H", tag_data[:2])[0]):
+ ifd_tag, typ, count, data = struct.unpack(
+ ">HHL4s", tag_data[i * 12 + 2 : (i + 1) * 12 + 2]
+ )
+ if ifd_tag == 0x1101:
+ # CameraInfo
+ (offset,) = struct.unpack(">L", data)
+ self.fp.seek(offset)
+
+ camerainfo = {"ModelID": self.fp.read(4)}
+
+ self.fp.read(4)
+ # Seconds since 2000
+ camerainfo["TimeStamp"] = i32le(self.fp.read(12))
+
+ self.fp.read(4)
+ camerainfo["InternalSerialNumber"] = self.fp.read(4)
+
+ self.fp.read(12)
+ parallax = self.fp.read(4)
+ handler = ImageFileDirectory_v2._load_dispatch[
+ TiffTags.FLOAT
+ ][1]
+ camerainfo["Parallax"] = handler(
+ ImageFileDirectory_v2(), parallax, False
+ )
+
+ self.fp.read(4)
+ camerainfo["Category"] = self.fp.read(2)
+
+ makernote = {0x1101: dict(self._fixup_dict(camerainfo))}
+ self._ifds[tag] = makernote
+ else:
+ # interop
+ self._ifds[tag] = self._get_ifd_dict(tag_data)
+ return self._ifds.get(tag, {})
+
+ def __str__(self):
+ if self._info is not None:
+ # Load all keys into self._data
+ for tag in self._info.keys():
+ self[tag]
+
+ return str(self._data)
+
+ def __len__(self):
+ keys = set(self._data)
+ if self._info is not None:
+ keys.update(self._info)
+ return len(keys)
+
+ def __getitem__(self, tag):
+ if self._info is not None and tag not in self._data and tag in self._info:
+ self._data[tag] = self._fixup(self._info[tag])
+ del self._info[tag]
+ return self._data[tag]
+
+ def __contains__(self, tag):
+ return tag in self._data or (self._info is not None and tag in self._info)
+
+ def __setitem__(self, tag, value):
+ if self._info is not None and tag in self._info:
+ del self._info[tag]
+ self._data[tag] = value
+
+ def __delitem__(self, tag):
+ if self._info is not None and tag in self._info:
+ del self._info[tag]
+ else:
+ del self._data[tag]
+
+ def __iter__(self):
+ keys = set(self._data)
+ if self._info is not None:
+ keys.update(self._info)
+ return iter(keys)
diff --git a/venv/Lib/site-packages/PIL/ImageChops.py b/venv/Lib/site-packages/PIL/ImageChops.py
new file mode 100644
index 0000000..61d3a29
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageChops.py
@@ -0,0 +1,328 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# standard channel operations
+#
+# History:
+# 1996-03-24 fl Created
+# 1996-08-13 fl Added logical operations (for "1" images)
+# 2000-10-12 fl Added offset method (from Image.py)
+#
+# Copyright (c) 1997-2000 by Secret Labs AB
+# Copyright (c) 1996-2000 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+from . import Image
+
+
+def constant(image, value):
+ """Fill a channel with a given grey level.
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ return Image.new("L", image.size, value)
+
+
+def duplicate(image):
+ """Copy a channel. Alias for :py:meth:`PIL.Image.Image.copy`.
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ return image.copy()
+
+
+def invert(image):
+ """
+ Invert an image (channel).
+
+ .. code-block:: python
+
+ out = MAX - image
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image.load()
+ return image._new(image.im.chop_invert())
+
+
+def lighter(image1, image2):
+ """
+ Compares the two images, pixel by pixel, and returns a new image containing
+ the lighter values.
+
+ .. code-block:: python
+
+ out = max(image1, image2)
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_lighter(image2.im))
+
+
+def darker(image1, image2):
+ """
+ Compares the two images, pixel by pixel, and returns a new image containing
+ the darker values.
+
+ .. code-block:: python
+
+ out = min(image1, image2)
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_darker(image2.im))
+
+
+def difference(image1, image2):
+ """
+ Returns the absolute value of the pixel-by-pixel difference between the two
+ images.
+
+ .. code-block:: python
+
+ out = abs(image1 - image2)
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_difference(image2.im))
+
+
+def multiply(image1, image2):
+ """
+ Superimposes two images on top of each other.
+
+ If you multiply an image with a solid black image, the result is black. If
+ you multiply with a solid white image, the image is unaffected.
+
+ .. code-block:: python
+
+ out = image1 * image2 / MAX
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_multiply(image2.im))
+
+
+def screen(image1, image2):
+ """
+ Superimposes two inverted images on top of each other.
+
+ .. code-block:: python
+
+ out = MAX - ((MAX - image1) * (MAX - image2) / MAX)
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_screen(image2.im))
+
+
+def soft_light(image1, image2):
+ """
+ Superimposes two images on top of each other using the Soft Light algorithm
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_soft_light(image2.im))
+
+
+def hard_light(image1, image2):
+ """
+ Superimposes two images on top of each other using the Hard Light algorithm
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_hard_light(image2.im))
+
+
+def overlay(image1, image2):
+ """
+ Superimposes two images on top of each other using the Overlay algorithm
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_overlay(image2.im))
+
+
+def add(image1, image2, scale=1.0, offset=0):
+ """
+ Adds two images, dividing the result by scale and adding the
+ offset. If omitted, scale defaults to 1.0, and offset to 0.0.
+
+ .. code-block:: python
+
+ out = ((image1 + image2) / scale + offset)
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_add(image2.im, scale, offset))
+
+
+def subtract(image1, image2, scale=1.0, offset=0):
+ """
+ Subtracts two images, dividing the result by scale and adding the offset.
+ If omitted, scale defaults to 1.0, and offset to 0.0.
+
+ .. code-block:: python
+
+ out = ((image1 - image2) / scale + offset)
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_subtract(image2.im, scale, offset))
+
+
+def add_modulo(image1, image2):
+ """Add two images, without clipping the result.
+
+ .. code-block:: python
+
+ out = ((image1 + image2) % MAX)
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_add_modulo(image2.im))
+
+
+def subtract_modulo(image1, image2):
+ """Subtract two images, without clipping the result.
+
+ .. code-block:: python
+
+ out = ((image1 - image2) % MAX)
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_subtract_modulo(image2.im))
+
+
+def logical_and(image1, image2):
+ """Logical AND between two images.
+
+ Both of the images must have mode "1". If you would like to perform a
+ logical AND on an image with a mode other than "1", try
+ :py:meth:`~PIL.ImageChops.multiply` instead, using a black-and-white mask
+ as the second image.
+
+ .. code-block:: python
+
+ out = ((image1 and image2) % MAX)
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_and(image2.im))
+
+
+def logical_or(image1, image2):
+ """Logical OR between two images.
+
+ Both of the images must have mode "1".
+
+ .. code-block:: python
+
+ out = ((image1 or image2) % MAX)
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_or(image2.im))
+
+
+def logical_xor(image1, image2):
+ """Logical XOR between two images.
+
+ Both of the images must have mode "1".
+
+ .. code-block:: python
+
+ out = ((bool(image1) != bool(image2)) % MAX)
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ image1.load()
+ image2.load()
+ return image1._new(image1.im.chop_xor(image2.im))
+
+
+def blend(image1, image2, alpha):
+ """Blend images using constant transparency weight. Alias for
+ :py:func:`PIL.Image.blend`.
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ return Image.blend(image1, image2, alpha)
+
+
+def composite(image1, image2, mask):
+ """Create composite using transparency mask. Alias for
+ :py:func:`PIL.Image.composite`.
+
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ return Image.composite(image1, image2, mask)
+
+
+def offset(image, xoffset, yoffset=None):
+ """Returns a copy of the image where data has been offset by the given
+ distances. Data wraps around the edges. If ``yoffset`` is omitted, it
+ is assumed to be equal to ``xoffset``.
+
+ :param xoffset: The horizontal distance.
+ :param yoffset: The vertical distance. If omitted, both
+ distances are set to the same value.
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+
+ if yoffset is None:
+ yoffset = xoffset
+ image.load()
+ return image._new(image.im.offset(xoffset, yoffset))
diff --git a/venv/Lib/site-packages/PIL/ImageCms.py b/venv/Lib/site-packages/PIL/ImageCms.py
new file mode 100644
index 0000000..8c4740d
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageCms.py
@@ -0,0 +1,999 @@
+# The Python Imaging Library.
+# $Id$
+
+# Optional color management support, based on Kevin Cazabon's PyCMS
+# library.
+
+# History:
+
+# 2009-03-08 fl Added to PIL.
+
+# Copyright (C) 2002-2003 Kevin Cazabon
+# Copyright (c) 2009 by Fredrik Lundh
+# Copyright (c) 2013 by Eric Soroos
+
+# See the README file for information on usage and redistribution. See
+# below for the original description.
+
+import sys
+
+from PIL import Image
+
+try:
+ from PIL import _imagingcms
+except ImportError as ex:
+ # Allow error import for doc purposes, but error out when accessing
+ # anything in core.
+ from ._util import deferred_error
+
+ _imagingcms = deferred_error(ex)
+
+DESCRIPTION = """
+pyCMS
+
+ a Python / PIL interface to the littleCMS ICC Color Management System
+ Copyright (C) 2002-2003 Kevin Cazabon
+ kevin@cazabon.com
+ http://www.cazabon.com
+
+ pyCMS home page: http://www.cazabon.com/pyCMS
+ littleCMS home page: http://www.littlecms.com
+ (littleCMS is Copyright (C) 1998-2001 Marti Maria)
+
+ Originally released under LGPL. Graciously donated to PIL in
+ March 2009, for distribution under the standard PIL license
+
+ The pyCMS.py module provides a "clean" interface between Python/PIL and
+ pyCMSdll, taking care of some of the more complex handling of the direct
+ pyCMSdll functions, as well as error-checking and making sure that all
+ relevant data is kept together.
+
+ While it is possible to call pyCMSdll functions directly, it's not highly
+ recommended.
+
+ Version History:
+
+ 1.0.0 pil Oct 2013 Port to LCMS 2.
+
+ 0.1.0 pil mod March 10, 2009
+
+ Renamed display profile to proof profile. The proof
+ profile is the profile of the device that is being
+ simulated, not the profile of the device which is
+ actually used to display/print the final simulation
+ (that'd be the output profile) - also see LCMSAPI.txt
+ input colorspace -> using 'renderingIntent' -> proof
+ colorspace -> using 'proofRenderingIntent' -> output
+ colorspace
+
+ Added LCMS FLAGS support.
+ Added FLAGS["SOFTPROOFING"] as default flag for
+ buildProofTransform (otherwise the proof profile/intent
+ would be ignored).
+
+ 0.1.0 pil March 2009 - added to PIL, as PIL.ImageCms
+
+ 0.0.2 alpha Jan 6, 2002
+
+ Added try/except statements around type() checks of
+ potential CObjects... Python won't let you use type()
+ on them, and raises a TypeError (stupid, if you ask
+ me!)
+
+ Added buildProofTransformFromOpenProfiles() function.
+ Additional fixes in DLL, see DLL code for details.
+
+ 0.0.1 alpha first public release, Dec. 26, 2002
+
+ Known to-do list with current version (of Python interface, not pyCMSdll):
+
+ none
+
+"""
+
+VERSION = "1.0.0 pil"
+
+# --------------------------------------------------------------------.
+
+core = _imagingcms
+
+#
+# intent/direction values
+
+INTENT_PERCEPTUAL = 0
+INTENT_RELATIVE_COLORIMETRIC = 1
+INTENT_SATURATION = 2
+INTENT_ABSOLUTE_COLORIMETRIC = 3
+
+DIRECTION_INPUT = 0
+DIRECTION_OUTPUT = 1
+DIRECTION_PROOF = 2
+
+#
+# flags
+
+FLAGS = {
+ "MATRIXINPUT": 1,
+ "MATRIXOUTPUT": 2,
+ "MATRIXONLY": (1 | 2),
+ "NOWHITEONWHITEFIXUP": 4, # Don't hot fix scum dot
+ # Don't create prelinearization tables on precalculated transforms
+ # (internal use):
+ "NOPRELINEARIZATION": 16,
+ "GUESSDEVICECLASS": 32, # Guess device class (for transform2devicelink)
+ "NOTCACHE": 64, # Inhibit 1-pixel cache
+ "NOTPRECALC": 256,
+ "NULLTRANSFORM": 512, # Don't transform anyway
+ "HIGHRESPRECALC": 1024, # Use more memory to give better accuracy
+ "LOWRESPRECALC": 2048, # Use less memory to minimize resources
+ "WHITEBLACKCOMPENSATION": 8192,
+ "BLACKPOINTCOMPENSATION": 8192,
+ "GAMUTCHECK": 4096, # Out of Gamut alarm
+ "SOFTPROOFING": 16384, # Do softproofing
+ "PRESERVEBLACK": 32768, # Black preservation
+ "NODEFAULTRESOURCEDEF": 16777216, # CRD special
+ "GRIDPOINTS": lambda n: ((n) & 0xFF) << 16, # Gridpoints
+}
+
+_MAX_FLAG = 0
+for flag in FLAGS.values():
+ if isinstance(flag, int):
+ _MAX_FLAG = _MAX_FLAG | flag
+
+
+# --------------------------------------------------------------------.
+# Experimental PIL-level API
+# --------------------------------------------------------------------.
+
+##
+# Profile.
+
+
+class ImageCmsProfile:
+ def __init__(self, profile):
+ """
+ :param profile: Either a string representing a filename,
+ a file like object containing a profile or a
+ low-level profile object
+
+ """
+
+ if isinstance(profile, str):
+ if sys.platform == "win32":
+ profile_bytes_path = profile.encode()
+ try:
+ profile_bytes_path.decode("ascii")
+ except UnicodeDecodeError:
+ with open(profile, "rb") as f:
+ self._set(core.profile_frombytes(f.read()))
+ return
+ self._set(core.profile_open(profile), profile)
+ elif hasattr(profile, "read"):
+ self._set(core.profile_frombytes(profile.read()))
+ elif isinstance(profile, _imagingcms.CmsProfile):
+ self._set(profile)
+ else:
+ raise TypeError("Invalid type for Profile")
+
+ def _set(self, profile, filename=None):
+ self.profile = profile
+ self.filename = filename
+ if profile:
+ self.product_name = None # profile.product_name
+ self.product_info = None # profile.product_info
+ else:
+ self.product_name = None
+ self.product_info = None
+
+ def tobytes(self):
+ """
+ Returns the profile in a format suitable for embedding in
+ saved images.
+
+ :returns: a bytes object containing the ICC profile.
+ """
+
+ return core.profile_tobytes(self.profile)
+
+
+class ImageCmsTransform(Image.ImagePointHandler):
+
+ """
+ Transform. This can be used with the procedural API, or with the standard
+ :py:func:`~PIL.Image.Image.point` method.
+
+ Will return the output profile in the ``output.info['icc_profile']``.
+ """
+
+ def __init__(
+ self,
+ input,
+ output,
+ input_mode,
+ output_mode,
+ intent=INTENT_PERCEPTUAL,
+ proof=None,
+ proof_intent=INTENT_ABSOLUTE_COLORIMETRIC,
+ flags=0,
+ ):
+ if proof is None:
+ self.transform = core.buildTransform(
+ input.profile, output.profile, input_mode, output_mode, intent, flags
+ )
+ else:
+ self.transform = core.buildProofTransform(
+ input.profile,
+ output.profile,
+ proof.profile,
+ input_mode,
+ output_mode,
+ intent,
+ proof_intent,
+ flags,
+ )
+ # Note: inputMode and outputMode are for pyCMS compatibility only
+ self.input_mode = self.inputMode = input_mode
+ self.output_mode = self.outputMode = output_mode
+
+ self.output_profile = output
+
+ def point(self, im):
+ return self.apply(im)
+
+ def apply(self, im, imOut=None):
+ im.load()
+ if imOut is None:
+ imOut = Image.new(self.output_mode, im.size, None)
+ self.transform.apply(im.im.id, imOut.im.id)
+ imOut.info["icc_profile"] = self.output_profile.tobytes()
+ return imOut
+
+ def apply_in_place(self, im):
+ im.load()
+ if im.mode != self.output_mode:
+ raise ValueError("mode mismatch") # wrong output mode
+ self.transform.apply(im.im.id, im.im.id)
+ im.info["icc_profile"] = self.output_profile.tobytes()
+ return im
+
+
+def get_display_profile(handle=None):
+ """
+ (experimental) Fetches the profile for the current display device.
+
+ :returns: ``None`` if the profile is not known.
+ """
+
+ if sys.platform != "win32":
+ return None
+
+ from PIL import ImageWin
+
+ if isinstance(handle, ImageWin.HDC):
+ profile = core.get_display_profile_win32(handle, 1)
+ else:
+ profile = core.get_display_profile_win32(handle or 0)
+ if profile is None:
+ return None
+ return ImageCmsProfile(profile)
+
+
+# --------------------------------------------------------------------.
+# pyCMS compatible layer
+# --------------------------------------------------------------------.
+
+
+class PyCMSError(Exception):
+
+ """(pyCMS) Exception class.
+ This is used for all errors in the pyCMS API."""
+
+ pass
+
+
+def profileToProfile(
+ im,
+ inputProfile,
+ outputProfile,
+ renderingIntent=INTENT_PERCEPTUAL,
+ outputMode=None,
+ inPlace=False,
+ flags=0,
+):
+ """
+ (pyCMS) Applies an ICC transformation to a given image, mapping from
+ ``inputProfile`` to ``outputProfile``.
+
+ If the input or output profiles specified are not valid filenames, a
+ :exc:`PyCMSError` will be raised. If ``inPlace`` is ``True`` and
+ ``outputMode != im.mode``, a :exc:`PyCMSError` will be raised.
+ If an error occurs during application of the profiles,
+ a :exc:`PyCMSError` will be raised.
+ If ``outputMode`` is not a mode supported by the ``outputProfile`` (or by pyCMS),
+ a :exc:`PyCMSError` will be raised.
+
+ This function applies an ICC transformation to im from ``inputProfile``'s
+ color space to ``outputProfile``'s color space using the specified rendering
+ intent to decide how to handle out-of-gamut colors.
+
+ ``outputMode`` can be used to specify that a color mode conversion is to
+ be done using these profiles, but the specified profiles must be able
+ to handle that mode. I.e., if converting im from RGB to CMYK using
+ profiles, the input profile must handle RGB data, and the output
+ profile must handle CMYK data.
+
+ :param im: An open :py:class:`~PIL.Image.Image` object (i.e. Image.new(...)
+ or Image.open(...), etc.)
+ :param inputProfile: String, as a valid filename path to the ICC input
+ profile you wish to use for this image, or a profile object
+ :param outputProfile: String, as a valid filename path to the ICC output
+ profile you wish to use for this image, or a profile object
+ :param renderingIntent: Integer (0-3) specifying the rendering intent you
+ wish to use for the transform
+
+ ImageCms.INTENT_PERCEPTUAL = 0 (DEFAULT)
+ ImageCms.INTENT_RELATIVE_COLORIMETRIC = 1
+ ImageCms.INTENT_SATURATION = 2
+ ImageCms.INTENT_ABSOLUTE_COLORIMETRIC = 3
+
+ see the pyCMS documentation for details on rendering intents and what
+ they do.
+ :param outputMode: A valid PIL mode for the output image (i.e. "RGB",
+ "CMYK", etc.). Note: if rendering the image "inPlace", outputMode
+ MUST be the same mode as the input, or omitted completely. If
+ omitted, the outputMode will be the same as the mode of the input
+ image (im.mode)
+ :param inPlace: Boolean. If ``True``, the original image is modified in-place,
+ and ``None`` is returned. If ``False`` (default), a new
+ :py:class:`~PIL.Image.Image` object is returned with the transform applied.
+ :param flags: Integer (0-...) specifying additional flags
+ :returns: Either None or a new :py:class:`~PIL.Image.Image` object, depending on
+ the value of ``inPlace``
+ :exception PyCMSError:
+ """
+
+ if outputMode is None:
+ outputMode = im.mode
+
+ if not isinstance(renderingIntent, int) or not (0 <= renderingIntent <= 3):
+ raise PyCMSError("renderingIntent must be an integer between 0 and 3")
+
+ if not isinstance(flags, int) or not (0 <= flags <= _MAX_FLAG):
+ raise PyCMSError("flags must be an integer between 0 and %s" + _MAX_FLAG)
+
+ try:
+ if not isinstance(inputProfile, ImageCmsProfile):
+ inputProfile = ImageCmsProfile(inputProfile)
+ if not isinstance(outputProfile, ImageCmsProfile):
+ outputProfile = ImageCmsProfile(outputProfile)
+ transform = ImageCmsTransform(
+ inputProfile,
+ outputProfile,
+ im.mode,
+ outputMode,
+ renderingIntent,
+ flags=flags,
+ )
+ if inPlace:
+ transform.apply_in_place(im)
+ imOut = None
+ else:
+ imOut = transform.apply(im)
+ except (OSError, TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+ return imOut
+
+
+def getOpenProfile(profileFilename):
+ """
+ (pyCMS) Opens an ICC profile file.
+
+ The PyCMSProfile object can be passed back into pyCMS for use in creating
+ transforms and such (as in ImageCms.buildTransformFromOpenProfiles()).
+
+ If ``profileFilename`` is not a valid filename for an ICC profile,
+ a :exc:`PyCMSError` will be raised.
+
+ :param profileFilename: String, as a valid filename path to the ICC profile
+ you wish to open, or a file-like object.
+ :returns: A CmsProfile class object.
+ :exception PyCMSError:
+ """
+
+ try:
+ return ImageCmsProfile(profileFilename)
+ except (OSError, TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+
+def buildTransform(
+ inputProfile,
+ outputProfile,
+ inMode,
+ outMode,
+ renderingIntent=INTENT_PERCEPTUAL,
+ flags=0,
+):
+ """
+ (pyCMS) Builds an ICC transform mapping from the ``inputProfile`` to the
+ ``outputProfile``. Use applyTransform to apply the transform to a given
+ image.
+
+ If the input or output profiles specified are not valid filenames, a
+ :exc:`PyCMSError` will be raised. If an error occurs during creation
+ of the transform, a :exc:`PyCMSError` will be raised.
+
+ If ``inMode`` or ``outMode`` are not a mode supported by the ``outputProfile``
+ (or by pyCMS), a :exc:`PyCMSError` will be raised.
+
+ This function builds and returns an ICC transform from the ``inputProfile``
+ to the ``outputProfile`` using the ``renderingIntent`` to determine what to do
+ with out-of-gamut colors. It will ONLY work for converting images that
+ are in ``inMode`` to images that are in ``outMode`` color format (PIL mode,
+ i.e. "RGB", "RGBA", "CMYK", etc.).
+
+ Building the transform is a fair part of the overhead in
+ ImageCms.profileToProfile(), so if you're planning on converting multiple
+ images using the same input/output settings, this can save you time.
+ Once you have a transform object, it can be used with
+ ImageCms.applyProfile() to convert images without the need to re-compute
+ the lookup table for the transform.
+
+ The reason pyCMS returns a class object rather than a handle directly
+ to the transform is that it needs to keep track of the PIL input/output
+ modes that the transform is meant for. These attributes are stored in
+ the ``inMode`` and ``outMode`` attributes of the object (which can be
+ manually overridden if you really want to, but I don't know of any
+ time that would be of use, or would even work).
+
+ :param inputProfile: String, as a valid filename path to the ICC input
+ profile you wish to use for this transform, or a profile object
+ :param outputProfile: String, as a valid filename path to the ICC output
+ profile you wish to use for this transform, or a profile object
+ :param inMode: String, as a valid PIL mode that the appropriate profile
+ also supports (i.e. "RGB", "RGBA", "CMYK", etc.)
+ :param outMode: String, as a valid PIL mode that the appropriate profile
+ also supports (i.e. "RGB", "RGBA", "CMYK", etc.)
+ :param renderingIntent: Integer (0-3) specifying the rendering intent you
+ wish to use for the transform
+
+ ImageCms.INTENT_PERCEPTUAL = 0 (DEFAULT)
+ ImageCms.INTENT_RELATIVE_COLORIMETRIC = 1
+ ImageCms.INTENT_SATURATION = 2
+ ImageCms.INTENT_ABSOLUTE_COLORIMETRIC = 3
+
+ see the pyCMS documentation for details on rendering intents and what
+ they do.
+ :param flags: Integer (0-...) specifying additional flags
+ :returns: A CmsTransform class object.
+ :exception PyCMSError:
+ """
+
+ if not isinstance(renderingIntent, int) or not (0 <= renderingIntent <= 3):
+ raise PyCMSError("renderingIntent must be an integer between 0 and 3")
+
+ if not isinstance(flags, int) or not (0 <= flags <= _MAX_FLAG):
+ raise PyCMSError("flags must be an integer between 0 and %s" + _MAX_FLAG)
+
+ try:
+ if not isinstance(inputProfile, ImageCmsProfile):
+ inputProfile = ImageCmsProfile(inputProfile)
+ if not isinstance(outputProfile, ImageCmsProfile):
+ outputProfile = ImageCmsProfile(outputProfile)
+ return ImageCmsTransform(
+ inputProfile, outputProfile, inMode, outMode, renderingIntent, flags=flags
+ )
+ except (OSError, TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+
+def buildProofTransform(
+ inputProfile,
+ outputProfile,
+ proofProfile,
+ inMode,
+ outMode,
+ renderingIntent=INTENT_PERCEPTUAL,
+ proofRenderingIntent=INTENT_ABSOLUTE_COLORIMETRIC,
+ flags=FLAGS["SOFTPROOFING"],
+):
+ """
+ (pyCMS) Builds an ICC transform mapping from the ``inputProfile`` to the
+ ``outputProfile``, but tries to simulate the result that would be
+ obtained on the ``proofProfile`` device.
+
+ If the input, output, or proof profiles specified are not valid
+ filenames, a :exc:`PyCMSError` will be raised.
+
+ If an error occurs during creation of the transform,
+ a :exc:`PyCMSError` will be raised.
+
+ If ``inMode`` or ``outMode`` are not a mode supported by the ``outputProfile``
+ (or by pyCMS), a :exc:`PyCMSError` will be raised.
+
+ This function builds and returns an ICC transform from the ``inputProfile``
+ to the ``outputProfile``, but tries to simulate the result that would be
+ obtained on the ``proofProfile`` device using ``renderingIntent`` and
+ ``proofRenderingIntent`` to determine what to do with out-of-gamut
+ colors. This is known as "soft-proofing". It will ONLY work for
+ converting images that are in ``inMode`` to images that are in outMode
+ color format (PIL mode, i.e. "RGB", "RGBA", "CMYK", etc.).
+
+ Usage of the resulting transform object is exactly the same as with
+ ImageCms.buildTransform().
+
+ Proof profiling is generally used when using an output device to get a
+ good idea of what the final printed/displayed image would look like on
+ the ``proofProfile`` device when it's quicker and easier to use the
+ output device for judging color. Generally, this means that the
+ output device is a monitor, or a dye-sub printer (etc.), and the simulated
+ device is something more expensive, complicated, or time consuming
+ (making it difficult to make a real print for color judgement purposes).
+
+ Soft-proofing basically functions by adjusting the colors on the
+ output device to match the colors of the device being simulated. However,
+ when the simulated device has a much wider gamut than the output
+ device, you may obtain marginal results.
+
+ :param inputProfile: String, as a valid filename path to the ICC input
+ profile you wish to use for this transform, or a profile object
+ :param outputProfile: String, as a valid filename path to the ICC output
+ (monitor, usually) profile you wish to use for this transform, or a
+ profile object
+ :param proofProfile: String, as a valid filename path to the ICC proof
+ profile you wish to use for this transform, or a profile object
+ :param inMode: String, as a valid PIL mode that the appropriate profile
+ also supports (i.e. "RGB", "RGBA", "CMYK", etc.)
+ :param outMode: String, as a valid PIL mode that the appropriate profile
+ also supports (i.e. "RGB", "RGBA", "CMYK", etc.)
+ :param renderingIntent: Integer (0-3) specifying the rendering intent you
+ wish to use for the input->proof (simulated) transform
+
+ ImageCms.INTENT_PERCEPTUAL = 0 (DEFAULT)
+ ImageCms.INTENT_RELATIVE_COLORIMETRIC = 1
+ ImageCms.INTENT_SATURATION = 2
+ ImageCms.INTENT_ABSOLUTE_COLORIMETRIC = 3
+
+ see the pyCMS documentation for details on rendering intents and what
+ they do.
+ :param proofRenderingIntent: Integer (0-3) specifying the rendering intent
+ you wish to use for proof->output transform
+
+ ImageCms.INTENT_PERCEPTUAL = 0 (DEFAULT)
+ ImageCms.INTENT_RELATIVE_COLORIMETRIC = 1
+ ImageCms.INTENT_SATURATION = 2
+ ImageCms.INTENT_ABSOLUTE_COLORIMETRIC = 3
+
+ see the pyCMS documentation for details on rendering intents and what
+ they do.
+ :param flags: Integer (0-...) specifying additional flags
+ :returns: A CmsTransform class object.
+ :exception PyCMSError:
+ """
+
+ if not isinstance(renderingIntent, int) or not (0 <= renderingIntent <= 3):
+ raise PyCMSError("renderingIntent must be an integer between 0 and 3")
+
+ if not isinstance(flags, int) or not (0 <= flags <= _MAX_FLAG):
+ raise PyCMSError("flags must be an integer between 0 and %s" + _MAX_FLAG)
+
+ try:
+ if not isinstance(inputProfile, ImageCmsProfile):
+ inputProfile = ImageCmsProfile(inputProfile)
+ if not isinstance(outputProfile, ImageCmsProfile):
+ outputProfile = ImageCmsProfile(outputProfile)
+ if not isinstance(proofProfile, ImageCmsProfile):
+ proofProfile = ImageCmsProfile(proofProfile)
+ return ImageCmsTransform(
+ inputProfile,
+ outputProfile,
+ inMode,
+ outMode,
+ renderingIntent,
+ proofProfile,
+ proofRenderingIntent,
+ flags,
+ )
+ except (OSError, TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+
+buildTransformFromOpenProfiles = buildTransform
+buildProofTransformFromOpenProfiles = buildProofTransform
+
+
+def applyTransform(im, transform, inPlace=False):
+ """
+ (pyCMS) Applies a transform to a given image.
+
+ If ``im.mode != transform.inMode``, a :exc:`PyCMSError` is raised.
+
+ If ``inPlace`` is ``True`` and ``transform.inMode != transform.outMode``, a
+ :exc:`PyCMSError` is raised.
+
+ If ``im.mode``, ``transform.inMode`` or ``transform.outMode`` is not
+ supported by pyCMSdll or the profiles you used for the transform, a
+ :exc:`PyCMSError` is raised.
+
+ If an error occurs while the transform is being applied,
+ a :exc:`PyCMSError` is raised.
+
+ This function applies a pre-calculated transform (from
+ ImageCms.buildTransform() or ImageCms.buildTransformFromOpenProfiles())
+ to an image. The transform can be used for multiple images, saving
+ considerable calculation time if doing the same conversion multiple times.
+
+ If you want to modify im in-place instead of receiving a new image as
+ the return value, set ``inPlace`` to ``True``. This can only be done if
+ ``transform.inMode`` and ``transform.outMode`` are the same, because we can't
+ change the mode in-place (the buffer sizes for some modes are
+ different). The default behavior is to return a new :py:class:`~PIL.Image.Image`
+ object of the same dimensions in mode ``transform.outMode``.
+
+ :param im: An :py:class:`~PIL.Image.Image` object, and im.mode must be the same
+ as the ``inMode`` supported by the transform.
+ :param transform: A valid CmsTransform class object
+ :param inPlace: Bool. If ``True``, ``im`` is modified in place and ``None`` is
+ returned, if ``False``, a new :py:class:`~PIL.Image.Image` object with the
+ transform applied is returned (and ``im`` is not changed). The default is
+ ``False``.
+ :returns: Either ``None``, or a new :py:class:`~PIL.Image.Image` object,
+ depending on the value of ``inPlace``. The profile will be returned in
+ the image's ``info['icc_profile']``.
+ :exception PyCMSError:
+ """
+
+ try:
+ if inPlace:
+ transform.apply_in_place(im)
+ imOut = None
+ else:
+ imOut = transform.apply(im)
+ except (TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+ return imOut
+
+
+def createProfile(colorSpace, colorTemp=-1):
+ """
+ (pyCMS) Creates a profile.
+
+ If colorSpace not in ``["LAB", "XYZ", "sRGB"]``,
+ a :exc:`PyCMSError` is raised.
+
+ If using LAB and ``colorTemp`` is not a positive integer,
+ a :exc:`PyCMSError` is raised.
+
+ If an error occurs while creating the profile,
+ a :exc:`PyCMSError` is raised.
+
+ Use this function to create common profiles on-the-fly instead of
+ having to supply a profile on disk and knowing the path to it. It
+ returns a normal CmsProfile object that can be passed to
+ ImageCms.buildTransformFromOpenProfiles() to create a transform to apply
+ to images.
+
+ :param colorSpace: String, the color space of the profile you wish to
+ create.
+ Currently only "LAB", "XYZ", and "sRGB" are supported.
+ :param colorTemp: Positive integer for the white point for the profile, in
+ degrees Kelvin (i.e. 5000, 6500, 9600, etc.). The default is for D50
+ illuminant if omitted (5000k). colorTemp is ONLY applied to LAB
+ profiles, and is ignored for XYZ and sRGB.
+ :returns: A CmsProfile class object
+ :exception PyCMSError:
+ """
+
+ if colorSpace not in ["LAB", "XYZ", "sRGB"]:
+ raise PyCMSError(
+ f"Color space not supported for on-the-fly profile creation ({colorSpace})"
+ )
+
+ if colorSpace == "LAB":
+ try:
+ colorTemp = float(colorTemp)
+ except (TypeError, ValueError) as e:
+ raise PyCMSError(
+ f'Color temperature must be numeric, "{colorTemp}" not valid'
+ ) from e
+
+ try:
+ return core.createProfile(colorSpace, colorTemp)
+ except (TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+
+def getProfileName(profile):
+ """
+
+ (pyCMS) Gets the internal product name for the given profile.
+
+ If ``profile`` isn't a valid CmsProfile object or filename to a profile,
+ a :exc:`PyCMSError` is raised If an error occurs while trying
+ to obtain the name tag, a :exc:`PyCMSError` is raised.
+
+ Use this function to obtain the INTERNAL name of the profile (stored
+ in an ICC tag in the profile itself), usually the one used when the
+ profile was originally created. Sometimes this tag also contains
+ additional information supplied by the creator.
+
+ :param profile: EITHER a valid CmsProfile object, OR a string of the
+ filename of an ICC profile.
+ :returns: A string containing the internal name of the profile as stored
+ in an ICC tag.
+ :exception PyCMSError:
+ """
+
+ try:
+ # add an extra newline to preserve pyCMS compatibility
+ if not isinstance(profile, ImageCmsProfile):
+ profile = ImageCmsProfile(profile)
+ # do it in python, not c.
+ # // name was "%s - %s" (model, manufacturer) || Description ,
+ # // but if the Model and Manufacturer were the same or the model
+ # // was long, Just the model, in 1.x
+ model = profile.profile.model
+ manufacturer = profile.profile.manufacturer
+
+ if not (model or manufacturer):
+ return (profile.profile.profile_description or "") + "\n"
+ if not manufacturer or len(model) > 30:
+ return model + "\n"
+ return f"{model} - {manufacturer}\n"
+
+ except (AttributeError, OSError, TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+
+def getProfileInfo(profile):
+ """
+ (pyCMS) Gets the internal product information for the given profile.
+
+ If ``profile`` isn't a valid CmsProfile object or filename to a profile,
+ a :exc:`PyCMSError` is raised.
+
+ If an error occurs while trying to obtain the info tag,
+ a :exc:`PyCMSError` is raised.
+
+ Use this function to obtain the information stored in the profile's
+ info tag. This often contains details about the profile, and how it
+ was created, as supplied by the creator.
+
+ :param profile: EITHER a valid CmsProfile object, OR a string of the
+ filename of an ICC profile.
+ :returns: A string containing the internal profile information stored in
+ an ICC tag.
+ :exception PyCMSError:
+ """
+
+ try:
+ if not isinstance(profile, ImageCmsProfile):
+ profile = ImageCmsProfile(profile)
+ # add an extra newline to preserve pyCMS compatibility
+ # Python, not C. the white point bits weren't working well,
+ # so skipping.
+ # info was description \r\n\r\n copyright \r\n\r\n K007 tag \r\n\r\n whitepoint
+ description = profile.profile.profile_description
+ cpright = profile.profile.copyright
+ arr = []
+ for elt in (description, cpright):
+ if elt:
+ arr.append(elt)
+ return "\r\n\r\n".join(arr) + "\r\n\r\n"
+
+ except (AttributeError, OSError, TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+
+def getProfileCopyright(profile):
+ """
+ (pyCMS) Gets the copyright for the given profile.
+
+ If ``profile`` isn't a valid CmsProfile object or filename to a profile, a
+ :exc:`PyCMSError` is raised.
+
+ If an error occurs while trying to obtain the copyright tag,
+ a :exc:`PyCMSError` is raised.
+
+ Use this function to obtain the information stored in the profile's
+ copyright tag.
+
+ :param profile: EITHER a valid CmsProfile object, OR a string of the
+ filename of an ICC profile.
+ :returns: A string containing the internal profile information stored in
+ an ICC tag.
+ :exception PyCMSError:
+ """
+ try:
+ # add an extra newline to preserve pyCMS compatibility
+ if not isinstance(profile, ImageCmsProfile):
+ profile = ImageCmsProfile(profile)
+ return (profile.profile.copyright or "") + "\n"
+ except (AttributeError, OSError, TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+
+def getProfileManufacturer(profile):
+ """
+ (pyCMS) Gets the manufacturer for the given profile.
+
+ If ``profile`` isn't a valid CmsProfile object or filename to a profile, a
+ :exc:`PyCMSError` is raised.
+
+ If an error occurs while trying to obtain the manufacturer tag, a
+ :exc:`PyCMSError` is raised.
+
+ Use this function to obtain the information stored in the profile's
+ manufacturer tag.
+
+ :param profile: EITHER a valid CmsProfile object, OR a string of the
+ filename of an ICC profile.
+ :returns: A string containing the internal profile information stored in
+ an ICC tag.
+ :exception PyCMSError:
+ """
+ try:
+ # add an extra newline to preserve pyCMS compatibility
+ if not isinstance(profile, ImageCmsProfile):
+ profile = ImageCmsProfile(profile)
+ return (profile.profile.manufacturer or "") + "\n"
+ except (AttributeError, OSError, TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+
+def getProfileModel(profile):
+ """
+ (pyCMS) Gets the model for the given profile.
+
+ If ``profile`` isn't a valid CmsProfile object or filename to a profile, a
+ :exc:`PyCMSError` is raised.
+
+ If an error occurs while trying to obtain the model tag,
+ a :exc:`PyCMSError` is raised.
+
+ Use this function to obtain the information stored in the profile's
+ model tag.
+
+ :param profile: EITHER a valid CmsProfile object, OR a string of the
+ filename of an ICC profile.
+ :returns: A string containing the internal profile information stored in
+ an ICC tag.
+ :exception PyCMSError:
+ """
+
+ try:
+ # add an extra newline to preserve pyCMS compatibility
+ if not isinstance(profile, ImageCmsProfile):
+ profile = ImageCmsProfile(profile)
+ return (profile.profile.model or "") + "\n"
+ except (AttributeError, OSError, TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+
+def getProfileDescription(profile):
+ """
+ (pyCMS) Gets the description for the given profile.
+
+ If ``profile`` isn't a valid CmsProfile object or filename to a profile, a
+ :exc:`PyCMSError` is raised.
+
+ If an error occurs while trying to obtain the description tag,
+ a :exc:`PyCMSError` is raised.
+
+ Use this function to obtain the information stored in the profile's
+ description tag.
+
+ :param profile: EITHER a valid CmsProfile object, OR a string of the
+ filename of an ICC profile.
+ :returns: A string containing the internal profile information stored in an
+ ICC tag.
+ :exception PyCMSError:
+ """
+
+ try:
+ # add an extra newline to preserve pyCMS compatibility
+ if not isinstance(profile, ImageCmsProfile):
+ profile = ImageCmsProfile(profile)
+ return (profile.profile.profile_description or "") + "\n"
+ except (AttributeError, OSError, TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+
+def getDefaultIntent(profile):
+ """
+ (pyCMS) Gets the default intent name for the given profile.
+
+ If ``profile`` isn't a valid CmsProfile object or filename to a profile, a
+ :exc:`PyCMSError` is raised.
+
+ If an error occurs while trying to obtain the default intent, a
+ :exc:`PyCMSError` is raised.
+
+ Use this function to determine the default (and usually best optimized)
+ rendering intent for this profile. Most profiles support multiple
+ rendering intents, but are intended mostly for one type of conversion.
+ If you wish to use a different intent than returned, use
+ ImageCms.isIntentSupported() to verify it will work first.
+
+ :param profile: EITHER a valid CmsProfile object, OR a string of the
+ filename of an ICC profile.
+ :returns: Integer 0-3 specifying the default rendering intent for this
+ profile.
+
+ ImageCms.INTENT_PERCEPTUAL = 0 (DEFAULT)
+ ImageCms.INTENT_RELATIVE_COLORIMETRIC = 1
+ ImageCms.INTENT_SATURATION = 2
+ ImageCms.INTENT_ABSOLUTE_COLORIMETRIC = 3
+
+ see the pyCMS documentation for details on rendering intents and what
+ they do.
+ :exception PyCMSError:
+ """
+
+ try:
+ if not isinstance(profile, ImageCmsProfile):
+ profile = ImageCmsProfile(profile)
+ return profile.profile.rendering_intent
+ except (AttributeError, OSError, TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+
+def isIntentSupported(profile, intent, direction):
+ """
+ (pyCMS) Checks if a given intent is supported.
+
+ Use this function to verify that you can use your desired
+ ``intent`` with ``profile``, and that ``profile`` can be used for the
+ input/output/proof profile as you desire.
+
+ Some profiles are created specifically for one "direction", can cannot
+ be used for others. Some profiles can only be used for certain
+ rendering intents, so it's best to either verify this before trying
+ to create a transform with them (using this function), or catch the
+ potential :exc:`PyCMSError` that will occur if they don't
+ support the modes you select.
+
+ :param profile: EITHER a valid CmsProfile object, OR a string of the
+ filename of an ICC profile.
+ :param intent: Integer (0-3) specifying the rendering intent you wish to
+ use with this profile
+
+ ImageCms.INTENT_PERCEPTUAL = 0 (DEFAULT)
+ ImageCms.INTENT_RELATIVE_COLORIMETRIC = 1
+ ImageCms.INTENT_SATURATION = 2
+ ImageCms.INTENT_ABSOLUTE_COLORIMETRIC = 3
+
+ see the pyCMS documentation for details on rendering intents and what
+ they do.
+ :param direction: Integer specifying if the profile is to be used for
+ input, output, or proof
+
+ INPUT = 0 (or use ImageCms.DIRECTION_INPUT)
+ OUTPUT = 1 (or use ImageCms.DIRECTION_OUTPUT)
+ PROOF = 2 (or use ImageCms.DIRECTION_PROOF)
+
+ :returns: 1 if the intent/direction are supported, -1 if they are not.
+ :exception PyCMSError:
+ """
+
+ try:
+ if not isinstance(profile, ImageCmsProfile):
+ profile = ImageCmsProfile(profile)
+ # FIXME: I get different results for the same data w. different
+ # compilers. Bug in LittleCMS or in the binding?
+ if profile.profile.is_intent_supported(intent, direction):
+ return 1
+ else:
+ return -1
+ except (AttributeError, OSError, TypeError, ValueError) as v:
+ raise PyCMSError(v) from v
+
+
+def versions():
+ """
+ (pyCMS) Fetches versions.
+ """
+
+ return (VERSION, core.littlecms_version, sys.version.split()[0], Image.__version__)
diff --git a/venv/Lib/site-packages/PIL/ImageColor.py b/venv/Lib/site-packages/PIL/ImageColor.py
new file mode 100644
index 0000000..51df440
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageColor.py
@@ -0,0 +1,300 @@
+#
+# The Python Imaging Library
+# $Id$
+#
+# map CSS3-style colour description strings to RGB
+#
+# History:
+# 2002-10-24 fl Added support for CSS-style color strings
+# 2002-12-15 fl Added RGBA support
+# 2004-03-27 fl Fixed remaining int() problems for Python 1.5.2
+# 2004-07-19 fl Fixed gray/grey spelling issues
+# 2009-03-05 fl Fixed rounding error in grayscale calculation
+#
+# Copyright (c) 2002-2004 by Secret Labs AB
+# Copyright (c) 2002-2004 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import re
+
+from . import Image
+
+
+def getrgb(color):
+ """
+ Convert a color string to an RGB or RGBA tuple. If the string cannot be
+ parsed, this function raises a :py:exc:`ValueError` exception.
+
+ .. versionadded:: 1.1.4
+
+ :param color: A color string
+ :return: ``(red, green, blue[, alpha])``
+ """
+ color = color.lower()
+
+ rgb = colormap.get(color, None)
+ if rgb:
+ if isinstance(rgb, tuple):
+ return rgb
+ colormap[color] = rgb = getrgb(rgb)
+ return rgb
+
+ # check for known string formats
+ if re.match("#[a-f0-9]{3}$", color):
+ return (int(color[1] * 2, 16), int(color[2] * 2, 16), int(color[3] * 2, 16))
+
+ if re.match("#[a-f0-9]{4}$", color):
+ return (
+ int(color[1] * 2, 16),
+ int(color[2] * 2, 16),
+ int(color[3] * 2, 16),
+ int(color[4] * 2, 16),
+ )
+
+ if re.match("#[a-f0-9]{6}$", color):
+ return (int(color[1:3], 16), int(color[3:5], 16), int(color[5:7], 16))
+
+ if re.match("#[a-f0-9]{8}$", color):
+ return (
+ int(color[1:3], 16),
+ int(color[3:5], 16),
+ int(color[5:7], 16),
+ int(color[7:9], 16),
+ )
+
+ m = re.match(r"rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color)
+ if m:
+ return (int(m.group(1)), int(m.group(2)), int(m.group(3)))
+
+ m = re.match(r"rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$", color)
+ if m:
+ return (
+ int((int(m.group(1)) * 255) / 100.0 + 0.5),
+ int((int(m.group(2)) * 255) / 100.0 + 0.5),
+ int((int(m.group(3)) * 255) / 100.0 + 0.5),
+ )
+
+ m = re.match(
+ r"hsl\(\s*(\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*\)$", color
+ )
+ if m:
+ from colorsys import hls_to_rgb
+
+ rgb = hls_to_rgb(
+ float(m.group(1)) / 360.0,
+ float(m.group(3)) / 100.0,
+ float(m.group(2)) / 100.0,
+ )
+ return (
+ int(rgb[0] * 255 + 0.5),
+ int(rgb[1] * 255 + 0.5),
+ int(rgb[2] * 255 + 0.5),
+ )
+
+ m = re.match(
+ r"hs[bv]\(\s*(\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*\)$", color
+ )
+ if m:
+ from colorsys import hsv_to_rgb
+
+ rgb = hsv_to_rgb(
+ float(m.group(1)) / 360.0,
+ float(m.group(2)) / 100.0,
+ float(m.group(3)) / 100.0,
+ )
+ return (
+ int(rgb[0] * 255 + 0.5),
+ int(rgb[1] * 255 + 0.5),
+ int(rgb[2] * 255 + 0.5),
+ )
+
+ m = re.match(r"rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color)
+ if m:
+ return (int(m.group(1)), int(m.group(2)), int(m.group(3)), int(m.group(4)))
+ raise ValueError(f"unknown color specifier: {repr(color)}")
+
+
+def getcolor(color, mode):
+ """
+ Same as :py:func:`~PIL.ImageColor.getrgb`, but converts the RGB value to a
+ greyscale value if the mode is not color or a palette image. If the string
+ cannot be parsed, this function raises a :py:exc:`ValueError` exception.
+
+ .. versionadded:: 1.1.4
+
+ :param color: A color string
+ :return: ``(graylevel [, alpha]) or (red, green, blue[, alpha])``
+ """
+ # same as getrgb, but converts the result to the given mode
+ color, alpha = getrgb(color), 255
+ if len(color) == 4:
+ color, alpha = color[0:3], color[3]
+
+ if Image.getmodebase(mode) == "L":
+ r, g, b = color
+ # ITU-R Recommendation 601-2 for nonlinear RGB
+ # scaled to 24 bits to match the convert's implementation.
+ color = (r * 19595 + g * 38470 + b * 7471 + 0x8000) >> 16
+ if mode[-1] == "A":
+ return (color, alpha)
+ else:
+ if mode[-1] == "A":
+ return color + (alpha,)
+ return color
+
+
+colormap = {
+ # X11 colour table from https://drafts.csswg.org/css-color-4/, with
+ # gray/grey spelling issues fixed. This is a superset of HTML 4.0
+ # colour names used in CSS 1.
+ "aliceblue": "#f0f8ff",
+ "antiquewhite": "#faebd7",
+ "aqua": "#00ffff",
+ "aquamarine": "#7fffd4",
+ "azure": "#f0ffff",
+ "beige": "#f5f5dc",
+ "bisque": "#ffe4c4",
+ "black": "#000000",
+ "blanchedalmond": "#ffebcd",
+ "blue": "#0000ff",
+ "blueviolet": "#8a2be2",
+ "brown": "#a52a2a",
+ "burlywood": "#deb887",
+ "cadetblue": "#5f9ea0",
+ "chartreuse": "#7fff00",
+ "chocolate": "#d2691e",
+ "coral": "#ff7f50",
+ "cornflowerblue": "#6495ed",
+ "cornsilk": "#fff8dc",
+ "crimson": "#dc143c",
+ "cyan": "#00ffff",
+ "darkblue": "#00008b",
+ "darkcyan": "#008b8b",
+ "darkgoldenrod": "#b8860b",
+ "darkgray": "#a9a9a9",
+ "darkgrey": "#a9a9a9",
+ "darkgreen": "#006400",
+ "darkkhaki": "#bdb76b",
+ "darkmagenta": "#8b008b",
+ "darkolivegreen": "#556b2f",
+ "darkorange": "#ff8c00",
+ "darkorchid": "#9932cc",
+ "darkred": "#8b0000",
+ "darksalmon": "#e9967a",
+ "darkseagreen": "#8fbc8f",
+ "darkslateblue": "#483d8b",
+ "darkslategray": "#2f4f4f",
+ "darkslategrey": "#2f4f4f",
+ "darkturquoise": "#00ced1",
+ "darkviolet": "#9400d3",
+ "deeppink": "#ff1493",
+ "deepskyblue": "#00bfff",
+ "dimgray": "#696969",
+ "dimgrey": "#696969",
+ "dodgerblue": "#1e90ff",
+ "firebrick": "#b22222",
+ "floralwhite": "#fffaf0",
+ "forestgreen": "#228b22",
+ "fuchsia": "#ff00ff",
+ "gainsboro": "#dcdcdc",
+ "ghostwhite": "#f8f8ff",
+ "gold": "#ffd700",
+ "goldenrod": "#daa520",
+ "gray": "#808080",
+ "grey": "#808080",
+ "green": "#008000",
+ "greenyellow": "#adff2f",
+ "honeydew": "#f0fff0",
+ "hotpink": "#ff69b4",
+ "indianred": "#cd5c5c",
+ "indigo": "#4b0082",
+ "ivory": "#fffff0",
+ "khaki": "#f0e68c",
+ "lavender": "#e6e6fa",
+ "lavenderblush": "#fff0f5",
+ "lawngreen": "#7cfc00",
+ "lemonchiffon": "#fffacd",
+ "lightblue": "#add8e6",
+ "lightcoral": "#f08080",
+ "lightcyan": "#e0ffff",
+ "lightgoldenrodyellow": "#fafad2",
+ "lightgreen": "#90ee90",
+ "lightgray": "#d3d3d3",
+ "lightgrey": "#d3d3d3",
+ "lightpink": "#ffb6c1",
+ "lightsalmon": "#ffa07a",
+ "lightseagreen": "#20b2aa",
+ "lightskyblue": "#87cefa",
+ "lightslategray": "#778899",
+ "lightslategrey": "#778899",
+ "lightsteelblue": "#b0c4de",
+ "lightyellow": "#ffffe0",
+ "lime": "#00ff00",
+ "limegreen": "#32cd32",
+ "linen": "#faf0e6",
+ "magenta": "#ff00ff",
+ "maroon": "#800000",
+ "mediumaquamarine": "#66cdaa",
+ "mediumblue": "#0000cd",
+ "mediumorchid": "#ba55d3",
+ "mediumpurple": "#9370db",
+ "mediumseagreen": "#3cb371",
+ "mediumslateblue": "#7b68ee",
+ "mediumspringgreen": "#00fa9a",
+ "mediumturquoise": "#48d1cc",
+ "mediumvioletred": "#c71585",
+ "midnightblue": "#191970",
+ "mintcream": "#f5fffa",
+ "mistyrose": "#ffe4e1",
+ "moccasin": "#ffe4b5",
+ "navajowhite": "#ffdead",
+ "navy": "#000080",
+ "oldlace": "#fdf5e6",
+ "olive": "#808000",
+ "olivedrab": "#6b8e23",
+ "orange": "#ffa500",
+ "orangered": "#ff4500",
+ "orchid": "#da70d6",
+ "palegoldenrod": "#eee8aa",
+ "palegreen": "#98fb98",
+ "paleturquoise": "#afeeee",
+ "palevioletred": "#db7093",
+ "papayawhip": "#ffefd5",
+ "peachpuff": "#ffdab9",
+ "peru": "#cd853f",
+ "pink": "#ffc0cb",
+ "plum": "#dda0dd",
+ "powderblue": "#b0e0e6",
+ "purple": "#800080",
+ "rebeccapurple": "#663399",
+ "red": "#ff0000",
+ "rosybrown": "#bc8f8f",
+ "royalblue": "#4169e1",
+ "saddlebrown": "#8b4513",
+ "salmon": "#fa8072",
+ "sandybrown": "#f4a460",
+ "seagreen": "#2e8b57",
+ "seashell": "#fff5ee",
+ "sienna": "#a0522d",
+ "silver": "#c0c0c0",
+ "skyblue": "#87ceeb",
+ "slateblue": "#6a5acd",
+ "slategray": "#708090",
+ "slategrey": "#708090",
+ "snow": "#fffafa",
+ "springgreen": "#00ff7f",
+ "steelblue": "#4682b4",
+ "tan": "#d2b48c",
+ "teal": "#008080",
+ "thistle": "#d8bfd8",
+ "tomato": "#ff6347",
+ "turquoise": "#40e0d0",
+ "violet": "#ee82ee",
+ "wheat": "#f5deb3",
+ "white": "#ffffff",
+ "whitesmoke": "#f5f5f5",
+ "yellow": "#ffff00",
+ "yellowgreen": "#9acd32",
+}
diff --git a/venv/Lib/site-packages/PIL/ImageDraw.py b/venv/Lib/site-packages/PIL/ImageDraw.py
new file mode 100644
index 0000000..8988e42
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageDraw.py
@@ -0,0 +1,988 @@
+#
+# The Python Imaging Library
+# $Id$
+#
+# drawing interface operations
+#
+# History:
+# 1996-04-13 fl Created (experimental)
+# 1996-08-07 fl Filled polygons, ellipses.
+# 1996-08-13 fl Added text support
+# 1998-06-28 fl Handle I and F images
+# 1998-12-29 fl Added arc; use arc primitive to draw ellipses
+# 1999-01-10 fl Added shape stuff (experimental)
+# 1999-02-06 fl Added bitmap support
+# 1999-02-11 fl Changed all primitives to take options
+# 1999-02-20 fl Fixed backwards compatibility
+# 2000-10-12 fl Copy on write, when necessary
+# 2001-02-18 fl Use default ink for bitmap/text also in fill mode
+# 2002-10-24 fl Added support for CSS-style color strings
+# 2002-12-10 fl Added experimental support for RGBA-on-RGB drawing
+# 2002-12-11 fl Refactored low-level drawing API (work in progress)
+# 2004-08-26 fl Made Draw() a factory function, added getdraw() support
+# 2004-09-04 fl Added width support to line primitive
+# 2004-09-10 fl Added font mode handling
+# 2006-06-19 fl Added font bearing support (getmask2)
+#
+# Copyright (c) 1997-2006 by Secret Labs AB
+# Copyright (c) 1996-2006 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import math
+import numbers
+
+from . import Image, ImageColor
+
+"""
+A simple 2D drawing interface for PIL images.
+
+Application code should use the Draw factory, instead of
+directly.
+"""
+
+
+class ImageDraw:
+ def __init__(self, im, mode=None):
+ """
+ Create a drawing instance.
+
+ :param im: The image to draw in.
+ :param mode: Optional mode to use for color values. For RGB
+ images, this argument can be RGB or RGBA (to blend the
+ drawing into the image). For all other modes, this argument
+ must be the same as the image mode. If omitted, the mode
+ defaults to the mode of the image.
+ """
+ im.load()
+ if im.readonly:
+ im._copy() # make it writeable
+ blend = 0
+ if mode is None:
+ mode = im.mode
+ if mode != im.mode:
+ if mode == "RGBA" and im.mode == "RGB":
+ blend = 1
+ else:
+ raise ValueError("mode mismatch")
+ if mode == "P":
+ self.palette = im.palette
+ else:
+ self.palette = None
+ self.im = im.im
+ self.draw = Image.core.draw(self.im, blend)
+ self.mode = mode
+ if mode in ("I", "F"):
+ self.ink = self.draw.draw_ink(1)
+ else:
+ self.ink = self.draw.draw_ink(-1)
+ if mode in ("1", "P", "I", "F"):
+ # FIXME: fix Fill2 to properly support matte for I+F images
+ self.fontmode = "1"
+ else:
+ self.fontmode = "L" # aliasing is okay for other modes
+ self.fill = 0
+ self.font = None
+
+ def getfont(self):
+ """
+ Get the current default font.
+
+ :returns: An image font."""
+ if not self.font:
+ # FIXME: should add a font repository
+ from . import ImageFont
+
+ self.font = ImageFont.load_default()
+ return self.font
+
+ def _getink(self, ink, fill=None):
+ if ink is None and fill is None:
+ if self.fill:
+ fill = self.ink
+ else:
+ ink = self.ink
+ else:
+ if ink is not None:
+ if isinstance(ink, str):
+ ink = ImageColor.getcolor(ink, self.mode)
+ if self.palette and not isinstance(ink, numbers.Number):
+ ink = self.palette.getcolor(ink)
+ ink = self.draw.draw_ink(ink)
+ if fill is not None:
+ if isinstance(fill, str):
+ fill = ImageColor.getcolor(fill, self.mode)
+ if self.palette and not isinstance(fill, numbers.Number):
+ fill = self.palette.getcolor(fill)
+ fill = self.draw.draw_ink(fill)
+ return ink, fill
+
+ def arc(self, xy, start, end, fill=None, width=1):
+ """Draw an arc."""
+ ink, fill = self._getink(fill)
+ if ink is not None:
+ self.draw.draw_arc(xy, start, end, ink, width)
+
+ def bitmap(self, xy, bitmap, fill=None):
+ """Draw a bitmap."""
+ bitmap.load()
+ ink, fill = self._getink(fill)
+ if ink is None:
+ ink = fill
+ if ink is not None:
+ self.draw.draw_bitmap(xy, bitmap.im, ink)
+
+ def chord(self, xy, start, end, fill=None, outline=None, width=1):
+ """Draw a chord."""
+ ink, fill = self._getink(outline, fill)
+ if fill is not None:
+ self.draw.draw_chord(xy, start, end, fill, 1)
+ if ink is not None and ink != fill and width != 0:
+ self.draw.draw_chord(xy, start, end, ink, 0, width)
+
+ def ellipse(self, xy, fill=None, outline=None, width=1):
+ """Draw an ellipse."""
+ ink, fill = self._getink(outline, fill)
+ if fill is not None:
+ self.draw.draw_ellipse(xy, fill, 1)
+ if ink is not None and ink != fill and width != 0:
+ self.draw.draw_ellipse(xy, ink, 0, width)
+
+ def line(self, xy, fill=None, width=0, joint=None):
+ """Draw a line, or a connected sequence of line segments."""
+ ink = self._getink(fill)[0]
+ if ink is not None:
+ self.draw.draw_lines(xy, ink, width)
+ if joint == "curve" and width > 4:
+ if not isinstance(xy[0], (list, tuple)):
+ xy = [tuple(xy[i : i + 2]) for i in range(0, len(xy), 2)]
+ for i in range(1, len(xy) - 1):
+ point = xy[i]
+ angles = [
+ math.degrees(math.atan2(end[0] - start[0], start[1] - end[1]))
+ % 360
+ for start, end in ((xy[i - 1], point), (point, xy[i + 1]))
+ ]
+ if angles[0] == angles[1]:
+ # This is a straight line, so no joint is required
+ continue
+
+ def coord_at_angle(coord, angle):
+ x, y = coord
+ angle -= 90
+ distance = width / 2 - 1
+ return tuple(
+ [
+ p + (math.floor(p_d) if p_d > 0 else math.ceil(p_d))
+ for p, p_d in (
+ (x, distance * math.cos(math.radians(angle))),
+ (y, distance * math.sin(math.radians(angle))),
+ )
+ ]
+ )
+
+ flipped = (
+ angles[1] > angles[0] and angles[1] - 180 > angles[0]
+ ) or (angles[1] < angles[0] and angles[1] + 180 > angles[0])
+ coords = [
+ (point[0] - width / 2 + 1, point[1] - width / 2 + 1),
+ (point[0] + width / 2 - 1, point[1] + width / 2 - 1),
+ ]
+ if flipped:
+ start, end = (angles[1] + 90, angles[0] + 90)
+ else:
+ start, end = (angles[0] - 90, angles[1] - 90)
+ self.pieslice(coords, start - 90, end - 90, fill)
+
+ if width > 8:
+ # Cover potential gaps between the line and the joint
+ if flipped:
+ gapCoords = [
+ coord_at_angle(point, angles[0] + 90),
+ point,
+ coord_at_angle(point, angles[1] + 90),
+ ]
+ else:
+ gapCoords = [
+ coord_at_angle(point, angles[0] - 90),
+ point,
+ coord_at_angle(point, angles[1] - 90),
+ ]
+ self.line(gapCoords, fill, width=3)
+
+ def shape(self, shape, fill=None, outline=None):
+ """(Experimental) Draw a shape."""
+ shape.close()
+ ink, fill = self._getink(outline, fill)
+ if fill is not None:
+ self.draw.draw_outline(shape, fill, 1)
+ if ink is not None and ink != fill:
+ self.draw.draw_outline(shape, ink, 0)
+
+ def pieslice(self, xy, start, end, fill=None, outline=None, width=1):
+ """Draw a pieslice."""
+ ink, fill = self._getink(outline, fill)
+ if fill is not None:
+ self.draw.draw_pieslice(xy, start, end, fill, 1)
+ if ink is not None and ink != fill and width != 0:
+ self.draw.draw_pieslice(xy, start, end, ink, 0, width)
+
+ def point(self, xy, fill=None):
+ """Draw one or more individual pixels."""
+ ink, fill = self._getink(fill)
+ if ink is not None:
+ self.draw.draw_points(xy, ink)
+
+ def polygon(self, xy, fill=None, outline=None):
+ """Draw a polygon."""
+ ink, fill = self._getink(outline, fill)
+ if fill is not None:
+ self.draw.draw_polygon(xy, fill, 1)
+ if ink is not None and ink != fill:
+ self.draw.draw_polygon(xy, ink, 0)
+
+ def regular_polygon(
+ self, bounding_circle, n_sides, rotation=0, fill=None, outline=None
+ ):
+ """Draw a regular polygon."""
+ xy = _compute_regular_polygon_vertices(bounding_circle, n_sides, rotation)
+ self.polygon(xy, fill, outline)
+
+ def rectangle(self, xy, fill=None, outline=None, width=1):
+ """Draw a rectangle."""
+ ink, fill = self._getink(outline, fill)
+ if fill is not None:
+ self.draw.draw_rectangle(xy, fill, 1)
+ if ink is not None and ink != fill and width != 0:
+ self.draw.draw_rectangle(xy, ink, 0, width)
+
+ def rounded_rectangle(self, xy, radius=0, fill=None, outline=None, width=1):
+ """Draw a rounded rectangle."""
+ if isinstance(xy[0], (list, tuple)):
+ (x0, y0), (x1, y1) = xy
+ else:
+ x0, y0, x1, y1 = xy
+
+ d = radius * 2
+
+ full_x = d >= x1 - x0
+ if full_x:
+ # The two left and two right corners are joined
+ d = x1 - x0
+ full_y = d >= y1 - y0
+ if full_y:
+ # The two top and two bottom corners are joined
+ d = y1 - y0
+ if full_x and full_y:
+ # If all corners are joined, that is a circle
+ return self.ellipse(xy, fill, outline, width)
+
+ if d == 0:
+ # If the corners have no curve, that is a rectangle
+ return self.rectangle(xy, fill, outline, width)
+
+ ink, fill = self._getink(outline, fill)
+
+ def draw_corners(pieslice):
+ if full_x:
+ # Draw top and bottom halves
+ parts = (
+ ((x0, y0, x0 + d, y0 + d), 180, 360),
+ ((x0, y1 - d, x0 + d, y1), 0, 180),
+ )
+ elif full_y:
+ # Draw left and right halves
+ parts = (
+ ((x0, y0, x0 + d, y0 + d), 90, 270),
+ ((x1 - d, y0, x1, y0 + d), 270, 90),
+ )
+ else:
+ # Draw four separate corners
+ parts = (
+ ((x1 - d, y0, x1, y0 + d), 270, 360),
+ ((x1 - d, y1 - d, x1, y1), 0, 90),
+ ((x0, y1 - d, x0 + d, y1), 90, 180),
+ ((x0, y0, x0 + d, y0 + d), 180, 270),
+ )
+ for part in parts:
+ if pieslice:
+ self.draw.draw_pieslice(*(part + (fill, 1)))
+ else:
+ self.draw.draw_arc(*(part + (ink, width)))
+
+ if fill is not None:
+ draw_corners(True)
+
+ if full_x:
+ self.draw.draw_rectangle(
+ (x0, y0 + d / 2 + 1, x1, y1 - d / 2 - 1), fill, 1
+ )
+ else:
+ self.draw.draw_rectangle(
+ (x0 + d / 2 + 1, y0, x1 - d / 2 - 1, y1), fill, 1
+ )
+ if not full_x and not full_y:
+ self.draw.draw_rectangle(
+ (x0, y0 + d / 2 + 1, x0 + d / 2, y1 - d / 2 - 1), fill, 1
+ )
+ self.draw.draw_rectangle(
+ (x1 - d / 2, y0 + d / 2 + 1, x1, y1 - d / 2 - 1), fill, 1
+ )
+ if ink is not None and ink != fill and width != 0:
+ draw_corners(False)
+
+ if not full_x:
+ self.draw.draw_rectangle(
+ (x0 + d / 2 + 1, y0, x1 - d / 2 - 1, y0 + width - 1), ink, 1
+ )
+ self.draw.draw_rectangle(
+ (x0 + d / 2 + 1, y1 - width + 1, x1 - d / 2 - 1, y1), ink, 1
+ )
+ if not full_y:
+ self.draw.draw_rectangle(
+ (x0, y0 + d / 2 + 1, x0 + width - 1, y1 - d / 2 - 1), ink, 1
+ )
+ self.draw.draw_rectangle(
+ (x1 - width + 1, y0 + d / 2 + 1, x1, y1 - d / 2 - 1), ink, 1
+ )
+
+ def _multiline_check(self, text):
+ """Draw text."""
+ split_character = "\n" if isinstance(text, str) else b"\n"
+
+ return split_character in text
+
+ def _multiline_split(self, text):
+ split_character = "\n" if isinstance(text, str) else b"\n"
+
+ return text.split(split_character)
+
+ def text(
+ self,
+ xy,
+ text,
+ fill=None,
+ font=None,
+ anchor=None,
+ spacing=4,
+ align="left",
+ direction=None,
+ features=None,
+ language=None,
+ stroke_width=0,
+ stroke_fill=None,
+ embedded_color=False,
+ *args,
+ **kwargs,
+ ):
+ if self._multiline_check(text):
+ return self.multiline_text(
+ xy,
+ text,
+ fill,
+ font,
+ anchor,
+ spacing,
+ align,
+ direction,
+ features,
+ language,
+ stroke_width,
+ stroke_fill,
+ embedded_color,
+ )
+
+ if embedded_color and self.mode not in ("RGB", "RGBA"):
+ raise ValueError("Embedded color supported only in RGB and RGBA modes")
+
+ if font is None:
+ font = self.getfont()
+
+ def getink(fill):
+ ink, fill = self._getink(fill)
+ if ink is None:
+ return fill
+ return ink
+
+ def draw_text(ink, stroke_width=0, stroke_offset=None):
+ mode = self.fontmode
+ if stroke_width == 0 and embedded_color:
+ mode = "RGBA"
+ coord = xy
+ try:
+ mask, offset = font.getmask2(
+ text,
+ mode,
+ direction=direction,
+ features=features,
+ language=language,
+ stroke_width=stroke_width,
+ anchor=anchor,
+ ink=ink,
+ *args,
+ **kwargs,
+ )
+ coord = coord[0] + offset[0], coord[1] + offset[1]
+ except AttributeError:
+ try:
+ mask = font.getmask(
+ text,
+ mode,
+ direction,
+ features,
+ language,
+ stroke_width,
+ anchor,
+ ink,
+ *args,
+ **kwargs,
+ )
+ except TypeError:
+ mask = font.getmask(text)
+ if stroke_offset:
+ coord = coord[0] + stroke_offset[0], coord[1] + stroke_offset[1]
+ if mode == "RGBA":
+ # font.getmask2(mode="RGBA") returns color in RGB bands and mask in A
+ # extract mask and set text alpha
+ color, mask = mask, mask.getband(3)
+ color.fillband(3, (ink >> 24) & 0xFF)
+ coord2 = coord[0] + mask.size[0], coord[1] + mask.size[1]
+ self.im.paste(color, coord + coord2, mask)
+ else:
+ self.draw.draw_bitmap(coord, mask, ink)
+
+ ink = getink(fill)
+ if ink is not None:
+ stroke_ink = None
+ if stroke_width:
+ stroke_ink = getink(stroke_fill) if stroke_fill is not None else ink
+
+ if stroke_ink is not None:
+ # Draw stroked text
+ draw_text(stroke_ink, stroke_width)
+
+ # Draw normal text
+ draw_text(ink, 0)
+ else:
+ # Only draw normal text
+ draw_text(ink)
+
+ def multiline_text(
+ self,
+ xy,
+ text,
+ fill=None,
+ font=None,
+ anchor=None,
+ spacing=4,
+ align="left",
+ direction=None,
+ features=None,
+ language=None,
+ stroke_width=0,
+ stroke_fill=None,
+ embedded_color=False,
+ ):
+ if direction == "ttb":
+ raise ValueError("ttb direction is unsupported for multiline text")
+
+ if anchor is None:
+ anchor = "la"
+ elif len(anchor) != 2:
+ raise ValueError("anchor must be a 2 character string")
+ elif anchor[1] in "tb":
+ raise ValueError("anchor not supported for multiline text")
+
+ widths = []
+ max_width = 0
+ lines = self._multiline_split(text)
+ line_spacing = (
+ self.textsize("A", font=font, stroke_width=stroke_width)[1] + spacing
+ )
+ for line in lines:
+ line_width = self.textlength(
+ line, font, direction=direction, features=features, language=language
+ )
+ widths.append(line_width)
+ max_width = max(max_width, line_width)
+
+ top = xy[1]
+ if anchor[1] == "m":
+ top -= (len(lines) - 1) * line_spacing / 2.0
+ elif anchor[1] == "d":
+ top -= (len(lines) - 1) * line_spacing
+
+ for idx, line in enumerate(lines):
+ left = xy[0]
+ width_difference = max_width - widths[idx]
+
+ # first align left by anchor
+ if anchor[0] == "m":
+ left -= width_difference / 2.0
+ elif anchor[0] == "r":
+ left -= width_difference
+
+ # then align by align parameter
+ if align == "left":
+ pass
+ elif align == "center":
+ left += width_difference / 2.0
+ elif align == "right":
+ left += width_difference
+ else:
+ raise ValueError('align must be "left", "center" or "right"')
+
+ self.text(
+ (left, top),
+ line,
+ fill,
+ font,
+ anchor,
+ direction=direction,
+ features=features,
+ language=language,
+ stroke_width=stroke_width,
+ stroke_fill=stroke_fill,
+ embedded_color=embedded_color,
+ )
+ top += line_spacing
+
+ def textsize(
+ self,
+ text,
+ font=None,
+ spacing=4,
+ direction=None,
+ features=None,
+ language=None,
+ stroke_width=0,
+ ):
+ """Get the size of a given string, in pixels."""
+ if self._multiline_check(text):
+ return self.multiline_textsize(
+ text, font, spacing, direction, features, language, stroke_width
+ )
+
+ if font is None:
+ font = self.getfont()
+ return font.getsize(text, direction, features, language, stroke_width)
+
+ def multiline_textsize(
+ self,
+ text,
+ font=None,
+ spacing=4,
+ direction=None,
+ features=None,
+ language=None,
+ stroke_width=0,
+ ):
+ max_width = 0
+ lines = self._multiline_split(text)
+ line_spacing = (
+ self.textsize("A", font=font, stroke_width=stroke_width)[1] + spacing
+ )
+ for line in lines:
+ line_width, line_height = self.textsize(
+ line, font, spacing, direction, features, language, stroke_width
+ )
+ max_width = max(max_width, line_width)
+ return max_width, len(lines) * line_spacing - spacing
+
+ def textlength(
+ self,
+ text,
+ font=None,
+ direction=None,
+ features=None,
+ language=None,
+ embedded_color=False,
+ ):
+ """Get the length of a given string, in pixels with 1/64 precision."""
+ if self._multiline_check(text):
+ raise ValueError("can't measure length of multiline text")
+ if embedded_color and self.mode not in ("RGB", "RGBA"):
+ raise ValueError("Embedded color supported only in RGB and RGBA modes")
+
+ if font is None:
+ font = self.getfont()
+ mode = "RGBA" if embedded_color else self.fontmode
+ try:
+ return font.getlength(text, mode, direction, features, language)
+ except AttributeError:
+ size = self.textsize(
+ text, font, direction=direction, features=features, language=language
+ )
+ if direction == "ttb":
+ return size[1]
+ return size[0]
+
+ def textbbox(
+ self,
+ xy,
+ text,
+ font=None,
+ anchor=None,
+ spacing=4,
+ align="left",
+ direction=None,
+ features=None,
+ language=None,
+ stroke_width=0,
+ embedded_color=False,
+ ):
+ """Get the bounding box of a given string, in pixels."""
+ if embedded_color and self.mode not in ("RGB", "RGBA"):
+ raise ValueError("Embedded color supported only in RGB and RGBA modes")
+
+ if self._multiline_check(text):
+ return self.multiline_textbbox(
+ xy,
+ text,
+ font,
+ anchor,
+ spacing,
+ align,
+ direction,
+ features,
+ language,
+ stroke_width,
+ embedded_color,
+ )
+
+ if font is None:
+ font = self.getfont()
+ mode = "RGBA" if embedded_color else self.fontmode
+ bbox = font.getbbox(
+ text, mode, direction, features, language, stroke_width, anchor
+ )
+ return bbox[0] + xy[0], bbox[1] + xy[1], bbox[2] + xy[0], bbox[3] + xy[1]
+
+ def multiline_textbbox(
+ self,
+ xy,
+ text,
+ font=None,
+ anchor=None,
+ spacing=4,
+ align="left",
+ direction=None,
+ features=None,
+ language=None,
+ stroke_width=0,
+ embedded_color=False,
+ ):
+ if direction == "ttb":
+ raise ValueError("ttb direction is unsupported for multiline text")
+
+ if anchor is None:
+ anchor = "la"
+ elif len(anchor) != 2:
+ raise ValueError("anchor must be a 2 character string")
+ elif anchor[1] in "tb":
+ raise ValueError("anchor not supported for multiline text")
+
+ widths = []
+ max_width = 0
+ lines = self._multiline_split(text)
+ line_spacing = (
+ self.textsize("A", font=font, stroke_width=stroke_width)[1] + spacing
+ )
+ for line in lines:
+ line_width = self.textlength(
+ line,
+ font,
+ direction=direction,
+ features=features,
+ language=language,
+ embedded_color=embedded_color,
+ )
+ widths.append(line_width)
+ max_width = max(max_width, line_width)
+
+ top = xy[1]
+ if anchor[1] == "m":
+ top -= (len(lines) - 1) * line_spacing / 2.0
+ elif anchor[1] == "d":
+ top -= (len(lines) - 1) * line_spacing
+
+ bbox = None
+
+ for idx, line in enumerate(lines):
+ left = xy[0]
+ width_difference = max_width - widths[idx]
+
+ # first align left by anchor
+ if anchor[0] == "m":
+ left -= width_difference / 2.0
+ elif anchor[0] == "r":
+ left -= width_difference
+
+ # then align by align parameter
+ if align == "left":
+ pass
+ elif align == "center":
+ left += width_difference / 2.0
+ elif align == "right":
+ left += width_difference
+ else:
+ raise ValueError('align must be "left", "center" or "right"')
+
+ bbox_line = self.textbbox(
+ (left, top),
+ line,
+ font,
+ anchor,
+ direction=direction,
+ features=features,
+ language=language,
+ stroke_width=stroke_width,
+ embedded_color=embedded_color,
+ )
+ if bbox is None:
+ bbox = bbox_line
+ else:
+ bbox = (
+ min(bbox[0], bbox_line[0]),
+ min(bbox[1], bbox_line[1]),
+ max(bbox[2], bbox_line[2]),
+ max(bbox[3], bbox_line[3]),
+ )
+
+ top += line_spacing
+
+ if bbox is None:
+ return xy[0], xy[1], xy[0], xy[1]
+ return bbox
+
+
+def Draw(im, mode=None):
+ """
+ A simple 2D drawing interface for PIL images.
+
+ :param im: The image to draw in.
+ :param mode: Optional mode to use for color values. For RGB
+ images, this argument can be RGB or RGBA (to blend the
+ drawing into the image). For all other modes, this argument
+ must be the same as the image mode. If omitted, the mode
+ defaults to the mode of the image.
+ """
+ try:
+ return im.getdraw(mode)
+ except AttributeError:
+ return ImageDraw(im, mode)
+
+
+# experimental access to the outline API
+try:
+ Outline = Image.core.outline
+except AttributeError:
+ Outline = None
+
+
+def getdraw(im=None, hints=None):
+ """
+ (Experimental) A more advanced 2D drawing interface for PIL images,
+ based on the WCK interface.
+
+ :param im: The image to draw in.
+ :param hints: An optional list of hints.
+ :returns: A (drawing context, drawing resource factory) tuple.
+ """
+ # FIXME: this needs more work!
+ # FIXME: come up with a better 'hints' scheme.
+ handler = None
+ if not hints or "nicest" in hints:
+ try:
+ from . import _imagingagg as handler
+ except ImportError:
+ pass
+ if handler is None:
+ from . import ImageDraw2 as handler
+ if im:
+ im = handler.Draw(im)
+ return im, handler
+
+
+def floodfill(image, xy, value, border=None, thresh=0):
+ """
+ (experimental) Fills a bounded region with a given color.
+
+ :param image: Target image.
+ :param xy: Seed position (a 2-item coordinate tuple). See
+ :ref:`coordinate-system`.
+ :param value: Fill color.
+ :param border: Optional border value. If given, the region consists of
+ pixels with a color different from the border color. If not given,
+ the region consists of pixels having the same color as the seed
+ pixel.
+ :param thresh: Optional threshold value which specifies a maximum
+ tolerable difference of a pixel value from the 'background' in
+ order for it to be replaced. Useful for filling regions of
+ non-homogeneous, but similar, colors.
+ """
+ # based on an implementation by Eric S. Raymond
+ # amended by yo1995 @20180806
+ pixel = image.load()
+ x, y = xy
+ try:
+ background = pixel[x, y]
+ if _color_diff(value, background) <= thresh:
+ return # seed point already has fill color
+ pixel[x, y] = value
+ except (ValueError, IndexError):
+ return # seed point outside image
+ edge = {(x, y)}
+ # use a set to keep record of current and previous edge pixels
+ # to reduce memory consumption
+ full_edge = set()
+ while edge:
+ new_edge = set()
+ for (x, y) in edge: # 4 adjacent method
+ for (s, t) in ((x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)):
+ # If already processed, or if a coordinate is negative, skip
+ if (s, t) in full_edge or s < 0 or t < 0:
+ continue
+ try:
+ p = pixel[s, t]
+ except (ValueError, IndexError):
+ pass
+ else:
+ full_edge.add((s, t))
+ if border is None:
+ fill = _color_diff(p, background) <= thresh
+ else:
+ fill = p != value and p != border
+ if fill:
+ pixel[s, t] = value
+ new_edge.add((s, t))
+ full_edge = edge # discard pixels processed
+ edge = new_edge
+
+
+def _compute_regular_polygon_vertices(bounding_circle, n_sides, rotation):
+ """
+ Generate a list of vertices for a 2D regular polygon.
+
+ :param bounding_circle: The bounding circle is a tuple defined
+ by a point and radius. The polygon is inscribed in this circle.
+ (e.g. ``bounding_circle=(x, y, r)`` or ``((x, y), r)``)
+ :param n_sides: Number of sides
+ (e.g. ``n_sides=3`` for a triangle, ``6`` for a hexagon)
+ :param rotation: Apply an arbitrary rotation to the polygon
+ (e.g. ``rotation=90``, applies a 90 degree rotation)
+ :return: List of regular polygon vertices
+ (e.g. ``[(25, 50), (50, 50), (50, 25), (25, 25)]``)
+
+ How are the vertices computed?
+ 1. Compute the following variables
+ - theta: Angle between the apothem & the nearest polygon vertex
+ - side_length: Length of each polygon edge
+ - centroid: Center of bounding circle (1st, 2nd elements of bounding_circle)
+ - polygon_radius: Polygon radius (last element of bounding_circle)
+ - angles: Location of each polygon vertex in polar grid
+ (e.g. A square with 0 degree rotation => [225.0, 315.0, 45.0, 135.0])
+
+ 2. For each angle in angles, get the polygon vertex at that angle
+ The vertex is computed using the equation below.
+ X= xcos(φ) + ysin(φ)
+ Y= −xsin(φ) + ycos(φ)
+
+ Note:
+ φ = angle in degrees
+ x = 0
+ y = polygon_radius
+
+ The formula above assumes rotation around the origin.
+ In our case, we are rotating around the centroid.
+ To account for this, we use the formula below
+ X = xcos(φ) + ysin(φ) + centroid_x
+ Y = −xsin(φ) + ycos(φ) + centroid_y
+ """
+ # 1. Error Handling
+ # 1.1 Check `n_sides` has an appropriate value
+ if not isinstance(n_sides, int):
+ raise TypeError("n_sides should be an int")
+ if n_sides < 3:
+ raise ValueError("n_sides should be an int > 2")
+
+ # 1.2 Check `bounding_circle` has an appropriate value
+ if not isinstance(bounding_circle, (list, tuple)):
+ raise TypeError("bounding_circle should be a tuple")
+
+ if len(bounding_circle) == 3:
+ *centroid, polygon_radius = bounding_circle
+ elif len(bounding_circle) == 2:
+ centroid, polygon_radius = bounding_circle
+ else:
+ raise ValueError(
+ "bounding_circle should contain 2D coordinates "
+ "and a radius (e.g. (x, y, r) or ((x, y), r) )"
+ )
+
+ if not all(isinstance(i, (int, float)) for i in (*centroid, polygon_radius)):
+ raise ValueError("bounding_circle should only contain numeric data")
+
+ if not len(centroid) == 2:
+ raise ValueError(
+ "bounding_circle centre should contain 2D coordinates (e.g. (x, y))"
+ )
+
+ if polygon_radius <= 0:
+ raise ValueError("bounding_circle radius should be > 0")
+
+ # 1.3 Check `rotation` has an appropriate value
+ if not isinstance(rotation, (int, float)):
+ raise ValueError("rotation should be an int or float")
+
+ # 2. Define Helper Functions
+ def _apply_rotation(point, degrees, centroid):
+ return (
+ round(
+ point[0] * math.cos(math.radians(360 - degrees))
+ - point[1] * math.sin(math.radians(360 - degrees))
+ + centroid[0],
+ 2,
+ ),
+ round(
+ point[1] * math.cos(math.radians(360 - degrees))
+ + point[0] * math.sin(math.radians(360 - degrees))
+ + centroid[1],
+ 2,
+ ),
+ )
+
+ def _compute_polygon_vertex(centroid, polygon_radius, angle):
+ start_point = [polygon_radius, 0]
+ return _apply_rotation(start_point, angle, centroid)
+
+ def _get_angles(n_sides, rotation):
+ angles = []
+ degrees = 360 / n_sides
+ # Start with the bottom left polygon vertex
+ current_angle = (270 - 0.5 * degrees) + rotation
+ for _ in range(0, n_sides):
+ angles.append(current_angle)
+ current_angle += degrees
+ if current_angle > 360:
+ current_angle -= 360
+ return angles
+
+ # 3. Variable Declarations
+ angles = _get_angles(n_sides, rotation)
+
+ # 4. Compute Vertices
+ return [
+ _compute_polygon_vertex(centroid, polygon_radius, angle) for angle in angles
+ ]
+
+
+def _color_diff(color1, color2):
+ """
+ Uses 1-norm distance to calculate difference between two values.
+ """
+ if isinstance(color2, tuple):
+ return sum([abs(color1[i] - color2[i]) for i in range(0, len(color2))])
+ else:
+ return abs(color1 - color2)
diff --git a/venv/Lib/site-packages/PIL/ImageDraw2.py b/venv/Lib/site-packages/PIL/ImageDraw2.py
new file mode 100644
index 0000000..1f63110
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageDraw2.py
@@ -0,0 +1,179 @@
+#
+# The Python Imaging Library
+# $Id$
+#
+# WCK-style drawing interface operations
+#
+# History:
+# 2003-12-07 fl created
+# 2005-05-15 fl updated; added to PIL as ImageDraw2
+# 2005-05-15 fl added text support
+# 2005-05-20 fl added arc/chord/pieslice support
+#
+# Copyright (c) 2003-2005 by Secret Labs AB
+# Copyright (c) 2003-2005 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+
+"""
+(Experimental) WCK-style drawing interface operations
+
+.. seealso:: :py:mod:`PIL.ImageDraw`
+"""
+
+
+from . import Image, ImageColor, ImageDraw, ImageFont, ImagePath
+
+
+class Pen:
+ """Stores an outline color and width."""
+
+ def __init__(self, color, width=1, opacity=255):
+ self.color = ImageColor.getrgb(color)
+ self.width = width
+
+
+class Brush:
+ """Stores a fill color"""
+
+ def __init__(self, color, opacity=255):
+ self.color = ImageColor.getrgb(color)
+
+
+class Font:
+ """Stores a TrueType font and color"""
+
+ def __init__(self, color, file, size=12):
+ # FIXME: add support for bitmap fonts
+ self.color = ImageColor.getrgb(color)
+ self.font = ImageFont.truetype(file, size)
+
+
+class Draw:
+ """
+ (Experimental) WCK-style drawing interface
+ """
+
+ def __init__(self, image, size=None, color=None):
+ if not hasattr(image, "im"):
+ image = Image.new(image, size, color)
+ self.draw = ImageDraw.Draw(image)
+ self.image = image
+ self.transform = None
+
+ def flush(self):
+ return self.image
+
+ def render(self, op, xy, pen, brush=None):
+ # handle color arguments
+ outline = fill = None
+ width = 1
+ if isinstance(pen, Pen):
+ outline = pen.color
+ width = pen.width
+ elif isinstance(brush, Pen):
+ outline = brush.color
+ width = brush.width
+ if isinstance(brush, Brush):
+ fill = brush.color
+ elif isinstance(pen, Brush):
+ fill = pen.color
+ # handle transformation
+ if self.transform:
+ xy = ImagePath.Path(xy)
+ xy.transform(self.transform)
+ # render the item
+ if op == "line":
+ self.draw.line(xy, fill=outline, width=width)
+ else:
+ getattr(self.draw, op)(xy, fill=fill, outline=outline)
+
+ def settransform(self, offset):
+ """Sets a transformation offset."""
+ (xoffset, yoffset) = offset
+ self.transform = (1, 0, xoffset, 0, 1, yoffset)
+
+ def arc(self, xy, start, end, *options):
+ """
+ Draws an arc (a portion of a circle outline) between the start and end
+ angles, inside the given bounding box.
+
+ .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.arc`
+ """
+ self.render("arc", xy, start, end, *options)
+
+ def chord(self, xy, start, end, *options):
+ """
+ Same as :py:meth:`~PIL.ImageDraw2.Draw.arc`, but connects the end points
+ with a straight line.
+
+ .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.chord`
+ """
+ self.render("chord", xy, start, end, *options)
+
+ def ellipse(self, xy, *options):
+ """
+ Draws an ellipse inside the given bounding box.
+
+ .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.ellipse`
+ """
+ self.render("ellipse", xy, *options)
+
+ def line(self, xy, *options):
+ """
+ Draws a line between the coordinates in the ``xy`` list.
+
+ .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.line`
+ """
+ self.render("line", xy, *options)
+
+ def pieslice(self, xy, start, end, *options):
+ """
+ Same as arc, but also draws straight lines between the end points and the
+ center of the bounding box.
+
+ .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.pieslice`
+ """
+ self.render("pieslice", xy, start, end, *options)
+
+ def polygon(self, xy, *options):
+ """
+ Draws a polygon.
+
+ The polygon outline consists of straight lines between the given
+ coordinates, plus a straight line between the last and the first
+ coordinate.
+
+
+ .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.polygon`
+ """
+ self.render("polygon", xy, *options)
+
+ def rectangle(self, xy, *options):
+ """
+ Draws a rectangle.
+
+ .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.rectangle`
+ """
+ self.render("rectangle", xy, *options)
+
+ def text(self, xy, text, font):
+ """
+ Draws the string at the given position.
+
+ .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.text`
+ """
+ if self.transform:
+ xy = ImagePath.Path(xy)
+ xy.transform(self.transform)
+ self.draw.text(xy, text, font=font.font, fill=font.color)
+
+ def textsize(self, text, font):
+ """
+ Return the size of the given string, in pixels.
+
+ .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.textsize`
+ """
+ return self.draw.textsize(text, font=font.font)
diff --git a/venv/Lib/site-packages/PIL/ImageEnhance.py b/venv/Lib/site-packages/PIL/ImageEnhance.py
new file mode 100644
index 0000000..3b79d5c
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageEnhance.py
@@ -0,0 +1,103 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# image enhancement classes
+#
+# For a background, see "Image Processing By Interpolation and
+# Extrapolation", Paul Haeberli and Douglas Voorhies. Available
+# at http://www.graficaobscura.com/interp/index.html
+#
+# History:
+# 1996-03-23 fl Created
+# 2009-06-16 fl Fixed mean calculation
+#
+# Copyright (c) Secret Labs AB 1997.
+# Copyright (c) Fredrik Lundh 1996.
+#
+# See the README file for information on usage and redistribution.
+#
+
+from . import Image, ImageFilter, ImageStat
+
+
+class _Enhance:
+ def enhance(self, factor):
+ """
+ Returns an enhanced image.
+
+ :param factor: A floating point value controlling the enhancement.
+ Factor 1.0 always returns a copy of the original image,
+ lower factors mean less color (brightness, contrast,
+ etc), and higher values more. There are no restrictions
+ on this value.
+ :rtype: :py:class:`~PIL.Image.Image`
+ """
+ return Image.blend(self.degenerate, self.image, factor)
+
+
+class Color(_Enhance):
+ """Adjust image color balance.
+
+ This class can be used to adjust the colour balance of an image, in
+ a manner similar to the controls on a colour TV set. An enhancement
+ factor of 0.0 gives a black and white image. A factor of 1.0 gives
+ the original image.
+ """
+
+ def __init__(self, image):
+ self.image = image
+ self.intermediate_mode = "L"
+ if "A" in image.getbands():
+ self.intermediate_mode = "LA"
+
+ self.degenerate = image.convert(self.intermediate_mode).convert(image.mode)
+
+
+class Contrast(_Enhance):
+ """Adjust image contrast.
+
+ This class can be used to control the contrast of an image, similar
+ to the contrast control on a TV set. An enhancement factor of 0.0
+ gives a solid grey image. A factor of 1.0 gives the original image.
+ """
+
+ def __init__(self, image):
+ self.image = image
+ mean = int(ImageStat.Stat(image.convert("L")).mean[0] + 0.5)
+ self.degenerate = Image.new("L", image.size, mean).convert(image.mode)
+
+ if "A" in image.getbands():
+ self.degenerate.putalpha(image.getchannel("A"))
+
+
+class Brightness(_Enhance):
+ """Adjust image brightness.
+
+ This class can be used to control the brightness of an image. An
+ enhancement factor of 0.0 gives a black image. A factor of 1.0 gives the
+ original image.
+ """
+
+ def __init__(self, image):
+ self.image = image
+ self.degenerate = Image.new(image.mode, image.size, 0)
+
+ if "A" in image.getbands():
+ self.degenerate.putalpha(image.getchannel("A"))
+
+
+class Sharpness(_Enhance):
+ """Adjust image sharpness.
+
+ This class can be used to adjust the sharpness of an image. An
+ enhancement factor of 0.0 gives a blurred image, a factor of 1.0 gives the
+ original image, and a factor of 2.0 gives a sharpened image.
+ """
+
+ def __init__(self, image):
+ self.image = image
+ self.degenerate = image.filter(ImageFilter.SMOOTH)
+
+ if "A" in image.getbands():
+ self.degenerate.putalpha(image.getchannel("A"))
diff --git a/venv/Lib/site-packages/PIL/ImageFile.py b/venv/Lib/site-packages/PIL/ImageFile.py
new file mode 100644
index 0000000..0258a2e
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageFile.py
@@ -0,0 +1,695 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# base class for image file handlers
+#
+# history:
+# 1995-09-09 fl Created
+# 1996-03-11 fl Fixed load mechanism.
+# 1996-04-15 fl Added pcx/xbm decoders.
+# 1996-04-30 fl Added encoders.
+# 1996-12-14 fl Added load helpers
+# 1997-01-11 fl Use encode_to_file where possible
+# 1997-08-27 fl Flush output in _save
+# 1998-03-05 fl Use memory mapping for some modes
+# 1999-02-04 fl Use memory mapping also for "I;16" and "I;16B"
+# 1999-05-31 fl Added image parser
+# 2000-10-12 fl Set readonly flag on memory-mapped images
+# 2002-03-20 fl Use better messages for common decoder errors
+# 2003-04-21 fl Fall back on mmap/map_buffer if map is not available
+# 2003-10-30 fl Added StubImageFile class
+# 2004-02-25 fl Made incremental parser more robust
+#
+# Copyright (c) 1997-2004 by Secret Labs AB
+# Copyright (c) 1995-2004 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import io
+import struct
+import sys
+import warnings
+
+from . import Image
+from ._util import isPath
+
+MAXBLOCK = 65536
+
+SAFEBLOCK = 1024 * 1024
+
+LOAD_TRUNCATED_IMAGES = False
+"""Whether or not to load truncated image files. User code may change this."""
+
+ERRORS = {
+ -1: "image buffer overrun error",
+ -2: "decoding error",
+ -3: "unknown error",
+ -8: "bad configuration",
+ -9: "out of memory error",
+}
+"""Dict of known error codes returned from :meth:`.PyDecoder.decode`."""
+
+
+#
+# --------------------------------------------------------------------
+# Helpers
+
+
+def raise_oserror(error):
+ try:
+ message = Image.core.getcodecstatus(error)
+ except AttributeError:
+ message = ERRORS.get(error)
+ if not message:
+ message = f"decoder error {error}"
+ raise OSError(message + " when reading image file")
+
+
+def raise_ioerror(error):
+ warnings.warn(
+ "raise_ioerror is deprecated and will be removed in Pillow 9 (2022-01-02). "
+ "Use raise_oserror instead.",
+ DeprecationWarning,
+ )
+ return raise_oserror(error)
+
+
+def _tilesort(t):
+ # sort on offset
+ return t[2]
+
+
+#
+# --------------------------------------------------------------------
+# ImageFile base class
+
+
+class ImageFile(Image.Image):
+ """Base class for image file format handlers."""
+
+ def __init__(self, fp=None, filename=None):
+ super().__init__()
+
+ self._min_frame = 0
+
+ self.custom_mimetype = None
+
+ self.tile = None
+ """ A list of tile descriptors, or ``None`` """
+
+ self.readonly = 1 # until we know better
+
+ self.decoderconfig = ()
+ self.decodermaxblock = MAXBLOCK
+
+ if isPath(fp):
+ # filename
+ self.fp = open(fp, "rb")
+ self.filename = fp
+ self._exclusive_fp = True
+ else:
+ # stream
+ self.fp = fp
+ self.filename = filename
+ # can be overridden
+ self._exclusive_fp = None
+
+ try:
+ try:
+ self._open()
+ except (
+ IndexError, # end of data
+ TypeError, # end of data (ord)
+ KeyError, # unsupported mode
+ EOFError, # got header but not the first frame
+ struct.error,
+ ) as v:
+ raise SyntaxError(v) from v
+
+ if not self.mode or self.size[0] <= 0:
+ raise SyntaxError("not identified by this driver")
+ except BaseException:
+ # close the file only if we have opened it this constructor
+ if self._exclusive_fp:
+ self.fp.close()
+ raise
+
+ def get_format_mimetype(self):
+ if self.custom_mimetype:
+ return self.custom_mimetype
+ if self.format is not None:
+ return Image.MIME.get(self.format.upper())
+
+ def verify(self):
+ """Check file integrity"""
+
+ # raise exception if something's wrong. must be called
+ # directly after open, and closes file when finished.
+ if self._exclusive_fp:
+ self.fp.close()
+ self.fp = None
+
+ def load(self):
+ """Load image data based on tile list"""
+
+ if self.tile is None:
+ raise OSError("cannot load this image")
+
+ pixel = Image.Image.load(self)
+ if not self.tile:
+ return pixel
+
+ self.map = None
+ use_mmap = self.filename and len(self.tile) == 1
+ # As of pypy 2.1.0, memory mapping was failing here.
+ use_mmap = use_mmap and not hasattr(sys, "pypy_version_info")
+
+ readonly = 0
+
+ # look for read/seek overrides
+ try:
+ read = self.load_read
+ # don't use mmap if there are custom read/seek functions
+ use_mmap = False
+ except AttributeError:
+ read = self.fp.read
+
+ try:
+ seek = self.load_seek
+ use_mmap = False
+ except AttributeError:
+ seek = self.fp.seek
+
+ if use_mmap:
+ # try memory mapping
+ decoder_name, extents, offset, args = self.tile[0]
+ if (
+ decoder_name == "raw"
+ and len(args) >= 3
+ and args[0] == self.mode
+ and args[0] in Image._MAPMODES
+ ):
+ try:
+ # use mmap, if possible
+ import mmap
+
+ with open(self.filename) as fp:
+ self.map = mmap.mmap(fp.fileno(), 0, access=mmap.ACCESS_READ)
+ self.im = Image.core.map_buffer(
+ self.map, self.size, decoder_name, offset, args
+ )
+ readonly = 1
+ # After trashing self.im,
+ # we might need to reload the palette data.
+ if self.palette:
+ self.palette.dirty = 1
+ except (AttributeError, OSError, ImportError):
+ self.map = None
+
+ self.load_prepare()
+ err_code = -3 # initialize to unknown error
+ if not self.map:
+ # sort tiles in file order
+ self.tile.sort(key=_tilesort)
+
+ try:
+ # FIXME: This is a hack to handle TIFF's JpegTables tag.
+ prefix = self.tile_prefix
+ except AttributeError:
+ prefix = b""
+
+ for decoder_name, extents, offset, args in self.tile:
+ decoder = Image._getdecoder(
+ self.mode, decoder_name, args, self.decoderconfig
+ )
+ try:
+ seek(offset)
+ decoder.setimage(self.im, extents)
+ if decoder.pulls_fd:
+ decoder.setfd(self.fp)
+ status, err_code = decoder.decode(b"")
+ else:
+ b = prefix
+ while True:
+ try:
+ s = read(self.decodermaxblock)
+ except (IndexError, struct.error) as e:
+ # truncated png/gif
+ if LOAD_TRUNCATED_IMAGES:
+ break
+ else:
+ raise OSError("image file is truncated") from e
+
+ if not s: # truncated jpeg
+ if LOAD_TRUNCATED_IMAGES:
+ break
+ else:
+ raise OSError(
+ "image file is truncated "
+ f"({len(b)} bytes not processed)"
+ )
+
+ b = b + s
+ n, err_code = decoder.decode(b)
+ if n < 0:
+ break
+ b = b[n:]
+ finally:
+ # Need to cleanup here to prevent leaks
+ decoder.cleanup()
+
+ self.tile = []
+ self.readonly = readonly
+
+ self.load_end()
+
+ if self._exclusive_fp and self._close_exclusive_fp_after_loading:
+ self.fp.close()
+ self.fp = None
+
+ if not self.map and not LOAD_TRUNCATED_IMAGES and err_code < 0:
+ # still raised if decoder fails to return anything
+ raise_oserror(err_code)
+
+ return Image.Image.load(self)
+
+ def load_prepare(self):
+ # create image memory if necessary
+ if not self.im or self.im.mode != self.mode or self.im.size != self.size:
+ self.im = Image.core.new(self.mode, self.size)
+ # create palette (optional)
+ if self.mode == "P":
+ Image.Image.load(self)
+
+ def load_end(self):
+ # may be overridden
+ pass
+
+ # may be defined for contained formats
+ # def load_seek(self, pos):
+ # pass
+
+ # may be defined for blocked formats (e.g. PNG)
+ # def load_read(self, bytes):
+ # pass
+
+ def _seek_check(self, frame):
+ if (
+ frame < self._min_frame
+ # Only check upper limit on frames if additional seek operations
+ # are not required to do so
+ or (
+ not (hasattr(self, "_n_frames") and self._n_frames is None)
+ and frame >= self.n_frames + self._min_frame
+ )
+ ):
+ raise EOFError("attempt to seek outside sequence")
+
+ return self.tell() != frame
+
+
+class StubImageFile(ImageFile):
+ """
+ Base class for stub image loaders.
+
+ A stub loader is an image loader that can identify files of a
+ certain format, but relies on external code to load the file.
+ """
+
+ def _open(self):
+ raise NotImplementedError("StubImageFile subclass must implement _open")
+
+ def load(self):
+ loader = self._load()
+ if loader is None:
+ raise OSError(f"cannot find loader for this {self.format} file")
+ image = loader.load(self)
+ assert image is not None
+ # become the other object (!)
+ self.__class__ = image.__class__
+ self.__dict__ = image.__dict__
+
+ def _load(self):
+ """(Hook) Find actual image loader."""
+ raise NotImplementedError("StubImageFile subclass must implement _load")
+
+
+class Parser:
+ """
+ Incremental image parser. This class implements the standard
+ feed/close consumer interface.
+ """
+
+ incremental = None
+ image = None
+ data = None
+ decoder = None
+ offset = 0
+ finished = 0
+
+ def reset(self):
+ """
+ (Consumer) Reset the parser. Note that you can only call this
+ method immediately after you've created a parser; parser
+ instances cannot be reused.
+ """
+ assert self.data is None, "cannot reuse parsers"
+
+ def feed(self, data):
+ """
+ (Consumer) Feed data to the parser.
+
+ :param data: A string buffer.
+ :exception OSError: If the parser failed to parse the image file.
+ """
+ # collect data
+
+ if self.finished:
+ return
+
+ if self.data is None:
+ self.data = data
+ else:
+ self.data = self.data + data
+
+ # parse what we have
+ if self.decoder:
+
+ if self.offset > 0:
+ # skip header
+ skip = min(len(self.data), self.offset)
+ self.data = self.data[skip:]
+ self.offset = self.offset - skip
+ if self.offset > 0 or not self.data:
+ return
+
+ n, e = self.decoder.decode(self.data)
+
+ if n < 0:
+ # end of stream
+ self.data = None
+ self.finished = 1
+ if e < 0:
+ # decoding error
+ self.image = None
+ raise_oserror(e)
+ else:
+ # end of image
+ return
+ self.data = self.data[n:]
+
+ elif self.image:
+
+ # if we end up here with no decoder, this file cannot
+ # be incrementally parsed. wait until we've gotten all
+ # available data
+ pass
+
+ else:
+
+ # attempt to open this file
+ try:
+ with io.BytesIO(self.data) as fp:
+ im = Image.open(fp)
+ except OSError:
+ # traceback.print_exc()
+ pass # not enough data
+ else:
+ flag = hasattr(im, "load_seek") or hasattr(im, "load_read")
+ if flag or len(im.tile) != 1:
+ # custom load code, or multiple tiles
+ self.decode = None
+ else:
+ # initialize decoder
+ im.load_prepare()
+ d, e, o, a = im.tile[0]
+ im.tile = []
+ self.decoder = Image._getdecoder(im.mode, d, a, im.decoderconfig)
+ self.decoder.setimage(im.im, e)
+
+ # calculate decoder offset
+ self.offset = o
+ if self.offset <= len(self.data):
+ self.data = self.data[self.offset :]
+ self.offset = 0
+
+ self.image = im
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *args):
+ self.close()
+
+ def close(self):
+ """
+ (Consumer) Close the stream.
+
+ :returns: An image object.
+ :exception OSError: If the parser failed to parse the image file either
+ because it cannot be identified or cannot be
+ decoded.
+ """
+ # finish decoding
+ if self.decoder:
+ # get rid of what's left in the buffers
+ self.feed(b"")
+ self.data = self.decoder = None
+ if not self.finished:
+ raise OSError("image was incomplete")
+ if not self.image:
+ raise OSError("cannot parse this image")
+ if self.data:
+ # incremental parsing not possible; reopen the file
+ # not that we have all data
+ with io.BytesIO(self.data) as fp:
+ try:
+ self.image = Image.open(fp)
+ finally:
+ self.image.load()
+ return self.image
+
+
+# --------------------------------------------------------------------
+
+
+def _save(im, fp, tile, bufsize=0):
+ """Helper to save image based on tile list
+
+ :param im: Image object.
+ :param fp: File object.
+ :param tile: Tile list.
+ :param bufsize: Optional buffer size
+ """
+
+ im.load()
+ if not hasattr(im, "encoderconfig"):
+ im.encoderconfig = ()
+ tile.sort(key=_tilesort)
+ # FIXME: make MAXBLOCK a configuration parameter
+ # It would be great if we could have the encoder specify what it needs
+ # But, it would need at least the image size in most cases. RawEncode is
+ # a tricky case.
+ bufsize = max(MAXBLOCK, bufsize, im.size[0] * 4) # see RawEncode.c
+ if fp == sys.stdout:
+ fp.flush()
+ return
+ try:
+ fh = fp.fileno()
+ fp.flush()
+ except (AttributeError, io.UnsupportedOperation) as exc:
+ # compress to Python file-compatible object
+ for e, b, o, a in tile:
+ e = Image._getencoder(im.mode, e, a, im.encoderconfig)
+ if o > 0:
+ fp.seek(o)
+ e.setimage(im.im, b)
+ if e.pushes_fd:
+ e.setfd(fp)
+ l, s = e.encode_to_pyfd()
+ else:
+ while True:
+ l, s, d = e.encode(bufsize)
+ fp.write(d)
+ if s:
+ break
+ if s < 0:
+ raise OSError(f"encoder error {s} when writing image file") from exc
+ e.cleanup()
+ else:
+ # slight speedup: compress to real file object
+ for e, b, o, a in tile:
+ e = Image._getencoder(im.mode, e, a, im.encoderconfig)
+ if o > 0:
+ fp.seek(o)
+ e.setimage(im.im, b)
+ if e.pushes_fd:
+ e.setfd(fp)
+ l, s = e.encode_to_pyfd()
+ else:
+ s = e.encode_to_file(fh, bufsize)
+ if s < 0:
+ raise OSError(f"encoder error {s} when writing image file")
+ e.cleanup()
+ if hasattr(fp, "flush"):
+ fp.flush()
+
+
+def _safe_read(fp, size):
+ """
+ Reads large blocks in a safe way. Unlike fp.read(n), this function
+ doesn't trust the user. If the requested size is larger than
+ SAFEBLOCK, the file is read block by block.
+
+ :param fp: File handle. Must implement a read method.
+ :param size: Number of bytes to read.
+ :returns: A string containing size bytes of data.
+
+ Raises an OSError if the file is truncated and the read cannot be completed
+
+ """
+ if size <= 0:
+ return b""
+ if size <= SAFEBLOCK:
+ data = fp.read(size)
+ if len(data) < size:
+ raise OSError("Truncated File Read")
+ return data
+ data = []
+ while size > 0:
+ block = fp.read(min(size, SAFEBLOCK))
+ if not block:
+ break
+ data.append(block)
+ size -= len(block)
+ if sum(len(d) for d in data) < size:
+ raise OSError("Truncated File Read")
+ return b"".join(data)
+
+
+class PyCodecState:
+ def __init__(self):
+ self.xsize = 0
+ self.ysize = 0
+ self.xoff = 0
+ self.yoff = 0
+
+ def extents(self):
+ return (self.xoff, self.yoff, self.xoff + self.xsize, self.yoff + self.ysize)
+
+
+class PyDecoder:
+ """
+ Python implementation of a format decoder. Override this class and
+ add the decoding logic in the :meth:`decode` method.
+
+ See :ref:`Writing Your Own File Decoder in Python`
+ """
+
+ _pulls_fd = False
+
+ def __init__(self, mode, *args):
+ self.im = None
+ self.state = PyCodecState()
+ self.fd = None
+ self.mode = mode
+ self.init(args)
+
+ def init(self, args):
+ """
+ Override to perform decoder specific initialization
+
+ :param args: Array of args items from the tile entry
+ :returns: None
+ """
+ self.args = args
+
+ @property
+ def pulls_fd(self):
+ return self._pulls_fd
+
+ def decode(self, buffer):
+ """
+ Override to perform the decoding process.
+
+ :param buffer: A bytes object with the data to be decoded.
+ :returns: A tuple of ``(bytes consumed, errcode)``.
+ If finished with decoding return <0 for the bytes consumed.
+ Err codes are from :data:`.ImageFile.ERRORS`.
+ """
+ raise NotImplementedError()
+
+ def cleanup(self):
+ """
+ Override to perform decoder specific cleanup
+
+ :returns: None
+ """
+ pass
+
+ def setfd(self, fd):
+ """
+ Called from ImageFile to set the python file-like object
+
+ :param fd: A python file-like object
+ :returns: None
+ """
+ self.fd = fd
+
+ def setimage(self, im, extents=None):
+ """
+ Called from ImageFile to set the core output image for the decoder
+
+ :param im: A core image object
+ :param extents: a 4 tuple of (x0, y0, x1, y1) defining the rectangle
+ for this tile
+ :returns: None
+ """
+
+ # following c code
+ self.im = im
+
+ if extents:
+ (x0, y0, x1, y1) = extents
+ else:
+ (x0, y0, x1, y1) = (0, 0, 0, 0)
+
+ if x0 == 0 and x1 == 0:
+ self.state.xsize, self.state.ysize = self.im.size
+ else:
+ self.state.xoff = x0
+ self.state.yoff = y0
+ self.state.xsize = x1 - x0
+ self.state.ysize = y1 - y0
+
+ if self.state.xsize <= 0 or self.state.ysize <= 0:
+ raise ValueError("Size cannot be negative")
+
+ if (
+ self.state.xsize + self.state.xoff > self.im.size[0]
+ or self.state.ysize + self.state.yoff > self.im.size[1]
+ ):
+ raise ValueError("Tile cannot extend outside image")
+
+ def set_as_raw(self, data, rawmode=None):
+ """
+ Convenience method to set the internal image from a stream of raw data
+
+ :param data: Bytes to be set
+ :param rawmode: The rawmode to be used for the decoder.
+ If not specified, it will default to the mode of the image
+ :returns: None
+ """
+
+ if not rawmode:
+ rawmode = self.mode
+ d = Image._getdecoder(self.mode, "raw", (rawmode))
+ d.setimage(self.im, self.state.extents())
+ s = d.decode(data)
+
+ if s[0] >= 0:
+ raise ValueError("not enough image data")
+ if s[1] != 0:
+ raise ValueError("cannot decode image data")
diff --git a/venv/Lib/site-packages/PIL/ImageFilter.py b/venv/Lib/site-packages/PIL/ImageFilter.py
new file mode 100644
index 0000000..6800bc3
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageFilter.py
@@ -0,0 +1,536 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# standard filters
+#
+# History:
+# 1995-11-27 fl Created
+# 2002-06-08 fl Added rank and mode filters
+# 2003-09-15 fl Fixed rank calculation in rank filter; added expand call
+#
+# Copyright (c) 1997-2003 by Secret Labs AB.
+# Copyright (c) 1995-2002 by Fredrik Lundh.
+#
+# See the README file for information on usage and redistribution.
+#
+import functools
+
+
+class Filter:
+ pass
+
+
+class MultibandFilter(Filter):
+ pass
+
+
+class BuiltinFilter(MultibandFilter):
+ def filter(self, image):
+ if image.mode == "P":
+ raise ValueError("cannot filter palette images")
+ return image.filter(*self.filterargs)
+
+
+class Kernel(BuiltinFilter):
+ """
+ Create a convolution kernel. The current version only
+ supports 3x3 and 5x5 integer and floating point kernels.
+
+ In the current version, kernels can only be applied to
+ "L" and "RGB" images.
+
+ :param size: Kernel size, given as (width, height). In the current
+ version, this must be (3,3) or (5,5).
+ :param kernel: A sequence containing kernel weights.
+ :param scale: Scale factor. If given, the result for each pixel is
+ divided by this value. The default is the sum of the
+ kernel weights.
+ :param offset: Offset. If given, this value is added to the result,
+ after it has been divided by the scale factor.
+ """
+
+ name = "Kernel"
+
+ def __init__(self, size, kernel, scale=None, offset=0):
+ if scale is None:
+ # default scale is sum of kernel
+ scale = functools.reduce(lambda a, b: a + b, kernel)
+ if size[0] * size[1] != len(kernel):
+ raise ValueError("not enough coefficients in kernel")
+ self.filterargs = size, scale, offset, kernel
+
+
+class RankFilter(Filter):
+ """
+ Create a rank filter. The rank filter sorts all pixels in
+ a window of the given size, and returns the ``rank``'th value.
+
+ :param size: The kernel size, in pixels.
+ :param rank: What pixel value to pick. Use 0 for a min filter,
+ ``size * size / 2`` for a median filter, ``size * size - 1``
+ for a max filter, etc.
+ """
+
+ name = "Rank"
+
+ def __init__(self, size, rank):
+ self.size = size
+ self.rank = rank
+
+ def filter(self, image):
+ if image.mode == "P":
+ raise ValueError("cannot filter palette images")
+ image = image.expand(self.size // 2, self.size // 2)
+ return image.rankfilter(self.size, self.rank)
+
+
+class MedianFilter(RankFilter):
+ """
+ Create a median filter. Picks the median pixel value in a window with the
+ given size.
+
+ :param size: The kernel size, in pixels.
+ """
+
+ name = "Median"
+
+ def __init__(self, size=3):
+ self.size = size
+ self.rank = size * size // 2
+
+
+class MinFilter(RankFilter):
+ """
+ Create a min filter. Picks the lowest pixel value in a window with the
+ given size.
+
+ :param size: The kernel size, in pixels.
+ """
+
+ name = "Min"
+
+ def __init__(self, size=3):
+ self.size = size
+ self.rank = 0
+
+
+class MaxFilter(RankFilter):
+ """
+ Create a max filter. Picks the largest pixel value in a window with the
+ given size.
+
+ :param size: The kernel size, in pixels.
+ """
+
+ name = "Max"
+
+ def __init__(self, size=3):
+ self.size = size
+ self.rank = size * size - 1
+
+
+class ModeFilter(Filter):
+ """
+ Create a mode filter. Picks the most frequent pixel value in a box with the
+ given size. Pixel values that occur only once or twice are ignored; if no
+ pixel value occurs more than twice, the original pixel value is preserved.
+
+ :param size: The kernel size, in pixels.
+ """
+
+ name = "Mode"
+
+ def __init__(self, size=3):
+ self.size = size
+
+ def filter(self, image):
+ return image.modefilter(self.size)
+
+
+class GaussianBlur(MultibandFilter):
+ """Gaussian blur filter.
+
+ :param radius: Blur radius.
+ """
+
+ name = "GaussianBlur"
+
+ def __init__(self, radius=2):
+ self.radius = radius
+
+ def filter(self, image):
+ return image.gaussian_blur(self.radius)
+
+
+class BoxBlur(MultibandFilter):
+ """Blurs the image by setting each pixel to the average value of the pixels
+ in a square box extending radius pixels in each direction.
+ Supports float radius of arbitrary size. Uses an optimized implementation
+ which runs in linear time relative to the size of the image
+ for any radius value.
+
+ :param radius: Size of the box in one direction. Radius 0 does not blur,
+ returns an identical image. Radius 1 takes 1 pixel
+ in each direction, i.e. 9 pixels in total.
+ """
+
+ name = "BoxBlur"
+
+ def __init__(self, radius):
+ self.radius = radius
+
+ def filter(self, image):
+ return image.box_blur(self.radius)
+
+
+class UnsharpMask(MultibandFilter):
+ """Unsharp mask filter.
+
+ See Wikipedia's entry on `digital unsharp masking`_ for an explanation of
+ the parameters.
+
+ :param radius: Blur Radius
+ :param percent: Unsharp strength, in percent
+ :param threshold: Threshold controls the minimum brightness change that
+ will be sharpened
+
+ .. _digital unsharp masking: https://en.wikipedia.org/wiki/Unsharp_masking#Digital_unsharp_masking
+
+ """ # noqa: E501
+
+ name = "UnsharpMask"
+
+ def __init__(self, radius=2, percent=150, threshold=3):
+ self.radius = radius
+ self.percent = percent
+ self.threshold = threshold
+
+ def filter(self, image):
+ return image.unsharp_mask(self.radius, self.percent, self.threshold)
+
+
+class BLUR(BuiltinFilter):
+ name = "Blur"
+ # fmt: off
+ filterargs = (5, 5), 16, 0, (
+ 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 1,
+ 1, 0, 0, 0, 1,
+ 1, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1,
+ )
+ # fmt: on
+
+
+class CONTOUR(BuiltinFilter):
+ name = "Contour"
+ # fmt: off
+ filterargs = (3, 3), 1, 255, (
+ -1, -1, -1,
+ -1, 8, -1,
+ -1, -1, -1,
+ )
+ # fmt: on
+
+
+class DETAIL(BuiltinFilter):
+ name = "Detail"
+ # fmt: off
+ filterargs = (3, 3), 6, 0, (
+ 0, -1, 0,
+ -1, 10, -1,
+ 0, -1, 0,
+ )
+ # fmt: on
+
+
+class EDGE_ENHANCE(BuiltinFilter):
+ name = "Edge-enhance"
+ # fmt: off
+ filterargs = (3, 3), 2, 0, (
+ -1, -1, -1,
+ -1, 10, -1,
+ -1, -1, -1,
+ )
+ # fmt: on
+
+
+class EDGE_ENHANCE_MORE(BuiltinFilter):
+ name = "Edge-enhance More"
+ # fmt: off
+ filterargs = (3, 3), 1, 0, (
+ -1, -1, -1,
+ -1, 9, -1,
+ -1, -1, -1,
+ )
+ # fmt: on
+
+
+class EMBOSS(BuiltinFilter):
+ name = "Emboss"
+ # fmt: off
+ filterargs = (3, 3), 1, 128, (
+ -1, 0, 0,
+ 0, 1, 0,
+ 0, 0, 0,
+ )
+ # fmt: on
+
+
+class FIND_EDGES(BuiltinFilter):
+ name = "Find Edges"
+ # fmt: off
+ filterargs = (3, 3), 1, 0, (
+ -1, -1, -1,
+ -1, 8, -1,
+ -1, -1, -1,
+ )
+ # fmt: on
+
+
+class SHARPEN(BuiltinFilter):
+ name = "Sharpen"
+ # fmt: off
+ filterargs = (3, 3), 16, 0, (
+ -2, -2, -2,
+ -2, 32, -2,
+ -2, -2, -2,
+ )
+ # fmt: on
+
+
+class SMOOTH(BuiltinFilter):
+ name = "Smooth"
+ # fmt: off
+ filterargs = (3, 3), 13, 0, (
+ 1, 1, 1,
+ 1, 5, 1,
+ 1, 1, 1,
+ )
+ # fmt: on
+
+
+class SMOOTH_MORE(BuiltinFilter):
+ name = "Smooth More"
+ # fmt: off
+ filterargs = (5, 5), 100, 0, (
+ 1, 1, 1, 1, 1,
+ 1, 5, 5, 5, 1,
+ 1, 5, 44, 5, 1,
+ 1, 5, 5, 5, 1,
+ 1, 1, 1, 1, 1,
+ )
+ # fmt: on
+
+
+class Color3DLUT(MultibandFilter):
+ """Three-dimensional color lookup table.
+
+ Transforms 3-channel pixels using the values of the channels as coordinates
+ in the 3D lookup table and interpolating the nearest elements.
+
+ This method allows you to apply almost any color transformation
+ in constant time by using pre-calculated decimated tables.
+
+ .. versionadded:: 5.2.0
+
+ :param size: Size of the table. One int or tuple of (int, int, int).
+ Minimal size in any dimension is 2, maximum is 65.
+ :param table: Flat lookup table. A list of ``channels * size**3``
+ float elements or a list of ``size**3`` channels-sized
+ tuples with floats. Channels are changed first,
+ then first dimension, then second, then third.
+ Value 0.0 corresponds lowest value of output, 1.0 highest.
+ :param channels: Number of channels in the table. Could be 3 or 4.
+ Default is 3.
+ :param target_mode: A mode for the result image. Should have not less
+ than ``channels`` channels. Default is ``None``,
+ which means that mode wouldn't be changed.
+ """
+
+ name = "Color 3D LUT"
+
+ def __init__(self, size, table, channels=3, target_mode=None, **kwargs):
+ if channels not in (3, 4):
+ raise ValueError("Only 3 or 4 output channels are supported")
+ self.size = size = self._check_size(size)
+ self.channels = channels
+ self.mode = target_mode
+
+ # Hidden flag `_copy_table=False` could be used to avoid extra copying
+ # of the table if the table is specially made for the constructor.
+ copy_table = kwargs.get("_copy_table", True)
+ items = size[0] * size[1] * size[2]
+ wrong_size = False
+
+ numpy = None
+ if hasattr(table, "shape"):
+ try:
+ import numpy
+ except ImportError: # pragma: no cover
+ pass
+
+ if numpy and isinstance(table, numpy.ndarray):
+ if copy_table:
+ table = table.copy()
+
+ if table.shape in [
+ (items * channels,),
+ (items, channels),
+ (size[2], size[1], size[0], channels),
+ ]:
+ table = table.reshape(items * channels)
+ else:
+ wrong_size = True
+
+ else:
+ if copy_table:
+ table = list(table)
+
+ # Convert to a flat list
+ if table and isinstance(table[0], (list, tuple)):
+ table, raw_table = [], table
+ for pixel in raw_table:
+ if len(pixel) != channels:
+ raise ValueError(
+ "The elements of the table should "
+ "have a length of {}.".format(channels)
+ )
+ table.extend(pixel)
+
+ if wrong_size or len(table) != items * channels:
+ raise ValueError(
+ "The table should have either channels * size**3 float items "
+ "or size**3 items of channels-sized tuples with floats. "
+ f"Table should be: {channels}x{size[0]}x{size[1]}x{size[2]}. "
+ f"Actual length: {len(table)}"
+ )
+ self.table = table
+
+ @staticmethod
+ def _check_size(size):
+ try:
+ _, _, _ = size
+ except ValueError as e:
+ raise ValueError(
+ "Size should be either an integer or a tuple of three integers."
+ ) from e
+ except TypeError:
+ size = (size, size, size)
+ size = [int(x) for x in size]
+ for size1D in size:
+ if not 2 <= size1D <= 65:
+ raise ValueError("Size should be in [2, 65] range.")
+ return size
+
+ @classmethod
+ def generate(cls, size, callback, channels=3, target_mode=None):
+ """Generates new LUT using provided callback.
+
+ :param size: Size of the table. Passed to the constructor.
+ :param callback: Function with three parameters which correspond
+ three color channels. Will be called ``size**3``
+ times with values from 0.0 to 1.0 and should return
+ a tuple with ``channels`` elements.
+ :param channels: The number of channels which should return callback.
+ :param target_mode: Passed to the constructor of the resulting
+ lookup table.
+ """
+ size1D, size2D, size3D = cls._check_size(size)
+ if channels not in (3, 4):
+ raise ValueError("Only 3 or 4 output channels are supported")
+
+ table = [0] * (size1D * size2D * size3D * channels)
+ idx_out = 0
+ for b in range(size3D):
+ for g in range(size2D):
+ for r in range(size1D):
+ table[idx_out : idx_out + channels] = callback(
+ r / (size1D - 1), g / (size2D - 1), b / (size3D - 1)
+ )
+ idx_out += channels
+
+ return cls(
+ (size1D, size2D, size3D),
+ table,
+ channels=channels,
+ target_mode=target_mode,
+ _copy_table=False,
+ )
+
+ def transform(self, callback, with_normals=False, channels=None, target_mode=None):
+ """Transforms the table values using provided callback and returns
+ a new LUT with altered values.
+
+ :param callback: A function which takes old lookup table values
+ and returns a new set of values. The number
+ of arguments which function should take is
+ ``self.channels`` or ``3 + self.channels``
+ if ``with_normals`` flag is set.
+ Should return a tuple of ``self.channels`` or
+ ``channels`` elements if it is set.
+ :param with_normals: If true, ``callback`` will be called with
+ coordinates in the color cube as the first
+ three arguments. Otherwise, ``callback``
+ will be called only with actual color values.
+ :param channels: The number of channels in the resulting lookup table.
+ :param target_mode: Passed to the constructor of the resulting
+ lookup table.
+ """
+ if channels not in (None, 3, 4):
+ raise ValueError("Only 3 or 4 output channels are supported")
+ ch_in = self.channels
+ ch_out = channels or ch_in
+ size1D, size2D, size3D = self.size
+
+ table = [0] * (size1D * size2D * size3D * ch_out)
+ idx_in = 0
+ idx_out = 0
+ for b in range(size3D):
+ for g in range(size2D):
+ for r in range(size1D):
+ values = self.table[idx_in : idx_in + ch_in]
+ if with_normals:
+ values = callback(
+ r / (size1D - 1),
+ g / (size2D - 1),
+ b / (size3D - 1),
+ *values,
+ )
+ else:
+ values = callback(*values)
+ table[idx_out : idx_out + ch_out] = values
+ idx_in += ch_in
+ idx_out += ch_out
+
+ return type(self)(
+ self.size,
+ table,
+ channels=ch_out,
+ target_mode=target_mode or self.mode,
+ _copy_table=False,
+ )
+
+ def __repr__(self):
+ r = [
+ f"{self.__class__.__name__} from {self.table.__class__.__name__}",
+ "size={:d}x{:d}x{:d}".format(*self.size),
+ f"channels={self.channels:d}",
+ ]
+ if self.mode:
+ r.append(f"target_mode={self.mode}")
+ return "<{}>".format(" ".join(r))
+
+ def filter(self, image):
+ from . import Image
+
+ return image.color_lut_3d(
+ self.mode or image.mode,
+ Image.LINEAR,
+ self.channels,
+ self.size[0],
+ self.size[1],
+ self.size[2],
+ self.table,
+ )
diff --git a/venv/Lib/site-packages/PIL/ImageFont.py b/venv/Lib/site-packages/PIL/ImageFont.py
new file mode 100644
index 0000000..2f63dda
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageFont.py
@@ -0,0 +1,1058 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# PIL raster font management
+#
+# History:
+# 1996-08-07 fl created (experimental)
+# 1997-08-25 fl minor adjustments to handle fonts from pilfont 0.3
+# 1999-02-06 fl rewrote most font management stuff in C
+# 1999-03-17 fl take pth files into account in load_path (from Richard Jones)
+# 2001-02-17 fl added freetype support
+# 2001-05-09 fl added TransposedFont wrapper class
+# 2002-03-04 fl make sure we have a "L" or "1" font
+# 2002-12-04 fl skip non-directory entries in the system path
+# 2003-04-29 fl add embedded default font
+# 2003-09-27 fl added support for truetype charmap encodings
+#
+# Todo:
+# Adapt to PILFONT2 format (16-bit fonts, compressed, single file)
+#
+# Copyright (c) 1997-2003 by Secret Labs AB
+# Copyright (c) 1996-2003 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import base64
+import os
+import sys
+import warnings
+from io import BytesIO
+
+from . import Image, features
+from ._util import isDirectory, isPath
+
+LAYOUT_BASIC = 0
+LAYOUT_RAQM = 1
+
+
+class _imagingft_not_installed:
+ # module placeholder
+ def __getattr__(self, id):
+ raise ImportError("The _imagingft C module is not installed")
+
+
+try:
+ from . import _imagingft as core
+except ImportError:
+ core = _imagingft_not_installed()
+
+
+# FIXME: add support for pilfont2 format (see FontFile.py)
+
+# --------------------------------------------------------------------
+# Font metrics format:
+# "PILfont" LF
+# fontdescriptor LF
+# (optional) key=value... LF
+# "DATA" LF
+# binary data: 256*10*2 bytes (dx, dy, dstbox, srcbox)
+#
+# To place a character, cut out srcbox and paste at dstbox,
+# relative to the character position. Then move the character
+# position according to dx, dy.
+# --------------------------------------------------------------------
+
+
+class ImageFont:
+ "PIL font wrapper"
+
+ def _load_pilfont(self, filename):
+
+ with open(filename, "rb") as fp:
+ image = None
+ for ext in (".png", ".gif", ".pbm"):
+ if image:
+ image.close()
+ try:
+ fullname = os.path.splitext(filename)[0] + ext
+ image = Image.open(fullname)
+ except Exception:
+ pass
+ else:
+ if image and image.mode in ("1", "L"):
+ break
+ else:
+ if image:
+ image.close()
+ raise OSError("cannot find glyph data file")
+
+ self.file = fullname
+
+ self._load_pilfont_data(fp, image)
+ image.close()
+
+ def _load_pilfont_data(self, file, image):
+
+ # read PILfont header
+ if file.readline() != b"PILfont\n":
+ raise SyntaxError("Not a PILfont file")
+ file.readline().split(b";")
+ self.info = [] # FIXME: should be a dictionary
+ while True:
+ s = file.readline()
+ if not s or s == b"DATA\n":
+ break
+ self.info.append(s)
+
+ # read PILfont metrics
+ data = file.read(256 * 20)
+
+ # check image
+ if image.mode not in ("1", "L"):
+ raise TypeError("invalid font image mode")
+
+ image.load()
+
+ self.font = Image.core.font(image.im, data)
+
+ def getsize(self, text, *args, **kwargs):
+ """
+ Returns width and height (in pixels) of given text.
+
+ :param text: Text to measure.
+
+ :return: (width, height)
+ """
+ return self.font.getsize(text)
+
+ def getmask(self, text, mode="", *args, **kwargs):
+ """
+ Create a bitmap for the text.
+
+ If the font uses antialiasing, the bitmap should have mode ``L`` and use a
+ maximum value of 255. Otherwise, it should have mode ``1``.
+
+ :param text: Text to render.
+ :param mode: Used by some graphics drivers to indicate what mode the
+ driver prefers; if empty, the renderer may return either
+ mode. Note that the mode is always a string, to simplify
+ C-level implementations.
+
+ .. versionadded:: 1.1.5
+
+ :return: An internal PIL storage memory instance as defined by the
+ :py:mod:`PIL.Image.core` interface module.
+ """
+ return self.font.getmask(text, mode)
+
+
+##
+# Wrapper for FreeType fonts. Application code should use the
+# truetype factory function to create font objects.
+
+
+class FreeTypeFont:
+ "FreeType font wrapper (requires _imagingft service)"
+
+ def __init__(self, font=None, size=10, index=0, encoding="", layout_engine=None):
+ # FIXME: use service provider instead
+
+ self.path = font
+ self.size = size
+ self.index = index
+ self.encoding = encoding
+
+ try:
+ from packaging.version import parse as parse_version
+ except ImportError:
+ pass
+ else:
+ freetype_version = parse_version(features.version_module("freetype2"))
+ if freetype_version < parse_version("2.8"):
+ warnings.warn(
+ "Support for FreeType 2.7 is deprecated and will be removed"
+ " in Pillow 9 (2022-01-02). Please upgrade to FreeType 2.8 "
+ "or newer, preferably FreeType 2.10.4 which fixes "
+ "CVE-2020-15999.",
+ DeprecationWarning,
+ )
+
+ if layout_engine not in (LAYOUT_BASIC, LAYOUT_RAQM):
+ layout_engine = LAYOUT_BASIC
+ if core.HAVE_RAQM:
+ layout_engine = LAYOUT_RAQM
+ elif layout_engine == LAYOUT_RAQM and not core.HAVE_RAQM:
+ layout_engine = LAYOUT_BASIC
+
+ self.layout_engine = layout_engine
+
+ def load_from_bytes(f):
+ self.font_bytes = f.read()
+ self.font = core.getfont(
+ "", size, index, encoding, self.font_bytes, layout_engine
+ )
+
+ if isPath(font):
+ if sys.platform == "win32":
+ font_bytes_path = font if isinstance(font, bytes) else font.encode()
+ try:
+ font_bytes_path.decode("ascii")
+ except UnicodeDecodeError:
+ # FreeType cannot load fonts with non-ASCII characters on Windows
+ # So load it into memory first
+ with open(font, "rb") as f:
+ load_from_bytes(f)
+ return
+ self.font = core.getfont(
+ font, size, index, encoding, layout_engine=layout_engine
+ )
+ else:
+ load_from_bytes(font)
+
+ def _multiline_split(self, text):
+ split_character = "\n" if isinstance(text, str) else b"\n"
+ return text.split(split_character)
+
+ def getname(self):
+ """
+ :return: A tuple of the font family (e.g. Helvetica) and the font style
+ (e.g. Bold)
+ """
+ return self.font.family, self.font.style
+
+ def getmetrics(self):
+ """
+ :return: A tuple of the font ascent (the distance from the baseline to
+ the highest outline point) and descent (the distance from the
+ baseline to the lowest outline point, a negative value)
+ """
+ return self.font.ascent, self.font.descent
+
+ def getlength(self, text, mode="", direction=None, features=None, language=None):
+ """
+ Returns length (in pixels with 1/64 precision) of given text when rendered
+ in font with provided direction, features, and language.
+
+ This is the amount by which following text should be offset.
+ Text bounding box may extend past the length in some fonts,
+ e.g. when using italics or accents.
+
+ The result is returned as a float; it is a whole number if using basic layout.
+
+ Note that the sum of two lengths may not equal the length of a concatenated
+ string due to kerning. If you need to adjust for kerning, include the following
+ character and subtract its length.
+
+ For example, instead of
+
+ .. code-block:: python
+
+ hello = font.getlength("Hello")
+ world = font.getlength("World")
+ hello_world = hello + world # not adjusted for kerning
+ assert hello_world == font.getlength("HelloWorld") # may fail
+
+ use
+
+ .. code-block:: python
+
+ hello = font.getlength("HelloW") - font.getlength("W") # adjusted for kerning
+ world = font.getlength("World")
+ hello_world = hello + world # adjusted for kerning
+ assert hello_world == font.getlength("HelloWorld") # True
+
+ or disable kerning with (requires libraqm)
+
+ .. code-block:: python
+
+ hello = draw.textlength("Hello", font, features=["-kern"])
+ world = draw.textlength("World", font, features=["-kern"])
+ hello_world = hello + world # kerning is disabled, no need to adjust
+ assert hello_world == draw.textlength("HelloWorld", font, features=["-kern"])
+
+ .. versionadded:: 8.0.0
+
+ :param text: Text to measure.
+ :param mode: Used by some graphics drivers to indicate what mode the
+ driver prefers; if empty, the renderer may return either
+ mode. Note that the mode is always a string, to simplify
+ C-level implementations.
+
+ :param direction: Direction of the text. It can be 'rtl' (right to
+ left), 'ltr' (left to right) or 'ttb' (top to bottom).
+ Requires libraqm.
+
+ :param features: A list of OpenType font features to be used during text
+ layout. This is usually used to turn on optional
+ font features that are not enabled by default,
+ for example 'dlig' or 'ss01', but can be also
+ used to turn off default font features for
+ example '-liga' to disable ligatures or '-kern'
+ to disable kerning. To get all supported
+ features, see
+ https://docs.microsoft.com/en-us/typography/opentype/spec/featurelist
+ Requires libraqm.
+
+ :param language: Language of the text. Different languages may use
+ different glyph shapes or ligatures. This parameter tells
+ the font which language the text is in, and to apply the
+ correct substitutions as appropriate, if available.
+ It should be a `BCP 47 language code
+ `_
+ Requires libraqm.
+
+ :return: Width for horizontal, height for vertical text.
+ """
+ return self.font.getlength(text, mode, direction, features, language) / 64
+
+ def getbbox(
+ self,
+ text,
+ mode="",
+ direction=None,
+ features=None,
+ language=None,
+ stroke_width=0,
+ anchor=None,
+ ):
+ """
+ Returns bounding box (in pixels) of given text relative to given anchor
+ when rendered in font with provided direction, features, and language.
+
+ Use :py:meth:`getlength()` to get the offset of following text with
+ 1/64 pixel precision. The bounding box includes extra margins for
+ some fonts, e.g. italics or accents.
+
+ .. versionadded:: 8.0.0
+
+ :param text: Text to render.
+ :param mode: Used by some graphics drivers to indicate what mode the
+ driver prefers; if empty, the renderer may return either
+ mode. Note that the mode is always a string, to simplify
+ C-level implementations.
+
+ :param direction: Direction of the text. It can be 'rtl' (right to
+ left), 'ltr' (left to right) or 'ttb' (top to bottom).
+ Requires libraqm.
+
+ :param features: A list of OpenType font features to be used during text
+ layout. This is usually used to turn on optional
+ font features that are not enabled by default,
+ for example 'dlig' or 'ss01', but can be also
+ used to turn off default font features for
+ example '-liga' to disable ligatures or '-kern'
+ to disable kerning. To get all supported
+ features, see
+ https://docs.microsoft.com/en-us/typography/opentype/spec/featurelist
+ Requires libraqm.
+
+ :param language: Language of the text. Different languages may use
+ different glyph shapes or ligatures. This parameter tells
+ the font which language the text is in, and to apply the
+ correct substitutions as appropriate, if available.
+ It should be a `BCP 47 language code
+ `_
+ Requires libraqm.
+
+ :param stroke_width: The width of the text stroke.
+
+ :param anchor: The text anchor alignment. Determines the relative location of
+ the anchor to the text. The default alignment is top left.
+ See :ref:`text-anchors` for valid values.
+
+ :return: ``(left, top, right, bottom)`` bounding box
+ """
+ size, offset = self.font.getsize(
+ text, mode, direction, features, language, anchor
+ )
+ left, top = offset[0] - stroke_width, offset[1] - stroke_width
+ width, height = size[0] + 2 * stroke_width, size[1] + 2 * stroke_width
+ return left, top, left + width, top + height
+
+ def getsize(
+ self, text, direction=None, features=None, language=None, stroke_width=0
+ ):
+ """
+ Returns width and height (in pixels) of given text if rendered in font with
+ provided direction, features, and language.
+
+ Use :py:meth:`getlength()` to measure the offset of following text with
+ 1/64 pixel precision.
+ Use :py:meth:`getbbox()` to get the exact bounding box based on an anchor.
+
+ .. note:: For historical reasons this function measures text height from
+ the ascender line instead of the top, see :ref:`text-anchors`.
+ If you wish to measure text height from the top, it is recommended
+ to use the bottom value of :meth:`getbbox` with ``anchor='lt'`` instead.
+
+ :param text: Text to measure.
+
+ :param direction: Direction of the text. It can be 'rtl' (right to
+ left), 'ltr' (left to right) or 'ttb' (top to bottom).
+ Requires libraqm.
+
+ .. versionadded:: 4.2.0
+
+ :param features: A list of OpenType font features to be used during text
+ layout. This is usually used to turn on optional
+ font features that are not enabled by default,
+ for example 'dlig' or 'ss01', but can be also
+ used to turn off default font features for
+ example '-liga' to disable ligatures or '-kern'
+ to disable kerning. To get all supported
+ features, see
+ https://docs.microsoft.com/en-us/typography/opentype/spec/featurelist
+ Requires libraqm.
+
+ .. versionadded:: 4.2.0
+
+ :param language: Language of the text. Different languages may use
+ different glyph shapes or ligatures. This parameter tells
+ the font which language the text is in, and to apply the
+ correct substitutions as appropriate, if available.
+ It should be a `BCP 47 language code
+ `_
+ Requires libraqm.
+
+ .. versionadded:: 6.0.0
+
+ :param stroke_width: The width of the text stroke.
+
+ .. versionadded:: 6.2.0
+
+ :return: (width, height)
+ """
+ # vertical offset is added for historical reasons
+ # see https://github.com/python-pillow/Pillow/pull/4910#discussion_r486682929
+ size, offset = self.font.getsize(text, "L", direction, features, language)
+ return (
+ size[0] + stroke_width * 2,
+ size[1] + stroke_width * 2 + offset[1],
+ )
+
+ def getsize_multiline(
+ self,
+ text,
+ direction=None,
+ spacing=4,
+ features=None,
+ language=None,
+ stroke_width=0,
+ ):
+ """
+ Returns width and height (in pixels) of given text if rendered in font
+ with provided direction, features, and language, while respecting
+ newline characters.
+
+ :param text: Text to measure.
+
+ :param direction: Direction of the text. It can be 'rtl' (right to
+ left), 'ltr' (left to right) or 'ttb' (top to bottom).
+ Requires libraqm.
+
+ :param spacing: The vertical gap between lines, defaulting to 4 pixels.
+
+ :param features: A list of OpenType font features to be used during text
+ layout. This is usually used to turn on optional
+ font features that are not enabled by default,
+ for example 'dlig' or 'ss01', but can be also
+ used to turn off default font features for
+ example '-liga' to disable ligatures or '-kern'
+ to disable kerning. To get all supported
+ features, see
+ https://docs.microsoft.com/en-us/typography/opentype/spec/featurelist
+ Requires libraqm.
+
+ :param language: Language of the text. Different languages may use
+ different glyph shapes or ligatures. This parameter tells
+ the font which language the text is in, and to apply the
+ correct substitutions as appropriate, if available.
+ It should be a `BCP 47 language code
+ `_
+ Requires libraqm.
+
+ .. versionadded:: 6.0.0
+
+ :param stroke_width: The width of the text stroke.
+
+ .. versionadded:: 6.2.0
+
+ :return: (width, height)
+ """
+ max_width = 0
+ lines = self._multiline_split(text)
+ line_spacing = self.getsize("A", stroke_width=stroke_width)[1] + spacing
+ for line in lines:
+ line_width, line_height = self.getsize(
+ line, direction, features, language, stroke_width
+ )
+ max_width = max(max_width, line_width)
+
+ return max_width, len(lines) * line_spacing - spacing
+
+ def getoffset(self, text):
+ """
+ Returns the offset of given text. This is the gap between the
+ starting coordinate and the first marking. Note that this gap is
+ included in the result of :py:func:`~PIL.ImageFont.FreeTypeFont.getsize`.
+
+ :param text: Text to measure.
+
+ :return: A tuple of the x and y offset
+ """
+ return self.font.getsize(text)[1]
+
+ def getmask(
+ self,
+ text,
+ mode="",
+ direction=None,
+ features=None,
+ language=None,
+ stroke_width=0,
+ anchor=None,
+ ink=0,
+ ):
+ """
+ Create a bitmap for the text.
+
+ If the font uses antialiasing, the bitmap should have mode ``L`` and use a
+ maximum value of 255. If the font has embedded color data, the bitmap
+ should have mode ``RGBA``. Otherwise, it should have mode ``1``.
+
+ :param text: Text to render.
+ :param mode: Used by some graphics drivers to indicate what mode the
+ driver prefers; if empty, the renderer may return either
+ mode. Note that the mode is always a string, to simplify
+ C-level implementations.
+
+ .. versionadded:: 1.1.5
+
+ :param direction: Direction of the text. It can be 'rtl' (right to
+ left), 'ltr' (left to right) or 'ttb' (top to bottom).
+ Requires libraqm.
+
+ .. versionadded:: 4.2.0
+
+ :param features: A list of OpenType font features to be used during text
+ layout. This is usually used to turn on optional
+ font features that are not enabled by default,
+ for example 'dlig' or 'ss01', but can be also
+ used to turn off default font features for
+ example '-liga' to disable ligatures or '-kern'
+ to disable kerning. To get all supported
+ features, see
+ https://docs.microsoft.com/en-us/typography/opentype/spec/featurelist
+ Requires libraqm.
+
+ .. versionadded:: 4.2.0
+
+ :param language: Language of the text. Different languages may use
+ different glyph shapes or ligatures. This parameter tells
+ the font which language the text is in, and to apply the
+ correct substitutions as appropriate, if available.
+ It should be a `BCP 47 language code
+ `_
+ Requires libraqm.
+
+ .. versionadded:: 6.0.0
+
+ :param stroke_width: The width of the text stroke.
+
+ .. versionadded:: 6.2.0
+
+ :param anchor: The text anchor alignment. Determines the relative location of
+ the anchor to the text. The default alignment is top left.
+ See :ref:`text-anchors` for valid values.
+
+ .. versionadded:: 8.0.0
+
+ :param ink: Foreground ink for rendering in RGBA mode.
+
+ .. versionadded:: 8.0.0
+
+ :return: An internal PIL storage memory instance as defined by the
+ :py:mod:`PIL.Image.core` interface module.
+ """
+ return self.getmask2(
+ text,
+ mode,
+ direction=direction,
+ features=features,
+ language=language,
+ stroke_width=stroke_width,
+ anchor=anchor,
+ ink=ink,
+ )[0]
+
+ def getmask2(
+ self,
+ text,
+ mode="",
+ fill=Image.core.fill,
+ direction=None,
+ features=None,
+ language=None,
+ stroke_width=0,
+ anchor=None,
+ ink=0,
+ *args,
+ **kwargs,
+ ):
+ """
+ Create a bitmap for the text.
+
+ If the font uses antialiasing, the bitmap should have mode ``L`` and use a
+ maximum value of 255. If the font has embedded color data, the bitmap
+ should have mode ``RGBA``. Otherwise, it should have mode ``1``.
+
+ :param text: Text to render.
+ :param mode: Used by some graphics drivers to indicate what mode the
+ driver prefers; if empty, the renderer may return either
+ mode. Note that the mode is always a string, to simplify
+ C-level implementations.
+
+ .. versionadded:: 1.1.5
+
+ :param direction: Direction of the text. It can be 'rtl' (right to
+ left), 'ltr' (left to right) or 'ttb' (top to bottom).
+ Requires libraqm.
+
+ .. versionadded:: 4.2.0
+
+ :param features: A list of OpenType font features to be used during text
+ layout. This is usually used to turn on optional
+ font features that are not enabled by default,
+ for example 'dlig' or 'ss01', but can be also
+ used to turn off default font features for
+ example '-liga' to disable ligatures or '-kern'
+ to disable kerning. To get all supported
+ features, see
+ https://docs.microsoft.com/en-us/typography/opentype/spec/featurelist
+ Requires libraqm.
+
+ .. versionadded:: 4.2.0
+
+ :param language: Language of the text. Different languages may use
+ different glyph shapes or ligatures. This parameter tells
+ the font which language the text is in, and to apply the
+ correct substitutions as appropriate, if available.
+ It should be a `BCP 47 language code
+ `_
+ Requires libraqm.
+
+ .. versionadded:: 6.0.0
+
+ :param stroke_width: The width of the text stroke.
+
+ .. versionadded:: 6.2.0
+
+ :param anchor: The text anchor alignment. Determines the relative location of
+ the anchor to the text. The default alignment is top left.
+ See :ref:`text-anchors` for valid values.
+
+ .. versionadded:: 8.0.0
+
+ :param ink: Foreground ink for rendering in RGBA mode.
+
+ .. versionadded:: 8.0.0
+
+ :return: A tuple of an internal PIL storage memory instance as defined by the
+ :py:mod:`PIL.Image.core` interface module, and the text offset, the
+ gap between the starting coordinate and the first marking
+ """
+ size, offset = self.font.getsize(
+ text, mode, direction, features, language, anchor
+ )
+ size = size[0] + stroke_width * 2, size[1] + stroke_width * 2
+ offset = offset[0] - stroke_width, offset[1] - stroke_width
+ Image._decompression_bomb_check(size)
+ im = fill("RGBA" if mode == "RGBA" else "L", size, 0)
+ self.font.render(
+ text, im.id, mode, direction, features, language, stroke_width, ink
+ )
+ return im, offset
+
+ def font_variant(
+ self, font=None, size=None, index=None, encoding=None, layout_engine=None
+ ):
+ """
+ Create a copy of this FreeTypeFont object,
+ using any specified arguments to override the settings.
+
+ Parameters are identical to the parameters used to initialize this
+ object.
+
+ :return: A FreeTypeFont object.
+ """
+ return FreeTypeFont(
+ font=self.path if font is None else font,
+ size=self.size if size is None else size,
+ index=self.index if index is None else index,
+ encoding=self.encoding if encoding is None else encoding,
+ layout_engine=layout_engine or self.layout_engine,
+ )
+
+ def get_variation_names(self):
+ """
+ :returns: A list of the named styles in a variation font.
+ :exception OSError: If the font is not a variation font.
+ """
+ try:
+ names = self.font.getvarnames()
+ except AttributeError as e:
+ raise NotImplementedError("FreeType 2.9.1 or greater is required") from e
+ return [name.replace(b"\x00", b"") for name in names]
+
+ def set_variation_by_name(self, name):
+ """
+ :param name: The name of the style.
+ :exception OSError: If the font is not a variation font.
+ """
+ names = self.get_variation_names()
+ if not isinstance(name, bytes):
+ name = name.encode()
+ index = names.index(name)
+
+ if index == getattr(self, "_last_variation_index", None):
+ # When the same name is set twice in a row,
+ # there is an 'unknown freetype error'
+ # https://savannah.nongnu.org/bugs/?56186
+ return
+ self._last_variation_index = index
+
+ self.font.setvarname(index)
+
+ def get_variation_axes(self):
+ """
+ :returns: A list of the axes in a variation font.
+ :exception OSError: If the font is not a variation font.
+ """
+ try:
+ axes = self.font.getvaraxes()
+ except AttributeError as e:
+ raise NotImplementedError("FreeType 2.9.1 or greater is required") from e
+ for axis in axes:
+ axis["name"] = axis["name"].replace(b"\x00", b"")
+ return axes
+
+ def set_variation_by_axes(self, axes):
+ """
+ :param axes: A list of values for each axis.
+ :exception OSError: If the font is not a variation font.
+ """
+ try:
+ self.font.setvaraxes(axes)
+ except AttributeError as e:
+ raise NotImplementedError("FreeType 2.9.1 or greater is required") from e
+
+
+class TransposedFont:
+ "Wrapper for writing rotated or mirrored text"
+
+ def __init__(self, font, orientation=None):
+ """
+ Wrapper that creates a transposed font from any existing font
+ object.
+
+ :param font: A font object.
+ :param orientation: An optional orientation. If given, this should
+ be one of Image.FLIP_LEFT_RIGHT, Image.FLIP_TOP_BOTTOM,
+ Image.ROTATE_90, Image.ROTATE_180, or Image.ROTATE_270.
+ """
+ self.font = font
+ self.orientation = orientation # any 'transpose' argument, or None
+
+ def getsize(self, text, *args, **kwargs):
+ w, h = self.font.getsize(text)
+ if self.orientation in (Image.ROTATE_90, Image.ROTATE_270):
+ return h, w
+ return w, h
+
+ def getmask(self, text, mode="", *args, **kwargs):
+ im = self.font.getmask(text, mode, *args, **kwargs)
+ if self.orientation is not None:
+ return im.transpose(self.orientation)
+ return im
+
+
+def load(filename):
+ """
+ Load a font file. This function loads a font object from the given
+ bitmap font file, and returns the corresponding font object.
+
+ :param filename: Name of font file.
+ :return: A font object.
+ :exception OSError: If the file could not be read.
+ """
+ f = ImageFont()
+ f._load_pilfont(filename)
+ return f
+
+
+def truetype(font=None, size=10, index=0, encoding="", layout_engine=None):
+ """
+ Load a TrueType or OpenType font from a file or file-like object,
+ and create a font object.
+ This function loads a font object from the given file or file-like
+ object, and creates a font object for a font of the given size.
+
+ Pillow uses FreeType to open font files. If you are opening many fonts
+ simultaneously on Windows, be aware that Windows limits the number of files
+ that can be open in C at once to 512. If you approach that limit, an
+ ``OSError`` may be thrown, reporting that FreeType "cannot open resource".
+
+ This function requires the _imagingft service.
+
+ :param font: A filename or file-like object containing a TrueType font.
+ If the file is not found in this filename, the loader may also
+ search in other directories, such as the :file:`fonts/`
+ directory on Windows or :file:`/Library/Fonts/`,
+ :file:`/System/Library/Fonts/` and :file:`~/Library/Fonts/` on
+ macOS.
+
+ :param size: The requested size, in points.
+ :param index: Which font face to load (default is first available face).
+ :param encoding: Which font encoding to use (default is Unicode). Possible
+ encodings include (see the FreeType documentation for more
+ information):
+
+ * "unic" (Unicode)
+ * "symb" (Microsoft Symbol)
+ * "ADOB" (Adobe Standard)
+ * "ADBE" (Adobe Expert)
+ * "ADBC" (Adobe Custom)
+ * "armn" (Apple Roman)
+ * "sjis" (Shift JIS)
+ * "gb " (PRC)
+ * "big5"
+ * "wans" (Extended Wansung)
+ * "joha" (Johab)
+ * "lat1" (Latin-1)
+
+ This specifies the character set to use. It does not alter the
+ encoding of any text provided in subsequent operations.
+ :param layout_engine: Which layout engine to use, if available:
+ :data:`.ImageFont.LAYOUT_BASIC` or :data:`.ImageFont.LAYOUT_RAQM`.
+
+ You can check support for Raqm layout using
+ :py:func:`PIL.features.check_feature` with ``feature="raqm"``.
+
+ .. versionadded:: 4.2.0
+ :return: A font object.
+ :exception OSError: If the file could not be read.
+ """
+
+ def freetype(font):
+ return FreeTypeFont(font, size, index, encoding, layout_engine)
+
+ try:
+ return freetype(font)
+ except OSError:
+ if not isPath(font):
+ raise
+ ttf_filename = os.path.basename(font)
+
+ dirs = []
+ if sys.platform == "win32":
+ # check the windows font repository
+ # NOTE: must use uppercase WINDIR, to work around bugs in
+ # 1.5.2's os.environ.get()
+ windir = os.environ.get("WINDIR")
+ if windir:
+ dirs.append(os.path.join(windir, "fonts"))
+ elif sys.platform in ("linux", "linux2"):
+ lindirs = os.environ.get("XDG_DATA_DIRS", "")
+ if not lindirs:
+ # According to the freedesktop spec, XDG_DATA_DIRS should
+ # default to /usr/share
+ lindirs = "/usr/share"
+ dirs += [os.path.join(lindir, "fonts") for lindir in lindirs.split(":")]
+ elif sys.platform == "darwin":
+ dirs += [
+ "/Library/Fonts",
+ "/System/Library/Fonts",
+ os.path.expanduser("~/Library/Fonts"),
+ ]
+
+ ext = os.path.splitext(ttf_filename)[1]
+ first_font_with_a_different_extension = None
+ for directory in dirs:
+ for walkroot, walkdir, walkfilenames in os.walk(directory):
+ for walkfilename in walkfilenames:
+ if ext and walkfilename == ttf_filename:
+ return freetype(os.path.join(walkroot, walkfilename))
+ elif not ext and os.path.splitext(walkfilename)[0] == ttf_filename:
+ fontpath = os.path.join(walkroot, walkfilename)
+ if os.path.splitext(fontpath)[1] == ".ttf":
+ return freetype(fontpath)
+ if not ext and first_font_with_a_different_extension is None:
+ first_font_with_a_different_extension = fontpath
+ if first_font_with_a_different_extension:
+ return freetype(first_font_with_a_different_extension)
+ raise
+
+
+def load_path(filename):
+ """
+ Load font file. Same as :py:func:`~PIL.ImageFont.load`, but searches for a
+ bitmap font along the Python path.
+
+ :param filename: Name of font file.
+ :return: A font object.
+ :exception OSError: If the file could not be read.
+ """
+ for directory in sys.path:
+ if isDirectory(directory):
+ if not isinstance(filename, str):
+ filename = filename.decode("utf-8")
+ try:
+ return load(os.path.join(directory, filename))
+ except OSError:
+ pass
+ raise OSError("cannot find font file")
+
+
+def load_default():
+ """Load a "better than nothing" default font.
+
+ .. versionadded:: 1.1.4
+
+ :return: A font object.
+ """
+ f = ImageFont()
+ f._load_pilfont_data(
+ # courB08
+ BytesIO(
+ base64.b64decode(
+ b"""
+UElMZm9udAo7Ozs7OzsxMDsKREFUQQoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAA//8AAQAAAAAAAAABAAEA
+BgAAAAH/+gADAAAAAQAAAAMABgAGAAAAAf/6AAT//QADAAAABgADAAYAAAAA//kABQABAAYAAAAL
+AAgABgAAAAD/+AAFAAEACwAAABAACQAGAAAAAP/5AAUAAAAQAAAAFQAHAAYAAP////oABQAAABUA
+AAAbAAYABgAAAAH/+QAE//wAGwAAAB4AAwAGAAAAAf/5AAQAAQAeAAAAIQAIAAYAAAAB//kABAAB
+ACEAAAAkAAgABgAAAAD/+QAE//0AJAAAACgABAAGAAAAAP/6AAX//wAoAAAALQAFAAYAAAAB//8A
+BAACAC0AAAAwAAMABgAAAAD//AAF//0AMAAAADUAAQAGAAAAAf//AAMAAAA1AAAANwABAAYAAAAB
+//kABQABADcAAAA7AAgABgAAAAD/+QAFAAAAOwAAAEAABwAGAAAAAP/5AAYAAABAAAAARgAHAAYA
+AAAA//kABQAAAEYAAABLAAcABgAAAAD/+QAFAAAASwAAAFAABwAGAAAAAP/5AAYAAABQAAAAVgAH
+AAYAAAAA//kABQAAAFYAAABbAAcABgAAAAD/+QAFAAAAWwAAAGAABwAGAAAAAP/5AAUAAABgAAAA
+ZQAHAAYAAAAA//kABQAAAGUAAABqAAcABgAAAAD/+QAFAAAAagAAAG8ABwAGAAAAAf/8AAMAAABv
+AAAAcQAEAAYAAAAA//wAAwACAHEAAAB0AAYABgAAAAD/+gAE//8AdAAAAHgABQAGAAAAAP/7AAT/
+/gB4AAAAfAADAAYAAAAB//oABf//AHwAAACAAAUABgAAAAD/+gAFAAAAgAAAAIUABgAGAAAAAP/5
+AAYAAQCFAAAAiwAIAAYAAP////oABgAAAIsAAACSAAYABgAA////+gAFAAAAkgAAAJgABgAGAAAA
+AP/6AAUAAACYAAAAnQAGAAYAAP////oABQAAAJ0AAACjAAYABgAA////+gAFAAAAowAAAKkABgAG
+AAD////6AAUAAACpAAAArwAGAAYAAAAA//oABQAAAK8AAAC0AAYABgAA////+gAGAAAAtAAAALsA
+BgAGAAAAAP/6AAQAAAC7AAAAvwAGAAYAAP////oABQAAAL8AAADFAAYABgAA////+gAGAAAAxQAA
+AMwABgAGAAD////6AAUAAADMAAAA0gAGAAYAAP////oABQAAANIAAADYAAYABgAA////+gAGAAAA
+2AAAAN8ABgAGAAAAAP/6AAUAAADfAAAA5AAGAAYAAP////oABQAAAOQAAADqAAYABgAAAAD/+gAF
+AAEA6gAAAO8ABwAGAAD////6AAYAAADvAAAA9gAGAAYAAAAA//oABQAAAPYAAAD7AAYABgAA////
++gAFAAAA+wAAAQEABgAGAAD////6AAYAAAEBAAABCAAGAAYAAP////oABgAAAQgAAAEPAAYABgAA
+////+gAGAAABDwAAARYABgAGAAAAAP/6AAYAAAEWAAABHAAGAAYAAP////oABgAAARwAAAEjAAYA
+BgAAAAD/+gAFAAABIwAAASgABgAGAAAAAf/5AAQAAQEoAAABKwAIAAYAAAAA//kABAABASsAAAEv
+AAgABgAAAAH/+QAEAAEBLwAAATIACAAGAAAAAP/5AAX//AEyAAABNwADAAYAAAAAAAEABgACATcA
+AAE9AAEABgAAAAH/+QAE//wBPQAAAUAAAwAGAAAAAP/7AAYAAAFAAAABRgAFAAYAAP////kABQAA
+AUYAAAFMAAcABgAAAAD/+wAFAAABTAAAAVEABQAGAAAAAP/5AAYAAAFRAAABVwAHAAYAAAAA//sA
+BQAAAVcAAAFcAAUABgAAAAD/+QAFAAABXAAAAWEABwAGAAAAAP/7AAYAAgFhAAABZwAHAAYAAP//
+//kABQAAAWcAAAFtAAcABgAAAAD/+QAGAAABbQAAAXMABwAGAAAAAP/5AAQAAgFzAAABdwAJAAYA
+AP////kABgAAAXcAAAF+AAcABgAAAAD/+QAGAAABfgAAAYQABwAGAAD////7AAUAAAGEAAABigAF
+AAYAAP////sABQAAAYoAAAGQAAUABgAAAAD/+wAFAAABkAAAAZUABQAGAAD////7AAUAAgGVAAAB
+mwAHAAYAAAAA//sABgACAZsAAAGhAAcABgAAAAD/+wAGAAABoQAAAacABQAGAAAAAP/7AAYAAAGn
+AAABrQAFAAYAAAAA//kABgAAAa0AAAGzAAcABgAA////+wAGAAABswAAAboABQAGAAD////7AAUA
+AAG6AAABwAAFAAYAAP////sABgAAAcAAAAHHAAUABgAAAAD/+wAGAAABxwAAAc0ABQAGAAD////7
+AAYAAgHNAAAB1AAHAAYAAAAA//sABQAAAdQAAAHZAAUABgAAAAH/+QAFAAEB2QAAAd0ACAAGAAAA
+Av/6AAMAAQHdAAAB3gAHAAYAAAAA//kABAABAd4AAAHiAAgABgAAAAD/+wAF//0B4gAAAecAAgAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAB
+//sAAwACAecAAAHpAAcABgAAAAD/+QAFAAEB6QAAAe4ACAAGAAAAAP/5AAYAAAHuAAAB9AAHAAYA
+AAAA//oABf//AfQAAAH5AAUABgAAAAD/+QAGAAAB+QAAAf8ABwAGAAAAAv/5AAMAAgH/AAACAAAJ
+AAYAAAAA//kABQABAgAAAAIFAAgABgAAAAH/+gAE//sCBQAAAggAAQAGAAAAAP/5AAYAAAIIAAAC
+DgAHAAYAAAAB//kABf/+Ag4AAAISAAUABgAA////+wAGAAACEgAAAhkABQAGAAAAAP/7AAX//gIZ
+AAACHgADAAYAAAAA//wABf/9Ah4AAAIjAAEABgAAAAD/+QAHAAACIwAAAioABwAGAAAAAP/6AAT/
++wIqAAACLgABAAYAAAAA//kABP/8Ai4AAAIyAAMABgAAAAD/+gAFAAACMgAAAjcABgAGAAAAAf/5
+AAT//QI3AAACOgAEAAYAAAAB//kABP/9AjoAAAI9AAQABgAAAAL/+QAE//sCPQAAAj8AAgAGAAD/
+///7AAYAAgI/AAACRgAHAAYAAAAA//kABgABAkYAAAJMAAgABgAAAAH//AAD//0CTAAAAk4AAQAG
+AAAAAf//AAQAAgJOAAACUQADAAYAAAAB//kABP/9AlEAAAJUAAQABgAAAAH/+QAF//4CVAAAAlgA
+BQAGAAD////7AAYAAAJYAAACXwAFAAYAAP////kABgAAAl8AAAJmAAcABgAA////+QAGAAACZgAA
+Am0ABwAGAAD////5AAYAAAJtAAACdAAHAAYAAAAA//sABQACAnQAAAJ5AAcABgAA////9wAGAAAC
+eQAAAoAACQAGAAD////3AAYAAAKAAAAChwAJAAYAAP////cABgAAAocAAAKOAAkABgAA////9wAG
+AAACjgAAApUACQAGAAD////4AAYAAAKVAAACnAAIAAYAAP////cABgAAApwAAAKjAAkABgAA////
++gAGAAACowAAAqoABgAGAAAAAP/6AAUAAgKqAAACrwAIAAYAAP////cABQAAAq8AAAK1AAkABgAA
+////9wAFAAACtQAAArsACQAGAAD////3AAUAAAK7AAACwQAJAAYAAP////gABQAAAsEAAALHAAgA
+BgAAAAD/9wAEAAACxwAAAssACQAGAAAAAP/3AAQAAALLAAACzwAJAAYAAAAA//cABAAAAs8AAALT
+AAkABgAAAAD/+AAEAAAC0wAAAtcACAAGAAD////6AAUAAALXAAAC3QAGAAYAAP////cABgAAAt0A
+AALkAAkABgAAAAD/9wAFAAAC5AAAAukACQAGAAAAAP/3AAUAAALpAAAC7gAJAAYAAAAA//cABQAA
+Au4AAALzAAkABgAAAAD/9wAFAAAC8wAAAvgACQAGAAAAAP/4AAUAAAL4AAAC/QAIAAYAAAAA//oA
+Bf//Av0AAAMCAAUABgAA////+gAGAAADAgAAAwkABgAGAAD////3AAYAAAMJAAADEAAJAAYAAP//
+//cABgAAAxAAAAMXAAkABgAA////9wAGAAADFwAAAx4ACQAGAAD////4AAYAAAAAAAoABwASAAYA
+AP////cABgAAAAcACgAOABMABgAA////+gAFAAAADgAKABQAEAAGAAD////6AAYAAAAUAAoAGwAQ
+AAYAAAAA//gABgAAABsACgAhABIABgAAAAD/+AAGAAAAIQAKACcAEgAGAAAAAP/4AAYAAAAnAAoA
+LQASAAYAAAAA//gABgAAAC0ACgAzABIABgAAAAD/+QAGAAAAMwAKADkAEQAGAAAAAP/3AAYAAAA5
+AAoAPwATAAYAAP////sABQAAAD8ACgBFAA8ABgAAAAD/+wAFAAIARQAKAEoAEQAGAAAAAP/4AAUA
+AABKAAoATwASAAYAAAAA//gABQAAAE8ACgBUABIABgAAAAD/+AAFAAAAVAAKAFkAEgAGAAAAAP/5
+AAUAAABZAAoAXgARAAYAAAAA//gABgAAAF4ACgBkABIABgAAAAD/+AAGAAAAZAAKAGoAEgAGAAAA
+AP/4AAYAAABqAAoAcAASAAYAAAAA//kABgAAAHAACgB2ABEABgAAAAD/+AAFAAAAdgAKAHsAEgAG
+AAD////4AAYAAAB7AAoAggASAAYAAAAA//gABQAAAIIACgCHABIABgAAAAD/+AAFAAAAhwAKAIwA
+EgAGAAAAAP/4AAUAAACMAAoAkQASAAYAAAAA//gABQAAAJEACgCWABIABgAAAAD/+QAFAAAAlgAK
+AJsAEQAGAAAAAP/6AAX//wCbAAoAoAAPAAYAAAAA//oABQABAKAACgClABEABgAA////+AAGAAAA
+pQAKAKwAEgAGAAD////4AAYAAACsAAoAswASAAYAAP////gABgAAALMACgC6ABIABgAA////+QAG
+AAAAugAKAMEAEQAGAAD////4AAYAAgDBAAoAyAAUAAYAAP////kABQACAMgACgDOABMABgAA////
++QAGAAIAzgAKANUAEw==
+"""
+ )
+ ),
+ Image.open(
+ BytesIO(
+ base64.b64decode(
+ b"""
+iVBORw0KGgoAAAANSUhEUgAAAx4AAAAUAQAAAAArMtZoAAAEwElEQVR4nABlAJr/AHVE4czCI/4u
+Mc4b7vuds/xzjz5/3/7u/n9vMe7vnfH/9++vPn/xyf5zhxzjt8GHw8+2d83u8x27199/nxuQ6Od9
+M43/5z2I+9n9ZtmDBwMQECDRQw/eQIQohJXxpBCNVE6QCCAAAAD//wBlAJr/AgALyj1t/wINwq0g
+LeNZUworuN1cjTPIzrTX6ofHWeo3v336qPzfEwRmBnHTtf95/fglZK5N0PDgfRTslpGBvz7LFc4F
+IUXBWQGjQ5MGCx34EDFPwXiY4YbYxavpnhHFrk14CDAAAAD//wBlAJr/AgKqRooH2gAgPeggvUAA
+Bu2WfgPoAwzRAABAAAAAAACQgLz/3Uv4Gv+gX7BJgDeeGP6AAAD1NMDzKHD7ANWr3loYbxsAD791
+NAADfcoIDyP44K/jv4Y63/Z+t98Ovt+ub4T48LAAAAD//wBlAJr/AuplMlADJAAAAGuAphWpqhMx
+in0A/fRvAYBABPgBwBUgABBQ/sYAyv9g0bCHgOLoGAAAAAAAREAAwI7nr0ArYpow7aX8//9LaP/9
+SjdavWA8ePHeBIKB//81/83ndznOaXx379wAAAD//wBlAJr/AqDxW+D3AABAAbUh/QMnbQag/gAY
+AYDAAACgtgD/gOqAAAB5IA/8AAAk+n9w0AAA8AAAmFRJuPo27ciC0cD5oeW4E7KA/wD3ECMAn2tt
+y8PgwH8AfAxFzC0JzeAMtratAsC/ffwAAAD//wBlAJr/BGKAyCAA4AAAAvgeYTAwHd1kmQF5chkG
+ABoMIHcL5xVpTfQbUqzlAAAErwAQBgAAEOClA5D9il08AEh/tUzdCBsXkbgACED+woQg8Si9VeqY
+lODCn7lmF6NhnAEYgAAA/NMIAAAAAAD//2JgjLZgVGBg5Pv/Tvpc8hwGBjYGJADjHDrAwPzAjv/H
+/Wf3PzCwtzcwHmBgYGcwbZz8wHaCAQMDOwMDQ8MCBgYOC3W7mp+f0w+wHOYxO3OG+e376hsMZjk3
+AAAAAP//YmCMY2A4wMAIN5e5gQETPD6AZisDAwMDgzSDAAPjByiHcQMDAwMDg1nOze1lByRu5/47
+c4859311AYNZzg0AAAAA//9iYGDBYihOIIMuwIjGL39/fwffA8b//xv/P2BPtzzHwCBjUQAAAAD/
+/yLFBrIBAAAA//9i1HhcwdhizX7u8NZNzyLbvT97bfrMf/QHI8evOwcSqGUJAAAA//9iYBB81iSw
+pEE170Qrg5MIYydHqwdDQRMrAwcVrQAAAAD//2J4x7j9AAMDn8Q/BgYLBoaiAwwMjPdvMDBYM1Tv
+oJodAAAAAP//Yqo/83+dxePWlxl3npsel9lvLfPcqlE9725C+acfVLMEAAAA//9i+s9gwCoaaGMR
+evta/58PTEWzr21hufPjA8N+qlnBwAAAAAD//2JiWLci5v1+HmFXDqcnULE/MxgYGBj+f6CaJQAA
+AAD//2Ji2FrkY3iYpYC5qDeGgeEMAwPDvwQBBoYvcTwOVLMEAAAA//9isDBgkP///0EOg9z35v//
+Gc/eeW7BwPj5+QGZhANUswMAAAD//2JgqGBgYGBgqEMXlvhMPUsAAAAA//8iYDd1AAAAAP//AwDR
+w7IkEbzhVQAAAABJRU5ErkJggg==
+"""
+ )
+ )
+ ),
+ )
+ return f
diff --git a/venv/Lib/site-packages/PIL/ImageGrab.py b/venv/Lib/site-packages/PIL/ImageGrab.py
new file mode 100644
index 0000000..b93ec3f
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageGrab.py
@@ -0,0 +1,120 @@
+#
+# The Python Imaging Library
+# $Id$
+#
+# screen grabber
+#
+# History:
+# 2001-04-26 fl created
+# 2001-09-17 fl use builtin driver, if present
+# 2002-11-19 fl added grabclipboard support
+#
+# Copyright (c) 2001-2002 by Secret Labs AB
+# Copyright (c) 2001-2002 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import sys
+
+from . import Image
+
+if sys.platform == "darwin":
+ import os
+ import subprocess
+ import tempfile
+
+
+def grab(bbox=None, include_layered_windows=False, all_screens=False, xdisplay=None):
+ if xdisplay is None:
+ if sys.platform == "darwin":
+ fh, filepath = tempfile.mkstemp(".png")
+ os.close(fh)
+ subprocess.call(["screencapture", "-x", filepath])
+ im = Image.open(filepath)
+ im.load()
+ os.unlink(filepath)
+ if bbox:
+ im_cropped = im.crop(bbox)
+ im.close()
+ return im_cropped
+ return im
+ elif sys.platform == "win32":
+ offset, size, data = Image.core.grabscreen_win32(
+ include_layered_windows, all_screens
+ )
+ im = Image.frombytes(
+ "RGB",
+ size,
+ data,
+ # RGB, 32-bit line padding, origin lower left corner
+ "raw",
+ "BGR",
+ (size[0] * 3 + 3) & -4,
+ -1,
+ )
+ if bbox:
+ x0, y0 = offset
+ left, top, right, bottom = bbox
+ im = im.crop((left - x0, top - y0, right - x0, bottom - y0))
+ return im
+ # use xdisplay=None for default display on non-win32/macOS systems
+ if not Image.core.HAVE_XCB:
+ raise OSError("Pillow was built without XCB support")
+ size, data = Image.core.grabscreen_x11(xdisplay)
+ im = Image.frombytes("RGB", size, data, "raw", "BGRX", size[0] * 4, 1)
+ if bbox:
+ im = im.crop(bbox)
+ return im
+
+
+def grabclipboard():
+ if sys.platform == "darwin":
+ fh, filepath = tempfile.mkstemp(".jpg")
+ os.close(fh)
+ commands = [
+ 'set theFile to (open for access POSIX file "'
+ + filepath
+ + '" with write permission)',
+ "try",
+ " write (the clipboard as JPEG picture) to theFile",
+ "end try",
+ "close access theFile",
+ ]
+ script = ["osascript"]
+ for command in commands:
+ script += ["-e", command]
+ subprocess.call(script)
+
+ im = None
+ if os.stat(filepath).st_size != 0:
+ im = Image.open(filepath)
+ im.load()
+ os.unlink(filepath)
+ return im
+ elif sys.platform == "win32":
+ fmt, data = Image.core.grabclipboard_win32()
+ if fmt == "file": # CF_HDROP
+ import struct
+
+ o = struct.unpack_from("I", data)[0]
+ if data[16] != 0:
+ files = data[o:].decode("utf-16le").split("\0")
+ else:
+ files = data[o:].decode("mbcs").split("\0")
+ return files[: files.index("")]
+ if isinstance(data, bytes):
+ import io
+
+ data = io.BytesIO(data)
+ if fmt == "png":
+ from . import PngImagePlugin
+
+ return PngImagePlugin.PngImageFile(data)
+ elif fmt == "DIB":
+ from . import BmpImagePlugin
+
+ return BmpImagePlugin.DibImageFile(data)
+ return None
+ else:
+ raise NotImplementedError("ImageGrab.grabclipboard() is macOS and Windows only")
diff --git a/venv/Lib/site-packages/PIL/ImageMath.py b/venv/Lib/site-packages/PIL/ImageMath.py
new file mode 100644
index 0000000..7f9c88e
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageMath.py
@@ -0,0 +1,253 @@
+#
+# The Python Imaging Library
+# $Id$
+#
+# a simple math add-on for the Python Imaging Library
+#
+# History:
+# 1999-02-15 fl Original PIL Plus release
+# 2005-05-05 fl Simplified and cleaned up for PIL 1.1.6
+# 2005-09-12 fl Fixed int() and float() for Python 2.4.1
+#
+# Copyright (c) 1999-2005 by Secret Labs AB
+# Copyright (c) 2005 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import builtins
+
+from . import Image, _imagingmath
+
+VERBOSE = 0
+
+
+def _isconstant(v):
+ return isinstance(v, (int, float))
+
+
+class _Operand:
+ """Wraps an image operand, providing standard operators"""
+
+ def __init__(self, im):
+ self.im = im
+
+ def __fixup(self, im1):
+ # convert image to suitable mode
+ if isinstance(im1, _Operand):
+ # argument was an image.
+ if im1.im.mode in ("1", "L"):
+ return im1.im.convert("I")
+ elif im1.im.mode in ("I", "F"):
+ return im1.im
+ else:
+ raise ValueError(f"unsupported mode: {im1.im.mode}")
+ else:
+ # argument was a constant
+ if _isconstant(im1) and self.im.mode in ("1", "L", "I"):
+ return Image.new("I", self.im.size, im1)
+ else:
+ return Image.new("F", self.im.size, im1)
+
+ def apply(self, op, im1, im2=None, mode=None):
+ im1 = self.__fixup(im1)
+ if im2 is None:
+ # unary operation
+ out = Image.new(mode or im1.mode, im1.size, None)
+ im1.load()
+ try:
+ op = getattr(_imagingmath, op + "_" + im1.mode)
+ except AttributeError as e:
+ raise TypeError(f"bad operand type for '{op}'") from e
+ _imagingmath.unop(op, out.im.id, im1.im.id)
+ else:
+ # binary operation
+ im2 = self.__fixup(im2)
+ if im1.mode != im2.mode:
+ # convert both arguments to floating point
+ if im1.mode != "F":
+ im1 = im1.convert("F")
+ if im2.mode != "F":
+ im2 = im2.convert("F")
+ if im1.mode != im2.mode:
+ raise ValueError("mode mismatch")
+ if im1.size != im2.size:
+ # crop both arguments to a common size
+ size = (min(im1.size[0], im2.size[0]), min(im1.size[1], im2.size[1]))
+ if im1.size != size:
+ im1 = im1.crop((0, 0) + size)
+ if im2.size != size:
+ im2 = im2.crop((0, 0) + size)
+ out = Image.new(mode or im1.mode, size, None)
+ else:
+ out = Image.new(mode or im1.mode, im1.size, None)
+ im1.load()
+ im2.load()
+ try:
+ op = getattr(_imagingmath, op + "_" + im1.mode)
+ except AttributeError as e:
+ raise TypeError(f"bad operand type for '{op}'") from e
+ _imagingmath.binop(op, out.im.id, im1.im.id, im2.im.id)
+ return _Operand(out)
+
+ # unary operators
+ def __bool__(self):
+ # an image is "true" if it contains at least one non-zero pixel
+ return self.im.getbbox() is not None
+
+ def __abs__(self):
+ return self.apply("abs", self)
+
+ def __pos__(self):
+ return self
+
+ def __neg__(self):
+ return self.apply("neg", self)
+
+ # binary operators
+ def __add__(self, other):
+ return self.apply("add", self, other)
+
+ def __radd__(self, other):
+ return self.apply("add", other, self)
+
+ def __sub__(self, other):
+ return self.apply("sub", self, other)
+
+ def __rsub__(self, other):
+ return self.apply("sub", other, self)
+
+ def __mul__(self, other):
+ return self.apply("mul", self, other)
+
+ def __rmul__(self, other):
+ return self.apply("mul", other, self)
+
+ def __truediv__(self, other):
+ return self.apply("div", self, other)
+
+ def __rtruediv__(self, other):
+ return self.apply("div", other, self)
+
+ def __mod__(self, other):
+ return self.apply("mod", self, other)
+
+ def __rmod__(self, other):
+ return self.apply("mod", other, self)
+
+ def __pow__(self, other):
+ return self.apply("pow", self, other)
+
+ def __rpow__(self, other):
+ return self.apply("pow", other, self)
+
+ # bitwise
+ def __invert__(self):
+ return self.apply("invert", self)
+
+ def __and__(self, other):
+ return self.apply("and", self, other)
+
+ def __rand__(self, other):
+ return self.apply("and", other, self)
+
+ def __or__(self, other):
+ return self.apply("or", self, other)
+
+ def __ror__(self, other):
+ return self.apply("or", other, self)
+
+ def __xor__(self, other):
+ return self.apply("xor", self, other)
+
+ def __rxor__(self, other):
+ return self.apply("xor", other, self)
+
+ def __lshift__(self, other):
+ return self.apply("lshift", self, other)
+
+ def __rshift__(self, other):
+ return self.apply("rshift", self, other)
+
+ # logical
+ def __eq__(self, other):
+ return self.apply("eq", self, other)
+
+ def __ne__(self, other):
+ return self.apply("ne", self, other)
+
+ def __lt__(self, other):
+ return self.apply("lt", self, other)
+
+ def __le__(self, other):
+ return self.apply("le", self, other)
+
+ def __gt__(self, other):
+ return self.apply("gt", self, other)
+
+ def __ge__(self, other):
+ return self.apply("ge", self, other)
+
+
+# conversions
+def imagemath_int(self):
+ return _Operand(self.im.convert("I"))
+
+
+def imagemath_float(self):
+ return _Operand(self.im.convert("F"))
+
+
+# logical
+def imagemath_equal(self, other):
+ return self.apply("eq", self, other, mode="I")
+
+
+def imagemath_notequal(self, other):
+ return self.apply("ne", self, other, mode="I")
+
+
+def imagemath_min(self, other):
+ return self.apply("min", self, other)
+
+
+def imagemath_max(self, other):
+ return self.apply("max", self, other)
+
+
+def imagemath_convert(self, mode):
+ return _Operand(self.im.convert(mode))
+
+
+ops = {}
+for k, v in list(globals().items()):
+ if k[:10] == "imagemath_":
+ ops[k[10:]] = v
+
+
+def eval(expression, _dict={}, **kw):
+ """
+ Evaluates an image expression.
+
+ :param expression: A string containing a Python-style expression.
+ :param options: Values to add to the evaluation context. You
+ can either use a dictionary, or one or more keyword
+ arguments.
+ :return: The evaluated expression. This is usually an image object, but can
+ also be an integer, a floating point value, or a pixel tuple,
+ depending on the expression.
+ """
+
+ # build execution namespace
+ args = ops.copy()
+ args.update(_dict)
+ args.update(kw)
+ for k, v in list(args.items()):
+ if hasattr(v, "im"):
+ args[k] = _Operand(v)
+
+ out = builtins.eval(expression, args)
+ try:
+ return out.im
+ except AttributeError:
+ return out
diff --git a/venv/Lib/site-packages/PIL/ImageMode.py b/venv/Lib/site-packages/PIL/ImageMode.py
new file mode 100644
index 0000000..0afcf9f
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageMode.py
@@ -0,0 +1,74 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# standard mode descriptors
+#
+# History:
+# 2006-03-20 fl Added
+#
+# Copyright (c) 2006 by Secret Labs AB.
+# Copyright (c) 2006 by Fredrik Lundh.
+#
+# See the README file for information on usage and redistribution.
+#
+
+# mode descriptor cache
+_modes = None
+
+
+class ModeDescriptor:
+ """Wrapper for mode strings."""
+
+ def __init__(self, mode, bands, basemode, basetype):
+ self.mode = mode
+ self.bands = bands
+ self.basemode = basemode
+ self.basetype = basetype
+
+ def __str__(self):
+ return self.mode
+
+
+def getmode(mode):
+ """Gets a mode descriptor for the given mode."""
+ global _modes
+ if not _modes:
+ # initialize mode cache
+ modes = {}
+ for m, (basemode, basetype, bands) in {
+ # core modes
+ "1": ("L", "L", ("1",)),
+ "L": ("L", "L", ("L",)),
+ "I": ("L", "I", ("I",)),
+ "F": ("L", "F", ("F",)),
+ "P": ("P", "L", ("P",)),
+ "RGB": ("RGB", "L", ("R", "G", "B")),
+ "RGBX": ("RGB", "L", ("R", "G", "B", "X")),
+ "RGBA": ("RGB", "L", ("R", "G", "B", "A")),
+ "CMYK": ("RGB", "L", ("C", "M", "Y", "K")),
+ "YCbCr": ("RGB", "L", ("Y", "Cb", "Cr")),
+ "LAB": ("RGB", "L", ("L", "A", "B")),
+ "HSV": ("RGB", "L", ("H", "S", "V")),
+ # extra experimental modes
+ "RGBa": ("RGB", "L", ("R", "G", "B", "a")),
+ "LA": ("L", "L", ("L", "A")),
+ "La": ("L", "L", ("L", "a")),
+ "PA": ("RGB", "L", ("P", "A")),
+ }.items():
+ modes[m] = ModeDescriptor(m, bands, basemode, basetype)
+ # mapping modes
+ for i16mode in (
+ "I;16",
+ "I;16S",
+ "I;16L",
+ "I;16LS",
+ "I;16B",
+ "I;16BS",
+ "I;16N",
+ "I;16NS",
+ ):
+ modes[i16mode] = ModeDescriptor(i16mode, ("I",), "L", "L")
+ # set global mode cache atomically
+ _modes = modes
+ return _modes[mode]
diff --git a/venv/Lib/site-packages/PIL/ImageMorph.py b/venv/Lib/site-packages/PIL/ImageMorph.py
new file mode 100644
index 0000000..b76dfa0
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageMorph.py
@@ -0,0 +1,245 @@
+# A binary morphology add-on for the Python Imaging Library
+#
+# History:
+# 2014-06-04 Initial version.
+#
+# Copyright (c) 2014 Dov Grobgeld
+
+import re
+
+from . import Image, _imagingmorph
+
+LUT_SIZE = 1 << 9
+
+# fmt: off
+ROTATION_MATRIX = [
+ 6, 3, 0,
+ 7, 4, 1,
+ 8, 5, 2,
+]
+MIRROR_MATRIX = [
+ 2, 1, 0,
+ 5, 4, 3,
+ 8, 7, 6,
+]
+# fmt: on
+
+
+class LutBuilder:
+ """A class for building a MorphLut from a descriptive language
+
+ The input patterns is a list of a strings sequences like these::
+
+ 4:(...
+ .1.
+ 111)->1
+
+ (whitespaces including linebreaks are ignored). The option 4
+ describes a series of symmetry operations (in this case a
+ 4-rotation), the pattern is described by:
+
+ - . or X - Ignore
+ - 1 - Pixel is on
+ - 0 - Pixel is off
+
+ The result of the operation is described after "->" string.
+
+ The default is to return the current pixel value, which is
+ returned if no other match is found.
+
+ Operations:
+
+ - 4 - 4 way rotation
+ - N - Negate
+ - 1 - Dummy op for no other operation (an op must always be given)
+ - M - Mirroring
+
+ Example::
+
+ lb = LutBuilder(patterns = ["4:(... .1. 111)->1"])
+ lut = lb.build_lut()
+
+ """
+
+ def __init__(self, patterns=None, op_name=None):
+ if patterns is not None:
+ self.patterns = patterns
+ else:
+ self.patterns = []
+ self.lut = None
+ if op_name is not None:
+ known_patterns = {
+ "corner": ["1:(... ... ...)->0", "4:(00. 01. ...)->1"],
+ "dilation4": ["4:(... .0. .1.)->1"],
+ "dilation8": ["4:(... .0. .1.)->1", "4:(... .0. ..1)->1"],
+ "erosion4": ["4:(... .1. .0.)->0"],
+ "erosion8": ["4:(... .1. .0.)->0", "4:(... .1. ..0)->0"],
+ "edge": [
+ "1:(... ... ...)->0",
+ "4:(.0. .1. ...)->1",
+ "4:(01. .1. ...)->1",
+ ],
+ }
+ if op_name not in known_patterns:
+ raise Exception("Unknown pattern " + op_name + "!")
+
+ self.patterns = known_patterns[op_name]
+
+ def add_patterns(self, patterns):
+ self.patterns += patterns
+
+ def build_default_lut(self):
+ symbols = [0, 1]
+ m = 1 << 4 # pos of current pixel
+ self.lut = bytearray(symbols[(i & m) > 0] for i in range(LUT_SIZE))
+
+ def get_lut(self):
+ return self.lut
+
+ def _string_permute(self, pattern, permutation):
+ """string_permute takes a pattern and a permutation and returns the
+ string permuted according to the permutation list.
+ """
+ assert len(permutation) == 9
+ return "".join(pattern[p] for p in permutation)
+
+ def _pattern_permute(self, basic_pattern, options, basic_result):
+ """pattern_permute takes a basic pattern and its result and clones
+ the pattern according to the modifications described in the $options
+ parameter. It returns a list of all cloned patterns."""
+ patterns = [(basic_pattern, basic_result)]
+
+ # rotations
+ if "4" in options:
+ res = patterns[-1][1]
+ for i in range(4):
+ patterns.append(
+ (self._string_permute(patterns[-1][0], ROTATION_MATRIX), res)
+ )
+ # mirror
+ if "M" in options:
+ n = len(patterns)
+ for pattern, res in patterns[0:n]:
+ patterns.append((self._string_permute(pattern, MIRROR_MATRIX), res))
+
+ # negate
+ if "N" in options:
+ n = len(patterns)
+ for pattern, res in patterns[0:n]:
+ # Swap 0 and 1
+ pattern = pattern.replace("0", "Z").replace("1", "0").replace("Z", "1")
+ res = 1 - int(res)
+ patterns.append((pattern, res))
+
+ return patterns
+
+ def build_lut(self):
+ """Compile all patterns into a morphology lut.
+
+ TBD :Build based on (file) morphlut:modify_lut
+ """
+ self.build_default_lut()
+ patterns = []
+
+ # Parse and create symmetries of the patterns strings
+ for p in self.patterns:
+ m = re.search(r"(\w*):?\s*\((.+?)\)\s*->\s*(\d)", p.replace("\n", ""))
+ if not m:
+ raise Exception('Syntax error in pattern "' + p + '"')
+ options = m.group(1)
+ pattern = m.group(2)
+ result = int(m.group(3))
+
+ # Get rid of spaces
+ pattern = pattern.replace(" ", "").replace("\n", "")
+
+ patterns += self._pattern_permute(pattern, options, result)
+
+ # compile the patterns into regular expressions for speed
+ for i, pattern in enumerate(patterns):
+ p = pattern[0].replace(".", "X").replace("X", "[01]")
+ p = re.compile(p)
+ patterns[i] = (p, pattern[1])
+
+ # Step through table and find patterns that match.
+ # Note that all the patterns are searched. The last one
+ # caught overrides
+ for i in range(LUT_SIZE):
+ # Build the bit pattern
+ bitpattern = bin(i)[2:]
+ bitpattern = ("0" * (9 - len(bitpattern)) + bitpattern)[::-1]
+
+ for p, r in patterns:
+ if p.match(bitpattern):
+ self.lut[i] = [0, 1][r]
+
+ return self.lut
+
+
+class MorphOp:
+ """A class for binary morphological operators"""
+
+ def __init__(self, lut=None, op_name=None, patterns=None):
+ """Create a binary morphological operator"""
+ self.lut = lut
+ if op_name is not None:
+ self.lut = LutBuilder(op_name=op_name).build_lut()
+ elif patterns is not None:
+ self.lut = LutBuilder(patterns=patterns).build_lut()
+
+ def apply(self, image):
+ """Run a single morphological operation on an image
+
+ Returns a tuple of the number of changed pixels and the
+ morphed image"""
+ if self.lut is None:
+ raise Exception("No operator loaded")
+
+ if image.mode != "L":
+ raise Exception("Image must be binary, meaning it must use mode L")
+ outimage = Image.new(image.mode, image.size, None)
+ count = _imagingmorph.apply(bytes(self.lut), image.im.id, outimage.im.id)
+ return count, outimage
+
+ def match(self, image):
+ """Get a list of coordinates matching the morphological operation on
+ an image.
+
+ Returns a list of tuples of (x,y) coordinates
+ of all matching pixels. See :ref:`coordinate-system`."""
+ if self.lut is None:
+ raise Exception("No operator loaded")
+
+ if image.mode != "L":
+ raise Exception("Image must be binary, meaning it must use mode L")
+ return _imagingmorph.match(bytes(self.lut), image.im.id)
+
+ def get_on_pixels(self, image):
+ """Get a list of all turned on pixels in a binary image
+
+ Returns a list of tuples of (x,y) coordinates
+ of all matching pixels. See :ref:`coordinate-system`."""
+
+ if image.mode != "L":
+ raise Exception("Image must be binary, meaning it must use mode L")
+ return _imagingmorph.get_on_pixels(image.im.id)
+
+ def load_lut(self, filename):
+ """Load an operator from an mrl file"""
+ with open(filename, "rb") as f:
+ self.lut = bytearray(f.read())
+
+ if len(self.lut) != LUT_SIZE:
+ self.lut = None
+ raise Exception("Wrong size operator file!")
+
+ def save_lut(self, filename):
+ """Save an operator to an mrl file"""
+ if self.lut is None:
+ raise Exception("No operator loaded")
+ with open(filename, "wb") as f:
+ f.write(self.lut)
+
+ def set_lut(self, lut):
+ """Set the lut from an external source"""
+ self.lut = lut
diff --git a/venv/Lib/site-packages/PIL/ImageOps.py b/venv/Lib/site-packages/PIL/ImageOps.py
new file mode 100644
index 0000000..d69a304
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageOps.py
@@ -0,0 +1,566 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# standard image operations
+#
+# History:
+# 2001-10-20 fl Created
+# 2001-10-23 fl Added autocontrast operator
+# 2001-12-18 fl Added Kevin's fit operator
+# 2004-03-14 fl Fixed potential division by zero in equalize
+# 2005-05-05 fl Fixed equalize for low number of values
+#
+# Copyright (c) 2001-2004 by Secret Labs AB
+# Copyright (c) 2001-2004 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import functools
+import operator
+
+from . import Image
+
+#
+# helpers
+
+
+def _border(border):
+ if isinstance(border, tuple):
+ if len(border) == 2:
+ left, top = right, bottom = border
+ elif len(border) == 4:
+ left, top, right, bottom = border
+ else:
+ left = top = right = bottom = border
+ return left, top, right, bottom
+
+
+def _color(color, mode):
+ if isinstance(color, str):
+ from . import ImageColor
+
+ color = ImageColor.getcolor(color, mode)
+ return color
+
+
+def _lut(image, lut):
+ if image.mode == "P":
+ # FIXME: apply to lookup table, not image data
+ raise NotImplementedError("mode P support coming soon")
+ elif image.mode in ("L", "RGB"):
+ if image.mode == "RGB" and len(lut) == 256:
+ lut = lut + lut + lut
+ return image.point(lut)
+ else:
+ raise OSError("not supported for this image mode")
+
+
+#
+# actions
+
+
+def autocontrast(image, cutoff=0, ignore=None, mask=None, preserve_tone=False):
+ """
+ Maximize (normalize) image contrast. This function calculates a
+ histogram of the input image (or mask region), removes ``cutoff`` percent of the
+ lightest and darkest pixels from the histogram, and remaps the image
+ so that the darkest pixel becomes black (0), and the lightest
+ becomes white (255).
+
+ :param image: The image to process.
+ :param cutoff: The percent to cut off from the histogram on the low and
+ high ends. Either a tuple of (low, high), or a single
+ number for both.
+ :param ignore: The background pixel value (use None for no background).
+ :param mask: Histogram used in contrast operation is computed using pixels
+ within the mask. If no mask is given the entire image is used
+ for histogram computation.
+ :param preserve_tone: Preserve image tone in Photoshop-like style autocontrast.
+
+ .. versionadded:: 8.2.0
+
+ :return: An image.
+ """
+ if preserve_tone:
+ histogram = image.convert("L").histogram(mask)
+ else:
+ histogram = image.histogram(mask)
+
+ lut = []
+ for layer in range(0, len(histogram), 256):
+ h = histogram[layer : layer + 256]
+ if ignore is not None:
+ # get rid of outliers
+ try:
+ h[ignore] = 0
+ except TypeError:
+ # assume sequence
+ for ix in ignore:
+ h[ix] = 0
+ if cutoff:
+ # cut off pixels from both ends of the histogram
+ if not isinstance(cutoff, tuple):
+ cutoff = (cutoff, cutoff)
+ # get number of pixels
+ n = 0
+ for ix in range(256):
+ n = n + h[ix]
+ # remove cutoff% pixels from the low end
+ cut = n * cutoff[0] // 100
+ for lo in range(256):
+ if cut > h[lo]:
+ cut = cut - h[lo]
+ h[lo] = 0
+ else:
+ h[lo] -= cut
+ cut = 0
+ if cut <= 0:
+ break
+ # remove cutoff% samples from the high end
+ cut = n * cutoff[1] // 100
+ for hi in range(255, -1, -1):
+ if cut > h[hi]:
+ cut = cut - h[hi]
+ h[hi] = 0
+ else:
+ h[hi] -= cut
+ cut = 0
+ if cut <= 0:
+ break
+ # find lowest/highest samples after preprocessing
+ for lo in range(256):
+ if h[lo]:
+ break
+ for hi in range(255, -1, -1):
+ if h[hi]:
+ break
+ if hi <= lo:
+ # don't bother
+ lut.extend(list(range(256)))
+ else:
+ scale = 255.0 / (hi - lo)
+ offset = -lo * scale
+ for ix in range(256):
+ ix = int(ix * scale + offset)
+ if ix < 0:
+ ix = 0
+ elif ix > 255:
+ ix = 255
+ lut.append(ix)
+ return _lut(image, lut)
+
+
+def colorize(image, black, white, mid=None, blackpoint=0, whitepoint=255, midpoint=127):
+ """
+ Colorize grayscale image.
+ This function calculates a color wedge which maps all black pixels in
+ the source image to the first color and all white pixels to the
+ second color. If ``mid`` is specified, it uses three-color mapping.
+ The ``black`` and ``white`` arguments should be RGB tuples or color names;
+ optionally you can use three-color mapping by also specifying ``mid``.
+ Mapping positions for any of the colors can be specified
+ (e.g. ``blackpoint``), where these parameters are the integer
+ value corresponding to where the corresponding color should be mapped.
+ These parameters must have logical order, such that
+ ``blackpoint <= midpoint <= whitepoint`` (if ``mid`` is specified).
+
+ :param image: The image to colorize.
+ :param black: The color to use for black input pixels.
+ :param white: The color to use for white input pixels.
+ :param mid: The color to use for midtone input pixels.
+ :param blackpoint: an int value [0, 255] for the black mapping.
+ :param whitepoint: an int value [0, 255] for the white mapping.
+ :param midpoint: an int value [0, 255] for the midtone mapping.
+ :return: An image.
+ """
+
+ # Initial asserts
+ assert image.mode == "L"
+ if mid is None:
+ assert 0 <= blackpoint <= whitepoint <= 255
+ else:
+ assert 0 <= blackpoint <= midpoint <= whitepoint <= 255
+
+ # Define colors from arguments
+ black = _color(black, "RGB")
+ white = _color(white, "RGB")
+ if mid is not None:
+ mid = _color(mid, "RGB")
+
+ # Empty lists for the mapping
+ red = []
+ green = []
+ blue = []
+
+ # Create the low-end values
+ for i in range(0, blackpoint):
+ red.append(black[0])
+ green.append(black[1])
+ blue.append(black[2])
+
+ # Create the mapping (2-color)
+ if mid is None:
+
+ range_map = range(0, whitepoint - blackpoint)
+
+ for i in range_map:
+ red.append(black[0] + i * (white[0] - black[0]) // len(range_map))
+ green.append(black[1] + i * (white[1] - black[1]) // len(range_map))
+ blue.append(black[2] + i * (white[2] - black[2]) // len(range_map))
+
+ # Create the mapping (3-color)
+ else:
+
+ range_map1 = range(0, midpoint - blackpoint)
+ range_map2 = range(0, whitepoint - midpoint)
+
+ for i in range_map1:
+ red.append(black[0] + i * (mid[0] - black[0]) // len(range_map1))
+ green.append(black[1] + i * (mid[1] - black[1]) // len(range_map1))
+ blue.append(black[2] + i * (mid[2] - black[2]) // len(range_map1))
+ for i in range_map2:
+ red.append(mid[0] + i * (white[0] - mid[0]) // len(range_map2))
+ green.append(mid[1] + i * (white[1] - mid[1]) // len(range_map2))
+ blue.append(mid[2] + i * (white[2] - mid[2]) // len(range_map2))
+
+ # Create the high-end values
+ for i in range(0, 256 - whitepoint):
+ red.append(white[0])
+ green.append(white[1])
+ blue.append(white[2])
+
+ # Return converted image
+ image = image.convert("RGB")
+ return _lut(image, red + green + blue)
+
+
+def pad(image, size, method=Image.BICUBIC, color=None, centering=(0.5, 0.5)):
+ """
+ Returns a sized and padded version of the image, expanded to fill the
+ requested aspect ratio and size.
+
+ :param image: The image to size and crop.
+ :param size: The requested output size in pixels, given as a
+ (width, height) tuple.
+ :param method: What resampling method to use. Default is
+ :py:attr:`PIL.Image.BICUBIC`. See :ref:`concept-filters`.
+ :param color: The background color of the padded image.
+ :param centering: Control the position of the original image within the
+ padded version.
+
+ (0.5, 0.5) will keep the image centered
+ (0, 0) will keep the image aligned to the top left
+ (1, 1) will keep the image aligned to the bottom
+ right
+ :return: An image.
+ """
+
+ im_ratio = image.width / image.height
+ dest_ratio = size[0] / size[1]
+
+ if im_ratio == dest_ratio:
+ out = image.resize(size, resample=method)
+ else:
+ out = Image.new(image.mode, size, color)
+ if im_ratio > dest_ratio:
+ new_height = int(image.height / image.width * size[0])
+ if new_height != size[1]:
+ image = image.resize((size[0], new_height), resample=method)
+
+ y = int((size[1] - new_height) * max(0, min(centering[1], 1)))
+ out.paste(image, (0, y))
+ else:
+ new_width = int(image.width / image.height * size[1])
+ if new_width != size[0]:
+ image = image.resize((new_width, size[1]), resample=method)
+
+ x = int((size[0] - new_width) * max(0, min(centering[0], 1)))
+ out.paste(image, (x, 0))
+ return out
+
+
+def crop(image, border=0):
+ """
+ Remove border from image. The same amount of pixels are removed
+ from all four sides. This function works on all image modes.
+
+ .. seealso:: :py:meth:`~PIL.Image.Image.crop`
+
+ :param image: The image to crop.
+ :param border: The number of pixels to remove.
+ :return: An image.
+ """
+ left, top, right, bottom = _border(border)
+ return image.crop((left, top, image.size[0] - right, image.size[1] - bottom))
+
+
+def scale(image, factor, resample=Image.BICUBIC):
+ """
+ Returns a rescaled image by a specific factor given in parameter.
+ A factor greater than 1 expands the image, between 0 and 1 contracts the
+ image.
+
+ :param image: The image to rescale.
+ :param factor: The expansion factor, as a float.
+ :param resample: What resampling method to use. Default is
+ :py:attr:`PIL.Image.BICUBIC`. See :ref:`concept-filters`.
+ :returns: An :py:class:`~PIL.Image.Image` object.
+ """
+ if factor == 1:
+ return image.copy()
+ elif factor <= 0:
+ raise ValueError("the factor must be greater than 0")
+ else:
+ size = (round(factor * image.width), round(factor * image.height))
+ return image.resize(size, resample)
+
+
+def deform(image, deformer, resample=Image.BILINEAR):
+ """
+ Deform the image.
+
+ :param image: The image to deform.
+ :param deformer: A deformer object. Any object that implements a
+ ``getmesh`` method can be used.
+ :param resample: An optional resampling filter. Same values possible as
+ in the PIL.Image.transform function.
+ :return: An image.
+ """
+ return image.transform(image.size, Image.MESH, deformer.getmesh(image), resample)
+
+
+def equalize(image, mask=None):
+ """
+ Equalize the image histogram. This function applies a non-linear
+ mapping to the input image, in order to create a uniform
+ distribution of grayscale values in the output image.
+
+ :param image: The image to equalize.
+ :param mask: An optional mask. If given, only the pixels selected by
+ the mask are included in the analysis.
+ :return: An image.
+ """
+ if image.mode == "P":
+ image = image.convert("RGB")
+ h = image.histogram(mask)
+ lut = []
+ for b in range(0, len(h), 256):
+ histo = [_f for _f in h[b : b + 256] if _f]
+ if len(histo) <= 1:
+ lut.extend(list(range(256)))
+ else:
+ step = (functools.reduce(operator.add, histo) - histo[-1]) // 255
+ if not step:
+ lut.extend(list(range(256)))
+ else:
+ n = step // 2
+ for i in range(256):
+ lut.append(n // step)
+ n = n + h[i + b]
+ return _lut(image, lut)
+
+
+def expand(image, border=0, fill=0):
+ """
+ Add border to the image
+
+ :param image: The image to expand.
+ :param border: Border width, in pixels.
+ :param fill: Pixel fill value (a color value). Default is 0 (black).
+ :return: An image.
+ """
+ left, top, right, bottom = _border(border)
+ width = left + image.size[0] + right
+ height = top + image.size[1] + bottom
+ out = Image.new(image.mode, (width, height), _color(fill, image.mode))
+ out.paste(image, (left, top))
+ return out
+
+
+def fit(image, size, method=Image.BICUBIC, bleed=0.0, centering=(0.5, 0.5)):
+ """
+ Returns a sized and cropped version of the image, cropped to the
+ requested aspect ratio and size.
+
+ This function was contributed by Kevin Cazabon.
+
+ :param image: The image to size and crop.
+ :param size: The requested output size in pixels, given as a
+ (width, height) tuple.
+ :param method: What resampling method to use. Default is
+ :py:attr:`PIL.Image.BICUBIC`. See :ref:`concept-filters`.
+ :param bleed: Remove a border around the outside of the image from all
+ four edges. The value is a decimal percentage (use 0.01 for
+ one percent). The default value is 0 (no border).
+ Cannot be greater than or equal to 0.5.
+ :param centering: Control the cropping position. Use (0.5, 0.5) for
+ center cropping (e.g. if cropping the width, take 50% off
+ of the left side, and therefore 50% off the right side).
+ (0.0, 0.0) will crop from the top left corner (i.e. if
+ cropping the width, take all of the crop off of the right
+ side, and if cropping the height, take all of it off the
+ bottom). (1.0, 0.0) will crop from the bottom left
+ corner, etc. (i.e. if cropping the width, take all of the
+ crop off the left side, and if cropping the height take
+ none from the top, and therefore all off the bottom).
+ :return: An image.
+ """
+
+ # by Kevin Cazabon, Feb 17/2000
+ # kevin@cazabon.com
+ # http://www.cazabon.com
+
+ # ensure centering is mutable
+ centering = list(centering)
+
+ if not 0.0 <= centering[0] <= 1.0:
+ centering[0] = 0.5
+ if not 0.0 <= centering[1] <= 1.0:
+ centering[1] = 0.5
+
+ if not 0.0 <= bleed < 0.5:
+ bleed = 0.0
+
+ # calculate the area to use for resizing and cropping, subtracting
+ # the 'bleed' around the edges
+
+ # number of pixels to trim off on Top and Bottom, Left and Right
+ bleed_pixels = (bleed * image.size[0], bleed * image.size[1])
+
+ live_size = (
+ image.size[0] - bleed_pixels[0] * 2,
+ image.size[1] - bleed_pixels[1] * 2,
+ )
+
+ # calculate the aspect ratio of the live_size
+ live_size_ratio = live_size[0] / live_size[1]
+
+ # calculate the aspect ratio of the output image
+ output_ratio = size[0] / size[1]
+
+ # figure out if the sides or top/bottom will be cropped off
+ if live_size_ratio == output_ratio:
+ # live_size is already the needed ratio
+ crop_width = live_size[0]
+ crop_height = live_size[1]
+ elif live_size_ratio >= output_ratio:
+ # live_size is wider than what's needed, crop the sides
+ crop_width = output_ratio * live_size[1]
+ crop_height = live_size[1]
+ else:
+ # live_size is taller than what's needed, crop the top and bottom
+ crop_width = live_size[0]
+ crop_height = live_size[0] / output_ratio
+
+ # make the crop
+ crop_left = bleed_pixels[0] + (live_size[0] - crop_width) * centering[0]
+ crop_top = bleed_pixels[1] + (live_size[1] - crop_height) * centering[1]
+
+ crop = (crop_left, crop_top, crop_left + crop_width, crop_top + crop_height)
+
+ # resize the image and return it
+ return image.resize(size, method, box=crop)
+
+
+def flip(image):
+ """
+ Flip the image vertically (top to bottom).
+
+ :param image: The image to flip.
+ :return: An image.
+ """
+ return image.transpose(Image.FLIP_TOP_BOTTOM)
+
+
+def grayscale(image):
+ """
+ Convert the image to grayscale.
+
+ :param image: The image to convert.
+ :return: An image.
+ """
+ return image.convert("L")
+
+
+def invert(image):
+ """
+ Invert (negate) the image.
+
+ :param image: The image to invert.
+ :return: An image.
+ """
+ lut = []
+ for i in range(256):
+ lut.append(255 - i)
+ return _lut(image, lut)
+
+
+def mirror(image):
+ """
+ Flip image horizontally (left to right).
+
+ :param image: The image to mirror.
+ :return: An image.
+ """
+ return image.transpose(Image.FLIP_LEFT_RIGHT)
+
+
+def posterize(image, bits):
+ """
+ Reduce the number of bits for each color channel.
+
+ :param image: The image to posterize.
+ :param bits: The number of bits to keep for each channel (1-8).
+ :return: An image.
+ """
+ lut = []
+ mask = ~(2 ** (8 - bits) - 1)
+ for i in range(256):
+ lut.append(i & mask)
+ return _lut(image, lut)
+
+
+def solarize(image, threshold=128):
+ """
+ Invert all pixel values above a threshold.
+
+ :param image: The image to solarize.
+ :param threshold: All pixels above this greyscale level are inverted.
+ :return: An image.
+ """
+ lut = []
+ for i in range(256):
+ if i < threshold:
+ lut.append(i)
+ else:
+ lut.append(255 - i)
+ return _lut(image, lut)
+
+
+def exif_transpose(image):
+ """
+ If an image has an EXIF Orientation tag, return a new image that is
+ transposed accordingly. Otherwise, return a copy of the image.
+
+ :param image: The image to transpose.
+ :return: An image.
+ """
+ exif = image.getexif()
+ orientation = exif.get(0x0112)
+ method = {
+ 2: Image.FLIP_LEFT_RIGHT,
+ 3: Image.ROTATE_180,
+ 4: Image.FLIP_TOP_BOTTOM,
+ 5: Image.TRANSPOSE,
+ 6: Image.ROTATE_270,
+ 7: Image.TRANSVERSE,
+ 8: Image.ROTATE_90,
+ }.get(orientation)
+ if method is not None:
+ transposed_image = image.transpose(method)
+ del exif[0x0112]
+ transposed_image.info["exif"] = exif.tobytes()
+ return transposed_image
+ return image.copy()
diff --git a/venv/Lib/site-packages/PIL/ImagePalette.py b/venv/Lib/site-packages/PIL/ImagePalette.py
new file mode 100644
index 0000000..d060411
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImagePalette.py
@@ -0,0 +1,221 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# image palette object
+#
+# History:
+# 1996-03-11 fl Rewritten.
+# 1997-01-03 fl Up and running.
+# 1997-08-23 fl Added load hack
+# 2001-04-16 fl Fixed randint shadow bug in random()
+#
+# Copyright (c) 1997-2001 by Secret Labs AB
+# Copyright (c) 1996-1997 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import array
+
+from . import GimpGradientFile, GimpPaletteFile, ImageColor, PaletteFile
+
+
+class ImagePalette:
+ """
+ Color palette for palette mapped images
+
+ :param mode: The mode to use for the Palette. See:
+ :ref:`concept-modes`. Defaults to "RGB"
+ :param palette: An optional palette. If given, it must be a bytearray,
+ an array or a list of ints between 0-255 and of length ``size``
+ times the number of colors in ``mode``. The list must be aligned
+ by channel (All R values must be contiguous in the list before G
+ and B values.) Defaults to 0 through 255 per channel.
+ :param size: An optional palette size. If given, it cannot be equal to
+ or greater than 256. Defaults to 0.
+ """
+
+ def __init__(self, mode="RGB", palette=None, size=0):
+ self.mode = mode
+ self.rawmode = None # if set, palette contains raw data
+ self.palette = palette or bytearray(range(256)) * len(self.mode)
+ self.colors = {}
+ self.dirty = None
+ if (size == 0 and len(self.mode) * 256 != len(self.palette)) or (
+ size != 0 and size != len(self.palette)
+ ):
+ raise ValueError("wrong palette size")
+
+ def copy(self):
+ new = ImagePalette()
+
+ new.mode = self.mode
+ new.rawmode = self.rawmode
+ if self.palette is not None:
+ new.palette = self.palette[:]
+ new.colors = self.colors.copy()
+ new.dirty = self.dirty
+
+ return new
+
+ def getdata(self):
+ """
+ Get palette contents in format suitable for the low-level
+ ``im.putpalette`` primitive.
+
+ .. warning:: This method is experimental.
+ """
+ if self.rawmode:
+ return self.rawmode, self.palette
+ return self.mode + ";L", self.tobytes()
+
+ def tobytes(self):
+ """Convert palette to bytes.
+
+ .. warning:: This method is experimental.
+ """
+ if self.rawmode:
+ raise ValueError("palette contains raw palette data")
+ if isinstance(self.palette, bytes):
+ return self.palette
+ arr = array.array("B", self.palette)
+ if hasattr(arr, "tobytes"):
+ return arr.tobytes()
+ return arr.tostring()
+
+ # Declare tostring as an alias for tobytes
+ tostring = tobytes
+
+ def getcolor(self, color):
+ """Given an rgb tuple, allocate palette entry.
+
+ .. warning:: This method is experimental.
+ """
+ if self.rawmode:
+ raise ValueError("palette contains raw palette data")
+ if isinstance(color, tuple):
+ try:
+ return self.colors[color]
+ except KeyError as e:
+ # allocate new color slot
+ if isinstance(self.palette, bytes):
+ self.palette = bytearray(self.palette)
+ index = len(self.colors)
+ if index >= 256:
+ raise ValueError("cannot allocate more than 256 colors") from e
+ self.colors[color] = index
+ self.palette[index] = color[0]
+ self.palette[index + 256] = color[1]
+ self.palette[index + 512] = color[2]
+ self.dirty = 1
+ return index
+ else:
+ raise ValueError(f"unknown color specifier: {repr(color)}")
+
+ def save(self, fp):
+ """Save palette to text file.
+
+ .. warning:: This method is experimental.
+ """
+ if self.rawmode:
+ raise ValueError("palette contains raw palette data")
+ if isinstance(fp, str):
+ fp = open(fp, "w")
+ fp.write("# Palette\n")
+ fp.write(f"# Mode: {self.mode}\n")
+ for i in range(256):
+ fp.write(f"{i}")
+ for j in range(i * len(self.mode), (i + 1) * len(self.mode)):
+ try:
+ fp.write(f" {self.palette[j]}")
+ except IndexError:
+ fp.write(" 0")
+ fp.write("\n")
+ fp.close()
+
+
+# --------------------------------------------------------------------
+# Internal
+
+
+def raw(rawmode, data):
+ palette = ImagePalette()
+ palette.rawmode = rawmode
+ palette.palette = data
+ palette.dirty = 1
+ return palette
+
+
+# --------------------------------------------------------------------
+# Factories
+
+
+def make_linear_lut(black, white):
+ lut = []
+ if black == 0:
+ for i in range(256):
+ lut.append(white * i // 255)
+ else:
+ raise NotImplementedError # FIXME
+ return lut
+
+
+def make_gamma_lut(exp):
+ lut = []
+ for i in range(256):
+ lut.append(int(((i / 255.0) ** exp) * 255.0 + 0.5))
+ return lut
+
+
+def negative(mode="RGB"):
+ palette = list(range(256))
+ palette.reverse()
+ return ImagePalette(mode, palette * len(mode))
+
+
+def random(mode="RGB"):
+ from random import randint
+
+ palette = []
+ for i in range(256 * len(mode)):
+ palette.append(randint(0, 255))
+ return ImagePalette(mode, palette)
+
+
+def sepia(white="#fff0c0"):
+ r, g, b = ImageColor.getrgb(white)
+ r = make_linear_lut(0, r)
+ g = make_linear_lut(0, g)
+ b = make_linear_lut(0, b)
+ return ImagePalette("RGB", r + g + b)
+
+
+def wedge(mode="RGB"):
+ return ImagePalette(mode, list(range(256)) * len(mode))
+
+
+def load(filename):
+
+ # FIXME: supports GIMP gradients only
+
+ with open(filename, "rb") as fp:
+
+ for paletteHandler in [
+ GimpPaletteFile.GimpPaletteFile,
+ GimpGradientFile.GimpGradientFile,
+ PaletteFile.PaletteFile,
+ ]:
+ try:
+ fp.seek(0)
+ lut = paletteHandler(fp).getpalette()
+ if lut:
+ break
+ except (SyntaxError, ValueError):
+ # import traceback
+ # traceback.print_exc()
+ pass
+ else:
+ raise OSError("cannot load palette")
+
+ return lut # data, rawmode
diff --git a/venv/Lib/site-packages/PIL/ImagePath.py b/venv/Lib/site-packages/PIL/ImagePath.py
new file mode 100644
index 0000000..3d3538c
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImagePath.py
@@ -0,0 +1,19 @@
+#
+# The Python Imaging Library
+# $Id$
+#
+# path interface
+#
+# History:
+# 1996-11-04 fl Created
+# 2002-04-14 fl Added documentation stub class
+#
+# Copyright (c) Secret Labs AB 1997.
+# Copyright (c) Fredrik Lundh 1996.
+#
+# See the README file for information on usage and redistribution.
+#
+
+from . import Image
+
+Path = Image.core.path
diff --git a/venv/Lib/site-packages/PIL/ImageQt.py b/venv/Lib/site-packages/PIL/ImageQt.py
new file mode 100644
index 0000000..32630f2
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageQt.py
@@ -0,0 +1,213 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# a simple Qt image interface.
+#
+# history:
+# 2006-06-03 fl: created
+# 2006-06-04 fl: inherit from QImage instead of wrapping it
+# 2006-06-05 fl: removed toimage helper; move string support to ImageQt
+# 2013-11-13 fl: add support for Qt5 (aurelien.ballier@cyclonit.com)
+#
+# Copyright (c) 2006 by Secret Labs AB
+# Copyright (c) 2006 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import sys
+from io import BytesIO
+
+from . import Image
+from ._util import isPath
+
+qt_versions = [
+ ["6", "PyQt6"],
+ ["side6", "PySide6"],
+ ["5", "PyQt5"],
+ ["side2", "PySide2"],
+]
+
+# If a version has already been imported, attempt it first
+qt_versions.sort(key=lambda qt_version: qt_version[1] in sys.modules, reverse=True)
+for qt_version, qt_module in qt_versions:
+ try:
+ if qt_module == "PyQt6":
+ from PyQt6.QtCore import QBuffer, QIODevice
+ from PyQt6.QtGui import QImage, QPixmap, qRgba
+ elif qt_module == "PySide6":
+ from PySide6.QtCore import QBuffer, QIODevice
+ from PySide6.QtGui import QImage, QPixmap, qRgba
+ elif qt_module == "PyQt5":
+ from PyQt5.QtCore import QBuffer, QIODevice
+ from PyQt5.QtGui import QImage, QPixmap, qRgba
+ elif qt_module == "PySide2":
+ from PySide2.QtCore import QBuffer, QIODevice
+ from PySide2.QtGui import QImage, QPixmap, qRgba
+ except (ImportError, RuntimeError):
+ continue
+ qt_is_installed = True
+ break
+else:
+ qt_is_installed = False
+ qt_version = None
+
+
+def rgb(r, g, b, a=255):
+ """(Internal) Turns an RGB color into a Qt compatible color integer."""
+ # use qRgb to pack the colors, and then turn the resulting long
+ # into a negative integer with the same bitpattern.
+ return qRgba(r, g, b, a) & 0xFFFFFFFF
+
+
+def fromqimage(im):
+ """
+ :param im: QImage or PIL ImageQt object
+ """
+ buffer = QBuffer()
+ qt_openmode = QIODevice.OpenMode if qt_version == "6" else QIODevice
+ buffer.open(qt_openmode.ReadWrite)
+ # preserve alpha channel with png
+ # otherwise ppm is more friendly with Image.open
+ if im.hasAlphaChannel():
+ im.save(buffer, "png")
+ else:
+ im.save(buffer, "ppm")
+
+ b = BytesIO()
+ b.write(buffer.data())
+ buffer.close()
+ b.seek(0)
+
+ return Image.open(b)
+
+
+def fromqpixmap(im):
+ return fromqimage(im)
+ # buffer = QBuffer()
+ # buffer.open(QIODevice.ReadWrite)
+ # # im.save(buffer)
+ # # What if png doesn't support some image features like animation?
+ # im.save(buffer, 'ppm')
+ # bytes_io = BytesIO()
+ # bytes_io.write(buffer.data())
+ # buffer.close()
+ # bytes_io.seek(0)
+ # return Image.open(bytes_io)
+
+
+def align8to32(bytes, width, mode):
+ """
+ converts each scanline of data from 8 bit to 32 bit aligned
+ """
+
+ bits_per_pixel = {"1": 1, "L": 8, "P": 8}[mode]
+
+ # calculate bytes per line and the extra padding if needed
+ bits_per_line = bits_per_pixel * width
+ full_bytes_per_line, remaining_bits_per_line = divmod(bits_per_line, 8)
+ bytes_per_line = full_bytes_per_line + (1 if remaining_bits_per_line else 0)
+
+ extra_padding = -bytes_per_line % 4
+
+ # already 32 bit aligned by luck
+ if not extra_padding:
+ return bytes
+
+ new_data = []
+ for i in range(len(bytes) // bytes_per_line):
+ new_data.append(
+ bytes[i * bytes_per_line : (i + 1) * bytes_per_line]
+ + b"\x00" * extra_padding
+ )
+
+ return b"".join(new_data)
+
+
+def _toqclass_helper(im):
+ data = None
+ colortable = None
+ exclusive_fp = False
+
+ # handle filename, if given instead of image name
+ if hasattr(im, "toUtf8"):
+ # FIXME - is this really the best way to do this?
+ im = str(im.toUtf8(), "utf-8")
+ if isPath(im):
+ im = Image.open(im)
+ exclusive_fp = True
+
+ qt_format = QImage.Format if qt_version == "6" else QImage
+ if im.mode == "1":
+ format = qt_format.Format_Mono
+ elif im.mode == "L":
+ format = qt_format.Format_Indexed8
+ colortable = []
+ for i in range(256):
+ colortable.append(rgb(i, i, i))
+ elif im.mode == "P":
+ format = qt_format.Format_Indexed8
+ colortable = []
+ palette = im.getpalette()
+ for i in range(0, len(palette), 3):
+ colortable.append(rgb(*palette[i : i + 3]))
+ elif im.mode == "RGB":
+ # Populate the 4th channel with 255
+ im = im.convert("RGBA")
+
+ data = im.tobytes("raw", "BGRA")
+ format = qt_format.Format_RGB32
+ elif im.mode == "RGBA":
+ data = im.tobytes("raw", "BGRA")
+ format = qt_format.Format_ARGB32
+ else:
+ if exclusive_fp:
+ im.close()
+ raise ValueError(f"unsupported image mode {repr(im.mode)}")
+
+ size = im.size
+ __data = data or align8to32(im.tobytes(), size[0], im.mode)
+ if exclusive_fp:
+ im.close()
+ return {"data": __data, "size": size, "format": format, "colortable": colortable}
+
+
+if qt_is_installed:
+
+ class ImageQt(QImage):
+ def __init__(self, im):
+ """
+ An PIL image wrapper for Qt. This is a subclass of PyQt's QImage
+ class.
+
+ :param im: A PIL Image object, or a file name (given either as
+ Python string or a PyQt string object).
+ """
+ im_data = _toqclass_helper(im)
+ # must keep a reference, or Qt will crash!
+ # All QImage constructors that take data operate on an existing
+ # buffer, so this buffer has to hang on for the life of the image.
+ # Fixes https://github.com/python-pillow/Pillow/issues/1370
+ self.__data = im_data["data"]
+ super().__init__(
+ self.__data,
+ im_data["size"][0],
+ im_data["size"][1],
+ im_data["format"],
+ )
+ if im_data["colortable"]:
+ self.setColorTable(im_data["colortable"])
+
+
+def toqimage(im):
+ return ImageQt(im)
+
+
+def toqpixmap(im):
+ # # This doesn't work. For now using a dumb approach.
+ # im_data = _toqclass_helper(im)
+ # result = QPixmap(im_data["size"][0], im_data["size"][1])
+ # result.loadFromData(im_data["data"])
+ qimage = toqimage(im)
+ return QPixmap.fromImage(qimage)
diff --git a/venv/Lib/site-packages/PIL/ImageSequence.py b/venv/Lib/site-packages/PIL/ImageSequence.py
new file mode 100644
index 0000000..9df910a
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageSequence.py
@@ -0,0 +1,75 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# sequence support classes
+#
+# history:
+# 1997-02-20 fl Created
+#
+# Copyright (c) 1997 by Secret Labs AB.
+# Copyright (c) 1997 by Fredrik Lundh.
+#
+# See the README file for information on usage and redistribution.
+#
+
+##
+
+
+class Iterator:
+ """
+ This class implements an iterator object that can be used to loop
+ over an image sequence.
+
+ You can use the ``[]`` operator to access elements by index. This operator
+ will raise an :py:exc:`IndexError` if you try to access a nonexistent
+ frame.
+
+ :param im: An image object.
+ """
+
+ def __init__(self, im):
+ if not hasattr(im, "seek"):
+ raise AttributeError("im must have seek method")
+ self.im = im
+ self.position = getattr(self.im, "_min_frame", 0)
+
+ def __getitem__(self, ix):
+ try:
+ self.im.seek(ix)
+ return self.im
+ except EOFError as e:
+ raise IndexError from e # end of sequence
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ try:
+ self.im.seek(self.position)
+ self.position += 1
+ return self.im
+ except EOFError as e:
+ raise StopIteration from e
+
+
+def all_frames(im, func=None):
+ """
+ Applies a given function to all frames in an image or a list of images.
+ The frames are returned as a list of separate images.
+
+ :param im: An image, or a list of images.
+ :param func: The function to apply to all of the image frames.
+ :returns: A list of images.
+ """
+ if not isinstance(im, list):
+ im = [im]
+
+ ims = []
+ for imSequence in im:
+ current = imSequence.tell()
+
+ ims += [im_frame.copy() for im_frame in Iterator(imSequence)]
+
+ imSequence.seek(current)
+ return [func(im) for im in ims] if func else ims
diff --git a/venv/Lib/site-packages/PIL/ImageShow.py b/venv/Lib/site-packages/PIL/ImageShow.py
new file mode 100644
index 0000000..6cc420d
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageShow.py
@@ -0,0 +1,263 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# im.show() drivers
+#
+# History:
+# 2008-04-06 fl Created
+#
+# Copyright (c) Secret Labs AB 2008.
+#
+# See the README file for information on usage and redistribution.
+#
+import os
+import shutil
+import subprocess
+import sys
+import tempfile
+from shlex import quote
+
+from PIL import Image
+
+_viewers = []
+
+
+def register(viewer, order=1):
+ """
+ The :py:func:`register` function is used to register additional viewers.
+
+ :param viewer: The viewer to be registered.
+ :param order:
+ Zero or a negative integer to prepend this viewer to the list,
+ a positive integer to append it.
+ """
+ try:
+ if issubclass(viewer, Viewer):
+ viewer = viewer()
+ except TypeError:
+ pass # raised if viewer wasn't a class
+ if order > 0:
+ _viewers.append(viewer)
+ else:
+ _viewers.insert(0, viewer)
+
+
+def show(image, title=None, **options):
+ r"""
+ Display a given image.
+
+ :param image: An image object.
+ :param title: Optional title. Not all viewers can display the title.
+ :param \**options: Additional viewer options.
+ :returns: ``True`` if a suitable viewer was found, ``False`` otherwise.
+ """
+ for viewer in _viewers:
+ if viewer.show(image, title=title, **options):
+ return 1
+ return 0
+
+
+class Viewer:
+ """Base class for viewers."""
+
+ # main api
+
+ def show(self, image, **options):
+ """
+ The main function for displaying an image.
+ Converts the given image to the target format and displays it.
+ """
+
+ if not (
+ image.mode in ("1", "RGBA")
+ or (self.format == "PNG" and image.mode in ("I;16", "LA"))
+ ):
+ base = Image.getmodebase(image.mode)
+ if image.mode != base:
+ image = image.convert(base)
+
+ return self.show_image(image, **options)
+
+ # hook methods
+
+ format = None
+ """The format to convert the image into."""
+ options = {}
+ """Additional options used to convert the image."""
+
+ def get_format(self, image):
+ """Return format name, or ``None`` to save as PGM/PPM."""
+ return self.format
+
+ def get_command(self, file, **options):
+ """
+ Returns the command used to display the file.
+ Not implemented in the base class.
+ """
+ raise NotImplementedError
+
+ def save_image(self, image):
+ """Save to temporary file and return filename."""
+ return image._dump(format=self.get_format(image), **self.options)
+
+ def show_image(self, image, **options):
+ """Display the given image."""
+ return self.show_file(self.save_image(image), **options)
+
+ def show_file(self, file, **options):
+ """Display the given file."""
+ os.system(self.get_command(file, **options))
+ return 1
+
+
+# --------------------------------------------------------------------
+
+
+class WindowsViewer(Viewer):
+ """The default viewer on Windows is the default system application for PNG files."""
+
+ format = "PNG"
+ options = {"compress_level": 1}
+
+ def get_command(self, file, **options):
+ return (
+ f'start "Pillow" /WAIT "{file}" '
+ "&& ping -n 2 127.0.0.1 >NUL "
+ f'&& del /f "{file}"'
+ )
+
+
+if sys.platform == "win32":
+ register(WindowsViewer)
+
+
+class MacViewer(Viewer):
+ """The default viewer on MacOS using ``Preview.app``."""
+
+ format = "PNG"
+ options = {"compress_level": 1}
+
+ def get_command(self, file, **options):
+ # on darwin open returns immediately resulting in the temp
+ # file removal while app is opening
+ command = "open -a Preview.app"
+ command = f"({command} {quote(file)}; sleep 20; rm -f {quote(file)})&"
+ return command
+
+ def show_file(self, file, **options):
+ """Display given file"""
+ fd, path = tempfile.mkstemp()
+ with os.fdopen(fd, "w") as f:
+ f.write(file)
+ with open(path) as f:
+ subprocess.Popen(
+ ["im=$(cat); open -a Preview.app $im; sleep 20; rm -f $im"],
+ shell=True,
+ stdin=f,
+ )
+ os.remove(path)
+ return 1
+
+
+if sys.platform == "darwin":
+ register(MacViewer)
+
+
+class UnixViewer(Viewer):
+ format = "PNG"
+ options = {"compress_level": 1}
+
+ def get_command(self, file, **options):
+ command = self.get_command_ex(file, **options)[0]
+ return f"({command} {quote(file)}; rm -f {quote(file)})&"
+
+ def show_file(self, file, **options):
+ """Display given file"""
+ fd, path = tempfile.mkstemp()
+ with os.fdopen(fd, "w") as f:
+ f.write(file)
+ with open(path) as f:
+ command = self.get_command_ex(file, **options)[0]
+ subprocess.Popen(
+ ["im=$(cat);" + command + " $im; rm -f $im"], shell=True, stdin=f
+ )
+ os.remove(path)
+ return 1
+
+
+class DisplayViewer(UnixViewer):
+ """The ImageMagick ``display`` command."""
+
+ def get_command_ex(self, file, **options):
+ command = executable = "display"
+ return command, executable
+
+
+class GmDisplayViewer(UnixViewer):
+ """The GraphicsMagick ``gm display`` command."""
+
+ def get_command_ex(self, file, **options):
+ executable = "gm"
+ command = "gm display"
+ return command, executable
+
+
+class EogViewer(UnixViewer):
+ """The GNOME Image Viewer ``eog`` command."""
+
+ def get_command_ex(self, file, **options):
+ command = executable = "eog"
+ return command, executable
+
+
+class XVViewer(UnixViewer):
+ """
+ The X Viewer ``xv`` command.
+ This viewer supports the ``title`` parameter.
+ """
+
+ def get_command_ex(self, file, title=None, **options):
+ # note: xv is pretty outdated. most modern systems have
+ # imagemagick's display command instead.
+ command = executable = "xv"
+ if title:
+ command += f" -name {quote(title)}"
+ return command, executable
+
+
+if sys.platform not in ("win32", "darwin"): # unixoids
+ if shutil.which("display"):
+ register(DisplayViewer)
+ if shutil.which("gm"):
+ register(GmDisplayViewer)
+ if shutil.which("eog"):
+ register(EogViewer)
+ if shutil.which("xv"):
+ register(XVViewer)
+
+
+class IPythonViewer(Viewer):
+ """The viewer for IPython frontends."""
+
+ def show_image(self, image, **options):
+ ipython_display(image)
+ return 1
+
+
+try:
+ from IPython.display import display as ipython_display
+except ImportError:
+ pass
+else:
+ register(IPythonViewer)
+
+
+if __name__ == "__main__":
+
+ if len(sys.argv) < 2:
+ print("Syntax: python ImageShow.py imagefile [title]")
+ sys.exit()
+
+ with Image.open(sys.argv[1]) as im:
+ print(show(im, *sys.argv[2:]))
diff --git a/venv/Lib/site-packages/PIL/ImageStat.py b/venv/Lib/site-packages/PIL/ImageStat.py
new file mode 100644
index 0000000..50bafc9
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageStat.py
@@ -0,0 +1,147 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# global image statistics
+#
+# History:
+# 1996-04-05 fl Created
+# 1997-05-21 fl Added mask; added rms, var, stddev attributes
+# 1997-08-05 fl Added median
+# 1998-07-05 hk Fixed integer overflow error
+#
+# Notes:
+# This class shows how to implement delayed evaluation of attributes.
+# To get a certain value, simply access the corresponding attribute.
+# The __getattr__ dispatcher takes care of the rest.
+#
+# Copyright (c) Secret Labs AB 1997.
+# Copyright (c) Fredrik Lundh 1996-97.
+#
+# See the README file for information on usage and redistribution.
+#
+
+import functools
+import math
+import operator
+
+
+class Stat:
+ def __init__(self, image_or_list, mask=None):
+ try:
+ if mask:
+ self.h = image_or_list.histogram(mask)
+ else:
+ self.h = image_or_list.histogram()
+ except AttributeError:
+ self.h = image_or_list # assume it to be a histogram list
+ if not isinstance(self.h, list):
+ raise TypeError("first argument must be image or list")
+ self.bands = list(range(len(self.h) // 256))
+
+ def __getattr__(self, id):
+ """Calculate missing attribute"""
+ if id[:4] == "_get":
+ raise AttributeError(id)
+ # calculate missing attribute
+ v = getattr(self, "_get" + id)()
+ setattr(self, id, v)
+ return v
+
+ def _getextrema(self):
+ """Get min/max values for each band in the image"""
+
+ def minmax(histogram):
+ n = 255
+ x = 0
+ for i in range(256):
+ if histogram[i]:
+ n = min(n, i)
+ x = max(x, i)
+ return n, x # returns (255, 0) if there's no data in the histogram
+
+ v = []
+ for i in range(0, len(self.h), 256):
+ v.append(minmax(self.h[i:]))
+ return v
+
+ def _getcount(self):
+ """Get total number of pixels in each layer"""
+
+ v = []
+ for i in range(0, len(self.h), 256):
+ v.append(functools.reduce(operator.add, self.h[i : i + 256]))
+ return v
+
+ def _getsum(self):
+ """Get sum of all pixels in each layer"""
+
+ v = []
+ for i in range(0, len(self.h), 256):
+ layerSum = 0.0
+ for j in range(256):
+ layerSum += j * self.h[i + j]
+ v.append(layerSum)
+ return v
+
+ def _getsum2(self):
+ """Get squared sum of all pixels in each layer"""
+
+ v = []
+ for i in range(0, len(self.h), 256):
+ sum2 = 0.0
+ for j in range(256):
+ sum2 += (j ** 2) * float(self.h[i + j])
+ v.append(sum2)
+ return v
+
+ def _getmean(self):
+ """Get average pixel level for each layer"""
+
+ v = []
+ for i in self.bands:
+ v.append(self.sum[i] / self.count[i])
+ return v
+
+ def _getmedian(self):
+ """Get median pixel level for each layer"""
+
+ v = []
+ for i in self.bands:
+ s = 0
+ half = self.count[i] // 2
+ b = i * 256
+ for j in range(256):
+ s = s + self.h[b + j]
+ if s > half:
+ break
+ v.append(j)
+ return v
+
+ def _getrms(self):
+ """Get RMS for each layer"""
+
+ v = []
+ for i in self.bands:
+ v.append(math.sqrt(self.sum2[i] / self.count[i]))
+ return v
+
+ def _getvar(self):
+ """Get variance for each layer"""
+
+ v = []
+ for i in self.bands:
+ n = self.count[i]
+ v.append((self.sum2[i] - (self.sum[i] ** 2.0) / n) / n)
+ return v
+
+ def _getstddev(self):
+ """Get standard deviation for each layer"""
+
+ v = []
+ for i in self.bands:
+ v.append(math.sqrt(self.var[i]))
+ return v
+
+
+Global = Stat # compatibility
diff --git a/venv/Lib/site-packages/PIL/ImageTk.py b/venv/Lib/site-packages/PIL/ImageTk.py
new file mode 100644
index 0000000..62db7a7
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageTk.py
@@ -0,0 +1,300 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# a Tk display interface
+#
+# History:
+# 96-04-08 fl Created
+# 96-09-06 fl Added getimage method
+# 96-11-01 fl Rewritten, removed image attribute and crop method
+# 97-05-09 fl Use PyImagingPaste method instead of image type
+# 97-05-12 fl Minor tweaks to match the IFUNC95 interface
+# 97-05-17 fl Support the "pilbitmap" booster patch
+# 97-06-05 fl Added file= and data= argument to image constructors
+# 98-03-09 fl Added width and height methods to Image classes
+# 98-07-02 fl Use default mode for "P" images without palette attribute
+# 98-07-02 fl Explicitly destroy Tkinter image objects
+# 99-07-24 fl Support multiple Tk interpreters (from Greg Couch)
+# 99-07-26 fl Automatically hook into Tkinter (if possible)
+# 99-08-15 fl Hook uses _imagingtk instead of _imaging
+#
+# Copyright (c) 1997-1999 by Secret Labs AB
+# Copyright (c) 1996-1997 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import tkinter
+from io import BytesIO
+
+from . import Image
+
+# --------------------------------------------------------------------
+# Check for Tkinter interface hooks
+
+_pilbitmap_ok = None
+
+
+def _pilbitmap_check():
+ global _pilbitmap_ok
+ if _pilbitmap_ok is None:
+ try:
+ im = Image.new("1", (1, 1))
+ tkinter.BitmapImage(data=f"PIL:{im.im.id}")
+ _pilbitmap_ok = 1
+ except tkinter.TclError:
+ _pilbitmap_ok = 0
+ return _pilbitmap_ok
+
+
+def _get_image_from_kw(kw):
+ source = None
+ if "file" in kw:
+ source = kw.pop("file")
+ elif "data" in kw:
+ source = BytesIO(kw.pop("data"))
+ if source:
+ return Image.open(source)
+
+
+# --------------------------------------------------------------------
+# PhotoImage
+
+
+class PhotoImage:
+ """
+ A Tkinter-compatible photo image. This can be used
+ everywhere Tkinter expects an image object. If the image is an RGBA
+ image, pixels having alpha 0 are treated as transparent.
+
+ The constructor takes either a PIL image, or a mode and a size.
+ Alternatively, you can use the ``file`` or ``data`` options to initialize
+ the photo image object.
+
+ :param image: Either a PIL image, or a mode string. If a mode string is
+ used, a size must also be given.
+ :param size: If the first argument is a mode string, this defines the size
+ of the image.
+ :keyword file: A filename to load the image from (using
+ ``Image.open(file)``).
+ :keyword data: An 8-bit string containing image data (as loaded from an
+ image file).
+ """
+
+ def __init__(self, image=None, size=None, **kw):
+
+ # Tk compatibility: file or data
+ if image is None:
+ image = _get_image_from_kw(kw)
+
+ if hasattr(image, "mode") and hasattr(image, "size"):
+ # got an image instead of a mode
+ mode = image.mode
+ if mode == "P":
+ # palette mapped data
+ image.load()
+ try:
+ mode = image.palette.mode
+ except AttributeError:
+ mode = "RGB" # default
+ size = image.size
+ kw["width"], kw["height"] = size
+ else:
+ mode = image
+ image = None
+
+ if mode not in ["1", "L", "RGB", "RGBA"]:
+ mode = Image.getmodebase(mode)
+
+ self.__mode = mode
+ self.__size = size
+ self.__photo = tkinter.PhotoImage(**kw)
+ self.tk = self.__photo.tk
+ if image:
+ self.paste(image)
+
+ def __del__(self):
+ name = self.__photo.name
+ self.__photo.name = None
+ try:
+ self.__photo.tk.call("image", "delete", name)
+ except Exception:
+ pass # ignore internal errors
+
+ def __str__(self):
+ """
+ Get the Tkinter photo image identifier. This method is automatically
+ called by Tkinter whenever a PhotoImage object is passed to a Tkinter
+ method.
+
+ :return: A Tkinter photo image identifier (a string).
+ """
+ return str(self.__photo)
+
+ def width(self):
+ """
+ Get the width of the image.
+
+ :return: The width, in pixels.
+ """
+ return self.__size[0]
+
+ def height(self):
+ """
+ Get the height of the image.
+
+ :return: The height, in pixels.
+ """
+ return self.__size[1]
+
+ def paste(self, im, box=None):
+ """
+ Paste a PIL image into the photo image. Note that this can
+ be very slow if the photo image is displayed.
+
+ :param im: A PIL image. The size must match the target region. If the
+ mode does not match, the image is converted to the mode of
+ the bitmap image.
+ :param box: A 4-tuple defining the left, upper, right, and lower pixel
+ coordinate. See :ref:`coordinate-system`. If None is given
+ instead of a tuple, all of the image is assumed.
+ """
+
+ # convert to blittable
+ im.load()
+ image = im.im
+ if image.isblock() and im.mode == self.__mode:
+ block = image
+ else:
+ block = image.new_block(self.__mode, im.size)
+ image.convert2(block, image) # convert directly between buffers
+
+ tk = self.__photo.tk
+
+ try:
+ tk.call("PyImagingPhoto", self.__photo, block.id)
+ except tkinter.TclError:
+ # activate Tkinter hook
+ try:
+ from . import _imagingtk
+
+ try:
+ if hasattr(tk, "interp"):
+ # Required for PyPy, which always has CFFI installed
+ from cffi import FFI
+
+ ffi = FFI()
+
+ # PyPy is using an FFI CDATA element
+ # (Pdb) self.tk.interp
+ #
+ _imagingtk.tkinit(int(ffi.cast("uintptr_t", tk.interp)), 1)
+ else:
+ _imagingtk.tkinit(tk.interpaddr(), 1)
+ except AttributeError:
+ _imagingtk.tkinit(id(tk), 0)
+ tk.call("PyImagingPhoto", self.__photo, block.id)
+ except (ImportError, AttributeError, tkinter.TclError):
+ raise # configuration problem; cannot attach to Tkinter
+
+
+# --------------------------------------------------------------------
+# BitmapImage
+
+
+class BitmapImage:
+ """
+ A Tkinter-compatible bitmap image. This can be used everywhere Tkinter
+ expects an image object.
+
+ The given image must have mode "1". Pixels having value 0 are treated as
+ transparent. Options, if any, are passed on to Tkinter. The most commonly
+ used option is ``foreground``, which is used to specify the color for the
+ non-transparent parts. See the Tkinter documentation for information on
+ how to specify colours.
+
+ :param image: A PIL image.
+ """
+
+ def __init__(self, image=None, **kw):
+
+ # Tk compatibility: file or data
+ if image is None:
+ image = _get_image_from_kw(kw)
+
+ self.__mode = image.mode
+ self.__size = image.size
+
+ if _pilbitmap_check():
+ # fast way (requires the pilbitmap booster patch)
+ image.load()
+ kw["data"] = f"PIL:{image.im.id}"
+ self.__im = image # must keep a reference
+ else:
+ # slow but safe way
+ kw["data"] = image.tobitmap()
+ self.__photo = tkinter.BitmapImage(**kw)
+
+ def __del__(self):
+ name = self.__photo.name
+ self.__photo.name = None
+ try:
+ self.__photo.tk.call("image", "delete", name)
+ except Exception:
+ pass # ignore internal errors
+
+ def width(self):
+ """
+ Get the width of the image.
+
+ :return: The width, in pixels.
+ """
+ return self.__size[0]
+
+ def height(self):
+ """
+ Get the height of the image.
+
+ :return: The height, in pixels.
+ """
+ return self.__size[1]
+
+ def __str__(self):
+ """
+ Get the Tkinter bitmap image identifier. This method is automatically
+ called by Tkinter whenever a BitmapImage object is passed to a Tkinter
+ method.
+
+ :return: A Tkinter bitmap image identifier (a string).
+ """
+ return str(self.__photo)
+
+
+def getimage(photo):
+ """Copies the contents of a PhotoImage to a PIL image memory."""
+ im = Image.new("RGBA", (photo.width(), photo.height()))
+ block = im.im
+
+ photo.tk.call("PyImagingPhotoGet", photo, block.id)
+
+ return im
+
+
+def _show(image, title):
+ """Helper for the Image.show method."""
+
+ class UI(tkinter.Label):
+ def __init__(self, master, im):
+ if im.mode == "1":
+ self.image = BitmapImage(im, foreground="white", master=master)
+ else:
+ self.image = PhotoImage(im, master=master)
+ super().__init__(master, image=self.image, bg="black", bd=0)
+
+ if not tkinter._default_root:
+ raise OSError("tkinter not initialized")
+ top = tkinter.Toplevel()
+ if title:
+ top.title(title)
+ UI(top, image).pack()
diff --git a/venv/Lib/site-packages/PIL/ImageTransform.py b/venv/Lib/site-packages/PIL/ImageTransform.py
new file mode 100644
index 0000000..77791ab
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageTransform.py
@@ -0,0 +1,102 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# transform wrappers
+#
+# History:
+# 2002-04-08 fl Created
+#
+# Copyright (c) 2002 by Secret Labs AB
+# Copyright (c) 2002 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+from . import Image
+
+
+class Transform(Image.ImageTransformHandler):
+ def __init__(self, data):
+ self.data = data
+
+ def getdata(self):
+ return self.method, self.data
+
+ def transform(self, size, image, **options):
+ # can be overridden
+ method, data = self.getdata()
+ return image.transform(size, method, data, **options)
+
+
+class AffineTransform(Transform):
+ """
+ Define an affine image transform.
+
+ This function takes a 6-tuple (a, b, c, d, e, f) which contain the first
+ two rows from an affine transform matrix. For each pixel (x, y) in the
+ output image, the new value is taken from a position (a x + b y + c,
+ d x + e y + f) in the input image, rounded to nearest pixel.
+
+ This function can be used to scale, translate, rotate, and shear the
+ original image.
+
+ See :py:meth:`~PIL.Image.Image.transform`
+
+ :param matrix: A 6-tuple (a, b, c, d, e, f) containing the first two rows
+ from an affine transform matrix.
+ """
+
+ method = Image.AFFINE
+
+
+class ExtentTransform(Transform):
+ """
+ Define a transform to extract a subregion from an image.
+
+ Maps a rectangle (defined by two corners) from the image to a rectangle of
+ the given size. The resulting image will contain data sampled from between
+ the corners, such that (x0, y0) in the input image will end up at (0,0) in
+ the output image, and (x1, y1) at size.
+
+ This method can be used to crop, stretch, shrink, or mirror an arbitrary
+ rectangle in the current image. It is slightly slower than crop, but about
+ as fast as a corresponding resize operation.
+
+ See :py:meth:`~PIL.Image.Image.transform`
+
+ :param bbox: A 4-tuple (x0, y0, x1, y1) which specifies two points in the
+ input image's coordinate system. See :ref:`coordinate-system`.
+ """
+
+ method = Image.EXTENT
+
+
+class QuadTransform(Transform):
+ """
+ Define a quad image transform.
+
+ Maps a quadrilateral (a region defined by four corners) from the image to a
+ rectangle of the given size.
+
+ See :py:meth:`~PIL.Image.Image.transform`
+
+ :param xy: An 8-tuple (x0, y0, x1, y1, x2, y2, x3, y3) which contain the
+ upper left, lower left, lower right, and upper right corner of the
+ source quadrilateral.
+ """
+
+ method = Image.QUAD
+
+
+class MeshTransform(Transform):
+ """
+ Define a mesh image transform. A mesh transform consists of one or more
+ individual quad transforms.
+
+ See :py:meth:`~PIL.Image.Image.transform`
+
+ :param data: A list of (bbox, quad) tuples.
+ """
+
+ method = Image.MESH
diff --git a/venv/Lib/site-packages/PIL/ImageWin.py b/venv/Lib/site-packages/PIL/ImageWin.py
new file mode 100644
index 0000000..ca9b14c
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImageWin.py
@@ -0,0 +1,230 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# a Windows DIB display interface
+#
+# History:
+# 1996-05-20 fl Created
+# 1996-09-20 fl Fixed subregion exposure
+# 1997-09-21 fl Added draw primitive (for tzPrint)
+# 2003-05-21 fl Added experimental Window/ImageWindow classes
+# 2003-09-05 fl Added fromstring/tostring methods
+#
+# Copyright (c) Secret Labs AB 1997-2003.
+# Copyright (c) Fredrik Lundh 1996-2003.
+#
+# See the README file for information on usage and redistribution.
+#
+
+from . import Image
+
+
+class HDC:
+ """
+ Wraps an HDC integer. The resulting object can be passed to the
+ :py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose`
+ methods.
+ """
+
+ def __init__(self, dc):
+ self.dc = dc
+
+ def __int__(self):
+ return self.dc
+
+
+class HWND:
+ """
+ Wraps an HWND integer. The resulting object can be passed to the
+ :py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose`
+ methods, instead of a DC.
+ """
+
+ def __init__(self, wnd):
+ self.wnd = wnd
+
+ def __int__(self):
+ return self.wnd
+
+
+class Dib:
+ """
+ A Windows bitmap with the given mode and size. The mode can be one of "1",
+ "L", "P", or "RGB".
+
+ If the display requires a palette, this constructor creates a suitable
+ palette and associates it with the image. For an "L" image, 128 greylevels
+ are allocated. For an "RGB" image, a 6x6x6 colour cube is used, together
+ with 20 greylevels.
+
+ To make sure that palettes work properly under Windows, you must call the
+ ``palette`` method upon certain events from Windows.
+
+ :param image: Either a PIL image, or a mode string. If a mode string is
+ used, a size must also be given. The mode can be one of "1",
+ "L", "P", or "RGB".
+ :param size: If the first argument is a mode string, this
+ defines the size of the image.
+ """
+
+ def __init__(self, image, size=None):
+ if hasattr(image, "mode") and hasattr(image, "size"):
+ mode = image.mode
+ size = image.size
+ else:
+ mode = image
+ image = None
+ if mode not in ["1", "L", "P", "RGB"]:
+ mode = Image.getmodebase(mode)
+ self.image = Image.core.display(mode, size)
+ self.mode = mode
+ self.size = size
+ if image:
+ self.paste(image)
+
+ def expose(self, handle):
+ """
+ Copy the bitmap contents to a device context.
+
+ :param handle: Device context (HDC), cast to a Python integer, or an
+ HDC or HWND instance. In PythonWin, you can use
+ ``CDC.GetHandleAttrib()`` to get a suitable handle.
+ """
+ if isinstance(handle, HWND):
+ dc = self.image.getdc(handle)
+ try:
+ result = self.image.expose(dc)
+ finally:
+ self.image.releasedc(handle, dc)
+ else:
+ result = self.image.expose(handle)
+ return result
+
+ def draw(self, handle, dst, src=None):
+ """
+ Same as expose, but allows you to specify where to draw the image, and
+ what part of it to draw.
+
+ The destination and source areas are given as 4-tuple rectangles. If
+ the source is omitted, the entire image is copied. If the source and
+ the destination have different sizes, the image is resized as
+ necessary.
+ """
+ if not src:
+ src = (0, 0) + self.size
+ if isinstance(handle, HWND):
+ dc = self.image.getdc(handle)
+ try:
+ result = self.image.draw(dc, dst, src)
+ finally:
+ self.image.releasedc(handle, dc)
+ else:
+ result = self.image.draw(handle, dst, src)
+ return result
+
+ def query_palette(self, handle):
+ """
+ Installs the palette associated with the image in the given device
+ context.
+
+ This method should be called upon **QUERYNEWPALETTE** and
+ **PALETTECHANGED** events from Windows. If this method returns a
+ non-zero value, one or more display palette entries were changed, and
+ the image should be redrawn.
+
+ :param handle: Device context (HDC), cast to a Python integer, or an
+ HDC or HWND instance.
+ :return: A true value if one or more entries were changed (this
+ indicates that the image should be redrawn).
+ """
+ if isinstance(handle, HWND):
+ handle = self.image.getdc(handle)
+ try:
+ result = self.image.query_palette(handle)
+ finally:
+ self.image.releasedc(handle, handle)
+ else:
+ result = self.image.query_palette(handle)
+ return result
+
+ def paste(self, im, box=None):
+ """
+ Paste a PIL image into the bitmap image.
+
+ :param im: A PIL image. The size must match the target region.
+ If the mode does not match, the image is converted to the
+ mode of the bitmap image.
+ :param box: A 4-tuple defining the left, upper, right, and
+ lower pixel coordinate. See :ref:`coordinate-system`. If
+ None is given instead of a tuple, all of the image is
+ assumed.
+ """
+ im.load()
+ if self.mode != im.mode:
+ im = im.convert(self.mode)
+ if box:
+ self.image.paste(im.im, box)
+ else:
+ self.image.paste(im.im)
+
+ def frombytes(self, buffer):
+ """
+ Load display memory contents from byte data.
+
+ :param buffer: A buffer containing display data (usually
+ data returned from :py:func:`~PIL.ImageWin.Dib.tobytes`)
+ """
+ return self.image.frombytes(buffer)
+
+ def tobytes(self):
+ """
+ Copy display memory contents to bytes object.
+
+ :return: A bytes object containing display data.
+ """
+ return self.image.tobytes()
+
+
+class Window:
+ """Create a Window with the given title size."""
+
+ def __init__(self, title="PIL", width=None, height=None):
+ self.hwnd = Image.core.createwindow(
+ title, self.__dispatcher, width or 0, height or 0
+ )
+
+ def __dispatcher(self, action, *args):
+ return getattr(self, "ui_handle_" + action)(*args)
+
+ def ui_handle_clear(self, dc, x0, y0, x1, y1):
+ pass
+
+ def ui_handle_damage(self, x0, y0, x1, y1):
+ pass
+
+ def ui_handle_destroy(self):
+ pass
+
+ def ui_handle_repair(self, dc, x0, y0, x1, y1):
+ pass
+
+ def ui_handle_resize(self, width, height):
+ pass
+
+ def mainloop(self):
+ Image.core.eventloop()
+
+
+class ImageWindow(Window):
+ """Create an image window which displays the given image."""
+
+ def __init__(self, image, title="PIL"):
+ if not isinstance(image, Dib):
+ image = Dib(image)
+ self.image = image
+ width, height = image.size
+ super().__init__(title, width=width, height=height)
+
+ def ui_handle_repair(self, dc, x0, y0, x1, y1):
+ self.image.draw(dc, (x0, y0, x1, y1))
diff --git a/venv/Lib/site-packages/PIL/ImtImagePlugin.py b/venv/Lib/site-packages/PIL/ImtImagePlugin.py
new file mode 100644
index 0000000..21ffd74
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/ImtImagePlugin.py
@@ -0,0 +1,93 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# IM Tools support for PIL
+#
+# history:
+# 1996-05-27 fl Created (read 8-bit images only)
+# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.2)
+#
+# Copyright (c) Secret Labs AB 1997-2001.
+# Copyright (c) Fredrik Lundh 1996-2001.
+#
+# See the README file for information on usage and redistribution.
+#
+
+
+import re
+
+from . import Image, ImageFile
+
+#
+# --------------------------------------------------------------------
+
+field = re.compile(br"([a-z]*) ([^ \r\n]*)")
+
+
+##
+# Image plugin for IM Tools images.
+
+
+class ImtImageFile(ImageFile.ImageFile):
+
+ format = "IMT"
+ format_description = "IM Tools"
+
+ def _open(self):
+
+ # Quick rejection: if there's not a LF among the first
+ # 100 bytes, this is (probably) not a text header.
+
+ if b"\n" not in self.fp.read(100):
+ raise SyntaxError("not an IM file")
+ self.fp.seek(0)
+
+ xsize = ysize = 0
+
+ while True:
+
+ s = self.fp.read(1)
+ if not s:
+ break
+
+ if s == b"\x0C":
+
+ # image data begins
+ self.tile = [
+ ("raw", (0, 0) + self.size, self.fp.tell(), (self.mode, 0, 1))
+ ]
+
+ break
+
+ else:
+
+ # read key/value pair
+ # FIXME: dangerous, may read whole file
+ s = s + self.fp.readline()
+ if len(s) == 1 or len(s) > 100:
+ break
+ if s[0] == ord(b"*"):
+ continue # comment
+
+ m = field.match(s)
+ if not m:
+ break
+ k, v = m.group(1, 2)
+ if k == "width":
+ xsize = int(v)
+ self._size = xsize, ysize
+ elif k == "height":
+ ysize = int(v)
+ self._size = xsize, ysize
+ elif k == "pixel" and v == "n8":
+ self.mode = "L"
+
+
+#
+# --------------------------------------------------------------------
+
+Image.register_open(ImtImageFile.format, ImtImageFile)
+
+#
+# no extension registered (".im" is simply too common)
diff --git a/venv/Lib/site-packages/PIL/IptcImagePlugin.py b/venv/Lib/site-packages/PIL/IptcImagePlugin.py
new file mode 100644
index 0000000..0bbe506
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/IptcImagePlugin.py
@@ -0,0 +1,230 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# IPTC/NAA file handling
+#
+# history:
+# 1995-10-01 fl Created
+# 1998-03-09 fl Cleaned up and added to PIL
+# 2002-06-18 fl Added getiptcinfo helper
+#
+# Copyright (c) Secret Labs AB 1997-2002.
+# Copyright (c) Fredrik Lundh 1995.
+#
+# See the README file for information on usage and redistribution.
+#
+import os
+import tempfile
+
+from . import Image, ImageFile
+from ._binary import i8
+from ._binary import i16be as i16
+from ._binary import i32be as i32
+from ._binary import o8
+
+COMPRESSION = {1: "raw", 5: "jpeg"}
+
+PAD = o8(0) * 4
+
+
+#
+# Helpers
+
+
+def i(c):
+ return i32((PAD + c)[-4:])
+
+
+def dump(c):
+ for i in c:
+ print("%02x" % i8(i), end=" ")
+ print()
+
+
+##
+# Image plugin for IPTC/NAA datastreams. To read IPTC/NAA fields
+# from TIFF and JPEG files, use the getiptcinfo function.
+
+
+class IptcImageFile(ImageFile.ImageFile):
+
+ format = "IPTC"
+ format_description = "IPTC/NAA"
+
+ def getint(self, key):
+ return i(self.info[key])
+
+ def field(self):
+ #
+ # get a IPTC field header
+ s = self.fp.read(5)
+ if not len(s):
+ return None, 0
+
+ tag = s[1], s[2]
+
+ # syntax
+ if s[0] != 0x1C or tag[0] < 1 or tag[0] > 9:
+ raise SyntaxError("invalid IPTC/NAA file")
+
+ # field size
+ size = s[3]
+ if size > 132:
+ raise OSError("illegal field length in IPTC/NAA file")
+ elif size == 128:
+ size = 0
+ elif size > 128:
+ size = i(self.fp.read(size - 128))
+ else:
+ size = i16(s, 3)
+
+ return tag, size
+
+ def _open(self):
+
+ # load descriptive fields
+ while True:
+ offset = self.fp.tell()
+ tag, size = self.field()
+ if not tag or tag == (8, 10):
+ break
+ if size:
+ tagdata = self.fp.read(size)
+ else:
+ tagdata = None
+ if tag in self.info:
+ if isinstance(self.info[tag], list):
+ self.info[tag].append(tagdata)
+ else:
+ self.info[tag] = [self.info[tag], tagdata]
+ else:
+ self.info[tag] = tagdata
+
+ # mode
+ layers = i8(self.info[(3, 60)][0])
+ component = i8(self.info[(3, 60)][1])
+ if (3, 65) in self.info:
+ id = i8(self.info[(3, 65)][0]) - 1
+ else:
+ id = 0
+ if layers == 1 and not component:
+ self.mode = "L"
+ elif layers == 3 and component:
+ self.mode = "RGB"[id]
+ elif layers == 4 and component:
+ self.mode = "CMYK"[id]
+
+ # size
+ self._size = self.getint((3, 20)), self.getint((3, 30))
+
+ # compression
+ try:
+ compression = COMPRESSION[self.getint((3, 120))]
+ except KeyError as e:
+ raise OSError("Unknown IPTC image compression") from e
+
+ # tile
+ if tag == (8, 10):
+ self.tile = [
+ ("iptc", (compression, offset), (0, 0, self.size[0], self.size[1]))
+ ]
+
+ def load(self):
+
+ if len(self.tile) != 1 or self.tile[0][0] != "iptc":
+ return ImageFile.ImageFile.load(self)
+
+ type, tile, box = self.tile[0]
+
+ encoding, offset = tile
+
+ self.fp.seek(offset)
+
+ # Copy image data to temporary file
+ o_fd, outfile = tempfile.mkstemp(text=False)
+ o = os.fdopen(o_fd)
+ if encoding == "raw":
+ # To simplify access to the extracted file,
+ # prepend a PPM header
+ o.write("P5\n%d %d\n255\n" % self.size)
+ while True:
+ type, size = self.field()
+ if type != (8, 10):
+ break
+ while size > 0:
+ s = self.fp.read(min(size, 8192))
+ if not s:
+ break
+ o.write(s)
+ size -= len(s)
+ o.close()
+
+ try:
+ with Image.open(outfile) as _im:
+ _im.load()
+ self.im = _im.im
+ finally:
+ try:
+ os.unlink(outfile)
+ except OSError:
+ pass
+
+
+Image.register_open(IptcImageFile.format, IptcImageFile)
+
+Image.register_extension(IptcImageFile.format, ".iim")
+
+
+def getiptcinfo(im):
+ """
+ Get IPTC information from TIFF, JPEG, or IPTC file.
+
+ :param im: An image containing IPTC data.
+ :returns: A dictionary containing IPTC information, or None if
+ no IPTC information block was found.
+ """
+ import io
+
+ from . import JpegImagePlugin, TiffImagePlugin
+
+ data = None
+
+ if isinstance(im, IptcImageFile):
+ # return info dictionary right away
+ return im.info
+
+ elif isinstance(im, JpegImagePlugin.JpegImageFile):
+ # extract the IPTC/NAA resource
+ photoshop = im.info.get("photoshop")
+ if photoshop:
+ data = photoshop.get(0x0404)
+
+ elif isinstance(im, TiffImagePlugin.TiffImageFile):
+ # get raw data from the IPTC/NAA tag (PhotoShop tags the data
+ # as 4-byte integers, so we cannot use the get method...)
+ try:
+ data = im.tag.tagdata[TiffImagePlugin.IPTC_NAA_CHUNK]
+ except (AttributeError, KeyError):
+ pass
+
+ if data is None:
+ return None # no properties
+
+ # create an IptcImagePlugin object without initializing it
+ class FakeImage:
+ pass
+
+ im = FakeImage()
+ im.__class__ = IptcImageFile
+
+ # parse the IPTC information chunk
+ im.info = {}
+ im.fp = io.BytesIO(data)
+
+ try:
+ im._open()
+ except (IndexError, KeyError):
+ pass # expected failure
+
+ return im.info
diff --git a/venv/Lib/site-packages/PIL/Jpeg2KImagePlugin.py b/venv/Lib/site-packages/PIL/Jpeg2KImagePlugin.py
new file mode 100644
index 0000000..0b0d433
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/Jpeg2KImagePlugin.py
@@ -0,0 +1,314 @@
+#
+# The Python Imaging Library
+# $Id$
+#
+# JPEG2000 file handling
+#
+# History:
+# 2014-03-12 ajh Created
+#
+# Copyright (c) 2014 Coriolis Systems Limited
+# Copyright (c) 2014 Alastair Houghton
+#
+# See the README file for information on usage and redistribution.
+#
+import io
+import os
+import struct
+
+from . import Image, ImageFile
+
+
+def _parse_codestream(fp):
+ """Parse the JPEG 2000 codestream to extract the size and component
+ count from the SIZ marker segment, returning a PIL (size, mode) tuple."""
+
+ hdr = fp.read(2)
+ lsiz = struct.unpack(">H", hdr)[0]
+ siz = hdr + fp.read(lsiz - 2)
+ lsiz, rsiz, xsiz, ysiz, xosiz, yosiz, _, _, _, _, csiz = struct.unpack_from(
+ ">HHIIIIIIIIH", siz
+ )
+ ssiz = [None] * csiz
+ xrsiz = [None] * csiz
+ yrsiz = [None] * csiz
+ for i in range(csiz):
+ ssiz[i], xrsiz[i], yrsiz[i] = struct.unpack_from(">BBB", siz, 36 + 3 * i)
+
+ size = (xsiz - xosiz, ysiz - yosiz)
+ if csiz == 1:
+ if (yrsiz[0] & 0x7F) > 8:
+ mode = "I;16"
+ else:
+ mode = "L"
+ elif csiz == 2:
+ mode = "LA"
+ elif csiz == 3:
+ mode = "RGB"
+ elif csiz == 4:
+ mode = "RGBA"
+ else:
+ mode = None
+
+ return (size, mode)
+
+
+def _parse_jp2_header(fp):
+ """Parse the JP2 header box to extract size, component count and
+ color space information, returning a (size, mode, mimetype) tuple."""
+
+ # Find the JP2 header box
+ header = None
+ mimetype = None
+ while True:
+ lbox, tbox = struct.unpack(">I4s", fp.read(8))
+ if lbox == 1:
+ lbox = struct.unpack(">Q", fp.read(8))[0]
+ hlen = 16
+ else:
+ hlen = 8
+
+ if lbox < hlen:
+ raise SyntaxError("Invalid JP2 header length")
+
+ if tbox == b"jp2h":
+ header = fp.read(lbox - hlen)
+ break
+ elif tbox == b"ftyp":
+ if fp.read(4) == b"jpx ":
+ mimetype = "image/jpx"
+ fp.seek(lbox - hlen - 4, os.SEEK_CUR)
+ else:
+ fp.seek(lbox - hlen, os.SEEK_CUR)
+
+ if header is None:
+ raise SyntaxError("could not find JP2 header")
+
+ size = None
+ mode = None
+ bpc = None
+ nc = None
+
+ hio = io.BytesIO(header)
+ while True:
+ lbox, tbox = struct.unpack(">I4s", hio.read(8))
+ if lbox == 1:
+ lbox = struct.unpack(">Q", hio.read(8))[0]
+ hlen = 16
+ else:
+ hlen = 8
+
+ content = hio.read(lbox - hlen)
+
+ if tbox == b"ihdr":
+ height, width, nc, bpc, c, unkc, ipr = struct.unpack(">IIHBBBB", content)
+ size = (width, height)
+ if unkc:
+ if nc == 1 and (bpc & 0x7F) > 8:
+ mode = "I;16"
+ elif nc == 1:
+ mode = "L"
+ elif nc == 2:
+ mode = "LA"
+ elif nc == 3:
+ mode = "RGB"
+ elif nc == 4:
+ mode = "RGBA"
+ break
+ elif tbox == b"colr":
+ meth, prec, approx = struct.unpack_from(">BBB", content)
+ if meth == 1:
+ cs = struct.unpack_from(">I", content, 3)[0]
+ if cs == 16: # sRGB
+ if nc == 1 and (bpc & 0x7F) > 8:
+ mode = "I;16"
+ elif nc == 1:
+ mode = "L"
+ elif nc == 3:
+ mode = "RGB"
+ elif nc == 4:
+ mode = "RGBA"
+ break
+ elif cs == 17: # grayscale
+ if nc == 1 and (bpc & 0x7F) > 8:
+ mode = "I;16"
+ elif nc == 1:
+ mode = "L"
+ elif nc == 2:
+ mode = "LA"
+ break
+ elif cs == 18: # sYCC
+ if nc == 3:
+ mode = "RGB"
+ elif nc == 4:
+ mode = "RGBA"
+ break
+
+ if size is None or mode is None:
+ raise SyntaxError("Malformed jp2 header")
+
+ return (size, mode, mimetype)
+
+
+##
+# Image plugin for JPEG2000 images.
+
+
+class Jpeg2KImageFile(ImageFile.ImageFile):
+ format = "JPEG2000"
+ format_description = "JPEG 2000 (ISO 15444)"
+
+ def _open(self):
+ sig = self.fp.read(4)
+ if sig == b"\xff\x4f\xff\x51":
+ self.codec = "j2k"
+ self._size, self.mode = _parse_codestream(self.fp)
+ else:
+ sig = sig + self.fp.read(8)
+
+ if sig == b"\x00\x00\x00\x0cjP \x0d\x0a\x87\x0a":
+ self.codec = "jp2"
+ header = _parse_jp2_header(self.fp)
+ self._size, self.mode, self.custom_mimetype = header
+ else:
+ raise SyntaxError("not a JPEG 2000 file")
+
+ if self.size is None or self.mode is None:
+ raise SyntaxError("unable to determine size/mode")
+
+ self._reduce = 0
+ self.layers = 0
+
+ fd = -1
+ length = -1
+
+ try:
+ fd = self.fp.fileno()
+ length = os.fstat(fd).st_size
+ except Exception:
+ fd = -1
+ try:
+ pos = self.fp.tell()
+ self.fp.seek(0, io.SEEK_END)
+ length = self.fp.tell()
+ self.fp.seek(pos)
+ except Exception:
+ length = -1
+
+ self.tile = [
+ (
+ "jpeg2k",
+ (0, 0) + self.size,
+ 0,
+ (self.codec, self._reduce, self.layers, fd, length),
+ )
+ ]
+
+ @property
+ def reduce(self):
+ # https://github.com/python-pillow/Pillow/issues/4343 found that the
+ # new Image 'reduce' method was shadowed by this plugin's 'reduce'
+ # property. This attempts to allow for both scenarios
+ return self._reduce or super().reduce
+
+ @reduce.setter
+ def reduce(self, value):
+ self._reduce = value
+
+ def load(self):
+ if self.tile and self._reduce:
+ power = 1 << self._reduce
+ adjust = power >> 1
+ self._size = (
+ int((self.size[0] + adjust) / power),
+ int((self.size[1] + adjust) / power),
+ )
+
+ # Update the reduce and layers settings
+ t = self.tile[0]
+ t3 = (t[3][0], self._reduce, self.layers, t[3][3], t[3][4])
+ self.tile = [(t[0], (0, 0) + self.size, t[2], t3)]
+
+ return ImageFile.ImageFile.load(self)
+
+
+def _accept(prefix):
+ return (
+ prefix[:4] == b"\xff\x4f\xff\x51"
+ or prefix[:12] == b"\x00\x00\x00\x0cjP \x0d\x0a\x87\x0a"
+ )
+
+
+# ------------------------------------------------------------
+# Save support
+
+
+def _save(im, fp, filename):
+ if filename.endswith(".j2k"):
+ kind = "j2k"
+ else:
+ kind = "jp2"
+
+ # Get the keyword arguments
+ info = im.encoderinfo
+
+ offset = info.get("offset", None)
+ tile_offset = info.get("tile_offset", None)
+ tile_size = info.get("tile_size", None)
+ quality_mode = info.get("quality_mode", "rates")
+ quality_layers = info.get("quality_layers", None)
+ if quality_layers is not None and not (
+ isinstance(quality_layers, (list, tuple))
+ and all(
+ [
+ isinstance(quality_layer, (int, float))
+ for quality_layer in quality_layers
+ ]
+ )
+ ):
+ raise ValueError("quality_layers must be a sequence of numbers")
+
+ num_resolutions = info.get("num_resolutions", 0)
+ cblk_size = info.get("codeblock_size", None)
+ precinct_size = info.get("precinct_size", None)
+ irreversible = info.get("irreversible", False)
+ progression = info.get("progression", "LRCP")
+ cinema_mode = info.get("cinema_mode", "no")
+ fd = -1
+
+ if hasattr(fp, "fileno"):
+ try:
+ fd = fp.fileno()
+ except Exception:
+ fd = -1
+
+ im.encoderconfig = (
+ offset,
+ tile_offset,
+ tile_size,
+ quality_mode,
+ quality_layers,
+ num_resolutions,
+ cblk_size,
+ precinct_size,
+ irreversible,
+ progression,
+ cinema_mode,
+ fd,
+ )
+
+ ImageFile._save(im, fp, [("jpeg2k", (0, 0) + im.size, 0, kind)])
+
+
+# ------------------------------------------------------------
+# Registry stuff
+
+
+Image.register_open(Jpeg2KImageFile.format, Jpeg2KImageFile, _accept)
+Image.register_save(Jpeg2KImageFile.format, _save)
+
+Image.register_extensions(
+ Jpeg2KImageFile.format, [".jp2", ".j2k", ".jpc", ".jpf", ".jpx", ".j2c"]
+)
+
+Image.register_mime(Jpeg2KImageFile.format, "image/jp2")
diff --git a/venv/Lib/site-packages/PIL/JpegImagePlugin.py b/venv/Lib/site-packages/PIL/JpegImagePlugin.py
new file mode 100644
index 0000000..48e0de5
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/JpegImagePlugin.py
@@ -0,0 +1,828 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# JPEG (JFIF) file handling
+#
+# See "Digital Compression and Coding of Continuous-Tone Still Images,
+# Part 1, Requirements and Guidelines" (CCITT T.81 / ISO 10918-1)
+#
+# History:
+# 1995-09-09 fl Created
+# 1995-09-13 fl Added full parser
+# 1996-03-25 fl Added hack to use the IJG command line utilities
+# 1996-05-05 fl Workaround Photoshop 2.5 CMYK polarity bug
+# 1996-05-28 fl Added draft support, JFIF version (0.1)
+# 1996-12-30 fl Added encoder options, added progression property (0.2)
+# 1997-08-27 fl Save mode 1 images as BW (0.3)
+# 1998-07-12 fl Added YCbCr to draft and save methods (0.4)
+# 1998-10-19 fl Don't hang on files using 16-bit DQT's (0.4.1)
+# 2001-04-16 fl Extract DPI settings from JFIF files (0.4.2)
+# 2002-07-01 fl Skip pad bytes before markers; identify Exif files (0.4.3)
+# 2003-04-25 fl Added experimental EXIF decoder (0.5)
+# 2003-06-06 fl Added experimental EXIF GPSinfo decoder
+# 2003-09-13 fl Extract COM markers
+# 2009-09-06 fl Added icc_profile support (from Florian Hoech)
+# 2009-03-06 fl Changed CMYK handling; always use Adobe polarity (0.6)
+# 2009-03-08 fl Added subsampling support (from Justin Huff).
+#
+# Copyright (c) 1997-2003 by Secret Labs AB.
+# Copyright (c) 1995-1996 by Fredrik Lundh.
+#
+# See the README file for information on usage and redistribution.
+#
+import array
+import io
+import os
+import struct
+import subprocess
+import sys
+import tempfile
+import warnings
+import xml.etree.ElementTree
+
+from . import Image, ImageFile, TiffImagePlugin
+from ._binary import i16be as i16
+from ._binary import i32be as i32
+from ._binary import o8
+from .JpegPresets import presets
+
+#
+# Parser
+
+
+def Skip(self, marker):
+ n = i16(self.fp.read(2)) - 2
+ ImageFile._safe_read(self.fp, n)
+
+
+def APP(self, marker):
+ #
+ # Application marker. Store these in the APP dictionary.
+ # Also look for well-known application markers.
+
+ n = i16(self.fp.read(2)) - 2
+ s = ImageFile._safe_read(self.fp, n)
+
+ app = "APP%d" % (marker & 15)
+
+ self.app[app] = s # compatibility
+ self.applist.append((app, s))
+
+ if marker == 0xFFE0 and s[:4] == b"JFIF":
+ # extract JFIF information
+ self.info["jfif"] = version = i16(s, 5) # version
+ self.info["jfif_version"] = divmod(version, 256)
+ # extract JFIF properties
+ try:
+ jfif_unit = s[7]
+ jfif_density = i16(s, 8), i16(s, 10)
+ except Exception:
+ pass
+ else:
+ if jfif_unit == 1:
+ self.info["dpi"] = jfif_density
+ self.info["jfif_unit"] = jfif_unit
+ self.info["jfif_density"] = jfif_density
+ elif marker == 0xFFE1 and s[:5] == b"Exif\0":
+ if "exif" not in self.info:
+ # extract EXIF information (incomplete)
+ self.info["exif"] = s # FIXME: value will change
+ elif marker == 0xFFE2 and s[:5] == b"FPXR\0":
+ # extract FlashPix information (incomplete)
+ self.info["flashpix"] = s # FIXME: value will change
+ elif marker == 0xFFE2 and s[:12] == b"ICC_PROFILE\0":
+ # Since an ICC profile can be larger than the maximum size of
+ # a JPEG marker (64K), we need provisions to split it into
+ # multiple markers. The format defined by the ICC specifies
+ # one or more APP2 markers containing the following data:
+ # Identifying string ASCII "ICC_PROFILE\0" (12 bytes)
+ # Marker sequence number 1, 2, etc (1 byte)
+ # Number of markers Total of APP2's used (1 byte)
+ # Profile data (remainder of APP2 data)
+ # Decoders should use the marker sequence numbers to
+ # reassemble the profile, rather than assuming that the APP2
+ # markers appear in the correct sequence.
+ self.icclist.append(s)
+ elif marker == 0xFFED and s[:14] == b"Photoshop 3.0\x00":
+ # parse the image resource block
+ offset = 14
+ photoshop = self.info.setdefault("photoshop", {})
+ while s[offset : offset + 4] == b"8BIM":
+ try:
+ offset += 4
+ # resource code
+ code = i16(s, offset)
+ offset += 2
+ # resource name (usually empty)
+ name_len = s[offset]
+ # name = s[offset+1:offset+1+name_len]
+ offset += 1 + name_len
+ offset += offset & 1 # align
+ # resource data block
+ size = i32(s, offset)
+ offset += 4
+ data = s[offset : offset + size]
+ if code == 0x03ED: # ResolutionInfo
+ data = {
+ "XResolution": i32(data, 0) / 65536,
+ "DisplayedUnitsX": i16(data, 4),
+ "YResolution": i32(data, 8) / 65536,
+ "DisplayedUnitsY": i16(data, 12),
+ }
+ photoshop[code] = data
+ offset += size
+ offset += offset & 1 # align
+ except struct.error:
+ break # insufficient data
+
+ elif marker == 0xFFEE and s[:5] == b"Adobe":
+ self.info["adobe"] = i16(s, 5)
+ # extract Adobe custom properties
+ try:
+ adobe_transform = s[1]
+ except Exception:
+ pass
+ else:
+ self.info["adobe_transform"] = adobe_transform
+ elif marker == 0xFFE2 and s[:4] == b"MPF\0":
+ # extract MPO information
+ self.info["mp"] = s[4:]
+ # offset is current location minus buffer size
+ # plus constant header size
+ self.info["mpoffset"] = self.fp.tell() - n + 4
+
+ # If DPI isn't in JPEG header, fetch from EXIF
+ if "dpi" not in self.info and "exif" in self.info:
+ try:
+ exif = self.getexif()
+ resolution_unit = exif[0x0128]
+ x_resolution = exif[0x011A]
+ try:
+ dpi = float(x_resolution[0]) / x_resolution[1]
+ except TypeError:
+ dpi = x_resolution
+ if resolution_unit == 3: # cm
+ # 1 dpcm = 2.54 dpi
+ dpi *= 2.54
+ self.info["dpi"] = int(dpi + 0.5), int(dpi + 0.5)
+ except (KeyError, SyntaxError, ValueError, ZeroDivisionError):
+ # SyntaxError for invalid/unreadable EXIF
+ # KeyError for dpi not included
+ # ZeroDivisionError for invalid dpi rational value
+ # ValueError for x_resolution[0] being an invalid float
+ self.info["dpi"] = 72, 72
+
+
+def COM(self, marker):
+ #
+ # Comment marker. Store these in the APP dictionary.
+ n = i16(self.fp.read(2)) - 2
+ s = ImageFile._safe_read(self.fp, n)
+
+ self.info["comment"] = s
+ self.app["COM"] = s # compatibility
+ self.applist.append(("COM", s))
+
+
+def SOF(self, marker):
+ #
+ # Start of frame marker. Defines the size and mode of the
+ # image. JPEG is colour blind, so we use some simple
+ # heuristics to map the number of layers to an appropriate
+ # mode. Note that this could be made a bit brighter, by
+ # looking for JFIF and Adobe APP markers.
+
+ n = i16(self.fp.read(2)) - 2
+ s = ImageFile._safe_read(self.fp, n)
+ self._size = i16(s, 3), i16(s, 1)
+
+ self.bits = s[0]
+ if self.bits != 8:
+ raise SyntaxError(f"cannot handle {self.bits}-bit layers")
+
+ self.layers = s[5]
+ if self.layers == 1:
+ self.mode = "L"
+ elif self.layers == 3:
+ self.mode = "RGB"
+ elif self.layers == 4:
+ self.mode = "CMYK"
+ else:
+ raise SyntaxError(f"cannot handle {self.layers}-layer images")
+
+ if marker in [0xFFC2, 0xFFC6, 0xFFCA, 0xFFCE]:
+ self.info["progressive"] = self.info["progression"] = 1
+
+ if self.icclist:
+ # fixup icc profile
+ self.icclist.sort() # sort by sequence number
+ if self.icclist[0][13] == len(self.icclist):
+ profile = []
+ for p in self.icclist:
+ profile.append(p[14:])
+ icc_profile = b"".join(profile)
+ else:
+ icc_profile = None # wrong number of fragments
+ self.info["icc_profile"] = icc_profile
+ self.icclist = []
+
+ for i in range(6, len(s), 3):
+ t = s[i : i + 3]
+ # 4-tuples: id, vsamp, hsamp, qtable
+ self.layer.append((t[0], t[1] // 16, t[1] & 15, t[2]))
+
+
+def DQT(self, marker):
+ #
+ # Define quantization table. Note that there might be more
+ # than one table in each marker.
+
+ # FIXME: The quantization tables can be used to estimate the
+ # compression quality.
+
+ n = i16(self.fp.read(2)) - 2
+ s = ImageFile._safe_read(self.fp, n)
+ while len(s):
+ v = s[0]
+ precision = 1 if (v // 16 == 0) else 2 # in bytes
+ qt_length = 1 + precision * 64
+ if len(s) < qt_length:
+ raise SyntaxError("bad quantization table marker")
+ data = array.array("B" if precision == 1 else "H", s[1:qt_length])
+ if sys.byteorder == "little" and precision > 1:
+ data.byteswap() # the values are always big-endian
+ self.quantization[v & 15] = data
+ s = s[qt_length:]
+
+
+#
+# JPEG marker table
+
+MARKER = {
+ 0xFFC0: ("SOF0", "Baseline DCT", SOF),
+ 0xFFC1: ("SOF1", "Extended Sequential DCT", SOF),
+ 0xFFC2: ("SOF2", "Progressive DCT", SOF),
+ 0xFFC3: ("SOF3", "Spatial lossless", SOF),
+ 0xFFC4: ("DHT", "Define Huffman table", Skip),
+ 0xFFC5: ("SOF5", "Differential sequential DCT", SOF),
+ 0xFFC6: ("SOF6", "Differential progressive DCT", SOF),
+ 0xFFC7: ("SOF7", "Differential spatial", SOF),
+ 0xFFC8: ("JPG", "Extension", None),
+ 0xFFC9: ("SOF9", "Extended sequential DCT (AC)", SOF),
+ 0xFFCA: ("SOF10", "Progressive DCT (AC)", SOF),
+ 0xFFCB: ("SOF11", "Spatial lossless DCT (AC)", SOF),
+ 0xFFCC: ("DAC", "Define arithmetic coding conditioning", Skip),
+ 0xFFCD: ("SOF13", "Differential sequential DCT (AC)", SOF),
+ 0xFFCE: ("SOF14", "Differential progressive DCT (AC)", SOF),
+ 0xFFCF: ("SOF15", "Differential spatial (AC)", SOF),
+ 0xFFD0: ("RST0", "Restart 0", None),
+ 0xFFD1: ("RST1", "Restart 1", None),
+ 0xFFD2: ("RST2", "Restart 2", None),
+ 0xFFD3: ("RST3", "Restart 3", None),
+ 0xFFD4: ("RST4", "Restart 4", None),
+ 0xFFD5: ("RST5", "Restart 5", None),
+ 0xFFD6: ("RST6", "Restart 6", None),
+ 0xFFD7: ("RST7", "Restart 7", None),
+ 0xFFD8: ("SOI", "Start of image", None),
+ 0xFFD9: ("EOI", "End of image", None),
+ 0xFFDA: ("SOS", "Start of scan", Skip),
+ 0xFFDB: ("DQT", "Define quantization table", DQT),
+ 0xFFDC: ("DNL", "Define number of lines", Skip),
+ 0xFFDD: ("DRI", "Define restart interval", Skip),
+ 0xFFDE: ("DHP", "Define hierarchical progression", SOF),
+ 0xFFDF: ("EXP", "Expand reference component", Skip),
+ 0xFFE0: ("APP0", "Application segment 0", APP),
+ 0xFFE1: ("APP1", "Application segment 1", APP),
+ 0xFFE2: ("APP2", "Application segment 2", APP),
+ 0xFFE3: ("APP3", "Application segment 3", APP),
+ 0xFFE4: ("APP4", "Application segment 4", APP),
+ 0xFFE5: ("APP5", "Application segment 5", APP),
+ 0xFFE6: ("APP6", "Application segment 6", APP),
+ 0xFFE7: ("APP7", "Application segment 7", APP),
+ 0xFFE8: ("APP8", "Application segment 8", APP),
+ 0xFFE9: ("APP9", "Application segment 9", APP),
+ 0xFFEA: ("APP10", "Application segment 10", APP),
+ 0xFFEB: ("APP11", "Application segment 11", APP),
+ 0xFFEC: ("APP12", "Application segment 12", APP),
+ 0xFFED: ("APP13", "Application segment 13", APP),
+ 0xFFEE: ("APP14", "Application segment 14", APP),
+ 0xFFEF: ("APP15", "Application segment 15", APP),
+ 0xFFF0: ("JPG0", "Extension 0", None),
+ 0xFFF1: ("JPG1", "Extension 1", None),
+ 0xFFF2: ("JPG2", "Extension 2", None),
+ 0xFFF3: ("JPG3", "Extension 3", None),
+ 0xFFF4: ("JPG4", "Extension 4", None),
+ 0xFFF5: ("JPG5", "Extension 5", None),
+ 0xFFF6: ("JPG6", "Extension 6", None),
+ 0xFFF7: ("JPG7", "Extension 7", None),
+ 0xFFF8: ("JPG8", "Extension 8", None),
+ 0xFFF9: ("JPG9", "Extension 9", None),
+ 0xFFFA: ("JPG10", "Extension 10", None),
+ 0xFFFB: ("JPG11", "Extension 11", None),
+ 0xFFFC: ("JPG12", "Extension 12", None),
+ 0xFFFD: ("JPG13", "Extension 13", None),
+ 0xFFFE: ("COM", "Comment", COM),
+}
+
+
+def _accept(prefix):
+ # Magic number was taken from https://en.wikipedia.org/wiki/JPEG
+ return prefix[0:3] == b"\xFF\xD8\xFF"
+
+
+##
+# Image plugin for JPEG and JFIF images.
+
+
+class JpegImageFile(ImageFile.ImageFile):
+
+ format = "JPEG"
+ format_description = "JPEG (ISO 10918)"
+
+ def _open(self):
+
+ s = self.fp.read(3)
+
+ if not _accept(s):
+ raise SyntaxError("not a JPEG file")
+ s = b"\xFF"
+
+ # Create attributes
+ self.bits = self.layers = 0
+
+ # JPEG specifics (internal)
+ self.layer = []
+ self.huffman_dc = {}
+ self.huffman_ac = {}
+ self.quantization = {}
+ self.app = {} # compatibility
+ self.applist = []
+ self.icclist = []
+ self._xmp = None
+
+ while True:
+
+ i = s[0]
+ if i == 0xFF:
+ s = s + self.fp.read(1)
+ i = i16(s)
+ else:
+ # Skip non-0xFF junk
+ s = self.fp.read(1)
+ continue
+
+ if i in MARKER:
+ name, description, handler = MARKER[i]
+ if handler is not None:
+ handler(self, i)
+ if i == 0xFFDA: # start of scan
+ rawmode = self.mode
+ if self.mode == "CMYK":
+ rawmode = "CMYK;I" # assume adobe conventions
+ self.tile = [("jpeg", (0, 0) + self.size, 0, (rawmode, ""))]
+ # self.__offset = self.fp.tell()
+ break
+ s = self.fp.read(1)
+ elif i == 0 or i == 0xFFFF:
+ # padded marker or junk; move on
+ s = b"\xff"
+ elif i == 0xFF00: # Skip extraneous data (escaped 0xFF)
+ s = self.fp.read(1)
+ else:
+ raise SyntaxError("no marker found")
+
+ def load_read(self, read_bytes):
+ """
+ internal: read more image data
+ For premature EOF and LOAD_TRUNCATED_IMAGES adds EOI marker
+ so libjpeg can finish decoding
+ """
+ s = self.fp.read(read_bytes)
+
+ if not s and ImageFile.LOAD_TRUNCATED_IMAGES:
+ # Premature EOF.
+ # Pretend file is finished adding EOI marker
+ return b"\xFF\xD9"
+
+ return s
+
+ def draft(self, mode, size):
+
+ if len(self.tile) != 1:
+ return
+
+ # Protect from second call
+ if self.decoderconfig:
+ return
+
+ d, e, o, a = self.tile[0]
+ scale = 1
+ original_size = self.size
+
+ if a[0] == "RGB" and mode in ["L", "YCbCr"]:
+ self.mode = mode
+ a = mode, ""
+
+ if size:
+ scale = min(self.size[0] // size[0], self.size[1] // size[1])
+ for s in [8, 4, 2, 1]:
+ if scale >= s:
+ break
+ e = (
+ e[0],
+ e[1],
+ (e[2] - e[0] + s - 1) // s + e[0],
+ (e[3] - e[1] + s - 1) // s + e[1],
+ )
+ self._size = ((self.size[0] + s - 1) // s, (self.size[1] + s - 1) // s)
+ scale = s
+
+ self.tile = [(d, e, o, a)]
+ self.decoderconfig = (scale, 0)
+
+ box = (0, 0, original_size[0] / scale, original_size[1] / scale)
+ return (self.mode, box)
+
+ def load_djpeg(self):
+
+ # ALTERNATIVE: handle JPEGs via the IJG command line utilities
+
+ f, path = tempfile.mkstemp()
+ os.close(f)
+ if os.path.exists(self.filename):
+ subprocess.check_call(["djpeg", "-outfile", path, self.filename])
+ else:
+ raise ValueError("Invalid Filename")
+
+ try:
+ with Image.open(path) as _im:
+ _im.load()
+ self.im = _im.im
+ finally:
+ try:
+ os.unlink(path)
+ except OSError:
+ pass
+
+ self.mode = self.im.mode
+ self._size = self.im.size
+
+ self.tile = []
+
+ def _getexif(self):
+ return _getexif(self)
+
+ def _getmp(self):
+ return _getmp(self)
+
+ def getxmp(self):
+ """
+ Returns a dictionary containing the XMP tags.
+ :returns: XMP tags in a dictionary.
+ """
+
+ if self._xmp is None:
+ self._xmp = {}
+
+ for segment, content in self.applist:
+ if segment == "APP1":
+ marker, xmp_tags = content.rsplit(b"\x00", 1)
+ if marker == b"http://ns.adobe.com/xap/1.0/":
+ root = xml.etree.ElementTree.fromstring(xmp_tags)
+ for element in root.findall(".//"):
+ self._xmp[element.tag.split("}")[1]] = {
+ child.split("}")[1]: value
+ for child, value in element.attrib.items()
+ }
+ return self._xmp
+
+
+def _getexif(self):
+ if "exif" not in self.info:
+ return None
+ return self.getexif()._get_merged_dict()
+
+
+def _getmp(self):
+ # Extract MP information. This method was inspired by the "highly
+ # experimental" _getexif version that's been in use for years now,
+ # itself based on the ImageFileDirectory class in the TIFF plugin.
+
+ # The MP record essentially consists of a TIFF file embedded in a JPEG
+ # application marker.
+ try:
+ data = self.info["mp"]
+ except KeyError:
+ return None
+ file_contents = io.BytesIO(data)
+ head = file_contents.read(8)
+ endianness = ">" if head[:4] == b"\x4d\x4d\x00\x2a" else "<"
+ # process dictionary
+ try:
+ info = TiffImagePlugin.ImageFileDirectory_v2(head)
+ file_contents.seek(info.next)
+ info.load(file_contents)
+ mp = dict(info)
+ except Exception as e:
+ raise SyntaxError("malformed MP Index (unreadable directory)") from e
+ # it's an error not to have a number of images
+ try:
+ quant = mp[0xB001]
+ except KeyError as e:
+ raise SyntaxError("malformed MP Index (no number of images)") from e
+ # get MP entries
+ mpentries = []
+ try:
+ rawmpentries = mp[0xB002]
+ for entrynum in range(0, quant):
+ unpackedentry = struct.unpack_from(
+ f"{endianness}LLLHH", rawmpentries, entrynum * 16
+ )
+ labels = ("Attribute", "Size", "DataOffset", "EntryNo1", "EntryNo2")
+ mpentry = dict(zip(labels, unpackedentry))
+ mpentryattr = {
+ "DependentParentImageFlag": bool(mpentry["Attribute"] & (1 << 31)),
+ "DependentChildImageFlag": bool(mpentry["Attribute"] & (1 << 30)),
+ "RepresentativeImageFlag": bool(mpentry["Attribute"] & (1 << 29)),
+ "Reserved": (mpentry["Attribute"] & (3 << 27)) >> 27,
+ "ImageDataFormat": (mpentry["Attribute"] & (7 << 24)) >> 24,
+ "MPType": mpentry["Attribute"] & 0x00FFFFFF,
+ }
+ if mpentryattr["ImageDataFormat"] == 0:
+ mpentryattr["ImageDataFormat"] = "JPEG"
+ else:
+ raise SyntaxError("unsupported picture format in MPO")
+ mptypemap = {
+ 0x000000: "Undefined",
+ 0x010001: "Large Thumbnail (VGA Equivalent)",
+ 0x010002: "Large Thumbnail (Full HD Equivalent)",
+ 0x020001: "Multi-Frame Image (Panorama)",
+ 0x020002: "Multi-Frame Image: (Disparity)",
+ 0x020003: "Multi-Frame Image: (Multi-Angle)",
+ 0x030000: "Baseline MP Primary Image",
+ }
+ mpentryattr["MPType"] = mptypemap.get(mpentryattr["MPType"], "Unknown")
+ mpentry["Attribute"] = mpentryattr
+ mpentries.append(mpentry)
+ mp[0xB002] = mpentries
+ except KeyError as e:
+ raise SyntaxError("malformed MP Index (bad MP Entry)") from e
+ # Next we should try and parse the individual image unique ID list;
+ # we don't because I've never seen this actually used in a real MPO
+ # file and so can't test it.
+ return mp
+
+
+# --------------------------------------------------------------------
+# stuff to save JPEG files
+
+RAWMODE = {
+ "1": "L",
+ "L": "L",
+ "RGB": "RGB",
+ "RGBX": "RGB",
+ "CMYK": "CMYK;I", # assume adobe conventions
+ "YCbCr": "YCbCr",
+}
+
+# fmt: off
+zigzag_index = (
+ 0, 1, 5, 6, 14, 15, 27, 28,
+ 2, 4, 7, 13, 16, 26, 29, 42,
+ 3, 8, 12, 17, 25, 30, 41, 43,
+ 9, 11, 18, 24, 31, 40, 44, 53,
+ 10, 19, 23, 32, 39, 45, 52, 54,
+ 20, 22, 33, 38, 46, 51, 55, 60,
+ 21, 34, 37, 47, 50, 56, 59, 61,
+ 35, 36, 48, 49, 57, 58, 62, 63,
+)
+
+samplings = {
+ (1, 1, 1, 1, 1, 1): 0,
+ (2, 1, 1, 1, 1, 1): 1,
+ (2, 2, 1, 1, 1, 1): 2,
+}
+# fmt: on
+
+
+def convert_dict_qtables(qtables):
+ qtables = [qtables[key] for key in range(len(qtables)) if key in qtables]
+ for idx, table in enumerate(qtables):
+ qtables[idx] = [table[i] for i in zigzag_index]
+ return qtables
+
+
+def get_sampling(im):
+ # There's no subsampling when images have only 1 layer
+ # (grayscale images) or when they are CMYK (4 layers),
+ # so set subsampling to the default value.
+ #
+ # NOTE: currently Pillow can't encode JPEG to YCCK format.
+ # If YCCK support is added in the future, subsampling code will have
+ # to be updated (here and in JpegEncode.c) to deal with 4 layers.
+ if not hasattr(im, "layers") or im.layers in (1, 4):
+ return -1
+ sampling = im.layer[0][1:3] + im.layer[1][1:3] + im.layer[2][1:3]
+ return samplings.get(sampling, -1)
+
+
+def _save(im, fp, filename):
+
+ try:
+ rawmode = RAWMODE[im.mode]
+ except KeyError as e:
+ raise OSError(f"cannot write mode {im.mode} as JPEG") from e
+
+ info = im.encoderinfo
+
+ dpi = [round(x) for x in info.get("dpi", (0, 0))]
+
+ quality = info.get("quality", -1)
+ subsampling = info.get("subsampling", -1)
+ qtables = info.get("qtables")
+
+ if quality == "keep":
+ quality = -1
+ subsampling = "keep"
+ qtables = "keep"
+ elif quality in presets:
+ preset = presets[quality]
+ quality = -1
+ subsampling = preset.get("subsampling", -1)
+ qtables = preset.get("quantization")
+ elif not isinstance(quality, int):
+ raise ValueError("Invalid quality setting")
+ else:
+ if subsampling in presets:
+ subsampling = presets[subsampling].get("subsampling", -1)
+ if isinstance(qtables, str) and qtables in presets:
+ qtables = presets[qtables].get("quantization")
+
+ if subsampling == "4:4:4":
+ subsampling = 0
+ elif subsampling == "4:2:2":
+ subsampling = 1
+ elif subsampling == "4:2:0":
+ subsampling = 2
+ elif subsampling == "4:1:1":
+ # For compatibility. Before Pillow 4.3, 4:1:1 actually meant 4:2:0.
+ # Set 4:2:0 if someone is still using that value.
+ subsampling = 2
+ elif subsampling == "keep":
+ if im.format != "JPEG":
+ raise ValueError("Cannot use 'keep' when original image is not a JPEG")
+ subsampling = get_sampling(im)
+
+ def validate_qtables(qtables):
+ if qtables is None:
+ return qtables
+ if isinstance(qtables, str):
+ try:
+ lines = [
+ int(num)
+ for line in qtables.splitlines()
+ for num in line.split("#", 1)[0].split()
+ ]
+ except ValueError as e:
+ raise ValueError("Invalid quantization table") from e
+ else:
+ qtables = [lines[s : s + 64] for s in range(0, len(lines), 64)]
+ if isinstance(qtables, (tuple, list, dict)):
+ if isinstance(qtables, dict):
+ qtables = convert_dict_qtables(qtables)
+ elif isinstance(qtables, tuple):
+ qtables = list(qtables)
+ if not (0 < len(qtables) < 5):
+ raise ValueError("None or too many quantization tables")
+ for idx, table in enumerate(qtables):
+ try:
+ if len(table) != 64:
+ raise TypeError
+ table = array.array("H", table)
+ except TypeError as e:
+ raise ValueError("Invalid quantization table") from e
+ else:
+ qtables[idx] = list(table)
+ return qtables
+
+ if qtables == "keep":
+ if im.format != "JPEG":
+ raise ValueError("Cannot use 'keep' when original image is not a JPEG")
+ qtables = getattr(im, "quantization", None)
+ qtables = validate_qtables(qtables)
+
+ extra = b""
+
+ icc_profile = info.get("icc_profile")
+ if icc_profile:
+ ICC_OVERHEAD_LEN = 14
+ MAX_BYTES_IN_MARKER = 65533
+ MAX_DATA_BYTES_IN_MARKER = MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN
+ markers = []
+ while icc_profile:
+ markers.append(icc_profile[:MAX_DATA_BYTES_IN_MARKER])
+ icc_profile = icc_profile[MAX_DATA_BYTES_IN_MARKER:]
+ i = 1
+ for marker in markers:
+ size = struct.pack(">H", 2 + ICC_OVERHEAD_LEN + len(marker))
+ extra += (
+ b"\xFF\xE2"
+ + size
+ + b"ICC_PROFILE\0"
+ + o8(i)
+ + o8(len(markers))
+ + marker
+ )
+ i += 1
+
+ # "progressive" is the official name, but older documentation
+ # says "progression"
+ # FIXME: issue a warning if the wrong form is used (post-1.1.7)
+ progressive = info.get("progressive", False) or info.get("progression", False)
+
+ optimize = info.get("optimize", False)
+
+ exif = info.get("exif", b"")
+ if isinstance(exif, Image.Exif):
+ exif = exif.tobytes()
+
+ # get keyword arguments
+ im.encoderconfig = (
+ quality,
+ progressive,
+ info.get("smooth", 0),
+ optimize,
+ info.get("streamtype", 0),
+ dpi[0],
+ dpi[1],
+ subsampling,
+ qtables,
+ extra,
+ exif,
+ )
+
+ # if we optimize, libjpeg needs a buffer big enough to hold the whole image
+ # in a shot. Guessing on the size, at im.size bytes. (raw pixel size is
+ # channels*size, this is a value that's been used in a django patch.
+ # https://github.com/matthewwithanm/django-imagekit/issues/50
+ bufsize = 0
+ if optimize or progressive:
+ # CMYK can be bigger
+ if im.mode == "CMYK":
+ bufsize = 4 * im.size[0] * im.size[1]
+ # keep sets quality to -1, but the actual value may be high.
+ elif quality >= 95 or quality == -1:
+ bufsize = 2 * im.size[0] * im.size[1]
+ else:
+ bufsize = im.size[0] * im.size[1]
+
+ # The EXIF info needs to be written as one block, + APP1, + one spare byte.
+ # Ensure that our buffer is big enough. Same with the icc_profile block.
+ bufsize = max(ImageFile.MAXBLOCK, bufsize, len(exif) + 5, len(extra) + 1)
+
+ ImageFile._save(im, fp, [("jpeg", (0, 0) + im.size, 0, rawmode)], bufsize)
+
+
+def _save_cjpeg(im, fp, filename):
+ # ALTERNATIVE: handle JPEGs via the IJG command line utilities.
+ tempfile = im._dump()
+ subprocess.check_call(["cjpeg", "-outfile", filename, tempfile])
+ try:
+ os.unlink(tempfile)
+ except OSError:
+ pass
+
+
+##
+# Factory for making JPEG and MPO instances
+def jpeg_factory(fp=None, filename=None):
+ im = JpegImageFile(fp, filename)
+ try:
+ mpheader = im._getmp()
+ if mpheader[45057] > 1:
+ # It's actually an MPO
+ from .MpoImagePlugin import MpoImageFile
+
+ # Don't reload everything, just convert it.
+ im = MpoImageFile.adopt(im, mpheader)
+ except (TypeError, IndexError):
+ # It is really a JPEG
+ pass
+ except SyntaxError:
+ warnings.warn(
+ "Image appears to be a malformed MPO file, it will be "
+ "interpreted as a base JPEG file"
+ )
+ return im
+
+
+# ---------------------------------------------------------------------
+# Registry stuff
+
+Image.register_open(JpegImageFile.format, jpeg_factory, _accept)
+Image.register_save(JpegImageFile.format, _save)
+
+Image.register_extensions(JpegImageFile.format, [".jfif", ".jpe", ".jpg", ".jpeg"])
+
+Image.register_mime(JpegImageFile.format, "image/jpeg")
diff --git a/venv/Lib/site-packages/PIL/JpegPresets.py b/venv/Lib/site-packages/PIL/JpegPresets.py
new file mode 100644
index 0000000..79d10eb
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/JpegPresets.py
@@ -0,0 +1,248 @@
+"""
+JPEG quality settings equivalent to the Photoshop settings.
+Can be used when saving JPEG files.
+
+The following presets are available by default:
+``web_low``, ``web_medium``, ``web_high``, ``web_very_high``, ``web_maximum``,
+``low``, ``medium``, ``high``, ``maximum``.
+More presets can be added to the :py:data:`presets` dict if needed.
+
+To apply the preset, specify::
+
+ quality="preset_name"
+
+To apply only the quantization table::
+
+ qtables="preset_name"
+
+To apply only the subsampling setting::
+
+ subsampling="preset_name"
+
+Example::
+
+ im.save("image_name.jpg", quality="web_high")
+
+Subsampling
+-----------
+
+Subsampling is the practice of encoding images by implementing less resolution
+for chroma information than for luma information.
+(ref.: https://en.wikipedia.org/wiki/Chroma_subsampling)
+
+Possible subsampling values are 0, 1 and 2 that correspond to 4:4:4, 4:2:2 and
+4:2:0.
+
+You can get the subsampling of a JPEG with the
+:func:`.JpegImagePlugin.get_sampling` function.
+
+In JPEG compressed data a JPEG marker is used instead of an EXIFÂ tag.
+(ref.: https://www.exiv2.org/tags.html)
+
+
+Quantization tables
+-------------------
+
+They are values use by the DCT (Discrete cosine transform) to remove
+*unnecessary* information from the image (the lossy part of the compression).
+(ref.: https://en.wikipedia.org/wiki/Quantization_matrix#Quantization_matrices,
+https://en.wikipedia.org/wiki/JPEG#Quantization)
+
+You can get the quantization tables of a JPEG with::
+
+ im.quantization
+
+This will return a dict with a number of arrays. You can pass this dict
+directly as the qtables argument when saving a JPEG.
+
+The tables format between im.quantization and quantization in presets differ in
+3 ways:
+
+1. The base container of the preset is a list with sublists instead of dict.
+ dict[0] -> list[0], dict[1] -> list[1], ...
+2. Each table in a preset is a list instead of an array.
+3. The zigzag order is remove in the preset (needed by libjpeg >= 6a).
+
+You can convert the dict format to the preset format with the
+:func:`.JpegImagePlugin.convert_dict_qtables()` function.
+
+Libjpeg ref.:
+https://web.archive.org/web/20120328125543/http://www.jpegcameras.com/libjpeg/libjpeg-3.html
+
+"""
+
+# fmt: off
+presets = {
+ 'web_low': {'subsampling': 2, # "4:2:0"
+ 'quantization': [
+ [20, 16, 25, 39, 50, 46, 62, 68,
+ 16, 18, 23, 38, 38, 53, 65, 68,
+ 25, 23, 31, 38, 53, 65, 68, 68,
+ 39, 38, 38, 53, 65, 68, 68, 68,
+ 50, 38, 53, 65, 68, 68, 68, 68,
+ 46, 53, 65, 68, 68, 68, 68, 68,
+ 62, 65, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68],
+ [21, 25, 32, 38, 54, 68, 68, 68,
+ 25, 28, 24, 38, 54, 68, 68, 68,
+ 32, 24, 32, 43, 66, 68, 68, 68,
+ 38, 38, 43, 53, 68, 68, 68, 68,
+ 54, 54, 66, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68]
+ ]},
+ 'web_medium': {'subsampling': 2, # "4:2:0"
+ 'quantization': [
+ [16, 11, 11, 16, 23, 27, 31, 30,
+ 11, 12, 12, 15, 20, 23, 23, 30,
+ 11, 12, 13, 16, 23, 26, 35, 47,
+ 16, 15, 16, 23, 26, 37, 47, 64,
+ 23, 20, 23, 26, 39, 51, 64, 64,
+ 27, 23, 26, 37, 51, 64, 64, 64,
+ 31, 23, 35, 47, 64, 64, 64, 64,
+ 30, 30, 47, 64, 64, 64, 64, 64],
+ [17, 15, 17, 21, 20, 26, 38, 48,
+ 15, 19, 18, 17, 20, 26, 35, 43,
+ 17, 18, 20, 22, 26, 30, 46, 53,
+ 21, 17, 22, 28, 30, 39, 53, 64,
+ 20, 20, 26, 30, 39, 48, 64, 64,
+ 26, 26, 30, 39, 48, 63, 64, 64,
+ 38, 35, 46, 53, 64, 64, 64, 64,
+ 48, 43, 53, 64, 64, 64, 64, 64]
+ ]},
+ 'web_high': {'subsampling': 0, # "4:4:4"
+ 'quantization': [
+ [6, 4, 4, 6, 9, 11, 12, 16,
+ 4, 5, 5, 6, 8, 10, 12, 12,
+ 4, 5, 5, 6, 10, 12, 14, 19,
+ 6, 6, 6, 11, 12, 15, 19, 28,
+ 9, 8, 10, 12, 16, 20, 27, 31,
+ 11, 10, 12, 15, 20, 27, 31, 31,
+ 12, 12, 14, 19, 27, 31, 31, 31,
+ 16, 12, 19, 28, 31, 31, 31, 31],
+ [7, 7, 13, 24, 26, 31, 31, 31,
+ 7, 12, 16, 21, 31, 31, 31, 31,
+ 13, 16, 17, 31, 31, 31, 31, 31,
+ 24, 21, 31, 31, 31, 31, 31, 31,
+ 26, 31, 31, 31, 31, 31, 31, 31,
+ 31, 31, 31, 31, 31, 31, 31, 31,
+ 31, 31, 31, 31, 31, 31, 31, 31,
+ 31, 31, 31, 31, 31, 31, 31, 31]
+ ]},
+ 'web_very_high': {'subsampling': 0, # "4:4:4"
+ 'quantization': [
+ [2, 2, 2, 2, 3, 4, 5, 6,
+ 2, 2, 2, 2, 3, 4, 5, 6,
+ 2, 2, 2, 2, 4, 5, 7, 9,
+ 2, 2, 2, 4, 5, 7, 9, 12,
+ 3, 3, 4, 5, 8, 10, 12, 12,
+ 4, 4, 5, 7, 10, 12, 12, 12,
+ 5, 5, 7, 9, 12, 12, 12, 12,
+ 6, 6, 9, 12, 12, 12, 12, 12],
+ [3, 3, 5, 9, 13, 15, 15, 15,
+ 3, 4, 6, 11, 14, 12, 12, 12,
+ 5, 6, 9, 14, 12, 12, 12, 12,
+ 9, 11, 14, 12, 12, 12, 12, 12,
+ 13, 14, 12, 12, 12, 12, 12, 12,
+ 15, 12, 12, 12, 12, 12, 12, 12,
+ 15, 12, 12, 12, 12, 12, 12, 12,
+ 15, 12, 12, 12, 12, 12, 12, 12]
+ ]},
+ 'web_maximum': {'subsampling': 0, # "4:4:4"
+ 'quantization': [
+ [1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 2,
+ 1, 1, 1, 1, 1, 1, 2, 2,
+ 1, 1, 1, 1, 1, 2, 2, 3,
+ 1, 1, 1, 1, 2, 2, 3, 3,
+ 1, 1, 1, 2, 2, 3, 3, 3,
+ 1, 1, 2, 2, 3, 3, 3, 3],
+ [1, 1, 1, 2, 2, 3, 3, 3,
+ 1, 1, 1, 2, 3, 3, 3, 3,
+ 1, 1, 1, 3, 3, 3, 3, 3,
+ 2, 2, 3, 3, 3, 3, 3, 3,
+ 2, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3]
+ ]},
+ 'low': {'subsampling': 2, # "4:2:0"
+ 'quantization': [
+ [18, 14, 14, 21, 30, 35, 34, 17,
+ 14, 16, 16, 19, 26, 23, 12, 12,
+ 14, 16, 17, 21, 23, 12, 12, 12,
+ 21, 19, 21, 23, 12, 12, 12, 12,
+ 30, 26, 23, 12, 12, 12, 12, 12,
+ 35, 23, 12, 12, 12, 12, 12, 12,
+ 34, 12, 12, 12, 12, 12, 12, 12,
+ 17, 12, 12, 12, 12, 12, 12, 12],
+ [20, 19, 22, 27, 20, 20, 17, 17,
+ 19, 25, 23, 14, 14, 12, 12, 12,
+ 22, 23, 14, 14, 12, 12, 12, 12,
+ 27, 14, 14, 12, 12, 12, 12, 12,
+ 20, 14, 12, 12, 12, 12, 12, 12,
+ 20, 12, 12, 12, 12, 12, 12, 12,
+ 17, 12, 12, 12, 12, 12, 12, 12,
+ 17, 12, 12, 12, 12, 12, 12, 12]
+ ]},
+ 'medium': {'subsampling': 2, # "4:2:0"
+ 'quantization': [
+ [12, 8, 8, 12, 17, 21, 24, 17,
+ 8, 9, 9, 11, 15, 19, 12, 12,
+ 8, 9, 10, 12, 19, 12, 12, 12,
+ 12, 11, 12, 21, 12, 12, 12, 12,
+ 17, 15, 19, 12, 12, 12, 12, 12,
+ 21, 19, 12, 12, 12, 12, 12, 12,
+ 24, 12, 12, 12, 12, 12, 12, 12,
+ 17, 12, 12, 12, 12, 12, 12, 12],
+ [13, 11, 13, 16, 20, 20, 17, 17,
+ 11, 14, 14, 14, 14, 12, 12, 12,
+ 13, 14, 14, 14, 12, 12, 12, 12,
+ 16, 14, 14, 12, 12, 12, 12, 12,
+ 20, 14, 12, 12, 12, 12, 12, 12,
+ 20, 12, 12, 12, 12, 12, 12, 12,
+ 17, 12, 12, 12, 12, 12, 12, 12,
+ 17, 12, 12, 12, 12, 12, 12, 12]
+ ]},
+ 'high': {'subsampling': 0, # "4:4:4"
+ 'quantization': [
+ [6, 4, 4, 6, 9, 11, 12, 16,
+ 4, 5, 5, 6, 8, 10, 12, 12,
+ 4, 5, 5, 6, 10, 12, 12, 12,
+ 6, 6, 6, 11, 12, 12, 12, 12,
+ 9, 8, 10, 12, 12, 12, 12, 12,
+ 11, 10, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 16, 12, 12, 12, 12, 12, 12, 12],
+ [7, 7, 13, 24, 20, 20, 17, 17,
+ 7, 12, 16, 14, 14, 12, 12, 12,
+ 13, 16, 14, 14, 12, 12, 12, 12,
+ 24, 14, 14, 12, 12, 12, 12, 12,
+ 20, 14, 12, 12, 12, 12, 12, 12,
+ 20, 12, 12, 12, 12, 12, 12, 12,
+ 17, 12, 12, 12, 12, 12, 12, 12,
+ 17, 12, 12, 12, 12, 12, 12, 12]
+ ]},
+ 'maximum': {'subsampling': 0, # "4:4:4"
+ 'quantization': [
+ [2, 2, 2, 2, 3, 4, 5, 6,
+ 2, 2, 2, 2, 3, 4, 5, 6,
+ 2, 2, 2, 2, 4, 5, 7, 9,
+ 2, 2, 2, 4, 5, 7, 9, 12,
+ 3, 3, 4, 5, 8, 10, 12, 12,
+ 4, 4, 5, 7, 10, 12, 12, 12,
+ 5, 5, 7, 9, 12, 12, 12, 12,
+ 6, 6, 9, 12, 12, 12, 12, 12],
+ [3, 3, 5, 9, 13, 15, 15, 15,
+ 3, 4, 6, 10, 14, 12, 12, 12,
+ 5, 6, 9, 14, 12, 12, 12, 12,
+ 9, 10, 14, 12, 12, 12, 12, 12,
+ 13, 14, 12, 12, 12, 12, 12, 12,
+ 15, 12, 12, 12, 12, 12, 12, 12,
+ 15, 12, 12, 12, 12, 12, 12, 12,
+ 15, 12, 12, 12, 12, 12, 12, 12]
+ ]},
+}
+# fmt: on
diff --git a/venv/Lib/site-packages/PIL/McIdasImagePlugin.py b/venv/Lib/site-packages/PIL/McIdasImagePlugin.py
new file mode 100644
index 0000000..cd047fe
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/McIdasImagePlugin.py
@@ -0,0 +1,75 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# Basic McIdas support for PIL
+#
+# History:
+# 1997-05-05 fl Created (8-bit images only)
+# 2009-03-08 fl Added 16/32-bit support.
+#
+# Thanks to Richard Jones and Craig Swank for specs and samples.
+#
+# Copyright (c) Secret Labs AB 1997.
+# Copyright (c) Fredrik Lundh 1997.
+#
+# See the README file for information on usage and redistribution.
+#
+
+import struct
+
+from . import Image, ImageFile
+
+
+def _accept(s):
+ return s[:8] == b"\x00\x00\x00\x00\x00\x00\x00\x04"
+
+
+##
+# Image plugin for McIdas area images.
+
+
+class McIdasImageFile(ImageFile.ImageFile):
+
+ format = "MCIDAS"
+ format_description = "McIdas area file"
+
+ def _open(self):
+
+ # parse area file directory
+ s = self.fp.read(256)
+ if not _accept(s) or len(s) != 256:
+ raise SyntaxError("not an McIdas area file")
+
+ self.area_descriptor_raw = s
+ self.area_descriptor = w = [0] + list(struct.unpack("!64i", s))
+
+ # get mode
+ if w[11] == 1:
+ mode = rawmode = "L"
+ elif w[11] == 2:
+ # FIXME: add memory map support
+ mode = "I"
+ rawmode = "I;16B"
+ elif w[11] == 4:
+ # FIXME: add memory map support
+ mode = "I"
+ rawmode = "I;32B"
+ else:
+ raise SyntaxError("unsupported McIdas format")
+
+ self.mode = mode
+ self._size = w[10], w[9]
+
+ offset = w[34] + w[15]
+ stride = w[15] + w[10] * w[11] * w[14]
+
+ self.tile = [("raw", (0, 0) + self.size, offset, (rawmode, stride, 1))]
+
+
+# --------------------------------------------------------------------
+# registry
+
+Image.register_open(McIdasImageFile.format, McIdasImageFile, _accept)
+
+# no default extension
diff --git a/venv/Lib/site-packages/PIL/MicImagePlugin.py b/venv/Lib/site-packages/PIL/MicImagePlugin.py
new file mode 100644
index 0000000..9248b1b
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/MicImagePlugin.py
@@ -0,0 +1,107 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# Microsoft Image Composer support for PIL
+#
+# Notes:
+# uses TiffImagePlugin.py to read the actual image streams
+#
+# History:
+# 97-01-20 fl Created
+#
+# Copyright (c) Secret Labs AB 1997.
+# Copyright (c) Fredrik Lundh 1997.
+#
+# See the README file for information on usage and redistribution.
+#
+
+
+import olefile
+
+from . import Image, TiffImagePlugin
+
+#
+# --------------------------------------------------------------------
+
+
+def _accept(prefix):
+ return prefix[:8] == olefile.MAGIC
+
+
+##
+# Image plugin for Microsoft's Image Composer file format.
+
+
+class MicImageFile(TiffImagePlugin.TiffImageFile):
+
+ format = "MIC"
+ format_description = "Microsoft Image Composer"
+ _close_exclusive_fp_after_loading = False
+
+ def _open(self):
+
+ # read the OLE directory and see if this is a likely
+ # to be a Microsoft Image Composer file
+
+ try:
+ self.ole = olefile.OleFileIO(self.fp)
+ except OSError as e:
+ raise SyntaxError("not an MIC file; invalid OLE file") from e
+
+ # find ACI subfiles with Image members (maybe not the
+ # best way to identify MIC files, but what the... ;-)
+
+ self.images = []
+ for path in self.ole.listdir():
+ if path[1:] and path[0][-4:] == ".ACI" and path[1] == "Image":
+ self.images.append(path)
+
+ # if we didn't find any images, this is probably not
+ # an MIC file.
+ if not self.images:
+ raise SyntaxError("not an MIC file; no image entries")
+
+ self.__fp = self.fp
+ self.frame = None
+ self._n_frames = len(self.images)
+ self.is_animated = self._n_frames > 1
+
+ if len(self.images) > 1:
+ self._category = Image.CONTAINER
+
+ self.seek(0)
+
+ def seek(self, frame):
+ if not self._seek_check(frame):
+ return
+ try:
+ filename = self.images[frame]
+ except IndexError as e:
+ raise EOFError("no such frame") from e
+
+ self.fp = self.ole.openstream(filename)
+
+ TiffImagePlugin.TiffImageFile._open(self)
+
+ self.frame = frame
+
+ def tell(self):
+ return self.frame
+
+ def _close__fp(self):
+ try:
+ if self.__fp != self.fp:
+ self.__fp.close()
+ except AttributeError:
+ pass
+ finally:
+ self.__fp = None
+
+
+#
+# --------------------------------------------------------------------
+
+Image.register_open(MicImageFile.format, MicImageFile, _accept)
+
+Image.register_extension(MicImageFile.format, ".mic")
diff --git a/venv/Lib/site-packages/PIL/MpegImagePlugin.py b/venv/Lib/site-packages/PIL/MpegImagePlugin.py
new file mode 100644
index 0000000..a358dfd
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/MpegImagePlugin.py
@@ -0,0 +1,83 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# MPEG file handling
+#
+# History:
+# 95-09-09 fl Created
+#
+# Copyright (c) Secret Labs AB 1997.
+# Copyright (c) Fredrik Lundh 1995.
+#
+# See the README file for information on usage and redistribution.
+#
+
+
+from . import Image, ImageFile
+from ._binary import i8
+
+#
+# Bitstream parser
+
+
+class BitStream:
+ def __init__(self, fp):
+ self.fp = fp
+ self.bits = 0
+ self.bitbuffer = 0
+
+ def next(self):
+ return i8(self.fp.read(1))
+
+ def peek(self, bits):
+ while self.bits < bits:
+ c = self.next()
+ if c < 0:
+ self.bits = 0
+ continue
+ self.bitbuffer = (self.bitbuffer << 8) + c
+ self.bits += 8
+ return self.bitbuffer >> (self.bits - bits) & (1 << bits) - 1
+
+ def skip(self, bits):
+ while self.bits < bits:
+ self.bitbuffer = (self.bitbuffer << 8) + i8(self.fp.read(1))
+ self.bits += 8
+ self.bits = self.bits - bits
+
+ def read(self, bits):
+ v = self.peek(bits)
+ self.bits = self.bits - bits
+ return v
+
+
+##
+# Image plugin for MPEG streams. This plugin can identify a stream,
+# but it cannot read it.
+
+
+class MpegImageFile(ImageFile.ImageFile):
+
+ format = "MPEG"
+ format_description = "MPEG"
+
+ def _open(self):
+
+ s = BitStream(self.fp)
+
+ if s.read(32) != 0x1B3:
+ raise SyntaxError("not an MPEG file")
+
+ self.mode = "RGB"
+ self._size = s.read(12), s.read(12)
+
+
+# --------------------------------------------------------------------
+# Registry stuff
+
+Image.register_open(MpegImageFile.format, MpegImageFile)
+
+Image.register_extensions(MpegImageFile.format, [".mpg", ".mpeg"])
+
+Image.register_mime(MpegImageFile.format, "video/mpeg")
diff --git a/venv/Lib/site-packages/PIL/MpoImagePlugin.py b/venv/Lib/site-packages/PIL/MpoImagePlugin.py
new file mode 100644
index 0000000..7244aa2
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/MpoImagePlugin.py
@@ -0,0 +1,136 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# MPO file handling
+#
+# See "Multi-Picture Format" (CIPA DC-007-Translation 2009, Standard of the
+# Camera & Imaging Products Association)
+#
+# The multi-picture object combines multiple JPEG images (with a modified EXIF
+# data format) into a single file. While it can theoretically be used much like
+# a GIF animation, it is commonly used to represent 3D photographs and is (as
+# of this writing) the most commonly used format by 3D cameras.
+#
+# History:
+# 2014-03-13 Feneric Created
+#
+# See the README file for information on usage and redistribution.
+#
+
+from . import Image, ImageFile, JpegImagePlugin
+from ._binary import i16be as i16
+
+
+def _accept(prefix):
+ return JpegImagePlugin._accept(prefix)
+
+
+def _save(im, fp, filename):
+ # Note that we can only save the current frame at present
+ return JpegImagePlugin._save(im, fp, filename)
+
+
+##
+# Image plugin for MPO images.
+
+
+class MpoImageFile(JpegImagePlugin.JpegImageFile):
+
+ format = "MPO"
+ format_description = "MPO (CIPA DC-007)"
+ _close_exclusive_fp_after_loading = False
+
+ def _open(self):
+ self.fp.seek(0) # prep the fp in order to pass the JPEG test
+ JpegImagePlugin.JpegImageFile._open(self)
+ self._after_jpeg_open()
+
+ def _after_jpeg_open(self, mpheader=None):
+ self.mpinfo = mpheader if mpheader is not None else self._getmp()
+ self.n_frames = self.mpinfo[0xB001]
+ self.__mpoffsets = [
+ mpent["DataOffset"] + self.info["mpoffset"] for mpent in self.mpinfo[0xB002]
+ ]
+ self.__mpoffsets[0] = 0
+ # Note that the following assertion will only be invalid if something
+ # gets broken within JpegImagePlugin.
+ assert self.n_frames == len(self.__mpoffsets)
+ del self.info["mpoffset"] # no longer needed
+ self.is_animated = self.n_frames > 1
+ self.__fp = self.fp # FIXME: hack
+ self.__fp.seek(self.__mpoffsets[0]) # get ready to read first frame
+ self.__frame = 0
+ self.offset = 0
+ # for now we can only handle reading and individual frame extraction
+ self.readonly = 1
+
+ def load_seek(self, pos):
+ self.__fp.seek(pos)
+
+ def seek(self, frame):
+ if not self._seek_check(frame):
+ return
+ self.fp = self.__fp
+ self.offset = self.__mpoffsets[frame]
+
+ self.fp.seek(self.offset + 2) # skip SOI marker
+ segment = self.fp.read(2)
+ if not segment:
+ raise ValueError("No data found for frame")
+ if i16(segment) == 0xFFE1: # APP1
+ n = i16(self.fp.read(2)) - 2
+ self.info["exif"] = ImageFile._safe_read(self.fp, n)
+
+ mptype = self.mpinfo[0xB002][frame]["Attribute"]["MPType"]
+ if mptype.startswith("Large Thumbnail"):
+ exif = self.getexif().get_ifd(0x8769)
+ if 40962 in exif and 40963 in exif:
+ self._size = (exif[40962], exif[40963])
+ elif "exif" in self.info:
+ del self.info["exif"]
+
+ self.tile = [("jpeg", (0, 0) + self.size, self.offset, (self.mode, ""))]
+ self.__frame = frame
+
+ def tell(self):
+ return self.__frame
+
+ def _close__fp(self):
+ try:
+ if self.__fp != self.fp:
+ self.__fp.close()
+ except AttributeError:
+ pass
+ finally:
+ self.__fp = None
+
+ @staticmethod
+ def adopt(jpeg_instance, mpheader=None):
+ """
+ Transform the instance of JpegImageFile into
+ an instance of MpoImageFile.
+ After the call, the JpegImageFile is extended
+ to be an MpoImageFile.
+
+ This is essentially useful when opening a JPEG
+ file that reveals itself as an MPO, to avoid
+ double call to _open.
+ """
+ jpeg_instance.__class__ = MpoImageFile
+ jpeg_instance._after_jpeg_open(mpheader)
+ return jpeg_instance
+
+
+# ---------------------------------------------------------------------
+# Registry stuff
+
+# Note that since MPO shares a factory with JPEG, we do not need to do a
+# separate registration for it here.
+# Image.register_open(MpoImageFile.format,
+# JpegImagePlugin.jpeg_factory, _accept)
+Image.register_save(MpoImageFile.format, _save)
+
+Image.register_extension(MpoImageFile.format, ".mpo")
+
+Image.register_mime(MpoImageFile.format, "image/mpo")
diff --git a/venv/Lib/site-packages/PIL/MspImagePlugin.py b/venv/Lib/site-packages/PIL/MspImagePlugin.py
new file mode 100644
index 0000000..e1fdc1f
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/MspImagePlugin.py
@@ -0,0 +1,194 @@
+#
+# The Python Imaging Library.
+#
+# MSP file handling
+#
+# This is the format used by the Paint program in Windows 1 and 2.
+#
+# History:
+# 95-09-05 fl Created
+# 97-01-03 fl Read/write MSP images
+# 17-02-21 es Fixed RLE interpretation
+#
+# Copyright (c) Secret Labs AB 1997.
+# Copyright (c) Fredrik Lundh 1995-97.
+# Copyright (c) Eric Soroos 2017.
+#
+# See the README file for information on usage and redistribution.
+#
+# More info on this format: https://archive.org/details/gg243631
+# Page 313:
+# Figure 205. Windows Paint Version 1: "DanM" Format
+# Figure 206. Windows Paint Version 2: "LinS" Format. Used in Windows V2.03
+#
+# See also: http://www.fileformat.info/format/mspaint/egff.htm
+
+import io
+import struct
+
+from . import Image, ImageFile
+from ._binary import i16le as i16
+from ._binary import o16le as o16
+
+#
+# read MSP files
+
+
+def _accept(prefix):
+ return prefix[:4] in [b"DanM", b"LinS"]
+
+
+##
+# Image plugin for Windows MSP images. This plugin supports both
+# uncompressed (Windows 1.0).
+
+
+class MspImageFile(ImageFile.ImageFile):
+
+ format = "MSP"
+ format_description = "Windows Paint"
+
+ def _open(self):
+
+ # Header
+ s = self.fp.read(32)
+ if not _accept(s):
+ raise SyntaxError("not an MSP file")
+
+ # Header checksum
+ checksum = 0
+ for i in range(0, 32, 2):
+ checksum = checksum ^ i16(s, i)
+ if checksum != 0:
+ raise SyntaxError("bad MSP checksum")
+
+ self.mode = "1"
+ self._size = i16(s, 4), i16(s, 6)
+
+ if s[:4] == b"DanM":
+ self.tile = [("raw", (0, 0) + self.size, 32, ("1", 0, 1))]
+ else:
+ self.tile = [("MSP", (0, 0) + self.size, 32, None)]
+
+
+class MspDecoder(ImageFile.PyDecoder):
+ # The algo for the MSP decoder is from
+ # http://www.fileformat.info/format/mspaint/egff.htm
+ # cc-by-attribution -- That page references is taken from the
+ # Encyclopedia of Graphics File Formats and is licensed by
+ # O'Reilly under the Creative Common/Attribution license
+ #
+ # For RLE encoded files, the 32byte header is followed by a scan
+ # line map, encoded as one 16bit word of encoded byte length per
+ # line.
+ #
+ # NOTE: the encoded length of the line can be 0. This was not
+ # handled in the previous version of this encoder, and there's no
+ # mention of how to handle it in the documentation. From the few
+ # examples I've seen, I've assumed that it is a fill of the
+ # background color, in this case, white.
+ #
+ #
+ # Pseudocode of the decoder:
+ # Read a BYTE value as the RunType
+ # If the RunType value is zero
+ # Read next byte as the RunCount
+ # Read the next byte as the RunValue
+ # Write the RunValue byte RunCount times
+ # If the RunType value is non-zero
+ # Use this value as the RunCount
+ # Read and write the next RunCount bytes literally
+ #
+ # e.g.:
+ # 0x00 03 ff 05 00 01 02 03 04
+ # would yield the bytes:
+ # 0xff ff ff 00 01 02 03 04
+ #
+ # which are then interpreted as a bit packed mode '1' image
+
+ _pulls_fd = True
+
+ def decode(self, buffer):
+
+ img = io.BytesIO()
+ blank_line = bytearray((0xFF,) * ((self.state.xsize + 7) // 8))
+ try:
+ self.fd.seek(32)
+ rowmap = struct.unpack_from(
+ f"<{self.state.ysize}H", self.fd.read(self.state.ysize * 2)
+ )
+ except struct.error as e:
+ raise OSError("Truncated MSP file in row map") from e
+
+ for x, rowlen in enumerate(rowmap):
+ try:
+ if rowlen == 0:
+ img.write(blank_line)
+ continue
+ row = self.fd.read(rowlen)
+ if len(row) != rowlen:
+ raise OSError(
+ "Truncated MSP file, expected %d bytes on row %s", (rowlen, x)
+ )
+ idx = 0
+ while idx < rowlen:
+ runtype = row[idx]
+ idx += 1
+ if runtype == 0:
+ (runcount, runval) = struct.unpack_from("Bc", row, idx)
+ img.write(runval * runcount)
+ idx += 2
+ else:
+ runcount = runtype
+ img.write(row[idx : idx + runcount])
+ idx += runcount
+
+ except struct.error as e:
+ raise OSError(f"Corrupted MSP file in row {x}") from e
+
+ self.set_as_raw(img.getvalue(), ("1", 0, 1))
+
+ return 0, 0
+
+
+Image.register_decoder("MSP", MspDecoder)
+
+
+#
+# write MSP files (uncompressed only)
+
+
+def _save(im, fp, filename):
+
+ if im.mode != "1":
+ raise OSError(f"cannot write mode {im.mode} as MSP")
+
+ # create MSP header
+ header = [0] * 16
+
+ header[0], header[1] = i16(b"Da"), i16(b"nM") # version 1
+ header[2], header[3] = im.size
+ header[4], header[5] = 1, 1
+ header[6], header[7] = 1, 1
+ header[8], header[9] = im.size
+
+ checksum = 0
+ for h in header:
+ checksum = checksum ^ h
+ header[12] = checksum # FIXME: is this the right field?
+
+ # header
+ for h in header:
+ fp.write(o16(h))
+
+ # image body
+ ImageFile._save(im, fp, [("raw", (0, 0) + im.size, 32, ("1", 0, 1))])
+
+
+#
+# registry
+
+Image.register_open(MspImageFile.format, MspImageFile, _accept)
+Image.register_save(MspImageFile.format, _save)
+
+Image.register_extension(MspImageFile.format, ".msp")
diff --git a/venv/Lib/site-packages/PIL/PSDraw.py b/venv/Lib/site-packages/PIL/PSDraw.py
new file mode 100644
index 0000000..c1bd933
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/PSDraw.py
@@ -0,0 +1,235 @@
+#
+# The Python Imaging Library
+# $Id$
+#
+# Simple PostScript graphics interface
+#
+# History:
+# 1996-04-20 fl Created
+# 1999-01-10 fl Added gsave/grestore to image method
+# 2005-05-04 fl Fixed floating point issue in image (from Eric Etheridge)
+#
+# Copyright (c) 1997-2005 by Secret Labs AB. All rights reserved.
+# Copyright (c) 1996 by Fredrik Lundh.
+#
+# See the README file for information on usage and redistribution.
+#
+
+import sys
+
+from . import EpsImagePlugin
+
+##
+# Simple PostScript graphics interface.
+
+
+class PSDraw:
+ """
+ Sets up printing to the given file. If ``fp`` is omitted,
+ :py:data:`sys.stdout` is assumed.
+ """
+
+ def __init__(self, fp=None):
+ if not fp:
+ fp = sys.stdout
+ self.fp = fp
+
+ def _fp_write(self, to_write):
+ if self.fp == sys.stdout:
+ self.fp.write(to_write)
+ else:
+ self.fp.write(bytes(to_write, "UTF-8"))
+
+ def begin_document(self, id=None):
+ """Set up printing of a document. (Write PostScript DSC header.)"""
+ # FIXME: incomplete
+ self._fp_write(
+ "%!PS-Adobe-3.0\n"
+ "save\n"
+ "/showpage { } def\n"
+ "%%EndComments\n"
+ "%%BeginDocument\n"
+ )
+ # self._fp_write(ERROR_PS) # debugging!
+ self._fp_write(EDROFF_PS)
+ self._fp_write(VDI_PS)
+ self._fp_write("%%EndProlog\n")
+ self.isofont = {}
+
+ def end_document(self):
+ """Ends printing. (Write PostScript DSC footer.)"""
+ self._fp_write("%%EndDocument\nrestore showpage\n%%End\n")
+ if hasattr(self.fp, "flush"):
+ self.fp.flush()
+
+ def setfont(self, font, size):
+ """
+ Selects which font to use.
+
+ :param font: A PostScript font name
+ :param size: Size in points.
+ """
+ if font not in self.isofont:
+ # reencode font
+ self._fp_write(f"/PSDraw-{font} ISOLatin1Encoding /{font} E\n")
+ self.isofont[font] = 1
+ # rough
+ self._fp_write(f"/F0 {size} /PSDraw-{font} F\n")
+
+ def line(self, xy0, xy1):
+ """
+ Draws a line between the two points. Coordinates are given in
+ PostScript point coordinates (72 points per inch, (0, 0) is the lower
+ left corner of the page).
+ """
+ self._fp_write("%d %d %d %d Vl\n" % (*xy0, *xy1))
+
+ def rectangle(self, box):
+ """
+ Draws a rectangle.
+
+ :param box: A 4-tuple of integers whose order and function is currently
+ undocumented.
+
+ Hint: the tuple is passed into this format string:
+
+ .. code-block:: python
+
+ %d %d M %d %d 0 Vr\n
+ """
+ self._fp_write("%d %d M %d %d 0 Vr\n" % box)
+
+ def text(self, xy, text):
+ """
+ Draws text at the given position. You must use
+ :py:meth:`~PIL.PSDraw.PSDraw.setfont` before calling this method.
+ """
+ text = "\\(".join(text.split("("))
+ text = "\\)".join(text.split(")"))
+ self._fp_write(f"{xy[0]} {xy[1]} M ({text}) S\n")
+
+ def image(self, box, im, dpi=None):
+ """Draw a PIL image, centered in the given box."""
+ # default resolution depends on mode
+ if not dpi:
+ if im.mode == "1":
+ dpi = 200 # fax
+ else:
+ dpi = 100 # greyscale
+ # image size (on paper)
+ x = im.size[0] * 72 / dpi
+ y = im.size[1] * 72 / dpi
+ # max allowed size
+ xmax = float(box[2] - box[0])
+ ymax = float(box[3] - box[1])
+ if x > xmax:
+ y = y * xmax / x
+ x = xmax
+ if y > ymax:
+ x = x * ymax / y
+ y = ymax
+ dx = (xmax - x) / 2 + box[0]
+ dy = (ymax - y) / 2 + box[1]
+ self._fp_write(f"gsave\n{dx:f} {dy:f} translate\n")
+ if (x, y) != im.size:
+ # EpsImagePlugin._save prints the image at (0,0,xsize,ysize)
+ sx = x / im.size[0]
+ sy = y / im.size[1]
+ self._fp_write(f"{sx:f} {sy:f} scale\n")
+ EpsImagePlugin._save(im, self.fp, None, 0)
+ self._fp_write("\ngrestore\n")
+
+
+# --------------------------------------------------------------------
+# PostScript driver
+
+#
+# EDROFF.PS -- PostScript driver for Edroff 2
+#
+# History:
+# 94-01-25 fl: created (edroff 2.04)
+#
+# Copyright (c) Fredrik Lundh 1994.
+#
+
+
+EDROFF_PS = """\
+/S { show } bind def
+/P { moveto show } bind def
+/M { moveto } bind def
+/X { 0 rmoveto } bind def
+/Y { 0 exch rmoveto } bind def
+/E { findfont
+ dup maxlength dict begin
+ {
+ 1 index /FID ne { def } { pop pop } ifelse
+ } forall
+ /Encoding exch def
+ dup /FontName exch def
+ currentdict end definefont pop
+} bind def
+/F { findfont exch scalefont dup setfont
+ [ exch /setfont cvx ] cvx bind def
+} bind def
+"""
+
+#
+# VDI.PS -- PostScript driver for VDI meta commands
+#
+# History:
+# 94-01-25 fl: created (edroff 2.04)
+#
+# Copyright (c) Fredrik Lundh 1994.
+#
+
+VDI_PS = """\
+/Vm { moveto } bind def
+/Va { newpath arcn stroke } bind def
+/Vl { moveto lineto stroke } bind def
+/Vc { newpath 0 360 arc closepath } bind def
+/Vr { exch dup 0 rlineto
+ exch dup neg 0 exch rlineto
+ exch neg 0 rlineto
+ 0 exch rlineto
+ 100 div setgray fill 0 setgray } bind def
+/Tm matrix def
+/Ve { Tm currentmatrix pop
+ translate scale newpath 0 0 .5 0 360 arc closepath
+ Tm setmatrix
+} bind def
+/Vf { currentgray exch setgray fill setgray } bind def
+"""
+
+#
+# ERROR.PS -- Error handler
+#
+# History:
+# 89-11-21 fl: created (pslist 1.10)
+#
+
+ERROR_PS = """\
+/landscape false def
+/errorBUF 200 string def
+/errorNL { currentpoint 10 sub exch pop 72 exch moveto } def
+errordict begin /handleerror {
+ initmatrix /Courier findfont 10 scalefont setfont
+ newpath 72 720 moveto $error begin /newerror false def
+ (PostScript Error) show errorNL errorNL
+ (Error: ) show
+ /errorname load errorBUF cvs show errorNL errorNL
+ (Command: ) show
+ /command load dup type /stringtype ne { errorBUF cvs } if show
+ errorNL errorNL
+ (VMstatus: ) show
+ vmstatus errorBUF cvs show ( bytes available, ) show
+ errorBUF cvs show ( bytes used at level ) show
+ errorBUF cvs show errorNL errorNL
+ (Operand stargck: ) show errorNL /ostargck load {
+ dup type /stringtype ne { errorBUF cvs } if 72 0 rmoveto show errorNL
+ } forall errorNL
+ (Execution stargck: ) show errorNL /estargck load {
+ dup type /stringtype ne { errorBUF cvs } if 72 0 rmoveto show errorNL
+ } forall
+ end showpage
+} def end
+"""
diff --git a/venv/Lib/site-packages/PIL/PaletteFile.py b/venv/Lib/site-packages/PIL/PaletteFile.py
new file mode 100644
index 0000000..6ccaa1f
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/PaletteFile.py
@@ -0,0 +1,53 @@
+#
+# Python Imaging Library
+# $Id$
+#
+# stuff to read simple, teragon-style palette files
+#
+# History:
+# 97-08-23 fl Created
+#
+# Copyright (c) Secret Labs AB 1997.
+# Copyright (c) Fredrik Lundh 1997.
+#
+# See the README file for information on usage and redistribution.
+#
+
+from ._binary import o8
+
+
+class PaletteFile:
+ """File handler for Teragon-style palette files."""
+
+ rawmode = "RGB"
+
+ def __init__(self, fp):
+
+ self.palette = [(i, i, i) for i in range(256)]
+
+ while True:
+
+ s = fp.readline()
+
+ if not s:
+ break
+ if s[0:1] == b"#":
+ continue
+ if len(s) > 100:
+ raise SyntaxError("bad palette file")
+
+ v = [int(x) for x in s.split()]
+ try:
+ [i, r, g, b] = v
+ except ValueError:
+ [i, r] = v
+ g = b = r
+
+ if 0 <= i <= 255:
+ self.palette[i] = o8(r) + o8(g) + o8(b)
+
+ self.palette = b"".join(self.palette)
+
+ def getpalette(self):
+
+ return self.palette, self.rawmode
diff --git a/venv/Lib/site-packages/PIL/PalmImagePlugin.py b/venv/Lib/site-packages/PIL/PalmImagePlugin.py
new file mode 100644
index 0000000..700f10e
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/PalmImagePlugin.py
@@ -0,0 +1,227 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+
+##
+# Image plugin for Palm pixmap images (output only).
+##
+
+from . import Image, ImageFile
+from ._binary import o8
+from ._binary import o16be as o16b
+
+# fmt: off
+_Palm8BitColormapValues = (
+ (255, 255, 255), (255, 204, 255), (255, 153, 255), (255, 102, 255),
+ (255, 51, 255), (255, 0, 255), (255, 255, 204), (255, 204, 204),
+ (255, 153, 204), (255, 102, 204), (255, 51, 204), (255, 0, 204),
+ (255, 255, 153), (255, 204, 153), (255, 153, 153), (255, 102, 153),
+ (255, 51, 153), (255, 0, 153), (204, 255, 255), (204, 204, 255),
+ (204, 153, 255), (204, 102, 255), (204, 51, 255), (204, 0, 255),
+ (204, 255, 204), (204, 204, 204), (204, 153, 204), (204, 102, 204),
+ (204, 51, 204), (204, 0, 204), (204, 255, 153), (204, 204, 153),
+ (204, 153, 153), (204, 102, 153), (204, 51, 153), (204, 0, 153),
+ (153, 255, 255), (153, 204, 255), (153, 153, 255), (153, 102, 255),
+ (153, 51, 255), (153, 0, 255), (153, 255, 204), (153, 204, 204),
+ (153, 153, 204), (153, 102, 204), (153, 51, 204), (153, 0, 204),
+ (153, 255, 153), (153, 204, 153), (153, 153, 153), (153, 102, 153),
+ (153, 51, 153), (153, 0, 153), (102, 255, 255), (102, 204, 255),
+ (102, 153, 255), (102, 102, 255), (102, 51, 255), (102, 0, 255),
+ (102, 255, 204), (102, 204, 204), (102, 153, 204), (102, 102, 204),
+ (102, 51, 204), (102, 0, 204), (102, 255, 153), (102, 204, 153),
+ (102, 153, 153), (102, 102, 153), (102, 51, 153), (102, 0, 153),
+ (51, 255, 255), (51, 204, 255), (51, 153, 255), (51, 102, 255),
+ (51, 51, 255), (51, 0, 255), (51, 255, 204), (51, 204, 204),
+ (51, 153, 204), (51, 102, 204), (51, 51, 204), (51, 0, 204),
+ (51, 255, 153), (51, 204, 153), (51, 153, 153), (51, 102, 153),
+ (51, 51, 153), (51, 0, 153), (0, 255, 255), (0, 204, 255),
+ (0, 153, 255), (0, 102, 255), (0, 51, 255), (0, 0, 255),
+ (0, 255, 204), (0, 204, 204), (0, 153, 204), (0, 102, 204),
+ (0, 51, 204), (0, 0, 204), (0, 255, 153), (0, 204, 153),
+ (0, 153, 153), (0, 102, 153), (0, 51, 153), (0, 0, 153),
+ (255, 255, 102), (255, 204, 102), (255, 153, 102), (255, 102, 102),
+ (255, 51, 102), (255, 0, 102), (255, 255, 51), (255, 204, 51),
+ (255, 153, 51), (255, 102, 51), (255, 51, 51), (255, 0, 51),
+ (255, 255, 0), (255, 204, 0), (255, 153, 0), (255, 102, 0),
+ (255, 51, 0), (255, 0, 0), (204, 255, 102), (204, 204, 102),
+ (204, 153, 102), (204, 102, 102), (204, 51, 102), (204, 0, 102),
+ (204, 255, 51), (204, 204, 51), (204, 153, 51), (204, 102, 51),
+ (204, 51, 51), (204, 0, 51), (204, 255, 0), (204, 204, 0),
+ (204, 153, 0), (204, 102, 0), (204, 51, 0), (204, 0, 0),
+ (153, 255, 102), (153, 204, 102), (153, 153, 102), (153, 102, 102),
+ (153, 51, 102), (153, 0, 102), (153, 255, 51), (153, 204, 51),
+ (153, 153, 51), (153, 102, 51), (153, 51, 51), (153, 0, 51),
+ (153, 255, 0), (153, 204, 0), (153, 153, 0), (153, 102, 0),
+ (153, 51, 0), (153, 0, 0), (102, 255, 102), (102, 204, 102),
+ (102, 153, 102), (102, 102, 102), (102, 51, 102), (102, 0, 102),
+ (102, 255, 51), (102, 204, 51), (102, 153, 51), (102, 102, 51),
+ (102, 51, 51), (102, 0, 51), (102, 255, 0), (102, 204, 0),
+ (102, 153, 0), (102, 102, 0), (102, 51, 0), (102, 0, 0),
+ (51, 255, 102), (51, 204, 102), (51, 153, 102), (51, 102, 102),
+ (51, 51, 102), (51, 0, 102), (51, 255, 51), (51, 204, 51),
+ (51, 153, 51), (51, 102, 51), (51, 51, 51), (51, 0, 51),
+ (51, 255, 0), (51, 204, 0), (51, 153, 0), (51, 102, 0),
+ (51, 51, 0), (51, 0, 0), (0, 255, 102), (0, 204, 102),
+ (0, 153, 102), (0, 102, 102), (0, 51, 102), (0, 0, 102),
+ (0, 255, 51), (0, 204, 51), (0, 153, 51), (0, 102, 51),
+ (0, 51, 51), (0, 0, 51), (0, 255, 0), (0, 204, 0),
+ (0, 153, 0), (0, 102, 0), (0, 51, 0), (17, 17, 17),
+ (34, 34, 34), (68, 68, 68), (85, 85, 85), (119, 119, 119),
+ (136, 136, 136), (170, 170, 170), (187, 187, 187), (221, 221, 221),
+ (238, 238, 238), (192, 192, 192), (128, 0, 0), (128, 0, 128),
+ (0, 128, 0), (0, 128, 128), (0, 0, 0), (0, 0, 0),
+ (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
+ (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
+ (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
+ (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
+ (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
+ (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0))
+# fmt: on
+
+
+# so build a prototype image to be used for palette resampling
+def build_prototype_image():
+ image = Image.new("L", (1, len(_Palm8BitColormapValues)))
+ image.putdata(list(range(len(_Palm8BitColormapValues))))
+ palettedata = ()
+ for colormapValue in _Palm8BitColormapValues:
+ palettedata += colormapValue
+ palettedata += (0, 0, 0) * (256 - len(_Palm8BitColormapValues))
+ image.putpalette(palettedata)
+ return image
+
+
+Palm8BitColormapImage = build_prototype_image()
+
+# OK, we now have in Palm8BitColormapImage,
+# a "P"-mode image with the right palette
+#
+# --------------------------------------------------------------------
+
+_FLAGS = {"custom-colormap": 0x4000, "is-compressed": 0x8000, "has-transparent": 0x2000}
+
+_COMPRESSION_TYPES = {"none": 0xFF, "rle": 0x01, "scanline": 0x00}
+
+
+#
+# --------------------------------------------------------------------
+
+##
+# (Internal) Image save plugin for the Palm format.
+
+
+def _save(im, fp, filename):
+
+ if im.mode == "P":
+
+ # we assume this is a color Palm image with the standard colormap,
+ # unless the "info" dict has a "custom-colormap" field
+
+ rawmode = "P"
+ bpp = 8
+ version = 1
+
+ elif im.mode == "L":
+ if im.encoderinfo.get("bpp") in (1, 2, 4):
+ # this is 8-bit grayscale, so we shift it to get the high-order bits,
+ # and invert it because
+ # Palm does greyscale from white (0) to black (1)
+ bpp = im.encoderinfo["bpp"]
+ im = im.point(
+ lambda x, shift=8 - bpp, maxval=(1 << bpp) - 1: maxval - (x >> shift)
+ )
+ elif im.info.get("bpp") in (1, 2, 4):
+ # here we assume that even though the inherent mode is 8-bit grayscale,
+ # only the lower bpp bits are significant.
+ # We invert them to match the Palm.
+ bpp = im.info["bpp"]
+ im = im.point(lambda x, maxval=(1 << bpp) - 1: maxval - (x & maxval))
+ else:
+ raise OSError(f"cannot write mode {im.mode} as Palm")
+
+ # we ignore the palette here
+ im.mode = "P"
+ rawmode = "P;" + str(bpp)
+ version = 1
+
+ elif im.mode == "1":
+
+ # monochrome -- write it inverted, as is the Palm standard
+ rawmode = "1;I"
+ bpp = 1
+ version = 0
+
+ else:
+
+ raise OSError(f"cannot write mode {im.mode} as Palm")
+
+ #
+ # make sure image data is available
+ im.load()
+
+ # write header
+
+ cols = im.size[0]
+ rows = im.size[1]
+
+ rowbytes = int((cols + (16 // bpp - 1)) / (16 // bpp)) * 2
+ transparent_index = 0
+ compression_type = _COMPRESSION_TYPES["none"]
+
+ flags = 0
+ if im.mode == "P" and "custom-colormap" in im.info:
+ flags = flags & _FLAGS["custom-colormap"]
+ colormapsize = 4 * 256 + 2
+ colormapmode = im.palette.mode
+ colormap = im.getdata().getpalette()
+ else:
+ colormapsize = 0
+
+ if "offset" in im.info:
+ offset = (rowbytes * rows + 16 + 3 + colormapsize) // 4
+ else:
+ offset = 0
+
+ fp.write(o16b(cols) + o16b(rows) + o16b(rowbytes) + o16b(flags))
+ fp.write(o8(bpp))
+ fp.write(o8(version))
+ fp.write(o16b(offset))
+ fp.write(o8(transparent_index))
+ fp.write(o8(compression_type))
+ fp.write(o16b(0)) # reserved by Palm
+
+ # now write colormap if necessary
+
+ if colormapsize > 0:
+ fp.write(o16b(256))
+ for i in range(256):
+ fp.write(o8(i))
+ if colormapmode == "RGB":
+ fp.write(
+ o8(colormap[3 * i])
+ + o8(colormap[3 * i + 1])
+ + o8(colormap[3 * i + 2])
+ )
+ elif colormapmode == "RGBA":
+ fp.write(
+ o8(colormap[4 * i])
+ + o8(colormap[4 * i + 1])
+ + o8(colormap[4 * i + 2])
+ )
+
+ # now convert data to raw form
+ ImageFile._save(im, fp, [("raw", (0, 0) + im.size, 0, (rawmode, rowbytes, 1))])
+
+ if hasattr(fp, "flush"):
+ fp.flush()
+
+
+#
+# --------------------------------------------------------------------
+
+Image.register_save("Palm", _save)
+
+Image.register_extension("Palm", ".palm")
+
+Image.register_mime("Palm", "image/palm")
diff --git a/venv/Lib/site-packages/PIL/PcdImagePlugin.py b/venv/Lib/site-packages/PIL/PcdImagePlugin.py
new file mode 100644
index 0000000..38caf5c
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/PcdImagePlugin.py
@@ -0,0 +1,63 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# PCD file handling
+#
+# History:
+# 96-05-10 fl Created
+# 96-05-27 fl Added draft mode (128x192, 256x384)
+#
+# Copyright (c) Secret Labs AB 1997.
+# Copyright (c) Fredrik Lundh 1996.
+#
+# See the README file for information on usage and redistribution.
+#
+
+
+from . import Image, ImageFile
+
+##
+# Image plugin for PhotoCD images. This plugin only reads the 768x512
+# image from the file; higher resolutions are encoded in a proprietary
+# encoding.
+
+
+class PcdImageFile(ImageFile.ImageFile):
+
+ format = "PCD"
+ format_description = "Kodak PhotoCD"
+
+ def _open(self):
+
+ # rough
+ self.fp.seek(2048)
+ s = self.fp.read(2048)
+
+ if s[:4] != b"PCD_":
+ raise SyntaxError("not a PCD file")
+
+ orientation = s[1538] & 3
+ self.tile_post_rotate = None
+ if orientation == 1:
+ self.tile_post_rotate = 90
+ elif orientation == 3:
+ self.tile_post_rotate = -90
+
+ self.mode = "RGB"
+ self._size = 768, 512 # FIXME: not correct for rotated images!
+ self.tile = [("pcd", (0, 0) + self.size, 96 * 2048, None)]
+
+ def load_end(self):
+ if self.tile_post_rotate:
+ # Handle rotated PCDs
+ self.im = self.im.rotate(self.tile_post_rotate)
+ self._size = self.im.size
+
+
+#
+# registry
+
+Image.register_open(PcdImageFile.format, PcdImageFile)
+
+Image.register_extension(PcdImageFile.format, ".pcd")
diff --git a/venv/Lib/site-packages/PIL/PcfFontFile.py b/venv/Lib/site-packages/PIL/PcfFontFile.py
new file mode 100644
index 0000000..6a4eb22
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/PcfFontFile.py
@@ -0,0 +1,248 @@
+#
+# THIS IS WORK IN PROGRESS
+#
+# The Python Imaging Library
+# $Id$
+#
+# portable compiled font file parser
+#
+# history:
+# 1997-08-19 fl created
+# 2003-09-13 fl fixed loading of unicode fonts
+#
+# Copyright (c) 1997-2003 by Secret Labs AB.
+# Copyright (c) 1997-2003 by Fredrik Lundh.
+#
+# See the README file for information on usage and redistribution.
+#
+
+import io
+
+from . import FontFile, Image
+from ._binary import i8
+from ._binary import i16be as b16
+from ._binary import i16le as l16
+from ._binary import i32be as b32
+from ._binary import i32le as l32
+
+# --------------------------------------------------------------------
+# declarations
+
+PCF_MAGIC = 0x70636601 # "\x01fcp"
+
+PCF_PROPERTIES = 1 << 0
+PCF_ACCELERATORS = 1 << 1
+PCF_METRICS = 1 << 2
+PCF_BITMAPS = 1 << 3
+PCF_INK_METRICS = 1 << 4
+PCF_BDF_ENCODINGS = 1 << 5
+PCF_SWIDTHS = 1 << 6
+PCF_GLYPH_NAMES = 1 << 7
+PCF_BDF_ACCELERATORS = 1 << 8
+
+BYTES_PER_ROW = [
+ lambda bits: ((bits + 7) >> 3),
+ lambda bits: ((bits + 15) >> 3) & ~1,
+ lambda bits: ((bits + 31) >> 3) & ~3,
+ lambda bits: ((bits + 63) >> 3) & ~7,
+]
+
+
+def sz(s, o):
+ return s[o : s.index(b"\0", o)]
+
+
+class PcfFontFile(FontFile.FontFile):
+ """Font file plugin for the X11 PCF format."""
+
+ name = "name"
+
+ def __init__(self, fp, charset_encoding="iso8859-1"):
+
+ self.charset_encoding = charset_encoding
+
+ magic = l32(fp.read(4))
+ if magic != PCF_MAGIC:
+ raise SyntaxError("not a PCF file")
+
+ super().__init__()
+
+ count = l32(fp.read(4))
+ self.toc = {}
+ for i in range(count):
+ type = l32(fp.read(4))
+ self.toc[type] = l32(fp.read(4)), l32(fp.read(4)), l32(fp.read(4))
+
+ self.fp = fp
+
+ self.info = self._load_properties()
+
+ metrics = self._load_metrics()
+ bitmaps = self._load_bitmaps(metrics)
+ encoding = self._load_encoding()
+
+ #
+ # create glyph structure
+
+ for ch in range(256):
+ ix = encoding[ch]
+ if ix is not None:
+ x, y, l, r, w, a, d, f = metrics[ix]
+ glyph = (w, 0), (l, d - y, x + l, d), (0, 0, x, y), bitmaps[ix]
+ self.glyph[ch] = glyph
+
+ def _getformat(self, tag):
+
+ format, size, offset = self.toc[tag]
+
+ fp = self.fp
+ fp.seek(offset)
+
+ format = l32(fp.read(4))
+
+ if format & 4:
+ i16, i32 = b16, b32
+ else:
+ i16, i32 = l16, l32
+
+ return fp, format, i16, i32
+
+ def _load_properties(self):
+
+ #
+ # font properties
+
+ properties = {}
+
+ fp, format, i16, i32 = self._getformat(PCF_PROPERTIES)
+
+ nprops = i32(fp.read(4))
+
+ # read property description
+ p = []
+ for i in range(nprops):
+ p.append((i32(fp.read(4)), i8(fp.read(1)), i32(fp.read(4))))
+ if nprops & 3:
+ fp.seek(4 - (nprops & 3), io.SEEK_CUR) # pad
+
+ data = fp.read(i32(fp.read(4)))
+
+ for k, s, v in p:
+ k = sz(data, k)
+ if s:
+ v = sz(data, v)
+ properties[k] = v
+
+ return properties
+
+ def _load_metrics(self):
+
+ #
+ # font metrics
+
+ metrics = []
+
+ fp, format, i16, i32 = self._getformat(PCF_METRICS)
+
+ append = metrics.append
+
+ if (format & 0xFF00) == 0x100:
+
+ # "compressed" metrics
+ for i in range(i16(fp.read(2))):
+ left = i8(fp.read(1)) - 128
+ right = i8(fp.read(1)) - 128
+ width = i8(fp.read(1)) - 128
+ ascent = i8(fp.read(1)) - 128
+ descent = i8(fp.read(1)) - 128
+ xsize = right - left
+ ysize = ascent + descent
+ append((xsize, ysize, left, right, width, ascent, descent, 0))
+
+ else:
+
+ # "jumbo" metrics
+ for i in range(i32(fp.read(4))):
+ left = i16(fp.read(2))
+ right = i16(fp.read(2))
+ width = i16(fp.read(2))
+ ascent = i16(fp.read(2))
+ descent = i16(fp.read(2))
+ attributes = i16(fp.read(2))
+ xsize = right - left
+ ysize = ascent + descent
+ append((xsize, ysize, left, right, width, ascent, descent, attributes))
+
+ return metrics
+
+ def _load_bitmaps(self, metrics):
+
+ #
+ # bitmap data
+
+ bitmaps = []
+
+ fp, format, i16, i32 = self._getformat(PCF_BITMAPS)
+
+ nbitmaps = i32(fp.read(4))
+
+ if nbitmaps != len(metrics):
+ raise OSError("Wrong number of bitmaps")
+
+ offsets = []
+ for i in range(nbitmaps):
+ offsets.append(i32(fp.read(4)))
+
+ bitmapSizes = []
+ for i in range(4):
+ bitmapSizes.append(i32(fp.read(4)))
+
+ # byteorder = format & 4 # non-zero => MSB
+ bitorder = format & 8 # non-zero => MSB
+ padindex = format & 3
+
+ bitmapsize = bitmapSizes[padindex]
+ offsets.append(bitmapsize)
+
+ data = fp.read(bitmapsize)
+
+ pad = BYTES_PER_ROW[padindex]
+ mode = "1;R"
+ if bitorder:
+ mode = "1"
+
+ for i in range(nbitmaps):
+ x, y, l, r, w, a, d, f = metrics[i]
+ b, e = offsets[i], offsets[i + 1]
+ bitmaps.append(Image.frombytes("1", (x, y), data[b:e], "raw", mode, pad(x)))
+
+ return bitmaps
+
+ def _load_encoding(self):
+
+ # map character code to bitmap index
+ encoding = [None] * 256
+
+ fp, format, i16, i32 = self._getformat(PCF_BDF_ENCODINGS)
+
+ firstCol, lastCol = i16(fp.read(2)), i16(fp.read(2))
+ firstRow, lastRow = i16(fp.read(2)), i16(fp.read(2))
+
+ i16(fp.read(2)) # default
+
+ nencoding = (lastCol - firstCol + 1) * (lastRow - firstRow + 1)
+
+ encodingOffsets = [i16(fp.read(2)) for _ in range(nencoding)]
+
+ for i in range(firstCol, len(encoding)):
+ try:
+ encodingOffset = encodingOffsets[
+ ord(bytearray([i]).decode(self.charset_encoding))
+ ]
+ if encodingOffset != 0xFFFF:
+ encoding[i] = encodingOffset
+ except UnicodeDecodeError:
+ # character is not supported in selected encoding
+ pass
+
+ return encoding
diff --git a/venv/Lib/site-packages/PIL/PcxImagePlugin.py b/venv/Lib/site-packages/PIL/PcxImagePlugin.py
new file mode 100644
index 0000000..d2e166b
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/PcxImagePlugin.py
@@ -0,0 +1,218 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# PCX file handling
+#
+# This format was originally used by ZSoft's popular PaintBrush
+# program for the IBM PC. It is also supported by many MS-DOS and
+# Windows applications, including the Windows PaintBrush program in
+# Windows 3.
+#
+# history:
+# 1995-09-01 fl Created
+# 1996-05-20 fl Fixed RGB support
+# 1997-01-03 fl Fixed 2-bit and 4-bit support
+# 1999-02-03 fl Fixed 8-bit support (broken in 1.0b1)
+# 1999-02-07 fl Added write support
+# 2002-06-09 fl Made 2-bit and 4-bit support a bit more robust
+# 2002-07-30 fl Seek from to current position, not beginning of file
+# 2003-06-03 fl Extract DPI settings (info["dpi"])
+#
+# Copyright (c) 1997-2003 by Secret Labs AB.
+# Copyright (c) 1995-2003 by Fredrik Lundh.
+#
+# See the README file for information on usage and redistribution.
+#
+
+import io
+import logging
+
+from . import Image, ImageFile, ImagePalette
+from ._binary import i16le as i16
+from ._binary import o8
+from ._binary import o16le as o16
+
+logger = logging.getLogger(__name__)
+
+
+def _accept(prefix):
+ return prefix[0] == 10 and prefix[1] in [0, 2, 3, 5]
+
+
+##
+# Image plugin for Paintbrush images.
+
+
+class PcxImageFile(ImageFile.ImageFile):
+
+ format = "PCX"
+ format_description = "Paintbrush"
+
+ def _open(self):
+
+ # header
+ s = self.fp.read(128)
+ if not _accept(s):
+ raise SyntaxError("not a PCX file")
+
+ # image
+ bbox = i16(s, 4), i16(s, 6), i16(s, 8) + 1, i16(s, 10) + 1
+ if bbox[2] <= bbox[0] or bbox[3] <= bbox[1]:
+ raise SyntaxError("bad PCX image size")
+ logger.debug("BBox: %s %s %s %s", *bbox)
+
+ # format
+ version = s[1]
+ bits = s[3]
+ planes = s[65]
+ provided_stride = i16(s, 66)
+ logger.debug(
+ "PCX version %s, bits %s, planes %s, stride %s",
+ version,
+ bits,
+ planes,
+ provided_stride,
+ )
+
+ self.info["dpi"] = i16(s, 12), i16(s, 14)
+
+ if bits == 1 and planes == 1:
+ mode = rawmode = "1"
+
+ elif bits == 1 and planes in (2, 4):
+ mode = "P"
+ rawmode = "P;%dL" % planes
+ self.palette = ImagePalette.raw("RGB", s[16:64])
+
+ elif version == 5 and bits == 8 and planes == 1:
+ mode = rawmode = "L"
+ # FIXME: hey, this doesn't work with the incremental loader !!!
+ self.fp.seek(-769, io.SEEK_END)
+ s = self.fp.read(769)
+ if len(s) == 769 and s[0] == 12:
+ # check if the palette is linear greyscale
+ for i in range(256):
+ if s[i * 3 + 1 : i * 3 + 4] != o8(i) * 3:
+ mode = rawmode = "P"
+ break
+ if mode == "P":
+ self.palette = ImagePalette.raw("RGB", s[1:])
+ self.fp.seek(128)
+
+ elif version == 5 and bits == 8 and planes == 3:
+ mode = "RGB"
+ rawmode = "RGB;L"
+
+ else:
+ raise OSError("unknown PCX mode")
+
+ self.mode = mode
+ self._size = bbox[2] - bbox[0], bbox[3] - bbox[1]
+
+ # Don't trust the passed in stride.
+ # Calculate the approximate position for ourselves.
+ # CVE-2020-35653
+ stride = (self._size[0] * bits + 7) // 8
+
+ # While the specification states that this must be even,
+ # not all images follow this
+ if provided_stride != stride:
+ stride += stride % 2
+
+ bbox = (0, 0) + self.size
+ logger.debug("size: %sx%s", *self.size)
+
+ self.tile = [("pcx", bbox, self.fp.tell(), (rawmode, planes * stride))]
+
+
+# --------------------------------------------------------------------
+# save PCX files
+
+
+SAVE = {
+ # mode: (version, bits, planes, raw mode)
+ "1": (2, 1, 1, "1"),
+ "L": (5, 8, 1, "L"),
+ "P": (5, 8, 1, "P"),
+ "RGB": (5, 8, 3, "RGB;L"),
+}
+
+
+def _save(im, fp, filename):
+
+ try:
+ version, bits, planes, rawmode = SAVE[im.mode]
+ except KeyError as e:
+ raise ValueError(f"Cannot save {im.mode} images as PCX") from e
+
+ # bytes per plane
+ stride = (im.size[0] * bits + 7) // 8
+ # stride should be even
+ stride += stride % 2
+ # Stride needs to be kept in sync with the PcxEncode.c version.
+ # Ideally it should be passed in in the state, but the bytes value
+ # gets overwritten.
+
+ logger.debug(
+ "PcxImagePlugin._save: xwidth: %d, bits: %d, stride: %d",
+ im.size[0],
+ bits,
+ stride,
+ )
+
+ # under windows, we could determine the current screen size with
+ # "Image.core.display_mode()[1]", but I think that's overkill...
+
+ screen = im.size
+
+ dpi = 100, 100
+
+ # PCX header
+ fp.write(
+ o8(10)
+ + o8(version)
+ + o8(1)
+ + o8(bits)
+ + o16(0)
+ + o16(0)
+ + o16(im.size[0] - 1)
+ + o16(im.size[1] - 1)
+ + o16(dpi[0])
+ + o16(dpi[1])
+ + b"\0" * 24
+ + b"\xFF" * 24
+ + b"\0"
+ + o8(planes)
+ + o16(stride)
+ + o16(1)
+ + o16(screen[0])
+ + o16(screen[1])
+ + b"\0" * 54
+ )
+
+ assert fp.tell() == 128
+
+ ImageFile._save(im, fp, [("pcx", (0, 0) + im.size, 0, (rawmode, bits * planes))])
+
+ if im.mode == "P":
+ # colour palette
+ fp.write(o8(12))
+ fp.write(im.im.getpalette("RGB", "RGB")) # 768 bytes
+ elif im.mode == "L":
+ # greyscale palette
+ fp.write(o8(12))
+ for i in range(256):
+ fp.write(o8(i) * 3)
+
+
+# --------------------------------------------------------------------
+# registry
+
+
+Image.register_open(PcxImageFile.format, PcxImageFile, _accept)
+Image.register_save(PcxImageFile.format, _save)
+
+Image.register_extension(PcxImageFile.format, ".pcx")
+
+Image.register_mime(PcxImageFile.format, "image/x-pcx")
diff --git a/venv/Lib/site-packages/PIL/PdfImagePlugin.py b/venv/Lib/site-packages/PIL/PdfImagePlugin.py
new file mode 100644
index 0000000..36c8fb8
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/PdfImagePlugin.py
@@ -0,0 +1,246 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# PDF (Acrobat) file handling
+#
+# History:
+# 1996-07-16 fl Created
+# 1997-01-18 fl Fixed header
+# 2004-02-21 fl Fixes for 1/L/CMYK images, etc.
+# 2004-02-24 fl Fixes for 1 and P images.
+#
+# Copyright (c) 1997-2004 by Secret Labs AB. All rights reserved.
+# Copyright (c) 1996-1997 by Fredrik Lundh.
+#
+# See the README file for information on usage and redistribution.
+#
+
+##
+# Image plugin for PDF images (output only).
+##
+
+import io
+import os
+import time
+
+from . import Image, ImageFile, ImageSequence, PdfParser, __version__
+
+#
+# --------------------------------------------------------------------
+
+# object ids:
+# 1. catalogue
+# 2. pages
+# 3. image
+# 4. page
+# 5. page contents
+
+
+def _save_all(im, fp, filename):
+ _save(im, fp, filename, save_all=True)
+
+
+##
+# (Internal) Image save plugin for the PDF format.
+
+
+def _save(im, fp, filename, save_all=False):
+ is_appending = im.encoderinfo.get("append", False)
+ if is_appending:
+ existing_pdf = PdfParser.PdfParser(f=fp, filename=filename, mode="r+b")
+ else:
+ existing_pdf = PdfParser.PdfParser(f=fp, filename=filename, mode="w+b")
+
+ resolution = im.encoderinfo.get("resolution", 72.0)
+
+ info = {
+ "title": None
+ if is_appending
+ else os.path.splitext(os.path.basename(filename))[0],
+ "author": None,
+ "subject": None,
+ "keywords": None,
+ "creator": None,
+ "producer": None,
+ "creationDate": None if is_appending else time.gmtime(),
+ "modDate": None if is_appending else time.gmtime(),
+ }
+ for k, default in info.items():
+ v = im.encoderinfo.get(k) if k in im.encoderinfo else default
+ if v:
+ existing_pdf.info[k[0].upper() + k[1:]] = v
+
+ #
+ # make sure image data is available
+ im.load()
+
+ existing_pdf.start_writing()
+ existing_pdf.write_header()
+ existing_pdf.write_comment(f"created by Pillow {__version__} PDF driver")
+
+ #
+ # pages
+ ims = [im]
+ if save_all:
+ append_images = im.encoderinfo.get("append_images", [])
+ for append_im in append_images:
+ append_im.encoderinfo = im.encoderinfo.copy()
+ ims.append(append_im)
+ numberOfPages = 0
+ image_refs = []
+ page_refs = []
+ contents_refs = []
+ for im in ims:
+ im_numberOfPages = 1
+ if save_all:
+ try:
+ im_numberOfPages = im.n_frames
+ except AttributeError:
+ # Image format does not have n_frames.
+ # It is a single frame image
+ pass
+ numberOfPages += im_numberOfPages
+ for i in range(im_numberOfPages):
+ image_refs.append(existing_pdf.next_object_id(0))
+ page_refs.append(existing_pdf.next_object_id(0))
+ contents_refs.append(existing_pdf.next_object_id(0))
+ existing_pdf.pages.append(page_refs[-1])
+
+ #
+ # catalog and list of pages
+ existing_pdf.write_catalog()
+
+ pageNumber = 0
+ for imSequence in ims:
+ im_pages = ImageSequence.Iterator(imSequence) if save_all else [imSequence]
+ for im in im_pages:
+ # FIXME: Should replace ASCIIHexDecode with RunLengthDecode
+ # (packbits) or LZWDecode (tiff/lzw compression). Note that
+ # PDF 1.2 also supports Flatedecode (zip compression).
+
+ bits = 8
+ params = None
+ decode = None
+
+ if im.mode == "1":
+ filter = "ASCIIHexDecode"
+ colorspace = PdfParser.PdfName("DeviceGray")
+ procset = "ImageB" # grayscale
+ bits = 1
+ elif im.mode == "L":
+ filter = "DCTDecode"
+ # params = f"<< /Predictor 15 /Columns {width-2} >>"
+ colorspace = PdfParser.PdfName("DeviceGray")
+ procset = "ImageB" # grayscale
+ elif im.mode == "P":
+ filter = "ASCIIHexDecode"
+ palette = im.im.getpalette("RGB")
+ colorspace = [
+ PdfParser.PdfName("Indexed"),
+ PdfParser.PdfName("DeviceRGB"),
+ 255,
+ PdfParser.PdfBinary(palette),
+ ]
+ procset = "ImageI" # indexed color
+ elif im.mode == "RGB":
+ filter = "DCTDecode"
+ colorspace = PdfParser.PdfName("DeviceRGB")
+ procset = "ImageC" # color images
+ elif im.mode == "CMYK":
+ filter = "DCTDecode"
+ colorspace = PdfParser.PdfName("DeviceCMYK")
+ procset = "ImageC" # color images
+ decode = [1, 0, 1, 0, 1, 0, 1, 0]
+ else:
+ raise ValueError(f"cannot save mode {im.mode}")
+
+ #
+ # image
+
+ op = io.BytesIO()
+
+ if filter == "ASCIIHexDecode":
+ if bits == 1:
+ # FIXME: the hex encoder doesn't support packed 1-bit
+ # images; do things the hard way...
+ data = im.tobytes("raw", "1")
+ im = Image.new("L", im.size)
+ im.putdata(data)
+ ImageFile._save(im, op, [("hex", (0, 0) + im.size, 0, im.mode)])
+ elif filter == "DCTDecode":
+ Image.SAVE["JPEG"](im, op, filename)
+ elif filter == "FlateDecode":
+ ImageFile._save(im, op, [("zip", (0, 0) + im.size, 0, im.mode)])
+ elif filter == "RunLengthDecode":
+ ImageFile._save(im, op, [("packbits", (0, 0) + im.size, 0, im.mode)])
+ else:
+ raise ValueError(f"unsupported PDF filter ({filter})")
+
+ #
+ # Get image characteristics
+
+ width, height = im.size
+
+ existing_pdf.write_obj(
+ image_refs[pageNumber],
+ stream=op.getvalue(),
+ Type=PdfParser.PdfName("XObject"),
+ Subtype=PdfParser.PdfName("Image"),
+ Width=width, # * 72.0 / resolution,
+ Height=height, # * 72.0 / resolution,
+ Filter=PdfParser.PdfName(filter),
+ BitsPerComponent=bits,
+ Decode=decode,
+ DecodeParams=params,
+ ColorSpace=colorspace,
+ )
+
+ #
+ # page
+
+ existing_pdf.write_page(
+ page_refs[pageNumber],
+ Resources=PdfParser.PdfDict(
+ ProcSet=[PdfParser.PdfName("PDF"), PdfParser.PdfName(procset)],
+ XObject=PdfParser.PdfDict(image=image_refs[pageNumber]),
+ ),
+ MediaBox=[
+ 0,
+ 0,
+ int(width * 72.0 / resolution),
+ int(height * 72.0 / resolution),
+ ],
+ Contents=contents_refs[pageNumber],
+ )
+
+ #
+ # page contents
+
+ page_contents = b"q %d 0 0 %d 0 0 cm /image Do Q\n" % (
+ int(width * 72.0 / resolution),
+ int(height * 72.0 / resolution),
+ )
+
+ existing_pdf.write_obj(contents_refs[pageNumber], stream=page_contents)
+
+ pageNumber += 1
+
+ #
+ # trailer
+ existing_pdf.write_xref_and_trailer()
+ if hasattr(fp, "flush"):
+ fp.flush()
+ existing_pdf.close()
+
+
+#
+# --------------------------------------------------------------------
+
+
+Image.register_save("PDF", _save)
+Image.register_save_all("PDF", _save_all)
+
+Image.register_extension("PDF", ".pdf")
+
+Image.register_mime("PDF", "application/pdf")
diff --git a/venv/Lib/site-packages/PIL/PdfParser.py b/venv/Lib/site-packages/PIL/PdfParser.py
new file mode 100644
index 0000000..86d78a9
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/PdfParser.py
@@ -0,0 +1,995 @@
+import calendar
+import codecs
+import collections
+import mmap
+import os
+import re
+import time
+import zlib
+
+
+# see 7.9.2.2 Text String Type on page 86 and D.3 PDFDocEncoding Character Set
+# on page 656
+def encode_text(s):
+ return codecs.BOM_UTF16_BE + s.encode("utf_16_be")
+
+
+PDFDocEncoding = {
+ 0x16: "\u0017",
+ 0x18: "\u02D8",
+ 0x19: "\u02C7",
+ 0x1A: "\u02C6",
+ 0x1B: "\u02D9",
+ 0x1C: "\u02DD",
+ 0x1D: "\u02DB",
+ 0x1E: "\u02DA",
+ 0x1F: "\u02DC",
+ 0x80: "\u2022",
+ 0x81: "\u2020",
+ 0x82: "\u2021",
+ 0x83: "\u2026",
+ 0x84: "\u2014",
+ 0x85: "\u2013",
+ 0x86: "\u0192",
+ 0x87: "\u2044",
+ 0x88: "\u2039",
+ 0x89: "\u203A",
+ 0x8A: "\u2212",
+ 0x8B: "\u2030",
+ 0x8C: "\u201E",
+ 0x8D: "\u201C",
+ 0x8E: "\u201D",
+ 0x8F: "\u2018",
+ 0x90: "\u2019",
+ 0x91: "\u201A",
+ 0x92: "\u2122",
+ 0x93: "\uFB01",
+ 0x94: "\uFB02",
+ 0x95: "\u0141",
+ 0x96: "\u0152",
+ 0x97: "\u0160",
+ 0x98: "\u0178",
+ 0x99: "\u017D",
+ 0x9A: "\u0131",
+ 0x9B: "\u0142",
+ 0x9C: "\u0153",
+ 0x9D: "\u0161",
+ 0x9E: "\u017E",
+ 0xA0: "\u20AC",
+}
+
+
+def decode_text(b):
+ if b[: len(codecs.BOM_UTF16_BE)] == codecs.BOM_UTF16_BE:
+ return b[len(codecs.BOM_UTF16_BE) :].decode("utf_16_be")
+ else:
+ return "".join(PDFDocEncoding.get(byte, chr(byte)) for byte in b)
+
+
+class PdfFormatError(RuntimeError):
+ """An error that probably indicates a syntactic or semantic error in the
+ PDF file structure"""
+
+ pass
+
+
+def check_format_condition(condition, error_message):
+ if not condition:
+ raise PdfFormatError(error_message)
+
+
+class IndirectReference(
+ collections.namedtuple("IndirectReferenceTuple", ["object_id", "generation"])
+):
+ def __str__(self):
+ return "%s %s R" % self
+
+ def __bytes__(self):
+ return self.__str__().encode("us-ascii")
+
+ def __eq__(self, other):
+ return (
+ other.__class__ is self.__class__
+ and other.object_id == self.object_id
+ and other.generation == self.generation
+ )
+
+ def __ne__(self, other):
+ return not (self == other)
+
+ def __hash__(self):
+ return hash((self.object_id, self.generation))
+
+
+class IndirectObjectDef(IndirectReference):
+ def __str__(self):
+ return "%s %s obj" % self
+
+
+class XrefTable:
+ def __init__(self):
+ self.existing_entries = {} # object ID => (offset, generation)
+ self.new_entries = {} # object ID => (offset, generation)
+ self.deleted_entries = {0: 65536} # object ID => generation
+ self.reading_finished = False
+
+ def __setitem__(self, key, value):
+ if self.reading_finished:
+ self.new_entries[key] = value
+ else:
+ self.existing_entries[key] = value
+ if key in self.deleted_entries:
+ del self.deleted_entries[key]
+
+ def __getitem__(self, key):
+ try:
+ return self.new_entries[key]
+ except KeyError:
+ return self.existing_entries[key]
+
+ def __delitem__(self, key):
+ if key in self.new_entries:
+ generation = self.new_entries[key][1] + 1
+ del self.new_entries[key]
+ self.deleted_entries[key] = generation
+ elif key in self.existing_entries:
+ generation = self.existing_entries[key][1] + 1
+ self.deleted_entries[key] = generation
+ elif key in self.deleted_entries:
+ generation = self.deleted_entries[key]
+ else:
+ raise IndexError(
+ "object ID " + str(key) + " cannot be deleted because it doesn't exist"
+ )
+
+ def __contains__(self, key):
+ return key in self.existing_entries or key in self.new_entries
+
+ def __len__(self):
+ return len(
+ set(self.existing_entries.keys())
+ | set(self.new_entries.keys())
+ | set(self.deleted_entries.keys())
+ )
+
+ def keys(self):
+ return (
+ set(self.existing_entries.keys()) - set(self.deleted_entries.keys())
+ ) | set(self.new_entries.keys())
+
+ def write(self, f):
+ keys = sorted(set(self.new_entries.keys()) | set(self.deleted_entries.keys()))
+ deleted_keys = sorted(set(self.deleted_entries.keys()))
+ startxref = f.tell()
+ f.write(b"xref\n")
+ while keys:
+ # find a contiguous sequence of object IDs
+ prev = None
+ for index, key in enumerate(keys):
+ if prev is None or prev + 1 == key:
+ prev = key
+ else:
+ contiguous_keys = keys[:index]
+ keys = keys[index:]
+ break
+ else:
+ contiguous_keys = keys
+ keys = None
+ f.write(b"%d %d\n" % (contiguous_keys[0], len(contiguous_keys)))
+ for object_id in contiguous_keys:
+ if object_id in self.new_entries:
+ f.write(b"%010d %05d n \n" % self.new_entries[object_id])
+ else:
+ this_deleted_object_id = deleted_keys.pop(0)
+ check_format_condition(
+ object_id == this_deleted_object_id,
+ f"expected the next deleted object ID to be {object_id}, "
+ f"instead found {this_deleted_object_id}",
+ )
+ try:
+ next_in_linked_list = deleted_keys[0]
+ except IndexError:
+ next_in_linked_list = 0
+ f.write(
+ b"%010d %05d f \n"
+ % (next_in_linked_list, self.deleted_entries[object_id])
+ )
+ return startxref
+
+
+class PdfName:
+ def __init__(self, name):
+ if isinstance(name, PdfName):
+ self.name = name.name
+ elif isinstance(name, bytes):
+ self.name = name
+ else:
+ self.name = name.encode("us-ascii")
+
+ def name_as_str(self):
+ return self.name.decode("us-ascii")
+
+ def __eq__(self, other):
+ return (
+ isinstance(other, PdfName) and other.name == self.name
+ ) or other == self.name
+
+ def __hash__(self):
+ return hash(self.name)
+
+ def __repr__(self):
+ return f"PdfName({repr(self.name)})"
+
+ @classmethod
+ def from_pdf_stream(cls, data):
+ return cls(PdfParser.interpret_name(data))
+
+ allowed_chars = set(range(33, 127)) - {ord(c) for c in "#%/()<>[]{}"}
+
+ def __bytes__(self):
+ result = bytearray(b"/")
+ for b in self.name:
+ if b in self.allowed_chars:
+ result.append(b)
+ else:
+ result.extend(b"#%02X" % b)
+ return bytes(result)
+
+
+class PdfArray(list):
+ def __bytes__(self):
+ return b"[ " + b" ".join(pdf_repr(x) for x in self) + b" ]"
+
+
+class PdfDict(collections.UserDict):
+ def __setattr__(self, key, value):
+ if key == "data":
+ collections.UserDict.__setattr__(self, key, value)
+ else:
+ self[key.encode("us-ascii")] = value
+
+ def __getattr__(self, key):
+ try:
+ value = self[key.encode("us-ascii")]
+ except KeyError as e:
+ raise AttributeError(key) from e
+ if isinstance(value, bytes):
+ value = decode_text(value)
+ if key.endswith("Date"):
+ if value.startswith("D:"):
+ value = value[2:]
+
+ relationship = "Z"
+ if len(value) > 17:
+ relationship = value[14]
+ offset = int(value[15:17]) * 60
+ if len(value) > 20:
+ offset += int(value[18:20])
+
+ format = "%Y%m%d%H%M%S"[: len(value) - 2]
+ value = time.strptime(value[: len(format) + 2], format)
+ if relationship in ["+", "-"]:
+ offset *= 60
+ if relationship == "+":
+ offset *= -1
+ value = time.gmtime(calendar.timegm(value) + offset)
+ return value
+
+ def __bytes__(self):
+ out = bytearray(b"<<")
+ for key, value in self.items():
+ if value is None:
+ continue
+ value = pdf_repr(value)
+ out.extend(b"\n")
+ out.extend(bytes(PdfName(key)))
+ out.extend(b" ")
+ out.extend(value)
+ out.extend(b"\n>>")
+ return bytes(out)
+
+
+class PdfBinary:
+ def __init__(self, data):
+ self.data = data
+
+ def __bytes__(self):
+ return b"<%s>" % b"".join(b"%02X" % b for b in self.data)
+
+
+class PdfStream:
+ def __init__(self, dictionary, buf):
+ self.dictionary = dictionary
+ self.buf = buf
+
+ def decode(self):
+ try:
+ filter = self.dictionary.Filter
+ except AttributeError:
+ return self.buf
+ if filter == b"FlateDecode":
+ try:
+ expected_length = self.dictionary.DL
+ except AttributeError:
+ expected_length = self.dictionary.Length
+ return zlib.decompress(self.buf, bufsize=int(expected_length))
+ else:
+ raise NotImplementedError(
+ f"stream filter {repr(self.dictionary.Filter)} unknown/unsupported"
+ )
+
+
+def pdf_repr(x):
+ if x is True:
+ return b"true"
+ elif x is False:
+ return b"false"
+ elif x is None:
+ return b"null"
+ elif isinstance(x, (PdfName, PdfDict, PdfArray, PdfBinary)):
+ return bytes(x)
+ elif isinstance(x, int):
+ return str(x).encode("us-ascii")
+ elif isinstance(x, time.struct_time):
+ return b"(D:" + time.strftime("%Y%m%d%H%M%SZ", x).encode("us-ascii") + b")"
+ elif isinstance(x, dict):
+ return bytes(PdfDict(x))
+ elif isinstance(x, list):
+ return bytes(PdfArray(x))
+ elif isinstance(x, str):
+ return pdf_repr(encode_text(x))
+ elif isinstance(x, bytes):
+ # XXX escape more chars? handle binary garbage
+ x = x.replace(b"\\", b"\\\\")
+ x = x.replace(b"(", b"\\(")
+ x = x.replace(b")", b"\\)")
+ return b"(" + x + b")"
+ else:
+ return bytes(x)
+
+
+class PdfParser:
+ """Based on
+ https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf
+ Supports PDF up to 1.4
+ """
+
+ def __init__(self, filename=None, f=None, buf=None, start_offset=0, mode="rb"):
+ if buf and f:
+ raise RuntimeError("specify buf or f or filename, but not both buf and f")
+ self.filename = filename
+ self.buf = buf
+ self.f = f
+ self.start_offset = start_offset
+ self.should_close_buf = False
+ self.should_close_file = False
+ if filename is not None and f is None:
+ self.f = f = open(filename, mode)
+ self.should_close_file = True
+ if f is not None:
+ self.buf = buf = self.get_buf_from_file(f)
+ self.should_close_buf = True
+ if not filename and hasattr(f, "name"):
+ self.filename = f.name
+ self.cached_objects = {}
+ if buf:
+ self.read_pdf_info()
+ else:
+ self.file_size_total = self.file_size_this = 0
+ self.root = PdfDict()
+ self.root_ref = None
+ self.info = PdfDict()
+ self.info_ref = None
+ self.page_tree_root = {}
+ self.pages = []
+ self.orig_pages = []
+ self.pages_ref = None
+ self.last_xref_section_offset = None
+ self.trailer_dict = {}
+ self.xref_table = XrefTable()
+ self.xref_table.reading_finished = True
+ if f:
+ self.seek_end()
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ self.close()
+ return False # do not suppress exceptions
+
+ def start_writing(self):
+ self.close_buf()
+ self.seek_end()
+
+ def close_buf(self):
+ try:
+ self.buf.close()
+ except AttributeError:
+ pass
+ self.buf = None
+
+ def close(self):
+ if self.should_close_buf:
+ self.close_buf()
+ if self.f is not None and self.should_close_file:
+ self.f.close()
+ self.f = None
+
+ def seek_end(self):
+ self.f.seek(0, os.SEEK_END)
+
+ def write_header(self):
+ self.f.write(b"%PDF-1.4\n")
+
+ def write_comment(self, s):
+ self.f.write(f"% {s}\n".encode("utf-8"))
+
+ def write_catalog(self):
+ self.del_root()
+ self.root_ref = self.next_object_id(self.f.tell())
+ self.pages_ref = self.next_object_id(0)
+ self.rewrite_pages()
+ self.write_obj(self.root_ref, Type=PdfName(b"Catalog"), Pages=self.pages_ref)
+ self.write_obj(
+ self.pages_ref,
+ Type=PdfName(b"Pages"),
+ Count=len(self.pages),
+ Kids=self.pages,
+ )
+ return self.root_ref
+
+ def rewrite_pages(self):
+ pages_tree_nodes_to_delete = []
+ for i, page_ref in enumerate(self.orig_pages):
+ page_info = self.cached_objects[page_ref]
+ del self.xref_table[page_ref.object_id]
+ pages_tree_nodes_to_delete.append(page_info[PdfName(b"Parent")])
+ if page_ref not in self.pages:
+ # the page has been deleted
+ continue
+ # make dict keys into strings for passing to write_page
+ stringified_page_info = {}
+ for key, value in page_info.items():
+ # key should be a PdfName
+ stringified_page_info[key.name_as_str()] = value
+ stringified_page_info["Parent"] = self.pages_ref
+ new_page_ref = self.write_page(None, **stringified_page_info)
+ for j, cur_page_ref in enumerate(self.pages):
+ if cur_page_ref == page_ref:
+ # replace the page reference with the new one
+ self.pages[j] = new_page_ref
+ # delete redundant Pages tree nodes from xref table
+ for pages_tree_node_ref in pages_tree_nodes_to_delete:
+ while pages_tree_node_ref:
+ pages_tree_node = self.cached_objects[pages_tree_node_ref]
+ if pages_tree_node_ref.object_id in self.xref_table:
+ del self.xref_table[pages_tree_node_ref.object_id]
+ pages_tree_node_ref = pages_tree_node.get(b"Parent", None)
+ self.orig_pages = []
+
+ def write_xref_and_trailer(self, new_root_ref=None):
+ if new_root_ref:
+ self.del_root()
+ self.root_ref = new_root_ref
+ if self.info:
+ self.info_ref = self.write_obj(None, self.info)
+ start_xref = self.xref_table.write(self.f)
+ num_entries = len(self.xref_table)
+ trailer_dict = {b"Root": self.root_ref, b"Size": num_entries}
+ if self.last_xref_section_offset is not None:
+ trailer_dict[b"Prev"] = self.last_xref_section_offset
+ if self.info:
+ trailer_dict[b"Info"] = self.info_ref
+ self.last_xref_section_offset = start_xref
+ self.f.write(
+ b"trailer\n"
+ + bytes(PdfDict(trailer_dict))
+ + b"\nstartxref\n%d\n%%%%EOF" % start_xref
+ )
+
+ def write_page(self, ref, *objs, **dict_obj):
+ if isinstance(ref, int):
+ ref = self.pages[ref]
+ if "Type" not in dict_obj:
+ dict_obj["Type"] = PdfName(b"Page")
+ if "Parent" not in dict_obj:
+ dict_obj["Parent"] = self.pages_ref
+ return self.write_obj(ref, *objs, **dict_obj)
+
+ def write_obj(self, ref, *objs, **dict_obj):
+ f = self.f
+ if ref is None:
+ ref = self.next_object_id(f.tell())
+ else:
+ self.xref_table[ref.object_id] = (f.tell(), ref.generation)
+ f.write(bytes(IndirectObjectDef(*ref)))
+ stream = dict_obj.pop("stream", None)
+ if stream is not None:
+ dict_obj["Length"] = len(stream)
+ if dict_obj:
+ f.write(pdf_repr(dict_obj))
+ for obj in objs:
+ f.write(pdf_repr(obj))
+ if stream is not None:
+ f.write(b"stream\n")
+ f.write(stream)
+ f.write(b"\nendstream\n")
+ f.write(b"endobj\n")
+ return ref
+
+ def del_root(self):
+ if self.root_ref is None:
+ return
+ del self.xref_table[self.root_ref.object_id]
+ del self.xref_table[self.root[b"Pages"].object_id]
+
+ @staticmethod
+ def get_buf_from_file(f):
+ if hasattr(f, "getbuffer"):
+ return f.getbuffer()
+ elif hasattr(f, "getvalue"):
+ return f.getvalue()
+ else:
+ try:
+ return mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
+ except ValueError: # cannot mmap an empty file
+ return b""
+
+ def read_pdf_info(self):
+ self.file_size_total = len(self.buf)
+ self.file_size_this = self.file_size_total - self.start_offset
+ self.read_trailer()
+ self.root_ref = self.trailer_dict[b"Root"]
+ self.info_ref = self.trailer_dict.get(b"Info", None)
+ self.root = PdfDict(self.read_indirect(self.root_ref))
+ if self.info_ref is None:
+ self.info = PdfDict()
+ else:
+ self.info = PdfDict(self.read_indirect(self.info_ref))
+ check_format_condition(b"Type" in self.root, "/Type missing in Root")
+ check_format_condition(
+ self.root[b"Type"] == b"Catalog", "/Type in Root is not /Catalog"
+ )
+ check_format_condition(b"Pages" in self.root, "/Pages missing in Root")
+ check_format_condition(
+ isinstance(self.root[b"Pages"], IndirectReference),
+ "/Pages in Root is not an indirect reference",
+ )
+ self.pages_ref = self.root[b"Pages"]
+ self.page_tree_root = self.read_indirect(self.pages_ref)
+ self.pages = self.linearize_page_tree(self.page_tree_root)
+ # save the original list of page references
+ # in case the user modifies, adds or deletes some pages
+ # and we need to rewrite the pages and their list
+ self.orig_pages = self.pages[:]
+
+ def next_object_id(self, offset=None):
+ try:
+ # TODO: support reuse of deleted objects
+ reference = IndirectReference(max(self.xref_table.keys()) + 1, 0)
+ except ValueError:
+ reference = IndirectReference(1, 0)
+ if offset is not None:
+ self.xref_table[reference.object_id] = (offset, 0)
+ return reference
+
+ delimiter = br"[][()<>{}/%]"
+ delimiter_or_ws = br"[][()<>{}/%\000\011\012\014\015\040]"
+ whitespace = br"[\000\011\012\014\015\040]"
+ whitespace_or_hex = br"[\000\011\012\014\015\0400-9a-fA-F]"
+ whitespace_optional = whitespace + b"*"
+ whitespace_mandatory = whitespace + b"+"
+ whitespace_optional_no_nl = br"[\000\011\014\015\040]*" # no "\012" aka "\n"
+ newline_only = br"[\r\n]+"
+ newline = whitespace_optional_no_nl + newline_only + whitespace_optional_no_nl
+ re_trailer_end = re.compile(
+ whitespace_mandatory
+ + br"trailer"
+ + whitespace_optional
+ + br"\<\<(.*\>\>)"
+ + newline
+ + br"startxref"
+ + newline
+ + br"([0-9]+)"
+ + newline
+ + br"%%EOF"
+ + whitespace_optional
+ + br"$",
+ re.DOTALL,
+ )
+ re_trailer_prev = re.compile(
+ whitespace_optional
+ + br"trailer"
+ + whitespace_optional
+ + br"\<\<(.*?\>\>)"
+ + newline
+ + br"startxref"
+ + newline
+ + br"([0-9]+)"
+ + newline
+ + br"%%EOF"
+ + whitespace_optional,
+ re.DOTALL,
+ )
+
+ def read_trailer(self):
+ search_start_offset = len(self.buf) - 16384
+ if search_start_offset < self.start_offset:
+ search_start_offset = self.start_offset
+ m = self.re_trailer_end.search(self.buf, search_start_offset)
+ check_format_condition(m, "trailer end not found")
+ # make sure we found the LAST trailer
+ last_match = m
+ while m:
+ last_match = m
+ m = self.re_trailer_end.search(self.buf, m.start() + 16)
+ if not m:
+ m = last_match
+ trailer_data = m.group(1)
+ self.last_xref_section_offset = int(m.group(2))
+ self.trailer_dict = self.interpret_trailer(trailer_data)
+ self.xref_table = XrefTable()
+ self.read_xref_table(xref_section_offset=self.last_xref_section_offset)
+ if b"Prev" in self.trailer_dict:
+ self.read_prev_trailer(self.trailer_dict[b"Prev"])
+
+ def read_prev_trailer(self, xref_section_offset):
+ trailer_offset = self.read_xref_table(xref_section_offset=xref_section_offset)
+ m = self.re_trailer_prev.search(
+ self.buf[trailer_offset : trailer_offset + 16384]
+ )
+ check_format_condition(m, "previous trailer not found")
+ trailer_data = m.group(1)
+ check_format_condition(
+ int(m.group(2)) == xref_section_offset,
+ "xref section offset in previous trailer doesn't match what was expected",
+ )
+ trailer_dict = self.interpret_trailer(trailer_data)
+ if b"Prev" in trailer_dict:
+ self.read_prev_trailer(trailer_dict[b"Prev"])
+
+ re_whitespace_optional = re.compile(whitespace_optional)
+ re_name = re.compile(
+ whitespace_optional
+ + br"/([!-$&'*-.0-;=?-Z\\^-z|~]+)(?="
+ + delimiter_or_ws
+ + br")"
+ )
+ re_dict_start = re.compile(whitespace_optional + br"\<\<")
+ re_dict_end = re.compile(whitespace_optional + br"\>\>" + whitespace_optional)
+
+ @classmethod
+ def interpret_trailer(cls, trailer_data):
+ trailer = {}
+ offset = 0
+ while True:
+ m = cls.re_name.match(trailer_data, offset)
+ if not m:
+ m = cls.re_dict_end.match(trailer_data, offset)
+ check_format_condition(
+ m and m.end() == len(trailer_data),
+ "name not found in trailer, remaining data: "
+ + repr(trailer_data[offset:]),
+ )
+ break
+ key = cls.interpret_name(m.group(1))
+ value, offset = cls.get_value(trailer_data, m.end())
+ trailer[key] = value
+ check_format_condition(
+ b"Size" in trailer and isinstance(trailer[b"Size"], int),
+ "/Size not in trailer or not an integer",
+ )
+ check_format_condition(
+ b"Root" in trailer and isinstance(trailer[b"Root"], IndirectReference),
+ "/Root not in trailer or not an indirect reference",
+ )
+ return trailer
+
+ re_hashes_in_name = re.compile(br"([^#]*)(#([0-9a-fA-F]{2}))?")
+
+ @classmethod
+ def interpret_name(cls, raw, as_text=False):
+ name = b""
+ for m in cls.re_hashes_in_name.finditer(raw):
+ if m.group(3):
+ name += m.group(1) + bytearray.fromhex(m.group(3).decode("us-ascii"))
+ else:
+ name += m.group(1)
+ if as_text:
+ return name.decode("utf-8")
+ else:
+ return bytes(name)
+
+ re_null = re.compile(whitespace_optional + br"null(?=" + delimiter_or_ws + br")")
+ re_true = re.compile(whitespace_optional + br"true(?=" + delimiter_or_ws + br")")
+ re_false = re.compile(whitespace_optional + br"false(?=" + delimiter_or_ws + br")")
+ re_int = re.compile(
+ whitespace_optional + br"([-+]?[0-9]+)(?=" + delimiter_or_ws + br")"
+ )
+ re_real = re.compile(
+ whitespace_optional
+ + br"([-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+))(?="
+ + delimiter_or_ws
+ + br")"
+ )
+ re_array_start = re.compile(whitespace_optional + br"\[")
+ re_array_end = re.compile(whitespace_optional + br"]")
+ re_string_hex = re.compile(
+ whitespace_optional + br"\<(" + whitespace_or_hex + br"*)\>"
+ )
+ re_string_lit = re.compile(whitespace_optional + br"\(")
+ re_indirect_reference = re.compile(
+ whitespace_optional
+ + br"([-+]?[0-9]+)"
+ + whitespace_mandatory
+ + br"([-+]?[0-9]+)"
+ + whitespace_mandatory
+ + br"R(?="
+ + delimiter_or_ws
+ + br")"
+ )
+ re_indirect_def_start = re.compile(
+ whitespace_optional
+ + br"([-+]?[0-9]+)"
+ + whitespace_mandatory
+ + br"([-+]?[0-9]+)"
+ + whitespace_mandatory
+ + br"obj(?="
+ + delimiter_or_ws
+ + br")"
+ )
+ re_indirect_def_end = re.compile(
+ whitespace_optional + br"endobj(?=" + delimiter_or_ws + br")"
+ )
+ re_comment = re.compile(
+ br"(" + whitespace_optional + br"%[^\r\n]*" + newline + br")*"
+ )
+ re_stream_start = re.compile(whitespace_optional + br"stream\r?\n")
+ re_stream_end = re.compile(
+ whitespace_optional + br"endstream(?=" + delimiter_or_ws + br")"
+ )
+
+ @classmethod
+ def get_value(cls, data, offset, expect_indirect=None, max_nesting=-1):
+ if max_nesting == 0:
+ return None, None
+ m = cls.re_comment.match(data, offset)
+ if m:
+ offset = m.end()
+ m = cls.re_indirect_def_start.match(data, offset)
+ if m:
+ check_format_condition(
+ int(m.group(1)) > 0,
+ "indirect object definition: object ID must be greater than 0",
+ )
+ check_format_condition(
+ int(m.group(2)) >= 0,
+ "indirect object definition: generation must be non-negative",
+ )
+ check_format_condition(
+ expect_indirect is None
+ or expect_indirect
+ == IndirectReference(int(m.group(1)), int(m.group(2))),
+ "indirect object definition different than expected",
+ )
+ object, offset = cls.get_value(data, m.end(), max_nesting=max_nesting - 1)
+ if offset is None:
+ return object, None
+ m = cls.re_indirect_def_end.match(data, offset)
+ check_format_condition(m, "indirect object definition end not found")
+ return object, m.end()
+ check_format_condition(
+ not expect_indirect, "indirect object definition not found"
+ )
+ m = cls.re_indirect_reference.match(data, offset)
+ if m:
+ check_format_condition(
+ int(m.group(1)) > 0,
+ "indirect object reference: object ID must be greater than 0",
+ )
+ check_format_condition(
+ int(m.group(2)) >= 0,
+ "indirect object reference: generation must be non-negative",
+ )
+ return IndirectReference(int(m.group(1)), int(m.group(2))), m.end()
+ m = cls.re_dict_start.match(data, offset)
+ if m:
+ offset = m.end()
+ result = {}
+ m = cls.re_dict_end.match(data, offset)
+ while not m:
+ key, offset = cls.get_value(data, offset, max_nesting=max_nesting - 1)
+ if offset is None:
+ return result, None
+ value, offset = cls.get_value(data, offset, max_nesting=max_nesting - 1)
+ result[key] = value
+ if offset is None:
+ return result, None
+ m = cls.re_dict_end.match(data, offset)
+ offset = m.end()
+ m = cls.re_stream_start.match(data, offset)
+ if m:
+ try:
+ stream_len = int(result[b"Length"])
+ except (TypeError, KeyError, ValueError) as e:
+ raise PdfFormatError(
+ "bad or missing Length in stream dict (%r)"
+ % result.get(b"Length", None)
+ ) from e
+ stream_data = data[m.end() : m.end() + stream_len]
+ m = cls.re_stream_end.match(data, m.end() + stream_len)
+ check_format_condition(m, "stream end not found")
+ offset = m.end()
+ result = PdfStream(PdfDict(result), stream_data)
+ else:
+ result = PdfDict(result)
+ return result, offset
+ m = cls.re_array_start.match(data, offset)
+ if m:
+ offset = m.end()
+ result = []
+ m = cls.re_array_end.match(data, offset)
+ while not m:
+ value, offset = cls.get_value(data, offset, max_nesting=max_nesting - 1)
+ result.append(value)
+ if offset is None:
+ return result, None
+ m = cls.re_array_end.match(data, offset)
+ return result, m.end()
+ m = cls.re_null.match(data, offset)
+ if m:
+ return None, m.end()
+ m = cls.re_true.match(data, offset)
+ if m:
+ return True, m.end()
+ m = cls.re_false.match(data, offset)
+ if m:
+ return False, m.end()
+ m = cls.re_name.match(data, offset)
+ if m:
+ return PdfName(cls.interpret_name(m.group(1))), m.end()
+ m = cls.re_int.match(data, offset)
+ if m:
+ return int(m.group(1)), m.end()
+ m = cls.re_real.match(data, offset)
+ if m:
+ # XXX Decimal instead of float???
+ return float(m.group(1)), m.end()
+ m = cls.re_string_hex.match(data, offset)
+ if m:
+ # filter out whitespace
+ hex_string = bytearray(
+ [b for b in m.group(1) if b in b"0123456789abcdefABCDEF"]
+ )
+ if len(hex_string) % 2 == 1:
+ # append a 0 if the length is not even - yes, at the end
+ hex_string.append(ord(b"0"))
+ return bytearray.fromhex(hex_string.decode("us-ascii")), m.end()
+ m = cls.re_string_lit.match(data, offset)
+ if m:
+ return cls.get_literal_string(data, m.end())
+ # return None, offset # fallback (only for debugging)
+ raise PdfFormatError("unrecognized object: " + repr(data[offset : offset + 32]))
+
+ re_lit_str_token = re.compile(
+ br"(\\[nrtbf()\\])|(\\[0-9]{1,3})|(\\(\r\n|\r|\n))|(\r\n|\r|\n)|(\()|(\))"
+ )
+ escaped_chars = {
+ b"n": b"\n",
+ b"r": b"\r",
+ b"t": b"\t",
+ b"b": b"\b",
+ b"f": b"\f",
+ b"(": b"(",
+ b")": b")",
+ b"\\": b"\\",
+ ord(b"n"): b"\n",
+ ord(b"r"): b"\r",
+ ord(b"t"): b"\t",
+ ord(b"b"): b"\b",
+ ord(b"f"): b"\f",
+ ord(b"("): b"(",
+ ord(b")"): b")",
+ ord(b"\\"): b"\\",
+ }
+
+ @classmethod
+ def get_literal_string(cls, data, offset):
+ nesting_depth = 0
+ result = bytearray()
+ for m in cls.re_lit_str_token.finditer(data, offset):
+ result.extend(data[offset : m.start()])
+ if m.group(1):
+ result.extend(cls.escaped_chars[m.group(1)[1]])
+ elif m.group(2):
+ result.append(int(m.group(2)[1:], 8))
+ elif m.group(3):
+ pass
+ elif m.group(5):
+ result.extend(b"\n")
+ elif m.group(6):
+ result.extend(b"(")
+ nesting_depth += 1
+ elif m.group(7):
+ if nesting_depth == 0:
+ return bytes(result), m.end()
+ result.extend(b")")
+ nesting_depth -= 1
+ offset = m.end()
+ raise PdfFormatError("unfinished literal string")
+
+ re_xref_section_start = re.compile(whitespace_optional + br"xref" + newline)
+ re_xref_subsection_start = re.compile(
+ whitespace_optional
+ + br"([0-9]+)"
+ + whitespace_mandatory
+ + br"([0-9]+)"
+ + whitespace_optional
+ + newline_only
+ )
+ re_xref_entry = re.compile(br"([0-9]{10}) ([0-9]{5}) ([fn])( \r| \n|\r\n)")
+
+ def read_xref_table(self, xref_section_offset):
+ subsection_found = False
+ m = self.re_xref_section_start.match(
+ self.buf, xref_section_offset + self.start_offset
+ )
+ check_format_condition(m, "xref section start not found")
+ offset = m.end()
+ while True:
+ m = self.re_xref_subsection_start.match(self.buf, offset)
+ if not m:
+ check_format_condition(
+ subsection_found, "xref subsection start not found"
+ )
+ break
+ subsection_found = True
+ offset = m.end()
+ first_object = int(m.group(1))
+ num_objects = int(m.group(2))
+ for i in range(first_object, first_object + num_objects):
+ m = self.re_xref_entry.match(self.buf, offset)
+ check_format_condition(m, "xref entry not found")
+ offset = m.end()
+ is_free = m.group(3) == b"f"
+ generation = int(m.group(2))
+ if not is_free:
+ new_entry = (int(m.group(1)), generation)
+ check_format_condition(
+ i not in self.xref_table or self.xref_table[i] == new_entry,
+ "xref entry duplicated (and not identical)",
+ )
+ self.xref_table[i] = new_entry
+ return offset
+
+ def read_indirect(self, ref, max_nesting=-1):
+ offset, generation = self.xref_table[ref[0]]
+ check_format_condition(
+ generation == ref[1],
+ f"expected to find generation {ref[1]} for object ID {ref[0]} in xref "
+ f"table, instead found generation {generation} at offset {offset}",
+ )
+ value = self.get_value(
+ self.buf,
+ offset + self.start_offset,
+ expect_indirect=IndirectReference(*ref),
+ max_nesting=max_nesting,
+ )[0]
+ self.cached_objects[ref] = value
+ return value
+
+ def linearize_page_tree(self, node=None):
+ if node is None:
+ node = self.page_tree_root
+ check_format_condition(
+ node[b"Type"] == b"Pages", "/Type of page tree node is not /Pages"
+ )
+ pages = []
+ for kid in node[b"Kids"]:
+ kid_object = self.read_indirect(kid)
+ if kid_object[b"Type"] == b"Page":
+ pages.append(kid)
+ else:
+ pages.extend(self.linearize_page_tree(node=kid_object))
+ return pages
diff --git a/venv/Lib/site-packages/PIL/PixarImagePlugin.py b/venv/Lib/site-packages/PIL/PixarImagePlugin.py
new file mode 100644
index 0000000..c4860b6
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/PixarImagePlugin.py
@@ -0,0 +1,70 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# PIXAR raster support for PIL
+#
+# history:
+# 97-01-29 fl Created
+#
+# notes:
+# This is incomplete; it is based on a few samples created with
+# Photoshop 2.5 and 3.0, and a summary description provided by
+# Greg Coats . Hopefully, "L" and
+# "RGBA" support will be added in future versions.
+#
+# Copyright (c) Secret Labs AB 1997.
+# Copyright (c) Fredrik Lundh 1997.
+#
+# See the README file for information on usage and redistribution.
+#
+
+from . import Image, ImageFile
+from ._binary import i16le as i16
+
+#
+# helpers
+
+
+def _accept(prefix):
+ return prefix[:4] == b"\200\350\000\000"
+
+
+##
+# Image plugin for PIXAR raster images.
+
+
+class PixarImageFile(ImageFile.ImageFile):
+
+ format = "PIXAR"
+ format_description = "PIXAR raster image"
+
+ def _open(self):
+
+ # assuming a 4-byte magic label
+ s = self.fp.read(4)
+ if not _accept(s):
+ raise SyntaxError("not a PIXAR file")
+
+ # read rest of header
+ s = s + self.fp.read(508)
+
+ self._size = i16(s, 418), i16(s, 416)
+
+ # get channel/depth descriptions
+ mode = i16(s, 424), i16(s, 426)
+
+ if mode == (14, 2):
+ self.mode = "RGB"
+ # FIXME: to be continued...
+
+ # create tile descriptor (assuming "dumped")
+ self.tile = [("raw", (0, 0) + self.size, 1024, (self.mode, 0, 1))]
+
+
+#
+# --------------------------------------------------------------------
+
+Image.register_open(PixarImageFile.format, PixarImageFile, _accept)
+
+Image.register_extension(PixarImageFile.format, ".pxr")
diff --git a/venv/Lib/site-packages/PIL/PngImagePlugin.py b/venv/Lib/site-packages/PIL/PngImagePlugin.py
new file mode 100644
index 0000000..07bbc52
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/PngImagePlugin.py
@@ -0,0 +1,1393 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# PNG support code
+#
+# See "PNG (Portable Network Graphics) Specification, version 1.0;
+# W3C Recommendation", 1996-10-01, Thomas Boutell (ed.).
+#
+# history:
+# 1996-05-06 fl Created (couldn't resist it)
+# 1996-12-14 fl Upgraded, added read and verify support (0.2)
+# 1996-12-15 fl Separate PNG stream parser
+# 1996-12-29 fl Added write support, added getchunks
+# 1996-12-30 fl Eliminated circular references in decoder (0.3)
+# 1998-07-12 fl Read/write 16-bit images as mode I (0.4)
+# 2001-02-08 fl Added transparency support (from Zircon) (0.5)
+# 2001-04-16 fl Don't close data source in "open" method (0.6)
+# 2004-02-24 fl Don't even pretend to support interlaced files (0.7)
+# 2004-08-31 fl Do basic sanity check on chunk identifiers (0.8)
+# 2004-09-20 fl Added PngInfo chunk container
+# 2004-12-18 fl Added DPI read support (based on code by Niki Spahiev)
+# 2008-08-13 fl Added tRNS support for RGB images
+# 2009-03-06 fl Support for preserving ICC profiles (by Florian Hoech)
+# 2009-03-08 fl Added zTXT support (from Lowell Alleman)
+# 2009-03-29 fl Read interlaced PNG files (from Conrado Porto Lopes Gouvua)
+#
+# Copyright (c) 1997-2009 by Secret Labs AB
+# Copyright (c) 1996 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import itertools
+import logging
+import re
+import struct
+import warnings
+import zlib
+
+from . import Image, ImageChops, ImageFile, ImagePalette, ImageSequence
+from ._binary import i16be as i16
+from ._binary import i32be as i32
+from ._binary import o8
+from ._binary import o16be as o16
+from ._binary import o32be as o32
+
+logger = logging.getLogger(__name__)
+
+is_cid = re.compile(br"\w\w\w\w").match
+
+
+_MAGIC = b"\211PNG\r\n\032\n"
+
+
+_MODES = {
+ # supported bits/color combinations, and corresponding modes/rawmodes
+ # Greyscale
+ (1, 0): ("1", "1"),
+ (2, 0): ("L", "L;2"),
+ (4, 0): ("L", "L;4"),
+ (8, 0): ("L", "L"),
+ (16, 0): ("I", "I;16B"),
+ # Truecolour
+ (8, 2): ("RGB", "RGB"),
+ (16, 2): ("RGB", "RGB;16B"),
+ # Indexed-colour
+ (1, 3): ("P", "P;1"),
+ (2, 3): ("P", "P;2"),
+ (4, 3): ("P", "P;4"),
+ (8, 3): ("P", "P"),
+ # Greyscale with alpha
+ (8, 4): ("LA", "LA"),
+ (16, 4): ("RGBA", "LA;16B"), # LA;16B->LA not yet available
+ # Truecolour with alpha
+ (8, 6): ("RGBA", "RGBA"),
+ (16, 6): ("RGBA", "RGBA;16B"),
+}
+
+
+_simple_palette = re.compile(b"^\xff*\x00\xff*$")
+
+MAX_TEXT_CHUNK = ImageFile.SAFEBLOCK
+"""
+Maximum decompressed size for a iTXt or zTXt chunk.
+Eliminates decompression bombs where compressed chunks can expand 1000x.
+See :ref:`Text in PNG File Format`.
+"""
+MAX_TEXT_MEMORY = 64 * MAX_TEXT_CHUNK
+"""
+Set the maximum total text chunk size.
+See :ref:`Text in PNG File Format`.
+"""
+
+
+# APNG frame disposal modes
+APNG_DISPOSE_OP_NONE = 0
+"""
+No disposal is done on this frame before rendering the next frame.
+See :ref:`Saving APNG sequences`.
+"""
+APNG_DISPOSE_OP_BACKGROUND = 1
+"""
+This frame’s modified region is cleared to fully transparent black before rendering
+the next frame.
+See :ref:`Saving APNG sequences`.
+"""
+APNG_DISPOSE_OP_PREVIOUS = 2
+"""
+This frame’s modified region is reverted to the previous frame’s contents before
+rendering the next frame.
+See :ref:`Saving APNG sequences`.
+"""
+
+# APNG frame blend modes
+APNG_BLEND_OP_SOURCE = 0
+"""
+All color components of this frame, including alpha, overwrite the previous output
+image contents.
+See :ref:`Saving APNG sequences`.
+"""
+APNG_BLEND_OP_OVER = 1
+"""
+This frame should be alpha composited with the previous output image contents.
+See :ref:`Saving APNG sequences`.
+"""
+
+
+def _safe_zlib_decompress(s):
+ dobj = zlib.decompressobj()
+ plaintext = dobj.decompress(s, MAX_TEXT_CHUNK)
+ if dobj.unconsumed_tail:
+ raise ValueError("Decompressed Data Too Large")
+ return plaintext
+
+
+def _crc32(data, seed=0):
+ return zlib.crc32(data, seed) & 0xFFFFFFFF
+
+
+# --------------------------------------------------------------------
+# Support classes. Suitable for PNG and related formats like MNG etc.
+
+
+class ChunkStream:
+ def __init__(self, fp):
+
+ self.fp = fp
+ self.queue = []
+
+ def read(self):
+ """Fetch a new chunk. Returns header information."""
+ cid = None
+
+ if self.queue:
+ cid, pos, length = self.queue.pop()
+ self.fp.seek(pos)
+ else:
+ s = self.fp.read(8)
+ cid = s[4:]
+ pos = self.fp.tell()
+ length = i32(s)
+
+ if not is_cid(cid):
+ if not ImageFile.LOAD_TRUNCATED_IMAGES:
+ raise SyntaxError(f"broken PNG file (chunk {repr(cid)})")
+
+ return cid, pos, length
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *args):
+ self.close()
+
+ def close(self):
+ self.queue = self.crc = self.fp = None
+
+ def push(self, cid, pos, length):
+
+ self.queue.append((cid, pos, length))
+
+ def call(self, cid, pos, length):
+ """Call the appropriate chunk handler"""
+
+ logger.debug("STREAM %r %s %s", cid, pos, length)
+ return getattr(self, "chunk_" + cid.decode("ascii"))(pos, length)
+
+ def crc(self, cid, data):
+ """Read and verify checksum"""
+
+ # Skip CRC checks for ancillary chunks if allowed to load truncated
+ # images
+ # 5th byte of first char is 1 [specs, section 5.4]
+ if ImageFile.LOAD_TRUNCATED_IMAGES and (cid[0] >> 5 & 1):
+ self.crc_skip(cid, data)
+ return
+
+ try:
+ crc1 = _crc32(data, _crc32(cid))
+ crc2 = i32(self.fp.read(4))
+ if crc1 != crc2:
+ raise SyntaxError(
+ f"broken PNG file (bad header checksum in {repr(cid)})"
+ )
+ except struct.error as e:
+ raise SyntaxError(
+ f"broken PNG file (incomplete checksum in {repr(cid)})"
+ ) from e
+
+ def crc_skip(self, cid, data):
+ """Read checksum. Used if the C module is not present"""
+
+ self.fp.read(4)
+
+ def verify(self, endchunk=b"IEND"):
+
+ # Simple approach; just calculate checksum for all remaining
+ # blocks. Must be called directly after open.
+
+ cids = []
+
+ while True:
+ try:
+ cid, pos, length = self.read()
+ except struct.error as e:
+ raise OSError("truncated PNG file") from e
+
+ if cid == endchunk:
+ break
+ self.crc(cid, ImageFile._safe_read(self.fp, length))
+ cids.append(cid)
+
+ return cids
+
+
+class iTXt(str):
+ """
+ Subclass of string to allow iTXt chunks to look like strings while
+ keeping their extra information
+
+ """
+
+ @staticmethod
+ def __new__(cls, text, lang=None, tkey=None):
+ """
+ :param cls: the class to use when creating the instance
+ :param text: value for this key
+ :param lang: language code
+ :param tkey: UTF-8 version of the key name
+ """
+
+ self = str.__new__(cls, text)
+ self.lang = lang
+ self.tkey = tkey
+ return self
+
+
+class PngInfo:
+ """
+ PNG chunk container (for use with save(pnginfo=))
+
+ """
+
+ def __init__(self):
+ self.chunks = []
+
+ def add(self, cid, data, after_idat=False):
+ """Appends an arbitrary chunk. Use with caution.
+
+ :param cid: a byte string, 4 bytes long.
+ :param data: a byte string of the encoded data
+ :param after_idat: for use with private chunks. Whether the chunk
+ should be written after IDAT
+
+ """
+
+ chunk = [cid, data]
+ if after_idat:
+ chunk.append(True)
+ self.chunks.append(tuple(chunk))
+
+ def add_itxt(self, key, value, lang="", tkey="", zip=False):
+ """Appends an iTXt chunk.
+
+ :param key: latin-1 encodable text key name
+ :param value: value for this key
+ :param lang: language code
+ :param tkey: UTF-8 version of the key name
+ :param zip: compression flag
+
+ """
+
+ if not isinstance(key, bytes):
+ key = key.encode("latin-1", "strict")
+ if not isinstance(value, bytes):
+ value = value.encode("utf-8", "strict")
+ if not isinstance(lang, bytes):
+ lang = lang.encode("utf-8", "strict")
+ if not isinstance(tkey, bytes):
+ tkey = tkey.encode("utf-8", "strict")
+
+ if zip:
+ self.add(
+ b"iTXt",
+ key + b"\0\x01\0" + lang + b"\0" + tkey + b"\0" + zlib.compress(value),
+ )
+ else:
+ self.add(b"iTXt", key + b"\0\0\0" + lang + b"\0" + tkey + b"\0" + value)
+
+ def add_text(self, key, value, zip=False):
+ """Appends a text chunk.
+
+ :param key: latin-1 encodable text key name
+ :param value: value for this key, text or an
+ :py:class:`PIL.PngImagePlugin.iTXt` instance
+ :param zip: compression flag
+
+ """
+ if isinstance(value, iTXt):
+ return self.add_itxt(key, value, value.lang, value.tkey, zip=zip)
+
+ # The tEXt chunk stores latin-1 text
+ if not isinstance(value, bytes):
+ try:
+ value = value.encode("latin-1", "strict")
+ except UnicodeError:
+ return self.add_itxt(key, value, zip=zip)
+
+ if not isinstance(key, bytes):
+ key = key.encode("latin-1", "strict")
+
+ if zip:
+ self.add(b"zTXt", key + b"\0\0" + zlib.compress(value))
+ else:
+ self.add(b"tEXt", key + b"\0" + value)
+
+
+# --------------------------------------------------------------------
+# PNG image stream (IHDR/IEND)
+
+
+class PngStream(ChunkStream):
+ def __init__(self, fp):
+ super().__init__(fp)
+
+ # local copies of Image attributes
+ self.im_info = {}
+ self.im_text = {}
+ self.im_size = (0, 0)
+ self.im_mode = None
+ self.im_tile = None
+ self.im_palette = None
+ self.im_custom_mimetype = None
+ self.im_n_frames = None
+ self._seq_num = None
+ self.rewind_state = None
+
+ self.text_memory = 0
+
+ def check_text_memory(self, chunklen):
+ self.text_memory += chunklen
+ if self.text_memory > MAX_TEXT_MEMORY:
+ raise ValueError(
+ "Too much memory used in text chunks: "
+ f"{self.text_memory}>MAX_TEXT_MEMORY"
+ )
+
+ def save_rewind(self):
+ self.rewind_state = {
+ "info": self.im_info.copy(),
+ "tile": self.im_tile,
+ "seq_num": self._seq_num,
+ }
+
+ def rewind(self):
+ self.im_info = self.rewind_state["info"]
+ self.im_tile = self.rewind_state["tile"]
+ self._seq_num = self.rewind_state["seq_num"]
+
+ def chunk_iCCP(self, pos, length):
+
+ # ICC profile
+ s = ImageFile._safe_read(self.fp, length)
+ # according to PNG spec, the iCCP chunk contains:
+ # Profile name 1-79 bytes (character string)
+ # Null separator 1 byte (null character)
+ # Compression method 1 byte (0)
+ # Compressed profile n bytes (zlib with deflate compression)
+ i = s.find(b"\0")
+ logger.debug("iCCP profile name %r", s[:i])
+ logger.debug("Compression method %s", s[i])
+ comp_method = s[i]
+ if comp_method != 0:
+ raise SyntaxError(f"Unknown compression method {comp_method} in iCCP chunk")
+ try:
+ icc_profile = _safe_zlib_decompress(s[i + 2 :])
+ except ValueError:
+ if ImageFile.LOAD_TRUNCATED_IMAGES:
+ icc_profile = None
+ else:
+ raise
+ except zlib.error:
+ icc_profile = None # FIXME
+ self.im_info["icc_profile"] = icc_profile
+ return s
+
+ def chunk_IHDR(self, pos, length):
+
+ # image header
+ s = ImageFile._safe_read(self.fp, length)
+ self.im_size = i32(s, 0), i32(s, 4)
+ try:
+ self.im_mode, self.im_rawmode = _MODES[(s[8], s[9])]
+ except Exception:
+ pass
+ if s[12]:
+ self.im_info["interlace"] = 1
+ if s[11]:
+ raise SyntaxError("unknown filter category")
+ return s
+
+ def chunk_IDAT(self, pos, length):
+
+ # image data
+ if "bbox" in self.im_info:
+ tile = [("zip", self.im_info["bbox"], pos, self.im_rawmode)]
+ else:
+ if self.im_n_frames is not None:
+ self.im_info["default_image"] = True
+ tile = [("zip", (0, 0) + self.im_size, pos, self.im_rawmode)]
+ self.im_tile = tile
+ self.im_idat = length
+ raise EOFError
+
+ def chunk_IEND(self, pos, length):
+
+ # end of PNG image
+ raise EOFError
+
+ def chunk_PLTE(self, pos, length):
+
+ # palette
+ s = ImageFile._safe_read(self.fp, length)
+ if self.im_mode == "P":
+ self.im_palette = "RGB", s
+ return s
+
+ def chunk_tRNS(self, pos, length):
+
+ # transparency
+ s = ImageFile._safe_read(self.fp, length)
+ if self.im_mode == "P":
+ if _simple_palette.match(s):
+ # tRNS contains only one full-transparent entry,
+ # other entries are full opaque
+ i = s.find(b"\0")
+ if i >= 0:
+ self.im_info["transparency"] = i
+ else:
+ # otherwise, we have a byte string with one alpha value
+ # for each palette entry
+ self.im_info["transparency"] = s
+ elif self.im_mode in ("1", "L", "I"):
+ self.im_info["transparency"] = i16(s)
+ elif self.im_mode == "RGB":
+ self.im_info["transparency"] = i16(s), i16(s, 2), i16(s, 4)
+ return s
+
+ def chunk_gAMA(self, pos, length):
+ # gamma setting
+ s = ImageFile._safe_read(self.fp, length)
+ self.im_info["gamma"] = i32(s) / 100000.0
+ return s
+
+ def chunk_cHRM(self, pos, length):
+ # chromaticity, 8 unsigned ints, actual value is scaled by 100,000
+ # WP x,y, Red x,y, Green x,y Blue x,y
+
+ s = ImageFile._safe_read(self.fp, length)
+ raw_vals = struct.unpack(">%dI" % (len(s) // 4), s)
+ self.im_info["chromaticity"] = tuple(elt / 100000.0 for elt in raw_vals)
+ return s
+
+ def chunk_sRGB(self, pos, length):
+ # srgb rendering intent, 1 byte
+ # 0 perceptual
+ # 1 relative colorimetric
+ # 2 saturation
+ # 3 absolute colorimetric
+
+ s = ImageFile._safe_read(self.fp, length)
+ self.im_info["srgb"] = s[0]
+ return s
+
+ def chunk_pHYs(self, pos, length):
+
+ # pixels per unit
+ s = ImageFile._safe_read(self.fp, length)
+ px, py = i32(s, 0), i32(s, 4)
+ unit = s[8]
+ if unit == 1: # meter
+ dpi = int(px * 0.0254 + 0.5), int(py * 0.0254 + 0.5)
+ self.im_info["dpi"] = dpi
+ elif unit == 0:
+ self.im_info["aspect"] = px, py
+ return s
+
+ def chunk_tEXt(self, pos, length):
+
+ # text
+ s = ImageFile._safe_read(self.fp, length)
+ try:
+ k, v = s.split(b"\0", 1)
+ except ValueError:
+ # fallback for broken tEXt tags
+ k = s
+ v = b""
+ if k:
+ k = k.decode("latin-1", "strict")
+ v_str = v.decode("latin-1", "replace")
+
+ self.im_info[k] = v if k == "exif" else v_str
+ self.im_text[k] = v_str
+ self.check_text_memory(len(v_str))
+
+ return s
+
+ def chunk_zTXt(self, pos, length):
+
+ # compressed text
+ s = ImageFile._safe_read(self.fp, length)
+ try:
+ k, v = s.split(b"\0", 1)
+ except ValueError:
+ k = s
+ v = b""
+ if v:
+ comp_method = v[0]
+ else:
+ comp_method = 0
+ if comp_method != 0:
+ raise SyntaxError(f"Unknown compression method {comp_method} in zTXt chunk")
+ try:
+ v = _safe_zlib_decompress(v[1:])
+ except ValueError:
+ if ImageFile.LOAD_TRUNCATED_IMAGES:
+ v = b""
+ else:
+ raise
+ except zlib.error:
+ v = b""
+
+ if k:
+ k = k.decode("latin-1", "strict")
+ v = v.decode("latin-1", "replace")
+
+ self.im_info[k] = self.im_text[k] = v
+ self.check_text_memory(len(v))
+
+ return s
+
+ def chunk_iTXt(self, pos, length):
+
+ # international text
+ r = s = ImageFile._safe_read(self.fp, length)
+ try:
+ k, r = r.split(b"\0", 1)
+ except ValueError:
+ return s
+ if len(r) < 2:
+ return s
+ cf, cm, r = r[0], r[1], r[2:]
+ try:
+ lang, tk, v = r.split(b"\0", 2)
+ except ValueError:
+ return s
+ if cf != 0:
+ if cm == 0:
+ try:
+ v = _safe_zlib_decompress(v)
+ except ValueError:
+ if ImageFile.LOAD_TRUNCATED_IMAGES:
+ return s
+ else:
+ raise
+ except zlib.error:
+ return s
+ else:
+ return s
+ try:
+ k = k.decode("latin-1", "strict")
+ lang = lang.decode("utf-8", "strict")
+ tk = tk.decode("utf-8", "strict")
+ v = v.decode("utf-8", "strict")
+ except UnicodeError:
+ return s
+
+ self.im_info[k] = self.im_text[k] = iTXt(v, lang, tk)
+ self.check_text_memory(len(v))
+
+ return s
+
+ def chunk_eXIf(self, pos, length):
+ s = ImageFile._safe_read(self.fp, length)
+ self.im_info["exif"] = b"Exif\x00\x00" + s
+ return s
+
+ # APNG chunks
+ def chunk_acTL(self, pos, length):
+ s = ImageFile._safe_read(self.fp, length)
+ if self.im_n_frames is not None:
+ self.im_n_frames = None
+ warnings.warn("Invalid APNG, will use default PNG image if possible")
+ return s
+ n_frames = i32(s)
+ if n_frames == 0 or n_frames > 0x80000000:
+ warnings.warn("Invalid APNG, will use default PNG image if possible")
+ return s
+ self.im_n_frames = n_frames
+ self.im_info["loop"] = i32(s, 4)
+ self.im_custom_mimetype = "image/apng"
+ return s
+
+ def chunk_fcTL(self, pos, length):
+ s = ImageFile._safe_read(self.fp, length)
+ seq = i32(s)
+ if (self._seq_num is None and seq != 0) or (
+ self._seq_num is not None and self._seq_num != seq - 1
+ ):
+ raise SyntaxError("APNG contains frame sequence errors")
+ self._seq_num = seq
+ width, height = i32(s, 4), i32(s, 8)
+ px, py = i32(s, 12), i32(s, 16)
+ im_w, im_h = self.im_size
+ if px + width > im_w or py + height > im_h:
+ raise SyntaxError("APNG contains invalid frames")
+ self.im_info["bbox"] = (px, py, px + width, py + height)
+ delay_num, delay_den = i16(s, 20), i16(s, 22)
+ if delay_den == 0:
+ delay_den = 100
+ self.im_info["duration"] = float(delay_num) / float(delay_den) * 1000
+ self.im_info["disposal"] = s[24]
+ self.im_info["blend"] = s[25]
+ return s
+
+ def chunk_fdAT(self, pos, length):
+ s = ImageFile._safe_read(self.fp, 4)
+ seq = i32(s)
+ if self._seq_num != seq - 1:
+ raise SyntaxError("APNG contains frame sequence errors")
+ self._seq_num = seq
+ return self.chunk_IDAT(pos + 4, length - 4)
+
+
+# --------------------------------------------------------------------
+# PNG reader
+
+
+def _accept(prefix):
+ return prefix[:8] == _MAGIC
+
+
+##
+# Image plugin for PNG images.
+
+
+class PngImageFile(ImageFile.ImageFile):
+
+ format = "PNG"
+ format_description = "Portable network graphics"
+
+ def _open(self):
+
+ if not _accept(self.fp.read(8)):
+ raise SyntaxError("not a PNG file")
+ self.__fp = self.fp
+ self.__frame = 0
+
+ #
+ # Parse headers up to the first IDAT or fDAT chunk
+
+ self.private_chunks = []
+ self.png = PngStream(self.fp)
+
+ while True:
+
+ #
+ # get next chunk
+
+ cid, pos, length = self.png.read()
+
+ try:
+ s = self.png.call(cid, pos, length)
+ except EOFError:
+ break
+ except AttributeError:
+ logger.debug("%r %s %s (unknown)", cid, pos, length)
+ s = ImageFile._safe_read(self.fp, length)
+ if cid[1:2].islower():
+ self.private_chunks.append((cid, s))
+
+ self.png.crc(cid, s)
+
+ #
+ # Copy relevant attributes from the PngStream. An alternative
+ # would be to let the PngStream class modify these attributes
+ # directly, but that introduces circular references which are
+ # difficult to break if things go wrong in the decoder...
+ # (believe me, I've tried ;-)
+
+ self.mode = self.png.im_mode
+ self._size = self.png.im_size
+ self.info = self.png.im_info
+ self._text = None
+ self.tile = self.png.im_tile
+ self.custom_mimetype = self.png.im_custom_mimetype
+ self.n_frames = self.png.im_n_frames or 1
+ self.default_image = self.info.get("default_image", False)
+
+ if self.png.im_palette:
+ rawmode, data = self.png.im_palette
+ self.palette = ImagePalette.raw(rawmode, data)
+
+ if cid == b"fdAT":
+ self.__prepare_idat = length - 4
+ else:
+ self.__prepare_idat = length # used by load_prepare()
+
+ if self.png.im_n_frames is not None:
+ self._close_exclusive_fp_after_loading = False
+ self.png.save_rewind()
+ self.__rewind_idat = self.__prepare_idat
+ self.__rewind = self.__fp.tell()
+ if self.default_image:
+ # IDAT chunk contains default image and not first animation frame
+ self.n_frames += 1
+ self._seek(0)
+ self.is_animated = self.n_frames > 1
+
+ @property
+ def text(self):
+ # experimental
+ if self._text is None:
+ # iTxt, tEXt and zTXt chunks may appear at the end of the file
+ # So load the file to ensure that they are read
+ if self.is_animated:
+ frame = self.__frame
+ # for APNG, seek to the final frame before loading
+ self.seek(self.n_frames - 1)
+ self.load()
+ if self.is_animated:
+ self.seek(frame)
+ return self._text
+
+ def verify(self):
+ """Verify PNG file"""
+
+ if self.fp is None:
+ raise RuntimeError("verify must be called directly after open")
+
+ # back up to beginning of IDAT block
+ self.fp.seek(self.tile[0][2] - 8)
+
+ self.png.verify()
+ self.png.close()
+
+ if self._exclusive_fp:
+ self.fp.close()
+ self.fp = None
+
+ def seek(self, frame):
+ if not self._seek_check(frame):
+ return
+ if frame < self.__frame:
+ self._seek(0, True)
+
+ last_frame = self.__frame
+ for f in range(self.__frame + 1, frame + 1):
+ try:
+ self._seek(f)
+ except EOFError as e:
+ self.seek(last_frame)
+ raise EOFError("no more images in APNG file") from e
+
+ def _seek(self, frame, rewind=False):
+ if frame == 0:
+ if rewind:
+ self.__fp.seek(self.__rewind)
+ self.png.rewind()
+ self.__prepare_idat = self.__rewind_idat
+ self.im = None
+ if self.pyaccess:
+ self.pyaccess = None
+ self.info = self.png.im_info
+ self.tile = self.png.im_tile
+ self.fp = self.__fp
+ self._prev_im = None
+ self.dispose = None
+ self.default_image = self.info.get("default_image", False)
+ self.dispose_op = self.info.get("disposal")
+ self.blend_op = self.info.get("blend")
+ self.dispose_extent = self.info.get("bbox")
+ self.__frame = 0
+ else:
+ if frame != self.__frame + 1:
+ raise ValueError(f"cannot seek to frame {frame}")
+
+ # ensure previous frame was loaded
+ self.load()
+
+ if self.dispose:
+ self.im.paste(self.dispose, self.dispose_extent)
+ self._prev_im = self.im.copy()
+
+ self.fp = self.__fp
+
+ # advance to the next frame
+ if self.__prepare_idat:
+ ImageFile._safe_read(self.fp, self.__prepare_idat)
+ self.__prepare_idat = 0
+ frame_start = False
+ while True:
+ self.fp.read(4) # CRC
+
+ try:
+ cid, pos, length = self.png.read()
+ except (struct.error, SyntaxError):
+ break
+
+ if cid == b"IEND":
+ raise EOFError("No more images in APNG file")
+ if cid == b"fcTL":
+ if frame_start:
+ # there must be at least one fdAT chunk between fcTL chunks
+ raise SyntaxError("APNG missing frame data")
+ frame_start = True
+
+ try:
+ self.png.call(cid, pos, length)
+ except UnicodeDecodeError:
+ break
+ except EOFError:
+ if cid == b"fdAT":
+ length -= 4
+ if frame_start:
+ self.__prepare_idat = length
+ break
+ ImageFile._safe_read(self.fp, length)
+ except AttributeError:
+ logger.debug("%r %s %s (unknown)", cid, pos, length)
+ ImageFile._safe_read(self.fp, length)
+
+ self.__frame = frame
+ self.tile = self.png.im_tile
+ self.dispose_op = self.info.get("disposal")
+ self.blend_op = self.info.get("blend")
+ self.dispose_extent = self.info.get("bbox")
+
+ if not self.tile:
+ raise EOFError
+
+ # setup frame disposal (actual disposal done when needed in the next _seek())
+ if self._prev_im is None and self.dispose_op == APNG_DISPOSE_OP_PREVIOUS:
+ self.dispose_op = APNG_DISPOSE_OP_BACKGROUND
+
+ if self.dispose_op == APNG_DISPOSE_OP_PREVIOUS:
+ self.dispose = self._prev_im.copy()
+ self.dispose = self._crop(self.dispose, self.dispose_extent)
+ elif self.dispose_op == APNG_DISPOSE_OP_BACKGROUND:
+ self.dispose = Image.core.fill(self.mode, self.size)
+ self.dispose = self._crop(self.dispose, self.dispose_extent)
+ else:
+ self.dispose = None
+
+ def tell(self):
+ return self.__frame
+
+ def load_prepare(self):
+ """internal: prepare to read PNG file"""
+
+ if self.info.get("interlace"):
+ self.decoderconfig = self.decoderconfig + (1,)
+
+ self.__idat = self.__prepare_idat # used by load_read()
+ ImageFile.ImageFile.load_prepare(self)
+
+ def load_read(self, read_bytes):
+ """internal: read more image data"""
+
+ while self.__idat == 0:
+ # end of chunk, skip forward to next one
+
+ self.fp.read(4) # CRC
+
+ cid, pos, length = self.png.read()
+
+ if cid not in [b"IDAT", b"DDAT", b"fdAT"]:
+ self.png.push(cid, pos, length)
+ return b""
+
+ if cid == b"fdAT":
+ try:
+ self.png.call(cid, pos, length)
+ except EOFError:
+ pass
+ self.__idat = length - 4 # sequence_num has already been read
+ else:
+ self.__idat = length # empty chunks are allowed
+
+ # read more data from this chunk
+ if read_bytes <= 0:
+ read_bytes = self.__idat
+ else:
+ read_bytes = min(read_bytes, self.__idat)
+
+ self.__idat = self.__idat - read_bytes
+
+ return self.fp.read(read_bytes)
+
+ def load_end(self):
+ """internal: finished reading image data"""
+ while True:
+ self.fp.read(4) # CRC
+
+ try:
+ cid, pos, length = self.png.read()
+ except (struct.error, SyntaxError):
+ break
+
+ if cid == b"IEND":
+ break
+ elif cid == b"fcTL" and self.is_animated:
+ # start of the next frame, stop reading
+ self.__prepare_idat = 0
+ self.png.push(cid, pos, length)
+ break
+
+ try:
+ self.png.call(cid, pos, length)
+ except UnicodeDecodeError:
+ break
+ except EOFError:
+ if cid == b"fdAT":
+ length -= 4
+ ImageFile._safe_read(self.fp, length)
+ except AttributeError:
+ logger.debug("%r %s %s (unknown)", cid, pos, length)
+ s = ImageFile._safe_read(self.fp, length)
+ if cid[1:2].islower():
+ self.private_chunks.append((cid, s, True))
+ self._text = self.png.im_text
+ if not self.is_animated:
+ self.png.close()
+ self.png = None
+ else:
+ if self._prev_im and self.blend_op == APNG_BLEND_OP_OVER:
+ updated = self._crop(self.im, self.dispose_extent)
+ self._prev_im.paste(
+ updated, self.dispose_extent, updated.convert("RGBA")
+ )
+ self.im = self._prev_im
+ if self.pyaccess:
+ self.pyaccess = None
+
+ def _getexif(self):
+ if "exif" not in self.info:
+ self.load()
+ if "exif" not in self.info and "Raw profile type exif" not in self.info:
+ return None
+ return self.getexif()._get_merged_dict()
+
+ def getexif(self):
+ if "exif" not in self.info:
+ self.load()
+
+ return super().getexif()
+
+ def _close__fp(self):
+ try:
+ if self.__fp != self.fp:
+ self.__fp.close()
+ except AttributeError:
+ pass
+ finally:
+ self.__fp = None
+
+
+# --------------------------------------------------------------------
+# PNG writer
+
+_OUTMODES = {
+ # supported PIL modes, and corresponding rawmodes/bits/color combinations
+ "1": ("1", b"\x01\x00"),
+ "L;1": ("L;1", b"\x01\x00"),
+ "L;2": ("L;2", b"\x02\x00"),
+ "L;4": ("L;4", b"\x04\x00"),
+ "L": ("L", b"\x08\x00"),
+ "LA": ("LA", b"\x08\x04"),
+ "I": ("I;16B", b"\x10\x00"),
+ "I;16": ("I;16B", b"\x10\x00"),
+ "P;1": ("P;1", b"\x01\x03"),
+ "P;2": ("P;2", b"\x02\x03"),
+ "P;4": ("P;4", b"\x04\x03"),
+ "P": ("P", b"\x08\x03"),
+ "RGB": ("RGB", b"\x08\x02"),
+ "RGBA": ("RGBA", b"\x08\x06"),
+}
+
+
+def putchunk(fp, cid, *data):
+ """Write a PNG chunk (including CRC field)"""
+
+ data = b"".join(data)
+
+ fp.write(o32(len(data)) + cid)
+ fp.write(data)
+ crc = _crc32(data, _crc32(cid))
+ fp.write(o32(crc))
+
+
+class _idat:
+ # wrap output from the encoder in IDAT chunks
+
+ def __init__(self, fp, chunk):
+ self.fp = fp
+ self.chunk = chunk
+
+ def write(self, data):
+ self.chunk(self.fp, b"IDAT", data)
+
+
+class _fdat:
+ # wrap encoder output in fdAT chunks
+
+ def __init__(self, fp, chunk, seq_num):
+ self.fp = fp
+ self.chunk = chunk
+ self.seq_num = seq_num
+
+ def write(self, data):
+ self.chunk(self.fp, b"fdAT", o32(self.seq_num), data)
+ self.seq_num += 1
+
+
+def _write_multiple_frames(im, fp, chunk, rawmode):
+ default_image = im.encoderinfo.get("default_image", im.info.get("default_image"))
+ duration = im.encoderinfo.get("duration", im.info.get("duration", 0))
+ loop = im.encoderinfo.get("loop", im.info.get("loop", 0))
+ disposal = im.encoderinfo.get("disposal", im.info.get("disposal"))
+ blend = im.encoderinfo.get("blend", im.info.get("blend"))
+
+ if default_image:
+ chain = itertools.chain(im.encoderinfo.get("append_images", []))
+ else:
+ chain = itertools.chain([im], im.encoderinfo.get("append_images", []))
+
+ im_frames = []
+ frame_count = 0
+ for im_seq in chain:
+ for im_frame in ImageSequence.Iterator(im_seq):
+ im_frame = im_frame.copy()
+ if im_frame.mode != im.mode:
+ if im.mode == "P":
+ im_frame = im_frame.convert(im.mode, palette=im.palette)
+ else:
+ im_frame = im_frame.convert(im.mode)
+ encoderinfo = im.encoderinfo.copy()
+ if isinstance(duration, (list, tuple)):
+ encoderinfo["duration"] = duration[frame_count]
+ if isinstance(disposal, (list, tuple)):
+ encoderinfo["disposal"] = disposal[frame_count]
+ if isinstance(blend, (list, tuple)):
+ encoderinfo["blend"] = blend[frame_count]
+ frame_count += 1
+
+ if im_frames:
+ previous = im_frames[-1]
+ prev_disposal = previous["encoderinfo"].get("disposal")
+ prev_blend = previous["encoderinfo"].get("blend")
+ if prev_disposal == APNG_DISPOSE_OP_PREVIOUS and len(im_frames) < 2:
+ prev_disposal = APNG_DISPOSE_OP_BACKGROUND
+
+ if prev_disposal == APNG_DISPOSE_OP_BACKGROUND:
+ base_im = previous["im"]
+ dispose = Image.core.fill("RGBA", im.size, (0, 0, 0, 0))
+ bbox = previous["bbox"]
+ if bbox:
+ dispose = dispose.crop(bbox)
+ else:
+ bbox = (0, 0) + im.size
+ base_im.paste(dispose, bbox)
+ elif prev_disposal == APNG_DISPOSE_OP_PREVIOUS:
+ base_im = im_frames[-2]["im"]
+ else:
+ base_im = previous["im"]
+ delta = ImageChops.subtract_modulo(
+ im_frame.convert("RGB"), base_im.convert("RGB")
+ )
+ bbox = delta.getbbox()
+ if (
+ not bbox
+ and prev_disposal == encoderinfo.get("disposal")
+ and prev_blend == encoderinfo.get("blend")
+ ):
+ duration = encoderinfo.get("duration", 0)
+ if duration:
+ if "duration" in previous["encoderinfo"]:
+ previous["encoderinfo"]["duration"] += duration
+ else:
+ previous["encoderinfo"]["duration"] = duration
+ continue
+ else:
+ bbox = None
+ im_frames.append({"im": im_frame, "bbox": bbox, "encoderinfo": encoderinfo})
+
+ # animation control
+ chunk(
+ fp,
+ b"acTL",
+ o32(len(im_frames)), # 0: num_frames
+ o32(loop), # 4: num_plays
+ )
+
+ # default image IDAT (if it exists)
+ if default_image:
+ ImageFile._save(im, _idat(fp, chunk), [("zip", (0, 0) + im.size, 0, rawmode)])
+
+ seq_num = 0
+ for frame, frame_data in enumerate(im_frames):
+ im_frame = frame_data["im"]
+ if not frame_data["bbox"]:
+ bbox = (0, 0) + im_frame.size
+ else:
+ bbox = frame_data["bbox"]
+ im_frame = im_frame.crop(bbox)
+ size = im_frame.size
+ duration = int(round(frame_data["encoderinfo"].get("duration", 0)))
+ disposal = frame_data["encoderinfo"].get("disposal", APNG_DISPOSE_OP_NONE)
+ blend = frame_data["encoderinfo"].get("blend", APNG_BLEND_OP_SOURCE)
+ # frame control
+ chunk(
+ fp,
+ b"fcTL",
+ o32(seq_num), # sequence_number
+ o32(size[0]), # width
+ o32(size[1]), # height
+ o32(bbox[0]), # x_offset
+ o32(bbox[1]), # y_offset
+ o16(duration), # delay_numerator
+ o16(1000), # delay_denominator
+ o8(disposal), # dispose_op
+ o8(blend), # blend_op
+ )
+ seq_num += 1
+ # frame data
+ if frame == 0 and not default_image:
+ # first frame must be in IDAT chunks for backwards compatibility
+ ImageFile._save(
+ im_frame,
+ _idat(fp, chunk),
+ [("zip", (0, 0) + im_frame.size, 0, rawmode)],
+ )
+ else:
+ fdat_chunks = _fdat(fp, chunk, seq_num)
+ ImageFile._save(
+ im_frame,
+ fdat_chunks,
+ [("zip", (0, 0) + im_frame.size, 0, rawmode)],
+ )
+ seq_num = fdat_chunks.seq_num
+
+
+def _save_all(im, fp, filename):
+ _save(im, fp, filename, save_all=True)
+
+
+def _save(im, fp, filename, chunk=putchunk, save_all=False):
+ # save an image to disk (called by the save method)
+
+ mode = im.mode
+
+ if mode == "P":
+
+ #
+ # attempt to minimize storage requirements for palette images
+ if "bits" in im.encoderinfo:
+ # number of bits specified by user
+ colors = min(1 << im.encoderinfo["bits"], 256)
+ else:
+ # check palette contents
+ if im.palette:
+ colors = max(min(len(im.palette.getdata()[1]) // 3, 256), 1)
+ else:
+ colors = 256
+
+ if colors <= 16:
+ if colors <= 2:
+ bits = 1
+ elif colors <= 4:
+ bits = 2
+ else:
+ bits = 4
+ mode = f"{mode};{bits}"
+
+ # encoder options
+ im.encoderconfig = (
+ im.encoderinfo.get("optimize", False),
+ im.encoderinfo.get("compress_level", -1),
+ im.encoderinfo.get("compress_type", -1),
+ im.encoderinfo.get("dictionary", b""),
+ )
+
+ # get the corresponding PNG mode
+ try:
+ rawmode, mode = _OUTMODES[mode]
+ except KeyError as e:
+ raise OSError(f"cannot write mode {mode} as PNG") from e
+
+ #
+ # write minimal PNG file
+
+ fp.write(_MAGIC)
+
+ chunk(
+ fp,
+ b"IHDR",
+ o32(im.size[0]), # 0: size
+ o32(im.size[1]),
+ mode, # 8: depth/type
+ b"\0", # 10: compression
+ b"\0", # 11: filter category
+ b"\0", # 12: interlace flag
+ )
+
+ chunks = [b"cHRM", b"gAMA", b"sBIT", b"sRGB", b"tIME"]
+
+ icc = im.encoderinfo.get("icc_profile", im.info.get("icc_profile"))
+ if icc:
+ # ICC profile
+ # according to PNG spec, the iCCP chunk contains:
+ # Profile name 1-79 bytes (character string)
+ # Null separator 1 byte (null character)
+ # Compression method 1 byte (0)
+ # Compressed profile n bytes (zlib with deflate compression)
+ name = b"ICC Profile"
+ data = name + b"\0\0" + zlib.compress(icc)
+ chunk(fp, b"iCCP", data)
+
+ # You must either have sRGB or iCCP.
+ # Disallow sRGB chunks when an iCCP-chunk has been emitted.
+ chunks.remove(b"sRGB")
+
+ info = im.encoderinfo.get("pnginfo")
+ if info:
+ chunks_multiple_allowed = [b"sPLT", b"iTXt", b"tEXt", b"zTXt"]
+ for info_chunk in info.chunks:
+ cid, data = info_chunk[:2]
+ if cid in chunks:
+ chunks.remove(cid)
+ chunk(fp, cid, data)
+ elif cid in chunks_multiple_allowed:
+ chunk(fp, cid, data)
+ elif cid[1:2].islower():
+ # Private chunk
+ after_idat = info_chunk[2:3]
+ if not after_idat:
+ chunk(fp, cid, data)
+
+ if im.mode == "P":
+ palette_byte_number = colors * 3
+ palette_bytes = im.im.getpalette("RGB")[:palette_byte_number]
+ while len(palette_bytes) < palette_byte_number:
+ palette_bytes += b"\0"
+ chunk(fp, b"PLTE", palette_bytes)
+
+ transparency = im.encoderinfo.get("transparency", im.info.get("transparency", None))
+
+ if transparency or transparency == 0:
+ if im.mode == "P":
+ # limit to actual palette size
+ alpha_bytes = colors
+ if isinstance(transparency, bytes):
+ chunk(fp, b"tRNS", transparency[:alpha_bytes])
+ else:
+ transparency = max(0, min(255, transparency))
+ alpha = b"\xFF" * transparency + b"\0"
+ chunk(fp, b"tRNS", alpha[:alpha_bytes])
+ elif im.mode in ("1", "L", "I"):
+ transparency = max(0, min(65535, transparency))
+ chunk(fp, b"tRNS", o16(transparency))
+ elif im.mode == "RGB":
+ red, green, blue = transparency
+ chunk(fp, b"tRNS", o16(red) + o16(green) + o16(blue))
+ else:
+ if "transparency" in im.encoderinfo:
+ # don't bother with transparency if it's an RGBA
+ # and it's in the info dict. It's probably just stale.
+ raise OSError("cannot use transparency for this mode")
+ else:
+ if im.mode == "P" and im.im.getpalettemode() == "RGBA":
+ alpha = im.im.getpalette("RGBA", "A")
+ alpha_bytes = colors
+ chunk(fp, b"tRNS", alpha[:alpha_bytes])
+
+ dpi = im.encoderinfo.get("dpi")
+ if dpi:
+ chunk(
+ fp,
+ b"pHYs",
+ o32(int(dpi[0] / 0.0254 + 0.5)),
+ o32(int(dpi[1] / 0.0254 + 0.5)),
+ b"\x01",
+ )
+
+ if info:
+ chunks = [b"bKGD", b"hIST"]
+ for info_chunk in info.chunks:
+ cid, data = info_chunk[:2]
+ if cid in chunks:
+ chunks.remove(cid)
+ chunk(fp, cid, data)
+
+ exif = im.encoderinfo.get("exif", im.info.get("exif"))
+ if exif:
+ if isinstance(exif, Image.Exif):
+ exif = exif.tobytes(8)
+ if exif.startswith(b"Exif\x00\x00"):
+ exif = exif[6:]
+ chunk(fp, b"eXIf", exif)
+
+ if save_all:
+ _write_multiple_frames(im, fp, chunk, rawmode)
+ else:
+ ImageFile._save(im, _idat(fp, chunk), [("zip", (0, 0) + im.size, 0, rawmode)])
+
+ if info:
+ for info_chunk in info.chunks:
+ cid, data = info_chunk[:2]
+ if cid[1:2].islower():
+ # Private chunk
+ after_idat = info_chunk[2:3]
+ if after_idat:
+ chunk(fp, cid, data)
+
+ chunk(fp, b"IEND", b"")
+
+ if hasattr(fp, "flush"):
+ fp.flush()
+
+
+# --------------------------------------------------------------------
+# PNG chunk converter
+
+
+def getchunks(im, **params):
+ """Return a list of PNG chunks representing this image."""
+
+ class collector:
+ data = []
+
+ def write(self, data):
+ pass
+
+ def append(self, chunk):
+ self.data.append(chunk)
+
+ def append(fp, cid, *data):
+ data = b"".join(data)
+ crc = o32(_crc32(data, _crc32(cid)))
+ fp.append((cid, data, crc))
+
+ fp = collector()
+
+ try:
+ im.encoderinfo = params
+ _save(im, fp, None, append)
+ finally:
+ del im.encoderinfo
+
+ return fp.data
+
+
+# --------------------------------------------------------------------
+# Registry
+
+Image.register_open(PngImageFile.format, PngImageFile, _accept)
+Image.register_save(PngImageFile.format, _save)
+Image.register_save_all(PngImageFile.format, _save_all)
+
+Image.register_extensions(PngImageFile.format, [".png", ".apng"])
+
+Image.register_mime(PngImageFile.format, "image/png")
diff --git a/venv/Lib/site-packages/PIL/PpmImagePlugin.py b/venv/Lib/site-packages/PIL/PpmImagePlugin.py
new file mode 100644
index 0000000..abf4d65
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/PpmImagePlugin.py
@@ -0,0 +1,164 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# PPM support for PIL
+#
+# History:
+# 96-03-24 fl Created
+# 98-03-06 fl Write RGBA images (as RGB, that is)
+#
+# Copyright (c) Secret Labs AB 1997-98.
+# Copyright (c) Fredrik Lundh 1996.
+#
+# See the README file for information on usage and redistribution.
+#
+
+
+from . import Image, ImageFile
+
+#
+# --------------------------------------------------------------------
+
+b_whitespace = b"\x20\x09\x0a\x0b\x0c\x0d"
+
+MODES = {
+ # standard
+ b"P4": "1",
+ b"P5": "L",
+ b"P6": "RGB",
+ # extensions
+ b"P0CMYK": "CMYK",
+ # PIL extensions (for test purposes only)
+ b"PyP": "P",
+ b"PyRGBA": "RGBA",
+ b"PyCMYK": "CMYK",
+}
+
+
+def _accept(prefix):
+ return prefix[0:1] == b"P" and prefix[1] in b"0456y"
+
+
+##
+# Image plugin for PBM, PGM, and PPM images.
+
+
+class PpmImageFile(ImageFile.ImageFile):
+
+ format = "PPM"
+ format_description = "Pbmplus image"
+
+ def _token(self, s=b""):
+ while True: # read until next whitespace
+ c = self.fp.read(1)
+ if not c or c in b_whitespace:
+ break
+ if c > b"\x79":
+ raise ValueError("Expected ASCII value, found binary")
+ s = s + c
+ if len(s) > 9:
+ raise ValueError("Expected int, got > 9 digits")
+ return s
+
+ def _open(self):
+
+ # check magic
+ s = self.fp.read(1)
+ if s != b"P":
+ raise SyntaxError("not a PPM file")
+ magic_number = self._token(s)
+ mode = MODES[magic_number]
+
+ self.custom_mimetype = {
+ b"P4": "image/x-portable-bitmap",
+ b"P5": "image/x-portable-graymap",
+ b"P6": "image/x-portable-pixmap",
+ }.get(magic_number)
+
+ if mode == "1":
+ self.mode = "1"
+ rawmode = "1;I"
+ else:
+ self.mode = rawmode = mode
+
+ for ix in range(3):
+ while True:
+ while True:
+ s = self.fp.read(1)
+ if s not in b_whitespace:
+ break
+ if s == b"":
+ raise ValueError("File does not extend beyond magic number")
+ if s != b"#":
+ break
+ s = self.fp.readline()
+ s = int(self._token(s))
+ if ix == 0:
+ xsize = s
+ elif ix == 1:
+ ysize = s
+ if mode == "1":
+ break
+ elif ix == 2:
+ # maxgrey
+ if s > 255:
+ if not mode == "L":
+ raise ValueError(f"Too many colors for band: {s}")
+ if s < 2 ** 16:
+ self.mode = "I"
+ rawmode = "I;16B"
+ else:
+ self.mode = "I"
+ rawmode = "I;32B"
+
+ self._size = xsize, ysize
+ self.tile = [("raw", (0, 0, xsize, ysize), self.fp.tell(), (rawmode, 0, 1))]
+
+
+#
+# --------------------------------------------------------------------
+
+
+def _save(im, fp, filename):
+ if im.mode == "1":
+ rawmode, head = "1;I", b"P4"
+ elif im.mode == "L":
+ rawmode, head = "L", b"P5"
+ elif im.mode == "I":
+ if im.getextrema()[1] < 2 ** 16:
+ rawmode, head = "I;16B", b"P5"
+ else:
+ rawmode, head = "I;32B", b"P5"
+ elif im.mode == "RGB":
+ rawmode, head = "RGB", b"P6"
+ elif im.mode == "RGBA":
+ rawmode, head = "RGB", b"P6"
+ else:
+ raise OSError(f"cannot write mode {im.mode} as PPM")
+ fp.write(head + ("\n%d %d\n" % im.size).encode("ascii"))
+ if head == b"P6":
+ fp.write(b"255\n")
+ if head == b"P5":
+ if rawmode == "L":
+ fp.write(b"255\n")
+ elif rawmode == "I;16B":
+ fp.write(b"65535\n")
+ elif rawmode == "I;32B":
+ fp.write(b"2147483648\n")
+ ImageFile._save(im, fp, [("raw", (0, 0) + im.size, 0, (rawmode, 0, 1))])
+
+ # ALTERNATIVE: save via builtin debug function
+ # im._dump(filename)
+
+
+#
+# --------------------------------------------------------------------
+
+
+Image.register_open(PpmImageFile.format, PpmImageFile, _accept)
+Image.register_save(PpmImageFile.format, _save)
+
+Image.register_extensions(PpmImageFile.format, [".pbm", ".pgm", ".ppm", ".pnm"])
+
+Image.register_mime(PpmImageFile.format, "image/x-portable-anymap")
diff --git a/venv/Lib/site-packages/PIL/PsdImagePlugin.py b/venv/Lib/site-packages/PIL/PsdImagePlugin.py
new file mode 100644
index 0000000..e7b8846
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/PsdImagePlugin.py
@@ -0,0 +1,324 @@
+#
+# The Python Imaging Library
+# $Id$
+#
+# Adobe PSD 2.5/3.0 file handling
+#
+# History:
+# 1995-09-01 fl Created
+# 1997-01-03 fl Read most PSD images
+# 1997-01-18 fl Fixed P and CMYK support
+# 2001-10-21 fl Added seek/tell support (for layers)
+#
+# Copyright (c) 1997-2001 by Secret Labs AB.
+# Copyright (c) 1995-2001 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import io
+
+from . import Image, ImageFile, ImagePalette
+from ._binary import i8
+from ._binary import i16be as i16
+from ._binary import i32be as i32
+
+MODES = {
+ # (photoshop mode, bits) -> (pil mode, required channels)
+ (0, 1): ("1", 1),
+ (0, 8): ("L", 1),
+ (1, 8): ("L", 1),
+ (2, 8): ("P", 1),
+ (3, 8): ("RGB", 3),
+ (4, 8): ("CMYK", 4),
+ (7, 8): ("L", 1), # FIXME: multilayer
+ (8, 8): ("L", 1), # duotone
+ (9, 8): ("LAB", 3),
+}
+
+
+# --------------------------------------------------------------------.
+# read PSD images
+
+
+def _accept(prefix):
+ return prefix[:4] == b"8BPS"
+
+
+##
+# Image plugin for Photoshop images.
+
+
+class PsdImageFile(ImageFile.ImageFile):
+
+ format = "PSD"
+ format_description = "Adobe Photoshop"
+ _close_exclusive_fp_after_loading = False
+
+ def _open(self):
+
+ read = self.fp.read
+
+ #
+ # header
+
+ s = read(26)
+ if not _accept(s) or i16(s, 4) != 1:
+ raise SyntaxError("not a PSD file")
+
+ psd_bits = i16(s, 22)
+ psd_channels = i16(s, 12)
+ psd_mode = i16(s, 24)
+
+ mode, channels = MODES[(psd_mode, psd_bits)]
+
+ if channels > psd_channels:
+ raise OSError("not enough channels")
+
+ self.mode = mode
+ self._size = i32(s, 18), i32(s, 14)
+
+ #
+ # color mode data
+
+ size = i32(read(4))
+ if size:
+ data = read(size)
+ if mode == "P" and size == 768:
+ self.palette = ImagePalette.raw("RGB;L", data)
+
+ #
+ # image resources
+
+ self.resources = []
+
+ size = i32(read(4))
+ if size:
+ # load resources
+ end = self.fp.tell() + size
+ while self.fp.tell() < end:
+ read(4) # signature
+ id = i16(read(2))
+ name = read(i8(read(1)))
+ if not (len(name) & 1):
+ read(1) # padding
+ data = read(i32(read(4)))
+ if len(data) & 1:
+ read(1) # padding
+ self.resources.append((id, name, data))
+ if id == 1039: # ICC profile
+ self.info["icc_profile"] = data
+
+ #
+ # layer and mask information
+
+ self.layers = []
+
+ size = i32(read(4))
+ if size:
+ end = self.fp.tell() + size
+ size = i32(read(4))
+ if size:
+ _layer_data = io.BytesIO(ImageFile._safe_read(self.fp, size))
+ self.layers = _layerinfo(_layer_data, size)
+ self.fp.seek(end)
+ self.n_frames = len(self.layers)
+ self.is_animated = self.n_frames > 1
+
+ #
+ # image descriptor
+
+ self.tile = _maketile(self.fp, mode, (0, 0) + self.size, channels)
+
+ # keep the file open
+ self.__fp = self.fp
+ self.frame = 1
+ self._min_frame = 1
+
+ def seek(self, layer):
+ if not self._seek_check(layer):
+ return
+
+ # seek to given layer (1..max)
+ try:
+ name, mode, bbox, tile = self.layers[layer - 1]
+ self.mode = mode
+ self.tile = tile
+ self.frame = layer
+ self.fp = self.__fp
+ return name, bbox
+ except IndexError as e:
+ raise EOFError("no such layer") from e
+
+ def tell(self):
+ # return layer number (0=image, 1..max=layers)
+ return self.frame
+
+ def load_prepare(self):
+ # create image memory if necessary
+ if not self.im or self.im.mode != self.mode or self.im.size != self.size:
+ self.im = Image.core.fill(self.mode, self.size, 0)
+ # create palette (optional)
+ if self.mode == "P":
+ Image.Image.load(self)
+
+ def _close__fp(self):
+ try:
+ if self.__fp != self.fp:
+ self.__fp.close()
+ except AttributeError:
+ pass
+ finally:
+ self.__fp = None
+
+
+def _layerinfo(fp, ct_bytes):
+ # read layerinfo block
+ layers = []
+
+ def read(size):
+ return ImageFile._safe_read(fp, size)
+
+ ct = i16(read(2))
+
+ # sanity check
+ if ct_bytes < (abs(ct) * 20):
+ raise SyntaxError("Layer block too short for number of layers requested")
+
+ for i in range(abs(ct)):
+
+ # bounding box
+ y0 = i32(read(4))
+ x0 = i32(read(4))
+ y1 = i32(read(4))
+ x1 = i32(read(4))
+
+ # image info
+ info = []
+ mode = []
+ ct_types = i16(read(2))
+ types = list(range(ct_types))
+ if len(types) > 4:
+ continue
+
+ for i in types:
+ type = i16(read(2))
+
+ if type == 65535:
+ m = "A"
+ else:
+ m = "RGBA"[type]
+
+ mode.append(m)
+ size = i32(read(4))
+ info.append((m, size))
+
+ # figure out the image mode
+ mode.sort()
+ if mode == ["R"]:
+ mode = "L"
+ elif mode == ["B", "G", "R"]:
+ mode = "RGB"
+ elif mode == ["A", "B", "G", "R"]:
+ mode = "RGBA"
+ else:
+ mode = None # unknown
+
+ # skip over blend flags and extra information
+ read(12) # filler
+ name = ""
+ size = i32(read(4)) # length of the extra data field
+ combined = 0
+ if size:
+ data_end = fp.tell() + size
+
+ length = i32(read(4))
+ if length:
+ fp.seek(length - 16, io.SEEK_CUR)
+ combined += length + 4
+
+ length = i32(read(4))
+ if length:
+ fp.seek(length, io.SEEK_CUR)
+ combined += length + 4
+
+ length = i8(read(1))
+ if length:
+ # Don't know the proper encoding,
+ # Latin-1 should be a good guess
+ name = read(length).decode("latin-1", "replace")
+ combined += length + 1
+
+ fp.seek(data_end)
+ layers.append((name, mode, (x0, y0, x1, y1)))
+
+ # get tiles
+ i = 0
+ for name, mode, bbox in layers:
+ tile = []
+ for m in mode:
+ t = _maketile(fp, m, bbox, 1)
+ if t:
+ tile.extend(t)
+ layers[i] = name, mode, bbox, tile
+ i += 1
+
+ return layers
+
+
+def _maketile(file, mode, bbox, channels):
+
+ tile = None
+ read = file.read
+
+ compression = i16(read(2))
+
+ xsize = bbox[2] - bbox[0]
+ ysize = bbox[3] - bbox[1]
+
+ offset = file.tell()
+
+ if compression == 0:
+ #
+ # raw compression
+ tile = []
+ for channel in range(channels):
+ layer = mode[channel]
+ if mode == "CMYK":
+ layer += ";I"
+ tile.append(("raw", bbox, offset, layer))
+ offset = offset + xsize * ysize
+
+ elif compression == 1:
+ #
+ # packbits compression
+ i = 0
+ tile = []
+ bytecount = read(channels * ysize * 2)
+ offset = file.tell()
+ for channel in range(channels):
+ layer = mode[channel]
+ if mode == "CMYK":
+ layer += ";I"
+ tile.append(("packbits", bbox, offset, layer))
+ for y in range(ysize):
+ offset = offset + i16(bytecount, i)
+ i += 2
+
+ file.seek(offset)
+
+ if offset & 1:
+ read(1) # padding
+
+ return tile
+
+
+# --------------------------------------------------------------------
+# registry
+
+
+Image.register_open(PsdImageFile.format, PsdImageFile, _accept)
+
+Image.register_extension(PsdImageFile.format, ".psd")
+
+Image.register_mime(PsdImageFile.format, "image/vnd.adobe.photoshop")
diff --git a/venv/Lib/site-packages/PIL/PyAccess.py b/venv/Lib/site-packages/PIL/PyAccess.py
new file mode 100644
index 0000000..494f5f9
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/PyAccess.py
@@ -0,0 +1,352 @@
+#
+# The Python Imaging Library
+# Pillow fork
+#
+# Python implementation of the PixelAccess Object
+#
+# Copyright (c) 1997-2009 by Secret Labs AB. All rights reserved.
+# Copyright (c) 1995-2009 by Fredrik Lundh.
+# Copyright (c) 2013 Eric Soroos
+#
+# See the README file for information on usage and redistribution
+#
+
+# Notes:
+#
+# * Implements the pixel access object following Access.
+# * Does not implement the line functions, as they don't appear to be used
+# * Taking only the tuple form, which is used from python.
+# * Fill.c uses the integer form, but it's still going to use the old
+# Access.c implementation.
+#
+
+import logging
+import sys
+
+try:
+ from cffi import FFI
+
+ defs = """
+ struct Pixel_RGBA {
+ unsigned char r,g,b,a;
+ };
+ struct Pixel_I16 {
+ unsigned char l,r;
+ };
+ """
+ ffi = FFI()
+ ffi.cdef(defs)
+except ImportError as ex:
+ # Allow error import for doc purposes, but error out when accessing
+ # anything in core.
+ from ._util import deferred_error
+
+ FFI = ffi = deferred_error(ex)
+
+logger = logging.getLogger(__name__)
+
+
+class PyAccess:
+ def __init__(self, img, readonly=False):
+ vals = dict(img.im.unsafe_ptrs)
+ self.readonly = readonly
+ self.image8 = ffi.cast("unsigned char **", vals["image8"])
+ self.image32 = ffi.cast("int **", vals["image32"])
+ self.image = ffi.cast("unsigned char **", vals["image"])
+ self.xsize, self.ysize = img.im.size
+
+ # Keep pointer to im object to prevent dereferencing.
+ self._im = img.im
+ if self._im.mode == "P":
+ self._palette = img.palette
+
+ # Debugging is polluting test traces, only useful here
+ # when hacking on PyAccess
+ # logger.debug("%s", vals)
+ self._post_init()
+
+ def _post_init(self):
+ pass
+
+ def __setitem__(self, xy, color):
+ """
+ Modifies the pixel at x,y. The color is given as a single
+ numerical value for single band images, and a tuple for
+ multi-band images
+
+ :param xy: The pixel coordinate, given as (x, y). See
+ :ref:`coordinate-system`.
+ :param color: The pixel value.
+ """
+ if self.readonly:
+ raise ValueError("Attempt to putpixel a read only image")
+ (x, y) = xy
+ if x < 0:
+ x = self.xsize + x
+ if y < 0:
+ y = self.ysize + y
+ (x, y) = self.check_xy((x, y))
+
+ if (
+ self._im.mode == "P"
+ and isinstance(color, (list, tuple))
+ and len(color) in [3, 4]
+ ):
+ # RGB or RGBA value for a P image
+ color = self._palette.getcolor(color)
+
+ return self.set_pixel(x, y, color)
+
+ def __getitem__(self, xy):
+ """
+ Returns the pixel at x,y. The pixel is returned as a single
+ value for single band images or a tuple for multiple band
+ images
+
+ :param xy: The pixel coordinate, given as (x, y). See
+ :ref:`coordinate-system`.
+ :returns: a pixel value for single band images, a tuple of
+ pixel values for multiband images.
+ """
+ (x, y) = xy
+ if x < 0:
+ x = self.xsize + x
+ if y < 0:
+ y = self.ysize + y
+ (x, y) = self.check_xy((x, y))
+ return self.get_pixel(x, y)
+
+ putpixel = __setitem__
+ getpixel = __getitem__
+
+ def check_xy(self, xy):
+ (x, y) = xy
+ if not (0 <= x < self.xsize and 0 <= y < self.ysize):
+ raise ValueError("pixel location out of range")
+ return xy
+
+
+class _PyAccess32_2(PyAccess):
+ """ PA, LA, stored in first and last bytes of a 32 bit word """
+
+ def _post_init(self, *args, **kwargs):
+ self.pixels = ffi.cast("struct Pixel_RGBA **", self.image32)
+
+ def get_pixel(self, x, y):
+ pixel = self.pixels[y][x]
+ return (pixel.r, pixel.a)
+
+ def set_pixel(self, x, y, color):
+ pixel = self.pixels[y][x]
+ # tuple
+ pixel.r = min(color[0], 255)
+ pixel.a = min(color[1], 255)
+
+
+class _PyAccess32_3(PyAccess):
+ """ RGB and friends, stored in the first three bytes of a 32 bit word """
+
+ def _post_init(self, *args, **kwargs):
+ self.pixels = ffi.cast("struct Pixel_RGBA **", self.image32)
+
+ def get_pixel(self, x, y):
+ pixel = self.pixels[y][x]
+ return (pixel.r, pixel.g, pixel.b)
+
+ def set_pixel(self, x, y, color):
+ pixel = self.pixels[y][x]
+ # tuple
+ pixel.r = min(color[0], 255)
+ pixel.g = min(color[1], 255)
+ pixel.b = min(color[2], 255)
+ pixel.a = 255
+
+
+class _PyAccess32_4(PyAccess):
+ """ RGBA etc, all 4 bytes of a 32 bit word """
+
+ def _post_init(self, *args, **kwargs):
+ self.pixels = ffi.cast("struct Pixel_RGBA **", self.image32)
+
+ def get_pixel(self, x, y):
+ pixel = self.pixels[y][x]
+ return (pixel.r, pixel.g, pixel.b, pixel.a)
+
+ def set_pixel(self, x, y, color):
+ pixel = self.pixels[y][x]
+ # tuple
+ pixel.r = min(color[0], 255)
+ pixel.g = min(color[1], 255)
+ pixel.b = min(color[2], 255)
+ pixel.a = min(color[3], 255)
+
+
+class _PyAccess8(PyAccess):
+ """ 1, L, P, 8 bit images stored as uint8 """
+
+ def _post_init(self, *args, **kwargs):
+ self.pixels = self.image8
+
+ def get_pixel(self, x, y):
+ return self.pixels[y][x]
+
+ def set_pixel(self, x, y, color):
+ try:
+ # integer
+ self.pixels[y][x] = min(color, 255)
+ except TypeError:
+ # tuple
+ self.pixels[y][x] = min(color[0], 255)
+
+
+class _PyAccessI16_N(PyAccess):
+ """ I;16 access, native bitendian without conversion """
+
+ def _post_init(self, *args, **kwargs):
+ self.pixels = ffi.cast("unsigned short **", self.image)
+
+ def get_pixel(self, x, y):
+ return self.pixels[y][x]
+
+ def set_pixel(self, x, y, color):
+ try:
+ # integer
+ self.pixels[y][x] = min(color, 65535)
+ except TypeError:
+ # tuple
+ self.pixels[y][x] = min(color[0], 65535)
+
+
+class _PyAccessI16_L(PyAccess):
+ """ I;16L access, with conversion """
+
+ def _post_init(self, *args, **kwargs):
+ self.pixels = ffi.cast("struct Pixel_I16 **", self.image)
+
+ def get_pixel(self, x, y):
+ pixel = self.pixels[y][x]
+ return pixel.l + pixel.r * 256
+
+ def set_pixel(self, x, y, color):
+ pixel = self.pixels[y][x]
+ try:
+ color = min(color, 65535)
+ except TypeError:
+ color = min(color[0], 65535)
+
+ pixel.l = color & 0xFF # noqa: E741
+ pixel.r = color >> 8
+
+
+class _PyAccessI16_B(PyAccess):
+ """ I;16B access, with conversion """
+
+ def _post_init(self, *args, **kwargs):
+ self.pixels = ffi.cast("struct Pixel_I16 **", self.image)
+
+ def get_pixel(self, x, y):
+ pixel = self.pixels[y][x]
+ return pixel.l * 256 + pixel.r
+
+ def set_pixel(self, x, y, color):
+ pixel = self.pixels[y][x]
+ try:
+ color = min(color, 65535)
+ except Exception:
+ color = min(color[0], 65535)
+
+ pixel.l = color >> 8 # noqa: E741
+ pixel.r = color & 0xFF
+
+
+class _PyAccessI32_N(PyAccess):
+ """ Signed Int32 access, native endian """
+
+ def _post_init(self, *args, **kwargs):
+ self.pixels = self.image32
+
+ def get_pixel(self, x, y):
+ return self.pixels[y][x]
+
+ def set_pixel(self, x, y, color):
+ self.pixels[y][x] = color
+
+
+class _PyAccessI32_Swap(PyAccess):
+ """ I;32L/B access, with byteswapping conversion """
+
+ def _post_init(self, *args, **kwargs):
+ self.pixels = self.image32
+
+ def reverse(self, i):
+ orig = ffi.new("int *", i)
+ chars = ffi.cast("unsigned char *", orig)
+ chars[0], chars[1], chars[2], chars[3] = chars[3], chars[2], chars[1], chars[0]
+ return ffi.cast("int *", chars)[0]
+
+ def get_pixel(self, x, y):
+ return self.reverse(self.pixels[y][x])
+
+ def set_pixel(self, x, y, color):
+ self.pixels[y][x] = self.reverse(color)
+
+
+class _PyAccessF(PyAccess):
+ """ 32 bit float access """
+
+ def _post_init(self, *args, **kwargs):
+ self.pixels = ffi.cast("float **", self.image32)
+
+ def get_pixel(self, x, y):
+ return self.pixels[y][x]
+
+ def set_pixel(self, x, y, color):
+ try:
+ # not a tuple
+ self.pixels[y][x] = color
+ except TypeError:
+ # tuple
+ self.pixels[y][x] = color[0]
+
+
+mode_map = {
+ "1": _PyAccess8,
+ "L": _PyAccess8,
+ "P": _PyAccess8,
+ "LA": _PyAccess32_2,
+ "La": _PyAccess32_2,
+ "PA": _PyAccess32_2,
+ "RGB": _PyAccess32_3,
+ "LAB": _PyAccess32_3,
+ "HSV": _PyAccess32_3,
+ "YCbCr": _PyAccess32_3,
+ "RGBA": _PyAccess32_4,
+ "RGBa": _PyAccess32_4,
+ "RGBX": _PyAccess32_4,
+ "CMYK": _PyAccess32_4,
+ "F": _PyAccessF,
+ "I": _PyAccessI32_N,
+}
+
+if sys.byteorder == "little":
+ mode_map["I;16"] = _PyAccessI16_N
+ mode_map["I;16L"] = _PyAccessI16_N
+ mode_map["I;16B"] = _PyAccessI16_B
+
+ mode_map["I;32L"] = _PyAccessI32_N
+ mode_map["I;32B"] = _PyAccessI32_Swap
+else:
+ mode_map["I;16"] = _PyAccessI16_L
+ mode_map["I;16L"] = _PyAccessI16_L
+ mode_map["I;16B"] = _PyAccessI16_N
+
+ mode_map["I;32L"] = _PyAccessI32_Swap
+ mode_map["I;32B"] = _PyAccessI32_N
+
+
+def new(img, readonly=False):
+ access_type = mode_map.get(img.mode, None)
+ if not access_type:
+ logger.debug("PyAccess Not Implemented: %s", img.mode)
+ return None
+ return access_type(img, readonly)
diff --git a/venv/Lib/site-packages/PIL/SgiImagePlugin.py b/venv/Lib/site-packages/PIL/SgiImagePlugin.py
new file mode 100644
index 0000000..d0f7c99
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/SgiImagePlugin.py
@@ -0,0 +1,229 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# SGI image file handling
+#
+# See "The SGI Image File Format (Draft version 0.97)", Paul Haeberli.
+#
+#
+#
+# History:
+# 2017-22-07 mb Add RLE decompression
+# 2016-16-10 mb Add save method without compression
+# 1995-09-10 fl Created
+#
+# Copyright (c) 2016 by Mickael Bonfill.
+# Copyright (c) 2008 by Karsten Hiddemann.
+# Copyright (c) 1997 by Secret Labs AB.
+# Copyright (c) 1995 by Fredrik Lundh.
+#
+# See the README file for information on usage and redistribution.
+#
+
+
+import os
+import struct
+
+from . import Image, ImageFile
+from ._binary import i16be as i16
+from ._binary import o8
+
+
+def _accept(prefix):
+ return len(prefix) >= 2 and i16(prefix) == 474
+
+
+MODES = {
+ (1, 1, 1): "L",
+ (1, 2, 1): "L",
+ (2, 1, 1): "L;16B",
+ (2, 2, 1): "L;16B",
+ (1, 3, 3): "RGB",
+ (2, 3, 3): "RGB;16B",
+ (1, 3, 4): "RGBA",
+ (2, 3, 4): "RGBA;16B",
+}
+
+
+##
+# Image plugin for SGI images.
+class SgiImageFile(ImageFile.ImageFile):
+
+ format = "SGI"
+ format_description = "SGI Image File Format"
+
+ def _open(self):
+
+ # HEAD
+ headlen = 512
+ s = self.fp.read(headlen)
+
+ if not _accept(s):
+ raise ValueError("Not an SGI image file")
+
+ # compression : verbatim or RLE
+ compression = s[2]
+
+ # bpc : 1 or 2 bytes (8bits or 16bits)
+ bpc = s[3]
+
+ # dimension : 1, 2 or 3 (depending on xsize, ysize and zsize)
+ dimension = i16(s, 4)
+
+ # xsize : width
+ xsize = i16(s, 6)
+
+ # ysize : height
+ ysize = i16(s, 8)
+
+ # zsize : channels count
+ zsize = i16(s, 10)
+
+ # layout
+ layout = bpc, dimension, zsize
+
+ # determine mode from bits/zsize
+ rawmode = ""
+ try:
+ rawmode = MODES[layout]
+ except KeyError:
+ pass
+
+ if rawmode == "":
+ raise ValueError("Unsupported SGI image mode")
+
+ self._size = xsize, ysize
+ self.mode = rawmode.split(";")[0]
+ if self.mode == "RGB":
+ self.custom_mimetype = "image/rgb"
+
+ # orientation -1 : scanlines begins at the bottom-left corner
+ orientation = -1
+
+ # decoder info
+ if compression == 0:
+ pagesize = xsize * ysize * bpc
+ if bpc == 2:
+ self.tile = [
+ ("SGI16", (0, 0) + self.size, headlen, (self.mode, 0, orientation))
+ ]
+ else:
+ self.tile = []
+ offset = headlen
+ for layer in self.mode:
+ self.tile.append(
+ ("raw", (0, 0) + self.size, offset, (layer, 0, orientation))
+ )
+ offset += pagesize
+ elif compression == 1:
+ self.tile = [
+ ("sgi_rle", (0, 0) + self.size, headlen, (rawmode, orientation, bpc))
+ ]
+
+
+def _save(im, fp, filename):
+ if im.mode != "RGB" and im.mode != "RGBA" and im.mode != "L":
+ raise ValueError("Unsupported SGI image mode")
+
+ # Get the keyword arguments
+ info = im.encoderinfo
+
+ # Byte-per-pixel precision, 1 = 8bits per pixel
+ bpc = info.get("bpc", 1)
+
+ if bpc not in (1, 2):
+ raise ValueError("Unsupported number of bytes per pixel")
+
+ # Flip the image, since the origin of SGI file is the bottom-left corner
+ orientation = -1
+ # Define the file as SGI File Format
+ magicNumber = 474
+ # Run-Length Encoding Compression - Unsupported at this time
+ rle = 0
+
+ # Number of dimensions (x,y,z)
+ dim = 3
+ # X Dimension = width / Y Dimension = height
+ x, y = im.size
+ if im.mode == "L" and y == 1:
+ dim = 1
+ elif im.mode == "L":
+ dim = 2
+ # Z Dimension: Number of channels
+ z = len(im.mode)
+
+ if dim == 1 or dim == 2:
+ z = 1
+
+ # assert we've got the right number of bands.
+ if len(im.getbands()) != z:
+ raise ValueError(
+ f"incorrect number of bands in SGI write: {z} vs {len(im.getbands())}"
+ )
+
+ # Minimum Byte value
+ pinmin = 0
+ # Maximum Byte value (255 = 8bits per pixel)
+ pinmax = 255
+ # Image name (79 characters max, truncated below in write)
+ imgName = os.path.splitext(os.path.basename(filename))[0]
+ imgName = imgName.encode("ascii", "ignore")
+ # Standard representation of pixel in the file
+ colormap = 0
+ fp.write(struct.pack(">h", magicNumber))
+ fp.write(o8(rle))
+ fp.write(o8(bpc))
+ fp.write(struct.pack(">H", dim))
+ fp.write(struct.pack(">H", x))
+ fp.write(struct.pack(">H", y))
+ fp.write(struct.pack(">H", z))
+ fp.write(struct.pack(">l", pinmin))
+ fp.write(struct.pack(">l", pinmax))
+ fp.write(struct.pack("4s", b"")) # dummy
+ fp.write(struct.pack("79s", imgName)) # truncates to 79 chars
+ fp.write(struct.pack("s", b"")) # force null byte after imgname
+ fp.write(struct.pack(">l", colormap))
+ fp.write(struct.pack("404s", b"")) # dummy
+
+ rawmode = "L"
+ if bpc == 2:
+ rawmode = "L;16B"
+
+ for channel in im.split():
+ fp.write(channel.tobytes("raw", rawmode, 0, orientation))
+
+ fp.close()
+
+
+class SGI16Decoder(ImageFile.PyDecoder):
+ _pulls_fd = True
+
+ def decode(self, buffer):
+ rawmode, stride, orientation = self.args
+ pagesize = self.state.xsize * self.state.ysize
+ zsize = len(self.mode)
+ self.fd.seek(512)
+
+ for band in range(zsize):
+ channel = Image.new("L", (self.state.xsize, self.state.ysize))
+ channel.frombytes(
+ self.fd.read(2 * pagesize), "raw", "L;16B", stride, orientation
+ )
+ self.im.putband(channel.im, band)
+
+ return -1, 0
+
+
+#
+# registry
+
+
+Image.register_decoder("SGI16", SGI16Decoder)
+Image.register_open(SgiImageFile.format, SgiImageFile, _accept)
+Image.register_save(SgiImageFile.format, _save)
+Image.register_mime(SgiImageFile.format, "image/sgi")
+
+Image.register_extensions(SgiImageFile.format, [".bw", ".rgb", ".rgba", ".sgi"])
+
+# End of file
diff --git a/venv/Lib/site-packages/PIL/SpiderImagePlugin.py b/venv/Lib/site-packages/PIL/SpiderImagePlugin.py
new file mode 100644
index 0000000..819f2ed
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/SpiderImagePlugin.py
@@ -0,0 +1,324 @@
+#
+# The Python Imaging Library.
+#
+# SPIDER image file handling
+#
+# History:
+# 2004-08-02 Created BB
+# 2006-03-02 added save method
+# 2006-03-13 added support for stack images
+#
+# Copyright (c) 2004 by Health Research Inc. (HRI) RENSSELAER, NY 12144.
+# Copyright (c) 2004 by William Baxter.
+# Copyright (c) 2004 by Secret Labs AB.
+# Copyright (c) 2004 by Fredrik Lundh.
+#
+
+##
+# Image plugin for the Spider image format. This format is is used
+# by the SPIDER software, in processing image data from electron
+# microscopy and tomography.
+##
+
+#
+# SpiderImagePlugin.py
+#
+# The Spider image format is used by SPIDER software, in processing
+# image data from electron microscopy and tomography.
+#
+# Spider home page:
+# https://spider.wadsworth.org/spider_doc/spider/docs/spider.html
+#
+# Details about the Spider image format:
+# https://spider.wadsworth.org/spider_doc/spider/docs/image_doc.html
+#
+import os
+import struct
+import sys
+
+from PIL import Image, ImageFile
+
+
+def isInt(f):
+ try:
+ i = int(f)
+ if f - i == 0:
+ return 1
+ else:
+ return 0
+ except (ValueError, OverflowError):
+ return 0
+
+
+iforms = [1, 3, -11, -12, -21, -22]
+
+
+# There is no magic number to identify Spider files, so just check a
+# series of header locations to see if they have reasonable values.
+# Returns no. of bytes in the header, if it is a valid Spider header,
+# otherwise returns 0
+
+
+def isSpiderHeader(t):
+ h = (99,) + t # add 1 value so can use spider header index start=1
+ # header values 1,2,5,12,13,22,23 should be integers
+ for i in [1, 2, 5, 12, 13, 22, 23]:
+ if not isInt(h[i]):
+ return 0
+ # check iform
+ iform = int(h[5])
+ if iform not in iforms:
+ return 0
+ # check other header values
+ labrec = int(h[13]) # no. records in file header
+ labbyt = int(h[22]) # total no. of bytes in header
+ lenbyt = int(h[23]) # record length in bytes
+ if labbyt != (labrec * lenbyt):
+ return 0
+ # looks like a valid header
+ return labbyt
+
+
+def isSpiderImage(filename):
+ with open(filename, "rb") as fp:
+ f = fp.read(92) # read 23 * 4 bytes
+ t = struct.unpack(">23f", f) # try big-endian first
+ hdrlen = isSpiderHeader(t)
+ if hdrlen == 0:
+ t = struct.unpack("<23f", f) # little-endian
+ hdrlen = isSpiderHeader(t)
+ return hdrlen
+
+
+class SpiderImageFile(ImageFile.ImageFile):
+
+ format = "SPIDER"
+ format_description = "Spider 2D image"
+ _close_exclusive_fp_after_loading = False
+
+ def _open(self):
+ # check header
+ n = 27 * 4 # read 27 float values
+ f = self.fp.read(n)
+
+ try:
+ self.bigendian = 1
+ t = struct.unpack(">27f", f) # try big-endian first
+ hdrlen = isSpiderHeader(t)
+ if hdrlen == 0:
+ self.bigendian = 0
+ t = struct.unpack("<27f", f) # little-endian
+ hdrlen = isSpiderHeader(t)
+ if hdrlen == 0:
+ raise SyntaxError("not a valid Spider file")
+ except struct.error as e:
+ raise SyntaxError("not a valid Spider file") from e
+
+ h = (99,) + t # add 1 value : spider header index starts at 1
+ iform = int(h[5])
+ if iform != 1:
+ raise SyntaxError("not a Spider 2D image")
+
+ self._size = int(h[12]), int(h[2]) # size in pixels (width, height)
+ self.istack = int(h[24])
+ self.imgnumber = int(h[27])
+
+ if self.istack == 0 and self.imgnumber == 0:
+ # stk=0, img=0: a regular 2D image
+ offset = hdrlen
+ self._nimages = 1
+ elif self.istack > 0 and self.imgnumber == 0:
+ # stk>0, img=0: Opening the stack for the first time
+ self.imgbytes = int(h[12]) * int(h[2]) * 4
+ self.hdrlen = hdrlen
+ self._nimages = int(h[26])
+ # Point to the first image in the stack
+ offset = hdrlen * 2
+ self.imgnumber = 1
+ elif self.istack == 0 and self.imgnumber > 0:
+ # stk=0, img>0: an image within the stack
+ offset = hdrlen + self.stkoffset
+ self.istack = 2 # So Image knows it's still a stack
+ else:
+ raise SyntaxError("inconsistent stack header values")
+
+ if self.bigendian:
+ self.rawmode = "F;32BF"
+ else:
+ self.rawmode = "F;32F"
+ self.mode = "F"
+
+ self.tile = [("raw", (0, 0) + self.size, offset, (self.rawmode, 0, 1))]
+ self.__fp = self.fp # FIXME: hack
+
+ @property
+ def n_frames(self):
+ return self._nimages
+
+ @property
+ def is_animated(self):
+ return self._nimages > 1
+
+ # 1st image index is zero (although SPIDER imgnumber starts at 1)
+ def tell(self):
+ if self.imgnumber < 1:
+ return 0
+ else:
+ return self.imgnumber - 1
+
+ def seek(self, frame):
+ if self.istack == 0:
+ raise EOFError("attempt to seek in a non-stack file")
+ if not self._seek_check(frame):
+ return
+ self.stkoffset = self.hdrlen + frame * (self.hdrlen + self.imgbytes)
+ self.fp = self.__fp
+ self.fp.seek(self.stkoffset)
+ self._open()
+
+ # returns a byte image after rescaling to 0..255
+ def convert2byte(self, depth=255):
+ (minimum, maximum) = self.getextrema()
+ m = 1
+ if maximum != minimum:
+ m = depth / (maximum - minimum)
+ b = -m * minimum
+ return self.point(lambda i, m=m, b=b: i * m + b).convert("L")
+
+ # returns a ImageTk.PhotoImage object, after rescaling to 0..255
+ def tkPhotoImage(self):
+ from PIL import ImageTk
+
+ return ImageTk.PhotoImage(self.convert2byte(), palette=256)
+
+ def _close__fp(self):
+ try:
+ if self.__fp != self.fp:
+ self.__fp.close()
+ except AttributeError:
+ pass
+ finally:
+ self.__fp = None
+
+
+# --------------------------------------------------------------------
+# Image series
+
+# given a list of filenames, return a list of images
+def loadImageSeries(filelist=None):
+ """create a list of :py:class:`~PIL.Image.Image` objects for use in a montage"""
+ if filelist is None or len(filelist) < 1:
+ return
+
+ imglist = []
+ for img in filelist:
+ if not os.path.exists(img):
+ print(f"unable to find {img}")
+ continue
+ try:
+ with Image.open(img) as im:
+ im = im.convert2byte()
+ except Exception:
+ if not isSpiderImage(img):
+ print(img + " is not a Spider image file")
+ continue
+ im.info["filename"] = img
+ imglist.append(im)
+ return imglist
+
+
+# --------------------------------------------------------------------
+# For saving images in Spider format
+
+
+def makeSpiderHeader(im):
+ nsam, nrow = im.size
+ lenbyt = nsam * 4 # There are labrec records in the header
+ labrec = int(1024 / lenbyt)
+ if 1024 % lenbyt != 0:
+ labrec += 1
+ labbyt = labrec * lenbyt
+ hdr = []
+ nvalues = int(labbyt / 4)
+ for i in range(nvalues):
+ hdr.append(0.0)
+
+ if len(hdr) < 23:
+ return []
+
+ # NB these are Fortran indices
+ hdr[1] = 1.0 # nslice (=1 for an image)
+ hdr[2] = float(nrow) # number of rows per slice
+ hdr[5] = 1.0 # iform for 2D image
+ hdr[12] = float(nsam) # number of pixels per line
+ hdr[13] = float(labrec) # number of records in file header
+ hdr[22] = float(labbyt) # total number of bytes in header
+ hdr[23] = float(lenbyt) # record length in bytes
+
+ # adjust for Fortran indexing
+ hdr = hdr[1:]
+ hdr.append(0.0)
+ # pack binary data into a string
+ hdrstr = []
+ for v in hdr:
+ hdrstr.append(struct.pack("f", v))
+ return hdrstr
+
+
+def _save(im, fp, filename):
+ if im.mode[0] != "F":
+ im = im.convert("F")
+
+ hdr = makeSpiderHeader(im)
+ if len(hdr) < 256:
+ raise OSError("Error creating Spider header")
+
+ # write the SPIDER header
+ fp.writelines(hdr)
+
+ rawmode = "F;32NF" # 32-bit native floating point
+ ImageFile._save(im, fp, [("raw", (0, 0) + im.size, 0, (rawmode, 0, 1))])
+
+
+def _save_spider(im, fp, filename):
+ # get the filename extension and register it with Image
+ ext = os.path.splitext(filename)[1]
+ Image.register_extension(SpiderImageFile.format, ext)
+ _save(im, fp, filename)
+
+
+# --------------------------------------------------------------------
+
+
+Image.register_open(SpiderImageFile.format, SpiderImageFile)
+Image.register_save(SpiderImageFile.format, _save_spider)
+
+if __name__ == "__main__":
+
+ if len(sys.argv) < 2:
+ print("Syntax: python SpiderImagePlugin.py [infile] [outfile]")
+ sys.exit()
+
+ filename = sys.argv[1]
+ if not isSpiderImage(filename):
+ print("input image must be in Spider format")
+ sys.exit()
+
+ with Image.open(filename) as im:
+ print("image: " + str(im))
+ print("format: " + str(im.format))
+ print("size: " + str(im.size))
+ print("mode: " + str(im.mode))
+ print("max, min: ", end=" ")
+ print(im.getextrema())
+
+ if len(sys.argv) > 2:
+ outfile = sys.argv[2]
+
+ # perform some image operation
+ im = im.transpose(Image.FLIP_LEFT_RIGHT)
+ print(
+ f"saving a flipped version of {os.path.basename(filename)} "
+ f"as {outfile} "
+ )
+ im.save(outfile, SpiderImageFile.format)
diff --git a/venv/Lib/site-packages/PIL/SunImagePlugin.py b/venv/Lib/site-packages/PIL/SunImagePlugin.py
new file mode 100644
index 0000000..c03759a
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/SunImagePlugin.py
@@ -0,0 +1,136 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# Sun image file handling
+#
+# History:
+# 1995-09-10 fl Created
+# 1996-05-28 fl Fixed 32-bit alignment
+# 1998-12-29 fl Import ImagePalette module
+# 2001-12-18 fl Fixed palette loading (from Jean-Claude Rimbault)
+#
+# Copyright (c) 1997-2001 by Secret Labs AB
+# Copyright (c) 1995-1996 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+
+from . import Image, ImageFile, ImagePalette
+from ._binary import i32be as i32
+
+
+def _accept(prefix):
+ return len(prefix) >= 4 and i32(prefix) == 0x59A66A95
+
+
+##
+# Image plugin for Sun raster files.
+
+
+class SunImageFile(ImageFile.ImageFile):
+
+ format = "SUN"
+ format_description = "Sun Raster File"
+
+ def _open(self):
+
+ # The Sun Raster file header is 32 bytes in length
+ # and has the following format:
+
+ # typedef struct _SunRaster
+ # {
+ # DWORD MagicNumber; /* Magic (identification) number */
+ # DWORD Width; /* Width of image in pixels */
+ # DWORD Height; /* Height of image in pixels */
+ # DWORD Depth; /* Number of bits per pixel */
+ # DWORD Length; /* Size of image data in bytes */
+ # DWORD Type; /* Type of raster file */
+ # DWORD ColorMapType; /* Type of color map */
+ # DWORD ColorMapLength; /* Size of the color map in bytes */
+ # } SUNRASTER;
+
+ # HEAD
+ s = self.fp.read(32)
+ if not _accept(s):
+ raise SyntaxError("not an SUN raster file")
+
+ offset = 32
+
+ self._size = i32(s, 4), i32(s, 8)
+
+ depth = i32(s, 12)
+ # data_length = i32(s, 16) # unreliable, ignore.
+ file_type = i32(s, 20)
+ palette_type = i32(s, 24) # 0: None, 1: RGB, 2: Raw/arbitrary
+ palette_length = i32(s, 28)
+
+ if depth == 1:
+ self.mode, rawmode = "1", "1;I"
+ elif depth == 4:
+ self.mode, rawmode = "L", "L;4"
+ elif depth == 8:
+ self.mode = rawmode = "L"
+ elif depth == 24:
+ if file_type == 3:
+ self.mode, rawmode = "RGB", "RGB"
+ else:
+ self.mode, rawmode = "RGB", "BGR"
+ elif depth == 32:
+ if file_type == 3:
+ self.mode, rawmode = "RGB", "RGBX"
+ else:
+ self.mode, rawmode = "RGB", "BGRX"
+ else:
+ raise SyntaxError("Unsupported Mode/Bit Depth")
+
+ if palette_length:
+ if palette_length > 1024:
+ raise SyntaxError("Unsupported Color Palette Length")
+
+ if palette_type != 1:
+ raise SyntaxError("Unsupported Palette Type")
+
+ offset = offset + palette_length
+ self.palette = ImagePalette.raw("RGB;L", self.fp.read(palette_length))
+ if self.mode == "L":
+ self.mode = "P"
+ rawmode = rawmode.replace("L", "P")
+
+ # 16 bit boundaries on stride
+ stride = ((self.size[0] * depth + 15) // 16) * 2
+
+ # file type: Type is the version (or flavor) of the bitmap
+ # file. The following values are typically found in the Type
+ # field:
+ # 0000h Old
+ # 0001h Standard
+ # 0002h Byte-encoded
+ # 0003h RGB format
+ # 0004h TIFF format
+ # 0005h IFF format
+ # FFFFh Experimental
+
+ # Old and standard are the same, except for the length tag.
+ # byte-encoded is run-length-encoded
+ # RGB looks similar to standard, but RGB byte order
+ # TIFF and IFF mean that they were converted from T/IFF
+ # Experimental means that it's something else.
+ # (https://www.fileformat.info/format/sunraster/egff.htm)
+
+ if file_type in (0, 1, 3, 4, 5):
+ self.tile = [("raw", (0, 0) + self.size, offset, (rawmode, stride))]
+ elif file_type == 2:
+ self.tile = [("sun_rle", (0, 0) + self.size, offset, rawmode)]
+ else:
+ raise SyntaxError("Unsupported Sun Raster file type")
+
+
+#
+# registry
+
+
+Image.register_open(SunImageFile.format, SunImageFile, _accept)
+
+Image.register_extension(SunImageFile.format, ".ras")
diff --git a/venv/Lib/site-packages/PIL/TarIO.py b/venv/Lib/site-packages/PIL/TarIO.py
new file mode 100644
index 0000000..d108362
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/TarIO.py
@@ -0,0 +1,65 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# read files from within a tar file
+#
+# History:
+# 95-06-18 fl Created
+# 96-05-28 fl Open files in binary mode
+#
+# Copyright (c) Secret Labs AB 1997.
+# Copyright (c) Fredrik Lundh 1995-96.
+#
+# See the README file for information on usage and redistribution.
+#
+
+import io
+
+from . import ContainerIO
+
+
+class TarIO(ContainerIO.ContainerIO):
+ """A file object that provides read access to a given member of a TAR file."""
+
+ def __init__(self, tarfile, file):
+ """
+ Create file object.
+
+ :param tarfile: Name of TAR file.
+ :param file: Name of member file.
+ """
+ self.fh = open(tarfile, "rb")
+
+ while True:
+
+ s = self.fh.read(512)
+ if len(s) != 512:
+ raise OSError("unexpected end of tar file")
+
+ name = s[:100].decode("utf-8")
+ i = name.find("\0")
+ if i == 0:
+ raise OSError("cannot find subfile")
+ if i > 0:
+ name = name[:i]
+
+ size = int(s[124:135], 8)
+
+ if file == name:
+ break
+
+ self.fh.seek((size + 511) & (~511), io.SEEK_CUR)
+
+ # Open region
+ super().__init__(self.fh, self.fh.tell(), size)
+
+ # Context manager support
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *args):
+ self.close()
+
+ def close(self):
+ self.fh.close()
diff --git a/venv/Lib/site-packages/PIL/TgaImagePlugin.py b/venv/Lib/site-packages/PIL/TgaImagePlugin.py
new file mode 100644
index 0000000..2b936d6
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/TgaImagePlugin.py
@@ -0,0 +1,248 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# TGA file handling
+#
+# History:
+# 95-09-01 fl created (reads 24-bit files only)
+# 97-01-04 fl support more TGA versions, including compressed images
+# 98-07-04 fl fixed orientation and alpha layer bugs
+# 98-09-11 fl fixed orientation for runlength decoder
+#
+# Copyright (c) Secret Labs AB 1997-98.
+# Copyright (c) Fredrik Lundh 1995-97.
+#
+# See the README file for information on usage and redistribution.
+#
+
+
+import warnings
+
+from . import Image, ImageFile, ImagePalette
+from ._binary import i16le as i16
+from ._binary import o8
+from ._binary import o16le as o16
+
+#
+# --------------------------------------------------------------------
+# Read RGA file
+
+
+MODES = {
+ # map imagetype/depth to rawmode
+ (1, 8): "P",
+ (3, 1): "1",
+ (3, 8): "L",
+ (3, 16): "LA",
+ (2, 16): "BGR;5",
+ (2, 24): "BGR",
+ (2, 32): "BGRA",
+}
+
+
+##
+# Image plugin for Targa files.
+
+
+class TgaImageFile(ImageFile.ImageFile):
+
+ format = "TGA"
+ format_description = "Targa"
+
+ def _open(self):
+
+ # process header
+ s = self.fp.read(18)
+
+ id_len = s[0]
+
+ colormaptype = s[1]
+ imagetype = s[2]
+
+ depth = s[16]
+
+ flags = s[17]
+
+ self._size = i16(s, 12), i16(s, 14)
+
+ # validate header fields
+ if (
+ colormaptype not in (0, 1)
+ or self.size[0] <= 0
+ or self.size[1] <= 0
+ or depth not in (1, 8, 16, 24, 32)
+ ):
+ raise SyntaxError("not a TGA file")
+
+ # image mode
+ if imagetype in (3, 11):
+ self.mode = "L"
+ if depth == 1:
+ self.mode = "1" # ???
+ elif depth == 16:
+ self.mode = "LA"
+ elif imagetype in (1, 9):
+ self.mode = "P"
+ elif imagetype in (2, 10):
+ self.mode = "RGB"
+ if depth == 32:
+ self.mode = "RGBA"
+ else:
+ raise SyntaxError("unknown TGA mode")
+
+ # orientation
+ orientation = flags & 0x30
+ if orientation == 0x20:
+ orientation = 1
+ elif not orientation:
+ orientation = -1
+ else:
+ raise SyntaxError("unknown TGA orientation")
+
+ self.info["orientation"] = orientation
+
+ if imagetype & 8:
+ self.info["compression"] = "tga_rle"
+
+ if id_len:
+ self.info["id_section"] = self.fp.read(id_len)
+
+ if colormaptype:
+ # read palette
+ start, size, mapdepth = i16(s, 3), i16(s, 5), i16(s, 7)
+ if mapdepth == 16:
+ self.palette = ImagePalette.raw(
+ "BGR;16", b"\0" * 2 * start + self.fp.read(2 * size)
+ )
+ elif mapdepth == 24:
+ self.palette = ImagePalette.raw(
+ "BGR", b"\0" * 3 * start + self.fp.read(3 * size)
+ )
+ elif mapdepth == 32:
+ self.palette = ImagePalette.raw(
+ "BGRA", b"\0" * 4 * start + self.fp.read(4 * size)
+ )
+
+ # setup tile descriptor
+ try:
+ rawmode = MODES[(imagetype & 7, depth)]
+ if imagetype & 8:
+ # compressed
+ self.tile = [
+ (
+ "tga_rle",
+ (0, 0) + self.size,
+ self.fp.tell(),
+ (rawmode, orientation, depth),
+ )
+ ]
+ else:
+ self.tile = [
+ (
+ "raw",
+ (0, 0) + self.size,
+ self.fp.tell(),
+ (rawmode, 0, orientation),
+ )
+ ]
+ except KeyError:
+ pass # cannot decode
+
+
+#
+# --------------------------------------------------------------------
+# Write TGA file
+
+
+SAVE = {
+ "1": ("1", 1, 0, 3),
+ "L": ("L", 8, 0, 3),
+ "LA": ("LA", 16, 0, 3),
+ "P": ("P", 8, 1, 1),
+ "RGB": ("BGR", 24, 0, 2),
+ "RGBA": ("BGRA", 32, 0, 2),
+}
+
+
+def _save(im, fp, filename):
+
+ try:
+ rawmode, bits, colormaptype, imagetype = SAVE[im.mode]
+ except KeyError as e:
+ raise OSError(f"cannot write mode {im.mode} as TGA") from e
+
+ if "rle" in im.encoderinfo:
+ rle = im.encoderinfo["rle"]
+ else:
+ compression = im.encoderinfo.get("compression", im.info.get("compression"))
+ rle = compression == "tga_rle"
+ if rle:
+ imagetype += 8
+
+ id_section = im.encoderinfo.get("id_section", im.info.get("id_section", ""))
+ id_len = len(id_section)
+ if id_len > 255:
+ id_len = 255
+ id_section = id_section[:255]
+ warnings.warn("id_section has been trimmed to 255 characters")
+
+ if colormaptype:
+ colormapfirst, colormaplength, colormapentry = 0, 256, 24
+ else:
+ colormapfirst, colormaplength, colormapentry = 0, 0, 0
+
+ if im.mode in ("LA", "RGBA"):
+ flags = 8
+ else:
+ flags = 0
+
+ orientation = im.encoderinfo.get("orientation", im.info.get("orientation", -1))
+ if orientation > 0:
+ flags = flags | 0x20
+
+ fp.write(
+ o8(id_len)
+ + o8(colormaptype)
+ + o8(imagetype)
+ + o16(colormapfirst)
+ + o16(colormaplength)
+ + o8(colormapentry)
+ + o16(0)
+ + o16(0)
+ + o16(im.size[0])
+ + o16(im.size[1])
+ + o8(bits)
+ + o8(flags)
+ )
+
+ if id_section:
+ fp.write(id_section)
+
+ if colormaptype:
+ fp.write(im.im.getpalette("RGB", "BGR"))
+
+ if rle:
+ ImageFile._save(
+ im, fp, [("tga_rle", (0, 0) + im.size, 0, (rawmode, orientation))]
+ )
+ else:
+ ImageFile._save(
+ im, fp, [("raw", (0, 0) + im.size, 0, (rawmode, 0, orientation))]
+ )
+
+ # write targa version 2 footer
+ fp.write(b"\000" * 8 + b"TRUEVISION-XFILE." + b"\000")
+
+
+#
+# --------------------------------------------------------------------
+# Registry
+
+
+Image.register_open(TgaImageFile.format, TgaImageFile)
+Image.register_save(TgaImageFile.format, _save)
+
+Image.register_extensions(TgaImageFile.format, [".tga", ".icb", ".vda", ".vst"])
+
+Image.register_mime(TgaImageFile.format, "image/x-tga")
diff --git a/venv/Lib/site-packages/PIL/TiffImagePlugin.py b/venv/Lib/site-packages/PIL/TiffImagePlugin.py
new file mode 100644
index 0000000..9d821dc
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/TiffImagePlugin.py
@@ -0,0 +1,1940 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# TIFF file handling
+#
+# TIFF is a flexible, if somewhat aged, image file format originally
+# defined by Aldus. Although TIFF supports a wide variety of pixel
+# layouts and compression methods, the name doesn't really stand for
+# "thousands of incompatible file formats," it just feels that way.
+#
+# To read TIFF data from a stream, the stream must be seekable. For
+# progressive decoding, make sure to use TIFF files where the tag
+# directory is placed first in the file.
+#
+# History:
+# 1995-09-01 fl Created
+# 1996-05-04 fl Handle JPEGTABLES tag
+# 1996-05-18 fl Fixed COLORMAP support
+# 1997-01-05 fl Fixed PREDICTOR support
+# 1997-08-27 fl Added support for rational tags (from Perry Stoll)
+# 1998-01-10 fl Fixed seek/tell (from Jan Blom)
+# 1998-07-15 fl Use private names for internal variables
+# 1999-06-13 fl Rewritten for PIL 1.0 (1.0)
+# 2000-10-11 fl Additional fixes for Python 2.0 (1.1)
+# 2001-04-17 fl Fixed rewind support (seek to frame 0) (1.2)
+# 2001-05-12 fl Added write support for more tags (from Greg Couch) (1.3)
+# 2001-12-18 fl Added workaround for broken Matrox library
+# 2002-01-18 fl Don't mess up if photometric tag is missing (D. Alan Stewart)
+# 2003-05-19 fl Check FILLORDER tag
+# 2003-09-26 fl Added RGBa support
+# 2004-02-24 fl Added DPI support; fixed rational write support
+# 2005-02-07 fl Added workaround for broken Corel Draw 10 files
+# 2006-01-09 fl Added support for float/double tags (from Russell Nelson)
+#
+# Copyright (c) 1997-2006 by Secret Labs AB. All rights reserved.
+# Copyright (c) 1995-1997 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+import io
+import itertools
+import logging
+import os
+import struct
+import warnings
+from collections.abc import MutableMapping
+from fractions import Fraction
+from numbers import Number, Rational
+
+from . import Image, ImageFile, ImagePalette, TiffTags
+from ._binary import o8
+from .TiffTags import TYPES
+
+logger = logging.getLogger(__name__)
+
+# Set these to true to force use of libtiff for reading or writing.
+READ_LIBTIFF = False
+WRITE_LIBTIFF = False
+IFD_LEGACY_API = True
+
+II = b"II" # little-endian (Intel style)
+MM = b"MM" # big-endian (Motorola style)
+
+#
+# --------------------------------------------------------------------
+# Read TIFF files
+
+# a few tag names, just to make the code below a bit more readable
+IMAGEWIDTH = 256
+IMAGELENGTH = 257
+BITSPERSAMPLE = 258
+COMPRESSION = 259
+PHOTOMETRIC_INTERPRETATION = 262
+FILLORDER = 266
+IMAGEDESCRIPTION = 270
+STRIPOFFSETS = 273
+SAMPLESPERPIXEL = 277
+ROWSPERSTRIP = 278
+STRIPBYTECOUNTS = 279
+X_RESOLUTION = 282
+Y_RESOLUTION = 283
+PLANAR_CONFIGURATION = 284
+RESOLUTION_UNIT = 296
+TRANSFERFUNCTION = 301
+SOFTWARE = 305
+DATE_TIME = 306
+ARTIST = 315
+PREDICTOR = 317
+COLORMAP = 320
+TILEOFFSETS = 324
+SUBIFD = 330
+EXTRASAMPLES = 338
+SAMPLEFORMAT = 339
+JPEGTABLES = 347
+REFERENCEBLACKWHITE = 532
+COPYRIGHT = 33432
+IPTC_NAA_CHUNK = 33723 # newsphoto properties
+PHOTOSHOP_CHUNK = 34377 # photoshop properties
+ICCPROFILE = 34675
+EXIFIFD = 34665
+XMP = 700
+JPEGQUALITY = 65537 # pseudo-tag by libtiff
+
+# https://github.com/imagej/ImageJA/blob/master/src/main/java/ij/io/TiffDecoder.java
+IMAGEJ_META_DATA_BYTE_COUNTS = 50838
+IMAGEJ_META_DATA = 50839
+
+COMPRESSION_INFO = {
+ # Compression => pil compression name
+ 1: "raw",
+ 2: "tiff_ccitt",
+ 3: "group3",
+ 4: "group4",
+ 5: "tiff_lzw",
+ 6: "tiff_jpeg", # obsolete
+ 7: "jpeg",
+ 8: "tiff_adobe_deflate",
+ 32771: "tiff_raw_16", # 16-bit padding
+ 32773: "packbits",
+ 32809: "tiff_thunderscan",
+ 32946: "tiff_deflate",
+ 34676: "tiff_sgilog",
+ 34677: "tiff_sgilog24",
+ 34925: "lzma",
+ 50000: "zstd",
+ 50001: "webp",
+}
+
+COMPRESSION_INFO_REV = {v: k for k, v in COMPRESSION_INFO.items()}
+
+OPEN_INFO = {
+ # (ByteOrder, PhotoInterpretation, SampleFormat, FillOrder, BitsPerSample,
+ # ExtraSamples) => mode, rawmode
+ (II, 0, (1,), 1, (1,), ()): ("1", "1;I"),
+ (MM, 0, (1,), 1, (1,), ()): ("1", "1;I"),
+ (II, 0, (1,), 2, (1,), ()): ("1", "1;IR"),
+ (MM, 0, (1,), 2, (1,), ()): ("1", "1;IR"),
+ (II, 1, (1,), 1, (1,), ()): ("1", "1"),
+ (MM, 1, (1,), 1, (1,), ()): ("1", "1"),
+ (II, 1, (1,), 2, (1,), ()): ("1", "1;R"),
+ (MM, 1, (1,), 2, (1,), ()): ("1", "1;R"),
+ (II, 0, (1,), 1, (2,), ()): ("L", "L;2I"),
+ (MM, 0, (1,), 1, (2,), ()): ("L", "L;2I"),
+ (II, 0, (1,), 2, (2,), ()): ("L", "L;2IR"),
+ (MM, 0, (1,), 2, (2,), ()): ("L", "L;2IR"),
+ (II, 1, (1,), 1, (2,), ()): ("L", "L;2"),
+ (MM, 1, (1,), 1, (2,), ()): ("L", "L;2"),
+ (II, 1, (1,), 2, (2,), ()): ("L", "L;2R"),
+ (MM, 1, (1,), 2, (2,), ()): ("L", "L;2R"),
+ (II, 0, (1,), 1, (4,), ()): ("L", "L;4I"),
+ (MM, 0, (1,), 1, (4,), ()): ("L", "L;4I"),
+ (II, 0, (1,), 2, (4,), ()): ("L", "L;4IR"),
+ (MM, 0, (1,), 2, (4,), ()): ("L", "L;4IR"),
+ (II, 1, (1,), 1, (4,), ()): ("L", "L;4"),
+ (MM, 1, (1,), 1, (4,), ()): ("L", "L;4"),
+ (II, 1, (1,), 2, (4,), ()): ("L", "L;4R"),
+ (MM, 1, (1,), 2, (4,), ()): ("L", "L;4R"),
+ (II, 0, (1,), 1, (8,), ()): ("L", "L;I"),
+ (MM, 0, (1,), 1, (8,), ()): ("L", "L;I"),
+ (II, 0, (1,), 2, (8,), ()): ("L", "L;IR"),
+ (MM, 0, (1,), 2, (8,), ()): ("L", "L;IR"),
+ (II, 1, (1,), 1, (8,), ()): ("L", "L"),
+ (MM, 1, (1,), 1, (8,), ()): ("L", "L"),
+ (II, 1, (1,), 2, (8,), ()): ("L", "L;R"),
+ (MM, 1, (1,), 2, (8,), ()): ("L", "L;R"),
+ (II, 1, (1,), 1, (12,), ()): ("I;16", "I;12"),
+ (II, 1, (1,), 1, (16,), ()): ("I;16", "I;16"),
+ (MM, 1, (1,), 1, (16,), ()): ("I;16B", "I;16B"),
+ (II, 1, (2,), 1, (16,), ()): ("I", "I;16S"),
+ (MM, 1, (2,), 1, (16,), ()): ("I", "I;16BS"),
+ (II, 0, (3,), 1, (32,), ()): ("F", "F;32F"),
+ (MM, 0, (3,), 1, (32,), ()): ("F", "F;32BF"),
+ (II, 1, (1,), 1, (32,), ()): ("I", "I;32N"),
+ (II, 1, (2,), 1, (32,), ()): ("I", "I;32S"),
+ (MM, 1, (2,), 1, (32,), ()): ("I", "I;32BS"),
+ (II, 1, (3,), 1, (32,), ()): ("F", "F;32F"),
+ (MM, 1, (3,), 1, (32,), ()): ("F", "F;32BF"),
+ (II, 1, (1,), 1, (8, 8), (2,)): ("LA", "LA"),
+ (MM, 1, (1,), 1, (8, 8), (2,)): ("LA", "LA"),
+ (II, 2, (1,), 1, (8, 8, 8), ()): ("RGB", "RGB"),
+ (MM, 2, (1,), 1, (8, 8, 8), ()): ("RGB", "RGB"),
+ (II, 2, (1,), 2, (8, 8, 8), ()): ("RGB", "RGB;R"),
+ (MM, 2, (1,), 2, (8, 8, 8), ()): ("RGB", "RGB;R"),
+ (II, 2, (1,), 1, (8, 8, 8, 8), ()): ("RGBA", "RGBA"), # missing ExtraSamples
+ (MM, 2, (1,), 1, (8, 8, 8, 8), ()): ("RGBA", "RGBA"), # missing ExtraSamples
+ (II, 2, (1,), 1, (8, 8, 8, 8), (0,)): ("RGBX", "RGBX"),
+ (MM, 2, (1,), 1, (8, 8, 8, 8), (0,)): ("RGBX", "RGBX"),
+ (II, 2, (1,), 1, (8, 8, 8, 8, 8), (0, 0)): ("RGBX", "RGBXX"),
+ (MM, 2, (1,), 1, (8, 8, 8, 8, 8), (0, 0)): ("RGBX", "RGBXX"),
+ (II, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0, 0)): ("RGBX", "RGBXXX"),
+ (MM, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0, 0)): ("RGBX", "RGBXXX"),
+ (II, 2, (1,), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBa"),
+ (MM, 2, (1,), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBa"),
+ (II, 2, (1,), 1, (8, 8, 8, 8, 8), (1, 0)): ("RGBA", "RGBaX"),
+ (MM, 2, (1,), 1, (8, 8, 8, 8, 8), (1, 0)): ("RGBA", "RGBaX"),
+ (II, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (1, 0, 0)): ("RGBA", "RGBaXX"),
+ (MM, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (1, 0, 0)): ("RGBA", "RGBaXX"),
+ (II, 2, (1,), 1, (8, 8, 8, 8), (2,)): ("RGBA", "RGBA"),
+ (MM, 2, (1,), 1, (8, 8, 8, 8), (2,)): ("RGBA", "RGBA"),
+ (II, 2, (1,), 1, (8, 8, 8, 8, 8), (2, 0)): ("RGBA", "RGBAX"),
+ (MM, 2, (1,), 1, (8, 8, 8, 8, 8), (2, 0)): ("RGBA", "RGBAX"),
+ (II, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (2, 0, 0)): ("RGBA", "RGBAXX"),
+ (MM, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (2, 0, 0)): ("RGBA", "RGBAXX"),
+ (II, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10
+ (MM, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10
+ (II, 2, (1,), 1, (16, 16, 16), ()): ("RGB", "RGB;16L"),
+ (MM, 2, (1,), 1, (16, 16, 16), ()): ("RGB", "RGB;16B"),
+ (II, 2, (1,), 1, (16, 16, 16, 16), ()): ("RGBA", "RGBA;16L"),
+ (MM, 2, (1,), 1, (16, 16, 16, 16), ()): ("RGBA", "RGBA;16B"),
+ (II, 2, (1,), 1, (16, 16, 16, 16), (0,)): ("RGBX", "RGBX;16L"),
+ (MM, 2, (1,), 1, (16, 16, 16, 16), (0,)): ("RGBX", "RGBX;16B"),
+ (II, 2, (1,), 1, (16, 16, 16, 16), (1,)): ("RGBA", "RGBa;16L"),
+ (MM, 2, (1,), 1, (16, 16, 16, 16), (1,)): ("RGBA", "RGBa;16B"),
+ (II, 2, (1,), 1, (16, 16, 16, 16), (2,)): ("RGBA", "RGBA;16L"),
+ (MM, 2, (1,), 1, (16, 16, 16, 16), (2,)): ("RGBA", "RGBA;16B"),
+ (II, 3, (1,), 1, (1,), ()): ("P", "P;1"),
+ (MM, 3, (1,), 1, (1,), ()): ("P", "P;1"),
+ (II, 3, (1,), 2, (1,), ()): ("P", "P;1R"),
+ (MM, 3, (1,), 2, (1,), ()): ("P", "P;1R"),
+ (II, 3, (1,), 1, (2,), ()): ("P", "P;2"),
+ (MM, 3, (1,), 1, (2,), ()): ("P", "P;2"),
+ (II, 3, (1,), 2, (2,), ()): ("P", "P;2R"),
+ (MM, 3, (1,), 2, (2,), ()): ("P", "P;2R"),
+ (II, 3, (1,), 1, (4,), ()): ("P", "P;4"),
+ (MM, 3, (1,), 1, (4,), ()): ("P", "P;4"),
+ (II, 3, (1,), 2, (4,), ()): ("P", "P;4R"),
+ (MM, 3, (1,), 2, (4,), ()): ("P", "P;4R"),
+ (II, 3, (1,), 1, (8,), ()): ("P", "P"),
+ (MM, 3, (1,), 1, (8,), ()): ("P", "P"),
+ (II, 3, (1,), 1, (8, 8), (2,)): ("PA", "PA"),
+ (MM, 3, (1,), 1, (8, 8), (2,)): ("PA", "PA"),
+ (II, 3, (1,), 2, (8,), ()): ("P", "P;R"),
+ (MM, 3, (1,), 2, (8,), ()): ("P", "P;R"),
+ (II, 5, (1,), 1, (8, 8, 8, 8), ()): ("CMYK", "CMYK"),
+ (MM, 5, (1,), 1, (8, 8, 8, 8), ()): ("CMYK", "CMYK"),
+ (II, 5, (1,), 1, (8, 8, 8, 8, 8), (0,)): ("CMYK", "CMYKX"),
+ (MM, 5, (1,), 1, (8, 8, 8, 8, 8), (0,)): ("CMYK", "CMYKX"),
+ (II, 5, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0)): ("CMYK", "CMYKXX"),
+ (MM, 5, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0)): ("CMYK", "CMYKXX"),
+ (II, 5, (1,), 1, (16, 16, 16, 16), ()): ("CMYK", "CMYK;16L"),
+ # JPEG compressed images handled by LibTiff and auto-converted to RGBX
+ # Minimal Baseline TIFF requires YCbCr images to have 3 SamplesPerPixel
+ (II, 6, (1,), 1, (8, 8, 8), ()): ("RGB", "RGBX"),
+ (MM, 6, (1,), 1, (8, 8, 8), ()): ("RGB", "RGBX"),
+ (II, 8, (1,), 1, (8, 8, 8), ()): ("LAB", "LAB"),
+ (MM, 8, (1,), 1, (8, 8, 8), ()): ("LAB", "LAB"),
+}
+
+PREFIXES = [
+ b"MM\x00\x2A", # Valid TIFF header with big-endian byte order
+ b"II\x2A\x00", # Valid TIFF header with little-endian byte order
+ b"MM\x2A\x00", # Invalid TIFF header, assume big-endian
+ b"II\x00\x2A", # Invalid TIFF header, assume little-endian
+]
+
+
+def _accept(prefix):
+ return prefix[:4] in PREFIXES
+
+
+def _limit_rational(val, max_val):
+ inv = abs(val) > 1
+ n_d = IFDRational(1 / val if inv else val).limit_rational(max_val)
+ return n_d[::-1] if inv else n_d
+
+
+def _limit_signed_rational(val, max_val, min_val):
+ frac = Fraction(val)
+ n_d = frac.numerator, frac.denominator
+
+ if min(n_d) < min_val:
+ n_d = _limit_rational(val, abs(min_val))
+
+ if max(n_d) > max_val:
+ val = Fraction(*n_d)
+ n_d = _limit_rational(val, max_val)
+
+ return n_d
+
+
+##
+# Wrapper for TIFF IFDs.
+
+_load_dispatch = {}
+_write_dispatch = {}
+
+
+class IFDRational(Rational):
+ """Implements a rational class where 0/0 is a legal value to match
+ the in the wild use of exif rationals.
+
+ e.g., DigitalZoomRatio - 0.00/0.00 indicates that no digital zoom was used
+ """
+
+ """ If the denominator is 0, store this as a float('nan'), otherwise store
+ as a fractions.Fraction(). Delegate as appropriate
+
+ """
+
+ __slots__ = ("_numerator", "_denominator", "_val")
+
+ def __init__(self, value, denominator=1):
+ """
+ :param value: either an integer numerator, a
+ float/rational/other number, or an IFDRational
+ :param denominator: Optional integer denominator
+ """
+ if isinstance(value, IFDRational):
+ self._numerator = value.numerator
+ self._denominator = value.denominator
+ self._val = value._val
+ return
+
+ if isinstance(value, Fraction):
+ self._numerator = value.numerator
+ self._denominator = value.denominator
+ else:
+ self._numerator = value
+ self._denominator = denominator
+
+ if denominator == 0:
+ self._val = float("nan")
+ elif denominator == 1:
+ self._val = Fraction(value)
+ else:
+ self._val = Fraction(value, denominator)
+
+ @property
+ def numerator(a):
+ return a._numerator
+
+ @property
+ def denominator(a):
+ return a._denominator
+
+ def limit_rational(self, max_denominator):
+ """
+
+ :param max_denominator: Integer, the maximum denominator value
+ :returns: Tuple of (numerator, denominator)
+ """
+
+ if self.denominator == 0:
+ return (self.numerator, self.denominator)
+
+ f = self._val.limit_denominator(max_denominator)
+ return (f.numerator, f.denominator)
+
+ def __repr__(self):
+ return str(float(self._val))
+
+ def __hash__(self):
+ return self._val.__hash__()
+
+ def __eq__(self, other):
+ if isinstance(other, IFDRational):
+ other = other._val
+ return self._val == other
+
+ def _delegate(op):
+ def delegate(self, *args):
+ return getattr(self._val, op)(*args)
+
+ return delegate
+
+ """ a = ['add','radd', 'sub', 'rsub', 'mul', 'rmul',
+ 'truediv', 'rtruediv', 'floordiv', 'rfloordiv',
+ 'mod','rmod', 'pow','rpow', 'pos', 'neg',
+ 'abs', 'trunc', 'lt', 'gt', 'le', 'ge', 'bool',
+ 'ceil', 'floor', 'round']
+ print("\n".join("__%s__ = _delegate('__%s__')" % (s,s) for s in a))
+ """
+
+ __add__ = _delegate("__add__")
+ __radd__ = _delegate("__radd__")
+ __sub__ = _delegate("__sub__")
+ __rsub__ = _delegate("__rsub__")
+ __mul__ = _delegate("__mul__")
+ __rmul__ = _delegate("__rmul__")
+ __truediv__ = _delegate("__truediv__")
+ __rtruediv__ = _delegate("__rtruediv__")
+ __floordiv__ = _delegate("__floordiv__")
+ __rfloordiv__ = _delegate("__rfloordiv__")
+ __mod__ = _delegate("__mod__")
+ __rmod__ = _delegate("__rmod__")
+ __pow__ = _delegate("__pow__")
+ __rpow__ = _delegate("__rpow__")
+ __pos__ = _delegate("__pos__")
+ __neg__ = _delegate("__neg__")
+ __abs__ = _delegate("__abs__")
+ __trunc__ = _delegate("__trunc__")
+ __lt__ = _delegate("__lt__")
+ __gt__ = _delegate("__gt__")
+ __le__ = _delegate("__le__")
+ __ge__ = _delegate("__ge__")
+ __bool__ = _delegate("__bool__")
+ __ceil__ = _delegate("__ceil__")
+ __floor__ = _delegate("__floor__")
+ __round__ = _delegate("__round__")
+
+
+class ImageFileDirectory_v2(MutableMapping):
+ """This class represents a TIFF tag directory. To speed things up, we
+ don't decode tags unless they're asked for.
+
+ Exposes a dictionary interface of the tags in the directory::
+
+ ifd = ImageFileDirectory_v2()
+ ifd[key] = 'Some Data'
+ ifd.tagtype[key] = TiffTags.ASCII
+ print(ifd[key])
+ 'Some Data'
+
+ Individual values are returned as the strings or numbers, sequences are
+ returned as tuples of the values.
+
+ The tiff metadata type of each item is stored in a dictionary of
+ tag types in
+ :attr:`~PIL.TiffImagePlugin.ImageFileDirectory_v2.tagtype`. The types
+ are read from a tiff file, guessed from the type added, or added
+ manually.
+
+ Data Structures:
+
+ * self.tagtype = {}
+
+ * Key: numerical tiff tag number
+ * Value: integer corresponding to the data type from
+ ~PIL.TiffTags.TYPES`
+
+ .. versionadded:: 3.0.0
+ """
+
+ """
+ Documentation:
+
+ 'internal' data structures:
+ * self._tags_v2 = {} Key: numerical tiff tag number
+ Value: decoded data, as tuple for multiple values
+ * self._tagdata = {} Key: numerical tiff tag number
+ Value: undecoded byte string from file
+ * self._tags_v1 = {} Key: numerical tiff tag number
+ Value: decoded data in the v1 format
+
+ Tags will be found in the private attributes self._tagdata, and in
+ self._tags_v2 once decoded.
+
+ Self.legacy_api is a value for internal use, and shouldn't be
+ changed from outside code. In cooperation with the
+ ImageFileDirectory_v1 class, if legacy_api is true, then decoded
+ tags will be populated into both _tags_v1 and _tags_v2. _Tags_v2
+ will be used if this IFD is used in the TIFF save routine. Tags
+ should be read from tags_v1 if legacy_api == true.
+
+ """
+
+ def __init__(self, ifh=b"II\052\0\0\0\0\0", prefix=None):
+ """Initialize an ImageFileDirectory.
+
+ To construct an ImageFileDirectory from a real file, pass the 8-byte
+ magic header to the constructor. To only set the endianness, pass it
+ as the 'prefix' keyword argument.
+
+ :param ifh: One of the accepted magic headers (cf. PREFIXES); also sets
+ endianness.
+ :param prefix: Override the endianness of the file.
+ """
+ if ifh[:4] not in PREFIXES:
+ raise SyntaxError(f"not a TIFF file (header {repr(ifh)} not valid)")
+ self._prefix = prefix if prefix is not None else ifh[:2]
+ if self._prefix == MM:
+ self._endian = ">"
+ elif self._prefix == II:
+ self._endian = "<"
+ else:
+ raise SyntaxError("not a TIFF IFD")
+ self.tagtype = {}
+ """ Dictionary of tag types """
+ self.reset()
+ (self.next,) = self._unpack("L", ifh[4:])
+ self._legacy_api = False
+
+ prefix = property(lambda self: self._prefix)
+ offset = property(lambda self: self._offset)
+ legacy_api = property(lambda self: self._legacy_api)
+
+ @legacy_api.setter
+ def legacy_api(self, value):
+ raise Exception("Not allowing setting of legacy api")
+
+ def reset(self):
+ self._tags_v1 = {} # will remain empty if legacy_api is false
+ self._tags_v2 = {} # main tag storage
+ self._tagdata = {}
+ self.tagtype = {} # added 2008-06-05 by Florian Hoech
+ self._next = None
+ self._offset = None
+
+ def __str__(self):
+ return str(dict(self))
+
+ def named(self):
+ """
+ :returns: dict of name|key: value
+
+ Returns the complete tag dictionary, with named tags where possible.
+ """
+ return {TiffTags.lookup(code).name: value for code, value in self.items()}
+
+ def __len__(self):
+ return len(set(self._tagdata) | set(self._tags_v2))
+
+ def __getitem__(self, tag):
+ if tag not in self._tags_v2: # unpack on the fly
+ data = self._tagdata[tag]
+ typ = self.tagtype[tag]
+ size, handler = self._load_dispatch[typ]
+ self[tag] = handler(self, data, self.legacy_api) # check type
+ val = self._tags_v2[tag]
+ if self.legacy_api and not isinstance(val, (tuple, bytes)):
+ val = (val,)
+ return val
+
+ def __contains__(self, tag):
+ return tag in self._tags_v2 or tag in self._tagdata
+
+ def __setitem__(self, tag, value):
+ self._setitem(tag, value, self.legacy_api)
+
+ def _setitem(self, tag, value, legacy_api):
+ basetypes = (Number, bytes, str)
+
+ info = TiffTags.lookup(tag)
+ values = [value] if isinstance(value, basetypes) else value
+
+ if tag not in self.tagtype:
+ if info.type:
+ self.tagtype[tag] = info.type
+ else:
+ self.tagtype[tag] = TiffTags.UNDEFINED
+ if all(isinstance(v, IFDRational) for v in values):
+ self.tagtype[tag] = (
+ TiffTags.RATIONAL
+ if all(v >= 0 for v in values)
+ else TiffTags.SIGNED_RATIONAL
+ )
+ elif all(isinstance(v, int) for v in values):
+ if all(0 <= v < 2 ** 16 for v in values):
+ self.tagtype[tag] = TiffTags.SHORT
+ elif all(-(2 ** 15) < v < 2 ** 15 for v in values):
+ self.tagtype[tag] = TiffTags.SIGNED_SHORT
+ else:
+ self.tagtype[tag] = (
+ TiffTags.LONG
+ if all(v >= 0 for v in values)
+ else TiffTags.SIGNED_LONG
+ )
+ elif all(isinstance(v, float) for v in values):
+ self.tagtype[tag] = TiffTags.DOUBLE
+ elif all(isinstance(v, str) for v in values):
+ self.tagtype[tag] = TiffTags.ASCII
+ elif all(isinstance(v, bytes) for v in values):
+ self.tagtype[tag] = TiffTags.BYTE
+
+ if self.tagtype[tag] == TiffTags.UNDEFINED:
+ values = [
+ value.encode("ascii", "replace") if isinstance(value, str) else value
+ ]
+ elif self.tagtype[tag] == TiffTags.RATIONAL:
+ values = [float(v) if isinstance(v, int) else v for v in values]
+
+ is_ifd = self.tagtype[tag] == TiffTags.LONG and isinstance(values, dict)
+ if not is_ifd:
+ values = tuple(info.cvt_enum(value) for value in values)
+
+ dest = self._tags_v1 if legacy_api else self._tags_v2
+
+ # Three branches:
+ # Spec'd length == 1, Actual length 1, store as element
+ # Spec'd length == 1, Actual > 1, Warn and truncate. Formerly barfed.
+ # No Spec, Actual length 1, Formerly (<4.2) returned a 1 element tuple.
+ # Don't mess with the legacy api, since it's frozen.
+ if not is_ifd and (
+ (info.length == 1)
+ or self.tagtype[tag] == TiffTags.BYTE
+ or (info.length is None and len(values) == 1 and not legacy_api)
+ ):
+ # Don't mess with the legacy api, since it's frozen.
+ if legacy_api and self.tagtype[tag] in [
+ TiffTags.RATIONAL,
+ TiffTags.SIGNED_RATIONAL,
+ ]: # rationals
+ values = (values,)
+ try:
+ (dest[tag],) = values
+ except ValueError:
+ # We've got a builtin tag with 1 expected entry
+ warnings.warn(
+ f"Metadata Warning, tag {tag} had too many entries: "
+ f"{len(values)}, expected 1"
+ )
+ dest[tag] = values[0]
+
+ else:
+ # Spec'd length > 1 or undefined
+ # Unspec'd, and length > 1
+ dest[tag] = values
+
+ def __delitem__(self, tag):
+ self._tags_v2.pop(tag, None)
+ self._tags_v1.pop(tag, None)
+ self._tagdata.pop(tag, None)
+
+ def __iter__(self):
+ return iter(set(self._tagdata) | set(self._tags_v2))
+
+ def _unpack(self, fmt, data):
+ return struct.unpack(self._endian + fmt, data)
+
+ def _pack(self, fmt, *values):
+ return struct.pack(self._endian + fmt, *values)
+
+ def _register_loader(idx, size):
+ def decorator(func):
+ from .TiffTags import TYPES
+
+ if func.__name__.startswith("load_"):
+ TYPES[idx] = func.__name__[5:].replace("_", " ")
+ _load_dispatch[idx] = size, func # noqa: F821
+ return func
+
+ return decorator
+
+ def _register_writer(idx):
+ def decorator(func):
+ _write_dispatch[idx] = func # noqa: F821
+ return func
+
+ return decorator
+
+ def _register_basic(idx_fmt_name):
+ from .TiffTags import TYPES
+
+ idx, fmt, name = idx_fmt_name
+ TYPES[idx] = name
+ size = struct.calcsize("=" + fmt)
+ _load_dispatch[idx] = ( # noqa: F821
+ size,
+ lambda self, data, legacy_api=True: (
+ self._unpack("{}{}".format(len(data) // size, fmt), data)
+ ),
+ )
+ _write_dispatch[idx] = lambda self, *values: ( # noqa: F821
+ b"".join(self._pack(fmt, value) for value in values)
+ )
+
+ list(
+ map(
+ _register_basic,
+ [
+ (TiffTags.SHORT, "H", "short"),
+ (TiffTags.LONG, "L", "long"),
+ (TiffTags.SIGNED_BYTE, "b", "signed byte"),
+ (TiffTags.SIGNED_SHORT, "h", "signed short"),
+ (TiffTags.SIGNED_LONG, "l", "signed long"),
+ (TiffTags.FLOAT, "f", "float"),
+ (TiffTags.DOUBLE, "d", "double"),
+ (TiffTags.IFD, "L", "long"),
+ ],
+ )
+ )
+
+ @_register_loader(1, 1) # Basic type, except for the legacy API.
+ def load_byte(self, data, legacy_api=True):
+ return data
+
+ @_register_writer(1) # Basic type, except for the legacy API.
+ def write_byte(self, data):
+ return data
+
+ @_register_loader(2, 1)
+ def load_string(self, data, legacy_api=True):
+ if data.endswith(b"\0"):
+ data = data[:-1]
+ return data.decode("latin-1", "replace")
+
+ @_register_writer(2)
+ def write_string(self, value):
+ # remerge of https://github.com/python-pillow/Pillow/pull/1416
+ return b"" + value.encode("ascii", "replace") + b"\0"
+
+ @_register_loader(5, 8)
+ def load_rational(self, data, legacy_api=True):
+ vals = self._unpack("{}L".format(len(data) // 4), data)
+
+ def combine(a, b):
+ return (a, b) if legacy_api else IFDRational(a, b)
+
+ return tuple(combine(num, denom) for num, denom in zip(vals[::2], vals[1::2]))
+
+ @_register_writer(5)
+ def write_rational(self, *values):
+ return b"".join(
+ self._pack("2L", *_limit_rational(frac, 2 ** 32 - 1)) for frac in values
+ )
+
+ @_register_loader(7, 1)
+ def load_undefined(self, data, legacy_api=True):
+ return data
+
+ @_register_writer(7)
+ def write_undefined(self, value):
+ return value
+
+ @_register_loader(10, 8)
+ def load_signed_rational(self, data, legacy_api=True):
+ vals = self._unpack("{}l".format(len(data) // 4), data)
+
+ def combine(a, b):
+ return (a, b) if legacy_api else IFDRational(a, b)
+
+ return tuple(combine(num, denom) for num, denom in zip(vals[::2], vals[1::2]))
+
+ @_register_writer(10)
+ def write_signed_rational(self, *values):
+ return b"".join(
+ self._pack("2l", *_limit_signed_rational(frac, 2 ** 31 - 1, -(2 ** 31)))
+ for frac in values
+ )
+
+ def _ensure_read(self, fp, size):
+ ret = fp.read(size)
+ if len(ret) != size:
+ raise OSError(
+ "Corrupt EXIF data. "
+ f"Expecting to read {size} bytes but only got {len(ret)}. "
+ )
+ return ret
+
+ def load(self, fp):
+
+ self.reset()
+ self._offset = fp.tell()
+
+ try:
+ for i in range(self._unpack("H", self._ensure_read(fp, 2))[0]):
+ tag, typ, count, data = self._unpack("HHL4s", self._ensure_read(fp, 12))
+
+ tagname = TiffTags.lookup(tag).name
+ typname = TYPES.get(typ, "unknown")
+ msg = f"tag: {tagname} ({tag}) - type: {typname} ({typ})"
+
+ try:
+ unit_size, handler = self._load_dispatch[typ]
+ except KeyError:
+ logger.debug(msg + f" - unsupported type {typ}")
+ continue # ignore unsupported type
+ size = count * unit_size
+ if size > 4:
+ here = fp.tell()
+ (offset,) = self._unpack("L", data)
+ msg += f" Tag Location: {here} - Data Location: {offset}"
+ fp.seek(offset)
+ data = ImageFile._safe_read(fp, size)
+ fp.seek(here)
+ else:
+ data = data[:size]
+
+ if len(data) != size:
+ warnings.warn(
+ "Possibly corrupt EXIF data. "
+ f"Expecting to read {size} bytes but only got {len(data)}."
+ f" Skipping tag {tag}"
+ )
+ logger.debug(msg)
+ continue
+
+ if not data:
+ logger.debug(msg)
+ continue
+
+ self._tagdata[tag] = data
+ self.tagtype[tag] = typ
+
+ msg += " - value: " + (
+ "" % size if size > 32 else repr(data)
+ )
+ logger.debug(msg)
+
+ (self.next,) = self._unpack("L", self._ensure_read(fp, 4))
+ except OSError as msg:
+ warnings.warn(str(msg))
+ return
+
+ def tobytes(self, offset=0):
+ # FIXME What about tagdata?
+ result = self._pack("H", len(self._tags_v2))
+
+ entries = []
+ offset = offset + len(result) + len(self._tags_v2) * 12 + 4
+ stripoffsets = None
+
+ # pass 1: convert tags to binary format
+ # always write tags in ascending order
+ for tag, value in sorted(self._tags_v2.items()):
+ if tag == STRIPOFFSETS:
+ stripoffsets = len(entries)
+ typ = self.tagtype.get(tag)
+ logger.debug(f"Tag {tag}, Type: {typ}, Value: {repr(value)}")
+ is_ifd = typ == TiffTags.LONG and isinstance(value, dict)
+ if is_ifd:
+ if self._endian == "<":
+ ifh = b"II\x2A\x00\x08\x00\x00\x00"
+ else:
+ ifh = b"MM\x00\x2A\x00\x00\x00\x08"
+ ifd = ImageFileDirectory_v2(ifh)
+ for ifd_tag, ifd_value in self._tags_v2[tag].items():
+ ifd[ifd_tag] = ifd_value
+ data = ifd.tobytes(offset)
+ else:
+ values = value if isinstance(value, tuple) else (value,)
+ data = self._write_dispatch[typ](self, *values)
+
+ tagname = TiffTags.lookup(tag).name
+ typname = "ifd" if is_ifd else TYPES.get(typ, "unknown")
+ msg = f"save: {tagname} ({tag}) - type: {typname} ({typ})"
+ msg += " - value: " + (
+ "" % len(data) if len(data) >= 16 else str(values)
+ )
+ logger.debug(msg)
+
+ # count is sum of lengths for string and arbitrary data
+ if is_ifd:
+ count = 1
+ elif typ in [TiffTags.BYTE, TiffTags.ASCII, TiffTags.UNDEFINED]:
+ count = len(data)
+ else:
+ count = len(values)
+ # figure out if data fits into the entry
+ if len(data) <= 4:
+ entries.append((tag, typ, count, data.ljust(4, b"\0"), b""))
+ else:
+ entries.append((tag, typ, count, self._pack("L", offset), data))
+ offset += (len(data) + 1) // 2 * 2 # pad to word
+
+ # update strip offset data to point beyond auxiliary data
+ if stripoffsets is not None:
+ tag, typ, count, value, data = entries[stripoffsets]
+ if data:
+ raise NotImplementedError("multistrip support not yet implemented")
+ value = self._pack("L", self._unpack("L", value)[0] + offset)
+ entries[stripoffsets] = tag, typ, count, value, data
+
+ # pass 2: write entries to file
+ for tag, typ, count, value, data in entries:
+ logger.debug(f"{tag} {typ} {count} {repr(value)} {repr(data)}")
+ result += self._pack("HHL4s", tag, typ, count, value)
+
+ # -- overwrite here for multi-page --
+ result += b"\0\0\0\0" # end of entries
+
+ # pass 3: write auxiliary data to file
+ for tag, typ, count, value, data in entries:
+ result += data
+ if len(data) & 1:
+ result += b"\0"
+
+ return result
+
+ def save(self, fp):
+
+ if fp.tell() == 0: # skip TIFF header on subsequent pages
+ # tiff header -- PIL always starts the first IFD at offset 8
+ fp.write(self._prefix + self._pack("HL", 42, 8))
+
+ offset = fp.tell()
+ result = self.tobytes(offset)
+ fp.write(result)
+ return offset + len(result)
+
+
+ImageFileDirectory_v2._load_dispatch = _load_dispatch
+ImageFileDirectory_v2._write_dispatch = _write_dispatch
+for idx, name in TYPES.items():
+ name = name.replace(" ", "_")
+ setattr(ImageFileDirectory_v2, "load_" + name, _load_dispatch[idx][1])
+ setattr(ImageFileDirectory_v2, "write_" + name, _write_dispatch[idx])
+del _load_dispatch, _write_dispatch, idx, name
+
+
+# Legacy ImageFileDirectory support.
+class ImageFileDirectory_v1(ImageFileDirectory_v2):
+ """This class represents the **legacy** interface to a TIFF tag directory.
+
+ Exposes a dictionary interface of the tags in the directory::
+
+ ifd = ImageFileDirectory_v1()
+ ifd[key] = 'Some Data'
+ ifd.tagtype[key] = TiffTags.ASCII
+ print(ifd[key])
+ ('Some Data',)
+
+ Also contains a dictionary of tag types as read from the tiff image file,
+ :attr:`~PIL.TiffImagePlugin.ImageFileDirectory_v1.tagtype`.
+
+ Values are returned as a tuple.
+
+ .. deprecated:: 3.0.0
+ """
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self._legacy_api = True
+
+ tags = property(lambda self: self._tags_v1)
+ tagdata = property(lambda self: self._tagdata)
+
+ # defined in ImageFileDirectory_v2
+ tagtype: dict
+ """Dictionary of tag types"""
+
+ @classmethod
+ def from_v2(cls, original):
+ """Returns an
+ :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1`
+ instance with the same data as is contained in the original
+ :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2`
+ instance.
+
+ :returns: :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1`
+
+ """
+
+ ifd = cls(prefix=original.prefix)
+ ifd._tagdata = original._tagdata
+ ifd.tagtype = original.tagtype
+ ifd.next = original.next # an indicator for multipage tiffs
+ return ifd
+
+ def to_v2(self):
+ """Returns an
+ :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2`
+ instance with the same data as is contained in the original
+ :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1`
+ instance.
+
+ :returns: :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2`
+
+ """
+
+ ifd = ImageFileDirectory_v2(prefix=self.prefix)
+ ifd._tagdata = dict(self._tagdata)
+ ifd.tagtype = dict(self.tagtype)
+ ifd._tags_v2 = dict(self._tags_v2)
+ return ifd
+
+ def __contains__(self, tag):
+ return tag in self._tags_v1 or tag in self._tagdata
+
+ def __len__(self):
+ return len(set(self._tagdata) | set(self._tags_v1))
+
+ def __iter__(self):
+ return iter(set(self._tagdata) | set(self._tags_v1))
+
+ def __setitem__(self, tag, value):
+ for legacy_api in (False, True):
+ self._setitem(tag, value, legacy_api)
+
+ def __getitem__(self, tag):
+ if tag not in self._tags_v1: # unpack on the fly
+ data = self._tagdata[tag]
+ typ = self.tagtype[tag]
+ size, handler = self._load_dispatch[typ]
+ for legacy in (False, True):
+ self._setitem(tag, handler(self, data, legacy), legacy)
+ val = self._tags_v1[tag]
+ if not isinstance(val, (tuple, bytes)):
+ val = (val,)
+ return val
+
+
+# undone -- switch this pointer when IFD_LEGACY_API == False
+ImageFileDirectory = ImageFileDirectory_v1
+
+
+##
+# Image plugin for TIFF files.
+
+
+class TiffImageFile(ImageFile.ImageFile):
+
+ format = "TIFF"
+ format_description = "Adobe TIFF"
+ _close_exclusive_fp_after_loading = False
+
+ def __init__(self, fp=None, filename=None):
+ self.tag_v2 = None
+ """ Image file directory (tag dictionary) """
+
+ self.tag = None
+ """ Legacy tag entries """
+
+ super().__init__(fp, filename)
+
+ def _open(self):
+ """Open the first image in a TIFF file"""
+
+ # Header
+ ifh = self.fp.read(8)
+
+ self.tag_v2 = ImageFileDirectory_v2(ifh)
+
+ # legacy IFD entries will be filled in later
+ self.ifd = None
+
+ # setup frame pointers
+ self.__first = self.__next = self.tag_v2.next
+ self.__frame = -1
+ self.__fp = self.fp
+ self._frame_pos = []
+ self._n_frames = None
+
+ logger.debug("*** TiffImageFile._open ***")
+ logger.debug(f"- __first: {self.__first}")
+ logger.debug(f"- ifh: {repr(ifh)}") # Use repr to avoid str(bytes)
+
+ # and load the first frame
+ self._seek(0)
+
+ @property
+ def n_frames(self):
+ if self._n_frames is None:
+ current = self.tell()
+ self._seek(len(self._frame_pos))
+ while self._n_frames is None:
+ self._seek(self.tell() + 1)
+ self.seek(current)
+ return self._n_frames
+
+ def seek(self, frame):
+ """Select a given frame as current image"""
+ if not self._seek_check(frame):
+ return
+ self._seek(frame)
+ # Create a new core image object on second and
+ # subsequent frames in the image. Image may be
+ # different size/mode.
+ Image._decompression_bomb_check(self.size)
+ self.im = Image.core.new(self.mode, self.size)
+
+ def _seek(self, frame):
+ self.fp = self.__fp
+ while len(self._frame_pos) <= frame:
+ if not self.__next:
+ raise EOFError("no more images in TIFF file")
+ logger.debug(
+ f"Seeking to frame {frame}, on frame {self.__frame}, "
+ f"__next {self.__next}, location: {self.fp.tell()}"
+ )
+ # reset buffered io handle in case fp
+ # was passed to libtiff, invalidating the buffer
+ self.fp.tell()
+ self.fp.seek(self.__next)
+ self._frame_pos.append(self.__next)
+ logger.debug("Loading tags, location: %s" % self.fp.tell())
+ self.tag_v2.load(self.fp)
+ self.__next = self.tag_v2.next
+ if self.__next == 0:
+ self._n_frames = frame + 1
+ if len(self._frame_pos) == 1:
+ self.is_animated = self.__next != 0
+ self.__frame += 1
+ self.fp.seek(self._frame_pos[frame])
+ self.tag_v2.load(self.fp)
+ # fill the legacy tag/ifd entries
+ self.tag = self.ifd = ImageFileDirectory_v1.from_v2(self.tag_v2)
+ self.__frame = frame
+ self._setup()
+
+ def tell(self):
+ """Return the current frame number"""
+ return self.__frame
+
+ def load(self):
+ if self.tile and self.use_load_libtiff:
+ return self._load_libtiff()
+ return super().load()
+
+ def load_end(self):
+ if self._tile_orientation:
+ method = {
+ 2: Image.FLIP_LEFT_RIGHT,
+ 3: Image.ROTATE_180,
+ 4: Image.FLIP_TOP_BOTTOM,
+ 5: Image.TRANSPOSE,
+ 6: Image.ROTATE_270,
+ 7: Image.TRANSVERSE,
+ 8: Image.ROTATE_90,
+ }.get(self._tile_orientation)
+ if method is not None:
+ self.im = self.im.transpose(method)
+ self._size = self.im.size
+
+ # allow closing if we're on the first frame, there's no next
+ # This is the ImageFile.load path only, libtiff specific below.
+ if not self.is_animated:
+ self._close_exclusive_fp_after_loading = True
+
+ def _load_libtiff(self):
+ """Overload method triggered when we detect a compressed tiff
+ Calls out to libtiff"""
+
+ Image.Image.load(self)
+
+ self.load_prepare()
+
+ if not len(self.tile) == 1:
+ raise OSError("Not exactly one tile")
+
+ # (self._compression, (extents tuple),
+ # 0, (rawmode, self._compression, fp))
+ extents = self.tile[0][1]
+ args = list(self.tile[0][3])
+
+ # To be nice on memory footprint, if there's a
+ # file descriptor, use that instead of reading
+ # into a string in python.
+ # libtiff closes the file descriptor, so pass in a dup.
+ try:
+ fp = hasattr(self.fp, "fileno") and os.dup(self.fp.fileno())
+ # flush the file descriptor, prevents error on pypy 2.4+
+ # should also eliminate the need for fp.tell
+ # in _seek
+ if hasattr(self.fp, "flush"):
+ self.fp.flush()
+ except OSError:
+ # io.BytesIO have a fileno, but returns an OSError if
+ # it doesn't use a file descriptor.
+ fp = False
+
+ if fp:
+ args[2] = fp
+
+ decoder = Image._getdecoder(
+ self.mode, "libtiff", tuple(args), self.decoderconfig
+ )
+ try:
+ decoder.setimage(self.im, extents)
+ except ValueError as e:
+ raise OSError("Couldn't set the image") from e
+
+ close_self_fp = self._exclusive_fp and not self.is_animated
+ if hasattr(self.fp, "getvalue"):
+ # We've got a stringio like thing passed in. Yay for all in memory.
+ # The decoder needs the entire file in one shot, so there's not
+ # a lot we can do here other than give it the entire file.
+ # unless we could do something like get the address of the
+ # underlying string for stringio.
+ #
+ # Rearranging for supporting byteio items, since they have a fileno
+ # that returns an OSError if there's no underlying fp. Easier to
+ # deal with here by reordering.
+ logger.debug("have getvalue. just sending in a string from getvalue")
+ n, err = decoder.decode(self.fp.getvalue())
+ elif fp:
+ # we've got a actual file on disk, pass in the fp.
+ logger.debug("have fileno, calling fileno version of the decoder.")
+ if not close_self_fp:
+ self.fp.seek(0)
+ # 4 bytes, otherwise the trace might error out
+ n, err = decoder.decode(b"fpfp")
+ else:
+ # we have something else.
+ logger.debug("don't have fileno or getvalue. just reading")
+ self.fp.seek(0)
+ # UNDONE -- so much for that buffer size thing.
+ n, err = decoder.decode(self.fp.read())
+
+ self.tile = []
+ self.readonly = 0
+
+ self.load_end()
+
+ # libtiff closed the fp in a, we need to close self.fp, if possible
+ if close_self_fp:
+ self.fp.close()
+ self.fp = None # might be shared
+
+ if err < 0:
+ raise OSError(err)
+
+ return Image.Image.load(self)
+
+ def _setup(self):
+ """Setup this image object based on current tags"""
+
+ if 0xBC01 in self.tag_v2:
+ raise OSError("Windows Media Photo files not yet supported")
+
+ # extract relevant tags
+ self._compression = COMPRESSION_INFO[self.tag_v2.get(COMPRESSION, 1)]
+ self._planar_configuration = self.tag_v2.get(PLANAR_CONFIGURATION, 1)
+
+ # photometric is a required tag, but not everyone is reading
+ # the specification
+ photo = self.tag_v2.get(PHOTOMETRIC_INTERPRETATION, 0)
+
+ # old style jpeg compression images most certainly are YCbCr
+ if self._compression == "tiff_jpeg":
+ photo = 6
+
+ fillorder = self.tag_v2.get(FILLORDER, 1)
+
+ logger.debug("*** Summary ***")
+ logger.debug(f"- compression: {self._compression}")
+ logger.debug(f"- photometric_interpretation: {photo}")
+ logger.debug(f"- planar_configuration: {self._planar_configuration}")
+ logger.debug(f"- fill_order: {fillorder}")
+ logger.debug(f"- YCbCr subsampling: {self.tag.get(530)}")
+
+ # size
+ xsize = int(self.tag_v2.get(IMAGEWIDTH))
+ ysize = int(self.tag_v2.get(IMAGELENGTH))
+ self._size = xsize, ysize
+
+ logger.debug(f"- size: {self.size}")
+
+ sampleFormat = self.tag_v2.get(SAMPLEFORMAT, (1,))
+ if len(sampleFormat) > 1 and max(sampleFormat) == min(sampleFormat) == 1:
+ # SAMPLEFORMAT is properly per band, so an RGB image will
+ # be (1,1,1). But, we don't support per band pixel types,
+ # and anything more than one band is a uint8. So, just
+ # take the first element. Revisit this if adding support
+ # for more exotic images.
+ sampleFormat = (1,)
+
+ bps_tuple = self.tag_v2.get(BITSPERSAMPLE, (1,))
+ extra_tuple = self.tag_v2.get(EXTRASAMPLES, ())
+ if photo in (2, 6, 8): # RGB, YCbCr, LAB
+ bps_count = 3
+ elif photo == 5: # CMYK
+ bps_count = 4
+ else:
+ bps_count = 1
+ bps_count += len(extra_tuple)
+ # Some files have only one value in bps_tuple,
+ # while should have more. Fix it
+ if bps_count > len(bps_tuple) and len(bps_tuple) == 1:
+ bps_tuple = bps_tuple * bps_count
+
+ samplesPerPixel = self.tag_v2.get(SAMPLESPERPIXEL, 1)
+ if len(bps_tuple) != samplesPerPixel:
+ raise SyntaxError("unknown data organization")
+
+ # mode: check photometric interpretation and bits per pixel
+ key = (
+ self.tag_v2.prefix,
+ photo,
+ sampleFormat,
+ fillorder,
+ bps_tuple,
+ extra_tuple,
+ )
+ logger.debug(f"format key: {key}")
+ try:
+ self.mode, rawmode = OPEN_INFO[key]
+ except KeyError as e:
+ logger.debug("- unsupported format")
+ raise SyntaxError("unknown pixel mode") from e
+
+ logger.debug(f"- raw mode: {rawmode}")
+ logger.debug(f"- pil mode: {self.mode}")
+
+ self.info["compression"] = self._compression
+
+ xres = self.tag_v2.get(X_RESOLUTION, 1)
+ yres = self.tag_v2.get(Y_RESOLUTION, 1)
+
+ if xres and yres:
+ resunit = self.tag_v2.get(RESOLUTION_UNIT)
+ if resunit == 2: # dots per inch
+ self.info["dpi"] = int(xres + 0.5), int(yres + 0.5)
+ elif resunit == 3: # dots per centimeter. convert to dpi
+ self.info["dpi"] = int(xres * 2.54 + 0.5), int(yres * 2.54 + 0.5)
+ elif resunit is None: # used to default to 1, but now 2)
+ self.info["dpi"] = int(xres + 0.5), int(yres + 0.5)
+ # For backward compatibility,
+ # we also preserve the old behavior
+ self.info["resolution"] = xres, yres
+ else: # No absolute unit of measurement
+ self.info["resolution"] = xres, yres
+
+ # build tile descriptors
+ x = y = layer = 0
+ self.tile = []
+ self.use_load_libtiff = READ_LIBTIFF or self._compression != "raw"
+ if self.use_load_libtiff:
+ # Decoder expects entire file as one tile.
+ # There's a buffer size limit in load (64k)
+ # so large g4 images will fail if we use that
+ # function.
+ #
+ # Setup the one tile for the whole image, then
+ # use the _load_libtiff function.
+
+ # libtiff handles the fillmode for us, so 1;IR should
+ # actually be 1;I. Including the R double reverses the
+ # bits, so stripes of the image are reversed. See
+ # https://github.com/python-pillow/Pillow/issues/279
+ if fillorder == 2:
+ # Replace fillorder with fillorder=1
+ key = key[:3] + (1,) + key[4:]
+ logger.debug(f"format key: {key}")
+ # this should always work, since all the
+ # fillorder==2 modes have a corresponding
+ # fillorder=1 mode
+ self.mode, rawmode = OPEN_INFO[key]
+ # libtiff always returns the bytes in native order.
+ # we're expecting image byte order. So, if the rawmode
+ # contains I;16, we need to convert from native to image
+ # byte order.
+ if rawmode == "I;16":
+ rawmode = "I;16N"
+ if ";16B" in rawmode:
+ rawmode = rawmode.replace(";16B", ";16N")
+ if ";16L" in rawmode:
+ rawmode = rawmode.replace(";16L", ";16N")
+
+ # YCbCr images with new jpeg compression with pixels in one plane
+ # unpacked straight into RGB values
+ if (
+ photo == 6
+ and self._compression == "jpeg"
+ and self._planar_configuration == 1
+ ):
+ rawmode = "RGB"
+
+ # Offset in the tile tuple is 0, we go from 0,0 to
+ # w,h, and we only do this once -- eds
+ a = (rawmode, self._compression, False, self.tag_v2.offset)
+ self.tile.append(("libtiff", (0, 0, xsize, ysize), 0, a))
+
+ elif STRIPOFFSETS in self.tag_v2 or TILEOFFSETS in self.tag_v2:
+ # striped image
+ if STRIPOFFSETS in self.tag_v2:
+ offsets = self.tag_v2[STRIPOFFSETS]
+ h = self.tag_v2.get(ROWSPERSTRIP, ysize)
+ w = self.size[0]
+ else:
+ # tiled image
+ offsets = self.tag_v2[TILEOFFSETS]
+ w = self.tag_v2.get(322)
+ h = self.tag_v2.get(323)
+
+ for offset in offsets:
+ if x + w > xsize:
+ stride = w * sum(bps_tuple) / 8 # bytes per line
+ else:
+ stride = 0
+
+ tile_rawmode = rawmode
+ if self._planar_configuration == 2:
+ # each band on it's own layer
+ tile_rawmode = rawmode[layer]
+ # adjust stride width accordingly
+ stride /= bps_count
+
+ a = (tile_rawmode, int(stride), 1)
+ self.tile.append(
+ (
+ self._compression,
+ (x, y, min(x + w, xsize), min(y + h, ysize)),
+ offset,
+ a,
+ )
+ )
+ x = x + w
+ if x >= self.size[0]:
+ x, y = 0, y + h
+ if y >= self.size[1]:
+ x = y = 0
+ layer += 1
+ else:
+ logger.debug("- unsupported data organization")
+ raise SyntaxError("unknown data organization")
+
+ # Fix up info.
+ if ICCPROFILE in self.tag_v2:
+ self.info["icc_profile"] = self.tag_v2[ICCPROFILE]
+
+ # fixup palette descriptor
+
+ if self.mode in ["P", "PA"]:
+ palette = [o8(b // 256) for b in self.tag_v2[COLORMAP]]
+ self.palette = ImagePalette.raw("RGB;L", b"".join(palette))
+
+ self._tile_orientation = self.tag_v2.get(0x0112)
+
+ def _close__fp(self):
+ try:
+ if self.__fp != self.fp:
+ self.__fp.close()
+ except AttributeError:
+ pass
+ finally:
+ self.__fp = None
+
+
+#
+# --------------------------------------------------------------------
+# Write TIFF files
+
+# little endian is default except for image modes with
+# explicit big endian byte-order
+
+SAVE_INFO = {
+ # mode => rawmode, byteorder, photometrics,
+ # sampleformat, bitspersample, extra
+ "1": ("1", II, 1, 1, (1,), None),
+ "L": ("L", II, 1, 1, (8,), None),
+ "LA": ("LA", II, 1, 1, (8, 8), 2),
+ "P": ("P", II, 3, 1, (8,), None),
+ "PA": ("PA", II, 3, 1, (8, 8), 2),
+ "I": ("I;32S", II, 1, 2, (32,), None),
+ "I;16": ("I;16", II, 1, 1, (16,), None),
+ "I;16S": ("I;16S", II, 1, 2, (16,), None),
+ "F": ("F;32F", II, 1, 3, (32,), None),
+ "RGB": ("RGB", II, 2, 1, (8, 8, 8), None),
+ "RGBX": ("RGBX", II, 2, 1, (8, 8, 8, 8), 0),
+ "RGBA": ("RGBA", II, 2, 1, (8, 8, 8, 8), 2),
+ "CMYK": ("CMYK", II, 5, 1, (8, 8, 8, 8), None),
+ "YCbCr": ("YCbCr", II, 6, 1, (8, 8, 8), None),
+ "LAB": ("LAB", II, 8, 1, (8, 8, 8), None),
+ "I;32BS": ("I;32BS", MM, 1, 2, (32,), None),
+ "I;16B": ("I;16B", MM, 1, 1, (16,), None),
+ "I;16BS": ("I;16BS", MM, 1, 2, (16,), None),
+ "F;32BF": ("F;32BF", MM, 1, 3, (32,), None),
+}
+
+
+def _save(im, fp, filename):
+
+ try:
+ rawmode, prefix, photo, format, bits, extra = SAVE_INFO[im.mode]
+ except KeyError as e:
+ raise OSError(f"cannot write mode {im.mode} as TIFF") from e
+
+ ifd = ImageFileDirectory_v2(prefix=prefix)
+
+ compression = im.encoderinfo.get("compression", im.info.get("compression"))
+ if compression is None:
+ compression = "raw"
+ elif compression == "tiff_jpeg":
+ # OJPEG is obsolete, so use new-style JPEG compression instead
+ compression = "jpeg"
+ elif compression == "tiff_deflate":
+ compression = "tiff_adobe_deflate"
+
+ libtiff = WRITE_LIBTIFF or compression != "raw"
+
+ # required for color libtiff images
+ ifd[PLANAR_CONFIGURATION] = getattr(im, "_planar_configuration", 1)
+
+ ifd[IMAGEWIDTH] = im.size[0]
+ ifd[IMAGELENGTH] = im.size[1]
+
+ # write any arbitrary tags passed in as an ImageFileDirectory
+ info = im.encoderinfo.get("tiffinfo", {})
+ logger.debug("Tiffinfo Keys: %s" % list(info))
+ if isinstance(info, ImageFileDirectory_v1):
+ info = info.to_v2()
+ for key in info:
+ ifd[key] = info.get(key)
+ try:
+ ifd.tagtype[key] = info.tagtype[key]
+ except Exception:
+ pass # might not be an IFD. Might not have populated type
+
+ # additions written by Greg Couch, gregc@cgl.ucsf.edu
+ # inspired by image-sig posting from Kevin Cazabon, kcazabon@home.com
+ if hasattr(im, "tag_v2"):
+ # preserve tags from original TIFF image file
+ for key in (
+ RESOLUTION_UNIT,
+ X_RESOLUTION,
+ Y_RESOLUTION,
+ IPTC_NAA_CHUNK,
+ PHOTOSHOP_CHUNK,
+ XMP,
+ ):
+ if key in im.tag_v2:
+ ifd[key] = im.tag_v2[key]
+ ifd.tagtype[key] = im.tag_v2.tagtype[key]
+
+ # preserve ICC profile (should also work when saving other formats
+ # which support profiles as TIFF) -- 2008-06-06 Florian Hoech
+ icc = im.encoderinfo.get("icc_profile", im.info.get("icc_profile"))
+ if icc:
+ ifd[ICCPROFILE] = icc
+
+ for key, name in [
+ (IMAGEDESCRIPTION, "description"),
+ (X_RESOLUTION, "resolution"),
+ (Y_RESOLUTION, "resolution"),
+ (X_RESOLUTION, "x_resolution"),
+ (Y_RESOLUTION, "y_resolution"),
+ (RESOLUTION_UNIT, "resolution_unit"),
+ (SOFTWARE, "software"),
+ (DATE_TIME, "date_time"),
+ (ARTIST, "artist"),
+ (COPYRIGHT, "copyright"),
+ ]:
+ if name in im.encoderinfo:
+ ifd[key] = im.encoderinfo[name]
+
+ dpi = im.encoderinfo.get("dpi")
+ if dpi:
+ ifd[RESOLUTION_UNIT] = 2
+ ifd[X_RESOLUTION] = int(dpi[0] + 0.5)
+ ifd[Y_RESOLUTION] = int(dpi[1] + 0.5)
+
+ if bits != (1,):
+ ifd[BITSPERSAMPLE] = bits
+ if len(bits) != 1:
+ ifd[SAMPLESPERPIXEL] = len(bits)
+ if extra is not None:
+ ifd[EXTRASAMPLES] = extra
+ if format != 1:
+ ifd[SAMPLEFORMAT] = format
+
+ ifd[PHOTOMETRIC_INTERPRETATION] = photo
+
+ if im.mode in ["P", "PA"]:
+ lut = im.im.getpalette("RGB", "RGB;L")
+ ifd[COLORMAP] = tuple(v * 256 for v in lut)
+ # data orientation
+ stride = len(bits) * ((im.size[0] * bits[0] + 7) // 8)
+ ifd[ROWSPERSTRIP] = im.size[1]
+ strip_byte_counts = stride * im.size[1]
+ if strip_byte_counts >= 2 ** 16:
+ ifd.tagtype[STRIPBYTECOUNTS] = TiffTags.LONG
+ ifd[STRIPBYTECOUNTS] = strip_byte_counts
+ ifd[STRIPOFFSETS] = 0 # this is adjusted by IFD writer
+ # no compression by default:
+ ifd[COMPRESSION] = COMPRESSION_INFO_REV.get(compression, 1)
+
+ if libtiff:
+ if "quality" in im.encoderinfo:
+ quality = im.encoderinfo["quality"]
+ if not isinstance(quality, int) or quality < 0 or quality > 100:
+ raise ValueError("Invalid quality setting")
+ if compression != "jpeg":
+ raise ValueError(
+ "quality setting only supported for 'jpeg' compression"
+ )
+ ifd[JPEGQUALITY] = quality
+
+ logger.debug("Saving using libtiff encoder")
+ logger.debug("Items: %s" % sorted(ifd.items()))
+ _fp = 0
+ if hasattr(fp, "fileno"):
+ try:
+ fp.seek(0)
+ _fp = os.dup(fp.fileno())
+ except io.UnsupportedOperation:
+ pass
+
+ # optional types for non core tags
+ types = {}
+ # SAMPLEFORMAT is determined by the image format and should not be copied
+ # from legacy_ifd.
+ # STRIPOFFSETS and STRIPBYTECOUNTS are added by the library
+ # based on the data in the strip.
+ # The other tags expect arrays with a certain length (fixed or depending on
+ # BITSPERSAMPLE, etc), passing arrays with a different length will result in
+ # segfaults. Block these tags until we add extra validation.
+ # SUBIFD may also cause a segfault.
+ blocklist = [
+ REFERENCEBLACKWHITE,
+ SAMPLEFORMAT,
+ STRIPBYTECOUNTS,
+ STRIPOFFSETS,
+ TRANSFERFUNCTION,
+ SUBIFD,
+ ]
+
+ atts = {}
+ # bits per sample is a single short in the tiff directory, not a list.
+ atts[BITSPERSAMPLE] = bits[0]
+ # Merge the ones that we have with (optional) more bits from
+ # the original file, e.g x,y resolution so that we can
+ # save(load('')) == original file.
+ legacy_ifd = {}
+ if hasattr(im, "tag"):
+ legacy_ifd = im.tag.to_v2()
+ for tag, value in itertools.chain(
+ ifd.items(), getattr(im, "tag_v2", {}).items(), legacy_ifd.items()
+ ):
+ # Libtiff can only process certain core items without adding
+ # them to the custom dictionary.
+ # Custom items are supported for int, float, unicode, string and byte
+ # values. Other types and tuples require a tagtype.
+ if tag not in TiffTags.LIBTIFF_CORE:
+ if not Image.core.libtiff_support_custom_tags:
+ continue
+
+ if tag in ifd.tagtype:
+ types[tag] = ifd.tagtype[tag]
+ elif not (isinstance(value, (int, float, str, bytes))):
+ continue
+ else:
+ type = TiffTags.lookup(tag).type
+ if type:
+ types[tag] = type
+ if tag not in atts and tag not in blocklist:
+ if isinstance(value, str):
+ atts[tag] = value.encode("ascii", "replace") + b"\0"
+ elif isinstance(value, IFDRational):
+ atts[tag] = float(value)
+ else:
+ atts[tag] = value
+
+ logger.debug("Converted items: %s" % sorted(atts.items()))
+
+ # libtiff always expects the bytes in native order.
+ # we're storing image byte order. So, if the rawmode
+ # contains I;16, we need to convert from native to image
+ # byte order.
+ if im.mode in ("I;16B", "I;16"):
+ rawmode = "I;16N"
+
+ # Pass tags as sorted list so that the tags are set in a fixed order.
+ # This is required by libtiff for some tags. For example, the JPEGQUALITY
+ # pseudo tag requires that the COMPRESS tag was already set.
+ tags = list(atts.items())
+ tags.sort()
+ a = (rawmode, compression, _fp, filename, tags, types)
+ e = Image._getencoder(im.mode, "libtiff", a, im.encoderconfig)
+ e.setimage(im.im, (0, 0) + im.size)
+ while True:
+ # undone, change to self.decodermaxblock:
+ l, s, d = e.encode(16 * 1024)
+ if not _fp:
+ fp.write(d)
+ if s:
+ break
+ if s < 0:
+ raise OSError(f"encoder error {s} when writing image file")
+
+ else:
+ offset = ifd.save(fp)
+
+ ImageFile._save(
+ im, fp, [("raw", (0, 0) + im.size, offset, (rawmode, stride, 1))]
+ )
+
+ # -- helper for multi-page save --
+ if "_debug_multipage" in im.encoderinfo:
+ # just to access o32 and o16 (using correct byte order)
+ im._debug_multipage = ifd
+
+
+class AppendingTiffWriter:
+ fieldSizes = [
+ 0, # None
+ 1, # byte
+ 1, # ascii
+ 2, # short
+ 4, # long
+ 8, # rational
+ 1, # sbyte
+ 1, # undefined
+ 2, # sshort
+ 4, # slong
+ 8, # srational
+ 4, # float
+ 8, # double
+ ]
+
+ # StripOffsets = 273
+ # FreeOffsets = 288
+ # TileOffsets = 324
+ # JPEGQTables = 519
+ # JPEGDCTables = 520
+ # JPEGACTables = 521
+ Tags = {273, 288, 324, 519, 520, 521}
+
+ def __init__(self, fn, new=False):
+ if hasattr(fn, "read"):
+ self.f = fn
+ self.close_fp = False
+ else:
+ self.name = fn
+ self.close_fp = True
+ try:
+ self.f = open(fn, "w+b" if new else "r+b")
+ except OSError:
+ self.f = open(fn, "w+b")
+ self.beginning = self.f.tell()
+ self.setup()
+
+ def setup(self):
+ # Reset everything.
+ self.f.seek(self.beginning, os.SEEK_SET)
+
+ self.whereToWriteNewIFDOffset = None
+ self.offsetOfNewPage = 0
+
+ self.IIMM = IIMM = self.f.read(4)
+ if not IIMM:
+ # empty file - first page
+ self.isFirst = True
+ return
+
+ self.isFirst = False
+ if IIMM == b"II\x2a\x00":
+ self.setEndian("<")
+ elif IIMM == b"MM\x00\x2a":
+ self.setEndian(">")
+ else:
+ raise RuntimeError("Invalid TIFF file header")
+
+ self.skipIFDs()
+ self.goToEnd()
+
+ def finalize(self):
+ if self.isFirst:
+ return
+
+ # fix offsets
+ self.f.seek(self.offsetOfNewPage)
+
+ IIMM = self.f.read(4)
+ if not IIMM:
+ # raise RuntimeError("nothing written into new page")
+ # Make it easy to finish a frame without committing to a new one.
+ return
+
+ if IIMM != self.IIMM:
+ raise RuntimeError("IIMM of new page doesn't match IIMM of first page")
+
+ IFDoffset = self.readLong()
+ IFDoffset += self.offsetOfNewPage
+ self.f.seek(self.whereToWriteNewIFDOffset)
+ self.writeLong(IFDoffset)
+ self.f.seek(IFDoffset)
+ self.fixIFD()
+
+ def newFrame(self):
+ # Call this to finish a frame.
+ self.finalize()
+ self.setup()
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ if self.close_fp:
+ self.close()
+ return False
+
+ def tell(self):
+ return self.f.tell() - self.offsetOfNewPage
+
+ def seek(self, offset, whence=io.SEEK_SET):
+ if whence == os.SEEK_SET:
+ offset += self.offsetOfNewPage
+
+ self.f.seek(offset, whence)
+ return self.tell()
+
+ def goToEnd(self):
+ self.f.seek(0, os.SEEK_END)
+ pos = self.f.tell()
+
+ # pad to 16 byte boundary
+ padBytes = 16 - pos % 16
+ if 0 < padBytes < 16:
+ self.f.write(bytes(padBytes))
+ self.offsetOfNewPage = self.f.tell()
+
+ def setEndian(self, endian):
+ self.endian = endian
+ self.longFmt = self.endian + "L"
+ self.shortFmt = self.endian + "H"
+ self.tagFormat = self.endian + "HHL"
+
+ def skipIFDs(self):
+ while True:
+ IFDoffset = self.readLong()
+ if IFDoffset == 0:
+ self.whereToWriteNewIFDOffset = self.f.tell() - 4
+ break
+
+ self.f.seek(IFDoffset)
+ numTags = self.readShort()
+ self.f.seek(numTags * 12, os.SEEK_CUR)
+
+ def write(self, data):
+ return self.f.write(data)
+
+ def readShort(self):
+ (value,) = struct.unpack(self.shortFmt, self.f.read(2))
+ return value
+
+ def readLong(self):
+ (value,) = struct.unpack(self.longFmt, self.f.read(4))
+ return value
+
+ def rewriteLastShortToLong(self, value):
+ self.f.seek(-2, os.SEEK_CUR)
+ bytesWritten = self.f.write(struct.pack(self.longFmt, value))
+ if bytesWritten is not None and bytesWritten != 4:
+ raise RuntimeError(f"wrote only {bytesWritten} bytes but wanted 4")
+
+ def rewriteLastShort(self, value):
+ self.f.seek(-2, os.SEEK_CUR)
+ bytesWritten = self.f.write(struct.pack(self.shortFmt, value))
+ if bytesWritten is not None and bytesWritten != 2:
+ raise RuntimeError(f"wrote only {bytesWritten} bytes but wanted 2")
+
+ def rewriteLastLong(self, value):
+ self.f.seek(-4, os.SEEK_CUR)
+ bytesWritten = self.f.write(struct.pack(self.longFmt, value))
+ if bytesWritten is not None and bytesWritten != 4:
+ raise RuntimeError(f"wrote only {bytesWritten} bytes but wanted 4")
+
+ def writeShort(self, value):
+ bytesWritten = self.f.write(struct.pack(self.shortFmt, value))
+ if bytesWritten is not None and bytesWritten != 2:
+ raise RuntimeError(f"wrote only {bytesWritten} bytes but wanted 2")
+
+ def writeLong(self, value):
+ bytesWritten = self.f.write(struct.pack(self.longFmt, value))
+ if bytesWritten is not None and bytesWritten != 4:
+ raise RuntimeError(f"wrote only {bytesWritten} bytes but wanted 4")
+
+ def close(self):
+ self.finalize()
+ self.f.close()
+
+ def fixIFD(self):
+ numTags = self.readShort()
+
+ for i in range(numTags):
+ tag, fieldType, count = struct.unpack(self.tagFormat, self.f.read(8))
+
+ fieldSize = self.fieldSizes[fieldType]
+ totalSize = fieldSize * count
+ isLocal = totalSize <= 4
+ if not isLocal:
+ offset = self.readLong()
+ offset += self.offsetOfNewPage
+ self.rewriteLastLong(offset)
+
+ if tag in self.Tags:
+ curPos = self.f.tell()
+
+ if isLocal:
+ self.fixOffsets(
+ count, isShort=(fieldSize == 2), isLong=(fieldSize == 4)
+ )
+ self.f.seek(curPos + 4)
+ else:
+ self.f.seek(offset)
+ self.fixOffsets(
+ count, isShort=(fieldSize == 2), isLong=(fieldSize == 4)
+ )
+ self.f.seek(curPos)
+
+ offset = curPos = None
+
+ elif isLocal:
+ # skip the locally stored value that is not an offset
+ self.f.seek(4, os.SEEK_CUR)
+
+ def fixOffsets(self, count, isShort=False, isLong=False):
+ if not isShort and not isLong:
+ raise RuntimeError("offset is neither short nor long")
+
+ for i in range(count):
+ offset = self.readShort() if isShort else self.readLong()
+ offset += self.offsetOfNewPage
+ if isShort and offset >= 65536:
+ # offset is now too large - we must convert shorts to longs
+ if count != 1:
+ raise RuntimeError("not implemented") # XXX TODO
+
+ # simple case - the offset is just one and therefore it is
+ # local (not referenced with another offset)
+ self.rewriteLastShortToLong(offset)
+ self.f.seek(-10, os.SEEK_CUR)
+ self.writeShort(TiffTags.LONG) # rewrite the type to LONG
+ self.f.seek(8, os.SEEK_CUR)
+ elif isShort:
+ self.rewriteLastShort(offset)
+ else:
+ self.rewriteLastLong(offset)
+
+
+def _save_all(im, fp, filename):
+ encoderinfo = im.encoderinfo.copy()
+ encoderconfig = im.encoderconfig
+ append_images = list(encoderinfo.get("append_images", []))
+ if not hasattr(im, "n_frames") and not append_images:
+ return _save(im, fp, filename)
+
+ cur_idx = im.tell()
+ try:
+ with AppendingTiffWriter(fp) as tf:
+ for ims in [im] + append_images:
+ ims.encoderinfo = encoderinfo
+ ims.encoderconfig = encoderconfig
+ if not hasattr(ims, "n_frames"):
+ nfr = 1
+ else:
+ nfr = ims.n_frames
+
+ for idx in range(nfr):
+ ims.seek(idx)
+ ims.load()
+ _save(ims, tf, filename)
+ tf.newFrame()
+ finally:
+ im.seek(cur_idx)
+
+
+#
+# --------------------------------------------------------------------
+# Register
+
+Image.register_open(TiffImageFile.format, TiffImageFile, _accept)
+Image.register_save(TiffImageFile.format, _save)
+Image.register_save_all(TiffImageFile.format, _save_all)
+
+Image.register_extensions(TiffImageFile.format, [".tif", ".tiff"])
+
+Image.register_mime(TiffImageFile.format, "image/tiff")
diff --git a/venv/Lib/site-packages/PIL/TiffTags.py b/venv/Lib/site-packages/PIL/TiffTags.py
new file mode 100644
index 0000000..9e9e117
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/TiffTags.py
@@ -0,0 +1,500 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# TIFF tags
+#
+# This module provides clear-text names for various well-known
+# TIFF tags. the TIFF codec works just fine without it.
+#
+# Copyright (c) Secret Labs AB 1999.
+#
+# See the README file for information on usage and redistribution.
+#
+
+##
+# This module provides constants and clear-text names for various
+# well-known TIFF tags.
+##
+
+from collections import namedtuple
+
+
+class TagInfo(namedtuple("_TagInfo", "value name type length enum")):
+ __slots__ = []
+
+ def __new__(cls, value=None, name="unknown", type=None, length=None, enum=None):
+ return super().__new__(cls, value, name, type, length, enum or {})
+
+ def cvt_enum(self, value):
+ # Using get will call hash(value), which can be expensive
+ # for some types (e.g. Fraction). Since self.enum is rarely
+ # used, it's usually better to test it first.
+ return self.enum.get(value, value) if self.enum else value
+
+
+def lookup(tag):
+ """
+ :param tag: Integer tag number
+ :returns: Taginfo namedtuple, From the TAGS_V2 info if possible,
+ otherwise just populating the value and name from TAGS.
+ If the tag is not recognized, "unknown" is returned for the name
+
+ """
+
+ return TAGS_V2.get(tag, TagInfo(tag, TAGS.get(tag, "unknown")))
+
+
+##
+# Map tag numbers to tag info.
+#
+# id: (Name, Type, Length, enum_values)
+#
+# The length here differs from the length in the tiff spec. For
+# numbers, the tiff spec is for the number of fields returned. We
+# agree here. For string-like types, the tiff spec uses the length of
+# field in bytes. In Pillow, we are using the number of expected
+# fields, in general 1 for string-like types.
+
+
+BYTE = 1
+ASCII = 2
+SHORT = 3
+LONG = 4
+RATIONAL = 5
+SIGNED_BYTE = 6
+UNDEFINED = 7
+SIGNED_SHORT = 8
+SIGNED_LONG = 9
+SIGNED_RATIONAL = 10
+FLOAT = 11
+DOUBLE = 12
+IFD = 13
+
+TAGS_V2 = {
+ 254: ("NewSubfileType", LONG, 1),
+ 255: ("SubfileType", SHORT, 1),
+ 256: ("ImageWidth", LONG, 1),
+ 257: ("ImageLength", LONG, 1),
+ 258: ("BitsPerSample", SHORT, 0),
+ 259: (
+ "Compression",
+ SHORT,
+ 1,
+ {
+ "Uncompressed": 1,
+ "CCITT 1d": 2,
+ "Group 3 Fax": 3,
+ "Group 4 Fax": 4,
+ "LZW": 5,
+ "JPEG": 6,
+ "PackBits": 32773,
+ },
+ ),
+ 262: (
+ "PhotometricInterpretation",
+ SHORT,
+ 1,
+ {
+ "WhiteIsZero": 0,
+ "BlackIsZero": 1,
+ "RGB": 2,
+ "RGB Palette": 3,
+ "Transparency Mask": 4,
+ "CMYK": 5,
+ "YCbCr": 6,
+ "CieLAB": 8,
+ "CFA": 32803, # TIFF/EP, Adobe DNG
+ "LinearRaw": 32892, # Adobe DNG
+ },
+ ),
+ 263: ("Threshholding", SHORT, 1),
+ 264: ("CellWidth", SHORT, 1),
+ 265: ("CellLength", SHORT, 1),
+ 266: ("FillOrder", SHORT, 1),
+ 269: ("DocumentName", ASCII, 1),
+ 270: ("ImageDescription", ASCII, 1),
+ 271: ("Make", ASCII, 1),
+ 272: ("Model", ASCII, 1),
+ 273: ("StripOffsets", LONG, 0),
+ 274: ("Orientation", SHORT, 1),
+ 277: ("SamplesPerPixel", SHORT, 1),
+ 278: ("RowsPerStrip", LONG, 1),
+ 279: ("StripByteCounts", LONG, 0),
+ 280: ("MinSampleValue", SHORT, 0),
+ 281: ("MaxSampleValue", SHORT, 0),
+ 282: ("XResolution", RATIONAL, 1),
+ 283: ("YResolution", RATIONAL, 1),
+ 284: ("PlanarConfiguration", SHORT, 1, {"Contiguous": 1, "Separate": 2}),
+ 285: ("PageName", ASCII, 1),
+ 286: ("XPosition", RATIONAL, 1),
+ 287: ("YPosition", RATIONAL, 1),
+ 288: ("FreeOffsets", LONG, 1),
+ 289: ("FreeByteCounts", LONG, 1),
+ 290: ("GrayResponseUnit", SHORT, 1),
+ 291: ("GrayResponseCurve", SHORT, 0),
+ 292: ("T4Options", LONG, 1),
+ 293: ("T6Options", LONG, 1),
+ 296: ("ResolutionUnit", SHORT, 1, {"none": 1, "inch": 2, "cm": 3}),
+ 297: ("PageNumber", SHORT, 2),
+ 301: ("TransferFunction", SHORT, 0),
+ 305: ("Software", ASCII, 1),
+ 306: ("DateTime", ASCII, 1),
+ 315: ("Artist", ASCII, 1),
+ 316: ("HostComputer", ASCII, 1),
+ 317: ("Predictor", SHORT, 1, {"none": 1, "Horizontal Differencing": 2}),
+ 318: ("WhitePoint", RATIONAL, 2),
+ 319: ("PrimaryChromaticities", RATIONAL, 6),
+ 320: ("ColorMap", SHORT, 0),
+ 321: ("HalftoneHints", SHORT, 2),
+ 322: ("TileWidth", LONG, 1),
+ 323: ("TileLength", LONG, 1),
+ 324: ("TileOffsets", LONG, 0),
+ 325: ("TileByteCounts", LONG, 0),
+ 332: ("InkSet", SHORT, 1),
+ 333: ("InkNames", ASCII, 1),
+ 334: ("NumberOfInks", SHORT, 1),
+ 336: ("DotRange", SHORT, 0),
+ 337: ("TargetPrinter", ASCII, 1),
+ 338: ("ExtraSamples", SHORT, 0),
+ 339: ("SampleFormat", SHORT, 0),
+ 340: ("SMinSampleValue", DOUBLE, 0),
+ 341: ("SMaxSampleValue", DOUBLE, 0),
+ 342: ("TransferRange", SHORT, 6),
+ 347: ("JPEGTables", UNDEFINED, 1),
+ # obsolete JPEG tags
+ 512: ("JPEGProc", SHORT, 1),
+ 513: ("JPEGInterchangeFormat", LONG, 1),
+ 514: ("JPEGInterchangeFormatLength", LONG, 1),
+ 515: ("JPEGRestartInterval", SHORT, 1),
+ 517: ("JPEGLosslessPredictors", SHORT, 0),
+ 518: ("JPEGPointTransforms", SHORT, 0),
+ 519: ("JPEGQTables", LONG, 0),
+ 520: ("JPEGDCTables", LONG, 0),
+ 521: ("JPEGACTables", LONG, 0),
+ 529: ("YCbCrCoefficients", RATIONAL, 3),
+ 530: ("YCbCrSubSampling", SHORT, 2),
+ 531: ("YCbCrPositioning", SHORT, 1),
+ 532: ("ReferenceBlackWhite", RATIONAL, 6),
+ 700: ("XMP", BYTE, 0),
+ 33432: ("Copyright", ASCII, 1),
+ 33723: ("IptcNaaInfo", UNDEFINED, 0),
+ 34377: ("PhotoshopInfo", BYTE, 0),
+ # FIXME add more tags here
+ 34665: ("ExifIFD", LONG, 1),
+ 34675: ("ICCProfile", UNDEFINED, 1),
+ 34853: ("GPSInfoIFD", LONG, 1),
+ 40965: ("InteroperabilityIFD", LONG, 1),
+ # MPInfo
+ 45056: ("MPFVersion", UNDEFINED, 1),
+ 45057: ("NumberOfImages", LONG, 1),
+ 45058: ("MPEntry", UNDEFINED, 1),
+ 45059: ("ImageUIDList", UNDEFINED, 0), # UNDONE, check
+ 45060: ("TotalFrames", LONG, 1),
+ 45313: ("MPIndividualNum", LONG, 1),
+ 45569: ("PanOrientation", LONG, 1),
+ 45570: ("PanOverlap_H", RATIONAL, 1),
+ 45571: ("PanOverlap_V", RATIONAL, 1),
+ 45572: ("BaseViewpointNum", LONG, 1),
+ 45573: ("ConvergenceAngle", SIGNED_RATIONAL, 1),
+ 45574: ("BaselineLength", RATIONAL, 1),
+ 45575: ("VerticalDivergence", SIGNED_RATIONAL, 1),
+ 45576: ("AxisDistance_X", SIGNED_RATIONAL, 1),
+ 45577: ("AxisDistance_Y", SIGNED_RATIONAL, 1),
+ 45578: ("AxisDistance_Z", SIGNED_RATIONAL, 1),
+ 45579: ("YawAngle", SIGNED_RATIONAL, 1),
+ 45580: ("PitchAngle", SIGNED_RATIONAL, 1),
+ 45581: ("RollAngle", SIGNED_RATIONAL, 1),
+ 50741: ("MakerNoteSafety", SHORT, 1, {"Unsafe": 0, "Safe": 1}),
+ 50780: ("BestQualityScale", RATIONAL, 1),
+ 50838: ("ImageJMetaDataByteCounts", LONG, 0), # Can be more than one
+ 50839: ("ImageJMetaData", UNDEFINED, 1), # see Issue #2006
+}
+
+# Legacy Tags structure
+# these tags aren't included above, but were in the previous versions
+TAGS = {
+ 347: "JPEGTables",
+ 700: "XMP",
+ # Additional Exif Info
+ 32932: "Wang Annotation",
+ 33434: "ExposureTime",
+ 33437: "FNumber",
+ 33445: "MD FileTag",
+ 33446: "MD ScalePixel",
+ 33447: "MD ColorTable",
+ 33448: "MD LabName",
+ 33449: "MD SampleInfo",
+ 33450: "MD PrepDate",
+ 33451: "MD PrepTime",
+ 33452: "MD FileUnits",
+ 33550: "ModelPixelScaleTag",
+ 33723: "IptcNaaInfo",
+ 33918: "INGR Packet Data Tag",
+ 33919: "INGR Flag Registers",
+ 33920: "IrasB Transformation Matrix",
+ 33922: "ModelTiepointTag",
+ 34264: "ModelTransformationTag",
+ 34377: "PhotoshopInfo",
+ 34735: "GeoKeyDirectoryTag",
+ 34736: "GeoDoubleParamsTag",
+ 34737: "GeoAsciiParamsTag",
+ 34850: "ExposureProgram",
+ 34852: "SpectralSensitivity",
+ 34855: "ISOSpeedRatings",
+ 34856: "OECF",
+ 34864: "SensitivityType",
+ 34865: "StandardOutputSensitivity",
+ 34866: "RecommendedExposureIndex",
+ 34867: "ISOSpeed",
+ 34868: "ISOSpeedLatitudeyyy",
+ 34869: "ISOSpeedLatitudezzz",
+ 34908: "HylaFAX FaxRecvParams",
+ 34909: "HylaFAX FaxSubAddress",
+ 34910: "HylaFAX FaxRecvTime",
+ 36864: "ExifVersion",
+ 36867: "DateTimeOriginal",
+ 36868: "DateTImeDigitized",
+ 37121: "ComponentsConfiguration",
+ 37122: "CompressedBitsPerPixel",
+ 37724: "ImageSourceData",
+ 37377: "ShutterSpeedValue",
+ 37378: "ApertureValue",
+ 37379: "BrightnessValue",
+ 37380: "ExposureBiasValue",
+ 37381: "MaxApertureValue",
+ 37382: "SubjectDistance",
+ 37383: "MeteringMode",
+ 37384: "LightSource",
+ 37385: "Flash",
+ 37386: "FocalLength",
+ 37396: "SubjectArea",
+ 37500: "MakerNote",
+ 37510: "UserComment",
+ 37520: "SubSec",
+ 37521: "SubSecTimeOriginal",
+ 37522: "SubsecTimeDigitized",
+ 40960: "FlashPixVersion",
+ 40961: "ColorSpace",
+ 40962: "PixelXDimension",
+ 40963: "PixelYDimension",
+ 40964: "RelatedSoundFile",
+ 40965: "InteroperabilityIFD",
+ 41483: "FlashEnergy",
+ 41484: "SpatialFrequencyResponse",
+ 41486: "FocalPlaneXResolution",
+ 41487: "FocalPlaneYResolution",
+ 41488: "FocalPlaneResolutionUnit",
+ 41492: "SubjectLocation",
+ 41493: "ExposureIndex",
+ 41495: "SensingMethod",
+ 41728: "FileSource",
+ 41729: "SceneType",
+ 41730: "CFAPattern",
+ 41985: "CustomRendered",
+ 41986: "ExposureMode",
+ 41987: "WhiteBalance",
+ 41988: "DigitalZoomRatio",
+ 41989: "FocalLengthIn35mmFilm",
+ 41990: "SceneCaptureType",
+ 41991: "GainControl",
+ 41992: "Contrast",
+ 41993: "Saturation",
+ 41994: "Sharpness",
+ 41995: "DeviceSettingDescription",
+ 41996: "SubjectDistanceRange",
+ 42016: "ImageUniqueID",
+ 42032: "CameraOwnerName",
+ 42033: "BodySerialNumber",
+ 42034: "LensSpecification",
+ 42035: "LensMake",
+ 42036: "LensModel",
+ 42037: "LensSerialNumber",
+ 42112: "GDAL_METADATA",
+ 42113: "GDAL_NODATA",
+ 42240: "Gamma",
+ 50215: "Oce Scanjob Description",
+ 50216: "Oce Application Selector",
+ 50217: "Oce Identification Number",
+ 50218: "Oce ImageLogic Characteristics",
+ # Adobe DNG
+ 50706: "DNGVersion",
+ 50707: "DNGBackwardVersion",
+ 50708: "UniqueCameraModel",
+ 50709: "LocalizedCameraModel",
+ 50710: "CFAPlaneColor",
+ 50711: "CFALayout",
+ 50712: "LinearizationTable",
+ 50713: "BlackLevelRepeatDim",
+ 50714: "BlackLevel",
+ 50715: "BlackLevelDeltaH",
+ 50716: "BlackLevelDeltaV",
+ 50717: "WhiteLevel",
+ 50718: "DefaultScale",
+ 50719: "DefaultCropOrigin",
+ 50720: "DefaultCropSize",
+ 50721: "ColorMatrix1",
+ 50722: "ColorMatrix2",
+ 50723: "CameraCalibration1",
+ 50724: "CameraCalibration2",
+ 50725: "ReductionMatrix1",
+ 50726: "ReductionMatrix2",
+ 50727: "AnalogBalance",
+ 50728: "AsShotNeutral",
+ 50729: "AsShotWhiteXY",
+ 50730: "BaselineExposure",
+ 50731: "BaselineNoise",
+ 50732: "BaselineSharpness",
+ 50733: "BayerGreenSplit",
+ 50734: "LinearResponseLimit",
+ 50735: "CameraSerialNumber",
+ 50736: "LensInfo",
+ 50737: "ChromaBlurRadius",
+ 50738: "AntiAliasStrength",
+ 50740: "DNGPrivateData",
+ 50778: "CalibrationIlluminant1",
+ 50779: "CalibrationIlluminant2",
+ 50784: "Alias Layer Metadata",
+}
+
+
+def _populate():
+ for k, v in TAGS_V2.items():
+ # Populate legacy structure.
+ TAGS[k] = v[0]
+ if len(v) == 4:
+ for sk, sv in v[3].items():
+ TAGS[(k, sv)] = sk
+
+ TAGS_V2[k] = TagInfo(k, *v)
+
+
+_populate()
+##
+# Map type numbers to type names -- defined in ImageFileDirectory.
+
+TYPES = {}
+
+# was:
+# TYPES = {
+# 1: "byte",
+# 2: "ascii",
+# 3: "short",
+# 4: "long",
+# 5: "rational",
+# 6: "signed byte",
+# 7: "undefined",
+# 8: "signed short",
+# 9: "signed long",
+# 10: "signed rational",
+# 11: "float",
+# 12: "double",
+# }
+
+#
+# These tags are handled by default in libtiff, without
+# adding to the custom dictionary. From tif_dir.c, searching for
+# case TIFFTAG in the _TIFFVSetField function:
+# Line: item.
+# 148: case TIFFTAG_SUBFILETYPE:
+# 151: case TIFFTAG_IMAGEWIDTH:
+# 154: case TIFFTAG_IMAGELENGTH:
+# 157: case TIFFTAG_BITSPERSAMPLE:
+# 181: case TIFFTAG_COMPRESSION:
+# 202: case TIFFTAG_PHOTOMETRIC:
+# 205: case TIFFTAG_THRESHHOLDING:
+# 208: case TIFFTAG_FILLORDER:
+# 214: case TIFFTAG_ORIENTATION:
+# 221: case TIFFTAG_SAMPLESPERPIXEL:
+# 228: case TIFFTAG_ROWSPERSTRIP:
+# 238: case TIFFTAG_MINSAMPLEVALUE:
+# 241: case TIFFTAG_MAXSAMPLEVALUE:
+# 244: case TIFFTAG_SMINSAMPLEVALUE:
+# 247: case TIFFTAG_SMAXSAMPLEVALUE:
+# 250: case TIFFTAG_XRESOLUTION:
+# 256: case TIFFTAG_YRESOLUTION:
+# 262: case TIFFTAG_PLANARCONFIG:
+# 268: case TIFFTAG_XPOSITION:
+# 271: case TIFFTAG_YPOSITION:
+# 274: case TIFFTAG_RESOLUTIONUNIT:
+# 280: case TIFFTAG_PAGENUMBER:
+# 284: case TIFFTAG_HALFTONEHINTS:
+# 288: case TIFFTAG_COLORMAP:
+# 294: case TIFFTAG_EXTRASAMPLES:
+# 298: case TIFFTAG_MATTEING:
+# 305: case TIFFTAG_TILEWIDTH:
+# 316: case TIFFTAG_TILELENGTH:
+# 327: case TIFFTAG_TILEDEPTH:
+# 333: case TIFFTAG_DATATYPE:
+# 344: case TIFFTAG_SAMPLEFORMAT:
+# 361: case TIFFTAG_IMAGEDEPTH:
+# 364: case TIFFTAG_SUBIFD:
+# 376: case TIFFTAG_YCBCRPOSITIONING:
+# 379: case TIFFTAG_YCBCRSUBSAMPLING:
+# 383: case TIFFTAG_TRANSFERFUNCTION:
+# 389: case TIFFTAG_REFERENCEBLACKWHITE:
+# 393: case TIFFTAG_INKNAMES:
+
+# Following pseudo-tags are also handled by default in libtiff:
+# TIFFTAG_JPEGQUALITY 65537
+
+# some of these are not in our TAGS_V2 dict and were included from tiff.h
+
+# This list also exists in encode.c
+LIBTIFF_CORE = {
+ 255,
+ 256,
+ 257,
+ 258,
+ 259,
+ 262,
+ 263,
+ 266,
+ 274,
+ 277,
+ 278,
+ 280,
+ 281,
+ 340,
+ 341,
+ 282,
+ 283,
+ 284,
+ 286,
+ 287,
+ 296,
+ 297,
+ 321,
+ 320,
+ 338,
+ 32995,
+ 322,
+ 323,
+ 32998,
+ 32996,
+ 339,
+ 32997,
+ 330,
+ 531,
+ 530,
+ 301,
+ 532,
+ 333,
+ # as above
+ 269, # this has been in our tests forever, and works
+ 65537,
+}
+
+LIBTIFF_CORE.remove(301) # Array of short, crashes
+LIBTIFF_CORE.remove(532) # Array of long, crashes
+
+LIBTIFF_CORE.remove(255) # We don't have support for subfiletypes
+LIBTIFF_CORE.remove(322) # We don't have support for writing tiled images with libtiff
+LIBTIFF_CORE.remove(323) # Tiled images
+LIBTIFF_CORE.remove(333) # Ink Names either
+
+# Note to advanced users: There may be combinations of these
+# parameters and values that when added properly, will work and
+# produce valid tiff images that may work in your application.
+# It is safe to add and remove tags from this set from Pillow's point
+# of view so long as you test against libtiff.
diff --git a/venv/Lib/site-packages/PIL/WalImageFile.py b/venv/Lib/site-packages/PIL/WalImageFile.py
new file mode 100644
index 0000000..b578d69
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/WalImageFile.py
@@ -0,0 +1,126 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# WAL file handling
+#
+# History:
+# 2003-04-23 fl created
+#
+# Copyright (c) 2003 by Fredrik Lundh.
+#
+# See the README file for information on usage and redistribution.
+#
+
+"""
+This reader is based on the specification available from:
+https://www.flipcode.com/archives/Quake_2_BSP_File_Format.shtml
+and has been tested with a few sample files found using google.
+
+.. note::
+ This format cannot be automatically recognized, so the reader
+ is not registered for use with :py:func:`PIL.Image.open()`.
+ To open a WAL file, use the :py:func:`PIL.WalImageFile.open()` function instead.
+"""
+
+import builtins
+
+from . import Image
+from ._binary import i32le as i32
+
+
+def open(filename):
+ """
+ Load texture from a Quake2 WAL texture file.
+
+ By default, a Quake2 standard palette is attached to the texture.
+ To override the palette, use the :py:func:`PIL.Image.Image.putpalette()` method.
+
+ :param filename: WAL file name, or an opened file handle.
+ :returns: An image instance.
+ """
+ # FIXME: modify to return a WalImageFile instance instead of
+ # plain Image object ?
+
+ def imopen(fp):
+ # read header fields
+ header = fp.read(32 + 24 + 32 + 12)
+ size = i32(header, 32), i32(header, 36)
+ offset = i32(header, 40)
+
+ # load pixel data
+ fp.seek(offset)
+
+ Image._decompression_bomb_check(size)
+ im = Image.frombytes("P", size, fp.read(size[0] * size[1]))
+ im.putpalette(quake2palette)
+
+ im.format = "WAL"
+ im.format_description = "Quake2 Texture"
+
+ # strings are null-terminated
+ im.info["name"] = header[:32].split(b"\0", 1)[0]
+ next_name = header[56 : 56 + 32].split(b"\0", 1)[0]
+ if next_name:
+ im.info["next_name"] = next_name
+
+ return im
+
+ if hasattr(filename, "read"):
+ return imopen(filename)
+ else:
+ with builtins.open(filename, "rb") as fp:
+ return imopen(fp)
+
+
+quake2palette = (
+ # default palette taken from piffo 0.93 by Hans Häggström
+ b"\x01\x01\x01\x0b\x0b\x0b\x12\x12\x12\x17\x17\x17\x1b\x1b\x1b\x1e"
+ b"\x1e\x1e\x22\x22\x22\x26\x26\x26\x29\x29\x29\x2c\x2c\x2c\x2f\x2f"
+ b"\x2f\x32\x32\x32\x35\x35\x35\x37\x37\x37\x3a\x3a\x3a\x3c\x3c\x3c"
+ b"\x24\x1e\x13\x22\x1c\x12\x20\x1b\x12\x1f\x1a\x10\x1d\x19\x10\x1b"
+ b"\x17\x0f\x1a\x16\x0f\x18\x14\x0d\x17\x13\x0d\x16\x12\x0d\x14\x10"
+ b"\x0b\x13\x0f\x0b\x10\x0d\x0a\x0f\x0b\x0a\x0d\x0b\x07\x0b\x0a\x07"
+ b"\x23\x23\x26\x22\x22\x25\x22\x20\x23\x21\x1f\x22\x20\x1e\x20\x1f"
+ b"\x1d\x1e\x1d\x1b\x1c\x1b\x1a\x1a\x1a\x19\x19\x18\x17\x17\x17\x16"
+ b"\x16\x14\x14\x14\x13\x13\x13\x10\x10\x10\x0f\x0f\x0f\x0d\x0d\x0d"
+ b"\x2d\x28\x20\x29\x24\x1c\x27\x22\x1a\x25\x1f\x17\x38\x2e\x1e\x31"
+ b"\x29\x1a\x2c\x25\x17\x26\x20\x14\x3c\x30\x14\x37\x2c\x13\x33\x28"
+ b"\x12\x2d\x24\x10\x28\x1f\x0f\x22\x1a\x0b\x1b\x14\x0a\x13\x0f\x07"
+ b"\x31\x1a\x16\x30\x17\x13\x2e\x16\x10\x2c\x14\x0d\x2a\x12\x0b\x27"
+ b"\x0f\x0a\x25\x0f\x07\x21\x0d\x01\x1e\x0b\x01\x1c\x0b\x01\x1a\x0b"
+ b"\x01\x18\x0a\x01\x16\x0a\x01\x13\x0a\x01\x10\x07\x01\x0d\x07\x01"
+ b"\x29\x23\x1e\x27\x21\x1c\x26\x20\x1b\x25\x1f\x1a\x23\x1d\x19\x21"
+ b"\x1c\x18\x20\x1b\x17\x1e\x19\x16\x1c\x18\x14\x1b\x17\x13\x19\x14"
+ b"\x10\x17\x13\x0f\x14\x10\x0d\x12\x0f\x0b\x0f\x0b\x0a\x0b\x0a\x07"
+ b"\x26\x1a\x0f\x23\x19\x0f\x20\x17\x0f\x1c\x16\x0f\x19\x13\x0d\x14"
+ b"\x10\x0b\x10\x0d\x0a\x0b\x0a\x07\x33\x22\x1f\x35\x29\x26\x37\x2f"
+ b"\x2d\x39\x35\x34\x37\x39\x3a\x33\x37\x39\x30\x34\x36\x2b\x31\x34"
+ b"\x27\x2e\x31\x22\x2b\x2f\x1d\x28\x2c\x17\x25\x2a\x0f\x20\x26\x0d"
+ b"\x1e\x25\x0b\x1c\x22\x0a\x1b\x20\x07\x19\x1e\x07\x17\x1b\x07\x14"
+ b"\x18\x01\x12\x16\x01\x0f\x12\x01\x0b\x0d\x01\x07\x0a\x01\x01\x01"
+ b"\x2c\x21\x21\x2a\x1f\x1f\x29\x1d\x1d\x27\x1c\x1c\x26\x1a\x1a\x24"
+ b"\x18\x18\x22\x17\x17\x21\x16\x16\x1e\x13\x13\x1b\x12\x12\x18\x10"
+ b"\x10\x16\x0d\x0d\x12\x0b\x0b\x0d\x0a\x0a\x0a\x07\x07\x01\x01\x01"
+ b"\x2e\x30\x29\x2d\x2e\x27\x2b\x2c\x26\x2a\x2a\x24\x28\x29\x23\x27"
+ b"\x27\x21\x26\x26\x1f\x24\x24\x1d\x22\x22\x1c\x1f\x1f\x1a\x1c\x1c"
+ b"\x18\x19\x19\x16\x17\x17\x13\x13\x13\x10\x0f\x0f\x0d\x0b\x0b\x0a"
+ b"\x30\x1e\x1b\x2d\x1c\x19\x2c\x1a\x17\x2a\x19\x14\x28\x17\x13\x26"
+ b"\x16\x10\x24\x13\x0f\x21\x12\x0d\x1f\x10\x0b\x1c\x0f\x0a\x19\x0d"
+ b"\x0a\x16\x0b\x07\x12\x0a\x07\x0f\x07\x01\x0a\x01\x01\x01\x01\x01"
+ b"\x28\x29\x38\x26\x27\x36\x25\x26\x34\x24\x24\x31\x22\x22\x2f\x20"
+ b"\x21\x2d\x1e\x1f\x2a\x1d\x1d\x27\x1b\x1b\x25\x19\x19\x21\x17\x17"
+ b"\x1e\x14\x14\x1b\x13\x12\x17\x10\x0f\x13\x0d\x0b\x0f\x0a\x07\x07"
+ b"\x2f\x32\x29\x2d\x30\x26\x2b\x2e\x24\x29\x2c\x21\x27\x2a\x1e\x25"
+ b"\x28\x1c\x23\x26\x1a\x21\x25\x18\x1e\x22\x14\x1b\x1f\x10\x19\x1c"
+ b"\x0d\x17\x1a\x0a\x13\x17\x07\x10\x13\x01\x0d\x0f\x01\x0a\x0b\x01"
+ b"\x01\x3f\x01\x13\x3c\x0b\x1b\x39\x10\x20\x35\x14\x23\x31\x17\x23"
+ b"\x2d\x18\x23\x29\x18\x3f\x3f\x3f\x3f\x3f\x39\x3f\x3f\x31\x3f\x3f"
+ b"\x2a\x3f\x3f\x20\x3f\x3f\x14\x3f\x3c\x12\x3f\x39\x0f\x3f\x35\x0b"
+ b"\x3f\x32\x07\x3f\x2d\x01\x3d\x2a\x01\x3b\x26\x01\x39\x21\x01\x37"
+ b"\x1d\x01\x34\x1a\x01\x32\x16\x01\x2f\x12\x01\x2d\x0f\x01\x2a\x0b"
+ b"\x01\x27\x07\x01\x23\x01\x01\x1d\x01\x01\x17\x01\x01\x10\x01\x01"
+ b"\x3d\x01\x01\x19\x19\x3f\x3f\x01\x01\x01\x01\x3f\x16\x16\x13\x10"
+ b"\x10\x0f\x0d\x0d\x0b\x3c\x2e\x2a\x36\x27\x20\x30\x21\x18\x29\x1b"
+ b"\x10\x3c\x39\x37\x37\x32\x2f\x31\x2c\x28\x2b\x26\x21\x30\x22\x20"
+)
diff --git a/venv/Lib/site-packages/PIL/WebPImagePlugin.py b/venv/Lib/site-packages/PIL/WebPImagePlugin.py
new file mode 100644
index 0000000..dfc8351
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/WebPImagePlugin.py
@@ -0,0 +1,351 @@
+from io import BytesIO
+
+from . import Image, ImageFile
+
+try:
+ from . import _webp
+
+ SUPPORTED = True
+except ImportError:
+ SUPPORTED = False
+
+
+_VALID_WEBP_MODES = {"RGBX": True, "RGBA": True, "RGB": True}
+
+_VALID_WEBP_LEGACY_MODES = {"RGB": True, "RGBA": True}
+
+_VP8_MODES_BY_IDENTIFIER = {
+ b"VP8 ": "RGB",
+ b"VP8X": "RGBA",
+ b"VP8L": "RGBA", # lossless
+}
+
+
+def _accept(prefix):
+ is_riff_file_format = prefix[:4] == b"RIFF"
+ is_webp_file = prefix[8:12] == b"WEBP"
+ is_valid_vp8_mode = prefix[12:16] in _VP8_MODES_BY_IDENTIFIER
+
+ if is_riff_file_format and is_webp_file and is_valid_vp8_mode:
+ if not SUPPORTED:
+ return (
+ "image file could not be identified because WEBP support not installed"
+ )
+ return True
+
+
+class WebPImageFile(ImageFile.ImageFile):
+
+ format = "WEBP"
+ format_description = "WebP image"
+ __loaded = 0
+ __logical_frame = 0
+
+ def _open(self):
+ if not _webp.HAVE_WEBPANIM:
+ # Legacy mode
+ data, width, height, self.mode, icc_profile, exif = _webp.WebPDecode(
+ self.fp.read()
+ )
+ if icc_profile:
+ self.info["icc_profile"] = icc_profile
+ if exif:
+ self.info["exif"] = exif
+ self._size = width, height
+ self.fp = BytesIO(data)
+ self.tile = [("raw", (0, 0) + self.size, 0, self.mode)]
+ self.n_frames = 1
+ self.is_animated = False
+ return
+
+ # Use the newer AnimDecoder API to parse the (possibly) animated file,
+ # and access muxed chunks like ICC/EXIF/XMP.
+ self._decoder = _webp.WebPAnimDecoder(self.fp.read())
+
+ # Get info from decoder
+ width, height, loop_count, bgcolor, frame_count, mode = self._decoder.get_info()
+ self._size = width, height
+ self.info["loop"] = loop_count
+ bg_a, bg_r, bg_g, bg_b = (
+ (bgcolor >> 24) & 0xFF,
+ (bgcolor >> 16) & 0xFF,
+ (bgcolor >> 8) & 0xFF,
+ bgcolor & 0xFF,
+ )
+ self.info["background"] = (bg_r, bg_g, bg_b, bg_a)
+ self.n_frames = frame_count
+ self.is_animated = self.n_frames > 1
+ self.mode = "RGB" if mode == "RGBX" else mode
+ self.rawmode = mode
+ self.tile = []
+
+ # Attempt to read ICC / EXIF / XMP chunks from file
+ icc_profile = self._decoder.get_chunk("ICCP")
+ exif = self._decoder.get_chunk("EXIF")
+ xmp = self._decoder.get_chunk("XMP ")
+ if icc_profile:
+ self.info["icc_profile"] = icc_profile
+ if exif:
+ self.info["exif"] = exif
+ if xmp:
+ self.info["xmp"] = xmp
+
+ # Initialize seek state
+ self._reset(reset=False)
+
+ def _getexif(self):
+ if "exif" not in self.info:
+ return None
+ return self.getexif()._get_merged_dict()
+
+ def seek(self, frame):
+ if not self._seek_check(frame):
+ return
+
+ # Set logical frame to requested position
+ self.__logical_frame = frame
+
+ def _reset(self, reset=True):
+ if reset:
+ self._decoder.reset()
+ self.__physical_frame = 0
+ self.__loaded = -1
+ self.__timestamp = 0
+
+ def _get_next(self):
+ # Get next frame
+ ret = self._decoder.get_next()
+ self.__physical_frame += 1
+
+ # Check if an error occurred
+ if ret is None:
+ self._reset() # Reset just to be safe
+ self.seek(0)
+ raise EOFError("failed to decode next frame in WebP file")
+
+ # Compute duration
+ data, timestamp = ret
+ duration = timestamp - self.__timestamp
+ self.__timestamp = timestamp
+
+ # libwebp gives frame end, adjust to start of frame
+ timestamp -= duration
+ return data, timestamp, duration
+
+ def _seek(self, frame):
+ if self.__physical_frame == frame:
+ return # Nothing to do
+ if frame < self.__physical_frame:
+ self._reset() # Rewind to beginning
+ while self.__physical_frame < frame:
+ self._get_next() # Advance to the requested frame
+
+ def load(self):
+ if _webp.HAVE_WEBPANIM:
+ if self.__loaded != self.__logical_frame:
+ self._seek(self.__logical_frame)
+
+ # We need to load the image data for this frame
+ data, timestamp, duration = self._get_next()
+ self.info["timestamp"] = timestamp
+ self.info["duration"] = duration
+ self.__loaded = self.__logical_frame
+
+ # Set tile
+ if self.fp and self._exclusive_fp:
+ self.fp.close()
+ self.fp = BytesIO(data)
+ self.tile = [("raw", (0, 0) + self.size, 0, self.rawmode)]
+
+ return super().load()
+
+ def tell(self):
+ if not _webp.HAVE_WEBPANIM:
+ return super().tell()
+
+ return self.__logical_frame
+
+
+def _save_all(im, fp, filename):
+ encoderinfo = im.encoderinfo.copy()
+ append_images = list(encoderinfo.get("append_images", []))
+
+ # If total frame count is 1, then save using the legacy API, which
+ # will preserve non-alpha modes
+ total = 0
+ for ims in [im] + append_images:
+ total += getattr(ims, "n_frames", 1)
+ if total == 1:
+ _save(im, fp, filename)
+ return
+
+ background = (0, 0, 0, 0)
+ if "background" in encoderinfo:
+ background = encoderinfo["background"]
+ elif "background" in im.info:
+ background = im.info["background"]
+ if isinstance(background, int):
+ # GifImagePlugin stores a global color table index in
+ # info["background"]. So it must be converted to an RGBA value
+ palette = im.getpalette()
+ if palette:
+ r, g, b = palette[background * 3 : (background + 1) * 3]
+ background = (r, g, b, 0)
+
+ duration = im.encoderinfo.get("duration", im.info.get("duration"))
+ loop = im.encoderinfo.get("loop", 0)
+ minimize_size = im.encoderinfo.get("minimize_size", False)
+ kmin = im.encoderinfo.get("kmin", None)
+ kmax = im.encoderinfo.get("kmax", None)
+ allow_mixed = im.encoderinfo.get("allow_mixed", False)
+ verbose = False
+ lossless = im.encoderinfo.get("lossless", False)
+ quality = im.encoderinfo.get("quality", 80)
+ method = im.encoderinfo.get("method", 0)
+ icc_profile = im.encoderinfo.get("icc_profile", "")
+ exif = im.encoderinfo.get("exif", "")
+ if isinstance(exif, Image.Exif):
+ exif = exif.tobytes()
+ xmp = im.encoderinfo.get("xmp", "")
+ if allow_mixed:
+ lossless = False
+
+ # Sensible keyframe defaults are from gif2webp.c script
+ if kmin is None:
+ kmin = 9 if lossless else 3
+ if kmax is None:
+ kmax = 17 if lossless else 5
+
+ # Validate background color
+ if (
+ not isinstance(background, (list, tuple))
+ or len(background) != 4
+ or not all(v >= 0 and v < 256 for v in background)
+ ):
+ raise OSError(
+ "Background color is not an RGBA tuple clamped to (0-255): %s"
+ % str(background)
+ )
+
+ # Convert to packed uint
+ bg_r, bg_g, bg_b, bg_a = background
+ background = (bg_a << 24) | (bg_r << 16) | (bg_g << 8) | (bg_b << 0)
+
+ # Setup the WebP animation encoder
+ enc = _webp.WebPAnimEncoder(
+ im.size[0],
+ im.size[1],
+ background,
+ loop,
+ minimize_size,
+ kmin,
+ kmax,
+ allow_mixed,
+ verbose,
+ )
+
+ # Add each frame
+ frame_idx = 0
+ timestamp = 0
+ cur_idx = im.tell()
+ try:
+ for ims in [im] + append_images:
+ # Get # of frames in this image
+ nfr = getattr(ims, "n_frames", 1)
+
+ for idx in range(nfr):
+ ims.seek(idx)
+ ims.load()
+
+ # Make sure image mode is supported
+ frame = ims
+ rawmode = ims.mode
+ if ims.mode not in _VALID_WEBP_MODES:
+ alpha = (
+ "A" in ims.mode
+ or "a" in ims.mode
+ or (ims.mode == "P" and "A" in ims.im.getpalettemode())
+ )
+ rawmode = "RGBA" if alpha else "RGB"
+ frame = ims.convert(rawmode)
+
+ if rawmode == "RGB":
+ # For faster conversion, use RGBX
+ rawmode = "RGBX"
+
+ # Append the frame to the animation encoder
+ enc.add(
+ frame.tobytes("raw", rawmode),
+ timestamp,
+ frame.size[0],
+ frame.size[1],
+ rawmode,
+ lossless,
+ quality,
+ method,
+ )
+
+ # Update timestamp and frame index
+ if isinstance(duration, (list, tuple)):
+ timestamp += duration[frame_idx]
+ else:
+ timestamp += duration
+ frame_idx += 1
+
+ finally:
+ im.seek(cur_idx)
+
+ # Force encoder to flush frames
+ enc.add(None, timestamp, 0, 0, "", lossless, quality, 0)
+
+ # Get the final output from the encoder
+ data = enc.assemble(icc_profile, exif, xmp)
+ if data is None:
+ raise OSError("cannot write file as WebP (encoder returned None)")
+
+ fp.write(data)
+
+
+def _save(im, fp, filename):
+ lossless = im.encoderinfo.get("lossless", False)
+ quality = im.encoderinfo.get("quality", 80)
+ icc_profile = im.encoderinfo.get("icc_profile", "")
+ exif = im.encoderinfo.get("exif", "")
+ if isinstance(exif, Image.Exif):
+ exif = exif.tobytes()
+ xmp = im.encoderinfo.get("xmp", "")
+ method = im.encoderinfo.get("method", 0)
+
+ if im.mode not in _VALID_WEBP_LEGACY_MODES:
+ alpha = (
+ "A" in im.mode
+ or "a" in im.mode
+ or (im.mode == "P" and "A" in im.im.getpalettemode())
+ )
+ im = im.convert("RGBA" if alpha else "RGB")
+
+ data = _webp.WebPEncode(
+ im.tobytes(),
+ im.size[0],
+ im.size[1],
+ lossless,
+ float(quality),
+ im.mode,
+ icc_profile,
+ method,
+ exif,
+ xmp,
+ )
+ if data is None:
+ raise OSError("cannot write file as WebP (encoder returned None)")
+
+ fp.write(data)
+
+
+Image.register_open(WebPImageFile.format, WebPImageFile, _accept)
+if SUPPORTED:
+ Image.register_save(WebPImageFile.format, _save)
+ if _webp.HAVE_WEBPANIM:
+ Image.register_save_all(WebPImageFile.format, _save_all)
+ Image.register_extension(WebPImageFile.format, ".webp")
+ Image.register_mime(WebPImageFile.format, "image/webp")
diff --git a/venv/Lib/site-packages/PIL/WmfImagePlugin.py b/venv/Lib/site-packages/PIL/WmfImagePlugin.py
new file mode 100644
index 0000000..87847a1
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/WmfImagePlugin.py
@@ -0,0 +1,178 @@
+#
+# The Python Imaging Library
+# $Id$
+#
+# WMF stub codec
+#
+# history:
+# 1996-12-14 fl Created
+# 2004-02-22 fl Turned into a stub driver
+# 2004-02-23 fl Added EMF support
+#
+# Copyright (c) Secret Labs AB 1997-2004. All rights reserved.
+# Copyright (c) Fredrik Lundh 1996.
+#
+# See the README file for information on usage and redistribution.
+#
+# WMF/EMF reference documentation:
+# https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-WMF/[MS-WMF].pdf
+# http://wvware.sourceforge.net/caolan/index.html
+# http://wvware.sourceforge.net/caolan/ora-wmf.html
+
+from . import Image, ImageFile
+from ._binary import i16le as word
+from ._binary import i32le as dword
+from ._binary import si16le as short
+from ._binary import si32le as _long
+
+_handler = None
+
+
+def register_handler(handler):
+ """
+ Install application-specific WMF image handler.
+
+ :param handler: Handler object.
+ """
+ global _handler
+ _handler = handler
+
+
+if hasattr(Image.core, "drawwmf"):
+ # install default handler (windows only)
+
+ class WmfHandler:
+ def open(self, im):
+ im.mode = "RGB"
+ self.bbox = im.info["wmf_bbox"]
+
+ def load(self, im):
+ im.fp.seek(0) # rewind
+ return Image.frombytes(
+ "RGB",
+ im.size,
+ Image.core.drawwmf(im.fp.read(), im.size, self.bbox),
+ "raw",
+ "BGR",
+ (im.size[0] * 3 + 3) & -4,
+ -1,
+ )
+
+ register_handler(WmfHandler())
+
+#
+# --------------------------------------------------------------------
+# Read WMF file
+
+
+def _accept(prefix):
+ return (
+ prefix[:6] == b"\xd7\xcd\xc6\x9a\x00\x00" or prefix[:4] == b"\x01\x00\x00\x00"
+ )
+
+
+##
+# Image plugin for Windows metafiles.
+
+
+class WmfStubImageFile(ImageFile.StubImageFile):
+
+ format = "WMF"
+ format_description = "Windows Metafile"
+
+ def _open(self):
+ self._inch = None
+
+ # check placable header
+ s = self.fp.read(80)
+
+ if s[:6] == b"\xd7\xcd\xc6\x9a\x00\x00":
+
+ # placeable windows metafile
+
+ # get units per inch
+ self._inch = word(s, 14)
+
+ # get bounding box
+ x0 = short(s, 6)
+ y0 = short(s, 8)
+ x1 = short(s, 10)
+ y1 = short(s, 12)
+
+ # normalize size to 72 dots per inch
+ self.info["dpi"] = 72
+ size = (
+ (x1 - x0) * self.info["dpi"] // self._inch,
+ (y1 - y0) * self.info["dpi"] // self._inch,
+ )
+
+ self.info["wmf_bbox"] = x0, y0, x1, y1
+
+ # sanity check (standard metafile header)
+ if s[22:26] != b"\x01\x00\t\x00":
+ raise SyntaxError("Unsupported WMF file format")
+
+ elif dword(s) == 1 and s[40:44] == b" EMF":
+ # enhanced metafile
+
+ # get bounding box
+ x0 = _long(s, 8)
+ y0 = _long(s, 12)
+ x1 = _long(s, 16)
+ y1 = _long(s, 20)
+
+ # get frame (in 0.01 millimeter units)
+ frame = _long(s, 24), _long(s, 28), _long(s, 32), _long(s, 36)
+
+ size = x1 - x0, y1 - y0
+
+ # calculate dots per inch from bbox and frame
+ xdpi = int(2540.0 * (x1 - y0) / (frame[2] - frame[0]) + 0.5)
+ ydpi = int(2540.0 * (y1 - y0) / (frame[3] - frame[1]) + 0.5)
+
+ self.info["wmf_bbox"] = x0, y0, x1, y1
+
+ if xdpi == ydpi:
+ self.info["dpi"] = xdpi
+ else:
+ self.info["dpi"] = xdpi, ydpi
+
+ else:
+ raise SyntaxError("Unsupported file format")
+
+ self.mode = "RGB"
+ self._size = size
+
+ loader = self._load()
+ if loader:
+ loader.open(self)
+
+ def _load(self):
+ return _handler
+
+ def load(self, dpi=None):
+ if dpi is not None and self._inch is not None:
+ self.info["dpi"] = int(dpi + 0.5)
+ x0, y0, x1, y1 = self.info["wmf_bbox"]
+ self._size = (
+ (x1 - x0) * self.info["dpi"] // self._inch,
+ (y1 - y0) * self.info["dpi"] // self._inch,
+ )
+ super().load()
+
+
+def _save(im, fp, filename):
+ if _handler is None or not hasattr(_handler, "save"):
+ raise OSError("WMF save handler not installed")
+ _handler.save(im, fp, filename)
+
+
+#
+# --------------------------------------------------------------------
+# Registry stuff
+
+
+Image.register_open(WmfStubImageFile.format, WmfStubImageFile, _accept)
+Image.register_save(WmfStubImageFile.format, _save)
+
+Image.register_extensions(WmfStubImageFile.format, [".wmf", ".emf"])
diff --git a/venv/Lib/site-packages/PIL/XVThumbImagePlugin.py b/venv/Lib/site-packages/PIL/XVThumbImagePlugin.py
new file mode 100644
index 0000000..4efedb7
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/XVThumbImagePlugin.py
@@ -0,0 +1,78 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# XV Thumbnail file handler by Charles E. "Gene" Cash
+# (gcash@magicnet.net)
+#
+# see xvcolor.c and xvbrowse.c in the sources to John Bradley's XV,
+# available from ftp://ftp.cis.upenn.edu/pub/xv/
+#
+# history:
+# 98-08-15 cec created (b/w only)
+# 98-12-09 cec added color palette
+# 98-12-28 fl added to PIL (with only a few very minor modifications)
+#
+# To do:
+# FIXME: make save work (this requires quantization support)
+#
+
+from . import Image, ImageFile, ImagePalette
+from ._binary import o8
+
+_MAGIC = b"P7 332"
+
+# standard color palette for thumbnails (RGB332)
+PALETTE = b""
+for r in range(8):
+ for g in range(8):
+ for b in range(4):
+ PALETTE = PALETTE + (
+ o8((r * 255) // 7) + o8((g * 255) // 7) + o8((b * 255) // 3)
+ )
+
+
+def _accept(prefix):
+ return prefix[:6] == _MAGIC
+
+
+##
+# Image plugin for XV thumbnail images.
+
+
+class XVThumbImageFile(ImageFile.ImageFile):
+
+ format = "XVThumb"
+ format_description = "XV thumbnail image"
+
+ def _open(self):
+
+ # check magic
+ if not _accept(self.fp.read(6)):
+ raise SyntaxError("not an XV thumbnail file")
+
+ # Skip to beginning of next line
+ self.fp.readline()
+
+ # skip info comments
+ while True:
+ s = self.fp.readline()
+ if not s:
+ raise SyntaxError("Unexpected EOF reading XV thumbnail file")
+ if s[0] != 35: # ie. when not a comment: '#'
+ break
+
+ # parse header line (already read)
+ s = s.strip().split()
+
+ self.mode = "P"
+ self._size = int(s[0]), int(s[1])
+
+ self.palette = ImagePalette.raw("RGB", PALETTE)
+
+ self.tile = [("raw", (0, 0) + self.size, self.fp.tell(), (self.mode, 0, 1))]
+
+
+# --------------------------------------------------------------------
+
+Image.register_open(XVThumbImageFile.format, XVThumbImageFile, _accept)
diff --git a/venv/Lib/site-packages/PIL/XbmImagePlugin.py b/venv/Lib/site-packages/PIL/XbmImagePlugin.py
new file mode 100644
index 0000000..644cfb3
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/XbmImagePlugin.py
@@ -0,0 +1,94 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# XBM File handling
+#
+# History:
+# 1995-09-08 fl Created
+# 1996-11-01 fl Added save support
+# 1997-07-07 fl Made header parser more tolerant
+# 1997-07-22 fl Fixed yet another parser bug
+# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.4)
+# 2001-05-13 fl Added hotspot handling (based on code from Bernhard Herzog)
+# 2004-02-24 fl Allow some whitespace before first #define
+#
+# Copyright (c) 1997-2004 by Secret Labs AB
+# Copyright (c) 1996-1997 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import re
+
+from . import Image, ImageFile
+
+# XBM header
+xbm_head = re.compile(
+ br"\s*#define[ \t]+.*_width[ \t]+(?P[0-9]+)[\r\n]+"
+ b"#define[ \t]+.*_height[ \t]+(?P[0-9]+)[\r\n]+"
+ b"(?P"
+ b"#define[ \t]+[^_]*_x_hot[ \t]+(?P[0-9]+)[\r\n]+"
+ b"#define[ \t]+[^_]*_y_hot[ \t]+(?P[0-9]+)[\r\n]+"
+ b")?"
+ b"[\\000-\\377]*_bits\\[\\]"
+)
+
+
+def _accept(prefix):
+ return prefix.lstrip()[:7] == b"#define"
+
+
+##
+# Image plugin for X11 bitmaps.
+
+
+class XbmImageFile(ImageFile.ImageFile):
+
+ format = "XBM"
+ format_description = "X11 Bitmap"
+
+ def _open(self):
+
+ m = xbm_head.match(self.fp.read(512))
+
+ if m:
+
+ xsize = int(m.group("width"))
+ ysize = int(m.group("height"))
+
+ if m.group("hotspot"):
+ self.info["hotspot"] = (int(m.group("xhot")), int(m.group("yhot")))
+
+ self.mode = "1"
+ self._size = xsize, ysize
+
+ self.tile = [("xbm", (0, 0) + self.size, m.end(), None)]
+
+
+def _save(im, fp, filename):
+
+ if im.mode != "1":
+ raise OSError(f"cannot write mode {im.mode} as XBM")
+
+ fp.write(f"#define im_width {im.size[0]}\n".encode("ascii"))
+ fp.write(f"#define im_height {im.size[1]}\n".encode("ascii"))
+
+ hotspot = im.encoderinfo.get("hotspot")
+ if hotspot:
+ fp.write(f"#define im_x_hot {hotspot[0]}\n".encode("ascii"))
+ fp.write(f"#define im_y_hot {hotspot[1]}\n".encode("ascii"))
+
+ fp.write(b"static char im_bits[] = {\n")
+
+ ImageFile._save(im, fp, [("xbm", (0, 0) + im.size, 0, None)])
+
+ fp.write(b"};\n")
+
+
+Image.register_open(XbmImageFile.format, XbmImageFile, _accept)
+Image.register_save(XbmImageFile.format, _save)
+
+Image.register_extension(XbmImageFile.format, ".xbm")
+
+Image.register_mime(XbmImageFile.format, "image/xbm")
diff --git a/venv/Lib/site-packages/PIL/XpmImagePlugin.py b/venv/Lib/site-packages/PIL/XpmImagePlugin.py
new file mode 100644
index 0000000..ebd65ba
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/XpmImagePlugin.py
@@ -0,0 +1,130 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# XPM File handling
+#
+# History:
+# 1996-12-29 fl Created
+# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.7)
+#
+# Copyright (c) Secret Labs AB 1997-2001.
+# Copyright (c) Fredrik Lundh 1996-2001.
+#
+# See the README file for information on usage and redistribution.
+#
+
+
+import re
+
+from . import Image, ImageFile, ImagePalette
+from ._binary import o8
+
+# XPM header
+xpm_head = re.compile(b'"([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*)')
+
+
+def _accept(prefix):
+ return prefix[:9] == b"/* XPM */"
+
+
+##
+# Image plugin for X11 pixel maps.
+
+
+class XpmImageFile(ImageFile.ImageFile):
+
+ format = "XPM"
+ format_description = "X11 Pixel Map"
+
+ def _open(self):
+
+ if not _accept(self.fp.read(9)):
+ raise SyntaxError("not an XPM file")
+
+ # skip forward to next string
+ while True:
+ s = self.fp.readline()
+ if not s:
+ raise SyntaxError("broken XPM file")
+ m = xpm_head.match(s)
+ if m:
+ break
+
+ self._size = int(m.group(1)), int(m.group(2))
+
+ pal = int(m.group(3))
+ bpp = int(m.group(4))
+
+ if pal > 256 or bpp != 1:
+ raise ValueError("cannot read this XPM file")
+
+ #
+ # load palette description
+
+ palette = [b"\0\0\0"] * 256
+
+ for i in range(pal):
+
+ s = self.fp.readline()
+ if s[-2:] == b"\r\n":
+ s = s[:-2]
+ elif s[-1:] in b"\r\n":
+ s = s[:-1]
+
+ c = s[1]
+ s = s[2:-2].split()
+
+ for i in range(0, len(s), 2):
+
+ if s[i] == b"c":
+
+ # process colour key
+ rgb = s[i + 1]
+ if rgb == b"None":
+ self.info["transparency"] = c
+ elif rgb[0:1] == b"#":
+ # FIXME: handle colour names (see ImagePalette.py)
+ rgb = int(rgb[1:], 16)
+ palette[c] = (
+ o8((rgb >> 16) & 255) + o8((rgb >> 8) & 255) + o8(rgb & 255)
+ )
+ else:
+ # unknown colour
+ raise ValueError("cannot read this XPM file")
+ break
+
+ else:
+
+ # missing colour key
+ raise ValueError("cannot read this XPM file")
+
+ self.mode = "P"
+ self.palette = ImagePalette.raw("RGB", b"".join(palette))
+
+ self.tile = [("raw", (0, 0) + self.size, self.fp.tell(), ("P", 0, 1))]
+
+ def load_read(self, bytes):
+
+ #
+ # load all image data in one chunk
+
+ xsize, ysize = self.size
+
+ s = [None] * ysize
+
+ for i in range(ysize):
+ s[i] = self.fp.readline()[1 : xsize + 1].ljust(xsize)
+
+ return b"".join(s)
+
+
+#
+# Registry
+
+
+Image.register_open(XpmImageFile.format, XpmImageFile, _accept)
+
+Image.register_extension(XpmImageFile.format, ".xpm")
+
+Image.register_mime(XpmImageFile.format, "image/xpm")
diff --git a/venv/Lib/site-packages/PIL/__init__.py b/venv/Lib/site-packages/PIL/__init__.py
new file mode 100644
index 0000000..890ae44
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/__init__.py
@@ -0,0 +1,139 @@
+"""Pillow (Fork of the Python Imaging Library)
+
+Pillow is the friendly PIL fork by Alex Clark and Contributors.
+ https://github.com/python-pillow/Pillow/
+
+Pillow is forked from PIL 1.1.7.
+
+PIL is the Python Imaging Library by Fredrik Lundh and Contributors.
+Copyright (c) 1999 by Secret Labs AB.
+
+Use PIL.__version__ for this Pillow version.
+
+;-)
+"""
+
+import sys
+import warnings
+
+from . import _version
+
+# VERSION was removed in Pillow 6.0.0.
+__version__ = _version.__version__
+
+
+# PILLOW_VERSION is deprecated and will be removed in a future release.
+# Use __version__ instead.
+def _raise_version_warning():
+ warnings.warn(
+ "PILLOW_VERSION is deprecated and will be removed in Pillow 9 (2022-01-02). "
+ "Use __version__ instead.",
+ DeprecationWarning,
+ stacklevel=3,
+ )
+
+
+if sys.version_info >= (3, 7):
+
+ def __getattr__(name):
+ if name == "PILLOW_VERSION":
+ _raise_version_warning()
+ return __version__
+ raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
+
+
+else:
+
+ class _Deprecated_Version(str):
+ def __str__(self):
+ _raise_version_warning()
+ return super().__str__()
+
+ def __getitem__(self, key):
+ _raise_version_warning()
+ return super().__getitem__(key)
+
+ def __eq__(self, other):
+ _raise_version_warning()
+ return super().__eq__(other)
+
+ def __ne__(self, other):
+ _raise_version_warning()
+ return super().__ne__(other)
+
+ def __gt__(self, other):
+ _raise_version_warning()
+ return super().__gt__(other)
+
+ def __lt__(self, other):
+ _raise_version_warning()
+ return super().__lt__(other)
+
+ def __ge__(self, other):
+ _raise_version_warning()
+ return super().__gt__(other)
+
+ def __le__(self, other):
+ _raise_version_warning()
+ return super().__lt__(other)
+
+ PILLOW_VERSION = _Deprecated_Version(__version__)
+
+del _version
+
+
+_plugins = [
+ "BlpImagePlugin",
+ "BmpImagePlugin",
+ "BufrStubImagePlugin",
+ "CurImagePlugin",
+ "DcxImagePlugin",
+ "DdsImagePlugin",
+ "EpsImagePlugin",
+ "FitsStubImagePlugin",
+ "FliImagePlugin",
+ "FpxImagePlugin",
+ "FtexImagePlugin",
+ "GbrImagePlugin",
+ "GifImagePlugin",
+ "GribStubImagePlugin",
+ "Hdf5StubImagePlugin",
+ "IcnsImagePlugin",
+ "IcoImagePlugin",
+ "ImImagePlugin",
+ "ImtImagePlugin",
+ "IptcImagePlugin",
+ "JpegImagePlugin",
+ "Jpeg2KImagePlugin",
+ "McIdasImagePlugin",
+ "MicImagePlugin",
+ "MpegImagePlugin",
+ "MpoImagePlugin",
+ "MspImagePlugin",
+ "PalmImagePlugin",
+ "PcdImagePlugin",
+ "PcxImagePlugin",
+ "PdfImagePlugin",
+ "PixarImagePlugin",
+ "PngImagePlugin",
+ "PpmImagePlugin",
+ "PsdImagePlugin",
+ "SgiImagePlugin",
+ "SpiderImagePlugin",
+ "SunImagePlugin",
+ "TgaImagePlugin",
+ "TiffImagePlugin",
+ "WebPImagePlugin",
+ "WmfImagePlugin",
+ "XbmImagePlugin",
+ "XpmImagePlugin",
+ "XVThumbImagePlugin",
+]
+
+
+class UnidentifiedImageError(OSError):
+ """
+ Raised in :py:meth:`PIL.Image.open` if an image cannot be opened and identified.
+ """
+
+ pass
diff --git a/venv/Lib/site-packages/PIL/__main__.py b/venv/Lib/site-packages/PIL/__main__.py
new file mode 100644
index 0000000..a05323f
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/__main__.py
@@ -0,0 +1,3 @@
+from .features import pilinfo
+
+pilinfo()
diff --git a/venv/Lib/site-packages/PIL/_binary.py b/venv/Lib/site-packages/PIL/_binary.py
new file mode 100644
index 0000000..5564f45
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/_binary.py
@@ -0,0 +1,92 @@
+#
+# The Python Imaging Library.
+# $Id$
+#
+# Binary input/output support routines.
+#
+# Copyright (c) 1997-2003 by Secret Labs AB
+# Copyright (c) 1995-2003 by Fredrik Lundh
+# Copyright (c) 2012 by Brian Crowell
+#
+# See the README file for information on usage and redistribution.
+#
+
+
+"""Binary input/output support routines."""
+
+
+from struct import pack, unpack_from
+
+
+def i8(c):
+ return c if c.__class__ is int else c[0]
+
+
+def o8(i):
+ return bytes((i & 255,))
+
+
+# Input, le = little endian, be = big endian
+def i16le(c, o=0):
+ """
+ Converts a 2-bytes (16 bits) string to an unsigned integer.
+
+ :param c: string containing bytes to convert
+ :param o: offset of bytes to convert in string
+ """
+ return unpack_from("H", c, o)[0]
+
+
+def i32be(c, o=0):
+ return unpack_from(">I", c, o)[0]
+
+
+# Output, le = little endian, be = big endian
+def o16le(i):
+ return pack("H", i)
+
+
+def o32be(i):
+ return pack(">I", i)
diff --git a/venv/Lib/site-packages/PIL/_imaging.cp38-win_amd64.pyd b/venv/Lib/site-packages/PIL/_imaging.cp38-win_amd64.pyd
new file mode 100644
index 0000000..efbeb14
Binary files /dev/null and b/venv/Lib/site-packages/PIL/_imaging.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/PIL/_imagingcms.cp38-win_amd64.pyd b/venv/Lib/site-packages/PIL/_imagingcms.cp38-win_amd64.pyd
new file mode 100644
index 0000000..6fa800b
Binary files /dev/null and b/venv/Lib/site-packages/PIL/_imagingcms.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/PIL/_imagingft.cp38-win_amd64.pyd b/venv/Lib/site-packages/PIL/_imagingft.cp38-win_amd64.pyd
new file mode 100644
index 0000000..766aa92
Binary files /dev/null and b/venv/Lib/site-packages/PIL/_imagingft.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/PIL/_imagingmath.cp38-win_amd64.pyd b/venv/Lib/site-packages/PIL/_imagingmath.cp38-win_amd64.pyd
new file mode 100644
index 0000000..6901ba9
Binary files /dev/null and b/venv/Lib/site-packages/PIL/_imagingmath.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/PIL/_imagingmorph.cp38-win_amd64.pyd b/venv/Lib/site-packages/PIL/_imagingmorph.cp38-win_amd64.pyd
new file mode 100644
index 0000000..63b09ca
Binary files /dev/null and b/venv/Lib/site-packages/PIL/_imagingmorph.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/PIL/_imagingtk.cp38-win_amd64.pyd b/venv/Lib/site-packages/PIL/_imagingtk.cp38-win_amd64.pyd
new file mode 100644
index 0000000..5447029
Binary files /dev/null and b/venv/Lib/site-packages/PIL/_imagingtk.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/PIL/_tkinter_finder.py b/venv/Lib/site-packages/PIL/_tkinter_finder.py
new file mode 100644
index 0000000..58aeffb
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/_tkinter_finder.py
@@ -0,0 +1,20 @@
+""" Find compiled module linking to Tcl / Tk libraries
+"""
+import sys
+import tkinter
+import warnings
+from tkinter import _tkinter as tk
+
+if hasattr(sys, "pypy_find_executable"):
+ TKINTER_LIB = tk.tklib_cffi.__file__
+else:
+ TKINTER_LIB = tk.__file__
+
+tk_version = str(tkinter.TkVersion)
+if tk_version == "8.4":
+ warnings.warn(
+ "Support for Tk/Tcl 8.4 is deprecated and will be removed"
+ " in Pillow 10 (2023-01-02). Please upgrade to Tk/Tcl 8.5 "
+ "or newer.",
+ DeprecationWarning,
+ )
diff --git a/venv/Lib/site-packages/PIL/_util.py b/venv/Lib/site-packages/PIL/_util.py
new file mode 100644
index 0000000..0c5d389
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/_util.py
@@ -0,0 +1,19 @@
+import os
+from pathlib import Path
+
+
+def isPath(f):
+ return isinstance(f, (bytes, str, Path))
+
+
+# Checks if an object is a string, and that it points to a directory.
+def isDirectory(f):
+ return isPath(f) and os.path.isdir(f)
+
+
+class deferred_error:
+ def __init__(self, ex):
+ self.ex = ex
+
+ def __getattr__(self, elt):
+ raise self.ex
diff --git a/venv/Lib/site-packages/PIL/_version.py b/venv/Lib/site-packages/PIL/_version.py
new file mode 100644
index 0000000..8fe6294
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/_version.py
@@ -0,0 +1,2 @@
+# Master version for Pillow
+__version__ = "8.2.0"
diff --git a/venv/Lib/site-packages/PIL/_webp.cp38-win_amd64.pyd b/venv/Lib/site-packages/PIL/_webp.cp38-win_amd64.pyd
new file mode 100644
index 0000000..44b2640
Binary files /dev/null and b/venv/Lib/site-packages/PIL/_webp.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/PIL/features.py b/venv/Lib/site-packages/PIL/features.py
new file mode 100644
index 0000000..66d0ba1
--- /dev/null
+++ b/venv/Lib/site-packages/PIL/features.py
@@ -0,0 +1,320 @@
+import collections
+import os
+import sys
+import warnings
+
+import PIL
+
+from . import Image
+
+modules = {
+ "pil": ("PIL._imaging", "PILLOW_VERSION"),
+ "tkinter": ("PIL._tkinter_finder", "tk_version"),
+ "freetype2": ("PIL._imagingft", "freetype2_version"),
+ "littlecms2": ("PIL._imagingcms", "littlecms_version"),
+ "webp": ("PIL._webp", "webpdecoder_version"),
+}
+
+
+def check_module(feature):
+ """
+ Checks if a module is available.
+
+ :param feature: The module to check for.
+ :returns: ``True`` if available, ``False`` otherwise.
+ :raises ValueError: If the module is not defined in this version of Pillow.
+ """
+ if not (feature in modules):
+ raise ValueError(f"Unknown module {feature}")
+
+ module, ver = modules[feature]
+
+ try:
+ __import__(module)
+ return True
+ except ImportError:
+ return False
+
+
+def version_module(feature):
+ """
+ :param feature: The module to check for.
+ :returns:
+ The loaded version number as a string, or ``None`` if unknown or not available.
+ :raises ValueError: If the module is not defined in this version of Pillow.
+ """
+ if not check_module(feature):
+ return None
+
+ module, ver = modules[feature]
+
+ if ver is None:
+ return None
+
+ return getattr(__import__(module, fromlist=[ver]), ver)
+
+
+def get_supported_modules():
+ """
+ :returns: A list of all supported modules.
+ """
+ return [f for f in modules if check_module(f)]
+
+
+codecs = {
+ "jpg": ("jpeg", "jpeglib"),
+ "jpg_2000": ("jpeg2k", "jp2klib"),
+ "zlib": ("zip", "zlib"),
+ "libtiff": ("libtiff", "libtiff"),
+}
+
+
+def check_codec(feature):
+ """
+ Checks if a codec is available.
+
+ :param feature: The codec to check for.
+ :returns: ``True`` if available, ``False`` otherwise.
+ :raises ValueError: If the codec is not defined in this version of Pillow.
+ """
+ if feature not in codecs:
+ raise ValueError(f"Unknown codec {feature}")
+
+ codec, lib = codecs[feature]
+
+ return codec + "_encoder" in dir(Image.core)
+
+
+def version_codec(feature):
+ """
+ :param feature: The codec to check for.
+ :returns:
+ The version number as a string, or ``None`` if not available.
+ Checked at compile time for ``jpg``, run-time otherwise.
+ :raises ValueError: If the codec is not defined in this version of Pillow.
+ """
+ if not check_codec(feature):
+ return None
+
+ codec, lib = codecs[feature]
+
+ version = getattr(Image.core, lib + "_version")
+
+ if feature == "libtiff":
+ return version.split("\n")[0].split("Version ")[1]
+
+ return version
+
+
+def get_supported_codecs():
+ """
+ :returns: A list of all supported codecs.
+ """
+ return [f for f in codecs if check_codec(f)]
+
+
+features = {
+ "webp_anim": ("PIL._webp", "HAVE_WEBPANIM", None),
+ "webp_mux": ("PIL._webp", "HAVE_WEBPMUX", None),
+ "transp_webp": ("PIL._webp", "HAVE_TRANSPARENCY", None),
+ "raqm": ("PIL._imagingft", "HAVE_RAQM", "raqm_version"),
+ "fribidi": ("PIL._imagingft", "HAVE_FRIBIDI", "fribidi_version"),
+ "harfbuzz": ("PIL._imagingft", "HAVE_HARFBUZZ", "harfbuzz_version"),
+ "libjpeg_turbo": ("PIL._imaging", "HAVE_LIBJPEGTURBO", "libjpeg_turbo_version"),
+ "libimagequant": ("PIL._imaging", "HAVE_LIBIMAGEQUANT", "imagequant_version"),
+ "xcb": ("PIL._imaging", "HAVE_XCB", None),
+}
+
+
+def check_feature(feature):
+ """
+ Checks if a feature is available.
+
+ :param feature: The feature to check for.
+ :returns: ``True`` if available, ``False`` if unavailable, ``None`` if unknown.
+ :raises ValueError: If the feature is not defined in this version of Pillow.
+ """
+ if feature not in features:
+ raise ValueError(f"Unknown feature {feature}")
+
+ module, flag, ver = features[feature]
+
+ try:
+ imported_module = __import__(module, fromlist=["PIL"])
+ return getattr(imported_module, flag)
+ except ImportError:
+ return None
+
+
+def version_feature(feature):
+ """
+ :param feature: The feature to check for.
+ :returns: The version number as a string, or ``None`` if not available.
+ :raises ValueError: If the feature is not defined in this version of Pillow.
+ """
+ if not check_feature(feature):
+ return None
+
+ module, flag, ver = features[feature]
+
+ if ver is None:
+ return None
+
+ return getattr(__import__(module, fromlist=[ver]), ver)
+
+
+def get_supported_features():
+ """
+ :returns: A list of all supported features.
+ """
+ return [f for f in features if check_feature(f)]
+
+
+def check(feature):
+ """
+ :param feature: A module, codec, or feature name.
+ :returns:
+ ``True`` if the module, codec, or feature is available,
+ ``False`` or ``None`` otherwise.
+ """
+
+ if feature in modules:
+ return check_module(feature)
+ if feature in codecs:
+ return check_codec(feature)
+ if feature in features:
+ return check_feature(feature)
+ warnings.warn(f"Unknown feature '{feature}'.", stacklevel=2)
+ return False
+
+
+def version(feature):
+ """
+ :param feature:
+ The module, codec, or feature to check for.
+ :returns:
+ The version number as a string, or ``None`` if unknown or not available.
+ """
+ if feature in modules:
+ return version_module(feature)
+ if feature in codecs:
+ return version_codec(feature)
+ if feature in features:
+ return version_feature(feature)
+ return None
+
+
+def get_supported():
+ """
+ :returns: A list of all supported modules, features, and codecs.
+ """
+
+ ret = get_supported_modules()
+ ret.extend(get_supported_features())
+ ret.extend(get_supported_codecs())
+ return ret
+
+
+def pilinfo(out=None, supported_formats=True):
+ """
+ Prints information about this installation of Pillow.
+ This function can be called with ``python -m PIL``.
+
+ :param out:
+ The output stream to print to. Defaults to ``sys.stdout`` if ``None``.
+ :param supported_formats:
+ If ``True``, a list of all supported image file formats will be printed.
+ """
+
+ if out is None:
+ out = sys.stdout
+
+ Image.init()
+
+ print("-" * 68, file=out)
+ print(f"Pillow {PIL.__version__}", file=out)
+ py_version = sys.version.splitlines()
+ print(f"Python {py_version[0].strip()}", file=out)
+ for py_version in py_version[1:]:
+ print(f" {py_version.strip()}", file=out)
+ print("-" * 68, file=out)
+ print(
+ f"Python modules loaded from {os.path.dirname(Image.__file__)}",
+ file=out,
+ )
+ print(
+ f"Binary modules loaded from {os.path.dirname(Image.core.__file__)}",
+ file=out,
+ )
+ print("-" * 68, file=out)
+
+ for name, feature in [
+ ("pil", "PIL CORE"),
+ ("tkinter", "TKINTER"),
+ ("freetype2", "FREETYPE2"),
+ ("littlecms2", "LITTLECMS2"),
+ ("webp", "WEBP"),
+ ("transp_webp", "WEBP Transparency"),
+ ("webp_mux", "WEBPMUX"),
+ ("webp_anim", "WEBP Animation"),
+ ("jpg", "JPEG"),
+ ("jpg_2000", "OPENJPEG (JPEG2000)"),
+ ("zlib", "ZLIB (PNG/ZIP)"),
+ ("libtiff", "LIBTIFF"),
+ ("raqm", "RAQM (Bidirectional Text)"),
+ ("libimagequant", "LIBIMAGEQUANT (Quantization method)"),
+ ("xcb", "XCB (X protocol)"),
+ ]:
+ if check(name):
+ if name == "jpg" and check_feature("libjpeg_turbo"):
+ v = "libjpeg-turbo " + version_feature("libjpeg_turbo")
+ else:
+ v = version(name)
+ if v is not None:
+ version_static = name in ("pil", "jpg")
+ if name == "littlecms2":
+ # this check is also in src/_imagingcms.c:setup_module()
+ version_static = tuple(int(x) for x in v.split(".")) < (2, 7)
+ t = "compiled for" if version_static else "loaded"
+ if name == "raqm":
+ for f in ("fribidi", "harfbuzz"):
+ v2 = version_feature(f)
+ if v2 is not None:
+ v += f", {f} {v2}"
+ print("---", feature, "support ok,", t, v, file=out)
+ else:
+ print("---", feature, "support ok", file=out)
+ else:
+ print("***", feature, "support not installed", file=out)
+ print("-" * 68, file=out)
+
+ if supported_formats:
+ extensions = collections.defaultdict(list)
+ for ext, i in Image.EXTENSION.items():
+ extensions[i].append(ext)
+
+ for i in sorted(Image.ID):
+ line = f"{i}"
+ if i in Image.MIME:
+ line = f"{line} {Image.MIME[i]}"
+ print(line, file=out)
+
+ if i in extensions:
+ print(
+ "Extensions: {}".format(", ".join(sorted(extensions[i]))), file=out
+ )
+
+ features = []
+ if i in Image.OPEN:
+ features.append("open")
+ if i in Image.SAVE:
+ features.append("save")
+ if i in Image.SAVE_ALL:
+ features.append("save_all")
+ if i in Image.DECODERS:
+ features.append("decode")
+ if i in Image.ENCODERS:
+ features.append("encode")
+
+ print("Features: {}".format(", ".join(features)), file=out)
+ print("-" * 68, file=out)
diff --git a/venv/Lib/site-packages/Pillow-8.2.0.dist-info/INSTALLER b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/INSTALLER
new file mode 100644
index 0000000..a1b589e
--- /dev/null
+++ b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/venv/Lib/site-packages/Pillow-8.2.0.dist-info/LICENSE b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/LICENSE
new file mode 100644
index 0000000..1197291
--- /dev/null
+++ b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/LICENSE
@@ -0,0 +1,30 @@
+The Python Imaging Library (PIL) is
+
+ Copyright © 1997-2011 by Secret Labs AB
+ Copyright © 1995-2011 by Fredrik Lundh
+
+Pillow is the friendly PIL fork. It is
+
+ Copyright © 2010-2021 by Alex Clark and contributors
+
+Like PIL, Pillow is licensed under the open source HPND License:
+
+By obtaining, using, and/or copying this software and/or its associated
+documentation, you agree that you have read, understood, and will comply
+with the following terms and conditions:
+
+Permission to use, copy, modify, and distribute this software and its
+associated documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appears in all copies, and that
+both that copyright notice and this permission notice appear in supporting
+documentation, and that the name of Secret Labs AB or the author not be
+used in advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.
+
+SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR ANY SPECIAL,
+INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
diff --git a/venv/Lib/site-packages/Pillow-8.2.0.dist-info/METADATA b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/METADATA
new file mode 100644
index 0000000..f4b735e
--- /dev/null
+++ b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/METADATA
@@ -0,0 +1,137 @@
+Metadata-Version: 2.1
+Name: Pillow
+Version: 8.2.0
+Summary: Python Imaging Library (Fork)
+Home-page: https://python-pillow.org
+Author: Alex Clark (PIL Fork Author)
+Author-email: aclark@python-pillow.org
+License: HPND
+Project-URL: Documentation, https://pillow.readthedocs.io
+Project-URL: Source, https://github.com/python-pillow/Pillow
+Project-URL: Funding, https://tidelift.com/subscription/pkg/pypi-pillow?utm_source=pypi-pillow&utm_medium=pypi
+Project-URL: Release notes, https://pillow.readthedocs.io/en/stable/releasenotes/index.html
+Project-URL: Changelog, https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst
+Keywords: Imaging
+Platform: UNKNOWN
+Classifier: Development Status :: 6 - Mature
+Classifier: License :: OSI Approved :: Historical Permission Notice and Disclaimer (HPND)
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+Classifier: Topic :: Multimedia :: Graphics
+Classifier: Topic :: Multimedia :: Graphics :: Capture :: Digital Camera
+Classifier: Topic :: Multimedia :: Graphics :: Capture :: Screen Capture
+Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
+Classifier: Topic :: Multimedia :: Graphics :: Viewers
+Requires-Python: >=3.6
+Description-Content-Type: text/markdown
+
+
+
+
+
+# Pillow
+
+## Python Imaging Library (Fork)
+
+Pillow is the friendly PIL fork by [Alex Clark and
+Contributors](https://github.com/python-pillow/Pillow/graphs/contributors).
+PIL is the Python Imaging Library by Fredrik Lundh and Contributors.
+As of 2019, Pillow development is
+[supported by Tidelift](https://tidelift.com/subscription/pkg/pypi-pillow?utm_source=pypi-pillow&utm_medium=readme&utm_campaign=enterprise).
+
+
+
+ docs
+
+
+
+
+
+ tests
+
+
+
+
+
+
+
+
+
+
+
+ package
+
+
+
+
+
+
+
+
+ social
+
+
+
+
+
+
+
+## Overview
+
+The Python Imaging Library adds image processing capabilities to your Python interpreter.
+
+This library provides extensive file format support, an efficient internal representation, and fairly powerful image processing capabilities.
+
+The core image library is designed for fast access to data stored in a few basic pixel formats. It should provide a solid foundation for a general image processing tool.
+
+## More Information
+
+- [Documentation](https://pillow.readthedocs.io/)
+ - [Installation](https://pillow.readthedocs.io/en/latest/installation.html)
+ - [Handbook](https://pillow.readthedocs.io/en/latest/handbook/index.html)
+- [Contribute](https://github.com/python-pillow/Pillow/blob/master/.github/CONTRIBUTING.md)
+ - [Issues](https://github.com/python-pillow/Pillow/issues)
+ - [Pull requests](https://github.com/python-pillow/Pillow/pulls)
+- [Release notes](https://pillow.readthedocs.io/en/stable/releasenotes/index.html)
+- [Changelog](https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst)
+ - [Pre-fork](https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst#pre-fork)
+
+## Report a Vulnerability
+
+To report a security vulnerability, please follow the procedure described in the [Tidelift security policy](https://tidelift.com/docs/security).
+
+
diff --git a/venv/Lib/site-packages/Pillow-8.2.0.dist-info/RECORD b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/RECORD
new file mode 100644
index 0000000..e1230a3
--- /dev/null
+++ b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/RECORD
@@ -0,0 +1,198 @@
+PIL/BdfFontFile.py,sha256=hRnSgFZOIiTgWfJIaRHRQpU4TKVok2E31KJY6sbZPwc,2817
+PIL/BlpImagePlugin.py,sha256=bbXSPXYqn6uzs63U0onoI7fz32xLcbvJo4Odbxouy00,14538
+PIL/BmpImagePlugin.py,sha256=JNcxnXmnv4s_TuFKOqqrjsVHC6cyVSN2BiA2fTiY7Rg,14164
+PIL/BufrStubImagePlugin.py,sha256=Zq60GwcqQJTmZJrA9EQq94QvYpNqwYvQzHojh4U7SDw,1520
+PIL/ContainerIO.py,sha256=1U15zUXjWO8uWK-MyCp66Eh7djQEU-oUeCDoBqewNkA,2883
+PIL/CurImagePlugin.py,sha256=er_bI3V1Ezly0QfFJq0fZMlGwrD5izDutwF1FrOwiMA,1679
+PIL/DcxImagePlugin.py,sha256=bfESLTji9GerqI4oYsy5oTFyRMlr2mjSsXzpY9IuLsk,2145
+PIL/DdsImagePlugin.py,sha256=DxDAfsdOvcjyLvMwbcZWLbYBxNv2sxNUOZ5dlOPOPhQ,6009
+PIL/EpsImagePlugin.py,sha256=7H3ZSJzQ88OcM-m0N-THhS1BNBekHqlQIKcoHCWQTkM,12123
+PIL/ExifTags.py,sha256=fx7S0CnztT9ptHT2HGuMYteI99CMVrD73IHeRI5OFjU,9009
+PIL/FitsStubImagePlugin.py,sha256=8Zq2D9ReJE-stBppxB_ELX3wxcS0_BDGg6Xce7sWpaU,1624
+PIL/FliImagePlugin.py,sha256=pGeC1JI6d5xdYWRhsKz0_3yeFzGII_jYbQhJYNo6n7Y,4260
+PIL/FontFile.py,sha256=LkQcbwUu1C4fokMnbg-ao9ksp2RX-saaPRie-z2rpH4,2765
+PIL/FpxImagePlugin.py,sha256=nKGioxa5C0q9X9qva3t_htRV_3jXQcFkclVxTEaSusk,6658
+PIL/FtexImagePlugin.py,sha256=d5xy9hZ6vzmzfTS7eUM_LaB8NHgV6izj1VKTBHOfFEQ,3309
+PIL/GbrImagePlugin.py,sha256=u9kOIdBxYMRrXfXfIwGcz0uyvvxNRCwO3U1xcfa51T4,2794
+PIL/GdImageFile.py,sha256=JFWSUssG1z1r884GQtBbZ3T7uhPF4cDXSuW3ctgf3TU,2465
+PIL/GifImagePlugin.py,sha256=WH4Yda_y3NEhnXiHSILS-KPL3itJ3IYPyMli1ol_370,28750
+PIL/GimpGradientFile.py,sha256=G0ClRmjRHIJoU0nmG-P-tgehLHZip5i0rY4-5pjJ7bc,3353
+PIL/GimpPaletteFile.py,sha256=_wWvNmB40AfQ1M5sTxoYYXOMApWQji7rrubqZhfd1dU,1274
+PIL/GribStubImagePlugin.py,sha256=sSBrTisTcunuC0WcSQ4_55nV6uFvLCQ0JLSd62dgURw,1515
+PIL/Hdf5StubImagePlugin.py,sha256=zjtFPZIcVkWXvYRPnHow6XA9kElEi772w7PFSuEqmq4,1517
+PIL/IcnsImagePlugin.py,sha256=Zef5EX1IlPq_LHdig-TEF_njD5KeXpTnvdiSTYaqi50,11782
+PIL/IcoImagePlugin.py,sha256=umIc2ud-FGl0ITHBfltfIY7dQMOkBsO6irhnTYP6QBA,10340
+PIL/ImImagePlugin.py,sha256=RFFyRlFJTVuti-TZ9yWsqP7vJJydgX1MC6mjYwwdw-0,10729
+PIL/Image.py,sha256=3ooJAJAxnPQx3sdWU7L32ANqtf61UwslMPev2pV5uYU,118373
+PIL/ImageChops.py,sha256=HOGSnuU4EcCbdeUzEGPm54zewppHWWe12XLyOLLPgCw,7297
+PIL/ImageCms.py,sha256=NZs-joebSCHg2J0fKXASLNgiXl7FRfWmUn-IW7AkonQ,37087
+PIL/ImageColor.py,sha256=txXexsvf-ZDCPaTs6yhwsmlzTNIBhynVo4Xywt30MAg,8646
+PIL/ImageDraw.py,sha256=-GlFqYQVDpKD8ivpeAtWWorWQp9oV07CWz-MDJBRegU,33966
+PIL/ImageDraw2.py,sha256=oBhpBTZhx3bd4D0s8E2kDjBzgThRkDU_TE_987l501k,5019
+PIL/ImageEnhance.py,sha256=CJnCouiBmxN2fE0xW7m_uMdBqcm-Fp0S3ruHhkygal4,3190
+PIL/ImageFile.py,sha256=ioPw5MUL1BFsEBSyOlkaK6J52kzqtAPnLhiQ9-sft28,21023
+PIL/ImageFilter.py,sha256=JJRlxb9yHgRMNGCrjtfHuday_7aorFSN-uZhXHToisM,15924
+PIL/ImageFont.py,sha256=ABwCz40JzZFNijXFUb5UyRiT7kjAHLuNdpOwCG-pSxU,45248
+PIL/ImageGrab.py,sha256=2o1aA0_vP-KeRJsJtIxYhi61yCK4k_Khh6NHQD7HO2Q,3625
+PIL/ImageMath.py,sha256=iQPtbXgdhcCchGTXbDop7AiI_Fe-fNmq8m1YHsHMBgc,7048
+PIL/ImageMode.py,sha256=woBgGcqCT5yTkS5yNWJyst4aaLdSMZsPpPoXDgnqo6M,2075
+PIL/ImageMorph.py,sha256=TM0-barsZdbHEyQ_wB2SrdZvJBkRnWnUbDzGVzDECL4,7854
+PIL/ImageOps.py,sha256=p1ckflRWMziSFJKzoMs_QDE8naBi8zYr0dcZ3MAKWoA,18711
+PIL/ImagePalette.py,sha256=ZjkQry8gfuET-QmG8P18UcZlttKUQjZUgQ3EKh3E6Js,6350
+PIL/ImagePath.py,sha256=lVmH1-lCd0SyrFoqyhlstAFW2iJuC14fPcW8iewvxCQ,336
+PIL/ImageQt.py,sha256=oZFNAntkAYxTbS99jU8F6L9U15U8xDtNU0QGZddXMsk,6380
+PIL/ImageSequence.py,sha256=3djA7vDH6wafTGbt4e_lPlVhy2TaKfdSrA1XQ4n-Uoc,1850
+PIL/ImageShow.py,sha256=nHrgk9tMOdM9kvsb8_xUyHTLcxVaLbigUHDnt00JIWk,6845
+PIL/ImageStat.py,sha256=PieQi44mRHE6jod7NqujwGr6WCntuZuNGmC2z9PaoDY,3901
+PIL/ImageTk.py,sha256=rLPqAnLH61y2XRHgRPUdesYLQqnDQ__LeRK66KL_fPQ,9324
+PIL/ImageTransform.py,sha256=V2l6tsjmymMIF7HQBMI21UPn4mlicarrm4NF3Kazvio,2843
+PIL/ImageWin.py,sha256=1MQBJS7tVrQzI9jN0nmeNeFpIaq8fXra9kQocHkiFxM,7191
+PIL/ImtImagePlugin.py,sha256=cn60lqUVnK2oh_sPqPBORr_rZ4zuF_6FU0V96IAh8Ww,2203
+PIL/IptcImagePlugin.py,sha256=-RZBUUodHcF5wLKanW1MxJj7cbLOpx5LvXqm0vDM22U,5714
+PIL/Jpeg2KImagePlugin.py,sha256=3NAbqBmvSU_fHUIGspXFsVQV7uYMydN2Rj8jP2bGdiA,8722
+PIL/JpegImagePlugin.py,sha256=SmRmmYVAOwJRJnIysK9ijbpguBem87xf2ZE5NOaINZ4,28583
+PIL/JpegPresets.py,sha256=6gYstS6ZLaE0ENw7qcz1vlNtF2HMGSKx5Sm-KfKKCJ0,12709
+PIL/McIdasImagePlugin.py,sha256=LrP5nA7l8IQG3WhlMI0Xs8fGXY_uf6IDmzNCERl3tGw,1754
+PIL/MicImagePlugin.py,sha256=Eh94vjTurXYkmm27hhooyNm9NkWWyVxP8Nq4thNLV6Y,2607
+PIL/MpegImagePlugin.py,sha256=n16Zgdy8Hcfke16lQwZWs53PZq4BA_OxPCMPDkW62nw,1803
+PIL/MpoImagePlugin.py,sha256=twbVL97PYOU0UaDyLcaQuWBA8RJ0SNQUcDmDXDy6tV4,4396
+PIL/MspImagePlugin.py,sha256=Rjs-Vw2v1RtdP0V3RS6cf_1edF9FIpn9fYApatwLXXM,5524
+PIL/PSDraw.py,sha256=caJ_uayWqTlk0EhPSKTUOevVooEfTV1ny3jw2PtteoI,6670
+PIL/PaletteFile.py,sha256=s3KtsDuY5S04MKDyiXK3iIbiOGzV9PvCDUpOQHI7yqc,1106
+PIL/PalmImagePlugin.py,sha256=lTVwwSPFrQ-IPFGU8_gRCMZ1Lb73cuVhQ-nkx1Q0oqc,9108
+PIL/PcdImagePlugin.py,sha256=cnBm_xKcpLGT6hZ8QKai9Up0gZERMxZwhDXl1hQtBm0,1476
+PIL/PcfFontFile.py,sha256=njhgblsjSVcITVz1DpWdEligmJgPMh5nTk_zDDWWTik,6348
+PIL/PcxImagePlugin.py,sha256=J-Pm2QBt5Hi4ObPeXDnc87X7nl1hbtTGqy4sTov6tug,5864
+PIL/PdfImagePlugin.py,sha256=H2zXDGd_he0MO411T_yREpn9IoA2nifXzaRn3WBGYqk,7665
+PIL/PdfParser.py,sha256=Cb4zRBgnG4_1kmkimjfxvGpUOvOk8aPVLdfa-7mQ2v0,34479
+PIL/PixarImagePlugin.py,sha256=5MMcrrShVr511QKevK1ziKyJn0WllokWQxBhs8NWttY,1631
+PIL/PngImagePlugin.py,sha256=TeNJ818s1nMAJVn1Dihr3Q0C3IYSavWOZiI37H03CJk,43876
+PIL/PpmImagePlugin.py,sha256=UNwCp3h7psEK8i0p3P93VVXUBz9_8tUVzUWsITux6HQ,4447
+PIL/PsdImagePlugin.py,sha256=nWsMd-QSTaofFMa2M6iZr7BRK9BIrBGdyH4SCUYXlyY,8035
+PIL/PyAccess.py,sha256=U_N4WB6yg_qpWKo1X7avE98p6Ve3bqqnWOGX6DeyE4U,9592
+PIL/SgiImagePlugin.py,sha256=fdY5GOfjLgGVV5nvZ9gGomYboQ0-uPqyosDAU5M9eeU,6064
+PIL/SpiderImagePlugin.py,sha256=1m1xCZ2S7i2w4f-Tz2FSNkqUzqqZzYaZetKXevmsx6Y,9534
+PIL/SunImagePlugin.py,sha256=bnjnVFRjvApCH1QC1F9HeynoCe5AZk3wa1tOhPvHzKU,4282
+PIL/TarIO.py,sha256=E_pjAxk9wHezXUuR_99liySBXfJoL2wjzdNDf0g1hTo,1440
+PIL/TgaImagePlugin.py,sha256=UmGHaYcHHz3V1T87ZfFNR5TvP1QnQ1QG_EfuJPLmDpw,6277
+PIL/TiffImagePlugin.py,sha256=Spti07AzKUdc5KrfASMnsg29tcoS1_TdsEaRABJgh9M,69130
+PIL/TiffTags.py,sha256=BF3l3IfzAzRXqrG-Y6IadW_V2hjeu4mwohV92V6zgW0,14605
+PIL/WalImageFile.py,sha256=Mfwtpwi-CgRKGORZbdc35uVG0XdelIEIafmtzh0aTKw,5531
+PIL/WebPImagePlugin.py,sha256=v7znfX2AuViVwSl3bF9kRfLDMqLH6Qzt1GwazRVKLeE,10830
+PIL/WmfImagePlugin.py,sha256=Ht5JppC4GZiYz8GNaww4IXEXTJkSQK7h-A2tt4AEvSI,4672
+PIL/XVThumbImagePlugin.py,sha256=zmZ8Z4B8Kr6NOdUqSipW9_X5mKiLBLs-wxvPRRg1l0M,1940
+PIL/XbmImagePlugin.py,sha256=oIEt_uqwKKU6lLS_IVFwEjotwE1FI4_IHUnx_6Ul_gk,2430
+PIL/XpmImagePlugin.py,sha256=1EBt-g678p0A0NXOkxq7sGM8dymneDMHHQmwJzAbrlw,3062
+PIL/__init__.py,sha256=NnlpBykSA7dIeA6k7aHKD2ikvrCKhpieYVv7UieVoyk,3260
+PIL/__main__.py,sha256=axR7PO-HtXp-o0rBhKIxs0wark0rBfaDIhAIWqtWUo4,41
+PIL/__pycache__/BdfFontFile.cpython-38.pyc,,
+PIL/__pycache__/BlpImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/BmpImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/BufrStubImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/ContainerIO.cpython-38.pyc,,
+PIL/__pycache__/CurImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/DcxImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/DdsImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/EpsImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/ExifTags.cpython-38.pyc,,
+PIL/__pycache__/FitsStubImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/FliImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/FontFile.cpython-38.pyc,,
+PIL/__pycache__/FpxImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/FtexImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/GbrImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/GdImageFile.cpython-38.pyc,,
+PIL/__pycache__/GifImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/GimpGradientFile.cpython-38.pyc,,
+PIL/__pycache__/GimpPaletteFile.cpython-38.pyc,,
+PIL/__pycache__/GribStubImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/Hdf5StubImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/IcnsImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/IcoImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/ImImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/Image.cpython-38.pyc,,
+PIL/__pycache__/ImageChops.cpython-38.pyc,,
+PIL/__pycache__/ImageCms.cpython-38.pyc,,
+PIL/__pycache__/ImageColor.cpython-38.pyc,,
+PIL/__pycache__/ImageDraw.cpython-38.pyc,,
+PIL/__pycache__/ImageDraw2.cpython-38.pyc,,
+PIL/__pycache__/ImageEnhance.cpython-38.pyc,,
+PIL/__pycache__/ImageFile.cpython-38.pyc,,
+PIL/__pycache__/ImageFilter.cpython-38.pyc,,
+PIL/__pycache__/ImageFont.cpython-38.pyc,,
+PIL/__pycache__/ImageGrab.cpython-38.pyc,,
+PIL/__pycache__/ImageMath.cpython-38.pyc,,
+PIL/__pycache__/ImageMode.cpython-38.pyc,,
+PIL/__pycache__/ImageMorph.cpython-38.pyc,,
+PIL/__pycache__/ImageOps.cpython-38.pyc,,
+PIL/__pycache__/ImagePalette.cpython-38.pyc,,
+PIL/__pycache__/ImagePath.cpython-38.pyc,,
+PIL/__pycache__/ImageQt.cpython-38.pyc,,
+PIL/__pycache__/ImageSequence.cpython-38.pyc,,
+PIL/__pycache__/ImageShow.cpython-38.pyc,,
+PIL/__pycache__/ImageStat.cpython-38.pyc,,
+PIL/__pycache__/ImageTk.cpython-38.pyc,,
+PIL/__pycache__/ImageTransform.cpython-38.pyc,,
+PIL/__pycache__/ImageWin.cpython-38.pyc,,
+PIL/__pycache__/ImtImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/IptcImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/Jpeg2KImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/JpegImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/JpegPresets.cpython-38.pyc,,
+PIL/__pycache__/McIdasImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/MicImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/MpegImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/MpoImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/MspImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/PSDraw.cpython-38.pyc,,
+PIL/__pycache__/PaletteFile.cpython-38.pyc,,
+PIL/__pycache__/PalmImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/PcdImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/PcfFontFile.cpython-38.pyc,,
+PIL/__pycache__/PcxImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/PdfImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/PdfParser.cpython-38.pyc,,
+PIL/__pycache__/PixarImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/PngImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/PpmImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/PsdImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/PyAccess.cpython-38.pyc,,
+PIL/__pycache__/SgiImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/SpiderImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/SunImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/TarIO.cpython-38.pyc,,
+PIL/__pycache__/TgaImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/TiffImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/TiffTags.cpython-38.pyc,,
+PIL/__pycache__/WalImageFile.cpython-38.pyc,,
+PIL/__pycache__/WebPImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/WmfImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/XVThumbImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/XbmImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/XpmImagePlugin.cpython-38.pyc,,
+PIL/__pycache__/__init__.cpython-38.pyc,,
+PIL/__pycache__/__main__.cpython-38.pyc,,
+PIL/__pycache__/_binary.cpython-38.pyc,,
+PIL/__pycache__/_tkinter_finder.cpython-38.pyc,,
+PIL/__pycache__/_util.cpython-38.pyc,,
+PIL/__pycache__/_version.cpython-38.pyc,,
+PIL/__pycache__/features.cpython-38.pyc,,
+PIL/_binary.py,sha256=M_yObPVR_1rxnS5craSJsSbFJMykMYqJ0vNHeUpAmj4,1793
+PIL/_imaging.cp38-win_amd64.pyd,sha256=oY5G8rVFsS7watkb-gebOrvr8M0WKAY7-1sMjolq9H8,2671104
+PIL/_imagingcms.cp38-win_amd64.pyd,sha256=uiywzFnrXwY57-ga2ybZo1qYOSSa1kuEbGsXMp3Izjw,247808
+PIL/_imagingft.cp38-win_amd64.pyd,sha256=cWeQEITdlXsAURtCAOHIVUReXxtmwBP5nT37jF_eypc,732672
+PIL/_imagingmath.cp38-win_amd64.pyd,sha256=e2hXlrMhl6NlVh37BnbqvOmO3sEcGpsvCHuV-AbNeXU,24576
+PIL/_imagingmorph.cp38-win_amd64.pyd,sha256=oz3y5KXxTl0Eye_GcAVCwaQ4gGrp2rUSohciomf9bdo,13312
+PIL/_imagingtk.cp38-win_amd64.pyd,sha256=9VbBXVXBdUlkGYDGP273kHKubqhZerrVT5OhHfQekFA,15360
+PIL/_tkinter_finder.py,sha256=-X7xba1HO66pG1K5KSNf4Yo2eORwFTXcoFtHsmmNEcQ,525
+PIL/_util.py,sha256=pbjX5KY1W2oZyYVC4TE9ai2PfrJZrAsO5hAnz_JMees,359
+PIL/_version.py,sha256=LAE4giKocGQerlRtsLzCxSiYv-nh_Q9qB_Gkuoiraro,50
+PIL/_webp.cp38-win_amd64.pyd,sha256=9jcEQs-Jeya0nlmjIVoE4xfxptsSquDa7TF1TSIWPCw,550400
+PIL/features.py,sha256=hLPjKt4clYmqezF2dN2vx7HKZWyV27f-qsS2t_icgOM,9386
+Pillow-8.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+Pillow-8.2.0.dist-info/LICENSE,sha256=W7EdlrOTppjfcAGAaamGJIAh8oY0TEN6E_KZw9rx39Q,1444
+Pillow-8.2.0.dist-info/METADATA,sha256=xCrCyOyapaBL2U2vkEUSGCouFB4hwVoeiheancyAGhQ,7064
+Pillow-8.2.0.dist-info/RECORD,,
+Pillow-8.2.0.dist-info/WHEEL,sha256=HLtxc_HoM-kGM7FPJVPSnTt0Nv2G3fZEAjT3ICdG8uY,100
+Pillow-8.2.0.dist-info/top_level.txt,sha256=riZqrk-hyZqh5f1Z0Zwii3dKfxEsByhu9cU9IODF-NY,4
+Pillow-8.2.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
diff --git a/venv/Lib/site-packages/Pillow-8.2.0.dist-info/WHEEL b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/WHEEL
new file mode 100644
index 0000000..f7306a7
--- /dev/null
+++ b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.36.2)
+Root-Is-Purelib: false
+Tag: cp38-cp38-win_amd64
+
diff --git a/venv/Lib/site-packages/Pillow-8.2.0.dist-info/top_level.txt b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/top_level.txt
new file mode 100644
index 0000000..b338169
--- /dev/null
+++ b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/top_level.txt
@@ -0,0 +1 @@
+PIL
diff --git a/venv/Lib/site-packages/Pillow-8.2.0.dist-info/zip-safe b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/zip-safe
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/venv/Lib/site-packages/Pillow-8.2.0.dist-info/zip-safe
@@ -0,0 +1 @@
+
diff --git a/venv/Lib/site-packages/_distutils_hack/__init__.py b/venv/Lib/site-packages/_distutils_hack/__init__.py
new file mode 100644
index 0000000..5f40996
--- /dev/null
+++ b/venv/Lib/site-packages/_distutils_hack/__init__.py
@@ -0,0 +1,128 @@
+import sys
+import os
+import re
+import importlib
+import warnings
+
+
+is_pypy = '__pypy__' in sys.builtin_module_names
+
+
+warnings.filterwarnings('ignore',
+ r'.+ distutils\b.+ deprecated',
+ DeprecationWarning)
+
+
+def warn_distutils_present():
+ if 'distutils' not in sys.modules:
+ return
+ if is_pypy and sys.version_info < (3, 7):
+ # PyPy for 3.6 unconditionally imports distutils, so bypass the warning
+ # https://foss.heptapod.net/pypy/pypy/-/blob/be829135bc0d758997b3566062999ee8b23872b4/lib-python/3/site.py#L250
+ return
+ warnings.warn(
+ "Distutils was imported before Setuptools, but importing Setuptools "
+ "also replaces the `distutils` module in `sys.modules`. This may lead "
+ "to undesirable behaviors or errors. To avoid these issues, avoid "
+ "using distutils directly, ensure that setuptools is installed in the "
+ "traditional way (e.g. not an editable install), and/or make sure "
+ "that setuptools is always imported before distutils.")
+
+
+def clear_distutils():
+ if 'distutils' not in sys.modules:
+ return
+ warnings.warn("Setuptools is replacing distutils.")
+ mods = [name for name in sys.modules if re.match(r'distutils\b', name)]
+ for name in mods:
+ del sys.modules[name]
+
+
+def enabled():
+ """
+ Allow selection of distutils by environment variable.
+ """
+ which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib')
+ return which == 'local'
+
+
+def ensure_local_distutils():
+ clear_distutils()
+ distutils = importlib.import_module('setuptools._distutils')
+ distutils.__name__ = 'distutils'
+ sys.modules['distutils'] = distutils
+
+ # sanity check that submodules load as expected
+ core = importlib.import_module('distutils.core')
+ assert '_distutils' in core.__file__, core.__file__
+
+
+def do_override():
+ """
+ Ensure that the local copy of distutils is preferred over stdlib.
+
+ See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401
+ for more motivation.
+ """
+ if enabled():
+ warn_distutils_present()
+ ensure_local_distutils()
+
+
+class DistutilsMetaFinder:
+ def find_spec(self, fullname, path, target=None):
+ if path is not None:
+ return
+
+ method_name = 'spec_for_{fullname}'.format(**locals())
+ method = getattr(self, method_name, lambda: None)
+ return method()
+
+ def spec_for_distutils(self):
+ import importlib.abc
+ import importlib.util
+
+ class DistutilsLoader(importlib.abc.Loader):
+
+ def create_module(self, spec):
+ return importlib.import_module('setuptools._distutils')
+
+ def exec_module(self, module):
+ pass
+
+ return importlib.util.spec_from_loader('distutils', DistutilsLoader())
+
+ def spec_for_pip(self):
+ """
+ Ensure stdlib distutils when running under pip.
+ See pypa/pip#8761 for rationale.
+ """
+ if self.pip_imported_during_build():
+ return
+ clear_distutils()
+ self.spec_for_distutils = lambda: None
+
+ @staticmethod
+ def pip_imported_during_build():
+ """
+ Detect if pip is being imported in a build script. Ref #2355.
+ """
+ import traceback
+ return any(
+ frame.f_globals['__file__'].endswith('setup.py')
+ for frame, line in traceback.walk_stack(None)
+ )
+
+
+DISTUTILS_FINDER = DistutilsMetaFinder()
+
+
+def add_shim():
+ sys.meta_path.insert(0, DISTUTILS_FINDER)
+
+
+def remove_shim():
+ try:
+ sys.meta_path.remove(DISTUTILS_FINDER)
+ except ValueError:
+ pass
diff --git a/venv/Lib/site-packages/_distutils_hack/override.py b/venv/Lib/site-packages/_distutils_hack/override.py
new file mode 100644
index 0000000..2cc433a
--- /dev/null
+++ b/venv/Lib/site-packages/_distutils_hack/override.py
@@ -0,0 +1 @@
+__import__('_distutils_hack').do_override()
diff --git a/venv/Lib/site-packages/cycler-0.10.0.dist-info/DESCRIPTION.rst b/venv/Lib/site-packages/cycler-0.10.0.dist-info/DESCRIPTION.rst
new file mode 100644
index 0000000..e118723
--- /dev/null
+++ b/venv/Lib/site-packages/cycler-0.10.0.dist-info/DESCRIPTION.rst
@@ -0,0 +1,3 @@
+UNKNOWN
+
+
diff --git a/venv/Lib/site-packages/cycler-0.10.0.dist-info/INSTALLER b/venv/Lib/site-packages/cycler-0.10.0.dist-info/INSTALLER
new file mode 100644
index 0000000..a1b589e
--- /dev/null
+++ b/venv/Lib/site-packages/cycler-0.10.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/venv/Lib/site-packages/cycler-0.10.0.dist-info/METADATA b/venv/Lib/site-packages/cycler-0.10.0.dist-info/METADATA
new file mode 100644
index 0000000..b232cee
--- /dev/null
+++ b/venv/Lib/site-packages/cycler-0.10.0.dist-info/METADATA
@@ -0,0 +1,25 @@
+Metadata-Version: 2.0
+Name: cycler
+Version: 0.10.0
+Summary: Composable style cycles
+Home-page: http://github.com/matplotlib/cycler
+Author: Thomas A Caswell
+Author-email: matplotlib-users@python.org
+License: BSD
+Keywords: cycle kwargs
+Platform: Cross platform (Linux
+Platform: Mac OSX
+Platform: Windows)
+Classifier: Development Status :: 4 - Beta
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Requires-Dist: six
+
+UNKNOWN
+
+
diff --git a/venv/Lib/site-packages/cycler-0.10.0.dist-info/RECORD b/venv/Lib/site-packages/cycler-0.10.0.dist-info/RECORD
new file mode 100644
index 0000000..e557fe6
--- /dev/null
+++ b/venv/Lib/site-packages/cycler-0.10.0.dist-info/RECORD
@@ -0,0 +1,10 @@
+__pycache__/cycler.cpython-38.pyc,,
+cycler-0.10.0.dist-info/DESCRIPTION.rst,sha256=OCTuuN6LcWulhHS3d5rfjdsQtW22n7HENFRh6jC6ego,10
+cycler-0.10.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+cycler-0.10.0.dist-info/METADATA,sha256=aWX1pyo7D2hSDNZ2Q6Zl7DxhUQdpyu1O5uNABnvz000,722
+cycler-0.10.0.dist-info/RECORD,,
+cycler-0.10.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+cycler-0.10.0.dist-info/WHEEL,sha256=o2k-Qa-RMNIJmUdIc7KU6VWR_ErNRbWNlxDIpl7lm34,110
+cycler-0.10.0.dist-info/metadata.json,sha256=CCBpg-KQU-VRL1unJcHPWKQeQbB84G0j7-BeCj7YUbU,875
+cycler-0.10.0.dist-info/top_level.txt,sha256=D8BVVDdAAelLb2FOEz7lDpc6-AL21ylKPrMhtG6yzyE,7
+cycler.py,sha256=ed3G39unvVEBrBZVDwnE0FFroRNsOLkbJ_TwIT5CjCU,15959
diff --git a/venv/Lib/site-packages/cycler-0.10.0.dist-info/REQUESTED b/venv/Lib/site-packages/cycler-0.10.0.dist-info/REQUESTED
new file mode 100644
index 0000000..e69de29
diff --git a/venv/Lib/site-packages/cycler-0.10.0.dist-info/WHEEL b/venv/Lib/site-packages/cycler-0.10.0.dist-info/WHEEL
new file mode 100644
index 0000000..8b6dd1b
--- /dev/null
+++ b/venv/Lib/site-packages/cycler-0.10.0.dist-info/WHEEL
@@ -0,0 +1,6 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.29.0)
+Root-Is-Purelib: true
+Tag: py2-none-any
+Tag: py3-none-any
+
diff --git a/venv/Lib/site-packages/cycler-0.10.0.dist-info/metadata.json b/venv/Lib/site-packages/cycler-0.10.0.dist-info/metadata.json
new file mode 100644
index 0000000..6082129
--- /dev/null
+++ b/venv/Lib/site-packages/cycler-0.10.0.dist-info/metadata.json
@@ -0,0 +1 @@
+{"classifiers": ["Development Status :: 4 - Beta", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5"], "extensions": {"python.details": {"contacts": [{"email": "matplotlib-users@python.org", "name": "Thomas A Caswell", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "http://github.com/matplotlib/cycler"}}}, "extras": [], "generator": "bdist_wheel (0.29.0)", "keywords": ["cycle", "kwargs"], "license": "BSD", "metadata_version": "2.0", "name": "cycler", "platform": "Cross platform (Linux", "run_requires": [{"requires": ["six"]}], "summary": "Composable style cycles", "version": "0.10.0"}
\ No newline at end of file
diff --git a/venv/Lib/site-packages/cycler-0.10.0.dist-info/top_level.txt b/venv/Lib/site-packages/cycler-0.10.0.dist-info/top_level.txt
new file mode 100644
index 0000000..2254644
--- /dev/null
+++ b/venv/Lib/site-packages/cycler-0.10.0.dist-info/top_level.txt
@@ -0,0 +1 @@
+cycler
diff --git a/venv/Lib/site-packages/cycler.py b/venv/Lib/site-packages/cycler.py
new file mode 100644
index 0000000..3c3eb2d
--- /dev/null
+++ b/venv/Lib/site-packages/cycler.py
@@ -0,0 +1,558 @@
+"""
+Cycler
+======
+
+Cycling through combinations of values, producing dictionaries.
+
+You can add cyclers::
+
+ from cycler import cycler
+ cc = (cycler(color=list('rgb')) +
+ cycler(linestyle=['-', '--', '-.']))
+ for d in cc:
+ print(d)
+
+Results in::
+
+ {'color': 'r', 'linestyle': '-'}
+ {'color': 'g', 'linestyle': '--'}
+ {'color': 'b', 'linestyle': '-.'}
+
+
+You can multiply cyclers::
+
+ from cycler import cycler
+ cc = (cycler(color=list('rgb')) *
+ cycler(linestyle=['-', '--', '-.']))
+ for d in cc:
+ print(d)
+
+Results in::
+
+ {'color': 'r', 'linestyle': '-'}
+ {'color': 'r', 'linestyle': '--'}
+ {'color': 'r', 'linestyle': '-.'}
+ {'color': 'g', 'linestyle': '-'}
+ {'color': 'g', 'linestyle': '--'}
+ {'color': 'g', 'linestyle': '-.'}
+ {'color': 'b', 'linestyle': '-'}
+ {'color': 'b', 'linestyle': '--'}
+ {'color': 'b', 'linestyle': '-.'}
+"""
+
+from __future__ import (absolute_import, division, print_function,
+ unicode_literals)
+
+import six
+from itertools import product, cycle
+from six.moves import zip, reduce
+from operator import mul, add
+import copy
+
+__version__ = '0.10.0'
+
+
+def _process_keys(left, right):
+ """
+ Helper function to compose cycler keys
+
+ Parameters
+ ----------
+ left, right : iterable of dictionaries or None
+ The cyclers to be composed
+ Returns
+ -------
+ keys : set
+ The keys in the composition of the two cyclers
+ """
+ l_peek = next(iter(left)) if left is not None else {}
+ r_peek = next(iter(right)) if right is not None else {}
+ l_key = set(l_peek.keys())
+ r_key = set(r_peek.keys())
+ if l_key & r_key:
+ raise ValueError("Can not compose overlapping cycles")
+ return l_key | r_key
+
+
+class Cycler(object):
+ """
+ Composable cycles
+
+ This class has compositions methods:
+
+ ``+``
+ for 'inner' products (zip)
+
+ ``+=``
+ in-place ``+``
+
+ ``*``
+ for outer products (itertools.product) and integer multiplication
+
+ ``*=``
+ in-place ``*``
+
+ and supports basic slicing via ``[]``
+
+ Parameters
+ ----------
+ left : Cycler or None
+ The 'left' cycler
+
+ right : Cycler or None
+ The 'right' cycler
+
+ op : func or None
+ Function which composes the 'left' and 'right' cyclers.
+
+ """
+ def __call__(self):
+ return cycle(self)
+
+ def __init__(self, left, right=None, op=None):
+ """Semi-private init
+
+ Do not use this directly, use `cycler` function instead.
+ """
+ if isinstance(left, Cycler):
+ self._left = Cycler(left._left, left._right, left._op)
+ elif left is not None:
+ # Need to copy the dictionary or else that will be a residual
+ # mutable that could lead to strange errors
+ self._left = [copy.copy(v) for v in left]
+ else:
+ self._left = None
+
+ if isinstance(right, Cycler):
+ self._right = Cycler(right._left, right._right, right._op)
+ elif right is not None:
+ # Need to copy the dictionary or else that will be a residual
+ # mutable that could lead to strange errors
+ self._right = [copy.copy(v) for v in right]
+ else:
+ self._right = None
+
+ self._keys = _process_keys(self._left, self._right)
+ self._op = op
+
+ @property
+ def keys(self):
+ """
+ The keys this Cycler knows about
+ """
+ return set(self._keys)
+
+ def change_key(self, old, new):
+ """
+ Change a key in this cycler to a new name.
+ Modification is performed in-place.
+
+ Does nothing if the old key is the same as the new key.
+ Raises a ValueError if the new key is already a key.
+ Raises a KeyError if the old key isn't a key.
+
+ """
+ if old == new:
+ return
+ if new in self._keys:
+ raise ValueError("Can't replace %s with %s, %s is already a key" %
+ (old, new, new))
+ if old not in self._keys:
+ raise KeyError("Can't replace %s with %s, %s is not a key" %
+ (old, new, old))
+
+ self._keys.remove(old)
+ self._keys.add(new)
+
+ if self._right is not None and old in self._right.keys:
+ self._right.change_key(old, new)
+
+ # self._left should always be non-None
+ # if self._keys is non-empty.
+ elif isinstance(self._left, Cycler):
+ self._left.change_key(old, new)
+ else:
+ # It should be completely safe at this point to
+ # assume that the old key can be found in each
+ # iteration.
+ self._left = [{new: entry[old]} for entry in self._left]
+
+ def _compose(self):
+ """
+ Compose the 'left' and 'right' components of this cycle
+ with the proper operation (zip or product as of now)
+ """
+ for a, b in self._op(self._left, self._right):
+ out = dict()
+ out.update(a)
+ out.update(b)
+ yield out
+
+ @classmethod
+ def _from_iter(cls, label, itr):
+ """
+ Class method to create 'base' Cycler objects
+ that do not have a 'right' or 'op' and for which
+ the 'left' object is not another Cycler.
+
+ Parameters
+ ----------
+ label : str
+ The property key.
+
+ itr : iterable
+ Finite length iterable of the property values.
+
+ Returns
+ -------
+ cycler : Cycler
+ New 'base' `Cycler`
+ """
+ ret = cls(None)
+ ret._left = list({label: v} for v in itr)
+ ret._keys = set([label])
+ return ret
+
+ def __getitem__(self, key):
+ # TODO : maybe add numpy style fancy slicing
+ if isinstance(key, slice):
+ trans = self.by_key()
+ return reduce(add, (_cycler(k, v[key])
+ for k, v in six.iteritems(trans)))
+ else:
+ raise ValueError("Can only use slices with Cycler.__getitem__")
+
+ def __iter__(self):
+ if self._right is None:
+ return iter(dict(l) for l in self._left)
+
+ return self._compose()
+
+ def __add__(self, other):
+ """
+ Pair-wise combine two equal length cycles (zip)
+
+ Parameters
+ ----------
+ other : Cycler
+ The second Cycler
+ """
+ if len(self) != len(other):
+ raise ValueError("Can only add equal length cycles, "
+ "not {0} and {1}".format(len(self), len(other)))
+ return Cycler(self, other, zip)
+
+ def __mul__(self, other):
+ """
+ Outer product of two cycles (`itertools.product`) or integer
+ multiplication.
+
+ Parameters
+ ----------
+ other : Cycler or int
+ The second Cycler or integer
+ """
+ if isinstance(other, Cycler):
+ return Cycler(self, other, product)
+ elif isinstance(other, int):
+ trans = self.by_key()
+ return reduce(add, (_cycler(k, v*other)
+ for k, v in six.iteritems(trans)))
+ else:
+ return NotImplemented
+
+ def __rmul__(self, other):
+ return self * other
+
+ def __len__(self):
+ op_dict = {zip: min, product: mul}
+ if self._right is None:
+ return len(self._left)
+ l_len = len(self._left)
+ r_len = len(self._right)
+ return op_dict[self._op](l_len, r_len)
+
+ def __iadd__(self, other):
+ """
+ In-place pair-wise combine two equal length cycles (zip)
+
+ Parameters
+ ----------
+ other : Cycler
+ The second Cycler
+ """
+ if not isinstance(other, Cycler):
+ raise TypeError("Cannot += with a non-Cycler object")
+ # True shallow copy of self is fine since this is in-place
+ old_self = copy.copy(self)
+ self._keys = _process_keys(old_self, other)
+ self._left = old_self
+ self._op = zip
+ self._right = Cycler(other._left, other._right, other._op)
+ return self
+
+ def __imul__(self, other):
+ """
+ In-place outer product of two cycles (`itertools.product`)
+
+ Parameters
+ ----------
+ other : Cycler
+ The second Cycler
+ """
+ if not isinstance(other, Cycler):
+ raise TypeError("Cannot *= with a non-Cycler object")
+ # True shallow copy of self is fine since this is in-place
+ old_self = copy.copy(self)
+ self._keys = _process_keys(old_self, other)
+ self._left = old_self
+ self._op = product
+ self._right = Cycler(other._left, other._right, other._op)
+ return self
+
+ def __eq__(self, other):
+ """
+ Check equality
+ """
+ if len(self) != len(other):
+ return False
+ if self.keys ^ other.keys:
+ return False
+
+ return all(a == b for a, b in zip(self, other))
+
+ def __repr__(self):
+ op_map = {zip: '+', product: '*'}
+ if self._right is None:
+ lab = self.keys.pop()
+ itr = list(v[lab] for v in self)
+ return "cycler({lab!r}, {itr!r})".format(lab=lab, itr=itr)
+ else:
+ op = op_map.get(self._op, '?')
+ msg = "({left!r} {op} {right!r})"
+ return msg.format(left=self._left, op=op, right=self._right)
+
+ def _repr_html_(self):
+ # an table showing the value of each key through a full cycle
+ output = ""
+ sorted_keys = sorted(self.keys, key=repr)
+ for key in sorted_keys:
+ output += "{key!r} ".format(key=key)
+ for d in iter(self):
+ output += ""
+ for k in sorted_keys:
+ output += "{val!r} ".format(val=d[k])
+ output += " "
+ output += "
"
+ return output
+
+ def by_key(self):
+ """Values by key
+
+ This returns the transposed values of the cycler. Iterating
+ over a `Cycler` yields dicts with a single value for each key,
+ this method returns a `dict` of `list` which are the values
+ for the given key.
+
+ The returned value can be used to create an equivalent `Cycler`
+ using only `+`.
+
+ Returns
+ -------
+ transpose : dict
+ dict of lists of the values for each key.
+ """
+
+ # TODO : sort out if this is a bottle neck, if there is a better way
+ # and if we care.
+
+ keys = self.keys
+ # change this to dict comprehension when drop 2.6
+ out = dict((k, list()) for k in keys)
+
+ for d in self:
+ for k in keys:
+ out[k].append(d[k])
+ return out
+
+ # for back compatibility
+ _transpose = by_key
+
+ def simplify(self):
+ """Simplify the Cycler
+
+ Returned as a composition using only sums (no multiplications)
+
+ Returns
+ -------
+ simple : Cycler
+ An equivalent cycler using only summation"""
+ # TODO: sort out if it is worth the effort to make sure this is
+ # balanced. Currently it is is
+ # (((a + b) + c) + d) vs
+ # ((a + b) + (c + d))
+ # I would believe that there is some performance implications
+
+ trans = self.by_key()
+ return reduce(add, (_cycler(k, v) for k, v in six.iteritems(trans)))
+
+ def concat(self, other):
+ """Concatenate this cycler and an other.
+
+ The keys must match exactly.
+
+ This returns a single Cycler which is equivalent to
+ `itertools.chain(self, other)`
+
+ Examples
+ --------
+
+ >>> num = cycler('a', range(3))
+ >>> let = cycler('a', 'abc')
+ >>> num.concat(let)
+ cycler('a', [0, 1, 2, 'a', 'b', 'c'])
+
+ Parameters
+ ----------
+ other : `Cycler`
+ The `Cycler` to concatenate to this one.
+
+ Returns
+ -------
+ ret : `Cycler`
+ The concatenated `Cycler`
+ """
+ return concat(self, other)
+
+
+def concat(left, right):
+ """Concatenate two cyclers.
+
+ The keys must match exactly.
+
+ This returns a single Cycler which is equivalent to
+ `itertools.chain(left, right)`
+
+ Examples
+ --------
+
+ >>> num = cycler('a', range(3))
+ >>> let = cycler('a', 'abc')
+ >>> num.concat(let)
+ cycler('a', [0, 1, 2, 'a', 'b', 'c'])
+
+ Parameters
+ ----------
+ left, right : `Cycler`
+ The two `Cycler` instances to concatenate
+
+ Returns
+ -------
+ ret : `Cycler`
+ The concatenated `Cycler`
+ """
+ if left.keys != right.keys:
+ msg = '\n\t'.join(["Keys do not match:",
+ "Intersection: {both!r}",
+ "Disjoint: {just_one!r}"]).format(
+ both=left.keys & right.keys,
+ just_one=left.keys ^ right.keys)
+
+ raise ValueError(msg)
+
+ _l = left.by_key()
+ _r = right.by_key()
+ return reduce(add, (_cycler(k, _l[k] + _r[k]) for k in left.keys))
+
+
+def cycler(*args, **kwargs):
+ """
+ Create a new `Cycler` object from a single positional argument,
+ a pair of positional arguments, or the combination of keyword arguments.
+
+ cycler(arg)
+ cycler(label1=itr1[, label2=iter2[, ...]])
+ cycler(label, itr)
+
+ Form 1 simply copies a given `Cycler` object.
+
+ Form 2 composes a `Cycler` as an inner product of the
+ pairs of keyword arguments. In other words, all of the
+ iterables are cycled simultaneously, as if through zip().
+
+ Form 3 creates a `Cycler` from a label and an iterable.
+ This is useful for when the label cannot be a keyword argument
+ (e.g., an integer or a name that has a space in it).
+
+ Parameters
+ ----------
+ arg : Cycler
+ Copy constructor for Cycler (does a shallow copy of iterables).
+
+ label : name
+ The property key. In the 2-arg form of the function,
+ the label can be any hashable object. In the keyword argument
+ form of the function, it must be a valid python identifier.
+
+ itr : iterable
+ Finite length iterable of the property values.
+ Can be a single-property `Cycler` that would
+ be like a key change, but as a shallow copy.
+
+ Returns
+ -------
+ cycler : Cycler
+ New `Cycler` for the given property
+
+ """
+ if args and kwargs:
+ raise TypeError("cyl() can only accept positional OR keyword "
+ "arguments -- not both.")
+
+ if len(args) == 1:
+ if not isinstance(args[0], Cycler):
+ raise TypeError("If only one positional argument given, it must "
+ " be a Cycler instance.")
+ return Cycler(args[0])
+ elif len(args) == 2:
+ return _cycler(*args)
+ elif len(args) > 2:
+ raise TypeError("Only a single Cycler can be accepted as the lone "
+ "positional argument. Use keyword arguments instead.")
+
+ if kwargs:
+ return reduce(add, (_cycler(k, v) for k, v in six.iteritems(kwargs)))
+
+ raise TypeError("Must have at least a positional OR keyword arguments")
+
+
+def _cycler(label, itr):
+ """
+ Create a new `Cycler` object from a property name and
+ iterable of values.
+
+ Parameters
+ ----------
+ label : hashable
+ The property key.
+
+ itr : iterable
+ Finite length iterable of the property values.
+
+ Returns
+ -------
+ cycler : Cycler
+ New `Cycler` for the given property
+ """
+ if isinstance(itr, Cycler):
+ keys = itr.keys
+ if len(keys) != 1:
+ msg = "Can not create Cycler from a multi-property Cycler"
+ raise ValueError(msg)
+
+ lab = keys.pop()
+ # Doesn't need to be a new list because
+ # _from_iter() will be creating that new list anyway.
+ itr = (v[lab] for v in itr)
+
+ return Cycler._from_iter(label, itr)
diff --git a/venv/Lib/site-packages/dateutil/__init__.py b/venv/Lib/site-packages/dateutil/__init__.py
new file mode 100644
index 0000000..0defb82
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/__init__.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+try:
+ from ._version import version as __version__
+except ImportError:
+ __version__ = 'unknown'
+
+__all__ = ['easter', 'parser', 'relativedelta', 'rrule', 'tz',
+ 'utils', 'zoneinfo']
diff --git a/venv/Lib/site-packages/dateutil/_common.py b/venv/Lib/site-packages/dateutil/_common.py
new file mode 100644
index 0000000..4eb2659
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/_common.py
@@ -0,0 +1,43 @@
+"""
+Common code used in multiple modules.
+"""
+
+
+class weekday(object):
+ __slots__ = ["weekday", "n"]
+
+ def __init__(self, weekday, n=None):
+ self.weekday = weekday
+ self.n = n
+
+ def __call__(self, n):
+ if n == self.n:
+ return self
+ else:
+ return self.__class__(self.weekday, n)
+
+ def __eq__(self, other):
+ try:
+ if self.weekday != other.weekday or self.n != other.n:
+ return False
+ except AttributeError:
+ return False
+ return True
+
+ def __hash__(self):
+ return hash((
+ self.weekday,
+ self.n,
+ ))
+
+ def __ne__(self, other):
+ return not (self == other)
+
+ def __repr__(self):
+ s = ("MO", "TU", "WE", "TH", "FR", "SA", "SU")[self.weekday]
+ if not self.n:
+ return s
+ else:
+ return "%s(%+d)" % (s, self.n)
+
+# vim:ts=4:sw=4:et
diff --git a/venv/Lib/site-packages/dateutil/_version.py b/venv/Lib/site-packages/dateutil/_version.py
new file mode 100644
index 0000000..eac1209
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/_version.py
@@ -0,0 +1,4 @@
+# coding: utf-8
+# file generated by setuptools_scm
+# don't change, don't track in version control
+version = '2.8.1'
diff --git a/venv/Lib/site-packages/dateutil/easter.py b/venv/Lib/site-packages/dateutil/easter.py
new file mode 100644
index 0000000..53b7c78
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/easter.py
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+"""
+This module offers a generic easter computing method for any given year, using
+Western, Orthodox or Julian algorithms.
+"""
+
+import datetime
+
+__all__ = ["easter", "EASTER_JULIAN", "EASTER_ORTHODOX", "EASTER_WESTERN"]
+
+EASTER_JULIAN = 1
+EASTER_ORTHODOX = 2
+EASTER_WESTERN = 3
+
+
+def easter(year, method=EASTER_WESTERN):
+ """
+ This method was ported from the work done by GM Arts,
+ on top of the algorithm by Claus Tondering, which was
+ based in part on the algorithm of Ouding (1940), as
+ quoted in "Explanatory Supplement to the Astronomical
+ Almanac", P. Kenneth Seidelmann, editor.
+
+ This algorithm implements three different easter
+ calculation methods:
+
+ 1 - Original calculation in Julian calendar, valid in
+ dates after 326 AD
+ 2 - Original method, with date converted to Gregorian
+ calendar, valid in years 1583 to 4099
+ 3 - Revised method, in Gregorian calendar, valid in
+ years 1583 to 4099 as well
+
+ These methods are represented by the constants:
+
+ * ``EASTER_JULIAN = 1``
+ * ``EASTER_ORTHODOX = 2``
+ * ``EASTER_WESTERN = 3``
+
+ The default method is method 3.
+
+ More about the algorithm may be found at:
+
+ `GM Arts: Easter Algorithms `_
+
+ and
+
+ `The Calendar FAQ: Easter `_
+
+ """
+
+ if not (1 <= method <= 3):
+ raise ValueError("invalid method")
+
+ # g - Golden year - 1
+ # c - Century
+ # h - (23 - Epact) mod 30
+ # i - Number of days from March 21 to Paschal Full Moon
+ # j - Weekday for PFM (0=Sunday, etc)
+ # p - Number of days from March 21 to Sunday on or before PFM
+ # (-6 to 28 methods 1 & 3, to 56 for method 2)
+ # e - Extra days to add for method 2 (converting Julian
+ # date to Gregorian date)
+
+ y = year
+ g = y % 19
+ e = 0
+ if method < 3:
+ # Old method
+ i = (19*g + 15) % 30
+ j = (y + y//4 + i) % 7
+ if method == 2:
+ # Extra dates to convert Julian to Gregorian date
+ e = 10
+ if y > 1600:
+ e = e + y//100 - 16 - (y//100 - 16)//4
+ else:
+ # New method
+ c = y//100
+ h = (c - c//4 - (8*c + 13)//25 + 19*g + 15) % 30
+ i = h - (h//28)*(1 - (h//28)*(29//(h + 1))*((21 - g)//11))
+ j = (y + y//4 + i + 2 - c + c//4) % 7
+
+ # p can be from -6 to 56 corresponding to dates 22 March to 23 May
+ # (later dates apply to method 2, although 23 May never actually occurs)
+ p = i - j + e
+ d = 1 + (p + 27 + (p + 6)//40) % 31
+ m = 3 + (p + 26)//30
+ return datetime.date(int(y), int(m), int(d))
diff --git a/venv/Lib/site-packages/dateutil/parser/__init__.py b/venv/Lib/site-packages/dateutil/parser/__init__.py
new file mode 100644
index 0000000..d174b0e
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/parser/__init__.py
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+from ._parser import parse, parser, parserinfo, ParserError
+from ._parser import DEFAULTPARSER, DEFAULTTZPARSER
+from ._parser import UnknownTimezoneWarning
+
+from ._parser import __doc__
+
+from .isoparser import isoparser, isoparse
+
+__all__ = ['parse', 'parser', 'parserinfo',
+ 'isoparse', 'isoparser',
+ 'ParserError',
+ 'UnknownTimezoneWarning']
+
+
+###
+# Deprecate portions of the private interface so that downstream code that
+# is improperly relying on it is given *some* notice.
+
+
+def __deprecated_private_func(f):
+ from functools import wraps
+ import warnings
+
+ msg = ('{name} is a private function and may break without warning, '
+ 'it will be moved and or renamed in future versions.')
+ msg = msg.format(name=f.__name__)
+
+ @wraps(f)
+ def deprecated_func(*args, **kwargs):
+ warnings.warn(msg, DeprecationWarning)
+ return f(*args, **kwargs)
+
+ return deprecated_func
+
+def __deprecate_private_class(c):
+ import warnings
+
+ msg = ('{name} is a private class and may break without warning, '
+ 'it will be moved and or renamed in future versions.')
+ msg = msg.format(name=c.__name__)
+
+ class private_class(c):
+ __doc__ = c.__doc__
+
+ def __init__(self, *args, **kwargs):
+ warnings.warn(msg, DeprecationWarning)
+ super(private_class, self).__init__(*args, **kwargs)
+
+ private_class.__name__ = c.__name__
+
+ return private_class
+
+
+from ._parser import _timelex, _resultbase
+from ._parser import _tzparser, _parsetz
+
+_timelex = __deprecate_private_class(_timelex)
+_tzparser = __deprecate_private_class(_tzparser)
+_resultbase = __deprecate_private_class(_resultbase)
+_parsetz = __deprecated_private_func(_parsetz)
diff --git a/venv/Lib/site-packages/dateutil/parser/_parser.py b/venv/Lib/site-packages/dateutil/parser/_parser.py
new file mode 100644
index 0000000..458aa6a
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/parser/_parser.py
@@ -0,0 +1,1609 @@
+# -*- coding: utf-8 -*-
+"""
+This module offers a generic date/time string parser which is able to parse
+most known formats to represent a date and/or time.
+
+This module attempts to be forgiving with regards to unlikely input formats,
+returning a datetime object even for dates which are ambiguous. If an element
+of a date/time stamp is omitted, the following rules are applied:
+
+- If AM or PM is left unspecified, a 24-hour clock is assumed, however, an hour
+ on a 12-hour clock (``0 <= hour <= 12``) *must* be specified if AM or PM is
+ specified.
+- If a time zone is omitted, a timezone-naive datetime is returned.
+
+If any other elements are missing, they are taken from the
+:class:`datetime.datetime` object passed to the parameter ``default``. If this
+results in a day number exceeding the valid number of days per month, the
+value falls back to the end of the month.
+
+Additional resources about date/time string formats can be found below:
+
+- `A summary of the international standard date and time notation
+ `_
+- `W3C Date and Time Formats `_
+- `Time Formats (Planetary Rings Node) `_
+- `CPAN ParseDate module
+ `_
+- `Java SimpleDateFormat Class
+ `_
+"""
+from __future__ import unicode_literals
+
+import datetime
+import re
+import string
+import time
+import warnings
+
+from calendar import monthrange
+from io import StringIO
+
+import six
+from six import integer_types, text_type
+
+from decimal import Decimal
+
+from warnings import warn
+
+from .. import relativedelta
+from .. import tz
+
+__all__ = ["parse", "parserinfo", "ParserError"]
+
+
+# TODO: pandas.core.tools.datetimes imports this explicitly. Might be worth
+# making public and/or figuring out if there is something we can
+# take off their plate.
+class _timelex(object):
+ # Fractional seconds are sometimes split by a comma
+ _split_decimal = re.compile("([.,])")
+
+ def __init__(self, instream):
+ if six.PY2:
+ # In Python 2, we can't duck type properly because unicode has
+ # a 'decode' function, and we'd be double-decoding
+ if isinstance(instream, (bytes, bytearray)):
+ instream = instream.decode()
+ else:
+ if getattr(instream, 'decode', None) is not None:
+ instream = instream.decode()
+
+ if isinstance(instream, text_type):
+ instream = StringIO(instream)
+ elif getattr(instream, 'read', None) is None:
+ raise TypeError('Parser must be a string or character stream, not '
+ '{itype}'.format(itype=instream.__class__.__name__))
+
+ self.instream = instream
+ self.charstack = []
+ self.tokenstack = []
+ self.eof = False
+
+ def get_token(self):
+ """
+ This function breaks the time string into lexical units (tokens), which
+ can be parsed by the parser. Lexical units are demarcated by changes in
+ the character set, so any continuous string of letters is considered
+ one unit, any continuous string of numbers is considered one unit.
+
+ The main complication arises from the fact that dots ('.') can be used
+ both as separators (e.g. "Sep.20.2009") or decimal points (e.g.
+ "4:30:21.447"). As such, it is necessary to read the full context of
+ any dot-separated strings before breaking it into tokens; as such, this
+ function maintains a "token stack", for when the ambiguous context
+ demands that multiple tokens be parsed at once.
+ """
+ if self.tokenstack:
+ return self.tokenstack.pop(0)
+
+ seenletters = False
+ token = None
+ state = None
+
+ while not self.eof:
+ # We only realize that we've reached the end of a token when we
+ # find a character that's not part of the current token - since
+ # that character may be part of the next token, it's stored in the
+ # charstack.
+ if self.charstack:
+ nextchar = self.charstack.pop(0)
+ else:
+ nextchar = self.instream.read(1)
+ while nextchar == '\x00':
+ nextchar = self.instream.read(1)
+
+ if not nextchar:
+ self.eof = True
+ break
+ elif not state:
+ # First character of the token - determines if we're starting
+ # to parse a word, a number or something else.
+ token = nextchar
+ if self.isword(nextchar):
+ state = 'a'
+ elif self.isnum(nextchar):
+ state = '0'
+ elif self.isspace(nextchar):
+ token = ' '
+ break # emit token
+ else:
+ break # emit token
+ elif state == 'a':
+ # If we've already started reading a word, we keep reading
+ # letters until we find something that's not part of a word.
+ seenletters = True
+ if self.isword(nextchar):
+ token += nextchar
+ elif nextchar == '.':
+ token += nextchar
+ state = 'a.'
+ else:
+ self.charstack.append(nextchar)
+ break # emit token
+ elif state == '0':
+ # If we've already started reading a number, we keep reading
+ # numbers until we find something that doesn't fit.
+ if self.isnum(nextchar):
+ token += nextchar
+ elif nextchar == '.' or (nextchar == ',' and len(token) >= 2):
+ token += nextchar
+ state = '0.'
+ else:
+ self.charstack.append(nextchar)
+ break # emit token
+ elif state == 'a.':
+ # If we've seen some letters and a dot separator, continue
+ # parsing, and the tokens will be broken up later.
+ seenletters = True
+ if nextchar == '.' or self.isword(nextchar):
+ token += nextchar
+ elif self.isnum(nextchar) and token[-1] == '.':
+ token += nextchar
+ state = '0.'
+ else:
+ self.charstack.append(nextchar)
+ break # emit token
+ elif state == '0.':
+ # If we've seen at least one dot separator, keep going, we'll
+ # break up the tokens later.
+ if nextchar == '.' or self.isnum(nextchar):
+ token += nextchar
+ elif self.isword(nextchar) and token[-1] == '.':
+ token += nextchar
+ state = 'a.'
+ else:
+ self.charstack.append(nextchar)
+ break # emit token
+
+ if (state in ('a.', '0.') and (seenletters or token.count('.') > 1 or
+ token[-1] in '.,')):
+ l = self._split_decimal.split(token)
+ token = l[0]
+ for tok in l[1:]:
+ if tok:
+ self.tokenstack.append(tok)
+
+ if state == '0.' and token.count('.') == 0:
+ token = token.replace(',', '.')
+
+ return token
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ token = self.get_token()
+ if token is None:
+ raise StopIteration
+
+ return token
+
+ def next(self):
+ return self.__next__() # Python 2.x support
+
+ @classmethod
+ def split(cls, s):
+ return list(cls(s))
+
+ @classmethod
+ def isword(cls, nextchar):
+ """ Whether or not the next character is part of a word """
+ return nextchar.isalpha()
+
+ @classmethod
+ def isnum(cls, nextchar):
+ """ Whether the next character is part of a number """
+ return nextchar.isdigit()
+
+ @classmethod
+ def isspace(cls, nextchar):
+ """ Whether the next character is whitespace """
+ return nextchar.isspace()
+
+
+class _resultbase(object):
+
+ def __init__(self):
+ for attr in self.__slots__:
+ setattr(self, attr, None)
+
+ def _repr(self, classname):
+ l = []
+ for attr in self.__slots__:
+ value = getattr(self, attr)
+ if value is not None:
+ l.append("%s=%s" % (attr, repr(value)))
+ return "%s(%s)" % (classname, ", ".join(l))
+
+ def __len__(self):
+ return (sum(getattr(self, attr) is not None
+ for attr in self.__slots__))
+
+ def __repr__(self):
+ return self._repr(self.__class__.__name__)
+
+
+class parserinfo(object):
+ """
+ Class which handles what inputs are accepted. Subclass this to customize
+ the language and acceptable values for each parameter.
+
+ :param dayfirst:
+ Whether to interpret the first value in an ambiguous 3-integer date
+ (e.g. 01/05/09) as the day (``True``) or month (``False``). If
+ ``yearfirst`` is set to ``True``, this distinguishes between YDM
+ and YMD. Default is ``False``.
+
+ :param yearfirst:
+ Whether to interpret the first value in an ambiguous 3-integer date
+ (e.g. 01/05/09) as the year. If ``True``, the first number is taken
+ to be the year, otherwise the last number is taken to be the year.
+ Default is ``False``.
+ """
+
+ # m from a.m/p.m, t from ISO T separator
+ JUMP = [" ", ".", ",", ";", "-", "/", "'",
+ "at", "on", "and", "ad", "m", "t", "of",
+ "st", "nd", "rd", "th"]
+
+ WEEKDAYS = [("Mon", "Monday"),
+ ("Tue", "Tuesday"), # TODO: "Tues"
+ ("Wed", "Wednesday"),
+ ("Thu", "Thursday"), # TODO: "Thurs"
+ ("Fri", "Friday"),
+ ("Sat", "Saturday"),
+ ("Sun", "Sunday")]
+ MONTHS = [("Jan", "January"),
+ ("Feb", "February"), # TODO: "Febr"
+ ("Mar", "March"),
+ ("Apr", "April"),
+ ("May", "May"),
+ ("Jun", "June"),
+ ("Jul", "July"),
+ ("Aug", "August"),
+ ("Sep", "Sept", "September"),
+ ("Oct", "October"),
+ ("Nov", "November"),
+ ("Dec", "December")]
+ HMS = [("h", "hour", "hours"),
+ ("m", "minute", "minutes"),
+ ("s", "second", "seconds")]
+ AMPM = [("am", "a"),
+ ("pm", "p")]
+ UTCZONE = ["UTC", "GMT", "Z", "z"]
+ PERTAIN = ["of"]
+ TZOFFSET = {}
+ # TODO: ERA = ["AD", "BC", "CE", "BCE", "Stardate",
+ # "Anno Domini", "Year of Our Lord"]
+
+ def __init__(self, dayfirst=False, yearfirst=False):
+ self._jump = self._convert(self.JUMP)
+ self._weekdays = self._convert(self.WEEKDAYS)
+ self._months = self._convert(self.MONTHS)
+ self._hms = self._convert(self.HMS)
+ self._ampm = self._convert(self.AMPM)
+ self._utczone = self._convert(self.UTCZONE)
+ self._pertain = self._convert(self.PERTAIN)
+
+ self.dayfirst = dayfirst
+ self.yearfirst = yearfirst
+
+ self._year = time.localtime().tm_year
+ self._century = self._year // 100 * 100
+
+ def _convert(self, lst):
+ dct = {}
+ for i, v in enumerate(lst):
+ if isinstance(v, tuple):
+ for v in v:
+ dct[v.lower()] = i
+ else:
+ dct[v.lower()] = i
+ return dct
+
+ def jump(self, name):
+ return name.lower() in self._jump
+
+ def weekday(self, name):
+ try:
+ return self._weekdays[name.lower()]
+ except KeyError:
+ pass
+ return None
+
+ def month(self, name):
+ try:
+ return self._months[name.lower()] + 1
+ except KeyError:
+ pass
+ return None
+
+ def hms(self, name):
+ try:
+ return self._hms[name.lower()]
+ except KeyError:
+ return None
+
+ def ampm(self, name):
+ try:
+ return self._ampm[name.lower()]
+ except KeyError:
+ return None
+
+ def pertain(self, name):
+ return name.lower() in self._pertain
+
+ def utczone(self, name):
+ return name.lower() in self._utczone
+
+ def tzoffset(self, name):
+ if name in self._utczone:
+ return 0
+
+ return self.TZOFFSET.get(name)
+
+ def convertyear(self, year, century_specified=False):
+ """
+ Converts two-digit years to year within [-50, 49]
+ range of self._year (current local time)
+ """
+
+ # Function contract is that the year is always positive
+ assert year >= 0
+
+ if year < 100 and not century_specified:
+ # assume current century to start
+ year += self._century
+
+ if year >= self._year + 50: # if too far in future
+ year -= 100
+ elif year < self._year - 50: # if too far in past
+ year += 100
+
+ return year
+
+ def validate(self, res):
+ # move to info
+ if res.year is not None:
+ res.year = self.convertyear(res.year, res.century_specified)
+
+ if ((res.tzoffset == 0 and not res.tzname) or
+ (res.tzname == 'Z' or res.tzname == 'z')):
+ res.tzname = "UTC"
+ res.tzoffset = 0
+ elif res.tzoffset != 0 and res.tzname and self.utczone(res.tzname):
+ res.tzoffset = 0
+ return True
+
+
+class _ymd(list):
+ def __init__(self, *args, **kwargs):
+ super(self.__class__, self).__init__(*args, **kwargs)
+ self.century_specified = False
+ self.dstridx = None
+ self.mstridx = None
+ self.ystridx = None
+
+ @property
+ def has_year(self):
+ return self.ystridx is not None
+
+ @property
+ def has_month(self):
+ return self.mstridx is not None
+
+ @property
+ def has_day(self):
+ return self.dstridx is not None
+
+ def could_be_day(self, value):
+ if self.has_day:
+ return False
+ elif not self.has_month:
+ return 1 <= value <= 31
+ elif not self.has_year:
+ # Be permissive, assume leap year
+ month = self[self.mstridx]
+ return 1 <= value <= monthrange(2000, month)[1]
+ else:
+ month = self[self.mstridx]
+ year = self[self.ystridx]
+ return 1 <= value <= monthrange(year, month)[1]
+
+ def append(self, val, label=None):
+ if hasattr(val, '__len__'):
+ if val.isdigit() and len(val) > 2:
+ self.century_specified = True
+ if label not in [None, 'Y']: # pragma: no cover
+ raise ValueError(label)
+ label = 'Y'
+ elif val > 100:
+ self.century_specified = True
+ if label not in [None, 'Y']: # pragma: no cover
+ raise ValueError(label)
+ label = 'Y'
+
+ super(self.__class__, self).append(int(val))
+
+ if label == 'M':
+ if self.has_month:
+ raise ValueError('Month is already set')
+ self.mstridx = len(self) - 1
+ elif label == 'D':
+ if self.has_day:
+ raise ValueError('Day is already set')
+ self.dstridx = len(self) - 1
+ elif label == 'Y':
+ if self.has_year:
+ raise ValueError('Year is already set')
+ self.ystridx = len(self) - 1
+
+ def _resolve_from_stridxs(self, strids):
+ """
+ Try to resolve the identities of year/month/day elements using
+ ystridx, mstridx, and dstridx, if enough of these are specified.
+ """
+ if len(self) == 3 and len(strids) == 2:
+ # we can back out the remaining stridx value
+ missing = [x for x in range(3) if x not in strids.values()]
+ key = [x for x in ['y', 'm', 'd'] if x not in strids]
+ assert len(missing) == len(key) == 1
+ key = key[0]
+ val = missing[0]
+ strids[key] = val
+
+ assert len(self) == len(strids) # otherwise this should not be called
+ out = {key: self[strids[key]] for key in strids}
+ return (out.get('y'), out.get('m'), out.get('d'))
+
+ def resolve_ymd(self, yearfirst, dayfirst):
+ len_ymd = len(self)
+ year, month, day = (None, None, None)
+
+ strids = (('y', self.ystridx),
+ ('m', self.mstridx),
+ ('d', self.dstridx))
+
+ strids = {key: val for key, val in strids if val is not None}
+ if (len(self) == len(strids) > 0 or
+ (len(self) == 3 and len(strids) == 2)):
+ return self._resolve_from_stridxs(strids)
+
+ mstridx = self.mstridx
+
+ if len_ymd > 3:
+ raise ValueError("More than three YMD values")
+ elif len_ymd == 1 or (mstridx is not None and len_ymd == 2):
+ # One member, or two members with a month string
+ if mstridx is not None:
+ month = self[mstridx]
+ # since mstridx is 0 or 1, self[mstridx-1] always
+ # looks up the other element
+ other = self[mstridx - 1]
+ else:
+ other = self[0]
+
+ if len_ymd > 1 or mstridx is None:
+ if other > 31:
+ year = other
+ else:
+ day = other
+
+ elif len_ymd == 2:
+ # Two members with numbers
+ if self[0] > 31:
+ # 99-01
+ year, month = self
+ elif self[1] > 31:
+ # 01-99
+ month, year = self
+ elif dayfirst and self[1] <= 12:
+ # 13-01
+ day, month = self
+ else:
+ # 01-13
+ month, day = self
+
+ elif len_ymd == 3:
+ # Three members
+ if mstridx == 0:
+ if self[1] > 31:
+ # Apr-2003-25
+ month, year, day = self
+ else:
+ month, day, year = self
+ elif mstridx == 1:
+ if self[0] > 31 or (yearfirst and self[2] <= 31):
+ # 99-Jan-01
+ year, month, day = self
+ else:
+ # 01-Jan-01
+ # Give precedence to day-first, since
+ # two-digit years is usually hand-written.
+ day, month, year = self
+
+ elif mstridx == 2:
+ # WTF!?
+ if self[1] > 31:
+ # 01-99-Jan
+ day, year, month = self
+ else:
+ # 99-01-Jan
+ year, day, month = self
+
+ else:
+ if (self[0] > 31 or
+ self.ystridx == 0 or
+ (yearfirst and self[1] <= 12 and self[2] <= 31)):
+ # 99-01-01
+ if dayfirst and self[2] <= 12:
+ year, day, month = self
+ else:
+ year, month, day = self
+ elif self[0] > 12 or (dayfirst and self[1] <= 12):
+ # 13-01-01
+ day, month, year = self
+ else:
+ # 01-13-01
+ month, day, year = self
+
+ return year, month, day
+
+
+class parser(object):
+ def __init__(self, info=None):
+ self.info = info or parserinfo()
+
+ def parse(self, timestr, default=None,
+ ignoretz=False, tzinfos=None, **kwargs):
+ """
+ Parse the date/time string into a :class:`datetime.datetime` object.
+
+ :param timestr:
+ Any date/time string using the supported formats.
+
+ :param default:
+ The default datetime object, if this is a datetime object and not
+ ``None``, elements specified in ``timestr`` replace elements in the
+ default object.
+
+ :param ignoretz:
+ If set ``True``, time zones in parsed strings are ignored and a
+ naive :class:`datetime.datetime` object is returned.
+
+ :param tzinfos:
+ Additional time zone names / aliases which may be present in the
+ string. This argument maps time zone names (and optionally offsets
+ from those time zones) to time zones. This parameter can be a
+ dictionary with timezone aliases mapping time zone names to time
+ zones or a function taking two parameters (``tzname`` and
+ ``tzoffset``) and returning a time zone.
+
+ The timezones to which the names are mapped can be an integer
+ offset from UTC in seconds or a :class:`tzinfo` object.
+
+ .. doctest::
+ :options: +NORMALIZE_WHITESPACE
+
+ >>> from dateutil.parser import parse
+ >>> from dateutil.tz import gettz
+ >>> tzinfos = {"BRST": -7200, "CST": gettz("America/Chicago")}
+ >>> parse("2012-01-19 17:21:00 BRST", tzinfos=tzinfos)
+ datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzoffset(u'BRST', -7200))
+ >>> parse("2012-01-19 17:21:00 CST", tzinfos=tzinfos)
+ datetime.datetime(2012, 1, 19, 17, 21,
+ tzinfo=tzfile('/usr/share/zoneinfo/America/Chicago'))
+
+ This parameter is ignored if ``ignoretz`` is set.
+
+ :param \\*\\*kwargs:
+ Keyword arguments as passed to ``_parse()``.
+
+ :return:
+ Returns a :class:`datetime.datetime` object or, if the
+ ``fuzzy_with_tokens`` option is ``True``, returns a tuple, the
+ first element being a :class:`datetime.datetime` object, the second
+ a tuple containing the fuzzy tokens.
+
+ :raises ParserError:
+ Raised for invalid or unknown string format, if the provided
+ :class:`tzinfo` is not in a valid format, or if an invalid date
+ would be created.
+
+ :raises TypeError:
+ Raised for non-string or character stream input.
+
+ :raises OverflowError:
+ Raised if the parsed date exceeds the largest valid C integer on
+ your system.
+ """
+
+ if default is None:
+ default = datetime.datetime.now().replace(hour=0, minute=0,
+ second=0, microsecond=0)
+
+ res, skipped_tokens = self._parse(timestr, **kwargs)
+
+ if res is None:
+ raise ParserError("Unknown string format: %s", timestr)
+
+ if len(res) == 0:
+ raise ParserError("String does not contain a date: %s", timestr)
+
+ try:
+ ret = self._build_naive(res, default)
+ except ValueError as e:
+ six.raise_from(ParserError(e.args[0] + ": %s", timestr), e)
+
+ if not ignoretz:
+ ret = self._build_tzaware(ret, res, tzinfos)
+
+ if kwargs.get('fuzzy_with_tokens', False):
+ return ret, skipped_tokens
+ else:
+ return ret
+
+ class _result(_resultbase):
+ __slots__ = ["year", "month", "day", "weekday",
+ "hour", "minute", "second", "microsecond",
+ "tzname", "tzoffset", "ampm","any_unused_tokens"]
+
+ def _parse(self, timestr, dayfirst=None, yearfirst=None, fuzzy=False,
+ fuzzy_with_tokens=False):
+ """
+ Private method which performs the heavy lifting of parsing, called from
+ ``parse()``, which passes on its ``kwargs`` to this function.
+
+ :param timestr:
+ The string to parse.
+
+ :param dayfirst:
+ Whether to interpret the first value in an ambiguous 3-integer date
+ (e.g. 01/05/09) as the day (``True``) or month (``False``). If
+ ``yearfirst`` is set to ``True``, this distinguishes between YDM
+ and YMD. If set to ``None``, this value is retrieved from the
+ current :class:`parserinfo` object (which itself defaults to
+ ``False``).
+
+ :param yearfirst:
+ Whether to interpret the first value in an ambiguous 3-integer date
+ (e.g. 01/05/09) as the year. If ``True``, the first number is taken
+ to be the year, otherwise the last number is taken to be the year.
+ If this is set to ``None``, the value is retrieved from the current
+ :class:`parserinfo` object (which itself defaults to ``False``).
+
+ :param fuzzy:
+ Whether to allow fuzzy parsing, allowing for string like "Today is
+ January 1, 2047 at 8:21:00AM".
+
+ :param fuzzy_with_tokens:
+ If ``True``, ``fuzzy`` is automatically set to True, and the parser
+ will return a tuple where the first element is the parsed
+ :class:`datetime.datetime` datetimestamp and the second element is
+ a tuple containing the portions of the string which were ignored:
+
+ .. doctest::
+
+ >>> from dateutil.parser import parse
+ >>> parse("Today is January 1, 2047 at 8:21:00AM", fuzzy_with_tokens=True)
+ (datetime.datetime(2047, 1, 1, 8, 21), (u'Today is ', u' ', u'at '))
+
+ """
+ if fuzzy_with_tokens:
+ fuzzy = True
+
+ info = self.info
+
+ if dayfirst is None:
+ dayfirst = info.dayfirst
+
+ if yearfirst is None:
+ yearfirst = info.yearfirst
+
+ res = self._result()
+ l = _timelex.split(timestr) # Splits the timestr into tokens
+
+ skipped_idxs = []
+
+ # year/month/day list
+ ymd = _ymd()
+
+ len_l = len(l)
+ i = 0
+ try:
+ while i < len_l:
+
+ # Check if it's a number
+ value_repr = l[i]
+ try:
+ value = float(value_repr)
+ except ValueError:
+ value = None
+
+ if value is not None:
+ # Numeric token
+ i = self._parse_numeric_token(l, i, info, ymd, res, fuzzy)
+
+ # Check weekday
+ elif info.weekday(l[i]) is not None:
+ value = info.weekday(l[i])
+ res.weekday = value
+
+ # Check month name
+ elif info.month(l[i]) is not None:
+ value = info.month(l[i])
+ ymd.append(value, 'M')
+
+ if i + 1 < len_l:
+ if l[i + 1] in ('-', '/'):
+ # Jan-01[-99]
+ sep = l[i + 1]
+ ymd.append(l[i + 2])
+
+ if i + 3 < len_l and l[i + 3] == sep:
+ # Jan-01-99
+ ymd.append(l[i + 4])
+ i += 2
+
+ i += 2
+
+ elif (i + 4 < len_l and l[i + 1] == l[i + 3] == ' ' and
+ info.pertain(l[i + 2])):
+ # Jan of 01
+ # In this case, 01 is clearly year
+ if l[i + 4].isdigit():
+ # Convert it here to become unambiguous
+ value = int(l[i + 4])
+ year = str(info.convertyear(value))
+ ymd.append(year, 'Y')
+ else:
+ # Wrong guess
+ pass
+ # TODO: not hit in tests
+ i += 4
+
+ # Check am/pm
+ elif info.ampm(l[i]) is not None:
+ value = info.ampm(l[i])
+ val_is_ampm = self._ampm_valid(res.hour, res.ampm, fuzzy)
+
+ if val_is_ampm:
+ res.hour = self._adjust_ampm(res.hour, value)
+ res.ampm = value
+
+ elif fuzzy:
+ skipped_idxs.append(i)
+
+ # Check for a timezone name
+ elif self._could_be_tzname(res.hour, res.tzname, res.tzoffset, l[i]):
+ res.tzname = l[i]
+ res.tzoffset = info.tzoffset(res.tzname)
+
+ # Check for something like GMT+3, or BRST+3. Notice
+ # that it doesn't mean "I am 3 hours after GMT", but
+ # "my time +3 is GMT". If found, we reverse the
+ # logic so that timezone parsing code will get it
+ # right.
+ if i + 1 < len_l and l[i + 1] in ('+', '-'):
+ l[i + 1] = ('+', '-')[l[i + 1] == '+']
+ res.tzoffset = None
+ if info.utczone(res.tzname):
+ # With something like GMT+3, the timezone
+ # is *not* GMT.
+ res.tzname = None
+
+ # Check for a numbered timezone
+ elif res.hour is not None and l[i] in ('+', '-'):
+ signal = (-1, 1)[l[i] == '+']
+ len_li = len(l[i + 1])
+
+ # TODO: check that l[i + 1] is integer?
+ if len_li == 4:
+ # -0300
+ hour_offset = int(l[i + 1][:2])
+ min_offset = int(l[i + 1][2:])
+ elif i + 2 < len_l and l[i + 2] == ':':
+ # -03:00
+ hour_offset = int(l[i + 1])
+ min_offset = int(l[i + 3]) # TODO: Check that l[i+3] is minute-like?
+ i += 2
+ elif len_li <= 2:
+ # -[0]3
+ hour_offset = int(l[i + 1][:2])
+ min_offset = 0
+ else:
+ raise ValueError(timestr)
+
+ res.tzoffset = signal * (hour_offset * 3600 + min_offset * 60)
+
+ # Look for a timezone name between parenthesis
+ if (i + 5 < len_l and
+ info.jump(l[i + 2]) and l[i + 3] == '(' and
+ l[i + 5] == ')' and
+ 3 <= len(l[i + 4]) and
+ self._could_be_tzname(res.hour, res.tzname,
+ None, l[i + 4])):
+ # -0300 (BRST)
+ res.tzname = l[i + 4]
+ i += 4
+
+ i += 1
+
+ # Check jumps
+ elif not (info.jump(l[i]) or fuzzy):
+ raise ValueError(timestr)
+
+ else:
+ skipped_idxs.append(i)
+ i += 1
+
+ # Process year/month/day
+ year, month, day = ymd.resolve_ymd(yearfirst, dayfirst)
+
+ res.century_specified = ymd.century_specified
+ res.year = year
+ res.month = month
+ res.day = day
+
+ except (IndexError, ValueError):
+ return None, None
+
+ if not info.validate(res):
+ return None, None
+
+ if fuzzy_with_tokens:
+ skipped_tokens = self._recombine_skipped(l, skipped_idxs)
+ return res, tuple(skipped_tokens)
+ else:
+ return res, None
+
+ def _parse_numeric_token(self, tokens, idx, info, ymd, res, fuzzy):
+ # Token is a number
+ value_repr = tokens[idx]
+ try:
+ value = self._to_decimal(value_repr)
+ except Exception as e:
+ six.raise_from(ValueError('Unknown numeric token'), e)
+
+ len_li = len(value_repr)
+
+ len_l = len(tokens)
+
+ if (len(ymd) == 3 and len_li in (2, 4) and
+ res.hour is None and
+ (idx + 1 >= len_l or
+ (tokens[idx + 1] != ':' and
+ info.hms(tokens[idx + 1]) is None))):
+ # 19990101T23[59]
+ s = tokens[idx]
+ res.hour = int(s[:2])
+
+ if len_li == 4:
+ res.minute = int(s[2:])
+
+ elif len_li == 6 or (len_li > 6 and tokens[idx].find('.') == 6):
+ # YYMMDD or HHMMSS[.ss]
+ s = tokens[idx]
+
+ if not ymd and '.' not in tokens[idx]:
+ ymd.append(s[:2])
+ ymd.append(s[2:4])
+ ymd.append(s[4:])
+ else:
+ # 19990101T235959[.59]
+
+ # TODO: Check if res attributes already set.
+ res.hour = int(s[:2])
+ res.minute = int(s[2:4])
+ res.second, res.microsecond = self._parsems(s[4:])
+
+ elif len_li in (8, 12, 14):
+ # YYYYMMDD
+ s = tokens[idx]
+ ymd.append(s[:4], 'Y')
+ ymd.append(s[4:6])
+ ymd.append(s[6:8])
+
+ if len_li > 8:
+ res.hour = int(s[8:10])
+ res.minute = int(s[10:12])
+
+ if len_li > 12:
+ res.second = int(s[12:])
+
+ elif self._find_hms_idx(idx, tokens, info, allow_jump=True) is not None:
+ # HH[ ]h or MM[ ]m or SS[.ss][ ]s
+ hms_idx = self._find_hms_idx(idx, tokens, info, allow_jump=True)
+ (idx, hms) = self._parse_hms(idx, tokens, info, hms_idx)
+ if hms is not None:
+ # TODO: checking that hour/minute/second are not
+ # already set?
+ self._assign_hms(res, value_repr, hms)
+
+ elif idx + 2 < len_l and tokens[idx + 1] == ':':
+ # HH:MM[:SS[.ss]]
+ res.hour = int(value)
+ value = self._to_decimal(tokens[idx + 2]) # TODO: try/except for this?
+ (res.minute, res.second) = self._parse_min_sec(value)
+
+ if idx + 4 < len_l and tokens[idx + 3] == ':':
+ res.second, res.microsecond = self._parsems(tokens[idx + 4])
+
+ idx += 2
+
+ idx += 2
+
+ elif idx + 1 < len_l and tokens[idx + 1] in ('-', '/', '.'):
+ sep = tokens[idx + 1]
+ ymd.append(value_repr)
+
+ if idx + 2 < len_l and not info.jump(tokens[idx + 2]):
+ if tokens[idx + 2].isdigit():
+ # 01-01[-01]
+ ymd.append(tokens[idx + 2])
+ else:
+ # 01-Jan[-01]
+ value = info.month(tokens[idx + 2])
+
+ if value is not None:
+ ymd.append(value, 'M')
+ else:
+ raise ValueError()
+
+ if idx + 3 < len_l and tokens[idx + 3] == sep:
+ # We have three members
+ value = info.month(tokens[idx + 4])
+
+ if value is not None:
+ ymd.append(value, 'M')
+ else:
+ ymd.append(tokens[idx + 4])
+ idx += 2
+
+ idx += 1
+ idx += 1
+
+ elif idx + 1 >= len_l or info.jump(tokens[idx + 1]):
+ if idx + 2 < len_l and info.ampm(tokens[idx + 2]) is not None:
+ # 12 am
+ hour = int(value)
+ res.hour = self._adjust_ampm(hour, info.ampm(tokens[idx + 2]))
+ idx += 1
+ else:
+ # Year, month or day
+ ymd.append(value)
+ idx += 1
+
+ elif info.ampm(tokens[idx + 1]) is not None and (0 <= value < 24):
+ # 12am
+ hour = int(value)
+ res.hour = self._adjust_ampm(hour, info.ampm(tokens[idx + 1]))
+ idx += 1
+
+ elif ymd.could_be_day(value):
+ ymd.append(value)
+
+ elif not fuzzy:
+ raise ValueError()
+
+ return idx
+
+ def _find_hms_idx(self, idx, tokens, info, allow_jump):
+ len_l = len(tokens)
+
+ if idx+1 < len_l and info.hms(tokens[idx+1]) is not None:
+ # There is an "h", "m", or "s" label following this token. We take
+ # assign the upcoming label to the current token.
+ # e.g. the "12" in 12h"
+ hms_idx = idx + 1
+
+ elif (allow_jump and idx+2 < len_l and tokens[idx+1] == ' ' and
+ info.hms(tokens[idx+2]) is not None):
+ # There is a space and then an "h", "m", or "s" label.
+ # e.g. the "12" in "12 h"
+ hms_idx = idx + 2
+
+ elif idx > 0 and info.hms(tokens[idx-1]) is not None:
+ # There is a "h", "m", or "s" preceding this token. Since neither
+ # of the previous cases was hit, there is no label following this
+ # token, so we use the previous label.
+ # e.g. the "04" in "12h04"
+ hms_idx = idx-1
+
+ elif (1 < idx == len_l-1 and tokens[idx-1] == ' ' and
+ info.hms(tokens[idx-2]) is not None):
+ # If we are looking at the final token, we allow for a
+ # backward-looking check to skip over a space.
+ # TODO: Are we sure this is the right condition here?
+ hms_idx = idx - 2
+
+ else:
+ hms_idx = None
+
+ return hms_idx
+
+ def _assign_hms(self, res, value_repr, hms):
+ # See GH issue #427, fixing float rounding
+ value = self._to_decimal(value_repr)
+
+ if hms == 0:
+ # Hour
+ res.hour = int(value)
+ if value % 1:
+ res.minute = int(60*(value % 1))
+
+ elif hms == 1:
+ (res.minute, res.second) = self._parse_min_sec(value)
+
+ elif hms == 2:
+ (res.second, res.microsecond) = self._parsems(value_repr)
+
+ def _could_be_tzname(self, hour, tzname, tzoffset, token):
+ return (hour is not None and
+ tzname is None and
+ tzoffset is None and
+ len(token) <= 5 and
+ (all(x in string.ascii_uppercase for x in token)
+ or token in self.info.UTCZONE))
+
+ def _ampm_valid(self, hour, ampm, fuzzy):
+ """
+ For fuzzy parsing, 'a' or 'am' (both valid English words)
+ may erroneously trigger the AM/PM flag. Deal with that
+ here.
+ """
+ val_is_ampm = True
+
+ # If there's already an AM/PM flag, this one isn't one.
+ if fuzzy and ampm is not None:
+ val_is_ampm = False
+
+ # If AM/PM is found and hour is not, raise a ValueError
+ if hour is None:
+ if fuzzy:
+ val_is_ampm = False
+ else:
+ raise ValueError('No hour specified with AM or PM flag.')
+ elif not 0 <= hour <= 12:
+ # If AM/PM is found, it's a 12 hour clock, so raise
+ # an error for invalid range
+ if fuzzy:
+ val_is_ampm = False
+ else:
+ raise ValueError('Invalid hour specified for 12-hour clock.')
+
+ return val_is_ampm
+
+ def _adjust_ampm(self, hour, ampm):
+ if hour < 12 and ampm == 1:
+ hour += 12
+ elif hour == 12 and ampm == 0:
+ hour = 0
+ return hour
+
+ def _parse_min_sec(self, value):
+ # TODO: Every usage of this function sets res.second to the return
+ # value. Are there any cases where second will be returned as None and
+ # we *don't* want to set res.second = None?
+ minute = int(value)
+ second = None
+
+ sec_remainder = value % 1
+ if sec_remainder:
+ second = int(60 * sec_remainder)
+ return (minute, second)
+
+ def _parse_hms(self, idx, tokens, info, hms_idx):
+ # TODO: Is this going to admit a lot of false-positives for when we
+ # just happen to have digits and "h", "m" or "s" characters in non-date
+ # text? I guess hex hashes won't have that problem, but there's plenty
+ # of random junk out there.
+ if hms_idx is None:
+ hms = None
+ new_idx = idx
+ elif hms_idx > idx:
+ hms = info.hms(tokens[hms_idx])
+ new_idx = hms_idx
+ else:
+ # Looking backwards, increment one.
+ hms = info.hms(tokens[hms_idx]) + 1
+ new_idx = idx
+
+ return (new_idx, hms)
+
+ # ------------------------------------------------------------------
+ # Handling for individual tokens. These are kept as methods instead
+ # of functions for the sake of customizability via subclassing.
+
+ def _parsems(self, value):
+ """Parse a I[.F] seconds value into (seconds, microseconds)."""
+ if "." not in value:
+ return int(value), 0
+ else:
+ i, f = value.split(".")
+ return int(i), int(f.ljust(6, "0")[:6])
+
+ def _to_decimal(self, val):
+ try:
+ decimal_value = Decimal(val)
+ # See GH 662, edge case, infinite value should not be converted
+ # via `_to_decimal`
+ if not decimal_value.is_finite():
+ raise ValueError("Converted decimal value is infinite or NaN")
+ except Exception as e:
+ msg = "Could not convert %s to decimal" % val
+ six.raise_from(ValueError(msg), e)
+ else:
+ return decimal_value
+
+ # ------------------------------------------------------------------
+ # Post-Parsing construction of datetime output. These are kept as
+ # methods instead of functions for the sake of customizability via
+ # subclassing.
+
+ def _build_tzinfo(self, tzinfos, tzname, tzoffset):
+ if callable(tzinfos):
+ tzdata = tzinfos(tzname, tzoffset)
+ else:
+ tzdata = tzinfos.get(tzname)
+ # handle case where tzinfo is paased an options that returns None
+ # eg tzinfos = {'BRST' : None}
+ if isinstance(tzdata, datetime.tzinfo) or tzdata is None:
+ tzinfo = tzdata
+ elif isinstance(tzdata, text_type):
+ tzinfo = tz.tzstr(tzdata)
+ elif isinstance(tzdata, integer_types):
+ tzinfo = tz.tzoffset(tzname, tzdata)
+ else:
+ raise TypeError("Offset must be tzinfo subclass, tz string, "
+ "or int offset.")
+ return tzinfo
+
+ def _build_tzaware(self, naive, res, tzinfos):
+ if (callable(tzinfos) or (tzinfos and res.tzname in tzinfos)):
+ tzinfo = self._build_tzinfo(tzinfos, res.tzname, res.tzoffset)
+ aware = naive.replace(tzinfo=tzinfo)
+ aware = self._assign_tzname(aware, res.tzname)
+
+ elif res.tzname and res.tzname in time.tzname:
+ aware = naive.replace(tzinfo=tz.tzlocal())
+
+ # Handle ambiguous local datetime
+ aware = self._assign_tzname(aware, res.tzname)
+
+ # This is mostly relevant for winter GMT zones parsed in the UK
+ if (aware.tzname() != res.tzname and
+ res.tzname in self.info.UTCZONE):
+ aware = aware.replace(tzinfo=tz.UTC)
+
+ elif res.tzoffset == 0:
+ aware = naive.replace(tzinfo=tz.UTC)
+
+ elif res.tzoffset:
+ aware = naive.replace(tzinfo=tz.tzoffset(res.tzname, res.tzoffset))
+
+ elif not res.tzname and not res.tzoffset:
+ # i.e. no timezone information was found.
+ aware = naive
+
+ elif res.tzname:
+ # tz-like string was parsed but we don't know what to do
+ # with it
+ warnings.warn("tzname {tzname} identified but not understood. "
+ "Pass `tzinfos` argument in order to correctly "
+ "return a timezone-aware datetime. In a future "
+ "version, this will raise an "
+ "exception.".format(tzname=res.tzname),
+ category=UnknownTimezoneWarning)
+ aware = naive
+
+ return aware
+
+ def _build_naive(self, res, default):
+ repl = {}
+ for attr in ("year", "month", "day", "hour",
+ "minute", "second", "microsecond"):
+ value = getattr(res, attr)
+ if value is not None:
+ repl[attr] = value
+
+ if 'day' not in repl:
+ # If the default day exceeds the last day of the month, fall back
+ # to the end of the month.
+ cyear = default.year if res.year is None else res.year
+ cmonth = default.month if res.month is None else res.month
+ cday = default.day if res.day is None else res.day
+
+ if cday > monthrange(cyear, cmonth)[1]:
+ repl['day'] = monthrange(cyear, cmonth)[1]
+
+ naive = default.replace(**repl)
+
+ if res.weekday is not None and not res.day:
+ naive = naive + relativedelta.relativedelta(weekday=res.weekday)
+
+ return naive
+
+ def _assign_tzname(self, dt, tzname):
+ if dt.tzname() != tzname:
+ new_dt = tz.enfold(dt, fold=1)
+ if new_dt.tzname() == tzname:
+ return new_dt
+
+ return dt
+
+ def _recombine_skipped(self, tokens, skipped_idxs):
+ """
+ >>> tokens = ["foo", " ", "bar", " ", "19June2000", "baz"]
+ >>> skipped_idxs = [0, 1, 2, 5]
+ >>> _recombine_skipped(tokens, skipped_idxs)
+ ["foo bar", "baz"]
+ """
+ skipped_tokens = []
+ for i, idx in enumerate(sorted(skipped_idxs)):
+ if i > 0 and idx - 1 == skipped_idxs[i - 1]:
+ skipped_tokens[-1] = skipped_tokens[-1] + tokens[idx]
+ else:
+ skipped_tokens.append(tokens[idx])
+
+ return skipped_tokens
+
+
+DEFAULTPARSER = parser()
+
+
+def parse(timestr, parserinfo=None, **kwargs):
+ """
+
+ Parse a string in one of the supported formats, using the
+ ``parserinfo`` parameters.
+
+ :param timestr:
+ A string containing a date/time stamp.
+
+ :param parserinfo:
+ A :class:`parserinfo` object containing parameters for the parser.
+ If ``None``, the default arguments to the :class:`parserinfo`
+ constructor are used.
+
+ The ``**kwargs`` parameter takes the following keyword arguments:
+
+ :param default:
+ The default datetime object, if this is a datetime object and not
+ ``None``, elements specified in ``timestr`` replace elements in the
+ default object.
+
+ :param ignoretz:
+ If set ``True``, time zones in parsed strings are ignored and a naive
+ :class:`datetime` object is returned.
+
+ :param tzinfos:
+ Additional time zone names / aliases which may be present in the
+ string. This argument maps time zone names (and optionally offsets
+ from those time zones) to time zones. This parameter can be a
+ dictionary with timezone aliases mapping time zone names to time
+ zones or a function taking two parameters (``tzname`` and
+ ``tzoffset``) and returning a time zone.
+
+ The timezones to which the names are mapped can be an integer
+ offset from UTC in seconds or a :class:`tzinfo` object.
+
+ .. doctest::
+ :options: +NORMALIZE_WHITESPACE
+
+ >>> from dateutil.parser import parse
+ >>> from dateutil.tz import gettz
+ >>> tzinfos = {"BRST": -7200, "CST": gettz("America/Chicago")}
+ >>> parse("2012-01-19 17:21:00 BRST", tzinfos=tzinfos)
+ datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzoffset(u'BRST', -7200))
+ >>> parse("2012-01-19 17:21:00 CST", tzinfos=tzinfos)
+ datetime.datetime(2012, 1, 19, 17, 21,
+ tzinfo=tzfile('/usr/share/zoneinfo/America/Chicago'))
+
+ This parameter is ignored if ``ignoretz`` is set.
+
+ :param dayfirst:
+ Whether to interpret the first value in an ambiguous 3-integer date
+ (e.g. 01/05/09) as the day (``True``) or month (``False``). If
+ ``yearfirst`` is set to ``True``, this distinguishes between YDM and
+ YMD. If set to ``None``, this value is retrieved from the current
+ :class:`parserinfo` object (which itself defaults to ``False``).
+
+ :param yearfirst:
+ Whether to interpret the first value in an ambiguous 3-integer date
+ (e.g. 01/05/09) as the year. If ``True``, the first number is taken to
+ be the year, otherwise the last number is taken to be the year. If
+ this is set to ``None``, the value is retrieved from the current
+ :class:`parserinfo` object (which itself defaults to ``False``).
+
+ :param fuzzy:
+ Whether to allow fuzzy parsing, allowing for string like "Today is
+ January 1, 2047 at 8:21:00AM".
+
+ :param fuzzy_with_tokens:
+ If ``True``, ``fuzzy`` is automatically set to True, and the parser
+ will return a tuple where the first element is the parsed
+ :class:`datetime.datetime` datetimestamp and the second element is
+ a tuple containing the portions of the string which were ignored:
+
+ .. doctest::
+
+ >>> from dateutil.parser import parse
+ >>> parse("Today is January 1, 2047 at 8:21:00AM", fuzzy_with_tokens=True)
+ (datetime.datetime(2047, 1, 1, 8, 21), (u'Today is ', u' ', u'at '))
+
+ :return:
+ Returns a :class:`datetime.datetime` object or, if the
+ ``fuzzy_with_tokens`` option is ``True``, returns a tuple, the
+ first element being a :class:`datetime.datetime` object, the second
+ a tuple containing the fuzzy tokens.
+
+ :raises ValueError:
+ Raised for invalid or unknown string format, if the provided
+ :class:`tzinfo` is not in a valid format, or if an invalid date
+ would be created.
+
+ :raises OverflowError:
+ Raised if the parsed date exceeds the largest valid C integer on
+ your system.
+ """
+ if parserinfo:
+ return parser(parserinfo).parse(timestr, **kwargs)
+ else:
+ return DEFAULTPARSER.parse(timestr, **kwargs)
+
+
+class _tzparser(object):
+
+ class _result(_resultbase):
+
+ __slots__ = ["stdabbr", "stdoffset", "dstabbr", "dstoffset",
+ "start", "end"]
+
+ class _attr(_resultbase):
+ __slots__ = ["month", "week", "weekday",
+ "yday", "jyday", "day", "time"]
+
+ def __repr__(self):
+ return self._repr("")
+
+ def __init__(self):
+ _resultbase.__init__(self)
+ self.start = self._attr()
+ self.end = self._attr()
+
+ def parse(self, tzstr):
+ res = self._result()
+ l = [x for x in re.split(r'([,:.]|[a-zA-Z]+|[0-9]+)',tzstr) if x]
+ used_idxs = list()
+ try:
+
+ len_l = len(l)
+
+ i = 0
+ while i < len_l:
+ # BRST+3[BRDT[+2]]
+ j = i
+ while j < len_l and not [x for x in l[j]
+ if x in "0123456789:,-+"]:
+ j += 1
+ if j != i:
+ if not res.stdabbr:
+ offattr = "stdoffset"
+ res.stdabbr = "".join(l[i:j])
+ else:
+ offattr = "dstoffset"
+ res.dstabbr = "".join(l[i:j])
+
+ for ii in range(j):
+ used_idxs.append(ii)
+ i = j
+ if (i < len_l and (l[i] in ('+', '-') or l[i][0] in
+ "0123456789")):
+ if l[i] in ('+', '-'):
+ # Yes, that's right. See the TZ variable
+ # documentation.
+ signal = (1, -1)[l[i] == '+']
+ used_idxs.append(i)
+ i += 1
+ else:
+ signal = -1
+ len_li = len(l[i])
+ if len_li == 4:
+ # -0300
+ setattr(res, offattr, (int(l[i][:2]) * 3600 +
+ int(l[i][2:]) * 60) * signal)
+ elif i + 1 < len_l and l[i + 1] == ':':
+ # -03:00
+ setattr(res, offattr,
+ (int(l[i]) * 3600 +
+ int(l[i + 2]) * 60) * signal)
+ used_idxs.append(i)
+ i += 2
+ elif len_li <= 2:
+ # -[0]3
+ setattr(res, offattr,
+ int(l[i][:2]) * 3600 * signal)
+ else:
+ return None
+ used_idxs.append(i)
+ i += 1
+ if res.dstabbr:
+ break
+ else:
+ break
+
+
+ if i < len_l:
+ for j in range(i, len_l):
+ if l[j] == ';':
+ l[j] = ','
+
+ assert l[i] == ','
+
+ i += 1
+
+ if i >= len_l:
+ pass
+ elif (8 <= l.count(',') <= 9 and
+ not [y for x in l[i:] if x != ','
+ for y in x if y not in "0123456789+-"]):
+ # GMT0BST,3,0,30,3600,10,0,26,7200[,3600]
+ for x in (res.start, res.end):
+ x.month = int(l[i])
+ used_idxs.append(i)
+ i += 2
+ if l[i] == '-':
+ value = int(l[i + 1]) * -1
+ used_idxs.append(i)
+ i += 1
+ else:
+ value = int(l[i])
+ used_idxs.append(i)
+ i += 2
+ if value:
+ x.week = value
+ x.weekday = (int(l[i]) - 1) % 7
+ else:
+ x.day = int(l[i])
+ used_idxs.append(i)
+ i += 2
+ x.time = int(l[i])
+ used_idxs.append(i)
+ i += 2
+ if i < len_l:
+ if l[i] in ('-', '+'):
+ signal = (-1, 1)[l[i] == "+"]
+ used_idxs.append(i)
+ i += 1
+ else:
+ signal = 1
+ used_idxs.append(i)
+ res.dstoffset = (res.stdoffset + int(l[i]) * signal)
+
+ # This was a made-up format that is not in normal use
+ warn(('Parsed time zone "%s"' % tzstr) +
+ 'is in a non-standard dateutil-specific format, which ' +
+ 'is now deprecated; support for parsing this format ' +
+ 'will be removed in future versions. It is recommended ' +
+ 'that you switch to a standard format like the GNU ' +
+ 'TZ variable format.', tz.DeprecatedTzFormatWarning)
+ elif (l.count(',') == 2 and l[i:].count('/') <= 2 and
+ not [y for x in l[i:] if x not in (',', '/', 'J', 'M',
+ '.', '-', ':')
+ for y in x if y not in "0123456789"]):
+ for x in (res.start, res.end):
+ if l[i] == 'J':
+ # non-leap year day (1 based)
+ used_idxs.append(i)
+ i += 1
+ x.jyday = int(l[i])
+ elif l[i] == 'M':
+ # month[-.]week[-.]weekday
+ used_idxs.append(i)
+ i += 1
+ x.month = int(l[i])
+ used_idxs.append(i)
+ i += 1
+ assert l[i] in ('-', '.')
+ used_idxs.append(i)
+ i += 1
+ x.week = int(l[i])
+ if x.week == 5:
+ x.week = -1
+ used_idxs.append(i)
+ i += 1
+ assert l[i] in ('-', '.')
+ used_idxs.append(i)
+ i += 1
+ x.weekday = (int(l[i]) - 1) % 7
+ else:
+ # year day (zero based)
+ x.yday = int(l[i]) + 1
+
+ used_idxs.append(i)
+ i += 1
+
+ if i < len_l and l[i] == '/':
+ used_idxs.append(i)
+ i += 1
+ # start time
+ len_li = len(l[i])
+ if len_li == 4:
+ # -0300
+ x.time = (int(l[i][:2]) * 3600 +
+ int(l[i][2:]) * 60)
+ elif i + 1 < len_l and l[i + 1] == ':':
+ # -03:00
+ x.time = int(l[i]) * 3600 + int(l[i + 2]) * 60
+ used_idxs.append(i)
+ i += 2
+ if i + 1 < len_l and l[i + 1] == ':':
+ used_idxs.append(i)
+ i += 2
+ x.time += int(l[i])
+ elif len_li <= 2:
+ # -[0]3
+ x.time = (int(l[i][:2]) * 3600)
+ else:
+ return None
+ used_idxs.append(i)
+ i += 1
+
+ assert i == len_l or l[i] == ','
+
+ i += 1
+
+ assert i >= len_l
+
+ except (IndexError, ValueError, AssertionError):
+ return None
+
+ unused_idxs = set(range(len_l)).difference(used_idxs)
+ res.any_unused_tokens = not {l[n] for n in unused_idxs}.issubset({",",":"})
+ return res
+
+
+DEFAULTTZPARSER = _tzparser()
+
+
+def _parsetz(tzstr):
+ return DEFAULTTZPARSER.parse(tzstr)
+
+
+class ParserError(ValueError):
+ """Error class for representing failure to parse a datetime string."""
+ def __str__(self):
+ try:
+ return self.args[0] % self.args[1:]
+ except (TypeError, IndexError):
+ return super(ParserError, self).__str__()
+
+ def __repr__(self):
+ return "%s(%s)" % (self.__class__.__name__, str(self))
+
+
+class UnknownTimezoneWarning(RuntimeWarning):
+ """Raised when the parser finds a timezone it cannot parse into a tzinfo"""
+# vim:ts=4:sw=4:et
diff --git a/venv/Lib/site-packages/dateutil/parser/isoparser.py b/venv/Lib/site-packages/dateutil/parser/isoparser.py
new file mode 100644
index 0000000..48f86a3
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/parser/isoparser.py
@@ -0,0 +1,411 @@
+# -*- coding: utf-8 -*-
+"""
+This module offers a parser for ISO-8601 strings
+
+It is intended to support all valid date, time and datetime formats per the
+ISO-8601 specification.
+
+..versionadded:: 2.7.0
+"""
+from datetime import datetime, timedelta, time, date
+import calendar
+from dateutil import tz
+
+from functools import wraps
+
+import re
+import six
+
+__all__ = ["isoparse", "isoparser"]
+
+
+def _takes_ascii(f):
+ @wraps(f)
+ def func(self, str_in, *args, **kwargs):
+ # If it's a stream, read the whole thing
+ str_in = getattr(str_in, 'read', lambda: str_in)()
+
+ # If it's unicode, turn it into bytes, since ISO-8601 only covers ASCII
+ if isinstance(str_in, six.text_type):
+ # ASCII is the same in UTF-8
+ try:
+ str_in = str_in.encode('ascii')
+ except UnicodeEncodeError as e:
+ msg = 'ISO-8601 strings should contain only ASCII characters'
+ six.raise_from(ValueError(msg), e)
+
+ return f(self, str_in, *args, **kwargs)
+
+ return func
+
+
+class isoparser(object):
+ def __init__(self, sep=None):
+ """
+ :param sep:
+ A single character that separates date and time portions. If
+ ``None``, the parser will accept any single character.
+ For strict ISO-8601 adherence, pass ``'T'``.
+ """
+ if sep is not None:
+ if (len(sep) != 1 or ord(sep) >= 128 or sep in '0123456789'):
+ raise ValueError('Separator must be a single, non-numeric ' +
+ 'ASCII character')
+
+ sep = sep.encode('ascii')
+
+ self._sep = sep
+
+ @_takes_ascii
+ def isoparse(self, dt_str):
+ """
+ Parse an ISO-8601 datetime string into a :class:`datetime.datetime`.
+
+ An ISO-8601 datetime string consists of a date portion, followed
+ optionally by a time portion - the date and time portions are separated
+ by a single character separator, which is ``T`` in the official
+ standard. Incomplete date formats (such as ``YYYY-MM``) may *not* be
+ combined with a time portion.
+
+ Supported date formats are:
+
+ Common:
+
+ - ``YYYY``
+ - ``YYYY-MM`` or ``YYYYMM``
+ - ``YYYY-MM-DD`` or ``YYYYMMDD``
+
+ Uncommon:
+
+ - ``YYYY-Www`` or ``YYYYWww`` - ISO week (day defaults to 0)
+ - ``YYYY-Www-D`` or ``YYYYWwwD`` - ISO week and day
+
+ The ISO week and day numbering follows the same logic as
+ :func:`datetime.date.isocalendar`.
+
+ Supported time formats are:
+
+ - ``hh``
+ - ``hh:mm`` or ``hhmm``
+ - ``hh:mm:ss`` or ``hhmmss``
+ - ``hh:mm:ss.ssssss`` (Up to 6 sub-second digits)
+
+ Midnight is a special case for `hh`, as the standard supports both
+ 00:00 and 24:00 as a representation. The decimal separator can be
+ either a dot or a comma.
+
+
+ .. caution::
+
+ Support for fractional components other than seconds is part of the
+ ISO-8601 standard, but is not currently implemented in this parser.
+
+ Supported time zone offset formats are:
+
+ - `Z` (UTC)
+ - `±HH:MM`
+ - `±HHMM`
+ - `±HH`
+
+ Offsets will be represented as :class:`dateutil.tz.tzoffset` objects,
+ with the exception of UTC, which will be represented as
+ :class:`dateutil.tz.tzutc`. Time zone offsets equivalent to UTC (such
+ as `+00:00`) will also be represented as :class:`dateutil.tz.tzutc`.
+
+ :param dt_str:
+ A string or stream containing only an ISO-8601 datetime string
+
+ :return:
+ Returns a :class:`datetime.datetime` representing the string.
+ Unspecified components default to their lowest value.
+
+ .. warning::
+
+ As of version 2.7.0, the strictness of the parser should not be
+ considered a stable part of the contract. Any valid ISO-8601 string
+ that parses correctly with the default settings will continue to
+ parse correctly in future versions, but invalid strings that
+ currently fail (e.g. ``2017-01-01T00:00+00:00:00``) are not
+ guaranteed to continue failing in future versions if they encode
+ a valid date.
+
+ .. versionadded:: 2.7.0
+ """
+ components, pos = self._parse_isodate(dt_str)
+
+ if len(dt_str) > pos:
+ if self._sep is None or dt_str[pos:pos + 1] == self._sep:
+ components += self._parse_isotime(dt_str[pos + 1:])
+ else:
+ raise ValueError('String contains unknown ISO components')
+
+ if len(components) > 3 and components[3] == 24:
+ components[3] = 0
+ return datetime(*components) + timedelta(days=1)
+
+ return datetime(*components)
+
+ @_takes_ascii
+ def parse_isodate(self, datestr):
+ """
+ Parse the date portion of an ISO string.
+
+ :param datestr:
+ The string portion of an ISO string, without a separator
+
+ :return:
+ Returns a :class:`datetime.date` object
+ """
+ components, pos = self._parse_isodate(datestr)
+ if pos < len(datestr):
+ raise ValueError('String contains unknown ISO ' +
+ 'components: {}'.format(datestr))
+ return date(*components)
+
+ @_takes_ascii
+ def parse_isotime(self, timestr):
+ """
+ Parse the time portion of an ISO string.
+
+ :param timestr:
+ The time portion of an ISO string, without a separator
+
+ :return:
+ Returns a :class:`datetime.time` object
+ """
+ components = self._parse_isotime(timestr)
+ if components[0] == 24:
+ components[0] = 0
+ return time(*components)
+
+ @_takes_ascii
+ def parse_tzstr(self, tzstr, zero_as_utc=True):
+ """
+ Parse a valid ISO time zone string.
+
+ See :func:`isoparser.isoparse` for details on supported formats.
+
+ :param tzstr:
+ A string representing an ISO time zone offset
+
+ :param zero_as_utc:
+ Whether to return :class:`dateutil.tz.tzutc` for zero-offset zones
+
+ :return:
+ Returns :class:`dateutil.tz.tzoffset` for offsets and
+ :class:`dateutil.tz.tzutc` for ``Z`` and (if ``zero_as_utc`` is
+ specified) offsets equivalent to UTC.
+ """
+ return self._parse_tzstr(tzstr, zero_as_utc=zero_as_utc)
+
+ # Constants
+ _DATE_SEP = b'-'
+ _TIME_SEP = b':'
+ _FRACTION_REGEX = re.compile(b'[\\.,]([0-9]+)')
+
+ def _parse_isodate(self, dt_str):
+ try:
+ return self._parse_isodate_common(dt_str)
+ except ValueError:
+ return self._parse_isodate_uncommon(dt_str)
+
+ def _parse_isodate_common(self, dt_str):
+ len_str = len(dt_str)
+ components = [1, 1, 1]
+
+ if len_str < 4:
+ raise ValueError('ISO string too short')
+
+ # Year
+ components[0] = int(dt_str[0:4])
+ pos = 4
+ if pos >= len_str:
+ return components, pos
+
+ has_sep = dt_str[pos:pos + 1] == self._DATE_SEP
+ if has_sep:
+ pos += 1
+
+ # Month
+ if len_str - pos < 2:
+ raise ValueError('Invalid common month')
+
+ components[1] = int(dt_str[pos:pos + 2])
+ pos += 2
+
+ if pos >= len_str:
+ if has_sep:
+ return components, pos
+ else:
+ raise ValueError('Invalid ISO format')
+
+ if has_sep:
+ if dt_str[pos:pos + 1] != self._DATE_SEP:
+ raise ValueError('Invalid separator in ISO string')
+ pos += 1
+
+ # Day
+ if len_str - pos < 2:
+ raise ValueError('Invalid common day')
+ components[2] = int(dt_str[pos:pos + 2])
+ return components, pos + 2
+
+ def _parse_isodate_uncommon(self, dt_str):
+ if len(dt_str) < 4:
+ raise ValueError('ISO string too short')
+
+ # All ISO formats start with the year
+ year = int(dt_str[0:4])
+
+ has_sep = dt_str[4:5] == self._DATE_SEP
+
+ pos = 4 + has_sep # Skip '-' if it's there
+ if dt_str[pos:pos + 1] == b'W':
+ # YYYY-?Www-?D?
+ pos += 1
+ weekno = int(dt_str[pos:pos + 2])
+ pos += 2
+
+ dayno = 1
+ if len(dt_str) > pos:
+ if (dt_str[pos:pos + 1] == self._DATE_SEP) != has_sep:
+ raise ValueError('Inconsistent use of dash separator')
+
+ pos += has_sep
+
+ dayno = int(dt_str[pos:pos + 1])
+ pos += 1
+
+ base_date = self._calculate_weekdate(year, weekno, dayno)
+ else:
+ # YYYYDDD or YYYY-DDD
+ if len(dt_str) - pos < 3:
+ raise ValueError('Invalid ordinal day')
+
+ ordinal_day = int(dt_str[pos:pos + 3])
+ pos += 3
+
+ if ordinal_day < 1 or ordinal_day > (365 + calendar.isleap(year)):
+ raise ValueError('Invalid ordinal day' +
+ ' {} for year {}'.format(ordinal_day, year))
+
+ base_date = date(year, 1, 1) + timedelta(days=ordinal_day - 1)
+
+ components = [base_date.year, base_date.month, base_date.day]
+ return components, pos
+
+ def _calculate_weekdate(self, year, week, day):
+ """
+ Calculate the day of corresponding to the ISO year-week-day calendar.
+
+ This function is effectively the inverse of
+ :func:`datetime.date.isocalendar`.
+
+ :param year:
+ The year in the ISO calendar
+
+ :param week:
+ The week in the ISO calendar - range is [1, 53]
+
+ :param day:
+ The day in the ISO calendar - range is [1 (MON), 7 (SUN)]
+
+ :return:
+ Returns a :class:`datetime.date`
+ """
+ if not 0 < week < 54:
+ raise ValueError('Invalid week: {}'.format(week))
+
+ if not 0 < day < 8: # Range is 1-7
+ raise ValueError('Invalid weekday: {}'.format(day))
+
+ # Get week 1 for the specific year:
+ jan_4 = date(year, 1, 4) # Week 1 always has January 4th in it
+ week_1 = jan_4 - timedelta(days=jan_4.isocalendar()[2] - 1)
+
+ # Now add the specific number of weeks and days to get what we want
+ week_offset = (week - 1) * 7 + (day - 1)
+ return week_1 + timedelta(days=week_offset)
+
+ def _parse_isotime(self, timestr):
+ len_str = len(timestr)
+ components = [0, 0, 0, 0, None]
+ pos = 0
+ comp = -1
+
+ if len(timestr) < 2:
+ raise ValueError('ISO time too short')
+
+ has_sep = len_str >= 3 and timestr[2:3] == self._TIME_SEP
+
+ while pos < len_str and comp < 5:
+ comp += 1
+
+ if timestr[pos:pos + 1] in b'-+Zz':
+ # Detect time zone boundary
+ components[-1] = self._parse_tzstr(timestr[pos:])
+ pos = len_str
+ break
+
+ if comp < 3:
+ # Hour, minute, second
+ components[comp] = int(timestr[pos:pos + 2])
+ pos += 2
+ if (has_sep and pos < len_str and
+ timestr[pos:pos + 1] == self._TIME_SEP):
+ pos += 1
+
+ if comp == 3:
+ # Fraction of a second
+ frac = self._FRACTION_REGEX.match(timestr[pos:])
+ if not frac:
+ continue
+
+ us_str = frac.group(1)[:6] # Truncate to microseconds
+ components[comp] = int(us_str) * 10**(6 - len(us_str))
+ pos += len(frac.group())
+
+ if pos < len_str:
+ raise ValueError('Unused components in ISO string')
+
+ if components[0] == 24:
+ # Standard supports 00:00 and 24:00 as representations of midnight
+ if any(component != 0 for component in components[1:4]):
+ raise ValueError('Hour may only be 24 at 24:00:00.000')
+
+ return components
+
+ def _parse_tzstr(self, tzstr, zero_as_utc=True):
+ if tzstr == b'Z' or tzstr == b'z':
+ return tz.UTC
+
+ if len(tzstr) not in {3, 5, 6}:
+ raise ValueError('Time zone offset must be 1, 3, 5 or 6 characters')
+
+ if tzstr[0:1] == b'-':
+ mult = -1
+ elif tzstr[0:1] == b'+':
+ mult = 1
+ else:
+ raise ValueError('Time zone offset requires sign')
+
+ hours = int(tzstr[1:3])
+ if len(tzstr) == 3:
+ minutes = 0
+ else:
+ minutes = int(tzstr[(4 if tzstr[3:4] == self._TIME_SEP else 3):])
+
+ if zero_as_utc and hours == 0 and minutes == 0:
+ return tz.UTC
+ else:
+ if minutes > 59:
+ raise ValueError('Invalid minutes in time zone offset')
+
+ if hours > 23:
+ raise ValueError('Invalid hours in time zone offset')
+
+ return tz.tzoffset(None, mult * (hours * 60 + minutes) * 60)
+
+
+DEFAULT_ISOPARSER = isoparser()
+isoparse = DEFAULT_ISOPARSER.isoparse
diff --git a/venv/Lib/site-packages/dateutil/relativedelta.py b/venv/Lib/site-packages/dateutil/relativedelta.py
new file mode 100644
index 0000000..a9e85f7
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/relativedelta.py
@@ -0,0 +1,599 @@
+# -*- coding: utf-8 -*-
+import datetime
+import calendar
+
+import operator
+from math import copysign
+
+from six import integer_types
+from warnings import warn
+
+from ._common import weekday
+
+MO, TU, WE, TH, FR, SA, SU = weekdays = tuple(weekday(x) for x in range(7))
+
+__all__ = ["relativedelta", "MO", "TU", "WE", "TH", "FR", "SA", "SU"]
+
+
+class relativedelta(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:
+
+ 1. Year
+ 2. Month
+ 3. Day
+ 4. Hours
+ 5. Minutes
+ 6. Seconds
+ 7. 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.
+
+ """
+
+ def __init__(self, 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):
+
+ if dt1 and dt2:
+ # datetime is a subclass of date. So both must be date
+ if not (isinstance(dt1, datetime.date) and
+ isinstance(dt2, datetime.date)):
+ raise TypeError("relativedelta only diffs datetime/date")
+
+ # We allow two dates, or two datetimes, so we coerce them to be
+ # of the same type
+ if (isinstance(dt1, datetime.datetime) !=
+ isinstance(dt2, datetime.datetime)):
+ if not isinstance(dt1, datetime.datetime):
+ dt1 = datetime.datetime.fromordinal(dt1.toordinal())
+ elif not isinstance(dt2, datetime.datetime):
+ dt2 = datetime.datetime.fromordinal(dt2.toordinal())
+
+ self.years = 0
+ self.months = 0
+ self.days = 0
+ self.leapdays = 0
+ self.hours = 0
+ self.minutes = 0
+ self.seconds = 0
+ self.microseconds = 0
+ self.year = None
+ self.month = None
+ self.day = None
+ self.weekday = None
+ self.hour = None
+ self.minute = None
+ self.second = None
+ self.microsecond = None
+ self._has_time = 0
+
+ # Get year / month delta between the two
+ months = (dt1.year - dt2.year) * 12 + (dt1.month - dt2.month)
+ self._set_months(months)
+
+ # Remove the year/month delta so the timedelta is just well-defined
+ # time units (seconds, days and microseconds)
+ dtm = self.__radd__(dt2)
+
+ # If we've overshot our target, make an adjustment
+ if dt1 < dt2:
+ compare = operator.gt
+ increment = 1
+ else:
+ compare = operator.lt
+ increment = -1
+
+ while compare(dt1, dtm):
+ months += increment
+ self._set_months(months)
+ dtm = self.__radd__(dt2)
+
+ # Get the timedelta between the "months-adjusted" date and dt1
+ delta = dt1 - dtm
+ self.seconds = delta.seconds + delta.days * 86400
+ self.microseconds = delta.microseconds
+ else:
+ # Check for non-integer values in integer-only quantities
+ if any(x is not None and x != int(x) for x in (years, months)):
+ raise ValueError("Non-integer years and months are "
+ "ambiguous and not currently supported.")
+
+ # Relative information
+ self.years = int(years)
+ self.months = int(months)
+ self.days = days + weeks * 7
+ self.leapdays = leapdays
+ self.hours = hours
+ self.minutes = minutes
+ self.seconds = seconds
+ self.microseconds = microseconds
+
+ # Absolute information
+ self.year = year
+ self.month = month
+ self.day = day
+ self.hour = hour
+ self.minute = minute
+ self.second = second
+ self.microsecond = microsecond
+
+ if any(x is not None and int(x) != x
+ for x in (year, month, day, hour,
+ minute, second, microsecond)):
+ # For now we'll deprecate floats - later it'll be an error.
+ warn("Non-integer value passed as absolute information. " +
+ "This is not a well-defined condition and will raise " +
+ "errors in future versions.", DeprecationWarning)
+
+ if isinstance(weekday, integer_types):
+ self.weekday = weekdays[weekday]
+ else:
+ self.weekday = weekday
+
+ yday = 0
+ if nlyearday:
+ yday = nlyearday
+ elif yearday:
+ yday = yearday
+ if yearday > 59:
+ self.leapdays = -1
+ if yday:
+ ydayidx = [31, 59, 90, 120, 151, 181, 212,
+ 243, 273, 304, 334, 366]
+ for idx, ydays in enumerate(ydayidx):
+ if yday <= ydays:
+ self.month = idx+1
+ if idx == 0:
+ self.day = yday
+ else:
+ self.day = yday-ydayidx[idx-1]
+ break
+ else:
+ raise ValueError("invalid year day (%d)" % yday)
+
+ self._fix()
+
+ def _fix(self):
+ if abs(self.microseconds) > 999999:
+ s = _sign(self.microseconds)
+ div, mod = divmod(self.microseconds * s, 1000000)
+ self.microseconds = mod * s
+ self.seconds += div * s
+ if abs(self.seconds) > 59:
+ s = _sign(self.seconds)
+ div, mod = divmod(self.seconds * s, 60)
+ self.seconds = mod * s
+ self.minutes += div * s
+ if abs(self.minutes) > 59:
+ s = _sign(self.minutes)
+ div, mod = divmod(self.minutes * s, 60)
+ self.minutes = mod * s
+ self.hours += div * s
+ if abs(self.hours) > 23:
+ s = _sign(self.hours)
+ div, mod = divmod(self.hours * s, 24)
+ self.hours = mod * s
+ self.days += div * s
+ if abs(self.months) > 11:
+ s = _sign(self.months)
+ div, mod = divmod(self.months * s, 12)
+ self.months = mod * s
+ self.years += div * s
+ if (self.hours or self.minutes or self.seconds or self.microseconds
+ or self.hour is not None or self.minute is not None or
+ self.second is not None or self.microsecond is not None):
+ self._has_time = 1
+ else:
+ self._has_time = 0
+
+ @property
+ def weeks(self):
+ return int(self.days / 7.0)
+
+ @weeks.setter
+ def weeks(self, value):
+ self.days = self.days - (self.weeks * 7) + value * 7
+
+ def _set_months(self, months):
+ self.months = months
+ if abs(self.months) > 11:
+ s = _sign(self.months)
+ div, mod = divmod(self.months * s, 12)
+ self.months = mod * s
+ self.years = div * s
+ else:
+ self.years = 0
+
+ def normalized(self):
+ """
+ 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)
+
+ :return:
+ Returns a :class:`dateutil.relativedelta.relativedelta` object.
+ """
+ # Cascade remainders down (rounding each to roughly nearest microsecond)
+ days = int(self.days)
+
+ hours_f = round(self.hours + 24 * (self.days - days), 11)
+ hours = int(hours_f)
+
+ minutes_f = round(self.minutes + 60 * (hours_f - hours), 10)
+ minutes = int(minutes_f)
+
+ seconds_f = round(self.seconds + 60 * (minutes_f - minutes), 8)
+ seconds = int(seconds_f)
+
+ microseconds = round(self.microseconds + 1e6 * (seconds_f - seconds))
+
+ # Constructor carries overflow back up with call to _fix()
+ return self.__class__(years=self.years, months=self.months,
+ days=days, hours=hours, minutes=minutes,
+ seconds=seconds, microseconds=microseconds,
+ leapdays=self.leapdays, year=self.year,
+ month=self.month, day=self.day,
+ weekday=self.weekday, hour=self.hour,
+ minute=self.minute, second=self.second,
+ microsecond=self.microsecond)
+
+ def __add__(self, other):
+ if isinstance(other, relativedelta):
+ return self.__class__(years=other.years + self.years,
+ months=other.months + self.months,
+ days=other.days + self.days,
+ hours=other.hours + self.hours,
+ minutes=other.minutes + self.minutes,
+ seconds=other.seconds + self.seconds,
+ microseconds=(other.microseconds +
+ self.microseconds),
+ leapdays=other.leapdays or self.leapdays,
+ year=(other.year if other.year is not None
+ else self.year),
+ month=(other.month if other.month is not None
+ else self.month),
+ day=(other.day if other.day is not None
+ else self.day),
+ weekday=(other.weekday if other.weekday is not None
+ else self.weekday),
+ hour=(other.hour if other.hour is not None
+ else self.hour),
+ minute=(other.minute if other.minute is not None
+ else self.minute),
+ second=(other.second if other.second is not None
+ else self.second),
+ microsecond=(other.microsecond if other.microsecond
+ is not None else
+ self.microsecond))
+ if isinstance(other, datetime.timedelta):
+ return self.__class__(years=self.years,
+ months=self.months,
+ days=self.days + other.days,
+ hours=self.hours,
+ minutes=self.minutes,
+ seconds=self.seconds + other.seconds,
+ microseconds=self.microseconds + other.microseconds,
+ leapdays=self.leapdays,
+ year=self.year,
+ month=self.month,
+ day=self.day,
+ weekday=self.weekday,
+ hour=self.hour,
+ minute=self.minute,
+ second=self.second,
+ microsecond=self.microsecond)
+ if not isinstance(other, datetime.date):
+ return NotImplemented
+ elif self._has_time and not isinstance(other, datetime.datetime):
+ other = datetime.datetime.fromordinal(other.toordinal())
+ year = (self.year or other.year)+self.years
+ month = self.month or other.month
+ if self.months:
+ assert 1 <= abs(self.months) <= 12
+ month += self.months
+ if month > 12:
+ year += 1
+ month -= 12
+ elif month < 1:
+ year -= 1
+ month += 12
+ day = min(calendar.monthrange(year, month)[1],
+ self.day or other.day)
+ repl = {"year": year, "month": month, "day": day}
+ for attr in ["hour", "minute", "second", "microsecond"]:
+ value = getattr(self, attr)
+ if value is not None:
+ repl[attr] = value
+ days = self.days
+ if self.leapdays and month > 2 and calendar.isleap(year):
+ days += self.leapdays
+ ret = (other.replace(**repl)
+ + datetime.timedelta(days=days,
+ hours=self.hours,
+ minutes=self.minutes,
+ seconds=self.seconds,
+ microseconds=self.microseconds))
+ if self.weekday:
+ weekday, nth = self.weekday.weekday, self.weekday.n or 1
+ jumpdays = (abs(nth) - 1) * 7
+ if nth > 0:
+ jumpdays += (7 - ret.weekday() + weekday) % 7
+ else:
+ jumpdays += (ret.weekday() - weekday) % 7
+ jumpdays *= -1
+ ret += datetime.timedelta(days=jumpdays)
+ return ret
+
+ def __radd__(self, other):
+ return self.__add__(other)
+
+ def __rsub__(self, other):
+ return self.__neg__().__radd__(other)
+
+ def __sub__(self, other):
+ if not isinstance(other, relativedelta):
+ return NotImplemented # In case the other object defines __rsub__
+ return self.__class__(years=self.years - other.years,
+ months=self.months - other.months,
+ days=self.days - other.days,
+ hours=self.hours - other.hours,
+ minutes=self.minutes - other.minutes,
+ seconds=self.seconds - other.seconds,
+ microseconds=self.microseconds - other.microseconds,
+ leapdays=self.leapdays or other.leapdays,
+ year=(self.year if self.year is not None
+ else other.year),
+ month=(self.month if self.month is not None else
+ other.month),
+ day=(self.day if self.day is not None else
+ other.day),
+ weekday=(self.weekday if self.weekday is not None else
+ other.weekday),
+ hour=(self.hour if self.hour is not None else
+ other.hour),
+ minute=(self.minute if self.minute is not None else
+ other.minute),
+ second=(self.second if self.second is not None else
+ other.second),
+ microsecond=(self.microsecond if self.microsecond
+ is not None else
+ other.microsecond))
+
+ def __abs__(self):
+ return self.__class__(years=abs(self.years),
+ months=abs(self.months),
+ days=abs(self.days),
+ hours=abs(self.hours),
+ minutes=abs(self.minutes),
+ seconds=abs(self.seconds),
+ microseconds=abs(self.microseconds),
+ leapdays=self.leapdays,
+ year=self.year,
+ month=self.month,
+ day=self.day,
+ weekday=self.weekday,
+ hour=self.hour,
+ minute=self.minute,
+ second=self.second,
+ microsecond=self.microsecond)
+
+ def __neg__(self):
+ return self.__class__(years=-self.years,
+ months=-self.months,
+ days=-self.days,
+ hours=-self.hours,
+ minutes=-self.minutes,
+ seconds=-self.seconds,
+ microseconds=-self.microseconds,
+ leapdays=self.leapdays,
+ year=self.year,
+ month=self.month,
+ day=self.day,
+ weekday=self.weekday,
+ hour=self.hour,
+ minute=self.minute,
+ second=self.second,
+ microsecond=self.microsecond)
+
+ def __bool__(self):
+ return not (not self.years and
+ not self.months and
+ not self.days and
+ not self.hours and
+ not self.minutes and
+ not self.seconds and
+ not self.microseconds and
+ not self.leapdays and
+ self.year is None and
+ self.month is None and
+ self.day is None and
+ self.weekday is None and
+ self.hour is None and
+ self.minute is None and
+ self.second is None and
+ self.microsecond is None)
+ # Compatibility with Python 2.x
+ __nonzero__ = __bool__
+
+ def __mul__(self, other):
+ try:
+ f = float(other)
+ except TypeError:
+ return NotImplemented
+
+ return self.__class__(years=int(self.years * f),
+ months=int(self.months * f),
+ days=int(self.days * f),
+ hours=int(self.hours * f),
+ minutes=int(self.minutes * f),
+ seconds=int(self.seconds * f),
+ microseconds=int(self.microseconds * f),
+ leapdays=self.leapdays,
+ year=self.year,
+ month=self.month,
+ day=self.day,
+ weekday=self.weekday,
+ hour=self.hour,
+ minute=self.minute,
+ second=self.second,
+ microsecond=self.microsecond)
+
+ __rmul__ = __mul__
+
+ def __eq__(self, other):
+ if not isinstance(other, relativedelta):
+ return NotImplemented
+ if self.weekday or other.weekday:
+ if not self.weekday or not other.weekday:
+ return False
+ if self.weekday.weekday != other.weekday.weekday:
+ return False
+ n1, n2 = self.weekday.n, other.weekday.n
+ if n1 != n2 and not ((not n1 or n1 == 1) and (not n2 or n2 == 1)):
+ return False
+ return (self.years == other.years and
+ self.months == other.months and
+ self.days == other.days and
+ self.hours == other.hours and
+ self.minutes == other.minutes and
+ self.seconds == other.seconds and
+ self.microseconds == other.microseconds and
+ self.leapdays == other.leapdays and
+ self.year == other.year and
+ self.month == other.month and
+ self.day == other.day and
+ self.hour == other.hour and
+ self.minute == other.minute and
+ self.second == other.second and
+ self.microsecond == other.microsecond)
+
+ def __hash__(self):
+ return hash((
+ self.weekday,
+ self.years,
+ self.months,
+ self.days,
+ self.hours,
+ self.minutes,
+ self.seconds,
+ self.microseconds,
+ self.leapdays,
+ self.year,
+ self.month,
+ self.day,
+ self.hour,
+ self.minute,
+ self.second,
+ self.microsecond,
+ ))
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+ def __div__(self, other):
+ try:
+ reciprocal = 1 / float(other)
+ except TypeError:
+ return NotImplemented
+
+ return self.__mul__(reciprocal)
+
+ __truediv__ = __div__
+
+ def __repr__(self):
+ l = []
+ for attr in ["years", "months", "days", "leapdays",
+ "hours", "minutes", "seconds", "microseconds"]:
+ value = getattr(self, attr)
+ if value:
+ l.append("{attr}={value:+g}".format(attr=attr, value=value))
+ for attr in ["year", "month", "day", "weekday",
+ "hour", "minute", "second", "microsecond"]:
+ value = getattr(self, attr)
+ if value is not None:
+ l.append("{attr}={value}".format(attr=attr, value=repr(value)))
+ return "{classname}({attrs})".format(classname=self.__class__.__name__,
+ attrs=", ".join(l))
+
+
+def _sign(x):
+ return int(copysign(1, x))
+
+# vim:ts=4:sw=4:et
diff --git a/venv/Lib/site-packages/dateutil/rrule.py b/venv/Lib/site-packages/dateutil/rrule.py
new file mode 100644
index 0000000..6bf0ea9
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/rrule.py
@@ -0,0 +1,1735 @@
+# -*- coding: utf-8 -*-
+"""
+The rrule module offers a small, complete, and very fast, implementation of
+the recurrence rules documented in the
+`iCalendar RFC `_,
+including support for caching of results.
+"""
+import itertools
+import datetime
+import calendar
+import re
+import sys
+
+try:
+ from math import gcd
+except ImportError:
+ from fractions import gcd
+
+from six import advance_iterator, integer_types
+from six.moves import _thread, range
+import heapq
+
+from ._common import weekday as weekdaybase
+
+# For warning about deprecation of until and count
+from warnings import warn
+
+__all__ = ["rrule", "rruleset", "rrulestr",
+ "YEARLY", "MONTHLY", "WEEKLY", "DAILY",
+ "HOURLY", "MINUTELY", "SECONDLY",
+ "MO", "TU", "WE", "TH", "FR", "SA", "SU"]
+
+# Every mask is 7 days longer to handle cross-year weekly periods.
+M366MASK = tuple([1]*31+[2]*29+[3]*31+[4]*30+[5]*31+[6]*30 +
+ [7]*31+[8]*31+[9]*30+[10]*31+[11]*30+[12]*31+[1]*7)
+M365MASK = list(M366MASK)
+M29, M30, M31 = list(range(1, 30)), list(range(1, 31)), list(range(1, 32))
+MDAY366MASK = tuple(M31+M29+M31+M30+M31+M30+M31+M31+M30+M31+M30+M31+M31[:7])
+MDAY365MASK = list(MDAY366MASK)
+M29, M30, M31 = list(range(-29, 0)), list(range(-30, 0)), list(range(-31, 0))
+NMDAY366MASK = tuple(M31+M29+M31+M30+M31+M30+M31+M31+M30+M31+M30+M31+M31[:7])
+NMDAY365MASK = list(NMDAY366MASK)
+M366RANGE = (0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366)
+M365RANGE = (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365)
+WDAYMASK = [0, 1, 2, 3, 4, 5, 6]*55
+del M29, M30, M31, M365MASK[59], MDAY365MASK[59], NMDAY365MASK[31]
+MDAY365MASK = tuple(MDAY365MASK)
+M365MASK = tuple(M365MASK)
+
+FREQNAMES = ['YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY', 'HOURLY', 'MINUTELY', 'SECONDLY']
+
+(YEARLY,
+ MONTHLY,
+ WEEKLY,
+ DAILY,
+ HOURLY,
+ MINUTELY,
+ SECONDLY) = list(range(7))
+
+# Imported on demand.
+easter = None
+parser = None
+
+
+class weekday(weekdaybase):
+ """
+ This version of weekday does not allow n = 0.
+ """
+ def __init__(self, wkday, n=None):
+ if n == 0:
+ raise ValueError("Can't create weekday with n==0")
+
+ super(weekday, self).__init__(wkday, n)
+
+
+MO, TU, WE, TH, FR, SA, SU = weekdays = tuple(weekday(x) for x in range(7))
+
+
+def _invalidates_cache(f):
+ """
+ Decorator for rruleset methods which may invalidate the
+ cached length.
+ """
+ def inner_func(self, *args, **kwargs):
+ rv = f(self, *args, **kwargs)
+ self._invalidate_cache()
+ return rv
+
+ return inner_func
+
+
+class rrulebase(object):
+ def __init__(self, cache=False):
+ if cache:
+ self._cache = []
+ self._cache_lock = _thread.allocate_lock()
+ self._invalidate_cache()
+ else:
+ self._cache = None
+ self._cache_complete = False
+ self._len = None
+
+ def __iter__(self):
+ if self._cache_complete:
+ return iter(self._cache)
+ elif self._cache is None:
+ return self._iter()
+ else:
+ return self._iter_cached()
+
+ def _invalidate_cache(self):
+ if self._cache is not None:
+ self._cache = []
+ self._cache_complete = False
+ self._cache_gen = self._iter()
+
+ if self._cache_lock.locked():
+ self._cache_lock.release()
+
+ self._len = None
+
+ def _iter_cached(self):
+ i = 0
+ gen = self._cache_gen
+ cache = self._cache
+ acquire = self._cache_lock.acquire
+ release = self._cache_lock.release
+ while gen:
+ if i == len(cache):
+ acquire()
+ if self._cache_complete:
+ break
+ try:
+ for j in range(10):
+ cache.append(advance_iterator(gen))
+ except StopIteration:
+ self._cache_gen = gen = None
+ self._cache_complete = True
+ break
+ release()
+ yield cache[i]
+ i += 1
+ while i < self._len:
+ yield cache[i]
+ i += 1
+
+ def __getitem__(self, item):
+ if self._cache_complete:
+ return self._cache[item]
+ elif isinstance(item, slice):
+ if item.step and item.step < 0:
+ return list(iter(self))[item]
+ else:
+ return list(itertools.islice(self,
+ item.start or 0,
+ item.stop or sys.maxsize,
+ item.step or 1))
+ elif item >= 0:
+ gen = iter(self)
+ try:
+ for i in range(item+1):
+ res = advance_iterator(gen)
+ except StopIteration:
+ raise IndexError
+ return res
+ else:
+ return list(iter(self))[item]
+
+ def __contains__(self, item):
+ if self._cache_complete:
+ return item in self._cache
+ else:
+ for i in self:
+ if i == item:
+ return True
+ elif i > item:
+ return False
+ return False
+
+ # __len__() introduces a large performance penalty.
+ def count(self):
+ """ Returns the number of recurrences in this set. It will have go
+ trough the whole recurrence, if this hasn't been done before. """
+ if self._len is None:
+ for x in self:
+ pass
+ return self._len
+
+ def before(self, dt, inc=False):
+ """ Returns the last recurrence before the given datetime instance. The
+ inc keyword defines what happens if dt is an occurrence. With
+ inc=True, if dt itself is an occurrence, it will be returned. """
+ if self._cache_complete:
+ gen = self._cache
+ else:
+ gen = self
+ last = None
+ if inc:
+ for i in gen:
+ if i > dt:
+ break
+ last = i
+ else:
+ for i in gen:
+ if i >= dt:
+ break
+ last = i
+ return last
+
+ def after(self, dt, inc=False):
+ """ Returns the first recurrence after the given datetime instance. The
+ inc keyword defines what happens if dt is an occurrence. With
+ inc=True, if dt itself is an occurrence, it will be returned. """
+ if self._cache_complete:
+ gen = self._cache
+ else:
+ gen = self
+ if inc:
+ for i in gen:
+ if i >= dt:
+ return i
+ else:
+ for i in gen:
+ if i > dt:
+ return i
+ return None
+
+ def xafter(self, dt, count=None, inc=False):
+ """
+ Generator which yields up to `count` recurrences after the given
+ datetime instance, equivalent to `after`.
+
+ :param dt:
+ The datetime at which to start generating recurrences.
+
+ :param count:
+ The maximum number of recurrences to generate. If `None` (default),
+ dates are generated until the recurrence rule is exhausted.
+
+ :param inc:
+ If `dt` is an instance of the rule and `inc` is `True`, it is
+ included in the output.
+
+ :yields: Yields a sequence of `datetime` objects.
+ """
+
+ if self._cache_complete:
+ gen = self._cache
+ else:
+ gen = self
+
+ # Select the comparison function
+ if inc:
+ comp = lambda dc, dtc: dc >= dtc
+ else:
+ comp = lambda dc, dtc: dc > dtc
+
+ # Generate dates
+ n = 0
+ for d in gen:
+ if comp(d, dt):
+ if count is not None:
+ n += 1
+ if n > count:
+ break
+
+ yield d
+
+ def between(self, after, before, inc=False, count=1):
+ """ Returns all the occurrences of the rrule between after and before.
+ The inc keyword defines what happens if after and/or before are
+ themselves occurrences. With inc=True, they will be included in the
+ list, if they are found in the recurrence set. """
+ if self._cache_complete:
+ gen = self._cache
+ else:
+ gen = self
+ started = False
+ l = []
+ if inc:
+ for i in gen:
+ if i > before:
+ break
+ elif not started:
+ if i >= after:
+ started = True
+ l.append(i)
+ else:
+ l.append(i)
+ else:
+ for i in gen:
+ if i >= before:
+ break
+ elif not started:
+ if i > after:
+ started = True
+ l.append(i)
+ else:
+ l.append(i)
+ return l
+
+
+class 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))
+ ... # doctest: +NORMALIZE_WHITESPACE
+ [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:
+
+ :param 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.
+ :param 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.
+ :param 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().
+ :param 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``.
+ :param 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``.
+ :param 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.
+ :param bymonth:
+ If given, it must be either an integer, or a sequence of integers,
+ meaning the months to apply the recurrence to.
+ :param bymonthday:
+ If given, it must be either an integer, or a sequence of integers,
+ meaning the month days to apply the recurrence to.
+ :param byyearday:
+ If given, it must be either an integer, or a sequence of integers,
+ meaning the year days to apply the recurrence to.
+ :param 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.
+ :param 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.
+ :param 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.
+ :param byhour:
+ If given, it must be either an integer, or a sequence of integers,
+ meaning the hours to apply the recurrence to.
+ :param byminute:
+ If given, it must be either an integer, or a sequence of integers,
+ meaning the minutes to apply the recurrence to.
+ :param bysecond:
+ If given, it must be either an integer, or a sequence of integers,
+ meaning the seconds to apply the recurrence to.
+ :param 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.
+ """
+ def __init__(self, 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):
+ super(rrule, self).__init__(cache)
+ global easter
+ if not dtstart:
+ if until and until.tzinfo:
+ dtstart = datetime.datetime.now(tz=until.tzinfo).replace(microsecond=0)
+ else:
+ dtstart = datetime.datetime.now().replace(microsecond=0)
+ elif not isinstance(dtstart, datetime.datetime):
+ dtstart = datetime.datetime.fromordinal(dtstart.toordinal())
+ else:
+ dtstart = dtstart.replace(microsecond=0)
+ self._dtstart = dtstart
+ self._tzinfo = dtstart.tzinfo
+ self._freq = freq
+ self._interval = interval
+ self._count = count
+
+ # Cache the original byxxx rules, if they are provided, as the _byxxx
+ # attributes do not necessarily map to the inputs, and this can be
+ # a problem in generating the strings. Only store things if they've
+ # been supplied (the string retrieval will just use .get())
+ self._original_rule = {}
+
+ if until and not isinstance(until, datetime.datetime):
+ until = datetime.datetime.fromordinal(until.toordinal())
+ self._until = until
+
+ if self._dtstart and self._until:
+ if (self._dtstart.tzinfo is not None) != (self._until.tzinfo is not None):
+ # According to RFC5545 Section 3.3.10:
+ # https://tools.ietf.org/html/rfc5545#section-3.3.10
+ #
+ # > If the "DTSTART" property is specified as a date with UTC
+ # > time or a date with local time and time zone reference,
+ # > then the UNTIL rule part MUST be specified as a date with
+ # > UTC time.
+ raise ValueError(
+ 'RRULE UNTIL values must be specified in UTC when DTSTART '
+ 'is timezone-aware'
+ )
+
+ if count is not None and until:
+ warn("Using both 'count' and 'until' is inconsistent with RFC 5545"
+ " and has been deprecated in dateutil. Future versions will "
+ "raise an error.", DeprecationWarning)
+
+ if wkst is None:
+ self._wkst = calendar.firstweekday()
+ elif isinstance(wkst, integer_types):
+ self._wkst = wkst
+ else:
+ self._wkst = wkst.weekday
+
+ if bysetpos is None:
+ self._bysetpos = None
+ elif isinstance(bysetpos, integer_types):
+ if bysetpos == 0 or not (-366 <= bysetpos <= 366):
+ raise ValueError("bysetpos must be between 1 and 366, "
+ "or between -366 and -1")
+ self._bysetpos = (bysetpos,)
+ else:
+ self._bysetpos = tuple(bysetpos)
+ for pos in self._bysetpos:
+ if pos == 0 or not (-366 <= pos <= 366):
+ raise ValueError("bysetpos must be between 1 and 366, "
+ "or between -366 and -1")
+
+ if self._bysetpos:
+ self._original_rule['bysetpos'] = self._bysetpos
+
+ if (byweekno is None and byyearday is None and bymonthday is None and
+ byweekday is None and byeaster is None):
+ if freq == YEARLY:
+ if bymonth is None:
+ bymonth = dtstart.month
+ self._original_rule['bymonth'] = None
+ bymonthday = dtstart.day
+ self._original_rule['bymonthday'] = None
+ elif freq == MONTHLY:
+ bymonthday = dtstart.day
+ self._original_rule['bymonthday'] = None
+ elif freq == WEEKLY:
+ byweekday = dtstart.weekday()
+ self._original_rule['byweekday'] = None
+
+ # bymonth
+ if bymonth is None:
+ self._bymonth = None
+ else:
+ if isinstance(bymonth, integer_types):
+ bymonth = (bymonth,)
+
+ self._bymonth = tuple(sorted(set(bymonth)))
+
+ if 'bymonth' not in self._original_rule:
+ self._original_rule['bymonth'] = self._bymonth
+
+ # byyearday
+ if byyearday is None:
+ self._byyearday = None
+ else:
+ if isinstance(byyearday, integer_types):
+ byyearday = (byyearday,)
+
+ self._byyearday = tuple(sorted(set(byyearday)))
+ self._original_rule['byyearday'] = self._byyearday
+
+ # byeaster
+ if byeaster is not None:
+ if not easter:
+ from dateutil import easter
+ if isinstance(byeaster, integer_types):
+ self._byeaster = (byeaster,)
+ else:
+ self._byeaster = tuple(sorted(byeaster))
+
+ self._original_rule['byeaster'] = self._byeaster
+ else:
+ self._byeaster = None
+
+ # bymonthday
+ if bymonthday is None:
+ self._bymonthday = ()
+ self._bynmonthday = ()
+ else:
+ if isinstance(bymonthday, integer_types):
+ bymonthday = (bymonthday,)
+
+ bymonthday = set(bymonthday) # Ensure it's unique
+
+ self._bymonthday = tuple(sorted(x for x in bymonthday if x > 0))
+ self._bynmonthday = tuple(sorted(x for x in bymonthday if x < 0))
+
+ # Storing positive numbers first, then negative numbers
+ if 'bymonthday' not in self._original_rule:
+ self._original_rule['bymonthday'] = tuple(
+ itertools.chain(self._bymonthday, self._bynmonthday))
+
+ # byweekno
+ if byweekno is None:
+ self._byweekno = None
+ else:
+ if isinstance(byweekno, integer_types):
+ byweekno = (byweekno,)
+
+ self._byweekno = tuple(sorted(set(byweekno)))
+
+ self._original_rule['byweekno'] = self._byweekno
+
+ # byweekday / bynweekday
+ if byweekday is None:
+ self._byweekday = None
+ self._bynweekday = None
+ else:
+ # If it's one of the valid non-sequence types, convert to a
+ # single-element sequence before the iterator that builds the
+ # byweekday set.
+ if isinstance(byweekday, integer_types) or hasattr(byweekday, "n"):
+ byweekday = (byweekday,)
+
+ self._byweekday = set()
+ self._bynweekday = set()
+ for wday in byweekday:
+ if isinstance(wday, integer_types):
+ self._byweekday.add(wday)
+ elif not wday.n or freq > MONTHLY:
+ self._byweekday.add(wday.weekday)
+ else:
+ self._bynweekday.add((wday.weekday, wday.n))
+
+ if not self._byweekday:
+ self._byweekday = None
+ elif not self._bynweekday:
+ self._bynweekday = None
+
+ if self._byweekday is not None:
+ self._byweekday = tuple(sorted(self._byweekday))
+ orig_byweekday = [weekday(x) for x in self._byweekday]
+ else:
+ orig_byweekday = ()
+
+ if self._bynweekday is not None:
+ self._bynweekday = tuple(sorted(self._bynweekday))
+ orig_bynweekday = [weekday(*x) for x in self._bynweekday]
+ else:
+ orig_bynweekday = ()
+
+ if 'byweekday' not in self._original_rule:
+ self._original_rule['byweekday'] = tuple(itertools.chain(
+ orig_byweekday, orig_bynweekday))
+
+ # byhour
+ if byhour is None:
+ if freq < HOURLY:
+ self._byhour = {dtstart.hour}
+ else:
+ self._byhour = None
+ else:
+ if isinstance(byhour, integer_types):
+ byhour = (byhour,)
+
+ if freq == HOURLY:
+ self._byhour = self.__construct_byset(start=dtstart.hour,
+ byxxx=byhour,
+ base=24)
+ else:
+ self._byhour = set(byhour)
+
+ self._byhour = tuple(sorted(self._byhour))
+ self._original_rule['byhour'] = self._byhour
+
+ # byminute
+ if byminute is None:
+ if freq < MINUTELY:
+ self._byminute = {dtstart.minute}
+ else:
+ self._byminute = None
+ else:
+ if isinstance(byminute, integer_types):
+ byminute = (byminute,)
+
+ if freq == MINUTELY:
+ self._byminute = self.__construct_byset(start=dtstart.minute,
+ byxxx=byminute,
+ base=60)
+ else:
+ self._byminute = set(byminute)
+
+ self._byminute = tuple(sorted(self._byminute))
+ self._original_rule['byminute'] = self._byminute
+
+ # bysecond
+ if bysecond is None:
+ if freq < SECONDLY:
+ self._bysecond = ((dtstart.second,))
+ else:
+ self._bysecond = None
+ else:
+ if isinstance(bysecond, integer_types):
+ bysecond = (bysecond,)
+
+ self._bysecond = set(bysecond)
+
+ if freq == SECONDLY:
+ self._bysecond = self.__construct_byset(start=dtstart.second,
+ byxxx=bysecond,
+ base=60)
+ else:
+ self._bysecond = set(bysecond)
+
+ self._bysecond = tuple(sorted(self._bysecond))
+ self._original_rule['bysecond'] = self._bysecond
+
+ if self._freq >= HOURLY:
+ self._timeset = None
+ else:
+ self._timeset = []
+ for hour in self._byhour:
+ for minute in self._byminute:
+ for second in self._bysecond:
+ self._timeset.append(
+ datetime.time(hour, minute, second,
+ tzinfo=self._tzinfo))
+ self._timeset.sort()
+ self._timeset = tuple(self._timeset)
+
+ def __str__(self):
+ """
+ Output a string that would generate this RRULE if passed to rrulestr.
+ This is mostly compatible with RFC5545, except for the
+ dateutil-specific extension BYEASTER.
+ """
+
+ output = []
+ h, m, s = [None] * 3
+ if self._dtstart:
+ output.append(self._dtstart.strftime('DTSTART:%Y%m%dT%H%M%S'))
+ h, m, s = self._dtstart.timetuple()[3:6]
+
+ parts = ['FREQ=' + FREQNAMES[self._freq]]
+ if self._interval != 1:
+ parts.append('INTERVAL=' + str(self._interval))
+
+ if self._wkst:
+ parts.append('WKST=' + repr(weekday(self._wkst))[0:2])
+
+ if self._count is not None:
+ parts.append('COUNT=' + str(self._count))
+
+ if self._until:
+ parts.append(self._until.strftime('UNTIL=%Y%m%dT%H%M%S'))
+
+ if self._original_rule.get('byweekday') is not None:
+ # The str() method on weekday objects doesn't generate
+ # RFC5545-compliant strings, so we should modify that.
+ original_rule = dict(self._original_rule)
+ wday_strings = []
+ for wday in original_rule['byweekday']:
+ if wday.n:
+ wday_strings.append('{n:+d}{wday}'.format(
+ n=wday.n,
+ wday=repr(wday)[0:2]))
+ else:
+ wday_strings.append(repr(wday))
+
+ original_rule['byweekday'] = wday_strings
+ else:
+ original_rule = self._original_rule
+
+ partfmt = '{name}={vals}'
+ for name, key in [('BYSETPOS', 'bysetpos'),
+ ('BYMONTH', 'bymonth'),
+ ('BYMONTHDAY', 'bymonthday'),
+ ('BYYEARDAY', 'byyearday'),
+ ('BYWEEKNO', 'byweekno'),
+ ('BYDAY', 'byweekday'),
+ ('BYHOUR', 'byhour'),
+ ('BYMINUTE', 'byminute'),
+ ('BYSECOND', 'bysecond'),
+ ('BYEASTER', 'byeaster')]:
+ value = original_rule.get(key)
+ if value:
+ parts.append(partfmt.format(name=name, vals=(','.join(str(v)
+ for v in value))))
+
+ output.append('RRULE:' + ';'.join(parts))
+ return '\n'.join(output)
+
+ def replace(self, **kwargs):
+ """Return new rrule with same attributes except for those attributes given new
+ values by whichever keyword arguments are specified."""
+ new_kwargs = {"interval": self._interval,
+ "count": self._count,
+ "dtstart": self._dtstart,
+ "freq": self._freq,
+ "until": self._until,
+ "wkst": self._wkst,
+ "cache": False if self._cache is None else True }
+ new_kwargs.update(self._original_rule)
+ new_kwargs.update(kwargs)
+ return rrule(**new_kwargs)
+
+ def _iter(self):
+ year, month, day, hour, minute, second, weekday, yearday, _ = \
+ self._dtstart.timetuple()
+
+ # Some local variables to speed things up a bit
+ freq = self._freq
+ interval = self._interval
+ wkst = self._wkst
+ until = self._until
+ bymonth = self._bymonth
+ byweekno = self._byweekno
+ byyearday = self._byyearday
+ byweekday = self._byweekday
+ byeaster = self._byeaster
+ bymonthday = self._bymonthday
+ bynmonthday = self._bynmonthday
+ bysetpos = self._bysetpos
+ byhour = self._byhour
+ byminute = self._byminute
+ bysecond = self._bysecond
+
+ ii = _iterinfo(self)
+ ii.rebuild(year, month)
+
+ getdayset = {YEARLY: ii.ydayset,
+ MONTHLY: ii.mdayset,
+ WEEKLY: ii.wdayset,
+ DAILY: ii.ddayset,
+ HOURLY: ii.ddayset,
+ MINUTELY: ii.ddayset,
+ SECONDLY: ii.ddayset}[freq]
+
+ if freq < HOURLY:
+ timeset = self._timeset
+ else:
+ gettimeset = {HOURLY: ii.htimeset,
+ MINUTELY: ii.mtimeset,
+ SECONDLY: ii.stimeset}[freq]
+ if ((freq >= HOURLY and
+ self._byhour and hour not in self._byhour) or
+ (freq >= MINUTELY and
+ self._byminute and minute not in self._byminute) or
+ (freq >= SECONDLY and
+ self._bysecond and second not in self._bysecond)):
+ timeset = ()
+ else:
+ timeset = gettimeset(hour, minute, second)
+
+ total = 0
+ count = self._count
+ while True:
+ # Get dayset with the right frequency
+ dayset, start, end = getdayset(year, month, day)
+
+ # Do the "hard" work ;-)
+ filtered = False
+ for i in dayset[start:end]:
+ if ((bymonth and ii.mmask[i] not in bymonth) or
+ (byweekno and not ii.wnomask[i]) or
+ (byweekday and ii.wdaymask[i] not in byweekday) or
+ (ii.nwdaymask and not ii.nwdaymask[i]) or
+ (byeaster and not ii.eastermask[i]) or
+ ((bymonthday or bynmonthday) and
+ ii.mdaymask[i] not in bymonthday and
+ ii.nmdaymask[i] not in bynmonthday) or
+ (byyearday and
+ ((i < ii.yearlen and i+1 not in byyearday and
+ -ii.yearlen+i not in byyearday) or
+ (i >= ii.yearlen and i+1-ii.yearlen not in byyearday and
+ -ii.nextyearlen+i-ii.yearlen not in byyearday)))):
+ dayset[i] = None
+ filtered = True
+
+ # Output results
+ if bysetpos and timeset:
+ poslist = []
+ for pos in bysetpos:
+ if pos < 0:
+ daypos, timepos = divmod(pos, len(timeset))
+ else:
+ daypos, timepos = divmod(pos-1, len(timeset))
+ try:
+ i = [x for x in dayset[start:end]
+ if x is not None][daypos]
+ time = timeset[timepos]
+ except IndexError:
+ pass
+ else:
+ date = datetime.date.fromordinal(ii.yearordinal+i)
+ res = datetime.datetime.combine(date, time)
+ if res not in poslist:
+ poslist.append(res)
+ poslist.sort()
+ for res in poslist:
+ if until and res > until:
+ self._len = total
+ return
+ elif res >= self._dtstart:
+ if count is not None:
+ count -= 1
+ if count < 0:
+ self._len = total
+ return
+ total += 1
+ yield res
+ else:
+ for i in dayset[start:end]:
+ if i is not None:
+ date = datetime.date.fromordinal(ii.yearordinal + i)
+ for time in timeset:
+ res = datetime.datetime.combine(date, time)
+ if until and res > until:
+ self._len = total
+ return
+ elif res >= self._dtstart:
+ if count is not None:
+ count -= 1
+ if count < 0:
+ self._len = total
+ return
+
+ total += 1
+ yield res
+
+ # Handle frequency and interval
+ fixday = False
+ if freq == YEARLY:
+ year += interval
+ if year > datetime.MAXYEAR:
+ self._len = total
+ return
+ ii.rebuild(year, month)
+ elif freq == MONTHLY:
+ month += interval
+ if month > 12:
+ div, mod = divmod(month, 12)
+ month = mod
+ year += div
+ if month == 0:
+ month = 12
+ year -= 1
+ if year > datetime.MAXYEAR:
+ self._len = total
+ return
+ ii.rebuild(year, month)
+ elif freq == WEEKLY:
+ if wkst > weekday:
+ day += -(weekday+1+(6-wkst))+self._interval*7
+ else:
+ day += -(weekday-wkst)+self._interval*7
+ weekday = wkst
+ fixday = True
+ elif freq == DAILY:
+ day += interval
+ fixday = True
+ elif freq == HOURLY:
+ if filtered:
+ # Jump to one iteration before next day
+ hour += ((23-hour)//interval)*interval
+
+ if byhour:
+ ndays, hour = self.__mod_distance(value=hour,
+ byxxx=self._byhour,
+ base=24)
+ else:
+ ndays, hour = divmod(hour+interval, 24)
+
+ if ndays:
+ day += ndays
+ fixday = True
+
+ timeset = gettimeset(hour, minute, second)
+ elif freq == MINUTELY:
+ if filtered:
+ # Jump to one iteration before next day
+ minute += ((1439-(hour*60+minute))//interval)*interval
+
+ valid = False
+ rep_rate = (24*60)
+ for j in range(rep_rate // gcd(interval, rep_rate)):
+ if byminute:
+ nhours, minute = \
+ self.__mod_distance(value=minute,
+ byxxx=self._byminute,
+ base=60)
+ else:
+ nhours, minute = divmod(minute+interval, 60)
+
+ div, hour = divmod(hour+nhours, 24)
+ if div:
+ day += div
+ fixday = True
+ filtered = False
+
+ if not byhour or hour in byhour:
+ valid = True
+ break
+
+ if not valid:
+ raise ValueError('Invalid combination of interval and ' +
+ 'byhour resulting in empty rule.')
+
+ timeset = gettimeset(hour, minute, second)
+ elif freq == SECONDLY:
+ if filtered:
+ # Jump to one iteration before next day
+ second += (((86399 - (hour * 3600 + minute * 60 + second))
+ // interval) * interval)
+
+ rep_rate = (24 * 3600)
+ valid = False
+ for j in range(0, rep_rate // gcd(interval, rep_rate)):
+ if bysecond:
+ nminutes, second = \
+ self.__mod_distance(value=second,
+ byxxx=self._bysecond,
+ base=60)
+ else:
+ nminutes, second = divmod(second+interval, 60)
+
+ div, minute = divmod(minute+nminutes, 60)
+ if div:
+ hour += div
+ div, hour = divmod(hour, 24)
+ if div:
+ day += div
+ fixday = True
+
+ if ((not byhour or hour in byhour) and
+ (not byminute or minute in byminute) and
+ (not bysecond or second in bysecond)):
+ valid = True
+ break
+
+ if not valid:
+ raise ValueError('Invalid combination of interval, ' +
+ 'byhour and byminute resulting in empty' +
+ ' rule.')
+
+ timeset = gettimeset(hour, minute, second)
+
+ if fixday and day > 28:
+ daysinmonth = calendar.monthrange(year, month)[1]
+ if day > daysinmonth:
+ while day > daysinmonth:
+ day -= daysinmonth
+ month += 1
+ if month == 13:
+ month = 1
+ year += 1
+ if year > datetime.MAXYEAR:
+ self._len = total
+ return
+ daysinmonth = calendar.monthrange(year, month)[1]
+ ii.rebuild(year, month)
+
+ def __construct_byset(self, start, byxxx, base):
+ """
+ If a `BYXXX` sequence is passed to the constructor at the same level as
+ `FREQ` (e.g. `FREQ=HOURLY,BYHOUR={2,4,7},INTERVAL=3`), there are some
+ specifications which cannot be reached given some starting conditions.
+
+ This occurs whenever the interval is not coprime with the base of a
+ given unit and the difference between the starting position and the
+ ending position is not coprime with the greatest common denominator
+ between the interval and the base. For example, with a FREQ of hourly
+ starting at 17:00 and an interval of 4, the only valid values for
+ BYHOUR would be {21, 1, 5, 9, 13, 17}, because 4 and 24 are not
+ coprime.
+
+ :param start:
+ Specifies the starting position.
+ :param byxxx:
+ An iterable containing the list of allowed values.
+ :param base:
+ The largest allowable value for the specified frequency (e.g.
+ 24 hours, 60 minutes).
+
+ This does not preserve the type of the iterable, returning a set, since
+ the values should be unique and the order is irrelevant, this will
+ speed up later lookups.
+
+ In the event of an empty set, raises a :exception:`ValueError`, as this
+ results in an empty rrule.
+ """
+
+ cset = set()
+
+ # Support a single byxxx value.
+ if isinstance(byxxx, integer_types):
+ byxxx = (byxxx, )
+
+ for num in byxxx:
+ i_gcd = gcd(self._interval, base)
+ # Use divmod rather than % because we need to wrap negative nums.
+ if i_gcd == 1 or divmod(num - start, i_gcd)[1] == 0:
+ cset.add(num)
+
+ if len(cset) == 0:
+ raise ValueError("Invalid rrule byxxx generates an empty set.")
+
+ return cset
+
+ def __mod_distance(self, value, byxxx, base):
+ """
+ Calculates the next value in a sequence where the `FREQ` parameter is
+ specified along with a `BYXXX` parameter at the same "level"
+ (e.g. `HOURLY` specified with `BYHOUR`).
+
+ :param value:
+ The old value of the component.
+ :param byxxx:
+ The `BYXXX` set, which should have been generated by
+ `rrule._construct_byset`, or something else which checks that a
+ valid rule is present.
+ :param base:
+ The largest allowable value for the specified frequency (e.g.
+ 24 hours, 60 minutes).
+
+ If a valid value is not found after `base` iterations (the maximum
+ number before the sequence would start to repeat), this raises a
+ :exception:`ValueError`, as no valid values were found.
+
+ This returns a tuple of `divmod(n*interval, base)`, where `n` is the
+ smallest number of `interval` repetitions until the next specified
+ value in `byxxx` is found.
+ """
+ accumulator = 0
+ for ii in range(1, base + 1):
+ # Using divmod() over % to account for negative intervals
+ div, value = divmod(value + self._interval, base)
+ accumulator += div
+ if value in byxxx:
+ return (accumulator, value)
+
+
+class _iterinfo(object):
+ __slots__ = ["rrule", "lastyear", "lastmonth",
+ "yearlen", "nextyearlen", "yearordinal", "yearweekday",
+ "mmask", "mrange", "mdaymask", "nmdaymask",
+ "wdaymask", "wnomask", "nwdaymask", "eastermask"]
+
+ def __init__(self, rrule):
+ for attr in self.__slots__:
+ setattr(self, attr, None)
+ self.rrule = rrule
+
+ def rebuild(self, year, month):
+ # Every mask is 7 days longer to handle cross-year weekly periods.
+ rr = self.rrule
+ if year != self.lastyear:
+ self.yearlen = 365 + calendar.isleap(year)
+ self.nextyearlen = 365 + calendar.isleap(year + 1)
+ firstyday = datetime.date(year, 1, 1)
+ self.yearordinal = firstyday.toordinal()
+ self.yearweekday = firstyday.weekday()
+
+ wday = datetime.date(year, 1, 1).weekday()
+ if self.yearlen == 365:
+ self.mmask = M365MASK
+ self.mdaymask = MDAY365MASK
+ self.nmdaymask = NMDAY365MASK
+ self.wdaymask = WDAYMASK[wday:]
+ self.mrange = M365RANGE
+ else:
+ self.mmask = M366MASK
+ self.mdaymask = MDAY366MASK
+ self.nmdaymask = NMDAY366MASK
+ self.wdaymask = WDAYMASK[wday:]
+ self.mrange = M366RANGE
+
+ if not rr._byweekno:
+ self.wnomask = None
+ else:
+ self.wnomask = [0]*(self.yearlen+7)
+ # no1wkst = firstwkst = self.wdaymask.index(rr._wkst)
+ no1wkst = firstwkst = (7-self.yearweekday+rr._wkst) % 7
+ if no1wkst >= 4:
+ no1wkst = 0
+ # Number of days in the year, plus the days we got
+ # from last year.
+ wyearlen = self.yearlen+(self.yearweekday-rr._wkst) % 7
+ else:
+ # Number of days in the year, minus the days we
+ # left in last year.
+ wyearlen = self.yearlen-no1wkst
+ div, mod = divmod(wyearlen, 7)
+ numweeks = div+mod//4
+ for n in rr._byweekno:
+ if n < 0:
+ n += numweeks+1
+ if not (0 < n <= numweeks):
+ continue
+ if n > 1:
+ i = no1wkst+(n-1)*7
+ if no1wkst != firstwkst:
+ i -= 7-firstwkst
+ else:
+ i = no1wkst
+ for j in range(7):
+ self.wnomask[i] = 1
+ i += 1
+ if self.wdaymask[i] == rr._wkst:
+ break
+ if 1 in rr._byweekno:
+ # Check week number 1 of next year as well
+ # TODO: Check -numweeks for next year.
+ i = no1wkst+numweeks*7
+ if no1wkst != firstwkst:
+ i -= 7-firstwkst
+ if i < self.yearlen:
+ # If week starts in next year, we
+ # don't care about it.
+ for j in range(7):
+ self.wnomask[i] = 1
+ i += 1
+ if self.wdaymask[i] == rr._wkst:
+ break
+ if no1wkst:
+ # Check last week number of last year as
+ # well. If no1wkst is 0, either the year
+ # started on week start, or week number 1
+ # got days from last year, so there are no
+ # days from last year's last week number in
+ # this year.
+ if -1 not in rr._byweekno:
+ lyearweekday = datetime.date(year-1, 1, 1).weekday()
+ lno1wkst = (7-lyearweekday+rr._wkst) % 7
+ lyearlen = 365+calendar.isleap(year-1)
+ if lno1wkst >= 4:
+ lno1wkst = 0
+ lnumweeks = 52+(lyearlen +
+ (lyearweekday-rr._wkst) % 7) % 7//4
+ else:
+ lnumweeks = 52+(self.yearlen-no1wkst) % 7//4
+ else:
+ lnumweeks = -1
+ if lnumweeks in rr._byweekno:
+ for i in range(no1wkst):
+ self.wnomask[i] = 1
+
+ if (rr._bynweekday and (month != self.lastmonth or
+ year != self.lastyear)):
+ ranges = []
+ if rr._freq == YEARLY:
+ if rr._bymonth:
+ for month in rr._bymonth:
+ ranges.append(self.mrange[month-1:month+1])
+ else:
+ ranges = [(0, self.yearlen)]
+ elif rr._freq == MONTHLY:
+ ranges = [self.mrange[month-1:month+1]]
+ if ranges:
+ # Weekly frequency won't get here, so we may not
+ # care about cross-year weekly periods.
+ self.nwdaymask = [0]*self.yearlen
+ for first, last in ranges:
+ last -= 1
+ for wday, n in rr._bynweekday:
+ if n < 0:
+ i = last+(n+1)*7
+ i -= (self.wdaymask[i]-wday) % 7
+ else:
+ i = first+(n-1)*7
+ i += (7-self.wdaymask[i]+wday) % 7
+ if first <= i <= last:
+ self.nwdaymask[i] = 1
+
+ if rr._byeaster:
+ self.eastermask = [0]*(self.yearlen+7)
+ eyday = easter.easter(year).toordinal()-self.yearordinal
+ for offset in rr._byeaster:
+ self.eastermask[eyday+offset] = 1
+
+ self.lastyear = year
+ self.lastmonth = month
+
+ def ydayset(self, year, month, day):
+ return list(range(self.yearlen)), 0, self.yearlen
+
+ def mdayset(self, year, month, day):
+ dset = [None]*self.yearlen
+ start, end = self.mrange[month-1:month+1]
+ for i in range(start, end):
+ dset[i] = i
+ return dset, start, end
+
+ def wdayset(self, year, month, day):
+ # We need to handle cross-year weeks here.
+ dset = [None]*(self.yearlen+7)
+ i = datetime.date(year, month, day).toordinal()-self.yearordinal
+ start = i
+ for j in range(7):
+ dset[i] = i
+ i += 1
+ # if (not (0 <= i < self.yearlen) or
+ # self.wdaymask[i] == self.rrule._wkst):
+ # This will cross the year boundary, if necessary.
+ if self.wdaymask[i] == self.rrule._wkst:
+ break
+ return dset, start, i
+
+ def ddayset(self, year, month, day):
+ dset = [None] * self.yearlen
+ i = datetime.date(year, month, day).toordinal() - self.yearordinal
+ dset[i] = i
+ return dset, i, i + 1
+
+ def htimeset(self, hour, minute, second):
+ tset = []
+ rr = self.rrule
+ for minute in rr._byminute:
+ for second in rr._bysecond:
+ tset.append(datetime.time(hour, minute, second,
+ tzinfo=rr._tzinfo))
+ tset.sort()
+ return tset
+
+ def mtimeset(self, hour, minute, second):
+ tset = []
+ rr = self.rrule
+ for second in rr._bysecond:
+ tset.append(datetime.time(hour, minute, second, tzinfo=rr._tzinfo))
+ tset.sort()
+ return tset
+
+ def stimeset(self, hour, minute, second):
+ return (datetime.time(hour, minute, second,
+ tzinfo=self.rrule._tzinfo),)
+
+
+class rruleset(rrulebase):
+ """ The rruleset type allows more complex recurrence setups, mixing
+ multiple rules, dates, exclusion rules, and exclusion dates. The type
+ constructor takes the following keyword arguments:
+
+ :param cache: If True, caching of results will be enabled, improving
+ performance of multiple queries considerably. """
+
+ class _genitem(object):
+ def __init__(self, genlist, gen):
+ try:
+ self.dt = advance_iterator(gen)
+ genlist.append(self)
+ except StopIteration:
+ pass
+ self.genlist = genlist
+ self.gen = gen
+
+ def __next__(self):
+ try:
+ self.dt = advance_iterator(self.gen)
+ except StopIteration:
+ if self.genlist[0] is self:
+ heapq.heappop(self.genlist)
+ else:
+ self.genlist.remove(self)
+ heapq.heapify(self.genlist)
+
+ next = __next__
+
+ def __lt__(self, other):
+ return self.dt < other.dt
+
+ def __gt__(self, other):
+ return self.dt > other.dt
+
+ def __eq__(self, other):
+ return self.dt == other.dt
+
+ def __ne__(self, other):
+ return self.dt != other.dt
+
+ def __init__(self, cache=False):
+ super(rruleset, self).__init__(cache)
+ self._rrule = []
+ self._rdate = []
+ self._exrule = []
+ self._exdate = []
+
+ @_invalidates_cache
+ def rrule(self, rrule):
+ """ Include the given :py:class:`rrule` instance in the recurrence set
+ generation. """
+ self._rrule.append(rrule)
+
+ @_invalidates_cache
+ def rdate(self, rdate):
+ """ Include the given :py:class:`datetime` instance in the recurrence
+ set generation. """
+ self._rdate.append(rdate)
+
+ @_invalidates_cache
+ def exrule(self, exrule):
+ """ Include the given rrule instance in the recurrence set exclusion
+ list. Dates which are part of the given recurrence rules will not
+ be generated, even if some inclusive rrule or rdate matches them.
+ """
+ self._exrule.append(exrule)
+
+ @_invalidates_cache
+ def exdate(self, exdate):
+ """ Include the given datetime instance in the recurrence set
+ exclusion list. Dates included that way will not be generated,
+ even if some inclusive rrule or rdate matches them. """
+ self._exdate.append(exdate)
+
+ def _iter(self):
+ rlist = []
+ self._rdate.sort()
+ self._genitem(rlist, iter(self._rdate))
+ for gen in [iter(x) for x in self._rrule]:
+ self._genitem(rlist, gen)
+ exlist = []
+ self._exdate.sort()
+ self._genitem(exlist, iter(self._exdate))
+ for gen in [iter(x) for x in self._exrule]:
+ self._genitem(exlist, gen)
+ lastdt = None
+ total = 0
+ heapq.heapify(rlist)
+ heapq.heapify(exlist)
+ while rlist:
+ ritem = rlist[0]
+ if not lastdt or lastdt != ritem.dt:
+ while exlist and exlist[0] < ritem:
+ exitem = exlist[0]
+ advance_iterator(exitem)
+ if exlist and exlist[0] is exitem:
+ heapq.heapreplace(exlist, exitem)
+ if not exlist or ritem != exlist[0]:
+ total += 1
+ yield ritem.dt
+ lastdt = ritem.dt
+ advance_iterator(ritem)
+ if rlist and rlist[0] is ritem:
+ heapq.heapreplace(rlist, ritem)
+ self._len = total
+
+
+
+
+class _rrulestr(object):
+ """ Parses a string representation of a recurrence rule or set of
+ recurrence rules.
+
+ :param s:
+ Required, a string defining one or more recurrence rules.
+
+ :param dtstart:
+ If given, used as the default recurrence start if not specified in the
+ rule string.
+
+ :param cache:
+ If set ``True`` caching of results will be enabled, improving
+ performance of multiple queries considerably.
+
+ :param unfold:
+ If set ``True`` indicates that a rule string is split over more
+ than one line and should be joined before processing.
+
+ :param forceset:
+ If set ``True`` forces a :class:`dateutil.rrule.rruleset` to
+ be returned.
+
+ :param compatible:
+ If set ``True`` forces ``unfold`` and ``forceset`` to be ``True``.
+
+ :param ignoretz:
+ If set ``True``, time zones in parsed strings are ignored and a naive
+ :class:`datetime.datetime` object is returned.
+
+ :param tzids:
+ If given, a callable or mapping used to retrieve a
+ :class:`datetime.tzinfo` from a string representation.
+ Defaults to :func:`dateutil.tz.gettz`.
+
+ :param tzinfos:
+ Additional time zone names / aliases which may be present in a string
+ representation. See :func:`dateutil.parser.parse` for more
+ information.
+
+ :return:
+ Returns a :class:`dateutil.rrule.rruleset` or
+ :class:`dateutil.rrule.rrule`
+ """
+
+ _freq_map = {"YEARLY": YEARLY,
+ "MONTHLY": MONTHLY,
+ "WEEKLY": WEEKLY,
+ "DAILY": DAILY,
+ "HOURLY": HOURLY,
+ "MINUTELY": MINUTELY,
+ "SECONDLY": SECONDLY}
+
+ _weekday_map = {"MO": 0, "TU": 1, "WE": 2, "TH": 3,
+ "FR": 4, "SA": 5, "SU": 6}
+
+ def _handle_int(self, rrkwargs, name, value, **kwargs):
+ rrkwargs[name.lower()] = int(value)
+
+ def _handle_int_list(self, rrkwargs, name, value, **kwargs):
+ rrkwargs[name.lower()] = [int(x) for x in value.split(',')]
+
+ _handle_INTERVAL = _handle_int
+ _handle_COUNT = _handle_int
+ _handle_BYSETPOS = _handle_int_list
+ _handle_BYMONTH = _handle_int_list
+ _handle_BYMONTHDAY = _handle_int_list
+ _handle_BYYEARDAY = _handle_int_list
+ _handle_BYEASTER = _handle_int_list
+ _handle_BYWEEKNO = _handle_int_list
+ _handle_BYHOUR = _handle_int_list
+ _handle_BYMINUTE = _handle_int_list
+ _handle_BYSECOND = _handle_int_list
+
+ def _handle_FREQ(self, rrkwargs, name, value, **kwargs):
+ rrkwargs["freq"] = self._freq_map[value]
+
+ def _handle_UNTIL(self, rrkwargs, name, value, **kwargs):
+ global parser
+ if not parser:
+ from dateutil import parser
+ try:
+ rrkwargs["until"] = parser.parse(value,
+ ignoretz=kwargs.get("ignoretz"),
+ tzinfos=kwargs.get("tzinfos"))
+ except ValueError:
+ raise ValueError("invalid until date")
+
+ def _handle_WKST(self, rrkwargs, name, value, **kwargs):
+ rrkwargs["wkst"] = self._weekday_map[value]
+
+ def _handle_BYWEEKDAY(self, rrkwargs, name, value, **kwargs):
+ """
+ Two ways to specify this: +1MO or MO(+1)
+ """
+ l = []
+ for wday in value.split(','):
+ if '(' in wday:
+ # If it's of the form TH(+1), etc.
+ splt = wday.split('(')
+ w = splt[0]
+ n = int(splt[1][:-1])
+ elif len(wday):
+ # If it's of the form +1MO
+ for i in range(len(wday)):
+ if wday[i] not in '+-0123456789':
+ break
+ n = wday[:i] or None
+ w = wday[i:]
+ if n:
+ n = int(n)
+ else:
+ raise ValueError("Invalid (empty) BYDAY specification.")
+
+ l.append(weekdays[self._weekday_map[w]](n))
+ rrkwargs["byweekday"] = l
+
+ _handle_BYDAY = _handle_BYWEEKDAY
+
+ def _parse_rfc_rrule(self, line,
+ dtstart=None,
+ cache=False,
+ ignoretz=False,
+ tzinfos=None):
+ if line.find(':') != -1:
+ name, value = line.split(':')
+ if name != "RRULE":
+ raise ValueError("unknown parameter name")
+ else:
+ value = line
+ rrkwargs = {}
+ for pair in value.split(';'):
+ name, value = pair.split('=')
+ name = name.upper()
+ value = value.upper()
+ try:
+ getattr(self, "_handle_"+name)(rrkwargs, name, value,
+ ignoretz=ignoretz,
+ tzinfos=tzinfos)
+ except AttributeError:
+ raise ValueError("unknown parameter '%s'" % name)
+ except (KeyError, ValueError):
+ raise ValueError("invalid '%s': %s" % (name, value))
+ return rrule(dtstart=dtstart, cache=cache, **rrkwargs)
+
+ def _parse_date_value(self, date_value, parms, rule_tzids,
+ ignoretz, tzids, tzinfos):
+ global parser
+ if not parser:
+ from dateutil import parser
+
+ datevals = []
+ value_found = False
+ TZID = None
+
+ for parm in parms:
+ if parm.startswith("TZID="):
+ try:
+ tzkey = rule_tzids[parm.split('TZID=')[-1]]
+ except KeyError:
+ continue
+ if tzids is None:
+ from . import tz
+ tzlookup = tz.gettz
+ elif callable(tzids):
+ tzlookup = tzids
+ else:
+ tzlookup = getattr(tzids, 'get', None)
+ if tzlookup is None:
+ msg = ('tzids must be a callable, mapping, or None, '
+ 'not %s' % tzids)
+ raise ValueError(msg)
+
+ TZID = tzlookup(tzkey)
+ continue
+
+ # RFC 5445 3.8.2.4: The VALUE parameter is optional, but may be found
+ # only once.
+ if parm not in {"VALUE=DATE-TIME", "VALUE=DATE"}:
+ raise ValueError("unsupported parm: " + parm)
+ else:
+ if value_found:
+ msg = ("Duplicate value parameter found in: " + parm)
+ raise ValueError(msg)
+ value_found = True
+
+ for datestr in date_value.split(','):
+ date = parser.parse(datestr, ignoretz=ignoretz, tzinfos=tzinfos)
+ if TZID is not None:
+ if date.tzinfo is None:
+ date = date.replace(tzinfo=TZID)
+ else:
+ raise ValueError('DTSTART/EXDATE specifies multiple timezone')
+ datevals.append(date)
+
+ return datevals
+
+ def _parse_rfc(self, s,
+ dtstart=None,
+ cache=False,
+ unfold=False,
+ forceset=False,
+ compatible=False,
+ ignoretz=False,
+ tzids=None,
+ tzinfos=None):
+ global parser
+ if compatible:
+ forceset = True
+ unfold = True
+
+ TZID_NAMES = dict(map(
+ lambda x: (x.upper(), x),
+ re.findall('TZID=(?P[^:]+):', s)
+ ))
+ s = s.upper()
+ if not s.strip():
+ raise ValueError("empty string")
+ if unfold:
+ lines = s.splitlines()
+ i = 0
+ while i < len(lines):
+ line = lines[i].rstrip()
+ if not line:
+ del lines[i]
+ elif i > 0 and line[0] == " ":
+ lines[i-1] += line[1:]
+ del lines[i]
+ else:
+ i += 1
+ else:
+ lines = s.split()
+ if (not forceset and len(lines) == 1 and (s.find(':') == -1 or
+ s.startswith('RRULE:'))):
+ return self._parse_rfc_rrule(lines[0], cache=cache,
+ dtstart=dtstart, ignoretz=ignoretz,
+ tzinfos=tzinfos)
+ else:
+ rrulevals = []
+ rdatevals = []
+ exrulevals = []
+ exdatevals = []
+ for line in lines:
+ if not line:
+ continue
+ if line.find(':') == -1:
+ name = "RRULE"
+ value = line
+ else:
+ name, value = line.split(':', 1)
+ parms = name.split(';')
+ if not parms:
+ raise ValueError("empty property name")
+ name = parms[0]
+ parms = parms[1:]
+ if name == "RRULE":
+ for parm in parms:
+ raise ValueError("unsupported RRULE parm: "+parm)
+ rrulevals.append(value)
+ elif name == "RDATE":
+ for parm in parms:
+ if parm != "VALUE=DATE-TIME":
+ raise ValueError("unsupported RDATE parm: "+parm)
+ rdatevals.append(value)
+ elif name == "EXRULE":
+ for parm in parms:
+ raise ValueError("unsupported EXRULE parm: "+parm)
+ exrulevals.append(value)
+ elif name == "EXDATE":
+ exdatevals.extend(
+ self._parse_date_value(value, parms,
+ TZID_NAMES, ignoretz,
+ tzids, tzinfos)
+ )
+ elif name == "DTSTART":
+ dtvals = self._parse_date_value(value, parms, TZID_NAMES,
+ ignoretz, tzids, tzinfos)
+ if len(dtvals) != 1:
+ raise ValueError("Multiple DTSTART values specified:" +
+ value)
+ dtstart = dtvals[0]
+ else:
+ raise ValueError("unsupported property: "+name)
+ if (forceset or len(rrulevals) > 1 or rdatevals
+ or exrulevals or exdatevals):
+ if not parser and (rdatevals or exdatevals):
+ from dateutil import parser
+ rset = rruleset(cache=cache)
+ for value in rrulevals:
+ rset.rrule(self._parse_rfc_rrule(value, dtstart=dtstart,
+ ignoretz=ignoretz,
+ tzinfos=tzinfos))
+ for value in rdatevals:
+ for datestr in value.split(','):
+ rset.rdate(parser.parse(datestr,
+ ignoretz=ignoretz,
+ tzinfos=tzinfos))
+ for value in exrulevals:
+ rset.exrule(self._parse_rfc_rrule(value, dtstart=dtstart,
+ ignoretz=ignoretz,
+ tzinfos=tzinfos))
+ for value in exdatevals:
+ rset.exdate(value)
+ if compatible and dtstart:
+ rset.rdate(dtstart)
+ return rset
+ else:
+ return self._parse_rfc_rrule(rrulevals[0],
+ dtstart=dtstart,
+ cache=cache,
+ ignoretz=ignoretz,
+ tzinfos=tzinfos)
+
+ def __call__(self, s, **kwargs):
+ return self._parse_rfc(s, **kwargs)
+
+
+rrulestr = _rrulestr()
+
+# vim:ts=4:sw=4:et
diff --git a/venv/Lib/site-packages/dateutil/tz/__init__.py b/venv/Lib/site-packages/dateutil/tz/__init__.py
new file mode 100644
index 0000000..af1352c
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/tz/__init__.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+from .tz import *
+from .tz import __doc__
+
+__all__ = ["tzutc", "tzoffset", "tzlocal", "tzfile", "tzrange",
+ "tzstr", "tzical", "tzwin", "tzwinlocal", "gettz",
+ "enfold", "datetime_ambiguous", "datetime_exists",
+ "resolve_imaginary", "UTC", "DeprecatedTzFormatWarning"]
+
+
+class DeprecatedTzFormatWarning(Warning):
+ """Warning raised when time zones are parsed from deprecated formats."""
diff --git a/venv/Lib/site-packages/dateutil/tz/_common.py b/venv/Lib/site-packages/dateutil/tz/_common.py
new file mode 100644
index 0000000..e6ac118
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/tz/_common.py
@@ -0,0 +1,419 @@
+from six import PY2
+
+from functools import wraps
+
+from datetime import datetime, timedelta, tzinfo
+
+
+ZERO = timedelta(0)
+
+__all__ = ['tzname_in_python2', 'enfold']
+
+
+def tzname_in_python2(namefunc):
+ """Change unicode output into bytestrings in Python 2
+
+ tzname() API changed in Python 3. It used to return bytes, but was changed
+ to unicode strings
+ """
+ if PY2:
+ @wraps(namefunc)
+ def adjust_encoding(*args, **kwargs):
+ name = namefunc(*args, **kwargs)
+ if name is not None:
+ name = name.encode()
+
+ return name
+
+ return adjust_encoding
+ else:
+ return namefunc
+
+
+# The following is adapted from Alexander Belopolsky's tz library
+# https://github.com/abalkin/tz
+if hasattr(datetime, 'fold'):
+ # This is the pre-python 3.6 fold situation
+ def enfold(dt, fold=1):
+ """
+ Provides a unified interface for assigning the ``fold`` attribute to
+ datetimes both before and after the implementation of PEP-495.
+
+ :param fold:
+ The value for the ``fold`` attribute in the returned datetime. This
+ should be either 0 or 1.
+
+ :return:
+ Returns an object for which ``getattr(dt, 'fold', 0)`` returns
+ ``fold`` for all versions of Python. In versions prior to
+ Python 3.6, this is a ``_DatetimeWithFold`` object, which is a
+ subclass of :py:class:`datetime.datetime` with the ``fold``
+ attribute added, if ``fold`` is 1.
+
+ .. versionadded:: 2.6.0
+ """
+ return dt.replace(fold=fold)
+
+else:
+ class _DatetimeWithFold(datetime):
+ """
+ This is a class designed to provide a PEP 495-compliant interface for
+ Python versions before 3.6. It is used only for dates in a fold, so
+ the ``fold`` attribute is fixed at ``1``.
+
+ .. versionadded:: 2.6.0
+ """
+ __slots__ = ()
+
+ def replace(self, *args, **kwargs):
+ """
+ Return a datetime with the same attributes, except for those
+ attributes given new values by whichever keyword arguments are
+ specified. Note that tzinfo=None can be specified to create a naive
+ datetime from an aware datetime with no conversion of date and time
+ data.
+
+ This is reimplemented in ``_DatetimeWithFold`` because pypy3 will
+ return a ``datetime.datetime`` even if ``fold`` is unchanged.
+ """
+ argnames = (
+ 'year', 'month', 'day', 'hour', 'minute', 'second',
+ 'microsecond', 'tzinfo'
+ )
+
+ for arg, argname in zip(args, argnames):
+ if argname in kwargs:
+ raise TypeError('Duplicate argument: {}'.format(argname))
+
+ kwargs[argname] = arg
+
+ for argname in argnames:
+ if argname not in kwargs:
+ kwargs[argname] = getattr(self, argname)
+
+ dt_class = self.__class__ if kwargs.get('fold', 1) else datetime
+
+ return dt_class(**kwargs)
+
+ @property
+ def fold(self):
+ return 1
+
+ def enfold(dt, fold=1):
+ """
+ Provides a unified interface for assigning the ``fold`` attribute to
+ datetimes both before and after the implementation of PEP-495.
+
+ :param fold:
+ The value for the ``fold`` attribute in the returned datetime. This
+ should be either 0 or 1.
+
+ :return:
+ Returns an object for which ``getattr(dt, 'fold', 0)`` returns
+ ``fold`` for all versions of Python. In versions prior to
+ Python 3.6, this is a ``_DatetimeWithFold`` object, which is a
+ subclass of :py:class:`datetime.datetime` with the ``fold``
+ attribute added, if ``fold`` is 1.
+
+ .. versionadded:: 2.6.0
+ """
+ if getattr(dt, 'fold', 0) == fold:
+ return dt
+
+ args = dt.timetuple()[:6]
+ args += (dt.microsecond, dt.tzinfo)
+
+ if fold:
+ return _DatetimeWithFold(*args)
+ else:
+ return datetime(*args)
+
+
+def _validate_fromutc_inputs(f):
+ """
+ The CPython version of ``fromutc`` checks that the input is a ``datetime``
+ object and that ``self`` is attached as its ``tzinfo``.
+ """
+ @wraps(f)
+ def fromutc(self, dt):
+ if not isinstance(dt, datetime):
+ raise TypeError("fromutc() requires a datetime argument")
+ if dt.tzinfo is not self:
+ raise ValueError("dt.tzinfo is not self")
+
+ return f(self, dt)
+
+ return fromutc
+
+
+class _tzinfo(tzinfo):
+ """
+ Base class for all ``dateutil`` ``tzinfo`` objects.
+ """
+
+ def is_ambiguous(self, dt):
+ """
+ Whether or not the "wall time" of a given datetime is ambiguous in this
+ zone.
+
+ :param dt:
+ A :py:class:`datetime.datetime`, naive or time zone aware.
+
+
+ :return:
+ Returns ``True`` if ambiguous, ``False`` otherwise.
+
+ .. versionadded:: 2.6.0
+ """
+
+ dt = dt.replace(tzinfo=self)
+
+ wall_0 = enfold(dt, fold=0)
+ wall_1 = enfold(dt, fold=1)
+
+ same_offset = wall_0.utcoffset() == wall_1.utcoffset()
+ same_dt = wall_0.replace(tzinfo=None) == wall_1.replace(tzinfo=None)
+
+ return same_dt and not same_offset
+
+ def _fold_status(self, dt_utc, dt_wall):
+ """
+ Determine the fold status of a "wall" datetime, given a representation
+ of the same datetime as a (naive) UTC datetime. This is calculated based
+ on the assumption that ``dt.utcoffset() - dt.dst()`` is constant for all
+ datetimes, and that this offset is the actual number of hours separating
+ ``dt_utc`` and ``dt_wall``.
+
+ :param dt_utc:
+ Representation of the datetime as UTC
+
+ :param dt_wall:
+ Representation of the datetime as "wall time". This parameter must
+ either have a `fold` attribute or have a fold-naive
+ :class:`datetime.tzinfo` attached, otherwise the calculation may
+ fail.
+ """
+ if self.is_ambiguous(dt_wall):
+ delta_wall = dt_wall - dt_utc
+ _fold = int(delta_wall == (dt_utc.utcoffset() - dt_utc.dst()))
+ else:
+ _fold = 0
+
+ return _fold
+
+ def _fold(self, dt):
+ return getattr(dt, 'fold', 0)
+
+ def _fromutc(self, dt):
+ """
+ Given a timezone-aware datetime in a given timezone, calculates a
+ timezone-aware datetime in a new timezone.
+
+ Since this is the one time that we *know* we have an unambiguous
+ datetime object, we take this opportunity to determine whether the
+ datetime is ambiguous and in a "fold" state (e.g. if it's the first
+ occurrence, chronologically, of the ambiguous datetime).
+
+ :param dt:
+ A timezone-aware :class:`datetime.datetime` object.
+ """
+
+ # Re-implement the algorithm from Python's datetime.py
+ dtoff = dt.utcoffset()
+ if dtoff is None:
+ raise ValueError("fromutc() requires a non-None utcoffset() "
+ "result")
+
+ # The original datetime.py code assumes that `dst()` defaults to
+ # zero during ambiguous times. PEP 495 inverts this presumption, so
+ # for pre-PEP 495 versions of python, we need to tweak the algorithm.
+ dtdst = dt.dst()
+ if dtdst is None:
+ raise ValueError("fromutc() requires a non-None dst() result")
+ delta = dtoff - dtdst
+
+ dt += delta
+ # Set fold=1 so we can default to being in the fold for
+ # ambiguous dates.
+ dtdst = enfold(dt, fold=1).dst()
+ if dtdst is None:
+ raise ValueError("fromutc(): dt.dst gave inconsistent "
+ "results; cannot convert")
+ return dt + dtdst
+
+ @_validate_fromutc_inputs
+ def fromutc(self, dt):
+ """
+ Given a timezone-aware datetime in a given timezone, calculates a
+ timezone-aware datetime in a new timezone.
+
+ Since this is the one time that we *know* we have an unambiguous
+ datetime object, we take this opportunity to determine whether the
+ datetime is ambiguous and in a "fold" state (e.g. if it's the first
+ occurrence, chronologically, of the ambiguous datetime).
+
+ :param dt:
+ A timezone-aware :class:`datetime.datetime` object.
+ """
+ dt_wall = self._fromutc(dt)
+
+ # Calculate the fold status given the two datetimes.
+ _fold = self._fold_status(dt, dt_wall)
+
+ # Set the default fold value for ambiguous dates
+ return enfold(dt_wall, fold=_fold)
+
+
+class tzrangebase(_tzinfo):
+ """
+ This is an abstract base class for time zones represented by an annual
+ transition into and out of DST. Child classes should implement the following
+ methods:
+
+ * ``__init__(self, *args, **kwargs)``
+ * ``transitions(self, year)`` - this is expected to return a tuple of
+ datetimes representing the DST on and off transitions in standard
+ time.
+
+ A fully initialized ``tzrangebase`` subclass should also provide the
+ following attributes:
+ * ``hasdst``: Boolean whether or not the zone uses DST.
+ * ``_dst_offset`` / ``_std_offset``: :class:`datetime.timedelta` objects
+ representing the respective UTC offsets.
+ * ``_dst_abbr`` / ``_std_abbr``: Strings representing the timezone short
+ abbreviations in DST and STD, respectively.
+ * ``_hasdst``: Whether or not the zone has DST.
+
+ .. versionadded:: 2.6.0
+ """
+ def __init__(self):
+ raise NotImplementedError('tzrangebase is an abstract base class')
+
+ def utcoffset(self, dt):
+ isdst = self._isdst(dt)
+
+ if isdst is None:
+ return None
+ elif isdst:
+ return self._dst_offset
+ else:
+ return self._std_offset
+
+ def dst(self, dt):
+ isdst = self._isdst(dt)
+
+ if isdst is None:
+ return None
+ elif isdst:
+ return self._dst_base_offset
+ else:
+ return ZERO
+
+ @tzname_in_python2
+ def tzname(self, dt):
+ if self._isdst(dt):
+ return self._dst_abbr
+ else:
+ return self._std_abbr
+
+ def fromutc(self, dt):
+ """ Given a datetime in UTC, return local time """
+ if not isinstance(dt, datetime):
+ raise TypeError("fromutc() requires a datetime argument")
+
+ if dt.tzinfo is not self:
+ raise ValueError("dt.tzinfo is not self")
+
+ # Get transitions - if there are none, fixed offset
+ transitions = self.transitions(dt.year)
+ if transitions is None:
+ return dt + self.utcoffset(dt)
+
+ # Get the transition times in UTC
+ dston, dstoff = transitions
+
+ dston -= self._std_offset
+ dstoff -= self._std_offset
+
+ utc_transitions = (dston, dstoff)
+ dt_utc = dt.replace(tzinfo=None)
+
+ isdst = self._naive_isdst(dt_utc, utc_transitions)
+
+ if isdst:
+ dt_wall = dt + self._dst_offset
+ else:
+ dt_wall = dt + self._std_offset
+
+ _fold = int(not isdst and self.is_ambiguous(dt_wall))
+
+ return enfold(dt_wall, fold=_fold)
+
+ def is_ambiguous(self, dt):
+ """
+ Whether or not the "wall time" of a given datetime is ambiguous in this
+ zone.
+
+ :param dt:
+ A :py:class:`datetime.datetime`, naive or time zone aware.
+
+
+ :return:
+ Returns ``True`` if ambiguous, ``False`` otherwise.
+
+ .. versionadded:: 2.6.0
+ """
+ if not self.hasdst:
+ return False
+
+ start, end = self.transitions(dt.year)
+
+ dt = dt.replace(tzinfo=None)
+ return (end <= dt < end + self._dst_base_offset)
+
+ def _isdst(self, dt):
+ if not self.hasdst:
+ return False
+ elif dt is None:
+ return None
+
+ transitions = self.transitions(dt.year)
+
+ if transitions is None:
+ return False
+
+ dt = dt.replace(tzinfo=None)
+
+ isdst = self._naive_isdst(dt, transitions)
+
+ # Handle ambiguous dates
+ if not isdst and self.is_ambiguous(dt):
+ return not self._fold(dt)
+ else:
+ return isdst
+
+ def _naive_isdst(self, dt, transitions):
+ dston, dstoff = transitions
+
+ dt = dt.replace(tzinfo=None)
+
+ if dston < dstoff:
+ isdst = dston <= dt < dstoff
+ else:
+ isdst = not dstoff <= dt < dston
+
+ return isdst
+
+ @property
+ def _dst_base_offset(self):
+ return self._dst_offset - self._std_offset
+
+ __hash__ = None
+
+ def __ne__(self, other):
+ return not (self == other)
+
+ def __repr__(self):
+ return "%s(...)" % self.__class__.__name__
+
+ __reduce__ = object.__reduce__
diff --git a/venv/Lib/site-packages/dateutil/tz/_factories.py b/venv/Lib/site-packages/dateutil/tz/_factories.py
new file mode 100644
index 0000000..f8a6589
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/tz/_factories.py
@@ -0,0 +1,80 @@
+from datetime import timedelta
+import weakref
+from collections import OrderedDict
+
+from six.moves import _thread
+
+
+class _TzSingleton(type):
+ def __init__(cls, *args, **kwargs):
+ cls.__instance = None
+ super(_TzSingleton, cls).__init__(*args, **kwargs)
+
+ def __call__(cls):
+ if cls.__instance is None:
+ cls.__instance = super(_TzSingleton, cls).__call__()
+ return cls.__instance
+
+
+class _TzFactory(type):
+ def instance(cls, *args, **kwargs):
+ """Alternate constructor that returns a fresh instance"""
+ return type.__call__(cls, *args, **kwargs)
+
+
+class _TzOffsetFactory(_TzFactory):
+ def __init__(cls, *args, **kwargs):
+ cls.__instances = weakref.WeakValueDictionary()
+ cls.__strong_cache = OrderedDict()
+ cls.__strong_cache_size = 8
+
+ cls._cache_lock = _thread.allocate_lock()
+
+ def __call__(cls, name, offset):
+ if isinstance(offset, timedelta):
+ key = (name, offset.total_seconds())
+ else:
+ key = (name, offset)
+
+ instance = cls.__instances.get(key, None)
+ if instance is None:
+ instance = cls.__instances.setdefault(key,
+ cls.instance(name, offset))
+
+ # This lock may not be necessary in Python 3. See GH issue #901
+ with cls._cache_lock:
+ cls.__strong_cache[key] = cls.__strong_cache.pop(key, instance)
+
+ # Remove an item if the strong cache is overpopulated
+ if len(cls.__strong_cache) > cls.__strong_cache_size:
+ cls.__strong_cache.popitem(last=False)
+
+ return instance
+
+
+class _TzStrFactory(_TzFactory):
+ def __init__(cls, *args, **kwargs):
+ cls.__instances = weakref.WeakValueDictionary()
+ cls.__strong_cache = OrderedDict()
+ cls.__strong_cache_size = 8
+
+ cls.__cache_lock = _thread.allocate_lock()
+
+ def __call__(cls, s, posix_offset=False):
+ key = (s, posix_offset)
+ instance = cls.__instances.get(key, None)
+
+ if instance is None:
+ instance = cls.__instances.setdefault(key,
+ cls.instance(s, posix_offset))
+
+ # This lock may not be necessary in Python 3. See GH issue #901
+ with cls.__cache_lock:
+ cls.__strong_cache[key] = cls.__strong_cache.pop(key, instance)
+
+ # Remove an item if the strong cache is overpopulated
+ if len(cls.__strong_cache) > cls.__strong_cache_size:
+ cls.__strong_cache.popitem(last=False)
+
+ return instance
+
diff --git a/venv/Lib/site-packages/dateutil/tz/tz.py b/venv/Lib/site-packages/dateutil/tz/tz.py
new file mode 100644
index 0000000..af81e88
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/tz/tz.py
@@ -0,0 +1,1849 @@
+# -*- coding: utf-8 -*-
+"""
+This module offers timezone implementations subclassing the abstract
+:py:class:`datetime.tzinfo` type. There are classes to handle tzfile format
+files (usually are in :file:`/etc/localtime`, :file:`/usr/share/zoneinfo`,
+etc), TZ environment string (in all known formats), given ranges (with help
+from relative deltas), local machine timezone, fixed offset timezone, and UTC
+timezone.
+"""
+import datetime
+import struct
+import time
+import sys
+import os
+import bisect
+import weakref
+from collections import OrderedDict
+
+import six
+from six import string_types
+from six.moves import _thread
+from ._common import tzname_in_python2, _tzinfo
+from ._common import tzrangebase, enfold
+from ._common import _validate_fromutc_inputs
+
+from ._factories import _TzSingleton, _TzOffsetFactory
+from ._factories import _TzStrFactory
+try:
+ from .win import tzwin, tzwinlocal
+except ImportError:
+ tzwin = tzwinlocal = None
+
+# For warning about rounding tzinfo
+from warnings import warn
+
+ZERO = datetime.timedelta(0)
+EPOCH = datetime.datetime.utcfromtimestamp(0)
+EPOCHORDINAL = EPOCH.toordinal()
+
+
+@six.add_metaclass(_TzSingleton)
+class tzutc(datetime.tzinfo):
+ """
+ This is a tzinfo object that represents the UTC time zone.
+
+ **Examples:**
+
+ .. doctest::
+
+ >>> from datetime import *
+ >>> from dateutil.tz import *
+
+ >>> datetime.now()
+ datetime.datetime(2003, 9, 27, 9, 40, 1, 521290)
+
+ >>> datetime.now(tzutc())
+ datetime.datetime(2003, 9, 27, 12, 40, 12, 156379, tzinfo=tzutc())
+
+ >>> datetime.now(tzutc()).tzname()
+ 'UTC'
+
+ .. versionchanged:: 2.7.0
+ ``tzutc()`` is now a singleton, so the result of ``tzutc()`` will
+ always return the same object.
+
+ .. doctest::
+
+ >>> from dateutil.tz import tzutc, UTC
+ >>> tzutc() is tzutc()
+ True
+ >>> tzutc() is UTC
+ True
+ """
+ def utcoffset(self, dt):
+ return ZERO
+
+ def dst(self, dt):
+ return ZERO
+
+ @tzname_in_python2
+ def tzname(self, dt):
+ return "UTC"
+
+ def is_ambiguous(self, dt):
+ """
+ Whether or not the "wall time" of a given datetime is ambiguous in this
+ zone.
+
+ :param dt:
+ A :py:class:`datetime.datetime`, naive or time zone aware.
+
+
+ :return:
+ Returns ``True`` if ambiguous, ``False`` otherwise.
+
+ .. versionadded:: 2.6.0
+ """
+ return False
+
+ @_validate_fromutc_inputs
+ def fromutc(self, dt):
+ """
+ Fast track version of fromutc() returns the original ``dt`` object for
+ any valid :py:class:`datetime.datetime` object.
+ """
+ return dt
+
+ def __eq__(self, other):
+ if not isinstance(other, (tzutc, tzoffset)):
+ return NotImplemented
+
+ return (isinstance(other, tzutc) or
+ (isinstance(other, tzoffset) and other._offset == ZERO))
+
+ __hash__ = None
+
+ def __ne__(self, other):
+ return not (self == other)
+
+ def __repr__(self):
+ return "%s()" % self.__class__.__name__
+
+ __reduce__ = object.__reduce__
+
+
+#: Convenience constant providing a :class:`tzutc()` instance
+#:
+#: .. versionadded:: 2.7.0
+UTC = tzutc()
+
+
+@six.add_metaclass(_TzOffsetFactory)
+class tzoffset(datetime.tzinfo):
+ """
+ A simple class for representing a fixed offset from UTC.
+
+ :param name:
+ The timezone name, to be returned when ``tzname()`` is called.
+ :param offset:
+ The time zone offset in seconds, or (since version 2.6.0, represented
+ as a :py:class:`datetime.timedelta` object).
+ """
+ def __init__(self, name, offset):
+ self._name = name
+
+ try:
+ # Allow a timedelta
+ offset = offset.total_seconds()
+ except (TypeError, AttributeError):
+ pass
+
+ self._offset = datetime.timedelta(seconds=_get_supported_offset(offset))
+
+ def utcoffset(self, dt):
+ return self._offset
+
+ def dst(self, dt):
+ return ZERO
+
+ @tzname_in_python2
+ def tzname(self, dt):
+ return self._name
+
+ @_validate_fromutc_inputs
+ def fromutc(self, dt):
+ return dt + self._offset
+
+ def is_ambiguous(self, dt):
+ """
+ Whether or not the "wall time" of a given datetime is ambiguous in this
+ zone.
+
+ :param dt:
+ A :py:class:`datetime.datetime`, naive or time zone aware.
+ :return:
+ Returns ``True`` if ambiguous, ``False`` otherwise.
+
+ .. versionadded:: 2.6.0
+ """
+ return False
+
+ def __eq__(self, other):
+ if not isinstance(other, tzoffset):
+ return NotImplemented
+
+ return self._offset == other._offset
+
+ __hash__ = None
+
+ def __ne__(self, other):
+ return not (self == other)
+
+ def __repr__(self):
+ return "%s(%s, %s)" % (self.__class__.__name__,
+ repr(self._name),
+ int(self._offset.total_seconds()))
+
+ __reduce__ = object.__reduce__
+
+
+class tzlocal(_tzinfo):
+ """
+ A :class:`tzinfo` subclass built around the ``time`` timezone functions.
+ """
+ def __init__(self):
+ super(tzlocal, self).__init__()
+
+ self._std_offset = datetime.timedelta(seconds=-time.timezone)
+ if time.daylight:
+ self._dst_offset = datetime.timedelta(seconds=-time.altzone)
+ else:
+ self._dst_offset = self._std_offset
+
+ self._dst_saved = self._dst_offset - self._std_offset
+ self._hasdst = bool(self._dst_saved)
+ self._tznames = tuple(time.tzname)
+
+ def utcoffset(self, dt):
+ if dt is None and self._hasdst:
+ return None
+
+ if self._isdst(dt):
+ return self._dst_offset
+ else:
+ return self._std_offset
+
+ def dst(self, dt):
+ if dt is None and self._hasdst:
+ return None
+
+ if self._isdst(dt):
+ return self._dst_offset - self._std_offset
+ else:
+ return ZERO
+
+ @tzname_in_python2
+ def tzname(self, dt):
+ return self._tznames[self._isdst(dt)]
+
+ def is_ambiguous(self, dt):
+ """
+ Whether or not the "wall time" of a given datetime is ambiguous in this
+ zone.
+
+ :param dt:
+ A :py:class:`datetime.datetime`, naive or time zone aware.
+
+
+ :return:
+ Returns ``True`` if ambiguous, ``False`` otherwise.
+
+ .. versionadded:: 2.6.0
+ """
+ naive_dst = self._naive_is_dst(dt)
+ return (not naive_dst and
+ (naive_dst != self._naive_is_dst(dt - self._dst_saved)))
+
+ def _naive_is_dst(self, dt):
+ timestamp = _datetime_to_timestamp(dt)
+ return time.localtime(timestamp + time.timezone).tm_isdst
+
+ def _isdst(self, dt, fold_naive=True):
+ # We can't use mktime here. It is unstable when deciding if
+ # the hour near to a change is DST or not.
+ #
+ # timestamp = time.mktime((dt.year, dt.month, dt.day, dt.hour,
+ # dt.minute, dt.second, dt.weekday(), 0, -1))
+ # return time.localtime(timestamp).tm_isdst
+ #
+ # The code above yields the following result:
+ #
+ # >>> import tz, datetime
+ # >>> t = tz.tzlocal()
+ # >>> datetime.datetime(2003,2,15,23,tzinfo=t).tzname()
+ # 'BRDT'
+ # >>> datetime.datetime(2003,2,16,0,tzinfo=t).tzname()
+ # 'BRST'
+ # >>> datetime.datetime(2003,2,15,23,tzinfo=t).tzname()
+ # 'BRST'
+ # >>> datetime.datetime(2003,2,15,22,tzinfo=t).tzname()
+ # 'BRDT'
+ # >>> datetime.datetime(2003,2,15,23,tzinfo=t).tzname()
+ # 'BRDT'
+ #
+ # Here is a more stable implementation:
+ #
+ if not self._hasdst:
+ return False
+
+ # Check for ambiguous times:
+ dstval = self._naive_is_dst(dt)
+ fold = getattr(dt, 'fold', None)
+
+ if self.is_ambiguous(dt):
+ if fold is not None:
+ return not self._fold(dt)
+ else:
+ return True
+
+ return dstval
+
+ def __eq__(self, other):
+ if isinstance(other, tzlocal):
+ return (self._std_offset == other._std_offset and
+ self._dst_offset == other._dst_offset)
+ elif isinstance(other, tzutc):
+ return (not self._hasdst and
+ self._tznames[0] in {'UTC', 'GMT'} and
+ self._std_offset == ZERO)
+ elif isinstance(other, tzoffset):
+ return (not self._hasdst and
+ self._tznames[0] == other._name and
+ self._std_offset == other._offset)
+ else:
+ return NotImplemented
+
+ __hash__ = None
+
+ def __ne__(self, other):
+ return not (self == other)
+
+ def __repr__(self):
+ return "%s()" % self.__class__.__name__
+
+ __reduce__ = object.__reduce__
+
+
+class _ttinfo(object):
+ __slots__ = ["offset", "delta", "isdst", "abbr",
+ "isstd", "isgmt", "dstoffset"]
+
+ def __init__(self):
+ for attr in self.__slots__:
+ setattr(self, attr, None)
+
+ def __repr__(self):
+ l = []
+ for attr in self.__slots__:
+ value = getattr(self, attr)
+ if value is not None:
+ l.append("%s=%s" % (attr, repr(value)))
+ return "%s(%s)" % (self.__class__.__name__, ", ".join(l))
+
+ def __eq__(self, other):
+ if not isinstance(other, _ttinfo):
+ return NotImplemented
+
+ return (self.offset == other.offset and
+ self.delta == other.delta and
+ self.isdst == other.isdst and
+ self.abbr == other.abbr and
+ self.isstd == other.isstd and
+ self.isgmt == other.isgmt and
+ self.dstoffset == other.dstoffset)
+
+ __hash__ = None
+
+ def __ne__(self, other):
+ return not (self == other)
+
+ def __getstate__(self):
+ state = {}
+ for name in self.__slots__:
+ state[name] = getattr(self, name, None)
+ return state
+
+ def __setstate__(self, state):
+ for name in self.__slots__:
+ if name in state:
+ setattr(self, name, state[name])
+
+
+class _tzfile(object):
+ """
+ Lightweight class for holding the relevant transition and time zone
+ information read from binary tzfiles.
+ """
+ attrs = ['trans_list', 'trans_list_utc', 'trans_idx', 'ttinfo_list',
+ 'ttinfo_std', 'ttinfo_dst', 'ttinfo_before', 'ttinfo_first']
+
+ def __init__(self, **kwargs):
+ for attr in self.attrs:
+ setattr(self, attr, kwargs.get(attr, None))
+
+
+class tzfile(_tzinfo):
+ """
+ This is a ``tzinfo`` subclass that allows one to use the ``tzfile(5)``
+ format timezone files to extract current and historical zone information.
+
+ :param fileobj:
+ This can be an opened file stream or a file name that the time zone
+ information can be read from.
+
+ :param filename:
+ This is an optional parameter specifying the source of the time zone
+ information in the event that ``fileobj`` is a file object. If omitted
+ and ``fileobj`` is a file stream, this parameter will be set either to
+ ``fileobj``'s ``name`` attribute or to ``repr(fileobj)``.
+
+ See `Sources for Time Zone and Daylight Saving Time Data
+ `_ for more information.
+ Time zone files can be compiled from the `IANA Time Zone database files
+ `_ with the `zic time zone compiler
+ `_
+
+ .. note::
+
+ Only construct a ``tzfile`` directly if you have a specific timezone
+ file on disk that you want to read into a Python ``tzinfo`` object.
+ If you want to get a ``tzfile`` representing a specific IANA zone,
+ (e.g. ``'America/New_York'``), you should call
+ :func:`dateutil.tz.gettz` with the zone identifier.
+
+
+ **Examples:**
+
+ Using the US Eastern time zone as an example, we can see that a ``tzfile``
+ provides time zone information for the standard Daylight Saving offsets:
+
+ .. testsetup:: tzfile
+
+ from dateutil.tz import gettz
+ from datetime import datetime
+
+ .. doctest:: tzfile
+
+ >>> NYC = gettz('America/New_York')
+ >>> NYC
+ tzfile('/usr/share/zoneinfo/America/New_York')
+
+ >>> print(datetime(2016, 1, 3, tzinfo=NYC)) # EST
+ 2016-01-03 00:00:00-05:00
+
+ >>> print(datetime(2016, 7, 7, tzinfo=NYC)) # EDT
+ 2016-07-07 00:00:00-04:00
+
+
+ The ``tzfile`` structure contains a fully history of the time zone,
+ so historical dates will also have the right offsets. For example, before
+ the adoption of the UTC standards, New York used local solar mean time:
+
+ .. doctest:: tzfile
+
+ >>> print(datetime(1901, 4, 12, tzinfo=NYC)) # LMT
+ 1901-04-12 00:00:00-04:56
+
+ And during World War II, New York was on "Eastern War Time", which was a
+ state of permanent daylight saving time:
+
+ .. doctest:: tzfile
+
+ >>> print(datetime(1944, 2, 7, tzinfo=NYC)) # EWT
+ 1944-02-07 00:00:00-04:00
+
+ """
+
+ def __init__(self, fileobj, filename=None):
+ super(tzfile, self).__init__()
+
+ file_opened_here = False
+ if isinstance(fileobj, string_types):
+ self._filename = fileobj
+ fileobj = open(fileobj, 'rb')
+ file_opened_here = True
+ elif filename is not None:
+ self._filename = filename
+ elif hasattr(fileobj, "name"):
+ self._filename = fileobj.name
+ else:
+ self._filename = repr(fileobj)
+
+ if fileobj is not None:
+ if not file_opened_here:
+ fileobj = _nullcontext(fileobj)
+
+ with fileobj as file_stream:
+ tzobj = self._read_tzfile(file_stream)
+
+ self._set_tzdata(tzobj)
+
+ def _set_tzdata(self, tzobj):
+ """ Set the time zone data of this object from a _tzfile object """
+ # Copy the relevant attributes over as private attributes
+ for attr in _tzfile.attrs:
+ setattr(self, '_' + attr, getattr(tzobj, attr))
+
+ def _read_tzfile(self, fileobj):
+ out = _tzfile()
+
+ # From tzfile(5):
+ #
+ # The time zone information files used by tzset(3)
+ # begin with the magic characters "TZif" to identify
+ # them as time zone information files, followed by
+ # sixteen bytes reserved for future use, followed by
+ # six four-byte values of type long, written in a
+ # ``standard'' byte order (the high-order byte
+ # of the value is written first).
+ if fileobj.read(4).decode() != "TZif":
+ raise ValueError("magic not found")
+
+ fileobj.read(16)
+
+ (
+ # The number of UTC/local indicators stored in the file.
+ ttisgmtcnt,
+
+ # The number of standard/wall indicators stored in the file.
+ ttisstdcnt,
+
+ # The number of leap seconds for which data is
+ # stored in the file.
+ leapcnt,
+
+ # The number of "transition times" for which data
+ # is stored in the file.
+ timecnt,
+
+ # The number of "local time types" for which data
+ # is stored in the file (must not be zero).
+ typecnt,
+
+ # The number of characters of "time zone
+ # abbreviation strings" stored in the file.
+ charcnt,
+
+ ) = struct.unpack(">6l", fileobj.read(24))
+
+ # The above header is followed by tzh_timecnt four-byte
+ # values of type long, sorted in ascending order.
+ # These values are written in ``standard'' byte order.
+ # Each is used as a transition time (as returned by
+ # time(2)) at which the rules for computing local time
+ # change.
+
+ if timecnt:
+ out.trans_list_utc = list(struct.unpack(">%dl" % timecnt,
+ fileobj.read(timecnt*4)))
+ else:
+ out.trans_list_utc = []
+
+ # Next come tzh_timecnt one-byte values of type unsigned
+ # char; each one tells which of the different types of
+ # ``local time'' types described in the file is associated
+ # with the same-indexed transition time. These values
+ # serve as indices into an array of ttinfo structures that
+ # appears next in the file.
+
+ if timecnt:
+ out.trans_idx = struct.unpack(">%dB" % timecnt,
+ fileobj.read(timecnt))
+ else:
+ out.trans_idx = []
+
+ # Each ttinfo structure is written as a four-byte value
+ # for tt_gmtoff of type long, in a standard byte
+ # order, followed by a one-byte value for tt_isdst
+ # and a one-byte value for tt_abbrind. In each
+ # structure, tt_gmtoff gives the number of
+ # seconds to be added to UTC, tt_isdst tells whether
+ # tm_isdst should be set by localtime(3), and
+ # tt_abbrind serves as an index into the array of
+ # time zone abbreviation characters that follow the
+ # ttinfo structure(s) in the file.
+
+ ttinfo = []
+
+ for i in range(typecnt):
+ ttinfo.append(struct.unpack(">lbb", fileobj.read(6)))
+
+ abbr = fileobj.read(charcnt).decode()
+
+ # Then there are tzh_leapcnt pairs of four-byte
+ # values, written in standard byte order; the
+ # first value of each pair gives the time (as
+ # returned by time(2)) at which a leap second
+ # occurs; the second gives the total number of
+ # leap seconds to be applied after the given time.
+ # The pairs of values are sorted in ascending order
+ # by time.
+
+ # Not used, for now (but seek for correct file position)
+ if leapcnt:
+ fileobj.seek(leapcnt * 8, os.SEEK_CUR)
+
+ # Then there are tzh_ttisstdcnt standard/wall
+ # indicators, each stored as a one-byte value;
+ # they tell whether the transition times associated
+ # with local time types were specified as standard
+ # time or wall clock time, and are used when
+ # a time zone file is used in handling POSIX-style
+ # time zone environment variables.
+
+ if ttisstdcnt:
+ isstd = struct.unpack(">%db" % ttisstdcnt,
+ fileobj.read(ttisstdcnt))
+
+ # Finally, there are tzh_ttisgmtcnt UTC/local
+ # indicators, each stored as a one-byte value;
+ # they tell whether the transition times associated
+ # with local time types were specified as UTC or
+ # local time, and are used when a time zone file
+ # is used in handling POSIX-style time zone envi-
+ # ronment variables.
+
+ if ttisgmtcnt:
+ isgmt = struct.unpack(">%db" % ttisgmtcnt,
+ fileobj.read(ttisgmtcnt))
+
+ # Build ttinfo list
+ out.ttinfo_list = []
+ for i in range(typecnt):
+ gmtoff, isdst, abbrind = ttinfo[i]
+ gmtoff = _get_supported_offset(gmtoff)
+ tti = _ttinfo()
+ tti.offset = gmtoff
+ tti.dstoffset = datetime.timedelta(0)
+ tti.delta = datetime.timedelta(seconds=gmtoff)
+ tti.isdst = isdst
+ tti.abbr = abbr[abbrind:abbr.find('\x00', abbrind)]
+ tti.isstd = (ttisstdcnt > i and isstd[i] != 0)
+ tti.isgmt = (ttisgmtcnt > i and isgmt[i] != 0)
+ out.ttinfo_list.append(tti)
+
+ # Replace ttinfo indexes for ttinfo objects.
+ out.trans_idx = [out.ttinfo_list[idx] for idx in out.trans_idx]
+
+ # Set standard, dst, and before ttinfos. before will be
+ # used when a given time is before any transitions,
+ # and will be set to the first non-dst ttinfo, or to
+ # the first dst, if all of them are dst.
+ out.ttinfo_std = None
+ out.ttinfo_dst = None
+ out.ttinfo_before = None
+ if out.ttinfo_list:
+ if not out.trans_list_utc:
+ out.ttinfo_std = out.ttinfo_first = out.ttinfo_list[0]
+ else:
+ for i in range(timecnt-1, -1, -1):
+ tti = out.trans_idx[i]
+ if not out.ttinfo_std and not tti.isdst:
+ out.ttinfo_std = tti
+ elif not out.ttinfo_dst and tti.isdst:
+ out.ttinfo_dst = tti
+
+ if out.ttinfo_std and out.ttinfo_dst:
+ break
+ else:
+ if out.ttinfo_dst and not out.ttinfo_std:
+ out.ttinfo_std = out.ttinfo_dst
+
+ for tti in out.ttinfo_list:
+ if not tti.isdst:
+ out.ttinfo_before = tti
+ break
+ else:
+ out.ttinfo_before = out.ttinfo_list[0]
+
+ # Now fix transition times to become relative to wall time.
+ #
+ # I'm not sure about this. In my tests, the tz source file
+ # is setup to wall time, and in the binary file isstd and
+ # isgmt are off, so it should be in wall time. OTOH, it's
+ # always in gmt time. Let me know if you have comments
+ # about this.
+ lastdst = None
+ lastoffset = None
+ lastdstoffset = None
+ lastbaseoffset = None
+ out.trans_list = []
+
+ for i, tti in enumerate(out.trans_idx):
+ offset = tti.offset
+ dstoffset = 0
+
+ if lastdst is not None:
+ if tti.isdst:
+ if not lastdst:
+ dstoffset = offset - lastoffset
+
+ if not dstoffset and lastdstoffset:
+ dstoffset = lastdstoffset
+
+ tti.dstoffset = datetime.timedelta(seconds=dstoffset)
+ lastdstoffset = dstoffset
+
+ # If a time zone changes its base offset during a DST transition,
+ # then you need to adjust by the previous base offset to get the
+ # transition time in local time. Otherwise you use the current
+ # base offset. Ideally, I would have some mathematical proof of
+ # why this is true, but I haven't really thought about it enough.
+ baseoffset = offset - dstoffset
+ adjustment = baseoffset
+ if (lastbaseoffset is not None and baseoffset != lastbaseoffset
+ and tti.isdst != lastdst):
+ # The base DST has changed
+ adjustment = lastbaseoffset
+
+ lastdst = tti.isdst
+ lastoffset = offset
+ lastbaseoffset = baseoffset
+
+ out.trans_list.append(out.trans_list_utc[i] + adjustment)
+
+ out.trans_idx = tuple(out.trans_idx)
+ out.trans_list = tuple(out.trans_list)
+ out.trans_list_utc = tuple(out.trans_list_utc)
+
+ return out
+
+ def _find_last_transition(self, dt, in_utc=False):
+ # If there's no list, there are no transitions to find
+ if not self._trans_list:
+ return None
+
+ timestamp = _datetime_to_timestamp(dt)
+
+ # Find where the timestamp fits in the transition list - if the
+ # timestamp is a transition time, it's part of the "after" period.
+ trans_list = self._trans_list_utc if in_utc else self._trans_list
+ idx = bisect.bisect_right(trans_list, timestamp)
+
+ # We want to know when the previous transition was, so subtract off 1
+ return idx - 1
+
+ def _get_ttinfo(self, idx):
+ # For no list or after the last transition, default to _ttinfo_std
+ if idx is None or (idx + 1) >= len(self._trans_list):
+ return self._ttinfo_std
+
+ # If there is a list and the time is before it, return _ttinfo_before
+ if idx < 0:
+ return self._ttinfo_before
+
+ return self._trans_idx[idx]
+
+ def _find_ttinfo(self, dt):
+ idx = self._resolve_ambiguous_time(dt)
+
+ return self._get_ttinfo(idx)
+
+ def fromutc(self, dt):
+ """
+ The ``tzfile`` implementation of :py:func:`datetime.tzinfo.fromutc`.
+
+ :param dt:
+ A :py:class:`datetime.datetime` object.
+
+ :raises TypeError:
+ Raised if ``dt`` is not a :py:class:`datetime.datetime` object.
+
+ :raises ValueError:
+ Raised if this is called with a ``dt`` which does not have this
+ ``tzinfo`` attached.
+
+ :return:
+ Returns a :py:class:`datetime.datetime` object representing the
+ wall time in ``self``'s time zone.
+ """
+ # These isinstance checks are in datetime.tzinfo, so we'll preserve
+ # them, even if we don't care about duck typing.
+ if not isinstance(dt, datetime.datetime):
+ raise TypeError("fromutc() requires a datetime argument")
+
+ if dt.tzinfo is not self:
+ raise ValueError("dt.tzinfo is not self")
+
+ # First treat UTC as wall time and get the transition we're in.
+ idx = self._find_last_transition(dt, in_utc=True)
+ tti = self._get_ttinfo(idx)
+
+ dt_out = dt + datetime.timedelta(seconds=tti.offset)
+
+ fold = self.is_ambiguous(dt_out, idx=idx)
+
+ return enfold(dt_out, fold=int(fold))
+
+ def is_ambiguous(self, dt, idx=None):
+ """
+ Whether or not the "wall time" of a given datetime is ambiguous in this
+ zone.
+
+ :param dt:
+ A :py:class:`datetime.datetime`, naive or time zone aware.
+
+
+ :return:
+ Returns ``True`` if ambiguous, ``False`` otherwise.
+
+ .. versionadded:: 2.6.0
+ """
+ if idx is None:
+ idx = self._find_last_transition(dt)
+
+ # Calculate the difference in offsets from current to previous
+ timestamp = _datetime_to_timestamp(dt)
+ tti = self._get_ttinfo(idx)
+
+ if idx is None or idx <= 0:
+ return False
+
+ od = self._get_ttinfo(idx - 1).offset - tti.offset
+ tt = self._trans_list[idx] # Transition time
+
+ return timestamp < tt + od
+
+ def _resolve_ambiguous_time(self, dt):
+ idx = self._find_last_transition(dt)
+
+ # If we have no transitions, return the index
+ _fold = self._fold(dt)
+ if idx is None or idx == 0:
+ return idx
+
+ # If it's ambiguous and we're in a fold, shift to a different index.
+ idx_offset = int(not _fold and self.is_ambiguous(dt, idx))
+
+ return idx - idx_offset
+
+ def utcoffset(self, dt):
+ if dt is None:
+ return None
+
+ if not self._ttinfo_std:
+ return ZERO
+
+ return self._find_ttinfo(dt).delta
+
+ def dst(self, dt):
+ if dt is None:
+ return None
+
+ if not self._ttinfo_dst:
+ return ZERO
+
+ tti = self._find_ttinfo(dt)
+
+ if not tti.isdst:
+ return ZERO
+
+ # The documentation says that utcoffset()-dst() must
+ # be constant for every dt.
+ return tti.dstoffset
+
+ @tzname_in_python2
+ def tzname(self, dt):
+ if not self._ttinfo_std or dt is None:
+ return None
+ return self._find_ttinfo(dt).abbr
+
+ def __eq__(self, other):
+ if not isinstance(other, tzfile):
+ return NotImplemented
+ return (self._trans_list == other._trans_list and
+ self._trans_idx == other._trans_idx and
+ self._ttinfo_list == other._ttinfo_list)
+
+ __hash__ = None
+
+ def __ne__(self, other):
+ return not (self == other)
+
+ def __repr__(self):
+ return "%s(%s)" % (self.__class__.__name__, repr(self._filename))
+
+ def __reduce__(self):
+ return self.__reduce_ex__(None)
+
+ def __reduce_ex__(self, protocol):
+ return (self.__class__, (None, self._filename), self.__dict__)
+
+
+class tzrange(tzrangebase):
+ """
+ The ``tzrange`` object is a time zone specified by a set of offsets and
+ abbreviations, equivalent to the way the ``TZ`` variable can be specified
+ in POSIX-like systems, but using Python delta objects to specify DST
+ start, end and offsets.
+
+ :param stdabbr:
+ The abbreviation for standard time (e.g. ``'EST'``).
+
+ :param stdoffset:
+ An integer or :class:`datetime.timedelta` object or equivalent
+ specifying the base offset from UTC.
+
+ If unspecified, +00:00 is used.
+
+ :param dstabbr:
+ The abbreviation for DST / "Summer" time (e.g. ``'EDT'``).
+
+ If specified, with no other DST information, DST is assumed to occur
+ and the default behavior or ``dstoffset``, ``start`` and ``end`` is
+ used. If unspecified and no other DST information is specified, it
+ is assumed that this zone has no DST.
+
+ If this is unspecified and other DST information is *is* specified,
+ DST occurs in the zone but the time zone abbreviation is left
+ unchanged.
+
+ :param dstoffset:
+ A an integer or :class:`datetime.timedelta` object or equivalent
+ specifying the UTC offset during DST. If unspecified and any other DST
+ information is specified, it is assumed to be the STD offset +1 hour.
+
+ :param start:
+ A :class:`relativedelta.relativedelta` object or equivalent specifying
+ the time and time of year that daylight savings time starts. To
+ specify, for example, that DST starts at 2AM on the 2nd Sunday in
+ March, pass:
+
+ ``relativedelta(hours=2, month=3, day=1, weekday=SU(+2))``
+
+ If unspecified and any other DST information is specified, the default
+ value is 2 AM on the first Sunday in April.
+
+ :param end:
+ A :class:`relativedelta.relativedelta` object or equivalent
+ representing the time and time of year that daylight savings time
+ ends, with the same specification method as in ``start``. One note is
+ that this should point to the first time in the *standard* zone, so if
+ a transition occurs at 2AM in the DST zone and the clocks are set back
+ 1 hour to 1AM, set the ``hours`` parameter to +1.
+
+
+ **Examples:**
+
+ .. testsetup:: tzrange
+
+ from dateutil.tz import tzrange, tzstr
+
+ .. doctest:: tzrange
+
+ >>> tzstr('EST5EDT') == tzrange("EST", -18000, "EDT")
+ True
+
+ >>> from dateutil.relativedelta import *
+ >>> range1 = tzrange("EST", -18000, "EDT")
+ >>> range2 = tzrange("EST", -18000, "EDT", -14400,
+ ... relativedelta(hours=+2, month=4, day=1,
+ ... weekday=SU(+1)),
+ ... relativedelta(hours=+1, month=10, day=31,
+ ... weekday=SU(-1)))
+ >>> tzstr('EST5EDT') == range1 == range2
+ True
+
+ """
+ def __init__(self, stdabbr, stdoffset=None,
+ dstabbr=None, dstoffset=None,
+ start=None, end=None):
+
+ global relativedelta
+ from dateutil import relativedelta
+
+ self._std_abbr = stdabbr
+ self._dst_abbr = dstabbr
+
+ try:
+ stdoffset = stdoffset.total_seconds()
+ except (TypeError, AttributeError):
+ pass
+
+ try:
+ dstoffset = dstoffset.total_seconds()
+ except (TypeError, AttributeError):
+ pass
+
+ if stdoffset is not None:
+ self._std_offset = datetime.timedelta(seconds=stdoffset)
+ else:
+ self._std_offset = ZERO
+
+ if dstoffset is not None:
+ self._dst_offset = datetime.timedelta(seconds=dstoffset)
+ elif dstabbr and stdoffset is not None:
+ self._dst_offset = self._std_offset + datetime.timedelta(hours=+1)
+ else:
+ self._dst_offset = ZERO
+
+ if dstabbr and start is None:
+ self._start_delta = relativedelta.relativedelta(
+ hours=+2, month=4, day=1, weekday=relativedelta.SU(+1))
+ else:
+ self._start_delta = start
+
+ if dstabbr and end is None:
+ self._end_delta = relativedelta.relativedelta(
+ hours=+1, month=10, day=31, weekday=relativedelta.SU(-1))
+ else:
+ self._end_delta = end
+
+ self._dst_base_offset_ = self._dst_offset - self._std_offset
+ self.hasdst = bool(self._start_delta)
+
+ def transitions(self, year):
+ """
+ For a given year, get the DST on and off transition times, expressed
+ always on the standard time side. For zones with no transitions, this
+ function returns ``None``.
+
+ :param year:
+ The year whose transitions you would like to query.
+
+ :return:
+ Returns a :class:`tuple` of :class:`datetime.datetime` objects,
+ ``(dston, dstoff)`` for zones with an annual DST transition, or
+ ``None`` for fixed offset zones.
+ """
+ if not self.hasdst:
+ return None
+
+ base_year = datetime.datetime(year, 1, 1)
+
+ start = base_year + self._start_delta
+ end = base_year + self._end_delta
+
+ return (start, end)
+
+ def __eq__(self, other):
+ if not isinstance(other, tzrange):
+ return NotImplemented
+
+ return (self._std_abbr == other._std_abbr and
+ self._dst_abbr == other._dst_abbr and
+ self._std_offset == other._std_offset and
+ self._dst_offset == other._dst_offset and
+ self._start_delta == other._start_delta and
+ self._end_delta == other._end_delta)
+
+ @property
+ def _dst_base_offset(self):
+ return self._dst_base_offset_
+
+
+@six.add_metaclass(_TzStrFactory)
+class tzstr(tzrange):
+ """
+ ``tzstr`` objects are time zone objects specified by a time-zone string as
+ it would be passed to a ``TZ`` variable on POSIX-style systems (see
+ the `GNU C Library: TZ Variable`_ for more details).
+
+ There is one notable exception, which is that POSIX-style time zones use an
+ inverted offset format, so normally ``GMT+3`` would be parsed as an offset
+ 3 hours *behind* GMT. The ``tzstr`` time zone object will parse this as an
+ offset 3 hours *ahead* of GMT. If you would like to maintain the POSIX
+ behavior, pass a ``True`` value to ``posix_offset``.
+
+ The :class:`tzrange` object provides the same functionality, but is
+ specified using :class:`relativedelta.relativedelta` objects. rather than
+ strings.
+
+ :param s:
+ A time zone string in ``TZ`` variable format. This can be a
+ :class:`bytes` (2.x: :class:`str`), :class:`str` (2.x:
+ :class:`unicode`) or a stream emitting unicode characters
+ (e.g. :class:`StringIO`).
+
+ :param posix_offset:
+ Optional. If set to ``True``, interpret strings such as ``GMT+3`` or
+ ``UTC+3`` as being 3 hours *behind* UTC rather than ahead, per the
+ POSIX standard.
+
+ .. caution::
+
+ Prior to version 2.7.0, this function also supported time zones
+ in the format:
+
+ * ``EST5EDT,4,0,6,7200,10,0,26,7200,3600``
+ * ``EST5EDT,4,1,0,7200,10,-1,0,7200,3600``
+
+ This format is non-standard and has been deprecated; this function
+ will raise a :class:`DeprecatedTZFormatWarning` until
+ support is removed in a future version.
+
+ .. _`GNU C Library: TZ Variable`:
+ https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
+ """
+ def __init__(self, s, posix_offset=False):
+ global parser
+ from dateutil.parser import _parser as parser
+
+ self._s = s
+
+ res = parser._parsetz(s)
+ if res is None or res.any_unused_tokens:
+ raise ValueError("unknown string format")
+
+ # Here we break the compatibility with the TZ variable handling.
+ # GMT-3 actually *means* the timezone -3.
+ if res.stdabbr in ("GMT", "UTC") and not posix_offset:
+ res.stdoffset *= -1
+
+ # We must initialize it first, since _delta() needs
+ # _std_offset and _dst_offset set. Use False in start/end
+ # to avoid building it two times.
+ tzrange.__init__(self, res.stdabbr, res.stdoffset,
+ res.dstabbr, res.dstoffset,
+ start=False, end=False)
+
+ if not res.dstabbr:
+ self._start_delta = None
+ self._end_delta = None
+ else:
+ self._start_delta = self._delta(res.start)
+ if self._start_delta:
+ self._end_delta = self._delta(res.end, isend=1)
+
+ self.hasdst = bool(self._start_delta)
+
+ def _delta(self, x, isend=0):
+ from dateutil import relativedelta
+ kwargs = {}
+ if x.month is not None:
+ kwargs["month"] = x.month
+ if x.weekday is not None:
+ kwargs["weekday"] = relativedelta.weekday(x.weekday, x.week)
+ if x.week > 0:
+ kwargs["day"] = 1
+ else:
+ kwargs["day"] = 31
+ elif x.day:
+ kwargs["day"] = x.day
+ elif x.yday is not None:
+ kwargs["yearday"] = x.yday
+ elif x.jyday is not None:
+ kwargs["nlyearday"] = x.jyday
+ if not kwargs:
+ # Default is to start on first sunday of april, and end
+ # on last sunday of october.
+ if not isend:
+ kwargs["month"] = 4
+ kwargs["day"] = 1
+ kwargs["weekday"] = relativedelta.SU(+1)
+ else:
+ kwargs["month"] = 10
+ kwargs["day"] = 31
+ kwargs["weekday"] = relativedelta.SU(-1)
+ if x.time is not None:
+ kwargs["seconds"] = x.time
+ else:
+ # Default is 2AM.
+ kwargs["seconds"] = 7200
+ if isend:
+ # Convert to standard time, to follow the documented way
+ # of working with the extra hour. See the documentation
+ # of the tzinfo class.
+ delta = self._dst_offset - self._std_offset
+ kwargs["seconds"] -= delta.seconds + delta.days * 86400
+ return relativedelta.relativedelta(**kwargs)
+
+ def __repr__(self):
+ return "%s(%s)" % (self.__class__.__name__, repr(self._s))
+
+
+class _tzicalvtzcomp(object):
+ def __init__(self, tzoffsetfrom, tzoffsetto, isdst,
+ tzname=None, rrule=None):
+ self.tzoffsetfrom = datetime.timedelta(seconds=tzoffsetfrom)
+ self.tzoffsetto = datetime.timedelta(seconds=tzoffsetto)
+ self.tzoffsetdiff = self.tzoffsetto - self.tzoffsetfrom
+ self.isdst = isdst
+ self.tzname = tzname
+ self.rrule = rrule
+
+
+class _tzicalvtz(_tzinfo):
+ def __init__(self, tzid, comps=[]):
+ super(_tzicalvtz, self).__init__()
+
+ self._tzid = tzid
+ self._comps = comps
+ self._cachedate = []
+ self._cachecomp = []
+ self._cache_lock = _thread.allocate_lock()
+
+ def _find_comp(self, dt):
+ if len(self._comps) == 1:
+ return self._comps[0]
+
+ dt = dt.replace(tzinfo=None)
+
+ try:
+ with self._cache_lock:
+ return self._cachecomp[self._cachedate.index(
+ (dt, self._fold(dt)))]
+ except ValueError:
+ pass
+
+ lastcompdt = None
+ lastcomp = None
+
+ for comp in self._comps:
+ compdt = self._find_compdt(comp, dt)
+
+ if compdt and (not lastcompdt or lastcompdt < compdt):
+ lastcompdt = compdt
+ lastcomp = comp
+
+ if not lastcomp:
+ # RFC says nothing about what to do when a given
+ # time is before the first onset date. We'll look for the
+ # first standard component, or the first component, if
+ # none is found.
+ for comp in self._comps:
+ if not comp.isdst:
+ lastcomp = comp
+ break
+ else:
+ lastcomp = comp[0]
+
+ with self._cache_lock:
+ self._cachedate.insert(0, (dt, self._fold(dt)))
+ self._cachecomp.insert(0, lastcomp)
+
+ if len(self._cachedate) > 10:
+ self._cachedate.pop()
+ self._cachecomp.pop()
+
+ return lastcomp
+
+ def _find_compdt(self, comp, dt):
+ if comp.tzoffsetdiff < ZERO and self._fold(dt):
+ dt -= comp.tzoffsetdiff
+
+ compdt = comp.rrule.before(dt, inc=True)
+
+ return compdt
+
+ def utcoffset(self, dt):
+ if dt is None:
+ return None
+
+ return self._find_comp(dt).tzoffsetto
+
+ def dst(self, dt):
+ comp = self._find_comp(dt)
+ if comp.isdst:
+ return comp.tzoffsetdiff
+ else:
+ return ZERO
+
+ @tzname_in_python2
+ def tzname(self, dt):
+ return self._find_comp(dt).tzname
+
+ def __repr__(self):
+ return "" % repr(self._tzid)
+
+ __reduce__ = object.__reduce__
+
+
+class tzical(object):
+ """
+ This object is designed to parse an iCalendar-style ``VTIMEZONE`` structure
+ as set out in `RFC 5545`_ Section 4.6.5 into one or more `tzinfo` objects.
+
+ :param `fileobj`:
+ A file or stream in iCalendar format, which should be UTF-8 encoded
+ with CRLF endings.
+
+ .. _`RFC 5545`: https://tools.ietf.org/html/rfc5545
+ """
+ def __init__(self, fileobj):
+ global rrule
+ from dateutil import rrule
+
+ if isinstance(fileobj, string_types):
+ self._s = fileobj
+ # ical should be encoded in UTF-8 with CRLF
+ fileobj = open(fileobj, 'r')
+ else:
+ self._s = getattr(fileobj, 'name', repr(fileobj))
+ fileobj = _nullcontext(fileobj)
+
+ self._vtz = {}
+
+ with fileobj as fobj:
+ self._parse_rfc(fobj.read())
+
+ def keys(self):
+ """
+ Retrieves the available time zones as a list.
+ """
+ return list(self._vtz.keys())
+
+ def get(self, tzid=None):
+ """
+ Retrieve a :py:class:`datetime.tzinfo` object by its ``tzid``.
+
+ :param tzid:
+ If there is exactly one time zone available, omitting ``tzid``
+ or passing :py:const:`None` value returns it. Otherwise a valid
+ key (which can be retrieved from :func:`keys`) is required.
+
+ :raises ValueError:
+ Raised if ``tzid`` is not specified but there are either more
+ or fewer than 1 zone defined.
+
+ :returns:
+ Returns either a :py:class:`datetime.tzinfo` object representing
+ the relevant time zone or :py:const:`None` if the ``tzid`` was
+ not found.
+ """
+ if tzid is None:
+ if len(self._vtz) == 0:
+ raise ValueError("no timezones defined")
+ elif len(self._vtz) > 1:
+ raise ValueError("more than one timezone available")
+ tzid = next(iter(self._vtz))
+
+ return self._vtz.get(tzid)
+
+ def _parse_offset(self, s):
+ s = s.strip()
+ if not s:
+ raise ValueError("empty offset")
+ if s[0] in ('+', '-'):
+ signal = (-1, +1)[s[0] == '+']
+ s = s[1:]
+ else:
+ signal = +1
+ if len(s) == 4:
+ return (int(s[:2]) * 3600 + int(s[2:]) * 60) * signal
+ elif len(s) == 6:
+ return (int(s[:2]) * 3600 + int(s[2:4]) * 60 + int(s[4:])) * signal
+ else:
+ raise ValueError("invalid offset: " + s)
+
+ def _parse_rfc(self, s):
+ lines = s.splitlines()
+ if not lines:
+ raise ValueError("empty string")
+
+ # Unfold
+ i = 0
+ while i < len(lines):
+ line = lines[i].rstrip()
+ if not line:
+ del lines[i]
+ elif i > 0 and line[0] == " ":
+ lines[i-1] += line[1:]
+ del lines[i]
+ else:
+ i += 1
+
+ tzid = None
+ comps = []
+ invtz = False
+ comptype = None
+ for line in lines:
+ if not line:
+ continue
+ name, value = line.split(':', 1)
+ parms = name.split(';')
+ if not parms:
+ raise ValueError("empty property name")
+ name = parms[0].upper()
+ parms = parms[1:]
+ if invtz:
+ if name == "BEGIN":
+ if value in ("STANDARD", "DAYLIGHT"):
+ # Process component
+ pass
+ else:
+ raise ValueError("unknown component: "+value)
+ comptype = value
+ founddtstart = False
+ tzoffsetfrom = None
+ tzoffsetto = None
+ rrulelines = []
+ tzname = None
+ elif name == "END":
+ if value == "VTIMEZONE":
+ if comptype:
+ raise ValueError("component not closed: "+comptype)
+ if not tzid:
+ raise ValueError("mandatory TZID not found")
+ if not comps:
+ raise ValueError(
+ "at least one component is needed")
+ # Process vtimezone
+ self._vtz[tzid] = _tzicalvtz(tzid, comps)
+ invtz = False
+ elif value == comptype:
+ if not founddtstart:
+ raise ValueError("mandatory DTSTART not found")
+ if tzoffsetfrom is None:
+ raise ValueError(
+ "mandatory TZOFFSETFROM not found")
+ if tzoffsetto is None:
+ raise ValueError(
+ "mandatory TZOFFSETFROM not found")
+ # Process component
+ rr = None
+ if rrulelines:
+ rr = rrule.rrulestr("\n".join(rrulelines),
+ compatible=True,
+ ignoretz=True,
+ cache=True)
+ comp = _tzicalvtzcomp(tzoffsetfrom, tzoffsetto,
+ (comptype == "DAYLIGHT"),
+ tzname, rr)
+ comps.append(comp)
+ comptype = None
+ else:
+ raise ValueError("invalid component end: "+value)
+ elif comptype:
+ if name == "DTSTART":
+ # DTSTART in VTIMEZONE takes a subset of valid RRULE
+ # values under RFC 5545.
+ for parm in parms:
+ if parm != 'VALUE=DATE-TIME':
+ msg = ('Unsupported DTSTART param in ' +
+ 'VTIMEZONE: ' + parm)
+ raise ValueError(msg)
+ rrulelines.append(line)
+ founddtstart = True
+ elif name in ("RRULE", "RDATE", "EXRULE", "EXDATE"):
+ rrulelines.append(line)
+ elif name == "TZOFFSETFROM":
+ if parms:
+ raise ValueError(
+ "unsupported %s parm: %s " % (name, parms[0]))
+ tzoffsetfrom = self._parse_offset(value)
+ elif name == "TZOFFSETTO":
+ if parms:
+ raise ValueError(
+ "unsupported TZOFFSETTO parm: "+parms[0])
+ tzoffsetto = self._parse_offset(value)
+ elif name == "TZNAME":
+ if parms:
+ raise ValueError(
+ "unsupported TZNAME parm: "+parms[0])
+ tzname = value
+ elif name == "COMMENT":
+ pass
+ else:
+ raise ValueError("unsupported property: "+name)
+ else:
+ if name == "TZID":
+ if parms:
+ raise ValueError(
+ "unsupported TZID parm: "+parms[0])
+ tzid = value
+ elif name in ("TZURL", "LAST-MODIFIED", "COMMENT"):
+ pass
+ else:
+ raise ValueError("unsupported property: "+name)
+ elif name == "BEGIN" and value == "VTIMEZONE":
+ tzid = None
+ comps = []
+ invtz = True
+
+ def __repr__(self):
+ return "%s(%s)" % (self.__class__.__name__, repr(self._s))
+
+
+if sys.platform != "win32":
+ TZFILES = ["/etc/localtime", "localtime"]
+ TZPATHS = ["/usr/share/zoneinfo",
+ "/usr/lib/zoneinfo",
+ "/usr/share/lib/zoneinfo",
+ "/etc/zoneinfo"]
+else:
+ TZFILES = []
+ TZPATHS = []
+
+
+def __get_gettz():
+ tzlocal_classes = (tzlocal,)
+ if tzwinlocal is not None:
+ tzlocal_classes += (tzwinlocal,)
+
+ class GettzFunc(object):
+ """
+ Retrieve a time zone object from a string representation
+
+ This function is intended to retrieve the :py:class:`tzinfo` subclass
+ that best represents the time zone that would be used if a POSIX
+ `TZ variable`_ were set to the same value.
+
+ If no argument or an empty string is passed to ``gettz``, local time
+ is returned:
+
+ .. code-block:: python3
+
+ >>> gettz()
+ tzfile('/etc/localtime')
+
+ This function is also the preferred way to map IANA tz database keys
+ to :class:`tzfile` objects:
+
+ .. code-block:: python3
+
+ >>> gettz('Pacific/Kiritimati')
+ tzfile('/usr/share/zoneinfo/Pacific/Kiritimati')
+
+ On Windows, the standard is extended to include the Windows-specific
+ zone names provided by the operating system:
+
+ .. code-block:: python3
+
+ >>> gettz('Egypt Standard Time')
+ tzwin('Egypt Standard Time')
+
+ Passing a GNU ``TZ`` style string time zone specification returns a
+ :class:`tzstr` object:
+
+ .. code-block:: python3
+
+ >>> gettz('AEST-10AEDT-11,M10.1.0/2,M4.1.0/3')
+ tzstr('AEST-10AEDT-11,M10.1.0/2,M4.1.0/3')
+
+ :param name:
+ A time zone name (IANA, or, on Windows, Windows keys), location of
+ a ``tzfile(5)`` zoneinfo file or ``TZ`` variable style time zone
+ specifier. An empty string, no argument or ``None`` is interpreted
+ as local time.
+
+ :return:
+ Returns an instance of one of ``dateutil``'s :py:class:`tzinfo`
+ subclasses.
+
+ .. versionchanged:: 2.7.0
+
+ After version 2.7.0, any two calls to ``gettz`` using the same
+ input strings will return the same object:
+
+ .. code-block:: python3
+
+ >>> tz.gettz('America/Chicago') is tz.gettz('America/Chicago')
+ True
+
+ In addition to improving performance, this ensures that
+ `"same zone" semantics`_ are used for datetimes in the same zone.
+
+
+ .. _`TZ variable`:
+ https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
+
+ .. _`"same zone" semantics`:
+ https://blog.ganssle.io/articles/2018/02/aware-datetime-arithmetic.html
+ """
+ def __init__(self):
+
+ self.__instances = weakref.WeakValueDictionary()
+ self.__strong_cache_size = 8
+ self.__strong_cache = OrderedDict()
+ self._cache_lock = _thread.allocate_lock()
+
+ def __call__(self, name=None):
+ with self._cache_lock:
+ rv = self.__instances.get(name, None)
+
+ if rv is None:
+ rv = self.nocache(name=name)
+ if not (name is None
+ or isinstance(rv, tzlocal_classes)
+ or rv is None):
+ # tzlocal is slightly more complicated than the other
+ # time zone providers because it depends on environment
+ # at construction time, so don't cache that.
+ #
+ # We also cannot store weak references to None, so we
+ # will also not store that.
+ self.__instances[name] = rv
+ else:
+ # No need for strong caching, return immediately
+ return rv
+
+ self.__strong_cache[name] = self.__strong_cache.pop(name, rv)
+
+ if len(self.__strong_cache) > self.__strong_cache_size:
+ self.__strong_cache.popitem(last=False)
+
+ return rv
+
+ def set_cache_size(self, size):
+ with self._cache_lock:
+ self.__strong_cache_size = size
+ while len(self.__strong_cache) > size:
+ self.__strong_cache.popitem(last=False)
+
+ def cache_clear(self):
+ with self._cache_lock:
+ self.__instances = weakref.WeakValueDictionary()
+ self.__strong_cache.clear()
+
+ @staticmethod
+ def nocache(name=None):
+ """A non-cached version of gettz"""
+ tz = None
+ if not name:
+ try:
+ name = os.environ["TZ"]
+ except KeyError:
+ pass
+ if name is None or name == ":":
+ for filepath in TZFILES:
+ if not os.path.isabs(filepath):
+ filename = filepath
+ for path in TZPATHS:
+ filepath = os.path.join(path, filename)
+ if os.path.isfile(filepath):
+ break
+ else:
+ continue
+ if os.path.isfile(filepath):
+ try:
+ tz = tzfile(filepath)
+ break
+ except (IOError, OSError, ValueError):
+ pass
+ else:
+ tz = tzlocal()
+ else:
+ try:
+ if name.startswith(":"):
+ name = name[1:]
+ except TypeError as e:
+ if isinstance(name, bytes):
+ new_msg = "gettz argument should be str, not bytes"
+ six.raise_from(TypeError(new_msg), e)
+ else:
+ raise
+ if os.path.isabs(name):
+ if os.path.isfile(name):
+ tz = tzfile(name)
+ else:
+ tz = None
+ else:
+ for path in TZPATHS:
+ filepath = os.path.join(path, name)
+ if not os.path.isfile(filepath):
+ filepath = filepath.replace(' ', '_')
+ if not os.path.isfile(filepath):
+ continue
+ try:
+ tz = tzfile(filepath)
+ break
+ except (IOError, OSError, ValueError):
+ pass
+ else:
+ tz = None
+ if tzwin is not None:
+ try:
+ tz = tzwin(name)
+ except (WindowsError, UnicodeEncodeError):
+ # UnicodeEncodeError is for Python 2.7 compat
+ tz = None
+
+ if not tz:
+ from dateutil.zoneinfo import get_zonefile_instance
+ tz = get_zonefile_instance().get(name)
+
+ if not tz:
+ for c in name:
+ # name is not a tzstr unless it has at least
+ # one offset. For short values of "name", an
+ # explicit for loop seems to be the fastest way
+ # To determine if a string contains a digit
+ if c in "0123456789":
+ try:
+ tz = tzstr(name)
+ except ValueError:
+ pass
+ break
+ else:
+ if name in ("GMT", "UTC"):
+ tz = UTC
+ elif name in time.tzname:
+ tz = tzlocal()
+ return tz
+
+ return GettzFunc()
+
+
+gettz = __get_gettz()
+del __get_gettz
+
+
+def datetime_exists(dt, tz=None):
+ """
+ Given a datetime and a time zone, determine whether or not a given datetime
+ would fall in a gap.
+
+ :param dt:
+ A :class:`datetime.datetime` (whose time zone will be ignored if ``tz``
+ is provided.)
+
+ :param tz:
+ A :class:`datetime.tzinfo` with support for the ``fold`` attribute. If
+ ``None`` or not provided, the datetime's own time zone will be used.
+
+ :return:
+ Returns a boolean value whether or not the "wall time" exists in
+ ``tz``.
+
+ .. versionadded:: 2.7.0
+ """
+ if tz is None:
+ if dt.tzinfo is None:
+ raise ValueError('Datetime is naive and no time zone provided.')
+ tz = dt.tzinfo
+
+ dt = dt.replace(tzinfo=None)
+
+ # This is essentially a test of whether or not the datetime can survive
+ # a round trip to UTC.
+ dt_rt = dt.replace(tzinfo=tz).astimezone(UTC).astimezone(tz)
+ dt_rt = dt_rt.replace(tzinfo=None)
+
+ return dt == dt_rt
+
+
+def datetime_ambiguous(dt, tz=None):
+ """
+ Given a datetime and a time zone, determine whether or not a given datetime
+ is ambiguous (i.e if there are two times differentiated only by their DST
+ status).
+
+ :param dt:
+ A :class:`datetime.datetime` (whose time zone will be ignored if ``tz``
+ is provided.)
+
+ :param tz:
+ A :class:`datetime.tzinfo` with support for the ``fold`` attribute. If
+ ``None`` or not provided, the datetime's own time zone will be used.
+
+ :return:
+ Returns a boolean value whether or not the "wall time" is ambiguous in
+ ``tz``.
+
+ .. versionadded:: 2.6.0
+ """
+ if tz is None:
+ if dt.tzinfo is None:
+ raise ValueError('Datetime is naive and no time zone provided.')
+
+ tz = dt.tzinfo
+
+ # If a time zone defines its own "is_ambiguous" function, we'll use that.
+ is_ambiguous_fn = getattr(tz, 'is_ambiguous', None)
+ if is_ambiguous_fn is not None:
+ try:
+ return tz.is_ambiguous(dt)
+ except Exception:
+ pass
+
+ # If it doesn't come out and tell us it's ambiguous, we'll just check if
+ # the fold attribute has any effect on this particular date and time.
+ dt = dt.replace(tzinfo=tz)
+ wall_0 = enfold(dt, fold=0)
+ wall_1 = enfold(dt, fold=1)
+
+ same_offset = wall_0.utcoffset() == wall_1.utcoffset()
+ same_dst = wall_0.dst() == wall_1.dst()
+
+ return not (same_offset and same_dst)
+
+
+def resolve_imaginary(dt):
+ """
+ Given a datetime that may be imaginary, return an existing datetime.
+
+ This function assumes that an imaginary datetime represents what the
+ wall time would be in a zone had the offset transition not occurred, so
+ it will always fall forward by the transition's change in offset.
+
+ .. doctest::
+
+ >>> from dateutil import tz
+ >>> from datetime import datetime
+ >>> NYC = tz.gettz('America/New_York')
+ >>> print(tz.resolve_imaginary(datetime(2017, 3, 12, 2, 30, tzinfo=NYC)))
+ 2017-03-12 03:30:00-04:00
+
+ >>> KIR = tz.gettz('Pacific/Kiritimati')
+ >>> print(tz.resolve_imaginary(datetime(1995, 1, 1, 12, 30, tzinfo=KIR)))
+ 1995-01-02 12:30:00+14:00
+
+ As a note, :func:`datetime.astimezone` is guaranteed to produce a valid,
+ existing datetime, so a round-trip to and from UTC is sufficient to get
+ an extant datetime, however, this generally "falls back" to an earlier time
+ rather than falling forward to the STD side (though no guarantees are made
+ about this behavior).
+
+ :param dt:
+ A :class:`datetime.datetime` which may or may not exist.
+
+ :return:
+ Returns an existing :class:`datetime.datetime`. If ``dt`` was not
+ imaginary, the datetime returned is guaranteed to be the same object
+ passed to the function.
+
+ .. versionadded:: 2.7.0
+ """
+ if dt.tzinfo is not None and not datetime_exists(dt):
+
+ curr_offset = (dt + datetime.timedelta(hours=24)).utcoffset()
+ old_offset = (dt - datetime.timedelta(hours=24)).utcoffset()
+
+ dt += curr_offset - old_offset
+
+ return dt
+
+
+def _datetime_to_timestamp(dt):
+ """
+ Convert a :class:`datetime.datetime` object to an epoch timestamp in
+ seconds since January 1, 1970, ignoring the time zone.
+ """
+ return (dt.replace(tzinfo=None) - EPOCH).total_seconds()
+
+
+if sys.version_info >= (3, 6):
+ def _get_supported_offset(second_offset):
+ return second_offset
+else:
+ def _get_supported_offset(second_offset):
+ # For python pre-3.6, round to full-minutes if that's not the case.
+ # Python's datetime doesn't accept sub-minute timezones. Check
+ # http://python.org/sf/1447945 or https://bugs.python.org/issue5288
+ # for some information.
+ old_offset = second_offset
+ calculated_offset = 60 * ((second_offset + 30) // 60)
+ return calculated_offset
+
+
+try:
+ # Python 3.7 feature
+ from contextlib import nullcontext as _nullcontext
+except ImportError:
+ class _nullcontext(object):
+ """
+ Class for wrapping contexts so that they are passed through in a
+ with statement.
+ """
+ def __init__(self, context):
+ self.context = context
+
+ def __enter__(self):
+ return self.context
+
+ def __exit__(*args, **kwargs):
+ pass
+
+# vim:ts=4:sw=4:et
diff --git a/venv/Lib/site-packages/dateutil/tz/win.py b/venv/Lib/site-packages/dateutil/tz/win.py
new file mode 100644
index 0000000..cde07ba
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/tz/win.py
@@ -0,0 +1,370 @@
+# -*- coding: utf-8 -*-
+"""
+This module provides an interface to the native time zone data on Windows,
+including :py:class:`datetime.tzinfo` implementations.
+
+Attempting to import this module on a non-Windows platform will raise an
+:py:obj:`ImportError`.
+"""
+# This code was originally contributed by Jeffrey Harris.
+import datetime
+import struct
+
+from six.moves import winreg
+from six import text_type
+
+try:
+ import ctypes
+ from ctypes import wintypes
+except ValueError:
+ # ValueError is raised on non-Windows systems for some horrible reason.
+ raise ImportError("Running tzwin on non-Windows system")
+
+from ._common import tzrangebase
+
+__all__ = ["tzwin", "tzwinlocal", "tzres"]
+
+ONEWEEK = datetime.timedelta(7)
+
+TZKEYNAMENT = r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones"
+TZKEYNAME9X = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Time Zones"
+TZLOCALKEYNAME = r"SYSTEM\CurrentControlSet\Control\TimeZoneInformation"
+
+
+def _settzkeyname():
+ handle = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
+ try:
+ winreg.OpenKey(handle, TZKEYNAMENT).Close()
+ TZKEYNAME = TZKEYNAMENT
+ except WindowsError:
+ TZKEYNAME = TZKEYNAME9X
+ handle.Close()
+ return TZKEYNAME
+
+
+TZKEYNAME = _settzkeyname()
+
+
+class tzres(object):
+ """
+ Class for accessing ``tzres.dll``, which contains timezone name related
+ resources.
+
+ .. versionadded:: 2.5.0
+ """
+ p_wchar = ctypes.POINTER(wintypes.WCHAR) # Pointer to a wide char
+
+ def __init__(self, tzres_loc='tzres.dll'):
+ # Load the user32 DLL so we can load strings from tzres
+ user32 = ctypes.WinDLL('user32')
+
+ # Specify the LoadStringW function
+ user32.LoadStringW.argtypes = (wintypes.HINSTANCE,
+ wintypes.UINT,
+ wintypes.LPWSTR,
+ ctypes.c_int)
+
+ self.LoadStringW = user32.LoadStringW
+ self._tzres = ctypes.WinDLL(tzres_loc)
+ self.tzres_loc = tzres_loc
+
+ def load_name(self, offset):
+ """
+ Load a timezone name from a DLL offset (integer).
+
+ >>> from dateutil.tzwin import tzres
+ >>> tzr = tzres()
+ >>> print(tzr.load_name(112))
+ 'Eastern Standard Time'
+
+ :param offset:
+ A positive integer value referring to a string from the tzres dll.
+
+ .. note::
+
+ Offsets found in the registry are generally of the form
+ ``@tzres.dll,-114``. The offset in this case is 114, not -114.
+
+ """
+ resource = self.p_wchar()
+ lpBuffer = ctypes.cast(ctypes.byref(resource), wintypes.LPWSTR)
+ nchar = self.LoadStringW(self._tzres._handle, offset, lpBuffer, 0)
+ return resource[:nchar]
+
+ def name_from_string(self, tzname_str):
+ """
+ Parse strings as returned from the Windows registry into the time zone
+ name as defined in the registry.
+
+ >>> from dateutil.tzwin import tzres
+ >>> tzr = tzres()
+ >>> print(tzr.name_from_string('@tzres.dll,-251'))
+ 'Dateline Daylight Time'
+ >>> print(tzr.name_from_string('Eastern Standard Time'))
+ 'Eastern Standard Time'
+
+ :param tzname_str:
+ A timezone name string as returned from a Windows registry key.
+
+ :return:
+ Returns the localized timezone string from tzres.dll if the string
+ is of the form `@tzres.dll,-offset`, else returns the input string.
+ """
+ if not tzname_str.startswith('@'):
+ return tzname_str
+
+ name_splt = tzname_str.split(',-')
+ try:
+ offset = int(name_splt[1])
+ except:
+ raise ValueError("Malformed timezone string.")
+
+ return self.load_name(offset)
+
+
+class tzwinbase(tzrangebase):
+ """tzinfo class based on win32's timezones available in the registry."""
+ def __init__(self):
+ raise NotImplementedError('tzwinbase is an abstract base class')
+
+ def __eq__(self, other):
+ # Compare on all relevant dimensions, including name.
+ if not isinstance(other, tzwinbase):
+ return NotImplemented
+
+ return (self._std_offset == other._std_offset and
+ self._dst_offset == other._dst_offset and
+ self._stddayofweek == other._stddayofweek and
+ self._dstdayofweek == other._dstdayofweek and
+ self._stdweeknumber == other._stdweeknumber and
+ self._dstweeknumber == other._dstweeknumber and
+ self._stdhour == other._stdhour and
+ self._dsthour == other._dsthour and
+ self._stdminute == other._stdminute and
+ self._dstminute == other._dstminute and
+ self._std_abbr == other._std_abbr and
+ self._dst_abbr == other._dst_abbr)
+
+ @staticmethod
+ def list():
+ """Return a list of all time zones known to the system."""
+ with winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) as handle:
+ with winreg.OpenKey(handle, TZKEYNAME) as tzkey:
+ result = [winreg.EnumKey(tzkey, i)
+ for i in range(winreg.QueryInfoKey(tzkey)[0])]
+ return result
+
+ def display(self):
+ """
+ Return the display name of the time zone.
+ """
+ return self._display
+
+ def transitions(self, year):
+ """
+ For a given year, get the DST on and off transition times, expressed
+ always on the standard time side. For zones with no transitions, this
+ function returns ``None``.
+
+ :param year:
+ The year whose transitions you would like to query.
+
+ :return:
+ Returns a :class:`tuple` of :class:`datetime.datetime` objects,
+ ``(dston, dstoff)`` for zones with an annual DST transition, or
+ ``None`` for fixed offset zones.
+ """
+
+ if not self.hasdst:
+ return None
+
+ dston = picknthweekday(year, self._dstmonth, self._dstdayofweek,
+ self._dsthour, self._dstminute,
+ self._dstweeknumber)
+
+ dstoff = picknthweekday(year, self._stdmonth, self._stddayofweek,
+ self._stdhour, self._stdminute,
+ self._stdweeknumber)
+
+ # Ambiguous dates default to the STD side
+ dstoff -= self._dst_base_offset
+
+ return dston, dstoff
+
+ def _get_hasdst(self):
+ return self._dstmonth != 0
+
+ @property
+ def _dst_base_offset(self):
+ return self._dst_base_offset_
+
+
+class tzwin(tzwinbase):
+ """
+ Time zone object created from the zone info in the Windows registry
+
+ These are similar to :py:class:`dateutil.tz.tzrange` objects in that
+ the time zone data is provided in the format of a single offset rule
+ for either 0 or 2 time zone transitions per year.
+
+ :param: name
+ The name of a Windows time zone key, e.g. "Eastern Standard Time".
+ The full list of keys can be retrieved with :func:`tzwin.list`.
+ """
+
+ def __init__(self, name):
+ self._name = name
+
+ with winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) as handle:
+ tzkeyname = text_type("{kn}\\{name}").format(kn=TZKEYNAME, name=name)
+ with winreg.OpenKey(handle, tzkeyname) as tzkey:
+ keydict = valuestodict(tzkey)
+
+ self._std_abbr = keydict["Std"]
+ self._dst_abbr = keydict["Dlt"]
+
+ self._display = keydict["Display"]
+
+ # See http://ww_winreg.jsiinc.com/SUBA/tip0300/rh0398.htm
+ tup = struct.unpack("=3l16h", keydict["TZI"])
+ stdoffset = -tup[0]-tup[1] # Bias + StandardBias * -1
+ dstoffset = stdoffset-tup[2] # + DaylightBias * -1
+ self._std_offset = datetime.timedelta(minutes=stdoffset)
+ self._dst_offset = datetime.timedelta(minutes=dstoffset)
+
+ # for the meaning see the win32 TIME_ZONE_INFORMATION structure docs
+ # http://msdn.microsoft.com/en-us/library/windows/desktop/ms725481(v=vs.85).aspx
+ (self._stdmonth,
+ self._stddayofweek, # Sunday = 0
+ self._stdweeknumber, # Last = 5
+ self._stdhour,
+ self._stdminute) = tup[4:9]
+
+ (self._dstmonth,
+ self._dstdayofweek, # Sunday = 0
+ self._dstweeknumber, # Last = 5
+ self._dsthour,
+ self._dstminute) = tup[12:17]
+
+ self._dst_base_offset_ = self._dst_offset - self._std_offset
+ self.hasdst = self._get_hasdst()
+
+ def __repr__(self):
+ return "tzwin(%s)" % repr(self._name)
+
+ def __reduce__(self):
+ return (self.__class__, (self._name,))
+
+
+class tzwinlocal(tzwinbase):
+ """
+ Class representing the local time zone information in the Windows registry
+
+ While :class:`dateutil.tz.tzlocal` makes system calls (via the :mod:`time`
+ module) to retrieve time zone information, ``tzwinlocal`` retrieves the
+ rules directly from the Windows registry and creates an object like
+ :class:`dateutil.tz.tzwin`.
+
+ Because Windows does not have an equivalent of :func:`time.tzset`, on
+ Windows, :class:`dateutil.tz.tzlocal` instances will always reflect the
+ time zone settings *at the time that the process was started*, meaning
+ changes to the machine's time zone settings during the run of a program
+ on Windows will **not** be reflected by :class:`dateutil.tz.tzlocal`.
+ Because ``tzwinlocal`` reads the registry directly, it is unaffected by
+ this issue.
+ """
+ def __init__(self):
+ with winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) as handle:
+ with winreg.OpenKey(handle, TZLOCALKEYNAME) as tzlocalkey:
+ keydict = valuestodict(tzlocalkey)
+
+ self._std_abbr = keydict["StandardName"]
+ self._dst_abbr = keydict["DaylightName"]
+
+ try:
+ tzkeyname = text_type('{kn}\\{sn}').format(kn=TZKEYNAME,
+ sn=self._std_abbr)
+ with winreg.OpenKey(handle, tzkeyname) as tzkey:
+ _keydict = valuestodict(tzkey)
+ self._display = _keydict["Display"]
+ except OSError:
+ self._display = None
+
+ stdoffset = -keydict["Bias"]-keydict["StandardBias"]
+ dstoffset = stdoffset-keydict["DaylightBias"]
+
+ self._std_offset = datetime.timedelta(minutes=stdoffset)
+ self._dst_offset = datetime.timedelta(minutes=dstoffset)
+
+ # For reasons unclear, in this particular key, the day of week has been
+ # moved to the END of the SYSTEMTIME structure.
+ tup = struct.unpack("=8h", keydict["StandardStart"])
+
+ (self._stdmonth,
+ self._stdweeknumber, # Last = 5
+ self._stdhour,
+ self._stdminute) = tup[1:5]
+
+ self._stddayofweek = tup[7]
+
+ tup = struct.unpack("=8h", keydict["DaylightStart"])
+
+ (self._dstmonth,
+ self._dstweeknumber, # Last = 5
+ self._dsthour,
+ self._dstminute) = tup[1:5]
+
+ self._dstdayofweek = tup[7]
+
+ self._dst_base_offset_ = self._dst_offset - self._std_offset
+ self.hasdst = self._get_hasdst()
+
+ def __repr__(self):
+ return "tzwinlocal()"
+
+ def __str__(self):
+ # str will return the standard name, not the daylight name.
+ return "tzwinlocal(%s)" % repr(self._std_abbr)
+
+ def __reduce__(self):
+ return (self.__class__, ())
+
+
+def picknthweekday(year, month, dayofweek, hour, minute, whichweek):
+ """ dayofweek == 0 means Sunday, whichweek 5 means last instance """
+ first = datetime.datetime(year, month, 1, hour, minute)
+
+ # This will work if dayofweek is ISO weekday (1-7) or Microsoft-style (0-6),
+ # Because 7 % 7 = 0
+ weekdayone = first.replace(day=((dayofweek - first.isoweekday()) % 7) + 1)
+ wd = weekdayone + ((whichweek - 1) * ONEWEEK)
+ if (wd.month != month):
+ wd -= ONEWEEK
+
+ return wd
+
+
+def valuestodict(key):
+ """Convert a registry key's values to a dictionary."""
+ dout = {}
+ size = winreg.QueryInfoKey(key)[1]
+ tz_res = None
+
+ for i in range(size):
+ key_name, value, dtype = winreg.EnumValue(key, i)
+ if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN:
+ # If it's a DWORD (32-bit integer), it's stored as unsigned - convert
+ # that to a proper signed integer
+ if value & (1 << 31):
+ value = value - (1 << 32)
+ elif dtype == winreg.REG_SZ:
+ # If it's a reference to the tzres DLL, load the actual string
+ if value.startswith('@tzres'):
+ tz_res = tz_res or tzres()
+ value = tz_res.name_from_string(value)
+
+ value = value.rstrip('\x00') # Remove trailing nulls
+
+ dout[key_name] = value
+
+ return dout
diff --git a/venv/Lib/site-packages/dateutil/tzwin.py b/venv/Lib/site-packages/dateutil/tzwin.py
new file mode 100644
index 0000000..cebc673
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/tzwin.py
@@ -0,0 +1,2 @@
+# tzwin has moved to dateutil.tz.win
+from .tz.win import *
diff --git a/venv/Lib/site-packages/dateutil/utils.py b/venv/Lib/site-packages/dateutil/utils.py
new file mode 100644
index 0000000..44d9c99
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/utils.py
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+"""
+This module offers general convenience and utility functions for dealing with
+datetimes.
+
+.. versionadded:: 2.7.0
+"""
+from __future__ import unicode_literals
+
+from datetime import datetime, time
+
+
+def today(tzinfo=None):
+ """
+ Returns a :py:class:`datetime` representing the current day at midnight
+
+ :param tzinfo:
+ The time zone to attach (also used to determine the current day).
+
+ :return:
+ A :py:class:`datetime.datetime` object representing the current day
+ at midnight.
+ """
+
+ dt = datetime.now(tzinfo)
+ return datetime.combine(dt.date(), time(0, tzinfo=tzinfo))
+
+
+def default_tzinfo(dt, tzinfo):
+ """
+ Sets the ``tzinfo`` parameter on naive datetimes only
+
+ This is useful for example when you are provided a datetime that may have
+ either an implicit or explicit time zone, such as when parsing a time zone
+ string.
+
+ .. doctest::
+
+ >>> from dateutil.tz import tzoffset
+ >>> from dateutil.parser import parse
+ >>> from dateutil.utils import default_tzinfo
+ >>> dflt_tz = tzoffset("EST", -18000)
+ >>> print(default_tzinfo(parse('2014-01-01 12:30 UTC'), dflt_tz))
+ 2014-01-01 12:30:00+00:00
+ >>> print(default_tzinfo(parse('2014-01-01 12:30'), dflt_tz))
+ 2014-01-01 12:30:00-05:00
+
+ :param dt:
+ The datetime on which to replace the time zone
+
+ :param tzinfo:
+ The :py:class:`datetime.tzinfo` subclass instance to assign to
+ ``dt`` if (and only if) it is naive.
+
+ :return:
+ Returns an aware :py:class:`datetime.datetime`.
+ """
+ if dt.tzinfo is not None:
+ return dt
+ else:
+ return dt.replace(tzinfo=tzinfo)
+
+
+def within_delta(dt1, dt2, delta):
+ """
+ Useful for comparing two datetimes that may a negilible difference
+ to be considered equal.
+ """
+ delta = abs(delta)
+ difference = dt1 - dt2
+ return -delta <= difference <= delta
diff --git a/venv/Lib/site-packages/dateutil/zoneinfo/__init__.py b/venv/Lib/site-packages/dateutil/zoneinfo/__init__.py
new file mode 100644
index 0000000..34f11ad
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/zoneinfo/__init__.py
@@ -0,0 +1,167 @@
+# -*- coding: utf-8 -*-
+import warnings
+import json
+
+from tarfile import TarFile
+from pkgutil import get_data
+from io import BytesIO
+
+from dateutil.tz import tzfile as _tzfile
+
+__all__ = ["get_zonefile_instance", "gettz", "gettz_db_metadata"]
+
+ZONEFILENAME = "dateutil-zoneinfo.tar.gz"
+METADATA_FN = 'METADATA'
+
+
+class tzfile(_tzfile):
+ def __reduce__(self):
+ return (gettz, (self._filename,))
+
+
+def getzoneinfofile_stream():
+ try:
+ return BytesIO(get_data(__name__, ZONEFILENAME))
+ except IOError as e: # TODO switch to FileNotFoundError?
+ warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror))
+ return None
+
+
+class ZoneInfoFile(object):
+ def __init__(self, zonefile_stream=None):
+ if zonefile_stream is not None:
+ with TarFile.open(fileobj=zonefile_stream) as tf:
+ self.zones = {zf.name: tzfile(tf.extractfile(zf), filename=zf.name)
+ for zf in tf.getmembers()
+ if zf.isfile() and zf.name != METADATA_FN}
+ # deal with links: They'll point to their parent object. Less
+ # waste of memory
+ links = {zl.name: self.zones[zl.linkname]
+ for zl in tf.getmembers() if
+ zl.islnk() or zl.issym()}
+ self.zones.update(links)
+ try:
+ metadata_json = tf.extractfile(tf.getmember(METADATA_FN))
+ metadata_str = metadata_json.read().decode('UTF-8')
+ self.metadata = json.loads(metadata_str)
+ except KeyError:
+ # no metadata in tar file
+ self.metadata = None
+ else:
+ self.zones = {}
+ self.metadata = None
+
+ def get(self, name, default=None):
+ """
+ Wrapper for :func:`ZoneInfoFile.zones.get`. This is a convenience method
+ for retrieving zones from the zone dictionary.
+
+ :param name:
+ The name of the zone to retrieve. (Generally IANA zone names)
+
+ :param default:
+ The value to return in the event of a missing key.
+
+ .. versionadded:: 2.6.0
+
+ """
+ return self.zones.get(name, default)
+
+
+# The current API has gettz as a module function, although in fact it taps into
+# a stateful class. So as a workaround for now, without changing the API, we
+# will create a new "global" class instance the first time a user requests a
+# timezone. Ugly, but adheres to the api.
+#
+# TODO: Remove after deprecation period.
+_CLASS_ZONE_INSTANCE = []
+
+
+def get_zonefile_instance(new_instance=False):
+ """
+ This is a convenience function which provides a :class:`ZoneInfoFile`
+ instance using the data provided by the ``dateutil`` package. By default, it
+ caches a single instance of the ZoneInfoFile object and returns that.
+
+ :param new_instance:
+ If ``True``, a new instance of :class:`ZoneInfoFile` is instantiated and
+ used as the cached instance for the next call. Otherwise, new instances
+ are created only as necessary.
+
+ :return:
+ Returns a :class:`ZoneInfoFile` object.
+
+ .. versionadded:: 2.6
+ """
+ if new_instance:
+ zif = None
+ else:
+ zif = getattr(get_zonefile_instance, '_cached_instance', None)
+
+ if zif is None:
+ zif = ZoneInfoFile(getzoneinfofile_stream())
+
+ get_zonefile_instance._cached_instance = zif
+
+ return zif
+
+
+def gettz(name):
+ """
+ This retrieves a time zone from the local zoneinfo tarball that is packaged
+ with dateutil.
+
+ :param name:
+ An IANA-style time zone name, as found in the zoneinfo file.
+
+ :return:
+ Returns a :class:`dateutil.tz.tzfile` time zone object.
+
+ .. warning::
+ It is generally inadvisable to use this function, and it is only
+ provided for API compatibility with earlier versions. This is *not*
+ equivalent to ``dateutil.tz.gettz()``, which selects an appropriate
+ time zone based on the inputs, favoring system zoneinfo. This is ONLY
+ for accessing the dateutil-specific zoneinfo (which may be out of
+ date compared to the system zoneinfo).
+
+ .. deprecated:: 2.6
+ If you need to use a specific zoneinfofile over the system zoneinfo,
+ instantiate a :class:`dateutil.zoneinfo.ZoneInfoFile` object and call
+ :func:`dateutil.zoneinfo.ZoneInfoFile.get(name)` instead.
+
+ Use :func:`get_zonefile_instance` to retrieve an instance of the
+ dateutil-provided zoneinfo.
+ """
+ warnings.warn("zoneinfo.gettz() will be removed in future versions, "
+ "to use the dateutil-provided zoneinfo files, instantiate a "
+ "ZoneInfoFile object and use ZoneInfoFile.zones.get() "
+ "instead. See the documentation for details.",
+ DeprecationWarning)
+
+ if len(_CLASS_ZONE_INSTANCE) == 0:
+ _CLASS_ZONE_INSTANCE.append(ZoneInfoFile(getzoneinfofile_stream()))
+ return _CLASS_ZONE_INSTANCE[0].zones.get(name)
+
+
+def gettz_db_metadata():
+ """ Get the zonefile metadata
+
+ See `zonefile_metadata`_
+
+ :returns:
+ A dictionary with the database metadata
+
+ .. deprecated:: 2.6
+ See deprecation warning in :func:`zoneinfo.gettz`. To get metadata,
+ query the attribute ``zoneinfo.ZoneInfoFile.metadata``.
+ """
+ warnings.warn("zoneinfo.gettz_db_metadata() will be removed in future "
+ "versions, to use the dateutil-provided zoneinfo files, "
+ "ZoneInfoFile object and query the 'metadata' attribute "
+ "instead. See the documentation for details.",
+ DeprecationWarning)
+
+ if len(_CLASS_ZONE_INSTANCE) == 0:
+ _CLASS_ZONE_INSTANCE.append(ZoneInfoFile(getzoneinfofile_stream()))
+ return _CLASS_ZONE_INSTANCE[0].metadata
diff --git a/venv/Lib/site-packages/dateutil/zoneinfo/dateutil-zoneinfo.tar.gz b/venv/Lib/site-packages/dateutil/zoneinfo/dateutil-zoneinfo.tar.gz
new file mode 100644
index 0000000..89e8351
Binary files /dev/null and b/venv/Lib/site-packages/dateutil/zoneinfo/dateutil-zoneinfo.tar.gz differ
diff --git a/venv/Lib/site-packages/dateutil/zoneinfo/rebuild.py b/venv/Lib/site-packages/dateutil/zoneinfo/rebuild.py
new file mode 100644
index 0000000..78f0d1a
--- /dev/null
+++ b/venv/Lib/site-packages/dateutil/zoneinfo/rebuild.py
@@ -0,0 +1,53 @@
+import logging
+import os
+import tempfile
+import shutil
+import json
+from subprocess import check_call
+from tarfile import TarFile
+
+from dateutil.zoneinfo import METADATA_FN, ZONEFILENAME
+
+
+def rebuild(filename, tag=None, format="gz", zonegroups=[], metadata=None):
+ """Rebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar*
+
+ filename is the timezone tarball from ``ftp.iana.org/tz``.
+
+ """
+ tmpdir = tempfile.mkdtemp()
+ zonedir = os.path.join(tmpdir, "zoneinfo")
+ moduledir = os.path.dirname(__file__)
+ try:
+ with TarFile.open(filename) as tf:
+ for name in zonegroups:
+ tf.extract(name, tmpdir)
+ filepaths = [os.path.join(tmpdir, n) for n in zonegroups]
+ try:
+ check_call(["zic", "-d", zonedir] + filepaths)
+ except OSError as e:
+ _print_on_nosuchfile(e)
+ raise
+ # write metadata file
+ with open(os.path.join(zonedir, METADATA_FN), 'w') as f:
+ json.dump(metadata, f, indent=4, sort_keys=True)
+ target = os.path.join(moduledir, ZONEFILENAME)
+ with TarFile.open(target, "w:%s" % format) as tf:
+ for entry in os.listdir(zonedir):
+ entrypath = os.path.join(zonedir, entry)
+ tf.add(entrypath, entry)
+ finally:
+ shutil.rmtree(tmpdir)
+
+
+def _print_on_nosuchfile(e):
+ """Print helpful troubleshooting message
+
+ e is an exception raised by subprocess.check_call()
+
+ """
+ if e.errno == 2:
+ logging.error(
+ "Could not find zic. Perhaps you need to install "
+ "libc-bin or some other package that provides it, "
+ "or it's not in your PATH?")
diff --git a/venv/Lib/site-packages/distutils-precedence.pth b/venv/Lib/site-packages/distutils-precedence.pth
new file mode 100644
index 0000000..6de4198
--- /dev/null
+++ b/venv/Lib/site-packages/distutils-precedence.pth
@@ -0,0 +1 @@
+import os; var = 'SETUPTOOLS_USE_DISTUTILS'; enabled = os.environ.get(var, 'stdlib') == 'local'; enabled and __import__('_distutils_hack').add_shim();
diff --git a/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/INSTALLER b/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/INSTALLER
new file mode 100644
index 0000000..a1b589e
--- /dev/null
+++ b/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/LICENSE b/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/LICENSE
new file mode 100644
index 0000000..c34aff7
--- /dev/null
+++ b/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/LICENSE
@@ -0,0 +1,71 @@
+=========================
+ The Kiwi licensing terms
+=========================
+Kiwi is licensed under the terms of the Modified BSD License (also known as
+New or Revised BSD), as follows:
+
+Copyright (c) 2013, Nucleic Development Team
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright notice, this
+list of conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+Neither the name of the Nucleic Development Team nor the names of its
+contributors may be used to endorse or promote products derived from this
+software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+About Kiwi
+----------
+Chris Colbert began the Kiwi project in December 2013 in an effort to
+create a blisteringly fast UI constraint solver. Chris is still the
+project lead.
+
+The Nucleic Development Team is the set of all contributors to the Nucleic
+project and its subprojects.
+
+The core team that coordinates development on GitHub can be found here:
+http://github.com/nucleic. The current team consists of:
+
+* Chris Colbert
+
+Our Copyright Policy
+--------------------
+Nucleic uses a shared copyright model. Each contributor maintains copyright
+over their contributions to Nucleic. But, it is important to note that these
+contributions are typically only changes to the repositories. Thus, the Nucleic
+source code, in its entirety is not the copyright of any single person or
+institution. Instead, it is the collective copyright of the entire Nucleic
+Development Team. If individual contributors want to maintain a record of what
+changes/contributions they have specific copyright on, they should indicate
+their copyright in the commit message of the change, when they commit the
+change to one of the Nucleic repositories.
+
+With this in mind, the following banner should be used in any source code file
+to indicate the copyright and license terms:
+
+#------------------------------------------------------------------------------
+# Copyright (c) 2013, Nucleic Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file LICENSE, distributed with this software.
+#------------------------------------------------------------------------------
diff --git a/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/METADATA b/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/METADATA
new file mode 100644
index 0000000..8a554f5
--- /dev/null
+++ b/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/METADATA
@@ -0,0 +1,45 @@
+Metadata-Version: 2.1
+Name: kiwisolver
+Version: 1.3.1
+Summary: A fast implementation of the Cassowary constraint solver
+Home-page: https://github.com/nucleic/kiwi
+Author: The Nucleic Development Team
+Author-email: sccolbert@gmail.com
+License: BSD
+Platform: UNKNOWN
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Requires-Python: >=3.6
+
+Welcome to Kiwi
+===============
+
+.. image:: https://travis-ci.org/nucleic/kiwi.svg?branch=master
+ :target: https://travis-ci.org/nucleic/kiwi
+.. image:: https://github.com/nucleic/kiwi/workflows/Continuous%20Integration/badge.svg
+ :target: https://github.com/nucleic/kiwi/actions
+.. image:: https://github.com/nucleic/kiwi/workflows/Documentation%20building/badge.svg
+ :target: https://github.com/nucleic/kiwi/actions
+.. image:: https://codecov.io/gh/nucleic/kiwi/branch/master/graph/badge.svg
+ :target: https://codecov.io/gh/nucleic/kiwi
+.. image:: https://readthedocs.org/projects/kiwisolver/badge/?version=latest
+ :target: https://kiwisolver.readthedocs.io/en/latest/?badge=latest
+ :alt: Documentation Status
+
+Kiwi is an efficient C++ implementation of the Cassowary constraint solving
+algorithm. Kiwi is an implementation of the algorithm based on the seminal
+Cassowary paper. It is *not* a refactoring of the original C++ solver. Kiwi
+has been designed from the ground up to be lightweight and fast. Kiwi ranges
+from 10x to 500x faster than the original Cassowary solver with typical use
+cases gaining a 40x improvement. Memory savings are consistently > 5x.
+
+In addition to the C++ solver, Kiwi ships with hand-rolled Python bindings for
+Python 3.6+.
+
+
diff --git a/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/RECORD b/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/RECORD
new file mode 100644
index 0000000..0030fb4
--- /dev/null
+++ b/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/RECORD
@@ -0,0 +1,8 @@
+kiwisolver-1.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+kiwisolver-1.3.1.dist-info/LICENSE,sha256=mcfCJHgDN3ly03E8EwtAsjyyZ7oHx8X46G0vh6wv1kY,3350
+kiwisolver-1.3.1.dist-info/METADATA,sha256=oT4PghUIpLXL3xTjn_-d8mARicDSwM4uzaUC-EMYNLc,1978
+kiwisolver-1.3.1.dist-info/RECORD,,
+kiwisolver-1.3.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+kiwisolver-1.3.1.dist-info/WHEEL,sha256=9MdUI0OzwjYaHl3jWlKFDIJ5MFBPjwppNgWNtexntqg,105
+kiwisolver-1.3.1.dist-info/top_level.txt,sha256=xqwWj7oSHlpIjcw2QMJb8puTFPdjDBO78AZp9gjTh9c,11
+kiwisolver.cp38-win_amd64.pyd,sha256=jU4zl8FDPsaDO-NC0BB0SrM2aYkCI1o8ayz3TltzyNI,116736
diff --git a/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/REQUESTED b/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/REQUESTED
new file mode 100644
index 0000000..e69de29
diff --git a/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/WHEEL b/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/WHEEL
new file mode 100644
index 0000000..671c245
--- /dev/null
+++ b/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.35.1)
+Root-Is-Purelib: false
+Tag: cp38-cp38-win_amd64
+
diff --git a/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/top_level.txt b/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/top_level.txt
new file mode 100644
index 0000000..9b85884
--- /dev/null
+++ b/venv/Lib/site-packages/kiwisolver-1.3.1.dist-info/top_level.txt
@@ -0,0 +1 @@
+kiwisolver
diff --git a/venv/Lib/site-packages/kiwisolver.cp38-win_amd64.pyd b/venv/Lib/site-packages/kiwisolver.cp38-win_amd64.pyd
new file mode 100644
index 0000000..edd6a1e
Binary files /dev/null and b/venv/Lib/site-packages/kiwisolver.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2-py3.8-nspkg.pth b/venv/Lib/site-packages/matplotlib-3.4.2-py3.8-nspkg.pth
new file mode 100644
index 0000000..2137841
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2-py3.8-nspkg.pth
@@ -0,0 +1 @@
+import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('mpl_toolkits',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('mpl_toolkits', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('mpl_toolkits', [os.path.dirname(p)])));m = m or sys.modules.setdefault('mpl_toolkits', types.ModuleType('mpl_toolkits'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/INSTALLER b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/INSTALLER
new file mode 100644
index 0000000..a1b589e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE
new file mode 100644
index 0000000..ec51537
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE
@@ -0,0 +1,99 @@
+License agreement for matplotlib versions 1.3.0 and later
+=========================================================
+
+1. This LICENSE AGREEMENT is between the Matplotlib Development Team
+("MDT"), and the Individual or Organization ("Licensee") accessing and
+otherwise using matplotlib software in source or binary form and its
+associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, MDT
+hereby grants Licensee a nonexclusive, royalty-free, world-wide license
+to reproduce, analyze, test, perform and/or display publicly, prepare
+derivative works, distribute, and otherwise use matplotlib
+alone or in any derivative version, provided, however, that MDT's
+License Agreement and MDT's notice of copyright, i.e., "Copyright (c)
+2012- Matplotlib Development Team; All Rights Reserved" are retained in
+matplotlib alone or in any derivative version prepared by
+Licensee.
+
+3. In the event Licensee prepares a derivative work that is based on or
+incorporates matplotlib or any part thereof, and wants to
+make the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to matplotlib .
+
+4. MDT is making matplotlib available to Licensee on an "AS
+IS" basis. MDT MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, MDT MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB
+WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. MDT SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB
+ FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR
+LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING
+MATPLOTLIB , OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF
+THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. Nothing in this License Agreement shall be deemed to create any
+relationship of agency, partnership, or joint venture between MDT and
+Licensee. This License Agreement does not grant permission to use MDT
+trademarks or trade name in a trademark sense to endorse or promote
+products or services of Licensee, or any third party.
+
+8. By copying, installing or otherwise using matplotlib ,
+Licensee agrees to be bound by the terms and conditions of this License
+Agreement.
+
+License agreement for matplotlib versions prior to 1.3.0
+========================================================
+
+1. This LICENSE AGREEMENT is between John D. Hunter ("JDH"), and the
+Individual or Organization ("Licensee") accessing and otherwise using
+matplotlib software in source or binary form and its associated
+documentation.
+
+2. Subject to the terms and conditions of this License Agreement, JDH
+hereby grants Licensee a nonexclusive, royalty-free, world-wide license
+to reproduce, analyze, test, perform and/or display publicly, prepare
+derivative works, distribute, and otherwise use matplotlib
+alone or in any derivative version, provided, however, that JDH's
+License Agreement and JDH's notice of copyright, i.e., "Copyright (c)
+2002-2011 John D. Hunter; All Rights Reserved" are retained in
+matplotlib alone or in any derivative version prepared by
+Licensee.
+
+3. In the event Licensee prepares a derivative work that is based on or
+incorporates matplotlib or any part thereof, and wants to
+make the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to matplotlib.
+
+4. JDH is making matplotlib available to Licensee on an "AS
+IS" basis. JDH MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, JDH MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB
+WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. JDH SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB
+ FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR
+LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING
+MATPLOTLIB , OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF
+THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. Nothing in this License Agreement shall be deemed to create any
+relationship of agency, partnership, or joint venture between JDH and
+Licensee. This License Agreement does not grant permission to use JDH
+trademarks or trade name in a trademark sense to endorse or promote
+products or services of Licensee, or any third party.
+
+8. By copying, installing or otherwise using matplotlib,
+Licensee agrees to be bound by the terms and conditions of this License
+Agreement.
\ No newline at end of file
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_AMSFONTS b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_AMSFONTS
new file mode 100644
index 0000000..3627bb9
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_AMSFONTS
@@ -0,0 +1,240 @@
+The cmr10.pfb file is a Type-1 version of one of Knuth's Computer Modern fonts.
+It is included here as test data only, but the following license applies.
+
+Copyright (c) 1997, 2009, American Mathematical Society (http://www.ams.org).
+All Rights Reserved.
+
+"cmb10" is a Reserved Font Name for this Font Software.
+"cmbsy10" is a Reserved Font Name for this Font Software.
+"cmbsy5" is a Reserved Font Name for this Font Software.
+"cmbsy6" is a Reserved Font Name for this Font Software.
+"cmbsy7" is a Reserved Font Name for this Font Software.
+"cmbsy8" is a Reserved Font Name for this Font Software.
+"cmbsy9" is a Reserved Font Name for this Font Software.
+"cmbx10" is a Reserved Font Name for this Font Software.
+"cmbx12" is a Reserved Font Name for this Font Software.
+"cmbx5" is a Reserved Font Name for this Font Software.
+"cmbx6" is a Reserved Font Name for this Font Software.
+"cmbx7" is a Reserved Font Name for this Font Software.
+"cmbx8" is a Reserved Font Name for this Font Software.
+"cmbx9" is a Reserved Font Name for this Font Software.
+"cmbxsl10" is a Reserved Font Name for this Font Software.
+"cmbxti10" is a Reserved Font Name for this Font Software.
+"cmcsc10" is a Reserved Font Name for this Font Software.
+"cmcsc8" is a Reserved Font Name for this Font Software.
+"cmcsc9" is a Reserved Font Name for this Font Software.
+"cmdunh10" is a Reserved Font Name for this Font Software.
+"cmex10" is a Reserved Font Name for this Font Software.
+"cmex7" is a Reserved Font Name for this Font Software.
+"cmex8" is a Reserved Font Name for this Font Software.
+"cmex9" is a Reserved Font Name for this Font Software.
+"cmff10" is a Reserved Font Name for this Font Software.
+"cmfi10" is a Reserved Font Name for this Font Software.
+"cmfib8" is a Reserved Font Name for this Font Software.
+"cminch" is a Reserved Font Name for this Font Software.
+"cmitt10" is a Reserved Font Name for this Font Software.
+"cmmi10" is a Reserved Font Name for this Font Software.
+"cmmi12" is a Reserved Font Name for this Font Software.
+"cmmi5" is a Reserved Font Name for this Font Software.
+"cmmi6" is a Reserved Font Name for this Font Software.
+"cmmi7" is a Reserved Font Name for this Font Software.
+"cmmi8" is a Reserved Font Name for this Font Software.
+"cmmi9" is a Reserved Font Name for this Font Software.
+"cmmib10" is a Reserved Font Name for this Font Software.
+"cmmib5" is a Reserved Font Name for this Font Software.
+"cmmib6" is a Reserved Font Name for this Font Software.
+"cmmib7" is a Reserved Font Name for this Font Software.
+"cmmib8" is a Reserved Font Name for this Font Software.
+"cmmib9" is a Reserved Font Name for this Font Software.
+"cmr10" is a Reserved Font Name for this Font Software.
+"cmr12" is a Reserved Font Name for this Font Software.
+"cmr17" is a Reserved Font Name for this Font Software.
+"cmr5" is a Reserved Font Name for this Font Software.
+"cmr6" is a Reserved Font Name for this Font Software.
+"cmr7" is a Reserved Font Name for this Font Software.
+"cmr8" is a Reserved Font Name for this Font Software.
+"cmr9" is a Reserved Font Name for this Font Software.
+"cmsl10" is a Reserved Font Name for this Font Software.
+"cmsl12" is a Reserved Font Name for this Font Software.
+"cmsl8" is a Reserved Font Name for this Font Software.
+"cmsl9" is a Reserved Font Name for this Font Software.
+"cmsltt10" is a Reserved Font Name for this Font Software.
+"cmss10" is a Reserved Font Name for this Font Software.
+"cmss12" is a Reserved Font Name for this Font Software.
+"cmss17" is a Reserved Font Name for this Font Software.
+"cmss8" is a Reserved Font Name for this Font Software.
+"cmss9" is a Reserved Font Name for this Font Software.
+"cmssbx10" is a Reserved Font Name for this Font Software.
+"cmssdc10" is a Reserved Font Name for this Font Software.
+"cmssi10" is a Reserved Font Name for this Font Software.
+"cmssi12" is a Reserved Font Name for this Font Software.
+"cmssi17" is a Reserved Font Name for this Font Software.
+"cmssi8" is a Reserved Font Name for this Font Software.
+"cmssi9" is a Reserved Font Name for this Font Software.
+"cmssq8" is a Reserved Font Name for this Font Software.
+"cmssqi8" is a Reserved Font Name for this Font Software.
+"cmsy10" is a Reserved Font Name for this Font Software.
+"cmsy5" is a Reserved Font Name for this Font Software.
+"cmsy6" is a Reserved Font Name for this Font Software.
+"cmsy7" is a Reserved Font Name for this Font Software.
+"cmsy8" is a Reserved Font Name for this Font Software.
+"cmsy9" is a Reserved Font Name for this Font Software.
+"cmtcsc10" is a Reserved Font Name for this Font Software.
+"cmtex10" is a Reserved Font Name for this Font Software.
+"cmtex8" is a Reserved Font Name for this Font Software.
+"cmtex9" is a Reserved Font Name for this Font Software.
+"cmti10" is a Reserved Font Name for this Font Software.
+"cmti12" is a Reserved Font Name for this Font Software.
+"cmti7" is a Reserved Font Name for this Font Software.
+"cmti8" is a Reserved Font Name for this Font Software.
+"cmti9" is a Reserved Font Name for this Font Software.
+"cmtt10" is a Reserved Font Name for this Font Software.
+"cmtt12" is a Reserved Font Name for this Font Software.
+"cmtt8" is a Reserved Font Name for this Font Software.
+"cmtt9" is a Reserved Font Name for this Font Software.
+"cmu10" is a Reserved Font Name for this Font Software.
+"cmvtt10" is a Reserved Font Name for this Font Software.
+"euex10" is a Reserved Font Name for this Font Software.
+"euex7" is a Reserved Font Name for this Font Software.
+"euex8" is a Reserved Font Name for this Font Software.
+"euex9" is a Reserved Font Name for this Font Software.
+"eufb10" is a Reserved Font Name for this Font Software.
+"eufb5" is a Reserved Font Name for this Font Software.
+"eufb7" is a Reserved Font Name for this Font Software.
+"eufm10" is a Reserved Font Name for this Font Software.
+"eufm5" is a Reserved Font Name for this Font Software.
+"eufm7" is a Reserved Font Name for this Font Software.
+"eurb10" is a Reserved Font Name for this Font Software.
+"eurb5" is a Reserved Font Name for this Font Software.
+"eurb7" is a Reserved Font Name for this Font Software.
+"eurm10" is a Reserved Font Name for this Font Software.
+"eurm5" is a Reserved Font Name for this Font Software.
+"eurm7" is a Reserved Font Name for this Font Software.
+"eusb10" is a Reserved Font Name for this Font Software.
+"eusb5" is a Reserved Font Name for this Font Software.
+"eusb7" is a Reserved Font Name for this Font Software.
+"eusm10" is a Reserved Font Name for this Font Software.
+"eusm5" is a Reserved Font Name for this Font Software.
+"eusm7" is a Reserved Font Name for this Font Software.
+"lasy10" is a Reserved Font Name for this Font Software.
+"lasy5" is a Reserved Font Name for this Font Software.
+"lasy6" is a Reserved Font Name for this Font Software.
+"lasy7" is a Reserved Font Name for this Font Software.
+"lasy8" is a Reserved Font Name for this Font Software.
+"lasy9" is a Reserved Font Name for this Font Software.
+"lasyb10" is a Reserved Font Name for this Font Software.
+"lcircle1" is a Reserved Font Name for this Font Software.
+"lcirclew" is a Reserved Font Name for this Font Software.
+"lcmss8" is a Reserved Font Name for this Font Software.
+"lcmssb8" is a Reserved Font Name for this Font Software.
+"lcmssi8" is a Reserved Font Name for this Font Software.
+"line10" is a Reserved Font Name for this Font Software.
+"linew10" is a Reserved Font Name for this Font Software.
+"msam10" is a Reserved Font Name for this Font Software.
+"msam5" is a Reserved Font Name for this Font Software.
+"msam6" is a Reserved Font Name for this Font Software.
+"msam7" is a Reserved Font Name for this Font Software.
+"msam8" is a Reserved Font Name for this Font Software.
+"msam9" is a Reserved Font Name for this Font Software.
+"msbm10" is a Reserved Font Name for this Font Software.
+"msbm5" is a Reserved Font Name for this Font Software.
+"msbm6" is a Reserved Font Name for this Font Software.
+"msbm7" is a Reserved Font Name for this Font Software.
+"msbm8" is a Reserved Font Name for this Font Software.
+"msbm9" is a Reserved Font Name for this Font Software.
+"wncyb10" is a Reserved Font Name for this Font Software.
+"wncyi10" is a Reserved Font Name for this Font Software.
+"wncyr10" is a Reserved Font Name for this Font Software.
+"wncysc10" is a Reserved Font Name for this Font Software.
+"wncyss10" is a Reserved Font Name for this Font Software.
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_BAKOMA b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_BAKOMA
new file mode 100644
index 0000000..6200f08
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_BAKOMA
@@ -0,0 +1,40 @@
+
+ BaKoMa Fonts Licence
+ --------------------
+
+ This licence covers two font packs (known as BaKoMa Fonts Collection,
+ which is available at `CTAN:fonts/cm/ps-type1/bakoma/'):
+
+ 1) BaKoMa-CM (1.1/12-Nov-94)
+ Computer Modern Fonts in PostScript Type 1 and TrueType font formats.
+
+ 2) BaKoMa-AMS (1.2/19-Jan-95)
+ AMS TeX fonts in PostScript Type 1 and TrueType font formats.
+
+ Copyright (C) 1994, 1995, Basil K. Malyshev. All Rights Reserved.
+
+ Permission to copy and distribute these fonts for any purpose is
+ hereby granted without fee, provided that the above copyright notice,
+ author statement and this permission notice appear in all copies of
+ these fonts and related documentation.
+
+ Permission to modify and distribute modified fonts for any purpose is
+ hereby granted without fee, provided that the copyright notice,
+ author statement, this permission notice and location of original
+ fonts (http://www.ctan.org/tex-archive/fonts/cm/ps-type1/bakoma)
+ appear in all copies of modified fonts and related documentation.
+
+ Permission to use these fonts (embedding into PostScript, PDF, SVG
+ and printing by using any software) is hereby granted without fee.
+ It is not required to provide any notices about using these fonts.
+
+ Basil K. Malyshev
+ INSTITUTE FOR HIGH ENERGY PHYSICS
+ IHEP, OMVT
+ Moscow Region
+ 142281 PROTVINO
+ RUSSIA
+
+ E-Mail: bakoma@mail.ru
+ or malyshev@mail.ihep.ru
+
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_CARLOGO b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_CARLOGO
new file mode 100644
index 0000000..8c99c65
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_CARLOGO
@@ -0,0 +1,45 @@
+----> we renamed carlito -> carlogo to comply with the terms <----
+
+Copyright (c) 2010-2013 by tyPoland Lukasz Dziedzic with Reserved Font Name "Carlito".
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
+
+"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
+
+5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
\ No newline at end of file
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_COLORBREWER b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_COLORBREWER
new file mode 100644
index 0000000..568afe8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_COLORBREWER
@@ -0,0 +1,38 @@
+Apache-Style Software License for ColorBrewer Color Schemes
+
+Version 1.1
+
+Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania
+State University. All rights reserved. Redistribution and use in source
+and binary forms, with or without modification, are permitted provided
+that the following conditions are met:
+
+1. Redistributions as source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+
+2. The end-user documentation included with the redistribution, if any,
+must include the following acknowledgment: "This product includes color
+specifications and designs developed by Cynthia Brewer
+(http://colorbrewer.org/)." Alternately, this acknowledgment may appear in
+the software itself, if and wherever such third-party acknowledgments
+normally appear.
+
+3. The name "ColorBrewer" must not be used to endorse or promote products
+derived from this software without prior written permission. For written
+permission, please contact Cynthia Brewer at cbrewer@psu.edu.
+
+4. Products derived from this software may not be called "ColorBrewer",
+nor may "ColorBrewer" appear in their name, without prior written
+permission of Cynthia Brewer.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+CYNTHIA BREWER, MARK HARROWER, OR THE PENNSYLVANIA STATE UNIVERSITY BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_JSXTOOLS_RESIZE_OBSERVER b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_JSXTOOLS_RESIZE_OBSERVER
new file mode 100644
index 0000000..0bc1fa7
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_JSXTOOLS_RESIZE_OBSERVER
@@ -0,0 +1,108 @@
+# CC0 1.0 Universal
+
+## Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator and
+subsequent owner(s) (each and all, an “ownerâ€) of an original work of
+authorship and/or a database (each, a “Workâ€).
+
+Certain owners wish to permanently relinquish those rights to a Work for the
+purpose of contributing to a commons of creative, cultural and scientific works
+(“Commonsâ€) that the public can reliably and without fear of later claims of
+infringement build upon, modify, incorporate in other works, reuse and
+redistribute as freely as possible in any form whatsoever and for any purposes,
+including without limitation commercial purposes. These owners may contribute
+to the Commons to promote the ideal of a free culture and the further
+production of creative, cultural and scientific works, or to gain reputation or
+greater distribution for their Work in part through the use and efforts of
+others.
+
+For these and/or other purposes and motivations, and without any expectation of
+additional consideration or compensation, the person associating CC0 with a
+Work (the “Affirmerâ€), to the extent that he or she is an owner of Copyright
+and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
+publicly distribute the Work under its terms, with knowledge of his or her
+Copyright and Related Rights in the Work and the meaning and intended legal
+effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+ protected by copyright and related or neighboring rights (“Copyright and
+ Related Rightsâ€). Copyright and Related Rights include, but are not limited
+ to, the following:
+ 1. the right to reproduce, adapt, distribute, perform, display, communicate,
+ and translate a Work;
+ 2. moral rights retained by the original author(s) and/or performer(s);
+ 3. publicity and privacy rights pertaining to a person’s image or likeness
+ depicted in a Work;
+ 4. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(i), below;
+ 5. rights protecting the extraction, dissemination, use and reuse of data in
+ a Work;
+ 6. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation thereof,
+ including any amended or successor version of such directive); and
+ 7. other similar, equivalent or corresponding rights throughout the world
+ based on applicable law or treaty, and any national implementations
+ thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention of,
+ applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
+ unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright
+ and Related Rights and associated claims and causes of action, whether now
+ known or unknown (including existing as well as future claims and causes of
+ action), in the Work (i) in all territories worldwide, (ii) for the maximum
+ duration provided by applicable law or treaty (including future time
+ extensions), (iii) in any current or future medium and for any number of
+ copies, and (iv) for any purpose whatsoever, including without limitation
+ commercial, advertising or promotional purposes (the “Waiverâ€). Affirmer
+ makes the Waiver for the benefit of each member of the public at large and
+ to the detriment of Affirmer’s heirs and successors, fully intending that
+ such Waiver shall not be subject to revocation, rescission, cancellation,
+ termination, or any other legal or equitable action to disrupt the quiet
+ enjoyment of the Work by the public as contemplated by Affirmer’s express
+ Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason be
+ judged legally invalid or ineffective under applicable law, then the Waiver
+ shall be preserved to the maximum extent permitted taking into account
+ Affirmer’s express Statement of Purpose. In addition, to the extent the
+ Waiver is so judged Affirmer hereby grants to each affected person a
+ royalty-free, non transferable, non sublicensable, non exclusive,
+ irrevocable and unconditional license to exercise Affirmer’s Copyright and
+ Related Rights in the Work (i) in all territories worldwide, (ii) for the
+ maximum duration provided by applicable law or treaty (including future time
+ extensions), (iii) in any current or future medium and for any number of
+ copies, and (iv) for any purpose whatsoever, including without limitation
+ commercial, advertising or promotional purposes (the “Licenseâ€). The License
+ shall be deemed effective as of the date CC0 was applied by Affirmer to the
+ Work. Should any part of the License for any reason be judged legally
+ invalid or ineffective under applicable law, such partial invalidity or
+ ineffectiveness shall not invalidate the remainder of the License, and in
+ such case Affirmer hereby affirms that he or she will not (i) exercise any
+ of his or her remaining Copyright and Related Rights in the Work or (ii)
+ assert any associated claims and causes of action with respect to the Work,
+ in either case contrary to Affirmer’s express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+ 1. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ 2. Affirmer offers the Work as-is and makes no representations or warranties
+ of any kind concerning the Work, express, implied, statutory or
+ otherwise, including without limitation warranties of title,
+ merchantability, fitness for a particular purpose, non infringement, or
+ the absence of latent or other defects, accuracy, or the present or
+ absence of errors, whether or not discoverable, all to the greatest
+ extent permissible under applicable law.
+ 3. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without
+ limitation any person’s Copyright and Related Rights in the Work.
+ Further, Affirmer disclaims responsibility for obtaining any necessary
+ consents, permissions or other rights required for any use of the Work.
+ 4. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to this
+ CC0 or use of the Work.
+
+For more information, please see
+http://creativecommons.org/publicdomain/zero/1.0/.
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_QHULL b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_QHULL
new file mode 100644
index 0000000..122a00a
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_QHULL
@@ -0,0 +1,39 @@
+ Qhull, Copyright (c) 1993-2020
+
+ C.B. Barber
+ Arlington, MA
+
+ and
+
+ The National Science and Technology Research Center for
+ Computation and Visualization of Geometric Structures
+ (The Geometry Center)
+ University of Minnesota
+
+ email: qhull@qhull.org
+
+This software includes Qhull from C.B. Barber and The Geometry Center.
+Files derived from Qhull 1.0 are copyrighted by the Geometry Center. The
+remaining files are copyrighted by C.B. Barber. Qhull is free software
+and may be obtained via http from www.qhull.org. It may be freely copied,
+modified, and redistributed under the following conditions:
+
+1. All copyright notices must remain intact in all files.
+
+2. A copy of this text file must be distributed along with any copies
+ of Qhull that you redistribute; this includes copies that you have
+ modified, or copies of programs or other software products that
+ include Qhull.
+
+3. If you modify Qhull, you must include a notice giving the
+ name of the person performing the modification, the date of
+ modification, and the reason for such modification.
+
+4. When distributing modified versions of Qhull, or other software
+ products that include Qhull, you must provide notice that the original
+ source code may be obtained as noted above.
+
+5. There is no warranty or other guarantee of fitness for Qhull, it is
+ provided solely "as is". Bug reports or fixes may be sent to
+ qhull_bug@qhull.org; the authors may or may not act on them as
+ they desire.
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_QT4_EDITOR b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_QT4_EDITOR
new file mode 100644
index 0000000..1c9d941
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_QT4_EDITOR
@@ -0,0 +1,30 @@
+
+Module creating PyQt4 form dialogs/layouts to edit various type of parameters
+
+
+formlayout License Agreement (MIT License)
+------------------------------------------
+
+Copyright (c) 2009 Pierre Raybaut
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+"""
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_SOLARIZED b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_SOLARIZED
new file mode 100644
index 0000000..6e5a047
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_SOLARIZED
@@ -0,0 +1,20 @@
+https://github.com/altercation/solarized/blob/master/LICENSE
+Copyright (c) 2011 Ethan Schoonover
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_STIX b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_STIX
new file mode 100644
index 0000000..2f7aeea
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_STIX
@@ -0,0 +1,71 @@
+TERMS AND CONDITIONS
+
+ 1. Permission is hereby granted, free of charge, to any person
+obtaining a copy of the STIX Fonts-TM set accompanying this license
+(collectively, the "Fonts") and the associated documentation files
+(collectively with the Fonts, the "Font Software"), to reproduce and
+distribute the Font Software, including the rights to use, copy, merge
+and publish copies of the Font Software, and to permit persons to whom
+the Font Software is furnished to do so same, subject to the following
+terms and conditions (the "License").
+
+ 2. The following copyright and trademark notice and these Terms and
+Conditions shall be included in all copies of one or more of the Font
+typefaces and any derivative work created as permitted under this
+License:
+
+ Copyright (c) 2001-2005 by the STI Pub Companies, consisting of
+the American Institute of Physics, the American Chemical Society, the
+American Mathematical Society, the American Physical Society, Elsevier,
+Inc., and The Institute of Electrical and Electronic Engineers, Inc.
+Portions copyright (c) 1998-2003 by MicroPress, Inc. Portions copyright
+(c) 1990 by Elsevier, Inc. All rights reserved. STIX Fonts-TM is a
+trademark of The Institute of Electrical and Electronics Engineers, Inc.
+
+ 3. You may (a) convert the Fonts from one format to another (e.g.,
+from TrueType to PostScript), in which case the normal and reasonable
+distortion that occurs during such conversion shall be permitted and (b)
+embed or include a subset of the Fonts in a document for the purposes of
+allowing users to read text in the document that utilizes the Fonts. In
+each case, you may use the STIX Fonts-TM mark to designate the resulting
+Fonts or subset of the Fonts.
+
+ 4. You may also (a) add glyphs or characters to the Fonts, or modify
+the shape of existing glyphs, so long as the base set of glyphs is not
+removed and (b) delete glyphs or characters from the Fonts, provided
+that the resulting font set is distributed with the following
+disclaimer: "This [name] font does not include all the Unicode points
+covered in the STIX Fonts-TM set but may include others." In each case,
+the name used to denote the resulting font set shall not include the
+term "STIX" or any similar term.
+
+ 5. You may charge a fee in connection with the distribution of the
+Font Software, provided that no copy of one or more of the individual
+Font typefaces that form the STIX Fonts-TM set may be sold by itself.
+
+ 6. THE FONT SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK OR OTHER RIGHT. IN NO EVENT SHALL
+MICROPRESS OR ANY OF THE STI PUB COMPANIES BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, INCLUDING, BUT NOT LIMITED TO, ANY GENERAL,
+SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM OR OUT OF THE USE OR
+INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT
+SOFTWARE.
+
+ 7. Except as contained in the notice set forth in Section 2, the
+names MicroPress Inc. and STI Pub Companies, as well as the names of the
+companies/organizations that compose the STI Pub Companies, shall not be
+used in advertising or otherwise to promote the sale, use or other
+dealings in the Font Software without the prior written consent of the
+respective company or organization.
+
+ 8. This License shall become null and void in the event of any
+material breach of the Terms and Conditions herein by licensee.
+
+ 9. A substantial portion of the STIX Fonts set was developed by
+MicroPress Inc. for the STI Pub Companies. To obtain additional
+mathematical fonts, please contact MicroPress, Inc., 68-30 Harrow
+Street, Forest Hills, NY 11375, USA - Phone: (718) 575-1816.
+
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_YORICK b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_YORICK
new file mode 100644
index 0000000..8c90850
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/LICENSE_YORICK
@@ -0,0 +1,49 @@
+BSD-style license for gist/yorick colormaps.
+
+Copyright:
+
+ Copyright (c) 1996. The Regents of the University of California.
+ All rights reserved.
+
+Permission to use, copy, modify, and distribute this software for any
+purpose without fee is hereby granted, provided that this entire
+notice is included in all copies of any software which is or includes
+a copy or modification of this software and in all copies of the
+supporting documentation for such software.
+
+This work was produced at the University of California, Lawrence
+Livermore National Laboratory under contract no. W-7405-ENG-48 between
+the U.S. Department of Energy and The Regents of the University of
+California for the operation of UC LLNL.
+
+
+ DISCLAIMER
+
+This software was prepared as an account of work sponsored by an
+agency of the United States Government. Neither the United States
+Government nor the University of California nor any of their
+employees, makes any warranty, express or implied, or assumes any
+liability or responsibility for the accuracy, completeness, or
+usefulness of any information, apparatus, product, or process
+disclosed, or represents that its use would not infringe
+privately-owned rights. Reference herein to any specific commercial
+products, process, or service by trade name, trademark, manufacturer,
+or otherwise, does not necessarily constitute or imply its
+endorsement, recommendation, or favoring by the United States
+Government or the University of California. The views and opinions of
+authors expressed herein do not necessarily state or reflect those of
+the United States Government or the University of California, and
+shall not be used for advertising or product endorsement purposes.
+
+
+ AUTHOR
+
+David H. Munro wrote Yorick and Gist. Berkeley Yacc (byacc) generated
+the Yorick parser. The routines in Math are from LAPACK and FFTPACK;
+MathC contains C translations by David H. Munro. The algorithms for
+Yorick's random number generator and several special functions in
+Yorick/include were taken from Numerical Recipes by Press, et. al.,
+although the Yorick implementations are unrelated to those in
+Numerical Recipes. A small amount of code in Gist was adapted from
+the X11R4 release, copyright M.I.T. -- the complete copyright notice
+may be found in the (unused) file Gist/host.c.
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/METADATA b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/METADATA
new file mode 100644
index 0000000..1adfa48
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/METADATA
@@ -0,0 +1,139 @@
+Metadata-Version: 2.1
+Name: matplotlib
+Version: 3.4.2
+Summary: Python plotting package
+Home-page: https://matplotlib.org
+Author: John D. Hunter, Michael Droettboom
+Author-email: matplotlib-users@python.org
+License: PSF
+Download-URL: https://matplotlib.org/users/installing.html
+Project-URL: Documentation, https://matplotlib.org
+Project-URL: Source Code, https://github.com/matplotlib/matplotlib
+Project-URL: Bug Tracker, https://github.com/matplotlib/matplotlib/issues
+Project-URL: Forum, https://discourse.matplotlib.org/
+Project-URL: Donate, https://numfocus.org/donate-to-matplotlib
+Platform: any
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Framework :: Matplotlib
+Classifier: Intended Audience :: Science/Research
+Classifier: Intended Audience :: Education
+Classifier: License :: OSI Approved :: Python Software Foundation License
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Topic :: Scientific/Engineering :: Visualization
+Requires-Python: >=3.7
+Description-Content-Type: text/x-rst
+Requires-Dist: cycler (>=0.10)
+Requires-Dist: kiwisolver (>=1.0.1)
+Requires-Dist: numpy (>=1.16)
+Requires-Dist: pillow (>=6.2.0)
+Requires-Dist: pyparsing (>=2.2.1)
+Requires-Dist: python-dateutil (>=2.7)
+
+|PyPi|_ |Downloads|_ |NUMFocus|_
+
+|DiscourseBadge|_ |Gitter|_ |GitHubIssues|_ |GitTutorial|_
+
+|GitHubActions|_ |AzurePipelines|_ |AppVeyor|_ |Codecov|_ |LGTM|_
+
+.. |GitHubActions| image:: https://github.com/matplotlib/matplotlib/workflows/Tests/badge.svg
+.. _GitHubActions: https://github.com/matplotlib/matplotlib/actions?query=workflow%3ATests
+
+.. |AzurePipelines| image:: https://dev.azure.com/matplotlib/matplotlib/_apis/build/status/matplotlib.matplotlib?branchName=master
+.. _AzurePipelines: https://dev.azure.com/matplotlib/matplotlib/_build/latest?definitionId=1&branchName=master
+
+.. |AppVeyor| image:: https://ci.appveyor.com/api/projects/status/github/matplotlib/matplotlib?branch=master&svg=true
+.. _AppVeyor: https://ci.appveyor.com/project/matplotlib/matplotlib
+
+.. |Codecov| image:: https://codecov.io/github/matplotlib/matplotlib/badge.svg?branch=master&service=github
+.. _Codecov: https://codecov.io/github/matplotlib/matplotlib?branch=master
+
+.. |LGTM| image:: https://img.shields.io/lgtm/grade/python/g/matplotlib/matplotlib.svg?logo=lgtm&logoWidth=18
+.. _LGTM: https://lgtm.com/projects/g/matplotlib/matplotlib
+
+.. |DiscourseBadge| image:: https://img.shields.io/badge/help_forum-discourse-blue.svg
+.. _DiscourseBadge: https://discourse.matplotlib.org
+
+.. |Gitter| image:: https://badges.gitter.im/matplotlib/matplotlib.svg
+.. _Gitter: https://gitter.im/matplotlib/matplotlib
+
+.. |GitHubIssues| image:: https://img.shields.io/badge/issue_tracking-github-blue.svg
+.. _GitHubIssues: https://github.com/matplotlib/matplotlib/issues
+
+.. |GitTutorial| image:: https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?
+.. _GitTutorial: https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project
+
+.. |PyPi| image:: https://badge.fury.io/py/matplotlib.svg
+.. _PyPi: https://badge.fury.io/py/matplotlib
+
+.. |Downloads| image:: https://pepy.tech/badge/matplotlib/month
+.. _Downloads: https://pepy.tech/project/matplotlib
+
+.. |NUMFocus| image:: https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A
+.. _NUMFocus: https://numfocus.org
+
+.. image:: https://matplotlib.org/_static/logo2.svg
+
+Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python.
+
+Check out our `home page `_ for more information.
+
+.. image:: https://matplotlib.org/_static/readme_preview.png
+
+Matplotlib produces publication-quality figures in a variety of hardcopy formats
+and interactive environments across platforms. Matplotlib can be used in Python scripts,
+the Python and IPython shell, web application servers, and various
+graphical user interface toolkits.
+
+
+Install
+=======
+
+For installation instructions and requirements, see `INSTALL.rst `_ or the
+`install `_ documentation.
+
+Test
+====
+
+After installation, launch the test suite::
+
+ python -m pytest
+
+Read the `testing guide `_ for more information and alternatives.
+
+Contribute
+==========
+You've discovered a bug or something else you want to change - excellent!
+
+You've worked out a way to fix it – even better!
+
+You want to tell us about it – best of all!
+
+Start at the `contributing guide `_!
+
+Contact
+=======
+
+`Discourse `_ is the discussion forum for general questions and discussions and our recommended starting point.
+
+Our active mailing lists (which are mirrored on Discourse) are:
+
+* `Users `_ mailing list: matplotlib-users@python.org
+* `Announcement `_ mailing list: matplotlib-announce@python.org
+* `Development `_ mailing list: matplotlib-devel@python.org
+
+Gitter_ is for coordinating development and asking questions directly related
+to contributing to matplotlib.
+
+
+Citing Matplotlib
+=================
+If Matplotlib contributes to a project that leads to publication, please
+acknowledge this by citing Matplotlib.
+
+`A ready-made citation entry `_ is available.
+
+
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/RECORD b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/RECORD
new file mode 100644
index 0000000..ff7d4aa
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/RECORD
@@ -0,0 +1,808 @@
+__pycache__/pylab.cpython-38.pyc,,
+matplotlib-3.4.2-py3.8-nspkg.pth,sha256=g9pwhlfLQRispACfr-Zaah4Psceyhyx9K_qv929IpMo,570
+matplotlib-3.4.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+matplotlib-3.4.2.dist-info/LICENSE,sha256=ojr3trhyymyw7GeYxkhO2JYoAxUVscbgMFz9b1qrcVM,4928
+matplotlib-3.4.2.dist-info/LICENSE_AMSFONTS,sha256=1nBvhOSH8d3ceR8cyG_bknr7Wg4RSmoB5M_HE72FVyE,12915
+matplotlib-3.4.2.dist-info/LICENSE_BAKOMA,sha256=1eFitoSKdvnOH02OCZL5B1v1I5GSKCJC-ac36uUaokc,1480
+matplotlib-3.4.2.dist-info/LICENSE_CARLOGO,sha256=zpO9wbKCiF7rqj4STQcHWjzLj_67kzhx1mzdwjnLdIE,4499
+matplotlib-3.4.2.dist-info/LICENSE_COLORBREWER,sha256=13Q--YD83BybM3nwuFLBxbUKygI9hALtJ8tZZiSQj5I,2006
+matplotlib-3.4.2.dist-info/LICENSE_JSXTOOLS_RESIZE_OBSERVER,sha256=7QUCZFhhOjyfNEcDDsbUAPaUy3QWkpKPWGIIv-Hl5y4,6907
+matplotlib-3.4.2.dist-info/LICENSE_QHULL,sha256=EG1VyTH9aoSCLlNF2QAnPQWfHCcxDQJWfMsxPF0YxV0,1720
+matplotlib-3.4.2.dist-info/LICENSE_QT4_EDITOR,sha256=AlDgmC0knGnjFWMZHYO0xVFQ4ws699gKFMSnKueffdM,1260
+matplotlib-3.4.2.dist-info/LICENSE_SOLARIZED,sha256=RrSaK9xcK12Uhuka3LOhEB_QW5ibbYX3kdwCakxULM0,1141
+matplotlib-3.4.2.dist-info/LICENSE_STIX,sha256=I3calycBxqh5ggJcyDvyYU4vu6Qf2bpleUWbTmWKDL4,3985
+matplotlib-3.4.2.dist-info/LICENSE_YORICK,sha256=iw-4fuTKjfpFYXIStZJ_pmLmIuZZWzUIpz6RwIKCSkk,2362
+matplotlib-3.4.2.dist-info/METADATA,sha256=tUceAGKyC0VTv6dXJl3aabt_QRiqN1UsoyHTOjH5-G0,5686
+matplotlib-3.4.2.dist-info/RECORD,,
+matplotlib-3.4.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+matplotlib-3.4.2.dist-info/WHEEL,sha256=HLtxc_HoM-kGM7FPJVPSnTt0Nv2G3fZEAjT3ICdG8uY,100
+matplotlib-3.4.2.dist-info/namespace_packages.txt,sha256=A2PHFg9NKYOU4pEQ1h97U0Qd-rB-65W34XqC-56ZN9g,13
+matplotlib-3.4.2.dist-info/top_level.txt,sha256=9tEw2ni8DdgX8CceoYHqSH1s50vrJ9SDfgtLIG8e3Y4,30
+matplotlib/__init__.py,sha256=ea-dOCwAhcVoVX4Z0zO2H7pWIAqvhPHFSfxw_aD5GQo,49279
+matplotlib/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/__pycache__/_animation_data.cpython-38.pyc,,
+matplotlib/__pycache__/_cm.cpython-38.pyc,,
+matplotlib/__pycache__/_cm_listed.cpython-38.pyc,,
+matplotlib/__pycache__/_color_data.cpython-38.pyc,,
+matplotlib/__pycache__/_constrained_layout.cpython-38.pyc,,
+matplotlib/__pycache__/_enums.cpython-38.pyc,,
+matplotlib/__pycache__/_internal_utils.cpython-38.pyc,,
+matplotlib/__pycache__/_layoutgrid.cpython-38.pyc,,
+matplotlib/__pycache__/_mathtext.cpython-38.pyc,,
+matplotlib/__pycache__/_mathtext_data.cpython-38.pyc,,
+matplotlib/__pycache__/_pylab_helpers.cpython-38.pyc,,
+matplotlib/__pycache__/_text_layout.cpython-38.pyc,,
+matplotlib/__pycache__/_version.cpython-38.pyc,,
+matplotlib/__pycache__/afm.cpython-38.pyc,,
+matplotlib/__pycache__/animation.cpython-38.pyc,,
+matplotlib/__pycache__/artist.cpython-38.pyc,,
+matplotlib/__pycache__/axis.cpython-38.pyc,,
+matplotlib/__pycache__/backend_bases.cpython-38.pyc,,
+matplotlib/__pycache__/backend_managers.cpython-38.pyc,,
+matplotlib/__pycache__/backend_tools.cpython-38.pyc,,
+matplotlib/__pycache__/bezier.cpython-38.pyc,,
+matplotlib/__pycache__/blocking_input.cpython-38.pyc,,
+matplotlib/__pycache__/category.cpython-38.pyc,,
+matplotlib/__pycache__/cm.cpython-38.pyc,,
+matplotlib/__pycache__/collections.cpython-38.pyc,,
+matplotlib/__pycache__/colorbar.cpython-38.pyc,,
+matplotlib/__pycache__/colors.cpython-38.pyc,,
+matplotlib/__pycache__/container.cpython-38.pyc,,
+matplotlib/__pycache__/contour.cpython-38.pyc,,
+matplotlib/__pycache__/dates.cpython-38.pyc,,
+matplotlib/__pycache__/docstring.cpython-38.pyc,,
+matplotlib/__pycache__/dviread.cpython-38.pyc,,
+matplotlib/__pycache__/figure.cpython-38.pyc,,
+matplotlib/__pycache__/font_manager.cpython-38.pyc,,
+matplotlib/__pycache__/fontconfig_pattern.cpython-38.pyc,,
+matplotlib/__pycache__/gridspec.cpython-38.pyc,,
+matplotlib/__pycache__/hatch.cpython-38.pyc,,
+matplotlib/__pycache__/image.cpython-38.pyc,,
+matplotlib/__pycache__/legend.cpython-38.pyc,,
+matplotlib/__pycache__/legend_handler.cpython-38.pyc,,
+matplotlib/__pycache__/lines.cpython-38.pyc,,
+matplotlib/__pycache__/markers.cpython-38.pyc,,
+matplotlib/__pycache__/mathtext.cpython-38.pyc,,
+matplotlib/__pycache__/mlab.cpython-38.pyc,,
+matplotlib/__pycache__/offsetbox.cpython-38.pyc,,
+matplotlib/__pycache__/patches.cpython-38.pyc,,
+matplotlib/__pycache__/path.cpython-38.pyc,,
+matplotlib/__pycache__/patheffects.cpython-38.pyc,,
+matplotlib/__pycache__/pylab.cpython-38.pyc,,
+matplotlib/__pycache__/pyplot.cpython-38.pyc,,
+matplotlib/__pycache__/quiver.cpython-38.pyc,,
+matplotlib/__pycache__/rcsetup.cpython-38.pyc,,
+matplotlib/__pycache__/sankey.cpython-38.pyc,,
+matplotlib/__pycache__/scale.cpython-38.pyc,,
+matplotlib/__pycache__/spines.cpython-38.pyc,,
+matplotlib/__pycache__/stackplot.cpython-38.pyc,,
+matplotlib/__pycache__/streamplot.cpython-38.pyc,,
+matplotlib/__pycache__/table.cpython-38.pyc,,
+matplotlib/__pycache__/texmanager.cpython-38.pyc,,
+matplotlib/__pycache__/text.cpython-38.pyc,,
+matplotlib/__pycache__/textpath.cpython-38.pyc,,
+matplotlib/__pycache__/ticker.cpython-38.pyc,,
+matplotlib/__pycache__/tight_bbox.cpython-38.pyc,,
+matplotlib/__pycache__/tight_layout.cpython-38.pyc,,
+matplotlib/__pycache__/transforms.cpython-38.pyc,,
+matplotlib/__pycache__/ttconv.cpython-38.pyc,,
+matplotlib/__pycache__/type1font.cpython-38.pyc,,
+matplotlib/__pycache__/units.cpython-38.pyc,,
+matplotlib/__pycache__/widgets.cpython-38.pyc,,
+matplotlib/_animation_data.py,sha256=ViIHgMu5dZqcV1p70NIPGeKi0efDkg5m0zUxf5hEfUY,8242
+matplotlib/_api/__init__.py,sha256=-GfprMzSgHD8fHV2Ra0k8q7lrabLfqOlLc9Geti3XWA,7004
+matplotlib/_api/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/_api/__pycache__/deprecation.cpython-38.pyc,,
+matplotlib/_api/deprecation.py,sha256=B4zPBL1hlEcbNwUz752etrg9xETn1C1mzP63TDaTE7s,20411
+matplotlib/_c_internal_utils.cp38-win_amd64.pyd,sha256=DmZIf-iXzqEyGaw378qyI2X7Tz2LVMNdubZaDk5-xUc,12288
+matplotlib/_cm.py,sha256=M9Z-57lyrTaFxj_08peYb4BA36TXsYGj9ZBvl45B07Q,67997
+matplotlib/_cm_listed.py,sha256=hA_9d8M187heFixIHIY9ywETb7eIOr9Ei4cDOx1y_pc,111533
+matplotlib/_color_data.py,sha256=ZnJq9AKcEl_cviGVCk5f4K6fT0nYB-iv-1k8xiNCOj4,36094
+matplotlib/_constrained_layout.py,sha256=FNESh7eqdfBH8UNYAECxVIfjBxjir_74MSPJTaBGJ48,24647
+matplotlib/_contour.cp38-win_amd64.pyd,sha256=qyEOFUoHoMqGYp7mWL1V4uGqLWykaTRS5UKQoBSEXNc,65024
+matplotlib/_enums.py,sha256=N-t5EkyaD_XiaDB9AVbf1eUezzj9V-2rFRyH327l5TM,7607
+matplotlib/_image.cp38-win_amd64.pyd,sha256=3jvtUBspHsPaqAGdPWEvA6w-tGDXtUFlf1umHkvRbBM,191488
+matplotlib/_internal_utils.py,sha256=MI2ymzqrQ1IH2yy6-n9mtm765vzgGSdEx7myejgbzt4,2204
+matplotlib/_layoutgrid.py,sha256=xviyyaKEbiTVOu5_RtVGCWYcVhAwp0IiiwdajT4I1m8,22492
+matplotlib/_mathtext.py,sha256=X2tINLOhNR3TpmSWgKDcemSk-wLLANGnE1w0ib2qIJc,109003
+matplotlib/_mathtext_data.py,sha256=XLXhU7C09UtKeJRyKrFCMMQLbn6plSD99kpHbZo9mJY,57313
+matplotlib/_path.cp38-win_amd64.pyd,sha256=9eJ2xRrlFELu_kHc55dw7maXJ2LTiFx32ypa_-fdpY0,161280
+matplotlib/_pylab_helpers.py,sha256=MUT_Bo2paRgwJ9Tb35AbB1irT56yvIaOhfTKj8Ukdd0,4632
+matplotlib/_qhull.cp38-win_amd64.pyd,sha256=6m_xBP2xA9wJQVEjsYEB45xd9PEpBn487OAHMBkD7tQ,476672
+matplotlib/_text_layout.py,sha256=Y95hW96uP-vgXkFV6M3bwIjgo3ur31b6Fv64cVbwde4,1227
+matplotlib/_tri.cp38-win_amd64.pyd,sha256=aU0xNSIPZF1Onwjg7Qmf94FTC1K8DXpXgL0d8I_qnWo,93184
+matplotlib/_ttconv.cp38-win_amd64.pyd,sha256=FkcJxMOpr6Ut4wDGFmnAQodd-zbpSFbKSVITPKZKjHI,64000
+matplotlib/_version.py,sha256=GGSQ14rup70E7geJZyvaJIg1zXDoXnaulkYwwOuYFEw,492
+matplotlib/afm.py,sha256=ENlPNEHKNvTlFxATyHznyv1vkWwtHJUj_u8l4LAfDkg,17223
+matplotlib/animation.py,sha256=mKlMpZAm18ocibOgIbSlf86a7j8vOF1oWBVZ4uZDEmg,71805
+matplotlib/artist.py,sha256=P85ADEoqubwt10DCLcZVHWWtNVEAU5-2hv0rHG7QpWc,58822
+matplotlib/axes/__init__.py,sha256=5LED7GJ0OxIdJfsHtnC1IYjxF9SNkyQg7UpmCkBT76k,48
+matplotlib/axes/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/axes/__pycache__/_axes.cpython-38.pyc,,
+matplotlib/axes/__pycache__/_base.cpython-38.pyc,,
+matplotlib/axes/__pycache__/_secondary_axes.cpython-38.pyc,,
+matplotlib/axes/__pycache__/_subplots.cpython-38.pyc,,
+matplotlib/axes/_axes.py,sha256=-7z1SQBFASsxIPnZBRBDeDbDv9ArGPDh7WmmnmPcbYQ,329517
+matplotlib/axes/_base.py,sha256=jNCHxskZKYTCgb8qKhqZ6VLBMwVQSDQYzQQCVdkp3yg,176069
+matplotlib/axes/_secondary_axes.py,sha256=uxwC7vgLEJUoWemx_8wwSukeSXVDzY9HXI6zQ3c_8_A,11069
+matplotlib/axes/_subplots.py,sha256=bBPHbwcXHNtOS0LStjbjjkthBuk9JOigIlOkp2hvvh4,8252
+matplotlib/axis.py,sha256=lOQRGma6knguY-esH43c-GlQzFrLzexiHPP3jccBSm8,94151
+matplotlib/backend_bases.py,sha256=5naB5t4QG8q52uyaxNeMvbVDmrdwxL7VhmVdqrsg6fo,133380
+matplotlib/backend_managers.py,sha256=kSWW6VzYdYFRUD0inlUOi8W9JX50kXBjoCp1BMRnjs8,13913
+matplotlib/backend_tools.py,sha256=pXeTSjYpGQEJcXzPDl4Rxp1wsWWjByJqpw5HBpmr3XU,35187
+matplotlib/backends/__init__.py,sha256=ASrypuHdJgwLQwfr7X9ou0hlJohw_7V4t8CmpazOY7I,109
+matplotlib/backends/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/backends/__pycache__/_backend_pdf_ps.cpython-38.pyc,,
+matplotlib/backends/__pycache__/_backend_tk.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_agg.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_cairo.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_gtk3.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_gtk3agg.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_gtk3cairo.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_macosx.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_mixed.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_nbagg.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_pdf.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_pgf.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_ps.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_qt4.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_qt4agg.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_qt4cairo.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_qt5.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_qt5agg.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_qt5cairo.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_svg.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_template.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_tkagg.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_tkcairo.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_webagg.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_webagg_core.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_wx.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_wxagg.cpython-38.pyc,,
+matplotlib/backends/__pycache__/backend_wxcairo.cpython-38.pyc,,
+matplotlib/backends/__pycache__/qt_compat.cpython-38.pyc,,
+matplotlib/backends/_backend_agg.cp38-win_amd64.pyd,sha256=sn5mDSuCnosI_110HDM0dzsBQMqjm3iiimpfmoK-5yE,238592
+matplotlib/backends/_backend_pdf_ps.py,sha256=HS6ZnbKHaKyUHvMUaw1pDhqZqb39dtpyp_jZfXWsNdM,4274
+matplotlib/backends/_backend_tk.py,sha256=w0T5xNoGDfXei_fcLCANdaWDn2iLOSWJeSmxZuCZLGU,34699
+matplotlib/backends/_tkagg.cp38-win_amd64.pyd,sha256=NYCjKwA1QzjnbYRwDm4lDi3QT9BRxe7KTSqyl5QaH8o,12800
+matplotlib/backends/backend_agg.py,sha256=bpXhm8_X6KH7alOjxFL7bymfqsKf96sgB-d418ZCAFI,23495
+matplotlib/backends/backend_cairo.py,sha256=N-E27scNIvhoyh8WRRSs1fcpEklWDKBOIts8p9BKwWk,19473
+matplotlib/backends/backend_gtk3.py,sha256=Buoo-W2_X4D1nHtERf-Ux8Oyx6cmqwIg8AURmoHauSU,30718
+matplotlib/backends/backend_gtk3agg.py,sha256=CZynWriGhHAZfcqDQcwJ3b0ZMgn-Lj6ZVHBDgs0OcUo,2890
+matplotlib/backends/backend_gtk3cairo.py,sha256=2_yq79ogT8_6CawqbmK7AmSz9-gZfOODmYWhf7QWBfY,1250
+matplotlib/backends/backend_macosx.py,sha256=HfY7kbjVxIb-0g1mcht34nPIT8xZYN7TF8uCIwopTuo,4891
+matplotlib/backends/backend_mixed.py,sha256=McBUIpHzNQZQzn1HQQglENUGpesH65epXo8TeD_8aIw,4844
+matplotlib/backends/backend_nbagg.py,sha256=r9NhaktW2cYr2dRYpHzoKsDjJ3ET31W426YV9J0Hbjs,8898
+matplotlib/backends/backend_pdf.py,sha256=1tJxUJLmttbWLmry4QXV3Nw31UxROFqLMhOh7JUYAlY,105041
+matplotlib/backends/backend_pgf.py,sha256=pM-9ZGDgMsmm0EkGoJ44HnjtJ9-B_aLXtIn5MCB--Uw,42155
+matplotlib/backends/backend_ps.py,sha256=dtz55m3mEqrcMVDQthyNx_nLrPeMIOzydthhaCieSxc,50330
+matplotlib/backends/backend_qt4.py,sha256=NMx2OHwNDTvTE_o_G1zVUUkXUH9nFcB2w6uiG0obZDc,526
+matplotlib/backends/backend_qt4agg.py,sha256=p1yawJDwGv-4Lk2VFnRWYsy8njEEmj-frI2MSZ2w5IE,393
+matplotlib/backends/backend_qt4cairo.py,sha256=MHkN4s3viC4zaTvjqbXUwknUfijhZuYn94ENlyBsGAE,325
+matplotlib/backends/backend_qt5.py,sha256=T0dQwnk53SHphPikqau5xzJet8xc18W5KCLjDKdtqgs,39882
+matplotlib/backends/backend_qt5agg.py,sha256=1JG893-G1URgI1FTu5dU7h1SLec8AfjZhUKcuKheMkM,3138
+matplotlib/backends/backend_qt5cairo.py,sha256=5XEV8bAFB-XUFPMJfIcplW5R_eI16ZzEolzoM6k05as,1840
+matplotlib/backends/backend_svg.py,sha256=12BsmmZng6x4SuHEP3oHsXtgj3WXP8Pve9GGhiUJxi8,50804
+matplotlib/backends/backend_template.py,sha256=feDC3FHa4tMEYyCO04KiTEBhN2_6o9-0-yXywB1nynY,9166
+matplotlib/backends/backend_tkagg.py,sha256=U8Qm2N4s178Pc14JmGzkLhGqpB5OqqiRqadoVzVG-8o,549
+matplotlib/backends/backend_tkcairo.py,sha256=gsEnb6lZ7mgsz30-Qx88eQXnBtu_3yV6OaZJ3gj8bH8,1034
+matplotlib/backends/backend_webagg.py,sha256=hvCJqMaup9UaDvO3x7WyCxSxU9gOd3WcKdFA3KE42N0,11116
+matplotlib/backends/backend_webagg_core.py,sha256=mMaquqwmFCsIzTBxVD69MryxnaC1kNmooKgdnLpd-08,17995
+matplotlib/backends/backend_wx.py,sha256=FtDDKLinnMre85SlFKJR5_7ZbQrLiEwVuE-a1ibNmBQ,56422
+matplotlib/backends/backend_wxagg.py,sha256=Q1T9noO_Jiam0hvNcuxDRB5UP09aJf-6sY89N6V2-w8,3008
+matplotlib/backends/backend_wxcairo.py,sha256=boEX-jbUT1NlIhKqjj71V0IOhV5jvWXbVg9Zay_CCZE,1862
+matplotlib/backends/qt_compat.py,sha256=cuQTKY9Pj0HzTzCc0_CYiG0I3bPR-AztsdeKNdX3Dn4,8651
+matplotlib/backends/qt_editor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+matplotlib/backends/qt_editor/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/backends/qt_editor/__pycache__/_formlayout.cpython-38.pyc,,
+matplotlib/backends/qt_editor/__pycache__/_formsubplottool.cpython-38.pyc,,
+matplotlib/backends/qt_editor/__pycache__/figureoptions.cpython-38.pyc,,
+matplotlib/backends/qt_editor/__pycache__/formsubplottool.cpython-38.pyc,,
+matplotlib/backends/qt_editor/_formlayout.py,sha256=zyvqieJwseTHV06Y02052A475_IlZ-jKMjGTUwoBPGw,20997
+matplotlib/backends/qt_editor/_formsubplottool.py,sha256=IJRLiHJYNay9dq8soSR30RpzsDy2QGK_VM-de-skcMM,1547
+matplotlib/backends/qt_editor/figureoptions.py,sha256=Bv1fpNcBEGJZNaqaJ8fEfZThl4cxxlnlMAPl5HBpE6g,9731
+matplotlib/backends/qt_editor/formsubplottool.py,sha256=5apF6aBdCjM5owZSyFel38uieSADDHdeNxcWbAI1mhw,242
+matplotlib/backends/web_backend/.eslintrc.js,sha256=Dv3YGyMCOxbDobwrxr332zNYMCxb6s_o07kQeizIko8,698
+matplotlib/backends/web_backend/.prettierignore,sha256=fhFE5YEVNHXvenOGu5fVvhzhGEMjutAocXz36mDB0iw,104
+matplotlib/backends/web_backend/.prettierrc,sha256=Yz-e2yrtBxjx8MeDh7Z55idCjKgOxGZwSe6PQJo-4z0,156
+matplotlib/backends/web_backend/all_figures.html,sha256=4iWdKDVq2wj-ox_wGB6jT_5a1XIZfx7cCSxptQr11_U,1669
+matplotlib/backends/web_backend/css/boilerplate.css,sha256=y2DbHYWFOmDcKhmUwACIwgZdL8mRqldKiQfABqlrCtA,2387
+matplotlib/backends/web_backend/css/fbm.css,sha256=-5wOcfCz-3RLDtEhOPo855AyDpxEnhN6hjeKuQi7ALE,1570
+matplotlib/backends/web_backend/css/mpl.css,sha256=VfGbqCCnb-3ZCSgUyv1PcmfEPvank9340v-F2oyhapw,1695
+matplotlib/backends/web_backend/css/page.css,sha256=qCCXiXJvwyM3zKpOlrhndn2kZl0CpOcd2ZDXA4JlLwo,1707
+matplotlib/backends/web_backend/ipython_inline_figure.html,sha256=C4mEsVfrNuy5K92pzLtrgw0wP_XG_-2h74CTngsPvCQ,1345
+matplotlib/backends/web_backend/js/mpl.js,sha256=vgW7Sw01F_MtJ2zrUUiphOIdqKHG5mhwiCcpMOkBDw8,24220
+matplotlib/backends/web_backend/js/mpl_tornado.js,sha256=k3JjkEWP-C2DCk8qrA3JPXFRl8Xu6gCf7zMtBZO4s5c,310
+matplotlib/backends/web_backend/js/nbagg_mpl.js,sha256=ZRlA0U58gd5SU5NWDoy2Kl1Bsgm1ymkD6fpkVUABlaI,9918
+matplotlib/backends/web_backend/nbagg_uat.ipynb,sha256=XFzIUAjjFQfbvwpOGnrcpkpOc0tUPjLY9I-y2yA9A5s,17062
+matplotlib/backends/web_backend/package.json,sha256=f8YHuIsmdbdBkAGmymVs_wWmHYAQNPI8JFOyWgfQu3M,563
+matplotlib/backends/web_backend/single_figure.html,sha256=Tv4FxHdVi872xGsC_WHeOsR9zCUmWNR4KoqEur9nTJ4,1276
+matplotlib/bezier.py,sha256=MMSR7fv8hQEKGl_Jjx2CaDGT1dzRlcSsrev-ou8x4R8,20076
+matplotlib/blocking_input.py,sha256=7sA_9oUauGvhBKnRBPUbvpel_5SVWmQN_Q3J9_1xDmc,11456
+matplotlib/category.py,sha256=gRhNTbC-p3Zv9wma-1uk38SmbrgW4JNG-EVNogHw59o,7765
+matplotlib/cbook/__init__.py,sha256=wAmDSwlp_jcWi5S6JIpncAPNocIxmq1__Q-kGTdlIs0,78304
+matplotlib/cbook/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/cbook/__pycache__/deprecation.cpython-38.pyc,,
+matplotlib/cbook/deprecation.py,sha256=MlMbkBmm51Ak1_aKix6xV1wtRztBvI-sZGgs6AHfUcg,365
+matplotlib/cm.py,sha256=tuFP2V6E1s2olf4dqgcBKnay8Fmno1QXkBP5LsiJH-s,17476
+matplotlib/collections.py,sha256=QWkx6mEqhgneookE7WGMWRGAQBLQk4bw4f6LZugqzEY,83016
+matplotlib/colorbar.py,sha256=CFdh-CoCxDdQvJFGWZzPMECKJ6rGSUSug5unlfCD8BY,62046
+matplotlib/colors.py,sha256=CaUDm4AKhVKw1eOwbldqmgTjiCvH7KGhadgY092Ex2s,90456
+matplotlib/compat/__init__.py,sha256=HwISzrppZWgB5-teEMgAH52FVRQMfqDSqFI02nWgRJ4,96
+matplotlib/compat/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/container.py,sha256=le7rKOkN7B9b8JEHICr2QwD5gsFnnqMCSAO0yKcu5hs,4724
+matplotlib/contour.py,sha256=HWtemrqDUBKEevr_oMAEUukFhVBTrWsICSmYRTCXK_M,70205
+matplotlib/dates.py,sha256=zGrplEdNqVlXVAshy7sMUbLLtb4fLZC6WNiS3nh-S8Q,70179
+matplotlib/docstring.py,sha256=uAD3VM2SWZ45LOE6htNlVdbYsGQgfQOGQntwwFrwEPs,2424
+matplotlib/dviread.py,sha256=4nG5OmDYQwcxOJBTblsIpBTCzGUHtjr5NN1_qM2BBr0,41796
+matplotlib/figure.py,sha256=ZVtyjimyep5lvA3LY10i6saZ9zWJnayGFct2D0T8KPk,122024
+matplotlib/font_manager.py,sha256=eHm13hK7rePbGKfXz0J2f1IF2blHz4Sz1k00YkiR9ww,51172
+matplotlib/fontconfig_pattern.py,sha256=J5-yG_qyi4ACRcDVw7aopFv3raii8QC4DhRPnhLkb5Q,6860
+matplotlib/ft2font.cp38-win_amd64.pyd,sha256=G8yL0wnzSCdyuL4osLDiBWAifeMBlYnWJP41vAzll9g,607232
+matplotlib/gridspec.py,sha256=vSJw-XfwC168WRoor2H7TOEB_C496ZFQKSZYIg4a5dU,32892
+matplotlib/hatch.py,sha256=IJSikXfrCSJuy54w7__ST7b8tJlHYRsFBS_BqgviG3o,7969
+matplotlib/image.py,sha256=rd8F-vrXa2m2r_l61Xk0BVwvADok4SqUjFi-3GIoV4g,69217
+matplotlib/legend.py,sha256=VW3-MJlRnUHdVlpfE7wsl8E7s3nGt4AdkFVIzgFhq24,49718
+matplotlib/legend_handler.py,sha256=pAaUTNQ-bUuA12zQylLxKQBXMn1RWVaSSc4XWKHZMbY,28465
+matplotlib/lines.py,sha256=SwwBmTv1yc7zR1U1y6FQDip6qAzveVPKep7E2c-Ely8,53695
+matplotlib/markers.py,sha256=j-VXlaCNvsm5fjncT_seWGhLbnrSbjeOoNchD4TnvgE,31746
+matplotlib/mathtext.py,sha256=k6O96YfW82MKdSClGb1jdwO5hSvh0dNtVRzBoa_bq4I,20734
+matplotlib/mlab.py,sha256=gdQ-osQi_q-0uRCDdWqOXUDcx9qh-qvn0GkpXG9axag,33224
+matplotlib/mpl-data/fonts/afm/cmex10.afm,sha256=zdDttyyqQ6Aa5AMVWowpNWgEksTX5KUAFqUjFMTBiUc,12290
+matplotlib/mpl-data/fonts/afm/cmmi10.afm,sha256=dCq-QWC9Vl4WmcD9IOi-CMMB-vmVj8VBTOJS20ODMC0,10742
+matplotlib/mpl-data/fonts/afm/cmr10.afm,sha256=bGb6XAS-H48vh-vmvrF0lMunP1c-RGNB3Uzm1Am9vew,10444
+matplotlib/mpl-data/fonts/afm/cmsy10.afm,sha256=lxhR0CjcTVxKsQ4GPe8ypC4DdYCbn5j4IXlq2QTAcDM,8490
+matplotlib/mpl-data/fonts/afm/cmtt10.afm,sha256=kFzBQ0WX0GZBss0jl_MogJ7ZvECCE8MnLpX58IFRUFU,6657
+matplotlib/mpl-data/fonts/afm/pagd8a.afm,sha256=_-81-K4IGcnEXZmOqkIMyL42gBRcxMEuk8N8onDtLIM,17759
+matplotlib/mpl-data/fonts/afm/pagdo8a.afm,sha256=GrsbRiN4fuoPK-SiaMngnmi5KyZC_nOFf_LYFk_Luxg,17831
+matplotlib/mpl-data/fonts/afm/pagk8a.afm,sha256=Fjz-OUzE9qB-MCosDuUrBnMq8BXmldx6j_zgj2mKc1k,17814
+matplotlib/mpl-data/fonts/afm/pagko8a.afm,sha256=pS716alw6ytmYYSRnz6hPvb1BZPlq3aUiViJFYagsHk,17919
+matplotlib/mpl-data/fonts/afm/pbkd8a.afm,sha256=WOJW5hnEnwBQGQsVxtdXI2PJ1m8qwF-xC4n6aD3-hRI,15572
+matplotlib/mpl-data/fonts/afm/pbkdi8a.afm,sha256=6D2SRhcYc-apq_Qq62bj_FwU_uHxIK09Tt_wjSSJS7c,15695
+matplotlib/mpl-data/fonts/afm/pbkl8a.afm,sha256=_ZJuFBKoz70E-SBlhG4Tb9Yqxm3I6D-jALpy-R-vcew,15407
+matplotlib/mpl-data/fonts/afm/pbkli8a.afm,sha256=1_6b55YPDXk9a3RUnNvja7y2iR3P6BKnh6DvkPnZ5pA,15591
+matplotlib/mpl-data/fonts/afm/pcrb8a.afm,sha256=5CDJe3t71aM5qinDYSE8svWhc6RjteZPNslOvNVp8NA,15696
+matplotlib/mpl-data/fonts/afm/pcrbo8a.afm,sha256=jNfbbBHfwvu0RglxuLeuh1K10KWEkj1lEVJR_hXQSWE,15766
+matplotlib/mpl-data/fonts/afm/pcrr8a.afm,sha256=Hx4X9kbsRm_S3eo9WLjuOQzuOmeZHO33b6uhDTsH1NQ,15683
+matplotlib/mpl-data/fonts/afm/pcrro8a.afm,sha256=DLrBm4iOvjCpKBnyC7yGAO4fdIvRUCO0uV_kQiy9VfQ,15787
+matplotlib/mpl-data/fonts/afm/phvb8a.afm,sha256=PR_ybr2HVx6aOXVRza7a-255AtGEyDwj_pC_xK1VH1o,17725
+matplotlib/mpl-data/fonts/afm/phvb8an.afm,sha256=pFHdjRgEoKxxmlf1PcTc-3Hyzh1Fzz2Xe2A8KzT3JuA,17656
+matplotlib/mpl-data/fonts/afm/phvbo8a.afm,sha256=4ocMbnfWYxd-YhpzbWPDRzDdckBRIlEHPZfAORFiaZQ,17800
+matplotlib/mpl-data/fonts/afm/phvbo8an.afm,sha256=cOAehWQUbLAtfhcWjTgZc8aLvKo_cWom0JdqmKDPsTo,17765
+matplotlib/mpl-data/fonts/afm/phvl8a.afm,sha256=QTqJU4cVVtbvZhqGXFAMRNyZxlJtmq6HE6UIbh6vLYE,16072
+matplotlib/mpl-data/fonts/afm/phvlo8a.afm,sha256=fAEd2GRQzamnndBw4ARWkJNKIBgmW24Jvo4wZDUVPRg,16174
+matplotlib/mpl-data/fonts/afm/phvr8a.afm,sha256=7G6gNk10zsb_wkQ2qov_SuIMtspNafAGppFQ9V-7Fmo,18451
+matplotlib/mpl-data/fonts/afm/phvr8an.afm,sha256=9TCWRgRyCgpwpKiF98j10hq9mHjdGv09aU96mcgfx2k,18393
+matplotlib/mpl-data/fonts/afm/phvro8a.afm,sha256=9eXW8tsJO-8iw98HCd9H7sIbG5d3fQ-ik5-XXXMkm-8,18531
+matplotlib/mpl-data/fonts/afm/phvro8an.afm,sha256=Rgr4U-gChgMcWU5VyFMwPg2gGXB5D9DhrbtYtWb7jSE,18489
+matplotlib/mpl-data/fonts/afm/pncb8a.afm,sha256=ZAfYR6gDZoTjPw1X9CKXAKhdGZzgSlDfdmxFIAaNMP0,16500
+matplotlib/mpl-data/fonts/afm/pncbi8a.afm,sha256=h6gIWhFKh3aiUMuA4QPCKN39ja1CJWDnagz-rLJWeJA,18098
+matplotlib/mpl-data/fonts/afm/pncr8a.afm,sha256=wqphv_7-oIEDrGhzQspyDeFD07jzAs5uaSbLnrZ53q0,17189
+matplotlib/mpl-data/fonts/afm/pncri8a.afm,sha256=mXZEWq-pTgsOG8_Nx5F52DMF8RB63RzAVOnH3QcRWPo,17456
+matplotlib/mpl-data/fonts/afm/pplb8a.afm,sha256=Yd8M-qXEemyVsBt4OY7vKYqr7Yc_KfRnb2E505ij3Ts,16096
+matplotlib/mpl-data/fonts/afm/pplbi8a.afm,sha256=BLReUiSSOvoiaTymK8hwqWCR2ndXJR2U2FAU2YKVhgM,16251
+matplotlib/mpl-data/fonts/afm/pplr8a.afm,sha256=OdM7mp--HfFWfp9IwolGoviuHphoATNFl88OG3h3Uw8,16197
+matplotlib/mpl-data/fonts/afm/pplri8a.afm,sha256=n0_vo-JC8voK6FKHvnZCygzsvTfNllQRya3L0dtTRZY,16172
+matplotlib/mpl-data/fonts/afm/psyr.afm,sha256=HItpBqCppGKaLaLUdijTZ31jzUV13UVEohYVUPSk1Kc,9853
+matplotlib/mpl-data/fonts/afm/ptmb8a.afm,sha256=td8VINDw_7_X3U6dHLcNxT-_2wU_CqaTSntSW696-M8,18631
+matplotlib/mpl-data/fonts/afm/ptmbi8a.afm,sha256=ZbK1H28xxIwcZGSqGR6iVtpMrZ15LRN1OfVLpt1yiZ8,18718
+matplotlib/mpl-data/fonts/afm/ptmr8a.afm,sha256=lwDiLF8RkJ46RoVFY0qEQ9J_h54cQHF6MCRx3ehLG_Y,18590
+matplotlib/mpl-data/fonts/afm/ptmri8a.afm,sha256=rYNz084EPuCgdbZcIvuaXA77ozg5sOgmGZjwpFzDGKQ,18716
+matplotlib/mpl-data/fonts/afm/putb8a.afm,sha256=RJuuhzr-dyocKMX4pgC9UoK3Ive2bnWtk74Oyx7ZBPk,22537
+matplotlib/mpl-data/fonts/afm/putbi8a.afm,sha256=1gyQknXqpiVmyKrcRhmenSJrP0kot5h84HmWtDQ3Leg,22948
+matplotlib/mpl-data/fonts/afm/putr8a.afm,sha256=Y_v97ZJKRPfPI2cFuFstBtBxRbAf3AK-hHYDVswMtdA,23177
+matplotlib/mpl-data/fonts/afm/putri8a.afm,sha256=Hxu2gSVpV93zKO6ecqtZSJZHQyE1xhwcUnh-RJ8TYPo,22899
+matplotlib/mpl-data/fonts/afm/pzcmi8a.afm,sha256=BhzLcod8-nVd2MWeZsO_GoZUXso4OhQktIZ2e7txJY8,16730
+matplotlib/mpl-data/fonts/afm/pzdr.afm,sha256=a7-NgSTSEyakts84h-hXLrbRrxmFhxr_NR51bhOLZYQ,9689
+matplotlib/mpl-data/fonts/pdfcorefonts/Courier-Bold.afm,sha256=rQFQ1L7cyId3Qr-UJR_OwT40jdWZ1GA_Z52SAn0ebpk,15675
+matplotlib/mpl-data/fonts/pdfcorefonts/Courier-BoldOblique.afm,sha256=y4LmnvX21CHo9AT-ALsNmTQlqueXJTMdDr-EfpTpfpI,15741
+matplotlib/mpl-data/fonts/pdfcorefonts/Courier-Oblique.afm,sha256=snEDsqLvYDDBEGJll-KrR7uCeQdaA5q5Fw-ssKofcOE,15783
+matplotlib/mpl-data/fonts/pdfcorefonts/Courier.afm,sha256=Uh4NfHUh79S-eKWpxTmOTGfQdx45YRWwNGvE73StpT0,15677
+matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-Bold.afm,sha256=uIDZa69W0MwFnyWPYLTXZO9JtVWrnbKUuVnAAW3uQfI,72096
+matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-BoldOblique.afm,sha256=aZhKNcomlzo58mHPg-DTZ-ouZRfFkLCwMNTUohnZwmk,72192
+matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-Oblique.afm,sha256=tGCbcbZgo5KsCd81BgJxqHbCzmZhfdg7-Cb3QrudlyE,77443
+matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica.afm,sha256=2jPxhwR0yOaL_j4jU_8QerbG7qH5g2ziqvHhoHsXmC8,77343
+matplotlib/mpl-data/fonts/pdfcorefonts/Symbol.afm,sha256=PSEoqCA3WhDem8i_bPsV3tSCwByg-VzAsyd_N-yL3mY,9953
+matplotlib/mpl-data/fonts/pdfcorefonts/Times-Bold.afm,sha256=tKAA7YXLIsbN2YWqD9P2947VB5t8aGDcTwI04NDjxSI,66839
+matplotlib/mpl-data/fonts/pdfcorefonts/Times-BoldItalic.afm,sha256=k8R0S6lVIV3gLEquC3dxM0Qq2i96taKvMKBAt5KzxV0,62026
+matplotlib/mpl-data/fonts/pdfcorefonts/Times-Italic.afm,sha256=7Tf6LmpntbF9_Ufzb8fpDfMokaRAiGDbyNTLvplZ4kI,68995
+matplotlib/mpl-data/fonts/pdfcorefonts/Times-Roman.afm,sha256=do4cq-oIXUiaY9o-gLlrxavw7JjTBzybTWunbnvMumQ,62879
+matplotlib/mpl-data/fonts/pdfcorefonts/ZapfDingbats.afm,sha256=oyVlyQr9G1enAI_FZ7eNlc8cIq3_XghglNZm2IsDmFk,9752
+matplotlib/mpl-data/fonts/pdfcorefonts/readme.txt,sha256=yQ1iD9441TPPu5-v-4nng62AUWpOPwW1M_NoeYTwGYQ,843
+matplotlib/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf,sha256=sYS4njwQdfIva3FXW2_CDUlys8_TsjMiym_Vltyu8Wc,704128
+matplotlib/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf,sha256=bt8CgxYBhq9FHL7nHnuEXy5Mq_Jku5ks5mjIPCVGXm8,641720
+matplotlib/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf,sha256=zN90s1DxH9PdV3TeUOXmNGoaXaH1t9X7g1kGZel6UhM,633840
+matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf,sha256=P99pyr8GBJ6nCgC1kZNA4s4ebQKwzDxLRPtoAb0eDSI,756072
+matplotlib/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf,sha256=ggmdz7paqGjN_CdFGYlSX-MpL3N_s8ngMozpzvWWUvY,25712
+matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf,sha256=uq2ppRcv4giGJRr_BDP8OEYZEtXa8HKH577lZiCo2pY,331536
+matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf,sha256=ppCBwVx2yCfgonpaf1x0thNchDSZlVSV_6jCDTqYKIs,253116
+matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf,sha256=KAUoE_enCfyJ9S0ZLcmV708P3Fw9e3OknWhJsZFtDNA,251472
+matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf,sha256=YC7Ia4lIz82VZIL-ZPlMNshndwFJ7y95HUYT9EO87LM,340240
+matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf,sha256=w3U_Lta8Zz8VhG3EWt2-s7nIcvMvsY_VOiHxvvHtdnY,355692
+matplotlib/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf,sha256=2T7-x6nS6CZ2jRou6VuVhw4V4pWZqE80hK8d4c7C4YE,347064
+matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf,sha256=PnmU-8VPoQzjNSpC1Uj63X2crbacsRCbydlg9trFfwQ,345612
+matplotlib/mpl-data/fonts/ttf/DejaVuSerif.ttf,sha256=EHJElW6ZYrnpb6zNxVGCXgrgiYrhNzcTPhuSGi_TX_o,379740
+matplotlib/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf,sha256=KRTzLkfHd8J75Wd6-ufbTeefnkXeb8kJfZlJwjwU99U,14300
+matplotlib/mpl-data/fonts/ttf/LICENSE_DEJAVU,sha256=xhup6GaKURy9C8_e6DKeAspspASKvabKfuisaKBZd2o,4915
+matplotlib/mpl-data/fonts/ttf/LICENSE_STIX,sha256=LVswXqq9O9oRWEuSeKQwviEY8mU7yjTzd4SS_6gFyhY,5599
+matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf,sha256=FnN4Ax4t3cYhbWeBnJJg6aBv_ExHjk4jy5im_USxg8I,448228
+matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf,sha256=6FM9xwg_o0a9oZM9YOpKg7Z9CUW86vGzVB-CtKDixqA,237360
+matplotlib/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf,sha256=mHiP1LpI37sr0CbA4gokeosGxzcoeWKLemuw1bsJc2w,181152
+matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf,sha256=bPyzM9IrfDxiO9_UAXTxTIXD1nMcphZsHtyAFA6uhSc,175040
+matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf,sha256=Ulb34CEzWsSFTRgPDovxmJZOwvyCAXYnbhaqvGU3u1c,59108
+matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf,sha256=XRBqW3jR_8MBdFU0ObhiV7-kXwiBIMs7QVClHcT5tgs,30512
+matplotlib/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf,sha256=pb22DnbDf2yQqizotc3wBDqFGC_g27YcCGJivH9-Le8,41272
+matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf,sha256=BMr9pWiBv2YIZdq04X4c3CgL6NPLUPrl64aV1N4w9Ug,46752
+matplotlib/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf,sha256=wYuH1gYUpCuusqItRH5kf9p_s6mUD-9X3L5RvRtKSxs,13656
+matplotlib/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf,sha256=yNdvjUoSmsZCULmD7SVq9HabndG9P4dPhboL1JpAf0s,12228
+matplotlib/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf,sha256=-9xVMYL4_1rcO8FiCKrCfR4PaSmKtA42ddLGqwtei1w,15972
+matplotlib/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf,sha256=cYexyo8rZcdqMlpa9fNF5a2IoXLUTZuIvh0JD1Qp0i4,12556
+matplotlib/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf,sha256=0lbHzpndzJmO8S42mlkhsz5NbvJLQCaH5Mcc7QZRDzc,19760
+matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf,sha256=3eBc-VtYbhQU3BnxiypfO6eAzEu8BdDvtIJSFbkS2oY,12192
+matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf,sha256=XFSKCptbESM8uxHtUFSAV2cybwxhSjd8dWVByq6f3w0,15836
+matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf,sha256=MUCYHrA0ZqFiSE_PjIGlJZgMuv79aUgQqE7Dtu3kuo0,12116
+matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf,sha256=_sdxDuEwBDtADpu9CyIXQxV7sIqA2TZVBCUiUjq5UCk,15704
+matplotlib/mpl-data/fonts/ttf/cmb10.ttf,sha256=B0SXtQxD6ldZcYFZH5iT04_BKofpUQT1ZX_CSB9hojo,25680
+matplotlib/mpl-data/fonts/ttf/cmex10.ttf,sha256=ryjwwXByOsd2pxv6WVrKCemNFa5cPVTOGa_VYZyWqQU,21092
+matplotlib/mpl-data/fonts/ttf/cmmi10.ttf,sha256=MJKWW4gR_WpnZXmWZIRRgfwd0TMLk3-RWAjEhdMWI00,32560
+matplotlib/mpl-data/fonts/ttf/cmr10.ttf,sha256=Tdl2GwWMAJ25shRfVe5mF9CTwnPdPWxbPkP_YRD6m_Y,26348
+matplotlib/mpl-data/fonts/ttf/cmss10.ttf,sha256=ffkag9BbLkcexjjLC0NaNgo8eSsJ_EKn2mfpHy55EVo,20376
+matplotlib/mpl-data/fonts/ttf/cmsy10.ttf,sha256=uyJu2TLz8QDNDlL15JEu5VO0G2nnv9uNOFTbDrZgUjI,29396
+matplotlib/mpl-data/fonts/ttf/cmtt10.ttf,sha256=YhHwmuk1mZka_alwwkZp2tGnfiU9kVYk-_IS9wLwcdc,28136
+matplotlib/mpl-data/images/back-symbolic.svg,sha256=yRdMiKsa-awUm2x_JE_rEV20rNTa7FInbFBEoMo-6ik,1512
+matplotlib/mpl-data/images/back.pdf,sha256=ZR7CJo_dAeCM-KlaGvskgtHQyRtrPIolc8REOmcoqJk,1623
+matplotlib/mpl-data/images/back.png,sha256=E4dGf4Gnz1xJ1v2tMygHV0YNQgShreDeVApaMb-74mU,380
+matplotlib/mpl-data/images/back.svg,sha256=yRdMiKsa-awUm2x_JE_rEV20rNTa7FInbFBEoMo-6ik,1512
+matplotlib/mpl-data/images/back_large.png,sha256=9A6hUSQeszhYONE4ZuH3kvOItM0JfDVu6tkfromCbsQ,620
+matplotlib/mpl-data/images/filesave-symbolic.svg,sha256=oxPVbLS9Pzelz71C1GCJWB34DZ0sx_pUVPRHBrCZrGs,2029
+matplotlib/mpl-data/images/filesave.pdf,sha256=P1EPPV2g50WTt8UaX-6kFoTZM1xVqo6S2H6FJ6Zd1ec,1734
+matplotlib/mpl-data/images/filesave.png,sha256=b7ctucrM_F2mG-DycTedG_a_y4pHkx3F-zM7l18GLhk,458
+matplotlib/mpl-data/images/filesave.svg,sha256=oxPVbLS9Pzelz71C1GCJWB34DZ0sx_pUVPRHBrCZrGs,2029
+matplotlib/mpl-data/images/filesave_large.png,sha256=LNbRD5KZ3Kf7nbp-stx_a1_6XfGBSWUfDdpgmnzoRvk,720
+matplotlib/mpl-data/images/forward-symbolic.svg,sha256=NnQDOenfjsn-o0aJMUfErrP320Zcx9XHZkLh0cjMHsk,1531
+matplotlib/mpl-data/images/forward.pdf,sha256=KIqIL4YId43LkcOxV_TT5uvz1SP8k5iUNUeJmAElMV8,1630
+matplotlib/mpl-data/images/forward.png,sha256=pKbLepgGiGeyY2TCBl8svjvm7Z4CS3iysFxcq4GR-wk,357
+matplotlib/mpl-data/images/forward.svg,sha256=NnQDOenfjsn-o0aJMUfErrP320Zcx9XHZkLh0cjMHsk,1531
+matplotlib/mpl-data/images/forward_large.png,sha256=36h7m7DZDHql6kkdpNPckyi2LKCe_xhhyavWARz_2kQ,593
+matplotlib/mpl-data/images/hand.pdf,sha256=hspwkNY915KPD7AMWnVQs7LFPOtlcj0VUiLu76dMabQ,4172
+matplotlib/mpl-data/images/hand.png,sha256=2cchRETGKa0hYNKUxnJABwkyYXEBPqJy_VqSPlT0W2Q,979
+matplotlib/mpl-data/images/hand.svg,sha256=tsVIES_nINrAbH4FqdsCGOx0SVE37vcofSYBhnnaOP0,4888
+matplotlib/mpl-data/images/help-symbolic.svg,sha256=KXabvQhqIWen_t2SvZuddFYa3S0iI3W8cAKm3s1fI8Q,1870
+matplotlib/mpl-data/images/help.pdf,sha256=CeE978IMi0YWznWKjIT1R8IrP4KhZ0S7usPUvreSgcA,1813
+matplotlib/mpl-data/images/help.png,sha256=s4pQrqaQ0py8I7vc9hv3BI3DO_tky-7YBMpaHuBDCBY,472
+matplotlib/mpl-data/images/help.svg,sha256=KXabvQhqIWen_t2SvZuddFYa3S0iI3W8cAKm3s1fI8Q,1870
+matplotlib/mpl-data/images/help_large.png,sha256=1IwEyWfGRgnoCWM-r9CJHEogTJVD5n1c8LXTK4AJ4RE,747
+matplotlib/mpl-data/images/home-symbolic.svg,sha256=n_AosjJVXET3McymFuHgXbUr5vMLdXK2PDgghX8Cch4,1891
+matplotlib/mpl-data/images/home.pdf,sha256=e0e0pI-XRtPmvUCW2VTKL1DeYu1pvPmUUeRSgEbWmik,1737
+matplotlib/mpl-data/images/home.png,sha256=IcFdAAUa6_A0qt8IO3I8p4rpXpQgAlJ8ndBECCh7C1w,468
+matplotlib/mpl-data/images/home.svg,sha256=n_AosjJVXET3McymFuHgXbUr5vMLdXK2PDgghX8Cch4,1891
+matplotlib/mpl-data/images/home_large.png,sha256=uxS2O3tWOHh1iau7CaVV4ermIJaZ007ibm5Z3i8kXYg,790
+matplotlib/mpl-data/images/matplotlib.pdf,sha256=BkSUf-2xoij-eXfpV2t7y1JFKG1zD1gtV6aAg3Xi_wE,22852
+matplotlib/mpl-data/images/matplotlib.png,sha256=w8KLRYVa-voUZXa41hgJauQuoois23f3NFfdc72pUYY,1283
+matplotlib/mpl-data/images/matplotlib.svg,sha256=QiTIcqlQwGaVPtHsEk-vtmJk1wxwZSvijhqBe_b9VCI,62087
+matplotlib/mpl-data/images/matplotlib_128.ppm,sha256=IHPRWXpLFRq3Vb7UjiCkFrN_N86lSPcfrEGunST08d8,49167
+matplotlib/mpl-data/images/matplotlib_large.png,sha256=ElRoue9grUqkZXJngk-nvh4GKfpvJ4gE69WryjCbX5U,3088
+matplotlib/mpl-data/images/move-symbolic.svg,sha256=_ZKpcwGD6DMTkZlbyj0nQbT8Ygt5vslEZ0OqXaXGd4E,2509
+matplotlib/mpl-data/images/move.pdf,sha256=CXk3PGK9WL5t-5J-G2X5Tl-nb6lcErTBS5oUj2St6aU,1867
+matplotlib/mpl-data/images/move.png,sha256=TmjR41IzSzxGbhiUcV64X0zx2BjrxbWH3cSKvnG2vzc,481
+matplotlib/mpl-data/images/move.svg,sha256=_ZKpcwGD6DMTkZlbyj0nQbT8Ygt5vslEZ0OqXaXGd4E,2509
+matplotlib/mpl-data/images/move_large.png,sha256=Skjz2nW_RTA5s_0g88gdq2hrVbm6DOcfYW4Fu42Fn9U,767
+matplotlib/mpl-data/images/qt4_editor_options.pdf,sha256=2qu6GVyBrJvVHxychQoJUiXPYxBylbH2j90QnytXs_w,1568
+matplotlib/mpl-data/images/qt4_editor_options.png,sha256=EryQjQ5hh2dwmIxtzCFiMN1U6Tnd11p1CDfgH5ZHjNM,380
+matplotlib/mpl-data/images/qt4_editor_options.svg,sha256=E00YoX7u4NrxMHm_L1TM8PDJ88bX5qRdCrO-Uj59CEA,1244
+matplotlib/mpl-data/images/qt4_editor_options_large.png,sha256=-Pd-9Vh5aIr3PZa8O6Ge_BLo41kiEnpmkdDj8a11JkY,619
+matplotlib/mpl-data/images/subplots-symbolic.svg,sha256=8acBogXIr9OWGn1iD6mUkgahdFZgDybww385zLCLoIs,2130
+matplotlib/mpl-data/images/subplots.pdf,sha256=Q0syPMI5EvtgM-CE-YXKOkL9eFUAZnj_X2Ihoj6R4p4,1714
+matplotlib/mpl-data/images/subplots.png,sha256=MUfCItq3_yzb9yRieGOglpn0Y74h8IA7m5i70B63iRc,445
+matplotlib/mpl-data/images/subplots.svg,sha256=8acBogXIr9OWGn1iD6mUkgahdFZgDybww385zLCLoIs,2130
+matplotlib/mpl-data/images/subplots_large.png,sha256=Edu9SwVMQEXJZ5ogU5cyW7VLcwXJdhdf-EtxxmxdkIs,662
+matplotlib/mpl-data/images/zoom_to_rect-symbolic.svg,sha256=1vRxr3cl8QTwTuRlQzD1jxu0fXZofTJ2PMgG97E7Bco,1479
+matplotlib/mpl-data/images/zoom_to_rect.pdf,sha256=SEvPc24gfZRpl-dHv7nx8KkxPyU66Kq4zgQTvGFm9KA,1609
+matplotlib/mpl-data/images/zoom_to_rect.png,sha256=aNz3QZBrIgxu9E-fFfaQweCVNitGuDUFoC27e5NU2L4,530
+matplotlib/mpl-data/images/zoom_to_rect.svg,sha256=1vRxr3cl8QTwTuRlQzD1jxu0fXZofTJ2PMgG97E7Bco,1479
+matplotlib/mpl-data/images/zoom_to_rect_large.png,sha256=V6pkxmm6VwFExdg_PEJWdK37HB7k3cE_corLa7RbUMk,1016
+matplotlib/mpl-data/matplotlibrc,sha256=r5ENfaxsDswVM5qbWd9DDHq3Tg7kYc6GpyggLGGecyk,41627
+matplotlib/mpl-data/plot_directive/plot_directive.css,sha256=dYBfao5OEGXxWGHeBQVOgTWeh6kPRpGFqiM-3sV3jbw,334
+matplotlib/mpl-data/sample_data/Minduka_Present_Blue_Pack.png,sha256=XnKGiCanpDKalQ5anvo5NZSAeDP7fyflzQAaivuc0IE,13634
+matplotlib/mpl-data/sample_data/README.txt,sha256=c8JfhUG72jHZj6SyS0hWvlXEtWUJbjRNfMZlA85SWIo,130
+matplotlib/mpl-data/sample_data/axes_grid/bivariate_normal.npy,sha256=DpWZ9udAh6ospYqneEa27D6EkRgORFwHosacZXVu98U,1880
+matplotlib/mpl-data/sample_data/data_x_x2_x3.csv,sha256=IG7mazfIlEyJnqIcZrKBEhjitrI3Wv35uVFVV6hBgMo,143
+matplotlib/mpl-data/sample_data/eeg.dat,sha256=KGVjFt8ABKz7p6XZirNfcxSTOpGGNuyA8JYErRKLRBc,25600
+matplotlib/mpl-data/sample_data/embedding_in_wx3.xrc,sha256=IcJ5PddMI2wSxlUGUUv3He3bsmGaRfBp9ZwEQz5QTdo,2250
+matplotlib/mpl-data/sample_data/goog.npz,sha256=QAkXzzDmtmT3sNqT18dFhg06qQCNqLfxYNLdEuajGLE,22845
+matplotlib/mpl-data/sample_data/grace_hopper.jpg,sha256=qMptc0dlcDsJcoq0f-WfRz2Trjln_CTHwCiMPHrbcTA,61306
+matplotlib/mpl-data/sample_data/jacksboro_fault_dem.npz,sha256=1JP1CjPoKkQgSUxU0fyhU50Xe9wnqxkLxf5ukvYvtjc,174061
+matplotlib/mpl-data/sample_data/logo2.png,sha256=ITxkJUsan2oqXgJDy6DJvwJ4aHviKeWGnxPkTjXUt7A,33541
+matplotlib/mpl-data/sample_data/membrane.dat,sha256=q3lbQpIBpbtXXGNw1eFwkN_PwxdDGqk4L46IE2b0M1c,48000
+matplotlib/mpl-data/sample_data/msft.csv,sha256=4JtKT5me60-GNMUoCMuIDAYAIpylT_EroyBbGh0yi_U,3276
+matplotlib/mpl-data/sample_data/percent_bachelors_degrees_women_usa.csv,sha256=Abap-NFjqwp1ELGNYCoTL4S5vRniAzM5R3ixgEFFpTU,5723
+matplotlib/mpl-data/sample_data/s1045.ima.gz,sha256=MrQk1k9it-ccsk0p_VOTitVmTWCAVaZ6srKvQ2n4uJ4,33229
+matplotlib/mpl-data/sample_data/topobathy.npz,sha256=AkTgMpFwLfRQJNy1ysvE89TLMNct-n_TccSsYcQrT78,45224
+matplotlib/mpl-data/stylelib/Solarize_Light2.mplstyle,sha256=uU84qox3o_tHASXoKLR6nBJmJ9AS0u7TWXxTFZx9tjA,1308
+matplotlib/mpl-data/stylelib/_classic_test_patch.mplstyle,sha256=9XRyb2XzCtS6piLIYFbNHpU-bF4f7YliWLdbLXvBojI,173
+matplotlib/mpl-data/stylelib/bmh.mplstyle,sha256=UTO__T6YaaUY6u5NjAsBGBsv_AOK45nKi1scf-ORxzU,741
+matplotlib/mpl-data/stylelib/classic.mplstyle,sha256=c3q6IVoWvuKS9YCv2VBG1oF9r7ClxorrmbjI0y2HuBQ,24966
+matplotlib/mpl-data/stylelib/dark_background.mplstyle,sha256=Vei27QYOP3dNTaHzmRYneNLTCw30nE75JOUDYuOjnXc,687
+matplotlib/mpl-data/stylelib/fast.mplstyle,sha256=HDqa0GATC9GjNeRA8rYiZM-qh7hTxsraeyYziGlbgzg,299
+matplotlib/mpl-data/stylelib/fivethirtyeight.mplstyle,sha256=IfXwiatqkv6rkauNnjcfDDS6pU-UabtEhbokK5-qAes,872
+matplotlib/mpl-data/stylelib/ggplot.mplstyle,sha256=pWh3RqvTy3fyP_aGOa1TR7NMAi5huuWDJRPeZM5kR3o,996
+matplotlib/mpl-data/stylelib/grayscale.mplstyle,sha256=MnigXJy2ckyQZuiwb-nCXQ0-0cJBz1WPu-CEJXEHWpA,555
+matplotlib/mpl-data/stylelib/seaborn-bright.mplstyle,sha256=DIo92H5LVQVPMeJOcVaOPOovchqMeDvkKoEQ0BX--wA,147
+matplotlib/mpl-data/stylelib/seaborn-colorblind.mplstyle,sha256=M7OYVR1choIo_jlDfMsGSADJahLDauZEOUJJpuDK8Hs,151
+matplotlib/mpl-data/stylelib/seaborn-dark-palette.mplstyle,sha256=HLb5n5XgW-IQ8b5YcTeIlA1QyHjP7wiNPAHD2syptW4,145
+matplotlib/mpl-data/stylelib/seaborn-dark.mplstyle,sha256=IZMc2QEnkTmbOfAr5HIiu6SymcdRbKWSIYGOtprNlDw,697
+matplotlib/mpl-data/stylelib/seaborn-darkgrid.mplstyle,sha256=lY9aae1ZeSJ1WyT42fi0lfuQi2t0vwhic8TBEphKA5c,700
+matplotlib/mpl-data/stylelib/seaborn-deep.mplstyle,sha256=djxxvf898QicTlmeDHJW5HVjrvHGZEOSIPWgFK0wqpw,145
+matplotlib/mpl-data/stylelib/seaborn-muted.mplstyle,sha256=5t2wew5ydrrJraEuuxH918TuAboCzuCVVj4kYq78_LU,146
+matplotlib/mpl-data/stylelib/seaborn-notebook.mplstyle,sha256=g0nB6xP2N5VfW31pBa4mRHZU5kLqZLQncj9ExpTuTi8,403
+matplotlib/mpl-data/stylelib/seaborn-paper.mplstyle,sha256=StESYj-S2Zv9Cngd5bpFqJVw4oBddpqB3C5qHESmzi8,414
+matplotlib/mpl-data/stylelib/seaborn-pastel.mplstyle,sha256=8KO6r5H2jWIophEf7XJVYKyrXSrYGEn2f1F_KXoEEIc,147
+matplotlib/mpl-data/stylelib/seaborn-poster.mplstyle,sha256=8xZxeZiSX2npJ-vCqsSsDcc4GeFrXwfrSNu0xXfA2Uk,424
+matplotlib/mpl-data/stylelib/seaborn-talk.mplstyle,sha256=_c29c8iDdsCMNVERcHHwD8khIcUVxeuoHI2o1eE0Phg,424
+matplotlib/mpl-data/stylelib/seaborn-ticks.mplstyle,sha256=Annui6BdMJqYZsIGCkdmk88r4m_H4esa7bSszkBpm-A,695
+matplotlib/mpl-data/stylelib/seaborn-white.mplstyle,sha256=VY6sw8wkqbl0leWtWa5gz8xfDMfqt5yEhITIjP4FsOI,695
+matplotlib/mpl-data/stylelib/seaborn-whitegrid.mplstyle,sha256=IOm2H1utXO_zR7FWqMLBiRxHyxABL3kq1fh0-6BDJ0E,694
+matplotlib/mpl-data/stylelib/seaborn.mplstyle,sha256=N9lUFHvOn06wT4MODXpVVGQMSueONejeAfCX5UfWrIM,1187
+matplotlib/mpl-data/stylelib/tableau-colorblind10.mplstyle,sha256=PzUMoOtw0V6l0bPk8ApRAKvcxdJmzRU2bVOkNqz8DnU,192
+matplotlib/offsetbox.py,sha256=Upv-CIVZYkHPVn-keAYaUx58kyRNbhD9zgROcui-dY0,59293
+matplotlib/patches.py,sha256=7BRqnYlu2wDKnyJfKg-C6EwSNsk55NUYnmoDT79Hi1s,159987
+matplotlib/path.py,sha256=RAb0d5kdHvKykP81aRhpIwWsOSxOWpxm6h_5NjUrdS8,42065
+matplotlib/patheffects.py,sha256=tWz7_phCTvT_nlsRe4g0QzQQkF-GvY5XlnMMFETE6R4,19306
+matplotlib/projections/__init__.py,sha256=yaWM60AYTHz3geKwIwnp-dDaAhvaKSlj65uZFDJNe70,1728
+matplotlib/projections/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/projections/__pycache__/geo.cpython-38.pyc,,
+matplotlib/projections/__pycache__/polar.cpython-38.pyc,,
+matplotlib/projections/geo.py,sha256=SU8QlDoejmi3v8wIESIVL0TMaaz1IaLowbjWYIvjQzc,17794
+matplotlib/projections/polar.py,sha256=8GoAnvDheUHeCkCuMvkGxfeWJok2RIyBBOGlQaWEwiw,55343
+matplotlib/pylab.py,sha256=5OYA5bP5Vz38Xha7ZCC3yaI_oAKjLXSdRCv0arXZeYE,1734
+matplotlib/pyplot.py,sha256=GiLRmdwqr20LrrJ8HkEs0Gg9fyWrtJmnrKKUzukCfS8,120283
+matplotlib/quiver.py,sha256=G4lzZv5pe7dH7eqiPx81-iHy1L4V5yh3UQzJa87N1JU,48094
+matplotlib/rcsetup.py,sha256=ezgtIG2v5TuMMP_-b0EMr2_yMVkjXwrpKvcA_fRAlW8,56255
+matplotlib/sankey.py,sha256=PXOkk8jdNjQ3YYz5JTtwl_93c0pyVyJnaNwurRUU1uI,37644
+matplotlib/scale.py,sha256=PCN66r1SXTdsZ_wjd5wLT9x65V4sgTbFnhv5AvBGDFE,23456
+matplotlib/sphinxext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+matplotlib/sphinxext/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/sphinxext/__pycache__/mathmpl.cpython-38.pyc,,
+matplotlib/sphinxext/__pycache__/plot_directive.cpython-38.pyc,,
+matplotlib/sphinxext/mathmpl.py,sha256=NncMTNxjnH0hn7VAWEyeM_0X6ShAQJ6m_izd0J8oaoc,3684
+matplotlib/sphinxext/plot_directive.py,sha256=KnsbqXFADhmIlf8XYqD_Uq0cXiL5Gd5Uo5gKZoC46lU,28484
+matplotlib/spines.py,sha256=le2sytT5pVNYKoBBnEhXtOBOnX_-T3gkWj3-CQ08Yw8,21811
+matplotlib/stackplot.py,sha256=2SBWhEMpPufDGQUx1XUHMes29uRCVl_xNU4XyO7tCP0,4248
+matplotlib/streamplot.py,sha256=IedHFcoFu_jrKv6EU144k5QK8kKx297NekwV2HpVFXM,23845
+matplotlib/style/__init__.py,sha256=Lee0QNI5VNg45wfj5h5w5_PhaBOq8zDPrDtqnpJfFWI,68
+matplotlib/style/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/style/__pycache__/core.cpython-38.pyc,,
+matplotlib/style/core.py,sha256=WePqK7ozrzokmB5gMXiGyK88izSCAyePSs4lv98ulGA,8119
+matplotlib/table.py,sha256=PDftMN9wNSEClFRrlpqE8QIOlsS2hxHvTs19sPXhpp0,27360
+matplotlib/testing/__init__.py,sha256=OJEQVEa-DhHNpfHvHuh2otQJPGS5PmI0eSNP069CH3U,2302
+matplotlib/testing/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/testing/__pycache__/compare.cpython-38.pyc,,
+matplotlib/testing/__pycache__/conftest.cpython-38.pyc,,
+matplotlib/testing/__pycache__/decorators.cpython-38.pyc,,
+matplotlib/testing/__pycache__/exceptions.cpython-38.pyc,,
+matplotlib/testing/__pycache__/widgets.cpython-38.pyc,,
+matplotlib/testing/compare.py,sha256=3jGH1C369I-7DSkiIQt-OmZ5_UJxobOeLb2t0-MI7e8,19321
+matplotlib/testing/conftest.py,sha256=fsSyFG2cNVmtHF96ljhaPkB9ChUdzrGylh47n5Nvo9I,5708
+matplotlib/testing/decorators.py,sha256=pplJNcl76IQ_8RHqte4XrphO0JExlCS5WXIILyk3scA,20038
+matplotlib/testing/exceptions.py,sha256=rTxMs5B6lKjXH6c53eVH7iVPrG5Ty7wInRSgzNiMKK4,142
+matplotlib/testing/jpl_units/Duration.py,sha256=nwkry60y3AXZTqFfsEaCzF5PiKoLPUnG32lQ5uIDFLo,4620
+matplotlib/testing/jpl_units/Epoch.py,sha256=79wxS8RWgMajXnEke3tx9buyzhvXoDClnhe0bixJ1OU,6579
+matplotlib/testing/jpl_units/EpochConverter.py,sha256=-mQ_6zbsgGvoka6JAnzoFk8V6ggWmlizJl4kgR6fhXI,3264
+matplotlib/testing/jpl_units/StrConverter.py,sha256=Gp26v8tKr5iGfLTWPSUcNxyjilH3u8teFBP3eNNxKqc,3047
+matplotlib/testing/jpl_units/UnitDbl.py,sha256=9Pys6tKq3prlAZD4bo5NXo-oRemaFakTL30ZK3zsH8k,7297
+matplotlib/testing/jpl_units/UnitDblConverter.py,sha256=dkLzijhvoXNR-pOwYHGN_TSkpw1yV-88B31Xitzo1ho,3190
+matplotlib/testing/jpl_units/UnitDblFormatter.py,sha256=3ZrRTulxYh-fTRtSpN9gCFqmyMA_ZR2_znkQjy3UCJc,709
+matplotlib/testing/jpl_units/__init__.py,sha256=gdnES2cnASttTSfKQn-g400gQ0dDZAQ_Kn09J_HyFJY,2760
+matplotlib/testing/jpl_units/__pycache__/Duration.cpython-38.pyc,,
+matplotlib/testing/jpl_units/__pycache__/Epoch.cpython-38.pyc,,
+matplotlib/testing/jpl_units/__pycache__/EpochConverter.cpython-38.pyc,,
+matplotlib/testing/jpl_units/__pycache__/StrConverter.cpython-38.pyc,,
+matplotlib/testing/jpl_units/__pycache__/UnitDbl.cpython-38.pyc,,
+matplotlib/testing/jpl_units/__pycache__/UnitDblConverter.cpython-38.pyc,,
+matplotlib/testing/jpl_units/__pycache__/UnitDblFormatter.cpython-38.pyc,,
+matplotlib/testing/jpl_units/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/testing/widgets.py,sha256=eWBeLbrKPcgjWrauz7RGCAEtIlXK7qt72abwWQmznGg,2564
+matplotlib/tests/__init__.py,sha256=y2ftcuJhePrKnF_GHdqlGPT_SY-rhoASd2m4iyHqpfE,376
+matplotlib/tests/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/tests/__pycache__/conftest.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_afm.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_agg.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_agg_filter.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_animation.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_api.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_arrow_patches.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_artist.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_axes.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_backend_bases.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_backend_cairo.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_backend_gtk3.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_backend_nbagg.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_backend_pdf.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_backend_pgf.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_backend_ps.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_backend_qt.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_backend_svg.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_backend_tk.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_backend_tools.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_backend_webagg.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_backends_interactive.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_basic.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_bbox_tight.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_category.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_cbook.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_collections.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_colorbar.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_colors.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_compare_images.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_constrainedlayout.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_container.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_contour.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_cycles.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_dates.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_determinism.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_dviread.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_figure.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_font_manager.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_fontconfig_pattern.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_gridspec.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_image.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_legend.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_lines.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_marker.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_mathtext.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_matplotlib.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_mlab.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_offsetbox.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_patches.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_path.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_patheffects.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_pickle.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_png.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_polar.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_preprocess_data.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_pyplot.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_quiver.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_rcparams.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_sankey.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_scale.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_simplification.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_skew.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_sphinxext.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_spines.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_streamplot.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_style.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_subplots.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_table.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_testing.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_texmanager.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_text.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_ticker.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_tightlayout.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_transforms.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_triangulation.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_ttconv.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_type1font.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_units.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_usetex.cpython-38.pyc,,
+matplotlib/tests/__pycache__/test_widgets.cpython-38.pyc,,
+matplotlib/tests/conftest.py,sha256=tjbU0uzdD8q4j30uWm-lzYfZCjqFYRAF_-WMhA3O0qY,262
+matplotlib/tests/test_afm.py,sha256=xlXDBFAzL7UGVhKZThanpogq1lsvvev4bO9xvzNLa80,3829
+matplotlib/tests/test_agg.py,sha256=cWAKF1GafEye080MTHB61R8GmlygUm8YtaNmEyIChlg,7711
+matplotlib/tests/test_agg_filter.py,sha256=weS7uYVgayAghg7DS6-hUuAarpL__tUkIU2P2mIB-9I,1107
+matplotlib/tests/test_animation.py,sha256=m9uTpf_lhHrTg7o3zr9HfziByeBozGeZnF72sxjeLDk,12001
+matplotlib/tests/test_api.py,sha256=_lrQhQrLRwTuqNQTlYXZmYAQKwrBk1x8am61wCQnrTg,1952
+matplotlib/tests/test_arrow_patches.py,sha256=djUMge_jL3gA4K6mSOZCpMWBOdoJbcnk9ERptTboZKg,6539
+matplotlib/tests/test_artist.py,sha256=PYQyRTgqFIytOYFE5BndAKTEeoNDe3sOwRAa-HEiLJ4,11726
+matplotlib/tests/test_axes.py,sha256=Hd40u0_o6U8Rui4JemlAxxcH56ZGZjv3QEQf5e9g0YY,241489
+matplotlib/tests/test_backend_bases.py,sha256=NLwQpXJXN3zaXBIPgb_jWqrWMwvEqTgDGYay8lWoQ9I,9268
+matplotlib/tests/test_backend_cairo.py,sha256=2jejOSazlpDheGuSBe2C6R2D37bMjmMy3Ds2NRCzFnA,1869
+matplotlib/tests/test_backend_gtk3.py,sha256=YaRMVCmgqt7mx5MqIthCd_vaKJDyZfE-ukP9LBILFYs,1809
+matplotlib/tests/test_backend_nbagg.py,sha256=rfFHvT0YhzBMdm-t3P-GBRKi-ZWgjTXie_Zuo6pngt0,935
+matplotlib/tests/test_backend_pdf.py,sha256=lYYoDaYQW0tqBsQO8pCBZT6WL7gKEK3zqqiglJHcV-w,11509
+matplotlib/tests/test_backend_pgf.py,sha256=Nkovbm4e9BoJqpL3qIXAAOAsR3hbmmyAoehqD5U9IRM,10878
+matplotlib/tests/test_backend_ps.py,sha256=WTGQvwFHhQ6_m7GwmBarHYQTfE4YWe7lbtE3nGg7Jfg,6195
+matplotlib/tests/test_backend_qt.py,sha256=7KktbW3iwgsXrXdFbJ-dZP6IXUICUcmpSH8LpYNKO8s,9646
+matplotlib/tests/test_backend_svg.py,sha256=XIOn_QRvYYHjH3JAG4bVJmxevf9j923OJBAbqwMRbHM,16033
+matplotlib/tests/test_backend_tk.py,sha256=gDDVW3jvtkfnGIyfEt5v45_rCrufuxThCHnzqQLLqew,7197
+matplotlib/tests/test_backend_tools.py,sha256=6StNyy5SGVdfh1r-UwXyQnMg_XJCiXL_hC40HehT-zA,521
+matplotlib/tests/test_backend_webagg.py,sha256=lQP6u1Vq8eV_9a7AnUzv58ORFdwXC9ggVZq2FfS6nto,729
+matplotlib/tests/test_backends_interactive.py,sha256=OTnZqNTbjqWwUMgQuD63fFv2wh5kGftrAFI3JXAvQNY,11146
+matplotlib/tests/test_basic.py,sha256=_x4D9C-qMIgkgbSHY-QdjStZxHEw-lRd_-U5oMJfYF0,1097
+matplotlib/tests/test_bbox_tight.py,sha256=aKbFVa5HFQKnqFjjaDtvGPiiq-BYSV1T_IuaICbX_AU,5411
+matplotlib/tests/test_category.py,sha256=dyOftzoU2cn4QMV8eKADIl5H_iP-fMu9IVpBRyUB7KY,11438
+matplotlib/tests/test_cbook.py,sha256=BVRmPZLB6x_UPgQ8OvXO4VZqdYC2l_ZMnshHdGHLj9c,26909
+matplotlib/tests/test_collections.py,sha256=K3ndtwg9kMQL3SuDBRL_1gguhK4f6X6SbQCUUwIL-F4,31927
+matplotlib/tests/test_colorbar.py,sha256=pue3rHC0Ek3gz9Rt_zLYRFivnHvnSX8xUI7oslhP0V0,26794
+matplotlib/tests/test_colors.py,sha256=p_oGZtzS-y6M6sQ-U5iyAb7u8FZmaTKksVj5qkzGhU0,50618
+matplotlib/tests/test_compare_images.py,sha256=twmG-C7CB9EZpA9ogy6YrCtgH1TJZMj2sBjFaxeZx7M,3366
+matplotlib/tests/test_constrainedlayout.py,sha256=fPP-D9m9rvUAjwc9urtclJUeFu6L5scGE9_wG3PPfCk,19480
+matplotlib/tests/test_container.py,sha256=QgNodtC50-2SyP_8coGyp1nQsmLKhfivlJrfX4cujds,580
+matplotlib/tests/test_contour.py,sha256=aMdk2_jF8ihCMIU9ihJW80ccYQVmou550CM6Yo76AQU,14402
+matplotlib/tests/test_cycles.py,sha256=7SnFRFaoAB9B77dtNkiDCBwr6QsQA4sSOQZxkzYZmYs,5820
+matplotlib/tests/test_dates.py,sha256=k-lL6yo4koKKD0XzWx1Iq-ycGgviZINA_S7pNx1W9PM,45151
+matplotlib/tests/test_determinism.py,sha256=9pa2XuMrzVZjvti4TEXvi0i1EQesAVYPE-wDkMX3VpY,4803
+matplotlib/tests/test_dviread.py,sha256=USbWVyR1pY5HMuoHEHWgfBaCojUQkuxLt-J4gSkwBcw,2378
+matplotlib/tests/test_figure.py,sha256=b-Hm-LdB6fIqch38g0AWFc2pk5_jitkbzrGwOiKxlIU,36170
+matplotlib/tests/test_font_manager.py,sha256=KrZzhuE4sjyVFak8ne9jCXOp4d0KjJ9GMXZdvOcoWZk,8795
+matplotlib/tests/test_fontconfig_pattern.py,sha256=NeM0UxB4m4fGY2Zq84QoDGyKnEOAcgmi0Cs-VjyFY0I,2091
+matplotlib/tests/test_gridspec.py,sha256=JiyMWPmsW_wJc7m4f8b2KRqCKlBSSlUt3LUyhak0heM,997
+matplotlib/tests/test_image.py,sha256=dtUu_6Zp0aHIiAuMSNx5yGJuFOGdbeFjasunbJlGt9w,41770
+matplotlib/tests/test_legend.py,sha256=rZwoRDpOV1laqVXKkNZXhxrwKrqep1M8v6IwMutaBfw,26745
+matplotlib/tests/test_lines.py,sha256=nKOq7igDS_E7Wrkiv42JTvl852YK5_akpNMhlneDO44,9558
+matplotlib/tests/test_marker.py,sha256=V1SGcdlSQH6SLQIU-bwUIgbiIE5tkgINkRXYvOZ1E_A,7170
+matplotlib/tests/test_mathtext.py,sha256=4XlD4BVIQpDrhFy7IQ_QMDSH8gv-NhcTGeTII2VJ5f0,17481
+matplotlib/tests/test_matplotlib.py,sha256=c9aiXg-8D99hKO06-PuFwIfIB3Hq00jPuMJ8Ir2Iybc,2296
+matplotlib/tests/test_mlab.py,sha256=8j6MC-GGgbArh2Pz-8uhF76wxNlO3m3_S2HuwZZoHlA,44861
+matplotlib/tests/test_offsetbox.py,sha256=PmgcyyKrJktlRvHKs61ebQF-PnxIpyr12NnMs3uJ4Ro,11765
+matplotlib/tests/test_patches.py,sha256=DxbfIMEJNQnCsIg7wNZqbth6PE7aakAQbw-O6KcCJm0,21918
+matplotlib/tests/test_path.py,sha256=rMi65DIsxp-KHyC-M7gMn6tcevxIbG43Yax0odT9oVg,17171
+matplotlib/tests/test_patheffects.py,sha256=7x6Ffw58LtRQeqPaSQqwnnzXAZH-IZOXDia8H8EvO3s,7169
+matplotlib/tests/test_pickle.py,sha256=KBDGzM0bw8iDYRdVH_OL_r59DFfl41azUPbaZkcs9Vw,6067
+matplotlib/tests/test_png.py,sha256=W_Otlwm8zTB17LRYObVh9CdNe3hut6XV7LGbWypPJeg,1352
+matplotlib/tests/test_polar.py,sha256=chPEwcnOvhfVIuo-fGa5wFdvwlVqPjHh97erEF-omvQ,12338
+matplotlib/tests/test_preprocess_data.py,sha256=D82rQiZBljpK3ggYJgcNTkszgiXGJLv11HsOm8WdHP4,10573
+matplotlib/tests/test_pyplot.py,sha256=DX6iokecnrJqkqqj8-uReR8Lt3FlxokV114IicjLtMk,8972
+matplotlib/tests/test_quiver.py,sha256=gyqDugeUL8gOnMXTvtd-GHI99usI7L5FDvfvLDuJCLU,8321
+matplotlib/tests/test_rcparams.py,sha256=v_uteLkylJ753vvmXsTn_NMK_cuTJ857vez65sueEwo,20141
+matplotlib/tests/test_sankey.py,sha256=24ENaS6B2bpiIkNv9FB5P6jyLEBIQRgT4Q14WsjH8-o,694
+matplotlib/tests/test_scale.py,sha256=RVawOt1Ubp-c32SCt9mNM2wL02gLMUE7j-m8YP3SiUI,6237
+matplotlib/tests/test_simplification.py,sha256=dt0mnYH7Iy059fIpG1WMd4W-mEBGrk74RtCxzgr1vkI,11393
+matplotlib/tests/test_skew.py,sha256=VWsvEHjlOWkheJYE2j82GvkYPW_3UBdsUA_1CWMbMn0,6435
+matplotlib/tests/test_sphinxext.py,sha256=ll41rPkqzBcAixlpmVRt0LBzTotGwRie3NC70B1JCFU,2575
+matplotlib/tests/test_spines.py,sha256=KjpNf98E-36xW0je7SzoO6wPWc47Y2lkoIYJ4e9trkI,4411
+matplotlib/tests/test_streamplot.py,sha256=Q42tncinEycgFxeI0u72_aXFw0h84jXpo48hxG9Aquc,5430
+matplotlib/tests/test_style.py,sha256=Xm9v8NSieC69Rnd_rGXUG_6SOdNPE7Gr--nMKI5nBbc,5905
+matplotlib/tests/test_subplots.py,sha256=uvoc0HEeio5wpiSoMypM9nrVuBZ9tJ59Ds6aOlbbVF8,7247
+matplotlib/tests/test_table.py,sha256=HGg0UohbRWfoJsiqYJfzyLaPAoXM-KnVX2JSeztaMuI,5924
+matplotlib/tests/test_testing.py,sha256=br5I_Hld4xKgSeWCoFtN60RD-xfDXyKSlNjdYVb_gkY,1098
+matplotlib/tests/test_texmanager.py,sha256=IoCMn9UcYSngl3m_nlWrDV9BZrNrtOiM2P5s5ULSb4w,475
+matplotlib/tests/test_text.py,sha256=srzWcLX8_duXwfeMPjnS8zpt3zDfrsLw4IGOgC9JsXA,23704
+matplotlib/tests/test_ticker.py,sha256=38yC0npHdnVXNDarRUmFlbbdnMzrWY6mc42NBZrOtl0,53546
+matplotlib/tests/test_tightlayout.py,sha256=udPVVhibPAFYFpnsYsUyY_7YXdMBaR7gBTf99stfmj4,10865
+matplotlib/tests/test_transforms.py,sha256=Nwl29oQNeWnbBzy_XoANWSk_I5IbnWDTPk1k3aZLnt0,29365
+matplotlib/tests/test_triangulation.py,sha256=TvD20c_nzy-lyAC4L_mFHLGBAYJKVMNq3ifJD7borng,47112
+matplotlib/tests/test_ttconv.py,sha256=MwDVqn8I2a09l7sN9vfluhABCpzoPasZOzrvoadYn8o,557
+matplotlib/tests/test_type1font.py,sha256=7wo1fMX8Rk4CoZTGe5XAQn7YsAjT3FENjmkVv_KLLdw,2942
+matplotlib/tests/test_units.py,sha256=RNjjDg4UqRv-lCRGZ14Rhy7MX1NReyl3OnsIsnkESOY,7545
+matplotlib/tests/test_usetex.py,sha256=0KnmY9odeD969yGyWy-uE0_OXTkSOYwfQqjI4dJm1MY,3699
+matplotlib/tests/test_widgets.py,sha256=l-dEI1eM5wyuDIBHWJe9wBE_qbZ7jO0UU6zCU7oRkok,18454
+matplotlib/texmanager.py,sha256=I7t9II-_J4IOM8k_5cx6JwQG-4KmHIi2b9FLxrksI3I,16414
+matplotlib/text.py,sha256=9wFjlNgQ4N5WpHOx8iPIl5d0mkIMpLvW47AWAJHTLfM,70749
+matplotlib/textpath.py,sha256=IsfHek3JjNKZIvme7oDjGtI6Jv-sH7jDmQOrBiXwVwk,15092
+matplotlib/ticker.py,sha256=H0JLcDhPXAHN4frOuCA8sJ9CrNkPqIObJwLU2SJ1IdI,107692
+matplotlib/tight_bbox.py,sha256=3nPRkvIogLL6n-ZJPPRsOLCC_cZBEmgKAsJfvhC9xQk,3023
+matplotlib/tight_layout.py,sha256=Rngr-xilxNuviddirNiahsYj9WaJI7nWttZIDzER8yM,13992
+matplotlib/transforms.py,sha256=QJs_PlzSsyGecDsQqtwEoGeMv6L1GH5qM_omiCqnTI4,101423
+matplotlib/tri/__init__.py,sha256=mXgRgH1EgncFGFKziNNW2C6zp0VEHtuhWZAQ6MKctJg,268
+matplotlib/tri/__pycache__/__init__.cpython-38.pyc,,
+matplotlib/tri/__pycache__/triangulation.cpython-38.pyc,,
+matplotlib/tri/__pycache__/tricontour.cpython-38.pyc,,
+matplotlib/tri/__pycache__/trifinder.cpython-38.pyc,,
+matplotlib/tri/__pycache__/triinterpolate.cpython-38.pyc,,
+matplotlib/tri/__pycache__/tripcolor.cpython-38.pyc,,
+matplotlib/tri/__pycache__/triplot.cpython-38.pyc,,
+matplotlib/tri/__pycache__/trirefine.cpython-38.pyc,,
+matplotlib/tri/__pycache__/tritools.cpython-38.pyc,,
+matplotlib/tri/triangulation.py,sha256=_ZS9W3Z8mviBBUDb6nE71DWA4-_kMQzfJoRFemqVRJ8,8614
+matplotlib/tri/tricontour.py,sha256=6oZLhfcU0Uxg-edAGHnnZRrkNtKJQQv8a6UcIhgu6VI,11976
+matplotlib/tri/trifinder.py,sha256=v4nqw4KD1_obgpk8p_lW3HtuSfRIs_SjF7RfuZg9NcA,3550
+matplotlib/tri/triinterpolate.py,sha256=tu2hTBP5Prdg9WoNHn1ZkEO-_AEPiY__zktlGaPBK5E,64157
+matplotlib/tri/tripcolor.py,sha256=G6_MIGX3rx3PtuLGC4l-BBy01dk_FthxnXw-rLJh03s,5133
+matplotlib/tri/triplot.py,sha256=iiS5jMj9P1LCuzQm_T5PLh8UXhQqTn7NSlHquiQK1dg,2845
+matplotlib/tri/trirefine.py,sha256=qElR5QouUoL4TxYsnszniVt248zF1pXni0EISpkpW9I,13498
+matplotlib/tri/tritools.py,sha256=aFA701dhdzgO5MPwlzU1T4leP9zPhjTlMtMnLtucNhQ,10837
+matplotlib/ttconv.py,sha256=nOFvkvXPU_NPITKrVoUzvTDyn9w6RdmQKhlTEBde4Mw,246
+matplotlib/type1font.py,sha256=WsQESmDPvqeCydHx7Z5Sud_Wl2362bkTt17rL_JXblg,12619
+matplotlib/units.py,sha256=HpMVm8uMp4JiL3wJDMDOH0MiqxVLRUy6WD2Iizs8BLU,7497
+matplotlib/widgets.py,sha256=jO8Lo-WY_oon5239aWyUZ2b-xya75_JTticiXn5uROU,106824
+mpl_toolkits/axes_grid/__init__.py,sha256=Ih5yWqFbeQSJD089lqdMdWJAy2uF4822uKMBlKQe_bQ,561
+mpl_toolkits/axes_grid/__pycache__/__init__.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/anchored_artists.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/angle_helper.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/axes_divider.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/axes_grid.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/axes_rgb.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/axes_size.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/axis_artist.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/axisline_style.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/axislines.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/clip_path.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/floating_axes.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/grid_finder.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/grid_helper_curvelinear.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/inset_locator.cpython-38.pyc,,
+mpl_toolkits/axes_grid/__pycache__/parasite_axes.cpython-38.pyc,,
+mpl_toolkits/axes_grid/anchored_artists.py,sha256=TDvJzLlt85cfXoiT1Yk4j0DEw_6HXeV6zb-tAdPP3zs,297
+mpl_toolkits/axes_grid/angle_helper.py,sha256=f77E-aQao6GkJfpEGmLAvpWgFkktkIV9d8YXVsDfsBQ,52
+mpl_toolkits/axes_grid/axes_divider.py,sha256=Sa_hLFBUH6F6P4apbj_9RQQJS-LfK8kMKe1U5AvHYqE,181
+mpl_toolkits/axes_grid/axes_grid.py,sha256=k7q2Tuf5yr29lDqK9DhixFgDi9R0G2ZQT__paXthg34,91
+mpl_toolkits/axes_grid/axes_rgb.py,sha256=V691yLhii-qIdxPFDoRF-28h-IINq1CDHUWa_fPmqDY,48
+mpl_toolkits/axes_grid/axes_size.py,sha256=SV0uHhIRHVYpGIZdw3gb8T4jvh0G24KPUPr11x9TGbY,49
+mpl_toolkits/axes_grid/axis_artist.py,sha256=VuHYa0LaHdU1YKDIir03ykI64Wd1zSYhnXuUEiIatAk,51
+mpl_toolkits/axes_grid/axisline_style.py,sha256=o2aVaavBc62VLXVYZCStRjGktDD8rfkwxwXTHJuKb-U,54
+mpl_toolkits/axes_grid/axislines.py,sha256=JFEkMHiAfYPEK1M3atZwmnMAn6KcgoUQALk0aApbvZw,49
+mpl_toolkits/axes_grid/clip_path.py,sha256=uSPvk9ovfA9UkX2fPAoLJPA4nBOEB27HaEKb4M-tpdI,49
+mpl_toolkits/axes_grid/floating_axes.py,sha256=tQxJJwFSBxNDcZCWjLDKIQ3Ck81TkJuErE_wbbwIbN0,53
+mpl_toolkits/axes_grid/grid_finder.py,sha256=YrtbbCgHY71Cowpc0TJOxTTyg-vwJSsuL0iRXogOllI,51
+mpl_toolkits/axes_grid/grid_helper_curvelinear.py,sha256=yh_X2vXTRUuGbrQxynWOO400T3Sifsxl5oFmNdrinrU,63
+mpl_toolkits/axes_grid/inset_locator.py,sha256=lvj8PMLvtLz0YA2KIUG6edwwI3zC0qbHo0V5ZPG-eKc,220
+mpl_toolkits/axes_grid/parasite_axes.py,sha256=bhqMaMmh-Gr5yxhX2EbizIYXjSjUL4K3NzeaGMxkeMs,535
+mpl_toolkits/axes_grid1/__init__.py,sha256=Dj6jFICuj-u5Om3DuZvW_9BQC2-dXXz06xhFNZQCmlo,209
+mpl_toolkits/axes_grid1/__pycache__/__init__.cpython-38.pyc,,
+mpl_toolkits/axes_grid1/__pycache__/anchored_artists.cpython-38.pyc,,
+mpl_toolkits/axes_grid1/__pycache__/axes_divider.cpython-38.pyc,,
+mpl_toolkits/axes_grid1/__pycache__/axes_grid.cpython-38.pyc,,
+mpl_toolkits/axes_grid1/__pycache__/axes_rgb.cpython-38.pyc,,
+mpl_toolkits/axes_grid1/__pycache__/axes_size.cpython-38.pyc,,
+mpl_toolkits/axes_grid1/__pycache__/inset_locator.cpython-38.pyc,,
+mpl_toolkits/axes_grid1/__pycache__/mpl_axes.cpython-38.pyc,,
+mpl_toolkits/axes_grid1/__pycache__/parasite_axes.cpython-38.pyc,,
+mpl_toolkits/axes_grid1/anchored_artists.py,sha256=TILUU59L2I4Pppv67Q1M27mpGf8JgVU7s8iyly3M-70,20302
+mpl_toolkits/axes_grid1/axes_divider.py,sha256=thoH_ugmotf4T1DLfqKfYnzNqM7dUKwtACtUgrdGCRo,26617
+mpl_toolkits/axes_grid1/axes_grid.py,sha256=IjFETFUxIQPs2tI-A4qjaX7UJr3gDIxtqTrtLRaTpB4,23183
+mpl_toolkits/axes_grid1/axes_rgb.py,sha256=irWZIQpZUaBU8XvVJf2wXpIYVOFv1j1UVDiC3gBjTLs,5282
+mpl_toolkits/axes_grid1/axes_size.py,sha256=zi7yIllEiZnPlVgZ7AYvBvfEJtLfueQ_ORcm05IUdyM,7813
+mpl_toolkits/axes_grid1/inset_locator.py,sha256=NPpp0ZuB8da214BAho6x5kI_cKuPl6VZ_B3USkIZMpg,23733
+mpl_toolkits/axes_grid1/mpl_axes.py,sha256=cULlzM1yCec5yJ-Bx_GSiEhQ2H-FF6rQtswMDGroNjM,4506
+mpl_toolkits/axes_grid1/parasite_axes.py,sha256=pJaI2S_ShvjxK1dFG7bV7dggF8WQC5YOB8jpVOvNwe8,14302
+mpl_toolkits/axisartist/__init__.py,sha256=xbfq7xDLTHPZycWoeZWb-EkS0pVjegcJ9-YosajfA4o,817
+mpl_toolkits/axisartist/__pycache__/__init__.cpython-38.pyc,,
+mpl_toolkits/axisartist/__pycache__/angle_helper.cpython-38.pyc,,
+mpl_toolkits/axisartist/__pycache__/axes_divider.cpython-38.pyc,,
+mpl_toolkits/axisartist/__pycache__/axes_grid.cpython-38.pyc,,
+mpl_toolkits/axisartist/__pycache__/axes_rgb.cpython-38.pyc,,
+mpl_toolkits/axisartist/__pycache__/axis_artist.cpython-38.pyc,,
+mpl_toolkits/axisartist/__pycache__/axisline_style.cpython-38.pyc,,
+mpl_toolkits/axisartist/__pycache__/axislines.cpython-38.pyc,,
+mpl_toolkits/axisartist/__pycache__/clip_path.cpython-38.pyc,,
+mpl_toolkits/axisartist/__pycache__/floating_axes.cpython-38.pyc,,
+mpl_toolkits/axisartist/__pycache__/grid_finder.cpython-38.pyc,,
+mpl_toolkits/axisartist/__pycache__/grid_helper_curvelinear.cpython-38.pyc,,
+mpl_toolkits/axisartist/__pycache__/parasite_axes.cpython-38.pyc,,
+mpl_toolkits/axisartist/angle_helper.py,sha256=5d6D5SfcY4plvCGNcnP7a_TUcuZjnCrF4VQoO6tPJ1s,13614
+mpl_toolkits/axisartist/axes_divider.py,sha256=2ReTIrF3nwwXtxiIchWRjImPLnxeoce8J17Gd8UsbY4,129
+mpl_toolkits/axisartist/axes_grid.py,sha256=-BiKRKmUY9SN2YkPwFkbsnrtDCux3HBQV2XbzOrKrrA,365
+mpl_toolkits/axisartist/axes_rgb.py,sha256=a2lvQ9MxvXjh9ZXDvzM6VNBA8AGg5xngu_pKAx8PWOc,190
+mpl_toolkits/axisartist/axis_artist.py,sha256=m9klDs8QBVNMCRf-C_pt6NU8sUCTJOGIgOR4vxkkZLE,37958
+mpl_toolkits/axisartist/axisline_style.py,sha256=0UNd7r9dk8HGRbYvEeIrxGwri2BkWR-wn1QLS82KxZ8,5115
+mpl_toolkits/axisartist/axislines.py,sha256=BO3AKLwe7-VII1ewiTIRvR_BlaHrPh4Ke8BvqLynxQs,20545
+mpl_toolkits/axisartist/clip_path.py,sha256=3K3j0JuB60PAGFNwRsEqQHxjGItQqx1IBxJjGjMJmIQ,3892
+mpl_toolkits/axisartist/floating_axes.py,sha256=GOhgBLbJg9kHCPwEsxIaNnGkY-XCD6DaZ16ePpesaKg,13233
+mpl_toolkits/axisartist/grid_finder.py,sha256=TcNFGw-KtSfTMCPUk45FE7We33bDRrwSwPzKj-ET7nM,10442
+mpl_toolkits/axisartist/grid_helper_curvelinear.py,sha256=R8hPkXz5yIAOGc1dUmQwIRNjFENhAyBQwkZs9k3B5BU,13873
+mpl_toolkits/axisartist/parasite_axes.py,sha256=6TzZNVeii1j0MHIAZz3FWpfdw8kPLKtbm_ElTkOH1Ak,512
+mpl_toolkits/mplot3d/__init__.py,sha256=-7jYs7BlOeVjnGxLWEfMb93i-vzMi6Hdi9CLsAWOD4k,28
+mpl_toolkits/mplot3d/__pycache__/__init__.cpython-38.pyc,,
+mpl_toolkits/mplot3d/__pycache__/art3d.cpython-38.pyc,,
+mpl_toolkits/mplot3d/__pycache__/axes3d.cpython-38.pyc,,
+mpl_toolkits/mplot3d/__pycache__/axis3d.cpython-38.pyc,,
+mpl_toolkits/mplot3d/__pycache__/proj3d.cpython-38.pyc,,
+mpl_toolkits/mplot3d/art3d.py,sha256=ZwL2vc-l4e_yTzVFA8PSPgLKuBIbuuhfIrWCqp8xXtY,32216
+mpl_toolkits/mplot3d/axes3d.py,sha256=58Cg_M_Gcgf1TZe-puXQhKQrgQ3-q81MfhbvxgwljTM,132952
+mpl_toolkits/mplot3d/axis3d.py,sha256=577Wwwzilu4cS6gW3T8YdxiF_d23NqHN3uWeicoCu14,19298
+mpl_toolkits/mplot3d/proj3d.py,sha256=Lbc0nw5w6Cvune2_kxCwIJ9Gg5VryOD0Ilue_3lU9dY,4441
+mpl_toolkits/tests/__init__.py,sha256=jY2lF4letZKOagkrt6B_HnnKouuCgo8hG3saDzq8eGI,375
+mpl_toolkits/tests/__pycache__/__init__.cpython-38.pyc,,
+mpl_toolkits/tests/__pycache__/conftest.cpython-38.pyc,,
+mpl_toolkits/tests/__pycache__/test_axes_grid.cpython-38.pyc,,
+mpl_toolkits/tests/__pycache__/test_axes_grid1.cpython-38.pyc,,
+mpl_toolkits/tests/__pycache__/test_axisartist_angle_helper.cpython-38.pyc,,
+mpl_toolkits/tests/__pycache__/test_axisartist_axis_artist.cpython-38.pyc,,
+mpl_toolkits/tests/__pycache__/test_axisartist_axislines.cpython-38.pyc,,
+mpl_toolkits/tests/__pycache__/test_axisartist_clip_path.cpython-38.pyc,,
+mpl_toolkits/tests/__pycache__/test_axisartist_floating_axes.cpython-38.pyc,,
+mpl_toolkits/tests/__pycache__/test_axisartist_grid_finder.cpython-38.pyc,,
+mpl_toolkits/tests/__pycache__/test_axisartist_grid_helper_curvelinear.cpython-38.pyc,,
+mpl_toolkits/tests/__pycache__/test_mplot3d.cpython-38.pyc,,
+mpl_toolkits/tests/conftest.py,sha256=C8DbesGlumOhSREkWrdBGaWu0vchqik17dTokP8aDAA,216
+mpl_toolkits/tests/test_axes_grid.py,sha256=nWcgdYcK5CX5dS2duS7lBU606YK3dALksHtqRYuOqHs,2225
+mpl_toolkits/tests/test_axes_grid1.py,sha256=LfWojqTWVeRQi-p_Zi6y1UUbAbAOaJs2F6s0ZCPjJac,18170
+mpl_toolkits/tests/test_axisartist_angle_helper.py,sha256=SI_lyCLbVKikZp9DRBpq--MbfT10vSQsNx1Z5HMeqMw,5811
+mpl_toolkits/tests/test_axisartist_axis_artist.py,sha256=yzGoWLFPlnkCYZKMO5M6KEipnZD0PsWK5UNToX3LaVU,3107
+mpl_toolkits/tests/test_axisartist_axislines.py,sha256=qPlG4iHAKCBkCHRAuKg36pLPIfi7pzAuXPtOViEOJgk,2821
+mpl_toolkits/tests/test_axisartist_clip_path.py,sha256=Hj622Au6sUcrIN6ryWnm9UUxXVd2isWxFZCUo1YicY0,1036
+mpl_toolkits/tests/test_axisartist_floating_axes.py,sha256=E0JiMUKAX8-IibI5iJN8eu283TWYoL66NTXHZf39dnk,4600
+mpl_toolkits/tests/test_axisartist_grid_finder.py,sha256=oNZQ1PoRgpUoWqg8qdvgplZW3iFK6FhXcVS9LxuVqZE,338
+mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py,sha256=3TrY7f2Srh1VYWFEyOGcRU_-BT_Dms5GNnwRY0-hMTo,7740
+mpl_toolkits/tests/test_mplot3d.py,sha256=5EIm5ulRhegAmK88WAZ1j6y2pPj7e_3WWjjSaYvzekk,48313
+pylab.py,sha256=Ni2YJ31pBmyfkWr5WyTFmS1qM40JuEeKrJhYKWbd6KY,93
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/REQUESTED b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/REQUESTED
new file mode 100644
index 0000000..e69de29
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/WHEEL b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/WHEEL
new file mode 100644
index 0000000..f7306a7
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.36.2)
+Root-Is-Purelib: false
+Tag: cp38-cp38-win_amd64
+
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/namespace_packages.txt b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/namespace_packages.txt
new file mode 100644
index 0000000..ba2e3ed
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/namespace_packages.txt
@@ -0,0 +1 @@
+mpl_toolkits
diff --git a/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/top_level.txt b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/top_level.txt
new file mode 100644
index 0000000..0eb77e4
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib-3.4.2.dist-info/top_level.txt
@@ -0,0 +1,3 @@
+matplotlib
+mpl_toolkits
+pylab
diff --git a/venv/Lib/site-packages/matplotlib/__init__.py b/venv/Lib/site-packages/matplotlib/__init__.py
new file mode 100644
index 0000000..71c68a3
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/__init__.py
@@ -0,0 +1,1397 @@
+"""
+An object-oriented plotting library.
+
+A procedural interface is provided by the companion pyplot module,
+which may be imported directly, e.g.::
+
+ import matplotlib.pyplot as plt
+
+or using ipython::
+
+ ipython
+
+at your terminal, followed by::
+
+ In [1]: %matplotlib
+ In [2]: import matplotlib.pyplot as plt
+
+at the ipython shell prompt.
+
+For the most part, direct use of the object-oriented library is encouraged when
+programming; pyplot is primarily for working interactively. The exceptions are
+the pyplot functions `.pyplot.figure`, `.pyplot.subplot`, `.pyplot.subplots`,
+and `.pyplot.savefig`, which can greatly simplify scripting.
+
+Modules include:
+
+ :mod:`matplotlib.axes`
+ The `~.axes.Axes` class. Most pyplot functions are wrappers for
+ `~.axes.Axes` methods. The axes module is the highest level of OO
+ access to the library.
+
+ :mod:`matplotlib.figure`
+ The `.Figure` class.
+
+ :mod:`matplotlib.artist`
+ The `.Artist` base class for all classes that draw things.
+
+ :mod:`matplotlib.lines`
+ The `.Line2D` class for drawing lines and markers.
+
+ :mod:`matplotlib.patches`
+ Classes for drawing polygons.
+
+ :mod:`matplotlib.text`
+ The `.Text` and `.Annotation` classes.
+
+ :mod:`matplotlib.image`
+ The `.AxesImage` and `.FigureImage` classes.
+
+ :mod:`matplotlib.collections`
+ Classes for efficient drawing of groups of lines or polygons.
+
+ :mod:`matplotlib.colors`
+ Color specifications and making colormaps.
+
+ :mod:`matplotlib.cm`
+ Colormaps, and the `.ScalarMappable` mixin class for providing color
+ mapping functionality to other classes.
+
+ :mod:`matplotlib.ticker`
+ Calculation of tick mark locations and formatting of tick labels.
+
+ :mod:`matplotlib.backends`
+ A subpackage with modules for various GUI libraries and output formats.
+
+The base matplotlib namespace includes:
+
+ `~matplotlib.rcParams`
+ Default configuration settings; their defaults may be overridden using
+ a :file:`matplotlibrc` file.
+
+ `~matplotlib.use`
+ Setting the Matplotlib backend. This should be called before any
+ figure is created, because it is not possible to switch between
+ different GUI backends after that.
+
+Matplotlib was initially written by John D. Hunter (1968-2012) and is now
+developed and maintained by a host of others.
+
+Occasionally the internal documentation (python docstrings) will refer
+to MATLAB®, a registered trademark of The MathWorks, Inc.
+"""
+
+import atexit
+from collections import namedtuple
+from collections.abc import MutableMapping
+import contextlib
+from distutils.version import LooseVersion
+import functools
+import importlib
+import inspect
+from inspect import Parameter
+import locale
+import logging
+import os
+from pathlib import Path
+import pprint
+import re
+import shutil
+import subprocess
+import sys
+import tempfile
+import warnings
+
+# cbook must import matplotlib only within function
+# definitions, so it is safe to import from it here.
+from . import _api, cbook, docstring, rcsetup
+from matplotlib.cbook import MatplotlibDeprecationWarning, sanitize_sequence
+from matplotlib.cbook import mplDeprecation # deprecated
+from matplotlib.rcsetup import validate_backend, cycler
+
+import numpy
+
+# Get the version from the _version.py versioneer file. For a git checkout,
+# this is computed based on the number of commits since the last tag.
+from ._version import get_versions
+__version__ = str(get_versions()['version'])
+del get_versions
+
+_log = logging.getLogger(__name__)
+
+__bibtex__ = r"""@Article{Hunter:2007,
+ Author = {Hunter, J. D.},
+ Title = {Matplotlib: A 2D graphics environment},
+ Journal = {Computing in Science \& Engineering},
+ Volume = {9},
+ Number = {3},
+ Pages = {90--95},
+ abstract = {Matplotlib is a 2D graphics package used for Python
+ for application development, interactive scripting, and
+ publication-quality image generation across user
+ interfaces and operating systems.},
+ publisher = {IEEE COMPUTER SOC},
+ year = 2007
+}"""
+
+
+def _check_versions():
+
+ # Quickfix to ensure Microsoft Visual C++ redistributable
+ # DLLs are loaded before importing kiwisolver
+ from . import ft2font
+
+ for modname, minver in [
+ ("cycler", "0.10"),
+ ("dateutil", "2.7"),
+ ("kiwisolver", "1.0.1"),
+ ("numpy", "1.16"),
+ ("pyparsing", "2.2.1"),
+ ]:
+ module = importlib.import_module(modname)
+ if LooseVersion(module.__version__) < minver:
+ raise ImportError("Matplotlib requires {}>={}; you have {}"
+ .format(modname, minver, module.__version__))
+
+
+_check_versions()
+
+
+# The decorator ensures this always returns the same handler (and it is only
+# attached once).
+@functools.lru_cache()
+def _ensure_handler():
+ """
+ The first time this function is called, attach a `StreamHandler` using the
+ same format as `logging.basicConfig` to the Matplotlib root logger.
+
+ Return this handler every time this function is called.
+ """
+ handler = logging.StreamHandler()
+ handler.setFormatter(logging.Formatter(logging.BASIC_FORMAT))
+ _log.addHandler(handler)
+ return handler
+
+
+def set_loglevel(level):
+ """
+ Set Matplotlib's root logger and root logger handler level, creating
+ the handler if it does not exist yet.
+
+ Typically, one should call ``set_loglevel("info")`` or
+ ``set_loglevel("debug")`` to get additional debugging information.
+
+ Parameters
+ ----------
+ level : {"notset", "debug", "info", "warning", "error", "critical"}
+ The log level of the handler.
+
+ Notes
+ -----
+ The first time this function is called, an additional handler is attached
+ to Matplotlib's root handler; this handler is reused every time and this
+ function simply manipulates the logger and handler's level.
+ """
+ _log.setLevel(level.upper())
+ _ensure_handler().setLevel(level.upper())
+
+
+def _logged_cached(fmt, func=None):
+ """
+ Decorator that logs a function's return value, and memoizes that value.
+
+ After ::
+
+ @_logged_cached(fmt)
+ def func(): ...
+
+ the first call to *func* will log its return value at the DEBUG level using
+ %-format string *fmt*, and memoize it; later calls to *func* will directly
+ return that value.
+ """
+ if func is None: # Return the actual decorator.
+ return functools.partial(_logged_cached, fmt)
+
+ called = False
+ ret = None
+
+ @functools.wraps(func)
+ def wrapper(**kwargs):
+ nonlocal called, ret
+ if not called:
+ ret = func(**kwargs)
+ called = True
+ _log.debug(fmt, ret)
+ return ret
+
+ return wrapper
+
+
+_ExecInfo = namedtuple("_ExecInfo", "executable version")
+
+
+class ExecutableNotFoundError(FileNotFoundError):
+ """
+ Error raised when an executable that Matplotlib optionally
+ depends on can't be found.
+ """
+ pass
+
+
+@functools.lru_cache()
+def _get_executable_info(name):
+ """
+ Get the version of some executable that Matplotlib optionally depends on.
+
+ .. warning::
+ The list of executables that this function supports is set according to
+ Matplotlib's internal needs, and may change without notice.
+
+ Parameters
+ ----------
+ name : str
+ The executable to query. The following values are currently supported:
+ "dvipng", "gs", "inkscape", "magick", "pdftops". This list is subject
+ to change without notice.
+
+ Returns
+ -------
+ tuple
+ A namedtuple with fields ``executable`` (`str`) and ``version``
+ (`distutils.version.LooseVersion`, or ``None`` if the version cannot be
+ determined).
+
+ Raises
+ ------
+ ExecutableNotFoundError
+ If the executable is not found or older than the oldest version
+ supported by Matplotlib.
+ ValueError
+ If the executable is not one that we know how to query.
+ """
+
+ def impl(args, regex, min_ver=None, ignore_exit_code=False):
+ # Execute the subprocess specified by args; capture stdout and stderr.
+ # Search for a regex match in the output; if the match succeeds, the
+ # first group of the match is the version.
+ # Return an _ExecInfo if the executable exists, and has a version of
+ # at least min_ver (if set); else, raise ExecutableNotFoundError.
+ try:
+ output = subprocess.check_output(
+ args, stderr=subprocess.STDOUT,
+ universal_newlines=True, errors="replace")
+ except subprocess.CalledProcessError as _cpe:
+ if ignore_exit_code:
+ output = _cpe.output
+ else:
+ raise ExecutableNotFoundError(str(_cpe)) from _cpe
+ except OSError as _ose:
+ raise ExecutableNotFoundError(str(_ose)) from _ose
+ match = re.search(regex, output)
+ if match:
+ version = LooseVersion(match.group(1))
+ if min_ver is not None and version < min_ver:
+ raise ExecutableNotFoundError(
+ f"You have {args[0]} version {version} but the minimum "
+ f"version supported by Matplotlib is {min_ver}")
+ return _ExecInfo(args[0], version)
+ else:
+ raise ExecutableNotFoundError(
+ f"Failed to determine the version of {args[0]} from "
+ f"{' '.join(args)}, which output {output}")
+
+ if name == "dvipng":
+ return impl(["dvipng", "-version"], "(?m)^dvipng(?: .*)? (.+)", "1.6")
+ elif name == "gs":
+ execs = (["gswin32c", "gswin64c", "mgs", "gs"] # "mgs" for miktex.
+ if sys.platform == "win32" else
+ ["gs"])
+ for e in execs:
+ try:
+ return impl([e, "--version"], "(.*)", "9")
+ except ExecutableNotFoundError:
+ pass
+ message = "Failed to find a Ghostscript installation"
+ raise ExecutableNotFoundError(message)
+ elif name == "inkscape":
+ try:
+ # Try headless option first (needed for Inkscape version < 1.0):
+ return impl(["inkscape", "--without-gui", "-V"],
+ "Inkscape ([^ ]*)")
+ except ExecutableNotFoundError:
+ pass # Suppress exception chaining.
+ # If --without-gui is not accepted, we may be using Inkscape >= 1.0 so
+ # try without it:
+ return impl(["inkscape", "-V"], "Inkscape ([^ ]*)")
+ elif name == "magick":
+ if sys.platform == "win32":
+ # Check the registry to avoid confusing ImageMagick's convert with
+ # Windows's builtin convert.exe.
+ import winreg
+ binpath = ""
+ for flag in [0, winreg.KEY_WOW64_32KEY, winreg.KEY_WOW64_64KEY]:
+ try:
+ with winreg.OpenKeyEx(
+ winreg.HKEY_LOCAL_MACHINE,
+ r"Software\Imagemagick\Current",
+ 0, winreg.KEY_QUERY_VALUE | flag) as hkey:
+ binpath = winreg.QueryValueEx(hkey, "BinPath")[0]
+ except OSError:
+ pass
+ path = None
+ if binpath:
+ for name in ["convert.exe", "magick.exe"]:
+ candidate = Path(binpath, name)
+ if candidate.exists():
+ path = str(candidate)
+ break
+ if path is None:
+ raise ExecutableNotFoundError(
+ "Failed to find an ImageMagick installation")
+ else:
+ path = "convert"
+ info = impl([path, "--version"], r"^Version: ImageMagick (\S*)")
+ if info.version == "7.0.10-34":
+ # https://github.com/ImageMagick/ImageMagick/issues/2720
+ raise ExecutableNotFoundError(
+ f"You have ImageMagick {info.version}, which is unsupported")
+ return info
+ elif name == "pdftops":
+ info = impl(["pdftops", "-v"], "^pdftops version (.*)",
+ ignore_exit_code=True)
+ if info and not ("3.0" <= info.version
+ # poppler version numbers.
+ or "0.9" <= info.version <= "1.0"):
+ raise ExecutableNotFoundError(
+ f"You have pdftops version {info.version} but the minimum "
+ f"version supported by Matplotlib is 3.0")
+ return info
+ else:
+ raise ValueError("Unknown executable: {!r}".format(name))
+
+
+def checkdep_usetex(s):
+ if not s:
+ return False
+ if not shutil.which("tex"):
+ _log.warning("usetex mode requires TeX.")
+ return False
+ try:
+ _get_executable_info("dvipng")
+ except ExecutableNotFoundError:
+ _log.warning("usetex mode requires dvipng.")
+ return False
+ try:
+ _get_executable_info("gs")
+ except ExecutableNotFoundError:
+ _log.warning("usetex mode requires ghostscript.")
+ return False
+ return True
+
+
+def _get_xdg_config_dir():
+ """
+ Return the XDG configuration directory, according to the XDG base
+ directory spec:
+
+ https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
+ """
+ return os.environ.get('XDG_CONFIG_HOME') or str(Path.home() / ".config")
+
+
+def _get_xdg_cache_dir():
+ """
+ Return the XDG cache directory, according to the XDG base directory spec:
+
+ https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
+ """
+ return os.environ.get('XDG_CACHE_HOME') or str(Path.home() / ".cache")
+
+
+def _get_config_or_cache_dir(xdg_base_getter):
+ configdir = os.environ.get('MPLCONFIGDIR')
+ if configdir:
+ configdir = Path(configdir).resolve()
+ elif sys.platform.startswith(('linux', 'freebsd')):
+ # Only call _xdg_base_getter here so that MPLCONFIGDIR is tried first,
+ # as _xdg_base_getter can throw.
+ configdir = Path(xdg_base_getter(), "matplotlib")
+ else:
+ configdir = Path.home() / ".matplotlib"
+ try:
+ configdir.mkdir(parents=True, exist_ok=True)
+ except OSError:
+ pass
+ else:
+ if os.access(str(configdir), os.W_OK) and configdir.is_dir():
+ return str(configdir)
+ # If the config or cache directory cannot be created or is not a writable
+ # directory, create a temporary one.
+ tmpdir = os.environ["MPLCONFIGDIR"] = \
+ tempfile.mkdtemp(prefix="matplotlib-")
+ atexit.register(shutil.rmtree, tmpdir)
+ _log.warning(
+ "Matplotlib created a temporary config/cache directory at %s because "
+ "the default path (%s) is not a writable directory; it is highly "
+ "recommended to set the MPLCONFIGDIR environment variable to a "
+ "writable directory, in particular to speed up the import of "
+ "Matplotlib and to better support multiprocessing.",
+ tmpdir, configdir)
+ return tmpdir
+
+
+@_logged_cached('CONFIGDIR=%s')
+def get_configdir():
+ """
+ Return the string path of the the configuration directory.
+
+ The directory is chosen as follows:
+
+ 1. If the MPLCONFIGDIR environment variable is supplied, choose that.
+ 2. On Linux, follow the XDG specification and look first in
+ ``$XDG_CONFIG_HOME``, if defined, or ``$HOME/.config``. On other
+ platforms, choose ``$HOME/.matplotlib``.
+ 3. If the chosen directory exists and is writable, use that as the
+ configuration directory.
+ 4. Else, create a temporary directory, and use it as the configuration
+ directory.
+ """
+ return _get_config_or_cache_dir(_get_xdg_config_dir)
+
+
+@_logged_cached('CACHEDIR=%s')
+def get_cachedir():
+ """
+ Return the string path of the cache directory.
+
+ The procedure used to find the directory is the same as for
+ _get_config_dir, except using ``$XDG_CACHE_HOME``/``$HOME/.cache`` instead.
+ """
+ return _get_config_or_cache_dir(_get_xdg_cache_dir)
+
+
+@_logged_cached('matplotlib data path: %s')
+def get_data_path():
+ """Return the path to Matplotlib data."""
+ return str(Path(__file__).with_name("mpl-data"))
+
+
+def matplotlib_fname():
+ """
+ Get the location of the config file.
+
+ The file location is determined in the following order
+
+ - ``$PWD/matplotlibrc``
+ - ``$MATPLOTLIBRC`` if it is not a directory
+ - ``$MATPLOTLIBRC/matplotlibrc``
+ - ``$MPLCONFIGDIR/matplotlibrc``
+ - On Linux,
+ - ``$XDG_CONFIG_HOME/matplotlib/matplotlibrc`` (if ``$XDG_CONFIG_HOME``
+ is defined)
+ - or ``$HOME/.config/matplotlib/matplotlibrc`` (if ``$XDG_CONFIG_HOME``
+ is not defined)
+ - On other platforms,
+ - ``$HOME/.matplotlib/matplotlibrc`` if ``$HOME`` is defined
+ - Lastly, it looks in ``$MATPLOTLIBDATA/matplotlibrc``, which should always
+ exist.
+ """
+
+ def gen_candidates():
+ # rely on down-stream code to make absolute. This protects us
+ # from having to directly get the current working directory
+ # which can fail if the user has ended up with a cwd that is
+ # non-existent.
+ yield 'matplotlibrc'
+ try:
+ matplotlibrc = os.environ['MATPLOTLIBRC']
+ except KeyError:
+ pass
+ else:
+ yield matplotlibrc
+ yield os.path.join(matplotlibrc, 'matplotlibrc')
+ yield os.path.join(get_configdir(), 'matplotlibrc')
+ yield os.path.join(get_data_path(), 'matplotlibrc')
+
+ for fname in gen_candidates():
+ if os.path.exists(fname) and not os.path.isdir(fname):
+ return fname
+
+ raise RuntimeError("Could not find matplotlibrc file; your Matplotlib "
+ "install is broken")
+
+
+# rcParams deprecated and automatically mapped to another key.
+# Values are tuples of (version, new_name, f_old2new, f_new2old).
+_deprecated_map = {}
+
+# rcParams deprecated; some can manually be mapped to another key.
+# Values are tuples of (version, new_name_or_None).
+_deprecated_ignore_map = {
+ 'mpl_toolkits.legacy_colorbar': ('3.4', None),
+}
+
+# rcParams deprecated; can use None to suppress warnings; remain actually
+# listed in the rcParams (not included in _all_deprecated).
+# Values are tuples of (version,)
+_deprecated_remain_as_none = {
+ 'animation.avconv_path': ('3.3',),
+ 'animation.avconv_args': ('3.3',),
+ 'animation.html_args': ('3.3',),
+ 'mathtext.fallback_to_cm': ('3.3',),
+ 'keymap.all_axes': ('3.3',),
+ 'savefig.jpeg_quality': ('3.3',),
+ 'text.latex.preview': ('3.3',),
+}
+
+
+_all_deprecated = {*_deprecated_map, *_deprecated_ignore_map}
+
+
+@docstring.Substitution("\n".join(map("- {}".format, rcsetup._validators)))
+class RcParams(MutableMapping, dict):
+ """
+ A dictionary object including validation.
+
+ Validating functions are defined and associated with rc parameters in
+ :mod:`matplotlib.rcsetup`.
+
+ The list of rcParams is:
+
+ %s
+
+ See Also
+ --------
+ :ref:`customizing-with-matplotlibrc-files`
+ """
+
+ validate = rcsetup._validators
+
+ # validate values on the way in
+ def __init__(self, *args, **kwargs):
+ self.update(*args, **kwargs)
+
+ def __setitem__(self, key, val):
+ try:
+ if key in _deprecated_map:
+ version, alt_key, alt_val, inverse_alt = _deprecated_map[key]
+ _api.warn_deprecated(
+ version, name=key, obj_type="rcparam", alternative=alt_key)
+ key = alt_key
+ val = alt_val(val)
+ elif key in _deprecated_remain_as_none and val is not None:
+ version, = _deprecated_remain_as_none[key]
+ _api.warn_deprecated(version, name=key, obj_type="rcparam")
+ elif key in _deprecated_ignore_map:
+ version, alt_key = _deprecated_ignore_map[key]
+ _api.warn_deprecated(
+ version, name=key, obj_type="rcparam", alternative=alt_key)
+ return
+ elif key == 'backend':
+ if val is rcsetup._auto_backend_sentinel:
+ if 'backend' in self:
+ return
+ try:
+ cval = self.validate[key](val)
+ except ValueError as ve:
+ raise ValueError(f"Key {key}: {ve}") from None
+ dict.__setitem__(self, key, cval)
+ except KeyError as err:
+ raise KeyError(
+ f"{key} is not a valid rc parameter (see rcParams.keys() for "
+ f"a list of valid parameters)") from err
+
+ def __getitem__(self, key):
+ if key in _deprecated_map:
+ version, alt_key, alt_val, inverse_alt = _deprecated_map[key]
+ _api.warn_deprecated(
+ version, name=key, obj_type="rcparam", alternative=alt_key)
+ return inverse_alt(dict.__getitem__(self, alt_key))
+
+ elif key in _deprecated_ignore_map:
+ version, alt_key = _deprecated_ignore_map[key]
+ _api.warn_deprecated(
+ version, name=key, obj_type="rcparam", alternative=alt_key)
+ return dict.__getitem__(self, alt_key) if alt_key else None
+
+ elif key == "backend":
+ val = dict.__getitem__(self, key)
+ if val is rcsetup._auto_backend_sentinel:
+ from matplotlib import pyplot as plt
+ plt.switch_backend(rcsetup._auto_backend_sentinel)
+
+ return dict.__getitem__(self, key)
+
+ def __repr__(self):
+ class_name = self.__class__.__name__
+ indent = len(class_name) + 1
+ with _api.suppress_matplotlib_deprecation_warning():
+ repr_split = pprint.pformat(dict(self), indent=1,
+ width=80 - indent).split('\n')
+ repr_indented = ('\n' + ' ' * indent).join(repr_split)
+ return '{}({})'.format(class_name, repr_indented)
+
+ def __str__(self):
+ return '\n'.join(map('{0[0]}: {0[1]}'.format, sorted(self.items())))
+
+ def __iter__(self):
+ """Yield sorted list of keys."""
+ with _api.suppress_matplotlib_deprecation_warning():
+ yield from sorted(dict.__iter__(self))
+
+ def __len__(self):
+ return dict.__len__(self)
+
+ def find_all(self, pattern):
+ """
+ Return the subset of this RcParams dictionary whose keys match,
+ using :func:`re.search`, the given ``pattern``.
+
+ .. note::
+
+ Changes to the returned dictionary are *not* propagated to
+ the parent RcParams dictionary.
+
+ """
+ pattern_re = re.compile(pattern)
+ return RcParams((key, value)
+ for key, value in self.items()
+ if pattern_re.search(key))
+
+ def copy(self):
+ return {k: dict.__getitem__(self, k) for k in self}
+
+
+def rc_params(fail_on_error=False):
+ """Construct a `RcParams` instance from the default Matplotlib rc file."""
+ return rc_params_from_file(matplotlib_fname(), fail_on_error)
+
+
+URL_REGEX = re.compile(r'^http://|^https://|^ftp://|^file:')
+
+
+def is_url(filename):
+ """Return whether *filename* is an http, https, ftp, or file URL path."""
+ return URL_REGEX.match(filename) is not None
+
+
+@functools.lru_cache()
+def _get_ssl_context():
+ try:
+ import certifi
+ except ImportError:
+ _log.debug("Could not import certifi.")
+ return None
+ import ssl
+ return ssl.create_default_context(cafile=certifi.where())
+
+
+@contextlib.contextmanager
+def _open_file_or_url(fname):
+ if not isinstance(fname, Path) and is_url(fname):
+ import urllib.request
+ ssl_ctx = _get_ssl_context()
+ if ssl_ctx is None:
+ _log.debug(
+ "Could not get certifi ssl context, https may not work."
+ )
+ with urllib.request.urlopen(fname, context=ssl_ctx) as f:
+ yield (line.decode('utf-8') for line in f)
+ else:
+ fname = os.path.expanduser(fname)
+ encoding = locale.getpreferredencoding(do_setlocale=False)
+ if encoding is None:
+ encoding = "utf-8"
+ with open(fname, encoding=encoding) as f:
+ yield f
+
+
+def _rc_params_in_file(fname, transform=lambda x: x, fail_on_error=False):
+ """
+ Construct a `RcParams` instance from file *fname*.
+
+ Unlike `rc_params_from_file`, the configuration class only contains the
+ parameters specified in the file (i.e. default values are not filled in).
+
+ Parameters
+ ----------
+ fname : path-like
+ The loaded file.
+ transform : callable, default: the identity function
+ A function called on each individual line of the file to transform it,
+ before further parsing.
+ fail_on_error : bool, default: False
+ Whether invalid entries should result in an exception or a warning.
+ """
+ rc_temp = {}
+ with _open_file_or_url(fname) as fd:
+ try:
+ for line_no, line in enumerate(fd, 1):
+ line = transform(line)
+ strippedline = line.split('#', 1)[0].strip()
+ if not strippedline:
+ continue
+ tup = strippedline.split(':', 1)
+ if len(tup) != 2:
+ _log.warning('Missing colon in file %r, line %d (%r)',
+ fname, line_no, line.rstrip('\n'))
+ continue
+ key, val = tup
+ key = key.strip()
+ val = val.strip()
+ if key in rc_temp:
+ _log.warning('Duplicate key in file %r, line %d (%r)',
+ fname, line_no, line.rstrip('\n'))
+ rc_temp[key] = (val, line, line_no)
+ except UnicodeDecodeError:
+ _log.warning('Cannot decode configuration file %s with encoding '
+ '%s, check LANG and LC_* variables.',
+ fname,
+ locale.getpreferredencoding(do_setlocale=False)
+ or 'utf-8 (default)')
+ raise
+
+ config = RcParams()
+
+ for key, (val, line, line_no) in rc_temp.items():
+ if key in rcsetup._validators:
+ if fail_on_error:
+ config[key] = val # try to convert to proper type or raise
+ else:
+ try:
+ config[key] = val # try to convert to proper type or skip
+ except Exception as msg:
+ _log.warning('Bad value in file %r, line %d (%r): %s',
+ fname, line_no, line.rstrip('\n'), msg)
+ elif key in _deprecated_ignore_map:
+ version, alt_key = _deprecated_ignore_map[key]
+ _api.warn_deprecated(
+ version, name=key, alternative=alt_key, obj_type='rcparam',
+ addendum="Please update your matplotlibrc.")
+ else:
+ version = 'master' if '.post' in __version__ else f'v{__version__}'
+ _log.warning("""
+Bad key %(key)s in file %(fname)s, line %(line_no)s (%(line)r)
+You probably need to get an updated matplotlibrc file from
+https://github.com/matplotlib/matplotlib/blob/%(version)s/matplotlibrc.template
+or from the matplotlib source distribution""",
+ dict(key=key, fname=fname, line_no=line_no,
+ line=line.rstrip('\n'), version=version))
+ return config
+
+
+def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
+ """
+ Construct a `RcParams` from file *fname*.
+
+ Parameters
+ ----------
+ fname : str or path-like
+ A file with Matplotlib rc settings.
+ fail_on_error : bool
+ If True, raise an error when the parser fails to convert a parameter.
+ use_default_template : bool
+ If True, initialize with default parameters before updating with those
+ in the given file. If False, the configuration class only contains the
+ parameters specified in the file. (Useful for updating dicts.)
+ """
+ config_from_file = _rc_params_in_file(fname, fail_on_error=fail_on_error)
+
+ if not use_default_template:
+ return config_from_file
+
+ with _api.suppress_matplotlib_deprecation_warning():
+ config = RcParams({**rcParamsDefault, **config_from_file})
+
+ if "".join(config['text.latex.preamble']):
+ _log.info("""
+*****************************************************************
+You have the following UNSUPPORTED LaTeX preamble customizations:
+%s
+Please do not ask for support with these customizations active.
+*****************************************************************
+""", '\n'.join(config['text.latex.preamble']))
+ _log.debug('loaded rc file %s', fname)
+
+ return config
+
+
+# When constructing the global instances, we need to perform certain updates
+# by explicitly calling the superclass (dict.update, dict.items) to avoid
+# triggering resolution of _auto_backend_sentinel.
+rcParamsDefault = _rc_params_in_file(
+ cbook._get_data_path("matplotlibrc"),
+ # Strip leading comment.
+ transform=lambda line: line[1:] if line.startswith("#") else line,
+ fail_on_error=True)
+dict.update(rcParamsDefault, rcsetup._hardcoded_defaults)
+rcParams = RcParams() # The global instance.
+dict.update(rcParams, dict.items(rcParamsDefault))
+dict.update(rcParams, _rc_params_in_file(matplotlib_fname()))
+with _api.suppress_matplotlib_deprecation_warning():
+ rcParamsOrig = RcParams(rcParams.copy())
+ # This also checks that all rcParams are indeed listed in the template.
+ # Assigning to rcsetup.defaultParams is left only for backcompat.
+ defaultParams = rcsetup.defaultParams = {
+ # We want to resolve deprecated rcParams, but not backend...
+ key: [(rcsetup._auto_backend_sentinel if key == "backend" else
+ rcParamsDefault[key]),
+ validator]
+ for key, validator in rcsetup._validators.items()}
+if rcParams['axes.formatter.use_locale']:
+ locale.setlocale(locale.LC_ALL, '')
+
+
+def rc(group, **kwargs):
+ """
+ Set the current `.rcParams`. *group* is the grouping for the rc, e.g.,
+ for ``lines.linewidth`` the group is ``lines``, for
+ ``axes.facecolor``, the group is ``axes``, and so on. Group may
+ also be a list or tuple of group names, e.g., (*xtick*, *ytick*).
+ *kwargs* is a dictionary attribute name/value pairs, e.g.,::
+
+ rc('lines', linewidth=2, color='r')
+
+ sets the current `.rcParams` and is equivalent to::
+
+ rcParams['lines.linewidth'] = 2
+ rcParams['lines.color'] = 'r'
+
+ The following aliases are available to save typing for interactive users:
+
+ ===== =================
+ Alias Property
+ ===== =================
+ 'lw' 'linewidth'
+ 'ls' 'linestyle'
+ 'c' 'color'
+ 'fc' 'facecolor'
+ 'ec' 'edgecolor'
+ 'mew' 'markeredgewidth'
+ 'aa' 'antialiased'
+ ===== =================
+
+ Thus you could abbreviate the above call as::
+
+ rc('lines', lw=2, c='r')
+
+ Note you can use python's kwargs dictionary facility to store
+ dictionaries of default parameters. e.g., you can customize the
+ font rc as follows::
+
+ font = {'family' : 'monospace',
+ 'weight' : 'bold',
+ 'size' : 'larger'}
+ rc('font', **font) # pass in the font dict as kwargs
+
+ This enables you to easily switch between several configurations. Use
+ ``matplotlib.style.use('default')`` or :func:`~matplotlib.rcdefaults` to
+ restore the default `.rcParams` after changes.
+
+ Notes
+ -----
+ Similar functionality is available by using the normal dict interface, i.e.
+ ``rcParams.update({"lines.linewidth": 2, ...})`` (but ``rcParams.update``
+ does not support abbreviations or grouping).
+ """
+
+ aliases = {
+ 'lw': 'linewidth',
+ 'ls': 'linestyle',
+ 'c': 'color',
+ 'fc': 'facecolor',
+ 'ec': 'edgecolor',
+ 'mew': 'markeredgewidth',
+ 'aa': 'antialiased',
+ }
+
+ if isinstance(group, str):
+ group = (group,)
+ for g in group:
+ for k, v in kwargs.items():
+ name = aliases.get(k) or k
+ key = '%s.%s' % (g, name)
+ try:
+ rcParams[key] = v
+ except KeyError as err:
+ raise KeyError(('Unrecognized key "%s" for group "%s" and '
+ 'name "%s"') % (key, g, name)) from err
+
+
+def rcdefaults():
+ """
+ Restore the `.rcParams` from Matplotlib's internal default style.
+
+ Style-blacklisted `.rcParams` (defined in
+ `matplotlib.style.core.STYLE_BLACKLIST`) are not updated.
+
+ See Also
+ --------
+ matplotlib.rc_file_defaults
+ Restore the `.rcParams` from the rc file originally loaded by
+ Matplotlib.
+ matplotlib.style.use
+ Use a specific style file. Call ``style.use('default')`` to restore
+ the default style.
+ """
+ # Deprecation warnings were already handled when creating rcParamsDefault,
+ # no need to reemit them here.
+ with _api.suppress_matplotlib_deprecation_warning():
+ from .style.core import STYLE_BLACKLIST
+ rcParams.clear()
+ rcParams.update({k: v for k, v in rcParamsDefault.items()
+ if k not in STYLE_BLACKLIST})
+
+
+def rc_file_defaults():
+ """
+ Restore the `.rcParams` from the original rc file loaded by Matplotlib.
+
+ Style-blacklisted `.rcParams` (defined in
+ `matplotlib.style.core.STYLE_BLACKLIST`) are not updated.
+ """
+ # Deprecation warnings were already handled when creating rcParamsOrig, no
+ # need to reemit them here.
+ with _api.suppress_matplotlib_deprecation_warning():
+ from .style.core import STYLE_BLACKLIST
+ rcParams.update({k: rcParamsOrig[k] for k in rcParamsOrig
+ if k not in STYLE_BLACKLIST})
+
+
+def rc_file(fname, *, use_default_template=True):
+ """
+ Update `.rcParams` from file.
+
+ Style-blacklisted `.rcParams` (defined in
+ `matplotlib.style.core.STYLE_BLACKLIST`) are not updated.
+
+ Parameters
+ ----------
+ fname : str or path-like
+ A file with Matplotlib rc settings.
+
+ use_default_template : bool
+ If True, initialize with default parameters before updating with those
+ in the given file. If False, the current configuration persists
+ and only the parameters specified in the file are updated.
+ """
+ # Deprecation warnings were already handled in rc_params_from_file, no need
+ # to reemit them here.
+ with _api.suppress_matplotlib_deprecation_warning():
+ from .style.core import STYLE_BLACKLIST
+ rc_from_file = rc_params_from_file(
+ fname, use_default_template=use_default_template)
+ rcParams.update({k: rc_from_file[k] for k in rc_from_file
+ if k not in STYLE_BLACKLIST})
+
+
+@contextlib.contextmanager
+def rc_context(rc=None, fname=None):
+ """
+ Return a context manager for temporarily changing rcParams.
+
+ Parameters
+ ----------
+ rc : dict
+ The rcParams to temporarily set.
+ fname : str or path-like
+ A file with Matplotlib rc settings. If both *fname* and *rc* are given,
+ settings from *rc* take precedence.
+
+ See Also
+ --------
+ :ref:`customizing-with-matplotlibrc-files`
+
+ Examples
+ --------
+ Passing explicit values via a dict::
+
+ with mpl.rc_context({'interactive': False}):
+ fig, ax = plt.subplots()
+ ax.plot(range(3), range(3))
+ fig.savefig('example.png')
+ plt.close(fig)
+
+ Loading settings from a file::
+
+ with mpl.rc_context(fname='print.rc'):
+ plt.plot(x, y) # uses 'print.rc'
+
+ """
+ orig = rcParams.copy()
+ try:
+ if fname:
+ rc_file(fname)
+ if rc:
+ rcParams.update(rc)
+ yield
+ finally:
+ dict.update(rcParams, orig) # Revert to the original rcs.
+
+
+def use(backend, *, force=True):
+ """
+ Select the backend used for rendering and GUI integration.
+
+ Parameters
+ ----------
+ backend : str
+ The backend to switch to. This can either be one of the standard
+ backend names, which are case-insensitive:
+
+ - interactive backends:
+ GTK3Agg, GTK3Cairo, MacOSX, nbAgg,
+ Qt4Agg, Qt4Cairo, Qt5Agg, Qt5Cairo,
+ TkAgg, TkCairo, WebAgg, WX, WXAgg, WXCairo
+
+ - non-interactive backends:
+ agg, cairo, pdf, pgf, ps, svg, template
+
+ or a string of the form: ``module://my.module.name``.
+
+ force : bool, default: True
+ If True (the default), raise an `ImportError` if the backend cannot be
+ set up (either because it fails to import, or because an incompatible
+ GUI interactive framework is already running); if False, ignore the
+ failure.
+
+ See Also
+ --------
+ :ref:`backends`
+ matplotlib.get_backend
+ """
+ name = validate_backend(backend)
+ # we need to use the base-class method here to avoid (prematurely)
+ # resolving the "auto" backend setting
+ if dict.__getitem__(rcParams, 'backend') == name:
+ # Nothing to do if the requested backend is already set
+ pass
+ else:
+ # if pyplot is not already imported, do not import it. Doing
+ # so may trigger a `plt.switch_backend` to the _default_ backend
+ # before we get a chance to change to the one the user just requested
+ plt = sys.modules.get('matplotlib.pyplot')
+ # if pyplot is imported, then try to change backends
+ if plt is not None:
+ try:
+ # we need this import check here to re-raise if the
+ # user does not have the libraries to support their
+ # chosen backend installed.
+ plt.switch_backend(name)
+ except ImportError:
+ if force:
+ raise
+ # if we have not imported pyplot, then we can set the rcParam
+ # value which will be respected when the user finally imports
+ # pyplot
+ else:
+ rcParams['backend'] = backend
+ # if the user has asked for a given backend, do not helpfully
+ # fallback
+ rcParams['backend_fallback'] = False
+
+
+if os.environ.get('MPLBACKEND'):
+ rcParams['backend'] = os.environ.get('MPLBACKEND')
+
+
+def get_backend():
+ """
+ Return the name of the current backend.
+
+ See Also
+ --------
+ matplotlib.use
+ """
+ return rcParams['backend']
+
+
+def interactive(b):
+ """
+ Set whether to redraw after every plotting command (e.g. `.pyplot.xlabel`).
+ """
+ rcParams['interactive'] = b
+
+
+def is_interactive():
+ """
+ Return whether to redraw after every plotting command.
+
+ .. note::
+
+ This function is only intended for use in backends. End users should
+ use `.pyplot.isinteractive` instead.
+ """
+ return rcParams['interactive']
+
+
+default_test_modules = [
+ 'matplotlib.tests',
+ 'mpl_toolkits.tests',
+]
+
+
+def _init_tests():
+ # The version of FreeType to install locally for running the
+ # tests. This must match the value in `setupext.py`
+ LOCAL_FREETYPE_VERSION = '2.6.1'
+
+ from matplotlib import ft2font
+ if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or
+ ft2font.__freetype_build_type__ != 'local'):
+ _log.warning(
+ f"Matplotlib is not built with the correct FreeType version to "
+ f"run tests. Rebuild without setting system_freetype=1 in "
+ f"setup.cfg. Expect many image comparison failures below. "
+ f"Expected freetype version {LOCAL_FREETYPE_VERSION}. "
+ f"Found freetype version {ft2font.__freetype_version__}. "
+ "Freetype build type is {}local".format(
+ "" if ft2font.__freetype_build_type__ == 'local' else "not "))
+
+
+@_api.delete_parameter("3.3", "recursionlimit")
+def test(verbosity=None, coverage=False, *, recursionlimit=0, **kwargs):
+ """Run the matplotlib test suite."""
+
+ try:
+ import pytest
+ except ImportError:
+ print("matplotlib.test requires pytest to run.")
+ return -1
+
+ if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'tests')):
+ print("Matplotlib test data is not installed")
+ return -1
+
+ old_backend = get_backend()
+ old_recursionlimit = sys.getrecursionlimit()
+ try:
+ use('agg')
+ if recursionlimit:
+ sys.setrecursionlimit(recursionlimit)
+
+ args = kwargs.pop('argv', [])
+ provide_default_modules = True
+ use_pyargs = True
+ for arg in args:
+ if any(arg.startswith(module_path)
+ for module_path in default_test_modules):
+ provide_default_modules = False
+ break
+ if os.path.exists(arg):
+ provide_default_modules = False
+ use_pyargs = False
+ break
+ if use_pyargs:
+ args += ['--pyargs']
+ if provide_default_modules:
+ args += default_test_modules
+
+ if coverage:
+ args += ['--cov']
+
+ if verbosity:
+ args += ['-' + 'v' * verbosity]
+
+ retcode = pytest.main(args, **kwargs)
+ finally:
+ if old_backend.lower() != 'agg':
+ use(old_backend)
+ if recursionlimit:
+ sys.setrecursionlimit(old_recursionlimit)
+
+ return retcode
+
+
+test.__test__ = False # pytest: this function is not a test
+
+
+def _replacer(data, value):
+ """
+ Either returns ``data[value]`` or passes ``data`` back, converts either to
+ a sequence.
+ """
+ try:
+ # if key isn't a string don't bother
+ if isinstance(value, str):
+ # try to use __getitem__
+ value = data[value]
+ except Exception:
+ # key does not exist, silently fall back to key
+ pass
+ return sanitize_sequence(value)
+
+
+def _label_from_arg(y, default_name):
+ try:
+ return y.name
+ except AttributeError:
+ if isinstance(default_name, str):
+ return default_name
+ return None
+
+
+_DATA_DOC_TITLE = """
+
+Notes
+-----
+"""
+
+_DATA_DOC_APPENDIX = """
+
+.. note::
+ In addition to the above described arguments, this function can take
+ a *data* keyword argument. If such a *data* argument is given,
+{replaced}
+
+ Objects passed as **data** must support item access (``data[s]``) and
+ membership test (``s in data``).
+"""
+
+
+def _add_data_doc(docstring, replace_names):
+ """
+ Add documentation for a *data* field to the given docstring.
+
+ Parameters
+ ----------
+ docstring : str
+ The input docstring.
+ replace_names : list of str or None
+ The list of parameter names which arguments should be replaced by
+ ``data[name]`` (if ``data[name]`` does not throw an exception). If
+ None, replacement is attempted for all arguments.
+
+ Returns
+ -------
+ str
+ The augmented docstring.
+ """
+ if (docstring is None
+ or replace_names is not None and len(replace_names) == 0):
+ return docstring
+ docstring = inspect.cleandoc(docstring)
+ repl = (
+ (" every other argument can also be string ``s``, which is\n"
+ " interpreted as ``data[s]`` (unless this raises an exception).")
+ if replace_names is None else
+ (" the following arguments can also be string ``s``, which is\n"
+ " interpreted as ``data[s]`` (unless this raises an exception):\n"
+ " " + ", ".join(map("*{}*".format, replace_names))) + ".")
+ addendum = _DATA_DOC_APPENDIX.format(replaced=repl)
+ if _DATA_DOC_TITLE not in docstring:
+ addendum = _DATA_DOC_TITLE + addendum
+ return docstring + addendum
+
+
+def _preprocess_data(func=None, *, replace_names=None, label_namer=None):
+ """
+ A decorator to add a 'data' kwarg to a function.
+
+ When applied::
+
+ @_preprocess_data()
+ def func(ax, *args, **kwargs): ...
+
+ the signature is modified to ``decorated(ax, *args, data=None, **kwargs)``
+ with the following behavior:
+
+ - if called with ``data=None``, forward the other arguments to ``func``;
+ - otherwise, *data* must be a mapping; for any argument passed in as a
+ string ``name``, replace the argument by ``data[name]`` (if this does not
+ throw an exception), then forward the arguments to ``func``.
+
+ In either case, any argument that is a `MappingView` is also converted to a
+ list.
+
+ Parameters
+ ----------
+ replace_names : list of str or None, default: None
+ The list of parameter names for which lookup into *data* should be
+ attempted. If None, replacement is attempted for all arguments.
+ label_namer : str, default: None
+ If set e.g. to "namer" (which must be a kwarg in the function's
+ signature -- not as ``**kwargs``), if the *namer* argument passed in is
+ a (string) key of *data* and no *label* kwarg is passed, then use the
+ (string) value of the *namer* as *label*. ::
+
+ @_preprocess_data(label_namer="foo")
+ def func(foo, label=None): ...
+
+ func("key", data={"key": value})
+ # is equivalent to
+ func.__wrapped__(value, label="key")
+ """
+
+ if func is None: # Return the actual decorator.
+ return functools.partial(
+ _preprocess_data,
+ replace_names=replace_names, label_namer=label_namer)
+
+ sig = inspect.signature(func)
+ varargs_name = None
+ varkwargs_name = None
+ arg_names = []
+ params = list(sig.parameters.values())
+ for p in params:
+ if p.kind is Parameter.VAR_POSITIONAL:
+ varargs_name = p.name
+ elif p.kind is Parameter.VAR_KEYWORD:
+ varkwargs_name = p.name
+ else:
+ arg_names.append(p.name)
+ data_param = Parameter("data", Parameter.KEYWORD_ONLY, default=None)
+ if varkwargs_name:
+ params.insert(-1, data_param)
+ else:
+ params.append(data_param)
+ new_sig = sig.replace(parameters=params)
+ arg_names = arg_names[1:] # remove the first "ax" / self arg
+
+ assert {*arg_names}.issuperset(replace_names or []) or varkwargs_name, (
+ "Matplotlib internal error: invalid replace_names ({!r}) for {!r}"
+ .format(replace_names, func.__name__))
+ assert label_namer is None or label_namer in arg_names, (
+ "Matplotlib internal error: invalid label_namer ({!r}) for {!r}"
+ .format(label_namer, func.__name__))
+
+ @functools.wraps(func)
+ def inner(ax, *args, data=None, **kwargs):
+ if data is None:
+ return func(ax, *map(sanitize_sequence, args), **kwargs)
+
+ bound = new_sig.bind(ax, *args, **kwargs)
+ auto_label = (bound.arguments.get(label_namer)
+ or bound.kwargs.get(label_namer))
+
+ for k, v in bound.arguments.items():
+ if k == varkwargs_name:
+ for k1, v1 in v.items():
+ if replace_names is None or k1 in replace_names:
+ v[k1] = _replacer(data, v1)
+ elif k == varargs_name:
+ if replace_names is None:
+ bound.arguments[k] = tuple(_replacer(data, v1) for v1 in v)
+ else:
+ if replace_names is None or k in replace_names:
+ bound.arguments[k] = _replacer(data, v)
+
+ new_args = bound.args
+ new_kwargs = bound.kwargs
+
+ args_and_kwargs = {**bound.arguments, **bound.kwargs}
+ if label_namer and "label" not in args_and_kwargs:
+ new_kwargs["label"] = _label_from_arg(
+ args_and_kwargs.get(label_namer), auto_label)
+
+ return func(*new_args, **new_kwargs)
+
+ inner.__doc__ = _add_data_doc(inner.__doc__, replace_names)
+ inner.__signature__ = new_sig
+ return inner
+
+
+_log.debug('matplotlib version %s', __version__)
+_log.debug('interactive is %s', is_interactive())
+_log.debug('platform is %s', sys.platform)
+_log.debug('loaded modules: %s', list(sys.modules))
diff --git a/venv/Lib/site-packages/matplotlib/_animation_data.py b/venv/Lib/site-packages/matplotlib/_animation_data.py
new file mode 100644
index 0000000..257f0c4
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_animation_data.py
@@ -0,0 +1,262 @@
+# Javascript template for HTMLWriter
+JS_INCLUDE = """
+
+
+"""
+
+
+# Style definitions for the HTML template
+STYLE_INCLUDE = """
+
+"""
+
+
+# HTML template for HTMLWriter
+DISPLAY_TEMPLATE = """
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"""
+
+
+INCLUDED_FRAMES = """
+ for (var i=0; i<{Nframes}; i++){{
+ frames[i] = "{frame_dir}/frame" + ("0000000" + i).slice(-7) +
+ ".{frame_format}";
+ }}
+"""
diff --git a/venv/Lib/site-packages/matplotlib/_api/__init__.py b/venv/Lib/site-packages/matplotlib/_api/__init__.py
new file mode 100644
index 0000000..f251e07
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_api/__init__.py
@@ -0,0 +1,213 @@
+"""
+Helper functions for managing the Matplotlib API.
+
+This documentation is only relevant for Matplotlib developers, not for users.
+
+.. warning:
+
+ This module and its submodules are for internal use only. Do not use them
+ in your own code. We may change the API at any time with no warning.
+
+"""
+
+import itertools
+import re
+import sys
+import warnings
+
+from .deprecation import (
+ deprecated, warn_deprecated,
+ rename_parameter, delete_parameter, make_keyword_only,
+ deprecate_method_override, deprecate_privatize_attribute,
+ suppress_matplotlib_deprecation_warning,
+ MatplotlibDeprecationWarning)
+
+
+class classproperty:
+ """
+ Like `property`, but also triggers on access via the class, and it is the
+ *class* that's passed as argument.
+
+ Examples
+ --------
+ ::
+
+ class C:
+ @classproperty
+ def foo(cls):
+ return cls.__name__
+
+ assert C.foo == "C"
+ """
+
+ def __init__(self, fget, fset=None, fdel=None, doc=None):
+ self._fget = fget
+ if fset is not None or fdel is not None:
+ raise ValueError('classproperty only implements fget.')
+ self.fset = fset
+ self.fdel = fdel
+ # docs are ignored for now
+ self._doc = doc
+
+ def __get__(self, instance, owner):
+ return self._fget(owner)
+
+ @property
+ def fget(self):
+ return self._fget
+
+
+# In the following check_foo() functions, the first parameter starts with an
+# underscore because it is intended to be positional-only (e.g., so that
+# `_api.check_isinstance([...], types=foo)` doesn't fail.
+
+def check_isinstance(_types, **kwargs):
+ """
+ For each *key, value* pair in *kwargs*, check that *value* is an instance
+ of one of *_types*; if not, raise an appropriate TypeError.
+
+ As a special case, a ``None`` entry in *_types* is treated as NoneType.
+
+ Examples
+ --------
+ >>> _api.check_isinstance((SomeClass, None), arg=arg)
+ """
+ types = _types
+ none_type = type(None)
+ types = ((types,) if isinstance(types, type) else
+ (none_type,) if types is None else
+ tuple(none_type if tp is None else tp for tp in types))
+
+ def type_name(tp):
+ return ("None" if tp is none_type
+ else tp.__qualname__ if tp.__module__ == "builtins"
+ else f"{tp.__module__}.{tp.__qualname__}")
+
+ for k, v in kwargs.items():
+ if not isinstance(v, types):
+ names = [*map(type_name, types)]
+ if "None" in names: # Move it to the end for better wording.
+ names.remove("None")
+ names.append("None")
+ raise TypeError(
+ "{!r} must be an instance of {}, not a {}".format(
+ k,
+ ", ".join(names[:-1]) + " or " + names[-1]
+ if len(names) > 1 else names[0],
+ type_name(type(v))))
+
+
+def check_in_list(_values, *, _print_supported_values=True, **kwargs):
+ """
+ For each *key, value* pair in *kwargs*, check that *value* is in *_values*.
+
+ Parameters
+ ----------
+ _values : iterable
+ Sequence of values to check on.
+ _print_supported_values : bool, default: True
+ Whether to print *_values* when raising ValueError.
+ **kwargs : dict
+ *key, value* pairs as keyword arguments to find in *_values*.
+
+ Raises
+ ------
+ ValueError
+ If any *value* in *kwargs* is not found in *_values*.
+
+ Examples
+ --------
+ >>> _api.check_in_list(["foo", "bar"], arg=arg, other_arg=other_arg)
+ """
+ values = _values
+ for key, val in kwargs.items():
+ if val not in values:
+ if _print_supported_values:
+ raise ValueError(
+ f"{val!r} is not a valid value for {key}; "
+ f"supported values are {', '.join(map(repr, values))}")
+ else:
+ raise ValueError(f"{val!r} is not a valid value for {key}")
+
+
+def check_shape(_shape, **kwargs):
+ """
+ For each *key, value* pair in *kwargs*, check that *value* has the shape
+ *_shape*, if not, raise an appropriate ValueError.
+
+ *None* in the shape is treated as a "free" size that can have any length.
+ e.g. (None, 2) -> (N, 2)
+
+ The values checked must be numpy arrays.
+
+ Examples
+ --------
+ To check for (N, 2) shaped arrays
+
+ >>> _api.check_shape((None, 2), arg=arg, other_arg=other_arg)
+ """
+ target_shape = _shape
+ for k, v in kwargs.items():
+ data_shape = v.shape
+
+ if len(target_shape) != len(data_shape) or any(
+ t not in [s, None]
+ for t, s in zip(target_shape, data_shape)
+ ):
+ dim_labels = iter(itertools.chain(
+ 'MNLIJKLH',
+ (f"D{i}" for i in itertools.count())))
+ text_shape = ", ".join((str(n)
+ if n is not None
+ else next(dim_labels)
+ for n in target_shape))
+
+ raise ValueError(
+ f"{k!r} must be {len(target_shape)}D "
+ f"with shape ({text_shape}). "
+ f"Your input has shape {v.shape}."
+ )
+
+
+def check_getitem(_mapping, **kwargs):
+ """
+ *kwargs* must consist of a single *key, value* pair. If *key* is in
+ *_mapping*, return ``_mapping[value]``; else, raise an appropriate
+ ValueError.
+
+ Examples
+ --------
+ >>> _api.check_getitem({"foo": "bar"}, arg=arg)
+ """
+ mapping = _mapping
+ if len(kwargs) != 1:
+ raise ValueError("check_getitem takes a single keyword argument")
+ (k, v), = kwargs.items()
+ try:
+ return mapping[v]
+ except KeyError:
+ raise ValueError(
+ "{!r} is not a valid value for {}; supported values are {}"
+ .format(v, k, ', '.join(map(repr, mapping)))) from None
+
+
+def warn_external(message, category=None):
+ """
+ `warnings.warn` wrapper that sets *stacklevel* to "outside Matplotlib".
+
+ The original emitter of the warning can be obtained by patching this
+ function back to `warnings.warn`, i.e. ``_api.warn_external =
+ warnings.warn`` (or ``functools.partial(warnings.warn, stacklevel=2)``,
+ etc.).
+ """
+ frame = sys._getframe()
+ for stacklevel in itertools.count(1): # lgtm[py/unused-loop-variable]
+ if frame is None:
+ # when called in embedded context may hit frame is None
+ break
+ if not re.match(r"\A(matplotlib|mpl_toolkits)(\Z|\.(?!tests\.))",
+ # Work around sphinx-gallery not setting __name__.
+ frame.f_globals.get("__name__", "")):
+ break
+ frame = frame.f_back
+ warnings.warn(message, category, stacklevel)
diff --git a/venv/Lib/site-packages/matplotlib/_api/deprecation.py b/venv/Lib/site-packages/matplotlib/_api/deprecation.py
new file mode 100644
index 0000000..7c3a179
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_api/deprecation.py
@@ -0,0 +1,522 @@
+"""
+Helper functions for deprecating parts of the Matplotlib API.
+
+This documentation is only relevant for Matplotlib developers, not for users.
+
+.. warning:
+
+ This module is for internal use only. Do not use it in your own code.
+ We may change the API at any time with no warning.
+
+"""
+
+import contextlib
+import functools
+import inspect
+import warnings
+
+
+class MatplotlibDeprecationWarning(UserWarning):
+ """
+ A class for issuing deprecation warnings for Matplotlib users.
+
+ In light of the fact that Python builtin DeprecationWarnings are ignored
+ by default as of Python 2.7 (see link below), this class was put in to
+ allow for the signaling of deprecation, but via UserWarnings which are not
+ ignored by default.
+
+ https://docs.python.org/dev/whatsnew/2.7.html#the-future-for-python-2-x
+ """
+
+
+# mplDeprecation is deprecated. Use MatplotlibDeprecationWarning instead.
+# remove when removing the re-import from cbook
+mplDeprecation = MatplotlibDeprecationWarning
+
+
+def _generate_deprecation_warning(
+ since, message='', name='', alternative='', pending=False, obj_type='',
+ addendum='', *, removal=''):
+ if pending:
+ if removal:
+ raise ValueError(
+ "A pending deprecation cannot have a scheduled removal")
+ else:
+ removal = f"in {removal}" if removal else "two minor releases later"
+ if not message:
+ message = (
+ "\nThe %(name)s %(obj_type)s"
+ + (" will be deprecated in a future version"
+ if pending else
+ (" was deprecated in Matplotlib %(since)s"
+ + (" and will be removed %(removal)s"
+ if removal else
+ "")))
+ + "."
+ + (" Use %(alternative)s instead." if alternative else "")
+ + (" %(addendum)s" if addendum else ""))
+ warning_cls = (PendingDeprecationWarning if pending
+ else MatplotlibDeprecationWarning)
+ return warning_cls(message % dict(
+ func=name, name=name, obj_type=obj_type, since=since, removal=removal,
+ alternative=alternative, addendum=addendum))
+
+
+def warn_deprecated(
+ since, *, message='', name='', alternative='', pending=False,
+ obj_type='', addendum='', removal=''):
+ """
+ Display a standardized deprecation.
+
+ Parameters
+ ----------
+ since : str
+ The release at which this API became deprecated.
+
+ message : str, optional
+ Override the default deprecation message. The ``%(since)s``,
+ ``%(name)s``, ``%(alternative)s``, ``%(obj_type)s``, ``%(addendum)s``,
+ and ``%(removal)s`` format specifiers will be replaced by the values
+ of the respective arguments passed to this function.
+
+ name : str, optional
+ The name of the deprecated object.
+
+ alternative : str, optional
+ An alternative API that the user may use in place of the deprecated
+ API. The deprecation warning will tell the user about this alternative
+ if provided.
+
+ pending : bool, optional
+ If True, uses a PendingDeprecationWarning instead of a
+ DeprecationWarning. Cannot be used together with *removal*.
+
+ obj_type : str, optional
+ The object type being deprecated.
+
+ addendum : str, optional
+ Additional text appended directly to the final message.
+
+ removal : str, optional
+ The expected removal version. With the default (an empty string), a
+ removal version is automatically computed from *since*. Set to other
+ Falsy values to not schedule a removal date. Cannot be used together
+ with *pending*.
+
+ Examples
+ --------
+ Basic example::
+
+ # To warn of the deprecation of "matplotlib.name_of_module"
+ warn_deprecated('1.4.0', name='matplotlib.name_of_module',
+ obj_type='module')
+ """
+ warning = _generate_deprecation_warning(
+ since, message, name, alternative, pending, obj_type, addendum,
+ removal=removal)
+ from . import warn_external
+ warn_external(warning, category=MatplotlibDeprecationWarning)
+
+
+def deprecated(since, *, message='', name='', alternative='', pending=False,
+ obj_type=None, addendum='', removal=''):
+ """
+ Decorator to mark a function, a class, or a property as deprecated.
+
+ When deprecating a classmethod, a staticmethod, or a property, the
+ ``@deprecated`` decorator should go *under* ``@classmethod`` and
+ ``@staticmethod`` (i.e., `deprecated` should directly decorate the
+ underlying callable), but *over* ``@property``.
+
+ When deprecating a class ``C`` intended to be used as a base class in a
+ multiple inheritance hierarchy, ``C`` *must* define an ``__init__`` method
+ (if ``C`` instead inherited its ``__init__`` from its own base class, then
+ ``@deprecated`` would mess up ``__init__`` inheritance when installing its
+ own (deprecation-emitting) ``C.__init__``).
+
+ Parameters
+ ----------
+ since : str
+ The release at which this API became deprecated.
+
+ message : str, optional
+ Override the default deprecation message. The ``%(since)s``,
+ ``%(name)s``, ``%(alternative)s``, ``%(obj_type)s``, ``%(addendum)s``,
+ and ``%(removal)s`` format specifiers will be replaced by the values
+ of the respective arguments passed to this function.
+
+ name : str, optional
+ The name used in the deprecation message; if not provided, the name
+ is automatically determined from the deprecated object.
+
+ alternative : str, optional
+ An alternative API that the user may use in place of the deprecated
+ API. The deprecation warning will tell the user about this alternative
+ if provided.
+
+ pending : bool, optional
+ If True, uses a PendingDeprecationWarning instead of a
+ DeprecationWarning. Cannot be used together with *removal*.
+
+ obj_type : str, optional
+ The object type being deprecated; by default, 'class' if decorating
+ a class, 'attribute' if decorating a property, 'function' otherwise.
+
+ addendum : str, optional
+ Additional text appended directly to the final message.
+
+ removal : str, optional
+ The expected removal version. With the default (an empty string), a
+ removal version is automatically computed from *since*. Set to other
+ Falsy values to not schedule a removal date. Cannot be used together
+ with *pending*.
+
+ Examples
+ --------
+ Basic example::
+
+ @deprecated('1.4.0')
+ def the_function_to_deprecate():
+ pass
+ """
+
+ def deprecate(obj, message=message, name=name, alternative=alternative,
+ pending=pending, obj_type=obj_type, addendum=addendum):
+ from matplotlib._api import classproperty
+
+ if isinstance(obj, type):
+ if obj_type is None:
+ obj_type = "class"
+ func = obj.__init__
+ name = name or obj.__name__
+ old_doc = obj.__doc__
+
+ def finalize(wrapper, new_doc):
+ try:
+ obj.__doc__ = new_doc
+ except AttributeError: # Can't set on some extension objects.
+ pass
+ obj.__init__ = functools.wraps(obj.__init__)(wrapper)
+ return obj
+
+ elif isinstance(obj, (property, classproperty)):
+ obj_type = "attribute"
+ func = None
+ name = name or obj.fget.__name__
+ old_doc = obj.__doc__
+
+ class _deprecated_property(type(obj)):
+ def __get__(self, instance, owner):
+ if instance is not None or owner is not None \
+ and isinstance(self, classproperty):
+ emit_warning()
+ return super().__get__(instance, owner)
+
+ def __set__(self, instance, value):
+ if instance is not None:
+ emit_warning()
+ return super().__set__(instance, value)
+
+ def __delete__(self, instance):
+ if instance is not None:
+ emit_warning()
+ return super().__delete__(instance)
+
+ def __set_name__(self, owner, set_name):
+ nonlocal name
+ if name == "":
+ name = set_name
+
+ def finalize(_, new_doc):
+ return _deprecated_property(
+ fget=obj.fget, fset=obj.fset, fdel=obj.fdel, doc=new_doc)
+
+ else:
+ if obj_type is None:
+ obj_type = "function"
+ func = obj
+ name = name or obj.__name__
+ old_doc = func.__doc__
+
+ def finalize(wrapper, new_doc):
+ wrapper = functools.wraps(func)(wrapper)
+ wrapper.__doc__ = new_doc
+ return wrapper
+
+ def emit_warning():
+ warn_deprecated(
+ since, message=message, name=name, alternative=alternative,
+ pending=pending, obj_type=obj_type, addendum=addendum,
+ removal=removal)
+
+ def wrapper(*args, **kwargs):
+ emit_warning()
+ return func(*args, **kwargs)
+
+ old_doc = inspect.cleandoc(old_doc or '').strip('\n')
+
+ notes_header = '\nNotes\n-----'
+ new_doc = (f"[*Deprecated*] {old_doc}\n"
+ f"{notes_header if notes_header not in old_doc else ''}\n"
+ f".. deprecated:: {since}\n"
+ f" {message.strip()}")
+
+ if not old_doc:
+ # This is to prevent a spurious 'unexpected unindent' warning from
+ # docutils when the original docstring was blank.
+ new_doc += r'\ '
+
+ return finalize(wrapper, new_doc)
+
+ return deprecate
+
+
+class deprecate_privatize_attribute:
+ """
+ Helper to deprecate public access to an attribute.
+
+ This helper should only be used at class scope, as follows::
+
+ class Foo:
+ attr = _deprecate_privatize_attribute(*args, **kwargs)
+
+ where *all* parameters are forwarded to `deprecated`. This form makes
+ ``attr`` a property which forwards access to ``self._attr`` (same name but
+ with a leading underscore), with a deprecation warning. Note that the
+ attribute name is derived from *the name this helper is assigned to*.
+ """
+
+ def __init__(self, *args, **kwargs):
+ self.deprecator = deprecated(*args, **kwargs)
+
+ def __set_name__(self, owner, name):
+ setattr(owner, name, self.deprecator(
+ property(lambda self: getattr(self, f"_{name}")), name=name))
+
+
+def rename_parameter(since, old, new, func=None):
+ """
+ Decorator indicating that parameter *old* of *func* is renamed to *new*.
+
+ The actual implementation of *func* should use *new*, not *old*. If *old*
+ is passed to *func*, a DeprecationWarning is emitted, and its value is
+ used, even if *new* is also passed by keyword (this is to simplify pyplot
+ wrapper functions, which always pass *new* explicitly to the Axes method).
+ If *new* is also passed but positionally, a TypeError will be raised by the
+ underlying function during argument binding.
+
+ Examples
+ --------
+ ::
+
+ @_api.rename_parameter("3.1", "bad_name", "good_name")
+ def func(good_name): ...
+ """
+
+ if func is None:
+ return functools.partial(rename_parameter, since, old, new)
+
+ signature = inspect.signature(func)
+ assert old not in signature.parameters, (
+ f"Matplotlib internal error: {old!r} cannot be a parameter for "
+ f"{func.__name__}()")
+ assert new in signature.parameters, (
+ f"Matplotlib internal error: {new!r} must be a parameter for "
+ f"{func.__name__}()")
+
+ @functools.wraps(func)
+ def wrapper(*args, **kwargs):
+ if old in kwargs:
+ warn_deprecated(
+ since, message=f"The {old!r} parameter of {func.__name__}() "
+ f"has been renamed {new!r} since Matplotlib {since}; support "
+ f"for the old name will be dropped %(removal)s.")
+ kwargs[new] = kwargs.pop(old)
+ return func(*args, **kwargs)
+
+ # wrapper() must keep the same documented signature as func(): if we
+ # instead made both *old* and *new* appear in wrapper()'s signature, they
+ # would both show up in the pyplot function for an Axes method as well and
+ # pyplot would explicitly pass both arguments to the Axes method.
+
+ return wrapper
+
+
+class _deprecated_parameter_class:
+ def __repr__(self):
+ return ""
+
+
+_deprecated_parameter = _deprecated_parameter_class()
+
+
+def delete_parameter(since, name, func=None, **kwargs):
+ """
+ Decorator indicating that parameter *name* of *func* is being deprecated.
+
+ The actual implementation of *func* should keep the *name* parameter in its
+ signature, or accept a ``**kwargs`` argument (through which *name* would be
+ passed).
+
+ Parameters that come after the deprecated parameter effectively become
+ keyword-only (as they cannot be passed positionally without triggering the
+ DeprecationWarning on the deprecated parameter), and should be marked as
+ such after the deprecation period has passed and the deprecated parameter
+ is removed.
+
+ Parameters other than *since*, *name*, and *func* are keyword-only and
+ forwarded to `.warn_deprecated`.
+
+ Examples
+ --------
+ ::
+
+ @_api.delete_parameter("3.1", "unused")
+ def func(used_arg, other_arg, unused, more_args): ...
+ """
+
+ if func is None:
+ return functools.partial(delete_parameter, since, name, **kwargs)
+
+ signature = inspect.signature(func)
+ # Name of `**kwargs` parameter of the decorated function, typically
+ # "kwargs" if such a parameter exists, or None if the decorated function
+ # doesn't accept `**kwargs`.
+ kwargs_name = next((param.name for param in signature.parameters.values()
+ if param.kind == inspect.Parameter.VAR_KEYWORD), None)
+ if name in signature.parameters:
+ kind = signature.parameters[name].kind
+ is_varargs = kind is inspect.Parameter.VAR_POSITIONAL
+ is_varkwargs = kind is inspect.Parameter.VAR_KEYWORD
+ if not is_varargs and not is_varkwargs:
+ func.__signature__ = signature = signature.replace(parameters=[
+ param.replace(default=_deprecated_parameter)
+ if param.name == name else param
+ for param in signature.parameters.values()])
+ else:
+ is_varargs = is_varkwargs = False
+ assert kwargs_name, (
+ f"Matplotlib internal error: {name!r} must be a parameter for "
+ f"{func.__name__}()")
+
+ addendum = kwargs.pop('addendum', None)
+
+ @functools.wraps(func)
+ def wrapper(*inner_args, **inner_kwargs):
+ arguments = signature.bind(*inner_args, **inner_kwargs).arguments
+ if is_varargs and arguments.get(name):
+ warn_deprecated(
+ since, message=f"Additional positional arguments to "
+ f"{func.__name__}() are deprecated since %(since)s and "
+ f"support for them will be removed %(removal)s.")
+ elif is_varkwargs and arguments.get(name):
+ warn_deprecated(
+ since, message=f"Additional keyword arguments to "
+ f"{func.__name__}() are deprecated since %(since)s and "
+ f"support for them will be removed %(removal)s.")
+ # We cannot just check `name not in arguments` because the pyplot
+ # wrappers always pass all arguments explicitly.
+ elif any(name in d and d[name] != _deprecated_parameter
+ for d in [arguments, arguments.get(kwargs_name, {})]):
+ deprecation_addendum = (
+ f"If any parameter follows {name!r}, they should be passed as "
+ f"keyword, not positionally.")
+ warn_deprecated(
+ since,
+ name=repr(name),
+ obj_type=f"parameter of {func.__name__}()",
+ addendum=(addendum + " " + deprecation_addendum) if addendum
+ else deprecation_addendum,
+ **kwargs)
+ return func(*inner_args, **inner_kwargs)
+
+ return wrapper
+
+
+def make_keyword_only(since, name, func=None):
+ """
+ Decorator indicating that passing parameter *name* (or any of the following
+ ones) positionally to *func* is being deprecated.
+ """
+
+ if func is None:
+ return functools.partial(make_keyword_only, since, name)
+
+ signature = inspect.signature(func)
+ POK = inspect.Parameter.POSITIONAL_OR_KEYWORD
+ KWO = inspect.Parameter.KEYWORD_ONLY
+ assert (name in signature.parameters
+ and signature.parameters[name].kind == POK), (
+ f"Matplotlib internal error: {name!r} must be a positional-or-keyword "
+ f"parameter for {func.__name__}()")
+ names = [*signature.parameters]
+ kwonly = [name for name in names[names.index(name):]
+ if signature.parameters[name].kind == POK]
+ func.__signature__ = signature.replace(parameters=[
+ param.replace(kind=KWO) if param.name in kwonly else param
+ for param in signature.parameters.values()])
+
+ @functools.wraps(func)
+ def wrapper(*args, **kwargs):
+ # Don't use signature.bind here, as it would fail when stacked with
+ # rename_parameter and an "old" argument name is passed in
+ # (signature.bind would fail, but the actual call would succeed).
+ idx = [*func.__signature__.parameters].index(name)
+ if len(args) > idx:
+ warn_deprecated(
+ since, message="Passing the %(name)s %(obj_type)s "
+ "positionally is deprecated since Matplotlib %(since)s; the "
+ "parameter will become keyword-only %(removal)s.",
+ name=name, obj_type=f"parameter of {func.__name__}()")
+ return func(*args, **kwargs)
+
+ return wrapper
+
+
+def deprecate_method_override(method, obj, *, allow_empty=False, **kwargs):
+ """
+ Return ``obj.method`` with a deprecation if it was overridden, else None.
+
+ Parameters
+ ----------
+ method
+ An unbound method, i.e. an expression of the form
+ ``Class.method_name``. Remember that within the body of a method, one
+ can always use ``__class__`` to refer to the class that is currently
+ being defined.
+ obj
+ Either an object of the class where *method* is defined, or a subclass
+ of that class.
+ allow_empty : bool, default: False
+ Whether to allow overrides by "empty" methods without emitting a
+ warning.
+ **kwargs
+ Additional parameters passed to `warn_deprecated` to generate the
+ deprecation warning; must at least include the "since" key.
+ """
+
+ def empty(): pass
+ def empty_with_docstring(): """doc"""
+
+ name = method.__name__
+ bound_child = getattr(obj, name)
+ bound_base = (
+ method # If obj is a class, then we need to use unbound methods.
+ if isinstance(bound_child, type(empty)) and isinstance(obj, type)
+ else method.__get__(obj))
+ if (bound_child != bound_base
+ and (not allow_empty
+ or (getattr(getattr(bound_child, "__code__", None),
+ "co_code", None)
+ not in [empty.__code__.co_code,
+ empty_with_docstring.__code__.co_code]))):
+ warn_deprecated(**{"name": name, "obj_type": "method", **kwargs})
+ return bound_child
+ return None
+
+
+@contextlib.contextmanager
+def suppress_matplotlib_deprecation_warning():
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
+ yield
diff --git a/venv/Lib/site-packages/matplotlib/_c_internal_utils.cp38-win_amd64.pyd b/venv/Lib/site-packages/matplotlib/_c_internal_utils.cp38-win_amd64.pyd
new file mode 100644
index 0000000..1b0da48
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/_c_internal_utils.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/matplotlib/_cm.py b/venv/Lib/site-packages/matplotlib/_cm.py
new file mode 100644
index 0000000..84b2fd3
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_cm.py
@@ -0,0 +1,1434 @@
+"""
+Nothing here but dictionaries for generating LinearSegmentedColormaps,
+and a dictionary of these dictionaries.
+
+Documentation for each is in pyplot.colormaps(). Please update this
+with the purpose and type of your colormap if you add data for one here.
+"""
+
+from functools import partial
+
+import numpy as np
+
+_binary_data = {
+ 'red': ((0., 1., 1.), (1., 0., 0.)),
+ 'green': ((0., 1., 1.), (1., 0., 0.)),
+ 'blue': ((0., 1., 1.), (1., 0., 0.))
+ }
+
+_autumn_data = {'red': ((0., 1.0, 1.0), (1.0, 1.0, 1.0)),
+ 'green': ((0., 0., 0.), (1.0, 1.0, 1.0)),
+ 'blue': ((0., 0., 0.), (1.0, 0., 0.))}
+
+_bone_data = {'red': ((0., 0., 0.),
+ (0.746032, 0.652778, 0.652778),
+ (1.0, 1.0, 1.0)),
+ 'green': ((0., 0., 0.),
+ (0.365079, 0.319444, 0.319444),
+ (0.746032, 0.777778, 0.777778),
+ (1.0, 1.0, 1.0)),
+ 'blue': ((0., 0., 0.),
+ (0.365079, 0.444444, 0.444444),
+ (1.0, 1.0, 1.0))}
+
+_cool_data = {'red': ((0., 0., 0.), (1.0, 1.0, 1.0)),
+ 'green': ((0., 1., 1.), (1.0, 0., 0.)),
+ 'blue': ((0., 1., 1.), (1.0, 1., 1.))}
+
+_copper_data = {'red': ((0., 0., 0.),
+ (0.809524, 1.000000, 1.000000),
+ (1.0, 1.0, 1.0)),
+ 'green': ((0., 0., 0.),
+ (1.0, 0.7812, 0.7812)),
+ 'blue': ((0., 0., 0.),
+ (1.0, 0.4975, 0.4975))}
+
+def _flag_red(x): return 0.75 * np.sin((x * 31.5 + 0.25) * np.pi) + 0.5
+def _flag_green(x): return np.sin(x * 31.5 * np.pi)
+def _flag_blue(x): return 0.75 * np.sin((x * 31.5 - 0.25) * np.pi) + 0.5
+_flag_data = {'red': _flag_red, 'green': _flag_green, 'blue': _flag_blue}
+
+def _prism_red(x): return 0.75 * np.sin((x * 20.9 + 0.25) * np.pi) + 0.67
+def _prism_green(x): return 0.75 * np.sin((x * 20.9 - 0.25) * np.pi) + 0.33
+def _prism_blue(x): return -1.1 * np.sin((x * 20.9) * np.pi)
+_prism_data = {'red': _prism_red, 'green': _prism_green, 'blue': _prism_blue}
+
+def _ch_helper(gamma, s, r, h, p0, p1, x):
+ """Helper function for generating picklable cubehelix colormaps."""
+ # Apply gamma factor to emphasise low or high intensity values
+ xg = x ** gamma
+ # Calculate amplitude and angle of deviation from the black to white
+ # diagonal in the plane of constant perceived intensity.
+ a = h * xg * (1 - xg) / 2
+ phi = 2 * np.pi * (s / 3 + r * x)
+ return xg + a * (p0 * np.cos(phi) + p1 * np.sin(phi))
+
+def cubehelix(gamma=1.0, s=0.5, r=-1.5, h=1.0):
+ """
+ Return custom data dictionary of (r, g, b) conversion functions, which can
+ be used with :func:`register_cmap`, for the cubehelix color scheme.
+
+ Unlike most other color schemes cubehelix was designed by D.A. Green to
+ be monotonically increasing in terms of perceived brightness.
+ Also, when printed on a black and white postscript printer, the scheme
+ results in a greyscale with monotonically increasing brightness.
+ This color scheme is named cubehelix because the (r, g, b) values produced
+ can be visualised as a squashed helix around the diagonal in the
+ (r, g, b) color cube.
+
+ For a unit color cube (i.e. 3D coordinates for (r, g, b) each in the
+ range 0 to 1) the color scheme starts at (r, g, b) = (0, 0, 0), i.e. black,
+ and finishes at (r, g, b) = (1, 1, 1), i.e. white. For some fraction *x*,
+ between 0 and 1, the color is the corresponding grey value at that
+ fraction along the black to white diagonal (x, x, x) plus a color
+ element. This color element is calculated in a plane of constant
+ perceived intensity and controlled by the following parameters.
+
+ Parameters
+ ----------
+ gamma : float, default: 1
+ Gamma factor emphasizing either low intensity values (gamma < 1), or
+ high intensity values (gamma > 1).
+ s : float, default: 0.5 (purple)
+ The starting color.
+ r : float, default: -1.5
+ The number of r, g, b rotations in color that are made from the start
+ to the end of the color scheme. The default of -1.5 corresponds to ->
+ B -> G -> R -> B.
+ h : float, default: 1
+ The hue, i.e. how saturated the colors are. If this parameter is zero
+ then the color scheme is purely a greyscale.
+ """
+ return {'red': partial(_ch_helper, gamma, s, r, h, -0.14861, 1.78277),
+ 'green': partial(_ch_helper, gamma, s, r, h, -0.29227, -0.90649),
+ 'blue': partial(_ch_helper, gamma, s, r, h, 1.97294, 0.0)}
+
+_cubehelix_data = cubehelix()
+
+_bwr_data = ((0.0, 0.0, 1.0), (1.0, 1.0, 1.0), (1.0, 0.0, 0.0))
+_brg_data = ((0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0))
+
+# Gnuplot palette functions
+def _g0(x): return 0
+def _g1(x): return 0.5
+def _g2(x): return 1
+def _g3(x): return x
+def _g4(x): return x ** 2
+def _g5(x): return x ** 3
+def _g6(x): return x ** 4
+def _g7(x): return np.sqrt(x)
+def _g8(x): return np.sqrt(np.sqrt(x))
+def _g9(x): return np.sin(x * np.pi / 2)
+def _g10(x): return np.cos(x * np.pi / 2)
+def _g11(x): return np.abs(x - 0.5)
+def _g12(x): return (2 * x - 1) ** 2
+def _g13(x): return np.sin(x * np.pi)
+def _g14(x): return np.abs(np.cos(x * np.pi))
+def _g15(x): return np.sin(x * 2 * np.pi)
+def _g16(x): return np.cos(x * 2 * np.pi)
+def _g17(x): return np.abs(np.sin(x * 2 * np.pi))
+def _g18(x): return np.abs(np.cos(x * 2 * np.pi))
+def _g19(x): return np.abs(np.sin(x * 4 * np.pi))
+def _g20(x): return np.abs(np.cos(x * 4 * np.pi))
+def _g21(x): return 3 * x
+def _g22(x): return 3 * x - 1
+def _g23(x): return 3 * x - 2
+def _g24(x): return np.abs(3 * x - 1)
+def _g25(x): return np.abs(3 * x - 2)
+def _g26(x): return (3 * x - 1) / 2
+def _g27(x): return (3 * x - 2) / 2
+def _g28(x): return np.abs((3 * x - 1) / 2)
+def _g29(x): return np.abs((3 * x - 2) / 2)
+def _g30(x): return x / 0.32 - 0.78125
+def _g31(x): return 2 * x - 0.84
+def _g32(x):
+ ret = np.zeros(len(x))
+ m = (x < 0.25)
+ ret[m] = 4 * x[m]
+ m = (x >= 0.25) & (x < 0.92)
+ ret[m] = -2 * x[m] + 1.84
+ m = (x >= 0.92)
+ ret[m] = x[m] / 0.08 - 11.5
+ return ret
+def _g33(x): return np.abs(2 * x - 0.5)
+def _g34(x): return 2 * x
+def _g35(x): return 2 * x - 0.5
+def _g36(x): return 2 * x - 1
+
+gfunc = {i: globals()["_g{}".format(i)] for i in range(37)}
+
+_gnuplot_data = {
+ 'red': gfunc[7],
+ 'green': gfunc[5],
+ 'blue': gfunc[15],
+}
+
+_gnuplot2_data = {
+ 'red': gfunc[30],
+ 'green': gfunc[31],
+ 'blue': gfunc[32],
+}
+
+_ocean_data = {
+ 'red': gfunc[23],
+ 'green': gfunc[28],
+ 'blue': gfunc[3],
+}
+
+_afmhot_data = {
+ 'red': gfunc[34],
+ 'green': gfunc[35],
+ 'blue': gfunc[36],
+}
+
+_rainbow_data = {
+ 'red': gfunc[33],
+ 'green': gfunc[13],
+ 'blue': gfunc[10],
+}
+
+_seismic_data = (
+ (0.0, 0.0, 0.3), (0.0, 0.0, 1.0),
+ (1.0, 1.0, 1.0), (1.0, 0.0, 0.0),
+ (0.5, 0.0, 0.0))
+
+_terrain_data = (
+ (0.00, (0.2, 0.2, 0.6)),
+ (0.15, (0.0, 0.6, 1.0)),
+ (0.25, (0.0, 0.8, 0.4)),
+ (0.50, (1.0, 1.0, 0.6)),
+ (0.75, (0.5, 0.36, 0.33)),
+ (1.00, (1.0, 1.0, 1.0)))
+
+_gray_data = {'red': ((0., 0, 0), (1., 1, 1)),
+ 'green': ((0., 0, 0), (1., 1, 1)),
+ 'blue': ((0., 0, 0), (1., 1, 1))}
+
+_hot_data = {'red': ((0., 0.0416, 0.0416),
+ (0.365079, 1.000000, 1.000000),
+ (1.0, 1.0, 1.0)),
+ 'green': ((0., 0., 0.),
+ (0.365079, 0.000000, 0.000000),
+ (0.746032, 1.000000, 1.000000),
+ (1.0, 1.0, 1.0)),
+ 'blue': ((0., 0., 0.),
+ (0.746032, 0.000000, 0.000000),
+ (1.0, 1.0, 1.0))}
+
+_hsv_data = {'red': ((0., 1., 1.),
+ (0.158730, 1.000000, 1.000000),
+ (0.174603, 0.968750, 0.968750),
+ (0.333333, 0.031250, 0.031250),
+ (0.349206, 0.000000, 0.000000),
+ (0.666667, 0.000000, 0.000000),
+ (0.682540, 0.031250, 0.031250),
+ (0.841270, 0.968750, 0.968750),
+ (0.857143, 1.000000, 1.000000),
+ (1.0, 1.0, 1.0)),
+ 'green': ((0., 0., 0.),
+ (0.158730, 0.937500, 0.937500),
+ (0.174603, 1.000000, 1.000000),
+ (0.507937, 1.000000, 1.000000),
+ (0.666667, 0.062500, 0.062500),
+ (0.682540, 0.000000, 0.000000),
+ (1.0, 0., 0.)),
+ 'blue': ((0., 0., 0.),
+ (0.333333, 0.000000, 0.000000),
+ (0.349206, 0.062500, 0.062500),
+ (0.507937, 1.000000, 1.000000),
+ (0.841270, 1.000000, 1.000000),
+ (0.857143, 0.937500, 0.937500),
+ (1.0, 0.09375, 0.09375))}
+
+_jet_data = {'red': ((0.00, 0, 0),
+ (0.35, 0, 0),
+ (0.66, 1, 1),
+ (0.89, 1, 1),
+ (1.00, 0.5, 0.5)),
+ 'green': ((0.000, 0, 0),
+ (0.125, 0, 0),
+ (0.375, 1, 1),
+ (0.640, 1, 1),
+ (0.910, 0, 0),
+ (1.000, 0, 0)),
+ 'blue': ((0.00, 0.5, 0.5),
+ (0.11, 1, 1),
+ (0.34, 1, 1),
+ (0.65, 0, 0),
+ (1.00, 0, 0))}
+
+_pink_data = {'red': ((0., 0.1178, 0.1178), (0.015873, 0.195857, 0.195857),
+ (0.031746, 0.250661, 0.250661),
+ (0.047619, 0.295468, 0.295468),
+ (0.063492, 0.334324, 0.334324),
+ (0.079365, 0.369112, 0.369112),
+ (0.095238, 0.400892, 0.400892),
+ (0.111111, 0.430331, 0.430331),
+ (0.126984, 0.457882, 0.457882),
+ (0.142857, 0.483867, 0.483867),
+ (0.158730, 0.508525, 0.508525),
+ (0.174603, 0.532042, 0.532042),
+ (0.190476, 0.554563, 0.554563),
+ (0.206349, 0.576204, 0.576204),
+ (0.222222, 0.597061, 0.597061),
+ (0.238095, 0.617213, 0.617213),
+ (0.253968, 0.636729, 0.636729),
+ (0.269841, 0.655663, 0.655663),
+ (0.285714, 0.674066, 0.674066),
+ (0.301587, 0.691980, 0.691980),
+ (0.317460, 0.709441, 0.709441),
+ (0.333333, 0.726483, 0.726483),
+ (0.349206, 0.743134, 0.743134),
+ (0.365079, 0.759421, 0.759421),
+ (0.380952, 0.766356, 0.766356),
+ (0.396825, 0.773229, 0.773229),
+ (0.412698, 0.780042, 0.780042),
+ (0.428571, 0.786796, 0.786796),
+ (0.444444, 0.793492, 0.793492),
+ (0.460317, 0.800132, 0.800132),
+ (0.476190, 0.806718, 0.806718),
+ (0.492063, 0.813250, 0.813250),
+ (0.507937, 0.819730, 0.819730),
+ (0.523810, 0.826160, 0.826160),
+ (0.539683, 0.832539, 0.832539),
+ (0.555556, 0.838870, 0.838870),
+ (0.571429, 0.845154, 0.845154),
+ (0.587302, 0.851392, 0.851392),
+ (0.603175, 0.857584, 0.857584),
+ (0.619048, 0.863731, 0.863731),
+ (0.634921, 0.869835, 0.869835),
+ (0.650794, 0.875897, 0.875897),
+ (0.666667, 0.881917, 0.881917),
+ (0.682540, 0.887896, 0.887896),
+ (0.698413, 0.893835, 0.893835),
+ (0.714286, 0.899735, 0.899735),
+ (0.730159, 0.905597, 0.905597),
+ (0.746032, 0.911421, 0.911421),
+ (0.761905, 0.917208, 0.917208),
+ (0.777778, 0.922958, 0.922958),
+ (0.793651, 0.928673, 0.928673),
+ (0.809524, 0.934353, 0.934353),
+ (0.825397, 0.939999, 0.939999),
+ (0.841270, 0.945611, 0.945611),
+ (0.857143, 0.951190, 0.951190),
+ (0.873016, 0.956736, 0.956736),
+ (0.888889, 0.962250, 0.962250),
+ (0.904762, 0.967733, 0.967733),
+ (0.920635, 0.973185, 0.973185),
+ (0.936508, 0.978607, 0.978607),
+ (0.952381, 0.983999, 0.983999),
+ (0.968254, 0.989361, 0.989361),
+ (0.984127, 0.994695, 0.994695), (1.0, 1.0, 1.0)),
+ 'green': ((0., 0., 0.), (0.015873, 0.102869, 0.102869),
+ (0.031746, 0.145479, 0.145479),
+ (0.047619, 0.178174, 0.178174),
+ (0.063492, 0.205738, 0.205738),
+ (0.079365, 0.230022, 0.230022),
+ (0.095238, 0.251976, 0.251976),
+ (0.111111, 0.272166, 0.272166),
+ (0.126984, 0.290957, 0.290957),
+ (0.142857, 0.308607, 0.308607),
+ (0.158730, 0.325300, 0.325300),
+ (0.174603, 0.341178, 0.341178),
+ (0.190476, 0.356348, 0.356348),
+ (0.206349, 0.370899, 0.370899),
+ (0.222222, 0.384900, 0.384900),
+ (0.238095, 0.398410, 0.398410),
+ (0.253968, 0.411476, 0.411476),
+ (0.269841, 0.424139, 0.424139),
+ (0.285714, 0.436436, 0.436436),
+ (0.301587, 0.448395, 0.448395),
+ (0.317460, 0.460044, 0.460044),
+ (0.333333, 0.471405, 0.471405),
+ (0.349206, 0.482498, 0.482498),
+ (0.365079, 0.493342, 0.493342),
+ (0.380952, 0.517549, 0.517549),
+ (0.396825, 0.540674, 0.540674),
+ (0.412698, 0.562849, 0.562849),
+ (0.428571, 0.584183, 0.584183),
+ (0.444444, 0.604765, 0.604765),
+ (0.460317, 0.624669, 0.624669),
+ (0.476190, 0.643958, 0.643958),
+ (0.492063, 0.662687, 0.662687),
+ (0.507937, 0.680900, 0.680900),
+ (0.523810, 0.698638, 0.698638),
+ (0.539683, 0.715937, 0.715937),
+ (0.555556, 0.732828, 0.732828),
+ (0.571429, 0.749338, 0.749338),
+ (0.587302, 0.765493, 0.765493),
+ (0.603175, 0.781313, 0.781313),
+ (0.619048, 0.796819, 0.796819),
+ (0.634921, 0.812029, 0.812029),
+ (0.650794, 0.826960, 0.826960),
+ (0.666667, 0.841625, 0.841625),
+ (0.682540, 0.856040, 0.856040),
+ (0.698413, 0.870216, 0.870216),
+ (0.714286, 0.884164, 0.884164),
+ (0.730159, 0.897896, 0.897896),
+ (0.746032, 0.911421, 0.911421),
+ (0.761905, 0.917208, 0.917208),
+ (0.777778, 0.922958, 0.922958),
+ (0.793651, 0.928673, 0.928673),
+ (0.809524, 0.934353, 0.934353),
+ (0.825397, 0.939999, 0.939999),
+ (0.841270, 0.945611, 0.945611),
+ (0.857143, 0.951190, 0.951190),
+ (0.873016, 0.956736, 0.956736),
+ (0.888889, 0.962250, 0.962250),
+ (0.904762, 0.967733, 0.967733),
+ (0.920635, 0.973185, 0.973185),
+ (0.936508, 0.978607, 0.978607),
+ (0.952381, 0.983999, 0.983999),
+ (0.968254, 0.989361, 0.989361),
+ (0.984127, 0.994695, 0.994695), (1.0, 1.0, 1.0)),
+ 'blue': ((0., 0., 0.), (0.015873, 0.102869, 0.102869),
+ (0.031746, 0.145479, 0.145479),
+ (0.047619, 0.178174, 0.178174),
+ (0.063492, 0.205738, 0.205738),
+ (0.079365, 0.230022, 0.230022),
+ (0.095238, 0.251976, 0.251976),
+ (0.111111, 0.272166, 0.272166),
+ (0.126984, 0.290957, 0.290957),
+ (0.142857, 0.308607, 0.308607),
+ (0.158730, 0.325300, 0.325300),
+ (0.174603, 0.341178, 0.341178),
+ (0.190476, 0.356348, 0.356348),
+ (0.206349, 0.370899, 0.370899),
+ (0.222222, 0.384900, 0.384900),
+ (0.238095, 0.398410, 0.398410),
+ (0.253968, 0.411476, 0.411476),
+ (0.269841, 0.424139, 0.424139),
+ (0.285714, 0.436436, 0.436436),
+ (0.301587, 0.448395, 0.448395),
+ (0.317460, 0.460044, 0.460044),
+ (0.333333, 0.471405, 0.471405),
+ (0.349206, 0.482498, 0.482498),
+ (0.365079, 0.493342, 0.493342),
+ (0.380952, 0.503953, 0.503953),
+ (0.396825, 0.514344, 0.514344),
+ (0.412698, 0.524531, 0.524531),
+ (0.428571, 0.534522, 0.534522),
+ (0.444444, 0.544331, 0.544331),
+ (0.460317, 0.553966, 0.553966),
+ (0.476190, 0.563436, 0.563436),
+ (0.492063, 0.572750, 0.572750),
+ (0.507937, 0.581914, 0.581914),
+ (0.523810, 0.590937, 0.590937),
+ (0.539683, 0.599824, 0.599824),
+ (0.555556, 0.608581, 0.608581),
+ (0.571429, 0.617213, 0.617213),
+ (0.587302, 0.625727, 0.625727),
+ (0.603175, 0.634126, 0.634126),
+ (0.619048, 0.642416, 0.642416),
+ (0.634921, 0.650600, 0.650600),
+ (0.650794, 0.658682, 0.658682),
+ (0.666667, 0.666667, 0.666667),
+ (0.682540, 0.674556, 0.674556),
+ (0.698413, 0.682355, 0.682355),
+ (0.714286, 0.690066, 0.690066),
+ (0.730159, 0.697691, 0.697691),
+ (0.746032, 0.705234, 0.705234),
+ (0.761905, 0.727166, 0.727166),
+ (0.777778, 0.748455, 0.748455),
+ (0.793651, 0.769156, 0.769156),
+ (0.809524, 0.789314, 0.789314),
+ (0.825397, 0.808969, 0.808969),
+ (0.841270, 0.828159, 0.828159),
+ (0.857143, 0.846913, 0.846913),
+ (0.873016, 0.865261, 0.865261),
+ (0.888889, 0.883229, 0.883229),
+ (0.904762, 0.900837, 0.900837),
+ (0.920635, 0.918109, 0.918109),
+ (0.936508, 0.935061, 0.935061),
+ (0.952381, 0.951711, 0.951711),
+ (0.968254, 0.968075, 0.968075),
+ (0.984127, 0.984167, 0.984167), (1.0, 1.0, 1.0))}
+
+_spring_data = {'red': ((0., 1., 1.), (1.0, 1.0, 1.0)),
+ 'green': ((0., 0., 0.), (1.0, 1.0, 1.0)),
+ 'blue': ((0., 1., 1.), (1.0, 0.0, 0.0))}
+
+
+_summer_data = {'red': ((0., 0., 0.), (1.0, 1.0, 1.0)),
+ 'green': ((0., 0.5, 0.5), (1.0, 1.0, 1.0)),
+ 'blue': ((0., 0.4, 0.4), (1.0, 0.4, 0.4))}
+
+
+_winter_data = {'red': ((0., 0., 0.), (1.0, 0.0, 0.0)),
+ 'green': ((0., 0., 0.), (1.0, 1.0, 1.0)),
+ 'blue': ((0., 1., 1.), (1.0, 0.5, 0.5))}
+
+_nipy_spectral_data = {
+ 'red': [(0.0, 0.0, 0.0), (0.05, 0.4667, 0.4667),
+ (0.10, 0.5333, 0.5333), (0.15, 0.0, 0.0),
+ (0.20, 0.0, 0.0), (0.25, 0.0, 0.0),
+ (0.30, 0.0, 0.0), (0.35, 0.0, 0.0),
+ (0.40, 0.0, 0.0), (0.45, 0.0, 0.0),
+ (0.50, 0.0, 0.0), (0.55, 0.0, 0.0),
+ (0.60, 0.0, 0.0), (0.65, 0.7333, 0.7333),
+ (0.70, 0.9333, 0.9333), (0.75, 1.0, 1.0),
+ (0.80, 1.0, 1.0), (0.85, 1.0, 1.0),
+ (0.90, 0.8667, 0.8667), (0.95, 0.80, 0.80),
+ (1.0, 0.80, 0.80)],
+ 'green': [(0.0, 0.0, 0.0), (0.05, 0.0, 0.0),
+ (0.10, 0.0, 0.0), (0.15, 0.0, 0.0),
+ (0.20, 0.0, 0.0), (0.25, 0.4667, 0.4667),
+ (0.30, 0.6000, 0.6000), (0.35, 0.6667, 0.6667),
+ (0.40, 0.6667, 0.6667), (0.45, 0.6000, 0.6000),
+ (0.50, 0.7333, 0.7333), (0.55, 0.8667, 0.8667),
+ (0.60, 1.0, 1.0), (0.65, 1.0, 1.0),
+ (0.70, 0.9333, 0.9333), (0.75, 0.8000, 0.8000),
+ (0.80, 0.6000, 0.6000), (0.85, 0.0, 0.0),
+ (0.90, 0.0, 0.0), (0.95, 0.0, 0.0),
+ (1.0, 0.80, 0.80)],
+ 'blue': [(0.0, 0.0, 0.0), (0.05, 0.5333, 0.5333),
+ (0.10, 0.6000, 0.6000), (0.15, 0.6667, 0.6667),
+ (0.20, 0.8667, 0.8667), (0.25, 0.8667, 0.8667),
+ (0.30, 0.8667, 0.8667), (0.35, 0.6667, 0.6667),
+ (0.40, 0.5333, 0.5333), (0.45, 0.0, 0.0),
+ (0.5, 0.0, 0.0), (0.55, 0.0, 0.0),
+ (0.60, 0.0, 0.0), (0.65, 0.0, 0.0),
+ (0.70, 0.0, 0.0), (0.75, 0.0, 0.0),
+ (0.80, 0.0, 0.0), (0.85, 0.0, 0.0),
+ (0.90, 0.0, 0.0), (0.95, 0.0, 0.0),
+ (1.0, 0.80, 0.80)],
+}
+
+
+# 34 colormaps based on color specifications and designs
+# developed by Cynthia Brewer (http://colorbrewer.org).
+# The ColorBrewer palettes have been included under the terms
+# of an Apache-stype license (for details, see the file
+# LICENSE_COLORBREWER in the license directory of the matplotlib
+# source distribution).
+
+# RGB values taken from Brewer's Excel sheet, divided by 255
+
+_Blues_data = (
+ (0.96862745098039216, 0.98431372549019602, 1.0 ),
+ (0.87058823529411766, 0.92156862745098034, 0.96862745098039216),
+ (0.77647058823529413, 0.85882352941176465, 0.93725490196078431),
+ (0.61960784313725492, 0.792156862745098 , 0.88235294117647056),
+ (0.41960784313725491, 0.68235294117647061, 0.83921568627450982),
+ (0.25882352941176473, 0.5725490196078431 , 0.77647058823529413),
+ (0.12941176470588237, 0.44313725490196076, 0.70980392156862748),
+ (0.03137254901960784, 0.31764705882352939, 0.61176470588235299),
+ (0.03137254901960784, 0.18823529411764706, 0.41960784313725491)
+ )
+
+_BrBG_data = (
+ (0.32941176470588235, 0.18823529411764706, 0.0196078431372549 ),
+ (0.5490196078431373 , 0.31764705882352939, 0.0392156862745098 ),
+ (0.74901960784313726, 0.50588235294117645, 0.17647058823529413),
+ (0.87450980392156863, 0.76078431372549016, 0.49019607843137253),
+ (0.96470588235294119, 0.90980392156862744, 0.76470588235294112),
+ (0.96078431372549022, 0.96078431372549022, 0.96078431372549022),
+ (0.7803921568627451 , 0.91764705882352937, 0.89803921568627454),
+ (0.50196078431372548, 0.80392156862745101, 0.75686274509803919),
+ (0.20784313725490197, 0.59215686274509804, 0.5607843137254902 ),
+ (0.00392156862745098, 0.4 , 0.36862745098039218),
+ (0.0 , 0.23529411764705882, 0.18823529411764706)
+ )
+
+_BuGn_data = (
+ (0.96862745098039216, 0.9882352941176471 , 0.99215686274509807),
+ (0.89803921568627454, 0.96078431372549022, 0.97647058823529409),
+ (0.8 , 0.92549019607843142, 0.90196078431372551),
+ (0.6 , 0.84705882352941175, 0.78823529411764703),
+ (0.4 , 0.76078431372549016, 0.64313725490196083),
+ (0.25490196078431371, 0.68235294117647061, 0.46274509803921571),
+ (0.13725490196078433, 0.54509803921568623, 0.27058823529411763),
+ (0.0 , 0.42745098039215684, 0.17254901960784313),
+ (0.0 , 0.26666666666666666, 0.10588235294117647)
+ )
+
+_BuPu_data = (
+ (0.96862745098039216, 0.9882352941176471 , 0.99215686274509807),
+ (0.8784313725490196 , 0.92549019607843142, 0.95686274509803926),
+ (0.74901960784313726, 0.82745098039215681, 0.90196078431372551),
+ (0.61960784313725492, 0.73725490196078436, 0.85490196078431369),
+ (0.5490196078431373 , 0.58823529411764708, 0.77647058823529413),
+ (0.5490196078431373 , 0.41960784313725491, 0.69411764705882351),
+ (0.53333333333333333, 0.25490196078431371, 0.61568627450980395),
+ (0.50588235294117645, 0.05882352941176471, 0.48627450980392156),
+ (0.30196078431372547, 0.0 , 0.29411764705882354)
+ )
+
+_GnBu_data = (
+ (0.96862745098039216, 0.9882352941176471 , 0.94117647058823528),
+ (0.8784313725490196 , 0.95294117647058818, 0.85882352941176465),
+ (0.8 , 0.92156862745098034, 0.77254901960784317),
+ (0.6588235294117647 , 0.8666666666666667 , 0.70980392156862748),
+ (0.4823529411764706 , 0.8 , 0.7686274509803922 ),
+ (0.30588235294117649, 0.70196078431372544, 0.82745098039215681),
+ (0.16862745098039217, 0.5490196078431373 , 0.74509803921568629),
+ (0.03137254901960784, 0.40784313725490196, 0.67450980392156867),
+ (0.03137254901960784, 0.25098039215686274, 0.50588235294117645)
+ )
+
+_Greens_data = (
+ (0.96862745098039216, 0.9882352941176471 , 0.96078431372549022),
+ (0.89803921568627454, 0.96078431372549022, 0.8784313725490196 ),
+ (0.7803921568627451 , 0.9137254901960784 , 0.75294117647058822),
+ (0.63137254901960782, 0.85098039215686272, 0.60784313725490191),
+ (0.45490196078431372, 0.7686274509803922 , 0.46274509803921571),
+ (0.25490196078431371, 0.6705882352941176 , 0.36470588235294116),
+ (0.13725490196078433, 0.54509803921568623, 0.27058823529411763),
+ (0.0 , 0.42745098039215684, 0.17254901960784313),
+ (0.0 , 0.26666666666666666, 0.10588235294117647)
+ )
+
+_Greys_data = (
+ (1.0 , 1.0 , 1.0 ),
+ (0.94117647058823528, 0.94117647058823528, 0.94117647058823528),
+ (0.85098039215686272, 0.85098039215686272, 0.85098039215686272),
+ (0.74117647058823533, 0.74117647058823533, 0.74117647058823533),
+ (0.58823529411764708, 0.58823529411764708, 0.58823529411764708),
+ (0.45098039215686275, 0.45098039215686275, 0.45098039215686275),
+ (0.32156862745098042, 0.32156862745098042, 0.32156862745098042),
+ (0.14509803921568629, 0.14509803921568629, 0.14509803921568629),
+ (0.0 , 0.0 , 0.0 )
+ )
+
+_Oranges_data = (
+ (1.0 , 0.96078431372549022, 0.92156862745098034),
+ (0.99607843137254903, 0.90196078431372551, 0.80784313725490198),
+ (0.99215686274509807, 0.81568627450980391, 0.63529411764705879),
+ (0.99215686274509807, 0.68235294117647061, 0.41960784313725491),
+ (0.99215686274509807, 0.55294117647058827, 0.23529411764705882),
+ (0.94509803921568625, 0.41176470588235292, 0.07450980392156863),
+ (0.85098039215686272, 0.28235294117647058, 0.00392156862745098),
+ (0.65098039215686276, 0.21176470588235294, 0.01176470588235294),
+ (0.49803921568627452, 0.15294117647058825, 0.01568627450980392)
+ )
+
+_OrRd_data = (
+ (1.0 , 0.96862745098039216, 0.92549019607843142),
+ (0.99607843137254903, 0.90980392156862744, 0.78431372549019607),
+ (0.99215686274509807, 0.83137254901960789, 0.61960784313725492),
+ (0.99215686274509807, 0.73333333333333328, 0.51764705882352946),
+ (0.9882352941176471 , 0.55294117647058827, 0.34901960784313724),
+ (0.93725490196078431, 0.396078431372549 , 0.28235294117647058),
+ (0.84313725490196079, 0.18823529411764706, 0.12156862745098039),
+ (0.70196078431372544, 0.0 , 0.0 ),
+ (0.49803921568627452, 0.0 , 0.0 )
+ )
+
+_PiYG_data = (
+ (0.55686274509803924, 0.00392156862745098, 0.32156862745098042),
+ (0.77254901960784317, 0.10588235294117647, 0.49019607843137253),
+ (0.87058823529411766, 0.46666666666666667, 0.68235294117647061),
+ (0.94509803921568625, 0.71372549019607845, 0.85490196078431369),
+ (0.99215686274509807, 0.8784313725490196 , 0.93725490196078431),
+ (0.96862745098039216, 0.96862745098039216, 0.96862745098039216),
+ (0.90196078431372551, 0.96078431372549022, 0.81568627450980391),
+ (0.72156862745098038, 0.88235294117647056, 0.52549019607843139),
+ (0.49803921568627452, 0.73725490196078436, 0.25490196078431371),
+ (0.30196078431372547, 0.5725490196078431 , 0.12941176470588237),
+ (0.15294117647058825, 0.39215686274509803, 0.09803921568627451)
+ )
+
+_PRGn_data = (
+ (0.25098039215686274, 0.0 , 0.29411764705882354),
+ (0.46274509803921571, 0.16470588235294117, 0.51372549019607838),
+ (0.6 , 0.4392156862745098 , 0.6705882352941176 ),
+ (0.76078431372549016, 0.6470588235294118 , 0.81176470588235294),
+ (0.90588235294117647, 0.83137254901960789, 0.90980392156862744),
+ (0.96862745098039216, 0.96862745098039216, 0.96862745098039216),
+ (0.85098039215686272, 0.94117647058823528, 0.82745098039215681),
+ (0.65098039215686276, 0.85882352941176465, 0.62745098039215685),
+ (0.35294117647058826, 0.68235294117647061, 0.38039215686274508),
+ (0.10588235294117647, 0.47058823529411764, 0.21568627450980393),
+ (0.0 , 0.26666666666666666, 0.10588235294117647)
+ )
+
+_PuBu_data = (
+ (1.0 , 0.96862745098039216, 0.98431372549019602),
+ (0.92549019607843142, 0.90588235294117647, 0.94901960784313721),
+ (0.81568627450980391, 0.81960784313725488, 0.90196078431372551),
+ (0.65098039215686276, 0.74117647058823533, 0.85882352941176465),
+ (0.45490196078431372, 0.66274509803921566, 0.81176470588235294),
+ (0.21176470588235294, 0.56470588235294117, 0.75294117647058822),
+ (0.0196078431372549 , 0.4392156862745098 , 0.69019607843137254),
+ (0.01568627450980392, 0.35294117647058826, 0.55294117647058827),
+ (0.00784313725490196, 0.2196078431372549 , 0.34509803921568627)
+ )
+
+_PuBuGn_data = (
+ (1.0 , 0.96862745098039216, 0.98431372549019602),
+ (0.92549019607843142, 0.88627450980392153, 0.94117647058823528),
+ (0.81568627450980391, 0.81960784313725488, 0.90196078431372551),
+ (0.65098039215686276, 0.74117647058823533, 0.85882352941176465),
+ (0.40392156862745099, 0.66274509803921566, 0.81176470588235294),
+ (0.21176470588235294, 0.56470588235294117, 0.75294117647058822),
+ (0.00784313725490196, 0.50588235294117645, 0.54117647058823526),
+ (0.00392156862745098, 0.42352941176470588, 0.34901960784313724),
+ (0.00392156862745098, 0.27450980392156865, 0.21176470588235294)
+ )
+
+_PuOr_data = (
+ (0.49803921568627452, 0.23137254901960785, 0.03137254901960784),
+ (0.70196078431372544, 0.34509803921568627, 0.02352941176470588),
+ (0.8784313725490196 , 0.50980392156862742, 0.07843137254901961),
+ (0.99215686274509807, 0.72156862745098038, 0.38823529411764707),
+ (0.99607843137254903, 0.8784313725490196 , 0.71372549019607845),
+ (0.96862745098039216, 0.96862745098039216, 0.96862745098039216),
+ (0.84705882352941175, 0.85490196078431369, 0.92156862745098034),
+ (0.69803921568627447, 0.6705882352941176 , 0.82352941176470584),
+ (0.50196078431372548, 0.45098039215686275, 0.67450980392156867),
+ (0.32941176470588235, 0.15294117647058825, 0.53333333333333333),
+ (0.17647058823529413, 0.0 , 0.29411764705882354)
+ )
+
+_PuRd_data = (
+ (0.96862745098039216, 0.95686274509803926, 0.97647058823529409),
+ (0.90588235294117647, 0.88235294117647056, 0.93725490196078431),
+ (0.83137254901960789, 0.72549019607843135, 0.85490196078431369),
+ (0.78823529411764703, 0.58039215686274515, 0.7803921568627451 ),
+ (0.87450980392156863, 0.396078431372549 , 0.69019607843137254),
+ (0.90588235294117647, 0.16078431372549021, 0.54117647058823526),
+ (0.80784313725490198, 0.07058823529411765, 0.33725490196078434),
+ (0.59607843137254901, 0.0 , 0.2627450980392157 ),
+ (0.40392156862745099, 0.0 , 0.12156862745098039)
+ )
+
+_Purples_data = (
+ (0.9882352941176471 , 0.98431372549019602, 0.99215686274509807),
+ (0.93725490196078431, 0.92941176470588238, 0.96078431372549022),
+ (0.85490196078431369, 0.85490196078431369, 0.92156862745098034),
+ (0.73725490196078436, 0.74117647058823533, 0.86274509803921573),
+ (0.61960784313725492, 0.60392156862745094, 0.78431372549019607),
+ (0.50196078431372548, 0.49019607843137253, 0.72941176470588232),
+ (0.41568627450980394, 0.31764705882352939, 0.63921568627450975),
+ (0.32941176470588235, 0.15294117647058825, 0.5607843137254902 ),
+ (0.24705882352941178, 0.0 , 0.49019607843137253)
+ )
+
+_RdBu_data = (
+ (0.40392156862745099, 0.0 , 0.12156862745098039),
+ (0.69803921568627447, 0.09411764705882353, 0.16862745098039217),
+ (0.83921568627450982, 0.37647058823529411, 0.30196078431372547),
+ (0.95686274509803926, 0.6470588235294118 , 0.50980392156862742),
+ (0.99215686274509807, 0.85882352941176465, 0.7803921568627451 ),
+ (0.96862745098039216, 0.96862745098039216, 0.96862745098039216),
+ (0.81960784313725488, 0.89803921568627454, 0.94117647058823528),
+ (0.5725490196078431 , 0.77254901960784317, 0.87058823529411766),
+ (0.2627450980392157 , 0.57647058823529407, 0.76470588235294112),
+ (0.12941176470588237, 0.4 , 0.67450980392156867),
+ (0.0196078431372549 , 0.18823529411764706, 0.38039215686274508)
+ )
+
+_RdGy_data = (
+ (0.40392156862745099, 0.0 , 0.12156862745098039),
+ (0.69803921568627447, 0.09411764705882353, 0.16862745098039217),
+ (0.83921568627450982, 0.37647058823529411, 0.30196078431372547),
+ (0.95686274509803926, 0.6470588235294118 , 0.50980392156862742),
+ (0.99215686274509807, 0.85882352941176465, 0.7803921568627451 ),
+ (1.0 , 1.0 , 1.0 ),
+ (0.8784313725490196 , 0.8784313725490196 , 0.8784313725490196 ),
+ (0.72941176470588232, 0.72941176470588232, 0.72941176470588232),
+ (0.52941176470588236, 0.52941176470588236, 0.52941176470588236),
+ (0.30196078431372547, 0.30196078431372547, 0.30196078431372547),
+ (0.10196078431372549, 0.10196078431372549, 0.10196078431372549)
+ )
+
+_RdPu_data = (
+ (1.0 , 0.96862745098039216, 0.95294117647058818),
+ (0.99215686274509807, 0.8784313725490196 , 0.86666666666666667),
+ (0.9882352941176471 , 0.77254901960784317, 0.75294117647058822),
+ (0.98039215686274506, 0.62352941176470589, 0.70980392156862748),
+ (0.96862745098039216, 0.40784313725490196, 0.63137254901960782),
+ (0.86666666666666667, 0.20392156862745098, 0.59215686274509804),
+ (0.68235294117647061, 0.00392156862745098, 0.49411764705882355),
+ (0.47843137254901963, 0.00392156862745098, 0.46666666666666667),
+ (0.28627450980392155, 0.0 , 0.41568627450980394)
+ )
+
+_RdYlBu_data = (
+ (0.6470588235294118 , 0.0 , 0.14901960784313725),
+ (0.84313725490196079, 0.18823529411764706 , 0.15294117647058825),
+ (0.95686274509803926, 0.42745098039215684 , 0.2627450980392157 ),
+ (0.99215686274509807, 0.68235294117647061 , 0.38039215686274508),
+ (0.99607843137254903, 0.8784313725490196 , 0.56470588235294117),
+ (1.0 , 1.0 , 0.74901960784313726),
+ (0.8784313725490196 , 0.95294117647058818 , 0.97254901960784312),
+ (0.6705882352941176 , 0.85098039215686272 , 0.9137254901960784 ),
+ (0.45490196078431372, 0.67843137254901964 , 0.81960784313725488),
+ (0.27058823529411763, 0.45882352941176469 , 0.70588235294117652),
+ (0.19215686274509805, 0.21176470588235294 , 0.58431372549019611)
+ )
+
+_RdYlGn_data = (
+ (0.6470588235294118 , 0.0 , 0.14901960784313725),
+ (0.84313725490196079, 0.18823529411764706 , 0.15294117647058825),
+ (0.95686274509803926, 0.42745098039215684 , 0.2627450980392157 ),
+ (0.99215686274509807, 0.68235294117647061 , 0.38039215686274508),
+ (0.99607843137254903, 0.8784313725490196 , 0.54509803921568623),
+ (1.0 , 1.0 , 0.74901960784313726),
+ (0.85098039215686272, 0.93725490196078431 , 0.54509803921568623),
+ (0.65098039215686276, 0.85098039215686272 , 0.41568627450980394),
+ (0.4 , 0.74117647058823533 , 0.38823529411764707),
+ (0.10196078431372549, 0.59607843137254901 , 0.31372549019607843),
+ (0.0 , 0.40784313725490196 , 0.21568627450980393)
+ )
+
+_Reds_data = (
+ (1.0 , 0.96078431372549022 , 0.94117647058823528),
+ (0.99607843137254903, 0.8784313725490196 , 0.82352941176470584),
+ (0.9882352941176471 , 0.73333333333333328 , 0.63137254901960782),
+ (0.9882352941176471 , 0.5725490196078431 , 0.44705882352941179),
+ (0.98431372549019602, 0.41568627450980394 , 0.29019607843137257),
+ (0.93725490196078431, 0.23137254901960785 , 0.17254901960784313),
+ (0.79607843137254897, 0.094117647058823528, 0.11372549019607843),
+ (0.6470588235294118 , 0.058823529411764705, 0.08235294117647058),
+ (0.40392156862745099, 0.0 , 0.05098039215686274)
+ )
+
+_Spectral_data = (
+ (0.61960784313725492, 0.003921568627450980, 0.25882352941176473),
+ (0.83529411764705885, 0.24313725490196078 , 0.30980392156862746),
+ (0.95686274509803926, 0.42745098039215684 , 0.2627450980392157 ),
+ (0.99215686274509807, 0.68235294117647061 , 0.38039215686274508),
+ (0.99607843137254903, 0.8784313725490196 , 0.54509803921568623),
+ (1.0 , 1.0 , 0.74901960784313726),
+ (0.90196078431372551, 0.96078431372549022 , 0.59607843137254901),
+ (0.6705882352941176 , 0.8666666666666667 , 0.64313725490196083),
+ (0.4 , 0.76078431372549016 , 0.6470588235294118 ),
+ (0.19607843137254902, 0.53333333333333333 , 0.74117647058823533),
+ (0.36862745098039218, 0.30980392156862746 , 0.63529411764705879)
+ )
+
+_YlGn_data = (
+ (1.0 , 1.0 , 0.89803921568627454),
+ (0.96862745098039216, 0.9882352941176471 , 0.72549019607843135),
+ (0.85098039215686272, 0.94117647058823528 , 0.63921568627450975),
+ (0.67843137254901964, 0.8666666666666667 , 0.55686274509803924),
+ (0.47058823529411764, 0.77647058823529413 , 0.47450980392156861),
+ (0.25490196078431371, 0.6705882352941176 , 0.36470588235294116),
+ (0.13725490196078433, 0.51764705882352946 , 0.2627450980392157 ),
+ (0.0 , 0.40784313725490196 , 0.21568627450980393),
+ (0.0 , 0.27058823529411763 , 0.16078431372549021)
+ )
+
+_YlGnBu_data = (
+ (1.0 , 1.0 , 0.85098039215686272),
+ (0.92941176470588238, 0.97254901960784312 , 0.69411764705882351),
+ (0.7803921568627451 , 0.9137254901960784 , 0.70588235294117652),
+ (0.49803921568627452, 0.80392156862745101 , 0.73333333333333328),
+ (0.25490196078431371, 0.71372549019607845 , 0.7686274509803922 ),
+ (0.11372549019607843, 0.56862745098039214 , 0.75294117647058822),
+ (0.13333333333333333, 0.36862745098039218 , 0.6588235294117647 ),
+ (0.14509803921568629, 0.20392156862745098 , 0.58039215686274515),
+ (0.03137254901960784, 0.11372549019607843 , 0.34509803921568627)
+ )
+
+_YlOrBr_data = (
+ (1.0 , 1.0 , 0.89803921568627454),
+ (1.0 , 0.96862745098039216 , 0.73725490196078436),
+ (0.99607843137254903, 0.8901960784313725 , 0.56862745098039214),
+ (0.99607843137254903, 0.7686274509803922 , 0.30980392156862746),
+ (0.99607843137254903, 0.6 , 0.16078431372549021),
+ (0.92549019607843142, 0.4392156862745098 , 0.07843137254901961),
+ (0.8 , 0.29803921568627451 , 0.00784313725490196),
+ (0.6 , 0.20392156862745098 , 0.01568627450980392),
+ (0.4 , 0.14509803921568629 , 0.02352941176470588)
+ )
+
+_YlOrRd_data = (
+ (1.0 , 1.0 , 0.8 ),
+ (1.0 , 0.92941176470588238 , 0.62745098039215685),
+ (0.99607843137254903, 0.85098039215686272 , 0.46274509803921571),
+ (0.99607843137254903, 0.69803921568627447 , 0.29803921568627451),
+ (0.99215686274509807, 0.55294117647058827 , 0.23529411764705882),
+ (0.9882352941176471 , 0.30588235294117649 , 0.16470588235294117),
+ (0.8901960784313725 , 0.10196078431372549 , 0.10980392156862745),
+ (0.74117647058823533, 0.0 , 0.14901960784313725),
+ (0.50196078431372548, 0.0 , 0.14901960784313725)
+ )
+
+
+# ColorBrewer's qualitative maps, implemented using ListedColormap
+# for use with mpl.colors.NoNorm
+
+_Accent_data = (
+ (0.49803921568627452, 0.78823529411764703, 0.49803921568627452),
+ (0.74509803921568629, 0.68235294117647061, 0.83137254901960789),
+ (0.99215686274509807, 0.75294117647058822, 0.52549019607843139),
+ (1.0, 1.0, 0.6 ),
+ (0.2196078431372549, 0.42352941176470588, 0.69019607843137254),
+ (0.94117647058823528, 0.00784313725490196, 0.49803921568627452),
+ (0.74901960784313726, 0.35686274509803922, 0.09019607843137254),
+ (0.4, 0.4, 0.4 ),
+ )
+
+_Dark2_data = (
+ (0.10588235294117647, 0.61960784313725492, 0.46666666666666667),
+ (0.85098039215686272, 0.37254901960784315, 0.00784313725490196),
+ (0.45882352941176469, 0.4392156862745098, 0.70196078431372544),
+ (0.90588235294117647, 0.16078431372549021, 0.54117647058823526),
+ (0.4, 0.65098039215686276, 0.11764705882352941),
+ (0.90196078431372551, 0.6705882352941176, 0.00784313725490196),
+ (0.65098039215686276, 0.46274509803921571, 0.11372549019607843),
+ (0.4, 0.4, 0.4 ),
+ )
+
+_Paired_data = (
+ (0.65098039215686276, 0.80784313725490198, 0.8901960784313725 ),
+ (0.12156862745098039, 0.47058823529411764, 0.70588235294117652),
+ (0.69803921568627447, 0.87450980392156863, 0.54117647058823526),
+ (0.2, 0.62745098039215685, 0.17254901960784313),
+ (0.98431372549019602, 0.60392156862745094, 0.6 ),
+ (0.8901960784313725, 0.10196078431372549, 0.10980392156862745),
+ (0.99215686274509807, 0.74901960784313726, 0.43529411764705883),
+ (1.0, 0.49803921568627452, 0.0 ),
+ (0.792156862745098, 0.69803921568627447, 0.83921568627450982),
+ (0.41568627450980394, 0.23921568627450981, 0.60392156862745094),
+ (1.0, 1.0, 0.6 ),
+ (0.69411764705882351, 0.34901960784313724, 0.15686274509803921),
+ )
+
+_Pastel1_data = (
+ (0.98431372549019602, 0.70588235294117652, 0.68235294117647061),
+ (0.70196078431372544, 0.80392156862745101, 0.8901960784313725 ),
+ (0.8, 0.92156862745098034, 0.77254901960784317),
+ (0.87058823529411766, 0.79607843137254897, 0.89411764705882357),
+ (0.99607843137254903, 0.85098039215686272, 0.65098039215686276),
+ (1.0, 1.0, 0.8 ),
+ (0.89803921568627454, 0.84705882352941175, 0.74117647058823533),
+ (0.99215686274509807, 0.85490196078431369, 0.92549019607843142),
+ (0.94901960784313721, 0.94901960784313721, 0.94901960784313721),
+ )
+
+_Pastel2_data = (
+ (0.70196078431372544, 0.88627450980392153, 0.80392156862745101),
+ (0.99215686274509807, 0.80392156862745101, 0.67450980392156867),
+ (0.79607843137254897, 0.83529411764705885, 0.90980392156862744),
+ (0.95686274509803926, 0.792156862745098, 0.89411764705882357),
+ (0.90196078431372551, 0.96078431372549022, 0.78823529411764703),
+ (1.0, 0.94901960784313721, 0.68235294117647061),
+ (0.94509803921568625, 0.88627450980392153, 0.8 ),
+ (0.8, 0.8, 0.8 ),
+ )
+
+_Set1_data = (
+ (0.89411764705882357, 0.10196078431372549, 0.10980392156862745),
+ (0.21568627450980393, 0.49411764705882355, 0.72156862745098038),
+ (0.30196078431372547, 0.68627450980392157, 0.29019607843137257),
+ (0.59607843137254901, 0.30588235294117649, 0.63921568627450975),
+ (1.0, 0.49803921568627452, 0.0 ),
+ (1.0, 1.0, 0.2 ),
+ (0.65098039215686276, 0.33725490196078434, 0.15686274509803921),
+ (0.96862745098039216, 0.50588235294117645, 0.74901960784313726),
+ (0.6, 0.6, 0.6),
+ )
+
+_Set2_data = (
+ (0.4, 0.76078431372549016, 0.6470588235294118 ),
+ (0.9882352941176471, 0.55294117647058827, 0.3843137254901961 ),
+ (0.55294117647058827, 0.62745098039215685, 0.79607843137254897),
+ (0.90588235294117647, 0.54117647058823526, 0.76470588235294112),
+ (0.65098039215686276, 0.84705882352941175, 0.32941176470588235),
+ (1.0, 0.85098039215686272, 0.18431372549019609),
+ (0.89803921568627454, 0.7686274509803922, 0.58039215686274515),
+ (0.70196078431372544, 0.70196078431372544, 0.70196078431372544),
+ )
+
+_Set3_data = (
+ (0.55294117647058827, 0.82745098039215681, 0.7803921568627451 ),
+ (1.0, 1.0, 0.70196078431372544),
+ (0.74509803921568629, 0.72941176470588232, 0.85490196078431369),
+ (0.98431372549019602, 0.50196078431372548, 0.44705882352941179),
+ (0.50196078431372548, 0.69411764705882351, 0.82745098039215681),
+ (0.99215686274509807, 0.70588235294117652, 0.3843137254901961 ),
+ (0.70196078431372544, 0.87058823529411766, 0.41176470588235292),
+ (0.9882352941176471, 0.80392156862745101, 0.89803921568627454),
+ (0.85098039215686272, 0.85098039215686272, 0.85098039215686272),
+ (0.73725490196078436, 0.50196078431372548, 0.74117647058823533),
+ (0.8, 0.92156862745098034, 0.77254901960784317),
+ (1.0, 0.92941176470588238, 0.43529411764705883),
+ )
+
+
+# The next 7 palettes are from the Yorick scientific visualization package,
+# an evolution of the GIST package, both by David H. Munro.
+# They are released under a BSD-like license (see LICENSE_YORICK in
+# the license directory of the matplotlib source distribution).
+#
+# Most palette functions have been reduced to simple function descriptions
+# by Reinier Heeres, since the rgb components were mostly straight lines.
+# gist_earth_data and gist_ncar_data were simplified by a script and some
+# manual effort.
+
+_gist_earth_data = \
+{'red': (
+(0.0, 0.0, 0.0000),
+(0.2824, 0.1882, 0.1882),
+(0.4588, 0.2714, 0.2714),
+(0.5490, 0.4719, 0.4719),
+(0.6980, 0.7176, 0.7176),
+(0.7882, 0.7553, 0.7553),
+(1.0000, 0.9922, 0.9922),
+), 'green': (
+(0.0, 0.0, 0.0000),
+(0.0275, 0.0000, 0.0000),
+(0.1098, 0.1893, 0.1893),
+(0.1647, 0.3035, 0.3035),
+(0.2078, 0.3841, 0.3841),
+(0.2824, 0.5020, 0.5020),
+(0.5216, 0.6397, 0.6397),
+(0.6980, 0.7171, 0.7171),
+(0.7882, 0.6392, 0.6392),
+(0.7922, 0.6413, 0.6413),
+(0.8000, 0.6447, 0.6447),
+(0.8078, 0.6481, 0.6481),
+(0.8157, 0.6549, 0.6549),
+(0.8667, 0.6991, 0.6991),
+(0.8745, 0.7103, 0.7103),
+(0.8824, 0.7216, 0.7216),
+(0.8902, 0.7323, 0.7323),
+(0.8980, 0.7430, 0.7430),
+(0.9412, 0.8275, 0.8275),
+(0.9569, 0.8635, 0.8635),
+(0.9647, 0.8816, 0.8816),
+(0.9961, 0.9733, 0.9733),
+(1.0000, 0.9843, 0.9843),
+), 'blue': (
+(0.0, 0.0, 0.0000),
+(0.0039, 0.1684, 0.1684),
+(0.0078, 0.2212, 0.2212),
+(0.0275, 0.4329, 0.4329),
+(0.0314, 0.4549, 0.4549),
+(0.2824, 0.5004, 0.5004),
+(0.4667, 0.2748, 0.2748),
+(0.5451, 0.3205, 0.3205),
+(0.7843, 0.3961, 0.3961),
+(0.8941, 0.6651, 0.6651),
+(1.0000, 0.9843, 0.9843),
+)}
+
+_gist_gray_data = {
+ 'red': gfunc[3],
+ 'green': gfunc[3],
+ 'blue': gfunc[3],
+}
+
+def _gist_heat_red(x): return 1.5 * x
+def _gist_heat_green(x): return 2 * x - 1
+def _gist_heat_blue(x): return 4 * x - 3
+_gist_heat_data = {
+ 'red': _gist_heat_red, 'green': _gist_heat_green, 'blue': _gist_heat_blue}
+
+_gist_ncar_data = \
+{'red': (
+(0.0, 0.0, 0.0000),
+(0.3098, 0.0000, 0.0000),
+(0.3725, 0.3993, 0.3993),
+(0.4235, 0.5003, 0.5003),
+(0.5333, 1.0000, 1.0000),
+(0.7922, 1.0000, 1.0000),
+(0.8471, 0.6218, 0.6218),
+(0.8980, 0.9235, 0.9235),
+(1.0000, 0.9961, 0.9961),
+), 'green': (
+(0.0, 0.0, 0.0000),
+(0.0510, 0.3722, 0.3722),
+(0.1059, 0.0000, 0.0000),
+(0.1569, 0.7202, 0.7202),
+(0.1608, 0.7537, 0.7537),
+(0.1647, 0.7752, 0.7752),
+(0.2157, 1.0000, 1.0000),
+(0.2588, 0.9804, 0.9804),
+(0.2706, 0.9804, 0.9804),
+(0.3176, 1.0000, 1.0000),
+(0.3686, 0.8081, 0.8081),
+(0.4275, 1.0000, 1.0000),
+(0.5216, 1.0000, 1.0000),
+(0.6314, 0.7292, 0.7292),
+(0.6863, 0.2796, 0.2796),
+(0.7451, 0.0000, 0.0000),
+(0.7922, 0.0000, 0.0000),
+(0.8431, 0.1753, 0.1753),
+(0.8980, 0.5000, 0.5000),
+(1.0000, 0.9725, 0.9725),
+), 'blue': (
+(0.0, 0.5020, 0.5020),
+(0.0510, 0.0222, 0.0222),
+(0.1098, 1.0000, 1.0000),
+(0.2039, 1.0000, 1.0000),
+(0.2627, 0.6145, 0.6145),
+(0.3216, 0.0000, 0.0000),
+(0.4157, 0.0000, 0.0000),
+(0.4745, 0.2342, 0.2342),
+(0.5333, 0.0000, 0.0000),
+(0.5804, 0.0000, 0.0000),
+(0.6314, 0.0549, 0.0549),
+(0.6902, 0.0000, 0.0000),
+(0.7373, 0.0000, 0.0000),
+(0.7922, 0.9738, 0.9738),
+(0.8000, 1.0000, 1.0000),
+(0.8431, 1.0000, 1.0000),
+(0.8980, 0.9341, 0.9341),
+(1.0000, 0.9961, 0.9961),
+)}
+
+_gist_rainbow_data = (
+ (0.000, (1.00, 0.00, 0.16)),
+ (0.030, (1.00, 0.00, 0.00)),
+ (0.215, (1.00, 1.00, 0.00)),
+ (0.400, (0.00, 1.00, 0.00)),
+ (0.586, (0.00, 1.00, 1.00)),
+ (0.770, (0.00, 0.00, 1.00)),
+ (0.954, (1.00, 0.00, 1.00)),
+ (1.000, (1.00, 0.00, 0.75))
+)
+
+_gist_stern_data = {
+ 'red': (
+ (0.000, 0.000, 0.000), (0.0547, 1.000, 1.000),
+ (0.250, 0.027, 0.250), # (0.2500, 0.250, 0.250),
+ (1.000, 1.000, 1.000)),
+ 'green': ((0, 0, 0), (1, 1, 1)),
+ 'blue': (
+ (0.000, 0.000, 0.000), (0.500, 1.000, 1.000),
+ (0.735, 0.000, 0.000), (1.000, 1.000, 1.000))
+}
+
+def _gist_yarg(x): return 1 - x
+_gist_yarg_data = {'red': _gist_yarg, 'green': _gist_yarg, 'blue': _gist_yarg}
+
+# This bipolar colormap was generated from CoolWarmFloat33.csv of
+# "Diverging Color Maps for Scientific Visualization" by Kenneth Moreland.
+#
+_coolwarm_data = {
+ 'red': [
+ (0.0, 0.2298057, 0.2298057),
+ (0.03125, 0.26623388, 0.26623388),
+ (0.0625, 0.30386891, 0.30386891),
+ (0.09375, 0.342804478, 0.342804478),
+ (0.125, 0.38301334, 0.38301334),
+ (0.15625, 0.424369608, 0.424369608),
+ (0.1875, 0.46666708, 0.46666708),
+ (0.21875, 0.509635204, 0.509635204),
+ (0.25, 0.552953156, 0.552953156),
+ (0.28125, 0.596262162, 0.596262162),
+ (0.3125, 0.639176211, 0.639176211),
+ (0.34375, 0.681291281, 0.681291281),
+ (0.375, 0.722193294, 0.722193294),
+ (0.40625, 0.761464949, 0.761464949),
+ (0.4375, 0.798691636, 0.798691636),
+ (0.46875, 0.833466556, 0.833466556),
+ (0.5, 0.865395197, 0.865395197),
+ (0.53125, 0.897787179, 0.897787179),
+ (0.5625, 0.924127593, 0.924127593),
+ (0.59375, 0.944468518, 0.944468518),
+ (0.625, 0.958852946, 0.958852946),
+ (0.65625, 0.96732803, 0.96732803),
+ (0.6875, 0.969954137, 0.969954137),
+ (0.71875, 0.966811177, 0.966811177),
+ (0.75, 0.958003065, 0.958003065),
+ (0.78125, 0.943660866, 0.943660866),
+ (0.8125, 0.923944917, 0.923944917),
+ (0.84375, 0.89904617, 0.89904617),
+ (0.875, 0.869186849, 0.869186849),
+ (0.90625, 0.834620542, 0.834620542),
+ (0.9375, 0.795631745, 0.795631745),
+ (0.96875, 0.752534934, 0.752534934),
+ (1.0, 0.705673158, 0.705673158)],
+ 'green': [
+ (0.0, 0.298717966, 0.298717966),
+ (0.03125, 0.353094838, 0.353094838),
+ (0.0625, 0.406535296, 0.406535296),
+ (0.09375, 0.458757618, 0.458757618),
+ (0.125, 0.50941904, 0.50941904),
+ (0.15625, 0.558148092, 0.558148092),
+ (0.1875, 0.604562568, 0.604562568),
+ (0.21875, 0.648280772, 0.648280772),
+ (0.25, 0.688929332, 0.688929332),
+ (0.28125, 0.726149107, 0.726149107),
+ (0.3125, 0.759599947, 0.759599947),
+ (0.34375, 0.788964712, 0.788964712),
+ (0.375, 0.813952739, 0.813952739),
+ (0.40625, 0.834302879, 0.834302879),
+ (0.4375, 0.849786142, 0.849786142),
+ (0.46875, 0.860207984, 0.860207984),
+ (0.5, 0.86541021, 0.86541021),
+ (0.53125, 0.848937047, 0.848937047),
+ (0.5625, 0.827384882, 0.827384882),
+ (0.59375, 0.800927443, 0.800927443),
+ (0.625, 0.769767752, 0.769767752),
+ (0.65625, 0.734132809, 0.734132809),
+ (0.6875, 0.694266682, 0.694266682),
+ (0.71875, 0.650421156, 0.650421156),
+ (0.75, 0.602842431, 0.602842431),
+ (0.78125, 0.551750968, 0.551750968),
+ (0.8125, 0.49730856, 0.49730856),
+ (0.84375, 0.439559467, 0.439559467),
+ (0.875, 0.378313092, 0.378313092),
+ (0.90625, 0.312874446, 0.312874446),
+ (0.9375, 0.24128379, 0.24128379),
+ (0.96875, 0.157246067, 0.157246067),
+ (1.0, 0.01555616, 0.01555616)],
+ 'blue': [
+ (0.0, 0.753683153, 0.753683153),
+ (0.03125, 0.801466763, 0.801466763),
+ (0.0625, 0.84495867, 0.84495867),
+ (0.09375, 0.883725899, 0.883725899),
+ (0.125, 0.917387822, 0.917387822),
+ (0.15625, 0.945619588, 0.945619588),
+ (0.1875, 0.968154911, 0.968154911),
+ (0.21875, 0.98478814, 0.98478814),
+ (0.25, 0.995375608, 0.995375608),
+ (0.28125, 0.999836203, 0.999836203),
+ (0.3125, 0.998151185, 0.998151185),
+ (0.34375, 0.990363227, 0.990363227),
+ (0.375, 0.976574709, 0.976574709),
+ (0.40625, 0.956945269, 0.956945269),
+ (0.4375, 0.931688648, 0.931688648),
+ (0.46875, 0.901068838, 0.901068838),
+ (0.5, 0.865395561, 0.865395561),
+ (0.53125, 0.820880546, 0.820880546),
+ (0.5625, 0.774508472, 0.774508472),
+ (0.59375, 0.726736146, 0.726736146),
+ (0.625, 0.678007945, 0.678007945),
+ (0.65625, 0.628751763, 0.628751763),
+ (0.6875, 0.579375448, 0.579375448),
+ (0.71875, 0.530263762, 0.530263762),
+ (0.75, 0.481775914, 0.481775914),
+ (0.78125, 0.434243684, 0.434243684),
+ (0.8125, 0.387970225, 0.387970225),
+ (0.84375, 0.343229596, 0.343229596),
+ (0.875, 0.300267182, 0.300267182),
+ (0.90625, 0.259301199, 0.259301199),
+ (0.9375, 0.220525627, 0.220525627),
+ (0.96875, 0.184115123, 0.184115123),
+ (1.0, 0.150232812, 0.150232812)]
+ }
+
+# Implementation of Carey Rappaport's CMRmap.
+# See `A Color Map for Effective Black-and-White Rendering of Color-Scale
+# Images' by Carey Rappaport
+# http://www.mathworks.com/matlabcentral/fileexchange/2662-cmrmap-m
+_CMRmap_data = {'red': ((0.000, 0.00, 0.00),
+ (0.125, 0.15, 0.15),
+ (0.250, 0.30, 0.30),
+ (0.375, 0.60, 0.60),
+ (0.500, 1.00, 1.00),
+ (0.625, 0.90, 0.90),
+ (0.750, 0.90, 0.90),
+ (0.875, 0.90, 0.90),
+ (1.000, 1.00, 1.00)),
+ 'green': ((0.000, 0.00, 0.00),
+ (0.125, 0.15, 0.15),
+ (0.250, 0.15, 0.15),
+ (0.375, 0.20, 0.20),
+ (0.500, 0.25, 0.25),
+ (0.625, 0.50, 0.50),
+ (0.750, 0.75, 0.75),
+ (0.875, 0.90, 0.90),
+ (1.000, 1.00, 1.00)),
+ 'blue': ((0.000, 0.00, 0.00),
+ (0.125, 0.50, 0.50),
+ (0.250, 0.75, 0.75),
+ (0.375, 0.50, 0.50),
+ (0.500, 0.15, 0.15),
+ (0.625, 0.00, 0.00),
+ (0.750, 0.10, 0.10),
+ (0.875, 0.50, 0.50),
+ (1.000, 1.00, 1.00))}
+
+
+# An MIT licensed, colorblind-friendly heatmap from Wistia:
+# https://github.com/wistia/heatmap-palette
+# http://wistia.com/blog/heatmaps-for-colorblindness
+#
+# >>> import matplotlib.colors as c
+# >>> colors = ["#e4ff7a", "#ffe81a", "#ffbd00", "#ffa000", "#fc7f00"]
+# >>> cm = c.LinearSegmentedColormap.from_list('wistia', colors)
+# >>> _wistia_data = cm._segmentdata
+# >>> del _wistia_data['alpha']
+#
+_wistia_data = {
+ 'red': [(0.0, 0.8941176470588236, 0.8941176470588236),
+ (0.25, 1.0, 1.0),
+ (0.5, 1.0, 1.0),
+ (0.75, 1.0, 1.0),
+ (1.0, 0.9882352941176471, 0.9882352941176471)],
+ 'green': [(0.0, 1.0, 1.0),
+ (0.25, 0.9098039215686274, 0.9098039215686274),
+ (0.5, 0.7411764705882353, 0.7411764705882353),
+ (0.75, 0.6274509803921569, 0.6274509803921569),
+ (1.0, 0.4980392156862745, 0.4980392156862745)],
+ 'blue': [(0.0, 0.47843137254901963, 0.47843137254901963),
+ (0.25, 0.10196078431372549, 0.10196078431372549),
+ (0.5, 0.0, 0.0),
+ (0.75, 0.0, 0.0),
+ (1.0, 0.0, 0.0)],
+}
+
+
+# Categorical palettes from Vega:
+# https://github.com/vega/vega/wiki/Scales
+# (divided by 255)
+#
+
+_tab10_data = (
+ (0.12156862745098039, 0.4666666666666667, 0.7058823529411765 ), # 1f77b4
+ (1.0, 0.4980392156862745, 0.054901960784313725), # ff7f0e
+ (0.17254901960784313, 0.6274509803921569, 0.17254901960784313 ), # 2ca02c
+ (0.8392156862745098, 0.15294117647058825, 0.1568627450980392 ), # d62728
+ (0.5803921568627451, 0.403921568627451, 0.7411764705882353 ), # 9467bd
+ (0.5490196078431373, 0.33725490196078434, 0.29411764705882354 ), # 8c564b
+ (0.8901960784313725, 0.4666666666666667, 0.7607843137254902 ), # e377c2
+ (0.4980392156862745, 0.4980392156862745, 0.4980392156862745 ), # 7f7f7f
+ (0.7372549019607844, 0.7411764705882353, 0.13333333333333333 ), # bcbd22
+ (0.09019607843137255, 0.7450980392156863, 0.8117647058823529), # 17becf
+)
+
+_tab20_data = (
+ (0.12156862745098039, 0.4666666666666667, 0.7058823529411765 ), # 1f77b4
+ (0.6823529411764706, 0.7803921568627451, 0.9098039215686274 ), # aec7e8
+ (1.0, 0.4980392156862745, 0.054901960784313725), # ff7f0e
+ (1.0, 0.7333333333333333, 0.47058823529411764 ), # ffbb78
+ (0.17254901960784313, 0.6274509803921569, 0.17254901960784313 ), # 2ca02c
+ (0.596078431372549, 0.8745098039215686, 0.5411764705882353 ), # 98df8a
+ (0.8392156862745098, 0.15294117647058825, 0.1568627450980392 ), # d62728
+ (1.0, 0.596078431372549, 0.5882352941176471 ), # ff9896
+ (0.5803921568627451, 0.403921568627451, 0.7411764705882353 ), # 9467bd
+ (0.7725490196078432, 0.6901960784313725, 0.8352941176470589 ), # c5b0d5
+ (0.5490196078431373, 0.33725490196078434, 0.29411764705882354 ), # 8c564b
+ (0.7686274509803922, 0.611764705882353, 0.5803921568627451 ), # c49c94
+ (0.8901960784313725, 0.4666666666666667, 0.7607843137254902 ), # e377c2
+ (0.9686274509803922, 0.7137254901960784, 0.8235294117647058 ), # f7b6d2
+ (0.4980392156862745, 0.4980392156862745, 0.4980392156862745 ), # 7f7f7f
+ (0.7803921568627451, 0.7803921568627451, 0.7803921568627451 ), # c7c7c7
+ (0.7372549019607844, 0.7411764705882353, 0.13333333333333333 ), # bcbd22
+ (0.8588235294117647, 0.8588235294117647, 0.5529411764705883 ), # dbdb8d
+ (0.09019607843137255, 0.7450980392156863, 0.8117647058823529 ), # 17becf
+ (0.6196078431372549, 0.8549019607843137, 0.8980392156862745), # 9edae5
+)
+
+_tab20b_data = (
+ (0.2235294117647059, 0.23137254901960785, 0.4745098039215686 ), # 393b79
+ (0.3215686274509804, 0.32941176470588235, 0.6392156862745098 ), # 5254a3
+ (0.4196078431372549, 0.43137254901960786, 0.8117647058823529 ), # 6b6ecf
+ (0.611764705882353, 0.6196078431372549, 0.8705882352941177 ), # 9c9ede
+ (0.38823529411764707, 0.4745098039215686, 0.2235294117647059 ), # 637939
+ (0.5490196078431373, 0.6352941176470588, 0.3215686274509804 ), # 8ca252
+ (0.7098039215686275, 0.8117647058823529, 0.4196078431372549 ), # b5cf6b
+ (0.807843137254902, 0.8588235294117647, 0.611764705882353 ), # cedb9c
+ (0.5490196078431373, 0.42745098039215684, 0.19215686274509805), # 8c6d31
+ (0.7411764705882353, 0.6196078431372549, 0.2235294117647059 ), # bd9e39
+ (0.9058823529411765, 0.7294117647058823, 0.3215686274509804 ), # e7ba52
+ (0.9058823529411765, 0.796078431372549, 0.5803921568627451 ), # e7cb94
+ (0.5176470588235295, 0.23529411764705882, 0.2235294117647059 ), # 843c39
+ (0.6784313725490196, 0.28627450980392155, 0.2901960784313726 ), # ad494a
+ (0.8392156862745098, 0.3803921568627451, 0.4196078431372549 ), # d6616b
+ (0.9058823529411765, 0.5882352941176471, 0.611764705882353 ), # e7969c
+ (0.4823529411764706, 0.2549019607843137, 0.45098039215686275), # 7b4173
+ (0.6470588235294118, 0.3176470588235294, 0.5803921568627451 ), # a55194
+ (0.807843137254902, 0.42745098039215684, 0.7411764705882353 ), # ce6dbd
+ (0.8705882352941177, 0.6196078431372549, 0.8392156862745098 ), # de9ed6
+)
+
+_tab20c_data = (
+ (0.19215686274509805, 0.5098039215686274, 0.7411764705882353 ), # 3182bd
+ (0.4196078431372549, 0.6823529411764706, 0.8392156862745098 ), # 6baed6
+ (0.6196078431372549, 0.792156862745098, 0.8823529411764706 ), # 9ecae1
+ (0.7764705882352941, 0.8588235294117647, 0.9372549019607843 ), # c6dbef
+ (0.9019607843137255, 0.3333333333333333, 0.050980392156862744), # e6550d
+ (0.9921568627450981, 0.5529411764705883, 0.23529411764705882 ), # fd8d3c
+ (0.9921568627450981, 0.6823529411764706, 0.4196078431372549 ), # fdae6b
+ (0.9921568627450981, 0.8156862745098039, 0.6352941176470588 ), # fdd0a2
+ (0.19215686274509805, 0.6392156862745098, 0.32941176470588235 ), # 31a354
+ (0.4549019607843137, 0.7686274509803922, 0.4627450980392157 ), # 74c476
+ (0.6313725490196078, 0.8509803921568627, 0.6078431372549019 ), # a1d99b
+ (0.7803921568627451, 0.9137254901960784, 0.7529411764705882 ), # c7e9c0
+ (0.4588235294117647, 0.4196078431372549, 0.6941176470588235 ), # 756bb1
+ (0.6196078431372549, 0.6039215686274509, 0.7843137254901961 ), # 9e9ac8
+ (0.7372549019607844, 0.7411764705882353, 0.8627450980392157 ), # bcbddc
+ (0.8549019607843137, 0.8549019607843137, 0.9215686274509803 ), # dadaeb
+ (0.38823529411764707, 0.38823529411764707, 0.38823529411764707 ), # 636363
+ (0.5882352941176471, 0.5882352941176471, 0.5882352941176471 ), # 969696
+ (0.7411764705882353, 0.7411764705882353, 0.7411764705882353 ), # bdbdbd
+ (0.8509803921568627, 0.8509803921568627, 0.8509803921568627 ), # d9d9d9
+)
+
+
+datad = {
+ 'Blues': _Blues_data,
+ 'BrBG': _BrBG_data,
+ 'BuGn': _BuGn_data,
+ 'BuPu': _BuPu_data,
+ 'CMRmap': _CMRmap_data,
+ 'GnBu': _GnBu_data,
+ 'Greens': _Greens_data,
+ 'Greys': _Greys_data,
+ 'OrRd': _OrRd_data,
+ 'Oranges': _Oranges_data,
+ 'PRGn': _PRGn_data,
+ 'PiYG': _PiYG_data,
+ 'PuBu': _PuBu_data,
+ 'PuBuGn': _PuBuGn_data,
+ 'PuOr': _PuOr_data,
+ 'PuRd': _PuRd_data,
+ 'Purples': _Purples_data,
+ 'RdBu': _RdBu_data,
+ 'RdGy': _RdGy_data,
+ 'RdPu': _RdPu_data,
+ 'RdYlBu': _RdYlBu_data,
+ 'RdYlGn': _RdYlGn_data,
+ 'Reds': _Reds_data,
+ 'Spectral': _Spectral_data,
+ 'Wistia': _wistia_data,
+ 'YlGn': _YlGn_data,
+ 'YlGnBu': _YlGnBu_data,
+ 'YlOrBr': _YlOrBr_data,
+ 'YlOrRd': _YlOrRd_data,
+ 'afmhot': _afmhot_data,
+ 'autumn': _autumn_data,
+ 'binary': _binary_data,
+ 'bone': _bone_data,
+ 'brg': _brg_data,
+ 'bwr': _bwr_data,
+ 'cool': _cool_data,
+ 'coolwarm': _coolwarm_data,
+ 'copper': _copper_data,
+ 'cubehelix': _cubehelix_data,
+ 'flag': _flag_data,
+ 'gist_earth': _gist_earth_data,
+ 'gist_gray': _gist_gray_data,
+ 'gist_heat': _gist_heat_data,
+ 'gist_ncar': _gist_ncar_data,
+ 'gist_rainbow': _gist_rainbow_data,
+ 'gist_stern': _gist_stern_data,
+ 'gist_yarg': _gist_yarg_data,
+ 'gnuplot': _gnuplot_data,
+ 'gnuplot2': _gnuplot2_data,
+ 'gray': _gray_data,
+ 'hot': _hot_data,
+ 'hsv': _hsv_data,
+ 'jet': _jet_data,
+ 'nipy_spectral': _nipy_spectral_data,
+ 'ocean': _ocean_data,
+ 'pink': _pink_data,
+ 'prism': _prism_data,
+ 'rainbow': _rainbow_data,
+ 'seismic': _seismic_data,
+ 'spring': _spring_data,
+ 'summer': _summer_data,
+ 'terrain': _terrain_data,
+ 'winter': _winter_data,
+ # Qualitative
+ 'Accent': {'listed': _Accent_data},
+ 'Dark2': {'listed': _Dark2_data},
+ 'Paired': {'listed': _Paired_data},
+ 'Pastel1': {'listed': _Pastel1_data},
+ 'Pastel2': {'listed': _Pastel2_data},
+ 'Set1': {'listed': _Set1_data},
+ 'Set2': {'listed': _Set2_data},
+ 'Set3': {'listed': _Set3_data},
+ 'tab10': {'listed': _tab10_data},
+ 'tab20': {'listed': _tab20_data},
+ 'tab20b': {'listed': _tab20b_data},
+ 'tab20c': {'listed': _tab20c_data},
+}
diff --git a/venv/Lib/site-packages/matplotlib/_cm_listed.py b/venv/Lib/site-packages/matplotlib/_cm_listed.py
new file mode 100644
index 0000000..a331ad7
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_cm_listed.py
@@ -0,0 +1,2071 @@
+from .colors import ListedColormap
+
+_magma_data = [[0.001462, 0.000466, 0.013866],
+ [0.002258, 0.001295, 0.018331],
+ [0.003279, 0.002305, 0.023708],
+ [0.004512, 0.003490, 0.029965],
+ [0.005950, 0.004843, 0.037130],
+ [0.007588, 0.006356, 0.044973],
+ [0.009426, 0.008022, 0.052844],
+ [0.011465, 0.009828, 0.060750],
+ [0.013708, 0.011771, 0.068667],
+ [0.016156, 0.013840, 0.076603],
+ [0.018815, 0.016026, 0.084584],
+ [0.021692, 0.018320, 0.092610],
+ [0.024792, 0.020715, 0.100676],
+ [0.028123, 0.023201, 0.108787],
+ [0.031696, 0.025765, 0.116965],
+ [0.035520, 0.028397, 0.125209],
+ [0.039608, 0.031090, 0.133515],
+ [0.043830, 0.033830, 0.141886],
+ [0.048062, 0.036607, 0.150327],
+ [0.052320, 0.039407, 0.158841],
+ [0.056615, 0.042160, 0.167446],
+ [0.060949, 0.044794, 0.176129],
+ [0.065330, 0.047318, 0.184892],
+ [0.069764, 0.049726, 0.193735],
+ [0.074257, 0.052017, 0.202660],
+ [0.078815, 0.054184, 0.211667],
+ [0.083446, 0.056225, 0.220755],
+ [0.088155, 0.058133, 0.229922],
+ [0.092949, 0.059904, 0.239164],
+ [0.097833, 0.061531, 0.248477],
+ [0.102815, 0.063010, 0.257854],
+ [0.107899, 0.064335, 0.267289],
+ [0.113094, 0.065492, 0.276784],
+ [0.118405, 0.066479, 0.286321],
+ [0.123833, 0.067295, 0.295879],
+ [0.129380, 0.067935, 0.305443],
+ [0.135053, 0.068391, 0.315000],
+ [0.140858, 0.068654, 0.324538],
+ [0.146785, 0.068738, 0.334011],
+ [0.152839, 0.068637, 0.343404],
+ [0.159018, 0.068354, 0.352688],
+ [0.165308, 0.067911, 0.361816],
+ [0.171713, 0.067305, 0.370771],
+ [0.178212, 0.066576, 0.379497],
+ [0.184801, 0.065732, 0.387973],
+ [0.191460, 0.064818, 0.396152],
+ [0.198177, 0.063862, 0.404009],
+ [0.204935, 0.062907, 0.411514],
+ [0.211718, 0.061992, 0.418647],
+ [0.218512, 0.061158, 0.425392],
+ [0.225302, 0.060445, 0.431742],
+ [0.232077, 0.059889, 0.437695],
+ [0.238826, 0.059517, 0.443256],
+ [0.245543, 0.059352, 0.448436],
+ [0.252220, 0.059415, 0.453248],
+ [0.258857, 0.059706, 0.457710],
+ [0.265447, 0.060237, 0.461840],
+ [0.271994, 0.060994, 0.465660],
+ [0.278493, 0.061978, 0.469190],
+ [0.284951, 0.063168, 0.472451],
+ [0.291366, 0.064553, 0.475462],
+ [0.297740, 0.066117, 0.478243],
+ [0.304081, 0.067835, 0.480812],
+ [0.310382, 0.069702, 0.483186],
+ [0.316654, 0.071690, 0.485380],
+ [0.322899, 0.073782, 0.487408],
+ [0.329114, 0.075972, 0.489287],
+ [0.335308, 0.078236, 0.491024],
+ [0.341482, 0.080564, 0.492631],
+ [0.347636, 0.082946, 0.494121],
+ [0.353773, 0.085373, 0.495501],
+ [0.359898, 0.087831, 0.496778],
+ [0.366012, 0.090314, 0.497960],
+ [0.372116, 0.092816, 0.499053],
+ [0.378211, 0.095332, 0.500067],
+ [0.384299, 0.097855, 0.501002],
+ [0.390384, 0.100379, 0.501864],
+ [0.396467, 0.102902, 0.502658],
+ [0.402548, 0.105420, 0.503386],
+ [0.408629, 0.107930, 0.504052],
+ [0.414709, 0.110431, 0.504662],
+ [0.420791, 0.112920, 0.505215],
+ [0.426877, 0.115395, 0.505714],
+ [0.432967, 0.117855, 0.506160],
+ [0.439062, 0.120298, 0.506555],
+ [0.445163, 0.122724, 0.506901],
+ [0.451271, 0.125132, 0.507198],
+ [0.457386, 0.127522, 0.507448],
+ [0.463508, 0.129893, 0.507652],
+ [0.469640, 0.132245, 0.507809],
+ [0.475780, 0.134577, 0.507921],
+ [0.481929, 0.136891, 0.507989],
+ [0.488088, 0.139186, 0.508011],
+ [0.494258, 0.141462, 0.507988],
+ [0.500438, 0.143719, 0.507920],
+ [0.506629, 0.145958, 0.507806],
+ [0.512831, 0.148179, 0.507648],
+ [0.519045, 0.150383, 0.507443],
+ [0.525270, 0.152569, 0.507192],
+ [0.531507, 0.154739, 0.506895],
+ [0.537755, 0.156894, 0.506551],
+ [0.544015, 0.159033, 0.506159],
+ [0.550287, 0.161158, 0.505719],
+ [0.556571, 0.163269, 0.505230],
+ [0.562866, 0.165368, 0.504692],
+ [0.569172, 0.167454, 0.504105],
+ [0.575490, 0.169530, 0.503466],
+ [0.581819, 0.171596, 0.502777],
+ [0.588158, 0.173652, 0.502035],
+ [0.594508, 0.175701, 0.501241],
+ [0.600868, 0.177743, 0.500394],
+ [0.607238, 0.179779, 0.499492],
+ [0.613617, 0.181811, 0.498536],
+ [0.620005, 0.183840, 0.497524],
+ [0.626401, 0.185867, 0.496456],
+ [0.632805, 0.187893, 0.495332],
+ [0.639216, 0.189921, 0.494150],
+ [0.645633, 0.191952, 0.492910],
+ [0.652056, 0.193986, 0.491611],
+ [0.658483, 0.196027, 0.490253],
+ [0.664915, 0.198075, 0.488836],
+ [0.671349, 0.200133, 0.487358],
+ [0.677786, 0.202203, 0.485819],
+ [0.684224, 0.204286, 0.484219],
+ [0.690661, 0.206384, 0.482558],
+ [0.697098, 0.208501, 0.480835],
+ [0.703532, 0.210638, 0.479049],
+ [0.709962, 0.212797, 0.477201],
+ [0.716387, 0.214982, 0.475290],
+ [0.722805, 0.217194, 0.473316],
+ [0.729216, 0.219437, 0.471279],
+ [0.735616, 0.221713, 0.469180],
+ [0.742004, 0.224025, 0.467018],
+ [0.748378, 0.226377, 0.464794],
+ [0.754737, 0.228772, 0.462509],
+ [0.761077, 0.231214, 0.460162],
+ [0.767398, 0.233705, 0.457755],
+ [0.773695, 0.236249, 0.455289],
+ [0.779968, 0.238851, 0.452765],
+ [0.786212, 0.241514, 0.450184],
+ [0.792427, 0.244242, 0.447543],
+ [0.798608, 0.247040, 0.444848],
+ [0.804752, 0.249911, 0.442102],
+ [0.810855, 0.252861, 0.439305],
+ [0.816914, 0.255895, 0.436461],
+ [0.822926, 0.259016, 0.433573],
+ [0.828886, 0.262229, 0.430644],
+ [0.834791, 0.265540, 0.427671],
+ [0.840636, 0.268953, 0.424666],
+ [0.846416, 0.272473, 0.421631],
+ [0.852126, 0.276106, 0.418573],
+ [0.857763, 0.279857, 0.415496],
+ [0.863320, 0.283729, 0.412403],
+ [0.868793, 0.287728, 0.409303],
+ [0.874176, 0.291859, 0.406205],
+ [0.879464, 0.296125, 0.403118],
+ [0.884651, 0.300530, 0.400047],
+ [0.889731, 0.305079, 0.397002],
+ [0.894700, 0.309773, 0.393995],
+ [0.899552, 0.314616, 0.391037],
+ [0.904281, 0.319610, 0.388137],
+ [0.908884, 0.324755, 0.385308],
+ [0.913354, 0.330052, 0.382563],
+ [0.917689, 0.335500, 0.379915],
+ [0.921884, 0.341098, 0.377376],
+ [0.925937, 0.346844, 0.374959],
+ [0.929845, 0.352734, 0.372677],
+ [0.933606, 0.358764, 0.370541],
+ [0.937221, 0.364929, 0.368567],
+ [0.940687, 0.371224, 0.366762],
+ [0.944006, 0.377643, 0.365136],
+ [0.947180, 0.384178, 0.363701],
+ [0.950210, 0.390820, 0.362468],
+ [0.953099, 0.397563, 0.361438],
+ [0.955849, 0.404400, 0.360619],
+ [0.958464, 0.411324, 0.360014],
+ [0.960949, 0.418323, 0.359630],
+ [0.963310, 0.425390, 0.359469],
+ [0.965549, 0.432519, 0.359529],
+ [0.967671, 0.439703, 0.359810],
+ [0.969680, 0.446936, 0.360311],
+ [0.971582, 0.454210, 0.361030],
+ [0.973381, 0.461520, 0.361965],
+ [0.975082, 0.468861, 0.363111],
+ [0.976690, 0.476226, 0.364466],
+ [0.978210, 0.483612, 0.366025],
+ [0.979645, 0.491014, 0.367783],
+ [0.981000, 0.498428, 0.369734],
+ [0.982279, 0.505851, 0.371874],
+ [0.983485, 0.513280, 0.374198],
+ [0.984622, 0.520713, 0.376698],
+ [0.985693, 0.528148, 0.379371],
+ [0.986700, 0.535582, 0.382210],
+ [0.987646, 0.543015, 0.385210],
+ [0.988533, 0.550446, 0.388365],
+ [0.989363, 0.557873, 0.391671],
+ [0.990138, 0.565296, 0.395122],
+ [0.990871, 0.572706, 0.398714],
+ [0.991558, 0.580107, 0.402441],
+ [0.992196, 0.587502, 0.406299],
+ [0.992785, 0.594891, 0.410283],
+ [0.993326, 0.602275, 0.414390],
+ [0.993834, 0.609644, 0.418613],
+ [0.994309, 0.616999, 0.422950],
+ [0.994738, 0.624350, 0.427397],
+ [0.995122, 0.631696, 0.431951],
+ [0.995480, 0.639027, 0.436607],
+ [0.995810, 0.646344, 0.441361],
+ [0.996096, 0.653659, 0.446213],
+ [0.996341, 0.660969, 0.451160],
+ [0.996580, 0.668256, 0.456192],
+ [0.996775, 0.675541, 0.461314],
+ [0.996925, 0.682828, 0.466526],
+ [0.997077, 0.690088, 0.471811],
+ [0.997186, 0.697349, 0.477182],
+ [0.997254, 0.704611, 0.482635],
+ [0.997325, 0.711848, 0.488154],
+ [0.997351, 0.719089, 0.493755],
+ [0.997351, 0.726324, 0.499428],
+ [0.997341, 0.733545, 0.505167],
+ [0.997285, 0.740772, 0.510983],
+ [0.997228, 0.747981, 0.516859],
+ [0.997138, 0.755190, 0.522806],
+ [0.997019, 0.762398, 0.528821],
+ [0.996898, 0.769591, 0.534892],
+ [0.996727, 0.776795, 0.541039],
+ [0.996571, 0.783977, 0.547233],
+ [0.996369, 0.791167, 0.553499],
+ [0.996162, 0.798348, 0.559820],
+ [0.995932, 0.805527, 0.566202],
+ [0.995680, 0.812706, 0.572645],
+ [0.995424, 0.819875, 0.579140],
+ [0.995131, 0.827052, 0.585701],
+ [0.994851, 0.834213, 0.592307],
+ [0.994524, 0.841387, 0.598983],
+ [0.994222, 0.848540, 0.605696],
+ [0.993866, 0.855711, 0.612482],
+ [0.993545, 0.862859, 0.619299],
+ [0.993170, 0.870024, 0.626189],
+ [0.992831, 0.877168, 0.633109],
+ [0.992440, 0.884330, 0.640099],
+ [0.992089, 0.891470, 0.647116],
+ [0.991688, 0.898627, 0.654202],
+ [0.991332, 0.905763, 0.661309],
+ [0.990930, 0.912915, 0.668481],
+ [0.990570, 0.920049, 0.675675],
+ [0.990175, 0.927196, 0.682926],
+ [0.989815, 0.934329, 0.690198],
+ [0.989434, 0.941470, 0.697519],
+ [0.989077, 0.948604, 0.704863],
+ [0.988717, 0.955742, 0.712242],
+ [0.988367, 0.962878, 0.719649],
+ [0.988033, 0.970012, 0.727077],
+ [0.987691, 0.977154, 0.734536],
+ [0.987387, 0.984288, 0.742002],
+ [0.987053, 0.991438, 0.749504]]
+
+_inferno_data = [[0.001462, 0.000466, 0.013866],
+ [0.002267, 0.001270, 0.018570],
+ [0.003299, 0.002249, 0.024239],
+ [0.004547, 0.003392, 0.030909],
+ [0.006006, 0.004692, 0.038558],
+ [0.007676, 0.006136, 0.046836],
+ [0.009561, 0.007713, 0.055143],
+ [0.011663, 0.009417, 0.063460],
+ [0.013995, 0.011225, 0.071862],
+ [0.016561, 0.013136, 0.080282],
+ [0.019373, 0.015133, 0.088767],
+ [0.022447, 0.017199, 0.097327],
+ [0.025793, 0.019331, 0.105930],
+ [0.029432, 0.021503, 0.114621],
+ [0.033385, 0.023702, 0.123397],
+ [0.037668, 0.025921, 0.132232],
+ [0.042253, 0.028139, 0.141141],
+ [0.046915, 0.030324, 0.150164],
+ [0.051644, 0.032474, 0.159254],
+ [0.056449, 0.034569, 0.168414],
+ [0.061340, 0.036590, 0.177642],
+ [0.066331, 0.038504, 0.186962],
+ [0.071429, 0.040294, 0.196354],
+ [0.076637, 0.041905, 0.205799],
+ [0.081962, 0.043328, 0.215289],
+ [0.087411, 0.044556, 0.224813],
+ [0.092990, 0.045583, 0.234358],
+ [0.098702, 0.046402, 0.243904],
+ [0.104551, 0.047008, 0.253430],
+ [0.110536, 0.047399, 0.262912],
+ [0.116656, 0.047574, 0.272321],
+ [0.122908, 0.047536, 0.281624],
+ [0.129285, 0.047293, 0.290788],
+ [0.135778, 0.046856, 0.299776],
+ [0.142378, 0.046242, 0.308553],
+ [0.149073, 0.045468, 0.317085],
+ [0.155850, 0.044559, 0.325338],
+ [0.162689, 0.043554, 0.333277],
+ [0.169575, 0.042489, 0.340874],
+ [0.176493, 0.041402, 0.348111],
+ [0.183429, 0.040329, 0.354971],
+ [0.190367, 0.039309, 0.361447],
+ [0.197297, 0.038400, 0.367535],
+ [0.204209, 0.037632, 0.373238],
+ [0.211095, 0.037030, 0.378563],
+ [0.217949, 0.036615, 0.383522],
+ [0.224763, 0.036405, 0.388129],
+ [0.231538, 0.036405, 0.392400],
+ [0.238273, 0.036621, 0.396353],
+ [0.244967, 0.037055, 0.400007],
+ [0.251620, 0.037705, 0.403378],
+ [0.258234, 0.038571, 0.406485],
+ [0.264810, 0.039647, 0.409345],
+ [0.271347, 0.040922, 0.411976],
+ [0.277850, 0.042353, 0.414392],
+ [0.284321, 0.043933, 0.416608],
+ [0.290763, 0.045644, 0.418637],
+ [0.297178, 0.047470, 0.420491],
+ [0.303568, 0.049396, 0.422182],
+ [0.309935, 0.051407, 0.423721],
+ [0.316282, 0.053490, 0.425116],
+ [0.322610, 0.055634, 0.426377],
+ [0.328921, 0.057827, 0.427511],
+ [0.335217, 0.060060, 0.428524],
+ [0.341500, 0.062325, 0.429425],
+ [0.347771, 0.064616, 0.430217],
+ [0.354032, 0.066925, 0.430906],
+ [0.360284, 0.069247, 0.431497],
+ [0.366529, 0.071579, 0.431994],
+ [0.372768, 0.073915, 0.432400],
+ [0.379001, 0.076253, 0.432719],
+ [0.385228, 0.078591, 0.432955],
+ [0.391453, 0.080927, 0.433109],
+ [0.397674, 0.083257, 0.433183],
+ [0.403894, 0.085580, 0.433179],
+ [0.410113, 0.087896, 0.433098],
+ [0.416331, 0.090203, 0.432943],
+ [0.422549, 0.092501, 0.432714],
+ [0.428768, 0.094790, 0.432412],
+ [0.434987, 0.097069, 0.432039],
+ [0.441207, 0.099338, 0.431594],
+ [0.447428, 0.101597, 0.431080],
+ [0.453651, 0.103848, 0.430498],
+ [0.459875, 0.106089, 0.429846],
+ [0.466100, 0.108322, 0.429125],
+ [0.472328, 0.110547, 0.428334],
+ [0.478558, 0.112764, 0.427475],
+ [0.484789, 0.114974, 0.426548],
+ [0.491022, 0.117179, 0.425552],
+ [0.497257, 0.119379, 0.424488],
+ [0.503493, 0.121575, 0.423356],
+ [0.509730, 0.123769, 0.422156],
+ [0.515967, 0.125960, 0.420887],
+ [0.522206, 0.128150, 0.419549],
+ [0.528444, 0.130341, 0.418142],
+ [0.534683, 0.132534, 0.416667],
+ [0.540920, 0.134729, 0.415123],
+ [0.547157, 0.136929, 0.413511],
+ [0.553392, 0.139134, 0.411829],
+ [0.559624, 0.141346, 0.410078],
+ [0.565854, 0.143567, 0.408258],
+ [0.572081, 0.145797, 0.406369],
+ [0.578304, 0.148039, 0.404411],
+ [0.584521, 0.150294, 0.402385],
+ [0.590734, 0.152563, 0.400290],
+ [0.596940, 0.154848, 0.398125],
+ [0.603139, 0.157151, 0.395891],
+ [0.609330, 0.159474, 0.393589],
+ [0.615513, 0.161817, 0.391219],
+ [0.621685, 0.164184, 0.388781],
+ [0.627847, 0.166575, 0.386276],
+ [0.633998, 0.168992, 0.383704],
+ [0.640135, 0.171438, 0.381065],
+ [0.646260, 0.173914, 0.378359],
+ [0.652369, 0.176421, 0.375586],
+ [0.658463, 0.178962, 0.372748],
+ [0.664540, 0.181539, 0.369846],
+ [0.670599, 0.184153, 0.366879],
+ [0.676638, 0.186807, 0.363849],
+ [0.682656, 0.189501, 0.360757],
+ [0.688653, 0.192239, 0.357603],
+ [0.694627, 0.195021, 0.354388],
+ [0.700576, 0.197851, 0.351113],
+ [0.706500, 0.200728, 0.347777],
+ [0.712396, 0.203656, 0.344383],
+ [0.718264, 0.206636, 0.340931],
+ [0.724103, 0.209670, 0.337424],
+ [0.729909, 0.212759, 0.333861],
+ [0.735683, 0.215906, 0.330245],
+ [0.741423, 0.219112, 0.326576],
+ [0.747127, 0.222378, 0.322856],
+ [0.752794, 0.225706, 0.319085],
+ [0.758422, 0.229097, 0.315266],
+ [0.764010, 0.232554, 0.311399],
+ [0.769556, 0.236077, 0.307485],
+ [0.775059, 0.239667, 0.303526],
+ [0.780517, 0.243327, 0.299523],
+ [0.785929, 0.247056, 0.295477],
+ [0.791293, 0.250856, 0.291390],
+ [0.796607, 0.254728, 0.287264],
+ [0.801871, 0.258674, 0.283099],
+ [0.807082, 0.262692, 0.278898],
+ [0.812239, 0.266786, 0.274661],
+ [0.817341, 0.270954, 0.270390],
+ [0.822386, 0.275197, 0.266085],
+ [0.827372, 0.279517, 0.261750],
+ [0.832299, 0.283913, 0.257383],
+ [0.837165, 0.288385, 0.252988],
+ [0.841969, 0.292933, 0.248564],
+ [0.846709, 0.297559, 0.244113],
+ [0.851384, 0.302260, 0.239636],
+ [0.855992, 0.307038, 0.235133],
+ [0.860533, 0.311892, 0.230606],
+ [0.865006, 0.316822, 0.226055],
+ [0.869409, 0.321827, 0.221482],
+ [0.873741, 0.326906, 0.216886],
+ [0.878001, 0.332060, 0.212268],
+ [0.882188, 0.337287, 0.207628],
+ [0.886302, 0.342586, 0.202968],
+ [0.890341, 0.347957, 0.198286],
+ [0.894305, 0.353399, 0.193584],
+ [0.898192, 0.358911, 0.188860],
+ [0.902003, 0.364492, 0.184116],
+ [0.905735, 0.370140, 0.179350],
+ [0.909390, 0.375856, 0.174563],
+ [0.912966, 0.381636, 0.169755],
+ [0.916462, 0.387481, 0.164924],
+ [0.919879, 0.393389, 0.160070],
+ [0.923215, 0.399359, 0.155193],
+ [0.926470, 0.405389, 0.150292],
+ [0.929644, 0.411479, 0.145367],
+ [0.932737, 0.417627, 0.140417],
+ [0.935747, 0.423831, 0.135440],
+ [0.938675, 0.430091, 0.130438],
+ [0.941521, 0.436405, 0.125409],
+ [0.944285, 0.442772, 0.120354],
+ [0.946965, 0.449191, 0.115272],
+ [0.949562, 0.455660, 0.110164],
+ [0.952075, 0.462178, 0.105031],
+ [0.954506, 0.468744, 0.099874],
+ [0.956852, 0.475356, 0.094695],
+ [0.959114, 0.482014, 0.089499],
+ [0.961293, 0.488716, 0.084289],
+ [0.963387, 0.495462, 0.079073],
+ [0.965397, 0.502249, 0.073859],
+ [0.967322, 0.509078, 0.068659],
+ [0.969163, 0.515946, 0.063488],
+ [0.970919, 0.522853, 0.058367],
+ [0.972590, 0.529798, 0.053324],
+ [0.974176, 0.536780, 0.048392],
+ [0.975677, 0.543798, 0.043618],
+ [0.977092, 0.550850, 0.039050],
+ [0.978422, 0.557937, 0.034931],
+ [0.979666, 0.565057, 0.031409],
+ [0.980824, 0.572209, 0.028508],
+ [0.981895, 0.579392, 0.026250],
+ [0.982881, 0.586606, 0.024661],
+ [0.983779, 0.593849, 0.023770],
+ [0.984591, 0.601122, 0.023606],
+ [0.985315, 0.608422, 0.024202],
+ [0.985952, 0.615750, 0.025592],
+ [0.986502, 0.623105, 0.027814],
+ [0.986964, 0.630485, 0.030908],
+ [0.987337, 0.637890, 0.034916],
+ [0.987622, 0.645320, 0.039886],
+ [0.987819, 0.652773, 0.045581],
+ [0.987926, 0.660250, 0.051750],
+ [0.987945, 0.667748, 0.058329],
+ [0.987874, 0.675267, 0.065257],
+ [0.987714, 0.682807, 0.072489],
+ [0.987464, 0.690366, 0.079990],
+ [0.987124, 0.697944, 0.087731],
+ [0.986694, 0.705540, 0.095694],
+ [0.986175, 0.713153, 0.103863],
+ [0.985566, 0.720782, 0.112229],
+ [0.984865, 0.728427, 0.120785],
+ [0.984075, 0.736087, 0.129527],
+ [0.983196, 0.743758, 0.138453],
+ [0.982228, 0.751442, 0.147565],
+ [0.981173, 0.759135, 0.156863],
+ [0.980032, 0.766837, 0.166353],
+ [0.978806, 0.774545, 0.176037],
+ [0.977497, 0.782258, 0.185923],
+ [0.976108, 0.789974, 0.196018],
+ [0.974638, 0.797692, 0.206332],
+ [0.973088, 0.805409, 0.216877],
+ [0.971468, 0.813122, 0.227658],
+ [0.969783, 0.820825, 0.238686],
+ [0.968041, 0.828515, 0.249972],
+ [0.966243, 0.836191, 0.261534],
+ [0.964394, 0.843848, 0.273391],
+ [0.962517, 0.851476, 0.285546],
+ [0.960626, 0.859069, 0.298010],
+ [0.958720, 0.866624, 0.310820],
+ [0.956834, 0.874129, 0.323974],
+ [0.954997, 0.881569, 0.337475],
+ [0.953215, 0.888942, 0.351369],
+ [0.951546, 0.896226, 0.365627],
+ [0.950018, 0.903409, 0.380271],
+ [0.948683, 0.910473, 0.395289],
+ [0.947594, 0.917399, 0.410665],
+ [0.946809, 0.924168, 0.426373],
+ [0.946392, 0.930761, 0.442367],
+ [0.946403, 0.937159, 0.458592],
+ [0.946903, 0.943348, 0.474970],
+ [0.947937, 0.949318, 0.491426],
+ [0.949545, 0.955063, 0.507860],
+ [0.951740, 0.960587, 0.524203],
+ [0.954529, 0.965896, 0.540361],
+ [0.957896, 0.971003, 0.556275],
+ [0.961812, 0.975924, 0.571925],
+ [0.966249, 0.980678, 0.587206],
+ [0.971162, 0.985282, 0.602154],
+ [0.976511, 0.989753, 0.616760],
+ [0.982257, 0.994109, 0.631017],
+ [0.988362, 0.998364, 0.644924]]
+
+_plasma_data = [[0.050383, 0.029803, 0.527975],
+ [0.063536, 0.028426, 0.533124],
+ [0.075353, 0.027206, 0.538007],
+ [0.086222, 0.026125, 0.542658],
+ [0.096379, 0.025165, 0.547103],
+ [0.105980, 0.024309, 0.551368],
+ [0.115124, 0.023556, 0.555468],
+ [0.123903, 0.022878, 0.559423],
+ [0.132381, 0.022258, 0.563250],
+ [0.140603, 0.021687, 0.566959],
+ [0.148607, 0.021154, 0.570562],
+ [0.156421, 0.020651, 0.574065],
+ [0.164070, 0.020171, 0.577478],
+ [0.171574, 0.019706, 0.580806],
+ [0.178950, 0.019252, 0.584054],
+ [0.186213, 0.018803, 0.587228],
+ [0.193374, 0.018354, 0.590330],
+ [0.200445, 0.017902, 0.593364],
+ [0.207435, 0.017442, 0.596333],
+ [0.214350, 0.016973, 0.599239],
+ [0.221197, 0.016497, 0.602083],
+ [0.227983, 0.016007, 0.604867],
+ [0.234715, 0.015502, 0.607592],
+ [0.241396, 0.014979, 0.610259],
+ [0.248032, 0.014439, 0.612868],
+ [0.254627, 0.013882, 0.615419],
+ [0.261183, 0.013308, 0.617911],
+ [0.267703, 0.012716, 0.620346],
+ [0.274191, 0.012109, 0.622722],
+ [0.280648, 0.011488, 0.625038],
+ [0.287076, 0.010855, 0.627295],
+ [0.293478, 0.010213, 0.629490],
+ [0.299855, 0.009561, 0.631624],
+ [0.306210, 0.008902, 0.633694],
+ [0.312543, 0.008239, 0.635700],
+ [0.318856, 0.007576, 0.637640],
+ [0.325150, 0.006915, 0.639512],
+ [0.331426, 0.006261, 0.641316],
+ [0.337683, 0.005618, 0.643049],
+ [0.343925, 0.004991, 0.644710],
+ [0.350150, 0.004382, 0.646298],
+ [0.356359, 0.003798, 0.647810],
+ [0.362553, 0.003243, 0.649245],
+ [0.368733, 0.002724, 0.650601],
+ [0.374897, 0.002245, 0.651876],
+ [0.381047, 0.001814, 0.653068],
+ [0.387183, 0.001434, 0.654177],
+ [0.393304, 0.001114, 0.655199],
+ [0.399411, 0.000859, 0.656133],
+ [0.405503, 0.000678, 0.656977],
+ [0.411580, 0.000577, 0.657730],
+ [0.417642, 0.000564, 0.658390],
+ [0.423689, 0.000646, 0.658956],
+ [0.429719, 0.000831, 0.659425],
+ [0.435734, 0.001127, 0.659797],
+ [0.441732, 0.001540, 0.660069],
+ [0.447714, 0.002080, 0.660240],
+ [0.453677, 0.002755, 0.660310],
+ [0.459623, 0.003574, 0.660277],
+ [0.465550, 0.004545, 0.660139],
+ [0.471457, 0.005678, 0.659897],
+ [0.477344, 0.006980, 0.659549],
+ [0.483210, 0.008460, 0.659095],
+ [0.489055, 0.010127, 0.658534],
+ [0.494877, 0.011990, 0.657865],
+ [0.500678, 0.014055, 0.657088],
+ [0.506454, 0.016333, 0.656202],
+ [0.512206, 0.018833, 0.655209],
+ [0.517933, 0.021563, 0.654109],
+ [0.523633, 0.024532, 0.652901],
+ [0.529306, 0.027747, 0.651586],
+ [0.534952, 0.031217, 0.650165],
+ [0.540570, 0.034950, 0.648640],
+ [0.546157, 0.038954, 0.647010],
+ [0.551715, 0.043136, 0.645277],
+ [0.557243, 0.047331, 0.643443],
+ [0.562738, 0.051545, 0.641509],
+ [0.568201, 0.055778, 0.639477],
+ [0.573632, 0.060028, 0.637349],
+ [0.579029, 0.064296, 0.635126],
+ [0.584391, 0.068579, 0.632812],
+ [0.589719, 0.072878, 0.630408],
+ [0.595011, 0.077190, 0.627917],
+ [0.600266, 0.081516, 0.625342],
+ [0.605485, 0.085854, 0.622686],
+ [0.610667, 0.090204, 0.619951],
+ [0.615812, 0.094564, 0.617140],
+ [0.620919, 0.098934, 0.614257],
+ [0.625987, 0.103312, 0.611305],
+ [0.631017, 0.107699, 0.608287],
+ [0.636008, 0.112092, 0.605205],
+ [0.640959, 0.116492, 0.602065],
+ [0.645872, 0.120898, 0.598867],
+ [0.650746, 0.125309, 0.595617],
+ [0.655580, 0.129725, 0.592317],
+ [0.660374, 0.134144, 0.588971],
+ [0.665129, 0.138566, 0.585582],
+ [0.669845, 0.142992, 0.582154],
+ [0.674522, 0.147419, 0.578688],
+ [0.679160, 0.151848, 0.575189],
+ [0.683758, 0.156278, 0.571660],
+ [0.688318, 0.160709, 0.568103],
+ [0.692840, 0.165141, 0.564522],
+ [0.697324, 0.169573, 0.560919],
+ [0.701769, 0.174005, 0.557296],
+ [0.706178, 0.178437, 0.553657],
+ [0.710549, 0.182868, 0.550004],
+ [0.714883, 0.187299, 0.546338],
+ [0.719181, 0.191729, 0.542663],
+ [0.723444, 0.196158, 0.538981],
+ [0.727670, 0.200586, 0.535293],
+ [0.731862, 0.205013, 0.531601],
+ [0.736019, 0.209439, 0.527908],
+ [0.740143, 0.213864, 0.524216],
+ [0.744232, 0.218288, 0.520524],
+ [0.748289, 0.222711, 0.516834],
+ [0.752312, 0.227133, 0.513149],
+ [0.756304, 0.231555, 0.509468],
+ [0.760264, 0.235976, 0.505794],
+ [0.764193, 0.240396, 0.502126],
+ [0.768090, 0.244817, 0.498465],
+ [0.771958, 0.249237, 0.494813],
+ [0.775796, 0.253658, 0.491171],
+ [0.779604, 0.258078, 0.487539],
+ [0.783383, 0.262500, 0.483918],
+ [0.787133, 0.266922, 0.480307],
+ [0.790855, 0.271345, 0.476706],
+ [0.794549, 0.275770, 0.473117],
+ [0.798216, 0.280197, 0.469538],
+ [0.801855, 0.284626, 0.465971],
+ [0.805467, 0.289057, 0.462415],
+ [0.809052, 0.293491, 0.458870],
+ [0.812612, 0.297928, 0.455338],
+ [0.816144, 0.302368, 0.451816],
+ [0.819651, 0.306812, 0.448306],
+ [0.823132, 0.311261, 0.444806],
+ [0.826588, 0.315714, 0.441316],
+ [0.830018, 0.320172, 0.437836],
+ [0.833422, 0.324635, 0.434366],
+ [0.836801, 0.329105, 0.430905],
+ [0.840155, 0.333580, 0.427455],
+ [0.843484, 0.338062, 0.424013],
+ [0.846788, 0.342551, 0.420579],
+ [0.850066, 0.347048, 0.417153],
+ [0.853319, 0.351553, 0.413734],
+ [0.856547, 0.356066, 0.410322],
+ [0.859750, 0.360588, 0.406917],
+ [0.862927, 0.365119, 0.403519],
+ [0.866078, 0.369660, 0.400126],
+ [0.869203, 0.374212, 0.396738],
+ [0.872303, 0.378774, 0.393355],
+ [0.875376, 0.383347, 0.389976],
+ [0.878423, 0.387932, 0.386600],
+ [0.881443, 0.392529, 0.383229],
+ [0.884436, 0.397139, 0.379860],
+ [0.887402, 0.401762, 0.376494],
+ [0.890340, 0.406398, 0.373130],
+ [0.893250, 0.411048, 0.369768],
+ [0.896131, 0.415712, 0.366407],
+ [0.898984, 0.420392, 0.363047],
+ [0.901807, 0.425087, 0.359688],
+ [0.904601, 0.429797, 0.356329],
+ [0.907365, 0.434524, 0.352970],
+ [0.910098, 0.439268, 0.349610],
+ [0.912800, 0.444029, 0.346251],
+ [0.915471, 0.448807, 0.342890],
+ [0.918109, 0.453603, 0.339529],
+ [0.920714, 0.458417, 0.336166],
+ [0.923287, 0.463251, 0.332801],
+ [0.925825, 0.468103, 0.329435],
+ [0.928329, 0.472975, 0.326067],
+ [0.930798, 0.477867, 0.322697],
+ [0.933232, 0.482780, 0.319325],
+ [0.935630, 0.487712, 0.315952],
+ [0.937990, 0.492667, 0.312575],
+ [0.940313, 0.497642, 0.309197],
+ [0.942598, 0.502639, 0.305816],
+ [0.944844, 0.507658, 0.302433],
+ [0.947051, 0.512699, 0.299049],
+ [0.949217, 0.517763, 0.295662],
+ [0.951344, 0.522850, 0.292275],
+ [0.953428, 0.527960, 0.288883],
+ [0.955470, 0.533093, 0.285490],
+ [0.957469, 0.538250, 0.282096],
+ [0.959424, 0.543431, 0.278701],
+ [0.961336, 0.548636, 0.275305],
+ [0.963203, 0.553865, 0.271909],
+ [0.965024, 0.559118, 0.268513],
+ [0.966798, 0.564396, 0.265118],
+ [0.968526, 0.569700, 0.261721],
+ [0.970205, 0.575028, 0.258325],
+ [0.971835, 0.580382, 0.254931],
+ [0.973416, 0.585761, 0.251540],
+ [0.974947, 0.591165, 0.248151],
+ [0.976428, 0.596595, 0.244767],
+ [0.977856, 0.602051, 0.241387],
+ [0.979233, 0.607532, 0.238013],
+ [0.980556, 0.613039, 0.234646],
+ [0.981826, 0.618572, 0.231287],
+ [0.983041, 0.624131, 0.227937],
+ [0.984199, 0.629718, 0.224595],
+ [0.985301, 0.635330, 0.221265],
+ [0.986345, 0.640969, 0.217948],
+ [0.987332, 0.646633, 0.214648],
+ [0.988260, 0.652325, 0.211364],
+ [0.989128, 0.658043, 0.208100],
+ [0.989935, 0.663787, 0.204859],
+ [0.990681, 0.669558, 0.201642],
+ [0.991365, 0.675355, 0.198453],
+ [0.991985, 0.681179, 0.195295],
+ [0.992541, 0.687030, 0.192170],
+ [0.993032, 0.692907, 0.189084],
+ [0.993456, 0.698810, 0.186041],
+ [0.993814, 0.704741, 0.183043],
+ [0.994103, 0.710698, 0.180097],
+ [0.994324, 0.716681, 0.177208],
+ [0.994474, 0.722691, 0.174381],
+ [0.994553, 0.728728, 0.171622],
+ [0.994561, 0.734791, 0.168938],
+ [0.994495, 0.740880, 0.166335],
+ [0.994355, 0.746995, 0.163821],
+ [0.994141, 0.753137, 0.161404],
+ [0.993851, 0.759304, 0.159092],
+ [0.993482, 0.765499, 0.156891],
+ [0.993033, 0.771720, 0.154808],
+ [0.992505, 0.777967, 0.152855],
+ [0.991897, 0.784239, 0.151042],
+ [0.991209, 0.790537, 0.149377],
+ [0.990439, 0.796859, 0.147870],
+ [0.989587, 0.803205, 0.146529],
+ [0.988648, 0.809579, 0.145357],
+ [0.987621, 0.815978, 0.144363],
+ [0.986509, 0.822401, 0.143557],
+ [0.985314, 0.828846, 0.142945],
+ [0.984031, 0.835315, 0.142528],
+ [0.982653, 0.841812, 0.142303],
+ [0.981190, 0.848329, 0.142279],
+ [0.979644, 0.854866, 0.142453],
+ [0.977995, 0.861432, 0.142808],
+ [0.976265, 0.868016, 0.143351],
+ [0.974443, 0.874622, 0.144061],
+ [0.972530, 0.881250, 0.144923],
+ [0.970533, 0.887896, 0.145919],
+ [0.968443, 0.894564, 0.147014],
+ [0.966271, 0.901249, 0.148180],
+ [0.964021, 0.907950, 0.149370],
+ [0.961681, 0.914672, 0.150520],
+ [0.959276, 0.921407, 0.151566],
+ [0.956808, 0.928152, 0.152409],
+ [0.954287, 0.934908, 0.152921],
+ [0.951726, 0.941671, 0.152925],
+ [0.949151, 0.948435, 0.152178],
+ [0.946602, 0.955190, 0.150328],
+ [0.944152, 0.961916, 0.146861],
+ [0.941896, 0.968590, 0.140956],
+ [0.940015, 0.975158, 0.131326]]
+
+_viridis_data = [[0.267004, 0.004874, 0.329415],
+ [0.268510, 0.009605, 0.335427],
+ [0.269944, 0.014625, 0.341379],
+ [0.271305, 0.019942, 0.347269],
+ [0.272594, 0.025563, 0.353093],
+ [0.273809, 0.031497, 0.358853],
+ [0.274952, 0.037752, 0.364543],
+ [0.276022, 0.044167, 0.370164],
+ [0.277018, 0.050344, 0.375715],
+ [0.277941, 0.056324, 0.381191],
+ [0.278791, 0.062145, 0.386592],
+ [0.279566, 0.067836, 0.391917],
+ [0.280267, 0.073417, 0.397163],
+ [0.280894, 0.078907, 0.402329],
+ [0.281446, 0.084320, 0.407414],
+ [0.281924, 0.089666, 0.412415],
+ [0.282327, 0.094955, 0.417331],
+ [0.282656, 0.100196, 0.422160],
+ [0.282910, 0.105393, 0.426902],
+ [0.283091, 0.110553, 0.431554],
+ [0.283197, 0.115680, 0.436115],
+ [0.283229, 0.120777, 0.440584],
+ [0.283187, 0.125848, 0.444960],
+ [0.283072, 0.130895, 0.449241],
+ [0.282884, 0.135920, 0.453427],
+ [0.282623, 0.140926, 0.457517],
+ [0.282290, 0.145912, 0.461510],
+ [0.281887, 0.150881, 0.465405],
+ [0.281412, 0.155834, 0.469201],
+ [0.280868, 0.160771, 0.472899],
+ [0.280255, 0.165693, 0.476498],
+ [0.279574, 0.170599, 0.479997],
+ [0.278826, 0.175490, 0.483397],
+ [0.278012, 0.180367, 0.486697],
+ [0.277134, 0.185228, 0.489898],
+ [0.276194, 0.190074, 0.493001],
+ [0.275191, 0.194905, 0.496005],
+ [0.274128, 0.199721, 0.498911],
+ [0.273006, 0.204520, 0.501721],
+ [0.271828, 0.209303, 0.504434],
+ [0.270595, 0.214069, 0.507052],
+ [0.269308, 0.218818, 0.509577],
+ [0.267968, 0.223549, 0.512008],
+ [0.266580, 0.228262, 0.514349],
+ [0.265145, 0.232956, 0.516599],
+ [0.263663, 0.237631, 0.518762],
+ [0.262138, 0.242286, 0.520837],
+ [0.260571, 0.246922, 0.522828],
+ [0.258965, 0.251537, 0.524736],
+ [0.257322, 0.256130, 0.526563],
+ [0.255645, 0.260703, 0.528312],
+ [0.253935, 0.265254, 0.529983],
+ [0.252194, 0.269783, 0.531579],
+ [0.250425, 0.274290, 0.533103],
+ [0.248629, 0.278775, 0.534556],
+ [0.246811, 0.283237, 0.535941],
+ [0.244972, 0.287675, 0.537260],
+ [0.243113, 0.292092, 0.538516],
+ [0.241237, 0.296485, 0.539709],
+ [0.239346, 0.300855, 0.540844],
+ [0.237441, 0.305202, 0.541921],
+ [0.235526, 0.309527, 0.542944],
+ [0.233603, 0.313828, 0.543914],
+ [0.231674, 0.318106, 0.544834],
+ [0.229739, 0.322361, 0.545706],
+ [0.227802, 0.326594, 0.546532],
+ [0.225863, 0.330805, 0.547314],
+ [0.223925, 0.334994, 0.548053],
+ [0.221989, 0.339161, 0.548752],
+ [0.220057, 0.343307, 0.549413],
+ [0.218130, 0.347432, 0.550038],
+ [0.216210, 0.351535, 0.550627],
+ [0.214298, 0.355619, 0.551184],
+ [0.212395, 0.359683, 0.551710],
+ [0.210503, 0.363727, 0.552206],
+ [0.208623, 0.367752, 0.552675],
+ [0.206756, 0.371758, 0.553117],
+ [0.204903, 0.375746, 0.553533],
+ [0.203063, 0.379716, 0.553925],
+ [0.201239, 0.383670, 0.554294],
+ [0.199430, 0.387607, 0.554642],
+ [0.197636, 0.391528, 0.554969],
+ [0.195860, 0.395433, 0.555276],
+ [0.194100, 0.399323, 0.555565],
+ [0.192357, 0.403199, 0.555836],
+ [0.190631, 0.407061, 0.556089],
+ [0.188923, 0.410910, 0.556326],
+ [0.187231, 0.414746, 0.556547],
+ [0.185556, 0.418570, 0.556753],
+ [0.183898, 0.422383, 0.556944],
+ [0.182256, 0.426184, 0.557120],
+ [0.180629, 0.429975, 0.557282],
+ [0.179019, 0.433756, 0.557430],
+ [0.177423, 0.437527, 0.557565],
+ [0.175841, 0.441290, 0.557685],
+ [0.174274, 0.445044, 0.557792],
+ [0.172719, 0.448791, 0.557885],
+ [0.171176, 0.452530, 0.557965],
+ [0.169646, 0.456262, 0.558030],
+ [0.168126, 0.459988, 0.558082],
+ [0.166617, 0.463708, 0.558119],
+ [0.165117, 0.467423, 0.558141],
+ [0.163625, 0.471133, 0.558148],
+ [0.162142, 0.474838, 0.558140],
+ [0.160665, 0.478540, 0.558115],
+ [0.159194, 0.482237, 0.558073],
+ [0.157729, 0.485932, 0.558013],
+ [0.156270, 0.489624, 0.557936],
+ [0.154815, 0.493313, 0.557840],
+ [0.153364, 0.497000, 0.557724],
+ [0.151918, 0.500685, 0.557587],
+ [0.150476, 0.504369, 0.557430],
+ [0.149039, 0.508051, 0.557250],
+ [0.147607, 0.511733, 0.557049],
+ [0.146180, 0.515413, 0.556823],
+ [0.144759, 0.519093, 0.556572],
+ [0.143343, 0.522773, 0.556295],
+ [0.141935, 0.526453, 0.555991],
+ [0.140536, 0.530132, 0.555659],
+ [0.139147, 0.533812, 0.555298],
+ [0.137770, 0.537492, 0.554906],
+ [0.136408, 0.541173, 0.554483],
+ [0.135066, 0.544853, 0.554029],
+ [0.133743, 0.548535, 0.553541],
+ [0.132444, 0.552216, 0.553018],
+ [0.131172, 0.555899, 0.552459],
+ [0.129933, 0.559582, 0.551864],
+ [0.128729, 0.563265, 0.551229],
+ [0.127568, 0.566949, 0.550556],
+ [0.126453, 0.570633, 0.549841],
+ [0.125394, 0.574318, 0.549086],
+ [0.124395, 0.578002, 0.548287],
+ [0.123463, 0.581687, 0.547445],
+ [0.122606, 0.585371, 0.546557],
+ [0.121831, 0.589055, 0.545623],
+ [0.121148, 0.592739, 0.544641],
+ [0.120565, 0.596422, 0.543611],
+ [0.120092, 0.600104, 0.542530],
+ [0.119738, 0.603785, 0.541400],
+ [0.119512, 0.607464, 0.540218],
+ [0.119423, 0.611141, 0.538982],
+ [0.119483, 0.614817, 0.537692],
+ [0.119699, 0.618490, 0.536347],
+ [0.120081, 0.622161, 0.534946],
+ [0.120638, 0.625828, 0.533488],
+ [0.121380, 0.629492, 0.531973],
+ [0.122312, 0.633153, 0.530398],
+ [0.123444, 0.636809, 0.528763],
+ [0.124780, 0.640461, 0.527068],
+ [0.126326, 0.644107, 0.525311],
+ [0.128087, 0.647749, 0.523491],
+ [0.130067, 0.651384, 0.521608],
+ [0.132268, 0.655014, 0.519661],
+ [0.134692, 0.658636, 0.517649],
+ [0.137339, 0.662252, 0.515571],
+ [0.140210, 0.665859, 0.513427],
+ [0.143303, 0.669459, 0.511215],
+ [0.146616, 0.673050, 0.508936],
+ [0.150148, 0.676631, 0.506589],
+ [0.153894, 0.680203, 0.504172],
+ [0.157851, 0.683765, 0.501686],
+ [0.162016, 0.687316, 0.499129],
+ [0.166383, 0.690856, 0.496502],
+ [0.170948, 0.694384, 0.493803],
+ [0.175707, 0.697900, 0.491033],
+ [0.180653, 0.701402, 0.488189],
+ [0.185783, 0.704891, 0.485273],
+ [0.191090, 0.708366, 0.482284],
+ [0.196571, 0.711827, 0.479221],
+ [0.202219, 0.715272, 0.476084],
+ [0.208030, 0.718701, 0.472873],
+ [0.214000, 0.722114, 0.469588],
+ [0.220124, 0.725509, 0.466226],
+ [0.226397, 0.728888, 0.462789],
+ [0.232815, 0.732247, 0.459277],
+ [0.239374, 0.735588, 0.455688],
+ [0.246070, 0.738910, 0.452024],
+ [0.252899, 0.742211, 0.448284],
+ [0.259857, 0.745492, 0.444467],
+ [0.266941, 0.748751, 0.440573],
+ [0.274149, 0.751988, 0.436601],
+ [0.281477, 0.755203, 0.432552],
+ [0.288921, 0.758394, 0.428426],
+ [0.296479, 0.761561, 0.424223],
+ [0.304148, 0.764704, 0.419943],
+ [0.311925, 0.767822, 0.415586],
+ [0.319809, 0.770914, 0.411152],
+ [0.327796, 0.773980, 0.406640],
+ [0.335885, 0.777018, 0.402049],
+ [0.344074, 0.780029, 0.397381],
+ [0.352360, 0.783011, 0.392636],
+ [0.360741, 0.785964, 0.387814],
+ [0.369214, 0.788888, 0.382914],
+ [0.377779, 0.791781, 0.377939],
+ [0.386433, 0.794644, 0.372886],
+ [0.395174, 0.797475, 0.367757],
+ [0.404001, 0.800275, 0.362552],
+ [0.412913, 0.803041, 0.357269],
+ [0.421908, 0.805774, 0.351910],
+ [0.430983, 0.808473, 0.346476],
+ [0.440137, 0.811138, 0.340967],
+ [0.449368, 0.813768, 0.335384],
+ [0.458674, 0.816363, 0.329727],
+ [0.468053, 0.818921, 0.323998],
+ [0.477504, 0.821444, 0.318195],
+ [0.487026, 0.823929, 0.312321],
+ [0.496615, 0.826376, 0.306377],
+ [0.506271, 0.828786, 0.300362],
+ [0.515992, 0.831158, 0.294279],
+ [0.525776, 0.833491, 0.288127],
+ [0.535621, 0.835785, 0.281908],
+ [0.545524, 0.838039, 0.275626],
+ [0.555484, 0.840254, 0.269281],
+ [0.565498, 0.842430, 0.262877],
+ [0.575563, 0.844566, 0.256415],
+ [0.585678, 0.846661, 0.249897],
+ [0.595839, 0.848717, 0.243329],
+ [0.606045, 0.850733, 0.236712],
+ [0.616293, 0.852709, 0.230052],
+ [0.626579, 0.854645, 0.223353],
+ [0.636902, 0.856542, 0.216620],
+ [0.647257, 0.858400, 0.209861],
+ [0.657642, 0.860219, 0.203082],
+ [0.668054, 0.861999, 0.196293],
+ [0.678489, 0.863742, 0.189503],
+ [0.688944, 0.865448, 0.182725],
+ [0.699415, 0.867117, 0.175971],
+ [0.709898, 0.868751, 0.169257],
+ [0.720391, 0.870350, 0.162603],
+ [0.730889, 0.871916, 0.156029],
+ [0.741388, 0.873449, 0.149561],
+ [0.751884, 0.874951, 0.143228],
+ [0.762373, 0.876424, 0.137064],
+ [0.772852, 0.877868, 0.131109],
+ [0.783315, 0.879285, 0.125405],
+ [0.793760, 0.880678, 0.120005],
+ [0.804182, 0.882046, 0.114965],
+ [0.814576, 0.883393, 0.110347],
+ [0.824940, 0.884720, 0.106217],
+ [0.835270, 0.886029, 0.102646],
+ [0.845561, 0.887322, 0.099702],
+ [0.855810, 0.888601, 0.097452],
+ [0.866013, 0.889868, 0.095953],
+ [0.876168, 0.891125, 0.095250],
+ [0.886271, 0.892374, 0.095374],
+ [0.896320, 0.893616, 0.096335],
+ [0.906311, 0.894855, 0.098125],
+ [0.916242, 0.896091, 0.100717],
+ [0.926106, 0.897330, 0.104071],
+ [0.935904, 0.898570, 0.108131],
+ [0.945636, 0.899815, 0.112838],
+ [0.955300, 0.901065, 0.118128],
+ [0.964894, 0.902323, 0.123941],
+ [0.974417, 0.903590, 0.130215],
+ [0.983868, 0.904867, 0.136897],
+ [0.993248, 0.906157, 0.143936]]
+
+_cividis_data = [[0.000000, 0.135112, 0.304751],
+ [0.000000, 0.138068, 0.311105],
+ [0.000000, 0.141013, 0.317579],
+ [0.000000, 0.143951, 0.323982],
+ [0.000000, 0.146877, 0.330479],
+ [0.000000, 0.149791, 0.337065],
+ [0.000000, 0.152673, 0.343704],
+ [0.000000, 0.155377, 0.350500],
+ [0.000000, 0.157932, 0.357521],
+ [0.000000, 0.160495, 0.364534],
+ [0.000000, 0.163058, 0.371608],
+ [0.000000, 0.165621, 0.378769],
+ [0.000000, 0.168204, 0.385902],
+ [0.000000, 0.170800, 0.393100],
+ [0.000000, 0.173420, 0.400353],
+ [0.000000, 0.176082, 0.407577],
+ [0.000000, 0.178802, 0.414764],
+ [0.000000, 0.181610, 0.421859],
+ [0.000000, 0.184550, 0.428802],
+ [0.000000, 0.186915, 0.435532],
+ [0.000000, 0.188769, 0.439563],
+ [0.000000, 0.190950, 0.441085],
+ [0.000000, 0.193366, 0.441561],
+ [0.003602, 0.195911, 0.441564],
+ [0.017852, 0.198528, 0.441248],
+ [0.032110, 0.201199, 0.440785],
+ [0.046205, 0.203903, 0.440196],
+ [0.058378, 0.206629, 0.439531],
+ [0.068968, 0.209372, 0.438863],
+ [0.078624, 0.212122, 0.438105],
+ [0.087465, 0.214879, 0.437342],
+ [0.095645, 0.217643, 0.436593],
+ [0.103401, 0.220406, 0.435790],
+ [0.110658, 0.223170, 0.435067],
+ [0.117612, 0.225935, 0.434308],
+ [0.124291, 0.228697, 0.433547],
+ [0.130669, 0.231458, 0.432840],
+ [0.136830, 0.234216, 0.432148],
+ [0.142852, 0.236972, 0.431404],
+ [0.148638, 0.239724, 0.430752],
+ [0.154261, 0.242475, 0.430120],
+ [0.159733, 0.245221, 0.429528],
+ [0.165113, 0.247965, 0.428908],
+ [0.170362, 0.250707, 0.428325],
+ [0.175490, 0.253444, 0.427790],
+ [0.180503, 0.256180, 0.427299],
+ [0.185453, 0.258914, 0.426788],
+ [0.190303, 0.261644, 0.426329],
+ [0.195057, 0.264372, 0.425924],
+ [0.199764, 0.267099, 0.425497],
+ [0.204385, 0.269823, 0.425126],
+ [0.208926, 0.272546, 0.424809],
+ [0.213431, 0.275266, 0.424480],
+ [0.217863, 0.277985, 0.424206],
+ [0.222264, 0.280702, 0.423914],
+ [0.226598, 0.283419, 0.423678],
+ [0.230871, 0.286134, 0.423498],
+ [0.235120, 0.288848, 0.423304],
+ [0.239312, 0.291562, 0.423167],
+ [0.243485, 0.294274, 0.423014],
+ [0.247605, 0.296986, 0.422917],
+ [0.251675, 0.299698, 0.422873],
+ [0.255731, 0.302409, 0.422814],
+ [0.259740, 0.305120, 0.422810],
+ [0.263738, 0.307831, 0.422789],
+ [0.267693, 0.310542, 0.422821],
+ [0.271639, 0.313253, 0.422837],
+ [0.275513, 0.315965, 0.422979],
+ [0.279411, 0.318677, 0.423031],
+ [0.283240, 0.321390, 0.423211],
+ [0.287065, 0.324103, 0.423373],
+ [0.290884, 0.326816, 0.423517],
+ [0.294669, 0.329531, 0.423716],
+ [0.298421, 0.332247, 0.423973],
+ [0.302169, 0.334963, 0.424213],
+ [0.305886, 0.337681, 0.424512],
+ [0.309601, 0.340399, 0.424790],
+ [0.313287, 0.343120, 0.425120],
+ [0.316941, 0.345842, 0.425512],
+ [0.320595, 0.348565, 0.425889],
+ [0.324250, 0.351289, 0.426250],
+ [0.327875, 0.354016, 0.426670],
+ [0.331474, 0.356744, 0.427144],
+ [0.335073, 0.359474, 0.427605],
+ [0.338673, 0.362206, 0.428053],
+ [0.342246, 0.364939, 0.428559],
+ [0.345793, 0.367676, 0.429127],
+ [0.349341, 0.370414, 0.429685],
+ [0.352892, 0.373153, 0.430226],
+ [0.356418, 0.375896, 0.430823],
+ [0.359916, 0.378641, 0.431501],
+ [0.363446, 0.381388, 0.432075],
+ [0.366923, 0.384139, 0.432796],
+ [0.370430, 0.386890, 0.433428],
+ [0.373884, 0.389646, 0.434209],
+ [0.377371, 0.392404, 0.434890],
+ [0.380830, 0.395164, 0.435653],
+ [0.384268, 0.397928, 0.436475],
+ [0.387705, 0.400694, 0.437305],
+ [0.391151, 0.403464, 0.438096],
+ [0.394568, 0.406236, 0.438986],
+ [0.397991, 0.409011, 0.439848],
+ [0.401418, 0.411790, 0.440708],
+ [0.404820, 0.414572, 0.441642],
+ [0.408226, 0.417357, 0.442570],
+ [0.411607, 0.420145, 0.443577],
+ [0.414992, 0.422937, 0.444578],
+ [0.418383, 0.425733, 0.445560],
+ [0.421748, 0.428531, 0.446640],
+ [0.425120, 0.431334, 0.447692],
+ [0.428462, 0.434140, 0.448864],
+ [0.431817, 0.436950, 0.449982],
+ [0.435168, 0.439763, 0.451134],
+ [0.438504, 0.442580, 0.452341],
+ [0.441810, 0.445402, 0.453659],
+ [0.445148, 0.448226, 0.454885],
+ [0.448447, 0.451053, 0.456264],
+ [0.451759, 0.453887, 0.457582],
+ [0.455072, 0.456718, 0.458976],
+ [0.458366, 0.459552, 0.460457],
+ [0.461616, 0.462405, 0.461969],
+ [0.464947, 0.465241, 0.463395],
+ [0.468254, 0.468083, 0.464908],
+ [0.471501, 0.470960, 0.466357],
+ [0.474812, 0.473832, 0.467681],
+ [0.478186, 0.476699, 0.468845],
+ [0.481622, 0.479573, 0.469767],
+ [0.485141, 0.482451, 0.470384],
+ [0.488697, 0.485318, 0.471008],
+ [0.492278, 0.488198, 0.471453],
+ [0.495913, 0.491076, 0.471751],
+ [0.499552, 0.493960, 0.472032],
+ [0.503185, 0.496851, 0.472305],
+ [0.506866, 0.499743, 0.472432],
+ [0.510540, 0.502643, 0.472550],
+ [0.514226, 0.505546, 0.472640],
+ [0.517920, 0.508454, 0.472707],
+ [0.521643, 0.511367, 0.472639],
+ [0.525348, 0.514285, 0.472660],
+ [0.529086, 0.517207, 0.472543],
+ [0.532829, 0.520135, 0.472401],
+ [0.536553, 0.523067, 0.472352],
+ [0.540307, 0.526005, 0.472163],
+ [0.544069, 0.528948, 0.471947],
+ [0.547840, 0.531895, 0.471704],
+ [0.551612, 0.534849, 0.471439],
+ [0.555393, 0.537807, 0.471147],
+ [0.559181, 0.540771, 0.470829],
+ [0.562972, 0.543741, 0.470488],
+ [0.566802, 0.546715, 0.469988],
+ [0.570607, 0.549695, 0.469593],
+ [0.574417, 0.552682, 0.469172],
+ [0.578236, 0.555673, 0.468724],
+ [0.582087, 0.558670, 0.468118],
+ [0.585916, 0.561674, 0.467618],
+ [0.589753, 0.564682, 0.467090],
+ [0.593622, 0.567697, 0.466401],
+ [0.597469, 0.570718, 0.465821],
+ [0.601354, 0.573743, 0.465074],
+ [0.605211, 0.576777, 0.464441],
+ [0.609105, 0.579816, 0.463638],
+ [0.612977, 0.582861, 0.462950],
+ [0.616852, 0.585913, 0.462237],
+ [0.620765, 0.588970, 0.461351],
+ [0.624654, 0.592034, 0.460583],
+ [0.628576, 0.595104, 0.459641],
+ [0.632506, 0.598180, 0.458668],
+ [0.636412, 0.601264, 0.457818],
+ [0.640352, 0.604354, 0.456791],
+ [0.644270, 0.607450, 0.455886],
+ [0.648222, 0.610553, 0.454801],
+ [0.652178, 0.613664, 0.453689],
+ [0.656114, 0.616780, 0.452702],
+ [0.660082, 0.619904, 0.451534],
+ [0.664055, 0.623034, 0.450338],
+ [0.668008, 0.626171, 0.449270],
+ [0.671991, 0.629316, 0.448018],
+ [0.675981, 0.632468, 0.446736],
+ [0.679979, 0.635626, 0.445424],
+ [0.683950, 0.638793, 0.444251],
+ [0.687957, 0.641966, 0.442886],
+ [0.691971, 0.645145, 0.441491],
+ [0.695985, 0.648334, 0.440072],
+ [0.700008, 0.651529, 0.438624],
+ [0.704037, 0.654731, 0.437147],
+ [0.708067, 0.657942, 0.435647],
+ [0.712105, 0.661160, 0.434117],
+ [0.716177, 0.664384, 0.432386],
+ [0.720222, 0.667618, 0.430805],
+ [0.724274, 0.670859, 0.429194],
+ [0.728334, 0.674107, 0.427554],
+ [0.732422, 0.677364, 0.425717],
+ [0.736488, 0.680629, 0.424028],
+ [0.740589, 0.683900, 0.422131],
+ [0.744664, 0.687181, 0.420393],
+ [0.748772, 0.690470, 0.418448],
+ [0.752886, 0.693766, 0.416472],
+ [0.756975, 0.697071, 0.414659],
+ [0.761096, 0.700384, 0.412638],
+ [0.765223, 0.703705, 0.410587],
+ [0.769353, 0.707035, 0.408516],
+ [0.773486, 0.710373, 0.406422],
+ [0.777651, 0.713719, 0.404112],
+ [0.781795, 0.717074, 0.401966],
+ [0.785965, 0.720438, 0.399613],
+ [0.790116, 0.723810, 0.397423],
+ [0.794298, 0.727190, 0.395016],
+ [0.798480, 0.730580, 0.392597],
+ [0.802667, 0.733978, 0.390153],
+ [0.806859, 0.737385, 0.387684],
+ [0.811054, 0.740801, 0.385198],
+ [0.815274, 0.744226, 0.382504],
+ [0.819499, 0.747659, 0.379785],
+ [0.823729, 0.751101, 0.377043],
+ [0.827959, 0.754553, 0.374292],
+ [0.832192, 0.758014, 0.371529],
+ [0.836429, 0.761483, 0.368747],
+ [0.840693, 0.764962, 0.365746],
+ [0.844957, 0.768450, 0.362741],
+ [0.849223, 0.771947, 0.359729],
+ [0.853515, 0.775454, 0.356500],
+ [0.857809, 0.778969, 0.353259],
+ [0.862105, 0.782494, 0.350011],
+ [0.866421, 0.786028, 0.346571],
+ [0.870717, 0.789572, 0.343333],
+ [0.875057, 0.793125, 0.339685],
+ [0.879378, 0.796687, 0.336241],
+ [0.883720, 0.800258, 0.332599],
+ [0.888081, 0.803839, 0.328770],
+ [0.892440, 0.807430, 0.324968],
+ [0.896818, 0.811030, 0.320982],
+ [0.901195, 0.814639, 0.317021],
+ [0.905589, 0.818257, 0.312889],
+ [0.910000, 0.821885, 0.308594],
+ [0.914407, 0.825522, 0.304348],
+ [0.918828, 0.829168, 0.299960],
+ [0.923279, 0.832822, 0.295244],
+ [0.927724, 0.836486, 0.290611],
+ [0.932180, 0.840159, 0.285880],
+ [0.936660, 0.843841, 0.280876],
+ [0.941147, 0.847530, 0.275815],
+ [0.945654, 0.851228, 0.270532],
+ [0.950178, 0.854933, 0.265085],
+ [0.954725, 0.858646, 0.259365],
+ [0.959284, 0.862365, 0.253563],
+ [0.963872, 0.866089, 0.247445],
+ [0.968469, 0.869819, 0.241310],
+ [0.973114, 0.873550, 0.234677],
+ [0.977780, 0.877281, 0.227954],
+ [0.982497, 0.881008, 0.220878],
+ [0.987293, 0.884718, 0.213336],
+ [0.992218, 0.888385, 0.205468],
+ [0.994847, 0.892954, 0.203445],
+ [0.995249, 0.898384, 0.207561],
+ [0.995503, 0.903866, 0.212370],
+ [0.995737, 0.909344, 0.217772]]
+
+_twilight_data = [
+ [0.88575015840754434, 0.85000924943067835, 0.8879736506427196],
+ [0.88378520195539056, 0.85072940540310626, 0.88723222096949894],
+ [0.88172231059285788, 0.85127594077653468, 0.88638056925514819],
+ [0.8795410528270573, 0.85165675407495722, 0.8854143767924102],
+ [0.87724880858965482, 0.85187028338870274, 0.88434120381311432],
+ [0.87485347508575972, 0.85191526123023187, 0.88316926967613829],
+ [0.87233134085124076, 0.85180165478080894, 0.88189704355001619],
+ [0.86970474853509816, 0.85152403004797894, 0.88053883390003362],
+ [0.86696015505333579, 0.8510896085314068, 0.87909766977173343],
+ [0.86408985081463996, 0.85050391167507788, 0.87757925784892632],
+ [0.86110245436899846, 0.84976754857001258, 0.87599242923439569],
+ [0.85798259245670372, 0.84888934810281835, 0.87434038553446281],
+ [0.85472593189256985, 0.84787488124672816, 0.8726282980930582],
+ [0.85133714570857189, 0.84672735796116472, 0.87086081657350445],
+ [0.84780710702577922, 0.8454546229209523, 0.86904036783694438],
+ [0.8441261828674842, 0.84406482711037389, 0.86716973322690072],
+ [0.84030420805957784, 0.8425605950855084, 0.865250882410458],
+ [0.83634031809191178, 0.84094796518951942, 0.86328528001070159],
+ [0.83222705712934408, 0.83923490627754482, 0.86127563500427884],
+ [0.82796894316013536, 0.83742600751395202, 0.85922399451306786],
+ [0.82357429680252847, 0.83552487764795436, 0.85713191328514948],
+ [0.81904654677937527, 0.8335364929949034, 0.85500206287010105],
+ [0.81438982121143089, 0.83146558694197847, 0.85283759062147024],
+ [0.8095999819094809, 0.82931896673505456, 0.85064441601050367],
+ [0.80469164429814577, 0.82709838780560663, 0.84842449296974021],
+ [0.79967075421267997, 0.82480781812080928, 0.84618210029578533],
+ [0.79454305089231114, 0.82245116226304615, 0.84392184786827984],
+ [0.78931445564608915, 0.82003213188702007, 0.8416486380471222],
+ [0.78399101042764918, 0.81755426400533426, 0.83936747464036732],
+ [0.77857892008227592, 0.81502089378742548, 0.8370834463093898],
+ [0.77308416590170936, 0.81243524735466011, 0.83480172950579679],
+ [0.76751108504417864, 0.8098007598713145, 0.83252816638059668],
+ [0.76186907937980286, 0.80711949387647486, 0.830266486168872],
+ [0.75616443584381976, 0.80439408733477935, 0.82802138994719998],
+ [0.75040346765406696, 0.80162699008965321, 0.82579737851082424],
+ [0.74459247771890169, 0.79882047719583249, 0.82359867586156521],
+ [0.73873771700494939, 0.79597665735031009, 0.82142922780433014],
+ [0.73284543645523459, 0.79309746468844067, 0.81929263384230377],
+ [0.72692177512829703, 0.7901846863592763, 0.81719217466726379],
+ [0.72097280665536778, 0.78723995923452639, 0.81513073920879264],
+ [0.71500403076252128, 0.78426487091581187, 0.81311116559949914],
+ [0.70902078134539304, 0.78126088716070907, 0.81113591855117928],
+ [0.7030297722540817, 0.77822904973358131, 0.80920618848056969],
+ [0.6970365443886174, 0.77517050008066057, 0.80732335380063447],
+ [0.69104641009309098, 0.77208629460678091, 0.80548841690679074],
+ [0.68506446154395928, 0.7689774029354699, 0.80370206267176914],
+ [0.67909554499882152, 0.76584472131395898, 0.8019646617300199],
+ [0.67314422559426212, 0.76268908733890484, 0.80027628545809526],
+ [0.66721479803752815, 0.7595112803730375, 0.79863674654537764],
+ [0.6613112930078745, 0.75631202708719025, 0.7970456043491897],
+ [0.65543692326454717, 0.75309208756768431, 0.79550271129031047],
+ [0.64959573004253479, 0.74985201221941766, 0.79400674021499107],
+ [0.6437910831099849, 0.7465923800833657, 0.79255653201306053],
+ [0.63802586828545982, 0.74331376714033193, 0.79115100459573173],
+ [0.6323027138710603, 0.74001672160131404, 0.78978892762640429],
+ [0.62662402022604591, 0.73670175403699445, 0.78846901316334561],
+ [0.62099193064817548, 0.73336934798923203, 0.78718994624696581],
+ [0.61540846411770478, 0.73001995232739691, 0.78595022706750484],
+ [0.60987543176093062, 0.72665398759758293, 0.78474835732694714],
+ [0.60439434200274855, 0.7232718614323369, 0.78358295593535587],
+ [0.5989665814482068, 0.71987394892246725, 0.78245259899346642],
+ [0.59359335696837223, 0.7164606049658685, 0.78135588237640097],
+ [0.58827579780555495, 0.71303214646458135, 0.78029141405636515],
+ [0.58301487036932409, 0.70958887676997473, 0.77925781820476592],
+ [0.5778116438998202, 0.70613106157153982, 0.77825345121025524],
+ [0.5726668948158774, 0.7026589535425779, 0.77727702680911992],
+ [0.56758117853861967, 0.69917279302646274, 0.77632748534275298],
+ [0.56255515357219343, 0.69567278381629649, 0.77540359142309845],
+ [0.55758940419605174, 0.69215911458254054, 0.7745041337932782],
+ [0.55268450589347129, 0.68863194515166382, 0.7736279426902245],
+ [0.54784098153018634, 0.68509142218509878, 0.77277386473440868],
+ [0.54305932424018233, 0.68153767253065878, 0.77194079697835083],
+ [0.53834015575176275, 0.67797081129095405, 0.77112734439057717],
+ [0.53368389147728401, 0.67439093705212727, 0.7703325054879735],
+ [0.529090861832473, 0.67079812302806219, 0.76955552292313134],
+ [0.52456151470593582, 0.66719242996142225, 0.76879541714230948],
+ [0.52009627392235558, 0.66357391434030388, 0.76805119403344102],
+ [0.5156955988596057, 0.65994260812897998, 0.76732191489596169],
+ [0.51135992541601927, 0.65629853981831865, 0.76660663780645333],
+ [0.50708969576451657, 0.65264172403146448, 0.76590445660835849],
+ [0.5028853540415561, 0.64897216734095264, 0.76521446718174913],
+ [0.49874733661356069, 0.6452898684900934, 0.76453578734180083],
+ [0.4946761847863938, 0.64159484119504429, 0.76386719002130909],
+ [0.49067224938561221, 0.63788704858847078, 0.76320812763163837],
+ [0.4867359599430568, 0.63416646251100506, 0.76255780085924041],
+ [0.4828677867260272, 0.6304330455306234, 0.76191537149895305],
+ [0.47906816236197386, 0.62668676251860134, 0.76128000375662419],
+ [0.47533752394906287, 0.62292757283835809, 0.76065085571817748],
+ [0.47167629518877091, 0.61915543242884641, 0.76002709227883047],
+ [0.46808490970531597, 0.61537028695790286, 0.75940789891092741],
+ [0.46456376716303932, 0.61157208822864151, 0.75879242623025811],
+ [0.46111326647023881, 0.607760777169989, 0.75817986436807139],
+ [0.45773377230160567, 0.60393630046586455, 0.75756936901859162],
+ [0.45442563977552913, 0.60009859503858665, 0.75696013660606487],
+ [0.45118918687617743, 0.59624762051353541, 0.75635120643246645],
+ [0.44802470933589172, 0.59238331452146575, 0.75574176474107924],
+ [0.44493246854215379, 0.5885055998308617, 0.7551311041857901],
+ [0.44191271766696399, 0.58461441100175571, 0.75451838884410671],
+ [0.43896563958048396, 0.58070969241098491, 0.75390276208285945],
+ [0.43609138958356369, 0.57679137998186081, 0.7532834105961016],
+ [0.43329008867358393, 0.57285941625606673, 0.75265946532566674],
+ [0.43056179073057571, 0.56891374572457176, 0.75203008099312696],
+ [0.42790652284925834, 0.5649543060909209, 0.75139443521914839],
+ [0.42532423665011354, 0.56098104959950301, 0.75075164989005116],
+ [0.42281485675772662, 0.55699392126996583, 0.75010086988227642],
+ [0.42037822361396326, 0.55299287158108168, 0.7494412559451894],
+ [0.41801414079233629, 0.54897785421888889, 0.74877193167001121],
+ [0.4157223260454232, 0.54494882715350401, 0.74809204459000522],
+ [0.41350245743314729, 0.54090574771098476, 0.74740073297543086],
+ [0.41135414697304568, 0.53684857765005933, 0.74669712855065784],
+ [0.4092768899914751, 0.53277730177130322, 0.74598030635707824],
+ [0.40727018694219069, 0.52869188011057411, 0.74524942637581271],
+ [0.40533343789303178, 0.52459228174983119, 0.74450365836708132],
+ [0.40346600333905397, 0.52047847653840029, 0.74374215223567086],
+ [0.40166714010896104, 0.51635044969688759, 0.7429640345324835],
+ [0.39993606933454834, 0.51220818143218516, 0.74216844571317986],
+ [0.3982719152586337, 0.50805166539276136, 0.74135450918099721],
+ [0.39667374905665609, 0.50388089053847973, 0.74052138580516735],
+ [0.39514058808207631, 0.49969585326377758, 0.73966820211715711],
+ [0.39367135736822567, 0.49549655777451179, 0.738794102296364],
+ [0.39226494876209317, 0.49128300332899261, 0.73789824784475078],
+ [0.39092017571994903, 0.48705520251223039, 0.73697977133881254],
+ [0.38963580160340855, 0.48281316715123496, 0.73603782546932739],
+ [0.38841053300842432, 0.47855691131792805, 0.73507157641157261],
+ [0.38724301459330251, 0.47428645933635388, 0.73408016787854391],
+ [0.38613184178892102, 0.4700018340988123, 0.7330627749243106],
+ [0.38507556793651387, 0.46570306719930193, 0.73201854033690505],
+ [0.38407269378943537, 0.46139018782416635, 0.73094665432902683],
+ [0.38312168084402748, 0.45706323581407199, 0.72984626791353258],
+ [0.38222094988570376, 0.45272225034283325, 0.72871656144003782],
+ [0.38136887930454161, 0.44836727669277859, 0.72755671317141346],
+ [0.38056380696565623, 0.44399837208633719, 0.72636587045135315],
+ [0.37980403744848751, 0.43961558821222629, 0.72514323778761092],
+ [0.37908789283110761, 0.43521897612544935, 0.72388798691323131],
+ [0.378413635091359, 0.43080859411413064, 0.72259931993061044],
+ [0.37777949753513729, 0.4263845142616835, 0.72127639993530235],
+ [0.37718371844251231, 0.42194680223454828, 0.71991841524475775],
+ [0.37662448930806297, 0.41749553747893614, 0.71852454736176108],
+ [0.37610001286385814, 0.41303079952477062, 0.71709396919920232],
+ [0.37560846919442398, 0.40855267638072096, 0.71562585091587549],
+ [0.37514802505380473, 0.4040612609993941, 0.7141193695725726],
+ [0.37471686019302231, 0.3995566498711684, 0.71257368516500463],
+ [0.37431313199312338, 0.39503894828283309, 0.71098796522377461],
+ [0.37393499330475782, 0.39050827529375831, 0.70936134293478448],
+ [0.3735806215098284, 0.38596474386057539, 0.70769297607310577],
+ [0.37324816143326384, 0.38140848555753937, 0.70598200974806036],
+ [0.37293578646665032, 0.37683963835219841, 0.70422755780589941],
+ [0.37264166757849604, 0.37225835004836849, 0.7024287314570723],
+ [0.37236397858465387, 0.36766477862108266, 0.70058463496520773],
+ [0.37210089702443822, 0.36305909736982378, 0.69869434615073722],
+ [0.3718506155898596, 0.35844148285875221, 0.69675695810256544],
+ [0.37161133234400479, 0.3538121372967869, 0.69477149919380887],
+ [0.37138124223736607, 0.34917126878479027, 0.69273703471928827],
+ [0.37115856636209105, 0.34451911410230168, 0.69065253586464992],
+ [0.37094151551337329, 0.33985591488818123, 0.68851703379505125],
+ [0.37072833279422668, 0.33518193808489577, 0.68632948169606767],
+ [0.37051738634484427, 0.33049741244307851, 0.68408888788857214],
+ [0.37030682071842685, 0.32580269697872455, 0.68179411684486679],
+ [0.37009487130772695, 0.3210981375964933, 0.67944405399056851],
+ [0.36987980329025361, 0.31638410101153364, 0.67703755438090574],
+ [0.36965987626565955, 0.31166098762951971, 0.67457344743419545],
+ [0.36943334591276228, 0.30692923551862339, 0.67205052849120617],
+ [0.36919847837592484, 0.30218932176507068, 0.66946754331614522],
+ [0.36895355306596778, 0.29744175492366276, 0.66682322089824264],
+ [0.36869682231895268, 0.29268709856150099, 0.66411625298236909],
+ [0.36842655638020444, 0.28792596437778462, 0.66134526910944602],
+ [0.36814101479899719, 0.28315901221182987, 0.65850888806972308],
+ [0.36783843696531082, 0.27838697181297761, 0.65560566838453704],
+ [0.36751707094367697, 0.27361063317090978, 0.65263411711618635],
+ [0.36717513650699446, 0.26883085667326956, 0.64959272297892245],
+ [0.36681085540107988, 0.26404857724525643, 0.64647991652908243],
+ [0.36642243251550632, 0.25926481158628106, 0.64329409140765537],
+ [0.36600853966739794, 0.25448043878086224, 0.64003361803368586],
+ [0.36556698373538982, 0.24969683475296395, 0.63669675187488584],
+ [0.36509579845886808, 0.24491536803550484, 0.63328173520055586],
+ [0.36459308890125008, 0.24013747024823828, 0.62978680155026101],
+ [0.36405693022088509, 0.23536470386204195, 0.62621013451953023],
+ [0.36348537610385145, 0.23059876218396419, 0.62254988622392882],
+ [0.36287643560041027, 0.22584149293287031, 0.61880417410823019],
+ [0.36222809558295926, 0.22109488427338303, 0.61497112346096128],
+ [0.36153829010998356, 0.21636111429594002, 0.61104880679640927],
+ [0.36080493826624654, 0.21164251793458128, 0.60703532172064711],
+ [0.36002681809096376, 0.20694122817889948, 0.60292845431916875],
+ [0.35920088560930186, 0.20226037920758122, 0.5987265295935138],
+ [0.35832489966617809, 0.197602942459778, 0.59442768517501066],
+ [0.35739663292915563, 0.19297208197842461, 0.59003011251063131],
+ [0.35641381143126327, 0.18837119869242164, 0.5855320765920552],
+ [0.35537415306906722, 0.18380392577704466, 0.58093191431832802],
+ [0.35427534960663759, 0.17927413271618647, 0.57622809660668717],
+ [0.35311574421123737, 0.17478570377561287, 0.57141871523555288],
+ [0.35189248608873791, 0.17034320478524959, 0.56650284911216653],
+ [0.35060304441931012, 0.16595129984720861, 0.56147964703993225],
+ [0.34924513554955644, 0.16161477763045118, 0.55634837474163779],
+ [0.34781653238777782, 0.15733863511152979, 0.55110853452703257],
+ [0.34631507175793091, 0.15312802296627787, 0.5457599924248665],
+ [0.34473901574536375, 0.14898820589826409, 0.54030245920406539],
+ [0.34308600291572294, 0.14492465359918028, 0.53473704282067103],
+ [0.34135411074506483, 0.1409427920655632, 0.52906500940336754],
+ [0.33954168752669694, 0.13704801896718169, 0.52328797535085236],
+ [0.33764732090671112, 0.13324562282438077, 0.51740807573979475],
+ [0.33566978565015315, 0.12954074251271822, 0.51142807215168951],
+ [0.33360804901486002, 0.12593818301005921, 0.50535164796654897],
+ [0.33146154891145124, 0.12244245263391232, 0.49918274588431072],
+ [0.32923005203231409, 0.11905764321981127, 0.49292595612342666],
+ [0.3269137124539796, 0.1157873496841953, 0.48658646495697461],
+ [0.32451307931207785, 0.11263459791730848, 0.48017007211645196],
+ [0.32202882276069322, 0.10960114111258401, 0.47368494725726878],
+ [0.31946262395497965, 0.10668879882392659, 0.46713728801395243],
+ [0.31681648089023501, 0.10389861387653518, 0.46053414662739794],
+ [0.31409278414755532, 0.10123077676403242, 0.45388335612058467],
+ [0.31129434479712365, 0.098684771934052201, 0.44719313715161618],
+ [0.30842444457210105, 0.096259385340577736, 0.44047194882050544],
+ [0.30548675819945936, 0.093952764840823738, 0.43372849999361113],
+ [0.30248536364574252, 0.091761187397303601, 0.42697404043749887],
+ [0.29942483960214772, 0.089682253716750038, 0.42021619665853854],
+ [0.29631000388905288, 0.087713250960463951, 0.41346259134143476],
+ [0.29314593096985248, 0.085850656889620708, 0.40672178082365834],
+ [0.28993792445176608, 0.08409078829085731, 0.40000214725256295],
+ [0.28669151388283165, 0.082429873848480689, 0.39331182532243375],
+ [0.28341239797185225, 0.080864153365499375, 0.38665868550105914],
+ [0.28010638576975472, 0.079389994802261526, 0.38005028528138707],
+ [0.27677939615815589, 0.078003941033788216, 0.37349382846504675],
+ [0.27343739342450812, 0.076702800237496066, 0.36699616136347685],
+ [0.27008637749114051, 0.075483675584275545, 0.36056376228111864],
+ [0.26673233211995284, 0.074344018028546205, 0.35420276066240958],
+ [0.26338121807151404, 0.073281657939897077, 0.34791888996380105],
+ [0.26003895187439957, 0.072294781043362205, 0.3417175669546984],
+ [0.25671191651083902, 0.071380106242082242, 0.33560648984600089],
+ [0.25340685873736807, 0.070533582926851829, 0.3295945757321303],
+ [0.25012845306199383, 0.069758206429106989, 0.32368100685760637],
+ [0.24688226237958999, 0.069053639449204451, 0.31786993834254956],
+ [0.24367372557466271, 0.068419855150922693, 0.31216524050888372],
+ [0.24050813332295939, 0.067857103814855602, 0.30657054493678321],
+ [0.23739062429054825, 0.067365888050555517, 0.30108922184065873],
+ [0.23433055727563878, 0.066935599661639394, 0.29574009929867601],
+ [0.23132955273021344, 0.066576186939090592, 0.29051361067988485],
+ [0.2283917709422868, 0.06628997924139618, 0.28541074411068496],
+ [0.22552164337737857, 0.066078173119395595, 0.28043398847505197],
+ [0.22272706739121817, 0.065933790675651943, 0.27559714652053702],
+ [0.22001251100779617, 0.065857918918907604, 0.27090279994325861],
+ [0.21737845072382705, 0.065859661233562045, 0.26634209349669508],
+ [0.21482843531473683, 0.065940385613778491, 0.26191675992376573],
+ [0.21237411048541005, 0.066085024661758446, 0.25765165093569542],
+ [0.21001214221188125, 0.066308573918947178, 0.2535289048041211],
+ [0.2077442377448806, 0.06661453200418091, 0.24954644291943817],
+ [0.20558051999470117, 0.066990462397868739, 0.24572497420147632],
+ [0.20352007949514977, 0.067444179612424215, 0.24205576625191821],
+ [0.20156133764129841, 0.067983271026200248, 0.23852974228695395],
+ [0.19971571438603364, 0.068592710553704722, 0.23517094067076993],
+ [0.19794834061899208, 0.069314066071660657, 0.23194647381302336],
+ [0.1960826032659409, 0.070321227242423623, 0.22874673279569585],
+ [0.19410351363791453, 0.071608304856891569, 0.22558727307410353],
+ [0.19199449184606268, 0.073182830649273306, 0.22243385243433622],
+ [0.18975853639094634, 0.075019861862143766, 0.2193005075652994],
+ [0.18739228342697645, 0.077102096899588329, 0.21618875376309582],
+ [0.18488035509396164, 0.079425730279723883, 0.21307651648984993],
+ [0.18774482037046955, 0.077251588468039312, 0.21387448578597812],
+ [0.19049578401722037, 0.075311278416787641, 0.2146562337112265],
+ [0.1931548636579131, 0.073606819040117955, 0.21542362939081539],
+ [0.19571853588267552, 0.072157781039602742, 0.21617499187076789],
+ [0.19819343656336558, 0.070974625252738788, 0.21690975060032436],
+ [0.20058760685133747, 0.070064576149984209, 0.21762721310371608],
+ [0.20290365333558247, 0.069435248580458964, 0.21833167885096033],
+ [0.20531725273301316, 0.068919592266397572, 0.21911516689288835],
+ [0.20785704662965598, 0.068484398797025281, 0.22000133917653536],
+ [0.21052882914958676, 0.06812195249816172, 0.22098759107715404],
+ [0.2133313859647627, 0.067830148426026665, 0.22207043213024291],
+ [0.21625279838647882, 0.067616330270516389, 0.22324568672294431],
+ [0.21930503925136402, 0.067465786362940039, 0.22451023616807558],
+ [0.22247308588973624, 0.067388214053092838, 0.22585960379408354],
+ [0.2257539681670791, 0.067382132300147474, 0.22728984778098055],
+ [0.22915620278592841, 0.067434730871152565, 0.22879681433956656],
+ [0.23266299920501882, 0.067557104388479783, 0.23037617493752832],
+ [0.23627495835774248, 0.06774359820987802, 0.23202360805926608],
+ [0.23999586188690308, 0.067985029964779953, 0.23373434258507808],
+ [0.24381149720247919, 0.068289851529011875, 0.23550427698321885],
+ [0.24772092990501099, 0.068653337909486523, 0.2373288009471749],
+ [0.25172899728289466, 0.069064630826035506, 0.23920260612763083],
+ [0.25582135547481771, 0.06953231029187984, 0.24112190491594204],
+ [0.25999463887892144, 0.070053855603861875, 0.24308218808684579],
+ [0.26425512207060942, 0.070616595622995437, 0.24507758869355967],
+ [0.26859095948172862, 0.071226716277922458, 0.24710443563450618],
+ [0.27299701518897301, 0.071883555446163511, 0.24915847093232929],
+ [0.27747150809142801, 0.072582969899254779, 0.25123493995942769],
+ [0.28201746297366942, 0.073315693214040967, 0.25332800295084507],
+ [0.28662309235899847, 0.074088460826808866, 0.25543478673717029],
+ [0.29128515387578635, 0.074899049847466703, 0.25755101595750435],
+ [0.2960004726065818, 0.075745336000958424, 0.25967245030364566],
+ [0.30077276812918691, 0.076617824336164764, 0.26179294097819672],
+ [0.30559226007249934, 0.077521963107537312, 0.26391006692119662],
+ [0.31045520848595526, 0.078456871676182177, 0.2660200572779356],
+ [0.31535870009205808, 0.079420997315243186, 0.26811904076941961],
+ [0.32029986557994061, 0.080412994737554838, 0.27020322893039511],
+ [0.32527888860401261, 0.081428390076546092, 0.27226772884656186],
+ [0.33029174471181438, 0.08246763389003825, 0.27430929404579435],
+ [0.33533353224455448, 0.083532434119003962, 0.27632534356790039],
+ [0.34040164359597463, 0.084622236191702671, 0.27831254595259397],
+ [0.34549355713871799, 0.085736654965126335, 0.28026769921081435],
+ [0.35060678246032478, 0.08687555176033529, 0.28218770540182386],
+ [0.35573889947341125, 0.088038974350243354, 0.2840695897279818],
+ [0.36088752387578377, 0.089227194362745205, 0.28591050458531014],
+ [0.36605031412464006, 0.090440685427697898, 0.2877077458811747],
+ [0.37122508431309342, 0.091679997480262732, 0.28945865397633169],
+ [0.3764103053221462, 0.092945198093777909, 0.29116024157313919],
+ [0.38160247377467543, 0.094238731263712183, 0.29281107506269488],
+ [0.38679939079544168, 0.09556181960083443, 0.29440901248173756],
+ [0.39199887556812907, 0.09691583650296684, 0.29595212005509081],
+ [0.39719876876325577, 0.098302320968278623, 0.29743856476285779],
+ [0.40239692379737496, 0.099722930314950553, 0.29886674369733968],
+ [0.40759120392688708, 0.10117945586419633, 0.30023519507728602],
+ [0.41277985630360303, 0.1026734006932461, 0.30154226437468967],
+ [0.41796105205173684, 0.10420644885760968, 0.30278652039631843],
+ [0.42313214269556043, 0.10578120994917611, 0.3039675809469457],
+ [0.42829101315789753, 0.1073997763055258, 0.30508479060294547],
+ [0.4334355841041439, 0.1090642347484701, 0.30613767928289148],
+ [0.43856378187931538, 0.11077667828375456, 0.30712600062348083],
+ [0.44367358645071275, 0.11253912421257944, 0.30804973095465449],
+ [0.44876299173174822, 0.11435355574622549, 0.30890905921943196],
+ [0.45383005086999889, 0.11622183788331528, 0.30970441249844921],
+ [0.45887288947308297, 0.11814571137706886, 0.31043636979038808],
+ [0.46389102840284874, 0.12012561256850712, 0.31110343446582983],
+ [0.46888111384598413, 0.12216445576414045, 0.31170911458932665],
+ [0.473841437035254, 0.12426354237989065, 0.31225470169927194],
+ [0.47877034239726296, 0.12642401401409453, 0.31274172735821959],
+ [0.48366628618847957, 0.12864679022013889, 0.31317188565991266],
+ [0.48852847371852987, 0.13093210934893723, 0.31354553695453014],
+ [0.49335504375145617, 0.13328091630401023, 0.31386561956734976],
+ [0.49814435462074153, 0.13569380302451714, 0.314135190862664],
+ [0.50289524974970612, 0.13817086581280427, 0.31435662153833671],
+ [0.50760681181053691, 0.14071192654913128, 0.31453200120082569],
+ [0.51227835105321762, 0.14331656120063752, 0.3146630922831542],
+ [0.51690848800544464, 0.14598463068714407, 0.31475407592280041],
+ [0.52149652863229956, 0.14871544765633712, 0.31480767954534428],
+ [0.52604189625477482, 0.15150818660835483, 0.31482653406646727],
+ [0.53054420489856446, 0.15436183633886777, 0.31481299789187128],
+ [0.5350027976174474, 0.15727540775107324, 0.31477085207396532],
+ [0.53941736649199057, 0.16024769309971934, 0.31470295028655965],
+ [0.54378771313608565, 0.16327738551419116, 0.31461204226295625],
+ [0.54811370033467621, 0.1663630904279047, 0.31450102990914708],
+ [0.55239521572711914, 0.16950338809328983, 0.31437291554615371],
+ [0.55663229034969341, 0.17269677158182117, 0.31423043195101424],
+ [0.56082499039117173, 0.17594170887918095, 0.31407639883970623],
+ [0.56497343529017696, 0.17923664950367169, 0.3139136046337036],
+ [0.56907784784011428, 0.18258004462335425, 0.31374440956796529],
+ [0.57313845754107873, 0.18597036007065024, 0.31357126868520002],
+ [0.57715550812992045, 0.18940601489760422, 0.31339704333572083],
+ [0.58112932761586555, 0.19288548904692518, 0.31322399394183942],
+ [0.58506024396466882, 0.19640737049066315, 0.31305401163732732],
+ [0.58894861935544707, 0.19997020971775276, 0.31288922211590126],
+ [0.59279480536520257, 0.20357251410079796, 0.31273234839304942],
+ [0.59659918109122367, 0.207212956082026, 0.31258523031121233],
+ [0.60036213010411577, 0.21089030138947745, 0.31244934410414688],
+ [0.60408401696732739, 0.21460331490206347, 0.31232652641170694],
+ [0.60776523994818654, 0.21835070166659282, 0.31221903291870201],
+ [0.6114062072731884, 0.22213124697023234, 0.31212881396435238],
+ [0.61500723236391375, 0.22594402043981826, 0.31205680685765741],
+ [0.61856865258877192, 0.22978799249179921, 0.31200463838728931],
+ [0.62209079821082613, 0.2336621873300741, 0.31197383273627388],
+ [0.62557416500434959, 0.23756535071152696, 0.31196698314912269],
+ [0.62901892016985872, 0.24149689191922535, 0.31198447195645718],
+ [0.63242534854210275, 0.24545598775548677, 0.31202765974624452],
+ [0.6357937104834237, 0.24944185818822678, 0.31209793953300591],
+ [0.6391243387840212, 0.25345365461983138, 0.31219689612063978],
+ [0.642417577481186, 0.257490519876798, 0.31232631707560987],
+ [0.64567349382645434, 0.26155203161615281, 0.31248673753935263],
+ [0.64889230169458245, 0.26563755336209077, 0.31267941819570189],
+ [0.65207417290277303, 0.26974650525236699, 0.31290560605819168],
+ [0.65521932609327127, 0.27387826652410152, 0.3131666792687211],
+ [0.6583280801134499, 0.27803210957665631, 0.3134643447952643],
+ [0.66140037532601781, 0.28220778870555907, 0.31379912926498488],
+ [0.66443632469878844, 0.28640483614256179, 0.31417223403606975],
+ [0.66743603766369131, 0.29062280081258873, 0.31458483752056837],
+ [0.67039959547676198, 0.29486126309253047, 0.31503813956872212],
+ [0.67332725564817331, 0.29911962764489264, 0.31553372323982209],
+ [0.67621897924409746, 0.30339762792450425, 0.3160724937230589],
+ [0.67907474028157344, 0.30769497879760166, 0.31665545668946665],
+ [0.68189457150944521, 0.31201133280550686, 0.31728380489244951],
+ [0.68467850942494535, 0.31634634821222207, 0.31795870784057567],
+ [0.68742656435169625, 0.32069970535138104, 0.31868137622277692],
+ [0.6901389321505248, 0.32507091815606004, 0.31945332332898302],
+ [0.69281544846764931, 0.32945984647042675, 0.3202754315314667],
+ [0.69545608346891119, 0.33386622163232865, 0.32114884306985791],
+ [0.6980608153581771, 0.33828976326048621, 0.32207478855218091],
+ [0.70062962477242097, 0.34273019305341756, 0.32305449047765694],
+ [0.70316249458814151, 0.34718723719597999, 0.32408913679491225],
+ [0.70565951122610093, 0.35166052978120937, 0.32518014084085567],
+ [0.70812059568420482, 0.35614985523380299, 0.32632861885644465],
+ [0.7105456546582587, 0.36065500290840113, 0.32753574162788762],
+ [0.71293466839773467, 0.36517570519856757, 0.3288027427038317],
+ [0.71528760614847287, 0.36971170225223449, 0.3301308728723546],
+ [0.71760444908133847, 0.37426272710686193, 0.33152138620958932],
+ [0.71988521490549851, 0.37882848839337313, 0.33297555200245399],
+ [0.7221299918421461, 0.38340864508963057, 0.33449469983585844],
+ [0.72433865647781592, 0.38800301593162145, 0.33607995965691828],
+ [0.72651122900227549, 0.3926113126792577, 0.3377325942005665],
+ [0.72864773856716547, 0.39723324476747235, 0.33945384341064017],
+ [0.73074820754845171, 0.401868526884681, 0.3412449533046818],
+ [0.73281270506268747, 0.4065168468778026, 0.34310715173410822],
+ [0.73484133598564938, 0.41117787004519513, 0.34504169470809071],
+ [0.73683422173585866, 0.41585125850290111, 0.34704978520758401],
+ [0.73879140024599266, 0.42053672992315327, 0.34913260148542435],
+ [0.74071301619506091, 0.4252339389526239, 0.35129130890802607],
+ [0.7425992159973317, 0.42994254036133867, 0.35352709245374592],
+ [0.74445018676570673, 0.43466217184617112, 0.35584108091122535],
+ [0.74626615789163442, 0.43939245044973502, 0.35823439142300639],
+ [0.74804739275559562, 0.44413297780351974, 0.36070813602540136],
+ [0.74979420547170472, 0.44888333481548809, 0.36326337558360278],
+ [0.75150685045891663, 0.45364314496866825, 0.36590112443835765],
+ [0.75318566369046569, 0.45841199172949604, 0.36862236642234769],
+ [0.75483105066959544, 0.46318942799460555, 0.3714280448394211],
+ [0.75644341577140706, 0.46797501437948458, 0.37431909037543515],
+ [0.75802325538455839, 0.4727682731566229, 0.37729635531096678],
+ [0.75957111105340058, 0.47756871222057079, 0.380360657784311],
+ [0.7610876378057071, 0.48237579130289127, 0.38351275723852291],
+ [0.76257333554052609, 0.48718906673415824, 0.38675335037837993],
+ [0.76402885609288662, 0.49200802533379656, 0.39008308392311997],
+ [0.76545492593330511, 0.49683212909727231, 0.39350254000115381],
+ [0.76685228950643891, 0.5016608471009063, 0.39701221751773474],
+ [0.76822176599735303, 0.50649362371287909, 0.40061257089416885],
+ [0.7695642334401418, 0.5113298901696085, 0.40430398069682483],
+ [0.77088091962302474, 0.51616892643469103, 0.40808667584648967],
+ [0.77217257229605551, 0.5210102658711383, 0.41196089987122869],
+ [0.77344021829889886, 0.52585332093451564, 0.41592679539764366],
+ [0.77468494746063199, 0.53069749384776732, 0.41998440356963762],
+ [0.77590790730685699, 0.53554217882461186, 0.42413367909988375],
+ [0.7771103295521099, 0.54038674910561235, 0.42837450371258479],
+ [0.77829345807633121, 0.54523059488426595, 0.432706647838971],
+ [0.77945862731506643, 0.55007308413977274, 0.43712979856444761],
+ [0.78060774749483774, 0.55491335744890613, 0.44164332426364639],
+ [0.78174180478981836, 0.55975098052594863, 0.44624687186865436],
+ [0.78286225264440912, 0.56458533111166875, 0.45093985823706345],
+ [0.78397060836414478, 0.56941578326710418, 0.45572154742892063],
+ [0.78506845019606841, 0.5742417003617839, 0.46059116206904965],
+ [0.78615737132332963, 0.5790624629815756, 0.46554778281918402],
+ [0.78723904108188347, 0.58387743744557208, 0.47059039582133383],
+ [0.78831514045623963, 0.58868600173562435, 0.47571791879076081],
+ [0.78938737766251943, 0.5934875421745599, 0.48092913815357724],
+ [0.79045776847727878, 0.59828134277062461, 0.48622257801969754],
+ [0.79152832843475607, 0.60306670593147205, 0.49159667021646397],
+ [0.79260034304237448, 0.60784322087037024, 0.49705020621532009],
+ [0.79367559698664958, 0.61261029334072192, 0.50258161291269432],
+ [0.79475585972654039, 0.61736734400220705, 0.50818921213102985],
+ [0.79584292379583765, 0.62211378808451145, 0.51387124091909786],
+ [0.79693854719951607, 0.62684905679296699, 0.5196258425240281],
+ [0.79804447815136637, 0.63157258225089552, 0.52545108144834785],
+ [0.7991624518501963, 0.63628379372029187, 0.53134495942561433],
+ [0.80029415389753977, 0.64098213306749863, 0.53730535185141037],
+ [0.80144124292560048, 0.64566703459218766, 0.5433300863249918],
+ [0.80260531146112946, 0.65033793748103852, 0.54941691584603647],
+ [0.80378792531077625, 0.65499426549472628, 0.55556350867083815],
+ [0.80499054790810298, 0.65963545027564163, 0.56176745110546977],
+ [0.80621460526927058, 0.66426089585282289, 0.56802629178649788],
+ [0.8074614045096935, 0.6688700095398864, 0.57433746373459582],
+ [0.80873219170089694, 0.67346216702194517, 0.58069834805576737],
+ [0.81002809466520687, 0.67803672673971815, 0.58710626908082753],
+ [0.81135014011763329, 0.68259301546243389, 0.59355848909050757],
+ [0.81269922039881493, 0.68713033714618876, 0.60005214820435104],
+ [0.81407611046993344, 0.69164794791482131, 0.6065843782630862],
+ [0.81548146627279483, 0.69614505508308089, 0.61315221209322646],
+ [0.81691575775055891, 0.70062083014783982, 0.61975260637257923],
+ [0.81837931164498223, 0.70507438189635097, 0.62638245478933297],
+ [0.81987230650455289, 0.70950474978787481, 0.63303857040067113],
+ [0.8213947205565636, 0.7139109141951604, 0.63971766697672761],
+ [0.82294635110428427, 0.71829177331290062, 0.6464164243818421],
+ [0.8245268129450285, 0.72264614312088882, 0.65313137915422603],
+ [0.82613549710580259, 0.72697275518238258, 0.65985900156216504],
+ [0.8277716072353446, 0.73127023324078089, 0.66659570204682972],
+ [0.82943407816481474, 0.7355371221572935, 0.67333772009301907],
+ [0.83112163529096306, 0.73977184647638616, 0.68008125203631464],
+ [0.83283277185777982, 0.74397271817459876, 0.68682235874648545],
+ [0.8345656905566583, 0.7481379479992134, 0.69355697649863846],
+ [0.83631898844737929, 0.75226548952875261, 0.70027999028864962],
+ [0.83809123476131964, 0.75635314860808633, 0.70698561390212977],
+ [0.83987839884120874, 0.76039907199779677, 0.71367147811129228],
+ [0.84167750766845151, 0.76440101200982946, 0.72033299387284622],
+ [0.84348529222933699, 0.76835660399870176, 0.72696536998972039],
+ [0.84529810731955113, 0.77226338601044719, 0.73356368240541492],
+ [0.84711195507965098, 0.77611880236047159, 0.74012275762807056],
+ [0.84892245563117641, 0.77992021407650147, 0.74663719293664366],
+ [0.85072697023178789, 0.78366457342383888, 0.7530974636118285],
+ [0.85251907207708444, 0.78734936133548439, 0.7594994148789691],
+ [0.85429219611470464, 0.79097196777091994, 0.76583801477914104],
+ [0.85604022314725403, 0.79452963601550608, 0.77210610037674143],
+ [0.85775662943504905, 0.79801963142713928, 0.77829571667247499],
+ [0.8594346370300241, 0.8014392309950078, 0.78439788751383921],
+ [0.86107117027565516, 0.80478517909812231, 0.79039529663736285],
+ [0.86265601051127572, 0.80805523804261525, 0.796282666437655],
+ [0.86418343723941027, 0.81124644224653542, 0.80204612696863953],
+ [0.86564934325605325, 0.81435544067514909, 0.80766972324164554],
+ [0.86705314907048503, 0.81737804041911244, 0.81313419626911398],
+ [0.86839954695818633, 0.82030875512181523, 0.81841638963128993],
+ [0.86969131502613806, 0.82314158859569164, 0.82350476683173168],
+ [0.87093846717297507, 0.82586857889438514, 0.82838497261149613],
+ [0.87215331978454325, 0.82848052823709672, 0.8330486712880828],
+ [0.87335171360916275, 0.83096715251272624, 0.83748851001197089],
+ [0.87453793320260187, 0.83331972948645461, 0.84171925358069011],
+ [0.87571458709961403, 0.8355302318472394, 0.84575537519027078],
+ [0.87687848451614692, 0.83759238071186537, 0.84961373549150254],
+ [0.87802298436649007, 0.83950165618540074, 0.85330645352458923],
+ [0.87913244240792765, 0.84125554884475906, 0.85685572291039636],
+ [0.88019293315695812, 0.84285224824778615, 0.86027399927156634],
+ [0.88119169871341951, 0.84429066717717349, 0.86356595168669881],
+ [0.88211542489401606, 0.84557007254559347, 0.86673765046233331],
+ [0.88295168595448525, 0.84668970275699273, 0.86979617048190971],
+ [0.88369127145898041, 0.84764891761519268, 0.87274147101441557],
+ [0.88432713054113543, 0.84844741572055415, 0.87556785228242973],
+ [0.88485138159908572, 0.84908426422893801, 0.87828235285372469],
+ [0.88525897972630474, 0.84955892810989209, 0.88088414794024839],
+ [0.88554714811952384, 0.84987174283631584, 0.88336206121170946],
+ [0.88571155122845646, 0.85002186115856315, 0.88572538990087124]]
+
+_twilight_shifted_data = (_twilight_data[len(_twilight_data)//2:] +
+ _twilight_data[:len(_twilight_data)//2])
+_twilight_shifted_data.reverse()
+_turbo_data = [[0.18995, 0.07176, 0.23217],
+ [0.19483, 0.08339, 0.26149],
+ [0.19956, 0.09498, 0.29024],
+ [0.20415, 0.10652, 0.31844],
+ [0.20860, 0.11802, 0.34607],
+ [0.21291, 0.12947, 0.37314],
+ [0.21708, 0.14087, 0.39964],
+ [0.22111, 0.15223, 0.42558],
+ [0.22500, 0.16354, 0.45096],
+ [0.22875, 0.17481, 0.47578],
+ [0.23236, 0.18603, 0.50004],
+ [0.23582, 0.19720, 0.52373],
+ [0.23915, 0.20833, 0.54686],
+ [0.24234, 0.21941, 0.56942],
+ [0.24539, 0.23044, 0.59142],
+ [0.24830, 0.24143, 0.61286],
+ [0.25107, 0.25237, 0.63374],
+ [0.25369, 0.26327, 0.65406],
+ [0.25618, 0.27412, 0.67381],
+ [0.25853, 0.28492, 0.69300],
+ [0.26074, 0.29568, 0.71162],
+ [0.26280, 0.30639, 0.72968],
+ [0.26473, 0.31706, 0.74718],
+ [0.26652, 0.32768, 0.76412],
+ [0.26816, 0.33825, 0.78050],
+ [0.26967, 0.34878, 0.79631],
+ [0.27103, 0.35926, 0.81156],
+ [0.27226, 0.36970, 0.82624],
+ [0.27334, 0.38008, 0.84037],
+ [0.27429, 0.39043, 0.85393],
+ [0.27509, 0.40072, 0.86692],
+ [0.27576, 0.41097, 0.87936],
+ [0.27628, 0.42118, 0.89123],
+ [0.27667, 0.43134, 0.90254],
+ [0.27691, 0.44145, 0.91328],
+ [0.27701, 0.45152, 0.92347],
+ [0.27698, 0.46153, 0.93309],
+ [0.27680, 0.47151, 0.94214],
+ [0.27648, 0.48144, 0.95064],
+ [0.27603, 0.49132, 0.95857],
+ [0.27543, 0.50115, 0.96594],
+ [0.27469, 0.51094, 0.97275],
+ [0.27381, 0.52069, 0.97899],
+ [0.27273, 0.53040, 0.98461],
+ [0.27106, 0.54015, 0.98930],
+ [0.26878, 0.54995, 0.99303],
+ [0.26592, 0.55979, 0.99583],
+ [0.26252, 0.56967, 0.99773],
+ [0.25862, 0.57958, 0.99876],
+ [0.25425, 0.58950, 0.99896],
+ [0.24946, 0.59943, 0.99835],
+ [0.24427, 0.60937, 0.99697],
+ [0.23874, 0.61931, 0.99485],
+ [0.23288, 0.62923, 0.99202],
+ [0.22676, 0.63913, 0.98851],
+ [0.22039, 0.64901, 0.98436],
+ [0.21382, 0.65886, 0.97959],
+ [0.20708, 0.66866, 0.97423],
+ [0.20021, 0.67842, 0.96833],
+ [0.19326, 0.68812, 0.96190],
+ [0.18625, 0.69775, 0.95498],
+ [0.17923, 0.70732, 0.94761],
+ [0.17223, 0.71680, 0.93981],
+ [0.16529, 0.72620, 0.93161],
+ [0.15844, 0.73551, 0.92305],
+ [0.15173, 0.74472, 0.91416],
+ [0.14519, 0.75381, 0.90496],
+ [0.13886, 0.76279, 0.89550],
+ [0.13278, 0.77165, 0.88580],
+ [0.12698, 0.78037, 0.87590],
+ [0.12151, 0.78896, 0.86581],
+ [0.11639, 0.79740, 0.85559],
+ [0.11167, 0.80569, 0.84525],
+ [0.10738, 0.81381, 0.83484],
+ [0.10357, 0.82177, 0.82437],
+ [0.10026, 0.82955, 0.81389],
+ [0.09750, 0.83714, 0.80342],
+ [0.09532, 0.84455, 0.79299],
+ [0.09377, 0.85175, 0.78264],
+ [0.09287, 0.85875, 0.77240],
+ [0.09267, 0.86554, 0.76230],
+ [0.09320, 0.87211, 0.75237],
+ [0.09451, 0.87844, 0.74265],
+ [0.09662, 0.88454, 0.73316],
+ [0.09958, 0.89040, 0.72393],
+ [0.10342, 0.89600, 0.71500],
+ [0.10815, 0.90142, 0.70599],
+ [0.11374, 0.90673, 0.69651],
+ [0.12014, 0.91193, 0.68660],
+ [0.12733, 0.91701, 0.67627],
+ [0.13526, 0.92197, 0.66556],
+ [0.14391, 0.92680, 0.65448],
+ [0.15323, 0.93151, 0.64308],
+ [0.16319, 0.93609, 0.63137],
+ [0.17377, 0.94053, 0.61938],
+ [0.18491, 0.94484, 0.60713],
+ [0.19659, 0.94901, 0.59466],
+ [0.20877, 0.95304, 0.58199],
+ [0.22142, 0.95692, 0.56914],
+ [0.23449, 0.96065, 0.55614],
+ [0.24797, 0.96423, 0.54303],
+ [0.26180, 0.96765, 0.52981],
+ [0.27597, 0.97092, 0.51653],
+ [0.29042, 0.97403, 0.50321],
+ [0.30513, 0.97697, 0.48987],
+ [0.32006, 0.97974, 0.47654],
+ [0.33517, 0.98234, 0.46325],
+ [0.35043, 0.98477, 0.45002],
+ [0.36581, 0.98702, 0.43688],
+ [0.38127, 0.98909, 0.42386],
+ [0.39678, 0.99098, 0.41098],
+ [0.41229, 0.99268, 0.39826],
+ [0.42778, 0.99419, 0.38575],
+ [0.44321, 0.99551, 0.37345],
+ [0.45854, 0.99663, 0.36140],
+ [0.47375, 0.99755, 0.34963],
+ [0.48879, 0.99828, 0.33816],
+ [0.50362, 0.99879, 0.32701],
+ [0.51822, 0.99910, 0.31622],
+ [0.53255, 0.99919, 0.30581],
+ [0.54658, 0.99907, 0.29581],
+ [0.56026, 0.99873, 0.28623],
+ [0.57357, 0.99817, 0.27712],
+ [0.58646, 0.99739, 0.26849],
+ [0.59891, 0.99638, 0.26038],
+ [0.61088, 0.99514, 0.25280],
+ [0.62233, 0.99366, 0.24579],
+ [0.63323, 0.99195, 0.23937],
+ [0.64362, 0.98999, 0.23356],
+ [0.65394, 0.98775, 0.22835],
+ [0.66428, 0.98524, 0.22370],
+ [0.67462, 0.98246, 0.21960],
+ [0.68494, 0.97941, 0.21602],
+ [0.69525, 0.97610, 0.21294],
+ [0.70553, 0.97255, 0.21032],
+ [0.71577, 0.96875, 0.20815],
+ [0.72596, 0.96470, 0.20640],
+ [0.73610, 0.96043, 0.20504],
+ [0.74617, 0.95593, 0.20406],
+ [0.75617, 0.95121, 0.20343],
+ [0.76608, 0.94627, 0.20311],
+ [0.77591, 0.94113, 0.20310],
+ [0.78563, 0.93579, 0.20336],
+ [0.79524, 0.93025, 0.20386],
+ [0.80473, 0.92452, 0.20459],
+ [0.81410, 0.91861, 0.20552],
+ [0.82333, 0.91253, 0.20663],
+ [0.83241, 0.90627, 0.20788],
+ [0.84133, 0.89986, 0.20926],
+ [0.85010, 0.89328, 0.21074],
+ [0.85868, 0.88655, 0.21230],
+ [0.86709, 0.87968, 0.21391],
+ [0.87530, 0.87267, 0.21555],
+ [0.88331, 0.86553, 0.21719],
+ [0.89112, 0.85826, 0.21880],
+ [0.89870, 0.85087, 0.22038],
+ [0.90605, 0.84337, 0.22188],
+ [0.91317, 0.83576, 0.22328],
+ [0.92004, 0.82806, 0.22456],
+ [0.92666, 0.82025, 0.22570],
+ [0.93301, 0.81236, 0.22667],
+ [0.93909, 0.80439, 0.22744],
+ [0.94489, 0.79634, 0.22800],
+ [0.95039, 0.78823, 0.22831],
+ [0.95560, 0.78005, 0.22836],
+ [0.96049, 0.77181, 0.22811],
+ [0.96507, 0.76352, 0.22754],
+ [0.96931, 0.75519, 0.22663],
+ [0.97323, 0.74682, 0.22536],
+ [0.97679, 0.73842, 0.22369],
+ [0.98000, 0.73000, 0.22161],
+ [0.98289, 0.72140, 0.21918],
+ [0.98549, 0.71250, 0.21650],
+ [0.98781, 0.70330, 0.21358],
+ [0.98986, 0.69382, 0.21043],
+ [0.99163, 0.68408, 0.20706],
+ [0.99314, 0.67408, 0.20348],
+ [0.99438, 0.66386, 0.19971],
+ [0.99535, 0.65341, 0.19577],
+ [0.99607, 0.64277, 0.19165],
+ [0.99654, 0.63193, 0.18738],
+ [0.99675, 0.62093, 0.18297],
+ [0.99672, 0.60977, 0.17842],
+ [0.99644, 0.59846, 0.17376],
+ [0.99593, 0.58703, 0.16899],
+ [0.99517, 0.57549, 0.16412],
+ [0.99419, 0.56386, 0.15918],
+ [0.99297, 0.55214, 0.15417],
+ [0.99153, 0.54036, 0.14910],
+ [0.98987, 0.52854, 0.14398],
+ [0.98799, 0.51667, 0.13883],
+ [0.98590, 0.50479, 0.13367],
+ [0.98360, 0.49291, 0.12849],
+ [0.98108, 0.48104, 0.12332],
+ [0.97837, 0.46920, 0.11817],
+ [0.97545, 0.45740, 0.11305],
+ [0.97234, 0.44565, 0.10797],
+ [0.96904, 0.43399, 0.10294],
+ [0.96555, 0.42241, 0.09798],
+ [0.96187, 0.41093, 0.09310],
+ [0.95801, 0.39958, 0.08831],
+ [0.95398, 0.38836, 0.08362],
+ [0.94977, 0.37729, 0.07905],
+ [0.94538, 0.36638, 0.07461],
+ [0.94084, 0.35566, 0.07031],
+ [0.93612, 0.34513, 0.06616],
+ [0.93125, 0.33482, 0.06218],
+ [0.92623, 0.32473, 0.05837],
+ [0.92105, 0.31489, 0.05475],
+ [0.91572, 0.30530, 0.05134],
+ [0.91024, 0.29599, 0.04814],
+ [0.90463, 0.28696, 0.04516],
+ [0.89888, 0.27824, 0.04243],
+ [0.89298, 0.26981, 0.03993],
+ [0.88691, 0.26152, 0.03753],
+ [0.88066, 0.25334, 0.03521],
+ [0.87422, 0.24526, 0.03297],
+ [0.86760, 0.23730, 0.03082],
+ [0.86079, 0.22945, 0.02875],
+ [0.85380, 0.22170, 0.02677],
+ [0.84662, 0.21407, 0.02487],
+ [0.83926, 0.20654, 0.02305],
+ [0.83172, 0.19912, 0.02131],
+ [0.82399, 0.19182, 0.01966],
+ [0.81608, 0.18462, 0.01809],
+ [0.80799, 0.17753, 0.01660],
+ [0.79971, 0.17055, 0.01520],
+ [0.79125, 0.16368, 0.01387],
+ [0.78260, 0.15693, 0.01264],
+ [0.77377, 0.15028, 0.01148],
+ [0.76476, 0.14374, 0.01041],
+ [0.75556, 0.13731, 0.00942],
+ [0.74617, 0.13098, 0.00851],
+ [0.73661, 0.12477, 0.00769],
+ [0.72686, 0.11867, 0.00695],
+ [0.71692, 0.11268, 0.00629],
+ [0.70680, 0.10680, 0.00571],
+ [0.69650, 0.10102, 0.00522],
+ [0.68602, 0.09536, 0.00481],
+ [0.67535, 0.08980, 0.00449],
+ [0.66449, 0.08436, 0.00424],
+ [0.65345, 0.07902, 0.00408],
+ [0.64223, 0.07380, 0.00401],
+ [0.63082, 0.06868, 0.00401],
+ [0.61923, 0.06367, 0.00410],
+ [0.60746, 0.05878, 0.00427],
+ [0.59550, 0.05399, 0.00453],
+ [0.58336, 0.04931, 0.00486],
+ [0.57103, 0.04474, 0.00529],
+ [0.55852, 0.04028, 0.00579],
+ [0.54583, 0.03593, 0.00638],
+ [0.53295, 0.03169, 0.00705],
+ [0.51989, 0.02756, 0.00780],
+ [0.50664, 0.02354, 0.00863],
+ [0.49321, 0.01963, 0.00955],
+ [0.47960, 0.01583, 0.01055]]
+
+
+cmaps = {
+ name: ListedColormap(data, name=name) for name, data in [
+ ('magma', _magma_data),
+ ('inferno', _inferno_data),
+ ('plasma', _plasma_data),
+ ('viridis', _viridis_data),
+ ('cividis', _cividis_data),
+ ('twilight', _twilight_data),
+ ('twilight_shifted', _twilight_shifted_data),
+ ('turbo', _turbo_data),
+ ]}
diff --git a/venv/Lib/site-packages/matplotlib/_color_data.py b/venv/Lib/site-packages/matplotlib/_color_data.py
new file mode 100644
index 0000000..e50998b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_color_data.py
@@ -0,0 +1,1147 @@
+from collections import OrderedDict
+
+
+BASE_COLORS = {
+ 'b': (0, 0, 1), # blue
+ 'g': (0, 0.5, 0), # green
+ 'r': (1, 0, 0), # red
+ 'c': (0, 0.75, 0.75), # cyan
+ 'm': (0.75, 0, 0.75), # magenta
+ 'y': (0.75, 0.75, 0), # yellow
+ 'k': (0, 0, 0), # black
+ 'w': (1, 1, 1), # white
+}
+
+
+# These colors are from Tableau
+TABLEAU_COLORS = (
+ ('blue', '#1f77b4'),
+ ('orange', '#ff7f0e'),
+ ('green', '#2ca02c'),
+ ('red', '#d62728'),
+ ('purple', '#9467bd'),
+ ('brown', '#8c564b'),
+ ('pink', '#e377c2'),
+ ('gray', '#7f7f7f'),
+ ('olive', '#bcbd22'),
+ ('cyan', '#17becf'),
+)
+
+# Normalize name to "tab:" to avoid name collisions.
+TABLEAU_COLORS = OrderedDict(
+ ('tab:' + name, value) for name, value in TABLEAU_COLORS)
+
+# This mapping of color names -> hex values is taken from
+# a survey run by Randall Munroe see:
+# https://blog.xkcd.com/2010/05/03/color-survey-results/
+# for more details. The results are hosted at
+# https://xkcd.com/color/rgb
+# and also available as a text file at
+# https://xkcd.com/color/rgb.txt
+#
+# License: http://creativecommons.org/publicdomain/zero/1.0/
+XKCD_COLORS = {
+ 'cloudy blue': '#acc2d9',
+ 'dark pastel green': '#56ae57',
+ 'dust': '#b2996e',
+ 'electric lime': '#a8ff04',
+ 'fresh green': '#69d84f',
+ 'light eggplant': '#894585',
+ 'nasty green': '#70b23f',
+ 'really light blue': '#d4ffff',
+ 'tea': '#65ab7c',
+ 'warm purple': '#952e8f',
+ 'yellowish tan': '#fcfc81',
+ 'cement': '#a5a391',
+ 'dark grass green': '#388004',
+ 'dusty teal': '#4c9085',
+ 'grey teal': '#5e9b8a',
+ 'macaroni and cheese': '#efb435',
+ 'pinkish tan': '#d99b82',
+ 'spruce': '#0a5f38',
+ 'strong blue': '#0c06f7',
+ 'toxic green': '#61de2a',
+ 'windows blue': '#3778bf',
+ 'blue blue': '#2242c7',
+ 'blue with a hint of purple': '#533cc6',
+ 'booger': '#9bb53c',
+ 'bright sea green': '#05ffa6',
+ 'dark green blue': '#1f6357',
+ 'deep turquoise': '#017374',
+ 'green teal': '#0cb577',
+ 'strong pink': '#ff0789',
+ 'bland': '#afa88b',
+ 'deep aqua': '#08787f',
+ 'lavender pink': '#dd85d7',
+ 'light moss green': '#a6c875',
+ 'light seafoam green': '#a7ffb5',
+ 'olive yellow': '#c2b709',
+ 'pig pink': '#e78ea5',
+ 'deep lilac': '#966ebd',
+ 'desert': '#ccad60',
+ 'dusty lavender': '#ac86a8',
+ 'purpley grey': '#947e94',
+ 'purply': '#983fb2',
+ 'candy pink': '#ff63e9',
+ 'light pastel green': '#b2fba5',
+ 'boring green': '#63b365',
+ 'kiwi green': '#8ee53f',
+ 'light grey green': '#b7e1a1',
+ 'orange pink': '#ff6f52',
+ 'tea green': '#bdf8a3',
+ 'very light brown': '#d3b683',
+ 'egg shell': '#fffcc4',
+ 'eggplant purple': '#430541',
+ 'powder pink': '#ffb2d0',
+ 'reddish grey': '#997570',
+ 'baby shit brown': '#ad900d',
+ 'liliac': '#c48efd',
+ 'stormy blue': '#507b9c',
+ 'ugly brown': '#7d7103',
+ 'custard': '#fffd78',
+ 'darkish pink': '#da467d',
+ 'deep brown': '#410200',
+ 'greenish beige': '#c9d179',
+ 'manilla': '#fffa86',
+ 'off blue': '#5684ae',
+ 'battleship grey': '#6b7c85',
+ 'browny green': '#6f6c0a',
+ 'bruise': '#7e4071',
+ 'kelley green': '#009337',
+ 'sickly yellow': '#d0e429',
+ 'sunny yellow': '#fff917',
+ 'azul': '#1d5dec',
+ 'darkgreen': '#054907',
+ 'green/yellow': '#b5ce08',
+ 'lichen': '#8fb67b',
+ 'light light green': '#c8ffb0',
+ 'pale gold': '#fdde6c',
+ 'sun yellow': '#ffdf22',
+ 'tan green': '#a9be70',
+ 'burple': '#6832e3',
+ 'butterscotch': '#fdb147',
+ 'toupe': '#c7ac7d',
+ 'dark cream': '#fff39a',
+ 'indian red': '#850e04',
+ 'light lavendar': '#efc0fe',
+ 'poison green': '#40fd14',
+ 'baby puke green': '#b6c406',
+ 'bright yellow green': '#9dff00',
+ 'charcoal grey': '#3c4142',
+ 'squash': '#f2ab15',
+ 'cinnamon': '#ac4f06',
+ 'light pea green': '#c4fe82',
+ 'radioactive green': '#2cfa1f',
+ 'raw sienna': '#9a6200',
+ 'baby purple': '#ca9bf7',
+ 'cocoa': '#875f42',
+ 'light royal blue': '#3a2efe',
+ 'orangeish': '#fd8d49',
+ 'rust brown': '#8b3103',
+ 'sand brown': '#cba560',
+ 'swamp': '#698339',
+ 'tealish green': '#0cdc73',
+ 'burnt siena': '#b75203',
+ 'camo': '#7f8f4e',
+ 'dusk blue': '#26538d',
+ 'fern': '#63a950',
+ 'old rose': '#c87f89',
+ 'pale light green': '#b1fc99',
+ 'peachy pink': '#ff9a8a',
+ 'rosy pink': '#f6688e',
+ 'light bluish green': '#76fda8',
+ 'light bright green': '#53fe5c',
+ 'light neon green': '#4efd54',
+ 'light seafoam': '#a0febf',
+ 'tiffany blue': '#7bf2da',
+ 'washed out green': '#bcf5a6',
+ 'browny orange': '#ca6b02',
+ 'nice blue': '#107ab0',
+ 'sapphire': '#2138ab',
+ 'greyish teal': '#719f91',
+ 'orangey yellow': '#fdb915',
+ 'parchment': '#fefcaf',
+ 'straw': '#fcf679',
+ 'very dark brown': '#1d0200',
+ 'terracota': '#cb6843',
+ 'ugly blue': '#31668a',
+ 'clear blue': '#247afd',
+ 'creme': '#ffffb6',
+ 'foam green': '#90fda9',
+ 'grey/green': '#86a17d',
+ 'light gold': '#fddc5c',
+ 'seafoam blue': '#78d1b6',
+ 'topaz': '#13bbaf',
+ 'violet pink': '#fb5ffc',
+ 'wintergreen': '#20f986',
+ 'yellow tan': '#ffe36e',
+ 'dark fuchsia': '#9d0759',
+ 'indigo blue': '#3a18b1',
+ 'light yellowish green': '#c2ff89',
+ 'pale magenta': '#d767ad',
+ 'rich purple': '#720058',
+ 'sunflower yellow': '#ffda03',
+ 'green/blue': '#01c08d',
+ 'leather': '#ac7434',
+ 'racing green': '#014600',
+ 'vivid purple': '#9900fa',
+ 'dark royal blue': '#02066f',
+ 'hazel': '#8e7618',
+ 'muted pink': '#d1768f',
+ 'booger green': '#96b403',
+ 'canary': '#fdff63',
+ 'cool grey': '#95a3a6',
+ 'dark taupe': '#7f684e',
+ 'darkish purple': '#751973',
+ 'true green': '#089404',
+ 'coral pink': '#ff6163',
+ 'dark sage': '#598556',
+ 'dark slate blue': '#214761',
+ 'flat blue': '#3c73a8',
+ 'mushroom': '#ba9e88',
+ 'rich blue': '#021bf9',
+ 'dirty purple': '#734a65',
+ 'greenblue': '#23c48b',
+ 'icky green': '#8fae22',
+ 'light khaki': '#e6f2a2',
+ 'warm blue': '#4b57db',
+ 'dark hot pink': '#d90166',
+ 'deep sea blue': '#015482',
+ 'carmine': '#9d0216',
+ 'dark yellow green': '#728f02',
+ 'pale peach': '#ffe5ad',
+ 'plum purple': '#4e0550',
+ 'golden rod': '#f9bc08',
+ 'neon red': '#ff073a',
+ 'old pink': '#c77986',
+ 'very pale blue': '#d6fffe',
+ 'blood orange': '#fe4b03',
+ 'grapefruit': '#fd5956',
+ 'sand yellow': '#fce166',
+ 'clay brown': '#b2713d',
+ 'dark blue grey': '#1f3b4d',
+ 'flat green': '#699d4c',
+ 'light green blue': '#56fca2',
+ 'warm pink': '#fb5581',
+ 'dodger blue': '#3e82fc',
+ 'gross green': '#a0bf16',
+ 'ice': '#d6fffa',
+ 'metallic blue': '#4f738e',
+ 'pale salmon': '#ffb19a',
+ 'sap green': '#5c8b15',
+ 'algae': '#54ac68',
+ 'bluey grey': '#89a0b0',
+ 'greeny grey': '#7ea07a',
+ 'highlighter green': '#1bfc06',
+ 'light light blue': '#cafffb',
+ 'light mint': '#b6ffbb',
+ 'raw umber': '#a75e09',
+ 'vivid blue': '#152eff',
+ 'deep lavender': '#8d5eb7',
+ 'dull teal': '#5f9e8f',
+ 'light greenish blue': '#63f7b4',
+ 'mud green': '#606602',
+ 'pinky': '#fc86aa',
+ 'red wine': '#8c0034',
+ 'shit green': '#758000',
+ 'tan brown': '#ab7e4c',
+ 'darkblue': '#030764',
+ 'rosa': '#fe86a4',
+ 'lipstick': '#d5174e',
+ 'pale mauve': '#fed0fc',
+ 'claret': '#680018',
+ 'dandelion': '#fedf08',
+ 'orangered': '#fe420f',
+ 'poop green': '#6f7c00',
+ 'ruby': '#ca0147',
+ 'dark': '#1b2431',
+ 'greenish turquoise': '#00fbb0',
+ 'pastel red': '#db5856',
+ 'piss yellow': '#ddd618',
+ 'bright cyan': '#41fdfe',
+ 'dark coral': '#cf524e',
+ 'algae green': '#21c36f',
+ 'darkish red': '#a90308',
+ 'reddy brown': '#6e1005',
+ 'blush pink': '#fe828c',
+ 'camouflage green': '#4b6113',
+ 'lawn green': '#4da409',
+ 'putty': '#beae8a',
+ 'vibrant blue': '#0339f8',
+ 'dark sand': '#a88f59',
+ 'purple/blue': '#5d21d0',
+ 'saffron': '#feb209',
+ 'twilight': '#4e518b',
+ 'warm brown': '#964e02',
+ 'bluegrey': '#85a3b2',
+ 'bubble gum pink': '#ff69af',
+ 'duck egg blue': '#c3fbf4',
+ 'greenish cyan': '#2afeb7',
+ 'petrol': '#005f6a',
+ 'royal': '#0c1793',
+ 'butter': '#ffff81',
+ 'dusty orange': '#f0833a',
+ 'off yellow': '#f1f33f',
+ 'pale olive green': '#b1d27b',
+ 'orangish': '#fc824a',
+ 'leaf': '#71aa34',
+ 'light blue grey': '#b7c9e2',
+ 'dried blood': '#4b0101',
+ 'lightish purple': '#a552e6',
+ 'rusty red': '#af2f0d',
+ 'lavender blue': '#8b88f8',
+ 'light grass green': '#9af764',
+ 'light mint green': '#a6fbb2',
+ 'sunflower': '#ffc512',
+ 'velvet': '#750851',
+ 'brick orange': '#c14a09',
+ 'lightish red': '#fe2f4a',
+ 'pure blue': '#0203e2',
+ 'twilight blue': '#0a437a',
+ 'violet red': '#a50055',
+ 'yellowy brown': '#ae8b0c',
+ 'carnation': '#fd798f',
+ 'muddy yellow': '#bfac05',
+ 'dark seafoam green': '#3eaf76',
+ 'deep rose': '#c74767',
+ 'dusty red': '#b9484e',
+ 'grey/blue': '#647d8e',
+ 'lemon lime': '#bffe28',
+ 'purple/pink': '#d725de',
+ 'brown yellow': '#b29705',
+ 'purple brown': '#673a3f',
+ 'wisteria': '#a87dc2',
+ 'banana yellow': '#fafe4b',
+ 'lipstick red': '#c0022f',
+ 'water blue': '#0e87cc',
+ 'brown grey': '#8d8468',
+ 'vibrant purple': '#ad03de',
+ 'baby green': '#8cff9e',
+ 'barf green': '#94ac02',
+ 'eggshell blue': '#c4fff7',
+ 'sandy yellow': '#fdee73',
+ 'cool green': '#33b864',
+ 'pale': '#fff9d0',
+ 'blue/grey': '#758da3',
+ 'hot magenta': '#f504c9',
+ 'greyblue': '#77a1b5',
+ 'purpley': '#8756e4',
+ 'baby shit green': '#889717',
+ 'brownish pink': '#c27e79',
+ 'dark aquamarine': '#017371',
+ 'diarrhea': '#9f8303',
+ 'light mustard': '#f7d560',
+ 'pale sky blue': '#bdf6fe',
+ 'turtle green': '#75b84f',
+ 'bright olive': '#9cbb04',
+ 'dark grey blue': '#29465b',
+ 'greeny brown': '#696006',
+ 'lemon green': '#adf802',
+ 'light periwinkle': '#c1c6fc',
+ 'seaweed green': '#35ad6b',
+ 'sunshine yellow': '#fffd37',
+ 'ugly purple': '#a442a0',
+ 'medium pink': '#f36196',
+ 'puke brown': '#947706',
+ 'very light pink': '#fff4f2',
+ 'viridian': '#1e9167',
+ 'bile': '#b5c306',
+ 'faded yellow': '#feff7f',
+ 'very pale green': '#cffdbc',
+ 'vibrant green': '#0add08',
+ 'bright lime': '#87fd05',
+ 'spearmint': '#1ef876',
+ 'light aquamarine': '#7bfdc7',
+ 'light sage': '#bcecac',
+ 'yellowgreen': '#bbf90f',
+ 'baby poo': '#ab9004',
+ 'dark seafoam': '#1fb57a',
+ 'deep teal': '#00555a',
+ 'heather': '#a484ac',
+ 'rust orange': '#c45508',
+ 'dirty blue': '#3f829d',
+ 'fern green': '#548d44',
+ 'bright lilac': '#c95efb',
+ 'weird green': '#3ae57f',
+ 'peacock blue': '#016795',
+ 'avocado green': '#87a922',
+ 'faded orange': '#f0944d',
+ 'grape purple': '#5d1451',
+ 'hot green': '#25ff29',
+ 'lime yellow': '#d0fe1d',
+ 'mango': '#ffa62b',
+ 'shamrock': '#01b44c',
+ 'bubblegum': '#ff6cb5',
+ 'purplish brown': '#6b4247',
+ 'vomit yellow': '#c7c10c',
+ 'pale cyan': '#b7fffa',
+ 'key lime': '#aeff6e',
+ 'tomato red': '#ec2d01',
+ 'lightgreen': '#76ff7b',
+ 'merlot': '#730039',
+ 'night blue': '#040348',
+ 'purpleish pink': '#df4ec8',
+ 'apple': '#6ecb3c',
+ 'baby poop green': '#8f9805',
+ 'green apple': '#5edc1f',
+ 'heliotrope': '#d94ff5',
+ 'yellow/green': '#c8fd3d',
+ 'almost black': '#070d0d',
+ 'cool blue': '#4984b8',
+ 'leafy green': '#51b73b',
+ 'mustard brown': '#ac7e04',
+ 'dusk': '#4e5481',
+ 'dull brown': '#876e4b',
+ 'frog green': '#58bc08',
+ 'vivid green': '#2fef10',
+ 'bright light green': '#2dfe54',
+ 'fluro green': '#0aff02',
+ 'kiwi': '#9cef43',
+ 'seaweed': '#18d17b',
+ 'navy green': '#35530a',
+ 'ultramarine blue': '#1805db',
+ 'iris': '#6258c4',
+ 'pastel orange': '#ff964f',
+ 'yellowish orange': '#ffab0f',
+ 'perrywinkle': '#8f8ce7',
+ 'tealish': '#24bca8',
+ 'dark plum': '#3f012c',
+ 'pear': '#cbf85f',
+ 'pinkish orange': '#ff724c',
+ 'midnight purple': '#280137',
+ 'light urple': '#b36ff6',
+ 'dark mint': '#48c072',
+ 'greenish tan': '#bccb7a',
+ 'light burgundy': '#a8415b',
+ 'turquoise blue': '#06b1c4',
+ 'ugly pink': '#cd7584',
+ 'sandy': '#f1da7a',
+ 'electric pink': '#ff0490',
+ 'muted purple': '#805b87',
+ 'mid green': '#50a747',
+ 'greyish': '#a8a495',
+ 'neon yellow': '#cfff04',
+ 'banana': '#ffff7e',
+ 'carnation pink': '#ff7fa7',
+ 'tomato': '#ef4026',
+ 'sea': '#3c9992',
+ 'muddy brown': '#886806',
+ 'turquoise green': '#04f489',
+ 'buff': '#fef69e',
+ 'fawn': '#cfaf7b',
+ 'muted blue': '#3b719f',
+ 'pale rose': '#fdc1c5',
+ 'dark mint green': '#20c073',
+ 'amethyst': '#9b5fc0',
+ 'blue/green': '#0f9b8e',
+ 'chestnut': '#742802',
+ 'sick green': '#9db92c',
+ 'pea': '#a4bf20',
+ 'rusty orange': '#cd5909',
+ 'stone': '#ada587',
+ 'rose red': '#be013c',
+ 'pale aqua': '#b8ffeb',
+ 'deep orange': '#dc4d01',
+ 'earth': '#a2653e',
+ 'mossy green': '#638b27',
+ 'grassy green': '#419c03',
+ 'pale lime green': '#b1ff65',
+ 'light grey blue': '#9dbcd4',
+ 'pale grey': '#fdfdfe',
+ 'asparagus': '#77ab56',
+ 'blueberry': '#464196',
+ 'purple red': '#990147',
+ 'pale lime': '#befd73',
+ 'greenish teal': '#32bf84',
+ 'caramel': '#af6f09',
+ 'deep magenta': '#a0025c',
+ 'light peach': '#ffd8b1',
+ 'milk chocolate': '#7f4e1e',
+ 'ocher': '#bf9b0c',
+ 'off green': '#6ba353',
+ 'purply pink': '#f075e6',
+ 'lightblue': '#7bc8f6',
+ 'dusky blue': '#475f94',
+ 'golden': '#f5bf03',
+ 'light beige': '#fffeb6',
+ 'butter yellow': '#fffd74',
+ 'dusky purple': '#895b7b',
+ 'french blue': '#436bad',
+ 'ugly yellow': '#d0c101',
+ 'greeny yellow': '#c6f808',
+ 'orangish red': '#f43605',
+ 'shamrock green': '#02c14d',
+ 'orangish brown': '#b25f03',
+ 'tree green': '#2a7e19',
+ 'deep violet': '#490648',
+ 'gunmetal': '#536267',
+ 'blue/purple': '#5a06ef',
+ 'cherry': '#cf0234',
+ 'sandy brown': '#c4a661',
+ 'warm grey': '#978a84',
+ 'dark indigo': '#1f0954',
+ 'midnight': '#03012d',
+ 'bluey green': '#2bb179',
+ 'grey pink': '#c3909b',
+ 'soft purple': '#a66fb5',
+ 'blood': '#770001',
+ 'brown red': '#922b05',
+ 'medium grey': '#7d7f7c',
+ 'berry': '#990f4b',
+ 'poo': '#8f7303',
+ 'purpley pink': '#c83cb9',
+ 'light salmon': '#fea993',
+ 'snot': '#acbb0d',
+ 'easter purple': '#c071fe',
+ 'light yellow green': '#ccfd7f',
+ 'dark navy blue': '#00022e',
+ 'drab': '#828344',
+ 'light rose': '#ffc5cb',
+ 'rouge': '#ab1239',
+ 'purplish red': '#b0054b',
+ 'slime green': '#99cc04',
+ 'baby poop': '#937c00',
+ 'irish green': '#019529',
+ 'pink/purple': '#ef1de7',
+ 'dark navy': '#000435',
+ 'greeny blue': '#42b395',
+ 'light plum': '#9d5783',
+ 'pinkish grey': '#c8aca9',
+ 'dirty orange': '#c87606',
+ 'rust red': '#aa2704',
+ 'pale lilac': '#e4cbff',
+ 'orangey red': '#fa4224',
+ 'primary blue': '#0804f9',
+ 'kermit green': '#5cb200',
+ 'brownish purple': '#76424e',
+ 'murky green': '#6c7a0e',
+ 'wheat': '#fbdd7e',
+ 'very dark purple': '#2a0134',
+ 'bottle green': '#044a05',
+ 'watermelon': '#fd4659',
+ 'deep sky blue': '#0d75f8',
+ 'fire engine red': '#fe0002',
+ 'yellow ochre': '#cb9d06',
+ 'pumpkin orange': '#fb7d07',
+ 'pale olive': '#b9cc81',
+ 'light lilac': '#edc8ff',
+ 'lightish green': '#61e160',
+ 'carolina blue': '#8ab8fe',
+ 'mulberry': '#920a4e',
+ 'shocking pink': '#fe02a2',
+ 'auburn': '#9a3001',
+ 'bright lime green': '#65fe08',
+ 'celadon': '#befdb7',
+ 'pinkish brown': '#b17261',
+ 'poo brown': '#885f01',
+ 'bright sky blue': '#02ccfe',
+ 'celery': '#c1fd95',
+ 'dirt brown': '#836539',
+ 'strawberry': '#fb2943',
+ 'dark lime': '#84b701',
+ 'copper': '#b66325',
+ 'medium brown': '#7f5112',
+ 'muted green': '#5fa052',
+ "robin's egg": '#6dedfd',
+ 'bright aqua': '#0bf9ea',
+ 'bright lavender': '#c760ff',
+ 'ivory': '#ffffcb',
+ 'very light purple': '#f6cefc',
+ 'light navy': '#155084',
+ 'pink red': '#f5054f',
+ 'olive brown': '#645403',
+ 'poop brown': '#7a5901',
+ 'mustard green': '#a8b504',
+ 'ocean green': '#3d9973',
+ 'very dark blue': '#000133',
+ 'dusty green': '#76a973',
+ 'light navy blue': '#2e5a88',
+ 'minty green': '#0bf77d',
+ 'adobe': '#bd6c48',
+ 'barney': '#ac1db8',
+ 'jade green': '#2baf6a',
+ 'bright light blue': '#26f7fd',
+ 'light lime': '#aefd6c',
+ 'dark khaki': '#9b8f55',
+ 'orange yellow': '#ffad01',
+ 'ocre': '#c69c04',
+ 'maize': '#f4d054',
+ 'faded pink': '#de9dac',
+ 'british racing green': '#05480d',
+ 'sandstone': '#c9ae74',
+ 'mud brown': '#60460f',
+ 'light sea green': '#98f6b0',
+ 'robin egg blue': '#8af1fe',
+ 'aqua marine': '#2ee8bb',
+ 'dark sea green': '#11875d',
+ 'soft pink': '#fdb0c0',
+ 'orangey brown': '#b16002',
+ 'cherry red': '#f7022a',
+ 'burnt yellow': '#d5ab09',
+ 'brownish grey': '#86775f',
+ 'camel': '#c69f59',
+ 'purplish grey': '#7a687f',
+ 'marine': '#042e60',
+ 'greyish pink': '#c88d94',
+ 'pale turquoise': '#a5fbd5',
+ 'pastel yellow': '#fffe71',
+ 'bluey purple': '#6241c7',
+ 'canary yellow': '#fffe40',
+ 'faded red': '#d3494e',
+ 'sepia': '#985e2b',
+ 'coffee': '#a6814c',
+ 'bright magenta': '#ff08e8',
+ 'mocha': '#9d7651',
+ 'ecru': '#feffca',
+ 'purpleish': '#98568d',
+ 'cranberry': '#9e003a',
+ 'darkish green': '#287c37',
+ 'brown orange': '#b96902',
+ 'dusky rose': '#ba6873',
+ 'melon': '#ff7855',
+ 'sickly green': '#94b21c',
+ 'silver': '#c5c9c7',
+ 'purply blue': '#661aee',
+ 'purpleish blue': '#6140ef',
+ 'hospital green': '#9be5aa',
+ 'shit brown': '#7b5804',
+ 'mid blue': '#276ab3',
+ 'amber': '#feb308',
+ 'easter green': '#8cfd7e',
+ 'soft blue': '#6488ea',
+ 'cerulean blue': '#056eee',
+ 'golden brown': '#b27a01',
+ 'bright turquoise': '#0ffef9',
+ 'red pink': '#fa2a55',
+ 'red purple': '#820747',
+ 'greyish brown': '#7a6a4f',
+ 'vermillion': '#f4320c',
+ 'russet': '#a13905',
+ 'steel grey': '#6f828a',
+ 'lighter purple': '#a55af4',
+ 'bright violet': '#ad0afd',
+ 'prussian blue': '#004577',
+ 'slate green': '#658d6d',
+ 'dirty pink': '#ca7b80',
+ 'dark blue green': '#005249',
+ 'pine': '#2b5d34',
+ 'yellowy green': '#bff128',
+ 'dark gold': '#b59410',
+ 'bluish': '#2976bb',
+ 'darkish blue': '#014182',
+ 'dull red': '#bb3f3f',
+ 'pinky red': '#fc2647',
+ 'bronze': '#a87900',
+ 'pale teal': '#82cbb2',
+ 'military green': '#667c3e',
+ 'barbie pink': '#fe46a5',
+ 'bubblegum pink': '#fe83cc',
+ 'pea soup green': '#94a617',
+ 'dark mustard': '#a88905',
+ 'shit': '#7f5f00',
+ 'medium purple': '#9e43a2',
+ 'very dark green': '#062e03',
+ 'dirt': '#8a6e45',
+ 'dusky pink': '#cc7a8b',
+ 'red violet': '#9e0168',
+ 'lemon yellow': '#fdff38',
+ 'pistachio': '#c0fa8b',
+ 'dull yellow': '#eedc5b',
+ 'dark lime green': '#7ebd01',
+ 'denim blue': '#3b5b92',
+ 'teal blue': '#01889f',
+ 'lightish blue': '#3d7afd',
+ 'purpley blue': '#5f34e7',
+ 'light indigo': '#6d5acf',
+ 'swamp green': '#748500',
+ 'brown green': '#706c11',
+ 'dark maroon': '#3c0008',
+ 'hot purple': '#cb00f5',
+ 'dark forest green': '#002d04',
+ 'faded blue': '#658cbb',
+ 'drab green': '#749551',
+ 'light lime green': '#b9ff66',
+ 'snot green': '#9dc100',
+ 'yellowish': '#faee66',
+ 'light blue green': '#7efbb3',
+ 'bordeaux': '#7b002c',
+ 'light mauve': '#c292a1',
+ 'ocean': '#017b92',
+ 'marigold': '#fcc006',
+ 'muddy green': '#657432',
+ 'dull orange': '#d8863b',
+ 'steel': '#738595',
+ 'electric purple': '#aa23ff',
+ 'fluorescent green': '#08ff08',
+ 'yellowish brown': '#9b7a01',
+ 'blush': '#f29e8e',
+ 'soft green': '#6fc276',
+ 'bright orange': '#ff5b00',
+ 'lemon': '#fdff52',
+ 'purple grey': '#866f85',
+ 'acid green': '#8ffe09',
+ 'pale lavender': '#eecffe',
+ 'violet blue': '#510ac9',
+ 'light forest green': '#4f9153',
+ 'burnt red': '#9f2305',
+ 'khaki green': '#728639',
+ 'cerise': '#de0c62',
+ 'faded purple': '#916e99',
+ 'apricot': '#ffb16d',
+ 'dark olive green': '#3c4d03',
+ 'grey brown': '#7f7053',
+ 'green grey': '#77926f',
+ 'true blue': '#010fcc',
+ 'pale violet': '#ceaefa',
+ 'periwinkle blue': '#8f99fb',
+ 'light sky blue': '#c6fcff',
+ 'blurple': '#5539cc',
+ 'green brown': '#544e03',
+ 'bluegreen': '#017a79',
+ 'bright teal': '#01f9c6',
+ 'brownish yellow': '#c9b003',
+ 'pea soup': '#929901',
+ 'forest': '#0b5509',
+ 'barney purple': '#a00498',
+ 'ultramarine': '#2000b1',
+ 'purplish': '#94568c',
+ 'puke yellow': '#c2be0e',
+ 'bluish grey': '#748b97',
+ 'dark periwinkle': '#665fd1',
+ 'dark lilac': '#9c6da5',
+ 'reddish': '#c44240',
+ 'light maroon': '#a24857',
+ 'dusty purple': '#825f87',
+ 'terra cotta': '#c9643b',
+ 'avocado': '#90b134',
+ 'marine blue': '#01386a',
+ 'teal green': '#25a36f',
+ 'slate grey': '#59656d',
+ 'lighter green': '#75fd63',
+ 'electric green': '#21fc0d',
+ 'dusty blue': '#5a86ad',
+ 'golden yellow': '#fec615',
+ 'bright yellow': '#fffd01',
+ 'light lavender': '#dfc5fe',
+ 'umber': '#b26400',
+ 'poop': '#7f5e00',
+ 'dark peach': '#de7e5d',
+ 'jungle green': '#048243',
+ 'eggshell': '#ffffd4',
+ 'denim': '#3b638c',
+ 'yellow brown': '#b79400',
+ 'dull purple': '#84597e',
+ 'chocolate brown': '#411900',
+ 'wine red': '#7b0323',
+ 'neon blue': '#04d9ff',
+ 'dirty green': '#667e2c',
+ 'light tan': '#fbeeac',
+ 'ice blue': '#d7fffe',
+ 'cadet blue': '#4e7496',
+ 'dark mauve': '#874c62',
+ 'very light blue': '#d5ffff',
+ 'grey purple': '#826d8c',
+ 'pastel pink': '#ffbacd',
+ 'very light green': '#d1ffbd',
+ 'dark sky blue': '#448ee4',
+ 'evergreen': '#05472a',
+ 'dull pink': '#d5869d',
+ 'aubergine': '#3d0734',
+ 'mahogany': '#4a0100',
+ 'reddish orange': '#f8481c',
+ 'deep green': '#02590f',
+ 'vomit green': '#89a203',
+ 'purple pink': '#e03fd8',
+ 'dusty pink': '#d58a94',
+ 'faded green': '#7bb274',
+ 'camo green': '#526525',
+ 'pinky purple': '#c94cbe',
+ 'pink purple': '#db4bda',
+ 'brownish red': '#9e3623',
+ 'dark rose': '#b5485d',
+ 'mud': '#735c12',
+ 'brownish': '#9c6d57',
+ 'emerald green': '#028f1e',
+ 'pale brown': '#b1916e',
+ 'dull blue': '#49759c',
+ 'burnt umber': '#a0450e',
+ 'medium green': '#39ad48',
+ 'clay': '#b66a50',
+ 'light aqua': '#8cffdb',
+ 'light olive green': '#a4be5c',
+ 'brownish orange': '#cb7723',
+ 'dark aqua': '#05696b',
+ 'purplish pink': '#ce5dae',
+ 'dark salmon': '#c85a53',
+ 'greenish grey': '#96ae8d',
+ 'jade': '#1fa774',
+ 'ugly green': '#7a9703',
+ 'dark beige': '#ac9362',
+ 'emerald': '#01a049',
+ 'pale red': '#d9544d',
+ 'light magenta': '#fa5ff7',
+ 'sky': '#82cafc',
+ 'light cyan': '#acfffc',
+ 'yellow orange': '#fcb001',
+ 'reddish purple': '#910951',
+ 'reddish pink': '#fe2c54',
+ 'orchid': '#c875c4',
+ 'dirty yellow': '#cdc50a',
+ 'orange red': '#fd411e',
+ 'deep red': '#9a0200',
+ 'orange brown': '#be6400',
+ 'cobalt blue': '#030aa7',
+ 'neon pink': '#fe019a',
+ 'rose pink': '#f7879a',
+ 'greyish purple': '#887191',
+ 'raspberry': '#b00149',
+ 'aqua green': '#12e193',
+ 'salmon pink': '#fe7b7c',
+ 'tangerine': '#ff9408',
+ 'brownish green': '#6a6e09',
+ 'red brown': '#8b2e16',
+ 'greenish brown': '#696112',
+ 'pumpkin': '#e17701',
+ 'pine green': '#0a481e',
+ 'charcoal': '#343837',
+ 'baby pink': '#ffb7ce',
+ 'cornflower': '#6a79f7',
+ 'blue violet': '#5d06e9',
+ 'chocolate': '#3d1c02',
+ 'greyish green': '#82a67d',
+ 'scarlet': '#be0119',
+ 'green yellow': '#c9ff27',
+ 'dark olive': '#373e02',
+ 'sienna': '#a9561e',
+ 'pastel purple': '#caa0ff',
+ 'terracotta': '#ca6641',
+ 'aqua blue': '#02d8e9',
+ 'sage green': '#88b378',
+ 'blood red': '#980002',
+ 'deep pink': '#cb0162',
+ 'grass': '#5cac2d',
+ 'moss': '#769958',
+ 'pastel blue': '#a2bffe',
+ 'bluish green': '#10a674',
+ 'green blue': '#06b48b',
+ 'dark tan': '#af884a',
+ 'greenish blue': '#0b8b87',
+ 'pale orange': '#ffa756',
+ 'vomit': '#a2a415',
+ 'forrest green': '#154406',
+ 'dark lavender': '#856798',
+ 'dark violet': '#34013f',
+ 'purple blue': '#632de9',
+ 'dark cyan': '#0a888a',
+ 'olive drab': '#6f7632',
+ 'pinkish': '#d46a7e',
+ 'cobalt': '#1e488f',
+ 'neon purple': '#bc13fe',
+ 'light turquoise': '#7ef4cc',
+ 'apple green': '#76cd26',
+ 'dull green': '#74a662',
+ 'wine': '#80013f',
+ 'powder blue': '#b1d1fc',
+ 'off white': '#ffffe4',
+ 'electric blue': '#0652ff',
+ 'dark turquoise': '#045c5a',
+ 'blue purple': '#5729ce',
+ 'azure': '#069af3',
+ 'bright red': '#ff000d',
+ 'pinkish red': '#f10c45',
+ 'cornflower blue': '#5170d7',
+ 'light olive': '#acbf69',
+ 'grape': '#6c3461',
+ 'greyish blue': '#5e819d',
+ 'purplish blue': '#601ef9',
+ 'yellowish green': '#b0dd16',
+ 'greenish yellow': '#cdfd02',
+ 'medium blue': '#2c6fbb',
+ 'dusty rose': '#c0737a',
+ 'light violet': '#d6b4fc',
+ 'midnight blue': '#020035',
+ 'bluish purple': '#703be7',
+ 'red orange': '#fd3c06',
+ 'dark magenta': '#960056',
+ 'greenish': '#40a368',
+ 'ocean blue': '#03719c',
+ 'coral': '#fc5a50',
+ 'cream': '#ffffc2',
+ 'reddish brown': '#7f2b0a',
+ 'burnt sienna': '#b04e0f',
+ 'brick': '#a03623',
+ 'sage': '#87ae73',
+ 'grey green': '#789b73',
+ 'white': '#ffffff',
+ "robin's egg blue": '#98eff9',
+ 'moss green': '#658b38',
+ 'steel blue': '#5a7d9a',
+ 'eggplant': '#380835',
+ 'light yellow': '#fffe7a',
+ 'leaf green': '#5ca904',
+ 'light grey': '#d8dcd6',
+ 'puke': '#a5a502',
+ 'pinkish purple': '#d648d7',
+ 'sea blue': '#047495',
+ 'pale purple': '#b790d4',
+ 'slate blue': '#5b7c99',
+ 'blue grey': '#607c8e',
+ 'hunter green': '#0b4008',
+ 'fuchsia': '#ed0dd9',
+ 'crimson': '#8c000f',
+ 'pale yellow': '#ffff84',
+ 'ochre': '#bf9005',
+ 'mustard yellow': '#d2bd0a',
+ 'light red': '#ff474c',
+ 'cerulean': '#0485d1',
+ 'pale pink': '#ffcfdc',
+ 'deep blue': '#040273',
+ 'rust': '#a83c09',
+ 'light teal': '#90e4c1',
+ 'slate': '#516572',
+ 'goldenrod': '#fac205',
+ 'dark yellow': '#d5b60a',
+ 'dark grey': '#363737',
+ 'army green': '#4b5d16',
+ 'grey blue': '#6b8ba4',
+ 'seafoam': '#80f9ad',
+ 'puce': '#a57e52',
+ 'spring green': '#a9f971',
+ 'dark orange': '#c65102',
+ 'sand': '#e2ca76',
+ 'pastel green': '#b0ff9d',
+ 'mint': '#9ffeb0',
+ 'light orange': '#fdaa48',
+ 'bright pink': '#fe01b1',
+ 'chartreuse': '#c1f80a',
+ 'deep purple': '#36013f',
+ 'dark brown': '#341c02',
+ 'taupe': '#b9a281',
+ 'pea green': '#8eab12',
+ 'puke green': '#9aae07',
+ 'kelly green': '#02ab2e',
+ 'seafoam green': '#7af9ab',
+ 'blue green': '#137e6d',
+ 'khaki': '#aaa662',
+ 'burgundy': '#610023',
+ 'dark teal': '#014d4e',
+ 'brick red': '#8f1402',
+ 'royal purple': '#4b006e',
+ 'plum': '#580f41',
+ 'mint green': '#8fff9f',
+ 'gold': '#dbb40c',
+ 'baby blue': '#a2cffe',
+ 'yellow green': '#c0fb2d',
+ 'bright purple': '#be03fd',
+ 'dark red': '#840000',
+ 'pale blue': '#d0fefe',
+ 'grass green': '#3f9b0b',
+ 'navy': '#01153e',
+ 'aquamarine': '#04d8b2',
+ 'burnt orange': '#c04e01',
+ 'neon green': '#0cff0c',
+ 'bright blue': '#0165fc',
+ 'rose': '#cf6275',
+ 'light pink': '#ffd1df',
+ 'mustard': '#ceb301',
+ 'indigo': '#380282',
+ 'lime': '#aaff32',
+ 'sea green': '#53fca1',
+ 'periwinkle': '#8e82fe',
+ 'dark pink': '#cb416b',
+ 'olive green': '#677a04',
+ 'peach': '#ffb07c',
+ 'pale green': '#c7fdb5',
+ 'light brown': '#ad8150',
+ 'hot pink': '#ff028d',
+ 'black': '#000000',
+ 'lilac': '#cea2fd',
+ 'navy blue': '#001146',
+ 'royal blue': '#0504aa',
+ 'beige': '#e6daa6',
+ 'salmon': '#ff796c',
+ 'olive': '#6e750e',
+ 'maroon': '#650021',
+ 'bright green': '#01ff07',
+ 'dark purple': '#35063e',
+ 'mauve': '#ae7181',
+ 'forest green': '#06470c',
+ 'aqua': '#13eac9',
+ 'cyan': '#00ffff',
+ 'tan': '#d1b26f',
+ 'dark blue': '#00035b',
+ 'lavender': '#c79fef',
+ 'turquoise': '#06c2ac',
+ 'dark green': '#033500',
+ 'violet': '#9a0eea',
+ 'light purple': '#bf77f6',
+ 'lime green': '#89fe05',
+ 'grey': '#929591',
+ 'sky blue': '#75bbfd',
+ 'yellow': '#ffff14',
+ 'magenta': '#c20078',
+ 'light green': '#96f97b',
+ 'orange': '#f97306',
+ 'teal': '#029386',
+ 'light blue': '#95d0fc',
+ 'red': '#e50000',
+ 'brown': '#653700',
+ 'pink': '#ff81c0',
+ 'blue': '#0343df',
+ 'green': '#15b01a',
+ 'purple': '#7e1e9c'}
+
+# Normalize name to "xkcd:" to avoid name collisions.
+XKCD_COLORS = {'xkcd:' + name: value for name, value in XKCD_COLORS.items()}
+
+
+# https://drafts.csswg.org/css-color-4/#named-colors
+CSS4_COLORS = {
+ 'aliceblue': '#F0F8FF',
+ 'antiquewhite': '#FAEBD7',
+ 'aqua': '#00FFFF',
+ 'aquamarine': '#7FFFD4',
+ 'azure': '#F0FFFF',
+ 'beige': '#F5F5DC',
+ 'bisque': '#FFE4C4',
+ 'black': '#000000',
+ 'blanchedalmond': '#FFEBCD',
+ 'blue': '#0000FF',
+ 'blueviolet': '#8A2BE2',
+ 'brown': '#A52A2A',
+ 'burlywood': '#DEB887',
+ 'cadetblue': '#5F9EA0',
+ 'chartreuse': '#7FFF00',
+ 'chocolate': '#D2691E',
+ 'coral': '#FF7F50',
+ 'cornflowerblue': '#6495ED',
+ 'cornsilk': '#FFF8DC',
+ 'crimson': '#DC143C',
+ 'cyan': '#00FFFF',
+ 'darkblue': '#00008B',
+ 'darkcyan': '#008B8B',
+ 'darkgoldenrod': '#B8860B',
+ 'darkgray': '#A9A9A9',
+ 'darkgreen': '#006400',
+ 'darkgrey': '#A9A9A9',
+ 'darkkhaki': '#BDB76B',
+ 'darkmagenta': '#8B008B',
+ 'darkolivegreen': '#556B2F',
+ 'darkorange': '#FF8C00',
+ 'darkorchid': '#9932CC',
+ 'darkred': '#8B0000',
+ 'darksalmon': '#E9967A',
+ 'darkseagreen': '#8FBC8F',
+ 'darkslateblue': '#483D8B',
+ 'darkslategray': '#2F4F4F',
+ 'darkslategrey': '#2F4F4F',
+ 'darkturquoise': '#00CED1',
+ 'darkviolet': '#9400D3',
+ 'deeppink': '#FF1493',
+ 'deepskyblue': '#00BFFF',
+ 'dimgray': '#696969',
+ 'dimgrey': '#696969',
+ 'dodgerblue': '#1E90FF',
+ 'firebrick': '#B22222',
+ 'floralwhite': '#FFFAF0',
+ 'forestgreen': '#228B22',
+ 'fuchsia': '#FF00FF',
+ 'gainsboro': '#DCDCDC',
+ 'ghostwhite': '#F8F8FF',
+ 'gold': '#FFD700',
+ 'goldenrod': '#DAA520',
+ 'gray': '#808080',
+ 'green': '#008000',
+ 'greenyellow': '#ADFF2F',
+ 'grey': '#808080',
+ 'honeydew': '#F0FFF0',
+ 'hotpink': '#FF69B4',
+ 'indianred': '#CD5C5C',
+ 'indigo': '#4B0082',
+ 'ivory': '#FFFFF0',
+ 'khaki': '#F0E68C',
+ 'lavender': '#E6E6FA',
+ 'lavenderblush': '#FFF0F5',
+ 'lawngreen': '#7CFC00',
+ 'lemonchiffon': '#FFFACD',
+ 'lightblue': '#ADD8E6',
+ 'lightcoral': '#F08080',
+ 'lightcyan': '#E0FFFF',
+ 'lightgoldenrodyellow': '#FAFAD2',
+ 'lightgray': '#D3D3D3',
+ 'lightgreen': '#90EE90',
+ 'lightgrey': '#D3D3D3',
+ 'lightpink': '#FFB6C1',
+ 'lightsalmon': '#FFA07A',
+ 'lightseagreen': '#20B2AA',
+ 'lightskyblue': '#87CEFA',
+ 'lightslategray': '#778899',
+ 'lightslategrey': '#778899',
+ 'lightsteelblue': '#B0C4DE',
+ 'lightyellow': '#FFFFE0',
+ 'lime': '#00FF00',
+ 'limegreen': '#32CD32',
+ 'linen': '#FAF0E6',
+ 'magenta': '#FF00FF',
+ 'maroon': '#800000',
+ 'mediumaquamarine': '#66CDAA',
+ 'mediumblue': '#0000CD',
+ 'mediumorchid': '#BA55D3',
+ 'mediumpurple': '#9370DB',
+ 'mediumseagreen': '#3CB371',
+ 'mediumslateblue': '#7B68EE',
+ 'mediumspringgreen': '#00FA9A',
+ 'mediumturquoise': '#48D1CC',
+ 'mediumvioletred': '#C71585',
+ 'midnightblue': '#191970',
+ 'mintcream': '#F5FFFA',
+ 'mistyrose': '#FFE4E1',
+ 'moccasin': '#FFE4B5',
+ 'navajowhite': '#FFDEAD',
+ 'navy': '#000080',
+ 'oldlace': '#FDF5E6',
+ 'olive': '#808000',
+ 'olivedrab': '#6B8E23',
+ 'orange': '#FFA500',
+ 'orangered': '#FF4500',
+ 'orchid': '#DA70D6',
+ 'palegoldenrod': '#EEE8AA',
+ 'palegreen': '#98FB98',
+ 'paleturquoise': '#AFEEEE',
+ 'palevioletred': '#DB7093',
+ 'papayawhip': '#FFEFD5',
+ 'peachpuff': '#FFDAB9',
+ 'peru': '#CD853F',
+ 'pink': '#FFC0CB',
+ 'plum': '#DDA0DD',
+ 'powderblue': '#B0E0E6',
+ 'purple': '#800080',
+ 'rebeccapurple': '#663399',
+ 'red': '#FF0000',
+ 'rosybrown': '#BC8F8F',
+ 'royalblue': '#4169E1',
+ 'saddlebrown': '#8B4513',
+ 'salmon': '#FA8072',
+ 'sandybrown': '#F4A460',
+ 'seagreen': '#2E8B57',
+ 'seashell': '#FFF5EE',
+ 'sienna': '#A0522D',
+ 'silver': '#C0C0C0',
+ 'skyblue': '#87CEEB',
+ 'slateblue': '#6A5ACD',
+ 'slategray': '#708090',
+ 'slategrey': '#708090',
+ 'snow': '#FFFAFA',
+ 'springgreen': '#00FF7F',
+ 'steelblue': '#4682B4',
+ 'tan': '#D2B48C',
+ 'teal': '#008080',
+ 'thistle': '#D8BFD8',
+ 'tomato': '#FF6347',
+ 'turquoise': '#40E0D0',
+ 'violet': '#EE82EE',
+ 'wheat': '#F5DEB3',
+ 'white': '#FFFFFF',
+ 'whitesmoke': '#F5F5F5',
+ 'yellow': '#FFFF00',
+ 'yellowgreen': '#9ACD32'}
diff --git a/venv/Lib/site-packages/matplotlib/_constrained_layout.py b/venv/Lib/site-packages/matplotlib/_constrained_layout.py
new file mode 100644
index 0000000..2456793
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_constrained_layout.py
@@ -0,0 +1,619 @@
+"""
+Adjust subplot layouts so that there are no overlapping axes or axes
+decorations. All axes decorations are dealt with (labels, ticks, titles,
+ticklabels) and some dependent artists are also dealt with (colorbar,
+suptitle).
+
+Layout is done via `~matplotlib.gridspec`, with one constraint per gridspec,
+so it is possible to have overlapping axes if the gridspecs overlap (i.e.
+using `~matplotlib.gridspec.GridSpecFromSubplotSpec`). Axes placed using
+``figure.subplots()`` or ``figure.add_subplots()`` will participate in the
+layout. Axes manually placed via ``figure.add_axes()`` will not.
+
+See Tutorial: :doc:`/tutorials/intermediate/constrainedlayout_guide`
+"""
+
+import logging
+
+import numpy as np
+
+from matplotlib import _api
+import matplotlib.transforms as mtransforms
+
+_log = logging.getLogger(__name__)
+
+"""
+General idea:
+-------------
+
+First, a figure has a gridspec that divides the figure into nrows and ncols,
+with heights and widths set by ``height_ratios`` and ``width_ratios``,
+often just set to 1 for an equal grid.
+
+Subplotspecs that are derived from this gridspec can contain either a
+``SubPanel``, a ``GridSpecFromSubplotSpec``, or an axes. The ``SubPanel`` and
+``GridSpecFromSubplotSpec`` are dealt with recursively and each contain an
+analogous layout.
+
+Each ``GridSpec`` has a ``_layoutgrid`` attached to it. The ``_layoutgrid``
+has the same logical layout as the ``GridSpec``. Each row of the grid spec
+has a top and bottom "margin" and each column has a left and right "margin".
+The "inner" height of each row is constrained to be the same (or as modified
+by ``height_ratio``), and the "inner" width of each column is
+constrained to be the same (as modified by ``width_ratio``), where "inner"
+is the width or height of each column/row minus the size of the margins.
+
+Then the size of the margins for each row and column are determined as the
+max width of the decorators on each axes that has decorators in that margin.
+For instance, a normal axes would have a left margin that includes the
+left ticklabels, and the ylabel if it exists. The right margin may include a
+colorbar, the bottom margin the xaxis decorations, and the top margin the
+title.
+
+With these constraints, the solver then finds appropriate bounds for the
+columns and rows. It's possible that the margins take up the whole figure,
+in which case the algorithm is not applied and a warning is raised.
+
+See the tutorial doc:`/tutorials/intermediate/constrainedlayout_guide`
+for more discussion of the algorithm with examples.
+"""
+
+
+######################################################
+def do_constrained_layout(fig, renderer, h_pad, w_pad,
+ hspace=None, wspace=None):
+ """
+ Do the constrained_layout. Called at draw time in
+ ``figure.constrained_layout()``
+
+ Parameters
+ ----------
+ fig : Figure
+ ``Figure`` instance to do the layout in.
+
+ renderer : Renderer
+ Renderer to use.
+
+ h_pad, w_pad : float
+ Padding around the axes elements in figure-normalized units.
+
+ hspace, wspace : float
+ Fraction of the figure to dedicate to space between the
+ axes. These are evenly spread between the gaps between the axes.
+ A value of 0.2 for a three-column layout would have a space
+ of 0.1 of the figure width between each column.
+ If h/wspace < h/w_pad, then the pads are used instead.
+ """
+
+ # list of unique gridspecs that contain child axes:
+ gss = set()
+ for ax in fig.axes:
+ if hasattr(ax, 'get_subplotspec'):
+ gs = ax.get_subplotspec().get_gridspec()
+ if gs._layoutgrid is not None:
+ gss.add(gs)
+ gss = list(gss)
+ if len(gss) == 0:
+ _api.warn_external('There are no gridspecs with layoutgrids. '
+ 'Possibly did not call parent GridSpec with the'
+ ' "figure" keyword')
+
+ for _ in range(2):
+ # do the algorithm twice. This has to be done because decorations
+ # change size after the first re-position (i.e. x/yticklabels get
+ # larger/smaller). This second reposition tends to be much milder,
+ # so doing twice makes things work OK.
+
+ # make margins for all the axes and subfigures in the
+ # figure. Add margins for colorbars...
+ _make_layout_margins(fig, renderer, h_pad=h_pad, w_pad=w_pad,
+ hspace=hspace, wspace=wspace)
+ _make_margin_suptitles(fig, renderer, h_pad=h_pad, w_pad=w_pad)
+
+ # if a layout is such that a columns (or rows) margin has no
+ # constraints, we need to make all such instances in the grid
+ # match in margin size.
+ _match_submerged_margins(fig)
+
+ # update all the variables in the layout.
+ fig._layoutgrid.update_variables()
+
+ if _check_no_collapsed_axes(fig):
+ _reposition_axes(fig, renderer, h_pad=h_pad, w_pad=w_pad,
+ hspace=hspace, wspace=wspace)
+ else:
+ _api.warn_external('constrained_layout not applied because '
+ 'axes sizes collapsed to zero. Try making '
+ 'figure larger or axes decorations smaller.')
+ _reset_margins(fig)
+
+
+def _check_no_collapsed_axes(fig):
+ """
+ Check that no axes have collapsed to zero size.
+ """
+ for panel in fig.subfigs:
+ ok = _check_no_collapsed_axes(panel)
+ if not ok:
+ return False
+
+ for ax in fig.axes:
+ if hasattr(ax, 'get_subplotspec'):
+ gs = ax.get_subplotspec().get_gridspec()
+ lg = gs._layoutgrid
+ if lg is not None:
+ for i in range(gs.nrows):
+ for j in range(gs.ncols):
+ bb = lg.get_inner_bbox(i, j)
+ if bb.width <= 0 or bb.height <= 0:
+ return False
+ return True
+
+
+def _get_margin_from_padding(object, *, w_pad=0, h_pad=0,
+ hspace=0, wspace=0):
+
+ ss = object._subplotspec
+ gs = ss.get_gridspec()
+ lg = gs._layoutgrid
+
+ if hasattr(gs, 'hspace'):
+ _hspace = (gs.hspace if gs.hspace is not None else hspace)
+ _wspace = (gs.wspace if gs.wspace is not None else wspace)
+ else:
+ _hspace = (gs._hspace if gs._hspace is not None else hspace)
+ _wspace = (gs._wspace if gs._wspace is not None else wspace)
+
+ _wspace = _wspace / 2
+ _hspace = _hspace / 2
+
+ nrows, ncols = gs.get_geometry()
+ # there are two margins for each direction. The "cb"
+ # margins are for pads and colorbars, the non-"cb" are
+ # for the axes decorations (labels etc).
+ margin = {'leftcb': w_pad, 'rightcb': w_pad,
+ 'bottomcb': h_pad, 'topcb': h_pad,
+ 'left': 0, 'right': 0,
+ 'top': 0, 'bottom': 0}
+ if _wspace / ncols > w_pad:
+ if ss.colspan.start > 0:
+ margin['leftcb'] = _wspace / ncols
+ if ss.colspan.stop < ncols:
+ margin['rightcb'] = _wspace / ncols
+ if _hspace / nrows > h_pad:
+ if ss.rowspan.stop < nrows:
+ margin['bottomcb'] = _hspace / nrows
+ if ss.rowspan.start > 0:
+ margin['topcb'] = _hspace / nrows
+
+ return margin
+
+
+def _make_layout_margins(fig, renderer, *, w_pad=0, h_pad=0,
+ hspace=0, wspace=0):
+ """
+ For each axes, make a margin between the *pos* layoutbox and the
+ *axes* layoutbox be a minimum size that can accommodate the
+ decorations on the axis.
+
+ Then make room for colorbars.
+ """
+ for panel in fig.subfigs: # recursively make child panel margins
+ ss = panel._subplotspec
+ _make_layout_margins(panel, renderer, w_pad=w_pad, h_pad=h_pad,
+ hspace=hspace, wspace=wspace)
+
+ margins = _get_margin_from_padding(panel, w_pad=0, h_pad=0,
+ hspace=hspace, wspace=wspace)
+ panel._layoutgrid.parent.edit_outer_margin_mins(margins, ss)
+
+ for ax in fig._localaxes.as_list():
+ if not hasattr(ax, 'get_subplotspec') or not ax.get_in_layout():
+ continue
+
+ ss = ax.get_subplotspec()
+ gs = ss.get_gridspec()
+ nrows, ncols = gs.get_geometry()
+
+ if gs._layoutgrid is None:
+ return
+
+ margin = _get_margin_from_padding(ax, w_pad=w_pad, h_pad=h_pad,
+ hspace=hspace, wspace=wspace)
+ margin0 = margin.copy()
+ pos, bbox = _get_pos_and_bbox(ax, renderer)
+ # the margin is the distance between the bounding box of the axes
+ # and its position (plus the padding from above)
+ margin['left'] += pos.x0 - bbox.x0
+ margin['right'] += bbox.x1 - pos.x1
+ # remember that rows are ordered from top:
+ margin['bottom'] += pos.y0 - bbox.y0
+ margin['top'] += bbox.y1 - pos.y1
+
+ # make margin for colorbars. These margins go in the
+ # padding margin, versus the margin for axes decorators.
+ for cbax in ax._colorbars:
+ # note pad is a fraction of the parent width...
+ pad = _colorbar_get_pad(cbax)
+ # colorbars can be child of more than one subplot spec:
+ cbp_rspan, cbp_cspan = _get_cb_parent_spans(cbax)
+ loc = cbax._colorbar_info['location']
+ cbpos, cbbbox = _get_pos_and_bbox(cbax, renderer)
+ if loc == 'right':
+ if cbp_cspan.stop == ss.colspan.stop:
+ # only increase if the colorbar is on the right edge
+ margin['rightcb'] += cbbbox.width + pad
+ elif loc == 'left':
+ if cbp_cspan.start == ss.colspan.start:
+ # only increase if the colorbar is on the left edge
+ margin['leftcb'] += cbbbox.width + pad
+ elif loc == 'top':
+ if cbp_rspan.start == ss.rowspan.start:
+ margin['topcb'] += cbbbox.height + pad
+ else:
+ if cbp_rspan.stop == ss.rowspan.stop:
+ margin['bottomcb'] += cbbbox.height + pad
+ # If the colorbars are wider than the parent box in the
+ # cross direction
+ if loc in ['top', 'bottom']:
+ if (cbp_cspan.start == ss.colspan.start and
+ cbbbox.x0 < bbox.x0):
+ margin['left'] += bbox.x0 - cbbbox.x0
+ if (cbp_cspan.stop == ss.colspan.stop and
+ cbbbox.x1 > bbox.x1):
+ margin['right'] += cbbbox.x1 - bbox.x1
+ # or taller:
+ if loc in ['left', 'right']:
+ if (cbp_rspan.stop == ss.rowspan.stop and
+ cbbbox.y0 < bbox.y0):
+ margin['bottom'] += bbox.y0 - cbbbox.y0
+ if (cbp_rspan.start == ss.rowspan.start and
+ cbbbox.y1 > bbox.y1):
+ margin['top'] += cbbbox.y1 - bbox.y1
+ # pass the new margins down to the layout grid for the solution...
+ gs._layoutgrid.edit_outer_margin_mins(margin, ss)
+
+
+def _make_margin_suptitles(fig, renderer, *, w_pad=0, h_pad=0):
+ # Figure out how large the suptitle is and make the
+ # top level figure margin larger.
+
+ inv_trans_fig = fig.transFigure.inverted().transform_bbox
+ # get the h_pad and w_pad as distances in the local subfigure coordinates:
+ padbox = mtransforms.Bbox([[0, 0], [w_pad, h_pad]])
+ padbox = (fig.transFigure -
+ fig.transSubfigure).transform_bbox(padbox)
+ h_pad_local = padbox.height
+ w_pad_local = padbox.width
+
+ for panel in fig.subfigs:
+ _make_margin_suptitles(panel, renderer, w_pad=w_pad, h_pad=h_pad)
+
+ if fig._suptitle is not None and fig._suptitle.get_in_layout():
+ p = fig._suptitle.get_position()
+ if getattr(fig._suptitle, '_autopos', False):
+ fig._suptitle.set_position((p[0], 1 - h_pad_local))
+ bbox = inv_trans_fig(fig._suptitle.get_tightbbox(renderer))
+ fig._layoutgrid.edit_margin_min('top', bbox.height + 2 * h_pad)
+
+ if fig._supxlabel is not None and fig._supxlabel.get_in_layout():
+ p = fig._supxlabel.get_position()
+ if getattr(fig._supxlabel, '_autopos', False):
+ fig._supxlabel.set_position((p[0], h_pad_local))
+ bbox = inv_trans_fig(fig._supxlabel.get_tightbbox(renderer))
+ fig._layoutgrid.edit_margin_min('bottom', bbox.height + 2 * h_pad)
+
+ if fig._supylabel is not None and fig._supxlabel.get_in_layout():
+ p = fig._supylabel.get_position()
+ if getattr(fig._supylabel, '_autopos', False):
+ fig._supylabel.set_position((w_pad_local, p[1]))
+ bbox = inv_trans_fig(fig._supylabel.get_tightbbox(renderer))
+ fig._layoutgrid.edit_margin_min('left', bbox.width + 2 * w_pad)
+
+
+def _match_submerged_margins(fig):
+ """
+ Make the margins that are submerged inside an Axes the same size.
+
+ This allows axes that span two columns (or rows) that are offset
+ from one another to have the same size.
+
+ This gives the proper layout for something like::
+ fig = plt.figure(constrained_layout=True)
+ axs = fig.subplot_mosaic("AAAB\nCCDD")
+
+ Without this routine, the axes D will be wider than C, because the
+ margin width between the two columns in C has no width by default,
+ whereas the margins between the two columns of D are set by the
+ width of the margin between A and B. However, obviously the user would
+ like C and D to be the same size, so we need to add constraints to these
+ "submerged" margins.
+
+ This routine makes all the interior margins the same, and the spacing
+ between the three columns in A and the two column in C are all set to the
+ margins between the two columns of D.
+
+ See test_constrained_layout::test_constrained_layout12 for an example.
+ """
+
+ for panel in fig.subfigs:
+ _match_submerged_margins(panel)
+
+ axs = [a for a in fig.get_axes() if (hasattr(a, 'get_subplotspec')
+ and a.get_in_layout())]
+
+ for ax1 in axs:
+ ss1 = ax1.get_subplotspec()
+ lg1 = ss1.get_gridspec()._layoutgrid
+ if lg1 is None:
+ axs.remove(ax1)
+ continue
+
+ # interior columns:
+ if len(ss1.colspan) > 1:
+ maxsubl = np.max(
+ lg1.margin_vals['left'][ss1.colspan[1:]] +
+ lg1.margin_vals['leftcb'][ss1.colspan[1:]]
+ )
+ maxsubr = np.max(
+ lg1.margin_vals['right'][ss1.colspan[:-1]] +
+ lg1.margin_vals['rightcb'][ss1.colspan[:-1]]
+ )
+ for ax2 in axs:
+ ss2 = ax2.get_subplotspec()
+ lg2 = ss2.get_gridspec()._layoutgrid
+ if lg2 is not None and len(ss2.colspan) > 1:
+ maxsubl2 = np.max(
+ lg2.margin_vals['left'][ss2.colspan[1:]] +
+ lg2.margin_vals['leftcb'][ss2.colspan[1:]])
+ if maxsubl2 > maxsubl:
+ maxsubl = maxsubl2
+ maxsubr2 = np.max(
+ lg2.margin_vals['right'][ss2.colspan[:-1]] +
+ lg2.margin_vals['rightcb'][ss2.colspan[:-1]])
+ if maxsubr2 > maxsubr:
+ maxsubr = maxsubr2
+ for i in ss1.colspan[1:]:
+ lg1.edit_margin_min('left', maxsubl, cell=i)
+ for i in ss1.colspan[:-1]:
+ lg1.edit_margin_min('right', maxsubr, cell=i)
+
+ # interior rows:
+ if len(ss1.rowspan) > 1:
+ maxsubt = np.max(
+ lg1.margin_vals['top'][ss1.rowspan[1:]] +
+ lg1.margin_vals['topcb'][ss1.rowspan[1:]]
+ )
+ maxsubb = np.max(
+ lg1.margin_vals['bottom'][ss1.rowspan[:-1]] +
+ lg1.margin_vals['bottomcb'][ss1.rowspan[:-1]]
+ )
+
+ for ax2 in axs:
+ ss2 = ax2.get_subplotspec()
+ lg2 = ss2.get_gridspec()._layoutgrid
+ if lg2 is not None:
+ if len(ss2.rowspan) > 1:
+ maxsubt = np.max([np.max(
+ lg2.margin_vals['top'][ss2.rowspan[1:]] +
+ lg2.margin_vals['topcb'][ss2.rowspan[1:]]
+ ), maxsubt])
+ maxsubb = np.max([np.max(
+ lg2.margin_vals['bottom'][ss2.rowspan[:-1]] +
+ lg2.margin_vals['bottomcb'][ss2.rowspan[:-1]]
+ ), maxsubb])
+ for i in ss1.rowspan[1:]:
+ lg1.edit_margin_min('top', maxsubt, cell=i)
+ for i in ss1.rowspan[:-1]:
+ lg1.edit_margin_min('bottom', maxsubb, cell=i)
+
+
+def _get_cb_parent_spans(cbax):
+ """
+ Figure out which subplotspecs this colorbar belongs to:
+ """
+ rowstart = np.inf
+ rowstop = -np.inf
+ colstart = np.inf
+ colstop = -np.inf
+ for parent in cbax._colorbar_info['parents']:
+ ss = parent.get_subplotspec()
+ rowstart = min(ss.rowspan.start, rowstart)
+ rowstop = max(ss.rowspan.stop, rowstop)
+ colstart = min(ss.colspan.start, colstart)
+ colstop = max(ss.colspan.stop, colstop)
+
+ rowspan = range(rowstart, rowstop)
+ colspan = range(colstart, colstop)
+ return rowspan, colspan
+
+
+def _get_pos_and_bbox(ax, renderer):
+ """
+ Get the position and the bbox for the axes.
+
+ Parameters
+ ----------
+ ax
+ renderer
+
+ Returns
+ -------
+ pos : Bbox
+ Position in figure coordinates.
+ bbox : Bbox
+ Tight bounding box in figure coordinates.
+
+ """
+ fig = ax.figure
+ pos = ax.get_position(original=True)
+ # pos is in panel co-ords, but we need in figure for the layout
+ pos = pos.transformed(fig.transSubfigure - fig.transFigure)
+ try:
+ tightbbox = ax.get_tightbbox(renderer=renderer, for_layout_only=True)
+ except TypeError:
+ tightbbox = ax.get_tightbbox(renderer=renderer)
+
+ if tightbbox is None:
+ bbox = pos
+ else:
+ bbox = tightbbox.transformed(fig.transFigure.inverted())
+ return pos, bbox
+
+
+def _reposition_axes(fig, renderer, *, w_pad=0, h_pad=0, hspace=0, wspace=0):
+ """
+ Reposition all the axes based on the new inner bounding box.
+ """
+ trans_fig_to_subfig = fig.transFigure - fig.transSubfigure
+ for sfig in fig.subfigs:
+ bbox = sfig._layoutgrid.get_outer_bbox()
+ sfig._redo_transform_rel_fig(
+ bbox=bbox.transformed(trans_fig_to_subfig))
+ _reposition_axes(sfig, renderer,
+ w_pad=w_pad, h_pad=h_pad,
+ wspace=wspace, hspace=hspace)
+
+ for ax in fig._localaxes.as_list():
+ if not hasattr(ax, 'get_subplotspec') or not ax.get_in_layout():
+ continue
+
+ # grid bbox is in Figure coordinates, but we specify in panel
+ # coordinates...
+ ss = ax.get_subplotspec()
+ gs = ss.get_gridspec()
+ nrows, ncols = gs.get_geometry()
+ if gs._layoutgrid is None:
+ return
+
+ bbox = gs._layoutgrid.get_inner_bbox(rows=ss.rowspan, cols=ss.colspan)
+
+ bboxouter = gs._layoutgrid.get_outer_bbox(rows=ss.rowspan,
+ cols=ss.colspan)
+
+ # transform from figure to panel for set_position:
+ newbbox = trans_fig_to_subfig.transform_bbox(bbox)
+ ax._set_position(newbbox)
+
+ # move the colorbars:
+ # we need to keep track of oldw and oldh if there is more than
+ # one colorbar:
+ offset = {'left': 0, 'right': 0, 'bottom': 0, 'top': 0}
+ for nn, cbax in enumerate(ax._colorbars[::-1]):
+ if ax == cbax._colorbar_info['parents'][0]:
+ margin = _reposition_colorbar(
+ cbax, renderer, offset=offset)
+
+
+def _reposition_colorbar(cbax, renderer, *, offset=None):
+ """
+ Place the colorbar in its new place.
+
+ Parameters
+ ----------
+ cbax : Axes
+ Axes for the colorbar
+
+ renderer :
+ w_pad, h_pad : float
+ width and height padding (in fraction of figure)
+ hspace, wspace : float
+ width and height padding as fraction of figure size divided by
+ number of columns or rows
+ margin : array-like
+ offset the colorbar needs to be pushed to in order to
+ account for multiple colorbars
+ """
+
+ parents = cbax._colorbar_info['parents']
+ gs = parents[0].get_gridspec()
+ ncols, nrows = gs.ncols, gs.nrows
+ fig = cbax.figure
+ trans_fig_to_subfig = fig.transFigure - fig.transSubfigure
+
+ cb_rspans, cb_cspans = _get_cb_parent_spans(cbax)
+ bboxparent = gs._layoutgrid.get_bbox_for_cb(rows=cb_rspans, cols=cb_cspans)
+ pb = gs._layoutgrid.get_inner_bbox(rows=cb_rspans, cols=cb_cspans)
+
+ location = cbax._colorbar_info['location']
+ anchor = cbax._colorbar_info['anchor']
+ fraction = cbax._colorbar_info['fraction']
+ aspect = cbax._colorbar_info['aspect']
+ shrink = cbax._colorbar_info['shrink']
+
+ cbpos, cbbbox = _get_pos_and_bbox(cbax, renderer)
+
+ # Colorbar gets put at extreme edge of outer bbox of the subplotspec
+ # It needs to be moved in by: 1) a pad 2) its "margin" 3) by
+ # any colorbars already added at this location:
+ cbpad = _colorbar_get_pad(cbax)
+ if location in ('left', 'right'):
+ # fraction and shrink are fractions of parent
+ pbcb = pb.shrunk(fraction, shrink).anchored(anchor, pb)
+ # The colorbar is at the left side of the parent. Need
+ # to translate to right (or left)
+ if location == 'right':
+ lmargin = cbpos.x0 - cbbbox.x0
+ dx = bboxparent.x1 - pbcb.x0 + offset['right']
+ dx += cbpad + lmargin
+ offset['right'] += cbbbox.width + cbpad
+ pbcb = pbcb.translated(dx, 0)
+ else:
+ lmargin = cbpos.x0 - cbbbox.x0
+ dx = bboxparent.x0 - pbcb.x0 # edge of parent
+ dx += -cbbbox.width - cbpad + lmargin - offset['left']
+ offset['left'] += cbbbox.width + cbpad
+ pbcb = pbcb.translated(dx, 0)
+ else: # horizontal axes:
+ pbcb = pb.shrunk(shrink, fraction).anchored(anchor, pb)
+ if location == 'top':
+ bmargin = cbpos.y0 - cbbbox.y0
+ dy = bboxparent.y1 - pbcb.y0 + offset['top']
+ dy += cbpad + bmargin
+ offset['top'] += cbbbox.height + cbpad
+ pbcb = pbcb.translated(0, dy)
+ else:
+ bmargin = cbpos.y0 - cbbbox.y0
+ dy = bboxparent.y0 - pbcb.y0
+ dy += -cbbbox.height - cbpad + bmargin - offset['bottom']
+ offset['bottom'] += cbbbox.height + cbpad
+ pbcb = pbcb.translated(0, dy)
+
+ pbcb = trans_fig_to_subfig.transform_bbox(pbcb)
+ cbax.set_transform(fig.transSubfigure)
+ cbax._set_position(pbcb)
+ cbax.set_aspect(aspect, anchor=anchor, adjustable='box')
+ return offset
+
+
+def _reset_margins(fig):
+ """
+ Reset the margins in the layoutboxes of fig.
+
+ Margins are usually set as a minimum, so if the figure gets smaller
+ the minimum needs to be zero in order for it to grow again.
+ """
+ for span in fig.subfigs:
+ _reset_margins(span)
+ for ax in fig.axes:
+ if hasattr(ax, 'get_subplotspec') and ax.get_in_layout():
+ ss = ax.get_subplotspec()
+ gs = ss.get_gridspec()
+ if gs._layoutgrid is not None:
+ gs._layoutgrid.reset_margins()
+ fig._layoutgrid.reset_margins()
+
+
+def _colorbar_get_pad(cax):
+ parents = cax._colorbar_info['parents']
+ gs = parents[0].get_gridspec()
+
+ cb_rspans, cb_cspans = _get_cb_parent_spans(cax)
+ bboxouter = gs._layoutgrid.get_inner_bbox(rows=cb_rspans, cols=cb_cspans)
+
+ if cax._colorbar_info['location'] in ['right', 'left']:
+ size = bboxouter.width
+ else:
+ size = bboxouter.height
+
+ return cax._colorbar_info['pad'] * size
diff --git a/venv/Lib/site-packages/matplotlib/_contour.cp38-win_amd64.pyd b/venv/Lib/site-packages/matplotlib/_contour.cp38-win_amd64.pyd
new file mode 100644
index 0000000..7764d0d
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/_contour.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/matplotlib/_enums.py b/venv/Lib/site-packages/matplotlib/_enums.py
new file mode 100644
index 0000000..35fe824
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_enums.py
@@ -0,0 +1,208 @@
+"""
+Enums representing sets of strings that Matplotlib uses as input parameters.
+
+Matplotlib often uses simple data types like strings or tuples to define a
+concept; e.g. the line capstyle can be specified as one of 'butt', 'round',
+or 'projecting'. The classes in this module are used internally and serve to
+document these concepts formally.
+
+As an end-user you will not use these classes directly, but only the values
+they define.
+"""
+
+from enum import Enum, auto
+from matplotlib import cbook, docstring
+
+
+class _AutoStringNameEnum(Enum):
+ """Automate the ``name = 'name'`` part of making a (str, Enum)."""
+
+ def _generate_next_value_(name, start, count, last_values):
+ return name
+
+ def __hash__(self):
+ return str(self).__hash__()
+
+
+def _deprecate_case_insensitive_join_cap(s):
+ s_low = s.lower()
+ if s != s_low:
+ if s_low in ['miter', 'round', 'bevel']:
+ cbook.warn_deprecated(
+ "3.3", message="Case-insensitive capstyles are deprecated "
+ "since %(since)s and support for them will be removed "
+ "%(removal)s; please pass them in lowercase.")
+ elif s_low in ['butt', 'round', 'projecting']:
+ cbook.warn_deprecated(
+ "3.3", message="Case-insensitive joinstyles are deprecated "
+ "since %(since)s and support for them will be removed "
+ "%(removal)s; please pass them in lowercase.")
+ # Else, error out at the check_in_list stage.
+ return s_low
+
+
+class JoinStyle(str, _AutoStringNameEnum):
+ """
+ Define how the connection between two line segments is drawn.
+
+ For a visual impression of each *JoinStyle*, `view these docs online
+ `, or run `JoinStyle.demo`.
+
+ Lines in Matplotlib are typically defined by a 1D `~.path.Path` and a
+ finite ``linewidth``, where the underlying 1D `~.path.Path` represents the
+ center of the stroked line.
+
+ By default, `~.backend_bases.GraphicsContextBase` defines the boundaries of
+ a stroked line to simply be every point within some radius,
+ ``linewidth/2``, away from any point of the center line. However, this
+ results in corners appearing "rounded", which may not be the desired
+ behavior if you are drawing, for example, a polygon or pointed star.
+
+ **Supported values:**
+
+ .. rst-class:: value-list
+
+ 'miter'
+ the "arrow-tip" style. Each boundary of the filled-in area will
+ extend in a straight line parallel to the tangent vector of the
+ centerline at the point it meets the corner, until they meet in a
+ sharp point.
+ 'round'
+ stokes every point within a radius of ``linewidth/2`` of the center
+ lines.
+ 'bevel'
+ the "squared-off" style. It can be thought of as a rounded corner
+ where the "circular" part of the corner has been cut off.
+
+ .. note::
+
+ Very long miter tips are cut off (to form a *bevel*) after a
+ backend-dependent limit called the "miter limit", which specifies the
+ maximum allowed ratio of miter length to line width. For example, the
+ PDF backend uses the default value of 10 specified by the PDF standard,
+ while the SVG backend does not even specify the miter limit, resulting
+ in a default value of 4 per the SVG specification. Matplotlib does not
+ currently allow the user to adjust this parameter.
+
+ A more detailed description of the effect of a miter limit can be found
+ in the `Mozilla Developer Docs
+ `_
+
+ .. plot::
+ :alt: Demo of possible JoinStyle's
+
+ from matplotlib._enums import JoinStyle
+ JoinStyle.demo()
+
+ """
+
+ miter = auto()
+ round = auto()
+ bevel = auto()
+
+ def __init__(self, s):
+ s = _deprecate_case_insensitive_join_cap(s)
+ Enum.__init__(self)
+
+ @staticmethod
+ def demo():
+ """Demonstrate how each JoinStyle looks for various join angles."""
+ import numpy as np
+ import matplotlib.pyplot as plt
+
+ def plot_angle(ax, x, y, angle, style):
+ phi = np.radians(angle)
+ xx = [x + .5, x, x + .5*np.cos(phi)]
+ yy = [y, y, y + .5*np.sin(phi)]
+ ax.plot(xx, yy, lw=12, color='tab:blue', solid_joinstyle=style)
+ ax.plot(xx, yy, lw=1, color='black')
+ ax.plot(xx[1], yy[1], 'o', color='tab:red', markersize=3)
+
+ fig, ax = plt.subplots(figsize=(5, 4), constrained_layout=True)
+ ax.set_title('Join style')
+ for x, style in enumerate(['miter', 'round', 'bevel']):
+ ax.text(x, 5, style)
+ for y, angle in enumerate([20, 45, 60, 90, 120]):
+ plot_angle(ax, x, y, angle, style)
+ if x == 0:
+ ax.text(-1.3, y, f'{angle} degrees')
+ ax.set_xlim(-1.5, 2.75)
+ ax.set_ylim(-.5, 5.5)
+ ax.set_axis_off()
+ fig.show()
+
+
+JoinStyle.input_description = "{" \
+ + ", ".join([f"'{js.name}'" for js in JoinStyle]) \
+ + "}"
+
+
+class CapStyle(str, _AutoStringNameEnum):
+ r"""
+ Define how the two endpoints (caps) of an unclosed line are drawn.
+
+ How to draw the start and end points of lines that represent a closed curve
+ (i.e. that end in a `~.path.Path.CLOSEPOLY`) is controlled by the line's
+ `JoinStyle`. For all other lines, how the start and end points are drawn is
+ controlled by the *CapStyle*.
+
+ For a visual impression of each *CapStyle*, `view these docs online
+ ` or run `CapStyle.demo`.
+
+ **Supported values:**
+
+ .. rst-class:: value-list
+
+ 'butt'
+ the line is squared off at its endpoint.
+ 'projecting'
+ the line is squared off as in *butt*, but the filled in area
+ extends beyond the endpoint a distance of ``linewidth/2``.
+ 'round'
+ like *butt*, but a semicircular cap is added to the end of the
+ line, of radius ``linewidth/2``.
+
+ .. plot::
+ :alt: Demo of possible CapStyle's
+
+ from matplotlib._enums import CapStyle
+ CapStyle.demo()
+
+ """
+ butt = 'butt'
+ projecting = 'projecting'
+ round = 'round'
+
+ def __init__(self, s):
+ s = _deprecate_case_insensitive_join_cap(s)
+ Enum.__init__(self)
+
+ @staticmethod
+ def demo():
+ """Demonstrate how each CapStyle looks for a thick line segment."""
+ import matplotlib.pyplot as plt
+
+ fig = plt.figure(figsize=(4, 1.2))
+ ax = fig.add_axes([0, 0, 1, 0.8])
+ ax.set_title('Cap style')
+
+ for x, style in enumerate(['butt', 'round', 'projecting']):
+ ax.text(x+0.25, 0.85, style, ha='center')
+ xx = [x, x+0.5]
+ yy = [0, 0]
+ ax.plot(xx, yy, lw=12, color='tab:blue', solid_capstyle=style)
+ ax.plot(xx, yy, lw=1, color='black')
+ ax.plot(xx, yy, 'o', color='tab:red', markersize=3)
+ ax.text(2.25, 0.55, '(default)', ha='center')
+
+ ax.set_ylim(-.5, 1.5)
+ ax.set_axis_off()
+ fig.show()
+
+
+CapStyle.input_description = "{" \
+ + ", ".join([f"'{cs.name}'" for cs in CapStyle]) \
+ + "}"
+
+docstring.interpd.update({'JoinStyle': JoinStyle.input_description,
+ 'CapStyle': CapStyle.input_description})
diff --git a/venv/Lib/site-packages/matplotlib/_image.cp38-win_amd64.pyd b/venv/Lib/site-packages/matplotlib/_image.cp38-win_amd64.pyd
new file mode 100644
index 0000000..c1c4f1f
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/_image.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/matplotlib/_internal_utils.py b/venv/Lib/site-packages/matplotlib/_internal_utils.py
new file mode 100644
index 0000000..0223aa5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_internal_utils.py
@@ -0,0 +1,64 @@
+"""
+Internal debugging utilities, that are not expected to be used in the rest of
+the codebase.
+
+WARNING: Code in this module may change without prior notice!
+"""
+
+from io import StringIO
+from pathlib import Path
+import subprocess
+
+from matplotlib.transforms import TransformNode
+
+
+def graphviz_dump_transform(transform, dest, *, highlight=None):
+ """
+ Generate a graphical representation of the transform tree for *transform*
+ using the :program:`dot` program (which this function depends on). The
+ output format (png, dot, etc.) is determined from the suffix of *dest*.
+
+ Parameters
+ ----------
+ transform : `~matplotlib.transform.Transform`
+ The represented transform.
+ dest : str
+ Output filename. The extension must be one of the formats supported
+ by :program:`dot`, e.g. png, svg, dot, ...
+ (see https://www.graphviz.org/doc/info/output.html).
+ highlight : list of `~matplotlib.transform.Transform` or None
+ The transforms in the tree to be drawn in bold.
+ If *None*, *transform* is highlighted.
+ """
+
+ if highlight is None:
+ highlight = [transform]
+ seen = set()
+
+ def recurse(root, buf):
+ if id(root) in seen:
+ return
+ seen.add(id(root))
+ props = {}
+ label = type(root).__name__
+ if root._invalid:
+ label = f'[{label}]'
+ if root in highlight:
+ props['style'] = 'bold'
+ props['shape'] = 'box'
+ props['label'] = '"%s"' % label
+ props = ' '.join(map('{0[0]}={0[1]}'.format, props.items()))
+ buf.write(f'{id(root)} [{props}];\n')
+ for key, val in vars(root).items():
+ if isinstance(val, TransformNode) and id(root) in val._parents:
+ buf.write(f'"{id(root)}" -> "{id(val)}" '
+ f'[label="{key}", fontsize=10];\n')
+ recurse(val, buf)
+
+ buf = StringIO()
+ buf.write('digraph G {\n')
+ recurse(transform, buf)
+ buf.write('}\n')
+ subprocess.run(
+ ['dot', '-T', Path(dest).suffix[1:], '-o', dest],
+ input=buf.getvalue().encode('utf-8'), check=True)
diff --git a/venv/Lib/site-packages/matplotlib/_layoutgrid.py b/venv/Lib/site-packages/matplotlib/_layoutgrid.py
new file mode 100644
index 0000000..e46b3fe
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_layoutgrid.py
@@ -0,0 +1,560 @@
+"""
+A layoutgrid is a nrows by ncols set of boxes, meant to be used by
+`._constrained_layout`, each box is analogous to a subplotspec element of
+a gridspec.
+
+Each box is defined by left[ncols], right[ncols], bottom[nrows] and top[nrows],
+and by two editable margins for each side. The main margin gets its value
+set by the size of ticklabels, titles, etc on each axes that is in the figure.
+The outer margin is the padding around the axes, and space for any
+colorbars.
+
+The "inner" widths and heights of these boxes are then constrained to be the
+same (relative the values of `width_ratios[ncols]` and `height_ratios[nrows]`).
+
+The layoutgrid is then constrained to be contained within a parent layoutgrid,
+its column(s) and row(s) specified when it is created.
+"""
+
+import itertools
+import kiwisolver as kiwi
+import logging
+import numpy as np
+from matplotlib.transforms import Bbox
+
+
+_log = logging.getLogger(__name__)
+
+
+class LayoutGrid:
+ """
+ Analogous to a gridspec, and contained in another LayoutGrid.
+ """
+
+ def __init__(self, parent=None, parent_pos=(0, 0),
+ parent_inner=False, name='', ncols=1, nrows=1,
+ h_pad=None, w_pad=None, width_ratios=None,
+ height_ratios=None):
+ Variable = kiwi.Variable
+ self.parent = parent
+ self.parent_pos = parent_pos
+ self.parent_inner = parent_inner
+ self.name = name
+ self.nrows = nrows
+ self.ncols = ncols
+ self.height_ratios = np.atleast_1d(height_ratios)
+ if height_ratios is None:
+ self.height_ratios = np.ones(nrows)
+ self.width_ratios = np.atleast_1d(width_ratios)
+ if width_ratios is None:
+ self.width_ratios = np.ones(ncols)
+
+ sn = self.name + '_'
+ if parent is None:
+ self.parent = None
+ self.solver = kiwi.Solver()
+ else:
+ self.parent = parent
+ parent.add_child(self, *parent_pos)
+ self.solver = self.parent.solver
+ # keep track of artist associated w/ this layout. Can be none
+ self.artists = np.empty((nrows, ncols), dtype=object)
+ self.children = np.empty((nrows, ncols), dtype=object)
+
+ self.margins = {}
+ self.margin_vals = {}
+ # all the boxes in each column share the same left/right margins:
+ for todo in ['left', 'right', 'leftcb', 'rightcb']:
+ # track the value so we can change only if a margin is larger
+ # than the current value
+ self.margin_vals[todo] = np.zeros(ncols)
+
+ sol = self.solver
+
+ # These are redundant, but make life easier if
+ # we define them all. All that is really
+ # needed is left/right, margin['left'], and margin['right']
+ self.widths = [Variable(f'{sn}widths[{i}]') for i in range(ncols)]
+ self.lefts = [Variable(f'{sn}lefts[{i}]') for i in range(ncols)]
+ self.rights = [Variable(f'{sn}rights[{i}]') for i in range(ncols)]
+ self.inner_widths = [Variable(f'{sn}inner_widths[{i}]')
+ for i in range(ncols)]
+ for todo in ['left', 'right', 'leftcb', 'rightcb']:
+ self.margins[todo] = [Variable(f'{sn}margins[{todo}][{i}]')
+ for i in range(ncols)]
+ for i in range(ncols):
+ sol.addEditVariable(self.margins[todo][i], 'strong')
+
+ for todo in ['bottom', 'top', 'bottomcb', 'topcb']:
+ self.margins[todo] = np.empty((nrows), dtype=object)
+ self.margin_vals[todo] = np.zeros(nrows)
+
+ self.heights = [Variable(f'{sn}heights[{i}]') for i in range(nrows)]
+ self.inner_heights = [Variable(f'{sn}inner_heights[{i}]')
+ for i in range(nrows)]
+ self.bottoms = [Variable(f'{sn}bottoms[{i}]') for i in range(nrows)]
+ self.tops = [Variable(f'{sn}tops[{i}]') for i in range(nrows)]
+ for todo in ['bottom', 'top', 'bottomcb', 'topcb']:
+ self.margins[todo] = [Variable(f'{sn}margins[{todo}][{i}]')
+ for i in range(nrows)]
+ for i in range(nrows):
+ sol.addEditVariable(self.margins[todo][i], 'strong')
+
+ # set these margins to zero by default. They will be edited as
+ # children are filled.
+ self.reset_margins()
+ self.add_constraints()
+
+ self.h_pad = h_pad
+ self.w_pad = w_pad
+
+ def __repr__(self):
+ str = f'LayoutBox: {self.name:25s} {self.nrows}x{self.ncols},\n'
+ for i in range(self.nrows):
+ for j in range(self.ncols):
+ str += f'{i}, {j}: '\
+ f'L({self.lefts[j].value():1.3f}, ' \
+ f'B{self.bottoms[i].value():1.3f}, ' \
+ f'W{self.widths[j].value():1.3f}, ' \
+ f'H{self.heights[i].value():1.3f}, ' \
+ f'innerW{self.inner_widths[j].value():1.3f}, ' \
+ f'innerH{self.inner_heights[i].value():1.3f}, ' \
+ f'ML{self.margins["left"][j].value():1.3f}, ' \
+ f'MR{self.margins["right"][j].value():1.3f}, \n'
+ return str
+
+ def reset_margins(self):
+ """
+ Reset all the margins to zero. Must do this after changing
+ figure size, for instance, because the relative size of the
+ axes labels etc changes.
+ """
+ for todo in ['left', 'right', 'bottom', 'top',
+ 'leftcb', 'rightcb', 'bottomcb', 'topcb']:
+ self.edit_margins(todo, 0.0)
+
+ def add_constraints(self):
+ # define self-consistent constraints
+ self.hard_constraints()
+ # define relationship with parent layoutgrid:
+ self.parent_constraints()
+ # define relative widths of the grid cells to each other
+ # and stack horizontally and vertically.
+ self.grid_constraints()
+
+ def hard_constraints(self):
+ """
+ These are the redundant constraints, plus ones that make the
+ rest of the code easier.
+ """
+ for i in range(self.ncols):
+ hc = [self.rights[i] >= self.lefts[i],
+ (self.rights[i] - self.margins['right'][i] -
+ self.margins['rightcb'][i] >=
+ self.lefts[i] - self.margins['left'][i] -
+ self.margins['leftcb'][i])
+ ]
+ for c in hc:
+ self.solver.addConstraint(c | 'required')
+
+ for i in range(self.nrows):
+ hc = [self.tops[i] >= self.bottoms[i],
+ (self.tops[i] - self.margins['top'][i] -
+ self.margins['topcb'][i] >=
+ self.bottoms[i] - self.margins['bottom'][i] -
+ self.margins['bottomcb'][i])
+ ]
+ for c in hc:
+ self.solver.addConstraint(c | 'required')
+
+ def add_child(self, child, i=0, j=0):
+ self.children[i, j] = child
+
+ def parent_constraints(self):
+ # constraints that are due to the parent...
+ # i.e. the first column's left is equal to the
+ # parent's left, the last column right equal to the
+ # parent's right...
+ parent = self.parent
+ if parent is None:
+ hc = [self.lefts[0] == 0,
+ self.rights[-1] == 1,
+ # top and bottom reversed order...
+ self.tops[0] == 1,
+ self.bottoms[-1] == 0]
+ else:
+ rows, cols = self.parent_pos
+ rows = np.atleast_1d(rows)
+ cols = np.atleast_1d(cols)
+
+ left = parent.lefts[cols[0]]
+ right = parent.rights[cols[-1]]
+ top = parent.tops[rows[0]]
+ bottom = parent.bottoms[rows[-1]]
+ if self.parent_inner:
+ # the layout grid is contained inside the inner
+ # grid of the parent.
+ left += parent.margins['left'][cols[0]]
+ left += parent.margins['leftcb'][cols[0]]
+ right -= parent.margins['right'][cols[-1]]
+ right -= parent.margins['rightcb'][cols[-1]]
+ top -= parent.margins['top'][rows[0]]
+ top -= parent.margins['topcb'][rows[0]]
+ bottom += parent.margins['bottom'][rows[-1]]
+ bottom += parent.margins['bottomcb'][rows[-1]]
+ hc = [self.lefts[0] == left,
+ self.rights[-1] == right,
+ # from top to bottom
+ self.tops[0] == top,
+ self.bottoms[-1] == bottom]
+ for c in hc:
+ self.solver.addConstraint(c | 'required')
+
+ def grid_constraints(self):
+ # constrain the ratio of the inner part of the grids
+ # to be the same (relative to width_ratios)
+
+ # constrain widths:
+ w = (self.rights[0] - self.margins['right'][0] -
+ self.margins['rightcb'][0])
+ w = (w - self.lefts[0] - self.margins['left'][0] -
+ self.margins['leftcb'][0])
+ w0 = w / self.width_ratios[0]
+ # from left to right
+ for i in range(1, self.ncols):
+ w = (self.rights[i] - self.margins['right'][i] -
+ self.margins['rightcb'][i])
+ w = (w - self.lefts[i] - self.margins['left'][i] -
+ self.margins['leftcb'][i])
+ c = (w == w0 * self.width_ratios[i])
+ self.solver.addConstraint(c | 'strong')
+ # constrain the grid cells to be directly next to each other.
+ c = (self.rights[i - 1] == self.lefts[i])
+ self.solver.addConstraint(c | 'strong')
+
+ # constrain heights:
+ h = self.tops[0] - self.margins['top'][0] - self.margins['topcb'][0]
+ h = (h - self.bottoms[0] - self.margins['bottom'][0] -
+ self.margins['bottomcb'][0])
+ h0 = h / self.height_ratios[0]
+ # from top to bottom:
+ for i in range(1, self.nrows):
+ h = (self.tops[i] - self.margins['top'][i] -
+ self.margins['topcb'][i])
+ h = (h - self.bottoms[i] - self.margins['bottom'][i] -
+ self.margins['bottomcb'][i])
+ c = (h == h0 * self.height_ratios[i])
+ self.solver.addConstraint(c | 'strong')
+ # constrain the grid cells to be directly above each other.
+ c = (self.bottoms[i - 1] == self.tops[i])
+ self.solver.addConstraint(c | 'strong')
+
+ # Margin editing: The margins are variable and meant to
+ # contain things of a fixed size like axes labels, tick labels, titles
+ # etc
+ def edit_margin(self, todo, size, cell):
+ """
+ Change the size of the margin for one cell.
+
+ Parameters
+ ----------
+ todo : string (one of 'left', 'right', 'bottom', 'top')
+ margin to alter.
+
+ size : float
+ Size of the margin. If it is larger than the existing minimum it
+ updates the margin size. Fraction of figure size.
+
+ cell : int
+ Cell column or row to edit.
+ """
+ self.solver.suggestValue(self.margins[todo][cell], size)
+ self.margin_vals[todo][cell] = size
+
+ def edit_margin_min(self, todo, size, cell=0):
+ """
+ Change the minimum size of the margin for one cell.
+
+ Parameters
+ ----------
+ todo : string (one of 'left', 'right', 'bottom', 'top')
+ margin to alter.
+
+ size : float
+ Minimum size of the margin . If it is larger than the
+ existing minimum it updates the margin size. Fraction of
+ figure size.
+
+ cell : int
+ Cell column or row to edit.
+ """
+
+ if size > self.margin_vals[todo][cell]:
+ self.edit_margin(todo, size, cell)
+
+ def edit_margins(self, todo, size):
+ """
+ Change the size of all the margin of all the cells in the layout grid.
+
+ Parameters
+ ----------
+ todo : string (one of 'left', 'right', 'bottom', 'top')
+ margin to alter.
+
+ size : float
+ Size to set the margins. Fraction of figure size.
+ """
+
+ for i in range(len(self.margin_vals[todo])):
+ self.edit_margin(todo, size, i)
+
+ def edit_all_margins_min(self, todo, size):
+ """
+ Change the minimum size of all the margin of all
+ the cells in the layout grid.
+
+ Parameters
+ ----------
+ todo : {'left', 'right', 'bottom', 'top'}
+ The margin to alter.
+
+ size : float
+ Minimum size of the margin. If it is larger than the
+ existing minimum it updates the margin size. Fraction of
+ figure size.
+ """
+
+ for i in range(len(self.margin_vals[todo])):
+ self.edit_margin_min(todo, size, i)
+
+ def edit_outer_margin_mins(self, margin, ss):
+ """
+ Edit all four margin minimums in one statement.
+
+ Parameters
+ ----------
+ margin : dict
+ size of margins in a dict with keys 'left', 'right', 'bottom',
+ 'top'
+
+ ss : SubplotSpec
+ defines the subplotspec these margins should be applied to
+ """
+
+ self.edit_margin_min('left', margin['left'], ss.colspan.start)
+ self.edit_margin_min('leftcb', margin['leftcb'], ss.colspan.start)
+ self.edit_margin_min('right', margin['right'], ss.colspan.stop - 1)
+ self.edit_margin_min('rightcb', margin['rightcb'], ss.colspan.stop - 1)
+ # rows are from the top down:
+ self.edit_margin_min('top', margin['top'], ss.rowspan.start)
+ self.edit_margin_min('topcb', margin['topcb'], ss.rowspan.start)
+ self.edit_margin_min('bottom', margin['bottom'], ss.rowspan.stop - 1)
+ self.edit_margin_min('bottomcb', margin['bottomcb'],
+ ss.rowspan.stop - 1)
+
+ def get_margins(self, todo, col):
+ """Return the margin at this position"""
+ return self.margin_vals[todo][col]
+
+ def get_outer_bbox(self, rows=0, cols=0):
+ """
+ Return the outer bounding box of the subplot specs
+ given by rows and cols. rows and cols can be spans.
+ """
+ rows = np.atleast_1d(rows)
+ cols = np.atleast_1d(cols)
+
+ bbox = Bbox.from_extents(
+ self.lefts[cols[0]].value(),
+ self.bottoms[rows[-1]].value(),
+ self.rights[cols[-1]].value(),
+ self.tops[rows[0]].value())
+ return bbox
+
+ def get_inner_bbox(self, rows=0, cols=0):
+ """
+ Return the inner bounding box of the subplot specs
+ given by rows and cols. rows and cols can be spans.
+ """
+ rows = np.atleast_1d(rows)
+ cols = np.atleast_1d(cols)
+
+ bbox = Bbox.from_extents(
+ (self.lefts[cols[0]].value() +
+ self.margins['left'][cols[0]].value() +
+ self.margins['leftcb'][cols[0]].value()),
+ (self.bottoms[rows[-1]].value() +
+ self.margins['bottom'][rows[-1]].value() +
+ self.margins['bottomcb'][rows[-1]].value()),
+ (self.rights[cols[-1]].value() -
+ self.margins['right'][cols[-1]].value() -
+ self.margins['rightcb'][cols[-1]].value()),
+ (self.tops[rows[0]].value() -
+ self.margins['top'][rows[0]].value() -
+ self.margins['topcb'][rows[0]].value())
+ )
+ return bbox
+
+ def get_bbox_for_cb(self, rows=0, cols=0):
+ """
+ Return the bounding box that includes the
+ decorations but, *not* the colorbar...
+ """
+ rows = np.atleast_1d(rows)
+ cols = np.atleast_1d(cols)
+
+ bbox = Bbox.from_extents(
+ (self.lefts[cols[0]].value() +
+ self.margins['leftcb'][cols[0]].value()),
+ (self.bottoms[rows[-1]].value() +
+ self.margins['bottomcb'][rows[-1]].value()),
+ (self.rights[cols[-1]].value() -
+ self.margins['rightcb'][cols[-1]].value()),
+ (self.tops[rows[0]].value() -
+ self.margins['topcb'][rows[0]].value())
+ )
+ return bbox
+
+ def get_left_margin_bbox(self, rows=0, cols=0):
+ """
+ Return the left margin bounding box of the subplot specs
+ given by rows and cols. rows and cols can be spans.
+ """
+ rows = np.atleast_1d(rows)
+ cols = np.atleast_1d(cols)
+
+ bbox = Bbox.from_extents(
+ (self.lefts[cols[0]].value() +
+ self.margins['leftcb'][cols[0]].value()),
+ (self.bottoms[rows[-1]].value()),
+ (self.lefts[cols[0]].value() +
+ self.margins['leftcb'][cols[0]].value() +
+ self.margins['left'][cols[0]].value()),
+ (self.tops[rows[0]].value()))
+ return bbox
+
+ def get_bottom_margin_bbox(self, rows=0, cols=0):
+ """
+ Return the left margin bounding box of the subplot specs
+ given by rows and cols. rows and cols can be spans.
+ """
+ rows = np.atleast_1d(rows)
+ cols = np.atleast_1d(cols)
+
+ bbox = Bbox.from_extents(
+ (self.lefts[cols[0]].value()),
+ (self.bottoms[rows[-1]].value() +
+ self.margins['bottomcb'][rows[-1]].value()),
+ (self.rights[cols[-1]].value()),
+ (self.bottoms[rows[-1]].value() +
+ self.margins['bottom'][rows[-1]].value() +
+ self.margins['bottomcb'][rows[-1]].value()
+ ))
+ return bbox
+
+ def get_right_margin_bbox(self, rows=0, cols=0):
+ """
+ Return the left margin bounding box of the subplot specs
+ given by rows and cols. rows and cols can be spans.
+ """
+ rows = np.atleast_1d(rows)
+ cols = np.atleast_1d(cols)
+
+ bbox = Bbox.from_extents(
+ (self.rights[cols[-1]].value() -
+ self.margins['right'][cols[-1]].value() -
+ self.margins['rightcb'][cols[-1]].value()),
+ (self.bottoms[rows[-1]].value()),
+ (self.rights[cols[-1]].value() -
+ self.margins['rightcb'][cols[-1]].value()),
+ (self.tops[rows[0]].value()))
+ return bbox
+
+ def get_top_margin_bbox(self, rows=0, cols=0):
+ """
+ Return the left margin bounding box of the subplot specs
+ given by rows and cols. rows and cols can be spans.
+ """
+ rows = np.atleast_1d(rows)
+ cols = np.atleast_1d(cols)
+
+ bbox = Bbox.from_extents(
+ (self.lefts[cols[0]].value()),
+ (self.tops[rows[0]].value() -
+ self.margins['topcb'][rows[0]].value()),
+ (self.rights[cols[-1]].value()),
+ (self.tops[rows[0]].value() -
+ self.margins['topcb'][rows[0]].value() -
+ self.margins['top'][rows[0]].value()))
+ return bbox
+
+ def update_variables(self):
+ """
+ Update the variables for the solver attached to this layoutgrid.
+ """
+ self.solver.updateVariables()
+
+_layoutboxobjnum = itertools.count()
+
+
+def seq_id():
+ """Generate a short sequential id for layoutbox objects."""
+ return '%06d' % next(_layoutboxobjnum)
+
+
+def print_children(lb):
+ """Print the children of the layoutbox."""
+ for child in lb.children:
+ print_children(child)
+
+
+def plot_children(fig, lg, level=0, printit=False):
+ """Simple plotting to show where boxes are."""
+ import matplotlib.pyplot as plt
+ import matplotlib.patches as mpatches
+
+ fig.canvas.draw()
+
+ colors = plt.rcParams["axes.prop_cycle"].by_key()["color"]
+ col = colors[level]
+ for i in range(lg.nrows):
+ for j in range(lg.ncols):
+ bb = lg.get_outer_bbox(rows=i, cols=j)
+ fig.add_artist(
+ mpatches.Rectangle(bb.p0, bb.width, bb.height, linewidth=1,
+ edgecolor='0.7', facecolor='0.7',
+ alpha=0.2, transform=fig.transFigure,
+ zorder=-3))
+ bbi = lg.get_inner_bbox(rows=i, cols=j)
+ fig.add_artist(
+ mpatches.Rectangle(bbi.p0, bbi.width, bbi.height, linewidth=2,
+ edgecolor=col, facecolor='none',
+ transform=fig.transFigure, zorder=-2))
+
+ bbi = lg.get_left_margin_bbox(rows=i, cols=j)
+ fig.add_artist(
+ mpatches.Rectangle(bbi.p0, bbi.width, bbi.height, linewidth=0,
+ edgecolor='none', alpha=0.2,
+ facecolor=[0.5, 0.7, 0.5],
+ transform=fig.transFigure, zorder=-2))
+ bbi = lg.get_right_margin_bbox(rows=i, cols=j)
+ fig.add_artist(
+ mpatches.Rectangle(bbi.p0, bbi.width, bbi.height, linewidth=0,
+ edgecolor='none', alpha=0.2,
+ facecolor=[0.7, 0.5, 0.5],
+ transform=fig.transFigure, zorder=-2))
+ bbi = lg.get_bottom_margin_bbox(rows=i, cols=j)
+ fig.add_artist(
+ mpatches.Rectangle(bbi.p0, bbi.width, bbi.height, linewidth=0,
+ edgecolor='none', alpha=0.2,
+ facecolor=[0.5, 0.5, 0.7],
+ transform=fig.transFigure, zorder=-2))
+ bbi = lg.get_top_margin_bbox(rows=i, cols=j)
+ fig.add_artist(
+ mpatches.Rectangle(bbi.p0, bbi.width, bbi.height, linewidth=0,
+ edgecolor='none', alpha=0.2,
+ facecolor=[0.7, 0.2, 0.7],
+ transform=fig.transFigure, zorder=-2))
+ for ch in lg.children.flat:
+ if ch is not None:
+ plot_children(fig, ch, level=level+1)
diff --git a/venv/Lib/site-packages/matplotlib/_mathtext.py b/venv/Lib/site-packages/matplotlib/_mathtext.py
new file mode 100644
index 0000000..6f0e47b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_mathtext.py
@@ -0,0 +1,2997 @@
+"""
+Implementation details for :mod:`.mathtext`.
+"""
+
+from collections import namedtuple
+import enum
+import functools
+from io import StringIO
+import logging
+import os
+import types
+import unicodedata
+
+import numpy as np
+from pyparsing import (
+ Combine, Empty, FollowedBy, Forward, Group, Literal, oneOf, OneOrMore,
+ Optional, ParseBaseException, ParseFatalException, ParserElement,
+ ParseResults, QuotedString, Regex, StringEnd, Suppress, ZeroOrMore)
+
+import matplotlib as mpl
+from . import _api, cbook
+from ._mathtext_data import (
+ latex_to_bakoma, latex_to_standard, stix_virtual_fonts, tex2uni)
+from .afm import AFM
+from .font_manager import FontProperties, findfont, get_font
+from .ft2font import KERNING_DEFAULT
+
+
+ParserElement.enablePackrat()
+_log = logging.getLogger("matplotlib.mathtext")
+
+
+##############################################################################
+# FONTS
+
+
+def get_unicode_index(symbol, math=True):
+ r"""
+ Return the integer index (from the Unicode table) of *symbol*.
+
+ Parameters
+ ----------
+ symbol : str
+ A single unicode character, a TeX command (e.g. r'\pi') or a Type1
+ symbol name (e.g. 'phi').
+ math : bool, default: True
+ If False, always treat as a single unicode character.
+ """
+ # for a non-math symbol, simply return its unicode index
+ if not math:
+ return ord(symbol)
+ # From UTF #25: U+2212 minus sign is the preferred
+ # representation of the unary and binary minus sign rather than
+ # the ASCII-derived U+002D hyphen-minus, because minus sign is
+ # unambiguous and because it is rendered with a more desirable
+ # length, usually longer than a hyphen.
+ if symbol == '-':
+ return 0x2212
+ try: # This will succeed if symbol is a single unicode char
+ return ord(symbol)
+ except TypeError:
+ pass
+ try: # Is symbol a TeX symbol (i.e. \alpha)
+ return tex2uni[symbol.strip("\\")]
+ except KeyError as err:
+ raise ValueError(
+ "'{}' is not a valid Unicode character or TeX/Type1 symbol"
+ .format(symbol)) from err
+
+
+class Fonts:
+ """
+ An abstract base class for a system of fonts to use for mathtext.
+
+ The class must be able to take symbol keys and font file names and
+ return the character metrics. It also delegates to a backend class
+ to do the actual drawing.
+ """
+
+ def __init__(self, default_font_prop, mathtext_backend):
+ """
+ Parameters
+ ----------
+ default_font_prop : `~.font_manager.FontProperties`
+ The default non-math font, or the base font for Unicode (generic)
+ font rendering.
+ mathtext_backend : `MathtextBackend` subclass
+ Backend to which rendering is actually delegated.
+ """
+ self.default_font_prop = default_font_prop
+ self.mathtext_backend = mathtext_backend
+ self.used_characters = {}
+
+ @_api.deprecated("3.4")
+ def destroy(self):
+ """
+ Fix any cyclical references before the object is about
+ to be destroyed.
+ """
+ self.used_characters = None
+
+ def get_kern(self, font1, fontclass1, sym1, fontsize1,
+ font2, fontclass2, sym2, fontsize2, dpi):
+ """
+ Get the kerning distance for font between *sym1* and *sym2*.
+
+ See `~.Fonts.get_metrics` for a detailed description of the parameters.
+ """
+ return 0.
+
+ def get_metrics(self, font, font_class, sym, fontsize, dpi, math=True):
+ r"""
+ Parameters
+ ----------
+ font : str
+ One of the TeX font names: "tt", "it", "rm", "cal", "sf", "bf",
+ "default", "regular", "bb", "frak", "scr". "default" and "regular"
+ are synonyms and use the non-math font.
+ font_class : str
+ One of the TeX font names (as for *font*), but **not** "bb",
+ "frak", or "scr". This is used to combine two font classes. The
+ only supported combination currently is ``get_metrics("frak", "bf",
+ ...)``.
+ sym : str
+ A symbol in raw TeX form, e.g., "1", "x", or "\sigma".
+ fontsize : float
+ Font size in points.
+ dpi : float
+ Rendering dots-per-inch.
+ math : bool
+ Whether we are currently in math mode or not.
+
+ Returns
+ -------
+ object
+
+ The returned object has the following attributes (all floats,
+ except *slanted*):
+
+ - *advance*: The advance distance (in points) of the glyph.
+ - *height*: The height of the glyph in points.
+ - *width*: The width of the glyph in points.
+ - *xmin*, *xmax*, *ymin*, *ymax*: The ink rectangle of the glyph
+ - *iceberg*: The distance from the baseline to the top of the
+ glyph. (This corresponds to TeX's definition of "height".)
+ - *slanted*: Whether the glyph should be considered as "slanted"
+ (currently used for kerning sub/superscripts).
+ """
+ info = self._get_info(font, font_class, sym, fontsize, dpi, math)
+ return info.metrics
+
+ def set_canvas_size(self, w, h, d):
+ """
+ Set the size of the buffer used to render the math expression.
+ Only really necessary for the bitmap backends.
+ """
+ self.width, self.height, self.depth = np.ceil([w, h, d])
+ self.mathtext_backend.set_canvas_size(
+ self.width, self.height, self.depth)
+
+ @_api.rename_parameter("3.4", "facename", "font")
+ def render_glyph(self, ox, oy, font, font_class, sym, fontsize, dpi):
+ """
+ At position (*ox*, *oy*), draw the glyph specified by the remaining
+ parameters (see `get_metrics` for their detailed description).
+ """
+ info = self._get_info(font, font_class, sym, fontsize, dpi)
+ self.used_characters.setdefault(info.font.fname, set()).add(info.num)
+ self.mathtext_backend.render_glyph(ox, oy, info)
+
+ def render_rect_filled(self, x1, y1, x2, y2):
+ """
+ Draw a filled rectangle from (*x1*, *y1*) to (*x2*, *y2*).
+ """
+ self.mathtext_backend.render_rect_filled(x1, y1, x2, y2)
+
+ def get_xheight(self, font, fontsize, dpi):
+ """
+ Get the xheight for the given *font* and *fontsize*.
+ """
+ raise NotImplementedError()
+
+ def get_underline_thickness(self, font, fontsize, dpi):
+ """
+ Get the line thickness that matches the given font. Used as a
+ base unit for drawing lines such as in a fraction or radical.
+ """
+ raise NotImplementedError()
+
+ def get_used_characters(self):
+ """
+ Get the set of characters that were used in the math
+ expression. Used by backends that need to subset fonts so
+ they know which glyphs to include.
+ """
+ return self.used_characters
+
+ def get_results(self, box):
+ """
+ Get the data needed by the backend to render the math
+ expression. The return value is backend-specific.
+ """
+ result = self.mathtext_backend.get_results(
+ box, self.get_used_characters())
+ if self.destroy != TruetypeFonts.destroy.__get__(self):
+ destroy = _api.deprecate_method_override(
+ __class__.destroy, self, since="3.4")
+ if destroy:
+ destroy()
+ return result
+
+ def get_sized_alternatives_for_symbol(self, fontname, sym):
+ """
+ Override if your font provides multiple sizes of the same
+ symbol. Should return a list of symbols matching *sym* in
+ various sizes. The expression renderer will select the most
+ appropriate size for a given situation from this list.
+ """
+ return [(fontname, sym)]
+
+
+class TruetypeFonts(Fonts):
+ """
+ A generic base class for all font setups that use Truetype fonts
+ (through FT2Font).
+ """
+ def __init__(self, default_font_prop, mathtext_backend):
+ super().__init__(default_font_prop, mathtext_backend)
+ self.glyphd = {}
+ self._fonts = {}
+
+ filename = findfont(default_font_prop)
+ default_font = get_font(filename)
+ self._fonts['default'] = default_font
+ self._fonts['regular'] = default_font
+
+ @_api.deprecated("3.4")
+ def destroy(self):
+ self.glyphd = None
+ super().destroy()
+
+ def _get_font(self, font):
+ if font in self.fontmap:
+ basename = self.fontmap[font]
+ else:
+ basename = font
+ cached_font = self._fonts.get(basename)
+ if cached_font is None and os.path.exists(basename):
+ cached_font = get_font(basename)
+ self._fonts[basename] = cached_font
+ self._fonts[cached_font.postscript_name] = cached_font
+ self._fonts[cached_font.postscript_name.lower()] = cached_font
+ return cached_font
+
+ def _get_offset(self, font, glyph, fontsize, dpi):
+ if font.postscript_name == 'Cmex10':
+ return (glyph.height / 64 / 2) + (fontsize/3 * dpi/72)
+ return 0.
+
+ def _get_info(self, fontname, font_class, sym, fontsize, dpi, math=True):
+ key = fontname, font_class, sym, fontsize, dpi
+ bunch = self.glyphd.get(key)
+ if bunch is not None:
+ return bunch
+
+ font, num, symbol_name, fontsize, slanted = \
+ self._get_glyph(fontname, font_class, sym, fontsize, math)
+
+ font.set_size(fontsize, dpi)
+ glyph = font.load_char(
+ num,
+ flags=self.mathtext_backend.get_hinting_type())
+
+ xmin, ymin, xmax, ymax = [val/64.0 for val in glyph.bbox]
+ offset = self._get_offset(font, glyph, fontsize, dpi)
+ metrics = types.SimpleNamespace(
+ advance = glyph.linearHoriAdvance/65536.0,
+ height = glyph.height/64.0,
+ width = glyph.width/64.0,
+ xmin = xmin,
+ xmax = xmax,
+ ymin = ymin+offset,
+ ymax = ymax+offset,
+ # iceberg is the equivalent of TeX's "height"
+ iceberg = glyph.horiBearingY/64.0 + offset,
+ slanted = slanted
+ )
+
+ result = self.glyphd[key] = types.SimpleNamespace(
+ font = font,
+ fontsize = fontsize,
+ postscript_name = font.postscript_name,
+ metrics = metrics,
+ symbol_name = symbol_name,
+ num = num,
+ glyph = glyph,
+ offset = offset
+ )
+ return result
+
+ def get_xheight(self, fontname, fontsize, dpi):
+ font = self._get_font(fontname)
+ font.set_size(fontsize, dpi)
+ pclt = font.get_sfnt_table('pclt')
+ if pclt is None:
+ # Some fonts don't store the xHeight, so we do a poor man's xHeight
+ metrics = self.get_metrics(
+ fontname, mpl.rcParams['mathtext.default'], 'x', fontsize, dpi)
+ return metrics.iceberg
+ xHeight = (pclt['xHeight'] / 64.0) * (fontsize / 12.0) * (dpi / 100.0)
+ return xHeight
+
+ def get_underline_thickness(self, font, fontsize, dpi):
+ # This function used to grab underline thickness from the font
+ # metrics, but that information is just too un-reliable, so it
+ # is now hardcoded.
+ return ((0.75 / 12.0) * fontsize * dpi) / 72.0
+
+ def get_kern(self, font1, fontclass1, sym1, fontsize1,
+ font2, fontclass2, sym2, fontsize2, dpi):
+ if font1 == font2 and fontsize1 == fontsize2:
+ info1 = self._get_info(font1, fontclass1, sym1, fontsize1, dpi)
+ info2 = self._get_info(font2, fontclass2, sym2, fontsize2, dpi)
+ font = info1.font
+ return font.get_kerning(info1.num, info2.num, KERNING_DEFAULT) / 64
+ return super().get_kern(font1, fontclass1, sym1, fontsize1,
+ font2, fontclass2, sym2, fontsize2, dpi)
+
+
+class BakomaFonts(TruetypeFonts):
+ """
+ Use the Bakoma TrueType fonts for rendering.
+
+ Symbols are strewn about a number of font files, each of which has
+ its own proprietary 8-bit encoding.
+ """
+ _fontmap = {
+ 'cal': 'cmsy10',
+ 'rm': 'cmr10',
+ 'tt': 'cmtt10',
+ 'it': 'cmmi10',
+ 'bf': 'cmb10',
+ 'sf': 'cmss10',
+ 'ex': 'cmex10',
+ }
+
+ def __init__(self, *args, **kwargs):
+ self._stix_fallback = StixFonts(*args, **kwargs)
+
+ super().__init__(*args, **kwargs)
+ self.fontmap = {}
+ for key, val in self._fontmap.items():
+ fullpath = findfont(val)
+ self.fontmap[key] = fullpath
+ self.fontmap[val] = fullpath
+
+ _slanted_symbols = set(r"\int \oint".split())
+
+ def _get_glyph(self, fontname, font_class, sym, fontsize, math=True):
+ symbol_name = None
+ font = None
+ if fontname in self.fontmap and sym in latex_to_bakoma:
+ basename, num = latex_to_bakoma[sym]
+ slanted = (basename == "cmmi10") or sym in self._slanted_symbols
+ font = self._get_font(basename)
+ elif len(sym) == 1:
+ slanted = (fontname == "it")
+ font = self._get_font(fontname)
+ if font is not None:
+ num = ord(sym)
+
+ if font is not None:
+ gid = font.get_char_index(num)
+ if gid != 0:
+ symbol_name = font.get_glyph_name(gid)
+
+ if symbol_name is None:
+ return self._stix_fallback._get_glyph(
+ fontname, font_class, sym, fontsize, math)
+
+ return font, num, symbol_name, fontsize, slanted
+
+ # The Bakoma fonts contain many pre-sized alternatives for the
+ # delimiters. The AutoSizedChar class will use these alternatives
+ # and select the best (closest sized) glyph.
+ _size_alternatives = {
+ '(': [('rm', '('), ('ex', '\xa1'), ('ex', '\xb3'),
+ ('ex', '\xb5'), ('ex', '\xc3')],
+ ')': [('rm', ')'), ('ex', '\xa2'), ('ex', '\xb4'),
+ ('ex', '\xb6'), ('ex', '\x21')],
+ '{': [('cal', '{'), ('ex', '\xa9'), ('ex', '\x6e'),
+ ('ex', '\xbd'), ('ex', '\x28')],
+ '}': [('cal', '}'), ('ex', '\xaa'), ('ex', '\x6f'),
+ ('ex', '\xbe'), ('ex', '\x29')],
+ # The fourth size of '[' is mysteriously missing from the BaKoMa
+ # font, so I've omitted it for both '[' and ']'
+ '[': [('rm', '['), ('ex', '\xa3'), ('ex', '\x68'),
+ ('ex', '\x22')],
+ ']': [('rm', ']'), ('ex', '\xa4'), ('ex', '\x69'),
+ ('ex', '\x23')],
+ r'\lfloor': [('ex', '\xa5'), ('ex', '\x6a'),
+ ('ex', '\xb9'), ('ex', '\x24')],
+ r'\rfloor': [('ex', '\xa6'), ('ex', '\x6b'),
+ ('ex', '\xba'), ('ex', '\x25')],
+ r'\lceil': [('ex', '\xa7'), ('ex', '\x6c'),
+ ('ex', '\xbb'), ('ex', '\x26')],
+ r'\rceil': [('ex', '\xa8'), ('ex', '\x6d'),
+ ('ex', '\xbc'), ('ex', '\x27')],
+ r'\langle': [('ex', '\xad'), ('ex', '\x44'),
+ ('ex', '\xbf'), ('ex', '\x2a')],
+ r'\rangle': [('ex', '\xae'), ('ex', '\x45'),
+ ('ex', '\xc0'), ('ex', '\x2b')],
+ r'\__sqrt__': [('ex', '\x70'), ('ex', '\x71'),
+ ('ex', '\x72'), ('ex', '\x73')],
+ r'\backslash': [('ex', '\xb2'), ('ex', '\x2f'),
+ ('ex', '\xc2'), ('ex', '\x2d')],
+ r'/': [('rm', '/'), ('ex', '\xb1'), ('ex', '\x2e'),
+ ('ex', '\xcb'), ('ex', '\x2c')],
+ r'\widehat': [('rm', '\x5e'), ('ex', '\x62'), ('ex', '\x63'),
+ ('ex', '\x64')],
+ r'\widetilde': [('rm', '\x7e'), ('ex', '\x65'), ('ex', '\x66'),
+ ('ex', '\x67')],
+ r'<': [('cal', 'h'), ('ex', 'D')],
+ r'>': [('cal', 'i'), ('ex', 'E')]
+ }
+
+ for alias, target in [(r'\leftparen', '('),
+ (r'\rightparent', ')'),
+ (r'\leftbrace', '{'),
+ (r'\rightbrace', '}'),
+ (r'\leftbracket', '['),
+ (r'\rightbracket', ']'),
+ (r'\{', '{'),
+ (r'\}', '}'),
+ (r'\[', '['),
+ (r'\]', ']')]:
+ _size_alternatives[alias] = _size_alternatives[target]
+
+ def get_sized_alternatives_for_symbol(self, fontname, sym):
+ return self._size_alternatives.get(sym, [(fontname, sym)])
+
+
+class UnicodeFonts(TruetypeFonts):
+ """
+ An abstract base class for handling Unicode fonts.
+
+ While some reasonably complete Unicode fonts (such as DejaVu) may
+ work in some situations, the only Unicode font I'm aware of with a
+ complete set of math symbols is STIX.
+
+ This class will "fallback" on the Bakoma fonts when a required
+ symbol can not be found in the font.
+ """
+ use_cmex = True # Unused; delete once mathtext becomes private.
+
+ def __init__(self, *args, **kwargs):
+ # This must come first so the backend's owner is set correctly
+ fallback_rc = mpl.rcParams['mathtext.fallback']
+ if mpl.rcParams['mathtext.fallback_to_cm'] is not None:
+ fallback_rc = ('cm' if mpl.rcParams['mathtext.fallback_to_cm']
+ else None)
+ font_cls = {'stix': StixFonts,
+ 'stixsans': StixSansFonts,
+ 'cm': BakomaFonts
+ }.get(fallback_rc)
+ self.cm_fallback = font_cls(*args, **kwargs) if font_cls else None
+
+ super().__init__(*args, **kwargs)
+ self.fontmap = {}
+ for texfont in "cal rm tt it bf sf".split():
+ prop = mpl.rcParams['mathtext.' + texfont]
+ font = findfont(prop)
+ self.fontmap[texfont] = font
+ prop = FontProperties('cmex10')
+ font = findfont(prop)
+ self.fontmap['ex'] = font
+
+ # include STIX sized alternatives for glyphs if fallback is STIX
+ if isinstance(self.cm_fallback, StixFonts):
+ stixsizedaltfonts = {
+ 0: 'STIXGeneral',
+ 1: 'STIXSizeOneSym',
+ 2: 'STIXSizeTwoSym',
+ 3: 'STIXSizeThreeSym',
+ 4: 'STIXSizeFourSym',
+ 5: 'STIXSizeFiveSym'}
+
+ for size, name in stixsizedaltfonts.items():
+ fullpath = findfont(name)
+ self.fontmap[size] = fullpath
+ self.fontmap[name] = fullpath
+
+ _slanted_symbols = set(r"\int \oint".split())
+
+ def _map_virtual_font(self, fontname, font_class, uniindex):
+ return fontname, uniindex
+
+ def _get_glyph(self, fontname, font_class, sym, fontsize, math=True):
+ try:
+ uniindex = get_unicode_index(sym, math)
+ found_symbol = True
+ except ValueError:
+ uniindex = ord('?')
+ found_symbol = False
+ _log.warning("No TeX to unicode mapping for {!a}.".format(sym))
+
+ fontname, uniindex = self._map_virtual_font(
+ fontname, font_class, uniindex)
+
+ new_fontname = fontname
+
+ # Only characters in the "Letter" class should be italicized in 'it'
+ # mode. Greek capital letters should be Roman.
+ if found_symbol:
+ if fontname == 'it' and uniindex < 0x10000:
+ char = chr(uniindex)
+ if (unicodedata.category(char)[0] != "L"
+ or unicodedata.name(char).startswith("GREEK CAPITAL")):
+ new_fontname = 'rm'
+
+ slanted = (new_fontname == 'it') or sym in self._slanted_symbols
+ found_symbol = False
+ font = self._get_font(new_fontname)
+ if font is not None:
+ glyphindex = font.get_char_index(uniindex)
+ if glyphindex != 0:
+ found_symbol = True
+
+ if not found_symbol:
+ if self.cm_fallback:
+ if (fontname in ('it', 'regular')
+ and isinstance(self.cm_fallback, StixFonts)):
+ fontname = 'rm'
+
+ g = self.cm_fallback._get_glyph(fontname, font_class,
+ sym, fontsize)
+ fname = g[0].family_name
+ if fname in list(BakomaFonts._fontmap.values()):
+ fname = "Computer Modern"
+ _log.info("Substituting symbol %s from %s", sym, fname)
+ return g
+
+ else:
+ if (fontname in ('it', 'regular')
+ and isinstance(self, StixFonts)):
+ return self._get_glyph('rm', font_class, sym, fontsize)
+ _log.warning("Font {!r} does not have a glyph for {!a} "
+ "[U+{:x}], substituting with a dummy "
+ "symbol.".format(new_fontname, sym, uniindex))
+ fontname = 'rm'
+ font = self._get_font(fontname)
+ uniindex = 0xA4 # currency char, for lack of anything better
+ glyphindex = font.get_char_index(uniindex)
+ slanted = False
+
+ symbol_name = font.get_glyph_name(glyphindex)
+ return font, uniindex, symbol_name, fontsize, slanted
+
+ def get_sized_alternatives_for_symbol(self, fontname, sym):
+ if self.cm_fallback:
+ return self.cm_fallback.get_sized_alternatives_for_symbol(
+ fontname, sym)
+ return [(fontname, sym)]
+
+
+class DejaVuFonts(UnicodeFonts):
+ use_cmex = False # Unused; delete once mathtext becomes private.
+
+ def __init__(self, *args, **kwargs):
+ # This must come first so the backend's owner is set correctly
+ if isinstance(self, DejaVuSerifFonts):
+ self.cm_fallback = StixFonts(*args, **kwargs)
+ else:
+ self.cm_fallback = StixSansFonts(*args, **kwargs)
+ self.bakoma = BakomaFonts(*args, **kwargs)
+ TruetypeFonts.__init__(self, *args, **kwargs)
+ self.fontmap = {}
+ # Include Stix sized alternatives for glyphs
+ self._fontmap.update({
+ 1: 'STIXSizeOneSym',
+ 2: 'STIXSizeTwoSym',
+ 3: 'STIXSizeThreeSym',
+ 4: 'STIXSizeFourSym',
+ 5: 'STIXSizeFiveSym',
+ })
+ for key, name in self._fontmap.items():
+ fullpath = findfont(name)
+ self.fontmap[key] = fullpath
+ self.fontmap[name] = fullpath
+
+ def _get_glyph(self, fontname, font_class, sym, fontsize, math=True):
+ # Override prime symbol to use Bakoma.
+ if sym == r'\prime':
+ return self.bakoma._get_glyph(
+ fontname, font_class, sym, fontsize, math)
+ else:
+ # check whether the glyph is available in the display font
+ uniindex = get_unicode_index(sym)
+ font = self._get_font('ex')
+ if font is not None:
+ glyphindex = font.get_char_index(uniindex)
+ if glyphindex != 0:
+ return super()._get_glyph(
+ 'ex', font_class, sym, fontsize, math)
+ # otherwise return regular glyph
+ return super()._get_glyph(
+ fontname, font_class, sym, fontsize, math)
+
+
+class DejaVuSerifFonts(DejaVuFonts):
+ """
+ A font handling class for the DejaVu Serif fonts
+
+ If a glyph is not found it will fallback to Stix Serif
+ """
+ _fontmap = {
+ 'rm': 'DejaVu Serif',
+ 'it': 'DejaVu Serif:italic',
+ 'bf': 'DejaVu Serif:weight=bold',
+ 'sf': 'DejaVu Sans',
+ 'tt': 'DejaVu Sans Mono',
+ 'ex': 'DejaVu Serif Display',
+ 0: 'DejaVu Serif',
+ }
+
+
+class DejaVuSansFonts(DejaVuFonts):
+ """
+ A font handling class for the DejaVu Sans fonts
+
+ If a glyph is not found it will fallback to Stix Sans
+ """
+ _fontmap = {
+ 'rm': 'DejaVu Sans',
+ 'it': 'DejaVu Sans:italic',
+ 'bf': 'DejaVu Sans:weight=bold',
+ 'sf': 'DejaVu Sans',
+ 'tt': 'DejaVu Sans Mono',
+ 'ex': 'DejaVu Sans Display',
+ 0: 'DejaVu Sans',
+ }
+
+
+class StixFonts(UnicodeFonts):
+ """
+ A font handling class for the STIX fonts.
+
+ In addition to what UnicodeFonts provides, this class:
+
+ - supports "virtual fonts" which are complete alpha numeric
+ character sets with different font styles at special Unicode
+ code points, such as "Blackboard".
+
+ - handles sized alternative characters for the STIXSizeX fonts.
+ """
+ _fontmap = {
+ 'rm': 'STIXGeneral',
+ 'it': 'STIXGeneral:italic',
+ 'bf': 'STIXGeneral:weight=bold',
+ 'nonunirm': 'STIXNonUnicode',
+ 'nonuniit': 'STIXNonUnicode:italic',
+ 'nonunibf': 'STIXNonUnicode:weight=bold',
+ 0: 'STIXGeneral',
+ 1: 'STIXSizeOneSym',
+ 2: 'STIXSizeTwoSym',
+ 3: 'STIXSizeThreeSym',
+ 4: 'STIXSizeFourSym',
+ 5: 'STIXSizeFiveSym',
+ }
+ use_cmex = False # Unused; delete once mathtext becomes private.
+ cm_fallback = False
+ _sans = False
+
+ def __init__(self, *args, **kwargs):
+ TruetypeFonts.__init__(self, *args, **kwargs)
+ self.fontmap = {}
+ for key, name in self._fontmap.items():
+ fullpath = findfont(name)
+ self.fontmap[key] = fullpath
+ self.fontmap[name] = fullpath
+
+ def _map_virtual_font(self, fontname, font_class, uniindex):
+ # Handle these "fonts" that are actually embedded in
+ # other fonts.
+ mapping = stix_virtual_fonts.get(fontname)
+ if (self._sans and mapping is None
+ and fontname not in ('regular', 'default')):
+ mapping = stix_virtual_fonts['sf']
+ doing_sans_conversion = True
+ else:
+ doing_sans_conversion = False
+
+ if mapping is not None:
+ if isinstance(mapping, dict):
+ try:
+ mapping = mapping[font_class]
+ except KeyError:
+ mapping = mapping['rm']
+
+ # Binary search for the source glyph
+ lo = 0
+ hi = len(mapping)
+ while lo < hi:
+ mid = (lo+hi)//2
+ range = mapping[mid]
+ if uniindex < range[0]:
+ hi = mid
+ elif uniindex <= range[1]:
+ break
+ else:
+ lo = mid + 1
+
+ if range[0] <= uniindex <= range[1]:
+ uniindex = uniindex - range[0] + range[3]
+ fontname = range[2]
+ elif not doing_sans_conversion:
+ # This will generate a dummy character
+ uniindex = 0x1
+ fontname = mpl.rcParams['mathtext.default']
+
+ # Handle private use area glyphs
+ if fontname in ('it', 'rm', 'bf') and 0xe000 <= uniindex <= 0xf8ff:
+ fontname = 'nonuni' + fontname
+
+ return fontname, uniindex
+
+ @functools.lru_cache()
+ def get_sized_alternatives_for_symbol(self, fontname, sym):
+ fixes = {
+ '\\{': '{', '\\}': '}', '\\[': '[', '\\]': ']',
+ '<': '\N{MATHEMATICAL LEFT ANGLE BRACKET}',
+ '>': '\N{MATHEMATICAL RIGHT ANGLE BRACKET}',
+ }
+ sym = fixes.get(sym, sym)
+ try:
+ uniindex = get_unicode_index(sym)
+ except ValueError:
+ return [(fontname, sym)]
+ alternatives = [(i, chr(uniindex)) for i in range(6)
+ if self._get_font(i).get_char_index(uniindex) != 0]
+ # The largest size of the radical symbol in STIX has incorrect
+ # metrics that cause it to be disconnected from the stem.
+ if sym == r'\__sqrt__':
+ alternatives = alternatives[:-1]
+ return alternatives
+
+
+class StixSansFonts(StixFonts):
+ """
+ A font handling class for the STIX fonts (that uses sans-serif
+ characters by default).
+ """
+ _sans = True
+
+
+class StandardPsFonts(Fonts):
+ """
+ Use the standard postscript fonts for rendering to backend_ps
+
+ Unlike the other font classes, BakomaFont and UnicodeFont, this
+ one requires the Ps backend.
+ """
+ basepath = str(cbook._get_data_path('fonts/afm'))
+
+ fontmap = {
+ 'cal': 'pzcmi8a', # Zapf Chancery
+ 'rm': 'pncr8a', # New Century Schoolbook
+ 'tt': 'pcrr8a', # Courier
+ 'it': 'pncri8a', # New Century Schoolbook Italic
+ 'sf': 'phvr8a', # Helvetica
+ 'bf': 'pncb8a', # New Century Schoolbook Bold
+ None: 'psyr', # Symbol
+ }
+
+ def __init__(self, default_font_prop, mathtext_backend=None):
+ if mathtext_backend is None:
+ # Circular import, can be dropped after public access to
+ # StandardPsFonts is removed and mathtext_backend made a required
+ # parameter.
+ from . import mathtext
+ mathtext_backend = mathtext.MathtextBackendPath()
+ super().__init__(default_font_prop, mathtext_backend)
+ self.glyphd = {}
+ self.fonts = {}
+
+ filename = findfont(default_font_prop, fontext='afm',
+ directory=self.basepath)
+ if filename is None:
+ filename = findfont('Helvetica', fontext='afm',
+ directory=self.basepath)
+ with open(filename, 'rb') as fd:
+ default_font = AFM(fd)
+ default_font.fname = filename
+
+ self.fonts['default'] = default_font
+ self.fonts['regular'] = default_font
+
+ pswriter = _api.deprecated("3.4")(property(lambda self: StringIO()))
+
+ def _get_font(self, font):
+ if font in self.fontmap:
+ basename = self.fontmap[font]
+ else:
+ basename = font
+
+ cached_font = self.fonts.get(basename)
+ if cached_font is None:
+ fname = os.path.join(self.basepath, basename + ".afm")
+ with open(fname, 'rb') as fd:
+ cached_font = AFM(fd)
+ cached_font.fname = fname
+ self.fonts[basename] = cached_font
+ self.fonts[cached_font.get_fontname()] = cached_font
+ return cached_font
+
+ def _get_info(self, fontname, font_class, sym, fontsize, dpi, math=True):
+ """Load the cmfont, metrics and glyph with caching."""
+ key = fontname, sym, fontsize, dpi
+ tup = self.glyphd.get(key)
+
+ if tup is not None:
+ return tup
+
+ # Only characters in the "Letter" class should really be italicized.
+ # This class includes greek letters, so we're ok
+ if (fontname == 'it' and
+ (len(sym) > 1
+ or not unicodedata.category(sym).startswith("L"))):
+ fontname = 'rm'
+
+ found_symbol = False
+
+ if sym in latex_to_standard:
+ fontname, num = latex_to_standard[sym]
+ glyph = chr(num)
+ found_symbol = True
+ elif len(sym) == 1:
+ glyph = sym
+ num = ord(glyph)
+ found_symbol = True
+ else:
+ _log.warning(
+ "No TeX to built-in Postscript mapping for {!r}".format(sym))
+
+ slanted = (fontname == 'it')
+ font = self._get_font(fontname)
+
+ if found_symbol:
+ try:
+ symbol_name = font.get_name_char(glyph)
+ except KeyError:
+ _log.warning(
+ "No glyph in standard Postscript font {!r} for {!r}"
+ .format(font.get_fontname(), sym))
+ found_symbol = False
+
+ if not found_symbol:
+ glyph = '?'
+ num = ord(glyph)
+ symbol_name = font.get_name_char(glyph)
+
+ offset = 0
+
+ scale = 0.001 * fontsize
+
+ xmin, ymin, xmax, ymax = [val * scale
+ for val in font.get_bbox_char(glyph)]
+ metrics = types.SimpleNamespace(
+ advance = font.get_width_char(glyph) * scale,
+ width = font.get_width_char(glyph) * scale,
+ height = font.get_height_char(glyph) * scale,
+ xmin = xmin,
+ xmax = xmax,
+ ymin = ymin+offset,
+ ymax = ymax+offset,
+ # iceberg is the equivalent of TeX's "height"
+ iceberg = ymax + offset,
+ slanted = slanted
+ )
+
+ self.glyphd[key] = types.SimpleNamespace(
+ font = font,
+ fontsize = fontsize,
+ postscript_name = font.get_fontname(),
+ metrics = metrics,
+ symbol_name = symbol_name,
+ num = num,
+ glyph = glyph,
+ offset = offset
+ )
+
+ return self.glyphd[key]
+
+ def get_kern(self, font1, fontclass1, sym1, fontsize1,
+ font2, fontclass2, sym2, fontsize2, dpi):
+ if font1 == font2 and fontsize1 == fontsize2:
+ info1 = self._get_info(font1, fontclass1, sym1, fontsize1, dpi)
+ info2 = self._get_info(font2, fontclass2, sym2, fontsize2, dpi)
+ font = info1.font
+ return (font.get_kern_dist(info1.glyph, info2.glyph)
+ * 0.001 * fontsize1)
+ return super().get_kern(font1, fontclass1, sym1, fontsize1,
+ font2, fontclass2, sym2, fontsize2, dpi)
+
+ def get_xheight(self, font, fontsize, dpi):
+ font = self._get_font(font)
+ return font.get_xheight() * 0.001 * fontsize
+
+ def get_underline_thickness(self, font, fontsize, dpi):
+ font = self._get_font(font)
+ return font.get_underline_thickness() * 0.001 * fontsize
+
+
+##############################################################################
+# TeX-LIKE BOX MODEL
+
+# The following is based directly on the document 'woven' from the
+# TeX82 source code. This information is also available in printed
+# form:
+#
+# Knuth, Donald E.. 1986. Computers and Typesetting, Volume B:
+# TeX: The Program. Addison-Wesley Professional.
+#
+# The most relevant "chapters" are:
+# Data structures for boxes and their friends
+# Shipping pages out (Ship class)
+# Packaging (hpack and vpack)
+# Data structures for math mode
+# Subroutines for math mode
+# Typesetting math formulas
+#
+# Many of the docstrings below refer to a numbered "node" in that
+# book, e.g., node123
+#
+# Note that (as TeX) y increases downward, unlike many other parts of
+# matplotlib.
+
+# How much text shrinks when going to the next-smallest level. GROW_FACTOR
+# must be the inverse of SHRINK_FACTOR.
+SHRINK_FACTOR = 0.7
+GROW_FACTOR = 1 / SHRINK_FACTOR
+# The number of different sizes of chars to use, beyond which they will not
+# get any smaller
+NUM_SIZE_LEVELS = 6
+
+
+class FontConstantsBase:
+ """
+ A set of constants that controls how certain things, such as sub-
+ and superscripts are laid out. These are all metrics that can't
+ be reliably retrieved from the font metrics in the font itself.
+ """
+ # Percentage of x-height of additional horiz. space after sub/superscripts
+ script_space = 0.05
+
+ # Percentage of x-height that sub/superscripts drop below the baseline
+ subdrop = 0.4
+
+ # Percentage of x-height that superscripts are raised from the baseline
+ sup1 = 0.7
+
+ # Percentage of x-height that subscripts drop below the baseline
+ sub1 = 0.3
+
+ # Percentage of x-height that subscripts drop below the baseline when a
+ # superscript is present
+ sub2 = 0.5
+
+ # Percentage of x-height that sub/supercripts are offset relative to the
+ # nucleus edge for non-slanted nuclei
+ delta = 0.025
+
+ # Additional percentage of last character height above 2/3 of the
+ # x-height that supercripts are offset relative to the subscript
+ # for slanted nuclei
+ delta_slanted = 0.2
+
+ # Percentage of x-height that supercripts and subscripts are offset for
+ # integrals
+ delta_integral = 0.1
+
+
+class ComputerModernFontConstants(FontConstantsBase):
+ script_space = 0.075
+ subdrop = 0.2
+ sup1 = 0.45
+ sub1 = 0.2
+ sub2 = 0.3
+ delta = 0.075
+ delta_slanted = 0.3
+ delta_integral = 0.3
+
+
+class STIXFontConstants(FontConstantsBase):
+ script_space = 0.1
+ sup1 = 0.8
+ sub2 = 0.6
+ delta = 0.05
+ delta_slanted = 0.3
+ delta_integral = 0.3
+
+
+class STIXSansFontConstants(FontConstantsBase):
+ script_space = 0.05
+ sup1 = 0.8
+ delta_slanted = 0.6
+ delta_integral = 0.3
+
+
+class DejaVuSerifFontConstants(FontConstantsBase):
+ pass
+
+
+class DejaVuSansFontConstants(FontConstantsBase):
+ pass
+
+
+# Maps font family names to the FontConstantBase subclass to use
+_font_constant_mapping = {
+ 'DejaVu Sans': DejaVuSansFontConstants,
+ 'DejaVu Sans Mono': DejaVuSansFontConstants,
+ 'DejaVu Serif': DejaVuSerifFontConstants,
+ 'cmb10': ComputerModernFontConstants,
+ 'cmex10': ComputerModernFontConstants,
+ 'cmmi10': ComputerModernFontConstants,
+ 'cmr10': ComputerModernFontConstants,
+ 'cmss10': ComputerModernFontConstants,
+ 'cmsy10': ComputerModernFontConstants,
+ 'cmtt10': ComputerModernFontConstants,
+ 'STIXGeneral': STIXFontConstants,
+ 'STIXNonUnicode': STIXFontConstants,
+ 'STIXSizeFiveSym': STIXFontConstants,
+ 'STIXSizeFourSym': STIXFontConstants,
+ 'STIXSizeThreeSym': STIXFontConstants,
+ 'STIXSizeTwoSym': STIXFontConstants,
+ 'STIXSizeOneSym': STIXFontConstants,
+ # Map the fonts we used to ship, just for good measure
+ 'Bitstream Vera Sans': DejaVuSansFontConstants,
+ 'Bitstream Vera': DejaVuSansFontConstants,
+ }
+
+
+def _get_font_constant_set(state):
+ constants = _font_constant_mapping.get(
+ state.font_output._get_font(state.font).family_name,
+ FontConstantsBase)
+ # STIX sans isn't really its own fonts, just different code points
+ # in the STIX fonts, so we have to detect this one separately.
+ if (constants is STIXFontConstants and
+ isinstance(state.font_output, StixSansFonts)):
+ return STIXSansFontConstants
+ return constants
+
+
+class Node:
+ """A node in the TeX box model."""
+
+ def __init__(self):
+ self.size = 0
+
+ def __repr__(self):
+ return self.__class__.__name__
+
+ def get_kerning(self, next):
+ return 0.0
+
+ def shrink(self):
+ """
+ Shrinks one level smaller. There are only three levels of
+ sizes, after which things will no longer get smaller.
+ """
+ self.size += 1
+
+ def grow(self):
+ """
+ Grows one level larger. There is no limit to how big
+ something can get.
+ """
+ self.size -= 1
+
+ def render(self, x, y):
+ pass
+
+
+class Box(Node):
+ """A node with a physical location."""
+
+ def __init__(self, width, height, depth):
+ super().__init__()
+ self.width = width
+ self.height = height
+ self.depth = depth
+
+ def shrink(self):
+ super().shrink()
+ if self.size < NUM_SIZE_LEVELS:
+ self.width *= SHRINK_FACTOR
+ self.height *= SHRINK_FACTOR
+ self.depth *= SHRINK_FACTOR
+
+ def grow(self):
+ super().grow()
+ self.width *= GROW_FACTOR
+ self.height *= GROW_FACTOR
+ self.depth *= GROW_FACTOR
+
+ def render(self, x1, y1, x2, y2):
+ pass
+
+
+class Vbox(Box):
+ """A box with only height (zero width)."""
+
+ def __init__(self, height, depth):
+ super().__init__(0., height, depth)
+
+
+class Hbox(Box):
+ """A box with only width (zero height and depth)."""
+
+ def __init__(self, width):
+ super().__init__(width, 0., 0.)
+
+
+class Char(Node):
+ """
+ A single character.
+
+ Unlike TeX, the font information and metrics are stored with each `Char`
+ to make it easier to lookup the font metrics when needed. Note that TeX
+ boxes have a width, height, and depth, unlike Type1 and TrueType which use
+ a full bounding box and an advance in the x-direction. The metrics must
+ be converted to the TeX model, and the advance (if different from width)
+ must be converted into a `Kern` node when the `Char` is added to its parent
+ `Hlist`.
+ """
+
+ def __init__(self, c, state, math=True):
+ super().__init__()
+ self.c = c
+ self.font_output = state.font_output
+ self.font = state.font
+ self.font_class = state.font_class
+ self.fontsize = state.fontsize
+ self.dpi = state.dpi
+ self.math = math
+ # The real width, height and depth will be set during the
+ # pack phase, after we know the real fontsize
+ self._update_metrics()
+
+ def __repr__(self):
+ return '`%s`' % self.c
+
+ def _update_metrics(self):
+ metrics = self._metrics = self.font_output.get_metrics(
+ self.font, self.font_class, self.c, self.fontsize, self.dpi,
+ self.math)
+ if self.c == ' ':
+ self.width = metrics.advance
+ else:
+ self.width = metrics.width
+ self.height = metrics.iceberg
+ self.depth = -(metrics.iceberg - metrics.height)
+
+ def is_slanted(self):
+ return self._metrics.slanted
+
+ def get_kerning(self, next):
+ """
+ Return the amount of kerning between this and the given character.
+
+ This method is called when characters are strung together into `Hlist`
+ to create `Kern` nodes.
+ """
+ advance = self._metrics.advance - self.width
+ kern = 0.
+ if isinstance(next, Char):
+ kern = self.font_output.get_kern(
+ self.font, self.font_class, self.c, self.fontsize,
+ next.font, next.font_class, next.c, next.fontsize,
+ self.dpi)
+ return advance + kern
+
+ def render(self, x, y):
+ """
+ Render the character to the canvas
+ """
+ self.font_output.render_glyph(
+ x, y,
+ self.font, self.font_class, self.c, self.fontsize, self.dpi)
+
+ def shrink(self):
+ super().shrink()
+ if self.size < NUM_SIZE_LEVELS:
+ self.fontsize *= SHRINK_FACTOR
+ self.width *= SHRINK_FACTOR
+ self.height *= SHRINK_FACTOR
+ self.depth *= SHRINK_FACTOR
+
+ def grow(self):
+ super().grow()
+ self.fontsize *= GROW_FACTOR
+ self.width *= GROW_FACTOR
+ self.height *= GROW_FACTOR
+ self.depth *= GROW_FACTOR
+
+
+class Accent(Char):
+ """
+ The font metrics need to be dealt with differently for accents,
+ since they are already offset correctly from the baseline in
+ TrueType fonts.
+ """
+ def _update_metrics(self):
+ metrics = self._metrics = self.font_output.get_metrics(
+ self.font, self.font_class, self.c, self.fontsize, self.dpi)
+ self.width = metrics.xmax - metrics.xmin
+ self.height = metrics.ymax - metrics.ymin
+ self.depth = 0
+
+ def shrink(self):
+ super().shrink()
+ self._update_metrics()
+
+ def grow(self):
+ super().grow()
+ self._update_metrics()
+
+ def render(self, x, y):
+ """
+ Render the character to the canvas.
+ """
+ self.font_output.render_glyph(
+ x - self._metrics.xmin, y + self._metrics.ymin,
+ self.font, self.font_class, self.c, self.fontsize, self.dpi)
+
+
+class List(Box):
+ """A list of nodes (either horizontal or vertical)."""
+
+ def __init__(self, elements):
+ super().__init__(0., 0., 0.)
+ self.shift_amount = 0. # An arbitrary offset
+ self.children = elements # The child nodes of this list
+ # The following parameters are set in the vpack and hpack functions
+ self.glue_set = 0. # The glue setting of this list
+ self.glue_sign = 0 # 0: normal, -1: shrinking, 1: stretching
+ self.glue_order = 0 # The order of infinity (0 - 3) for the glue
+
+ def __repr__(self):
+ return '[%s <%.02f %.02f %.02f %.02f> %s]' % (
+ super().__repr__(),
+ self.width, self.height,
+ self.depth, self.shift_amount,
+ ' '.join([repr(x) for x in self.children]))
+
+ @staticmethod
+ def _determine_order(totals):
+ """
+ Determine the highest order of glue used by the members of this list.
+
+ Helper function used by vpack and hpack.
+ """
+ for i in range(len(totals))[::-1]:
+ if totals[i] != 0:
+ return i
+ return 0
+
+ def _set_glue(self, x, sign, totals, error_type):
+ o = self._determine_order(totals)
+ self.glue_order = o
+ self.glue_sign = sign
+ if totals[o] != 0.:
+ self.glue_set = x / totals[o]
+ else:
+ self.glue_sign = 0
+ self.glue_ratio = 0.
+ if o == 0:
+ if len(self.children):
+ _log.warning("%s %s: %r",
+ error_type, self.__class__.__name__, self)
+
+ def shrink(self):
+ for child in self.children:
+ child.shrink()
+ super().shrink()
+ if self.size < NUM_SIZE_LEVELS:
+ self.shift_amount *= SHRINK_FACTOR
+ self.glue_set *= SHRINK_FACTOR
+
+ def grow(self):
+ for child in self.children:
+ child.grow()
+ super().grow()
+ self.shift_amount *= GROW_FACTOR
+ self.glue_set *= GROW_FACTOR
+
+
+class Hlist(List):
+ """A horizontal list of boxes."""
+
+ def __init__(self, elements, w=0., m='additional', do_kern=True):
+ super().__init__(elements)
+ if do_kern:
+ self.kern()
+ self.hpack()
+
+ def kern(self):
+ """
+ Insert `Kern` nodes between `Char` nodes to set kerning.
+
+ The `Char` nodes themselves determine the amount of kerning they need
+ (in `~Char.get_kerning`), and this function just creates the correct
+ linked list.
+ """
+ new_children = []
+ num_children = len(self.children)
+ if num_children:
+ for i in range(num_children):
+ elem = self.children[i]
+ if i < num_children - 1:
+ next = self.children[i + 1]
+ else:
+ next = None
+
+ new_children.append(elem)
+ kerning_distance = elem.get_kerning(next)
+ if kerning_distance != 0.:
+ kern = Kern(kerning_distance)
+ new_children.append(kern)
+ self.children = new_children
+
+ # This is a failed experiment to fake cross-font kerning.
+# def get_kerning(self, next):
+# if len(self.children) >= 2 and isinstance(self.children[-2], Char):
+# if isinstance(next, Char):
+# print "CASE A"
+# return self.children[-2].get_kerning(next)
+# elif (isinstance(next, Hlist) and len(next.children)
+# and isinstance(next.children[0], Char)):
+# print "CASE B"
+# result = self.children[-2].get_kerning(next.children[0])
+# print result
+# return result
+# return 0.0
+
+ def hpack(self, w=0., m='additional'):
+ r"""
+ Compute the dimensions of the resulting boxes, and adjust the glue if
+ one of those dimensions is pre-specified. The computed sizes normally
+ enclose all of the material inside the new box; but some items may
+ stick out if negative glue is used, if the box is overfull, or if a
+ ``\vbox`` includes other boxes that have been shifted left.
+
+ Parameters
+ ----------
+ w : float, default: 0
+ A width.
+ m : {'exactly', 'additional'}, default: 'additional'
+ Whether to produce a box whose width is 'exactly' *w*; or a box
+ with the natural width of the contents, plus *w* ('additional').
+
+ Notes
+ -----
+ The defaults produce a box with the natural width of the contents.
+ """
+ # I don't know why these get reset in TeX. Shift_amount is pretty
+ # much useless if we do.
+ # self.shift_amount = 0.
+ h = 0.
+ d = 0.
+ x = 0.
+ total_stretch = [0.] * 4
+ total_shrink = [0.] * 4
+ for p in self.children:
+ if isinstance(p, Char):
+ x += p.width
+ h = max(h, p.height)
+ d = max(d, p.depth)
+ elif isinstance(p, Box):
+ x += p.width
+ if not np.isinf(p.height) and not np.isinf(p.depth):
+ s = getattr(p, 'shift_amount', 0.)
+ h = max(h, p.height - s)
+ d = max(d, p.depth + s)
+ elif isinstance(p, Glue):
+ glue_spec = p.glue_spec
+ x += glue_spec.width
+ total_stretch[glue_spec.stretch_order] += glue_spec.stretch
+ total_shrink[glue_spec.shrink_order] += glue_spec.shrink
+ elif isinstance(p, Kern):
+ x += p.width
+ self.height = h
+ self.depth = d
+
+ if m == 'additional':
+ w += x
+ self.width = w
+ x = w - x
+
+ if x == 0.:
+ self.glue_sign = 0
+ self.glue_order = 0
+ self.glue_ratio = 0.
+ return
+ if x > 0.:
+ self._set_glue(x, 1, total_stretch, "Overfull")
+ else:
+ self._set_glue(x, -1, total_shrink, "Underfull")
+
+
+class Vlist(List):
+ """A vertical list of boxes."""
+
+ def __init__(self, elements, h=0., m='additional'):
+ super().__init__(elements)
+ self.vpack()
+
+ def vpack(self, h=0., m='additional', l=np.inf):
+ """
+ Compute the dimensions of the resulting boxes, and to adjust the glue
+ if one of those dimensions is pre-specified.
+
+ Parameters
+ ----------
+ h : float, default: 0
+ A height.
+ m : {'exactly', 'additional'}, default: 'additional'
+ Whether to produce a box whose height is 'exactly' *w*; or a box
+ with the natural height of the contents, plus *w* ('additional').
+ l : float, default: np.inf
+ The maximum height.
+
+ Notes
+ -----
+ The defaults produce a box with the natural height of the contents.
+ """
+ # I don't know why these get reset in TeX. Shift_amount is pretty
+ # much useless if we do.
+ # self.shift_amount = 0.
+ w = 0.
+ d = 0.
+ x = 0.
+ total_stretch = [0.] * 4
+ total_shrink = [0.] * 4
+ for p in self.children:
+ if isinstance(p, Box):
+ x += d + p.height
+ d = p.depth
+ if not np.isinf(p.width):
+ s = getattr(p, 'shift_amount', 0.)
+ w = max(w, p.width + s)
+ elif isinstance(p, Glue):
+ x += d
+ d = 0.
+ glue_spec = p.glue_spec
+ x += glue_spec.width
+ total_stretch[glue_spec.stretch_order] += glue_spec.stretch
+ total_shrink[glue_spec.shrink_order] += glue_spec.shrink
+ elif isinstance(p, Kern):
+ x += d + p.width
+ d = 0.
+ elif isinstance(p, Char):
+ raise RuntimeError(
+ "Internal mathtext error: Char node found in Vlist")
+
+ self.width = w
+ if d > l:
+ x += d - l
+ self.depth = l
+ else:
+ self.depth = d
+
+ if m == 'additional':
+ h += x
+ self.height = h
+ x = h - x
+
+ if x == 0:
+ self.glue_sign = 0
+ self.glue_order = 0
+ self.glue_ratio = 0.
+ return
+
+ if x > 0.:
+ self._set_glue(x, 1, total_stretch, "Overfull")
+ else:
+ self._set_glue(x, -1, total_shrink, "Underfull")
+
+
+class Rule(Box):
+ """
+ A solid black rectangle.
+
+ It has *width*, *depth*, and *height* fields just as in an `Hlist`.
+ However, if any of these dimensions is inf, the actual value will be
+ determined by running the rule up to the boundary of the innermost
+ enclosing box. This is called a "running dimension". The width is never
+ running in an `Hlist`; the height and depth are never running in a `Vlist`.
+ """
+
+ def __init__(self, width, height, depth, state):
+ super().__init__(width, height, depth)
+ self.font_output = state.font_output
+
+ def render(self, x, y, w, h):
+ self.font_output.render_rect_filled(x, y, x + w, y + h)
+
+
+class Hrule(Rule):
+ """Convenience class to create a horizontal rule."""
+
+ def __init__(self, state, thickness=None):
+ if thickness is None:
+ thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+ height = depth = thickness * 0.5
+ super().__init__(np.inf, height, depth, state)
+
+
+class Vrule(Rule):
+ """Convenience class to create a vertical rule."""
+
+ def __init__(self, state):
+ thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+ super().__init__(thickness, np.inf, np.inf, state)
+
+
+_GlueSpec = namedtuple(
+ "_GlueSpec", "width stretch stretch_order shrink shrink_order")
+_GlueSpec._named = {
+ 'fil': _GlueSpec(0., 1., 1, 0., 0),
+ 'fill': _GlueSpec(0., 1., 2, 0., 0),
+ 'filll': _GlueSpec(0., 1., 3, 0., 0),
+ 'neg_fil': _GlueSpec(0., 0., 0, 1., 1),
+ 'neg_fill': _GlueSpec(0., 0., 0, 1., 2),
+ 'neg_filll': _GlueSpec(0., 0., 0, 1., 3),
+ 'empty': _GlueSpec(0., 0., 0, 0., 0),
+ 'ss': _GlueSpec(0., 1., 1, -1., 1),
+}
+
+
+class Glue(Node):
+ """
+ Most of the information in this object is stored in the underlying
+ ``_GlueSpec`` class, which is shared between multiple glue objects.
+ (This is a memory optimization which probably doesn't matter anymore, but
+ it's easier to stick to what TeX does.)
+ """
+
+ glue_subtype = _api.deprecated("3.3")(property(lambda self: "normal"))
+
+ @_api.delete_parameter("3.3", "copy")
+ def __init__(self, glue_type, copy=False):
+ super().__init__()
+ if isinstance(glue_type, str):
+ glue_spec = _GlueSpec._named[glue_type]
+ elif isinstance(glue_type, _GlueSpec):
+ glue_spec = glue_type
+ else:
+ raise ValueError("glue_type must be a glue spec name or instance")
+ self.glue_spec = glue_spec
+
+ def shrink(self):
+ super().shrink()
+ if self.size < NUM_SIZE_LEVELS:
+ g = self.glue_spec
+ self.glue_spec = g._replace(width=g.width * SHRINK_FACTOR)
+
+ def grow(self):
+ super().grow()
+ g = self.glue_spec
+ self.glue_spec = g._replace(width=g.width * GROW_FACTOR)
+
+
+# Some convenient ways to get common kinds of glue
+
+
+@_api.deprecated("3.3", alternative="Glue('fil')")
+class Fil(Glue):
+ def __init__(self):
+ super().__init__('fil')
+
+
+@_api.deprecated("3.3", alternative="Glue('fill')")
+class Fill(Glue):
+ def __init__(self):
+ super().__init__('fill')
+
+
+@_api.deprecated("3.3", alternative="Glue('filll')")
+class Filll(Glue):
+ def __init__(self):
+ super().__init__('filll')
+
+
+@_api.deprecated("3.3", alternative="Glue('neg_fil')")
+class NegFil(Glue):
+ def __init__(self):
+ super().__init__('neg_fil')
+
+
+@_api.deprecated("3.3", alternative="Glue('neg_fill')")
+class NegFill(Glue):
+ def __init__(self):
+ super().__init__('neg_fill')
+
+
+@_api.deprecated("3.3", alternative="Glue('neg_filll')")
+class NegFilll(Glue):
+ def __init__(self):
+ super().__init__('neg_filll')
+
+
+@_api.deprecated("3.3", alternative="Glue('ss')")
+class SsGlue(Glue):
+ def __init__(self):
+ super().__init__('ss')
+
+
+class HCentered(Hlist):
+ """
+ A convenience class to create an `Hlist` whose contents are
+ centered within its enclosing box.
+ """
+
+ def __init__(self, elements):
+ super().__init__([Glue('ss'), *elements, Glue('ss')], do_kern=False)
+
+
+class VCentered(Vlist):
+ """
+ A convenience class to create a `Vlist` whose contents are
+ centered within its enclosing box.
+ """
+
+ def __init__(self, elements):
+ super().__init__([Glue('ss'), *elements, Glue('ss')])
+
+
+class Kern(Node):
+ """
+ A `Kern` node has a width field to specify a (normally
+ negative) amount of spacing. This spacing correction appears in
+ horizontal lists between letters like A and V when the font
+ designer said that it looks better to move them closer together or
+ further apart. A kern node can also appear in a vertical list,
+ when its *width* denotes additional spacing in the vertical
+ direction.
+ """
+
+ height = 0
+ depth = 0
+
+ def __init__(self, width):
+ super().__init__()
+ self.width = width
+
+ def __repr__(self):
+ return "k%.02f" % self.width
+
+ def shrink(self):
+ super().shrink()
+ if self.size < NUM_SIZE_LEVELS:
+ self.width *= SHRINK_FACTOR
+
+ def grow(self):
+ super().grow()
+ self.width *= GROW_FACTOR
+
+
+class SubSuperCluster(Hlist):
+ """
+ A hack to get around that fact that this code does a two-pass parse like
+ TeX. This lets us store enough information in the hlist itself, namely the
+ nucleus, sub- and super-script, such that if another script follows that
+ needs to be attached, it can be reconfigured on the fly.
+ """
+
+ def __init__(self):
+ self.nucleus = None
+ self.sub = None
+ self.super = None
+ super().__init__([])
+
+
+class AutoHeightChar(Hlist):
+ """
+ A character as close to the given height and depth as possible.
+
+ When using a font with multiple height versions of some characters (such as
+ the BaKoMa fonts), the correct glyph will be selected, otherwise this will
+ always just return a scaled version of the glyph.
+ """
+
+ def __init__(self, c, height, depth, state, always=False, factor=None):
+ alternatives = state.font_output.get_sized_alternatives_for_symbol(
+ state.font, c)
+
+ xHeight = state.font_output.get_xheight(
+ state.font, state.fontsize, state.dpi)
+
+ state = state.copy()
+ target_total = height + depth
+ for fontname, sym in alternatives:
+ state.font = fontname
+ char = Char(sym, state)
+ # Ensure that size 0 is chosen when the text is regular sized but
+ # with descender glyphs by subtracting 0.2 * xHeight
+ if char.height + char.depth >= target_total - 0.2 * xHeight:
+ break
+
+ shift = 0
+ if state.font != 0:
+ if factor is None:
+ factor = target_total / (char.height + char.depth)
+ state.fontsize *= factor
+ char = Char(sym, state)
+
+ shift = (depth - char.depth)
+
+ super().__init__([char])
+ self.shift_amount = shift
+
+
+class AutoWidthChar(Hlist):
+ """
+ A character as close to the given width as possible.
+
+ When using a font with multiple width versions of some characters (such as
+ the BaKoMa fonts), the correct glyph will be selected, otherwise this will
+ always just return a scaled version of the glyph.
+ """
+
+ def __init__(self, c, width, state, always=False, char_class=Char):
+ alternatives = state.font_output.get_sized_alternatives_for_symbol(
+ state.font, c)
+
+ state = state.copy()
+ for fontname, sym in alternatives:
+ state.font = fontname
+ char = char_class(sym, state)
+ if char.width >= width:
+ break
+
+ factor = width / char.width
+ state.fontsize *= factor
+ char = char_class(sym, state)
+
+ super().__init__([char])
+ self.width = char.width
+
+
+class Ship:
+ """
+ Ship boxes to output once they have been set up, this sends them to output.
+
+ Since boxes can be inside of boxes inside of boxes, the main work of `Ship`
+ is done by two mutually recursive routines, `hlist_out` and `vlist_out`,
+ which traverse the `Hlist` nodes and `Vlist` nodes inside of horizontal
+ and vertical boxes. The global variables used in TeX to store state as it
+ processes have become member variables here.
+ """
+
+ def __call__(self, ox, oy, box):
+ self.max_push = 0 # Deepest nesting of push commands so far
+ self.cur_s = 0
+ self.cur_v = 0.
+ self.cur_h = 0.
+ self.off_h = ox
+ self.off_v = oy + box.height
+ self.hlist_out(box)
+
+ @staticmethod
+ def clamp(value):
+ if value < -1000000000.:
+ return -1000000000.
+ if value > 1000000000.:
+ return 1000000000.
+ return value
+
+ def hlist_out(self, box):
+ cur_g = 0
+ cur_glue = 0.
+ glue_order = box.glue_order
+ glue_sign = box.glue_sign
+ base_line = self.cur_v
+ left_edge = self.cur_h
+ self.cur_s += 1
+ self.max_push = max(self.cur_s, self.max_push)
+ clamp = self.clamp
+
+ for p in box.children:
+ if isinstance(p, Char):
+ p.render(self.cur_h + self.off_h, self.cur_v + self.off_v)
+ self.cur_h += p.width
+ elif isinstance(p, Kern):
+ self.cur_h += p.width
+ elif isinstance(p, List):
+ # node623
+ if len(p.children) == 0:
+ self.cur_h += p.width
+ else:
+ edge = self.cur_h
+ self.cur_v = base_line + p.shift_amount
+ if isinstance(p, Hlist):
+ self.hlist_out(p)
+ else:
+ # p.vpack(box.height + box.depth, 'exactly')
+ self.vlist_out(p)
+ self.cur_h = edge + p.width
+ self.cur_v = base_line
+ elif isinstance(p, Box):
+ # node624
+ rule_height = p.height
+ rule_depth = p.depth
+ rule_width = p.width
+ if np.isinf(rule_height):
+ rule_height = box.height
+ if np.isinf(rule_depth):
+ rule_depth = box.depth
+ if rule_height > 0 and rule_width > 0:
+ self.cur_v = base_line + rule_depth
+ p.render(self.cur_h + self.off_h,
+ self.cur_v + self.off_v,
+ rule_width, rule_height)
+ self.cur_v = base_line
+ self.cur_h += rule_width
+ elif isinstance(p, Glue):
+ # node625
+ glue_spec = p.glue_spec
+ rule_width = glue_spec.width - cur_g
+ if glue_sign != 0: # normal
+ if glue_sign == 1: # stretching
+ if glue_spec.stretch_order == glue_order:
+ cur_glue += glue_spec.stretch
+ cur_g = round(clamp(box.glue_set * cur_glue))
+ elif glue_spec.shrink_order == glue_order:
+ cur_glue += glue_spec.shrink
+ cur_g = round(clamp(box.glue_set * cur_glue))
+ rule_width += cur_g
+ self.cur_h += rule_width
+ self.cur_s -= 1
+
+ def vlist_out(self, box):
+ cur_g = 0
+ cur_glue = 0.
+ glue_order = box.glue_order
+ glue_sign = box.glue_sign
+ self.cur_s += 1
+ self.max_push = max(self.max_push, self.cur_s)
+ left_edge = self.cur_h
+ self.cur_v -= box.height
+ top_edge = self.cur_v
+ clamp = self.clamp
+
+ for p in box.children:
+ if isinstance(p, Kern):
+ self.cur_v += p.width
+ elif isinstance(p, List):
+ if len(p.children) == 0:
+ self.cur_v += p.height + p.depth
+ else:
+ self.cur_v += p.height
+ self.cur_h = left_edge + p.shift_amount
+ save_v = self.cur_v
+ p.width = box.width
+ if isinstance(p, Hlist):
+ self.hlist_out(p)
+ else:
+ self.vlist_out(p)
+ self.cur_v = save_v + p.depth
+ self.cur_h = left_edge
+ elif isinstance(p, Box):
+ rule_height = p.height
+ rule_depth = p.depth
+ rule_width = p.width
+ if np.isinf(rule_width):
+ rule_width = box.width
+ rule_height += rule_depth
+ if rule_height > 0 and rule_depth > 0:
+ self.cur_v += rule_height
+ p.render(self.cur_h + self.off_h,
+ self.cur_v + self.off_v,
+ rule_width, rule_height)
+ elif isinstance(p, Glue):
+ glue_spec = p.glue_spec
+ rule_height = glue_spec.width - cur_g
+ if glue_sign != 0: # normal
+ if glue_sign == 1: # stretching
+ if glue_spec.stretch_order == glue_order:
+ cur_glue += glue_spec.stretch
+ cur_g = round(clamp(box.glue_set * cur_glue))
+ elif glue_spec.shrink_order == glue_order: # shrinking
+ cur_glue += glue_spec.shrink
+ cur_g = round(clamp(box.glue_set * cur_glue))
+ rule_height += cur_g
+ self.cur_v += rule_height
+ elif isinstance(p, Char):
+ raise RuntimeError(
+ "Internal mathtext error: Char node found in vlist")
+ self.cur_s -= 1
+
+
+ship = Ship()
+
+
+##############################################################################
+# PARSER
+
+
+def Error(msg):
+ """Helper class to raise parser errors."""
+ def raise_error(s, loc, toks):
+ raise ParseFatalException(s, loc, msg)
+
+ empty = Empty()
+ empty.setParseAction(raise_error)
+ return empty
+
+
+class Parser:
+ """
+ A pyparsing-based parser for strings containing math expressions.
+
+ Raw text may also appear outside of pairs of ``$``.
+
+ The grammar is based directly on that in TeX, though it cuts a few corners.
+ """
+
+ class _MathStyle(enum.Enum):
+ DISPLAYSTYLE = enum.auto()
+ TEXTSTYLE = enum.auto()
+ SCRIPTSTYLE = enum.auto()
+ SCRIPTSCRIPTSTYLE = enum.auto()
+
+ _binary_operators = set('''
+ + * -
+ \\pm \\sqcap \\rhd
+ \\mp \\sqcup \\unlhd
+ \\times \\vee \\unrhd
+ \\div \\wedge \\oplus
+ \\ast \\setminus \\ominus
+ \\star \\wr \\otimes
+ \\circ \\diamond \\oslash
+ \\bullet \\bigtriangleup \\odot
+ \\cdot \\bigtriangledown \\bigcirc
+ \\cap \\triangleleft \\dagger
+ \\cup \\triangleright \\ddagger
+ \\uplus \\lhd \\amalg'''.split())
+
+ _relation_symbols = set('''
+ = < > :
+ \\leq \\geq \\equiv \\models
+ \\prec \\succ \\sim \\perp
+ \\preceq \\succeq \\simeq \\mid
+ \\ll \\gg \\asymp \\parallel
+ \\subset \\supset \\approx \\bowtie
+ \\subseteq \\supseteq \\cong \\Join
+ \\sqsubset \\sqsupset \\neq \\smile
+ \\sqsubseteq \\sqsupseteq \\doteq \\frown
+ \\in \\ni \\propto \\vdash
+ \\dashv \\dots \\dotplus \\doteqdot'''.split())
+
+ _arrow_symbols = set('''
+ \\leftarrow \\longleftarrow \\uparrow
+ \\Leftarrow \\Longleftarrow \\Uparrow
+ \\rightarrow \\longrightarrow \\downarrow
+ \\Rightarrow \\Longrightarrow \\Downarrow
+ \\leftrightarrow \\longleftrightarrow \\updownarrow
+ \\Leftrightarrow \\Longleftrightarrow \\Updownarrow
+ \\mapsto \\longmapsto \\nearrow
+ \\hookleftarrow \\hookrightarrow \\searrow
+ \\leftharpoonup \\rightharpoonup \\swarrow
+ \\leftharpoondown \\rightharpoondown \\nwarrow
+ \\rightleftharpoons \\leadsto'''.split())
+
+ _spaced_symbols = _binary_operators | _relation_symbols | _arrow_symbols
+
+ _punctuation_symbols = set(r', ; . ! \ldotp \cdotp'.split())
+
+ _overunder_symbols = set(r'''
+ \sum \prod \coprod \bigcap \bigcup \bigsqcup \bigvee
+ \bigwedge \bigodot \bigotimes \bigoplus \biguplus
+ '''.split())
+
+ _overunder_functions = set(
+ "lim liminf limsup sup max min".split())
+
+ _dropsub_symbols = set(r'''\int \oint'''.split())
+
+ _fontnames = set("rm cal it tt sf bf default bb frak scr regular".split())
+
+ _function_names = set("""
+ arccos csc ker min arcsin deg lg Pr arctan det lim sec arg dim
+ liminf sin cos exp limsup sinh cosh gcd ln sup cot hom log tan
+ coth inf max tanh""".split())
+
+ _ambi_delim = set("""
+ | \\| / \\backslash \\uparrow \\downarrow \\updownarrow \\Uparrow
+ \\Downarrow \\Updownarrow . \\vert \\Vert \\\\|""".split())
+
+ _left_delim = set(r"( [ \{ < \lfloor \langle \lceil".split())
+
+ _right_delim = set(r") ] \} > \rfloor \rangle \rceil".split())
+
+ def __init__(self):
+ p = types.SimpleNamespace()
+ # All forward declarations are here
+ p.accent = Forward()
+ p.ambi_delim = Forward()
+ p.apostrophe = Forward()
+ p.auto_delim = Forward()
+ p.binom = Forward()
+ p.bslash = Forward()
+ p.c_over_c = Forward()
+ p.customspace = Forward()
+ p.end_group = Forward()
+ p.float_literal = Forward()
+ p.font = Forward()
+ p.frac = Forward()
+ p.dfrac = Forward()
+ p.function = Forward()
+ p.genfrac = Forward()
+ p.group = Forward()
+ p.int_literal = Forward()
+ p.latexfont = Forward()
+ p.lbracket = Forward()
+ p.left_delim = Forward()
+ p.lbrace = Forward()
+ p.main = Forward()
+ p.math = Forward()
+ p.math_string = Forward()
+ p.non_math = Forward()
+ p.operatorname = Forward()
+ p.overline = Forward()
+ p.overset = Forward()
+ p.placeable = Forward()
+ p.rbrace = Forward()
+ p.rbracket = Forward()
+ p.required_group = Forward()
+ p.right_delim = Forward()
+ p.right_delim_safe = Forward()
+ p.simple = Forward()
+ p.simple_group = Forward()
+ p.single_symbol = Forward()
+ p.accentprefixed = Forward()
+ p.space = Forward()
+ p.sqrt = Forward()
+ p.start_group = Forward()
+ p.subsuper = Forward()
+ p.subsuperop = Forward()
+ p.symbol = Forward()
+ p.symbol_name = Forward()
+ p.token = Forward()
+ p.underset = Forward()
+ p.unknown_symbol = Forward()
+
+ # Set names on everything -- very useful for debugging
+ for key, val in vars(p).items():
+ if not key.startswith('_'):
+ val.setName(key)
+
+ p.float_literal <<= Regex(r"[-+]?([0-9]+\.?[0-9]*|\.[0-9]+)")
+ p.int_literal <<= Regex("[-+]?[0-9]+")
+
+ p.lbrace <<= Literal('{').suppress()
+ p.rbrace <<= Literal('}').suppress()
+ p.lbracket <<= Literal('[').suppress()
+ p.rbracket <<= Literal(']').suppress()
+ p.bslash <<= Literal('\\')
+
+ p.space <<= oneOf(list(self._space_widths))
+ p.customspace <<= (
+ Suppress(Literal(r'\hspace'))
+ - ((p.lbrace + p.float_literal + p.rbrace)
+ | Error(r"Expected \hspace{n}"))
+ )
+
+ unicode_range = "\U00000080-\U0001ffff"
+ p.single_symbol <<= Regex(
+ r"([a-zA-Z0-9 +\-*/<>=:,.;!\?&'@()\[\]|%s])|(\\[%%${}\[\]_|])" %
+ unicode_range)
+ p.accentprefixed <<= Suppress(p.bslash) + oneOf(self._accentprefixed)
+ p.symbol_name <<= (
+ Combine(p.bslash + oneOf(list(tex2uni)))
+ + FollowedBy(Regex("[^A-Za-z]").leaveWhitespace() | StringEnd())
+ )
+ p.symbol <<= (p.single_symbol | p.symbol_name).leaveWhitespace()
+
+ p.apostrophe <<= Regex("'+")
+
+ p.c_over_c <<= (
+ Suppress(p.bslash)
+ + oneOf(list(self._char_over_chars))
+ )
+
+ p.accent <<= Group(
+ Suppress(p.bslash)
+ + oneOf([*self._accent_map, *self._wide_accents])
+ - p.placeable
+ )
+
+ p.function <<= (
+ Suppress(p.bslash)
+ + oneOf(list(self._function_names))
+ )
+
+ p.start_group <<= Optional(p.latexfont) + p.lbrace
+ p.end_group <<= p.rbrace.copy()
+ p.simple_group <<= Group(p.lbrace + ZeroOrMore(p.token) + p.rbrace)
+ p.required_group <<= Group(p.lbrace + OneOrMore(p.token) + p.rbrace)
+ p.group <<= Group(
+ p.start_group + ZeroOrMore(p.token) + p.end_group
+ )
+
+ p.font <<= Suppress(p.bslash) + oneOf(list(self._fontnames))
+ p.latexfont <<= (
+ Suppress(p.bslash)
+ + oneOf(['math' + x for x in self._fontnames])
+ )
+
+ p.frac <<= Group(
+ Suppress(Literal(r"\frac"))
+ - ((p.required_group + p.required_group)
+ | Error(r"Expected \frac{num}{den}"))
+ )
+
+ p.dfrac <<= Group(
+ Suppress(Literal(r"\dfrac"))
+ - ((p.required_group + p.required_group)
+ | Error(r"Expected \dfrac{num}{den}"))
+ )
+
+ p.binom <<= Group(
+ Suppress(Literal(r"\binom"))
+ - ((p.required_group + p.required_group)
+ | Error(r"Expected \binom{num}{den}"))
+ )
+
+ p.ambi_delim <<= oneOf(list(self._ambi_delim))
+ p.left_delim <<= oneOf(list(self._left_delim))
+ p.right_delim <<= oneOf(list(self._right_delim))
+ p.right_delim_safe <<= oneOf([*(self._right_delim - {'}'}), r'\}'])
+
+ p.genfrac <<= Group(
+ Suppress(Literal(r"\genfrac"))
+ - (((p.lbrace
+ + Optional(p.ambi_delim | p.left_delim, default='')
+ + p.rbrace)
+ + (p.lbrace
+ + Optional(p.ambi_delim | p.right_delim_safe, default='')
+ + p.rbrace)
+ + (p.lbrace + p.float_literal + p.rbrace)
+ + p.simple_group + p.required_group + p.required_group)
+ | Error("Expected "
+ r"\genfrac{ldelim}{rdelim}{rulesize}{style}{num}{den}"))
+ )
+
+ p.sqrt <<= Group(
+ Suppress(Literal(r"\sqrt"))
+ - ((Group(Optional(
+ p.lbracket + OneOrMore(~p.rbracket + p.token) + p.rbracket))
+ + p.required_group)
+ | Error("Expected \\sqrt{value}"))
+ )
+
+ p.overline <<= Group(
+ Suppress(Literal(r"\overline"))
+ - (p.required_group | Error("Expected \\overline{value}"))
+ )
+
+ p.overset <<= Group(
+ Suppress(Literal(r"\overset"))
+ - ((p.simple_group + p.simple_group)
+ | Error("Expected \\overset{body}{annotation}"))
+ )
+
+ p.underset <<= Group(
+ Suppress(Literal(r"\underset"))
+ - ((p.simple_group + p.simple_group)
+ | Error("Expected \\underset{body}{annotation}"))
+ )
+
+ p.unknown_symbol <<= Combine(p.bslash + Regex("[A-Za-z]*"))
+
+ p.operatorname <<= Group(
+ Suppress(Literal(r"\operatorname"))
+ - ((p.lbrace + ZeroOrMore(p.simple | p.unknown_symbol) + p.rbrace)
+ | Error("Expected \\operatorname{value}"))
+ )
+
+ p.placeable <<= (
+ p.accentprefixed # Must be before accent so named symbols that are
+ # prefixed with an accent name work
+ | p.accent # Must be before symbol as all accents are symbols
+ | p.symbol # Must be third to catch all named symbols and single
+ # chars not in a group
+ | p.c_over_c
+ | p.function
+ | p.group
+ | p.frac
+ | p.dfrac
+ | p.binom
+ | p.genfrac
+ | p.overset
+ | p.underset
+ | p.sqrt
+ | p.overline
+ | p.operatorname
+ )
+
+ p.simple <<= (
+ p.space
+ | p.customspace
+ | p.font
+ | p.subsuper
+ )
+
+ p.subsuperop <<= oneOf(["_", "^"])
+
+ p.subsuper <<= Group(
+ (Optional(p.placeable)
+ + OneOrMore(p.subsuperop - p.placeable)
+ + Optional(p.apostrophe))
+ | (p.placeable + Optional(p.apostrophe))
+ | p.apostrophe
+ )
+
+ p.token <<= (
+ p.simple
+ | p.auto_delim
+ | p.unknown_symbol # Must be last
+ )
+
+ p.auto_delim <<= (
+ Suppress(Literal(r"\left"))
+ - ((p.left_delim | p.ambi_delim)
+ | Error("Expected a delimiter"))
+ + Group(ZeroOrMore(p.simple | p.auto_delim))
+ + Suppress(Literal(r"\right"))
+ - ((p.right_delim | p.ambi_delim)
+ | Error("Expected a delimiter"))
+ )
+
+ p.math <<= OneOrMore(p.token)
+
+ p.math_string <<= QuotedString('$', '\\', unquoteResults=False)
+
+ p.non_math <<= Regex(r"(?:(?:\\[$])|[^$])*").leaveWhitespace()
+
+ p.main <<= (
+ p.non_math + ZeroOrMore(p.math_string + p.non_math) + StringEnd()
+ )
+
+ # Set actions
+ for key, val in vars(p).items():
+ if not key.startswith('_'):
+ if hasattr(self, key):
+ val.setParseAction(getattr(self, key))
+
+ self._expression = p.main
+ self._math_expression = p.math
+
+ def parse(self, s, fonts_object, fontsize, dpi):
+ """
+ Parse expression *s* using the given *fonts_object* for
+ output, at the given *fontsize* and *dpi*.
+
+ Returns the parse tree of `Node` instances.
+ """
+ self._state_stack = [
+ self.State(fonts_object, 'default', 'rm', fontsize, dpi)]
+ self._em_width_cache = {}
+ try:
+ result = self._expression.parseString(s)
+ except ParseBaseException as err:
+ raise ValueError("\n".join(["",
+ err.line,
+ " " * (err.column - 1) + "^",
+ str(err)])) from err
+ self._state_stack = None
+ self._em_width_cache = {}
+ self._expression.resetCache()
+ return result[0]
+
+ # The state of the parser is maintained in a stack. Upon
+ # entering and leaving a group { } or math/non-math, the stack
+ # is pushed and popped accordingly. The current state always
+ # exists in the top element of the stack.
+ class State:
+ """
+ Stores the state of the parser.
+
+ States are pushed and popped from a stack as necessary, and
+ the "current" state is always at the top of the stack.
+ """
+ def __init__(self, font_output, font, font_class, fontsize, dpi):
+ self.font_output = font_output
+ self._font = font
+ self.font_class = font_class
+ self.fontsize = fontsize
+ self.dpi = dpi
+
+ def copy(self):
+ return Parser.State(
+ self.font_output,
+ self.font,
+ self.font_class,
+ self.fontsize,
+ self.dpi)
+
+ @property
+ def font(self):
+ return self._font
+
+ @font.setter
+ def font(self, name):
+ if name in ('rm', 'it', 'bf'):
+ self.font_class = name
+ self._font = name
+
+ def get_state(self):
+ """Get the current `State` of the parser."""
+ return self._state_stack[-1]
+
+ def pop_state(self):
+ """Pop a `State` off of the stack."""
+ self._state_stack.pop()
+
+ def push_state(self):
+ """Push a new `State` onto the stack, copying the current state."""
+ self._state_stack.append(self.get_state().copy())
+
+ def main(self, s, loc, toks):
+ return [Hlist(toks)]
+
+ def math_string(self, s, loc, toks):
+ return self._math_expression.parseString(toks[0][1:-1])
+
+ def math(self, s, loc, toks):
+ hlist = Hlist(toks)
+ self.pop_state()
+ return [hlist]
+
+ def non_math(self, s, loc, toks):
+ s = toks[0].replace(r'\$', '$')
+ symbols = [Char(c, self.get_state(), math=False) for c in s]
+ hlist = Hlist(symbols)
+ # We're going into math now, so set font to 'it'
+ self.push_state()
+ self.get_state().font = mpl.rcParams['mathtext.default']
+ return [hlist]
+
+ def _make_space(self, percentage):
+ # All spaces are relative to em width
+ state = self.get_state()
+ key = (state.font, state.fontsize, state.dpi)
+ width = self._em_width_cache.get(key)
+ if width is None:
+ metrics = state.font_output.get_metrics(
+ state.font, mpl.rcParams['mathtext.default'], 'm',
+ state.fontsize, state.dpi)
+ width = metrics.advance
+ self._em_width_cache[key] = width
+ return Kern(width * percentage)
+
+ _space_widths = {
+ r'\,': 0.16667, # 3/18 em = 3 mu
+ r'\thinspace': 0.16667, # 3/18 em = 3 mu
+ r'\/': 0.16667, # 3/18 em = 3 mu
+ r'\>': 0.22222, # 4/18 em = 4 mu
+ r'\:': 0.22222, # 4/18 em = 4 mu
+ r'\;': 0.27778, # 5/18 em = 5 mu
+ r'\ ': 0.33333, # 6/18 em = 6 mu
+ r'~': 0.33333, # 6/18 em = 6 mu, nonbreakable
+ r'\enspace': 0.5, # 9/18 em = 9 mu
+ r'\quad': 1, # 1 em = 18 mu
+ r'\qquad': 2, # 2 em = 36 mu
+ r'\!': -0.16667, # -3/18 em = -3 mu
+ }
+
+ def space(self, s, loc, toks):
+ tok, = toks
+ num = self._space_widths[tok]
+ box = self._make_space(num)
+ return [box]
+
+ def customspace(self, s, loc, toks):
+ return [self._make_space(float(toks[0]))]
+
+ def symbol(self, s, loc, toks):
+ c, = toks
+ try:
+ char = Char(c, self.get_state())
+ except ValueError as err:
+ raise ParseFatalException(s, loc,
+ "Unknown symbol: %s" % c) from err
+
+ if c in self._spaced_symbols:
+ # iterate until we find previous character, needed for cases
+ # such as ${ -2}$, $ -2$, or $ -2$.
+ prev_char = next((c for c in s[:loc][::-1] if c != ' '), '')
+ # Binary operators at start of string should not be spaced
+ if (c in self._binary_operators and
+ (len(s[:loc].split()) == 0 or prev_char == '{' or
+ prev_char in self._left_delim)):
+ return [char]
+ else:
+ return [Hlist([self._make_space(0.2),
+ char,
+ self._make_space(0.2)],
+ do_kern=True)]
+ elif c in self._punctuation_symbols:
+
+ # Do not space commas between brackets
+ if c == ',':
+ prev_char = next((c for c in s[:loc][::-1] if c != ' '), '')
+ next_char = next((c for c in s[loc + 1:] if c != ' '), '')
+ if prev_char == '{' and next_char == '}':
+ return [char]
+
+ # Do not space dots as decimal separators
+ if c == '.' and s[loc - 1].isdigit() and s[loc + 1].isdigit():
+ return [char]
+ else:
+ return [Hlist([char, self._make_space(0.2)], do_kern=True)]
+ return [char]
+
+ accentprefixed = symbol
+
+ def unknown_symbol(self, s, loc, toks):
+ c, = toks
+ raise ParseFatalException(s, loc, "Unknown symbol: %s" % c)
+
+ _char_over_chars = {
+ # The first 2 entries in the tuple are (font, char, sizescale) for
+ # the two symbols under and over. The third element is the space
+ # (in multiples of underline height)
+ r'AA': (('it', 'A', 1.0), (None, '\\circ', 0.5), 0.0),
+ }
+
+ def c_over_c(self, s, loc, toks):
+ sym, = toks
+ state = self.get_state()
+ thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+
+ under_desc, over_desc, space = \
+ self._char_over_chars.get(sym, (None, None, 0.0))
+ if under_desc is None:
+ raise ParseFatalException("Error parsing symbol")
+
+ over_state = state.copy()
+ if over_desc[0] is not None:
+ over_state.font = over_desc[0]
+ over_state.fontsize *= over_desc[2]
+ over = Accent(over_desc[1], over_state)
+
+ under_state = state.copy()
+ if under_desc[0] is not None:
+ under_state.font = under_desc[0]
+ under_state.fontsize *= under_desc[2]
+ under = Char(under_desc[1], under_state)
+
+ width = max(over.width, under.width)
+
+ over_centered = HCentered([over])
+ over_centered.hpack(width, 'exactly')
+
+ under_centered = HCentered([under])
+ under_centered.hpack(width, 'exactly')
+
+ return Vlist([
+ over_centered,
+ Vbox(0., thickness * space),
+ under_centered
+ ])
+
+ _accent_map = {
+ r'hat': r'\circumflexaccent',
+ r'breve': r'\combiningbreve',
+ r'bar': r'\combiningoverline',
+ r'grave': r'\combininggraveaccent',
+ r'acute': r'\combiningacuteaccent',
+ r'tilde': r'\combiningtilde',
+ r'dot': r'\combiningdotabove',
+ r'ddot': r'\combiningdiaeresis',
+ r'vec': r'\combiningrightarrowabove',
+ r'"': r'\combiningdiaeresis',
+ r"`": r'\combininggraveaccent',
+ r"'": r'\combiningacuteaccent',
+ r'~': r'\combiningtilde',
+ r'.': r'\combiningdotabove',
+ r'^': r'\circumflexaccent',
+ r'overrightarrow': r'\rightarrow',
+ r'overleftarrow': r'\leftarrow',
+ r'mathring': r'\circ',
+ }
+
+ _wide_accents = set(r"widehat widetilde widebar".split())
+
+ # make a lambda and call it to get the namespace right
+ _accentprefixed = (lambda am: [
+ p for p in tex2uni
+ if any(p.startswith(a) and a != p for a in am)
+ ])(set(_accent_map))
+
+ def accent(self, s, loc, toks):
+ state = self.get_state()
+ thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+ (accent, sym), = toks
+ if accent in self._wide_accents:
+ accent_box = AutoWidthChar(
+ '\\' + accent, sym.width, state, char_class=Accent)
+ else:
+ accent_box = Accent(self._accent_map[accent], state)
+ if accent == 'mathring':
+ accent_box.shrink()
+ accent_box.shrink()
+ centered = HCentered([Hbox(sym.width / 4.0), accent_box])
+ centered.hpack(sym.width, 'exactly')
+ return Vlist([
+ centered,
+ Vbox(0., thickness * 2.0),
+ Hlist([sym])
+ ])
+
+ def function(self, s, loc, toks):
+ hlist = self.operatorname(s, loc, toks)
+ hlist.function_name, = toks
+ return hlist
+
+ def operatorname(self, s, loc, toks):
+ self.push_state()
+ state = self.get_state()
+ state.font = 'rm'
+ hlist_list = []
+ # Change the font of Chars, but leave Kerns alone
+ for c in toks[0]:
+ if isinstance(c, Char):
+ c.font = 'rm'
+ c._update_metrics()
+ hlist_list.append(c)
+ elif isinstance(c, str):
+ hlist_list.append(Char(c, state))
+ else:
+ hlist_list.append(c)
+ next_char_loc = loc + len(toks[0]) + 1
+ if isinstance(toks[0], ParseResults):
+ next_char_loc += len('operatorname{}')
+ next_char = next((c for c in s[next_char_loc:] if c != ' '), '')
+ delimiters = self._left_delim | self._ambi_delim | self._right_delim
+ delimiters |= {'^', '_'}
+ if (next_char not in delimiters and
+ toks[0] not in self._overunder_functions):
+ # Add thin space except when followed by parenthesis, bracket, etc.
+ hlist_list += [self._make_space(self._space_widths[r'\,'])]
+ self.pop_state()
+ return Hlist(hlist_list)
+
+ def start_group(self, s, loc, toks):
+ self.push_state()
+ # Deal with LaTeX-style font tokens
+ if len(toks):
+ self.get_state().font = toks[0][4:]
+ return []
+
+ def group(self, s, loc, toks):
+ grp = Hlist(toks[0])
+ return [grp]
+ required_group = simple_group = group
+
+ def end_group(self, s, loc, toks):
+ self.pop_state()
+ return []
+
+ def font(self, s, loc, toks):
+ name, = toks
+ self.get_state().font = name
+ return []
+
+ def is_overunder(self, nucleus):
+ if isinstance(nucleus, Char):
+ return nucleus.c in self._overunder_symbols
+ elif isinstance(nucleus, Hlist) and hasattr(nucleus, 'function_name'):
+ return nucleus.function_name in self._overunder_functions
+ return False
+
+ def is_dropsub(self, nucleus):
+ if isinstance(nucleus, Char):
+ return nucleus.c in self._dropsub_symbols
+ return False
+
+ def is_slanted(self, nucleus):
+ if isinstance(nucleus, Char):
+ return nucleus.is_slanted()
+ return False
+
+ def is_between_brackets(self, s, loc):
+ return False
+
+ def subsuper(self, s, loc, toks):
+ assert len(toks) == 1
+
+ nucleus = None
+ sub = None
+ super = None
+
+ # Pick all of the apostrophes out, including first apostrophes that
+ # have been parsed as characters
+ napostrophes = 0
+ new_toks = []
+ for tok in toks[0]:
+ if isinstance(tok, str) and tok not in ('^', '_'):
+ napostrophes += len(tok)
+ elif isinstance(tok, Char) and tok.c == "'":
+ napostrophes += 1
+ else:
+ new_toks.append(tok)
+ toks = new_toks
+
+ if len(toks) == 0:
+ assert napostrophes
+ nucleus = Hbox(0.0)
+ elif len(toks) == 1:
+ if not napostrophes:
+ return toks[0] # .asList()
+ else:
+ nucleus = toks[0]
+ elif len(toks) in (2, 3):
+ # single subscript or superscript
+ nucleus = toks[0] if len(toks) == 3 else Hbox(0.0)
+ op, next = toks[-2:]
+ if op == '_':
+ sub = next
+ else:
+ super = next
+ elif len(toks) in (4, 5):
+ # subscript and superscript
+ nucleus = toks[0] if len(toks) == 5 else Hbox(0.0)
+ op1, next1, op2, next2 = toks[-4:]
+ if op1 == op2:
+ if op1 == '_':
+ raise ParseFatalException("Double subscript")
+ else:
+ raise ParseFatalException("Double superscript")
+ if op1 == '_':
+ sub = next1
+ super = next2
+ else:
+ super = next1
+ sub = next2
+ else:
+ raise ParseFatalException(
+ "Subscript/superscript sequence is too long. "
+ "Use braces { } to remove ambiguity.")
+
+ state = self.get_state()
+ rule_thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+ xHeight = state.font_output.get_xheight(
+ state.font, state.fontsize, state.dpi)
+
+ if napostrophes:
+ if super is None:
+ super = Hlist([])
+ for i in range(napostrophes):
+ super.children.extend(self.symbol(s, loc, ['\\prime']))
+ # kern() and hpack() needed to get the metrics right after
+ # extending
+ super.kern()
+ super.hpack()
+
+ # Handle over/under symbols, such as sum or prod
+ if self.is_overunder(nucleus):
+ vlist = []
+ shift = 0.
+ width = nucleus.width
+ if super is not None:
+ super.shrink()
+ width = max(width, super.width)
+ if sub is not None:
+ sub.shrink()
+ width = max(width, sub.width)
+
+ vgap = rule_thickness * 3.0
+ if super is not None:
+ hlist = HCentered([super])
+ hlist.hpack(width, 'exactly')
+ vlist.extend([hlist, Vbox(0, vgap)])
+ hlist = HCentered([nucleus])
+ hlist.hpack(width, 'exactly')
+ vlist.append(hlist)
+ if sub is not None:
+ hlist = HCentered([sub])
+ hlist.hpack(width, 'exactly')
+ vlist.extend([Vbox(0, vgap), hlist])
+ shift = hlist.height + vgap
+ vlist = Vlist(vlist)
+ vlist.shift_amount = shift + nucleus.depth
+ result = Hlist([vlist])
+ return [result]
+
+ # We remove kerning on the last character for consistency (otherwise
+ # it will compute kerning based on non-shrunk characters and may put
+ # them too close together when superscripted)
+ # We change the width of the last character to match the advance to
+ # consider some fonts with weird metrics: e.g. stix's f has a width of
+ # 7.75 and a kerning of -4.0 for an advance of 3.72, and we want to put
+ # the superscript at the advance
+ last_char = nucleus
+ if isinstance(nucleus, Hlist):
+ new_children = nucleus.children
+ if len(new_children):
+ # remove last kern
+ if (isinstance(new_children[-1], Kern) and
+ hasattr(new_children[-2], '_metrics')):
+ new_children = new_children[:-1]
+ last_char = new_children[-1]
+ if hasattr(last_char, '_metrics'):
+ last_char.width = last_char._metrics.advance
+ # create new Hlist without kerning
+ nucleus = Hlist(new_children, do_kern=False)
+ else:
+ if isinstance(nucleus, Char):
+ last_char.width = last_char._metrics.advance
+ nucleus = Hlist([nucleus])
+
+ # Handle regular sub/superscripts
+ constants = _get_font_constant_set(state)
+ lc_height = last_char.height
+ lc_baseline = 0
+ if self.is_dropsub(last_char):
+ lc_baseline = last_char.depth
+
+ # Compute kerning for sub and super
+ superkern = constants.delta * xHeight
+ subkern = constants.delta * xHeight
+ if self.is_slanted(last_char):
+ superkern += constants.delta * xHeight
+ superkern += (constants.delta_slanted *
+ (lc_height - xHeight * 2. / 3.))
+ if self.is_dropsub(last_char):
+ subkern = (3 * constants.delta -
+ constants.delta_integral) * lc_height
+ superkern = (3 * constants.delta +
+ constants.delta_integral) * lc_height
+ else:
+ subkern = 0
+
+ if super is None:
+ # node757
+ x = Hlist([Kern(subkern), sub])
+ x.shrink()
+ if self.is_dropsub(last_char):
+ shift_down = lc_baseline + constants.subdrop * xHeight
+ else:
+ shift_down = constants.sub1 * xHeight
+ x.shift_amount = shift_down
+ else:
+ x = Hlist([Kern(superkern), super])
+ x.shrink()
+ if self.is_dropsub(last_char):
+ shift_up = lc_height - constants.subdrop * xHeight
+ else:
+ shift_up = constants.sup1 * xHeight
+ if sub is None:
+ x.shift_amount = -shift_up
+ else: # Both sub and superscript
+ y = Hlist([Kern(subkern), sub])
+ y.shrink()
+ if self.is_dropsub(last_char):
+ shift_down = lc_baseline + constants.subdrop * xHeight
+ else:
+ shift_down = constants.sub2 * xHeight
+ # If sub and superscript collide, move super up
+ clr = (2.0 * rule_thickness -
+ ((shift_up - x.depth) - (y.height - shift_down)))
+ if clr > 0.:
+ shift_up += clr
+ x = Vlist([
+ x,
+ Kern((shift_up - x.depth) - (y.height - shift_down)),
+ y])
+ x.shift_amount = shift_down
+
+ if not self.is_dropsub(last_char):
+ x.width += constants.script_space * xHeight
+ result = Hlist([nucleus, x])
+
+ return [result]
+
+ def _genfrac(self, ldelim, rdelim, rule, style, num, den):
+ state = self.get_state()
+ thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+
+ rule = float(rule)
+
+ if style is not self._MathStyle.DISPLAYSTYLE:
+ num.shrink()
+ den.shrink()
+ cnum = HCentered([num])
+ cden = HCentered([den])
+ width = max(num.width, den.width)
+ cnum.hpack(width, 'exactly')
+ cden.hpack(width, 'exactly')
+ vlist = Vlist([cnum, # numerator
+ Vbox(0, thickness * 2.0), # space
+ Hrule(state, rule), # rule
+ Vbox(0, thickness * 2.0), # space
+ cden # denominator
+ ])
+
+ # Shift so the fraction line sits in the middle of the
+ # equals sign
+ metrics = state.font_output.get_metrics(
+ state.font, mpl.rcParams['mathtext.default'],
+ '=', state.fontsize, state.dpi)
+ shift = (cden.height -
+ ((metrics.ymax + metrics.ymin) / 2 -
+ thickness * 3.0))
+ vlist.shift_amount = shift
+
+ result = [Hlist([vlist, Hbox(thickness * 2.)])]
+ if ldelim or rdelim:
+ if ldelim == '':
+ ldelim = '.'
+ if rdelim == '':
+ rdelim = '.'
+ return self._auto_sized_delimiter(ldelim, result, rdelim)
+ return result
+
+ def genfrac(self, s, loc, toks):
+ args, = toks
+ return self._genfrac(*args)
+
+ def frac(self, s, loc, toks):
+ state = self.get_state()
+ thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+ (num, den), = toks
+ return self._genfrac('', '', thickness, self._MathStyle.TEXTSTYLE,
+ num, den)
+
+ def dfrac(self, s, loc, toks):
+ state = self.get_state()
+ thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+ (num, den), = toks
+ return self._genfrac('', '', thickness, self._MathStyle.DISPLAYSTYLE,
+ num, den)
+
+ def binom(self, s, loc, toks):
+ (num, den), = toks
+ return self._genfrac('(', ')', 0.0, self._MathStyle.TEXTSTYLE,
+ num, den)
+
+ def _genset(self, state, annotation, body, overunder):
+ thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+
+ annotation.shrink()
+
+ cannotation = HCentered([annotation])
+ cbody = HCentered([body])
+ width = max(cannotation.width, cbody.width)
+ cannotation.hpack(width, 'exactly')
+ cbody.hpack(width, 'exactly')
+
+ vgap = thickness * 3
+ if overunder == "under":
+ vlist = Vlist([cbody, # body
+ Vbox(0, vgap), # space
+ cannotation # annotation
+ ])
+ # Shift so the body sits in the same vertical position
+ shift_amount = cbody.depth + cannotation.height + vgap
+
+ vlist.shift_amount = shift_amount
+ else:
+ vlist = Vlist([cannotation, # annotation
+ Vbox(0, vgap), # space
+ cbody # body
+ ])
+
+ # To add horizontal gap between symbols: wrap the Vlist into
+ # an Hlist and extend it with an Hbox(0, horizontal_gap)
+ return vlist
+
+ def sqrt(self, s, loc, toks):
+ (root, body), = toks
+ state = self.get_state()
+ thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+
+ # Determine the height of the body, and add a little extra to
+ # the height so it doesn't seem cramped
+ height = body.height - body.shift_amount + thickness * 5.0
+ depth = body.depth + body.shift_amount
+ check = AutoHeightChar(r'\__sqrt__', height, depth, state, always=True)
+ height = check.height - check.shift_amount
+ depth = check.depth + check.shift_amount
+
+ # Put a little extra space to the left and right of the body
+ padded_body = Hlist([Hbox(2 * thickness), body, Hbox(2 * thickness)])
+ rightside = Vlist([Hrule(state), Glue('fill'), padded_body])
+ # Stretch the glue between the hrule and the body
+ rightside.vpack(height + (state.fontsize * state.dpi) / (100.0 * 12.0),
+ 'exactly', depth)
+
+ # Add the root and shift it upward so it is above the tick.
+ # The value of 0.6 is a hard-coded hack ;)
+ if not root:
+ root = Box(check.width * 0.5, 0., 0.)
+ else:
+ root = Hlist(root)
+ root.shrink()
+ root.shrink()
+
+ root_vlist = Vlist([Hlist([root])])
+ root_vlist.shift_amount = -height * 0.6
+
+ hlist = Hlist([root_vlist, # Root
+ # Negative kerning to put root over tick
+ Kern(-check.width * 0.5),
+ check, # Check
+ rightside]) # Body
+ return [hlist]
+
+ def overline(self, s, loc, toks):
+ (body,), = toks
+
+ state = self.get_state()
+ thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+
+ height = body.height - body.shift_amount + thickness * 3.0
+ depth = body.depth + body.shift_amount
+
+ # Place overline above body
+ rightside = Vlist([Hrule(state), Glue('fill'), Hlist([body])])
+
+ # Stretch the glue between the hrule and the body
+ rightside.vpack(height + (state.fontsize * state.dpi) / (100.0 * 12.0),
+ 'exactly', depth)
+
+ hlist = Hlist([rightside])
+ return [hlist]
+
+ def overset(self, s, loc, toks):
+ assert len(toks) == 1
+ assert len(toks[0]) == 2
+
+ state = self.get_state()
+ annotation, body = toks[0]
+
+ return self._genset(state, annotation, body, overunder="over")
+
+ def underset(self, s, loc, toks):
+ assert len(toks) == 1
+ assert len(toks[0]) == 2
+
+ state = self.get_state()
+ annotation, body = toks[0]
+
+ return self._genset(state, annotation, body, overunder="under")
+
+ def _auto_sized_delimiter(self, front, middle, back):
+ state = self.get_state()
+ if len(middle):
+ height = max(x.height for x in middle)
+ depth = max(x.depth for x in middle)
+ factor = None
+ else:
+ height = 0
+ depth = 0
+ factor = 1.0
+ parts = []
+ # \left. and \right. aren't supposed to produce any symbols
+ if front != '.':
+ parts.append(
+ AutoHeightChar(front, height, depth, state, factor=factor))
+ parts.extend(middle)
+ if back != '.':
+ parts.append(
+ AutoHeightChar(back, height, depth, state, factor=factor))
+ hlist = Hlist(parts)
+ return hlist
+
+ def auto_delim(self, s, loc, toks):
+ front, middle, back = toks
+
+ return self._auto_sized_delimiter(front, middle.asList(), back)
diff --git a/venv/Lib/site-packages/matplotlib/_mathtext_data.py b/venv/Lib/site-packages/matplotlib/_mathtext_data.py
new file mode 100644
index 0000000..e17f1e0
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_mathtext_data.py
@@ -0,0 +1,1384 @@
+"""
+font data tables for truetype and afm computer modern fonts
+"""
+
+latex_to_bakoma = {
+ '\\__sqrt__' : ('cmex10', 0x70),
+ '\\bigcap' : ('cmex10', 0x5c),
+ '\\bigcup' : ('cmex10', 0x5b),
+ '\\bigodot' : ('cmex10', 0x4b),
+ '\\bigoplus' : ('cmex10', 0x4d),
+ '\\bigotimes' : ('cmex10', 0x4f),
+ '\\biguplus' : ('cmex10', 0x5d),
+ '\\bigvee' : ('cmex10', 0x5f),
+ '\\bigwedge' : ('cmex10', 0x5e),
+ '\\coprod' : ('cmex10', 0x61),
+ '\\int' : ('cmex10', 0x5a),
+ '\\langle' : ('cmex10', 0xad),
+ '\\leftangle' : ('cmex10', 0xad),
+ '\\leftbrace' : ('cmex10', 0xa9),
+ '\\oint' : ('cmex10', 0x49),
+ '\\prod' : ('cmex10', 0x59),
+ '\\rangle' : ('cmex10', 0xae),
+ '\\rightangle' : ('cmex10', 0xae),
+ '\\rightbrace' : ('cmex10', 0xaa),
+ '\\sum' : ('cmex10', 0x58),
+ '\\widehat' : ('cmex10', 0x62),
+ '\\widetilde' : ('cmex10', 0x65),
+ '\\{' : ('cmex10', 0xa9),
+ '\\}' : ('cmex10', 0xaa),
+ '{' : ('cmex10', 0xa9),
+ '}' : ('cmex10', 0xaa),
+
+ ',' : ('cmmi10', 0x3b),
+ '.' : ('cmmi10', 0x3a),
+ '/' : ('cmmi10', 0x3d),
+ '<' : ('cmmi10', 0x3c),
+ '>' : ('cmmi10', 0x3e),
+ '\\alpha' : ('cmmi10', 0xae),
+ '\\beta' : ('cmmi10', 0xaf),
+ '\\chi' : ('cmmi10', 0xc2),
+ '\\combiningrightarrowabove' : ('cmmi10', 0x7e),
+ '\\delta' : ('cmmi10', 0xb1),
+ '\\ell' : ('cmmi10', 0x60),
+ '\\epsilon' : ('cmmi10', 0xb2),
+ '\\eta' : ('cmmi10', 0xb4),
+ '\\flat' : ('cmmi10', 0x5b),
+ '\\frown' : ('cmmi10', 0x5f),
+ '\\gamma' : ('cmmi10', 0xb0),
+ '\\imath' : ('cmmi10', 0x7b),
+ '\\iota' : ('cmmi10', 0xb6),
+ '\\jmath' : ('cmmi10', 0x7c),
+ '\\kappa' : ('cmmi10', 0x2219),
+ '\\lambda' : ('cmmi10', 0xb8),
+ '\\leftharpoondown' : ('cmmi10', 0x29),
+ '\\leftharpoonup' : ('cmmi10', 0x28),
+ '\\mu' : ('cmmi10', 0xb9),
+ '\\natural' : ('cmmi10', 0x5c),
+ '\\nu' : ('cmmi10', 0xba),
+ '\\omega' : ('cmmi10', 0x21),
+ '\\phi' : ('cmmi10', 0xc1),
+ '\\pi' : ('cmmi10', 0xbc),
+ '\\psi' : ('cmmi10', 0xc3),
+ '\\rho' : ('cmmi10', 0xbd),
+ '\\rightharpoondown' : ('cmmi10', 0x2b),
+ '\\rightharpoonup' : ('cmmi10', 0x2a),
+ '\\sharp' : ('cmmi10', 0x5d),
+ '\\sigma' : ('cmmi10', 0xbe),
+ '\\smile' : ('cmmi10', 0x5e),
+ '\\tau' : ('cmmi10', 0xbf),
+ '\\theta' : ('cmmi10', 0xb5),
+ '\\triangleleft' : ('cmmi10', 0x2f),
+ '\\triangleright' : ('cmmi10', 0x2e),
+ '\\upsilon' : ('cmmi10', 0xc0),
+ '\\varepsilon' : ('cmmi10', 0x22),
+ '\\varphi' : ('cmmi10', 0x27),
+ '\\varrho' : ('cmmi10', 0x25),
+ '\\varsigma' : ('cmmi10', 0x26),
+ '\\vartheta' : ('cmmi10', 0x23),
+ '\\wp' : ('cmmi10', 0x7d),
+ '\\xi' : ('cmmi10', 0xbb),
+ '\\zeta' : ('cmmi10', 0xb3),
+
+ '!' : ('cmr10', 0x21),
+ '%' : ('cmr10', 0x25),
+ '&' : ('cmr10', 0x26),
+ '(' : ('cmr10', 0x28),
+ ')' : ('cmr10', 0x29),
+ '+' : ('cmr10', 0x2b),
+ '0' : ('cmr10', 0x30),
+ '1' : ('cmr10', 0x31),
+ '2' : ('cmr10', 0x32),
+ '3' : ('cmr10', 0x33),
+ '4' : ('cmr10', 0x34),
+ '5' : ('cmr10', 0x35),
+ '6' : ('cmr10', 0x36),
+ '7' : ('cmr10', 0x37),
+ '8' : ('cmr10', 0x38),
+ '9' : ('cmr10', 0x39),
+ ':' : ('cmr10', 0x3a),
+ ';' : ('cmr10', 0x3b),
+ '=' : ('cmr10', 0x3d),
+ '?' : ('cmr10', 0x3f),
+ '@' : ('cmr10', 0x40),
+ '[' : ('cmr10', 0x5b),
+ '\\#' : ('cmr10', 0x23),
+ '\\$' : ('cmr10', 0x24),
+ '\\%' : ('cmr10', 0x25),
+ '\\Delta' : ('cmr10', 0xa2),
+ '\\Gamma' : ('cmr10', 0xa1),
+ '\\Lambda' : ('cmr10', 0xa4),
+ '\\Omega' : ('cmr10', 0xad),
+ '\\Phi' : ('cmr10', 0xa9),
+ '\\Pi' : ('cmr10', 0xa6),
+ '\\Psi' : ('cmr10', 0xaa),
+ '\\Sigma' : ('cmr10', 0xa7),
+ '\\Theta' : ('cmr10', 0xa3),
+ '\\Upsilon' : ('cmr10', 0xa8),
+ '\\Xi' : ('cmr10', 0xa5),
+ '\\circumflexaccent' : ('cmr10', 0x5e),
+ '\\combiningacuteaccent' : ('cmr10', 0xb6),
+ '\\combiningbreve' : ('cmr10', 0xb8),
+ '\\combiningdiaeresis' : ('cmr10', 0xc4),
+ '\\combiningdotabove' : ('cmr10', 0x5f),
+ '\\combininggraveaccent' : ('cmr10', 0xb5),
+ '\\combiningoverline' : ('cmr10', 0xb9),
+ '\\combiningtilde' : ('cmr10', 0x7e),
+ '\\leftbracket' : ('cmr10', 0x5b),
+ '\\leftparen' : ('cmr10', 0x28),
+ '\\rightbracket' : ('cmr10', 0x5d),
+ '\\rightparen' : ('cmr10', 0x29),
+ '\\widebar' : ('cmr10', 0xb9),
+ ']' : ('cmr10', 0x5d),
+
+ '*' : ('cmsy10', 0xa4),
+ '-' : ('cmsy10', 0xa1),
+ '\\Downarrow' : ('cmsy10', 0x2b),
+ '\\Im' : ('cmsy10', 0x3d),
+ '\\Leftarrow' : ('cmsy10', 0x28),
+ '\\Leftrightarrow' : ('cmsy10', 0x2c),
+ '\\P' : ('cmsy10', 0x7b),
+ '\\Re' : ('cmsy10', 0x3c),
+ '\\Rightarrow' : ('cmsy10', 0x29),
+ '\\S' : ('cmsy10', 0x78),
+ '\\Uparrow' : ('cmsy10', 0x2a),
+ '\\Updownarrow' : ('cmsy10', 0x6d),
+ '\\Vert' : ('cmsy10', 0x6b),
+ '\\aleph' : ('cmsy10', 0x40),
+ '\\approx' : ('cmsy10', 0xbc),
+ '\\ast' : ('cmsy10', 0xa4),
+ '\\asymp' : ('cmsy10', 0xb3),
+ '\\backslash' : ('cmsy10', 0x6e),
+ '\\bigcirc' : ('cmsy10', 0xb0),
+ '\\bigtriangledown' : ('cmsy10', 0x35),
+ '\\bigtriangleup' : ('cmsy10', 0x34),
+ '\\bot' : ('cmsy10', 0x3f),
+ '\\bullet' : ('cmsy10', 0xb2),
+ '\\cap' : ('cmsy10', 0x5c),
+ '\\cdot' : ('cmsy10', 0xa2),
+ '\\circ' : ('cmsy10', 0xb1),
+ '\\clubsuit' : ('cmsy10', 0x7c),
+ '\\cup' : ('cmsy10', 0x5b),
+ '\\dag' : ('cmsy10', 0x79),
+ '\\dashv' : ('cmsy10', 0x61),
+ '\\ddag' : ('cmsy10', 0x7a),
+ '\\diamond' : ('cmsy10', 0xa6),
+ '\\diamondsuit' : ('cmsy10', 0x7d),
+ '\\div' : ('cmsy10', 0xa5),
+ '\\downarrow' : ('cmsy10', 0x23),
+ '\\emptyset' : ('cmsy10', 0x3b),
+ '\\equiv' : ('cmsy10', 0xb4),
+ '\\exists' : ('cmsy10', 0x39),
+ '\\forall' : ('cmsy10', 0x38),
+ '\\geq' : ('cmsy10', 0xb8),
+ '\\gg' : ('cmsy10', 0xc0),
+ '\\heartsuit' : ('cmsy10', 0x7e),
+ '\\in' : ('cmsy10', 0x32),
+ '\\infty' : ('cmsy10', 0x31),
+ '\\lbrace' : ('cmsy10', 0x66),
+ '\\lceil' : ('cmsy10', 0x64),
+ '\\leftarrow' : ('cmsy10', 0xc3),
+ '\\leftrightarrow' : ('cmsy10', 0x24),
+ '\\leq' : ('cmsy10', 0x2219),
+ '\\lfloor' : ('cmsy10', 0x62),
+ '\\ll' : ('cmsy10', 0xbf),
+ '\\mid' : ('cmsy10', 0x6a),
+ '\\mp' : ('cmsy10', 0xa8),
+ '\\nabla' : ('cmsy10', 0x72),
+ '\\nearrow' : ('cmsy10', 0x25),
+ '\\neg' : ('cmsy10', 0x3a),
+ '\\ni' : ('cmsy10', 0x33),
+ '\\nwarrow' : ('cmsy10', 0x2d),
+ '\\odot' : ('cmsy10', 0xaf),
+ '\\ominus' : ('cmsy10', 0xaa),
+ '\\oplus' : ('cmsy10', 0xa9),
+ '\\oslash' : ('cmsy10', 0xae),
+ '\\otimes' : ('cmsy10', 0xad),
+ '\\pm' : ('cmsy10', 0xa7),
+ '\\prec' : ('cmsy10', 0xc1),
+ '\\preceq' : ('cmsy10', 0xb9),
+ '\\prime' : ('cmsy10', 0x30),
+ '\\propto' : ('cmsy10', 0x2f),
+ '\\rbrace' : ('cmsy10', 0x67),
+ '\\rceil' : ('cmsy10', 0x65),
+ '\\rfloor' : ('cmsy10', 0x63),
+ '\\rightarrow' : ('cmsy10', 0x21),
+ '\\searrow' : ('cmsy10', 0x26),
+ '\\sim' : ('cmsy10', 0xbb),
+ '\\simeq' : ('cmsy10', 0x27),
+ '\\slash' : ('cmsy10', 0x36),
+ '\\spadesuit' : ('cmsy10', 0xc4),
+ '\\sqcap' : ('cmsy10', 0x75),
+ '\\sqcup' : ('cmsy10', 0x74),
+ '\\sqsubseteq' : ('cmsy10', 0x76),
+ '\\sqsupseteq' : ('cmsy10', 0x77),
+ '\\subset' : ('cmsy10', 0xbd),
+ '\\subseteq' : ('cmsy10', 0xb5),
+ '\\succ' : ('cmsy10', 0xc2),
+ '\\succeq' : ('cmsy10', 0xba),
+ '\\supset' : ('cmsy10', 0xbe),
+ '\\supseteq' : ('cmsy10', 0xb6),
+ '\\swarrow' : ('cmsy10', 0x2e),
+ '\\times' : ('cmsy10', 0xa3),
+ '\\to' : ('cmsy10', 0x21),
+ '\\top' : ('cmsy10', 0x3e),
+ '\\uparrow' : ('cmsy10', 0x22),
+ '\\updownarrow' : ('cmsy10', 0x6c),
+ '\\uplus' : ('cmsy10', 0x5d),
+ '\\vdash' : ('cmsy10', 0x60),
+ '\\vee' : ('cmsy10', 0x5f),
+ '\\vert' : ('cmsy10', 0x6a),
+ '\\wedge' : ('cmsy10', 0x5e),
+ '\\wr' : ('cmsy10', 0x6f),
+ '\\|' : ('cmsy10', 0x6b),
+ '|' : ('cmsy10', 0x6a),
+
+ '\\_' : ('cmtt10', 0x5f)
+}
+
+latex_to_cmex = { # Unused; delete once mathtext becomes private.
+ r'\__sqrt__' : 112,
+ r'\bigcap' : 92,
+ r'\bigcup' : 91,
+ r'\bigodot' : 75,
+ r'\bigoplus' : 77,
+ r'\bigotimes' : 79,
+ r'\biguplus' : 93,
+ r'\bigvee' : 95,
+ r'\bigwedge' : 94,
+ r'\coprod' : 97,
+ r'\int' : 90,
+ r'\leftangle' : 173,
+ r'\leftbrace' : 169,
+ r'\oint' : 73,
+ r'\prod' : 89,
+ r'\rightangle' : 174,
+ r'\rightbrace' : 170,
+ r'\sum' : 88,
+ r'\widehat' : 98,
+ r'\widetilde' : 101,
+}
+
+latex_to_standard = {
+ r'\cong' : ('psyr', 64),
+ r'\Delta' : ('psyr', 68),
+ r'\Phi' : ('psyr', 70),
+ r'\Gamma' : ('psyr', 89),
+ r'\alpha' : ('psyr', 97),
+ r'\beta' : ('psyr', 98),
+ r'\chi' : ('psyr', 99),
+ r'\delta' : ('psyr', 100),
+ r'\varepsilon' : ('psyr', 101),
+ r'\phi' : ('psyr', 102),
+ r'\gamma' : ('psyr', 103),
+ r'\eta' : ('psyr', 104),
+ r'\iota' : ('psyr', 105),
+ r'\varphi' : ('psyr', 106),
+ r'\kappa' : ('psyr', 108),
+ r'\nu' : ('psyr', 110),
+ r'\pi' : ('psyr', 112),
+ r'\theta' : ('psyr', 113),
+ r'\rho' : ('psyr', 114),
+ r'\sigma' : ('psyr', 115),
+ r'\tau' : ('psyr', 116),
+ r'\upsilon' : ('psyr', 117),
+ r'\varpi' : ('psyr', 118),
+ r'\omega' : ('psyr', 119),
+ r'\xi' : ('psyr', 120),
+ r'\psi' : ('psyr', 121),
+ r'\zeta' : ('psyr', 122),
+ r'\sim' : ('psyr', 126),
+ r'\leq' : ('psyr', 163),
+ r'\infty' : ('psyr', 165),
+ r'\clubsuit' : ('psyr', 167),
+ r'\diamondsuit' : ('psyr', 168),
+ r'\heartsuit' : ('psyr', 169),
+ r'\spadesuit' : ('psyr', 170),
+ r'\leftrightarrow' : ('psyr', 171),
+ r'\leftarrow' : ('psyr', 172),
+ r'\uparrow' : ('psyr', 173),
+ r'\rightarrow' : ('psyr', 174),
+ r'\downarrow' : ('psyr', 175),
+ r'\pm' : ('psyr', 176),
+ r'\geq' : ('psyr', 179),
+ r'\times' : ('psyr', 180),
+ r'\propto' : ('psyr', 181),
+ r'\partial' : ('psyr', 182),
+ r'\bullet' : ('psyr', 183),
+ r'\div' : ('psyr', 184),
+ r'\neq' : ('psyr', 185),
+ r'\equiv' : ('psyr', 186),
+ r'\approx' : ('psyr', 187),
+ r'\ldots' : ('psyr', 188),
+ r'\aleph' : ('psyr', 192),
+ r'\Im' : ('psyr', 193),
+ r'\Re' : ('psyr', 194),
+ r'\wp' : ('psyr', 195),
+ r'\otimes' : ('psyr', 196),
+ r'\oplus' : ('psyr', 197),
+ r'\oslash' : ('psyr', 198),
+ r'\cap' : ('psyr', 199),
+ r'\cup' : ('psyr', 200),
+ r'\supset' : ('psyr', 201),
+ r'\supseteq' : ('psyr', 202),
+ r'\subset' : ('psyr', 204),
+ r'\subseteq' : ('psyr', 205),
+ r'\in' : ('psyr', 206),
+ r'\notin' : ('psyr', 207),
+ r'\angle' : ('psyr', 208),
+ r'\nabla' : ('psyr', 209),
+ r'\textregistered' : ('psyr', 210),
+ r'\copyright' : ('psyr', 211),
+ r'\texttrademark' : ('psyr', 212),
+ r'\Pi' : ('psyr', 213),
+ r'\prod' : ('psyr', 213),
+ r'\surd' : ('psyr', 214),
+ r'\__sqrt__' : ('psyr', 214),
+ r'\cdot' : ('psyr', 215),
+ r'\urcorner' : ('psyr', 216),
+ r'\vee' : ('psyr', 217),
+ r'\wedge' : ('psyr', 218),
+ r'\Leftrightarrow' : ('psyr', 219),
+ r'\Leftarrow' : ('psyr', 220),
+ r'\Uparrow' : ('psyr', 221),
+ r'\Rightarrow' : ('psyr', 222),
+ r'\Downarrow' : ('psyr', 223),
+ r'\Diamond' : ('psyr', 224),
+ r'\Sigma' : ('psyr', 229),
+ r'\sum' : ('psyr', 229),
+ r'\forall' : ('psyr', 34),
+ r'\exists' : ('psyr', 36),
+ r'\lceil' : ('psyr', 233),
+ r'\lbrace' : ('psyr', 123),
+ r'\Psi' : ('psyr', 89),
+ r'\bot' : ('psyr', 0o136),
+ r'\Omega' : ('psyr', 0o127),
+ r'\leftbracket' : ('psyr', 0o133),
+ r'\rightbracket' : ('psyr', 0o135),
+ r'\leftbrace' : ('psyr', 123),
+ r'\leftparen' : ('psyr', 0o50),
+ r'\prime' : ('psyr', 0o242),
+ r'\sharp' : ('psyr', 0o43),
+ r'\slash' : ('psyr', 0o57),
+ r'\Lambda' : ('psyr', 0o114),
+ r'\neg' : ('psyr', 0o330),
+ r'\Upsilon' : ('psyr', 0o241),
+ r'\rightbrace' : ('psyr', 0o175),
+ r'\rfloor' : ('psyr', 0o373),
+ r'\lambda' : ('psyr', 0o154),
+ r'\to' : ('psyr', 0o256),
+ r'\Xi' : ('psyr', 0o130),
+ r'\emptyset' : ('psyr', 0o306),
+ r'\lfloor' : ('psyr', 0o353),
+ r'\rightparen' : ('psyr', 0o51),
+ r'\rceil' : ('psyr', 0o371),
+ r'\ni' : ('psyr', 0o47),
+ r'\epsilon' : ('psyr', 0o145),
+ r'\Theta' : ('psyr', 0o121),
+ r'\langle' : ('psyr', 0o341),
+ r'\leftangle' : ('psyr', 0o341),
+ r'\rangle' : ('psyr', 0o361),
+ r'\rightangle' : ('psyr', 0o361),
+ r'\rbrace' : ('psyr', 0o175),
+ r'\circ' : ('psyr', 0o260),
+ r'\diamond' : ('psyr', 0o340),
+ r'\mu' : ('psyr', 0o155),
+ r'\mid' : ('psyr', 0o352),
+ r'\imath' : ('pncri8a', 105),
+ r'\%' : ('pncr8a', 37),
+ r'\$' : ('pncr8a', 36),
+ r'\{' : ('pncr8a', 123),
+ r'\}' : ('pncr8a', 125),
+ r'\backslash' : ('pncr8a', 92),
+ r'\ast' : ('pncr8a', 42),
+ r'\#' : ('pncr8a', 35),
+
+ r'\circumflexaccent' : ('pncri8a', 124), # for \hat
+ r'\combiningbreve' : ('pncri8a', 81), # for \breve
+ r'\combininggraveaccent' : ('pncri8a', 114), # for \grave
+ r'\combiningacuteaccent' : ('pncri8a', 63), # for \accute
+ r'\combiningdiaeresis' : ('pncri8a', 91), # for \ddot
+ r'\combiningtilde' : ('pncri8a', 75), # for \tilde
+ r'\combiningrightarrowabove' : ('pncri8a', 110), # for \vec
+ r'\combiningdotabove' : ('pncri8a', 26), # for \dot
+}
+
+# Automatically generated.
+
+type12uni = {
+ 'aring' : 229,
+ 'quotedblright' : 8221,
+ 'V' : 86,
+ 'dollar' : 36,
+ 'four' : 52,
+ 'Yacute' : 221,
+ 'P' : 80,
+ 'underscore' : 95,
+ 'p' : 112,
+ 'Otilde' : 213,
+ 'perthousand' : 8240,
+ 'zero' : 48,
+ 'dotlessi' : 305,
+ 'Scaron' : 352,
+ 'zcaron' : 382,
+ 'egrave' : 232,
+ 'section' : 167,
+ 'Icircumflex' : 206,
+ 'ntilde' : 241,
+ 'ampersand' : 38,
+ 'dotaccent' : 729,
+ 'degree' : 176,
+ 'K' : 75,
+ 'acircumflex' : 226,
+ 'Aring' : 197,
+ 'k' : 107,
+ 'smalltilde' : 732,
+ 'Agrave' : 192,
+ 'divide' : 247,
+ 'ocircumflex' : 244,
+ 'asciitilde' : 126,
+ 'two' : 50,
+ 'E' : 69,
+ 'scaron' : 353,
+ 'F' : 70,
+ 'bracketleft' : 91,
+ 'asciicircum' : 94,
+ 'f' : 102,
+ 'ordmasculine' : 186,
+ 'mu' : 181,
+ 'paragraph' : 182,
+ 'nine' : 57,
+ 'v' : 118,
+ 'guilsinglleft' : 8249,
+ 'backslash' : 92,
+ 'six' : 54,
+ 'A' : 65,
+ 'icircumflex' : 238,
+ 'a' : 97,
+ 'ogonek' : 731,
+ 'q' : 113,
+ 'oacute' : 243,
+ 'ograve' : 242,
+ 'edieresis' : 235,
+ 'comma' : 44,
+ 'otilde' : 245,
+ 'guillemotright' : 187,
+ 'ecircumflex' : 234,
+ 'greater' : 62,
+ 'uacute' : 250,
+ 'L' : 76,
+ 'bullet' : 8226,
+ 'cedilla' : 184,
+ 'ydieresis' : 255,
+ 'l' : 108,
+ 'logicalnot' : 172,
+ 'exclamdown' : 161,
+ 'endash' : 8211,
+ 'agrave' : 224,
+ 'Adieresis' : 196,
+ 'germandbls' : 223,
+ 'Odieresis' : 214,
+ 'space' : 32,
+ 'quoteright' : 8217,
+ 'ucircumflex' : 251,
+ 'G' : 71,
+ 'quoteleft' : 8216,
+ 'W' : 87,
+ 'Q' : 81,
+ 'g' : 103,
+ 'w' : 119,
+ 'question' : 63,
+ 'one' : 49,
+ 'ring' : 730,
+ 'figuredash' : 8210,
+ 'B' : 66,
+ 'iacute' : 237,
+ 'Ydieresis' : 376,
+ 'R' : 82,
+ 'b' : 98,
+ 'r' : 114,
+ 'Ccedilla' : 199,
+ 'minus' : 8722,
+ 'Lslash' : 321,
+ 'Uacute' : 218,
+ 'yacute' : 253,
+ 'Ucircumflex' : 219,
+ 'quotedbl' : 34,
+ 'onehalf' : 189,
+ 'Thorn' : 222,
+ 'M' : 77,
+ 'eight' : 56,
+ 'multiply' : 215,
+ 'grave' : 96,
+ 'Ocircumflex' : 212,
+ 'm' : 109,
+ 'Ugrave' : 217,
+ 'guilsinglright' : 8250,
+ 'Ntilde' : 209,
+ 'questiondown' : 191,
+ 'Atilde' : 195,
+ 'ccedilla' : 231,
+ 'Z' : 90,
+ 'copyright' : 169,
+ 'yen' : 165,
+ 'Eacute' : 201,
+ 'H' : 72,
+ 'X' : 88,
+ 'Idieresis' : 207,
+ 'bar' : 124,
+ 'h' : 104,
+ 'x' : 120,
+ 'udieresis' : 252,
+ 'ordfeminine' : 170,
+ 'braceleft' : 123,
+ 'macron' : 175,
+ 'atilde' : 227,
+ 'Acircumflex' : 194,
+ 'Oslash' : 216,
+ 'C' : 67,
+ 'quotedblleft' : 8220,
+ 'S' : 83,
+ 'exclam' : 33,
+ 'Zcaron' : 381,
+ 'equal' : 61,
+ 's' : 115,
+ 'eth' : 240,
+ 'Egrave' : 200,
+ 'hyphen' : 45,
+ 'period' : 46,
+ 'igrave' : 236,
+ 'colon' : 58,
+ 'Ecircumflex' : 202,
+ 'trademark' : 8482,
+ 'Aacute' : 193,
+ 'cent' : 162,
+ 'lslash' : 322,
+ 'c' : 99,
+ 'N' : 78,
+ 'breve' : 728,
+ 'Oacute' : 211,
+ 'guillemotleft' : 171,
+ 'n' : 110,
+ 'idieresis' : 239,
+ 'braceright' : 125,
+ 'seven' : 55,
+ 'brokenbar' : 166,
+ 'ugrave' : 249,
+ 'periodcentered' : 183,
+ 'sterling' : 163,
+ 'I' : 73,
+ 'Y' : 89,
+ 'Eth' : 208,
+ 'emdash' : 8212,
+ 'i' : 105,
+ 'daggerdbl' : 8225,
+ 'y' : 121,
+ 'plusminus' : 177,
+ 'less' : 60,
+ 'Udieresis' : 220,
+ 'D' : 68,
+ 'five' : 53,
+ 'T' : 84,
+ 'oslash' : 248,
+ 'acute' : 180,
+ 'd' : 100,
+ 'OE' : 338,
+ 'Igrave' : 204,
+ 't' : 116,
+ 'parenright' : 41,
+ 'adieresis' : 228,
+ 'quotesingle' : 39,
+ 'twodotenleader' : 8229,
+ 'slash' : 47,
+ 'ellipsis' : 8230,
+ 'numbersign' : 35,
+ 'odieresis' : 246,
+ 'O' : 79,
+ 'oe' : 339,
+ 'o' : 111,
+ 'Edieresis' : 203,
+ 'plus' : 43,
+ 'dagger' : 8224,
+ 'three' : 51,
+ 'hungarumlaut' : 733,
+ 'parenleft' : 40,
+ 'fraction' : 8260,
+ 'registered' : 174,
+ 'J' : 74,
+ 'dieresis' : 168,
+ 'Ograve' : 210,
+ 'j' : 106,
+ 'z' : 122,
+ 'ae' : 230,
+ 'semicolon' : 59,
+ 'at' : 64,
+ 'Iacute' : 205,
+ 'percent' : 37,
+ 'bracketright' : 93,
+ 'AE' : 198,
+ 'asterisk' : 42,
+ 'aacute' : 225,
+ 'U' : 85,
+ 'eacute' : 233,
+ 'e' : 101,
+ 'thorn' : 254,
+ 'u' : 117,
+}
+
+uni2type1 = {v: k for k, v in type12uni.items()}
+
+tex2uni = {
+ 'widehat' : 0x0302,
+ 'widetilde' : 0x0303,
+ 'widebar' : 0x0305,
+ 'langle' : 0x27e8,
+ 'rangle' : 0x27e9,
+ 'perp' : 0x27c2,
+ 'neq' : 0x2260,
+ 'Join' : 0x2a1d,
+ 'leqslant' : 0x2a7d,
+ 'geqslant' : 0x2a7e,
+ 'lessapprox' : 0x2a85,
+ 'gtrapprox' : 0x2a86,
+ 'lesseqqgtr' : 0x2a8b,
+ 'gtreqqless' : 0x2a8c,
+ 'triangleeq' : 0x225c,
+ 'eqslantless' : 0x2a95,
+ 'eqslantgtr' : 0x2a96,
+ 'backepsilon' : 0x03f6,
+ 'precapprox' : 0x2ab7,
+ 'succapprox' : 0x2ab8,
+ 'fallingdotseq' : 0x2252,
+ 'subseteqq' : 0x2ac5,
+ 'supseteqq' : 0x2ac6,
+ 'varpropto' : 0x221d,
+ 'precnapprox' : 0x2ab9,
+ 'succnapprox' : 0x2aba,
+ 'subsetneqq' : 0x2acb,
+ 'supsetneqq' : 0x2acc,
+ 'lnapprox' : 0x2ab9,
+ 'gnapprox' : 0x2aba,
+ 'longleftarrow' : 0x27f5,
+ 'longrightarrow' : 0x27f6,
+ 'longleftrightarrow' : 0x27f7,
+ 'Longleftarrow' : 0x27f8,
+ 'Longrightarrow' : 0x27f9,
+ 'Longleftrightarrow' : 0x27fa,
+ 'longmapsto' : 0x27fc,
+ 'leadsto' : 0x21dd,
+ 'dashleftarrow' : 0x290e,
+ 'dashrightarrow' : 0x290f,
+ 'circlearrowleft' : 0x21ba,
+ 'circlearrowright' : 0x21bb,
+ 'leftrightsquigarrow' : 0x21ad,
+ 'leftsquigarrow' : 0x219c,
+ 'rightsquigarrow' : 0x219d,
+ 'Game' : 0x2141,
+ 'hbar' : 0x0127,
+ 'hslash' : 0x210f,
+ 'ldots' : 0x2026,
+ 'vdots' : 0x22ee,
+ 'doteqdot' : 0x2251,
+ 'doteq' : 8784,
+ 'partial' : 8706,
+ 'gg' : 8811,
+ 'asymp' : 8781,
+ 'blacktriangledown' : 9662,
+ 'otimes' : 8855,
+ 'nearrow' : 8599,
+ 'varpi' : 982,
+ 'vee' : 8744,
+ 'vec' : 8407,
+ 'smile' : 8995,
+ 'succnsim' : 8937,
+ 'gimel' : 8503,
+ 'vert' : 124,
+ '|' : 124,
+ 'varrho' : 1009,
+ 'P' : 182,
+ 'approxident' : 8779,
+ 'Swarrow' : 8665,
+ 'textasciicircum' : 94,
+ 'imageof' : 8887,
+ 'ntriangleleft' : 8938,
+ 'nleq' : 8816,
+ 'div' : 247,
+ 'nparallel' : 8742,
+ 'Leftarrow' : 8656,
+ 'lll' : 8920,
+ 'oiint' : 8751,
+ 'ngeq' : 8817,
+ 'Theta' : 920,
+ 'origof' : 8886,
+ 'blacksquare' : 9632,
+ 'solbar' : 9023,
+ 'neg' : 172,
+ 'sum' : 8721,
+ 'Vdash' : 8873,
+ 'coloneq' : 8788,
+ 'degree' : 176,
+ 'bowtie' : 8904,
+ 'blacktriangleright' : 9654,
+ 'varsigma' : 962,
+ 'leq' : 8804,
+ 'ggg' : 8921,
+ 'lneqq' : 8808,
+ 'scurel' : 8881,
+ 'stareq' : 8795,
+ 'BbbN' : 8469,
+ 'nLeftarrow' : 8653,
+ 'nLeftrightarrow' : 8654,
+ 'k' : 808,
+ 'bot' : 8869,
+ 'BbbC' : 8450,
+ 'Lsh' : 8624,
+ 'leftleftarrows' : 8647,
+ 'BbbZ' : 8484,
+ 'digamma' : 989,
+ 'BbbR' : 8477,
+ 'BbbP' : 8473,
+ 'BbbQ' : 8474,
+ 'vartriangleright' : 8883,
+ 'succsim' : 8831,
+ 'wedge' : 8743,
+ 'lessgtr' : 8822,
+ 'veebar' : 8891,
+ 'mapsdown' : 8615,
+ 'Rsh' : 8625,
+ 'chi' : 967,
+ 'prec' : 8826,
+ 'nsubseteq' : 8840,
+ 'therefore' : 8756,
+ 'eqcirc' : 8790,
+ 'textexclamdown' : 161,
+ 'nRightarrow' : 8655,
+ 'flat' : 9837,
+ 'notin' : 8713,
+ 'llcorner' : 8990,
+ 'varepsilon' : 949,
+ 'bigtriangleup' : 9651,
+ 'aleph' : 8501,
+ 'dotminus' : 8760,
+ 'upsilon' : 965,
+ 'Lambda' : 923,
+ 'cap' : 8745,
+ 'barleftarrow' : 8676,
+ 'mu' : 956,
+ 'boxplus' : 8862,
+ 'mp' : 8723,
+ 'circledast' : 8859,
+ 'tau' : 964,
+ 'in' : 8712,
+ 'backslash' : 92,
+ 'varnothing' : 8709,
+ 'sharp' : 9839,
+ 'eqsim' : 8770,
+ 'gnsim' : 8935,
+ 'Searrow' : 8664,
+ 'updownarrows' : 8645,
+ 'heartsuit' : 9825,
+ 'trianglelefteq' : 8884,
+ 'ddag' : 8225,
+ 'sqsubseteq' : 8849,
+ 'mapsfrom' : 8612,
+ 'boxbar' : 9707,
+ 'sim' : 8764,
+ 'Nwarrow' : 8662,
+ 'nequiv' : 8802,
+ 'succ' : 8827,
+ 'vdash' : 8866,
+ 'Leftrightarrow' : 8660,
+ 'parallel' : 8741,
+ 'invnot' : 8976,
+ 'natural' : 9838,
+ 'ss' : 223,
+ 'uparrow' : 8593,
+ 'nsim' : 8769,
+ 'hookrightarrow' : 8618,
+ 'Equiv' : 8803,
+ 'approx' : 8776,
+ 'Vvdash' : 8874,
+ 'nsucc' : 8833,
+ 'leftrightharpoons' : 8651,
+ 'Re' : 8476,
+ 'boxminus' : 8863,
+ 'equiv' : 8801,
+ 'Lleftarrow' : 8666,
+ 'll' : 8810,
+ 'Cup' : 8915,
+ 'measeq' : 8798,
+ 'upharpoonleft' : 8639,
+ 'lq' : 8216,
+ 'Upsilon' : 933,
+ 'subsetneq' : 8842,
+ 'greater' : 62,
+ 'supsetneq' : 8843,
+ 'Cap' : 8914,
+ 'L' : 321,
+ 'spadesuit' : 9824,
+ 'lrcorner' : 8991,
+ 'not' : 824,
+ 'bar' : 772,
+ 'rightharpoonaccent' : 8401,
+ 'boxdot' : 8865,
+ 'l' : 322,
+ 'leftharpoondown' : 8637,
+ 'bigcup' : 8899,
+ 'iint' : 8748,
+ 'bigwedge' : 8896,
+ 'downharpoonleft' : 8643,
+ 'textasciitilde' : 126,
+ 'subset' : 8834,
+ 'leqq' : 8806,
+ 'mapsup' : 8613,
+ 'nvDash' : 8877,
+ 'looparrowleft' : 8619,
+ 'nless' : 8814,
+ 'rightarrowbar' : 8677,
+ 'Vert' : 8214,
+ 'downdownarrows' : 8650,
+ 'uplus' : 8846,
+ 'simeq' : 8771,
+ 'napprox' : 8777,
+ 'ast' : 8727,
+ 'twoheaduparrow' : 8607,
+ 'doublebarwedge' : 8966,
+ 'Sigma' : 931,
+ 'leftharpoonaccent' : 8400,
+ 'ntrianglelefteq' : 8940,
+ 'nexists' : 8708,
+ 'times' : 215,
+ 'measuredangle' : 8737,
+ 'bumpeq' : 8783,
+ 'carriagereturn' : 8629,
+ 'adots' : 8944,
+ 'checkmark' : 10003,
+ 'lambda' : 955,
+ 'xi' : 958,
+ 'rbrace' : 125,
+ 'rbrack' : 93,
+ 'Nearrow' : 8663,
+ 'maltese' : 10016,
+ 'clubsuit' : 9827,
+ 'top' : 8868,
+ 'overarc' : 785,
+ 'varphi' : 966,
+ 'Delta' : 916,
+ 'iota' : 953,
+ 'nleftarrow' : 8602,
+ 'candra' : 784,
+ 'supset' : 8835,
+ 'triangleleft' : 9665,
+ 'gtreqless' : 8923,
+ 'ntrianglerighteq' : 8941,
+ 'quad' : 8195,
+ 'Xi' : 926,
+ 'gtrdot' : 8919,
+ 'leftthreetimes' : 8907,
+ 'minus' : 8722,
+ 'preccurlyeq' : 8828,
+ 'nleftrightarrow' : 8622,
+ 'lambdabar' : 411,
+ 'blacktriangle' : 9652,
+ 'kernelcontraction' : 8763,
+ 'Phi' : 934,
+ 'angle' : 8736,
+ 'spadesuitopen' : 9828,
+ 'eqless' : 8924,
+ 'mid' : 8739,
+ 'varkappa' : 1008,
+ 'Ldsh' : 8626,
+ 'updownarrow' : 8597,
+ 'beta' : 946,
+ 'textquotedblleft' : 8220,
+ 'rho' : 961,
+ 'alpha' : 945,
+ 'intercal' : 8890,
+ 'beth' : 8502,
+ 'grave' : 768,
+ 'acwopencirclearrow' : 8634,
+ 'nmid' : 8740,
+ 'nsupset' : 8837,
+ 'sigma' : 963,
+ 'dot' : 775,
+ 'Rightarrow' : 8658,
+ 'turnednot' : 8985,
+ 'backsimeq' : 8909,
+ 'leftarrowtail' : 8610,
+ 'approxeq' : 8778,
+ 'curlyeqsucc' : 8927,
+ 'rightarrowtail' : 8611,
+ 'Psi' : 936,
+ 'copyright' : 169,
+ 'yen' : 165,
+ 'vartriangleleft' : 8882,
+ 'rasp' : 700,
+ 'triangleright' : 9655,
+ 'precsim' : 8830,
+ 'infty' : 8734,
+ 'geq' : 8805,
+ 'updownarrowbar' : 8616,
+ 'precnsim' : 8936,
+ 'H' : 779,
+ 'ulcorner' : 8988,
+ 'looparrowright' : 8620,
+ 'ncong' : 8775,
+ 'downarrow' : 8595,
+ 'circeq' : 8791,
+ 'subseteq' : 8838,
+ 'bigstar' : 9733,
+ 'prime' : 8242,
+ 'lceil' : 8968,
+ 'Rrightarrow' : 8667,
+ 'oiiint' : 8752,
+ 'curlywedge' : 8911,
+ 'vDash' : 8872,
+ 'lfloor' : 8970,
+ 'ddots' : 8945,
+ 'exists' : 8707,
+ 'underbar' : 817,
+ 'Pi' : 928,
+ 'leftrightarrows' : 8646,
+ 'sphericalangle' : 8738,
+ 'coprod' : 8720,
+ 'circledcirc' : 8858,
+ 'gtrsim' : 8819,
+ 'gneqq' : 8809,
+ 'between' : 8812,
+ 'theta' : 952,
+ 'complement' : 8705,
+ 'arceq' : 8792,
+ 'nVdash' : 8878,
+ 'S' : 167,
+ 'wr' : 8768,
+ 'wp' : 8472,
+ 'backcong' : 8780,
+ 'lasp' : 701,
+ 'c' : 807,
+ 'nabla' : 8711,
+ 'dotplus' : 8724,
+ 'eta' : 951,
+ 'forall' : 8704,
+ 'eth' : 240,
+ 'colon' : 58,
+ 'sqcup' : 8852,
+ 'rightrightarrows' : 8649,
+ 'sqsupset' : 8848,
+ 'mapsto' : 8614,
+ 'bigtriangledown' : 9661,
+ 'sqsupseteq' : 8850,
+ 'propto' : 8733,
+ 'pi' : 960,
+ 'pm' : 177,
+ 'dots' : 0x2026,
+ 'nrightarrow' : 8603,
+ 'textasciiacute' : 180,
+ 'Doteq' : 8785,
+ 'breve' : 774,
+ 'sqcap' : 8851,
+ 'twoheadrightarrow' : 8608,
+ 'kappa' : 954,
+ 'vartriangle' : 9653,
+ 'diamondsuit' : 9826,
+ 'pitchfork' : 8916,
+ 'blacktriangleleft' : 9664,
+ 'nprec' : 8832,
+ 'curvearrowright' : 8631,
+ 'barwedge' : 8892,
+ 'multimap' : 8888,
+ 'textquestiondown' : 191,
+ 'cong' : 8773,
+ 'rtimes' : 8906,
+ 'rightzigzagarrow' : 8669,
+ 'rightarrow' : 8594,
+ 'leftarrow' : 8592,
+ '__sqrt__' : 8730,
+ 'twoheaddownarrow' : 8609,
+ 'oint' : 8750,
+ 'bigvee' : 8897,
+ 'eqdef' : 8797,
+ 'sterling' : 163,
+ 'phi' : 981,
+ 'Updownarrow' : 8661,
+ 'backprime' : 8245,
+ 'emdash' : 8212,
+ 'Gamma' : 915,
+ 'i' : 305,
+ 'rceil' : 8969,
+ 'leftharpoonup' : 8636,
+ 'Im' : 8465,
+ 'curvearrowleft' : 8630,
+ 'wedgeq' : 8793,
+ 'curlyeqprec' : 8926,
+ 'questeq' : 8799,
+ 'less' : 60,
+ 'upuparrows' : 8648,
+ 'tilde' : 771,
+ 'textasciigrave' : 96,
+ 'smallsetminus' : 8726,
+ 'ell' : 8467,
+ 'cup' : 8746,
+ 'danger' : 9761,
+ 'nVDash' : 8879,
+ 'cdotp' : 183,
+ 'cdots' : 8943,
+ 'hat' : 770,
+ 'eqgtr' : 8925,
+ 'psi' : 968,
+ 'frown' : 8994,
+ 'acute' : 769,
+ 'downzigzagarrow' : 8623,
+ 'ntriangleright' : 8939,
+ 'cupdot' : 8845,
+ 'circleddash' : 8861,
+ 'oslash' : 8856,
+ 'mho' : 8487,
+ 'd' : 803,
+ 'sqsubset' : 8847,
+ 'cdot' : 8901,
+ 'Omega' : 937,
+ 'OE' : 338,
+ 'veeeq' : 8794,
+ 'Finv' : 8498,
+ 't' : 865,
+ 'leftrightarrow' : 8596,
+ 'swarrow' : 8601,
+ 'rightthreetimes' : 8908,
+ 'rightleftharpoons' : 8652,
+ 'lesssim' : 8818,
+ 'searrow' : 8600,
+ 'because' : 8757,
+ 'gtrless' : 8823,
+ 'star' : 8902,
+ 'nsubset' : 8836,
+ 'zeta' : 950,
+ 'dddot' : 8411,
+ 'bigcirc' : 9675,
+ 'Supset' : 8913,
+ 'circ' : 8728,
+ 'slash' : 8725,
+ 'ocirc' : 778,
+ 'prod' : 8719,
+ 'twoheadleftarrow' : 8606,
+ 'daleth' : 8504,
+ 'upharpoonright' : 8638,
+ 'odot' : 8857,
+ 'Uparrow' : 8657,
+ 'O' : 216,
+ 'hookleftarrow' : 8617,
+ 'trianglerighteq' : 8885,
+ 'nsime' : 8772,
+ 'oe' : 339,
+ 'nwarrow' : 8598,
+ 'o' : 248,
+ 'ddddot' : 8412,
+ 'downharpoonright' : 8642,
+ 'succcurlyeq' : 8829,
+ 'gamma' : 947,
+ 'scrR' : 8475,
+ 'dag' : 8224,
+ 'thickspace' : 8197,
+ 'frakZ' : 8488,
+ 'lessdot' : 8918,
+ 'triangledown' : 9663,
+ 'ltimes' : 8905,
+ 'scrB' : 8492,
+ 'endash' : 8211,
+ 'scrE' : 8496,
+ 'scrF' : 8497,
+ 'scrH' : 8459,
+ 'scrI' : 8464,
+ 'rightharpoondown' : 8641,
+ 'scrL' : 8466,
+ 'scrM' : 8499,
+ 'frakC' : 8493,
+ 'nsupseteq' : 8841,
+ 'circledR' : 174,
+ 'circledS' : 9416,
+ 'ngtr' : 8815,
+ 'bigcap' : 8898,
+ 'scre' : 8495,
+ 'Downarrow' : 8659,
+ 'scrg' : 8458,
+ 'overleftrightarrow' : 8417,
+ 'scro' : 8500,
+ 'lnsim' : 8934,
+ 'eqcolon' : 8789,
+ 'curlyvee' : 8910,
+ 'urcorner' : 8989,
+ 'lbrace' : 123,
+ 'Bumpeq' : 8782,
+ 'delta' : 948,
+ 'boxtimes' : 8864,
+ 'overleftarrow' : 8406,
+ 'prurel' : 8880,
+ 'clubsuitopen' : 9831,
+ 'cwopencirclearrow' : 8635,
+ 'geqq' : 8807,
+ 'rightleftarrows' : 8644,
+ 'ac' : 8766,
+ 'ae' : 230,
+ 'int' : 8747,
+ 'rfloor' : 8971,
+ 'risingdotseq' : 8787,
+ 'nvdash' : 8876,
+ 'diamond' : 8900,
+ 'ddot' : 776,
+ 'backsim' : 8765,
+ 'oplus' : 8853,
+ 'triangleq' : 8796,
+ 'check' : 780,
+ 'ni' : 8715,
+ 'iiint' : 8749,
+ 'ne' : 8800,
+ 'lesseqgtr' : 8922,
+ 'obar' : 9021,
+ 'supseteq' : 8839,
+ 'nu' : 957,
+ 'AA' : 197,
+ 'AE' : 198,
+ 'models' : 8871,
+ 'ominus' : 8854,
+ 'dashv' : 8867,
+ 'omega' : 969,
+ 'rq' : 8217,
+ 'Subset' : 8912,
+ 'rightharpoonup' : 8640,
+ 'Rdsh' : 8627,
+ 'bullet' : 8729,
+ 'divideontimes' : 8903,
+ 'lbrack' : 91,
+ 'textquotedblright' : 8221,
+ 'Colon' : 8759,
+ '%' : 37,
+ '$' : 36,
+ '{' : 123,
+ '}' : 125,
+ '_' : 95,
+ '#' : 35,
+ 'imath' : 0x131,
+ 'circumflexaccent' : 770,
+ 'combiningbreve' : 774,
+ 'combiningoverline' : 772,
+ 'combininggraveaccent' : 768,
+ 'combiningacuteaccent' : 769,
+ 'combiningdiaeresis' : 776,
+ 'combiningtilde' : 771,
+ 'combiningrightarrowabove' : 8407,
+ 'combiningdotabove' : 775,
+ 'to' : 8594,
+ 'succeq' : 8829,
+ 'emptyset' : 8709,
+ 'leftparen' : 40,
+ 'rightparen' : 41,
+ 'bigoplus' : 10753,
+ 'leftangle' : 10216,
+ 'rightangle' : 10217,
+ 'leftbrace' : 124,
+ 'rightbrace' : 125,
+ 'jmath' : 567,
+ 'bigodot' : 10752,
+ 'preceq' : 8828,
+ 'biguplus' : 10756,
+ 'epsilon' : 949,
+ 'vartheta' : 977,
+ 'bigotimes' : 10754,
+ 'guillemotleft' : 171,
+ 'ring' : 730,
+ 'Thorn' : 222,
+ 'guilsinglright' : 8250,
+ 'perthousand' : 8240,
+ 'macron' : 175,
+ 'cent' : 162,
+ 'guillemotright' : 187,
+ 'equal' : 61,
+ 'asterisk' : 42,
+ 'guilsinglleft' : 8249,
+ 'plus' : 43,
+ 'thorn' : 254,
+ 'dagger' : 8224
+}
+
+# Each element is a 4-tuple of the form:
+# src_start, src_end, dst_font, dst_start
+#
+stix_virtual_fonts = {
+ 'bb':
+ {
+ 'rm':
+ [
+ (0x0030, 0x0039, 'rm', 0x1d7d8), # 0-9
+ (0x0041, 0x0042, 'rm', 0x1d538), # A-B
+ (0x0043, 0x0043, 'rm', 0x2102), # C
+ (0x0044, 0x0047, 'rm', 0x1d53b), # D-G
+ (0x0048, 0x0048, 'rm', 0x210d), # H
+ (0x0049, 0x004d, 'rm', 0x1d540), # I-M
+ (0x004e, 0x004e, 'rm', 0x2115), # N
+ (0x004f, 0x004f, 'rm', 0x1d546), # O
+ (0x0050, 0x0051, 'rm', 0x2119), # P-Q
+ (0x0052, 0x0052, 'rm', 0x211d), # R
+ (0x0053, 0x0059, 'rm', 0x1d54a), # S-Y
+ (0x005a, 0x005a, 'rm', 0x2124), # Z
+ (0x0061, 0x007a, 'rm', 0x1d552), # a-z
+ (0x0393, 0x0393, 'rm', 0x213e), # \Gamma
+ (0x03a0, 0x03a0, 'rm', 0x213f), # \Pi
+ (0x03a3, 0x03a3, 'rm', 0x2140), # \Sigma
+ (0x03b3, 0x03b3, 'rm', 0x213d), # \gamma
+ (0x03c0, 0x03c0, 'rm', 0x213c), # \pi
+ ],
+ 'it':
+ [
+ (0x0030, 0x0039, 'rm', 0x1d7d8), # 0-9
+ (0x0041, 0x0042, 'it', 0xe154), # A-B
+ (0x0043, 0x0043, 'it', 0x2102), # C
+ (0x0044, 0x0044, 'it', 0x2145), # D
+ (0x0045, 0x0047, 'it', 0xe156), # E-G
+ (0x0048, 0x0048, 'it', 0x210d), # H
+ (0x0049, 0x004d, 'it', 0xe159), # I-M
+ (0x004e, 0x004e, 'it', 0x2115), # N
+ (0x004f, 0x004f, 'it', 0xe15e), # O
+ (0x0050, 0x0051, 'it', 0x2119), # P-Q
+ (0x0052, 0x0052, 'it', 0x211d), # R
+ (0x0053, 0x0059, 'it', 0xe15f), # S-Y
+ (0x005a, 0x005a, 'it', 0x2124), # Z
+ (0x0061, 0x0063, 'it', 0xe166), # a-c
+ (0x0064, 0x0065, 'it', 0x2146), # d-e
+ (0x0066, 0x0068, 'it', 0xe169), # f-h
+ (0x0069, 0x006a, 'it', 0x2148), # i-j
+ (0x006b, 0x007a, 'it', 0xe16c), # k-z
+ (0x0393, 0x0393, 'it', 0x213e), # \Gamma (not in beta STIX fonts)
+ (0x03a0, 0x03a0, 'it', 0x213f), # \Pi
+ (0x03a3, 0x03a3, 'it', 0x2140), # \Sigma (not in beta STIX fonts)
+ (0x03b3, 0x03b3, 'it', 0x213d), # \gamma (not in beta STIX fonts)
+ (0x03c0, 0x03c0, 'it', 0x213c), # \pi
+ ],
+ 'bf':
+ [
+ (0x0030, 0x0039, 'rm', 0x1d7d8), # 0-9
+ (0x0041, 0x0042, 'bf', 0xe38a), # A-B
+ (0x0043, 0x0043, 'bf', 0x2102), # C
+ (0x0044, 0x0044, 'bf', 0x2145), # D
+ (0x0045, 0x0047, 'bf', 0xe38d), # E-G
+ (0x0048, 0x0048, 'bf', 0x210d), # H
+ (0x0049, 0x004d, 'bf', 0xe390), # I-M
+ (0x004e, 0x004e, 'bf', 0x2115), # N
+ (0x004f, 0x004f, 'bf', 0xe395), # O
+ (0x0050, 0x0051, 'bf', 0x2119), # P-Q
+ (0x0052, 0x0052, 'bf', 0x211d), # R
+ (0x0053, 0x0059, 'bf', 0xe396), # S-Y
+ (0x005a, 0x005a, 'bf', 0x2124), # Z
+ (0x0061, 0x0063, 'bf', 0xe39d), # a-c
+ (0x0064, 0x0065, 'bf', 0x2146), # d-e
+ (0x0066, 0x0068, 'bf', 0xe3a2), # f-h
+ (0x0069, 0x006a, 'bf', 0x2148), # i-j
+ (0x006b, 0x007a, 'bf', 0xe3a7), # k-z
+ (0x0393, 0x0393, 'bf', 0x213e), # \Gamma
+ (0x03a0, 0x03a0, 'bf', 0x213f), # \Pi
+ (0x03a3, 0x03a3, 'bf', 0x2140), # \Sigma
+ (0x03b3, 0x03b3, 'bf', 0x213d), # \gamma
+ (0x03c0, 0x03c0, 'bf', 0x213c), # \pi
+ ],
+ },
+ 'cal':
+ [
+ (0x0041, 0x005a, 'it', 0xe22d), # A-Z
+ ],
+ 'frak':
+ {
+ 'rm':
+ [
+ (0x0041, 0x0042, 'rm', 0x1d504), # A-B
+ (0x0043, 0x0043, 'rm', 0x212d), # C
+ (0x0044, 0x0047, 'rm', 0x1d507), # D-G
+ (0x0048, 0x0048, 'rm', 0x210c), # H
+ (0x0049, 0x0049, 'rm', 0x2111), # I
+ (0x004a, 0x0051, 'rm', 0x1d50d), # J-Q
+ (0x0052, 0x0052, 'rm', 0x211c), # R
+ (0x0053, 0x0059, 'rm', 0x1d516), # S-Y
+ (0x005a, 0x005a, 'rm', 0x2128), # Z
+ (0x0061, 0x007a, 'rm', 0x1d51e), # a-z
+ ],
+ 'bf':
+ [
+ (0x0041, 0x005a, 'bf', 0x1d56c), # A-Z
+ (0x0061, 0x007a, 'bf', 0x1d586), # a-z
+ ],
+ },
+ 'scr':
+ [
+ (0x0041, 0x0041, 'it', 0x1d49c), # A
+ (0x0042, 0x0042, 'it', 0x212c), # B
+ (0x0043, 0x0044, 'it', 0x1d49e), # C-D
+ (0x0045, 0x0046, 'it', 0x2130), # E-F
+ (0x0047, 0x0047, 'it', 0x1d4a2), # G
+ (0x0048, 0x0048, 'it', 0x210b), # H
+ (0x0049, 0x0049, 'it', 0x2110), # I
+ (0x004a, 0x004b, 'it', 0x1d4a5), # J-K
+ (0x004c, 0x004c, 'it', 0x2112), # L
+ (0x004d, 0x004d, 'it', 0x2133), # M
+ (0x004e, 0x0051, 'it', 0x1d4a9), # N-Q
+ (0x0052, 0x0052, 'it', 0x211b), # R
+ (0x0053, 0x005a, 'it', 0x1d4ae), # S-Z
+ (0x0061, 0x0064, 'it', 0x1d4b6), # a-d
+ (0x0065, 0x0065, 'it', 0x212f), # e
+ (0x0066, 0x0066, 'it', 0x1d4bb), # f
+ (0x0067, 0x0067, 'it', 0x210a), # g
+ (0x0068, 0x006e, 'it', 0x1d4bd), # h-n
+ (0x006f, 0x006f, 'it', 0x2134), # o
+ (0x0070, 0x007a, 'it', 0x1d4c5), # p-z
+ ],
+ 'sf':
+ {
+ 'rm':
+ [
+ (0x0030, 0x0039, 'rm', 0x1d7e2), # 0-9
+ (0x0041, 0x005a, 'rm', 0x1d5a0), # A-Z
+ (0x0061, 0x007a, 'rm', 0x1d5ba), # a-z
+ (0x0391, 0x03a9, 'rm', 0xe17d), # \Alpha-\Omega
+ (0x03b1, 0x03c9, 'rm', 0xe196), # \alpha-\omega
+ (0x03d1, 0x03d1, 'rm', 0xe1b0), # theta variant
+ (0x03d5, 0x03d5, 'rm', 0xe1b1), # phi variant
+ (0x03d6, 0x03d6, 'rm', 0xe1b3), # pi variant
+ (0x03f1, 0x03f1, 'rm', 0xe1b2), # rho variant
+ (0x03f5, 0x03f5, 'rm', 0xe1af), # lunate epsilon
+ (0x2202, 0x2202, 'rm', 0xe17c), # partial differential
+ ],
+ 'it':
+ [
+ # These numerals are actually upright. We don't actually
+ # want italic numerals ever.
+ (0x0030, 0x0039, 'rm', 0x1d7e2), # 0-9
+ (0x0041, 0x005a, 'it', 0x1d608), # A-Z
+ (0x0061, 0x007a, 'it', 0x1d622), # a-z
+ (0x0391, 0x03a9, 'rm', 0xe17d), # \Alpha-\Omega
+ (0x03b1, 0x03c9, 'it', 0xe1d8), # \alpha-\omega
+ (0x03d1, 0x03d1, 'it', 0xe1f2), # theta variant
+ (0x03d5, 0x03d5, 'it', 0xe1f3), # phi variant
+ (0x03d6, 0x03d6, 'it', 0xe1f5), # pi variant
+ (0x03f1, 0x03f1, 'it', 0xe1f4), # rho variant
+ (0x03f5, 0x03f5, 'it', 0xe1f1), # lunate epsilon
+ ],
+ 'bf':
+ [
+ (0x0030, 0x0039, 'bf', 0x1d7ec), # 0-9
+ (0x0041, 0x005a, 'bf', 0x1d5d4), # A-Z
+ (0x0061, 0x007a, 'bf', 0x1d5ee), # a-z
+ (0x0391, 0x03a9, 'bf', 0x1d756), # \Alpha-\Omega
+ (0x03b1, 0x03c9, 'bf', 0x1d770), # \alpha-\omega
+ (0x03d1, 0x03d1, 'bf', 0x1d78b), # theta variant
+ (0x03d5, 0x03d5, 'bf', 0x1d78d), # phi variant
+ (0x03d6, 0x03d6, 'bf', 0x1d78f), # pi variant
+ (0x03f0, 0x03f0, 'bf', 0x1d78c), # kappa variant
+ (0x03f1, 0x03f1, 'bf', 0x1d78e), # rho variant
+ (0x03f5, 0x03f5, 'bf', 0x1d78a), # lunate epsilon
+ (0x2202, 0x2202, 'bf', 0x1d789), # partial differential
+ (0x2207, 0x2207, 'bf', 0x1d76f), # \Nabla
+ ],
+ },
+ 'tt':
+ [
+ (0x0030, 0x0039, 'rm', 0x1d7f6), # 0-9
+ (0x0041, 0x005a, 'rm', 0x1d670), # A-Z
+ (0x0061, 0x007a, 'rm', 0x1d68a) # a-z
+ ],
+ }
diff --git a/venv/Lib/site-packages/matplotlib/_path.cp38-win_amd64.pyd b/venv/Lib/site-packages/matplotlib/_path.cp38-win_amd64.pyd
new file mode 100644
index 0000000..b29567e
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/_path.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/matplotlib/_pylab_helpers.py b/venv/Lib/site-packages/matplotlib/_pylab_helpers.py
new file mode 100644
index 0000000..27904dd
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_pylab_helpers.py
@@ -0,0 +1,140 @@
+"""
+Manage figures for the pyplot interface.
+"""
+
+import atexit
+from collections import OrderedDict
+import gc
+
+
+class Gcf:
+ """
+ Singleton to maintain the relation between figures and their managers, and
+ keep track of and "active" figure and manager.
+
+ The canvas of a figure created through pyplot is associated with a figure
+ manager, which handles the interaction between the figure and the backend.
+ pyplot keeps track of figure managers using an identifier, the "figure
+ number" or "manager number" (which can actually be any hashable value);
+ this number is available as the :attr:`number` attribute of the manager.
+
+ This class is never instantiated; it consists of an `OrderedDict` mapping
+ figure/manager numbers to managers, and a set of class methods that
+ manipulate this `OrderedDict`.
+
+ Attributes
+ ----------
+ figs : OrderedDict
+ `OrderedDict` mapping numbers to managers; the active manager is at the
+ end.
+ """
+
+ figs = OrderedDict()
+
+ @classmethod
+ def get_fig_manager(cls, num):
+ """
+ If manager number *num* exists, make it the active one and return it;
+ otherwise return *None*.
+ """
+ manager = cls.figs.get(num, None)
+ if manager is not None:
+ cls.set_active(manager)
+ return manager
+
+ @classmethod
+ def destroy(cls, num):
+ """
+ Destroy manager *num* -- either a manager instance or a manager number.
+
+ In the interactive backends, this is bound to the window "destroy" and
+ "delete" events.
+
+ It is recommended to pass a manager instance, to avoid confusion when
+ two managers share the same number.
+ """
+ if all(hasattr(num, attr) for attr in ["num", "destroy"]):
+ manager = num
+ if cls.figs.get(manager.num) is manager:
+ cls.figs.pop(manager.num)
+ else:
+ try:
+ manager = cls.figs.pop(num)
+ except KeyError:
+ return
+ if hasattr(manager, "_cidgcf"):
+ manager.canvas.mpl_disconnect(manager._cidgcf)
+ manager.destroy()
+ gc.collect(1)
+
+ @classmethod
+ def destroy_fig(cls, fig):
+ """Destroy figure *fig*."""
+ num = next((manager.num for manager in cls.figs.values()
+ if manager.canvas.figure == fig), None)
+ if num is not None:
+ cls.destroy(num)
+
+ @classmethod
+ def destroy_all(cls):
+ """Destroy all figures."""
+ # Reimport gc in case the module globals have already been removed
+ # during interpreter shutdown.
+ import gc
+ for manager in list(cls.figs.values()):
+ manager.canvas.mpl_disconnect(manager._cidgcf)
+ manager.destroy()
+ cls.figs.clear()
+ gc.collect(1)
+
+ @classmethod
+ def has_fignum(cls, num):
+ """Return whether figure number *num* exists."""
+ return num in cls.figs
+
+ @classmethod
+ def get_all_fig_managers(cls):
+ """Return a list of figure managers."""
+ return list(cls.figs.values())
+
+ @classmethod
+ def get_num_fig_managers(cls):
+ """Return the number of figures being managed."""
+ return len(cls.figs)
+
+ @classmethod
+ def get_active(cls):
+ """Return the active manager, or *None* if there is no manager."""
+ return next(reversed(cls.figs.values())) if cls.figs else None
+
+ @classmethod
+ def _set_new_active_manager(cls, manager):
+ """Adopt *manager* into pyplot and make it the active manager."""
+ if not hasattr(manager, "_cidgcf"):
+ manager._cidgcf = manager.canvas.mpl_connect(
+ "button_press_event", lambda event: cls.set_active(manager))
+ fig = manager.canvas.figure
+ fig.number = manager.num
+ label = fig.get_label()
+ if label:
+ manager.set_window_title(label)
+ cls.set_active(manager)
+
+ @classmethod
+ def set_active(cls, manager):
+ """Make *manager* the active manager."""
+ cls.figs[manager.num] = manager
+ cls.figs.move_to_end(manager.num)
+
+ @classmethod
+ def draw_all(cls, force=False):
+ """
+ Redraw all stale managed figures, or, if *force* is True, all managed
+ figures.
+ """
+ for manager in cls.get_all_fig_managers():
+ if force or manager.canvas.figure.stale:
+ manager.canvas.draw_idle()
+
+
+atexit.register(Gcf.destroy_all)
diff --git a/venv/Lib/site-packages/matplotlib/_qhull.cp38-win_amd64.pyd b/venv/Lib/site-packages/matplotlib/_qhull.cp38-win_amd64.pyd
new file mode 100644
index 0000000..68c17e0
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/_qhull.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/matplotlib/_text_layout.py b/venv/Lib/site-packages/matplotlib/_text_layout.py
new file mode 100644
index 0000000..c7a87e8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_text_layout.py
@@ -0,0 +1,44 @@
+"""
+Text layouting utilities.
+"""
+
+import dataclasses
+
+from .ft2font import KERNING_DEFAULT, LOAD_NO_HINTING
+
+
+LayoutItem = dataclasses.make_dataclass(
+ "LayoutItem", ["char", "glyph_idx", "x", "prev_kern"])
+
+
+def layout(string, font, *, kern_mode=KERNING_DEFAULT):
+ """
+ Render *string* with *font*. For each character in *string*, yield a
+ (glyph-index, x-position) pair. When such a pair is yielded, the font's
+ glyph is set to the corresponding character.
+
+ Parameters
+ ----------
+ string : str
+ The string to be rendered.
+ font : FT2Font
+ The font.
+ kern_mode : int
+ A FreeType kerning mode.
+
+ Yields
+ ------
+ glyph_index : int
+ x_position : float
+ """
+ x = 0
+ prev_glyph_idx = None
+ for char in string:
+ glyph_idx = font.get_char_index(ord(char))
+ kern = (font.get_kerning(prev_glyph_idx, glyph_idx, kern_mode) / 64
+ if prev_glyph_idx is not None else 0.)
+ x += kern
+ glyph = font.load_glyph(glyph_idx, flags=LOAD_NO_HINTING)
+ yield LayoutItem(char, glyph_idx, x, kern)
+ x += glyph.linearHoriAdvance / 65536
+ prev_glyph_idx = glyph_idx
diff --git a/venv/Lib/site-packages/matplotlib/_tri.cp38-win_amd64.pyd b/venv/Lib/site-packages/matplotlib/_tri.cp38-win_amd64.pyd
new file mode 100644
index 0000000..15d82ea
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/_tri.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/matplotlib/_ttconv.cp38-win_amd64.pyd b/venv/Lib/site-packages/matplotlib/_ttconv.cp38-win_amd64.pyd
new file mode 100644
index 0000000..fd2b641
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/_ttconv.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/matplotlib/_version.py b/venv/Lib/site-packages/matplotlib/_version.py
new file mode 100644
index 0000000..f1205f5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/_version.py
@@ -0,0 +1,21 @@
+
+# This file was generated by 'versioneer.py' (0.15) from
+# revision-control system data, or from the parent directory name of an
+# unpacked source archive. Distribution tarballs contain a pre-generated copy
+# of this file.
+
+import json
+import sys
+
+version_json = '''
+{
+ "dirty": false,
+ "error": null,
+ "full-revisionid": "e3fe991d45a3dbdf3afeaf8bd4556980178183eb",
+ "version": "3.4.2"
+}
+''' # END VERSION_JSON
+
+
+def get_versions():
+ return json.loads(version_json)
diff --git a/venv/Lib/site-packages/matplotlib/afm.py b/venv/Lib/site-packages/matplotlib/afm.py
new file mode 100644
index 0000000..0106664
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/afm.py
@@ -0,0 +1,532 @@
+"""
+A python interface to Adobe Font Metrics Files.
+
+Although a number of other python implementations exist, and may be more
+complete than this, it was decided not to go with them because they were
+either:
+
+1) copyrighted or used a non-BSD compatible license
+2) had too many dependencies and a free standing lib was needed
+3) did more than needed and it was easier to write afresh rather than
+ figure out how to get just what was needed.
+
+It is pretty easy to use, and has no external dependencies:
+
+>>> import matplotlib as mpl
+>>> from pathlib import Path
+>>> afm_path = Path(mpl.get_data_path(), 'fonts', 'afm', 'ptmr8a.afm')
+>>>
+>>> from matplotlib.afm import AFM
+>>> with afm_path.open('rb') as fh:
+... afm = AFM(fh)
+>>> afm.string_width_height('What the heck?')
+(6220.0, 694)
+>>> afm.get_fontname()
+'Times-Roman'
+>>> afm.get_kern_dist('A', 'f')
+0
+>>> afm.get_kern_dist('A', 'y')
+-92.0
+>>> afm.get_bbox_char('!')
+[130, -9, 238, 676]
+
+As in the Adobe Font Metrics File Format Specification, all dimensions
+are given in units of 1/1000 of the scale factor (point size) of the font
+being used.
+"""
+
+from collections import namedtuple
+import logging
+import re
+
+from ._mathtext_data import uni2type1
+
+
+_log = logging.getLogger(__name__)
+
+
+def _to_int(x):
+ # Some AFM files have floats where we are expecting ints -- there is
+ # probably a better way to handle this (support floats, round rather than
+ # truncate). But I don't know what the best approach is now and this
+ # change to _to_int should at least prevent Matplotlib from crashing on
+ # these. JDH (2009-11-06)
+ return int(float(x))
+
+
+def _to_float(x):
+ # Some AFM files use "," instead of "." as decimal separator -- this
+ # shouldn't be ambiguous (unless someone is wicked enough to use "," as
+ # thousands separator...).
+ if isinstance(x, bytes):
+ # Encoding doesn't really matter -- if we have codepoints >127 the call
+ # to float() will error anyways.
+ x = x.decode('latin-1')
+ return float(x.replace(',', '.'))
+
+
+def _to_str(x):
+ return x.decode('utf8')
+
+
+def _to_list_of_ints(s):
+ s = s.replace(b',', b' ')
+ return [_to_int(val) for val in s.split()]
+
+
+def _to_list_of_floats(s):
+ return [_to_float(val) for val in s.split()]
+
+
+def _to_bool(s):
+ if s.lower().strip() in (b'false', b'0', b'no'):
+ return False
+ else:
+ return True
+
+
+def _parse_header(fh):
+ """
+ Read the font metrics header (up to the char metrics) and returns
+ a dictionary mapping *key* to *val*. *val* will be converted to the
+ appropriate python type as necessary; e.g.:
+
+ * 'False'->False
+ * '0'->0
+ * '-168 -218 1000 898'-> [-168, -218, 1000, 898]
+
+ Dictionary keys are
+
+ StartFontMetrics, FontName, FullName, FamilyName, Weight,
+ ItalicAngle, IsFixedPitch, FontBBox, UnderlinePosition,
+ UnderlineThickness, Version, Notice, EncodingScheme, CapHeight,
+ XHeight, Ascender, Descender, StartCharMetrics
+ """
+ header_converters = {
+ b'StartFontMetrics': _to_float,
+ b'FontName': _to_str,
+ b'FullName': _to_str,
+ b'FamilyName': _to_str,
+ b'Weight': _to_str,
+ b'ItalicAngle': _to_float,
+ b'IsFixedPitch': _to_bool,
+ b'FontBBox': _to_list_of_ints,
+ b'UnderlinePosition': _to_float,
+ b'UnderlineThickness': _to_float,
+ b'Version': _to_str,
+ # Some AFM files have non-ASCII characters (which are not allowed by
+ # the spec). Given that there is actually no public API to even access
+ # this field, just return it as straight bytes.
+ b'Notice': lambda x: x,
+ b'EncodingScheme': _to_str,
+ b'CapHeight': _to_float, # Is the second version a mistake, or
+ b'Capheight': _to_float, # do some AFM files contain 'Capheight'? -JKS
+ b'XHeight': _to_float,
+ b'Ascender': _to_float,
+ b'Descender': _to_float,
+ b'StdHW': _to_float,
+ b'StdVW': _to_float,
+ b'StartCharMetrics': _to_int,
+ b'CharacterSet': _to_str,
+ b'Characters': _to_int,
+ }
+ d = {}
+ first_line = True
+ for line in fh:
+ line = line.rstrip()
+ if line.startswith(b'Comment'):
+ continue
+ lst = line.split(b' ', 1)
+ key = lst[0]
+ if first_line:
+ # AFM spec, Section 4: The StartFontMetrics keyword
+ # [followed by a version number] must be the first line in
+ # the file, and the EndFontMetrics keyword must be the
+ # last non-empty line in the file. We just check the
+ # first header entry.
+ if key != b'StartFontMetrics':
+ raise RuntimeError('Not an AFM file')
+ first_line = False
+ if len(lst) == 2:
+ val = lst[1]
+ else:
+ val = b''
+ try:
+ converter = header_converters[key]
+ except KeyError:
+ _log.error('Found an unknown keyword in AFM header (was %r)' % key)
+ continue
+ try:
+ d[key] = converter(val)
+ except ValueError:
+ _log.error('Value error parsing header in AFM: %s, %s', key, val)
+ continue
+ if key == b'StartCharMetrics':
+ break
+ else:
+ raise RuntimeError('Bad parse')
+ return d
+
+
+CharMetrics = namedtuple('CharMetrics', 'width, name, bbox')
+CharMetrics.__doc__ = """
+ Represents the character metrics of a single character.
+
+ Notes
+ -----
+ The fields do currently only describe a subset of character metrics
+ information defined in the AFM standard.
+ """
+CharMetrics.width.__doc__ = """The character width (WX)."""
+CharMetrics.name.__doc__ = """The character name (N)."""
+CharMetrics.bbox.__doc__ = """
+ The bbox of the character (B) as a tuple (*llx*, *lly*, *urx*, *ury*)."""
+
+
+def _parse_char_metrics(fh):
+ """
+ Parse the given filehandle for character metrics information and return
+ the information as dicts.
+
+ It is assumed that the file cursor is on the line behind
+ 'StartCharMetrics'.
+
+ Returns
+ -------
+ ascii_d : dict
+ A mapping "ASCII num of the character" to `.CharMetrics`.
+ name_d : dict
+ A mapping "character name" to `.CharMetrics`.
+
+ Notes
+ -----
+ This function is incomplete per the standard, but thus far parses
+ all the sample afm files tried.
+ """
+ required_keys = {'C', 'WX', 'N', 'B'}
+
+ ascii_d = {}
+ name_d = {}
+ for line in fh:
+ # We are defensively letting values be utf8. The spec requires
+ # ascii, but there are non-compliant fonts in circulation
+ line = _to_str(line.rstrip()) # Convert from byte-literal
+ if line.startswith('EndCharMetrics'):
+ return ascii_d, name_d
+ # Split the metric line into a dictionary, keyed by metric identifiers
+ vals = dict(s.strip().split(' ', 1) for s in line.split(';') if s)
+ # There may be other metrics present, but only these are needed
+ if not required_keys.issubset(vals):
+ raise RuntimeError('Bad char metrics line: %s' % line)
+ num = _to_int(vals['C'])
+ wx = _to_float(vals['WX'])
+ name = vals['N']
+ bbox = _to_list_of_floats(vals['B'])
+ bbox = list(map(int, bbox))
+ metrics = CharMetrics(wx, name, bbox)
+ # Workaround: If the character name is 'Euro', give it the
+ # corresponding character code, according to WinAnsiEncoding (see PDF
+ # Reference).
+ if name == 'Euro':
+ num = 128
+ elif name == 'minus':
+ num = ord("\N{MINUS SIGN}") # 0x2212
+ if num != -1:
+ ascii_d[num] = metrics
+ name_d[name] = metrics
+ raise RuntimeError('Bad parse')
+
+
+def _parse_kern_pairs(fh):
+ """
+ Return a kern pairs dictionary; keys are (*char1*, *char2*) tuples and
+ values are the kern pair value. For example, a kern pairs line like
+ ``KPX A y -50``
+
+ will be represented as::
+
+ d[ ('A', 'y') ] = -50
+
+ """
+
+ line = next(fh)
+ if not line.startswith(b'StartKernPairs'):
+ raise RuntimeError('Bad start of kern pairs data: %s' % line)
+
+ d = {}
+ for line in fh:
+ line = line.rstrip()
+ if not line:
+ continue
+ if line.startswith(b'EndKernPairs'):
+ next(fh) # EndKernData
+ return d
+ vals = line.split()
+ if len(vals) != 4 or vals[0] != b'KPX':
+ raise RuntimeError('Bad kern pairs line: %s' % line)
+ c1, c2, val = _to_str(vals[1]), _to_str(vals[2]), _to_float(vals[3])
+ d[(c1, c2)] = val
+ raise RuntimeError('Bad kern pairs parse')
+
+
+CompositePart = namedtuple('CompositePart', 'name, dx, dy')
+CompositePart.__doc__ = """
+ Represents the information on a composite element of a composite char."""
+CompositePart.name.__doc__ = """Name of the part, e.g. 'acute'."""
+CompositePart.dx.__doc__ = """x-displacement of the part from the origin."""
+CompositePart.dy.__doc__ = """y-displacement of the part from the origin."""
+
+
+def _parse_composites(fh):
+ """
+ Parse the given filehandle for composites information return them as a
+ dict.
+
+ It is assumed that the file cursor is on the line behind 'StartComposites'.
+
+ Returns
+ -------
+ dict
+ A dict mapping composite character names to a parts list. The parts
+ list is a list of `.CompositePart` entries describing the parts of
+ the composite.
+
+ Examples
+ --------
+ A composite definition line::
+
+ CC Aacute 2 ; PCC A 0 0 ; PCC acute 160 170 ;
+
+ will be represented as::
+
+ composites['Aacute'] = [CompositePart(name='A', dx=0, dy=0),
+ CompositePart(name='acute', dx=160, dy=170)]
+
+ """
+ composites = {}
+ for line in fh:
+ line = line.rstrip()
+ if not line:
+ continue
+ if line.startswith(b'EndComposites'):
+ return composites
+ vals = line.split(b';')
+ cc = vals[0].split()
+ name, numParts = cc[1], _to_int(cc[2])
+ pccParts = []
+ for s in vals[1:-1]:
+ pcc = s.split()
+ part = CompositePart(pcc[1], _to_float(pcc[2]), _to_float(pcc[3]))
+ pccParts.append(part)
+ composites[name] = pccParts
+
+ raise RuntimeError('Bad composites parse')
+
+
+def _parse_optional(fh):
+ """
+ Parse the optional fields for kern pair data and composites.
+
+ Returns
+ -------
+ kern_data : dict
+ A dict containing kerning information. May be empty.
+ See `._parse_kern_pairs`.
+ composites : dict
+ A dict containing composite information. May be empty.
+ See `._parse_composites`.
+ """
+ optional = {
+ b'StartKernData': _parse_kern_pairs,
+ b'StartComposites': _parse_composites,
+ }
+
+ d = {b'StartKernData': {},
+ b'StartComposites': {}}
+ for line in fh:
+ line = line.rstrip()
+ if not line:
+ continue
+ key = line.split()[0]
+
+ if key in optional:
+ d[key] = optional[key](fh)
+
+ return d[b'StartKernData'], d[b'StartComposites']
+
+
+class AFM:
+
+ def __init__(self, fh):
+ """Parse the AFM file in file object *fh*."""
+ self._header = _parse_header(fh)
+ self._metrics, self._metrics_by_name = _parse_char_metrics(fh)
+ self._kern, self._composite = _parse_optional(fh)
+
+ def get_bbox_char(self, c, isord=False):
+ if not isord:
+ c = ord(c)
+ return self._metrics[c].bbox
+
+ def string_width_height(self, s):
+ """
+ Return the string width (including kerning) and string height
+ as a (*w*, *h*) tuple.
+ """
+ if not len(s):
+ return 0, 0
+ total_width = 0
+ namelast = None
+ miny = 1e9
+ maxy = 0
+ for c in s:
+ if c == '\n':
+ continue
+ wx, name, bbox = self._metrics[ord(c)]
+
+ total_width += wx + self._kern.get((namelast, name), 0)
+ l, b, w, h = bbox
+ miny = min(miny, b)
+ maxy = max(maxy, b + h)
+
+ namelast = name
+
+ return total_width, maxy - miny
+
+ def get_str_bbox_and_descent(self, s):
+ """Return the string bounding box and the maximal descent."""
+ if not len(s):
+ return 0, 0, 0, 0, 0
+ total_width = 0
+ namelast = None
+ miny = 1e9
+ maxy = 0
+ left = 0
+ if not isinstance(s, str):
+ s = _to_str(s)
+ for c in s:
+ if c == '\n':
+ continue
+ name = uni2type1.get(ord(c), f"uni{ord(c):04X}")
+ try:
+ wx, _, bbox = self._metrics_by_name[name]
+ except KeyError:
+ name = 'question'
+ wx, _, bbox = self._metrics_by_name[name]
+ total_width += wx + self._kern.get((namelast, name), 0)
+ l, b, w, h = bbox
+ left = min(left, l)
+ miny = min(miny, b)
+ maxy = max(maxy, b + h)
+
+ namelast = name
+
+ return left, miny, total_width, maxy - miny, -miny
+
+ def get_str_bbox(self, s):
+ """Return the string bounding box."""
+ return self.get_str_bbox_and_descent(s)[:4]
+
+ def get_name_char(self, c, isord=False):
+ """Get the name of the character, i.e., ';' is 'semicolon'."""
+ if not isord:
+ c = ord(c)
+ return self._metrics[c].name
+
+ def get_width_char(self, c, isord=False):
+ """
+ Get the width of the character from the character metric WX field.
+ """
+ if not isord:
+ c = ord(c)
+ return self._metrics[c].width
+
+ def get_width_from_char_name(self, name):
+ """Get the width of the character from a type1 character name."""
+ return self._metrics_by_name[name].width
+
+ def get_height_char(self, c, isord=False):
+ """Get the bounding box (ink) height of character *c* (space is 0)."""
+ if not isord:
+ c = ord(c)
+ return self._metrics[c].bbox[-1]
+
+ def get_kern_dist(self, c1, c2):
+ """
+ Return the kerning pair distance (possibly 0) for chars *c1* and *c2*.
+ """
+ name1, name2 = self.get_name_char(c1), self.get_name_char(c2)
+ return self.get_kern_dist_from_name(name1, name2)
+
+ def get_kern_dist_from_name(self, name1, name2):
+ """
+ Return the kerning pair distance (possibly 0) for chars
+ *name1* and *name2*.
+ """
+ return self._kern.get((name1, name2), 0)
+
+ def get_fontname(self):
+ """Return the font name, e.g., 'Times-Roman'."""
+ return self._header[b'FontName']
+
+ @property
+ def postscript_name(self): # For consistency with FT2Font.
+ return self.get_fontname()
+
+ def get_fullname(self):
+ """Return the font full name, e.g., 'Times-Roman'."""
+ name = self._header.get(b'FullName')
+ if name is None: # use FontName as a substitute
+ name = self._header[b'FontName']
+ return name
+
+ def get_familyname(self):
+ """Return the font family name, e.g., 'Times'."""
+ name = self._header.get(b'FamilyName')
+ if name is not None:
+ return name
+
+ # FamilyName not specified so we'll make a guess
+ name = self.get_fullname()
+ extras = (r'(?i)([ -](regular|plain|italic|oblique|bold|semibold|'
+ r'light|ultralight|extra|condensed))+$')
+ return re.sub(extras, '', name)
+
+ @property
+ def family_name(self):
+ """The font family name, e.g., 'Times'."""
+ return self.get_familyname()
+
+ def get_weight(self):
+ """Return the font weight, e.g., 'Bold' or 'Roman'."""
+ return self._header[b'Weight']
+
+ def get_angle(self):
+ """Return the fontangle as float."""
+ return self._header[b'ItalicAngle']
+
+ def get_capheight(self):
+ """Return the cap height as float."""
+ return self._header[b'CapHeight']
+
+ def get_xheight(self):
+ """Return the xheight as float."""
+ return self._header[b'XHeight']
+
+ def get_underline_thickness(self):
+ """Return the underline thickness as float."""
+ return self._header[b'UnderlineThickness']
+
+ def get_horizontal_stem_width(self):
+ """
+ Return the standard horizontal stem width as float, or *None* if
+ not specified in AFM file.
+ """
+ return self._header.get(b'StdHW', None)
+
+ def get_vertical_stem_width(self):
+ """
+ Return the standard vertical stem width as float, or *None* if
+ not specified in AFM file.
+ """
+ return self._header.get(b'StdVW', None)
diff --git a/venv/Lib/site-packages/matplotlib/animation.py b/venv/Lib/site-packages/matplotlib/animation.py
new file mode 100644
index 0000000..af9b9b8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/animation.py
@@ -0,0 +1,1797 @@
+# TODO:
+# * Documentation -- this will need a new section of the User's Guide.
+# Both for Animations and just timers.
+# - Also need to update http://www.scipy.org/Cookbook/Matplotlib/Animations
+# * Blit
+# * Currently broken with Qt4 for widgets that don't start on screen
+# * Still a few edge cases that aren't working correctly
+# * Can this integrate better with existing matplotlib animation artist flag?
+# - If animated removes from default draw(), perhaps we could use this to
+# simplify initial draw.
+# * Example
+# * Frameless animation - pure procedural with no loop
+# * Need example that uses something like inotify or subprocess
+# * Complex syncing examples
+# * Movies
+# * Can blit be enabled for movies?
+# * Need to consider event sources to allow clicking through multiple figures
+
+import abc
+import base64
+import contextlib
+from io import BytesIO, TextIOWrapper
+import itertools
+import logging
+from pathlib import Path
+import shutil
+import subprocess
+import sys
+from tempfile import TemporaryDirectory
+import uuid
+import warnings
+
+import numpy as np
+from PIL import Image
+
+import matplotlib as mpl
+from matplotlib._animation_data import (
+ DISPLAY_TEMPLATE, INCLUDED_FRAMES, JS_INCLUDE, STYLE_INCLUDE)
+from matplotlib import _api, cbook
+
+
+_log = logging.getLogger(__name__)
+
+# Process creation flag for subprocess to prevent it raising a terminal
+# window. See for example:
+# https://stackoverflow.com/questions/24130623/using-python-subprocess-popen-cant-prevent-exe-stopped-working-prompt
+if sys.platform == 'win32':
+ subprocess_creation_flags = CREATE_NO_WINDOW = 0x08000000
+else:
+ # Apparently None won't work here
+ subprocess_creation_flags = 0
+
+# Other potential writing methods:
+# * http://pymedia.org/
+# * libming (produces swf) python wrappers: https://github.com/libming/libming
+# * Wrap x264 API:
+
+# (http://stackoverflow.com/questions/2940671/
+# how-to-encode-series-of-images-into-h264-using-x264-api-c-c )
+
+
+def adjusted_figsize(w, h, dpi, n):
+ """
+ Compute figure size so that pixels are a multiple of n.
+
+ Parameters
+ ----------
+ w, h : float
+ Size in inches.
+
+ dpi : float
+ The dpi.
+
+ n : int
+ The target multiple.
+
+ Returns
+ -------
+ wnew, hnew : float
+ The new figure size in inches.
+ """
+
+ # this maybe simplified if / when we adopt consistent rounding for
+ # pixel size across the whole library
+ def correct_roundoff(x, dpi, n):
+ if int(x*dpi) % n != 0:
+ if int(np.nextafter(x, np.inf)*dpi) % n == 0:
+ x = np.nextafter(x, np.inf)
+ elif int(np.nextafter(x, -np.inf)*dpi) % n == 0:
+ x = np.nextafter(x, -np.inf)
+ return x
+
+ wnew = int(w * dpi / n) * n / dpi
+ hnew = int(h * dpi / n) * n / dpi
+ return correct_roundoff(wnew, dpi, n), correct_roundoff(hnew, dpi, n)
+
+
+class MovieWriterRegistry:
+ """Registry of available writer classes by human readable name."""
+
+ def __init__(self):
+ self._registered = dict()
+
+ def register(self, name):
+ """
+ Decorator for registering a class under a name.
+
+ Example use::
+
+ @registry.register(name)
+ class Foo:
+ pass
+ """
+ def wrapper(writer_cls):
+ self._registered[name] = writer_cls
+ return writer_cls
+ return wrapper
+
+ def is_available(self, name):
+ """
+ Check if given writer is available by name.
+
+ Parameters
+ ----------
+ name : str
+
+ Returns
+ -------
+ bool
+ """
+ try:
+ cls = self._registered[name]
+ except KeyError:
+ return False
+ return cls.isAvailable()
+
+ def __iter__(self):
+ """Iterate over names of available writer class."""
+ for name in self._registered:
+ if self.is_available(name):
+ yield name
+
+ def list(self):
+ """Get a list of available MovieWriters."""
+ return [*self]
+
+ def __getitem__(self, name):
+ """Get an available writer class from its name."""
+ if self.is_available(name):
+ return self._registered[name]
+ raise RuntimeError(f"Requested MovieWriter ({name}) not available")
+
+
+writers = MovieWriterRegistry()
+
+
+class AbstractMovieWriter(abc.ABC):
+ """
+ Abstract base class for writing movies. Fundamentally, what a MovieWriter
+ does is provide is a way to grab frames by calling grab_frame().
+
+ setup() is called to start the process and finish() is called afterwards.
+
+ This class is set up to provide for writing movie frame data to a pipe.
+ saving() is provided as a context manager to facilitate this process as::
+
+ with moviewriter.saving(fig, outfile='myfile.mp4', dpi=100):
+ # Iterate over frames
+ moviewriter.grab_frame(**savefig_kwargs)
+
+ The use of the context manager ensures that setup() and finish() are
+ performed as necessary.
+
+ An instance of a concrete subclass of this class can be given as the
+ ``writer`` argument of `Animation.save()`.
+ """
+
+ def __init__(self, fps=5, metadata=None, codec=None, bitrate=None):
+ self.fps = fps
+ self.metadata = metadata if metadata is not None else {}
+ self.codec = (
+ mpl.rcParams['animation.codec'] if codec is None else codec)
+ self.bitrate = (
+ mpl.rcParams['animation.bitrate'] if bitrate is None else bitrate)
+
+ @abc.abstractmethod
+ def setup(self, fig, outfile, dpi=None):
+ """
+ Setup for writing the movie file.
+
+ Parameters
+ ----------
+ fig : `~matplotlib.figure.Figure`
+ The figure object that contains the information for frames.
+ outfile : str
+ The filename of the resulting movie file.
+ dpi : float, default: ``fig.dpi``
+ The DPI (or resolution) for the file. This controls the size
+ in pixels of the resulting movie file.
+ """
+ self.outfile = outfile
+ self.fig = fig
+ if dpi is None:
+ dpi = self.fig.dpi
+ self.dpi = dpi
+
+ @property
+ def frame_size(self):
+ """A tuple ``(width, height)`` in pixels of a movie frame."""
+ w, h = self.fig.get_size_inches()
+ return int(w * self.dpi), int(h * self.dpi)
+
+ @abc.abstractmethod
+ def grab_frame(self, **savefig_kwargs):
+ """
+ Grab the image information from the figure and save as a movie frame.
+
+ All keyword arguments in *savefig_kwargs* are passed on to the
+ `~.Figure.savefig` call that saves the figure.
+ """
+
+ @abc.abstractmethod
+ def finish(self):
+ """Finish any processing for writing the movie."""
+
+ @contextlib.contextmanager
+ def saving(self, fig, outfile, dpi, *args, **kwargs):
+ """
+ Context manager to facilitate writing the movie file.
+
+ ``*args, **kw`` are any parameters that should be passed to `setup`.
+ """
+ # This particular sequence is what contextlib.contextmanager wants
+ self.setup(fig, outfile, dpi, *args, **kwargs)
+ try:
+ yield self
+ finally:
+ self.finish()
+
+
+class MovieWriter(AbstractMovieWriter):
+ """
+ Base class for writing movies.
+
+ This is a base class for MovieWriter subclasses that write a movie frame
+ data to a pipe. You cannot instantiate this class directly.
+ See examples for how to use its subclasses.
+
+ Attributes
+ ----------
+ frame_format : str
+ The format used in writing frame data, defaults to 'rgba'.
+ fig : `~matplotlib.figure.Figure`
+ The figure to capture data from.
+ This must be provided by the sub-classes.
+ """
+
+ # Builtin writer subclasses additionally define the _exec_key and _args_key
+ # attributes, which indicate the rcParams entries where the path to the
+ # executable and additional command-line arguments to the executable are
+ # stored. Third-party writers cannot meaningfully set these as they cannot
+ # extend rcParams with new keys.
+
+ exec_key = _api.deprecate_privatize_attribute("3.3")
+ args_key = _api.deprecate_privatize_attribute("3.3")
+
+ # Pipe-based writers only support RGBA, but file-based ones support more
+ # formats.
+ supported_formats = ["rgba"]
+
+ def __init__(self, fps=5, codec=None, bitrate=None, extra_args=None,
+ metadata=None):
+ """
+ Parameters
+ ----------
+ fps : int, default: 5
+ Movie frame rate (per second).
+ codec : str or None, default: :rc:`animation.codec`
+ The codec to use.
+ bitrate : int, default: :rc:`animation.bitrate`
+ The bitrate of the movie, in kilobits per second. Higher values
+ means higher quality movies, but increase the file size. A value
+ of -1 lets the underlying movie encoder select the bitrate.
+ extra_args : list of str or None, optional
+ Extra command-line arguments passed to the underlying movie
+ encoder. The default, None, means to use
+ :rc:`animation.[name-of-encoder]_args` for the builtin writers.
+ metadata : dict[str, str], default: {}
+ A dictionary of keys and values for metadata to include in the
+ output file. Some keys that may be of use include:
+ title, artist, genre, subject, copyright, srcform, comment.
+ """
+ if type(self) is MovieWriter:
+ # TODO MovieWriter is still an abstract class and needs to be
+ # extended with a mixin. This should be clearer in naming
+ # and description. For now, just give a reasonable error
+ # message to users.
+ raise TypeError(
+ 'MovieWriter cannot be instantiated directly. Please use one '
+ 'of its subclasses.')
+
+ super().__init__(fps=fps, metadata=metadata, codec=codec,
+ bitrate=bitrate)
+ self.frame_format = self.supported_formats[0]
+ self.extra_args = extra_args
+
+ def _adjust_frame_size(self):
+ if self.codec == 'h264':
+ wo, ho = self.fig.get_size_inches()
+ w, h = adjusted_figsize(wo, ho, self.dpi, 2)
+ if (wo, ho) != (w, h):
+ self.fig.set_size_inches(w, h, forward=True)
+ _log.info('figure size in inches has been adjusted '
+ 'from %s x %s to %s x %s', wo, ho, w, h)
+ else:
+ w, h = self.fig.get_size_inches()
+ _log.debug('frame size in pixels is %s x %s', *self.frame_size)
+ return w, h
+
+ def setup(self, fig, outfile, dpi=None):
+ # docstring inherited
+ super().setup(fig, outfile, dpi=dpi)
+ self._w, self._h = self._adjust_frame_size()
+ # Run here so that grab_frame() can write the data to a pipe. This
+ # eliminates the need for temp files.
+ self._run()
+
+ def _run(self):
+ # Uses subprocess to call the program for assembling frames into a
+ # movie file. *args* returns the sequence of command line arguments
+ # from a few configuration options.
+ command = self._args()
+ _log.info('MovieWriter._run: running command: %s',
+ cbook._pformat_subprocess(command))
+ PIPE = subprocess.PIPE
+ self._proc = subprocess.Popen(
+ command, stdin=PIPE, stdout=PIPE, stderr=PIPE,
+ creationflags=subprocess_creation_flags)
+
+ def finish(self):
+ """Finish any processing for writing the movie."""
+ overridden_cleanup = _api.deprecate_method_override(
+ __class__.cleanup, self, since="3.4", alternative="finish()")
+ if overridden_cleanup is not None:
+ overridden_cleanup()
+ else:
+ self._cleanup() # Inline _cleanup() once cleanup() is removed.
+
+ def grab_frame(self, **savefig_kwargs):
+ # docstring inherited
+ _log.debug('MovieWriter.grab_frame: Grabbing frame.')
+ # Readjust the figure size in case it has been changed by the user.
+ # All frames must have the same size to save the movie correctly.
+ self.fig.set_size_inches(self._w, self._h)
+ # Save the figure data to the sink, using the frame format and dpi.
+ self.fig.savefig(self._proc.stdin, format=self.frame_format,
+ dpi=self.dpi, **savefig_kwargs)
+
+ def _args(self):
+ """Assemble list of encoder-specific command-line arguments."""
+ return NotImplementedError("args needs to be implemented by subclass.")
+
+ def _cleanup(self): # Inline to finish() once cleanup() is removed.
+ """Clean-up and collect the process used to write the movie file."""
+ out, err = self._proc.communicate()
+ # Use the encoding/errors that universal_newlines would use.
+ out = TextIOWrapper(BytesIO(out)).read()
+ err = TextIOWrapper(BytesIO(err)).read()
+ if out:
+ _log.log(
+ logging.WARNING if self._proc.returncode else logging.DEBUG,
+ "MovieWriter stdout:\n%s", out)
+ if err:
+ _log.log(
+ logging.WARNING if self._proc.returncode else logging.DEBUG,
+ "MovieWriter stderr:\n%s", err)
+ if self._proc.returncode:
+ raise subprocess.CalledProcessError(
+ self._proc.returncode, self._proc.args, out, err)
+
+ @_api.deprecated("3.4")
+ def cleanup(self):
+ self._cleanup()
+
+ @classmethod
+ def bin_path(cls):
+ """
+ Return the binary path to the commandline tool used by a specific
+ subclass. This is a class method so that the tool can be looked for
+ before making a particular MovieWriter subclass available.
+ """
+ return str(mpl.rcParams[cls._exec_key])
+
+ @classmethod
+ def isAvailable(cls):
+ """Return whether a MovieWriter subclass is actually available."""
+ return shutil.which(cls.bin_path()) is not None
+
+
+class FileMovieWriter(MovieWriter):
+ """
+ `MovieWriter` for writing to individual files and stitching at the end.
+
+ This must be sub-classed to be useful.
+ """
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.frame_format = mpl.rcParams['animation.frame_format']
+
+ @_api.delete_parameter("3.3", "clear_temp")
+ def setup(self, fig, outfile, dpi=None, frame_prefix=None,
+ clear_temp=True):
+ """
+ Setup for writing the movie file.
+
+ Parameters
+ ----------
+ fig : `~matplotlib.figure.Figure`
+ The figure to grab the rendered frames from.
+ outfile : str
+ The filename of the resulting movie file.
+ dpi : float, default: ``fig.dpi``
+ The dpi of the output file. This, with the figure size,
+ controls the size in pixels of the resulting movie file.
+ frame_prefix : str, optional
+ The filename prefix to use for temporary files. If None (the
+ default), files are written to a temporary directory which is
+ deleted by `cleanup` (regardless of the value of *clear_temp*).
+ clear_temp : bool, optional
+ If the temporary files should be deleted after stitching
+ the final result. Setting this to ``False`` can be useful for
+ debugging. Defaults to ``True``.
+ """
+ self.fig = fig
+ self.outfile = outfile
+ if dpi is None:
+ dpi = self.fig.dpi
+ self.dpi = dpi
+ self._adjust_frame_size()
+
+ if frame_prefix is None:
+ self._tmpdir = TemporaryDirectory()
+ self.temp_prefix = str(Path(self._tmpdir.name, 'tmp'))
+ else:
+ self._tmpdir = None
+ self.temp_prefix = frame_prefix
+ self._clear_temp = clear_temp
+ self._frame_counter = 0 # used for generating sequential file names
+ self._temp_paths = list()
+ self.fname_format_str = '%s%%07d.%s'
+
+ def __del__(self):
+ if self._tmpdir:
+ self._tmpdir.cleanup()
+
+ @_api.deprecated("3.3")
+ @property
+ def clear_temp(self):
+ return self._clear_temp
+
+ @clear_temp.setter
+ def clear_temp(self, value):
+ self._clear_temp = value
+
+ @property
+ def frame_format(self):
+ """
+ Format (png, jpeg, etc.) to use for saving the frames, which can be
+ decided by the individual subclasses.
+ """
+ return self._frame_format
+
+ @frame_format.setter
+ def frame_format(self, frame_format):
+ if frame_format in self.supported_formats:
+ self._frame_format = frame_format
+ else:
+ _api.warn_external(
+ f"Ignoring file format {frame_format!r} which is not "
+ f"supported by {type(self).__name__}; using "
+ f"{self.supported_formats[0]} instead.")
+ self._frame_format = self.supported_formats[0]
+
+ def _base_temp_name(self):
+ # Generates a template name (without number) given the frame format
+ # for extension and the prefix.
+ return self.fname_format_str % (self.temp_prefix, self.frame_format)
+
+ def grab_frame(self, **savefig_kwargs):
+ # docstring inherited
+ # Overloaded to explicitly close temp file.
+ # Creates a filename for saving using basename and counter.
+ path = Path(self._base_temp_name() % self._frame_counter)
+ self._temp_paths.append(path) # Record the filename for later cleanup.
+ self._frame_counter += 1 # Ensures each created name is unique.
+ _log.debug('FileMovieWriter.grab_frame: Grabbing frame %d to path=%s',
+ self._frame_counter, path)
+ with open(path, 'wb') as sink: # Save figure to the sink.
+ self.fig.savefig(sink, format=self.frame_format, dpi=self.dpi,
+ **savefig_kwargs)
+
+ def finish(self):
+ # Call run here now that all frame grabbing is done. All temp files
+ # are available to be assembled.
+ self._run()
+ super().finish() # Will call clean-up
+
+ def _cleanup(self): # Inline to finish() once cleanup() is removed.
+ super()._cleanup()
+ if self._tmpdir:
+ _log.debug('MovieWriter: clearing temporary path=%s', self._tmpdir)
+ self._tmpdir.cleanup()
+ else:
+ if self._clear_temp:
+ _log.debug('MovieWriter: clearing temporary paths=%s',
+ self._temp_paths)
+ for path in self._temp_paths:
+ path.unlink()
+
+
+@writers.register('pillow')
+class PillowWriter(AbstractMovieWriter):
+ @classmethod
+ def isAvailable(cls):
+ return True
+
+ def setup(self, fig, outfile, dpi=None):
+ super().setup(fig, outfile, dpi=dpi)
+ self._frames = []
+
+ def grab_frame(self, **savefig_kwargs):
+ buf = BytesIO()
+ self.fig.savefig(
+ buf, **{**savefig_kwargs, "format": "rgba", "dpi": self.dpi})
+ renderer = self.fig.canvas.get_renderer()
+ self._frames.append(Image.frombuffer(
+ "RGBA", self.frame_size, buf.getbuffer(), "raw", "RGBA", 0, 1))
+
+ def finish(self):
+ self._frames[0].save(
+ self.outfile, save_all=True, append_images=self._frames[1:],
+ duration=int(1000 / self.fps), loop=0)
+
+
+# Base class of ffmpeg information. Has the config keys and the common set
+# of arguments that controls the *output* side of things.
+class FFMpegBase:
+ """
+ Mixin class for FFMpeg output.
+
+ To be useful this must be multiply-inherited from with a
+ `MovieWriterBase` sub-class.
+ """
+
+ _exec_key = 'animation.ffmpeg_path'
+ _args_key = 'animation.ffmpeg_args'
+
+ @property
+ def output_args(self):
+ args = []
+ if Path(self.outfile).suffix == '.gif':
+ self.codec = 'gif'
+ else:
+ args.extend(['-vcodec', self.codec])
+ extra_args = (self.extra_args if self.extra_args is not None
+ else mpl.rcParams[self._args_key])
+ # For h264, the default format is yuv444p, which is not compatible
+ # with quicktime (and others). Specifying yuv420p fixes playback on
+ # iOS, as well as HTML5 video in firefox and safari (on both Win and
+ # OSX). Also fixes internet explorer. This is as of 2015/10/29.
+ if self.codec == 'h264' and '-pix_fmt' not in extra_args:
+ args.extend(['-pix_fmt', 'yuv420p'])
+ # For GIF, we're telling FFMPEG to split the video stream, to generate
+ # a palette, and then use it for encoding.
+ elif self.codec == 'gif' and '-filter_complex' not in extra_args:
+ args.extend(['-filter_complex',
+ 'split [a][b];[a] palettegen [p];[b][p] paletteuse'])
+ if self.bitrate > 0:
+ args.extend(['-b', '%dk' % self.bitrate]) # %dk: bitrate in kbps.
+ args.extend(extra_args)
+ for k, v in self.metadata.items():
+ args.extend(['-metadata', '%s=%s' % (k, v)])
+
+ return args + ['-y', self.outfile]
+
+ @classmethod
+ def isAvailable(cls):
+ return (
+ super().isAvailable()
+ # Ubuntu 12.04 ships a broken ffmpeg binary which we shouldn't use.
+ # NOTE: when removed, remove the same method in AVConvBase.
+ and b'LibAv' not in subprocess.run(
+ [cls.bin_path()], creationflags=subprocess_creation_flags,
+ stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
+ stderr=subprocess.PIPE).stderr)
+
+
+# Combine FFMpeg options with pipe-based writing
+@writers.register('ffmpeg')
+class FFMpegWriter(FFMpegBase, MovieWriter):
+ """
+ Pipe-based ffmpeg writer.
+
+ Frames are streamed directly to ffmpeg via a pipe and written in a single
+ pass.
+ """
+ def _args(self):
+ # Returns the command line parameters for subprocess to use
+ # ffmpeg to create a movie using a pipe.
+ args = [self.bin_path(), '-f', 'rawvideo', '-vcodec', 'rawvideo',
+ '-s', '%dx%d' % self.frame_size, '-pix_fmt', self.frame_format,
+ '-r', str(self.fps)]
+ # Logging is quieted because subprocess.PIPE has limited buffer size.
+ # If you have a lot of frames in your animation and set logging to
+ # DEBUG, you will have a buffer overrun.
+ if _log.getEffectiveLevel() > logging.DEBUG:
+ args += ['-loglevel', 'error']
+ args += ['-i', 'pipe:'] + self.output_args
+ return args
+
+
+# Combine FFMpeg options with temp file-based writing
+@writers.register('ffmpeg_file')
+class FFMpegFileWriter(FFMpegBase, FileMovieWriter):
+ """
+ File-based ffmpeg writer.
+
+ Frames are written to temporary files on disk and then stitched
+ together at the end.
+ """
+ supported_formats = ['png', 'jpeg', 'tiff', 'raw', 'rgba']
+
+ def _args(self):
+ # Returns the command line parameters for subprocess to use
+ # ffmpeg to create a movie using a collection of temp images
+ args = []
+ # For raw frames, we need to explicitly tell ffmpeg the metadata.
+ if self.frame_format in {'raw', 'rgba'}:
+ args += [
+ '-f', 'image2', '-vcodec', 'rawvideo',
+ '-video_size', '%dx%d' % self.frame_size,
+ '-pixel_format', 'rgba',
+ '-framerate', str(self.fps),
+ ]
+ args += ['-r', str(self.fps), '-i', self._base_temp_name(),
+ '-vframes', str(self._frame_counter)]
+ # Logging is quieted because subprocess.PIPE has limited buffer size.
+ # If you have a lot of frames in your animation and set logging to
+ # DEBUG, you will have a buffer overrun.
+ if _log.getEffectiveLevel() > logging.DEBUG:
+ args += ['-loglevel', 'error']
+ return [self.bin_path(), *args, *self.output_args]
+
+
+# Base class of avconv information. AVConv has identical arguments to FFMpeg.
+@_api.deprecated('3.3')
+class AVConvBase(FFMpegBase):
+ """
+ Mixin class for avconv output.
+
+ To be useful this must be multiply-inherited from with a
+ `MovieWriterBase` sub-class.
+ """
+
+ _exec_key = 'animation.avconv_path'
+ _args_key = 'animation.avconv_args'
+
+ # NOTE : should be removed when the same method is removed in FFMpegBase.
+ isAvailable = classmethod(MovieWriter.isAvailable.__func__)
+
+
+# Combine AVConv options with pipe-based writing
+@writers.register('avconv')
+class AVConvWriter(AVConvBase, FFMpegWriter):
+ """
+ Pipe-based avconv writer.
+
+ Frames are streamed directly to avconv via a pipe and written in a single
+ pass.
+ """
+
+
+# Combine AVConv options with file-based writing
+@writers.register('avconv_file')
+class AVConvFileWriter(AVConvBase, FFMpegFileWriter):
+ """
+ File-based avconv writer.
+
+ Frames are written to temporary files on disk and then stitched
+ together at the end.
+ """
+
+
+# Base class for animated GIFs with ImageMagick
+class ImageMagickBase:
+ """
+ Mixin class for ImageMagick output.
+
+ To be useful this must be multiply-inherited from with a
+ `MovieWriterBase` sub-class.
+ """
+
+ _exec_key = 'animation.convert_path'
+ _args_key = 'animation.convert_args'
+
+ @property
+ def delay(self):
+ return 100. / self.fps
+
+ @property
+ def output_args(self):
+ extra_args = (self.extra_args if self.extra_args is not None
+ else mpl.rcParams[self._args_key])
+ return [*extra_args, self.outfile]
+
+ @classmethod
+ def bin_path(cls):
+ binpath = super().bin_path()
+ if binpath == 'convert':
+ binpath = mpl._get_executable_info('magick').executable
+ return binpath
+
+ @classmethod
+ def isAvailable(cls):
+ try:
+ return super().isAvailable()
+ except mpl.ExecutableNotFoundError as _enf:
+ # May be raised by get_executable_info.
+ _log.debug('ImageMagick unavailable due to: %s', _enf)
+ return False
+
+
+# Combine ImageMagick options with pipe-based writing
+@writers.register('imagemagick')
+class ImageMagickWriter(ImageMagickBase, MovieWriter):
+ """
+ Pipe-based animated gif.
+
+ Frames are streamed directly to ImageMagick via a pipe and written
+ in a single pass.
+
+ """
+ def _args(self):
+ return ([self.bin_path(),
+ '-size', '%ix%i' % self.frame_size, '-depth', '8',
+ '-delay', str(self.delay), '-loop', '0',
+ '%s:-' % self.frame_format]
+ + self.output_args)
+
+
+# Combine ImageMagick options with temp file-based writing
+@writers.register('imagemagick_file')
+class ImageMagickFileWriter(ImageMagickBase, FileMovieWriter):
+ """
+ File-based animated gif writer.
+
+ Frames are written to temporary files on disk and then stitched
+ together at the end.
+ """
+
+ supported_formats = ['png', 'jpeg', 'tiff', 'raw', 'rgba']
+
+ def _args(self):
+ # Force format: ImageMagick does not recognize 'raw'.
+ fmt = 'rgba:' if self.frame_format == 'raw' else ''
+ return ([self.bin_path(),
+ '-size', '%ix%i' % self.frame_size, '-depth', '8',
+ '-delay', str(self.delay), '-loop', '0',
+ '%s%s*.%s' % (fmt, self.temp_prefix, self.frame_format)]
+ + self.output_args)
+
+
+# Taken directly from jakevdp's JSAnimation package at
+# http://github.com/jakevdp/JSAnimation
+def _included_frames(paths, frame_format):
+ """paths should be a list of Paths"""
+ return INCLUDED_FRAMES.format(Nframes=len(paths),
+ frame_dir=paths[0].parent,
+ frame_format=frame_format)
+
+
+def _embedded_frames(frame_list, frame_format):
+ """frame_list should be a list of base64-encoded png files"""
+ if frame_format == 'svg':
+ # Fix MIME type for svg
+ frame_format = 'svg+xml'
+ template = ' frames[{0}] = "data:image/{1};base64,{2}"\n'
+ return "\n" + "".join(
+ template.format(i, frame_format, frame_data.replace('\n', '\\\n'))
+ for i, frame_data in enumerate(frame_list))
+
+
+@writers.register('html')
+class HTMLWriter(FileMovieWriter):
+ """Writer for JavaScript-based HTML movies."""
+
+ supported_formats = ['png', 'jpeg', 'tiff', 'svg']
+ args_key = _api.deprecated("3.3")(property(
+ lambda self: 'animation.html_args'))
+
+ @classmethod
+ def isAvailable(cls):
+ return True
+
+ def __init__(self, fps=30, codec=None, bitrate=None, extra_args=None,
+ metadata=None, embed_frames=False, default_mode='loop',
+ embed_limit=None):
+
+ if extra_args:
+ _log.warning("HTMLWriter ignores 'extra_args'")
+ extra_args = () # Don't lookup nonexistent rcParam[args_key].
+ self.embed_frames = embed_frames
+ self.default_mode = default_mode.lower()
+ _api.check_in_list(['loop', 'once', 'reflect'],
+ default_mode=self.default_mode)
+
+ # Save embed limit, which is given in MB
+ if embed_limit is None:
+ self._bytes_limit = mpl.rcParams['animation.embed_limit']
+ else:
+ self._bytes_limit = embed_limit
+ # Convert from MB to bytes
+ self._bytes_limit *= 1024 * 1024
+
+ super().__init__(fps, codec, bitrate, extra_args, metadata)
+
+ def setup(self, fig, outfile, dpi, frame_dir=None):
+ outfile = Path(outfile)
+ _api.check_in_list(['.html', '.htm'], outfile_extension=outfile.suffix)
+
+ self._saved_frames = []
+ self._total_bytes = 0
+ self._hit_limit = False
+
+ if not self.embed_frames:
+ if frame_dir is None:
+ frame_dir = outfile.with_name(outfile.stem + '_frames')
+ frame_dir.mkdir(parents=True, exist_ok=True)
+ frame_prefix = frame_dir / 'frame'
+ else:
+ frame_prefix = None
+
+ super().setup(fig, outfile, dpi, frame_prefix)
+ self._clear_temp = False
+
+ def grab_frame(self, **savefig_kwargs):
+ if self.embed_frames:
+ # Just stop processing if we hit the limit
+ if self._hit_limit:
+ return
+ f = BytesIO()
+ self.fig.savefig(f, format=self.frame_format,
+ dpi=self.dpi, **savefig_kwargs)
+ imgdata64 = base64.encodebytes(f.getvalue()).decode('ascii')
+ self._total_bytes += len(imgdata64)
+ if self._total_bytes >= self._bytes_limit:
+ _log.warning(
+ "Animation size has reached %s bytes, exceeding the limit "
+ "of %s. If you're sure you want a larger animation "
+ "embedded, set the animation.embed_limit rc parameter to "
+ "a larger value (in MB). This and further frames will be "
+ "dropped.", self._total_bytes, self._bytes_limit)
+ self._hit_limit = True
+ else:
+ self._saved_frames.append(imgdata64)
+ else:
+ return super().grab_frame(**savefig_kwargs)
+
+ def finish(self):
+ # save the frames to an html file
+ if self.embed_frames:
+ fill_frames = _embedded_frames(self._saved_frames,
+ self.frame_format)
+ Nframes = len(self._saved_frames)
+ else:
+ # temp names is filled by FileMovieWriter
+ fill_frames = _included_frames(self._temp_paths, self.frame_format)
+ Nframes = len(self._temp_paths)
+ mode_dict = dict(once_checked='',
+ loop_checked='',
+ reflect_checked='')
+ mode_dict[self.default_mode + '_checked'] = 'checked'
+
+ interval = 1000 // self.fps
+
+ with open(self.outfile, 'w') as of:
+ of.write(JS_INCLUDE + STYLE_INCLUDE)
+ of.write(DISPLAY_TEMPLATE.format(id=uuid.uuid4().hex,
+ Nframes=Nframes,
+ fill_frames=fill_frames,
+ interval=interval,
+ **mode_dict))
+
+ # duplicate the temporary file clean up logic from
+ # FileMovieWriter.cleanup. We can not call the inherited
+ # versions of finished or cleanup because both assume that
+ # there is a subprocess that we either need to call to merge
+ # many frames together or that there is a subprocess call that
+ # we need to clean up.
+ if self._tmpdir:
+ _log.debug('MovieWriter: clearing temporary path=%s', self._tmpdir)
+ self._tmpdir.cleanup()
+ else:
+ if self._clear_temp:
+ _log.debug('MovieWriter: clearing temporary paths=%s',
+ self._temp_paths)
+ for path in self._temp_paths:
+ path.unlink()
+
+
+class Animation:
+ """
+ A base class for Animations.
+
+ This class is not usable as is, and should be subclassed to provide needed
+ behavior.
+
+ .. note::
+
+ You must store the created Animation in a variable that lives as long
+ as the animation should run. Otherwise, the Animation object will be
+ garbage-collected and the animation stops.
+
+ Parameters
+ ----------
+ fig : `~matplotlib.figure.Figure`
+ The figure object used to get needed events, such as draw or resize.
+
+ event_source : object, optional
+ A class that can run a callback when desired events
+ are generated, as well as be stopped and started.
+
+ Examples include timers (see `TimedAnimation`) and file
+ system notifications.
+
+ blit : bool, default: False
+ Whether blitting is used to optimize drawing.
+
+ See Also
+ --------
+ FuncAnimation, ArtistAnimation
+ """
+
+ def __init__(self, fig, event_source=None, blit=False):
+ self._draw_was_started = False
+
+ self._fig = fig
+ # Disables blitting for backends that don't support it. This
+ # allows users to request it if available, but still have a
+ # fallback that works if it is not.
+ self._blit = blit and fig.canvas.supports_blit
+
+ # These are the basics of the animation. The frame sequence represents
+ # information for each frame of the animation and depends on how the
+ # drawing is handled by the subclasses. The event source fires events
+ # that cause the frame sequence to be iterated.
+ self.frame_seq = self.new_frame_seq()
+ self.event_source = event_source
+
+ # Instead of starting the event source now, we connect to the figure's
+ # draw_event, so that we only start once the figure has been drawn.
+ self._first_draw_id = fig.canvas.mpl_connect('draw_event', self._start)
+
+ # Connect to the figure's close_event so that we don't continue to
+ # fire events and try to draw to a deleted figure.
+ self._close_id = self._fig.canvas.mpl_connect('close_event',
+ self._stop)
+ if self._blit:
+ self._setup_blit()
+
+ def __del__(self):
+ if not getattr(self, '_draw_was_started', True):
+ warnings.warn(
+ 'Animation was deleted without rendering anything. This is '
+ 'most likely unintended. To prevent deletion, assign the '
+ 'Animation to a variable that exists for as long as you need '
+ 'the Animation.')
+
+ def _start(self, *args):
+ """
+ Starts interactive animation. Adds the draw frame command to the GUI
+ handler, calls show to start the event loop.
+ """
+ # Do not start the event source if saving() it.
+ if self._fig.canvas.is_saving():
+ return
+ # First disconnect our draw event handler
+ self._fig.canvas.mpl_disconnect(self._first_draw_id)
+
+ # Now do any initial draw
+ self._init_draw()
+
+ # Add our callback for stepping the animation and
+ # actually start the event_source.
+ self.event_source.add_callback(self._step)
+ self.event_source.start()
+
+ def _stop(self, *args):
+ # On stop we disconnect all of our events.
+ if self._blit:
+ self._fig.canvas.mpl_disconnect(self._resize_id)
+ self._fig.canvas.mpl_disconnect(self._close_id)
+ self.event_source.remove_callback(self._step)
+ self.event_source = None
+
+ def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
+ bitrate=None, extra_args=None, metadata=None, extra_anim=None,
+ savefig_kwargs=None, *, progress_callback=None):
+ """
+ Save the animation as a movie file by drawing every frame.
+
+ Parameters
+ ----------
+ filename : str
+ The output filename, e.g., :file:`mymovie.mp4`.
+
+ writer : `MovieWriter` or str, default: :rc:`animation.writer`
+ A `MovieWriter` instance to use or a key that identifies a
+ class to use, such as 'ffmpeg'.
+
+ fps : int, optional
+ Movie frame rate (per second). If not set, the frame rate from the
+ animation's frame interval.
+
+ dpi : float, default: :rc:`savefig.dpi`
+ Controls the dots per inch for the movie frames. Together with
+ the figure's size in inches, this controls the size of the movie.
+
+ codec : str, default: :rc:`animation.codec`.
+ The video codec to use. Not all codecs are supported by a given
+ `MovieWriter`.
+
+ bitrate : int, default: :rc:`animation.bitrate`
+ The bitrate of the movie, in kilobits per second. Higher values
+ means higher quality movies, but increase the file size. A value
+ of -1 lets the underlying movie encoder select the bitrate.
+
+ extra_args : list of str or None, optional
+ Extra command-line arguments passed to the underlying movie
+ encoder. The default, None, means to use
+ :rc:`animation.[name-of-encoder]_args` for the builtin writers.
+
+ metadata : dict[str, str], default: {}
+ Dictionary of keys and values for metadata to include in
+ the output file. Some keys that may be of use include:
+ title, artist, genre, subject, copyright, srcform, comment.
+
+ extra_anim : list, default: []
+ Additional `Animation` objects that should be included
+ in the saved movie file. These need to be from the same
+ `matplotlib.figure.Figure` instance. Also, animation frames will
+ just be simply combined, so there should be a 1:1 correspondence
+ between the frames from the different animations.
+
+ savefig_kwargs : dict, default: {}
+ Keyword arguments passed to each `~.Figure.savefig` call used to
+ save the individual frames.
+
+ progress_callback : function, optional
+ A callback function that will be called for every frame to notify
+ the saving progress. It must have the signature ::
+
+ def func(current_frame: int, total_frames: int) -> Any
+
+ where *current_frame* is the current frame number and
+ *total_frames* is the total number of frames to be saved.
+ *total_frames* is set to None, if the total number of frames can
+ not be determined. Return values may exist but are ignored.
+
+ Example code to write the progress to stdout::
+
+ progress_callback =\
+ lambda i, n: print(f'Saving frame {i} of {n}')
+
+ Notes
+ -----
+ *fps*, *codec*, *bitrate*, *extra_args* and *metadata* are used to
+ construct a `.MovieWriter` instance and can only be passed if
+ *writer* is a string. If they are passed as non-*None* and *writer*
+ is a `.MovieWriter`, a `RuntimeError` will be raised.
+ """
+
+ if writer is None:
+ writer = mpl.rcParams['animation.writer']
+ elif (not isinstance(writer, str) and
+ any(arg is not None
+ for arg in (fps, codec, bitrate, extra_args, metadata))):
+ raise RuntimeError('Passing in values for arguments '
+ 'fps, codec, bitrate, extra_args, or metadata '
+ 'is not supported when writer is an existing '
+ 'MovieWriter instance. These should instead be '
+ 'passed as arguments when creating the '
+ 'MovieWriter instance.')
+
+ if savefig_kwargs is None:
+ savefig_kwargs = {}
+
+ if fps is None and hasattr(self, '_interval'):
+ # Convert interval in ms to frames per second
+ fps = 1000. / self._interval
+
+ # Re-use the savefig DPI for ours if none is given
+ if dpi is None:
+ dpi = mpl.rcParams['savefig.dpi']
+ if dpi == 'figure':
+ dpi = self._fig.dpi
+
+ writer_kwargs = {}
+ if codec is not None:
+ writer_kwargs['codec'] = codec
+ if bitrate is not None:
+ writer_kwargs['bitrate'] = bitrate
+ if extra_args is not None:
+ writer_kwargs['extra_args'] = extra_args
+ if metadata is not None:
+ writer_kwargs['metadata'] = metadata
+
+ all_anim = [self]
+ if extra_anim is not None:
+ all_anim.extend(anim
+ for anim
+ in extra_anim if anim._fig is self._fig)
+
+ # If we have the name of a writer, instantiate an instance of the
+ # registered class.
+ if isinstance(writer, str):
+ try:
+ writer_cls = writers[writer]
+ except RuntimeError: # Raised if not available.
+ writer_cls = PillowWriter # Always available.
+ _log.warning("MovieWriter %s unavailable; using Pillow "
+ "instead.", writer)
+ writer = writer_cls(fps, **writer_kwargs)
+ _log.info('Animation.save using %s', type(writer))
+
+ if 'bbox_inches' in savefig_kwargs:
+ _log.warning("Warning: discarding the 'bbox_inches' argument in "
+ "'savefig_kwargs' as it may cause frame size "
+ "to vary, which is inappropriate for animation.")
+ savefig_kwargs.pop('bbox_inches')
+
+ # Create a new sequence of frames for saved data. This is different
+ # from new_frame_seq() to give the ability to save 'live' generated
+ # frame information to be saved later.
+ # TODO: Right now, after closing the figure, saving a movie won't work
+ # since GUI widgets are gone. Either need to remove extra code to
+ # allow for this non-existent use case or find a way to make it work.
+ if mpl.rcParams['savefig.bbox'] == 'tight':
+ _log.info("Disabling savefig.bbox = 'tight', as it may cause "
+ "frame size to vary, which is inappropriate for "
+ "animation.")
+ # canvas._is_saving = True makes the draw_event animation-starting
+ # callback a no-op; canvas.manager = None prevents resizing the GUI
+ # widget (both are likewise done in savefig()).
+ with mpl.rc_context({'savefig.bbox': None}), \
+ writer.saving(self._fig, filename, dpi), \
+ cbook._setattr_cm(self._fig.canvas,
+ _is_saving=True, manager=None):
+ for anim in all_anim:
+ anim._init_draw() # Clear the initial frame
+ frame_number = 0
+ # TODO: Currently only FuncAnimation has a save_count
+ # attribute. Can we generalize this to all Animations?
+ save_count_list = [getattr(a, 'save_count', None)
+ for a in all_anim]
+ if None in save_count_list:
+ total_frames = None
+ else:
+ total_frames = sum(save_count_list)
+ for data in zip(*[a.new_saved_frame_seq() for a in all_anim]):
+ for anim, d in zip(all_anim, data):
+ # TODO: See if turning off blit is really necessary
+ anim._draw_next_frame(d, blit=False)
+ if progress_callback is not None:
+ progress_callback(frame_number, total_frames)
+ frame_number += 1
+ writer.grab_frame(**savefig_kwargs)
+
+ def _step(self, *args):
+ """
+ Handler for getting events. By default, gets the next frame in the
+ sequence and hands the data off to be drawn.
+ """
+ # Returns True to indicate that the event source should continue to
+ # call _step, until the frame sequence reaches the end of iteration,
+ # at which point False will be returned.
+ try:
+ framedata = next(self.frame_seq)
+ self._draw_next_frame(framedata, self._blit)
+ return True
+ except StopIteration:
+ return False
+
+ def new_frame_seq(self):
+ """Return a new sequence of frame information."""
+ # Default implementation is just an iterator over self._framedata
+ return iter(self._framedata)
+
+ def new_saved_frame_seq(self):
+ """Return a new sequence of saved/cached frame information."""
+ # Default is the same as the regular frame sequence
+ return self.new_frame_seq()
+
+ def _draw_next_frame(self, framedata, blit):
+ # Breaks down the drawing of the next frame into steps of pre- and
+ # post- draw, as well as the drawing of the frame itself.
+ self._pre_draw(framedata, blit)
+ self._draw_frame(framedata)
+ self._post_draw(framedata, blit)
+
+ def _init_draw(self):
+ # Initial draw to clear the frame. Also used by the blitting code
+ # when a clean base is required.
+ self._draw_was_started = True
+
+ def _pre_draw(self, framedata, blit):
+ # Perform any cleaning or whatnot before the drawing of the frame.
+ # This default implementation allows blit to clear the frame.
+ if blit:
+ self._blit_clear(self._drawn_artists)
+
+ def _draw_frame(self, framedata):
+ # Performs actual drawing of the frame.
+ raise NotImplementedError('Needs to be implemented by subclasses to'
+ ' actually make an animation.')
+
+ def _post_draw(self, framedata, blit):
+ # After the frame is rendered, this handles the actual flushing of
+ # the draw, which can be a direct draw_idle() or make use of the
+ # blitting.
+ if blit and self._drawn_artists:
+ self._blit_draw(self._drawn_artists)
+ else:
+ self._fig.canvas.draw_idle()
+
+ # The rest of the code in this class is to facilitate easy blitting
+ def _blit_draw(self, artists):
+ # Handles blitted drawing, which renders only the artists given instead
+ # of the entire figure.
+ updated_ax = {a.axes for a in artists}
+ # Enumerate artists to cache axes' backgrounds. We do not draw
+ # artists yet to not cache foreground from plots with shared axes
+ for ax in updated_ax:
+ # If we haven't cached the background for the current view of this
+ # axes object, do so now. This might not always be reliable, but
+ # it's an attempt to automate the process.
+ cur_view = ax._get_view()
+ view, bg = self._blit_cache.get(ax, (object(), None))
+ if cur_view != view:
+ self._blit_cache[ax] = (
+ cur_view, ax.figure.canvas.copy_from_bbox(ax.bbox))
+ # Make a separate pass to draw foreground.
+ for a in artists:
+ a.axes.draw_artist(a)
+ # After rendering all the needed artists, blit each axes individually.
+ for ax in updated_ax:
+ ax.figure.canvas.blit(ax.bbox)
+
+ def _blit_clear(self, artists):
+ # Get a list of the axes that need clearing from the artists that
+ # have been drawn. Grab the appropriate saved background from the
+ # cache and restore.
+ axes = {a.axes for a in artists}
+ for ax in axes:
+ try:
+ view, bg = self._blit_cache[ax]
+ except KeyError:
+ continue
+ if ax._get_view() == view:
+ ax.figure.canvas.restore_region(bg)
+ else:
+ self._blit_cache.pop(ax)
+
+ def _setup_blit(self):
+ # Setting up the blit requires: a cache of the background for the
+ # axes
+ self._blit_cache = dict()
+ self._drawn_artists = []
+ self._resize_id = self._fig.canvas.mpl_connect('resize_event',
+ self._on_resize)
+ self._post_draw(None, self._blit)
+
+ def _on_resize(self, event):
+ # On resize, we need to disable the resize event handling so we don't
+ # get too many events. Also stop the animation events, so that
+ # we're paused. Reset the cache and re-init. Set up an event handler
+ # to catch once the draw has actually taken place.
+ self._fig.canvas.mpl_disconnect(self._resize_id)
+ self.event_source.stop()
+ self._blit_cache.clear()
+ self._init_draw()
+ self._resize_id = self._fig.canvas.mpl_connect('draw_event',
+ self._end_redraw)
+
+ def _end_redraw(self, event):
+ # Now that the redraw has happened, do the post draw flushing and
+ # blit handling. Then re-enable all of the original events.
+ self._post_draw(None, False)
+ self.event_source.start()
+ self._fig.canvas.mpl_disconnect(self._resize_id)
+ self._resize_id = self._fig.canvas.mpl_connect('resize_event',
+ self._on_resize)
+
+ def to_html5_video(self, embed_limit=None):
+ """
+ Convert the animation to an HTML5 ```` tag.
+
+ This saves the animation as an h264 video, encoded in base64
+ directly into the HTML5 video tag. This respects :rc:`animation.writer`
+ and :rc:`animation.bitrate`. This also makes use of the
+ ``interval`` to control the speed, and uses the ``repeat``
+ parameter to decide whether to loop.
+
+ Parameters
+ ----------
+ embed_limit : float, optional
+ Limit, in MB, of the returned animation. No animation is created
+ if the limit is exceeded.
+ Defaults to :rc:`animation.embed_limit` = 20.0.
+
+ Returns
+ -------
+ str
+ An HTML5 video tag with the animation embedded as base64 encoded
+ h264 video.
+ If the *embed_limit* is exceeded, this returns the string
+ "Video too large to embed."
+ """
+ VIDEO_TAG = r'''
+
+ Your browser does not support the video tag.
+ '''
+ # Cache the rendering of the video as HTML
+ if not hasattr(self, '_base64_video'):
+ # Save embed limit, which is given in MB
+ if embed_limit is None:
+ embed_limit = mpl.rcParams['animation.embed_limit']
+
+ # Convert from MB to bytes
+ embed_limit *= 1024 * 1024
+
+ # Can't open a NamedTemporaryFile twice on Windows, so use a
+ # TemporaryDirectory instead.
+ with TemporaryDirectory() as tmpdir:
+ path = Path(tmpdir, "temp.m4v")
+ # We create a writer manually so that we can get the
+ # appropriate size for the tag
+ Writer = writers[mpl.rcParams['animation.writer']]
+ writer = Writer(codec='h264',
+ bitrate=mpl.rcParams['animation.bitrate'],
+ fps=1000. / self._interval)
+ self.save(str(path), writer=writer)
+ # Now open and base64 encode.
+ vid64 = base64.encodebytes(path.read_bytes())
+
+ vid_len = len(vid64)
+ if vid_len >= embed_limit:
+ _log.warning(
+ "Animation movie is %s bytes, exceeding the limit of %s. "
+ "If you're sure you want a large animation embedded, set "
+ "the animation.embed_limit rc parameter to a larger value "
+ "(in MB).", vid_len, embed_limit)
+ else:
+ self._base64_video = vid64.decode('ascii')
+ self._video_size = 'width="{}" height="{}"'.format(
+ *writer.frame_size)
+
+ # If we exceeded the size, this attribute won't exist
+ if hasattr(self, '_base64_video'):
+ # Default HTML5 options are to autoplay and display video controls
+ options = ['controls', 'autoplay']
+
+ # If we're set to repeat, make it loop
+ if hasattr(self, 'repeat') and self.repeat:
+ options.append('loop')
+
+ return VIDEO_TAG.format(video=self._base64_video,
+ size=self._video_size,
+ options=' '.join(options))
+ else:
+ return 'Video too large to embed.'
+
+ def to_jshtml(self, fps=None, embed_frames=True, default_mode=None):
+ """Generate HTML representation of the animation"""
+ if fps is None and hasattr(self, '_interval'):
+ # Convert interval in ms to frames per second
+ fps = 1000 / self._interval
+
+ # If we're not given a default mode, choose one base on the value of
+ # the repeat attribute
+ if default_mode is None:
+ default_mode = 'loop' if self.repeat else 'once'
+
+ if not hasattr(self, "_html_representation"):
+ # Can't open a NamedTemporaryFile twice on Windows, so use a
+ # TemporaryDirectory instead.
+ with TemporaryDirectory() as tmpdir:
+ path = Path(tmpdir, "temp.html")
+ writer = HTMLWriter(fps=fps,
+ embed_frames=embed_frames,
+ default_mode=default_mode)
+ self.save(str(path), writer=writer)
+ self._html_representation = path.read_text()
+
+ return self._html_representation
+
+ def _repr_html_(self):
+ """IPython display hook for rendering."""
+ fmt = mpl.rcParams['animation.html']
+ if fmt == 'html5':
+ return self.to_html5_video()
+ elif fmt == 'jshtml':
+ return self.to_jshtml()
+
+ def pause(self):
+ """Pause the animation."""
+ self.event_source.stop()
+ if self._blit:
+ for artist in self._drawn_artists:
+ artist.set_animated(False)
+
+ def resume(self):
+ """Resume the animation."""
+ self.event_source.start()
+ if self._blit:
+ for artist in self._drawn_artists:
+ artist.set_animated(True)
+
+
+class TimedAnimation(Animation):
+ """
+ `Animation` subclass for time-based animation.
+
+ A new frame is drawn every *interval* milliseconds.
+
+ .. note::
+
+ You must store the created Animation in a variable that lives as long
+ as the animation should run. Otherwise, the Animation object will be
+ garbage-collected and the animation stops.
+
+ Parameters
+ ----------
+ fig : `~matplotlib.figure.Figure`
+ The figure object used to get needed events, such as draw or resize.
+ interval : int, default: 200
+ Delay between frames in milliseconds.
+ repeat_delay : int, default: 0
+ The delay in milliseconds between consecutive animation runs, if
+ *repeat* is True.
+ repeat : bool, default: True
+ Whether the animation repeats when the sequence of frames is completed.
+ blit : bool, default: False
+ Whether blitting is used to optimize drawing.
+ """
+
+ def __init__(self, fig, interval=200, repeat_delay=0, repeat=True,
+ event_source=None, *args, **kwargs):
+ self._interval = interval
+ # Undocumented support for repeat_delay = None as backcompat.
+ self._repeat_delay = repeat_delay if repeat_delay is not None else 0
+ self.repeat = repeat
+ # If we're not given an event source, create a new timer. This permits
+ # sharing timers between animation objects for syncing animations.
+ if event_source is None:
+ event_source = fig.canvas.new_timer(interval=self._interval)
+ super().__init__(fig, event_source=event_source, *args, **kwargs)
+
+ def _step(self, *args):
+ """Handler for getting events."""
+ # Extends the _step() method for the Animation class. If
+ # Animation._step signals that it reached the end and we want to
+ # repeat, we refresh the frame sequence and return True. If
+ # _repeat_delay is set, change the event_source's interval to our loop
+ # delay and set the callback to one which will then set the interval
+ # back.
+ still_going = super()._step(*args)
+ if not still_going and self.repeat:
+ self._init_draw()
+ self.frame_seq = self.new_frame_seq()
+ self.event_source.interval = self._repeat_delay
+ return True
+ else:
+ self.event_source.interval = self._interval
+ return still_going
+
+
+class ArtistAnimation(TimedAnimation):
+ """
+ Animation using a fixed set of `.Artist` objects.
+
+ Before creating an instance, all plotting should have taken place
+ and the relevant artists saved.
+
+ .. note::
+
+ You must store the created Animation in a variable that lives as long
+ as the animation should run. Otherwise, the Animation object will be
+ garbage-collected and the animation stops.
+
+ Parameters
+ ----------
+ fig : `~matplotlib.figure.Figure`
+ The figure object used to get needed events, such as draw or resize.
+ artists : list
+ Each list entry is a collection of `.Artist` objects that are made
+ visible on the corresponding frame. Other artists are made invisible.
+ interval : int, default: 200
+ Delay between frames in milliseconds.
+ repeat_delay : int, default: 0
+ The delay in milliseconds between consecutive animation runs, if
+ *repeat* is True.
+ repeat : bool, default: True
+ Whether the animation repeats when the sequence of frames is completed.
+ blit : bool, default: False
+ Whether blitting is used to optimize drawing.
+ """
+
+ def __init__(self, fig, artists, *args, **kwargs):
+ # Internal list of artists drawn in the most recent frame.
+ self._drawn_artists = []
+
+ # Use the list of artists as the framedata, which will be iterated
+ # over by the machinery.
+ self._framedata = artists
+ super().__init__(fig, *args, **kwargs)
+
+ def _init_draw(self):
+ super()._init_draw()
+ # Make all the artists involved in *any* frame invisible
+ figs = set()
+ for f in self.new_frame_seq():
+ for artist in f:
+ artist.set_visible(False)
+ artist.set_animated(self._blit)
+ # Assemble a list of unique figures that need flushing
+ if artist.get_figure() not in figs:
+ figs.add(artist.get_figure())
+
+ # Flush the needed figures
+ for fig in figs:
+ fig.canvas.draw_idle()
+
+ def _pre_draw(self, framedata, blit):
+ """Clears artists from the last frame."""
+ if blit:
+ # Let blit handle clearing
+ self._blit_clear(self._drawn_artists)
+ else:
+ # Otherwise, make all the artists from the previous frame invisible
+ for artist in self._drawn_artists:
+ artist.set_visible(False)
+
+ def _draw_frame(self, artists):
+ # Save the artists that were passed in as framedata for the other
+ # steps (esp. blitting) to use.
+ self._drawn_artists = artists
+
+ # Make all the artists from the current frame visible
+ for artist in artists:
+ artist.set_visible(True)
+
+
+class FuncAnimation(TimedAnimation):
+ """
+ Makes an animation by repeatedly calling a function *func*.
+
+ .. note::
+
+ You must store the created Animation in a variable that lives as long
+ as the animation should run. Otherwise, the Animation object will be
+ garbage-collected and the animation stops.
+
+ Parameters
+ ----------
+ fig : `~matplotlib.figure.Figure`
+ The figure object used to get needed events, such as draw or resize.
+
+ func : callable
+ The function to call at each frame. The first argument will
+ be the next value in *frames*. Any additional positional
+ arguments can be supplied via the *fargs* parameter.
+
+ The required signature is::
+
+ def func(frame, *fargs) -> iterable_of_artists
+
+ If ``blit == True``, *func* must return an iterable of all artists
+ that were modified or created. This information is used by the blitting
+ algorithm to determine which parts of the figure have to be updated.
+ The return value is unused if ``blit == False`` and may be omitted in
+ that case.
+
+ frames : iterable, int, generator function, or None, optional
+ Source of data to pass *func* and each frame of the animation
+
+ - If an iterable, then simply use the values provided. If the
+ iterable has a length, it will override the *save_count* kwarg.
+
+ - If an integer, then equivalent to passing ``range(frames)``
+
+ - If a generator function, then must have the signature::
+
+ def gen_function() -> obj
+
+ - If *None*, then equivalent to passing ``itertools.count``.
+
+ In all of these cases, the values in *frames* is simply passed through
+ to the user-supplied *func* and thus can be of any type.
+
+ init_func : callable, optional
+ A function used to draw a clear frame. If not given, the results of
+ drawing from the first item in the frames sequence will be used. This
+ function will be called once before the first frame.
+
+ The required signature is::
+
+ def init_func() -> iterable_of_artists
+
+ If ``blit == True``, *init_func* must return an iterable of artists
+ to be re-drawn. This information is used by the blitting algorithm to
+ determine which parts of the figure have to be updated. The return
+ value is unused if ``blit == False`` and may be omitted in that case.
+
+ fargs : tuple or None, optional
+ Additional arguments to pass to each call to *func*.
+
+ save_count : int, default: 100
+ Fallback for the number of values from *frames* to cache. This is
+ only used if the number of frames cannot be inferred from *frames*,
+ i.e. when it's an iterator without length or a generator.
+
+ interval : int, default: 200
+ Delay between frames in milliseconds.
+
+ repeat_delay : int, default: 0
+ The delay in milliseconds between consecutive animation runs, if
+ *repeat* is True.
+
+ repeat : bool, default: True
+ Whether the animation repeats when the sequence of frames is completed.
+
+ blit : bool, default: False
+ Whether blitting is used to optimize drawing. Note: when using
+ blitting, any animated artists will be drawn according to their zorder;
+ however, they will be drawn on top of any previous artists, regardless
+ of their zorder.
+
+ cache_frame_data : bool, default: True
+ Whether frame data is cached. Disabling cache might be helpful when
+ frames contain large objects.
+ """
+
+ def __init__(self, fig, func, frames=None, init_func=None, fargs=None,
+ save_count=None, *, cache_frame_data=True, **kwargs):
+ if fargs:
+ self._args = fargs
+ else:
+ self._args = ()
+ self._func = func
+ self._init_func = init_func
+
+ # Amount of framedata to keep around for saving movies. This is only
+ # used if we don't know how many frames there will be: in the case
+ # of no generator or in the case of a callable.
+ self.save_count = save_count
+ # Set up a function that creates a new iterable when needed. If nothing
+ # is passed in for frames, just use itertools.count, which will just
+ # keep counting from 0. A callable passed in for frames is assumed to
+ # be a generator. An iterable will be used as is, and anything else
+ # will be treated as a number of frames.
+ if frames is None:
+ self._iter_gen = itertools.count
+ elif callable(frames):
+ self._iter_gen = frames
+ elif np.iterable(frames):
+ if kwargs.get('repeat', True):
+ self._tee_from = frames
+ def iter_frames(frames=frames):
+ this, self._tee_from = itertools.tee(self._tee_from, 2)
+ yield from this
+ self._iter_gen = iter_frames
+ else:
+ self._iter_gen = lambda: iter(frames)
+ if hasattr(frames, '__len__'):
+ self.save_count = len(frames)
+ else:
+ self._iter_gen = lambda: iter(range(frames))
+ self.save_count = frames
+
+ if self.save_count is None:
+ # If we're passed in and using the default, set save_count to 100.
+ self.save_count = 100
+ else:
+ # itertools.islice returns an error when passed a numpy int instead
+ # of a native python int (http://bugs.python.org/issue30537).
+ # As a workaround, convert save_count to a native python int.
+ self.save_count = int(self.save_count)
+
+ self._cache_frame_data = cache_frame_data
+
+ # Needs to be initialized so the draw functions work without checking
+ self._save_seq = []
+
+ super().__init__(fig, **kwargs)
+
+ # Need to reset the saved seq, since right now it will contain data
+ # for a single frame from init, which is not what we want.
+ self._save_seq = []
+
+ def new_frame_seq(self):
+ # Use the generating function to generate a new frame sequence
+ return self._iter_gen()
+
+ def new_saved_frame_seq(self):
+ # Generate an iterator for the sequence of saved data. If there are
+ # no saved frames, generate a new frame sequence and take the first
+ # save_count entries in it.
+ if self._save_seq:
+ # While iterating we are going to update _save_seq
+ # so make a copy to safely iterate over
+ self._old_saved_seq = list(self._save_seq)
+ return iter(self._old_saved_seq)
+ else:
+ if self.save_count is not None:
+ return itertools.islice(self.new_frame_seq(), self.save_count)
+
+ else:
+ frame_seq = self.new_frame_seq()
+
+ def gen():
+ try:
+ for _ in range(100):
+ yield next(frame_seq)
+ except StopIteration:
+ pass
+ else:
+ _api.warn_deprecated(
+ "2.2", message="FuncAnimation.save has truncated "
+ "your animation to 100 frames. In the future, no "
+ "such truncation will occur; please pass "
+ "'save_count' accordingly.")
+
+ return gen()
+
+ def _init_draw(self):
+ super()._init_draw()
+ # Initialize the drawing either using the given init_func or by
+ # calling the draw function with the first item of the frame sequence.
+ # For blitting, the init_func should return a sequence of modified
+ # artists.
+ if self._init_func is None:
+ self._draw_frame(next(self.new_frame_seq()))
+
+ else:
+ self._drawn_artists = self._init_func()
+ if self._blit:
+ if self._drawn_artists is None:
+ raise RuntimeError('The init_func must return a '
+ 'sequence of Artist objects.')
+ for a in self._drawn_artists:
+ a.set_animated(self._blit)
+ self._save_seq = []
+
+ def _draw_frame(self, framedata):
+ if self._cache_frame_data:
+ # Save the data for potential saving of movies.
+ self._save_seq.append(framedata)
+
+ # Make sure to respect save_count (keep only the last save_count
+ # around)
+ self._save_seq = self._save_seq[-self.save_count:]
+
+ # Call the func with framedata and args. If blitting is desired,
+ # func needs to return a sequence of any artists that were modified.
+ self._drawn_artists = self._func(framedata, *self._args)
+
+ if self._blit:
+
+ err = RuntimeError('The animation function must return a sequence '
+ 'of Artist objects.')
+ try:
+ # check if a sequence
+ iter(self._drawn_artists)
+ except TypeError:
+ raise err from None
+
+ # check each item if is artist
+ for i in self._drawn_artists:
+ if not isinstance(i, mpl.artist.Artist):
+ raise err
+
+ self._drawn_artists = sorted(self._drawn_artists,
+ key=lambda x: x.get_zorder())
+
+ for a in self._drawn_artists:
+ a.set_animated(self._blit)
diff --git a/venv/Lib/site-packages/matplotlib/artist.py b/venv/Lib/site-packages/matplotlib/artist.py
new file mode 100644
index 0000000..b6f13f8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/artist.py
@@ -0,0 +1,1714 @@
+from collections import OrderedDict, namedtuple
+from functools import wraps
+import inspect
+import logging
+from numbers import Number
+import re
+import warnings
+
+import numpy as np
+
+import matplotlib as mpl
+from . import _api, cbook, docstring
+from .path import Path
+from .transforms import (Bbox, IdentityTransform, Transform, TransformedBbox,
+ TransformedPatchPath, TransformedPath)
+
+_log = logging.getLogger(__name__)
+
+
+def allow_rasterization(draw):
+ """
+ Decorator for Artist.draw method. Provides routines
+ that run before and after the draw call. The before and after functions
+ are useful for changing artist-dependent renderer attributes or making
+ other setup function calls, such as starting and flushing a mixed-mode
+ renderer.
+ """
+
+ # Axes has a second (deprecated) argument inframe for its draw method.
+ # args and kwargs are deprecated, but we don't wrap this in
+ # _api.delete_parameter for performance; the relevant deprecation
+ # warning will be emitted by the inner draw() call.
+ @wraps(draw)
+ def draw_wrapper(artist, renderer, *args, **kwargs):
+ try:
+ if artist.get_rasterized():
+ if renderer._raster_depth == 0 and not renderer._rasterizing:
+ renderer.start_rasterizing()
+ renderer._rasterizing = True
+ renderer._raster_depth += 1
+ else:
+ if renderer._raster_depth == 0 and renderer._rasterizing:
+ # Only stop when we are not in a rasterized parent
+ # and something has be rasterized since last stop
+ renderer.stop_rasterizing()
+ renderer._rasterizing = False
+
+ if artist.get_agg_filter() is not None:
+ renderer.start_filter()
+
+ return draw(artist, renderer, *args, **kwargs)
+ finally:
+ if artist.get_agg_filter() is not None:
+ renderer.stop_filter(artist.get_agg_filter())
+ if artist.get_rasterized():
+ renderer._raster_depth -= 1
+ if (renderer._rasterizing and artist.figure and
+ artist.figure.suppressComposite):
+ # restart rasterizing to prevent merging
+ renderer.stop_rasterizing()
+ renderer.start_rasterizing()
+
+ draw_wrapper._supports_rasterization = True
+ return draw_wrapper
+
+
+def _finalize_rasterization(draw):
+ """
+ Decorator for Artist.draw method. Needed on the outermost artist, i.e.
+ Figure, to finish up if the render is still in rasterized mode.
+ """
+ @wraps(draw)
+ def draw_wrapper(artist, renderer, *args, **kwargs):
+ result = draw(artist, renderer, *args, **kwargs)
+ if renderer._rasterizing:
+ renderer.stop_rasterizing()
+ renderer._rasterizing = False
+ return result
+ return draw_wrapper
+
+
+def _stale_axes_callback(self, val):
+ if self.axes:
+ self.axes.stale = val
+
+
+_XYPair = namedtuple("_XYPair", "x y")
+
+
+class Artist:
+ """
+ Abstract base class for objects that render into a FigureCanvas.
+
+ Typically, all visible elements in a figure are subclasses of Artist.
+ """
+
+ zorder = 0
+
+ def __init__(self):
+ self._stale = True
+ self.stale_callback = None
+ self._axes = None
+ self.figure = None
+
+ self._transform = None
+ self._transformSet = False
+ self._visible = True
+ self._animated = False
+ self._alpha = None
+ self.clipbox = None
+ self._clippath = None
+ self._clipon = True
+ self._label = ''
+ self._picker = None
+ self._contains = None
+ self._rasterized = False
+ self._agg_filter = None
+ # Normally, artist classes need to be queried for mouseover info if and
+ # only if they override get_cursor_data.
+ self._mouseover = type(self).get_cursor_data != Artist.get_cursor_data
+ self._callbacks = cbook.CallbackRegistry()
+ try:
+ self.axes = None
+ except AttributeError:
+ # Handle self.axes as a read-only property, as in Figure.
+ pass
+ self._remove_method = None
+ self._url = None
+ self._gid = None
+ self._snap = None
+ self._sketch = mpl.rcParams['path.sketch']
+ self._path_effects = mpl.rcParams['path.effects']
+ self._sticky_edges = _XYPair([], [])
+ self._in_layout = True
+
+ def __getstate__(self):
+ d = self.__dict__.copy()
+ # remove the unpicklable remove method, this will get re-added on load
+ # (by the axes) if the artist lives on an axes.
+ d['stale_callback'] = None
+ return d
+
+ def remove(self):
+ """
+ Remove the artist from the figure if possible.
+
+ The effect will not be visible until the figure is redrawn, e.g.,
+ with `.FigureCanvasBase.draw_idle`. Call `~.axes.Axes.relim` to
+ update the axes limits if desired.
+
+ Note: `~.axes.Axes.relim` will not see collections even if the
+ collection was added to the axes with *autolim* = True.
+
+ Note: there is no support for removing the artist's legend entry.
+ """
+
+ # There is no method to set the callback. Instead the parent should
+ # set the _remove_method attribute directly. This would be a
+ # protected attribute if Python supported that sort of thing. The
+ # callback has one parameter, which is the child to be removed.
+ if self._remove_method is not None:
+ self._remove_method(self)
+ # clear stale callback
+ self.stale_callback = None
+ _ax_flag = False
+ if hasattr(self, 'axes') and self.axes:
+ # remove from the mouse hit list
+ self.axes._mouseover_set.discard(self)
+ # mark the axes as stale
+ self.axes.stale = True
+ # decouple the artist from the axes
+ self.axes = None
+ _ax_flag = True
+
+ if self.figure:
+ self.figure = None
+ if not _ax_flag:
+ self.figure = True
+
+ else:
+ raise NotImplementedError('cannot remove artist')
+ # TODO: the fix for the collections relim problem is to move the
+ # limits calculation into the artist itself, including the property of
+ # whether or not the artist should affect the limits. Then there will
+ # be no distinction between axes.add_line, axes.add_patch, etc.
+ # TODO: add legend support
+
+ def have_units(self):
+ """Return whether units are set on any axis."""
+ ax = self.axes
+ return ax and any(axis.have_units() for axis in ax._get_axis_list())
+
+ def convert_xunits(self, x):
+ """
+ Convert *x* using the unit type of the xaxis.
+
+ If the artist is not in contained in an Axes or if the xaxis does not
+ have units, *x* itself is returned.
+ """
+ ax = getattr(self, 'axes', None)
+ if ax is None or ax.xaxis is None:
+ return x
+ return ax.xaxis.convert_units(x)
+
+ def convert_yunits(self, y):
+ """
+ Convert *y* using the unit type of the yaxis.
+
+ If the artist is not in contained in an Axes or if the yaxis does not
+ have units, *y* itself is returned.
+ """
+ ax = getattr(self, 'axes', None)
+ if ax is None or ax.yaxis is None:
+ return y
+ return ax.yaxis.convert_units(y)
+
+ @property
+ def axes(self):
+ """The `~.axes.Axes` instance the artist resides in, or *None*."""
+ return self._axes
+
+ @axes.setter
+ def axes(self, new_axes):
+ if (new_axes is not None and self._axes is not None
+ and new_axes != self._axes):
+ raise ValueError("Can not reset the axes. You are probably "
+ "trying to re-use an artist in more than one "
+ "Axes which is not supported")
+ self._axes = new_axes
+ if new_axes is not None and new_axes is not self:
+ self.stale_callback = _stale_axes_callback
+
+ @property
+ def stale(self):
+ """
+ Whether the artist is 'stale' and needs to be re-drawn for the output
+ to match the internal state of the artist.
+ """
+ return self._stale
+
+ @stale.setter
+ def stale(self, val):
+ self._stale = val
+
+ # if the artist is animated it does not take normal part in the
+ # draw stack and is not expected to be drawn as part of the normal
+ # draw loop (when not saving) so do not propagate this change
+ if self.get_animated():
+ return
+
+ if val and self.stale_callback is not None:
+ self.stale_callback(self, val)
+
+ def get_window_extent(self, renderer):
+ """
+ Get the axes bounding box in display space.
+
+ The bounding box' width and height are nonnegative.
+
+ Subclasses should override for inclusion in the bounding box
+ "tight" calculation. Default is to return an empty bounding
+ box at 0, 0.
+
+ Be careful when using this function, the results will not update
+ if the artist window extent of the artist changes. The extent
+ can change due to any changes in the transform stack, such as
+ changing the axes limits, the figure size, or the canvas used
+ (as is done when saving a figure). This can lead to unexpected
+ behavior where interactive figures will look fine on the screen,
+ but will save incorrectly.
+ """
+ return Bbox([[0, 0], [0, 0]])
+
+ def _get_clipping_extent_bbox(self):
+ """
+ Return a bbox with the extents of the intersection of the clip_path
+ and clip_box for this artist, or None if both of these are
+ None, or ``get_clip_on`` is False.
+ """
+ bbox = None
+ if self.get_clip_on():
+ clip_box = self.get_clip_box()
+ if clip_box is not None:
+ bbox = clip_box
+ clip_path = self.get_clip_path()
+ if clip_path is not None and bbox is not None:
+ clip_path = clip_path.get_fully_transformed_path()
+ bbox = Bbox.intersection(bbox, clip_path.get_extents())
+ return bbox
+
+ def get_tightbbox(self, renderer):
+ """
+ Like `.Artist.get_window_extent`, but includes any clipping.
+
+ Parameters
+ ----------
+ renderer : `.RendererBase` subclass
+ renderer that will be used to draw the figures (i.e.
+ ``fig.canvas.get_renderer()``)
+
+ Returns
+ -------
+ `.Bbox`
+ The enclosing bounding box (in figure pixel coordinates).
+ """
+ bbox = self.get_window_extent(renderer)
+ if self.get_clip_on():
+ clip_box = self.get_clip_box()
+ if clip_box is not None:
+ bbox = Bbox.intersection(bbox, clip_box)
+ clip_path = self.get_clip_path()
+ if clip_path is not None and bbox is not None:
+ clip_path = clip_path.get_fully_transformed_path()
+ bbox = Bbox.intersection(bbox, clip_path.get_extents())
+ return bbox
+
+ def add_callback(self, func):
+ """
+ Add a callback function that will be called whenever one of the
+ `.Artist`'s properties changes.
+
+ Parameters
+ ----------
+ func : callable
+ The callback function. It must have the signature::
+
+ def func(artist: Artist) -> Any
+
+ where *artist* is the calling `.Artist`. Return values may exist
+ but are ignored.
+
+ Returns
+ -------
+ int
+ The observer id associated with the callback. This id can be
+ used for removing the callback with `.remove_callback` later.
+
+ See Also
+ --------
+ remove_callback
+ """
+ # Wrapping func in a lambda ensures it can be connected multiple times
+ # and never gets weakref-gc'ed.
+ return self._callbacks.connect("pchanged", lambda: func(self))
+
+ def remove_callback(self, oid):
+ """
+ Remove a callback based on its observer id.
+
+ See Also
+ --------
+ add_callback
+ """
+ self._callbacks.disconnect(oid)
+
+ def pchanged(self):
+ """
+ Call all of the registered callbacks.
+
+ This function is triggered internally when a property is changed.
+
+ See Also
+ --------
+ add_callback
+ remove_callback
+ """
+ self._callbacks.process("pchanged")
+
+ def is_transform_set(self):
+ """
+ Return whether the Artist has an explicitly set transform.
+
+ This is *True* after `.set_transform` has been called.
+ """
+ return self._transformSet
+
+ def set_transform(self, t):
+ """
+ Set the artist transform.
+
+ Parameters
+ ----------
+ t : `.Transform`
+ """
+ self._transform = t
+ self._transformSet = True
+ self.pchanged()
+ self.stale = True
+
+ def get_transform(self):
+ """Return the `.Transform` instance used by this artist."""
+ if self._transform is None:
+ self._transform = IdentityTransform()
+ elif (not isinstance(self._transform, Transform)
+ and hasattr(self._transform, '_as_mpl_transform')):
+ self._transform = self._transform._as_mpl_transform(self.axes)
+ return self._transform
+
+ def get_children(self):
+ r"""Return a list of the child `.Artist`\s of this `.Artist`."""
+ return []
+
+ def _default_contains(self, mouseevent, figure=None):
+ """
+ Base impl. for checking whether a mouseevent happened in an artist.
+
+ 1. If the artist defines a custom checker, use it (deprecated).
+ 2. If the artist figure is known and the event did not occur in that
+ figure (by checking its ``canvas`` attribute), reject it.
+ 3. Otherwise, return `None, {}`, indicating that the subclass'
+ implementation should be used.
+
+ Subclasses should start their definition of `contains` as follows:
+
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+ # subclass-specific implementation follows
+
+ The *figure* kwarg is provided for the implementation of
+ `.Figure.contains`.
+ """
+ if callable(self._contains):
+ return self._contains(self, mouseevent)
+ if figure is not None and mouseevent.canvas is not figure.canvas:
+ return False, {}
+ return None, {}
+
+ def contains(self, mouseevent):
+ """
+ Test whether the artist contains the mouse event.
+
+ Parameters
+ ----------
+ mouseevent : `matplotlib.backend_bases.MouseEvent`
+
+ Returns
+ -------
+ contains : bool
+ Whether any values are within the radius.
+ details : dict
+ An artist-specific dictionary of details of the event context,
+ such as which points are contained in the pick radius. See the
+ individual Artist subclasses for details.
+ """
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+ _log.warning("%r needs 'contains' method", self.__class__.__name__)
+ return False, {}
+
+ @_api.deprecated("3.3", alternative="set_picker")
+ def set_contains(self, picker):
+ """
+ Define a custom contains test for the artist.
+
+ The provided callable replaces the default `.contains` method
+ of the artist.
+
+ Parameters
+ ----------
+ picker : callable
+ A custom picker function to evaluate if an event is within the
+ artist. The function must have the signature::
+
+ def contains(artist: Artist, event: MouseEvent) -> bool, dict
+
+ that returns:
+
+ - a bool indicating if the event is within the artist
+ - a dict of additional information. The dict should at least
+ return the same information as the default ``contains()``
+ implementation of the respective artist, but may provide
+ additional information.
+ """
+ if not callable(picker):
+ raise TypeError("picker is not a callable")
+ self._contains = picker
+
+ @_api.deprecated("3.3", alternative="get_picker")
+ def get_contains(self):
+ """
+ Return the custom contains function of the artist if set, or *None*.
+
+ See Also
+ --------
+ set_contains
+ """
+ return self._contains
+
+ def pickable(self):
+ """
+ Return whether the artist is pickable.
+
+ See Also
+ --------
+ set_picker, get_picker, pick
+ """
+ return self.figure is not None and self._picker is not None
+
+ def pick(self, mouseevent):
+ """
+ Process a pick event.
+
+ Each child artist will fire a pick event if *mouseevent* is over
+ the artist and the artist has picker set.
+
+ See Also
+ --------
+ set_picker, get_picker, pickable
+ """
+ # Pick self
+ if self.pickable():
+ picker = self.get_picker()
+ if callable(picker):
+ inside, prop = picker(self, mouseevent)
+ else:
+ inside, prop = self.contains(mouseevent)
+ if inside:
+ self.figure.canvas.pick_event(mouseevent, self, **prop)
+
+ # Pick children
+ for a in self.get_children():
+ # make sure the event happened in the same axes
+ ax = getattr(a, 'axes', None)
+ if (mouseevent.inaxes is None or ax is None
+ or mouseevent.inaxes == ax):
+ # we need to check if mouseevent.inaxes is None
+ # because some objects associated with an axes (e.g., a
+ # tick label) can be outside the bounding box of the
+ # axes and inaxes will be None
+ # also check that ax is None so that it traverse objects
+ # which do no have an axes property but children might
+ a.pick(mouseevent)
+
+ def set_picker(self, picker):
+ """
+ Define the picking behavior of the artist.
+
+ Parameters
+ ----------
+ picker : None or bool or float or callable
+ This can be one of the following:
+
+ - *None*: Picking is disabled for this artist (default).
+
+ - A boolean: If *True* then picking will be enabled and the
+ artist will fire a pick event if the mouse event is over
+ the artist.
+
+ - A float: If picker is a number it is interpreted as an
+ epsilon tolerance in points and the artist will fire
+ off an event if its data is within epsilon of the mouse
+ event. For some artists like lines and patch collections,
+ the artist may provide additional data to the pick event
+ that is generated, e.g., the indices of the data within
+ epsilon of the pick event
+
+ - A function: If picker is callable, it is a user supplied
+ function which determines whether the artist is hit by the
+ mouse event::
+
+ hit, props = picker(artist, mouseevent)
+
+ to determine the hit test. if the mouse event is over the
+ artist, return *hit=True* and props is a dictionary of
+ properties you want added to the PickEvent attributes.
+ """
+ self._picker = picker
+
+ def get_picker(self):
+ """
+ Return the picking behavior of the artist.
+
+ The possible values are described in `.set_picker`.
+
+ See Also
+ --------
+ set_picker, pickable, pick
+ """
+ return self._picker
+
+ def get_url(self):
+ """Return the url."""
+ return self._url
+
+ def set_url(self, url):
+ """
+ Set the url for the artist.
+
+ Parameters
+ ----------
+ url : str
+ """
+ self._url = url
+
+ def get_gid(self):
+ """Return the group id."""
+ return self._gid
+
+ def set_gid(self, gid):
+ """
+ Set the (group) id for the artist.
+
+ Parameters
+ ----------
+ gid : str
+ """
+ self._gid = gid
+
+ def get_snap(self):
+ """
+ Return the snap setting.
+
+ See `.set_snap` for details.
+ """
+ if mpl.rcParams['path.snap']:
+ return self._snap
+ else:
+ return False
+
+ def set_snap(self, snap):
+ """
+ Set the snapping behavior.
+
+ Snapping aligns positions with the pixel grid, which results in
+ clearer images. For example, if a black line of 1px width was
+ defined at a position in between two pixels, the resulting image
+ would contain the interpolated value of that line in the pixel grid,
+ which would be a grey value on both adjacent pixel positions. In
+ contrast, snapping will move the line to the nearest integer pixel
+ value, so that the resulting image will really contain a 1px wide
+ black line.
+
+ Snapping is currently only supported by the Agg and MacOSX backends.
+
+ Parameters
+ ----------
+ snap : bool or None
+ Possible values:
+
+ - *True*: Snap vertices to the nearest pixel center.
+ - *False*: Do not modify vertex positions.
+ - *None*: (auto) If the path contains only rectilinear line
+ segments, round to the nearest pixel center.
+ """
+ self._snap = snap
+ self.stale = True
+
+ def get_sketch_params(self):
+ """
+ Return the sketch parameters for the artist.
+
+ Returns
+ -------
+ tuple or None
+
+ A 3-tuple with the following elements:
+
+ - *scale*: The amplitude of the wiggle perpendicular to the
+ source line.
+ - *length*: The length of the wiggle along the line.
+ - *randomness*: The scale factor by which the length is
+ shrunken or expanded.
+
+ Returns *None* if no sketch parameters were set.
+ """
+ return self._sketch
+
+ def set_sketch_params(self, scale=None, length=None, randomness=None):
+ """
+ Set the sketch parameters.
+
+ Parameters
+ ----------
+ scale : float, optional
+ The amplitude of the wiggle perpendicular to the source
+ line, in pixels. If scale is `None`, or not provided, no
+ sketch filter will be provided.
+ length : float, optional
+ The length of the wiggle along the line, in pixels
+ (default 128.0)
+ randomness : float, optional
+ The scale factor by which the length is shrunken or
+ expanded (default 16.0)
+
+ .. ACCEPTS: (scale: float, length: float, randomness: float)
+ """
+ if scale is None:
+ self._sketch = None
+ else:
+ self._sketch = (scale, length or 128.0, randomness or 16.0)
+ self.stale = True
+
+ def set_path_effects(self, path_effects):
+ """
+ Set the path effects.
+
+ Parameters
+ ----------
+ path_effects : `.AbstractPathEffect`
+ """
+ self._path_effects = path_effects
+ self.stale = True
+
+ def get_path_effects(self):
+ return self._path_effects
+
+ def get_figure(self):
+ """Return the `.Figure` instance the artist belongs to."""
+ return self.figure
+
+ def set_figure(self, fig):
+ """
+ Set the `.Figure` instance the artist belongs to.
+
+ Parameters
+ ----------
+ fig : `.Figure`
+ """
+ # if this is a no-op just return
+ if self.figure is fig:
+ return
+ # if we currently have a figure (the case of both `self.figure`
+ # and *fig* being none is taken care of above) we then user is
+ # trying to change the figure an artist is associated with which
+ # is not allowed for the same reason as adding the same instance
+ # to more than one Axes
+ if self.figure is not None:
+ raise RuntimeError("Can not put single artist in "
+ "more than one figure")
+ self.figure = fig
+ if self.figure and self.figure is not self:
+ self.pchanged()
+ self.stale = True
+
+ def set_clip_box(self, clipbox):
+ """
+ Set the artist's clip `.Bbox`.
+
+ Parameters
+ ----------
+ clipbox : `.Bbox`
+ """
+ self.clipbox = clipbox
+ self.pchanged()
+ self.stale = True
+
+ def set_clip_path(self, path, transform=None):
+ """
+ Set the artist's clip path.
+
+ Parameters
+ ----------
+ path : `.Patch` or `.Path` or `.TransformedPath` or None
+ The clip path. If given a `.Path`, *transform* must be provided as
+ well. If *None*, a previously set clip path is removed.
+ transform : `~matplotlib.transforms.Transform`, optional
+ Only used if *path* is a `.Path`, in which case the given `.Path`
+ is converted to a `.TransformedPath` using *transform*.
+
+ Notes
+ -----
+ For efficiency, if *path* is a `.Rectangle` this method will set the
+ clipping box to the corresponding rectangle and set the clipping path
+ to ``None``.
+
+ For technical reasons (support of `~.Artist.set`), a tuple
+ (*path*, *transform*) is also accepted as a single positional
+ parameter.
+
+ .. ACCEPTS: Patch or (Path, Transform) or None
+ """
+ from matplotlib.patches import Patch, Rectangle
+
+ success = False
+ if transform is None:
+ if isinstance(path, Rectangle):
+ self.clipbox = TransformedBbox(Bbox.unit(),
+ path.get_transform())
+ self._clippath = None
+ success = True
+ elif isinstance(path, Patch):
+ self._clippath = TransformedPatchPath(path)
+ success = True
+ elif isinstance(path, tuple):
+ path, transform = path
+
+ if path is None:
+ self._clippath = None
+ success = True
+ elif isinstance(path, Path):
+ self._clippath = TransformedPath(path, transform)
+ success = True
+ elif isinstance(path, TransformedPatchPath):
+ self._clippath = path
+ success = True
+ elif isinstance(path, TransformedPath):
+ self._clippath = path
+ success = True
+
+ if not success:
+ raise TypeError(
+ "Invalid arguments to set_clip_path, of type {} and {}"
+ .format(type(path).__name__, type(transform).__name__))
+ # This may result in the callbacks being hit twice, but guarantees they
+ # will be hit at least once.
+ self.pchanged()
+ self.stale = True
+
+ def get_alpha(self):
+ """
+ Return the alpha value used for blending - not supported on all
+ backends.
+ """
+ return self._alpha
+
+ def get_visible(self):
+ """Return the visibility."""
+ return self._visible
+
+ def get_animated(self):
+ """Return whether the artist is animated."""
+ return self._animated
+
+ def get_in_layout(self):
+ """
+ Return boolean flag, ``True`` if artist is included in layout
+ calculations.
+
+ E.g. :doc:`/tutorials/intermediate/constrainedlayout_guide`,
+ `.Figure.tight_layout()`, and
+ ``fig.savefig(fname, bbox_inches='tight')``.
+ """
+ return self._in_layout
+
+ def get_clip_on(self):
+ """Return whether the artist uses clipping."""
+ return self._clipon
+
+ def get_clip_box(self):
+ """Return the clipbox."""
+ return self.clipbox
+
+ def get_clip_path(self):
+ """Return the clip path."""
+ return self._clippath
+
+ def get_transformed_clip_path_and_affine(self):
+ """
+ Return the clip path with the non-affine part of its
+ transformation applied, and the remaining affine part of its
+ transformation.
+ """
+ if self._clippath is not None:
+ return self._clippath.get_transformed_path_and_affine()
+ return None, None
+
+ def set_clip_on(self, b):
+ """
+ Set whether the artist uses clipping.
+
+ When False artists will be visible outside of the axes which
+ can lead to unexpected results.
+
+ Parameters
+ ----------
+ b : bool
+ """
+ self._clipon = b
+ # This may result in the callbacks being hit twice, but ensures they
+ # are hit at least once
+ self.pchanged()
+ self.stale = True
+
+ def _set_gc_clip(self, gc):
+ """Set the clip properly for the gc."""
+ if self._clipon:
+ if self.clipbox is not None:
+ gc.set_clip_rectangle(self.clipbox)
+ gc.set_clip_path(self._clippath)
+ else:
+ gc.set_clip_rectangle(None)
+ gc.set_clip_path(None)
+
+ def get_rasterized(self):
+ """Return whether the artist is to be rasterized."""
+ return self._rasterized
+
+ def set_rasterized(self, rasterized):
+ """
+ Force rasterized (bitmap) drawing for vector graphics output.
+
+ Rasterized drawing is not supported by all artists. If you try to
+ enable this on an artist that does not support it, the command has no
+ effect and a warning will be issued.
+
+ This setting is ignored for pixel-based output.
+
+ See also :doc:`/gallery/misc/rasterization_demo`.
+
+ Parameters
+ ----------
+ rasterized : bool
+ """
+ if rasterized and not hasattr(self.draw, "_supports_rasterization"):
+ _api.warn_external(f"Rasterization of '{self}' will be ignored")
+
+ self._rasterized = rasterized
+
+ def get_agg_filter(self):
+ """Return filter function to be used for agg filter."""
+ return self._agg_filter
+
+ def set_agg_filter(self, filter_func):
+ """
+ Set the agg filter.
+
+ Parameters
+ ----------
+ filter_func : callable
+ A filter function, which takes a (m, n, 3) float array and a dpi
+ value, and returns a (m, n, 3) array.
+
+ .. ACCEPTS: a filter function, which takes a (m, n, 3) float array
+ and a dpi value, and returns a (m, n, 3) array
+ """
+ self._agg_filter = filter_func
+ self.stale = True
+
+ @_api.delete_parameter("3.3", "args")
+ @_api.delete_parameter("3.3", "kwargs")
+ def draw(self, renderer, *args, **kwargs):
+ """
+ Draw the Artist (and its children) using the given renderer.
+
+ This has no effect if the artist is not visible (`.Artist.get_visible`
+ returns False).
+
+ Parameters
+ ----------
+ renderer : `.RendererBase` subclass.
+
+ Notes
+ -----
+ This method is overridden in the Artist subclasses.
+ """
+ if not self.get_visible():
+ return
+ self.stale = False
+
+ def set_alpha(self, alpha):
+ """
+ Set the alpha value used for blending - not supported on all backends.
+
+ Parameters
+ ----------
+ alpha : scalar or None
+ *alpha* must be within the 0-1 range, inclusive.
+ """
+ if alpha is not None and not isinstance(alpha, Number):
+ raise TypeError(
+ f'alpha must be numeric or None, not {type(alpha)}')
+ if alpha is not None and not (0 <= alpha <= 1):
+ raise ValueError(f'alpha ({alpha}) is outside 0-1 range')
+ self._alpha = alpha
+ self.pchanged()
+ self.stale = True
+
+ def _set_alpha_for_array(self, alpha):
+ """
+ Set the alpha value used for blending - not supported on all backends.
+
+ Parameters
+ ----------
+ alpha : array-like or scalar or None
+ All values must be within the 0-1 range, inclusive.
+ Masked values and nans are not supported.
+ """
+ if isinstance(alpha, str):
+ raise TypeError("alpha must be numeric or None, not a string")
+ if not np.iterable(alpha):
+ Artist.set_alpha(self, alpha)
+ return
+ alpha = np.asarray(alpha)
+ if not (0 <= alpha.min() and alpha.max() <= 1):
+ raise ValueError('alpha must be between 0 and 1, inclusive, '
+ f'but min is {alpha.min()}, max is {alpha.max()}')
+ self._alpha = alpha
+ self.pchanged()
+ self.stale = True
+
+ def set_visible(self, b):
+ """
+ Set the artist's visibility.
+
+ Parameters
+ ----------
+ b : bool
+ """
+ self._visible = b
+ self.pchanged()
+ self.stale = True
+
+ def set_animated(self, b):
+ """
+ Set whether the artist is intended to be used in an animation.
+
+ If True, the artist is excluded from regular drawing of the figure.
+ You have to call `.Figure.draw_artist` / `.Axes.draw_artist`
+ explicitly on the artist. This appoach is used to speed up animations
+ using blitting.
+
+ See also `matplotlib.animation` and
+ :doc:`/tutorials/advanced/blitting`.
+
+ Parameters
+ ----------
+ b : bool
+ """
+ if self._animated != b:
+ self._animated = b
+ self.pchanged()
+
+ def set_in_layout(self, in_layout):
+ """
+ Set if artist is to be included in layout calculations,
+ E.g. :doc:`/tutorials/intermediate/constrainedlayout_guide`,
+ `.Figure.tight_layout()`, and
+ ``fig.savefig(fname, bbox_inches='tight')``.
+
+ Parameters
+ ----------
+ in_layout : bool
+ """
+ self._in_layout = in_layout
+
+ def update(self, props):
+ """
+ Update this artist's properties from the dict *props*.
+
+ Parameters
+ ----------
+ props : dict
+ """
+ ret = []
+ with cbook._setattr_cm(self, eventson=False):
+ for k, v in props.items():
+ if k != k.lower():
+ _api.warn_deprecated(
+ "3.3", message="Case-insensitive properties were "
+ "deprecated in %(since)s and support will be removed "
+ "%(removal)s")
+ k = k.lower()
+ # White list attributes we want to be able to update through
+ # art.update, art.set, setp.
+ if k == "axes":
+ ret.append(setattr(self, k, v))
+ else:
+ func = getattr(self, f"set_{k}", None)
+ if not callable(func):
+ raise AttributeError(f"{type(self).__name__!r} object "
+ f"has no property {k!r}")
+ ret.append(func(v))
+ if ret:
+ self.pchanged()
+ self.stale = True
+ return ret
+
+ def get_label(self):
+ """Return the label used for this artist in the legend."""
+ return self._label
+
+ def set_label(self, s):
+ """
+ Set a label that will be displayed in the legend.
+
+ Parameters
+ ----------
+ s : object
+ *s* will be converted to a string by calling `str`.
+ """
+ if s is not None:
+ self._label = str(s)
+ else:
+ self._label = None
+ self.pchanged()
+ self.stale = True
+
+ def get_zorder(self):
+ """Return the artist's zorder."""
+ return self.zorder
+
+ def set_zorder(self, level):
+ """
+ Set the zorder for the artist. Artists with lower zorder
+ values are drawn first.
+
+ Parameters
+ ----------
+ level : float
+ """
+ if level is None:
+ level = self.__class__.zorder
+ self.zorder = level
+ self.pchanged()
+ self.stale = True
+
+ @property
+ def sticky_edges(self):
+ """
+ ``x`` and ``y`` sticky edge lists for autoscaling.
+
+ When performing autoscaling, if a data limit coincides with a value in
+ the corresponding sticky_edges list, then no margin will be added--the
+ view limit "sticks" to the edge. A typical use case is histograms,
+ where one usually expects no margin on the bottom edge (0) of the
+ histogram.
+
+ This attribute cannot be assigned to; however, the ``x`` and ``y``
+ lists can be modified in place as needed.
+
+ Examples
+ --------
+ >>> artist.sticky_edges.x[:] = (xmin, xmax)
+ >>> artist.sticky_edges.y[:] = (ymin, ymax)
+
+ """
+ return self._sticky_edges
+
+ def update_from(self, other):
+ """Copy properties from *other* to *self*."""
+ self._transform = other._transform
+ self._transformSet = other._transformSet
+ self._visible = other._visible
+ self._alpha = other._alpha
+ self.clipbox = other.clipbox
+ self._clipon = other._clipon
+ self._clippath = other._clippath
+ self._label = other._label
+ self._sketch = other._sketch
+ self._path_effects = other._path_effects
+ self.sticky_edges.x[:] = other.sticky_edges.x.copy()
+ self.sticky_edges.y[:] = other.sticky_edges.y.copy()
+ self.pchanged()
+ self.stale = True
+
+ def properties(self):
+ """Return a dictionary of all the properties of the artist."""
+ return ArtistInspector(self).properties()
+
+ def set(self, **kwargs):
+ """A property batch setter. Pass *kwargs* to set properties."""
+ kwargs = cbook.normalize_kwargs(kwargs, self)
+ move_color_to_start = False
+ if "color" in kwargs:
+ keys = [*kwargs]
+ i_color = keys.index("color")
+ props = ["edgecolor", "facecolor"]
+ if any(tp.__module__ == "matplotlib.collections"
+ and tp.__name__ == "Collection"
+ for tp in type(self).__mro__):
+ props.append("alpha")
+ for other in props:
+ if other not in keys:
+ continue
+ i_other = keys.index(other)
+ if i_other < i_color:
+ move_color_to_start = True
+ _api.warn_deprecated(
+ "3.3", message=f"You have passed the {other!r} kwarg "
+ "before the 'color' kwarg. Artist.set() currently "
+ "reorders the properties to apply 'color' first, but "
+ "this is deprecated since %(since)s and will be "
+ "removed %(removal)s; please pass 'color' first "
+ "instead.")
+ if move_color_to_start:
+ kwargs = {"color": kwargs.pop("color"), **kwargs}
+ return self.update(kwargs)
+
+ def findobj(self, match=None, include_self=True):
+ """
+ Find artist objects.
+
+ Recursively find all `.Artist` instances contained in the artist.
+
+ Parameters
+ ----------
+ match
+ A filter criterion for the matches. This can be
+
+ - *None*: Return all objects contained in artist.
+ - A function with signature ``def match(artist: Artist) -> bool``.
+ The result will only contain artists for which the function
+ returns *True*.
+ - A class instance: e.g., `.Line2D`. The result will only contain
+ artists of this class or its subclasses (``isinstance`` check).
+
+ include_self : bool
+ Include *self* in the list to be checked for a match.
+
+ Returns
+ -------
+ list of `.Artist`
+
+ """
+ if match is None: # always return True
+ def matchfunc(x):
+ return True
+ elif isinstance(match, type) and issubclass(match, Artist):
+ def matchfunc(x):
+ return isinstance(x, match)
+ elif callable(match):
+ matchfunc = match
+ else:
+ raise ValueError('match must be None, a matplotlib.artist.Artist '
+ 'subclass, or a callable')
+
+ artists = sum([c.findobj(matchfunc) for c in self.get_children()], [])
+ if include_self and matchfunc(self):
+ artists.append(self)
+ return artists
+
+ def get_cursor_data(self, event):
+ """
+ Return the cursor data for a given event.
+
+ .. note::
+ This method is intended to be overridden by artist subclasses.
+ As an end-user of Matplotlib you will most likely not call this
+ method yourself.
+
+ Cursor data can be used by Artists to provide additional context
+ information for a given event. The default implementation just returns
+ *None*.
+
+ Subclasses can override the method and return arbitrary data. However,
+ when doing so, they must ensure that `.format_cursor_data` can convert
+ the data to a string representation.
+
+ The only current use case is displaying the z-value of an `.AxesImage`
+ in the status bar of a plot window, while moving the mouse.
+
+ Parameters
+ ----------
+ event : `matplotlib.backend_bases.MouseEvent`
+
+ See Also
+ --------
+ format_cursor_data
+
+ """
+ return None
+
+ def format_cursor_data(self, data):
+ """
+ Return a string representation of *data*.
+
+ .. note::
+ This method is intended to be overridden by artist subclasses.
+ As an end-user of Matplotlib you will most likely not call this
+ method yourself.
+
+ The default implementation converts ints and floats and arrays of ints
+ and floats into a comma-separated string enclosed in square brackets.
+
+ See Also
+ --------
+ get_cursor_data
+ """
+ try:
+ data[0]
+ except (TypeError, IndexError):
+ data = [data]
+ data_str = ', '.join('{:0.3g}'.format(item) for item in data
+ if isinstance(item, Number))
+ return "[" + data_str + "]"
+
+ @property
+ def mouseover(self):
+ """
+ If this property is set to *True*, the artist will be queried for
+ custom context information when the mouse cursor moves over it.
+
+ See also :meth:`get_cursor_data`, :class:`.ToolCursorPosition` and
+ :class:`.NavigationToolbar2`.
+ """
+ return self._mouseover
+
+ @mouseover.setter
+ def mouseover(self, val):
+ val = bool(val)
+ self._mouseover = val
+ ax = self.axes
+ if ax:
+ if val:
+ ax._mouseover_set.add(self)
+ else:
+ ax._mouseover_set.discard(self)
+
+
+class ArtistInspector:
+ """
+ A helper class to inspect an `~matplotlib.artist.Artist` and return
+ information about its settable properties and their current values.
+ """
+
+ def __init__(self, o):
+ r"""
+ Initialize the artist inspector with an `Artist` or an iterable of
+ `Artist`\s. If an iterable is used, we assume it is a homogeneous
+ sequence (all `Artist`\s are of the same type) and it is your
+ responsibility to make sure this is so.
+ """
+ if not isinstance(o, Artist):
+ if np.iterable(o):
+ o = list(o)
+ if len(o):
+ o = o[0]
+
+ self.oorig = o
+ if not isinstance(o, type):
+ o = type(o)
+ self.o = o
+
+ self.aliasd = self.get_aliases()
+
+ def get_aliases(self):
+ """
+ Get a dict mapping property fullnames to sets of aliases for each alias
+ in the :class:`~matplotlib.artist.ArtistInspector`.
+
+ e.g., for lines::
+
+ {'markerfacecolor': {'mfc'},
+ 'linewidth' : {'lw'},
+ }
+ """
+ names = [name for name in dir(self.o)
+ if name.startswith(('set_', 'get_'))
+ and callable(getattr(self.o, name))]
+ aliases = {}
+ for name in names:
+ func = getattr(self.o, name)
+ if not self.is_alias(func):
+ continue
+ propname = re.search("`({}.*)`".format(name[:4]), # get_.*/set_.*
+ inspect.getdoc(func)).group(1)
+ aliases.setdefault(propname[4:], set()).add(name[4:])
+ return aliases
+
+ _get_valid_values_regex = re.compile(
+ r"\n\s*(?:\.\.\s+)?ACCEPTS:\s*((?:.|\n)*?)(?:$|(?:\n\n))"
+ )
+
+ def get_valid_values(self, attr):
+ """
+ Get the legal arguments for the setter associated with *attr*.
+
+ This is done by querying the docstring of the setter for a line that
+ begins with "ACCEPTS:" or ".. ACCEPTS:", and then by looking for a
+ numpydoc-style documentation for the setter's first argument.
+ """
+
+ name = 'set_%s' % attr
+ if not hasattr(self.o, name):
+ raise AttributeError('%s has no function %s' % (self.o, name))
+ func = getattr(self.o, name)
+
+ docstring = inspect.getdoc(func)
+ if docstring is None:
+ return 'unknown'
+
+ if docstring.startswith('Alias for '):
+ return None
+
+ match = self._get_valid_values_regex.search(docstring)
+ if match is not None:
+ return re.sub("\n *", " ", match.group(1))
+
+ # Much faster than list(inspect.signature(func).parameters)[1],
+ # although barely relevant wrt. matplotlib's total import time.
+ param_name = func.__code__.co_varnames[1]
+ # We could set the presence * based on whether the parameter is a
+ # varargs (it can't be a varkwargs) but it's not really worth the it.
+ match = re.search(r"(?m)^ *\*?{} : (.+)".format(param_name), docstring)
+ if match:
+ return match.group(1)
+
+ return 'unknown'
+
+ def _replace_path(self, source_class):
+ """
+ Changes the full path to the public API path that is used
+ in sphinx. This is needed for links to work.
+ """
+ replace_dict = {'_base._AxesBase': 'Axes',
+ '_axes.Axes': 'Axes'}
+ for key, value in replace_dict.items():
+ source_class = source_class.replace(key, value)
+ return source_class
+
+ def get_setters(self):
+ """
+ Get the attribute strings with setters for object.
+
+ For example, for a line, return ``['markerfacecolor', 'linewidth',
+ ....]``.
+ """
+ setters = []
+ for name in dir(self.o):
+ if not name.startswith('set_'):
+ continue
+ func = getattr(self.o, name)
+ if (not callable(func)
+ or len(inspect.signature(func).parameters) < 2
+ or self.is_alias(func)):
+ continue
+ setters.append(name[4:])
+ return setters
+
+ def is_alias(self, o):
+ """Return whether method object *o* is an alias for another method."""
+ ds = inspect.getdoc(o)
+ if ds is None:
+ return False
+ return ds.startswith('Alias for ')
+
+ def aliased_name(self, s):
+ """
+ Return 'PROPNAME or alias' if *s* has an alias, else return 'PROPNAME'.
+
+ e.g., for the line markerfacecolor property, which has an
+ alias, return 'markerfacecolor or mfc' and for the transform
+ property, which does not, return 'transform'.
+ """
+ aliases = ''.join(' or %s' % x for x in sorted(self.aliasd.get(s, [])))
+ return s + aliases
+
+ def aliased_name_rest(self, s, target):
+ """
+ Return 'PROPNAME or alias' if *s* has an alias, else return 'PROPNAME',
+ formatted for reST.
+
+ e.g., for the line markerfacecolor property, which has an
+ alias, return 'markerfacecolor or mfc' and for the transform
+ property, which does not, return 'transform'.
+ """
+ aliases = ''.join(' or %s' % x for x in sorted(self.aliasd.get(s, [])))
+ return ':meth:`%s <%s>`%s' % (s, target, aliases)
+
+ def pprint_setters(self, prop=None, leadingspace=2):
+ """
+ If *prop* is *None*, return a list of strings of all settable
+ properties and their valid values.
+
+ If *prop* is not *None*, it is a valid property name and that
+ property will be returned as a string of property : valid
+ values.
+ """
+ if leadingspace:
+ pad = ' ' * leadingspace
+ else:
+ pad = ''
+ if prop is not None:
+ accepts = self.get_valid_values(prop)
+ return '%s%s: %s' % (pad, prop, accepts)
+
+ lines = []
+ for prop in sorted(self.get_setters()):
+ accepts = self.get_valid_values(prop)
+ name = self.aliased_name(prop)
+ lines.append('%s%s: %s' % (pad, name, accepts))
+ return lines
+
+ def pprint_setters_rest(self, prop=None, leadingspace=4):
+ """
+ If *prop* is *None*, return a list of reST-formatted strings of all
+ settable properties and their valid values.
+
+ If *prop* is not *None*, it is a valid property name and that
+ property will be returned as a string of "property : valid"
+ values.
+ """
+ if leadingspace:
+ pad = ' ' * leadingspace
+ else:
+ pad = ''
+ if prop is not None:
+ accepts = self.get_valid_values(prop)
+ return '%s%s: %s' % (pad, prop, accepts)
+
+ prop_and_qualnames = []
+ for prop in sorted(self.get_setters()):
+ # Find the parent method which actually provides the docstring.
+ for cls in self.o.__mro__:
+ method = getattr(cls, f"set_{prop}", None)
+ if method and method.__doc__ is not None:
+ break
+ else: # No docstring available.
+ method = getattr(self.o, f"set_{prop}")
+ prop_and_qualnames.append(
+ (prop, f"{method.__module__}.{method.__qualname__}"))
+
+ names = [self.aliased_name_rest(prop, target)
+ .replace('_base._AxesBase', 'Axes')
+ .replace('_axes.Axes', 'Axes')
+ for prop, target in prop_and_qualnames]
+ accepts = [self.get_valid_values(prop)
+ for prop, _ in prop_and_qualnames]
+
+ col0_len = max(len(n) for n in names)
+ col1_len = max(len(a) for a in accepts)
+ table_formatstr = pad + ' ' + '=' * col0_len + ' ' + '=' * col1_len
+
+ return [
+ '',
+ pad + '.. table::',
+ pad + ' :class: property-table',
+ '',
+ table_formatstr,
+ pad + ' ' + 'Property'.ljust(col0_len)
+ + ' ' + 'Description'.ljust(col1_len),
+ table_formatstr,
+ *[pad + ' ' + n.ljust(col0_len) + ' ' + a.ljust(col1_len)
+ for n, a in zip(names, accepts)],
+ table_formatstr,
+ '',
+ ]
+
+ def properties(self):
+ """Return a dictionary mapping property name -> value."""
+ o = self.oorig
+ getters = [name for name in dir(o)
+ if name.startswith('get_') and callable(getattr(o, name))]
+ getters.sort()
+ d = {}
+ for name in getters:
+ func = getattr(o, name)
+ if self.is_alias(func):
+ continue
+ try:
+ with warnings.catch_warnings():
+ warnings.simplefilter('ignore')
+ val = func()
+ except Exception:
+ continue
+ else:
+ d[name[4:]] = val
+ return d
+
+ def pprint_getters(self):
+ """Return the getters and actual values as list of strings."""
+ lines = []
+ for name, val in sorted(self.properties().items()):
+ if getattr(val, 'shape', ()) != () and len(val) > 6:
+ s = str(val[:6]) + '...'
+ else:
+ s = str(val)
+ s = s.replace('\n', ' ')
+ if len(s) > 50:
+ s = s[:50] + '...'
+ name = self.aliased_name(name)
+ lines.append(' %s = %s' % (name, s))
+ return lines
+
+
+def getp(obj, property=None):
+ """
+ Return the value of an `.Artist`'s *property*, or print all of them.
+
+ Parameters
+ ----------
+ obj : `.Artist`
+ The queried artist; e.g., a `.Line2D`, a `.Text`, or an `~.axes.Axes`.
+
+ property : str or None, default: None
+ If *property* is 'somename', this function returns
+ ``obj.get_somename()``.
+
+ If is is None (or unset), it *prints* all gettable properties from
+ *obj*. Many properties have aliases for shorter typing, e.g. 'lw' is
+ an alias for 'linewidth'. In the output, aliases and full property
+ names will be listed as:
+
+ property or alias = value
+
+ e.g.:
+
+ linewidth or lw = 2
+
+ See Also
+ --------
+ setp
+ """
+ if property is None:
+ insp = ArtistInspector(obj)
+ ret = insp.pprint_getters()
+ print('\n'.join(ret))
+ return
+ return getattr(obj, 'get_' + property)()
+
+# alias
+get = getp
+
+
+def setp(obj, *args, file=None, **kwargs):
+ """
+ Set one or more properties on an `.Artist`, or list allowed values.
+
+ Parameters
+ ----------
+ obj : `.Artist` or list of `.Artist`
+ The artist(s) whose properties are being set or queried. When setting
+ properties, all artists are affected; when querying the allowed values,
+ only the first instance in the sequence is queried.
+
+ For example, two lines can be made thicker and red with a single call:
+
+ >>> x = arange(0, 1, 0.01)
+ >>> lines = plot(x, sin(2*pi*x), x, sin(4*pi*x))
+ >>> setp(lines, linewidth=2, color='r')
+
+ file : file-like, default: `sys.stdout`
+ Where `setp` writes its output when asked to list allowed values.
+
+ >>> with open('output.log') as file:
+ ... setp(line, file=file)
+
+ The default, ``None``, means `sys.stdout`.
+
+ *args, **kwargs
+ The properties to set. The following combinations are supported:
+
+ - Set the linestyle of a line to be dashed:
+
+ >>> line, = plot([1, 2, 3])
+ >>> setp(line, linestyle='--')
+
+ - Set multiple properties at once:
+
+ >>> setp(line, linewidth=2, color='r')
+
+ - List allowed values for a line's linestyle:
+
+ >>> setp(line, 'linestyle')
+ linestyle: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
+
+ - List all properties that can be set, and their allowed values:
+
+ >>> setp(line)
+ agg_filter: a filter function, ...
+ [long output listing omitted]
+
+ `setp` also supports MATLAB style string/value pairs. For example, the
+ following are equivalent:
+
+ >>> setp(lines, 'linewidth', 2, 'color', 'r') # MATLAB style
+ >>> setp(lines, linewidth=2, color='r') # Python style
+
+ See Also
+ --------
+ getp
+ """
+
+ if isinstance(obj, Artist):
+ objs = [obj]
+ else:
+ objs = list(cbook.flatten(obj))
+
+ if not objs:
+ return
+
+ insp = ArtistInspector(objs[0])
+
+ if not kwargs and len(args) < 2:
+ if args:
+ print(insp.pprint_setters(prop=args[0]), file=file)
+ else:
+ print('\n'.join(insp.pprint_setters()), file=file)
+ return
+
+ if len(args) % 2:
+ raise ValueError('The set args must be string, value pairs')
+
+ # put args into ordereddict to maintain order
+ funcvals = OrderedDict((k, v) for k, v in zip(args[::2], args[1::2]))
+ ret = [o.update(funcvals) for o in objs] + [o.set(**kwargs) for o in objs]
+ return list(cbook.flatten(ret))
+
+
+def kwdoc(artist):
+ r"""
+ Inspect an `~matplotlib.artist.Artist` class (using `.ArtistInspector`) and
+ return information about its settable properties and their current values.
+
+ Parameters
+ ----------
+ artist : `~matplotlib.artist.Artist` or an iterable of `Artist`\s
+
+ Returns
+ -------
+ str
+ The settable properties of *artist*, as plain text if
+ :rc:`docstring.hardcopy` is False and as a rst table (intended for
+ use in Sphinx) if it is True.
+ """
+ ai = ArtistInspector(artist)
+ return ('\n'.join(ai.pprint_setters_rest(leadingspace=4))
+ if mpl.rcParams['docstring.hardcopy'] else
+ 'Properties:\n' + '\n'.join(ai.pprint_setters(leadingspace=4)))
+
+
+docstring.interpd.update(Artist_kwdoc=kwdoc(Artist))
diff --git a/venv/Lib/site-packages/matplotlib/axes/__init__.py b/venv/Lib/site-packages/matplotlib/axes/__init__.py
new file mode 100644
index 0000000..4dd998c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/axes/__init__.py
@@ -0,0 +1,2 @@
+from ._subplots import *
+from ._axes import *
diff --git a/venv/Lib/site-packages/matplotlib/axes/_axes.py b/venv/Lib/site-packages/matplotlib/axes/_axes.py
new file mode 100644
index 0000000..9d59ed5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/axes/_axes.py
@@ -0,0 +1,8250 @@
+import functools
+import itertools
+import logging
+import math
+from numbers import Integral, Number
+
+import numpy as np
+from numpy import ma
+
+import matplotlib.category # Register category unit converter as side-effect.
+import matplotlib.cbook as cbook
+import matplotlib.collections as mcoll
+import matplotlib.colors as mcolors
+import matplotlib.contour as mcontour
+import matplotlib.dates # Register date unit converter as side-effect.
+import matplotlib.docstring as docstring
+import matplotlib.image as mimage
+import matplotlib.legend as mlegend
+import matplotlib.lines as mlines
+import matplotlib.markers as mmarkers
+import matplotlib.mlab as mlab
+import matplotlib.patches as mpatches
+import matplotlib.path as mpath
+import matplotlib.quiver as mquiver
+import matplotlib.stackplot as mstack
+import matplotlib.streamplot as mstream
+import matplotlib.table as mtable
+import matplotlib.text as mtext
+import matplotlib.ticker as mticker
+import matplotlib.transforms as mtransforms
+import matplotlib.tri as mtri
+import matplotlib.units as munits
+from matplotlib import _api, _preprocess_data, rcParams
+from matplotlib.axes._base import (
+ _AxesBase, _TransformedBoundsLocator, _process_plot_format)
+from matplotlib.axes._secondary_axes import SecondaryAxis
+from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer
+
+_log = logging.getLogger(__name__)
+
+
+# The axes module contains all the wrappers to plotting functions.
+# All the other methods should go in the _AxesBase class.
+
+
+class Axes(_AxesBase):
+ """
+ The `Axes` contains most of the figure elements: `~.axis.Axis`,
+ `~.axis.Tick`, `~.lines.Line2D`, `~.text.Text`, `~.patches.Polygon`, etc.,
+ and sets the coordinate system.
+
+ The `Axes` instance supports callbacks through a callbacks attribute which
+ is a `~.cbook.CallbackRegistry` instance. The events you can connect to
+ are 'xlim_changed' and 'ylim_changed' and the callback will be called with
+ func(*ax*) where *ax* is the `Axes` instance.
+
+ Attributes
+ ----------
+ dataLim : `.Bbox`
+ The bounding box enclosing all data displayed in the Axes.
+ viewLim : `.Bbox`
+ The view limits in data coordinates.
+
+ """
+ ### Labelling, legend and texts
+
+ def get_title(self, loc="center"):
+ """
+ Get an Axes title.
+
+ Get one of the three available Axes titles. The available titles
+ are positioned above the Axes in the center, flush with the left
+ edge, and flush with the right edge.
+
+ Parameters
+ ----------
+ loc : {'center', 'left', 'right'}, str, default: 'center'
+ Which title to return.
+
+ Returns
+ -------
+ str
+ The title text string.
+
+ """
+ titles = {'left': self._left_title,
+ 'center': self.title,
+ 'right': self._right_title}
+ title = _api.check_getitem(titles, loc=loc.lower())
+ return title.get_text()
+
+ def set_title(self, label, fontdict=None, loc=None, pad=None, *, y=None,
+ **kwargs):
+ """
+ Set a title for the Axes.
+
+ Set one of the three available Axes titles. The available titles
+ are positioned above the Axes in the center, flush with the left
+ edge, and flush with the right edge.
+
+ Parameters
+ ----------
+ label : str
+ Text to use for the title
+
+ fontdict : dict
+ A dictionary controlling the appearance of the title text,
+ the default *fontdict* is::
+
+ {'fontsize': rcParams['axes.titlesize'],
+ 'fontweight': rcParams['axes.titleweight'],
+ 'color': rcParams['axes.titlecolor'],
+ 'verticalalignment': 'baseline',
+ 'horizontalalignment': loc}
+
+ loc : {'center', 'left', 'right'}, default: :rc:`axes.titlelocation`
+ Which title to set.
+
+ y : float, default: :rc:`axes.titley`
+ Vertical Axes loation for the title (1.0 is the top). If
+ None (the default), y is determined automatically to avoid
+ decorators on the Axes.
+
+ pad : float, default: :rc:`axes.titlepad`
+ The offset of the title from the top of the Axes, in points.
+
+ Returns
+ -------
+ `.Text`
+ The matplotlib text instance representing the title
+
+ Other Parameters
+ ----------------
+ **kwargs : `.Text` properties
+ Other keyword arguments are text properties, see `.Text` for a list
+ of valid text properties.
+ """
+ if loc is None:
+ loc = rcParams['axes.titlelocation']
+
+ if y is None:
+ y = rcParams['axes.titley']
+ if y is None:
+ y = 1.0
+ else:
+ self._autotitlepos = False
+ kwargs['y'] = y
+
+ titles = {'left': self._left_title,
+ 'center': self.title,
+ 'right': self._right_title}
+ title = _api.check_getitem(titles, loc=loc.lower())
+ default = {
+ 'fontsize': rcParams['axes.titlesize'],
+ 'fontweight': rcParams['axes.titleweight'],
+ 'verticalalignment': 'baseline',
+ 'horizontalalignment': loc.lower()}
+ titlecolor = rcParams['axes.titlecolor']
+ if not cbook._str_lower_equal(titlecolor, 'auto'):
+ default["color"] = titlecolor
+ if pad is None:
+ pad = rcParams['axes.titlepad']
+ self._set_title_offset_trans(float(pad))
+ title.set_text(label)
+ title.update(default)
+ if fontdict is not None:
+ title.update(fontdict)
+ title.update(kwargs)
+ return title
+
+ def get_legend_handles_labels(self, legend_handler_map=None):
+ """
+ Return handles and labels for legend
+
+ ``ax.legend()`` is equivalent to ::
+
+ h, l = ax.get_legend_handles_labels()
+ ax.legend(h, l)
+ """
+ # pass through to legend.
+ handles, labels = mlegend._get_legend_handles_labels(
+ [self], legend_handler_map)
+ return handles, labels
+
+ @docstring.dedent_interpd
+ def legend(self, *args, **kwargs):
+ """
+ Place a legend on the Axes.
+
+ Call signatures::
+
+ legend()
+ legend(labels)
+ legend(handles, labels)
+
+ The call signatures correspond to these three different ways to use
+ this method:
+
+ **1. Automatic detection of elements to be shown in the legend**
+
+ The elements to be added to the legend are automatically determined,
+ when you do not pass in any extra arguments.
+
+ In this case, the labels are taken from the artist. You can specify
+ them either at artist creation or by calling the
+ :meth:`~.Artist.set_label` method on the artist::
+
+ ax.plot([1, 2, 3], label='Inline label')
+ ax.legend()
+
+ or::
+
+ line, = ax.plot([1, 2, 3])
+ line.set_label('Label via method')
+ ax.legend()
+
+ Specific lines can be excluded from the automatic legend element
+ selection by defining a label starting with an underscore.
+ This is default for all artists, so calling `.Axes.legend` without
+ any arguments and without setting the labels manually will result in
+ no legend being drawn.
+
+
+ **2. Labeling existing plot elements**
+
+ To make a legend for lines which already exist on the Axes
+ (via plot for instance), simply call this function with an iterable
+ of strings, one for each legend item. For example::
+
+ ax.plot([1, 2, 3])
+ ax.legend(['A simple line'])
+
+ Note: This call signature is discouraged, because the relation between
+ plot elements and labels is only implicit by their order and can
+ easily be mixed up.
+
+
+ **3. Explicitly defining the elements in the legend**
+
+ For full control of which artists have a legend entry, it is possible
+ to pass an iterable of legend artists followed by an iterable of
+ legend labels respectively::
+
+ ax.legend([line1, line2, line3], ['label1', 'label2', 'label3'])
+
+ Parameters
+ ----------
+ handles : sequence of `.Artist`, optional
+ A list of Artists (lines, patches) to be added to the legend.
+ Use this together with *labels*, if you need full control on what
+ is shown in the legend and the automatic mechanism described above
+ is not sufficient.
+
+ The length of handles and labels should be the same in this
+ case. If they are not, they are truncated to the smaller length.
+
+ labels : list of str, optional
+ A list of labels to show next to the artists.
+ Use this together with *handles*, if you need full control on what
+ is shown in the legend and the automatic mechanism described above
+ is not sufficient.
+
+ Returns
+ -------
+ `~matplotlib.legend.Legend`
+
+ Other Parameters
+ ----------------
+ %(_legend_kw_doc)s
+
+ See Also
+ --------
+ .Figure.legend
+
+ Notes
+ -----
+ Some artists are not supported by this function. See
+ :doc:`/tutorials/intermediate/legend_guide` for details.
+
+ Examples
+ --------
+ .. plot:: gallery/text_labels_and_annotations/legend.py
+ """
+ handles, labels, extra_args, kwargs = mlegend._parse_legend_args(
+ [self],
+ *args,
+ **kwargs)
+ if len(extra_args):
+ raise TypeError('legend only accepts two non-keyword arguments')
+ self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
+ self.legend_._remove_method = self._remove_legend
+ return self.legend_
+
+ def _remove_legend(self, legend):
+ self.legend_ = None
+
+ def inset_axes(self, bounds, *, transform=None, zorder=5, **kwargs):
+ """
+ Add a child inset Axes to this existing Axes.
+
+ Warnings
+ --------
+ This method is experimental as of 3.0, and the API may change.
+
+ Parameters
+ ----------
+ bounds : [x0, y0, width, height]
+ Lower-left corner of inset Axes, and its width and height.
+
+ transform : `.Transform`
+ Defaults to `ax.transAxes`, i.e. the units of *rect* are in
+ Axes-relative coordinates.
+
+ zorder : number
+ Defaults to 5 (same as `.Axes.legend`). Adjust higher or lower
+ to change whether it is above or below data plotted on the
+ parent Axes.
+
+ **kwargs
+ Other keyword arguments are passed on to the child `.Axes`.
+
+ Returns
+ -------
+ ax
+ The created `~.axes.Axes` instance.
+
+ Examples
+ --------
+ This example makes two inset Axes, the first is in Axes-relative
+ coordinates, and the second in data-coordinates::
+
+ fig, ax = plt.subplots()
+ ax.plot(range(10))
+ axin1 = ax.inset_axes([0.8, 0.1, 0.15, 0.15])
+ axin2 = ax.inset_axes(
+ [5, 7, 2.3, 2.3], transform=ax.transData)
+
+ """
+ if transform is None:
+ transform = self.transAxes
+ kwargs.setdefault('label', 'inset_axes')
+
+ # This puts the rectangle into figure-relative coordinates.
+ inset_locator = _TransformedBoundsLocator(bounds, transform)
+ bounds = inset_locator(self, None).bounds
+ inset_ax = Axes(self.figure, bounds, zorder=zorder, **kwargs)
+ # this locator lets the axes move if in data coordinates.
+ # it gets called in `ax.apply_aspect() (of all places)
+ inset_ax.set_axes_locator(inset_locator)
+
+ self.add_child_axes(inset_ax)
+
+ return inset_ax
+
+ @docstring.dedent_interpd
+ def indicate_inset(self, bounds, inset_ax=None, *, transform=None,
+ facecolor='none', edgecolor='0.5', alpha=0.5,
+ zorder=4.99, **kwargs):
+ """
+ Add an inset indicator to the Axes. This is a rectangle on the plot
+ at the position indicated by *bounds* that optionally has lines that
+ connect the rectangle to an inset Axes (`.Axes.inset_axes`).
+
+ Warnings
+ --------
+ This method is experimental as of 3.0, and the API may change.
+
+ Parameters
+ ----------
+ bounds : [x0, y0, width, height]
+ Lower-left corner of rectangle to be marked, and its width
+ and height.
+
+ inset_ax : `.Axes`
+ An optional inset Axes to draw connecting lines to. Two lines are
+ drawn connecting the indicator box to the inset Axes on corners
+ chosen so as to not overlap with the indicator box.
+
+ transform : `.Transform`
+ Transform for the rectangle coordinates. Defaults to
+ `ax.transAxes`, i.e. the units of *rect* are in Axes-relative
+ coordinates.
+
+ facecolor : color, default: 'none'
+ Facecolor of the rectangle.
+
+ edgecolor : color, default: '0.5'
+ Color of the rectangle and color of the connecting lines.
+
+ alpha : float, default: 0.5
+ Transparency of the rectangle and connector lines.
+
+ zorder : float, default: 4.99
+ Drawing order of the rectangle and connector lines. The default,
+ 4.99, is just below the default level of inset Axes.
+
+ **kwargs
+ Other keyword arguments are passed on to the `.Rectangle` patch:
+
+ %(Rectangle_kwdoc)s
+
+ Returns
+ -------
+ rectangle_patch : `.patches.Rectangle`
+ The indicator frame.
+
+ connector_lines : 4-tuple of `.patches.ConnectionPatch`
+ The four connector lines connecting to (lower_left, upper_left,
+ lower_right upper_right) corners of *inset_ax*. Two lines are
+ set with visibility to *False*, but the user can set the
+ visibility to True if the automatic choice is not deemed correct.
+
+ """
+ # to make the axes connectors work, we need to apply the aspect to
+ # the parent axes.
+ self.apply_aspect()
+
+ if transform is None:
+ transform = self.transData
+ kwargs.setdefault('label', '_indicate_inset')
+
+ x, y, width, height = bounds
+ rectangle_patch = mpatches.Rectangle(
+ (x, y), width, height,
+ facecolor=facecolor, edgecolor=edgecolor, alpha=alpha,
+ zorder=zorder, transform=transform, **kwargs)
+ self.add_patch(rectangle_patch)
+
+ connects = []
+
+ if inset_ax is not None:
+ # connect the inset_axes to the rectangle
+ for xy_inset_ax in [(0, 0), (0, 1), (1, 0), (1, 1)]:
+ # inset_ax positions are in axes coordinates
+ # The 0, 1 values define the four edges if the inset_ax
+ # lower_left, upper_left, lower_right upper_right.
+ ex, ey = xy_inset_ax
+ if self.xaxis.get_inverted():
+ ex = 1 - ex
+ if self.yaxis.get_inverted():
+ ey = 1 - ey
+ xy_data = x + ex * width, y + ey * height
+ p = mpatches.ConnectionPatch(
+ xyA=xy_inset_ax, coordsA=inset_ax.transAxes,
+ xyB=xy_data, coordsB=self.transData,
+ arrowstyle="-", zorder=zorder,
+ edgecolor=edgecolor, alpha=alpha)
+ connects.append(p)
+ self.add_patch(p)
+
+ # decide which two of the lines to keep visible....
+ pos = inset_ax.get_position()
+ bboxins = pos.transformed(self.figure.transSubfigure)
+ rectbbox = mtransforms.Bbox.from_bounds(
+ *bounds
+ ).transformed(transform)
+ x0 = rectbbox.x0 < bboxins.x0
+ x1 = rectbbox.x1 < bboxins.x1
+ y0 = rectbbox.y0 < bboxins.y0
+ y1 = rectbbox.y1 < bboxins.y1
+ connects[0].set_visible(x0 ^ y0)
+ connects[1].set_visible(x0 == y1)
+ connects[2].set_visible(x1 == y0)
+ connects[3].set_visible(x1 ^ y1)
+
+ return rectangle_patch, tuple(connects) if connects else None
+
+ def indicate_inset_zoom(self, inset_ax, **kwargs):
+ """
+ Add an inset indicator rectangle to the Axes based on the axis
+ limits for an *inset_ax* and draw connectors between *inset_ax*
+ and the rectangle.
+
+ Warnings
+ --------
+ This method is experimental as of 3.0, and the API may change.
+
+ Parameters
+ ----------
+ inset_ax : `.Axes`
+ Inset Axes to draw connecting lines to. Two lines are
+ drawn connecting the indicator box to the inset Axes on corners
+ chosen so as to not overlap with the indicator box.
+
+ **kwargs
+ Other keyword arguments are passed on to `.Axes.indicate_inset`
+
+ Returns
+ -------
+ rectangle_patch : `.patches.Rectangle`
+ Rectangle artist.
+
+ connector_lines : 4-tuple of `.patches.ConnectionPatch`
+ Each of four connector lines coming from the rectangle drawn on
+ this axis, in the order lower left, upper left, lower right,
+ upper right.
+ Two are set with visibility to *False*, but the user can
+ set the visibility to *True* if the automatic choice is not deemed
+ correct.
+ """
+
+ xlim = inset_ax.get_xlim()
+ ylim = inset_ax.get_ylim()
+ rect = (xlim[0], ylim[0], xlim[1] - xlim[0], ylim[1] - ylim[0])
+ return self.indicate_inset(rect, inset_ax, **kwargs)
+
+ @docstring.dedent_interpd
+ def secondary_xaxis(self, location, *, functions=None, **kwargs):
+ """
+ Add a second x-axis to this Axes.
+
+ For example if we want to have a second scale for the data plotted on
+ the xaxis.
+
+ %(_secax_docstring)s
+
+ Examples
+ --------
+ The main axis shows frequency, and the secondary axis shows period.
+
+ .. plot::
+
+ fig, ax = plt.subplots()
+ ax.loglog(range(1, 360, 5), range(1, 360, 5))
+ ax.set_xlabel('frequency [Hz]')
+
+ def invert(x):
+ # 1/x with special treatment of x == 0
+ x = np.array(x).astype(float)
+ near_zero = np.isclose(x, 0)
+ x[near_zero] = np.inf
+ x[~near_zero] = 1 / x[~near_zero]
+ return x
+
+ # the inverse of 1/x is itself
+ secax = ax.secondary_xaxis('top', functions=(invert, invert))
+ secax.set_xlabel('Period [s]')
+ plt.show()
+ """
+ if location in ['top', 'bottom'] or isinstance(location, Number):
+ secondary_ax = SecondaryAxis(self, 'x', location, functions,
+ **kwargs)
+ self.add_child_axes(secondary_ax)
+ return secondary_ax
+ else:
+ raise ValueError('secondary_xaxis location must be either '
+ 'a float or "top"/"bottom"')
+
+ @docstring.dedent_interpd
+ def secondary_yaxis(self, location, *, functions=None, **kwargs):
+ """
+ Add a second y-axis to this Axes.
+
+ For example if we want to have a second scale for the data plotted on
+ the yaxis.
+
+ %(_secax_docstring)s
+
+ Examples
+ --------
+ Add a secondary Axes that converts from radians to degrees
+
+ .. plot::
+
+ fig, ax = plt.subplots()
+ ax.plot(range(1, 360, 5), range(1, 360, 5))
+ ax.set_ylabel('degrees')
+ secax = ax.secondary_yaxis('right', functions=(np.deg2rad,
+ np.rad2deg))
+ secax.set_ylabel('radians')
+ """
+ if location in ['left', 'right'] or isinstance(location, Number):
+ secondary_ax = SecondaryAxis(self, 'y', location,
+ functions, **kwargs)
+ self.add_child_axes(secondary_ax)
+ return secondary_ax
+ else:
+ raise ValueError('secondary_yaxis location must be either '
+ 'a float or "left"/"right"')
+
+ @docstring.dedent_interpd
+ def text(self, x, y, s, fontdict=None, **kwargs):
+ """
+ Add text to the Axes.
+
+ Add the text *s* to the Axes at location *x*, *y* in data coordinates.
+
+ Parameters
+ ----------
+ x, y : float
+ The position to place the text. By default, this is in data
+ coordinates. The coordinate system can be changed using the
+ *transform* parameter.
+
+ s : str
+ The text.
+
+ fontdict : dict, default: None
+ A dictionary to override the default text properties. If fontdict
+ is None, the defaults are determined by `.rcParams`.
+
+ Returns
+ -------
+ `.Text`
+ The created `.Text` instance.
+
+ Other Parameters
+ ----------------
+ **kwargs : `~matplotlib.text.Text` properties.
+ Other miscellaneous text parameters.
+
+ %(Text_kwdoc)s
+
+ Examples
+ --------
+ Individual keyword arguments can be used to override any given
+ parameter::
+
+ >>> text(x, y, s, fontsize=12)
+
+ The default transform specifies that text is in data coords,
+ alternatively, you can specify text in axis coords ((0, 0) is
+ lower-left and (1, 1) is upper-right). The example below places
+ text in the center of the Axes::
+
+ >>> text(0.5, 0.5, 'matplotlib', horizontalalignment='center',
+ ... verticalalignment='center', transform=ax.transAxes)
+
+ You can put a rectangular box around the text instance (e.g., to
+ set a background color) by using the keyword *bbox*. *bbox* is
+ a dictionary of `~matplotlib.patches.Rectangle`
+ properties. For example::
+
+ >>> text(x, y, s, bbox=dict(facecolor='red', alpha=0.5))
+ """
+ effective_kwargs = {
+ 'verticalalignment': 'baseline',
+ 'horizontalalignment': 'left',
+ 'transform': self.transData,
+ 'clip_on': False,
+ **(fontdict if fontdict is not None else {}),
+ **kwargs,
+ }
+ t = mtext.Text(x, y, text=s, **effective_kwargs)
+ t.set_clip_path(self.patch)
+ self._add_text(t)
+ return t
+
+ @_api.rename_parameter("3.3", "s", "text")
+ @docstring.dedent_interpd
+ def annotate(self, text, xy, *args, **kwargs):
+ a = mtext.Annotation(text, xy, *args, **kwargs)
+ a.set_transform(mtransforms.IdentityTransform())
+ if 'clip_on' in kwargs:
+ a.set_clip_path(self.patch)
+ self._add_text(a)
+ return a
+ annotate.__doc__ = mtext.Annotation.__init__.__doc__
+ #### Lines and spans
+
+ @docstring.dedent_interpd
+ def axhline(self, y=0, xmin=0, xmax=1, **kwargs):
+ """
+ Add a horizontal line across the axis.
+
+ Parameters
+ ----------
+ y : float, default: 0
+ y position in data coordinates of the horizontal line.
+
+ xmin : float, default: 0
+ Should be between 0 and 1, 0 being the far left of the plot, 1 the
+ far right of the plot.
+
+ xmax : float, default: 1
+ Should be between 0 and 1, 0 being the far left of the plot, 1 the
+ far right of the plot.
+
+ Returns
+ -------
+ `~matplotlib.lines.Line2D`
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Valid keyword arguments are `.Line2D` properties, with the
+ exception of 'transform':
+
+ %(Line2D_kwdoc)s
+
+ See Also
+ --------
+ hlines : Add horizontal lines in data coordinates.
+ axhspan : Add a horizontal span (rectangle) across the axis.
+ axline : Add a line with an arbitrary slope.
+
+ Examples
+ --------
+ * draw a thick red hline at 'y' = 0 that spans the xrange::
+
+ >>> axhline(linewidth=4, color='r')
+
+ * draw a default hline at 'y' = 1 that spans the xrange::
+
+ >>> axhline(y=1)
+
+ * draw a default hline at 'y' = .5 that spans the middle half of
+ the xrange::
+
+ >>> axhline(y=.5, xmin=0.25, xmax=0.75)
+ """
+ self._check_no_units([xmin, xmax], ['xmin', 'xmax'])
+ if "transform" in kwargs:
+ raise ValueError("'transform' is not allowed as a keyword "
+ "argument; axhline generates its own transform.")
+ ymin, ymax = self.get_ybound()
+
+ # Strip away the units for comparison with non-unitized bounds.
+ yy, = self._process_unit_info([("y", y)], kwargs)
+ scaley = (yy < ymin) or (yy > ymax)
+
+ trans = self.get_yaxis_transform(which='grid')
+ l = mlines.Line2D([xmin, xmax], [y, y], transform=trans, **kwargs)
+ self.add_line(l)
+ self._request_autoscale_view(scalex=False, scaley=scaley)
+ return l
+
+ @docstring.dedent_interpd
+ def axvline(self, x=0, ymin=0, ymax=1, **kwargs):
+ """
+ Add a vertical line across the Axes.
+
+ Parameters
+ ----------
+ x : float, default: 0
+ x position in data coordinates of the vertical line.
+
+ ymin : float, default: 0
+ Should be between 0 and 1, 0 being the bottom of the plot, 1 the
+ top of the plot.
+
+ ymax : float, default: 1
+ Should be between 0 and 1, 0 being the bottom of the plot, 1 the
+ top of the plot.
+
+ Returns
+ -------
+ `~matplotlib.lines.Line2D`
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Valid keyword arguments are `.Line2D` properties, with the
+ exception of 'transform':
+
+ %(Line2D_kwdoc)s
+
+ See Also
+ --------
+ vlines : Add vertical lines in data coordinates.
+ axvspan : Add a vertical span (rectangle) across the axis.
+ axline : Add a line with an arbitrary slope.
+
+ Examples
+ --------
+ * draw a thick red vline at *x* = 0 that spans the yrange::
+
+ >>> axvline(linewidth=4, color='r')
+
+ * draw a default vline at *x* = 1 that spans the yrange::
+
+ >>> axvline(x=1)
+
+ * draw a default vline at *x* = .5 that spans the middle half of
+ the yrange::
+
+ >>> axvline(x=.5, ymin=0.25, ymax=0.75)
+ """
+ self._check_no_units([ymin, ymax], ['ymin', 'ymax'])
+ if "transform" in kwargs:
+ raise ValueError("'transform' is not allowed as a keyword "
+ "argument; axvline generates its own transform.")
+ xmin, xmax = self.get_xbound()
+
+ # Strip away the units for comparison with non-unitized bounds.
+ xx, = self._process_unit_info([("x", x)], kwargs)
+ scalex = (xx < xmin) or (xx > xmax)
+
+ trans = self.get_xaxis_transform(which='grid')
+ l = mlines.Line2D([x, x], [ymin, ymax], transform=trans, **kwargs)
+ self.add_line(l)
+ self._request_autoscale_view(scalex=scalex, scaley=False)
+ return l
+
+ @staticmethod
+ def _check_no_units(vals, names):
+ # Helper method to check that vals are not unitized
+ for val, name in zip(vals, names):
+ if not munits._is_natively_supported(val):
+ raise ValueError(f"{name} must be a single scalar value, "
+ f"but got {val}")
+
+ @docstring.dedent_interpd
+ def axline(self, xy1, xy2=None, *, slope=None, **kwargs):
+ """
+ Add an infinitely long straight line.
+
+ The line can be defined either by two points *xy1* and *xy2*, or
+ by one point *xy1* and a *slope*.
+
+ This draws a straight line "on the screen", regardless of the x and y
+ scales, and is thus also suitable for drawing exponential decays in
+ semilog plots, power laws in loglog plots, etc. However, *slope*
+ should only be used with linear scales; It has no clear meaning for
+ all other scales, and thus the behavior is undefined. Please specify
+ the line using the points *xy1*, *xy2* for non-linear scales.
+
+ The *transform* keyword argument only applies to the points *xy1*,
+ *xy2*. The *slope* (if given) is always in data coordinates. This can
+ be used e.g. with ``ax.transAxes`` for drawing grid lines with a fixed
+ slope.
+
+ Parameters
+ ----------
+ xy1, xy2 : (float, float)
+ Points for the line to pass through.
+ Either *xy2* or *slope* has to be given.
+ slope : float, optional
+ The slope of the line. Either *xy2* or *slope* has to be given.
+
+ Returns
+ -------
+ `.Line2D`
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Valid kwargs are `.Line2D` properties
+
+ %(Line2D_kwdoc)s
+
+ See Also
+ --------
+ axhline : for horizontal lines
+ axvline : for vertical lines
+
+ Examples
+ --------
+ Draw a thick red line passing through (0, 0) and (1, 1)::
+
+ >>> axline((0, 0), (1, 1), linewidth=4, color='r')
+ """
+ if slope is not None and (self.get_xscale() != 'linear' or
+ self.get_yscale() != 'linear'):
+ raise TypeError("'slope' cannot be used with non-linear scales")
+
+ datalim = [xy1] if xy2 is None else [xy1, xy2]
+ if "transform" in kwargs:
+ # if a transform is passed (i.e. line points not in data space),
+ # data limits should not be adjusted.
+ datalim = []
+
+ line = mlines._AxLine(xy1, xy2, slope, **kwargs)
+ # Like add_line, but correctly handling data limits.
+ self._set_artist_props(line)
+ if line.get_clip_path() is None:
+ line.set_clip_path(self.patch)
+ if not line.get_label():
+ line.set_label(f"_line{len(self.lines)}")
+ self.lines.append(line)
+ line._remove_method = self.lines.remove
+ self.update_datalim(datalim)
+
+ self._request_autoscale_view()
+ return line
+
+ @docstring.dedent_interpd
+ def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
+ """
+ Add a horizontal span (rectangle) across the Axes.
+
+ The rectangle spans from *ymin* to *ymax* vertically, and, by default,
+ the whole x-axis horizontally. The x-span can be set using *xmin*
+ (default: 0) and *xmax* (default: 1) which are in axis units; e.g.
+ ``xmin = 0.5`` always refers to the middle of the x-axis regardless of
+ the limits set by `~.Axes.set_xlim`.
+
+ Parameters
+ ----------
+ ymin : float
+ Lower y-coordinate of the span, in data units.
+ ymax : float
+ Upper y-coordinate of the span, in data units.
+ xmin : float, default: 0
+ Lower x-coordinate of the span, in x-axis (0-1) units.
+ xmax : float, default: 1
+ Upper x-coordinate of the span, in x-axis (0-1) units.
+
+ Returns
+ -------
+ `~matplotlib.patches.Polygon`
+ Horizontal span (rectangle) from (xmin, ymin) to (xmax, ymax).
+
+ Other Parameters
+ ----------------
+ **kwargs : `~matplotlib.patches.Polygon` properties
+
+ %(Polygon_kwdoc)s
+
+ See Also
+ --------
+ axvspan : Add a vertical span across the Axes.
+ """
+ # Strip units away.
+ self._check_no_units([xmin, xmax], ['xmin', 'xmax'])
+ (ymin, ymax), = self._process_unit_info([("y", [ymin, ymax])], kwargs)
+
+ verts = (xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)
+ p = mpatches.Polygon(verts, **kwargs)
+ p.set_transform(self.get_yaxis_transform(which="grid"))
+ self.add_patch(p)
+ self._request_autoscale_view(scalex=False)
+ return p
+
+ @docstring.dedent_interpd
+ def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
+ """
+ Add a vertical span (rectangle) across the Axes.
+
+ The rectangle spans from *xmin* to *xmax* horizontally, and, by
+ default, the whole y-axis vertically. The y-span can be set using
+ *ymin* (default: 0) and *ymax* (default: 1) which are in axis units;
+ e.g. ``ymin = 0.5`` always refers to the middle of the y-axis
+ regardless of the limits set by `~.Axes.set_ylim`.
+
+ Parameters
+ ----------
+ xmin : float
+ Lower x-coordinate of the span, in data units.
+ xmax : float
+ Upper x-coordinate of the span, in data units.
+ ymin : float, default: 0
+ Lower y-coordinate of the span, in y-axis units (0-1).
+ ymax : float, default: 1
+ Upper y-coordinate of the span, in y-axis units (0-1).
+
+ Returns
+ -------
+ `~matplotlib.patches.Polygon`
+ Vertical span (rectangle) from (xmin, ymin) to (xmax, ymax).
+
+ Other Parameters
+ ----------------
+ **kwargs : `~matplotlib.patches.Polygon` properties
+
+ %(Polygon_kwdoc)s
+
+ See Also
+ --------
+ axhspan : Add a horizontal span across the Axes.
+
+ Examples
+ --------
+ Draw a vertical, green, translucent rectangle from x = 1.25 to
+ x = 1.55 that spans the yrange of the Axes.
+
+ >>> axvspan(1.25, 1.55, facecolor='g', alpha=0.5)
+
+ """
+ # Strip units away.
+ self._check_no_units([ymin, ymax], ['ymin', 'ymax'])
+ (xmin, xmax), = self._process_unit_info([("x", [xmin, xmax])], kwargs)
+
+ verts = [(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)]
+ p = mpatches.Polygon(verts, **kwargs)
+ p.set_transform(self.get_xaxis_transform(which="grid"))
+ self.add_patch(p)
+ self._request_autoscale_view(scaley=False)
+ return p
+
+ @_preprocess_data(replace_names=["y", "xmin", "xmax", "colors"],
+ label_namer="y")
+ def hlines(self, y, xmin, xmax, colors=None, linestyles='solid',
+ label='', **kwargs):
+ """
+ Plot horizontal lines at each *y* from *xmin* to *xmax*.
+
+ Parameters
+ ----------
+ y : float or array-like
+ y-indexes where to plot the lines.
+
+ xmin, xmax : float or array-like
+ Respective beginning and end of each line. If scalars are
+ provided, all lines will have same length.
+
+ colors : list of colors, default: :rc:`lines.color`
+
+ linestyles : {'solid', 'dashed', 'dashdot', 'dotted'}, optional
+
+ label : str, default: ''
+
+ Returns
+ -------
+ `~matplotlib.collections.LineCollection`
+
+ Other Parameters
+ ----------------
+ **kwargs : `~matplotlib.collections.LineCollection` properties.
+
+ See Also
+ --------
+ vlines : vertical lines
+ axhline : horizontal line across the Axes
+ """
+
+ # We do the conversion first since not all unitized data is uniform
+ xmin, xmax, y = self._process_unit_info(
+ [("x", xmin), ("x", xmax), ("y", y)], kwargs)
+
+ if not np.iterable(y):
+ y = [y]
+ if not np.iterable(xmin):
+ xmin = [xmin]
+ if not np.iterable(xmax):
+ xmax = [xmax]
+
+ # Create and combine masked_arrays from input
+ y, xmin, xmax = cbook._combine_masks(y, xmin, xmax)
+ y = np.ravel(y)
+ xmin = np.ravel(xmin)
+ xmax = np.ravel(xmax)
+
+ masked_verts = np.ma.empty((len(y), 2, 2))
+ masked_verts[:, 0, 0] = xmin
+ masked_verts[:, 0, 1] = y
+ masked_verts[:, 1, 0] = xmax
+ masked_verts[:, 1, 1] = y
+
+ lines = mcoll.LineCollection(masked_verts, colors=colors,
+ linestyles=linestyles, label=label)
+ self.add_collection(lines, autolim=False)
+ lines.update(kwargs)
+
+ if len(y) > 0:
+ minx = min(xmin.min(), xmax.min())
+ maxx = max(xmin.max(), xmax.max())
+ miny = y.min()
+ maxy = y.max()
+
+ corners = (minx, miny), (maxx, maxy)
+
+ self.update_datalim(corners)
+ self._request_autoscale_view()
+
+ return lines
+
+ @_preprocess_data(replace_names=["x", "ymin", "ymax", "colors"],
+ label_namer="x")
+ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
+ label='', **kwargs):
+ """
+ Plot vertical lines at each *x* from *ymin* to *ymax*.
+
+ Parameters
+ ----------
+ x : float or array-like
+ x-indexes where to plot the lines.
+
+ ymin, ymax : float or array-like
+ Respective beginning and end of each line. If scalars are
+ provided, all lines will have same length.
+
+ colors : list of colors, default: :rc:`lines.color`
+
+ linestyles : {'solid', 'dashed', 'dashdot', 'dotted'}, optional
+
+ label : str, default: ''
+
+ Returns
+ -------
+ `~matplotlib.collections.LineCollection`
+
+ Other Parameters
+ ----------------
+ **kwargs : `~matplotlib.collections.LineCollection` properties.
+
+ See Also
+ --------
+ hlines : horizontal lines
+ axvline : vertical line across the Axes
+ """
+
+ # We do the conversion first since not all unitized data is uniform
+ x, ymin, ymax = self._process_unit_info(
+ [("x", x), ("y", ymin), ("y", ymax)], kwargs)
+
+ if not np.iterable(x):
+ x = [x]
+ if not np.iterable(ymin):
+ ymin = [ymin]
+ if not np.iterable(ymax):
+ ymax = [ymax]
+
+ # Create and combine masked_arrays from input
+ x, ymin, ymax = cbook._combine_masks(x, ymin, ymax)
+ x = np.ravel(x)
+ ymin = np.ravel(ymin)
+ ymax = np.ravel(ymax)
+
+ masked_verts = np.ma.empty((len(x), 2, 2))
+ masked_verts[:, 0, 0] = x
+ masked_verts[:, 0, 1] = ymin
+ masked_verts[:, 1, 0] = x
+ masked_verts[:, 1, 1] = ymax
+
+ lines = mcoll.LineCollection(masked_verts, colors=colors,
+ linestyles=linestyles, label=label)
+ self.add_collection(lines, autolim=False)
+ lines.update(kwargs)
+
+ if len(x) > 0:
+ minx = x.min()
+ maxx = x.max()
+ miny = min(ymin.min(), ymax.min())
+ maxy = max(ymin.max(), ymax.max())
+
+ corners = (minx, miny), (maxx, maxy)
+ self.update_datalim(corners)
+ self._request_autoscale_view()
+
+ return lines
+
+ @_preprocess_data(replace_names=["positions", "lineoffsets",
+ "linelengths", "linewidths",
+ "colors", "linestyles"])
+ @docstring.dedent_interpd
+ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
+ linelengths=1, linewidths=None, colors=None,
+ linestyles='solid', **kwargs):
+ """
+ Plot identical parallel lines at the given positions.
+
+ This type of plot is commonly used in neuroscience for representing
+ neural events, where it is usually called a spike raster, dot raster,
+ or raster plot.
+
+ However, it is useful in any situation where you wish to show the
+ timing or position of multiple sets of discrete events, such as the
+ arrival times of people to a business on each day of the month or the
+ date of hurricanes each year of the last century.
+
+ Parameters
+ ----------
+ positions : array-like or list of array-like
+ A 1D array-like defines the positions of one sequence of events.
+
+ Multiple groups of events may be passed as a list of array-likes.
+ Each group can be styled independently by passing lists of values
+ to *lineoffsets*, *linelengths*, *linewidths*, *colors* and
+ *linestyles*.
+
+ Note that *positions* can be a 2D array, but in practice different
+ event groups usually have different counts so that one will use a
+ list of different-length arrays rather than a 2D array.
+
+ orientation : {'horizontal', 'vertical'}, default: 'horizontal'
+ The direction of the event sequence:
+
+ - 'horizontal': the events are arranged horizontally.
+ The indicator lines are vertical.
+ - 'vertical': the events are arranged vertically.
+ The indicator lines are horizontal.
+
+ lineoffsets : float or array-like, default: 1
+ The offset of the center of the lines from the origin, in the
+ direction orthogonal to *orientation*.
+
+ If *positions* is 2D, this can be a sequence with length matching
+ the length of *positions*.
+
+ linelengths : float or array-like, default: 1
+ The total height of the lines (i.e. the lines stretches from
+ ``lineoffset - linelength/2`` to ``lineoffset + linelength/2``).
+
+ If *positions* is 2D, this can be a sequence with length matching
+ the length of *positions*.
+
+ linewidths : float or array-like, default: :rc:`lines.linewidth`
+ The line width(s) of the event lines, in points.
+
+ If *positions* is 2D, this can be a sequence with length matching
+ the length of *positions*.
+
+ colors : color or list of colors, default: :rc:`lines.color`
+ The color(s) of the event lines.
+
+ If *positions* is 2D, this can be a sequence with length matching
+ the length of *positions*.
+
+ linestyles : str or tuple or list of such values, default: 'solid'
+ Default is 'solid'. Valid strings are ['solid', 'dashed',
+ 'dashdot', 'dotted', '-', '--', '-.', ':']. Dash tuples
+ should be of the form::
+
+ (offset, onoffseq),
+
+ where *onoffseq* is an even length tuple of on and off ink
+ in points.
+
+ If *positions* is 2D, this can be a sequence with length matching
+ the length of *positions*.
+
+ **kwargs
+ Other keyword arguments are line collection properties. See
+ `.LineCollection` for a list of the valid properties.
+
+ Returns
+ -------
+ list of `.EventCollection`
+ The `.EventCollection` that were added.
+
+ Notes
+ -----
+ For *linelengths*, *linewidths*, *colors*, and *linestyles*, if only
+ a single value is given, that value is applied to all lines. If an
+ array-like is given, it must have the same length as *positions*, and
+ each value will be applied to the corresponding row of the array.
+
+ Examples
+ --------
+ .. plot:: gallery/lines_bars_and_markers/eventplot_demo.py
+ """
+ # We do the conversion first since not all unitized data is uniform
+ positions, lineoffsets, linelengths = self._process_unit_info(
+ [("x", positions), ("y", lineoffsets), ("y", linelengths)], kwargs)
+
+ if not np.iterable(positions):
+ positions = [positions]
+ elif any(np.iterable(position) for position in positions):
+ positions = [np.asanyarray(position) for position in positions]
+ else:
+ positions = [np.asanyarray(positions)]
+
+ if len(positions) == 0:
+ return []
+
+ # prevent 'singular' keys from **kwargs dict from overriding the effect
+ # of 'plural' keyword arguments (e.g. 'color' overriding 'colors')
+ colors = cbook._local_over_kwdict(colors, kwargs, 'color')
+ linewidths = cbook._local_over_kwdict(linewidths, kwargs, 'linewidth')
+ linestyles = cbook._local_over_kwdict(linestyles, kwargs, 'linestyle')
+
+ if not np.iterable(lineoffsets):
+ lineoffsets = [lineoffsets]
+ if not np.iterable(linelengths):
+ linelengths = [linelengths]
+ if not np.iterable(linewidths):
+ linewidths = [linewidths]
+ if not np.iterable(colors):
+ colors = [colors]
+ if hasattr(linestyles, 'lower') or not np.iterable(linestyles):
+ linestyles = [linestyles]
+
+ lineoffsets = np.asarray(lineoffsets)
+ linelengths = np.asarray(linelengths)
+ linewidths = np.asarray(linewidths)
+
+ if len(lineoffsets) == 0:
+ lineoffsets = [None]
+ if len(linelengths) == 0:
+ linelengths = [None]
+ if len(linewidths) == 0:
+ lineoffsets = [None]
+ if len(linewidths) == 0:
+ lineoffsets = [None]
+ if len(colors) == 0:
+ colors = [None]
+ try:
+ # Early conversion of the colors into RGBA values to take care
+ # of cases like colors='0.5' or colors='C1'. (Issue #8193)
+ colors = mcolors.to_rgba_array(colors)
+ except ValueError:
+ # Will fail if any element of *colors* is None. But as long
+ # as len(colors) == 1 or len(positions), the rest of the
+ # code should process *colors* properly.
+ pass
+
+ if len(lineoffsets) == 1 and len(positions) != 1:
+ lineoffsets = np.tile(lineoffsets, len(positions))
+ lineoffsets[0] = 0
+ lineoffsets = np.cumsum(lineoffsets)
+ if len(linelengths) == 1:
+ linelengths = np.tile(linelengths, len(positions))
+ if len(linewidths) == 1:
+ linewidths = np.tile(linewidths, len(positions))
+ if len(colors) == 1:
+ colors = list(colors)
+ colors = colors * len(positions)
+ if len(linestyles) == 1:
+ linestyles = [linestyles] * len(positions)
+
+ if len(lineoffsets) != len(positions):
+ raise ValueError('lineoffsets and positions are unequal sized '
+ 'sequences')
+ if len(linelengths) != len(positions):
+ raise ValueError('linelengths and positions are unequal sized '
+ 'sequences')
+ if len(linewidths) != len(positions):
+ raise ValueError('linewidths and positions are unequal sized '
+ 'sequences')
+ if len(colors) != len(positions):
+ raise ValueError('colors and positions are unequal sized '
+ 'sequences')
+ if len(linestyles) != len(positions):
+ raise ValueError('linestyles and positions are unequal sized '
+ 'sequences')
+
+ colls = []
+ for position, lineoffset, linelength, linewidth, color, linestyle in \
+ zip(positions, lineoffsets, linelengths, linewidths,
+ colors, linestyles):
+ coll = mcoll.EventCollection(position,
+ orientation=orientation,
+ lineoffset=lineoffset,
+ linelength=linelength,
+ linewidth=linewidth,
+ color=color,
+ linestyle=linestyle)
+ self.add_collection(coll, autolim=False)
+ coll.update(kwargs)
+ colls.append(coll)
+
+ if len(positions) > 0:
+ # try to get min/max
+ min_max = [(np.min(_p), np.max(_p)) for _p in positions
+ if len(_p) > 0]
+ # if we have any non-empty positions, try to autoscale
+ if len(min_max) > 0:
+ mins, maxes = zip(*min_max)
+ minpos = np.min(mins)
+ maxpos = np.max(maxes)
+
+ minline = (lineoffsets - linelengths).min()
+ maxline = (lineoffsets + linelengths).max()
+
+ if (orientation is not None and
+ orientation.lower() == "vertical"):
+ corners = (minline, minpos), (maxline, maxpos)
+ else: # "horizontal", None or "none" (see EventCollection)
+ corners = (minpos, minline), (maxpos, maxline)
+ self.update_datalim(corners)
+ self._request_autoscale_view()
+
+ return colls
+
+ #### Basic plotting
+
+ # Uses a custom implementation of data-kwarg handling in
+ # _process_plot_var_args.
+ @docstring.dedent_interpd
+ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
+ """
+ Plot y versus x as lines and/or markers.
+
+ Call signatures::
+
+ plot([x], y, [fmt], *, data=None, **kwargs)
+ plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
+
+ The coordinates of the points or line nodes are given by *x*, *y*.
+
+ The optional parameter *fmt* is a convenient way for defining basic
+ formatting like color, marker and linestyle. It's a shortcut string
+ notation described in the *Notes* section below.
+
+ >>> plot(x, y) # plot x and y using default line style and color
+ >>> plot(x, y, 'bo') # plot x and y using blue circle markers
+ >>> plot(y) # plot y using x as index array 0..N-1
+ >>> plot(y, 'r+') # ditto, but with red plusses
+
+ You can use `.Line2D` properties as keyword arguments for more
+ control on the appearance. Line properties and *fmt* can be mixed.
+ The following two calls yield identical results:
+
+ >>> plot(x, y, 'go--', linewidth=2, markersize=12)
+ >>> plot(x, y, color='green', marker='o', linestyle='dashed',
+ ... linewidth=2, markersize=12)
+
+ When conflicting with *fmt*, keyword arguments take precedence.
+
+
+ **Plotting labelled data**
+
+ There's a convenient way for plotting objects with labelled data (i.e.
+ data that can be accessed by index ``obj['y']``). Instead of giving
+ the data in *x* and *y*, you can provide the object in the *data*
+ parameter and just give the labels for *x* and *y*::
+
+ >>> plot('xlabel', 'ylabel', data=obj)
+
+ All indexable objects are supported. This could e.g. be a `dict`, a
+ `pandas.DataFrame` or a structured numpy array.
+
+
+ **Plotting multiple sets of data**
+
+ There are various ways to plot multiple sets of data.
+
+ - The most straight forward way is just to call `plot` multiple times.
+ Example:
+
+ >>> plot(x1, y1, 'bo')
+ >>> plot(x2, y2, 'go')
+
+ - If *x* and/or *y* are 2D arrays a separate data set will be drawn
+ for every column. If both *x* and *y* are 2D, they must have the
+ same shape. If only one of them is 2D with shape (N, m) the other
+ must have length N and will be used for every data set m.
+
+ Example:
+
+ >>> x = [1, 2, 3]
+ >>> y = np.array([[1, 2], [3, 4], [5, 6]])
+ >>> plot(x, y)
+
+ is equivalent to:
+
+ >>> for col in range(y.shape[1]):
+ ... plot(x, y[:, col])
+
+ - The third way is to specify multiple sets of *[x]*, *y*, *[fmt]*
+ groups::
+
+ >>> plot(x1, y1, 'g^', x2, y2, 'g-')
+
+ In this case, any additional keyword argument applies to all
+ datasets. Also this syntax cannot be combined with the *data*
+ parameter.
+
+ By default, each line is assigned a different style specified by a
+ 'style cycle'. The *fmt* and line property parameters are only
+ necessary if you want explicit deviations from these defaults.
+ Alternatively, you can also change the style cycle using
+ :rc:`axes.prop_cycle`.
+
+
+ Parameters
+ ----------
+ x, y : array-like or scalar
+ The horizontal / vertical coordinates of the data points.
+ *x* values are optional and default to ``range(len(y))``.
+
+ Commonly, these parameters are 1D arrays.
+
+ They can also be scalars, or two-dimensional (in that case, the
+ columns represent separate data sets).
+
+ These arguments cannot be passed as keywords.
+
+ fmt : str, optional
+ A format string, e.g. 'ro' for red circles. See the *Notes*
+ section for a full description of the format strings.
+
+ Format strings are just an abbreviation for quickly setting
+ basic line properties. All of these and more can also be
+ controlled by keyword arguments.
+
+ This argument cannot be passed as keyword.
+
+ data : indexable object, optional
+ An object with labelled data. If given, provide the label names to
+ plot in *x* and *y*.
+
+ .. note::
+ Technically there's a slight ambiguity in calls where the
+ second label is a valid *fmt*. ``plot('n', 'o', data=obj)``
+ could be ``plt(x, y)`` or ``plt(y, fmt)``. In such cases,
+ the former interpretation is chosen, but a warning is issued.
+ You may suppress the warning by adding an empty format string
+ ``plot('n', 'o', '', data=obj)``.
+
+ Returns
+ -------
+ list of `.Line2D`
+ A list of lines representing the plotted data.
+
+ Other Parameters
+ ----------------
+ scalex, scaley : bool, default: True
+ These parameters determine if the view limits are adapted to the
+ data limits. The values are passed on to `autoscale_view`.
+
+ **kwargs : `.Line2D` properties, optional
+ *kwargs* are used to specify properties like a line label (for
+ auto legends), linewidth, antialiasing, marker face color.
+ Example::
+
+ >>> plot([1, 2, 3], [1, 2, 3], 'go-', label='line 1', linewidth=2)
+ >>> plot([1, 2, 3], [1, 4, 9], 'rs', label='line 2')
+
+ If you specify multiple lines with one plot call, the kwargs apply
+ to all those lines. In case the label object is iterable, each
+ element is used as labels for each set of data.
+
+ Here is a list of available `.Line2D` properties:
+
+ %(Line2D_kwdoc)s
+
+ See Also
+ --------
+ scatter : XY scatter plot with markers of varying size and/or color (
+ sometimes also called bubble chart).
+
+ Notes
+ -----
+ **Format Strings**
+
+ A format string consists of a part for color, marker and line::
+
+ fmt = '[marker][line][color]'
+
+ Each of them is optional. If not provided, the value from the style
+ cycle is used. Exception: If ``line`` is given, but no ``marker``,
+ the data will be a line without markers.
+
+ Other combinations such as ``[color][marker][line]`` are also
+ supported, but note that their parsing may be ambiguous.
+
+ **Markers**
+
+ ============= ===============================
+ character description
+ ============= ===============================
+ ``'.'`` point marker
+ ``','`` pixel marker
+ ``'o'`` circle marker
+ ``'v'`` triangle_down marker
+ ``'^'`` triangle_up marker
+ ``'<'`` triangle_left marker
+ ``'>'`` triangle_right marker
+ ``'1'`` tri_down marker
+ ``'2'`` tri_up marker
+ ``'3'`` tri_left marker
+ ``'4'`` tri_right marker
+ ``'8'`` octagon marker
+ ``'s'`` square marker
+ ``'p'`` pentagon marker
+ ``'P'`` plus (filled) marker
+ ``'*'`` star marker
+ ``'h'`` hexagon1 marker
+ ``'H'`` hexagon2 marker
+ ``'+'`` plus marker
+ ``'x'`` x marker
+ ``'X'`` x (filled) marker
+ ``'D'`` diamond marker
+ ``'d'`` thin_diamond marker
+ ``'|'`` vline marker
+ ``'_'`` hline marker
+ ============= ===============================
+
+ **Line Styles**
+
+ ============= ===============================
+ character description
+ ============= ===============================
+ ``'-'`` solid line style
+ ``'--'`` dashed line style
+ ``'-.'`` dash-dot line style
+ ``':'`` dotted line style
+ ============= ===============================
+
+ Example format strings::
+
+ 'b' # blue markers with default shape
+ 'or' # red circles
+ '-g' # green solid line
+ '--' # dashed line with default color
+ '^k:' # black triangle_up markers connected by a dotted line
+
+ **Colors**
+
+ The supported color abbreviations are the single letter codes
+
+ ============= ===============================
+ character color
+ ============= ===============================
+ ``'b'`` blue
+ ``'g'`` green
+ ``'r'`` red
+ ``'c'`` cyan
+ ``'m'`` magenta
+ ``'y'`` yellow
+ ``'k'`` black
+ ``'w'`` white
+ ============= ===============================
+
+ and the ``'CN'`` colors that index into the default property cycle.
+
+ If the color is the only part of the format string, you can
+ additionally use any `matplotlib.colors` spec, e.g. full names
+ (``'green'``) or hex strings (``'#008000'``).
+ """
+ kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
+ lines = [*self._get_lines(*args, data=data, **kwargs)]
+ for line in lines:
+ self.add_line(line)
+ self._request_autoscale_view(scalex=scalex, scaley=scaley)
+ return lines
+
+ @_preprocess_data(replace_names=["x", "y"], label_namer="y")
+ @docstring.dedent_interpd
+ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
+ **kwargs):
+ """
+ Plot co-ercing the axis to treat floats as dates.
+
+ Similar to `.plot`, this plots *y* vs. *x* as lines or markers.
+ However, the axis labels are formatted as dates depending on *xdate*
+ and *ydate*. Note that `.plot` will work with `datetime` and
+ `numpy.datetime64` objects without resorting to this method.
+
+ Parameters
+ ----------
+ x, y : array-like
+ The coordinates of the data points. If *xdate* or *ydate* is
+ *True*, the respective values *x* or *y* are interpreted as
+ :ref:`Matplotlib dates `.
+
+ fmt : str, optional
+ The plot format string. For details, see the corresponding
+ parameter in `.plot`.
+
+ tz : timezone string or `datetime.tzinfo`, default: :rc:`timezone`
+ The time zone to use in labeling dates.
+
+ xdate : bool, default: True
+ If *True*, the *x*-axis will be interpreted as Matplotlib dates.
+
+ ydate : bool, default: False
+ If *True*, the *y*-axis will be interpreted as Matplotlib dates.
+
+ Returns
+ -------
+ list of `~.Line2D`
+ Objects representing the plotted data.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Keyword arguments control the `.Line2D` properties:
+
+ %(Line2D_kwdoc)s
+
+ See Also
+ --------
+ matplotlib.dates : Helper functions on dates.
+ matplotlib.dates.date2num : Convert dates to num.
+ matplotlib.dates.num2date : Convert num to dates.
+ matplotlib.dates.drange : Create an equally spaced sequence of dates.
+
+ Notes
+ -----
+ If you are using custom date tickers and formatters, it may be
+ necessary to set the formatters/locators after the call to
+ `.plot_date`. `.plot_date` will set the default tick locator to
+ `.AutoDateLocator` (if the tick locator is not already set to a
+ `.DateLocator` instance) and the default tick formatter to
+ `.AutoDateFormatter` (if the tick formatter is not already set to a
+ `.DateFormatter` instance).
+ """
+ if xdate:
+ self.xaxis_date(tz)
+ if ydate:
+ self.yaxis_date(tz)
+ return self.plot(x, y, fmt, **kwargs)
+
+ # @_preprocess_data() # let 'plot' do the unpacking..
+ @docstring.dedent_interpd
+ def loglog(self, *args, **kwargs):
+ """
+ Make a plot with log scaling on both the x and y axis.
+
+ Call signatures::
+
+ loglog([x], y, [fmt], data=None, **kwargs)
+ loglog([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
+
+ This is just a thin wrapper around `.plot` which additionally changes
+ both the x-axis and the y-axis to log scaling. All of the concepts and
+ parameters of plot can be used here as well.
+
+ The additional parameters *base*, *subs* and *nonpositive* control the
+ x/y-axis properties. They are just forwarded to `.Axes.set_xscale` and
+ `.Axes.set_yscale`. To use different properties on the x-axis and the
+ y-axis, use e.g.
+ ``ax.set_xscale("log", base=10); ax.set_yscale("log", base=2)``.
+
+ Parameters
+ ----------
+ base : float, default: 10
+ Base of the logarithm.
+
+ subs : sequence, optional
+ The location of the minor ticks. If *None*, reasonable locations
+ are automatically chosen depending on the number of decades in the
+ plot. See `.Axes.set_xscale`/`.Axes.set_yscale` for details.
+
+ nonpositive : {'mask', 'clip'}, default: 'mask'
+ Non-positive values can be masked as invalid, or clipped to a very
+ small positive number.
+
+ Returns
+ -------
+ list of `~.Line2D`
+ Objects representing the plotted data.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ All parameters supported by `.plot`.
+ """
+ dx = {k: v for k, v in kwargs.items()
+ if k in ['base', 'subs', 'nonpositive',
+ 'basex', 'subsx', 'nonposx']}
+ self.set_xscale('log', **dx)
+ dy = {k: v for k, v in kwargs.items()
+ if k in ['base', 'subs', 'nonpositive',
+ 'basey', 'subsy', 'nonposy']}
+ self.set_yscale('log', **dy)
+ return self.plot(
+ *args, **{k: v for k, v in kwargs.items() if k not in {*dx, *dy}})
+
+ # @_preprocess_data() # let 'plot' do the unpacking..
+ @docstring.dedent_interpd
+ def semilogx(self, *args, **kwargs):
+ """
+ Make a plot with log scaling on the x axis.
+
+ Call signatures::
+
+ semilogx([x], y, [fmt], data=None, **kwargs)
+ semilogx([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
+
+ This is just a thin wrapper around `.plot` which additionally changes
+ the x-axis to log scaling. All of the concepts and parameters of plot
+ can be used here as well.
+
+ The additional parameters *base*, *subs*, and *nonpositive* control the
+ x-axis properties. They are just forwarded to `.Axes.set_xscale`.
+
+ Parameters
+ ----------
+ base : float, default: 10
+ Base of the x logarithm.
+
+ subs : array-like, optional
+ The location of the minor xticks. If *None*, reasonable locations
+ are automatically chosen depending on the number of decades in the
+ plot. See `.Axes.set_xscale` for details.
+
+ nonpositive : {'mask', 'clip'}, default: 'mask'
+ Non-positive values in x can be masked as invalid, or clipped to a
+ very small positive number.
+
+ Returns
+ -------
+ list of `~.Line2D`
+ Objects representing the plotted data.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ All parameters supported by `.plot`.
+ """
+ d = {k: v for k, v in kwargs.items()
+ if k in ['base', 'subs', 'nonpositive',
+ 'basex', 'subsx', 'nonposx']}
+ self.set_xscale('log', **d)
+ return self.plot(
+ *args, **{k: v for k, v in kwargs.items() if k not in d})
+
+ # @_preprocess_data() # let 'plot' do the unpacking..
+ @docstring.dedent_interpd
+ def semilogy(self, *args, **kwargs):
+ """
+ Make a plot with log scaling on the y axis.
+
+ Call signatures::
+
+ semilogy([x], y, [fmt], data=None, **kwargs)
+ semilogy([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
+
+ This is just a thin wrapper around `.plot` which additionally changes
+ the y-axis to log scaling. All of the concepts and parameters of plot
+ can be used here as well.
+
+ The additional parameters *base*, *subs*, and *nonpositive* control the
+ y-axis properties. They are just forwarded to `.Axes.set_yscale`.
+
+ Parameters
+ ----------
+ base : float, default: 10
+ Base of the y logarithm.
+
+ subs : array-like, optional
+ The location of the minor yticks. If *None*, reasonable locations
+ are automatically chosen depending on the number of decades in the
+ plot. See `.Axes.set_yscale` for details.
+
+ nonpositive : {'mask', 'clip'}, default: 'mask'
+ Non-positive values in y can be masked as invalid, or clipped to a
+ very small positive number.
+
+ Returns
+ -------
+ list of `~.Line2D`
+ Objects representing the plotted data.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ All parameters supported by `.plot`.
+ """
+ d = {k: v for k, v in kwargs.items()
+ if k in ['base', 'subs', 'nonpositive',
+ 'basey', 'subsy', 'nonposy']}
+ self.set_yscale('log', **d)
+ return self.plot(
+ *args, **{k: v for k, v in kwargs.items() if k not in d})
+
+ @_preprocess_data(replace_names=["x"], label_namer="x")
+ def acorr(self, x, **kwargs):
+ """
+ Plot the autocorrelation of *x*.
+
+ Parameters
+ ----------
+ x : array-like
+
+ detrend : callable, default: `.mlab.detrend_none` (no detrending)
+ A detrending function applied to *x*. It must have the
+ signature ::
+
+ detrend(x: np.ndarray) -> np.ndarray
+
+ normed : bool, default: True
+ If ``True``, input vectors are normalised to unit length.
+
+ usevlines : bool, default: True
+ Determines the plot style.
+
+ If ``True``, vertical lines are plotted from 0 to the acorr value
+ using `.Axes.vlines`. Additionally, a horizontal line is plotted
+ at y=0 using `.Axes.axhline`.
+
+ If ``False``, markers are plotted at the acorr values using
+ `.Axes.plot`.
+
+ maxlags : int, default: 10
+ Number of lags to show. If ``None``, will return all
+ ``2 * len(x) - 1`` lags.
+
+ Returns
+ -------
+ lags : array (length ``2*maxlags+1``)
+ The lag vector.
+ c : array (length ``2*maxlags+1``)
+ The auto correlation vector.
+ line : `.LineCollection` or `.Line2D`
+ `.Artist` added to the Axes of the correlation:
+
+ - `.LineCollection` if *usevlines* is True.
+ - `.Line2D` if *usevlines* is False.
+ b : `.Line2D` or None
+ Horizontal line at 0 if *usevlines* is True
+ None *usevlines* is False.
+
+ Other Parameters
+ ----------------
+ linestyle : `.Line2D` property, optional
+ The linestyle for plotting the data points.
+ Only used if *usevlines* is ``False``.
+
+ marker : str, default: 'o'
+ The marker for plotting the data points.
+ Only used if *usevlines* is ``False``.
+
+ **kwargs
+ Additional parameters are passed to `.Axes.vlines` and
+ `.Axes.axhline` if *usevlines* is ``True``; otherwise they are
+ passed to `.Axes.plot`.
+
+ Notes
+ -----
+ The cross correlation is performed with `numpy.correlate` with
+ ``mode = "full"``.
+ """
+ return self.xcorr(x, x, **kwargs)
+
+ @_preprocess_data(replace_names=["x", "y"], label_namer="y")
+ def xcorr(self, x, y, normed=True, detrend=mlab.detrend_none,
+ usevlines=True, maxlags=10, **kwargs):
+ r"""
+ Plot the cross correlation between *x* and *y*.
+
+ The correlation with lag k is defined as
+ :math:`\sum_n x[n+k] \cdot y^*[n]`, where :math:`y^*` is the complex
+ conjugate of :math:`y`.
+
+ Parameters
+ ----------
+ x, y : array-like of length n
+
+ detrend : callable, default: `.mlab.detrend_none` (no detrending)
+ A detrending function applied to *x* and *y*. It must have the
+ signature ::
+
+ detrend(x: np.ndarray) -> np.ndarray
+
+ normed : bool, default: True
+ If ``True``, input vectors are normalised to unit length.
+
+ usevlines : bool, default: True
+ Determines the plot style.
+
+ If ``True``, vertical lines are plotted from 0 to the xcorr value
+ using `.Axes.vlines`. Additionally, a horizontal line is plotted
+ at y=0 using `.Axes.axhline`.
+
+ If ``False``, markers are plotted at the xcorr values using
+ `.Axes.plot`.
+
+ maxlags : int, default: 10
+ Number of lags to show. If None, will return all ``2 * len(x) - 1``
+ lags.
+
+ Returns
+ -------
+ lags : array (length ``2*maxlags+1``)
+ The lag vector.
+ c : array (length ``2*maxlags+1``)
+ The auto correlation vector.
+ line : `.LineCollection` or `.Line2D`
+ `.Artist` added to the Axes of the correlation:
+
+ - `.LineCollection` if *usevlines* is True.
+ - `.Line2D` if *usevlines* is False.
+ b : `.Line2D` or None
+ Horizontal line at 0 if *usevlines* is True
+ None *usevlines* is False.
+
+ Other Parameters
+ ----------------
+ linestyle : `.Line2D` property, optional
+ The linestyle for plotting the data points.
+ Only used if *usevlines* is ``False``.
+
+ marker : str, default: 'o'
+ The marker for plotting the data points.
+ Only used if *usevlines* is ``False``.
+
+ **kwargs
+ Additional parameters are passed to `.Axes.vlines` and
+ `.Axes.axhline` if *usevlines* is ``True``; otherwise they are
+ passed to `.Axes.plot`.
+
+ Notes
+ -----
+ The cross correlation is performed with `numpy.correlate` with
+ ``mode = "full"``.
+ """
+ Nx = len(x)
+ if Nx != len(y):
+ raise ValueError('x and y must be equal length')
+
+ x = detrend(np.asarray(x))
+ y = detrend(np.asarray(y))
+
+ correls = np.correlate(x, y, mode="full")
+
+ if normed:
+ correls /= np.sqrt(np.dot(x, x) * np.dot(y, y))
+
+ if maxlags is None:
+ maxlags = Nx - 1
+
+ if maxlags >= Nx or maxlags < 1:
+ raise ValueError('maxlags must be None or strictly '
+ 'positive < %d' % Nx)
+
+ lags = np.arange(-maxlags, maxlags + 1)
+ correls = correls[Nx - 1 - maxlags:Nx + maxlags]
+
+ if usevlines:
+ a = self.vlines(lags, [0], correls, **kwargs)
+ # Make label empty so only vertical lines get a legend entry
+ kwargs.pop('label', '')
+ b = self.axhline(**kwargs)
+ else:
+ kwargs.setdefault('marker', 'o')
+ kwargs.setdefault('linestyle', 'None')
+ a, = self.plot(lags, correls, **kwargs)
+ b = None
+ return lags, correls, a, b
+
+ #### Specialized plotting
+
+ # @_preprocess_data() # let 'plot' do the unpacking..
+ def step(self, x, y, *args, where='pre', data=None, **kwargs):
+ """
+ Make a step plot.
+
+ Call signatures::
+
+ step(x, y, [fmt], *, data=None, where='pre', **kwargs)
+ step(x, y, [fmt], x2, y2, [fmt2], ..., *, where='pre', **kwargs)
+
+ This is just a thin wrapper around `.plot` which changes some
+ formatting options. Most of the concepts and parameters of plot can be
+ used here as well.
+
+ .. note::
+
+ This method uses a standard plot with a step drawstyle: The *x*
+ values are the reference positions and steps extend left/right/both
+ directions depending on *where*.
+
+ For the common case where you know the values and edges of the
+ steps, use `~.Axes.stairs` instead.
+
+ Parameters
+ ----------
+ x : array-like
+ 1D sequence of x positions. It is assumed, but not checked, that
+ it is uniformly increasing.
+
+ y : array-like
+ 1D sequence of y levels.
+
+ fmt : str, optional
+ A format string, e.g. 'g' for a green line. See `.plot` for a more
+ detailed description.
+
+ Note: While full format strings are accepted, it is recommended to
+ only specify the color. Line styles are currently ignored (use
+ the keyword argument *linestyle* instead). Markers are accepted
+ and plotted on the given positions, however, this is a rarely
+ needed feature for step plots.
+
+ data : indexable object, optional
+ An object with labelled data. If given, provide the label names to
+ plot in *x* and *y*.
+
+ where : {'pre', 'post', 'mid'}, default: 'pre'
+ Define where the steps should be placed:
+
+ - 'pre': The y value is continued constantly to the left from
+ every *x* position, i.e. the interval ``(x[i-1], x[i]]`` has the
+ value ``y[i]``.
+ - 'post': The y value is continued constantly to the right from
+ every *x* position, i.e. the interval ``[x[i], x[i+1])`` has the
+ value ``y[i]``.
+ - 'mid': Steps occur half-way between the *x* positions.
+
+ Returns
+ -------
+ list of `.Line2D`
+ Objects representing the plotted data.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Additional parameters are the same as those for `.plot`.
+
+ Notes
+ -----
+ .. [notes section required to get data note injection right]
+ """
+ _api.check_in_list(('pre', 'post', 'mid'), where=where)
+ kwargs['drawstyle'] = 'steps-' + where
+ return self.plot(x, y, *args, data=data, **kwargs)
+
+ @staticmethod
+ def _convert_dx(dx, x0, xconv, convert):
+ """
+ Small helper to do logic of width conversion flexibly.
+
+ *dx* and *x0* have units, but *xconv* has already been converted
+ to unitless (and is an ndarray). This allows the *dx* to have units
+ that are different from *x0*, but are still accepted by the
+ ``__add__`` operator of *x0*.
+ """
+
+ # x should be an array...
+ assert type(xconv) is np.ndarray
+
+ if xconv.size == 0:
+ # xconv has already been converted, but maybe empty...
+ return convert(dx)
+
+ try:
+ # attempt to add the width to x0; this works for
+ # datetime+timedelta, for instance
+
+ # only use the first element of x and x0. This saves
+ # having to be sure addition works across the whole
+ # vector. This is particularly an issue if
+ # x0 and dx are lists so x0 + dx just concatenates the lists.
+ # We can't just cast x0 and dx to numpy arrays because that
+ # removes the units from unit packages like `pint` that
+ # wrap numpy arrays.
+ try:
+ x0 = cbook.safe_first_element(x0)
+ except (TypeError, IndexError, KeyError):
+ x0 = x0
+
+ try:
+ x = cbook.safe_first_element(xconv)
+ except (TypeError, IndexError, KeyError):
+ x = xconv
+
+ delist = False
+ if not np.iterable(dx):
+ dx = [dx]
+ delist = True
+ dx = [convert(x0 + ddx) - x for ddx in dx]
+ if delist:
+ dx = dx[0]
+ except (ValueError, TypeError, AttributeError):
+ # if the above fails (for any reason) just fallback to what
+ # we do by default and convert dx by itself.
+ dx = convert(dx)
+ return dx
+
+ @_preprocess_data()
+ @docstring.dedent_interpd
+ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
+ **kwargs):
+ r"""
+ Make a bar plot.
+
+ The bars are positioned at *x* with the given *align*\ment. Their
+ dimensions are given by *height* and *width*. The vertical baseline
+ is *bottom* (default 0).
+
+ Many parameters can take either a single value applying to all bars
+ or a sequence of values, one for each bar.
+
+ Parameters
+ ----------
+ x : float or array-like
+ The x coordinates of the bars. See also *align* for the
+ alignment of the bars to the coordinates.
+
+ height : float or array-like
+ The height(s) of the bars.
+
+ width : float or array-like, default: 0.8
+ The width(s) of the bars.
+
+ bottom : float or array-like, default: 0
+ The y coordinate(s) of the bars bases.
+
+ align : {'center', 'edge'}, default: 'center'
+ Alignment of the bars to the *x* coordinates:
+
+ - 'center': Center the base on the *x* positions.
+ - 'edge': Align the left edges of the bars with the *x* positions.
+
+ To align the bars on the right edge pass a negative *width* and
+ ``align='edge'``.
+
+ Returns
+ -------
+ `.BarContainer`
+ Container with all the bars and optionally errorbars.
+
+ Other Parameters
+ ----------------
+ color : color or list of color, optional
+ The colors of the bar faces.
+
+ edgecolor : color or list of color, optional
+ The colors of the bar edges.
+
+ linewidth : float or array-like, optional
+ Width of the bar edge(s). If 0, don't draw edges.
+
+ tick_label : str or list of str, optional
+ The tick labels of the bars.
+ Default: None (Use default numeric labels.)
+
+ xerr, yerr : float or array-like of shape(N,) or shape(2, N), optional
+ If not *None*, add horizontal / vertical errorbars to the bar tips.
+ The values are +/- sizes relative to the data:
+
+ - scalar: symmetric +/- values for all bars
+ - shape(N,): symmetric +/- values for each bar
+ - shape(2, N): Separate - and + values for each bar. First row
+ contains the lower errors, the second row contains the upper
+ errors.
+ - *None*: No errorbar. (Default)
+
+ See :doc:`/gallery/statistics/errorbar_features`
+ for an example on the usage of ``xerr`` and ``yerr``.
+
+ ecolor : color or list of color, default: 'black'
+ The line color of the errorbars.
+
+ capsize : float, default: :rc:`errorbar.capsize`
+ The length of the error bar caps in points.
+
+ error_kw : dict, optional
+ Dictionary of kwargs to be passed to the `~.Axes.errorbar`
+ method. Values of *ecolor* or *capsize* defined here take
+ precedence over the independent kwargs.
+
+ log : bool, default: False
+ If *True*, set the y-axis to be log scale.
+
+ **kwargs : `.Rectangle` properties
+
+ %(Rectangle_kwdoc)s
+
+ See Also
+ --------
+ barh : Plot a horizontal bar plot.
+
+ Notes
+ -----
+ Stacked bars can be achieved by passing individual *bottom* values per
+ bar. See :doc:`/gallery/lines_bars_and_markers/bar_stacked`.
+ """
+ kwargs = cbook.normalize_kwargs(kwargs, mpatches.Patch)
+ color = kwargs.pop('color', None)
+ if color is None:
+ color = self._get_patches_for_fill.get_next_color()
+ edgecolor = kwargs.pop('edgecolor', None)
+ linewidth = kwargs.pop('linewidth', None)
+ hatch = kwargs.pop('hatch', None)
+
+ # Because xerr and yerr will be passed to errorbar, most dimension
+ # checking and processing will be left to the errorbar method.
+ xerr = kwargs.pop('xerr', None)
+ yerr = kwargs.pop('yerr', None)
+ error_kw = kwargs.pop('error_kw', {})
+ ezorder = error_kw.pop('zorder', None)
+ if ezorder is None:
+ ezorder = kwargs.get('zorder', None)
+ if ezorder is not None:
+ # If using the bar zorder, increment slightly to make sure
+ # errorbars are drawn on top of bars
+ ezorder += 0.01
+ error_kw.setdefault('zorder', ezorder)
+ ecolor = kwargs.pop('ecolor', 'k')
+ capsize = kwargs.pop('capsize', rcParams["errorbar.capsize"])
+ error_kw.setdefault('ecolor', ecolor)
+ error_kw.setdefault('capsize', capsize)
+
+ # The keyword argument *orientation* is used by barh() to defer all
+ # logic and drawing to bar(). It is considered internal and is
+ # intentionally not mentioned in the docstring.
+ orientation = kwargs.pop('orientation', 'vertical')
+ _api.check_in_list(['vertical', 'horizontal'], orientation=orientation)
+ log = kwargs.pop('log', False)
+ label = kwargs.pop('label', '')
+ tick_labels = kwargs.pop('tick_label', None)
+
+ y = bottom # Matches barh call signature.
+ if orientation == 'vertical':
+ if y is None:
+ y = 0
+ elif orientation == 'horizontal':
+ if x is None:
+ x = 0
+
+ if orientation == 'vertical':
+ self._process_unit_info(
+ [("x", x), ("y", height)], kwargs, convert=False)
+ if log:
+ self.set_yscale('log', nonpositive='clip')
+ elif orientation == 'horizontal':
+ self._process_unit_info(
+ [("x", width), ("y", y)], kwargs, convert=False)
+ if log:
+ self.set_xscale('log', nonpositive='clip')
+
+ # lets do some conversions now since some types cannot be
+ # subtracted uniformly
+ if self.xaxis is not None:
+ x0 = x
+ x = np.asarray(self.convert_xunits(x))
+ width = self._convert_dx(width, x0, x, self.convert_xunits)
+ if xerr is not None:
+ xerr = self._convert_dx(xerr, x0, x, self.convert_xunits)
+ if self.yaxis is not None:
+ y0 = y
+ y = np.asarray(self.convert_yunits(y))
+ height = self._convert_dx(height, y0, y, self.convert_yunits)
+ if yerr is not None:
+ yerr = self._convert_dx(yerr, y0, y, self.convert_yunits)
+
+ x, height, width, y, linewidth, hatch = np.broadcast_arrays(
+ # Make args iterable too.
+ np.atleast_1d(x), height, width, y, linewidth, hatch)
+
+ # Now that units have been converted, set the tick locations.
+ if orientation == 'vertical':
+ tick_label_axis = self.xaxis
+ tick_label_position = x
+ elif orientation == 'horizontal':
+ tick_label_axis = self.yaxis
+ tick_label_position = y
+
+ linewidth = itertools.cycle(np.atleast_1d(linewidth))
+ hatch = itertools.cycle(np.atleast_1d(hatch))
+ color = itertools.chain(itertools.cycle(mcolors.to_rgba_array(color)),
+ # Fallback if color == "none".
+ itertools.repeat('none'))
+ if edgecolor is None:
+ edgecolor = itertools.repeat(None)
+ else:
+ edgecolor = itertools.chain(
+ itertools.cycle(mcolors.to_rgba_array(edgecolor)),
+ # Fallback if edgecolor == "none".
+ itertools.repeat('none'))
+
+ # We will now resolve the alignment and really have
+ # left, bottom, width, height vectors
+ _api.check_in_list(['center', 'edge'], align=align)
+ if align == 'center':
+ if orientation == 'vertical':
+ try:
+ left = x - width / 2
+ except TypeError as e:
+ raise TypeError(f'the dtypes of parameters x ({x.dtype}) '
+ f'and width ({width.dtype}) '
+ f'are incompatible') from e
+ bottom = y
+ elif orientation == 'horizontal':
+ try:
+ bottom = y - height / 2
+ except TypeError as e:
+ raise TypeError(f'the dtypes of parameters y ({y.dtype}) '
+ f'and height ({height.dtype}) '
+ f'are incompatible') from e
+ left = x
+ elif align == 'edge':
+ left = x
+ bottom = y
+
+ patches = []
+ args = zip(left, bottom, width, height, color, edgecolor, linewidth,
+ hatch)
+ for l, b, w, h, c, e, lw, htch in args:
+ r = mpatches.Rectangle(
+ xy=(l, b), width=w, height=h,
+ facecolor=c,
+ edgecolor=e,
+ linewidth=lw,
+ label='_nolegend_',
+ hatch=htch,
+ )
+ r.update(kwargs)
+ r.get_path()._interpolation_steps = 100
+ if orientation == 'vertical':
+ r.sticky_edges.y.append(b)
+ elif orientation == 'horizontal':
+ r.sticky_edges.x.append(l)
+ self.add_patch(r)
+ patches.append(r)
+
+ if xerr is not None or yerr is not None:
+ if orientation == 'vertical':
+ # using list comps rather than arrays to preserve unit info
+ ex = [l + 0.5 * w for l, w in zip(left, width)]
+ ey = [b + h for b, h in zip(bottom, height)]
+
+ elif orientation == 'horizontal':
+ # using list comps rather than arrays to preserve unit info
+ ex = [l + w for l, w in zip(left, width)]
+ ey = [b + 0.5 * h for b, h in zip(bottom, height)]
+
+ error_kw.setdefault("label", '_nolegend_')
+
+ errorbar = self.errorbar(ex, ey,
+ yerr=yerr, xerr=xerr,
+ fmt='none', **error_kw)
+ else:
+ errorbar = None
+
+ self._request_autoscale_view()
+
+ if orientation == 'vertical':
+ datavalues = height
+ elif orientation == 'horizontal':
+ datavalues = width
+
+ bar_container = BarContainer(patches, errorbar, datavalues=datavalues,
+ orientation=orientation, label=label)
+ self.add_container(bar_container)
+
+ if tick_labels is not None:
+ tick_labels = np.broadcast_to(tick_labels, len(patches))
+ tick_label_axis.set_ticks(tick_label_position)
+ tick_label_axis.set_ticklabels(tick_labels)
+
+ return bar_container
+
+ @docstring.dedent_interpd
+ def barh(self, y, width, height=0.8, left=None, *, align="center",
+ **kwargs):
+ r"""
+ Make a horizontal bar plot.
+
+ The bars are positioned at *y* with the given *align*\ment. Their
+ dimensions are given by *width* and *height*. The horizontal baseline
+ is *left* (default 0).
+
+ Many parameters can take either a single value applying to all bars
+ or a sequence of values, one for each bar.
+
+ Parameters
+ ----------
+ y : float or array-like
+ The y coordinates of the bars. See also *align* for the
+ alignment of the bars to the coordinates.
+
+ width : float or array-like
+ The width(s) of the bars.
+
+ height : float or array-like, default: 0.8
+ The heights of the bars.
+
+ left : float or array-like, default: 0
+ The x coordinates of the left sides of the bars.
+
+ align : {'center', 'edge'}, default: 'center'
+ Alignment of the base to the *y* coordinates*:
+
+ - 'center': Center the bars on the *y* positions.
+ - 'edge': Align the bottom edges of the bars with the *y*
+ positions.
+
+ To align the bars on the top edge pass a negative *height* and
+ ``align='edge'``.
+
+ Returns
+ -------
+ `.BarContainer`
+ Container with all the bars and optionally errorbars.
+
+ Other Parameters
+ ----------------
+ color : color or list of color, optional
+ The colors of the bar faces.
+
+ edgecolor : color or list of color, optional
+ The colors of the bar edges.
+
+ linewidth : float or array-like, optional
+ Width of the bar edge(s). If 0, don't draw edges.
+
+ tick_label : str or list of str, optional
+ The tick labels of the bars.
+ Default: None (Use default numeric labels.)
+
+ xerr, yerr : float or array-like of shape(N,) or shape(2, N), optional
+ If not ``None``, add horizontal / vertical errorbars to the
+ bar tips. The values are +/- sizes relative to the data:
+
+ - scalar: symmetric +/- values for all bars
+ - shape(N,): symmetric +/- values for each bar
+ - shape(2, N): Separate - and + values for each bar. First row
+ contains the lower errors, the second row contains the upper
+ errors.
+ - *None*: No errorbar. (default)
+
+ See :doc:`/gallery/statistics/errorbar_features`
+ for an example on the usage of ``xerr`` and ``yerr``.
+
+ ecolor : color or list of color, default: 'black'
+ The line color of the errorbars.
+
+ capsize : float, default: :rc:`errorbar.capsize`
+ The length of the error bar caps in points.
+
+ error_kw : dict, optional
+ Dictionary of kwargs to be passed to the `~.Axes.errorbar`
+ method. Values of *ecolor* or *capsize* defined here take
+ precedence over the independent kwargs.
+
+ log : bool, default: False
+ If ``True``, set the x-axis to be log scale.
+
+ **kwargs : `.Rectangle` properties
+
+ %(Rectangle_kwdoc)s
+
+ See Also
+ --------
+ bar : Plot a vertical bar plot.
+
+ Notes
+ -----
+ Stacked bars can be achieved by passing individual *left* values per
+ bar. See
+ :doc:`/gallery/lines_bars_and_markers/horizontal_barchart_distribution`
+ .
+ """
+ kwargs.setdefault('orientation', 'horizontal')
+ patches = self.bar(x=left, height=height, width=width, bottom=y,
+ align=align, **kwargs)
+ return patches
+
+ def bar_label(self, container, labels=None, *, fmt="%g", label_type="edge",
+ padding=0, **kwargs):
+ """
+ Label a bar plot.
+
+ Adds labels to bars in the given `.BarContainer`.
+ You may need to adjust the axis limits to fit the labels.
+
+ Parameters
+ ----------
+ container : `.BarContainer`
+ Container with all the bars and optionally errorbars, likely
+ returned from `.bar` or `.barh`.
+
+ labels : array-like, optional
+ A list of label texts, that should be displayed. If not given, the
+ label texts will be the data values formatted with *fmt*.
+
+ fmt : str, default: '%g'
+ A format string for the label.
+
+ label_type : {'edge', 'center'}, default: 'edge'
+ The label type. Possible values:
+
+ - 'edge': label placed at the end-point of the bar segment, and the
+ value displayed will be the position of that end-point.
+ - 'center': label placed in the center of the bar segment, and the
+ value displayed will be the length of that segment.
+ (useful for stacked bars, i.e.,
+ :doc:`/gallery/lines_bars_and_markers/bar_label_demo`)
+
+ padding : float, default: 0
+ Distance of label from the end of the bar, in points.
+
+ **kwargs
+ Any remaining keyword arguments are passed through to
+ `.Axes.annotate`.
+
+ Returns
+ -------
+ list of `.Text`
+ A list of `.Text` instances for the labels.
+ """
+
+ # want to know whether to put label on positive or negative direction
+ # cannot use np.sign here because it will return 0 if x == 0
+ def sign(x):
+ return 1 if x >= 0 else -1
+
+ _api.check_in_list(['edge', 'center'], label_type=label_type)
+
+ bars = container.patches
+ errorbar = container.errorbar
+ datavalues = container.datavalues
+ orientation = container.orientation
+
+ if errorbar:
+ # check "ErrorbarContainer" for the definition of these elements
+ lines = errorbar.lines # attribute of "ErrorbarContainer" (tuple)
+ barlinecols = lines[2] # 0: data_line, 1: caplines, 2: barlinecols
+ barlinecol = barlinecols[0] # the "LineCollection" of error bars
+ errs = barlinecol.get_segments()
+ else:
+ errs = []
+
+ if labels is None:
+ labels = []
+
+ annotations = []
+
+ for bar, err, dat, lbl in itertools.zip_longest(
+ bars, errs, datavalues, labels
+ ):
+ (x0, y0), (x1, y1) = bar.get_bbox().get_points()
+ xc, yc = (x0 + x1) / 2, (y0 + y1) / 2
+
+ if orientation == "vertical":
+ extrema = max(y0, y1) if dat >= 0 else min(y0, y1)
+ length = abs(y0 - y1)
+ elif orientation == "horizontal":
+ extrema = max(x0, x1) if dat >= 0 else min(x0, x1)
+ length = abs(x0 - x1)
+
+ if err is None:
+ endpt = extrema
+ elif orientation == "vertical":
+ endpt = err[:, 1].max() if dat >= 0 else err[:, 1].min()
+ elif orientation == "horizontal":
+ endpt = err[:, 0].max() if dat >= 0 else err[:, 0].min()
+
+ if label_type == "center":
+ value = sign(dat) * length
+ elif label_type == "edge":
+ value = extrema
+
+ if label_type == "center":
+ xy = xc, yc
+ elif label_type == "edge" and orientation == "vertical":
+ xy = xc, endpt
+ elif label_type == "edge" and orientation == "horizontal":
+ xy = endpt, yc
+
+ if orientation == "vertical":
+ xytext = 0, sign(dat) * padding
+ else:
+ xytext = sign(dat) * padding, 0
+
+ if label_type == "center":
+ ha, va = "center", "center"
+ elif label_type == "edge":
+ if orientation == "vertical":
+ ha = 'center'
+ va = 'top' if dat < 0 else 'bottom' # also handles NaN
+ elif orientation == "horizontal":
+ ha = 'right' if dat < 0 else 'left' # also handles NaN
+ va = 'center'
+
+ if np.isnan(dat):
+ lbl = ''
+
+ annotation = self.annotate(fmt % value if lbl is None else lbl,
+ xy, xytext, textcoords="offset points",
+ ha=ha, va=va, **kwargs)
+ annotations.append(annotation)
+
+ return annotations
+
+ @_preprocess_data()
+ @docstring.dedent_interpd
+ def broken_barh(self, xranges, yrange, **kwargs):
+ """
+ Plot a horizontal sequence of rectangles.
+
+ A rectangle is drawn for each element of *xranges*. All rectangles
+ have the same vertical position and size defined by *yrange*.
+
+ This is a convenience function for instantiating a
+ `.BrokenBarHCollection`, adding it to the Axes and autoscaling the
+ view.
+
+ Parameters
+ ----------
+ xranges : sequence of tuples (*xmin*, *xwidth*)
+ The x-positions and extends of the rectangles. For each tuple
+ (*xmin*, *xwidth*) a rectangle is drawn from *xmin* to *xmin* +
+ *xwidth*.
+ yrange : (*ymin*, *yheight*)
+ The y-position and extend for all the rectangles.
+
+ Returns
+ -------
+ `~.collections.BrokenBarHCollection`
+
+ Other Parameters
+ ----------------
+ **kwargs : `.BrokenBarHCollection` properties
+
+ Each *kwarg* can be either a single argument applying to all
+ rectangles, e.g.::
+
+ facecolors='black'
+
+ or a sequence of arguments over which is cycled, e.g.::
+
+ facecolors=('black', 'blue')
+
+ would create interleaving black and blue rectangles.
+
+ Supported keywords:
+
+ %(BrokenBarHCollection_kwdoc)s
+ """
+ # process the unit information
+ if len(xranges):
+ xdata = cbook.safe_first_element(xranges)
+ else:
+ xdata = None
+ if len(yrange):
+ ydata = cbook.safe_first_element(yrange)
+ else:
+ ydata = None
+ self._process_unit_info(
+ [("x", xdata), ("y", ydata)], kwargs, convert=False)
+ xranges_conv = []
+ for xr in xranges:
+ if len(xr) != 2:
+ raise ValueError('each range in xrange must be a sequence '
+ 'with two elements (i.e. an Nx2 array)')
+ # convert the absolute values, not the x and dx...
+ x_conv = np.asarray(self.convert_xunits(xr[0]))
+ x1 = self._convert_dx(xr[1], xr[0], x_conv, self.convert_xunits)
+ xranges_conv.append((x_conv, x1))
+
+ yrange_conv = self.convert_yunits(yrange)
+
+ col = mcoll.BrokenBarHCollection(xranges_conv, yrange_conv, **kwargs)
+ self.add_collection(col, autolim=True)
+ self._request_autoscale_view()
+
+ return col
+
+ @_preprocess_data()
+ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
+ label=None, use_line_collection=True, orientation='vertical'):
+ """
+ Create a stem plot.
+
+ A stem plot draws lines perpendicular to a baseline at each location
+ *locs* from the baseline to *heads*, and places a marker there. For
+ vertical stem plots (the default), the *locs* are *x* positions, and
+ the *heads* are *y* values. For horizontal stem plots, the *locs* are
+ *y* positions, and the *heads* are *x* values.
+
+ Call signature::
+
+ stem([locs,] heads, linefmt=None, markerfmt=None, basefmt=None)
+
+ The *locs*-positions are optional. The formats may be provided either
+ as positional or as keyword-arguments.
+
+ Parameters
+ ----------
+ locs : array-like, default: (0, 1, ..., len(heads) - 1)
+ For vertical stem plots, the x-positions of the stems.
+ For horizontal stem plots, the y-positions of the stems.
+
+ heads : array-like
+ For vertical stem plots, the y-values of the stem heads.
+ For horizontal stem plots, the x-values of the stem heads.
+
+ linefmt : str, optional
+ A string defining the color and/or linestyle of the vertical lines:
+
+ ========= =============
+ Character Line Style
+ ========= =============
+ ``'-'`` solid line
+ ``'--'`` dashed line
+ ``'-.'`` dash-dot line
+ ``':'`` dotted line
+ ========= =============
+
+ Default: 'C0-', i.e. solid line with the first color of the color
+ cycle.
+
+ Note: Markers specified through this parameter (e.g. 'x') will be
+ silently ignored (unless using ``use_line_collection=False``).
+ Instead, markers should be specified using *markerfmt*.
+
+ markerfmt : str, optional
+ A string defining the color and/or shape of the markers at the stem
+ heads. Default: 'C0o', i.e. filled circles with the first color of
+ the color cycle.
+
+ basefmt : str, default: 'C3-' ('C2-' in classic mode)
+ A format string defining the properties of the baseline.
+
+ orientation : str, default: 'vertical'
+ If 'vertical', will produce a plot with stems oriented vertically,
+ otherwise the stems will be oriented horizontally.
+
+ bottom : float, default: 0
+ The y/x-position of the baseline (depending on orientation).
+
+ label : str, default: None
+ The label to use for the stems in legends.
+
+ use_line_collection : bool, default: True
+ If ``True``, store and plot the stem lines as a
+ `~.collections.LineCollection` instead of individual lines, which
+ significantly increases performance. If ``False``, defaults to the
+ old behavior of using a list of `.Line2D` objects. This parameter
+ may be deprecated in the future.
+
+ Returns
+ -------
+ `.StemContainer`
+ The container may be treated like a tuple
+ (*markerline*, *stemlines*, *baseline*)
+
+ Notes
+ -----
+ .. seealso::
+ The MATLAB function
+ `stem `_
+ which inspired this method.
+ """
+ if not 1 <= len(args) <= 5:
+ raise TypeError('stem expected between 1 and 5 positional '
+ 'arguments, got {}'.format(args))
+ _api.check_in_list(['horizontal', 'vertical'], orientation=orientation)
+
+ if len(args) == 1:
+ heads, = args
+ locs = np.arange(len(heads))
+ args = ()
+ else:
+ locs, heads, *args = args
+
+ if orientation == 'vertical':
+ locs, heads = self._process_unit_info([("x", locs), ("y", heads)])
+ else:
+ heads, locs = self._process_unit_info([("x", heads), ("y", locs)])
+
+ # defaults for formats
+ if linefmt is None:
+ try:
+ # fallback to positional argument
+ linefmt = args[0]
+ except IndexError:
+ linecolor = 'C0'
+ linemarker = 'None'
+ linestyle = '-'
+ else:
+ linestyle, linemarker, linecolor = \
+ _process_plot_format(linefmt)
+ else:
+ linestyle, linemarker, linecolor = _process_plot_format(linefmt)
+
+ if markerfmt is None:
+ try:
+ # fallback to positional argument
+ markerfmt = args[1]
+ except IndexError:
+ markercolor = 'C0'
+ markermarker = 'o'
+ markerstyle = 'None'
+ else:
+ markerstyle, markermarker, markercolor = \
+ _process_plot_format(markerfmt)
+ else:
+ markerstyle, markermarker, markercolor = \
+ _process_plot_format(markerfmt)
+
+ if basefmt is None:
+ try:
+ # fallback to positional argument
+ basefmt = args[2]
+ except IndexError:
+ if rcParams['_internal.classic_mode']:
+ basecolor = 'C2'
+ else:
+ basecolor = 'C3'
+ basemarker = 'None'
+ basestyle = '-'
+ else:
+ basestyle, basemarker, basecolor = \
+ _process_plot_format(basefmt)
+ else:
+ basestyle, basemarker, basecolor = _process_plot_format(basefmt)
+
+ # New behaviour in 3.1 is to use a LineCollection for the stemlines
+ if use_line_collection:
+ if linestyle is None:
+ linestyle = rcParams['lines.linestyle']
+ xlines = self.vlines if orientation == "vertical" else self.hlines
+ stemlines = xlines(
+ locs, bottom, heads,
+ colors=linecolor, linestyles=linestyle, label="_nolegend_")
+ # Old behaviour is to plot each of the lines individually
+ else:
+ stemlines = []
+ for loc, head in zip(locs, heads):
+ if orientation == 'horizontal':
+ xs = [bottom, head]
+ ys = [loc, loc]
+ else:
+ xs = [loc, loc]
+ ys = [bottom, head]
+ l, = self.plot(xs, ys,
+ color=linecolor, linestyle=linestyle,
+ marker=linemarker, label="_nolegend_")
+ stemlines.append(l)
+
+ if orientation == 'horizontal':
+ marker_x = heads
+ marker_y = locs
+ baseline_x = [bottom, bottom]
+ baseline_y = [np.min(locs), np.max(locs)]
+ else:
+ marker_x = locs
+ marker_y = heads
+ baseline_x = [np.min(locs), np.max(locs)]
+ baseline_y = [bottom, bottom]
+
+ markerline, = self.plot(marker_x, marker_y,
+ color=markercolor, linestyle=markerstyle,
+ marker=markermarker, label="_nolegend_")
+
+ baseline, = self.plot(baseline_x, baseline_y,
+ color=basecolor, linestyle=basestyle,
+ marker=basemarker, label="_nolegend_")
+
+ stem_container = StemContainer((markerline, stemlines, baseline),
+ label=label)
+ self.add_container(stem_container)
+ return stem_container
+
+ @_preprocess_data(replace_names=["x", "explode", "labels", "colors"])
+ def pie(self, x, explode=None, labels=None, colors=None,
+ autopct=None, pctdistance=0.6, shadow=False, labeldistance=1.1,
+ startangle=0, radius=1, counterclock=True,
+ wedgeprops=None, textprops=None, center=(0, 0),
+ frame=False, rotatelabels=False, *, normalize=None):
+ """
+ Plot a pie chart.
+
+ Make a pie chart of array *x*. The fractional area of each wedge is
+ given by ``x/sum(x)``. If ``sum(x) < 1``, then the values of *x* give
+ the fractional area directly and the array will not be normalized. The
+ resulting pie will have an empty wedge of size ``1 - sum(x)``.
+
+ The wedges are plotted counterclockwise, by default starting from the
+ x-axis.
+
+ Parameters
+ ----------
+ x : 1D array-like
+ The wedge sizes.
+
+ explode : array-like, default: None
+ If not *None*, is a ``len(x)`` array which specifies the fraction
+ of the radius with which to offset each wedge.
+
+ labels : list, default: None
+ A sequence of strings providing the labels for each wedge
+
+ colors : array-like, default: None
+ A sequence of colors through which the pie chart will cycle. If
+ *None*, will use the colors in the currently active cycle.
+
+ autopct : None or str or callable, default: None
+ If not *None*, is a string or function used to label the wedges
+ with their numeric value. The label will be placed inside the
+ wedge. If it is a format string, the label will be ``fmt % pct``.
+ If it is a function, it will be called.
+
+ pctdistance : float, default: 0.6
+ The ratio between the center of each pie slice and the start of
+ the text generated by *autopct*. Ignored if *autopct* is *None*.
+
+ shadow : bool, default: False
+ Draw a shadow beneath the pie.
+
+ normalize : None or bool, default: None
+ When *True*, always make a full pie by normalizing x so that
+ ``sum(x) == 1``. *False* makes a partial pie if ``sum(x) <= 1``
+ and raises a `ValueError` for ``sum(x) > 1``.
+
+ When *None*, defaults to *True* if ``sum(x) >= 1`` and *False* if
+ ``sum(x) < 1``.
+
+ Please note that the previous default value of *None* is now
+ deprecated, and the default will change to *True* in the next
+ release. Please pass ``normalize=False`` explicitly if you want to
+ draw a partial pie.
+
+ labeldistance : float or None, default: 1.1
+ The radial distance at which the pie labels are drawn.
+ If set to ``None``, label are not drawn, but are stored for use in
+ ``legend()``
+
+ startangle : float, default: 0 degrees
+ The angle by which the start of the pie is rotated,
+ counterclockwise from the x-axis.
+
+ radius : float, default: 1
+ The radius of the pie.
+
+ counterclock : bool, default: True
+ Specify fractions direction, clockwise or counterclockwise.
+
+ wedgeprops : dict, default: None
+ Dict of arguments passed to the wedge objects making the pie.
+ For example, you can pass in ``wedgeprops = {'linewidth': 3}``
+ to set the width of the wedge border lines equal to 3.
+ For more details, look at the doc/arguments of the wedge object.
+ By default ``clip_on=False``.
+
+ textprops : dict, default: None
+ Dict of arguments to pass to the text objects.
+
+ center : (float, float), default: (0, 0)
+ The coordinates of the center of the chart.
+
+ frame : bool, default: False
+ Plot Axes frame with the chart if true.
+
+ rotatelabels : bool, default: False
+ Rotate each label to the angle of the corresponding slice if true.
+
+ Returns
+ -------
+ patches : list
+ A sequence of `matplotlib.patches.Wedge` instances
+
+ texts : list
+ A list of the label `.Text` instances.
+
+ autotexts : list
+ A list of `.Text` instances for the numeric labels. This will only
+ be returned if the parameter *autopct* is not *None*.
+
+ Notes
+ -----
+ The pie chart will probably look best if the figure and Axes are
+ square, or the Axes aspect is equal.
+ This method sets the aspect ratio of the axis to "equal".
+ The Axes aspect ratio can be controlled with `.Axes.set_aspect`.
+ """
+ self.set_aspect('equal')
+ # The use of float32 is "historical", but can't be changed without
+ # regenerating the test baselines.
+ x = np.asarray(x, np.float32)
+ if x.ndim > 1:
+ raise ValueError("x must be 1D")
+
+ if np.any(x < 0):
+ raise ValueError("Wedge sizes 'x' must be non negative values")
+
+ sx = x.sum()
+
+ if normalize is None:
+ if sx < 1:
+ _api.warn_deprecated(
+ "3.3", message="normalize=None does not normalize "
+ "if the sum is less than 1 but this behavior "
+ "is deprecated since %(since)s until %(removal)s. "
+ "After the deprecation "
+ "period the default value will be normalize=True. "
+ "To prevent normalization pass normalize=False ")
+ else:
+ normalize = True
+ if normalize:
+ x = x / sx
+ elif sx > 1:
+ raise ValueError('Cannot plot an unnormalized pie with sum(x) > 1')
+ if labels is None:
+ labels = [''] * len(x)
+ if explode is None:
+ explode = [0] * len(x)
+ if len(x) != len(labels):
+ raise ValueError("'label' must be of length 'x'")
+ if len(x) != len(explode):
+ raise ValueError("'explode' must be of length 'x'")
+ if colors is None:
+ get_next_color = self._get_patches_for_fill.get_next_color
+ else:
+ color_cycle = itertools.cycle(colors)
+
+ def get_next_color():
+ return next(color_cycle)
+
+ if radius is None:
+ _api.warn_deprecated(
+ "3.3", message="Support for passing a radius of None to mean "
+ "1 is deprecated since %(since)s and will be removed "
+ "%(removal)s.")
+ radius = 1
+
+ # Starting theta1 is the start fraction of the circle
+ if startangle is None:
+ _api.warn_deprecated(
+ "3.3", message="Support for passing a startangle of None to "
+ "mean 0 is deprecated since %(since)s and will be removed "
+ "%(removal)s.")
+ startangle = 0
+ theta1 = startangle / 360
+
+ if wedgeprops is None:
+ wedgeprops = {}
+ if textprops is None:
+ textprops = {}
+
+ texts = []
+ slices = []
+ autotexts = []
+
+ for frac, label, expl in zip(x, labels, explode):
+ x, y = center
+ theta2 = (theta1 + frac) if counterclock else (theta1 - frac)
+ thetam = 2 * np.pi * 0.5 * (theta1 + theta2)
+ x += expl * math.cos(thetam)
+ y += expl * math.sin(thetam)
+
+ w = mpatches.Wedge((x, y), radius, 360. * min(theta1, theta2),
+ 360. * max(theta1, theta2),
+ facecolor=get_next_color(),
+ clip_on=False,
+ label=label)
+ w.set(**wedgeprops)
+ slices.append(w)
+ self.add_patch(w)
+
+ if shadow:
+ # Make sure to add a shadow after the call to add_patch so the
+ # figure and transform props will be set.
+ shad = mpatches.Shadow(w, -0.02, -0.02, label='_nolegend_')
+ self.add_patch(shad)
+
+ if labeldistance is not None:
+ xt = x + labeldistance * radius * math.cos(thetam)
+ yt = y + labeldistance * radius * math.sin(thetam)
+ label_alignment_h = 'left' if xt > 0 else 'right'
+ label_alignment_v = 'center'
+ label_rotation = 'horizontal'
+ if rotatelabels:
+ label_alignment_v = 'bottom' if yt > 0 else 'top'
+ label_rotation = (np.rad2deg(thetam)
+ + (0 if xt > 0 else 180))
+ t = self.text(xt, yt, label,
+ clip_on=False,
+ horizontalalignment=label_alignment_h,
+ verticalalignment=label_alignment_v,
+ rotation=label_rotation,
+ size=rcParams['xtick.labelsize'])
+ t.set(**textprops)
+ texts.append(t)
+
+ if autopct is not None:
+ xt = x + pctdistance * radius * math.cos(thetam)
+ yt = y + pctdistance * radius * math.sin(thetam)
+ if isinstance(autopct, str):
+ s = autopct % (100. * frac)
+ elif callable(autopct):
+ s = autopct(100. * frac)
+ else:
+ raise TypeError(
+ 'autopct must be callable or a format string')
+ t = self.text(xt, yt, s,
+ clip_on=False,
+ horizontalalignment='center',
+ verticalalignment='center')
+ t.set(**textprops)
+ autotexts.append(t)
+
+ theta1 = theta2
+
+ if frame:
+ self._request_autoscale_view()
+ else:
+ self.set(frame_on=False, xticks=[], yticks=[],
+ xlim=(-1.25 + center[0], 1.25 + center[0]),
+ ylim=(-1.25 + center[1], 1.25 + center[1]))
+
+ if autopct is None:
+ return slices, texts
+ else:
+ return slices, texts, autotexts
+
+ @_preprocess_data(replace_names=["x", "y", "xerr", "yerr"],
+ label_namer="y")
+ @docstring.dedent_interpd
+ def errorbar(self, x, y, yerr=None, xerr=None,
+ fmt='', ecolor=None, elinewidth=None, capsize=None,
+ barsabove=False, lolims=False, uplims=False,
+ xlolims=False, xuplims=False, errorevery=1, capthick=None,
+ **kwargs):
+ """
+ Plot y versus x as lines and/or markers with attached errorbars.
+
+ *x*, *y* define the data locations, *xerr*, *yerr* define the errorbar
+ sizes. By default, this draws the data markers/lines as well the
+ errorbars. Use fmt='none' to draw errorbars without any data markers.
+
+ Parameters
+ ----------
+ x, y : float or array-like
+ The data positions.
+
+ xerr, yerr : float or array-like, shape(N,) or shape(2, N), optional
+ The errorbar sizes:
+
+ - scalar: Symmetric +/- values for all data points.
+ - shape(N,): Symmetric +/-values for each data point.
+ - shape(2, N): Separate - and + values for each bar. First row
+ contains the lower errors, the second row contains the upper
+ errors.
+ - *None*: No errorbar.
+
+ Note that all error arrays should have *positive* values.
+
+ See :doc:`/gallery/statistics/errorbar_features`
+ for an example on the usage of ``xerr`` and ``yerr``.
+
+ fmt : str, default: ''
+ The format for the data points / data lines. See `.plot` for
+ details.
+
+ Use 'none' (case insensitive) to plot errorbars without any data
+ markers.
+
+ ecolor : color, default: None
+ The color of the errorbar lines. If None, use the color of the
+ line connecting the markers.
+
+ elinewidth : float, default: None
+ The linewidth of the errorbar lines. If None, the linewidth of
+ the current style is used.
+
+ capsize : float, default: :rc:`errorbar.capsize`
+ The length of the error bar caps in points.
+
+ capthick : float, default: None
+ An alias to the keyword argument *markeredgewidth* (a.k.a. *mew*).
+ This setting is a more sensible name for the property that
+ controls the thickness of the error bar cap in points. For
+ backwards compatibility, if *mew* or *markeredgewidth* are given,
+ then they will over-ride *capthick*. This may change in future
+ releases.
+
+ barsabove : bool, default: False
+ If True, will plot the errorbars above the plot
+ symbols. Default is below.
+
+ lolims, uplims, xlolims, xuplims : bool, default: False
+ These arguments can be used to indicate that a value gives only
+ upper/lower limits. In that case a caret symbol is used to
+ indicate this. *lims*-arguments may be scalars, or array-likes of
+ the same length as *xerr* and *yerr*. To use limits with inverted
+ axes, `~.Axes.set_xlim` or `~.Axes.set_ylim` must be called before
+ :meth:`errorbar`. Note the tricky parameter names: setting e.g.
+ *lolims* to True means that the y-value is a *lower* limit of the
+ True value, so, only an *upward*-pointing arrow will be drawn!
+
+ errorevery : int or (int, int), default: 1
+ draws error bars on a subset of the data. *errorevery* =N draws
+ error bars on the points (x[::N], y[::N]).
+ *errorevery* =(start, N) draws error bars on the points
+ (x[start::N], y[start::N]). e.g. errorevery=(6, 3)
+ adds error bars to the data at (x[6], x[9], x[12], x[15], ...).
+ Used to avoid overlapping error bars when two series share x-axis
+ values.
+
+ Returns
+ -------
+ `.ErrorbarContainer`
+ The container contains:
+
+ - plotline: `.Line2D` instance of x, y plot markers and/or line.
+ - caplines: A tuple of `.Line2D` instances of the error bar caps.
+ - barlinecols: A tuple of `.LineCollection` with the horizontal and
+ vertical error ranges.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ All other keyword arguments are passed on to the `~.Axes.plot` call
+ drawing the markers. For example, this code makes big red squares
+ with thick green edges::
+
+ x, y, yerr = rand(3, 10)
+ errorbar(x, y, yerr, marker='s', mfc='red',
+ mec='green', ms=20, mew=4)
+
+ where *mfc*, *mec*, *ms* and *mew* are aliases for the longer
+ property names, *markerfacecolor*, *markeredgecolor*, *markersize*
+ and *markeredgewidth*.
+
+ Valid kwargs for the marker properties are `.Line2D` properties:
+
+ %(Line2D_kwdoc)s
+ """
+ kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
+ # anything that comes in as 'None', drop so the default thing
+ # happens down stream
+ kwargs = {k: v for k, v in kwargs.items() if v is not None}
+ kwargs.setdefault('zorder', 2)
+
+ self._process_unit_info([("x", x), ("y", y)], kwargs, convert=False)
+
+ # Make sure all the args are iterable; use lists not arrays to preserve
+ # units.
+ if not np.iterable(x):
+ x = [x]
+
+ if not np.iterable(y):
+ y = [y]
+
+ if len(x) != len(y):
+ raise ValueError("'x' and 'y' must have the same size")
+
+ if xerr is not None:
+ if not np.iterable(xerr):
+ xerr = [xerr] * len(x)
+
+ if yerr is not None:
+ if not np.iterable(yerr):
+ yerr = [yerr] * len(y)
+
+ if isinstance(errorevery, Integral):
+ errorevery = (0, errorevery)
+ if isinstance(errorevery, tuple):
+ if (len(errorevery) == 2 and
+ isinstance(errorevery[0], Integral) and
+ isinstance(errorevery[1], Integral)):
+ errorevery = slice(errorevery[0], None, errorevery[1])
+ else:
+ raise ValueError(
+ f'errorevery={errorevery!r} is a not a tuple of two '
+ f'integers')
+
+ elif isinstance(errorevery, slice):
+ pass
+
+ elif not isinstance(errorevery, str) and np.iterable(errorevery):
+ # fancy indexing
+ try:
+ x[errorevery]
+ except (ValueError, IndexError) as err:
+ raise ValueError(
+ f"errorevery={errorevery!r} is iterable but not a valid "
+ f"NumPy fancy index to match 'xerr'/'yerr'") from err
+ else:
+ raise ValueError(
+ f"errorevery={errorevery!r} is not a recognized value")
+
+ label = kwargs.pop("label", None)
+ kwargs['label'] = '_nolegend_'
+
+ # Create the main line and determine overall kwargs for child artists.
+ # We avoid calling self.plot() directly, or self._get_lines(), because
+ # that would call self._process_unit_info again, and do other indirect
+ # data processing.
+ (data_line, base_style), = self._get_lines._plot_args(
+ (x, y) if fmt == '' else (x, y, fmt), kwargs, return_kwargs=True)
+
+ # Do this after creating `data_line` to avoid modifying `base_style`.
+ if barsabove:
+ data_line.set_zorder(kwargs['zorder'] - .1)
+ else:
+ data_line.set_zorder(kwargs['zorder'] + .1)
+
+ # Add line to plot, or throw it away and use it to determine kwargs.
+ if fmt.lower() != 'none':
+ self.add_line(data_line)
+ else:
+ data_line = None
+ # Remove alpha=0 color that _get_lines._plot_args returns for
+ # 'none' format, and replace it with user-specified color, if
+ # supplied.
+ base_style.pop('color')
+ if 'color' in kwargs:
+ base_style['color'] = kwargs.pop('color')
+
+ if 'color' not in base_style:
+ base_style['color'] = 'C0'
+ if ecolor is None:
+ ecolor = base_style['color']
+
+ # Eject any line-specific information from format string, as it's not
+ # needed for bars or caps.
+ for key in ['marker', 'markersize', 'markerfacecolor',
+ 'markeredgewidth', 'markeredgecolor', 'markevery',
+ 'linestyle', 'fillstyle', 'drawstyle', 'dash_capstyle',
+ 'dash_joinstyle', 'solid_capstyle', 'solid_joinstyle']:
+ base_style.pop(key, None)
+
+ # Make the style dict for the line collections (the bars).
+ eb_lines_style = {**base_style, 'color': ecolor}
+
+ if elinewidth is not None:
+ eb_lines_style['linewidth'] = elinewidth
+ elif 'linewidth' in kwargs:
+ eb_lines_style['linewidth'] = kwargs['linewidth']
+
+ for key in ('transform', 'alpha', 'zorder', 'rasterized'):
+ if key in kwargs:
+ eb_lines_style[key] = kwargs[key]
+
+ # Make the style dict for caps (the "hats").
+ eb_cap_style = {**base_style, 'linestyle': 'none'}
+ if capsize is None:
+ capsize = rcParams["errorbar.capsize"]
+ if capsize > 0:
+ eb_cap_style['markersize'] = 2. * capsize
+ if capthick is not None:
+ eb_cap_style['markeredgewidth'] = capthick
+
+ # For backwards-compat, allow explicit setting of
+ # 'markeredgewidth' to over-ride capthick.
+ for key in ('markeredgewidth', 'transform', 'alpha',
+ 'zorder', 'rasterized'):
+ if key in kwargs:
+ eb_cap_style[key] = kwargs[key]
+ eb_cap_style['color'] = ecolor
+
+ barcols = []
+ caplines = []
+
+ # arrays fine here, they are booleans and hence not units
+ lolims = np.broadcast_to(lolims, len(x)).astype(bool)
+ uplims = np.broadcast_to(uplims, len(x)).astype(bool)
+ xlolims = np.broadcast_to(xlolims, len(x)).astype(bool)
+ xuplims = np.broadcast_to(xuplims, len(x)).astype(bool)
+
+ everymask = np.zeros(len(x), bool)
+ everymask[errorevery] = True
+
+ def apply_mask(arrays, mask):
+ # Return, for each array in *arrays*, the elements for which *mask*
+ # is True, without using fancy indexing.
+ return [[*itertools.compress(array, mask)] for array in arrays]
+
+ def extract_err(name, err, data, lolims, uplims):
+ """
+ Private function to compute error bars.
+
+ Parameters
+ ----------
+ name : {'x', 'y'}
+ Name used in the error message.
+ err : array-like
+ xerr or yerr from errorbar().
+ data : array-like
+ x or y from errorbar().
+ lolims : array-like
+ Error is only applied on **upper** side when this is True. See
+ the note in the main docstring about this parameter's name.
+ uplims : array-like
+ Error is only applied on **lower** side when this is True. See
+ the note in the main docstring about this parameter's name.
+ """
+ try: # Asymmetric error: pair of 1D iterables.
+ a, b = err
+ iter(a)
+ iter(b)
+ except (TypeError, ValueError):
+ a = b = err # Symmetric error: 1D iterable.
+ if np.ndim(a) > 1 or np.ndim(b) > 1:
+ raise ValueError(
+ f"{name}err must be a scalar or a 1D or (2, n) array-like")
+ # Using list comprehensions rather than arrays to preserve units.
+ for e in [a, b]:
+ if len(data) != len(e):
+ raise ValueError(
+ f"The lengths of the data ({len(data)}) and the "
+ f"error {len(e)} do not match")
+ low = [v if lo else v - e for v, e, lo in zip(data, a, lolims)]
+ high = [v if up else v + e for v, e, up in zip(data, b, uplims)]
+ return low, high
+
+ if xerr is not None:
+ left, right = extract_err('x', xerr, x, xlolims, xuplims)
+ barcols.append(self.hlines(
+ *apply_mask([y, left, right], everymask), **eb_lines_style))
+ # select points without upper/lower limits in x and
+ # draw normal errorbars for these points
+ noxlims = ~(xlolims | xuplims)
+ if noxlims.any() and capsize > 0:
+ yo, lo, ro = apply_mask([y, left, right], noxlims & everymask)
+ caplines.extend([
+ mlines.Line2D(lo, yo, marker='|', **eb_cap_style),
+ mlines.Line2D(ro, yo, marker='|', **eb_cap_style)])
+ if xlolims.any():
+ xo, yo, ro = apply_mask([x, y, right], xlolims & everymask)
+ if self.xaxis_inverted():
+ marker = mlines.CARETLEFTBASE
+ else:
+ marker = mlines.CARETRIGHTBASE
+ caplines.append(mlines.Line2D(
+ ro, yo, ls='None', marker=marker, **eb_cap_style))
+ if capsize > 0:
+ caplines.append(mlines.Line2D(
+ xo, yo, marker='|', **eb_cap_style))
+ if xuplims.any():
+ xo, yo, lo = apply_mask([x, y, left], xuplims & everymask)
+ if self.xaxis_inverted():
+ marker = mlines.CARETRIGHTBASE
+ else:
+ marker = mlines.CARETLEFTBASE
+ caplines.append(mlines.Line2D(
+ lo, yo, ls='None', marker=marker, **eb_cap_style))
+ if capsize > 0:
+ caplines.append(mlines.Line2D(
+ xo, yo, marker='|', **eb_cap_style))
+
+ if yerr is not None:
+ lower, upper = extract_err('y', yerr, y, lolims, uplims)
+ barcols.append(self.vlines(
+ *apply_mask([x, lower, upper], everymask), **eb_lines_style))
+ # select points without upper/lower limits in y and
+ # draw normal errorbars for these points
+ noylims = ~(lolims | uplims)
+ if noylims.any() and capsize > 0:
+ xo, lo, uo = apply_mask([x, lower, upper], noylims & everymask)
+ caplines.extend([
+ mlines.Line2D(xo, lo, marker='_', **eb_cap_style),
+ mlines.Line2D(xo, uo, marker='_', **eb_cap_style)])
+ if lolims.any():
+ xo, yo, uo = apply_mask([x, y, upper], lolims & everymask)
+ if self.yaxis_inverted():
+ marker = mlines.CARETDOWNBASE
+ else:
+ marker = mlines.CARETUPBASE
+ caplines.append(mlines.Line2D(
+ xo, uo, ls='None', marker=marker, **eb_cap_style))
+ if capsize > 0:
+ caplines.append(mlines.Line2D(
+ xo, yo, marker='_', **eb_cap_style))
+ if uplims.any():
+ xo, yo, lo = apply_mask([x, y, lower], uplims & everymask)
+ if self.yaxis_inverted():
+ marker = mlines.CARETUPBASE
+ else:
+ marker = mlines.CARETDOWNBASE
+ caplines.append(mlines.Line2D(
+ xo, lo, ls='None', marker=marker, **eb_cap_style))
+ if capsize > 0:
+ caplines.append(mlines.Line2D(
+ xo, yo, marker='_', **eb_cap_style))
+
+ for l in caplines:
+ self.add_line(l)
+
+ self._request_autoscale_view()
+ errorbar_container = ErrorbarContainer(
+ (data_line, tuple(caplines), tuple(barcols)),
+ has_xerr=(xerr is not None), has_yerr=(yerr is not None),
+ label=label)
+ self.containers.append(errorbar_container)
+
+ return errorbar_container # (l0, caplines, barcols)
+
+ @_preprocess_data()
+ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
+ positions=None, widths=None, patch_artist=None,
+ bootstrap=None, usermedians=None, conf_intervals=None,
+ meanline=None, showmeans=None, showcaps=None,
+ showbox=None, showfliers=None, boxprops=None,
+ labels=None, flierprops=None, medianprops=None,
+ meanprops=None, capprops=None, whiskerprops=None,
+ manage_ticks=True, autorange=False, zorder=None):
+ """
+ Make a box and whisker plot.
+
+ Make a box and whisker plot for each column of *x* or each
+ vector in sequence *x*. The box extends from the lower to
+ upper quartile values of the data, with a line at the median.
+ The whiskers extend from the box to show the range of the
+ data. Flier points are those past the end of the whiskers.
+
+ Parameters
+ ----------
+ x : Array or a sequence of vectors.
+ The input data.
+
+ notch : bool, default: False
+ Whether to draw a notched box plot (`True`), or a rectangular box
+ plot (`False`). The notches represent the confidence interval (CI)
+ around the median. The documentation for *bootstrap* describes how
+ the locations of the notches are computed by default, but their
+ locations may also be overridden by setting the *conf_intervals*
+ parameter.
+
+ .. note::
+
+ In cases where the values of the CI are less than the
+ lower quartile or greater than the upper quartile, the
+ notches will extend beyond the box, giving it a
+ distinctive "flipped" appearance. This is expected
+ behavior and consistent with other statistical
+ visualization packages.
+
+ sym : str, optional
+ The default symbol for flier points. An empty string ('') hides
+ the fliers. If `None`, then the fliers default to 'b+'. More
+ control is provided by the *flierprops* parameter.
+
+ vert : bool, default: True
+ If `True`, draws vertical boxes.
+ If `False`, draw horizontal boxes.
+
+ whis : float or (float, float), default: 1.5
+ The position of the whiskers.
+
+ If a float, the lower whisker is at the lowest datum above
+ ``Q1 - whis*(Q3-Q1)``, and the upper whisker at the highest datum
+ below ``Q3 + whis*(Q3-Q1)``, where Q1 and Q3 are the first and
+ third quartiles. The default value of ``whis = 1.5`` corresponds
+ to Tukey's original definition of boxplots.
+
+ If a pair of floats, they indicate the percentiles at which to
+ draw the whiskers (e.g., (5, 95)). In particular, setting this to
+ (0, 100) results in whiskers covering the whole range of the data.
+
+ In the edge case where ``Q1 == Q3``, *whis* is automatically set
+ to (0, 100) (cover the whole range of the data) if *autorange* is
+ True.
+
+ Beyond the whiskers, data are considered outliers and are plotted
+ as individual points.
+
+ bootstrap : int, optional
+ Specifies whether to bootstrap the confidence intervals
+ around the median for notched boxplots. If *bootstrap* is
+ None, no bootstrapping is performed, and notches are
+ calculated using a Gaussian-based asymptotic approximation
+ (see McGill, R., Tukey, J.W., and Larsen, W.A., 1978, and
+ Kendall and Stuart, 1967). Otherwise, bootstrap specifies
+ the number of times to bootstrap the median to determine its
+ 95% confidence intervals. Values between 1000 and 10000 are
+ recommended.
+
+ usermedians : 1D array-like, optional
+ A 1D array-like of length ``len(x)``. Each entry that is not
+ `None` forces the value of the median for the corresponding
+ dataset. For entries that are `None`, the medians are computed
+ by Matplotlib as normal.
+
+ conf_intervals : array-like, optional
+ A 2D array-like of shape ``(len(x), 2)``. Each entry that is not
+ None forces the location of the corresponding notch (which is
+ only drawn if *notch* is `True`). For entries that are `None`,
+ the notches are computed by the method specified by the other
+ parameters (e.g., *bootstrap*).
+
+ positions : array-like, optional
+ The positions of the boxes. The ticks and limits are
+ automatically set to match the positions. Defaults to
+ ``range(1, N+1)`` where N is the number of boxes to be drawn.
+
+ widths : float or array-like
+ The widths of the boxes. The default is 0.5, or ``0.15*(distance
+ between extreme positions)``, if that is smaller.
+
+ patch_artist : bool, default: False
+ If `False` produces boxes with the Line2D artist. Otherwise,
+ boxes and drawn with Patch artists.
+
+ labels : sequence, optional
+ Labels for each dataset (one per dataset).
+
+ manage_ticks : bool, default: True
+ If True, the tick locations and labels will be adjusted to match
+ the boxplot positions.
+
+ autorange : bool, default: False
+ When `True` and the data are distributed such that the 25th and
+ 75th percentiles are equal, *whis* is set to (0, 100) such
+ that the whisker ends are at the minimum and maximum of the data.
+
+ meanline : bool, default: False
+ If `True` (and *showmeans* is `True`), will try to render the
+ mean as a line spanning the full width of the box according to
+ *meanprops* (see below). Not recommended if *shownotches* is also
+ True. Otherwise, means will be shown as points.
+
+ zorder : float, default: ``Line2D.zorder = 2``
+ The zorder of the boxplot.
+
+ Returns
+ -------
+ dict
+ A dictionary mapping each component of the boxplot to a list
+ of the `.Line2D` instances created. That dictionary has the
+ following keys (assuming vertical boxplots):
+
+ - ``boxes``: the main body of the boxplot showing the
+ quartiles and the median's confidence intervals if
+ enabled.
+
+ - ``medians``: horizontal lines at the median of each box.
+
+ - ``whiskers``: the vertical lines extending to the most
+ extreme, non-outlier data points.
+
+ - ``caps``: the horizontal lines at the ends of the
+ whiskers.
+
+ - ``fliers``: points representing data that extend beyond
+ the whiskers (fliers).
+
+ - ``means``: points or lines representing the means.
+
+ Other Parameters
+ ----------------
+ showcaps : bool, default: True
+ Show the caps on the ends of whiskers.
+ showbox : bool, default: True
+ Show the central box.
+ showfliers : bool, default: True
+ Show the outliers beyond the caps.
+ showmeans : bool, default: False
+ Show the arithmetic means.
+ capprops : dict, default: None
+ The style of the caps.
+ boxprops : dict, default: None
+ The style of the box.
+ whiskerprops : dict, default: None
+ The style of the whiskers.
+ flierprops : dict, default: None
+ The style of the fliers.
+ medianprops : dict, default: None
+ The style of the median.
+ meanprops : dict, default: None
+ The style of the mean.
+
+ Notes
+ -----
+ Box plots provide insight into distribution properties of the data.
+ However, they can be challenging to interpret for the unfamiliar
+ reader. The figure below illustrates the different visual features of
+ a box plot.
+
+ .. image:: /_static/boxplot_explanation.png
+ :alt: Illustration of box plot features
+ :scale: 50 %
+
+ The whiskers mark the range of the non-outlier data. The most common
+ definition of non-outlier is ``[Q1 - 1.5xIQR, Q3 + 1.5xIQR]``, which
+ is also the default in this function. Other whisker meanings can be
+ applied via the *whis* parameter.
+
+ See `Box plot `_ on Wikipedia
+ for further information.
+
+ Violin plots (`~.Axes.violinplot`) add even more detail about the
+ statistical distribution by plotting the kernel density estimation
+ (KDE) as an estimation of the probability density function.
+ """
+
+ # Missing arguments default to rcParams.
+ if whis is None:
+ whis = rcParams['boxplot.whiskers']
+ if bootstrap is None:
+ bootstrap = rcParams['boxplot.bootstrap']
+
+ bxpstats = cbook.boxplot_stats(x, whis=whis, bootstrap=bootstrap,
+ labels=labels, autorange=autorange)
+ if notch is None:
+ notch = rcParams['boxplot.notch']
+ if vert is None:
+ vert = rcParams['boxplot.vertical']
+ if patch_artist is None:
+ patch_artist = rcParams['boxplot.patchartist']
+ if meanline is None:
+ meanline = rcParams['boxplot.meanline']
+ if showmeans is None:
+ showmeans = rcParams['boxplot.showmeans']
+ if showcaps is None:
+ showcaps = rcParams['boxplot.showcaps']
+ if showbox is None:
+ showbox = rcParams['boxplot.showbox']
+ if showfliers is None:
+ showfliers = rcParams['boxplot.showfliers']
+
+ if boxprops is None:
+ boxprops = {}
+ if whiskerprops is None:
+ whiskerprops = {}
+ if capprops is None:
+ capprops = {}
+ if medianprops is None:
+ medianprops = {}
+ if meanprops is None:
+ meanprops = {}
+ if flierprops is None:
+ flierprops = {}
+
+ if patch_artist:
+ boxprops['linestyle'] = 'solid' # Not consistent with bxp.
+ if 'color' in boxprops:
+ boxprops['edgecolor'] = boxprops.pop('color')
+
+ # if non-default sym value, put it into the flier dictionary
+ # the logic for providing the default symbol ('b+') now lives
+ # in bxp in the initial value of final_flierprops
+ # handle all of the *sym* related logic here so we only have to pass
+ # on the flierprops dict.
+ if sym is not None:
+ # no-flier case, which should really be done with
+ # 'showfliers=False' but none-the-less deal with it to keep back
+ # compatibility
+ if sym == '':
+ # blow away existing dict and make one for invisible markers
+ flierprops = dict(linestyle='none', marker='', color='none')
+ # turn the fliers off just to be safe
+ showfliers = False
+ # now process the symbol string
+ else:
+ # process the symbol string
+ # discarded linestyle
+ _, marker, color = _process_plot_format(sym)
+ # if we have a marker, use it
+ if marker is not None:
+ flierprops['marker'] = marker
+ # if we have a color, use it
+ if color is not None:
+ # assume that if color is passed in the user want
+ # filled symbol, if the users want more control use
+ # flierprops
+ flierprops['color'] = color
+ flierprops['markerfacecolor'] = color
+ flierprops['markeredgecolor'] = color
+
+ # replace medians if necessary:
+ if usermedians is not None:
+ if (len(np.ravel(usermedians)) != len(bxpstats) or
+ np.shape(usermedians)[0] != len(bxpstats)):
+ raise ValueError(
+ "'usermedians' and 'x' have different lengths")
+ else:
+ # reassign medians as necessary
+ for stats, med in zip(bxpstats, usermedians):
+ if med is not None:
+ stats['med'] = med
+
+ if conf_intervals is not None:
+ if len(conf_intervals) != len(bxpstats):
+ raise ValueError(
+ "'conf_intervals' and 'x' have different lengths")
+ else:
+ for stats, ci in zip(bxpstats, conf_intervals):
+ if ci is not None:
+ if len(ci) != 2:
+ raise ValueError('each confidence interval must '
+ 'have two values')
+ else:
+ if ci[0] is not None:
+ stats['cilo'] = ci[0]
+ if ci[1] is not None:
+ stats['cihi'] = ci[1]
+
+ artists = self.bxp(bxpstats, positions=positions, widths=widths,
+ vert=vert, patch_artist=patch_artist,
+ shownotches=notch, showmeans=showmeans,
+ showcaps=showcaps, showbox=showbox,
+ boxprops=boxprops, flierprops=flierprops,
+ medianprops=medianprops, meanprops=meanprops,
+ meanline=meanline, showfliers=showfliers,
+ capprops=capprops, whiskerprops=whiskerprops,
+ manage_ticks=manage_ticks, zorder=zorder)
+ return artists
+
+ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
+ patch_artist=False, shownotches=False, showmeans=False,
+ showcaps=True, showbox=True, showfliers=True,
+ boxprops=None, whiskerprops=None, flierprops=None,
+ medianprops=None, capprops=None, meanprops=None,
+ meanline=False, manage_ticks=True, zorder=None):
+ """
+ Drawing function for box and whisker plots.
+
+ Make a box and whisker plot for each column of *x* or each
+ vector in sequence *x*. The box extends from the lower to
+ upper quartile values of the data, with a line at the median.
+ The whiskers extend from the box to show the range of the
+ data. Flier points are those past the end of the whiskers.
+
+ Parameters
+ ----------
+ bxpstats : list of dicts
+ A list of dictionaries containing stats for each boxplot.
+ Required keys are:
+
+ - ``med``: The median (scalar float).
+
+ - ``q1``: The first quartile (25th percentile) (scalar
+ float).
+
+ - ``q3``: The third quartile (75th percentile) (scalar
+ float).
+
+ - ``whislo``: Lower bound of the lower whisker (scalar
+ float).
+
+ - ``whishi``: Upper bound of the upper whisker (scalar
+ float).
+
+ Optional keys are:
+
+ - ``mean``: The mean (scalar float). Needed if
+ ``showmeans=True``.
+
+ - ``fliers``: Data beyond the whiskers (sequence of floats).
+ Needed if ``showfliers=True``.
+
+ - ``cilo`` & ``cihi``: Lower and upper confidence intervals
+ about the median. Needed if ``shownotches=True``.
+
+ - ``label``: Name of the dataset (string). If available,
+ this will be used a tick label for the boxplot
+
+ positions : array-like, default: [1, 2, ..., n]
+ The positions of the boxes. The ticks and limits
+ are automatically set to match the positions.
+
+ widths : array-like, default: None
+ Either a scalar or a vector and sets the width of each
+ box. The default is ``0.15*(distance between extreme
+ positions)``, clipped to no less than 0.15 and no more than
+ 0.5.
+
+ vert : bool, default: True
+ If `True` (default), makes the boxes vertical. If `False`,
+ makes horizontal boxes.
+
+ patch_artist : bool, default: False
+ If `False` produces boxes with the `.Line2D` artist.
+ If `True` produces boxes with the `~matplotlib.patches.Patch` artist.
+
+ shownotches : bool, default: False
+ If `False` (default), produces a rectangular box plot.
+ If `True`, will produce a notched box plot
+
+ showmeans : bool, default: False
+ If `True`, will toggle on the rendering of the means
+
+ showcaps : bool, default: True
+ If `True`, will toggle on the rendering of the caps
+
+ showbox : bool, default: True
+ If `True`, will toggle on the rendering of the box
+
+ showfliers : bool, default: True
+ If `True`, will toggle on the rendering of the fliers
+
+ boxprops : dict or None (default)
+ If provided, will set the plotting style of the boxes
+
+ whiskerprops : dict or None (default)
+ If provided, will set the plotting style of the whiskers
+
+ capprops : dict or None (default)
+ If provided, will set the plotting style of the caps
+
+ flierprops : dict or None (default)
+ If provided will set the plotting style of the fliers
+
+ medianprops : dict or None (default)
+ If provided, will set the plotting style of the medians
+
+ meanprops : dict or None (default)
+ If provided, will set the plotting style of the means
+
+ meanline : bool, default: False
+ If `True` (and *showmeans* is `True`), will try to render the mean
+ as a line spanning the full width of the box according to
+ *meanprops*. Not recommended if *shownotches* is also True.
+ Otherwise, means will be shown as points.
+
+ manage_ticks : bool, default: True
+ If True, the tick locations and labels will be adjusted to match the
+ boxplot positions.
+
+ zorder : float, default: ``Line2D.zorder = 2``
+ The zorder of the resulting boxplot.
+
+ Returns
+ -------
+ dict
+ A dictionary mapping each component of the boxplot to a list
+ of the `.Line2D` instances created. That dictionary has the
+ following keys (assuming vertical boxplots):
+
+ - ``boxes``: the main body of the boxplot showing the
+ quartiles and the median's confidence intervals if
+ enabled.
+
+ - ``medians``: horizontal lines at the median of each box.
+
+ - ``whiskers``: the vertical lines extending to the most
+ extreme, non-outlier data points.
+
+ - ``caps``: the horizontal lines at the ends of the
+ whiskers.
+
+ - ``fliers``: points representing data that extend beyond
+ the whiskers (fliers).
+
+ - ``means``: points or lines representing the means.
+
+ Examples
+ --------
+ .. plot:: gallery/statistics/bxp.py
+
+ """
+ # lists of artists to be output
+ whiskers = []
+ caps = []
+ boxes = []
+ medians = []
+ means = []
+ fliers = []
+
+ # empty list of xticklabels
+ datalabels = []
+
+ # Use default zorder if none specified
+ if zorder is None:
+ zorder = mlines.Line2D.zorder
+
+ zdelta = 0.1
+
+ def line_props_with_rcdefaults(subkey, explicit, zdelta=0,
+ use_marker=True):
+ d = {k.split('.')[-1]: v for k, v in rcParams.items()
+ if k.startswith(f'boxplot.{subkey}')}
+ d['zorder'] = zorder + zdelta
+ if not use_marker:
+ d['marker'] = ''
+ d.update(cbook.normalize_kwargs(explicit, mlines.Line2D))
+ return d
+
+ # box properties
+ if patch_artist:
+ final_boxprops = {
+ 'linestyle': rcParams['boxplot.boxprops.linestyle'],
+ 'linewidth': rcParams['boxplot.boxprops.linewidth'],
+ 'edgecolor': rcParams['boxplot.boxprops.color'],
+ 'facecolor': ('white' if rcParams['_internal.classic_mode']
+ else rcParams['patch.facecolor']),
+ 'zorder': zorder,
+ **cbook.normalize_kwargs(boxprops, mpatches.PathPatch)
+ }
+ else:
+ final_boxprops = line_props_with_rcdefaults('boxprops', boxprops,
+ use_marker=False)
+ final_whiskerprops = line_props_with_rcdefaults(
+ 'whiskerprops', whiskerprops, use_marker=False)
+ final_capprops = line_props_with_rcdefaults(
+ 'capprops', capprops, use_marker=False)
+ final_flierprops = line_props_with_rcdefaults(
+ 'flierprops', flierprops)
+ final_medianprops = line_props_with_rcdefaults(
+ 'medianprops', medianprops, zdelta, use_marker=False)
+ final_meanprops = line_props_with_rcdefaults(
+ 'meanprops', meanprops, zdelta)
+ removed_prop = 'marker' if meanline else 'linestyle'
+ # Only remove the property if it's not set explicitly as a parameter.
+ if meanprops is None or removed_prop not in meanprops:
+ final_meanprops[removed_prop] = ''
+
+ def patch_list(xs, ys, **kwargs):
+ path = mpath.Path(
+ # Last vertex will have a CLOSEPOLY code and thus be ignored.
+ np.append(np.column_stack([xs, ys]), [(0, 0)], 0),
+ closed=True)
+ patch = mpatches.PathPatch(path, **kwargs)
+ self.add_artist(patch)
+ return [patch]
+
+ # vertical or horizontal plot?
+ if vert:
+ def doplot(*args, **kwargs):
+ return self.plot(*args, **kwargs)
+
+ def dopatch(xs, ys, **kwargs):
+ return patch_list(xs, ys, **kwargs)
+
+ else:
+ def doplot(*args, **kwargs):
+ shuffled = []
+ for i in range(0, len(args), 2):
+ shuffled.extend([args[i + 1], args[i]])
+ return self.plot(*shuffled, **kwargs)
+
+ def dopatch(xs, ys, **kwargs):
+ xs, ys = ys, xs # flip X, Y
+ return patch_list(xs, ys, **kwargs)
+
+ # input validation
+ N = len(bxpstats)
+ datashape_message = ("List of boxplot statistics and `{0}` "
+ "values must have same the length")
+ # check position
+ if positions is None:
+ positions = list(range(1, N + 1))
+ elif len(positions) != N:
+ raise ValueError(datashape_message.format("positions"))
+
+ positions = np.array(positions)
+ if len(positions) > 0 and not isinstance(positions[0], Number):
+ raise TypeError("positions should be an iterable of numbers")
+
+ # width
+ if widths is None:
+ widths = [np.clip(0.15 * np.ptp(positions), 0.15, 0.5)] * N
+ elif np.isscalar(widths):
+ widths = [widths] * N
+ elif len(widths) != N:
+ raise ValueError(datashape_message.format("widths"))
+
+ for pos, width, stats in zip(positions, widths, bxpstats):
+ # try to find a new label
+ datalabels.append(stats.get('label', pos))
+
+ # whisker coords
+ whisker_x = np.ones(2) * pos
+ whiskerlo_y = np.array([stats['q1'], stats['whislo']])
+ whiskerhi_y = np.array([stats['q3'], stats['whishi']])
+
+ # cap coords
+ cap_left = pos - width * 0.25
+ cap_right = pos + width * 0.25
+ cap_x = np.array([cap_left, cap_right])
+ cap_lo = np.ones(2) * stats['whislo']
+ cap_hi = np.ones(2) * stats['whishi']
+
+ # box and median coords
+ box_left = pos - width * 0.5
+ box_right = pos + width * 0.5
+ med_y = [stats['med'], stats['med']]
+
+ # notched boxes
+ if shownotches:
+ box_x = [box_left, box_right, box_right, cap_right, box_right,
+ box_right, box_left, box_left, cap_left, box_left,
+ box_left]
+ box_y = [stats['q1'], stats['q1'], stats['cilo'],
+ stats['med'], stats['cihi'], stats['q3'],
+ stats['q3'], stats['cihi'], stats['med'],
+ stats['cilo'], stats['q1']]
+ med_x = cap_x
+
+ # plain boxes
+ else:
+ box_x = [box_left, box_right, box_right, box_left, box_left]
+ box_y = [stats['q1'], stats['q1'], stats['q3'], stats['q3'],
+ stats['q1']]
+ med_x = [box_left, box_right]
+
+ # maybe draw the box:
+ if showbox:
+ if patch_artist:
+ boxes.extend(dopatch(box_x, box_y, **final_boxprops))
+ else:
+ boxes.extend(doplot(box_x, box_y, **final_boxprops))
+
+ # draw the whiskers
+ whiskers.extend(doplot(
+ whisker_x, whiskerlo_y, **final_whiskerprops
+ ))
+ whiskers.extend(doplot(
+ whisker_x, whiskerhi_y, **final_whiskerprops
+ ))
+
+ # maybe draw the caps:
+ if showcaps:
+ caps.extend(doplot(cap_x, cap_lo, **final_capprops))
+ caps.extend(doplot(cap_x, cap_hi, **final_capprops))
+
+ # draw the medians
+ medians.extend(doplot(med_x, med_y, **final_medianprops))
+
+ # maybe draw the means
+ if showmeans:
+ if meanline:
+ means.extend(doplot(
+ [box_left, box_right], [stats['mean'], stats['mean']],
+ **final_meanprops
+ ))
+ else:
+ means.extend(doplot(
+ [pos], [stats['mean']], **final_meanprops
+ ))
+
+ # maybe draw the fliers
+ if showfliers:
+ # fliers coords
+ flier_x = np.full(len(stats['fliers']), pos, dtype=np.float64)
+ flier_y = stats['fliers']
+
+ fliers.extend(doplot(
+ flier_x, flier_y, **final_flierprops
+ ))
+
+ if manage_ticks:
+ axis_name = "x" if vert else "y"
+ interval = getattr(self.dataLim, f"interval{axis_name}")
+ axis = getattr(self, f"{axis_name}axis")
+ positions = axis.convert_units(positions)
+ # The 0.5 additional padding ensures reasonable-looking boxes
+ # even when drawing a single box. We set the sticky edge to
+ # prevent margins expansion, in order to match old behavior (back
+ # when separate calls to boxplot() would completely reset the axis
+ # limits regardless of what was drawn before). The sticky edges
+ # are attached to the median lines, as they are always present.
+ interval[:] = (min(interval[0], min(positions) - .5),
+ max(interval[1], max(positions) + .5))
+ for median, position in zip(medians, positions):
+ getattr(median.sticky_edges, axis_name).extend(
+ [position - .5, position + .5])
+ # Modified from Axis.set_ticks and Axis.set_ticklabels.
+ locator = axis.get_major_locator()
+ if not isinstance(axis.get_major_locator(),
+ mticker.FixedLocator):
+ locator = mticker.FixedLocator([])
+ axis.set_major_locator(locator)
+ locator.locs = np.array([*locator.locs, *positions])
+ formatter = axis.get_major_formatter()
+ if not isinstance(axis.get_major_formatter(),
+ mticker.FixedFormatter):
+ formatter = mticker.FixedFormatter([])
+ axis.set_major_formatter(formatter)
+ formatter.seq = [*formatter.seq, *datalabels]
+
+ self._request_autoscale_view(
+ scalex=self._autoscaleXon, scaley=self._autoscaleYon)
+
+ return dict(whiskers=whiskers, caps=caps, boxes=boxes,
+ medians=medians, fliers=fliers, means=means)
+
+ @staticmethod
+ def _parse_scatter_color_args(c, edgecolors, kwargs, xsize,
+ get_next_color_func):
+ """
+ Helper function to process color related arguments of `.Axes.scatter`.
+
+ Argument precedence for facecolors:
+
+ - c (if not None)
+ - kwargs['facecolor']
+ - kwargs['facecolors']
+ - kwargs['color'] (==kwcolor)
+ - 'b' if in classic mode else the result of ``get_next_color_func()``
+
+ Argument precedence for edgecolors:
+
+ - kwargs['edgecolor']
+ - edgecolors (is an explicit kw argument in scatter())
+ - kwargs['color'] (==kwcolor)
+ - 'face' if not in classic mode else None
+
+ Parameters
+ ----------
+ c : color or sequence or sequence of color or None
+ See argument description of `.Axes.scatter`.
+ edgecolors : color or sequence of color or {'face', 'none'} or None
+ See argument description of `.Axes.scatter`.
+ kwargs : dict
+ Additional kwargs. If these keys exist, we pop and process them:
+ 'facecolors', 'facecolor', 'edgecolor', 'color'
+ Note: The dict is modified by this function.
+ xsize : int
+ The size of the x and y arrays passed to `.Axes.scatter`.
+ get_next_color_func : callable
+ A callable that returns a color. This color is used as facecolor
+ if no other color is provided.
+
+ Note, that this is a function rather than a fixed color value to
+ support conditional evaluation of the next color. As of the
+ current implementation obtaining the next color from the
+ property cycle advances the cycle. This must only happen if we
+ actually use the color, which will only be decided within this
+ method.
+
+ Returns
+ -------
+ c
+ The input *c* if it was not *None*, else a color derived from the
+ other inputs or defaults.
+ colors : array(N, 4) or None
+ The facecolors as RGBA values, or *None* if a colormap is used.
+ edgecolors
+ The edgecolor.
+
+ """
+ facecolors = kwargs.pop('facecolors', None)
+ facecolors = kwargs.pop('facecolor', facecolors)
+ edgecolors = kwargs.pop('edgecolor', edgecolors)
+
+ kwcolor = kwargs.pop('color', None)
+
+ if kwcolor is not None and c is not None:
+ raise ValueError("Supply a 'c' argument or a 'color'"
+ " kwarg but not both; they differ but"
+ " their functionalities overlap.")
+
+ if kwcolor is not None:
+ try:
+ mcolors.to_rgba_array(kwcolor)
+ except ValueError as err:
+ raise ValueError(
+ "'color' kwarg must be an color or sequence of color "
+ "specs. For a sequence of values to be color-mapped, use "
+ "the 'c' argument instead.") from err
+ if edgecolors is None:
+ edgecolors = kwcolor
+ if facecolors is None:
+ facecolors = kwcolor
+
+ if edgecolors is None and not rcParams['_internal.classic_mode']:
+ edgecolors = rcParams['scatter.edgecolors']
+
+ c_was_none = c is None
+ if c is None:
+ c = (facecolors if facecolors is not None
+ else "b" if rcParams['_internal.classic_mode']
+ else get_next_color_func())
+ c_is_string_or_strings = (
+ isinstance(c, str)
+ or (np.iterable(c) and len(c) > 0
+ and isinstance(cbook.safe_first_element(c), str)))
+
+ def invalid_shape_exception(csize, xsize):
+ return ValueError(
+ f"'c' argument has {csize} elements, which is inconsistent "
+ f"with 'x' and 'y' with size {xsize}.")
+
+ c_is_mapped = False # Unless proven otherwise below.
+ valid_shape = True # Unless proven otherwise below.
+ if not c_was_none and kwcolor is None and not c_is_string_or_strings:
+ try: # First, does 'c' look suitable for value-mapping?
+ c = np.asanyarray(c, dtype=float)
+ except ValueError:
+ pass # Failed to convert to float array; must be color specs.
+ else:
+ # handle the documented special case of a 2D array with 1
+ # row which as RGB(A) to broadcast.
+ if c.shape == (1, 4) or c.shape == (1, 3):
+ c_is_mapped = False
+ if c.size != xsize:
+ valid_shape = False
+ # If c can be either mapped values or a RGB(A) color, prefer
+ # the former if shapes match, the latter otherwise.
+ elif c.size == xsize:
+ c = c.ravel()
+ c_is_mapped = True
+ else: # Wrong size; it must not be intended for mapping.
+ if c.shape in ((3,), (4,)):
+ _log.warning(
+ "*c* argument looks like a single numeric RGB or "
+ "RGBA sequence, which should be avoided as value-"
+ "mapping will have precedence in case its length "
+ "matches with *x* & *y*. Please use the *color* "
+ "keyword-argument or provide a 2D array "
+ "with a single row if you intend to specify "
+ "the same RGB or RGBA value for all points.")
+ valid_shape = False
+ if not c_is_mapped:
+ try: # Is 'c' acceptable as PathCollection facecolors?
+ colors = mcolors.to_rgba_array(c)
+ except (TypeError, ValueError) as err:
+ if "RGBA values should be within 0-1 range" in str(err):
+ raise
+ else:
+ if not valid_shape:
+ raise invalid_shape_exception(c.size, xsize) from err
+ # Both the mapping *and* the RGBA conversion failed: pretty
+ # severe failure => one may appreciate a verbose feedback.
+ raise ValueError(
+ f"'c' argument must be a color, a sequence of colors, "
+ f"or a sequence of numbers, not {c}") from err
+ else:
+ if len(colors) not in (0, 1, xsize):
+ # NB: remember that a single color is also acceptable.
+ # Besides *colors* will be an empty array if c == 'none'.
+ raise invalid_shape_exception(len(colors), xsize)
+ else:
+ colors = None # use cmap, norm after collection is created
+ return c, colors, edgecolors
+
+ @_preprocess_data(replace_names=["x", "y", "s", "linewidths",
+ "edgecolors", "c", "facecolor",
+ "facecolors", "color"],
+ label_namer="y")
+ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
+ vmin=None, vmax=None, alpha=None, linewidths=None, *,
+ edgecolors=None, plotnonfinite=False, **kwargs):
+ """
+ A scatter plot of *y* vs. *x* with varying marker size and/or color.
+
+ Parameters
+ ----------
+ x, y : float or array-like, shape (n, )
+ The data positions.
+
+ s : float or array-like, shape (n, ), optional
+ The marker size in points**2.
+ Default is ``rcParams['lines.markersize'] ** 2``.
+
+ c : array-like or list of colors or color, optional
+ The marker colors. Possible values:
+
+ - A scalar or sequence of n numbers to be mapped to colors using
+ *cmap* and *norm*.
+ - A 2D array in which the rows are RGB or RGBA.
+ - A sequence of colors of length n.
+ - A single color format string.
+
+ Note that *c* should not be a single numeric RGB or RGBA sequence
+ because that is indistinguishable from an array of values to be
+ colormapped. If you want to specify the same RGB or RGBA value for
+ all points, use a 2D array with a single row. Otherwise, value-
+ matching will have precedence in case of a size matching with *x*
+ and *y*.
+
+ If you wish to specify a single color for all points
+ prefer the *color* keyword argument.
+
+ Defaults to `None`. In that case the marker color is determined
+ by the value of *color*, *facecolor* or *facecolors*. In case
+ those are not specified or `None`, the marker color is determined
+ by the next color of the ``Axes``' current "shape and fill" color
+ cycle. This cycle defaults to :rc:`axes.prop_cycle`.
+
+ marker : `~.markers.MarkerStyle`, default: :rc:`scatter.marker`
+ The marker style. *marker* can be either an instance of the class
+ or the text shorthand for a particular marker.
+ See :mod:`matplotlib.markers` for more information about marker
+ styles.
+
+ cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
+ A `.Colormap` instance or registered colormap name. *cmap* is only
+ used if *c* is an array of floats.
+
+ norm : `~matplotlib.colors.Normalize`, default: None
+ If *c* is an array of floats, *norm* is used to scale the color
+ data, *c*, in the range 0 to 1, in order to map into the colormap
+ *cmap*.
+ If *None*, use the default `.colors.Normalize`.
+
+ vmin, vmax : float, default: None
+ *vmin* and *vmax* are used in conjunction with the default norm to
+ map the color array *c* to the colormap *cmap*. If None, the
+ respective min and max of the color array is used.
+ It is deprecated to use *vmin*/*vmax* when *norm* is given.
+
+ alpha : float, default: None
+ The alpha blending value, between 0 (transparent) and 1 (opaque).
+
+ linewidths : float or array-like, default: :rc:`lines.linewidth`
+ The linewidth of the marker edges. Note: The default *edgecolors*
+ is 'face'. You may want to change this as well.
+
+ edgecolors : {'face', 'none', *None*} or color or sequence of color, \
+default: :rc:`scatter.edgecolors`
+ The edge color of the marker. Possible values:
+
+ - 'face': The edge color will always be the same as the face color.
+ - 'none': No patch boundary will be drawn.
+ - A color or sequence of colors.
+
+ For non-filled markers, *edgecolors* is ignored. Instead, the color
+ is determined like with 'face', i.e. from *c*, *colors*, or
+ *facecolors*.
+
+ plotnonfinite : bool, default: False
+ Whether to plot points with nonfinite *c* (i.e. ``inf``, ``-inf``
+ or ``nan``). If ``True`` the points are drawn with the *bad*
+ colormap color (see `.Colormap.set_bad`).
+
+ Returns
+ -------
+ `~matplotlib.collections.PathCollection`
+
+ Other Parameters
+ ----------------
+ **kwargs : `~matplotlib.collections.Collection` properties
+
+ See Also
+ --------
+ plot : To plot scatter plots when markers are identical in size and
+ color.
+
+ Notes
+ -----
+ * The `.plot` function will be faster for scatterplots where markers
+ don't vary in size or color.
+
+ * Any or all of *x*, *y*, *s*, and *c* may be masked arrays, in which
+ case all masks will be combined and only unmasked points will be
+ plotted.
+
+ * Fundamentally, scatter works with 1D arrays; *x*, *y*, *s*, and *c*
+ may be input as N-D arrays, but within scatter they will be
+ flattened. The exception is *c*, which will be flattened only if its
+ size matches the size of *x* and *y*.
+
+ """
+ # Process **kwargs to handle aliases, conflicts with explicit kwargs:
+
+ x, y = self._process_unit_info([("x", x), ("y", y)], kwargs)
+
+ # np.ma.ravel yields an ndarray, not a masked array,
+ # unless its argument is a masked array.
+ x = np.ma.ravel(x)
+ y = np.ma.ravel(y)
+ if x.size != y.size:
+ raise ValueError("x and y must be the same size")
+
+ if s is None:
+ s = (20 if rcParams['_internal.classic_mode'] else
+ rcParams['lines.markersize'] ** 2.0)
+ s = np.ma.ravel(s)
+ if (len(s) not in (1, x.size) or
+ (not np.issubdtype(s.dtype, np.floating) and
+ not np.issubdtype(s.dtype, np.integer))):
+ raise ValueError(
+ "s must be a scalar, "
+ "or float array-like with the same size as x and y")
+
+ # get the original edgecolor the user passed before we normalize
+ orig_edgecolor = edgecolors
+ if edgecolors is None:
+ orig_edgecolor = kwargs.get('edgecolor', None)
+ c, colors, edgecolors = \
+ self._parse_scatter_color_args(
+ c, edgecolors, kwargs, x.size,
+ get_next_color_func=self._get_patches_for_fill.get_next_color)
+
+ if plotnonfinite and colors is None:
+ c = np.ma.masked_invalid(c)
+ x, y, s, edgecolors, linewidths = \
+ cbook._combine_masks(x, y, s, edgecolors, linewidths)
+ else:
+ x, y, s, c, colors, edgecolors, linewidths = \
+ cbook._combine_masks(
+ x, y, s, c, colors, edgecolors, linewidths)
+ # Unmask edgecolors if it was actually a single RGB or RGBA.
+ if (x.size in (3, 4)
+ and np.ma.is_masked(edgecolors)
+ and not np.ma.is_masked(orig_edgecolor)):
+ edgecolors = edgecolors.data
+
+ scales = s # Renamed for readability below.
+
+ # load default marker from rcParams
+ if marker is None:
+ marker = rcParams['scatter.marker']
+
+ if isinstance(marker, mmarkers.MarkerStyle):
+ marker_obj = marker
+ else:
+ marker_obj = mmarkers.MarkerStyle(marker)
+
+ path = marker_obj.get_path().transformed(
+ marker_obj.get_transform())
+ if not marker_obj.is_filled():
+ if orig_edgecolor is not None:
+ _api.warn_external(
+ f"You passed a edgecolor/edgecolors ({orig_edgecolor!r}) "
+ f"for an unfilled marker ({marker!r}). Matplotlib is "
+ "ignoring the edgecolor in favor of the facecolor. This "
+ "behavior may change in the future."
+ )
+ # We need to handle markers that can not be filled (like
+ # '+' and 'x') differently than markers that can be
+ # filled, but have their fillstyle set to 'none'. This is
+ # to get:
+ #
+ # - respecting the fillestyle if set
+ # - maintaining back-compatibility for querying the facecolor of
+ # the un-fillable markers.
+ #
+ # While not an ideal situation, but is better than the
+ # alternatives.
+ if marker_obj.get_fillstyle() == 'none':
+ # promote the facecolor to be the edgecolor
+ edgecolors = colors
+ # set the facecolor to 'none' (at the last chance) because
+ # we can not not fill a path if the facecolor is non-null.
+ # (which is defendable at the renderer level)
+ colors = 'none'
+ else:
+ # if we are not nulling the face color we can do this
+ # simpler
+ edgecolors = 'face'
+
+ if linewidths is None:
+ linewidths = rcParams['lines.linewidth']
+ elif np.iterable(linewidths):
+ linewidths = [
+ lw if lw is not None else rcParams['lines.linewidth']
+ for lw in linewidths]
+
+ offsets = np.ma.column_stack([x, y])
+
+ collection = mcoll.PathCollection(
+ (path,), scales,
+ facecolors=colors,
+ edgecolors=edgecolors,
+ linewidths=linewidths,
+ offsets=offsets,
+ transOffset=kwargs.pop('transform', self.transData),
+ alpha=alpha
+ )
+ collection.set_transform(mtransforms.IdentityTransform())
+ collection.update(kwargs)
+
+ if colors is None:
+ collection.set_array(c)
+ collection.set_cmap(cmap)
+ collection.set_norm(norm)
+ collection._scale_norm(norm, vmin, vmax)
+
+ # Classic mode only:
+ # ensure there are margins to allow for the
+ # finite size of the symbols. In v2.x, margins
+ # are present by default, so we disable this
+ # scatter-specific override.
+ if rcParams['_internal.classic_mode']:
+ if self._xmargin < 0.05 and x.size > 0:
+ self.set_xmargin(0.05)
+ if self._ymargin < 0.05 and x.size > 0:
+ self.set_ymargin(0.05)
+
+ self.add_collection(collection)
+ self._request_autoscale_view()
+
+ return collection
+
+ @_preprocess_data(replace_names=["x", "y", "C"], label_namer="y")
+ @docstring.dedent_interpd
+ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
+ xscale='linear', yscale='linear', extent=None,
+ cmap=None, norm=None, vmin=None, vmax=None,
+ alpha=None, linewidths=None, edgecolors='face',
+ reduce_C_function=np.mean, mincnt=None, marginals=False,
+ **kwargs):
+ """
+ Make a 2D hexagonal binning plot of points *x*, *y*.
+
+ If *C* is *None*, the value of the hexagon is determined by the number
+ of points in the hexagon. Otherwise, *C* specifies values at the
+ coordinate (x[i], y[i]). For each hexagon, these values are reduced
+ using *reduce_C_function*.
+
+ Parameters
+ ----------
+ x, y : array-like
+ The data positions. *x* and *y* must be of the same length.
+
+ C : array-like, optional
+ If given, these values are accumulated in the bins. Otherwise,
+ every point has a value of 1. Must be of the same length as *x*
+ and *y*.
+
+ gridsize : int or (int, int), default: 100
+ If a single int, the number of hexagons in the *x*-direction.
+ The number of hexagons in the *y*-direction is chosen such that
+ the hexagons are approximately regular.
+
+ Alternatively, if a tuple (*nx*, *ny*), the number of hexagons
+ in the *x*-direction and the *y*-direction.
+
+ bins : 'log' or int or sequence, default: None
+ Discretization of the hexagon values.
+
+ - If *None*, no binning is applied; the color of each hexagon
+ directly corresponds to its count value.
+ - If 'log', use a logarithmic scale for the colormap.
+ Internally, :math:`log_{10}(i+1)` is used to determine the
+ hexagon color. This is equivalent to ``norm=LogNorm()``.
+ - If an integer, divide the counts in the specified number
+ of bins, and color the hexagons accordingly.
+ - If a sequence of values, the values of the lower bound of
+ the bins to be used.
+
+ xscale : {'linear', 'log'}, default: 'linear'
+ Use a linear or log10 scale on the horizontal axis.
+
+ yscale : {'linear', 'log'}, default: 'linear'
+ Use a linear or log10 scale on the vertical axis.
+
+ mincnt : int > 0, default: *None*
+ If not *None*, only display cells with more than *mincnt*
+ number of points in the cell.
+
+ marginals : bool, default: *False*
+ If marginals is *True*, plot the marginal density as
+ colormapped rectangles along the bottom of the x-axis and
+ left of the y-axis.
+
+ extent : float, default: *None*
+ The limits of the bins. The default assigns the limits
+ based on *gridsize*, *x*, *y*, *xscale* and *yscale*.
+
+ If *xscale* or *yscale* is set to 'log', the limits are
+ expected to be the exponent for a power of 10. E.g. for
+ x-limits of 1 and 50 in 'linear' scale and y-limits
+ of 10 and 1000 in 'log' scale, enter (1, 50, 1, 3).
+
+ Order of scalars is (left, right, bottom, top).
+
+ Returns
+ -------
+ `~matplotlib.collections.PolyCollection`
+ A `.PolyCollection` defining the hexagonal bins.
+
+ - `.PolyCollection.get_offsets` contains a Mx2 array containing
+ the x, y positions of the M hexagon centers.
+ - `.PolyCollection.get_array` contains the values of the M
+ hexagons.
+
+ If *marginals* is *True*, horizontal
+ bar and vertical bar (both PolyCollections) will be attached
+ to the return collection as attributes *hbar* and *vbar*.
+
+ Other Parameters
+ ----------------
+ cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
+ The Colormap instance or registered colormap name used to map
+ the bin values to colors.
+
+ norm : `~matplotlib.colors.Normalize`, optional
+ The Normalize instance scales the bin values to the canonical
+ colormap range [0, 1] for mapping to colors. By default, the data
+ range is mapped to the colorbar range using linear scaling.
+
+ vmin, vmax : float, default: None
+ The colorbar range. If *None*, suitable min/max values are
+ automatically chosen by the `~.Normalize` instance (defaults to
+ the respective min/max values of the bins in case of the default
+ linear scaling).
+ It is deprecated to use *vmin*/*vmax* when *norm* is given.
+
+ alpha : float between 0 and 1, optional
+ The alpha blending value, between 0 (transparent) and 1 (opaque).
+
+ linewidths : float, default: *None*
+ If *None*, defaults to 1.0.
+
+ edgecolors : {'face', 'none', *None*} or color, default: 'face'
+ The color of the hexagon edges. Possible values are:
+
+ - 'face': Draw the edges in the same color as the fill color.
+ - 'none': No edges are drawn. This can sometimes lead to unsightly
+ unpainted pixels between the hexagons.
+ - *None*: Draw outlines in the default color.
+ - An explicit color.
+
+ reduce_C_function : callable, default: `numpy.mean`
+ The function to aggregate *C* within the bins. It is ignored if
+ *C* is not given. This must have the signature::
+
+ def reduce_C_function(C: array) -> float
+
+ Commonly used functions are:
+
+ - `numpy.mean`: average of the points
+ - `numpy.sum`: integral of the point values
+ - `numpy.amax`: value taken from the largest point
+
+ **kwargs : `~matplotlib.collections.PolyCollection` properties
+ All other keyword arguments are passed on to `.PolyCollection`:
+
+ %(PolyCollection_kwdoc)s
+
+ """
+ self._process_unit_info([("x", x), ("y", y)], kwargs, convert=False)
+
+ x, y, C = cbook.delete_masked_points(x, y, C)
+
+ # Set the size of the hexagon grid
+ if np.iterable(gridsize):
+ nx, ny = gridsize
+ else:
+ nx = gridsize
+ ny = int(nx / math.sqrt(3))
+ # Count the number of data in each hexagon
+ x = np.array(x, float)
+ y = np.array(y, float)
+ if xscale == 'log':
+ if np.any(x <= 0.0):
+ raise ValueError("x contains non-positive values, so can not"
+ " be log-scaled")
+ x = np.log10(x)
+ if yscale == 'log':
+ if np.any(y <= 0.0):
+ raise ValueError("y contains non-positive values, so can not"
+ " be log-scaled")
+ y = np.log10(y)
+ if extent is not None:
+ xmin, xmax, ymin, ymax = extent
+ else:
+ xmin, xmax = (np.min(x), np.max(x)) if len(x) else (0, 1)
+ ymin, ymax = (np.min(y), np.max(y)) if len(y) else (0, 1)
+
+ # to avoid issues with singular data, expand the min/max pairs
+ xmin, xmax = mtransforms.nonsingular(xmin, xmax, expander=0.1)
+ ymin, ymax = mtransforms.nonsingular(ymin, ymax, expander=0.1)
+
+ # In the x-direction, the hexagons exactly cover the region from
+ # xmin to xmax. Need some padding to avoid roundoff errors.
+ padding = 1.e-9 * (xmax - xmin)
+ xmin -= padding
+ xmax += padding
+ sx = (xmax - xmin) / nx
+ sy = (ymax - ymin) / ny
+
+ if marginals:
+ xorig = x.copy()
+ yorig = y.copy()
+
+ x = (x - xmin) / sx
+ y = (y - ymin) / sy
+ ix1 = np.round(x).astype(int)
+ iy1 = np.round(y).astype(int)
+ ix2 = np.floor(x).astype(int)
+ iy2 = np.floor(y).astype(int)
+
+ nx1 = nx + 1
+ ny1 = ny + 1
+ nx2 = nx
+ ny2 = ny
+ n = nx1 * ny1 + nx2 * ny2
+
+ d1 = (x - ix1) ** 2 + 3.0 * (y - iy1) ** 2
+ d2 = (x - ix2 - 0.5) ** 2 + 3.0 * (y - iy2 - 0.5) ** 2
+ bdist = (d1 < d2)
+ if C is None:
+ lattice1 = np.zeros((nx1, ny1))
+ lattice2 = np.zeros((nx2, ny2))
+ c1 = (0 <= ix1) & (ix1 < nx1) & (0 <= iy1) & (iy1 < ny1) & bdist
+ c2 = (0 <= ix2) & (ix2 < nx2) & (0 <= iy2) & (iy2 < ny2) & ~bdist
+ np.add.at(lattice1, (ix1[c1], iy1[c1]), 1)
+ np.add.at(lattice2, (ix2[c2], iy2[c2]), 1)
+ if mincnt is not None:
+ lattice1[lattice1 < mincnt] = np.nan
+ lattice2[lattice2 < mincnt] = np.nan
+ accum = np.concatenate([lattice1.ravel(), lattice2.ravel()])
+ good_idxs = ~np.isnan(accum)
+
+ else:
+ if mincnt is None:
+ mincnt = 0
+
+ # create accumulation arrays
+ lattice1 = np.empty((nx1, ny1), dtype=object)
+ for i in range(nx1):
+ for j in range(ny1):
+ lattice1[i, j] = []
+ lattice2 = np.empty((nx2, ny2), dtype=object)
+ for i in range(nx2):
+ for j in range(ny2):
+ lattice2[i, j] = []
+
+ for i in range(len(x)):
+ if bdist[i]:
+ if 0 <= ix1[i] < nx1 and 0 <= iy1[i] < ny1:
+ lattice1[ix1[i], iy1[i]].append(C[i])
+ else:
+ if 0 <= ix2[i] < nx2 and 0 <= iy2[i] < ny2:
+ lattice2[ix2[i], iy2[i]].append(C[i])
+
+ for i in range(nx1):
+ for j in range(ny1):
+ vals = lattice1[i, j]
+ if len(vals) > mincnt:
+ lattice1[i, j] = reduce_C_function(vals)
+ else:
+ lattice1[i, j] = np.nan
+ for i in range(nx2):
+ for j in range(ny2):
+ vals = lattice2[i, j]
+ if len(vals) > mincnt:
+ lattice2[i, j] = reduce_C_function(vals)
+ else:
+ lattice2[i, j] = np.nan
+
+ accum = np.concatenate([lattice1.astype(float).ravel(),
+ lattice2.astype(float).ravel()])
+ good_idxs = ~np.isnan(accum)
+
+ offsets = np.zeros((n, 2), float)
+ offsets[:nx1 * ny1, 0] = np.repeat(np.arange(nx1), ny1)
+ offsets[:nx1 * ny1, 1] = np.tile(np.arange(ny1), nx1)
+ offsets[nx1 * ny1:, 0] = np.repeat(np.arange(nx2) + 0.5, ny2)
+ offsets[nx1 * ny1:, 1] = np.tile(np.arange(ny2), nx2) + 0.5
+ offsets[:, 0] *= sx
+ offsets[:, 1] *= sy
+ offsets[:, 0] += xmin
+ offsets[:, 1] += ymin
+ # remove accumulation bins with no data
+ offsets = offsets[good_idxs, :]
+ accum = accum[good_idxs]
+
+ polygon = [sx, sy / 3] * np.array(
+ [[.5, -.5], [.5, .5], [0., 1.], [-.5, .5], [-.5, -.5], [0., -1.]])
+
+ if linewidths is None:
+ linewidths = [1.0]
+
+ if xscale == 'log' or yscale == 'log':
+ polygons = np.expand_dims(polygon, 0) + np.expand_dims(offsets, 1)
+ if xscale == 'log':
+ polygons[:, :, 0] = 10.0 ** polygons[:, :, 0]
+ xmin = 10.0 ** xmin
+ xmax = 10.0 ** xmax
+ self.set_xscale(xscale)
+ if yscale == 'log':
+ polygons[:, :, 1] = 10.0 ** polygons[:, :, 1]
+ ymin = 10.0 ** ymin
+ ymax = 10.0 ** ymax
+ self.set_yscale(yscale)
+ collection = mcoll.PolyCollection(
+ polygons,
+ edgecolors=edgecolors,
+ linewidths=linewidths,
+ )
+ else:
+ collection = mcoll.PolyCollection(
+ [polygon],
+ edgecolors=edgecolors,
+ linewidths=linewidths,
+ offsets=offsets,
+ transOffset=mtransforms.AffineDeltaTransform(self.transData),
+ )
+
+ # Set normalizer if bins is 'log'
+ if bins == 'log':
+ if norm is not None:
+ _api.warn_external("Only one of 'bins' and 'norm' arguments "
+ f"can be supplied, ignoring bins={bins}")
+ else:
+ norm = mcolors.LogNorm()
+ bins = None
+
+ if isinstance(norm, mcolors.LogNorm):
+ if (accum == 0).any():
+ # make sure we have no zeros
+ accum += 1
+
+ # autoscale the norm with current accum values if it hasn't
+ # been set
+ if norm is not None:
+ if norm.vmin is None and norm.vmax is None:
+ norm.autoscale(accum)
+
+ if bins is not None:
+ if not np.iterable(bins):
+ minimum, maximum = min(accum), max(accum)
+ bins -= 1 # one less edge than bins
+ bins = minimum + (maximum - minimum) * np.arange(bins) / bins
+ bins = np.sort(bins)
+ accum = bins.searchsorted(accum)
+
+ collection.set_array(accum)
+ collection.set_cmap(cmap)
+ collection.set_norm(norm)
+ collection.set_alpha(alpha)
+ collection.update(kwargs)
+ collection._scale_norm(norm, vmin, vmax)
+
+ corners = ((xmin, ymin), (xmax, ymax))
+ self.update_datalim(corners)
+ self._request_autoscale_view(tight=True)
+
+ # add the collection last
+ self.add_collection(collection, autolim=False)
+ if not marginals:
+ return collection
+
+ if C is None:
+ C = np.ones(len(x))
+
+ def coarse_bin(x, y, coarse):
+ ind = coarse.searchsorted(x).clip(0, len(coarse) - 1)
+ mus = np.zeros(len(coarse))
+ for i in range(len(coarse)):
+ yi = y[ind == i]
+ if len(yi) > 0:
+ mu = reduce_C_function(yi)
+ else:
+ mu = np.nan
+ mus[i] = mu
+ return mus
+
+ coarse = np.linspace(xmin, xmax, gridsize)
+
+ xcoarse = coarse_bin(xorig, C, coarse)
+ valid = ~np.isnan(xcoarse)
+ verts, values = [], []
+ for i, val in enumerate(xcoarse):
+ thismin = coarse[i]
+ if i < len(coarse) - 1:
+ thismax = coarse[i + 1]
+ else:
+ thismax = thismin + np.diff(coarse)[-1]
+
+ if not valid[i]:
+ continue
+
+ verts.append([(thismin, 0),
+ (thismin, 0.05),
+ (thismax, 0.05),
+ (thismax, 0)])
+ values.append(val)
+
+ values = np.array(values)
+ trans = self.get_xaxis_transform(which='grid')
+
+ hbar = mcoll.PolyCollection(verts, transform=trans, edgecolors='face')
+
+ hbar.set_array(values)
+ hbar.set_cmap(cmap)
+ hbar.set_norm(norm)
+ hbar.set_alpha(alpha)
+ hbar.update(kwargs)
+ self.add_collection(hbar, autolim=False)
+
+ coarse = np.linspace(ymin, ymax, gridsize)
+ ycoarse = coarse_bin(yorig, C, coarse)
+ valid = ~np.isnan(ycoarse)
+ verts, values = [], []
+ for i, val in enumerate(ycoarse):
+ thismin = coarse[i]
+ if i < len(coarse) - 1:
+ thismax = coarse[i + 1]
+ else:
+ thismax = thismin + np.diff(coarse)[-1]
+ if not valid[i]:
+ continue
+ verts.append([(0, thismin), (0.0, thismax),
+ (0.05, thismax), (0.05, thismin)])
+ values.append(val)
+
+ values = np.array(values)
+
+ trans = self.get_yaxis_transform(which='grid')
+
+ vbar = mcoll.PolyCollection(verts, transform=trans, edgecolors='face')
+ vbar.set_array(values)
+ vbar.set_cmap(cmap)
+ vbar.set_norm(norm)
+ vbar.set_alpha(alpha)
+ vbar.update(kwargs)
+ self.add_collection(vbar, autolim=False)
+
+ collection.hbar = hbar
+ collection.vbar = vbar
+
+ def on_changed(collection):
+ hbar.set_cmap(collection.get_cmap())
+ hbar.set_clim(collection.get_clim())
+ vbar.set_cmap(collection.get_cmap())
+ vbar.set_clim(collection.get_clim())
+
+ collection.callbacksSM.connect('changed', on_changed)
+
+ return collection
+
+ @docstring.dedent_interpd
+ def arrow(self, x, y, dx, dy, **kwargs):
+ """
+ Add an arrow to the Axes.
+
+ This draws an arrow from ``(x, y)`` to ``(x+dx, y+dy)``.
+
+ Parameters
+ ----------
+ x, y : float
+ The x and y coordinates of the arrow base.
+
+ dx, dy : float
+ The length of the arrow along x and y direction.
+
+ %(FancyArrow)s
+
+ Returns
+ -------
+ `.FancyArrow`
+ The created `.FancyArrow` object.
+
+ Notes
+ -----
+ The resulting arrow is affected by the Axes aspect ratio and limits.
+ This may produce an arrow whose head is not square with its stem. To
+ create an arrow whose head is square with its stem,
+ use :meth:`annotate` for example:
+
+ >>> ax.annotate("", xy=(0.5, 0.5), xytext=(0, 0),
+ ... arrowprops=dict(arrowstyle="->"))
+
+ """
+ # Strip away units for the underlying patch since units
+ # do not make sense to most patch-like code
+ x = self.convert_xunits(x)
+ y = self.convert_yunits(y)
+ dx = self.convert_xunits(dx)
+ dy = self.convert_yunits(dy)
+
+ a = mpatches.FancyArrow(x, y, dx, dy, **kwargs)
+ self.add_patch(a)
+ self._request_autoscale_view()
+ return a
+
+ @docstring.copy(mquiver.QuiverKey.__init__)
+ def quiverkey(self, Q, X, Y, U, label, **kw):
+ qk = mquiver.QuiverKey(Q, X, Y, U, label, **kw)
+ self.add_artist(qk)
+ return qk
+
+ # Handle units for x and y, if they've been passed
+ def _quiver_units(self, args, kw):
+ if len(args) > 3:
+ x, y = args[0:2]
+ x, y = self._process_unit_info([("x", x), ("y", y)], kw)
+ return (x, y) + args[2:]
+ return args
+
+ # args can by a combination if X, Y, U, V, C and all should be replaced
+ @_preprocess_data()
+ def quiver(self, *args, **kw):
+ # Make sure units are handled for x and y values
+ args = self._quiver_units(args, kw)
+
+ q = mquiver.Quiver(self, *args, **kw)
+
+ self.add_collection(q, autolim=True)
+ self._request_autoscale_view()
+ return q
+ quiver.__doc__ = mquiver.Quiver.quiver_doc
+
+ # args can be some combination of X, Y, U, V, C and all should be replaced
+ @_preprocess_data()
+ @docstring.dedent_interpd
+ def barbs(self, *args, **kw):
+ """
+ %(barbs_doc)s
+ """
+ # Make sure units are handled for x and y values
+ args = self._quiver_units(args, kw)
+
+ b = mquiver.Barbs(self, *args, **kw)
+ self.add_collection(b, autolim=True)
+ self._request_autoscale_view()
+ return b
+
+ # Uses a custom implementation of data-kwarg handling in
+ # _process_plot_var_args.
+ def fill(self, *args, data=None, **kwargs):
+ """
+ Plot filled polygons.
+
+ Parameters
+ ----------
+ *args : sequence of x, y, [color]
+ Each polygon is defined by the lists of *x* and *y* positions of
+ its nodes, optionally followed by a *color* specifier. See
+ :mod:`matplotlib.colors` for supported color specifiers. The
+ standard color cycle is used for polygons without a color
+ specifier.
+
+ You can plot multiple polygons by providing multiple *x*, *y*,
+ *[color]* groups.
+
+ For example, each of the following is legal::
+
+ ax.fill(x, y) # a polygon with default color
+ ax.fill(x, y, "b") # a blue polygon
+ ax.fill(x, y, x2, y2) # two polygons
+ ax.fill(x, y, "b", x2, y2, "r") # a blue and a red polygon
+
+ data : indexable object, optional
+ An object with labelled data. If given, provide the label names to
+ plot in *x* and *y*, e.g.::
+
+ ax.fill("time", "signal",
+ data={"time": [0, 1, 2], "signal": [0, 1, 0]})
+
+ Returns
+ -------
+ list of `~matplotlib.patches.Polygon`
+
+ Other Parameters
+ ----------------
+ **kwargs : `~matplotlib.patches.Polygon` properties
+
+ Notes
+ -----
+ Use :meth:`fill_between` if you would like to fill the region between
+ two curves.
+ """
+ # For compatibility(!), get aliases from Line2D rather than Patch.
+ kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
+ # _get_patches_for_fill returns a generator, convert it to a list.
+ patches = [*self._get_patches_for_fill(*args, data=data, **kwargs)]
+ for poly in patches:
+ self.add_patch(poly)
+ self._request_autoscale_view()
+ return patches
+
+ def _fill_between_x_or_y(
+ self, ind_dir, ind, dep1, dep2=0, *,
+ where=None, interpolate=False, step=None, **kwargs):
+ # Common implementation between fill_between (*ind_dir*="x") and
+ # fill_betweenx (*ind_dir*="y"). *ind* is the independent variable,
+ # *dep* the dependent variable. The docstring below is interpolated
+ # to generate both methods' docstrings.
+ """
+ Fill the area between two {dir} curves.
+
+ The curves are defined by the points (*{ind}*, *{dep}1*) and (*{ind}*,
+ *{dep}2*). This creates one or multiple polygons describing the filled
+ area.
+
+ You may exclude some {dir} sections from filling using *where*.
+
+ By default, the edges connect the given points directly. Use *step*
+ if the filling should be a step function, i.e. constant in between
+ *{ind}*.
+
+ Parameters
+ ----------
+ {ind} : array (length N)
+ The {ind} coordinates of the nodes defining the curves.
+
+ {dep}1 : array (length N) or scalar
+ The {dep} coordinates of the nodes defining the first curve.
+
+ {dep}2 : array (length N) or scalar, default: 0
+ The {dep} coordinates of the nodes defining the second curve.
+
+ where : array of bool (length N), optional
+ Define *where* to exclude some {dir} regions from being filled.
+ The filled regions are defined by the coordinates ``{ind}[where]``.
+ More precisely, fill between ``{ind}[i]`` and ``{ind}[i+1]`` if
+ ``where[i] and where[i+1]``. Note that this definition implies
+ that an isolated *True* value between two *False* values in *where*
+ will not result in filling. Both sides of the *True* position
+ remain unfilled due to the adjacent *False* values.
+
+ interpolate : bool, default: False
+ This option is only relevant if *where* is used and the two curves
+ are crossing each other.
+
+ Semantically, *where* is often used for *{dep}1* > *{dep}2* or
+ similar. By default, the nodes of the polygon defining the filled
+ region will only be placed at the positions in the *{ind}* array.
+ Such a polygon cannot describe the above semantics close to the
+ intersection. The {ind}-sections containing the intersection are
+ simply clipped.
+
+ Setting *interpolate* to *True* will calculate the actual
+ intersection point and extend the filled region up to this point.
+
+ step : {{'pre', 'post', 'mid'}}, optional
+ Define *step* if the filling should be a step function,
+ i.e. constant in between *{ind}*. The value determines where the
+ step will occur:
+
+ - 'pre': The y value is continued constantly to the left from
+ every *x* position, i.e. the interval ``(x[i-1], x[i]]`` has the
+ value ``y[i]``.
+ - 'post': The y value is continued constantly to the right from
+ every *x* position, i.e. the interval ``[x[i], x[i+1])`` has the
+ value ``y[i]``.
+ - 'mid': Steps occur half-way between the *x* positions.
+
+ Returns
+ -------
+ `.PolyCollection`
+ A `.PolyCollection` containing the plotted polygons.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ All other keyword arguments are passed on to `.PolyCollection`.
+ They control the `.Polygon` properties:
+
+ %(PolyCollection_kwdoc)s
+
+ See Also
+ --------
+ fill_between : Fill between two sets of y-values.
+ fill_betweenx : Fill between two sets of x-values.
+
+ Notes
+ -----
+ .. [notes section required to get data note injection right]
+ """
+
+ dep_dir = {"x": "y", "y": "x"}[ind_dir]
+
+ if not rcParams["_internal.classic_mode"]:
+ kwargs = cbook.normalize_kwargs(kwargs, mcoll.Collection)
+ if not any(c in kwargs for c in ("color", "facecolor")):
+ kwargs["facecolor"] = \
+ self._get_patches_for_fill.get_next_color()
+
+ # Handle united data, such as dates
+ ind, dep1, dep2 = map(
+ ma.masked_invalid, self._process_unit_info(
+ [(ind_dir, ind), (dep_dir, dep1), (dep_dir, dep2)], kwargs))
+
+ for name, array in [
+ (ind_dir, ind), (f"{dep_dir}1", dep1), (f"{dep_dir}2", dep2)]:
+ if array.ndim > 1:
+ raise ValueError(f"{name!r} is not 1-dimensional")
+
+ if where is None:
+ where = True
+ else:
+ where = np.asarray(where, dtype=bool)
+ if where.size != ind.size:
+ raise ValueError(f"where size ({where.size}) does not match "
+ f"{ind_dir} size ({ind.size})")
+ where = where & ~functools.reduce(
+ np.logical_or, map(np.ma.getmask, [ind, dep1, dep2]))
+
+ ind, dep1, dep2 = np.broadcast_arrays(np.atleast_1d(ind), dep1, dep2)
+
+ polys = []
+ for idx0, idx1 in cbook.contiguous_regions(where):
+ indslice = ind[idx0:idx1]
+ dep1slice = dep1[idx0:idx1]
+ dep2slice = dep2[idx0:idx1]
+ if step is not None:
+ step_func = cbook.STEP_LOOKUP_MAP["steps-" + step]
+ indslice, dep1slice, dep2slice = \
+ step_func(indslice, dep1slice, dep2slice)
+
+ if not len(indslice):
+ continue
+
+ N = len(indslice)
+ pts = np.zeros((2 * N + 2, 2))
+
+ if interpolate:
+ def get_interp_point(idx):
+ im1 = max(idx - 1, 0)
+ ind_values = ind[im1:idx+1]
+ diff_values = dep1[im1:idx+1] - dep2[im1:idx+1]
+ dep1_values = dep1[im1:idx+1]
+
+ if len(diff_values) == 2:
+ if np.ma.is_masked(diff_values[1]):
+ return ind[im1], dep1[im1]
+ elif np.ma.is_masked(diff_values[0]):
+ return ind[idx], dep1[idx]
+
+ diff_order = diff_values.argsort()
+ diff_root_ind = np.interp(
+ 0, diff_values[diff_order], ind_values[diff_order])
+ ind_order = ind_values.argsort()
+ diff_root_dep = np.interp(
+ diff_root_ind,
+ ind_values[ind_order], dep1_values[ind_order])
+ return diff_root_ind, diff_root_dep
+
+ start = get_interp_point(idx0)
+ end = get_interp_point(idx1)
+ else:
+ # Handle scalar dep2 (e.g. 0): the fill should go all
+ # the way down to 0 even if none of the dep1 sample points do.
+ start = indslice[0], dep2slice[0]
+ end = indslice[-1], dep2slice[-1]
+
+ pts[0] = start
+ pts[N + 1] = end
+
+ pts[1:N+1, 0] = indslice
+ pts[1:N+1, 1] = dep1slice
+ pts[N+2:, 0] = indslice[::-1]
+ pts[N+2:, 1] = dep2slice[::-1]
+
+ if ind_dir == "y":
+ pts = pts[:, ::-1]
+
+ polys.append(pts)
+
+ collection = mcoll.PolyCollection(polys, **kwargs)
+
+ # now update the datalim and autoscale
+ pts = np.row_stack([np.column_stack([ind[where], dep1[where]]),
+ np.column_stack([ind[where], dep2[where]])])
+ if ind_dir == "y":
+ pts = pts[:, ::-1]
+ self.update_datalim(pts, updatex=True, updatey=True)
+ self.add_collection(collection, autolim=False)
+ self._request_autoscale_view()
+ return collection
+
+ def fill_between(self, x, y1, y2=0, where=None, interpolate=False,
+ step=None, **kwargs):
+ return self._fill_between_x_or_y(
+ "x", x, y1, y2,
+ where=where, interpolate=interpolate, step=step, **kwargs)
+
+ if _fill_between_x_or_y.__doc__:
+ fill_between.__doc__ = _fill_between_x_or_y.__doc__.format(
+ dir="horizontal", ind="x", dep="y"
+ )
+ fill_between = _preprocess_data(
+ docstring.dedent_interpd(fill_between),
+ replace_names=["x", "y1", "y2", "where"])
+
+ def fill_betweenx(self, y, x1, x2=0, where=None,
+ step=None, interpolate=False, **kwargs):
+ return self._fill_between_x_or_y(
+ "y", y, x1, x2,
+ where=where, interpolate=interpolate, step=step, **kwargs)
+
+ if _fill_between_x_or_y.__doc__:
+ fill_betweenx.__doc__ = _fill_between_x_or_y.__doc__.format(
+ dir="vertical", ind="y", dep="x"
+ )
+ fill_betweenx = _preprocess_data(
+ docstring.dedent_interpd(fill_betweenx),
+ replace_names=["y", "x1", "x2", "where"])
+
+ #### plotting z(x, y): imshow, pcolor and relatives, contour
+ @_preprocess_data()
+ def imshow(self, X, cmap=None, norm=None, aspect=None,
+ interpolation=None, alpha=None, vmin=None, vmax=None,
+ origin=None, extent=None, *, filternorm=True, filterrad=4.0,
+ resample=None, url=None, **kwargs):
+ """
+ Display data as an image, i.e., on a 2D regular raster.
+
+ The input may either be actual RGB(A) data, or 2D scalar data, which
+ will be rendered as a pseudocolor image. For displaying a grayscale
+ image set up the colormapping using the parameters
+ ``cmap='gray', vmin=0, vmax=255``.
+
+ The number of pixels used to render an image is set by the Axes size
+ and the *dpi* of the figure. This can lead to aliasing artifacts when
+ the image is resampled because the displayed image size will usually
+ not match the size of *X* (see
+ :doc:`/gallery/images_contours_and_fields/image_antialiasing`).
+ The resampling can be controlled via the *interpolation* parameter
+ and/or :rc:`image.interpolation`.
+
+ Parameters
+ ----------
+ X : array-like or PIL image
+ The image data. Supported array shapes are:
+
+ - (M, N): an image with scalar data. The values are mapped to
+ colors using normalization and a colormap. See parameters *norm*,
+ *cmap*, *vmin*, *vmax*.
+ - (M, N, 3): an image with RGB values (0-1 float or 0-255 int).
+ - (M, N, 4): an image with RGBA values (0-1 float or 0-255 int),
+ i.e. including transparency.
+
+ The first two dimensions (M, N) define the rows and columns of
+ the image.
+
+ Out-of-range RGB(A) values are clipped.
+
+ cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
+ The Colormap instance or registered colormap name used to map
+ scalar data to colors. This parameter is ignored for RGB(A) data.
+
+ norm : `~matplotlib.colors.Normalize`, optional
+ The `.Normalize` instance used to scale scalar data to the [0, 1]
+ range before mapping to colors using *cmap*. By default, a linear
+ scaling mapping the lowest value to 0 and the highest to 1 is used.
+ This parameter is ignored for RGB(A) data.
+
+ aspect : {'equal', 'auto'} or float, default: :rc:`image.aspect`
+ The aspect ratio of the Axes. This parameter is particularly
+ relevant for images since it determines whether data pixels are
+ square.
+
+ This parameter is a shortcut for explicitly calling
+ `.Axes.set_aspect`. See there for further details.
+
+ - 'equal': Ensures an aspect ratio of 1. Pixels will be square
+ (unless pixel sizes are explicitly made non-square in data
+ coordinates using *extent*).
+ - 'auto': The Axes is kept fixed and the aspect is adjusted so
+ that the data fit in the Axes. In general, this will result in
+ non-square pixels.
+
+ interpolation : str, default: :rc:`image.interpolation`
+ The interpolation method used.
+
+ Supported values are 'none', 'antialiased', 'nearest', 'bilinear',
+ 'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite',
+ 'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell',
+ 'sinc', 'lanczos', 'blackman'.
+
+ If *interpolation* is 'none', then no interpolation is performed
+ on the Agg, ps, pdf and svg backends. Other backends will fall back
+ to 'nearest'. Note that most SVG renderers perform interpolation at
+ rendering and that the default interpolation method they implement
+ may differ.
+
+ If *interpolation* is the default 'antialiased', then 'nearest'
+ interpolation is used if the image is upsampled by more than a
+ factor of three (i.e. the number of display pixels is at least
+ three times the size of the data array). If the upsampling rate is
+ smaller than 3, or the image is downsampled, then 'hanning'
+ interpolation is used to act as an anti-aliasing filter, unless the
+ image happens to be upsampled by exactly a factor of two or one.
+
+ See
+ :doc:`/gallery/images_contours_and_fields/interpolation_methods`
+ for an overview of the supported interpolation methods, and
+ :doc:`/gallery/images_contours_and_fields/image_antialiasing` for
+ a discussion of image antialiasing.
+
+ Some interpolation methods require an additional radius parameter,
+ which can be set by *filterrad*. Additionally, the antigrain image
+ resize filter is controlled by the parameter *filternorm*.
+
+ alpha : float or array-like, optional
+ The alpha blending value, between 0 (transparent) and 1 (opaque).
+ If *alpha* is an array, the alpha blending values are applied pixel
+ by pixel, and *alpha* must have the same shape as *X*.
+
+ vmin, vmax : float, optional
+ When using scalar data and no explicit *norm*, *vmin* and *vmax*
+ define the data range that the colormap covers. By default,
+ the colormap covers the complete value range of the supplied
+ data. It is deprecated to use *vmin*/*vmax* when *norm* is given.
+ When using RGB(A) data, parameters *vmin*/*vmax* are ignored.
+
+ origin : {'upper', 'lower'}, default: :rc:`image.origin`
+ Place the [0, 0] index of the array in the upper left or lower
+ left corner of the Axes. The convention (the default) 'upper' is
+ typically used for matrices and images.
+
+ Note that the vertical axis points upward for 'lower'
+ but downward for 'upper'.
+
+ See the :doc:`/tutorials/intermediate/imshow_extent` tutorial for
+ examples and a more detailed description.
+
+ extent : floats (left, right, bottom, top), optional
+ The bounding box in data coordinates that the image will fill.
+ The image is stretched individually along x and y to fill the box.
+
+ The default extent is determined by the following conditions.
+ Pixels have unit size in data coordinates. Their centers are on
+ integer coordinates, and their center coordinates range from 0 to
+ columns-1 horizontally and from 0 to rows-1 vertically.
+
+ Note that the direction of the vertical axis and thus the default
+ values for top and bottom depend on *origin*:
+
+ - For ``origin == 'upper'`` the default is
+ ``(-0.5, numcols-0.5, numrows-0.5, -0.5)``.
+ - For ``origin == 'lower'`` the default is
+ ``(-0.5, numcols-0.5, -0.5, numrows-0.5)``.
+
+ See the :doc:`/tutorials/intermediate/imshow_extent` tutorial for
+ examples and a more detailed description.
+
+ filternorm : bool, default: True
+ A parameter for the antigrain image resize filter (see the
+ antigrain documentation). If *filternorm* is set, the filter
+ normalizes integer values and corrects the rounding errors. It
+ doesn't do anything with the source floating point values, it
+ corrects only integers according to the rule of 1.0 which means
+ that any sum of pixel weights must be equal to 1.0. So, the
+ filter function must produce a graph of the proper shape.
+
+ filterrad : float > 0, default: 4.0
+ The filter radius for filters that have a radius parameter, i.e.
+ when interpolation is one of: 'sinc', 'lanczos' or 'blackman'.
+
+ resample : bool, default: :rc:`image.resample`
+ When *True*, use a full resampling method. When *False*, only
+ resample when the output image is larger than the input image.
+
+ url : str, optional
+ Set the url of the created `.AxesImage`. See `.Artist.set_url`.
+
+ Returns
+ -------
+ `~matplotlib.image.AxesImage`
+
+ Other Parameters
+ ----------------
+ **kwargs : `~matplotlib.artist.Artist` properties
+ These parameters are passed on to the constructor of the
+ `.AxesImage` artist.
+
+ See Also
+ --------
+ matshow : Plot a matrix or an array as an image.
+
+ Notes
+ -----
+ Unless *extent* is used, pixel centers will be located at integer
+ coordinates. In other words: the origin will coincide with the center
+ of pixel (0, 0).
+
+ There are two common representations for RGB images with an alpha
+ channel:
+
+ - Straight (unassociated) alpha: R, G, and B channels represent the
+ color of the pixel, disregarding its opacity.
+ - Premultiplied (associated) alpha: R, G, and B channels represent
+ the color of the pixel, adjusted for its opacity by multiplication.
+
+ `~matplotlib.pyplot.imshow` expects RGB images adopting the straight
+ (unassociated) alpha representation.
+ """
+ if aspect is None:
+ aspect = rcParams['image.aspect']
+ self.set_aspect(aspect)
+ im = mimage.AxesImage(self, cmap, norm, interpolation, origin, extent,
+ filternorm=filternorm, filterrad=filterrad,
+ resample=resample, **kwargs)
+
+ im.set_data(X)
+ im.set_alpha(alpha)
+ if im.get_clip_path() is None:
+ # image does not already have clipping set, clip to axes patch
+ im.set_clip_path(self.patch)
+ im._scale_norm(norm, vmin, vmax)
+ im.set_url(url)
+
+ # update ax.dataLim, and, if autoscaling, set viewLim
+ # to tightly fit the image, regardless of dataLim.
+ im.set_extent(im.get_extent())
+
+ self.add_image(im)
+ return im
+
+ def _pcolorargs(self, funcname, *args, shading='flat', **kwargs):
+ # - create X and Y if not present;
+ # - reshape X and Y as needed if they are 1-D;
+ # - check for proper sizes based on `shading` kwarg;
+ # - reset shading if shading='auto' to flat or nearest
+ # depending on size;
+
+ _valid_shading = ['gouraud', 'nearest', 'flat', 'auto']
+ try:
+ _api.check_in_list(_valid_shading, shading=shading)
+ except ValueError as err:
+ _api.warn_external(f"shading value '{shading}' not in list of "
+ f"valid values {_valid_shading}. Setting "
+ "shading='auto'.")
+ shading = 'auto'
+
+ if len(args) == 1:
+ C = np.asanyarray(args[0])
+ nrows, ncols = C.shape
+ if shading in ['gouraud', 'nearest']:
+ X, Y = np.meshgrid(np.arange(ncols), np.arange(nrows))
+ else:
+ X, Y = np.meshgrid(np.arange(ncols + 1), np.arange(nrows + 1))
+ shading = 'flat'
+ C = cbook.safe_masked_invalid(C)
+ return X, Y, C, shading
+
+ if len(args) == 3:
+ # Check x and y for bad data...
+ C = np.asanyarray(args[2])
+ # unit conversion allows e.g. datetime objects as axis values
+ X, Y = args[:2]
+ X, Y = self._process_unit_info([("x", X), ("y", Y)], kwargs)
+ X, Y = [cbook.safe_masked_invalid(a) for a in [X, Y]]
+
+ if funcname == 'pcolormesh':
+ if np.ma.is_masked(X) or np.ma.is_masked(Y):
+ raise ValueError(
+ 'x and y arguments to pcolormesh cannot have '
+ 'non-finite values or be of type '
+ 'numpy.ma.core.MaskedArray with masked values')
+ # safe_masked_invalid() returns an ndarray for dtypes other
+ # than floating point.
+ if isinstance(X, np.ma.core.MaskedArray):
+ X = X.data # strip mask as downstream doesn't like it...
+ if isinstance(Y, np.ma.core.MaskedArray):
+ Y = Y.data
+ nrows, ncols = C.shape
+ else:
+ raise TypeError(f'{funcname}() takes 1 or 3 positional arguments '
+ f'but {len(args)} were given')
+
+ Nx = X.shape[-1]
+ Ny = Y.shape[0]
+ if X.ndim != 2 or X.shape[0] == 1:
+ x = X.reshape(1, Nx)
+ X = x.repeat(Ny, axis=0)
+ if Y.ndim != 2 or Y.shape[1] == 1:
+ y = Y.reshape(Ny, 1)
+ Y = y.repeat(Nx, axis=1)
+ if X.shape != Y.shape:
+ raise TypeError(
+ 'Incompatible X, Y inputs to %s; see help(%s)' % (
+ funcname, funcname))
+
+ if shading == 'auto':
+ if ncols == Nx and nrows == Ny:
+ shading = 'nearest'
+ else:
+ shading = 'flat'
+
+ if shading == 'flat':
+ if not (ncols in (Nx, Nx - 1) and nrows in (Ny, Ny - 1)):
+ raise TypeError('Dimensions of C %s are incompatible with'
+ ' X (%d) and/or Y (%d); see help(%s)' % (
+ C.shape, Nx, Ny, funcname))
+ if (ncols == Nx or nrows == Ny):
+ _api.warn_deprecated(
+ "3.3", message="shading='flat' when X and Y have the same "
+ "dimensions as C is deprecated since %(since)s. Either "
+ "specify the corners of the quadrilaterals with X and Y, "
+ "or pass shading='auto', 'nearest' or 'gouraud', or set "
+ "rcParams['pcolor.shading']. This will become an error "
+ "%(removal)s.")
+ C = C[:Ny - 1, :Nx - 1]
+ else: # ['nearest', 'gouraud']:
+ if (Nx, Ny) != (ncols, nrows):
+ raise TypeError('Dimensions of C %s are incompatible with'
+ ' X (%d) and/or Y (%d); see help(%s)' % (
+ C.shape, Nx, Ny, funcname))
+ if shading in ['nearest', 'auto']:
+ # grid is specified at the center, so define corners
+ # at the midpoints between the grid centers and then use the
+ # flat algorithm.
+ def _interp_grid(X):
+ # helper for below
+ if np.shape(X)[1] > 1:
+ dX = np.diff(X, axis=1)/2.
+ if not (np.all(dX >= 0) or np.all(dX <= 0)):
+ _api.warn_external(
+ f"The input coordinates to {funcname} are "
+ "interpreted as cell centers, but are not "
+ "monotonically increasing or decreasing. "
+ "This may lead to incorrectly calculated cell "
+ "edges, in which case, please supply "
+ f"explicit cell edges to {funcname}.")
+ X = np.hstack((X[:, [0]] - dX[:, [0]],
+ X[:, :-1] + dX,
+ X[:, [-1]] + dX[:, [-1]]))
+ else:
+ # This is just degenerate, but we can't reliably guess
+ # a dX if there is just one value.
+ X = np.hstack((X, X))
+ return X
+
+ if ncols == Nx:
+ X = _interp_grid(X)
+ Y = _interp_grid(Y)
+ if nrows == Ny:
+ X = _interp_grid(X.T).T
+ Y = _interp_grid(Y.T).T
+ shading = 'flat'
+
+ C = cbook.safe_masked_invalid(C)
+ return X, Y, C, shading
+
+ @_preprocess_data()
+ @docstring.dedent_interpd
+ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
+ vmin=None, vmax=None, **kwargs):
+ r"""
+ Create a pseudocolor plot with a non-regular rectangular grid.
+
+ Call signature::
+
+ pcolor([X, Y,] C, **kwargs)
+
+ *X* and *Y* can be used to specify the corners of the quadrilaterals.
+
+ .. hint::
+
+ ``pcolor()`` can be very slow for large arrays. In most
+ cases you should use the similar but much faster
+ `~.Axes.pcolormesh` instead. See
+ :ref:`Differences between pcolor() and pcolormesh()
+ ` for a discussion of the
+ differences.
+
+ Parameters
+ ----------
+ C : 2D array-like
+ The color-mapped values.
+
+ X, Y : array-like, optional
+ The coordinates of the corners of quadrilaterals of a pcolormesh::
+
+ (X[i+1, j], Y[i+1, j]) (X[i+1, j+1], Y[i+1, j+1])
+ +-----+
+ | |
+ +-----+
+ (X[i, j], Y[i, j]) (X[i, j+1], Y[i, j+1])
+
+ Note that the column index corresponds to the x-coordinate, and
+ the row index corresponds to y. For details, see the
+ :ref:`Notes ` section below.
+
+ If ``shading='flat'`` the dimensions of *X* and *Y* should be one
+ greater than those of *C*, and the quadrilateral is colored due
+ to the value at ``C[i, j]``. If *X*, *Y* and *C* have equal
+ dimensions, a warning will be raised and the last row and column
+ of *C* will be ignored.
+
+ If ``shading='nearest'``, the dimensions of *X* and *Y* should be
+ the same as those of *C* (if not, a ValueError will be raised). The
+ color ``C[i, j]`` will be centered on ``(X[i, j], Y[i, j])``.
+
+ If *X* and/or *Y* are 1-D arrays or column vectors they will be
+ expanded as needed into the appropriate 2D arrays, making a
+ rectangular grid.
+
+ shading : {'flat', 'nearest', 'auto'}, optional
+ The fill style for the quadrilateral; defaults to 'flat' or
+ :rc:`pcolor.shading`. Possible values:
+
+ - 'flat': A solid color is used for each quad. The color of the
+ quad (i, j), (i+1, j), (i, j+1), (i+1, j+1) is given by
+ ``C[i, j]``. The dimensions of *X* and *Y* should be
+ one greater than those of *C*; if they are the same as *C*,
+ then a deprecation warning is raised, and the last row
+ and column of *C* are dropped.
+ - 'nearest': Each grid point will have a color centered on it,
+ extending halfway between the adjacent grid centers. The
+ dimensions of *X* and *Y* must be the same as *C*.
+ - 'auto': Choose 'flat' if dimensions of *X* and *Y* are one
+ larger than *C*. Choose 'nearest' if dimensions are the same.
+
+ See :doc:`/gallery/images_contours_and_fields/pcolormesh_grids`
+ for more description.
+
+ cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
+ A Colormap instance or registered colormap name. The colormap
+ maps the *C* values to colors.
+
+ norm : `~matplotlib.colors.Normalize`, optional
+ The Normalize instance scales the data values to the canonical
+ colormap range [0, 1] for mapping to colors. By default, the data
+ range is mapped to the colorbar range using linear scaling.
+
+ vmin, vmax : float, default: None
+ The colorbar range. If *None*, suitable min/max values are
+ automatically chosen by the `~.Normalize` instance (defaults to
+ the respective min/max values of *C* in case of the default linear
+ scaling).
+ It is deprecated to use *vmin*/*vmax* when *norm* is given.
+
+ edgecolors : {'none', None, 'face', color, color sequence}, optional
+ The color of the edges. Defaults to 'none'. Possible values:
+
+ - 'none' or '': No edge.
+ - *None*: :rc:`patch.edgecolor` will be used. Note that currently
+ :rc:`patch.force_edgecolor` has to be True for this to work.
+ - 'face': Use the adjacent face color.
+ - A color or sequence of colors will set the edge color.
+
+ The singular form *edgecolor* works as an alias.
+
+ alpha : float, default: None
+ The alpha blending value of the face color, between 0 (transparent)
+ and 1 (opaque). Note: The edgecolor is currently not affected by
+ this.
+
+ snap : bool, default: False
+ Whether to snap the mesh to pixel boundaries.
+
+ Returns
+ -------
+ `matplotlib.collections.Collection`
+
+ Other Parameters
+ ----------------
+ antialiaseds : bool, default: False
+ The default *antialiaseds* is False if the default
+ *edgecolors*\ ="none" is used. This eliminates artificial lines
+ at patch boundaries, and works regardless of the value of alpha.
+ If *edgecolors* is not "none", then the default *antialiaseds*
+ is taken from :rc:`patch.antialiased`.
+ Stroking the edges may be preferred if *alpha* is 1, but will
+ cause artifacts otherwise.
+
+ **kwargs
+ Additionally, the following arguments are allowed. They are passed
+ along to the `~matplotlib.collections.PolyCollection` constructor:
+
+ %(PolyCollection_kwdoc)s
+
+ See Also
+ --------
+ pcolormesh : for an explanation of the differences between
+ pcolor and pcolormesh.
+ imshow : If *X* and *Y* are each equidistant, `~.Axes.imshow` can be a
+ faster alternative.
+
+ Notes
+ -----
+ **Masked arrays**
+
+ *X*, *Y* and *C* may be masked arrays. If either ``C[i, j]``, or one
+ of the vertices surrounding ``C[i, j]`` (*X* or *Y* at
+ ``[i, j], [i+1, j], [i, j+1], [i+1, j+1]``) is masked, nothing is
+ plotted.
+
+ .. _axes-pcolor-grid-orientation:
+
+ **Grid orientation**
+
+ The grid orientation follows the standard matrix convention: An array
+ *C* with shape (nrows, ncolumns) is plotted with the column number as
+ *X* and the row number as *Y*.
+ """
+
+ if shading is None:
+ shading = rcParams['pcolor.shading']
+ shading = shading.lower()
+ X, Y, C, shading = self._pcolorargs('pcolor', *args, shading=shading,
+ kwargs=kwargs)
+ Ny, Nx = X.shape
+
+ # convert to MA, if necessary.
+ C = ma.asarray(C)
+ X = ma.asarray(X)
+ Y = ma.asarray(Y)
+
+ mask = ma.getmaskarray(X) + ma.getmaskarray(Y)
+ xymask = (mask[0:-1, 0:-1] + mask[1:, 1:] +
+ mask[0:-1, 1:] + mask[1:, 0:-1])
+ # don't plot if C or any of the surrounding vertices are masked.
+ mask = ma.getmaskarray(C) + xymask
+
+ unmask = ~mask
+ X1 = ma.filled(X[:-1, :-1])[unmask]
+ Y1 = ma.filled(Y[:-1, :-1])[unmask]
+ X2 = ma.filled(X[1:, :-1])[unmask]
+ Y2 = ma.filled(Y[1:, :-1])[unmask]
+ X3 = ma.filled(X[1:, 1:])[unmask]
+ Y3 = ma.filled(Y[1:, 1:])[unmask]
+ X4 = ma.filled(X[:-1, 1:])[unmask]
+ Y4 = ma.filled(Y[:-1, 1:])[unmask]
+ npoly = len(X1)
+
+ xy = np.stack([X1, Y1, X2, Y2, X3, Y3, X4, Y4, X1, Y1], axis=-1)
+ verts = xy.reshape((npoly, 5, 2))
+
+ C = ma.filled(C[:Ny - 1, :Nx - 1])[unmask]
+
+ linewidths = (0.25,)
+ if 'linewidth' in kwargs:
+ kwargs['linewidths'] = kwargs.pop('linewidth')
+ kwargs.setdefault('linewidths', linewidths)
+
+ if 'edgecolor' in kwargs:
+ kwargs['edgecolors'] = kwargs.pop('edgecolor')
+ ec = kwargs.setdefault('edgecolors', 'none')
+
+ # aa setting will default via collections to patch.antialiased
+ # unless the boundary is not stroked, in which case the
+ # default will be False; with unstroked boundaries, aa
+ # makes artifacts that are often disturbing.
+ if 'antialiased' in kwargs:
+ kwargs['antialiaseds'] = kwargs.pop('antialiased')
+ if 'antialiaseds' not in kwargs and cbook._str_lower_equal(ec, "none"):
+ kwargs['antialiaseds'] = False
+
+ kwargs.setdefault('snap', False)
+
+ collection = mcoll.PolyCollection(verts, **kwargs)
+
+ collection.set_alpha(alpha)
+ collection.set_array(C)
+ collection.set_cmap(cmap)
+ collection.set_norm(norm)
+ collection._scale_norm(norm, vmin, vmax)
+ self.grid(False)
+
+ x = X.compressed()
+ y = Y.compressed()
+
+ # Transform from native to data coordinates?
+ t = collection._transform
+ if (not isinstance(t, mtransforms.Transform) and
+ hasattr(t, '_as_mpl_transform')):
+ t = t._as_mpl_transform(self.axes)
+
+ if t and any(t.contains_branch_seperately(self.transData)):
+ trans_to_data = t - self.transData
+ pts = np.vstack([x, y]).T.astype(float)
+ transformed_pts = trans_to_data.transform(pts)
+ x = transformed_pts[..., 0]
+ y = transformed_pts[..., 1]
+
+ self.add_collection(collection, autolim=False)
+
+ minx = np.min(x)
+ maxx = np.max(x)
+ miny = np.min(y)
+ maxy = np.max(y)
+ collection.sticky_edges.x[:] = [minx, maxx]
+ collection.sticky_edges.y[:] = [miny, maxy]
+ corners = (minx, miny), (maxx, maxy)
+ self.update_datalim(corners)
+ self._request_autoscale_view()
+ return collection
+
+ @_preprocess_data()
+ @docstring.dedent_interpd
+ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
+ vmax=None, shading=None, antialiased=False, **kwargs):
+ """
+ Create a pseudocolor plot with a non-regular rectangular grid.
+
+ Call signature::
+
+ pcolormesh([X, Y,] C, **kwargs)
+
+ *X* and *Y* can be used to specify the corners of the quadrilaterals.
+
+ .. hint::
+
+ `~.Axes.pcolormesh` is similar to `~.Axes.pcolor`. It is much faster
+ and preferred in most cases. For a detailed discussion on the
+ differences see :ref:`Differences between pcolor() and pcolormesh()
+ `.
+
+ Parameters
+ ----------
+ C : 2D array-like
+ The color-mapped values.
+
+ X, Y : array-like, optional
+ The coordinates of the corners of quadrilaterals of a pcolormesh::
+
+ (X[i+1, j], Y[i+1, j]) (X[i+1, j+1], Y[i+1, j+1])
+ +-----+
+ | |
+ +-----+
+ (X[i, j], Y[i, j]) (X[i, j+1], Y[i, j+1])
+
+ Note that the column index corresponds to the x-coordinate, and
+ the row index corresponds to y. For details, see the
+ :ref:`Notes ` section below.
+
+ If ``shading='flat'`` the dimensions of *X* and *Y* should be one
+ greater than those of *C*, and the quadrilateral is colored due
+ to the value at ``C[i, j]``. If *X*, *Y* and *C* have equal
+ dimensions, a warning will be raised and the last row and column
+ of *C* will be ignored.
+
+ If ``shading='nearest'`` or ``'gouraud'``, the dimensions of *X*
+ and *Y* should be the same as those of *C* (if not, a ValueError
+ will be raised). For ``'nearest'`` the color ``C[i, j]`` is
+ centered on ``(X[i, j], Y[i, j])``. For ``'gouraud'``, a smooth
+ interpolation is caried out between the quadrilateral corners.
+
+ If *X* and/or *Y* are 1-D arrays or column vectors they will be
+ expanded as needed into the appropriate 2D arrays, making a
+ rectangular grid.
+
+ cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
+ A Colormap instance or registered colormap name. The colormap
+ maps the *C* values to colors.
+
+ norm : `~matplotlib.colors.Normalize`, optional
+ The Normalize instance scales the data values to the canonical
+ colormap range [0, 1] for mapping to colors. By default, the data
+ range is mapped to the colorbar range using linear scaling.
+
+ vmin, vmax : float, default: None
+ The colorbar range. If *None*, suitable min/max values are
+ automatically chosen by the `~.Normalize` instance (defaults to
+ the respective min/max values of *C* in case of the default linear
+ scaling).
+ It is deprecated to use *vmin*/*vmax* when *norm* is given.
+
+ edgecolors : {'none', None, 'face', color, color sequence}, optional
+ The color of the edges. Defaults to 'none'. Possible values:
+
+ - 'none' or '': No edge.
+ - *None*: :rc:`patch.edgecolor` will be used. Note that currently
+ :rc:`patch.force_edgecolor` has to be True for this to work.
+ - 'face': Use the adjacent face color.
+ - A color or sequence of colors will set the edge color.
+
+ The singular form *edgecolor* works as an alias.
+
+ alpha : float, default: None
+ The alpha blending value, between 0 (transparent) and 1 (opaque).
+
+ shading : {'flat', 'nearest', 'gouraud', 'auto'}, optional
+ The fill style for the quadrilateral; defaults to
+ 'flat' or :rc:`pcolor.shading`. Possible values:
+
+ - 'flat': A solid color is used for each quad. The color of the
+ quad (i, j), (i+1, j), (i, j+1), (i+1, j+1) is given by
+ ``C[i, j]``. The dimensions of *X* and *Y* should be
+ one greater than those of *C*; if they are the same as *C*,
+ then a deprecation warning is raised, and the last row
+ and column of *C* are dropped.
+ - 'nearest': Each grid point will have a color centered on it,
+ extending halfway between the adjacent grid centers. The
+ dimensions of *X* and *Y* must be the same as *C*.
+ - 'gouraud': Each quad will be Gouraud shaded: The color of the
+ corners (i', j') are given by ``C[i', j']``. The color values of
+ the area in between is interpolated from the corner values.
+ The dimensions of *X* and *Y* must be the same as *C*. When
+ Gouraud shading is used, *edgecolors* is ignored.
+ - 'auto': Choose 'flat' if dimensions of *X* and *Y* are one
+ larger than *C*. Choose 'nearest' if dimensions are the same.
+
+ See :doc:`/gallery/images_contours_and_fields/pcolormesh_grids`
+ for more description.
+
+ snap : bool, default: False
+ Whether to snap the mesh to pixel boundaries.
+
+ rasterized: bool, optional
+ Rasterize the pcolormesh when drawing vector graphics. This can
+ speed up rendering and produce smaller files for large data sets.
+ See also :doc:`/gallery/misc/rasterization_demo`.
+
+ Returns
+ -------
+ `matplotlib.collections.QuadMesh`
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Additionally, the following arguments are allowed. They are passed
+ along to the `~matplotlib.collections.QuadMesh` constructor:
+
+ %(QuadMesh_kwdoc)s
+
+ See Also
+ --------
+ pcolor : An alternative implementation with slightly different
+ features. For a detailed discussion on the differences see
+ :ref:`Differences between pcolor() and pcolormesh()
+ `.
+ imshow : If *X* and *Y* are each equidistant, `~.Axes.imshow` can be a
+ faster alternative.
+
+ Notes
+ -----
+ **Masked arrays**
+
+ *C* may be a masked array. If ``C[i, j]`` is masked, the corresponding
+ quadrilateral will be transparent. Masking of *X* and *Y* is not
+ supported. Use `~.Axes.pcolor` if you need this functionality.
+
+ .. _axes-pcolormesh-grid-orientation:
+
+ **Grid orientation**
+
+ The grid orientation follows the standard matrix convention: An array
+ *C* with shape (nrows, ncolumns) is plotted with the column number as
+ *X* and the row number as *Y*.
+
+ .. _differences-pcolor-pcolormesh:
+
+ **Differences between pcolor() and pcolormesh()**
+
+ Both methods are used to create a pseudocolor plot of a 2D array
+ using quadrilaterals.
+
+ The main difference lies in the created object and internal data
+ handling:
+ While `~.Axes.pcolor` returns a `.PolyCollection`, `~.Axes.pcolormesh`
+ returns a `.QuadMesh`. The latter is more specialized for the given
+ purpose and thus is faster. It should almost always be preferred.
+
+ There is also a slight difference in the handling of masked arrays.
+ Both `~.Axes.pcolor` and `~.Axes.pcolormesh` support masked arrays
+ for *C*. However, only `~.Axes.pcolor` supports masked arrays for *X*
+ and *Y*. The reason lies in the internal handling of the masked values.
+ `~.Axes.pcolor` leaves out the respective polygons from the
+ PolyCollection. `~.Axes.pcolormesh` sets the facecolor of the masked
+ elements to transparent. You can see the difference when using
+ edgecolors. While all edges are drawn irrespective of masking in a
+ QuadMesh, the edge between two adjacent masked quadrilaterals in
+ `~.Axes.pcolor` is not drawn as the corresponding polygons do not
+ exist in the PolyCollection.
+
+ Another difference is the support of Gouraud shading in
+ `~.Axes.pcolormesh`, which is not available with `~.Axes.pcolor`.
+
+ """
+ if shading is None:
+ shading = rcParams['pcolor.shading']
+ shading = shading.lower()
+ kwargs.setdefault('edgecolors', 'none')
+
+ X, Y, C, shading = self._pcolorargs('pcolormesh', *args,
+ shading=shading, kwargs=kwargs)
+ Ny, Nx = X.shape
+ X = X.ravel()
+ Y = Y.ravel()
+
+ # convert to one dimensional arrays
+ C = C.ravel()
+ coords = np.column_stack((X, Y)).astype(float, copy=False)
+ collection = mcoll.QuadMesh(Nx - 1, Ny - 1, coords,
+ antialiased=antialiased, shading=shading,
+ **kwargs)
+ snap = kwargs.get('snap', rcParams['pcolormesh.snap'])
+ collection.set_snap(snap)
+ collection.set_alpha(alpha)
+ collection.set_array(C)
+ collection.set_cmap(cmap)
+ collection.set_norm(norm)
+ collection._scale_norm(norm, vmin, vmax)
+
+ self.grid(False)
+
+ # Transform from native to data coordinates?
+ t = collection._transform
+ if (not isinstance(t, mtransforms.Transform) and
+ hasattr(t, '_as_mpl_transform')):
+ t = t._as_mpl_transform(self.axes)
+
+ if t and any(t.contains_branch_seperately(self.transData)):
+ trans_to_data = t - self.transData
+ coords = trans_to_data.transform(coords)
+
+ self.add_collection(collection, autolim=False)
+
+ minx, miny = np.min(coords, axis=0)
+ maxx, maxy = np.max(coords, axis=0)
+ collection.sticky_edges.x[:] = [minx, maxx]
+ collection.sticky_edges.y[:] = [miny, maxy]
+ corners = (minx, miny), (maxx, maxy)
+ self.update_datalim(corners)
+ self._request_autoscale_view()
+ return collection
+
+ @_preprocess_data()
+ @docstring.dedent_interpd
+ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
+ vmax=None, **kwargs):
+ """
+ Create a pseudocolor plot with a non-regular rectangular grid.
+
+ Call signature::
+
+ ax.pcolorfast([X, Y], C, /, **kwargs)
+
+ This method is similar to `~.Axes.pcolor` and `~.Axes.pcolormesh`.
+ It's designed to provide the fastest pcolor-type plotting with the
+ Agg backend. To achieve this, it uses different algorithms internally
+ depending on the complexity of the input grid (regular rectangular,
+ non-regular rectangular or arbitrary quadrilateral).
+
+ .. warning::
+
+ This method is experimental. Compared to `~.Axes.pcolor` or
+ `~.Axes.pcolormesh` it has some limitations:
+
+ - It supports only flat shading (no outlines)
+ - It lacks support for log scaling of the axes.
+ - It does not have a have a pyplot wrapper.
+
+ Parameters
+ ----------
+ C : array-like
+ The image data. Supported array shapes are:
+
+ - (M, N): an image with scalar data. The data is visualized
+ using a colormap.
+ - (M, N, 3): an image with RGB values (0-1 float or 0-255 int).
+ - (M, N, 4): an image with RGBA values (0-1 float or 0-255 int),
+ i.e. including transparency.
+
+ The first two dimensions (M, N) define the rows and columns of
+ the image.
+
+ This parameter can only be passed positionally.
+
+ X, Y : tuple or array-like, default: ``(0, N)``, ``(0, M)``
+ *X* and *Y* are used to specify the coordinates of the
+ quadrilaterals. There are different ways to do this:
+
+ - Use tuples ``X=(xmin, xmax)`` and ``Y=(ymin, ymax)`` to define
+ a *uniform rectangular grid*.
+
+ The tuples define the outer edges of the grid. All individual
+ quadrilaterals will be of the same size. This is the fastest
+ version.
+
+ - Use 1D arrays *X*, *Y* to specify a *non-uniform rectangular
+ grid*.
+
+ In this case *X* and *Y* have to be monotonic 1D arrays of length
+ *N+1* and *M+1*, specifying the x and y boundaries of the cells.
+
+ The speed is intermediate. Note: The grid is checked, and if
+ found to be uniform the fast version is used.
+
+ - Use 2D arrays *X*, *Y* if you need an *arbitrary quadrilateral
+ grid* (i.e. if the quadrilaterals are not rectangular).
+
+ In this case *X* and *Y* are 2D arrays with shape (M + 1, N + 1),
+ specifying the x and y coordinates of the corners of the colored
+ quadrilaterals.
+
+ This is the most general, but the slowest to render. It may
+ produce faster and more compact output using ps, pdf, and
+ svg backends, however.
+
+ These arguments can only be passed positionally.
+
+ cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
+ A Colormap instance or registered colormap name. The colormap
+ maps the *C* values to colors.
+
+ norm : `~matplotlib.colors.Normalize`, optional
+ The Normalize instance scales the data values to the canonical
+ colormap range [0, 1] for mapping to colors. By default, the data
+ range is mapped to the colorbar range using linear scaling.
+
+ vmin, vmax : float, default: None
+ The colorbar range. If *None*, suitable min/max values are
+ automatically chosen by the `~.Normalize` instance (defaults to
+ the respective min/max values of *C* in case of the default linear
+ scaling).
+ It is deprecated to use *vmin*/*vmax* when *norm* is given.
+
+ alpha : float, default: None
+ The alpha blending value, between 0 (transparent) and 1 (opaque).
+
+ snap : bool, default: False
+ Whether to snap the mesh to pixel boundaries.
+
+ Returns
+ -------
+ `.AxesImage` or `.PcolorImage` or `.QuadMesh`
+ The return type depends on the type of grid:
+
+ - `.AxesImage` for a regular rectangular grid.
+ - `.PcolorImage` for a non-regular rectangular grid.
+ - `.QuadMesh` for a non-rectangular grid.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Supported additional parameters depend on the type of grid.
+ See return types of *image* for further description.
+
+ Notes
+ -----
+ .. [notes section required to get data note injection right]
+ """
+
+ C = args[-1]
+ nr, nc = np.shape(C)[:2]
+ if len(args) == 1:
+ style = "image"
+ x = [0, nc]
+ y = [0, nr]
+ elif len(args) == 3:
+ x, y = args[:2]
+ x = np.asarray(x)
+ y = np.asarray(y)
+ if x.ndim == 1 and y.ndim == 1:
+ if x.size == 2 and y.size == 2:
+ style = "image"
+ else:
+ dx = np.diff(x)
+ dy = np.diff(y)
+ if (np.ptp(dx) < 0.01 * abs(dx.mean()) and
+ np.ptp(dy) < 0.01 * abs(dy.mean())):
+ style = "image"
+ else:
+ style = "pcolorimage"
+ elif x.ndim == 2 and y.ndim == 2:
+ style = "quadmesh"
+ else:
+ raise TypeError("arguments do not match valid signatures")
+ else:
+ raise TypeError("need 1 argument or 3 arguments")
+
+ if style == "quadmesh":
+ # data point in each cell is value at lower left corner
+ coords = np.stack([x, y], axis=-1)
+ if np.ndim(C) == 2:
+ qm_kwargs = {"array": np.ma.ravel(C)}
+ elif np.ndim(C) == 3:
+ qm_kwargs = {"color": np.ma.reshape(C, (-1, C.shape[-1]))}
+ else:
+ raise ValueError("C must be 2D or 3D")
+ collection = mcoll.QuadMesh(
+ nc, nr, coords, **qm_kwargs,
+ alpha=alpha, cmap=cmap, norm=norm,
+ antialiased=False, edgecolors="none")
+ self.add_collection(collection, autolim=False)
+ xl, xr, yb, yt = x.min(), x.max(), y.min(), y.max()
+ ret = collection
+
+ else: # It's one of the two image styles.
+ extent = xl, xr, yb, yt = x[0], x[-1], y[0], y[-1]
+ if style == "image":
+ im = mimage.AxesImage(
+ self, cmap, norm,
+ data=C, alpha=alpha, extent=extent,
+ interpolation='nearest', origin='lower',
+ **kwargs)
+ elif style == "pcolorimage":
+ im = mimage.PcolorImage(
+ self, x, y, C,
+ cmap=cmap, norm=norm, alpha=alpha, extent=extent,
+ **kwargs)
+ self.add_image(im)
+ ret = im
+
+ if np.ndim(C) == 2: # C.ndim == 3 is RGB(A) so doesn't need scaling.
+ ret._scale_norm(norm, vmin, vmax)
+
+ if ret.get_clip_path() is None:
+ # image does not already have clipping set, clip to axes patch
+ ret.set_clip_path(self.patch)
+
+ ret.sticky_edges.x[:] = [xl, xr]
+ ret.sticky_edges.y[:] = [yb, yt]
+ self.update_datalim(np.array([[xl, yb], [xr, yt]]))
+ self._request_autoscale_view(tight=True)
+ return ret
+
+ @_preprocess_data()
+ def contour(self, *args, **kwargs):
+ kwargs['filled'] = False
+ contours = mcontour.QuadContourSet(self, *args, **kwargs)
+ self._request_autoscale_view()
+ return contours
+ contour.__doc__ = """
+ Plot contour lines.
+
+ Call signature::
+
+ contour([X, Y,] Z, [levels], **kwargs)
+ """ + mcontour.QuadContourSet._contour_doc
+
+ @_preprocess_data()
+ def contourf(self, *args, **kwargs):
+ kwargs['filled'] = True
+ contours = mcontour.QuadContourSet(self, *args, **kwargs)
+ self._request_autoscale_view()
+ return contours
+ contourf.__doc__ = """
+ Plot filled contours.
+
+ Call signature::
+
+ contourf([X, Y,] Z, [levels], **kwargs)
+ """ + mcontour.QuadContourSet._contour_doc
+
+ def clabel(self, CS, levels=None, **kwargs):
+ """
+ Label a contour plot.
+
+ Adds labels to line contours in given `.ContourSet`.
+
+ Parameters
+ ----------
+ CS : `~.ContourSet` instance
+ Line contours to label.
+
+ levels : array-like, optional
+ A list of level values, that should be labeled. The list must be
+ a subset of ``CS.levels``. If not given, all levels are labeled.
+
+ **kwargs
+ All other parameters are documented in `~.ContourLabeler.clabel`.
+ """
+ return CS.clabel(levels, **kwargs)
+
+ #### Data analysis
+
+ @_preprocess_data(replace_names=["x", 'weights'], label_namer="x")
+ def hist(self, x, bins=None, range=None, density=False, weights=None,
+ cumulative=False, bottom=None, histtype='bar', align='mid',
+ orientation='vertical', rwidth=None, log=False,
+ color=None, label=None, stacked=False, **kwargs):
+ """
+ Plot a histogram.
+
+ Compute and draw the histogram of *x*. The return value is a tuple
+ (*n*, *bins*, *patches*) or ([*n0*, *n1*, ...], *bins*, [*patches0*,
+ *patches1*, ...]) if the input contains multiple data. See the
+ documentation of the *weights* parameter to draw a histogram of
+ already-binned data.
+
+ Multiple data can be provided via *x* as a list of datasets
+ of potentially different length ([*x0*, *x1*, ...]), or as
+ a 2D ndarray in which each column is a dataset. Note that
+ the ndarray form is transposed relative to the list form.
+
+ Masked arrays are not supported.
+
+ The *bins*, *range*, *weights*, and *density* parameters behave as in
+ `numpy.histogram`.
+
+ Parameters
+ ----------
+ x : (n,) array or sequence of (n,) arrays
+ Input values, this takes either a single array or a sequence of
+ arrays which are not required to be of the same length.
+
+ bins : int or sequence or str, default: :rc:`hist.bins`
+ If *bins* is an integer, it defines the number of equal-width bins
+ in the range.
+
+ If *bins* is a sequence, it defines the bin edges, including the
+ left edge of the first bin and the right edge of the last bin;
+ in this case, bins may be unequally spaced. All but the last
+ (righthand-most) bin is half-open. In other words, if *bins* is::
+
+ [1, 2, 3, 4]
+
+ then the first bin is ``[1, 2)`` (including 1, but excluding 2) and
+ the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which
+ *includes* 4.
+
+ If *bins* is a string, it is one of the binning strategies
+ supported by `numpy.histogram_bin_edges`: 'auto', 'fd', 'doane',
+ 'scott', 'stone', 'rice', 'sturges', or 'sqrt'.
+
+ range : tuple or None, default: None
+ The lower and upper range of the bins. Lower and upper outliers
+ are ignored. If not provided, *range* is ``(x.min(), x.max())``.
+ Range has no effect if *bins* is a sequence.
+
+ If *bins* is a sequence or *range* is specified, autoscaling
+ is based on the specified bin range instead of the
+ range of x.
+
+ density : bool, default: False
+ If ``True``, draw and return a probability density: each bin
+ will display the bin's raw count divided by the total number of
+ counts *and the bin width*
+ (``density = counts / (sum(counts) * np.diff(bins))``),
+ so that the area under the histogram integrates to 1
+ (``np.sum(density * np.diff(bins)) == 1``).
+
+ If *stacked* is also ``True``, the sum of the histograms is
+ normalized to 1.
+
+ weights : (n,) array-like or None, default: None
+ An array of weights, of the same shape as *x*. Each value in
+ *x* only contributes its associated weight towards the bin count
+ (instead of 1). If *density* is ``True``, the weights are
+ normalized, so that the integral of the density over the range
+ remains 1.
+
+ This parameter can be used to draw a histogram of data that has
+ already been binned, e.g. using `numpy.histogram` (by treating each
+ bin as a single point with a weight equal to its count) ::
+
+ counts, bins = np.histogram(data)
+ plt.hist(bins[:-1], bins, weights=counts)
+
+ (or you may alternatively use `~.bar()`).
+
+ cumulative : bool or -1, default: False
+ If ``True``, then a histogram is computed where each bin gives the
+ counts in that bin plus all bins for smaller values. The last bin
+ gives the total number of datapoints.
+
+ If *density* is also ``True`` then the histogram is normalized such
+ that the last bin equals 1.
+
+ If *cumulative* is a number less than 0 (e.g., -1), the direction
+ of accumulation is reversed. In this case, if *density* is also
+ ``True``, then the histogram is normalized such that the first bin
+ equals 1.
+
+ bottom : array-like, scalar, or None, default: None
+ Location of the bottom of each bin, ie. bins are drawn from
+ ``bottom`` to ``bottom + hist(x, bins)`` If a scalar, the bottom
+ of each bin is shifted by the same amount. If an array, each bin
+ is shifted independently and the length of bottom must match the
+ number of bins. If None, defaults to 0.
+
+ histtype : {'bar', 'barstacked', 'step', 'stepfilled'}, default: 'bar'
+ The type of histogram to draw.
+
+ - 'bar' is a traditional bar-type histogram. If multiple data
+ are given the bars are arranged side by side.
+ - 'barstacked' is a bar-type histogram where multiple
+ data are stacked on top of each other.
+ - 'step' generates a lineplot that is by default unfilled.
+ - 'stepfilled' generates a lineplot that is by default filled.
+
+ align : {'left', 'mid', 'right'}, default: 'mid'
+ The horizontal alignment of the histogram bars.
+
+ - 'left': bars are centered on the left bin edges.
+ - 'mid': bars are centered between the bin edges.
+ - 'right': bars are centered on the right bin edges.
+
+ orientation : {'vertical', 'horizontal'}, default: 'vertical'
+ If 'horizontal', `~.Axes.barh` will be used for bar-type histograms
+ and the *bottom* kwarg will be the left edges.
+
+ rwidth : float or None, default: None
+ The relative width of the bars as a fraction of the bin width. If
+ ``None``, automatically compute the width.
+
+ Ignored if *histtype* is 'step' or 'stepfilled'.
+
+ log : bool, default: False
+ If ``True``, the histogram axis will be set to a log scale.
+
+ color : color or array-like of colors or None, default: None
+ Color or sequence of colors, one per dataset. Default (``None``)
+ uses the standard line color sequence.
+
+ label : str or None, default: None
+ String, or sequence of strings to match multiple datasets. Bar
+ charts yield multiple patches per dataset, but only the first gets
+ the label, so that `~.Axes.legend` will work as expected.
+
+ stacked : bool, default: False
+ If ``True``, multiple data are stacked on top of each other If
+ ``False`` multiple data are arranged side by side if histtype is
+ 'bar' or on top of each other if histtype is 'step'
+
+ Returns
+ -------
+ n : array or list of arrays
+ The values of the histogram bins. See *density* and *weights* for a
+ description of the possible semantics. If input *x* is an array,
+ then this is an array of length *nbins*. If input is a sequence of
+ arrays ``[data1, data2, ...]``, then this is a list of arrays with
+ the values of the histograms for each of the arrays in the same
+ order. The dtype of the array *n* (or of its element arrays) will
+ always be float even if no weighting or normalization is used.
+
+ bins : array
+ The edges of the bins. Length nbins + 1 (nbins left edges and right
+ edge of last bin). Always a single array even when multiple data
+ sets are passed in.
+
+ patches : `.BarContainer` or list of a single `.Polygon` or list of \
+such objects
+ Container of individual artists used to create the histogram
+ or list of such containers if there are multiple input datasets.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ `~matplotlib.patches.Patch` properties
+
+ See Also
+ --------
+ hist2d : 2D histograms
+
+ Notes
+ -----
+ For large numbers of bins (>1000), 'step' and 'stepfilled' can be
+ significantly faster than 'bar' and 'barstacked'.
+
+ """
+ # Avoid shadowing the builtin.
+ bin_range = range
+ from builtins import range
+
+ if np.isscalar(x):
+ x = [x]
+
+ if bins is None:
+ bins = rcParams['hist.bins']
+
+ # Validate string inputs here to avoid cluttering subsequent code.
+ _api.check_in_list(['bar', 'barstacked', 'step', 'stepfilled'],
+ histtype=histtype)
+ _api.check_in_list(['left', 'mid', 'right'], align=align)
+ _api.check_in_list(['horizontal', 'vertical'], orientation=orientation)
+
+ if histtype == 'barstacked' and not stacked:
+ stacked = True
+
+ # Massage 'x' for processing.
+ x = cbook._reshape_2D(x, 'x')
+ nx = len(x) # number of datasets
+
+ # Process unit information. _process_unit_info sets the unit and
+ # converts the first dataset; then we convert each following dataset
+ # one at a time.
+ if orientation == "vertical":
+ convert_units = self.convert_xunits
+ x = [*self._process_unit_info([("x", x[0])], kwargs),
+ *map(convert_units, x[1:])]
+ else: # horizontal
+ convert_units = self.convert_yunits
+ x = [*self._process_unit_info([("y", x[0])], kwargs),
+ *map(convert_units, x[1:])]
+
+ if bin_range is not None:
+ bin_range = convert_units(bin_range)
+
+ if not cbook.is_scalar_or_string(bins):
+ bins = convert_units(bins)
+
+ # We need to do to 'weights' what was done to 'x'
+ if weights is not None:
+ w = cbook._reshape_2D(weights, 'weights')
+ else:
+ w = [None] * nx
+
+ if len(w) != nx:
+ raise ValueError('weights should have the same shape as x')
+
+ input_empty = True
+ for xi, wi in zip(x, w):
+ len_xi = len(xi)
+ if wi is not None and len(wi) != len_xi:
+ raise ValueError('weights should have the same shape as x')
+ if len_xi:
+ input_empty = False
+
+ if color is None:
+ color = [self._get_lines.get_next_color() for i in range(nx)]
+ else:
+ color = mcolors.to_rgba_array(color)
+ if len(color) != nx:
+ raise ValueError(f"The 'color' keyword argument must have one "
+ f"color per dataset, but {nx} datasets and "
+ f"{len(color)} colors were provided")
+
+ hist_kwargs = dict()
+
+ # if the bin_range is not given, compute without nan numpy
+ # does not do this for us when guessing the range (but will
+ # happily ignore nans when computing the histogram).
+ if bin_range is None:
+ xmin = np.inf
+ xmax = -np.inf
+ for xi in x:
+ if len(xi):
+ # python's min/max ignore nan,
+ # np.minnan returns nan for all nan input
+ xmin = min(xmin, np.nanmin(xi))
+ xmax = max(xmax, np.nanmax(xi))
+ if xmin <= xmax: # Only happens if we have seen a finite value.
+ bin_range = (xmin, xmax)
+
+ # If bins are not specified either explicitly or via range,
+ # we need to figure out the range required for all datasets,
+ # and supply that to np.histogram.
+ if not input_empty and len(x) > 1:
+ if weights is not None:
+ _w = np.concatenate(w)
+ else:
+ _w = None
+ bins = np.histogram_bin_edges(
+ np.concatenate(x), bins, bin_range, _w)
+ else:
+ hist_kwargs['range'] = bin_range
+
+ density = bool(density)
+ if density and not stacked:
+ hist_kwargs['density'] = density
+
+ # List to store all the top coordinates of the histograms
+ tops = [] # Will have shape (n_datasets, n_bins).
+ # Loop through datasets
+ for i in range(nx):
+ # this will automatically overwrite bins,
+ # so that each histogram uses the same bins
+ m, bins = np.histogram(x[i], bins, weights=w[i], **hist_kwargs)
+ tops.append(m)
+ tops = np.array(tops, float) # causes problems later if it's an int
+ if stacked:
+ tops = tops.cumsum(axis=0)
+ # If a stacked density plot, normalize so the area of all the
+ # stacked histograms together is 1
+ if density:
+ tops = (tops / np.diff(bins)) / tops[-1].sum()
+ if cumulative:
+ slc = slice(None)
+ if isinstance(cumulative, Number) and cumulative < 0:
+ slc = slice(None, None, -1)
+ if density:
+ tops = (tops * np.diff(bins))[:, slc].cumsum(axis=1)[:, slc]
+ else:
+ tops = tops[:, slc].cumsum(axis=1)[:, slc]
+
+ patches = []
+
+ if histtype.startswith('bar'):
+
+ totwidth = np.diff(bins)
+
+ if rwidth is not None:
+ dr = np.clip(rwidth, 0, 1)
+ elif (len(tops) > 1 and
+ ((not stacked) or rcParams['_internal.classic_mode'])):
+ dr = 0.8
+ else:
+ dr = 1.0
+
+ if histtype == 'bar' and not stacked:
+ width = dr * totwidth / nx
+ dw = width
+ boffset = -0.5 * dr * totwidth * (1 - 1 / nx)
+ elif histtype == 'barstacked' or stacked:
+ width = dr * totwidth
+ boffset, dw = 0.0, 0.0
+
+ if align == 'mid':
+ boffset += 0.5 * totwidth
+ elif align == 'right':
+ boffset += totwidth
+
+ if orientation == 'horizontal':
+ _barfunc = self.barh
+ bottom_kwarg = 'left'
+ else: # orientation == 'vertical'
+ _barfunc = self.bar
+ bottom_kwarg = 'bottom'
+
+ for m, c in zip(tops, color):
+ if bottom is None:
+ bottom = np.zeros(len(m))
+ if stacked:
+ height = m - bottom
+ else:
+ height = m
+ bars = _barfunc(bins[:-1]+boffset, height, width,
+ align='center', log=log,
+ color=c, **{bottom_kwarg: bottom})
+ patches.append(bars)
+ if stacked:
+ bottom = m
+ boffset += dw
+ # Remove stickies from all bars but the lowest ones, as otherwise
+ # margin expansion would be unable to cross the stickies in the
+ # middle of the bars.
+ for bars in patches[1:]:
+ for patch in bars:
+ patch.sticky_edges.x[:] = patch.sticky_edges.y[:] = []
+
+ elif histtype.startswith('step'):
+ # these define the perimeter of the polygon
+ x = np.zeros(4 * len(bins) - 3)
+ y = np.zeros(4 * len(bins) - 3)
+
+ x[0:2*len(bins)-1:2], x[1:2*len(bins)-1:2] = bins, bins[:-1]
+ x[2*len(bins)-1:] = x[1:2*len(bins)-1][::-1]
+
+ if bottom is None:
+ bottom = 0
+
+ y[1:2*len(bins)-1:2] = y[2:2*len(bins):2] = bottom
+ y[2*len(bins)-1:] = y[1:2*len(bins)-1][::-1]
+
+ if log:
+ if orientation == 'horizontal':
+ self.set_xscale('log', nonpositive='clip')
+ else: # orientation == 'vertical'
+ self.set_yscale('log', nonpositive='clip')
+
+ if align == 'left':
+ x -= 0.5*(bins[1]-bins[0])
+ elif align == 'right':
+ x += 0.5*(bins[1]-bins[0])
+
+ # If fill kwarg is set, it will be passed to the patch collection,
+ # overriding this
+ fill = (histtype == 'stepfilled')
+
+ xvals, yvals = [], []
+ for m in tops:
+ if stacked:
+ # top of the previous polygon becomes the bottom
+ y[2*len(bins)-1:] = y[1:2*len(bins)-1][::-1]
+ # set the top of this polygon
+ y[1:2*len(bins)-1:2] = y[2:2*len(bins):2] = m + bottom
+
+ # The starting point of the polygon has not yet been
+ # updated. So far only the endpoint was adjusted. This
+ # assignment closes the polygon. The redundant endpoint is
+ # later discarded (for step and stepfilled).
+ y[0] = y[-1]
+
+ if orientation == 'horizontal':
+ xvals.append(y.copy())
+ yvals.append(x.copy())
+ else:
+ xvals.append(x.copy())
+ yvals.append(y.copy())
+
+ # stepfill is closed, step is not
+ split = -1 if fill else 2 * len(bins)
+ # add patches in reverse order so that when stacking,
+ # items lower in the stack are plotted on top of
+ # items higher in the stack
+ for x, y, c in reversed(list(zip(xvals, yvals, color))):
+ patches.append(self.fill(
+ x[:split], y[:split],
+ closed=True if fill else None,
+ facecolor=c,
+ edgecolor=None if fill else c,
+ fill=fill if fill else None,
+ zorder=None if fill else mlines.Line2D.zorder))
+ for patch_list in patches:
+ for patch in patch_list:
+ if orientation == 'vertical':
+ patch.sticky_edges.y.append(0)
+ elif orientation == 'horizontal':
+ patch.sticky_edges.x.append(0)
+
+ # we return patches, so put it back in the expected order
+ patches.reverse()
+
+ # If None, make all labels None (via zip_longest below); otherwise,
+ # cast each element to str, but keep a single str as it.
+ labels = [] if label is None else np.atleast_1d(np.asarray(label, str))
+ for patch, lbl in itertools.zip_longest(patches, labels):
+ if patch:
+ p = patch[0]
+ p.update(kwargs)
+ if lbl is not None:
+ p.set_label(lbl)
+ for p in patch[1:]:
+ p.update(kwargs)
+ p.set_label('_nolegend_')
+
+ if nx == 1:
+ return tops[0], bins, patches[0]
+ else:
+ patch_type = ("BarContainer" if histtype.startswith("bar")
+ else "list[Polygon]")
+ return tops, bins, cbook.silent_list(patch_type, patches)
+
+ @_preprocess_data()
+ def stairs(self, values, edges=None, *,
+ orientation='vertical', baseline=0, fill=False, **kwargs):
+ """
+ A stepwise constant function as a line with bounding edges
+ or a filled plot.
+
+ Parameters
+ ----------
+ values : array-like
+ The step heights.
+
+ edges : array-like
+ The edge positions, with ``len(edges) == len(vals) + 1``,
+ between which the curve takes on vals values.
+
+ orientation : {'vertical', 'horizontal'}, default: 'vertical'
+ The direction of the steps. Vertical means that *values* are along
+ the y-axis, and edges are along the x-axis.
+
+ baseline : float, array-like or None, default: 0
+ The bottom value of the bounding edges or when
+ ``fill=True``, position of lower edge. If *fill* is
+ True or an array is passed to *baseline*, a closed
+ path is drawn.
+
+ fill : bool, default: False
+ Whether the area under the step curve should be filled.
+
+ Returns
+ -------
+ StepPatch : `matplotlib.patches.StepPatch`
+
+ Other Parameters
+ ----------------
+ **kwargs
+ `~matplotlib.patches.StepPatch` properties
+
+ """
+
+ if 'color' in kwargs:
+ _color = kwargs.pop('color')
+ else:
+ _color = self._get_lines.get_next_color()
+ if fill:
+ kwargs.setdefault('edgecolor', 'none')
+ kwargs.setdefault('facecolor', _color)
+ else:
+ kwargs.setdefault('edgecolor', _color)
+
+ if edges is None:
+ edges = np.arange(len(values) + 1)
+
+ edges, values, baseline = self._process_unit_info(
+ [("x", edges), ("y", values), ("y", baseline)], kwargs)
+
+ patch = mpatches.StepPatch(values,
+ edges,
+ baseline=baseline,
+ orientation=orientation,
+ fill=fill,
+ **kwargs)
+ self.add_patch(patch)
+ if baseline is None:
+ baseline = 0
+ if orientation == 'vertical':
+ patch.sticky_edges.y.append(np.min(baseline))
+ self.update_datalim([(edges[0], np.min(baseline))])
+ else:
+ patch.sticky_edges.x.append(np.min(baseline))
+ self.update_datalim([(np.min(baseline), edges[0])])
+ self._request_autoscale_view()
+ return patch
+
+ @_preprocess_data(replace_names=["x", "y", "weights"])
+ @docstring.dedent_interpd
+ def hist2d(self, x, y, bins=10, range=None, density=False, weights=None,
+ cmin=None, cmax=None, **kwargs):
+ """
+ Make a 2D histogram plot.
+
+ Parameters
+ ----------
+ x, y : array-like, shape (n, )
+ Input values
+
+ bins : None or int or [int, int] or array-like or [array, array]
+
+ The bin specification:
+
+ - If int, the number of bins for the two dimensions
+ (nx=ny=bins).
+ - If ``[int, int]``, the number of bins in each dimension
+ (nx, ny = bins).
+ - If array-like, the bin edges for the two dimensions
+ (x_edges=y_edges=bins).
+ - If ``[array, array]``, the bin edges in each dimension
+ (x_edges, y_edges = bins).
+
+ The default value is 10.
+
+ range : array-like shape(2, 2), optional
+ The leftmost and rightmost edges of the bins along each dimension
+ (if not specified explicitly in the bins parameters): ``[[xmin,
+ xmax], [ymin, ymax]]``. All values outside of this range will be
+ considered outliers and not tallied in the histogram.
+
+ density : bool, default: False
+ Normalize histogram. See the documentation for the *density*
+ parameter of `~.Axes.hist` for more details.
+
+ weights : array-like, shape (n, ), optional
+ An array of values w_i weighing each sample (x_i, y_i).
+
+ cmin, cmax : float, default: None
+ All bins that has count less than *cmin* or more than *cmax* will
+ not be displayed (set to NaN before passing to imshow) and these
+ count values in the return value count histogram will also be set
+ to nan upon return.
+
+ Returns
+ -------
+ h : 2D array
+ The bi-dimensional histogram of samples x and y. Values in x are
+ histogrammed along the first dimension and values in y are
+ histogrammed along the second dimension.
+ xedges : 1D array
+ The bin edges along the x axis.
+ yedges : 1D array
+ The bin edges along the y axis.
+ image : `~.matplotlib.collections.QuadMesh`
+
+ Other Parameters
+ ----------------
+ cmap : Colormap or str, optional
+ A `.colors.Colormap` instance. If not set, use rc settings.
+
+ norm : Normalize, optional
+ A `.colors.Normalize` instance is used to
+ scale luminance data to ``[0, 1]``. If not set, defaults to
+ `.colors.Normalize()`.
+
+ vmin/vmax : None or scalar, optional
+ Arguments passed to the `~.colors.Normalize` instance.
+
+ alpha : ``0 <= scalar <= 1`` or ``None``, optional
+ The alpha blending value.
+
+ **kwargs
+ Additional parameters are passed along to the
+ `~.Axes.pcolormesh` method and `~matplotlib.collections.QuadMesh`
+ constructor.
+
+ See Also
+ --------
+ hist : 1D histogram plotting
+
+ Notes
+ -----
+ - Currently ``hist2d`` calculates its own axis limits, and any limits
+ previously set are ignored.
+ - Rendering the histogram with a logarithmic color scale is
+ accomplished by passing a `.colors.LogNorm` instance to the *norm*
+ keyword argument. Likewise, power-law normalization (similar
+ in effect to gamma correction) can be accomplished with
+ `.colors.PowerNorm`.
+ """
+
+ h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=range,
+ density=density, weights=weights)
+
+ if cmin is not None:
+ h[h < cmin] = None
+ if cmax is not None:
+ h[h > cmax] = None
+
+ pc = self.pcolormesh(xedges, yedges, h.T, **kwargs)
+ self.set_xlim(xedges[0], xedges[-1])
+ self.set_ylim(yedges[0], yedges[-1])
+
+ return h, xedges, yedges, pc
+
+ @_preprocess_data(replace_names=["x"])
+ @docstring.dedent_interpd
+ def psd(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
+ window=None, noverlap=None, pad_to=None,
+ sides=None, scale_by_freq=None, return_line=None, **kwargs):
+ r"""
+ Plot the power spectral density.
+
+ The power spectral density :math:`P_{xx}` by Welch's average
+ periodogram method. The vector *x* is divided into *NFFT* length
+ segments. Each segment is detrended by function *detrend* and
+ windowed by function *window*. *noverlap* gives the length of
+ the overlap between segments. The :math:`|\mathrm{fft}(i)|^2`
+ of each segment :math:`i` are averaged to compute :math:`P_{xx}`,
+ with a scaling to correct for power loss due to windowing.
+
+ If len(*x*) < *NFFT*, it will be zero padded to *NFFT*.
+
+ Parameters
+ ----------
+ x : 1-D array or sequence
+ Array or sequence containing the data
+
+ %(Spectral)s
+
+ %(PSD)s
+
+ noverlap : int, default: 0 (no overlap)
+ The number of points of overlap between segments.
+
+ Fc : int, default: 0
+ The center frequency of *x*, which offsets the x extents of the
+ plot to reflect the frequency range used when a signal is acquired
+ and then filtered and downsampled to baseband.
+
+ return_line : bool, default: False
+ Whether to include the line object plotted in the returned values.
+
+ Returns
+ -------
+ Pxx : 1-D array
+ The values for the power spectrum :math:`P_{xx}` before scaling
+ (real valued).
+
+ freqs : 1-D array
+ The frequencies corresponding to the elements in *Pxx*.
+
+ line : `~matplotlib.lines.Line2D`
+ The line created by this function.
+ Only returned if *return_line* is True.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Keyword arguments control the `.Line2D` properties:
+
+ %(Line2D_kwdoc)s
+
+ See Also
+ --------
+ specgram
+ Differs in the default overlap; in not returning the mean of the
+ segment periodograms; in returning the times of the segments; and
+ in plotting a colormap instead of a line.
+ magnitude_spectrum
+ Plots the magnitude spectrum.
+ csd
+ Plots the spectral density between two signals.
+
+ Notes
+ -----
+ For plotting, the power is plotted as
+ :math:`10\log_{10}(P_{xx})` for decibels, though *Pxx* itself
+ is returned.
+
+ References
+ ----------
+ Bendat & Piersol -- Random Data: Analysis and Measurement Procedures,
+ John Wiley & Sons (1986)
+ """
+ if Fc is None:
+ Fc = 0
+
+ pxx, freqs = mlab.psd(x=x, NFFT=NFFT, Fs=Fs, detrend=detrend,
+ window=window, noverlap=noverlap, pad_to=pad_to,
+ sides=sides, scale_by_freq=scale_by_freq)
+ freqs += Fc
+
+ if scale_by_freq in (None, True):
+ psd_units = 'dB/Hz'
+ else:
+ psd_units = 'dB'
+
+ line = self.plot(freqs, 10 * np.log10(pxx), **kwargs)
+ self.set_xlabel('Frequency')
+ self.set_ylabel('Power Spectral Density (%s)' % psd_units)
+ self.grid(True)
+ vmin, vmax = self.viewLim.intervaly
+ intv = vmax - vmin
+ logi = int(np.log10(intv))
+ if logi == 0:
+ logi = .1
+ step = 10 * logi
+ ticks = np.arange(math.floor(vmin), math.ceil(vmax) + 1, step)
+ self.set_yticks(ticks)
+
+ if return_line is None or not return_line:
+ return pxx, freqs
+ else:
+ return pxx, freqs, line
+
+ @_preprocess_data(replace_names=["x", "y"], label_namer="y")
+ @docstring.dedent_interpd
+ def csd(self, x, y, NFFT=None, Fs=None, Fc=None, detrend=None,
+ window=None, noverlap=None, pad_to=None,
+ sides=None, scale_by_freq=None, return_line=None, **kwargs):
+ r"""
+ Plot the cross-spectral density.
+
+ The cross spectral density :math:`P_{xy}` by Welch's average
+ periodogram method. The vectors *x* and *y* are divided into
+ *NFFT* length segments. Each segment is detrended by function
+ *detrend* and windowed by function *window*. *noverlap* gives
+ the length of the overlap between segments. The product of
+ the direct FFTs of *x* and *y* are averaged over each segment
+ to compute :math:`P_{xy}`, with a scaling to correct for power
+ loss due to windowing.
+
+ If len(*x*) < *NFFT* or len(*y*) < *NFFT*, they will be zero
+ padded to *NFFT*.
+
+ Parameters
+ ----------
+ x, y : 1-D arrays or sequences
+ Arrays or sequences containing the data.
+
+ %(Spectral)s
+
+ %(PSD)s
+
+ noverlap : int, default: 0 (no overlap)
+ The number of points of overlap between segments.
+
+ Fc : int, default: 0
+ The center frequency of *x*, which offsets the x extents of the
+ plot to reflect the frequency range used when a signal is acquired
+ and then filtered and downsampled to baseband.
+
+ return_line : bool, default: False
+ Whether to include the line object plotted in the returned values.
+
+ Returns
+ -------
+ Pxy : 1-D array
+ The values for the cross spectrum :math:`P_{xy}` before scaling
+ (complex valued).
+
+ freqs : 1-D array
+ The frequencies corresponding to the elements in *Pxy*.
+
+ line : `~matplotlib.lines.Line2D`
+ The line created by this function.
+ Only returned if *return_line* is True.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Keyword arguments control the `.Line2D` properties:
+
+ %(Line2D_kwdoc)s
+
+ See Also
+ --------
+ psd : is equivalent to setting ``y = x``.
+
+ Notes
+ -----
+ For plotting, the power is plotted as
+ :math:`10 \log_{10}(P_{xy})` for decibels, though :math:`P_{xy}` itself
+ is returned.
+
+ References
+ ----------
+ Bendat & Piersol -- Random Data: Analysis and Measurement Procedures,
+ John Wiley & Sons (1986)
+ """
+ if Fc is None:
+ Fc = 0
+
+ pxy, freqs = mlab.csd(x=x, y=y, NFFT=NFFT, Fs=Fs, detrend=detrend,
+ window=window, noverlap=noverlap, pad_to=pad_to,
+ sides=sides, scale_by_freq=scale_by_freq)
+ # pxy is complex
+ freqs += Fc
+
+ line = self.plot(freqs, 10 * np.log10(np.abs(pxy)), **kwargs)
+ self.set_xlabel('Frequency')
+ self.set_ylabel('Cross Spectrum Magnitude (dB)')
+ self.grid(True)
+ vmin, vmax = self.viewLim.intervaly
+
+ intv = vmax - vmin
+ step = 10 * int(np.log10(intv))
+
+ ticks = np.arange(math.floor(vmin), math.ceil(vmax) + 1, step)
+ self.set_yticks(ticks)
+
+ if return_line is None or not return_line:
+ return pxy, freqs
+ else:
+ return pxy, freqs, line
+
+ @_preprocess_data(replace_names=["x"])
+ @docstring.dedent_interpd
+ def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None,
+ pad_to=None, sides=None, scale=None,
+ **kwargs):
+ """
+ Plot the magnitude spectrum.
+
+ Compute the magnitude spectrum of *x*. Data is padded to a
+ length of *pad_to* and the windowing function *window* is applied to
+ the signal.
+
+ Parameters
+ ----------
+ x : 1-D array or sequence
+ Array or sequence containing the data.
+
+ %(Spectral)s
+
+ %(Single_Spectrum)s
+
+ scale : {'default', 'linear', 'dB'}
+ The scaling of the values in the *spec*. 'linear' is no scaling.
+ 'dB' returns the values in dB scale, i.e., the dB amplitude
+ (20 * log10). 'default' is 'linear'.
+
+ Fc : int, default: 0
+ The center frequency of *x*, which offsets the x extents of the
+ plot to reflect the frequency range used when a signal is acquired
+ and then filtered and downsampled to baseband.
+
+ Returns
+ -------
+ spectrum : 1-D array
+ The values for the magnitude spectrum before scaling (real valued).
+
+ freqs : 1-D array
+ The frequencies corresponding to the elements in *spectrum*.
+
+ line : `~matplotlib.lines.Line2D`
+ The line created by this function.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Keyword arguments control the `.Line2D` properties:
+
+ %(Line2D_kwdoc)s
+
+ See Also
+ --------
+ psd
+ Plots the power spectral density.
+ angle_spectrum
+ Plots the angles of the corresponding frequencies.
+ phase_spectrum
+ Plots the phase (unwrapped angle) of the corresponding frequencies.
+ specgram
+ Can plot the magnitude spectrum of segments within the signal in a
+ colormap.
+ """
+ if Fc is None:
+ Fc = 0
+
+ spec, freqs = mlab.magnitude_spectrum(x=x, Fs=Fs, window=window,
+ pad_to=pad_to, sides=sides)
+ freqs += Fc
+
+ yunits = _api.check_getitem(
+ {None: 'energy', 'default': 'energy', 'linear': 'energy',
+ 'dB': 'dB'},
+ scale=scale)
+ if yunits == 'energy':
+ Z = spec
+ else: # yunits == 'dB'
+ Z = 20. * np.log10(spec)
+
+ line, = self.plot(freqs, Z, **kwargs)
+ self.set_xlabel('Frequency')
+ self.set_ylabel('Magnitude (%s)' % yunits)
+
+ return spec, freqs, line
+
+ @_preprocess_data(replace_names=["x"])
+ @docstring.dedent_interpd
+ def angle_spectrum(self, x, Fs=None, Fc=None, window=None,
+ pad_to=None, sides=None, **kwargs):
+ """
+ Plot the angle spectrum.
+
+ Compute the angle spectrum (wrapped phase spectrum) of *x*.
+ Data is padded to a length of *pad_to* and the windowing function
+ *window* is applied to the signal.
+
+ Parameters
+ ----------
+ x : 1-D array or sequence
+ Array or sequence containing the data.
+
+ %(Spectral)s
+
+ %(Single_Spectrum)s
+
+ Fc : int, default: 0
+ The center frequency of *x*, which offsets the x extents of the
+ plot to reflect the frequency range used when a signal is acquired
+ and then filtered and downsampled to baseband.
+
+ Returns
+ -------
+ spectrum : 1-D array
+ The values for the angle spectrum in radians (real valued).
+
+ freqs : 1-D array
+ The frequencies corresponding to the elements in *spectrum*.
+
+ line : `~matplotlib.lines.Line2D`
+ The line created by this function.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Keyword arguments control the `.Line2D` properties:
+
+ %(Line2D_kwdoc)s
+
+ See Also
+ --------
+ magnitude_spectrum
+ Plots the magnitudes of the corresponding frequencies.
+ phase_spectrum
+ Plots the unwrapped version of this function.
+ specgram
+ Can plot the angle spectrum of segments within the signal in a
+ colormap.
+ """
+ if Fc is None:
+ Fc = 0
+
+ spec, freqs = mlab.angle_spectrum(x=x, Fs=Fs, window=window,
+ pad_to=pad_to, sides=sides)
+ freqs += Fc
+
+ lines = self.plot(freqs, spec, **kwargs)
+ self.set_xlabel('Frequency')
+ self.set_ylabel('Angle (radians)')
+
+ return spec, freqs, lines[0]
+
+ @_preprocess_data(replace_names=["x"])
+ @docstring.dedent_interpd
+ def phase_spectrum(self, x, Fs=None, Fc=None, window=None,
+ pad_to=None, sides=None, **kwargs):
+ """
+ Plot the phase spectrum.
+
+ Compute the phase spectrum (unwrapped angle spectrum) of *x*.
+ Data is padded to a length of *pad_to* and the windowing function
+ *window* is applied to the signal.
+
+ Parameters
+ ----------
+ x : 1-D array or sequence
+ Array or sequence containing the data
+
+ %(Spectral)s
+
+ %(Single_Spectrum)s
+
+ Fc : int, default: 0
+ The center frequency of *x*, which offsets the x extents of the
+ plot to reflect the frequency range used when a signal is acquired
+ and then filtered and downsampled to baseband.
+
+ Returns
+ -------
+ spectrum : 1-D array
+ The values for the phase spectrum in radians (real valued).
+
+ freqs : 1-D array
+ The frequencies corresponding to the elements in *spectrum*.
+
+ line : `~matplotlib.lines.Line2D`
+ The line created by this function.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Keyword arguments control the `.Line2D` properties:
+
+ %(Line2D_kwdoc)s
+
+ See Also
+ --------
+ magnitude_spectrum
+ Plots the magnitudes of the corresponding frequencies.
+ angle_spectrum
+ Plots the wrapped version of this function.
+ specgram
+ Can plot the phase spectrum of segments within the signal in a
+ colormap.
+ """
+ if Fc is None:
+ Fc = 0
+
+ spec, freqs = mlab.phase_spectrum(x=x, Fs=Fs, window=window,
+ pad_to=pad_to, sides=sides)
+ freqs += Fc
+
+ lines = self.plot(freqs, spec, **kwargs)
+ self.set_xlabel('Frequency')
+ self.set_ylabel('Phase (radians)')
+
+ return spec, freqs, lines[0]
+
+ @_preprocess_data(replace_names=["x", "y"])
+ @docstring.dedent_interpd
+ def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
+ window=mlab.window_hanning, noverlap=0, pad_to=None,
+ sides='default', scale_by_freq=None, **kwargs):
+ r"""
+ Plot the coherence between *x* and *y*.
+
+ Plot the coherence between *x* and *y*. Coherence is the
+ normalized cross spectral density:
+
+ .. math::
+
+ C_{xy} = \frac{|P_{xy}|^2}{P_{xx}P_{yy}}
+
+ Parameters
+ ----------
+ %(Spectral)s
+
+ %(PSD)s
+
+ noverlap : int, default: 0 (no overlap)
+ The number of points of overlap between blocks.
+
+ Fc : int, default: 0
+ The center frequency of *x*, which offsets the x extents of the
+ plot to reflect the frequency range used when a signal is acquired
+ and then filtered and downsampled to baseband.
+
+ Returns
+ -------
+ Cxy : 1-D array
+ The coherence vector.
+
+ freqs : 1-D array
+ The frequencies for the elements in *Cxy*.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Keyword arguments control the `.Line2D` properties:
+
+ %(Line2D_kwdoc)s
+
+ References
+ ----------
+ Bendat & Piersol -- Random Data: Analysis and Measurement Procedures,
+ John Wiley & Sons (1986)
+ """
+ cxy, freqs = mlab.cohere(x=x, y=y, NFFT=NFFT, Fs=Fs, detrend=detrend,
+ window=window, noverlap=noverlap,
+ scale_by_freq=scale_by_freq)
+ freqs += Fc
+
+ self.plot(freqs, cxy, **kwargs)
+ self.set_xlabel('Frequency')
+ self.set_ylabel('Coherence')
+ self.grid(True)
+
+ return cxy, freqs
+
+ @_preprocess_data(replace_names=["x"])
+ @docstring.dedent_interpd
+ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
+ window=None, noverlap=None,
+ cmap=None, xextent=None, pad_to=None, sides=None,
+ scale_by_freq=None, mode=None, scale=None,
+ vmin=None, vmax=None, **kwargs):
+ """
+ Plot a spectrogram.
+
+ Compute and plot a spectrogram of data in *x*. Data are split into
+ *NFFT* length segments and the spectrum of each section is
+ computed. The windowing function *window* is applied to each
+ segment, and the amount of overlap of each segment is
+ specified with *noverlap*. The spectrogram is plotted as a colormap
+ (using imshow).
+
+ Parameters
+ ----------
+ x : 1-D array or sequence
+ Array or sequence containing the data.
+
+ %(Spectral)s
+
+ %(PSD)s
+
+ mode : {'default', 'psd', 'magnitude', 'angle', 'phase'}
+ What sort of spectrum to use. Default is 'psd', which takes the
+ power spectral density. 'magnitude' returns the magnitude
+ spectrum. 'angle' returns the phase spectrum without unwrapping.
+ 'phase' returns the phase spectrum with unwrapping.
+
+ noverlap : int, default: 128
+ The number of points of overlap between blocks.
+
+ scale : {'default', 'linear', 'dB'}
+ The scaling of the values in the *spec*. 'linear' is no scaling.
+ 'dB' returns the values in dB scale. When *mode* is 'psd',
+ this is dB power (10 * log10). Otherwise this is dB amplitude
+ (20 * log10). 'default' is 'dB' if *mode* is 'psd' or
+ 'magnitude' and 'linear' otherwise. This must be 'linear'
+ if *mode* is 'angle' or 'phase'.
+
+ Fc : int, default: 0
+ The center frequency of *x*, which offsets the x extents of the
+ plot to reflect the frequency range used when a signal is acquired
+ and then filtered and downsampled to baseband.
+
+ cmap : `.Colormap`, default: :rc:`image.cmap`
+
+ xextent : *None* or (xmin, xmax)
+ The image extent along the x-axis. The default sets *xmin* to the
+ left border of the first bin (*spectrum* column) and *xmax* to the
+ right border of the last bin. Note that for *noverlap>0* the width
+ of the bins is smaller than those of the segments.
+
+ **kwargs
+ Additional keyword arguments are passed on to `~.axes.Axes.imshow`
+ which makes the specgram image. The origin keyword argument
+ is not supported.
+
+ Returns
+ -------
+ spectrum : 2D array
+ Columns are the periodograms of successive segments.
+
+ freqs : 1-D array
+ The frequencies corresponding to the rows in *spectrum*.
+
+ t : 1-D array
+ The times corresponding to midpoints of segments (i.e., the columns
+ in *spectrum*).
+
+ im : `.AxesImage`
+ The image created by imshow containing the spectrogram.
+
+ See Also
+ --------
+ psd
+ Differs in the default overlap; in returning the mean of the
+ segment periodograms; in not returning times; and in generating a
+ line plot instead of colormap.
+ magnitude_spectrum
+ A single spectrum, similar to having a single segment when *mode*
+ is 'magnitude'. Plots a line instead of a colormap.
+ angle_spectrum
+ A single spectrum, similar to having a single segment when *mode*
+ is 'angle'. Plots a line instead of a colormap.
+ phase_spectrum
+ A single spectrum, similar to having a single segment when *mode*
+ is 'phase'. Plots a line instead of a colormap.
+
+ Notes
+ -----
+ The parameters *detrend* and *scale_by_freq* do only apply when *mode*
+ is set to 'psd'.
+ """
+ if NFFT is None:
+ NFFT = 256 # same default as in mlab.specgram()
+ if Fc is None:
+ Fc = 0 # same default as in mlab._spectral_helper()
+ if noverlap is None:
+ noverlap = 128 # same default as in mlab.specgram()
+ if Fs is None:
+ Fs = 2 # same default as in mlab._spectral_helper()
+
+ if mode == 'complex':
+ raise ValueError('Cannot plot a complex specgram')
+
+ if scale is None or scale == 'default':
+ if mode in ['angle', 'phase']:
+ scale = 'linear'
+ else:
+ scale = 'dB'
+ elif mode in ['angle', 'phase'] and scale == 'dB':
+ raise ValueError('Cannot use dB scale with angle or phase mode')
+
+ spec, freqs, t = mlab.specgram(x=x, NFFT=NFFT, Fs=Fs,
+ detrend=detrend, window=window,
+ noverlap=noverlap, pad_to=pad_to,
+ sides=sides,
+ scale_by_freq=scale_by_freq,
+ mode=mode)
+
+ if scale == 'linear':
+ Z = spec
+ elif scale == 'dB':
+ if mode is None or mode == 'default' or mode == 'psd':
+ Z = 10. * np.log10(spec)
+ else:
+ Z = 20. * np.log10(spec)
+ else:
+ raise ValueError('Unknown scale %s', scale)
+
+ Z = np.flipud(Z)
+
+ if xextent is None:
+ # padding is needed for first and last segment:
+ pad_xextent = (NFFT-noverlap) / Fs / 2
+ xextent = np.min(t) - pad_xextent, np.max(t) + pad_xextent
+ xmin, xmax = xextent
+ freqs += Fc
+ extent = xmin, xmax, freqs[0], freqs[-1]
+
+ if 'origin' in kwargs:
+ raise TypeError("specgram() got an unexpected keyword argument "
+ "'origin'")
+
+ im = self.imshow(Z, cmap, extent=extent, vmin=vmin, vmax=vmax,
+ origin='upper', **kwargs)
+ self.axis('auto')
+
+ return spec, freqs, t, im
+
+ @docstring.dedent_interpd
+ def spy(self, Z, precision=0, marker=None, markersize=None,
+ aspect='equal', origin="upper", **kwargs):
+ """
+ Plot the sparsity pattern of a 2D array.
+
+ This visualizes the non-zero values of the array.
+
+ Two plotting styles are available: image and marker. Both
+ are available for full arrays, but only the marker style
+ works for `scipy.sparse.spmatrix` instances.
+
+ **Image style**
+
+ If *marker* and *markersize* are *None*, `~.Axes.imshow` is used. Any
+ extra remaining keyword arguments are passed to this method.
+
+ **Marker style**
+
+ If *Z* is a `scipy.sparse.spmatrix` or *marker* or *markersize* are
+ *None*, a `.Line2D` object will be returned with the value of marker
+ determining the marker type, and any remaining keyword arguments
+ passed to `~.Axes.plot`.
+
+ Parameters
+ ----------
+ Z : (M, N) array-like
+ The array to be plotted.
+
+ precision : float or 'present', default: 0
+ If *precision* is 0, any non-zero value will be plotted. Otherwise,
+ values of :math:`|Z| > precision` will be plotted.
+
+ For `scipy.sparse.spmatrix` instances, you can also
+ pass 'present'. In this case any value present in the array
+ will be plotted, even if it is identically zero.
+
+ aspect : {'equal', 'auto', None} or float, default: 'equal'
+ The aspect ratio of the Axes. This parameter is particularly
+ relevant for images since it determines whether data pixels are
+ square.
+
+ This parameter is a shortcut for explicitly calling
+ `.Axes.set_aspect`. See there for further details.
+
+ - 'equal': Ensures an aspect ratio of 1. Pixels will be square.
+ - 'auto': The Axes is kept fixed and the aspect is adjusted so
+ that the data fit in the Axes. In general, this will result in
+ non-square pixels.
+ - *None*: Use :rc:`image.aspect`.
+
+ origin : {'upper', 'lower'}, default: :rc:`image.origin`
+ Place the [0, 0] index of the array in the upper left or lower left
+ corner of the Axes. The convention 'upper' is typically used for
+ matrices and images.
+
+ Returns
+ -------
+ `~matplotlib.image.AxesImage` or `.Line2D`
+ The return type depends on the plotting style (see above).
+
+ Other Parameters
+ ----------------
+ **kwargs
+ The supported additional parameters depend on the plotting style.
+
+ For the image style, you can pass the following additional
+ parameters of `~.Axes.imshow`:
+
+ - *cmap*
+ - *alpha*
+ - *url*
+ - any `.Artist` properties (passed on to the `.AxesImage`)
+
+ For the marker style, you can pass any `.Line2D` property except
+ for *linestyle*:
+
+ %(Line2D_kwdoc)s
+ """
+ if marker is None and markersize is None and hasattr(Z, 'tocoo'):
+ marker = 's'
+ _api.check_in_list(["upper", "lower"], origin=origin)
+ if marker is None and markersize is None:
+ Z = np.asarray(Z)
+ mask = np.abs(Z) > precision
+
+ if 'cmap' not in kwargs:
+ kwargs['cmap'] = mcolors.ListedColormap(['w', 'k'],
+ name='binary')
+ if 'interpolation' in kwargs:
+ raise TypeError(
+ "spy() got an unexpected keyword argument 'interpolation'")
+ if 'norm' not in kwargs:
+ kwargs['norm'] = mcolors.NoNorm()
+ ret = self.imshow(mask, interpolation='nearest',
+ aspect=aspect, origin=origin,
+ **kwargs)
+ else:
+ if hasattr(Z, 'tocoo'):
+ c = Z.tocoo()
+ if precision == 'present':
+ y = c.row
+ x = c.col
+ else:
+ nonzero = np.abs(c.data) > precision
+ y = c.row[nonzero]
+ x = c.col[nonzero]
+ else:
+ Z = np.asarray(Z)
+ nonzero = np.abs(Z) > precision
+ y, x = np.nonzero(nonzero)
+ if marker is None:
+ marker = 's'
+ if markersize is None:
+ markersize = 10
+ if 'linestyle' in kwargs:
+ raise TypeError(
+ "spy() got an unexpected keyword argument 'linestyle'")
+ ret = mlines.Line2D(
+ x, y, linestyle='None', marker=marker, markersize=markersize,
+ **kwargs)
+ self.add_line(ret)
+ nr, nc = Z.shape
+ self.set_xlim(-0.5, nc - 0.5)
+ if origin == "upper":
+ self.set_ylim(nr - 0.5, -0.5)
+ else:
+ self.set_ylim(-0.5, nr - 0.5)
+ self.set_aspect(aspect)
+ self.title.set_y(1.05)
+ if origin == "upper":
+ self.xaxis.tick_top()
+ else:
+ self.xaxis.tick_bottom()
+ self.xaxis.set_ticks_position('both')
+ self.xaxis.set_major_locator(
+ mticker.MaxNLocator(nbins=9, steps=[1, 2, 5, 10], integer=True))
+ self.yaxis.set_major_locator(
+ mticker.MaxNLocator(nbins=9, steps=[1, 2, 5, 10], integer=True))
+ return ret
+
+ def matshow(self, Z, **kwargs):
+ """
+ Plot the values of a 2D matrix or array as color-coded image.
+
+ The matrix will be shown the way it would be printed, with the first
+ row at the top. Row and column numbering is zero-based.
+
+ Parameters
+ ----------
+ Z : (M, N) array-like
+ The matrix to be displayed.
+
+ Returns
+ -------
+ `~matplotlib.image.AxesImage`
+
+ Other Parameters
+ ----------------
+ **kwargs : `~matplotlib.axes.Axes.imshow` arguments
+
+ See Also
+ --------
+ imshow : More general function to plot data on a 2D regular raster.
+
+ Notes
+ -----
+ This is just a convenience function wrapping `.imshow` to set useful
+ defaults for displaying a matrix. In particular:
+
+ - Set ``origin='upper'``.
+ - Set ``interpolation='nearest'``.
+ - Set ``aspect='equal'``.
+ - Ticks are placed to the left and above.
+ - Ticks are formatted to show integer indices.
+
+ """
+ Z = np.asanyarray(Z)
+ kw = {'origin': 'upper',
+ 'interpolation': 'nearest',
+ 'aspect': 'equal', # (already the imshow default)
+ **kwargs}
+ im = self.imshow(Z, **kw)
+ self.title.set_y(1.05)
+ self.xaxis.tick_top()
+ self.xaxis.set_ticks_position('both')
+ self.xaxis.set_major_locator(
+ mticker.MaxNLocator(nbins=9, steps=[1, 2, 5, 10], integer=True))
+ self.yaxis.set_major_locator(
+ mticker.MaxNLocator(nbins=9, steps=[1, 2, 5, 10], integer=True))
+ return im
+
+ @_preprocess_data(replace_names=["dataset"])
+ def violinplot(self, dataset, positions=None, vert=True, widths=0.5,
+ showmeans=False, showextrema=True, showmedians=False,
+ quantiles=None, points=100, bw_method=None):
+ """
+ Make a violin plot.
+
+ Make a violin plot for each column of *dataset* or each vector in
+ sequence *dataset*. Each filled area extends to represent the
+ entire data range, with optional lines at the mean, the median,
+ the minimum, the maximum, and user-specified quantiles.
+
+ Parameters
+ ----------
+ dataset : Array or a sequence of vectors.
+ The input data.
+
+ positions : array-like, default: [1, 2, ..., n]
+ The positions of the violins. The ticks and limits are
+ automatically set to match the positions.
+
+ vert : bool, default: True.
+ If true, creates a vertical violin plot.
+ Otherwise, creates a horizontal violin plot.
+
+ widths : array-like, default: 0.5
+ Either a scalar or a vector that sets the maximal width of
+ each violin. The default is 0.5, which uses about half of the
+ available horizontal space.
+
+ showmeans : bool, default: False
+ If `True`, will toggle rendering of the means.
+
+ showextrema : bool, default: True
+ If `True`, will toggle rendering of the extrema.
+
+ showmedians : bool, default: False
+ If `True`, will toggle rendering of the medians.
+
+ quantiles : array-like, default: None
+ If not None, set a list of floats in interval [0, 1] for each violin,
+ which stands for the quantiles that will be rendered for that
+ violin.
+
+ points : int, default: 100
+ Defines the number of points to evaluate each of the
+ gaussian kernel density estimations at.
+
+ bw_method : str, scalar or callable, optional
+ The method used to calculate the estimator bandwidth. This can be
+ 'scott', 'silverman', a scalar constant or a callable. If a
+ scalar, this will be used directly as `kde.factor`. If a
+ callable, it should take a `GaussianKDE` instance as its only
+ parameter and return a scalar. If None (default), 'scott' is used.
+
+ Returns
+ -------
+ dict
+ A dictionary mapping each component of the violinplot to a
+ list of the corresponding collection instances created. The
+ dictionary has the following keys:
+
+ - ``bodies``: A list of the `~.collections.PolyCollection`
+ instances containing the filled area of each violin.
+
+ - ``cmeans``: A `~.collections.LineCollection` instance that marks
+ the mean values of each of the violin's distribution.
+
+ - ``cmins``: A `~.collections.LineCollection` instance that marks
+ the bottom of each violin's distribution.
+
+ - ``cmaxes``: A `~.collections.LineCollection` instance that marks
+ the top of each violin's distribution.
+
+ - ``cbars``: A `~.collections.LineCollection` instance that marks
+ the centers of each violin's distribution.
+
+ - ``cmedians``: A `~.collections.LineCollection` instance that
+ marks the median values of each of the violin's distribution.
+
+ - ``cquantiles``: A `~.collections.LineCollection` instance created
+ to identify the quantile values of each of the violin's
+ distribution.
+
+ """
+
+ def _kde_method(X, coords):
+ if hasattr(X, 'values'): # support pandas.Series
+ X = X.values
+ # fallback gracefully if the vector contains only one value
+ if np.all(X[0] == X):
+ return (X[0] == coords).astype(float)
+ kde = mlab.GaussianKDE(X, bw_method)
+ return kde.evaluate(coords)
+
+ vpstats = cbook.violin_stats(dataset, _kde_method, points=points,
+ quantiles=quantiles)
+ return self.violin(vpstats, positions=positions, vert=vert,
+ widths=widths, showmeans=showmeans,
+ showextrema=showextrema, showmedians=showmedians)
+
+ def violin(self, vpstats, positions=None, vert=True, widths=0.5,
+ showmeans=False, showextrema=True, showmedians=False):
+ """
+ Drawing function for violin plots.
+
+ Draw a violin plot for each column of *vpstats*. Each filled area
+ extends to represent the entire data range, with optional lines at the
+ mean, the median, the minimum, the maximum, and the quantiles values.
+
+ Parameters
+ ----------
+ vpstats : list of dicts
+ A list of dictionaries containing stats for each violin plot.
+ Required keys are:
+
+ - ``coords``: A list of scalars containing the coordinates that
+ the violin's kernel density estimate were evaluated at.
+
+ - ``vals``: A list of scalars containing the values of the
+ kernel density estimate at each of the coordinates given
+ in *coords*.
+
+ - ``mean``: The mean value for this violin's dataset.
+
+ - ``median``: The median value for this violin's dataset.
+
+ - ``min``: The minimum value for this violin's dataset.
+
+ - ``max``: The maximum value for this violin's dataset.
+
+ Optional keys are:
+
+ - ``quantiles``: A list of scalars containing the quantile values
+ for this violin's dataset.
+
+ positions : array-like, default: [1, 2, ..., n]
+ The positions of the violins. The ticks and limits are
+ automatically set to match the positions.
+
+ vert : bool, default: True.
+ If true, plots the violins vertically.
+ Otherwise, plots the violins horizontally.
+
+ widths : array-like, default: 0.5
+ Either a scalar or a vector that sets the maximal width of
+ each violin. The default is 0.5, which uses about half of the
+ available horizontal space.
+
+ showmeans : bool, default: False
+ If true, will toggle rendering of the means.
+
+ showextrema : bool, default: True
+ If true, will toggle rendering of the extrema.
+
+ showmedians : bool, default: False
+ If true, will toggle rendering of the medians.
+
+ Returns
+ -------
+ dict
+ A dictionary mapping each component of the violinplot to a
+ list of the corresponding collection instances created. The
+ dictionary has the following keys:
+
+ - ``bodies``: A list of the `~.collections.PolyCollection`
+ instances containing the filled area of each violin.
+
+ - ``cmeans``: A `~.collections.LineCollection` instance that marks
+ the mean values of each of the violin's distribution.
+
+ - ``cmins``: A `~.collections.LineCollection` instance that marks
+ the bottom of each violin's distribution.
+
+ - ``cmaxes``: A `~.collections.LineCollection` instance that marks
+ the top of each violin's distribution.
+
+ - ``cbars``: A `~.collections.LineCollection` instance that marks
+ the centers of each violin's distribution.
+
+ - ``cmedians``: A `~.collections.LineCollection` instance that
+ marks the median values of each of the violin's distribution.
+
+ - ``cquantiles``: A `~.collections.LineCollection` instance created
+ to identify the quantiles values of each of the violin's
+ distribution.
+
+ """
+
+ # Statistical quantities to be plotted on the violins
+ means = []
+ mins = []
+ maxes = []
+ medians = []
+ quantiles = np.asarray([])
+
+ # Collections to be returned
+ artists = {}
+
+ N = len(vpstats)
+ datashape_message = ("List of violinplot statistics and `{0}` "
+ "values must have the same length")
+
+ # Validate positions
+ if positions is None:
+ positions = range(1, N + 1)
+ elif len(positions) != N:
+ raise ValueError(datashape_message.format("positions"))
+
+ # Validate widths
+ if np.isscalar(widths):
+ widths = [widths] * N
+ elif len(widths) != N:
+ raise ValueError(datashape_message.format("widths"))
+
+ # Calculate ranges for statistics lines
+ pmins = -0.25 * np.array(widths) + positions
+ pmaxes = 0.25 * np.array(widths) + positions
+
+ # Check whether we are rendering vertically or horizontally
+ if vert:
+ fill = self.fill_betweenx
+ perp_lines = self.hlines
+ par_lines = self.vlines
+ else:
+ fill = self.fill_between
+ perp_lines = self.vlines
+ par_lines = self.hlines
+
+ if rcParams['_internal.classic_mode']:
+ fillcolor = 'y'
+ edgecolor = 'r'
+ else:
+ fillcolor = edgecolor = self._get_lines.get_next_color()
+
+ # Render violins
+ bodies = []
+ for stats, pos, width in zip(vpstats, positions, widths):
+ # The 0.5 factor reflects the fact that we plot from v-p to
+ # v+p
+ vals = np.array(stats['vals'])
+ vals = 0.5 * width * vals / vals.max()
+ bodies += [fill(stats['coords'],
+ -vals + pos,
+ vals + pos,
+ facecolor=fillcolor,
+ alpha=0.3)]
+ means.append(stats['mean'])
+ mins.append(stats['min'])
+ maxes.append(stats['max'])
+ medians.append(stats['median'])
+ q = stats.get('quantiles')
+ if q is not None:
+ # If exist key quantiles, assume it's a list of floats
+ quantiles = np.concatenate((quantiles, q))
+ artists['bodies'] = bodies
+
+ # Render means
+ if showmeans:
+ artists['cmeans'] = perp_lines(means, pmins, pmaxes,
+ colors=edgecolor)
+
+ # Render extrema
+ if showextrema:
+ artists['cmaxes'] = perp_lines(maxes, pmins, pmaxes,
+ colors=edgecolor)
+ artists['cmins'] = perp_lines(mins, pmins, pmaxes,
+ colors=edgecolor)
+ artists['cbars'] = par_lines(positions, mins, maxes,
+ colors=edgecolor)
+
+ # Render medians
+ if showmedians:
+ artists['cmedians'] = perp_lines(medians,
+ pmins,
+ pmaxes,
+ colors=edgecolor)
+
+ # Render quantile values
+ if quantiles.size > 0:
+ # Recalculate ranges for statistics lines for quantiles.
+ # ppmins are the left end of quantiles lines
+ ppmins = np.asarray([])
+ # pmaxes are the right end of quantiles lines
+ ppmaxs = np.asarray([])
+ for stats, cmin, cmax in zip(vpstats, pmins, pmaxes):
+ q = stats.get('quantiles')
+ if q is not None:
+ ppmins = np.concatenate((ppmins, [cmin] * np.size(q)))
+ ppmaxs = np.concatenate((ppmaxs, [cmax] * np.size(q)))
+ # Start rendering
+ artists['cquantiles'] = perp_lines(quantiles, ppmins, ppmaxs,
+ colors=edgecolor)
+
+ return artists
+
+ # Methods that are entirely implemented in other modules.
+
+ table = mtable.table
+
+ # args can by either Y or y1, y2, ... and all should be replaced
+ stackplot = _preprocess_data()(mstack.stackplot)
+
+ streamplot = _preprocess_data(
+ replace_names=["x", "y", "u", "v", "start_points"])(mstream.streamplot)
+
+ tricontour = mtri.tricontour
+ tricontourf = mtri.tricontourf
+ tripcolor = mtri.tripcolor
+ triplot = mtri.triplot
diff --git a/venv/Lib/site-packages/matplotlib/axes/_base.py b/venv/Lib/site-packages/matplotlib/axes/_base.py
new file mode 100644
index 0000000..2a97499
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/axes/_base.py
@@ -0,0 +1,4571 @@
+from collections import OrderedDict
+from contextlib import ExitStack
+import functools
+import inspect
+import itertools
+import logging
+from numbers import Real
+from operator import attrgetter
+import types
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib import _api, cbook
+from matplotlib.cbook import _OrderedSet, _check_1d, index_of
+from matplotlib import docstring
+import matplotlib.colors as mcolors
+import matplotlib.lines as mlines
+import matplotlib.patches as mpatches
+import matplotlib.artist as martist
+import matplotlib.transforms as mtransforms
+import matplotlib.ticker as mticker
+import matplotlib.axis as maxis
+import matplotlib.spines as mspines
+import matplotlib.font_manager as font_manager
+import matplotlib.text as mtext
+import matplotlib.image as mimage
+import matplotlib.path as mpath
+from matplotlib.rcsetup import cycler, validate_axisbelow
+
+_log = logging.getLogger(__name__)
+
+
+class _axis_method_wrapper:
+ """
+ Helper to generate Axes methods wrapping Axis methods.
+
+ After ::
+
+ get_foo = _axis_method_wrapper("xaxis", "get_bar")
+
+ (in the body of a class) ``get_foo`` is a method that forwards it arguments
+ to the ``get_bar`` method of the ``xaxis`` attribute, and gets its
+ signature and docstring from ``Axis.get_bar``.
+
+ The docstring of ``get_foo`` is built by replacing "this Axis" by "the
+ {attr_name}" (i.e., "the xaxis", "the yaxis") in the wrapped method's
+ dedented docstring; additional replacements can by given in *doc_sub*.
+ """
+
+ def __init__(self, attr_name, method_name, *, doc_sub=None):
+ self.attr_name = attr_name
+ self.method_name = method_name
+ # Immediately put the docstring in ``self.__doc__`` so that docstring
+ # manipulations within the class body work as expected.
+ doc = inspect.getdoc(getattr(maxis.Axis, method_name))
+ self._missing_subs = []
+ if doc:
+ doc_sub = {"this Axis": f"the {self.attr_name}", **(doc_sub or {})}
+ for k, v in doc_sub.items():
+ if k not in doc: # Delay raising error until we know qualname.
+ self._missing_subs.append(k)
+ doc = doc.replace(k, v)
+ self.__doc__ = doc
+
+ def __set_name__(self, owner, name):
+ # This is called at the end of the class body as
+ # ``self.__set_name__(cls, name_under_which_self_is_assigned)``; we
+ # rely on that to give the wrapper the correct __name__/__qualname__.
+ get_method = attrgetter(f"{self.attr_name}.{self.method_name}")
+
+ def wrapper(self, *args, **kwargs):
+ return get_method(self)(*args, **kwargs)
+
+ wrapper.__module__ = owner.__module__
+ wrapper.__name__ = name
+ wrapper.__qualname__ = f"{owner.__qualname__}.{name}"
+ wrapper.__doc__ = self.__doc__
+ # Manually copy the signature instead of using functools.wraps because
+ # displaying the Axis method source when asking for the Axes method
+ # source would be confusing.
+ wrapper.__signature__ = inspect.signature(
+ getattr(maxis.Axis, self.method_name))
+
+ if self._missing_subs:
+ raise ValueError(
+ "The definition of {} expected that the docstring of Axis.{} "
+ "contains {!r} as substrings".format(
+ wrapper.__qualname__, self.method_name,
+ ", ".join(map(repr, self._missing_subs))))
+
+ setattr(owner, name, wrapper)
+
+
+class _TransformedBoundsLocator:
+ """
+ Axes locator for `.Axes.inset_axes` and similarly positioned axes.
+
+ The locator is a callable object used in `.Axes.set_aspect` to compute the
+ axes location depending on the renderer.
+ """
+
+ def __init__(self, bounds, transform):
+ """
+ *bounds* (a ``[l, b, w, h]`` rectangle) and *transform* together
+ specify the position of the inset axes.
+ """
+ self._bounds = bounds
+ self._transform = transform
+
+ def __call__(self, ax, renderer):
+ # Subtracting transSubfigure will typically rely on inverted(),
+ # freezing the transform; thus, this needs to be delayed until draw
+ # time as transSubfigure may otherwise change after this is evaluated.
+ return mtransforms.TransformedBbox(
+ mtransforms.Bbox.from_bounds(*self._bounds),
+ self._transform - ax.figure.transSubfigure)
+
+
+def _process_plot_format(fmt):
+ """
+ Convert a MATLAB style color/line style format string to a (*linestyle*,
+ *marker*, *color*) tuple.
+
+ Example format strings include:
+
+ * 'ko': black circles
+ * '.b': blue dots
+ * 'r--': red dashed lines
+ * 'C2--': the third color in the color cycle, dashed lines
+
+ The format is absolute in the sense that if a linestyle or marker is not
+ defined in *fmt*, there is no line or marker. This is expressed by
+ returning 'None' for the respective quantity.
+
+ See Also
+ --------
+ matplotlib.Line2D.lineStyles, matplotlib.colors.cnames
+ All possible styles and color format strings.
+ """
+
+ linestyle = None
+ marker = None
+ color = None
+
+ # Is fmt just a colorspec?
+ try:
+ color = mcolors.to_rgba(fmt)
+
+ # We need to differentiate grayscale '1.0' from tri_down marker '1'
+ try:
+ fmtint = str(int(fmt))
+ except ValueError:
+ return linestyle, marker, color # Yes
+ else:
+ if fmt != fmtint:
+ # user definitely doesn't want tri_down marker
+ return linestyle, marker, color # Yes
+ else:
+ # ignore converted color
+ color = None
+ except ValueError:
+ pass # No, not just a color.
+
+ i = 0
+ while i < len(fmt):
+ c = fmt[i]
+ if fmt[i:i+2] in mlines.lineStyles: # First, the two-char styles.
+ if linestyle is not None:
+ raise ValueError(
+ 'Illegal format string "%s"; two linestyle symbols' % fmt)
+ linestyle = fmt[i:i+2]
+ i += 2
+ elif c in mlines.lineStyles:
+ if linestyle is not None:
+ raise ValueError(
+ 'Illegal format string "%s"; two linestyle symbols' % fmt)
+ linestyle = c
+ i += 1
+ elif c in mlines.lineMarkers:
+ if marker is not None:
+ raise ValueError(
+ 'Illegal format string "%s"; two marker symbols' % fmt)
+ marker = c
+ i += 1
+ elif c in mcolors.get_named_colors_mapping():
+ if color is not None:
+ raise ValueError(
+ 'Illegal format string "%s"; two color symbols' % fmt)
+ color = c
+ i += 1
+ elif c == 'C' and i < len(fmt) - 1:
+ color_cycle_number = int(fmt[i + 1])
+ color = mcolors.to_rgba("C{}".format(color_cycle_number))
+ i += 2
+ else:
+ raise ValueError(
+ 'Unrecognized character %c in format string' % c)
+
+ if linestyle is None and marker is None:
+ linestyle = mpl.rcParams['lines.linestyle']
+ if linestyle is None:
+ linestyle = 'None'
+ if marker is None:
+ marker = 'None'
+
+ return linestyle, marker, color
+
+
+class _process_plot_var_args:
+ """
+ Process variable length arguments to `~.Axes.plot`, to support ::
+
+ plot(t, s)
+ plot(t1, s1, t2, s2)
+ plot(t1, s1, 'ko', t2, s2)
+ plot(t1, s1, 'ko', t2, s2, 'r--', t3, e3)
+
+ an arbitrary number of *x*, *y*, *fmt* are allowed
+ """
+ def __init__(self, axes, command='plot'):
+ self.axes = axes
+ self.command = command
+ self.set_prop_cycle()
+
+ def __getstate__(self):
+ # note: it is not possible to pickle a generator (and thus a cycler).
+ return {'axes': self.axes, 'command': self.command}
+
+ def __setstate__(self, state):
+ self.__dict__ = state.copy()
+ self.set_prop_cycle()
+
+ def set_prop_cycle(self, *args, **kwargs):
+ # Can't do `args == (None,)` as that crashes cycler.
+ if not (args or kwargs) or (len(args) == 1 and args[0] is None):
+ prop_cycler = mpl.rcParams['axes.prop_cycle']
+ else:
+ prop_cycler = cycler(*args, **kwargs)
+
+ self.prop_cycler = itertools.cycle(prop_cycler)
+ # This should make a copy
+ self._prop_keys = prop_cycler.keys
+
+ def __call__(self, *args, data=None, **kwargs):
+ self.axes._process_unit_info(kwargs=kwargs)
+
+ for pos_only in "xy":
+ if pos_only in kwargs:
+ raise TypeError("{} got an unexpected keyword argument {!r}"
+ .format(self.command, pos_only))
+
+ if not args:
+ return
+
+ if data is None: # Process dict views
+ args = [cbook.sanitize_sequence(a) for a in args]
+ else: # Process the 'data' kwarg.
+ replaced = [mpl._replacer(data, arg) for arg in args]
+ if len(args) == 1:
+ label_namer_idx = 0
+ elif len(args) == 2: # Can be x, y or y, c.
+ # Figure out what the second argument is.
+ # 1) If the second argument cannot be a format shorthand, the
+ # second argument is the label_namer.
+ # 2) Otherwise (it could have been a format shorthand),
+ # a) if we did perform a substitution, emit a warning, and
+ # use it as label_namer.
+ # b) otherwise, it is indeed a format shorthand; use the
+ # first argument as label_namer.
+ try:
+ _process_plot_format(args[1])
+ except ValueError: # case 1)
+ label_namer_idx = 1
+ else:
+ if replaced[1] is not args[1]: # case 2a)
+ _api.warn_external(
+ f"Second argument {args[1]!r} is ambiguous: could "
+ f"be a format string but is in 'data'; using as "
+ f"data. If it was intended as data, set the "
+ f"format string to an empty string to suppress "
+ f"this warning. If it was intended as a format "
+ f"string, explicitly pass the x-values as well. "
+ f"Alternatively, rename the entry in 'data'.",
+ RuntimeWarning)
+ label_namer_idx = 1
+ else: # case 2b)
+ label_namer_idx = 0
+ elif len(args) == 3:
+ label_namer_idx = 1
+ else:
+ raise ValueError(
+ "Using arbitrary long args with data is not supported due "
+ "to ambiguity of arguments; use multiple plotting calls "
+ "instead")
+ if kwargs.get("label") is None:
+ kwargs["label"] = mpl._label_from_arg(
+ replaced[label_namer_idx], args[label_namer_idx])
+ args = replaced
+
+ if len(args) >= 4 and not cbook.is_scalar_or_string(
+ kwargs.get("label")):
+ raise ValueError("plot() with multiple groups of data (i.e., "
+ "pairs of x and y) does not support multiple "
+ "labels")
+
+ # Repeatedly grab (x, y) or (x, y, format) from the front of args and
+ # massage them into arguments to plot() or fill().
+
+ while args:
+ this, args = args[:2], args[2:]
+ if args and isinstance(args[0], str):
+ this += args[0],
+ args = args[1:]
+ yield from self._plot_args(this, kwargs)
+
+ def get_next_color(self):
+ """Return the next color in the cycle."""
+ if 'color' not in self._prop_keys:
+ return 'k'
+ return next(self.prop_cycler)['color']
+
+ def _getdefaults(self, ignore, kw):
+ """
+ If some keys in the property cycle (excluding those in the set
+ *ignore*) are absent or set to None in the dict *kw*, return a copy
+ of the next entry in the property cycle, excluding keys in *ignore*.
+ Otherwise, don't advance the property cycle, and return an empty dict.
+ """
+ prop_keys = self._prop_keys - ignore
+ if any(kw.get(k, None) is None for k in prop_keys):
+ # Need to copy this dictionary or else the next time around
+ # in the cycle, the dictionary could be missing entries.
+ default_dict = next(self.prop_cycler).copy()
+ for p in ignore:
+ default_dict.pop(p, None)
+ else:
+ default_dict = {}
+ return default_dict
+
+ def _setdefaults(self, defaults, kw):
+ """
+ Add to the dict *kw* the entries in the dict *default* that are absent
+ or set to None in *kw*.
+ """
+ for k in defaults:
+ if kw.get(k, None) is None:
+ kw[k] = defaults[k]
+
+ def _makeline(self, x, y, kw, kwargs):
+ kw = {**kw, **kwargs} # Don't modify the original kw.
+ default_dict = self._getdefaults(set(), kw)
+ self._setdefaults(default_dict, kw)
+ seg = mlines.Line2D(x, y, **kw)
+ return seg, kw
+
+ def _makefill(self, x, y, kw, kwargs):
+ # Polygon doesn't directly support unitized inputs.
+ x = self.axes.convert_xunits(x)
+ y = self.axes.convert_yunits(y)
+
+ kw = kw.copy() # Don't modify the original kw.
+ kwargs = kwargs.copy()
+
+ # Ignore 'marker'-related properties as they aren't Polygon
+ # properties, but they are Line2D properties, and so they are
+ # likely to appear in the default cycler construction.
+ # This is done here to the defaults dictionary as opposed to the
+ # other two dictionaries because we do want to capture when a
+ # *user* explicitly specifies a marker which should be an error.
+ # We also want to prevent advancing the cycler if there are no
+ # defaults needed after ignoring the given properties.
+ ignores = {'marker', 'markersize', 'markeredgecolor',
+ 'markerfacecolor', 'markeredgewidth'}
+ # Also ignore anything provided by *kwargs*.
+ for k, v in kwargs.items():
+ if v is not None:
+ ignores.add(k)
+
+ # Only using the first dictionary to use as basis
+ # for getting defaults for back-compat reasons.
+ # Doing it with both seems to mess things up in
+ # various places (probably due to logic bugs elsewhere).
+ default_dict = self._getdefaults(ignores, kw)
+ self._setdefaults(default_dict, kw)
+
+ # Looks like we don't want "color" to be interpreted to
+ # mean both facecolor and edgecolor for some reason.
+ # So the "kw" dictionary is thrown out, and only its
+ # 'color' value is kept and translated as a 'facecolor'.
+ # This design should probably be revisited as it increases
+ # complexity.
+ facecolor = kw.get('color', None)
+
+ # Throw out 'color' as it is now handled as a facecolor
+ default_dict.pop('color', None)
+
+ # To get other properties set from the cycler
+ # modify the kwargs dictionary.
+ self._setdefaults(default_dict, kwargs)
+
+ seg = mpatches.Polygon(np.column_stack((x, y)),
+ facecolor=facecolor,
+ fill=kwargs.get('fill', True),
+ closed=kw['closed'])
+ seg.set(**kwargs)
+ return seg, kwargs
+
+ def _plot_args(self, tup, kwargs, return_kwargs=False):
+ """
+ Process the arguments of ``plot([x], y, [fmt], **kwargs)`` calls.
+
+ This processes a single set of ([x], y, [fmt]) parameters; i.e. for
+ ``plot(x, y, x2, y2)`` it will be called twice. Once for (x, y) and
+ once for (x2, y2).
+
+ x and y may be 2D and thus can still represent multiple datasets.
+
+ For multiple datasets, if the keyword argument *label* is a list, this
+ will unpack the list and assign the individual labels to the datasets.
+
+ Parameters
+ ----------
+ tup : tuple
+ A tuple of the positional parameters. This can be one of
+
+ - (y,)
+ - (x, y)
+ - (y, fmt)
+ - (x, y, fmt)
+
+ kwargs : dict
+ The keyword arguments passed to ``plot()``.
+
+ return_kwargs : bool
+ If true, return the effective keyword arguments after label
+ unpacking as well.
+
+ Returns
+ -------
+ result
+ If *return_kwargs* is false, a list of Artists representing the
+ dataset(s).
+ If *return_kwargs* is true, a list of (Artist, effective_kwargs)
+ representing the dataset(s). See *return_kwargs*.
+ The Artist is either `.Line2D` (if called from ``plot()``) or
+ `.Polygon` otherwise.
+ """
+ if len(tup) > 1 and isinstance(tup[-1], str):
+ # xy is tup with fmt stripped (could still be (y,) only)
+ *xy, fmt = tup
+ linestyle, marker, color = _process_plot_format(fmt)
+ elif len(tup) == 3:
+ raise ValueError('third arg must be a format string')
+ else:
+ xy = tup
+ linestyle, marker, color = None, None, None
+
+ # Don't allow any None value; these would be up-converted to one
+ # element array of None which causes problems downstream.
+ if any(v is None for v in tup):
+ raise ValueError("x, y, and format string must not be None")
+
+ kw = {}
+ for prop_name, val in zip(('linestyle', 'marker', 'color'),
+ (linestyle, marker, color)):
+ if val is not None:
+ # check for conflicts between fmt and kwargs
+ if (fmt.lower() != 'none'
+ and prop_name in kwargs
+ and val != 'None'):
+ # Technically ``plot(x, y, 'o', ls='--')`` is a conflict
+ # because 'o' implicitly unsets the linestyle
+ # (linestyle='None').
+ # We'll gracefully not warn in this case because an
+ # explicit set via kwargs can be seen as intention to
+ # override an implicit unset.
+ # Note: We don't val.lower() != 'none' because val is not
+ # necessarily a string (can be a tuple for colors). This
+ # is safe, because *val* comes from _process_plot_format()
+ # which only returns 'None'.
+ _api.warn_external(
+ f"{prop_name} is redundantly defined by the "
+ f"'{prop_name}' keyword argument and the fmt string "
+ f'"{fmt}" (-> {prop_name}={val!r}). The keyword '
+ f"argument will take precedence.")
+ kw[prop_name] = val
+
+ if len(xy) == 2:
+ x = _check_1d(xy[0])
+ y = _check_1d(xy[1])
+ else:
+ x, y = index_of(xy[-1])
+
+ if self.axes.xaxis is not None:
+ self.axes.xaxis.update_units(x)
+ if self.axes.yaxis is not None:
+ self.axes.yaxis.update_units(y)
+
+ if x.shape[0] != y.shape[0]:
+ raise ValueError(f"x and y must have same first dimension, but "
+ f"have shapes {x.shape} and {y.shape}")
+ if x.ndim > 2 or y.ndim > 2:
+ raise ValueError(f"x and y can be no greater than 2D, but have "
+ f"shapes {x.shape} and {y.shape}")
+ if x.ndim == 1:
+ x = x[:, np.newaxis]
+ if y.ndim == 1:
+ y = y[:, np.newaxis]
+
+ if self.command == 'plot':
+ make_artist = self._makeline
+ else:
+ kw['closed'] = kwargs.get('closed', True)
+ make_artist = self._makefill
+
+ ncx, ncy = x.shape[1], y.shape[1]
+ if ncx > 1 and ncy > 1 and ncx != ncy:
+ raise ValueError(f"x has {ncx} columns but y has {ncy} columns")
+
+ label = kwargs.get('label')
+ n_datasets = max(ncx, ncy)
+ if n_datasets > 1 and not cbook.is_scalar_or_string(label):
+ if len(label) != n_datasets:
+ raise ValueError(f"label must be scalar or have the same "
+ f"length as the input data, but found "
+ f"{len(label)} for {n_datasets} datasets.")
+ labels = label
+ else:
+ labels = [label] * n_datasets
+
+ result = (make_artist(x[:, j % ncx], y[:, j % ncy], kw,
+ {**kwargs, 'label': label})
+ for j, label in enumerate(labels))
+
+ if return_kwargs:
+ return list(result)
+ else:
+ return [l[0] for l in result]
+
+
+@cbook._define_aliases({"facecolor": ["fc"]})
+class _AxesBase(martist.Artist):
+ name = "rectilinear"
+
+ _shared_x_axes = cbook.Grouper()
+ _shared_y_axes = cbook.Grouper()
+ _twinned_axes = cbook.Grouper()
+
+ def __str__(self):
+ return "{0}({1[0]:g},{1[1]:g};{1[2]:g}x{1[3]:g})".format(
+ type(self).__name__, self._position.bounds)
+
+ @_api.make_keyword_only("3.4", "facecolor")
+ def __init__(self, fig, rect,
+ facecolor=None, # defaults to rc axes.facecolor
+ frameon=True,
+ sharex=None, # use Axes instance's xaxis info
+ sharey=None, # use Axes instance's yaxis info
+ label='',
+ xscale=None,
+ yscale=None,
+ box_aspect=None,
+ **kwargs
+ ):
+ """
+ Build an axes in a figure.
+
+ Parameters
+ ----------
+ fig : `~matplotlib.figure.Figure`
+ The axes is build in the `.Figure` *fig*.
+
+ rect : [left, bottom, width, height]
+ The axes is build in the rectangle *rect*. *rect* is in
+ `.Figure` coordinates.
+
+ sharex, sharey : `~.axes.Axes`, optional
+ The x or y `~.matplotlib.axis` is shared with the x or
+ y axis in the input `~.axes.Axes`.
+
+ frameon : bool, default: True
+ Whether the axes frame is visible.
+
+ box_aspect : float, optional
+ Set a fixed aspect for the axes box, i.e. the ratio of height to
+ width. See `~.axes.Axes.set_box_aspect` for details.
+
+ **kwargs
+ Other optional keyword arguments:
+
+ %(Axes_kwdoc)s
+
+ Returns
+ -------
+ `~.axes.Axes`
+ The new `~.axes.Axes` object.
+ """
+
+ super().__init__()
+ if isinstance(rect, mtransforms.Bbox):
+ self._position = rect
+ else:
+ self._position = mtransforms.Bbox.from_bounds(*rect)
+ if self._position.width < 0 or self._position.height < 0:
+ raise ValueError('Width and height specified must be non-negative')
+ self._originalPosition = self._position.frozen()
+ self.axes = self
+ self._aspect = 'auto'
+ self._adjustable = 'box'
+ self._anchor = 'C'
+ self._stale_viewlim_x = False
+ self._stale_viewlim_y = False
+ self._sharex = sharex
+ self._sharey = sharey
+ self.set_label(label)
+ self.set_figure(fig)
+ self.set_box_aspect(box_aspect)
+ self._axes_locator = None # Optionally set via update(kwargs).
+ # placeholder for any colorbars added that use this axes.
+ # (see colorbar.py):
+ self._colorbars = []
+ self.spines = mspines.Spines.from_dict(self._gen_axes_spines())
+
+ # this call may differ for non-sep axes, e.g., polar
+ self._init_axis()
+ if facecolor is None:
+ facecolor = mpl.rcParams['axes.facecolor']
+ self._facecolor = facecolor
+ self._frameon = frameon
+ self.set_axisbelow(mpl.rcParams['axes.axisbelow'])
+
+ self._rasterization_zorder = None
+ self.cla()
+
+ # funcs used to format x and y - fall back on major formatters
+ self.fmt_xdata = None
+ self.fmt_ydata = None
+
+ self.set_navigate(True)
+ self.set_navigate_mode(None)
+
+ if xscale:
+ self.set_xscale(xscale)
+ if yscale:
+ self.set_yscale(yscale)
+
+ self.update(kwargs)
+
+ for name, axis in self._get_axis_map().items():
+ axis.callbacks._pickled_cids.add(
+ axis.callbacks.connect(
+ 'units finalize', self._unit_change_handler(name)))
+
+ rcParams = mpl.rcParams
+ self.tick_params(
+ top=rcParams['xtick.top'] and rcParams['xtick.minor.top'],
+ bottom=rcParams['xtick.bottom'] and rcParams['xtick.minor.bottom'],
+ labeltop=(rcParams['xtick.labeltop'] and
+ rcParams['xtick.minor.top']),
+ labelbottom=(rcParams['xtick.labelbottom'] and
+ rcParams['xtick.minor.bottom']),
+ left=rcParams['ytick.left'] and rcParams['ytick.minor.left'],
+ right=rcParams['ytick.right'] and rcParams['ytick.minor.right'],
+ labelleft=(rcParams['ytick.labelleft'] and
+ rcParams['ytick.minor.left']),
+ labelright=(rcParams['ytick.labelright'] and
+ rcParams['ytick.minor.right']),
+ which='minor')
+
+ self.tick_params(
+ top=rcParams['xtick.top'] and rcParams['xtick.major.top'],
+ bottom=rcParams['xtick.bottom'] and rcParams['xtick.major.bottom'],
+ labeltop=(rcParams['xtick.labeltop'] and
+ rcParams['xtick.major.top']),
+ labelbottom=(rcParams['xtick.labelbottom'] and
+ rcParams['xtick.major.bottom']),
+ left=rcParams['ytick.left'] and rcParams['ytick.major.left'],
+ right=rcParams['ytick.right'] and rcParams['ytick.major.right'],
+ labelleft=(rcParams['ytick.labelleft'] and
+ rcParams['ytick.major.left']),
+ labelright=(rcParams['ytick.labelright'] and
+ rcParams['ytick.major.right']),
+ which='major')
+
+ def __getstate__(self):
+ # The renderer should be re-created by the figure, and then cached at
+ # that point.
+ state = super().__getstate__()
+ # Prune the sharing & twinning info to only contain the current group.
+ for grouper_name in [
+ '_shared_x_axes', '_shared_y_axes', '_twinned_axes']:
+ grouper = getattr(self, grouper_name)
+ state[grouper_name] = (grouper.get_siblings(self)
+ if self in grouper else None)
+ return state
+
+ def __setstate__(self, state):
+ # Merge the grouping info back into the global groupers.
+ for grouper_name in [
+ '_shared_x_axes', '_shared_y_axes', '_twinned_axes']:
+ siblings = state.pop(grouper_name)
+ if siblings:
+ getattr(self, grouper_name).join(*siblings)
+ self.__dict__ = state
+ self._stale = True
+
+ def __repr__(self):
+ fields = []
+ if self.get_label():
+ fields += [f"label={self.get_label()!r}"]
+ titles = []
+ for k in ["left", "center", "right"]:
+ title = self.get_title(loc=k)
+ if title:
+ titles.append(f"{k!r}:{title!r}")
+ if titles:
+ fields += ["title={" + ",".join(titles) + "}"]
+ if self.get_xlabel():
+ fields += [f"xlabel={self.get_xlabel()!r}"]
+ if self.get_ylabel():
+ fields += [f"ylabel={self.get_ylabel()!r}"]
+ return f"<{self.__class__.__name__}:" + ", ".join(fields) + ">"
+
+ def get_window_extent(self, *args, **kwargs):
+ """
+ Return the axes bounding box in display space; *args* and *kwargs*
+ are empty.
+
+ This bounding box does not include the spines, ticks, ticklables,
+ or other labels. For a bounding box including these elements use
+ `~matplotlib.axes.Axes.get_tightbbox`.
+
+ See Also
+ --------
+ matplotlib.axes.Axes.get_tightbbox
+ matplotlib.axis.Axis.get_tightbbox
+ matplotlib.spines.Spine.get_window_extent
+ """
+ return self.bbox
+
+ def _init_axis(self):
+ # This is moved out of __init__ because non-separable axes don't use it
+ self.xaxis = maxis.XAxis(self)
+ self.spines.bottom.register_axis(self.xaxis)
+ self.spines.top.register_axis(self.xaxis)
+ self.yaxis = maxis.YAxis(self)
+ self.spines.left.register_axis(self.yaxis)
+ self.spines.right.register_axis(self.yaxis)
+ self._update_transScale()
+
+ def set_figure(self, fig):
+ # docstring inherited
+ super().set_figure(fig)
+
+ self.bbox = mtransforms.TransformedBbox(self._position,
+ fig.transSubfigure)
+ # these will be updated later as data is added
+ self.dataLim = mtransforms.Bbox.null()
+ self._viewLim = mtransforms.Bbox.unit()
+ self.transScale = mtransforms.TransformWrapper(
+ mtransforms.IdentityTransform())
+
+ self._set_lim_and_transforms()
+
+ def _unstale_viewLim(self):
+ # We should arrange to store this information once per share-group
+ # instead of on every axis.
+ scalex = any(ax._stale_viewlim_x
+ for ax in self._shared_x_axes.get_siblings(self))
+ scaley = any(ax._stale_viewlim_y
+ for ax in self._shared_y_axes.get_siblings(self))
+ if scalex or scaley:
+ for ax in self._shared_x_axes.get_siblings(self):
+ ax._stale_viewlim_x = False
+ for ax in self._shared_y_axes.get_siblings(self):
+ ax._stale_viewlim_y = False
+ self.autoscale_view(scalex=scalex, scaley=scaley)
+
+ @property
+ def viewLim(self):
+ self._unstale_viewLim()
+ return self._viewLim
+
+ # API could be better, right now this is just to match the old calls to
+ # autoscale_view() after each plotting method.
+ def _request_autoscale_view(self, tight=None, scalex=True, scaley=True):
+ if tight is not None:
+ self._tight = tight
+ if scalex:
+ self._stale_viewlim_x = True # Else keep old state.
+ if scaley:
+ self._stale_viewlim_y = True
+
+ def _set_lim_and_transforms(self):
+ """
+ Set the *_xaxis_transform*, *_yaxis_transform*, *transScale*,
+ *transData*, *transLimits* and *transAxes* transformations.
+
+ .. note::
+
+ This method is primarily used by rectilinear projections of the
+ `~matplotlib.axes.Axes` class, and is meant to be overridden by
+ new kinds of projection axes that need different transformations
+ and limits. (See `~matplotlib.projections.polar.PolarAxes` for an
+ example.)
+ """
+ self.transAxes = mtransforms.BboxTransformTo(self.bbox)
+
+ # Transforms the x and y axis separately by a scale factor.
+ # It is assumed that this part will have non-linear components
+ # (e.g., for a log scale).
+ self.transScale = mtransforms.TransformWrapper(
+ mtransforms.IdentityTransform())
+
+ # An affine transformation on the data, generally to limit the
+ # range of the axes
+ self.transLimits = mtransforms.BboxTransformFrom(
+ mtransforms.TransformedBbox(self._viewLim, self.transScale))
+
+ # The parentheses are important for efficiency here -- they
+ # group the last two (which are usually affines) separately
+ # from the first (which, with log-scaling can be non-affine).
+ self.transData = self.transScale + (self.transLimits + self.transAxes)
+
+ self._xaxis_transform = mtransforms.blended_transform_factory(
+ self.transData, self.transAxes)
+ self._yaxis_transform = mtransforms.blended_transform_factory(
+ self.transAxes, self.transData)
+
+ def get_xaxis_transform(self, which='grid'):
+ """
+ Get the transformation used for drawing x-axis labels, ticks
+ and gridlines. The x-direction is in data coordinates and the
+ y-direction is in axis coordinates.
+
+ .. note::
+
+ This transformation is primarily used by the
+ `~matplotlib.axis.Axis` class, and is meant to be
+ overridden by new kinds of projections that may need to
+ place axis elements in different locations.
+ """
+ if which == 'grid':
+ return self._xaxis_transform
+ elif which == 'tick1':
+ # for cartesian projection, this is bottom spine
+ return self.spines.bottom.get_spine_transform()
+ elif which == 'tick2':
+ # for cartesian projection, this is top spine
+ return self.spines.top.get_spine_transform()
+ else:
+ raise ValueError('unknown value for which')
+
+ def get_xaxis_text1_transform(self, pad_points):
+ """
+ Returns
+ -------
+ transform : Transform
+ The transform used for drawing x-axis labels, which will add
+ *pad_points* of padding (in points) between the axes and the label.
+ The x-direction is in data coordinates and the y-direction is in
+ axis coordinates
+ valign : {'center', 'top', 'bottom', 'baseline', 'center_baseline'}
+ The text vertical alignment.
+ halign : {'center', 'left', 'right'}
+ The text horizontal alignment.
+
+ Notes
+ -----
+ This transformation is primarily used by the `~matplotlib.axis.Axis`
+ class, and is meant to be overridden by new kinds of projections that
+ may need to place axis elements in different locations.
+ """
+ labels_align = mpl.rcParams["xtick.alignment"]
+ return (self.get_xaxis_transform(which='tick1') +
+ mtransforms.ScaledTranslation(0, -1 * pad_points / 72,
+ self.figure.dpi_scale_trans),
+ "top", labels_align)
+
+ def get_xaxis_text2_transform(self, pad_points):
+ """
+ Returns
+ -------
+ transform : Transform
+ The transform used for drawing secondary x-axis labels, which will
+ add *pad_points* of padding (in points) between the axes and the
+ label. The x-direction is in data coordinates and the y-direction
+ is in axis coordinates
+ valign : {'center', 'top', 'bottom', 'baseline', 'center_baseline'}
+ The text vertical alignment.
+ halign : {'center', 'left', 'right'}
+ The text horizontal alignment.
+
+ Notes
+ -----
+ This transformation is primarily used by the `~matplotlib.axis.Axis`
+ class, and is meant to be overridden by new kinds of projections that
+ may need to place axis elements in different locations.
+ """
+ labels_align = mpl.rcParams["xtick.alignment"]
+ return (self.get_xaxis_transform(which='tick2') +
+ mtransforms.ScaledTranslation(0, pad_points / 72,
+ self.figure.dpi_scale_trans),
+ "bottom", labels_align)
+
+ def get_yaxis_transform(self, which='grid'):
+ """
+ Get the transformation used for drawing y-axis labels, ticks
+ and gridlines. The x-direction is in axis coordinates and the
+ y-direction is in data coordinates.
+
+ .. note::
+
+ This transformation is primarily used by the
+ `~matplotlib.axis.Axis` class, and is meant to be
+ overridden by new kinds of projections that may need to
+ place axis elements in different locations.
+ """
+ if which == 'grid':
+ return self._yaxis_transform
+ elif which == 'tick1':
+ # for cartesian projection, this is bottom spine
+ return self.spines.left.get_spine_transform()
+ elif which == 'tick2':
+ # for cartesian projection, this is top spine
+ return self.spines.right.get_spine_transform()
+ else:
+ raise ValueError('unknown value for which')
+
+ def get_yaxis_text1_transform(self, pad_points):
+ """
+ Returns
+ -------
+ transform : Transform
+ The transform used for drawing y-axis labels, which will add
+ *pad_points* of padding (in points) between the axes and the label.
+ The x-direction is in axis coordinates and the y-direction is in
+ data coordinates
+ valign : {'center', 'top', 'bottom', 'baseline', 'center_baseline'}
+ The text vertical alignment.
+ halign : {'center', 'left', 'right'}
+ The text horizontal alignment.
+
+ Notes
+ -----
+ This transformation is primarily used by the `~matplotlib.axis.Axis`
+ class, and is meant to be overridden by new kinds of projections that
+ may need to place axis elements in different locations.
+ """
+ labels_align = mpl.rcParams["ytick.alignment"]
+ return (self.get_yaxis_transform(which='tick1') +
+ mtransforms.ScaledTranslation(-1 * pad_points / 72, 0,
+ self.figure.dpi_scale_trans),
+ labels_align, "right")
+
+ def get_yaxis_text2_transform(self, pad_points):
+ """
+ Returns
+ -------
+ transform : Transform
+ The transform used for drawing secondart y-axis labels, which will
+ add *pad_points* of padding (in points) between the axes and the
+ label. The x-direction is in axis coordinates and the y-direction
+ is in data coordinates
+ valign : {'center', 'top', 'bottom', 'baseline', 'center_baseline'}
+ The text vertical alignment.
+ halign : {'center', 'left', 'right'}
+ The text horizontal alignment.
+
+ Notes
+ -----
+ This transformation is primarily used by the `~matplotlib.axis.Axis`
+ class, and is meant to be overridden by new kinds of projections that
+ may need to place axis elements in different locations.
+ """
+ labels_align = mpl.rcParams["ytick.alignment"]
+ return (self.get_yaxis_transform(which='tick2') +
+ mtransforms.ScaledTranslation(pad_points / 72, 0,
+ self.figure.dpi_scale_trans),
+ labels_align, "left")
+
+ def _update_transScale(self):
+ self.transScale.set(
+ mtransforms.blended_transform_factory(
+ self.xaxis.get_transform(), self.yaxis.get_transform()))
+ for line in getattr(self, "lines", []): # Not set during init.
+ try:
+ line._transformed_path.invalidate()
+ except AttributeError:
+ pass
+
+ def get_position(self, original=False):
+ """
+ Get a copy of the axes rectangle as a `.Bbox`.
+
+ Parameters
+ ----------
+ original : bool
+ If ``True``, return the original position. Otherwise return the
+ active position. For an explanation of the positions see
+ `.set_position`.
+
+ Returns
+ -------
+ `.Bbox`
+
+ """
+ if original:
+ return self._originalPosition.frozen()
+ else:
+ locator = self.get_axes_locator()
+ if not locator:
+ self.apply_aspect()
+ return self._position.frozen()
+
+ def set_position(self, pos, which='both'):
+ """
+ Set the axes position.
+
+ Axes have two position attributes. The 'original' position is the
+ position allocated for the Axes. The 'active' position is the
+ position the Axes is actually drawn at. These positions are usually
+ the same unless a fixed aspect is set to the Axes. See
+ `.Axes.set_aspect` for details.
+
+ Parameters
+ ----------
+ pos : [left, bottom, width, height] or `~matplotlib.transforms.Bbox`
+ The new position of the in `.Figure` coordinates.
+
+ which : {'both', 'active', 'original'}, default: 'both'
+ Determines which position variables to change.
+
+ See Also
+ --------
+ matplotlib.transforms.Bbox.from_bounds
+ matplotlib.transforms.Bbox.from_extents
+ """
+ self._set_position(pos, which=which)
+ # because this is being called externally to the library we
+ # don't let it be in the layout.
+ self.set_in_layout(False)
+
+ def _set_position(self, pos, which='both'):
+ """
+ Private version of set_position.
+
+ Call this internally to get the same functionality of `get_position`,
+ but not to take the axis out of the constrained_layout hierarchy.
+ """
+ if not isinstance(pos, mtransforms.BboxBase):
+ pos = mtransforms.Bbox.from_bounds(*pos)
+ for ax in self._twinned_axes.get_siblings(self):
+ if which in ('both', 'active'):
+ ax._position.set(pos)
+ if which in ('both', 'original'):
+ ax._originalPosition.set(pos)
+ self.stale = True
+
+ def reset_position(self):
+ """
+ Reset the active position to the original position.
+
+ This resets the a possible position change due to aspect constraints.
+ For an explanation of the positions see `.set_position`.
+ """
+ for ax in self._twinned_axes.get_siblings(self):
+ pos = ax.get_position(original=True)
+ ax.set_position(pos, which='active')
+
+ def set_axes_locator(self, locator):
+ """
+ Set the axes locator.
+
+ Parameters
+ ----------
+ locator : Callable[[Axes, Renderer], Bbox]
+ """
+ self._axes_locator = locator
+ self.stale = True
+
+ def get_axes_locator(self):
+ """
+ Return the axes_locator.
+ """
+ return self._axes_locator
+
+ def _set_artist_props(self, a):
+ """Set the boilerplate props for artists added to axes."""
+ a.set_figure(self.figure)
+ if not a.is_transform_set():
+ a.set_transform(self.transData)
+
+ a.axes = self
+ if a.mouseover:
+ self._mouseover_set.add(a)
+
+ def _gen_axes_patch(self):
+ """
+ Returns
+ -------
+ Patch
+ The patch used to draw the background of the axes. It is also used
+ as the clipping path for any data elements on the axes.
+
+ In the standard axes, this is a rectangle, but in other projections
+ it may not be.
+
+ Notes
+ -----
+ Intended to be overridden by new projection types.
+ """
+ return mpatches.Rectangle((0.0, 0.0), 1.0, 1.0)
+
+ def _gen_axes_spines(self, locations=None, offset=0.0, units='inches'):
+ """
+ Returns
+ -------
+ dict
+ Mapping of spine names to `.Line2D` or `.Patch` instances that are
+ used to draw axes spines.
+
+ In the standard axes, spines are single line segments, but in other
+ projections they may not be.
+
+ Notes
+ -----
+ Intended to be overridden by new projection types.
+ """
+ return OrderedDict((side, mspines.Spine.linear_spine(self, side))
+ for side in ['left', 'right', 'bottom', 'top'])
+
+ def sharex(self, other):
+ """
+ Share the x-axis with *other*.
+
+ This is equivalent to passing ``sharex=other`` when constructing the
+ axes, and cannot be used if the x-axis is already being shared with
+ another axes.
+ """
+ _api.check_isinstance(_AxesBase, other=other)
+ if self._sharex is not None and other is not self._sharex:
+ raise ValueError("x-axis is already shared")
+ self._shared_x_axes.join(self, other)
+ self._sharex = other
+ self.xaxis.major = other.xaxis.major # Ticker instances holding
+ self.xaxis.minor = other.xaxis.minor # locator and formatter.
+ x0, x1 = other.get_xlim()
+ self.set_xlim(x0, x1, emit=False, auto=other.get_autoscalex_on())
+ self.xaxis._scale = other.xaxis._scale
+
+ def sharey(self, other):
+ """
+ Share the y-axis with *other*.
+
+ This is equivalent to passing ``sharey=other`` when constructing the
+ axes, and cannot be used if the y-axis is already being shared with
+ another axes.
+ """
+ _api.check_isinstance(_AxesBase, other=other)
+ if self._sharey is not None and other is not self._sharey:
+ raise ValueError("y-axis is already shared")
+ self._shared_y_axes.join(self, other)
+ self._sharey = other
+ self.yaxis.major = other.yaxis.major # Ticker instances holding
+ self.yaxis.minor = other.yaxis.minor # locator and formatter.
+ y0, y1 = other.get_ylim()
+ self.set_ylim(y0, y1, emit=False, auto=other.get_autoscaley_on())
+ self.yaxis._scale = other.yaxis._scale
+
+ def cla(self):
+ """Clear the axes."""
+ # Note: this is called by Axes.__init__()
+
+ # stash the current visibility state
+ if hasattr(self, 'patch'):
+ patch_visible = self.patch.get_visible()
+ else:
+ patch_visible = True
+
+ xaxis_visible = self.xaxis.get_visible()
+ yaxis_visible = self.yaxis.get_visible()
+
+ self.xaxis.clear()
+ self.yaxis.clear()
+
+ for name, spine in self.spines.items():
+ spine.clear()
+
+ self.ignore_existing_data_limits = True
+ self.callbacks = cbook.CallbackRegistry()
+
+ if self._sharex is not None:
+ self.sharex(self._sharex)
+ else:
+ self.xaxis._set_scale('linear')
+ try:
+ self.set_xlim(0, 1)
+ except TypeError:
+ pass
+ if self._sharey is not None:
+ self.sharey(self._sharey)
+ else:
+ self.yaxis._set_scale('linear')
+ try:
+ self.set_ylim(0, 1)
+ except TypeError:
+ pass
+
+ # update the minor locator for x and y axis based on rcParams
+ if mpl.rcParams['xtick.minor.visible']:
+ self.xaxis.set_minor_locator(mticker.AutoMinorLocator())
+ if mpl.rcParams['ytick.minor.visible']:
+ self.yaxis.set_minor_locator(mticker.AutoMinorLocator())
+
+ if self._sharex is None:
+ self._autoscaleXon = True
+ if self._sharey is None:
+ self._autoscaleYon = True
+ self._xmargin = mpl.rcParams['axes.xmargin']
+ self._ymargin = mpl.rcParams['axes.ymargin']
+ self._tight = None
+ self._use_sticky_edges = True
+ self._update_transScale() # needed?
+
+ self._get_lines = _process_plot_var_args(self)
+ self._get_patches_for_fill = _process_plot_var_args(self, 'fill')
+
+ self._gridOn = mpl.rcParams['axes.grid']
+ self.lines = []
+ self.patches = []
+ self.texts = []
+ self.tables = []
+ self.artists = []
+ self.images = []
+ self._mouseover_set = _OrderedSet()
+ self.child_axes = []
+ self._current_image = None # strictly for pyplot via _sci, _gci
+ self._projection_init = None # strictly for pyplot.subplot
+ self.legend_ = None
+ self.collections = [] # collection.Collection instances
+ self.containers = []
+
+ self.grid(False) # Disable grid on init to use rcParameter
+ self.grid(self._gridOn, which=mpl.rcParams['axes.grid.which'],
+ axis=mpl.rcParams['axes.grid.axis'])
+ props = font_manager.FontProperties(
+ size=mpl.rcParams['axes.titlesize'],
+ weight=mpl.rcParams['axes.titleweight'])
+
+ y = mpl.rcParams['axes.titley']
+ if y is None:
+ y = 1.0
+ self._autotitlepos = True
+ else:
+ self._autotitlepos = False
+
+ self.title = mtext.Text(
+ x=0.5, y=y, text='',
+ fontproperties=props,
+ verticalalignment='baseline',
+ horizontalalignment='center',
+ )
+ self._left_title = mtext.Text(
+ x=0.0, y=y, text='',
+ fontproperties=props.copy(),
+ verticalalignment='baseline',
+ horizontalalignment='left', )
+ self._right_title = mtext.Text(
+ x=1.0, y=y, text='',
+ fontproperties=props.copy(),
+ verticalalignment='baseline',
+ horizontalalignment='right',
+ )
+ title_offset_points = mpl.rcParams['axes.titlepad']
+ # refactor this out so it can be called in ax.set_title if
+ # pad argument used...
+ self._set_title_offset_trans(title_offset_points)
+
+ for _title in (self.title, self._left_title, self._right_title):
+ self._set_artist_props(_title)
+
+ # The patch draws the background of the axes. We want this to be below
+ # the other artists. We use the frame to draw the edges so we are
+ # setting the edgecolor to None.
+ self.patch = self._gen_axes_patch()
+ self.patch.set_figure(self.figure)
+ self.patch.set_facecolor(self._facecolor)
+ self.patch.set_edgecolor('None')
+ self.patch.set_linewidth(0)
+ self.patch.set_transform(self.transAxes)
+
+ self.set_axis_on()
+
+ self.xaxis.set_clip_path(self.patch)
+ self.yaxis.set_clip_path(self.patch)
+
+ self._shared_x_axes.clean()
+ self._shared_y_axes.clean()
+ if self._sharex is not None:
+ self.xaxis.set_visible(xaxis_visible)
+ self.patch.set_visible(patch_visible)
+ if self._sharey is not None:
+ self.yaxis.set_visible(yaxis_visible)
+ self.patch.set_visible(patch_visible)
+
+ self.stale = True
+
+ def clear(self):
+ """Clear the axes."""
+ self.cla()
+
+ def get_facecolor(self):
+ """Get the facecolor of the Axes."""
+ return self.patch.get_facecolor()
+
+ def set_facecolor(self, color):
+ """
+ Set the facecolor of the Axes.
+
+ Parameters
+ ----------
+ color : color
+ """
+ self._facecolor = color
+ self.stale = True
+ return self.patch.set_facecolor(color)
+
+ def _set_title_offset_trans(self, title_offset_points):
+ """
+ Set the offset for the title either from :rc:`axes.titlepad`
+ or from set_title kwarg ``pad``.
+ """
+ self.titleOffsetTrans = mtransforms.ScaledTranslation(
+ 0.0, title_offset_points / 72,
+ self.figure.dpi_scale_trans)
+ for _title in (self.title, self._left_title, self._right_title):
+ _title.set_transform(self.transAxes + self.titleOffsetTrans)
+ _title.set_clip_box(None)
+
+ def set_prop_cycle(self, *args, **kwargs):
+ """
+ Set the property cycle of the Axes.
+
+ The property cycle controls the style properties such as color,
+ marker and linestyle of future plot commands. The style properties
+ of data already added to the Axes are not modified.
+
+ Call signatures::
+
+ set_prop_cycle(cycler)
+ set_prop_cycle(label=values[, label2=values2[, ...]])
+ set_prop_cycle(label, values)
+
+ Form 1 sets given `~cycler.Cycler` object.
+
+ Form 2 creates a `~cycler.Cycler` which cycles over one or more
+ properties simultaneously and set it as the property cycle of the
+ axes. If multiple properties are given, their value lists must have
+ the same length. This is just a shortcut for explicitly creating a
+ cycler and passing it to the function, i.e. it's short for
+ ``set_prop_cycle(cycler(label=values label2=values2, ...))``.
+
+ Form 3 creates a `~cycler.Cycler` for a single property and set it
+ as the property cycle of the axes. This form exists for compatibility
+ with the original `cycler.cycler` interface. Its use is discouraged
+ in favor of the kwarg form, i.e. ``set_prop_cycle(label=values)``.
+
+ Parameters
+ ----------
+ cycler : Cycler
+ Set the given Cycler. *None* resets to the cycle defined by the
+ current style.
+
+ label : str
+ The property key. Must be a valid `.Artist` property.
+ For example, 'color' or 'linestyle'. Aliases are allowed,
+ such as 'c' for 'color' and 'lw' for 'linewidth'.
+
+ values : iterable
+ Finite-length iterable of the property values. These values
+ are validated and will raise a ValueError if invalid.
+
+ See Also
+ --------
+ matplotlib.rcsetup.cycler
+ Convenience function for creating validated cyclers for properties.
+ cycler.cycler
+ The original function for creating unvalidated cyclers.
+
+ Examples
+ --------
+ Setting the property cycle for a single property:
+
+ >>> ax.set_prop_cycle(color=['red', 'green', 'blue'])
+
+ Setting the property cycle for simultaneously cycling over multiple
+ properties (e.g. red circle, green plus, blue cross):
+
+ >>> ax.set_prop_cycle(color=['red', 'green', 'blue'],
+ ... marker=['o', '+', 'x'])
+
+ """
+ if args and kwargs:
+ raise TypeError("Cannot supply both positional and keyword "
+ "arguments to this method.")
+ # Can't do `args == (None,)` as that crashes cycler.
+ if len(args) == 1 and args[0] is None:
+ prop_cycle = None
+ else:
+ prop_cycle = cycler(*args, **kwargs)
+ self._get_lines.set_prop_cycle(prop_cycle)
+ self._get_patches_for_fill.set_prop_cycle(prop_cycle)
+
+ def get_aspect(self):
+ return self._aspect
+
+ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
+ """
+ Set the aspect of the axis scaling, i.e. the ratio of y-unit to x-unit.
+
+ Parameters
+ ----------
+ aspect : {'auto', 'equal'} or float
+ Possible values:
+
+ - 'auto': fill the position rectangle with data.
+ - 'equal': same as ``aspect=1``, i.e. same scaling for x and y.
+ - *float*: A circle will be stretched such that the height
+ is *float* times the width.
+
+ adjustable : None or {'box', 'datalim'}, optional
+ If not ``None``, this defines which parameter will be adjusted to
+ meet the required aspect. See `.set_adjustable` for further
+ details.
+
+ anchor : None or str or (float, float), optional
+ If not ``None``, this defines where the Axes will be drawn if there
+ is extra space due to aspect constraints. The most common way to
+ to specify the anchor are abbreviations of cardinal directions:
+
+ ===== =====================
+ value description
+ ===== =====================
+ 'C' centered
+ 'SW' lower left corner
+ 'S' middle of bottom edge
+ 'SE' lower right corner
+ etc.
+ ===== =====================
+
+ See `~.Axes.set_anchor` for further details.
+
+ share : bool, default: False
+ If ``True``, apply the settings to all shared Axes.
+
+ See Also
+ --------
+ matplotlib.axes.Axes.set_adjustable
+ Set how the Axes adjusts to achieve the required aspect ratio.
+ matplotlib.axes.Axes.set_anchor
+ Set the position in case of extra space.
+ """
+ if cbook._str_equal(aspect, 'equal'):
+ aspect = 1
+ if not cbook._str_equal(aspect, 'auto'):
+ aspect = float(aspect) # raise ValueError if necessary
+
+ if share:
+ axes = {*self._shared_x_axes.get_siblings(self),
+ *self._shared_y_axes.get_siblings(self)}
+ else:
+ axes = [self]
+
+ for ax in axes:
+ ax._aspect = aspect
+
+ if adjustable is None:
+ adjustable = self._adjustable
+ self.set_adjustable(adjustable, share=share) # Handle sharing.
+
+ if anchor is not None:
+ self.set_anchor(anchor, share=share)
+ self.stale = True
+
+ def get_adjustable(self):
+ """
+ Return whether the Axes will adjust its physical dimension ('box') or
+ its data limits ('datalim') to achieve the desired aspect ratio.
+
+ See Also
+ --------
+ matplotlib.axes.Axes.set_adjustable
+ Set how the Axes adjusts to achieve the required aspect ratio.
+ matplotlib.axes.Axes.set_aspect
+ For a description of aspect handling.
+ """
+ return self._adjustable
+
+ def set_adjustable(self, adjustable, share=False):
+ """
+ Set how the Axes adjusts to achieve the required aspect ratio.
+
+ Parameters
+ ----------
+ adjustable : {'box', 'datalim'}
+ If 'box', change the physical dimensions of the Axes.
+ If 'datalim', change the ``x`` or ``y`` data limits.
+
+ share : bool, default: False
+ If ``True``, apply the settings to all shared Axes.
+
+ See Also
+ --------
+ matplotlib.axes.Axes.set_aspect
+ For a description of aspect handling.
+
+ Notes
+ -----
+ Shared Axes (of which twinned Axes are a special case)
+ impose restrictions on how aspect ratios can be imposed.
+ For twinned Axes, use 'datalim'. For Axes that share both
+ x and y, use 'box'. Otherwise, either 'datalim' or 'box'
+ may be used. These limitations are partly a requirement
+ to avoid over-specification, and partly a result of the
+ particular implementation we are currently using, in
+ which the adjustments for aspect ratios are done sequentially
+ and independently on each Axes as it is drawn.
+ """
+ _api.check_in_list(["box", "datalim"], adjustable=adjustable)
+ if share:
+ axs = {*self._shared_x_axes.get_siblings(self),
+ *self._shared_y_axes.get_siblings(self)}
+ else:
+ axs = [self]
+ if (adjustable == "datalim"
+ and any(getattr(ax.get_data_ratio, "__func__", None)
+ != _AxesBase.get_data_ratio
+ for ax in axs)):
+ # Limits adjustment by apply_aspect assumes that the axes' aspect
+ # ratio can be computed from the data limits and scales.
+ raise ValueError("Cannot set axes adjustable to 'datalim' for "
+ "Axes which override 'get_data_ratio'")
+ for ax in axs:
+ ax._adjustable = adjustable
+ self.stale = True
+
+ def get_box_aspect(self):
+ """
+ Return the axes box aspect, i.e. the ratio of height to width.
+
+ The box aspect is ``None`` (i.e. chosen depending on the available
+ figure space) unless explicitly specified.
+
+ See Also
+ --------
+ matplotlib.axes.Axes.set_box_aspect
+ for a description of box aspect.
+ matplotlib.axes.Axes.set_aspect
+ for a description of aspect handling.
+ """
+ return self._box_aspect
+
+ def set_box_aspect(self, aspect=None):
+ """
+ Set the axes box aspect, i.e. the ratio of height to width.
+
+ This defines the aspect of the axes in figure space and is not to be
+ confused with the data aspect (see `~.Axes.set_aspect`).
+
+ Parameters
+ ----------
+ aspect : float or None
+ Changes the physical dimensions of the Axes, such that the ratio
+ of the axes height to the axes width in physical units is equal to
+ *aspect*. Defining a box aspect will change the *adjustable*
+ property to 'datalim' (see `~.Axes.set_adjustable`).
+
+ *None* will disable a fixed box aspect so that height and width
+ of the axes are chosen independently.
+
+ See Also
+ --------
+ matplotlib.axes.Axes.set_aspect
+ for a description of aspect handling.
+ """
+ axs = {*self._twinned_axes.get_siblings(self),
+ *self._twinned_axes.get_siblings(self)}
+
+ if aspect is not None:
+ aspect = float(aspect)
+ # when box_aspect is set to other than ´None`,
+ # adjustable must be "datalim"
+ for ax in axs:
+ ax.set_adjustable("datalim")
+
+ for ax in axs:
+ ax._box_aspect = aspect
+ ax.stale = True
+
+ def get_anchor(self):
+ """
+ Get the anchor location.
+
+ See Also
+ --------
+ matplotlib.axes.Axes.set_anchor
+ for a description of the anchor.
+ matplotlib.axes.Axes.set_aspect
+ for a description of aspect handling.
+ """
+ return self._anchor
+
+ def set_anchor(self, anchor, share=False):
+ """
+ Define the anchor location.
+
+ The actual drawing area (active position) of the Axes may be smaller
+ than the Bbox (original position) when a fixed aspect is required. The
+ anchor defines where the drawing area will be located within the
+ available space.
+
+ Parameters
+ ----------
+ anchor : 2-tuple of floats or {'C', 'SW', 'S', 'SE', ...}
+ The anchor position may be either:
+
+ - a sequence (*cx*, *cy*). *cx* and *cy* may range from 0
+ to 1, where 0 is left or bottom and 1 is right or top.
+
+ - a string using cardinal directions as abbreviation:
+
+ - 'C' for centered
+ - 'S' (south) for bottom-center
+ - 'SW' (south west) for bottom-left
+ - etc.
+
+ Here is an overview of the possible positions:
+
+ +------+------+------+
+ | 'NW' | 'N' | 'NE' |
+ +------+------+------+
+ | 'W' | 'C' | 'E' |
+ +------+------+------+
+ | 'SW' | 'S' | 'SE' |
+ +------+------+------+
+
+ share : bool, default: False
+ If ``True``, apply the settings to all shared Axes.
+
+ See Also
+ --------
+ matplotlib.axes.Axes.set_aspect
+ for a description of aspect handling.
+ """
+ if not (anchor in mtransforms.Bbox.coefs or len(anchor) == 2):
+ raise ValueError('argument must be among %s' %
+ ', '.join(mtransforms.Bbox.coefs))
+ if share:
+ axes = {*self._shared_x_axes.get_siblings(self),
+ *self._shared_y_axes.get_siblings(self)}
+ else:
+ axes = [self]
+ for ax in axes:
+ ax._anchor = anchor
+
+ self.stale = True
+
+ def get_data_ratio(self):
+ """
+ Return the aspect ratio of the scaled data.
+
+ Notes
+ -----
+ This method is intended to be overridden by new projection types.
+ """
+ txmin, txmax = self.xaxis.get_transform().transform(self.get_xbound())
+ tymin, tymax = self.yaxis.get_transform().transform(self.get_ybound())
+ xsize = max(abs(txmax - txmin), 1e-30)
+ ysize = max(abs(tymax - tymin), 1e-30)
+ return ysize / xsize
+
+ def apply_aspect(self, position=None):
+ """
+ Adjust the Axes for a specified data aspect ratio.
+
+ Depending on `.get_adjustable` this will modify either the
+ Axes box (position) or the view limits. In the former case,
+ `~matplotlib.axes.Axes.get_anchor` will affect the position.
+
+ Notes
+ -----
+ This is called automatically when each Axes is drawn. You may need
+ to call it yourself if you need to update the Axes position and/or
+ view limits before the Figure is drawn.
+
+ See Also
+ --------
+ matplotlib.axes.Axes.set_aspect
+ For a description of aspect ratio handling.
+ matplotlib.axes.Axes.set_adjustable
+ Set how the Axes adjusts to achieve the required aspect ratio.
+ matplotlib.axes.Axes.set_anchor
+ Set the position in case of extra space.
+ """
+ if position is None:
+ position = self.get_position(original=True)
+
+ aspect = self.get_aspect()
+
+ if aspect == 'auto' and self._box_aspect is None:
+ self._set_position(position, which='active')
+ return
+
+ trans = self.get_figure().transSubfigure
+ bb = mtransforms.Bbox.from_bounds(0, 0, 1, 1).transformed(trans)
+ # this is the physical aspect of the panel (or figure):
+ fig_aspect = bb.height / bb.width
+
+ if self._adjustable == 'box':
+ if self in self._twinned_axes:
+ raise RuntimeError("Adjustable 'box' is not allowed in a "
+ "twinned Axes; use 'datalim' instead")
+ box_aspect = aspect * self.get_data_ratio()
+ pb = position.frozen()
+ pb1 = pb.shrunk_to_aspect(box_aspect, pb, fig_aspect)
+ self._set_position(pb1.anchored(self.get_anchor(), pb), 'active')
+ return
+
+ # The following is only seen if self._adjustable == 'datalim'
+ if self._box_aspect is not None:
+ pb = position.frozen()
+ pb1 = pb.shrunk_to_aspect(self._box_aspect, pb, fig_aspect)
+ self._set_position(pb1.anchored(self.get_anchor(), pb), 'active')
+ if aspect == "auto":
+ return
+
+ # reset active to original in case it had been changed by prior use
+ # of 'box'
+ if self._box_aspect is None:
+ self._set_position(position, which='active')
+ else:
+ position = pb1.anchored(self.get_anchor(), pb)
+
+ x_trf = self.xaxis.get_transform()
+ y_trf = self.yaxis.get_transform()
+ xmin, xmax = x_trf.transform(self.get_xbound())
+ ymin, ymax = y_trf.transform(self.get_ybound())
+ xsize = max(abs(xmax - xmin), 1e-30)
+ ysize = max(abs(ymax - ymin), 1e-30)
+
+ box_aspect = fig_aspect * (position.height / position.width)
+ data_ratio = box_aspect / aspect
+
+ y_expander = data_ratio * xsize / ysize - 1
+ # If y_expander > 0, the dy/dx viewLim ratio needs to increase
+ if abs(y_expander) < 0.005:
+ return
+
+ dL = self.dataLim
+ x0, x1 = x_trf.transform(dL.intervalx)
+ y0, y1 = y_trf.transform(dL.intervaly)
+ xr = 1.05 * (x1 - x0)
+ yr = 1.05 * (y1 - y0)
+
+ xmarg = xsize - xr
+ ymarg = ysize - yr
+ Ysize = data_ratio * xsize
+ Xsize = ysize / data_ratio
+ Xmarg = Xsize - xr
+ Ymarg = Ysize - yr
+ # Setting these targets to, e.g., 0.05*xr does not seem to help.
+ xm = 0
+ ym = 0
+
+ shared_x = self in self._shared_x_axes
+ shared_y = self in self._shared_y_axes
+ # Not sure whether we need this check:
+ if shared_x and shared_y:
+ raise RuntimeError("adjustable='datalim' is not allowed when both "
+ "axes are shared")
+
+ # If y is shared, then we are only allowed to change x, etc.
+ if shared_y:
+ adjust_y = False
+ else:
+ if xmarg > xm and ymarg > ym:
+ adjy = ((Ymarg > 0 and y_expander < 0) or
+ (Xmarg < 0 and y_expander > 0))
+ else:
+ adjy = y_expander > 0
+ adjust_y = shared_x or adjy # (Ymarg > xmarg)
+
+ if adjust_y:
+ yc = 0.5 * (ymin + ymax)
+ y0 = yc - Ysize / 2.0
+ y1 = yc + Ysize / 2.0
+ self.set_ybound(y_trf.inverted().transform([y0, y1]))
+ else:
+ xc = 0.5 * (xmin + xmax)
+ x0 = xc - Xsize / 2.0
+ x1 = xc + Xsize / 2.0
+ self.set_xbound(x_trf.inverted().transform([x0, x1]))
+
+ def axis(self, *args, emit=True, **kwargs):
+ """
+ Convenience method to get or set some axis properties.
+
+ Call signatures::
+
+ xmin, xmax, ymin, ymax = axis()
+ xmin, xmax, ymin, ymax = axis([xmin, xmax, ymin, ymax])
+ xmin, xmax, ymin, ymax = axis(option)
+ xmin, xmax, ymin, ymax = axis(**kwargs)
+
+ Parameters
+ ----------
+ xmin, xmax, ymin, ymax : float, optional
+ The axis limits to be set. This can also be achieved using ::
+
+ ax.set(xlim=(xmin, xmax), ylim=(ymin, ymax))
+
+ option : bool or str
+ If a bool, turns axis lines and labels on or off. If a string,
+ possible values are:
+
+ ======== ==========================================================
+ Value Description
+ ======== ==========================================================
+ 'on' Turn on axis lines and labels. Same as ``True``.
+ 'off' Turn off axis lines and labels. Same as ``False``.
+ 'equal' Set equal scaling (i.e., make circles circular) by
+ changing axis limits. This is the same as
+ ``ax.set_aspect('equal', adjustable='datalim')``.
+ Explicit data limits may not be respected in this case.
+ 'scaled' Set equal scaling (i.e., make circles circular) by
+ changing dimensions of the plot box. This is the same as
+ ``ax.set_aspect('equal', adjustable='box', anchor='C')``.
+ Additionally, further autoscaling will be disabled.
+ 'tight' Set limits just large enough to show all data, then
+ disable further autoscaling.
+ 'auto' Automatic scaling (fill plot box with data).
+ 'image' 'scaled' with axis limits equal to data limits.
+ 'square' Square plot; similar to 'scaled', but initially forcing
+ ``xmax-xmin == ymax-ymin``.
+ ======== ==========================================================
+
+ emit : bool, default: True
+ Whether observers are notified of the axis limit change.
+ This option is passed on to `~.Axes.set_xlim` and
+ `~.Axes.set_ylim`.
+
+ Returns
+ -------
+ xmin, xmax, ymin, ymax : float
+ The axis limits.
+
+ See Also
+ --------
+ matplotlib.axes.Axes.set_xlim
+ matplotlib.axes.Axes.set_ylim
+ """
+ if len(args) > 1:
+ raise TypeError("axis() takes 0 or 1 positional arguments but "
+ f"{len(args)} were given")
+ elif len(args) == 1 and isinstance(args[0], (str, bool)):
+ s = args[0]
+ if s is True:
+ s = 'on'
+ if s is False:
+ s = 'off'
+ s = s.lower()
+ if s == 'on':
+ self.set_axis_on()
+ elif s == 'off':
+ self.set_axis_off()
+ elif s in ('equal', 'tight', 'scaled', 'auto', 'image', 'square'):
+ self.set_autoscale_on(True)
+ self.set_aspect('auto')
+ self.autoscale_view(tight=False)
+ # self.apply_aspect()
+ if s == 'equal':
+ self.set_aspect('equal', adjustable='datalim')
+ elif s == 'scaled':
+ self.set_aspect('equal', adjustable='box', anchor='C')
+ self.set_autoscale_on(False) # Req. by Mark Bakker
+ elif s == 'tight':
+ self.autoscale_view(tight=True)
+ self.set_autoscale_on(False)
+ elif s == 'image':
+ self.autoscale_view(tight=True)
+ self.set_autoscale_on(False)
+ self.set_aspect('equal', adjustable='box', anchor='C')
+ elif s == 'square':
+ self.set_aspect('equal', adjustable='box', anchor='C')
+ self.set_autoscale_on(False)
+ xlim = self.get_xlim()
+ ylim = self.get_ylim()
+ edge_size = max(np.diff(xlim), np.diff(ylim))[0]
+ self.set_xlim([xlim[0], xlim[0] + edge_size],
+ emit=emit, auto=False)
+ self.set_ylim([ylim[0], ylim[0] + edge_size],
+ emit=emit, auto=False)
+ else:
+ raise ValueError('Unrecognized string %s to axis; '
+ 'try on or off' % s)
+ else:
+ if len(args) == 1:
+ limits = args[0]
+ try:
+ xmin, xmax, ymin, ymax = limits
+ except (TypeError, ValueError) as err:
+ raise TypeError('the first argument to axis() must be an '
+ 'iterable of the form '
+ '[xmin, xmax, ymin, ymax]') from err
+ else:
+ xmin = kwargs.pop('xmin', None)
+ xmax = kwargs.pop('xmax', None)
+ ymin = kwargs.pop('ymin', None)
+ ymax = kwargs.pop('ymax', None)
+ xauto = (None # Keep autoscale state as is.
+ if xmin is None and xmax is None
+ else False) # Turn off autoscale.
+ yauto = (None
+ if ymin is None and ymax is None
+ else False)
+ self.set_xlim(xmin, xmax, emit=emit, auto=xauto)
+ self.set_ylim(ymin, ymax, emit=emit, auto=yauto)
+ if kwargs:
+ raise TypeError(f"axis() got an unexpected keyword argument "
+ f"'{next(iter(kwargs))}'")
+ return (*self.get_xlim(), *self.get_ylim())
+
+ def get_legend(self):
+ """Return the `.Legend` instance, or None if no legend is defined."""
+ return self.legend_
+
+ def get_images(self):
+ r"""Return a list of `.AxesImage`\s contained by the Axes."""
+ return cbook.silent_list('AxesImage', self.images)
+
+ def get_lines(self):
+ """Return a list of lines contained by the Axes."""
+ return cbook.silent_list('Line2D', self.lines)
+
+ def get_xaxis(self):
+ """
+ Return the XAxis instance.
+
+ The use of this function is discouraged. You should instead directly
+ access the attribute ``ax.xaxis``.
+ """
+ return self.xaxis
+
+ def get_yaxis(self):
+ """
+ Return the YAxis instance.
+
+ The use of this function is discouraged. You should instead directly
+ access the attribute ``ax.yaxis``.
+ """
+ return self.yaxis
+
+ get_xgridlines = _axis_method_wrapper("xaxis", "get_gridlines")
+ get_xticklines = _axis_method_wrapper("xaxis", "get_ticklines")
+ get_ygridlines = _axis_method_wrapper("yaxis", "get_gridlines")
+ get_yticklines = _axis_method_wrapper("yaxis", "get_ticklines")
+
+ # Adding and tracking artists
+
+ def _sci(self, im):
+ """
+ Set the current image.
+
+ This image will be the target of colormap functions like
+ `~.pyplot.viridis`, and other functions such as `~.pyplot.clim`. The
+ current image is an attribute of the current axes.
+ """
+ if isinstance(im, mpl.contour.ContourSet):
+ if im.collections[0] not in self.collections:
+ raise ValueError("ContourSet must be in current Axes")
+ elif im not in self.images and im not in self.collections:
+ raise ValueError("Argument must be an image, collection, or "
+ "ContourSet in this Axes")
+ self._current_image = im
+
+ def _gci(self):
+ """Helper for `~matplotlib.pyplot.gci`; do not use elsewhere."""
+ return self._current_image
+
+ def has_data(self):
+ """
+ Return whether any artists have been added to the axes.
+
+ This should not be used to determine whether the *dataLim*
+ need to be updated, and may not actually be useful for
+ anything.
+ """
+ return (
+ len(self.collections) +
+ len(self.images) +
+ len(self.lines) +
+ len(self.patches)) > 0
+
+ def add_artist(self, a):
+ """
+ Add an `~.Artist` to the axes, and return the artist.
+
+ Use `add_artist` only for artists for which there is no dedicated
+ "add" method; and if necessary, use a method such as `update_datalim`
+ to manually update the dataLim if the artist is to be included in
+ autoscaling.
+
+ If no ``transform`` has been specified when creating the artist (e.g.
+ ``artist.get_transform() == None``) then the transform is set to
+ ``ax.transData``.
+ """
+ a.axes = self
+ self.artists.append(a)
+ a._remove_method = self.artists.remove
+ self._set_artist_props(a)
+ a.set_clip_path(self.patch)
+ self.stale = True
+ return a
+
+ def add_child_axes(self, ax):
+ """
+ Add an `~.AxesBase` to the axes' children; return the child axes.
+
+ This is the lowlevel version. See `.axes.Axes.inset_axes`.
+ """
+
+ # normally axes have themselves as the axes, but these need to have
+ # their parent...
+ # Need to bypass the getter...
+ ax._axes = self
+ ax.stale_callback = martist._stale_axes_callback
+
+ self.child_axes.append(ax)
+ ax._remove_method = self.child_axes.remove
+ self.stale = True
+ return ax
+
+ def add_collection(self, collection, autolim=True):
+ """
+ Add a `~.Collection` to the axes' collections; return the collection.
+ """
+ label = collection.get_label()
+ if not label:
+ collection.set_label('_collection%d' % len(self.collections))
+ self.collections.append(collection)
+ collection._remove_method = self.collections.remove
+ self._set_artist_props(collection)
+
+ if collection.get_clip_path() is None:
+ collection.set_clip_path(self.patch)
+
+ if autolim:
+ # Make sure viewLim is not stale (mostly to match
+ # pre-lazy-autoscale behavior, which is not really better).
+ self._unstale_viewLim()
+ datalim = collection.get_datalim(self.transData)
+ points = datalim.get_points()
+ if not np.isinf(datalim.minpos).all():
+ # By definition, if minpos (minimum positive value) is set
+ # (i.e., non-inf), then min(points) <= minpos <= max(points),
+ # and minpos would be superfluous. However, we add minpos to
+ # the call so that self.dataLim will update its own minpos.
+ # This ensures that log scales see the correct minimum.
+ points = np.concatenate([points, [datalim.minpos]])
+ self.update_datalim(points)
+
+ self.stale = True
+ return collection
+
+ def add_image(self, image):
+ """
+ Add an `~.AxesImage` to the axes' images; return the image.
+ """
+ self._set_artist_props(image)
+ if not image.get_label():
+ image.set_label('_image%d' % len(self.images))
+ self.images.append(image)
+ image._remove_method = self.images.remove
+ self.stale = True
+ return image
+
+ def _update_image_limits(self, image):
+ xmin, xmax, ymin, ymax = image.get_extent()
+ self.axes.update_datalim(((xmin, ymin), (xmax, ymax)))
+
+ def add_line(self, line):
+ """
+ Add a `.Line2D` to the axes' lines; return the line.
+ """
+ self._set_artist_props(line)
+ if line.get_clip_path() is None:
+ line.set_clip_path(self.patch)
+
+ self._update_line_limits(line)
+ if not line.get_label():
+ line.set_label('_line%d' % len(self.lines))
+ self.lines.append(line)
+ line._remove_method = self.lines.remove
+ self.stale = True
+ return line
+
+ def _add_text(self, txt):
+ """
+ Add a `~.Text` to the axes' texts; return the text.
+ """
+ self._set_artist_props(txt)
+ self.texts.append(txt)
+ txt._remove_method = self.texts.remove
+ self.stale = True
+ return txt
+
+ def _update_line_limits(self, line):
+ """
+ Figures out the data limit of the given line, updating self.dataLim.
+ """
+ path = line.get_path()
+ if path.vertices.size == 0:
+ return
+
+ line_trans = line.get_transform()
+
+ if line_trans == self.transData:
+ data_path = path
+
+ elif any(line_trans.contains_branch_seperately(self.transData)):
+ # identify the transform to go from line's coordinates
+ # to data coordinates
+ trans_to_data = line_trans - self.transData
+
+ # if transData is affine we can use the cached non-affine component
+ # of line's path. (since the non-affine part of line_trans is
+ # entirely encapsulated in trans_to_data).
+ if self.transData.is_affine:
+ line_trans_path = line._get_transformed_path()
+ na_path, _ = line_trans_path.get_transformed_path_and_affine()
+ data_path = trans_to_data.transform_path_affine(na_path)
+ else:
+ data_path = trans_to_data.transform_path(path)
+ else:
+ # for backwards compatibility we update the dataLim with the
+ # coordinate range of the given path, even though the coordinate
+ # systems are completely different. This may occur in situations
+ # such as when ax.transAxes is passed through for absolute
+ # positioning.
+ data_path = path
+
+ if data_path.vertices.size > 0:
+ updatex, updatey = line_trans.contains_branch_seperately(
+ self.transData)
+ self.dataLim.update_from_path(data_path,
+ self.ignore_existing_data_limits,
+ updatex=updatex,
+ updatey=updatey)
+ self.ignore_existing_data_limits = False
+
+ def add_patch(self, p):
+ """
+ Add a `~.Patch` to the axes' patches; return the patch.
+ """
+ self._set_artist_props(p)
+ if p.get_clip_path() is None:
+ p.set_clip_path(self.patch)
+ self._update_patch_limits(p)
+ self.patches.append(p)
+ p._remove_method = self.patches.remove
+ return p
+
+ def _update_patch_limits(self, patch):
+ """Update the data limits for the given patch."""
+ # hist can add zero height Rectangles, which is useful to keep
+ # the bins, counts and patches lined up, but it throws off log
+ # scaling. We'll ignore rects with zero height or width in
+ # the auto-scaling
+
+ # cannot check for '==0' since unitized data may not compare to zero
+ # issue #2150 - we update the limits if patch has non zero width
+ # or height.
+ if (isinstance(patch, mpatches.Rectangle) and
+ ((not patch.get_width()) and (not patch.get_height()))):
+ return
+ p = patch.get_path()
+ vertices = p.vertices if p.codes is None else p.vertices[np.isin(
+ p.codes, (mpath.Path.CLOSEPOLY, mpath.Path.STOP), invert=True)]
+ if vertices.size > 0:
+ xys = patch.get_patch_transform().transform(vertices)
+ if patch.get_data_transform() != self.transData:
+ patch_to_data = (patch.get_data_transform() -
+ self.transData)
+ xys = patch_to_data.transform(xys)
+
+ updatex, updatey = patch.get_transform().\
+ contains_branch_seperately(self.transData)
+ self.update_datalim(xys, updatex=updatex,
+ updatey=updatey)
+
+ def add_table(self, tab):
+ """
+ Add a `~.Table` to the axes' tables; return the table.
+ """
+ self._set_artist_props(tab)
+ self.tables.append(tab)
+ tab.set_clip_path(self.patch)
+ tab._remove_method = self.tables.remove
+ return tab
+
+ def add_container(self, container):
+ """
+ Add a `~.Container` to the axes' containers; return the container.
+ """
+ label = container.get_label()
+ if not label:
+ container.set_label('_container%d' % len(self.containers))
+ self.containers.append(container)
+ container._remove_method = self.containers.remove
+ return container
+
+ def _unit_change_handler(self, axis_name, event=None):
+ """
+ Process axis units changes: requests updates to data and view limits.
+ """
+ if event is None: # Allow connecting `self._unit_change_handler(name)`
+ return functools.partial(
+ self._unit_change_handler, axis_name, event=object())
+ _api.check_in_list(self._get_axis_map(), axis_name=axis_name)
+ self.relim()
+ self._request_autoscale_view(scalex=(axis_name == "x"),
+ scaley=(axis_name == "y"))
+
+ def relim(self, visible_only=False):
+ """
+ Recompute the data limits based on current artists.
+
+ At present, `~.Collection` instances are not supported.
+
+ Parameters
+ ----------
+ visible_only : bool, default: False
+ Whether to exclude invisible artists.
+ """
+ # Collections are deliberately not supported (yet); see
+ # the TODO note in artists.py.
+ self.dataLim.ignore(True)
+ self.dataLim.set_points(mtransforms.Bbox.null().get_points())
+ self.ignore_existing_data_limits = True
+
+ for line in self.lines:
+ if not visible_only or line.get_visible():
+ self._update_line_limits(line)
+
+ for p in self.patches:
+ if not visible_only or p.get_visible():
+ self._update_patch_limits(p)
+
+ for image in self.images:
+ if not visible_only or image.get_visible():
+ self._update_image_limits(image)
+
+ def update_datalim(self, xys, updatex=True, updatey=True):
+ """
+ Extend the `~.Axes.dataLim` Bbox to include the given points.
+
+ If no data is set currently, the Bbox will ignore its limits and set
+ the bound to be the bounds of the xydata (*xys*). Otherwise, it will
+ compute the bounds of the union of its current data and the data in
+ *xys*.
+
+ Parameters
+ ----------
+ xys : 2D array-like
+ The points to include in the data limits Bbox. This can be either
+ a list of (x, y) tuples or a Nx2 array.
+
+ updatex, updatey : bool, default: True
+ Whether to update the x/y limits.
+ """
+ xys = np.asarray(xys)
+ if not np.any(np.isfinite(xys)):
+ return
+ self.dataLim.update_from_data_xy(xys, self.ignore_existing_data_limits,
+ updatex=updatex, updatey=updatey)
+ self.ignore_existing_data_limits = False
+
+ @_api.deprecated(
+ "3.3", alternative="ax.dataLim.set(Bbox.union([ax.dataLim, bounds]))")
+ def update_datalim_bounds(self, bounds):
+ """
+ Extend the `~.Axes.datalim` Bbox to include the given
+ `~matplotlib.transforms.Bbox`.
+
+ Parameters
+ ----------
+ bounds : `~matplotlib.transforms.Bbox`
+ """
+ self.dataLim.set(mtransforms.Bbox.union([self.dataLim, bounds]))
+
+ def _process_unit_info(self, datasets=None, kwargs=None, *, convert=True):
+ """
+ Set axis units based on *datasets* and *kwargs*, and optionally apply
+ unit conversions to *datasets*.
+
+ Parameters
+ ----------
+ datasets : list
+ List of (axis_name, dataset) pairs (where the axis name is defined
+ as in `._get_axis_map`.
+ kwargs : dict
+ Other parameters from which unit info (i.e., the *xunits*,
+ *yunits*, *zunits* (for 3D axes), *runits* and *thetaunits* (for
+ polar axes) entries) is popped, if present. Note that this dict is
+ mutated in-place!
+ convert : bool, default: True
+ Whether to return the original datasets or the converted ones.
+
+ Returns
+ -------
+ list
+ Either the original datasets if *convert* is False, or the
+ converted ones if *convert* is True (the default).
+ """
+ # The API makes datasets a list of pairs rather than an axis_name to
+ # dataset mapping because it is sometimes necessary to process multiple
+ # datasets for a single axis, and concatenating them may be tricky
+ # (e.g. if some are scalars, etc.).
+ datasets = datasets or []
+ kwargs = kwargs or {}
+ axis_map = self._get_axis_map()
+ for axis_name, data in datasets:
+ try:
+ axis = axis_map[axis_name]
+ except KeyError:
+ raise ValueError(f"Invalid axis name: {axis_name!r}") from None
+ # Update from data if axis is already set but no unit is set yet.
+ if axis is not None and data is not None and not axis.have_units():
+ axis.update_units(data)
+ for axis_name, axis in axis_map.items():
+ # Return if no axis is set.
+ if axis is None:
+ continue
+ # Check for units in the kwargs, and if present update axis.
+ units = kwargs.pop(f"{axis_name}units", axis.units)
+ if self.name == "polar":
+ # Special case: polar supports "thetaunits"/"runits".
+ polar_units = {"x": "thetaunits", "y": "runits"}
+ units = kwargs.pop(polar_units[axis_name], units)
+ if units != axis.units and units is not None:
+ axis.set_units(units)
+ # If the units being set imply a different converter,
+ # we need to update again.
+ for dataset_axis_name, data in datasets:
+ if dataset_axis_name == axis_name and data is not None:
+ axis.update_units(data)
+ return [axis_map[axis_name].convert_units(data) if convert else data
+ for axis_name, data in datasets]
+
+ def in_axes(self, mouseevent):
+ """
+ Return whether the given event (in display coords) is in the Axes.
+ """
+ return self.patch.contains(mouseevent)[0]
+
+ def get_autoscale_on(self):
+ """
+ Get whether autoscaling is applied for both axes on plot commands
+ """
+ return self._autoscaleXon and self._autoscaleYon
+
+ def get_autoscalex_on(self):
+ """
+ Get whether autoscaling for the x-axis is applied on plot commands
+ """
+ return self._autoscaleXon
+
+ def get_autoscaley_on(self):
+ """
+ Get whether autoscaling for the y-axis is applied on plot commands
+ """
+ return self._autoscaleYon
+
+ def set_autoscale_on(self, b):
+ """
+ Set whether autoscaling is applied to axes on the next draw or call to
+ `.Axes.autoscale_view`.
+
+ Parameters
+ ----------
+ b : bool
+ """
+ self._autoscaleXon = b
+ self._autoscaleYon = b
+
+ def set_autoscalex_on(self, b):
+ """
+ Set whether autoscaling for the x-axis is applied to axes on the next
+ draw or call to `.Axes.autoscale_view`.
+
+ Parameters
+ ----------
+ b : bool
+ """
+ self._autoscaleXon = b
+
+ def set_autoscaley_on(self, b):
+ """
+ Set whether autoscaling for the y-axis is applied to axes on the next
+ draw or call to `.Axes.autoscale_view`.
+
+ Parameters
+ ----------
+ b : bool
+ """
+ self._autoscaleYon = b
+
+ @property
+ def use_sticky_edges(self):
+ """
+ When autoscaling, whether to obey all `Artist.sticky_edges`.
+
+ Default is ``True``.
+
+ Setting this to ``False`` ensures that the specified margins
+ will be applied, even if the plot includes an image, for
+ example, which would otherwise force a view limit to coincide
+ with its data limit.
+
+ The changing this property does not change the plot until
+ `autoscale` or `autoscale_view` is called.
+ """
+ return self._use_sticky_edges
+
+ @use_sticky_edges.setter
+ def use_sticky_edges(self, b):
+ self._use_sticky_edges = bool(b)
+ # No effect until next autoscaling, which will mark the axes as stale.
+
+ def set_xmargin(self, m):
+ """
+ Set padding of X data limits prior to autoscaling.
+
+ *m* times the data interval will be added to each
+ end of that interval before it is used in autoscaling.
+ For example, if your data is in the range [0, 2], a factor of
+ ``m = 0.1`` will result in a range [-0.2, 2.2].
+
+ Negative values -0.5 < m < 0 will result in clipping of the data range.
+ I.e. for a data range [0, 2], a factor of ``m = -0.1`` will result in
+ a range [0.2, 1.8].
+
+ Parameters
+ ----------
+ m : float greater than -0.5
+ """
+ if m <= -0.5:
+ raise ValueError("margin must be greater than -0.5")
+ self._xmargin = m
+ self._request_autoscale_view(scalex=True, scaley=False)
+ self.stale = True
+
+ def set_ymargin(self, m):
+ """
+ Set padding of Y data limits prior to autoscaling.
+
+ *m* times the data interval will be added to each
+ end of that interval before it is used in autoscaling.
+ For example, if your data is in the range [0, 2], a factor of
+ ``m = 0.1`` will result in a range [-0.2, 2.2].
+
+ Negative values -0.5 < m < 0 will result in clipping of the data range.
+ I.e. for a data range [0, 2], a factor of ``m = -0.1`` will result in
+ a range [0.2, 1.8].
+
+ Parameters
+ ----------
+ m : float greater than -0.5
+ """
+ if m <= -0.5:
+ raise ValueError("margin must be greater than -0.5")
+ self._ymargin = m
+ self._request_autoscale_view(scalex=False, scaley=True)
+ self.stale = True
+
+ def margins(self, *margins, x=None, y=None, tight=True):
+ """
+ Set or retrieve autoscaling margins.
+
+ The padding added to each limit of the axes is the *margin*
+ times the data interval. All input parameters must be floats
+ within the range [0, 1]. Passing both positional and keyword
+ arguments is invalid and will raise a TypeError. If no
+ arguments (positional or otherwise) are provided, the current
+ margins will remain in place and simply be returned.
+
+ Specifying any margin changes only the autoscaling; for example,
+ if *xmargin* is not None, then *xmargin* times the X data
+ interval will be added to each end of that interval before
+ it is used in autoscaling.
+
+ Parameters
+ ----------
+ *margins : float, optional
+ If a single positional argument is provided, it specifies
+ both margins of the x-axis and y-axis limits. If two
+ positional arguments are provided, they will be interpreted
+ as *xmargin*, *ymargin*. If setting the margin on a single
+ axis is desired, use the keyword arguments described below.
+
+ x, y : float, optional
+ Specific margin values for the x-axis and y-axis,
+ respectively. These cannot be used with positional
+ arguments, but can be used individually to alter on e.g.,
+ only the y-axis.
+
+ tight : bool or None, default: True
+ The *tight* parameter is passed to :meth:`autoscale_view`,
+ which is executed after a margin is changed; the default
+ here is *True*, on the assumption that when margins are
+ specified, no additional padding to match tick marks is
+ usually desired. Set *tight* to *None* will preserve
+ the previous setting.
+
+ Returns
+ -------
+ xmargin, ymargin : float
+
+ Notes
+ -----
+ If a previously used Axes method such as :meth:`pcolor` has set
+ :attr:`use_sticky_edges` to `True`, only the limits not set by
+ the "sticky artists" will be modified. To force all of the
+ margins to be set, set :attr:`use_sticky_edges` to `False`
+ before calling :meth:`margins`.
+ """
+
+ if margins and x is not None and y is not None:
+ raise TypeError('Cannot pass both positional and keyword '
+ 'arguments for x and/or y.')
+ elif len(margins) == 1:
+ x = y = margins[0]
+ elif len(margins) == 2:
+ x, y = margins
+ elif margins:
+ raise TypeError('Must pass a single positional argument for all '
+ 'margins, or one for each margin (x, y).')
+
+ if x is None and y is None:
+ if tight is not True:
+ _api.warn_external(f'ignoring tight={tight!r} in get mode')
+ return self._xmargin, self._ymargin
+
+ if tight is not None:
+ self._tight = tight
+ if x is not None:
+ self.set_xmargin(x)
+ if y is not None:
+ self.set_ymargin(y)
+
+ def set_rasterization_zorder(self, z):
+ """
+ Set the zorder threshold for rasterization for vector graphics output.
+
+ All artists with a zorder below the given value will be rasterized if
+ they support rasterization.
+
+ This setting is ignored for pixel-based output.
+
+ See also :doc:`/gallery/misc/rasterization_demo`.
+
+ Parameters
+ ----------
+ z : float or None
+ The zorder below which artists are rasterized.
+ If ``None`` rasterization based on zorder is deactivated.
+ """
+ self._rasterization_zorder = z
+ self.stale = True
+
+ def get_rasterization_zorder(self):
+ """Return the zorder value below which artists will be rasterized."""
+ return self._rasterization_zorder
+
+ def autoscale(self, enable=True, axis='both', tight=None):
+ """
+ Autoscale the axis view to the data (toggle).
+
+ Convenience method for simple axis view autoscaling.
+ It turns autoscaling on or off, and then,
+ if autoscaling for either axis is on, it performs
+ the autoscaling on the specified axis or axes.
+
+ Parameters
+ ----------
+ enable : bool or None, default: True
+ True turns autoscaling on, False turns it off.
+ None leaves the autoscaling state unchanged.
+ axis : {'both', 'x', 'y'}, default: 'both'
+ Which axis to operate on.
+ tight : bool or None, default: None
+ If True, first set the margins to zero. Then, this argument is
+ forwarded to `autoscale_view` (regardless of its value); see the
+ description of its behavior there.
+ """
+ if enable is None:
+ scalex = True
+ scaley = True
+ else:
+ scalex = False
+ scaley = False
+ if axis in ['x', 'both']:
+ self._autoscaleXon = bool(enable)
+ scalex = self._autoscaleXon
+ if axis in ['y', 'both']:
+ self._autoscaleYon = bool(enable)
+ scaley = self._autoscaleYon
+ if tight and scalex:
+ self._xmargin = 0
+ if tight and scaley:
+ self._ymargin = 0
+ self._request_autoscale_view(tight=tight, scalex=scalex, scaley=scaley)
+
+ def autoscale_view(self, tight=None, scalex=True, scaley=True):
+ """
+ Autoscale the view limits using the data limits.
+
+ Parameters
+ ----------
+ tight : bool or None
+ If *True*, only expand the axis limits using the margins. Note
+ that unlike for `autoscale`, ``tight=True`` does *not* set the
+ margins to zero.
+
+ If *False* and :rc:`axes.autolimit_mode` is 'round_numbers', then
+ after expansion by the margins, further expand the axis limits
+ using the axis major locator.
+
+ If None (the default), reuse the value set in the previous call to
+ `autoscale_view` (the initial value is False, but the default style
+ sets :rc:`axes.autolimit_mode` to 'data', in which case this
+ behaves like True).
+
+ scalex : bool, default: True
+ Whether to autoscale the x axis.
+
+ scaley : bool, default: True
+ Whether to autoscale the y axis.
+
+ Notes
+ -----
+ The autoscaling preserves any preexisting axis direction reversal.
+
+ The data limits are not updated automatically when artist data are
+ changed after the artist has been added to an Axes instance. In that
+ case, use :meth:`matplotlib.axes.Axes.relim` prior to calling
+ autoscale_view.
+
+ If the views of the axes are fixed, e.g. via `set_xlim`, they will
+ not be changed by autoscale_view().
+ See :meth:`matplotlib.axes.Axes.autoscale` for an alternative.
+ """
+ if tight is not None:
+ self._tight = bool(tight)
+
+ x_stickies = y_stickies = np.array([])
+ if self.use_sticky_edges:
+ # Only iterate over axes and artists if needed. The check for
+ # ``hasattr(ax, "lines")`` is necessary because this can be called
+ # very early in the axes init process (e.g., for twin axes) when
+ # these attributes don't even exist yet, in which case
+ # `get_children` would raise an AttributeError.
+ if self._xmargin and scalex and self._autoscaleXon:
+ x_stickies = np.sort(np.concatenate([
+ artist.sticky_edges.x
+ for ax in self._shared_x_axes.get_siblings(self)
+ if hasattr(ax, "lines")
+ for artist in ax.get_children()]))
+ if self._ymargin and scaley and self._autoscaleYon:
+ y_stickies = np.sort(np.concatenate([
+ artist.sticky_edges.y
+ for ax in self._shared_y_axes.get_siblings(self)
+ if hasattr(ax, "lines")
+ for artist in ax.get_children()]))
+ if self.get_xscale() == 'log':
+ x_stickies = x_stickies[x_stickies > 0]
+ if self.get_yscale() == 'log':
+ y_stickies = y_stickies[y_stickies > 0]
+
+ def handle_single_axis(scale, autoscaleon, shared_axes, interval,
+ minpos, axis, margin, stickies, set_bound):
+
+ if not (scale and autoscaleon):
+ return # nothing to do...
+
+ shared = shared_axes.get_siblings(self)
+ # Base autoscaling on finite data limits when there is at least one
+ # finite data limit among all the shared_axes and intervals.
+ # Also, find the minimum minpos for use in the margin calculation.
+ x_values = []
+ minimum_minpos = np.inf
+ for ax in shared:
+ x_values.extend(getattr(ax.dataLim, interval))
+ minimum_minpos = min(minimum_minpos,
+ getattr(ax.dataLim, minpos))
+ x_values = np.extract(np.isfinite(x_values), x_values)
+ if x_values.size >= 1:
+ x0, x1 = (x_values.min(), x_values.max())
+ else:
+ x0, x1 = (-np.inf, np.inf)
+ # If x0 and x1 are non finite, use the locator to figure out
+ # default limits.
+ locator = axis.get_major_locator()
+ x0, x1 = locator.nonsingular(x0, x1)
+
+ # Prevent margin addition from crossing a sticky value. A small
+ # tolerance must be added due to floating point issues with
+ # streamplot; it is defined relative to x0, x1, x1-x0 but has
+ # no absolute term (e.g. "+1e-8") to avoid issues when working with
+ # datasets where all values are tiny (less than 1e-8).
+ tol = 1e-5 * max(abs(x0), abs(x1), abs(x1 - x0))
+ # Index of largest element < x0 + tol, if any.
+ i0 = stickies.searchsorted(x0 + tol) - 1
+ x0bound = stickies[i0] if i0 != -1 else None
+ # Index of smallest element > x1 - tol, if any.
+ i1 = stickies.searchsorted(x1 - tol)
+ x1bound = stickies[i1] if i1 != len(stickies) else None
+
+ # Add the margin in figure space and then transform back, to handle
+ # non-linear scales.
+ transform = axis.get_transform()
+ inverse_trans = transform.inverted()
+ x0, x1 = axis._scale.limit_range_for_scale(x0, x1, minimum_minpos)
+ x0t, x1t = transform.transform([x0, x1])
+ delta = (x1t - x0t) * margin
+ if not np.isfinite(delta):
+ delta = 0 # If a bound isn't finite, set margin to zero.
+ x0, x1 = inverse_trans.transform([x0t - delta, x1t + delta])
+
+ # Apply sticky bounds.
+ if x0bound is not None:
+ x0 = max(x0, x0bound)
+ if x1bound is not None:
+ x1 = min(x1, x1bound)
+
+ if not self._tight:
+ x0, x1 = locator.view_limits(x0, x1)
+ set_bound(x0, x1)
+ # End of definition of internal function 'handle_single_axis'.
+
+ handle_single_axis(
+ scalex, self._autoscaleXon, self._shared_x_axes, 'intervalx',
+ 'minposx', self.xaxis, self._xmargin, x_stickies, self.set_xbound)
+ handle_single_axis(
+ scaley, self._autoscaleYon, self._shared_y_axes, 'intervaly',
+ 'minposy', self.yaxis, self._ymargin, y_stickies, self.set_ybound)
+
+ def _get_axis_list(self):
+ return self.xaxis, self.yaxis
+
+ def _get_axis_map(self):
+ """
+ Return a mapping of `Axis` "names" to `Axis` instances.
+
+ The `Axis` name is derived from the attribute under which the instance
+ is stored, so e.g. for polar axes, the theta-axis is still named "x"
+ and the r-axis is still named "y" (for back-compatibility).
+
+ In practice, this means that the entries are typically "x" and "y", and
+ additionally "z" for 3D axes.
+ """
+ d = {}
+ axis_list = self._get_axis_list()
+ for k, v in vars(self).items():
+ if k.endswith("axis") and v in axis_list:
+ d[k[:-len("axis")]] = v
+ return d
+
+ def _update_title_position(self, renderer):
+ """
+ Update the title position based on the bounding box enclosing
+ all the ticklabels and x-axis spine and xlabel...
+ """
+ if self._autotitlepos is not None and not self._autotitlepos:
+ _log.debug('title position was updated manually, not adjusting')
+ return
+
+ titles = (self.title, self._left_title, self._right_title)
+
+ for title in titles:
+ x, _ = title.get_position()
+ # need to start again in case of window resizing
+ title.set_position((x, 1.0))
+ # need to check all our twins too...
+ axs = self._twinned_axes.get_siblings(self)
+ # and all the children
+ for ax in self.child_axes:
+ if ax is not None:
+ locator = ax.get_axes_locator()
+ if locator:
+ pos = locator(self, renderer)
+ ax.apply_aspect(pos)
+ else:
+ ax.apply_aspect()
+ axs = axs + [ax]
+ top = -np.Inf
+ for ax in axs:
+ if (ax.xaxis.get_ticks_position() in ['top', 'unknown']
+ or ax.xaxis.get_label_position() == 'top'):
+ bb = ax.xaxis.get_tightbbox(renderer)
+ else:
+ bb = ax.get_window_extent(renderer)
+ if bb is not None:
+ top = max(top, bb.ymax)
+ if top < 0:
+ # the top of axes is not even on the figure, so don't try and
+ # automatically place it.
+ _log.debug('top of axes not in the figure, so title not moved')
+ return
+ if title.get_window_extent(renderer).ymin < top:
+ _, y = self.transAxes.inverted().transform((0, top))
+ title.set_position((x, y))
+ # empirically, this doesn't always get the min to top,
+ # so we need to adjust again.
+ if title.get_window_extent(renderer).ymin < top:
+ _, y = self.transAxes.inverted().transform(
+ (0., 2 * top - title.get_window_extent(renderer).ymin))
+ title.set_position((x, y))
+
+ ymax = max(title.get_position()[1] for title in titles)
+ for title in titles:
+ # now line up all the titles at the highest baseline.
+ x, _ = title.get_position()
+ title.set_position((x, ymax))
+
+ # Drawing
+ @martist.allow_rasterization
+ @_api.delete_parameter(
+ "3.3", "inframe", alternative="Axes.redraw_in_frame()")
+ def draw(self, renderer=None, inframe=False):
+ # docstring inherited
+ if renderer is None:
+ _api.warn_deprecated(
+ "3.3", message="Support for not passing the 'renderer' "
+ "parameter to Axes.draw() is deprecated since %(since)s and "
+ "will be removed %(removal)s. Use axes.draw_artist(axes) "
+ "instead.")
+ renderer = self.figure._cachedRenderer
+ if renderer is None:
+ raise RuntimeError('No renderer defined')
+ if not self.get_visible():
+ return
+ self._unstale_viewLim()
+
+ renderer.open_group('axes', gid=self.get_gid())
+
+ # prevent triggering call backs during the draw process
+ self._stale = True
+
+ # loop over self and child axes...
+ locator = self.get_axes_locator()
+ if locator:
+ pos = locator(self, renderer)
+ self.apply_aspect(pos)
+ else:
+ self.apply_aspect()
+
+ artists = self.get_children()
+ artists.remove(self.patch)
+
+ # the frame draws the edges around the axes patch -- we
+ # decouple these so the patch can be in the background and the
+ # frame in the foreground. Do this before drawing the axis
+ # objects so that the spine has the opportunity to update them.
+ if not (self.axison and self._frameon):
+ for spine in self.spines.values():
+ artists.remove(spine)
+
+ self._update_title_position(renderer)
+
+ if not self.axison or inframe:
+ for _axis in self._get_axis_list():
+ artists.remove(_axis)
+
+ if inframe:
+ artists.remove(self.title)
+ artists.remove(self._left_title)
+ artists.remove(self._right_title)
+
+ if not self.figure.canvas.is_saving():
+ artists = [a for a in artists
+ if not a.get_animated() or a in self.images]
+ artists = sorted(artists, key=attrgetter('zorder'))
+
+ # rasterize artists with negative zorder
+ # if the minimum zorder is negative, start rasterization
+ rasterization_zorder = self._rasterization_zorder
+
+ if (rasterization_zorder is not None and
+ artists and artists[0].zorder < rasterization_zorder):
+ renderer.start_rasterizing()
+ artists_rasterized = [a for a in artists
+ if a.zorder < rasterization_zorder]
+ artists = [a for a in artists
+ if a.zorder >= rasterization_zorder]
+ else:
+ artists_rasterized = []
+
+ # the patch draws the background rectangle -- the frame below
+ # will draw the edges
+ if self.axison and self._frameon:
+ self.patch.draw(renderer)
+
+ if artists_rasterized:
+ for a in artists_rasterized:
+ a.draw(renderer)
+ renderer.stop_rasterizing()
+
+ mimage._draw_list_compositing_images(renderer, self, artists)
+
+ renderer.close_group('axes')
+ self.stale = False
+
+ def draw_artist(self, a):
+ """
+ Efficiently redraw a single artist.
+
+ This method can only be used after an initial draw of the figure,
+ because that creates and caches the renderer needed here.
+ """
+ if self.figure._cachedRenderer is None:
+ raise AttributeError("draw_artist can only be used after an "
+ "initial draw which caches the renderer")
+ a.draw(self.figure._cachedRenderer)
+
+ def redraw_in_frame(self):
+ """
+ Efficiently redraw Axes data, but not axis ticks, labels, etc.
+
+ This method can only be used after an initial draw which caches the
+ renderer.
+ """
+ if self.figure._cachedRenderer is None:
+ raise AttributeError("redraw_in_frame can only be used after an "
+ "initial draw which caches the renderer")
+ with ExitStack() as stack:
+ for artist in [*self._get_axis_list(),
+ self.title, self._left_title, self._right_title]:
+ stack.callback(artist.set_visible, artist.get_visible())
+ artist.set_visible(False)
+ self.draw(self.figure._cachedRenderer)
+
+ def get_renderer_cache(self):
+ return self.figure._cachedRenderer
+
+ # Axes rectangle characteristics
+
+ def get_frame_on(self):
+ """Get whether the axes rectangle patch is drawn."""
+ return self._frameon
+
+ def set_frame_on(self, b):
+ """
+ Set whether the axes rectangle patch is drawn.
+
+ Parameters
+ ----------
+ b : bool
+ """
+ self._frameon = b
+ self.stale = True
+
+ def get_axisbelow(self):
+ """
+ Get whether axis ticks and gridlines are above or below most artists.
+
+ Returns
+ -------
+ bool or 'line'
+
+ See Also
+ --------
+ set_axisbelow
+ """
+ return self._axisbelow
+
+ def set_axisbelow(self, b):
+ """
+ Set whether axis ticks and gridlines are above or below most artists.
+
+ This controls the zorder of the ticks and gridlines. For more
+ information on the zorder see :doc:`/gallery/misc/zorder_demo`.
+
+ Parameters
+ ----------
+ b : bool or 'line'
+ Possible values:
+
+ - *True* (zorder = 0.5): Ticks and gridlines are below all Artists.
+ - 'line' (zorder = 1.5): Ticks and gridlines are above patches
+ (e.g. rectangles, with default zorder = 1) but still below lines
+ and markers (with their default zorder = 2).
+ - *False* (zorder = 2.5): Ticks and gridlines are above patches
+ and lines / markers.
+
+ See Also
+ --------
+ get_axisbelow
+ """
+ self._axisbelow = axisbelow = validate_axisbelow(b)
+ if axisbelow is True:
+ zorder = 0.5
+ elif axisbelow is False:
+ zorder = 2.5
+ elif axisbelow == "line":
+ zorder = 1.5
+ else:
+ raise ValueError("Unexpected axisbelow value")
+ for axis in self._get_axis_list():
+ axis.set_zorder(zorder)
+ self.stale = True
+
+ @docstring.dedent_interpd
+ def grid(self, b=None, which='major', axis='both', **kwargs):
+ """
+ Configure the grid lines.
+
+ Parameters
+ ----------
+ b : bool or None, optional
+ Whether to show the grid lines. If any *kwargs* are supplied,
+ it is assumed you want the grid on and *b* will be set to True.
+
+ If *b* is *None* and there are no *kwargs*, this toggles the
+ visibility of the lines.
+
+ which : {'major', 'minor', 'both'}, optional
+ The grid lines to apply the changes on.
+
+ axis : {'both', 'x', 'y'}, optional
+ The axis to apply the changes on.
+
+ **kwargs : `.Line2D` properties
+ Define the line properties of the grid, e.g.::
+
+ grid(color='r', linestyle='-', linewidth=2)
+
+ Valid keyword arguments are:
+
+ %(Line2D_kwdoc)s
+
+ Notes
+ -----
+ The axis is drawn as a unit, so the effective zorder for drawing the
+ grid is determined by the zorder of each axis, not by the zorder of the
+ `.Line2D` objects comprising the grid. Therefore, to set grid zorder,
+ use `.set_axisbelow` or, for more control, call the
+ `~.Artist.set_zorder` method of each axis.
+ """
+ _api.check_in_list(['x', 'y', 'both'], axis=axis)
+ if axis in ['x', 'both']:
+ self.xaxis.grid(b, which=which, **kwargs)
+ if axis in ['y', 'both']:
+ self.yaxis.grid(b, which=which, **kwargs)
+
+ def ticklabel_format(self, *, axis='both', style='', scilimits=None,
+ useOffset=None, useLocale=None, useMathText=None):
+ r"""
+ Configure the `.ScalarFormatter` used by default for linear axes.
+
+ If a parameter is not set, the corresponding property of the formatter
+ is left unchanged.
+
+ Parameters
+ ----------
+ axis : {'x', 'y', 'both'}, default: 'both'
+ The axes to configure. Only major ticks are affected.
+
+ style : {'sci', 'scientific', 'plain'}
+ Whether to use scientific notation.
+ The formatter default is to use scientific notation.
+
+ scilimits : pair of ints (m, n)
+ Scientific notation is used only for numbers outside the range
+ 10\ :sup:`m` to 10\ :sup:`n` (and only if the formatter is
+ configured to use scientific notation at all). Use (0, 0) to
+ include all numbers. Use (m, m) where m != 0 to fix the order of
+ magnitude to 10\ :sup:`m`.
+ The formatter default is :rc:`axes.formatter.limits`.
+
+ useOffset : bool or float
+ If True, the offset is calculated as needed.
+ If False, no offset is used.
+ If a numeric value, it sets the offset.
+ The formatter default is :rc:`axes.formatter.useoffset`.
+
+ useLocale : bool
+ Whether to format the number using the current locale or using the
+ C (English) locale. This affects e.g. the decimal separator. The
+ formatter default is :rc:`axes.formatter.use_locale`.
+
+ useMathText : bool
+ Render the offset and scientific notation in mathtext.
+ The formatter default is :rc:`axes.formatter.use_mathtext`.
+
+ Raises
+ ------
+ AttributeError
+ If the current formatter is not a `.ScalarFormatter`.
+ """
+ style = style.lower()
+ axis = axis.lower()
+ if scilimits is not None:
+ try:
+ m, n = scilimits
+ m + n + 1 # check that both are numbers
+ except (ValueError, TypeError) as err:
+ raise ValueError("scilimits must be a sequence of 2 integers"
+ ) from err
+ STYLES = {'sci': True, 'scientific': True, 'plain': False, '': None}
+ is_sci_style = _api.check_getitem(STYLES, style=style)
+ axis_map = {**{k: [v] for k, v in self._get_axis_map().items()},
+ 'both': self._get_axis_list()}
+ axises = _api.check_getitem(axis_map, axis=axis)
+ try:
+ for axis in axises:
+ if is_sci_style is not None:
+ axis.major.formatter.set_scientific(is_sci_style)
+ if scilimits is not None:
+ axis.major.formatter.set_powerlimits(scilimits)
+ if useOffset is not None:
+ axis.major.formatter.set_useOffset(useOffset)
+ if useLocale is not None:
+ axis.major.formatter.set_useLocale(useLocale)
+ if useMathText is not None:
+ axis.major.formatter.set_useMathText(useMathText)
+ except AttributeError as err:
+ raise AttributeError(
+ "This method only works with the ScalarFormatter") from err
+
+ def locator_params(self, axis='both', tight=None, **kwargs):
+ """
+ Control behavior of major tick locators.
+
+ Because the locator is involved in autoscaling, `~.Axes.autoscale_view`
+ is called automatically after the parameters are changed.
+
+ Parameters
+ ----------
+ axis : {'both', 'x', 'y'}, default: 'both'
+ The axis on which to operate.
+
+ tight : bool or None, optional
+ Parameter passed to `~.Axes.autoscale_view`.
+ Default is None, for no change.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Remaining keyword arguments are passed to directly to the
+ ``set_params()`` method of the locator. Supported keywords depend
+ on the type of the locator. See for example
+ `~.ticker.MaxNLocator.set_params` for the `.ticker.MaxNLocator`
+ used by default for linear axes.
+
+ Examples
+ --------
+ When plotting small subplots, one might want to reduce the maximum
+ number of ticks and use tight bounds, for example::
+
+ ax.locator_params(tight=True, nbins=4)
+
+ """
+ _api.check_in_list(['x', 'y', 'both'], axis=axis)
+ update_x = axis in ['x', 'both']
+ update_y = axis in ['y', 'both']
+ if update_x:
+ self.xaxis.get_major_locator().set_params(**kwargs)
+ if update_y:
+ self.yaxis.get_major_locator().set_params(**kwargs)
+ self._request_autoscale_view(tight=tight,
+ scalex=update_x, scaley=update_y)
+ self.stale = True
+
+ def tick_params(self, axis='both', **kwargs):
+ """
+ Change the appearance of ticks, tick labels, and gridlines.
+
+ Tick properties that are not explicitly set using the keyword
+ arguments remain unchanged unless *reset* is True.
+
+ Parameters
+ ----------
+ axis : {'x', 'y', 'both'}, default: 'both'
+ The axis to which the parameters are applied.
+ which : {'major', 'minor', 'both'}, default: 'major'
+ The group of ticks to which the parameters are applied.
+ reset : bool, default: False
+ Whether to reset the ticks to defaults before updating them.
+
+ Other Parameters
+ ----------------
+ direction : {'in', 'out', 'inout'}
+ Puts ticks inside the axes, outside the axes, or both.
+ length : float
+ Tick length in points.
+ width : float
+ Tick width in points.
+ color : color
+ Tick color.
+ pad : float
+ Distance in points between tick and label.
+ labelsize : float or str
+ Tick label font size in points or as a string (e.g., 'large').
+ labelcolor : color
+ Tick label color.
+ colors : color
+ Tick color and label color.
+ zorder : float
+ Tick and label zorder.
+ bottom, top, left, right : bool
+ Whether to draw the respective ticks.
+ labelbottom, labeltop, labelleft, labelright : bool
+ Whether to draw the respective tick labels.
+ labelrotation : float
+ Tick label rotation
+ grid_color : color
+ Gridline color.
+ grid_alpha : float
+ Transparency of gridlines: 0 (transparent) to 1 (opaque).
+ grid_linewidth : float
+ Width of gridlines in points.
+ grid_linestyle : str
+ Any valid `.Line2D` line style spec.
+
+ Examples
+ --------
+ ::
+
+ ax.tick_params(direction='out', length=6, width=2, colors='r',
+ grid_color='r', grid_alpha=0.5)
+
+ This will make all major ticks be red, pointing out of the box,
+ and with dimensions 6 points by 2 points. Tick labels will
+ also be red. Gridlines will be red and translucent.
+
+ """
+ _api.check_in_list(['x', 'y', 'both'], axis=axis)
+ if axis in ['x', 'both']:
+ xkw = dict(kwargs)
+ xkw.pop('left', None)
+ xkw.pop('right', None)
+ xkw.pop('labelleft', None)
+ xkw.pop('labelright', None)
+ self.xaxis.set_tick_params(**xkw)
+ if axis in ['y', 'both']:
+ ykw = dict(kwargs)
+ ykw.pop('top', None)
+ ykw.pop('bottom', None)
+ ykw.pop('labeltop', None)
+ ykw.pop('labelbottom', None)
+ self.yaxis.set_tick_params(**ykw)
+
+ def set_axis_off(self):
+ """
+ Turn the x- and y-axis off.
+
+ This affects the axis lines, ticks, ticklabels, grid and axis labels.
+ """
+ self.axison = False
+ self.stale = True
+
+ def set_axis_on(self):
+ """
+ Turn the x- and y-axis on.
+
+ This affects the axis lines, ticks, ticklabels, grid and axis labels.
+ """
+ self.axison = True
+ self.stale = True
+
+ # data limits, ticks, tick labels, and formatting
+
+ def get_xlabel(self):
+ """
+ Get the xlabel text string.
+ """
+ label = self.xaxis.get_label()
+ return label.get_text()
+
+ def set_xlabel(self, xlabel, fontdict=None, labelpad=None, *,
+ loc=None, **kwargs):
+ """
+ Set the label for the x-axis.
+
+ Parameters
+ ----------
+ xlabel : str
+ The label text.
+
+ labelpad : float, default: :rc:`axes.labelpad`
+ Spacing in points from the axes bounding box including ticks
+ and tick labels. If None, the previous value is left as is.
+
+ loc : {'left', 'center', 'right'}, default: :rc:`xaxis.labellocation`
+ The label position. This is a high-level alternative for passing
+ parameters *x* and *horizontalalignment*.
+
+ Other Parameters
+ ----------------
+ **kwargs : `.Text` properties
+ `.Text` properties control the appearance of the label.
+
+ See Also
+ --------
+ text : Documents the properties supported by `.Text`.
+ """
+ if labelpad is not None:
+ self.xaxis.labelpad = labelpad
+ protected_kw = ['x', 'horizontalalignment', 'ha']
+ if {*kwargs} & {*protected_kw}:
+ if loc is not None:
+ raise TypeError(f"Specifying 'loc' is disallowed when any of "
+ f"its corresponding low level keyword "
+ f"arguments ({protected_kw}) are also "
+ f"supplied")
+ loc = 'center'
+ else:
+ loc = (loc if loc is not None
+ else mpl.rcParams['xaxis.labellocation'])
+ _api.check_in_list(('left', 'center', 'right'), loc=loc)
+ if loc == 'left':
+ kwargs.update(x=0, horizontalalignment='left')
+ elif loc == 'right':
+ kwargs.update(x=1, horizontalalignment='right')
+ return self.xaxis.set_label_text(xlabel, fontdict, **kwargs)
+
+ def invert_xaxis(self):
+ """
+ Invert the x-axis.
+
+ See Also
+ --------
+ xaxis_inverted
+ get_xlim, set_xlim
+ get_xbound, set_xbound
+ """
+ self.xaxis.set_inverted(not self.xaxis.get_inverted())
+
+ xaxis_inverted = _axis_method_wrapper("xaxis", "get_inverted")
+
+ def get_xbound(self):
+ """
+ Return the lower and upper x-axis bounds, in increasing order.
+
+ See Also
+ --------
+ set_xbound
+ get_xlim, set_xlim
+ invert_xaxis, xaxis_inverted
+ """
+ left, right = self.get_xlim()
+ if left < right:
+ return left, right
+ else:
+ return right, left
+
+ def set_xbound(self, lower=None, upper=None):
+ """
+ Set the lower and upper numerical bounds of the x-axis.
+
+ This method will honor axes inversion regardless of parameter order.
+ It will not change the autoscaling setting (`.get_autoscalex_on()`).
+
+ Parameters
+ ----------
+ lower, upper : float or None
+ The lower and upper bounds. If *None*, the respective axis bound
+ is not modified.
+
+ See Also
+ --------
+ get_xbound
+ get_xlim, set_xlim
+ invert_xaxis, xaxis_inverted
+ """
+ if upper is None and np.iterable(lower):
+ lower, upper = lower
+
+ old_lower, old_upper = self.get_xbound()
+ if lower is None:
+ lower = old_lower
+ if upper is None:
+ upper = old_upper
+
+ self.set_xlim(sorted((lower, upper),
+ reverse=bool(self.xaxis_inverted())),
+ auto=None)
+
+ def get_xlim(self):
+ """
+ Return the x-axis view limits.
+
+ Returns
+ -------
+ left, right : (float, float)
+ The current x-axis limits in data coordinates.
+
+ See Also
+ --------
+ set_xlim
+ set_xbound, get_xbound
+ invert_xaxis, xaxis_inverted
+
+ Notes
+ -----
+ The x-axis may be inverted, in which case the *left* value will
+ be greater than the *right* value.
+
+ """
+ return tuple(self.viewLim.intervalx)
+
+ def _validate_converted_limits(self, limit, convert):
+ """
+ Raise ValueError if converted limits are non-finite.
+
+ Note that this function also accepts None as a limit argument.
+
+ Returns
+ -------
+ The limit value after call to convert(), or None if limit is None.
+ """
+ if limit is not None:
+ converted_limit = convert(limit)
+ if (isinstance(converted_limit, Real)
+ and not np.isfinite(converted_limit)):
+ raise ValueError("Axis limits cannot be NaN or Inf")
+ return converted_limit
+
+ def set_xlim(self, left=None, right=None, emit=True, auto=False,
+ *, xmin=None, xmax=None):
+ """
+ Set the x-axis view limits.
+
+ Parameters
+ ----------
+ left : float, optional
+ The left xlim in data coordinates. Passing *None* leaves the
+ limit unchanged.
+
+ The left and right xlims may also be passed as the tuple
+ (*left*, *right*) as the first positional argument (or as
+ the *left* keyword argument).
+
+ .. ACCEPTS: (bottom: float, top: float)
+
+ right : float, optional
+ The right xlim in data coordinates. Passing *None* leaves the
+ limit unchanged.
+
+ emit : bool, default: True
+ Whether to notify observers of limit change.
+
+ auto : bool or None, default: False
+ Whether to turn on autoscaling of the x-axis. True turns on,
+ False turns off, None leaves unchanged.
+
+ xmin, xmax : float, optional
+ They are equivalent to left and right respectively,
+ and it is an error to pass both *xmin* and *left* or
+ *xmax* and *right*.
+
+ Returns
+ -------
+ left, right : (float, float)
+ The new x-axis limits in data coordinates.
+
+ See Also
+ --------
+ get_xlim
+ set_xbound, get_xbound
+ invert_xaxis, xaxis_inverted
+
+ Notes
+ -----
+ The *left* value may be greater than the *right* value, in which
+ case the x-axis values will decrease from left to right.
+
+ Examples
+ --------
+ >>> set_xlim(left, right)
+ >>> set_xlim((left, right))
+ >>> left, right = set_xlim(left, right)
+
+ One limit may be left unchanged.
+
+ >>> set_xlim(right=right_lim)
+
+ Limits may be passed in reverse order to flip the direction of
+ the x-axis. For example, suppose *x* represents the number of
+ years before present. The x-axis limits might be set like the
+ following so 5000 years ago is on the left of the plot and the
+ present is on the right.
+
+ >>> set_xlim(5000, 0)
+
+ """
+ if right is None and np.iterable(left):
+ left, right = left
+ if xmin is not None:
+ if left is not None:
+ raise TypeError('Cannot pass both `xmin` and `left`')
+ left = xmin
+ if xmax is not None:
+ if right is not None:
+ raise TypeError('Cannot pass both `xmax` and `right`')
+ right = xmax
+
+ self._process_unit_info([("x", (left, right))], convert=False)
+ left = self._validate_converted_limits(left, self.convert_xunits)
+ right = self._validate_converted_limits(right, self.convert_xunits)
+
+ if left is None or right is None:
+ # Axes init calls set_xlim(0, 1) before get_xlim() can be called,
+ # so only grab the limits if we really need them.
+ old_left, old_right = self.get_xlim()
+ if left is None:
+ left = old_left
+ if right is None:
+ right = old_right
+
+ if self.get_xscale() == 'log' and (left <= 0 or right <= 0):
+ # Axes init calls set_xlim(0, 1) before get_xlim() can be called,
+ # so only grab the limits if we really need them.
+ old_left, old_right = self.get_xlim()
+ if left <= 0:
+ _api.warn_external(
+ 'Attempted to set non-positive left xlim on a '
+ 'log-scaled axis.\n'
+ 'Invalid limit will be ignored.')
+ left = old_left
+ if right <= 0:
+ _api.warn_external(
+ 'Attempted to set non-positive right xlim on a '
+ 'log-scaled axis.\n'
+ 'Invalid limit will be ignored.')
+ right = old_right
+ if left == right:
+ _api.warn_external(
+ f"Attempting to set identical left == right == {left} results "
+ f"in singular transformations; automatically expanding.")
+ reverse = left > right
+ left, right = self.xaxis.get_major_locator().nonsingular(left, right)
+ left, right = self.xaxis.limit_range_for_scale(left, right)
+ # cast to bool to avoid bad interaction between python 3.8 and np.bool_
+ left, right = sorted([left, right], reverse=bool(reverse))
+
+ self._viewLim.intervalx = (left, right)
+ # Mark viewlims as no longer stale without triggering an autoscale.
+ for ax in self._shared_x_axes.get_siblings(self):
+ ax._stale_viewlim_x = False
+ if auto is not None:
+ self._autoscaleXon = bool(auto)
+
+ if emit:
+ self.callbacks.process('xlim_changed', self)
+ # Call all of the other x-axes that are shared with this one
+ for other in self._shared_x_axes.get_siblings(self):
+ if other is not self:
+ other.set_xlim(self.viewLim.intervalx,
+ emit=False, auto=auto)
+ if other.figure != self.figure:
+ other.figure.canvas.draw_idle()
+ self.stale = True
+ return left, right
+
+ get_xscale = _axis_method_wrapper("xaxis", "get_scale")
+
+ def set_xscale(self, value, **kwargs):
+ """
+ Set the x-axis scale.
+
+ Parameters
+ ----------
+ value : {"linear", "log", "symlog", "logit", ...} or `.ScaleBase`
+ The axis scale type to apply.
+
+ **kwargs
+ Different keyword arguments are accepted, depending on the scale.
+ See the respective class keyword arguments:
+
+ - `matplotlib.scale.LinearScale`
+ - `matplotlib.scale.LogScale`
+ - `matplotlib.scale.SymmetricalLogScale`
+ - `matplotlib.scale.LogitScale`
+ - `matplotlib.scale.FuncScale`
+
+ Notes
+ -----
+ By default, Matplotlib supports the above mentioned scales.
+ Additionally, custom scales may be registered using
+ `matplotlib.scale.register_scale`. These scales can then also
+ be used here.
+ """
+ old_default_lims = (self.xaxis.get_major_locator()
+ .nonsingular(-np.inf, np.inf))
+ g = self.get_shared_x_axes()
+ for ax in g.get_siblings(self):
+ ax.xaxis._set_scale(value, **kwargs)
+ ax._update_transScale()
+ ax.stale = True
+ new_default_lims = (self.xaxis.get_major_locator()
+ .nonsingular(-np.inf, np.inf))
+ if old_default_lims != new_default_lims:
+ # Force autoscaling now, to take advantage of the scale locator's
+ # nonsingular() before it possibly gets swapped out by the user.
+ self.autoscale_view(scaley=False)
+
+ get_xticks = _axis_method_wrapper("xaxis", "get_ticklocs")
+ set_xticks = _axis_method_wrapper("xaxis", "set_ticks")
+ get_xmajorticklabels = _axis_method_wrapper("xaxis", "get_majorticklabels")
+ get_xminorticklabels = _axis_method_wrapper("xaxis", "get_minorticklabels")
+ get_xticklabels = _axis_method_wrapper("xaxis", "get_ticklabels")
+ set_xticklabels = _axis_method_wrapper(
+ "xaxis", "_set_ticklabels",
+ doc_sub={"Axis.set_ticks": "Axes.set_xticks"})
+
+ def get_ylabel(self):
+ """
+ Get the ylabel text string.
+ """
+ label = self.yaxis.get_label()
+ return label.get_text()
+
+ def set_ylabel(self, ylabel, fontdict=None, labelpad=None, *,
+ loc=None, **kwargs):
+ """
+ Set the label for the y-axis.
+
+ Parameters
+ ----------
+ ylabel : str
+ The label text.
+
+ labelpad : float, default: :rc:`axes.labelpad`
+ Spacing in points from the axes bounding box including ticks
+ and tick labels. If None, the previous value is left as is.
+
+ loc : {'bottom', 'center', 'top'}, default: :rc:`yaxis.labellocation`
+ The label position. This is a high-level alternative for passing
+ parameters *y* and *horizontalalignment*.
+
+ Other Parameters
+ ----------------
+ **kwargs : `.Text` properties
+ `.Text` properties control the appearance of the label.
+
+ See Also
+ --------
+ text : Documents the properties supported by `.Text`.
+ """
+ if labelpad is not None:
+ self.yaxis.labelpad = labelpad
+ protected_kw = ['y', 'horizontalalignment', 'ha']
+ if {*kwargs} & {*protected_kw}:
+ if loc is not None:
+ raise TypeError(f"Specifying 'loc' is disallowed when any of "
+ f"its corresponding low level keyword "
+ f"arguments ({protected_kw}) are also "
+ f"supplied")
+ loc = 'center'
+ else:
+ loc = (loc if loc is not None
+ else mpl.rcParams['yaxis.labellocation'])
+ _api.check_in_list(('bottom', 'center', 'top'), loc=loc)
+ if loc == 'bottom':
+ kwargs.update(y=0, horizontalalignment='left')
+ elif loc == 'top':
+ kwargs.update(y=1, horizontalalignment='right')
+ return self.yaxis.set_label_text(ylabel, fontdict, **kwargs)
+
+ def invert_yaxis(self):
+ """
+ Invert the y-axis.
+
+ See Also
+ --------
+ yaxis_inverted
+ get_ylim, set_ylim
+ get_ybound, set_ybound
+ """
+ self.yaxis.set_inverted(not self.yaxis.get_inverted())
+
+ yaxis_inverted = _axis_method_wrapper("yaxis", "get_inverted")
+
+ def get_ybound(self):
+ """
+ Return the lower and upper y-axis bounds, in increasing order.
+
+ See Also
+ --------
+ set_ybound
+ get_ylim, set_ylim
+ invert_yaxis, yaxis_inverted
+ """
+ bottom, top = self.get_ylim()
+ if bottom < top:
+ return bottom, top
+ else:
+ return top, bottom
+
+ def set_ybound(self, lower=None, upper=None):
+ """
+ Set the lower and upper numerical bounds of the y-axis.
+
+ This method will honor axes inversion regardless of parameter order.
+ It will not change the autoscaling setting (`.get_autoscaley_on()`).
+
+ Parameters
+ ----------
+ lower, upper : float or None
+ The lower and upper bounds. If *None*, the respective axis bound
+ is not modified.
+
+ See Also
+ --------
+ get_ybound
+ get_ylim, set_ylim
+ invert_yaxis, yaxis_inverted
+ """
+ if upper is None and np.iterable(lower):
+ lower, upper = lower
+
+ old_lower, old_upper = self.get_ybound()
+ if lower is None:
+ lower = old_lower
+ if upper is None:
+ upper = old_upper
+
+ self.set_ylim(sorted((lower, upper),
+ reverse=bool(self.yaxis_inverted())),
+ auto=None)
+
+ def get_ylim(self):
+ """
+ Return the y-axis view limits.
+
+ Returns
+ -------
+ bottom, top : (float, float)
+ The current y-axis limits in data coordinates.
+
+ See Also
+ --------
+ set_ylim
+ set_ybound, get_ybound
+ invert_yaxis, yaxis_inverted
+
+ Notes
+ -----
+ The y-axis may be inverted, in which case the *bottom* value
+ will be greater than the *top* value.
+
+ """
+ return tuple(self.viewLim.intervaly)
+
+ def set_ylim(self, bottom=None, top=None, emit=True, auto=False,
+ *, ymin=None, ymax=None):
+ """
+ Set the y-axis view limits.
+
+ Parameters
+ ----------
+ bottom : float, optional
+ The bottom ylim in data coordinates. Passing *None* leaves the
+ limit unchanged.
+
+ The bottom and top ylims may also be passed as the tuple
+ (*bottom*, *top*) as the first positional argument (or as
+ the *bottom* keyword argument).
+
+ .. ACCEPTS: (bottom: float, top: float)
+
+ top : float, optional
+ The top ylim in data coordinates. Passing *None* leaves the
+ limit unchanged.
+
+ emit : bool, default: True
+ Whether to notify observers of limit change.
+
+ auto : bool or None, default: False
+ Whether to turn on autoscaling of the y-axis. *True* turns on,
+ *False* turns off, *None* leaves unchanged.
+
+ ymin, ymax : float, optional
+ They are equivalent to bottom and top respectively,
+ and it is an error to pass both *ymin* and *bottom* or
+ *ymax* and *top*.
+
+ Returns
+ -------
+ bottom, top : (float, float)
+ The new y-axis limits in data coordinates.
+
+ See Also
+ --------
+ get_ylim
+ set_ybound, get_ybound
+ invert_yaxis, yaxis_inverted
+
+ Notes
+ -----
+ The *bottom* value may be greater than the *top* value, in which
+ case the y-axis values will decrease from *bottom* to *top*.
+
+ Examples
+ --------
+ >>> set_ylim(bottom, top)
+ >>> set_ylim((bottom, top))
+ >>> bottom, top = set_ylim(bottom, top)
+
+ One limit may be left unchanged.
+
+ >>> set_ylim(top=top_lim)
+
+ Limits may be passed in reverse order to flip the direction of
+ the y-axis. For example, suppose ``y`` represents depth of the
+ ocean in m. The y-axis limits might be set like the following
+ so 5000 m depth is at the bottom of the plot and the surface,
+ 0 m, is at the top.
+
+ >>> set_ylim(5000, 0)
+ """
+ if top is None and np.iterable(bottom):
+ bottom, top = bottom
+ if ymin is not None:
+ if bottom is not None:
+ raise TypeError('Cannot pass both `ymin` and `bottom`')
+ bottom = ymin
+ if ymax is not None:
+ if top is not None:
+ raise TypeError('Cannot pass both `ymax` and `top`')
+ top = ymax
+
+ self._process_unit_info([("y", (bottom, top))], convert=False)
+ bottom = self._validate_converted_limits(bottom, self.convert_yunits)
+ top = self._validate_converted_limits(top, self.convert_yunits)
+
+ if bottom is None or top is None:
+ # Axes init calls set_ylim(0, 1) before get_ylim() can be called,
+ # so only grab the limits if we really need them.
+ old_bottom, old_top = self.get_ylim()
+ if bottom is None:
+ bottom = old_bottom
+ if top is None:
+ top = old_top
+
+ if self.get_yscale() == 'log' and (bottom <= 0 or top <= 0):
+ # Axes init calls set_xlim(0, 1) before get_xlim() can be called,
+ # so only grab the limits if we really need them.
+ old_bottom, old_top = self.get_ylim()
+ if bottom <= 0:
+ _api.warn_external(
+ 'Attempted to set non-positive bottom ylim on a '
+ 'log-scaled axis.\n'
+ 'Invalid limit will be ignored.')
+ bottom = old_bottom
+ if top <= 0:
+ _api.warn_external(
+ 'Attempted to set non-positive top ylim on a '
+ 'log-scaled axis.\n'
+ 'Invalid limit will be ignored.')
+ top = old_top
+ if bottom == top:
+ _api.warn_external(
+ f"Attempting to set identical bottom == top == {bottom} "
+ f"results in singular transformations; automatically "
+ f"expanding.")
+ reverse = bottom > top
+ bottom, top = self.yaxis.get_major_locator().nonsingular(bottom, top)
+ bottom, top = self.yaxis.limit_range_for_scale(bottom, top)
+ # cast to bool to avoid bad interaction between python 3.8 and np.bool_
+ bottom, top = sorted([bottom, top], reverse=bool(reverse))
+
+ self._viewLim.intervaly = (bottom, top)
+ # Mark viewlims as no longer stale without triggering an autoscale.
+ for ax in self._shared_y_axes.get_siblings(self):
+ ax._stale_viewlim_y = False
+ if auto is not None:
+ self._autoscaleYon = bool(auto)
+
+ if emit:
+ self.callbacks.process('ylim_changed', self)
+ # Call all of the other y-axes that are shared with this one
+ for other in self._shared_y_axes.get_siblings(self):
+ if other is not self:
+ other.set_ylim(self.viewLim.intervaly,
+ emit=False, auto=auto)
+ if other.figure != self.figure:
+ other.figure.canvas.draw_idle()
+ self.stale = True
+ return bottom, top
+
+ get_yscale = _axis_method_wrapper("yaxis", "get_scale")
+
+ def set_yscale(self, value, **kwargs):
+ """
+ Set the y-axis scale.
+
+ Parameters
+ ----------
+ value : {"linear", "log", "symlog", "logit", ...} or `.ScaleBase`
+ The axis scale type to apply.
+
+ **kwargs
+ Different keyword arguments are accepted, depending on the scale.
+ See the respective class keyword arguments:
+
+ - `matplotlib.scale.LinearScale`
+ - `matplotlib.scale.LogScale`
+ - `matplotlib.scale.SymmetricalLogScale`
+ - `matplotlib.scale.LogitScale`
+ - `matplotlib.scale.FuncScale`
+
+ Notes
+ -----
+ By default, Matplotlib supports the above mentioned scales.
+ Additionally, custom scales may be registered using
+ `matplotlib.scale.register_scale`. These scales can then also
+ be used here.
+ """
+ old_default_lims = (self.yaxis.get_major_locator()
+ .nonsingular(-np.inf, np.inf))
+ g = self.get_shared_y_axes()
+ for ax in g.get_siblings(self):
+ ax.yaxis._set_scale(value, **kwargs)
+ ax._update_transScale()
+ ax.stale = True
+ new_default_lims = (self.yaxis.get_major_locator()
+ .nonsingular(-np.inf, np.inf))
+ if old_default_lims != new_default_lims:
+ # Force autoscaling now, to take advantage of the scale locator's
+ # nonsingular() before it possibly gets swapped out by the user.
+ self.autoscale_view(scalex=False)
+
+ get_yticks = _axis_method_wrapper("yaxis", "get_ticklocs")
+ set_yticks = _axis_method_wrapper("yaxis", "set_ticks")
+ get_ymajorticklabels = _axis_method_wrapper("yaxis", "get_majorticklabels")
+ get_yminorticklabels = _axis_method_wrapper("yaxis", "get_minorticklabels")
+ get_yticklabels = _axis_method_wrapper("yaxis", "get_ticklabels")
+ set_yticklabels = _axis_method_wrapper(
+ "yaxis", "_set_ticklabels",
+ doc_sub={"Axis.set_ticks": "Axes.set_yticks"})
+
+ xaxis_date = _axis_method_wrapper("xaxis", "axis_date")
+ yaxis_date = _axis_method_wrapper("yaxis", "axis_date")
+
+ def format_xdata(self, x):
+ """
+ Return *x* formatted as an x-value.
+
+ This function will use the `.fmt_xdata` attribute if it is not None,
+ else will fall back on the xaxis major formatter.
+ """
+ return (self.fmt_xdata if self.fmt_xdata is not None
+ else self.xaxis.get_major_formatter().format_data_short)(x)
+
+ def format_ydata(self, y):
+ """
+ Return *y* formatted as an y-value.
+
+ This function will use the `.fmt_ydata` attribute if it is not None,
+ else will fall back on the yaxis major formatter.
+ """
+ return (self.fmt_ydata if self.fmt_ydata is not None
+ else self.yaxis.get_major_formatter().format_data_short)(y)
+
+ def format_coord(self, x, y):
+ """Return a format string formatting the *x*, *y* coordinates."""
+ if x is None:
+ xs = '???'
+ else:
+ xs = self.format_xdata(x)
+ if y is None:
+ ys = '???'
+ else:
+ ys = self.format_ydata(y)
+ return 'x=%s y=%s' % (xs, ys)
+
+ def minorticks_on(self):
+ """
+ Display minor ticks on the axes.
+
+ Displaying minor ticks may reduce performance; you may turn them off
+ using `minorticks_off()` if drawing speed is a problem.
+ """
+ for ax in (self.xaxis, self.yaxis):
+ scale = ax.get_scale()
+ if scale == 'log':
+ s = ax._scale
+ ax.set_minor_locator(mticker.LogLocator(s.base, s.subs))
+ elif scale == 'symlog':
+ s = ax._scale
+ ax.set_minor_locator(
+ mticker.SymmetricalLogLocator(s._transform, s.subs))
+ else:
+ ax.set_minor_locator(mticker.AutoMinorLocator())
+
+ def minorticks_off(self):
+ """Remove minor ticks from the axes."""
+ self.xaxis.set_minor_locator(mticker.NullLocator())
+ self.yaxis.set_minor_locator(mticker.NullLocator())
+
+ # Interactive manipulation
+
+ def can_zoom(self):
+ """
+ Return whether this axes supports the zoom box button functionality.
+ """
+ return True
+
+ def can_pan(self):
+ """
+ Return whether this axes supports any pan/zoom button functionality.
+ """
+ return True
+
+ def get_navigate(self):
+ """
+ Get whether the axes responds to navigation commands
+ """
+ return self._navigate
+
+ def set_navigate(self, b):
+ """
+ Set whether the axes responds to navigation toolbar commands
+
+ Parameters
+ ----------
+ b : bool
+ """
+ self._navigate = b
+
+ def get_navigate_mode(self):
+ """
+ Get the navigation toolbar button status: 'PAN', 'ZOOM', or None
+ """
+ return self._navigate_mode
+
+ def set_navigate_mode(self, b):
+ """
+ Set the navigation toolbar button status;
+
+ .. warning ::
+ this is not a user-API function.
+
+ """
+ self._navigate_mode = b
+
+ def _get_view(self):
+ """
+ Save information required to reproduce the current view.
+
+ Called before a view is changed, such as during a pan or zoom
+ initiated by the user. You may return any information you deem
+ necessary to describe the view.
+
+ .. note::
+
+ Intended to be overridden by new projection types, but if not, the
+ default implementation saves the view limits. You *must* implement
+ :meth:`_set_view` if you implement this method.
+ """
+ xmin, xmax = self.get_xlim()
+ ymin, ymax = self.get_ylim()
+ return xmin, xmax, ymin, ymax
+
+ def _set_view(self, view):
+ """
+ Apply a previously saved view.
+
+ Called when restoring a view, such as with the navigation buttons.
+
+ .. note::
+
+ Intended to be overridden by new projection types, but if not, the
+ default implementation restores the view limits. You *must*
+ implement :meth:`_get_view` if you implement this method.
+ """
+ xmin, xmax, ymin, ymax = view
+ self.set_xlim((xmin, xmax))
+ self.set_ylim((ymin, ymax))
+
+ def _set_view_from_bbox(self, bbox, direction='in',
+ mode=None, twinx=False, twiny=False):
+ """
+ Update view from a selection bbox.
+
+ .. note::
+
+ Intended to be overridden by new projection types, but if not, the
+ default implementation sets the view limits to the bbox directly.
+
+ Parameters
+ ----------
+ bbox : 4-tuple or 3 tuple
+ * If bbox is a 4 tuple, it is the selected bounding box limits,
+ in *display* coordinates.
+ * If bbox is a 3 tuple, it is an (xp, yp, scl) triple, where
+ (xp, yp) is the center of zooming and scl the scale factor to
+ zoom by.
+
+ direction : str
+ The direction to apply the bounding box.
+ * `'in'` - The bounding box describes the view directly, i.e.,
+ it zooms in.
+ * `'out'` - The bounding box describes the size to make the
+ existing view, i.e., it zooms out.
+
+ mode : str or None
+ The selection mode, whether to apply the bounding box in only the
+ `'x'` direction, `'y'` direction or both (`None`).
+
+ twinx : bool
+ Whether this axis is twinned in the *x*-direction.
+
+ twiny : bool
+ Whether this axis is twinned in the *y*-direction.
+ """
+ if len(bbox) == 3:
+ Xmin, Xmax = self.get_xlim()
+ Ymin, Ymax = self.get_ylim()
+
+ xp, yp, scl = bbox # Zooming code
+
+ if scl == 0: # Should not happen
+ scl = 1.
+
+ if scl > 1:
+ direction = 'in'
+ else:
+ direction = 'out'
+ scl = 1/scl
+
+ # get the limits of the axes
+ tranD2C = self.transData.transform
+ xmin, ymin = tranD2C((Xmin, Ymin))
+ xmax, ymax = tranD2C((Xmax, Ymax))
+
+ # set the range
+ xwidth = xmax - xmin
+ ywidth = ymax - ymin
+ xcen = (xmax + xmin)*.5
+ ycen = (ymax + ymin)*.5
+ xzc = (xp*(scl - 1) + xcen)/scl
+ yzc = (yp*(scl - 1) + ycen)/scl
+
+ bbox = [xzc - xwidth/2./scl, yzc - ywidth/2./scl,
+ xzc + xwidth/2./scl, yzc + ywidth/2./scl]
+ elif len(bbox) != 4:
+ # should be len 3 or 4 but nothing else
+ _api.warn_external(
+ "Warning in _set_view_from_bbox: bounding box is not a tuple "
+ "of length 3 or 4. Ignoring the view change.")
+ return
+
+ # Original limits.
+ xmin0, xmax0 = self.get_xbound()
+ ymin0, ymax0 = self.get_ybound()
+ # The zoom box in screen coords.
+ startx, starty, stopx, stopy = bbox
+ # Convert to data coords.
+ (startx, starty), (stopx, stopy) = self.transData.inverted().transform(
+ [(startx, starty), (stopx, stopy)])
+ # Clip to axes limits.
+ xmin, xmax = np.clip(sorted([startx, stopx]), xmin0, xmax0)
+ ymin, ymax = np.clip(sorted([starty, stopy]), ymin0, ymax0)
+ # Don't double-zoom twinned axes or if zooming only the other axis.
+ if twinx or mode == "y":
+ xmin, xmax = xmin0, xmax0
+ if twiny or mode == "x":
+ ymin, ymax = ymin0, ymax0
+
+ if direction == "in":
+ new_xbound = xmin, xmax
+ new_ybound = ymin, ymax
+
+ elif direction == "out":
+ x_trf = self.xaxis.get_transform()
+ sxmin0, sxmax0, sxmin, sxmax = x_trf.transform(
+ [xmin0, xmax0, xmin, xmax]) # To screen space.
+ factor = (sxmax0 - sxmin0) / (sxmax - sxmin) # Unzoom factor.
+ # Move original bounds away by
+ # (factor) x (distance between unzoom box and axes bbox).
+ sxmin1 = sxmin0 - factor * (sxmin - sxmin0)
+ sxmax1 = sxmax0 + factor * (sxmax0 - sxmax)
+ # And back to data space.
+ new_xbound = x_trf.inverted().transform([sxmin1, sxmax1])
+
+ y_trf = self.yaxis.get_transform()
+ symin0, symax0, symin, symax = y_trf.transform(
+ [ymin0, ymax0, ymin, ymax])
+ factor = (symax0 - symin0) / (symax - symin)
+ symin1 = symin0 - factor * (symin - symin0)
+ symax1 = symax0 + factor * (symax0 - symax)
+ new_ybound = y_trf.inverted().transform([symin1, symax1])
+
+ if not twinx and mode != "y":
+ self.set_xbound(new_xbound)
+ if not twiny and mode != "x":
+ self.set_ybound(new_ybound)
+
+ def start_pan(self, x, y, button):
+ """
+ Called when a pan operation has started.
+
+ Parameters
+ ----------
+ x, y : float
+ The mouse coordinates in display coords.
+ button : `.MouseButton`
+ The pressed mouse button.
+
+ Notes
+ -----
+ This is intended to be overridden by new projection types.
+ """
+ self._pan_start = types.SimpleNamespace(
+ lim=self.viewLim.frozen(),
+ trans=self.transData.frozen(),
+ trans_inverse=self.transData.inverted().frozen(),
+ bbox=self.bbox.frozen(),
+ x=x,
+ y=y)
+
+ def end_pan(self):
+ """
+ Called when a pan operation completes (when the mouse button is up.)
+
+ Notes
+ -----
+ This is intended to be overridden by new projection types.
+ """
+ del self._pan_start
+
+ def drag_pan(self, button, key, x, y):
+ """
+ Called when the mouse moves during a pan operation.
+
+ Parameters
+ ----------
+ button : `.MouseButton`
+ The pressed mouse button.
+ key : str or None
+ The pressed key, if any.
+ x, y : float
+ The mouse coordinates in display coords.
+
+ Notes
+ -----
+ This is intended to be overridden by new projection types.
+ """
+ def format_deltas(key, dx, dy):
+ if key == 'control':
+ if abs(dx) > abs(dy):
+ dy = dx
+ else:
+ dx = dy
+ elif key == 'x':
+ dy = 0
+ elif key == 'y':
+ dx = 0
+ elif key == 'shift':
+ if 2 * abs(dx) < abs(dy):
+ dx = 0
+ elif 2 * abs(dy) < abs(dx):
+ dy = 0
+ elif abs(dx) > abs(dy):
+ dy = dy / abs(dy) * abs(dx)
+ else:
+ dx = dx / abs(dx) * abs(dy)
+ return dx, dy
+
+ p = self._pan_start
+ dx = x - p.x
+ dy = y - p.y
+ if dx == dy == 0:
+ return
+ if button == 1:
+ dx, dy = format_deltas(key, dx, dy)
+ result = p.bbox.translated(-dx, -dy).transformed(p.trans_inverse)
+ elif button == 3:
+ try:
+ dx = -dx / self.bbox.width
+ dy = -dy / self.bbox.height
+ dx, dy = format_deltas(key, dx, dy)
+ if self.get_aspect() != 'auto':
+ dx = dy = 0.5 * (dx + dy)
+ alpha = np.power(10.0, (dx, dy))
+ start = np.array([p.x, p.y])
+ oldpoints = p.lim.transformed(p.trans)
+ newpoints = start + alpha * (oldpoints - start)
+ result = (mtransforms.Bbox(newpoints)
+ .transformed(p.trans_inverse))
+ except OverflowError:
+ _api.warn_external('Overflow while panning')
+ return
+ else:
+ return
+
+ valid = np.isfinite(result.transformed(p.trans))
+ points = result.get_points().astype(object)
+ # Just ignore invalid limits (typically, underflow in log-scale).
+ points[~valid] = None
+ self.set_xlim(points[:, 0])
+ self.set_ylim(points[:, 1])
+
+ def get_children(self):
+ # docstring inherited.
+ return [
+ *self.collections,
+ *self.patches,
+ *self.lines,
+ *self.texts,
+ *self.artists,
+ *self.spines.values(),
+ *self._get_axis_list(),
+ self.title, self._left_title, self._right_title,
+ *self.tables,
+ *self.images,
+ *self.child_axes,
+ *([self.legend_] if self.legend_ is not None else []),
+ self.patch,
+ ]
+
+ def contains(self, mouseevent):
+ # docstring inherited.
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+ return self.patch.contains(mouseevent)
+
+ def contains_point(self, point):
+ """
+ Return whether *point* (pair of pixel coordinates) is inside the axes
+ patch.
+ """
+ return self.patch.contains_point(point, radius=1.0)
+
+ def get_default_bbox_extra_artists(self):
+ """
+ Return a default list of artists that are used for the bounding box
+ calculation.
+
+ Artists are excluded either by not being visible or
+ ``artist.set_in_layout(False)``.
+ """
+
+ artists = self.get_children()
+
+ if not (self.axison and self._frameon):
+ # don't do bbox on spines if frame not on.
+ for spine in self.spines.values():
+ artists.remove(spine)
+
+ if not self.axison:
+ for _axis in self._get_axis_list():
+ artists.remove(_axis)
+
+ artists.remove(self.title)
+ artists.remove(self._left_title)
+ artists.remove(self._right_title)
+
+ return [artist for artist in artists
+ if (artist.get_visible() and artist.get_in_layout())]
+
+ def get_tightbbox(self, renderer, call_axes_locator=True,
+ bbox_extra_artists=None, *, for_layout_only=False):
+ """
+ Return the tight bounding box of the axes, including axis and their
+ decorators (xlabel, title, etc).
+
+ Artists that have ``artist.set_in_layout(False)`` are not included
+ in the bbox.
+
+ Parameters
+ ----------
+ renderer : `.RendererBase` subclass
+ renderer that will be used to draw the figures (i.e.
+ ``fig.canvas.get_renderer()``)
+
+ bbox_extra_artists : list of `.Artist` or ``None``
+ List of artists to include in the tight bounding box. If
+ ``None`` (default), then all artist children of the axes are
+ included in the tight bounding box.
+
+ call_axes_locator : bool, default: True
+ If *call_axes_locator* is ``False``, it does not call the
+ ``_axes_locator`` attribute, which is necessary to get the correct
+ bounding box. ``call_axes_locator=False`` can be used if the
+ caller is only interested in the relative size of the tightbbox
+ compared to the axes bbox.
+
+ for_layout_only : default: False
+ The bounding box will *not* include the x-extent of the title and
+ the xlabel, or the y-extent of the ylabel.
+
+ Returns
+ -------
+ `.BboxBase`
+ Bounding box in figure pixel coordinates.
+
+ See Also
+ --------
+ matplotlib.axes.Axes.get_window_extent
+ matplotlib.axis.Axis.get_tightbbox
+ matplotlib.spines.Spine.get_window_extent
+ """
+
+ bb = []
+
+ if not self.get_visible():
+ return None
+
+ locator = self.get_axes_locator()
+ if locator and call_axes_locator:
+ pos = locator(self, renderer)
+ self.apply_aspect(pos)
+ else:
+ self.apply_aspect()
+
+ if self.axison:
+ if self.xaxis.get_visible():
+ try:
+ bb_xaxis = self.xaxis.get_tightbbox(
+ renderer, for_layout_only=for_layout_only)
+ except TypeError:
+ # in case downstream library has redefined axis:
+ bb_xaxis = self.xaxis.get_tightbbox(renderer)
+ if bb_xaxis:
+ bb.append(bb_xaxis)
+ if self.yaxis.get_visible():
+ try:
+ bb_yaxis = self.yaxis.get_tightbbox(
+ renderer, for_layout_only=for_layout_only)
+ except TypeError:
+ # in case downstream library has redefined axis:
+ bb_yaxis = self.yaxis.get_tightbbox(renderer)
+ if bb_yaxis:
+ bb.append(bb_yaxis)
+ self._update_title_position(renderer)
+ axbbox = self.get_window_extent(renderer)
+ bb.append(axbbox)
+
+ for title in [self.title, self._left_title, self._right_title]:
+ if title.get_visible():
+ bt = title.get_window_extent(renderer)
+ if for_layout_only and bt.width > 0:
+ # make the title bbox 1 pixel wide so its width
+ # is not accounted for in bbox calculations in
+ # tight/constrained_layout
+ bt.x0 = (bt.x0 + bt.x1) / 2 - 0.5
+ bt.x1 = bt.x0 + 1.0
+ bb.append(bt)
+
+ bbox_artists = bbox_extra_artists
+ if bbox_artists is None:
+ bbox_artists = self.get_default_bbox_extra_artists()
+
+ for a in bbox_artists:
+ # Extra check here to quickly see if clipping is on and
+ # contained in the axes. If it is, don't get the tightbbox for
+ # this artist because this can be expensive:
+ clip_extent = a._get_clipping_extent_bbox()
+ if clip_extent is not None:
+ clip_extent = mtransforms.Bbox.intersection(
+ clip_extent, axbbox)
+ if np.all(clip_extent.extents == axbbox.extents):
+ # clip extent is inside the axes bbox so don't check
+ # this artist
+ continue
+ bbox = a.get_tightbbox(renderer)
+ if (bbox is not None
+ and 0 < bbox.width < np.inf
+ and 0 < bbox.height < np.inf):
+ bb.append(bbox)
+ return mtransforms.Bbox.union(
+ [b for b in bb if b.width != 0 or b.height != 0])
+
+ def _make_twin_axes(self, *args, **kwargs):
+ """Make a twinx axes of self. This is used for twinx and twiny."""
+ # Typically, SubplotBase._make_twin_axes is called instead of this.
+ if 'sharex' in kwargs and 'sharey' in kwargs:
+ raise ValueError("Twinned Axes may share only one axis")
+ ax2 = self.figure.add_axes(
+ self.get_position(True), *args, **kwargs,
+ axes_locator=_TransformedBoundsLocator(
+ [0, 0, 1, 1], self.transAxes))
+ self.set_adjustable('datalim')
+ ax2.set_adjustable('datalim')
+ self._twinned_axes.join(self, ax2)
+ return ax2
+
+ def twinx(self):
+ """
+ Create a twin Axes sharing the xaxis.
+
+ Create a new Axes with an invisible x-axis and an independent
+ y-axis positioned opposite to the original one (i.e. at right). The
+ x-axis autoscale setting will be inherited from the original
+ Axes. To ensure that the tick marks of both y-axes align, see
+ `~matplotlib.ticker.LinearLocator`.
+
+ Returns
+ -------
+ Axes
+ The newly created Axes instance
+
+ Notes
+ -----
+ For those who are 'picking' artists while using twinx, pick
+ events are only called for the artists in the top-most axes.
+ """
+ ax2 = self._make_twin_axes(sharex=self)
+ ax2.yaxis.tick_right()
+ ax2.yaxis.set_label_position('right')
+ ax2.yaxis.set_offset_position('right')
+ ax2.set_autoscalex_on(self.get_autoscalex_on())
+ self.yaxis.tick_left()
+ ax2.xaxis.set_visible(False)
+ ax2.patch.set_visible(False)
+ return ax2
+
+ def twiny(self):
+ """
+ Create a twin Axes sharing the yaxis.
+
+ Create a new Axes with an invisible y-axis and an independent
+ x-axis positioned opposite to the original one (i.e. at top). The
+ y-axis autoscale setting will be inherited from the original Axes.
+ To ensure that the tick marks of both x-axes align, see
+ `~matplotlib.ticker.LinearLocator`.
+
+ Returns
+ -------
+ Axes
+ The newly created Axes instance
+
+ Notes
+ -----
+ For those who are 'picking' artists while using twiny, pick
+ events are only called for the artists in the top-most axes.
+ """
+ ax2 = self._make_twin_axes(sharey=self)
+ ax2.xaxis.tick_top()
+ ax2.xaxis.set_label_position('top')
+ ax2.set_autoscaley_on(self.get_autoscaley_on())
+ self.xaxis.tick_bottom()
+ ax2.yaxis.set_visible(False)
+ ax2.patch.set_visible(False)
+ return ax2
+
+ def get_shared_x_axes(self):
+ """Return a reference to the shared axes Grouper object for x axes."""
+ return self._shared_x_axes
+
+ def get_shared_y_axes(self):
+ """Return a reference to the shared axes Grouper object for y axes."""
+ return self._shared_y_axes
diff --git a/venv/Lib/site-packages/matplotlib/axes/_secondary_axes.py b/venv/Lib/site-packages/matplotlib/axes/_secondary_axes.py
new file mode 100644
index 0000000..98a6120
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/axes/_secondary_axes.py
@@ -0,0 +1,304 @@
+import numpy as np
+
+from matplotlib import _api
+import matplotlib.docstring as docstring
+import matplotlib.ticker as mticker
+from matplotlib.axes._base import _AxesBase, _TransformedBoundsLocator
+
+
+class SecondaryAxis(_AxesBase):
+ """
+ General class to hold a Secondary_X/Yaxis.
+ """
+
+ def __init__(self, parent, orientation, location, functions, **kwargs):
+ """
+ See `.secondary_xaxis` and `.secondary_yaxis` for the doc string.
+ While there is no need for this to be private, it should really be
+ called by those higher level functions.
+ """
+
+ self._functions = functions
+ self._parent = parent
+ self._orientation = orientation
+ self._ticks_set = False
+
+ if self._orientation == 'x':
+ super().__init__(self._parent.figure, [0, 1., 1, 0.0001], **kwargs)
+ self._axis = self.xaxis
+ self._locstrings = ['top', 'bottom']
+ self._otherstrings = ['left', 'right']
+ elif self._orientation == 'y':
+ super().__init__(self._parent.figure, [0, 1., 0.0001, 1], **kwargs)
+ self._axis = self.yaxis
+ self._locstrings = ['right', 'left']
+ self._otherstrings = ['top', 'bottom']
+ self._parentscale = None
+ # this gets positioned w/o constrained_layout so exclude:
+
+ self.set_location(location)
+ self.set_functions(functions)
+
+ # styling:
+ if self._orientation == 'x':
+ otheraxis = self.yaxis
+ else:
+ otheraxis = self.xaxis
+
+ otheraxis.set_major_locator(mticker.NullLocator())
+ otheraxis.set_ticks_position('none')
+
+ self.spines[self._otherstrings].set_visible(False)
+ self.spines[self._locstrings].set_visible(True)
+
+ if self._pos < 0.5:
+ # flip the location strings...
+ self._locstrings = self._locstrings[::-1]
+ self.set_alignment(self._locstrings[0])
+
+ def set_alignment(self, align):
+ """
+ Set if axes spine and labels are drawn at top or bottom (or left/right)
+ of the axes.
+
+ Parameters
+ ----------
+ align : str
+ either 'top' or 'bottom' for orientation='x' or
+ 'left' or 'right' for orientation='y' axis.
+ """
+ _api.check_in_list(self._locstrings, align=align)
+ if align == self._locstrings[1]: # Need to change the orientation.
+ self._locstrings = self._locstrings[::-1]
+ self.spines[self._locstrings[0]].set_visible(True)
+ self.spines[self._locstrings[1]].set_visible(False)
+ self._axis.set_ticks_position(align)
+ self._axis.set_label_position(align)
+
+ def set_location(self, location):
+ """
+ Set the vertical or horizontal location of the axes in
+ parent-normalized coordinates.
+
+ Parameters
+ ----------
+ location : {'top', 'bottom', 'left', 'right'} or float
+ The position to put the secondary axis. Strings can be 'top' or
+ 'bottom' for orientation='x' and 'right' or 'left' for
+ orientation='y'. A float indicates the relative position on the
+ parent axes to put the new axes, 0.0 being the bottom (or left)
+ and 1.0 being the top (or right).
+ """
+
+ # This puts the rectangle into figure-relative coordinates.
+ if isinstance(location, str):
+ if location in ['top', 'right']:
+ self._pos = 1.
+ elif location in ['bottom', 'left']:
+ self._pos = 0.
+ else:
+ raise ValueError(
+ f"location must be {self._locstrings[0]!r}, "
+ f"{self._locstrings[1]!r}, or a float, not {location!r}")
+ else:
+ self._pos = location
+ self._loc = location
+
+ if self._orientation == 'x':
+ # An x-secondary axes is like an inset axes from x = 0 to x = 1 and
+ # from y = pos to y = pos + eps, in the parent's transAxes coords.
+ bounds = [0, self._pos, 1., 1e-10]
+ else:
+ bounds = [self._pos, 0, 1e-10, 1]
+
+ # this locator lets the axes move in the parent axes coordinates.
+ # so it never needs to know where the parent is explicitly in
+ # figure coordinates.
+ # it gets called in ax.apply_aspect() (of all places)
+ self.set_axes_locator(
+ _TransformedBoundsLocator(bounds, self._parent.transAxes))
+
+ def apply_aspect(self, position=None):
+ # docstring inherited.
+ self._set_lims()
+ super().apply_aspect(position)
+
+ def set_ticks(self, ticks, *, minor=False):
+ """
+ Set the x ticks with list of *ticks*
+
+ Parameters
+ ----------
+ ticks : list
+ List of x-axis tick locations.
+ minor : bool, default: False
+ If ``False`` sets major ticks, if ``True`` sets minor ticks.
+ """
+ ret = self._axis.set_ticks(ticks, minor=minor)
+ self.stale = True
+ self._ticks_set = True
+ return ret
+
+ def set_functions(self, functions):
+ """
+ Set how the secondary axis converts limits from the parent axes.
+
+ Parameters
+ ----------
+ functions : 2-tuple of func, or `Transform` with an inverse.
+ Transform between the parent axis values and the secondary axis
+ values.
+
+ If supplied as a 2-tuple of functions, the first function is
+ the forward transform function and the second is the inverse
+ transform.
+
+ If a transform is supplied, then the transform must have an
+ inverse.
+ """
+ if (isinstance(functions, tuple) and len(functions) == 2 and
+ callable(functions[0]) and callable(functions[1])):
+ # make an arbitrary convert from a two-tuple of functions
+ # forward and inverse.
+ self._functions = functions
+ elif functions is None:
+ self._functions = (lambda x: x, lambda x: x)
+ else:
+ raise ValueError('functions argument of secondary axes '
+ 'must be a two-tuple of callable functions '
+ 'with the first function being the transform '
+ 'and the second being the inverse')
+ self._set_scale()
+
+ # Should be changed to draw(self, renderer) once the deprecation of
+ # renderer=None and of inframe expires.
+ def draw(self, *args, **kwargs):
+ """
+ Draw the secondary axes.
+
+ Consults the parent axes for its limits and converts them
+ using the converter specified by
+ `~.axes._secondary_axes.set_functions` (or *functions*
+ parameter when axes initialized.)
+ """
+ self._set_lims()
+ # this sets the scale in case the parent has set its scale.
+ self._set_scale()
+ super().draw(*args, **kwargs)
+
+ def _set_scale(self):
+ """
+ Check if parent has set its scale
+ """
+
+ if self._orientation == 'x':
+ pscale = self._parent.xaxis.get_scale()
+ set_scale = self.set_xscale
+ if self._orientation == 'y':
+ pscale = self._parent.yaxis.get_scale()
+ set_scale = self.set_yscale
+ if pscale == self._parentscale:
+ return
+
+ if pscale == 'log':
+ defscale = 'functionlog'
+ else:
+ defscale = 'function'
+
+ if self._ticks_set:
+ ticks = self._axis.get_ticklocs()
+
+ # need to invert the roles here for the ticks to line up.
+ set_scale(defscale, functions=self._functions[::-1])
+
+ # OK, set_scale sets the locators, but if we've called
+ # axsecond.set_ticks, we want to keep those.
+ if self._ticks_set:
+ self._axis.set_major_locator(mticker.FixedLocator(ticks))
+
+ # If the parent scale doesn't change, we can skip this next time.
+ self._parentscale = pscale
+
+ def _set_lims(self):
+ """
+ Set the limits based on parent limits and the convert method
+ between the parent and this secondary axes.
+ """
+ if self._orientation == 'x':
+ lims = self._parent.get_xlim()
+ set_lim = self.set_xlim
+ if self._orientation == 'y':
+ lims = self._parent.get_ylim()
+ set_lim = self.set_ylim
+ order = lims[0] < lims[1]
+ lims = self._functions[0](np.array(lims))
+ neworder = lims[0] < lims[1]
+ if neworder != order:
+ # Flip because the transform will take care of the flipping.
+ lims = lims[::-1]
+ set_lim(lims)
+
+ def set_aspect(self, *args, **kwargs):
+ """
+ Secondary axes cannot set the aspect ratio, so calling this just
+ sets a warning.
+ """
+ _api.warn_external("Secondary axes can't set the aspect ratio")
+
+ def set_color(self, color):
+ """
+ Change the color of the secondary axes and all decorators.
+
+ Parameters
+ ----------
+ color : color
+ """
+ if self._orientation == 'x':
+ self.tick_params(axis='x', colors=color)
+ self.spines.bottom.set_color(color)
+ self.spines.top.set_color(color)
+ self.xaxis.label.set_color(color)
+ else:
+ self.tick_params(axis='y', colors=color)
+ self.spines.left.set_color(color)
+ self.spines.right.set_color(color)
+ self.yaxis.label.set_color(color)
+
+
+_secax_docstring = '''
+Warnings
+--------
+This method is experimental as of 3.1, and the API may change.
+
+Parameters
+----------
+location : {'top', 'bottom', 'left', 'right'} or float
+ The position to put the secondary axis. Strings can be 'top' or
+ 'bottom' for orientation='x' and 'right' or 'left' for
+ orientation='y'. A float indicates the relative position on the
+ parent axes to put the new axes, 0.0 being the bottom (or left)
+ and 1.0 being the top (or right).
+
+functions : 2-tuple of func, or Transform with an inverse
+
+ If a 2-tuple of functions, the user specifies the transform
+ function and its inverse. i.e.
+ ``functions=(lambda x: 2 / x, lambda x: 2 / x)`` would be an
+ reciprocal transform with a factor of 2.
+
+ The user can also directly supply a subclass of
+ `.transforms.Transform` so long as it has an inverse.
+
+ See :doc:`/gallery/subplots_axes_and_figures/secondary_axis`
+ for examples of making these conversions.
+
+Returns
+-------
+ax : axes._secondary_axes.SecondaryAxis
+
+Other Parameters
+----------------
+**kwargs : `~matplotlib.axes.Axes` properties.
+ Other miscellaneous axes parameters.
+'''
+docstring.interpd.update(_secax_docstring=_secax_docstring)
diff --git a/venv/Lib/site-packages/matplotlib/axes/_subplots.py b/venv/Lib/site-packages/matplotlib/axes/_subplots.py
new file mode 100644
index 0000000..5042e3b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/axes/_subplots.py
@@ -0,0 +1,206 @@
+import functools
+
+from matplotlib import _api, docstring
+import matplotlib.artist as martist
+from matplotlib.axes._axes import Axes
+from matplotlib.gridspec import GridSpec, SubplotSpec
+
+
+class SubplotBase:
+ """
+ Base class for subplots, which are :class:`Axes` instances with
+ additional methods to facilitate generating and manipulating a set
+ of :class:`Axes` within a figure.
+ """
+
+ def __init__(self, fig, *args, **kwargs):
+ """
+ Parameters
+ ----------
+ fig : `matplotlib.figure.Figure`
+
+ *args : tuple (*nrows*, *ncols*, *index*) or int
+ The array of subplots in the figure has dimensions ``(nrows,
+ ncols)``, and *index* is the index of the subplot being created.
+ *index* starts at 1 in the upper left corner and increases to the
+ right.
+
+ If *nrows*, *ncols*, and *index* are all single digit numbers, then
+ *args* can be passed as a single 3-digit number (e.g. 234 for
+ (2, 3, 4)).
+
+ **kwargs
+ Keyword arguments are passed to the Axes (sub)class constructor.
+ """
+ # _axes_class is set in the subplot_class_factory
+ self._axes_class.__init__(self, fig, [0, 0, 1, 1], **kwargs)
+ # This will also update the axes position.
+ self.set_subplotspec(SubplotSpec._from_subplot_args(fig, args))
+
+ def __reduce__(self):
+ # get the first axes class which does not inherit from a subplotbase
+ axes_class = next(
+ c for c in type(self).__mro__
+ if issubclass(c, Axes) and not issubclass(c, SubplotBase))
+ return (_picklable_subplot_class_constructor,
+ (axes_class,),
+ self.__getstate__())
+
+ @_api.deprecated(
+ "3.4", alternative="get_subplotspec",
+ addendum="(get_subplotspec returns a SubplotSpec instance.)")
+ def get_geometry(self):
+ """Get the subplot geometry, e.g., (2, 2, 3)."""
+ rows, cols, num1, num2 = self.get_subplotspec().get_geometry()
+ return rows, cols, num1 + 1 # for compatibility
+
+ @_api.deprecated("3.4", alternative="set_subplotspec")
+ def change_geometry(self, numrows, numcols, num):
+ """Change subplot geometry, e.g., from (1, 1, 1) to (2, 2, 3)."""
+ self._subplotspec = GridSpec(numrows, numcols,
+ figure=self.figure)[num - 1]
+ self.update_params()
+ self.set_position(self.figbox)
+
+ def get_subplotspec(self):
+ """Return the `.SubplotSpec` instance associated with the subplot."""
+ return self._subplotspec
+
+ def set_subplotspec(self, subplotspec):
+ """Set the `.SubplotSpec`. instance associated with the subplot."""
+ self._subplotspec = subplotspec
+ self._set_position(subplotspec.get_position(self.figure))
+
+ def get_gridspec(self):
+ """Return the `.GridSpec` instance associated with the subplot."""
+ return self._subplotspec.get_gridspec()
+
+ @_api.deprecated(
+ "3.4", alternative="get_subplotspec().get_position(self.figure)")
+ @property
+ def figbox(self):
+ return self.get_subplotspec().get_position(self.figure)
+
+ @_api.deprecated("3.4", alternative="get_gridspec().nrows")
+ @property
+ def numRows(self):
+ return self.get_gridspec().nrows
+
+ @_api.deprecated("3.4", alternative="get_gridspec().ncols")
+ @property
+ def numCols(self):
+ return self.get_gridspec().ncols
+
+ @_api.deprecated("3.4")
+ def update_params(self):
+ """Update the subplot position from ``self.figure.subplotpars``."""
+ # Now a no-op, as figbox/numRows/numCols are (deprecated) auto-updating
+ # properties.
+
+ @_api.deprecated("3.4", alternative="ax.get_subplotspec().is_first_row()")
+ def is_first_row(self):
+ return self.get_subplotspec().rowspan.start == 0
+
+ @_api.deprecated("3.4", alternative="ax.get_subplotspec().is_last_row()")
+ def is_last_row(self):
+ return self.get_subplotspec().rowspan.stop == self.get_gridspec().nrows
+
+ @_api.deprecated("3.4", alternative="ax.get_subplotspec().is_first_col()")
+ def is_first_col(self):
+ return self.get_subplotspec().colspan.start == 0
+
+ @_api.deprecated("3.4", alternative="ax.get_subplotspec().is_last_col()")
+ def is_last_col(self):
+ return self.get_subplotspec().colspan.stop == self.get_gridspec().ncols
+
+ def label_outer(self):
+ """
+ Only show "outer" labels and tick labels.
+
+ x-labels are only kept for subplots on the last row; y-labels only for
+ subplots on the first column.
+ """
+ ss = self.get_subplotspec()
+ lastrow = ss.is_last_row()
+ firstcol = ss.is_first_col()
+ if not lastrow:
+ for label in self.get_xticklabels(which="both"):
+ label.set_visible(False)
+ self.xaxis.get_offset_text().set_visible(False)
+ self.set_xlabel("")
+ if not firstcol:
+ for label in self.get_yticklabels(which="both"):
+ label.set_visible(False)
+ self.yaxis.get_offset_text().set_visible(False)
+ self.set_ylabel("")
+
+ def _make_twin_axes(self, *args, **kwargs):
+ """Make a twinx axes of self. This is used for twinx and twiny."""
+ if 'sharex' in kwargs and 'sharey' in kwargs:
+ # The following line is added in v2.2 to avoid breaking Seaborn,
+ # which currently uses this internal API.
+ if kwargs["sharex"] is not self and kwargs["sharey"] is not self:
+ raise ValueError("Twinned Axes may share only one axis")
+ twin = self.figure.add_subplot(self.get_subplotspec(), *args, **kwargs)
+ self.set_adjustable('datalim')
+ twin.set_adjustable('datalim')
+ self._twinned_axes.join(self, twin)
+ return twin
+
+
+# this here to support cartopy which was using a private part of the
+# API to register their Axes subclasses.
+
+# In 3.1 this should be changed to a dict subclass that warns on use
+# In 3.3 to a dict subclass that raises a useful exception on use
+# In 3.4 should be removed
+
+# The slow timeline is to give cartopy enough time to get several
+# release out before we break them.
+_subplot_classes = {}
+
+
+@functools.lru_cache(None)
+def subplot_class_factory(axes_class=None):
+ """
+ Make a new class that inherits from `.SubplotBase` and the
+ given axes_class (which is assumed to be a subclass of `.axes.Axes`).
+ This is perhaps a little bit roundabout to make a new class on
+ the fly like this, but it means that a new Subplot class does
+ not have to be created for every type of Axes.
+ """
+ if axes_class is None:
+ _api.warn_deprecated(
+ "3.3", message="Support for passing None to subplot_class_factory "
+ "is deprecated since %(since)s; explicitly pass the default Axes "
+ "class instead. This will become an error %(removal)s.")
+ axes_class = Axes
+ try:
+ # Avoid creating two different instances of GeoAxesSubplot...
+ # Only a temporary backcompat fix. This should be removed in
+ # 3.4
+ return next(cls for cls in SubplotBase.__subclasses__()
+ if cls.__bases__ == (SubplotBase, axes_class))
+ except StopIteration:
+ return type("%sSubplot" % axes_class.__name__,
+ (SubplotBase, axes_class),
+ {'_axes_class': axes_class})
+
+
+Subplot = subplot_class_factory(Axes) # Provided for backward compatibility.
+
+
+def _picklable_subplot_class_constructor(axes_class):
+ """
+ Stub factory that returns an empty instance of the appropriate subplot
+ class when called with an axes class. This is purely to allow pickling of
+ Axes and Subplots.
+ """
+ subplot_class = subplot_class_factory(axes_class)
+ return subplot_class.__new__(subplot_class)
+
+
+docstring.interpd.update(Axes_kwdoc=martist.kwdoc(Axes))
+docstring.dedent_interpd(Axes.__init__)
+
+docstring.interpd.update(Subplot_kwdoc=martist.kwdoc(Axes))
diff --git a/venv/Lib/site-packages/matplotlib/axis.py b/venv/Lib/site-packages/matplotlib/axis.py
new file mode 100644
index 0000000..9d5adb1
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/axis.py
@@ -0,0 +1,2536 @@
+"""
+Classes for the ticks and x and y axis.
+"""
+
+import datetime
+import functools
+import logging
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib import _api
+import matplotlib.artist as martist
+import matplotlib.cbook as cbook
+import matplotlib.lines as mlines
+import matplotlib.scale as mscale
+import matplotlib.text as mtext
+import matplotlib.ticker as mticker
+import matplotlib.transforms as mtransforms
+import matplotlib.units as munits
+
+_log = logging.getLogger(__name__)
+
+GRIDLINE_INTERPOLATION_STEPS = 180
+
+# This list is being used for compatibility with Axes.grid, which
+# allows all Line2D kwargs.
+_line_inspector = martist.ArtistInspector(mlines.Line2D)
+_line_param_names = _line_inspector.get_setters()
+_line_param_aliases = [list(d)[0] for d in _line_inspector.aliasd.values()]
+_gridline_param_names = ['grid_' + name
+ for name in _line_param_names + _line_param_aliases]
+
+
+class Tick(martist.Artist):
+ """
+ Abstract base class for the axis ticks, grid lines and labels.
+
+ Ticks mark a position on an Axis. They contain two lines as markers and
+ two labels; one each for the bottom and top positions (in case of an
+ `.XAxis`) or for the left and right positions (in case of a `.YAxis`).
+
+ Attributes
+ ----------
+ tick1line : `.Line2D`
+ The left/bottom tick marker.
+ tick2line : `.Line2D`
+ The right/top tick marker.
+ gridline : `.Line2D`
+ The grid line associated with the label position.
+ label1 : `.Text`
+ The left/bottom tick label.
+ label2 : `.Text`
+ The right/top tick label.
+
+ """
+ @_api.delete_parameter("3.3", "label")
+ def __init__(self, axes, loc, label=None,
+ size=None, # points
+ width=None,
+ color=None,
+ tickdir=None,
+ pad=None,
+ labelsize=None,
+ labelcolor=None,
+ zorder=None,
+ gridOn=None, # defaults to axes.grid depending on
+ # axes.grid.which
+ tick1On=True,
+ tick2On=True,
+ label1On=True,
+ label2On=False,
+ major=True,
+ labelrotation=0,
+ grid_color=None,
+ grid_linestyle=None,
+ grid_linewidth=None,
+ grid_alpha=None,
+ **kw # Other Line2D kwargs applied to gridlines.
+ ):
+ """
+ bbox is the Bound2D bounding box in display coords of the Axes
+ loc is the tick location in data coords
+ size is the tick size in points
+ """
+ super().__init__()
+
+ if gridOn is None:
+ if major and (mpl.rcParams['axes.grid.which']
+ in ('both', 'major')):
+ gridOn = mpl.rcParams['axes.grid']
+ elif (not major) and (mpl.rcParams['axes.grid.which']
+ in ('both', 'minor')):
+ gridOn = mpl.rcParams['axes.grid']
+ else:
+ gridOn = False
+
+ self.set_figure(axes.figure)
+ self.axes = axes
+
+ self._loc = loc
+ self._major = major
+
+ name = self.__name__
+ major_minor = "major" if major else "minor"
+
+ if size is None:
+ size = mpl.rcParams[f"{name}.{major_minor}.size"]
+ self._size = size
+
+ if width is None:
+ width = mpl.rcParams[f"{name}.{major_minor}.width"]
+ self._width = width
+
+ if color is None:
+ color = mpl.rcParams[f"{name}.color"]
+
+ if pad is None:
+ pad = mpl.rcParams[f"{name}.{major_minor}.pad"]
+ self._base_pad = pad
+
+ if labelcolor is None:
+ labelcolor = mpl.rcParams[f"{name}.labelcolor"]
+
+ if labelcolor == 'inherit':
+ # inherit from tick color
+ labelcolor = mpl.rcParams[f"{name}.color"]
+
+ if labelsize is None:
+ labelsize = mpl.rcParams[f"{name}.labelsize"]
+
+ self._set_labelrotation(labelrotation)
+
+ if zorder is None:
+ if major:
+ zorder = mlines.Line2D.zorder + 0.01
+ else:
+ zorder = mlines.Line2D.zorder
+ self._zorder = zorder
+
+ if grid_color is None:
+ grid_color = mpl.rcParams["grid.color"]
+ if grid_linestyle is None:
+ grid_linestyle = mpl.rcParams["grid.linestyle"]
+ if grid_linewidth is None:
+ grid_linewidth = mpl.rcParams["grid.linewidth"]
+ if grid_alpha is None:
+ grid_alpha = mpl.rcParams["grid.alpha"]
+ grid_kw = {k[5:]: v for k, v in kw.items()}
+
+ self.apply_tickdir(tickdir)
+
+ self.tick1line = mlines.Line2D(
+ [], [],
+ color=color, linestyle="none", zorder=zorder, visible=tick1On,
+ markeredgecolor=color, markersize=size, markeredgewidth=width,
+ )
+ self.tick2line = mlines.Line2D(
+ [], [],
+ color=color, linestyle="none", zorder=zorder, visible=tick2On,
+ markeredgecolor=color, markersize=size, markeredgewidth=width,
+ )
+ self.gridline = mlines.Line2D(
+ [], [],
+ color=grid_color, alpha=grid_alpha, visible=gridOn,
+ linestyle=grid_linestyle, linewidth=grid_linewidth, marker="",
+ **grid_kw,
+ )
+ self.gridline.get_path()._interpolation_steps = \
+ GRIDLINE_INTERPOLATION_STEPS
+ self.label1 = mtext.Text(
+ np.nan, np.nan,
+ fontsize=labelsize, color=labelcolor, visible=label1On)
+ self.label2 = mtext.Text(
+ np.nan, np.nan,
+ fontsize=labelsize, color=labelcolor, visible=label2On)
+ for meth, attr in [("_get_tick1line", "tick1line"),
+ ("_get_tick2line", "tick2line"),
+ ("_get_gridline", "gridline"),
+ ("_get_text1", "label1"),
+ ("_get_text2", "label2")]:
+ overridden_method = _api.deprecate_method_override(
+ getattr(__class__, meth), self, since="3.3", message="Relying "
+ f"on {meth} to initialize Tick.{attr} is deprecated since "
+ f"%(since)s and will not work %(removal)s; please directly "
+ f"set the attribute in the subclass' __init__ instead.")
+ if overridden_method:
+ setattr(self, attr, overridden_method())
+ for artist in [self.tick1line, self.tick2line, self.gridline,
+ self.label1, self.label2]:
+ self._set_artist_props(artist)
+
+ self.update_position(loc)
+
+ @property
+ @_api.deprecated("3.1", alternative="Tick.label1", pending=True)
+ def label(self):
+ return self.label1
+
+ def _set_labelrotation(self, labelrotation):
+ if isinstance(labelrotation, str):
+ mode = labelrotation
+ angle = 0
+ elif isinstance(labelrotation, (tuple, list)):
+ mode, angle = labelrotation
+ else:
+ mode = 'default'
+ angle = labelrotation
+ _api.check_in_list(['auto', 'default'], labelrotation=mode)
+ self._labelrotation = (mode, angle)
+
+ def apply_tickdir(self, tickdir):
+ """Set tick direction. Valid values are 'out', 'in', 'inout'."""
+ if tickdir is None:
+ tickdir = mpl.rcParams[f'{self.__name__}.direction']
+ _api.check_in_list(['in', 'out', 'inout'], tickdir=tickdir)
+ self._tickdir = tickdir
+ self._pad = self._base_pad + self.get_tick_padding()
+ self.stale = True
+ # Subclass overrides should compute _tickmarkers as appropriate here.
+
+ def get_tickdir(self):
+ return self._tickdir
+
+ def get_tick_padding(self):
+ """Get the length of the tick outside of the axes."""
+ padding = {
+ 'in': 0.0,
+ 'inout': 0.5,
+ 'out': 1.0
+ }
+ return self._size * padding[self._tickdir]
+
+ def get_children(self):
+ children = [self.tick1line, self.tick2line,
+ self.gridline, self.label1, self.label2]
+ return children
+
+ def set_clip_path(self, clippath, transform=None):
+ # docstring inherited
+ super().set_clip_path(clippath, transform)
+ self.gridline.set_clip_path(clippath, transform)
+ self.stale = True
+
+ def get_pad_pixels(self):
+ return self.figure.dpi * self._base_pad / 72
+
+ def contains(self, mouseevent):
+ """
+ Test whether the mouse event occurred in the Tick marks.
+
+ This function always returns false. It is more useful to test if the
+ axis as a whole contains the mouse rather than the set of tick marks.
+ """
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+ return False, {}
+
+ def set_pad(self, val):
+ """
+ Set the tick label pad in points
+
+ Parameters
+ ----------
+ val : float
+ """
+ self._apply_params(pad=val)
+ self.stale = True
+
+ def get_pad(self):
+ """Get the value of the tick label pad in points."""
+ return self._base_pad
+
+ def _get_text1(self):
+ """Get the default Text 1 instance."""
+
+ def _get_text2(self):
+ """Get the default Text 2 instance."""
+
+ def _get_tick1line(self):
+ """Get the default line2D instance for tick1."""
+
+ def _get_tick2line(self):
+ """Get the default line2D instance for tick2."""
+
+ def _get_gridline(self):
+ """Get the default grid Line2d instance for this tick."""
+
+ def get_loc(self):
+ """Return the tick location (data coords) as a scalar."""
+ return self._loc
+
+ @martist.allow_rasterization
+ def draw(self, renderer):
+ if not self.get_visible():
+ self.stale = False
+ return
+ renderer.open_group(self.__name__, gid=self.get_gid())
+ for artist in [self.gridline, self.tick1line, self.tick2line,
+ self.label1, self.label2]:
+ artist.draw(renderer)
+ renderer.close_group(self.__name__)
+ self.stale = False
+
+ def set_label1(self, s):
+ """
+ Set the label1 text.
+
+ Parameters
+ ----------
+ s : str
+ """
+ self.label1.set_text(s)
+ self.stale = True
+
+ set_label = set_label1
+
+ def set_label2(self, s):
+ """
+ Set the label2 text.
+
+ Parameters
+ ----------
+ s : str
+ """
+ self.label2.set_text(s)
+ self.stale = True
+
+ def set_url(self, url):
+ """
+ Set the url of label1 and label2.
+
+ Parameters
+ ----------
+ url : str
+ """
+ super().set_url(url)
+ self.label1.set_url(url)
+ self.label2.set_url(url)
+ self.stale = True
+
+ def _set_artist_props(self, a):
+ a.set_figure(self.figure)
+
+ def get_view_interval(self):
+ """
+ Return the view limits ``(min, max)`` of the axis the tick belongs to.
+ """
+ raise NotImplementedError('Derived must override')
+
+ def _apply_params(self, **kw):
+ for name, target in [("gridOn", self.gridline),
+ ("tick1On", self.tick1line),
+ ("tick2On", self.tick2line),
+ ("label1On", self.label1),
+ ("label2On", self.label2)]:
+ if name in kw:
+ target.set_visible(kw.pop(name))
+ if any(k in kw for k in ['size', 'width', 'pad', 'tickdir']):
+ self._size = kw.pop('size', self._size)
+ # Width could be handled outside this block, but it is
+ # convenient to leave it here.
+ self._width = kw.pop('width', self._width)
+ self._base_pad = kw.pop('pad', self._base_pad)
+ # apply_tickdir uses _size and _base_pad to make _pad,
+ # and also makes _tickmarkers.
+ self.apply_tickdir(kw.pop('tickdir', self._tickdir))
+ self.tick1line.set_marker(self._tickmarkers[0])
+ self.tick2line.set_marker(self._tickmarkers[1])
+ for line in (self.tick1line, self.tick2line):
+ line.set_markersize(self._size)
+ line.set_markeredgewidth(self._width)
+ # _get_text1_transform uses _pad from apply_tickdir.
+ trans = self._get_text1_transform()[0]
+ self.label1.set_transform(trans)
+ trans = self._get_text2_transform()[0]
+ self.label2.set_transform(trans)
+ tick_kw = {k: v for k, v in kw.items() if k in ['color', 'zorder']}
+ if 'color' in kw:
+ tick_kw['markeredgecolor'] = kw['color']
+ self.tick1line.set(**tick_kw)
+ self.tick2line.set(**tick_kw)
+ for k, v in tick_kw.items():
+ setattr(self, '_' + k, v)
+
+ if 'labelrotation' in kw:
+ self._set_labelrotation(kw.pop('labelrotation'))
+ self.label1.set(rotation=self._labelrotation[1])
+ self.label2.set(rotation=self._labelrotation[1])
+
+ label_kw = {k[5:]: v for k, v in kw.items()
+ if k in ['labelsize', 'labelcolor']}
+ self.label1.set(**label_kw)
+ self.label2.set(**label_kw)
+
+ grid_kw = {k[5:]: v for k, v in kw.items()
+ if k in _gridline_param_names}
+ self.gridline.set(**grid_kw)
+
+ def update_position(self, loc):
+ """Set the location of tick in data coords with scalar *loc*."""
+ raise NotImplementedError('Derived must override')
+
+ def _get_text1_transform(self):
+ raise NotImplementedError('Derived must override')
+
+ def _get_text2_transform(self):
+ raise NotImplementedError('Derived must override')
+
+
+class XTick(Tick):
+ """
+ Contains all the Artists needed to make an x tick - the tick line,
+ the label text and the grid line
+ """
+ __name__ = 'xtick'
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ # x in data coords, y in axes coords
+ self.tick1line.set(
+ xdata=[0], ydata=[0],
+ transform=self.axes.get_xaxis_transform(which="tick1"),
+ marker=self._tickmarkers[0],
+ )
+ self.tick2line.set(
+ xdata=[0], ydata=[1],
+ transform=self.axes.get_xaxis_transform(which="tick2"),
+ marker=self._tickmarkers[1],
+ )
+ self.gridline.set(
+ xdata=[0, 0], ydata=[0, 1],
+ transform=self.axes.get_xaxis_transform(which="grid"),
+ )
+ # the y loc is 3 points below the min of y axis
+ trans, va, ha = self._get_text1_transform()
+ self.label1.set(
+ x=0, y=0,
+ verticalalignment=va, horizontalalignment=ha, transform=trans,
+ )
+ trans, va, ha = self._get_text2_transform()
+ self.label2.set(
+ x=0, y=1,
+ verticalalignment=va, horizontalalignment=ha, transform=trans,
+ )
+
+ def _get_text1_transform(self):
+ return self.axes.get_xaxis_text1_transform(self._pad)
+
+ def _get_text2_transform(self):
+ return self.axes.get_xaxis_text2_transform(self._pad)
+
+ def apply_tickdir(self, tickdir):
+ # docstring inherited
+ super().apply_tickdir(tickdir)
+ self._tickmarkers = {
+ 'out': (mlines.TICKDOWN, mlines.TICKUP),
+ 'in': (mlines.TICKUP, mlines.TICKDOWN),
+ 'inout': ('|', '|'),
+ }[self._tickdir]
+ self.stale = True
+
+ def update_position(self, loc):
+ """Set the location of tick in data coords with scalar *loc*."""
+ self.tick1line.set_xdata((loc,))
+ self.tick2line.set_xdata((loc,))
+ self.gridline.set_xdata((loc,))
+ self.label1.set_x(loc)
+ self.label2.set_x(loc)
+ self._loc = loc
+ self.stale = True
+
+ def get_view_interval(self):
+ # docstring inherited
+ return self.axes.viewLim.intervalx
+
+
+class YTick(Tick):
+ """
+ Contains all the Artists needed to make a Y tick - the tick line,
+ the label text and the grid line
+ """
+ __name__ = 'ytick'
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ # x in axes coords, y in data coords
+ self.tick1line.set(
+ xdata=[0], ydata=[0],
+ transform=self.axes.get_yaxis_transform(which="tick1"),
+ marker=self._tickmarkers[0],
+ )
+ self.tick2line.set(
+ xdata=[1], ydata=[0],
+ transform=self.axes.get_yaxis_transform(which="tick2"),
+ marker=self._tickmarkers[1],
+ )
+ self.gridline.set(
+ xdata=[0, 1], ydata=[0, 0],
+ transform=self.axes.get_yaxis_transform(which="grid"),
+ )
+ # the y loc is 3 points below the min of y axis
+ trans, va, ha = self._get_text1_transform()
+ self.label1.set(
+ x=0, y=0,
+ verticalalignment=va, horizontalalignment=ha, transform=trans,
+ )
+ trans, va, ha = self._get_text2_transform()
+ self.label2.set(
+ x=1, y=0,
+ verticalalignment=va, horizontalalignment=ha, transform=trans,
+ )
+
+ def _get_text1_transform(self):
+ return self.axes.get_yaxis_text1_transform(self._pad)
+
+ def _get_text2_transform(self):
+ return self.axes.get_yaxis_text2_transform(self._pad)
+
+ def apply_tickdir(self, tickdir):
+ # docstring inherited
+ super().apply_tickdir(tickdir)
+ self._tickmarkers = {
+ 'out': (mlines.TICKLEFT, mlines.TICKRIGHT),
+ 'in': (mlines.TICKRIGHT, mlines.TICKLEFT),
+ 'inout': ('_', '_'),
+ }[self._tickdir]
+ self.stale = True
+
+ def update_position(self, loc):
+ """Set the location of tick in data coords with scalar *loc*."""
+ self.tick1line.set_ydata((loc,))
+ self.tick2line.set_ydata((loc,))
+ self.gridline.set_ydata((loc,))
+ self.label1.set_y(loc)
+ self.label2.set_y(loc)
+ self._loc = loc
+ self.stale = True
+
+ def get_view_interval(self):
+ # docstring inherited
+ return self.axes.viewLim.intervaly
+
+
+class Ticker:
+ """
+ A container for the objects defining tick position and format.
+
+ Attributes
+ ----------
+ locator : `matplotlib.ticker.Locator` subclass
+ Determines the positions of the ticks.
+ formatter : `matplotlib.ticker.Formatter` subclass
+ Determines the format of the tick labels.
+ """
+
+ def __init__(self):
+ self._locator = None
+ self._formatter = None
+
+ @property
+ def locator(self):
+ return self._locator
+
+ @locator.setter
+ def locator(self, locator):
+ if not isinstance(locator, mticker.Locator):
+ raise TypeError('locator must be a subclass of '
+ 'matplotlib.ticker.Locator')
+ self._locator = locator
+
+ @property
+ def formatter(self):
+ return self._formatter
+
+ @formatter.setter
+ def formatter(self, formatter):
+ if not isinstance(formatter, mticker.Formatter):
+ raise TypeError('formatter must be a subclass of '
+ 'matplotlib.ticker.Formatter')
+ self._formatter = formatter
+
+
+class _LazyTickList:
+ """
+ A descriptor for lazy instantiation of tick lists.
+
+ See comment above definition of the ``majorTicks`` and ``minorTicks``
+ attributes.
+ """
+
+ def __init__(self, major):
+ self._major = major
+
+ def __get__(self, instance, cls):
+ if instance is None:
+ return self
+ else:
+ # instance._get_tick() can itself try to access the majorTicks
+ # attribute (e.g. in certain projection classes which override
+ # e.g. get_xaxis_text1_transform). In order to avoid infinite
+ # recursion, first set the majorTicks on the instance to an empty
+ # list, then create the tick and append it.
+ if self._major:
+ instance.majorTicks = []
+ tick = instance._get_tick(major=True)
+ instance.majorTicks.append(tick)
+ return instance.majorTicks
+ else:
+ instance.minorTicks = []
+ tick = instance._get_tick(major=False)
+ instance.minorTicks.append(tick)
+ return instance.minorTicks
+
+
+class Axis(martist.Artist):
+ """
+ Base class for `.XAxis` and `.YAxis`.
+
+ Attributes
+ ----------
+ isDefault_label : bool
+
+ axes : `matplotlib.axes.Axes`
+ The `~.axes.Axes` to which the Axis belongs.
+ major : `matplotlib.axis.Ticker`
+ Determines the major tick positions and their label format.
+ minor : `matplotlib.axis.Ticker`
+ Determines the minor tick positions and their label format.
+ callbacks : `matplotlib.cbook.CallbackRegistry`
+
+ label : `.Text`
+ The axis label.
+ labelpad : float
+ The distance between the axis label and the tick labels.
+ Defaults to :rc:`axes.labelpad` = 4.
+ offsetText : `.Text`
+ A `.Text` object containing the data offset of the ticks (if any).
+ pickradius : float
+ The acceptance radius for containment tests. See also `.Axis.contains`.
+ majorTicks : list of `.Tick`
+ The major ticks.
+ minorTicks : list of `.Tick`
+ The minor ticks.
+ """
+ OFFSETTEXTPAD = 3
+
+ def __str__(self):
+ return "{}({},{})".format(
+ type(self).__name__, *self.axes.transAxes.transform((0, 0)))
+
+ def __init__(self, axes, pickradius=15):
+ """
+ Parameters
+ ----------
+ axes : `matplotlib.axes.Axes`
+ The `~.axes.Axes` to which the created Axis belongs.
+ pickradius : float
+ The acceptance radius for containment tests. See also
+ `.Axis.contains`.
+ """
+ super().__init__()
+ self._remove_overlapping_locs = True
+
+ self.set_figure(axes.figure)
+
+ self.isDefault_label = True
+
+ self.axes = axes
+ self.major = Ticker()
+ self.minor = Ticker()
+ self.callbacks = cbook.CallbackRegistry()
+
+ self._autolabelpos = True
+
+ self.label = mtext.Text(
+ np.nan, np.nan,
+ fontsize=mpl.rcParams['axes.labelsize'],
+ fontweight=mpl.rcParams['axes.labelweight'],
+ color=mpl.rcParams['axes.labelcolor'],
+ )
+ self._set_artist_props(self.label)
+ self.offsetText = mtext.Text(np.nan, np.nan)
+ self._set_artist_props(self.offsetText)
+
+ self.labelpad = mpl.rcParams['axes.labelpad']
+
+ self.pickradius = pickradius
+
+ # Initialize here for testing; later add API
+ self._major_tick_kw = dict()
+ self._minor_tick_kw = dict()
+
+ self.clear()
+ self._set_scale('linear')
+
+ # During initialization, Axis objects often create ticks that are later
+ # unused; this turns out to be a very slow step. Instead, use a custom
+ # descriptor to make the tick lists lazy and instantiate them as needed.
+ majorTicks = _LazyTickList(major=True)
+ minorTicks = _LazyTickList(major=False)
+
+ def get_remove_overlapping_locs(self):
+ return self._remove_overlapping_locs
+
+ def set_remove_overlapping_locs(self, val):
+ self._remove_overlapping_locs = bool(val)
+
+ remove_overlapping_locs = property(
+ get_remove_overlapping_locs, set_remove_overlapping_locs,
+ doc=('If minor ticker locations that overlap with major '
+ 'ticker locations should be trimmed.'))
+
+ def set_label_coords(self, x, y, transform=None):
+ """
+ Set the coordinates of the label.
+
+ By default, the x coordinate of the y label and the y coordinate of the
+ x label are determined by the tick label bounding boxes, but this can
+ lead to poor alignment of multiple labels if there are multiple axes.
+
+ You can also specify the coordinate system of the label with the
+ transform. If None, the default coordinate system will be the axes
+ coordinate system: (0, 0) is bottom left, (0.5, 0.5) is center, etc.
+ """
+ self._autolabelpos = False
+ if transform is None:
+ transform = self.axes.transAxes
+
+ self.label.set_transform(transform)
+ self.label.set_position((x, y))
+ self.stale = True
+
+ def get_transform(self):
+ return self._scale.get_transform()
+
+ def get_scale(self):
+ """Return this Axis' scale (as a str)."""
+ return self._scale.name
+
+ def _set_scale(self, value, **kwargs):
+ if not isinstance(value, mscale.ScaleBase):
+ self._scale = mscale.scale_factory(value, self, **kwargs)
+ else:
+ self._scale = value
+ self._scale.set_default_locators_and_formatters(self)
+
+ self.isDefault_majloc = True
+ self.isDefault_minloc = True
+ self.isDefault_majfmt = True
+ self.isDefault_minfmt = True
+
+ def limit_range_for_scale(self, vmin, vmax):
+ return self._scale.limit_range_for_scale(vmin, vmax, self.get_minpos())
+
+ def get_children(self):
+ return [self.label, self.offsetText,
+ *self.get_major_ticks(), *self.get_minor_ticks()]
+
+ def _reset_major_tick_kw(self):
+ self._major_tick_kw.clear()
+ self._major_tick_kw['gridOn'] = (
+ mpl.rcParams['axes.grid'] and
+ mpl.rcParams['axes.grid.which'] in ('both', 'major'))
+
+ def _reset_minor_tick_kw(self):
+ self._minor_tick_kw.clear()
+ self._minor_tick_kw['gridOn'] = (
+ mpl.rcParams['axes.grid'] and
+ mpl.rcParams['axes.grid.which'] in ('both', 'minor'))
+
+ def clear(self):
+ """
+ Clear the axis.
+
+ This resets axis properties to their default values:
+
+ - the label
+ - the scale
+ - locators, formatters and ticks
+ - major and minor grid
+ - units
+ - registered callbacks
+ """
+
+ self.label.set_text('') # self.set_label_text would change isDefault_
+
+ self._set_scale('linear')
+
+ # Clear the callback registry for this axis, or it may "leak"
+ self.callbacks = cbook.CallbackRegistry()
+
+ self._reset_major_tick_kw()
+ self._reset_minor_tick_kw()
+ self.reset_ticks()
+
+ self.converter = None
+ self.units = None
+ self.set_units(None)
+ self.stale = True
+
+ @_api.deprecated("3.4", alternative="Axis.clear()")
+ def cla(self):
+ """Clear this axis."""
+ return self.clear()
+
+ def reset_ticks(self):
+ """
+ Re-initialize the major and minor Tick lists.
+
+ Each list starts with a single fresh Tick.
+ """
+ # Restore the lazy tick lists.
+ try:
+ del self.majorTicks
+ except AttributeError:
+ pass
+ try:
+ del self.minorTicks
+ except AttributeError:
+ pass
+ try:
+ self.set_clip_path(self.axes.patch)
+ except AttributeError:
+ pass
+
+ def set_tick_params(self, which='major', reset=False, **kw):
+ """
+ Set appearance parameters for ticks, ticklabels, and gridlines.
+
+ For documentation of keyword arguments, see
+ :meth:`matplotlib.axes.Axes.tick_params`.
+ """
+ _api.check_in_list(['major', 'minor', 'both'], which=which)
+ kwtrans = self._translate_tick_kw(kw)
+
+ # the kwargs are stored in self._major/minor_tick_kw so that any
+ # future new ticks will automatically get them
+ if reset:
+ if which in ['major', 'both']:
+ self._reset_major_tick_kw()
+ self._major_tick_kw.update(kwtrans)
+ if which in ['minor', 'both']:
+ self._reset_minor_tick_kw()
+ self._minor_tick_kw.update(kwtrans)
+ self.reset_ticks()
+ else:
+ if which in ['major', 'both']:
+ self._major_tick_kw.update(kwtrans)
+ for tick in self.majorTicks:
+ tick._apply_params(**kwtrans)
+ if which in ['minor', 'both']:
+ self._minor_tick_kw.update(kwtrans)
+ for tick in self.minorTicks:
+ tick._apply_params(**kwtrans)
+ # labelOn and labelcolor also apply to the offset text.
+ if 'label1On' in kwtrans or 'label2On' in kwtrans:
+ self.offsetText.set_visible(
+ self._major_tick_kw.get('label1On', False)
+ or self._major_tick_kw.get('label2On', False))
+ if 'labelcolor' in kwtrans:
+ self.offsetText.set_color(kwtrans['labelcolor'])
+
+ self.stale = True
+
+ @staticmethod
+ def _translate_tick_kw(kw):
+ # The following lists may be moved to a more accessible location.
+ kwkeys = ['size', 'width', 'color', 'tickdir', 'pad',
+ 'labelsize', 'labelcolor', 'zorder', 'gridOn',
+ 'tick1On', 'tick2On', 'label1On', 'label2On',
+ 'length', 'direction', 'left', 'bottom', 'right', 'top',
+ 'labelleft', 'labelbottom', 'labelright', 'labeltop',
+ 'labelrotation'] + _gridline_param_names
+ kwtrans = {}
+ if 'length' in kw:
+ kwtrans['size'] = kw.pop('length')
+ if 'direction' in kw:
+ kwtrans['tickdir'] = kw.pop('direction')
+ if 'rotation' in kw:
+ kwtrans['labelrotation'] = kw.pop('rotation')
+ if 'left' in kw:
+ kwtrans['tick1On'] = kw.pop('left')
+ if 'bottom' in kw:
+ kwtrans['tick1On'] = kw.pop('bottom')
+ if 'right' in kw:
+ kwtrans['tick2On'] = kw.pop('right')
+ if 'top' in kw:
+ kwtrans['tick2On'] = kw.pop('top')
+ if 'labelleft' in kw:
+ kwtrans['label1On'] = kw.pop('labelleft')
+ if 'labelbottom' in kw:
+ kwtrans['label1On'] = kw.pop('labelbottom')
+ if 'labelright' in kw:
+ kwtrans['label2On'] = kw.pop('labelright')
+ if 'labeltop' in kw:
+ kwtrans['label2On'] = kw.pop('labeltop')
+ if 'colors' in kw:
+ c = kw.pop('colors')
+ kwtrans['color'] = c
+ kwtrans['labelcolor'] = c
+ # Maybe move the checking up to the caller of this method.
+ for key in kw:
+ if key not in kwkeys:
+ raise ValueError(
+ "keyword %s is not recognized; valid keywords are %s"
+ % (key, kwkeys))
+ kwtrans.update(kw)
+ return kwtrans
+
+ def set_clip_path(self, clippath, transform=None):
+ super().set_clip_path(clippath, transform)
+ for child in self.majorTicks + self.minorTicks:
+ child.set_clip_path(clippath, transform)
+ self.stale = True
+
+ def get_view_interval(self):
+ """Return the view limits ``(min, max)`` of this axis."""
+ raise NotImplementedError('Derived must override')
+
+ def set_view_interval(self, vmin, vmax, ignore=False):
+ """
+ Set the axis view limits. This method is for internal use; Matplotlib
+ users should typically use e.g. `~.Axes.set_xlim` or `~.Axes.set_ylim`.
+
+ If *ignore* is False (the default), this method will never reduce the
+ preexisting view limits, only expand them if *vmin* or *vmax* are not
+ within them. Moreover, the order of *vmin* and *vmax* does not matter;
+ the orientation of the axis will not change.
+
+ If *ignore* is True, the view limits will be set exactly to ``(vmin,
+ vmax)`` in that order.
+ """
+ raise NotImplementedError('Derived must override')
+
+ def get_data_interval(self):
+ """Return the Interval instance for this axis data limits."""
+ raise NotImplementedError('Derived must override')
+
+ def set_data_interval(self, vmin, vmax, ignore=False):
+ """
+ Set the axis data limits. This method is for internal use.
+
+ If *ignore* is False (the default), this method will never reduce the
+ preexisting data limits, only expand them if *vmin* or *vmax* are not
+ within them. Moreover, the order of *vmin* and *vmax* does not matter;
+ the orientation of the axis will not change.
+
+ If *ignore* is True, the data limits will be set exactly to ``(vmin,
+ vmax)`` in that order.
+ """
+ raise NotImplementedError('Derived must override')
+
+ def get_inverted(self):
+ """
+ Return whether this Axis is oriented in the "inverse" direction.
+
+ The "normal" direction is increasing to the right for the x-axis and to
+ the top for the y-axis; the "inverse" direction is increasing to the
+ left for the x-axis and to the bottom for the y-axis.
+ """
+ low, high = self.get_view_interval()
+ return high < low
+
+ def set_inverted(self, inverted):
+ """
+ Set whether this Axis is oriented in the "inverse" direction.
+
+ The "normal" direction is increasing to the right for the x-axis and to
+ the top for the y-axis; the "inverse" direction is increasing to the
+ left for the x-axis and to the bottom for the y-axis.
+ """
+ # Currently, must be implemented in subclasses using set_xlim/set_ylim
+ # rather than generically using set_view_interval, so that shared
+ # axes get updated as well.
+ raise NotImplementedError('Derived must override')
+
+ def set_default_intervals(self):
+ """
+ Set the default limits for the axis data and view interval if they
+ have not been not mutated yet.
+ """
+ # this is mainly in support of custom object plotting. For
+ # example, if someone passes in a datetime object, we do not
+ # know automagically how to set the default min/max of the
+ # data and view limits. The unit conversion AxisInfo
+ # interface provides a hook for custom types to register
+ # default limits through the AxisInfo.default_limits
+ # attribute, and the derived code below will check for that
+ # and use it if is available (else just use 0..1)
+
+ def _set_artist_props(self, a):
+ if a is None:
+ return
+ a.set_figure(self.figure)
+
+ def get_ticklabel_extents(self, renderer):
+ """
+ Get the extents of the tick labels on either side
+ of the axes.
+ """
+
+ ticks_to_draw = self._update_ticks()
+ ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
+ renderer)
+
+ if len(ticklabelBoxes):
+ bbox = mtransforms.Bbox.union(ticklabelBoxes)
+ else:
+ bbox = mtransforms.Bbox.from_extents(0, 0, 0, 0)
+ if len(ticklabelBoxes2):
+ bbox2 = mtransforms.Bbox.union(ticklabelBoxes2)
+ else:
+ bbox2 = mtransforms.Bbox.from_extents(0, 0, 0, 0)
+ return bbox, bbox2
+
+ def _update_ticks(self):
+ """
+ Update ticks (position and labels) using the current data interval of
+ the axes. Return the list of ticks that will be drawn.
+ """
+ major_locs = self.get_majorticklocs()
+ major_labels = self.major.formatter.format_ticks(major_locs)
+ major_ticks = self.get_major_ticks(len(major_locs))
+ self.major.formatter.set_locs(major_locs)
+ for tick, loc, label in zip(major_ticks, major_locs, major_labels):
+ tick.update_position(loc)
+ tick.set_label1(label)
+ tick.set_label2(label)
+ minor_locs = self.get_minorticklocs()
+ minor_labels = self.minor.formatter.format_ticks(minor_locs)
+ minor_ticks = self.get_minor_ticks(len(minor_locs))
+ self.minor.formatter.set_locs(minor_locs)
+ for tick, loc, label in zip(minor_ticks, minor_locs, minor_labels):
+ tick.update_position(loc)
+ tick.set_label1(label)
+ tick.set_label2(label)
+ ticks = [*major_ticks, *minor_ticks]
+
+ view_low, view_high = self.get_view_interval()
+ if view_low > view_high:
+ view_low, view_high = view_high, view_low
+
+ interval_t = self.get_transform().transform([view_low, view_high])
+
+ ticks_to_draw = []
+ for tick in ticks:
+ try:
+ loc_t = self.get_transform().transform(tick.get_loc())
+ except AssertionError:
+ # transforms.transform doesn't allow masked values but
+ # some scales might make them, so we need this try/except.
+ pass
+ else:
+ if mtransforms._interval_contains_close(interval_t, loc_t):
+ ticks_to_draw.append(tick)
+
+ return ticks_to_draw
+
+ def _get_tick_bboxes(self, ticks, renderer):
+ """Return lists of bboxes for ticks' label1's and label2's."""
+ return ([tick.label1.get_window_extent(renderer)
+ for tick in ticks if tick.label1.get_visible()],
+ [tick.label2.get_window_extent(renderer)
+ for tick in ticks if tick.label2.get_visible()])
+
+ def get_tightbbox(self, renderer, *, for_layout_only=False):
+ """
+ Return a bounding box that encloses the axis. It only accounts
+ tick labels, axis label, and offsetText.
+
+ If *for_layout_only* is True, then the width of the label (if this
+ is an x-axis) or the height of the label (if this is a y-axis) is
+ collapsed to near zero. This allows tight/constrained_layout to ignore
+ too-long labels when doing their layout.
+ """
+ if not self.get_visible():
+ return
+
+ ticks_to_draw = self._update_ticks()
+
+ self._update_label_position(renderer)
+
+ # go back to just this axis's tick labels
+ ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(
+ ticks_to_draw, renderer)
+
+ self._update_offset_text_position(ticklabelBoxes, ticklabelBoxes2)
+ self.offsetText.set_text(self.major.formatter.get_offset())
+
+ bboxes = [
+ *(a.get_window_extent(renderer)
+ for a in [self.offsetText]
+ if a.get_visible()),
+ *ticklabelBoxes,
+ *ticklabelBoxes2,
+ ]
+ # take care of label
+ if self.label.get_visible():
+ bb = self.label.get_window_extent(renderer)
+ # for constrained/tight_layout, we want to ignore the label's
+ # width/height because the adjustments they make can't be improved.
+ # this code collapses the relevant direction
+ if for_layout_only:
+ if self.axis_name == "x" and bb.width > 0:
+ bb.x0 = (bb.x0 + bb.x1) / 2 - 0.5
+ bb.x1 = bb.x0 + 1.0
+ if self.axis_name == "y" and bb.height > 0:
+ bb.y0 = (bb.y0 + bb.y1) / 2 - 0.5
+ bb.y1 = bb.y0 + 1.0
+ bboxes.append(bb)
+ bboxes = [b for b in bboxes
+ if 0 < b.width < np.inf and 0 < b.height < np.inf]
+ if bboxes:
+ return mtransforms.Bbox.union(bboxes)
+ else:
+ return None
+
+ def get_tick_padding(self):
+ values = []
+ if len(self.majorTicks):
+ values.append(self.majorTicks[0].get_tick_padding())
+ if len(self.minorTicks):
+ values.append(self.minorTicks[0].get_tick_padding())
+ return max(values, default=0)
+
+ @martist.allow_rasterization
+ def draw(self, renderer, *args, **kwargs):
+ # docstring inherited
+
+ if not self.get_visible():
+ return
+ renderer.open_group(__name__, gid=self.get_gid())
+
+ ticks_to_draw = self._update_ticks()
+ ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
+ renderer)
+
+ for tick in ticks_to_draw:
+ tick.draw(renderer)
+
+ # scale up the axis label box to also find the neighbors, not
+ # just the tick labels that actually overlap note we need a
+ # *copy* of the axis label box because we don't want to scale
+ # the actual bbox
+
+ self._update_label_position(renderer)
+
+ self.label.draw(renderer)
+
+ self._update_offset_text_position(ticklabelBoxes, ticklabelBoxes2)
+ self.offsetText.set_text(self.major.formatter.get_offset())
+ self.offsetText.draw(renderer)
+
+ renderer.close_group(__name__)
+ self.stale = False
+
+ def get_gridlines(self):
+ r"""Return this Axis' grid lines as a list of `.Line2D`\s."""
+ ticks = self.get_major_ticks()
+ return cbook.silent_list('Line2D gridline',
+ [tick.gridline for tick in ticks])
+
+ def get_label(self):
+ """Return the axis label as a Text instance."""
+ return self.label
+
+ def get_offset_text(self):
+ """Return the axis offsetText as a Text instance."""
+ return self.offsetText
+
+ def get_pickradius(self):
+ """Return the depth of the axis used by the picker."""
+ return self.pickradius
+
+ def get_majorticklabels(self):
+ """Return this Axis' major tick labels, as a list of `~.text.Text`."""
+ ticks = self.get_major_ticks()
+ labels1 = [tick.label1 for tick in ticks if tick.label1.get_visible()]
+ labels2 = [tick.label2 for tick in ticks if tick.label2.get_visible()]
+ return labels1 + labels2
+
+ def get_minorticklabels(self):
+ """Return this Axis' minor tick labels, as a list of `~.text.Text`."""
+ ticks = self.get_minor_ticks()
+ labels1 = [tick.label1 for tick in ticks if tick.label1.get_visible()]
+ labels2 = [tick.label2 for tick in ticks if tick.label2.get_visible()]
+ return labels1 + labels2
+
+ def get_ticklabels(self, minor=False, which=None):
+ """
+ Get this Axis' tick labels.
+
+ Parameters
+ ----------
+ minor : bool
+ Whether to return the minor or the major ticklabels.
+
+ which : None, ('minor', 'major', 'both')
+ Overrides *minor*.
+
+ Selects which ticklabels to return
+
+ Returns
+ -------
+ list of `~matplotlib.text.Text`
+
+ Notes
+ -----
+ The tick label strings are not populated until a ``draw`` method has
+ been called.
+
+ See also: `~.pyplot.draw` and `~.FigureCanvasBase.draw`.
+ """
+ if which is not None:
+ if which == 'minor':
+ return self.get_minorticklabels()
+ elif which == 'major':
+ return self.get_majorticklabels()
+ elif which == 'both':
+ return self.get_majorticklabels() + self.get_minorticklabels()
+ else:
+ _api.check_in_list(['major', 'minor', 'both'], which=which)
+ if minor:
+ return self.get_minorticklabels()
+ return self.get_majorticklabels()
+
+ def get_majorticklines(self):
+ r"""Return this Axis' major tick lines as a list of `.Line2D`\s."""
+ lines = []
+ ticks = self.get_major_ticks()
+ for tick in ticks:
+ lines.append(tick.tick1line)
+ lines.append(tick.tick2line)
+ return cbook.silent_list('Line2D ticklines', lines)
+
+ def get_minorticklines(self):
+ r"""Return this Axis' minor tick lines as a list of `.Line2D`\s."""
+ lines = []
+ ticks = self.get_minor_ticks()
+ for tick in ticks:
+ lines.append(tick.tick1line)
+ lines.append(tick.tick2line)
+ return cbook.silent_list('Line2D ticklines', lines)
+
+ def get_ticklines(self, minor=False):
+ r"""Return this Axis' tick lines as a list of `.Line2D`\s."""
+ if minor:
+ return self.get_minorticklines()
+ return self.get_majorticklines()
+
+ def get_majorticklocs(self):
+ """Return this Axis' major tick locations in data coordinates."""
+ return self.major.locator()
+
+ def get_minorticklocs(self):
+ """Return this Axis' minor tick locations in data coordinates."""
+ # Remove minor ticks duplicating major ticks.
+ major_locs = self.major.locator()
+ minor_locs = self.minor.locator()
+ transform = self._scale.get_transform()
+ tr_minor_locs = transform.transform(minor_locs)
+ tr_major_locs = transform.transform(major_locs)
+ lo, hi = sorted(transform.transform(self.get_view_interval()))
+ # Use the transformed view limits as scale. 1e-5 is the default rtol
+ # for np.isclose.
+ tol = (hi - lo) * 1e-5
+ if self.remove_overlapping_locs:
+ minor_locs = [
+ loc for loc, tr_loc in zip(minor_locs, tr_minor_locs)
+ if ~np.isclose(tr_loc, tr_major_locs, atol=tol, rtol=0).any()]
+ return minor_locs
+
+ @_api.make_keyword_only("3.3", "minor")
+ def get_ticklocs(self, minor=False):
+ """Return this Axis' tick locations in data coordinates."""
+ return self.get_minorticklocs() if minor else self.get_majorticklocs()
+
+ def get_ticks_direction(self, minor=False):
+ """
+ Get the tick directions as a numpy array
+
+ Parameters
+ ----------
+ minor : bool, default: False
+ True to return the minor tick directions,
+ False to return the major tick directions.
+
+ Returns
+ -------
+ numpy array of tick directions
+ """
+ if minor:
+ return np.array(
+ [tick._tickdir for tick in self.get_minor_ticks()])
+ else:
+ return np.array(
+ [tick._tickdir for tick in self.get_major_ticks()])
+
+ def _get_tick(self, major):
+ """Return the default tick instance."""
+ raise NotImplementedError('derived must override')
+
+ def _get_tick_label_size(self, axis_name):
+ """
+ Return the text size of tick labels for this Axis.
+
+ This is a convenience function to avoid having to create a `Tick` in
+ `.get_tick_space`, since it is expensive.
+ """
+ tick_kw = self._major_tick_kw
+ size = tick_kw.get('labelsize',
+ mpl.rcParams[f'{axis_name}tick.labelsize'])
+ return mtext.FontProperties(size=size).get_size_in_points()
+
+ def _copy_tick_props(self, src, dest):
+ """Copy the properties from *src* tick to *dest* tick."""
+ if src is None or dest is None:
+ return
+ dest.label1.update_from(src.label1)
+ dest.label2.update_from(src.label2)
+ dest.tick1line.update_from(src.tick1line)
+ dest.tick2line.update_from(src.tick2line)
+ dest.gridline.update_from(src.gridline)
+
+ def get_label_text(self):
+ """Get the text of the label."""
+ return self.label.get_text()
+
+ def get_major_locator(self):
+ """Get the locator of the major ticker."""
+ return self.major.locator
+
+ def get_minor_locator(self):
+ """Get the locator of the minor ticker."""
+ return self.minor.locator
+
+ def get_major_formatter(self):
+ """Get the formatter of the major ticker."""
+ return self.major.formatter
+
+ def get_minor_formatter(self):
+ """Get the formatter of the minor ticker."""
+ return self.minor.formatter
+
+ def get_major_ticks(self, numticks=None):
+ r"""Return the list of major `.Tick`\s."""
+ if numticks is None:
+ numticks = len(self.get_majorticklocs())
+
+ while len(self.majorTicks) < numticks:
+ # Update the new tick label properties from the old.
+ tick = self._get_tick(major=True)
+ self.majorTicks.append(tick)
+ self._copy_tick_props(self.majorTicks[0], tick)
+
+ return self.majorTicks[:numticks]
+
+ def get_minor_ticks(self, numticks=None):
+ r"""Return the list of minor `.Tick`\s."""
+ if numticks is None:
+ numticks = len(self.get_minorticklocs())
+
+ while len(self.minorTicks) < numticks:
+ # Update the new tick label properties from the old.
+ tick = self._get_tick(major=False)
+ self.minorTicks.append(tick)
+ self._copy_tick_props(self.minorTicks[0], tick)
+
+ return self.minorTicks[:numticks]
+
+ def grid(self, b=None, which='major', **kwargs):
+ """
+ Configure the grid lines.
+
+ Parameters
+ ----------
+ b : bool or None
+ Whether to show the grid lines. If any *kwargs* are supplied,
+ it is assumed you want the grid on and *b* will be set to True.
+
+ If *b* is *None* and there are no *kwargs*, this toggles the
+ visibility of the lines.
+
+ which : {'major', 'minor', 'both'}
+ The grid lines to apply the changes on.
+
+ **kwargs : `.Line2D` properties
+ Define the line properties of the grid, e.g.::
+
+ grid(color='r', linestyle='-', linewidth=2)
+ """
+ TOGGLE = object()
+ UNSET = object()
+ visible = kwargs.pop('visible', UNSET)
+
+ if b is None:
+ if visible is UNSET:
+ if kwargs: # grid(color='r')
+ b = True
+ else: # grid()
+ b = TOGGLE
+ else: # grid(visible=v)
+ b = visible
+ else:
+ if visible is not UNSET and bool(b) != bool(visible):
+ # grid(True, visible=False), grid(False, visible=True)
+ raise ValueError(
+ "'b' and 'visible' specify inconsistent grid visibilities")
+ if kwargs and not b: # something false-like but not None
+ # grid(0, visible=True)
+ _api.warn_external('First parameter to grid() is false, '
+ 'but line properties are supplied. The '
+ 'grid will be enabled.')
+ b = True
+
+ which = which.lower()
+ _api.check_in_list(['major', 'minor', 'both'], which=which)
+ gridkw = {'grid_' + item[0]: item[1] for item in kwargs.items()}
+ if which in ['minor', 'both']:
+ gridkw['gridOn'] = (not self._minor_tick_kw['gridOn']
+ if b is TOGGLE else b)
+ self.set_tick_params(which='minor', **gridkw)
+ if which in ['major', 'both']:
+ gridkw['gridOn'] = (not self._major_tick_kw['gridOn']
+ if b is TOGGLE else b)
+ self.set_tick_params(which='major', **gridkw)
+ self.stale = True
+
+ def update_units(self, data):
+ """
+ Introspect *data* for units converter and update the
+ axis.converter instance if necessary. Return *True*
+ if *data* is registered for unit conversion.
+ """
+ converter = munits.registry.get_converter(data)
+ if converter is None:
+ return False
+
+ neednew = self.converter != converter
+ self.converter = converter
+ default = self.converter.default_units(data, self)
+ if default is not None and self.units is None:
+ self.set_units(default)
+
+ if neednew:
+ self._update_axisinfo()
+ self.stale = True
+ return True
+
+ def _update_axisinfo(self):
+ """
+ Check the axis converter for the stored units to see if the
+ axis info needs to be updated.
+ """
+ if self.converter is None:
+ return
+
+ info = self.converter.axisinfo(self.units, self)
+
+ if info is None:
+ return
+ if info.majloc is not None and \
+ self.major.locator != info.majloc and self.isDefault_majloc:
+ self.set_major_locator(info.majloc)
+ self.isDefault_majloc = True
+ if info.minloc is not None and \
+ self.minor.locator != info.minloc and self.isDefault_minloc:
+ self.set_minor_locator(info.minloc)
+ self.isDefault_minloc = True
+ if info.majfmt is not None and \
+ self.major.formatter != info.majfmt and self.isDefault_majfmt:
+ self.set_major_formatter(info.majfmt)
+ self.isDefault_majfmt = True
+ if info.minfmt is not None and \
+ self.minor.formatter != info.minfmt and self.isDefault_minfmt:
+ self.set_minor_formatter(info.minfmt)
+ self.isDefault_minfmt = True
+ if info.label is not None and self.isDefault_label:
+ self.set_label_text(info.label)
+ self.isDefault_label = True
+
+ self.set_default_intervals()
+
+ def have_units(self):
+ return self.converter is not None or self.units is not None
+
+ def convert_units(self, x):
+ # If x is natively supported by Matplotlib, doesn't need converting
+ if munits._is_natively_supported(x):
+ return x
+
+ if self.converter is None:
+ self.converter = munits.registry.get_converter(x)
+
+ if self.converter is None:
+ return x
+ try:
+ ret = self.converter.convert(x, self.units, self)
+ except Exception as e:
+ raise munits.ConversionError('Failed to convert value(s) to axis '
+ f'units: {x!r}') from e
+ return ret
+
+ def set_units(self, u):
+ """
+ Set the units for axis.
+
+ Parameters
+ ----------
+ u : units tag
+
+ Notes
+ -----
+ The units of any shared axis will also be updated.
+ """
+ if u == self.units:
+ return
+ if self is self.axes.xaxis:
+ shared = [
+ ax.xaxis
+ for ax in self.axes.get_shared_x_axes().get_siblings(self.axes)
+ ]
+ elif self is self.axes.yaxis:
+ shared = [
+ ax.yaxis
+ for ax in self.axes.get_shared_y_axes().get_siblings(self.axes)
+ ]
+ else:
+ shared = [self]
+ for axis in shared:
+ axis.units = u
+ axis._update_axisinfo()
+ axis.callbacks.process('units')
+ axis.callbacks.process('units finalize')
+ axis.stale = True
+
+ def get_units(self):
+ """Return the units for axis."""
+ return self.units
+
+ def set_label_text(self, label, fontdict=None, **kwargs):
+ """
+ Set the text value of the axis label.
+
+ Parameters
+ ----------
+ label : str
+ Text string.
+ fontdict : dict
+ Text properties.
+ **kwargs
+ Merged into fontdict.
+ """
+ self.isDefault_label = False
+ self.label.set_text(label)
+ if fontdict is not None:
+ self.label.update(fontdict)
+ self.label.update(kwargs)
+ self.stale = True
+ return self.label
+
+ def set_major_formatter(self, formatter):
+ """
+ Set the formatter of the major ticker.
+
+ In addition to a `~matplotlib.ticker.Formatter` instance,
+ this also accepts a ``str`` or function.
+
+ For a ``str`` a `~matplotlib.ticker.StrMethodFormatter` is used.
+ The field used for the value must be labeled ``'x'`` and the field used
+ for the position must be labeled ``'pos'``.
+ See the `~matplotlib.ticker.StrMethodFormatter` documentation for
+ more information.
+
+ For a function, a `~matplotlib.ticker.FuncFormatter` is used.
+ The function must take two inputs (a tick value ``x`` and a
+ position ``pos``), and return a string containing the corresponding
+ tick label.
+ See the `~matplotlib.ticker.FuncFormatter` documentation for
+ more information.
+
+ Parameters
+ ----------
+ formatter : `~matplotlib.ticker.Formatter`, ``str``, or function
+ """
+ self._set_formatter(formatter, self.major)
+
+ def set_minor_formatter(self, formatter):
+ """
+ Set the formatter of the minor ticker.
+
+ In addition to a `~matplotlib.ticker.Formatter` instance,
+ this also accepts a ``str`` or function.
+ See `.Axis.set_major_formatter` for more information.
+
+ Parameters
+ ----------
+ formatter : `~matplotlib.ticker.Formatter`, ``str``, or function
+ """
+ self._set_formatter(formatter, self.minor)
+
+ def _set_formatter(self, formatter, level):
+ if isinstance(formatter, str):
+ formatter = mticker.StrMethodFormatter(formatter)
+ # Don't allow any other TickHelper to avoid easy-to-make errors,
+ # like using a Locator instead of a Formatter.
+ elif (callable(formatter) and
+ not isinstance(formatter, mticker.TickHelper)):
+ formatter = mticker.FuncFormatter(formatter)
+ else:
+ _api.check_isinstance(mticker.Formatter, formatter=formatter)
+
+ if (isinstance(formatter, mticker.FixedFormatter)
+ and len(formatter.seq) > 0
+ and not isinstance(level.locator, mticker.FixedLocator)):
+ _api.warn_external('FixedFormatter should only be used together '
+ 'with FixedLocator')
+
+ if level == self.major:
+ self.isDefault_majfmt = False
+ else:
+ self.isDefault_minfmt = False
+
+ level.formatter = formatter
+ formatter.set_axis(self)
+ self.stale = True
+
+ def set_major_locator(self, locator):
+ """
+ Set the locator of the major ticker.
+
+ Parameters
+ ----------
+ locator : `~matplotlib.ticker.Locator`
+ """
+ _api.check_isinstance(mticker.Locator, locator=locator)
+ self.isDefault_majloc = False
+ self.major.locator = locator
+ if self.major.formatter:
+ self.major.formatter._set_locator(locator)
+ locator.set_axis(self)
+ self.stale = True
+
+ def set_minor_locator(self, locator):
+ """
+ Set the locator of the minor ticker.
+
+ Parameters
+ ----------
+ locator : `~matplotlib.ticker.Locator`
+ """
+ _api.check_isinstance(mticker.Locator, locator=locator)
+ self.isDefault_minloc = False
+ self.minor.locator = locator
+ if self.minor.formatter:
+ self.minor.formatter._set_locator(locator)
+ locator.set_axis(self)
+ self.stale = True
+
+ def set_pickradius(self, pickradius):
+ """
+ Set the depth of the axis used by the picker.
+
+ Parameters
+ ----------
+ pickradius : float
+ """
+ self.pickradius = pickradius
+
+ # Helper for set_ticklabels. Defining it here makes it pickleable.
+ @staticmethod
+ def _format_with_dict(tickd, x, pos):
+ return tickd.get(x, "")
+
+ def set_ticklabels(self, ticklabels, *, minor=False, **kwargs):
+ r"""
+ Set the text values of the tick labels.
+
+ .. warning::
+ This method should only be used after fixing the tick positions
+ using `.Axis.set_ticks`. Otherwise, the labels may end up in
+ unexpected positions.
+
+ Parameters
+ ----------
+ ticklabels : sequence of str or of `.Text`\s
+ Texts for labeling each tick location in the sequence set by
+ `.Axis.set_ticks`; the number of labels must match the number of
+ locations.
+ minor : bool
+ If True, set minor ticks instead of major ticks.
+ **kwargs
+ Text properties.
+
+ Returns
+ -------
+ list of `.Text`\s
+ For each tick, includes ``tick.label1`` if it is visible, then
+ ``tick.label2`` if it is visible, in that order.
+ """
+ ticklabels = [t.get_text() if hasattr(t, 'get_text') else t
+ for t in ticklabels]
+ locator = (self.get_minor_locator() if minor
+ else self.get_major_locator())
+ if isinstance(locator, mticker.FixedLocator):
+ # Passing [] as a list of ticklabels is often used as a way to
+ # remove all tick labels, so only error for > 0 ticklabels
+ if len(locator.locs) != len(ticklabels) and len(ticklabels) != 0:
+ raise ValueError(
+ "The number of FixedLocator locations"
+ f" ({len(locator.locs)}), usually from a call to"
+ " set_ticks, does not match"
+ f" the number of ticklabels ({len(ticklabels)}).")
+ tickd = {loc: lab for loc, lab in zip(locator.locs, ticklabels)}
+ func = functools.partial(self._format_with_dict, tickd)
+ formatter = mticker.FuncFormatter(func)
+ else:
+ formatter = mticker.FixedFormatter(ticklabels)
+
+ if minor:
+ self.set_minor_formatter(formatter)
+ locs = self.get_minorticklocs()
+ ticks = self.get_minor_ticks(len(locs))
+ else:
+ self.set_major_formatter(formatter)
+ locs = self.get_majorticklocs()
+ ticks = self.get_major_ticks(len(locs))
+
+ ret = []
+ for pos, (loc, tick) in enumerate(zip(locs, ticks)):
+ tick.update_position(loc)
+ tick_label = formatter(loc, pos)
+ # deal with label1
+ tick.label1.set_text(tick_label)
+ tick.label1.update(kwargs)
+ # deal with label2
+ tick.label2.set_text(tick_label)
+ tick.label2.update(kwargs)
+ # only return visible tick labels
+ if tick.label1.get_visible():
+ ret.append(tick.label1)
+ if tick.label2.get_visible():
+ ret.append(tick.label2)
+
+ self.stale = True
+ return ret
+
+ # Wrapper around set_ticklabels used to generate Axes.set_x/ytickabels; can
+ # go away once the API of Axes.set_x/yticklabels becomes consistent.
+ @_api.make_keyword_only("3.3", "fontdict")
+ def _set_ticklabels(self, labels, fontdict=None, minor=False, **kwargs):
+ """
+ Set this Axis' labels with list of string labels.
+
+ .. warning::
+ This method should only be used after fixing the tick positions
+ using `.Axis.set_ticks`. Otherwise, the labels may end up in
+ unexpected positions.
+
+ Parameters
+ ----------
+ labels : list of str
+ The label texts.
+
+ fontdict : dict, optional
+ A dictionary controlling the appearance of the ticklabels.
+ The default *fontdict* is::
+
+ {'fontsize': rcParams['axes.titlesize'],
+ 'fontweight': rcParams['axes.titleweight'],
+ 'verticalalignment': 'baseline',
+ 'horizontalalignment': loc}
+
+ minor : bool, default: False
+ Whether to set the minor ticklabels rather than the major ones.
+
+ Returns
+ -------
+ list of `~.Text`
+ The labels.
+
+ Other Parameters
+ ----------------
+ **kwargs : `~.text.Text` properties.
+ """
+ if fontdict is not None:
+ kwargs.update(fontdict)
+ return self.set_ticklabels(labels, minor=minor, **kwargs)
+
+ def set_ticks(self, ticks, *, minor=False):
+ """
+ Set this Axis' tick locations.
+
+ If necessary, the view limits of the Axis are expanded so that all
+ given ticks are visible.
+
+ Parameters
+ ----------
+ ticks : list of floats
+ List of tick locations.
+ minor : bool, default: False
+ If ``False``, set the major ticks; if ``True``, the minor ticks.
+
+ Notes
+ -----
+ The mandatory expansion of the view limits is an intentional design
+ choice to prevent the surprise of a non-visible tick. If you need
+ other limits, you should set the limits explicitly after setting the
+ ticks.
+ """
+ # XXX if the user changes units, the information will be lost here
+ ticks = self.convert_units(ticks)
+ if self is self.axes.xaxis:
+ shared = [
+ ax.xaxis
+ for ax in self.axes.get_shared_x_axes().get_siblings(self.axes)
+ ]
+ elif self is self.axes.yaxis:
+ shared = [
+ ax.yaxis
+ for ax in self.axes.get_shared_y_axes().get_siblings(self.axes)
+ ]
+ elif hasattr(self.axes, "zaxis") and self is self.axes.zaxis:
+ shared = [
+ ax.zaxis
+ for ax in self.axes._shared_z_axes.get_siblings(self.axes)
+ ]
+ else:
+ shared = [self]
+ for axis in shared:
+ if len(ticks) > 1:
+ xleft, xright = axis.get_view_interval()
+ if xright > xleft:
+ axis.set_view_interval(min(ticks), max(ticks))
+ else:
+ axis.set_view_interval(max(ticks), min(ticks))
+ self.axes.stale = True
+ if minor:
+ self.set_minor_locator(mticker.FixedLocator(ticks))
+ return self.get_minor_ticks(len(ticks))
+ else:
+ self.set_major_locator(mticker.FixedLocator(ticks))
+ return self.get_major_ticks(len(ticks))
+
+ def _get_tick_boxes_siblings(self, renderer):
+ """
+ Get the bounding boxes for this `.axis` and its siblings
+ as set by `.Figure.align_xlabels` or `.Figure.align_ylabels`.
+
+ By default it just gets bboxes for self.
+ """
+ # Get the Grouper keeping track of x or y label groups for this figure.
+ axis_names = [
+ name for name, axis in self.axes._get_axis_map().items()
+ if name in self.figure._align_label_groups and axis is self]
+ if len(axis_names) != 1:
+ return [], []
+ axis_name, = axis_names
+ grouper = self.figure._align_label_groups[axis_name]
+ bboxes = []
+ bboxes2 = []
+ # If we want to align labels from other axes:
+ for ax in grouper.get_siblings(self.axes):
+ axis = ax._get_axis_map()[axis_name]
+ ticks_to_draw = axis._update_ticks()
+ tlb, tlb2 = axis._get_tick_bboxes(ticks_to_draw, renderer)
+ bboxes.extend(tlb)
+ bboxes2.extend(tlb2)
+ return bboxes, bboxes2
+
+ def _update_label_position(self, renderer):
+ """
+ Update the label position based on the bounding box enclosing
+ all the ticklabels and axis spine.
+ """
+ raise NotImplementedError('Derived must override')
+
+ def _update_offset_text_position(self, bboxes, bboxes2):
+ """
+ Update the offset text position based on the sequence of bounding
+ boxes of all the ticklabels.
+ """
+ raise NotImplementedError('Derived must override')
+
+ @_api.deprecated("3.3")
+ def pan(self, numsteps):
+ """Pan by *numsteps* (can be positive or negative)."""
+ self.major.locator.pan(numsteps)
+
+ @_api.deprecated("3.3")
+ def zoom(self, direction):
+ """Zoom in/out on axis; if *direction* is >0 zoom in, else zoom out."""
+ self.major.locator.zoom(direction)
+
+ def axis_date(self, tz=None):
+ """
+ Set up axis ticks and labels to treat data along this Axis as dates.
+
+ Parameters
+ ----------
+ tz : str or `datetime.tzinfo`, default: :rc:`timezone`
+ The timezone used to create date labels.
+ """
+ # By providing a sample datetime instance with the desired timezone,
+ # the registered converter can be selected, and the "units" attribute,
+ # which is the timezone, can be set.
+ if isinstance(tz, str):
+ import dateutil.tz
+ tz = dateutil.tz.gettz(tz)
+ self.update_units(datetime.datetime(2009, 1, 1, 0, 0, 0, 0, tz))
+
+ def get_tick_space(self):
+ """Return the estimated number of ticks that can fit on the axis."""
+ # Must be overridden in the subclass
+ raise NotImplementedError()
+
+ def _get_ticks_position(self):
+ """
+ Helper for `XAxis.get_ticks_position` and `YAxis.get_ticks_position`.
+
+ Check the visibility of tick1line, label1, tick2line, and label2 on
+ the first major and the first minor ticks, and return
+
+ - 1 if only tick1line and label1 are visible (which corresponds to
+ "bottom" for the x-axis and "left" for the y-axis);
+ - 2 if only tick2line and label2 are visible (which corresponds to
+ "top" for the x-axis and "right" for the y-axis);
+ - "default" if only tick1line, tick2line and label1 are visible;
+ - "unknown" otherwise.
+ """
+ major = self.majorTicks[0]
+ minor = self.minorTicks[0]
+ if all(tick.tick1line.get_visible()
+ and not tick.tick2line.get_visible()
+ and tick.label1.get_visible()
+ and not tick.label2.get_visible()
+ for tick in [major, minor]):
+ return 1
+ elif all(tick.tick2line.get_visible()
+ and not tick.tick1line.get_visible()
+ and tick.label2.get_visible()
+ and not tick.label1.get_visible()
+ for tick in [major, minor]):
+ return 2
+ elif all(tick.tick1line.get_visible()
+ and tick.tick2line.get_visible()
+ and tick.label1.get_visible()
+ and not tick.label2.get_visible()
+ for tick in [major, minor]):
+ return "default"
+ else:
+ return "unknown"
+
+ def get_label_position(self):
+ """
+ Return the label position (top or bottom)
+ """
+ return self.label_position
+
+ def set_label_position(self, position):
+ """
+ Set the label position (top or bottom)
+
+ Parameters
+ ----------
+ position : {'top', 'bottom'}
+ """
+ raise NotImplementedError()
+
+ def get_minpos(self):
+ raise NotImplementedError()
+
+
+def _make_getset_interval(method_name, lim_name, attr_name):
+ """
+ Helper to generate ``get_{data,view}_interval`` and
+ ``set_{data,view}_interval`` implementations.
+ """
+
+ def getter(self):
+ # docstring inherited.
+ return getattr(getattr(self.axes, lim_name), attr_name)
+
+ def setter(self, vmin, vmax, ignore=False):
+ # docstring inherited.
+ if ignore:
+ setattr(getattr(self.axes, lim_name), attr_name, (vmin, vmax))
+ else:
+ oldmin, oldmax = getter(self)
+ if oldmin < oldmax:
+ setter(self, min(vmin, vmax, oldmin), max(vmin, vmax, oldmax),
+ ignore=True)
+ else:
+ setter(self, max(vmin, vmax, oldmin), min(vmin, vmax, oldmax),
+ ignore=True)
+ self.stale = True
+
+ getter.__name__ = f"get_{method_name}_interval"
+ setter.__name__ = f"set_{method_name}_interval"
+
+ return getter, setter
+
+
+class XAxis(Axis):
+ __name__ = 'xaxis'
+ axis_name = 'x' #: Read-only name identifying the axis.
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ # x in axes coords, y in display coords (to be updated at draw time by
+ # _update_label_positions and _update_offset_text_position).
+ self.label.set(
+ x=0.5, y=0,
+ verticalalignment='top', horizontalalignment='center',
+ transform=mtransforms.blended_transform_factory(
+ self.axes.transAxes, mtransforms.IdentityTransform()),
+ )
+ self.label_position = 'bottom'
+ self.offsetText.set(
+ x=1, y=0,
+ verticalalignment='top', horizontalalignment='right',
+ transform=mtransforms.blended_transform_factory(
+ self.axes.transAxes, mtransforms.IdentityTransform()),
+ fontsize=mpl.rcParams['xtick.labelsize'],
+ color=mpl.rcParams['xtick.color'],
+ )
+ self.offset_text_position = 'bottom'
+
+ def contains(self, mouseevent):
+ """Test whether the mouse event occurred in the x axis."""
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+
+ x, y = mouseevent.x, mouseevent.y
+ try:
+ trans = self.axes.transAxes.inverted()
+ xaxes, yaxes = trans.transform((x, y))
+ except ValueError:
+ return False, {}
+ (l, b), (r, t) = self.axes.transAxes.transform([(0, 0), (1, 1)])
+ inaxis = 0 <= xaxes <= 1 and (
+ b - self.pickradius < y < b or
+ t < y < t + self.pickradius)
+ return inaxis, {}
+
+ def _get_tick(self, major):
+ if major:
+ tick_kw = self._major_tick_kw
+ else:
+ tick_kw = self._minor_tick_kw
+ return XTick(self.axes, 0, major=major, **tick_kw)
+
+ def set_label_position(self, position):
+ """
+ Set the label position (top or bottom)
+
+ Parameters
+ ----------
+ position : {'top', 'bottom'}
+ """
+ self.label.set_verticalalignment(_api.check_getitem({
+ 'top': 'baseline', 'bottom': 'top',
+ }, position=position))
+ self.label_position = position
+ self.stale = True
+
+ def _update_label_position(self, renderer):
+ """
+ Update the label position based on the bounding box enclosing
+ all the ticklabels and axis spine
+ """
+ if not self._autolabelpos:
+ return
+
+ # get bounding boxes for this axis and any siblings
+ # that have been set by `fig.align_xlabels()`
+ bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer)
+
+ x, y = self.label.get_position()
+ if self.label_position == 'bottom':
+ try:
+ spine = self.axes.spines['bottom']
+ spinebbox = spine.get_transform().transform_path(
+ spine.get_path()).get_extents()
+ except KeyError:
+ # use axes if spine doesn't exist
+ spinebbox = self.axes.bbox
+ bbox = mtransforms.Bbox.union(bboxes + [spinebbox])
+ bottom = bbox.y0
+
+ self.label.set_position(
+ (x, bottom - self.labelpad * self.figure.dpi / 72)
+ )
+
+ else:
+ try:
+ spine = self.axes.spines['top']
+ spinebbox = spine.get_transform().transform_path(
+ spine.get_path()).get_extents()
+ except KeyError:
+ # use axes if spine doesn't exist
+ spinebbox = self.axes.bbox
+ bbox = mtransforms.Bbox.union(bboxes2 + [spinebbox])
+ top = bbox.y1
+
+ self.label.set_position(
+ (x, top + self.labelpad * self.figure.dpi / 72)
+ )
+
+ def _update_offset_text_position(self, bboxes, bboxes2):
+ """
+ Update the offset_text position based on the sequence of bounding
+ boxes of all the ticklabels
+ """
+ x, y = self.offsetText.get_position()
+ if not hasattr(self, '_tick_position'):
+ self._tick_position = 'bottom'
+ if self._tick_position == 'bottom':
+ if not len(bboxes):
+ bottom = self.axes.bbox.ymin
+ else:
+ bbox = mtransforms.Bbox.union(bboxes)
+ bottom = bbox.y0
+ y = bottom - self.OFFSETTEXTPAD * self.figure.dpi / 72
+ else:
+ if not len(bboxes2):
+ top = self.axes.bbox.ymax
+ else:
+ bbox = mtransforms.Bbox.union(bboxes2)
+ top = bbox.y1
+ y = top + self.OFFSETTEXTPAD * self.figure.dpi / 72
+ self.offsetText.set_position((x, y))
+
+ def get_text_heights(self, renderer):
+ """
+ Return how much space should be reserved for text above and below the
+ axes, as a pair of floats.
+ """
+ bbox, bbox2 = self.get_ticklabel_extents(renderer)
+ # MGDTODO: Need a better way to get the pad
+ padPixels = self.majorTicks[0].get_pad_pixels()
+
+ above = 0.0
+ if bbox2.height:
+ above += bbox2.height + padPixels
+ below = 0.0
+ if bbox.height:
+ below += bbox.height + padPixels
+
+ if self.get_label_position() == 'top':
+ above += self.label.get_window_extent(renderer).height + padPixels
+ else:
+ below += self.label.get_window_extent(renderer).height + padPixels
+ return above, below
+
+ def set_ticks_position(self, position):
+ """
+ Set the ticks position.
+
+ Parameters
+ ----------
+ position : {'top', 'bottom', 'both', 'default', 'none'}
+ 'both' sets the ticks to appear on both positions, but does not
+ change the tick labels. 'default' resets the tick positions to
+ the default: ticks on both positions, labels at bottom. 'none'
+ can be used if you don't want any ticks. 'none' and 'both'
+ affect only the ticks, not the labels.
+ """
+ _api.check_in_list(['top', 'bottom', 'both', 'default', 'none'],
+ position=position)
+ if position == 'top':
+ self.set_tick_params(which='both', top=True, labeltop=True,
+ bottom=False, labelbottom=False)
+ self._tick_position = 'top'
+ self.offsetText.set_verticalalignment('bottom')
+ elif position == 'bottom':
+ self.set_tick_params(which='both', top=False, labeltop=False,
+ bottom=True, labelbottom=True)
+ self._tick_position = 'bottom'
+ self.offsetText.set_verticalalignment('top')
+ elif position == 'both':
+ self.set_tick_params(which='both', top=True,
+ bottom=True)
+ elif position == 'none':
+ self.set_tick_params(which='both', top=False,
+ bottom=False)
+ elif position == 'default':
+ self.set_tick_params(which='both', top=True, labeltop=False,
+ bottom=True, labelbottom=True)
+ self._tick_position = 'bottom'
+ self.offsetText.set_verticalalignment('top')
+ else:
+ assert False, "unhandled parameter not caught by _check_in_list"
+ self.stale = True
+
+ def tick_top(self):
+ """
+ Move ticks and ticklabels (if present) to the top of the axes.
+ """
+ label = True
+ if 'label1On' in self._major_tick_kw:
+ label = (self._major_tick_kw['label1On']
+ or self._major_tick_kw['label2On'])
+ self.set_ticks_position('top')
+ # If labels were turned off before this was called, leave them off.
+ self.set_tick_params(which='both', labeltop=label)
+
+ def tick_bottom(self):
+ """
+ Move ticks and ticklabels (if present) to the bottom of the axes.
+ """
+ label = True
+ if 'label1On' in self._major_tick_kw:
+ label = (self._major_tick_kw['label1On']
+ or self._major_tick_kw['label2On'])
+ self.set_ticks_position('bottom')
+ # If labels were turned off before this was called, leave them off.
+ self.set_tick_params(which='both', labelbottom=label)
+
+ def get_ticks_position(self):
+ """
+ Return the ticks position ("top", "bottom", "default", or "unknown").
+ """
+ return {1: "bottom", 2: "top",
+ "default": "default", "unknown": "unknown"}[
+ self._get_ticks_position()]
+
+ get_view_interval, set_view_interval = _make_getset_interval(
+ "view", "viewLim", "intervalx")
+ get_data_interval, set_data_interval = _make_getset_interval(
+ "data", "dataLim", "intervalx")
+
+ def get_minpos(self):
+ return self.axes.dataLim.minposx
+
+ def set_inverted(self, inverted):
+ # docstring inherited
+ a, b = self.get_view_interval()
+ # cast to bool to avoid bad interaction between python 3.8 and np.bool_
+ self.axes.set_xlim(sorted((a, b), reverse=bool(inverted)), auto=None)
+
+ def set_default_intervals(self):
+ # docstring inherited
+ xmin, xmax = 0., 1.
+ dataMutated = self.axes.dataLim.mutatedx()
+ viewMutated = self.axes.viewLim.mutatedx()
+ if not dataMutated or not viewMutated:
+ if self.converter is not None:
+ info = self.converter.axisinfo(self.units, self)
+ if info.default_limits is not None:
+ valmin, valmax = info.default_limits
+ xmin = self.converter.convert(valmin, self.units, self)
+ xmax = self.converter.convert(valmax, self.units, self)
+ if not dataMutated:
+ self.axes.dataLim.intervalx = xmin, xmax
+ if not viewMutated:
+ self.axes.viewLim.intervalx = xmin, xmax
+ self.stale = True
+
+ def get_tick_space(self):
+ ends = self.axes.transAxes.transform([[0, 0], [1, 0]])
+ length = ((ends[1][0] - ends[0][0]) / self.axes.figure.dpi) * 72
+ # There is a heuristic here that the aspect ratio of tick text
+ # is no more than 3:1
+ size = self._get_tick_label_size('x') * 3
+ if size > 0:
+ return int(np.floor(length / size))
+ else:
+ return 2**31 - 1
+
+
+class YAxis(Axis):
+ __name__ = 'yaxis'
+ axis_name = 'y' #: Read-only name identifying the axis.
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ # x in display coords, y in axes coords (to be updated at draw time by
+ # _update_label_positions and _update_offset_text_position).
+ self.label.set(
+ x=0, y=0.5,
+ verticalalignment='bottom', horizontalalignment='center',
+ rotation='vertical', rotation_mode='anchor',
+ transform=mtransforms.blended_transform_factory(
+ mtransforms.IdentityTransform(), self.axes.transAxes),
+ )
+ self.label_position = 'left'
+ # x in axes coords, y in display coords(!).
+ self.offsetText.set(
+ x=0, y=0.5,
+ verticalalignment='baseline', horizontalalignment='left',
+ transform=mtransforms.blended_transform_factory(
+ self.axes.transAxes, mtransforms.IdentityTransform()),
+ fontsize=mpl.rcParams['ytick.labelsize'],
+ color=mpl.rcParams['ytick.color'],
+ )
+ self.offset_text_position = 'left'
+
+ def contains(self, mouseevent):
+ # docstring inherited
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+
+ x, y = mouseevent.x, mouseevent.y
+ try:
+ trans = self.axes.transAxes.inverted()
+ xaxes, yaxes = trans.transform((x, y))
+ except ValueError:
+ return False, {}
+ (l, b), (r, t) = self.axes.transAxes.transform([(0, 0), (1, 1)])
+ inaxis = 0 <= yaxes <= 1 and (
+ l - self.pickradius < x < l or
+ r < x < r + self.pickradius)
+ return inaxis, {}
+
+ def _get_tick(self, major):
+ if major:
+ tick_kw = self._major_tick_kw
+ else:
+ tick_kw = self._minor_tick_kw
+ return YTick(self.axes, 0, major=major, **tick_kw)
+
+ def set_label_position(self, position):
+ """
+ Set the label position (left or right)
+
+ Parameters
+ ----------
+ position : {'left', 'right'}
+ """
+ self.label.set_rotation_mode('anchor')
+ self.label.set_verticalalignment(_api.check_getitem({
+ 'left': 'bottom', 'right': 'top',
+ }, position=position))
+ self.label_position = position
+ self.stale = True
+
+ def _update_label_position(self, renderer):
+ """
+ Update the label position based on the bounding box enclosing
+ all the ticklabels and axis spine
+ """
+ if not self._autolabelpos:
+ return
+
+ # get bounding boxes for this axis and any siblings
+ # that have been set by `fig.align_ylabels()`
+ bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer)
+
+ x, y = self.label.get_position()
+ if self.label_position == 'left':
+ try:
+ spine = self.axes.spines['left']
+ spinebbox = spine.get_transform().transform_path(
+ spine.get_path()).get_extents()
+ except KeyError:
+ # use axes if spine doesn't exist
+ spinebbox = self.axes.bbox
+ bbox = mtransforms.Bbox.union(bboxes + [spinebbox])
+ left = bbox.x0
+ self.label.set_position(
+ (left - self.labelpad * self.figure.dpi / 72, y)
+ )
+
+ else:
+ try:
+ spine = self.axes.spines['right']
+ spinebbox = spine.get_transform().transform_path(
+ spine.get_path()).get_extents()
+ except KeyError:
+ # use axes if spine doesn't exist
+ spinebbox = self.axes.bbox
+ bbox = mtransforms.Bbox.union(bboxes2 + [spinebbox])
+ right = bbox.x1
+
+ self.label.set_position(
+ (right + self.labelpad * self.figure.dpi / 72, y)
+ )
+
+ def _update_offset_text_position(self, bboxes, bboxes2):
+ """
+ Update the offset_text position based on the sequence of bounding
+ boxes of all the ticklabels
+ """
+ x, y = self.offsetText.get_position()
+ top = self.axes.bbox.ymax
+ self.offsetText.set_position(
+ (x, top + self.OFFSETTEXTPAD * self.figure.dpi / 72)
+ )
+
+ def set_offset_position(self, position):
+ """
+ Parameters
+ ----------
+ position : {'left', 'right'}
+ """
+ x, y = self.offsetText.get_position()
+ x = _api.check_getitem({'left': 0, 'right': 1}, position=position)
+
+ self.offsetText.set_ha(position)
+ self.offsetText.set_position((x, y))
+ self.stale = True
+
+ def get_text_widths(self, renderer):
+ bbox, bbox2 = self.get_ticklabel_extents(renderer)
+ # MGDTODO: Need a better way to get the pad
+ padPixels = self.majorTicks[0].get_pad_pixels()
+
+ left = 0.0
+ if bbox.width:
+ left += bbox.width + padPixels
+ right = 0.0
+ if bbox2.width:
+ right += bbox2.width + padPixels
+
+ if self.get_label_position() == 'left':
+ left += self.label.get_window_extent(renderer).width + padPixels
+ else:
+ right += self.label.get_window_extent(renderer).width + padPixels
+ return left, right
+
+ def set_ticks_position(self, position):
+ """
+ Set the ticks position.
+
+ Parameters
+ ----------
+ position : {'left', 'right', 'both', 'default', 'none'}
+ 'both' sets the ticks to appear on both positions, but does not
+ change the tick labels. 'default' resets the tick positions to
+ the default: ticks on both positions, labels at left. 'none'
+ can be used if you don't want any ticks. 'none' and 'both'
+ affect only the ticks, not the labels.
+ """
+ _api.check_in_list(['left', 'right', 'both', 'default', 'none'],
+ position=position)
+ if position == 'right':
+ self.set_tick_params(which='both', right=True, labelright=True,
+ left=False, labelleft=False)
+ self.set_offset_position(position)
+ elif position == 'left':
+ self.set_tick_params(which='both', right=False, labelright=False,
+ left=True, labelleft=True)
+ self.set_offset_position(position)
+ elif position == 'both':
+ self.set_tick_params(which='both', right=True,
+ left=True)
+ elif position == 'none':
+ self.set_tick_params(which='both', right=False,
+ left=False)
+ elif position == 'default':
+ self.set_tick_params(which='both', right=True, labelright=False,
+ left=True, labelleft=True)
+ else:
+ assert False, "unhandled parameter not caught by _check_in_list"
+ self.stale = True
+
+ def tick_right(self):
+ """
+ Move ticks and ticklabels (if present) to the right of the axes.
+ """
+ label = True
+ if 'label1On' in self._major_tick_kw:
+ label = (self._major_tick_kw['label1On']
+ or self._major_tick_kw['label2On'])
+ self.set_ticks_position('right')
+ # if labels were turned off before this was called
+ # leave them off
+ self.set_tick_params(which='both', labelright=label)
+
+ def tick_left(self):
+ """
+ Move ticks and ticklabels (if present) to the left of the axes.
+ """
+ label = True
+ if 'label1On' in self._major_tick_kw:
+ label = (self._major_tick_kw['label1On']
+ or self._major_tick_kw['label2On'])
+ self.set_ticks_position('left')
+ # if labels were turned off before this was called
+ # leave them off
+ self.set_tick_params(which='both', labelleft=label)
+
+ def get_ticks_position(self):
+ """
+ Return the ticks position ("left", "right", "default", or "unknown").
+ """
+ return {1: "left", 2: "right",
+ "default": "default", "unknown": "unknown"}[
+ self._get_ticks_position()]
+
+ get_view_interval, set_view_interval = _make_getset_interval(
+ "view", "viewLim", "intervaly")
+ get_data_interval, set_data_interval = _make_getset_interval(
+ "data", "dataLim", "intervaly")
+
+ def get_minpos(self):
+ return self.axes.dataLim.minposy
+
+ def set_inverted(self, inverted):
+ # docstring inherited
+ a, b = self.get_view_interval()
+ # cast to bool to avoid bad interaction between python 3.8 and np.bool_
+ self.axes.set_ylim(sorted((a, b), reverse=bool(inverted)), auto=None)
+
+ def set_default_intervals(self):
+ # docstring inherited
+ ymin, ymax = 0., 1.
+ dataMutated = self.axes.dataLim.mutatedy()
+ viewMutated = self.axes.viewLim.mutatedy()
+ if not dataMutated or not viewMutated:
+ if self.converter is not None:
+ info = self.converter.axisinfo(self.units, self)
+ if info.default_limits is not None:
+ valmin, valmax = info.default_limits
+ ymin = self.converter.convert(valmin, self.units, self)
+ ymax = self.converter.convert(valmax, self.units, self)
+ if not dataMutated:
+ self.axes.dataLim.intervaly = ymin, ymax
+ if not viewMutated:
+ self.axes.viewLim.intervaly = ymin, ymax
+ self.stale = True
+
+ def get_tick_space(self):
+ ends = self.axes.transAxes.transform([[0, 0], [0, 1]])
+ length = ((ends[1][1] - ends[0][1]) / self.axes.figure.dpi) * 72
+ # Having a spacing of at least 2 just looks good.
+ size = self._get_tick_label_size('y') * 2
+ if size > 0:
+ return int(np.floor(length / size))
+ else:
+ return 2**31 - 1
diff --git a/venv/Lib/site-packages/matplotlib/backend_bases.py b/venv/Lib/site-packages/matplotlib/backend_bases.py
new file mode 100644
index 0000000..32e069e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backend_bases.py
@@ -0,0 +1,3630 @@
+"""
+Abstract base classes define the primitives that renderers and
+graphics contexts must implement to serve as a Matplotlib backend.
+
+`RendererBase`
+ An abstract base class to handle drawing/rendering operations.
+
+`FigureCanvasBase`
+ The abstraction layer that separates the `.Figure` from the backend
+ specific details like a user interface drawing area.
+
+`GraphicsContextBase`
+ An abstract base class that provides color, line styles, etc.
+
+`Event`
+ The base class for all of the Matplotlib event handling. Derived classes
+ such as `KeyEvent` and `MouseEvent` store the meta data like keys and
+ buttons pressed, x and y locations in pixel and `~.axes.Axes` coordinates.
+
+`ShowBase`
+ The base class for the ``Show`` class of each interactive backend; the
+ 'show' callable is then set to ``Show.__call__``.
+
+`ToolContainerBase`
+ The base class for the Toolbar class of each interactive backend.
+"""
+
+from collections import namedtuple
+from contextlib import contextmanager, suppress
+from enum import Enum, IntEnum
+import functools
+import importlib
+import inspect
+import io
+import logging
+import os
+import re
+import sys
+import time
+import traceback
+from weakref import WeakKeyDictionary
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib import (
+ _api, backend_tools as tools, cbook, colors, docstring, textpath,
+ tight_bbox, transforms, widgets, get_backend, is_interactive, rcParams)
+from matplotlib._pylab_helpers import Gcf
+from matplotlib.backend_managers import ToolManager
+from matplotlib.cbook import _setattr_cm
+from matplotlib.path import Path
+from matplotlib.transforms import Affine2D
+from matplotlib._enums import JoinStyle, CapStyle
+
+
+_log = logging.getLogger(__name__)
+_default_filetypes = {
+ 'eps': 'Encapsulated Postscript',
+ 'jpg': 'Joint Photographic Experts Group',
+ 'jpeg': 'Joint Photographic Experts Group',
+ 'pdf': 'Portable Document Format',
+ 'pgf': 'PGF code for LaTeX',
+ 'png': 'Portable Network Graphics',
+ 'ps': 'Postscript',
+ 'raw': 'Raw RGBA bitmap',
+ 'rgba': 'Raw RGBA bitmap',
+ 'svg': 'Scalable Vector Graphics',
+ 'svgz': 'Scalable Vector Graphics',
+ 'tif': 'Tagged Image File Format',
+ 'tiff': 'Tagged Image File Format',
+}
+_default_backends = {
+ 'eps': 'matplotlib.backends.backend_ps',
+ 'jpg': 'matplotlib.backends.backend_agg',
+ 'jpeg': 'matplotlib.backends.backend_agg',
+ 'pdf': 'matplotlib.backends.backend_pdf',
+ 'pgf': 'matplotlib.backends.backend_pgf',
+ 'png': 'matplotlib.backends.backend_agg',
+ 'ps': 'matplotlib.backends.backend_ps',
+ 'raw': 'matplotlib.backends.backend_agg',
+ 'rgba': 'matplotlib.backends.backend_agg',
+ 'svg': 'matplotlib.backends.backend_svg',
+ 'svgz': 'matplotlib.backends.backend_svg',
+ 'tif': 'matplotlib.backends.backend_agg',
+ 'tiff': 'matplotlib.backends.backend_agg',
+}
+
+
+def _safe_pyplot_import():
+ """
+ Import and return ``pyplot``, correctly setting the backend if one is
+ already forced.
+ """
+ try:
+ import matplotlib.pyplot as plt
+ except ImportError: # Likely due to a framework mismatch.
+ current_framework = cbook._get_running_interactive_framework()
+ if current_framework is None:
+ raise # No, something else went wrong, likely with the install...
+ backend_mapping = {'qt5': 'qt5agg',
+ 'qt4': 'qt4agg',
+ 'gtk3': 'gtk3agg',
+ 'wx': 'wxagg',
+ 'tk': 'tkagg',
+ 'macosx': 'macosx',
+ 'headless': 'agg'}
+ backend = backend_mapping[current_framework]
+ rcParams["backend"] = mpl.rcParamsOrig["backend"] = backend
+ import matplotlib.pyplot as plt # Now this should succeed.
+ return plt
+
+
+def register_backend(format, backend, description=None):
+ """
+ Register a backend for saving to a given file format.
+
+ Parameters
+ ----------
+ format : str
+ File extension
+ backend : module string or canvas class
+ Backend for handling file output
+ description : str, default: ""
+ Description of the file type.
+ """
+ if description is None:
+ description = ''
+ _default_backends[format] = backend
+ _default_filetypes[format] = description
+
+
+def get_registered_canvas_class(format):
+ """
+ Return the registered default canvas for given file format.
+ Handles deferred import of required backend.
+ """
+ if format not in _default_backends:
+ return None
+ backend_class = _default_backends[format]
+ if isinstance(backend_class, str):
+ backend_class = importlib.import_module(backend_class).FigureCanvas
+ _default_backends[format] = backend_class
+ return backend_class
+
+
+class RendererBase:
+ """
+ An abstract base class to handle drawing/rendering operations.
+
+ The following methods must be implemented in the backend for full
+ functionality (though just implementing :meth:`draw_path` alone would
+ give a highly capable backend):
+
+ * :meth:`draw_path`
+ * :meth:`draw_image`
+ * :meth:`draw_gouraud_triangle`
+
+ The following methods *should* be implemented in the backend for
+ optimization reasons:
+
+ * :meth:`draw_text`
+ * :meth:`draw_markers`
+ * :meth:`draw_path_collection`
+ * :meth:`draw_quad_mesh`
+ """
+
+ def __init__(self):
+ super().__init__()
+ self._texmanager = None
+ self._text2path = textpath.TextToPath()
+ self._raster_depth = 0
+ self._rasterizing = False
+
+ def open_group(self, s, gid=None):
+ """
+ Open a grouping element with label *s* and *gid* (if set) as id.
+
+ Only used by the SVG renderer.
+ """
+
+ def close_group(self, s):
+ """
+ Close a grouping element with label *s*.
+
+ Only used by the SVG renderer.
+ """
+
+ def draw_path(self, gc, path, transform, rgbFace=None):
+ """Draw a `~.path.Path` instance using the given affine transform."""
+ raise NotImplementedError
+
+ def draw_markers(self, gc, marker_path, marker_trans, path,
+ trans, rgbFace=None):
+ """
+ Draw a marker at each of *path*'s vertices (excluding control points).
+
+ This provides a fallback implementation of draw_markers that
+ makes multiple calls to :meth:`draw_path`. Some backends may
+ want to override this method in order to draw the marker only
+ once and reuse it multiple times.
+
+ Parameters
+ ----------
+ gc : `.GraphicsContextBase`
+ The graphics context.
+ marker_trans : `matplotlib.transforms.Transform`
+ An affine transform applied to the marker.
+ trans : `matplotlib.transforms.Transform`
+ An affine transform applied to the path.
+ """
+ for vertices, codes in path.iter_segments(trans, simplify=False):
+ if len(vertices):
+ x, y = vertices[-2:]
+ self.draw_path(gc, marker_path,
+ marker_trans +
+ transforms.Affine2D().translate(x, y),
+ rgbFace)
+
+ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
+ offsets, offsetTrans, facecolors, edgecolors,
+ linewidths, linestyles, antialiaseds, urls,
+ offset_position):
+ """
+ Draw a collection of paths selecting drawing properties from
+ the lists *facecolors*, *edgecolors*, *linewidths*,
+ *linestyles* and *antialiaseds*. *offsets* is a list of
+ offsets to apply to each of the paths. The offsets in
+ *offsets* are first transformed by *offsetTrans* before being
+ applied.
+
+ *offset_position* may be either "screen" or "data" depending on the
+ space that the offsets are in; "data" is deprecated.
+
+ This provides a fallback implementation of
+ :meth:`draw_path_collection` that makes multiple calls to
+ :meth:`draw_path`. Some backends may want to override this in
+ order to render each set of path data only once, and then
+ reference that path multiple times with the different offsets,
+ colors, styles etc. The generator methods
+ :meth:`_iter_collection_raw_paths` and
+ :meth:`_iter_collection` are provided to help with (and
+ standardize) the implementation across backends. It is highly
+ recommended to use those generators, so that changes to the
+ behavior of :meth:`draw_path_collection` can be made globally.
+ """
+ path_ids = self._iter_collection_raw_paths(master_transform,
+ paths, all_transforms)
+
+ for xo, yo, path_id, gc0, rgbFace in self._iter_collection(
+ gc, master_transform, all_transforms, list(path_ids), offsets,
+ offsetTrans, facecolors, edgecolors, linewidths, linestyles,
+ antialiaseds, urls, offset_position):
+ path, transform = path_id
+ # Only apply another translation if we have an offset, else we
+ # reuse the initial transform.
+ if xo != 0 or yo != 0:
+ # The transformation can be used by multiple paths. Since
+ # translate is a inplace operation, we need to copy the
+ # transformation by .frozen() before applying the translation.
+ transform = transform.frozen()
+ transform.translate(xo, yo)
+ self.draw_path(gc0, path, transform, rgbFace)
+
+ def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
+ coordinates, offsets, offsetTrans, facecolors,
+ antialiased, edgecolors):
+ """
+ Fallback implementation of :meth:`draw_quad_mesh` that generates paths
+ and then calls :meth:`draw_path_collection`.
+ """
+
+ from matplotlib.collections import QuadMesh
+ paths = QuadMesh.convert_mesh_to_paths(
+ meshWidth, meshHeight, coordinates)
+
+ if edgecolors is None:
+ edgecolors = facecolors
+ linewidths = np.array([gc.get_linewidth()], float)
+
+ return self.draw_path_collection(
+ gc, master_transform, paths, [], offsets, offsetTrans, facecolors,
+ edgecolors, linewidths, [], [antialiased], [None], 'screen')
+
+ def draw_gouraud_triangle(self, gc, points, colors, transform):
+ """
+ Draw a Gouraud-shaded triangle.
+
+ Parameters
+ ----------
+ gc : `.GraphicsContextBase`
+ The graphics context.
+ points : (3, 2) array-like
+ Array of (x, y) points for the triangle.
+ colors : (3, 4) array-like
+ RGBA colors for each point of the triangle.
+ transform : `matplotlib.transforms.Transform`
+ An affine transform to apply to the points.
+ """
+ raise NotImplementedError
+
+ def draw_gouraud_triangles(self, gc, triangles_array, colors_array,
+ transform):
+ """
+ Draw a series of Gouraud triangles.
+
+ Parameters
+ ----------
+ points : (N, 3, 2) array-like
+ Array of *N* (x, y) points for the triangles.
+ colors : (N, 3, 4) array-like
+ Array of *N* RGBA colors for each point of the triangles.
+ transform : `matplotlib.transforms.Transform`
+ An affine transform to apply to the points.
+ """
+ transform = transform.frozen()
+ for tri, col in zip(triangles_array, colors_array):
+ self.draw_gouraud_triangle(gc, tri, col, transform)
+
+ def _iter_collection_raw_paths(self, master_transform, paths,
+ all_transforms):
+ """
+ Helper method (along with :meth:`_iter_collection`) to implement
+ :meth:`draw_path_collection` in a space-efficient manner.
+
+ This method yields all of the base path/transform
+ combinations, given a master transform, a list of paths and
+ list of transforms.
+
+ The arguments should be exactly what is passed in to
+ :meth:`draw_path_collection`.
+
+ The backend should take each yielded path and transform and
+ create an object that can be referenced (reused) later.
+ """
+ Npaths = len(paths)
+ Ntransforms = len(all_transforms)
+ N = max(Npaths, Ntransforms)
+
+ if Npaths == 0:
+ return
+
+ transform = transforms.IdentityTransform()
+ for i in range(N):
+ path = paths[i % Npaths]
+ if Ntransforms:
+ transform = Affine2D(all_transforms[i % Ntransforms])
+ yield path, transform + master_transform
+
+ def _iter_collection_uses_per_path(self, paths, all_transforms,
+ offsets, facecolors, edgecolors):
+ """
+ Compute how many times each raw path object returned by
+ _iter_collection_raw_paths would be used when calling
+ _iter_collection. This is intended for the backend to decide
+ on the tradeoff between using the paths in-line and storing
+ them once and reusing. Rounds up in case the number of uses
+ is not the same for every path.
+ """
+ Npaths = len(paths)
+ if Npaths == 0 or len(facecolors) == len(edgecolors) == 0:
+ return 0
+ Npath_ids = max(Npaths, len(all_transforms))
+ N = max(Npath_ids, len(offsets))
+ return (N + Npath_ids - 1) // Npath_ids
+
+ def _iter_collection(self, gc, master_transform, all_transforms,
+ path_ids, offsets, offsetTrans, facecolors,
+ edgecolors, linewidths, linestyles,
+ antialiaseds, urls, offset_position):
+ """
+ Helper method (along with :meth:`_iter_collection_raw_paths`) to
+ implement :meth:`draw_path_collection` in a space-efficient manner.
+
+ This method yields all of the path, offset and graphics
+ context combinations to draw the path collection. The caller
+ should already have looped over the results of
+ :meth:`_iter_collection_raw_paths` to draw this collection.
+
+ The arguments should be the same as that passed into
+ :meth:`draw_path_collection`, with the exception of
+ *path_ids*, which is a list of arbitrary objects that the
+ backend will use to reference one of the paths created in the
+ :meth:`_iter_collection_raw_paths` stage.
+
+ Each yielded result is of the form::
+
+ xo, yo, path_id, gc, rgbFace
+
+ where *xo*, *yo* is an offset; *path_id* is one of the elements of
+ *path_ids*; *gc* is a graphics context and *rgbFace* is a color to
+ use for filling the path.
+ """
+ Ntransforms = len(all_transforms)
+ Npaths = len(path_ids)
+ Noffsets = len(offsets)
+ N = max(Npaths, Noffsets)
+ Nfacecolors = len(facecolors)
+ Nedgecolors = len(edgecolors)
+ Nlinewidths = len(linewidths)
+ Nlinestyles = len(linestyles)
+ Naa = len(antialiaseds)
+ Nurls = len(urls)
+
+ if offset_position == "data":
+ _api.warn_deprecated(
+ "3.3", message="Support for offset_position='data' is "
+ "deprecated since %(since)s and will be removed %(removal)s.")
+
+ if (Nfacecolors == 0 and Nedgecolors == 0) or Npaths == 0:
+ return
+ if Noffsets:
+ toffsets = offsetTrans.transform(offsets)
+
+ gc0 = self.new_gc()
+ gc0.copy_properties(gc)
+
+ if Nfacecolors == 0:
+ rgbFace = None
+
+ if Nedgecolors == 0:
+ gc0.set_linewidth(0.0)
+
+ xo, yo = 0, 0
+ for i in range(N):
+ path_id = path_ids[i % Npaths]
+ if Noffsets:
+ xo, yo = toffsets[i % Noffsets]
+ if offset_position == 'data':
+ if Ntransforms:
+ transform = (
+ Affine2D(all_transforms[i % Ntransforms]) +
+ master_transform)
+ else:
+ transform = master_transform
+ (xo, yo), (xp, yp) = transform.transform(
+ [(xo, yo), (0, 0)])
+ xo = -(xp - xo)
+ yo = -(yp - yo)
+ if not (np.isfinite(xo) and np.isfinite(yo)):
+ continue
+ if Nfacecolors:
+ rgbFace = facecolors[i % Nfacecolors]
+ if Nedgecolors:
+ if Nlinewidths:
+ gc0.set_linewidth(linewidths[i % Nlinewidths])
+ if Nlinestyles:
+ gc0.set_dashes(*linestyles[i % Nlinestyles])
+ fg = edgecolors[i % Nedgecolors]
+ if len(fg) == 4:
+ if fg[3] == 0.0:
+ gc0.set_linewidth(0)
+ else:
+ gc0.set_foreground(fg)
+ else:
+ gc0.set_foreground(fg)
+ if rgbFace is not None and len(rgbFace) == 4:
+ if rgbFace[3] == 0:
+ rgbFace = None
+ gc0.set_antialiased(antialiaseds[i % Naa])
+ if Nurls:
+ gc0.set_url(urls[i % Nurls])
+
+ yield xo, yo, path_id, gc0, rgbFace
+ gc0.restore()
+
+ def get_image_magnification(self):
+ """
+ Get the factor by which to magnify images passed to :meth:`draw_image`.
+ Allows a backend to have images at a different resolution to other
+ artists.
+ """
+ return 1.0
+
+ def draw_image(self, gc, x, y, im, transform=None):
+ """
+ Draw an RGBA image.
+
+ Parameters
+ ----------
+ gc : `.GraphicsContextBase`
+ A graphics context with clipping information.
+
+ x : scalar
+ The distance in physical units (i.e., dots or pixels) from the left
+ hand side of the canvas.
+
+ y : scalar
+ The distance in physical units (i.e., dots or pixels) from the
+ bottom side of the canvas.
+
+ im : (N, M, 4) array-like of np.uint8
+ An array of RGBA pixels.
+
+ transform : `matplotlib.transforms.Affine2DBase`
+ If and only if the concrete backend is written such that
+ :meth:`option_scale_image` returns ``True``, an affine
+ transformation (i.e., an `.Affine2DBase`) *may* be passed to
+ :meth:`draw_image`. The translation vector of the transformation
+ is given in physical units (i.e., dots or pixels). Note that
+ the transformation does not override *x* and *y*, and has to be
+ applied *before* translating the result by *x* and *y* (this can
+ be accomplished by adding *x* and *y* to the translation vector
+ defined by *transform*).
+ """
+ raise NotImplementedError
+
+ def option_image_nocomposite(self):
+ """
+ Return whether image composition by Matplotlib should be skipped.
+
+ Raster backends should usually return False (letting the C-level
+ rasterizer take care of image composition); vector backends should
+ usually return ``not rcParams["image.composite_image"]``.
+ """
+ return False
+
+ def option_scale_image(self):
+ """
+ Return whether arbitrary affine transformations in :meth:`draw_image`
+ are supported (True for most vector backends).
+ """
+ return False
+
+ @_api.delete_parameter("3.3", "ismath")
+ def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
+ """
+ """
+ self._draw_text_as_path(gc, x, y, s, prop, angle, ismath="TeX")
+
+ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
+ """
+ Draw the text instance.
+
+ Parameters
+ ----------
+ gc : `.GraphicsContextBase`
+ The graphics context.
+ x : float
+ The x location of the text in display coords.
+ y : float
+ The y location of the text baseline in display coords.
+ s : str
+ The text string.
+ prop : `matplotlib.font_manager.FontProperties`
+ The font properties.
+ angle : float
+ The rotation angle in degrees anti-clockwise.
+ mtext : `matplotlib.text.Text`
+ The original text object to be rendered.
+
+ Notes
+ -----
+ **Note for backend implementers:**
+
+ When you are trying to determine if you have gotten your bounding box
+ right (which is what enables the text layout/alignment to work
+ properly), it helps to change the line in text.py::
+
+ if 0: bbox_artist(self, renderer)
+
+ to if 1, and then the actual bounding box will be plotted along with
+ your text.
+ """
+
+ self._draw_text_as_path(gc, x, y, s, prop, angle, ismath)
+
+ def _get_text_path_transform(self, x, y, s, prop, angle, ismath):
+ """
+ Return the text path and transform.
+
+ Parameters
+ ----------
+ prop : `matplotlib.font_manager.FontProperties`
+ The font property.
+ s : str
+ The text to be converted.
+ ismath : bool or "TeX"
+ If True, use mathtext parser. If "TeX", use *usetex* mode.
+ """
+
+ text2path = self._text2path
+ fontsize = self.points_to_pixels(prop.get_size_in_points())
+ verts, codes = text2path.get_text_path(prop, s, ismath=ismath)
+
+ path = Path(verts, codes)
+ angle = np.deg2rad(angle)
+ if self.flipy():
+ width, height = self.get_canvas_width_height()
+ transform = (Affine2D()
+ .scale(fontsize / text2path.FONT_SCALE)
+ .rotate(angle)
+ .translate(x, height - y))
+ else:
+ transform = (Affine2D()
+ .scale(fontsize / text2path.FONT_SCALE)
+ .rotate(angle)
+ .translate(x, y))
+
+ return path, transform
+
+ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath):
+ """
+ Draw the text by converting them to paths using textpath module.
+
+ Parameters
+ ----------
+ prop : `matplotlib.font_manager.FontProperties`
+ The font property.
+ s : str
+ The text to be converted.
+ usetex : bool
+ Whether to use usetex mode.
+ ismath : bool or "TeX"
+ If True, use mathtext parser. If "TeX", use *usetex* mode.
+ """
+ path, transform = self._get_text_path_transform(
+ x, y, s, prop, angle, ismath)
+ color = gc.get_rgb()
+ gc.set_linewidth(0.0)
+ self.draw_path(gc, path, transform, rgbFace=color)
+
+ def get_text_width_height_descent(self, s, prop, ismath):
+ """
+ Get the width, height, and descent (offset from the bottom
+ to the baseline), in display coords, of the string *s* with
+ `.FontProperties` *prop*.
+ """
+ if ismath == 'TeX':
+ # todo: handle props
+ texmanager = self._text2path.get_texmanager()
+ fontsize = prop.get_size_in_points()
+ w, h, d = texmanager.get_text_width_height_descent(
+ s, fontsize, renderer=self)
+ return w, h, d
+
+ dpi = self.points_to_pixels(72)
+ if ismath:
+ dims = self._text2path.mathtext_parser.parse(s, dpi, prop)
+ return dims[0:3] # return width, height, descent
+
+ flags = self._text2path._get_hinting_flag()
+ font = self._text2path._get_font(prop)
+ size = prop.get_size_in_points()
+ font.set_size(size, dpi)
+ # the width and height of unrotated string
+ font.set_text(s, 0.0, flags=flags)
+ w, h = font.get_width_height()
+ d = font.get_descent()
+ w /= 64.0 # convert from subpixels
+ h /= 64.0
+ d /= 64.0
+ return w, h, d
+
+ def flipy(self):
+ """
+ Return whether y values increase from top to bottom.
+
+ Note that this only affects drawing of texts and images.
+ """
+ return True
+
+ def get_canvas_width_height(self):
+ """Return the canvas width and height in display coords."""
+ return 1, 1
+
+ def get_texmanager(self):
+ """Return the `.TexManager` instance."""
+ if self._texmanager is None:
+ from matplotlib.texmanager import TexManager
+ self._texmanager = TexManager()
+ return self._texmanager
+
+ def new_gc(self):
+ """Return an instance of a `.GraphicsContextBase`."""
+ return GraphicsContextBase()
+
+ def points_to_pixels(self, points):
+ """
+ Convert points to display units.
+
+ You need to override this function (unless your backend
+ doesn't have a dpi, e.g., postscript or svg). Some imaging
+ systems assume some value for pixels per inch::
+
+ points to pixels = points * pixels_per_inch/72 * dpi/72
+
+ Parameters
+ ----------
+ points : float or array-like
+ a float or a numpy array of float
+
+ Returns
+ -------
+ Points converted to pixels
+ """
+ return points
+
+ def start_rasterizing(self):
+ """
+ Switch to the raster renderer.
+
+ Used by `.MixedModeRenderer`.
+ """
+
+ def stop_rasterizing(self):
+ """
+ Switch back to the vector renderer and draw the contents of the raster
+ renderer as an image on the vector renderer.
+
+ Used by `.MixedModeRenderer`.
+ """
+
+ def start_filter(self):
+ """
+ Switch to a temporary renderer for image filtering effects.
+
+ Currently only supported by the agg renderer.
+ """
+
+ def stop_filter(self, filter_func):
+ """
+ Switch back to the original renderer. The contents of the temporary
+ renderer is processed with the *filter_func* and is drawn on the
+ original renderer as an image.
+
+ Currently only supported by the agg renderer.
+ """
+
+ def _draw_disabled(self):
+ """
+ Context manager to temporary disable drawing.
+
+ This is used for getting the drawn size of Artists. This lets us
+ run the draw process to update any Python state but does not pay the
+ cost of the draw_XYZ calls on the canvas.
+ """
+ no_ops = {
+ meth_name: lambda *args, **kwargs: None
+ for meth_name in dir(RendererBase)
+ if (meth_name.startswith("draw_")
+ or meth_name in ["open_group", "close_group"])
+ }
+
+ return _setattr_cm(self, **no_ops)
+
+
+class GraphicsContextBase:
+ """An abstract base class that provides color, line styles, etc."""
+
+ def __init__(self):
+ self._alpha = 1.0
+ self._forced_alpha = False # if True, _alpha overrides A from RGBA
+ self._antialiased = 1 # use 0, 1 not True, False for extension code
+ self._capstyle = CapStyle('butt')
+ self._cliprect = None
+ self._clippath = None
+ self._dashes = 0, None
+ self._joinstyle = JoinStyle('round')
+ self._linestyle = 'solid'
+ self._linewidth = 1
+ self._rgb = (0.0, 0.0, 0.0, 1.0)
+ self._hatch = None
+ self._hatch_color = colors.to_rgba(rcParams['hatch.color'])
+ self._hatch_linewidth = rcParams['hatch.linewidth']
+ self._url = None
+ self._gid = None
+ self._snap = None
+ self._sketch = None
+
+ def copy_properties(self, gc):
+ """Copy properties from *gc* to self."""
+ self._alpha = gc._alpha
+ self._forced_alpha = gc._forced_alpha
+ self._antialiased = gc._antialiased
+ self._capstyle = gc._capstyle
+ self._cliprect = gc._cliprect
+ self._clippath = gc._clippath
+ self._dashes = gc._dashes
+ self._joinstyle = gc._joinstyle
+ self._linestyle = gc._linestyle
+ self._linewidth = gc._linewidth
+ self._rgb = gc._rgb
+ self._hatch = gc._hatch
+ self._hatch_color = gc._hatch_color
+ self._hatch_linewidth = gc._hatch_linewidth
+ self._url = gc._url
+ self._gid = gc._gid
+ self._snap = gc._snap
+ self._sketch = gc._sketch
+
+ def restore(self):
+ """
+ Restore the graphics context from the stack - needed only
+ for backends that save graphics contexts on a stack.
+ """
+
+ def get_alpha(self):
+ """
+ Return the alpha value used for blending - not supported on all
+ backends.
+ """
+ return self._alpha
+
+ def get_antialiased(self):
+ """Return whether the object should try to do antialiased rendering."""
+ return self._antialiased
+
+ def get_capstyle(self):
+ """Return the `.CapStyle`."""
+ return self._capstyle.name
+
+ def get_clip_rectangle(self):
+ """
+ Return the clip rectangle as a `~matplotlib.transforms.Bbox` instance.
+ """
+ return self._cliprect
+
+ def get_clip_path(self):
+ """
+ Return the clip path in the form (path, transform), where path
+ is a `~.path.Path` instance, and transform is
+ an affine transform to apply to the path before clipping.
+ """
+ if self._clippath is not None:
+ tpath, tr = self._clippath.get_transformed_path_and_affine()
+ if np.all(np.isfinite(tpath.vertices)):
+ return tpath, tr
+ else:
+ _log.warning("Ill-defined clip_path detected. Returning None.")
+ return None, None
+ return None, None
+
+ def get_dashes(self):
+ """
+ Return the dash style as an (offset, dash-list) pair.
+
+ The dash list is a even-length list that gives the ink on, ink off in
+ points. See p. 107 of to PostScript `blue book`_ for more info.
+
+ Default value is (None, None).
+
+ .. _blue book: https://www-cdf.fnal.gov/offline/PostScript/BLUEBOOK.PDF
+ """
+ return self._dashes
+
+ def get_forced_alpha(self):
+ """
+ Return whether the value given by get_alpha() should be used to
+ override any other alpha-channel values.
+ """
+ return self._forced_alpha
+
+ def get_joinstyle(self):
+ """Return the `.JoinStyle`."""
+ return self._joinstyle.name
+
+ def get_linewidth(self):
+ """Return the line width in points."""
+ return self._linewidth
+
+ def get_rgb(self):
+ """Return a tuple of three or four floats from 0-1."""
+ return self._rgb
+
+ def get_url(self):
+ """Return a url if one is set, None otherwise."""
+ return self._url
+
+ def get_gid(self):
+ """Return the object identifier if one is set, None otherwise."""
+ return self._gid
+
+ def get_snap(self):
+ """
+ Return the snap setting, which can be:
+
+ * True: snap vertices to the nearest pixel center
+ * False: leave vertices as-is
+ * None: (auto) If the path contains only rectilinear line segments,
+ round to the nearest pixel center
+ """
+ return self._snap
+
+ def set_alpha(self, alpha):
+ """
+ Set the alpha value used for blending - not supported on all backends.
+
+ If ``alpha=None`` (the default), the alpha components of the
+ foreground and fill colors will be used to set their respective
+ transparencies (where applicable); otherwise, ``alpha`` will override
+ them.
+ """
+ if alpha is not None:
+ self._alpha = alpha
+ self._forced_alpha = True
+ else:
+ self._alpha = 1.0
+ self._forced_alpha = False
+ self.set_foreground(self._rgb, isRGBA=True)
+
+ def set_antialiased(self, b):
+ """Set whether object should be drawn with antialiased rendering."""
+ # Use ints to make life easier on extension code trying to read the gc.
+ self._antialiased = int(bool(b))
+
+ @docstring.interpd
+ def set_capstyle(self, cs):
+ """
+ Set how to draw endpoints of lines.
+
+ Parameters
+ ----------
+ cs : `.CapStyle` or %(CapStyle)s
+ """
+ self._capstyle = CapStyle(cs)
+
+ def set_clip_rectangle(self, rectangle):
+ """Set the clip rectangle to a `.Bbox` or None."""
+ self._cliprect = rectangle
+
+ def set_clip_path(self, path):
+ """Set the clip path to a `.TransformedPath` or None."""
+ _api.check_isinstance((transforms.TransformedPath, None), path=path)
+ self._clippath = path
+
+ def set_dashes(self, dash_offset, dash_list):
+ """
+ Set the dash style for the gc.
+
+ Parameters
+ ----------
+ dash_offset : float or None
+ The offset (usually 0).
+ dash_list : array-like or None
+ The on-off sequence as points.
+
+ Notes
+ -----
+ ``(None, None)`` specifies a solid line.
+
+ See p. 107 of to PostScript `blue book`_ for more info.
+
+ .. _blue book: https://www-cdf.fnal.gov/offline/PostScript/BLUEBOOK.PDF
+ """
+ if dash_list is not None:
+ dl = np.asarray(dash_list)
+ if np.any(dl < 0.0):
+ raise ValueError(
+ "All values in the dash list must be positive")
+ self._dashes = dash_offset, dash_list
+
+ def set_foreground(self, fg, isRGBA=False):
+ """
+ Set the foreground color.
+
+ Parameters
+ ----------
+ fg : color
+ isRGBA : bool
+ If *fg* is known to be an ``(r, g, b, a)`` tuple, *isRGBA* can be
+ set to True to improve performance.
+ """
+ if self._forced_alpha and isRGBA:
+ self._rgb = fg[:3] + (self._alpha,)
+ elif self._forced_alpha:
+ self._rgb = colors.to_rgba(fg, self._alpha)
+ elif isRGBA:
+ self._rgb = fg
+ else:
+ self._rgb = colors.to_rgba(fg)
+
+ @docstring.interpd
+ def set_joinstyle(self, js):
+ """
+ Set how to draw connections between line segments.
+
+ Parameters
+ ----------
+ js : `.JoinStyle` or %(JoinStyle)s
+ """
+ self._joinstyle = JoinStyle(js)
+
+ def set_linewidth(self, w):
+ """Set the linewidth in points."""
+ self._linewidth = float(w)
+
+ def set_url(self, url):
+ """Set the url for links in compatible backends."""
+ self._url = url
+
+ def set_gid(self, id):
+ """Set the id."""
+ self._gid = id
+
+ def set_snap(self, snap):
+ """
+ Set the snap setting which may be:
+
+ * True: snap vertices to the nearest pixel center
+ * False: leave vertices as-is
+ * None: (auto) If the path contains only rectilinear line segments,
+ round to the nearest pixel center
+ """
+ self._snap = snap
+
+ def set_hatch(self, hatch):
+ """Set the hatch style (for fills)."""
+ self._hatch = hatch
+
+ def get_hatch(self):
+ """Get the current hatch style."""
+ return self._hatch
+
+ def get_hatch_path(self, density=6.0):
+ """Return a `.Path` for the current hatch."""
+ hatch = self.get_hatch()
+ if hatch is None:
+ return None
+ return Path.hatch(hatch, density)
+
+ def get_hatch_color(self):
+ """Get the hatch color."""
+ return self._hatch_color
+
+ def set_hatch_color(self, hatch_color):
+ """Set the hatch color."""
+ self._hatch_color = hatch_color
+
+ def get_hatch_linewidth(self):
+ """Get the hatch linewidth."""
+ return self._hatch_linewidth
+
+ def get_sketch_params(self):
+ """
+ Return the sketch parameters for the artist.
+
+ Returns
+ -------
+ tuple or `None`
+
+ A 3-tuple with the following elements:
+
+ * ``scale``: The amplitude of the wiggle perpendicular to the
+ source line.
+ * ``length``: The length of the wiggle along the line.
+ * ``randomness``: The scale factor by which the length is
+ shrunken or expanded.
+
+ May return `None` if no sketch parameters were set.
+ """
+ return self._sketch
+
+ def set_sketch_params(self, scale=None, length=None, randomness=None):
+ """
+ Set the sketch parameters.
+
+ Parameters
+ ----------
+ scale : float, optional
+ The amplitude of the wiggle perpendicular to the source line, in
+ pixels. If scale is `None`, or not provided, no sketch filter will
+ be provided.
+ length : float, default: 128
+ The length of the wiggle along the line, in pixels.
+ randomness : float, default: 16
+ The scale factor by which the length is shrunken or expanded.
+ """
+ self._sketch = (
+ None if scale is None
+ else (scale, length or 128., randomness or 16.))
+
+
+class TimerBase:
+ """
+ A base class for providing timer events, useful for things animations.
+ Backends need to implement a few specific methods in order to use their
+ own timing mechanisms so that the timer events are integrated into their
+ event loops.
+
+ Subclasses must override the following methods:
+
+ - ``_timer_start``: Backend-specific code for starting the timer.
+ - ``_timer_stop``: Backend-specific code for stopping the timer.
+
+ Subclasses may additionally override the following methods:
+
+ - ``_timer_set_single_shot``: Code for setting the timer to single shot
+ operating mode, if supported by the timer object. If not, the `Timer`
+ class itself will store the flag and the ``_on_timer`` method should be
+ overridden to support such behavior.
+
+ - ``_timer_set_interval``: Code for setting the interval on the timer, if
+ there is a method for doing so on the timer object.
+
+ - ``_on_timer``: The internal function that any timer object should call,
+ which will handle the task of running all callbacks that have been set.
+ """
+
+ def __init__(self, interval=None, callbacks=None):
+ """
+ Parameters
+ ----------
+ interval : int, default: 1000ms
+ The time between timer events in milliseconds. Will be stored as
+ ``timer.interval``.
+ callbacks : list[tuple[callable, tuple, dict]]
+ List of (func, args, kwargs) tuples that will be called upon
+ timer events. This list is accessible as ``timer.callbacks`` and
+ can be manipulated directly, or the functions `add_callback` and
+ `remove_callback` can be used.
+ """
+ self.callbacks = [] if callbacks is None else callbacks.copy()
+ # Set .interval and not ._interval to go through the property setter.
+ self.interval = 1000 if interval is None else interval
+ self.single_shot = False
+
+ def __del__(self):
+ """Need to stop timer and possibly disconnect timer."""
+ self._timer_stop()
+
+ def start(self, interval=None):
+ """
+ Start the timer object.
+
+ Parameters
+ ----------
+ interval : int, optional
+ Timer interval in milliseconds; overrides a previously set interval
+ if provided.
+ """
+ if interval is not None:
+ self.interval = interval
+ self._timer_start()
+
+ def stop(self):
+ """Stop the timer."""
+ self._timer_stop()
+
+ def _timer_start(self):
+ pass
+
+ def _timer_stop(self):
+ pass
+
+ @property
+ def interval(self):
+ """The time between timer events, in milliseconds."""
+ return self._interval
+
+ @interval.setter
+ def interval(self, interval):
+ # Force to int since none of the backends actually support fractional
+ # milliseconds, and some error or give warnings.
+ interval = int(interval)
+ self._interval = interval
+ self._timer_set_interval()
+
+ @property
+ def single_shot(self):
+ """Whether this timer should stop after a single run."""
+ return self._single
+
+ @single_shot.setter
+ def single_shot(self, ss):
+ self._single = ss
+ self._timer_set_single_shot()
+
+ def add_callback(self, func, *args, **kwargs):
+ """
+ Register *func* to be called by timer when the event fires. Any
+ additional arguments provided will be passed to *func*.
+
+ This function returns *func*, which makes it possible to use it as a
+ decorator.
+ """
+ self.callbacks.append((func, args, kwargs))
+ return func
+
+ def remove_callback(self, func, *args, **kwargs):
+ """
+ Remove *func* from list of callbacks.
+
+ *args* and *kwargs* are optional and used to distinguish between copies
+ of the same function registered to be called with different arguments.
+ This behavior is deprecated. In the future, ``*args, **kwargs`` won't
+ be considered anymore; to keep a specific callback removable by itself,
+ pass it to `add_callback` as a `functools.partial` object.
+ """
+ if args or kwargs:
+ _api.warn_deprecated(
+ "3.1", message="In a future version, Timer.remove_callback "
+ "will not take *args, **kwargs anymore, but remove all "
+ "callbacks where the callable matches; to keep a specific "
+ "callback removable by itself, pass it to add_callback as a "
+ "functools.partial object.")
+ self.callbacks.remove((func, args, kwargs))
+ else:
+ funcs = [c[0] for c in self.callbacks]
+ if func in funcs:
+ self.callbacks.pop(funcs.index(func))
+
+ def _timer_set_interval(self):
+ """Used to set interval on underlying timer object."""
+
+ def _timer_set_single_shot(self):
+ """Used to set single shot on underlying timer object."""
+
+ def _on_timer(self):
+ """
+ Runs all function that have been registered as callbacks. Functions
+ can return False (or 0) if they should not be called any more. If there
+ are no callbacks, the timer is automatically stopped.
+ """
+ for func, args, kwargs in self.callbacks:
+ ret = func(*args, **kwargs)
+ # docstring above explains why we use `if ret == 0` here,
+ # instead of `if not ret`.
+ # This will also catch `ret == False` as `False == 0`
+ # but does not annoy the linters
+ # https://docs.python.org/3/library/stdtypes.html#boolean-values
+ if ret == 0:
+ self.callbacks.remove((func, args, kwargs))
+
+ if len(self.callbacks) == 0:
+ self.stop()
+
+
+class Event:
+ """
+ A Matplotlib event. Attach additional attributes as defined in
+ :meth:`FigureCanvasBase.mpl_connect`. The following attributes
+ are defined and shown with their default values
+
+ Attributes
+ ----------
+ name : str
+ The event name.
+ canvas : `FigureCanvasBase`
+ The backend-specific canvas instance generating the event.
+ guiEvent
+ The GUI event that triggered the Matplotlib event.
+ """
+ def __init__(self, name, canvas, guiEvent=None):
+ self.name = name
+ self.canvas = canvas
+ self.guiEvent = guiEvent
+
+
+class DrawEvent(Event):
+ """
+ An event triggered by a draw operation on the canvas
+
+ In most backends callbacks subscribed to this callback will be
+ fired after the rendering is complete but before the screen is
+ updated. Any extra artists drawn to the canvas's renderer will
+ be reflected without an explicit call to ``blit``.
+
+ .. warning::
+
+ Calling ``canvas.draw`` and ``canvas.blit`` in these callbacks may
+ not be safe with all backends and may cause infinite recursion.
+
+ In addition to the `Event` attributes, the following event
+ attributes are defined:
+
+ Attributes
+ ----------
+ renderer : `RendererBase`
+ The renderer for the draw event.
+ """
+ def __init__(self, name, canvas, renderer):
+ super().__init__(name, canvas)
+ self.renderer = renderer
+
+
+class ResizeEvent(Event):
+ """
+ An event triggered by a canvas resize
+
+ In addition to the `Event` attributes, the following event
+ attributes are defined:
+
+ Attributes
+ ----------
+ width : int
+ Width of the canvas in pixels.
+ height : int
+ Height of the canvas in pixels.
+ """
+ def __init__(self, name, canvas):
+ super().__init__(name, canvas)
+ self.width, self.height = canvas.get_width_height()
+
+
+class CloseEvent(Event):
+ """An event triggered by a figure being closed."""
+
+
+class LocationEvent(Event):
+ """
+ An event that has a screen location.
+
+ The following additional attributes are defined and shown with
+ their default values.
+
+ In addition to the `Event` attributes, the following
+ event attributes are defined:
+
+ Attributes
+ ----------
+ x : int
+ x position - pixels from left of canvas.
+ y : int
+ y position - pixels from bottom of canvas.
+ inaxes : `~.axes.Axes` or None
+ The `~.axes.Axes` instance over which the mouse is, if any.
+ xdata : float or None
+ x data coordinate of the mouse.
+ ydata : float or None
+ y data coordinate of the mouse.
+ """
+
+ lastevent = None # the last event that was triggered before this one
+
+ def __init__(self, name, canvas, x, y, guiEvent=None):
+ """
+ (*x*, *y*) in figure coords ((0, 0) = bottom left).
+ """
+ super().__init__(name, canvas, guiEvent=guiEvent)
+ # x position - pixels from left of canvas
+ self.x = int(x) if x is not None else x
+ # y position - pixels from right of canvas
+ self.y = int(y) if y is not None else y
+ self.inaxes = None # the Axes instance if mouse us over axes
+ self.xdata = None # x coord of mouse in data coords
+ self.ydata = None # y coord of mouse in data coords
+
+ if x is None or y is None:
+ # cannot check if event was in axes if no (x, y) info
+ self._update_enter_leave()
+ return
+
+ if self.canvas.mouse_grabber is None:
+ self.inaxes = self.canvas.inaxes((x, y))
+ else:
+ self.inaxes = self.canvas.mouse_grabber
+
+ if self.inaxes is not None:
+ try:
+ trans = self.inaxes.transData.inverted()
+ xdata, ydata = trans.transform((x, y))
+ except ValueError:
+ pass
+ else:
+ self.xdata = xdata
+ self.ydata = ydata
+
+ self._update_enter_leave()
+
+ def _update_enter_leave(self):
+ """Process the figure/axes enter leave events."""
+ if LocationEvent.lastevent is not None:
+ last = LocationEvent.lastevent
+ if last.inaxes != self.inaxes:
+ # process axes enter/leave events
+ try:
+ if last.inaxes is not None:
+ last.canvas.callbacks.process('axes_leave_event', last)
+ except Exception:
+ pass
+ # See ticket 2901582.
+ # I think this is a valid exception to the rule
+ # against catching all exceptions; if anything goes
+ # wrong, we simply want to move on and process the
+ # current event.
+ if self.inaxes is not None:
+ self.canvas.callbacks.process('axes_enter_event', self)
+
+ else:
+ # process a figure enter event
+ if self.inaxes is not None:
+ self.canvas.callbacks.process('axes_enter_event', self)
+
+ LocationEvent.lastevent = self
+
+
+class MouseButton(IntEnum):
+ LEFT = 1
+ MIDDLE = 2
+ RIGHT = 3
+ BACK = 8
+ FORWARD = 9
+
+
+class MouseEvent(LocationEvent):
+ """
+ A mouse event ('button_press_event',
+ 'button_release_event',
+ 'scroll_event',
+ 'motion_notify_event').
+
+ In addition to the `Event` and `LocationEvent`
+ attributes, the following attributes are defined:
+
+ Attributes
+ ----------
+ button : None or `MouseButton` or {'up', 'down'}
+ The button pressed. 'up' and 'down' are used for scroll events.
+ Note that LEFT and RIGHT actually refer to the "primary" and
+ "secondary" buttons, i.e. if the user inverts their left and right
+ buttons ("left-handed setting") then the LEFT button will be the one
+ physically on the right.
+
+ key : None or str
+ The key pressed when the mouse event triggered, e.g. 'shift'.
+ See `KeyEvent`.
+
+ .. warning::
+ This key is currently obtained from the last 'key_press_event' or
+ 'key_release_event' that occurred within the canvas. Thus, if the
+ last change of keyboard state occurred while the canvas did not have
+ focus, this attribute will be wrong.
+
+ step : float
+ The number of scroll steps (positive for 'up', negative for 'down').
+ This applies only to 'scroll_event' and defaults to 0 otherwise.
+
+ dblclick : bool
+ Whether the event is a double-click. This applies only to
+ 'button_press_event' and is False otherwise. In particular, it's
+ not used in 'button_release_event'.
+
+ Examples
+ --------
+ ::
+
+ def on_press(event):
+ print('you pressed', event.button, event.xdata, event.ydata)
+
+ cid = fig.canvas.mpl_connect('button_press_event', on_press)
+ """
+
+ def __init__(self, name, canvas, x, y, button=None, key=None,
+ step=0, dblclick=False, guiEvent=None):
+ """
+ (*x*, *y*) in figure coords ((0, 0) = bottom left)
+ button pressed None, 1, 2, 3, 'up', 'down'
+ """
+ if button in MouseButton.__members__.values():
+ button = MouseButton(button)
+ self.button = button
+ self.key = key
+ self.step = step
+ self.dblclick = dblclick
+
+ # super-init is deferred to the end because it calls back on
+ # 'axes_enter_event', which requires a fully initialized event.
+ super().__init__(name, canvas, x, y, guiEvent=guiEvent)
+
+ def __str__(self):
+ return (f"{self.name}: "
+ f"xy=({self.x}, {self.y}) xydata=({self.xdata}, {self.ydata}) "
+ f"button={self.button} dblclick={self.dblclick} "
+ f"inaxes={self.inaxes}")
+
+
+class PickEvent(Event):
+ """
+ A pick event, fired when the user picks a location on the canvas
+ sufficiently close to an artist that has been made pickable with
+ `.Artist.set_picker`.
+
+ Attrs: all the `Event` attributes plus
+
+ Attributes
+ ----------
+ mouseevent : `MouseEvent`
+ The mouse event that generated the pick.
+ artist : `matplotlib.artist.Artist`
+ The picked artist. Note that artists are not pickable by default
+ (see `.Artist.set_picker`).
+ other
+ Additional attributes may be present depending on the type of the
+ picked object; e.g., a `~.Line2D` pick may define different extra
+ attributes than a `~.PatchCollection` pick.
+
+ Examples
+ --------
+ Bind a function ``on_pick()`` to pick events, that prints the coordinates
+ of the picked data point::
+
+ ax.plot(np.rand(100), 'o', picker=5) # 5 points tolerance
+
+ def on_pick(event):
+ line = event.artist
+ xdata, ydata = line.get_data()
+ ind = event.ind
+ print('on pick line:', np.array([xdata[ind], ydata[ind]]).T)
+
+ cid = fig.canvas.mpl_connect('pick_event', on_pick)
+ """
+ def __init__(self, name, canvas, mouseevent, artist,
+ guiEvent=None, **kwargs):
+ super().__init__(name, canvas, guiEvent)
+ self.mouseevent = mouseevent
+ self.artist = artist
+ self.__dict__.update(kwargs)
+
+
+class KeyEvent(LocationEvent):
+ """
+ A key event (key press, key release).
+
+ Attach additional attributes as defined in
+ :meth:`FigureCanvasBase.mpl_connect`.
+
+ In addition to the `Event` and `LocationEvent`
+ attributes, the following attributes are defined:
+
+ Attributes
+ ----------
+ key : None or str
+ the key(s) pressed. Could be **None**, a single case sensitive ascii
+ character ("g", "G", "#", etc.), a special key
+ ("control", "shift", "f1", "up", etc.) or a
+ combination of the above (e.g., "ctrl+alt+g", "ctrl+alt+G").
+
+ Notes
+ -----
+ Modifier keys will be prefixed to the pressed key and will be in the order
+ "ctrl", "alt", "super". The exception to this rule is when the pressed key
+ is itself a modifier key, therefore "ctrl+alt" and "alt+control" can both
+ be valid key values.
+
+ Examples
+ --------
+ ::
+
+ def on_key(event):
+ print('you pressed', event.key, event.xdata, event.ydata)
+
+ cid = fig.canvas.mpl_connect('key_press_event', on_key)
+ """
+ def __init__(self, name, canvas, key, x=0, y=0, guiEvent=None):
+ self.key = key
+ # super-init deferred to the end: callback errors if called before
+ super().__init__(name, canvas, x, y, guiEvent=guiEvent)
+
+
+def _get_renderer(figure, print_method=None):
+ """
+ Get the renderer that would be used to save a `~.Figure`, and cache it on
+ the figure.
+
+ If you need a renderer without any active draw methods use
+ renderer._draw_disabled to temporary patch them out at your call site.
+ """
+ # This is implemented by triggering a draw, then immediately jumping out of
+ # Figure.draw() by raising an exception.
+
+ class Done(Exception):
+ pass
+
+ def _draw(renderer): raise Done(renderer)
+
+ with cbook._setattr_cm(figure, draw=_draw):
+ orig_canvas = figure.canvas
+ if print_method is None:
+ fmt = figure.canvas.get_default_filetype()
+ # Even for a canvas' default output type, a canvas switch may be
+ # needed, e.g. for FigureCanvasBase.
+ print_method = getattr(
+ figure.canvas._get_output_canvas(None, fmt), f"print_{fmt}")
+ try:
+ print_method(io.BytesIO())
+ except Done as exc:
+ renderer, = figure._cachedRenderer, = exc.args
+ return renderer
+ else:
+ raise RuntimeError(f"{print_method} did not call Figure.draw, so "
+ f"no renderer is available")
+ finally:
+ figure.canvas = orig_canvas
+
+
+def _no_output_draw(figure):
+ renderer = _get_renderer(figure)
+ with renderer._draw_disabled():
+ figure.draw(renderer)
+
+
+def _is_non_interactive_terminal_ipython(ip):
+ """
+ Return whether we are in a a terminal IPython, but non interactive.
+
+ When in _terminal_ IPython, ip.parent will have and `interact` attribute,
+ if this attribute is False we do not setup eventloop integration as the
+ user will _not_ interact with IPython. In all other case (ZMQKernel, or is
+ interactive), we do.
+ """
+ return (hasattr(ip, 'parent')
+ and (ip.parent is not None)
+ and getattr(ip.parent, 'interact', None) is False)
+
+
+def _check_savefig_extra_args(func=None, extra_kwargs=()):
+ """
+ Decorator for the final print_* methods that accept keyword arguments.
+
+ If any unused keyword arguments are left, this decorator will warn about
+ them, and as part of the warning, will attempt to specify the function that
+ the user actually called, instead of the backend-specific method. If unable
+ to determine which function the user called, it will specify `.savefig`.
+
+ For compatibility across backends, this does not warn about keyword
+ arguments added by `FigureCanvasBase.print_figure` for use in a subset of
+ backends, because the user would not have added them directly.
+ """
+
+ if func is None:
+ return functools.partial(_check_savefig_extra_args,
+ extra_kwargs=extra_kwargs)
+
+ old_sig = inspect.signature(func)
+
+ @functools.wraps(func)
+ def wrapper(*args, **kwargs):
+ name = 'savefig' # Reasonable default guess.
+ public_api = re.compile(
+ r'^savefig|print_[A-Za-z0-9]+|_no_output_draw$'
+ )
+ seen_print_figure = False
+ for frame, line in traceback.walk_stack(None):
+ if frame is None:
+ # when called in embedded context may hit frame is None.
+ break
+ if re.match(r'\A(matplotlib|mpl_toolkits)(\Z|\.(?!tests\.))',
+ # Work around sphinx-gallery not setting __name__.
+ frame.f_globals.get('__name__', '')):
+ if public_api.match(frame.f_code.co_name):
+ name = frame.f_code.co_name
+ if name in ('print_figure', '_no_output_draw'):
+ seen_print_figure = True
+
+ else:
+ break
+
+ accepted_kwargs = {*old_sig.parameters, *extra_kwargs}
+ if seen_print_figure:
+ for kw in ['dpi', 'facecolor', 'edgecolor', 'orientation',
+ 'bbox_inches_restore']:
+ # Ignore keyword arguments that are passed in by print_figure
+ # for the use of other renderers.
+ if kw not in accepted_kwargs:
+ kwargs.pop(kw, None)
+
+ for arg in list(kwargs):
+ if arg in accepted_kwargs:
+ continue
+ _api.warn_deprecated(
+ '3.3', name=name,
+ message='%(name)s() got unexpected keyword argument "'
+ + arg + '" which is no longer supported as of '
+ '%(since)s and will become an error '
+ '%(removal)s')
+ kwargs.pop(arg)
+
+ return func(*args, **kwargs)
+
+ return wrapper
+
+
+class FigureCanvasBase:
+ """
+ The canvas the figure renders into.
+
+ Attributes
+ ----------
+ figure : `matplotlib.figure.Figure`
+ A high-level figure instance.
+ """
+
+ # Set to one of {"qt5", "qt4", "gtk3", "wx", "tk", "macosx"} if an
+ # interactive framework is required, or None otherwise.
+ required_interactive_framework = None
+
+ events = [
+ 'resize_event',
+ 'draw_event',
+ 'key_press_event',
+ 'key_release_event',
+ 'button_press_event',
+ 'button_release_event',
+ 'scroll_event',
+ 'motion_notify_event',
+ 'pick_event',
+ 'figure_enter_event',
+ 'figure_leave_event',
+ 'axes_enter_event',
+ 'axes_leave_event',
+ 'close_event'
+ ]
+
+ fixed_dpi = None
+
+ filetypes = _default_filetypes
+
+ @_api.classproperty
+ def supports_blit(cls):
+ """If this Canvas sub-class supports blitting."""
+ return (hasattr(cls, "copy_from_bbox")
+ and hasattr(cls, "restore_region"))
+
+ def __init__(self, figure=None):
+ from matplotlib.figure import Figure
+ self._fix_ipython_backend2gui()
+ self._is_idle_drawing = True
+ self._is_saving = False
+ if figure is None:
+ figure = Figure()
+ figure.set_canvas(self)
+ self.figure = figure
+ self.manager = None
+ self.widgetlock = widgets.LockDraw()
+ self._button = None # the button pressed
+ self._key = None # the key pressed
+ self._lastx, self._lasty = None, None
+ self.mouse_grabber = None # the axes currently grabbing mouse
+ self.toolbar = None # NavigationToolbar2 will set me
+ self._is_idle_drawing = False
+
+ callbacks = property(lambda self: self.figure._canvas_callbacks)
+ button_pick_id = property(lambda self: self.figure._button_pick_id)
+ scroll_pick_id = property(lambda self: self.figure._scroll_pick_id)
+
+ @classmethod
+ @functools.lru_cache()
+ def _fix_ipython_backend2gui(cls):
+ # Fix hard-coded module -> toolkit mapping in IPython (used for
+ # `ipython --auto`). This cannot be done at import time due to
+ # ordering issues, so we do it when creating a canvas, and should only
+ # be done once per class (hence the `lru_cache(1)`).
+ if sys.modules.get("IPython") is None:
+ return
+ import IPython
+ ip = IPython.get_ipython()
+ if not ip:
+ return
+ from IPython.core import pylabtools as pt
+ if (not hasattr(pt, "backend2gui")
+ or not hasattr(ip, "enable_matplotlib")):
+ # In case we ever move the patch to IPython and remove these APIs,
+ # don't break on our side.
+ return
+ rif = getattr(cls, "required_interactive_framework", None)
+ backend2gui_rif = {"qt5": "qt", "qt4": "qt", "gtk3": "gtk3",
+ "wx": "wx", "macosx": "osx"}.get(rif)
+ if backend2gui_rif:
+ if _is_non_interactive_terminal_ipython(ip):
+ ip.enable_gui(backend2gui_rif)
+
+ @contextmanager
+ def _idle_draw_cntx(self):
+ self._is_idle_drawing = True
+ try:
+ yield
+ finally:
+ self._is_idle_drawing = False
+
+ def is_saving(self):
+ """
+ Return whether the renderer is in the process of saving
+ to a file, rather than rendering for an on-screen buffer.
+ """
+ return self._is_saving
+
+ def pick(self, mouseevent):
+ if not self.widgetlock.locked():
+ self.figure.pick(mouseevent)
+
+ def blit(self, bbox=None):
+ """Blit the canvas in bbox (default entire canvas)."""
+
+ def resize(self, w, h):
+ """Set the canvas size in pixels."""
+
+ def draw_event(self, renderer):
+ """Pass a `DrawEvent` to all functions connected to ``draw_event``."""
+ s = 'draw_event'
+ event = DrawEvent(s, self, renderer)
+ self.callbacks.process(s, event)
+
+ def resize_event(self):
+ """
+ Pass a `ResizeEvent` to all functions connected to ``resize_event``.
+ """
+ s = 'resize_event'
+ event = ResizeEvent(s, self)
+ self.callbacks.process(s, event)
+ self.draw_idle()
+
+ def close_event(self, guiEvent=None):
+ """
+ Pass a `CloseEvent` to all functions connected to ``close_event``.
+ """
+ s = 'close_event'
+ try:
+ event = CloseEvent(s, self, guiEvent=guiEvent)
+ self.callbacks.process(s, event)
+ except (TypeError, AttributeError):
+ pass
+ # Suppress the TypeError when the python session is being killed.
+ # It may be that a better solution would be a mechanism to
+ # disconnect all callbacks upon shutdown.
+ # AttributeError occurs on OSX with qt4agg upon exiting
+ # with an open window; 'callbacks' attribute no longer exists.
+
+ def key_press_event(self, key, guiEvent=None):
+ """
+ Pass a `KeyEvent` to all functions connected to ``key_press_event``.
+ """
+ self._key = key
+ s = 'key_press_event'
+ event = KeyEvent(
+ s, self, key, self._lastx, self._lasty, guiEvent=guiEvent)
+ self.callbacks.process(s, event)
+
+ def key_release_event(self, key, guiEvent=None):
+ """
+ Pass a `KeyEvent` to all functions connected to ``key_release_event``.
+ """
+ s = 'key_release_event'
+ event = KeyEvent(
+ s, self, key, self._lastx, self._lasty, guiEvent=guiEvent)
+ self.callbacks.process(s, event)
+ self._key = None
+
+ def pick_event(self, mouseevent, artist, **kwargs):
+ """
+ Callback processing for pick events.
+
+ This method will be called by artists who are picked and will
+ fire off `PickEvent` callbacks registered listeners.
+
+ Note that artists are not pickable by default (see
+ `.Artist.set_picker`).
+ """
+ s = 'pick_event'
+ event = PickEvent(s, self, mouseevent, artist,
+ guiEvent=mouseevent.guiEvent,
+ **kwargs)
+ self.callbacks.process(s, event)
+
+ def scroll_event(self, x, y, step, guiEvent=None):
+ """
+ Callback processing for scroll events.
+
+ Backend derived classes should call this function on any
+ scroll wheel event. (*x*, *y*) are the canvas coords ((0, 0) is lower
+ left). button and key are as defined in `MouseEvent`.
+
+ This method will call all functions connected to the 'scroll_event'
+ with a `MouseEvent` instance.
+ """
+ if step >= 0:
+ self._button = 'up'
+ else:
+ self._button = 'down'
+ s = 'scroll_event'
+ mouseevent = MouseEvent(s, self, x, y, self._button, self._key,
+ step=step, guiEvent=guiEvent)
+ self.callbacks.process(s, mouseevent)
+
+ def button_press_event(self, x, y, button, dblclick=False, guiEvent=None):
+ """
+ Callback processing for mouse button press events.
+
+ Backend derived classes should call this function on any mouse
+ button press. (*x*, *y*) are the canvas coords ((0, 0) is lower left).
+ button and key are as defined in `MouseEvent`.
+
+ This method will call all functions connected to the
+ 'button_press_event' with a `MouseEvent` instance.
+ """
+ self._button = button
+ s = 'button_press_event'
+ mouseevent = MouseEvent(s, self, x, y, button, self._key,
+ dblclick=dblclick, guiEvent=guiEvent)
+ self.callbacks.process(s, mouseevent)
+
+ def button_release_event(self, x, y, button, guiEvent=None):
+ """
+ Callback processing for mouse button release events.
+
+ Backend derived classes should call this function on any mouse
+ button release.
+
+ This method will call all functions connected to the
+ 'button_release_event' with a `MouseEvent` instance.
+
+ Parameters
+ ----------
+ x : float
+ The canvas coordinates where 0=left.
+ y : float
+ The canvas coordinates where 0=bottom.
+ guiEvent
+ The native UI event that generated the Matplotlib event.
+ """
+ s = 'button_release_event'
+ event = MouseEvent(s, self, x, y, button, self._key, guiEvent=guiEvent)
+ self.callbacks.process(s, event)
+ self._button = None
+
+ def motion_notify_event(self, x, y, guiEvent=None):
+ """
+ Callback processing for mouse movement events.
+
+ Backend derived classes should call this function on any
+ motion-notify-event.
+
+ This method will call all functions connected to the
+ 'motion_notify_event' with a `MouseEvent` instance.
+
+ Parameters
+ ----------
+ x : float
+ The canvas coordinates where 0=left.
+ y : float
+ The canvas coordinates where 0=bottom.
+ guiEvent
+ The native UI event that generated the Matplotlib event.
+ """
+ self._lastx, self._lasty = x, y
+ s = 'motion_notify_event'
+ event = MouseEvent(s, self, x, y, self._button, self._key,
+ guiEvent=guiEvent)
+ self.callbacks.process(s, event)
+
+ def leave_notify_event(self, guiEvent=None):
+ """
+ Callback processing for the mouse cursor leaving the canvas.
+
+ Backend derived classes should call this function when leaving
+ canvas.
+
+ Parameters
+ ----------
+ guiEvent
+ The native UI event that generated the Matplotlib event.
+ """
+ self.callbacks.process('figure_leave_event', LocationEvent.lastevent)
+ LocationEvent.lastevent = None
+ self._lastx, self._lasty = None, None
+
+ def enter_notify_event(self, guiEvent=None, xy=None):
+ """
+ Callback processing for the mouse cursor entering the canvas.
+
+ Backend derived classes should call this function when entering
+ canvas.
+
+ Parameters
+ ----------
+ guiEvent
+ The native UI event that generated the Matplotlib event.
+ xy : (float, float)
+ The coordinate location of the pointer when the canvas is entered.
+ """
+ if xy is not None:
+ x, y = xy
+ self._lastx, self._lasty = x, y
+ else:
+ x = None
+ y = None
+ _api.warn_deprecated(
+ '3.0', removal='3.5', name='enter_notify_event',
+ message='Since %(since)s, %(name)s expects a location but '
+ 'your backend did not pass one. This will become an error '
+ '%(removal)s.')
+
+ event = LocationEvent('figure_enter_event', self, x, y, guiEvent)
+ self.callbacks.process('figure_enter_event', event)
+
+ def inaxes(self, xy):
+ """
+ Return the topmost visible `~.axes.Axes` containing the point *xy*.
+
+ Parameters
+ ----------
+ xy : (float, float)
+ (x, y) pixel positions from left/bottom of the canvas.
+
+ Returns
+ -------
+ `~matplotlib.axes.Axes` or None
+ The topmost visible axes containing the point, or None if no axes.
+ """
+ axes_list = [a for a in self.figure.get_axes()
+ if a.patch.contains_point(xy) and a.get_visible()]
+ if axes_list:
+ axes = cbook._topmost_artist(axes_list)
+ else:
+ axes = None
+
+ return axes
+
+ def grab_mouse(self, ax):
+ """
+ Set the child `~.axes.Axes` which is grabbing the mouse events.
+
+ Usually called by the widgets themselves. It is an error to call this
+ if the mouse is already grabbed by another axes.
+ """
+ if self.mouse_grabber not in (None, ax):
+ raise RuntimeError("Another Axes already grabs mouse input")
+ self.mouse_grabber = ax
+
+ def release_mouse(self, ax):
+ """
+ Release the mouse grab held by the `~.axes.Axes` *ax*.
+
+ Usually called by the widgets. It is ok to call this even if *ax*
+ doesn't have the mouse grab currently.
+ """
+ if self.mouse_grabber is ax:
+ self.mouse_grabber = None
+
+ def draw(self, *args, **kwargs):
+ """
+ Render the `.Figure`.
+
+ It is important that this method actually walk the artist tree
+ even if not output is produced because this will trigger
+ deferred work (like computing limits auto-limits and tick
+ values) that users may want access to before saving to disk.
+ """
+
+ def draw_idle(self, *args, **kwargs):
+ """
+ Request a widget redraw once control returns to the GUI event loop.
+
+ Even if multiple calls to `draw_idle` occur before control returns
+ to the GUI event loop, the figure will only be rendered once.
+
+ Notes
+ -----
+ Backends may choose to override the method and implement their own
+ strategy to prevent multiple renderings.
+
+ """
+ if not self._is_idle_drawing:
+ with self._idle_draw_cntx():
+ self.draw(*args, **kwargs)
+
+ def get_width_height(self):
+ """
+ Return the figure width and height in points or pixels
+ (depending on the backend), truncated to integers.
+ """
+ return int(self.figure.bbox.width), int(self.figure.bbox.height)
+
+ @classmethod
+ def get_supported_filetypes(cls):
+ """Return dict of savefig file formats supported by this backend."""
+ return cls.filetypes
+
+ @classmethod
+ def get_supported_filetypes_grouped(cls):
+ """
+ Return a dict of savefig file formats supported by this backend,
+ where the keys are a file type name, such as 'Joint Photographic
+ Experts Group', and the values are a list of filename extensions used
+ for that filetype, such as ['jpg', 'jpeg'].
+ """
+ groupings = {}
+ for ext, name in cls.filetypes.items():
+ groupings.setdefault(name, []).append(ext)
+ groupings[name].sort()
+ return groupings
+
+ def _get_output_canvas(self, backend, fmt):
+ """
+ Set the canvas in preparation for saving the figure.
+
+ Parameters
+ ----------
+ backend : str or None
+ If not None, switch the figure canvas to the ``FigureCanvas`` class
+ of the given backend.
+ fmt : str
+ If *backend* is None, then determine a suitable canvas class for
+ saving to format *fmt* -- either the current canvas class, if it
+ supports *fmt*, or whatever `get_registered_canvas_class` returns;
+ switch the figure canvas to that canvas class.
+ """
+ if backend is not None:
+ # Return a specific canvas class, if requested.
+ canvas_class = (
+ importlib.import_module(cbook._backend_module_name(backend))
+ .FigureCanvas)
+ if not hasattr(canvas_class, f"print_{fmt}"):
+ raise ValueError(
+ f"The {backend!r} backend does not support {fmt} output")
+ elif hasattr(self, f"print_{fmt}"):
+ # Return the current canvas if it supports the requested format.
+ return self
+ else:
+ # Return a default canvas for the requested format, if it exists.
+ canvas_class = get_registered_canvas_class(fmt)
+ if canvas_class:
+ return self.switch_backends(canvas_class)
+ # Else report error for unsupported format.
+ raise ValueError(
+ "Format {!r} is not supported (supported formats: {})"
+ .format(fmt, ", ".join(sorted(self.get_supported_filetypes()))))
+
+ def print_figure(
+ self, filename, dpi=None, facecolor=None, edgecolor=None,
+ orientation='portrait', format=None, *,
+ bbox_inches=None, pad_inches=None, bbox_extra_artists=None,
+ backend=None, **kwargs):
+ """
+ Render the figure to hardcopy. Set the figure patch face and edge
+ colors. This is useful because some of the GUIs have a gray figure
+ face color background and you'll probably want to override this on
+ hardcopy.
+
+ Parameters
+ ----------
+ filename : str or path-like or file-like
+ The file where the figure is saved.
+
+ dpi : float, default: :rc:`savefig.dpi`
+ The dots per inch to save the figure in.
+
+ facecolor : color or 'auto', default: :rc:`savefig.facecolor`
+ The facecolor of the figure. If 'auto', use the current figure
+ facecolor.
+
+ edgecolor : color or 'auto', default: :rc:`savefig.edgecolor`
+ The edgecolor of the figure. If 'auto', use the current figure
+ edgecolor.
+
+ orientation : {'landscape', 'portrait'}, default: 'portrait'
+ Only currently applies to PostScript printing.
+
+ format : str, optional
+ Force a specific file format. If not given, the format is inferred
+ from the *filename* extension, and if that fails from
+ :rc:`savefig.format`.
+
+ bbox_inches : 'tight' or `.Bbox`, default: :rc:`savefig.bbox`
+ Bounding box in inches: only the given portion of the figure is
+ saved. If 'tight', try to figure out the tight bbox of the figure.
+
+ pad_inches : float, default: :rc:`savefig.pad_inches`
+ Amount of padding around the figure when *bbox_inches* is 'tight'.
+
+ bbox_extra_artists : list of `~matplotlib.artist.Artist`, optional
+ A list of extra artists that will be considered when the
+ tight bbox is calculated.
+
+ backend : str, optional
+ Use a non-default backend to render the file, e.g. to render a
+ png file with the "cairo" backend rather than the default "agg",
+ or a pdf file with the "pgf" backend rather than the default
+ "pdf". Note that the default backend is normally sufficient. See
+ :ref:`the-builtin-backends` for a list of valid backends for each
+ file format. Custom backends can be referenced as "module://...".
+ """
+ if format is None:
+ # get format from filename, or from backend's default filetype
+ if isinstance(filename, os.PathLike):
+ filename = os.fspath(filename)
+ if isinstance(filename, str):
+ format = os.path.splitext(filename)[1][1:]
+ if format is None or format == '':
+ format = self.get_default_filetype()
+ if isinstance(filename, str):
+ filename = filename.rstrip('.') + '.' + format
+ format = format.lower()
+
+ # get canvas object and print method for format
+ canvas = self._get_output_canvas(backend, format)
+ print_method = getattr(canvas, 'print_%s' % format)
+
+ if dpi is None:
+ dpi = rcParams['savefig.dpi']
+ if dpi == 'figure':
+ dpi = getattr(self.figure, '_original_dpi', self.figure.dpi)
+
+ # Remove the figure manager, if any, to avoid resizing the GUI widget.
+ with cbook._setattr_cm(self, manager=None), \
+ cbook._setattr_cm(self.figure, dpi=dpi), \
+ cbook._setattr_cm(canvas, _is_saving=True):
+ origfacecolor = self.figure.get_facecolor()
+ origedgecolor = self.figure.get_edgecolor()
+
+ if facecolor is None:
+ facecolor = rcParams['savefig.facecolor']
+ if cbook._str_equal(facecolor, 'auto'):
+ facecolor = origfacecolor
+ if edgecolor is None:
+ edgecolor = rcParams['savefig.edgecolor']
+ if cbook._str_equal(edgecolor, 'auto'):
+ edgecolor = origedgecolor
+
+ self.figure.set_facecolor(facecolor)
+ self.figure.set_edgecolor(edgecolor)
+
+ if bbox_inches is None:
+ bbox_inches = rcParams['savefig.bbox']
+
+ if (self.figure.get_constrained_layout() or
+ bbox_inches == "tight"):
+ # we need to trigger a draw before printing to make sure
+ # CL works. "tight" also needs a draw to get the right
+ # locations:
+ renderer = _get_renderer(
+ self.figure,
+ functools.partial(
+ print_method, orientation=orientation)
+ )
+ ctx = (renderer._draw_disabled()
+ if hasattr(renderer, '_draw_disabled')
+ else suppress())
+ with ctx:
+ self.figure.draw(renderer)
+
+ if bbox_inches:
+ if bbox_inches == "tight":
+ bbox_inches = self.figure.get_tightbbox(
+ renderer, bbox_extra_artists=bbox_extra_artists)
+ if pad_inches is None:
+ pad_inches = rcParams['savefig.pad_inches']
+ bbox_inches = bbox_inches.padded(pad_inches)
+
+ # call adjust_bbox to save only the given area
+ restore_bbox = tight_bbox.adjust_bbox(self.figure, bbox_inches,
+ canvas.fixed_dpi)
+
+ _bbox_inches_restore = (bbox_inches, restore_bbox)
+ else:
+ _bbox_inches_restore = None
+
+ # we have already done CL above, so turn it off:
+ cl_state = self.figure.get_constrained_layout()
+ self.figure.set_constrained_layout(False)
+ try:
+ # _get_renderer may change the figure dpi (as vector formats
+ # force the figure dpi to 72), so we need to set it again here.
+ with cbook._setattr_cm(self.figure, dpi=dpi):
+ result = print_method(
+ filename,
+ facecolor=facecolor,
+ edgecolor=edgecolor,
+ orientation=orientation,
+ bbox_inches_restore=_bbox_inches_restore,
+ **kwargs)
+ finally:
+ if bbox_inches and restore_bbox:
+ restore_bbox()
+
+ self.figure.set_facecolor(origfacecolor)
+ self.figure.set_edgecolor(origedgecolor)
+ self.figure.set_canvas(self)
+ # reset to cached state
+ self.figure.set_constrained_layout(cl_state)
+ return result
+
+ @classmethod
+ def get_default_filetype(cls):
+ """
+ Return the default savefig file format as specified in
+ :rc:`savefig.format`.
+
+ The returned string does not include a period. This method is
+ overridden in backends that only support a single file type.
+ """
+ return rcParams['savefig.format']
+
+ @_api.deprecated(
+ "3.4", alternative="manager.get_window_title or GUI-specific methods")
+ def get_window_title(self):
+ """
+ Return the title text of the window containing the figure, or None
+ if there is no window (e.g., a PS backend).
+ """
+ if self.manager is not None:
+ return self.manager.get_window_title()
+
+ @_api.deprecated(
+ "3.4", alternative="manager.set_window_title or GUI-specific methods")
+ def set_window_title(self, title):
+ """
+ Set the title text of the window containing the figure. Note that
+ this has no effect if there is no window (e.g., a PS backend).
+ """
+ if self.manager is not None:
+ self.manager.set_window_title(title)
+
+ def get_default_filename(self):
+ """
+ Return a string, which includes extension, suitable for use as
+ a default filename.
+ """
+ basename = (self.manager.get_window_title() if self.manager is not None
+ else '')
+ basename = (basename or 'image').replace(' ', '_')
+ filetype = self.get_default_filetype()
+ filename = basename + '.' + filetype
+ return filename
+
+ def switch_backends(self, FigureCanvasClass):
+ """
+ Instantiate an instance of FigureCanvasClass
+
+ This is used for backend switching, e.g., to instantiate a
+ FigureCanvasPS from a FigureCanvasGTK. Note, deep copying is
+ not done, so any changes to one of the instances (e.g., setting
+ figure size or line props), will be reflected in the other
+ """
+ newCanvas = FigureCanvasClass(self.figure)
+ newCanvas._is_saving = self._is_saving
+ return newCanvas
+
+ def mpl_connect(self, s, func):
+ """
+ Bind function *func* to event *s*.
+
+ Parameters
+ ----------
+ s : str
+ One of the following events ids:
+
+ - 'button_press_event'
+ - 'button_release_event'
+ - 'draw_event'
+ - 'key_press_event'
+ - 'key_release_event'
+ - 'motion_notify_event'
+ - 'pick_event'
+ - 'resize_event'
+ - 'scroll_event'
+ - 'figure_enter_event',
+ - 'figure_leave_event',
+ - 'axes_enter_event',
+ - 'axes_leave_event'
+ - 'close_event'.
+
+ func : callable
+ The callback function to be executed, which must have the
+ signature::
+
+ def func(event: Event) -> Any
+
+ For the location events (button and key press/release), if the
+ mouse is over the axes, the ``inaxes`` attribute of the event will
+ be set to the `~matplotlib.axes.Axes` the event occurs is over, and
+ additionally, the variables ``xdata`` and ``ydata`` attributes will
+ be set to the mouse location in data coordinates. See `.KeyEvent`
+ and `.MouseEvent` for more info.
+
+ Returns
+ -------
+ cid
+ A connection id that can be used with
+ `.FigureCanvasBase.mpl_disconnect`.
+
+ Examples
+ --------
+ ::
+
+ def on_press(event):
+ print('you pressed', event.button, event.xdata, event.ydata)
+
+ cid = canvas.mpl_connect('button_press_event', on_press)
+ """
+
+ return self.callbacks.connect(s, func)
+
+ def mpl_disconnect(self, cid):
+ """
+ Disconnect the callback with id *cid*.
+
+ Examples
+ --------
+ ::
+
+ cid = canvas.mpl_connect('button_press_event', on_press)
+ # ... later
+ canvas.mpl_disconnect(cid)
+ """
+ return self.callbacks.disconnect(cid)
+
+ # Internal subclasses can override _timer_cls instead of new_timer, though
+ # this is not a public API for third-party subclasses.
+ _timer_cls = TimerBase
+
+ def new_timer(self, interval=None, callbacks=None):
+ """
+ Create a new backend-specific subclass of `.Timer`.
+
+ This is useful for getting periodic events through the backend's native
+ event loop. Implemented only for backends with GUIs.
+
+ Parameters
+ ----------
+ interval : int
+ Timer interval in milliseconds.
+
+ callbacks : list[tuple[callable, tuple, dict]]
+ Sequence of (func, args, kwargs) where ``func(*args, **kwargs)``
+ will be executed by the timer every *interval*.
+
+ Callbacks which return ``False`` or ``0`` will be removed from the
+ timer.
+
+ Examples
+ --------
+ >>> timer = fig.canvas.new_timer(callbacks=[(f1, (1,), {'a': 3})])
+ """
+ return self._timer_cls(interval=interval, callbacks=callbacks)
+
+ def flush_events(self):
+ """
+ Flush the GUI events for the figure.
+
+ Interactive backends need to reimplement this method.
+ """
+
+ def start_event_loop(self, timeout=0):
+ """
+ Start a blocking event loop.
+
+ Such an event loop is used by interactive functions, such as
+ `~.Figure.ginput` and `~.Figure.waitforbuttonpress`, to wait for
+ events.
+
+ The event loop blocks until a callback function triggers
+ `stop_event_loop`, or *timeout* is reached.
+
+ If *timeout* is 0 or negative, never timeout.
+
+ Only interactive backends need to reimplement this method and it relies
+ on `flush_events` being properly implemented.
+
+ Interactive backends should implement this in a more native way.
+ """
+ if timeout <= 0:
+ timeout = np.inf
+ timestep = 0.01
+ counter = 0
+ self._looping = True
+ while self._looping and counter * timestep < timeout:
+ self.flush_events()
+ time.sleep(timestep)
+ counter += 1
+
+ def stop_event_loop(self):
+ """
+ Stop the current blocking event loop.
+
+ Interactive backends need to reimplement this to match
+ `start_event_loop`
+ """
+ self._looping = False
+
+
+def key_press_handler(event, canvas=None, toolbar=None):
+ """
+ Implement the default Matplotlib key bindings for the canvas and toolbar
+ described at :ref:`key-event-handling`.
+
+ Parameters
+ ----------
+ event : `KeyEvent`
+ A key press/release event.
+ canvas : `FigureCanvasBase`, default: ``event.canvas``
+ The backend-specific canvas instance. This parameter is kept for
+ back-compatibility, but, if set, should always be equal to
+ ``event.canvas``.
+ toolbar : `NavigationToolbar2`, default: ``event.canvas.toolbar``
+ The navigation cursor toolbar. This parameter is kept for
+ back-compatibility, but, if set, should always be equal to
+ ``event.canvas.toolbar``.
+ """
+ # these bindings happen whether you are over an axes or not
+
+ if event.key is None:
+ return
+ if canvas is None:
+ canvas = event.canvas
+ if toolbar is None:
+ toolbar = canvas.toolbar
+
+ # Load key-mappings from rcParams.
+ fullscreen_keys = rcParams['keymap.fullscreen']
+ home_keys = rcParams['keymap.home']
+ back_keys = rcParams['keymap.back']
+ forward_keys = rcParams['keymap.forward']
+ pan_keys = rcParams['keymap.pan']
+ zoom_keys = rcParams['keymap.zoom']
+ save_keys = rcParams['keymap.save']
+ quit_keys = rcParams['keymap.quit']
+ quit_all_keys = rcParams['keymap.quit_all']
+ grid_keys = rcParams['keymap.grid']
+ grid_minor_keys = rcParams['keymap.grid_minor']
+ toggle_yscale_keys = rcParams['keymap.yscale']
+ toggle_xscale_keys = rcParams['keymap.xscale']
+ all_keys = dict.__getitem__(rcParams, 'keymap.all_axes')
+
+ # toggle fullscreen mode ('f', 'ctrl + f')
+ if event.key in fullscreen_keys:
+ try:
+ canvas.manager.full_screen_toggle()
+ except AttributeError:
+ pass
+
+ # quit the figure (default key 'ctrl+w')
+ if event.key in quit_keys:
+ Gcf.destroy_fig(canvas.figure)
+ if event.key in quit_all_keys:
+ Gcf.destroy_all()
+
+ if toolbar is not None:
+ # home or reset mnemonic (default key 'h', 'home' and 'r')
+ if event.key in home_keys:
+ toolbar.home()
+ # forward / backward keys to enable left handed quick navigation
+ # (default key for backward: 'left', 'backspace' and 'c')
+ elif event.key in back_keys:
+ toolbar.back()
+ # (default key for forward: 'right' and 'v')
+ elif event.key in forward_keys:
+ toolbar.forward()
+ # pan mnemonic (default key 'p')
+ elif event.key in pan_keys:
+ toolbar.pan()
+ toolbar._update_cursor(event)
+ # zoom mnemonic (default key 'o')
+ elif event.key in zoom_keys:
+ toolbar.zoom()
+ toolbar._update_cursor(event)
+ # saving current figure (default key 's')
+ elif event.key in save_keys:
+ toolbar.save_figure()
+
+ if event.inaxes is None:
+ return
+
+ # these bindings require the mouse to be over an axes to trigger
+ def _get_uniform_gridstate(ticks):
+ # Return True/False if all grid lines are on or off, None if they are
+ # not all in the same state.
+ if all(tick.gridline.get_visible() for tick in ticks):
+ return True
+ elif not any(tick.gridline.get_visible() for tick in ticks):
+ return False
+ else:
+ return None
+
+ ax = event.inaxes
+ # toggle major grids in current axes (default key 'g')
+ # Both here and below (for 'G'), we do nothing if *any* grid (major or
+ # minor, x or y) is not in a uniform state, to avoid messing up user
+ # customization.
+ if (event.key in grid_keys
+ # Exclude minor grids not in a uniform state.
+ and None not in [_get_uniform_gridstate(ax.xaxis.minorTicks),
+ _get_uniform_gridstate(ax.yaxis.minorTicks)]):
+ x_state = _get_uniform_gridstate(ax.xaxis.majorTicks)
+ y_state = _get_uniform_gridstate(ax.yaxis.majorTicks)
+ cycle = [(False, False), (True, False), (True, True), (False, True)]
+ try:
+ x_state, y_state = (
+ cycle[(cycle.index((x_state, y_state)) + 1) % len(cycle)])
+ except ValueError:
+ # Exclude major grids not in a uniform state.
+ pass
+ else:
+ # If turning major grids off, also turn minor grids off.
+ ax.grid(x_state, which="major" if x_state else "both", axis="x")
+ ax.grid(y_state, which="major" if y_state else "both", axis="y")
+ canvas.draw_idle()
+ # toggle major and minor grids in current axes (default key 'G')
+ if (event.key in grid_minor_keys
+ # Exclude major grids not in a uniform state.
+ and None not in [_get_uniform_gridstate(ax.xaxis.majorTicks),
+ _get_uniform_gridstate(ax.yaxis.majorTicks)]):
+ x_state = _get_uniform_gridstate(ax.xaxis.minorTicks)
+ y_state = _get_uniform_gridstate(ax.yaxis.minorTicks)
+ cycle = [(False, False), (True, False), (True, True), (False, True)]
+ try:
+ x_state, y_state = (
+ cycle[(cycle.index((x_state, y_state)) + 1) % len(cycle)])
+ except ValueError:
+ # Exclude minor grids not in a uniform state.
+ pass
+ else:
+ ax.grid(x_state, which="both", axis="x")
+ ax.grid(y_state, which="both", axis="y")
+ canvas.draw_idle()
+ # toggle scaling of y-axes between 'log and 'linear' (default key 'l')
+ elif event.key in toggle_yscale_keys:
+ scale = ax.get_yscale()
+ if scale == 'log':
+ ax.set_yscale('linear')
+ ax.figure.canvas.draw_idle()
+ elif scale == 'linear':
+ try:
+ ax.set_yscale('log')
+ except ValueError as exc:
+ _log.warning(str(exc))
+ ax.set_yscale('linear')
+ ax.figure.canvas.draw_idle()
+ # toggle scaling of x-axes between 'log and 'linear' (default key 'k')
+ elif event.key in toggle_xscale_keys:
+ scalex = ax.get_xscale()
+ if scalex == 'log':
+ ax.set_xscale('linear')
+ ax.figure.canvas.draw_idle()
+ elif scalex == 'linear':
+ try:
+ ax.set_xscale('log')
+ except ValueError as exc:
+ _log.warning(str(exc))
+ ax.set_xscale('linear')
+ ax.figure.canvas.draw_idle()
+ # enable navigation for all axes that contain the event (default key 'a')
+ elif event.key in all_keys:
+ for a in canvas.figure.get_axes():
+ if (event.x is not None and event.y is not None
+ and a.in_axes(event)): # FIXME: Why only these?
+ _api.warn_deprecated(
+ "3.3", message="Toggling axes navigation from the "
+ "keyboard is deprecated since %(since)s and will be "
+ "removed %(removal)s.")
+ a.set_navigate(True)
+ # enable navigation only for axes with this index (if such an axes exist,
+ # otherwise do nothing)
+ elif event.key.isdigit() and event.key != '0':
+ n = int(event.key) - 1
+ if n < len(canvas.figure.get_axes()):
+ for i, a in enumerate(canvas.figure.get_axes()):
+ if (event.x is not None and event.y is not None
+ and a.in_axes(event)): # FIXME: Why only these?
+ _api.warn_deprecated(
+ "3.3", message="Toggling axes navigation from the "
+ "keyboard is deprecated since %(since)s and will be "
+ "removed %(removal)s.")
+ a.set_navigate(i == n)
+
+
+def button_press_handler(event, canvas=None, toolbar=None):
+ """
+ The default Matplotlib button actions for extra mouse buttons.
+
+ Parameters are as for `key_press_handler`, except that *event* is a
+ `MouseEvent`.
+ """
+ if canvas is None:
+ canvas = event.canvas
+ if toolbar is None:
+ toolbar = canvas.toolbar
+ if toolbar is not None:
+ button_name = str(MouseButton(event.button))
+ if button_name in rcParams['keymap.back']:
+ toolbar.back()
+ elif button_name in rcParams['keymap.forward']:
+ toolbar.forward()
+
+
+class NonGuiException(Exception):
+ """Raised when trying show a figure in a non-GUI backend."""
+ pass
+
+
+class FigureManagerBase:
+ """
+ A backend-independent abstraction of a figure container and controller.
+
+ The figure manager is used by pyplot to interact with the window in a
+ backend-independent way. It's an adapter for the real (GUI) framework that
+ represents the visual figure on screen.
+
+ GUI backends define from this class to translate common operations such
+ as *show* or *resize* to the GUI-specific code. Non-GUI backends do not
+ support these operations an can just use the base class.
+
+ This following basic operations are accessible:
+
+ **Window operations**
+
+ - `~.FigureManagerBase.show`
+ - `~.FigureManagerBase.destroy`
+ - `~.FigureManagerBase.full_screen_toggle`
+ - `~.FigureManagerBase.resize`
+ - `~.FigureManagerBase.get_window_title`
+ - `~.FigureManagerBase.set_window_title`
+
+ **Key and mouse button press handling**
+
+ The figure manager sets up default key and mouse button press handling by
+ hooking up the `.key_press_handler` to the matplotlib event system. This
+ ensures the same shortcuts and mouse actions across backends.
+
+ **Other operations**
+
+ Subclasses will have additional attributes and functions to access
+ additional functionality. This is of course backend-specific. For example,
+ most GUI backends have ``window`` and ``toolbar`` attributes that give
+ access to the native GUI widgets of the respective framework.
+
+ Attributes
+ ----------
+ canvas : `FigureCanvasBase`
+ The backend-specific canvas instance.
+
+ num : int or str
+ The figure number.
+
+ key_press_handler_id : int
+ The default key handler cid, when using the toolmanager.
+ To disable the default key press handling use::
+
+ figure.canvas.mpl_disconnect(
+ figure.canvas.manager.key_press_handler_id)
+
+ button_press_handler_id : int
+ The default mouse button handler cid, when using the toolmanager.
+ To disable the default button press handling use::
+
+ figure.canvas.mpl_disconnect(
+ figure.canvas.manager.button_press_handler_id)
+ """
+
+ statusbar = _api.deprecated("3.3")(property(lambda self: None))
+
+ def __init__(self, canvas, num):
+ self.canvas = canvas
+ canvas.manager = self # store a pointer to parent
+ self.num = num
+ self.set_window_title(f"Figure {num:d}")
+
+ self.key_press_handler_id = None
+ self.button_press_handler_id = None
+ if rcParams['toolbar'] != 'toolmanager':
+ self.key_press_handler_id = self.canvas.mpl_connect(
+ 'key_press_event', key_press_handler)
+ self.button_press_handler_id = self.canvas.mpl_connect(
+ 'button_press_event', button_press_handler)
+
+ self.toolmanager = (ToolManager(canvas.figure)
+ if mpl.rcParams['toolbar'] == 'toolmanager'
+ else None)
+ self.toolbar = None
+
+ @self.canvas.figure.add_axobserver
+ def notify_axes_change(fig):
+ # Called whenever the current axes is changed.
+ if self.toolmanager is None and self.toolbar is not None:
+ self.toolbar.update()
+
+ def show(self):
+ """
+ For GUI backends, show the figure window and redraw.
+ For non-GUI backends, raise an exception, unless running headless (i.e.
+ on Linux with an unset DISPLAY); this exception is converted to a
+ warning in `.Figure.show`.
+ """
+ # This should be overridden in GUI backends.
+ if sys.platform == "linux" and not os.environ.get("DISPLAY"):
+ # We cannot check _get_running_interactive_framework() ==
+ # "headless" because that would also suppress the warning when
+ # $DISPLAY exists but is invalid, which is more likely an error and
+ # thus warrants a warning.
+ return
+ raise NonGuiException(
+ f"Matplotlib is currently using {get_backend()}, which is a "
+ f"non-GUI backend, so cannot show the figure.")
+
+ def destroy(self):
+ pass
+
+ def full_screen_toggle(self):
+ pass
+
+ def resize(self, w, h):
+ """For GUI backends, resize the window (in pixels)."""
+
+ @_api.deprecated(
+ "3.4", alternative="self.canvas.callbacks.process(event.name, event)")
+ def key_press(self, event):
+ """
+ Implement the default Matplotlib key bindings defined at
+ :ref:`key-event-handling`.
+ """
+ if rcParams['toolbar'] != 'toolmanager':
+ key_press_handler(event)
+
+ @_api.deprecated(
+ "3.4", alternative="self.canvas.callbacks.process(event.name, event)")
+ def button_press(self, event):
+ """The default Matplotlib button actions for extra mouse buttons."""
+ if rcParams['toolbar'] != 'toolmanager':
+ button_press_handler(event)
+
+ def get_window_title(self):
+ """
+ Return the title text of the window containing the figure, or None
+ if there is no window (e.g., a PS backend).
+ """
+ return 'image'
+
+ def set_window_title(self, title):
+ """
+ Set the title text of the window containing the figure.
+
+ This has no effect for non-GUI (e.g., PS) backends.
+ """
+
+
+cursors = tools.cursors
+
+
+class _Mode(str, Enum):
+ NONE = ""
+ PAN = "pan/zoom"
+ ZOOM = "zoom rect"
+
+ def __str__(self):
+ return self.value
+
+ @property
+ def _navigate_mode(self):
+ return self.name if self is not _Mode.NONE else None
+
+
+class NavigationToolbar2:
+ """
+ Base class for the navigation cursor, version 2.
+
+ Backends must implement a canvas that handles connections for
+ 'button_press_event' and 'button_release_event'. See
+ :meth:`FigureCanvasBase.mpl_connect` for more information.
+
+ They must also define
+
+ :meth:`save_figure`
+ save the current figure
+
+ :meth:`set_cursor`
+ if you want the pointer icon to change
+
+ :meth:`draw_rubberband` (optional)
+ draw the zoom to rect "rubberband" rectangle
+
+ :meth:`set_message` (optional)
+ display message
+
+ :meth:`set_history_buttons` (optional)
+ you can change the history back / forward buttons to
+ indicate disabled / enabled state.
+
+ and override ``__init__`` to set up the toolbar -- without forgetting to
+ call the base-class init. Typically, ``__init__`` needs to set up toolbar
+ buttons connected to the `home`, `back`, `forward`, `pan`, `zoom`, and
+ `save_figure` methods and using standard icons in the "images" subdirectory
+ of the data path.
+
+ That's it, we'll do the rest!
+ """
+
+ # list of toolitems to add to the toolbar, format is:
+ # (
+ # text, # the text of the button (often not visible to users)
+ # tooltip_text, # the tooltip shown on hover (where possible)
+ # image_file, # name of the image for the button (without the extension)
+ # name_of_method, # name of the method in NavigationToolbar2 to call
+ # )
+ toolitems = (
+ ('Home', 'Reset original view', 'home', 'home'),
+ ('Back', 'Back to previous view', 'back', 'back'),
+ ('Forward', 'Forward to next view', 'forward', 'forward'),
+ (None, None, None, None),
+ ('Pan',
+ 'Left button pans, Right button zooms\n'
+ 'x/y fixes axis, CTRL fixes aspect',
+ 'move', 'pan'),
+ ('Zoom', 'Zoom to rectangle\nx/y fixes axis, CTRL fixes aspect',
+ 'zoom_to_rect', 'zoom'),
+ ('Subplots', 'Configure subplots', 'subplots', 'configure_subplots'),
+ (None, None, None, None),
+ ('Save', 'Save the figure', 'filesave', 'save_figure'),
+ )
+
+ def __init__(self, canvas):
+ self.canvas = canvas
+ canvas.toolbar = self
+ self._nav_stack = cbook.Stack()
+ # This cursor will be set after the initial draw.
+ self._lastCursor = cursors.POINTER
+
+ init = _api.deprecate_method_override(
+ __class__._init_toolbar, self, allow_empty=True, since="3.3",
+ addendum="Please fully initialize the toolbar in your subclass' "
+ "__init__; a fully empty _init_toolbar implementation may be kept "
+ "for compatibility with earlier versions of Matplotlib.")
+ if init:
+ init()
+
+ self._id_press = self.canvas.mpl_connect(
+ 'button_press_event', self._zoom_pan_handler)
+ self._id_release = self.canvas.mpl_connect(
+ 'button_release_event', self._zoom_pan_handler)
+ self._id_drag = self.canvas.mpl_connect(
+ 'motion_notify_event', self.mouse_move)
+ self._pan_info = None
+ self._zoom_info = None
+
+ self.mode = _Mode.NONE # a mode string for the status bar
+ self.set_history_buttons()
+
+ def set_message(self, s):
+ """Display a message on toolbar or in status bar."""
+
+ def draw_rubberband(self, event, x0, y0, x1, y1):
+ """
+ Draw a rectangle rubberband to indicate zoom limits.
+
+ Note that it is not guaranteed that ``x0 <= x1`` and ``y0 <= y1``.
+ """
+
+ def remove_rubberband(self):
+ """Remove the rubberband."""
+
+ def home(self, *args):
+ """
+ Restore the original view.
+
+ For convenience of being directly connected as a GUI callback, which
+ often get passed additional parameters, this method accepts arbitrary
+ parameters, but does not use them.
+ """
+ self._nav_stack.home()
+ self.set_history_buttons()
+ self._update_view()
+
+ def back(self, *args):
+ """
+ Move back up the view lim stack.
+
+ For convenience of being directly connected as a GUI callback, which
+ often get passed additional parameters, this method accepts arbitrary
+ parameters, but does not use them.
+ """
+ self._nav_stack.back()
+ self.set_history_buttons()
+ self._update_view()
+
+ def forward(self, *args):
+ """
+ Move forward in the view lim stack.
+
+ For convenience of being directly connected as a GUI callback, which
+ often get passed additional parameters, this method accepts arbitrary
+ parameters, but does not use them.
+ """
+ self._nav_stack.forward()
+ self.set_history_buttons()
+ self._update_view()
+
+ @_api.deprecated("3.3", alternative="__init__")
+ def _init_toolbar(self):
+ """
+ This is where you actually build the GUI widgets (called by
+ __init__). The icons ``home.xpm``, ``back.xpm``, ``forward.xpm``,
+ ``hand.xpm``, ``zoom_to_rect.xpm`` and ``filesave.xpm`` are standard
+ across backends (there are ppm versions in CVS also).
+
+ You just need to set the callbacks
+
+ home : self.home
+ back : self.back
+ forward : self.forward
+ hand : self.pan
+ zoom_to_rect : self.zoom
+ filesave : self.save_figure
+
+ You only need to define the last one - the others are in the base
+ class implementation.
+
+ """
+ raise NotImplementedError
+
+ def _update_cursor(self, event):
+ """
+ Update the cursor after a mouse move event or a tool (de)activation.
+ """
+ if not event.inaxes or not self.mode:
+ if self._lastCursor != cursors.POINTER:
+ self.set_cursor(cursors.POINTER)
+ self._lastCursor = cursors.POINTER
+ else:
+ if (self.mode == _Mode.ZOOM
+ and self._lastCursor != cursors.SELECT_REGION):
+ self.set_cursor(cursors.SELECT_REGION)
+ self._lastCursor = cursors.SELECT_REGION
+ elif (self.mode == _Mode.PAN
+ and self._lastCursor != cursors.MOVE):
+ self.set_cursor(cursors.MOVE)
+ self._lastCursor = cursors.MOVE
+
+ @contextmanager
+ def _wait_cursor_for_draw_cm(self):
+ """
+ Set the cursor to a wait cursor when drawing the canvas.
+
+ In order to avoid constantly changing the cursor when the canvas
+ changes frequently, do nothing if this context was triggered during the
+ last second. (Optimally we'd prefer only setting the wait cursor if
+ the *current* draw takes too long, but the current draw blocks the GUI
+ thread).
+ """
+ self._draw_time, last_draw_time = (
+ time.time(), getattr(self, "_draw_time", -np.inf))
+ if self._draw_time - last_draw_time > 1:
+ try:
+ self.set_cursor(cursors.WAIT)
+ yield
+ finally:
+ self.set_cursor(self._lastCursor)
+ else:
+ yield
+
+ @staticmethod
+ def _mouse_event_to_message(event):
+ if event.inaxes and event.inaxes.get_navigate():
+ try:
+ s = event.inaxes.format_coord(event.xdata, event.ydata)
+ except (ValueError, OverflowError):
+ pass
+ else:
+ s = s.rstrip()
+ artists = [a for a in event.inaxes._mouseover_set
+ if a.contains(event)[0] and a.get_visible()]
+ if artists:
+ a = cbook._topmost_artist(artists)
+ if a is not event.inaxes.patch:
+ data = a.get_cursor_data(event)
+ if data is not None:
+ data_str = a.format_cursor_data(data).rstrip()
+ if data_str:
+ s = s + '\n' + data_str
+ return s
+
+ def mouse_move(self, event):
+ self._update_cursor(event)
+
+ s = self._mouse_event_to_message(event)
+ if s is not None:
+ self.set_message(s)
+ else:
+ self.set_message(self.mode)
+
+ def _zoom_pan_handler(self, event):
+ if self.mode == _Mode.PAN:
+ if event.name == "button_press_event":
+ self.press_pan(event)
+ elif event.name == "button_release_event":
+ self.release_pan(event)
+ if self.mode == _Mode.ZOOM:
+ if event.name == "button_press_event":
+ self.press_zoom(event)
+ elif event.name == "button_release_event":
+ self.release_zoom(event)
+
+ @_api.deprecated("3.3")
+ def press(self, event):
+ """Called whenever a mouse button is pressed."""
+
+ @_api.deprecated("3.3")
+ def release(self, event):
+ """Callback for mouse button release."""
+
+ def pan(self, *args):
+ """
+ Toggle the pan/zoom tool.
+
+ Pan with left button, zoom with right.
+ """
+ if self.mode == _Mode.PAN:
+ self.mode = _Mode.NONE
+ self.canvas.widgetlock.release(self)
+ else:
+ self.mode = _Mode.PAN
+ self.canvas.widgetlock(self)
+ for a in self.canvas.figure.get_axes():
+ a.set_navigate_mode(self.mode._navigate_mode)
+ self.set_message(self.mode)
+
+ _PanInfo = namedtuple("_PanInfo", "button axes cid")
+
+ def press_pan(self, event):
+ """Callback for mouse button press in pan/zoom mode."""
+ if (event.button not in [MouseButton.LEFT, MouseButton.RIGHT]
+ or event.x is None or event.y is None):
+ return
+ axes = [a for a in self.canvas.figure.get_axes()
+ if a.in_axes(event) and a.get_navigate() and a.can_pan()]
+ if not axes:
+ return
+ if self._nav_stack() is None:
+ self.push_current() # set the home button to this view
+ for ax in axes:
+ ax.start_pan(event.x, event.y, event.button)
+ self.canvas.mpl_disconnect(self._id_drag)
+ id_drag = self.canvas.mpl_connect("motion_notify_event", self.drag_pan)
+ self._pan_info = self._PanInfo(
+ button=event.button, axes=axes, cid=id_drag)
+ press = _api.deprecate_method_override(
+ __class__.press, self, since="3.3", message="Calling an "
+ "overridden press() at pan start is deprecated since %(since)s "
+ "and will be removed %(removal)s; override press_pan() instead.")
+ if press is not None:
+ press(event)
+
+ def drag_pan(self, event):
+ """Callback for dragging in pan/zoom mode."""
+ for ax in self._pan_info.axes:
+ # Using the recorded button at the press is safer than the current
+ # button, as multiple buttons can get pressed during motion.
+ ax.drag_pan(self._pan_info.button, event.key, event.x, event.y)
+ self.canvas.draw_idle()
+
+ def release_pan(self, event):
+ """Callback for mouse button release in pan/zoom mode."""
+ if self._pan_info is None:
+ return
+ self.canvas.mpl_disconnect(self._pan_info.cid)
+ self._id_drag = self.canvas.mpl_connect(
+ 'motion_notify_event', self.mouse_move)
+ for ax in self._pan_info.axes:
+ ax.end_pan()
+ release = _api.deprecate_method_override(
+ __class__.press, self, since="3.3", message="Calling an "
+ "overridden release() at pan stop is deprecated since %(since)s "
+ "and will be removed %(removal)s; override release_pan() instead.")
+ if release is not None:
+ release(event)
+ self._draw()
+ self._pan_info = None
+ self.push_current()
+
+ def zoom(self, *args):
+ """Toggle zoom to rect mode."""
+ if self.mode == _Mode.ZOOM:
+ self.mode = _Mode.NONE
+ self.canvas.widgetlock.release(self)
+ else:
+ self.mode = _Mode.ZOOM
+ self.canvas.widgetlock(self)
+ for a in self.canvas.figure.get_axes():
+ a.set_navigate_mode(self.mode._navigate_mode)
+ self.set_message(self.mode)
+
+ _ZoomInfo = namedtuple("_ZoomInfo", "direction start_xy axes cid")
+
+ def press_zoom(self, event):
+ """Callback for mouse button press in zoom to rect mode."""
+ if (event.button not in [MouseButton.LEFT, MouseButton.RIGHT]
+ or event.x is None or event.y is None):
+ return
+ axes = [a for a in self.canvas.figure.get_axes()
+ if a.in_axes(event) and a.get_navigate() and a.can_zoom()]
+ if not axes:
+ return
+ if self._nav_stack() is None:
+ self.push_current() # set the home button to this view
+ id_zoom = self.canvas.mpl_connect(
+ "motion_notify_event", self.drag_zoom)
+ self._zoom_info = self._ZoomInfo(
+ direction="in" if event.button == 1 else "out",
+ start_xy=(event.x, event.y), axes=axes, cid=id_zoom)
+ press = _api.deprecate_method_override(
+ __class__.press, self, since="3.3", message="Calling an "
+ "overridden press() at zoom start is deprecated since %(since)s "
+ "and will be removed %(removal)s; override press_zoom() instead.")
+ if press is not None:
+ press(event)
+
+ def drag_zoom(self, event):
+ """Callback for dragging in zoom mode."""
+ start_xy = self._zoom_info.start_xy
+ ax = self._zoom_info.axes[0]
+ (x1, y1), (x2, y2) = np.clip(
+ [start_xy, [event.x, event.y]], ax.bbox.min, ax.bbox.max)
+ if event.key == "x":
+ y1, y2 = ax.bbox.intervaly
+ elif event.key == "y":
+ x1, x2 = ax.bbox.intervalx
+ self.draw_rubberband(event, x1, y1, x2, y2)
+
+ def release_zoom(self, event):
+ """Callback for mouse button release in zoom to rect mode."""
+ if self._zoom_info is None:
+ return
+
+ # We don't check the event button here, so that zooms can be cancelled
+ # by (pressing and) releasing another mouse button.
+ self.canvas.mpl_disconnect(self._zoom_info.cid)
+ self.remove_rubberband()
+
+ start_x, start_y = self._zoom_info.start_xy
+ # Ignore single clicks: 5 pixels is a threshold that allows the user to
+ # "cancel" a zoom action by zooming by less than 5 pixels.
+ if ((abs(event.x - start_x) < 5 and event.key != "y")
+ or (abs(event.y - start_y) < 5 and event.key != "x")):
+ self._draw()
+ self._zoom_info = None
+ release = _api.deprecate_method_override(
+ __class__.press, self, since="3.3", message="Calling an "
+ "overridden release() at zoom stop is deprecated since "
+ "%(since)s and will be removed %(removal)s; override "
+ "release_zoom() instead.")
+ if release is not None:
+ release(event)
+ return
+
+ for i, ax in enumerate(self._zoom_info.axes):
+ # Detect whether this axes is twinned with an earlier axes in the
+ # list of zoomed axes, to avoid double zooming.
+ twinx = any(ax.get_shared_x_axes().joined(ax, prev)
+ for prev in self._zoom_info.axes[:i])
+ twiny = any(ax.get_shared_y_axes().joined(ax, prev)
+ for prev in self._zoom_info.axes[:i])
+ ax._set_view_from_bbox(
+ (start_x, start_y, event.x, event.y),
+ self._zoom_info.direction, event.key, twinx, twiny)
+
+ self._draw()
+ self._zoom_info = None
+ self.push_current()
+
+ release = _api.deprecate_method_override(
+ __class__.release, self, since="3.3", message="Calling an "
+ "overridden release() at zoom stop is deprecated since %(since)s "
+ "and will be removed %(removal)s; override release_zoom() "
+ "instead.")
+ if release is not None:
+ release(event)
+
+ def push_current(self):
+ """Push the current view limits and position onto the stack."""
+ self._nav_stack.push(
+ WeakKeyDictionary(
+ {ax: (ax._get_view(),
+ # Store both the original and modified positions.
+ (ax.get_position(True).frozen(),
+ ax.get_position().frozen()))
+ for ax in self.canvas.figure.axes}))
+ self.set_history_buttons()
+
+ @_api.deprecated("3.3", alternative="toolbar.canvas.draw_idle()")
+ def draw(self):
+ """Redraw the canvases, update the locators."""
+ self._draw()
+
+ # Can be removed once Locator.refresh() is removed, and replaced by an
+ # inline call to self.canvas.draw_idle().
+ def _draw(self):
+ for a in self.canvas.figure.get_axes():
+ xaxis = getattr(a, 'xaxis', None)
+ yaxis = getattr(a, 'yaxis', None)
+ locators = []
+ if xaxis is not None:
+ locators.append(xaxis.get_major_locator())
+ locators.append(xaxis.get_minor_locator())
+ if yaxis is not None:
+ locators.append(yaxis.get_major_locator())
+ locators.append(yaxis.get_minor_locator())
+
+ for loc in locators:
+ mpl.ticker._if_refresh_overridden_call_and_emit_deprec(loc)
+ self.canvas.draw_idle()
+
+ def _update_view(self):
+ """
+ Update the viewlim and position from the view and position stack for
+ each axes.
+ """
+ nav_info = self._nav_stack()
+ if nav_info is None:
+ return
+ # Retrieve all items at once to avoid any risk of GC deleting an Axes
+ # while in the middle of the loop below.
+ items = list(nav_info.items())
+ for ax, (view, (pos_orig, pos_active)) in items:
+ ax._set_view(view)
+ # Restore both the original and modified positions
+ ax._set_position(pos_orig, 'original')
+ ax._set_position(pos_active, 'active')
+ self.canvas.draw_idle()
+
+ def configure_subplots(self, *args):
+ plt = _safe_pyplot_import()
+ self.subplot_tool = plt.subplot_tool(self.canvas.figure)
+ self.subplot_tool.figure.canvas.manager.show()
+
+ def save_figure(self, *args):
+ """Save the current figure."""
+ raise NotImplementedError
+
+ def set_cursor(self, cursor):
+ """
+ Set the current cursor to one of the :class:`Cursors` enums values.
+
+ If required by the backend, this method should trigger an update in
+ the backend event loop after the cursor is set, as this method may be
+ called e.g. before a long-running task during which the GUI is not
+ updated.
+ """
+
+ def update(self):
+ """Reset the axes stack."""
+ self._nav_stack.clear()
+ self.set_history_buttons()
+
+ def set_history_buttons(self):
+ """Enable or disable the back/forward button."""
+
+
+class ToolContainerBase:
+ """
+ Base class for all tool containers, e.g. toolbars.
+
+ Attributes
+ ----------
+ toolmanager : `.ToolManager`
+ The tools with which this `ToolContainer` wants to communicate.
+ """
+
+ _icon_extension = '.png'
+ """
+ Toolcontainer button icon image format extension
+
+ **String**: Image extension
+ """
+
+ def __init__(self, toolmanager):
+ self.toolmanager = toolmanager
+ toolmanager.toolmanager_connect(
+ 'tool_message_event',
+ lambda event: self.set_message(event.message))
+ toolmanager.toolmanager_connect(
+ 'tool_removed_event',
+ lambda event: self.remove_toolitem(event.tool.name))
+
+ def _tool_toggled_cbk(self, event):
+ """
+ Capture the 'tool_trigger_[name]'
+
+ This only gets used for toggled tools.
+ """
+ self.toggle_toolitem(event.tool.name, event.tool.toggled)
+
+ def add_tool(self, tool, group, position=-1):
+ """
+ Add a tool to this container.
+
+ Parameters
+ ----------
+ tool : tool_like
+ The tool to add, see `.ToolManager.get_tool`.
+ group : str
+ The name of the group to add this tool to.
+ position : int, default: -1
+ The position within the group to place this tool.
+ """
+ tool = self.toolmanager.get_tool(tool)
+ image = self._get_image_filename(tool.image)
+ toggle = getattr(tool, 'toggled', None) is not None
+ self.add_toolitem(tool.name, group, position,
+ image, tool.description, toggle)
+ if toggle:
+ self.toolmanager.toolmanager_connect('tool_trigger_%s' % tool.name,
+ self._tool_toggled_cbk)
+ # If initially toggled
+ if tool.toggled:
+ self.toggle_toolitem(tool.name, True)
+
+ def _get_image_filename(self, image):
+ """Find the image based on its name."""
+ if not image:
+ return None
+
+ basedir = cbook._get_data_path("images")
+ for fname in [
+ image,
+ image + self._icon_extension,
+ str(basedir / image),
+ str(basedir / (image + self._icon_extension)),
+ ]:
+ if os.path.isfile(fname):
+ return fname
+
+ def trigger_tool(self, name):
+ """
+ Trigger the tool.
+
+ Parameters
+ ----------
+ name : str
+ Name (id) of the tool triggered from within the container.
+ """
+ self.toolmanager.trigger_tool(name, sender=self)
+
+ def add_toolitem(self, name, group, position, image, description, toggle):
+ """
+ Add a toolitem to the container.
+
+ This method must be implemented per backend.
+
+ The callback associated with the button click event,
+ must be *exactly* ``self.trigger_tool(name)``.
+
+ Parameters
+ ----------
+ name : str
+ Name of the tool to add, this gets used as the tool's ID and as the
+ default label of the buttons.
+ group : str
+ Name of the group that this tool belongs to.
+ position : int
+ Position of the tool within its group, if -1 it goes at the end.
+ image : str
+ Filename of the image for the button or `None`.
+ description : str
+ Description of the tool, used for the tooltips.
+ toggle : bool
+ * `True` : The button is a toggle (change the pressed/unpressed
+ state between consecutive clicks).
+ * `False` : The button is a normal button (returns to unpressed
+ state after release).
+ """
+ raise NotImplementedError
+
+ def toggle_toolitem(self, name, toggled):
+ """
+ Toggle the toolitem without firing event.
+
+ Parameters
+ ----------
+ name : str
+ Id of the tool to toggle.
+ toggled : bool
+ Whether to set this tool as toggled or not.
+ """
+ raise NotImplementedError
+
+ def remove_toolitem(self, name):
+ """
+ Remove a toolitem from the `ToolContainer`.
+
+ This method must get implemented per backend.
+
+ Called when `.ToolManager` emits a `tool_removed_event`.
+
+ Parameters
+ ----------
+ name : str
+ Name of the tool to remove.
+ """
+ raise NotImplementedError
+
+ def set_message(self, s):
+ """
+ Display a message on the toolbar.
+
+ Parameters
+ ----------
+ s : str
+ Message text.
+ """
+ raise NotImplementedError
+
+
+@_api.deprecated("3.3")
+class StatusbarBase:
+ """Base class for the statusbar."""
+ def __init__(self, toolmanager):
+ self.toolmanager = toolmanager
+ self.toolmanager.toolmanager_connect('tool_message_event',
+ self._message_cbk)
+
+ def _message_cbk(self, event):
+ """Capture the 'tool_message_event' and set the message."""
+ self.set_message(event.message)
+
+ def set_message(self, s):
+ """
+ Display a message on toolbar or in status bar.
+
+ Parameters
+ ----------
+ s : str
+ Message text.
+ """
+
+
+class _Backend:
+ # A backend can be defined by using the following pattern:
+ #
+ # @_Backend.export
+ # class FooBackend(_Backend):
+ # # override the attributes and methods documented below.
+
+ # `backend_version` may be overridden by the subclass.
+ backend_version = "unknown"
+
+ # The `FigureCanvas` class must be defined.
+ FigureCanvas = None
+
+ # For interactive backends, the `FigureManager` class must be overridden.
+ FigureManager = FigureManagerBase
+
+ # For interactive backends, `mainloop` should be a function taking no
+ # argument and starting the backend main loop. It should be left as None
+ # for non-interactive backends.
+ mainloop = None
+
+ # The following methods will be automatically defined and exported, but
+ # can be overridden.
+
+ @classmethod
+ def new_figure_manager(cls, num, *args, **kwargs):
+ """Create a new figure manager instance."""
+ # This import needs to happen here due to circular imports.
+ from matplotlib.figure import Figure
+ fig_cls = kwargs.pop('FigureClass', Figure)
+ fig = fig_cls(*args, **kwargs)
+ return cls.new_figure_manager_given_figure(num, fig)
+
+ @classmethod
+ def new_figure_manager_given_figure(cls, num, figure):
+ """Create a new figure manager instance for the given figure."""
+ canvas = cls.FigureCanvas(figure)
+ manager = cls.FigureManager(canvas, num)
+ return manager
+
+ @classmethod
+ def draw_if_interactive(cls):
+ if cls.mainloop is not None and is_interactive():
+ manager = Gcf.get_active()
+ if manager:
+ manager.canvas.draw_idle()
+
+ @classmethod
+ def show(cls, *, block=None):
+ """
+ Show all figures.
+
+ `show` blocks by calling `mainloop` if *block* is ``True``, or if it
+ is ``None`` and we are neither in IPython's ``%pylab`` mode, nor in
+ `interactive` mode.
+ """
+ managers = Gcf.get_all_fig_managers()
+ if not managers:
+ return
+ for manager in managers:
+ try:
+ manager.show() # Emits a warning for non-interactive backend.
+ except NonGuiException as exc:
+ _api.warn_external(str(exc))
+ if cls.mainloop is None:
+ return
+ if block is None:
+ # Hack: Are we in IPython's pylab mode?
+ from matplotlib import pyplot
+ try:
+ # IPython versions >= 0.10 tack the _needmain attribute onto
+ # pyplot.show, and always set it to False, when in %pylab mode.
+ ipython_pylab = not pyplot.show._needmain
+ except AttributeError:
+ ipython_pylab = False
+ block = not ipython_pylab and not is_interactive()
+ # TODO: The above is a hack to get the WebAgg backend working with
+ # ipython's `%pylab` mode until proper integration is implemented.
+ if get_backend() == "WebAgg":
+ block = True
+ if block:
+ cls.mainloop()
+
+ # This method is the one actually exporting the required methods.
+
+ @staticmethod
+ def export(cls):
+ for name in [
+ "backend_version",
+ "FigureCanvas",
+ "FigureManager",
+ "new_figure_manager",
+ "new_figure_manager_given_figure",
+ "draw_if_interactive",
+ "show",
+ ]:
+ setattr(sys.modules[cls.__module__], name, getattr(cls, name))
+
+ # For back-compatibility, generate a shim `Show` class.
+
+ class Show(ShowBase):
+ def mainloop(self):
+ return cls.mainloop()
+
+ setattr(sys.modules[cls.__module__], "Show", Show)
+ return cls
+
+
+class ShowBase(_Backend):
+ """
+ Simple base class to generate a ``show()`` function in backends.
+
+ Subclass must override ``mainloop()`` method.
+ """
+
+ def __call__(self, block=None):
+ return self.show(block=block)
diff --git a/venv/Lib/site-packages/matplotlib/backend_managers.py b/venv/Lib/site-packages/matplotlib/backend_managers.py
new file mode 100644
index 0000000..384b453
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backend_managers.py
@@ -0,0 +1,435 @@
+from matplotlib import _api, cbook, widgets
+from matplotlib.rcsetup import validate_stringlist
+import matplotlib.backend_tools as tools
+
+
+class ToolEvent:
+ """Event for tool manipulation (add/remove)."""
+ def __init__(self, name, sender, tool, data=None):
+ self.name = name
+ self.sender = sender
+ self.tool = tool
+ self.data = data
+
+
+class ToolTriggerEvent(ToolEvent):
+ """Event to inform that a tool has been triggered."""
+ def __init__(self, name, sender, tool, canvasevent=None, data=None):
+ super().__init__(name, sender, tool, data)
+ self.canvasevent = canvasevent
+
+
+class ToolManagerMessageEvent:
+ """
+ Event carrying messages from toolmanager.
+
+ Messages usually get displayed to the user by the toolbar.
+ """
+ def __init__(self, name, sender, message):
+ self.name = name
+ self.sender = sender
+ self.message = message
+
+
+class ToolManager:
+ """
+ Manager for actions triggered by user interactions (key press, toolbar
+ clicks, ...) on a Figure.
+
+ Attributes
+ ----------
+ figure : `.Figure`
+ keypresslock : `~matplotlib.widgets.LockDraw`
+ `.LockDraw` object to know if the `canvas` key_press_event is locked.
+ messagelock : `~matplotlib.widgets.LockDraw`
+ `.LockDraw` object to know if the message is available to write.
+ """
+
+ def __init__(self, figure=None):
+
+ self._key_press_handler_id = None
+
+ self._tools = {}
+ self._keys = {}
+ self._toggled = {}
+ self._callbacks = cbook.CallbackRegistry()
+
+ # to process keypress event
+ self.keypresslock = widgets.LockDraw()
+ self.messagelock = widgets.LockDraw()
+
+ self._figure = None
+ self.set_figure(figure)
+
+ @property
+ def canvas(self):
+ """Canvas managed by FigureManager."""
+ if not self._figure:
+ return None
+ return self._figure.canvas
+
+ @property
+ def figure(self):
+ """Figure that holds the canvas."""
+ return self._figure
+
+ @figure.setter
+ def figure(self, figure):
+ self.set_figure(figure)
+
+ def set_figure(self, figure, update_tools=True):
+ """
+ Bind the given figure to the tools.
+
+ Parameters
+ ----------
+ figure : `.Figure`
+ update_tools : bool, default: True
+ Force tools to update figure.
+ """
+ if self._key_press_handler_id:
+ self.canvas.mpl_disconnect(self._key_press_handler_id)
+ self._figure = figure
+ if figure:
+ self._key_press_handler_id = self.canvas.mpl_connect(
+ 'key_press_event', self._key_press)
+ if update_tools:
+ for tool in self._tools.values():
+ tool.figure = figure
+
+ def toolmanager_connect(self, s, func):
+ """
+ Connect event with string *s* to *func*.
+
+ Parameters
+ ----------
+ s : str
+ The name of the event. The following events are recognized:
+
+ - 'tool_message_event'
+ - 'tool_removed_event'
+ - 'tool_added_event'
+
+ For every tool added a new event is created
+
+ - 'tool_trigger_TOOLNAME', where TOOLNAME is the id of the tool.
+
+ func : callable
+ Callback function for the toolmanager event with signature::
+
+ def func(event: ToolEvent) -> Any
+
+ Returns
+ -------
+ cid
+ The callback id for the connection. This can be used in
+ `.toolmanager_disconnect`.
+ """
+ return self._callbacks.connect(s, func)
+
+ def toolmanager_disconnect(self, cid):
+ """
+ Disconnect callback id *cid*.
+
+ Example usage::
+
+ cid = toolmanager.toolmanager_connect('tool_trigger_zoom', onpress)
+ #...later
+ toolmanager.toolmanager_disconnect(cid)
+ """
+ return self._callbacks.disconnect(cid)
+
+ def message_event(self, message, sender=None):
+ """Emit a `ToolManagerMessageEvent`."""
+ if sender is None:
+ sender = self
+
+ s = 'tool_message_event'
+ event = ToolManagerMessageEvent(s, sender, message)
+ self._callbacks.process(s, event)
+
+ @property
+ def active_toggle(self):
+ """Currently toggled tools."""
+ return self._toggled
+
+ def get_tool_keymap(self, name):
+ """
+ Return the keymap associated with the specified tool.
+
+ Parameters
+ ----------
+ name : str
+ Name of the Tool.
+
+ Returns
+ -------
+ list of str
+ List of keys associated with the tool.
+ """
+
+ keys = [k for k, i in self._keys.items() if i == name]
+ return keys
+
+ def _remove_keys(self, name):
+ for k in self.get_tool_keymap(name):
+ del self._keys[k]
+
+ @_api.delete_parameter("3.3", "args")
+ def update_keymap(self, name, key, *args):
+ """
+ Set the keymap to associate with the specified tool.
+
+ Parameters
+ ----------
+ name : str
+ Name of the Tool.
+ key : str or list of str
+ Keys to associate with the tool.
+ """
+ if name not in self._tools:
+ raise KeyError('%s not in Tools' % name)
+ self._remove_keys(name)
+ for key in [key, *args]:
+ if isinstance(key, str) and validate_stringlist(key) != [key]:
+ _api.warn_deprecated(
+ "3.3", message="Passing a list of keys as a single "
+ "comma-separated string is deprecated since %(since)s and "
+ "support will be removed %(removal)s; pass keys as a list "
+ "of strings instead.")
+ key = validate_stringlist(key)
+ if isinstance(key, str):
+ key = [key]
+ for k in key:
+ if k in self._keys:
+ _api.warn_external(
+ f'Key {k} changed from {self._keys[k]} to {name}')
+ self._keys[k] = name
+
+ def remove_tool(self, name):
+ """
+ Remove tool named *name*.
+
+ Parameters
+ ----------
+ name : str
+ Name of the tool.
+ """
+
+ tool = self.get_tool(name)
+ tool.destroy()
+
+ # If is a toggle tool and toggled, untoggle
+ if getattr(tool, 'toggled', False):
+ self.trigger_tool(tool, 'toolmanager')
+
+ self._remove_keys(name)
+
+ s = 'tool_removed_event'
+ event = ToolEvent(s, self, tool)
+ self._callbacks.process(s, event)
+
+ del self._tools[name]
+
+ def add_tool(self, name, tool, *args, **kwargs):
+ """
+ Add *tool* to `ToolManager`.
+
+ If successful, adds a new event ``tool_trigger_{name}`` where
+ ``{name}`` is the *name* of the tool; the event is fired every time the
+ tool is triggered.
+
+ Parameters
+ ----------
+ name : str
+ Name of the tool, treated as the ID, has to be unique.
+ tool : class_like, i.e. str or type
+ Reference to find the class of the Tool to added.
+
+ Notes
+ -----
+ args and kwargs get passed directly to the tools constructor.
+
+ See Also
+ --------
+ matplotlib.backend_tools.ToolBase : The base class for tools.
+ """
+
+ tool_cls = self._get_cls_to_instantiate(tool)
+ if not tool_cls:
+ raise ValueError('Impossible to find class for %s' % str(tool))
+
+ if name in self._tools:
+ _api.warn_external('A "Tool class" with the same name already '
+ 'exists, not added')
+ return self._tools[name]
+
+ tool_obj = tool_cls(self, name, *args, **kwargs)
+ self._tools[name] = tool_obj
+
+ if tool_cls.default_keymap is not None:
+ self.update_keymap(name, tool_cls.default_keymap)
+
+ # For toggle tools init the radio_group in self._toggled
+ if isinstance(tool_obj, tools.ToolToggleBase):
+ # None group is not mutually exclusive, a set is used to keep track
+ # of all toggled tools in this group
+ if tool_obj.radio_group is None:
+ self._toggled.setdefault(None, set())
+ else:
+ self._toggled.setdefault(tool_obj.radio_group, None)
+
+ # If initially toggled
+ if tool_obj.toggled:
+ self._handle_toggle(tool_obj, None, None, None)
+ tool_obj.set_figure(self.figure)
+
+ self._tool_added_event(tool_obj)
+ return tool_obj
+
+ def _tool_added_event(self, tool):
+ s = 'tool_added_event'
+ event = ToolEvent(s, self, tool)
+ self._callbacks.process(s, event)
+
+ def _handle_toggle(self, tool, sender, canvasevent, data):
+ """
+ Toggle tools, need to untoggle prior to using other Toggle tool.
+ Called from trigger_tool.
+
+ Parameters
+ ----------
+ tool : `.ToolBase`
+ sender : object
+ Object that wishes to trigger the tool.
+ canvasevent : Event
+ Original Canvas event or None.
+ data : object
+ Extra data to pass to the tool when triggering.
+ """
+
+ radio_group = tool.radio_group
+ # radio_group None is not mutually exclusive
+ # just keep track of toggled tools in this group
+ if radio_group is None:
+ if tool.name in self._toggled[None]:
+ self._toggled[None].remove(tool.name)
+ else:
+ self._toggled[None].add(tool.name)
+ return
+
+ # If the tool already has a toggled state, untoggle it
+ if self._toggled[radio_group] == tool.name:
+ toggled = None
+ # If no tool was toggled in the radio_group
+ # toggle it
+ elif self._toggled[radio_group] is None:
+ toggled = tool.name
+ # Other tool in the radio_group is toggled
+ else:
+ # Untoggle previously toggled tool
+ self.trigger_tool(self._toggled[radio_group],
+ self,
+ canvasevent,
+ data)
+ toggled = tool.name
+
+ # Keep track of the toggled tool in the radio_group
+ self._toggled[radio_group] = toggled
+
+ def _get_cls_to_instantiate(self, callback_class):
+ # Find the class that corresponds to the tool
+ if isinstance(callback_class, str):
+ # FIXME: make more complete searching structure
+ if callback_class in globals():
+ callback_class = globals()[callback_class]
+ else:
+ mod = 'backend_tools'
+ current_module = __import__(mod,
+ globals(), locals(), [mod], 1)
+
+ callback_class = getattr(current_module, callback_class, False)
+ if callable(callback_class):
+ return callback_class
+ else:
+ return None
+
+ def trigger_tool(self, name, sender=None, canvasevent=None, data=None):
+ """
+ Trigger a tool and emit the ``tool_trigger_{name}`` event.
+
+ Parameters
+ ----------
+ name : str
+ Name of the tool.
+ sender : object
+ Object that wishes to trigger the tool.
+ canvasevent : Event
+ Original Canvas event or None.
+ data : object
+ Extra data to pass to the tool when triggering.
+ """
+ tool = self.get_tool(name)
+ if tool is None:
+ return
+
+ if sender is None:
+ sender = self
+
+ self._trigger_tool(name, sender, canvasevent, data)
+
+ s = 'tool_trigger_%s' % name
+ event = ToolTriggerEvent(s, sender, tool, canvasevent, data)
+ self._callbacks.process(s, event)
+
+ def _trigger_tool(self, name, sender=None, canvasevent=None, data=None):
+ """Actually trigger a tool."""
+ tool = self.get_tool(name)
+
+ if isinstance(tool, tools.ToolToggleBase):
+ self._handle_toggle(tool, sender, canvasevent, data)
+
+ # Important!!!
+ # This is where the Tool object gets triggered
+ tool.trigger(sender, canvasevent, data)
+
+ def _key_press(self, event):
+ if event.key is None or self.keypresslock.locked():
+ return
+
+ name = self._keys.get(event.key, None)
+ if name is None:
+ return
+ self.trigger_tool(name, canvasevent=event)
+
+ @property
+ def tools(self):
+ """A dict mapping tool name -> controlled tool."""
+ return self._tools
+
+ def get_tool(self, name, warn=True):
+ """
+ Return the tool object with the given name.
+
+ For convenience, this passes tool objects through.
+
+ Parameters
+ ----------
+ name : str or `.ToolBase`
+ Name of the tool, or the tool itself.
+ warn : bool, default: True
+ Whether a warning should be emitted it no tool with the given name
+ exists.
+
+ Returns
+ -------
+ `.ToolBase` or None
+ The tool or None if no tool with the given name exists.
+ """
+ if isinstance(name, tools.ToolBase) and name.name in self._tools:
+ return name
+ if name not in self._tools:
+ if warn:
+ _api.warn_external(f"ToolManager does not control tool {name}")
+ return None
+ return self._tools[name]
diff --git a/venv/Lib/site-packages/matplotlib/backend_tools.py b/venv/Lib/site-packages/matplotlib/backend_tools.py
new file mode 100644
index 0000000..a8bad1e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backend_tools.py
@@ -0,0 +1,1082 @@
+"""
+Abstract base classes define the primitives for Tools.
+These tools are used by `matplotlib.backend_managers.ToolManager`
+
+:class:`ToolBase`
+ Simple stateless tool
+
+:class:`ToolToggleBase`
+ Tool that has two states, only one Toggle tool can be
+ active at any given time for the same
+ `matplotlib.backend_managers.ToolManager`
+"""
+
+from enum import IntEnum
+import re
+import time
+from types import SimpleNamespace
+import uuid
+from weakref import WeakKeyDictionary
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib._pylab_helpers import Gcf
+from matplotlib import _api, cbook
+
+
+class Cursors(IntEnum): # Must subclass int for the macOS backend.
+ """Backend-independent cursor types."""
+ HAND, POINTER, SELECT_REGION, MOVE, WAIT = range(5)
+cursors = Cursors # Backcompat.
+
+# Views positions tool
+_views_positions = 'viewpos'
+
+
+class ToolBase:
+ """
+ Base tool class.
+
+ A base tool, only implements `trigger` method or not method at all.
+ The tool is instantiated by `matplotlib.backend_managers.ToolManager`.
+
+ Attributes
+ ----------
+ toolmanager : `matplotlib.backend_managers.ToolManager`
+ ToolManager that controls this Tool.
+ figure : `FigureCanvas`
+ Figure instance that is affected by this Tool.
+ name : str
+ Used as **Id** of the tool, has to be unique among tools of the same
+ ToolManager.
+ """
+
+ default_keymap = None
+ """
+ Keymap to associate with this tool.
+
+ **String**: List of comma separated keys that will be used to call this
+ tool when the keypress event of ``self.figure.canvas`` is emitted.
+ """
+
+ description = None
+ """
+ Description of the Tool.
+
+ **String**: If the Tool is included in the Toolbar this text is used
+ as a Tooltip.
+ """
+
+ image = None
+ """
+ Filename of the image.
+
+ **String**: Filename of the image to use in the toolbar. If None, the
+ *name* is used as a label in the toolbar button.
+ """
+
+ def __init__(self, toolmanager, name):
+ self._name = name
+ self._toolmanager = toolmanager
+ self._figure = None
+
+ @property
+ def figure(self):
+ return self._figure
+
+ @figure.setter
+ def figure(self, figure):
+ self.set_figure(figure)
+
+ @property
+ def canvas(self):
+ if not self._figure:
+ return None
+ return self._figure.canvas
+
+ @property
+ def toolmanager(self):
+ return self._toolmanager
+
+ def _make_classic_style_pseudo_toolbar(self):
+ """
+ Return a placeholder object with a single `canvas` attribute.
+
+ This is useful to reuse the implementations of tools already provided
+ by the classic Toolbars.
+ """
+ return SimpleNamespace(canvas=self.canvas)
+
+ def set_figure(self, figure):
+ """
+ Assign a figure to the tool.
+
+ Parameters
+ ----------
+ figure : `.Figure`
+ """
+ self._figure = figure
+
+ def trigger(self, sender, event, data=None):
+ """
+ Called when this tool gets used.
+
+ This method is called by
+ `matplotlib.backend_managers.ToolManager.trigger_tool`.
+
+ Parameters
+ ----------
+ event : `.Event`
+ The canvas event that caused this tool to be called.
+ sender : object
+ Object that requested the tool to be triggered.
+ data : object
+ Extra data.
+ """
+ pass
+
+ @property
+ def name(self):
+ """Tool Id."""
+ return self._name
+
+ def destroy(self):
+ """
+ Destroy the tool.
+
+ This method is called when the tool is removed by
+ `matplotlib.backend_managers.ToolManager.remove_tool`.
+ """
+ pass
+
+
+class ToolToggleBase(ToolBase):
+ """
+ Toggleable tool.
+
+ Every time it is triggered, it switches between enable and disable.
+
+ Parameters
+ ----------
+ ``*args``
+ Variable length argument to be used by the Tool.
+ ``**kwargs``
+ `toggled` if present and True, sets the initial state of the Tool
+ Arbitrary keyword arguments to be consumed by the Tool
+ """
+
+ radio_group = None
+ """Attribute to group 'radio' like tools (mutually exclusive).
+
+ **String** that identifies the group or **None** if not belonging to a
+ group.
+ """
+
+ cursor = None
+ """Cursor to use when the tool is active."""
+
+ default_toggled = False
+ """Default of toggled state."""
+
+ def __init__(self, *args, **kwargs):
+ self._toggled = kwargs.pop('toggled', self.default_toggled)
+ super().__init__(*args, **kwargs)
+
+ def trigger(self, sender, event, data=None):
+ """Calls `enable` or `disable` based on `toggled` value."""
+ if self._toggled:
+ self.disable(event)
+ else:
+ self.enable(event)
+ self._toggled = not self._toggled
+
+ def enable(self, event=None):
+ """
+ Enable the toggle tool.
+
+ `trigger` calls this method when `toggled` is False.
+ """
+ pass
+
+ def disable(self, event=None):
+ """
+ Disable the toggle tool.
+
+ `trigger` call this method when `toggled` is True.
+
+ This can happen in different circumstances.
+
+ * Click on the toolbar tool button.
+ * Call to `matplotlib.backend_managers.ToolManager.trigger_tool`.
+ * Another `ToolToggleBase` derived tool is triggered
+ (from the same `.ToolManager`).
+ """
+ pass
+
+ @property
+ def toggled(self):
+ """State of the toggled tool."""
+
+ return self._toggled
+
+ def set_figure(self, figure):
+ toggled = self.toggled
+ if toggled:
+ if self.figure:
+ self.trigger(self, None)
+ else:
+ # if no figure the internal state is not changed
+ # we change it here so next call to trigger will change it back
+ self._toggled = False
+ super().set_figure(figure)
+ if toggled:
+ if figure:
+ self.trigger(self, None)
+ else:
+ # if there is no figure, trigger won't change the internal
+ # state we change it back
+ self._toggled = True
+
+
+class SetCursorBase(ToolBase):
+ """
+ Change to the current cursor while inaxes.
+
+ This tool, keeps track of all `ToolToggleBase` derived tools, and calls
+ `set_cursor` when a tool gets triggered.
+ """
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self._id_drag = None
+ self._cursor = None
+ self._default_cursor = cursors.POINTER
+ self._last_cursor = self._default_cursor
+ self.toolmanager.toolmanager_connect('tool_added_event',
+ self._add_tool_cbk)
+
+ # process current tools
+ for tool in self.toolmanager.tools.values():
+ self._add_tool(tool)
+
+ def set_figure(self, figure):
+ if self._id_drag:
+ self.canvas.mpl_disconnect(self._id_drag)
+ super().set_figure(figure)
+ if figure:
+ self._id_drag = self.canvas.mpl_connect(
+ 'motion_notify_event', self._set_cursor_cbk)
+
+ def _tool_trigger_cbk(self, event):
+ if event.tool.toggled:
+ self._cursor = event.tool.cursor
+ else:
+ self._cursor = None
+
+ self._set_cursor_cbk(event.canvasevent)
+
+ def _add_tool(self, tool):
+ """Set the cursor when the tool is triggered."""
+ if getattr(tool, 'cursor', None) is not None:
+ self.toolmanager.toolmanager_connect('tool_trigger_%s' % tool.name,
+ self._tool_trigger_cbk)
+
+ def _add_tool_cbk(self, event):
+ """Process every newly added tool."""
+ if event.tool is self:
+ return
+ self._add_tool(event.tool)
+
+ def _set_cursor_cbk(self, event):
+ if not event:
+ return
+
+ if not getattr(event, 'inaxes', False) or not self._cursor:
+ if self._last_cursor != self._default_cursor:
+ self.set_cursor(self._default_cursor)
+ self._last_cursor = self._default_cursor
+ elif self._cursor:
+ cursor = self._cursor
+ if cursor and self._last_cursor != cursor:
+ self.set_cursor(cursor)
+ self._last_cursor = cursor
+
+ def set_cursor(self, cursor):
+ """
+ Set the cursor.
+
+ This method has to be implemented per backend.
+ """
+ raise NotImplementedError
+
+
+class ToolCursorPosition(ToolBase):
+ """
+ Send message with the current pointer position.
+
+ This tool runs in the background reporting the position of the cursor.
+ """
+ def __init__(self, *args, **kwargs):
+ self._id_drag = None
+ super().__init__(*args, **kwargs)
+
+ def set_figure(self, figure):
+ if self._id_drag:
+ self.canvas.mpl_disconnect(self._id_drag)
+ super().set_figure(figure)
+ if figure:
+ self._id_drag = self.canvas.mpl_connect(
+ 'motion_notify_event', self.send_message)
+
+ def send_message(self, event):
+ """Call `matplotlib.backend_managers.ToolManager.message_event`."""
+ if self.toolmanager.messagelock.locked():
+ return
+
+ from matplotlib.backend_bases import NavigationToolbar2
+ message = NavigationToolbar2._mouse_event_to_message(event)
+ if message is None:
+ message = ' '
+ self.toolmanager.message_event(message, self)
+
+
+class RubberbandBase(ToolBase):
+ """Draw and remove a rubberband."""
+ def trigger(self, sender, event, data):
+ """Call `draw_rubberband` or `remove_rubberband` based on data."""
+ if not self.figure.canvas.widgetlock.available(sender):
+ return
+ if data is not None:
+ self.draw_rubberband(*data)
+ else:
+ self.remove_rubberband()
+
+ def draw_rubberband(self, *data):
+ """
+ Draw rubberband.
+
+ This method must get implemented per backend.
+ """
+ raise NotImplementedError
+
+ def remove_rubberband(self):
+ """
+ Remove rubberband.
+
+ This method should get implemented per backend.
+ """
+ pass
+
+
+class ToolQuit(ToolBase):
+ """Tool to call the figure manager destroy method."""
+
+ description = 'Quit the figure'
+ default_keymap = mpl.rcParams['keymap.quit']
+
+ def trigger(self, sender, event, data=None):
+ Gcf.destroy_fig(self.figure)
+
+
+class ToolQuitAll(ToolBase):
+ """Tool to call the figure manager destroy method."""
+
+ description = 'Quit all figures'
+ default_keymap = mpl.rcParams['keymap.quit_all']
+
+ def trigger(self, sender, event, data=None):
+ Gcf.destroy_all()
+
+
+class _ToolEnableAllNavigation(ToolBase):
+ """Tool to enable all axes for toolmanager interaction."""
+
+ description = 'Enable all axes toolmanager'
+ default_keymap = mpl.rcParams['keymap.all_axes']
+
+ def trigger(self, sender, event, data=None):
+ mpl.backend_bases.key_press_handler(event, self.figure.canvas, None)
+
+
+@_api.deprecated("3.3")
+class ToolEnableAllNavigation(_ToolEnableAllNavigation):
+ pass
+
+
+class _ToolEnableNavigation(ToolBase):
+ """Tool to enable a specific axes for toolmanager interaction."""
+
+ description = 'Enable one axes toolmanager'
+ default_keymap = ('1', '2', '3', '4', '5', '6', '7', '8', '9')
+
+ def trigger(self, sender, event, data=None):
+ mpl.backend_bases.key_press_handler(event, self.figure.canvas, None)
+
+
+@_api.deprecated("3.3")
+class ToolEnableNavigation(_ToolEnableNavigation):
+ pass
+
+
+class ToolGrid(ToolBase):
+ """Tool to toggle the major grids of the figure."""
+
+ description = 'Toggle major grids'
+ default_keymap = mpl.rcParams['keymap.grid']
+
+ def trigger(self, sender, event, data=None):
+ sentinel = str(uuid.uuid4())
+ # Trigger grid switching by temporarily setting :rc:`keymap.grid`
+ # to a unique key and sending an appropriate event.
+ with cbook._setattr_cm(event, key=sentinel), \
+ mpl.rc_context({'keymap.grid': sentinel}):
+ mpl.backend_bases.key_press_handler(event, self.figure.canvas)
+
+
+class ToolMinorGrid(ToolBase):
+ """Tool to toggle the major and minor grids of the figure."""
+
+ description = 'Toggle major and minor grids'
+ default_keymap = mpl.rcParams['keymap.grid_minor']
+
+ def trigger(self, sender, event, data=None):
+ sentinel = str(uuid.uuid4())
+ # Trigger grid switching by temporarily setting :rc:`keymap.grid_minor`
+ # to a unique key and sending an appropriate event.
+ with cbook._setattr_cm(event, key=sentinel), \
+ mpl.rc_context({'keymap.grid_minor': sentinel}):
+ mpl.backend_bases.key_press_handler(event, self.figure.canvas)
+
+
+class ToolFullScreen(ToolToggleBase):
+ """Tool to toggle full screen."""
+
+ description = 'Toggle fullscreen mode'
+ default_keymap = mpl.rcParams['keymap.fullscreen']
+
+ def enable(self, event):
+ self.figure.canvas.manager.full_screen_toggle()
+
+ def disable(self, event):
+ self.figure.canvas.manager.full_screen_toggle()
+
+
+class AxisScaleBase(ToolToggleBase):
+ """Base Tool to toggle between linear and logarithmic."""
+
+ def trigger(self, sender, event, data=None):
+ if event.inaxes is None:
+ return
+ super().trigger(sender, event, data)
+
+ def enable(self, event):
+ self.set_scale(event.inaxes, 'log')
+ self.figure.canvas.draw_idle()
+
+ def disable(self, event):
+ self.set_scale(event.inaxes, 'linear')
+ self.figure.canvas.draw_idle()
+
+
+class ToolYScale(AxisScaleBase):
+ """Tool to toggle between linear and logarithmic scales on the Y axis."""
+
+ description = 'Toggle scale Y axis'
+ default_keymap = mpl.rcParams['keymap.yscale']
+
+ def set_scale(self, ax, scale):
+ ax.set_yscale(scale)
+
+
+class ToolXScale(AxisScaleBase):
+ """Tool to toggle between linear and logarithmic scales on the X axis."""
+
+ description = 'Toggle scale X axis'
+ default_keymap = mpl.rcParams['keymap.xscale']
+
+ def set_scale(self, ax, scale):
+ ax.set_xscale(scale)
+
+
+class ToolViewsPositions(ToolBase):
+ """
+ Auxiliary Tool to handle changes in views and positions.
+
+ Runs in the background and should get used by all the tools that
+ need to access the figure's history of views and positions, e.g.
+
+ * `ToolZoom`
+ * `ToolPan`
+ * `ToolHome`
+ * `ToolBack`
+ * `ToolForward`
+ """
+
+ def __init__(self, *args, **kwargs):
+ self.views = WeakKeyDictionary()
+ self.positions = WeakKeyDictionary()
+ self.home_views = WeakKeyDictionary()
+ super().__init__(*args, **kwargs)
+
+ def add_figure(self, figure):
+ """Add the current figure to the stack of views and positions."""
+
+ if figure not in self.views:
+ self.views[figure] = cbook.Stack()
+ self.positions[figure] = cbook.Stack()
+ self.home_views[figure] = WeakKeyDictionary()
+ # Define Home
+ self.push_current(figure)
+ # Make sure we add a home view for new axes as they're added
+ figure.add_axobserver(lambda fig: self.update_home_views(fig))
+
+ def clear(self, figure):
+ """Reset the axes stack."""
+ if figure in self.views:
+ self.views[figure].clear()
+ self.positions[figure].clear()
+ self.home_views[figure].clear()
+ self.update_home_views()
+
+ def update_view(self):
+ """
+ Update the view limits and position for each axes from the current
+ stack position. If any axes are present in the figure that aren't in
+ the current stack position, use the home view limits for those axes and
+ don't update *any* positions.
+ """
+
+ views = self.views[self.figure]()
+ if views is None:
+ return
+ pos = self.positions[self.figure]()
+ if pos is None:
+ return
+ home_views = self.home_views[self.figure]
+ all_axes = self.figure.get_axes()
+ for a in all_axes:
+ if a in views:
+ cur_view = views[a]
+ else:
+ cur_view = home_views[a]
+ a._set_view(cur_view)
+
+ if set(all_axes).issubset(pos):
+ for a in all_axes:
+ # Restore both the original and modified positions
+ a._set_position(pos[a][0], 'original')
+ a._set_position(pos[a][1], 'active')
+
+ self.figure.canvas.draw_idle()
+
+ def push_current(self, figure=None):
+ """
+ Push the current view limits and position onto their respective stacks.
+ """
+ if not figure:
+ figure = self.figure
+ views = WeakKeyDictionary()
+ pos = WeakKeyDictionary()
+ for a in figure.get_axes():
+ views[a] = a._get_view()
+ pos[a] = self._axes_pos(a)
+ self.views[figure].push(views)
+ self.positions[figure].push(pos)
+
+ def _axes_pos(self, ax):
+ """
+ Return the original and modified positions for the specified axes.
+
+ Parameters
+ ----------
+ ax : matplotlib.axes.Axes
+ The `.Axes` to get the positions for.
+
+ Returns
+ -------
+ original_position, modified_position
+ A tuple of the original and modified positions.
+ """
+
+ return (ax.get_position(True).frozen(),
+ ax.get_position().frozen())
+
+ def update_home_views(self, figure=None):
+ """
+ Make sure that ``self.home_views`` has an entry for all axes present
+ in the figure.
+ """
+
+ if not figure:
+ figure = self.figure
+ for a in figure.get_axes():
+ if a not in self.home_views[figure]:
+ self.home_views[figure][a] = a._get_view()
+
+ @_api.deprecated("3.3", alternative="self.figure.canvas.draw_idle()")
+ def refresh_locators(self):
+ """Redraw the canvases, update the locators."""
+ self._refresh_locators()
+
+ # Can be removed once Locator.refresh() is removed, and replaced by an
+ # inline call to self.figure.canvas.draw_idle().
+ def _refresh_locators(self):
+ for a in self.figure.get_axes():
+ xaxis = getattr(a, 'xaxis', None)
+ yaxis = getattr(a, 'yaxis', None)
+ zaxis = getattr(a, 'zaxis', None)
+ locators = []
+ if xaxis is not None:
+ locators.append(xaxis.get_major_locator())
+ locators.append(xaxis.get_minor_locator())
+ if yaxis is not None:
+ locators.append(yaxis.get_major_locator())
+ locators.append(yaxis.get_minor_locator())
+ if zaxis is not None:
+ locators.append(zaxis.get_major_locator())
+ locators.append(zaxis.get_minor_locator())
+
+ for loc in locators:
+ mpl.ticker._if_refresh_overridden_call_and_emit_deprec(loc)
+ self.figure.canvas.draw_idle()
+
+ def home(self):
+ """Recall the first view and position from the stack."""
+ self.views[self.figure].home()
+ self.positions[self.figure].home()
+
+ def back(self):
+ """Back one step in the stack of views and positions."""
+ self.views[self.figure].back()
+ self.positions[self.figure].back()
+
+ def forward(self):
+ """Forward one step in the stack of views and positions."""
+ self.views[self.figure].forward()
+ self.positions[self.figure].forward()
+
+
+class ViewsPositionsBase(ToolBase):
+ """Base class for `ToolHome`, `ToolBack` and `ToolForward`."""
+
+ _on_trigger = None
+
+ def trigger(self, sender, event, data=None):
+ self.toolmanager.get_tool(_views_positions).add_figure(self.figure)
+ getattr(self.toolmanager.get_tool(_views_positions),
+ self._on_trigger)()
+ self.toolmanager.get_tool(_views_positions).update_view()
+
+
+class ToolHome(ViewsPositionsBase):
+ """Restore the original view limits."""
+
+ description = 'Reset original view'
+ image = 'home'
+ default_keymap = mpl.rcParams['keymap.home']
+ _on_trigger = 'home'
+
+
+class ToolBack(ViewsPositionsBase):
+ """Move back up the view limits stack."""
+
+ description = 'Back to previous view'
+ image = 'back'
+ default_keymap = mpl.rcParams['keymap.back']
+ _on_trigger = 'back'
+
+
+class ToolForward(ViewsPositionsBase):
+ """Move forward in the view lim stack."""
+
+ description = 'Forward to next view'
+ image = 'forward'
+ default_keymap = mpl.rcParams['keymap.forward']
+ _on_trigger = 'forward'
+
+
+class ConfigureSubplotsBase(ToolBase):
+ """Base tool for the configuration of subplots."""
+
+ description = 'Configure subplots'
+ image = 'subplots'
+
+
+class SaveFigureBase(ToolBase):
+ """Base tool for figure saving."""
+
+ description = 'Save the figure'
+ image = 'filesave'
+ default_keymap = mpl.rcParams['keymap.save']
+
+
+class ZoomPanBase(ToolToggleBase):
+ """Base class for `ToolZoom` and `ToolPan`."""
+ def __init__(self, *args):
+ super().__init__(*args)
+ self._button_pressed = None
+ self._xypress = None
+ self._idPress = None
+ self._idRelease = None
+ self._idScroll = None
+ self.base_scale = 2.
+ self.scrollthresh = .5 # .5 second scroll threshold
+ self.lastscroll = time.time()-self.scrollthresh
+
+ def enable(self, event):
+ """Connect press/release events and lock the canvas."""
+ self.figure.canvas.widgetlock(self)
+ self._idPress = self.figure.canvas.mpl_connect(
+ 'button_press_event', self._press)
+ self._idRelease = self.figure.canvas.mpl_connect(
+ 'button_release_event', self._release)
+ self._idScroll = self.figure.canvas.mpl_connect(
+ 'scroll_event', self.scroll_zoom)
+
+ def disable(self, event):
+ """Release the canvas and disconnect press/release events."""
+ self._cancel_action()
+ self.figure.canvas.widgetlock.release(self)
+ self.figure.canvas.mpl_disconnect(self._idPress)
+ self.figure.canvas.mpl_disconnect(self._idRelease)
+ self.figure.canvas.mpl_disconnect(self._idScroll)
+
+ def trigger(self, sender, event, data=None):
+ self.toolmanager.get_tool(_views_positions).add_figure(self.figure)
+ super().trigger(sender, event, data)
+ new_navigate_mode = self.name.upper() if self.toggled else None
+ for ax in self.figure.axes:
+ ax.set_navigate_mode(new_navigate_mode)
+
+ def scroll_zoom(self, event):
+ # https://gist.github.com/tacaswell/3144287
+ if event.inaxes is None:
+ return
+
+ if event.button == 'up':
+ # deal with zoom in
+ scl = self.base_scale
+ elif event.button == 'down':
+ # deal with zoom out
+ scl = 1/self.base_scale
+ else:
+ # deal with something that should never happen
+ scl = 1
+
+ ax = event.inaxes
+ ax._set_view_from_bbox([event.x, event.y, scl])
+
+ # If last scroll was done within the timing threshold, delete the
+ # previous view
+ if (time.time()-self.lastscroll) < self.scrollthresh:
+ self.toolmanager.get_tool(_views_positions).back()
+
+ self.figure.canvas.draw_idle() # force re-draw
+
+ self.lastscroll = time.time()
+ self.toolmanager.get_tool(_views_positions).push_current()
+
+
+class ToolZoom(ZoomPanBase):
+ """A Tool for zooming using a rectangle selector."""
+
+ description = 'Zoom to rectangle'
+ image = 'zoom_to_rect'
+ default_keymap = mpl.rcParams['keymap.zoom']
+ cursor = cursors.SELECT_REGION
+ radio_group = 'default'
+
+ def __init__(self, *args):
+ super().__init__(*args)
+ self._ids_zoom = []
+
+ def _cancel_action(self):
+ for zoom_id in self._ids_zoom:
+ self.figure.canvas.mpl_disconnect(zoom_id)
+ self.toolmanager.trigger_tool('rubberband', self)
+ self.toolmanager.get_tool(_views_positions)._refresh_locators()
+ self._xypress = None
+ self._button_pressed = None
+ self._ids_zoom = []
+ return
+
+ def _press(self, event):
+ """Callback for mouse button presses in zoom-to-rectangle mode."""
+
+ # If we're already in the middle of a zoom, pressing another
+ # button works to "cancel"
+ if self._ids_zoom:
+ self._cancel_action()
+
+ if event.button == 1:
+ self._button_pressed = 1
+ elif event.button == 3:
+ self._button_pressed = 3
+ else:
+ self._cancel_action()
+ return
+
+ x, y = event.x, event.y
+
+ self._xypress = []
+ for i, a in enumerate(self.figure.get_axes()):
+ if (x is not None and y is not None and a.in_axes(event) and
+ a.get_navigate() and a.can_zoom()):
+ self._xypress.append((x, y, a, i, a._get_view()))
+
+ id1 = self.figure.canvas.mpl_connect(
+ 'motion_notify_event', self._mouse_move)
+ id2 = self.figure.canvas.mpl_connect(
+ 'key_press_event', self._switch_on_zoom_mode)
+ id3 = self.figure.canvas.mpl_connect(
+ 'key_release_event', self._switch_off_zoom_mode)
+
+ self._ids_zoom = id1, id2, id3
+ self._zoom_mode = event.key
+
+ def _switch_on_zoom_mode(self, event):
+ self._zoom_mode = event.key
+ self._mouse_move(event)
+
+ def _switch_off_zoom_mode(self, event):
+ self._zoom_mode = None
+ self._mouse_move(event)
+
+ def _mouse_move(self, event):
+ """Callback for mouse moves in zoom-to-rectangle mode."""
+
+ if self._xypress:
+ x, y = event.x, event.y
+ lastx, lasty, a, ind, view = self._xypress[0]
+ (x1, y1), (x2, y2) = np.clip(
+ [[lastx, lasty], [x, y]], a.bbox.min, a.bbox.max)
+ if self._zoom_mode == "x":
+ y1, y2 = a.bbox.intervaly
+ elif self._zoom_mode == "y":
+ x1, x2 = a.bbox.intervalx
+ self.toolmanager.trigger_tool(
+ 'rubberband', self, data=(x1, y1, x2, y2))
+
+ def _release(self, event):
+ """Callback for mouse button releases in zoom-to-rectangle mode."""
+
+ for zoom_id in self._ids_zoom:
+ self.figure.canvas.mpl_disconnect(zoom_id)
+ self._ids_zoom = []
+
+ if not self._xypress:
+ self._cancel_action()
+ return
+
+ last_a = []
+
+ for cur_xypress in self._xypress:
+ x, y = event.x, event.y
+ lastx, lasty, a, _ind, view = cur_xypress
+ # ignore singular clicks - 5 pixels is a threshold
+ if abs(x - lastx) < 5 or abs(y - lasty) < 5:
+ self._cancel_action()
+ return
+
+ # detect twinx, twiny axes and avoid double zooming
+ twinx, twiny = False, False
+ if last_a:
+ for la in last_a:
+ if a.get_shared_x_axes().joined(a, la):
+ twinx = True
+ if a.get_shared_y_axes().joined(a, la):
+ twiny = True
+ last_a.append(a)
+
+ if self._button_pressed == 1:
+ direction = 'in'
+ elif self._button_pressed == 3:
+ direction = 'out'
+ else:
+ continue
+
+ a._set_view_from_bbox((lastx, lasty, x, y), direction,
+ self._zoom_mode, twinx, twiny)
+
+ self._zoom_mode = None
+ self.toolmanager.get_tool(_views_positions).push_current()
+ self._cancel_action()
+
+
+class ToolPan(ZoomPanBase):
+ """Pan axes with left mouse, zoom with right."""
+
+ default_keymap = mpl.rcParams['keymap.pan']
+ description = 'Pan axes with left mouse, zoom with right'
+ image = 'move'
+ cursor = cursors.MOVE
+ radio_group = 'default'
+
+ def __init__(self, *args):
+ super().__init__(*args)
+ self._id_drag = None
+
+ def _cancel_action(self):
+ self._button_pressed = None
+ self._xypress = []
+ self.figure.canvas.mpl_disconnect(self._id_drag)
+ self.toolmanager.messagelock.release(self)
+ self.toolmanager.get_tool(_views_positions)._refresh_locators()
+
+ def _press(self, event):
+ if event.button == 1:
+ self._button_pressed = 1
+ elif event.button == 3:
+ self._button_pressed = 3
+ else:
+ self._cancel_action()
+ return
+
+ x, y = event.x, event.y
+
+ self._xypress = []
+ for i, a in enumerate(self.figure.get_axes()):
+ if (x is not None and y is not None and a.in_axes(event) and
+ a.get_navigate() and a.can_pan()):
+ a.start_pan(x, y, event.button)
+ self._xypress.append((a, i))
+ self.toolmanager.messagelock(self)
+ self._id_drag = self.figure.canvas.mpl_connect(
+ 'motion_notify_event', self._mouse_move)
+
+ def _release(self, event):
+ if self._button_pressed is None:
+ self._cancel_action()
+ return
+
+ self.figure.canvas.mpl_disconnect(self._id_drag)
+ self.toolmanager.messagelock.release(self)
+
+ for a, _ind in self._xypress:
+ a.end_pan()
+ if not self._xypress:
+ self._cancel_action()
+ return
+
+ self.toolmanager.get_tool(_views_positions).push_current()
+ self._cancel_action()
+
+ def _mouse_move(self, event):
+ for a, _ind in self._xypress:
+ # safer to use the recorded button at the _press than current
+ # button: # multiple button can get pressed during motion...
+ a.drag_pan(self._button_pressed, event.key, event.x, event.y)
+ self.toolmanager.canvas.draw_idle()
+
+
+class ToolHelpBase(ToolBase):
+ description = 'Print tool list, shortcuts and description'
+ default_keymap = mpl.rcParams['keymap.help']
+ image = 'help'
+
+ @staticmethod
+ def format_shortcut(key_sequence):
+ """
+ Converts a shortcut string from the notation used in rc config to the
+ standard notation for displaying shortcuts, e.g. 'ctrl+a' -> 'Ctrl+A'.
+ """
+ return (key_sequence if len(key_sequence) == 1 else
+ re.sub(r"\+[A-Z]", r"+Shift\g<0>", key_sequence).title())
+
+ def _format_tool_keymap(self, name):
+ keymaps = self.toolmanager.get_tool_keymap(name)
+ return ", ".join(self.format_shortcut(keymap) for keymap in keymaps)
+
+ def _get_help_entries(self):
+ return [(name, self._format_tool_keymap(name), tool.description)
+ for name, tool in sorted(self.toolmanager.tools.items())
+ if tool.description]
+
+ def _get_help_text(self):
+ entries = self._get_help_entries()
+ entries = ["{}: {}\n\t{}".format(*entry) for entry in entries]
+ return "\n".join(entries)
+
+ def _get_help_html(self):
+ fmt = "{} {} {} "
+ rows = [fmt.format(
+ "Action ", "Shortcuts ", "Description ")]
+ rows += [fmt.format(*row) for row in self._get_help_entries()]
+ return (""
+ "" + rows[0] + " "
+ "".join(rows[1:]) + "
")
+
+
+class ToolCopyToClipboardBase(ToolBase):
+ """Tool to copy the figure to the clipboard."""
+
+ description = 'Copy the canvas figure to clipboard'
+ default_keymap = mpl.rcParams['keymap.copy']
+
+ def trigger(self, *args, **kwargs):
+ message = "Copy tool is not available"
+ self.toolmanager.message_event(message, self)
+
+
+default_tools = {'home': ToolHome, 'back': ToolBack, 'forward': ToolForward,
+ 'zoom': ToolZoom, 'pan': ToolPan,
+ 'subplots': 'ToolConfigureSubplots',
+ 'save': 'ToolSaveFigure',
+ 'grid': ToolGrid,
+ 'grid_minor': ToolMinorGrid,
+ 'fullscreen': ToolFullScreen,
+ 'quit': ToolQuit,
+ 'quit_all': ToolQuitAll,
+ 'allnav': _ToolEnableAllNavigation,
+ 'nav': _ToolEnableNavigation,
+ 'xscale': ToolXScale,
+ 'yscale': ToolYScale,
+ 'position': ToolCursorPosition,
+ _views_positions: ToolViewsPositions,
+ 'cursor': 'ToolSetCursor',
+ 'rubberband': 'ToolRubberband',
+ 'help': 'ToolHelp',
+ 'copy': 'ToolCopyToClipboard',
+ }
+"""Default tools"""
+
+default_toolbar_tools = [['navigation', ['home', 'back', 'forward']],
+ ['zoompan', ['pan', 'zoom', 'subplots']],
+ ['io', ['save', 'help']]]
+"""Default tools in the toolbar"""
+
+
+def add_tools_to_manager(toolmanager, tools=default_tools):
+ """
+ Add multiple tools to a `.ToolManager`.
+
+ Parameters
+ ----------
+ toolmanager : `.backend_managers.ToolManager`
+ Manager to which the tools are added.
+ tools : {str: class_like}, optional
+ The tools to add in a {name: tool} dict, see `add_tool` for more
+ info.
+ """
+
+ for name, tool in tools.items():
+ toolmanager.add_tool(name, tool)
+
+
+def add_tools_to_container(container, tools=default_toolbar_tools):
+ """
+ Add multiple tools to the container.
+
+ Parameters
+ ----------
+ container : Container
+ `backend_bases.ToolContainerBase` object that will get the tools added.
+ tools : list, optional
+ List in the form ``[[group1, [tool1, tool2 ...]], [group2, [...]]]``
+ where the tools ``[tool1, tool2, ...]`` will display in group1.
+ See `add_tool` for details.
+ """
+
+ for group, grouptools in tools:
+ for position, tool in enumerate(grouptools):
+ container.add_tool(tool, group, position)
diff --git a/venv/Lib/site-packages/matplotlib/backends/__init__.py b/venv/Lib/site-packages/matplotlib/backends/__init__.py
new file mode 100644
index 0000000..6f4015d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/__init__.py
@@ -0,0 +1,2 @@
+# NOTE: plt.switch_backend() (called at import time) will add a "backend"
+# attribute here for backcompat.
diff --git a/venv/Lib/site-packages/matplotlib/backends/_backend_agg.cp38-win_amd64.pyd b/venv/Lib/site-packages/matplotlib/backends/_backend_agg.cp38-win_amd64.pyd
new file mode 100644
index 0000000..c9db50d
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/backends/_backend_agg.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/matplotlib/backends/_backend_pdf_ps.py b/venv/Lib/site-packages/matplotlib/backends/_backend_pdf_ps.py
new file mode 100644
index 0000000..6c4f129
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/_backend_pdf_ps.py
@@ -0,0 +1,128 @@
+"""
+Common functionality between the PDF and PS backends.
+"""
+
+import functools
+
+import matplotlib as mpl
+from matplotlib import _api
+from .. import font_manager, ft2font
+from ..afm import AFM
+from ..backend_bases import RendererBase
+
+
+@functools.lru_cache(50)
+def _cached_get_afm_from_fname(fname):
+ with open(fname, "rb") as fh:
+ return AFM(fh)
+
+
+class CharacterTracker:
+ """
+ Helper for font subsetting by the pdf and ps backends.
+
+ Maintains a mapping of font paths to the set of character codepoints that
+ are being used from that font.
+ """
+
+ def __init__(self):
+ self.used = {}
+
+ @_api.deprecated("3.3")
+ @property
+ def used_characters(self):
+ d = {}
+ for fname, chars in self.used.items():
+ realpath, stat_key = mpl.cbook.get_realpath_and_stat(fname)
+ d[stat_key] = (realpath, chars)
+ return d
+
+ def track(self, font, s):
+ """Record that string *s* is being typeset using font *font*."""
+ if isinstance(font, str):
+ # Unused, can be removed after removal of track_characters.
+ fname = font
+ else:
+ fname = font.fname
+ self.used.setdefault(fname, set()).update(map(ord, s))
+
+ # Not public, can be removed when pdf/ps merge_used_characters is removed.
+ def merge(self, other):
+ """Update self with a font path to character codepoints."""
+ for fname, charset in other.items():
+ self.used.setdefault(fname, set()).update(charset)
+
+
+class RendererPDFPSBase(RendererBase):
+ # The following attributes must be defined by the subclasses:
+ # - _afm_font_dir
+ # - _use_afm_rc_name
+
+ def __init__(self, width, height):
+ super().__init__()
+ self.width = width
+ self.height = height
+
+ def flipy(self):
+ # docstring inherited
+ return False # y increases from bottom to top.
+
+ def option_scale_image(self):
+ # docstring inherited
+ return True # PDF and PS support arbitrary image scaling.
+
+ def option_image_nocomposite(self):
+ # docstring inherited
+ # Decide whether to composite image based on rcParam value.
+ return not mpl.rcParams["image.composite_image"]
+
+ def get_canvas_width_height(self):
+ # docstring inherited
+ return self.width * 72.0, self.height * 72.0
+
+ def get_text_width_height_descent(self, s, prop, ismath):
+ # docstring inherited
+ if ismath == "TeX":
+ texmanager = self.get_texmanager()
+ fontsize = prop.get_size_in_points()
+ w, h, d = texmanager.get_text_width_height_descent(
+ s, fontsize, renderer=self)
+ return w, h, d
+ elif ismath:
+ # Circular import.
+ from matplotlib.backends.backend_ps import RendererPS
+ parse = self._text2path.mathtext_parser.parse(
+ s, 72, prop,
+ _force_standard_ps_fonts=(isinstance(self, RendererPS)
+ and mpl.rcParams["ps.useafm"]))
+ return parse.width, parse.height, parse.depth
+ elif mpl.rcParams[self._use_afm_rc_name]:
+ font = self._get_font_afm(prop)
+ l, b, w, h, d = font.get_str_bbox_and_descent(s)
+ scale = prop.get_size_in_points() / 1000
+ w *= scale
+ h *= scale
+ d *= scale
+ return w, h, d
+ else:
+ font = self._get_font_ttf(prop)
+ font.set_text(s, 0.0, flags=ft2font.LOAD_NO_HINTING)
+ w, h = font.get_width_height()
+ d = font.get_descent()
+ scale = 1 / 64
+ w *= scale
+ h *= scale
+ d *= scale
+ return w, h, d
+
+ def _get_font_afm(self, prop):
+ fname = font_manager.findfont(
+ prop, fontext="afm", directory=self._afm_font_dir)
+ return _cached_get_afm_from_fname(fname)
+
+ def _get_font_ttf(self, prop):
+ fname = font_manager.findfont(prop)
+ font = font_manager.get_font(fname)
+ font.clear()
+ font.set_size(prop.get_size_in_points(), 72)
+ return font
diff --git a/venv/Lib/site-packages/matplotlib/backends/_backend_tk.py b/venv/Lib/site-packages/matplotlib/backends/_backend_tk.py
new file mode 100644
index 0000000..adf0a9d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/_backend_tk.py
@@ -0,0 +1,918 @@
+import uuid
+from contextlib import contextmanager
+import logging
+import math
+import os.path
+import sys
+import tkinter as tk
+from tkinter.simpledialog import SimpleDialog
+import tkinter.filedialog
+import tkinter.messagebox
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib import _api, backend_tools, cbook, _c_internal_utils
+from matplotlib.backend_bases import (
+ _Backend, FigureCanvasBase, FigureManagerBase, NavigationToolbar2,
+ StatusbarBase, TimerBase, ToolContainerBase, cursors, _Mode)
+from matplotlib._pylab_helpers import Gcf
+from matplotlib.figure import Figure
+from matplotlib.widgets import SubplotTool
+from . import _tkagg
+
+
+_log = logging.getLogger(__name__)
+
+backend_version = tk.TkVersion
+
+cursord = {
+ cursors.MOVE: "fleur",
+ cursors.HAND: "hand2",
+ cursors.POINTER: "arrow",
+ cursors.SELECT_REGION: "tcross",
+ cursors.WAIT: "watch",
+ }
+
+
+@contextmanager
+def _restore_foreground_window_at_end():
+ foreground = _c_internal_utils.Win32_GetForegroundWindow()
+ try:
+ yield
+ finally:
+ if mpl.rcParams['tk.window_focus']:
+ _c_internal_utils.Win32_SetForegroundWindow(foreground)
+
+
+_blit_args = {}
+# Initialize to a non-empty string that is not a Tcl command
+_blit_tcl_name = "mpl_blit_" + uuid.uuid4().hex
+
+
+def _blit(argsid):
+ """
+ Thin wrapper to blit called via tkapp.call.
+
+ *argsid* is a unique string identifier to fetch the correct arguments from
+ the ``_blit_args`` dict, since arguments cannot be passed directly.
+
+ photoimage blanking must occur in the same event and thread as blitting
+ to avoid flickering.
+ """
+ photoimage, dataptr, offsets, bboxptr, blank = _blit_args.pop(argsid)
+ if blank:
+ photoimage.blank()
+ _tkagg.blit(
+ photoimage.tk.interpaddr(), str(photoimage), dataptr, offsets, bboxptr)
+
+
+def blit(photoimage, aggimage, offsets, bbox=None):
+ """
+ Blit *aggimage* to *photoimage*.
+
+ *offsets* is a tuple describing how to fill the ``offset`` field of the
+ ``Tk_PhotoImageBlock`` struct: it should be (0, 1, 2, 3) for RGBA8888 data,
+ (2, 1, 0, 3) for little-endian ARBG32 (i.e. GBRA8888) data and (1, 2, 3, 0)
+ for big-endian ARGB32 (i.e. ARGB8888) data.
+
+ If *bbox* is passed, it defines the region that gets blitted. That region
+ will NOT be blanked before blitting.
+
+ Tcl events must be dispatched to trigger a blit from a non-Tcl thread.
+ """
+ data = np.asarray(aggimage)
+ height, width = data.shape[:2]
+ dataptr = (height, width, data.ctypes.data)
+ if bbox is not None:
+ (x1, y1), (x2, y2) = bbox.__array__()
+ x1 = max(math.floor(x1), 0)
+ x2 = min(math.ceil(x2), width)
+ y1 = max(math.floor(y1), 0)
+ y2 = min(math.ceil(y2), height)
+ bboxptr = (x1, x2, y1, y2)
+ blank = False
+ else:
+ bboxptr = (0, width, 0, height)
+ blank = True
+
+ # NOTE: _tkagg.blit is thread unsafe and will crash the process if called
+ # from a thread (GH#13293). Instead of blanking and blitting here,
+ # use tkapp.call to post a cross-thread event if this function is called
+ # from a non-Tcl thread.
+
+ # tkapp.call coerces all arguments to strings, so to avoid string parsing
+ # within _blit, pack up the arguments into a global data structure.
+ args = photoimage, dataptr, offsets, bboxptr, blank
+ # Need a unique key to avoid thread races.
+ # Again, make the key a string to avoid string parsing in _blit.
+ argsid = str(id(args))
+ _blit_args[argsid] = args
+
+ try:
+ photoimage.tk.call(_blit_tcl_name, argsid)
+ except tk.TclError as e:
+ if "invalid command name" not in str(e):
+ raise
+ photoimage.tk.createcommand(_blit_tcl_name, _blit)
+ photoimage.tk.call(_blit_tcl_name, argsid)
+
+
+class TimerTk(TimerBase):
+ """Subclass of `backend_bases.TimerBase` using Tk timer events."""
+
+ def __init__(self, parent, *args, **kwargs):
+ self._timer = None
+ super().__init__(*args, **kwargs)
+ self.parent = parent
+
+ def _timer_start(self):
+ self._timer_stop()
+ self._timer = self.parent.after(self._interval, self._on_timer)
+
+ def _timer_stop(self):
+ if self._timer is not None:
+ self.parent.after_cancel(self._timer)
+ self._timer = None
+
+ def _on_timer(self):
+ super()._on_timer()
+ # Tk after() is only a single shot, so we need to add code here to
+ # reset the timer if we're not operating in single shot mode. However,
+ # if _timer is None, this means that _timer_stop has been called; so
+ # don't recreate the timer in that case.
+ if not self._single and self._timer:
+ if self._interval > 0:
+ self._timer = self.parent.after(self._interval, self._on_timer)
+ else:
+ # Edge case: Tcl after 0 *prepends* events to the queue
+ # so a 0 interval does not allow any other events to run.
+ # This incantation is cancellable and runs as fast as possible
+ # while also allowing events and drawing every frame. GH#18236
+ self._timer = self.parent.after_idle(
+ lambda: self.parent.after(self._interval, self._on_timer)
+ )
+ else:
+ self._timer = None
+
+
+class FigureCanvasTk(FigureCanvasBase):
+ required_interactive_framework = "tk"
+
+ @_api.delete_parameter(
+ "3.4", "resize_callback",
+ alternative="get_tk_widget().bind('', ..., True)")
+ def __init__(self, figure=None, master=None, resize_callback=None):
+ super().__init__(figure)
+ self._idle = True
+ self._idle_callback = None
+ self._event_loop_id = None
+ w, h = self.figure.bbox.size.astype(int)
+ self._tkcanvas = tk.Canvas(
+ master=master, background="white",
+ width=w, height=h, borderwidth=0, highlightthickness=0)
+ self._tkphoto = tk.PhotoImage(
+ master=self._tkcanvas, width=w, height=h)
+ self._tkcanvas.create_image(w//2, h//2, image=self._tkphoto)
+ self._resize_callback = resize_callback
+ self._tkcanvas.bind("", self.resize)
+ self._tkcanvas.bind("", self.key_press)
+ self._tkcanvas.bind("", self.motion_notify_event)
+ self._tkcanvas.bind("", self.enter_notify_event)
+ self._tkcanvas.bind("", self.leave_notify_event)
+ self._tkcanvas.bind("", self.key_release)
+ for name in ["", "", ""]:
+ self._tkcanvas.bind(name, self.button_press_event)
+ for name in [
+ "", "", ""]:
+ self._tkcanvas.bind(name, self.button_dblclick_event)
+ for name in [
+ "", "", ""]:
+ self._tkcanvas.bind(name, self.button_release_event)
+
+ # Mouse wheel on Linux generates button 4/5 events
+ for name in "", "":
+ self._tkcanvas.bind(name, self.scroll_event)
+ # Mouse wheel for windows goes to the window with the focus.
+ # Since the canvas won't usually have the focus, bind the
+ # event to the window containing the canvas instead.
+ # See http://wiki.tcl.tk/3893 (mousewheel) for details
+ root = self._tkcanvas.winfo_toplevel()
+ root.bind("", self.scroll_event_windows, "+")
+
+ # Can't get destroy events by binding to _tkcanvas. Therefore, bind
+ # to the window and filter.
+ def filter_destroy(event):
+ if event.widget is self._tkcanvas:
+ self.close_event()
+ root.bind("", filter_destroy, "+")
+
+ self._master = master
+ self._tkcanvas.focus_set()
+
+ def resize(self, event):
+ width, height = event.width, event.height
+ if self._resize_callback is not None:
+ self._resize_callback(event)
+
+ # compute desired figure size in inches
+ dpival = self.figure.dpi
+ winch = width / dpival
+ hinch = height / dpival
+ self.figure.set_size_inches(winch, hinch, forward=False)
+
+ self._tkcanvas.delete(self._tkphoto)
+ self._tkphoto = tk.PhotoImage(
+ master=self._tkcanvas, width=int(width), height=int(height))
+ self._tkcanvas.create_image(
+ int(width / 2), int(height / 2), image=self._tkphoto)
+ self.resize_event()
+
+ def draw_idle(self):
+ # docstring inherited
+ if not self._idle:
+ return
+
+ self._idle = False
+
+ def idle_draw(*args):
+ try:
+ self.draw()
+ finally:
+ self._idle = True
+
+ self._idle_callback = self._tkcanvas.after_idle(idle_draw)
+
+ def get_tk_widget(self):
+ """
+ Return the Tk widget used to implement FigureCanvasTkAgg.
+
+ Although the initial implementation uses a Tk canvas, this routine
+ is intended to hide that fact.
+ """
+ return self._tkcanvas
+
+ def motion_notify_event(self, event):
+ x = event.x
+ # flipy so y=0 is bottom of canvas
+ y = self.figure.bbox.height - event.y
+ super().motion_notify_event(x, y, guiEvent=event)
+
+ def enter_notify_event(self, event):
+ x = event.x
+ # flipy so y=0 is bottom of canvas
+ y = self.figure.bbox.height - event.y
+ super().enter_notify_event(guiEvent=event, xy=(x, y))
+
+ def button_press_event(self, event, dblclick=False):
+ x = event.x
+ # flipy so y=0 is bottom of canvas
+ y = self.figure.bbox.height - event.y
+ num = getattr(event, 'num', None)
+
+ if sys.platform == 'darwin':
+ # 2 and 3 were reversed on the OSX platform I tested under tkagg.
+ if num == 2:
+ num = 3
+ elif num == 3:
+ num = 2
+
+ super().button_press_event(x, y, num,
+ dblclick=dblclick, guiEvent=event)
+
+ def button_dblclick_event(self, event):
+ self.button_press_event(event, dblclick=True)
+
+ def button_release_event(self, event):
+ x = event.x
+ # flipy so y=0 is bottom of canvas
+ y = self.figure.bbox.height - event.y
+
+ num = getattr(event, 'num', None)
+
+ if sys.platform == 'darwin':
+ # 2 and 3 were reversed on the OSX platform I tested under tkagg.
+ if num == 2:
+ num = 3
+ elif num == 3:
+ num = 2
+
+ super().button_release_event(x, y, num, guiEvent=event)
+
+ def scroll_event(self, event):
+ x = event.x
+ y = self.figure.bbox.height - event.y
+ num = getattr(event, 'num', None)
+ step = 1 if num == 4 else -1 if num == 5 else 0
+ super().scroll_event(x, y, step, guiEvent=event)
+
+ def scroll_event_windows(self, event):
+ """MouseWheel event processor"""
+ # need to find the window that contains the mouse
+ w = event.widget.winfo_containing(event.x_root, event.y_root)
+ if w == self._tkcanvas:
+ x = event.x_root - w.winfo_rootx()
+ y = event.y_root - w.winfo_rooty()
+ y = self.figure.bbox.height - y
+ step = event.delta/120.
+ FigureCanvasBase.scroll_event(self, x, y, step, guiEvent=event)
+
+ def _get_key(self, event):
+ unikey = event.char
+ key = cbook._unikey_or_keysym_to_mplkey(unikey, event.keysym)
+
+ # add modifier keys to the key string. Bit details originate from
+ # http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm
+ # BIT_SHIFT = 0x001; BIT_CAPSLOCK = 0x002; BIT_CONTROL = 0x004;
+ # BIT_LEFT_ALT = 0x008; BIT_NUMLOCK = 0x010; BIT_RIGHT_ALT = 0x080;
+ # BIT_MB_1 = 0x100; BIT_MB_2 = 0x200; BIT_MB_3 = 0x400;
+ # In general, the modifier key is excluded from the modifier flag,
+ # however this is not the case on "darwin", so double check that
+ # we aren't adding repeat modifier flags to a modifier key.
+ if sys.platform == 'win32':
+ modifiers = [(2, 'ctrl', 'control'),
+ (17, 'alt', 'alt'),
+ (0, 'shift', 'shift'),
+ ]
+ elif sys.platform == 'darwin':
+ modifiers = [(2, 'ctrl', 'control'),
+ (4, 'alt', 'alt'),
+ (0, 'shift', 'shift'),
+ (3, 'super', 'super'),
+ ]
+ else:
+ modifiers = [(2, 'ctrl', 'control'),
+ (3, 'alt', 'alt'),
+ (0, 'shift', 'shift'),
+ (6, 'super', 'super'),
+ ]
+
+ if key is not None:
+ # shift is not added to the keys as this is already accounted for
+ for bitmask, prefix, key_name in modifiers:
+ if event.state & (1 << bitmask) and key_name not in key:
+ if not (prefix == 'shift' and unikey):
+ key = '{0}+{1}'.format(prefix, key)
+
+ return key
+
+ def key_press(self, event):
+ key = self._get_key(event)
+ FigureCanvasBase.key_press_event(self, key, guiEvent=event)
+
+ def key_release(self, event):
+ key = self._get_key(event)
+ FigureCanvasBase.key_release_event(self, key, guiEvent=event)
+
+ def new_timer(self, *args, **kwargs):
+ # docstring inherited
+ return TimerTk(self._tkcanvas, *args, **kwargs)
+
+ def flush_events(self):
+ # docstring inherited
+ self._master.update()
+
+ def start_event_loop(self, timeout=0):
+ # docstring inherited
+ if timeout > 0:
+ milliseconds = int(1000 * timeout)
+ if milliseconds > 0:
+ self._event_loop_id = self._tkcanvas.after(
+ milliseconds, self.stop_event_loop)
+ else:
+ self._event_loop_id = self._tkcanvas.after_idle(
+ self.stop_event_loop)
+ self._master.mainloop()
+
+ def stop_event_loop(self):
+ # docstring inherited
+ if self._event_loop_id:
+ self._master.after_cancel(self._event_loop_id)
+ self._event_loop_id = None
+ self._master.quit()
+
+
+class FigureManagerTk(FigureManagerBase):
+ """
+ Attributes
+ ----------
+ canvas : `FigureCanvas`
+ The FigureCanvas instance
+ num : int or str
+ The Figure number
+ toolbar : tk.Toolbar
+ The tk.Toolbar
+ window : tk.Window
+ The tk.Window
+ """
+
+ _owns_mainloop = False
+
+ def __init__(self, canvas, num, window):
+ self.window = window
+ super().__init__(canvas, num)
+ self.window.withdraw()
+ # packing toolbar first, because if space is getting low, last packed
+ # widget is getting shrunk first (-> the canvas)
+ self.toolbar = self._get_toolbar()
+ self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1)
+
+ if self.toolmanager:
+ backend_tools.add_tools_to_manager(self.toolmanager)
+ if self.toolbar:
+ backend_tools.add_tools_to_container(self.toolbar)
+
+ self._shown = False
+
+ def _get_toolbar(self):
+ if mpl.rcParams['toolbar'] == 'toolbar2':
+ toolbar = NavigationToolbar2Tk(self.canvas, self.window)
+ elif mpl.rcParams['toolbar'] == 'toolmanager':
+ toolbar = ToolbarTk(self.toolmanager, self.window)
+ else:
+ toolbar = None
+ return toolbar
+
+ def resize(self, width, height):
+ max_size = 1_400_000 # the measured max on xorg 1.20.8 was 1_409_023
+
+ if (width > max_size or height > max_size) and sys.platform == 'linux':
+ raise ValueError(
+ 'You have requested to resize the '
+ f'Tk window to ({width}, {height}), one of which '
+ f'is bigger than {max_size}. At larger sizes xorg will '
+ 'either exit with an error on newer versions (~1.20) or '
+ 'cause corruption on older version (~1.19). We '
+ 'do not expect a window over a million pixel wide or tall '
+ 'to be intended behavior.')
+ self.canvas._tkcanvas.configure(width=width, height=height)
+
+ def show(self):
+ with _restore_foreground_window_at_end():
+ if not self._shown:
+ def destroy(*args):
+ Gcf.destroy(self)
+ self.window.protocol("WM_DELETE_WINDOW", destroy)
+ self.window.deiconify()
+ else:
+ self.canvas.draw_idle()
+ if mpl.rcParams['figure.raise_window']:
+ self.canvas.manager.window.attributes('-topmost', 1)
+ self.canvas.manager.window.attributes('-topmost', 0)
+ self._shown = True
+
+ def destroy(self, *args):
+ if self.canvas._idle_callback:
+ self.canvas._tkcanvas.after_cancel(self.canvas._idle_callback)
+ if self.canvas._event_loop_id:
+ self.canvas._tkcanvas.after_cancel(self.canvas._event_loop_id)
+
+ # NOTE: events need to be flushed before issuing destroy (GH #9956),
+ # however, self.window.update() can break user code. This is the
+ # safest way to achieve a complete draining of the event queue,
+ # but it may require users to update() on their own to execute the
+ # completion in obscure corner cases.
+ def delayed_destroy():
+ self.window.destroy()
+
+ if self._owns_mainloop and not Gcf.get_num_fig_managers():
+ self.window.quit()
+
+ # "after idle after 0" avoids Tcl error/race (GH #19940)
+ self.window.after_idle(self.window.after, 0, delayed_destroy)
+
+ def get_window_title(self):
+ return self.window.wm_title()
+
+ def set_window_title(self, title):
+ self.window.wm_title(title)
+
+ def full_screen_toggle(self):
+ is_fullscreen = bool(self.window.attributes('-fullscreen'))
+ self.window.attributes('-fullscreen', not is_fullscreen)
+
+
+class NavigationToolbar2Tk(NavigationToolbar2, tk.Frame):
+ """
+ Attributes
+ ----------
+ canvas : `FigureCanvas`
+ The figure canvas on which to operate.
+ win : tk.Window
+ The tk.Window which owns this toolbar.
+ pack_toolbar : bool, default: True
+ If True, add the toolbar to the parent's pack manager's packing list
+ during initialization with ``side='bottom'`` and ``fill='x'``.
+ If you want to use the toolbar with a different layout manager, use
+ ``pack_toolbar=False``.
+ """
+ def __init__(self, canvas, window, *, pack_toolbar=True):
+ # Avoid using self.window (prefer self.canvas.get_tk_widget().master),
+ # so that Tool implementations can reuse the methods.
+ self.window = window
+
+ tk.Frame.__init__(self, master=window, borderwidth=2,
+ width=int(canvas.figure.bbox.width), height=50)
+
+ self._buttons = {}
+ for text, tooltip_text, image_file, callback in self.toolitems:
+ if text is None:
+ # Add a spacer; return value is unused.
+ self._Spacer()
+ else:
+ self._buttons[text] = button = self._Button(
+ text,
+ str(cbook._get_data_path(f"images/{image_file}.png")),
+ toggle=callback in ["zoom", "pan"],
+ command=getattr(self, callback),
+ )
+ if tooltip_text is not None:
+ ToolTip.createToolTip(button, tooltip_text)
+
+ # This filler item ensures the toolbar is always at least two text
+ # lines high. Otherwise the canvas gets redrawn as the mouse hovers
+ # over images because those use two-line messages which resize the
+ # toolbar.
+ label = tk.Label(master=self,
+ text='\N{NO-BREAK SPACE}\n\N{NO-BREAK SPACE}')
+ label.pack(side=tk.RIGHT)
+
+ self.message = tk.StringVar(master=self)
+ self._message_label = tk.Label(master=self, textvariable=self.message)
+ self._message_label.pack(side=tk.RIGHT)
+
+ NavigationToolbar2.__init__(self, canvas)
+ if pack_toolbar:
+ self.pack(side=tk.BOTTOM, fill=tk.X)
+
+ def _update_buttons_checked(self):
+ # sync button checkstates to match active mode
+ for text, mode in [('Zoom', _Mode.ZOOM), ('Pan', _Mode.PAN)]:
+ if text in self._buttons:
+ if self.mode == mode:
+ self._buttons[text].select() # NOT .invoke()
+ else:
+ self._buttons[text].deselect()
+
+ def pan(self, *args):
+ super().pan(*args)
+ self._update_buttons_checked()
+
+ def zoom(self, *args):
+ super().zoom(*args)
+ self._update_buttons_checked()
+
+ def set_message(self, s):
+ self.message.set(s)
+
+ def draw_rubberband(self, event, x0, y0, x1, y1):
+ height = self.canvas.figure.bbox.height
+ y0 = height - y0
+ y1 = height - y1
+ if hasattr(self, "lastrect"):
+ self.canvas._tkcanvas.delete(self.lastrect)
+ self.lastrect = self.canvas._tkcanvas.create_rectangle(x0, y0, x1, y1)
+
+ def release_zoom(self, event):
+ super().release_zoom(event)
+ if hasattr(self, "lastrect"):
+ self.canvas._tkcanvas.delete(self.lastrect)
+ del self.lastrect
+
+ def set_cursor(self, cursor):
+ window = self.canvas.get_tk_widget().master
+ try:
+ window.configure(cursor=cursord[cursor])
+ except tkinter.TclError:
+ pass
+
+ def _Button(self, text, image_file, toggle, command):
+ if tk.TkVersion >= 8.6:
+ PhotoImage = tk.PhotoImage
+ else:
+ from PIL.ImageTk import PhotoImage
+ image = (PhotoImage(master=self, file=image_file)
+ if image_file is not None else None)
+ if not toggle:
+ b = tk.Button(master=self, text=text, image=image, command=command)
+ else:
+ # There is a bug in tkinter included in some python 3.6 versions
+ # that without this variable, produces a "visual" toggling of
+ # other near checkbuttons
+ # https://bugs.python.org/issue29402
+ # https://bugs.python.org/issue25684
+ var = tk.IntVar(master=self)
+ b = tk.Checkbutton(
+ master=self, text=text, image=image, command=command,
+ indicatoron=False, variable=var)
+ b.var = var
+ b._ntimage = image
+ b.pack(side=tk.LEFT)
+ return b
+
+ def _Spacer(self):
+ # Buttons are 30px high. Make this 26px tall +2px padding to center it.
+ s = tk.Frame(
+ master=self, height=26, relief=tk.RIDGE, pady=2, bg="DarkGray")
+ s.pack(side=tk.LEFT, padx=5)
+ return s
+
+ def save_figure(self, *args):
+ filetypes = self.canvas.get_supported_filetypes().copy()
+ default_filetype = self.canvas.get_default_filetype()
+
+ # Tk doesn't provide a way to choose a default filetype,
+ # so we just have to put it first
+ default_filetype_name = filetypes.pop(default_filetype)
+ sorted_filetypes = ([(default_filetype, default_filetype_name)]
+ + sorted(filetypes.items()))
+ tk_filetypes = [(name, '*.%s' % ext) for ext, name in sorted_filetypes]
+
+ # adding a default extension seems to break the
+ # asksaveasfilename dialog when you choose various save types
+ # from the dropdown. Passing in the empty string seems to
+ # work - JDH!
+ #defaultextension = self.canvas.get_default_filetype()
+ defaultextension = ''
+ initialdir = os.path.expanduser(mpl.rcParams['savefig.directory'])
+ initialfile = self.canvas.get_default_filename()
+ fname = tkinter.filedialog.asksaveasfilename(
+ master=self.canvas.get_tk_widget().master,
+ title='Save the figure',
+ filetypes=tk_filetypes,
+ defaultextension=defaultextension,
+ initialdir=initialdir,
+ initialfile=initialfile,
+ )
+
+ if fname in ["", ()]:
+ return
+ # Save dir for next time, unless empty str (i.e., use cwd).
+ if initialdir != "":
+ mpl.rcParams['savefig.directory'] = (
+ os.path.dirname(str(fname)))
+ try:
+ # This method will handle the delegation to the correct type
+ self.canvas.figure.savefig(fname)
+ except Exception as e:
+ tkinter.messagebox.showerror("Error saving file", str(e))
+
+ def set_history_buttons(self):
+ state_map = {True: tk.NORMAL, False: tk.DISABLED}
+ can_back = self._nav_stack._pos > 0
+ can_forward = self._nav_stack._pos < len(self._nav_stack._elements) - 1
+
+ if "Back" in self._buttons:
+ self._buttons['Back']['state'] = state_map[can_back]
+
+ if "Forward" in self._buttons:
+ self._buttons['Forward']['state'] = state_map[can_forward]
+
+
+class ToolTip:
+ """
+ Tooltip recipe from
+ http://www.voidspace.org.uk/python/weblog/arch_d7_2006_07_01.shtml#e387
+ """
+ @staticmethod
+ def createToolTip(widget, text):
+ toolTip = ToolTip(widget)
+ def enter(event):
+ toolTip.showtip(text)
+ def leave(event):
+ toolTip.hidetip()
+ widget.bind('', enter)
+ widget.bind('', leave)
+
+ def __init__(self, widget):
+ self.widget = widget
+ self.tipwindow = None
+ self.id = None
+ self.x = self.y = 0
+
+ def showtip(self, text):
+ """Display text in tooltip window."""
+ self.text = text
+ if self.tipwindow or not self.text:
+ return
+ x, y, _, _ = self.widget.bbox("insert")
+ x = x + self.widget.winfo_rootx() + 27
+ y = y + self.widget.winfo_rooty()
+ self.tipwindow = tw = tk.Toplevel(self.widget)
+ tw.wm_overrideredirect(1)
+ tw.wm_geometry("+%d+%d" % (x, y))
+ try:
+ # For Mac OS
+ tw.tk.call("::tk::unsupported::MacWindowStyle",
+ "style", tw._w,
+ "help", "noActivates")
+ except tk.TclError:
+ pass
+ label = tk.Label(tw, text=self.text, justify=tk.LEFT,
+ relief=tk.SOLID, borderwidth=1)
+ label.pack(ipadx=1)
+
+ def hidetip(self):
+ tw = self.tipwindow
+ self.tipwindow = None
+ if tw:
+ tw.destroy()
+
+
+class RubberbandTk(backend_tools.RubberbandBase):
+ def draw_rubberband(self, x0, y0, x1, y1):
+ height = self.figure.canvas.figure.bbox.height
+ y0 = height - y0
+ y1 = height - y1
+ if hasattr(self, "lastrect"):
+ self.figure.canvas._tkcanvas.delete(self.lastrect)
+ self.lastrect = self.figure.canvas._tkcanvas.create_rectangle(
+ x0, y0, x1, y1)
+
+ def remove_rubberband(self):
+ if hasattr(self, "lastrect"):
+ self.figure.canvas._tkcanvas.delete(self.lastrect)
+ del self.lastrect
+
+
+class SetCursorTk(backend_tools.SetCursorBase):
+ def set_cursor(self, cursor):
+ NavigationToolbar2Tk.set_cursor(
+ self._make_classic_style_pseudo_toolbar(), cursor)
+
+
+class ToolbarTk(ToolContainerBase, tk.Frame):
+ def __init__(self, toolmanager, window):
+ ToolContainerBase.__init__(self, toolmanager)
+ xmin, xmax = self.toolmanager.canvas.figure.bbox.intervalx
+ height, width = 50, xmax - xmin
+ tk.Frame.__init__(self, master=window,
+ width=int(width), height=int(height),
+ borderwidth=2)
+ self._message = tk.StringVar(master=self)
+ self._message_label = tk.Label(master=self, textvariable=self._message)
+ self._message_label.pack(side=tk.RIGHT)
+ self._toolitems = {}
+ self.pack(side=tk.TOP, fill=tk.X)
+ self._groups = {}
+
+ def add_toolitem(
+ self, name, group, position, image_file, description, toggle):
+ frame = self._get_groupframe(group)
+ button = NavigationToolbar2Tk._Button(self, name, image_file, toggle,
+ lambda: self._button_click(name))
+ if description is not None:
+ ToolTip.createToolTip(button, description)
+ self._toolitems.setdefault(name, [])
+ self._toolitems[name].append(button)
+
+ def _get_groupframe(self, group):
+ if group not in self._groups:
+ if self._groups:
+ self._add_separator()
+ frame = tk.Frame(master=self, borderwidth=0)
+ frame.pack(side=tk.LEFT, fill=tk.Y)
+ self._groups[group] = frame
+ return self._groups[group]
+
+ def _add_separator(self):
+ return NavigationToolbar2Tk._Spacer(self)
+
+ def _button_click(self, name):
+ self.trigger_tool(name)
+
+ def toggle_toolitem(self, name, toggled):
+ if name not in self._toolitems:
+ return
+ for toolitem in self._toolitems[name]:
+ if toggled:
+ toolitem.select()
+ else:
+ toolitem.deselect()
+
+ def remove_toolitem(self, name):
+ for toolitem in self._toolitems[name]:
+ toolitem.pack_forget()
+ del self._toolitems[name]
+
+ def set_message(self, s):
+ self._message.set(s)
+
+
+@_api.deprecated("3.3")
+class StatusbarTk(StatusbarBase, tk.Frame):
+ def __init__(self, window, *args, **kwargs):
+ StatusbarBase.__init__(self, *args, **kwargs)
+ xmin, xmax = self.toolmanager.canvas.figure.bbox.intervalx
+ height, width = 50, xmax - xmin
+ tk.Frame.__init__(self, master=window,
+ width=int(width), height=int(height),
+ borderwidth=2)
+ self._message = tk.StringVar(master=self)
+ self._message_label = tk.Label(master=self, textvariable=self._message)
+ self._message_label.pack(side=tk.RIGHT)
+ self.pack(side=tk.TOP, fill=tk.X)
+
+ def set_message(self, s):
+ self._message.set(s)
+
+
+class SaveFigureTk(backend_tools.SaveFigureBase):
+ def trigger(self, *args):
+ NavigationToolbar2Tk.save_figure(
+ self._make_classic_style_pseudo_toolbar())
+
+
+class ConfigureSubplotsTk(backend_tools.ConfigureSubplotsBase):
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.window = None
+
+ def trigger(self, *args):
+ self.init_window()
+ self.window.lift()
+
+ def init_window(self):
+ if self.window:
+ return
+
+ toolfig = Figure(figsize=(6, 3))
+ self.window = tk.Tk()
+
+ canvas = type(self.canvas)(toolfig, master=self.window)
+ toolfig.subplots_adjust(top=0.9)
+ SubplotTool(self.figure, toolfig)
+ canvas.draw()
+ canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)
+ self.window.protocol("WM_DELETE_WINDOW", self.destroy)
+
+ def destroy(self, *args, **kwargs):
+ if self.window is not None:
+ self.window.destroy()
+ self.window = None
+
+
+class HelpTk(backend_tools.ToolHelpBase):
+ def trigger(self, *args):
+ dialog = SimpleDialog(
+ self.figure.canvas._tkcanvas, self._get_help_text(), ["OK"])
+ dialog.done = lambda num: dialog.frame.master.withdraw()
+
+
+backend_tools.ToolSaveFigure = SaveFigureTk
+backend_tools.ToolConfigureSubplots = ConfigureSubplotsTk
+backend_tools.ToolSetCursor = SetCursorTk
+backend_tools.ToolRubberband = RubberbandTk
+backend_tools.ToolHelp = HelpTk
+backend_tools.ToolCopyToClipboard = backend_tools.ToolCopyToClipboardBase
+Toolbar = ToolbarTk
+
+
+@_Backend.export
+class _BackendTk(_Backend):
+ FigureManager = FigureManagerTk
+
+ @classmethod
+ def new_figure_manager_given_figure(cls, num, figure):
+ """
+ Create a new figure manager instance for the given figure.
+ """
+ with _restore_foreground_window_at_end():
+ if cbook._get_running_interactive_framework() is None:
+ cbook._setup_new_guiapp()
+ window = tk.Tk(className="matplotlib")
+ window.withdraw()
+
+ # Put a Matplotlib icon on the window rather than the default tk
+ # icon. Tkinter doesn't allow colour icons on linux systems, but
+ # tk>=8.5 has a iconphoto command which we call directly. See
+ # http://mail.python.org/pipermail/tkinter-discuss/2006-November/000954.html
+ icon_fname = str(cbook._get_data_path(
+ 'images/matplotlib_128.ppm'))
+ icon_img = tk.PhotoImage(file=icon_fname, master=window)
+ try:
+ window.iconphoto(False, icon_img)
+ except Exception as exc:
+ # log the failure (due e.g. to Tk version), but carry on
+ _log.info('Could not load matplotlib icon: %s', exc)
+
+ canvas = cls.FigureCanvas(figure, master=window)
+ manager = cls.FigureManager(canvas, num, window)
+ if mpl.is_interactive():
+ manager.show()
+ canvas.draw_idle()
+ return manager
+
+ @staticmethod
+ def mainloop():
+ managers = Gcf.get_all_fig_managers()
+ if managers:
+ first_manager = managers[0]
+ manager_class = type(first_manager)
+ if manager_class._owns_mainloop:
+ return
+ manager_class._owns_mainloop = True
+ try:
+ first_manager.window.mainloop()
+ finally:
+ manager_class._owns_mainloop = False
diff --git a/venv/Lib/site-packages/matplotlib/backends/_tkagg.cp38-win_amd64.pyd b/venv/Lib/site-packages/matplotlib/backends/_tkagg.cp38-win_amd64.pyd
new file mode 100644
index 0000000..e032881
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/backends/_tkagg.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_agg.py b/venv/Lib/site-packages/matplotlib/backends/backend_agg.py
new file mode 100644
index 0000000..a9b0383
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_agg.py
@@ -0,0 +1,604 @@
+"""
+An `Anti-Grain Geometry `_ (AGG) backend.
+
+Features that are implemented:
+
+* capstyles and join styles
+* dashes
+* linewidth
+* lines, rectangles, ellipses
+* clipping to a rectangle
+* output to RGBA and Pillow-supported image formats
+* alpha blending
+* DPI scaling properly - everything scales properly (dashes, linewidths, etc)
+* draw polygon
+* freetype2 w/ ft2font
+
+Still TODO:
+
+* integrate screen dpi w/ ppi and text
+"""
+
+try:
+ import threading
+except ImportError:
+ import dummy_threading as threading
+from contextlib import nullcontext
+from math import radians, cos, sin
+
+import numpy as np
+from PIL import Image
+
+import matplotlib as mpl
+from matplotlib import _api, cbook
+from matplotlib import colors as mcolors
+from matplotlib.backend_bases import (
+ _Backend, _check_savefig_extra_args, FigureCanvasBase, FigureManagerBase,
+ RendererBase)
+from matplotlib.font_manager import findfont, get_font
+from matplotlib.ft2font import (LOAD_FORCE_AUTOHINT, LOAD_NO_HINTING,
+ LOAD_DEFAULT, LOAD_NO_AUTOHINT)
+from matplotlib.mathtext import MathTextParser
+from matplotlib.path import Path
+from matplotlib.transforms import Bbox, BboxBase
+from matplotlib.backends._backend_agg import RendererAgg as _RendererAgg
+
+
+backend_version = 'v2.2'
+
+
+def get_hinting_flag():
+ mapping = {
+ 'default': LOAD_DEFAULT,
+ 'no_autohint': LOAD_NO_AUTOHINT,
+ 'force_autohint': LOAD_FORCE_AUTOHINT,
+ 'no_hinting': LOAD_NO_HINTING,
+ True: LOAD_FORCE_AUTOHINT,
+ False: LOAD_NO_HINTING,
+ 'either': LOAD_DEFAULT,
+ 'native': LOAD_NO_AUTOHINT,
+ 'auto': LOAD_FORCE_AUTOHINT,
+ 'none': LOAD_NO_HINTING,
+ }
+ return mapping[mpl.rcParams['text.hinting']]
+
+
+class RendererAgg(RendererBase):
+ """
+ The renderer handles all the drawing primitives using a graphics
+ context instance that controls the colors/styles
+ """
+
+ # we want to cache the fonts at the class level so that when
+ # multiple figures are created we can reuse them. This helps with
+ # a bug on windows where the creation of too many figures leads to
+ # too many open file handles. However, storing them at the class
+ # level is not thread safe. The solution here is to let the
+ # FigureCanvas acquire a lock on the fontd at the start of the
+ # draw, and release it when it is done. This allows multiple
+ # renderers to share the cached fonts, but only one figure can
+ # draw at time and so the font cache is used by only one
+ # renderer at a time.
+
+ lock = threading.RLock()
+
+ def __init__(self, width, height, dpi):
+ super().__init__()
+
+ self.dpi = dpi
+ self.width = width
+ self.height = height
+ self._renderer = _RendererAgg(int(width), int(height), dpi)
+ self._filter_renderers = []
+
+ self._update_methods()
+ self.mathtext_parser = MathTextParser('Agg')
+
+ self.bbox = Bbox.from_bounds(0, 0, self.width, self.height)
+
+ def __getstate__(self):
+ # We only want to preserve the init keywords of the Renderer.
+ # Anything else can be re-created.
+ return {'width': self.width, 'height': self.height, 'dpi': self.dpi}
+
+ def __setstate__(self, state):
+ self.__init__(state['width'], state['height'], state['dpi'])
+
+ def _update_methods(self):
+ self.draw_gouraud_triangle = self._renderer.draw_gouraud_triangle
+ self.draw_gouraud_triangles = self._renderer.draw_gouraud_triangles
+ self.draw_image = self._renderer.draw_image
+ self.draw_markers = self._renderer.draw_markers
+ # This is its own method for the duration of the deprecation of
+ # offset_position = "data".
+ # self.draw_path_collection = self._renderer.draw_path_collection
+ self.draw_quad_mesh = self._renderer.draw_quad_mesh
+ self.copy_from_bbox = self._renderer.copy_from_bbox
+
+ @_api.deprecated("3.4")
+ def get_content_extents(self):
+ orig_img = np.asarray(self.buffer_rgba())
+ slice_y, slice_x = cbook._get_nonzero_slices(orig_img[..., 3])
+ return (slice_x.start, slice_y.start,
+ slice_x.stop - slice_x.start, slice_y.stop - slice_y.start)
+
+ @_api.deprecated("3.4")
+ def tostring_rgba_minimized(self):
+ extents = self.get_content_extents()
+ bbox = [[extents[0], self.height - (extents[1] + extents[3])],
+ [extents[0] + extents[2], self.height - extents[1]]]
+ region = self.copy_from_bbox(bbox)
+ return np.array(region), extents
+
+ def draw_path(self, gc, path, transform, rgbFace=None):
+ # docstring inherited
+ nmax = mpl.rcParams['agg.path.chunksize'] # here at least for testing
+ npts = path.vertices.shape[0]
+
+ if (npts > nmax > 100 and path.should_simplify and
+ rgbFace is None and gc.get_hatch() is None):
+ nch = np.ceil(npts / nmax)
+ chsize = int(np.ceil(npts / nch))
+ i0 = np.arange(0, npts, chsize)
+ i1 = np.zeros_like(i0)
+ i1[:-1] = i0[1:] - 1
+ i1[-1] = npts
+ for ii0, ii1 in zip(i0, i1):
+ v = path.vertices[ii0:ii1, :]
+ c = path.codes
+ if c is not None:
+ c = c[ii0:ii1]
+ c[0] = Path.MOVETO # move to end of last chunk
+ p = Path(v, c)
+ try:
+ self._renderer.draw_path(gc, p, transform, rgbFace)
+ except OverflowError as err:
+ raise OverflowError(
+ "Exceeded cell block limit (set 'agg.path.chunksize' "
+ "rcparam)") from err
+ else:
+ try:
+ self._renderer.draw_path(gc, path, transform, rgbFace)
+ except OverflowError as err:
+ raise OverflowError("Exceeded cell block limit (set "
+ "'agg.path.chunksize' rcparam)") from err
+
+ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
+ offsets, offsetTrans, facecolors, edgecolors,
+ linewidths, linestyles, antialiaseds, urls,
+ offset_position):
+ if offset_position == "data":
+ _api.warn_deprecated(
+ "3.3", message="Support for offset_position='data' is "
+ "deprecated since %(since)s and will be removed %(removal)s.")
+ return self._renderer.draw_path_collection(
+ gc, master_transform, paths, all_transforms, offsets, offsetTrans,
+ facecolors, edgecolors, linewidths, linestyles, antialiaseds, urls,
+ offset_position)
+
+ def draw_mathtext(self, gc, x, y, s, prop, angle):
+ """Draw mathtext using :mod:`matplotlib.mathtext`."""
+ ox, oy, width, height, descent, font_image, used_characters = \
+ self.mathtext_parser.parse(s, self.dpi, prop)
+
+ xd = descent * sin(radians(angle))
+ yd = descent * cos(radians(angle))
+ x = round(x + ox + xd)
+ y = round(y - oy + yd)
+ self._renderer.draw_text_image(font_image, x, y + 1, angle, gc)
+
+ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
+ # docstring inherited
+
+ if ismath:
+ return self.draw_mathtext(gc, x, y, s, prop, angle)
+
+ flags = get_hinting_flag()
+ font = self._get_agg_font(prop)
+
+ if font is None:
+ return None
+ # We pass '0' for angle here, since it will be rotated (in raster
+ # space) in the following call to draw_text_image).
+ font.set_text(s, 0, flags=flags)
+ font.draw_glyphs_to_bitmap(
+ antialiased=mpl.rcParams['text.antialiased'])
+ d = font.get_descent() / 64.0
+ # The descent needs to be adjusted for the angle.
+ xo, yo = font.get_bitmap_offset()
+ xo /= 64.0
+ yo /= 64.0
+ xd = d * sin(radians(angle))
+ yd = d * cos(radians(angle))
+ x = round(x + xo + xd)
+ y = round(y + yo + yd)
+ self._renderer.draw_text_image(font, x, y + 1, angle, gc)
+
+ def get_text_width_height_descent(self, s, prop, ismath):
+ # docstring inherited
+
+ if ismath in ["TeX", "TeX!"]:
+ if ismath == "TeX!":
+ _api.warn_deprecated(
+ "3.3", message="Support for ismath='TeX!' is deprecated "
+ "since %(since)s and will be removed %(removal)s; use "
+ "ismath='TeX' instead.")
+ # todo: handle props
+ texmanager = self.get_texmanager()
+ fontsize = prop.get_size_in_points()
+ w, h, d = texmanager.get_text_width_height_descent(
+ s, fontsize, renderer=self)
+ return w, h, d
+
+ if ismath:
+ ox, oy, width, height, descent, fonts, used_characters = \
+ self.mathtext_parser.parse(s, self.dpi, prop)
+ return width, height, descent
+
+ flags = get_hinting_flag()
+ font = self._get_agg_font(prop)
+ font.set_text(s, 0.0, flags=flags)
+ w, h = font.get_width_height() # width and height of unrotated string
+ d = font.get_descent()
+ w /= 64.0 # convert from subpixels
+ h /= 64.0
+ d /= 64.0
+ return w, h, d
+
+ def draw_tex(self, gc, x, y, s, prop, angle, *, mtext=None):
+ # docstring inherited
+ # todo, handle props, angle, origins
+ size = prop.get_size_in_points()
+
+ texmanager = self.get_texmanager()
+
+ Z = texmanager.get_grey(s, size, self.dpi)
+ Z = np.array(Z * 255.0, np.uint8)
+
+ w, h, d = self.get_text_width_height_descent(s, prop, ismath="TeX")
+ xd = d * sin(radians(angle))
+ yd = d * cos(radians(angle))
+ x = round(x + xd)
+ y = round(y + yd)
+ self._renderer.draw_text_image(Z, x, y, angle, gc)
+
+ def get_canvas_width_height(self):
+ # docstring inherited
+ return self.width, self.height
+
+ def _get_agg_font(self, prop):
+ """
+ Get the font for text instance t, caching for efficiency
+ """
+ fname = findfont(prop)
+ font = get_font(fname)
+
+ font.clear()
+ size = prop.get_size_in_points()
+ font.set_size(size, self.dpi)
+
+ return font
+
+ def points_to_pixels(self, points):
+ # docstring inherited
+ return points * self.dpi / 72
+
+ def buffer_rgba(self):
+ return memoryview(self._renderer)
+
+ def tostring_argb(self):
+ return np.asarray(self._renderer).take([3, 0, 1, 2], axis=2).tobytes()
+
+ def tostring_rgb(self):
+ return np.asarray(self._renderer).take([0, 1, 2], axis=2).tobytes()
+
+ def clear(self):
+ self._renderer.clear()
+
+ def option_image_nocomposite(self):
+ # docstring inherited
+
+ # It is generally faster to composite each image directly to
+ # the Figure, and there's no file size benefit to compositing
+ # with the Agg backend
+ return True
+
+ def option_scale_image(self):
+ # docstring inherited
+ return False
+
+ def restore_region(self, region, bbox=None, xy=None):
+ """
+ Restore the saved region. If bbox (instance of BboxBase, or
+ its extents) is given, only the region specified by the bbox
+ will be restored. *xy* (a pair of floats) optionally
+ specifies the new position (the LLC of the original region,
+ not the LLC of the bbox) where the region will be restored.
+
+ >>> region = renderer.copy_from_bbox()
+ >>> x1, y1, x2, y2 = region.get_extents()
+ >>> renderer.restore_region(region, bbox=(x1+dx, y1, x2, y2),
+ ... xy=(x1-dx, y1))
+
+ """
+ if bbox is not None or xy is not None:
+ if bbox is None:
+ x1, y1, x2, y2 = region.get_extents()
+ elif isinstance(bbox, BboxBase):
+ x1, y1, x2, y2 = bbox.extents
+ else:
+ x1, y1, x2, y2 = bbox
+
+ if xy is None:
+ ox, oy = x1, y1
+ else:
+ ox, oy = xy
+
+ # The incoming data is float, but the _renderer type-checking wants
+ # to see integers.
+ self._renderer.restore_region(region, int(x1), int(y1),
+ int(x2), int(y2), int(ox), int(oy))
+
+ else:
+ self._renderer.restore_region(region)
+
+ def start_filter(self):
+ """
+ Start filtering. It simply create a new canvas (the old one is saved).
+ """
+ self._filter_renderers.append(self._renderer)
+ self._renderer = _RendererAgg(int(self.width), int(self.height),
+ self.dpi)
+ self._update_methods()
+
+ def stop_filter(self, post_processing):
+ """
+ Save the plot in the current canvas as a image and apply
+ the *post_processing* function.
+
+ def post_processing(image, dpi):
+ # ny, nx, depth = image.shape
+ # image (numpy array) has RGBA channels and has a depth of 4.
+ ...
+ # create a new_image (numpy array of 4 channels, size can be
+ # different). The resulting image may have offsets from
+ # lower-left corner of the original image
+ return new_image, offset_x, offset_y
+
+ The saved renderer is restored and the returned image from
+ post_processing is plotted (using draw_image) on it.
+ """
+ orig_img = np.asarray(self.buffer_rgba())
+ slice_y, slice_x = cbook._get_nonzero_slices(orig_img[..., 3])
+ cropped_img = orig_img[slice_y, slice_x]
+
+ self._renderer = self._filter_renderers.pop()
+ self._update_methods()
+
+ if cropped_img.size:
+ img, ox, oy = post_processing(cropped_img / 255, self.dpi)
+ gc = self.new_gc()
+ if img.dtype.kind == 'f':
+ img = np.asarray(img * 255., np.uint8)
+ self._renderer.draw_image(
+ gc, slice_x.start + ox, int(self.height) - slice_y.stop + oy,
+ img[::-1])
+
+
+class FigureCanvasAgg(FigureCanvasBase):
+ # docstring inherited
+
+ def copy_from_bbox(self, bbox):
+ renderer = self.get_renderer()
+ return renderer.copy_from_bbox(bbox)
+
+ def restore_region(self, region, bbox=None, xy=None):
+ renderer = self.get_renderer()
+ return renderer.restore_region(region, bbox, xy)
+
+ def draw(self):
+ # docstring inherited
+ self.renderer = self.get_renderer(cleared=True)
+ # Acquire a lock on the shared font cache.
+ with RendererAgg.lock, \
+ (self.toolbar._wait_cursor_for_draw_cm() if self.toolbar
+ else nullcontext()):
+ self.figure.draw(self.renderer)
+ # A GUI class may be need to update a window using this draw, so
+ # don't forget to call the superclass.
+ super().draw()
+
+ def get_renderer(self, cleared=False):
+ w, h = self.figure.bbox.size
+ key = w, h, self.figure.dpi
+ reuse_renderer = (hasattr(self, "renderer")
+ and getattr(self, "_lastKey", None) == key)
+ if not reuse_renderer:
+ self.renderer = RendererAgg(w, h, self.figure.dpi)
+ self._lastKey = key
+ elif cleared:
+ self.renderer.clear()
+ return self.renderer
+
+ def tostring_rgb(self):
+ """
+ Get the image as RGB `bytes`.
+
+ `draw` must be called at least once before this function will work and
+ to update the renderer for any subsequent changes to the Figure.
+ """
+ return self.renderer.tostring_rgb()
+
+ def tostring_argb(self):
+ """
+ Get the image as ARGB `bytes`.
+
+ `draw` must be called at least once before this function will work and
+ to update the renderer for any subsequent changes to the Figure.
+ """
+ return self.renderer.tostring_argb()
+
+ def buffer_rgba(self):
+ """
+ Get the image as a `memoryview` to the renderer's buffer.
+
+ `draw` must be called at least once before this function will work and
+ to update the renderer for any subsequent changes to the Figure.
+ """
+ return self.renderer.buffer_rgba()
+
+ @_check_savefig_extra_args
+ def print_raw(self, filename_or_obj, *args):
+ FigureCanvasAgg.draw(self)
+ renderer = self.get_renderer()
+ with cbook.open_file_cm(filename_or_obj, "wb") as fh:
+ fh.write(renderer.buffer_rgba())
+
+ print_rgba = print_raw
+
+ @_check_savefig_extra_args
+ def print_png(self, filename_or_obj, *args,
+ metadata=None, pil_kwargs=None):
+ """
+ Write the figure to a PNG file.
+
+ Parameters
+ ----------
+ filename_or_obj : str or path-like or file-like
+ The file to write to.
+
+ metadata : dict, optional
+ Metadata in the PNG file as key-value pairs of bytes or latin-1
+ encodable strings.
+ According to the PNG specification, keys must be shorter than 79
+ chars.
+
+ The `PNG specification`_ defines some common keywords that may be
+ used as appropriate:
+
+ - Title: Short (one line) title or caption for image.
+ - Author: Name of image's creator.
+ - Description: Description of image (possibly long).
+ - Copyright: Copyright notice.
+ - Creation Time: Time of original image creation
+ (usually RFC 1123 format).
+ - Software: Software used to create the image.
+ - Disclaimer: Legal disclaimer.
+ - Warning: Warning of nature of content.
+ - Source: Device used to create the image.
+ - Comment: Miscellaneous comment;
+ conversion from other image format.
+
+ Other keywords may be invented for other purposes.
+
+ If 'Software' is not given, an autogenerated value for Matplotlib
+ will be used. This can be removed by setting it to *None*.
+
+ For more details see the `PNG specification`_.
+
+ .. _PNG specification: \
+ https://www.w3.org/TR/2003/REC-PNG-20031110/#11keywords
+
+ pil_kwargs : dict, optional
+ Keyword arguments passed to `PIL.Image.Image.save`.
+
+ If the 'pnginfo' key is present, it completely overrides
+ *metadata*, including the default 'Software' key.
+ """
+ FigureCanvasAgg.draw(self)
+ mpl.image.imsave(
+ filename_or_obj, self.buffer_rgba(), format="png", origin="upper",
+ dpi=self.figure.dpi, metadata=metadata, pil_kwargs=pil_kwargs)
+
+ def print_to_buffer(self):
+ FigureCanvasAgg.draw(self)
+ renderer = self.get_renderer()
+ return (bytes(renderer.buffer_rgba()),
+ (int(renderer.width), int(renderer.height)))
+
+ # Note that these methods should typically be called via savefig() and
+ # print_figure(), and the latter ensures that `self.figure.dpi` already
+ # matches the dpi kwarg (if any).
+
+ @_check_savefig_extra_args(
+ extra_kwargs=["quality", "optimize", "progressive"])
+ @_api.delete_parameter("3.3", "quality",
+ alternative="pil_kwargs={'quality': ...}")
+ @_api.delete_parameter("3.3", "optimize",
+ alternative="pil_kwargs={'optimize': ...}")
+ @_api.delete_parameter("3.3", "progressive",
+ alternative="pil_kwargs={'progressive': ...}")
+ def print_jpg(self, filename_or_obj, *args, pil_kwargs=None, **kwargs):
+ """
+ Write the figure to a JPEG file.
+
+ Parameters
+ ----------
+ filename_or_obj : str or path-like or file-like
+ The file to write to.
+
+ Other Parameters
+ ----------------
+ quality : int, default: :rc:`savefig.jpeg_quality`
+ The image quality, on a scale from 1 (worst) to 95 (best).
+ Values above 95 should be avoided; 100 disables portions of
+ the JPEG compression algorithm, and results in large files
+ with hardly any gain in image quality. This parameter is
+ deprecated.
+ optimize : bool, default: False
+ Whether the encoder should make an extra pass over the image
+ in order to select optimal encoder settings. This parameter is
+ deprecated.
+ progressive : bool, default: False
+ Whether the image should be stored as a progressive JPEG file.
+ This parameter is deprecated.
+ pil_kwargs : dict, optional
+ Additional keyword arguments that are passed to
+ `PIL.Image.Image.save` when saving the figure. These take
+ precedence over *quality*, *optimize* and *progressive*.
+ """
+ # Remove transparency by alpha-blending on an assumed white background.
+ r, g, b, a = mcolors.to_rgba(self.figure.get_facecolor())
+ try:
+ self.figure.set_facecolor(a * np.array([r, g, b]) + 1 - a)
+ FigureCanvasAgg.draw(self)
+ finally:
+ self.figure.set_facecolor((r, g, b, a))
+ if pil_kwargs is None:
+ pil_kwargs = {}
+ for k in ["quality", "optimize", "progressive"]:
+ if k in kwargs:
+ pil_kwargs.setdefault(k, kwargs.pop(k))
+ if "quality" not in pil_kwargs:
+ quality = pil_kwargs["quality"] = \
+ dict.__getitem__(mpl.rcParams, "savefig.jpeg_quality")
+ if quality not in [0, 75, 95]: # default qualities.
+ _api.warn_deprecated(
+ "3.3", name="savefig.jpeg_quality", obj_type="rcParam",
+ addendum="Set the quality using "
+ "`pil_kwargs={'quality': ...}`; the future default "
+ "quality will be 75, matching the default of Pillow and "
+ "libjpeg.")
+ pil_kwargs.setdefault("dpi", (self.figure.dpi, self.figure.dpi))
+ # Drop alpha channel now.
+ return (Image.fromarray(np.asarray(self.buffer_rgba())[..., :3])
+ .save(filename_or_obj, format='jpeg', **pil_kwargs))
+
+ print_jpeg = print_jpg
+
+ @_check_savefig_extra_args
+ def print_tif(self, filename_or_obj, *, pil_kwargs=None):
+ FigureCanvasAgg.draw(self)
+ if pil_kwargs is None:
+ pil_kwargs = {}
+ pil_kwargs.setdefault("dpi", (self.figure.dpi, self.figure.dpi))
+ return (Image.fromarray(np.asarray(self.buffer_rgba()))
+ .save(filename_or_obj, format='tiff', **pil_kwargs))
+
+ print_tiff = print_tif
+
+
+@_Backend.export
+class _BackendAgg(_Backend):
+ FigureCanvas = FigureCanvasAgg
+ FigureManager = FigureManagerBase
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_cairo.py b/venv/Lib/site-packages/matplotlib/backends/backend_cairo.py
new file mode 100644
index 0000000..9b72c04
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_cairo.py
@@ -0,0 +1,546 @@
+"""
+A Cairo backend for matplotlib
+==============================
+:Author: Steve Chaplin and others
+
+This backend depends on cairocffi or pycairo.
+"""
+
+import gzip
+import math
+
+import numpy as np
+
+try:
+ import cairo
+ if cairo.version_info < (1, 11, 0):
+ # Introduced create_for_data for Py3.
+ raise ImportError
+except ImportError:
+ try:
+ import cairocffi as cairo
+ except ImportError as err:
+ raise ImportError(
+ "cairo backend requires that pycairo>=1.11.0 or cairocffi "
+ "is installed") from err
+
+import matplotlib as mpl
+from .. import _api, cbook, font_manager
+from matplotlib.backend_bases import (
+ _Backend, _check_savefig_extra_args, FigureCanvasBase, FigureManagerBase,
+ GraphicsContextBase, RendererBase)
+from matplotlib.font_manager import ttfFontProperty
+from matplotlib.mathtext import MathTextParser
+from matplotlib.path import Path
+from matplotlib.transforms import Affine2D
+
+
+backend_version = cairo.version
+
+
+if cairo.__name__ == "cairocffi":
+ # Convert a pycairo context to a cairocffi one.
+ def _to_context(ctx):
+ if not isinstance(ctx, cairo.Context):
+ ctx = cairo.Context._from_pointer(
+ cairo.ffi.cast(
+ 'cairo_t **',
+ id(ctx) + object.__basicsize__)[0],
+ incref=True)
+ return ctx
+else:
+ # Pass-through a pycairo context.
+ def _to_context(ctx):
+ return ctx
+
+
+def _append_path(ctx, path, transform, clip=None):
+ for points, code in path.iter_segments(
+ transform, remove_nans=True, clip=clip):
+ if code == Path.MOVETO:
+ ctx.move_to(*points)
+ elif code == Path.CLOSEPOLY:
+ ctx.close_path()
+ elif code == Path.LINETO:
+ ctx.line_to(*points)
+ elif code == Path.CURVE3:
+ cur = np.asarray(ctx.get_current_point())
+ a = points[:2]
+ b = points[-2:]
+ ctx.curve_to(*(cur / 3 + a * 2 / 3), *(a * 2 / 3 + b / 3), *b)
+ elif code == Path.CURVE4:
+ ctx.curve_to(*points)
+
+
+def _cairo_font_args_from_font_prop(prop):
+ """
+ Convert a `.FontProperties` or a `.FontEntry` to arguments that can be
+ passed to `.Context.select_font_face`.
+ """
+ def attr(field):
+ try:
+ return getattr(prop, f"get_{field}")()
+ except AttributeError:
+ return getattr(prop, field)
+
+ name = attr("name")
+ slant = getattr(cairo, f"FONT_SLANT_{attr('style').upper()}")
+ weight = attr("weight")
+ weight = (cairo.FONT_WEIGHT_NORMAL
+ if font_manager.weight_dict.get(weight, weight) < 550
+ else cairo.FONT_WEIGHT_BOLD)
+ return name, slant, weight
+
+
+# Mappings used for deprecated properties in RendererCairo, see below.
+_f_weights = {
+ 100: cairo.FONT_WEIGHT_NORMAL,
+ 200: cairo.FONT_WEIGHT_NORMAL,
+ 300: cairo.FONT_WEIGHT_NORMAL,
+ 400: cairo.FONT_WEIGHT_NORMAL,
+ 500: cairo.FONT_WEIGHT_NORMAL,
+ 600: cairo.FONT_WEIGHT_BOLD,
+ 700: cairo.FONT_WEIGHT_BOLD,
+ 800: cairo.FONT_WEIGHT_BOLD,
+ 900: cairo.FONT_WEIGHT_BOLD,
+ 'ultralight': cairo.FONT_WEIGHT_NORMAL,
+ 'light': cairo.FONT_WEIGHT_NORMAL,
+ 'normal': cairo.FONT_WEIGHT_NORMAL,
+ 'medium': cairo.FONT_WEIGHT_NORMAL,
+ 'regular': cairo.FONT_WEIGHT_NORMAL,
+ 'semibold': cairo.FONT_WEIGHT_BOLD,
+ 'bold': cairo.FONT_WEIGHT_BOLD,
+ 'heavy': cairo.FONT_WEIGHT_BOLD,
+ 'ultrabold': cairo.FONT_WEIGHT_BOLD,
+ 'black': cairo.FONT_WEIGHT_BOLD,
+}
+_f_angles = {
+ 'italic': cairo.FONT_SLANT_ITALIC,
+ 'normal': cairo.FONT_SLANT_NORMAL,
+ 'oblique': cairo.FONT_SLANT_OBLIQUE,
+}
+
+
+class RendererCairo(RendererBase):
+ fontweights = _api.deprecated("3.3")(property(lambda self: {*_f_weights}))
+ fontangles = _api.deprecated("3.3")(property(lambda self: {*_f_angles}))
+ mathtext_parser = _api.deprecated("3.4")(
+ property(lambda self: MathTextParser('Cairo')))
+
+ def __init__(self, dpi):
+ self.dpi = dpi
+ self.gc = GraphicsContextCairo(renderer=self)
+ self.text_ctx = cairo.Context(
+ cairo.ImageSurface(cairo.FORMAT_ARGB32, 1, 1))
+ super().__init__()
+
+ def set_ctx_from_surface(self, surface):
+ self.gc.ctx = cairo.Context(surface)
+ # Although it may appear natural to automatically call
+ # `self.set_width_height(surface.get_width(), surface.get_height())`
+ # here (instead of having the caller do so separately), this would fail
+ # for PDF/PS/SVG surfaces, which have no way to report their extents.
+
+ def set_width_height(self, width, height):
+ self.width = width
+ self.height = height
+
+ def _fill_and_stroke(self, ctx, fill_c, alpha, alpha_overrides):
+ if fill_c is not None:
+ ctx.save()
+ if len(fill_c) == 3 or alpha_overrides:
+ ctx.set_source_rgba(fill_c[0], fill_c[1], fill_c[2], alpha)
+ else:
+ ctx.set_source_rgba(fill_c[0], fill_c[1], fill_c[2], fill_c[3])
+ ctx.fill_preserve()
+ ctx.restore()
+ ctx.stroke()
+
+ def draw_path(self, gc, path, transform, rgbFace=None):
+ # docstring inherited
+ ctx = gc.ctx
+ # Clip the path to the actual rendering extents if it isn't filled.
+ clip = (ctx.clip_extents()
+ if rgbFace is None and gc.get_hatch() is None
+ else None)
+ transform = (transform
+ + Affine2D().scale(1, -1).translate(0, self.height))
+ ctx.new_path()
+ _append_path(ctx, path, transform, clip)
+ self._fill_and_stroke(
+ ctx, rgbFace, gc.get_alpha(), gc.get_forced_alpha())
+
+ def draw_markers(self, gc, marker_path, marker_trans, path, transform,
+ rgbFace=None):
+ # docstring inherited
+
+ ctx = gc.ctx
+ ctx.new_path()
+ # Create the path for the marker; it needs to be flipped here already!
+ _append_path(ctx, marker_path, marker_trans + Affine2D().scale(1, -1))
+ marker_path = ctx.copy_path_flat()
+
+ # Figure out whether the path has a fill
+ x1, y1, x2, y2 = ctx.fill_extents()
+ if x1 == 0 and y1 == 0 and x2 == 0 and y2 == 0:
+ filled = False
+ # No fill, just unset this (so we don't try to fill it later on)
+ rgbFace = None
+ else:
+ filled = True
+
+ transform = (transform
+ + Affine2D().scale(1, -1).translate(0, self.height))
+
+ ctx.new_path()
+ for i, (vertices, codes) in enumerate(
+ path.iter_segments(transform, simplify=False)):
+ if len(vertices):
+ x, y = vertices[-2:]
+ ctx.save()
+
+ # Translate and apply path
+ ctx.translate(x, y)
+ ctx.append_path(marker_path)
+
+ ctx.restore()
+
+ # Slower code path if there is a fill; we need to draw
+ # the fill and stroke for each marker at the same time.
+ # Also flush out the drawing every once in a while to
+ # prevent the paths from getting way too long.
+ if filled or i % 1000 == 0:
+ self._fill_and_stroke(
+ ctx, rgbFace, gc.get_alpha(), gc.get_forced_alpha())
+
+ # Fast path, if there is no fill, draw everything in one step
+ if not filled:
+ self._fill_and_stroke(
+ ctx, rgbFace, gc.get_alpha(), gc.get_forced_alpha())
+
+ def draw_image(self, gc, x, y, im):
+ im = cbook._unmultiplied_rgba8888_to_premultiplied_argb32(im[::-1])
+ surface = cairo.ImageSurface.create_for_data(
+ im.ravel().data, cairo.FORMAT_ARGB32,
+ im.shape[1], im.shape[0], im.shape[1] * 4)
+ ctx = gc.ctx
+ y = self.height - y - im.shape[0]
+
+ ctx.save()
+ ctx.set_source_surface(surface, float(x), float(y))
+ ctx.paint()
+ ctx.restore()
+
+ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
+ # docstring inherited
+
+ # Note: (x, y) are device/display coords, not user-coords, unlike other
+ # draw_* methods
+ if ismath:
+ self._draw_mathtext(gc, x, y, s, prop, angle)
+
+ else:
+ ctx = gc.ctx
+ ctx.new_path()
+ ctx.move_to(x, y)
+
+ ctx.save()
+ ctx.select_font_face(*_cairo_font_args_from_font_prop(prop))
+ ctx.set_font_size(prop.get_size_in_points() * self.dpi / 72)
+ opts = cairo.FontOptions()
+ opts.set_antialias(
+ cairo.ANTIALIAS_DEFAULT if mpl.rcParams["text.antialiased"]
+ else cairo.ANTIALIAS_NONE)
+ ctx.set_font_options(opts)
+ if angle:
+ ctx.rotate(np.deg2rad(-angle))
+ ctx.show_text(s)
+ ctx.restore()
+
+ def _draw_mathtext(self, gc, x, y, s, prop, angle):
+ ctx = gc.ctx
+ width, height, descent, glyphs, rects = \
+ self._text2path.mathtext_parser.parse(s, self.dpi, prop)
+
+ ctx.save()
+ ctx.translate(x, y)
+ if angle:
+ ctx.rotate(np.deg2rad(-angle))
+
+ for font, fontsize, idx, ox, oy in glyphs:
+ ctx.new_path()
+ ctx.move_to(ox, -oy)
+ ctx.select_font_face(
+ *_cairo_font_args_from_font_prop(ttfFontProperty(font)))
+ ctx.set_font_size(fontsize * self.dpi / 72)
+ ctx.show_text(chr(idx))
+
+ for ox, oy, w, h in rects:
+ ctx.new_path()
+ ctx.rectangle(ox, -oy, w, -h)
+ ctx.set_source_rgb(0, 0, 0)
+ ctx.fill_preserve()
+
+ ctx.restore()
+
+ def get_canvas_width_height(self):
+ # docstring inherited
+ return self.width, self.height
+
+ def get_text_width_height_descent(self, s, prop, ismath):
+ # docstring inherited
+
+ if ismath == 'TeX':
+ return super().get_text_width_height_descent(s, prop, ismath)
+
+ if ismath:
+ width, height, descent, *_ = \
+ self._text2path.mathtext_parser.parse(s, self.dpi, prop)
+ return width, height, descent
+
+ ctx = self.text_ctx
+ # problem - scale remembers last setting and font can become
+ # enormous causing program to crash
+ # save/restore prevents the problem
+ ctx.save()
+ ctx.select_font_face(*_cairo_font_args_from_font_prop(prop))
+ # Cairo (says it) uses 1/96 inch user space units, ref: cairo_gstate.c
+ # but if /96.0 is used the font is too small
+ ctx.set_font_size(prop.get_size_in_points() * self.dpi / 72)
+
+ y_bearing, w, h = ctx.text_extents(s)[1:4]
+ ctx.restore()
+
+ return w, h, h + y_bearing
+
+ def new_gc(self):
+ # docstring inherited
+ self.gc.ctx.save()
+ self.gc._alpha = 1
+ self.gc._forced_alpha = False # if True, _alpha overrides A from RGBA
+ return self.gc
+
+ def points_to_pixels(self, points):
+ # docstring inherited
+ return points / 72 * self.dpi
+
+
+class GraphicsContextCairo(GraphicsContextBase):
+ _joind = {
+ 'bevel': cairo.LINE_JOIN_BEVEL,
+ 'miter': cairo.LINE_JOIN_MITER,
+ 'round': cairo.LINE_JOIN_ROUND,
+ }
+
+ _capd = {
+ 'butt': cairo.LINE_CAP_BUTT,
+ 'projecting': cairo.LINE_CAP_SQUARE,
+ 'round': cairo.LINE_CAP_ROUND,
+ }
+
+ def __init__(self, renderer):
+ super().__init__()
+ self.renderer = renderer
+
+ def restore(self):
+ self.ctx.restore()
+
+ def set_alpha(self, alpha):
+ super().set_alpha(alpha)
+ _alpha = self.get_alpha()
+ rgb = self._rgb
+ if self.get_forced_alpha():
+ self.ctx.set_source_rgba(rgb[0], rgb[1], rgb[2], _alpha)
+ else:
+ self.ctx.set_source_rgba(rgb[0], rgb[1], rgb[2], rgb[3])
+
+ def set_antialiased(self, b):
+ self.ctx.set_antialias(
+ cairo.ANTIALIAS_DEFAULT if b else cairo.ANTIALIAS_NONE)
+
+ def set_capstyle(self, cs):
+ self.ctx.set_line_cap(_api.check_getitem(self._capd, capstyle=cs))
+ self._capstyle = cs
+
+ def set_clip_rectangle(self, rectangle):
+ if not rectangle:
+ return
+ x, y, w, h = np.round(rectangle.bounds)
+ ctx = self.ctx
+ ctx.new_path()
+ ctx.rectangle(x, self.renderer.height - h - y, w, h)
+ ctx.clip()
+
+ def set_clip_path(self, path):
+ if not path:
+ return
+ tpath, affine = path.get_transformed_path_and_affine()
+ ctx = self.ctx
+ ctx.new_path()
+ affine = (affine
+ + Affine2D().scale(1, -1).translate(0, self.renderer.height))
+ _append_path(ctx, tpath, affine)
+ ctx.clip()
+
+ def set_dashes(self, offset, dashes):
+ self._dashes = offset, dashes
+ if dashes is None:
+ self.ctx.set_dash([], 0) # switch dashes off
+ else:
+ self.ctx.set_dash(
+ list(self.renderer.points_to_pixels(np.asarray(dashes))),
+ offset)
+
+ def set_foreground(self, fg, isRGBA=None):
+ super().set_foreground(fg, isRGBA)
+ if len(self._rgb) == 3:
+ self.ctx.set_source_rgb(*self._rgb)
+ else:
+ self.ctx.set_source_rgba(*self._rgb)
+
+ def get_rgb(self):
+ return self.ctx.get_source().get_rgba()[:3]
+
+ def set_joinstyle(self, js):
+ self.ctx.set_line_join(_api.check_getitem(self._joind, joinstyle=js))
+ self._joinstyle = js
+
+ def set_linewidth(self, w):
+ self._linewidth = float(w)
+ self.ctx.set_line_width(self.renderer.points_to_pixels(w))
+
+
+class _CairoRegion:
+ def __init__(self, slices, data):
+ self._slices = slices
+ self._data = data
+
+
+class FigureCanvasCairo(FigureCanvasBase):
+
+ def copy_from_bbox(self, bbox):
+ surface = self._renderer.gc.ctx.get_target()
+ if not isinstance(surface, cairo.ImageSurface):
+ raise RuntimeError(
+ "copy_from_bbox only works when rendering to an ImageSurface")
+ sw = surface.get_width()
+ sh = surface.get_height()
+ x0 = math.ceil(bbox.x0)
+ x1 = math.floor(bbox.x1)
+ y0 = math.ceil(sh - bbox.y1)
+ y1 = math.floor(sh - bbox.y0)
+ if not (0 <= x0 and x1 <= sw and bbox.x0 <= bbox.x1
+ and 0 <= y0 and y1 <= sh and bbox.y0 <= bbox.y1):
+ raise ValueError("Invalid bbox")
+ sls = slice(y0, y0 + max(y1 - y0, 0)), slice(x0, x0 + max(x1 - x0, 0))
+ data = (np.frombuffer(surface.get_data(), np.uint32)
+ .reshape((sh, sw))[sls].copy())
+ return _CairoRegion(sls, data)
+
+ def restore_region(self, region):
+ surface = self._renderer.gc.ctx.get_target()
+ if not isinstance(surface, cairo.ImageSurface):
+ raise RuntimeError(
+ "restore_region only works when rendering to an ImageSurface")
+ surface.flush()
+ sw = surface.get_width()
+ sh = surface.get_height()
+ sly, slx = region._slices
+ (np.frombuffer(surface.get_data(), np.uint32)
+ .reshape((sh, sw))[sly, slx]) = region._data
+ surface.mark_dirty_rectangle(
+ slx.start, sly.start, slx.stop - slx.start, sly.stop - sly.start)
+
+ @_check_savefig_extra_args
+ def print_png(self, fobj):
+ self._get_printed_image_surface().write_to_png(fobj)
+
+ @_check_savefig_extra_args
+ def print_rgba(self, fobj):
+ width, height = self.get_width_height()
+ buf = self._get_printed_image_surface().get_data()
+ fobj.write(cbook._premultiplied_argb32_to_unmultiplied_rgba8888(
+ np.asarray(buf).reshape((width, height, 4))))
+
+ print_raw = print_rgba
+
+ def _get_printed_image_surface(self):
+ width, height = self.get_width_height()
+ renderer = RendererCairo(self.figure.dpi)
+ renderer.set_width_height(width, height)
+ surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
+ renderer.set_ctx_from_surface(surface)
+ self.figure.draw(renderer)
+ return surface
+
+ def print_pdf(self, fobj, *args, **kwargs):
+ return self._save(fobj, 'pdf', *args, **kwargs)
+
+ def print_ps(self, fobj, *args, **kwargs):
+ return self._save(fobj, 'ps', *args, **kwargs)
+
+ def print_svg(self, fobj, *args, **kwargs):
+ return self._save(fobj, 'svg', *args, **kwargs)
+
+ def print_svgz(self, fobj, *args, **kwargs):
+ return self._save(fobj, 'svgz', *args, **kwargs)
+
+ @_check_savefig_extra_args
+ def _save(self, fo, fmt, *, orientation='portrait'):
+ # save PDF/PS/SVG
+
+ dpi = 72
+ self.figure.dpi = dpi
+ w_in, h_in = self.figure.get_size_inches()
+ width_in_points, height_in_points = w_in * dpi, h_in * dpi
+
+ if orientation == 'landscape':
+ width_in_points, height_in_points = (
+ height_in_points, width_in_points)
+
+ if fmt == 'ps':
+ if not hasattr(cairo, 'PSSurface'):
+ raise RuntimeError('cairo has not been compiled with PS '
+ 'support enabled')
+ surface = cairo.PSSurface(fo, width_in_points, height_in_points)
+ elif fmt == 'pdf':
+ if not hasattr(cairo, 'PDFSurface'):
+ raise RuntimeError('cairo has not been compiled with PDF '
+ 'support enabled')
+ surface = cairo.PDFSurface(fo, width_in_points, height_in_points)
+ elif fmt in ('svg', 'svgz'):
+ if not hasattr(cairo, 'SVGSurface'):
+ raise RuntimeError('cairo has not been compiled with SVG '
+ 'support enabled')
+ if fmt == 'svgz':
+ if isinstance(fo, str):
+ fo = gzip.GzipFile(fo, 'wb')
+ else:
+ fo = gzip.GzipFile(None, 'wb', fileobj=fo)
+ surface = cairo.SVGSurface(fo, width_in_points, height_in_points)
+ else:
+ raise ValueError("Unknown format: {!r}".format(fmt))
+
+ # surface.set_dpi() can be used
+ renderer = RendererCairo(self.figure.dpi)
+ renderer.set_width_height(width_in_points, height_in_points)
+ renderer.set_ctx_from_surface(surface)
+ ctx = renderer.gc.ctx
+
+ if orientation == 'landscape':
+ ctx.rotate(np.pi / 2)
+ ctx.translate(0, -height_in_points)
+ # Perhaps add an '%%Orientation: Landscape' comment?
+
+ self.figure.draw(renderer)
+
+ ctx.show_page()
+ surface.finish()
+ if fmt == 'svgz':
+ fo.close()
+
+
+@_Backend.export
+class _BackendCairo(_Backend):
+ FigureCanvas = FigureCanvasCairo
+ FigureManager = FigureManagerBase
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_gtk3.py b/venv/Lib/site-packages/matplotlib/backends/backend_gtk3.py
new file mode 100644
index 0000000..1dbf5d9
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_gtk3.py
@@ -0,0 +1,850 @@
+import functools
+import logging
+import os
+from pathlib import Path
+import sys
+
+import matplotlib as mpl
+from matplotlib import _api, backend_tools, cbook
+from matplotlib._pylab_helpers import Gcf
+from matplotlib.backend_bases import (
+ _Backend, FigureCanvasBase, FigureManagerBase, NavigationToolbar2,
+ StatusbarBase, TimerBase, ToolContainerBase, cursors)
+from matplotlib.figure import Figure
+from matplotlib.widgets import SubplotTool
+
+try:
+ import gi
+except ImportError as err:
+ raise ImportError("The GTK3 backends require PyGObject") from err
+
+try:
+ # :raises ValueError: If module/version is already loaded, already
+ # required, or unavailable.
+ gi.require_version("Gtk", "3.0")
+except ValueError as e:
+ # in this case we want to re-raise as ImportError so the
+ # auto-backend selection logic correctly skips.
+ raise ImportError from e
+
+from gi.repository import Gio, GLib, GObject, Gtk, Gdk
+
+
+_log = logging.getLogger(__name__)
+
+backend_version = "%s.%s.%s" % (
+ Gtk.get_major_version(), Gtk.get_micro_version(), Gtk.get_minor_version())
+
+try:
+ _display = Gdk.Display.get_default()
+ cursord = {
+ cursors.MOVE: Gdk.Cursor.new_from_name(_display, "move"),
+ cursors.HAND: Gdk.Cursor.new_from_name(_display, "pointer"),
+ cursors.POINTER: Gdk.Cursor.new_from_name(_display, "default"),
+ cursors.SELECT_REGION: Gdk.Cursor.new_from_name(_display, "crosshair"),
+ cursors.WAIT: Gdk.Cursor.new_from_name(_display, "wait"),
+ }
+except TypeError as exc:
+ # Happens when running headless. Convert to ImportError to cooperate with
+ # backend switching.
+ raise ImportError(exc) from exc
+
+
+class TimerGTK3(TimerBase):
+ """Subclass of `.TimerBase` using GTK3 timer events."""
+
+ def __init__(self, *args, **kwargs):
+ self._timer = None
+ super().__init__(*args, **kwargs)
+
+ def _timer_start(self):
+ # Need to stop it, otherwise we potentially leak a timer id that will
+ # never be stopped.
+ self._timer_stop()
+ self._timer = GLib.timeout_add(self._interval, self._on_timer)
+
+ def _timer_stop(self):
+ if self._timer is not None:
+ GLib.source_remove(self._timer)
+ self._timer = None
+
+ def _timer_set_interval(self):
+ # Only stop and restart it if the timer has already been started
+ if self._timer is not None:
+ self._timer_stop()
+ self._timer_start()
+
+ def _on_timer(self):
+ super()._on_timer()
+
+ # Gtk timeout_add() requires that the callback returns True if it
+ # is to be called again.
+ if self.callbacks and not self._single:
+ return True
+ else:
+ self._timer = None
+ return False
+
+
+class FigureCanvasGTK3(Gtk.DrawingArea, FigureCanvasBase):
+ required_interactive_framework = "gtk3"
+ _timer_cls = TimerGTK3
+ # Setting this as a static constant prevents
+ # this resulting expression from leaking
+ event_mask = (Gdk.EventMask.BUTTON_PRESS_MASK
+ | Gdk.EventMask.BUTTON_RELEASE_MASK
+ | Gdk.EventMask.EXPOSURE_MASK
+ | Gdk.EventMask.KEY_PRESS_MASK
+ | Gdk.EventMask.KEY_RELEASE_MASK
+ | Gdk.EventMask.ENTER_NOTIFY_MASK
+ | Gdk.EventMask.LEAVE_NOTIFY_MASK
+ | Gdk.EventMask.POINTER_MOTION_MASK
+ | Gdk.EventMask.POINTER_MOTION_HINT_MASK
+ | Gdk.EventMask.SCROLL_MASK)
+
+ def __init__(self, figure=None):
+ FigureCanvasBase.__init__(self, figure)
+ GObject.GObject.__init__(self)
+
+ self._idle_draw_id = 0
+ self._lastCursor = None
+ self._rubberband_rect = None
+
+ self.connect('scroll_event', self.scroll_event)
+ self.connect('button_press_event', self.button_press_event)
+ self.connect('button_release_event', self.button_release_event)
+ self.connect('configure_event', self.configure_event)
+ self.connect('draw', self.on_draw_event)
+ self.connect('draw', self._post_draw)
+ self.connect('key_press_event', self.key_press_event)
+ self.connect('key_release_event', self.key_release_event)
+ self.connect('motion_notify_event', self.motion_notify_event)
+ self.connect('leave_notify_event', self.leave_notify_event)
+ self.connect('enter_notify_event', self.enter_notify_event)
+ self.connect('size_allocate', self.size_allocate)
+
+ self.set_events(self.__class__.event_mask)
+
+ self.set_can_focus(True)
+
+ css = Gtk.CssProvider()
+ css.load_from_data(b".matplotlib-canvas { background-color: white; }")
+ style_ctx = self.get_style_context()
+ style_ctx.add_provider(css, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
+ style_ctx.add_class("matplotlib-canvas")
+
+ renderer_init = _api.deprecate_method_override(
+ __class__._renderer_init, self, allow_empty=True, since="3.3",
+ addendum="Please initialize the renderer, if needed, in the "
+ "subclass' __init__; a fully empty _renderer_init implementation "
+ "may be kept for compatibility with earlier versions of "
+ "Matplotlib.")
+ if renderer_init:
+ renderer_init()
+
+ @_api.deprecated("3.3", alternative="__init__")
+ def _renderer_init(self):
+ pass
+
+ def destroy(self):
+ #Gtk.DrawingArea.destroy(self)
+ self.close_event()
+
+ def scroll_event(self, widget, event):
+ x = event.x
+ # flipy so y=0 is bottom of canvas
+ y = self.get_allocation().height - event.y
+ step = 1 if event.direction == Gdk.ScrollDirection.UP else -1
+ FigureCanvasBase.scroll_event(self, x, y, step, guiEvent=event)
+ return False # finish event propagation?
+
+ def button_press_event(self, widget, event):
+ x = event.x
+ # flipy so y=0 is bottom of canvas
+ y = self.get_allocation().height - event.y
+ FigureCanvasBase.button_press_event(
+ self, x, y, event.button, guiEvent=event)
+ return False # finish event propagation?
+
+ def button_release_event(self, widget, event):
+ x = event.x
+ # flipy so y=0 is bottom of canvas
+ y = self.get_allocation().height - event.y
+ FigureCanvasBase.button_release_event(
+ self, x, y, event.button, guiEvent=event)
+ return False # finish event propagation?
+
+ def key_press_event(self, widget, event):
+ key = self._get_key(event)
+ FigureCanvasBase.key_press_event(self, key, guiEvent=event)
+ return True # stop event propagation
+
+ def key_release_event(self, widget, event):
+ key = self._get_key(event)
+ FigureCanvasBase.key_release_event(self, key, guiEvent=event)
+ return True # stop event propagation
+
+ def motion_notify_event(self, widget, event):
+ if event.is_hint:
+ t, x, y, state = event.window.get_device_position(event.device)
+ else:
+ x, y = event.x, event.y
+
+ # flipy so y=0 is bottom of canvas
+ y = self.get_allocation().height - y
+ FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=event)
+ return False # finish event propagation?
+
+ def leave_notify_event(self, widget, event):
+ FigureCanvasBase.leave_notify_event(self, event)
+
+ def enter_notify_event(self, widget, event):
+ x = event.x
+ # flipy so y=0 is bottom of canvas
+ y = self.get_allocation().height - event.y
+ FigureCanvasBase.enter_notify_event(self, guiEvent=event, xy=(x, y))
+
+ def size_allocate(self, widget, allocation):
+ dpival = self.figure.dpi
+ winch = allocation.width / dpival
+ hinch = allocation.height / dpival
+ self.figure.set_size_inches(winch, hinch, forward=False)
+ FigureCanvasBase.resize_event(self)
+ self.draw_idle()
+
+ def _get_key(self, event):
+ unikey = chr(Gdk.keyval_to_unicode(event.keyval))
+ key = cbook._unikey_or_keysym_to_mplkey(
+ unikey,
+ Gdk.keyval_name(event.keyval))
+ modifiers = [
+ (Gdk.ModifierType.CONTROL_MASK, 'ctrl'),
+ (Gdk.ModifierType.MOD1_MASK, 'alt'),
+ (Gdk.ModifierType.SHIFT_MASK, 'shift'),
+ (Gdk.ModifierType.MOD4_MASK, 'super'),
+ ]
+ for key_mask, prefix in modifiers:
+ if event.state & key_mask:
+ if not (prefix == 'shift' and unikey.isprintable()):
+ key = '{0}+{1}'.format(prefix, key)
+ return key
+
+ def configure_event(self, widget, event):
+ if widget.get_property("window") is None:
+ return
+ w, h = event.width, event.height
+ if w < 3 or h < 3:
+ return # empty fig
+ # resize the figure (in inches)
+ dpi = self.figure.dpi
+ self.figure.set_size_inches(w / dpi, h / dpi, forward=False)
+ return False # finish event propagation?
+
+ def _draw_rubberband(self, rect):
+ self._rubberband_rect = rect
+ # TODO: Only update the rubberband area.
+ self.queue_draw()
+
+ def _post_draw(self, widget, ctx):
+ if self._rubberband_rect is None:
+ return
+
+ x0, y0, w, h = self._rubberband_rect
+ x1 = x0 + w
+ y1 = y0 + h
+
+ # Draw the lines from x0, y0 towards x1, y1 so that the
+ # dashes don't "jump" when moving the zoom box.
+ ctx.move_to(x0, y0)
+ ctx.line_to(x0, y1)
+ ctx.move_to(x0, y0)
+ ctx.line_to(x1, y0)
+ ctx.move_to(x0, y1)
+ ctx.line_to(x1, y1)
+ ctx.move_to(x1, y0)
+ ctx.line_to(x1, y1)
+
+ ctx.set_antialias(1)
+ ctx.set_line_width(1)
+ ctx.set_dash((3, 3), 0)
+ ctx.set_source_rgb(0, 0, 0)
+ ctx.stroke_preserve()
+
+ ctx.set_dash((3, 3), 3)
+ ctx.set_source_rgb(1, 1, 1)
+ ctx.stroke()
+
+ def on_draw_event(self, widget, ctx):
+ # to be overwritten by GTK3Agg or GTK3Cairo
+ pass
+
+ def draw(self):
+ # docstring inherited
+ if self.is_drawable():
+ self.queue_draw()
+
+ def draw_idle(self):
+ # docstring inherited
+ if self._idle_draw_id != 0:
+ return
+ def idle_draw(*args):
+ try:
+ self.draw()
+ finally:
+ self._idle_draw_id = 0
+ return False
+ self._idle_draw_id = GLib.idle_add(idle_draw)
+
+ def flush_events(self):
+ # docstring inherited
+ Gdk.threads_enter()
+ while Gtk.events_pending():
+ Gtk.main_iteration()
+ Gdk.flush()
+ Gdk.threads_leave()
+
+
+class FigureManagerGTK3(FigureManagerBase):
+ """
+ Attributes
+ ----------
+ canvas : `FigureCanvas`
+ The FigureCanvas instance
+ num : int or str
+ The Figure number
+ toolbar : Gtk.Toolbar
+ The Gtk.Toolbar
+ vbox : Gtk.VBox
+ The Gtk.VBox containing the canvas and toolbar
+ window : Gtk.Window
+ The Gtk.Window
+
+ """
+ def __init__(self, canvas, num):
+ self.window = Gtk.Window()
+ super().__init__(canvas, num)
+
+ self.window.set_wmclass("matplotlib", "Matplotlib")
+ try:
+ self.window.set_icon_from_file(window_icon)
+ except Exception:
+ # Some versions of gtk throw a glib.GError but not all, so I am not
+ # sure how to catch it. I am unhappy doing a blanket catch here,
+ # but am not sure what a better way is - JDH
+ _log.info('Could not load matplotlib icon: %s', sys.exc_info()[1])
+
+ self.vbox = Gtk.Box()
+ self.vbox.set_property("orientation", Gtk.Orientation.VERTICAL)
+ self.window.add(self.vbox)
+ self.vbox.show()
+
+ self.canvas.show()
+
+ self.vbox.pack_start(self.canvas, True, True, 0)
+ # calculate size for window
+ w = int(self.canvas.figure.bbox.width)
+ h = int(self.canvas.figure.bbox.height)
+
+ self.toolbar = self._get_toolbar()
+
+ if self.toolmanager:
+ backend_tools.add_tools_to_manager(self.toolmanager)
+ if self.toolbar:
+ backend_tools.add_tools_to_container(self.toolbar)
+
+ if self.toolbar is not None:
+ self.toolbar.show()
+ self.vbox.pack_end(self.toolbar, False, False, 0)
+ min_size, nat_size = self.toolbar.get_preferred_size()
+ h += nat_size.height
+
+ self.window.set_default_size(w, h)
+
+ self._destroying = False
+ self.window.connect("destroy", lambda *args: Gcf.destroy(self))
+ self.window.connect("delete_event", lambda *args: Gcf.destroy(self))
+ if mpl.is_interactive():
+ self.window.show()
+ self.canvas.draw_idle()
+
+ self.canvas.grab_focus()
+
+ def destroy(self, *args):
+ if self._destroying:
+ # Otherwise, this can be called twice when the user presses 'q',
+ # which calls Gcf.destroy(self), then this destroy(), then triggers
+ # Gcf.destroy(self) once again via
+ # `connect("destroy", lambda *args: Gcf.destroy(self))`.
+ return
+ self._destroying = True
+ self.vbox.destroy()
+ self.window.destroy()
+ self.canvas.destroy()
+ if self.toolbar:
+ self.toolbar.destroy()
+
+ if (Gcf.get_num_fig_managers() == 0 and not mpl.is_interactive() and
+ Gtk.main_level() >= 1):
+ Gtk.main_quit()
+
+ def show(self):
+ # show the figure window
+ self.window.show()
+ self.canvas.draw()
+ if mpl.rcParams['figure.raise_window']:
+ if self.window.get_window():
+ self.window.present()
+ else:
+ # If this is called by a callback early during init,
+ # self.window (a GtkWindow) may not have an associated
+ # low-level GdkWindow (self.window.get_window()) yet, and
+ # present() would crash.
+ _api.warn_external("Cannot raise window yet to be setup")
+
+ def full_screen_toggle(self):
+ self._full_screen_flag = not self._full_screen_flag
+ if self._full_screen_flag:
+ self.window.fullscreen()
+ else:
+ self.window.unfullscreen()
+ _full_screen_flag = False
+
+ def _get_toolbar(self):
+ # must be inited after the window, drawingArea and figure
+ # attrs are set
+ if mpl.rcParams['toolbar'] == 'toolbar2':
+ toolbar = NavigationToolbar2GTK3(self.canvas, self.window)
+ elif mpl.rcParams['toolbar'] == 'toolmanager':
+ toolbar = ToolbarGTK3(self.toolmanager)
+ else:
+ toolbar = None
+ return toolbar
+
+ def get_window_title(self):
+ return self.window.get_title()
+
+ def set_window_title(self, title):
+ self.window.set_title(title)
+
+ def resize(self, width, height):
+ """Set the canvas size in pixels."""
+ if self.toolbar:
+ toolbar_size = self.toolbar.size_request()
+ height += toolbar_size.height
+ canvas_size = self.canvas.get_allocation()
+ if canvas_size.width == canvas_size.height == 1:
+ # A canvas size of (1, 1) cannot exist in most cases, because
+ # window decorations would prevent such a small window. This call
+ # must be before the window has been mapped and widgets have been
+ # sized, so just change the window's starting size.
+ self.window.set_default_size(width, height)
+ else:
+ self.window.resize(width, height)
+
+
+class NavigationToolbar2GTK3(NavigationToolbar2, Gtk.Toolbar):
+ ctx = _api.deprecated("3.3")(property(
+ lambda self: self.canvas.get_property("window").cairo_create()))
+
+ def __init__(self, canvas, window):
+ self.win = window
+ GObject.GObject.__init__(self)
+
+ self.set_style(Gtk.ToolbarStyle.ICONS)
+
+ self._gtk_ids = {}
+ for text, tooltip_text, image_file, callback in self.toolitems:
+ if text is None:
+ self.insert(Gtk.SeparatorToolItem(), -1)
+ continue
+ image = Gtk.Image.new_from_gicon(
+ Gio.Icon.new_for_string(
+ str(cbook._get_data_path('images',
+ f'{image_file}-symbolic.svg'))),
+ Gtk.IconSize.LARGE_TOOLBAR)
+ self._gtk_ids[text] = tbutton = (
+ Gtk.ToggleToolButton() if callback in ['zoom', 'pan'] else
+ Gtk.ToolButton())
+ tbutton.set_label(text)
+ tbutton.set_icon_widget(image)
+ self.insert(tbutton, -1)
+ # Save the handler id, so that we can block it as needed.
+ tbutton._signal_handler = tbutton.connect(
+ 'clicked', getattr(self, callback))
+ tbutton.set_tooltip_text(tooltip_text)
+
+ toolitem = Gtk.SeparatorToolItem()
+ self.insert(toolitem, -1)
+ toolitem.set_draw(False)
+ toolitem.set_expand(True)
+
+ # This filler item ensures the toolbar is always at least two text
+ # lines high. Otherwise the canvas gets redrawn as the mouse hovers
+ # over images because those use two-line messages which resize the
+ # toolbar.
+ toolitem = Gtk.ToolItem()
+ self.insert(toolitem, -1)
+ label = Gtk.Label()
+ label.set_markup(
+ '\N{NO-BREAK SPACE}\n\N{NO-BREAK SPACE} ')
+ toolitem.add(label)
+
+ toolitem = Gtk.ToolItem()
+ self.insert(toolitem, -1)
+ self.message = Gtk.Label()
+ toolitem.add(self.message)
+
+ self.show_all()
+
+ NavigationToolbar2.__init__(self, canvas)
+
+ def set_message(self, s):
+ escaped = GLib.markup_escape_text(s)
+ self.message.set_markup(f'{escaped} ')
+
+ def set_cursor(self, cursor):
+ window = self.canvas.get_property("window")
+ if window is not None:
+ window.set_cursor(cursord[cursor])
+ Gtk.main_iteration()
+
+ def draw_rubberband(self, event, x0, y0, x1, y1):
+ height = self.canvas.figure.bbox.height
+ y1 = height - y1
+ y0 = height - y0
+ rect = [int(val) for val in (x0, y0, x1 - x0, y1 - y0)]
+ self.canvas._draw_rubberband(rect)
+
+ def remove_rubberband(self):
+ self.canvas._draw_rubberband(None)
+
+ def _update_buttons_checked(self):
+ for name, active in [("Pan", "PAN"), ("Zoom", "ZOOM")]:
+ button = self._gtk_ids.get(name)
+ if button:
+ with button.handler_block(button._signal_handler):
+ button.set_active(self.mode.name == active)
+
+ def pan(self, *args):
+ super().pan(*args)
+ self._update_buttons_checked()
+
+ def zoom(self, *args):
+ super().zoom(*args)
+ self._update_buttons_checked()
+
+ def save_figure(self, *args):
+ dialog = Gtk.FileChooserDialog(
+ title="Save the figure",
+ parent=self.canvas.get_toplevel(),
+ action=Gtk.FileChooserAction.SAVE,
+ buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+ Gtk.STOCK_SAVE, Gtk.ResponseType.OK),
+ )
+ for name, fmts \
+ in self.canvas.get_supported_filetypes_grouped().items():
+ ff = Gtk.FileFilter()
+ ff.set_name(name)
+ for fmt in fmts:
+ ff.add_pattern("*." + fmt)
+ dialog.add_filter(ff)
+ if self.canvas.get_default_filetype() in fmts:
+ dialog.set_filter(ff)
+
+ @functools.partial(dialog.connect, "notify::filter")
+ def on_notify_filter(*args):
+ name = dialog.get_filter().get_name()
+ fmt = self.canvas.get_supported_filetypes_grouped()[name][0]
+ dialog.set_current_name(
+ str(Path(dialog.get_current_name()).with_suffix("." + fmt)))
+
+ dialog.set_current_folder(mpl.rcParams["savefig.directory"])
+ dialog.set_current_name(self.canvas.get_default_filename())
+ dialog.set_do_overwrite_confirmation(True)
+
+ response = dialog.run()
+ fname = dialog.get_filename()
+ ff = dialog.get_filter() # Doesn't autoadjust to filename :/
+ fmt = self.canvas.get_supported_filetypes_grouped()[ff.get_name()][0]
+ dialog.destroy()
+ if response != Gtk.ResponseType.OK:
+ return
+ # Save dir for next time, unless empty str (which means use cwd).
+ if mpl.rcParams['savefig.directory']:
+ mpl.rcParams['savefig.directory'] = os.path.dirname(fname)
+ try:
+ self.canvas.figure.savefig(fname, format=fmt)
+ except Exception as e:
+ error_msg_gtk(str(e), parent=self)
+
+ def set_history_buttons(self):
+ can_backward = self._nav_stack._pos > 0
+ can_forward = self._nav_stack._pos < len(self._nav_stack._elements) - 1
+ if 'Back' in self._gtk_ids:
+ self._gtk_ids['Back'].set_sensitive(can_backward)
+ if 'Forward' in self._gtk_ids:
+ self._gtk_ids['Forward'].set_sensitive(can_forward)
+
+
+class ToolbarGTK3(ToolContainerBase, Gtk.Box):
+ _icon_extension = '-symbolic.svg'
+
+ def __init__(self, toolmanager):
+ ToolContainerBase.__init__(self, toolmanager)
+ Gtk.Box.__init__(self)
+ self.set_property('orientation', Gtk.Orientation.HORIZONTAL)
+ self._message = Gtk.Label()
+ self.pack_end(self._message, False, False, 0)
+ self.show_all()
+ self._groups = {}
+ self._toolitems = {}
+
+ def add_toolitem(self, name, group, position, image_file, description,
+ toggle):
+ if toggle:
+ tbutton = Gtk.ToggleToolButton()
+ else:
+ tbutton = Gtk.ToolButton()
+ tbutton.set_label(name)
+
+ if image_file is not None:
+ image = Gtk.Image.new_from_gicon(
+ Gio.Icon.new_for_string(image_file),
+ Gtk.IconSize.LARGE_TOOLBAR)
+ tbutton.set_icon_widget(image)
+
+ if position is None:
+ position = -1
+
+ self._add_button(tbutton, group, position)
+ signal = tbutton.connect('clicked', self._call_tool, name)
+ tbutton.set_tooltip_text(description)
+ tbutton.show_all()
+ self._toolitems.setdefault(name, [])
+ self._toolitems[name].append((tbutton, signal))
+
+ def _add_button(self, button, group, position):
+ if group not in self._groups:
+ if self._groups:
+ self._add_separator()
+ toolbar = Gtk.Toolbar()
+ toolbar.set_style(Gtk.ToolbarStyle.ICONS)
+ self.pack_start(toolbar, False, False, 0)
+ toolbar.show_all()
+ self._groups[group] = toolbar
+ self._groups[group].insert(button, position)
+
+ def _call_tool(self, btn, name):
+ self.trigger_tool(name)
+
+ def toggle_toolitem(self, name, toggled):
+ if name not in self._toolitems:
+ return
+ for toolitem, signal in self._toolitems[name]:
+ toolitem.handler_block(signal)
+ toolitem.set_active(toggled)
+ toolitem.handler_unblock(signal)
+
+ def remove_toolitem(self, name):
+ if name not in self._toolitems:
+ self.toolmanager.message_event('%s Not in toolbar' % name, self)
+ return
+
+ for group in self._groups:
+ for toolitem, _signal in self._toolitems[name]:
+ if toolitem in self._groups[group]:
+ self._groups[group].remove(toolitem)
+ del self._toolitems[name]
+
+ def _add_separator(self):
+ sep = Gtk.Separator()
+ sep.set_property("orientation", Gtk.Orientation.VERTICAL)
+ self.pack_start(sep, False, True, 0)
+ sep.show_all()
+
+ def set_message(self, s):
+ self._message.set_label(s)
+
+
+@_api.deprecated("3.3")
+class StatusbarGTK3(StatusbarBase, Gtk.Statusbar):
+ def __init__(self, *args, **kwargs):
+ StatusbarBase.__init__(self, *args, **kwargs)
+ Gtk.Statusbar.__init__(self)
+ self._context = self.get_context_id('message')
+
+ def set_message(self, s):
+ self.pop(self._context)
+ self.push(self._context, s)
+
+
+class RubberbandGTK3(backend_tools.RubberbandBase):
+ def draw_rubberband(self, x0, y0, x1, y1):
+ NavigationToolbar2GTK3.draw_rubberband(
+ self._make_classic_style_pseudo_toolbar(), None, x0, y0, x1, y1)
+
+ def remove_rubberband(self):
+ NavigationToolbar2GTK3.remove_rubberband(
+ self._make_classic_style_pseudo_toolbar())
+
+
+class SaveFigureGTK3(backend_tools.SaveFigureBase):
+ def trigger(self, *args, **kwargs):
+
+ class PseudoToolbar:
+ canvas = self.figure.canvas
+
+ return NavigationToolbar2GTK3.save_figure(PseudoToolbar())
+
+
+class SetCursorGTK3(backend_tools.SetCursorBase):
+ def set_cursor(self, cursor):
+ NavigationToolbar2GTK3.set_cursor(
+ self._make_classic_style_pseudo_toolbar(), cursor)
+
+
+class ConfigureSubplotsGTK3(backend_tools.ConfigureSubplotsBase, Gtk.Window):
+ def _get_canvas(self, fig):
+ return self.canvas.__class__(fig)
+
+ def trigger(self, *args):
+ NavigationToolbar2GTK3.configure_subplots(
+ self._make_classic_style_pseudo_toolbar(), None)
+
+
+class HelpGTK3(backend_tools.ToolHelpBase):
+ def _normalize_shortcut(self, key):
+ """
+ Convert Matplotlib key presses to GTK+ accelerator identifiers.
+
+ Related to `FigureCanvasGTK3._get_key`.
+ """
+ special = {
+ 'backspace': 'BackSpace',
+ 'pagedown': 'Page_Down',
+ 'pageup': 'Page_Up',
+ 'scroll_lock': 'Scroll_Lock',
+ }
+
+ parts = key.split('+')
+ mods = ['<' + mod + '>' for mod in parts[:-1]]
+ key = parts[-1]
+
+ if key in special:
+ key = special[key]
+ elif len(key) > 1:
+ key = key.capitalize()
+ elif key.isupper():
+ mods += ['']
+
+ return ''.join(mods) + key
+
+ def _is_valid_shortcut(self, key):
+ """
+ Check for a valid shortcut to be displayed.
+
+ - GTK will never send 'cmd+' (see `FigureCanvasGTK3._get_key`).
+ - The shortcut window only shows keyboard shortcuts, not mouse buttons.
+ """
+ return 'cmd+' not in key and not key.startswith('MouseButton.')
+
+ def _show_shortcuts_window(self):
+ section = Gtk.ShortcutsSection()
+
+ for name, tool in sorted(self.toolmanager.tools.items()):
+ if not tool.description:
+ continue
+
+ # Putting everything in a separate group allows GTK to
+ # automatically split them into separate columns/pages, which is
+ # useful because we have lots of shortcuts, some with many keys
+ # that are very wide.
+ group = Gtk.ShortcutsGroup()
+ section.add(group)
+ # A hack to remove the title since we have no group naming.
+ group.forall(lambda widget, data: widget.set_visible(False), None)
+
+ shortcut = Gtk.ShortcutsShortcut(
+ accelerator=' '.join(
+ self._normalize_shortcut(key)
+ for key in self.toolmanager.get_tool_keymap(name)
+ if self._is_valid_shortcut(key)),
+ title=tool.name,
+ subtitle=tool.description)
+ group.add(shortcut)
+
+ window = Gtk.ShortcutsWindow(
+ title='Help',
+ modal=True,
+ transient_for=self._figure.canvas.get_toplevel())
+ section.show() # Must be done explicitly before add!
+ window.add(section)
+
+ window.show_all()
+
+ def _show_shortcuts_dialog(self):
+ dialog = Gtk.MessageDialog(
+ self._figure.canvas.get_toplevel(),
+ 0, Gtk.MessageType.INFO, Gtk.ButtonsType.OK, self._get_help_text(),
+ title="Help")
+ dialog.run()
+ dialog.destroy()
+
+ def trigger(self, *args):
+ if Gtk.check_version(3, 20, 0) is None:
+ self._show_shortcuts_window()
+ else:
+ self._show_shortcuts_dialog()
+
+
+class ToolCopyToClipboardGTK3(backend_tools.ToolCopyToClipboardBase):
+ def trigger(self, *args, **kwargs):
+ clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
+ window = self.canvas.get_window()
+ x, y, width, height = window.get_geometry()
+ pb = Gdk.pixbuf_get_from_window(window, x, y, width, height)
+ clipboard.set_image(pb)
+
+
+# Define the file to use as the GTk icon
+if sys.platform == 'win32':
+ icon_filename = 'matplotlib.png'
+else:
+ icon_filename = 'matplotlib.svg'
+window_icon = str(cbook._get_data_path('images', icon_filename))
+
+
+def error_msg_gtk(msg, parent=None):
+ if parent is not None: # find the toplevel Gtk.Window
+ parent = parent.get_toplevel()
+ if not parent.is_toplevel():
+ parent = None
+ if not isinstance(msg, str):
+ msg = ','.join(map(str, msg))
+ dialog = Gtk.MessageDialog(
+ parent=parent, type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.OK,
+ message_format=msg)
+ dialog.run()
+ dialog.destroy()
+
+
+backend_tools.ToolSaveFigure = SaveFigureGTK3
+backend_tools.ToolConfigureSubplots = ConfigureSubplotsGTK3
+backend_tools.ToolSetCursor = SetCursorGTK3
+backend_tools.ToolRubberband = RubberbandGTK3
+backend_tools.ToolHelp = HelpGTK3
+backend_tools.ToolCopyToClipboard = ToolCopyToClipboardGTK3
+
+Toolbar = ToolbarGTK3
+
+
+@_Backend.export
+class _BackendGTK3(_Backend):
+ FigureCanvas = FigureCanvasGTK3
+ FigureManager = FigureManagerGTK3
+
+ @staticmethod
+ def mainloop():
+ if Gtk.main_level() == 0:
+ cbook._setup_new_guiapp()
+ Gtk.main()
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_gtk3agg.py b/venv/Lib/site-packages/matplotlib/backends/backend_gtk3agg.py
new file mode 100644
index 0000000..ecd1532
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_gtk3agg.py
@@ -0,0 +1,86 @@
+import numpy as np
+
+from .. import cbook
+try:
+ from . import backend_cairo
+except ImportError as e:
+ raise ImportError('backend Gtk3Agg requires cairo') from e
+from . import backend_agg, backend_gtk3
+from .backend_cairo import cairo
+from .backend_gtk3 import Gtk, _BackendGTK3
+from matplotlib import transforms
+
+
+class FigureCanvasGTK3Agg(backend_gtk3.FigureCanvasGTK3,
+ backend_agg.FigureCanvasAgg):
+ def __init__(self, figure):
+ backend_gtk3.FigureCanvasGTK3.__init__(self, figure)
+ self._bbox_queue = []
+
+ def on_draw_event(self, widget, ctx):
+ """GtkDrawable draw event, like expose_event in GTK 2.X."""
+ allocation = self.get_allocation()
+ w, h = allocation.width, allocation.height
+
+ if not len(self._bbox_queue):
+ Gtk.render_background(
+ self.get_style_context(), ctx,
+ allocation.x, allocation.y,
+ allocation.width, allocation.height)
+ bbox_queue = [transforms.Bbox([[0, 0], [w, h]])]
+ else:
+ bbox_queue = self._bbox_queue
+
+ ctx = backend_cairo._to_context(ctx)
+
+ for bbox in bbox_queue:
+ x = int(bbox.x0)
+ y = h - int(bbox.y1)
+ width = int(bbox.x1) - int(bbox.x0)
+ height = int(bbox.y1) - int(bbox.y0)
+
+ buf = cbook._unmultiplied_rgba8888_to_premultiplied_argb32(
+ np.asarray(self.copy_from_bbox(bbox)))
+ image = cairo.ImageSurface.create_for_data(
+ buf.ravel().data, cairo.FORMAT_ARGB32, width, height)
+ ctx.set_source_surface(image, x, y)
+ ctx.paint()
+
+ if len(self._bbox_queue):
+ self._bbox_queue = []
+
+ return False
+
+ def blit(self, bbox=None):
+ # If bbox is None, blit the entire canvas to gtk. Otherwise
+ # blit only the area defined by the bbox.
+ if bbox is None:
+ bbox = self.figure.bbox
+
+ allocation = self.get_allocation()
+ x = int(bbox.x0)
+ y = allocation.height - int(bbox.y1)
+ width = int(bbox.x1) - int(bbox.x0)
+ height = int(bbox.y1) - int(bbox.y0)
+
+ self._bbox_queue.append(bbox)
+ self.queue_draw_area(x, y, width, height)
+
+ def draw(self):
+ backend_agg.FigureCanvasAgg.draw(self)
+ super().draw()
+
+ def print_png(self, filename, *args, **kwargs):
+ # Do this so we can save the resolution of figure in the PNG file
+ agg = self.switch_backends(backend_agg.FigureCanvasAgg)
+ return agg.print_png(filename, *args, **kwargs)
+
+
+class FigureManagerGTK3Agg(backend_gtk3.FigureManagerGTK3):
+ pass
+
+
+@_BackendGTK3.export
+class _BackendGTK3Cairo(_BackendGTK3):
+ FigureCanvas = FigureCanvasGTK3Agg
+ FigureManager = FigureManagerGTK3Agg
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_gtk3cairo.py b/venv/Lib/site-packages/matplotlib/backends/backend_gtk3cairo.py
new file mode 100644
index 0000000..af29090
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_gtk3cairo.py
@@ -0,0 +1,36 @@
+from contextlib import nullcontext
+
+from . import backend_cairo, backend_gtk3
+from .backend_gtk3 import Gtk, _BackendGTK3
+
+
+class RendererGTK3Cairo(backend_cairo.RendererCairo):
+ def set_context(self, ctx):
+ self.gc.ctx = backend_cairo._to_context(ctx)
+
+
+class FigureCanvasGTK3Cairo(backend_gtk3.FigureCanvasGTK3,
+ backend_cairo.FigureCanvasCairo):
+
+ def __init__(self, figure):
+ super().__init__(figure)
+ self._renderer = RendererGTK3Cairo(self.figure.dpi)
+
+ def on_draw_event(self, widget, ctx):
+ """GtkDrawable draw event."""
+ with (self.toolbar._wait_cursor_for_draw_cm() if self.toolbar
+ else nullcontext()):
+ self._renderer.set_context(ctx)
+ allocation = self.get_allocation()
+ Gtk.render_background(
+ self.get_style_context(), ctx,
+ allocation.x, allocation.y,
+ allocation.width, allocation.height)
+ self._renderer.set_width_height(
+ allocation.width, allocation.height)
+ self.figure.draw(self._renderer)
+
+
+@_BackendGTK3.export
+class _BackendGTK3Cairo(_BackendGTK3):
+ FigureCanvas = FigureCanvasGTK3Cairo
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_macosx.py b/venv/Lib/site-packages/matplotlib/backends/backend_macosx.py
new file mode 100644
index 0000000..c84087f
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_macosx.py
@@ -0,0 +1,140 @@
+import matplotlib as mpl
+from matplotlib import cbook
+from matplotlib._pylab_helpers import Gcf
+from matplotlib.backends import _macosx
+from matplotlib.backends.backend_agg import FigureCanvasAgg
+from matplotlib.backend_bases import (
+ _Backend, FigureCanvasBase, FigureManagerBase, NavigationToolbar2,
+ TimerBase)
+from matplotlib.figure import Figure
+from matplotlib.widgets import SubplotTool
+
+
+class TimerMac(_macosx.Timer, TimerBase):
+ """Subclass of `.TimerBase` using CFRunLoop timer events."""
+ # completely implemented at the C-level (in _macosx.Timer)
+
+
+class FigureCanvasMac(_macosx.FigureCanvas, FigureCanvasAgg):
+ # docstring inherited
+
+ # Events such as button presses, mouse movements, and key presses
+ # are handled in the C code and the base class methods
+ # button_press_event, button_release_event, motion_notify_event,
+ # key_press_event, and key_release_event are called from there.
+
+ required_interactive_framework = "macosx"
+ _timer_cls = TimerMac
+
+ def __init__(self, figure):
+ FigureCanvasBase.__init__(self, figure)
+ width, height = self.get_width_height()
+ _macosx.FigureCanvas.__init__(self, width, height)
+ self._dpi_ratio = 1.0
+
+ def _set_device_scale(self, value):
+ if self._dpi_ratio != value:
+ # Need the new value in place before setting figure.dpi, which
+ # will trigger a resize
+ self._dpi_ratio, old_value = value, self._dpi_ratio
+ self.figure.dpi = self.figure.dpi / old_value * self._dpi_ratio
+
+ def _draw(self):
+ renderer = self.get_renderer(cleared=self.figure.stale)
+ if self.figure.stale:
+ self.figure.draw(renderer)
+ return renderer
+
+ def draw(self):
+ # docstring inherited
+ self.draw_idle()
+ self.flush_events()
+
+ # draw_idle is provided by _macosx.FigureCanvas
+
+ def blit(self, bbox=None):
+ self.draw_idle()
+
+ def resize(self, width, height):
+ dpi = self.figure.dpi
+ width /= dpi
+ height /= dpi
+ self.figure.set_size_inches(width * self._dpi_ratio,
+ height * self._dpi_ratio,
+ forward=False)
+ FigureCanvasBase.resize_event(self)
+ self.draw_idle()
+
+
+class FigureManagerMac(_macosx.FigureManager, FigureManagerBase):
+ """
+ Wrap everything up into a window for the pylab interface
+ """
+ def __init__(self, canvas, num):
+ _macosx.FigureManager.__init__(self, canvas)
+ FigureManagerBase.__init__(self, canvas, num)
+ if mpl.rcParams['toolbar'] == 'toolbar2':
+ self.toolbar = NavigationToolbar2Mac(canvas)
+ else:
+ self.toolbar = None
+ if self.toolbar is not None:
+ self.toolbar.update()
+
+ if mpl.is_interactive():
+ self.show()
+ self.canvas.draw_idle()
+
+ def close(self):
+ Gcf.destroy(self)
+
+
+class NavigationToolbar2Mac(_macosx.NavigationToolbar2, NavigationToolbar2):
+
+ def __init__(self, canvas):
+ self.canvas = canvas # Needed by the _macosx __init__.
+ data_path = cbook._get_data_path('images')
+ _, tooltips, image_names, _ = zip(*NavigationToolbar2.toolitems)
+ _macosx.NavigationToolbar2.__init__(
+ self,
+ tuple(str(data_path / image_name) + ".pdf"
+ for image_name in image_names if image_name is not None),
+ tuple(tooltip for tooltip in tooltips if tooltip is not None))
+ NavigationToolbar2.__init__(self, canvas)
+
+ def draw_rubberband(self, event, x0, y0, x1, y1):
+ self.canvas.set_rubberband(int(x0), int(y0), int(x1), int(y1))
+
+ def release_zoom(self, event):
+ super().release_zoom(event)
+ self.canvas.remove_rubberband()
+
+ def set_cursor(self, cursor):
+ _macosx.set_cursor(cursor)
+
+ def save_figure(self, *args):
+ filename = _macosx.choose_save_file('Save the figure',
+ self.canvas.get_default_filename())
+ if filename is None: # Cancel
+ return
+ self.canvas.figure.savefig(filename)
+
+ def prepare_configure_subplots(self):
+ toolfig = Figure(figsize=(6, 3))
+ canvas = FigureCanvasMac(toolfig)
+ toolfig.subplots_adjust(top=0.9)
+ # Need to keep a reference to the tool.
+ _tool = SubplotTool(self.canvas.figure, toolfig)
+ return canvas
+
+ def set_message(self, message):
+ _macosx.NavigationToolbar2.set_message(self, message.encode('utf-8'))
+
+
+@_Backend.export
+class _BackendMac(_Backend):
+ FigureCanvas = FigureCanvasMac
+ FigureManager = FigureManagerMac
+
+ @staticmethod
+ def mainloop():
+ _macosx.show()
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_mixed.py b/venv/Lib/site-packages/matplotlib/backends/backend_mixed.py
new file mode 100644
index 0000000..54ca8f8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_mixed.py
@@ -0,0 +1,119 @@
+import numpy as np
+
+from matplotlib import cbook
+from matplotlib.backends.backend_agg import RendererAgg
+from matplotlib.tight_bbox import process_figure_for_rasterizing
+
+
+class MixedModeRenderer:
+ """
+ A helper class to implement a renderer that switches between
+ vector and raster drawing. An example may be a PDF writer, where
+ most things are drawn with PDF vector commands, but some very
+ complex objects, such as quad meshes, are rasterised and then
+ output as images.
+ """
+ def __init__(self, figure, width, height, dpi, vector_renderer,
+ raster_renderer_class=None,
+ bbox_inches_restore=None):
+ """
+ Parameters
+ ----------
+ figure : `matplotlib.figure.Figure`
+ The figure instance.
+ width : scalar
+ The width of the canvas in logical units
+ height : scalar
+ The height of the canvas in logical units
+ dpi : float
+ The dpi of the canvas
+ vector_renderer : `matplotlib.backend_bases.RendererBase`
+ An instance of a subclass of
+ `~matplotlib.backend_bases.RendererBase` that will be used for the
+ vector drawing.
+ raster_renderer_class : `matplotlib.backend_bases.RendererBase`
+ The renderer class to use for the raster drawing. If not provided,
+ this will use the Agg backend (which is currently the only viable
+ option anyway.)
+
+ """
+ if raster_renderer_class is None:
+ raster_renderer_class = RendererAgg
+
+ self._raster_renderer_class = raster_renderer_class
+ self._width = width
+ self._height = height
+ self.dpi = dpi
+
+ self._vector_renderer = vector_renderer
+
+ self._raster_renderer = None
+
+ # A reference to the figure is needed as we need to change
+ # the figure dpi before and after the rasterization. Although
+ # this looks ugly, I couldn't find a better solution. -JJL
+ self.figure = figure
+ self._figdpi = figure.get_dpi()
+
+ self._bbox_inches_restore = bbox_inches_restore
+
+ self._renderer = vector_renderer
+
+ def __getattr__(self, attr):
+ # Proxy everything that hasn't been overridden to the base
+ # renderer. Things that *are* overridden can call methods
+ # on self._renderer directly, but must not cache/store
+ # methods (because things like RendererAgg change their
+ # methods on the fly in order to optimise proxying down
+ # to the underlying C implementation).
+ return getattr(self._renderer, attr)
+
+ def start_rasterizing(self):
+ """
+ Enter "raster" mode. All subsequent drawing commands (until
+ `stop_rasterizing` is called) will be drawn with the raster backend.
+ """
+ # change the dpi of the figure temporarily.
+ self.figure.set_dpi(self.dpi)
+ if self._bbox_inches_restore: # when tight bbox is used
+ r = process_figure_for_rasterizing(self.figure,
+ self._bbox_inches_restore)
+ self._bbox_inches_restore = r
+
+ self._raster_renderer = self._raster_renderer_class(
+ self._width*self.dpi, self._height*self.dpi, self.dpi)
+ self._renderer = self._raster_renderer
+
+ def stop_rasterizing(self):
+ """
+ Exit "raster" mode. All of the drawing that was done since
+ the last `start_rasterizing` call will be copied to the
+ vector backend by calling draw_image.
+ """
+
+ self._renderer = self._vector_renderer
+
+ height = self._height * self.dpi
+ img = np.asarray(self._raster_renderer.buffer_rgba())
+ slice_y, slice_x = cbook._get_nonzero_slices(img[..., 3])
+ cropped_img = img[slice_y, slice_x]
+ if cropped_img.size:
+ gc = self._renderer.new_gc()
+ # TODO: If the mixedmode resolution differs from the figure's
+ # dpi, the image must be scaled (dpi->_figdpi). Not all
+ # backends support this.
+ self._renderer.draw_image(
+ gc,
+ slice_x.start * self._figdpi / self.dpi,
+ (height - slice_y.stop) * self._figdpi / self.dpi,
+ cropped_img[::-1])
+ self._raster_renderer = None
+
+ # restore the figure dpi.
+ self.figure.set_dpi(self._figdpi)
+
+ if self._bbox_inches_restore: # when tight bbox is used
+ r = process_figure_for_rasterizing(self.figure,
+ self._bbox_inches_restore,
+ self._figdpi)
+ self._bbox_inches_restore = r
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_nbagg.py b/venv/Lib/site-packages/matplotlib/backends/backend_nbagg.py
new file mode 100644
index 0000000..0fb8b03
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_nbagg.py
@@ -0,0 +1,267 @@
+"""Interactive figures in the IPython notebook"""
+# Note: There is a notebook in
+# lib/matplotlib/backends/web_backend/nbagg_uat.ipynb to help verify
+# that changes made maintain expected behaviour.
+
+from base64 import b64encode
+import io
+import json
+import pathlib
+import uuid
+
+from IPython.display import display, Javascript, HTML
+try:
+ # Jupyter/IPython 4.x or later
+ from ipykernel.comm import Comm
+except ImportError:
+ # Jupyter/IPython 3.x or earlier
+ from IPython.kernel.comm import Comm
+
+from matplotlib import is_interactive
+from matplotlib._pylab_helpers import Gcf
+from matplotlib.backend_bases import _Backend, NavigationToolbar2
+from matplotlib.backends.backend_webagg_core import (
+ FigureCanvasWebAggCore, FigureManagerWebAgg, NavigationToolbar2WebAgg,
+ TimerTornado)
+
+
+def connection_info():
+ """
+ Return a string showing the figure and connection status for the backend.
+
+ This is intended as a diagnostic tool, and not for general use.
+ """
+ result = [
+ '{fig} - {socket}'.format(
+ fig=(manager.canvas.figure.get_label()
+ or "Figure {}".format(manager.num)),
+ socket=manager.web_sockets)
+ for manager in Gcf.get_all_fig_managers()
+ ]
+ if not is_interactive():
+ result.append(f'Figures pending show: {len(Gcf.figs)}')
+ return '\n'.join(result)
+
+
+# Note: Version 3.2 and 4.x icons
+# http://fontawesome.io/3.2.1/icons/
+# http://fontawesome.io/
+# the `fa fa-xxx` part targets font-awesome 4, (IPython 3.x)
+# the icon-xxx targets font awesome 3.21 (IPython 2.x)
+_FONT_AWESOME_CLASSES = {
+ 'home': 'fa fa-home icon-home',
+ 'back': 'fa fa-arrow-left icon-arrow-left',
+ 'forward': 'fa fa-arrow-right icon-arrow-right',
+ 'zoom_to_rect': 'fa fa-square-o icon-check-empty',
+ 'move': 'fa fa-arrows icon-move',
+ 'download': 'fa fa-floppy-o icon-save',
+ None: None
+}
+
+
+class NavigationIPy(NavigationToolbar2WebAgg):
+
+ # Use the standard toolbar items + download button
+ toolitems = [(text, tooltip_text,
+ _FONT_AWESOME_CLASSES[image_file], name_of_method)
+ for text, tooltip_text, image_file, name_of_method
+ in (NavigationToolbar2.toolitems +
+ (('Download', 'Download plot', 'download', 'download'),))
+ if image_file in _FONT_AWESOME_CLASSES]
+
+
+class FigureManagerNbAgg(FigureManagerWebAgg):
+ ToolbarCls = NavigationIPy
+
+ def __init__(self, canvas, num):
+ self._shown = False
+ super().__init__(canvas, num)
+
+ def display_js(self):
+ # XXX How to do this just once? It has to deal with multiple
+ # browser instances using the same kernel (require.js - but the
+ # file isn't static?).
+ display(Javascript(FigureManagerNbAgg.get_javascript()))
+
+ def show(self):
+ if not self._shown:
+ self.display_js()
+ self._create_comm()
+ else:
+ self.canvas.draw_idle()
+ self._shown = True
+
+ def reshow(self):
+ """
+ A special method to re-show the figure in the notebook.
+
+ """
+ self._shown = False
+ self.show()
+
+ @property
+ def connected(self):
+ return bool(self.web_sockets)
+
+ @classmethod
+ def get_javascript(cls, stream=None):
+ if stream is None:
+ output = io.StringIO()
+ else:
+ output = stream
+ super().get_javascript(stream=output)
+ output.write((pathlib.Path(__file__).parent
+ / "web_backend/js/nbagg_mpl.js")
+ .read_text(encoding="utf-8"))
+ if stream is None:
+ return output.getvalue()
+
+ def _create_comm(self):
+ comm = CommSocket(self)
+ self.add_web_socket(comm)
+ return comm
+
+ def destroy(self):
+ self._send_event('close')
+ # need to copy comms as callbacks will modify this list
+ for comm in list(self.web_sockets):
+ comm.on_close()
+ self.clearup_closed()
+
+ def clearup_closed(self):
+ """Clear up any closed Comms."""
+ self.web_sockets = {socket for socket in self.web_sockets
+ if socket.is_open()}
+
+ if len(self.web_sockets) == 0:
+ self.canvas.close_event()
+
+ def remove_comm(self, comm_id):
+ self.web_sockets = {socket for socket in self.web_sockets
+ if socket.comm.comm_id != comm_id}
+
+
+class FigureCanvasNbAgg(FigureCanvasWebAggCore):
+ pass
+
+
+class CommSocket:
+ """
+ Manages the Comm connection between IPython and the browser (client).
+
+ Comms are 2 way, with the CommSocket being able to publish a message
+ via the send_json method, and handle a message with on_message. On the
+ JS side figure.send_message and figure.ws.onmessage do the sending and
+ receiving respectively.
+
+ """
+ def __init__(self, manager):
+ self.supports_binary = None
+ self.manager = manager
+ self.uuid = str(uuid.uuid4())
+ # Publish an output area with a unique ID. The javascript can then
+ # hook into this area.
+ display(HTML("
" % self.uuid))
+ try:
+ self.comm = Comm('matplotlib', data={'id': self.uuid})
+ except AttributeError as err:
+ raise RuntimeError('Unable to create an IPython notebook Comm '
+ 'instance. Are you in the IPython '
+ 'notebook?') from err
+ self.comm.on_msg(self.on_message)
+
+ manager = self.manager
+ self._ext_close = False
+
+ def _on_close(close_message):
+ self._ext_close = True
+ manager.remove_comm(close_message['content']['comm_id'])
+ manager.clearup_closed()
+
+ self.comm.on_close(_on_close)
+
+ def is_open(self):
+ return not (self._ext_close or self.comm._closed)
+
+ def on_close(self):
+ # When the socket is closed, deregister the websocket with
+ # the FigureManager.
+ if self.is_open():
+ try:
+ self.comm.close()
+ except KeyError:
+ # apparently already cleaned it up?
+ pass
+
+ def send_json(self, content):
+ self.comm.send({'data': json.dumps(content)})
+
+ def send_binary(self, blob):
+ if self.supports_binary:
+ self.comm.send({'blob': 'image/png'}, buffers=[blob])
+ else:
+ # The comm is ASCII, so we send the image in base64 encoded data
+ # URL form.
+ data = b64encode(blob).decode('ascii')
+ data_uri = "data:image/png;base64,{0}".format(data)
+ self.comm.send({'data': data_uri})
+
+ def on_message(self, message):
+ # The 'supports_binary' message is relevant to the
+ # websocket itself. The other messages get passed along
+ # to matplotlib as-is.
+
+ # Every message has a "type" and a "figure_id".
+ message = json.loads(message['content']['data'])
+ if message['type'] == 'closing':
+ self.on_close()
+ self.manager.clearup_closed()
+ elif message['type'] == 'supports_binary':
+ self.supports_binary = message['value']
+ else:
+ self.manager.handle_json(message)
+
+
+@_Backend.export
+class _BackendNbAgg(_Backend):
+ FigureCanvas = FigureCanvasNbAgg
+ FigureManager = FigureManagerNbAgg
+
+ @staticmethod
+ def new_figure_manager_given_figure(num, figure):
+ canvas = FigureCanvasNbAgg(figure)
+ manager = FigureManagerNbAgg(canvas, num)
+ if is_interactive():
+ manager.show()
+ figure.canvas.draw_idle()
+
+ def destroy(event):
+ canvas.mpl_disconnect(cid)
+ Gcf.destroy(manager)
+
+ cid = canvas.mpl_connect('close_event', destroy)
+ return manager
+
+ @staticmethod
+ def show(block=None):
+ ## TODO: something to do when keyword block==False ?
+ from matplotlib._pylab_helpers import Gcf
+
+ managers = Gcf.get_all_fig_managers()
+ if not managers:
+ return
+
+ interactive = is_interactive()
+
+ for manager in managers:
+ manager.show()
+
+ # plt.figure adds an event which makes the figure in focus the
+ # active one. Disable this behaviour, as it results in
+ # figures being put as the active figure after they have been
+ # shown, even in non-interactive mode.
+ if hasattr(manager, '_cidgcf'):
+ manager.canvas.mpl_disconnect(manager._cidgcf)
+
+ if not interactive:
+ Gcf.figs.pop(manager.num, None)
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_pdf.py b/venv/Lib/site-packages/matplotlib/backends/backend_pdf.py
new file mode 100644
index 0000000..26a1276
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_pdf.py
@@ -0,0 +1,2745 @@
+"""
+A PDF matplotlib backend
+Author: Jouni K Seppänen
+"""
+
+import codecs
+import collections
+from datetime import datetime
+from enum import Enum
+from functools import total_ordering
+from io import BytesIO
+import itertools
+import logging
+import math
+import os
+import re
+import struct
+import time
+import types
+import warnings
+import zlib
+
+import numpy as np
+from PIL import Image
+
+import matplotlib as mpl
+from matplotlib import _api, _text_layout, cbook
+from matplotlib._pylab_helpers import Gcf
+from matplotlib.backend_bases import (
+ _Backend, _check_savefig_extra_args, FigureCanvasBase, FigureManagerBase,
+ GraphicsContextBase, RendererBase, _no_output_draw)
+from matplotlib.backends.backend_mixed import MixedModeRenderer
+from matplotlib.figure import Figure
+from matplotlib.font_manager import findfont, get_font
+from matplotlib.afm import AFM
+import matplotlib.type1font as type1font
+import matplotlib.dviread as dviread
+from matplotlib.ft2font import (FIXED_WIDTH, ITALIC, LOAD_NO_SCALE,
+ LOAD_NO_HINTING, KERNING_UNFITTED)
+from matplotlib.mathtext import MathTextParser
+from matplotlib.transforms import Affine2D, BboxBase
+from matplotlib.path import Path
+from matplotlib.dates import UTC
+from matplotlib import _path
+from . import _backend_pdf_ps
+
+_log = logging.getLogger(__name__)
+
+# Overview
+#
+# The low-level knowledge about pdf syntax lies mainly in the pdfRepr
+# function and the classes Reference, Name, Operator, and Stream. The
+# PdfFile class knows about the overall structure of pdf documents.
+# It provides a "write" method for writing arbitrary strings in the
+# file, and an "output" method that passes objects through the pdfRepr
+# function before writing them in the file. The output method is
+# called by the RendererPdf class, which contains the various draw_foo
+# methods. RendererPdf contains a GraphicsContextPdf instance, and
+# each draw_foo calls self.check_gc before outputting commands. This
+# method checks whether the pdf graphics state needs to be modified
+# and outputs the necessary commands. GraphicsContextPdf represents
+# the graphics state, and its "delta" method returns the commands that
+# modify the state.
+
+# Add "pdf.use14corefonts: True" in your configuration file to use only
+# the 14 PDF core fonts. These fonts do not need to be embedded; every
+# PDF viewing application is required to have them. This results in very
+# light PDF files you can use directly in LaTeX or ConTeXt documents
+# generated with pdfTeX, without any conversion.
+
+# These fonts are: Helvetica, Helvetica-Bold, Helvetica-Oblique,
+# Helvetica-BoldOblique, Courier, Courier-Bold, Courier-Oblique,
+# Courier-BoldOblique, Times-Roman, Times-Bold, Times-Italic,
+# Times-BoldItalic, Symbol, ZapfDingbats.
+#
+# Some tricky points:
+#
+# 1. The clip path can only be widened by popping from the state
+# stack. Thus the state must be pushed onto the stack before narrowing
+# the clip path. This is taken care of by GraphicsContextPdf.
+#
+# 2. Sometimes it is necessary to refer to something (e.g., font,
+# image, or extended graphics state, which contains the alpha value)
+# in the page stream by a name that needs to be defined outside the
+# stream. PdfFile provides the methods fontName, imageObject, and
+# alphaState for this purpose. The implementations of these methods
+# should perhaps be generalized.
+
+# TODOs:
+#
+# * encoding of fonts, including mathtext fonts and unicode support
+# * TTF support has lots of small TODOs, e.g., how do you know if a font
+# is serif/sans-serif, or symbolic/non-symbolic?
+# * draw_quad_mesh
+
+
+def fill(strings, linelen=75):
+ """
+ Make one string from sequence of strings, with whitespace in between.
+
+ The whitespace is chosen to form lines of at most *linelen* characters,
+ if possible.
+ """
+ currpos = 0
+ lasti = 0
+ result = []
+ for i, s in enumerate(strings):
+ length = len(s)
+ if currpos + length < linelen:
+ currpos += length + 1
+ else:
+ result.append(b' '.join(strings[lasti:i]))
+ lasti = i
+ currpos = length
+ result.append(b' '.join(strings[lasti:]))
+ return b'\n'.join(result)
+
+# PDF strings are supposed to be able to include any eight-bit data,
+# except that unbalanced parens and backslashes must be escaped by a
+# backslash. However, sf bug #2708559 shows that the carriage return
+# character may get read as a newline; these characters correspond to
+# \gamma and \Omega in TeX's math font encoding. Escaping them fixes
+# the bug.
+_string_escape_regex = re.compile(br'([\\()\r\n])')
+
+
+def _string_escape(match):
+ m = match.group(0)
+ if m in br'\()':
+ return b'\\' + m
+ elif m == b'\n':
+ return br'\n'
+ elif m == b'\r':
+ return br'\r'
+ assert False
+
+
+def _create_pdf_info_dict(backend, metadata):
+ """
+ Create a PDF infoDict based on user-supplied metadata.
+
+ A default ``Creator``, ``Producer``, and ``CreationDate`` are added, though
+ the user metadata may override it. The date may be the current time, or a
+ time set by the ``SOURCE_DATE_EPOCH`` environment variable.
+
+ Metadata is verified to have the correct keys and their expected types. Any
+ unknown keys/types will raise a warning.
+
+ Parameters
+ ----------
+ backend : str
+ The name of the backend to use in the Producer value.
+
+ metadata : dict[str, Union[str, datetime, Name]]
+ A dictionary of metadata supplied by the user with information
+ following the PDF specification, also defined in
+ `~.backend_pdf.PdfPages` below.
+
+ If any value is *None*, then the key will be removed. This can be used
+ to remove any pre-defined values.
+
+ Returns
+ -------
+ dict[str, Union[str, datetime, Name]]
+ A validated dictionary of metadata.
+ """
+
+ # get source date from SOURCE_DATE_EPOCH, if set
+ # See https://reproducible-builds.org/specs/source-date-epoch/
+ source_date_epoch = os.getenv("SOURCE_DATE_EPOCH")
+ if source_date_epoch:
+ source_date = datetime.utcfromtimestamp(int(source_date_epoch))
+ source_date = source_date.replace(tzinfo=UTC)
+ else:
+ source_date = datetime.today()
+
+ info = {
+ 'Creator': f'Matplotlib v{mpl.__version__}, https://matplotlib.org',
+ 'Producer': f'Matplotlib {backend} backend v{mpl.__version__}',
+ 'CreationDate': source_date,
+ **metadata
+ }
+ info = {k: v for (k, v) in info.items() if v is not None}
+
+ def is_string_like(x):
+ return isinstance(x, str)
+ is_string_like.text_for_warning = "an instance of str"
+
+ def is_date(x):
+ return isinstance(x, datetime)
+ is_date.text_for_warning = "an instance of datetime.datetime"
+
+ def check_trapped(x):
+ if isinstance(x, Name):
+ return x.name in (b'True', b'False', b'Unknown')
+ else:
+ return x in ('True', 'False', 'Unknown')
+ check_trapped.text_for_warning = 'one of {"True", "False", "Unknown"}'
+
+ keywords = {
+ 'Title': is_string_like,
+ 'Author': is_string_like,
+ 'Subject': is_string_like,
+ 'Keywords': is_string_like,
+ 'Creator': is_string_like,
+ 'Producer': is_string_like,
+ 'CreationDate': is_date,
+ 'ModDate': is_date,
+ 'Trapped': check_trapped,
+ }
+ for k in info:
+ if k not in keywords:
+ _api.warn_external(f'Unknown infodict keyword: {k!r}. '
+ f'Must be one of {set(keywords)!r}.')
+ elif not keywords[k](info[k]):
+ _api.warn_external(f'Bad value for infodict keyword {k}. '
+ f'Got {info[k]!r} which is not '
+ f'{keywords[k].text_for_warning}.')
+ if 'Trapped' in info:
+ info['Trapped'] = Name(info['Trapped'])
+
+ return info
+
+
+def _datetime_to_pdf(d):
+ """
+ Convert a datetime to a PDF string representing it.
+
+ Used for PDF and PGF.
+ """
+ r = d.strftime('D:%Y%m%d%H%M%S')
+ z = d.utcoffset()
+ if z is not None:
+ z = z.seconds
+ else:
+ if time.daylight:
+ z = time.altzone
+ else:
+ z = time.timezone
+ if z == 0:
+ r += 'Z'
+ elif z < 0:
+ r += "+%02d'%02d'" % ((-z) // 3600, (-z) % 3600)
+ else:
+ r += "-%02d'%02d'" % (z // 3600, z % 3600)
+ return r
+
+
+def pdfRepr(obj):
+ """Map Python objects to PDF syntax."""
+
+ # Some objects defined later have their own pdfRepr method.
+ if hasattr(obj, 'pdfRepr'):
+ return obj.pdfRepr()
+
+ # Floats. PDF does not have exponential notation (1.0e-10) so we
+ # need to use %f with some precision. Perhaps the precision
+ # should adapt to the magnitude of the number?
+ elif isinstance(obj, (float, np.floating)):
+ if not np.isfinite(obj):
+ raise ValueError("Can only output finite numbers in PDF")
+ r = b"%.10f" % obj
+ return r.rstrip(b'0').rstrip(b'.')
+
+ # Booleans. Needs to be tested before integers since
+ # isinstance(True, int) is true.
+ elif isinstance(obj, bool):
+ return [b'false', b'true'][obj]
+
+ # Integers are written as such.
+ elif isinstance(obj, (int, np.integer)):
+ return b"%d" % obj
+
+ # Unicode strings are encoded in UTF-16BE with byte-order mark.
+ elif isinstance(obj, str):
+ try:
+ # But maybe it's really ASCII?
+ s = obj.encode('ASCII')
+ return pdfRepr(s)
+ except UnicodeEncodeError:
+ s = codecs.BOM_UTF16_BE + obj.encode('UTF-16BE')
+ return pdfRepr(s)
+
+ # Strings are written in parentheses, with backslashes and parens
+ # escaped. Actually balanced parens are allowed, but it is
+ # simpler to escape them all. TODO: cut long strings into lines;
+ # I believe there is some maximum line length in PDF.
+ elif isinstance(obj, bytes):
+ return b'(' + _string_escape_regex.sub(_string_escape, obj) + b')'
+
+ # Dictionaries. The keys must be PDF names, so if we find strings
+ # there, we make Name objects from them. The values may be
+ # anything, so the caller must ensure that PDF names are
+ # represented as Name objects.
+ elif isinstance(obj, dict):
+ return fill([
+ b"<<",
+ *[Name(key).pdfRepr() + b" " + pdfRepr(obj[key])
+ for key in sorted(obj)],
+ b">>",
+ ])
+
+ # Lists.
+ elif isinstance(obj, (list, tuple)):
+ return fill([b"[", *[pdfRepr(val) for val in obj], b"]"])
+
+ # The null keyword.
+ elif obj is None:
+ return b'null'
+
+ # A date.
+ elif isinstance(obj, datetime):
+ return pdfRepr(_datetime_to_pdf(obj))
+
+ # A bounding box
+ elif isinstance(obj, BboxBase):
+ return fill([pdfRepr(val) for val in obj.bounds])
+
+ else:
+ raise TypeError("Don't know a PDF representation for {} objects"
+ .format(type(obj)))
+
+
+class Reference:
+ """
+ PDF reference object.
+
+ Use PdfFile.reserveObject() to create References.
+ """
+
+ def __init__(self, id):
+ self.id = id
+
+ def __repr__(self):
+ return "" % self.id
+
+ def pdfRepr(self):
+ return b"%d 0 R" % self.id
+
+ def write(self, contents, file):
+ write = file.write
+ write(b"%d 0 obj\n" % self.id)
+ write(pdfRepr(contents))
+ write(b"\nendobj\n")
+
+
+@total_ordering
+class Name:
+ """PDF name object."""
+ __slots__ = ('name',)
+ _regex = re.compile(r'[^!-~]')
+
+ def __init__(self, name):
+ if isinstance(name, Name):
+ self.name = name.name
+ else:
+ if isinstance(name, bytes):
+ name = name.decode('ascii')
+ self.name = self._regex.sub(Name.hexify, name).encode('ascii')
+
+ def __repr__(self):
+ return "" % self.name
+
+ def __str__(self):
+ return '/' + str(self.name)
+
+ def __eq__(self, other):
+ return isinstance(other, Name) and self.name == other.name
+
+ def __lt__(self, other):
+ return isinstance(other, Name) and self.name < other.name
+
+ def __hash__(self):
+ return hash(self.name)
+
+ @staticmethod
+ def hexify(match):
+ return '#%02x' % ord(match.group())
+
+ def pdfRepr(self):
+ return b'/' + self.name
+
+
+class Operator:
+ """PDF operator object."""
+ __slots__ = ('op',)
+
+ def __init__(self, op):
+ self.op = op
+
+ def __repr__(self):
+ return '' % self.op
+
+ def pdfRepr(self):
+ return self.op
+
+
+class Verbatim:
+ """Store verbatim PDF command content for later inclusion in the stream."""
+ def __init__(self, x):
+ self._x = x
+
+ def pdfRepr(self):
+ return self._x
+
+
+# PDF operators (not an exhaustive list)
+class Op(Operator, Enum):
+ close_fill_stroke = b'b'
+ fill_stroke = b'B'
+ fill = b'f'
+ closepath = b'h',
+ close_stroke = b's'
+ stroke = b'S'
+ endpath = b'n'
+ begin_text = b'BT',
+ end_text = b'ET'
+ curveto = b'c'
+ rectangle = b're'
+ lineto = b'l'
+ moveto = b'm',
+ concat_matrix = b'cm'
+ use_xobject = b'Do'
+ setgray_stroke = b'G',
+ setgray_nonstroke = b'g'
+ setrgb_stroke = b'RG'
+ setrgb_nonstroke = b'rg',
+ setcolorspace_stroke = b'CS'
+ setcolorspace_nonstroke = b'cs',
+ setcolor_stroke = b'SCN'
+ setcolor_nonstroke = b'scn'
+ setdash = b'd',
+ setlinejoin = b'j'
+ setlinecap = b'J'
+ setgstate = b'gs'
+ gsave = b'q',
+ grestore = b'Q'
+ textpos = b'Td'
+ selectfont = b'Tf'
+ textmatrix = b'Tm',
+ show = b'Tj'
+ showkern = b'TJ'
+ setlinewidth = b'w'
+ clip = b'W'
+ shading = b'sh'
+
+ @classmethod
+ def paint_path(cls, fill, stroke):
+ """
+ Return the PDF operator to paint a path.
+
+ Parameters
+ ----------
+ fill : bool
+ Fill the path with the fill color.
+ stroke : bool
+ Stroke the outline of the path with the line color.
+ """
+ if stroke:
+ if fill:
+ return cls.fill_stroke
+ else:
+ return cls.stroke
+ else:
+ if fill:
+ return cls.fill
+ else:
+ return cls.endpath
+
+
+class Stream:
+ """
+ PDF stream object.
+
+ This has no pdfRepr method. Instead, call begin(), then output the
+ contents of the stream by calling write(), and finally call end().
+ """
+ __slots__ = ('id', 'len', 'pdfFile', 'file', 'compressobj', 'extra', 'pos')
+
+ def __init__(self, id, len, file, extra=None, png=None):
+ """
+ Parameters
+ ----------
+ id : int
+ Object id of the stream.
+ len : Reference or None
+ An unused Reference object for the length of the stream;
+ None means to use a memory buffer so the length can be inlined.
+ file : PdfFile
+ The underlying object to write the stream to.
+ extra : dict from Name to anything, or None
+ Extra key-value pairs to include in the stream header.
+ png : dict or None
+ If the data is already png encoded, the decode parameters.
+ """
+ self.id = id # object id
+ self.len = len # id of length object
+ self.pdfFile = file
+ self.file = file.fh # file to which the stream is written
+ self.compressobj = None # compression object
+ if extra is None:
+ self.extra = dict()
+ else:
+ self.extra = extra.copy()
+ if png is not None:
+ self.extra.update({'Filter': Name('FlateDecode'),
+ 'DecodeParms': png})
+
+ self.pdfFile.recordXref(self.id)
+ if mpl.rcParams['pdf.compression'] and not png:
+ self.compressobj = zlib.compressobj(
+ mpl.rcParams['pdf.compression'])
+ if self.len is None:
+ self.file = BytesIO()
+ else:
+ self._writeHeader()
+ self.pos = self.file.tell()
+
+ def _writeHeader(self):
+ write = self.file.write
+ write(b"%d 0 obj\n" % self.id)
+ dict = self.extra
+ dict['Length'] = self.len
+ if mpl.rcParams['pdf.compression']:
+ dict['Filter'] = Name('FlateDecode')
+
+ write(pdfRepr(dict))
+ write(b"\nstream\n")
+
+ def end(self):
+ """Finalize stream."""
+
+ self._flush()
+ if self.len is None:
+ contents = self.file.getvalue()
+ self.len = len(contents)
+ self.file = self.pdfFile.fh
+ self._writeHeader()
+ self.file.write(contents)
+ self.file.write(b"\nendstream\nendobj\n")
+ else:
+ length = self.file.tell() - self.pos
+ self.file.write(b"\nendstream\nendobj\n")
+ self.pdfFile.writeObject(self.len, length)
+
+ def write(self, data):
+ """Write some data on the stream."""
+
+ if self.compressobj is None:
+ self.file.write(data)
+ else:
+ compressed = self.compressobj.compress(data)
+ self.file.write(compressed)
+
+ def _flush(self):
+ """Flush the compression object."""
+
+ if self.compressobj is not None:
+ compressed = self.compressobj.flush()
+ self.file.write(compressed)
+ self.compressobj = None
+
+
+def _get_pdf_charprocs(font_path, glyph_ids):
+ font = get_font(font_path, hinting_factor=1)
+ conv = 1000 / font.units_per_EM # Conversion to PS units (1/1000's).
+ procs = {}
+ for glyph_id in glyph_ids:
+ g = font.load_glyph(glyph_id, LOAD_NO_SCALE)
+ # NOTE: We should be using round(), but instead use
+ # "(x+.5).astype(int)" to keep backcompat with the old ttconv code
+ # (this is different for negative x's).
+ d1 = (np.array([g.horiAdvance, 0, *g.bbox]) * conv + .5).astype(int)
+ v, c = font.get_path()
+ v = (v * 64).astype(int) # Back to TrueType's internal units (1/64's).
+ # Backcompat with old ttconv code: control points between two quads are
+ # omitted if they are exactly at the midpoint between the control of
+ # the quad before and the quad after, but ttconv used to interpolate
+ # *after* conversion to PS units, causing floating point errors. Here
+ # we reproduce ttconv's logic, detecting these "implicit" points and
+ # re-interpolating them. Note that occasionally (e.g. with DejaVu Sans
+ # glyph "0") a point detected as "implicit" is actually explicit, and
+ # will thus be shifted by 1.
+ quads, = np.nonzero(c == 3)
+ quads_on = quads[1::2]
+ quads_mid_on = np.array(
+ sorted({*quads_on} & {*(quads - 1)} & {*(quads + 1)}), int)
+ implicit = quads_mid_on[
+ (v[quads_mid_on] # As above, use astype(int), not // division
+ == ((v[quads_mid_on - 1] + v[quads_mid_on + 1]) / 2).astype(int))
+ .all(axis=1)]
+ if (font.postscript_name, glyph_id) in [
+ ("DejaVuSerif-Italic", 77), # j
+ ("DejaVuSerif-Italic", 135), # \AA
+ ]:
+ v[:, 0] -= 1 # Hard-coded backcompat (FreeType shifts glyph by 1).
+ v = (v * conv + .5).astype(int) # As above re: truncation vs rounding.
+ v[implicit] = (( # Fix implicit points; again, truncate.
+ (v[implicit - 1] + v[implicit + 1]) / 2).astype(int))
+ procs[font.get_glyph_name(glyph_id)] = (
+ " ".join(map(str, d1)).encode("ascii") + b" d1\n"
+ + _path.convert_to_string(
+ Path(v, c), None, None, False, None, -1,
+ # no code for quad Beziers triggers auto-conversion to cubics.
+ [b"m", b"l", b"", b"c", b"h"], True)
+ + b"f")
+ return procs
+
+
+class PdfFile:
+ """PDF file object."""
+
+ def __init__(self, filename, metadata=None):
+ """
+ Parameters
+ ----------
+ filename : str or path-like or file-like
+ Output target; if a string, a file will be opened for writing.
+
+ metadata : dict from strings to strings and dates
+ Information dictionary object (see PDF reference section 10.2.1
+ 'Document Information Dictionary'), e.g.:
+ ``{'Creator': 'My software', 'Author': 'Me', 'Title': 'Awesome'}``.
+
+ The standard keys are 'Title', 'Author', 'Subject', 'Keywords',
+ 'Creator', 'Producer', 'CreationDate', 'ModDate', and
+ 'Trapped'. Values have been predefined for 'Creator', 'Producer'
+ and 'CreationDate'. They can be removed by setting them to `None`.
+ """
+ super().__init__()
+
+ self._object_seq = itertools.count(1) # consumed by reserveObject
+ self.xrefTable = [[0, 65535, 'the zero object']]
+ self.passed_in_file_object = False
+ self.original_file_like = None
+ self.tell_base = 0
+ fh, opened = cbook.to_filehandle(filename, "wb", return_opened=True)
+ if not opened:
+ try:
+ self.tell_base = filename.tell()
+ except IOError:
+ fh = BytesIO()
+ self.original_file_like = filename
+ else:
+ fh = filename
+ self.passed_in_file_object = True
+
+ self.fh = fh
+ self.currentstream = None # stream object to write to, if any
+ fh.write(b"%PDF-1.4\n") # 1.4 is the first version to have alpha
+ # Output some eight-bit chars as a comment so various utilities
+ # recognize the file as binary by looking at the first few
+ # lines (see note in section 3.4.1 of the PDF reference).
+ fh.write(b"%\254\334 \253\272\n")
+
+ self.rootObject = self.reserveObject('root')
+ self.pagesObject = self.reserveObject('pages')
+ self.pageList = []
+ self.fontObject = self.reserveObject('fonts')
+ self._extGStateObject = self.reserveObject('extended graphics states')
+ self.hatchObject = self.reserveObject('tiling patterns')
+ self.gouraudObject = self.reserveObject('Gouraud triangles')
+ self.XObjectObject = self.reserveObject('external objects')
+ self.resourceObject = self.reserveObject('resources')
+
+ root = {'Type': Name('Catalog'),
+ 'Pages': self.pagesObject}
+ self.writeObject(self.rootObject, root)
+
+ self.infoDict = _create_pdf_info_dict('pdf', metadata or {})
+
+ self.fontNames = {} # maps filenames to internal font names
+ self._internal_font_seq = (Name(f'F{i}') for i in itertools.count(1))
+ self.dviFontInfo = {} # maps dvi font names to embedding information
+ # differently encoded Type-1 fonts may share the same descriptor
+ self.type1Descriptors = {}
+ self._character_tracker = _backend_pdf_ps.CharacterTracker()
+
+ self.alphaStates = {} # maps alpha values to graphics state objects
+ self._alpha_state_seq = (Name(f'A{i}') for i in itertools.count(1))
+ self._soft_mask_states = {}
+ self._soft_mask_seq = (Name(f'SM{i}') for i in itertools.count(1))
+ self._soft_mask_groups = []
+ # reproducible writeHatches needs an ordered dict:
+ self.hatchPatterns = collections.OrderedDict()
+ self._hatch_pattern_seq = (Name(f'H{i}') for i in itertools.count(1))
+ self.gouraudTriangles = []
+
+ self._images = collections.OrderedDict() # reproducible writeImages
+ self._image_seq = (Name(f'I{i}') for i in itertools.count(1))
+
+ self.markers = collections.OrderedDict() # reproducible writeMarkers
+ self.multi_byte_charprocs = {}
+
+ self.paths = []
+
+ # A list of annotations for each page. Each entry is a tuple of the
+ # overall Annots object reference that's inserted into the page object,
+ # followed by a list of the actual annotations.
+ self._annotations = []
+ # For annotations added before a page is created; mostly for the
+ # purpose of newTextnote.
+ self.pageAnnotations = []
+
+ # The PDF spec recommends to include every procset
+ procsets = [Name(x) for x in "PDF Text ImageB ImageC ImageI".split()]
+
+ # Write resource dictionary.
+ # Possibly TODO: more general ExtGState (graphics state dictionaries)
+ # ColorSpace Pattern Shading Properties
+ resources = {'Font': self.fontObject,
+ 'XObject': self.XObjectObject,
+ 'ExtGState': self._extGStateObject,
+ 'Pattern': self.hatchObject,
+ 'Shading': self.gouraudObject,
+ 'ProcSet': procsets}
+ self.writeObject(self.resourceObject, resources)
+
+ @_api.deprecated("3.3")
+ @property
+ def used_characters(self):
+ return self.file._character_tracker.used_characters
+
+ def newPage(self, width, height):
+ self.endStream()
+
+ self.width, self.height = width, height
+ contentObject = self.reserveObject('page contents')
+ annotsObject = self.reserveObject('annotations')
+ thePage = {'Type': Name('Page'),
+ 'Parent': self.pagesObject,
+ 'Resources': self.resourceObject,
+ 'MediaBox': [0, 0, 72 * width, 72 * height],
+ 'Contents': contentObject,
+ 'Group': {'Type': Name('Group'),
+ 'S': Name('Transparency'),
+ 'CS': Name('DeviceRGB')},
+ 'Annots': annotsObject,
+ }
+ pageObject = self.reserveObject('page')
+ self.writeObject(pageObject, thePage)
+ self.pageList.append(pageObject)
+ self._annotations.append((annotsObject, self.pageAnnotations))
+
+ self.beginStream(contentObject.id,
+ self.reserveObject('length of content stream'))
+ # Initialize the pdf graphics state to match the default mpl
+ # graphics context: currently only the join style needs to be set
+ self.output(GraphicsContextPdf.joinstyles['round'], Op.setlinejoin)
+
+ # Clear the list of annotations for the next page
+ self.pageAnnotations = []
+
+ def newTextnote(self, text, positionRect=[-100, -100, 0, 0]):
+ # Create a new annotation of type text
+ theNote = {'Type': Name('Annot'),
+ 'Subtype': Name('Text'),
+ 'Contents': text,
+ 'Rect': positionRect,
+ }
+ self.pageAnnotations.append(theNote)
+
+ def finalize(self):
+ """Write out the various deferred objects and the pdf end matter."""
+
+ self.endStream()
+ self._write_annotations()
+ self.writeFonts()
+ self.writeExtGSTates()
+ self._write_soft_mask_groups()
+ self.writeHatches()
+ self.writeGouraudTriangles()
+ xobjects = {
+ name: ob for image, name, ob in self._images.values()}
+ for tup in self.markers.values():
+ xobjects[tup[0]] = tup[1]
+ for name, value in self.multi_byte_charprocs.items():
+ xobjects[name] = value
+ for name, path, trans, ob, join, cap, padding, filled, stroked \
+ in self.paths:
+ xobjects[name] = ob
+ self.writeObject(self.XObjectObject, xobjects)
+ self.writeImages()
+ self.writeMarkers()
+ self.writePathCollectionTemplates()
+ self.writeObject(self.pagesObject,
+ {'Type': Name('Pages'),
+ 'Kids': self.pageList,
+ 'Count': len(self.pageList)})
+ self.writeInfoDict()
+
+ # Finalize the file
+ self.writeXref()
+ self.writeTrailer()
+
+ def close(self):
+ """Flush all buffers and free all resources."""
+
+ self.endStream()
+ if self.passed_in_file_object:
+ self.fh.flush()
+ else:
+ if self.original_file_like is not None:
+ self.original_file_like.write(self.fh.getvalue())
+ self.fh.close()
+
+ def write(self, data):
+ if self.currentstream is None:
+ self.fh.write(data)
+ else:
+ self.currentstream.write(data)
+
+ def output(self, *data):
+ self.write(fill([pdfRepr(x) for x in data]))
+ self.write(b'\n')
+
+ def beginStream(self, id, len, extra=None, png=None):
+ assert self.currentstream is None
+ self.currentstream = Stream(id, len, self, extra, png)
+
+ def endStream(self):
+ if self.currentstream is not None:
+ self.currentstream.end()
+ self.currentstream = None
+
+ def _write_annotations(self):
+ for annotsObject, annotations in self._annotations:
+ self.writeObject(annotsObject, annotations)
+
+ def fontName(self, fontprop):
+ """
+ Select a font based on fontprop and return a name suitable for
+ Op.selectfont. If fontprop is a string, it will be interpreted
+ as the filename of the font.
+ """
+
+ if isinstance(fontprop, str):
+ filename = fontprop
+ elif mpl.rcParams['pdf.use14corefonts']:
+ filename = findfont(
+ fontprop, fontext='afm', directory=RendererPdf._afm_font_dir)
+ else:
+ filename = findfont(fontprop)
+
+ Fx = self.fontNames.get(filename)
+ if Fx is None:
+ Fx = next(self._internal_font_seq)
+ self.fontNames[filename] = Fx
+ _log.debug('Assigning font %s = %r', Fx, filename)
+
+ return Fx
+
+ def dviFontName(self, dvifont):
+ """
+ Given a dvi font object, return a name suitable for Op.selectfont.
+ This registers the font information in ``self.dviFontInfo`` if not yet
+ registered.
+ """
+
+ dvi_info = self.dviFontInfo.get(dvifont.texname)
+ if dvi_info is not None:
+ return dvi_info.pdfname
+
+ tex_font_map = dviread.PsfontsMap(dviread.find_tex_file('pdftex.map'))
+ psfont = tex_font_map[dvifont.texname]
+ if psfont.filename is None:
+ raise ValueError(
+ "No usable font file found for {} (TeX: {}); "
+ "the font may lack a Type-1 version"
+ .format(psfont.psname, dvifont.texname))
+
+ pdfname = next(self._internal_font_seq)
+ _log.debug('Assigning font %s = %s (dvi)', pdfname, dvifont.texname)
+ self.dviFontInfo[dvifont.texname] = types.SimpleNamespace(
+ dvifont=dvifont,
+ pdfname=pdfname,
+ fontfile=psfont.filename,
+ basefont=psfont.psname,
+ encodingfile=psfont.encoding,
+ effects=psfont.effects)
+ return pdfname
+
+ def writeFonts(self):
+ fonts = {}
+ for dviname, info in sorted(self.dviFontInfo.items()):
+ Fx = info.pdfname
+ _log.debug('Embedding Type-1 font %s from dvi.', dviname)
+ fonts[Fx] = self._embedTeXFont(info)
+ for filename in sorted(self.fontNames):
+ Fx = self.fontNames[filename]
+ _log.debug('Embedding font %s.', filename)
+ if filename.endswith('.afm'):
+ # from pdf.use14corefonts
+ _log.debug('Writing AFM font.')
+ fonts[Fx] = self._write_afm_font(filename)
+ else:
+ # a normal TrueType font
+ _log.debug('Writing TrueType font.')
+ chars = self._character_tracker.used.get(filename)
+ if chars:
+ fonts[Fx] = self.embedTTF(filename, chars)
+ self.writeObject(self.fontObject, fonts)
+
+ def _write_afm_font(self, filename):
+ with open(filename, 'rb') as fh:
+ font = AFM(fh)
+ fontname = font.get_fontname()
+ fontdict = {'Type': Name('Font'),
+ 'Subtype': Name('Type1'),
+ 'BaseFont': Name(fontname),
+ 'Encoding': Name('WinAnsiEncoding')}
+ fontdictObject = self.reserveObject('font dictionary')
+ self.writeObject(fontdictObject, fontdict)
+ return fontdictObject
+
+ def _embedTeXFont(self, fontinfo):
+ _log.debug('Embedding TeX font %s - fontinfo=%s',
+ fontinfo.dvifont.texname, fontinfo.__dict__)
+
+ # Widths
+ widthsObject = self.reserveObject('font widths')
+ self.writeObject(widthsObject, fontinfo.dvifont.widths)
+
+ # Font dictionary
+ fontdictObject = self.reserveObject('font dictionary')
+ fontdict = {
+ 'Type': Name('Font'),
+ 'Subtype': Name('Type1'),
+ 'FirstChar': 0,
+ 'LastChar': len(fontinfo.dvifont.widths) - 1,
+ 'Widths': widthsObject,
+ }
+
+ # Encoding (if needed)
+ if fontinfo.encodingfile is not None:
+ fontdict['Encoding'] = {
+ 'Type': Name('Encoding'),
+ 'Differences': [
+ 0, *map(Name, dviread._parse_enc(fontinfo.encodingfile))],
+ }
+
+ # If no file is specified, stop short
+ if fontinfo.fontfile is None:
+ _log.warning(
+ "Because of TeX configuration (pdftex.map, see updmap option "
+ "pdftexDownloadBase14) the font %s is not embedded. This is "
+ "deprecated as of PDF 1.5 and it may cause the consumer "
+ "application to show something that was not intended.",
+ fontinfo.basefont)
+ fontdict['BaseFont'] = Name(fontinfo.basefont)
+ self.writeObject(fontdictObject, fontdict)
+ return fontdictObject
+
+ # We have a font file to embed - read it in and apply any effects
+ t1font = type1font.Type1Font(fontinfo.fontfile)
+ if fontinfo.effects:
+ t1font = t1font.transform(fontinfo.effects)
+ fontdict['BaseFont'] = Name(t1font.prop['FontName'])
+
+ # Font descriptors may be shared between differently encoded
+ # Type-1 fonts, so only create a new descriptor if there is no
+ # existing descriptor for this font.
+ effects = (fontinfo.effects.get('slant', 0.0),
+ fontinfo.effects.get('extend', 1.0))
+ fontdesc = self.type1Descriptors.get((fontinfo.fontfile, effects))
+ if fontdesc is None:
+ fontdesc = self.createType1Descriptor(t1font, fontinfo.fontfile)
+ self.type1Descriptors[(fontinfo.fontfile, effects)] = fontdesc
+ fontdict['FontDescriptor'] = fontdesc
+
+ self.writeObject(fontdictObject, fontdict)
+ return fontdictObject
+
+ def createType1Descriptor(self, t1font, fontfile):
+ # Create and write the font descriptor and the font file
+ # of a Type-1 font
+ fontdescObject = self.reserveObject('font descriptor')
+ fontfileObject = self.reserveObject('font file')
+
+ italic_angle = t1font.prop['ItalicAngle']
+ fixed_pitch = t1font.prop['isFixedPitch']
+
+ flags = 0
+ # fixed width
+ if fixed_pitch:
+ flags |= 1 << 0
+ # TODO: serif
+ if 0:
+ flags |= 1 << 1
+ # TODO: symbolic (most TeX fonts are)
+ if 1:
+ flags |= 1 << 2
+ # non-symbolic
+ else:
+ flags |= 1 << 5
+ # italic
+ if italic_angle:
+ flags |= 1 << 6
+ # TODO: all caps
+ if 0:
+ flags |= 1 << 16
+ # TODO: small caps
+ if 0:
+ flags |= 1 << 17
+ # TODO: force bold
+ if 0:
+ flags |= 1 << 18
+
+ ft2font = get_font(fontfile)
+
+ descriptor = {
+ 'Type': Name('FontDescriptor'),
+ 'FontName': Name(t1font.prop['FontName']),
+ 'Flags': flags,
+ 'FontBBox': ft2font.bbox,
+ 'ItalicAngle': italic_angle,
+ 'Ascent': ft2font.ascender,
+ 'Descent': ft2font.descender,
+ 'CapHeight': 1000, # TODO: find this out
+ 'XHeight': 500, # TODO: this one too
+ 'FontFile': fontfileObject,
+ 'FontFamily': t1font.prop['FamilyName'],
+ 'StemV': 50, # TODO
+ # (see also revision 3874; but not all TeX distros have AFM files!)
+ # 'FontWeight': a number where 400 = Regular, 700 = Bold
+ }
+
+ self.writeObject(fontdescObject, descriptor)
+
+ self.beginStream(fontfileObject.id, None,
+ {'Length1': len(t1font.parts[0]),
+ 'Length2': len(t1font.parts[1]),
+ 'Length3': 0})
+ self.currentstream.write(t1font.parts[0])
+ self.currentstream.write(t1font.parts[1])
+ self.endStream()
+
+ return fontdescObject
+
+ def _get_xobject_symbol_name(self, filename, symbol_name):
+ Fx = self.fontName(filename)
+ return "-".join([
+ Fx.name.decode(),
+ os.path.splitext(os.path.basename(filename))[0],
+ symbol_name])
+
+ _identityToUnicodeCMap = b"""/CIDInit /ProcSet findresource begin
+12 dict begin
+begincmap
+/CIDSystemInfo
+<< /Registry (Adobe)
+ /Ordering (UCS)
+ /Supplement 0
+>> def
+/CMapName /Adobe-Identity-UCS def
+/CMapType 2 def
+1 begincodespacerange
+<0000>
+endcodespacerange
+%d beginbfrange
+%s
+endbfrange
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+end"""
+
+ def embedTTF(self, filename, characters):
+ """Embed the TTF font from the named file into the document."""
+
+ font = get_font(filename)
+ fonttype = mpl.rcParams['pdf.fonttype']
+
+ def cvt(length, upe=font.units_per_EM, nearest=True):
+ """Convert font coordinates to PDF glyph coordinates."""
+ value = length / upe * 1000
+ if nearest:
+ return round(value)
+ # Best(?) to round away from zero for bounding boxes and the like.
+ if value < 0:
+ return math.floor(value)
+ else:
+ return math.ceil(value)
+
+ def embedTTFType3(font, characters, descriptor):
+ """The Type 3-specific part of embedding a Truetype font"""
+ widthsObject = self.reserveObject('font widths')
+ fontdescObject = self.reserveObject('font descriptor')
+ fontdictObject = self.reserveObject('font dictionary')
+ charprocsObject = self.reserveObject('character procs')
+ differencesArray = []
+ firstchar, lastchar = 0, 255
+ bbox = [cvt(x, nearest=False) for x in font.bbox]
+
+ fontdict = {
+ 'Type': Name('Font'),
+ 'BaseFont': ps_name,
+ 'FirstChar': firstchar,
+ 'LastChar': lastchar,
+ 'FontDescriptor': fontdescObject,
+ 'Subtype': Name('Type3'),
+ 'Name': descriptor['FontName'],
+ 'FontBBox': bbox,
+ 'FontMatrix': [.001, 0, 0, .001, 0, 0],
+ 'CharProcs': charprocsObject,
+ 'Encoding': {
+ 'Type': Name('Encoding'),
+ 'Differences': differencesArray},
+ 'Widths': widthsObject
+ }
+
+ from encodings import cp1252
+
+ # Make the "Widths" array
+ def get_char_width(charcode):
+ s = ord(cp1252.decoding_table[charcode])
+ width = font.load_char(
+ s, flags=LOAD_NO_SCALE | LOAD_NO_HINTING).horiAdvance
+ return cvt(width)
+
+ with warnings.catch_warnings():
+ # Ignore 'Required glyph missing from current font' warning
+ # from ft2font: here we're just building the widths table, but
+ # the missing glyphs may not even be used in the actual string.
+ warnings.filterwarnings("ignore")
+ widths = [get_char_width(charcode)
+ for charcode in range(firstchar, lastchar+1)]
+ descriptor['MaxWidth'] = max(widths)
+
+ # Make the "Differences" array, sort the ccodes < 255 from
+ # the multi-byte ccodes, and build the whole set of glyph ids
+ # that we need from this font.
+ glyph_ids = []
+ differences = []
+ multi_byte_chars = set()
+ for c in characters:
+ ccode = c
+ gind = font.get_char_index(ccode)
+ glyph_ids.append(gind)
+ glyph_name = font.get_glyph_name(gind)
+ if ccode <= 255:
+ differences.append((ccode, glyph_name))
+ else:
+ multi_byte_chars.add(glyph_name)
+ differences.sort()
+
+ last_c = -2
+ for c, name in differences:
+ if c != last_c + 1:
+ differencesArray.append(c)
+ differencesArray.append(Name(name))
+ last_c = c
+
+ # Make the charprocs array.
+ rawcharprocs = _get_pdf_charprocs(filename, glyph_ids)
+ charprocs = {}
+ for charname in sorted(rawcharprocs):
+ stream = rawcharprocs[charname]
+ charprocDict = {'Length': len(stream)}
+ # The 2-byte characters are used as XObjects, so they
+ # need extra info in their dictionary
+ if charname in multi_byte_chars:
+ charprocDict['Type'] = Name('XObject')
+ charprocDict['Subtype'] = Name('Form')
+ charprocDict['BBox'] = bbox
+ # Each glyph includes bounding box information,
+ # but xpdf and ghostscript can't handle it in a
+ # Form XObject (they segfault!!!), so we remove it
+ # from the stream here. It's not needed anyway,
+ # since the Form XObject includes it in its BBox
+ # value.
+ stream = stream[stream.find(b"d1") + 2:]
+ charprocObject = self.reserveObject('charProc')
+ self.beginStream(charprocObject.id, None, charprocDict)
+ self.currentstream.write(stream)
+ self.endStream()
+
+ # Send the glyphs with ccode > 255 to the XObject dictionary,
+ # and the others to the font itself
+ if charname in multi_byte_chars:
+ name = self._get_xobject_symbol_name(filename, charname)
+ self.multi_byte_charprocs[name] = charprocObject
+ else:
+ charprocs[charname] = charprocObject
+
+ # Write everything out
+ self.writeObject(fontdictObject, fontdict)
+ self.writeObject(fontdescObject, descriptor)
+ self.writeObject(widthsObject, widths)
+ self.writeObject(charprocsObject, charprocs)
+
+ return fontdictObject
+
+ def embedTTFType42(font, characters, descriptor):
+ """The Type 42-specific part of embedding a Truetype font"""
+ fontdescObject = self.reserveObject('font descriptor')
+ cidFontDictObject = self.reserveObject('CID font dictionary')
+ type0FontDictObject = self.reserveObject('Type 0 font dictionary')
+ cidToGidMapObject = self.reserveObject('CIDToGIDMap stream')
+ fontfileObject = self.reserveObject('font file stream')
+ wObject = self.reserveObject('Type 0 widths')
+ toUnicodeMapObject = self.reserveObject('ToUnicode map')
+
+ cidFontDict = {
+ 'Type': Name('Font'),
+ 'Subtype': Name('CIDFontType2'),
+ 'BaseFont': ps_name,
+ 'CIDSystemInfo': {
+ 'Registry': 'Adobe',
+ 'Ordering': 'Identity',
+ 'Supplement': 0},
+ 'FontDescriptor': fontdescObject,
+ 'W': wObject,
+ 'CIDToGIDMap': cidToGidMapObject
+ }
+
+ type0FontDict = {
+ 'Type': Name('Font'),
+ 'Subtype': Name('Type0'),
+ 'BaseFont': ps_name,
+ 'Encoding': Name('Identity-H'),
+ 'DescendantFonts': [cidFontDictObject],
+ 'ToUnicode': toUnicodeMapObject
+ }
+
+ # Make fontfile stream
+ descriptor['FontFile2'] = fontfileObject
+ length1Object = self.reserveObject('decoded length of a font')
+ self.beginStream(
+ fontfileObject.id,
+ self.reserveObject('length of font stream'),
+ {'Length1': length1Object})
+ with open(filename, 'rb') as fontfile:
+ length1 = 0
+ while True:
+ data = fontfile.read(4096)
+ if not data:
+ break
+ length1 += len(data)
+ self.currentstream.write(data)
+ self.endStream()
+ self.writeObject(length1Object, length1)
+
+ # Make the 'W' (Widths) array, CidToGidMap and ToUnicode CMap
+ # at the same time
+ cid_to_gid_map = ['\0'] * 65536
+ widths = []
+ max_ccode = 0
+ for c in characters:
+ ccode = c
+ gind = font.get_char_index(ccode)
+ glyph = font.load_char(ccode,
+ flags=LOAD_NO_SCALE | LOAD_NO_HINTING)
+ widths.append((ccode, cvt(glyph.horiAdvance)))
+ if ccode < 65536:
+ cid_to_gid_map[ccode] = chr(gind)
+ max_ccode = max(ccode, max_ccode)
+ widths.sort()
+ cid_to_gid_map = cid_to_gid_map[:max_ccode + 1]
+
+ last_ccode = -2
+ w = []
+ max_width = 0
+ unicode_groups = []
+ for ccode, width in widths:
+ if ccode != last_ccode + 1:
+ w.append(ccode)
+ w.append([width])
+ unicode_groups.append([ccode, ccode])
+ else:
+ w[-1].append(width)
+ unicode_groups[-1][1] = ccode
+ max_width = max(max_width, width)
+ last_ccode = ccode
+
+ unicode_bfrange = []
+ for start, end in unicode_groups:
+ unicode_bfrange.append(
+ b"<%04x> <%04x> [%s]" %
+ (start, end,
+ b" ".join(b"<%04x>" % x for x in range(start, end+1))))
+ unicode_cmap = (self._identityToUnicodeCMap %
+ (len(unicode_groups), b"\n".join(unicode_bfrange)))
+
+ # CIDToGIDMap stream
+ cid_to_gid_map = "".join(cid_to_gid_map).encode("utf-16be")
+ self.beginStream(cidToGidMapObject.id,
+ None,
+ {'Length': len(cid_to_gid_map)})
+ self.currentstream.write(cid_to_gid_map)
+ self.endStream()
+
+ # ToUnicode CMap
+ self.beginStream(toUnicodeMapObject.id,
+ None,
+ {'Length': unicode_cmap})
+ self.currentstream.write(unicode_cmap)
+ self.endStream()
+
+ descriptor['MaxWidth'] = max_width
+
+ # Write everything out
+ self.writeObject(cidFontDictObject, cidFontDict)
+ self.writeObject(type0FontDictObject, type0FontDict)
+ self.writeObject(fontdescObject, descriptor)
+ self.writeObject(wObject, w)
+
+ return type0FontDictObject
+
+ # Beginning of main embedTTF function...
+
+ ps_name = font.postscript_name.encode('ascii', 'replace')
+ ps_name = Name(ps_name)
+ pclt = font.get_sfnt_table('pclt') or {'capHeight': 0, 'xHeight': 0}
+ post = font.get_sfnt_table('post') or {'italicAngle': (0, 0)}
+ ff = font.face_flags
+ sf = font.style_flags
+
+ flags = 0
+ symbolic = False # ps_name.name in ('Cmsy10', 'Cmmi10', 'Cmex10')
+ if ff & FIXED_WIDTH:
+ flags |= 1 << 0
+ if 0: # TODO: serif
+ flags |= 1 << 1
+ if symbolic:
+ flags |= 1 << 2
+ else:
+ flags |= 1 << 5
+ if sf & ITALIC:
+ flags |= 1 << 6
+ if 0: # TODO: all caps
+ flags |= 1 << 16
+ if 0: # TODO: small caps
+ flags |= 1 << 17
+ if 0: # TODO: force bold
+ flags |= 1 << 18
+
+ descriptor = {
+ 'Type': Name('FontDescriptor'),
+ 'FontName': ps_name,
+ 'Flags': flags,
+ 'FontBBox': [cvt(x, nearest=False) for x in font.bbox],
+ 'Ascent': cvt(font.ascender, nearest=False),
+ 'Descent': cvt(font.descender, nearest=False),
+ 'CapHeight': cvt(pclt['capHeight'], nearest=False),
+ 'XHeight': cvt(pclt['xHeight']),
+ 'ItalicAngle': post['italicAngle'][1], # ???
+ 'StemV': 0 # ???
+ }
+
+ if fonttype == 3:
+ return embedTTFType3(font, characters, descriptor)
+ elif fonttype == 42:
+ return embedTTFType42(font, characters, descriptor)
+
+ def alphaState(self, alpha):
+ """Return name of an ExtGState that sets alpha to the given value."""
+
+ state = self.alphaStates.get(alpha, None)
+ if state is not None:
+ return state[0]
+
+ name = next(self._alpha_state_seq)
+ self.alphaStates[alpha] = \
+ (name, {'Type': Name('ExtGState'),
+ 'CA': alpha[0], 'ca': alpha[1]})
+ return name
+
+ def _soft_mask_state(self, smask):
+ """
+ Return an ExtGState that sets the soft mask to the given shading.
+
+ Parameters
+ ----------
+ smask : Reference
+ Reference to a shading in DeviceGray color space, whose luminosity
+ is to be used as the alpha channel.
+
+ Returns
+ -------
+ Name
+ """
+
+ state = self._soft_mask_states.get(smask, None)
+ if state is not None:
+ return state[0]
+
+ name = next(self._soft_mask_seq)
+ groupOb = self.reserveObject('transparency group for soft mask')
+ self._soft_mask_states[smask] = (
+ name,
+ {
+ 'Type': Name('ExtGState'),
+ 'AIS': False,
+ 'SMask': {
+ 'Type': Name('Mask'),
+ 'S': Name('Luminosity'),
+ 'BC': [1],
+ 'G': groupOb
+ }
+ }
+ )
+ self._soft_mask_groups.append((
+ groupOb,
+ {
+ 'Type': Name('XObject'),
+ 'Subtype': Name('Form'),
+ 'FormType': 1,
+ 'Group': {
+ 'S': Name('Transparency'),
+ 'CS': Name('DeviceGray')
+ },
+ 'Matrix': [1, 0, 0, 1, 0, 0],
+ 'Resources': {'Shading': {'S': smask}},
+ 'BBox': [0, 0, 1, 1]
+ },
+ [Name('S'), Op.shading]
+ ))
+ return name
+
+ def writeExtGSTates(self):
+ self.writeObject(
+ self._extGStateObject,
+ dict([
+ *self.alphaStates.values(),
+ *self._soft_mask_states.values()
+ ])
+ )
+
+ def _write_soft_mask_groups(self):
+ for ob, attributes, content in self._soft_mask_groups:
+ self.beginStream(ob.id, None, attributes)
+ self.output(*content)
+ self.endStream()
+
+ def hatchPattern(self, hatch_style):
+ # The colors may come in as numpy arrays, which aren't hashable
+ if hatch_style is not None:
+ edge, face, hatch = hatch_style
+ if edge is not None:
+ edge = tuple(edge)
+ if face is not None:
+ face = tuple(face)
+ hatch_style = (edge, face, hatch)
+
+ pattern = self.hatchPatterns.get(hatch_style, None)
+ if pattern is not None:
+ return pattern
+
+ name = next(self._hatch_pattern_seq)
+ self.hatchPatterns[hatch_style] = name
+ return name
+
+ def writeHatches(self):
+ hatchDict = dict()
+ sidelen = 72.0
+ for hatch_style, name in self.hatchPatterns.items():
+ ob = self.reserveObject('hatch pattern')
+ hatchDict[name] = ob
+ res = {'Procsets':
+ [Name(x) for x in "PDF Text ImageB ImageC ImageI".split()]}
+ self.beginStream(
+ ob.id, None,
+ {'Type': Name('Pattern'),
+ 'PatternType': 1, 'PaintType': 1, 'TilingType': 1,
+ 'BBox': [0, 0, sidelen, sidelen],
+ 'XStep': sidelen, 'YStep': sidelen,
+ 'Resources': res,
+ # Change origin to match Agg at top-left.
+ 'Matrix': [1, 0, 0, 1, 0, self.height * 72]})
+
+ stroke_rgb, fill_rgb, path = hatch_style
+ self.output(stroke_rgb[0], stroke_rgb[1], stroke_rgb[2],
+ Op.setrgb_stroke)
+ if fill_rgb is not None:
+ self.output(fill_rgb[0], fill_rgb[1], fill_rgb[2],
+ Op.setrgb_nonstroke,
+ 0, 0, sidelen, sidelen, Op.rectangle,
+ Op.fill)
+
+ self.output(mpl.rcParams['hatch.linewidth'], Op.setlinewidth)
+
+ self.output(*self.pathOperations(
+ Path.hatch(path),
+ Affine2D().scale(sidelen),
+ simplify=False))
+ self.output(Op.fill_stroke)
+
+ self.endStream()
+ self.writeObject(self.hatchObject, hatchDict)
+
+ def addGouraudTriangles(self, points, colors):
+ """
+ Add a Gouraud triangle shading.
+
+ Parameters
+ ----------
+ points : np.ndarray
+ Triangle vertices, shape (n, 3, 2)
+ where n = number of triangles, 3 = vertices, 2 = x, y.
+ colors : np.ndarray
+ Vertex colors, shape (n, 3, 1) or (n, 3, 4)
+ as with points, but last dimension is either (gray,)
+ or (r, g, b, alpha).
+
+ Returns
+ -------
+ Name, Reference
+ """
+ name = Name('GT%d' % len(self.gouraudTriangles))
+ ob = self.reserveObject(f'Gouraud triangle {name}')
+ self.gouraudTriangles.append((name, ob, points, colors))
+ return name, ob
+
+ def writeGouraudTriangles(self):
+ gouraudDict = dict()
+ for name, ob, points, colors in self.gouraudTriangles:
+ gouraudDict[name] = ob
+ shape = points.shape
+ flat_points = points.reshape((shape[0] * shape[1], 2))
+ colordim = colors.shape[2]
+ assert colordim in (1, 4)
+ flat_colors = colors.reshape((shape[0] * shape[1], colordim))
+ if colordim == 4:
+ # strip the alpha channel
+ colordim = 3
+ points_min = np.min(flat_points, axis=0) - (1 << 8)
+ points_max = np.max(flat_points, axis=0) + (1 << 8)
+ factor = 0xffffffff / (points_max - points_min)
+
+ self.beginStream(
+ ob.id, None,
+ {'ShadingType': 4,
+ 'BitsPerCoordinate': 32,
+ 'BitsPerComponent': 8,
+ 'BitsPerFlag': 8,
+ 'ColorSpace': Name(
+ 'DeviceRGB' if colordim == 3 else 'DeviceGray'
+ ),
+ 'AntiAlias': False,
+ 'Decode': ([points_min[0], points_max[0],
+ points_min[1], points_max[1]]
+ + [0, 1] * colordim),
+ })
+
+ streamarr = np.empty(
+ (shape[0] * shape[1],),
+ dtype=[('flags', 'u1'),
+ ('points', '>u4', (2,)),
+ ('colors', 'u1', (colordim,))])
+ streamarr['flags'] = 0
+ streamarr['points'] = (flat_points - points_min) * factor
+ streamarr['colors'] = flat_colors[:, :colordim] * 255.0
+
+ self.write(streamarr.tobytes())
+ self.endStream()
+ self.writeObject(self.gouraudObject, gouraudDict)
+
+ def imageObject(self, image):
+ """Return name of an image XObject representing the given image."""
+
+ entry = self._images.get(id(image), None)
+ if entry is not None:
+ return entry[1]
+
+ name = next(self._image_seq)
+ ob = self.reserveObject(f'image {name}')
+ self._images[id(image)] = (image, name, ob)
+ return name
+
+ def _unpack(self, im):
+ """
+ Unpack image array *im* into ``(data, alpha)``, which have shape
+ ``(height, width, 3)`` (RGB) or ``(height, width, 1)`` (grayscale or
+ alpha), except that alpha is None if the image is fully opaque.
+ """
+ im = im[::-1]
+ if im.ndim == 2:
+ return im, None
+ else:
+ rgb = im[:, :, :3]
+ rgb = np.array(rgb, order='C')
+ # PDF needs a separate alpha image
+ if im.shape[2] == 4:
+ alpha = im[:, :, 3][..., None]
+ if np.all(alpha == 255):
+ alpha = None
+ else:
+ alpha = np.array(alpha, order='C')
+ else:
+ alpha = None
+ return rgb, alpha
+
+ def _writePng(self, img):
+ """
+ Write the image *img* into the pdf file using png
+ predictors with Flate compression.
+ """
+ buffer = BytesIO()
+ img.save(buffer, format="png")
+ buffer.seek(8)
+ png_data = b''
+ bit_depth = palette = None
+ while True:
+ length, type = struct.unpack(b'!L4s', buffer.read(8))
+ if type in [b'IHDR', b'PLTE', b'IDAT']:
+ data = buffer.read(length)
+ if len(data) != length:
+ raise RuntimeError("truncated data")
+ if type == b'IHDR':
+ bit_depth = int(data[8])
+ elif type == b'PLTE':
+ palette = data
+ elif type == b'IDAT':
+ png_data += data
+ elif type == b'IEND':
+ break
+ else:
+ buffer.seek(length, 1)
+ buffer.seek(4, 1) # skip CRC
+ return png_data, bit_depth, palette
+
+ def _writeImg(self, data, id, smask=None):
+ """
+ Write the image *data*, of shape ``(height, width, 1)`` (grayscale) or
+ ``(height, width, 3)`` (RGB), as pdf object *id* and with the soft mask
+ (alpha channel) *smask*, which should be either None or a ``(height,
+ width, 1)`` array.
+ """
+ height, width, color_channels = data.shape
+ obj = {'Type': Name('XObject'),
+ 'Subtype': Name('Image'),
+ 'Width': width,
+ 'Height': height,
+ 'ColorSpace': Name({1: 'DeviceGray',
+ 3: 'DeviceRGB'}[color_channels]),
+ 'BitsPerComponent': 8}
+ if smask:
+ obj['SMask'] = smask
+ if mpl.rcParams['pdf.compression']:
+ if data.shape[-1] == 1:
+ data = data.squeeze(axis=-1)
+ img = Image.fromarray(data)
+ img_colors = img.getcolors(maxcolors=256)
+ if color_channels == 3 and img_colors is not None:
+ # Convert to indexed color if there are 256 colors or fewer
+ # This can significantly reduce the file size
+ num_colors = len(img_colors)
+ img = img.convert(mode='P', dither=Image.NONE,
+ palette=Image.ADAPTIVE, colors=num_colors)
+ png_data, bit_depth, palette = self._writePng(img)
+ if bit_depth is None or palette is None:
+ raise RuntimeError("invalid PNG header")
+ palette = palette[:num_colors * 3] # Trim padding
+ palette = pdfRepr(palette)
+ obj['ColorSpace'] = Verbatim(b'[/Indexed /DeviceRGB '
+ + str(num_colors - 1).encode()
+ + b' ' + palette + b']')
+ obj['BitsPerComponent'] = bit_depth
+ color_channels = 1
+ else:
+ png_data, _, _ = self._writePng(img)
+ png = {'Predictor': 10, 'Colors': color_channels, 'Columns': width}
+ else:
+ png = None
+ self.beginStream(
+ id,
+ self.reserveObject('length of image stream'),
+ obj,
+ png=png
+ )
+ if png:
+ self.currentstream.write(png_data)
+ else:
+ self.currentstream.write(data.tobytes())
+ self.endStream()
+
+ def writeImages(self):
+ for img, name, ob in self._images.values():
+ data, adata = self._unpack(img)
+ if adata is not None:
+ smaskObject = self.reserveObject("smask")
+ self._writeImg(adata, smaskObject.id)
+ else:
+ smaskObject = None
+ self._writeImg(data, ob.id, smaskObject)
+
+ def markerObject(self, path, trans, fill, stroke, lw, joinstyle,
+ capstyle):
+ """Return name of a marker XObject representing the given path."""
+ # self.markers used by markerObject, writeMarkers, close:
+ # mapping from (path operations, fill?, stroke?) to
+ # [name, object reference, bounding box, linewidth]
+ # This enables different draw_markers calls to share the XObject
+ # if the gc is sufficiently similar: colors etc can vary, but
+ # the choices of whether to fill and whether to stroke cannot.
+ # We need a bounding box enclosing all of the XObject path,
+ # but since line width may vary, we store the maximum of all
+ # occurring line widths in self.markers.
+ # close() is somewhat tightly coupled in that it expects the
+ # first two components of each value in self.markers to be the
+ # name and object reference.
+ pathops = self.pathOperations(path, trans, simplify=False)
+ key = (tuple(pathops), bool(fill), bool(stroke), joinstyle, capstyle)
+ result = self.markers.get(key)
+ if result is None:
+ name = Name('M%d' % len(self.markers))
+ ob = self.reserveObject('marker %d' % len(self.markers))
+ bbox = path.get_extents(trans)
+ self.markers[key] = [name, ob, bbox, lw]
+ else:
+ if result[-1] < lw:
+ result[-1] = lw
+ name = result[0]
+ return name
+
+ def writeMarkers(self):
+ for ((pathops, fill, stroke, joinstyle, capstyle),
+ (name, ob, bbox, lw)) in self.markers.items():
+ # bbox wraps the exact limits of the control points, so half a line
+ # will appear outside it. If the join style is miter and the line
+ # is not parallel to the edge, then the line will extend even
+ # further. From the PDF specification, Section 8.4.3.5, the miter
+ # limit is miterLength / lineWidth and from Table 52, the default
+ # is 10. With half the miter length outside, that works out to the
+ # following padding:
+ bbox = bbox.padded(lw * 5)
+ self.beginStream(
+ ob.id, None,
+ {'Type': Name('XObject'), 'Subtype': Name('Form'),
+ 'BBox': list(bbox.extents)})
+ self.output(GraphicsContextPdf.joinstyles[joinstyle],
+ Op.setlinejoin)
+ self.output(GraphicsContextPdf.capstyles[capstyle], Op.setlinecap)
+ self.output(*pathops)
+ self.output(Op.paint_path(fill, stroke))
+ self.endStream()
+
+ def pathCollectionObject(self, gc, path, trans, padding, filled, stroked):
+ name = Name('P%d' % len(self.paths))
+ ob = self.reserveObject('path %d' % len(self.paths))
+ self.paths.append(
+ (name, path, trans, ob, gc.get_joinstyle(), gc.get_capstyle(),
+ padding, filled, stroked))
+ return name
+
+ def writePathCollectionTemplates(self):
+ for (name, path, trans, ob, joinstyle, capstyle, padding, filled,
+ stroked) in self.paths:
+ pathops = self.pathOperations(path, trans, simplify=False)
+ bbox = path.get_extents(trans)
+ if not np.all(np.isfinite(bbox.extents)):
+ extents = [0, 0, 0, 0]
+ else:
+ bbox = bbox.padded(padding)
+ extents = list(bbox.extents)
+ self.beginStream(
+ ob.id, None,
+ {'Type': Name('XObject'), 'Subtype': Name('Form'),
+ 'BBox': extents})
+ self.output(GraphicsContextPdf.joinstyles[joinstyle],
+ Op.setlinejoin)
+ self.output(GraphicsContextPdf.capstyles[capstyle], Op.setlinecap)
+ self.output(*pathops)
+ self.output(Op.paint_path(filled, stroked))
+ self.endStream()
+
+ @staticmethod
+ def pathOperations(path, transform, clip=None, simplify=None, sketch=None):
+ return [Verbatim(_path.convert_to_string(
+ path, transform, clip, simplify, sketch,
+ 6,
+ [Op.moveto.op, Op.lineto.op, b'', Op.curveto.op, Op.closepath.op],
+ True))]
+
+ def writePath(self, path, transform, clip=False, sketch=None):
+ if clip:
+ clip = (0.0, 0.0, self.width * 72, self.height * 72)
+ simplify = path.should_simplify
+ else:
+ clip = None
+ simplify = False
+ cmds = self.pathOperations(path, transform, clip, simplify=simplify,
+ sketch=sketch)
+ self.output(*cmds)
+
+ def reserveObject(self, name=''):
+ """
+ Reserve an ID for an indirect object.
+
+ The name is used for debugging in case we forget to print out
+ the object with writeObject.
+ """
+ id = next(self._object_seq)
+ self.xrefTable.append([None, 0, name])
+ return Reference(id)
+
+ def recordXref(self, id):
+ self.xrefTable[id][0] = self.fh.tell() - self.tell_base
+
+ def writeObject(self, object, contents):
+ self.recordXref(object.id)
+ object.write(contents, self)
+
+ def writeXref(self):
+ """Write out the xref table."""
+ self.startxref = self.fh.tell() - self.tell_base
+ self.write(b"xref\n0 %d\n" % len(self.xrefTable))
+ for i, (offset, generation, name) in enumerate(self.xrefTable):
+ if offset is None:
+ raise AssertionError(
+ 'No offset for object %d (%s)' % (i, name))
+ else:
+ key = b"f" if name == 'the zero object' else b"n"
+ text = b"%010d %05d %b \n" % (offset, generation, key)
+ self.write(text)
+
+ def writeInfoDict(self):
+ """Write out the info dictionary, checking it for good form"""
+
+ self.infoObject = self.reserveObject('info')
+ self.writeObject(self.infoObject, self.infoDict)
+
+ def writeTrailer(self):
+ """Write out the PDF trailer."""
+
+ self.write(b"trailer\n")
+ self.write(pdfRepr(
+ {'Size': len(self.xrefTable),
+ 'Root': self.rootObject,
+ 'Info': self.infoObject}))
+ # Could add 'ID'
+ self.write(b"\nstartxref\n%d\n%%%%EOF\n" % self.startxref)
+
+
+class RendererPdf(_backend_pdf_ps.RendererPDFPSBase):
+
+ _afm_font_dir = cbook._get_data_path("fonts/pdfcorefonts")
+ _use_afm_rc_name = "pdf.use14corefonts"
+
+ def __init__(self, file, image_dpi, height, width):
+ super().__init__(width, height)
+ self.file = file
+ self.gc = self.new_gc()
+ self.image_dpi = image_dpi
+
+ @_api.deprecated("3.4")
+ @property
+ def mathtext_parser(self):
+ return MathTextParser("Pdf")
+
+ def finalize(self):
+ self.file.output(*self.gc.finalize())
+
+ def check_gc(self, gc, fillcolor=None):
+ orig_fill = getattr(gc, '_fillcolor', (0., 0., 0.))
+ gc._fillcolor = fillcolor
+
+ orig_alphas = getattr(gc, '_effective_alphas', (1.0, 1.0))
+
+ if gc.get_rgb() is None:
+ # It should not matter what color here since linewidth should be
+ # 0 unless affected by global settings in rcParams, hence setting
+ # zero alpha just in case.
+ gc.set_foreground((0, 0, 0, 0), isRGBA=True)
+
+ if gc._forced_alpha:
+ gc._effective_alphas = (gc._alpha, gc._alpha)
+ elif fillcolor is None or len(fillcolor) < 4:
+ gc._effective_alphas = (gc._rgb[3], 1.0)
+ else:
+ gc._effective_alphas = (gc._rgb[3], fillcolor[3])
+
+ delta = self.gc.delta(gc)
+ if delta:
+ self.file.output(*delta)
+
+ # Restore gc to avoid unwanted side effects
+ gc._fillcolor = orig_fill
+ gc._effective_alphas = orig_alphas
+
+ @_api.deprecated("3.3")
+ def track_characters(self, *args, **kwargs):
+ """Keep track of which characters are required from each font."""
+ self.file._character_tracker.track(*args, **kwargs)
+
+ @_api.deprecated("3.3")
+ def merge_used_characters(self, *args, **kwargs):
+ self.file._character_tracker.merge(*args, **kwargs)
+
+ def get_image_magnification(self):
+ return self.image_dpi/72.0
+
+ def draw_image(self, gc, x, y, im, transform=None):
+ # docstring inherited
+
+ h, w = im.shape[:2]
+ if w == 0 or h == 0:
+ return
+
+ if transform is None:
+ # If there's no transform, alpha has already been applied
+ gc.set_alpha(1.0)
+
+ self.check_gc(gc)
+
+ w = 72.0 * w / self.image_dpi
+ h = 72.0 * h / self.image_dpi
+
+ imob = self.file.imageObject(im)
+
+ if transform is None:
+ self.file.output(Op.gsave,
+ w, 0, 0, h, x, y, Op.concat_matrix,
+ imob, Op.use_xobject, Op.grestore)
+ else:
+ tr1, tr2, tr3, tr4, tr5, tr6 = transform.frozen().to_values()
+
+ self.file.output(Op.gsave,
+ 1, 0, 0, 1, x, y, Op.concat_matrix,
+ tr1, tr2, tr3, tr4, tr5, tr6, Op.concat_matrix,
+ imob, Op.use_xobject, Op.grestore)
+
+ def draw_path(self, gc, path, transform, rgbFace=None):
+ # docstring inherited
+ self.check_gc(gc, rgbFace)
+ self.file.writePath(
+ path, transform,
+ rgbFace is None and gc.get_hatch_path() is None,
+ gc.get_sketch_params())
+ self.file.output(self.gc.paint())
+
+ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
+ offsets, offsetTrans, facecolors, edgecolors,
+ linewidths, linestyles, antialiaseds, urls,
+ offset_position):
+ # We can only reuse the objects if the presence of fill and
+ # stroke (and the amount of alpha for each) is the same for
+ # all of them
+ can_do_optimization = True
+ facecolors = np.asarray(facecolors)
+ edgecolors = np.asarray(edgecolors)
+
+ if not len(facecolors):
+ filled = False
+ can_do_optimization = not gc.get_hatch()
+ else:
+ if np.all(facecolors[:, 3] == facecolors[0, 3]):
+ filled = facecolors[0, 3] != 0.0
+ else:
+ can_do_optimization = False
+
+ if not len(edgecolors):
+ stroked = False
+ else:
+ if np.all(np.asarray(linewidths) == 0.0):
+ stroked = False
+ elif np.all(edgecolors[:, 3] == edgecolors[0, 3]):
+ stroked = edgecolors[0, 3] != 0.0
+ else:
+ can_do_optimization = False
+
+ # Is the optimization worth it? Rough calculation:
+ # cost of emitting a path in-line is len_path * uses_per_path
+ # cost of XObject is len_path + 5 for the definition,
+ # uses_per_path for the uses
+ len_path = len(paths[0].vertices) if len(paths) > 0 else 0
+ uses_per_path = self._iter_collection_uses_per_path(
+ paths, all_transforms, offsets, facecolors, edgecolors)
+ should_do_optimization = \
+ len_path + uses_per_path + 5 < len_path * uses_per_path
+
+ if (not can_do_optimization) or (not should_do_optimization):
+ return RendererBase.draw_path_collection(
+ self, gc, master_transform, paths, all_transforms,
+ offsets, offsetTrans, facecolors, edgecolors,
+ linewidths, linestyles, antialiaseds, urls,
+ offset_position)
+
+ padding = np.max(linewidths)
+ path_codes = []
+ for i, (path, transform) in enumerate(self._iter_collection_raw_paths(
+ master_transform, paths, all_transforms)):
+ name = self.file.pathCollectionObject(
+ gc, path, transform, padding, filled, stroked)
+ path_codes.append(name)
+
+ output = self.file.output
+ output(*self.gc.push())
+ lastx, lasty = 0, 0
+ for xo, yo, path_id, gc0, rgbFace in self._iter_collection(
+ gc, master_transform, all_transforms, path_codes, offsets,
+ offsetTrans, facecolors, edgecolors, linewidths, linestyles,
+ antialiaseds, urls, offset_position):
+
+ self.check_gc(gc0, rgbFace)
+ dx, dy = xo - lastx, yo - lasty
+ output(1, 0, 0, 1, dx, dy, Op.concat_matrix, path_id,
+ Op.use_xobject)
+ lastx, lasty = xo, yo
+ output(*self.gc.pop())
+
+ def draw_markers(self, gc, marker_path, marker_trans, path, trans,
+ rgbFace=None):
+ # docstring inherited
+
+ # Same logic as in draw_path_collection
+ len_marker_path = len(marker_path)
+ uses = len(path)
+ if len_marker_path * uses < len_marker_path + uses + 5:
+ RendererBase.draw_markers(self, gc, marker_path, marker_trans,
+ path, trans, rgbFace)
+ return
+
+ self.check_gc(gc, rgbFace)
+ fill = gc.fill(rgbFace)
+ stroke = gc.stroke()
+
+ output = self.file.output
+ marker = self.file.markerObject(
+ marker_path, marker_trans, fill, stroke, self.gc._linewidth,
+ gc.get_joinstyle(), gc.get_capstyle())
+
+ output(Op.gsave)
+ lastx, lasty = 0, 0
+ for vertices, code in path.iter_segments(
+ trans,
+ clip=(0, 0, self.file.width*72, self.file.height*72),
+ simplify=False):
+ if len(vertices):
+ x, y = vertices[-2:]
+ if not (0 <= x <= self.file.width * 72
+ and 0 <= y <= self.file.height * 72):
+ continue
+ dx, dy = x - lastx, y - lasty
+ output(1, 0, 0, 1, dx, dy, Op.concat_matrix,
+ marker, Op.use_xobject)
+ lastx, lasty = x, y
+ output(Op.grestore)
+
+ def draw_gouraud_triangle(self, gc, points, colors, trans):
+ self.draw_gouraud_triangles(gc, points.reshape((1, 3, 2)),
+ colors.reshape((1, 3, 4)), trans)
+
+ def draw_gouraud_triangles(self, gc, points, colors, trans):
+ assert len(points) == len(colors)
+ if len(points) == 0:
+ return
+ assert points.ndim == 3
+ assert points.shape[1] == 3
+ assert points.shape[2] == 2
+ assert colors.ndim == 3
+ assert colors.shape[1] == 3
+ assert colors.shape[2] in (1, 4)
+
+ shape = points.shape
+ points = points.reshape((shape[0] * shape[1], 2))
+ tpoints = trans.transform(points)
+ tpoints = tpoints.reshape(shape)
+ name, _ = self.file.addGouraudTriangles(tpoints, colors)
+ output = self.file.output
+
+ if colors.shape[2] == 1:
+ # grayscale
+ gc.set_alpha(1.0)
+ self.check_gc(gc)
+ output(name, Op.shading)
+ return
+
+ alpha = colors[0, 0, 3]
+ if np.allclose(alpha, colors[:, :, 3]):
+ # single alpha value
+ gc.set_alpha(alpha)
+ self.check_gc(gc)
+ output(name, Op.shading)
+ else:
+ # varying alpha: use a soft mask
+ alpha = colors[:, :, 3][:, :, None]
+ _, smask_ob = self.file.addGouraudTriangles(tpoints, alpha)
+ gstate = self.file._soft_mask_state(smask_ob)
+ output(Op.gsave, gstate, Op.setgstate,
+ name, Op.shading,
+ Op.grestore)
+
+ def _setup_textpos(self, x, y, angle, oldx=0, oldy=0, oldangle=0):
+ if angle == oldangle == 0:
+ self.file.output(x - oldx, y - oldy, Op.textpos)
+ else:
+ angle = math.radians(angle)
+ self.file.output(math.cos(angle), math.sin(angle),
+ -math.sin(angle), math.cos(angle),
+ x, y, Op.textmatrix)
+ self.file.output(0, 0, Op.textpos)
+
+ def draw_mathtext(self, gc, x, y, s, prop, angle):
+ # TODO: fix positioning and encoding
+ width, height, descent, glyphs, rects = \
+ self._text2path.mathtext_parser.parse(s, 72, prop)
+
+ if gc.get_url() is not None:
+ link_annotation = {
+ 'Type': Name('Annot'),
+ 'Subtype': Name('Link'),
+ 'Rect': (x, y, x + width, y + height),
+ 'Border': [0, 0, 0],
+ 'A': {
+ 'S': Name('URI'),
+ 'URI': gc.get_url(),
+ },
+ }
+ self.file._annotations[-1][1].append(link_annotation)
+
+ fonttype = mpl.rcParams['pdf.fonttype']
+
+ # Set up a global transformation matrix for the whole math expression
+ a = math.radians(angle)
+ self.file.output(Op.gsave)
+ self.file.output(math.cos(a), math.sin(a),
+ -math.sin(a), math.cos(a),
+ x, y, Op.concat_matrix)
+
+ self.check_gc(gc, gc._rgb)
+ prev_font = None, None
+ oldx, oldy = 0, 0
+ type3_multibytes = []
+
+ self.file.output(Op.begin_text)
+ for font, fontsize, num, ox, oy in glyphs:
+ self.file._character_tracker.track(font, chr(num))
+ fontname = font.fname
+ if fonttype == 3 and num > 255:
+ # For Type3 fonts, multibyte characters must be emitted
+ # separately (below).
+ type3_multibytes.append((font, fontsize, ox, oy, num))
+ else:
+ self._setup_textpos(ox, oy, 0, oldx, oldy)
+ oldx, oldy = ox, oy
+ if (fontname, fontsize) != prev_font:
+ self.file.output(self.file.fontName(fontname), fontsize,
+ Op.selectfont)
+ prev_font = fontname, fontsize
+ self.file.output(self.encode_string(chr(num), fonttype),
+ Op.show)
+ self.file.output(Op.end_text)
+
+ for font, fontsize, ox, oy, num in type3_multibytes:
+ self._draw_xobject_glyph(
+ font, fontsize, font.get_char_index(num), ox, oy)
+
+ # Draw any horizontal lines in the math layout
+ for ox, oy, width, height in rects:
+ self.file.output(Op.gsave, ox, oy, width, height,
+ Op.rectangle, Op.fill, Op.grestore)
+
+ # Pop off the global transformation
+ self.file.output(Op.grestore)
+
+ @_api.delete_parameter("3.3", "ismath")
+ def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
+ # docstring inherited
+ texmanager = self.get_texmanager()
+ fontsize = prop.get_size_in_points()
+ dvifile = texmanager.make_dvi(s, fontsize)
+ with dviread.Dvi(dvifile, 72) as dvi:
+ page, = dvi
+
+ if gc.get_url() is not None:
+ link_annotation = {
+ 'Type': Name('Annot'),
+ 'Subtype': Name('Link'),
+ 'Rect': (x, y, x + page.width, y + page.height),
+ 'Border': [0, 0, 0],
+ 'A': {
+ 'S': Name('URI'),
+ 'URI': gc.get_url(),
+ },
+ }
+ self.file._annotations[-1][1].append(link_annotation)
+
+ # Gather font information and do some setup for combining
+ # characters into strings. The variable seq will contain a
+ # sequence of font and text entries. A font entry is a list
+ # ['font', name, size] where name is a Name object for the
+ # font. A text entry is ['text', x, y, glyphs, x+w] where x
+ # and y are the starting coordinates, w is the width, and
+ # glyphs is a list; in this phase it will always contain just
+ # one one-character string, but later it may have longer
+ # strings interspersed with kern amounts.
+ oldfont, seq = None, []
+ for x1, y1, dvifont, glyph, width in page.text:
+ if dvifont != oldfont:
+ pdfname = self.file.dviFontName(dvifont)
+ seq += [['font', pdfname, dvifont.size]]
+ oldfont = dvifont
+ seq += [['text', x1, y1, [bytes([glyph])], x1+width]]
+
+ # Find consecutive text strings with constant y coordinate and
+ # combine into a sequence of strings and kerns, or just one
+ # string (if any kerns would be less than 0.1 points).
+ i, curx, fontsize = 0, 0, None
+ while i < len(seq)-1:
+ elt, nxt = seq[i:i+2]
+ if elt[0] == 'font':
+ fontsize = elt[2]
+ elif elt[0] == nxt[0] == 'text' and elt[2] == nxt[2]:
+ offset = elt[4] - nxt[1]
+ if abs(offset) < 0.1:
+ elt[3][-1] += nxt[3][0]
+ elt[4] += nxt[4]-nxt[1]
+ else:
+ elt[3] += [offset*1000.0/fontsize, nxt[3][0]]
+ elt[4] = nxt[4]
+ del seq[i+1]
+ continue
+ i += 1
+
+ # Create a transform to map the dvi contents to the canvas.
+ mytrans = Affine2D().rotate_deg(angle).translate(x, y)
+
+ # Output the text.
+ self.check_gc(gc, gc._rgb)
+ self.file.output(Op.begin_text)
+ curx, cury, oldx, oldy = 0, 0, 0, 0
+ for elt in seq:
+ if elt[0] == 'font':
+ self.file.output(elt[1], elt[2], Op.selectfont)
+ elif elt[0] == 'text':
+ curx, cury = mytrans.transform((elt[1], elt[2]))
+ self._setup_textpos(curx, cury, angle, oldx, oldy)
+ oldx, oldy = curx, cury
+ if len(elt[3]) == 1:
+ self.file.output(elt[3][0], Op.show)
+ else:
+ self.file.output(elt[3], Op.showkern)
+ else:
+ assert False
+ self.file.output(Op.end_text)
+
+ # Then output the boxes (e.g., variable-length lines of square
+ # roots).
+ boxgc = self.new_gc()
+ boxgc.copy_properties(gc)
+ boxgc.set_linewidth(0)
+ pathops = [Path.MOVETO, Path.LINETO, Path.LINETO, Path.LINETO,
+ Path.CLOSEPOLY]
+ for x1, y1, h, w in page.boxes:
+ path = Path([[x1, y1], [x1+w, y1], [x1+w, y1+h], [x1, y1+h],
+ [0, 0]], pathops)
+ self.draw_path(boxgc, path, mytrans, gc._rgb)
+
+ def encode_string(self, s, fonttype):
+ if fonttype in (1, 3):
+ return s.encode('cp1252', 'replace')
+ return s.encode('utf-16be', 'replace')
+
+ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
+ # docstring inherited
+
+ # TODO: combine consecutive texts into one BT/ET delimited section
+
+ self.check_gc(gc, gc._rgb)
+ if ismath:
+ return self.draw_mathtext(gc, x, y, s, prop, angle)
+
+ fontsize = prop.get_size_in_points()
+
+ if mpl.rcParams['pdf.use14corefonts']:
+ font = self._get_font_afm(prop)
+ fonttype = 1
+ else:
+ font = self._get_font_ttf(prop)
+ self.file._character_tracker.track(font, s)
+ fonttype = mpl.rcParams['pdf.fonttype']
+
+ if gc.get_url() is not None:
+ font.set_text(s)
+ width, height = font.get_width_height()
+ link_annotation = {
+ 'Type': Name('Annot'),
+ 'Subtype': Name('Link'),
+ 'Rect': (x, y, x + width / 64, y + height / 64),
+ 'Border': [0, 0, 0],
+ 'A': {
+ 'S': Name('URI'),
+ 'URI': gc.get_url(),
+ },
+ }
+ self.file._annotations[-1][1].append(link_annotation)
+
+ # If fonttype != 3 emit the whole string at once without manual
+ # kerning.
+ if fonttype != 3:
+ self.file.output(Op.begin_text,
+ self.file.fontName(prop), fontsize, Op.selectfont)
+ self._setup_textpos(x, y, angle)
+ self.file.output(self.encode_string(s, fonttype),
+ Op.show, Op.end_text)
+
+ # There is no way to access multibyte characters of Type 3 fonts, as
+ # they cannot have a CIDMap. Therefore, in this case we break the
+ # string into chunks, where each chunk contains either a string of
+ # consecutive 1-byte characters or a single multibyte character.
+ # A sequence of 1-byte characters is broken into multiple chunks to
+ # adjust the kerning between adjacent chunks. Each chunk is emitted
+ # with a separate command: 1-byte characters use the regular text show
+ # command (TJ) with appropriate kerning between chunks, whereas
+ # multibyte characters use the XObject command (Do). (If using Type
+ # 42 fonts, all of this complication is avoided, but of course,
+ # subsetting those fonts is complex/hard to implement.)
+ else:
+ # List of (start_x, [prev_kern, char, char, ...]), w/o zero kerns.
+ singlebyte_chunks = []
+ # List of (start_x, glyph_index).
+ multibyte_glyphs = []
+ prev_was_multibyte = True
+ for item in _text_layout.layout(
+ s, font, kern_mode=KERNING_UNFITTED):
+ if ord(item.char) <= 255:
+ if prev_was_multibyte:
+ singlebyte_chunks.append((item.x, []))
+ if item.prev_kern:
+ singlebyte_chunks[-1][1].append(item.prev_kern)
+ singlebyte_chunks[-1][1].append(item.char)
+ prev_was_multibyte = False
+ else:
+ multibyte_glyphs.append((item.x, item.glyph_idx))
+ prev_was_multibyte = True
+ # Do the rotation and global translation as a single matrix
+ # concatenation up front
+ self.file.output(Op.gsave)
+ a = math.radians(angle)
+ self.file.output(math.cos(a), math.sin(a),
+ -math.sin(a), math.cos(a),
+ x, y, Op.concat_matrix)
+ # Emit all the 1-byte characters in a BT/ET group.
+ self.file.output(Op.begin_text,
+ self.file.fontName(prop), fontsize, Op.selectfont)
+ prev_start_x = 0
+ for start_x, kerns_or_chars in singlebyte_chunks:
+ self._setup_textpos(start_x, 0, 0, prev_start_x, 0, 0)
+ self.file.output(
+ # See pdf spec "Text space details" for the 1000/fontsize
+ # (aka. 1000/T_fs) factor.
+ [-1000 * next(group) / fontsize if tp == float # a kern
+ else self.encode_string("".join(group), fonttype)
+ for tp, group in itertools.groupby(kerns_or_chars, type)],
+ Op.showkern)
+ prev_start_x = start_x
+ self.file.output(Op.end_text)
+ # Then emit all the multibyte characters, one at a time.
+ for start_x, glyph_idx in multibyte_glyphs:
+ self._draw_xobject_glyph(font, fontsize, glyph_idx, start_x, 0)
+ self.file.output(Op.grestore)
+
+ def _draw_xobject_glyph(self, font, fontsize, glyph_idx, x, y):
+ """Draw a multibyte character from a Type 3 font as an XObject."""
+ symbol_name = font.get_glyph_name(glyph_idx)
+ name = self.file._get_xobject_symbol_name(font.fname, symbol_name)
+ self.file.output(
+ Op.gsave,
+ 0.001 * fontsize, 0, 0, 0.001 * fontsize, x, y, Op.concat_matrix,
+ Name(name), Op.use_xobject,
+ Op.grestore,
+ )
+
+ def new_gc(self):
+ # docstring inherited
+ return GraphicsContextPdf(self.file)
+
+
+class GraphicsContextPdf(GraphicsContextBase):
+
+ def __init__(self, file):
+ super().__init__()
+ self._fillcolor = (0.0, 0.0, 0.0)
+ self._effective_alphas = (1.0, 1.0)
+ self.file = file
+ self.parent = None
+
+ def __repr__(self):
+ d = dict(self.__dict__)
+ del d['file']
+ del d['parent']
+ return repr(d)
+
+ def stroke(self):
+ """
+ Predicate: does the path need to be stroked (its outline drawn)?
+ This tests for the various conditions that disable stroking
+ the path, in which case it would presumably be filled.
+ """
+ # _linewidth > 0: in pdf a line of width 0 is drawn at minimum
+ # possible device width, but e.g., agg doesn't draw at all
+ return (self._linewidth > 0 and self._alpha > 0 and
+ (len(self._rgb) <= 3 or self._rgb[3] != 0.0))
+
+ def fill(self, *args):
+ """
+ Predicate: does the path need to be filled?
+
+ An optional argument can be used to specify an alternative
+ _fillcolor, as needed by RendererPdf.draw_markers.
+ """
+ if len(args):
+ _fillcolor = args[0]
+ else:
+ _fillcolor = self._fillcolor
+ return (self._hatch or
+ (_fillcolor is not None and
+ (len(_fillcolor) <= 3 or _fillcolor[3] != 0.0)))
+
+ def paint(self):
+ """
+ Return the appropriate pdf operator to cause the path to be
+ stroked, filled, or both.
+ """
+ return Op.paint_path(self.fill(), self.stroke())
+
+ capstyles = {'butt': 0, 'round': 1, 'projecting': 2}
+ joinstyles = {'miter': 0, 'round': 1, 'bevel': 2}
+
+ def capstyle_cmd(self, style):
+ return [self.capstyles[style], Op.setlinecap]
+
+ def joinstyle_cmd(self, style):
+ return [self.joinstyles[style], Op.setlinejoin]
+
+ def linewidth_cmd(self, width):
+ return [width, Op.setlinewidth]
+
+ def dash_cmd(self, dashes):
+ offset, dash = dashes
+ if dash is None:
+ dash = []
+ offset = 0
+ return [list(dash), offset, Op.setdash]
+
+ def alpha_cmd(self, alpha, forced, effective_alphas):
+ name = self.file.alphaState(effective_alphas)
+ return [name, Op.setgstate]
+
+ def hatch_cmd(self, hatch, hatch_color):
+ if not hatch:
+ if self._fillcolor is not None:
+ return self.fillcolor_cmd(self._fillcolor)
+ else:
+ return [Name('DeviceRGB'), Op.setcolorspace_nonstroke]
+ else:
+ hatch_style = (hatch_color, self._fillcolor, hatch)
+ name = self.file.hatchPattern(hatch_style)
+ return [Name('Pattern'), Op.setcolorspace_nonstroke,
+ name, Op.setcolor_nonstroke]
+
+ def rgb_cmd(self, rgb):
+ if mpl.rcParams['pdf.inheritcolor']:
+ return []
+ if rgb[0] == rgb[1] == rgb[2]:
+ return [rgb[0], Op.setgray_stroke]
+ else:
+ return [*rgb[:3], Op.setrgb_stroke]
+
+ def fillcolor_cmd(self, rgb):
+ if rgb is None or mpl.rcParams['pdf.inheritcolor']:
+ return []
+ elif rgb[0] == rgb[1] == rgb[2]:
+ return [rgb[0], Op.setgray_nonstroke]
+ else:
+ return [*rgb[:3], Op.setrgb_nonstroke]
+
+ def push(self):
+ parent = GraphicsContextPdf(self.file)
+ parent.copy_properties(self)
+ parent.parent = self.parent
+ self.parent = parent
+ return [Op.gsave]
+
+ def pop(self):
+ assert self.parent is not None
+ self.copy_properties(self.parent)
+ self.parent = self.parent.parent
+ return [Op.grestore]
+
+ def clip_cmd(self, cliprect, clippath):
+ """Set clip rectangle. Calls `.pop()` and `.push()`."""
+ cmds = []
+ # Pop graphics state until we hit the right one or the stack is empty
+ while ((self._cliprect, self._clippath) != (cliprect, clippath)
+ and self.parent is not None):
+ cmds.extend(self.pop())
+ # Unless we hit the right one, set the clip polygon
+ if ((self._cliprect, self._clippath) != (cliprect, clippath) or
+ self.parent is None):
+ cmds.extend(self.push())
+ if self._cliprect != cliprect:
+ cmds.extend([cliprect, Op.rectangle, Op.clip, Op.endpath])
+ if self._clippath != clippath:
+ path, affine = clippath.get_transformed_path_and_affine()
+ cmds.extend(
+ PdfFile.pathOperations(path, affine, simplify=False) +
+ [Op.clip, Op.endpath])
+ return cmds
+
+ commands = (
+ # must come first since may pop
+ (('_cliprect', '_clippath'), clip_cmd),
+ (('_alpha', '_forced_alpha', '_effective_alphas'), alpha_cmd),
+ (('_capstyle',), capstyle_cmd),
+ (('_fillcolor',), fillcolor_cmd),
+ (('_joinstyle',), joinstyle_cmd),
+ (('_linewidth',), linewidth_cmd),
+ (('_dashes',), dash_cmd),
+ (('_rgb',), rgb_cmd),
+ # must come after fillcolor and rgb
+ (('_hatch', '_hatch_color'), hatch_cmd),
+ )
+
+ def delta(self, other):
+ """
+ Copy properties of other into self and return PDF commands
+ needed to transform self into other.
+ """
+ cmds = []
+ fill_performed = False
+ for params, cmd in self.commands:
+ different = False
+ for p in params:
+ ours = getattr(self, p)
+ theirs = getattr(other, p)
+ try:
+ if ours is None or theirs is None:
+ different = ours is not theirs
+ else:
+ different = bool(ours != theirs)
+ except ValueError:
+ ours = np.asarray(ours)
+ theirs = np.asarray(theirs)
+ different = (ours.shape != theirs.shape or
+ np.any(ours != theirs))
+ if different:
+ break
+
+ # Need to update hatching if we also updated fillcolor
+ if params == ('_hatch', '_hatch_color') and fill_performed:
+ different = True
+
+ if different:
+ if params == ('_fillcolor',):
+ fill_performed = True
+ theirs = [getattr(other, p) for p in params]
+ cmds.extend(cmd(self, *theirs))
+ for p in params:
+ setattr(self, p, getattr(other, p))
+ return cmds
+
+ def copy_properties(self, other):
+ """
+ Copy properties of other into self.
+ """
+ super().copy_properties(other)
+ fillcolor = getattr(other, '_fillcolor', self._fillcolor)
+ effective_alphas = getattr(other, '_effective_alphas',
+ self._effective_alphas)
+ self._fillcolor = fillcolor
+ self._effective_alphas = effective_alphas
+
+ def finalize(self):
+ """
+ Make sure every pushed graphics state is popped.
+ """
+ cmds = []
+ while self.parent is not None:
+ cmds.extend(self.pop())
+ return cmds
+
+
+class PdfPages:
+ """
+ A multi-page PDF file.
+
+ Examples
+ --------
+ >>> import matplotlib.pyplot as plt
+ >>> # Initialize:
+ >>> with PdfPages('foo.pdf') as pdf:
+ ... # As many times as you like, create a figure fig and save it:
+ ... fig = plt.figure()
+ ... pdf.savefig(fig)
+ ... # When no figure is specified the current figure is saved
+ ... pdf.savefig()
+
+ Notes
+ -----
+ In reality `PdfPages` is a thin wrapper around `PdfFile`, in order to avoid
+ confusion when using `~.pyplot.savefig` and forgetting the format argument.
+ """
+ __slots__ = ('_file', 'keep_empty')
+
+ def __init__(self, filename, keep_empty=True, metadata=None):
+ """
+ Create a new PdfPages object.
+
+ Parameters
+ ----------
+ filename : str or path-like or file-like
+ Plots using `PdfPages.savefig` will be written to a file at this
+ location. The file is opened at once and any older file with the
+ same name is overwritten.
+
+ keep_empty : bool, optional
+ If set to False, then empty pdf files will be deleted automatically
+ when closed.
+
+ metadata : dict, optional
+ Information dictionary object (see PDF reference section 10.2.1
+ 'Document Information Dictionary'), e.g.:
+ ``{'Creator': 'My software', 'Author': 'Me', 'Title': 'Awesome'}``.
+
+ The standard keys are 'Title', 'Author', 'Subject', 'Keywords',
+ 'Creator', 'Producer', 'CreationDate', 'ModDate', and
+ 'Trapped'. Values have been predefined for 'Creator', 'Producer'
+ and 'CreationDate'. They can be removed by setting them to `None`.
+ """
+ self._file = PdfFile(filename, metadata=metadata)
+ self.keep_empty = keep_empty
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ self.close()
+
+ def close(self):
+ """
+ Finalize this object, making the underlying file a complete
+ PDF file.
+ """
+ self._file.finalize()
+ self._file.close()
+ if (self.get_pagecount() == 0 and not self.keep_empty and
+ not self._file.passed_in_file_object):
+ os.remove(self._file.fh.name)
+ self._file = None
+
+ def infodict(self):
+ """
+ Return a modifiable information dictionary object
+ (see PDF reference section 10.2.1 'Document Information
+ Dictionary').
+ """
+ return self._file.infoDict
+
+ def savefig(self, figure=None, **kwargs):
+ """
+ Save a `.Figure` to this file as a new page.
+
+ Any other keyword arguments are passed to `~.Figure.savefig`.
+
+ Parameters
+ ----------
+ figure : `.Figure` or int, optional
+ Specifies what figure is saved to file. If not specified, the
+ active figure is saved. If a `.Figure` instance is provided, this
+ figure is saved. If an int is specified, the figure instance to
+ save is looked up by number.
+ """
+ if not isinstance(figure, Figure):
+ if figure is None:
+ manager = Gcf.get_active()
+ else:
+ manager = Gcf.get_fig_manager(figure)
+ if manager is None:
+ raise ValueError("No figure {}".format(figure))
+ figure = manager.canvas.figure
+ # Force use of pdf backend, as PdfPages is tightly coupled with it.
+ try:
+ orig_canvas = figure.canvas
+ figure.canvas = FigureCanvasPdf(figure)
+ figure.savefig(self, format="pdf", **kwargs)
+ finally:
+ figure.canvas = orig_canvas
+
+ def get_pagecount(self):
+ """Return the current number of pages in the multipage pdf file."""
+ return len(self._file.pageList)
+
+ def attach_note(self, text, positionRect=[-100, -100, 0, 0]):
+ """
+ Add a new text note to the page to be saved next. The optional
+ positionRect specifies the position of the new note on the
+ page. It is outside the page per default to make sure it is
+ invisible on printouts.
+ """
+ self._file.newTextnote(text, positionRect)
+
+
+class FigureCanvasPdf(FigureCanvasBase):
+ # docstring inherited
+
+ fixed_dpi = 72
+ filetypes = {'pdf': 'Portable Document Format'}
+
+ def get_default_filetype(self):
+ return 'pdf'
+
+ @_check_savefig_extra_args
+ @_api.delete_parameter("3.4", "dpi")
+ def print_pdf(self, filename, *,
+ dpi=None, # dpi to use for images
+ bbox_inches_restore=None, metadata=None):
+
+ if dpi is None: # always use this branch after deprecation elapses.
+ dpi = self.figure.get_dpi()
+ self.figure.set_dpi(72) # there are 72 pdf points to an inch
+ width, height = self.figure.get_size_inches()
+ if isinstance(filename, PdfPages):
+ file = filename._file
+ else:
+ file = PdfFile(filename, metadata=metadata)
+ try:
+ file.newPage(width, height)
+ renderer = MixedModeRenderer(
+ self.figure, width, height, dpi,
+ RendererPdf(file, dpi, height, width),
+ bbox_inches_restore=bbox_inches_restore)
+ self.figure.draw(renderer)
+ renderer.finalize()
+ if not isinstance(filename, PdfPages):
+ file.finalize()
+ finally:
+ if isinstance(filename, PdfPages): # finish off this page
+ file.endStream()
+ else: # we opened the file above; now finish it off
+ file.close()
+
+ def draw(self):
+ _no_output_draw(self.figure)
+ return super().draw()
+
+
+FigureManagerPdf = FigureManagerBase
+
+
+@_Backend.export
+class _BackendPdf(_Backend):
+ FigureCanvas = FigureCanvasPdf
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_pgf.py b/venv/Lib/site-packages/matplotlib/backends/backend_pgf.py
new file mode 100644
index 0000000..9d01f60
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_pgf.py
@@ -0,0 +1,1104 @@
+import atexit
+import codecs
+import datetime
+import functools
+from io import BytesIO
+import logging
+import math
+import os
+import pathlib
+import re
+import shutil
+import subprocess
+from tempfile import TemporaryDirectory
+import weakref
+
+from PIL import Image
+
+import matplotlib as mpl
+from matplotlib import _api, cbook, font_manager as fm
+from matplotlib.backend_bases import (
+ _Backend, _check_savefig_extra_args, FigureCanvasBase, FigureManagerBase,
+ GraphicsContextBase, RendererBase, _no_output_draw
+)
+from matplotlib.backends.backend_mixed import MixedModeRenderer
+from matplotlib.backends.backend_pdf import (
+ _create_pdf_info_dict, _datetime_to_pdf)
+from matplotlib.path import Path
+from matplotlib.figure import Figure
+from matplotlib._pylab_helpers import Gcf
+
+_log = logging.getLogger(__name__)
+
+
+# Note: When formatting floating point values, it is important to use the
+# %f/{:f} format rather than %s/{} to avoid triggering scientific notation,
+# which is not recognized by TeX.
+
+
+def get_fontspec():
+ """Build fontspec preamble from rc."""
+ latex_fontspec = []
+ texcommand = mpl.rcParams["pgf.texsystem"]
+
+ if texcommand != "pdflatex":
+ latex_fontspec.append("\\usepackage{fontspec}")
+
+ if texcommand != "pdflatex" and mpl.rcParams["pgf.rcfonts"]:
+ families = ["serif", "sans\\-serif", "monospace"]
+ commands = ["setmainfont", "setsansfont", "setmonofont"]
+ for family, command in zip(families, commands):
+ # 1) Forward slashes also work on Windows, so don't mess with
+ # backslashes. 2) The dirname needs to include a separator.
+ path = pathlib.Path(fm.findfont(family))
+ latex_fontspec.append(r"\%s{%s}[Path=\detokenize{%s}]" % (
+ command, path.name, path.parent.as_posix() + "/"))
+
+ return "\n".join(latex_fontspec)
+
+
+def get_preamble():
+ """Get LaTeX preamble from rc."""
+ return mpl.rcParams["pgf.preamble"]
+
+###############################################################################
+
+# This almost made me cry!!!
+# In the end, it's better to use only one unit for all coordinates, since the
+# arithmetic in latex seems to produce inaccurate conversions.
+latex_pt_to_in = 1. / 72.27
+latex_in_to_pt = 1. / latex_pt_to_in
+mpl_pt_to_in = 1. / 72.
+mpl_in_to_pt = 1. / mpl_pt_to_in
+
+###############################################################################
+# helper functions
+
+NO_ESCAPE = r"(? 3 else 1.0
+
+ if has_fill:
+ writeln(self.fh,
+ r"\definecolor{currentfill}{rgb}{%f,%f,%f}"
+ % tuple(rgbFace[:3]))
+ writeln(self.fh, r"\pgfsetfillcolor{currentfill}")
+ if has_fill and fillopacity != 1.0:
+ writeln(self.fh, r"\pgfsetfillopacity{%f}" % fillopacity)
+
+ # linewidth and color
+ lw = gc.get_linewidth() * mpl_pt_to_in * latex_in_to_pt
+ stroke_rgba = gc.get_rgb()
+ writeln(self.fh, r"\pgfsetlinewidth{%fpt}" % lw)
+ writeln(self.fh,
+ r"\definecolor{currentstroke}{rgb}{%f,%f,%f}"
+ % stroke_rgba[:3])
+ writeln(self.fh, r"\pgfsetstrokecolor{currentstroke}")
+ if strokeopacity != 1.0:
+ writeln(self.fh, r"\pgfsetstrokeopacity{%f}" % strokeopacity)
+
+ # line style
+ dash_offset, dash_list = gc.get_dashes()
+ if dash_list is None:
+ writeln(self.fh, r"\pgfsetdash{}{0pt}")
+ else:
+ writeln(self.fh,
+ r"\pgfsetdash{%s}{%fpt}"
+ % ("".join(r"{%fpt}" % dash for dash in dash_list),
+ dash_offset))
+
+ def _print_pgf_path(self, gc, path, transform, rgbFace=None):
+ f = 1. / self.dpi
+ # check for clip box / ignore clip for filled paths
+ bbox = gc.get_clip_rectangle() if gc else None
+ if bbox and (rgbFace is None):
+ p1, p2 = bbox.get_points()
+ clip = (p1[0], p1[1], p2[0], p2[1])
+ else:
+ clip = None
+ # build path
+ for points, code in path.iter_segments(transform, clip=clip):
+ if code == Path.MOVETO:
+ x, y = tuple(points)
+ writeln(self.fh,
+ r"\pgfpathmoveto{\pgfqpoint{%fin}{%fin}}" %
+ (f * x, f * y))
+ elif code == Path.CLOSEPOLY:
+ writeln(self.fh, r"\pgfpathclose")
+ elif code == Path.LINETO:
+ x, y = tuple(points)
+ writeln(self.fh,
+ r"\pgfpathlineto{\pgfqpoint{%fin}{%fin}}" %
+ (f * x, f * y))
+ elif code == Path.CURVE3:
+ cx, cy, px, py = tuple(points)
+ coords = cx * f, cy * f, px * f, py * f
+ writeln(self.fh,
+ r"\pgfpathquadraticcurveto"
+ r"{\pgfqpoint{%fin}{%fin}}{\pgfqpoint{%fin}{%fin}}"
+ % coords)
+ elif code == Path.CURVE4:
+ c1x, c1y, c2x, c2y, px, py = tuple(points)
+ coords = c1x * f, c1y * f, c2x * f, c2y * f, px * f, py * f
+ writeln(self.fh,
+ r"\pgfpathcurveto"
+ r"{\pgfqpoint{%fin}{%fin}}"
+ r"{\pgfqpoint{%fin}{%fin}}"
+ r"{\pgfqpoint{%fin}{%fin}}"
+ % coords)
+
+ def _pgf_path_draw(self, stroke=True, fill=False):
+ actions = []
+ if stroke:
+ actions.append("stroke")
+ if fill:
+ actions.append("fill")
+ writeln(self.fh, r"\pgfusepath{%s}" % ",".join(actions))
+
+ def option_scale_image(self):
+ # docstring inherited
+ return True
+
+ def option_image_nocomposite(self):
+ # docstring inherited
+ return not mpl.rcParams['image.composite_image']
+
+ def draw_image(self, gc, x, y, im, transform=None):
+ # docstring inherited
+
+ h, w = im.shape[:2]
+ if w == 0 or h == 0:
+ return
+
+ if not os.path.exists(getattr(self.fh, "name", "")):
+ _api.warn_external(
+ "streamed pgf-code does not support raster graphics, consider "
+ "using the pgf-to-pdf option.")
+
+ # save the images to png files
+ path = pathlib.Path(self.fh.name)
+ fname_img = "%s-img%d.png" % (path.stem, self.image_counter)
+ Image.fromarray(im[::-1]).save(path.parent / fname_img)
+ self.image_counter += 1
+
+ # reference the image in the pgf picture
+ writeln(self.fh, r"\begin{pgfscope}")
+ self._print_pgf_clip(gc)
+ f = 1. / self.dpi # from display coords to inch
+ if transform is None:
+ writeln(self.fh,
+ r"\pgfsys@transformshift{%fin}{%fin}" % (x * f, y * f))
+ w, h = w * f, h * f
+ else:
+ tr1, tr2, tr3, tr4, tr5, tr6 = transform.frozen().to_values()
+ writeln(self.fh,
+ r"\pgfsys@transformcm{%f}{%f}{%f}{%f}{%fin}{%fin}" %
+ (tr1 * f, tr2 * f, tr3 * f, tr4 * f,
+ (tr5 + x) * f, (tr6 + y) * f))
+ w = h = 1 # scale is already included in the transform
+ interp = str(transform is None).lower() # interpolation in PDF reader
+ writeln(self.fh,
+ r"\pgftext[left,bottom]"
+ r"{%s[interpolate=%s,width=%fin,height=%fin]{%s}}" %
+ (_get_image_inclusion_command(),
+ interp, w, h, fname_img))
+ writeln(self.fh, r"\end{pgfscope}")
+
+ def draw_tex(self, gc, x, y, s, prop, angle, ismath="TeX!", mtext=None):
+ # docstring inherited
+ self.draw_text(gc, x, y, s, prop, angle, ismath, mtext)
+
+ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
+ # docstring inherited
+
+ # prepare string for tex
+ s = common_texification(s)
+ prop_cmds = _font_properties_str(prop)
+ s = r"%s %s" % (prop_cmds, s)
+
+ writeln(self.fh, r"\begin{pgfscope}")
+
+ alpha = gc.get_alpha()
+ if alpha != 1.0:
+ writeln(self.fh, r"\pgfsetfillopacity{%f}" % alpha)
+ writeln(self.fh, r"\pgfsetstrokeopacity{%f}" % alpha)
+ rgb = tuple(gc.get_rgb())[:3]
+ writeln(self.fh, r"\definecolor{textcolor}{rgb}{%f,%f,%f}" % rgb)
+ writeln(self.fh, r"\pgfsetstrokecolor{textcolor}")
+ writeln(self.fh, r"\pgfsetfillcolor{textcolor}")
+ s = r"\color{textcolor}" + s
+
+ dpi = self.figure.dpi
+ text_args = []
+ if mtext and (
+ (angle == 0 or
+ mtext.get_rotation_mode() == "anchor") and
+ mtext.get_verticalalignment() != "center_baseline"):
+ # if text anchoring can be supported, get the original coordinates
+ # and add alignment information
+ pos = mtext.get_unitless_position()
+ x, y = mtext.get_transform().transform(pos)
+ halign = {"left": "left", "right": "right", "center": ""}
+ valign = {"top": "top", "bottom": "bottom",
+ "baseline": "base", "center": ""}
+ text_args.extend([
+ f"x={x/dpi:f}in",
+ f"y={y/dpi:f}in",
+ halign[mtext.get_horizontalalignment()],
+ valign[mtext.get_verticalalignment()],
+ ])
+ else:
+ # if not, use the text layout provided by Matplotlib.
+ text_args.append(f"x={x/dpi:f}in, y={y/dpi:f}in, left, base")
+
+ if angle != 0:
+ text_args.append("rotate=%f" % angle)
+
+ writeln(self.fh, r"\pgftext[%s]{%s}" % (",".join(text_args), s))
+ writeln(self.fh, r"\end{pgfscope}")
+
+ def get_text_width_height_descent(self, s, prop, ismath):
+ # docstring inherited
+
+ # check if the math is supposed to be displaystyled
+ s = common_texification(s)
+
+ # get text metrics in units of latex pt, convert to display units
+ w, h, d = (LatexManager._get_cached_or_new()
+ .get_width_height_descent(s, prop))
+ # TODO: this should be latex_pt_to_in instead of mpl_pt_to_in
+ # but having a little bit more space around the text looks better,
+ # plus the bounding box reported by LaTeX is VERY narrow
+ f = mpl_pt_to_in * self.dpi
+ return w * f, h * f, d * f
+
+ def flipy(self):
+ # docstring inherited
+ return False
+
+ def get_canvas_width_height(self):
+ # docstring inherited
+ return (self.figure.get_figwidth() * self.dpi,
+ self.figure.get_figheight() * self.dpi)
+
+ def points_to_pixels(self, points):
+ # docstring inherited
+ return points * mpl_pt_to_in * self.dpi
+
+
+@_api.deprecated("3.3", alternative="GraphicsContextBase")
+class GraphicsContextPgf(GraphicsContextBase):
+ pass
+
+
+@_api.deprecated("3.4")
+class TmpDirCleaner:
+ _remaining_tmpdirs = set()
+
+ @_api.classproperty
+ @_api.deprecated("3.4")
+ def remaining_tmpdirs(cls):
+ return cls._remaining_tmpdirs
+
+ @staticmethod
+ @_api.deprecated("3.4")
+ def add(tmpdir):
+ TmpDirCleaner._remaining_tmpdirs.add(tmpdir)
+
+ @staticmethod
+ @_api.deprecated("3.4")
+ @atexit.register
+ def cleanup_remaining_tmpdirs():
+ for tmpdir in TmpDirCleaner._remaining_tmpdirs:
+ error_message = "error deleting tmp directory {}".format(tmpdir)
+ shutil.rmtree(
+ tmpdir,
+ onerror=lambda *args: _log.error(error_message))
+
+
+class FigureCanvasPgf(FigureCanvasBase):
+ filetypes = {"pgf": "LaTeX PGF picture",
+ "pdf": "LaTeX compiled PGF picture",
+ "png": "Portable Network Graphics", }
+
+ def get_default_filetype(self):
+ return 'pdf'
+
+ @_check_savefig_extra_args
+ def _print_pgf_to_fh(self, fh, *, bbox_inches_restore=None):
+
+ header_text = """%% Creator: Matplotlib, PGF backend
+%%
+%% To include the figure in your LaTeX document, write
+%% \\input{.pgf}
+%%
+%% Make sure the required packages are loaded in your preamble
+%% \\usepackage{pgf}
+%%
+%% Figures using additional raster images can only be included by \\input if
+%% they are in the same directory as the main LaTeX file. For loading figures
+%% from other directories you can use the `import` package
+%% \\usepackage{import}
+%%
+%% and then include the figures with
+%% \\import{}{.pgf}
+%%
+"""
+
+ # append the preamble used by the backend as a comment for debugging
+ header_info_preamble = ["%% Matplotlib used the following preamble"]
+ for line in get_preamble().splitlines():
+ header_info_preamble.append("%% " + line)
+ for line in get_fontspec().splitlines():
+ header_info_preamble.append("%% " + line)
+ header_info_preamble.append("%%")
+ header_info_preamble = "\n".join(header_info_preamble)
+
+ # get figure size in inch
+ w, h = self.figure.get_figwidth(), self.figure.get_figheight()
+ dpi = self.figure.get_dpi()
+
+ # create pgfpicture environment and write the pgf code
+ fh.write(header_text)
+ fh.write(header_info_preamble)
+ fh.write("\n")
+ writeln(fh, r"\begingroup")
+ writeln(fh, r"\makeatletter")
+ writeln(fh, r"\begin{pgfpicture}")
+ writeln(fh,
+ r"\pgfpathrectangle{\pgfpointorigin}{\pgfqpoint{%fin}{%fin}}"
+ % (w, h))
+ writeln(fh, r"\pgfusepath{use as bounding box, clip}")
+ renderer = MixedModeRenderer(self.figure, w, h, dpi,
+ RendererPgf(self.figure, fh),
+ bbox_inches_restore=bbox_inches_restore)
+ self.figure.draw(renderer)
+
+ # end the pgfpicture environment
+ writeln(fh, r"\end{pgfpicture}")
+ writeln(fh, r"\makeatother")
+ writeln(fh, r"\endgroup")
+
+ def print_pgf(self, fname_or_fh, *args, **kwargs):
+ """
+ Output pgf macros for drawing the figure so it can be included and
+ rendered in latex documents.
+ """
+ with cbook.open_file_cm(fname_or_fh, "w", encoding="utf-8") as file:
+ if not cbook.file_requires_unicode(file):
+ file = codecs.getwriter("utf-8")(file)
+ self._print_pgf_to_fh(file, *args, **kwargs)
+
+ def print_pdf(self, fname_or_fh, *args, metadata=None, **kwargs):
+ """Use LaTeX to compile a pgf generated figure to pdf."""
+ w, h = self.figure.get_figwidth(), self.figure.get_figheight()
+
+ info_dict = _create_pdf_info_dict('pgf', metadata or {})
+ hyperref_options = ','.join(
+ _metadata_to_str(k, v) for k, v in info_dict.items())
+
+ with TemporaryDirectory() as tmpdir:
+ tmppath = pathlib.Path(tmpdir)
+
+ # print figure to pgf and compile it with latex
+ self.print_pgf(tmppath / "figure.pgf", *args, **kwargs)
+
+ latexcode = """
+\\PassOptionsToPackage{pdfinfo={%s}}{hyperref}
+\\RequirePackage{hyperref}
+\\documentclass[12pt]{minimal}
+\\usepackage[paperwidth=%fin, paperheight=%fin, margin=0in]{geometry}
+%s
+%s
+\\usepackage{pgf}
+
+\\begin{document}
+\\centering
+\\input{figure.pgf}
+\\end{document}""" % (hyperref_options, w, h, get_preamble(), get_fontspec())
+ (tmppath / "figure.tex").write_text(latexcode, encoding="utf-8")
+
+ texcommand = mpl.rcParams["pgf.texsystem"]
+ cbook._check_and_log_subprocess(
+ [texcommand, "-interaction=nonstopmode", "-halt-on-error",
+ "figure.tex"], _log, cwd=tmpdir)
+
+ with (tmppath / "figure.pdf").open("rb") as orig, \
+ cbook.open_file_cm(fname_or_fh, "wb") as dest:
+ shutil.copyfileobj(orig, dest) # copy file contents to target
+
+ def print_png(self, fname_or_fh, *args, **kwargs):
+ """Use LaTeX to compile a pgf figure to pdf and convert it to png."""
+ converter = make_pdf_to_png_converter()
+ with TemporaryDirectory() as tmpdir:
+ tmppath = pathlib.Path(tmpdir)
+ pdf_path = tmppath / "figure.pdf"
+ png_path = tmppath / "figure.png"
+ self.print_pdf(pdf_path, *args, **kwargs)
+ converter(pdf_path, png_path, dpi=self.figure.dpi)
+ with png_path.open("rb") as orig, \
+ cbook.open_file_cm(fname_or_fh, "wb") as dest:
+ shutil.copyfileobj(orig, dest) # copy file contents to target
+
+ def get_renderer(self):
+ return RendererPgf(self.figure, None)
+
+ def draw(self):
+ _no_output_draw(self.figure)
+ return super().draw()
+
+
+FigureManagerPgf = FigureManagerBase
+
+
+@_Backend.export
+class _BackendPgf(_Backend):
+ FigureCanvas = FigureCanvasPgf
+
+
+class PdfPages:
+ """
+ A multi-page PDF file using the pgf backend
+
+ Examples
+ --------
+ >>> import matplotlib.pyplot as plt
+ >>> # Initialize:
+ >>> with PdfPages('foo.pdf') as pdf:
+ ... # As many times as you like, create a figure fig and save it:
+ ... fig = plt.figure()
+ ... pdf.savefig(fig)
+ ... # When no figure is specified the current figure is saved
+ ... pdf.savefig()
+ """
+ __slots__ = (
+ '_output_name',
+ 'keep_empty',
+ '_n_figures',
+ '_file',
+ '_info_dict',
+ '_metadata',
+ )
+ metadata = _api.deprecated('3.3')(property(lambda self: self._metadata))
+
+ def __init__(self, filename, *, keep_empty=True, metadata=None):
+ """
+ Create a new PdfPages object.
+
+ Parameters
+ ----------
+ filename : str or path-like
+ Plots using `PdfPages.savefig` will be written to a file at this
+ location. Any older file with the same name is overwritten.
+
+ keep_empty : bool, default: True
+ If set to False, then empty pdf files will be deleted automatically
+ when closed.
+
+ metadata : dict, optional
+ Information dictionary object (see PDF reference section 10.2.1
+ 'Document Information Dictionary'), e.g.:
+ ``{'Creator': 'My software', 'Author': 'Me', 'Title': 'Awesome'}``.
+
+ The standard keys are 'Title', 'Author', 'Subject', 'Keywords',
+ 'Creator', 'Producer', 'CreationDate', 'ModDate', and
+ 'Trapped'. Values have been predefined for 'Creator', 'Producer'
+ and 'CreationDate'. They can be removed by setting them to `None`.
+ """
+ self._output_name = filename
+ self._n_figures = 0
+ self.keep_empty = keep_empty
+ self._metadata = (metadata or {}).copy()
+ if metadata:
+ for key in metadata:
+ canonical = {
+ 'creationdate': 'CreationDate',
+ 'moddate': 'ModDate',
+ }.get(key.lower(), key.lower().title())
+ if canonical != key:
+ _api.warn_deprecated(
+ '3.3', message='Support for setting PDF metadata keys '
+ 'case-insensitively is deprecated since %(since)s and '
+ 'will be removed %(removal)s; '
+ f'set {canonical} instead of {key}.')
+ self._metadata[canonical] = self._metadata.pop(key)
+ self._info_dict = _create_pdf_info_dict('pgf', self._metadata)
+ self._file = BytesIO()
+
+ def _write_header(self, width_inches, height_inches):
+ hyperref_options = ','.join(
+ _metadata_to_str(k, v) for k, v in self._info_dict.items())
+
+ latex_preamble = get_preamble()
+ latex_fontspec = get_fontspec()
+ latex_header = r"""\PassOptionsToPackage{{
+ pdfinfo={{
+ {metadata}
+ }}
+}}{{hyperref}}
+\RequirePackage{{hyperref}}
+\documentclass[12pt]{{minimal}}
+\usepackage[
+ paperwidth={width}in,
+ paperheight={height}in,
+ margin=0in
+]{{geometry}}
+{preamble}
+{fontspec}
+\usepackage{{pgf}}
+\setlength{{\parindent}}{{0pt}}
+
+\begin{{document}}%%
+""".format(
+ width=width_inches,
+ height=height_inches,
+ preamble=latex_preamble,
+ fontspec=latex_fontspec,
+ metadata=hyperref_options,
+ )
+ self._file.write(latex_header.encode('utf-8'))
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ self.close()
+
+ def close(self):
+ """
+ Finalize this object, running LaTeX in a temporary directory
+ and moving the final pdf file to *filename*.
+ """
+ self._file.write(rb'\end{document}\n')
+ if self._n_figures > 0:
+ self._run_latex()
+ elif self.keep_empty:
+ open(self._output_name, 'wb').close()
+ self._file.close()
+
+ def _run_latex(self):
+ texcommand = mpl.rcParams["pgf.texsystem"]
+ with TemporaryDirectory() as tmpdir:
+ tex_source = pathlib.Path(tmpdir, "pdf_pages.tex")
+ tex_source.write_bytes(self._file.getvalue())
+ cbook._check_and_log_subprocess(
+ [texcommand, "-interaction=nonstopmode", "-halt-on-error",
+ tex_source],
+ _log, cwd=tmpdir)
+ shutil.move(tex_source.with_suffix(".pdf"), self._output_name)
+
+ def savefig(self, figure=None, **kwargs):
+ """
+ Save a `.Figure` to this file as a new page.
+
+ Any other keyword arguments are passed to `~.Figure.savefig`.
+
+ Parameters
+ ----------
+ figure : `.Figure` or int, optional
+ Specifies what figure is saved to file. If not specified, the
+ active figure is saved. If a `.Figure` instance is provided, this
+ figure is saved. If an int is specified, the figure instance to
+ save is looked up by number.
+ """
+ if not isinstance(figure, Figure):
+ if figure is None:
+ manager = Gcf.get_active()
+ else:
+ manager = Gcf.get_fig_manager(figure)
+ if manager is None:
+ raise ValueError("No figure {}".format(figure))
+ figure = manager.canvas.figure
+
+ try:
+ orig_canvas = figure.canvas
+ figure.canvas = FigureCanvasPgf(figure)
+
+ width, height = figure.get_size_inches()
+ if self._n_figures == 0:
+ self._write_header(width, height)
+ else:
+ # \pdfpagewidth and \pdfpageheight exist on pdftex, xetex, and
+ # luatex<0.85; they were renamed to \pagewidth and \pageheight
+ # on luatex>=0.85.
+ self._file.write(
+ br'\newpage'
+ br'\ifdefined\pdfpagewidth\pdfpagewidth'
+ br'\else\pagewidth\fi=%ain'
+ br'\ifdefined\pdfpageheight\pdfpageheight'
+ br'\else\pageheight\fi=%ain'
+ b'%%\n' % (width, height)
+ )
+
+ figure.savefig(self._file, format="pgf", **kwargs)
+ self._n_figures += 1
+ finally:
+ figure.canvas = orig_canvas
+
+ def get_pagecount(self):
+ """Return the current number of pages in the multipage pdf file."""
+ return self._n_figures
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_ps.py b/venv/Lib/site-packages/matplotlib/backends/backend_ps.py
new file mode 100644
index 0000000..1ef67c6
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_ps.py
@@ -0,0 +1,1397 @@
+"""
+A PostScript backend, which can produce both PostScript .ps and .eps.
+"""
+
+import datetime
+from enum import Enum
+import glob
+from io import StringIO, TextIOWrapper
+import logging
+import math
+import os
+import pathlib
+import re
+import shutil
+from tempfile import TemporaryDirectory
+import time
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib import _api, cbook, _path
+from matplotlib import _text_layout
+from matplotlib.afm import AFM
+from matplotlib.backend_bases import (
+ _Backend, _check_savefig_extra_args, FigureCanvasBase, FigureManagerBase,
+ GraphicsContextBase, RendererBase, _no_output_draw)
+from matplotlib.cbook import is_writable_file_like, file_requires_unicode
+from matplotlib.font_manager import get_font
+from matplotlib.ft2font import LOAD_NO_HINTING, LOAD_NO_SCALE
+from matplotlib._ttconv import convert_ttf_to_ps
+from matplotlib.mathtext import MathTextParser
+from matplotlib._mathtext_data import uni2type1
+from matplotlib.path import Path
+from matplotlib.texmanager import TexManager
+from matplotlib.transforms import Affine2D
+from matplotlib.backends.backend_mixed import MixedModeRenderer
+from . import _backend_pdf_ps
+
+_log = logging.getLogger(__name__)
+
+backend_version = 'Level II'
+
+debugPS = 0
+
+
+class PsBackendHelper:
+ def __init__(self):
+ self._cached = {}
+
+
+ps_backend_helper = PsBackendHelper()
+
+
+papersize = {'letter': (8.5, 11),
+ 'legal': (8.5, 14),
+ 'ledger': (11, 17),
+ 'a0': (33.11, 46.81),
+ 'a1': (23.39, 33.11),
+ 'a2': (16.54, 23.39),
+ 'a3': (11.69, 16.54),
+ 'a4': (8.27, 11.69),
+ 'a5': (5.83, 8.27),
+ 'a6': (4.13, 5.83),
+ 'a7': (2.91, 4.13),
+ 'a8': (2.07, 2.91),
+ 'a9': (1.457, 2.05),
+ 'a10': (1.02, 1.457),
+ 'b0': (40.55, 57.32),
+ 'b1': (28.66, 40.55),
+ 'b2': (20.27, 28.66),
+ 'b3': (14.33, 20.27),
+ 'b4': (10.11, 14.33),
+ 'b5': (7.16, 10.11),
+ 'b6': (5.04, 7.16),
+ 'b7': (3.58, 5.04),
+ 'b8': (2.51, 3.58),
+ 'b9': (1.76, 2.51),
+ 'b10': (1.26, 1.76)}
+
+
+def _get_papertype(w, h):
+ for key, (pw, ph) in sorted(papersize.items(), reverse=True):
+ if key.startswith('l'):
+ continue
+ if w < pw and h < ph:
+ return key
+ return 'a0'
+
+
+def _num_to_str(val):
+ if isinstance(val, str):
+ return val
+
+ ival = int(val)
+ if val == ival:
+ return str(ival)
+
+ s = "%1.3f" % val
+ s = s.rstrip("0")
+ s = s.rstrip(".")
+ return s
+
+
+def _nums_to_str(*args):
+ return ' '.join(map(_num_to_str, args))
+
+
+def quote_ps_string(s):
+ """
+ Quote dangerous characters of S for use in a PostScript string constant.
+ """
+ s = s.replace(b"\\", b"\\\\")
+ s = s.replace(b"(", b"\\(")
+ s = s.replace(b")", b"\\)")
+ s = s.replace(b"'", b"\\251")
+ s = s.replace(b"`", b"\\301")
+ s = re.sub(br"[^ -~\n]", lambda x: br"\%03o" % ord(x.group()), s)
+ return s.decode('ascii')
+
+
+def _move_path_to_path_or_stream(src, dst):
+ """
+ Move the contents of file at *src* to path-or-filelike *dst*.
+
+ If *dst* is a path, the metadata of *src* are *not* copied.
+ """
+ if is_writable_file_like(dst):
+ fh = (open(src, 'r', encoding='latin-1')
+ if file_requires_unicode(dst)
+ else open(src, 'rb'))
+ with fh:
+ shutil.copyfileobj(fh, dst)
+ else:
+ shutil.move(src, dst, copy_function=shutil.copyfile)
+
+
+def _font_to_ps_type3(font_path, glyph_ids):
+ """
+ Subset *glyph_ids* from the font at *font_path* into a Type 3 font.
+
+ Parameters
+ ----------
+ font_path : path-like
+ Path to the font to be subsetted.
+ glyph_ids : list of int
+ The glyph indices to include in the subsetted font.
+
+ Returns
+ -------
+ str
+ The string representation of a Type 3 font, which can be included
+ verbatim into a PostScript file.
+ """
+ font = get_font(font_path, hinting_factor=1)
+
+ preamble = """\
+%!PS-Adobe-3.0 Resource-Font
+%%Creator: Converted from TrueType to Type 3 by Matplotlib.
+10 dict begin
+/FontName /{font_name} def
+/PaintType 0 def
+/FontMatrix [{inv_units_per_em} 0 0 {inv_units_per_em} 0 0] def
+/FontBBox [{bbox}] def
+/FontType 3 def
+/Encoding [{encoding}] def
+/CharStrings {num_glyphs} dict dup begin
+/.notdef 0 def
+""".format(font_name=font.postscript_name,
+ inv_units_per_em=1 / font.units_per_EM,
+ bbox=" ".join(map(str, font.bbox)),
+ encoding=" ".join("/{}".format(font.get_glyph_name(glyph_id))
+ for glyph_id in glyph_ids),
+ num_glyphs=len(glyph_ids) + 1)
+ postamble = """
+end readonly def
+
+/BuildGlyph {
+ exch begin
+ CharStrings exch
+ 2 copy known not {pop /.notdef} if
+ true 3 1 roll get exec
+ end
+} _d
+
+/BuildChar {
+ 1 index /Encoding get exch get
+ 1 index /BuildGlyph get exec
+} _d
+
+FontName currentdict end definefont pop
+"""
+
+ entries = []
+ for glyph_id in glyph_ids:
+ g = font.load_glyph(glyph_id, LOAD_NO_SCALE)
+ v, c = font.get_path()
+ entries.append(
+ "/%(name)s{%(bbox)s sc\n" % {
+ "name": font.get_glyph_name(glyph_id),
+ "bbox": " ".join(map(str, [g.horiAdvance, 0, *g.bbox])),
+ }
+ + _path.convert_to_string(
+ # Convert back to TrueType's internal units (1/64's).
+ # (Other dimensions are already in these units.)
+ Path(v * 64, c), None, None, False, None, 0,
+ # No code for quad Beziers triggers auto-conversion to cubics.
+ # Drop intermediate closepolys (relying on the outline
+ # decomposer always explicitly moving to the closing point
+ # first).
+ [b"m", b"l", b"", b"c", b""], True).decode("ascii")
+ + "ce} _d"
+ )
+
+ return preamble + "\n".join(entries) + postamble
+
+
+class RendererPS(_backend_pdf_ps.RendererPDFPSBase):
+ """
+ The renderer handles all the drawing primitives using a graphics
+ context instance that controls the colors/styles.
+ """
+
+ _afm_font_dir = cbook._get_data_path("fonts/afm")
+ _use_afm_rc_name = "ps.useafm"
+
+ mathtext_parser = _api.deprecated("3.4")(property(
+ lambda self: MathTextParser("PS")))
+ used_characters = _api.deprecated("3.3")(property(
+ lambda self: self._character_tracker.used_characters))
+
+ def __init__(self, width, height, pswriter, imagedpi=72):
+ # Although postscript itself is dpi independent, we need to inform the
+ # image code about a requested dpi to generate high resolution images
+ # and them scale them before embedding them.
+ super().__init__(width, height)
+ self._pswriter = pswriter
+ if mpl.rcParams['text.usetex']:
+ self.textcnt = 0
+ self.psfrag = []
+ self.imagedpi = imagedpi
+
+ # current renderer state (None=uninitialised)
+ self.color = None
+ self.linewidth = None
+ self.linejoin = None
+ self.linecap = None
+ self.linedash = None
+ self.fontname = None
+ self.fontsize = None
+ self._hatches = {}
+ self.image_magnification = imagedpi / 72
+ self._clip_paths = {}
+ self._path_collection_id = 0
+
+ self._character_tracker = _backend_pdf_ps.CharacterTracker()
+
+ @_api.deprecated("3.3")
+ def track_characters(self, *args, **kwargs):
+ """Keep track of which characters are required from each font."""
+ self._character_tracker.track(*args, **kwargs)
+
+ @_api.deprecated("3.3")
+ def merge_used_characters(self, *args, **kwargs):
+ self._character_tracker.merge(*args, **kwargs)
+
+ def set_color(self, r, g, b, store=True):
+ if (r, g, b) != self.color:
+ if r == g and r == b:
+ self._pswriter.write("%1.3f setgray\n" % r)
+ else:
+ self._pswriter.write(
+ "%1.3f %1.3f %1.3f setrgbcolor\n" % (r, g, b))
+ if store:
+ self.color = (r, g, b)
+
+ def set_linewidth(self, linewidth, store=True):
+ linewidth = float(linewidth)
+ if linewidth != self.linewidth:
+ self._pswriter.write("%1.3f setlinewidth\n" % linewidth)
+ if store:
+ self.linewidth = linewidth
+
+ @staticmethod
+ def _linejoin_cmd(linejoin):
+ # Support for directly passing integer values is for backcompat.
+ linejoin = {'miter': 0, 'round': 1, 'bevel': 2, 0: 0, 1: 1, 2: 2}[
+ linejoin]
+ return f"{linejoin:d} setlinejoin\n"
+
+ def set_linejoin(self, linejoin, store=True):
+ if linejoin != self.linejoin:
+ self._pswriter.write(self._linejoin_cmd(linejoin))
+ if store:
+ self.linejoin = linejoin
+
+ @staticmethod
+ def _linecap_cmd(linecap):
+ # Support for directly passing integer values is for backcompat.
+ linecap = {'butt': 0, 'round': 1, 'projecting': 2, 0: 0, 1: 1, 2: 2}[
+ linecap]
+ return f"{linecap:d} setlinecap\n"
+
+ def set_linecap(self, linecap, store=True):
+ if linecap != self.linecap:
+ self._pswriter.write(self._linecap_cmd(linecap))
+ if store:
+ self.linecap = linecap
+
+ def set_linedash(self, offset, seq, store=True):
+ if self.linedash is not None:
+ oldo, oldseq = self.linedash
+ if np.array_equal(seq, oldseq) and oldo == offset:
+ return
+
+ if seq is not None and len(seq):
+ s = "[%s] %d setdash\n" % (_nums_to_str(*seq), offset)
+ self._pswriter.write(s)
+ else:
+ self._pswriter.write("[] 0 setdash\n")
+ if store:
+ self.linedash = (offset, seq)
+
+ def set_font(self, fontname, fontsize, store=True):
+ if (fontname, fontsize) != (self.fontname, self.fontsize):
+ self._pswriter.write(f"/{fontname} {fontsize:1.3f} selectfont\n")
+ if store:
+ self.fontname = fontname
+ self.fontsize = fontsize
+
+ def create_hatch(self, hatch):
+ sidelen = 72
+ if hatch in self._hatches:
+ return self._hatches[hatch]
+ name = 'H%d' % len(self._hatches)
+ linewidth = mpl.rcParams['hatch.linewidth']
+ pageheight = self.height * 72
+ self._pswriter.write(f"""\
+ << /PatternType 1
+ /PaintType 2
+ /TilingType 2
+ /BBox[0 0 {sidelen:d} {sidelen:d}]
+ /XStep {sidelen:d}
+ /YStep {sidelen:d}
+
+ /PaintProc {{
+ pop
+ {linewidth:f} setlinewidth
+{self._convert_path(
+ Path.hatch(hatch), Affine2D().scale(sidelen), simplify=False)}
+ gsave
+ fill
+ grestore
+ stroke
+ }} bind
+ >>
+ matrix
+ 0.0 {pageheight:f} translate
+ makepattern
+ /{name} exch def
+""")
+ self._hatches[hatch] = name
+ return name
+
+ def get_image_magnification(self):
+ """
+ Get the factor by which to magnify images passed to draw_image.
+ Allows a backend to have images at a different resolution to other
+ artists.
+ """
+ return self.image_magnification
+
+ def _convert_path(self, path, transform, clip=False, simplify=None):
+ if clip:
+ clip = (0.0, 0.0, self.width * 72.0, self.height * 72.0)
+ else:
+ clip = None
+ return _path.convert_to_string(
+ path, transform, clip, simplify, None,
+ 6, [b"m", b"l", b"", b"c", b"cl"], True).decode("ascii")
+
+ def _get_clip_cmd(self, gc):
+ clip = []
+ rect = gc.get_clip_rectangle()
+ if rect is not None:
+ clip.append("%s clipbox\n" % _nums_to_str(*rect.size, *rect.p0))
+ path, trf = gc.get_clip_path()
+ if path is not None:
+ key = (path, id(trf))
+ custom_clip_cmd = self._clip_paths.get(key)
+ if custom_clip_cmd is None:
+ custom_clip_cmd = "c%x" % len(self._clip_paths)
+ self._pswriter.write(f"""\
+/{custom_clip_cmd} {{
+{self._convert_path(path, trf, simplify=False)}
+clip
+newpath
+}} bind def
+""")
+ self._clip_paths[key] = custom_clip_cmd
+ clip.append(f"{custom_clip_cmd}\n")
+ return "".join(clip)
+
+ def draw_image(self, gc, x, y, im, transform=None):
+ # docstring inherited
+
+ h, w = im.shape[:2]
+ imagecmd = "false 3 colorimage"
+ data = im[::-1, :, :3] # Vertically flipped rgb values.
+ # data.tobytes().hex() has no spaces, so can be linewrapped by simply
+ # splitting data every nchars. It's equivalent to textwrap.fill only
+ # much faster.
+ nchars = 128
+ data = data.tobytes().hex()
+ hexlines = "\n".join(
+ [
+ data[n * nchars:(n + 1) * nchars]
+ for n in range(math.ceil(len(data) / nchars))
+ ]
+ )
+
+ if transform is None:
+ matrix = "1 0 0 1 0 0"
+ xscale = w / self.image_magnification
+ yscale = h / self.image_magnification
+ else:
+ matrix = " ".join(map(str, transform.frozen().to_values()))
+ xscale = 1.0
+ yscale = 1.0
+
+ self._pswriter.write(f"""\
+gsave
+{self._get_clip_cmd(gc)}
+{x:f} {y:f} translate
+[{matrix}] concat
+{xscale:f} {yscale:f} scale
+/DataString {w:d} string def
+{w:d} {h:d} 8 [ {w:d} 0 0 -{h:d} 0 {h:d} ]
+{{
+currentfile DataString readhexstring pop
+}} bind {imagecmd}
+{hexlines}
+grestore
+""")
+
+ def draw_path(self, gc, path, transform, rgbFace=None):
+ # docstring inherited
+ clip = rgbFace is None and gc.get_hatch_path() is None
+ simplify = path.should_simplify and clip
+ ps = self._convert_path(path, transform, clip=clip, simplify=simplify)
+ self._draw_ps(ps, gc, rgbFace)
+
+ def draw_markers(
+ self, gc, marker_path, marker_trans, path, trans, rgbFace=None):
+ # docstring inherited
+
+ if debugPS:
+ self._pswriter.write('% draw_markers \n')
+
+ ps_color = (
+ None
+ if _is_transparent(rgbFace)
+ else '%1.3f setgray' % rgbFace[0]
+ if rgbFace[0] == rgbFace[1] == rgbFace[2]
+ else '%1.3f %1.3f %1.3f setrgbcolor' % rgbFace[:3])
+
+ # construct the generic marker command:
+
+ # don't want the translate to be global
+ ps_cmd = ['/o {', 'gsave', 'newpath', 'translate']
+
+ lw = gc.get_linewidth()
+ alpha = (gc.get_alpha()
+ if gc.get_forced_alpha() or len(gc.get_rgb()) == 3
+ else gc.get_rgb()[3])
+ stroke = lw > 0 and alpha > 0
+ if stroke:
+ ps_cmd.append('%.1f setlinewidth' % lw)
+ ps_cmd.append(self._linejoin_cmd(gc.get_joinstyle()))
+ ps_cmd.append(self._linecap_cmd(gc.get_capstyle()))
+
+ ps_cmd.append(self._convert_path(marker_path, marker_trans,
+ simplify=False))
+
+ if rgbFace:
+ if stroke:
+ ps_cmd.append('gsave')
+ if ps_color:
+ ps_cmd.extend([ps_color, 'fill'])
+ if stroke:
+ ps_cmd.append('grestore')
+
+ if stroke:
+ ps_cmd.append('stroke')
+ ps_cmd.extend(['grestore', '} bind def'])
+
+ for vertices, code in path.iter_segments(
+ trans,
+ clip=(0, 0, self.width*72, self.height*72),
+ simplify=False):
+ if len(vertices):
+ x, y = vertices[-2:]
+ ps_cmd.append("%g %g o" % (x, y))
+
+ ps = '\n'.join(ps_cmd)
+ self._draw_ps(ps, gc, rgbFace, fill=False, stroke=False)
+
+ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
+ offsets, offsetTrans, facecolors, edgecolors,
+ linewidths, linestyles, antialiaseds, urls,
+ offset_position):
+ # Is the optimization worth it? Rough calculation:
+ # cost of emitting a path in-line is
+ # (len_path + 2) * uses_per_path
+ # cost of definition+use is
+ # (len_path + 3) + 3 * uses_per_path
+ len_path = len(paths[0].vertices) if len(paths) > 0 else 0
+ uses_per_path = self._iter_collection_uses_per_path(
+ paths, all_transforms, offsets, facecolors, edgecolors)
+ should_do_optimization = \
+ len_path + 3 * uses_per_path + 3 < (len_path + 2) * uses_per_path
+ if not should_do_optimization:
+ return RendererBase.draw_path_collection(
+ self, gc, master_transform, paths, all_transforms,
+ offsets, offsetTrans, facecolors, edgecolors,
+ linewidths, linestyles, antialiaseds, urls,
+ offset_position)
+
+ path_codes = []
+ for i, (path, transform) in enumerate(self._iter_collection_raw_paths(
+ master_transform, paths, all_transforms)):
+ name = 'p%x_%x' % (self._path_collection_id, i)
+ path_bytes = self._convert_path(path, transform, simplify=False)
+ self._pswriter.write(f"""\
+/{name} {{
+newpath
+translate
+{path_bytes}
+}} bind def
+""")
+ path_codes.append(name)
+
+ for xo, yo, path_id, gc0, rgbFace in self._iter_collection(
+ gc, master_transform, all_transforms, path_codes, offsets,
+ offsetTrans, facecolors, edgecolors, linewidths, linestyles,
+ antialiaseds, urls, offset_position):
+ ps = "%g %g %s" % (xo, yo, path_id)
+ self._draw_ps(ps, gc0, rgbFace)
+
+ self._path_collection_id += 1
+
+ @_api.delete_parameter("3.3", "ismath")
+ def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
+ # docstring inherited
+ if not hasattr(self, "psfrag"):
+ _log.warning(
+ "The PS backend determines usetex status solely based on "
+ "rcParams['text.usetex'] and does not support having "
+ "usetex=True only for some elements; this element will thus "
+ "be rendered as if usetex=False.")
+ self.draw_text(gc, x, y, s, prop, angle, False, mtext)
+ return
+
+ w, h, bl = self.get_text_width_height_descent(s, prop, ismath="TeX")
+ fontsize = prop.get_size_in_points()
+ thetext = 'psmarker%d' % self.textcnt
+ color = '%1.3f,%1.3f,%1.3f' % gc.get_rgb()[:3]
+ fontcmd = {'sans-serif': r'{\sffamily %s}',
+ 'monospace': r'{\ttfamily %s}'}.get(
+ mpl.rcParams['font.family'][0], r'{\rmfamily %s}')
+ s = fontcmd % s
+ tex = r'\color[rgb]{%s} %s' % (color, s)
+
+ corr = 0 # w/2*(fontsize-10)/10
+ if dict.__getitem__(mpl.rcParams, 'text.latex.preview'):
+ # use baseline alignment!
+ pos = _nums_to_str(x-corr, y)
+ self.psfrag.append(
+ r'\psfrag{%s}[Bl][Bl][1][%f]{\fontsize{%f}{%f}%s}' % (
+ thetext, angle, fontsize, fontsize*1.25, tex))
+ else:
+ # Stick to the bottom alignment.
+ pos = _nums_to_str(x-corr, y-bl)
+ self.psfrag.append(
+ r'\psfrag{%s}[bl][bl][1][%f]{\fontsize{%f}{%f}%s}' % (
+ thetext, angle, fontsize, fontsize*1.25, tex))
+
+ self._pswriter.write(f"""\
+gsave
+{pos} moveto
+({thetext})
+show
+grestore
+""")
+ self.textcnt += 1
+
+ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
+ # docstring inherited
+
+ if debugPS:
+ self._pswriter.write("% text\n")
+
+ if _is_transparent(gc.get_rgb()):
+ return # Special handling for fully transparent.
+
+ if ismath == 'TeX':
+ return self.draw_tex(gc, x, y, s, prop, angle)
+
+ if ismath:
+ return self.draw_mathtext(gc, x, y, s, prop, angle)
+
+ if mpl.rcParams['ps.useafm']:
+ font = self._get_font_afm(prop)
+ scale = 0.001 * prop.get_size_in_points()
+
+ thisx = 0
+ last_name = None # kerns returns 0 for None.
+ xs_names = []
+ for c in s:
+ name = uni2type1.get(ord(c), f"uni{ord(c):04X}")
+ try:
+ width = font.get_width_from_char_name(name)
+ except KeyError:
+ name = 'question'
+ width = font.get_width_char('?')
+ kern = font.get_kern_dist_from_name(last_name, name)
+ last_name = name
+ thisx += kern * scale
+ xs_names.append((thisx, name))
+ thisx += width * scale
+
+ else:
+ font = self._get_font_ttf(prop)
+ font.set_text(s, 0, flags=LOAD_NO_HINTING)
+ self._character_tracker.track(font, s)
+ xs_names = [(item.x, font.get_glyph_name(item.glyph_idx))
+ for item in _text_layout.layout(s, font)]
+
+ self.set_color(*gc.get_rgb())
+ ps_name = (font.postscript_name
+ .encode("ascii", "replace").decode("ascii"))
+ self.set_font(ps_name, prop.get_size_in_points())
+ thetext = "\n".join(f"{x:f} 0 m /{name:s} glyphshow"
+ for x, name in xs_names)
+ self._pswriter.write(f"""\
+gsave
+{self._get_clip_cmd(gc)}
+{x:f} {y:f} translate
+{angle:f} rotate
+{thetext}
+grestore
+""")
+
+ def draw_mathtext(self, gc, x, y, s, prop, angle):
+ """Draw the math text using matplotlib.mathtext."""
+ if debugPS:
+ self._pswriter.write("% mathtext\n")
+
+ width, height, descent, glyphs, rects = \
+ self._text2path.mathtext_parser.parse(
+ s, 72, prop,
+ _force_standard_ps_fonts=mpl.rcParams["ps.useafm"])
+ self.set_color(*gc.get_rgb())
+ self._pswriter.write(
+ f"gsave\n"
+ f"{x:f} {y:f} translate\n"
+ f"{angle:f} rotate\n")
+ lastfont = None
+ for font, fontsize, num, ox, oy in glyphs:
+ self._character_tracker.track(font, chr(num))
+ if (font.postscript_name, fontsize) != lastfont:
+ lastfont = font.postscript_name, fontsize
+ self._pswriter.write(
+ f"/{font.postscript_name} {fontsize} selectfont\n")
+ symbol_name = (
+ font.get_name_char(chr(num)) if isinstance(font, AFM) else
+ font.get_glyph_name(font.get_char_index(num)))
+ self._pswriter.write(
+ f"{ox:f} {oy:f} moveto\n"
+ f"/{symbol_name} glyphshow\n")
+ for ox, oy, w, h in rects:
+ self._pswriter.write(f"{ox} {oy} {w} {h} rectfill\n")
+ self._pswriter.write("grestore\n")
+
+ def draw_gouraud_triangle(self, gc, points, colors, trans):
+ self.draw_gouraud_triangles(gc, points.reshape((1, 3, 2)),
+ colors.reshape((1, 3, 4)), trans)
+
+ def draw_gouraud_triangles(self, gc, points, colors, trans):
+ assert len(points) == len(colors)
+ assert points.ndim == 3
+ assert points.shape[1] == 3
+ assert points.shape[2] == 2
+ assert colors.ndim == 3
+ assert colors.shape[1] == 3
+ assert colors.shape[2] == 4
+
+ shape = points.shape
+ flat_points = points.reshape((shape[0] * shape[1], 2))
+ flat_points = trans.transform(flat_points)
+ flat_colors = colors.reshape((shape[0] * shape[1], 4))
+ points_min = np.min(flat_points, axis=0) - (1 << 12)
+ points_max = np.max(flat_points, axis=0) + (1 << 12)
+ factor = np.ceil((2 ** 32 - 1) / (points_max - points_min))
+
+ xmin, ymin = points_min
+ xmax, ymax = points_max
+
+ streamarr = np.empty(
+ shape[0] * shape[1],
+ dtype=[('flags', 'u1'), ('points', '2>u4'), ('colors', '3u1')])
+ streamarr['flags'] = 0
+ streamarr['points'] = (flat_points - points_min) * factor
+ streamarr['colors'] = flat_colors[:, :3] * 255.0
+ stream = quote_ps_string(streamarr.tobytes())
+
+ self._pswriter.write(f"""\
+gsave
+<< /ShadingType 4
+ /ColorSpace [/DeviceRGB]
+ /BitsPerCoordinate 32
+ /BitsPerComponent 8
+ /BitsPerFlag 8
+ /AntiAlias true
+ /Decode [ {xmin:f} {xmax:f} {ymin:f} {ymax:f} 0 1 0 1 0 1 ]
+ /DataSource ({stream})
+>>
+shfill
+grestore
+""")
+
+ def _draw_ps(self, ps, gc, rgbFace, fill=True, stroke=True, command=None):
+ """
+ Emit the PostScript snippet 'ps' with all the attributes from 'gc'
+ applied. 'ps' must consist of PostScript commands to construct a path.
+
+ The fill and/or stroke kwargs can be set to False if the
+ 'ps' string already includes filling and/or stroking, in
+ which case _draw_ps is just supplying properties and
+ clipping.
+ """
+ # local variable eliminates all repeated attribute lookups
+ write = self._pswriter.write
+ if debugPS and command:
+ write("% "+command+"\n")
+ mightstroke = (gc.get_linewidth() > 0
+ and not _is_transparent(gc.get_rgb()))
+ if not mightstroke:
+ stroke = False
+ if _is_transparent(rgbFace):
+ fill = False
+ hatch = gc.get_hatch()
+
+ if mightstroke:
+ self.set_linewidth(gc.get_linewidth())
+ self.set_linejoin(gc.get_joinstyle())
+ self.set_linecap(gc.get_capstyle())
+ self.set_linedash(*gc.get_dashes())
+ self.set_color(*gc.get_rgb()[:3])
+ write('gsave\n')
+
+ write(self._get_clip_cmd(gc))
+
+ # Jochen, is the strip necessary? - this could be a honking big string
+ write(ps.strip())
+ write("\n")
+
+ if fill:
+ if stroke or hatch:
+ write("gsave\n")
+ self.set_color(*rgbFace[:3], store=False)
+ write("fill\n")
+ if stroke or hatch:
+ write("grestore\n")
+
+ if hatch:
+ hatch_name = self.create_hatch(hatch)
+ write("gsave\n")
+ write("%f %f %f " % gc.get_hatch_color()[:3])
+ write("%s setpattern fill grestore\n" % hatch_name)
+
+ if stroke:
+ write("stroke\n")
+
+ write("grestore\n")
+
+
+def _is_transparent(rgb_or_rgba):
+ if rgb_or_rgba is None:
+ return True # Consistent with rgbFace semantics.
+ elif len(rgb_or_rgba) == 4:
+ if rgb_or_rgba[3] == 0:
+ return True
+ if rgb_or_rgba[3] != 1:
+ _log.warning(
+ "The PostScript backend does not support transparency; "
+ "partially transparent artists will be rendered opaque.")
+ return False
+ else: # len() == 3.
+ return False
+
+
+@_api.deprecated("3.4", alternative="GraphicsContextBase")
+class GraphicsContextPS(GraphicsContextBase):
+ def get_capstyle(self):
+ return {'butt': 0, 'round': 1, 'projecting': 2}[super().get_capstyle()]
+
+ def get_joinstyle(self):
+ return {'miter': 0, 'round': 1, 'bevel': 2}[super().get_joinstyle()]
+
+
+class _Orientation(Enum):
+ portrait, landscape = range(2)
+
+ def swap_if_landscape(self, shape):
+ return shape[::-1] if self.name == "landscape" else shape
+
+
+class FigureCanvasPS(FigureCanvasBase):
+ fixed_dpi = 72
+ filetypes = {'ps': 'Postscript',
+ 'eps': 'Encapsulated Postscript'}
+
+ def get_default_filetype(self):
+ return 'ps'
+
+ def print_ps(self, outfile, *args, **kwargs):
+ return self._print_ps(outfile, 'ps', *args, **kwargs)
+
+ def print_eps(self, outfile, *args, **kwargs):
+ return self._print_ps(outfile, 'eps', *args, **kwargs)
+
+ @_api.delete_parameter("3.4", "dpi")
+ def _print_ps(
+ self, outfile, format, *args,
+ dpi=None, metadata=None, papertype=None, orientation='portrait',
+ **kwargs):
+
+ if dpi is None: # always use this branch after deprecation elapses.
+ dpi = self.figure.get_dpi()
+ self.figure.set_dpi(72) # Override the dpi kwarg
+
+ dsc_comments = {}
+ if isinstance(outfile, (str, os.PathLike)):
+ filename = pathlib.Path(outfile).name
+ dsc_comments["Title"] = \
+ filename.encode("ascii", "replace").decode("ascii")
+ dsc_comments["Creator"] = (metadata or {}).get(
+ "Creator",
+ f"Matplotlib v{mpl.__version__}, https://matplotlib.org/")
+ # See https://reproducible-builds.org/specs/source-date-epoch/
+ source_date_epoch = os.getenv("SOURCE_DATE_EPOCH")
+ dsc_comments["CreationDate"] = (
+ datetime.datetime.utcfromtimestamp(
+ int(source_date_epoch)).strftime("%a %b %d %H:%M:%S %Y")
+ if source_date_epoch
+ else time.ctime())
+ dsc_comments = "\n".join(
+ f"%%{k}: {v}" for k, v in dsc_comments.items())
+
+ if papertype is None:
+ papertype = mpl.rcParams['ps.papersize']
+ papertype = papertype.lower()
+ _api.check_in_list(['auto', *papersize], papertype=papertype)
+
+ orientation = _api.check_getitem(
+ _Orientation, orientation=orientation.lower())
+
+ printer = (self._print_figure_tex
+ if mpl.rcParams['text.usetex'] else
+ self._print_figure)
+ printer(outfile, format, dpi=dpi, dsc_comments=dsc_comments,
+ orientation=orientation, papertype=papertype, **kwargs)
+
+ @_check_savefig_extra_args
+ def _print_figure(
+ self, outfile, format, *,
+ dpi, dsc_comments, orientation, papertype,
+ bbox_inches_restore=None):
+ """
+ Render the figure to a filesystem path or a file-like object.
+
+ Parameters are as for `.print_figure`, except that *dsc_comments* is a
+ all string containing Document Structuring Convention comments,
+ generated from the *metadata* parameter to `.print_figure`.
+ """
+ is_eps = format == 'eps'
+ if isinstance(outfile, (str, os.PathLike)):
+ outfile = os.fspath(outfile)
+ passed_in_file_object = False
+ elif is_writable_file_like(outfile):
+ passed_in_file_object = True
+ else:
+ raise ValueError("outfile must be a path or a file-like object")
+
+ # find the appropriate papertype
+ width, height = self.figure.get_size_inches()
+ if papertype == 'auto':
+ papertype = _get_papertype(
+ *orientation.swap_if_landscape((width, height)))
+ paper_width, paper_height = orientation.swap_if_landscape(
+ papersize[papertype])
+
+ if mpl.rcParams['ps.usedistiller']:
+ # distillers improperly clip eps files if pagesize is too small
+ if width > paper_width or height > paper_height:
+ papertype = _get_papertype(
+ *orientation.swap_if_landscape((width, height)))
+ paper_width, paper_height = orientation.swap_if_landscape(
+ papersize[papertype])
+
+ # center the figure on the paper
+ xo = 72 * 0.5 * (paper_width - width)
+ yo = 72 * 0.5 * (paper_height - height)
+
+ llx = xo
+ lly = yo
+ urx = llx + self.figure.bbox.width
+ ury = lly + self.figure.bbox.height
+ rotation = 0
+ if orientation is _Orientation.landscape:
+ llx, lly, urx, ury = lly, llx, ury, urx
+ xo, yo = 72 * paper_height - yo, xo
+ rotation = 90
+ bbox = (llx, lly, urx, ury)
+
+ self._pswriter = StringIO()
+
+ # mixed mode rendering
+ ps_renderer = RendererPS(width, height, self._pswriter, imagedpi=dpi)
+ renderer = MixedModeRenderer(
+ self.figure, width, height, dpi, ps_renderer,
+ bbox_inches_restore=bbox_inches_restore)
+
+ self.figure.draw(renderer)
+
+ def print_figure_impl(fh):
+ # write the PostScript headers
+ if is_eps:
+ print("%!PS-Adobe-3.0 EPSF-3.0", file=fh)
+ else:
+ print(f"%!PS-Adobe-3.0\n"
+ f"%%DocumentPaperSizes: {papertype}\n"
+ f"%%Pages: 1\n",
+ end="", file=fh)
+ print(f"{dsc_comments}\n"
+ f"%%Orientation: {orientation.name}\n"
+ f"{get_bbox_header(bbox)[0]}\n"
+ f"%%EndComments\n",
+ end="", file=fh)
+
+ Ndict = len(psDefs)
+ print("%%BeginProlog", file=fh)
+ if not mpl.rcParams['ps.useafm']:
+ Ndict += len(ps_renderer._character_tracker.used)
+ print("/mpldict %d dict def" % Ndict, file=fh)
+ print("mpldict begin", file=fh)
+ print("\n".join(psDefs), file=fh)
+ if not mpl.rcParams['ps.useafm']:
+ for font_path, chars \
+ in ps_renderer._character_tracker.used.items():
+ if not chars:
+ continue
+ font = get_font(font_path)
+ glyph_ids = [font.get_char_index(c) for c in chars]
+ fonttype = mpl.rcParams['ps.fonttype']
+ # Can't use more than 255 chars from a single Type 3 font.
+ if len(glyph_ids) > 255:
+ fonttype = 42
+ fh.flush()
+ if fonttype == 3:
+ fh.write(_font_to_ps_type3(font_path, glyph_ids))
+ else:
+ try:
+ convert_ttf_to_ps(os.fsencode(font_path),
+ fh, fonttype, glyph_ids)
+ except RuntimeError:
+ _log.warning(
+ "The PostScript backend does not currently "
+ "support the selected font.")
+ raise
+ print("end", file=fh)
+ print("%%EndProlog", file=fh)
+
+ if not is_eps:
+ print("%%Page: 1 1", file=fh)
+ print("mpldict begin", file=fh)
+
+ print("%s translate" % _nums_to_str(xo, yo), file=fh)
+ if rotation:
+ print("%d rotate" % rotation, file=fh)
+ print("%s clipbox" % _nums_to_str(width*72, height*72, 0, 0),
+ file=fh)
+
+ # write the figure
+ print(self._pswriter.getvalue(), file=fh)
+
+ # write the trailer
+ print("end", file=fh)
+ print("showpage", file=fh)
+ if not is_eps:
+ print("%%EOF", file=fh)
+ fh.flush()
+
+ if mpl.rcParams['ps.usedistiller']:
+ # We are going to use an external program to process the output.
+ # Write to a temporary file.
+ with TemporaryDirectory() as tmpdir:
+ tmpfile = os.path.join(tmpdir, "tmp.ps")
+ with open(tmpfile, 'w', encoding='latin-1') as fh:
+ print_figure_impl(fh)
+ if mpl.rcParams['ps.usedistiller'] == 'ghostscript':
+ _try_distill(gs_distill,
+ tmpfile, is_eps, ptype=papertype, bbox=bbox)
+ elif mpl.rcParams['ps.usedistiller'] == 'xpdf':
+ _try_distill(xpdf_distill,
+ tmpfile, is_eps, ptype=papertype, bbox=bbox)
+ _move_path_to_path_or_stream(tmpfile, outfile)
+
+ else:
+ # Write directly to outfile.
+ if passed_in_file_object:
+ requires_unicode = file_requires_unicode(outfile)
+
+ if not requires_unicode:
+ fh = TextIOWrapper(outfile, encoding="latin-1")
+ # Prevent the TextIOWrapper from closing the underlying
+ # file.
+ fh.close = lambda: None
+ else:
+ fh = outfile
+
+ print_figure_impl(fh)
+ else:
+ with open(outfile, 'w', encoding='latin-1') as fh:
+ print_figure_impl(fh)
+
+ @_check_savefig_extra_args
+ def _print_figure_tex(
+ self, outfile, format, *,
+ dpi, dsc_comments, orientation, papertype,
+ bbox_inches_restore=None):
+ """
+ If :rc:`text.usetex` is True, a temporary pair of tex/eps files
+ are created to allow tex to manage the text layout via the PSFrags
+ package. These files are processed to yield the final ps or eps file.
+
+ The rest of the behavior is as for `._print_figure`.
+ """
+ is_eps = format == 'eps'
+
+ width, height = self.figure.get_size_inches()
+ xo = 0
+ yo = 0
+
+ llx = xo
+ lly = yo
+ urx = llx + self.figure.bbox.width
+ ury = lly + self.figure.bbox.height
+ bbox = (llx, lly, urx, ury)
+
+ self._pswriter = StringIO()
+
+ # mixed mode rendering
+ ps_renderer = RendererPS(width, height, self._pswriter, imagedpi=dpi)
+ renderer = MixedModeRenderer(self.figure,
+ width, height, dpi, ps_renderer,
+ bbox_inches_restore=bbox_inches_restore)
+
+ self.figure.draw(renderer)
+
+ # write to a temp file, we'll move it to outfile when done
+ with TemporaryDirectory() as tmpdir:
+ tmpfile = os.path.join(tmpdir, "tmp.ps")
+ pathlib.Path(tmpfile).write_text(
+ f"""\
+%!PS-Adobe-3.0 EPSF-3.0
+{dsc_comments}
+{get_bbox_header(bbox)[0]}
+%%EndComments
+%%BeginProlog
+/mpldict {len(psDefs)} dict def
+mpldict begin
+{"".join(psDefs)}
+end
+%%EndProlog
+mpldict begin
+{_nums_to_str(xo, yo)} translate
+{_nums_to_str(width*72, height*72)} 0 0 clipbox
+{self._pswriter.getvalue()}
+end
+showpage
+""",
+ encoding="latin-1")
+
+ if orientation is _Orientation.landscape: # now, ready to rotate
+ width, height = height, width
+ bbox = (lly, llx, ury, urx)
+
+ # set the paper size to the figure size if is_eps. The
+ # resulting ps file has the given size with correct bounding
+ # box so that there is no need to call 'pstoeps'
+ if is_eps:
+ paper_width, paper_height = orientation.swap_if_landscape(
+ self.figure.get_size_inches())
+ else:
+ if papertype == 'auto':
+ papertype = _get_papertype(width, height)
+ paper_width, paper_height = papersize[papertype]
+
+ texmanager = ps_renderer.get_texmanager()
+ font_preamble = texmanager.get_font_preamble()
+ custom_preamble = texmanager.get_custom_preamble()
+
+ psfrag_rotated = convert_psfrags(tmpfile, ps_renderer.psfrag,
+ font_preamble,
+ custom_preamble, paper_width,
+ paper_height,
+ orientation.name)
+
+ if (mpl.rcParams['ps.usedistiller'] == 'ghostscript'
+ or mpl.rcParams['text.usetex']):
+ _try_distill(gs_distill,
+ tmpfile, is_eps, ptype=papertype, bbox=bbox,
+ rotated=psfrag_rotated)
+ elif mpl.rcParams['ps.usedistiller'] == 'xpdf':
+ _try_distill(xpdf_distill,
+ tmpfile, is_eps, ptype=papertype, bbox=bbox,
+ rotated=psfrag_rotated)
+
+ _move_path_to_path_or_stream(tmpfile, outfile)
+
+ def draw(self):
+ _no_output_draw(self.figure)
+ return super().draw()
+
+
+def convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble,
+ paper_width, paper_height, orientation):
+ """
+ When we want to use the LaTeX backend with postscript, we write PSFrag tags
+ to a temporary postscript file, each one marking a position for LaTeX to
+ render some text. convert_psfrags generates a LaTeX document containing the
+ commands to convert those tags to text. LaTeX/dvips produces the postscript
+ file that includes the actual text.
+ """
+ with mpl.rc_context({
+ "text.latex.preamble":
+ mpl.rcParams["text.latex.preamble"] +
+ r"\usepackage{psfrag,color}""\n"
+ r"\usepackage[dvips]{graphicx}""\n"
+ r"\geometry{papersize={%(width)sin,%(height)sin},margin=0in}"
+ % {"width": paper_width, "height": paper_height}
+ }):
+ dvifile = TexManager().make_dvi(
+ "\n"
+ r"\begin{figure}""\n"
+ r" \centering\leavevmode""\n"
+ r" %(psfrags)s""\n"
+ r" \includegraphics*[angle=%(angle)s]{%(epsfile)s}""\n"
+ r"\end{figure}"
+ % {
+ "psfrags": "\n".join(psfrags),
+ "angle": 90 if orientation == 'landscape' else 0,
+ "epsfile": pathlib.Path(tmpfile).resolve().as_posix(),
+ },
+ fontsize=10) # tex's default fontsize.
+
+ with TemporaryDirectory() as tmpdir:
+ psfile = os.path.join(tmpdir, "tmp.ps")
+ cbook._check_and_log_subprocess(
+ ['dvips', '-q', '-R0', '-o', psfile, dvifile], _log)
+ shutil.move(psfile, tmpfile)
+
+ # check if the dvips created a ps in landscape paper. Somehow,
+ # above latex+dvips results in a ps file in a landscape mode for a
+ # certain figure sizes (e.g., 8.3in, 5.8in which is a5). And the
+ # bounding box of the final output got messed up. We check see if
+ # the generated ps file is in landscape and return this
+ # information. The return value is used in pstoeps step to recover
+ # the correct bounding box. 2010-06-05 JJL
+ with open(tmpfile) as fh:
+ psfrag_rotated = "Landscape" in fh.read(1000)
+ return psfrag_rotated
+
+
+def _try_distill(func, *args, **kwargs):
+ try:
+ func(*args, **kwargs)
+ except mpl.ExecutableNotFoundError as exc:
+ _log.warning("%s. Distillation step skipped.", exc)
+
+
+def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
+ """
+ Use ghostscript's pswrite or epswrite device to distill a file.
+ This yields smaller files without illegal encapsulated postscript
+ operators. The output is low-level, converting text to outlines.
+ """
+
+ if eps:
+ paper_option = "-dEPSCrop"
+ else:
+ paper_option = "-sPAPERSIZE=%s" % ptype
+
+ psfile = tmpfile + '.ps'
+ dpi = mpl.rcParams['ps.distiller.res']
+
+ cbook._check_and_log_subprocess(
+ [mpl._get_executable_info("gs").executable,
+ "-dBATCH", "-dNOPAUSE", "-r%d" % dpi, "-sDEVICE=ps2write",
+ paper_option, "-sOutputFile=%s" % psfile, tmpfile],
+ _log)
+
+ os.remove(tmpfile)
+ shutil.move(psfile, tmpfile)
+
+ # While it is best if above steps preserve the original bounding
+ # box, there seem to be cases when it is not. For those cases,
+ # the original bbox can be restored during the pstoeps step.
+
+ if eps:
+ # For some versions of gs, above steps result in an ps file where the
+ # original bbox is no more correct. Do not adjust bbox for now.
+ pstoeps(tmpfile, bbox, rotated=rotated)
+
+
+def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
+ """
+ Use ghostscript's ps2pdf and xpdf's/poppler's pdftops to distill a file.
+ This yields smaller files without illegal encapsulated postscript
+ operators. This distiller is preferred, generating high-level postscript
+ output that treats text as text.
+ """
+ mpl._get_executable_info("gs") # Effectively checks for ps2pdf.
+ mpl._get_executable_info("pdftops")
+
+ pdffile = tmpfile + '.pdf'
+ psfile = tmpfile + '.ps'
+
+ # Pass options as `-foo#bar` instead of `-foo=bar` to keep Windows happy
+ # (https://www.ghostscript.com/doc/9.22/Use.htm#MS_Windows).
+ cbook._check_and_log_subprocess(
+ ["ps2pdf",
+ "-dAutoFilterColorImages#false",
+ "-dAutoFilterGrayImages#false",
+ "-sAutoRotatePages#None",
+ "-sGrayImageFilter#FlateEncode",
+ "-sColorImageFilter#FlateEncode",
+ "-dEPSCrop" if eps else "-sPAPERSIZE#%s" % ptype,
+ tmpfile, pdffile], _log)
+ cbook._check_and_log_subprocess(
+ ["pdftops", "-paper", "match", "-level2", pdffile, psfile], _log)
+
+ os.remove(tmpfile)
+ shutil.move(psfile, tmpfile)
+
+ if eps:
+ pstoeps(tmpfile)
+
+ for fname in glob.glob(tmpfile+'.*'):
+ os.remove(fname)
+
+
+def get_bbox_header(lbrt, rotated=False):
+ """
+ Return a postscript header string for the given bbox lbrt=(l, b, r, t).
+ Optionally, return rotate command.
+ """
+
+ l, b, r, t = lbrt
+ if rotated:
+ rotate = "%.2f %.2f translate\n90 rotate" % (l+r, 0)
+ else:
+ rotate = ""
+ bbox_info = '%%%%BoundingBox: %d %d %d %d' % (l, b, np.ceil(r), np.ceil(t))
+ hires_bbox_info = '%%%%HiResBoundingBox: %.6f %.6f %.6f %.6f' % (
+ l, b, r, t)
+
+ return '\n'.join([bbox_info, hires_bbox_info]), rotate
+
+
+def pstoeps(tmpfile, bbox=None, rotated=False):
+ """
+ Convert the postscript to encapsulated postscript. The bbox of
+ the eps file will be replaced with the given *bbox* argument. If
+ None, original bbox will be used.
+ """
+
+ # if rotated==True, the output eps file need to be rotated
+ if bbox:
+ bbox_info, rotate = get_bbox_header(bbox, rotated=rotated)
+ else:
+ bbox_info, rotate = None, None
+
+ epsfile = tmpfile + '.eps'
+ with open(epsfile, 'wb') as epsh, open(tmpfile, 'rb') as tmph:
+ write = epsh.write
+ # Modify the header:
+ for line in tmph:
+ if line.startswith(b'%!PS'):
+ write(b"%!PS-Adobe-3.0 EPSF-3.0\n")
+ if bbox:
+ write(bbox_info.encode('ascii') + b'\n')
+ elif line.startswith(b'%%EndComments'):
+ write(line)
+ write(b'%%BeginProlog\n'
+ b'save\n'
+ b'countdictstack\n'
+ b'mark\n'
+ b'newpath\n'
+ b'/showpage {} def\n'
+ b'/setpagedevice {pop} def\n'
+ b'%%EndProlog\n'
+ b'%%Page 1 1\n')
+ if rotate:
+ write(rotate.encode('ascii') + b'\n')
+ break
+ elif bbox and line.startswith((b'%%Bound', b'%%HiResBound',
+ b'%%DocumentMedia', b'%%Pages')):
+ pass
+ else:
+ write(line)
+ # Now rewrite the rest of the file, and modify the trailer.
+ # This is done in a second loop such that the header of the embedded
+ # eps file is not modified.
+ for line in tmph:
+ if line.startswith(b'%%EOF'):
+ write(b'cleartomark\n'
+ b'countdictstack\n'
+ b'exch sub { end } repeat\n'
+ b'restore\n'
+ b'showpage\n'
+ b'%%EOF\n')
+ elif line.startswith(b'%%PageBoundingBox'):
+ pass
+ else:
+ write(line)
+
+ os.remove(tmpfile)
+ shutil.move(epsfile, tmpfile)
+
+
+FigureManagerPS = FigureManagerBase
+
+
+# The following Python dictionary psDefs contains the entries for the
+# PostScript dictionary mpldict. This dictionary implements most of
+# the matplotlib primitives and some abbreviations.
+#
+# References:
+# http://www.adobe.com/products/postscript/pdfs/PLRM.pdf
+# http://www.mactech.com/articles/mactech/Vol.09/09.04/PostscriptTutorial/
+# http://www.math.ubc.ca/people/faculty/cass/graphics/text/www/
+#
+
+# The usage comments use the notation of the operator summary
+# in the PostScript Language reference manual.
+psDefs = [
+ # name proc *_d* -
+ # Note that this cannot be bound to /d, because when embedding a Type3 font
+ # we may want to define a "d" glyph using "/d{...} d" which would locally
+ # overwrite the definition.
+ "/_d { bind def } bind def",
+ # x y *m* -
+ "/m { moveto } _d",
+ # x y *l* -
+ "/l { lineto } _d",
+ # x y *r* -
+ "/r { rlineto } _d",
+ # x1 y1 x2 y2 x y *c* -
+ "/c { curveto } _d",
+ # *cl* -
+ "/cl { closepath } _d",
+ # *ce* -
+ "/ce { closepath eofill } _d",
+ # w h x y *box* -
+ """/box {
+ m
+ 1 index 0 r
+ 0 exch r
+ neg 0 r
+ cl
+ } _d""",
+ # w h x y *clipbox* -
+ """/clipbox {
+ box
+ clip
+ newpath
+ } _d""",
+ # wx wy llx lly urx ury *setcachedevice* -
+ "/sc { setcachedevice } _d",
+]
+
+
+@_Backend.export
+class _BackendPS(_Backend):
+ FigureCanvas = FigureCanvasPS
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_qt4.py b/venv/Lib/site-packages/matplotlib/backends/backend_qt4.py
new file mode 100644
index 0000000..9443bff
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_qt4.py
@@ -0,0 +1,15 @@
+from .. import _api
+from .backend_qt5 import (
+ backend_version, SPECIAL_KEYS,
+ SUPER, ALT, CTRL, SHIFT, MODIFIER_KEYS, # These are deprecated.
+ cursord, _create_qApp, _BackendQT5, TimerQT, MainWindow, FigureCanvasQT,
+ FigureManagerQT, NavigationToolbar2QT, SubplotToolQt, exception_handler)
+
+
+_api.warn_deprecated("3.3", name=__name__, obj_type="backend")
+
+
+@_BackendQT5.export
+class _BackendQT4(_BackendQT5):
+ class FigureCanvas(FigureCanvasQT):
+ required_interactive_framework = "qt4"
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_qt4agg.py b/venv/Lib/site-packages/matplotlib/backends/backend_qt4agg.py
new file mode 100644
index 0000000..9f028c4
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_qt4agg.py
@@ -0,0 +1,16 @@
+"""
+Render to qt from agg
+"""
+
+from .. import _api
+from .backend_qt5agg import (
+ _BackendQT5Agg, FigureCanvasQTAgg, FigureManagerQT, NavigationToolbar2QT)
+
+
+_api.warn_deprecated("3.3", name=__name__, obj_type="backend")
+
+
+@_BackendQT5Agg.export
+class _BackendQT4Agg(_BackendQT5Agg):
+ class FigureCanvas(FigureCanvasQTAgg):
+ required_interactive_framework = "qt4"
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_qt4cairo.py b/venv/Lib/site-packages/matplotlib/backends/backend_qt4cairo.py
new file mode 100644
index 0000000..650b816
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_qt4cairo.py
@@ -0,0 +1,11 @@
+from .. import _api
+from .backend_qt5cairo import _BackendQT5Cairo, FigureCanvasQTCairo
+
+
+_api.warn_deprecated("3.3", name=__name__, obj_type="backend")
+
+
+@_BackendQT5Cairo.export
+class _BackendQT4Cairo(_BackendQT5Cairo):
+ class FigureCanvas(FigureCanvasQTCairo):
+ required_interactive_framework = "qt4"
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_qt5.py b/venv/Lib/site-packages/matplotlib/backends/backend_qt5.py
new file mode 100644
index 0000000..0c2d32e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_qt5.py
@@ -0,0 +1,1031 @@
+import functools
+import os
+import signal
+import sys
+import traceback
+
+import matplotlib as mpl
+from matplotlib import _api, backend_tools, cbook
+from matplotlib._pylab_helpers import Gcf
+from matplotlib.backend_bases import (
+ _Backend, FigureCanvasBase, FigureManagerBase, NavigationToolbar2,
+ TimerBase, cursors, ToolContainerBase, StatusbarBase, MouseButton)
+import matplotlib.backends.qt_editor.figureoptions as figureoptions
+from matplotlib.backends.qt_editor._formsubplottool import UiSubplotTool
+from . import qt_compat
+from .qt_compat import (
+ QtCore, QtGui, QtWidgets, __version__, QT_API,
+ _devicePixelRatioF, _isdeleted, _setDevicePixelRatio,
+)
+
+backend_version = __version__
+
+# SPECIAL_KEYS are keys that do *not* return their unicode name
+# instead they have manually specified names
+SPECIAL_KEYS = {QtCore.Qt.Key_Control: 'control',
+ QtCore.Qt.Key_Shift: 'shift',
+ QtCore.Qt.Key_Alt: 'alt',
+ QtCore.Qt.Key_Meta: 'meta',
+ QtCore.Qt.Key_Super_L: 'super',
+ QtCore.Qt.Key_Super_R: 'super',
+ QtCore.Qt.Key_CapsLock: 'caps_lock',
+ QtCore.Qt.Key_Return: 'enter',
+ QtCore.Qt.Key_Left: 'left',
+ QtCore.Qt.Key_Up: 'up',
+ QtCore.Qt.Key_Right: 'right',
+ QtCore.Qt.Key_Down: 'down',
+ QtCore.Qt.Key_Escape: 'escape',
+ QtCore.Qt.Key_F1: 'f1',
+ QtCore.Qt.Key_F2: 'f2',
+ QtCore.Qt.Key_F3: 'f3',
+ QtCore.Qt.Key_F4: 'f4',
+ QtCore.Qt.Key_F5: 'f5',
+ QtCore.Qt.Key_F6: 'f6',
+ QtCore.Qt.Key_F7: 'f7',
+ QtCore.Qt.Key_F8: 'f8',
+ QtCore.Qt.Key_F9: 'f9',
+ QtCore.Qt.Key_F10: 'f10',
+ QtCore.Qt.Key_F11: 'f11',
+ QtCore.Qt.Key_F12: 'f12',
+ QtCore.Qt.Key_Home: 'home',
+ QtCore.Qt.Key_End: 'end',
+ QtCore.Qt.Key_PageUp: 'pageup',
+ QtCore.Qt.Key_PageDown: 'pagedown',
+ QtCore.Qt.Key_Tab: 'tab',
+ QtCore.Qt.Key_Backspace: 'backspace',
+ QtCore.Qt.Key_Enter: 'enter',
+ QtCore.Qt.Key_Insert: 'insert',
+ QtCore.Qt.Key_Delete: 'delete',
+ QtCore.Qt.Key_Pause: 'pause',
+ QtCore.Qt.Key_SysReq: 'sysreq',
+ QtCore.Qt.Key_Clear: 'clear', }
+if sys.platform == 'darwin':
+ # in OSX, the control and super (aka cmd/apple) keys are switched, so
+ # switch them back.
+ SPECIAL_KEYS.update({QtCore.Qt.Key_Control: 'cmd', # cmd/apple key
+ QtCore.Qt.Key_Meta: 'control',
+ })
+# Define which modifier keys are collected on keyboard events.
+# Elements are (Modifier Flag, Qt Key) tuples.
+# Order determines the modifier order (ctrl+alt+...) reported by Matplotlib.
+_MODIFIER_KEYS = [
+ (QtCore.Qt.ControlModifier, QtCore.Qt.Key_Control),
+ (QtCore.Qt.AltModifier, QtCore.Qt.Key_Alt),
+ (QtCore.Qt.ShiftModifier, QtCore.Qt.Key_Shift),
+ (QtCore.Qt.MetaModifier, QtCore.Qt.Key_Meta),
+]
+cursord = {
+ cursors.MOVE: QtCore.Qt.SizeAllCursor,
+ cursors.HAND: QtCore.Qt.PointingHandCursor,
+ cursors.POINTER: QtCore.Qt.ArrowCursor,
+ cursors.SELECT_REGION: QtCore.Qt.CrossCursor,
+ cursors.WAIT: QtCore.Qt.WaitCursor,
+ }
+SUPER = 0 # Deprecated.
+ALT = 1 # Deprecated.
+CTRL = 2 # Deprecated.
+SHIFT = 3 # Deprecated.
+MODIFIER_KEYS = [ # Deprecated.
+ (SPECIAL_KEYS[key], mod, key) for mod, key in _MODIFIER_KEYS]
+
+
+# make place holder
+qApp = None
+
+
+def _create_qApp():
+ """
+ Only one qApp can exist at a time, so check before creating one.
+ """
+ global qApp
+
+ if qApp is None:
+ app = QtWidgets.QApplication.instance()
+ if app is None:
+ # display_is_valid returns False only if on Linux and neither X11
+ # nor Wayland display can be opened.
+ if not mpl._c_internal_utils.display_is_valid():
+ raise RuntimeError('Invalid DISPLAY variable')
+ try:
+ QtWidgets.QApplication.setAttribute(
+ QtCore.Qt.AA_EnableHighDpiScaling)
+ except AttributeError: # Attribute only exists for Qt>=5.6.
+ pass
+ try:
+ QtWidgets.QApplication.setHighDpiScaleFactorRoundingPolicy(
+ QtCore.Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
+ except AttributeError: # Added in Qt>=5.14.
+ pass
+ qApp = QtWidgets.QApplication(["matplotlib"])
+ qApp.lastWindowClosed.connect(qApp.quit)
+ cbook._setup_new_guiapp()
+ else:
+ qApp = app
+
+ try:
+ qApp.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)
+ except AttributeError:
+ pass
+
+
+def _allow_super_init(__init__):
+ """
+ Decorator for ``__init__`` to allow ``super().__init__`` on PyQt4/PySide2.
+ """
+
+ if QT_API == "PyQt5":
+
+ return __init__
+
+ else:
+ # To work around lack of cooperative inheritance in PyQt4, PySide,
+ # and PySide2, when calling FigureCanvasQT.__init__, we temporarily
+ # patch QWidget.__init__ by a cooperative version, that first calls
+ # QWidget.__init__ with no additional arguments, and then finds the
+ # next class in the MRO with an __init__ that does support cooperative
+ # inheritance (i.e., not defined by the PyQt4, PySide, PySide2, sip
+ # or Shiboken packages), and manually call its `__init__`, once again
+ # passing the additional arguments.
+
+ qwidget_init = QtWidgets.QWidget.__init__
+
+ def cooperative_qwidget_init(self, *args, **kwargs):
+ qwidget_init(self)
+ mro = type(self).__mro__
+ next_coop_init = next(
+ cls for cls in mro[mro.index(QtWidgets.QWidget) + 1:]
+ if cls.__module__.split(".")[0] not in [
+ "PyQt4", "sip", "PySide", "PySide2", "Shiboken"])
+ next_coop_init.__init__(self, *args, **kwargs)
+
+ @functools.wraps(__init__)
+ def wrapper(self, *args, **kwargs):
+ with cbook._setattr_cm(QtWidgets.QWidget,
+ __init__=cooperative_qwidget_init):
+ __init__(self, *args, **kwargs)
+
+ return wrapper
+
+
+class TimerQT(TimerBase):
+ """Subclass of `.TimerBase` using QTimer events."""
+
+ def __init__(self, *args, **kwargs):
+ # Create a new timer and connect the timeout() signal to the
+ # _on_timer method.
+ self._timer = QtCore.QTimer()
+ self._timer.timeout.connect(self._on_timer)
+ super().__init__(*args, **kwargs)
+
+ def __del__(self):
+ # The check for deletedness is needed to avoid an error at animation
+ # shutdown with PySide2.
+ if not _isdeleted(self._timer):
+ self._timer_stop()
+
+ def _timer_set_single_shot(self):
+ self._timer.setSingleShot(self._single)
+
+ def _timer_set_interval(self):
+ self._timer.setInterval(self._interval)
+
+ def _timer_start(self):
+ self._timer.start()
+
+ def _timer_stop(self):
+ self._timer.stop()
+
+
+class FigureCanvasQT(QtWidgets.QWidget, FigureCanvasBase):
+ required_interactive_framework = "qt5"
+ _timer_cls = TimerQT
+
+ # map Qt button codes to MouseEvent's ones:
+ buttond = {QtCore.Qt.LeftButton: MouseButton.LEFT,
+ QtCore.Qt.MidButton: MouseButton.MIDDLE,
+ QtCore.Qt.RightButton: MouseButton.RIGHT,
+ QtCore.Qt.XButton1: MouseButton.BACK,
+ QtCore.Qt.XButton2: MouseButton.FORWARD,
+ }
+
+ @_allow_super_init
+ def __init__(self, figure=None):
+ _create_qApp()
+ super().__init__(figure=figure)
+
+ # We don't want to scale up the figure DPI more than once.
+ # Note, we don't handle a signal for changing DPI yet.
+ self.figure._original_dpi = self.figure.dpi
+ self._update_figure_dpi()
+ # In cases with mixed resolution displays, we need to be careful if the
+ # dpi_ratio changes - in this case we need to resize the canvas
+ # accordingly.
+ self._dpi_ratio_prev = self._dpi_ratio
+
+ self._draw_pending = False
+ self._is_drawing = False
+ self._draw_rect_callback = lambda painter: None
+
+ self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent)
+ self.setMouseTracking(True)
+ self.resize(*self.get_width_height())
+
+ palette = QtGui.QPalette(QtCore.Qt.white)
+ self.setPalette(palette)
+
+ def _update_figure_dpi(self):
+ dpi = self._dpi_ratio * self.figure._original_dpi
+ self.figure._set_dpi(dpi, forward=False)
+
+ @property
+ def _dpi_ratio(self):
+ return _devicePixelRatioF(self)
+
+ def _update_pixel_ratio(self):
+ # We need to be careful in cases with mixed resolution displays if
+ # dpi_ratio changes.
+ if self._dpi_ratio != self._dpi_ratio_prev:
+ # We need to update the figure DPI.
+ self._update_figure_dpi()
+ self._dpi_ratio_prev = self._dpi_ratio
+ # The easiest way to resize the canvas is to emit a resizeEvent
+ # since we implement all the logic for resizing the canvas for
+ # that event.
+ event = QtGui.QResizeEvent(self.size(), self.size())
+ self.resizeEvent(event)
+ # resizeEvent triggers a paintEvent itself, so we exit this one
+ # (after making sure that the event is immediately handled).
+
+ def _update_screen(self, screen):
+ # Handler for changes to a window's attached screen.
+ self._update_pixel_ratio()
+ if screen is not None:
+ screen.physicalDotsPerInchChanged.connect(self._update_pixel_ratio)
+ screen.logicalDotsPerInchChanged.connect(self._update_pixel_ratio)
+
+ def showEvent(self, event):
+ # Set up correct pixel ratio, and connect to any signal changes for it,
+ # once the window is shown (and thus has these attributes).
+ window = self.window().windowHandle()
+ window.screenChanged.connect(self._update_screen)
+ self._update_screen(window.screen())
+
+ def get_width_height(self):
+ w, h = FigureCanvasBase.get_width_height(self)
+ return int(w / self._dpi_ratio), int(h / self._dpi_ratio)
+
+ def enterEvent(self, event):
+ try:
+ x, y = self.mouseEventCoords(event.pos())
+ except AttributeError:
+ # the event from PyQt4 does not include the position
+ x = y = None
+ FigureCanvasBase.enter_notify_event(self, guiEvent=event, xy=(x, y))
+
+ def leaveEvent(self, event):
+ QtWidgets.QApplication.restoreOverrideCursor()
+ FigureCanvasBase.leave_notify_event(self, guiEvent=event)
+
+ def mouseEventCoords(self, pos):
+ """
+ Calculate mouse coordinates in physical pixels.
+
+ Qt5 use logical pixels, but the figure is scaled to physical
+ pixels for rendering. Transform to physical pixels so that
+ all of the down-stream transforms work as expected.
+
+ Also, the origin is different and needs to be corrected.
+ """
+ dpi_ratio = self._dpi_ratio
+ x = pos.x()
+ # flip y so y=0 is bottom of canvas
+ y = self.figure.bbox.height / dpi_ratio - pos.y()
+ return x * dpi_ratio, y * dpi_ratio
+
+ def mousePressEvent(self, event):
+ x, y = self.mouseEventCoords(event.pos())
+ button = self.buttond.get(event.button())
+ if button is not None:
+ FigureCanvasBase.button_press_event(self, x, y, button,
+ guiEvent=event)
+
+ def mouseDoubleClickEvent(self, event):
+ x, y = self.mouseEventCoords(event.pos())
+ button = self.buttond.get(event.button())
+ if button is not None:
+ FigureCanvasBase.button_press_event(self, x, y,
+ button, dblclick=True,
+ guiEvent=event)
+
+ def mouseMoveEvent(self, event):
+ x, y = self.mouseEventCoords(event)
+ FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=event)
+
+ def mouseReleaseEvent(self, event):
+ x, y = self.mouseEventCoords(event)
+ button = self.buttond.get(event.button())
+ if button is not None:
+ FigureCanvasBase.button_release_event(self, x, y, button,
+ guiEvent=event)
+
+ if QtCore.qVersion() >= "5.":
+ def wheelEvent(self, event):
+ x, y = self.mouseEventCoords(event)
+ # from QWheelEvent::delta doc
+ if event.pixelDelta().x() == 0 and event.pixelDelta().y() == 0:
+ steps = event.angleDelta().y() / 120
+ else:
+ steps = event.pixelDelta().y()
+ if steps:
+ FigureCanvasBase.scroll_event(
+ self, x, y, steps, guiEvent=event)
+ else:
+ def wheelEvent(self, event):
+ x = event.x()
+ # flipy so y=0 is bottom of canvas
+ y = self.figure.bbox.height - event.y()
+ # from QWheelEvent::delta doc
+ steps = event.delta() / 120
+ if event.orientation() == QtCore.Qt.Vertical:
+ FigureCanvasBase.scroll_event(
+ self, x, y, steps, guiEvent=event)
+
+ def keyPressEvent(self, event):
+ key = self._get_key(event)
+ if key is not None:
+ FigureCanvasBase.key_press_event(self, key, guiEvent=event)
+
+ def keyReleaseEvent(self, event):
+ key = self._get_key(event)
+ if key is not None:
+ FigureCanvasBase.key_release_event(self, key, guiEvent=event)
+
+ def resizeEvent(self, event):
+ w = event.size().width() * self._dpi_ratio
+ h = event.size().height() * self._dpi_ratio
+ dpival = self.figure.dpi
+ winch = w / dpival
+ hinch = h / dpival
+ self.figure.set_size_inches(winch, hinch, forward=False)
+ # pass back into Qt to let it finish
+ QtWidgets.QWidget.resizeEvent(self, event)
+ # emit our resize events
+ FigureCanvasBase.resize_event(self)
+
+ def sizeHint(self):
+ w, h = self.get_width_height()
+ return QtCore.QSize(w, h)
+
+ def minumumSizeHint(self):
+ return QtCore.QSize(10, 10)
+
+ def _get_key(self, event):
+ event_key = event.key()
+ event_mods = int(event.modifiers()) # actually a bitmask
+
+ # get names of the pressed modifier keys
+ # 'control' is named 'control' when a standalone key, but 'ctrl' when a
+ # modifier
+ # bit twiddling to pick out modifier keys from event_mods bitmask,
+ # if event_key is a MODIFIER, it should not be duplicated in mods
+ mods = [SPECIAL_KEYS[key].replace('control', 'ctrl')
+ for mod, key in _MODIFIER_KEYS
+ if event_key != key and event_mods & mod]
+ try:
+ # for certain keys (enter, left, backspace, etc) use a word for the
+ # key, rather than unicode
+ key = SPECIAL_KEYS[event_key]
+ except KeyError:
+ # unicode defines code points up to 0x10ffff (sys.maxunicode)
+ # QT will use Key_Codes larger than that for keyboard keys that are
+ # are not unicode characters (like multimedia keys)
+ # skip these
+ # if you really want them, you should add them to SPECIAL_KEYS
+ if event_key > sys.maxunicode:
+ return None
+
+ key = chr(event_key)
+ # qt delivers capitalized letters. fix capitalization
+ # note that capslock is ignored
+ if 'shift' in mods:
+ mods.remove('shift')
+ else:
+ key = key.lower()
+
+ return '+'.join(mods + [key])
+
+ def flush_events(self):
+ # docstring inherited
+ qApp.processEvents()
+
+ def start_event_loop(self, timeout=0):
+ # docstring inherited
+ if hasattr(self, "_event_loop") and self._event_loop.isRunning():
+ raise RuntimeError("Event loop already running")
+ self._event_loop = event_loop = QtCore.QEventLoop()
+ if timeout > 0:
+ timer = QtCore.QTimer.singleShot(int(timeout * 1000),
+ event_loop.quit)
+ event_loop.exec_()
+
+ def stop_event_loop(self, event=None):
+ # docstring inherited
+ if hasattr(self, "_event_loop"):
+ self._event_loop.quit()
+
+ def draw(self):
+ """Render the figure, and queue a request for a Qt draw."""
+ # The renderer draw is done here; delaying causes problems with code
+ # that uses the result of the draw() to update plot elements.
+ if self._is_drawing:
+ return
+ with cbook._setattr_cm(self, _is_drawing=True):
+ super().draw()
+ self.update()
+
+ def draw_idle(self):
+ """Queue redraw of the Agg buffer and request Qt paintEvent."""
+ # The Agg draw needs to be handled by the same thread Matplotlib
+ # modifies the scene graph from. Post Agg draw request to the
+ # current event loop in order to ensure thread affinity and to
+ # accumulate multiple draw requests from event handling.
+ # TODO: queued signal connection might be safer than singleShot
+ if not (getattr(self, '_draw_pending', False) or
+ getattr(self, '_is_drawing', False)):
+ self._draw_pending = True
+ QtCore.QTimer.singleShot(0, self._draw_idle)
+
+ def blit(self, bbox=None):
+ # docstring inherited
+ if bbox is None and self.figure:
+ bbox = self.figure.bbox # Blit the entire canvas if bbox is None.
+ # repaint uses logical pixels, not physical pixels like the renderer.
+ l, b, w, h = [int(pt / self._dpi_ratio) for pt in bbox.bounds]
+ t = b + h
+ self.repaint(l, self.rect().height() - t, w, h)
+
+ def _draw_idle(self):
+ with self._idle_draw_cntx():
+ if not self._draw_pending:
+ return
+ self._draw_pending = False
+ if self.height() < 0 or self.width() < 0:
+ return
+ try:
+ self.draw()
+ except Exception:
+ # Uncaught exceptions are fatal for PyQt5, so catch them.
+ traceback.print_exc()
+
+ def drawRectangle(self, rect):
+ # Draw the zoom rectangle to the QPainter. _draw_rect_callback needs
+ # to be called at the end of paintEvent.
+ if rect is not None:
+ x0, y0, w, h = [int(pt / self._dpi_ratio) for pt in rect]
+ x1 = x0 + w
+ y1 = y0 + h
+ def _draw_rect_callback(painter):
+ pen = QtGui.QPen(QtCore.Qt.black, 1 / self._dpi_ratio)
+ pen.setDashPattern([3, 3])
+ for color, offset in [
+ (QtCore.Qt.black, 0), (QtCore.Qt.white, 3)]:
+ pen.setDashOffset(offset)
+ pen.setColor(color)
+ painter.setPen(pen)
+ # Draw the lines from x0, y0 towards x1, y1 so that the
+ # dashes don't "jump" when moving the zoom box.
+ painter.drawLine(x0, y0, x0, y1)
+ painter.drawLine(x0, y0, x1, y0)
+ painter.drawLine(x0, y1, x1, y1)
+ painter.drawLine(x1, y0, x1, y1)
+ else:
+ def _draw_rect_callback(painter):
+ return
+ self._draw_rect_callback = _draw_rect_callback
+ self.update()
+
+
+class MainWindow(QtWidgets.QMainWindow):
+ closing = QtCore.Signal()
+
+ def closeEvent(self, event):
+ self.closing.emit()
+ super().closeEvent(event)
+
+
+class FigureManagerQT(FigureManagerBase):
+ """
+ Attributes
+ ----------
+ canvas : `FigureCanvas`
+ The FigureCanvas instance
+ num : int or str
+ The Figure number
+ toolbar : qt.QToolBar
+ The qt.QToolBar
+ window : qt.QMainWindow
+ The qt.QMainWindow
+ """
+
+ def __init__(self, canvas, num):
+ self.window = MainWindow()
+ super().__init__(canvas, num)
+ self.window.closing.connect(canvas.close_event)
+ self.window.closing.connect(self._widgetclosed)
+
+ image = str(cbook._get_data_path('images/matplotlib.svg'))
+ self.window.setWindowIcon(QtGui.QIcon(image))
+
+ self.window._destroying = False
+
+ self.toolbar = self._get_toolbar(self.canvas, self.window)
+
+ if self.toolmanager:
+ backend_tools.add_tools_to_manager(self.toolmanager)
+ if self.toolbar:
+ backend_tools.add_tools_to_container(self.toolbar)
+
+ if self.toolbar:
+ self.window.addToolBar(self.toolbar)
+ tbs_height = self.toolbar.sizeHint().height()
+ else:
+ tbs_height = 0
+
+ # resize the main window so it will display the canvas with the
+ # requested size:
+ cs = canvas.sizeHint()
+ cs_height = cs.height()
+ height = cs_height + tbs_height
+ self.window.resize(cs.width(), height)
+
+ self.window.setCentralWidget(self.canvas)
+
+ if mpl.is_interactive():
+ self.window.show()
+ self.canvas.draw_idle()
+
+ # Give the keyboard focus to the figure instead of the manager:
+ # StrongFocus accepts both tab and click to focus and will enable the
+ # canvas to process event without clicking.
+ # https://doc.qt.io/qt-5/qt.html#FocusPolicy-enum
+ self.canvas.setFocusPolicy(QtCore.Qt.StrongFocus)
+ self.canvas.setFocus()
+
+ self.window.raise_()
+
+ def full_screen_toggle(self):
+ if self.window.isFullScreen():
+ self.window.showNormal()
+ else:
+ self.window.showFullScreen()
+
+ def _widgetclosed(self):
+ if self.window._destroying:
+ return
+ self.window._destroying = True
+ try:
+ Gcf.destroy(self)
+ except AttributeError:
+ pass
+ # It seems that when the python session is killed,
+ # Gcf can get destroyed before the Gcf.destroy
+ # line is run, leading to a useless AttributeError.
+
+ def _get_toolbar(self, canvas, parent):
+ # must be inited after the window, drawingArea and figure
+ # attrs are set
+ if mpl.rcParams['toolbar'] == 'toolbar2':
+ toolbar = NavigationToolbar2QT(canvas, parent, True)
+ elif mpl.rcParams['toolbar'] == 'toolmanager':
+ toolbar = ToolbarQt(self.toolmanager, self.window)
+ else:
+ toolbar = None
+ return toolbar
+
+ def resize(self, width, height):
+ # these are Qt methods so they return sizes in 'virtual' pixels
+ # so we do not need to worry about dpi scaling here.
+ extra_width = self.window.width() - self.canvas.width()
+ extra_height = self.window.height() - self.canvas.height()
+ self.canvas.resize(width, height)
+ self.window.resize(width + extra_width, height + extra_height)
+
+ def show(self):
+ self.window.show()
+ if mpl.rcParams['figure.raise_window']:
+ self.window.activateWindow()
+ self.window.raise_()
+
+ def destroy(self, *args):
+ # check for qApp first, as PySide deletes it in its atexit handler
+ if QtWidgets.QApplication.instance() is None:
+ return
+ if self.window._destroying:
+ return
+ self.window._destroying = True
+ if self.toolbar:
+ self.toolbar.destroy()
+ self.window.close()
+
+ def get_window_title(self):
+ return self.window.windowTitle()
+
+ def set_window_title(self, title):
+ self.window.setWindowTitle(title)
+
+
+class NavigationToolbar2QT(NavigationToolbar2, QtWidgets.QToolBar):
+ message = QtCore.Signal(str)
+
+ toolitems = [*NavigationToolbar2.toolitems]
+ toolitems.insert(
+ # Add 'customize' action after 'subplots'
+ [name for name, *_ in toolitems].index("Subplots") + 1,
+ ("Customize", "Edit axis, curve and image parameters",
+ "qt4_editor_options", "edit_parameters"))
+
+ def __init__(self, canvas, parent, coordinates=True):
+ """coordinates: should we show the coordinates on the right?"""
+ QtWidgets.QToolBar.__init__(self, parent)
+ self.setAllowedAreas(
+ QtCore.Qt.TopToolBarArea | QtCore.Qt.BottomToolBarArea)
+
+ self.coordinates = coordinates
+ self._actions = {} # mapping of toolitem method names to QActions.
+
+ for text, tooltip_text, image_file, callback in self.toolitems:
+ if text is None:
+ self.addSeparator()
+ else:
+ a = self.addAction(self._icon(image_file + '.png'),
+ text, getattr(self, callback))
+ self._actions[callback] = a
+ if callback in ['zoom', 'pan']:
+ a.setCheckable(True)
+ if tooltip_text is not None:
+ a.setToolTip(tooltip_text)
+
+ # Add the (x, y) location widget at the right side of the toolbar
+ # The stretch factor is 1 which means any resizing of the toolbar
+ # will resize this label instead of the buttons.
+ if self.coordinates:
+ self.locLabel = QtWidgets.QLabel("", self)
+ self.locLabel.setAlignment(
+ QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
+ self.locLabel.setSizePolicy(
+ QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
+ QtWidgets.QSizePolicy.Ignored))
+ labelAction = self.addWidget(self.locLabel)
+ labelAction.setVisible(True)
+
+ NavigationToolbar2.__init__(self, canvas)
+
+ @_api.deprecated("3.3", alternative="self.canvas.parent()")
+ @property
+ def parent(self):
+ return self.canvas.parent()
+
+ @_api.deprecated("3.3", alternative="self.canvas.setParent()")
+ @parent.setter
+ def parent(self, value):
+ pass
+
+ @_api.deprecated(
+ "3.3", alternative="os.path.join(mpl.get_data_path(), 'images')")
+ @property
+ def basedir(self):
+ return str(cbook._get_data_path('images'))
+
+ def _icon(self, name):
+ """
+ Construct a `.QIcon` from an image file *name*, including the extension
+ and relative to Matplotlib's "images" data directory.
+ """
+ if QtCore.qVersion() >= '5.':
+ name = name.replace('.png', '_large.png')
+ pm = QtGui.QPixmap(str(cbook._get_data_path('images', name)))
+ _setDevicePixelRatio(pm, _devicePixelRatioF(self))
+ if self.palette().color(self.backgroundRole()).value() < 128:
+ icon_color = self.palette().color(self.foregroundRole())
+ mask = pm.createMaskFromColor(QtGui.QColor('black'),
+ QtCore.Qt.MaskOutColor)
+ pm.fill(icon_color)
+ pm.setMask(mask)
+ return QtGui.QIcon(pm)
+
+ def edit_parameters(self):
+ axes = self.canvas.figure.get_axes()
+ if not axes:
+ QtWidgets.QMessageBox.warning(
+ self.canvas.parent(), "Error", "There are no axes to edit.")
+ return
+ elif len(axes) == 1:
+ ax, = axes
+ else:
+ titles = [
+ ax.get_label() or
+ ax.get_title() or
+ " - ".join(filter(None, [ax.get_xlabel(), ax.get_ylabel()])) or
+ f""
+ for ax in axes]
+ duplicate_titles = [
+ title for title in titles if titles.count(title) > 1]
+ for i, ax in enumerate(axes):
+ if titles[i] in duplicate_titles:
+ titles[i] += f" (id: {id(ax):#x})" # Deduplicate titles.
+ item, ok = QtWidgets.QInputDialog.getItem(
+ self.canvas.parent(),
+ 'Customize', 'Select axes:', titles, 0, False)
+ if not ok:
+ return
+ ax = axes[titles.index(item)]
+ figureoptions.figure_edit(ax, self)
+
+ def _update_buttons_checked(self):
+ # sync button checkstates to match active mode
+ if 'pan' in self._actions:
+ self._actions['pan'].setChecked(self.mode.name == 'PAN')
+ if 'zoom' in self._actions:
+ self._actions['zoom'].setChecked(self.mode.name == 'ZOOM')
+
+ def pan(self, *args):
+ super().pan(*args)
+ self._update_buttons_checked()
+
+ def zoom(self, *args):
+ super().zoom(*args)
+ self._update_buttons_checked()
+
+ def set_message(self, s):
+ self.message.emit(s)
+ if self.coordinates:
+ self.locLabel.setText(s)
+
+ def set_cursor(self, cursor):
+ self.canvas.setCursor(cursord[cursor])
+
+ def draw_rubberband(self, event, x0, y0, x1, y1):
+ height = self.canvas.figure.bbox.height
+ y1 = height - y1
+ y0 = height - y0
+ rect = [int(val) for val in (x0, y0, x1 - x0, y1 - y0)]
+ self.canvas.drawRectangle(rect)
+
+ def remove_rubberband(self):
+ self.canvas.drawRectangle(None)
+
+ def configure_subplots(self):
+ image = str(cbook._get_data_path('images/matplotlib.png'))
+ dia = SubplotToolQt(self.canvas.figure, self.canvas.parent())
+ dia.setWindowIcon(QtGui.QIcon(image))
+ dia.exec_()
+
+ def save_figure(self, *args):
+ filetypes = self.canvas.get_supported_filetypes_grouped()
+ sorted_filetypes = sorted(filetypes.items())
+ default_filetype = self.canvas.get_default_filetype()
+
+ startpath = os.path.expanduser(mpl.rcParams['savefig.directory'])
+ start = os.path.join(startpath, self.canvas.get_default_filename())
+ filters = []
+ selectedFilter = None
+ for name, exts in sorted_filetypes:
+ exts_list = " ".join(['*.%s' % ext for ext in exts])
+ filter = '%s (%s)' % (name, exts_list)
+ if default_filetype in exts:
+ selectedFilter = filter
+ filters.append(filter)
+ filters = ';;'.join(filters)
+
+ fname, filter = qt_compat._getSaveFileName(
+ self.canvas.parent(), "Choose a filename to save to", start,
+ filters, selectedFilter)
+ if fname:
+ # Save dir for next time, unless empty str (i.e., use cwd).
+ if startpath != "":
+ mpl.rcParams['savefig.directory'] = os.path.dirname(fname)
+ try:
+ self.canvas.figure.savefig(fname)
+ except Exception as e:
+ QtWidgets.QMessageBox.critical(
+ self, "Error saving file", str(e),
+ QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.NoButton)
+
+ def set_history_buttons(self):
+ can_backward = self._nav_stack._pos > 0
+ can_forward = self._nav_stack._pos < len(self._nav_stack._elements) - 1
+ if 'back' in self._actions:
+ self._actions['back'].setEnabled(can_backward)
+ if 'forward' in self._actions:
+ self._actions['forward'].setEnabled(can_forward)
+
+
+class SubplotToolQt(UiSubplotTool):
+ def __init__(self, targetfig, parent):
+ super().__init__(None)
+
+ self._figure = targetfig
+
+ for lower, higher in [("bottom", "top"), ("left", "right")]:
+ self._widgets[lower].valueChanged.connect(
+ lambda val: self._widgets[higher].setMinimum(val + .001))
+ self._widgets[higher].valueChanged.connect(
+ lambda val: self._widgets[lower].setMaximum(val - .001))
+
+ self._attrs = ["top", "bottom", "left", "right", "hspace", "wspace"]
+ self._defaults = {attr: vars(self._figure.subplotpars)[attr]
+ for attr in self._attrs}
+
+ # Set values after setting the range callbacks, but before setting up
+ # the redraw callbacks.
+ self._reset()
+
+ for attr in self._attrs:
+ self._widgets[attr].valueChanged.connect(self._on_value_changed)
+ for action, method in [("Export values", self._export_values),
+ ("Tight layout", self._tight_layout),
+ ("Reset", self._reset),
+ ("Close", self.close)]:
+ self._widgets[action].clicked.connect(method)
+
+ def _export_values(self):
+ # Explicitly round to 3 decimals (which is also the spinbox precision)
+ # to avoid numbers of the form 0.100...001.
+ dialog = QtWidgets.QDialog()
+ layout = QtWidgets.QVBoxLayout()
+ dialog.setLayout(layout)
+ text = QtWidgets.QPlainTextEdit()
+ text.setReadOnly(True)
+ layout.addWidget(text)
+ text.setPlainText(
+ ",\n".join("{}={:.3}".format(attr, self._widgets[attr].value())
+ for attr in self._attrs))
+ # Adjust the height of the text widget to fit the whole text, plus
+ # some padding.
+ size = text.maximumSize()
+ size.setHeight(
+ QtGui.QFontMetrics(text.document().defaultFont())
+ .size(0, text.toPlainText()).height() + 20)
+ text.setMaximumSize(size)
+ dialog.exec_()
+
+ def _on_value_changed(self):
+ self._figure.subplots_adjust(**{attr: self._widgets[attr].value()
+ for attr in self._attrs})
+ self._figure.canvas.draw_idle()
+
+ def _tight_layout(self):
+ self._figure.tight_layout()
+ for attr in self._attrs:
+ widget = self._widgets[attr]
+ widget.blockSignals(True)
+ widget.setValue(vars(self._figure.subplotpars)[attr])
+ widget.blockSignals(False)
+ self._figure.canvas.draw_idle()
+
+ def _reset(self):
+ for attr, value in self._defaults.items():
+ self._widgets[attr].setValue(value)
+
+
+class ToolbarQt(ToolContainerBase, QtWidgets.QToolBar):
+ def __init__(self, toolmanager, parent):
+ ToolContainerBase.__init__(self, toolmanager)
+ QtWidgets.QToolBar.__init__(self, parent)
+ self.setAllowedAreas(
+ QtCore.Qt.TopToolBarArea | QtCore.Qt.BottomToolBarArea)
+ message_label = QtWidgets.QLabel("")
+ message_label.setAlignment(
+ QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
+ message_label.setSizePolicy(
+ QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
+ QtWidgets.QSizePolicy.Ignored))
+ self._message_action = self.addWidget(message_label)
+ self._toolitems = {}
+ self._groups = {}
+
+ def add_toolitem(
+ self, name, group, position, image_file, description, toggle):
+
+ button = QtWidgets.QToolButton(self)
+ if image_file:
+ button.setIcon(NavigationToolbar2QT._icon(self, image_file))
+ button.setText(name)
+ if description:
+ button.setToolTip(description)
+
+ def handler():
+ self.trigger_tool(name)
+ if toggle:
+ button.setCheckable(True)
+ button.toggled.connect(handler)
+ else:
+ button.clicked.connect(handler)
+
+ self._toolitems.setdefault(name, [])
+ self._add_to_group(group, name, button, position)
+ self._toolitems[name].append((button, handler))
+
+ def _add_to_group(self, group, name, button, position):
+ gr = self._groups.get(group, [])
+ if not gr:
+ sep = self.insertSeparator(self._message_action)
+ gr.append(sep)
+ before = gr[position]
+ widget = self.insertWidget(before, button)
+ gr.insert(position, widget)
+ self._groups[group] = gr
+
+ def toggle_toolitem(self, name, toggled):
+ if name not in self._toolitems:
+ return
+ for button, handler in self._toolitems[name]:
+ button.toggled.disconnect(handler)
+ button.setChecked(toggled)
+ button.toggled.connect(handler)
+
+ def remove_toolitem(self, name):
+ for button, handler in self._toolitems[name]:
+ button.setParent(None)
+ del self._toolitems[name]
+
+ def set_message(self, s):
+ self.widgetForAction(self._message_action).setText(s)
+
+
+@_api.deprecated("3.3")
+class StatusbarQt(StatusbarBase, QtWidgets.QLabel):
+ def __init__(self, window, *args, **kwargs):
+ StatusbarBase.__init__(self, *args, **kwargs)
+ QtWidgets.QLabel.__init__(self)
+ window.statusBar().addWidget(self)
+
+ def set_message(self, s):
+ self.setText(s)
+
+
+class ConfigureSubplotsQt(backend_tools.ConfigureSubplotsBase):
+ def trigger(self, *args):
+ NavigationToolbar2QT.configure_subplots(
+ self._make_classic_style_pseudo_toolbar())
+
+
+class SaveFigureQt(backend_tools.SaveFigureBase):
+ def trigger(self, *args):
+ NavigationToolbar2QT.save_figure(
+ self._make_classic_style_pseudo_toolbar())
+
+
+class SetCursorQt(backend_tools.SetCursorBase):
+ def set_cursor(self, cursor):
+ NavigationToolbar2QT.set_cursor(
+ self._make_classic_style_pseudo_toolbar(), cursor)
+
+
+class RubberbandQt(backend_tools.RubberbandBase):
+ def draw_rubberband(self, x0, y0, x1, y1):
+ NavigationToolbar2QT.draw_rubberband(
+ self._make_classic_style_pseudo_toolbar(), None, x0, y0, x1, y1)
+
+ def remove_rubberband(self):
+ NavigationToolbar2QT.remove_rubberband(
+ self._make_classic_style_pseudo_toolbar())
+
+
+class HelpQt(backend_tools.ToolHelpBase):
+ def trigger(self, *args):
+ QtWidgets.QMessageBox.information(None, "Help", self._get_help_html())
+
+
+class ToolCopyToClipboardQT(backend_tools.ToolCopyToClipboardBase):
+ def trigger(self, *args, **kwargs):
+ pixmap = self.canvas.grab()
+ qApp.clipboard().setPixmap(pixmap)
+
+
+backend_tools.ToolSaveFigure = SaveFigureQt
+backend_tools.ToolConfigureSubplots = ConfigureSubplotsQt
+backend_tools.ToolSetCursor = SetCursorQt
+backend_tools.ToolRubberband = RubberbandQt
+backend_tools.ToolHelp = HelpQt
+backend_tools.ToolCopyToClipboard = ToolCopyToClipboardQT
+
+
+@_Backend.export
+class _BackendQT5(_Backend):
+ FigureCanvas = FigureCanvasQT
+ FigureManager = FigureManagerQT
+
+ @staticmethod
+ def mainloop():
+ old_signal = signal.getsignal(signal.SIGINT)
+ # allow SIGINT exceptions to close the plot window.
+ is_python_signal_handler = old_signal is not None
+ if is_python_signal_handler:
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+ try:
+ qApp.exec_()
+ finally:
+ # reset the SIGINT exception handler
+ if is_python_signal_handler:
+ signal.signal(signal.SIGINT, old_signal)
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_qt5agg.py b/venv/Lib/site-packages/matplotlib/backends/backend_qt5agg.py
new file mode 100644
index 0000000..897c28c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_qt5agg.py
@@ -0,0 +1,84 @@
+"""
+Render to qt from agg.
+"""
+
+import ctypes
+
+from matplotlib.transforms import Bbox
+
+from .. import cbook
+from .backend_agg import FigureCanvasAgg
+from .backend_qt5 import (
+ QtCore, QtGui, QtWidgets, _BackendQT5, FigureCanvasQT, FigureManagerQT,
+ NavigationToolbar2QT, backend_version)
+from .qt_compat import QT_API, _setDevicePixelRatio
+
+
+class FigureCanvasQTAgg(FigureCanvasAgg, FigureCanvasQT):
+
+ def __init__(self, figure=None):
+ # Must pass 'figure' as kwarg to Qt base class.
+ super().__init__(figure=figure)
+
+ def paintEvent(self, event):
+ """
+ Copy the image from the Agg canvas to the qt.drawable.
+
+ In Qt, all drawing should be done inside of here when a widget is
+ shown onscreen.
+ """
+ self._draw_idle() # Only does something if a draw is pending.
+
+ # If the canvas does not have a renderer, then give up and wait for
+ # FigureCanvasAgg.draw(self) to be called.
+ if not hasattr(self, 'renderer'):
+ return
+
+ painter = QtGui.QPainter(self)
+ try:
+ # See documentation of QRect: bottom() and right() are off
+ # by 1, so use left() + width() and top() + height().
+ rect = event.rect()
+ # scale rect dimensions using the screen dpi ratio to get
+ # correct values for the Figure coordinates (rather than
+ # QT5's coords)
+ width = rect.width() * self._dpi_ratio
+ height = rect.height() * self._dpi_ratio
+ left, top = self.mouseEventCoords(rect.topLeft())
+ # shift the "top" by the height of the image to get the
+ # correct corner for our coordinate system
+ bottom = top - height
+ # same with the right side of the image
+ right = left + width
+ # create a buffer using the image bounding box
+ bbox = Bbox([[left, bottom], [right, top]])
+ reg = self.copy_from_bbox(bbox)
+ buf = cbook._unmultiplied_rgba8888_to_premultiplied_argb32(
+ memoryview(reg))
+
+ # clear the widget canvas
+ painter.eraseRect(rect)
+
+ qimage = QtGui.QImage(buf, buf.shape[1], buf.shape[0],
+ QtGui.QImage.Format_ARGB32_Premultiplied)
+ _setDevicePixelRatio(qimage, self._dpi_ratio)
+ # set origin using original QT coordinates
+ origin = QtCore.QPoint(rect.left(), rect.top())
+ painter.drawImage(origin, qimage)
+ # Adjust the buf reference count to work around a memory
+ # leak bug in QImage under PySide on Python 3.
+ if QT_API in ('PySide', 'PySide2'):
+ ctypes.c_long.from_address(id(buf)).value = 1
+
+ self._draw_rect_callback(painter)
+ finally:
+ painter.end()
+
+ def print_figure(self, *args, **kwargs):
+ super().print_figure(*args, **kwargs)
+ self.draw()
+
+
+@_BackendQT5.export
+class _BackendQT5Agg(_BackendQT5):
+ FigureCanvas = FigureCanvasQTAgg
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_qt5cairo.py b/venv/Lib/site-packages/matplotlib/backends/backend_qt5cairo.py
new file mode 100644
index 0000000..4b6d730
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_qt5cairo.py
@@ -0,0 +1,45 @@
+import ctypes
+
+from .backend_cairo import cairo, FigureCanvasCairo, RendererCairo
+from .backend_qt5 import QtCore, QtGui, _BackendQT5, FigureCanvasQT
+from .qt_compat import QT_API, _setDevicePixelRatio
+
+
+class FigureCanvasQTCairo(FigureCanvasQT, FigureCanvasCairo):
+ def __init__(self, figure=None):
+ super().__init__(figure=figure)
+ self._renderer = RendererCairo(self.figure.dpi)
+ self._renderer.set_width_height(-1, -1) # Invalid values.
+
+ def draw(self):
+ if hasattr(self._renderer.gc, "ctx"):
+ self.figure.draw(self._renderer)
+ super().draw()
+
+ def paintEvent(self, event):
+ dpi_ratio = self._dpi_ratio
+ width = int(dpi_ratio * self.width())
+ height = int(dpi_ratio * self.height())
+ if (width, height) != self._renderer.get_canvas_width_height():
+ surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
+ self._renderer.set_ctx_from_surface(surface)
+ self._renderer.set_width_height(width, height)
+ self.figure.draw(self._renderer)
+ buf = self._renderer.gc.ctx.get_target().get_data()
+ qimage = QtGui.QImage(buf, width, height,
+ QtGui.QImage.Format_ARGB32_Premultiplied)
+ # Adjust the buf reference count to work around a memory leak bug in
+ # QImage under PySide on Python 3.
+ if QT_API == 'PySide':
+ ctypes.c_long.from_address(id(buf)).value = 1
+ _setDevicePixelRatio(qimage, dpi_ratio)
+ painter = QtGui.QPainter(self)
+ painter.eraseRect(event.rect())
+ painter.drawImage(0, 0, qimage)
+ self._draw_rect_callback(painter)
+ painter.end()
+
+
+@_BackendQT5.export
+class _BackendQT5Cairo(_BackendQT5):
+ FigureCanvas = FigureCanvasQTCairo
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_svg.py b/venv/Lib/site-packages/matplotlib/backends/backend_svg.py
new file mode 100644
index 0000000..21a8536
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_svg.py
@@ -0,0 +1,1383 @@
+from collections import OrderedDict
+import base64
+import datetime
+import gzip
+import hashlib
+from io import BytesIO, StringIO, TextIOWrapper
+import itertools
+import logging
+import os
+import re
+import uuid
+
+import numpy as np
+from PIL import Image
+
+import matplotlib as mpl
+from matplotlib import _api, cbook
+from matplotlib.backend_bases import (
+ _Backend, _check_savefig_extra_args, FigureCanvasBase, FigureManagerBase,
+ RendererBase, _no_output_draw)
+from matplotlib.backends.backend_mixed import MixedModeRenderer
+from matplotlib.colors import rgb2hex
+from matplotlib.dates import UTC
+from matplotlib.font_manager import findfont, get_font
+from matplotlib.ft2font import LOAD_NO_HINTING
+from matplotlib.mathtext import MathTextParser
+from matplotlib.path import Path
+from matplotlib import _path
+from matplotlib.transforms import Affine2D, Affine2DBase
+
+_log = logging.getLogger(__name__)
+
+backend_version = mpl.__version__
+
+# ----------------------------------------------------------------------
+# SimpleXMLWriter class
+#
+# Based on an original by Fredrik Lundh, but modified here to:
+# 1. Support modern Python idioms
+# 2. Remove encoding support (it's handled by the file writer instead)
+# 3. Support proper indentation
+# 4. Minify things a little bit
+
+# --------------------------------------------------------------------
+# The SimpleXMLWriter module is
+#
+# Copyright (c) 2001-2004 by Fredrik Lundh
+#
+# By obtaining, using, and/or copying this software and/or its
+# associated documentation, you agree that you have read, understood,
+# and will comply with the following terms and conditions:
+#
+# Permission to use, copy, modify, and distribute this software and
+# its associated documentation for any purpose and without fee is
+# hereby granted, provided that the above copyright notice appears in
+# all copies, and that both that copyright notice and this permission
+# notice appear in supporting documentation, and that the name of
+# Secret Labs AB or the author not be used in advertising or publicity
+# pertaining to distribution of the software without specific, written
+# prior permission.
+#
+# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
+# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
+# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
+# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+# --------------------------------------------------------------------
+
+
+def escape_cdata(s):
+ s = s.replace("&", "&")
+ s = s.replace("<", "<")
+ s = s.replace(">", ">")
+ return s
+
+
+_escape_xml_comment = re.compile(r'-(?=-)')
+
+
+def escape_comment(s):
+ s = escape_cdata(s)
+ return _escape_xml_comment.sub('- ', s)
+
+
+def escape_attrib(s):
+ s = s.replace("&", "&")
+ s = s.replace("'", "'")
+ s = s.replace('"', """)
+ s = s.replace("<", "<")
+ s = s.replace(">", ">")
+ return s
+
+
+def short_float_fmt(x):
+ """
+ Create a short string representation of a float, which is %f
+ formatting with trailing zeros and the decimal point removed.
+ """
+ return '{0:f}'.format(x).rstrip('0').rstrip('.')
+
+
+class XMLWriter:
+ """
+ Parameters
+ ----------
+ file : writable text file-like object
+ """
+
+ def __init__(self, file):
+ self.__write = file.write
+ if hasattr(file, "flush"):
+ self.flush = file.flush
+ self.__open = 0 # true if start tag is open
+ self.__tags = []
+ self.__data = []
+ self.__indentation = " " * 64
+
+ def __flush(self, indent=True):
+ # flush internal buffers
+ if self.__open:
+ if indent:
+ self.__write(">\n")
+ else:
+ self.__write(">")
+ self.__open = 0
+ if self.__data:
+ data = ''.join(self.__data)
+ self.__write(escape_cdata(data))
+ self.__data = []
+
+ def start(self, tag, attrib={}, **extra):
+ """
+ Open a new element. Attributes can be given as keyword
+ arguments, or as a string/string dictionary. The method returns
+ an opaque identifier that can be passed to the :meth:`close`
+ method, to close all open elements up to and including this one.
+
+ Parameters
+ ----------
+ tag
+ Element tag.
+ attrib
+ Attribute dictionary. Alternatively, attributes can be given as
+ keyword arguments.
+
+ Returns
+ -------
+ An element identifier.
+ """
+ self.__flush()
+ tag = escape_cdata(tag)
+ self.__data = []
+ self.__tags.append(tag)
+ self.__write(self.__indentation[:len(self.__tags) - 1])
+ self.__write("<%s" % tag)
+ for k, v in sorted({**attrib, **extra}.items()):
+ if v:
+ k = escape_cdata(k)
+ v = escape_attrib(v)
+ self.__write(' %s="%s"' % (k, v))
+ self.__open = 1
+ return len(self.__tags) - 1
+
+ def comment(self, comment):
+ """
+ Add a comment to the output stream.
+
+ Parameters
+ ----------
+ comment : str
+ Comment text.
+ """
+ self.__flush()
+ self.__write(self.__indentation[:len(self.__tags)])
+ self.__write("\n" % escape_comment(comment))
+
+ def data(self, text):
+ """
+ Add character data to the output stream.
+
+ Parameters
+ ----------
+ text : str
+ Character data.
+ """
+ self.__data.append(text)
+
+ def end(self, tag=None, indent=True):
+ """
+ Close the current element (opened by the most recent call to
+ :meth:`start`).
+
+ Parameters
+ ----------
+ tag
+ Element tag. If given, the tag must match the start tag. If
+ omitted, the current element is closed.
+ """
+ if tag:
+ assert self.__tags, "unbalanced end(%s)" % tag
+ assert escape_cdata(tag) == self.__tags[-1], \
+ "expected end(%s), got %s" % (self.__tags[-1], tag)
+ else:
+ assert self.__tags, "unbalanced end()"
+ tag = self.__tags.pop()
+ if self.__data:
+ self.__flush(indent)
+ elif self.__open:
+ self.__open = 0
+ self.__write("/>\n")
+ return
+ if indent:
+ self.__write(self.__indentation[:len(self.__tags)])
+ self.__write("%s>\n" % tag)
+
+ def close(self, id):
+ """
+ Close open elements, up to (and including) the element identified
+ by the given identifier.
+
+ Parameters
+ ----------
+ id
+ Element identifier, as returned by the :meth:`start` method.
+ """
+ while len(self.__tags) > id:
+ self.end()
+
+ def element(self, tag, text=None, attrib={}, **extra):
+ """
+ Add an entire element. This is the same as calling :meth:`start`,
+ :meth:`data`, and :meth:`end` in sequence. The *text* argument can be
+ omitted.
+ """
+ self.start(tag, attrib, **extra)
+ if text:
+ self.data(text)
+ self.end(indent=False)
+
+ def flush(self):
+ """Flush the output stream."""
+ pass # replaced by the constructor
+
+
+def generate_transform(transform_list=[]):
+ if len(transform_list):
+ output = StringIO()
+ for type, value in transform_list:
+ if (type == 'scale' and (value == (1,) or value == (1, 1))
+ or type == 'translate' and value == (0, 0)
+ or type == 'rotate' and value == (0,)):
+ continue
+ if type == 'matrix' and isinstance(value, Affine2DBase):
+ value = value.to_values()
+ output.write('%s(%s)' % (
+ type, ' '.join(short_float_fmt(x) for x in value)))
+ return output.getvalue()
+ return ''
+
+
+def generate_css(attrib={}):
+ if attrib:
+ output = StringIO()
+ attrib = sorted(attrib.items())
+ for k, v in attrib:
+ k = escape_attrib(k)
+ v = escape_attrib(v)
+ output.write("%s:%s;" % (k, v))
+ return output.getvalue()
+ return ''
+
+
+_capstyle_d = {'projecting': 'square', 'butt': 'butt', 'round': 'round'}
+
+
+class RendererSVG(RendererBase):
+ def __init__(self, width, height, svgwriter, basename=None, image_dpi=72,
+ *, metadata=None):
+ self.width = width
+ self.height = height
+ self.writer = XMLWriter(svgwriter)
+ self.image_dpi = image_dpi # actual dpi at which we rasterize stuff
+
+ self._groupd = {}
+ self.basename = basename
+ self._image_counter = itertools.count()
+ self._clipd = OrderedDict()
+ self._markers = {}
+ self._path_collection_id = 0
+ self._hatchd = OrderedDict()
+ self._has_gouraud = False
+ self._n_gradients = 0
+ self._fonts = OrderedDict()
+
+ super().__init__()
+ self._glyph_map = dict()
+ str_height = short_float_fmt(height)
+ str_width = short_float_fmt(width)
+ svgwriter.write(svgProlog)
+ self._start_id = self.writer.start(
+ 'svg',
+ width='%spt' % str_width,
+ height='%spt' % str_height,
+ viewBox='0 0 %s %s' % (str_width, str_height),
+ xmlns="http://www.w3.org/2000/svg",
+ version="1.1",
+ attrib={'xmlns:xlink': "http://www.w3.org/1999/xlink"})
+ self._write_metadata(metadata)
+ self._write_default_style()
+
+ @_api.deprecated("3.4")
+ @property
+ def mathtext_parser(self):
+ return MathTextParser('SVG')
+
+ def finalize(self):
+ self._write_clips()
+ self._write_hatches()
+ self.writer.close(self._start_id)
+ self.writer.flush()
+
+ def _write_metadata(self, metadata):
+ # Add metadata following the Dublin Core Metadata Initiative, and the
+ # Creative Commons Rights Expression Language. This is mainly for
+ # compatibility with Inkscape.
+ if metadata is None:
+ metadata = {}
+ metadata = {
+ 'Format': 'image/svg+xml',
+ 'Type': 'http://purl.org/dc/dcmitype/StillImage',
+ 'Creator':
+ f'Matplotlib v{mpl.__version__}, https://matplotlib.org/',
+ **metadata
+ }
+ writer = self.writer
+
+ if 'Title' in metadata:
+ writer.element('title', text=metadata['Title'])
+
+ # Special handling.
+ date = metadata.get('Date', None)
+ if date is not None:
+ if isinstance(date, str):
+ dates = [date]
+ elif isinstance(date, (datetime.datetime, datetime.date)):
+ dates = [date.isoformat()]
+ elif np.iterable(date):
+ dates = []
+ for d in date:
+ if isinstance(d, str):
+ dates.append(d)
+ elif isinstance(d, (datetime.datetime, datetime.date)):
+ dates.append(d.isoformat())
+ else:
+ raise ValueError(
+ 'Invalid type for Date metadata. '
+ 'Expected iterable of str, date, or datetime, '
+ 'not {!r}.'.format(type(d)))
+ else:
+ raise ValueError('Invalid type for Date metadata. '
+ 'Expected str, date, datetime, or iterable '
+ 'of the same, not {!r}.'.format(type(date)))
+ metadata['Date'] = '/'.join(dates)
+ elif 'Date' not in metadata:
+ # Do not add `Date` if the user explicitly set `Date` to `None`
+ # Get source date from SOURCE_DATE_EPOCH, if set.
+ # See https://reproducible-builds.org/specs/source-date-epoch/
+ date = os.getenv("SOURCE_DATE_EPOCH")
+ if date:
+ date = datetime.datetime.utcfromtimestamp(int(date))
+ metadata['Date'] = date.replace(tzinfo=UTC).isoformat()
+ else:
+ metadata['Date'] = datetime.datetime.today().isoformat()
+
+ mid = None
+ def ensure_metadata(mid):
+ if mid is not None:
+ return mid
+ mid = writer.start('metadata')
+ writer.start('rdf:RDF', attrib={
+ 'xmlns:dc': "http://purl.org/dc/elements/1.1/",
+ 'xmlns:cc': "http://creativecommons.org/ns#",
+ 'xmlns:rdf': "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+ })
+ writer.start('cc:Work')
+ return mid
+
+ uri = metadata.pop('Type', None)
+ if uri is not None:
+ mid = ensure_metadata(mid)
+ writer.element('dc:type', attrib={'rdf:resource': uri})
+
+ # Single value only.
+ for key in ['title', 'coverage', 'date', 'description', 'format',
+ 'identifier', 'language', 'relation', 'source']:
+ info = metadata.pop(key.title(), None)
+ if info is not None:
+ mid = ensure_metadata(mid)
+ writer.element(f'dc:{key}', text=info)
+
+ # Multiple Agent values.
+ for key in ['creator', 'contributor', 'publisher', 'rights']:
+ agents = metadata.pop(key.title(), None)
+ if agents is None:
+ continue
+
+ if isinstance(agents, str):
+ agents = [agents]
+
+ mid = ensure_metadata(mid)
+ writer.start(f'dc:{key}')
+ for agent in agents:
+ writer.start('cc:Agent')
+ writer.element('dc:title', text=agent)
+ writer.end('cc:Agent')
+ writer.end(f'dc:{key}')
+
+ # Multiple values.
+ keywords = metadata.pop('Keywords', None)
+ if keywords is not None:
+ if isinstance(keywords, str):
+ keywords = [keywords]
+
+ mid = ensure_metadata(mid)
+ writer.start('dc:subject')
+ writer.start('rdf:Bag')
+ for keyword in keywords:
+ writer.element('rdf:li', text=keyword)
+ writer.end('rdf:Bag')
+ writer.end('dc:subject')
+
+ if mid is not None:
+ writer.close(mid)
+
+ if metadata:
+ raise ValueError('Unknown metadata key(s) passed to SVG writer: ' +
+ ','.join(metadata))
+
+ def _write_default_style(self):
+ writer = self.writer
+ default_style = generate_css({
+ 'stroke-linejoin': 'round',
+ 'stroke-linecap': 'butt'})
+ writer.start('defs')
+ writer.element('style', type='text/css', text='*{%s}' % default_style)
+ writer.end('defs')
+
+ def _make_id(self, type, content):
+ salt = mpl.rcParams['svg.hashsalt']
+ if salt is None:
+ salt = str(uuid.uuid4())
+ m = hashlib.sha256()
+ m.update(salt.encode('utf8'))
+ m.update(str(content).encode('utf8'))
+ return '%s%s' % (type, m.hexdigest()[:10])
+
+ def _make_flip_transform(self, transform):
+ return (transform +
+ Affine2D()
+ .scale(1.0, -1.0)
+ .translate(0.0, self.height))
+
+ def _get_font(self, prop):
+ fname = findfont(prop)
+ font = get_font(fname)
+ font.clear()
+ size = prop.get_size_in_points()
+ font.set_size(size, 72.0)
+ return font
+
+ def _get_hatch(self, gc, rgbFace):
+ """
+ Create a new hatch pattern
+ """
+ if rgbFace is not None:
+ rgbFace = tuple(rgbFace)
+ edge = gc.get_hatch_color()
+ if edge is not None:
+ edge = tuple(edge)
+ dictkey = (gc.get_hatch(), rgbFace, edge)
+ oid = self._hatchd.get(dictkey)
+ if oid is None:
+ oid = self._make_id('h', dictkey)
+ self._hatchd[dictkey] = ((gc.get_hatch_path(), rgbFace, edge), oid)
+ else:
+ _, oid = oid
+ return oid
+
+ def _write_hatches(self):
+ if not len(self._hatchd):
+ return
+ HATCH_SIZE = 72
+ writer = self.writer
+ writer.start('defs')
+ for (path, face, stroke), oid in self._hatchd.values():
+ writer.start(
+ 'pattern',
+ id=oid,
+ patternUnits="userSpaceOnUse",
+ x="0", y="0", width=str(HATCH_SIZE),
+ height=str(HATCH_SIZE))
+ path_data = self._convert_path(
+ path,
+ Affine2D()
+ .scale(HATCH_SIZE).scale(1.0, -1.0).translate(0, HATCH_SIZE),
+ simplify=False)
+ if face is None:
+ fill = 'none'
+ else:
+ fill = rgb2hex(face)
+ writer.element(
+ 'rect',
+ x="0", y="0", width=str(HATCH_SIZE+1),
+ height=str(HATCH_SIZE+1),
+ fill=fill)
+ hatch_style = {
+ 'fill': rgb2hex(stroke),
+ 'stroke': rgb2hex(stroke),
+ 'stroke-width': str(mpl.rcParams['hatch.linewidth']),
+ 'stroke-linecap': 'butt',
+ 'stroke-linejoin': 'miter'
+ }
+ if stroke[3] < 1:
+ hatch_style['stroke-opacity'] = str(stroke[3])
+ writer.element(
+ 'path',
+ d=path_data,
+ style=generate_css(hatch_style)
+ )
+ writer.end('pattern')
+ writer.end('defs')
+
+ def _get_style_dict(self, gc, rgbFace):
+ """Generate a style string from the GraphicsContext and rgbFace."""
+ attrib = {}
+
+ forced_alpha = gc.get_forced_alpha()
+
+ if gc.get_hatch() is not None:
+ attrib['fill'] = "url(#%s)" % self._get_hatch(gc, rgbFace)
+ if (rgbFace is not None and len(rgbFace) == 4 and rgbFace[3] != 1.0
+ and not forced_alpha):
+ attrib['fill-opacity'] = short_float_fmt(rgbFace[3])
+ else:
+ if rgbFace is None:
+ attrib['fill'] = 'none'
+ else:
+ if tuple(rgbFace[:3]) != (0, 0, 0):
+ attrib['fill'] = rgb2hex(rgbFace)
+ if (len(rgbFace) == 4 and rgbFace[3] != 1.0
+ and not forced_alpha):
+ attrib['fill-opacity'] = short_float_fmt(rgbFace[3])
+
+ if forced_alpha and gc.get_alpha() != 1.0:
+ attrib['opacity'] = short_float_fmt(gc.get_alpha())
+
+ offset, seq = gc.get_dashes()
+ if seq is not None:
+ attrib['stroke-dasharray'] = ','.join(
+ short_float_fmt(val) for val in seq)
+ attrib['stroke-dashoffset'] = short_float_fmt(float(offset))
+
+ linewidth = gc.get_linewidth()
+ if linewidth:
+ rgb = gc.get_rgb()
+ attrib['stroke'] = rgb2hex(rgb)
+ if not forced_alpha and rgb[3] != 1.0:
+ attrib['stroke-opacity'] = short_float_fmt(rgb[3])
+ if linewidth != 1.0:
+ attrib['stroke-width'] = short_float_fmt(linewidth)
+ if gc.get_joinstyle() != 'round':
+ attrib['stroke-linejoin'] = gc.get_joinstyle()
+ if gc.get_capstyle() != 'butt':
+ attrib['stroke-linecap'] = _capstyle_d[gc.get_capstyle()]
+
+ return attrib
+
+ def _get_style(self, gc, rgbFace):
+ return generate_css(self._get_style_dict(gc, rgbFace))
+
+ def _get_clip(self, gc):
+ cliprect = gc.get_clip_rectangle()
+ clippath, clippath_trans = gc.get_clip_path()
+ if clippath is not None:
+ clippath_trans = self._make_flip_transform(clippath_trans)
+ dictkey = (id(clippath), str(clippath_trans))
+ elif cliprect is not None:
+ x, y, w, h = cliprect.bounds
+ y = self.height-(y+h)
+ dictkey = (x, y, w, h)
+ else:
+ return None
+
+ clip = self._clipd.get(dictkey)
+ if clip is None:
+ oid = self._make_id('p', dictkey)
+ if clippath is not None:
+ self._clipd[dictkey] = ((clippath, clippath_trans), oid)
+ else:
+ self._clipd[dictkey] = (dictkey, oid)
+ else:
+ clip, oid = clip
+ return oid
+
+ def _write_clips(self):
+ if not len(self._clipd):
+ return
+ writer = self.writer
+ writer.start('defs')
+ for clip, oid in self._clipd.values():
+ writer.start('clipPath', id=oid)
+ if len(clip) == 2:
+ clippath, clippath_trans = clip
+ path_data = self._convert_path(
+ clippath, clippath_trans, simplify=False)
+ writer.element('path', d=path_data)
+ else:
+ x, y, w, h = clip
+ writer.element(
+ 'rect',
+ x=short_float_fmt(x),
+ y=short_float_fmt(y),
+ width=short_float_fmt(w),
+ height=short_float_fmt(h))
+ writer.end('clipPath')
+ writer.end('defs')
+
+ def open_group(self, s, gid=None):
+ # docstring inherited
+ if gid:
+ self.writer.start('g', id=gid)
+ else:
+ self._groupd[s] = self._groupd.get(s, 0) + 1
+ self.writer.start('g', id="%s_%d" % (s, self._groupd[s]))
+
+ def close_group(self, s):
+ # docstring inherited
+ self.writer.end('g')
+
+ def option_image_nocomposite(self):
+ # docstring inherited
+ return not mpl.rcParams['image.composite_image']
+
+ def _convert_path(self, path, transform=None, clip=None, simplify=None,
+ sketch=None):
+ if clip:
+ clip = (0.0, 0.0, self.width, self.height)
+ else:
+ clip = None
+ return _path.convert_to_string(
+ path, transform, clip, simplify, sketch, 6,
+ [b'M', b'L', b'Q', b'C', b'z'], False).decode('ascii')
+
+ def draw_path(self, gc, path, transform, rgbFace=None):
+ # docstring inherited
+ trans_and_flip = self._make_flip_transform(transform)
+ clip = (rgbFace is None and gc.get_hatch_path() is None)
+ simplify = path.should_simplify and clip
+ path_data = self._convert_path(
+ path, trans_and_flip, clip=clip, simplify=simplify,
+ sketch=gc.get_sketch_params())
+
+ attrib = {}
+ attrib['style'] = self._get_style(gc, rgbFace)
+
+ clipid = self._get_clip(gc)
+ if clipid is not None:
+ attrib['clip-path'] = 'url(#%s)' % clipid
+
+ if gc.get_url() is not None:
+ self.writer.start('a', {'xlink:href': gc.get_url()})
+ self.writer.element('path', d=path_data, attrib=attrib)
+ if gc.get_url() is not None:
+ self.writer.end('a')
+
+ def draw_markers(
+ self, gc, marker_path, marker_trans, path, trans, rgbFace=None):
+ # docstring inherited
+
+ if not len(path.vertices):
+ return
+
+ writer = self.writer
+ path_data = self._convert_path(
+ marker_path,
+ marker_trans + Affine2D().scale(1.0, -1.0),
+ simplify=False)
+ style = self._get_style_dict(gc, rgbFace)
+ dictkey = (path_data, generate_css(style))
+ oid = self._markers.get(dictkey)
+ style = generate_css({k: v for k, v in style.items()
+ if k.startswith('stroke')})
+
+ if oid is None:
+ oid = self._make_id('m', dictkey)
+ writer.start('defs')
+ writer.element('path', id=oid, d=path_data, style=style)
+ writer.end('defs')
+ self._markers[dictkey] = oid
+
+ attrib = {}
+ clipid = self._get_clip(gc)
+ if clipid is not None:
+ attrib['clip-path'] = 'url(#%s)' % clipid
+ writer.start('g', attrib=attrib)
+
+ trans_and_flip = self._make_flip_transform(trans)
+ attrib = {'xlink:href': '#%s' % oid}
+ clip = (0, 0, self.width*72, self.height*72)
+ for vertices, code in path.iter_segments(
+ trans_and_flip, clip=clip, simplify=False):
+ if len(vertices):
+ x, y = vertices[-2:]
+ attrib['x'] = short_float_fmt(x)
+ attrib['y'] = short_float_fmt(y)
+ attrib['style'] = self._get_style(gc, rgbFace)
+ writer.element('use', attrib=attrib)
+ writer.end('g')
+
+ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
+ offsets, offsetTrans, facecolors, edgecolors,
+ linewidths, linestyles, antialiaseds, urls,
+ offset_position):
+ # Is the optimization worth it? Rough calculation:
+ # cost of emitting a path in-line is
+ # (len_path + 5) * uses_per_path
+ # cost of definition+use is
+ # (len_path + 3) + 9 * uses_per_path
+ len_path = len(paths[0].vertices) if len(paths) > 0 else 0
+ uses_per_path = self._iter_collection_uses_per_path(
+ paths, all_transforms, offsets, facecolors, edgecolors)
+ should_do_optimization = \
+ len_path + 9 * uses_per_path + 3 < (len_path + 5) * uses_per_path
+ if not should_do_optimization:
+ return super().draw_path_collection(
+ gc, master_transform, paths, all_transforms,
+ offsets, offsetTrans, facecolors, edgecolors,
+ linewidths, linestyles, antialiaseds, urls,
+ offset_position)
+
+ writer = self.writer
+ path_codes = []
+ writer.start('defs')
+ for i, (path, transform) in enumerate(self._iter_collection_raw_paths(
+ master_transform, paths, all_transforms)):
+ transform = Affine2D(transform.get_matrix()).scale(1.0, -1.0)
+ d = self._convert_path(path, transform, simplify=False)
+ oid = 'C%x_%x_%s' % (
+ self._path_collection_id, i, self._make_id('', d))
+ writer.element('path', id=oid, d=d)
+ path_codes.append(oid)
+ writer.end('defs')
+
+ for xo, yo, path_id, gc0, rgbFace in self._iter_collection(
+ gc, master_transform, all_transforms, path_codes, offsets,
+ offsetTrans, facecolors, edgecolors, linewidths, linestyles,
+ antialiaseds, urls, offset_position):
+ clipid = self._get_clip(gc0)
+ url = gc0.get_url()
+ if url is not None:
+ writer.start('a', attrib={'xlink:href': url})
+ if clipid is not None:
+ writer.start('g', attrib={'clip-path': 'url(#%s)' % clipid})
+ attrib = {
+ 'xlink:href': '#%s' % path_id,
+ 'x': short_float_fmt(xo),
+ 'y': short_float_fmt(self.height - yo),
+ 'style': self._get_style(gc0, rgbFace)
+ }
+ writer.element('use', attrib=attrib)
+ if clipid is not None:
+ writer.end('g')
+ if url is not None:
+ writer.end('a')
+
+ self._path_collection_id += 1
+
+ def draw_gouraud_triangle(self, gc, points, colors, trans):
+ # docstring inherited
+
+ # This uses a method described here:
+ #
+ # http://www.svgopen.org/2005/papers/Converting3DFaceToSVG/index.html
+ #
+ # that uses three overlapping linear gradients to simulate a
+ # Gouraud triangle. Each gradient goes from fully opaque in
+ # one corner to fully transparent along the opposite edge.
+ # The line between the stop points is perpendicular to the
+ # opposite edge. Underlying these three gradients is a solid
+ # triangle whose color is the average of all three points.
+
+ writer = self.writer
+ if not self._has_gouraud:
+ self._has_gouraud = True
+ writer.start(
+ 'filter',
+ id='colorAdd')
+ writer.element(
+ 'feComposite',
+ attrib={'in': 'SourceGraphic'},
+ in2='BackgroundImage',
+ operator='arithmetic',
+ k2="1", k3="1")
+ writer.end('filter')
+ # feColorMatrix filter to correct opacity
+ writer.start(
+ 'filter',
+ id='colorMat')
+ writer.element(
+ 'feColorMatrix',
+ attrib={'type': 'matrix'},
+ values='1 0 0 0 0 \n0 1 0 0 0 \n0 0 1 0 0' +
+ ' \n1 1 1 1 0 \n0 0 0 0 1 ')
+ writer.end('filter')
+
+ avg_color = np.average(colors, axis=0)
+ if avg_color[-1] == 0:
+ # Skip fully-transparent triangles
+ return
+
+ trans_and_flip = self._make_flip_transform(trans)
+ tpoints = trans_and_flip.transform(points)
+
+ writer.start('defs')
+ for i in range(3):
+ x1, y1 = tpoints[i]
+ x2, y2 = tpoints[(i + 1) % 3]
+ x3, y3 = tpoints[(i + 2) % 3]
+ rgba_color = colors[i]
+
+ if x2 == x3:
+ xb = x2
+ yb = y1
+ elif y2 == y3:
+ xb = x1
+ yb = y2
+ else:
+ m1 = (y2 - y3) / (x2 - x3)
+ b1 = y2 - (m1 * x2)
+ m2 = -(1.0 / m1)
+ b2 = y1 - (m2 * x1)
+ xb = (-b1 + b2) / (m1 - m2)
+ yb = m2 * xb + b2
+
+ writer.start(
+ 'linearGradient',
+ id="GR%x_%d" % (self._n_gradients, i),
+ gradientUnits="userSpaceOnUse",
+ x1=short_float_fmt(x1), y1=short_float_fmt(y1),
+ x2=short_float_fmt(xb), y2=short_float_fmt(yb))
+ writer.element(
+ 'stop',
+ offset='1',
+ style=generate_css({
+ 'stop-color': rgb2hex(avg_color),
+ 'stop-opacity': short_float_fmt(rgba_color[-1])}))
+ writer.element(
+ 'stop',
+ offset='0',
+ style=generate_css({'stop-color': rgb2hex(rgba_color),
+ 'stop-opacity': "0"}))
+
+ writer.end('linearGradient')
+
+ writer.end('defs')
+
+ # triangle formation using "path"
+ dpath = "M " + short_float_fmt(x1)+',' + short_float_fmt(y1)
+ dpath += " L " + short_float_fmt(x2) + ',' + short_float_fmt(y2)
+ dpath += " " + short_float_fmt(x3) + ',' + short_float_fmt(y3) + " Z"
+
+ writer.element(
+ 'path',
+ attrib={'d': dpath,
+ 'fill': rgb2hex(avg_color),
+ 'fill-opacity': '1',
+ 'shape-rendering': "crispEdges"})
+
+ writer.start(
+ 'g',
+ attrib={'stroke': "none",
+ 'stroke-width': "0",
+ 'shape-rendering': "crispEdges",
+ 'filter': "url(#colorMat)"})
+
+ writer.element(
+ 'path',
+ attrib={'d': dpath,
+ 'fill': 'url(#GR%x_0)' % self._n_gradients,
+ 'shape-rendering': "crispEdges"})
+
+ writer.element(
+ 'path',
+ attrib={'d': dpath,
+ 'fill': 'url(#GR%x_1)' % self._n_gradients,
+ 'filter': 'url(#colorAdd)',
+ 'shape-rendering': "crispEdges"})
+
+ writer.element(
+ 'path',
+ attrib={'d': dpath,
+ 'fill': 'url(#GR%x_2)' % self._n_gradients,
+ 'filter': 'url(#colorAdd)',
+ 'shape-rendering': "crispEdges"})
+
+ writer.end('g')
+
+ self._n_gradients += 1
+
+ def draw_gouraud_triangles(self, gc, triangles_array, colors_array,
+ transform):
+ attrib = {}
+ clipid = self._get_clip(gc)
+ if clipid is not None:
+ attrib['clip-path'] = 'url(#%s)' % clipid
+
+ self.writer.start('g', attrib=attrib)
+
+ transform = transform.frozen()
+ for tri, col in zip(triangles_array, colors_array):
+ self.draw_gouraud_triangle(gc, tri, col, transform)
+
+ self.writer.end('g')
+
+ def option_scale_image(self):
+ # docstring inherited
+ return True
+
+ def get_image_magnification(self):
+ return self.image_dpi / 72.0
+
+ def draw_image(self, gc, x, y, im, transform=None):
+ # docstring inherited
+
+ h, w = im.shape[:2]
+
+ if w == 0 or h == 0:
+ return
+
+ attrib = {}
+ clipid = self._get_clip(gc)
+ if clipid is not None:
+ # Can't apply clip-path directly to the image because the
+ # image has a transformation, which would also be applied
+ # to the clip-path
+ self.writer.start('g', attrib={'clip-path': 'url(#%s)' % clipid})
+
+ oid = gc.get_gid()
+ url = gc.get_url()
+ if url is not None:
+ self.writer.start('a', attrib={'xlink:href': url})
+ if mpl.rcParams['svg.image_inline']:
+ buf = BytesIO()
+ Image.fromarray(im).save(buf, format="png")
+ oid = oid or self._make_id('image', buf.getvalue())
+ attrib['xlink:href'] = (
+ "data:image/png;base64,\n" +
+ base64.b64encode(buf.getvalue()).decode('ascii'))
+ else:
+ if self.basename is None:
+ raise ValueError("Cannot save image data to filesystem when "
+ "writing SVG to an in-memory buffer")
+ filename = '{}.image{}.png'.format(
+ self.basename, next(self._image_counter))
+ _log.info('Writing image file for inclusion: %s', filename)
+ Image.fromarray(im).save(filename)
+ oid = oid or 'Im_' + self._make_id('image', filename)
+ attrib['xlink:href'] = filename
+
+ attrib['id'] = oid
+
+ if transform is None:
+ w = 72.0 * w / self.image_dpi
+ h = 72.0 * h / self.image_dpi
+
+ self.writer.element(
+ 'image',
+ transform=generate_transform([
+ ('scale', (1, -1)), ('translate', (0, -h))]),
+ x=short_float_fmt(x),
+ y=short_float_fmt(-(self.height - y - h)),
+ width=short_float_fmt(w), height=short_float_fmt(h),
+ attrib=attrib)
+ else:
+ alpha = gc.get_alpha()
+ if alpha != 1.0:
+ attrib['opacity'] = short_float_fmt(alpha)
+
+ flipped = (
+ Affine2D().scale(1.0 / w, 1.0 / h) +
+ transform +
+ Affine2D()
+ .translate(x, y)
+ .scale(1.0, -1.0)
+ .translate(0.0, self.height))
+
+ attrib['transform'] = generate_transform(
+ [('matrix', flipped.frozen())])
+ attrib['style'] = (
+ 'image-rendering:crisp-edges;'
+ 'image-rendering:pixelated')
+ self.writer.element(
+ 'image',
+ width=short_float_fmt(w), height=short_float_fmt(h),
+ attrib=attrib)
+
+ if url is not None:
+ self.writer.end('a')
+ if clipid is not None:
+ self.writer.end('g')
+
+ def _update_glyph_map_defs(self, glyph_map_new):
+ """
+ Emit definitions for not-yet-defined glyphs, and record them as having
+ been defined.
+ """
+ writer = self.writer
+ if glyph_map_new:
+ writer.start('defs')
+ for char_id, (vertices, codes) in glyph_map_new.items():
+ char_id = self._adjust_char_id(char_id)
+ # x64 to go back to FreeType's internal (integral) units.
+ path_data = self._convert_path(
+ Path(vertices * 64, codes), simplify=False)
+ writer.element(
+ 'path', id=char_id, d=path_data,
+ transform=generate_transform([('scale', (1 / 64,))]))
+ writer.end('defs')
+ self._glyph_map.update(glyph_map_new)
+
+ def _adjust_char_id(self, char_id):
+ return char_id.replace("%20", "_")
+
+ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath, mtext=None):
+ """
+ Draw the text by converting them to paths using the textpath module.
+
+ Parameters
+ ----------
+ s : str
+ text to be converted
+ prop : `matplotlib.font_manager.FontProperties`
+ font property
+ ismath : bool
+ If True, use mathtext parser. If "TeX", use *usetex* mode.
+ """
+ writer = self.writer
+
+ writer.comment(s)
+
+ glyph_map = self._glyph_map
+
+ text2path = self._text2path
+ color = rgb2hex(gc.get_rgb())
+ fontsize = prop.get_size_in_points()
+
+ style = {}
+ if color != '#000000':
+ style['fill'] = color
+ alpha = gc.get_alpha() if gc.get_forced_alpha() else gc.get_rgb()[3]
+ if alpha != 1:
+ style['opacity'] = short_float_fmt(alpha)
+ font_scale = fontsize / text2path.FONT_SCALE
+ attrib = {
+ 'style': generate_css(style),
+ 'transform': generate_transform([
+ ('translate', (x, y)),
+ ('rotate', (-angle,)),
+ ('scale', (font_scale, -font_scale))]),
+ }
+ writer.start('g', attrib=attrib)
+
+ if not ismath:
+ font = text2path._get_font(prop)
+ _glyphs = text2path.get_glyphs_with_font(
+ font, s, glyph_map=glyph_map, return_new_glyphs_only=True)
+ glyph_info, glyph_map_new, rects = _glyphs
+ self._update_glyph_map_defs(glyph_map_new)
+
+ for glyph_id, xposition, yposition, scale in glyph_info:
+ attrib = {'xlink:href': '#%s' % glyph_id}
+ if xposition != 0.0:
+ attrib['x'] = short_float_fmt(xposition)
+ if yposition != 0.0:
+ attrib['y'] = short_float_fmt(yposition)
+ writer.element('use', attrib=attrib)
+
+ else:
+ if ismath == "TeX":
+ _glyphs = text2path.get_glyphs_tex(
+ prop, s, glyph_map=glyph_map, return_new_glyphs_only=True)
+ else:
+ _glyphs = text2path.get_glyphs_mathtext(
+ prop, s, glyph_map=glyph_map, return_new_glyphs_only=True)
+ glyph_info, glyph_map_new, rects = _glyphs
+ self._update_glyph_map_defs(glyph_map_new)
+
+ for char_id, xposition, yposition, scale in glyph_info:
+ char_id = self._adjust_char_id(char_id)
+ writer.element(
+ 'use',
+ transform=generate_transform([
+ ('translate', (xposition, yposition)),
+ ('scale', (scale,)),
+ ]),
+ attrib={'xlink:href': '#%s' % char_id})
+
+ for verts, codes in rects:
+ path = Path(verts, codes)
+ path_data = self._convert_path(path, simplify=False)
+ writer.element('path', d=path_data)
+
+ writer.end('g')
+
+ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
+ writer = self.writer
+
+ color = rgb2hex(gc.get_rgb())
+ style = {}
+ if color != '#000000':
+ style['fill'] = color
+
+ alpha = gc.get_alpha() if gc.get_forced_alpha() else gc.get_rgb()[3]
+ if alpha != 1:
+ style['opacity'] = short_float_fmt(alpha)
+
+ if not ismath:
+ font = self._get_font(prop)
+ font.set_text(s, 0.0, flags=LOAD_NO_HINTING)
+
+ attrib = {}
+ style['font-family'] = str(font.family_name)
+ style['font-weight'] = str(prop.get_weight()).lower()
+ style['font-stretch'] = str(prop.get_stretch()).lower()
+ style['font-style'] = prop.get_style().lower()
+ # Must add "px" to workaround a Firefox bug
+ style['font-size'] = short_float_fmt(prop.get_size()) + 'px'
+ attrib['style'] = generate_css(style)
+
+ if mtext and (angle == 0 or mtext.get_rotation_mode() == "anchor"):
+ # If text anchoring can be supported, get the original
+ # coordinates and add alignment information.
+
+ # Get anchor coordinates.
+ transform = mtext.get_transform()
+ ax, ay = transform.transform(mtext.get_unitless_position())
+ ay = self.height - ay
+
+ # Don't do vertical anchor alignment. Most applications do not
+ # support 'alignment-baseline' yet. Apply the vertical layout
+ # to the anchor point manually for now.
+ angle_rad = np.deg2rad(angle)
+ dir_vert = np.array([np.sin(angle_rad), np.cos(angle_rad)])
+ v_offset = np.dot(dir_vert, [(x - ax), (y - ay)])
+ ax = ax + v_offset * dir_vert[0]
+ ay = ay + v_offset * dir_vert[1]
+
+ ha_mpl_to_svg = {'left': 'start', 'right': 'end',
+ 'center': 'middle'}
+ style['text-anchor'] = ha_mpl_to_svg[mtext.get_ha()]
+
+ attrib['x'] = short_float_fmt(ax)
+ attrib['y'] = short_float_fmt(ay)
+ attrib['style'] = generate_css(style)
+ attrib['transform'] = "rotate(%s, %s, %s)" % (
+ short_float_fmt(-angle),
+ short_float_fmt(ax),
+ short_float_fmt(ay))
+ writer.element('text', s, attrib=attrib)
+ else:
+ attrib['transform'] = generate_transform([
+ ('translate', (x, y)),
+ ('rotate', (-angle,))])
+
+ writer.element('text', s, attrib=attrib)
+
+ else:
+ writer.comment(s)
+
+ width, height, descent, glyphs, rects = \
+ self._text2path.mathtext_parser.parse(s, 72, prop)
+
+ # Apply attributes to 'g', not 'text', because we likely have some
+ # rectangles as well with the same style and transformation.
+ writer.start('g',
+ style=generate_css(style),
+ transform=generate_transform([
+ ('translate', (x, y)),
+ ('rotate', (-angle,))]),
+ )
+
+ writer.start('text')
+
+ # Sort the characters by font, and output one tspan for each.
+ spans = OrderedDict()
+ for font, fontsize, thetext, new_x, new_y in glyphs:
+ style = generate_css({
+ 'font-size': short_float_fmt(fontsize) + 'px',
+ 'font-family': font.family_name,
+ 'font-style': font.style_name.lower(),
+ 'font-weight': font.style_name.lower()})
+ if thetext == 32:
+ thetext = 0xa0 # non-breaking space
+ spans.setdefault(style, []).append((new_x, -new_y, thetext))
+
+ for style, chars in spans.items():
+ chars.sort()
+
+ if len({y for x, y, t in chars}) == 1: # Are all y's the same?
+ ys = str(chars[0][1])
+ else:
+ ys = ' '.join(str(c[1]) for c in chars)
+
+ attrib = {
+ 'style': style,
+ 'x': ' '.join(short_float_fmt(c[0]) for c in chars),
+ 'y': ys
+ }
+
+ writer.element(
+ 'tspan',
+ ''.join(chr(c[2]) for c in chars),
+ attrib=attrib)
+
+ writer.end('text')
+
+ for x, y, width, height in rects:
+ writer.element(
+ 'rect',
+ x=short_float_fmt(x),
+ y=short_float_fmt(-y-1),
+ width=short_float_fmt(width),
+ height=short_float_fmt(height)
+ )
+
+ writer.end('g')
+
+ @_api.delete_parameter("3.3", "ismath")
+ def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
+ # docstring inherited
+ self._draw_text_as_path(gc, x, y, s, prop, angle, ismath="TeX")
+
+ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
+ # docstring inherited
+
+ clipid = self._get_clip(gc)
+ if clipid is not None:
+ # Cannot apply clip-path directly to the text, because
+ # is has a transformation
+ self.writer.start(
+ 'g', attrib={'clip-path': 'url(#%s)' % clipid})
+
+ if gc.get_url() is not None:
+ self.writer.start('a', {'xlink:href': gc.get_url()})
+
+ if mpl.rcParams['svg.fonttype'] == 'path':
+ self._draw_text_as_path(gc, x, y, s, prop, angle, ismath, mtext)
+ else:
+ self._draw_text_as_text(gc, x, y, s, prop, angle, ismath, mtext)
+
+ if gc.get_url() is not None:
+ self.writer.end('a')
+
+ if clipid is not None:
+ self.writer.end('g')
+
+ def flipy(self):
+ # docstring inherited
+ return True
+
+ def get_canvas_width_height(self):
+ # docstring inherited
+ return self.width, self.height
+
+ def get_text_width_height_descent(self, s, prop, ismath):
+ # docstring inherited
+ return self._text2path.get_text_width_height_descent(s, prop, ismath)
+
+
+class FigureCanvasSVG(FigureCanvasBase):
+ filetypes = {'svg': 'Scalable Vector Graphics',
+ 'svgz': 'Scalable Vector Graphics'}
+
+ fixed_dpi = 72
+
+ def print_svg(self, filename, *args, **kwargs):
+ """
+ Parameters
+ ----------
+ filename : str or path-like or file-like
+ Output target; if a string, a file will be opened for writing.
+
+ metadata : dict[str, Any], optional
+ Metadata in the SVG file defined as key-value pairs of strings,
+ datetimes, or lists of strings, e.g., ``{'Creator': 'My software',
+ 'Contributor': ['Me', 'My Friend'], 'Title': 'Awesome'}``.
+
+ The standard keys and their value types are:
+
+ * *str*: ``'Coverage'``, ``'Description'``, ``'Format'``,
+ ``'Identifier'``, ``'Language'``, ``'Relation'``, ``'Source'``,
+ ``'Title'``, and ``'Type'``.
+ * *str* or *list of str*: ``'Contributor'``, ``'Creator'``,
+ ``'Keywords'``, ``'Publisher'``, and ``'Rights'``.
+ * *str*, *date*, *datetime*, or *tuple* of same: ``'Date'``. If a
+ non-*str*, then it will be formatted as ISO 8601.
+
+ Values have been predefined for ``'Creator'``, ``'Date'``,
+ ``'Format'``, and ``'Type'``. They can be removed by setting them
+ to `None`.
+
+ Information is encoded as `Dublin Core Metadata`__.
+
+ .. _DC: https://www.dublincore.org/specifications/dublin-core/
+
+ __ DC_
+ """
+ with cbook.open_file_cm(filename, "w", encoding="utf-8") as fh:
+
+ filename = getattr(fh, 'name', '')
+ if not isinstance(filename, str):
+ filename = ''
+
+ if cbook.file_requires_unicode(fh):
+ detach = False
+ else:
+ fh = TextIOWrapper(fh, 'utf-8')
+ detach = True
+
+ self._print_svg(filename, fh, **kwargs)
+
+ # Detach underlying stream from wrapper so that it remains open in
+ # the caller.
+ if detach:
+ fh.detach()
+
+ def print_svgz(self, filename, *args, **kwargs):
+ with cbook.open_file_cm(filename, "wb") as fh, \
+ gzip.GzipFile(mode='w', fileobj=fh) as gzipwriter:
+ return self.print_svg(gzipwriter)
+
+ @_check_savefig_extra_args
+ @_api.delete_parameter("3.4", "dpi")
+ def _print_svg(self, filename, fh, *, dpi=None, bbox_inches_restore=None,
+ metadata=None):
+ if dpi is None: # always use this branch after deprecation elapses.
+ dpi = self.figure.get_dpi()
+ self.figure.set_dpi(72)
+ width, height = self.figure.get_size_inches()
+ w, h = width * 72, height * 72
+
+ renderer = MixedModeRenderer(
+ self.figure, width, height, dpi,
+ RendererSVG(w, h, fh, filename, dpi, metadata=metadata),
+ bbox_inches_restore=bbox_inches_restore)
+
+ self.figure.draw(renderer)
+ renderer.finalize()
+
+ def get_default_filetype(self):
+ return 'svg'
+
+ def draw(self):
+ _no_output_draw(self.figure)
+ return super().draw()
+
+
+FigureManagerSVG = FigureManagerBase
+
+
+svgProlog = """\
+
+
+"""
+
+
+@_Backend.export
+class _BackendSVG(_Backend):
+ FigureCanvas = FigureCanvasSVG
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_template.py b/venv/Lib/site-packages/matplotlib/backends/backend_template.py
new file mode 100644
index 0000000..7ed017a
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_template.py
@@ -0,0 +1,243 @@
+"""
+A fully functional, do-nothing backend intended as a template for backend
+writers. It is fully functional in that you can select it as a backend e.g.
+with ::
+
+ import matplotlib
+ matplotlib.use("template")
+
+and your program will (should!) run without error, though no output is
+produced. This provides a starting point for backend writers; you can
+selectively implement drawing methods (`~.RendererTemplate.draw_path`,
+`~.RendererTemplate.draw_image`, etc.) and slowly see your figure come to life
+instead having to have a full blown implementation before getting any results.
+
+Copy this file to a directory outside of the Matplotlib source tree, somewhere
+where Python can import it (by adding the directory to your ``sys.path`` or by
+packaging it as a normal Python package); if the backend is importable as
+``import my.backend`` you can then select it using ::
+
+ import matplotlib
+ matplotlib.use("module://my.backend")
+
+If your backend implements support for saving figures (i.e. has a `print_xyz`
+method), you can register it as the default handler for a given file type::
+
+ from matplotlib.backend_bases import register_backend
+ register_backend('xyz', 'my_backend', 'XYZ File Format')
+ ...
+ plt.savefig("figure.xyz")
+"""
+
+from matplotlib._pylab_helpers import Gcf
+from matplotlib.backend_bases import (
+ FigureCanvasBase, FigureManagerBase, GraphicsContextBase, RendererBase)
+from matplotlib.figure import Figure
+
+
+class RendererTemplate(RendererBase):
+ """
+ The renderer handles drawing/rendering operations.
+
+ This is a minimal do-nothing class that can be used to get started when
+ writing a new backend. Refer to `backend_bases.RendererBase` for
+ documentation of the methods.
+ """
+
+ def __init__(self, dpi):
+ super().__init__()
+ self.dpi = dpi
+
+ def draw_path(self, gc, path, transform, rgbFace=None):
+ pass
+
+ # draw_markers is optional, and we get more correct relative
+ # timings by leaving it out. backend implementers concerned with
+ # performance will probably want to implement it
+# def draw_markers(self, gc, marker_path, marker_trans, path, trans,
+# rgbFace=None):
+# pass
+
+ # draw_path_collection is optional, and we get more correct
+ # relative timings by leaving it out. backend implementers concerned with
+ # performance will probably want to implement it
+# def draw_path_collection(self, gc, master_transform, paths,
+# all_transforms, offsets, offsetTrans,
+# facecolors, edgecolors, linewidths, linestyles,
+# antialiaseds):
+# pass
+
+ # draw_quad_mesh is optional, and we get more correct
+ # relative timings by leaving it out. backend implementers concerned with
+ # performance will probably want to implement it
+# def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
+# coordinates, offsets, offsetTrans, facecolors,
+# antialiased, edgecolors):
+# pass
+
+ def draw_image(self, gc, x, y, im):
+ pass
+
+ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
+ pass
+
+ def flipy(self):
+ # docstring inherited
+ return True
+
+ def get_canvas_width_height(self):
+ # docstring inherited
+ return 100, 100
+
+ def get_text_width_height_descent(self, s, prop, ismath):
+ return 1, 1, 1
+
+ def new_gc(self):
+ # docstring inherited
+ return GraphicsContextTemplate()
+
+ def points_to_pixels(self, points):
+ # if backend doesn't have dpi, e.g., postscript or svg
+ return points
+ # elif backend assumes a value for pixels_per_inch
+ #return points/72.0 * self.dpi.get() * pixels_per_inch/72.0
+ # else
+ #return points/72.0 * self.dpi.get()
+
+
+class GraphicsContextTemplate(GraphicsContextBase):
+ """
+ The graphics context provides the color, line styles, etc... See the cairo
+ and postscript backends for examples of mapping the graphics context
+ attributes (cap styles, join styles, line widths, colors) to a particular
+ backend. In cairo this is done by wrapping a cairo.Context object and
+ forwarding the appropriate calls to it using a dictionary mapping styles
+ to gdk constants. In Postscript, all the work is done by the renderer,
+ mapping line styles to postscript calls.
+
+ If it's more appropriate to do the mapping at the renderer level (as in
+ the postscript backend), you don't need to override any of the GC methods.
+ If it's more appropriate to wrap an instance (as in the cairo backend) and
+ do the mapping here, you'll need to override several of the setter
+ methods.
+
+ The base GraphicsContext stores colors as a RGB tuple on the unit
+ interval, e.g., (0.5, 0.0, 1.0). You may need to map this to colors
+ appropriate for your backend.
+ """
+
+
+########################################################################
+#
+# The following functions and classes are for pyplot and implement
+# window/figure managers, etc...
+#
+########################################################################
+
+
+def draw_if_interactive():
+ """
+ For image backends - is not required.
+ For GUI backends - this should be overridden if drawing should be done in
+ interactive python mode.
+ """
+
+
+def show(*, block=None):
+ """
+ For image backends - is not required.
+ For GUI backends - show() is usually the last line of a pyplot script and
+ tells the backend that it is time to draw. In interactive mode, this
+ should do nothing.
+ """
+ for manager in Gcf.get_all_fig_managers():
+ # do something to display the GUI
+ pass
+
+
+def new_figure_manager(num, *args, FigureClass=Figure, **kwargs):
+ """Create a new figure manager instance."""
+ # If a main-level app must be created, this (and
+ # new_figure_manager_given_figure) is the usual place to do it -- see
+ # backend_wx, backend_wxagg and backend_tkagg for examples. Not all GUIs
+ # require explicit instantiation of a main-level app (e.g., backend_gtk3)
+ # for pylab.
+ thisFig = FigureClass(*args, **kwargs)
+ return new_figure_manager_given_figure(num, thisFig)
+
+
+def new_figure_manager_given_figure(num, figure):
+ """Create a new figure manager instance for the given figure."""
+ canvas = FigureCanvasTemplate(figure)
+ manager = FigureManagerTemplate(canvas, num)
+ return manager
+
+
+class FigureCanvasTemplate(FigureCanvasBase):
+ """
+ The canvas the figure renders into. Calls the draw and print fig
+ methods, creates the renderers, etc.
+
+ Note: GUI templates will want to connect events for button presses,
+ mouse movements and key presses to functions that call the base
+ class methods button_press_event, button_release_event,
+ motion_notify_event, key_press_event, and key_release_event. See the
+ implementations of the interactive backends for examples.
+
+ Attributes
+ ----------
+ figure : `matplotlib.figure.Figure`
+ A high-level Figure instance
+ """
+
+ def draw(self):
+ """
+ Draw the figure using the renderer.
+
+ It is important that this method actually walk the artist tree
+ even if not output is produced because this will trigger
+ deferred work (like computing limits auto-limits and tick
+ values) that users may want access to before saving to disk.
+ """
+ renderer = RendererTemplate(self.figure.dpi)
+ self.figure.draw(renderer)
+
+ # You should provide a print_xxx function for every file format
+ # you can write.
+
+ # If the file type is not in the base set of filetypes,
+ # you should add it to the class-scope filetypes dictionary as follows:
+ filetypes = {**FigureCanvasBase.filetypes, 'foo': 'My magic Foo format'}
+
+ def print_foo(self, filename, *args, **kwargs):
+ """
+ Write out format foo.
+
+ This method is normally called via `.Figure.savefig` and
+ `.FigureCanvasBase.print_figure`, which take care of setting the figure
+ facecolor, edgecolor, and dpi to the desired output values, and will
+ restore them to the original values. Therefore, `print_foo` does not
+ need to handle these settings.
+ """
+ self.draw()
+
+ def get_default_filetype(self):
+ return 'foo'
+
+
+class FigureManagerTemplate(FigureManagerBase):
+ """
+ Helper class for pyplot mode, wraps everything up into a neat bundle.
+
+ For non-interactive backends, the base class is sufficient.
+ """
+
+
+########################################################################
+#
+# Now just provide the standard names that backend.__init__ is expecting
+#
+########################################################################
+
+FigureCanvas = FigureCanvasTemplate
+FigureManager = FigureManagerTemplate
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_tkagg.py b/venv/Lib/site-packages/matplotlib/backends/backend_tkagg.py
new file mode 100644
index 0000000..31012d8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_tkagg.py
@@ -0,0 +1,19 @@
+from . import _backend_tk
+from .backend_agg import FigureCanvasAgg
+from ._backend_tk import (
+ _BackendTk, FigureCanvasTk, FigureManagerTk, NavigationToolbar2Tk)
+
+
+class FigureCanvasTkAgg(FigureCanvasAgg, FigureCanvasTk):
+ def draw(self):
+ super().draw()
+ self.blit()
+
+ def blit(self, bbox=None):
+ _backend_tk.blit(self._tkphoto, self.renderer.buffer_rgba(),
+ (0, 1, 2, 3), bbox=bbox)
+
+
+@_BackendTk.export
+class _BackendTkAgg(_BackendTk):
+ FigureCanvas = FigureCanvasTkAgg
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_tkcairo.py b/venv/Lib/site-packages/matplotlib/backends/backend_tkcairo.py
new file mode 100644
index 0000000..a81fd0d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_tkcairo.py
@@ -0,0 +1,30 @@
+import sys
+
+import numpy as np
+
+from . import _backend_tk
+from .backend_cairo import cairo, FigureCanvasCairo, RendererCairo
+from ._backend_tk import _BackendTk, FigureCanvasTk
+
+
+class FigureCanvasTkCairo(FigureCanvasCairo, FigureCanvasTk):
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self._renderer = RendererCairo(self.figure.dpi)
+
+ def draw(self):
+ width = int(self.figure.bbox.width)
+ height = int(self.figure.bbox.height)
+ surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
+ self._renderer.set_ctx_from_surface(surface)
+ self._renderer.set_width_height(width, height)
+ self.figure.draw(self._renderer)
+ buf = np.reshape(surface.get_data(), (height, width, 4))
+ _backend_tk.blit(
+ self._tkphoto, buf,
+ (2, 1, 0, 3) if sys.byteorder == "little" else (1, 2, 3, 0))
+
+
+@_BackendTk.export
+class _BackendTkCairo(_BackendTk):
+ FigureCanvas = FigureCanvasTkCairo
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_webagg.py b/venv/Lib/site-packages/matplotlib/backends/backend_webagg.py
new file mode 100644
index 0000000..7f43187
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_webagg.py
@@ -0,0 +1,320 @@
+"""
+Displays Agg images in the browser, with interactivity
+"""
+
+# The WebAgg backend is divided into two modules:
+#
+# - `backend_webagg_core.py` contains code necessary to embed a WebAgg
+# plot inside of a web application, and communicate in an abstract
+# way over a web socket.
+#
+# - `backend_webagg.py` contains a concrete implementation of a basic
+# application, implemented with tornado.
+
+from contextlib import contextmanager
+import errno
+from io import BytesIO
+import json
+import mimetypes
+from pathlib import Path
+import random
+import sys
+import signal
+import socket
+import threading
+
+try:
+ import tornado
+except ImportError as err:
+ raise RuntimeError("The WebAgg backend requires Tornado.") from err
+
+import tornado.web
+import tornado.ioloop
+import tornado.websocket
+
+import matplotlib as mpl
+from matplotlib.backend_bases import _Backend
+from matplotlib._pylab_helpers import Gcf
+from . import backend_webagg_core as core
+from .backend_webagg_core import TimerTornado
+
+
+class ServerThread(threading.Thread):
+ def run(self):
+ tornado.ioloop.IOLoop.instance().start()
+
+
+webagg_server_thread = ServerThread()
+
+
+class FigureCanvasWebAgg(core.FigureCanvasWebAggCore):
+ pass
+
+
+class WebAggApplication(tornado.web.Application):
+ initialized = False
+ started = False
+
+ class FavIcon(tornado.web.RequestHandler):
+ def get(self):
+ self.set_header('Content-Type', 'image/png')
+ self.write(Path(mpl.get_data_path(),
+ 'images/matplotlib.png').read_bytes())
+
+ class SingleFigurePage(tornado.web.RequestHandler):
+ def __init__(self, application, request, *, url_prefix='', **kwargs):
+ self.url_prefix = url_prefix
+ super().__init__(application, request, **kwargs)
+
+ def get(self, fignum):
+ fignum = int(fignum)
+ manager = Gcf.get_fig_manager(fignum)
+
+ ws_uri = 'ws://{req.host}{prefix}/'.format(req=self.request,
+ prefix=self.url_prefix)
+ self.render(
+ "single_figure.html",
+ prefix=self.url_prefix,
+ ws_uri=ws_uri,
+ fig_id=fignum,
+ toolitems=core.NavigationToolbar2WebAgg.toolitems,
+ canvas=manager.canvas)
+
+ class AllFiguresPage(tornado.web.RequestHandler):
+ def __init__(self, application, request, *, url_prefix='', **kwargs):
+ self.url_prefix = url_prefix
+ super().__init__(application, request, **kwargs)
+
+ def get(self):
+ ws_uri = 'ws://{req.host}{prefix}/'.format(req=self.request,
+ prefix=self.url_prefix)
+ self.render(
+ "all_figures.html",
+ prefix=self.url_prefix,
+ ws_uri=ws_uri,
+ figures=sorted(Gcf.figs.items()),
+ toolitems=core.NavigationToolbar2WebAgg.toolitems)
+
+ class MplJs(tornado.web.RequestHandler):
+ def get(self):
+ self.set_header('Content-Type', 'application/javascript')
+
+ js_content = core.FigureManagerWebAgg.get_javascript()
+
+ self.write(js_content)
+
+ class Download(tornado.web.RequestHandler):
+ def get(self, fignum, fmt):
+ fignum = int(fignum)
+ manager = Gcf.get_fig_manager(fignum)
+ self.set_header(
+ 'Content-Type', mimetypes.types_map.get(fmt, 'binary'))
+ buff = BytesIO()
+ manager.canvas.figure.savefig(buff, format=fmt)
+ self.write(buff.getvalue())
+
+ class WebSocket(tornado.websocket.WebSocketHandler):
+ supports_binary = True
+
+ def open(self, fignum):
+ self.fignum = int(fignum)
+ self.manager = Gcf.get_fig_manager(self.fignum)
+ self.manager.add_web_socket(self)
+ if hasattr(self, 'set_nodelay'):
+ self.set_nodelay(True)
+
+ def on_close(self):
+ self.manager.remove_web_socket(self)
+
+ def on_message(self, message):
+ message = json.loads(message)
+ # The 'supports_binary' message is on a client-by-client
+ # basis. The others affect the (shared) canvas as a
+ # whole.
+ if message['type'] == 'supports_binary':
+ self.supports_binary = message['value']
+ else:
+ manager = Gcf.get_fig_manager(self.fignum)
+ # It is possible for a figure to be closed,
+ # but a stale figure UI is still sending messages
+ # from the browser.
+ if manager is not None:
+ manager.handle_json(message)
+
+ def send_json(self, content):
+ self.write_message(json.dumps(content))
+
+ def send_binary(self, blob):
+ if self.supports_binary:
+ self.write_message(blob, binary=True)
+ else:
+ data_uri = "data:image/png;base64,{0}".format(
+ blob.encode('base64').replace('\n', ''))
+ self.write_message(data_uri)
+
+ def __init__(self, url_prefix=''):
+ if url_prefix:
+ assert url_prefix[0] == '/' and url_prefix[-1] != '/', \
+ 'url_prefix must start with a "/" and not end with one.'
+
+ super().__init__(
+ [
+ # Static files for the CSS and JS
+ (url_prefix + r'/_static/(.*)',
+ tornado.web.StaticFileHandler,
+ {'path': core.FigureManagerWebAgg.get_static_file_path()}),
+
+ # Static images for the toolbar
+ (url_prefix + r'/_images/(.*)',
+ tornado.web.StaticFileHandler,
+ {'path': Path(mpl.get_data_path(), 'images')}),
+
+ # A Matplotlib favicon
+ (url_prefix + r'/favicon.ico', self.FavIcon),
+
+ # The page that contains all of the pieces
+ (url_prefix + r'/([0-9]+)', self.SingleFigurePage,
+ {'url_prefix': url_prefix}),
+
+ # The page that contains all of the figures
+ (url_prefix + r'/?', self.AllFiguresPage,
+ {'url_prefix': url_prefix}),
+
+ (url_prefix + r'/js/mpl.js', self.MplJs),
+
+ # Sends images and events to the browser, and receives
+ # events from the browser
+ (url_prefix + r'/([0-9]+)/ws', self.WebSocket),
+
+ # Handles the downloading (i.e., saving) of static images
+ (url_prefix + r'/([0-9]+)/download.([a-z0-9.]+)',
+ self.Download),
+ ],
+ template_path=core.FigureManagerWebAgg.get_static_file_path())
+
+ @classmethod
+ def initialize(cls, url_prefix='', port=None, address=None):
+ if cls.initialized:
+ return
+
+ # Create the class instance
+ app = cls(url_prefix=url_prefix)
+
+ cls.url_prefix = url_prefix
+
+ # This port selection algorithm is borrowed, more or less
+ # verbatim, from IPython.
+ def random_ports(port, n):
+ """
+ Generate a list of n random ports near the given port.
+
+ The first 5 ports will be sequential, and the remaining n-5 will be
+ randomly selected in the range [port-2*n, port+2*n].
+ """
+ for i in range(min(5, n)):
+ yield port + i
+ for i in range(n - 5):
+ yield port + random.randint(-2 * n, 2 * n)
+
+ if address is None:
+ cls.address = mpl.rcParams['webagg.address']
+ else:
+ cls.address = address
+ cls.port = mpl.rcParams['webagg.port']
+ for port in random_ports(cls.port,
+ mpl.rcParams['webagg.port_retries']):
+ try:
+ app.listen(port, cls.address)
+ except socket.error as e:
+ if e.errno != errno.EADDRINUSE:
+ raise
+ else:
+ cls.port = port
+ break
+ else:
+ raise SystemExit(
+ "The webagg server could not be started because an available "
+ "port could not be found")
+
+ cls.initialized = True
+
+ @classmethod
+ def start(cls):
+ if cls.started:
+ return
+
+ """
+ IOLoop.running() was removed as of Tornado 2.4; see for example
+ https://groups.google.com/forum/#!topic/python-tornado/QLMzkpQBGOY
+ Thus there is no correct way to check if the loop has already been
+ launched. We may end up with two concurrently running loops in that
+ unlucky case with all the expected consequences.
+ """
+ ioloop = tornado.ioloop.IOLoop.instance()
+
+ def shutdown():
+ ioloop.stop()
+ print("Server is stopped")
+ sys.stdout.flush()
+ cls.started = False
+
+ @contextmanager
+ def catch_sigint():
+ old_handler = signal.signal(
+ signal.SIGINT,
+ lambda sig, frame: ioloop.add_callback_from_signal(shutdown))
+ try:
+ yield
+ finally:
+ signal.signal(signal.SIGINT, old_handler)
+
+ # Set the flag to True *before* blocking on ioloop.start()
+ cls.started = True
+
+ print("Press Ctrl+C to stop WebAgg server")
+ sys.stdout.flush()
+ with catch_sigint():
+ ioloop.start()
+
+
+def ipython_inline_display(figure):
+ import tornado.template
+
+ WebAggApplication.initialize()
+ if not webagg_server_thread.is_alive():
+ webagg_server_thread.start()
+
+ fignum = figure.number
+ tpl = Path(core.FigureManagerWebAgg.get_static_file_path(),
+ "ipython_inline_figure.html").read_text()
+ t = tornado.template.Template(tpl)
+ return t.generate(
+ prefix=WebAggApplication.url_prefix,
+ fig_id=fignum,
+ toolitems=core.NavigationToolbar2WebAgg.toolitems,
+ canvas=figure.canvas,
+ port=WebAggApplication.port).decode('utf-8')
+
+
+@_Backend.export
+class _BackendWebAgg(_Backend):
+ FigureCanvas = FigureCanvasWebAgg
+ FigureManager = core.FigureManagerWebAgg
+
+ @staticmethod
+ def show():
+ WebAggApplication.initialize()
+
+ url = "http://{address}:{port}{prefix}".format(
+ address=WebAggApplication.address,
+ port=WebAggApplication.port,
+ prefix=WebAggApplication.url_prefix)
+
+ if mpl.rcParams['webagg.open_in_browser']:
+ import webbrowser
+ if not webbrowser.open(url):
+ print("To view figure, visit {0}".format(url))
+ else:
+ print("To view figure, visit {0}".format(url))
+
+ WebAggApplication.start()
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_webagg_core.py b/venv/Lib/site-packages/matplotlib/backends/backend_webagg_core.py
new file mode 100644
index 0000000..ed0d617
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_webagg_core.py
@@ -0,0 +1,503 @@
+"""
+Displays Agg images in the browser, with interactivity
+"""
+# The WebAgg backend is divided into two modules:
+#
+# - `backend_webagg_core.py` contains code necessary to embed a WebAgg
+# plot inside of a web application, and communicate in an abstract
+# way over a web socket.
+#
+# - `backend_webagg.py` contains a concrete implementation of a basic
+# application, implemented with tornado.
+
+import datetime
+from io import BytesIO, StringIO
+import json
+import logging
+import os
+from pathlib import Path
+
+import numpy as np
+from PIL import Image
+import tornado
+
+from matplotlib import _api, backend_bases
+from matplotlib.backends import backend_agg
+from matplotlib.backend_bases import _Backend
+
+_log = logging.getLogger(__name__)
+
+_SPECIAL_KEYS_LUT = {'Alt': 'alt',
+ 'AltGraph': 'alt',
+ 'CapsLock': 'caps_lock',
+ 'Control': 'control',
+ 'Meta': 'meta',
+ 'NumLock': 'num_lock',
+ 'ScrollLock': 'scroll_lock',
+ 'Shift': 'shift',
+ 'Super': 'super',
+ 'Enter': 'enter',
+ 'Tab': 'tab',
+ 'ArrowDown': 'down',
+ 'ArrowLeft': 'left',
+ 'ArrowRight': 'right',
+ 'ArrowUp': 'up',
+ 'End': 'end',
+ 'Home': 'home',
+ 'PageDown': 'pagedown',
+ 'PageUp': 'pageup',
+ 'Backspace': 'backspace',
+ 'Delete': 'delete',
+ 'Insert': 'insert',
+ 'Escape': 'escape',
+ 'Pause': 'pause',
+ 'Select': 'select',
+ 'Dead': 'dead',
+ 'F1': 'f1',
+ 'F2': 'f2',
+ 'F3': 'f3',
+ 'F4': 'f4',
+ 'F5': 'f5',
+ 'F6': 'f6',
+ 'F7': 'f7',
+ 'F8': 'f8',
+ 'F9': 'f9',
+ 'F10': 'f10',
+ 'F11': 'f11',
+ 'F12': 'f12'}
+
+
+def _handle_key(key):
+ """Handle key values"""
+ value = key[key.index('k') + 1:]
+ if 'shift+' in key:
+ if len(value) == 1:
+ key = key.replace('shift+', '')
+ if value in _SPECIAL_KEYS_LUT:
+ value = _SPECIAL_KEYS_LUT[value]
+ key = key[:key.index('k')] + value
+ return key
+
+
+class TimerTornado(backend_bases.TimerBase):
+ def __init__(self, *args, **kwargs):
+ self._timer = None
+ super().__init__(*args, **kwargs)
+
+ def _timer_start(self):
+ self._timer_stop()
+ if self._single:
+ ioloop = tornado.ioloop.IOLoop.instance()
+ self._timer = ioloop.add_timeout(
+ datetime.timedelta(milliseconds=self.interval),
+ self._on_timer)
+ else:
+ self._timer = tornado.ioloop.PeriodicCallback(
+ self._on_timer,
+ max(self.interval, 1e-6))
+ self._timer.start()
+
+ def _timer_stop(self):
+ if self._timer is None:
+ return
+ elif self._single:
+ ioloop = tornado.ioloop.IOLoop.instance()
+ ioloop.remove_timeout(self._timer)
+ else:
+ self._timer.stop()
+ self._timer = None
+
+ def _timer_set_interval(self):
+ # Only stop and restart it if the timer has already been started
+ if self._timer is not None:
+ self._timer_stop()
+ self._timer_start()
+
+
+class FigureCanvasWebAggCore(backend_agg.FigureCanvasAgg):
+ _timer_cls = TimerTornado
+ # Webagg and friends having the right methods, but still
+ # having bugs in practice. Do not advertise that it works until
+ # we can debug this.
+ supports_blit = False
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+
+ # Set to True when the renderer contains data that is newer
+ # than the PNG buffer.
+ self._png_is_old = True
+
+ # Set to True by the `refresh` message so that the next frame
+ # sent to the clients will be a full frame.
+ self._force_full = True
+
+ # Store the current image mode so that at any point, clients can
+ # request the information. This should be changed by calling
+ # self.set_image_mode(mode) so that the notification can be given
+ # to the connected clients.
+ self._current_image_mode = 'full'
+
+ # Store the DPI ratio of the browser. This is the scaling that
+ # occurs automatically for all images on a HiDPI display.
+ self._dpi_ratio = 1
+
+ def show(self):
+ # show the figure window
+ from matplotlib.pyplot import show
+ show()
+
+ def draw(self):
+ self._png_is_old = True
+ try:
+ super().draw()
+ finally:
+ self.manager.refresh_all() # Swap the frames.
+
+ def blit(self, bbox=None):
+ self._png_is_old = True
+ self.manager.refresh_all()
+
+ def draw_idle(self):
+ self.send_event("draw")
+
+ def set_image_mode(self, mode):
+ """
+ Set the image mode for any subsequent images which will be sent
+ to the clients. The modes may currently be either 'full' or 'diff'.
+
+ Note: diff images may not contain transparency, therefore upon
+ draw this mode may be changed if the resulting image has any
+ transparent component.
+ """
+ _api.check_in_list(['full', 'diff'], mode=mode)
+ if self._current_image_mode != mode:
+ self._current_image_mode = mode
+ self.handle_send_image_mode(None)
+
+ def get_diff_image(self):
+ if self._png_is_old:
+ renderer = self.get_renderer()
+
+ # The buffer is created as type uint32 so that entire
+ # pixels can be compared in one numpy call, rather than
+ # needing to compare each plane separately.
+ buff = (np.frombuffer(renderer.buffer_rgba(), dtype=np.uint32)
+ .reshape((renderer.height, renderer.width)))
+
+ # If any pixels have transparency, we need to force a full
+ # draw as we cannot overlay new on top of old.
+ pixels = buff.view(dtype=np.uint8).reshape(buff.shape + (4,))
+
+ if self._force_full or np.any(pixels[:, :, 3] != 255):
+ self.set_image_mode('full')
+ output = buff
+ else:
+ self.set_image_mode('diff')
+ diff = buff != self._last_buff
+ output = np.where(diff, buff, 0)
+
+ # Store the current buffer so we can compute the next diff.
+ np.copyto(self._last_buff, buff)
+ self._force_full = False
+ self._png_is_old = False
+
+ data = output.view(dtype=np.uint8).reshape((*output.shape, 4))
+ with BytesIO() as png:
+ Image.fromarray(data).save(png, format="png")
+ return png.getvalue()
+
+ def get_renderer(self, cleared=None):
+ # Mirrors super.get_renderer, but caches the old one so that we can do
+ # things such as produce a diff image in get_diff_image.
+ w, h = self.figure.bbox.size.astype(int)
+ key = w, h, self.figure.dpi
+ try:
+ self._lastKey, self._renderer
+ except AttributeError:
+ need_new_renderer = True
+ else:
+ need_new_renderer = (self._lastKey != key)
+
+ if need_new_renderer:
+ self._renderer = backend_agg.RendererAgg(
+ w, h, self.figure.dpi)
+ self._lastKey = key
+ self._last_buff = np.copy(np.frombuffer(
+ self._renderer.buffer_rgba(), dtype=np.uint32
+ ).reshape((self._renderer.height, self._renderer.width)))
+
+ elif cleared:
+ self._renderer.clear()
+
+ return self._renderer
+
+ def handle_event(self, event):
+ e_type = event['type']
+ handler = getattr(self, 'handle_{0}'.format(e_type),
+ self.handle_unknown_event)
+ return handler(event)
+
+ def handle_unknown_event(self, event):
+ _log.warning('Unhandled message type {0}. {1}'.format(
+ event['type'], event))
+
+ def handle_ack(self, event):
+ # Network latency tends to decrease if traffic is flowing
+ # in both directions. Therefore, the browser sends back
+ # an "ack" message after each image frame is received.
+ # This could also be used as a simple sanity check in the
+ # future, but for now the performance increase is enough
+ # to justify it, even if the server does nothing with it.
+ pass
+
+ def handle_draw(self, event):
+ self.draw()
+
+ def _handle_mouse(self, event):
+ x = event['x']
+ y = event['y']
+ y = self.get_renderer().height - y
+
+ # Javascript button numbers and matplotlib button numbers are
+ # off by 1
+ button = event['button'] + 1
+
+ e_type = event['type']
+ guiEvent = event.get('guiEvent', None)
+ if e_type == 'button_press':
+ self.button_press_event(x, y, button, guiEvent=guiEvent)
+ elif e_type == 'dblclick':
+ self.button_press_event(x, y, button, dblclick=True,
+ guiEvent=guiEvent)
+ elif e_type == 'button_release':
+ self.button_release_event(x, y, button, guiEvent=guiEvent)
+ elif e_type == 'motion_notify':
+ self.motion_notify_event(x, y, guiEvent=guiEvent)
+ elif e_type == 'figure_enter':
+ self.enter_notify_event(xy=(x, y), guiEvent=guiEvent)
+ elif e_type == 'figure_leave':
+ self.leave_notify_event()
+ elif e_type == 'scroll':
+ self.scroll_event(x, y, event['step'], guiEvent=guiEvent)
+ handle_button_press = handle_button_release = handle_dblclick = \
+ handle_figure_enter = handle_figure_leave = handle_motion_notify = \
+ handle_scroll = _handle_mouse
+
+ def _handle_key(self, event):
+ key = _handle_key(event['key'])
+ e_type = event['type']
+ guiEvent = event.get('guiEvent', None)
+ if e_type == 'key_press':
+ self.key_press_event(key, guiEvent=guiEvent)
+ elif e_type == 'key_release':
+ self.key_release_event(key, guiEvent=guiEvent)
+ handle_key_press = handle_key_release = _handle_key
+
+ def handle_toolbar_button(self, event):
+ # TODO: Be more suspicious of the input
+ getattr(self.toolbar, event['name'])()
+
+ def handle_refresh(self, event):
+ figure_label = self.figure.get_label()
+ if not figure_label:
+ figure_label = "Figure {0}".format(self.manager.num)
+ self.send_event('figure_label', label=figure_label)
+ self._force_full = True
+ if self.toolbar:
+ # Normal toolbar init would refresh this, but it happens before the
+ # browser canvas is set up.
+ self.toolbar.set_history_buttons()
+ self.draw_idle()
+
+ def handle_resize(self, event):
+ x, y = event.get('width', 800), event.get('height', 800)
+ x, y = int(x) * self._dpi_ratio, int(y) * self._dpi_ratio
+ fig = self.figure
+ # An attempt at approximating the figure size in pixels.
+ fig.set_size_inches(x / fig.dpi, y / fig.dpi, forward=False)
+ # Acknowledge the resize, and force the viewer to update the
+ # canvas size to the figure's new size (which is hopefully
+ # identical or within a pixel or so).
+ self._png_is_old = True
+ self.manager.resize(*fig.bbox.size, forward=False)
+ self.resize_event()
+
+ def handle_send_image_mode(self, event):
+ # The client requests notification of what the current image mode is.
+ self.send_event('image_mode', mode=self._current_image_mode)
+
+ def handle_set_dpi_ratio(self, event):
+ dpi_ratio = event.get('dpi_ratio', 1)
+ if dpi_ratio != self._dpi_ratio:
+ # We don't want to scale up the figure dpi more than once.
+ if not hasattr(self.figure, '_original_dpi'):
+ self.figure._original_dpi = self.figure.dpi
+ self.figure.dpi = dpi_ratio * self.figure._original_dpi
+ self._dpi_ratio = dpi_ratio
+ self._force_full = True
+ self.draw_idle()
+
+ def send_event(self, event_type, **kwargs):
+ if self.manager:
+ self.manager._send_event(event_type, **kwargs)
+
+
+_ALLOWED_TOOL_ITEMS = {
+ 'home',
+ 'back',
+ 'forward',
+ 'pan',
+ 'zoom',
+ 'download',
+ None,
+}
+
+
+class NavigationToolbar2WebAgg(backend_bases.NavigationToolbar2):
+
+ # Use the standard toolbar items + download button
+ toolitems = [
+ (text, tooltip_text, image_file, name_of_method)
+ for text, tooltip_text, image_file, name_of_method
+ in (*backend_bases.NavigationToolbar2.toolitems,
+ ('Download', 'Download plot', 'filesave', 'download'))
+ if name_of_method in _ALLOWED_TOOL_ITEMS
+ ]
+
+ def __init__(self, canvas):
+ self.message = ''
+ self.cursor = 0
+ super().__init__(canvas)
+
+ def set_message(self, message):
+ if message != self.message:
+ self.canvas.send_event("message", message=message)
+ self.message = message
+
+ def set_cursor(self, cursor):
+ if cursor != self.cursor:
+ self.canvas.send_event("cursor", cursor=cursor)
+ self.cursor = cursor
+
+ def draw_rubberband(self, event, x0, y0, x1, y1):
+ self.canvas.send_event(
+ "rubberband", x0=x0, y0=y0, x1=x1, y1=y1)
+
+ def release_zoom(self, event):
+ super().release_zoom(event)
+ self.canvas.send_event(
+ "rubberband", x0=-1, y0=-1, x1=-1, y1=-1)
+
+ def save_figure(self, *args):
+ """Save the current figure"""
+ self.canvas.send_event('save')
+
+ def pan(self):
+ super().pan()
+ self.canvas.send_event('navigate_mode', mode=self.mode.name)
+
+ def zoom(self):
+ super().zoom()
+ self.canvas.send_event('navigate_mode', mode=self.mode.name)
+
+ def set_history_buttons(self):
+ can_backward = self._nav_stack._pos > 0
+ can_forward = self._nav_stack._pos < len(self._nav_stack._elements) - 1
+ self.canvas.send_event('history_buttons',
+ Back=can_backward, Forward=can_forward)
+
+
+class FigureManagerWebAgg(backend_bases.FigureManagerBase):
+ ToolbarCls = NavigationToolbar2WebAgg
+
+ def __init__(self, canvas, num):
+ self.web_sockets = set()
+ super().__init__(canvas, num)
+ self.toolbar = self._get_toolbar(canvas)
+
+ def show(self):
+ pass
+
+ def _get_toolbar(self, canvas):
+ toolbar = self.ToolbarCls(canvas)
+ return toolbar
+
+ def resize(self, w, h, forward=True):
+ self._send_event(
+ 'resize',
+ size=(w / self.canvas._dpi_ratio, h / self.canvas._dpi_ratio),
+ forward=forward)
+
+ def set_window_title(self, title):
+ self._send_event('figure_label', label=title)
+
+ # The following methods are specific to FigureManagerWebAgg
+
+ def add_web_socket(self, web_socket):
+ assert hasattr(web_socket, 'send_binary')
+ assert hasattr(web_socket, 'send_json')
+ self.web_sockets.add(web_socket)
+ self.resize(*self.canvas.figure.bbox.size)
+ self._send_event('refresh')
+
+ def remove_web_socket(self, web_socket):
+ self.web_sockets.remove(web_socket)
+
+ def handle_json(self, content):
+ self.canvas.handle_event(content)
+
+ def refresh_all(self):
+ if self.web_sockets:
+ diff = self.canvas.get_diff_image()
+ if diff is not None:
+ for s in self.web_sockets:
+ s.send_binary(diff)
+
+ @classmethod
+ def get_javascript(cls, stream=None):
+ if stream is None:
+ output = StringIO()
+ else:
+ output = stream
+
+ output.write((Path(__file__).parent / "web_backend/js/mpl.js")
+ .read_text(encoding="utf-8"))
+
+ toolitems = []
+ for name, tooltip, image, method in cls.ToolbarCls.toolitems:
+ if name is None:
+ toolitems.append(['', '', '', ''])
+ else:
+ toolitems.append([name, tooltip, image, method])
+ output.write("mpl.toolbar_items = {0};\n\n".format(
+ json.dumps(toolitems)))
+
+ extensions = []
+ for filetype, ext in sorted(FigureCanvasWebAggCore.
+ get_supported_filetypes_grouped().
+ items()):
+ extensions.append(ext[0])
+ output.write("mpl.extensions = {0};\n\n".format(
+ json.dumps(extensions)))
+
+ output.write("mpl.default_extension = {0};".format(
+ json.dumps(FigureCanvasWebAggCore.get_default_filetype())))
+
+ if stream is None:
+ return output.getvalue()
+
+ @classmethod
+ def get_static_file_path(cls):
+ return os.path.join(os.path.dirname(__file__), 'web_backend')
+
+ def _send_event(self, event_type, **kwargs):
+ payload = {'type': event_type, **kwargs}
+ for s in self.web_sockets:
+ s.send_json(payload)
+
+
+@_Backend.export
+class _BackendWebAggCoreAgg(_Backend):
+ FigureCanvas = FigureCanvasWebAggCore
+ FigureManager = FigureManagerWebAgg
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_wx.py b/venv/Lib/site-packages/matplotlib/backends/backend_wx.py
new file mode 100644
index 0000000..9d12357
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_wx.py
@@ -0,0 +1,1516 @@
+"""
+A wxPython backend for matplotlib.
+
+Originally contributed by Jeremy O'Donoghue (jeremy@o-donoghue.com) and John
+Hunter (jdhunter@ace.bsd.uchicago.edu).
+
+Copyright (C) Jeremy O'Donoghue & John Hunter, 2003-4.
+"""
+
+import logging
+import math
+import pathlib
+import sys
+import weakref
+
+import numpy as np
+import PIL
+
+import matplotlib as mpl
+from matplotlib.backend_bases import (
+ _Backend, _check_savefig_extra_args, FigureCanvasBase, FigureManagerBase,
+ GraphicsContextBase, MouseButton, NavigationToolbar2, RendererBase,
+ StatusbarBase, TimerBase, ToolContainerBase, cursors)
+
+from matplotlib import _api, cbook, backend_tools
+from matplotlib._pylab_helpers import Gcf
+from matplotlib.backend_managers import ToolManager
+from matplotlib.figure import Figure
+from matplotlib.path import Path
+from matplotlib.transforms import Affine2D
+from matplotlib.widgets import SubplotTool
+
+import wx
+
+_log = logging.getLogger(__name__)
+
+# Debugging settings here...
+# Debug level set here. If the debug level is less than 5, information
+# messages (progressively more info for lower value) are printed. In addition,
+# traceback is performed, and pdb activated, for all uncaught exceptions in
+# this case
+_DEBUG = 5
+_DEBUG_lvls = {1: 'Low ', 2: 'Med ', 3: 'High', 4: 'Error'}
+
+
+@_api.deprecated("3.3")
+def DEBUG_MSG(string, lvl=3, o=None):
+ if lvl >= _DEBUG:
+ print(f"{_DEBUG_lvls[lvl]}- {string} in {type(o)}")
+
+
+# the True dots per inch on the screen; should be display dependent; see
+# http://groups.google.com/groups?q=screen+dpi+x11&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=7077.26e81ad5%40swift.cs.tcd.ie&rnum=5
+# for some info about screen dpi
+PIXELS_PER_INCH = 75
+
+# Delay time for idle checks
+IDLE_DELAY = 5 # Documented as deprecated as of Matplotlib 3.1.
+
+
+def error_msg_wx(msg, parent=None):
+ """Signal an error condition with a popup error dialog."""
+ dialog = wx.MessageDialog(parent=parent,
+ message=msg,
+ caption='Matplotlib backend_wx error',
+ style=wx.OK | wx.CENTRE)
+ dialog.ShowModal()
+ dialog.Destroy()
+ return None
+
+
+class TimerWx(TimerBase):
+ """Subclass of `.TimerBase` using wx.Timer events."""
+
+ def __init__(self, *args, **kwargs):
+ self._timer = wx.Timer()
+ self._timer.Notify = self._on_timer
+ super().__init__(*args, **kwargs)
+
+ def _timer_start(self):
+ self._timer.Start(self._interval, self._single)
+
+ def _timer_stop(self):
+ self._timer.Stop()
+
+ def _timer_set_interval(self):
+ if self._timer.IsRunning():
+ self._timer_start() # Restart with new interval.
+
+
+class RendererWx(RendererBase):
+ """
+ The renderer handles all the drawing primitives using a graphics
+ context instance that controls the colors/styles. It acts as the
+ 'renderer' instance used by many classes in the hierarchy.
+ """
+ # In wxPython, drawing is performed on a wxDC instance, which will
+ # generally be mapped to the client area of the window displaying
+ # the plot. Under wxPython, the wxDC instance has a wx.Pen which
+ # describes the colour and weight of any lines drawn, and a wxBrush
+ # which describes the fill colour of any closed polygon.
+
+ # Font styles, families and weight.
+ fontweights = {
+ 100: wx.FONTWEIGHT_LIGHT,
+ 200: wx.FONTWEIGHT_LIGHT,
+ 300: wx.FONTWEIGHT_LIGHT,
+ 400: wx.FONTWEIGHT_NORMAL,
+ 500: wx.FONTWEIGHT_NORMAL,
+ 600: wx.FONTWEIGHT_NORMAL,
+ 700: wx.FONTWEIGHT_BOLD,
+ 800: wx.FONTWEIGHT_BOLD,
+ 900: wx.FONTWEIGHT_BOLD,
+ 'ultralight': wx.FONTWEIGHT_LIGHT,
+ 'light': wx.FONTWEIGHT_LIGHT,
+ 'normal': wx.FONTWEIGHT_NORMAL,
+ 'medium': wx.FONTWEIGHT_NORMAL,
+ 'semibold': wx.FONTWEIGHT_NORMAL,
+ 'bold': wx.FONTWEIGHT_BOLD,
+ 'heavy': wx.FONTWEIGHT_BOLD,
+ 'ultrabold': wx.FONTWEIGHT_BOLD,
+ 'black': wx.FONTWEIGHT_BOLD,
+ }
+ fontangles = {
+ 'italic': wx.FONTSTYLE_ITALIC,
+ 'normal': wx.FONTSTYLE_NORMAL,
+ 'oblique': wx.FONTSTYLE_SLANT,
+ }
+
+ # wxPython allows for portable font styles, choosing them appropriately for
+ # the target platform. Map some standard font names to the portable styles.
+ # QUESTION: Is it be wise to agree standard fontnames across all backends?
+ fontnames = {
+ 'Sans': wx.FONTFAMILY_SWISS,
+ 'Roman': wx.FONTFAMILY_ROMAN,
+ 'Script': wx.FONTFAMILY_SCRIPT,
+ 'Decorative': wx.FONTFAMILY_DECORATIVE,
+ 'Modern': wx.FONTFAMILY_MODERN,
+ 'Courier': wx.FONTFAMILY_MODERN,
+ 'courier': wx.FONTFAMILY_MODERN,
+ }
+
+ def __init__(self, bitmap, dpi):
+ """Initialise a wxWindows renderer instance."""
+ _api.warn_deprecated(
+ "2.0", name="wx", obj_type="backend", removal="the future",
+ alternative="wxagg", addendum="See the Matplotlib usage FAQ for "
+ "more info on backends.")
+ super().__init__()
+ _log.debug("%s - __init__()", type(self))
+ self.width = bitmap.GetWidth()
+ self.height = bitmap.GetHeight()
+ self.bitmap = bitmap
+ self.fontd = {}
+ self.dpi = dpi
+ self.gc = None
+
+ def flipy(self):
+ # docstring inherited
+ return True
+
+ def offset_text_height(self):
+ return True
+
+ def get_text_width_height_descent(self, s, prop, ismath):
+ # docstring inherited
+
+ if ismath:
+ s = cbook.strip_math(s)
+
+ if self.gc is None:
+ gc = self.new_gc()
+ else:
+ gc = self.gc
+ gfx_ctx = gc.gfx_ctx
+ font = self.get_wx_font(s, prop)
+ gfx_ctx.SetFont(font, wx.BLACK)
+ w, h, descent, leading = gfx_ctx.GetFullTextExtent(s)
+
+ return w, h, descent
+
+ def get_canvas_width_height(self):
+ # docstring inherited
+ return self.width, self.height
+
+ def handle_clip_rectangle(self, gc):
+ new_bounds = gc.get_clip_rectangle()
+ if new_bounds is not None:
+ new_bounds = new_bounds.bounds
+ gfx_ctx = gc.gfx_ctx
+ if gfx_ctx._lastcliprect != new_bounds:
+ gfx_ctx._lastcliprect = new_bounds
+ if new_bounds is None:
+ gfx_ctx.ResetClip()
+ else:
+ gfx_ctx.Clip(new_bounds[0],
+ self.height - new_bounds[1] - new_bounds[3],
+ new_bounds[2], new_bounds[3])
+
+ @staticmethod
+ def convert_path(gfx_ctx, path, transform):
+ wxpath = gfx_ctx.CreatePath()
+ for points, code in path.iter_segments(transform):
+ if code == Path.MOVETO:
+ wxpath.MoveToPoint(*points)
+ elif code == Path.LINETO:
+ wxpath.AddLineToPoint(*points)
+ elif code == Path.CURVE3:
+ wxpath.AddQuadCurveToPoint(*points)
+ elif code == Path.CURVE4:
+ wxpath.AddCurveToPoint(*points)
+ elif code == Path.CLOSEPOLY:
+ wxpath.CloseSubpath()
+ return wxpath
+
+ def draw_path(self, gc, path, transform, rgbFace=None):
+ # docstring inherited
+ gc.select()
+ self.handle_clip_rectangle(gc)
+ gfx_ctx = gc.gfx_ctx
+ transform = transform + \
+ Affine2D().scale(1.0, -1.0).translate(0.0, self.height)
+ wxpath = self.convert_path(gfx_ctx, path, transform)
+ if rgbFace is not None:
+ gfx_ctx.SetBrush(wx.Brush(gc.get_wxcolour(rgbFace)))
+ gfx_ctx.DrawPath(wxpath)
+ else:
+ gfx_ctx.StrokePath(wxpath)
+ gc.unselect()
+
+ def draw_image(self, gc, x, y, im):
+ bbox = gc.get_clip_rectangle()
+ if bbox is not None:
+ l, b, w, h = bbox.bounds
+ else:
+ l = 0
+ b = 0
+ w = self.width
+ h = self.height
+ rows, cols = im.shape[:2]
+ bitmap = wx.Bitmap.FromBufferRGBA(cols, rows, im.tobytes())
+ gc.select()
+ gc.gfx_ctx.DrawBitmap(bitmap, int(l), int(self.height - b),
+ int(w), int(-h))
+ gc.unselect()
+
+ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
+ # docstring inherited
+
+ if ismath:
+ s = cbook.strip_math(s)
+ _log.debug("%s - draw_text()", type(self))
+ gc.select()
+ self.handle_clip_rectangle(gc)
+ gfx_ctx = gc.gfx_ctx
+
+ font = self.get_wx_font(s, prop)
+ color = gc.get_wxcolour(gc.get_rgb())
+ gfx_ctx.SetFont(font, color)
+
+ w, h, d = self.get_text_width_height_descent(s, prop, ismath)
+ x = int(x)
+ y = int(y - h)
+
+ if angle == 0.0:
+ gfx_ctx.DrawText(s, x, y)
+ else:
+ rads = math.radians(angle)
+ xo = h * math.sin(rads)
+ yo = h * math.cos(rads)
+ gfx_ctx.DrawRotatedText(s, x - xo, y - yo, rads)
+
+ gc.unselect()
+
+ def new_gc(self):
+ # docstring inherited
+ _log.debug("%s - new_gc()", type(self))
+ self.gc = GraphicsContextWx(self.bitmap, self)
+ self.gc.select()
+ self.gc.unselect()
+ return self.gc
+
+ @_api.deprecated("3.3", alternative=".gc")
+ def get_gc(self):
+ """
+ Fetch the locally cached gc.
+ """
+ # This is a dirty hack to allow anything with access to a renderer to
+ # access the current graphics context
+ assert self.gc is not None, "gc must be defined"
+ return self.gc
+
+ def get_wx_font(self, s, prop):
+ """Return a wx font. Cache font instances for efficiency."""
+ _log.debug("%s - get_wx_font()", type(self))
+ key = hash(prop)
+ font = self.fontd.get(key)
+ if font is not None:
+ return font
+ size = self.points_to_pixels(prop.get_size_in_points())
+ # Font colour is determined by the active wx.Pen
+ # TODO: It may be wise to cache font information
+ self.fontd[key] = font = wx.Font( # Cache the font and gc.
+ pointSize=int(size + 0.5),
+ family=self.fontnames.get(prop.get_name(), wx.ROMAN),
+ style=self.fontangles[prop.get_style()],
+ weight=self.fontweights[prop.get_weight()])
+ return font
+
+ def points_to_pixels(self, points):
+ # docstring inherited
+ return points * (PIXELS_PER_INCH / 72.0 * self.dpi / 72.0)
+
+
+class GraphicsContextWx(GraphicsContextBase):
+ """
+ The graphics context provides the color, line styles, etc...
+
+ This class stores a reference to a wxMemoryDC, and a
+ wxGraphicsContext that draws to it. Creating a wxGraphicsContext
+ seems to be fairly heavy, so these objects are cached based on the
+ bitmap object that is passed in.
+
+ The base GraphicsContext stores colors as a RGB tuple on the unit
+ interval, e.g., (0.5, 0.0, 1.0). wxPython uses an int interval, but
+ since wxPython colour management is rather simple, I have not chosen
+ to implement a separate colour manager class.
+ """
+ _capd = {'butt': wx.CAP_BUTT,
+ 'projecting': wx.CAP_PROJECTING,
+ 'round': wx.CAP_ROUND}
+
+ _joind = {'bevel': wx.JOIN_BEVEL,
+ 'miter': wx.JOIN_MITER,
+ 'round': wx.JOIN_ROUND}
+
+ _cache = weakref.WeakKeyDictionary()
+
+ def __init__(self, bitmap, renderer):
+ super().__init__()
+ # assert self.Ok(), "wxMemoryDC not OK to use"
+ _log.debug("%s - __init__(): %s", type(self), bitmap)
+
+ dc, gfx_ctx = self._cache.get(bitmap, (None, None))
+ if dc is None:
+ dc = wx.MemoryDC()
+ dc.SelectObject(bitmap)
+ gfx_ctx = wx.GraphicsContext.Create(dc)
+ gfx_ctx._lastcliprect = None
+ self._cache[bitmap] = dc, gfx_ctx
+
+ self.bitmap = bitmap
+ self.dc = dc
+ self.gfx_ctx = gfx_ctx
+ self._pen = wx.Pen('BLACK', 1, wx.SOLID)
+ gfx_ctx.SetPen(self._pen)
+ self.renderer = renderer
+
+ def select(self):
+ """Select the current bitmap into this wxDC instance."""
+ if sys.platform == 'win32':
+ self.dc.SelectObject(self.bitmap)
+ self.IsSelected = True
+
+ def unselect(self):
+ """Select a Null bitmap into this wxDC instance."""
+ if sys.platform == 'win32':
+ self.dc.SelectObject(wx.NullBitmap)
+ self.IsSelected = False
+
+ def set_foreground(self, fg, isRGBA=None):
+ # docstring inherited
+ # Implementation note: wxPython has a separate concept of pen and
+ # brush - the brush fills any outline trace left by the pen.
+ # Here we set both to the same colour - if a figure is not to be
+ # filled, the renderer will set the brush to be transparent
+ # Same goes for text foreground...
+ _log.debug("%s - set_foreground()", type(self))
+ self.select()
+ super().set_foreground(fg, isRGBA)
+
+ self._pen.SetColour(self.get_wxcolour(self.get_rgb()))
+ self.gfx_ctx.SetPen(self._pen)
+ self.unselect()
+
+ def set_linewidth(self, w):
+ # docstring inherited
+ w = float(w)
+ _log.debug("%s - set_linewidth()", type(self))
+ self.select()
+ if 0 < w < 1:
+ w = 1
+ super().set_linewidth(w)
+ lw = int(self.renderer.points_to_pixels(self._linewidth))
+ if lw == 0:
+ lw = 1
+ self._pen.SetWidth(lw)
+ self.gfx_ctx.SetPen(self._pen)
+ self.unselect()
+
+ def set_capstyle(self, cs):
+ # docstring inherited
+ _log.debug("%s - set_capstyle()", type(self))
+ self.select()
+ super().set_capstyle(cs)
+ self._pen.SetCap(GraphicsContextWx._capd[self._capstyle])
+ self.gfx_ctx.SetPen(self._pen)
+ self.unselect()
+
+ def set_joinstyle(self, js):
+ # docstring inherited
+ _log.debug("%s - set_joinstyle()", type(self))
+ self.select()
+ super().set_joinstyle(js)
+ self._pen.SetJoin(GraphicsContextWx._joind[self._joinstyle])
+ self.gfx_ctx.SetPen(self._pen)
+ self.unselect()
+
+ def get_wxcolour(self, color):
+ """Convert a RGB(A) color to a wx.Colour."""
+ _log.debug("%s - get_wx_color()", type(self))
+ return wx.Colour(*[int(255 * x) for x in color])
+
+
+class _FigureCanvasWxBase(FigureCanvasBase, wx.Panel):
+ """
+ The FigureCanvas contains the figure and does event handling.
+
+ In the wxPython backend, it is derived from wxPanel, and (usually) lives
+ inside a frame instantiated by a FigureManagerWx. The parent window
+ probably implements a wx.Sizer to control the displayed control size - but
+ we give a hint as to our preferred minimum size.
+ """
+
+ required_interactive_framework = "wx"
+ _timer_cls = TimerWx
+
+ keyvald = {
+ wx.WXK_CONTROL: 'control',
+ wx.WXK_SHIFT: 'shift',
+ wx.WXK_ALT: 'alt',
+ wx.WXK_CAPITAL: 'caps_lock',
+ wx.WXK_LEFT: 'left',
+ wx.WXK_UP: 'up',
+ wx.WXK_RIGHT: 'right',
+ wx.WXK_DOWN: 'down',
+ wx.WXK_ESCAPE: 'escape',
+ wx.WXK_F1: 'f1',
+ wx.WXK_F2: 'f2',
+ wx.WXK_F3: 'f3',
+ wx.WXK_F4: 'f4',
+ wx.WXK_F5: 'f5',
+ wx.WXK_F6: 'f6',
+ wx.WXK_F7: 'f7',
+ wx.WXK_F8: 'f8',
+ wx.WXK_F9: 'f9',
+ wx.WXK_F10: 'f10',
+ wx.WXK_F11: 'f11',
+ wx.WXK_F12: 'f12',
+ wx.WXK_SCROLL: 'scroll_lock',
+ wx.WXK_PAUSE: 'break',
+ wx.WXK_BACK: 'backspace',
+ wx.WXK_RETURN: 'enter',
+ wx.WXK_INSERT: 'insert',
+ wx.WXK_DELETE: 'delete',
+ wx.WXK_HOME: 'home',
+ wx.WXK_END: 'end',
+ wx.WXK_PAGEUP: 'pageup',
+ wx.WXK_PAGEDOWN: 'pagedown',
+ wx.WXK_NUMPAD0: '0',
+ wx.WXK_NUMPAD1: '1',
+ wx.WXK_NUMPAD2: '2',
+ wx.WXK_NUMPAD3: '3',
+ wx.WXK_NUMPAD4: '4',
+ wx.WXK_NUMPAD5: '5',
+ wx.WXK_NUMPAD6: '6',
+ wx.WXK_NUMPAD7: '7',
+ wx.WXK_NUMPAD8: '8',
+ wx.WXK_NUMPAD9: '9',
+ wx.WXK_NUMPAD_ADD: '+',
+ wx.WXK_NUMPAD_SUBTRACT: '-',
+ wx.WXK_NUMPAD_MULTIPLY: '*',
+ wx.WXK_NUMPAD_DIVIDE: '/',
+ wx.WXK_NUMPAD_DECIMAL: 'dec',
+ wx.WXK_NUMPAD_ENTER: 'enter',
+ wx.WXK_NUMPAD_UP: 'up',
+ wx.WXK_NUMPAD_RIGHT: 'right',
+ wx.WXK_NUMPAD_DOWN: 'down',
+ wx.WXK_NUMPAD_LEFT: 'left',
+ wx.WXK_NUMPAD_PAGEUP: 'pageup',
+ wx.WXK_NUMPAD_PAGEDOWN: 'pagedown',
+ wx.WXK_NUMPAD_HOME: 'home',
+ wx.WXK_NUMPAD_END: 'end',
+ wx.WXK_NUMPAD_INSERT: 'insert',
+ wx.WXK_NUMPAD_DELETE: 'delete',
+ }
+
+ def __init__(self, parent, id, figure=None):
+ """
+ Initialize a FigureWx instance.
+
+ - Initialize the FigureCanvasBase and wxPanel parents.
+ - Set event handlers for resize, paint, and keyboard and mouse
+ interaction.
+ """
+
+ FigureCanvasBase.__init__(self, figure)
+ w, h = map(math.ceil, self.figure.bbox.size)
+ # Set preferred window size hint - helps the sizer, if one is connected
+ wx.Panel.__init__(self, parent, id, size=wx.Size(w, h))
+ # Create the drawing bitmap
+ self.bitmap = wx.Bitmap(w, h)
+ _log.debug("%s - __init__() - bitmap w:%d h:%d", type(self), w, h)
+ self._isDrawn = False
+ self._rubberband_rect = None
+
+ self.Bind(wx.EVT_SIZE, self._onSize)
+ self.Bind(wx.EVT_PAINT, self._onPaint)
+ self.Bind(wx.EVT_CHAR_HOOK, self._onKeyDown)
+ self.Bind(wx.EVT_KEY_UP, self._onKeyUp)
+ self.Bind(wx.EVT_LEFT_DOWN, self._onMouseButton)
+ self.Bind(wx.EVT_LEFT_DCLICK, self._onMouseButton)
+ self.Bind(wx.EVT_LEFT_UP, self._onMouseButton)
+ self.Bind(wx.EVT_MIDDLE_DOWN, self._onMouseButton)
+ self.Bind(wx.EVT_MIDDLE_DCLICK, self._onMouseButton)
+ self.Bind(wx.EVT_MIDDLE_UP, self._onMouseButton)
+ self.Bind(wx.EVT_RIGHT_DOWN, self._onMouseButton)
+ self.Bind(wx.EVT_RIGHT_DCLICK, self._onMouseButton)
+ self.Bind(wx.EVT_RIGHT_UP, self._onMouseButton)
+ self.Bind(wx.EVT_MOUSEWHEEL, self._onMouseWheel)
+ self.Bind(wx.EVT_MOTION, self._onMotion)
+ self.Bind(wx.EVT_LEAVE_WINDOW, self._onLeave)
+ self.Bind(wx.EVT_ENTER_WINDOW, self._onEnter)
+
+ self.Bind(wx.EVT_MOUSE_CAPTURE_CHANGED, self._onCaptureLost)
+ self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self._onCaptureLost)
+
+ self.SetBackgroundStyle(wx.BG_STYLE_PAINT) # Reduce flicker.
+ self.SetBackgroundColour(wx.WHITE)
+
+ def Copy_to_Clipboard(self, event=None):
+ """Copy bitmap of canvas to system clipboard."""
+ bmp_obj = wx.BitmapDataObject()
+ bmp_obj.SetBitmap(self.bitmap)
+
+ if not wx.TheClipboard.IsOpened():
+ open_success = wx.TheClipboard.Open()
+ if open_success:
+ wx.TheClipboard.SetData(bmp_obj)
+ wx.TheClipboard.Close()
+ wx.TheClipboard.Flush()
+
+ def draw_idle(self):
+ # docstring inherited
+ _log.debug("%s - draw_idle()", type(self))
+ self._isDrawn = False # Force redraw
+ # Triggering a paint event is all that is needed to defer drawing
+ # until later. The platform will send the event when it thinks it is
+ # a good time (usually as soon as there are no other events pending).
+ self.Refresh(eraseBackground=False)
+
+ def flush_events(self):
+ # docstring inherited
+ wx.Yield()
+
+ def start_event_loop(self, timeout=0):
+ # docstring inherited
+ if hasattr(self, '_event_loop'):
+ raise RuntimeError("Event loop already running")
+ timer = wx.Timer(self, id=wx.ID_ANY)
+ if timeout > 0:
+ timer.Start(int(timeout * 1000), oneShot=True)
+ self.Bind(wx.EVT_TIMER, self.stop_event_loop, id=timer.GetId())
+ # Event loop handler for start/stop event loop
+ self._event_loop = wx.GUIEventLoop()
+ self._event_loop.Run()
+ timer.Stop()
+
+ def stop_event_loop(self, event=None):
+ # docstring inherited
+ if hasattr(self, '_event_loop'):
+ if self._event_loop.IsRunning():
+ self._event_loop.Exit()
+ del self._event_loop
+
+ def _get_imagesave_wildcards(self):
+ """Return the wildcard string for the filesave dialog."""
+ default_filetype = self.get_default_filetype()
+ filetypes = self.get_supported_filetypes_grouped()
+ sorted_filetypes = sorted(filetypes.items())
+ wildcards = []
+ extensions = []
+ filter_index = 0
+ for i, (name, exts) in enumerate(sorted_filetypes):
+ ext_list = ';'.join(['*.%s' % ext for ext in exts])
+ extensions.append(exts[0])
+ wildcard = '%s (%s)|%s' % (name, ext_list, ext_list)
+ if default_filetype in exts:
+ filter_index = i
+ wildcards.append(wildcard)
+ wildcards = '|'.join(wildcards)
+ return wildcards, extensions, filter_index
+
+ @_api.delete_parameter("3.4", "origin")
+ def gui_repaint(self, drawDC=None, origin='WX'):
+ """
+ Performs update of the displayed image on the GUI canvas, using the
+ supplied wx.PaintDC device context.
+
+ The 'WXAgg' backend sets origin accordingly.
+ """
+ _log.debug("%s - gui_repaint()", type(self))
+ # The "if self" check avoids a "wrapped C/C++ object has been deleted"
+ # RuntimeError if doing things after window is closed.
+ if not (self and self.IsShownOnScreen()):
+ return
+ if not drawDC: # not called from OnPaint use a ClientDC
+ drawDC = wx.ClientDC(self)
+ # For 'WX' backend on Windows, the bitmap can not be in use by another
+ # DC (see GraphicsContextWx._cache).
+ bmp = (self.bitmap.ConvertToImage().ConvertToBitmap()
+ if wx.Platform == '__WXMSW__'
+ and isinstance(self.figure._cachedRenderer, RendererWx)
+ else self.bitmap)
+ drawDC.DrawBitmap(bmp, 0, 0)
+ if self._rubberband_rect is not None:
+ x0, y0, x1, y1 = self._rubberband_rect
+ drawDC.DrawLineList(
+ [(x0, y0, x1, y0), (x1, y0, x1, y1),
+ (x0, y0, x0, y1), (x0, y1, x1, y1)],
+ wx.Pen('BLACK', 1, wx.PENSTYLE_SHORT_DASH))
+
+ filetypes = {
+ **FigureCanvasBase.filetypes,
+ 'bmp': 'Windows bitmap',
+ 'jpeg': 'JPEG',
+ 'jpg': 'JPEG',
+ 'pcx': 'PCX',
+ 'png': 'Portable Network Graphics',
+ 'tif': 'Tagged Image Format File',
+ 'tiff': 'Tagged Image Format File',
+ 'xpm': 'X pixmap',
+ }
+
+ def print_figure(self, filename, *args, **kwargs):
+ # docstring inherited
+ super().print_figure(filename, *args, **kwargs)
+ # Restore the current view; this is needed because the artist contains
+ # methods rely on particular attributes of the rendered figure for
+ # determining things like bounding boxes.
+ if self._isDrawn:
+ self.draw()
+
+ def _onPaint(self, event):
+ """Called when wxPaintEvt is generated."""
+ _log.debug("%s - _onPaint()", type(self))
+ drawDC = wx.PaintDC(self)
+ if not self._isDrawn:
+ self.draw(drawDC=drawDC)
+ else:
+ self.gui_repaint(drawDC=drawDC)
+ drawDC.Destroy()
+
+ def _onSize(self, event):
+ """
+ Called when wxEventSize is generated.
+
+ In this application we attempt to resize to fit the window, so it
+ is better to take the performance hit and redraw the whole window.
+ """
+
+ _log.debug("%s - _onSize()", type(self))
+ sz = self.GetParent().GetSizer()
+ if sz:
+ si = sz.GetItem(self)
+ if sz and si and not si.Proportion and not si.Flag & wx.EXPAND:
+ # managed by a sizer, but with a fixed size
+ size = self.GetMinSize()
+ else:
+ # variable size
+ size = self.GetClientSize()
+ # Do not allow size to become smaller than MinSize
+ size.IncTo(self.GetMinSize())
+ if getattr(self, "_width", None):
+ if size == (self._width, self._height):
+ # no change in size
+ return
+ self._width, self._height = size
+ self._isDrawn = False
+
+ if self._width <= 1 or self._height <= 1:
+ return # Empty figure
+
+ # Create a new, correctly sized bitmap
+ self.bitmap = wx.Bitmap(self._width, self._height)
+
+ dpival = self.figure.dpi
+ winch = self._width / dpival
+ hinch = self._height / dpival
+ self.figure.set_size_inches(winch, hinch, forward=False)
+
+ # Rendering will happen on the associated paint event
+ # so no need to do anything here except to make sure
+ # the whole background is repainted.
+ self.Refresh(eraseBackground=False)
+ FigureCanvasBase.resize_event(self)
+
+ def _get_key(self, event):
+
+ keyval = event.KeyCode
+ if keyval in self.keyvald:
+ key = self.keyvald[keyval]
+ elif keyval < 256:
+ key = chr(keyval)
+ # wx always returns an uppercase, so make it lowercase if the shift
+ # key is not depressed (NOTE: this will not handle Caps Lock)
+ if not event.ShiftDown():
+ key = key.lower()
+ else:
+ key = None
+
+ for meth, prefix, key_name in (
+ [event.ControlDown, 'ctrl', 'control'],
+ [event.AltDown, 'alt', 'alt'],
+ [event.ShiftDown, 'shift', 'shift'],):
+ if meth() and key_name != key:
+ if not (key_name == 'shift' and key.isupper()):
+ key = '{0}+{1}'.format(prefix, key)
+
+ return key
+
+ def _onKeyDown(self, event):
+ """Capture key press."""
+ key = self._get_key(event)
+ FigureCanvasBase.key_press_event(self, key, guiEvent=event)
+ if self:
+ event.Skip()
+
+ def _onKeyUp(self, event):
+ """Release key."""
+ key = self._get_key(event)
+ FigureCanvasBase.key_release_event(self, key, guiEvent=event)
+ if self:
+ event.Skip()
+
+ def _set_capture(self, capture=True):
+ """Control wx mouse capture."""
+ if self.HasCapture():
+ self.ReleaseMouse()
+ if capture:
+ self.CaptureMouse()
+
+ def _onCaptureLost(self, event):
+ """Capture changed or lost"""
+ self._set_capture(False)
+
+ def _onMouseButton(self, event):
+ """Start measuring on an axis."""
+ event.Skip()
+ self._set_capture(event.ButtonDown() or event.ButtonDClick())
+ x = event.X
+ y = self.figure.bbox.height - event.Y
+ button_map = {
+ wx.MOUSE_BTN_LEFT: MouseButton.LEFT,
+ wx.MOUSE_BTN_MIDDLE: MouseButton.MIDDLE,
+ wx.MOUSE_BTN_RIGHT: MouseButton.RIGHT,
+ }
+ button = event.GetButton()
+ button = button_map.get(button, button)
+ if event.ButtonDown():
+ self.button_press_event(x, y, button, guiEvent=event)
+ elif event.ButtonDClick():
+ self.button_press_event(x, y, button, dblclick=True,
+ guiEvent=event)
+ elif event.ButtonUp():
+ self.button_release_event(x, y, button, guiEvent=event)
+
+ def _onMouseWheel(self, event):
+ """Translate mouse wheel events into matplotlib events"""
+ # Determine mouse location
+ x = event.GetX()
+ y = self.figure.bbox.height - event.GetY()
+ # Convert delta/rotation/rate into a floating point step size
+ step = event.LinesPerAction * event.WheelRotation / event.WheelDelta
+ # Done handling event
+ event.Skip()
+ # Mac gives two events for every wheel event; skip every second one.
+ if wx.Platform == '__WXMAC__':
+ if not hasattr(self, '_skipwheelevent'):
+ self._skipwheelevent = True
+ elif self._skipwheelevent:
+ self._skipwheelevent = False
+ return # Return without processing event
+ else:
+ self._skipwheelevent = True
+ FigureCanvasBase.scroll_event(self, x, y, step, guiEvent=event)
+
+ def _onMotion(self, event):
+ """Start measuring on an axis."""
+ x = event.GetX()
+ y = self.figure.bbox.height - event.GetY()
+ event.Skip()
+ FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=event)
+
+ def _onLeave(self, event):
+ """Mouse has left the window."""
+ event.Skip()
+ FigureCanvasBase.leave_notify_event(self, guiEvent=event)
+
+ def _onEnter(self, event):
+ """Mouse has entered the window."""
+ x = event.GetX()
+ y = self.figure.bbox.height - event.GetY()
+ event.Skip()
+ FigureCanvasBase.enter_notify_event(self, guiEvent=event, xy=(x, y))
+
+
+class FigureCanvasWx(_FigureCanvasWxBase):
+ # Rendering to a Wx canvas using the deprecated Wx renderer.
+
+ def draw(self, drawDC=None):
+ """
+ Render the figure using RendererWx instance renderer, or using a
+ previously defined renderer if none is specified.
+ """
+ _log.debug("%s - draw()", type(self))
+ self.renderer = RendererWx(self.bitmap, self.figure.dpi)
+ self.figure.draw(self.renderer)
+ self._isDrawn = True
+ self.gui_repaint(drawDC=drawDC)
+
+ def print_bmp(self, filename, *args, **kwargs):
+ return self._print_image(filename, wx.BITMAP_TYPE_BMP, *args, **kwargs)
+
+ def print_jpeg(self, filename, *args, **kwargs):
+ return self._print_image(filename, wx.BITMAP_TYPE_JPEG,
+ *args, **kwargs)
+ print_jpg = print_jpeg
+
+ def print_pcx(self, filename, *args, **kwargs):
+ return self._print_image(filename, wx.BITMAP_TYPE_PCX, *args, **kwargs)
+
+ def print_png(self, filename, *args, **kwargs):
+ return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs)
+
+ def print_tiff(self, filename, *args, **kwargs):
+ return self._print_image(filename, wx.BITMAP_TYPE_TIF, *args, **kwargs)
+ print_tif = print_tiff
+
+ def print_xpm(self, filename, *args, **kwargs):
+ return self._print_image(filename, wx.BITMAP_TYPE_XPM, *args, **kwargs)
+
+ @_check_savefig_extra_args
+ def _print_image(self, filename, filetype, *, quality=None):
+ origBitmap = self.bitmap
+
+ self.bitmap = wx.Bitmap(math.ceil(self.figure.bbox.width),
+ math.ceil(self.figure.bbox.height))
+ renderer = RendererWx(self.bitmap, self.figure.dpi)
+
+ gc = renderer.new_gc()
+ self.figure.draw(renderer)
+
+ # image is the object that we call SaveFile on.
+ image = self.bitmap
+ # set the JPEG quality appropriately. Unfortunately, it is only
+ # possible to set the quality on a wx.Image object. So if we
+ # are saving a JPEG, convert the wx.Bitmap to a wx.Image,
+ # and set the quality.
+ if filetype == wx.BITMAP_TYPE_JPEG:
+ if quality is None:
+ quality = dict.__getitem__(mpl.rcParams,
+ 'savefig.jpeg_quality')
+ image = self.bitmap.ConvertToImage()
+ image.SetOption(wx.IMAGE_OPTION_QUALITY, str(quality))
+
+ # Now that we have rendered into the bitmap, save it to the appropriate
+ # file type and clean up.
+ if (cbook.is_writable_file_like(filename) and
+ not isinstance(image, wx.Image)):
+ image = image.ConvertToImage()
+ if not image.SaveFile(filename, filetype):
+ raise RuntimeError(f'Could not save figure to {filename}')
+
+ # Restore everything to normal
+ self.bitmap = origBitmap
+
+ # Note: draw is required here since bits of state about the
+ # last renderer are strewn about the artist draw methods. Do
+ # not remove the draw without first verifying that these have
+ # been cleaned up. The artist contains() methods will fail
+ # otherwise.
+ if self._isDrawn:
+ self.draw()
+ # The "if self" check avoids a "wrapped C/C++ object has been deleted"
+ # RuntimeError if doing things after window is closed.
+ if self:
+ self.Refresh()
+
+
+class FigureFrameWx(wx.Frame):
+ def __init__(self, num, fig):
+ # On non-Windows platform, explicitly set the position - fix
+ # positioning bug on some Linux platforms
+ if wx.Platform == '__WXMSW__':
+ pos = wx.DefaultPosition
+ else:
+ pos = wx.Point(20, 20)
+ super().__init__(parent=None, id=-1, pos=pos)
+ # Frame will be sized later by the Fit method
+ _log.debug("%s - __init__()", type(self))
+ self.num = num
+ _set_frame_icon(self)
+
+ self.canvas = self.get_canvas(fig)
+ w, h = map(math.ceil, fig.bbox.size)
+ self.canvas.SetInitialSize(wx.Size(w, h))
+ self.canvas.SetFocus()
+ self.sizer = wx.BoxSizer(wx.VERTICAL)
+ self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND)
+ # By adding toolbar in sizer, we are able to put it at the bottom
+ # of the frame - so appearance is closer to GTK version
+
+ self.figmgr = FigureManagerWx(self.canvas, num, self)
+
+ self.toolbar = self._get_toolbar()
+
+ if self.figmgr.toolmanager:
+ backend_tools.add_tools_to_manager(self.figmgr.toolmanager)
+ if self.toolbar:
+ backend_tools.add_tools_to_container(self.toolbar)
+
+ if self.toolbar is not None:
+ self.toolbar.Realize()
+ # On Windows platform, default window size is incorrect, so set
+ # toolbar width to figure width.
+ tw, th = self.toolbar.GetSize()
+ fw, fh = self.canvas.GetSize()
+ # By adding toolbar in sizer, we are able to put it at the bottom
+ # of the frame - so appearance is closer to GTK version.
+ self.toolbar.SetSize(wx.Size(fw, th))
+ self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
+ self.SetSizer(self.sizer)
+ self.Fit()
+
+ self.canvas.SetMinSize((2, 2))
+
+ self.Bind(wx.EVT_CLOSE, self._onClose)
+
+ @property
+ def toolmanager(self):
+ return self.figmgr.toolmanager
+
+ def _get_toolbar(self):
+ if mpl.rcParams['toolbar'] == 'toolbar2':
+ toolbar = NavigationToolbar2Wx(self.canvas)
+ elif mpl.rcParams['toolbar'] == 'toolmanager':
+ toolbar = ToolbarWx(self.toolmanager, self)
+ else:
+ toolbar = None
+ return toolbar
+
+ def get_canvas(self, fig):
+ return FigureCanvasWx(self, -1, fig)
+
+ def get_figure_manager(self):
+ _log.debug("%s - get_figure_manager()", type(self))
+ return self.figmgr
+
+ def _onClose(self, event):
+ _log.debug("%s - onClose()", type(self))
+ self.canvas.close_event()
+ self.canvas.stop_event_loop()
+ # set FigureManagerWx.frame to None to prevent repeated attempts to
+ # close this frame from FigureManagerWx.destroy()
+ self.figmgr.frame = None
+ # remove figure manager from Gcf.figs
+ Gcf.destroy(self.figmgr)
+ # Carry on with close event propagation, frame & children destruction
+ event.Skip()
+
+ def GetToolBar(self):
+ """Override wxFrame::GetToolBar as we don't have managed toolbar"""
+ return self.toolbar
+
+ def Destroy(self, *args, **kwargs):
+ try:
+ self.canvas.mpl_disconnect(self.toolbar._id_drag)
+ # Rationale for line above: see issue 2941338.
+ except AttributeError:
+ pass # classic toolbar lacks the attribute
+ # The "if self" check avoids a "wrapped C/C++ object has been deleted"
+ # RuntimeError at exit with e.g.
+ # MPLBACKEND=wxagg python -c 'from pylab import *; plot()'.
+ if self and not self.IsBeingDeleted():
+ super().Destroy(*args, **kwargs)
+ # self.toolbar.Destroy() should not be necessary if the close event
+ # is allowed to propagate.
+ return True
+
+
+class FigureManagerWx(FigureManagerBase):
+ """
+ Container/controller for the FigureCanvas and GUI frame.
+
+ It is instantiated by Gcf whenever a new figure is created. Gcf is
+ responsible for managing multiple instances of FigureManagerWx.
+
+ Attributes
+ ----------
+ canvas : `FigureCanvas`
+ a FigureCanvasWx(wx.Panel) instance
+ window : wxFrame
+ a wxFrame instance - wxpython.org/Phoenix/docs/html/Frame.html
+ """
+
+ def __init__(self, canvas, num, frame):
+ _log.debug("%s - __init__()", type(self))
+ self.frame = self.window = frame
+ self._initializing = True
+ super().__init__(canvas, num)
+ self._initializing = False
+
+ @property
+ def toolbar(self):
+ return self.frame.GetToolBar()
+
+ @toolbar.setter
+ def toolbar(self, value):
+ # Never allow this, except that base class inits this to None before
+ # the frame is set up.
+ if not self._initializing:
+ raise AttributeError("can't set attribute")
+
+ def show(self):
+ # docstring inherited
+ self.frame.Show()
+ self.canvas.draw()
+ if mpl.rcParams['figure.raise_window']:
+ self.frame.Raise()
+
+ def destroy(self, *args):
+ # docstring inherited
+ _log.debug("%s - destroy()", type(self))
+ frame = self.frame
+ if frame: # Else, may have been already deleted, e.g. when closing.
+ # As this can be called from non-GUI thread from plt.close use
+ # wx.CallAfter to ensure thread safety.
+ wx.CallAfter(frame.Close)
+
+ def full_screen_toggle(self):
+ # docstring inherited
+ self.frame.ShowFullScreen(not self.frame.IsFullScreen())
+
+ def get_window_title(self):
+ # docstring inherited
+ return self.window.GetTitle()
+
+ def set_window_title(self, title):
+ # docstring inherited
+ self.window.SetTitle(title)
+
+ def resize(self, width, height):
+ # docstring inherited
+ self.canvas.SetInitialSize(
+ wx.Size(math.ceil(width), math.ceil(height)))
+ self.window.GetSizer().Fit(self.window)
+
+
+def _load_bitmap(filename):
+ """
+ Load a wx.Bitmap from a file in the "images" directory of the Matplotlib
+ data.
+ """
+ return wx.Bitmap(str(cbook._get_data_path('images', filename)))
+
+
+def _set_frame_icon(frame):
+ bundle = wx.IconBundle()
+ for image in ('matplotlib.png', 'matplotlib_large.png'):
+ icon = wx.Icon(_load_bitmap(image))
+ if not icon.IsOk():
+ return
+ bundle.AddIcon(icon)
+ frame.SetIcons(bundle)
+
+
+cursord = {
+ cursors.MOVE: wx.CURSOR_HAND,
+ cursors.HAND: wx.CURSOR_HAND,
+ cursors.POINTER: wx.CURSOR_ARROW,
+ cursors.SELECT_REGION: wx.CURSOR_CROSS,
+ cursors.WAIT: wx.CURSOR_WAIT,
+}
+
+
+class NavigationToolbar2Wx(NavigationToolbar2, wx.ToolBar):
+ def __init__(self, canvas, coordinates=True):
+ wx.ToolBar.__init__(self, canvas.GetParent(), -1)
+
+ if 'wxMac' in wx.PlatformInfo:
+ self.SetToolBitmapSize((24, 24))
+ self.wx_ids = {}
+ for text, tooltip_text, image_file, callback in self.toolitems:
+ if text is None:
+ self.AddSeparator()
+ continue
+ self.wx_ids[text] = (
+ self.AddTool(
+ -1,
+ bitmap=self._icon(f"{image_file}.png"),
+ bmpDisabled=wx.NullBitmap,
+ label=text, shortHelp=tooltip_text,
+ kind=(wx.ITEM_CHECK if text in ["Pan", "Zoom"]
+ else wx.ITEM_NORMAL))
+ .Id)
+ self.Bind(wx.EVT_TOOL, getattr(self, callback),
+ id=self.wx_ids[text])
+
+ self._coordinates = coordinates
+ if self._coordinates:
+ self.AddStretchableSpace()
+ self._label_text = wx.StaticText(self)
+ self.AddControl(self._label_text)
+
+ self.Realize()
+
+ NavigationToolbar2.__init__(self, canvas)
+
+ self._prevZoomRect = None
+ # for now, use alternate zoom-rectangle drawing on all
+ # Macs. N.B. In future versions of wx it may be possible to
+ # detect Retina displays with window.GetContentScaleFactor()
+ # and/or dc.GetContentScaleFactor()
+ self._retinaFix = 'wxMac' in wx.PlatformInfo
+
+ prevZoomRect = _api.deprecate_privatize_attribute("3.3")
+ retinaFix = _api.deprecate_privatize_attribute("3.3")
+ savedRetinaImage = _api.deprecate_privatize_attribute("3.3")
+ wxoverlay = _api.deprecate_privatize_attribute("3.3")
+ zoomAxes = _api.deprecate_privatize_attribute("3.3")
+ zoomStartX = _api.deprecate_privatize_attribute("3.3")
+ zoomStartY = _api.deprecate_privatize_attribute("3.3")
+
+ @staticmethod
+ def _icon(name):
+ """
+ Construct a `wx.Bitmap` suitable for use as icon from an image file
+ *name*, including the extension and relative to Matplotlib's "images"
+ data directory.
+ """
+ image = np.array(PIL.Image.open(cbook._get_data_path("images", name)))
+ try:
+ dark = wx.SystemSettings.GetAppearance().IsDark()
+ except AttributeError: # wxpython < 4.1
+ # copied from wx's IsUsingDarkBackground / GetLuminance.
+ bg = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
+ fg = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT)
+ # See wx.Colour.GetLuminance.
+ bg_lum = (.299 * bg.red + .587 * bg.green + .114 * bg.blue) / 255
+ fg_lum = (.299 * fg.red + .587 * fg.green + .114 * fg.blue) / 255
+ dark = fg_lum - bg_lum > .2
+ if dark:
+ fg = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT)
+ black_mask = (image[..., :3] == 0).all(axis=-1)
+ image[black_mask, :3] = (fg.Red(), fg.Green(), fg.Blue())
+ return wx.Bitmap.FromBufferRGBA(
+ image.shape[1], image.shape[0], image.tobytes())
+
+ @_api.deprecated("3.4")
+ def get_canvas(self, frame, fig):
+ return type(self.canvas)(frame, -1, fig)
+
+ def zoom(self, *args):
+ tool = self.wx_ids['Zoom']
+ self.ToggleTool(tool, not self.GetToolState(tool))
+ super().zoom(*args)
+
+ def pan(self, *args):
+ tool = self.wx_ids['Pan']
+ self.ToggleTool(tool, not self.GetToolState(tool))
+ super().pan(*args)
+
+ def save_figure(self, *args):
+ # Fetch the required filename and file type.
+ filetypes, exts, filter_index = self.canvas._get_imagesave_wildcards()
+ default_file = self.canvas.get_default_filename()
+ dlg = wx.FileDialog(
+ self.canvas.GetParent(), "Save to file",
+ mpl.rcParams["savefig.directory"], default_file, filetypes,
+ wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
+ dlg.SetFilterIndex(filter_index)
+ if dlg.ShowModal() == wx.ID_OK:
+ path = pathlib.Path(dlg.GetPath())
+ _log.debug('%s - Save file path: %s', type(self), path)
+ fmt = exts[dlg.GetFilterIndex()]
+ ext = path.suffix[1:]
+ if ext in self.canvas.get_supported_filetypes() and fmt != ext:
+ # looks like they forgot to set the image type drop
+ # down, going with the extension.
+ _log.warning('extension %s did not match the selected '
+ 'image type %s; going with %s',
+ ext, fmt, ext)
+ fmt = ext
+ # Save dir for next time, unless empty str (which means use cwd).
+ if mpl.rcParams["savefig.directory"]:
+ mpl.rcParams["savefig.directory"] = str(path.parent)
+ try:
+ self.canvas.figure.savefig(str(path), format=fmt)
+ except Exception as e:
+ error_msg_wx(str(e))
+
+ def set_cursor(self, cursor):
+ cursor = wx.Cursor(cursord[cursor])
+ self.canvas.SetCursor(cursor)
+ self.canvas.Update()
+
+ def press_zoom(self, event):
+ super().press_zoom(event)
+ if self.mode.name == 'ZOOM':
+ if not self._retinaFix:
+ self._wxoverlay = wx.Overlay()
+ else:
+ if event.inaxes is not None:
+ self._savedRetinaImage = self.canvas.copy_from_bbox(
+ event.inaxes.bbox)
+ self._zoomStartX = event.xdata
+ self._zoomStartY = event.ydata
+ self._zoomAxes = event.inaxes
+
+ def release_zoom(self, event):
+ super().release_zoom(event)
+ if self.mode.name == 'ZOOM':
+ # When the mouse is released we reset the overlay and it
+ # restores the former content to the window.
+ if not self._retinaFix:
+ self._wxoverlay.Reset()
+ del self._wxoverlay
+ else:
+ del self._savedRetinaImage
+ if self._prevZoomRect:
+ self._prevZoomRect.pop(0).remove()
+ self._prevZoomRect = None
+ if self._zoomAxes:
+ self._zoomAxes = None
+
+ def draw_rubberband(self, event, x0, y0, x1, y1):
+ height = self.canvas.figure.bbox.height
+ self.canvas._rubberband_rect = (x0, height - y0, x1, height - y1)
+ self.canvas.Refresh()
+
+ def remove_rubberband(self):
+ self.canvas._rubberband_rect = None
+ self.canvas.Refresh()
+
+ def set_message(self, s):
+ if self._coordinates:
+ self._label_text.SetLabel(s)
+
+ def set_history_buttons(self):
+ can_backward = self._nav_stack._pos > 0
+ can_forward = self._nav_stack._pos < len(self._nav_stack._elements) - 1
+ if 'Back' in self.wx_ids:
+ self.EnableTool(self.wx_ids['Back'], can_backward)
+ if 'Forward' in self.wx_ids:
+ self.EnableTool(self.wx_ids['Forward'], can_forward)
+
+
+@_api.deprecated("3.3")
+class StatusBarWx(wx.StatusBar):
+ """
+ A status bar is added to _FigureFrame to allow measurements and the
+ previously selected scroll function to be displayed as a user convenience.
+ """
+
+ def __init__(self, parent, *args, **kwargs):
+ super().__init__(parent, -1)
+ self.SetFieldsCount(2)
+
+ def set_function(self, string):
+ self.SetStatusText("%s" % string, 1)
+
+
+# tools for matplotlib.backend_managers.ToolManager:
+
+class ToolbarWx(ToolContainerBase, wx.ToolBar):
+ def __init__(self, toolmanager, parent, style=wx.TB_HORIZONTAL):
+ ToolContainerBase.__init__(self, toolmanager)
+ wx.ToolBar.__init__(self, parent, -1, style=style)
+ self._space = self.AddStretchableSpace()
+ self._label_text = wx.StaticText(self)
+ self.AddControl(self._label_text)
+ self._toolitems = {}
+ self._groups = {} # Mapping of groups to the separator after them.
+
+ def _get_tool_pos(self, tool):
+ """
+ Find the position (index) of a wx.ToolBarToolBase in a ToolBar.
+
+ ``ToolBar.GetToolPos`` is not useful because wx assigns the same Id to
+ all Separators and StretchableSpaces.
+ """
+ pos, = [pos for pos in range(self.ToolsCount)
+ if self.GetToolByPos(pos) == tool]
+ return pos
+
+ def add_toolitem(self, name, group, position, image_file, description,
+ toggle):
+ # Find or create the separator that follows this group.
+ if group not in self._groups:
+ self._groups[group] = self.InsertSeparator(
+ self._get_tool_pos(self._space))
+ sep = self._groups[group]
+ # List all separators.
+ seps = [t for t in map(self.GetToolByPos, range(self.ToolsCount))
+ if t.IsSeparator() and not t.IsStretchableSpace()]
+ # Find where to insert the tool.
+ if position >= 0:
+ # Find the start of the group by looking for the separator
+ # preceding this one; then move forward from it.
+ start = (0 if sep == seps[0]
+ else self._get_tool_pos(seps[seps.index(sep) - 1]) + 1)
+ else:
+ # Move backwards from this separator.
+ start = self._get_tool_pos(sep) + 1
+ idx = start + position
+ if image_file:
+ bmp = NavigationToolbar2Wx._icon(image_file)
+ kind = wx.ITEM_NORMAL if not toggle else wx.ITEM_CHECK
+ tool = self.InsertTool(idx, -1, name, bmp, wx.NullBitmap, kind,
+ description or "")
+ else:
+ size = (self.GetTextExtent(name)[0] + 10, -1)
+ if toggle:
+ control = wx.ToggleButton(self, -1, name, size=size)
+ else:
+ control = wx.Button(self, -1, name, size=size)
+ tool = self.InsertControl(idx, control, label=name)
+ self.Realize()
+
+ def handler(event):
+ self.trigger_tool(name)
+
+ if image_file:
+ self.Bind(wx.EVT_TOOL, handler, tool)
+ else:
+ control.Bind(wx.EVT_LEFT_DOWN, handler)
+
+ self._toolitems.setdefault(name, [])
+ self._toolitems[name].append((tool, handler))
+
+ def toggle_toolitem(self, name, toggled):
+ if name not in self._toolitems:
+ return
+ for tool, handler in self._toolitems[name]:
+ if not tool.IsControl():
+ self.ToggleTool(tool.Id, toggled)
+ else:
+ tool.GetControl().SetValue(toggled)
+ self.Refresh()
+
+ def remove_toolitem(self, name):
+ for tool, handler in self._toolitems[name]:
+ self.DeleteTool(tool.Id)
+ del self._toolitems[name]
+
+ def set_message(self, s):
+ self._label_text.SetLabel(s)
+
+
+@_api.deprecated("3.3")
+class StatusbarWx(StatusbarBase, wx.StatusBar):
+ """For use with ToolManager."""
+ def __init__(self, parent, *args, **kwargs):
+ StatusbarBase.__init__(self, *args, **kwargs)
+ wx.StatusBar.__init__(self, parent, -1)
+ self.SetFieldsCount(1)
+ self.SetStatusText("")
+
+ def set_message(self, s):
+ self.SetStatusText(s)
+
+
+class ConfigureSubplotsWx(backend_tools.ConfigureSubplotsBase):
+ def trigger(self, *args):
+ NavigationToolbar2Wx.configure_subplots(
+ self._make_classic_style_pseudo_toolbar())
+
+
+class SaveFigureWx(backend_tools.SaveFigureBase):
+ def trigger(self, *args):
+ NavigationToolbar2Wx.save_figure(
+ self._make_classic_style_pseudo_toolbar())
+
+
+class SetCursorWx(backend_tools.SetCursorBase):
+ def set_cursor(self, cursor):
+ NavigationToolbar2Wx.set_cursor(
+ self._make_classic_style_pseudo_toolbar(), cursor)
+
+
+class RubberbandWx(backend_tools.RubberbandBase):
+ def draw_rubberband(self, x0, y0, x1, y1):
+ NavigationToolbar2Wx.draw_rubberband(
+ self._make_classic_style_pseudo_toolbar(), None, x0, y0, x1, y1)
+
+ def remove_rubberband(self):
+ NavigationToolbar2Wx.remove_rubberband(
+ self._make_classic_style_pseudo_toolbar())
+
+
+class _HelpDialog(wx.Dialog):
+ _instance = None # a reference to an open dialog singleton
+ headers = [("Action", "Shortcuts", "Description")]
+ widths = [100, 140, 300]
+
+ def __init__(self, parent, help_entries):
+ super().__init__(parent, title="Help",
+ style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
+
+ sizer = wx.BoxSizer(wx.VERTICAL)
+ grid_sizer = wx.FlexGridSizer(0, 3, 8, 6)
+ # create and add the entries
+ bold = self.GetFont().MakeBold()
+ for r, row in enumerate(self.headers + help_entries):
+ for (col, width) in zip(row, self.widths):
+ label = wx.StaticText(self, label=col)
+ if r == 0:
+ label.SetFont(bold)
+ label.Wrap(width)
+ grid_sizer.Add(label, 0, 0, 0)
+ # finalize layout, create button
+ sizer.Add(grid_sizer, 0, wx.ALL, 6)
+ OK = wx.Button(self, wx.ID_OK)
+ sizer.Add(OK, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 8)
+ self.SetSizer(sizer)
+ sizer.Fit(self)
+ self.Layout()
+ self.Bind(wx.EVT_CLOSE, self.OnClose)
+ OK.Bind(wx.EVT_BUTTON, self.OnClose)
+
+ def OnClose(self, event):
+ _HelpDialog._instance = None # remove global reference
+ self.DestroyLater()
+ event.Skip()
+
+ @classmethod
+ def show(cls, parent, help_entries):
+ # if no dialog is shown, create one; otherwise just re-raise it
+ if cls._instance:
+ cls._instance.Raise()
+ return
+ cls._instance = cls(parent, help_entries)
+ cls._instance.Show()
+
+
+class HelpWx(backend_tools.ToolHelpBase):
+ def trigger(self, *args):
+ _HelpDialog.show(self.figure.canvas.GetTopLevelParent(),
+ self._get_help_entries())
+
+
+class ToolCopyToClipboardWx(backend_tools.ToolCopyToClipboardBase):
+ def trigger(self, *args, **kwargs):
+ if not self.canvas._isDrawn:
+ self.canvas.draw()
+ if not self.canvas.bitmap.IsOk() or not wx.TheClipboard.Open():
+ return
+ try:
+ wx.TheClipboard.SetData(wx.BitmapDataObject(self.canvas.bitmap))
+ finally:
+ wx.TheClipboard.Close()
+
+
+backend_tools.ToolSaveFigure = SaveFigureWx
+backend_tools.ToolConfigureSubplots = ConfigureSubplotsWx
+backend_tools.ToolSetCursor = SetCursorWx
+backend_tools.ToolRubberband = RubberbandWx
+backend_tools.ToolHelp = HelpWx
+backend_tools.ToolCopyToClipboard = ToolCopyToClipboardWx
+
+
+@_Backend.export
+class _BackendWx(_Backend):
+ FigureCanvas = FigureCanvasWx
+ FigureManager = FigureManagerWx
+ _frame_class = FigureFrameWx
+
+ @classmethod
+ def new_figure_manager(cls, num, *args, **kwargs):
+ # Create a wx.App instance if it has not been created so far.
+ wxapp = wx.GetApp()
+ if wxapp is None:
+ wxapp = wx.App(False)
+ wxapp.SetExitOnFrameDelete(True)
+ cbook._setup_new_guiapp()
+ # Retain a reference to the app object so that it does not get
+ # garbage collected.
+ _BackendWx._theWxApp = wxapp
+ return super().new_figure_manager(num, *args, **kwargs)
+
+ @classmethod
+ def new_figure_manager_given_figure(cls, num, figure):
+ frame = cls._frame_class(num, figure)
+ figmgr = frame.get_figure_manager()
+ if mpl.is_interactive():
+ figmgr.frame.Show()
+ figure.canvas.draw_idle()
+ return figmgr
+
+ @staticmethod
+ def mainloop():
+ if not wx.App.IsMainLoopRunning():
+ wxapp = wx.GetApp()
+ if wxapp is not None:
+ wxapp.MainLoop()
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_wxagg.py b/venv/Lib/site-packages/matplotlib/backends/backend_wxagg.py
new file mode 100644
index 0000000..106578e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_wxagg.py
@@ -0,0 +1,92 @@
+import wx
+
+from .backend_agg import FigureCanvasAgg
+from .backend_wx import (
+ _BackendWx, _FigureCanvasWxBase, FigureFrameWx,
+ NavigationToolbar2Wx as NavigationToolbar2WxAgg)
+
+
+class FigureFrameWxAgg(FigureFrameWx):
+ def get_canvas(self, fig):
+ return FigureCanvasWxAgg(self, -1, fig)
+
+
+class FigureCanvasWxAgg(FigureCanvasAgg, _FigureCanvasWxBase):
+ """
+ The FigureCanvas contains the figure and does event handling.
+
+ In the wxPython backend, it is derived from wxPanel, and (usually)
+ lives inside a frame instantiated by a FigureManagerWx. The parent
+ window probably implements a wxSizer to control the displayed
+ control size - but we give a hint as to our preferred minimum
+ size.
+ """
+
+ def draw(self, drawDC=None):
+ """
+ Render the figure using agg.
+ """
+ FigureCanvasAgg.draw(self)
+
+ self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
+ self._isDrawn = True
+ self.gui_repaint(drawDC=drawDC)
+
+ def blit(self, bbox=None):
+ # docstring inherited
+ if bbox is None:
+ self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
+ self.gui_repaint()
+ return
+
+ srcBmp = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
+ srcDC = wx.MemoryDC()
+ srcDC.SelectObject(srcBmp)
+
+ destDC = wx.MemoryDC()
+ destDC.SelectObject(self.bitmap)
+
+ x = int(bbox.x0)
+ y = int(self.bitmap.GetHeight() - bbox.y1)
+ destDC.Blit(x, y, int(bbox.width), int(bbox.height), srcDC, x, y)
+
+ destDC.SelectObject(wx.NullBitmap)
+ srcDC.SelectObject(wx.NullBitmap)
+ self.gui_repaint()
+
+
+def _convert_agg_to_wx_bitmap(agg, bbox):
+ """
+ Convert the region of the agg buffer bounded by bbox to a wx.Bitmap. If
+ bbox is None, the entire buffer is converted.
+ Note: agg must be a backend_agg.RendererAgg instance.
+ """
+ if bbox is None:
+ # agg => rgba buffer -> bitmap
+ return wx.Bitmap.FromBufferRGBA(int(agg.width), int(agg.height),
+ agg.buffer_rgba())
+ else:
+ # agg => rgba buffer -> bitmap => clipped bitmap
+ srcBmp = wx.Bitmap.FromBufferRGBA(int(agg.width), int(agg.height),
+ agg.buffer_rgba())
+ srcDC = wx.MemoryDC()
+ srcDC.SelectObject(srcBmp)
+
+ destBmp = wx.Bitmap(int(bbox.width), int(bbox.height))
+ destDC = wx.MemoryDC()
+ destDC.SelectObject(destBmp)
+
+ x = int(bbox.x0)
+ y = int(int(agg.height) - bbox.y1)
+ destDC.Blit(0, 0, int(bbox.width), int(bbox.height), srcDC, x, y)
+
+ srcDC.SelectObject(wx.NullBitmap)
+ destDC.SelectObject(wx.NullBitmap)
+
+ return destBmp
+
+
+@_BackendWx.export
+class _BackendWxAgg(_BackendWx):
+ FigureCanvas = FigureCanvasWxAgg
+ _frame_class = FigureFrameWxAgg
diff --git a/venv/Lib/site-packages/matplotlib/backends/backend_wxcairo.py b/venv/Lib/site-packages/matplotlib/backends/backend_wxcairo.py
new file mode 100644
index 0000000..6cb0b9d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/backend_wxcairo.py
@@ -0,0 +1,47 @@
+import wx.lib.wxcairo as wxcairo
+
+from .backend_cairo import cairo, FigureCanvasCairo, RendererCairo
+from .backend_wx import (
+ _BackendWx, _FigureCanvasWxBase, FigureFrameWx,
+ NavigationToolbar2Wx as NavigationToolbar2WxCairo)
+
+
+class FigureFrameWxCairo(FigureFrameWx):
+ def get_canvas(self, fig):
+ return FigureCanvasWxCairo(self, -1, fig)
+
+
+class FigureCanvasWxCairo(_FigureCanvasWxBase, FigureCanvasCairo):
+ """
+ The FigureCanvas contains the figure and does event handling.
+
+ In the wxPython backend, it is derived from wxPanel, and (usually) lives
+ inside a frame instantiated by a FigureManagerWx. The parent window
+ probably implements a wxSizer to control the displayed control size - but
+ we give a hint as to our preferred minimum size.
+ """
+
+ def __init__(self, parent, id, figure):
+ # _FigureCanvasWxBase should be fixed to have the same signature as
+ # every other FigureCanvas and use cooperative inheritance, but in the
+ # meantime the following will make do.
+ _FigureCanvasWxBase.__init__(self, parent, id, figure)
+ FigureCanvasCairo.__init__(self, figure)
+ self._renderer = RendererCairo(self.figure.dpi)
+
+ def draw(self, drawDC=None):
+ width = int(self.figure.bbox.width)
+ height = int(self.figure.bbox.height)
+ surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
+ self._renderer.set_ctx_from_surface(surface)
+ self._renderer.set_width_height(width, height)
+ self.figure.draw(self._renderer)
+ self.bitmap = wxcairo.BitmapFromImageSurface(surface)
+ self._isDrawn = True
+ self.gui_repaint(drawDC=drawDC)
+
+
+@_BackendWx.export
+class _BackendWxCairo(_BackendWx):
+ FigureCanvas = FigureCanvasWxCairo
+ _frame_class = FigureFrameWxCairo
diff --git a/venv/Lib/site-packages/matplotlib/backends/qt_compat.py b/venv/Lib/site-packages/matplotlib/backends/qt_compat.py
new file mode 100644
index 0000000..b741dc4
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/qt_compat.py
@@ -0,0 +1,230 @@
+"""
+Qt binding and backend selector.
+
+The selection logic is as follows:
+- if any of PyQt5, PySide2, PyQt4 or PySide have already been imported
+ (checked in that order), use it;
+- otherwise, if the QT_API environment variable (used by Enthought) is set, use
+ it to determine which binding to use (but do not change the backend based on
+ it; i.e. if the Qt5Agg backend is requested but QT_API is set to "pyqt4",
+ then actually use Qt5 with PyQt5 or PySide2 (whichever can be imported);
+- otherwise, use whatever the rcParams indicate.
+
+Support for PyQt4 is deprecated.
+"""
+
+from distutils.version import LooseVersion
+import os
+import platform
+import sys
+
+import matplotlib as mpl
+from matplotlib import _api
+
+
+QT_API_PYQT5 = "PyQt5"
+QT_API_PYSIDE2 = "PySide2"
+QT_API_PYQTv2 = "PyQt4v2"
+QT_API_PYSIDE = "PySide"
+QT_API_PYQT = "PyQt4" # Use the old sip v1 API (Py3 defaults to v2).
+QT_API_ENV = os.environ.get("QT_API")
+if QT_API_ENV is not None:
+ QT_API_ENV = QT_API_ENV.lower()
+# Mapping of QT_API_ENV to requested binding. ETS does not support PyQt4v1.
+# (https://github.com/enthought/pyface/blob/master/pyface/qt/__init__.py)
+_ETS = {"pyqt5": QT_API_PYQT5, "pyside2": QT_API_PYSIDE2,
+ "pyqt": QT_API_PYQTv2, "pyside": QT_API_PYSIDE,
+ None: None}
+# First, check if anything is already imported.
+if "PyQt5.QtCore" in sys.modules:
+ QT_API = QT_API_PYQT5
+elif "PySide2.QtCore" in sys.modules:
+ QT_API = QT_API_PYSIDE2
+elif "PyQt4.QtCore" in sys.modules:
+ QT_API = QT_API_PYQTv2
+elif "PySide.QtCore" in sys.modules:
+ QT_API = QT_API_PYSIDE
+# Otherwise, check the QT_API environment variable (from Enthought). This can
+# only override the binding, not the backend (in other words, we check that the
+# requested backend actually matches). Use dict.__getitem__ to avoid
+# triggering backend resolution (which can result in a partially but
+# incompletely imported backend_qt5).
+elif dict.__getitem__(mpl.rcParams, "backend") in ["Qt5Agg", "Qt5Cairo"]:
+ if QT_API_ENV in ["pyqt5", "pyside2"]:
+ QT_API = _ETS[QT_API_ENV]
+ else:
+ QT_API = None
+elif dict.__getitem__(mpl.rcParams, "backend") in ["Qt4Agg", "Qt4Cairo"]:
+ if QT_API_ENV in ["pyqt4", "pyside"]:
+ QT_API = _ETS[QT_API_ENV]
+ else:
+ QT_API = None
+# A non-Qt backend was selected but we still got there (possible, e.g., when
+# fully manually embedding Matplotlib in a Qt app without using pyplot).
+else:
+ try:
+ QT_API = _ETS[QT_API_ENV]
+ except KeyError as err:
+ raise RuntimeError(
+ "The environment variable QT_API has the unrecognized value {!r};"
+ "valid values are 'pyqt5', 'pyside2', 'pyqt', and "
+ "'pyside'") from err
+
+
+def _setup_pyqt5():
+ global QtCore, QtGui, QtWidgets, __version__, is_pyqt5, \
+ _isdeleted, _getSaveFileName
+
+ if QT_API == QT_API_PYQT5:
+ from PyQt5 import QtCore, QtGui, QtWidgets
+ import sip
+ __version__ = QtCore.PYQT_VERSION_STR
+ QtCore.Signal = QtCore.pyqtSignal
+ QtCore.Slot = QtCore.pyqtSlot
+ QtCore.Property = QtCore.pyqtProperty
+ _isdeleted = sip.isdeleted
+ elif QT_API == QT_API_PYSIDE2:
+ from PySide2 import QtCore, QtGui, QtWidgets, __version__
+ import shiboken2
+ def _isdeleted(obj): return not shiboken2.isValid(obj)
+ else:
+ raise ValueError("Unexpected value for the 'backend.qt5' rcparam")
+ _getSaveFileName = QtWidgets.QFileDialog.getSaveFileName
+
+ @_api.deprecated("3.3", alternative="QtCore.qVersion()")
+ def is_pyqt5():
+ return True
+
+
+def _setup_pyqt4():
+ global QtCore, QtGui, QtWidgets, __version__, is_pyqt5, \
+ _isdeleted, _getSaveFileName
+
+ def _setup_pyqt4_internal(api):
+ global QtCore, QtGui, QtWidgets, \
+ __version__, is_pyqt5, _isdeleted, _getSaveFileName
+ # List of incompatible APIs:
+ # http://pyqt.sourceforge.net/Docs/PyQt4/incompatible_apis.html
+ _sip_apis = ["QDate", "QDateTime", "QString", "QTextStream", "QTime",
+ "QUrl", "QVariant"]
+ try:
+ import sip
+ except ImportError:
+ pass
+ else:
+ for _sip_api in _sip_apis:
+ try:
+ sip.setapi(_sip_api, api)
+ except (AttributeError, ValueError):
+ pass
+ from PyQt4 import QtCore, QtGui
+ import sip # Always succeeds *after* importing PyQt4.
+ __version__ = QtCore.PYQT_VERSION_STR
+ # PyQt 4.6 introduced getSaveFileNameAndFilter:
+ # https://riverbankcomputing.com/news/pyqt-46
+ if __version__ < LooseVersion("4.6"):
+ raise ImportError("PyQt<4.6 is not supported")
+ QtCore.Signal = QtCore.pyqtSignal
+ QtCore.Slot = QtCore.pyqtSlot
+ QtCore.Property = QtCore.pyqtProperty
+ _isdeleted = sip.isdeleted
+ _getSaveFileName = QtGui.QFileDialog.getSaveFileNameAndFilter
+
+ if QT_API == QT_API_PYQTv2:
+ _setup_pyqt4_internal(api=2)
+ elif QT_API == QT_API_PYSIDE:
+ from PySide import QtCore, QtGui, __version__, __version_info__
+ import shiboken
+ # PySide 1.0.3 fixed the following:
+ # https://srinikom.github.io/pyside-bz-archive/809.html
+ if __version_info__ < (1, 0, 3):
+ raise ImportError("PySide<1.0.3 is not supported")
+ def _isdeleted(obj): return not shiboken.isValid(obj)
+ _getSaveFileName = QtGui.QFileDialog.getSaveFileName
+ elif QT_API == QT_API_PYQT:
+ _setup_pyqt4_internal(api=1)
+ else:
+ raise ValueError("Unexpected value for the 'backend.qt4' rcparam")
+ QtWidgets = QtGui
+
+ @_api.deprecated("3.3", alternative="QtCore.qVersion()")
+ def is_pyqt5():
+ return False
+
+
+if QT_API in [QT_API_PYQT5, QT_API_PYSIDE2]:
+ _setup_pyqt5()
+elif QT_API in [QT_API_PYQTv2, QT_API_PYSIDE, QT_API_PYQT]:
+ _setup_pyqt4()
+elif QT_API is None: # See above re: dict.__getitem__.
+ if dict.__getitem__(mpl.rcParams, "backend") == "Qt4Agg":
+ _candidates = [(_setup_pyqt4, QT_API_PYQTv2),
+ (_setup_pyqt4, QT_API_PYSIDE),
+ (_setup_pyqt4, QT_API_PYQT),
+ (_setup_pyqt5, QT_API_PYQT5),
+ (_setup_pyqt5, QT_API_PYSIDE2)]
+ else:
+ _candidates = [(_setup_pyqt5, QT_API_PYQT5),
+ (_setup_pyqt5, QT_API_PYSIDE2),
+ (_setup_pyqt4, QT_API_PYQTv2),
+ (_setup_pyqt4, QT_API_PYSIDE),
+ (_setup_pyqt4, QT_API_PYQT)]
+ for _setup, QT_API in _candidates:
+ try:
+ _setup()
+ except ImportError:
+ continue
+ break
+ else:
+ raise ImportError("Failed to import any qt binding")
+else: # We should not get there.
+ raise AssertionError("Unexpected QT_API: {}".format(QT_API))
+
+
+# Fixes issues with Big Sur
+# https://bugreports.qt.io/browse/QTBUG-87014, fixed in qt 5.15.2
+if (sys.platform == 'darwin' and
+ LooseVersion(platform.mac_ver()[0]) >= LooseVersion("10.16") and
+ LooseVersion(QtCore.qVersion()) < LooseVersion("5.15.2") and
+ "QT_MAC_WANTS_LAYER" not in os.environ):
+ os.environ["QT_MAC_WANTS_LAYER"] = "1"
+
+
+# These globals are only defined for backcompatibility purposes.
+ETS = dict(pyqt=(QT_API_PYQTv2, 4), pyside=(QT_API_PYSIDE, 4),
+ pyqt5=(QT_API_PYQT5, 5), pyside2=(QT_API_PYSIDE2, 5))
+
+QT_RC_MAJOR_VERSION = int(QtCore.qVersion().split(".")[0])
+
+if QT_RC_MAJOR_VERSION == 4:
+ _api.warn_deprecated("3.3", name="support for Qt4")
+
+
+def _devicePixelRatioF(obj):
+ """
+ Return obj.devicePixelRatioF() with graceful fallback for older Qt.
+
+ This can be replaced by the direct call when we require Qt>=5.6.
+ """
+ try:
+ # Not available on Qt<5.6
+ return obj.devicePixelRatioF() or 1
+ except AttributeError:
+ pass
+ try:
+ # Not available on Qt4 or some older Qt5.
+ # self.devicePixelRatio() returns 0 in rare cases
+ return obj.devicePixelRatio() or 1
+ except AttributeError:
+ return 1
+
+
+def _setDevicePixelRatio(obj, val):
+ """
+ Call obj.setDevicePixelRatio(val) with graceful fallback for older Qt.
+
+ This can be replaced by the direct call when we require Qt>=5.6.
+ """
+ if hasattr(obj, 'setDevicePixelRatio'):
+ # Not available on Qt4 or some older Qt5.
+ obj.setDevicePixelRatio(val)
diff --git a/venv/Lib/site-packages/matplotlib/backends/qt_editor/__init__.py b/venv/Lib/site-packages/matplotlib/backends/qt_editor/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/venv/Lib/site-packages/matplotlib/backends/qt_editor/_formlayout.py b/venv/Lib/site-packages/matplotlib/backends/qt_editor/_formlayout.py
new file mode 100644
index 0000000..e2b371f
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/qt_editor/_formlayout.py
@@ -0,0 +1,568 @@
+"""
+formlayout
+==========
+
+Module creating Qt form dialogs/layouts to edit various type of parameters
+
+
+formlayout License Agreement (MIT License)
+------------------------------------------
+
+Copyright (c) 2009 Pierre Raybaut
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+"""
+
+# History:
+# 1.0.10: added float validator
+# (disable "Ok" and "Apply" button when not valid)
+# 1.0.7: added support for "Apply" button
+# 1.0.6: code cleaning
+
+__version__ = '1.0.10'
+__license__ = __doc__
+
+import copy
+import datetime
+import logging
+from numbers import Integral, Real
+
+from matplotlib import _api, colors as mcolors
+from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
+
+_log = logging.getLogger(__name__)
+
+BLACKLIST = {"title", "label"}
+
+
+class ColorButton(QtWidgets.QPushButton):
+ """
+ Color choosing push button
+ """
+ colorChanged = QtCore.Signal(QtGui.QColor)
+
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ self.setFixedSize(20, 20)
+ self.setIconSize(QtCore.QSize(12, 12))
+ self.clicked.connect(self.choose_color)
+ self._color = QtGui.QColor()
+
+ def choose_color(self):
+ color = QtWidgets.QColorDialog.getColor(
+ self._color, self.parentWidget(), "",
+ QtWidgets.QColorDialog.ShowAlphaChannel)
+ if color.isValid():
+ self.set_color(color)
+
+ def get_color(self):
+ return self._color
+
+ @QtCore.Slot(QtGui.QColor)
+ def set_color(self, color):
+ if color != self._color:
+ self._color = color
+ self.colorChanged.emit(self._color)
+ pixmap = QtGui.QPixmap(self.iconSize())
+ pixmap.fill(color)
+ self.setIcon(QtGui.QIcon(pixmap))
+
+ color = QtCore.Property(QtGui.QColor, get_color, set_color)
+
+
+def to_qcolor(color):
+ """Create a QColor from a matplotlib color"""
+ qcolor = QtGui.QColor()
+ try:
+ rgba = mcolors.to_rgba(color)
+ except ValueError:
+ _api.warn_external(f'Ignoring invalid color {color!r}')
+ return qcolor # return invalid QColor
+ qcolor.setRgbF(*rgba)
+ return qcolor
+
+
+class ColorLayout(QtWidgets.QHBoxLayout):
+ """Color-specialized QLineEdit layout"""
+ def __init__(self, color, parent=None):
+ super().__init__()
+ assert isinstance(color, QtGui.QColor)
+ self.lineedit = QtWidgets.QLineEdit(
+ mcolors.to_hex(color.getRgbF(), keep_alpha=True), parent)
+ self.lineedit.editingFinished.connect(self.update_color)
+ self.addWidget(self.lineedit)
+ self.colorbtn = ColorButton(parent)
+ self.colorbtn.color = color
+ self.colorbtn.colorChanged.connect(self.update_text)
+ self.addWidget(self.colorbtn)
+
+ def update_color(self):
+ color = self.text()
+ qcolor = to_qcolor(color) # defaults to black if not qcolor.isValid()
+ self.colorbtn.color = qcolor
+
+ def update_text(self, color):
+ self.lineedit.setText(mcolors.to_hex(color.getRgbF(), keep_alpha=True))
+
+ def text(self):
+ return self.lineedit.text()
+
+
+def font_is_installed(font):
+ """Check if font is installed"""
+ return [fam for fam in QtGui.QFontDatabase().families()
+ if str(fam) == font]
+
+
+def tuple_to_qfont(tup):
+ """
+ Create a QFont from tuple:
+ (family [string], size [int], italic [bool], bold [bool])
+ """
+ if not (isinstance(tup, tuple) and len(tup) == 4
+ and font_is_installed(tup[0])
+ and isinstance(tup[1], Integral)
+ and isinstance(tup[2], bool)
+ and isinstance(tup[3], bool)):
+ return None
+ font = QtGui.QFont()
+ family, size, italic, bold = tup
+ font.setFamily(family)
+ font.setPointSize(size)
+ font.setItalic(italic)
+ font.setBold(bold)
+ return font
+
+
+def qfont_to_tuple(font):
+ return (str(font.family()), int(font.pointSize()),
+ font.italic(), font.bold())
+
+
+class FontLayout(QtWidgets.QGridLayout):
+ """Font selection"""
+ def __init__(self, value, parent=None):
+ super().__init__()
+ font = tuple_to_qfont(value)
+ assert font is not None
+
+ # Font family
+ self.family = QtWidgets.QFontComboBox(parent)
+ self.family.setCurrentFont(font)
+ self.addWidget(self.family, 0, 0, 1, -1)
+
+ # Font size
+ self.size = QtWidgets.QComboBox(parent)
+ self.size.setEditable(True)
+ sizelist = [*range(6, 12), *range(12, 30, 2), 36, 48, 72]
+ size = font.pointSize()
+ if size not in sizelist:
+ sizelist.append(size)
+ sizelist.sort()
+ self.size.addItems([str(s) for s in sizelist])
+ self.size.setCurrentIndex(sizelist.index(size))
+ self.addWidget(self.size, 1, 0)
+
+ # Italic or not
+ self.italic = QtWidgets.QCheckBox(self.tr("Italic"), parent)
+ self.italic.setChecked(font.italic())
+ self.addWidget(self.italic, 1, 1)
+
+ # Bold or not
+ self.bold = QtWidgets.QCheckBox(self.tr("Bold"), parent)
+ self.bold.setChecked(font.bold())
+ self.addWidget(self.bold, 1, 2)
+
+ def get_font(self):
+ font = self.family.currentFont()
+ font.setItalic(self.italic.isChecked())
+ font.setBold(self.bold.isChecked())
+ font.setPointSize(int(self.size.currentText()))
+ return qfont_to_tuple(font)
+
+
+def is_edit_valid(edit):
+ text = edit.text()
+ state = edit.validator().validate(text, 0)[0]
+
+ return state == QtGui.QDoubleValidator.Acceptable
+
+
+class FormWidget(QtWidgets.QWidget):
+ update_buttons = QtCore.Signal()
+
+ def __init__(self, data, comment="", with_margin=False, parent=None):
+ """
+ Parameters
+ ----------
+ data : list of (label, value) pairs
+ The data to be edited in the form.
+ comment : str, optional
+ with_margin : bool, default: False
+ If False, the form elements reach to the border of the widget.
+ This is the desired behavior if the FormWidget is used as a widget
+ alongside with other widgets such as a QComboBox, which also do
+ not have a margin around them.
+ However, a margin can be desired if the FormWidget is the only
+ widget within a container, e.g. a tab in a QTabWidget.
+ parent : QWidget or None
+ The parent widget.
+ """
+ super().__init__(parent)
+ self.data = copy.deepcopy(data)
+ self.widgets = []
+ self.formlayout = QtWidgets.QFormLayout(self)
+ if not with_margin:
+ self.formlayout.setContentsMargins(0, 0, 0, 0)
+ if comment:
+ self.formlayout.addRow(QtWidgets.QLabel(comment))
+ self.formlayout.addRow(QtWidgets.QLabel(" "))
+
+ def get_dialog(self):
+ """Return FormDialog instance"""
+ dialog = self.parent()
+ while not isinstance(dialog, QtWidgets.QDialog):
+ dialog = dialog.parent()
+ return dialog
+
+ def setup(self):
+ for label, value in self.data:
+ if label is None and value is None:
+ # Separator: (None, None)
+ self.formlayout.addRow(QtWidgets.QLabel(" "),
+ QtWidgets.QLabel(" "))
+ self.widgets.append(None)
+ continue
+ elif label is None:
+ # Comment
+ self.formlayout.addRow(QtWidgets.QLabel(value))
+ self.widgets.append(None)
+ continue
+ elif tuple_to_qfont(value) is not None:
+ field = FontLayout(value, self)
+ elif (label.lower() not in BLACKLIST
+ and mcolors.is_color_like(value)):
+ field = ColorLayout(to_qcolor(value), self)
+ elif isinstance(value, str):
+ field = QtWidgets.QLineEdit(value, self)
+ elif isinstance(value, (list, tuple)):
+ if isinstance(value, tuple):
+ value = list(value)
+ # Note: get() below checks the type of value[0] in self.data so
+ # it is essential that value gets modified in-place.
+ # This means that the code is actually broken in the case where
+ # value is a tuple, but fortunately we always pass a list...
+ selindex = value.pop(0)
+ field = QtWidgets.QComboBox(self)
+ if isinstance(value[0], (list, tuple)):
+ keys = [key for key, _val in value]
+ value = [val for _key, val in value]
+ else:
+ keys = value
+ field.addItems(value)
+ if selindex in value:
+ selindex = value.index(selindex)
+ elif selindex in keys:
+ selindex = keys.index(selindex)
+ elif not isinstance(selindex, Integral):
+ _log.warning(
+ "index '%s' is invalid (label: %s, value: %s)",
+ selindex, label, value)
+ selindex = 0
+ field.setCurrentIndex(selindex)
+ elif isinstance(value, bool):
+ field = QtWidgets.QCheckBox(self)
+ if value:
+ field.setCheckState(QtCore.Qt.Checked)
+ else:
+ field.setCheckState(QtCore.Qt.Unchecked)
+ elif isinstance(value, Integral):
+ field = QtWidgets.QSpinBox(self)
+ field.setRange(-10**9, 10**9)
+ field.setValue(value)
+ elif isinstance(value, Real):
+ field = QtWidgets.QLineEdit(repr(value), self)
+ field.setCursorPosition(0)
+ field.setValidator(QtGui.QDoubleValidator(field))
+ field.validator().setLocale(QtCore.QLocale("C"))
+ dialog = self.get_dialog()
+ dialog.register_float_field(field)
+ field.textChanged.connect(lambda text: dialog.update_buttons())
+ elif isinstance(value, datetime.datetime):
+ field = QtWidgets.QDateTimeEdit(self)
+ field.setDateTime(value)
+ elif isinstance(value, datetime.date):
+ field = QtWidgets.QDateEdit(self)
+ field.setDate(value)
+ else:
+ field = QtWidgets.QLineEdit(repr(value), self)
+ self.formlayout.addRow(label, field)
+ self.widgets.append(field)
+
+ def get(self):
+ valuelist = []
+ for index, (label, value) in enumerate(self.data):
+ field = self.widgets[index]
+ if label is None:
+ # Separator / Comment
+ continue
+ elif tuple_to_qfont(value) is not None:
+ value = field.get_font()
+ elif isinstance(value, str) or mcolors.is_color_like(value):
+ value = str(field.text())
+ elif isinstance(value, (list, tuple)):
+ index = int(field.currentIndex())
+ if isinstance(value[0], (list, tuple)):
+ value = value[index][0]
+ else:
+ value = value[index]
+ elif isinstance(value, bool):
+ value = field.checkState() == QtCore.Qt.Checked
+ elif isinstance(value, Integral):
+ value = int(field.value())
+ elif isinstance(value, Real):
+ value = float(str(field.text()))
+ elif isinstance(value, datetime.datetime):
+ value = field.dateTime().toPyDateTime()
+ elif isinstance(value, datetime.date):
+ value = field.date().toPyDate()
+ else:
+ value = eval(str(field.text()))
+ valuelist.append(value)
+ return valuelist
+
+
+class FormComboWidget(QtWidgets.QWidget):
+ update_buttons = QtCore.Signal()
+
+ def __init__(self, datalist, comment="", parent=None):
+ super().__init__(parent)
+ layout = QtWidgets.QVBoxLayout()
+ self.setLayout(layout)
+ self.combobox = QtWidgets.QComboBox()
+ layout.addWidget(self.combobox)
+
+ self.stackwidget = QtWidgets.QStackedWidget(self)
+ layout.addWidget(self.stackwidget)
+ self.combobox.currentIndexChanged.connect(
+ self.stackwidget.setCurrentIndex)
+
+ self.widgetlist = []
+ for data, title, comment in datalist:
+ self.combobox.addItem(title)
+ widget = FormWidget(data, comment=comment, parent=self)
+ self.stackwidget.addWidget(widget)
+ self.widgetlist.append(widget)
+
+ def setup(self):
+ for widget in self.widgetlist:
+ widget.setup()
+
+ def get(self):
+ return [widget.get() for widget in self.widgetlist]
+
+
+class FormTabWidget(QtWidgets.QWidget):
+ update_buttons = QtCore.Signal()
+
+ def __init__(self, datalist, comment="", parent=None):
+ super().__init__(parent)
+ layout = QtWidgets.QVBoxLayout()
+ self.tabwidget = QtWidgets.QTabWidget()
+ layout.addWidget(self.tabwidget)
+ layout.setContentsMargins(0, 0, 0, 0)
+ self.setLayout(layout)
+ self.widgetlist = []
+ for data, title, comment in datalist:
+ if len(data[0]) == 3:
+ widget = FormComboWidget(data, comment=comment, parent=self)
+ else:
+ widget = FormWidget(data, with_margin=True, comment=comment,
+ parent=self)
+ index = self.tabwidget.addTab(widget, title)
+ self.tabwidget.setTabToolTip(index, comment)
+ self.widgetlist.append(widget)
+
+ def setup(self):
+ for widget in self.widgetlist:
+ widget.setup()
+
+ def get(self):
+ return [widget.get() for widget in self.widgetlist]
+
+
+class FormDialog(QtWidgets.QDialog):
+ """Form Dialog"""
+ def __init__(self, data, title="", comment="",
+ icon=None, parent=None, apply=None):
+ super().__init__(parent)
+
+ self.apply_callback = apply
+
+ # Form
+ if isinstance(data[0][0], (list, tuple)):
+ self.formwidget = FormTabWidget(data, comment=comment,
+ parent=self)
+ elif len(data[0]) == 3:
+ self.formwidget = FormComboWidget(data, comment=comment,
+ parent=self)
+ else:
+ self.formwidget = FormWidget(data, comment=comment,
+ parent=self)
+ layout = QtWidgets.QVBoxLayout()
+ layout.addWidget(self.formwidget)
+
+ self.float_fields = []
+ self.formwidget.setup()
+
+ # Button box
+ self.bbox = bbox = QtWidgets.QDialogButtonBox(
+ QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
+ self.formwidget.update_buttons.connect(self.update_buttons)
+ if self.apply_callback is not None:
+ apply_btn = bbox.addButton(QtWidgets.QDialogButtonBox.Apply)
+ apply_btn.clicked.connect(self.apply)
+
+ bbox.accepted.connect(self.accept)
+ bbox.rejected.connect(self.reject)
+ layout.addWidget(bbox)
+
+ self.setLayout(layout)
+
+ self.setWindowTitle(title)
+ if not isinstance(icon, QtGui.QIcon):
+ icon = QtWidgets.QWidget().style().standardIcon(
+ QtWidgets.QStyle.SP_MessageBoxQuestion)
+ self.setWindowIcon(icon)
+
+ def register_float_field(self, field):
+ self.float_fields.append(field)
+
+ def update_buttons(self):
+ valid = True
+ for field in self.float_fields:
+ if not is_edit_valid(field):
+ valid = False
+ for btn_type in (QtWidgets.QDialogButtonBox.Ok,
+ QtWidgets.QDialogButtonBox.Apply):
+ btn = self.bbox.button(btn_type)
+ if btn is not None:
+ btn.setEnabled(valid)
+
+ def accept(self):
+ self.data = self.formwidget.get()
+ super().accept()
+
+ def reject(self):
+ self.data = None
+ super().reject()
+
+ def apply(self):
+ self.apply_callback(self.formwidget.get())
+
+ def get(self):
+ """Return form result"""
+ return self.data
+
+
+def fedit(data, title="", comment="", icon=None, parent=None, apply=None):
+ """
+ Create form dialog and return result
+ (if Cancel button is pressed, return None)
+
+ data: datalist, datagroup
+ title: str
+ comment: str
+ icon: QIcon instance
+ parent: parent QWidget
+ apply: apply callback (function)
+
+ datalist: list/tuple of (field_name, field_value)
+ datagroup: list/tuple of (datalist *or* datagroup, title, comment)
+
+ -> one field for each member of a datalist
+ -> one tab for each member of a top-level datagroup
+ -> one page (of a multipage widget, each page can be selected with a combo
+ box) for each member of a datagroup inside a datagroup
+
+ Supported types for field_value:
+ - int, float, str, unicode, bool
+ - colors: in Qt-compatible text form, i.e. in hex format or name
+ (red, ...) (automatically detected from a string)
+ - list/tuple:
+ * the first element will be the selected index (or value)
+ * the other elements can be couples (key, value) or only values
+ """
+
+ # Create a QApplication instance if no instance currently exists
+ # (e.g., if the module is used directly from the interpreter)
+ if QtWidgets.QApplication.startingUp():
+ _app = QtWidgets.QApplication([])
+ dialog = FormDialog(data, title, comment, icon, parent, apply)
+ if dialog.exec_():
+ return dialog.get()
+
+
+if __name__ == "__main__":
+
+ def create_datalist_example():
+ return [('str', 'this is a string'),
+ ('list', [0, '1', '3', '4']),
+ ('list2', ['--', ('none', 'None'), ('--', 'Dashed'),
+ ('-.', 'DashDot'), ('-', 'Solid'),
+ ('steps', 'Steps'), (':', 'Dotted')]),
+ ('float', 1.2),
+ (None, 'Other:'),
+ ('int', 12),
+ ('font', ('Arial', 10, False, True)),
+ ('color', '#123409'),
+ ('bool', True),
+ ('date', datetime.date(2010, 10, 10)),
+ ('datetime', datetime.datetime(2010, 10, 10)),
+ ]
+
+ def create_datagroup_example():
+ datalist = create_datalist_example()
+ return ((datalist, "Category 1", "Category 1 comment"),
+ (datalist, "Category 2", "Category 2 comment"),
+ (datalist, "Category 3", "Category 3 comment"))
+
+ #--------- datalist example
+ datalist = create_datalist_example()
+
+ def apply_test(data):
+ print("data:", data)
+ print("result:", fedit(datalist, title="Example",
+ comment="This is just an example .",
+ apply=apply_test))
+
+ #--------- datagroup example
+ datagroup = create_datagroup_example()
+ print("result:", fedit(datagroup, "Global title"))
+
+ #--------- datagroup inside a datagroup example
+ datalist = create_datalist_example()
+ datagroup = create_datagroup_example()
+ print("result:", fedit(((datagroup, "Title 1", "Tab 1 comment"),
+ (datalist, "Title 2", "Tab 2 comment"),
+ (datalist, "Title 3", "Tab 3 comment")),
+ "Global title"))
diff --git a/venv/Lib/site-packages/matplotlib/backends/qt_editor/_formsubplottool.py b/venv/Lib/site-packages/matplotlib/backends/qt_editor/_formsubplottool.py
new file mode 100644
index 0000000..d8d0af0
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/qt_editor/_formsubplottool.py
@@ -0,0 +1,40 @@
+from matplotlib.backends.qt_compat import QtWidgets
+
+
+class UiSubplotTool(QtWidgets.QDialog):
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.setObjectName("SubplotTool")
+ self._widgets = {}
+
+ main_layout = QtWidgets.QHBoxLayout()
+ self.setLayout(main_layout)
+
+ for group, spinboxes, buttons in [
+ ("Borders",
+ ["top", "bottom", "left", "right"], ["Export values"]),
+ ("Spacings",
+ ["hspace", "wspace"], ["Tight layout", "Reset", "Close"]),
+ ]:
+ layout = QtWidgets.QVBoxLayout()
+ main_layout.addLayout(layout)
+ box = QtWidgets.QGroupBox(group)
+ layout.addWidget(box)
+ inner = QtWidgets.QFormLayout(box)
+ for name in spinboxes:
+ self._widgets[name] = widget = QtWidgets.QDoubleSpinBox()
+ widget.setMinimum(0)
+ widget.setMaximum(1)
+ widget.setDecimals(3)
+ widget.setSingleStep(0.005)
+ widget.setKeyboardTracking(False)
+ inner.addRow(name, widget)
+ layout.addStretch(1)
+ for name in buttons:
+ self._widgets[name] = widget = QtWidgets.QPushButton(name)
+ # Don't trigger on , which is used to input values.
+ widget.setAutoDefault(False)
+ layout.addWidget(widget)
+
+ self._widgets["Close"].setFocus()
diff --git a/venv/Lib/site-packages/matplotlib/backends/qt_editor/figureoptions.py b/venv/Lib/site-packages/matplotlib/backends/qt_editor/figureoptions.py
new file mode 100644
index 0000000..98cf3c6
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/qt_editor/figureoptions.py
@@ -0,0 +1,260 @@
+# Copyright © 2009 Pierre Raybaut
+# Licensed under the terms of the MIT License
+# see the Matplotlib licenses directory for a copy of the license
+
+
+"""Module that provides a GUI-based editor for Matplotlib's figure options."""
+
+import re
+
+from matplotlib import cbook, cm, colors as mcolors, markers, image as mimage
+from matplotlib.backends.qt_compat import QtGui
+from matplotlib.backends.qt_editor import _formlayout
+
+
+LINESTYLES = {'-': 'Solid',
+ '--': 'Dashed',
+ '-.': 'DashDot',
+ ':': 'Dotted',
+ 'None': 'None',
+ }
+
+DRAWSTYLES = {
+ 'default': 'Default',
+ 'steps-pre': 'Steps (Pre)', 'steps': 'Steps (Pre)',
+ 'steps-mid': 'Steps (Mid)',
+ 'steps-post': 'Steps (Post)'}
+
+MARKERS = markers.MarkerStyle.markers
+
+
+def figure_edit(axes, parent=None):
+ """Edit matplotlib figure options"""
+ sep = (None, None) # separator
+
+ # Get / General
+ # Cast to builtin floats as they have nicer reprs.
+ xmin, xmax = map(float, axes.get_xlim())
+ ymin, ymax = map(float, axes.get_ylim())
+ general = [('Title', axes.get_title()),
+ sep,
+ (None, "X-Axis "),
+ ('Left', xmin), ('Right', xmax),
+ ('Label', axes.get_xlabel()),
+ ('Scale', [axes.get_xscale(), 'linear', 'log', 'logit']),
+ sep,
+ (None, "Y-Axis "),
+ ('Bottom', ymin), ('Top', ymax),
+ ('Label', axes.get_ylabel()),
+ ('Scale', [axes.get_yscale(), 'linear', 'log', 'logit']),
+ sep,
+ ('(Re-)Generate automatic legend', False),
+ ]
+
+ # Save the unit data
+ xconverter = axes.xaxis.converter
+ yconverter = axes.yaxis.converter
+ xunits = axes.xaxis.get_units()
+ yunits = axes.yaxis.get_units()
+
+ # Sorting for default labels (_lineXXX, _imageXXX).
+ def cmp_key(label):
+ match = re.match(r"(_line|_image)(\d+)", label)
+ if match:
+ return match.group(1), int(match.group(2))
+ else:
+ return label, 0
+
+ # Get / Curves
+ linedict = {}
+ for line in axes.get_lines():
+ label = line.get_label()
+ if label == '_nolegend_':
+ continue
+ linedict[label] = line
+ curves = []
+
+ def prepare_data(d, init):
+ """
+ Prepare entry for FormLayout.
+
+ *d* is a mapping of shorthands to style names (a single style may
+ have multiple shorthands, in particular the shorthands `None`,
+ `"None"`, `"none"` and `""` are synonyms); *init* is one shorthand
+ of the initial style.
+
+ This function returns an list suitable for initializing a
+ FormLayout combobox, namely `[initial_name, (shorthand,
+ style_name), (shorthand, style_name), ...]`.
+ """
+ if init not in d:
+ d = {**d, init: str(init)}
+ # Drop duplicate shorthands from dict (by overwriting them during
+ # the dict comprehension).
+ name2short = {name: short for short, name in d.items()}
+ # Convert back to {shorthand: name}.
+ short2name = {short: name for name, short in name2short.items()}
+ # Find the kept shorthand for the style specified by init.
+ canonical_init = name2short[d[init]]
+ # Sort by representation and prepend the initial value.
+ return ([canonical_init] +
+ sorted(short2name.items(),
+ key=lambda short_and_name: short_and_name[1]))
+
+ curvelabels = sorted(linedict, key=cmp_key)
+ for label in curvelabels:
+ line = linedict[label]
+ color = mcolors.to_hex(
+ mcolors.to_rgba(line.get_color(), line.get_alpha()),
+ keep_alpha=True)
+ ec = mcolors.to_hex(
+ mcolors.to_rgba(line.get_markeredgecolor(), line.get_alpha()),
+ keep_alpha=True)
+ fc = mcolors.to_hex(
+ mcolors.to_rgba(line.get_markerfacecolor(), line.get_alpha()),
+ keep_alpha=True)
+ curvedata = [
+ ('Label', label),
+ sep,
+ (None, 'Line '),
+ ('Line style', prepare_data(LINESTYLES, line.get_linestyle())),
+ ('Draw style', prepare_data(DRAWSTYLES, line.get_drawstyle())),
+ ('Width', line.get_linewidth()),
+ ('Color (RGBA)', color),
+ sep,
+ (None, 'Marker '),
+ ('Style', prepare_data(MARKERS, line.get_marker())),
+ ('Size', line.get_markersize()),
+ ('Face color (RGBA)', fc),
+ ('Edge color (RGBA)', ec)]
+ curves.append([curvedata, label, ""])
+ # Is there a curve displayed?
+ has_curve = bool(curves)
+
+ # Get ScalarMappables.
+ mappabledict = {}
+ for mappable in [*axes.images, *axes.collections]:
+ label = mappable.get_label()
+ if label == '_nolegend_' or mappable.get_array() is None:
+ continue
+ mappabledict[label] = mappable
+ mappablelabels = sorted(mappabledict, key=cmp_key)
+ mappables = []
+ cmaps = [(cmap, name) for name, cmap in sorted(cm._cmap_registry.items())]
+ for label in mappablelabels:
+ mappable = mappabledict[label]
+ cmap = mappable.get_cmap()
+ if cmap not in cm._cmap_registry.values():
+ cmaps = [(cmap, cmap.name), *cmaps]
+ low, high = mappable.get_clim()
+ mappabledata = [
+ ('Label', label),
+ ('Colormap', [cmap.name] + cmaps),
+ ('Min. value', low),
+ ('Max. value', high),
+ ]
+ if hasattr(mappable, "get_interpolation"): # Images.
+ interpolations = [
+ (name, name) for name in sorted(mimage.interpolations_names)]
+ mappabledata.append((
+ 'Interpolation',
+ [mappable.get_interpolation(), *interpolations]))
+ mappables.append([mappabledata, label, ""])
+ # Is there a scalarmappable displayed?
+ has_sm = bool(mappables)
+
+ datalist = [(general, "Axes", "")]
+ if curves:
+ datalist.append((curves, "Curves", ""))
+ if mappables:
+ datalist.append((mappables, "Images, etc.", ""))
+
+ def apply_callback(data):
+ """A callback to apply changes."""
+ orig_xlim = axes.get_xlim()
+ orig_ylim = axes.get_ylim()
+
+ general = data.pop(0)
+ curves = data.pop(0) if has_curve else []
+ mappables = data.pop(0) if has_sm else []
+ if data:
+ raise ValueError("Unexpected field")
+
+ # Set / General
+ (title, xmin, xmax, xlabel, xscale, ymin, ymax, ylabel, yscale,
+ generate_legend) = general
+
+ if axes.get_xscale() != xscale:
+ axes.set_xscale(xscale)
+ if axes.get_yscale() != yscale:
+ axes.set_yscale(yscale)
+
+ axes.set_title(title)
+ axes.set_xlim(xmin, xmax)
+ axes.set_xlabel(xlabel)
+ axes.set_ylim(ymin, ymax)
+ axes.set_ylabel(ylabel)
+
+ # Restore the unit data
+ axes.xaxis.converter = xconverter
+ axes.yaxis.converter = yconverter
+ axes.xaxis.set_units(xunits)
+ axes.yaxis.set_units(yunits)
+ axes.xaxis._update_axisinfo()
+ axes.yaxis._update_axisinfo()
+
+ # Set / Curves
+ for index, curve in enumerate(curves):
+ line = linedict[curvelabels[index]]
+ (label, linestyle, drawstyle, linewidth, color, marker, markersize,
+ markerfacecolor, markeredgecolor) = curve
+ line.set_label(label)
+ line.set_linestyle(linestyle)
+ line.set_drawstyle(drawstyle)
+ line.set_linewidth(linewidth)
+ rgba = mcolors.to_rgba(color)
+ line.set_alpha(None)
+ line.set_color(rgba)
+ if marker != 'none':
+ line.set_marker(marker)
+ line.set_markersize(markersize)
+ line.set_markerfacecolor(markerfacecolor)
+ line.set_markeredgecolor(markeredgecolor)
+
+ # Set ScalarMappables.
+ for index, mappable_settings in enumerate(mappables):
+ mappable = mappabledict[mappablelabels[index]]
+ if len(mappable_settings) == 5:
+ label, cmap, low, high, interpolation = mappable_settings
+ mappable.set_interpolation(interpolation)
+ elif len(mappable_settings) == 4:
+ label, cmap, low, high = mappable_settings
+ mappable.set_label(label)
+ mappable.set_cmap(cm.get_cmap(cmap))
+ mappable.set_clim(*sorted([low, high]))
+
+ # re-generate legend, if checkbox is checked
+ if generate_legend:
+ draggable = None
+ ncol = 1
+ if axes.legend_ is not None:
+ old_legend = axes.get_legend()
+ draggable = old_legend._draggable is not None
+ ncol = old_legend._ncol
+ new_legend = axes.legend(ncol=ncol)
+ if new_legend:
+ new_legend.set_draggable(draggable)
+
+ # Redraw
+ figure = axes.get_figure()
+ figure.canvas.draw()
+ if not (axes.get_xlim() == orig_xlim and axes.get_ylim() == orig_ylim):
+ figure.canvas.toolbar.push_current()
+
+ data = _formlayout.fedit(
+ datalist, title="Figure options", parent=parent,
+ icon=QtGui.QIcon(
+ str(cbook._get_data_path('images', 'qt4_editor_options.svg'))),
+ apply=apply_callback)
+ if data is not None:
+ apply_callback(data)
diff --git a/venv/Lib/site-packages/matplotlib/backends/qt_editor/formsubplottool.py b/venv/Lib/site-packages/matplotlib/backends/qt_editor/formsubplottool.py
new file mode 100644
index 0000000..db79a3a
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/qt_editor/formsubplottool.py
@@ -0,0 +1,8 @@
+from matplotlib import _api
+from ._formsubplottool import UiSubplotTool
+
+
+_api.warn_deprecated(
+ "3.3", obj_type="module", name=__name__,
+ alternative="matplotlib.backends.backend_qt5.SubplotToolQt")
+__all__ = ["UiSubplotTool"]
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/.eslintrc.js b/venv/Lib/site-packages/matplotlib/backends/web_backend/.eslintrc.js
new file mode 100644
index 0000000..6f3581a
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/.eslintrc.js
@@ -0,0 +1,32 @@
+module.exports = {
+ root: true,
+ ignorePatterns: ["jquery-ui-*/", "node_modules/"],
+ env: {
+ browser: true,
+ jquery: true,
+ },
+ extends: ["eslint:recommended", "prettier"],
+ globals: {
+ IPython: "readonly",
+ MozWebSocket: "readonly",
+ },
+ rules: {
+ indent: ["error", 2, { SwitchCase: 1 }],
+ "no-unused-vars": [
+ "error",
+ {
+ argsIgnorePattern: "^_",
+ },
+ ],
+ quotes: ["error", "double", { avoidEscape: true }],
+ },
+ overrides: [
+ {
+ files: "js/**/*.js",
+ rules: {
+ indent: ["error", 4, { SwitchCase: 1 }],
+ quotes: ["error", "single", { avoidEscape: true }],
+ },
+ },
+ ],
+};
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/.prettierignore b/venv/Lib/site-packages/matplotlib/backends/web_backend/.prettierignore
new file mode 100644
index 0000000..06a29c6
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/.prettierignore
@@ -0,0 +1,7 @@
+node_modules/
+
+# Vendored dependencies
+css/boilerplate.css
+css/fbm.css
+css/page.css
+jquery-ui-*/
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/.prettierrc b/venv/Lib/site-packages/matplotlib/backends/web_backend/.prettierrc
new file mode 100644
index 0000000..fe8d711
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/.prettierrc
@@ -0,0 +1,11 @@
+{
+ "overrides": [
+ {
+ "files": "js/**/*.js",
+ "options": {
+ "singleQuote": true,
+ "tabWidth": 4,
+ }
+ }
+ ]
+}
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/all_figures.html b/venv/Lib/site-packages/matplotlib/backends/web_backend/all_figures.html
new file mode 100644
index 0000000..c29ee55
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/all_figures.html
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+ MPL | WebAgg current figures
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/css/boilerplate.css b/venv/Lib/site-packages/matplotlib/backends/web_backend/css/boilerplate.css
new file mode 100644
index 0000000..2b1535f
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/css/boilerplate.css
@@ -0,0 +1,77 @@
+/**
+ * HTML5 ✰ Boilerplate
+ *
+ * style.css contains a reset, font normalization and some base styles.
+ *
+ * Credit is left where credit is due.
+ * Much inspiration was taken from these projects:
+ * - yui.yahooapis.com/2.8.1/build/base/base.css
+ * - camendesign.com/design/
+ * - praegnanz.de/weblog/htmlcssjs-kickstart
+ */
+
+
+/**
+ * html5doctor.com Reset Stylesheet (Eric Meyer's Reset Reloaded + HTML5 baseline)
+ * v1.6.1 2010-09-17 | Authors: Eric Meyer & Richard Clark
+ * html5doctor.com/html-5-reset-stylesheet/
+ */
+
+html, body, div, span, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp,
+small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td,
+article, aside, canvas, details, figcaption, figure,
+footer, header, hgroup, menu, nav, section, summary,
+time, mark, audio, video {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
+}
+
+sup { vertical-align: super; }
+sub { vertical-align: sub; }
+
+article, aside, details, figcaption, figure,
+footer, header, hgroup, menu, nav, section {
+ display: block;
+}
+
+blockquote, q { quotes: none; }
+
+blockquote:before, blockquote:after,
+q:before, q:after { content: ""; content: none; }
+
+ins { background-color: #ff9; color: #000; text-decoration: none; }
+
+mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; }
+
+del { text-decoration: line-through; }
+
+abbr[title], dfn[title] { border-bottom: 1px dotted; cursor: help; }
+
+table { border-collapse: collapse; border-spacing: 0; }
+
+hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
+
+input, select { vertical-align: middle; }
+
+
+/**
+ * Font normalization inspired by YUI Library's fonts.css: developer.yahoo.com/yui/
+ */
+
+body { font:13px/1.231 sans-serif; *font-size:small; } /* Hack retained to preserve specificity */
+select, input, textarea, button { font:99% sans-serif; }
+
+/* Normalize monospace sizing:
+ en.wikipedia.org/wiki/MediaWiki_talk:Common.css/Archive_11#Teletype_style_fix_for_Chrome */
+pre, code, kbd, samp { font-family: monospace, sans-serif; }
+
+em,i { font-style: italic; }
+b,strong { font-weight: bold; }
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/css/fbm.css b/venv/Lib/site-packages/matplotlib/backends/web_backend/css/fbm.css
new file mode 100644
index 0000000..0e21d19
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/css/fbm.css
@@ -0,0 +1,97 @@
+
+/* Flexible box model classes */
+/* Taken from Alex Russell http://infrequently.org/2009/08/css-3-progress/ */
+
+.hbox {
+ display: -webkit-box;
+ -webkit-box-orient: horizontal;
+ -webkit-box-align: stretch;
+
+ display: -moz-box;
+ -moz-box-orient: horizontal;
+ -moz-box-align: stretch;
+
+ display: box;
+ box-orient: horizontal;
+ box-align: stretch;
+}
+
+.hbox > * {
+ -webkit-box-flex: 0;
+ -moz-box-flex: 0;
+ box-flex: 0;
+}
+
+.vbox {
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-box-align: stretch;
+
+ display: -moz-box;
+ -moz-box-orient: vertical;
+ -moz-box-align: stretch;
+
+ display: box;
+ box-orient: vertical;
+ box-align: stretch;
+}
+
+.vbox > * {
+ -webkit-box-flex: 0;
+ -moz-box-flex: 0;
+ box-flex: 0;
+}
+
+.reverse {
+ -webkit-box-direction: reverse;
+ -moz-box-direction: reverse;
+ box-direction: reverse;
+}
+
+.box-flex0 {
+ -webkit-box-flex: 0;
+ -moz-box-flex: 0;
+ box-flex: 0;
+}
+
+.box-flex1, .box-flex {
+ -webkit-box-flex: 1;
+ -moz-box-flex: 1;
+ box-flex: 1;
+}
+
+.box-flex2 {
+ -webkit-box-flex: 2;
+ -moz-box-flex: 2;
+ box-flex: 2;
+}
+
+.box-group1 {
+ -webkit-box-flex-group: 1;
+ -moz-box-flex-group: 1;
+ box-flex-group: 1;
+}
+
+.box-group2 {
+ -webkit-box-flex-group: 2;
+ -moz-box-flex-group: 2;
+ box-flex-group: 2;
+}
+
+.start {
+ -webkit-box-pack: start;
+ -moz-box-pack: start;
+ box-pack: start;
+}
+
+.end {
+ -webkit-box-pack: end;
+ -moz-box-pack: end;
+ box-pack: end;
+}
+
+.center {
+ -webkit-box-pack: center;
+ -moz-box-pack: center;
+ box-pack: center;
+}
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/css/mpl.css b/venv/Lib/site-packages/matplotlib/backends/web_backend/css/mpl.css
new file mode 100644
index 0000000..e55733d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/css/mpl.css
@@ -0,0 +1,84 @@
+/* General styling */
+.ui-helper-clearfix:before,
+.ui-helper-clearfix:after {
+ content: "";
+ display: table;
+ border-collapse: collapse;
+}
+.ui-helper-clearfix:after {
+ clear: both;
+}
+
+/* Header */
+.ui-widget-header {
+ border: 1px solid #dddddd;
+ border-top-left-radius: 6px;
+ border-top-right-radius: 6px;
+ background: #e9e9e9;
+ color: #333333;
+ font-weight: bold;
+}
+
+/* Toolbar and items */
+.mpl-toolbar {
+ width: 100%;
+}
+
+.mpl-toolbar div.mpl-button-group {
+ display: inline-block;
+}
+
+.mpl-button-group + .mpl-button-group {
+ margin-left: 0.5em;
+}
+
+.mpl-widget {
+ background-color: #fff;
+ border: 1px solid #ccc;
+ display: inline-block;
+ cursor: pointer;
+ color: #333;
+ padding: 6px;
+ vertical-align: middle;
+}
+
+.mpl-widget:disabled,
+.mpl-widget[disabled] {
+ background-color: #ddd;
+ border-color: #ddd !important;
+ cursor: not-allowed;
+}
+
+.mpl-widget:disabled img,
+.mpl-widget[disabled] img {
+ /* Convert black to grey */
+ filter: contrast(0%);
+}
+
+.mpl-widget.active img {
+ /* Convert black to tab:blue, approximately */
+ filter: invert(34%) sepia(97%) saturate(468%) hue-rotate(162deg) brightness(96%) contrast(91%);
+}
+
+button.mpl-widget:focus,
+button.mpl-widget:hover {
+ background-color: #ddd;
+ border-color: #aaa;
+}
+
+.mpl-button-group button.mpl-widget {
+ margin-left: -1px;
+}
+.mpl-button-group button.mpl-widget:first-child {
+ border-top-left-radius: 6px;
+ border-bottom-left-radius: 6px;
+ margin-left: 0px;
+}
+.mpl-button-group button.mpl-widget:last-child {
+ border-top-right-radius: 6px;
+ border-bottom-right-radius: 6px;
+}
+
+select.mpl-widget {
+ cursor: default;
+}
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/css/page.css b/venv/Lib/site-packages/matplotlib/backends/web_backend/css/page.css
new file mode 100644
index 0000000..c380ef0
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/css/page.css
@@ -0,0 +1,83 @@
+/**
+ * Primary styles
+ *
+ * Author: IPython Development Team
+ */
+
+
+body {
+ background-color: white;
+ /* This makes sure that the body covers the entire window and needs to
+ be in a different element than the display: box in wrapper below */
+ position: absolute;
+ left: 0px;
+ right: 0px;
+ top: 0px;
+ bottom: 0px;
+ overflow: visible;
+}
+
+
+div#header {
+ /* Initially hidden to prevent FLOUC */
+ display: none;
+ position: relative;
+ height: 40px;
+ padding: 5px;
+ margin: 0px;
+ width: 100%;
+}
+
+span#ipython_notebook {
+ position: absolute;
+ padding: 2px 2px 2px 5px;
+}
+
+span#ipython_notebook img {
+ font-family: Verdana, "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
+ height: 24px;
+ text-decoration:none;
+ display: inline;
+ color: black;
+}
+
+#site {
+ width: 100%;
+ display: none;
+}
+
+/* We set the fonts by hand here to override the values in the theme */
+.ui-widget {
+ font-family: "Lucinda Grande", "Lucinda Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
+}
+
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button {
+ font-family: "Lucinda Grande", "Lucinda Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
+}
+
+/* Smaller buttons */
+.ui-button .ui-button-text {
+ padding: 0.2em 0.8em;
+ font-size: 77%;
+}
+
+input.ui-button {
+ padding: 0.3em 0.9em;
+}
+
+span#login_widget {
+ float: right;
+}
+
+.border-box-sizing {
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+}
+
+#figure-div {
+ display: inline-block;
+ margin: 10px;
+ vertical-align: top;
+}
+
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/ipython_inline_figure.html b/venv/Lib/site-packages/matplotlib/backends/web_backend/ipython_inline_figure.html
new file mode 100644
index 0000000..9cc6aa9
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/ipython_inline_figure.html
@@ -0,0 +1,34 @@
+
+
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/js/mpl.js b/venv/Lib/site-packages/matplotlib/backends/web_backend/js/mpl.js
new file mode 100644
index 0000000..4adeb98
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/js/mpl.js
@@ -0,0 +1,688 @@
+/* Put everything inside the global mpl namespace */
+/* global mpl */
+window.mpl = {};
+
+mpl.get_websocket_type = function () {
+ if (typeof WebSocket !== 'undefined') {
+ return WebSocket;
+ } else if (typeof MozWebSocket !== 'undefined') {
+ return MozWebSocket;
+ } else {
+ alert(
+ 'Your browser does not have WebSocket support. ' +
+ 'Please try Chrome, Safari or Firefox ≥ 6. ' +
+ 'Firefox 4 and 5 are also supported but you ' +
+ 'have to enable WebSockets in about:config.'
+ );
+ }
+};
+
+mpl.figure = function (figure_id, websocket, ondownload, parent_element) {
+ this.id = figure_id;
+
+ this.ws = websocket;
+
+ this.supports_binary = this.ws.binaryType !== undefined;
+
+ if (!this.supports_binary) {
+ var warnings = document.getElementById('mpl-warnings');
+ if (warnings) {
+ warnings.style.display = 'block';
+ warnings.textContent =
+ 'This browser does not support binary websocket messages. ' +
+ 'Performance may be slow.';
+ }
+ }
+
+ this.imageObj = new Image();
+
+ this.context = undefined;
+ this.message = undefined;
+ this.canvas = undefined;
+ this.rubberband_canvas = undefined;
+ this.rubberband_context = undefined;
+ this.format_dropdown = undefined;
+
+ this.image_mode = 'full';
+
+ this.root = document.createElement('div');
+ this.root.setAttribute('style', 'display: inline-block');
+ this._root_extra_style(this.root);
+
+ parent_element.appendChild(this.root);
+
+ this._init_header(this);
+ this._init_canvas(this);
+ this._init_toolbar(this);
+
+ var fig = this;
+
+ this.waiting = false;
+
+ this.ws.onopen = function () {
+ fig.send_message('supports_binary', { value: fig.supports_binary });
+ fig.send_message('send_image_mode', {});
+ if (fig.ratio !== 1) {
+ fig.send_message('set_dpi_ratio', { dpi_ratio: fig.ratio });
+ }
+ fig.send_message('refresh', {});
+ };
+
+ this.imageObj.onload = function () {
+ if (fig.image_mode === 'full') {
+ // Full images could contain transparency (where diff images
+ // almost always do), so we need to clear the canvas so that
+ // there is no ghosting.
+ fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);
+ }
+ fig.context.drawImage(fig.imageObj, 0, 0);
+ };
+
+ this.imageObj.onunload = function () {
+ fig.ws.close();
+ };
+
+ this.ws.onmessage = this._make_on_message_function(this);
+
+ this.ondownload = ondownload;
+};
+
+mpl.figure.prototype._init_header = function () {
+ var titlebar = document.createElement('div');
+ titlebar.classList =
+ 'ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix';
+ var titletext = document.createElement('div');
+ titletext.classList = 'ui-dialog-title';
+ titletext.setAttribute(
+ 'style',
+ 'width: 100%; text-align: center; padding: 3px;'
+ );
+ titlebar.appendChild(titletext);
+ this.root.appendChild(titlebar);
+ this.header = titletext;
+};
+
+mpl.figure.prototype._canvas_extra_style = function (_canvas_div) {};
+
+mpl.figure.prototype._root_extra_style = function (_canvas_div) {};
+
+mpl.figure.prototype._init_canvas = function () {
+ var fig = this;
+
+ var canvas_div = (this.canvas_div = document.createElement('div'));
+ canvas_div.setAttribute(
+ 'style',
+ 'border: 1px solid #ddd;' +
+ 'box-sizing: content-box;' +
+ 'clear: both;' +
+ 'min-height: 1px;' +
+ 'min-width: 1px;' +
+ 'outline: 0;' +
+ 'overflow: hidden;' +
+ 'position: relative;' +
+ 'resize: both;'
+ );
+
+ function on_keyboard_event_closure(name) {
+ return function (event) {
+ return fig.key_event(event, name);
+ };
+ }
+
+ canvas_div.addEventListener(
+ 'keydown',
+ on_keyboard_event_closure('key_press')
+ );
+ canvas_div.addEventListener(
+ 'keyup',
+ on_keyboard_event_closure('key_release')
+ );
+
+ this._canvas_extra_style(canvas_div);
+ this.root.appendChild(canvas_div);
+
+ var canvas = (this.canvas = document.createElement('canvas'));
+ canvas.classList.add('mpl-canvas');
+ canvas.setAttribute('style', 'box-sizing: content-box;');
+
+ this.context = canvas.getContext('2d');
+
+ var backingStore =
+ this.context.backingStorePixelRatio ||
+ this.context.webkitBackingStorePixelRatio ||
+ this.context.mozBackingStorePixelRatio ||
+ this.context.msBackingStorePixelRatio ||
+ this.context.oBackingStorePixelRatio ||
+ this.context.backingStorePixelRatio ||
+ 1;
+
+ this.ratio = (window.devicePixelRatio || 1) / backingStore;
+
+ var rubberband_canvas = (this.rubberband_canvas = document.createElement(
+ 'canvas'
+ ));
+ rubberband_canvas.setAttribute(
+ 'style',
+ 'box-sizing: content-box; position: absolute; left: 0; top: 0; z-index: 1;'
+ );
+
+ // Apply a ponyfill if ResizeObserver is not implemented by browser.
+ if (this.ResizeObserver === undefined) {
+ if (window.ResizeObserver !== undefined) {
+ this.ResizeObserver = window.ResizeObserver;
+ } else {
+ var obs = _JSXTOOLS_RESIZE_OBSERVER({});
+ this.ResizeObserver = obs.ResizeObserver;
+ }
+ }
+
+ this.resizeObserverInstance = new this.ResizeObserver(function (entries) {
+ var nentries = entries.length;
+ for (var i = 0; i < nentries; i++) {
+ var entry = entries[i];
+ var width, height;
+ if (entry.contentBoxSize) {
+ if (entry.contentBoxSize instanceof Array) {
+ // Chrome 84 implements new version of spec.
+ width = entry.contentBoxSize[0].inlineSize;
+ height = entry.contentBoxSize[0].blockSize;
+ } else {
+ // Firefox implements old version of spec.
+ width = entry.contentBoxSize.inlineSize;
+ height = entry.contentBoxSize.blockSize;
+ }
+ } else {
+ // Chrome <84 implements even older version of spec.
+ width = entry.contentRect.width;
+ height = entry.contentRect.height;
+ }
+
+ // Keep the size of the canvas and rubber band canvas in sync with
+ // the canvas container.
+ if (entry.devicePixelContentBoxSize) {
+ // Chrome 84 implements new version of spec.
+ canvas.setAttribute(
+ 'width',
+ entry.devicePixelContentBoxSize[0].inlineSize
+ );
+ canvas.setAttribute(
+ 'height',
+ entry.devicePixelContentBoxSize[0].blockSize
+ );
+ } else {
+ canvas.setAttribute('width', width * fig.ratio);
+ canvas.setAttribute('height', height * fig.ratio);
+ }
+ canvas.setAttribute(
+ 'style',
+ 'width: ' + width + 'px; height: ' + height + 'px;'
+ );
+
+ rubberband_canvas.setAttribute('width', width);
+ rubberband_canvas.setAttribute('height', height);
+
+ // And update the size in Python. We ignore the initial 0/0 size
+ // that occurs as the element is placed into the DOM, which should
+ // otherwise not happen due to the minimum size styling.
+ if (fig.ws.readyState == 1 && width != 0 && height != 0) {
+ fig.request_resize(width, height);
+ }
+ }
+ });
+ this.resizeObserverInstance.observe(canvas_div);
+
+ function on_mouse_event_closure(name) {
+ return function (event) {
+ return fig.mouse_event(event, name);
+ };
+ }
+
+ rubberband_canvas.addEventListener(
+ 'mousedown',
+ on_mouse_event_closure('button_press')
+ );
+ rubberband_canvas.addEventListener(
+ 'mouseup',
+ on_mouse_event_closure('button_release')
+ );
+ rubberband_canvas.addEventListener(
+ 'dblclick',
+ on_mouse_event_closure('dblclick')
+ );
+ // Throttle sequential mouse events to 1 every 20ms.
+ rubberband_canvas.addEventListener(
+ 'mousemove',
+ on_mouse_event_closure('motion_notify')
+ );
+
+ rubberband_canvas.addEventListener(
+ 'mouseenter',
+ on_mouse_event_closure('figure_enter')
+ );
+ rubberband_canvas.addEventListener(
+ 'mouseleave',
+ on_mouse_event_closure('figure_leave')
+ );
+
+ canvas_div.addEventListener('wheel', function (event) {
+ if (event.deltaY < 0) {
+ event.step = 1;
+ } else {
+ event.step = -1;
+ }
+ on_mouse_event_closure('scroll')(event);
+ });
+
+ canvas_div.appendChild(canvas);
+ canvas_div.appendChild(rubberband_canvas);
+
+ this.rubberband_context = rubberband_canvas.getContext('2d');
+ this.rubberband_context.strokeStyle = '#000000';
+
+ this._resize_canvas = function (width, height, forward) {
+ if (forward) {
+ canvas_div.style.width = width + 'px';
+ canvas_div.style.height = height + 'px';
+ }
+ };
+
+ // Disable right mouse context menu.
+ this.rubberband_canvas.addEventListener('contextmenu', function (_e) {
+ event.preventDefault();
+ return false;
+ });
+
+ function set_focus() {
+ canvas.focus();
+ canvas_div.focus();
+ }
+
+ window.setTimeout(set_focus, 100);
+};
+
+mpl.figure.prototype._init_toolbar = function () {
+ var fig = this;
+
+ var toolbar = document.createElement('div');
+ toolbar.classList = 'mpl-toolbar';
+ this.root.appendChild(toolbar);
+
+ function on_click_closure(name) {
+ return function (_event) {
+ return fig.toolbar_button_onclick(name);
+ };
+ }
+
+ function on_mouseover_closure(tooltip) {
+ return function (event) {
+ if (!event.currentTarget.disabled) {
+ return fig.toolbar_button_onmouseover(tooltip);
+ }
+ };
+ }
+
+ fig.buttons = {};
+ var buttonGroup = document.createElement('div');
+ buttonGroup.classList = 'mpl-button-group';
+ for (var toolbar_ind in mpl.toolbar_items) {
+ var name = mpl.toolbar_items[toolbar_ind][0];
+ var tooltip = mpl.toolbar_items[toolbar_ind][1];
+ var image = mpl.toolbar_items[toolbar_ind][2];
+ var method_name = mpl.toolbar_items[toolbar_ind][3];
+
+ if (!name) {
+ /* Instead of a spacer, we start a new button group. */
+ if (buttonGroup.hasChildNodes()) {
+ toolbar.appendChild(buttonGroup);
+ }
+ buttonGroup = document.createElement('div');
+ buttonGroup.classList = 'mpl-button-group';
+ continue;
+ }
+
+ var button = (fig.buttons[name] = document.createElement('button'));
+ button.classList = 'mpl-widget';
+ button.setAttribute('role', 'button');
+ button.setAttribute('aria-disabled', 'false');
+ button.addEventListener('click', on_click_closure(method_name));
+ button.addEventListener('mouseover', on_mouseover_closure(tooltip));
+
+ var icon_img = document.createElement('img');
+ icon_img.src = '_images/' + image + '.png';
+ icon_img.srcset = '_images/' + image + '_large.png 2x';
+ icon_img.alt = tooltip;
+ button.appendChild(icon_img);
+
+ buttonGroup.appendChild(button);
+ }
+
+ if (buttonGroup.hasChildNodes()) {
+ toolbar.appendChild(buttonGroup);
+ }
+
+ var fmt_picker = document.createElement('select');
+ fmt_picker.classList = 'mpl-widget';
+ toolbar.appendChild(fmt_picker);
+ this.format_dropdown = fmt_picker;
+
+ for (var ind in mpl.extensions) {
+ var fmt = mpl.extensions[ind];
+ var option = document.createElement('option');
+ option.selected = fmt === mpl.default_extension;
+ option.innerHTML = fmt;
+ fmt_picker.appendChild(option);
+ }
+
+ var status_bar = document.createElement('span');
+ status_bar.classList = 'mpl-message';
+ toolbar.appendChild(status_bar);
+ this.message = status_bar;
+};
+
+mpl.figure.prototype.request_resize = function (x_pixels, y_pixels) {
+ // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,
+ // which will in turn request a refresh of the image.
+ this.send_message('resize', { width: x_pixels, height: y_pixels });
+};
+
+mpl.figure.prototype.send_message = function (type, properties) {
+ properties['type'] = type;
+ properties['figure_id'] = this.id;
+ this.ws.send(JSON.stringify(properties));
+};
+
+mpl.figure.prototype.send_draw_message = function () {
+ if (!this.waiting) {
+ this.waiting = true;
+ this.ws.send(JSON.stringify({ type: 'draw', figure_id: this.id }));
+ }
+};
+
+mpl.figure.prototype.handle_save = function (fig, _msg) {
+ var format_dropdown = fig.format_dropdown;
+ var format = format_dropdown.options[format_dropdown.selectedIndex].value;
+ fig.ondownload(fig, format);
+};
+
+mpl.figure.prototype.handle_resize = function (fig, msg) {
+ var size = msg['size'];
+ if (size[0] !== fig.canvas.width || size[1] !== fig.canvas.height) {
+ fig._resize_canvas(size[0], size[1], msg['forward']);
+ fig.send_message('refresh', {});
+ }
+};
+
+mpl.figure.prototype.handle_rubberband = function (fig, msg) {
+ var x0 = msg['x0'] / fig.ratio;
+ var y0 = (fig.canvas.height - msg['y0']) / fig.ratio;
+ var x1 = msg['x1'] / fig.ratio;
+ var y1 = (fig.canvas.height - msg['y1']) / fig.ratio;
+ x0 = Math.floor(x0) + 0.5;
+ y0 = Math.floor(y0) + 0.5;
+ x1 = Math.floor(x1) + 0.5;
+ y1 = Math.floor(y1) + 0.5;
+ var min_x = Math.min(x0, x1);
+ var min_y = Math.min(y0, y1);
+ var width = Math.abs(x1 - x0);
+ var height = Math.abs(y1 - y0);
+
+ fig.rubberband_context.clearRect(
+ 0,
+ 0,
+ fig.canvas.width / fig.ratio,
+ fig.canvas.height / fig.ratio
+ );
+
+ fig.rubberband_context.strokeRect(min_x, min_y, width, height);
+};
+
+mpl.figure.prototype.handle_figure_label = function (fig, msg) {
+ // Updates the figure title.
+ fig.header.textContent = msg['label'];
+};
+
+mpl.figure.prototype.handle_cursor = function (fig, msg) {
+ var cursor = msg['cursor'];
+ switch (cursor) {
+ case 0:
+ cursor = 'pointer';
+ break;
+ case 1:
+ cursor = 'default';
+ break;
+ case 2:
+ cursor = 'crosshair';
+ break;
+ case 3:
+ cursor = 'move';
+ break;
+ }
+ fig.rubberband_canvas.style.cursor = cursor;
+};
+
+mpl.figure.prototype.handle_message = function (fig, msg) {
+ fig.message.textContent = msg['message'];
+};
+
+mpl.figure.prototype.handle_draw = function (fig, _msg) {
+ // Request the server to send over a new figure.
+ fig.send_draw_message();
+};
+
+mpl.figure.prototype.handle_image_mode = function (fig, msg) {
+ fig.image_mode = msg['mode'];
+};
+
+mpl.figure.prototype.handle_history_buttons = function (fig, msg) {
+ for (var key in msg) {
+ if (!(key in fig.buttons)) {
+ continue;
+ }
+ fig.buttons[key].disabled = !msg[key];
+ fig.buttons[key].setAttribute('aria-disabled', !msg[key]);
+ }
+};
+
+mpl.figure.prototype.handle_navigate_mode = function (fig, msg) {
+ if (msg['mode'] === 'PAN') {
+ fig.buttons['Pan'].classList.add('active');
+ fig.buttons['Zoom'].classList.remove('active');
+ } else if (msg['mode'] === 'ZOOM') {
+ fig.buttons['Pan'].classList.remove('active');
+ fig.buttons['Zoom'].classList.add('active');
+ } else {
+ fig.buttons['Pan'].classList.remove('active');
+ fig.buttons['Zoom'].classList.remove('active');
+ }
+};
+
+mpl.figure.prototype.updated_canvas_event = function () {
+ // Called whenever the canvas gets updated.
+ this.send_message('ack', {});
+};
+
+// A function to construct a web socket function for onmessage handling.
+// Called in the figure constructor.
+mpl.figure.prototype._make_on_message_function = function (fig) {
+ return function socket_on_message(evt) {
+ if (evt.data instanceof Blob) {
+ var img = evt.data;
+ if (img.type !== 'image/png') {
+ /* FIXME: We get "Resource interpreted as Image but
+ * transferred with MIME type text/plain:" errors on
+ * Chrome. But how to set the MIME type? It doesn't seem
+ * to be part of the websocket stream */
+ img.type = 'image/png';
+ }
+
+ /* Free the memory for the previous frames */
+ if (fig.imageObj.src) {
+ (window.URL || window.webkitURL).revokeObjectURL(
+ fig.imageObj.src
+ );
+ }
+
+ fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(
+ img
+ );
+ fig.updated_canvas_event();
+ fig.waiting = false;
+ return;
+ } else if (
+ typeof evt.data === 'string' &&
+ evt.data.slice(0, 21) === 'data:image/png;base64'
+ ) {
+ fig.imageObj.src = evt.data;
+ fig.updated_canvas_event();
+ fig.waiting = false;
+ return;
+ }
+
+ var msg = JSON.parse(evt.data);
+ var msg_type = msg['type'];
+
+ // Call the "handle_{type}" callback, which takes
+ // the figure and JSON message as its only arguments.
+ try {
+ var callback = fig['handle_' + msg_type];
+ } catch (e) {
+ console.log(
+ "No handler for the '" + msg_type + "' message type: ",
+ msg
+ );
+ return;
+ }
+
+ if (callback) {
+ try {
+ // console.log("Handling '" + msg_type + "' message: ", msg);
+ callback(fig, msg);
+ } catch (e) {
+ console.log(
+ "Exception inside the 'handler_" + msg_type + "' callback:",
+ e,
+ e.stack,
+ msg
+ );
+ }
+ }
+ };
+};
+
+// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas
+mpl.findpos = function (e) {
+ //this section is from http://www.quirksmode.org/js/events_properties.html
+ var targ;
+ if (!e) {
+ e = window.event;
+ }
+ if (e.target) {
+ targ = e.target;
+ } else if (e.srcElement) {
+ targ = e.srcElement;
+ }
+ if (targ.nodeType === 3) {
+ // defeat Safari bug
+ targ = targ.parentNode;
+ }
+
+ // pageX,Y are the mouse positions relative to the document
+ var boundingRect = targ.getBoundingClientRect();
+ var x = e.pageX - (boundingRect.left + document.body.scrollLeft);
+ var y = e.pageY - (boundingRect.top + document.body.scrollTop);
+
+ return { x: x, y: y };
+};
+
+/*
+ * return a copy of an object with only non-object keys
+ * we need this to avoid circular references
+ * http://stackoverflow.com/a/24161582/3208463
+ */
+function simpleKeys(original) {
+ return Object.keys(original).reduce(function (obj, key) {
+ if (typeof original[key] !== 'object') {
+ obj[key] = original[key];
+ }
+ return obj;
+ }, {});
+}
+
+mpl.figure.prototype.mouse_event = function (event, name) {
+ var canvas_pos = mpl.findpos(event);
+
+ if (name === 'button_press') {
+ this.canvas.focus();
+ this.canvas_div.focus();
+ }
+
+ var x = canvas_pos.x * this.ratio;
+ var y = canvas_pos.y * this.ratio;
+
+ this.send_message(name, {
+ x: x,
+ y: y,
+ button: event.button,
+ step: event.step,
+ guiEvent: simpleKeys(event),
+ });
+
+ /* This prevents the web browser from automatically changing to
+ * the text insertion cursor when the button is pressed. We want
+ * to control all of the cursor setting manually through the
+ * 'cursor' event from matplotlib */
+ event.preventDefault();
+ return false;
+};
+
+mpl.figure.prototype._key_event_extra = function (_event, _name) {
+ // Handle any extra behaviour associated with a key event
+};
+
+mpl.figure.prototype.key_event = function (event, name) {
+ // Prevent repeat events
+ if (name === 'key_press') {
+ if (event.key === this._key) {
+ return;
+ } else {
+ this._key = event.key;
+ }
+ }
+ if (name === 'key_release') {
+ this._key = null;
+ }
+
+ var value = '';
+ if (event.ctrlKey && event.key !== 'Control') {
+ value += 'ctrl+';
+ }
+ else if (event.altKey && event.key !== 'Alt') {
+ value += 'alt+';
+ }
+ else if (event.shiftKey && event.key !== 'Shift') {
+ value += 'shift+';
+ }
+
+ value += 'k' + event.key;
+
+ this._key_event_extra(event, name);
+
+ this.send_message(name, { key: value, guiEvent: simpleKeys(event) });
+ return false;
+};
+
+mpl.figure.prototype.toolbar_button_onclick = function (name) {
+ if (name === 'download') {
+ this.handle_save(this, null);
+ } else {
+ this.send_message('toolbar_button', { name: name });
+ }
+};
+
+mpl.figure.prototype.toolbar_button_onmouseover = function (tooltip) {
+ this.message.textContent = tooltip;
+};
+
+///////////////// REMAINING CONTENT GENERATED BY embed_js.py /////////////////
+// prettier-ignore
+var _JSXTOOLS_RESIZE_OBSERVER=function(A){var t,i=new WeakMap,n=new WeakMap,a=new WeakMap,r=new WeakMap,o=new Set;function s(e){if(!(this instanceof s))throw new TypeError("Constructor requires 'new' operator");i.set(this,e)}function h(){throw new TypeError("Function is not a constructor")}function c(e,t,i,n){e=0 in arguments?Number(arguments[0]):0,t=1 in arguments?Number(arguments[1]):0,i=2 in arguments?Number(arguments[2]):0,n=3 in arguments?Number(arguments[3]):0,this.right=(this.x=this.left=e)+(this.width=i),this.bottom=(this.y=this.top=t)+(this.height=n),Object.freeze(this)}function d(){t=requestAnimationFrame(d);var s=new WeakMap,p=new Set;o.forEach((function(t){r.get(t).forEach((function(i){var r=t instanceof window.SVGElement,o=a.get(t),d=r?0:parseFloat(o.paddingTop),f=r?0:parseFloat(o.paddingRight),l=r?0:parseFloat(o.paddingBottom),u=r?0:parseFloat(o.paddingLeft),g=r?0:parseFloat(o.borderTopWidth),m=r?0:parseFloat(o.borderRightWidth),w=r?0:parseFloat(o.borderBottomWidth),b=u+f,F=d+l,v=(r?0:parseFloat(o.borderLeftWidth))+m,W=g+w,y=r?0:t.offsetHeight-W-t.clientHeight,E=r?0:t.offsetWidth-v-t.clientWidth,R=b+v,z=F+W,M=r?t.width:parseFloat(o.width)-R-E,O=r?t.height:parseFloat(o.height)-z-y;if(n.has(t)){var k=n.get(t);if(k[0]===M&&k[1]===O)return}n.set(t,[M,O]);var S=Object.create(h.prototype);S.target=t,S.contentRect=new c(u,d,M,O),s.has(i)||(s.set(i,[]),p.add(i)),s.get(i).push(S)}))})),p.forEach((function(e){i.get(e).call(e,s.get(e),e)}))}return s.prototype.observe=function(i){if(i instanceof window.Element){r.has(i)||(r.set(i,new Set),o.add(i),a.set(i,window.getComputedStyle(i)));var n=r.get(i);n.has(this)||n.add(this),cancelAnimationFrame(t),t=requestAnimationFrame(d)}},s.prototype.unobserve=function(i){if(i instanceof window.Element&&r.has(i)){var n=r.get(i);n.has(this)&&(n.delete(this),n.size||(r.delete(i),o.delete(i))),n.size||r.delete(i),o.size||cancelAnimationFrame(t)}},A.DOMRectReadOnly=c,A.ResizeObserver=s,A.ResizeObserverEntry=h,A}; // eslint-disable-line
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/js/mpl_tornado.js b/venv/Lib/site-packages/matplotlib/backends/web_backend/js/mpl_tornado.js
new file mode 100644
index 0000000..b3cab8b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/js/mpl_tornado.js
@@ -0,0 +1,8 @@
+/* This .js file contains functions for matplotlib's built-in
+ tornado-based server, that are not relevant when embedding WebAgg
+ in another web application. */
+
+/* exported mpl_ondownload */
+function mpl_ondownload(figure, format) {
+ window.open(figure.id + '/download.' + format, '_blank');
+}
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/js/nbagg_mpl.js b/venv/Lib/site-packages/matplotlib/backends/web_backend/js/nbagg_mpl.js
new file mode 100644
index 0000000..8e7e381
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/js/nbagg_mpl.js
@@ -0,0 +1,280 @@
+/* global mpl */
+
+var comm_websocket_adapter = function (comm) {
+ // Create a "websocket"-like object which calls the given IPython comm
+ // object with the appropriate methods. Currently this is a non binary
+ // socket, so there is still some room for performance tuning.
+ var ws = {};
+
+ ws.binaryType = comm.kernel.ws.binaryType;
+ ws.readyState = comm.kernel.ws.readyState;
+ function updateReadyState(_event) {
+ if (comm.kernel.ws) {
+ ws.readyState = comm.kernel.ws.readyState;
+ } else {
+ ws.readyState = 3; // Closed state.
+ }
+ }
+ comm.kernel.ws.addEventListener('open', updateReadyState);
+ comm.kernel.ws.addEventListener('close', updateReadyState);
+ comm.kernel.ws.addEventListener('error', updateReadyState);
+
+ ws.close = function () {
+ comm.close();
+ };
+ ws.send = function (m) {
+ //console.log('sending', m);
+ comm.send(m);
+ };
+ // Register the callback with on_msg.
+ comm.on_msg(function (msg) {
+ //console.log('receiving', msg['content']['data'], msg);
+ var data = msg['content']['data'];
+ if (data['blob'] !== undefined) {
+ data = {
+ data: new Blob(msg['buffers'], { type: data['blob'] }),
+ };
+ }
+ // Pass the mpl event to the overridden (by mpl) onmessage function.
+ ws.onmessage(data);
+ });
+ return ws;
+};
+
+mpl.mpl_figure_comm = function (comm, msg) {
+ // This is the function which gets called when the mpl process
+ // starts-up an IPython Comm through the "matplotlib" channel.
+
+ var id = msg.content.data.id;
+ // Get hold of the div created by the display call when the Comm
+ // socket was opened in Python.
+ var element = document.getElementById(id);
+ var ws_proxy = comm_websocket_adapter(comm);
+
+ function ondownload(figure, _format) {
+ window.open(figure.canvas.toDataURL());
+ }
+
+ var fig = new mpl.figure(id, ws_proxy, ondownload, element);
+
+ // Call onopen now - mpl needs it, as it is assuming we've passed it a real
+ // web socket which is closed, not our websocket->open comm proxy.
+ ws_proxy.onopen();
+
+ fig.parent_element = element;
+ fig.cell_info = mpl.find_output_cell("
");
+ if (!fig.cell_info) {
+ console.error('Failed to find cell for figure', id, fig);
+ return;
+ }
+ fig.cell_info[0].output_area.element.on(
+ 'cleared',
+ { fig: fig },
+ fig._remove_fig_handler
+ );
+};
+
+mpl.figure.prototype.handle_close = function (fig, msg) {
+ var width = fig.canvas.width / fig.ratio;
+ fig.cell_info[0].output_area.element.off(
+ 'cleared',
+ fig._remove_fig_handler
+ );
+ fig.resizeObserverInstance.unobserve(fig.canvas_div);
+
+ // Update the output cell to use the data from the current canvas.
+ fig.push_to_output();
+ var dataURL = fig.canvas.toDataURL();
+ // Re-enable the keyboard manager in IPython - without this line, in FF,
+ // the notebook keyboard shortcuts fail.
+ IPython.keyboard_manager.enable();
+ fig.parent_element.innerHTML =
+ ' ';
+ fig.close_ws(fig, msg);
+};
+
+mpl.figure.prototype.close_ws = function (fig, msg) {
+ fig.send_message('closing', msg);
+ // fig.ws.close()
+};
+
+mpl.figure.prototype.push_to_output = function (_remove_interactive) {
+ // Turn the data on the canvas into data in the output cell.
+ var width = this.canvas.width / this.ratio;
+ var dataURL = this.canvas.toDataURL();
+ this.cell_info[1]['text/html'] =
+ ' ';
+};
+
+mpl.figure.prototype.updated_canvas_event = function () {
+ // Tell IPython that the notebook contents must change.
+ IPython.notebook.set_dirty(true);
+ this.send_message('ack', {});
+ var fig = this;
+ // Wait a second, then push the new image to the DOM so
+ // that it is saved nicely (might be nice to debounce this).
+ setTimeout(function () {
+ fig.push_to_output();
+ }, 1000);
+};
+
+mpl.figure.prototype._init_toolbar = function () {
+ var fig = this;
+
+ var toolbar = document.createElement('div');
+ toolbar.classList = 'btn-toolbar';
+ this.root.appendChild(toolbar);
+
+ function on_click_closure(name) {
+ return function (_event) {
+ return fig.toolbar_button_onclick(name);
+ };
+ }
+
+ function on_mouseover_closure(tooltip) {
+ return function (event) {
+ if (!event.currentTarget.disabled) {
+ return fig.toolbar_button_onmouseover(tooltip);
+ }
+ };
+ }
+
+ fig.buttons = {};
+ var buttonGroup = document.createElement('div');
+ buttonGroup.classList = 'btn-group';
+ var button;
+ for (var toolbar_ind in mpl.toolbar_items) {
+ var name = mpl.toolbar_items[toolbar_ind][0];
+ var tooltip = mpl.toolbar_items[toolbar_ind][1];
+ var image = mpl.toolbar_items[toolbar_ind][2];
+ var method_name = mpl.toolbar_items[toolbar_ind][3];
+
+ if (!name) {
+ /* Instead of a spacer, we start a new button group. */
+ if (buttonGroup.hasChildNodes()) {
+ toolbar.appendChild(buttonGroup);
+ }
+ buttonGroup = document.createElement('div');
+ buttonGroup.classList = 'btn-group';
+ continue;
+ }
+
+ button = fig.buttons[name] = document.createElement('button');
+ button.classList = 'btn btn-default';
+ button.href = '#';
+ button.title = name;
+ button.innerHTML = ' ';
+ button.addEventListener('click', on_click_closure(method_name));
+ button.addEventListener('mouseover', on_mouseover_closure(tooltip));
+ buttonGroup.appendChild(button);
+ }
+
+ if (buttonGroup.hasChildNodes()) {
+ toolbar.appendChild(buttonGroup);
+ }
+
+ // Add the status bar.
+ var status_bar = document.createElement('span');
+ status_bar.classList = 'mpl-message pull-right';
+ toolbar.appendChild(status_bar);
+ this.message = status_bar;
+
+ // Add the close button to the window.
+ var buttongrp = document.createElement('div');
+ buttongrp.classList = 'btn-group inline pull-right';
+ button = document.createElement('button');
+ button.classList = 'btn btn-mini btn-primary';
+ button.href = '#';
+ button.title = 'Stop Interaction';
+ button.innerHTML = ' ';
+ button.addEventListener('click', function (_evt) {
+ fig.handle_close(fig, {});
+ });
+ button.addEventListener(
+ 'mouseover',
+ on_mouseover_closure('Stop Interaction')
+ );
+ buttongrp.appendChild(button);
+ var titlebar = this.root.querySelector('.ui-dialog-titlebar');
+ titlebar.insertBefore(buttongrp, titlebar.firstChild);
+};
+
+mpl.figure.prototype._remove_fig_handler = function (event) {
+ var fig = event.data.fig;
+ if (event.target !== this) {
+ // Ignore bubbled events from children.
+ return;
+ }
+ fig.close_ws(fig, {});
+};
+
+mpl.figure.prototype._root_extra_style = function (el) {
+ el.style.boxSizing = 'content-box'; // override notebook setting of border-box.
+};
+
+mpl.figure.prototype._canvas_extra_style = function (el) {
+ // this is important to make the div 'focusable
+ el.setAttribute('tabindex', 0);
+ // reach out to IPython and tell the keyboard manager to turn it's self
+ // off when our div gets focus
+
+ // location in version 3
+ if (IPython.notebook.keyboard_manager) {
+ IPython.notebook.keyboard_manager.register_events(el);
+ } else {
+ // location in version 2
+ IPython.keyboard_manager.register_events(el);
+ }
+};
+
+mpl.figure.prototype._key_event_extra = function (event, _name) {
+ var manager = IPython.notebook.keyboard_manager;
+ if (!manager) {
+ manager = IPython.keyboard_manager;
+ }
+
+ // Check for shift+enter
+ if (event.shiftKey && event.which === 13) {
+ this.canvas_div.blur();
+ // select the cell after this one
+ var index = IPython.notebook.find_cell_index(this.cell_info[0]);
+ IPython.notebook.select(index + 1);
+ }
+};
+
+mpl.figure.prototype.handle_save = function (fig, _msg) {
+ fig.ondownload(fig, null);
+};
+
+mpl.find_output_cell = function (html_output) {
+ // Return the cell and output element which can be found *uniquely* in the notebook.
+ // Note - this is a bit hacky, but it is done because the "notebook_saving.Notebook"
+ // IPython event is triggered only after the cells have been serialised, which for
+ // our purposes (turning an active figure into a static one), is too late.
+ var cells = IPython.notebook.get_cells();
+ var ncells = cells.length;
+ for (var i = 0; i < ncells; i++) {
+ var cell = cells[i];
+ if (cell.cell_type === 'code') {
+ for (var j = 0; j < cell.output_area.outputs.length; j++) {
+ var data = cell.output_area.outputs[j];
+ if (data.data) {
+ // IPython >= 3 moved mimebundle to data attribute of output
+ data = data.data;
+ }
+ if (data['text/html'] === html_output) {
+ return [cell, data, j];
+ }
+ }
+ }
+ }
+};
+
+// Register the function which deals with the matplotlib target/channel.
+// The kernel may be null if the page has been refreshed.
+if (IPython.notebook.kernel !== null) {
+ IPython.notebook.kernel.comm_manager.register_target(
+ 'matplotlib',
+ mpl.mpl_figure_comm
+ );
+}
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/nbagg_uat.ipynb b/venv/Lib/site-packages/matplotlib/backends/web_backend/nbagg_uat.ipynb
new file mode 100644
index 0000000..a914e71
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/nbagg_uat.ipynb
@@ -0,0 +1,631 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from imp import reload"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## UAT for NbAgg backend.\n",
+ "\n",
+ "The first line simply reloads matplotlib, uses the nbagg backend and then reloads the backend, just to ensure we have the latest modification to the backend code. Note: The underlying JavaScript will not be updated by this process, so a refresh of the browser after clearing the output and saving is necessary to clear everything fully."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import matplotlib\n",
+ "reload(matplotlib)\n",
+ "\n",
+ "matplotlib.use('nbagg')\n",
+ "\n",
+ "import matplotlib.backends.backend_nbagg\n",
+ "reload(matplotlib.backends.backend_nbagg)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 1 - Simple figure creation using pyplot\n",
+ "\n",
+ "Should produce a figure window which is interactive with the pan and zoom buttons. (Do not press the close button, but any others may be used)."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import matplotlib.backends.backend_webagg_core\n",
+ "reload(matplotlib.backends.backend_webagg_core)\n",
+ "\n",
+ "import matplotlib.pyplot as plt\n",
+ "plt.interactive(False)\n",
+ "\n",
+ "fig1 = plt.figure()\n",
+ "plt.plot(range(10))\n",
+ "\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 2 - Creation of another figure, without the need to do plt.figure.\n",
+ "\n",
+ "As above, a new figure should be created."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "plt.plot([3, 2, 1])\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 3 - Connection info\n",
+ "\n",
+ "The printout should show that there are two figures which have active CommSockets, and no figures pending show."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "print(matplotlib.backends.backend_nbagg.connection_info())"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 4 - Closing figures\n",
+ "\n",
+ "Closing a specific figure instance should turn the figure into a plain image - the UI should have been removed. In this case, scroll back to the first figure and assert this is the case."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "plt.close(fig1)\n",
+ "plt.close('all')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 5 - No show without plt.show in non-interactive mode\n",
+ "\n",
+ "Simply doing a plt.plot should not show a new figure, nor indeed update an existing one (easily verified in UAT 6).\n",
+ "The output should simply be a list of Line2D instances."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "plt.plot(range(10))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 6 - Connection information\n",
+ "\n",
+ "We just created a new figure, but didn't show it. Connection info should no longer have \"Figure 1\" (as we closed it in UAT 4) and should have figure 2 and 3, with Figure 3 without any connections. There should be 1 figure pending."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "print(matplotlib.backends.backend_nbagg.connection_info())"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 7 - Show of previously created figure\n",
+ "\n",
+ "We should be able to show a figure we've previously created. The following should produce two figure windows."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "plt.show()\n",
+ "plt.figure()\n",
+ "plt.plot(range(5))\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 8 - Interactive mode\n",
+ "\n",
+ "In interactive mode, creating a line should result in a figure being shown."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "plt.interactive(True)\n",
+ "plt.figure()\n",
+ "plt.plot([3, 2, 1])"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Subsequent lines should be added to the existing figure, rather than creating a new one."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "plt.plot(range(3))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Calling connection_info in interactive mode should not show any pending figures."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "print(matplotlib.backends.backend_nbagg.connection_info())"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Disable interactive mode again."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "plt.interactive(False)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 9 - Multiple shows\n",
+ "\n",
+ "Unlike most of the other matplotlib backends, we may want to see a figure multiple times (with or without synchronisation between the views, though the former is not yet implemented). Assert that plt.gcf().canvas.manager.reshow() results in another figure window which is synchronised upon pan & zoom."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "plt.gcf().canvas.manager.reshow()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 10 - Saving notebook\n",
+ "\n",
+ "Saving the notebook (with CTRL+S or File->Save) should result in the saved notebook having static versions of the figues embedded within. The image should be the last update from user interaction and interactive plotting. (check by converting with ``ipython nbconvert ``)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 11 - Creation of a new figure on second show\n",
+ "\n",
+ "Create a figure, show it, then create a new axes and show it. The result should be a new figure.\n",
+ "\n",
+ "**BUG: Sometimes this doesn't work - not sure why (@pelson).**"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "fig = plt.figure()\n",
+ "plt.axes()\n",
+ "plt.show()\n",
+ "\n",
+ "plt.plot([1, 2, 3])\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 12 - OO interface\n",
+ "\n",
+ "Should produce a new figure and plot it."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from matplotlib.backends.backend_nbagg import new_figure_manager,show\n",
+ "\n",
+ "manager = new_figure_manager(1000)\n",
+ "fig = manager.canvas.figure\n",
+ "ax = fig.add_subplot(1,1,1)\n",
+ "ax.plot([1,2,3])\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## UAT 13 - Animation\n",
+ "\n",
+ "The following should generate an animated line:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import matplotlib.animation as animation\n",
+ "import numpy as np\n",
+ "\n",
+ "fig, ax = plt.subplots()\n",
+ "\n",
+ "x = np.arange(0, 2*np.pi, 0.01) # x-array\n",
+ "line, = ax.plot(x, np.sin(x))\n",
+ "\n",
+ "def animate(i):\n",
+ " line.set_ydata(np.sin(x+i/10.0)) # update the data\n",
+ " return line,\n",
+ "\n",
+ "#Init only required for blitting to give a clean slate.\n",
+ "def init():\n",
+ " line.set_ydata(np.ma.array(x, mask=True))\n",
+ " return line,\n",
+ "\n",
+ "ani = animation.FuncAnimation(fig, animate, np.arange(1, 200), init_func=init,\n",
+ " interval=100., blit=True)\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 14 - Keyboard shortcuts in IPython after close of figure\n",
+ "\n",
+ "After closing the previous figure (with the close button above the figure) the IPython keyboard shortcuts should still function.\n",
+ "\n",
+ "### UAT 15 - Figure face colours\n",
+ "\n",
+ "The nbagg honours all colours apart from that of the figure.patch. The two plots below should produce a figure with a red background. There should be no yellow figure."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import matplotlib\n",
+ "matplotlib.rcParams.update({'figure.facecolor': 'red',\n",
+ " 'savefig.facecolor': 'yellow'})\n",
+ "plt.figure()\n",
+ "plt.plot([3, 2, 1])\n",
+ "\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 16 - Events\n",
+ "\n",
+ "Pressing any keyboard key or mouse button (or scrolling) should cycle the line line while the figure has focus. The figure should have focus by default when it is created and re-gain it by clicking on the canvas. Clicking anywhere outside of the figure should release focus, but moving the mouse out of the figure should not release focus."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import itertools\n",
+ "fig, ax = plt.subplots()\n",
+ "x = np.linspace(0,10,10000)\n",
+ "y = np.sin(x)\n",
+ "ln, = ax.plot(x,y)\n",
+ "evt = []\n",
+ "colors = iter(itertools.cycle(['r', 'g', 'b', 'k', 'c']))\n",
+ "def on_event(event):\n",
+ " if event.name.startswith('key'):\n",
+ " fig.suptitle('%s: %s' % (event.name, event.key))\n",
+ " elif event.name == 'scroll_event':\n",
+ " fig.suptitle('%s: %s' % (event.name, event.step))\n",
+ " else:\n",
+ " fig.suptitle('%s: %s' % (event.name, event.button))\n",
+ " evt.append(event)\n",
+ " ln.set_color(next(colors))\n",
+ " fig.canvas.draw()\n",
+ " fig.canvas.draw_idle()\n",
+ "\n",
+ "fig.canvas.mpl_connect('button_press_event', on_event)\n",
+ "fig.canvas.mpl_connect('button_release_event', on_event)\n",
+ "fig.canvas.mpl_connect('scroll_event', on_event)\n",
+ "fig.canvas.mpl_connect('key_press_event', on_event)\n",
+ "fig.canvas.mpl_connect('key_release_event', on_event)\n",
+ "\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 17 - Timers\n",
+ "\n",
+ "Single-shot timers follow a completely different code path in the nbagg backend than regular timers (such as those used in the animation example above.) The next set of tests ensures that both \"regular\" and \"single-shot\" timers work properly.\n",
+ "\n",
+ "The following should show a simple clock that updates twice a second:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import time\n",
+ "\n",
+ "fig, ax = plt.subplots()\n",
+ "text = ax.text(0.5, 0.5, '', ha='center')\n",
+ "\n",
+ "def update(text):\n",
+ " text.set(text=time.ctime())\n",
+ " text.axes.figure.canvas.draw()\n",
+ " \n",
+ "timer = fig.canvas.new_timer(500, [(update, [text], {})])\n",
+ "timer.start()\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "However, the following should only update once and then stop:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "fig, ax = plt.subplots()\n",
+ "text = ax.text(0.5, 0.5, '', ha='center') \n",
+ "timer = fig.canvas.new_timer(500, [(update, [text], {})])\n",
+ "\n",
+ "timer.single_shot = True\n",
+ "timer.start()\n",
+ "\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "And the next two examples should never show any visible text at all:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "fig, ax = plt.subplots()\n",
+ "text = ax.text(0.5, 0.5, '', ha='center')\n",
+ "timer = fig.canvas.new_timer(500, [(update, [text], {})])\n",
+ "\n",
+ "timer.start()\n",
+ "timer.stop()\n",
+ "\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "fig, ax = plt.subplots()\n",
+ "text = ax.text(0.5, 0.5, '', ha='center')\n",
+ "timer = fig.canvas.new_timer(500, [(update, [text], {})])\n",
+ "\n",
+ "timer.single_shot = True\n",
+ "timer.start()\n",
+ "timer.stop()\n",
+ "\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### UAT 18 - stopping figure when removed from DOM\n",
+ "\n",
+ "When the div that contains from the figure is removed from the DOM the figure should shut down it's comm, and if the python-side figure has no more active comms, it should destroy the figure. Repeatedly running the cell below should always have the same figure number"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "fig, ax = plt.subplots()\n",
+ "ax.plot(range(5))\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Running the cell below will re-show the figure. After this, re-running the cell above should result in a new figure number."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "fig.canvas.manager.reshow()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "collapsed": true
+ },
+ "source": [
+ "### UAT 19 - Blitting\n",
+ "\n",
+ "Clicking on the figure should plot a green horizontal line moving up the axes."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import itertools\n",
+ "\n",
+ "cnt = itertools.count()\n",
+ "bg = None\n",
+ "\n",
+ "def onclick_handle(event):\n",
+ " \"\"\"Should draw elevating green line on each mouse click\"\"\"\n",
+ " global bg\n",
+ " if bg is None:\n",
+ " bg = ax.figure.canvas.copy_from_bbox(ax.bbox) \n",
+ " ax.figure.canvas.restore_region(bg)\n",
+ "\n",
+ " cur_y = (next(cnt) % 10) * 0.1\n",
+ " ln.set_ydata([cur_y, cur_y])\n",
+ " ax.draw_artist(ln)\n",
+ " ax.figure.canvas.blit(ax.bbox)\n",
+ "\n",
+ "fig, ax = plt.subplots()\n",
+ "ax.plot([0, 1], [0, 1], 'r')\n",
+ "ln, = ax.plot([0, 1], [0, 0], 'g', animated=True)\n",
+ "plt.show()\n",
+ "ax.figure.canvas.draw()\n",
+ "\n",
+ "ax.figure.canvas.mpl_connect('button_press_event', onclick_handle)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.8.5"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/package.json b/venv/Lib/site-packages/matplotlib/backends/web_backend/package.json
new file mode 100644
index 0000000..95bd8fd
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/package.json
@@ -0,0 +1,18 @@
+{
+ "devDependencies": {
+ "eslint": "^6.8.0",
+ "eslint-config-prettier": "^6.10.1",
+ "prettier": "^2.0.2"
+ },
+ "scripts": {
+ "eslint": "eslint . --fix",
+ "eslint:check": "eslint .",
+ "lint": "npm run prettier && npm run eslint",
+ "lint:check": "npm run prettier:check && npm run eslint:check",
+ "prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json}\"",
+ "prettier:check": "prettier --check \"**/*{.ts,.tsx,.js,.jsx,.css,.json}\""
+ },
+ "dependencies": {
+ "@jsxtools/resize-observer": "^1.0.4"
+ }
+}
diff --git a/venv/Lib/site-packages/matplotlib/backends/web_backend/single_figure.html b/venv/Lib/site-packages/matplotlib/backends/web_backend/single_figure.html
new file mode 100644
index 0000000..71fe451
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/backends/web_backend/single_figure.html
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+ matplotlib
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/bezier.py b/venv/Lib/site-packages/matplotlib/bezier.py
new file mode 100644
index 0000000..32889ed
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/bezier.py
@@ -0,0 +1,620 @@
+"""
+A module providing some utility functions regarding Bezier path manipulation.
+"""
+
+from functools import lru_cache
+import math
+import warnings
+
+import numpy as np
+
+from matplotlib import _api
+
+
+# same algorithm as 3.8's math.comb
+@np.vectorize
+@lru_cache(maxsize=128)
+def _comb(n, k):
+ if k > n:
+ return 0
+ k = min(k, n - k)
+ i = np.arange(1, k + 1)
+ return np.prod((n + 1 - i)/i).astype(int)
+
+
+class NonIntersectingPathException(ValueError):
+ pass
+
+
+# some functions
+
+
+def get_intersection(cx1, cy1, cos_t1, sin_t1,
+ cx2, cy2, cos_t2, sin_t2):
+ """
+ Return the intersection between the line through (*cx1*, *cy1*) at angle
+ *t1* and the line through (*cx2*, *cy2*) at angle *t2*.
+ """
+
+ # line1 => sin_t1 * (x - cx1) - cos_t1 * (y - cy1) = 0.
+ # line1 => sin_t1 * x + cos_t1 * y = sin_t1*cx1 - cos_t1*cy1
+
+ line1_rhs = sin_t1 * cx1 - cos_t1 * cy1
+ line2_rhs = sin_t2 * cx2 - cos_t2 * cy2
+
+ # rhs matrix
+ a, b = sin_t1, -cos_t1
+ c, d = sin_t2, -cos_t2
+
+ ad_bc = a * d - b * c
+ if abs(ad_bc) < 1e-12:
+ raise ValueError("Given lines do not intersect. Please verify that "
+ "the angles are not equal or differ by 180 degrees.")
+
+ # rhs_inverse
+ a_, b_ = d, -b
+ c_, d_ = -c, a
+ a_, b_, c_, d_ = [k / ad_bc for k in [a_, b_, c_, d_]]
+
+ x = a_ * line1_rhs + b_ * line2_rhs
+ y = c_ * line1_rhs + d_ * line2_rhs
+
+ return x, y
+
+
+def get_normal_points(cx, cy, cos_t, sin_t, length):
+ """
+ For a line passing through (*cx*, *cy*) and having an angle *t*, return
+ locations of the two points located along its perpendicular line at the
+ distance of *length*.
+ """
+
+ if length == 0.:
+ return cx, cy, cx, cy
+
+ cos_t1, sin_t1 = sin_t, -cos_t
+ cos_t2, sin_t2 = -sin_t, cos_t
+
+ x1, y1 = length * cos_t1 + cx, length * sin_t1 + cy
+ x2, y2 = length * cos_t2 + cx, length * sin_t2 + cy
+
+ return x1, y1, x2, y2
+
+
+# BEZIER routines
+
+# subdividing bezier curve
+# http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/Bezier/bezier-sub.html
+
+
+def _de_casteljau1(beta, t):
+ next_beta = beta[:-1] * (1 - t) + beta[1:] * t
+ return next_beta
+
+
+def split_de_casteljau(beta, t):
+ """
+ Split a Bezier segment defined by its control points *beta* into two
+ separate segments divided at *t* and return their control points.
+ """
+ beta = np.asarray(beta)
+ beta_list = [beta]
+ while True:
+ beta = _de_casteljau1(beta, t)
+ beta_list.append(beta)
+ if len(beta) == 1:
+ break
+ left_beta = [beta[0] for beta in beta_list]
+ right_beta = [beta[-1] for beta in reversed(beta_list)]
+
+ return left_beta, right_beta
+
+
+def find_bezier_t_intersecting_with_closedpath(
+ bezier_point_at_t, inside_closedpath, t0=0., t1=1., tolerance=0.01):
+ """
+ Find the intersection of the Bezier curve with a closed path.
+
+ The intersection point *t* is approximated by two parameters *t0*, *t1*
+ such that *t0* <= *t* <= *t1*.
+
+ Search starts from *t0* and *t1* and uses a simple bisecting algorithm
+ therefore one of the end points must be inside the path while the other
+ doesn't. The search stops when the distance of the points parametrized by
+ *t0* and *t1* gets smaller than the given *tolerance*.
+
+ Parameters
+ ----------
+ bezier_point_at_t : callable
+ A function returning x, y coordinates of the Bezier at parameter *t*.
+ It must have the signature::
+
+ bezier_point_at_t(t: float) -> tuple[float, float]
+
+ inside_closedpath : callable
+ A function returning True if a given point (x, y) is inside the
+ closed path. It must have the signature::
+
+ inside_closedpath(point: tuple[float, float]) -> bool
+
+ t0, t1 : float
+ Start parameters for the search.
+
+ tolerance : float
+ Maximal allowed distance between the final points.
+
+ Returns
+ -------
+ t0, t1 : float
+ The Bezier path parameters.
+ """
+ start = bezier_point_at_t(t0)
+ end = bezier_point_at_t(t1)
+
+ start_inside = inside_closedpath(start)
+ end_inside = inside_closedpath(end)
+
+ if start_inside == end_inside and start != end:
+ raise NonIntersectingPathException(
+ "Both points are on the same side of the closed path")
+
+ while True:
+
+ # return if the distance is smaller than the tolerance
+ if np.hypot(start[0] - end[0], start[1] - end[1]) < tolerance:
+ return t0, t1
+
+ # calculate the middle point
+ middle_t = 0.5 * (t0 + t1)
+ middle = bezier_point_at_t(middle_t)
+ middle_inside = inside_closedpath(middle)
+
+ if start_inside ^ middle_inside:
+ t1 = middle_t
+ end = middle
+ end_inside = middle_inside
+ else:
+ t0 = middle_t
+ start = middle
+ start_inside = middle_inside
+
+
+class BezierSegment:
+ """
+ A d-dimensional Bezier segment.
+
+ Parameters
+ ----------
+ control_points : (N, d) array
+ Location of the *N* control points.
+ """
+
+ def __init__(self, control_points):
+ self._cpoints = np.asarray(control_points)
+ self._N, self._d = self._cpoints.shape
+ self._orders = np.arange(self._N)
+ coeff = [math.factorial(self._N - 1)
+ // (math.factorial(i) * math.factorial(self._N - 1 - i))
+ for i in range(self._N)]
+ self._px = (self._cpoints.T * coeff).T
+
+ def __call__(self, t):
+ """
+ Evaluate the Bezier curve at point(s) t in [0, 1].
+
+ Parameters
+ ----------
+ t : (k,) array-like
+ Points at which to evaluate the curve.
+
+ Returns
+ -------
+ (k, d) array
+ Value of the curve for each point in *t*.
+ """
+ t = np.asarray(t)
+ return (np.power.outer(1 - t, self._orders[::-1])
+ * np.power.outer(t, self._orders)) @ self._px
+
+ def point_at_t(self, t):
+ """
+ Evaluate the curve at a single point, returning a tuple of *d* floats.
+ """
+ return tuple(self(t))
+
+ @property
+ def control_points(self):
+ """The control points of the curve."""
+ return self._cpoints
+
+ @property
+ def dimension(self):
+ """The dimension of the curve."""
+ return self._d
+
+ @property
+ def degree(self):
+ """Degree of the polynomial. One less the number of control points."""
+ return self._N - 1
+
+ @property
+ def polynomial_coefficients(self):
+ r"""
+ The polynomial coefficients of the Bezier curve.
+
+ .. warning:: Follows opposite convention from `numpy.polyval`.
+
+ Returns
+ -------
+ (n+1, d) array
+ Coefficients after expanding in polynomial basis, where :math:`n`
+ is the degree of the bezier curve and :math:`d` its dimension.
+ These are the numbers (:math:`C_j`) such that the curve can be
+ written :math:`\sum_{j=0}^n C_j t^j`.
+
+ Notes
+ -----
+ The coefficients are calculated as
+
+ .. math::
+
+ {n \choose j} \sum_{i=0}^j (-1)^{i+j} {j \choose i} P_i
+
+ where :math:`P_i` are the control points of the curve.
+ """
+ n = self.degree
+ # matplotlib uses n <= 4. overflow plausible starting around n = 15.
+ if n > 10:
+ warnings.warn("Polynomial coefficients formula unstable for high "
+ "order Bezier curves!", RuntimeWarning)
+ P = self.control_points
+ j = np.arange(n+1)[:, None]
+ i = np.arange(n+1)[None, :] # _comb is non-zero for i <= j
+ prefactor = (-1)**(i + j) * _comb(j, i) # j on axis 0, i on axis 1
+ return _comb(n, j) * prefactor @ P # j on axis 0, self.dimension on 1
+
+ def axis_aligned_extrema(self):
+ """
+ Return the dimension and location of the curve's interior extrema.
+
+ The extrema are the points along the curve where one of its partial
+ derivatives is zero.
+
+ Returns
+ -------
+ dims : array of int
+ Index :math:`i` of the partial derivative which is zero at each
+ interior extrema.
+ dzeros : array of float
+ Of same size as dims. The :math:`t` such that :math:`d/dx_i B(t) =
+ 0`
+ """
+ n = self.degree
+ if n <= 1:
+ return np.array([]), np.array([])
+ Cj = self.polynomial_coefficients
+ dCj = np.arange(1, n+1)[:, None] * Cj[1:]
+ dims = []
+ roots = []
+ for i, pi in enumerate(dCj.T):
+ r = np.roots(pi[::-1])
+ roots.append(r)
+ dims.append(np.full_like(r, i))
+ roots = np.concatenate(roots)
+ dims = np.concatenate(dims)
+ in_range = np.isreal(roots) & (roots >= 0) & (roots <= 1)
+ return dims[in_range], np.real(roots)[in_range]
+
+
+def split_bezier_intersecting_with_closedpath(
+ bezier, inside_closedpath, tolerance=0.01):
+ """
+ Split a Bezier curve into two at the intersection with a closed path.
+
+ Parameters
+ ----------
+ bezier : (N, 2) array-like
+ Control points of the Bezier segment. See `.BezierSegment`.
+ inside_closedpath : callable
+ A function returning True if a given point (x, y) is inside the
+ closed path. See also `.find_bezier_t_intersecting_with_closedpath`.
+ tolerance : float
+ The tolerance for the intersection. See also
+ `.find_bezier_t_intersecting_with_closedpath`.
+
+ Returns
+ -------
+ left, right
+ Lists of control points for the two Bezier segments.
+ """
+
+ bz = BezierSegment(bezier)
+ bezier_point_at_t = bz.point_at_t
+
+ t0, t1 = find_bezier_t_intersecting_with_closedpath(
+ bezier_point_at_t, inside_closedpath, tolerance=tolerance)
+
+ _left, _right = split_de_casteljau(bezier, (t0 + t1) / 2.)
+ return _left, _right
+
+
+# matplotlib specific
+
+
+def split_path_inout(path, inside, tolerance=0.01, reorder_inout=False):
+ """
+ Divide a path into two segments at the point where ``inside(x, y)`` becomes
+ False.
+ """
+ from .path import Path
+ path_iter = path.iter_segments()
+
+ ctl_points, command = next(path_iter)
+ begin_inside = inside(ctl_points[-2:]) # true if begin point is inside
+
+ ctl_points_old = ctl_points
+
+ iold = 0
+ i = 1
+
+ for ctl_points, command in path_iter:
+ iold = i
+ i += len(ctl_points) // 2
+ if inside(ctl_points[-2:]) != begin_inside:
+ bezier_path = np.concatenate([ctl_points_old[-2:], ctl_points])
+ break
+ ctl_points_old = ctl_points
+ else:
+ raise ValueError("The path does not intersect with the patch")
+
+ bp = bezier_path.reshape((-1, 2))
+ left, right = split_bezier_intersecting_with_closedpath(
+ bp, inside, tolerance)
+ if len(left) == 2:
+ codes_left = [Path.LINETO]
+ codes_right = [Path.MOVETO, Path.LINETO]
+ elif len(left) == 3:
+ codes_left = [Path.CURVE3, Path.CURVE3]
+ codes_right = [Path.MOVETO, Path.CURVE3, Path.CURVE3]
+ elif len(left) == 4:
+ codes_left = [Path.CURVE4, Path.CURVE4, Path.CURVE4]
+ codes_right = [Path.MOVETO, Path.CURVE4, Path.CURVE4, Path.CURVE4]
+ else:
+ raise AssertionError("This should never be reached")
+
+ verts_left = left[1:]
+ verts_right = right[:]
+
+ if path.codes is None:
+ path_in = Path(np.concatenate([path.vertices[:i], verts_left]))
+ path_out = Path(np.concatenate([verts_right, path.vertices[i:]]))
+
+ else:
+ path_in = Path(np.concatenate([path.vertices[:iold], verts_left]),
+ np.concatenate([path.codes[:iold], codes_left]))
+
+ path_out = Path(np.concatenate([verts_right, path.vertices[i:]]),
+ np.concatenate([codes_right, path.codes[i:]]))
+
+ if reorder_inout and not begin_inside:
+ path_in, path_out = path_out, path_in
+
+ return path_in, path_out
+
+
+def inside_circle(cx, cy, r):
+ """
+ Return a function that checks whether a point is in a circle with center
+ (*cx*, *cy*) and radius *r*.
+
+ The returned function has the signature::
+
+ f(xy: tuple[float, float]) -> bool
+ """
+ r2 = r ** 2
+
+ def _f(xy):
+ x, y = xy
+ return (x - cx) ** 2 + (y - cy) ** 2 < r2
+ return _f
+
+
+# quadratic Bezier lines
+
+def get_cos_sin(x0, y0, x1, y1):
+ dx, dy = x1 - x0, y1 - y0
+ d = (dx * dx + dy * dy) ** .5
+ # Account for divide by zero
+ if d == 0:
+ return 0.0, 0.0
+ return dx / d, dy / d
+
+
+def check_if_parallel(dx1, dy1, dx2, dy2, tolerance=1.e-5):
+ """
+ Check if two lines are parallel.
+
+ Parameters
+ ----------
+ dx1, dy1, dx2, dy2 : float
+ The gradients *dy*/*dx* of the two lines.
+ tolerance : float
+ The angular tolerance in radians up to which the lines are considered
+ parallel.
+
+ Returns
+ -------
+ is_parallel
+ - 1 if two lines are parallel in same direction.
+ - -1 if two lines are parallel in opposite direction.
+ - False otherwise.
+ """
+ theta1 = np.arctan2(dx1, dy1)
+ theta2 = np.arctan2(dx2, dy2)
+ dtheta = abs(theta1 - theta2)
+ if dtheta < tolerance:
+ return 1
+ elif abs(dtheta - np.pi) < tolerance:
+ return -1
+ else:
+ return False
+
+
+def get_parallels(bezier2, width):
+ """
+ Given the quadratic Bezier control points *bezier2*, returns
+ control points of quadratic Bezier lines roughly parallel to given
+ one separated by *width*.
+ """
+
+ # The parallel Bezier lines are constructed by following ways.
+ # c1 and c2 are control points representing the begin and end of the
+ # Bezier line.
+ # cm is the middle point
+
+ c1x, c1y = bezier2[0]
+ cmx, cmy = bezier2[1]
+ c2x, c2y = bezier2[2]
+
+ parallel_test = check_if_parallel(c1x - cmx, c1y - cmy,
+ cmx - c2x, cmy - c2y)
+
+ if parallel_test == -1:
+ _api.warn_external(
+ "Lines do not intersect. A straight line is used instead.")
+ cos_t1, sin_t1 = get_cos_sin(c1x, c1y, c2x, c2y)
+ cos_t2, sin_t2 = cos_t1, sin_t1
+ else:
+ # t1 and t2 is the angle between c1 and cm, cm, c2. They are
+ # also a angle of the tangential line of the path at c1 and c2
+ cos_t1, sin_t1 = get_cos_sin(c1x, c1y, cmx, cmy)
+ cos_t2, sin_t2 = get_cos_sin(cmx, cmy, c2x, c2y)
+
+ # find c1_left, c1_right which are located along the lines
+ # through c1 and perpendicular to the tangential lines of the
+ # Bezier path at a distance of width. Same thing for c2_left and
+ # c2_right with respect to c2.
+ c1x_left, c1y_left, c1x_right, c1y_right = (
+ get_normal_points(c1x, c1y, cos_t1, sin_t1, width)
+ )
+ c2x_left, c2y_left, c2x_right, c2y_right = (
+ get_normal_points(c2x, c2y, cos_t2, sin_t2, width)
+ )
+
+ # find cm_left which is the intersecting point of a line through
+ # c1_left with angle t1 and a line through c2_left with angle
+ # t2. Same with cm_right.
+ try:
+ cmx_left, cmy_left = get_intersection(c1x_left, c1y_left, cos_t1,
+ sin_t1, c2x_left, c2y_left,
+ cos_t2, sin_t2)
+ cmx_right, cmy_right = get_intersection(c1x_right, c1y_right, cos_t1,
+ sin_t1, c2x_right, c2y_right,
+ cos_t2, sin_t2)
+ except ValueError:
+ # Special case straight lines, i.e., angle between two lines is
+ # less than the threshold used by get_intersection (we don't use
+ # check_if_parallel as the threshold is not the same).
+ cmx_left, cmy_left = (
+ 0.5 * (c1x_left + c2x_left), 0.5 * (c1y_left + c2y_left)
+ )
+ cmx_right, cmy_right = (
+ 0.5 * (c1x_right + c2x_right), 0.5 * (c1y_right + c2y_right)
+ )
+
+ # the parallel Bezier lines are created with control points of
+ # [c1_left, cm_left, c2_left] and [c1_right, cm_right, c2_right]
+ path_left = [(c1x_left, c1y_left),
+ (cmx_left, cmy_left),
+ (c2x_left, c2y_left)]
+ path_right = [(c1x_right, c1y_right),
+ (cmx_right, cmy_right),
+ (c2x_right, c2y_right)]
+
+ return path_left, path_right
+
+
+def find_control_points(c1x, c1y, mmx, mmy, c2x, c2y):
+ """
+ Find control points of the Bezier curve passing through (*c1x*, *c1y*),
+ (*mmx*, *mmy*), and (*c2x*, *c2y*), at parametric values 0, 0.5, and 1.
+ """
+ cmx = .5 * (4 * mmx - (c1x + c2x))
+ cmy = .5 * (4 * mmy - (c1y + c2y))
+ return [(c1x, c1y), (cmx, cmy), (c2x, c2y)]
+
+
+def make_wedged_bezier2(bezier2, width, w1=1., wm=0.5, w2=0.):
+ """
+ Being similar to get_parallels, returns control points of two quadratic
+ Bezier lines having a width roughly parallel to given one separated by
+ *width*.
+ """
+
+ # c1, cm, c2
+ c1x, c1y = bezier2[0]
+ cmx, cmy = bezier2[1]
+ c3x, c3y = bezier2[2]
+
+ # t1 and t2 is the angle between c1 and cm, cm, c3.
+ # They are also a angle of the tangential line of the path at c1 and c3
+ cos_t1, sin_t1 = get_cos_sin(c1x, c1y, cmx, cmy)
+ cos_t2, sin_t2 = get_cos_sin(cmx, cmy, c3x, c3y)
+
+ # find c1_left, c1_right which are located along the lines
+ # through c1 and perpendicular to the tangential lines of the
+ # Bezier path at a distance of width. Same thing for c3_left and
+ # c3_right with respect to c3.
+ c1x_left, c1y_left, c1x_right, c1y_right = (
+ get_normal_points(c1x, c1y, cos_t1, sin_t1, width * w1)
+ )
+ c3x_left, c3y_left, c3x_right, c3y_right = (
+ get_normal_points(c3x, c3y, cos_t2, sin_t2, width * w2)
+ )
+
+ # find c12, c23 and c123 which are middle points of c1-cm, cm-c3 and
+ # c12-c23
+ c12x, c12y = (c1x + cmx) * .5, (c1y + cmy) * .5
+ c23x, c23y = (cmx + c3x) * .5, (cmy + c3y) * .5
+ c123x, c123y = (c12x + c23x) * .5, (c12y + c23y) * .5
+
+ # tangential angle of c123 (angle between c12 and c23)
+ cos_t123, sin_t123 = get_cos_sin(c12x, c12y, c23x, c23y)
+
+ c123x_left, c123y_left, c123x_right, c123y_right = (
+ get_normal_points(c123x, c123y, cos_t123, sin_t123, width * wm)
+ )
+
+ path_left = find_control_points(c1x_left, c1y_left,
+ c123x_left, c123y_left,
+ c3x_left, c3y_left)
+ path_right = find_control_points(c1x_right, c1y_right,
+ c123x_right, c123y_right,
+ c3x_right, c3y_right)
+
+ return path_left, path_right
+
+
+@_api.deprecated(
+ "3.3", alternative="Path.cleaned() and remove the final STOP if needed")
+def make_path_regular(p):
+ """
+ If the ``codes`` attribute of `.Path` *p* is None, return a copy of *p*
+ with ``codes`` set to (MOVETO, LINETO, LINETO, ..., LINETO); otherwise
+ return *p* itself.
+ """
+ from .path import Path
+ c = p.codes
+ if c is None:
+ c = np.full(len(p.vertices), Path.LINETO, dtype=Path.code_type)
+ c[0] = Path.MOVETO
+ return Path(p.vertices, c)
+ else:
+ return p
+
+
+@_api.deprecated("3.3", alternative="Path.make_compound_path()")
+def concatenate_paths(paths):
+ """Concatenate a list of paths into a single path."""
+ from .path import Path
+ return Path.make_compound_path(*paths)
diff --git a/venv/Lib/site-packages/matplotlib/blocking_input.py b/venv/Lib/site-packages/matplotlib/blocking_input.py
new file mode 100644
index 0000000..afbfdac
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/blocking_input.py
@@ -0,0 +1,353 @@
+"""
+Classes used for blocking interaction with figure windows:
+
+`BlockingInput`
+ Creates a callable object to retrieve events in a blocking way for
+ interactive sessions. Base class of the other classes listed here.
+
+`BlockingKeyMouseInput`
+ Creates a callable object to retrieve key or mouse clicks in a blocking
+ way for interactive sessions. Used by `~.Figure.waitforbuttonpress`.
+
+`BlockingMouseInput`
+ Creates a callable object to retrieve mouse clicks in a blocking way for
+ interactive sessions. Used by `~.Figure.ginput`.
+
+`BlockingContourLabeler`
+ Creates a callable object to retrieve mouse clicks in a blocking way that
+ will then be used to place labels on a `.ContourSet`. Used by
+ `~.Axes.clabel`.
+"""
+
+import logging
+from numbers import Integral
+
+from matplotlib import _api
+from matplotlib.backend_bases import MouseButton
+import matplotlib.lines as mlines
+
+_log = logging.getLogger(__name__)
+
+
+class BlockingInput:
+ """Callable for retrieving events in a blocking way."""
+
+ def __init__(self, fig, eventslist=()):
+ self.fig = fig
+ self.eventslist = eventslist
+
+ def on_event(self, event):
+ """
+ Event handler; will be passed to the current figure to retrieve events.
+ """
+ # Add a new event to list - using a separate function is overkill for
+ # the base class, but this is consistent with subclasses.
+ self.add_event(event)
+ _log.info("Event %i", len(self.events))
+
+ # This will extract info from events.
+ self.post_event()
+
+ # Check if we have enough events already.
+ if len(self.events) >= self.n > 0:
+ self.fig.canvas.stop_event_loop()
+
+ def post_event(self):
+ """For baseclass, do nothing but collect events."""
+
+ def cleanup(self):
+ """Disconnect all callbacks."""
+ for cb in self.callbacks:
+ self.fig.canvas.mpl_disconnect(cb)
+ self.callbacks = []
+
+ def add_event(self, event):
+ """For base class, this just appends an event to events."""
+ self.events.append(event)
+
+ def pop_event(self, index=-1):
+ """
+ Remove an event from the event list -- by default, the last.
+
+ Note that this does not check that there are events, much like the
+ normal pop method. If no events exist, this will throw an exception.
+ """
+ self.events.pop(index)
+
+ pop = pop_event
+
+ def __call__(self, n=1, timeout=30):
+ """Blocking call to retrieve *n* events."""
+ _api.check_isinstance(Integral, n=n)
+ self.n = n
+ self.events = []
+
+ if hasattr(self.fig.canvas, "manager"):
+ # Ensure that the figure is shown, if we are managing it.
+ self.fig.show()
+ # Connect the events to the on_event function call.
+ self.callbacks = [self.fig.canvas.mpl_connect(name, self.on_event)
+ for name in self.eventslist]
+ try:
+ # Start event loop.
+ self.fig.canvas.start_event_loop(timeout=timeout)
+ finally: # Run even on exception like ctrl-c.
+ # Disconnect the callbacks.
+ self.cleanup()
+ # Return the events in this case.
+ return self.events
+
+
+class BlockingMouseInput(BlockingInput):
+ """
+ Callable for retrieving mouse clicks in a blocking way.
+
+ This class will also retrieve keypresses and map them to mouse clicks:
+ delete and backspace are a right click, enter is like a middle click,
+ and all others are like a left click.
+ """
+
+ button_add = MouseButton.LEFT
+ button_pop = MouseButton.RIGHT
+ button_stop = MouseButton.MIDDLE
+
+ def __init__(self, fig,
+ mouse_add=MouseButton.LEFT,
+ mouse_pop=MouseButton.RIGHT,
+ mouse_stop=MouseButton.MIDDLE):
+ super().__init__(fig=fig,
+ eventslist=('button_press_event', 'key_press_event'))
+ self.button_add = mouse_add
+ self.button_pop = mouse_pop
+ self.button_stop = mouse_stop
+
+ def post_event(self):
+ """Process an event."""
+ if len(self.events) == 0:
+ _log.warning("No events yet")
+ elif self.events[-1].name == 'key_press_event':
+ self.key_event()
+ else:
+ self.mouse_event()
+
+ def mouse_event(self):
+ """Process a mouse click event."""
+ event = self.events[-1]
+ button = event.button
+ if button == self.button_pop:
+ self.mouse_event_pop(event)
+ elif button == self.button_stop:
+ self.mouse_event_stop(event)
+ elif button == self.button_add:
+ self.mouse_event_add(event)
+
+ def key_event(self):
+ """
+ Process a key press event, mapping keys to appropriate mouse clicks.
+ """
+ event = self.events[-1]
+ if event.key is None:
+ # At least in OSX gtk backend some keys return None.
+ return
+ if event.key in ['backspace', 'delete']:
+ self.mouse_event_pop(event)
+ elif event.key in ['escape', 'enter']:
+ self.mouse_event_stop(event)
+ else:
+ self.mouse_event_add(event)
+
+ def mouse_event_add(self, event):
+ """
+ Process an button-1 event (add a click if inside axes).
+
+ Parameters
+ ----------
+ event : `~.backend_bases.MouseEvent`
+ """
+ if event.inaxes:
+ self.add_click(event)
+ else: # If not a valid click, remove from event list.
+ BlockingInput.pop(self)
+
+ def mouse_event_stop(self, event):
+ """
+ Process an button-2 event (end blocking input).
+
+ Parameters
+ ----------
+ event : `~.backend_bases.MouseEvent`
+ """
+ # Remove last event just for cleanliness.
+ BlockingInput.pop(self)
+ # This will exit even if not in infinite mode. This is consistent with
+ # MATLAB and sometimes quite useful, but will require the user to test
+ # how many points were actually returned before using data.
+ self.fig.canvas.stop_event_loop()
+
+ def mouse_event_pop(self, event):
+ """
+ Process an button-3 event (remove the last click).
+
+ Parameters
+ ----------
+ event : `~.backend_bases.MouseEvent`
+ """
+ # Remove this last event.
+ BlockingInput.pop(self)
+ # Now remove any existing clicks if possible.
+ if self.events:
+ self.pop(event)
+
+ def add_click(self, event):
+ """
+ Add the coordinates of an event to the list of clicks.
+
+ Parameters
+ ----------
+ event : `~.backend_bases.MouseEvent`
+ """
+ self.clicks.append((event.xdata, event.ydata))
+ _log.info("input %i: %f, %f",
+ len(self.clicks), event.xdata, event.ydata)
+ # If desired, plot up click.
+ if self.show_clicks:
+ line = mlines.Line2D([event.xdata], [event.ydata],
+ marker='+', color='r')
+ event.inaxes.add_line(line)
+ self.marks.append(line)
+ self.fig.canvas.draw()
+
+ def pop_click(self, event, index=-1):
+ """
+ Remove a click (by default, the last) from the list of clicks.
+
+ Parameters
+ ----------
+ event : `~.backend_bases.MouseEvent`
+ """
+ self.clicks.pop(index)
+ if self.show_clicks:
+ self.marks.pop(index).remove()
+ self.fig.canvas.draw()
+
+ def pop(self, event, index=-1):
+ """
+ Remove a click and the associated event from the list of clicks.
+
+ Defaults to the last click.
+ """
+ self.pop_click(event, index)
+ super().pop(index)
+
+ def cleanup(self, event=None):
+ """
+ Parameters
+ ----------
+ event : `~.backend_bases.MouseEvent`, optional
+ Not used
+ """
+ # Clean the figure.
+ if self.show_clicks:
+ for mark in self.marks:
+ mark.remove()
+ self.marks = []
+ self.fig.canvas.draw()
+ # Call base class to remove callbacks.
+ super().cleanup()
+
+ def __call__(self, n=1, timeout=30, show_clicks=True):
+ """
+ Blocking call to retrieve *n* coordinate pairs through mouse clicks.
+ """
+ self.show_clicks = show_clicks
+ self.clicks = []
+ self.marks = []
+ super().__call__(n=n, timeout=timeout)
+ return self.clicks
+
+
+class BlockingContourLabeler(BlockingMouseInput):
+ """
+ Callable for retrieving mouse clicks and key presses in a blocking way.
+
+ Used to place contour labels.
+ """
+
+ def __init__(self, cs):
+ self.cs = cs
+ super().__init__(fig=cs.axes.figure)
+
+ def add_click(self, event):
+ self.button1(event)
+
+ def pop_click(self, event, index=-1):
+ self.button3(event)
+
+ def button1(self, event):
+ """
+ Process an button-1 event (add a label to a contour).
+
+ Parameters
+ ----------
+ event : `~.backend_bases.MouseEvent`
+ """
+ # Shorthand
+ if event.inaxes == self.cs.ax:
+ self.cs.add_label_near(event.x, event.y, self.inline,
+ inline_spacing=self.inline_spacing,
+ transform=False)
+ self.fig.canvas.draw()
+ else: # Remove event if not valid
+ BlockingInput.pop(self)
+
+ def button3(self, event):
+ """
+ Process an button-3 event (remove a label if not in inline mode).
+
+ Unfortunately, if one is doing inline labels, then there is currently
+ no way to fix the broken contour - once humpty-dumpty is broken, he
+ can't be put back together. In inline mode, this does nothing.
+
+ Parameters
+ ----------
+ event : `~.backend_bases.MouseEvent`
+ """
+ if self.inline:
+ pass
+ else:
+ self.cs.pop_label()
+ self.cs.ax.figure.canvas.draw()
+
+ def __call__(self, inline, inline_spacing=5, n=-1, timeout=-1):
+ self.inline = inline
+ self.inline_spacing = inline_spacing
+ super().__call__(n=n, timeout=timeout, show_clicks=False)
+
+
+class BlockingKeyMouseInput(BlockingInput):
+ """
+ Callable for retrieving mouse clicks and key presses in a blocking way.
+ """
+
+ def __init__(self, fig):
+ super().__init__(fig=fig,
+ eventslist=('button_press_event', 'key_press_event'))
+
+ def post_event(self):
+ """Determine if it is a key event."""
+ if self.events:
+ self.keyormouse = self.events[-1].name == 'key_press_event'
+ else:
+ _log.warning("No events yet.")
+
+ def __call__(self, timeout=30):
+ """
+ Blocking call to retrieve a single mouse click or key press.
+
+ Returns ``True`` if key press, ``False`` if mouse click, or ``None`` if
+ timed out.
+ """
+ self.keyormouse = None
+ super().__call__(n=1, timeout=timeout)
+
+ return self.keyormouse
diff --git a/venv/Lib/site-packages/matplotlib/category.py b/venv/Lib/site-packages/matplotlib/category.py
new file mode 100644
index 0000000..2e7f19c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/category.py
@@ -0,0 +1,237 @@
+"""
+Plotting of string "category" data: ``plot(['d', 'f', 'a'], [1, 2, 3])`` will
+plot three points with x-axis values of 'd', 'f', 'a'.
+
+See :doc:`/gallery/lines_bars_and_markers/categorical_variables` for an
+example.
+
+The module uses Matplotlib's `matplotlib.units` mechanism to convert from
+strings to integers and provides a tick locator, a tick formatter, and the
+`.UnitData` class that creates and stores the string-to-integer mapping.
+"""
+
+from collections import OrderedDict
+import dateutil.parser
+import itertools
+import logging
+
+import numpy as np
+
+from matplotlib import _api, ticker, units
+
+
+_log = logging.getLogger(__name__)
+
+
+class StrCategoryConverter(units.ConversionInterface):
+ @staticmethod
+ def convert(value, unit, axis):
+ """
+ Convert strings in *value* to floats using mapping information stored
+ in the *unit* object.
+
+ Parameters
+ ----------
+ value : str or iterable
+ Value or list of values to be converted.
+ unit : `.UnitData`
+ An object mapping strings to integers.
+ axis : `~matplotlib.axis.Axis`
+ The axis on which the converted value is plotted.
+
+ .. note:: *axis* is unused.
+
+ Returns
+ -------
+ float or ndarray[float]
+ """
+ if unit is None:
+ raise ValueError(
+ 'Missing category information for StrCategoryConverter; '
+ 'this might be caused by unintendedly mixing categorical and '
+ 'numeric data')
+ StrCategoryConverter._validate_unit(unit)
+ # dtype = object preserves numerical pass throughs
+ values = np.atleast_1d(np.array(value, dtype=object))
+ # pass through sequence of non binary numbers
+ if all(units.ConversionInterface.is_numlike(v)
+ and not isinstance(v, (str, bytes))
+ for v in values):
+ return np.asarray(values, dtype=float)
+ # force an update so it also does type checking
+ unit.update(values)
+ return np.vectorize(unit._mapping.__getitem__, otypes=[float])(values)
+
+ @staticmethod
+ def axisinfo(unit, axis):
+ """
+ Set 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
+ -------
+ `~matplotlib.units.AxisInfo`
+ Information to support default tick labeling
+
+ .. note: axis is not used
+ """
+ StrCategoryConverter._validate_unit(unit)
+ # 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)
+
+ @staticmethod
+ def default_units(data, axis):
+ """
+ Set and update the `~matplotlib.axis.Axis` units.
+
+ Parameters
+ ----------
+ data : str or iterable of str
+ axis : `~matplotlib.axis.Axis`
+ axis on which the data is plotted
+
+ Returns
+ -------
+ `.UnitData`
+ object storing string to integer mapping
+ """
+ # the conversion call stack is default_units -> axis_info -> convert
+ if axis.units is None:
+ axis.set_units(UnitData(data))
+ else:
+ axis.units.update(data)
+ return axis.units
+
+ @staticmethod
+ def _validate_unit(unit):
+ if not hasattr(unit, '_mapping'):
+ raise ValueError(
+ f'Provided unit "{unit}" is not valid for a categorical '
+ 'converter, as it does not have a _mapping attribute.')
+
+
+class StrCategoryLocator(ticker.Locator):
+ """Tick at every integer mapping of the string data."""
+ def __init__(self, units_mapping):
+ """
+ Parameters
+ -----------
+ units_mapping : dict
+ Mapping of category names (str) to indices (int).
+ """
+ self._units = units_mapping
+
+ def __call__(self):
+ # docstring inherited
+ return list(self._units.values())
+
+ def tick_values(self, vmin, vmax):
+ # docstring inherited
+ return self()
+
+
+class StrCategoryFormatter(ticker.Formatter):
+ """String representation of the data at every tick."""
+ def __init__(self, units_mapping):
+ """
+ Parameters
+ ----------
+ units_mapping : dict
+ Mapping of category names (str) to indices (int).
+ """
+ self._units = units_mapping
+
+ def __call__(self, x, pos=None):
+ # docstring inherited
+ return self.format_ticks([x])[0]
+
+ def format_ticks(self, values):
+ # docstring inherited
+ r_mapping = {v: self._text(k) for k, v in self._units.items()}
+ return [r_mapping.get(round(val), '') for val in values]
+
+ @staticmethod
+ def _text(value):
+ """Convert text values into utf-8 or ascii strings."""
+ if isinstance(value, bytes):
+ value = value.decode(encoding='utf-8')
+ elif not isinstance(value, str):
+ value = str(value)
+ return value
+
+
+class UnitData:
+ def __init__(self, data=None):
+ """
+ Create mapping between unique categorical values and integer ids.
+
+ Parameters
+ ----------
+ data : iterable
+ sequence of string values
+ """
+ self._mapping = OrderedDict()
+ self._counter = itertools.count()
+ if data is not None:
+ self.update(data)
+
+ @staticmethod
+ def _str_is_convertible(val):
+ """
+ Helper method to check whether a string can be parsed as float or date.
+ """
+ try:
+ float(val)
+ except ValueError:
+ try:
+ dateutil.parser.parse(val)
+ except (ValueError, TypeError):
+ # TypeError if dateutil >= 2.8.1 else ValueError
+ return False
+ return True
+
+ def update(self, data):
+ """
+ Map new values to integer identifiers.
+
+ Parameters
+ ----------
+ data : iterable of str or bytes
+
+ Raises
+ ------
+ TypeError
+ If elements in *data* are neither str nor bytes.
+ """
+ data = np.atleast_1d(np.array(data, dtype=object))
+ # check if convertible to number:
+ convertible = True
+ for val in OrderedDict.fromkeys(data):
+ # OrderedDict just iterates over unique values in data.
+ _api.check_isinstance((str, bytes), value=val)
+ if convertible:
+ # this will only be called so long as convertible is True.
+ convertible = self._str_is_convertible(val)
+ if val not in self._mapping:
+ self._mapping[val] = next(self._counter)
+ if convertible:
+ _log.info('Using categorical units to plot a list of strings '
+ 'that are all parsable as floats or dates. If these '
+ 'strings should be plotted as numbers, cast to the '
+ 'appropriate data type before plotting.')
+
+
+# Register the converter with Matplotlib's unit framework
+units.registry[str] = StrCategoryConverter()
+units.registry[np.str_] = StrCategoryConverter()
+units.registry[bytes] = StrCategoryConverter()
+units.registry[np.bytes_] = StrCategoryConverter()
diff --git a/venv/Lib/site-packages/matplotlib/cbook/__init__.py b/venv/Lib/site-packages/matplotlib/cbook/__init__.py
new file mode 100644
index 0000000..7fae32c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/cbook/__init__.py
@@ -0,0 +1,2312 @@
+"""
+A collection of utility functions and classes. Originally, many
+(but not all) were from the Python Cookbook -- hence the name cbook.
+
+This module is safe to import from anywhere within Matplotlib;
+it imports Matplotlib only at runtime.
+"""
+
+import collections
+import collections.abc
+import contextlib
+import functools
+import gzip
+import itertools
+import operator
+import os
+from pathlib import Path
+import re
+import shlex
+import subprocess
+import sys
+import time
+import traceback
+import types
+import warnings
+import weakref
+
+import numpy as np
+
+import matplotlib
+from matplotlib import _api, _c_internal_utils
+from matplotlib._api.deprecation import (
+ MatplotlibDeprecationWarning, mplDeprecation)
+
+
+@_api.deprecated("3.4")
+def deprecated(*args, **kwargs):
+ return _api.deprecated(*args, **kwargs)
+
+
+@_api.deprecated("3.4")
+def warn_deprecated(*args, **kwargs):
+ _api.warn_deprecated(*args, **kwargs)
+
+
+def _get_running_interactive_framework():
+ """
+ Return the interactive framework whose event loop is currently running, if
+ any, or "headless" if no event loop can be started, or None.
+
+ Returns
+ -------
+ Optional[str]
+ One of the following values: "qt5", "qt4", "gtk3", "wx", "tk",
+ "macosx", "headless", ``None``.
+ """
+ QtWidgets = (sys.modules.get("PyQt5.QtWidgets")
+ or sys.modules.get("PySide2.QtWidgets"))
+ if QtWidgets and QtWidgets.QApplication.instance():
+ return "qt5"
+ QtGui = (sys.modules.get("PyQt4.QtGui")
+ or sys.modules.get("PySide.QtGui"))
+ if QtGui and QtGui.QApplication.instance():
+ return "qt4"
+ Gtk = sys.modules.get("gi.repository.Gtk")
+ if Gtk and Gtk.main_level():
+ return "gtk3"
+ wx = sys.modules.get("wx")
+ if wx and wx.GetApp():
+ return "wx"
+ tkinter = sys.modules.get("tkinter")
+ if tkinter:
+ codes = {tkinter.mainloop.__code__, tkinter.Misc.mainloop.__code__}
+ for frame in sys._current_frames().values():
+ while frame:
+ if frame.f_code in codes:
+ return "tk"
+ frame = frame.f_back
+ if 'matplotlib.backends._macosx' in sys.modules:
+ if sys.modules["matplotlib.backends._macosx"].event_loop_is_running():
+ return "macosx"
+ if not _c_internal_utils.display_is_valid():
+ return "headless"
+ return None
+
+
+def _exception_printer(exc):
+ if _get_running_interactive_framework() in ["headless", None]:
+ raise exc
+ else:
+ traceback.print_exc()
+
+
+class _StrongRef:
+ """
+ Wrapper similar to a weakref, but keeping a strong reference to the object.
+ """
+
+ def __init__(self, obj):
+ self._obj = obj
+
+ def __call__(self):
+ return self._obj
+
+ def __eq__(self, other):
+ return isinstance(other, _StrongRef) and self._obj == other._obj
+
+ def __hash__(self):
+ return hash(self._obj)
+
+
+def _weak_or_strong_ref(func, callback):
+ """
+ Return a `WeakMethod` wrapping *func* if possible, else a `_StrongRef`.
+ """
+ try:
+ return weakref.WeakMethod(func, callback)
+ except TypeError:
+ return _StrongRef(func)
+
+
+class CallbackRegistry:
+ """
+ Handle registering and disconnecting for a set of signals and callbacks:
+
+ >>> def oneat(x):
+ ... print('eat', x)
+ >>> def ondrink(x):
+ ... print('drink', x)
+
+ >>> from matplotlib.cbook import CallbackRegistry
+ >>> callbacks = CallbackRegistry()
+
+ >>> id_eat = callbacks.connect('eat', oneat)
+ >>> id_drink = callbacks.connect('drink', ondrink)
+
+ >>> callbacks.process('drink', 123)
+ drink 123
+ >>> callbacks.process('eat', 456)
+ eat 456
+ >>> callbacks.process('be merry', 456) # nothing will be called
+ >>> callbacks.disconnect(id_eat)
+ >>> callbacks.process('eat', 456) # nothing will be called
+
+ In practice, one should always disconnect all callbacks when they are
+ no longer needed to avoid dangling references (and thus memory leaks).
+ However, real code in Matplotlib rarely does so, and due to its design,
+ it is rather difficult to place this kind of code. To get around this,
+ and prevent this class of memory leaks, we instead store weak references
+ to bound methods only, so when the destination object needs to die, the
+ CallbackRegistry won't keep it alive.
+
+ Parameters
+ ----------
+ exception_handler : callable, optional
+ If not None, *exception_handler* must be a function that takes an
+ `Exception` as single parameter. It gets called with any `Exception`
+ raised by the callbacks during `CallbackRegistry.process`, and may
+ either re-raise the exception or handle it in another manner.
+
+ The default handler prints the exception (with `traceback.print_exc`) if
+ an interactive event loop is running; it re-raises the exception if no
+ interactive event loop is running.
+ """
+
+ # We maintain two mappings:
+ # callbacks: signal -> {cid -> weakref-to-callback}
+ # _func_cid_map: signal -> {weakref-to-callback -> cid}
+
+ def __init__(self, exception_handler=_exception_printer):
+ self.exception_handler = exception_handler
+ self.callbacks = {}
+ self._cid_gen = itertools.count()
+ self._func_cid_map = {}
+ # A hidden variable that marks cids that need to be pickled.
+ self._pickled_cids = set()
+
+ def __getstate__(self):
+ return {
+ **vars(self),
+ # In general, callbacks may not be pickled, so we just drop them,
+ # unless directed otherwise by self._pickled_cids.
+ "callbacks": {s: {cid: proxy() for cid, proxy in d.items()
+ if cid in self._pickled_cids}
+ for s, d in self.callbacks.items()},
+ # It is simpler to reconstruct this from callbacks in __setstate__.
+ "_func_cid_map": None,
+ }
+
+ def __setstate__(self, state):
+ vars(self).update(state)
+ self.callbacks = {
+ s: {cid: _weak_or_strong_ref(func, self._remove_proxy)
+ for cid, func in d.items()}
+ for s, d in self.callbacks.items()}
+ self._func_cid_map = {
+ s: {proxy: cid for cid, proxy in d.items()}
+ for s, d in self.callbacks.items()}
+
+ @_api.rename_parameter("3.4", "s", "signal")
+ def connect(self, signal, func):
+ """Register *func* to be called when signal *signal* is generated."""
+ self._func_cid_map.setdefault(signal, {})
+ proxy = _weak_or_strong_ref(func, self._remove_proxy)
+ if proxy in self._func_cid_map[signal]:
+ return self._func_cid_map[signal][proxy]
+ cid = next(self._cid_gen)
+ self._func_cid_map[signal][proxy] = cid
+ self.callbacks.setdefault(signal, {})
+ self.callbacks[signal][cid] = proxy
+ return cid
+
+ # Keep a reference to sys.is_finalizing, as sys may have been cleared out
+ # at that point.
+ def _remove_proxy(self, proxy, *, _is_finalizing=sys.is_finalizing):
+ if _is_finalizing():
+ # Weakrefs can't be properly torn down at that point anymore.
+ return
+ for signal, proxy_to_cid in list(self._func_cid_map.items()):
+ cid = proxy_to_cid.pop(proxy, None)
+ if cid is not None:
+ del self.callbacks[signal][cid]
+ self._pickled_cids.discard(cid)
+ break
+ else:
+ # Not found
+ return
+ # Clean up empty dicts
+ if len(self.callbacks[signal]) == 0:
+ del self.callbacks[signal]
+ del self._func_cid_map[signal]
+
+ def disconnect(self, cid):
+ """
+ Disconnect the callback registered with callback id *cid*.
+
+ No error is raised if such a callback does not exist.
+ """
+ self._pickled_cids.discard(cid)
+ # Clean up callbacks
+ for signal, cid_to_proxy in list(self.callbacks.items()):
+ proxy = cid_to_proxy.pop(cid, None)
+ if proxy is not None:
+ break
+ else:
+ # Not found
+ return
+
+ proxy_to_cid = self._func_cid_map[signal]
+ for current_proxy, current_cid in list(proxy_to_cid.items()):
+ if current_cid == cid:
+ assert proxy is current_proxy
+ del proxy_to_cid[current_proxy]
+ # Clean up empty dicts
+ if len(self.callbacks[signal]) == 0:
+ del self.callbacks[signal]
+ del self._func_cid_map[signal]
+
+ def process(self, s, *args, **kwargs):
+ """
+ Process signal *s*.
+
+ All of the functions registered to receive callbacks on *s* will be
+ called with ``*args`` and ``**kwargs``.
+ """
+ for cid, ref in list(self.callbacks.get(s, {}).items()):
+ func = ref()
+ if func is not None:
+ try:
+ func(*args, **kwargs)
+ # this does not capture KeyboardInterrupt, SystemExit,
+ # and GeneratorExit
+ except Exception as exc:
+ if self.exception_handler is not None:
+ self.exception_handler(exc)
+ else:
+ raise
+
+
+class silent_list(list):
+ """
+ A list with a short ``repr()``.
+
+ This is meant to be used for a homogeneous list of artists, so that they
+ don't cause long, meaningless output.
+
+ Instead of ::
+
+ [,
+ ,
+ ]
+
+ one will get ::
+
+
+
+ If ``self.type`` is None, the type name is obtained from the first item in
+ the list (if any).
+ """
+
+ def __init__(self, type, seq=None):
+ self.type = type
+ if seq is not None:
+ self.extend(seq)
+
+ def __repr__(self):
+ if self.type is not None or len(self) != 0:
+ tp = self.type if self.type is not None else type(self[0]).__name__
+ return f" "
+ else:
+ return ""
+
+
+@_api.deprecated("3.3")
+class IgnoredKeywordWarning(UserWarning):
+ """
+ A class for issuing warnings about keyword arguments that will be ignored
+ by Matplotlib.
+ """
+ pass
+
+
+@_api.deprecated("3.3", alternative="normalize_kwargs")
+def local_over_kwdict(local_var, kwargs, *keys):
+ """
+ Enforces the priority of a local variable over potentially conflicting
+ argument(s) from a kwargs dict. The following possible output values are
+ considered in order of priority::
+
+ local_var > kwargs[keys[0]] > ... > kwargs[keys[-1]]
+
+ The first of these whose value is not None will be returned. If all are
+ None then None will be returned. Each key in keys will be removed from the
+ kwargs dict in place.
+
+ Parameters
+ ----------
+ local_var : any object
+ The local variable (highest priority).
+
+ kwargs : dict
+ Dictionary of keyword arguments; modified in place.
+
+ keys : str(s)
+ Name(s) of keyword arguments to process, in descending order of
+ priority.
+
+ Returns
+ -------
+ any object
+ Either local_var or one of kwargs[key] for key in keys.
+
+ Raises
+ ------
+ IgnoredKeywordWarning
+ For each key in keys that is removed from kwargs but not used as
+ the output value.
+ """
+ return _local_over_kwdict(local_var, kwargs, *keys, IgnoredKeywordWarning)
+
+
+def _local_over_kwdict(
+ local_var, kwargs, *keys, warning_cls=MatplotlibDeprecationWarning):
+ out = local_var
+ for key in keys:
+ kwarg_val = kwargs.pop(key, None)
+ if kwarg_val is not None:
+ if out is None:
+ out = kwarg_val
+ else:
+ _api.warn_external(f'"{key}" keyword argument will be ignored',
+ warning_cls)
+ return out
+
+
+def strip_math(s):
+ """
+ Remove latex formatting from mathtext.
+
+ Only handles fully math and fully non-math strings.
+ """
+ if len(s) >= 2 and s[0] == s[-1] == "$":
+ s = s[1:-1]
+ for tex, plain in [
+ (r"\times", "x"), # Specifically for Formatter support.
+ (r"\mathdefault", ""),
+ (r"\rm", ""),
+ (r"\cal", ""),
+ (r"\tt", ""),
+ (r"\it", ""),
+ ("\\", ""),
+ ("{", ""),
+ ("}", ""),
+ ]:
+ s = s.replace(tex, plain)
+ return s
+
+
+def is_writable_file_like(obj):
+ """Return whether *obj* looks like a file object with a *write* method."""
+ return callable(getattr(obj, 'write', None))
+
+
+def file_requires_unicode(x):
+ """
+ Return whether the given writable file-like object requires Unicode to be
+ written to it.
+ """
+ try:
+ x.write(b'')
+ except TypeError:
+ return True
+ else:
+ return False
+
+
+def to_filehandle(fname, flag='r', return_opened=False, encoding=None):
+ """
+ Convert a path to an open file handle or pass-through a file-like object.
+
+ Consider using `open_file_cm` instead, as it allows one to properly close
+ newly created file objects more easily.
+
+ Parameters
+ ----------
+ fname : str or path-like or file-like
+ If `str` or `os.PathLike`, the file is opened using the flags specified
+ by *flag* and *encoding*. If a file-like object, it is passed through.
+ flag : str, default: 'r'
+ Passed as the *mode* argument to `open` when *fname* is `str` or
+ `os.PathLike`; ignored if *fname* is file-like.
+ return_opened : bool, default: False
+ If True, return both the file object and a boolean indicating whether
+ this was a new file (that the caller needs to close). If False, return
+ only the new file.
+ encoding : str or None, default: None
+ Passed as the *mode* argument to `open` when *fname* is `str` or
+ `os.PathLike`; ignored if *fname* is file-like.
+
+ Returns
+ -------
+ fh : file-like
+ opened : bool
+ *opened* is only returned if *return_opened* is True.
+ """
+ if isinstance(fname, os.PathLike):
+ fname = os.fspath(fname)
+ if "U" in flag:
+ _api.warn_deprecated(
+ "3.3", message="Passing a flag containing 'U' to to_filehandle() "
+ "is deprecated since %(since)s and will be removed %(removal)s.")
+ flag = flag.replace("U", "")
+ if isinstance(fname, str):
+ if fname.endswith('.gz'):
+ fh = gzip.open(fname, flag)
+ elif fname.endswith('.bz2'):
+ # python may not be complied with bz2 support,
+ # bury import until we need it
+ import bz2
+ fh = bz2.BZ2File(fname, flag)
+ else:
+ fh = open(fname, flag, encoding=encoding)
+ opened = True
+ elif hasattr(fname, 'seek'):
+ fh = fname
+ opened = False
+ else:
+ raise ValueError('fname must be a PathLike or file handle')
+ if return_opened:
+ return fh, opened
+ return fh
+
+
+@contextlib.contextmanager
+def open_file_cm(path_or_file, mode="r", encoding=None):
+ r"""Pass through file objects and context-manage path-likes."""
+ fh, opened = to_filehandle(path_or_file, mode, True, encoding)
+ if opened:
+ with fh:
+ yield fh
+ else:
+ yield fh
+
+
+def is_scalar_or_string(val):
+ """Return whether the given object is a scalar or string like."""
+ return isinstance(val, str) or not np.iterable(val)
+
+
+def get_sample_data(fname, asfileobj=True, *, np_load=False):
+ """
+ Return a sample data file. *fname* is a path relative to the
+ :file:`mpl-data/sample_data` directory. If *asfileobj* is `True`
+ return a file object, otherwise just a file path.
+
+ Sample data files are stored in the 'mpl-data/sample_data' directory within
+ the Matplotlib package.
+
+ If the filename ends in .gz, the file is implicitly ungzipped. If the
+ filename ends with .npy or .npz, *asfileobj* is True, and *np_load* is
+ True, the file is loaded with `numpy.load`. *np_load* currently defaults
+ to False but will default to True in a future release.
+ """
+ path = _get_data_path('sample_data', fname)
+ if asfileobj:
+ suffix = path.suffix.lower()
+ if suffix == '.gz':
+ return gzip.open(path)
+ elif suffix in ['.npy', '.npz']:
+ if np_load:
+ return np.load(path)
+ else:
+ _api.warn_deprecated(
+ "3.3", message="In a future release, get_sample_data "
+ "will automatically load numpy arrays. Set np_load to "
+ "True to get the array and suppress this warning. Set "
+ "asfileobj to False to get the path to the data file and "
+ "suppress this warning.")
+ return path.open('rb')
+ elif suffix in ['.csv', '.xrc', '.txt']:
+ return path.open('r')
+ else:
+ return path.open('rb')
+ else:
+ return str(path)
+
+
+def _get_data_path(*args):
+ """
+ Return the `pathlib.Path` to a resource file provided by Matplotlib.
+
+ ``*args`` specify a path relative to the base data path.
+ """
+ return Path(matplotlib.get_data_path(), *args)
+
+
+def flatten(seq, scalarp=is_scalar_or_string):
+ """
+ Return a generator of flattened nested containers.
+
+ For example:
+
+ >>> from matplotlib.cbook import flatten
+ >>> l = (('John', ['Hunter']), (1, 23), [[([42, (5, 23)], )]])
+ >>> print(list(flatten(l)))
+ ['John', 'Hunter', 1, 23, 42, 5, 23]
+
+ By: Composite of Holger Krekel and Luther Blissett
+ From: https://code.activestate.com/recipes/121294/
+ and Recipe 1.12 in cookbook
+ """
+ for item in seq:
+ if scalarp(item) or item is None:
+ yield item
+ else:
+ yield from flatten(item, scalarp)
+
+
+@_api.deprecated("3.3", alternative="os.path.realpath and os.stat")
+@functools.lru_cache()
+def get_realpath_and_stat(path):
+ realpath = os.path.realpath(path)
+ stat = os.stat(realpath)
+ stat_key = (stat.st_ino, stat.st_dev)
+ return realpath, stat_key
+
+
+# A regular expression used to determine the amount of space to
+# remove. It looks for the first sequence of spaces immediately
+# following the first newline, or at the beginning of the string.
+_find_dedent_regex = re.compile(r"(?:(?:\n\r?)|^)( *)\S")
+# A cache to hold the regexs that actually remove the indent.
+_dedent_regex = {}
+
+
+class maxdict(dict):
+ """
+ A dictionary with a maximum size.
+
+ Notes
+ -----
+ This doesn't override all the relevant methods to constrain the size,
+ just ``__setitem__``, so use with caution.
+ """
+ def __init__(self, maxsize):
+ dict.__init__(self)
+ self.maxsize = maxsize
+ self._killkeys = []
+
+ def __setitem__(self, k, v):
+ if k not in self:
+ if len(self) >= self.maxsize:
+ del self[self._killkeys[0]]
+ del self._killkeys[0]
+ self._killkeys.append(k)
+ dict.__setitem__(self, k, v)
+
+
+class Stack:
+ """
+ Stack of elements with a movable cursor.
+
+ Mimics home/back/forward in a web browser.
+ """
+
+ def __init__(self, default=None):
+ self.clear()
+ self._default = default
+
+ def __call__(self):
+ """Return the current element, or None."""
+ if not self._elements:
+ return self._default
+ else:
+ return self._elements[self._pos]
+
+ def __len__(self):
+ return len(self._elements)
+
+ def __getitem__(self, ind):
+ return self._elements[ind]
+
+ def forward(self):
+ """Move the position forward and return the current element."""
+ self._pos = min(self._pos + 1, len(self._elements) - 1)
+ return self()
+
+ def back(self):
+ """Move the position back and return the current element."""
+ if self._pos > 0:
+ self._pos -= 1
+ return self()
+
+ def push(self, o):
+ """
+ Push *o* to the stack at current position. Discard all later elements.
+
+ *o* is returned.
+ """
+ self._elements = self._elements[:self._pos + 1] + [o]
+ self._pos = len(self._elements) - 1
+ return self()
+
+ def home(self):
+ """
+ Push the first element onto the top of the stack.
+
+ The first element is returned.
+ """
+ if not self._elements:
+ return
+ self.push(self._elements[0])
+ return self()
+
+ def empty(self):
+ """Return whether the stack is empty."""
+ return len(self._elements) == 0
+
+ def clear(self):
+ """Empty the stack."""
+ self._pos = -1
+ self._elements = []
+
+ def bubble(self, o):
+ """
+ Raise all references of *o* to the top of the stack, and return it.
+
+ Raises
+ ------
+ ValueError
+ If *o* is not in the stack.
+ """
+ if o not in self._elements:
+ raise ValueError('Given element not contained in the stack')
+ old_elements = self._elements.copy()
+ self.clear()
+ top_elements = []
+ for elem in old_elements:
+ if elem == o:
+ top_elements.append(elem)
+ else:
+ self.push(elem)
+ for _ in top_elements:
+ self.push(o)
+ return o
+
+ def remove(self, o):
+ """
+ Remove *o* from the stack.
+
+ Raises
+ ------
+ ValueError
+ If *o* is not in the stack.
+ """
+ if o not in self._elements:
+ raise ValueError('Given element not contained in the stack')
+ old_elements = self._elements.copy()
+ self.clear()
+ for elem in old_elements:
+ if elem != o:
+ self.push(elem)
+
+
+def report_memory(i=0): # argument may go away
+ """Return the memory consumed by the process."""
+ def call(command, os_name):
+ try:
+ return subprocess.check_output(command)
+ except subprocess.CalledProcessError as err:
+ raise NotImplementedError(
+ "report_memory works on %s only if "
+ "the '%s' program is found" % (os_name, command[0])
+ ) from err
+
+ pid = os.getpid()
+ if sys.platform == 'sunos5':
+ lines = call(['ps', '-p', '%d' % pid, '-o', 'osz'], 'Sun OS')
+ mem = int(lines[-1].strip())
+ elif sys.platform == 'linux':
+ lines = call(['ps', '-p', '%d' % pid, '-o', 'rss,sz'], 'Linux')
+ mem = int(lines[1].split()[1])
+ elif sys.platform == 'darwin':
+ lines = call(['ps', '-p', '%d' % pid, '-o', 'rss,vsz'], 'Mac OS')
+ mem = int(lines[1].split()[0])
+ elif sys.platform == 'win32':
+ lines = call(["tasklist", "/nh", "/fi", "pid eq %d" % pid], 'Windows')
+ mem = int(lines.strip().split()[-2].replace(',', ''))
+ else:
+ raise NotImplementedError(
+ "We don't have a memory monitor for %s" % sys.platform)
+ return mem
+
+
+def safe_masked_invalid(x, copy=False):
+ x = np.array(x, subok=True, copy=copy)
+ if not x.dtype.isnative:
+ # If we have already made a copy, do the byteswap in place, else make a
+ # copy with the byte order swapped.
+ x = x.byteswap(inplace=copy).newbyteorder('N') # Swap to native order.
+ try:
+ xm = np.ma.masked_invalid(x, copy=False)
+ xm.shrink_mask()
+ except TypeError:
+ return x
+ return xm
+
+
+def print_cycles(objects, outstream=sys.stdout, show_progress=False):
+ """
+ Print loops of cyclic references in the given *objects*.
+
+ It is often useful to pass in ``gc.garbage`` to find the cycles that are
+ preventing some objects from being garbage collected.
+
+ Parameters
+ ----------
+ objects
+ A list of objects to find cycles in.
+ outstream
+ The stream for output.
+ show_progress : bool
+ If True, print the number of objects reached as they are found.
+ """
+ import gc
+
+ def print_path(path):
+ for i, step in enumerate(path):
+ # next "wraps around"
+ next = path[(i + 1) % len(path)]
+
+ outstream.write(" %s -- " % type(step))
+ if isinstance(step, dict):
+ for key, val in step.items():
+ if val is next:
+ outstream.write("[{!r}]".format(key))
+ break
+ if key is next:
+ outstream.write("[key] = {!r}".format(val))
+ break
+ elif isinstance(step, list):
+ outstream.write("[%d]" % step.index(next))
+ elif isinstance(step, tuple):
+ outstream.write("( tuple )")
+ else:
+ outstream.write(repr(step))
+ outstream.write(" ->\n")
+ outstream.write("\n")
+
+ def recurse(obj, start, all, current_path):
+ if show_progress:
+ outstream.write("%d\r" % len(all))
+
+ all[id(obj)] = None
+
+ referents = gc.get_referents(obj)
+ for referent in referents:
+ # If we've found our way back to the start, this is
+ # a cycle, so print it out
+ if referent is start:
+ print_path(current_path)
+
+ # Don't go back through the original list of objects, or
+ # through temporary references to the object, since those
+ # are just an artifact of the cycle detector itself.
+ elif referent is objects or isinstance(referent, types.FrameType):
+ continue
+
+ # We haven't seen this object before, so recurse
+ elif id(referent) not in all:
+ recurse(referent, start, all, current_path + [obj])
+
+ for obj in objects:
+ outstream.write(f"Examining: {obj!r}\n")
+ recurse(obj, obj, {}, [])
+
+
+class Grouper:
+ """
+ A disjoint-set data structure.
+
+ Objects can be joined using :meth:`join`, tested for connectedness
+ using :meth:`joined`, and all disjoint sets can be retrieved by
+ using the object as an iterator.
+
+ The objects being joined must be hashable and weak-referenceable.
+
+ Examples
+ --------
+ >>> from matplotlib.cbook import Grouper
+ >>> class Foo:
+ ... def __init__(self, s):
+ ... self.s = s
+ ... def __repr__(self):
+ ... return self.s
+ ...
+ >>> a, b, c, d, e, f = [Foo(x) for x in 'abcdef']
+ >>> grp = Grouper()
+ >>> grp.join(a, b)
+ >>> grp.join(b, c)
+ >>> grp.join(d, e)
+ >>> list(grp)
+ [[a, b, c], [d, e]]
+ >>> grp.joined(a, b)
+ True
+ >>> grp.joined(a, c)
+ True
+ >>> grp.joined(a, d)
+ False
+ """
+
+ def __init__(self, init=()):
+ self._mapping = {weakref.ref(x): [weakref.ref(x)] for x in init}
+
+ def __contains__(self, item):
+ return weakref.ref(item) in self._mapping
+
+ def clean(self):
+ """Clean dead weak references from the dictionary."""
+ mapping = self._mapping
+ to_drop = [key for key in mapping if key() is None]
+ for key in to_drop:
+ val = mapping.pop(key)
+ val.remove(key)
+
+ def join(self, a, *args):
+ """
+ Join given arguments into the same set. Accepts one or more arguments.
+ """
+ mapping = self._mapping
+ set_a = mapping.setdefault(weakref.ref(a), [weakref.ref(a)])
+
+ for arg in args:
+ set_b = mapping.get(weakref.ref(arg), [weakref.ref(arg)])
+ if set_b is not set_a:
+ if len(set_b) > len(set_a):
+ set_a, set_b = set_b, set_a
+ set_a.extend(set_b)
+ for elem in set_b:
+ mapping[elem] = set_a
+
+ self.clean()
+
+ def joined(self, a, b):
+ """Return whether *a* and *b* are members of the same set."""
+ self.clean()
+ return (self._mapping.get(weakref.ref(a), object())
+ is self._mapping.get(weakref.ref(b)))
+
+ def remove(self, a):
+ self.clean()
+ set_a = self._mapping.pop(weakref.ref(a), None)
+ if set_a:
+ set_a.remove(weakref.ref(a))
+
+ def __iter__(self):
+ """
+ Iterate over each of the disjoint sets as a list.
+
+ The iterator is invalid if interleaved with calls to join().
+ """
+ self.clean()
+ unique_groups = {id(group): group for group in self._mapping.values()}
+ for group in unique_groups.values():
+ yield [x() for x in group]
+
+ def get_siblings(self, a):
+ """Return all of the items joined with *a*, including itself."""
+ self.clean()
+ siblings = self._mapping.get(weakref.ref(a), [weakref.ref(a)])
+ return [x() for x in siblings]
+
+
+def simple_linear_interpolation(a, steps):
+ """
+ Resample an array with ``steps - 1`` points between original point pairs.
+
+ Along each column of *a*, ``(steps - 1)`` points are introduced between
+ each original values; the values are linearly interpolated.
+
+ Parameters
+ ----------
+ a : array, shape (n, ...)
+ steps : int
+
+ Returns
+ -------
+ array
+ shape ``((n - 1) * steps + 1, ...)``
+ """
+ fps = a.reshape((len(a), -1))
+ xp = np.arange(len(a)) * steps
+ x = np.arange((len(a) - 1) * steps + 1)
+ return (np.column_stack([np.interp(x, xp, fp) for fp in fps.T])
+ .reshape((len(x),) + a.shape[1:]))
+
+
+def delete_masked_points(*args):
+ """
+ Find all masked and/or non-finite points in a set of arguments,
+ and return the arguments with only the unmasked points remaining.
+
+ Arguments can be in any of 5 categories:
+
+ 1) 1-D masked arrays
+ 2) 1-D ndarrays
+ 3) ndarrays with more than one dimension
+ 4) other non-string iterables
+ 5) anything else
+
+ The first argument must be in one of the first four categories;
+ any argument with a length differing from that of the first
+ argument (and hence anything in category 5) then will be
+ passed through unchanged.
+
+ Masks are obtained from all arguments of the correct length
+ in categories 1, 2, and 4; a point is bad if masked in a masked
+ array or if it is a nan or inf. No attempt is made to
+ extract a mask from categories 2, 3, and 4 if `numpy.isfinite`
+ does not yield a Boolean array.
+
+ All input arguments that are not passed unchanged are returned
+ as ndarrays after removing the points or rows corresponding to
+ masks in any of the arguments.
+
+ A vastly simpler version of this function was originally
+ written as a helper for Axes.scatter().
+
+ """
+ if not len(args):
+ return ()
+ if is_scalar_or_string(args[0]):
+ raise ValueError("First argument must be a sequence")
+ nrecs = len(args[0])
+ margs = []
+ seqlist = [False] * len(args)
+ for i, x in enumerate(args):
+ if not isinstance(x, str) and np.iterable(x) and len(x) == nrecs:
+ seqlist[i] = True
+ if isinstance(x, np.ma.MaskedArray):
+ if x.ndim > 1:
+ raise ValueError("Masked arrays must be 1-D")
+ else:
+ x = np.asarray(x)
+ margs.append(x)
+ masks = [] # list of masks that are True where good
+ for i, x in enumerate(margs):
+ if seqlist[i]:
+ if x.ndim > 1:
+ continue # Don't try to get nan locations unless 1-D.
+ if isinstance(x, np.ma.MaskedArray):
+ masks.append(~np.ma.getmaskarray(x)) # invert the mask
+ xd = x.data
+ else:
+ xd = x
+ try:
+ mask = np.isfinite(xd)
+ if isinstance(mask, np.ndarray):
+ masks.append(mask)
+ except Exception: # Fixme: put in tuple of possible exceptions?
+ pass
+ if len(masks):
+ mask = np.logical_and.reduce(masks)
+ igood = mask.nonzero()[0]
+ if len(igood) < nrecs:
+ for i, x in enumerate(margs):
+ if seqlist[i]:
+ margs[i] = x[igood]
+ for i, x in enumerate(margs):
+ if seqlist[i] and isinstance(x, np.ma.MaskedArray):
+ margs[i] = x.filled()
+ return margs
+
+
+def _combine_masks(*args):
+ """
+ Find all masked and/or non-finite points in a set of arguments,
+ and return the arguments as masked arrays with a common mask.
+
+ Arguments can be in any of 5 categories:
+
+ 1) 1-D masked arrays
+ 2) 1-D ndarrays
+ 3) ndarrays with more than one dimension
+ 4) other non-string iterables
+ 5) anything else
+
+ The first argument must be in one of the first four categories;
+ any argument with a length differing from that of the first
+ argument (and hence anything in category 5) then will be
+ passed through unchanged.
+
+ Masks are obtained from all arguments of the correct length
+ in categories 1, 2, and 4; a point is bad if masked in a masked
+ array or if it is a nan or inf. No attempt is made to
+ extract a mask from categories 2 and 4 if `numpy.isfinite`
+ does not yield a Boolean array. Category 3 is included to
+ support RGB or RGBA ndarrays, which are assumed to have only
+ valid values and which are passed through unchanged.
+
+ All input arguments that are not passed unchanged are returned
+ as masked arrays if any masked points are found, otherwise as
+ ndarrays.
+
+ """
+ if not len(args):
+ return ()
+ if is_scalar_or_string(args[0]):
+ raise ValueError("First argument must be a sequence")
+ nrecs = len(args[0])
+ margs = [] # Output args; some may be modified.
+ seqlist = [False] * len(args) # Flags: True if output will be masked.
+ masks = [] # List of masks.
+ for i, x in enumerate(args):
+ if is_scalar_or_string(x) or len(x) != nrecs:
+ margs.append(x) # Leave it unmodified.
+ else:
+ if isinstance(x, np.ma.MaskedArray) and x.ndim > 1:
+ raise ValueError("Masked arrays must be 1-D")
+ try:
+ x = np.asanyarray(x)
+ except (np.VisibleDeprecationWarning, ValueError):
+ # NumPy 1.19 raises a warning about ragged arrays, but we want
+ # to accept basically anything here.
+ x = np.asanyarray(x, dtype=object)
+ if x.ndim == 1:
+ x = safe_masked_invalid(x)
+ seqlist[i] = True
+ if np.ma.is_masked(x):
+ masks.append(np.ma.getmaskarray(x))
+ margs.append(x) # Possibly modified.
+ if len(masks):
+ mask = np.logical_or.reduce(masks)
+ for i, x in enumerate(margs):
+ if seqlist[i]:
+ margs[i] = np.ma.array(x, mask=mask)
+ return margs
+
+
+def boxplot_stats(X, whis=1.5, bootstrap=None, labels=None,
+ autorange=False):
+ r"""
+ Return a list of dictionaries of statistics used to draw a series of box
+ and whisker plots using `~.Axes.bxp`.
+
+ Parameters
+ ----------
+ X : array-like
+ Data that will be represented in the boxplots. Should have 2 or
+ fewer dimensions.
+
+ whis : float or (float, float), default: 1.5
+ The position of the whiskers.
+
+ If a float, the lower whisker is at the lowest datum above
+ ``Q1 - whis*(Q3-Q1)``, and the upper whisker at the highest datum below
+ ``Q3 + whis*(Q3-Q1)``, where Q1 and Q3 are the first and third
+ quartiles. The default value of ``whis = 1.5`` corresponds to Tukey's
+ original definition of boxplots.
+
+ If a pair of floats, they indicate the percentiles at which to draw the
+ whiskers (e.g., (5, 95)). In particular, setting this to (0, 100)
+ results in whiskers covering the whole range of the data.
+
+ In the edge case where ``Q1 == Q3``, *whis* is automatically set to
+ (0, 100) (cover the whole range of the data) if *autorange* is True.
+
+ Beyond the whiskers, data are considered outliers and are plotted as
+ individual points.
+
+ bootstrap : int, optional
+ Number of times the confidence intervals around the median
+ should be bootstrapped (percentile method).
+
+ labels : array-like, optional
+ Labels for each dataset. Length must be compatible with
+ dimensions of *X*.
+
+ autorange : bool, optional (False)
+ When `True` and the data are distributed such that the 25th and 75th
+ percentiles are equal, ``whis`` is set to (0, 100) such that the
+ whisker ends are at the minimum and maximum of the data.
+
+ Returns
+ -------
+ list of dict
+ A list of dictionaries containing the results for each column
+ of data. Keys of each dictionary are the following:
+
+ ======== ===================================
+ Key Value Description
+ ======== ===================================
+ label tick label for the boxplot
+ mean arithmetic mean value
+ med 50th percentile
+ q1 first quartile (25th percentile)
+ q3 third quartile (75th percentile)
+ cilo lower notch around the median
+ cihi upper notch around the median
+ whislo end of the lower whisker
+ whishi end of the upper whisker
+ fliers outliers
+ ======== ===================================
+
+ Notes
+ -----
+ Non-bootstrapping approach to confidence interval uses Gaussian-based
+ asymptotic approximation:
+
+ .. math::
+
+ \mathrm{med} \pm 1.57 \times \frac{\mathrm{iqr}}{\sqrt{N}}
+
+ General approach from:
+ McGill, R., Tukey, J.W., and Larsen, W.A. (1978) "Variations of
+ Boxplots", The American Statistician, 32:12-16.
+ """
+
+ def _bootstrap_median(data, N=5000):
+ # determine 95% confidence intervals of the median
+ M = len(data)
+ percentiles = [2.5, 97.5]
+
+ bs_index = np.random.randint(M, size=(N, M))
+ bsData = data[bs_index]
+ estimate = np.median(bsData, axis=1, overwrite_input=True)
+
+ CI = np.percentile(estimate, percentiles)
+ return CI
+
+ def _compute_conf_interval(data, med, iqr, bootstrap):
+ if bootstrap is not None:
+ # Do a bootstrap estimate of notch locations.
+ # get conf. intervals around median
+ CI = _bootstrap_median(data, N=bootstrap)
+ notch_min = CI[0]
+ notch_max = CI[1]
+ else:
+
+ N = len(data)
+ notch_min = med - 1.57 * iqr / np.sqrt(N)
+ notch_max = med + 1.57 * iqr / np.sqrt(N)
+
+ return notch_min, notch_max
+
+ # output is a list of dicts
+ bxpstats = []
+
+ # convert X to a list of lists
+ X = _reshape_2D(X, "X")
+
+ ncols = len(X)
+ if labels is None:
+ labels = itertools.repeat(None)
+ elif len(labels) != ncols:
+ raise ValueError("Dimensions of labels and X must be compatible")
+
+ input_whis = whis
+ for ii, (x, label) in enumerate(zip(X, labels)):
+
+ # empty dict
+ stats = {}
+ if label is not None:
+ stats['label'] = label
+
+ # restore whis to the input values in case it got changed in the loop
+ whis = input_whis
+
+ # note tricksiness, append up here and then mutate below
+ bxpstats.append(stats)
+
+ # if empty, bail
+ if len(x) == 0:
+ stats['fliers'] = np.array([])
+ stats['mean'] = np.nan
+ stats['med'] = np.nan
+ stats['q1'] = np.nan
+ stats['q3'] = np.nan
+ stats['cilo'] = np.nan
+ stats['cihi'] = np.nan
+ stats['whislo'] = np.nan
+ stats['whishi'] = np.nan
+ stats['med'] = np.nan
+ continue
+
+ # up-convert to an array, just to be safe
+ x = np.asarray(x)
+
+ # arithmetic mean
+ stats['mean'] = np.mean(x)
+
+ # medians and quartiles
+ q1, med, q3 = np.percentile(x, [25, 50, 75])
+
+ # interquartile range
+ stats['iqr'] = q3 - q1
+ if stats['iqr'] == 0 and autorange:
+ whis = (0, 100)
+
+ # conf. interval around median
+ stats['cilo'], stats['cihi'] = _compute_conf_interval(
+ x, med, stats['iqr'], bootstrap
+ )
+
+ # lowest/highest non-outliers
+ if np.iterable(whis) and not isinstance(whis, str):
+ loval, hival = np.percentile(x, whis)
+ elif np.isreal(whis):
+ loval = q1 - whis * stats['iqr']
+ hival = q3 + whis * stats['iqr']
+ else:
+ raise ValueError('whis must be a float or list of percentiles')
+
+ # get high extreme
+ wiskhi = x[x <= hival]
+ if len(wiskhi) == 0 or np.max(wiskhi) < q3:
+ stats['whishi'] = q3
+ else:
+ stats['whishi'] = np.max(wiskhi)
+
+ # get low extreme
+ wisklo = x[x >= loval]
+ if len(wisklo) == 0 or np.min(wisklo) > q1:
+ stats['whislo'] = q1
+ else:
+ stats['whislo'] = np.min(wisklo)
+
+ # compute a single array of outliers
+ stats['fliers'] = np.concatenate([
+ x[x < stats['whislo']],
+ x[x > stats['whishi']],
+ ])
+
+ # add in the remaining stats
+ stats['q1'], stats['med'], stats['q3'] = q1, med, q3
+
+ return bxpstats
+
+
+#: Maps short codes for line style to their full name used by backends.
+ls_mapper = {'-': 'solid', '--': 'dashed', '-.': 'dashdot', ':': 'dotted'}
+#: Maps full names for line styles used by backends to their short codes.
+ls_mapper_r = {v: k for k, v in ls_mapper.items()}
+
+
+def contiguous_regions(mask):
+ """
+ Return a list of (ind0, ind1) such that ``mask[ind0:ind1].all()`` is
+ True and we cover all such regions.
+ """
+ mask = np.asarray(mask, dtype=bool)
+
+ if not mask.size:
+ return []
+
+ # Find the indices of region changes, and correct offset
+ idx, = np.nonzero(mask[:-1] != mask[1:])
+ idx += 1
+
+ # List operations are faster for moderately sized arrays
+ idx = idx.tolist()
+
+ # Add first and/or last index if needed
+ if mask[0]:
+ idx = [0] + idx
+ if mask[-1]:
+ idx.append(len(mask))
+
+ return list(zip(idx[::2], idx[1::2]))
+
+
+def is_math_text(s):
+ """
+ Return whether the string *s* contains math expressions.
+
+ This is done by checking whether *s* contains an even number of
+ non-escaped dollar signs.
+ """
+ s = str(s)
+ dollar_count = s.count(r'$') - s.count(r'\$')
+ even_dollars = (dollar_count > 0 and dollar_count % 2 == 0)
+ return even_dollars
+
+
+def _to_unmasked_float_array(x):
+ """
+ Convert a sequence to a float array; if input was a masked array, masked
+ values are converted to nans.
+ """
+ if hasattr(x, 'mask'):
+ return np.ma.asarray(x, float).filled(np.nan)
+ else:
+ return np.asarray(x, float)
+
+
+def _check_1d(x):
+ """Convert scalars to 1D arrays; pass-through arrays as is."""
+ if not hasattr(x, 'shape') or len(x.shape) < 1:
+ return np.atleast_1d(x)
+ else:
+ try:
+ # work around
+ # https://github.com/pandas-dev/pandas/issues/27775 which
+ # means the shape of multi-dimensional slicing is not as
+ # expected. That this ever worked was an unintentional
+ # quirk of pandas and will raise an exception in the
+ # future. This slicing warns in pandas >= 1.0rc0 via
+ # https://github.com/pandas-dev/pandas/pull/30588
+ #
+ # < 1.0rc0 : x[:, None].ndim == 1, no warning, custom type
+ # >= 1.0rc1 : x[:, None].ndim == 2, warns, numpy array
+ # future : x[:, None] -> raises
+ #
+ # This code should correctly identify and coerce to a
+ # numpy array all pandas versions.
+ with warnings.catch_warnings(record=True) as w:
+ warnings.filterwarnings(
+ "always",
+ category=Warning,
+ message='Support for multi-dimensional indexing')
+
+ ndim = x[:, None].ndim
+ # we have definitely hit a pandas index or series object
+ # cast to a numpy array.
+ if len(w) > 0:
+ return np.asanyarray(x)
+ # We have likely hit a pandas object, or at least
+ # something where 2D slicing does not result in a 2D
+ # object.
+ if ndim < 2:
+ return np.atleast_1d(x)
+ return x
+ # In pandas 1.1.0, multidimensional indexing leads to an
+ # AssertionError for some Series objects, but should be
+ # IndexError as described in
+ # https://github.com/pandas-dev/pandas/issues/35527
+ except (AssertionError, IndexError, TypeError):
+ return np.atleast_1d(x)
+
+
+def _reshape_2D(X, name):
+ """
+ Use Fortran ordering to convert ndarrays and lists of iterables to lists of
+ 1D arrays.
+
+ Lists of iterables are converted by applying `numpy.asanyarray` to each of
+ their elements. 1D ndarrays are returned in a singleton list containing
+ them. 2D ndarrays are converted to the list of their *columns*.
+
+ *name* is used to generate the error message for invalid inputs.
+ """
+
+ # unpack if we have a values or to_numpy method.
+ try:
+ X = X.to_numpy()
+ except AttributeError:
+ try:
+ if isinstance(X.values, np.ndarray):
+ X = X.values
+ except AttributeError:
+ pass
+
+ # Iterate over columns for ndarrays.
+ if isinstance(X, np.ndarray):
+ X = X.T
+
+ if len(X) == 0:
+ return [[]]
+ elif X.ndim == 1 and np.ndim(X[0]) == 0:
+ # 1D array of scalars: directly return it.
+ return [X]
+ elif X.ndim in [1, 2]:
+ # 2D array, or 1D array of iterables: flatten them first.
+ return [np.reshape(x, -1) for x in X]
+ else:
+ raise ValueError(f'{name} must have 2 or fewer dimensions')
+
+ # Iterate over list of iterables.
+ if len(X) == 0:
+ return [[]]
+
+ result = []
+ is_1d = True
+ for xi in X:
+ # check if this is iterable, except for strings which we
+ # treat as singletons.
+ if (isinstance(xi, collections.abc.Iterable) and
+ not isinstance(xi, str)):
+ is_1d = False
+ xi = np.asanyarray(xi)
+ nd = np.ndim(xi)
+ if nd > 1:
+ raise ValueError(f'{name} must have 2 or fewer dimensions')
+ result.append(xi.reshape(-1))
+
+ if is_1d:
+ # 1D array of scalars: directly return it.
+ return [np.reshape(result, -1)]
+ else:
+ # 2D array, or 1D array of iterables: use flattened version.
+ return result
+
+
+def violin_stats(X, method, points=100, quantiles=None):
+ """
+ Return a list of dictionaries of data which can be used to draw a series
+ of violin plots.
+
+ See the ``Returns`` section below to view the required keys of the
+ dictionary.
+
+ Users can skip this function and pass a user-defined set of dictionaries
+ with the same keys to `~.axes.Axes.violinplot` instead of using Matplotlib
+ to do the calculations. See the *Returns* section below for the keys
+ that must be present in the dictionaries.
+
+ Parameters
+ ----------
+ X : array-like
+ Sample data that will be used to produce the gaussian kernel density
+ estimates. Must have 2 or fewer dimensions.
+
+ method : callable
+ The method used to calculate the kernel density estimate for each
+ column of data. When called via ``method(v, coords)``, it should
+ return a vector of the values of the KDE evaluated at the values
+ specified in coords.
+
+ points : int, default: 100
+ Defines the number of points to evaluate each of the gaussian kernel
+ density estimates at.
+
+ quantiles : array-like, default: None
+ Defines (if not None) a list of floats in interval [0, 1] for each
+ column of data, which represents the quantiles that will be rendered
+ for that column of data. Must have 2 or fewer dimensions. 1D array will
+ be treated as a singleton list containing them.
+
+ Returns
+ -------
+ list of dict
+ A list of dictionaries containing the results for each column of data.
+ The dictionaries contain at least the following:
+
+ - coords: A list of scalars containing the coordinates this particular
+ kernel density estimate was evaluated at.
+ - vals: A list of scalars containing the values of the kernel density
+ estimate at each of the coordinates given in *coords*.
+ - mean: The mean value for this column of data.
+ - median: The median value for this column of data.
+ - min: The minimum value for this column of data.
+ - max: The maximum value for this column of data.
+ - quantiles: The quantile values for this column of data.
+ """
+
+ # List of dictionaries describing each of the violins.
+ vpstats = []
+
+ # Want X to be a list of data sequences
+ X = _reshape_2D(X, "X")
+
+ # Want quantiles to be as the same shape as data sequences
+ if quantiles is not None and len(quantiles) != 0:
+ quantiles = _reshape_2D(quantiles, "quantiles")
+ # Else, mock quantiles if is none or empty
+ else:
+ quantiles = [[]] * len(X)
+
+ # quantiles should has the same size as dataset
+ if len(X) != len(quantiles):
+ raise ValueError("List of violinplot statistics and quantiles values"
+ " must have the same length")
+
+ # Zip x and quantiles
+ for (x, q) in zip(X, quantiles):
+ # Dictionary of results for this distribution
+ stats = {}
+
+ # Calculate basic stats for the distribution
+ min_val = np.min(x)
+ max_val = np.max(x)
+ quantile_val = np.percentile(x, 100 * q)
+
+ # Evaluate the kernel density estimate
+ coords = np.linspace(min_val, max_val, points)
+ stats['vals'] = method(x, coords)
+ stats['coords'] = coords
+
+ # Store additional statistics for this distribution
+ stats['mean'] = np.mean(x)
+ stats['median'] = np.median(x)
+ stats['min'] = min_val
+ stats['max'] = max_val
+ stats['quantiles'] = np.atleast_1d(quantile_val)
+
+ # Append to output
+ vpstats.append(stats)
+
+ return vpstats
+
+
+def pts_to_prestep(x, *args):
+ """
+ Convert continuous line to pre-steps.
+
+ Given a set of ``N`` points, convert to ``2N - 1`` points, which when
+ connected linearly give a step function which changes values at the
+ beginning of the intervals.
+
+ Parameters
+ ----------
+ x : array
+ The x location of the steps. May be empty.
+
+ y1, ..., yp : array
+ y arrays to be turned into steps; all must be the same length as ``x``.
+
+ Returns
+ -------
+ array
+ The x and y values converted to steps in the same order as the input;
+ can be unpacked as ``x_out, y1_out, ..., yp_out``. If the input is
+ length ``N``, each of these arrays will be length ``2N + 1``. For
+ ``N=0``, the length will be 0.
+
+ Examples
+ --------
+ >>> x_s, y1_s, y2_s = pts_to_prestep(x, y1, y2)
+ """
+ steps = np.zeros((1 + len(args), max(2 * len(x) - 1, 0)))
+ # In all `pts_to_*step` functions, only assign once using *x* and *args*,
+ # as converting to an array may be expensive.
+ steps[0, 0::2] = x
+ steps[0, 1::2] = steps[0, 0:-2:2]
+ steps[1:, 0::2] = args
+ steps[1:, 1::2] = steps[1:, 2::2]
+ return steps
+
+
+def pts_to_poststep(x, *args):
+ """
+ Convert continuous line to post-steps.
+
+ Given a set of ``N`` points convert to ``2N + 1`` points, which when
+ connected linearly give a step function which changes values at the end of
+ the intervals.
+
+ Parameters
+ ----------
+ x : array
+ The x location of the steps. May be empty.
+
+ y1, ..., yp : array
+ y arrays to be turned into steps; all must be the same length as ``x``.
+
+ Returns
+ -------
+ array
+ The x and y values converted to steps in the same order as the input;
+ can be unpacked as ``x_out, y1_out, ..., yp_out``. If the input is
+ length ``N``, each of these arrays will be length ``2N + 1``. For
+ ``N=0``, the length will be 0.
+
+ Examples
+ --------
+ >>> x_s, y1_s, y2_s = pts_to_poststep(x, y1, y2)
+ """
+ steps = np.zeros((1 + len(args), max(2 * len(x) - 1, 0)))
+ steps[0, 0::2] = x
+ steps[0, 1::2] = steps[0, 2::2]
+ steps[1:, 0::2] = args
+ steps[1:, 1::2] = steps[1:, 0:-2:2]
+ return steps
+
+
+def pts_to_midstep(x, *args):
+ """
+ Convert continuous line to mid-steps.
+
+ Given a set of ``N`` points convert to ``2N`` points which when connected
+ linearly give a step function which changes values at the middle of the
+ intervals.
+
+ Parameters
+ ----------
+ x : array
+ The x location of the steps. May be empty.
+
+ y1, ..., yp : array
+ y arrays to be turned into steps; all must be the same length as
+ ``x``.
+
+ Returns
+ -------
+ array
+ The x and y values converted to steps in the same order as the input;
+ can be unpacked as ``x_out, y1_out, ..., yp_out``. If the input is
+ length ``N``, each of these arrays will be length ``2N``.
+
+ Examples
+ --------
+ >>> x_s, y1_s, y2_s = pts_to_midstep(x, y1, y2)
+ """
+ steps = np.zeros((1 + len(args), 2 * len(x)))
+ x = np.asanyarray(x)
+ steps[0, 1:-1:2] = steps[0, 2::2] = (x[:-1] + x[1:]) / 2
+ steps[0, :1] = x[:1] # Also works for zero-sized input.
+ steps[0, -1:] = x[-1:]
+ steps[1:, 0::2] = args
+ steps[1:, 1::2] = steps[1:, 0::2]
+ return steps
+
+
+STEP_LOOKUP_MAP = {'default': lambda x, y: (x, y),
+ 'steps': pts_to_prestep,
+ 'steps-pre': pts_to_prestep,
+ 'steps-post': pts_to_poststep,
+ 'steps-mid': pts_to_midstep}
+
+
+def index_of(y):
+ """
+ A helper function to create reasonable x values for the given *y*.
+
+ This is used for plotting (x, y) if x values are not explicitly given.
+
+ First try ``y.index`` (assuming *y* is a `pandas.Series`), if that
+ fails, use ``range(len(y))``.
+
+ This will be extended in the future to deal with more types of
+ labeled data.
+
+ Parameters
+ ----------
+ y : float or array-like
+
+ Returns
+ -------
+ x, y : ndarray
+ The x and y values to plot.
+ """
+ try:
+ return y.index.values, y.values
+ except AttributeError:
+ pass
+ try:
+ y = _check_1d(y)
+ except (np.VisibleDeprecationWarning, ValueError):
+ # NumPy 1.19 will warn on ragged input, and we can't actually use it.
+ pass
+ else:
+ return np.arange(y.shape[0], dtype=float), y
+ raise ValueError('Input could not be cast to an at-least-1D NumPy array')
+
+
+def safe_first_element(obj):
+ """
+ Return the first element in *obj*.
+
+ This is an type-independent way of obtaining the first element, supporting
+ both index access and the iterator protocol.
+ """
+ if isinstance(obj, collections.abc.Iterator):
+ # needed to accept `array.flat` as input.
+ # np.flatiter reports as an instance of collections.Iterator
+ # but can still be indexed via [].
+ # This has the side effect of re-setting the iterator, but
+ # that is acceptable.
+ try:
+ return obj[0]
+ except TypeError:
+ pass
+ raise RuntimeError("matplotlib does not support generators "
+ "as input")
+ return next(iter(obj))
+
+
+def sanitize_sequence(data):
+ """
+ Convert dictview objects to list. Other inputs are returned unchanged.
+ """
+ return (list(data) if isinstance(data, collections.abc.MappingView)
+ else data)
+
+
+@_api.delete_parameter("3.3", "required")
+@_api.delete_parameter("3.3", "forbidden")
+@_api.delete_parameter("3.3", "allowed")
+def normalize_kwargs(kw, alias_mapping=None, required=(), forbidden=(),
+ allowed=None):
+ """
+ Helper function to normalize kwarg inputs.
+
+ The order they are resolved are:
+
+ 1. aliasing
+ 2. required
+ 3. forbidden
+ 4. allowed
+
+ This order means that only the canonical names need appear in
+ *allowed*, *forbidden*, *required*.
+
+ Parameters
+ ----------
+ kw : dict or None
+ A dict of keyword arguments. None is explicitly supported and treated
+ as an empty dict, to support functions with an optional parameter of
+ the form ``props=None``.
+
+ alias_mapping : dict or Artist subclass or Artist instance, optional
+ A mapping between a canonical name to a list of
+ aliases, in order of precedence from lowest to highest.
+
+ If the canonical value is not in the list it is assumed to have
+ the highest priority.
+
+ If an Artist subclass or instance is passed, use its properties alias
+ mapping.
+
+ required : list of str, optional
+ A list of keys that must be in *kws*. This parameter is deprecated.
+
+ forbidden : list of str, optional
+ A list of keys which may not be in *kw*. This parameter is deprecated.
+
+ allowed : list of str, optional
+ A list of allowed fields. If this not None, then raise if
+ *kw* contains any keys not in the union of *required*
+ and *allowed*. To allow only the required fields pass in
+ an empty tuple ``allowed=()``. This parameter is deprecated.
+
+ Raises
+ ------
+ TypeError
+ To match what python raises if invalid args/kwargs are passed to
+ a callable.
+ """
+ from matplotlib.artist import Artist
+
+ if kw is None:
+ return {}
+
+ # deal with default value of alias_mapping
+ if alias_mapping is None:
+ alias_mapping = dict()
+ elif (isinstance(alias_mapping, type) and issubclass(alias_mapping, Artist)
+ or isinstance(alias_mapping, Artist)):
+ alias_mapping = getattr(alias_mapping, "_alias_map", {})
+
+ to_canonical = {alias: canonical
+ for canonical, alias_list in alias_mapping.items()
+ for alias in alias_list}
+ canonical_to_seen = {}
+ ret = {} # output dictionary
+
+ for k, v in kw.items():
+ canonical = to_canonical.get(k, k)
+ if canonical in canonical_to_seen:
+ raise TypeError(f"Got both {canonical_to_seen[canonical]!r} and "
+ f"{k!r}, which are aliases of one another")
+ canonical_to_seen[canonical] = k
+ ret[canonical] = v
+
+ fail_keys = [k for k in required if k not in ret]
+ if fail_keys:
+ raise TypeError("The required keys {keys!r} "
+ "are not in kwargs".format(keys=fail_keys))
+
+ fail_keys = [k for k in forbidden if k in ret]
+ if fail_keys:
+ raise TypeError("The forbidden keys {keys!r} "
+ "are in kwargs".format(keys=fail_keys))
+
+ if allowed is not None:
+ allowed_set = {*required, *allowed}
+ fail_keys = [k for k in ret if k not in allowed_set]
+ if fail_keys:
+ raise TypeError(
+ "kwargs contains {keys!r} which are not in the required "
+ "{req!r} or allowed {allow!r} keys".format(
+ keys=fail_keys, req=required, allow=allowed))
+
+ return ret
+
+
+@contextlib.contextmanager
+def _lock_path(path):
+ """
+ Context manager for locking a path.
+
+ Usage::
+
+ with _lock_path(path):
+ ...
+
+ Another thread or process that attempts to lock the same path will wait
+ until this context manager is exited.
+
+ The lock is implemented by creating a temporary file in the parent
+ directory, so that directory must exist and be writable.
+ """
+ path = Path(path)
+ lock_path = path.with_name(path.name + ".matplotlib-lock")
+ retries = 50
+ sleeptime = 0.1
+ for _ in range(retries):
+ try:
+ with lock_path.open("xb"):
+ break
+ except FileExistsError:
+ time.sleep(sleeptime)
+ else:
+ raise TimeoutError("""\
+Lock error: Matplotlib failed to acquire the following lock file:
+ {}
+This maybe due to another process holding this lock file. If you are sure no
+other Matplotlib process is running, remove this file and try again.""".format(
+ lock_path))
+ try:
+ yield
+ finally:
+ lock_path.unlink()
+
+
+def _topmost_artist(
+ artists,
+ _cached_max=functools.partial(max, key=operator.attrgetter("zorder"))):
+ """
+ Get the topmost artist of a list.
+
+ In case of a tie, return the *last* of the tied artists, as it will be
+ drawn on top of the others. `max` returns the first maximum in case of
+ ties, so we need to iterate over the list in reverse order.
+ """
+ return _cached_max(reversed(artists))
+
+
+def _str_equal(obj, s):
+ """
+ Return whether *obj* is a string equal to string *s*.
+
+ This helper solely exists to handle the case where *obj* is a numpy array,
+ because in such cases, a naive ``obj == s`` would yield an array, which
+ cannot be used in a boolean context.
+ """
+ return isinstance(obj, str) and obj == s
+
+
+def _str_lower_equal(obj, s):
+ """
+ Return whether *obj* is a string equal, when lowercased, to string *s*.
+
+ This helper solely exists to handle the case where *obj* is a numpy array,
+ because in such cases, a naive ``obj == s`` would yield an array, which
+ cannot be used in a boolean context.
+ """
+ return isinstance(obj, str) and obj.lower() == s
+
+
+def _define_aliases(alias_d, cls=None):
+ """
+ Class decorator for defining property aliases.
+
+ Use as ::
+
+ @cbook._define_aliases({"property": ["alias", ...], ...})
+ class C: ...
+
+ For each property, if the corresponding ``get_property`` is defined in the
+ class so far, an alias named ``get_alias`` will be defined; the same will
+ be done for setters. If neither the getter nor the setter exists, an
+ exception will be raised.
+
+ The alias map is stored as the ``_alias_map`` attribute on the class and
+ can be used by `~.normalize_kwargs` (which assumes that higher priority
+ aliases come last).
+ """
+ if cls is None: # Return the actual class decorator.
+ return functools.partial(_define_aliases, alias_d)
+
+ def make_alias(name): # Enforce a closure over *name*.
+ @functools.wraps(getattr(cls, name))
+ def method(self, *args, **kwargs):
+ return getattr(self, name)(*args, **kwargs)
+ return method
+
+ for prop, aliases in alias_d.items():
+ exists = False
+ for prefix in ["get_", "set_"]:
+ if prefix + prop in vars(cls):
+ exists = True
+ for alias in aliases:
+ method = make_alias(prefix + prop)
+ method.__name__ = prefix + alias
+ method.__doc__ = "Alias for `{}`.".format(prefix + prop)
+ setattr(cls, prefix + alias, method)
+ if not exists:
+ raise ValueError(
+ "Neither getter nor setter exists for {!r}".format(prop))
+
+ def get_aliased_and_aliases(d):
+ return {*d, *(alias for aliases in d.values() for alias in aliases)}
+
+ preexisting_aliases = getattr(cls, "_alias_map", {})
+ conflicting = (get_aliased_and_aliases(preexisting_aliases)
+ & get_aliased_and_aliases(alias_d))
+ if conflicting:
+ # Need to decide on conflict resolution policy.
+ raise NotImplementedError(
+ f"Parent class already defines conflicting aliases: {conflicting}")
+ cls._alias_map = {**preexisting_aliases, **alias_d}
+ return cls
+
+
+def _array_perimeter(arr):
+ """
+ Get the elements on the perimeter of *arr*.
+
+ Parameters
+ ----------
+ arr : ndarray, shape (M, N)
+ The input array.
+
+ Returns
+ -------
+ ndarray, shape (2*(M - 1) + 2*(N - 1),)
+ The elements on the perimeter of the array::
+
+ [arr[0, 0], ..., arr[0, -1], ..., arr[-1, -1], ..., arr[-1, 0], ...]
+
+ Examples
+ --------
+ >>> i, j = np.ogrid[:3,:4]
+ >>> a = i*10 + j
+ >>> a
+ array([[ 0, 1, 2, 3],
+ [10, 11, 12, 13],
+ [20, 21, 22, 23]])
+ >>> _array_perimeter(a)
+ array([ 0, 1, 2, 3, 13, 23, 22, 21, 20, 10])
+ """
+ # note we use Python's half-open ranges to avoid repeating
+ # the corners
+ forward = np.s_[0:-1] # [0 ... -1)
+ backward = np.s_[-1:0:-1] # [-1 ... 0)
+ return np.concatenate((
+ arr[0, forward],
+ arr[forward, -1],
+ arr[-1, backward],
+ arr[backward, 0],
+ ))
+
+
+def _unfold(arr, axis, size, step):
+ """
+ Append an extra dimension containing sliding windows along *axis*.
+
+ All windows are of size *size* and begin with every *step* elements.
+
+ Parameters
+ ----------
+ arr : ndarray, shape (N_1, ..., N_k)
+ The input array
+ axis : int
+ Axis along which the windows are extracted
+ size : int
+ Size of the windows
+ step : int
+ Stride between first elements of subsequent windows.
+
+ Returns
+ -------
+ ndarray, shape (N_1, ..., 1 + (N_axis-size)/step, ..., N_k, size)
+
+ Examples
+ --------
+ >>> i, j = np.ogrid[:3,:7]
+ >>> a = i*10 + j
+ >>> a
+ array([[ 0, 1, 2, 3, 4, 5, 6],
+ [10, 11, 12, 13, 14, 15, 16],
+ [20, 21, 22, 23, 24, 25, 26]])
+ >>> _unfold(a, axis=1, size=3, step=2)
+ array([[[ 0, 1, 2],
+ [ 2, 3, 4],
+ [ 4, 5, 6]],
+ [[10, 11, 12],
+ [12, 13, 14],
+ [14, 15, 16]],
+ [[20, 21, 22],
+ [22, 23, 24],
+ [24, 25, 26]]])
+ """
+ new_shape = [*arr.shape, size]
+ new_strides = [*arr.strides, arr.strides[axis]]
+ new_shape[axis] = (new_shape[axis] - size) // step + 1
+ new_strides[axis] = new_strides[axis] * step
+ return np.lib.stride_tricks.as_strided(arr,
+ shape=new_shape,
+ strides=new_strides,
+ writeable=False)
+
+
+def _array_patch_perimeters(x, rstride, cstride):
+ """
+ Extract perimeters of patches from *arr*.
+
+ Extracted patches are of size (*rstride* + 1) x (*cstride* + 1) and
+ share perimeters with their neighbors. The ordering of the vertices matches
+ that returned by ``_array_perimeter``.
+
+ Parameters
+ ----------
+ x : ndarray, shape (N, M)
+ Input array
+ rstride : int
+ Vertical (row) stride between corresponding elements of each patch
+ cstride : int
+ Horizontal (column) stride between corresponding elements of each patch
+
+ Returns
+ -------
+ ndarray, shape (N/rstride * M/cstride, 2 * (rstride + cstride))
+ """
+ assert rstride > 0 and cstride > 0
+ assert (x.shape[0] - 1) % rstride == 0
+ assert (x.shape[1] - 1) % cstride == 0
+ # We build up each perimeter from four half-open intervals. Here is an
+ # illustrated explanation for rstride == cstride == 3
+ #
+ # T T T R
+ # L R
+ # L R
+ # L B B B
+ #
+ # where T means that this element will be in the top array, R for right,
+ # B for bottom and L for left. Each of the arrays below has a shape of:
+ #
+ # (number of perimeters that can be extracted vertically,
+ # number of perimeters that can be extracted horizontally,
+ # cstride for top and bottom and rstride for left and right)
+ #
+ # Note that _unfold doesn't incur any memory copies, so the only costly
+ # operation here is the np.concatenate.
+ top = _unfold(x[:-1:rstride, :-1], 1, cstride, cstride)
+ bottom = _unfold(x[rstride::rstride, 1:], 1, cstride, cstride)[..., ::-1]
+ right = _unfold(x[:-1, cstride::cstride], 0, rstride, rstride)
+ left = _unfold(x[1:, :-1:cstride], 0, rstride, rstride)[..., ::-1]
+ return (np.concatenate((top, right, bottom, left), axis=2)
+ .reshape(-1, 2 * (rstride + cstride)))
+
+
+@contextlib.contextmanager
+def _setattr_cm(obj, **kwargs):
+ """
+ Temporarily set some attributes; restore original state at context exit.
+ """
+ sentinel = object()
+ origs = {}
+ for attr in kwargs:
+ orig = getattr(obj, attr, sentinel)
+ if attr in obj.__dict__ or orig is sentinel:
+ # if we are pulling from the instance dict or the object
+ # does not have this attribute we can trust the above
+ origs[attr] = orig
+ else:
+ # if the attribute is not in the instance dict it must be
+ # from the class level
+ cls_orig = getattr(type(obj), attr)
+ # if we are dealing with a property (but not a general descriptor)
+ # we want to set the original value back.
+ if isinstance(cls_orig, property):
+ origs[attr] = orig
+ # otherwise this is _something_ we are going to shadow at
+ # the instance dict level from higher up in the MRO. We
+ # are going to assume we can delattr(obj, attr) to clean
+ # up after ourselves. It is possible that this code will
+ # fail if used with a non-property custom descriptor which
+ # implements __set__ (and __delete__ does not act like a
+ # stack). However, this is an internal tool and we do not
+ # currently have any custom descriptors.
+ else:
+ origs[attr] = sentinel
+
+ try:
+ for attr, val in kwargs.items():
+ setattr(obj, attr, val)
+ yield
+ finally:
+ for attr, orig in origs.items():
+ if orig is sentinel:
+ delattr(obj, attr)
+ else:
+ setattr(obj, attr, orig)
+
+
+class _OrderedSet(collections.abc.MutableSet):
+ def __init__(self):
+ self._od = collections.OrderedDict()
+
+ def __contains__(self, key):
+ return key in self._od
+
+ def __iter__(self):
+ return iter(self._od)
+
+ def __len__(self):
+ return len(self._od)
+
+ def add(self, key):
+ self._od.pop(key, None)
+ self._od[key] = None
+
+ def discard(self, key):
+ self._od.pop(key, None)
+
+
+# Agg's buffers are unmultiplied RGBA8888, which neither PyQt4 nor cairo
+# support; however, both do support premultiplied ARGB32.
+
+
+def _premultiplied_argb32_to_unmultiplied_rgba8888(buf):
+ """
+ Convert a premultiplied ARGB32 buffer to an unmultiplied RGBA8888 buffer.
+ """
+ rgba = np.take( # .take() ensures C-contiguity of the result.
+ buf,
+ [2, 1, 0, 3] if sys.byteorder == "little" else [1, 2, 3, 0], axis=2)
+ rgb = rgba[..., :-1]
+ alpha = rgba[..., -1]
+ # Un-premultiply alpha. The formula is the same as in cairo-png.c.
+ mask = alpha != 0
+ for channel in np.rollaxis(rgb, -1):
+ channel[mask] = (
+ (channel[mask].astype(int) * 255 + alpha[mask] // 2)
+ // alpha[mask])
+ return rgba
+
+
+def _unmultiplied_rgba8888_to_premultiplied_argb32(rgba8888):
+ """
+ Convert an unmultiplied RGBA8888 buffer to a premultiplied ARGB32 buffer.
+ """
+ if sys.byteorder == "little":
+ argb32 = np.take(rgba8888, [2, 1, 0, 3], axis=2)
+ rgb24 = argb32[..., :-1]
+ alpha8 = argb32[..., -1:]
+ else:
+ argb32 = np.take(rgba8888, [3, 0, 1, 2], axis=2)
+ alpha8 = argb32[..., :1]
+ rgb24 = argb32[..., 1:]
+ # Only bother premultiplying when the alpha channel is not fully opaque,
+ # as the cost is not negligible. The unsafe cast is needed to do the
+ # multiplication in-place in an integer buffer.
+ if alpha8.min() != 0xff:
+ np.multiply(rgb24, alpha8 / 0xff, out=rgb24, casting="unsafe")
+ return argb32
+
+
+def _get_nonzero_slices(buf):
+ """
+ Return the bounds of the nonzero region of a 2D array as a pair of slices.
+
+ ``buf[_get_nonzero_slices(buf)]`` is the smallest sub-rectangle in *buf*
+ that encloses all non-zero entries in *buf*. If *buf* is fully zero, then
+ ``(slice(0, 0), slice(0, 0))`` is returned.
+ """
+ x_nz, = buf.any(axis=0).nonzero()
+ y_nz, = buf.any(axis=1).nonzero()
+ if len(x_nz) and len(y_nz):
+ l, r = x_nz[[0, -1]]
+ b, t = y_nz[[0, -1]]
+ return slice(b, t + 1), slice(l, r + 1)
+ else:
+ return slice(0, 0), slice(0, 0)
+
+
+def _pformat_subprocess(command):
+ """Pretty-format a subprocess command for printing/logging purposes."""
+ return (command if isinstance(command, str)
+ else " ".join(shlex.quote(os.fspath(arg)) for arg in command))
+
+
+def _check_and_log_subprocess(command, logger, **kwargs):
+ """
+ Run *command*, returning its stdout output if it succeeds.
+
+ If it fails (exits with nonzero return code), raise an exception whose text
+ includes the failed command and captured stdout and stderr output.
+
+ Regardless of the return code, the command is logged at DEBUG level on
+ *logger*. In case of success, the output is likewise logged.
+ """
+ logger.debug('%s', _pformat_subprocess(command))
+ proc = subprocess.run(
+ command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs)
+ if proc.returncode:
+ stdout = proc.stdout
+ if isinstance(stdout, bytes):
+ stdout = stdout.decode()
+ stderr = proc.stderr
+ if isinstance(stderr, bytes):
+ stderr = stderr.decode()
+ raise RuntimeError(
+ f"The command\n"
+ f" {_pformat_subprocess(command)}\n"
+ f"failed and generated the following output:\n"
+ f"{stdout}\n"
+ f"and the following error:\n"
+ f"{stderr}")
+ if proc.stdout:
+ logger.debug("stdout:\n%s", proc.stdout)
+ if proc.stderr:
+ logger.debug("stderr:\n%s", proc.stderr)
+ return proc.stdout
+
+
+def _backend_module_name(name):
+ """
+ Convert a backend name (either a standard backend -- "Agg", "TkAgg", ... --
+ or a custom backend -- "module://...") to the corresponding module name).
+ """
+ return (name[9:] if name.startswith("module://")
+ else "matplotlib.backends.backend_{}".format(name.lower()))
+
+
+def _setup_new_guiapp():
+ """
+ Perform OS-dependent setup when Matplotlib creates a new GUI application.
+ """
+ # Windows: If not explicit app user model id has been set yet (so we're not
+ # already embedded), then set it to "matplotlib", so that taskbar icons are
+ # correct.
+ try:
+ _c_internal_utils.Win32_GetCurrentProcessExplicitAppUserModelID()
+ except OSError:
+ _c_internal_utils.Win32_SetCurrentProcessExplicitAppUserModelID(
+ "matplotlib")
+
+
+def _format_approx(number, precision):
+ """
+ Format the number with at most the number of decimals given as precision.
+ Remove trailing zeros and possibly the decimal point.
+ """
+ return f'{number:.{precision}f}'.rstrip('0').rstrip('.') or '0'
+
+
+def _unikey_or_keysym_to_mplkey(unikey, keysym):
+ """
+ Convert a Unicode key or X keysym to a Matplotlib key name.
+
+ The Unicode key is checked first; this avoids having to list most printable
+ keysyms such as ``EuroSign``.
+ """
+ # For non-printable characters, gtk3 passes "\0" whereas tk passes an "".
+ if unikey and unikey.isprintable():
+ return unikey
+ key = keysym.lower()
+ if key.startswith("kp_"): # keypad_x (including kp_enter).
+ key = key[3:]
+ if key.startswith("page_"): # page_{up,down}
+ key = key.replace("page_", "page")
+ if key.endswith(("_l", "_r")): # alt_l, ctrl_l, shift_l.
+ key = key[:-2]
+ key = {
+ "return": "enter",
+ "prior": "pageup", # Used by tk.
+ "next": "pagedown", # Used by tk.
+ }.get(key, key)
+ return key
diff --git a/venv/Lib/site-packages/matplotlib/cbook/deprecation.py b/venv/Lib/site-packages/matplotlib/cbook/deprecation.py
new file mode 100644
index 0000000..5a0f02f
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/cbook/deprecation.py
@@ -0,0 +1,8 @@
+# imports are for backward compatibility
+from matplotlib._api.deprecation import (
+ MatplotlibDeprecationWarning, mplDeprecation, warn_deprecated, deprecated)
+
+warn_deprecated("3.4",
+ message="The module matplotlib.cbook.deprecation is "
+ "considered internal and it will be made private in the "
+ "future.")
diff --git a/venv/Lib/site-packages/matplotlib/cm.py b/venv/Lib/site-packages/matplotlib/cm.py
new file mode 100644
index 0000000..376d703
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/cm.py
@@ -0,0 +1,511 @@
+"""
+Builtin colormaps, colormap handling utilities, and the `ScalarMappable` mixin.
+
+.. seealso::
+
+ :doc:`/gallery/color/colormap_reference` for a list of builtin colormaps.
+
+ :doc:`/tutorials/colors/colormap-manipulation` for examples of how to
+ make colormaps.
+
+ :doc:`/tutorials/colors/colormaps` an in-depth discussion of
+ choosing colormaps.
+
+ :doc:`/tutorials/colors/colormapnorms` for more details about data
+ normalization.
+"""
+
+from collections.abc import MutableMapping
+
+import numpy as np
+from numpy import ma
+
+import matplotlib as mpl
+from matplotlib import _api, colors, cbook
+from matplotlib._cm import datad
+from matplotlib._cm_listed import cmaps as cmaps_listed
+
+
+LUTSIZE = mpl.rcParams['image.lut']
+
+
+def _gen_cmap_registry():
+ """
+ Generate a dict mapping standard colormap names to standard colormaps, as
+ well as the reversed colormaps.
+ """
+ cmap_d = {**cmaps_listed}
+ for name, spec in datad.items():
+ cmap_d[name] = ( # Precache the cmaps at a fixed lutsize..
+ colors.LinearSegmentedColormap(name, spec, LUTSIZE)
+ if 'red' in spec else
+ colors.ListedColormap(spec['listed'], name)
+ if 'listed' in spec else
+ colors.LinearSegmentedColormap.from_list(name, spec, LUTSIZE))
+ # Generate reversed cmaps.
+ for cmap in list(cmap_d.values()):
+ rmap = cmap.reversed()
+ cmap._global = True
+ rmap._global = True
+ cmap_d[rmap.name] = rmap
+ return cmap_d
+
+
+class _DeprecatedCmapDictWrapper(MutableMapping):
+ """Dictionary mapping for deprecated _cmap_d access."""
+
+ def __init__(self, cmap_registry):
+ self._cmap_registry = cmap_registry
+
+ def __delitem__(self, key):
+ self._warn_deprecated()
+ self._cmap_registry.__delitem__(key)
+
+ def __getitem__(self, key):
+ self._warn_deprecated()
+ return self._cmap_registry.__getitem__(key)
+
+ def __iter__(self):
+ self._warn_deprecated()
+ return self._cmap_registry.__iter__()
+
+ def __len__(self):
+ self._warn_deprecated()
+ return self._cmap_registry.__len__()
+
+ def __setitem__(self, key, val):
+ self._warn_deprecated()
+ self._cmap_registry.__setitem__(key, val)
+
+ def get(self, key, default=None):
+ self._warn_deprecated()
+ return self._cmap_registry.get(key, default)
+
+ def _warn_deprecated(self):
+ _api.warn_deprecated(
+ "3.3",
+ message="The global colormaps dictionary is no longer "
+ "considered public API.",
+ alternative="Please use register_cmap() and get_cmap() to "
+ "access the contents of the dictionary."
+ )
+
+
+_cmap_registry = _gen_cmap_registry()
+globals().update(_cmap_registry)
+# This is no longer considered public API
+cmap_d = _DeprecatedCmapDictWrapper(_cmap_registry)
+__builtin_cmaps = tuple(_cmap_registry)
+
+# Continue with definitions ...
+
+
+def register_cmap(name=None, cmap=None, *, override_builtin=False):
+ """
+ Add a colormap to the set recognized by :func:`get_cmap`.
+
+ Register a new colormap to be accessed by name ::
+
+ LinearSegmentedColormap('swirly', data, lut)
+ register_cmap(cmap=swirly_cmap)
+
+ Parameters
+ ----------
+ name : str, optional
+ The name that can be used in :func:`get_cmap` or :rc:`image.cmap`
+
+ If absent, the name will be the :attr:`~matplotlib.colors.Colormap.name`
+ attribute of the *cmap*.
+
+ cmap : matplotlib.colors.Colormap
+ Despite being the second argument and having a default value, this
+ is a required argument.
+
+ override_builtin : bool
+
+ Allow built-in colormaps to be overridden by a user-supplied
+ colormap.
+
+ Please do not use this unless you are sure you need it.
+
+ Notes
+ -----
+ Registering a colormap stores a reference to the colormap object
+ which can currently be modified and inadvertently change the global
+ colormap state. This behavior is deprecated and in Matplotlib 3.5
+ the registered colormap will be immutable.
+
+ """
+ _api.check_isinstance((str, None), name=name)
+ if name is None:
+ try:
+ name = cmap.name
+ except AttributeError as err:
+ raise ValueError("Arguments must include a name or a "
+ "Colormap") from err
+ if name in _cmap_registry:
+ if not override_builtin and name in __builtin_cmaps:
+ msg = f"Trying to re-register the builtin cmap {name!r}."
+ raise ValueError(msg)
+ else:
+ msg = f"Trying to register the cmap {name!r} which already exists."
+ _api.warn_external(msg)
+
+ if not isinstance(cmap, colors.Colormap):
+ raise ValueError("You must pass a Colormap instance. "
+ f"You passed {cmap} a {type(cmap)} object.")
+
+ cmap._global = True
+ _cmap_registry[name] = cmap
+ return
+
+
+def get_cmap(name=None, lut=None):
+ """
+ Get a colormap instance, defaulting to rc values if *name* is None.
+
+ Colormaps added with :func:`register_cmap` take precedence over
+ built-in colormaps.
+
+ Notes
+ -----
+ Currently, this returns the global colormap object, which is deprecated.
+ In Matplotlib 3.5, you will no longer be able to modify the global
+ colormaps in-place.
+
+ Parameters
+ ----------
+ name : `matplotlib.colors.Colormap` or str or None, default: None
+ If a `.Colormap` instance, it will be returned. Otherwise, the name of
+ a colormap known to Matplotlib, which will be resampled by *lut*. The
+ default, None, means :rc:`image.cmap`.
+ lut : int or None, default: None
+ If *name* is not already a Colormap instance and *lut* is not None, the
+ colormap will be resampled to have *lut* entries in the lookup table.
+ """
+ if name is None:
+ name = mpl.rcParams['image.cmap']
+ if isinstance(name, colors.Colormap):
+ return name
+ _api.check_in_list(sorted(_cmap_registry), name=name)
+ if lut is None:
+ return _cmap_registry[name]
+ else:
+ return _cmap_registry[name]._resample(lut)
+
+
+def unregister_cmap(name):
+ """
+ Remove a colormap recognized by :func:`get_cmap`.
+
+ You may not remove built-in colormaps.
+
+ If the named colormap is not registered, returns with no error, raises
+ if you try to de-register a default colormap.
+
+ .. warning ::
+
+ Colormap names are currently a shared namespace that may be used
+ by multiple packages. Use `unregister_cmap` only if you know you
+ have registered that name before. In particular, do not
+ unregister just in case to clean the name before registering a
+ new colormap.
+
+ Parameters
+ ----------
+ name : str
+ The name of the colormap to be un-registered
+
+ Returns
+ -------
+ ColorMap or None
+ If the colormap was registered, return it if not return `None`
+
+ Raises
+ ------
+ ValueError
+ If you try to de-register a default built-in colormap.
+
+ """
+ if name not in _cmap_registry:
+ return
+ if name in __builtin_cmaps:
+ raise ValueError(f"cannot unregister {name!r} which is a builtin "
+ "colormap.")
+ return _cmap_registry.pop(name)
+
+
+class ScalarMappable:
+ """
+ A mixin class to map scalar data to RGBA.
+
+ The ScalarMappable applies data normalization before returning RGBA colors
+ from the given colormap.
+ """
+
+ def __init__(self, norm=None, cmap=None):
+ """
+
+ Parameters
+ ----------
+ norm : `matplotlib.colors.Normalize` (or subclass thereof)
+ The normalizing object which scales data, typically into the
+ interval ``[0, 1]``.
+ If *None*, *norm* defaults to a *colors.Normalize* object which
+ initializes its scaling based on the first data processed.
+ cmap : str or `~matplotlib.colors.Colormap`
+ The colormap used to map normalized data values to RGBA colors.
+ """
+ self._A = None
+ self.norm = None # So that the setter knows we're initializing.
+ self.set_norm(norm) # The Normalize instance of this ScalarMappable.
+ self.cmap = None # So that the setter knows we're initializing.
+ self.set_cmap(cmap) # The Colormap instance of this ScalarMappable.
+ #: The last colorbar associated with this ScalarMappable. May be None.
+ self.colorbar = None
+ self.callbacksSM = cbook.CallbackRegistry()
+ self._update_dict = {'array': False}
+
+ def _scale_norm(self, norm, vmin, vmax):
+ """
+ Helper for initial scaling.
+
+ Used by public functions that create a ScalarMappable and support
+ parameters *vmin*, *vmax* and *norm*. This makes sure that a *norm*
+ will take precedence over *vmin*, *vmax*.
+
+ Note that this method does not set the norm.
+ """
+ if vmin is not None or vmax is not None:
+ self.set_clim(vmin, vmax)
+ if norm is not None:
+ _api.warn_deprecated(
+ "3.3",
+ message="Passing parameters norm and vmin/vmax "
+ "simultaneously is deprecated since %(since)s and "
+ "will become an error %(removal)s. Please pass "
+ "vmin/vmax directly to the norm when creating it.")
+
+ # always resolve the autoscaling so we have concrete limits
+ # rather than deferring to draw time.
+ self.autoscale_None()
+
+ def to_rgba(self, x, alpha=None, bytes=False, norm=True):
+ """
+ Return a normalized rgba array corresponding to *x*.
+
+ In the normal case, *x* is a 1D or 2D sequence of scalars, and
+ the corresponding ndarray of rgba values will be returned,
+ based on the norm and colormap set for this ScalarMappable.
+
+ There is one special case, for handling images that are already
+ rgb or rgba, such as might have been read from an image file.
+ If *x* is an ndarray with 3 dimensions,
+ and the last dimension is either 3 or 4, then it will be
+ treated as an rgb or rgba array, and no mapping will be done.
+ The array can be uint8, or it can be floating point with
+ values in the 0-1 range; otherwise a ValueError will be raised.
+ If it is a masked array, the mask will be ignored.
+ If the last dimension is 3, the *alpha* kwarg (defaulting to 1)
+ will be used to fill in the transparency. If the last dimension
+ is 4, the *alpha* kwarg is ignored; it does not
+ replace the pre-existing alpha. A ValueError will be raised
+ if the third dimension is other than 3 or 4.
+
+ In either case, if *bytes* is *False* (default), the rgba
+ array will be floats in the 0-1 range; if it is *True*,
+ the returned rgba array will be uint8 in the 0 to 255 range.
+
+ If norm is False, no normalization of the input data is
+ performed, and it is assumed to be in the range (0-1).
+
+ """
+ # First check for special case, image input:
+ try:
+ if x.ndim == 3:
+ if x.shape[2] == 3:
+ if alpha is None:
+ alpha = 1
+ if x.dtype == np.uint8:
+ alpha = np.uint8(alpha * 255)
+ m, n = x.shape[:2]
+ xx = np.empty(shape=(m, n, 4), dtype=x.dtype)
+ xx[:, :, :3] = x
+ xx[:, :, 3] = alpha
+ elif x.shape[2] == 4:
+ xx = x
+ else:
+ raise ValueError("Third dimension must be 3 or 4")
+ if xx.dtype.kind == 'f':
+ if norm and (xx.max() > 1 or xx.min() < 0):
+ raise ValueError("Floating point image RGB values "
+ "must be in the 0..1 range.")
+ if bytes:
+ xx = (xx * 255).astype(np.uint8)
+ elif xx.dtype == np.uint8:
+ if not bytes:
+ xx = xx.astype(np.float32) / 255
+ else:
+ raise ValueError("Image RGB array must be uint8 or "
+ "floating point; found %s" % xx.dtype)
+ return xx
+ except AttributeError:
+ # e.g., x is not an ndarray; so try mapping it
+ pass
+
+ # This is the normal case, mapping a scalar array:
+ x = ma.asarray(x)
+ if norm:
+ x = self.norm(x)
+ rgba = self.cmap(x, alpha=alpha, bytes=bytes)
+ return rgba
+
+ def set_array(self, A):
+ """
+ Set the image array from numpy array *A*.
+
+ Parameters
+ ----------
+ A : ndarray or None
+ """
+ self._A = A
+ self._update_dict['array'] = True
+
+ def get_array(self):
+ """Return the data array."""
+ return self._A
+
+ def get_cmap(self):
+ """Return the `.Colormap` instance."""
+ return self.cmap
+
+ def get_clim(self):
+ """
+ Return the values (min, max) that are mapped to the colormap limits.
+ """
+ return self.norm.vmin, self.norm.vmax
+
+ def set_clim(self, vmin=None, vmax=None):
+ """
+ Set the norm limits for image scaling.
+
+ Parameters
+ ----------
+ vmin, vmax : float
+ The limits.
+
+ The limits may also be passed as a tuple (*vmin*, *vmax*) as a
+ single positional argument.
+
+ .. ACCEPTS: (vmin: float, vmax: float)
+ """
+ if vmax is None:
+ try:
+ vmin, vmax = vmin
+ except (TypeError, ValueError):
+ pass
+ if vmin is not None:
+ self.norm.vmin = colors._sanitize_extrema(vmin)
+ if vmax is not None:
+ self.norm.vmax = colors._sanitize_extrema(vmax)
+ self.changed()
+
+ def get_alpha(self):
+ """
+ Returns
+ -------
+ float
+ Always returns 1.
+ """
+ # This method is intended to be overridden by Artist sub-classes
+ return 1.
+
+ def set_cmap(self, cmap):
+ """
+ Set the colormap for luminance data.
+
+ Parameters
+ ----------
+ cmap : `.Colormap` or str or None
+ """
+ in_init = self.cmap is None
+ cmap = get_cmap(cmap)
+ self.cmap = cmap
+ if not in_init:
+ self.changed() # Things are not set up properly yet.
+
+ def set_norm(self, norm):
+ """
+ Set the normalization instance.
+
+ Parameters
+ ----------
+ norm : `.Normalize` or None
+
+ Notes
+ -----
+ If there are any colorbars using the mappable for this norm, setting
+ the norm of the mappable will reset the norm, locator, and formatters
+ on the colorbar to default.
+ """
+ _api.check_isinstance((colors.Normalize, None), norm=norm)
+ in_init = self.norm is None
+ if norm is None:
+ norm = colors.Normalize()
+ self.norm = norm
+ if not in_init:
+ self.changed() # Things are not set up properly yet.
+
+ def autoscale(self):
+ """
+ Autoscale the scalar limits on the norm instance using the
+ current array
+ """
+ if self._A is None:
+ raise TypeError('You must first set_array for mappable')
+ self.norm.autoscale(self._A)
+ self.changed()
+
+ def autoscale_None(self):
+ """
+ Autoscale the scalar limits on the norm instance using the
+ current array, changing only limits that are None
+ """
+ if self._A is None:
+ raise TypeError('You must first set_array for mappable')
+ self.norm.autoscale_None(self._A)
+ self.changed()
+
+ def _add_checker(self, checker):
+ """
+ Add an entry to a dictionary of boolean flags
+ that are set to True when the mappable is changed.
+ """
+ self._update_dict[checker] = False
+
+ def _check_update(self, checker):
+ """Return whether mappable has changed since the last check."""
+ if self._update_dict[checker]:
+ self._update_dict[checker] = False
+ return True
+ return False
+
+ def changed(self):
+ """
+ Call this whenever the mappable is changed to notify all the
+ callbackSM listeners to the 'changed' signal.
+ """
+ self.callbacksSM.process('changed', self)
+ for key in self._update_dict:
+ self._update_dict[key] = True
+ self.stale = True
+
+ update_dict = _api.deprecate_privatize_attribute("3.3")
+
+ @_api.deprecated("3.3")
+ def add_checker(self, checker):
+ return self._add_checker(checker)
+
+ @_api.deprecated("3.3")
+ def check_update(self, checker):
+ return self._check_update(checker)
diff --git a/venv/Lib/site-packages/matplotlib/collections.py b/venv/Lib/site-packages/matplotlib/collections.py
new file mode 100644
index 0000000..0e1d225
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/collections.py
@@ -0,0 +1,2143 @@
+"""
+Classes for the efficient drawing of large collections of objects that
+share most properties, e.g., a large number of line segments or
+polygons.
+
+The classes are not meant to be as flexible as their single element
+counterparts (e.g., you may not be able to select all line styles) but
+they are meant to be fast for common use cases (e.g., a large set of solid
+line segments).
+"""
+
+import math
+from numbers import Number
+import numpy as np
+
+import matplotlib as mpl
+from . import (_api, _path, artist, cbook, cm, colors as mcolors, docstring,
+ hatch as mhatch, lines as mlines, path as mpath, transforms)
+from ._enums import JoinStyle, CapStyle
+import warnings
+
+
+# "color" is excluded; it is a compound setter, and its docstring differs
+# in LineCollection.
+@cbook._define_aliases({
+ "antialiased": ["antialiaseds", "aa"],
+ "edgecolor": ["edgecolors", "ec"],
+ "facecolor": ["facecolors", "fc"],
+ "linestyle": ["linestyles", "dashes", "ls"],
+ "linewidth": ["linewidths", "lw"],
+})
+class Collection(artist.Artist, cm.ScalarMappable):
+ r"""
+ Base class for Collections. Must be subclassed to be usable.
+
+ A Collection represents a sequence of `.Patch`\es that can be drawn
+ more efficiently together than individually. For example, when a single
+ path is being drawn repeatedly at different offsets, the renderer can
+ typically execute a ``draw_marker()`` call much more efficiently than a
+ series of repeated calls to ``draw_path()`` with the offsets put in
+ one-by-one.
+
+ Most properties of a collection can be configured per-element. Therefore,
+ Collections have "plural" versions of many of the properties of a `.Patch`
+ (e.g. `.Collection.get_paths` instead of `.Patch.get_path`). Exceptions are
+ the *zorder*, *hatch*, *pickradius*, *capstyle* and *joinstyle* properties,
+ which can only be set globally for the whole collection.
+
+ Besides these exceptions, all properties can be specified as single values
+ (applying to all elements) or sequences of values. The property of the
+ ``i``\th element of the collection is::
+
+ prop[i % len(prop)]
+
+ Each Collection can optionally be used as its own `.ScalarMappable` by
+ passing the *norm* and *cmap* parameters to its constructor. If the
+ Collection's `.ScalarMappable` matrix ``_A`` has been set (via a call
+ to `.Collection.set_array`), then at draw time this internal scalar
+ mappable will be used to set the ``facecolors`` and ``edgecolors``,
+ ignoring those that were manually passed in.
+ """
+ _offsets = np.zeros((0, 2))
+ _transOffset = transforms.IdentityTransform()
+ #: Either a list of 3x3 arrays or an Nx3x3 array (representing N
+ #: transforms), suitable for the `all_transforms` argument to
+ #: `~matplotlib.backend_bases.RendererBase.draw_path_collection`;
+ #: each 3x3 array is used to initialize an
+ #: `~matplotlib.transforms.Affine2D` object.
+ #: Each kind of collection defines this based on its arguments.
+ _transforms = np.empty((0, 3, 3))
+
+ # Whether to draw an edge by default. Set on a
+ # subclass-by-subclass basis.
+ _edge_default = False
+
+ @_api.delete_parameter("3.3", "offset_position")
+ @docstring.interpd
+ def __init__(self,
+ edgecolors=None,
+ facecolors=None,
+ linewidths=None,
+ linestyles='solid',
+ capstyle=None,
+ joinstyle=None,
+ antialiaseds=None,
+ offsets=None,
+ transOffset=None,
+ norm=None, # optional for ScalarMappable
+ cmap=None, # ditto
+ pickradius=5.0,
+ hatch=None,
+ urls=None,
+ offset_position='screen',
+ zorder=1,
+ **kwargs
+ ):
+ """
+ Parameters
+ ----------
+ edgecolors : color or list of colors, default: :rc:`patch.edgecolor`
+ Edge color for each patch making up the collection. The special
+ value 'face' can be passed to make the edgecolor match the
+ facecolor.
+ facecolors : color or list of colors, default: :rc:`patch.facecolor`
+ Face color for each patch making up the collection.
+ linewidths : float or list of floats, default: :rc:`patch.linewidth`
+ Line width for each patch making up the collection.
+ linestyles : str or tuple or list thereof, default: 'solid'
+ Valid strings are ['solid', 'dashed', 'dashdot', 'dotted', '-',
+ '--', '-.', ':']. Dash tuples should be of the form::
+
+ (offset, onoffseq),
+
+ where *onoffseq* is an even length tuple of on and off ink lengths
+ in points. For examples, see
+ :doc:`/gallery/lines_bars_and_markers/linestyles`.
+ capstyle : `.CapStyle`-like, default: :rc:`patch.capstyle`
+ Style to use for capping lines for all paths in the collection.
+ Allowed values are %(CapStyle)s.
+ joinstyle : `.JoinStyle`-like, default: :rc:`patch.joinstyle`
+ Style to use for joining lines for all paths in the collection.
+ Allowed values are %(JoinStyle)s.
+ antialiaseds : bool or list of bool, default: :rc:`patch.antialiased`
+ Whether each patch in the collection should be drawn with
+ antialiasing.
+ offsets : (float, float) or list thereof, default: (0, 0)
+ A vector by which to translate each patch after rendering (default
+ is no translation). The translation is performed in screen (pixel)
+ coordinates (i.e. after the Artist's transform is applied).
+ transOffset : `~.transforms.Transform`, default: `.IdentityTransform`
+ A single transform which will be applied to each *offsets* vector
+ before it is used.
+ offset_position : {{'screen' (default), 'data' (deprecated)}}
+ If set to 'data' (deprecated), *offsets* will be treated as if it
+ is in data coordinates instead of in screen coordinates.
+ norm : `~.colors.Normalize`, optional
+ Forwarded to `.ScalarMappable`. The default of
+ ``None`` means that the first draw call will set ``vmin`` and
+ ``vmax`` using the minimum and maximum values of the data.
+ cmap : `~.colors.Colormap`, optional
+ Forwarded to `.ScalarMappable`. The default of
+ ``None`` will result in :rc:`image.cmap` being used.
+ hatch : str, optional
+ Hatching pattern to use in filled paths, if any. Valid strings are
+ ['/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*']. See
+ :doc:`/gallery/shapes_and_collections/hatch_style_reference` for
+ the meaning of each hatch type.
+ pickradius : float, default: 5.0
+ If ``pickradius <= 0``, then `.Collection.contains` will return
+ ``True`` whenever the test point is inside of one of the polygons
+ formed by the control points of a Path in the Collection. On the
+ other hand, if it is greater than 0, then we instead check if the
+ test point is contained in a stroke of width ``2*pickradius``
+ following any of the Paths in the Collection.
+ urls : list of str, default: None
+ A URL for each patch to link to once drawn. Currently only works
+ for the SVG backend. See :doc:`/gallery/misc/hyperlinks_sgskip` for
+ examples.
+ zorder : float, default: 1
+ The drawing order, shared by all Patches in the Collection. See
+ :doc:`/gallery/misc/zorder_demo` for all defaults and examples.
+ """
+ artist.Artist.__init__(self)
+ cm.ScalarMappable.__init__(self, norm, cmap)
+ # list of un-scaled dash patterns
+ # this is needed scaling the dash pattern by linewidth
+ self._us_linestyles = [(0, None)]
+ # list of dash patterns
+ self._linestyles = [(0, None)]
+ # list of unbroadcast/scaled linewidths
+ self._us_lw = [0]
+ self._linewidths = [0]
+ # Flags set by _set_mappable_flags: are colors from mapping an array?
+ self._face_is_mapped = None
+ self._edge_is_mapped = None
+ self._mapped_colors = None # calculated in update_scalarmappable
+ self._hatch_color = mcolors.to_rgba(mpl.rcParams['hatch.color'])
+ self.set_facecolor(facecolors)
+ self.set_edgecolor(edgecolors)
+ self.set_linewidth(linewidths)
+ self.set_linestyle(linestyles)
+ self.set_antialiased(antialiaseds)
+ self.set_pickradius(pickradius)
+ self.set_urls(urls)
+ self.set_hatch(hatch)
+ self._offset_position = "screen"
+ if offset_position != "screen":
+ self.set_offset_position(offset_position) # emit deprecation.
+ self.set_zorder(zorder)
+
+ if capstyle:
+ self.set_capstyle(capstyle)
+ else:
+ self._capstyle = None
+
+ if joinstyle:
+ self.set_joinstyle(joinstyle)
+ else:
+ self._joinstyle = None
+
+ self._offsets = np.zeros((1, 2))
+ # save if offsets passed in were none...
+ self._offsetsNone = offsets is None
+ self._uniform_offsets = None
+ if offsets is not None:
+ offsets = np.asanyarray(offsets, float)
+ # Broadcast (2,) -> (1, 2) but nothing else.
+ if offsets.shape == (2,):
+ offsets = offsets[None, :]
+ if transOffset is not None:
+ self._offsets = offsets
+ self._transOffset = transOffset
+ else:
+ self._uniform_offsets = offsets
+
+ self._path_effects = None
+ self.update(kwargs)
+ self._paths = None
+
+ def get_paths(self):
+ return self._paths
+
+ def set_paths(self):
+ raise NotImplementedError
+
+ def get_transforms(self):
+ return self._transforms
+
+ def get_offset_transform(self):
+ t = self._transOffset
+ if (not isinstance(t, transforms.Transform)
+ and hasattr(t, '_as_mpl_transform')):
+ t = t._as_mpl_transform(self.axes)
+ return t
+
+ def get_datalim(self, transData):
+ # Calculate the data limits and return them as a `.Bbox`.
+ #
+ # This operation depends on the transforms for the data in the
+ # collection and whether the collection has offsets:
+ #
+ # 1. offsets = None, transform child of transData: use the paths for
+ # the automatic limits (i.e. for LineCollection in streamline).
+ # 2. offsets != None: offset_transform is child of transData:
+ #
+ # a. transform is child of transData: use the path + offset for
+ # limits (i.e for bar).
+ # b. transform is not a child of transData: just use the offsets
+ # for the limits (i.e. for scatter)
+ #
+ # 3. otherwise return a null Bbox.
+
+ transform = self.get_transform()
+ transOffset = self.get_offset_transform()
+ if (not self._offsetsNone and
+ not transOffset.contains_branch(transData)):
+ # if there are offsets but in some coords other than data,
+ # then don't use them for autoscaling.
+ return transforms.Bbox.null()
+ offsets = self._offsets
+
+ paths = self.get_paths()
+
+ if not transform.is_affine:
+ paths = [transform.transform_path_non_affine(p) for p in paths]
+ # Don't convert transform to transform.get_affine() here because
+ # we may have transform.contains_branch(transData) but not
+ # transforms.get_affine().contains_branch(transData). But later,
+ # be careful to only apply the affine part that remains.
+
+ if isinstance(offsets, np.ma.MaskedArray):
+ offsets = offsets.filled(np.nan)
+ # get_path_collection_extents handles nan but not masked arrays
+
+ if len(paths) and len(offsets):
+ if any(transform.contains_branch_seperately(transData)):
+ # collections that are just in data units (like quiver)
+ # can properly have the axes limits set by their shape +
+ # offset. LineCollections that have no offsets can
+ # also use this algorithm (like streamplot).
+ return mpath.get_path_collection_extents(
+ transform.get_affine() - transData, paths,
+ self.get_transforms(),
+ transOffset.transform_non_affine(offsets),
+ transOffset.get_affine().frozen())
+ if not self._offsetsNone:
+ # this is for collections that have their paths (shapes)
+ # in physical, axes-relative, or figure-relative units
+ # (i.e. like scatter). We can't uniquely set limits based on
+ # those shapes, so we just set the limits based on their
+ # location.
+
+ offsets = (transOffset - transData).transform(offsets)
+ # note A-B means A B^{-1}
+ offsets = np.ma.masked_invalid(offsets)
+ if not offsets.mask.all():
+ bbox = transforms.Bbox.null()
+ bbox.update_from_data_xy(offsets)
+ return bbox
+ return transforms.Bbox.null()
+
+ def get_window_extent(self, renderer):
+ # TODO: check to ensure that this does not fail for
+ # cases other than scatter plot legend
+ return self.get_datalim(transforms.IdentityTransform())
+
+ def _prepare_points(self):
+ # Helper for drawing and hit testing.
+
+ transform = self.get_transform()
+ transOffset = self.get_offset_transform()
+ offsets = self._offsets
+ paths = self.get_paths()
+
+ if self.have_units():
+ paths = []
+ for path in self.get_paths():
+ vertices = path.vertices
+ xs, ys = vertices[:, 0], vertices[:, 1]
+ xs = self.convert_xunits(xs)
+ ys = self.convert_yunits(ys)
+ paths.append(mpath.Path(np.column_stack([xs, ys]), path.codes))
+ if offsets.size:
+ xs = self.convert_xunits(offsets[:, 0])
+ ys = self.convert_yunits(offsets[:, 1])
+ offsets = np.column_stack([xs, ys])
+
+ if not transform.is_affine:
+ paths = [transform.transform_path_non_affine(path)
+ for path in paths]
+ transform = transform.get_affine()
+ if not transOffset.is_affine:
+ offsets = transOffset.transform_non_affine(offsets)
+ # This might have changed an ndarray into a masked array.
+ transOffset = transOffset.get_affine()
+
+ if isinstance(offsets, np.ma.MaskedArray):
+ offsets = offsets.filled(np.nan)
+ # Changing from a masked array to nan-filled ndarray
+ # is probably most efficient at this point.
+
+ return transform, transOffset, offsets, paths
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ if not self.get_visible():
+ return
+ renderer.open_group(self.__class__.__name__, self.get_gid())
+
+ self.update_scalarmappable()
+
+ transform, transOffset, offsets, paths = self._prepare_points()
+
+ gc = renderer.new_gc()
+ self._set_gc_clip(gc)
+ gc.set_snap(self.get_snap())
+
+ if self._hatch:
+ gc.set_hatch(self._hatch)
+ gc.set_hatch_color(self._hatch_color)
+
+ if self.get_sketch_params() is not None:
+ gc.set_sketch_params(*self.get_sketch_params())
+
+ if self.get_path_effects():
+ from matplotlib.patheffects import PathEffectRenderer
+ renderer = PathEffectRenderer(self.get_path_effects(), renderer)
+
+ # If the collection is made up of a single shape/color/stroke,
+ # it can be rendered once and blitted multiple times, using
+ # `draw_markers` rather than `draw_path_collection`. This is
+ # *much* faster for Agg, and results in smaller file sizes in
+ # PDF/SVG/PS.
+
+ trans = self.get_transforms()
+ facecolors = self.get_facecolor()
+ edgecolors = self.get_edgecolor()
+ do_single_path_optimization = False
+ if (len(paths) == 1 and len(trans) <= 1 and
+ len(facecolors) == 1 and len(edgecolors) == 1 and
+ len(self._linewidths) == 1 and
+ all(ls[1] is None for ls in self._linestyles) and
+ len(self._antialiaseds) == 1 and len(self._urls) == 1 and
+ self.get_hatch() is None):
+ if len(trans):
+ combined_transform = transforms.Affine2D(trans[0]) + transform
+ else:
+ combined_transform = transform
+ extents = paths[0].get_extents(combined_transform)
+ if (extents.width < self.figure.bbox.width
+ and extents.height < self.figure.bbox.height):
+ do_single_path_optimization = True
+
+ if self._joinstyle:
+ gc.set_joinstyle(self._joinstyle)
+
+ if self._capstyle:
+ gc.set_capstyle(self._capstyle)
+
+ if do_single_path_optimization:
+ gc.set_foreground(tuple(edgecolors[0]))
+ gc.set_linewidth(self._linewidths[0])
+ gc.set_dashes(*self._linestyles[0])
+ gc.set_antialiased(self._antialiaseds[0])
+ gc.set_url(self._urls[0])
+ renderer.draw_markers(
+ gc, paths[0], combined_transform.frozen(),
+ mpath.Path(offsets), transOffset, tuple(facecolors[0]))
+ else:
+ renderer.draw_path_collection(
+ gc, transform.frozen(), paths,
+ self.get_transforms(), offsets, transOffset,
+ self.get_facecolor(), self.get_edgecolor(),
+ self._linewidths, self._linestyles,
+ self._antialiaseds, self._urls,
+ self._offset_position)
+
+ gc.restore()
+ renderer.close_group(self.__class__.__name__)
+ self.stale = False
+
+ def set_pickradius(self, pr):
+ """
+ Set the pick radius used for containment tests.
+
+ Parameters
+ ----------
+ pr : float
+ Pick radius, in points.
+ """
+ self._pickradius = pr
+
+ def get_pickradius(self):
+ return self._pickradius
+
+ def contains(self, mouseevent):
+ """
+ Test whether the mouse event occurred in the collection.
+
+ Returns ``bool, dict(ind=itemlist)``, where every item in itemlist
+ contains the event.
+ """
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+
+ if not self.get_visible():
+ return False, {}
+
+ pickradius = (
+ float(self._picker)
+ if isinstance(self._picker, Number) and
+ self._picker is not True # the bool, not just nonzero or 1
+ else self._pickradius)
+
+ if self.axes:
+ self.axes._unstale_viewLim()
+
+ transform, transOffset, offsets, paths = self._prepare_points()
+
+ # Tests if the point is contained on one of the polygons formed
+ # by the control points of each of the paths. A point is considered
+ # "on" a path if it would lie within a stroke of width 2*pickradius
+ # following the path. If pickradius <= 0, then we instead simply check
+ # if the point is *inside* of the path instead.
+ ind = _path.point_in_path_collection(
+ mouseevent.x, mouseevent.y, pickradius,
+ transform.frozen(), paths, self.get_transforms(),
+ offsets, transOffset, pickradius <= 0,
+ self._offset_position)
+
+ return len(ind) > 0, dict(ind=ind)
+
+ def set_urls(self, urls):
+ """
+ Parameters
+ ----------
+ urls : list of str or None
+
+ Notes
+ -----
+ URLs are currently only implemented by the SVG backend. They are
+ ignored by all other backends.
+ """
+ self._urls = urls if urls is not None else [None]
+ self.stale = True
+
+ def get_urls(self):
+ """
+ Return a list of URLs, one for each element of the collection.
+
+ The list contains *None* for elements without a URL. See
+ :doc:`/gallery/misc/hyperlinks_sgskip` for an example.
+ """
+ return self._urls
+
+ def set_hatch(self, hatch):
+ r"""
+ Set the hatching pattern
+
+ *hatch* can be one of::
+
+ / - diagonal hatching
+ \ - back diagonal
+ | - vertical
+ - - horizontal
+ + - crossed
+ x - crossed diagonal
+ o - small circle
+ O - large circle
+ . - dots
+ * - stars
+
+ Letters can be combined, in which case all the specified
+ hatchings are done. If same letter repeats, it increases the
+ density of hatching of that pattern.
+
+ Hatching is supported in the PostScript, PDF, SVG and Agg
+ backends only.
+
+ Unlike other properties such as linewidth and colors, hatching
+ can only be specified for the collection as a whole, not separately
+ for each member.
+
+ Parameters
+ ----------
+ hatch : {'/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
+ """
+ # Use validate_hatch(list) after deprecation.
+ mhatch._validate_hatch_pattern(hatch)
+ self._hatch = hatch
+ self.stale = True
+
+ def get_hatch(self):
+ """Return the current hatching pattern."""
+ return self._hatch
+
+ def set_offsets(self, offsets):
+ """
+ Set the offsets for the collection.
+
+ Parameters
+ ----------
+ offsets : (N, 2) or (2,) array-like
+ """
+ offsets = np.asanyarray(offsets, float)
+ if offsets.shape == (2,): # Broadcast (2,) -> (1, 2) but nothing else.
+ offsets = offsets[None, :]
+ # This decision is based on how they are initialized above in __init__.
+ if self._uniform_offsets is None:
+ self._offsets = offsets
+ else:
+ self._uniform_offsets = offsets
+ self.stale = True
+
+ def get_offsets(self):
+ """Return the offsets for the collection."""
+ # This decision is based on how they are initialized above in __init__.
+ if self._uniform_offsets is None:
+ return self._offsets
+ else:
+ return self._uniform_offsets
+
+ @_api.deprecated("3.3")
+ def set_offset_position(self, offset_position):
+ """
+ Set how offsets are applied. If *offset_position* is 'screen'
+ (default) the offset is applied after the master transform has
+ been applied, that is, the offsets are in screen coordinates.
+ If offset_position is 'data', the offset is applied before the
+ master transform, i.e., the offsets are in data coordinates.
+
+ Parameters
+ ----------
+ offset_position : {'screen', 'data'}
+ """
+ _api.check_in_list(['screen', 'data'], offset_position=offset_position)
+ self._offset_position = offset_position
+ self.stale = True
+
+ @_api.deprecated("3.3")
+ def get_offset_position(self):
+ """
+ Return how offsets are applied for the collection. If
+ *offset_position* is 'screen', the offset is applied after the
+ master transform has been applied, that is, the offsets are in
+ screen coordinates. If offset_position is 'data', the offset
+ is applied before the master transform, i.e., the offsets are
+ in data coordinates.
+ """
+ return self._offset_position
+
+ def _get_default_linewidth(self):
+ # This may be overridden in a subclass.
+ return mpl.rcParams['patch.linewidth'] # validated as float
+
+ def set_linewidth(self, lw):
+ """
+ Set the linewidth(s) for the collection. *lw* can be a scalar
+ or a sequence; if it is a sequence the patches will cycle
+ through the sequence
+
+ Parameters
+ ----------
+ lw : float or list of floats
+ """
+ if lw is None:
+ lw = self._get_default_linewidth()
+ # get the un-scaled/broadcast lw
+ self._us_lw = np.atleast_1d(np.asarray(lw))
+
+ # scale all of the dash patterns.
+ self._linewidths, self._linestyles = self._bcast_lwls(
+ self._us_lw, self._us_linestyles)
+ self.stale = True
+
+ def set_linestyle(self, ls):
+ """
+ Set the linestyle(s) for the collection.
+
+ =========================== =================
+ linestyle description
+ =========================== =================
+ ``'-'`` or ``'solid'`` solid line
+ ``'--'`` or ``'dashed'`` dashed line
+ ``'-.'`` or ``'dashdot'`` dash-dotted line
+ ``':'`` or ``'dotted'`` dotted line
+ =========================== =================
+
+ Alternatively a dash tuple of the following form can be provided::
+
+ (offset, onoffseq),
+
+ where ``onoffseq`` is an even length tuple of on and off ink in points.
+
+ Parameters
+ ----------
+ ls : str or tuple or list thereof
+ Valid values for individual linestyles include {'-', '--', '-.',
+ ':', '', (offset, on-off-seq)}. See `.Line2D.set_linestyle` for a
+ complete description.
+ """
+ try:
+ if isinstance(ls, str):
+ ls = cbook.ls_mapper.get(ls, ls)
+ dashes = [mlines._get_dash_pattern(ls)]
+ else:
+ try:
+ dashes = [mlines._get_dash_pattern(ls)]
+ except ValueError:
+ dashes = [mlines._get_dash_pattern(x) for x in ls]
+
+ except ValueError as err:
+ raise ValueError('Do not know how to convert {!r} to '
+ 'dashes'.format(ls)) from err
+
+ # get the list of raw 'unscaled' dash patterns
+ self._us_linestyles = dashes
+
+ # broadcast and scale the lw and dash patterns
+ self._linewidths, self._linestyles = self._bcast_lwls(
+ self._us_lw, self._us_linestyles)
+
+ @docstring.interpd
+ def set_capstyle(self, cs):
+ """
+ Set the `.CapStyle` for the collection (for all its elements).
+
+ Parameters
+ ----------
+ cs : `.CapStyle` or %(CapStyle)s
+ """
+ self._capstyle = CapStyle(cs)
+
+ def get_capstyle(self):
+ return self._capstyle.name
+
+ @docstring.interpd
+ def set_joinstyle(self, js):
+ """
+ Set the `.JoinStyle` for the collection (for all its elements).
+
+ Parameters
+ ----------
+ js : `.JoinStyle` or %(JoinStyle)s
+ """
+ self._joinstyle = JoinStyle(js)
+
+ def get_joinstyle(self):
+ return self._joinstyle.name
+
+ @staticmethod
+ def _bcast_lwls(linewidths, dashes):
+ """
+ Internal helper function to broadcast + scale ls/lw
+
+ In the collection drawing code, the linewidth and linestyle are cycled
+ through as circular buffers (via ``v[i % len(v)]``). Thus, if we are
+ going to scale the dash pattern at set time (not draw time) we need to
+ do the broadcasting now and expand both lists to be the same length.
+
+ Parameters
+ ----------
+ linewidths : list
+ line widths of collection
+ dashes : list
+ dash specification (offset, (dash pattern tuple))
+
+ Returns
+ -------
+ linewidths, dashes : list
+ Will be the same length, dashes are scaled by paired linewidth
+ """
+ if mpl.rcParams['_internal.classic_mode']:
+ return linewidths, dashes
+ # make sure they are the same length so we can zip them
+ if len(dashes) != len(linewidths):
+ l_dashes = len(dashes)
+ l_lw = len(linewidths)
+ gcd = math.gcd(l_dashes, l_lw)
+ dashes = list(dashes) * (l_lw // gcd)
+ linewidths = list(linewidths) * (l_dashes // gcd)
+
+ # scale the dash patters
+ dashes = [mlines._scale_dashes(o, d, lw)
+ for (o, d), lw in zip(dashes, linewidths)]
+
+ return linewidths, dashes
+
+ def set_antialiased(self, aa):
+ """
+ Set the antialiasing state for rendering.
+
+ Parameters
+ ----------
+ aa : bool or list of bools
+ """
+ if aa is None:
+ aa = self._get_default_antialiased()
+ self._antialiaseds = np.atleast_1d(np.asarray(aa, bool))
+ self.stale = True
+
+ def _get_default_antialiased(self):
+ # This may be overridden in a subclass.
+ return mpl.rcParams['patch.antialiased']
+
+ def set_color(self, c):
+ """
+ Set both the edgecolor and the facecolor.
+
+ Parameters
+ ----------
+ c : color or list of rgba tuples
+
+ See Also
+ --------
+ Collection.set_facecolor, Collection.set_edgecolor
+ For setting the edge or face color individually.
+ """
+ self.set_facecolor(c)
+ self.set_edgecolor(c)
+
+ def _get_default_facecolor(self):
+ # This may be overridden in a subclass.
+ return mpl.rcParams['patch.facecolor']
+
+ def _set_facecolor(self, c):
+ if c is None:
+ c = self._get_default_facecolor()
+
+ self._facecolors = mcolors.to_rgba_array(c, self._alpha)
+ self.stale = True
+
+ def set_facecolor(self, c):
+ """
+ Set the facecolor(s) of the collection. *c* can be a color (all patches
+ have same color), or a sequence of colors; if it is a sequence the
+ patches will cycle through the sequence.
+
+ If *c* is 'none', the patch will not be filled.
+
+ Parameters
+ ----------
+ c : color or list of colors
+ """
+ if isinstance(c, str) and c.lower() in ("none", "face"):
+ c = c.lower()
+ self._original_facecolor = c
+ self._set_facecolor(c)
+
+ def get_facecolor(self):
+ return self._facecolors
+
+ def get_edgecolor(self):
+ if cbook._str_equal(self._edgecolors, 'face'):
+ return self.get_facecolor()
+ else:
+ return self._edgecolors
+
+ def _get_default_edgecolor(self):
+ # This may be overridden in a subclass.
+ return mpl.rcParams['patch.edgecolor']
+
+ def _set_edgecolor(self, c):
+ set_hatch_color = True
+ if c is None:
+ if (mpl.rcParams['patch.force_edgecolor']
+ or self._edge_default
+ or cbook._str_equal(self._original_facecolor, 'none')):
+ c = self._get_default_edgecolor()
+ else:
+ c = 'none'
+ set_hatch_color = False
+ if cbook._str_lower_equal(c, 'face'):
+ self._edgecolors = 'face'
+ self.stale = True
+ return
+ self._edgecolors = mcolors.to_rgba_array(c, self._alpha)
+ if set_hatch_color and len(self._edgecolors):
+ self._hatch_color = tuple(self._edgecolors[0])
+ self.stale = True
+
+ def set_edgecolor(self, c):
+ """
+ Set the edgecolor(s) of the collection.
+
+ Parameters
+ ----------
+ c : color or list of colors or 'face'
+ The collection edgecolor(s). If a sequence, the patches cycle
+ through it. If 'face', match the facecolor.
+ """
+ # We pass through a default value for use in LineCollection.
+ # This allows us to maintain None as the default indicator in
+ # _original_edgecolor.
+ if isinstance(c, str) and c.lower() in ("none", "face"):
+ c = c.lower()
+ self._original_edgecolor = c
+ self._set_edgecolor(c)
+
+ def set_alpha(self, alpha):
+ """
+ Set the transparency of the collection.
+
+ Parameters
+ ----------
+ alpha : float or array of float or None
+ If not None, *alpha* values must be between 0 and 1, inclusive.
+ If an array is provided, its length must match the number of
+ elements in the collection. Masked values and nans are not
+ supported.
+ """
+ artist.Artist._set_alpha_for_array(self, alpha)
+ self._update_dict['array'] = True
+ self._set_facecolor(self._original_facecolor)
+ self._set_edgecolor(self._original_edgecolor)
+
+ set_alpha.__doc__ = artist.Artist._set_alpha_for_array.__doc__
+
+ def get_linewidth(self):
+ return self._linewidths
+
+ def get_linestyle(self):
+ return self._linestyles
+
+ def _set_mappable_flags(self):
+ """
+ Determine whether edges and/or faces are color-mapped.
+
+ This is a helper for update_scalarmappable.
+ It sets Boolean flags '_edge_is_mapped' and '_face_is_mapped'.
+
+ Returns
+ -------
+ mapping_change : bool
+ True if either flag is True, or if a flag has changed.
+ """
+ # The flags are initialized to None to ensure this returns True
+ # the first time it is called.
+ edge0 = self._edge_is_mapped
+ face0 = self._face_is_mapped
+ # After returning, the flags must be Booleans, not None.
+ self._edge_is_mapped = False
+ self._face_is_mapped = False
+ if self._A is not None:
+ if not cbook._str_equal(self._original_facecolor, 'none'):
+ self._face_is_mapped = True
+ if cbook._str_equal(self._original_edgecolor, 'face'):
+ self._edge_is_mapped = True
+ else:
+ if self._original_edgecolor is None:
+ self._edge_is_mapped = True
+
+ mapped = self._face_is_mapped or self._edge_is_mapped
+ changed = (edge0 is None or face0 is None
+ or self._edge_is_mapped != edge0
+ or self._face_is_mapped != face0)
+ return mapped or changed
+
+ def update_scalarmappable(self):
+ """
+ Update colors from the scalar mappable array, if any.
+
+ Assign colors to edges and faces based on the array and/or
+ colors that were directly set, as appropriate.
+ """
+ if not self._set_mappable_flags():
+ return
+ # Allow possibility to call 'self.set_array(None)'.
+ if self._check_update("array") and self._A is not None:
+ # QuadMesh can map 2d arrays (but pcolormesh supplies 1d array)
+ if self._A.ndim > 1 and not isinstance(self, QuadMesh):
+ raise ValueError('Collections can only map rank 1 arrays')
+ if np.iterable(self._alpha):
+ if self._alpha.size != self._A.size:
+ raise ValueError(
+ f'Data array shape, {self._A.shape} '
+ 'is incompatible with alpha array shape, '
+ f'{self._alpha.shape}. '
+ 'This can occur with the deprecated '
+ 'behavior of the "flat" shading option, '
+ 'in which a row and/or column of the data '
+ 'array is dropped.')
+ # pcolormesh, scatter, maybe others flatten their _A
+ self._alpha = self._alpha.reshape(self._A.shape)
+ self._mapped_colors = self.to_rgba(self._A, self._alpha)
+
+ if self._face_is_mapped:
+ self._facecolors = self._mapped_colors
+ else:
+ self._set_facecolor(self._original_facecolor)
+ if self._edge_is_mapped:
+ self._edgecolors = self._mapped_colors
+ else:
+ self._set_edgecolor(self._original_edgecolor)
+ self.stale = True
+
+ def get_fill(self):
+ """Return whether face is colored."""
+ return not cbook._str_lower_equal(self._original_facecolor, "none")
+
+ def update_from(self, other):
+ """Copy properties from other to self."""
+
+ artist.Artist.update_from(self, other)
+ self._antialiaseds = other._antialiaseds
+ self._mapped_colors = other._mapped_colors
+ self._edge_is_mapped = other._edge_is_mapped
+ self._original_edgecolor = other._original_edgecolor
+ self._edgecolors = other._edgecolors
+ self._face_is_mapped = other._face_is_mapped
+ self._original_facecolor = other._original_facecolor
+ self._facecolors = other._facecolors
+ self._linewidths = other._linewidths
+ self._linestyles = other._linestyles
+ self._us_linestyles = other._us_linestyles
+ self._pickradius = other._pickradius
+ self._hatch = other._hatch
+
+ # update_from for scalarmappable
+ self._A = other._A
+ self.norm = other.norm
+ self.cmap = other.cmap
+ self._update_dict = other._update_dict.copy()
+ self.stale = True
+
+
+class _CollectionWithSizes(Collection):
+ """
+ Base class for collections that have an array of sizes.
+ """
+ _factor = 1.0
+
+ def get_sizes(self):
+ """
+ Return the sizes ('areas') of the elements in the collection.
+
+ Returns
+ -------
+ array
+ The 'area' of each element.
+ """
+ return self._sizes
+
+ def set_sizes(self, sizes, dpi=72.0):
+ """
+ Set the sizes of each member of the collection.
+
+ Parameters
+ ----------
+ sizes : ndarray or None
+ The size to set for each element of the collection. The
+ value is the 'area' of the element.
+ dpi : float, default: 72
+ The dpi of the canvas.
+ """
+ if sizes is None:
+ self._sizes = np.array([])
+ self._transforms = np.empty((0, 3, 3))
+ else:
+ self._sizes = np.asarray(sizes)
+ self._transforms = np.zeros((len(self._sizes), 3, 3))
+ scale = np.sqrt(self._sizes) * dpi / 72.0 * self._factor
+ self._transforms[:, 0, 0] = scale
+ self._transforms[:, 1, 1] = scale
+ self._transforms[:, 2, 2] = 1.0
+ self.stale = True
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ self.set_sizes(self._sizes, self.figure.dpi)
+ super().draw(renderer)
+
+
+class PathCollection(_CollectionWithSizes):
+ r"""
+ A collection of `~.path.Path`\s, as created by e.g. `~.Axes.scatter`.
+ """
+
+ def __init__(self, paths, sizes=None, **kwargs):
+ """
+ Parameters
+ ----------
+ paths : list of `.path.Path`
+ The paths that will make up the `.Collection`.
+ sizes : array-like
+ The factor by which to scale each drawn `~.path.Path`. One unit
+ squared in the Path's data space is scaled to be ``sizes**2``
+ points when rendered.
+ **kwargs
+ Forwarded to `.Collection`.
+ """
+
+ super().__init__(**kwargs)
+ self.set_paths(paths)
+ self.set_sizes(sizes)
+ self.stale = True
+
+ def set_paths(self, paths):
+ self._paths = paths
+ self.stale = True
+
+ def get_paths(self):
+ return self._paths
+
+ def legend_elements(self, prop="colors", num="auto",
+ fmt=None, func=lambda x: x, **kwargs):
+ """
+ Create legend handles and labels for a PathCollection.
+
+ Each legend handle is a `.Line2D` representing the Path that was drawn,
+ and each label is a string what each Path represents.
+
+ This is useful for obtaining a legend for a `~.Axes.scatter` plot;
+ e.g.::
+
+ scatter = plt.scatter([1, 2, 3], [4, 5, 6], c=[7, 2, 3])
+ plt.legend(*scatter.legend_elements())
+
+ creates three legend elements, one for each color with the numerical
+ values passed to *c* as the labels.
+
+ Also see the :ref:`automatedlegendcreation` example.
+
+ Parameters
+ ----------
+ prop : {"colors", "sizes"}, default: "colors"
+ If "colors", the legend handles will show the different colors of
+ the collection. If "sizes", the legend will show the different
+ sizes. To set both, use *kwargs* to directly edit the `.Line2D`
+ properties.
+ num : int, None, "auto" (default), array-like, or `~.ticker.Locator`
+ Target number of elements to create.
+ If None, use all unique elements of the mappable array. If an
+ integer, target to use *num* elements in the normed range.
+ If *"auto"*, try to determine which option better suits the nature
+ of the data.
+ The number of created elements may slightly deviate from *num* due
+ to a `~.ticker.Locator` being used to find useful locations.
+ If a list or array, use exactly those elements for the legend.
+ Finally, a `~.ticker.Locator` can be provided.
+ fmt : str, `~matplotlib.ticker.Formatter`, or None (default)
+ The format or formatter to use for the labels. If a string must be
+ a valid input for a `~.StrMethodFormatter`. If None (the default),
+ use a `~.ScalarFormatter`.
+ func : function, default: ``lambda x: x``
+ Function to calculate the labels. Often the size (or color)
+ argument to `~.Axes.scatter` will have been pre-processed by the
+ user using a function ``s = f(x)`` to make the markers visible;
+ e.g. ``size = np.log10(x)``. Providing the inverse of this
+ function here allows that pre-processing to be inverted, so that
+ the legend labels have the correct values; e.g. ``func = lambda
+ x: 10**x``.
+ **kwargs
+ Allowed keyword arguments are *color* and *size*. E.g. it may be
+ useful to set the color of the markers if *prop="sizes"* is used;
+ similarly to set the size of the markers if *prop="colors"* is
+ used. Any further parameters are passed onto the `.Line2D`
+ instance. This may be useful to e.g. specify a different
+ *markeredgecolor* or *alpha* for the legend handles.
+
+ Returns
+ -------
+ handles : list of `.Line2D`
+ Visual representation of each element of the legend.
+ labels : list of str
+ The string labels for elements of the legend.
+ """
+ handles = []
+ labels = []
+ hasarray = self.get_array() is not None
+ if fmt is None:
+ fmt = mpl.ticker.ScalarFormatter(useOffset=False, useMathText=True)
+ elif isinstance(fmt, str):
+ fmt = mpl.ticker.StrMethodFormatter(fmt)
+ fmt.create_dummy_axis()
+
+ if prop == "colors":
+ if not hasarray:
+ warnings.warn("Collection without array used. Make sure to "
+ "specify the values to be colormapped via the "
+ "`c` argument.")
+ return handles, labels
+ u = np.unique(self.get_array())
+ size = kwargs.pop("size", mpl.rcParams["lines.markersize"])
+ elif prop == "sizes":
+ u = np.unique(self.get_sizes())
+ color = kwargs.pop("color", "k")
+ else:
+ raise ValueError("Valid values for `prop` are 'colors' or "
+ f"'sizes'. You supplied '{prop}' instead.")
+
+ fmt.set_bounds(func(u).min(), func(u).max())
+ if num == "auto":
+ num = 9
+ if len(u) <= num:
+ num = None
+ if num is None:
+ values = u
+ label_values = func(values)
+ else:
+ if prop == "colors":
+ arr = self.get_array()
+ elif prop == "sizes":
+ arr = self.get_sizes()
+ if isinstance(num, mpl.ticker.Locator):
+ loc = num
+ elif np.iterable(num):
+ loc = mpl.ticker.FixedLocator(num)
+ else:
+ num = int(num)
+ loc = mpl.ticker.MaxNLocator(nbins=num, min_n_ticks=num-1,
+ steps=[1, 2, 2.5, 3, 5, 6, 8, 10])
+ label_values = loc.tick_values(func(arr).min(), func(arr).max())
+ cond = ((label_values >= func(arr).min()) &
+ (label_values <= func(arr).max()))
+ label_values = label_values[cond]
+ yarr = np.linspace(arr.min(), arr.max(), 256)
+ xarr = func(yarr)
+ ix = np.argsort(xarr)
+ values = np.interp(label_values, xarr[ix], yarr[ix])
+
+ kw = dict(markeredgewidth=self.get_linewidths()[0],
+ alpha=self.get_alpha())
+ kw.update(kwargs)
+
+ for val, lab in zip(values, label_values):
+ if prop == "colors":
+ color = self.cmap(self.norm(val))
+ elif prop == "sizes":
+ size = np.sqrt(val)
+ if np.isclose(size, 0.0):
+ continue
+ h = mlines.Line2D([0], [0], ls="", color=color, ms=size,
+ marker=self.get_paths()[0], **kw)
+ handles.append(h)
+ if hasattr(fmt, "set_locs"):
+ fmt.set_locs(label_values)
+ l = fmt(lab)
+ labels.append(l)
+
+ return handles, labels
+
+
+class PolyCollection(_CollectionWithSizes):
+ def __init__(self, verts, sizes=None, closed=True, **kwargs):
+ """
+ Parameters
+ ----------
+ verts : list of array-like
+ The sequence of polygons [*verts0*, *verts1*, ...] where each
+ element *verts_i* defines the vertices of polygon *i* as a 2D
+ array-like of shape (M, 2).
+ sizes : array-like, default: None
+ Squared scaling factors for the polygons. The coordinates of each
+ polygon *verts_i* are multiplied by the square-root of the
+ corresponding entry in *sizes* (i.e., *sizes* specify the scaling
+ of areas). The scaling is applied before the Artist master
+ transform.
+ closed : bool, default: True
+ Whether the polygon should be closed by adding a CLOSEPOLY
+ connection at the end.
+ **kwargs
+ Forwarded to `.Collection`.
+ """
+ super().__init__(**kwargs)
+ self.set_sizes(sizes)
+ self.set_verts(verts, closed)
+ self.stale = True
+
+ def set_verts(self, verts, closed=True):
+ """
+ Set the vertices of the polygons.
+
+ Parameters
+ ----------
+ verts : list of array-like
+ The sequence of polygons [*verts0*, *verts1*, ...] where each
+ element *verts_i* defines the vertices of polygon *i* as a 2D
+ array-like of shape (M, 2).
+ closed : bool, default: True
+ Whether the polygon should be closed by adding a CLOSEPOLY
+ connection at the end.
+ """
+ self.stale = True
+ if isinstance(verts, np.ma.MaskedArray):
+ verts = verts.astype(float).filled(np.nan)
+
+ # No need to do anything fancy if the path isn't closed.
+ if not closed:
+ self._paths = [mpath.Path(xy) for xy in verts]
+ return
+
+ # Fast path for arrays
+ if isinstance(verts, np.ndarray) and len(verts.shape) == 3:
+ verts_pad = np.concatenate((verts, verts[:, :1]), axis=1)
+ # Creating the codes once is much faster than having Path do it
+ # separately each time by passing closed=True.
+ codes = np.empty(verts_pad.shape[1], dtype=mpath.Path.code_type)
+ codes[:] = mpath.Path.LINETO
+ codes[0] = mpath.Path.MOVETO
+ codes[-1] = mpath.Path.CLOSEPOLY
+ self._paths = [mpath.Path(xy, codes) for xy in verts_pad]
+ return
+
+ self._paths = []
+ for xy in verts:
+ if len(xy):
+ if isinstance(xy, np.ma.MaskedArray):
+ xy = np.ma.concatenate([xy, xy[:1]])
+ else:
+ xy = np.concatenate([xy, xy[:1]])
+ self._paths.append(mpath.Path(xy, closed=True))
+ else:
+ self._paths.append(mpath.Path(xy))
+
+ set_paths = set_verts
+
+ def set_verts_and_codes(self, verts, codes):
+ """Initialize vertices with path codes."""
+ if len(verts) != len(codes):
+ raise ValueError("'codes' must be a 1D list or array "
+ "with the same length of 'verts'")
+ self._paths = []
+ for xy, cds in zip(verts, codes):
+ if len(xy):
+ self._paths.append(mpath.Path(xy, cds))
+ else:
+ self._paths.append(mpath.Path(xy))
+ self.stale = True
+
+
+class BrokenBarHCollection(PolyCollection):
+ """
+ A collection of horizontal bars spanning *yrange* with a sequence of
+ *xranges*.
+ """
+ def __init__(self, xranges, yrange, **kwargs):
+ """
+ Parameters
+ ----------
+ xranges : list of (float, float)
+ The sequence of (left-edge-position, width) pairs for each bar.
+ yrange : (float, float)
+ The (lower-edge, height) common to all bars.
+ **kwargs
+ Forwarded to `.Collection`.
+ """
+ ymin, ywidth = yrange
+ ymax = ymin + ywidth
+ verts = [[(xmin, ymin),
+ (xmin, ymax),
+ (xmin + xwidth, ymax),
+ (xmin + xwidth, ymin),
+ (xmin, ymin)] for xmin, xwidth in xranges]
+ super().__init__(verts, **kwargs)
+
+ @classmethod
+ def span_where(cls, x, ymin, ymax, where, **kwargs):
+ """
+ Return a `.BrokenBarHCollection` that plots horizontal bars from
+ over the regions in *x* where *where* is True. The bars range
+ on the y-axis from *ymin* to *ymax*
+
+ *kwargs* are passed on to the collection.
+ """
+ xranges = []
+ for ind0, ind1 in cbook.contiguous_regions(where):
+ xslice = x[ind0:ind1]
+ if not len(xslice):
+ continue
+ xranges.append((xslice[0], xslice[-1] - xslice[0]))
+ return cls(xranges, [ymin, ymax - ymin], **kwargs)
+
+
+class RegularPolyCollection(_CollectionWithSizes):
+ """A collection of n-sided regular polygons."""
+
+ _path_generator = mpath.Path.unit_regular_polygon
+ _factor = np.pi ** (-1/2)
+
+ def __init__(self,
+ numsides,
+ rotation=0,
+ sizes=(1,),
+ **kwargs):
+ """
+ Parameters
+ ----------
+ numsides : int
+ The number of sides of the polygon.
+ rotation : float
+ The rotation of the polygon in radians.
+ sizes : tuple of float
+ The area of the circle circumscribing the polygon in points^2.
+ **kwargs
+ Forwarded to `.Collection`.
+
+ Examples
+ --------
+ See :doc:`/gallery/event_handling/lasso_demo` for a complete example::
+
+ offsets = np.random.rand(20, 2)
+ facecolors = [cm.jet(x) for x in np.random.rand(20)]
+
+ collection = RegularPolyCollection(
+ numsides=5, # a pentagon
+ rotation=0, sizes=(50,),
+ facecolors=facecolors,
+ edgecolors=("black",),
+ linewidths=(1,),
+ offsets=offsets,
+ transOffset=ax.transData,
+ )
+ """
+ super().__init__(**kwargs)
+ self.set_sizes(sizes)
+ self._numsides = numsides
+ self._paths = [self._path_generator(numsides)]
+ self._rotation = rotation
+ self.set_transform(transforms.IdentityTransform())
+
+ def get_numsides(self):
+ return self._numsides
+
+ def get_rotation(self):
+ return self._rotation
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ self.set_sizes(self._sizes, self.figure.dpi)
+ self._transforms = [
+ transforms.Affine2D(x).rotate(-self._rotation).get_matrix()
+ for x in self._transforms
+ ]
+ # Explicitly not super().draw, because set_sizes must be called before
+ # updating self._transforms.
+ Collection.draw(self, renderer)
+
+
+class StarPolygonCollection(RegularPolyCollection):
+ """Draw a collection of regular stars with *numsides* points."""
+ _path_generator = mpath.Path.unit_regular_star
+
+
+class AsteriskPolygonCollection(RegularPolyCollection):
+ """Draw a collection of regular asterisks with *numsides* points."""
+ _path_generator = mpath.Path.unit_regular_asterisk
+
+
+class LineCollection(Collection):
+ r"""
+ Represents a sequence of `.Line2D`\s that should be drawn together.
+
+ This class extends `.Collection` to represent a sequence of
+ `~.Line2D`\s instead of just a sequence of `~.Patch`\s.
+ Just as in `.Collection`, each property of a *LineCollection* may be either
+ a single value or a list of values. This list is then used cyclically for
+ each element of the LineCollection, so the property of the ``i``\th element
+ of the collection is::
+
+ prop[i % len(prop)]
+
+ The properties of each member of a *LineCollection* default to their values
+ in :rc:`lines.*` instead of :rc:`patch.*`, and the property *colors* is
+ added in place of *edgecolors*.
+ """
+
+ _edge_default = True
+
+ def __init__(self, segments, # Can be None.
+ *args, # Deprecated.
+ zorder=2, # Collection.zorder is 1
+ **kwargs
+ ):
+ """
+ Parameters
+ ----------
+ segments : list of array-like
+ A sequence of (*line0*, *line1*, *line2*), where::
+
+ linen = (x0, y0), (x1, y1), ... (xm, ym)
+
+ or the equivalent numpy array with two columns. Each line
+ can have a different number of segments.
+ linewidths : float or list of float, default: :rc:`lines.linewidth`
+ The width of each line in points.
+ colors : color or list of color, default: :rc:`lines.color`
+ A sequence of RGBA tuples (e.g., arbitrary color strings, etc, not
+ allowed).
+ antialiaseds : bool or list of bool, default: :rc:`lines.antialiased`
+ Whether to use antialiasing for each line.
+ zorder : int, default: 2
+ zorder of the lines once drawn.
+
+ facecolors : color or list of color, default: 'none'
+ When setting *facecolors*, each line is interpreted as a boundary
+ for an area, implicitly closing the path from the last point to the
+ first point. The enclosed area is filled with *facecolor*.
+ In order to manually specify what should count as the "interior" of
+ each line, please use `.PathCollection` instead, where the
+ "interior" can be specified by appropriate usage of
+ `~.path.Path.CLOSEPOLY`.
+
+ **kwargs
+ Forwarded to `.Collection`.
+ """
+ argnames = ["linewidths", "colors", "antialiaseds", "linestyles",
+ "offsets", "transOffset", "norm", "cmap", "pickradius",
+ "zorder", "facecolors"]
+ if args:
+ argkw = {name: val for name, val in zip(argnames, args)}
+ kwargs.update(argkw)
+ cbook.warn_deprecated(
+ "3.4", message="Since %(since)s, passing LineCollection "
+ "arguments other than the first, 'segments', as positional "
+ "arguments is deprecated, and they will become keyword-only "
+ "arguments %(removal)s."
+ )
+ # Unfortunately, mplot3d needs this explicit setting of 'facecolors'.
+ kwargs.setdefault('facecolors', 'none')
+ super().__init__(
+ zorder=zorder,
+ **kwargs)
+ self.set_segments(segments)
+
+ def set_segments(self, segments):
+ if segments is None:
+ return
+ _segments = []
+
+ for seg in segments:
+ if not isinstance(seg, np.ma.MaskedArray):
+ seg = np.asarray(seg, float)
+ _segments.append(seg)
+
+ if self._uniform_offsets is not None:
+ _segments = self._add_offsets(_segments)
+
+ self._paths = [mpath.Path(_seg) for _seg in _segments]
+ self.stale = True
+
+ set_verts = set_segments # for compatibility with PolyCollection
+ set_paths = set_segments
+
+ def get_segments(self):
+ """
+ Returns
+ -------
+ list
+ List of segments in the LineCollection. Each list item contains an
+ array of vertices.
+ """
+ segments = []
+
+ for path in self._paths:
+ vertices = [vertex for vertex, _ in path.iter_segments()]
+ vertices = np.asarray(vertices)
+ segments.append(vertices)
+
+ return segments
+
+ def _add_offsets(self, segs):
+ offsets = self._uniform_offsets
+ Nsegs = len(segs)
+ Noffs = offsets.shape[0]
+ if Noffs == 1:
+ for i in range(Nsegs):
+ segs[i] = segs[i] + i * offsets
+ else:
+ for i in range(Nsegs):
+ io = i % Noffs
+ segs[i] = segs[i] + offsets[io:io + 1]
+ return segs
+
+ def _get_default_linewidth(self):
+ return mpl.rcParams['lines.linewidth']
+
+ def _get_default_antialiased(self):
+ return mpl.rcParams['lines.antialiased']
+
+ def _get_default_edgecolor(self):
+ return mpl.rcParams['lines.color']
+
+ def _get_default_facecolor(self):
+ return 'none'
+
+ def set_color(self, c):
+ """
+ Set the edgecolor(s) of the LineCollection.
+
+ Parameters
+ ----------
+ c : color or list of colors
+ Single color (all lines have same color), or a
+ sequence of rgba tuples; if it is a sequence the lines will
+ cycle through the sequence.
+ """
+ self.set_edgecolor(c)
+
+ set_colors = set_color
+
+ def get_color(self):
+ return self._edgecolors
+
+ get_colors = get_color # for compatibility with old versions
+
+
+class EventCollection(LineCollection):
+ """
+ A collection of locations along a single axis at which an "event" occurred.
+
+ The events are given by a 1-dimensional array. They do not have an
+ amplitude and are displayed as parallel lines.
+ """
+
+ _edge_default = True
+
+ def __init__(self,
+ positions, # Cannot be None.
+ orientation='horizontal',
+ lineoffset=0,
+ linelength=1,
+ linewidth=None,
+ color=None,
+ linestyle='solid',
+ antialiased=None,
+ **kwargs
+ ):
+ """
+ Parameters
+ ----------
+ positions : 1D array-like
+ Each value is an event.
+ orientation : {'horizontal', 'vertical'}, default: 'horizontal'
+ The sequence of events is plotted along this direction.
+ The marker lines of the single events are along the orthogonal
+ direction.
+ lineoffset : float, default: 0
+ The offset of the center of the markers from the origin, in the
+ direction orthogonal to *orientation*.
+ linelength : float, default: 1
+ The total height of the marker (i.e. the marker stretches from
+ ``lineoffset - linelength/2`` to ``lineoffset + linelength/2``).
+ linewidth : float or list thereof, default: :rc:`lines.linewidth`
+ The line width of the event lines, in points.
+ color : color or list of colors, default: :rc:`lines.color`
+ The color of the event lines.
+ linestyle : str or tuple or list thereof, default: 'solid'
+ Valid strings are ['solid', 'dashed', 'dashdot', 'dotted',
+ '-', '--', '-.', ':']. Dash tuples should be of the form::
+
+ (offset, onoffseq),
+
+ where *onoffseq* is an even length tuple of on and off ink
+ in points.
+ antialiased : bool or list thereof, default: :rc:`lines.antialiased`
+ Whether to use antialiasing for drawing the lines.
+ **kwargs
+ Forwarded to `.LineCollection`.
+
+ Examples
+ --------
+ .. plot:: gallery/lines_bars_and_markers/eventcollection_demo.py
+ """
+ super().__init__([],
+ linewidths=linewidth, linestyles=linestyle,
+ colors=color, antialiaseds=antialiased,
+ **kwargs)
+ self._is_horizontal = True # Initial value, may be switched below.
+ self._linelength = linelength
+ self._lineoffset = lineoffset
+ self.set_orientation(orientation)
+ self.set_positions(positions)
+
+ def get_positions(self):
+ """
+ Return an array containing the floating-point values of the positions.
+ """
+ pos = 0 if self.is_horizontal() else 1
+ return [segment[0, pos] for segment in self.get_segments()]
+
+ def set_positions(self, positions):
+ """Set the positions of the events."""
+ if positions is None:
+ positions = []
+ if np.ndim(positions) != 1:
+ raise ValueError('positions must be one-dimensional')
+ lineoffset = self.get_lineoffset()
+ linelength = self.get_linelength()
+ pos_idx = 0 if self.is_horizontal() else 1
+ segments = np.empty((len(positions), 2, 2))
+ segments[:, :, pos_idx] = np.sort(positions)[:, None]
+ segments[:, 0, 1 - pos_idx] = lineoffset + linelength / 2
+ segments[:, 1, 1 - pos_idx] = lineoffset - linelength / 2
+ self.set_segments(segments)
+
+ def add_positions(self, position):
+ """Add one or more events at the specified positions."""
+ if position is None or (hasattr(position, 'len') and
+ len(position) == 0):
+ return
+ positions = self.get_positions()
+ positions = np.hstack([positions, np.asanyarray(position)])
+ self.set_positions(positions)
+ extend_positions = append_positions = add_positions
+
+ def is_horizontal(self):
+ """True if the eventcollection is horizontal, False if vertical."""
+ return self._is_horizontal
+
+ def get_orientation(self):
+ """
+ Return the orientation of the event line ('horizontal' or 'vertical').
+ """
+ return 'horizontal' if self.is_horizontal() else 'vertical'
+
+ def switch_orientation(self):
+ """
+ Switch the orientation of the event line, either from vertical to
+ horizontal or vice versus.
+ """
+ segments = self.get_segments()
+ for i, segment in enumerate(segments):
+ segments[i] = np.fliplr(segment)
+ self.set_segments(segments)
+ self._is_horizontal = not self.is_horizontal()
+ self.stale = True
+
+ def set_orientation(self, orientation=None):
+ """
+ Set the orientation of the event line.
+
+ Parameters
+ ----------
+ orientation : {'horizontal', 'vertical'}
+ """
+ try:
+ is_horizontal = _api.check_getitem(
+ {"horizontal": True, "vertical": False},
+ orientation=orientation)
+ except ValueError:
+ if (orientation is None or orientation.lower() == "none"
+ or orientation.lower() == "horizontal"):
+ is_horizontal = True
+ elif orientation.lower() == "vertical":
+ is_horizontal = False
+ else:
+ raise
+ normalized = "horizontal" if is_horizontal else "vertical"
+ _api.warn_deprecated(
+ "3.3", message="Support for setting the orientation of "
+ f"EventCollection to {orientation!r} is deprecated since "
+ f"%(since)s and will be removed %(removal)s; please set it to "
+ f"{normalized!r} instead.")
+ if is_horizontal == self.is_horizontal():
+ return
+ self.switch_orientation()
+
+ def get_linelength(self):
+ """Return the length of the lines used to mark each event."""
+ return self._linelength
+
+ def set_linelength(self, linelength):
+ """Set the length of the lines used to mark each event."""
+ if linelength == self.get_linelength():
+ return
+ lineoffset = self.get_lineoffset()
+ segments = self.get_segments()
+ pos = 1 if self.is_horizontal() else 0
+ for segment in segments:
+ segment[0, pos] = lineoffset + linelength / 2.
+ segment[1, pos] = lineoffset - linelength / 2.
+ self.set_segments(segments)
+ self._linelength = linelength
+
+ def get_lineoffset(self):
+ """Return the offset of the lines used to mark each event."""
+ return self._lineoffset
+
+ def set_lineoffset(self, lineoffset):
+ """Set the offset of the lines used to mark each event."""
+ if lineoffset == self.get_lineoffset():
+ return
+ linelength = self.get_linelength()
+ segments = self.get_segments()
+ pos = 1 if self.is_horizontal() else 0
+ for segment in segments:
+ segment[0, pos] = lineoffset + linelength / 2.
+ segment[1, pos] = lineoffset - linelength / 2.
+ self.set_segments(segments)
+ self._lineoffset = lineoffset
+
+ def get_linewidth(self):
+ """Get the width of the lines used to mark each event."""
+ return super().get_linewidth()[0]
+
+ def get_linewidths(self):
+ return super().get_linewidth()
+
+ def get_color(self):
+ """Return the color of the lines used to mark each event."""
+ return self.get_colors()[0]
+
+
+class CircleCollection(_CollectionWithSizes):
+ """A collection of circles, drawn using splines."""
+
+ _factor = np.pi ** (-1/2)
+
+ def __init__(self, sizes, **kwargs):
+ """
+ Parameters
+ ----------
+ sizes : float or array-like
+ The area of each circle in points^2.
+ **kwargs
+ Forwarded to `.Collection`.
+ """
+ super().__init__(**kwargs)
+ self.set_sizes(sizes)
+ self.set_transform(transforms.IdentityTransform())
+ self._paths = [mpath.Path.unit_circle()]
+
+
+class EllipseCollection(Collection):
+ """A collection of ellipses, drawn using splines."""
+
+ def __init__(self, widths, heights, angles, units='points', **kwargs):
+ """
+ Parameters
+ ----------
+ widths : array-like
+ The lengths of the first axes (e.g., major axis lengths).
+ heights : array-like
+ The lengths of second axes.
+ angles : array-like
+ The angles of the first axes, degrees CCW from the x-axis.
+ units : {'points', 'inches', 'dots', 'width', 'height', 'x', 'y', 'xy'}
+ The units in which majors and minors are given; 'width' and
+ 'height' refer to the dimensions of the axes, while 'x' and 'y'
+ refer to the *offsets* data units. 'xy' differs from all others in
+ that the angle as plotted varies with the aspect ratio, and equals
+ the specified angle only when the aspect ratio is unity. Hence
+ it behaves the same as the `~.patches.Ellipse` with
+ ``axes.transData`` as its transform.
+ **kwargs
+ Forwarded to `Collection`.
+ """
+ super().__init__(**kwargs)
+ self._widths = 0.5 * np.asarray(widths).ravel()
+ self._heights = 0.5 * np.asarray(heights).ravel()
+ self._angles = np.deg2rad(angles).ravel()
+ self._units = units
+ self.set_transform(transforms.IdentityTransform())
+ self._transforms = np.empty((0, 3, 3))
+ self._paths = [mpath.Path.unit_circle()]
+
+ def _set_transforms(self):
+ """Calculate transforms immediately before drawing."""
+
+ ax = self.axes
+ fig = self.figure
+
+ if self._units == 'xy':
+ sc = 1
+ elif self._units == 'x':
+ sc = ax.bbox.width / ax.viewLim.width
+ elif self._units == 'y':
+ sc = ax.bbox.height / ax.viewLim.height
+ elif self._units == 'inches':
+ sc = fig.dpi
+ elif self._units == 'points':
+ sc = fig.dpi / 72.0
+ elif self._units == 'width':
+ sc = ax.bbox.width
+ elif self._units == 'height':
+ sc = ax.bbox.height
+ elif self._units == 'dots':
+ sc = 1.0
+ else:
+ raise ValueError('unrecognized units: %s' % self._units)
+
+ self._transforms = np.zeros((len(self._widths), 3, 3))
+ widths = self._widths * sc
+ heights = self._heights * sc
+ sin_angle = np.sin(self._angles)
+ cos_angle = np.cos(self._angles)
+ self._transforms[:, 0, 0] = widths * cos_angle
+ self._transforms[:, 0, 1] = heights * -sin_angle
+ self._transforms[:, 1, 0] = widths * sin_angle
+ self._transforms[:, 1, 1] = heights * cos_angle
+ self._transforms[:, 2, 2] = 1.0
+
+ _affine = transforms.Affine2D
+ if self._units == 'xy':
+ m = ax.transData.get_affine().get_matrix().copy()
+ m[:2, 2:] = 0
+ self.set_transform(_affine(m))
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ self._set_transforms()
+ super().draw(renderer)
+
+
+class PatchCollection(Collection):
+ """
+ A generic collection of patches.
+
+ This makes it easier to assign a colormap to a heterogeneous
+ collection of patches.
+
+ This also may improve plotting speed, since PatchCollection will
+ draw faster than a large number of patches.
+ """
+
+ def __init__(self, patches, match_original=False, **kwargs):
+ """
+ *patches*
+ a sequence of Patch objects. This list may include
+ a heterogeneous assortment of different patch types.
+
+ *match_original*
+ If True, use the colors and linewidths of the original
+ patches. If False, new colors may be assigned by
+ providing the standard collection arguments, facecolor,
+ edgecolor, linewidths, norm or cmap.
+
+ If any of *edgecolors*, *facecolors*, *linewidths*, *antialiaseds* are
+ None, they default to their `.rcParams` patch setting, in sequence
+ form.
+
+ The use of `~matplotlib.cm.ScalarMappable` functionality is optional.
+ If the `~matplotlib.cm.ScalarMappable` matrix ``_A`` has been set (via
+ a call to `~.ScalarMappable.set_array`), at draw time a call to scalar
+ mappable will be made to set the face colors.
+ """
+
+ if match_original:
+ def determine_facecolor(patch):
+ if patch.get_fill():
+ return patch.get_facecolor()
+ return [0, 0, 0, 0]
+
+ kwargs['facecolors'] = [determine_facecolor(p) for p in patches]
+ kwargs['edgecolors'] = [p.get_edgecolor() for p in patches]
+ kwargs['linewidths'] = [p.get_linewidth() for p in patches]
+ kwargs['linestyles'] = [p.get_linestyle() for p in patches]
+ kwargs['antialiaseds'] = [p.get_antialiased() for p in patches]
+
+ super().__init__(**kwargs)
+
+ self.set_paths(patches)
+
+ def set_paths(self, patches):
+ paths = [p.get_transform().transform_path(p.get_path())
+ for p in patches]
+ self._paths = paths
+
+
+class TriMesh(Collection):
+ """
+ Class for the efficient drawing of a triangular mesh using Gouraud shading.
+
+ A triangular mesh is a `~matplotlib.tri.Triangulation` object.
+ """
+ def __init__(self, triangulation, **kwargs):
+ super().__init__(**kwargs)
+ self._triangulation = triangulation
+ self._shading = 'gouraud'
+
+ self._bbox = transforms.Bbox.unit()
+
+ # Unfortunately this requires a copy, unless Triangulation
+ # was rewritten.
+ xy = np.hstack((triangulation.x.reshape(-1, 1),
+ triangulation.y.reshape(-1, 1)))
+ self._bbox.update_from_data_xy(xy)
+
+ def get_paths(self):
+ if self._paths is None:
+ self.set_paths()
+ return self._paths
+
+ def set_paths(self):
+ self._paths = self.convert_mesh_to_paths(self._triangulation)
+
+ @staticmethod
+ def convert_mesh_to_paths(tri):
+ """
+ Convert a given mesh into a sequence of `~.Path` objects.
+
+ This function is primarily of use to implementers of backends that do
+ not directly support meshes.
+ """
+ triangles = tri.get_masked_triangles()
+ verts = np.stack((tri.x[triangles], tri.y[triangles]), axis=-1)
+ return [mpath.Path(x) for x in verts]
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ if not self.get_visible():
+ return
+ renderer.open_group(self.__class__.__name__, gid=self.get_gid())
+ transform = self.get_transform()
+
+ # Get a list of triangles and the color at each vertex.
+ tri = self._triangulation
+ triangles = tri.get_masked_triangles()
+
+ verts = np.stack((tri.x[triangles], tri.y[triangles]), axis=-1)
+
+ self.update_scalarmappable()
+ colors = self._facecolors[triangles]
+
+ gc = renderer.new_gc()
+ self._set_gc_clip(gc)
+ gc.set_linewidth(self.get_linewidth()[0])
+ renderer.draw_gouraud_triangles(gc, verts, colors, transform.frozen())
+ gc.restore()
+ renderer.close_group(self.__class__.__name__)
+
+
+class QuadMesh(Collection):
+ """
+ Class for the efficient drawing of a quadrilateral mesh.
+
+ A quadrilateral mesh consists of a grid of vertices.
+ The dimensions of this array are (*meshWidth* + 1, *meshHeight* + 1).
+ Each vertex in the mesh has a different set of "mesh coordinates"
+ representing its position in the topology of the mesh.
+ For any values (*m*, *n*) such that 0 <= *m* <= *meshWidth*
+ and 0 <= *n* <= *meshHeight*, the vertices at mesh coordinates
+ (*m*, *n*), (*m*, *n* + 1), (*m* + 1, *n* + 1), and (*m* + 1, *n*)
+ form one of the quadrilaterals in the mesh. There are thus
+ (*meshWidth* * *meshHeight*) quadrilaterals in the mesh. The mesh
+ need not be regular and the polygons need not be convex.
+
+ A quadrilateral mesh is represented by a (2 x ((*meshWidth* + 1) *
+ (*meshHeight* + 1))) numpy array *coordinates*, where each row is
+ the *x* and *y* coordinates of one of the vertices. To define the
+ function that maps from a data point to its corresponding color,
+ use the :meth:`set_cmap` method. Each of these arrays is indexed in
+ row-major order by the mesh coordinates of the vertex (or the mesh
+ coordinates of the lower left vertex, in the case of the colors).
+
+ For example, the first entry in *coordinates* is the coordinates of the
+ vertex at mesh coordinates (0, 0), then the one at (0, 1), then at (0, 2)
+ .. (0, meshWidth), (1, 0), (1, 1), and so on.
+
+ *shading* may be 'flat', or 'gouraud'
+ """
+ def __init__(self, meshWidth, meshHeight, coordinates,
+ antialiased=True, shading='flat', **kwargs):
+ super().__init__(**kwargs)
+ self._meshWidth = meshWidth
+ self._meshHeight = meshHeight
+ # By converting to floats now, we can avoid that on every draw.
+ self._coordinates = np.asarray(coordinates, float).reshape(
+ (meshHeight + 1, meshWidth + 1, 2))
+ self._antialiased = antialiased
+ self._shading = shading
+
+ self._bbox = transforms.Bbox.unit()
+ self._bbox.update_from_data_xy(coordinates.reshape(
+ ((meshWidth + 1) * (meshHeight + 1), 2)))
+
+ def get_paths(self):
+ if self._paths is None:
+ self.set_paths()
+ return self._paths
+
+ def set_paths(self):
+ self._paths = self.convert_mesh_to_paths(
+ self._meshWidth, self._meshHeight, self._coordinates)
+ self.stale = True
+
+ def get_datalim(self, transData):
+ return (self.get_transform() - transData).transform_bbox(self._bbox)
+
+ @staticmethod
+ def convert_mesh_to_paths(meshWidth, meshHeight, coordinates):
+ """
+ Convert a given mesh into a sequence of `~.Path` objects.
+
+ This function is primarily of use to implementers of backends that do
+ not directly support quadmeshes.
+ """
+ if isinstance(coordinates, np.ma.MaskedArray):
+ c = coordinates.data
+ else:
+ c = coordinates
+ points = np.concatenate((
+ c[:-1, :-1],
+ c[:-1, 1:],
+ c[1:, 1:],
+ c[1:, :-1],
+ c[:-1, :-1]
+ ), axis=2)
+ points = points.reshape((meshWidth * meshHeight, 5, 2))
+ return [mpath.Path(x) for x in points]
+
+ def convert_mesh_to_triangles(self, meshWidth, meshHeight, coordinates):
+ """
+ Convert a given mesh into a sequence of triangles, each point
+ with its own color. This is useful for experiments using
+ `~.RendererBase.draw_gouraud_triangle`.
+ """
+ if isinstance(coordinates, np.ma.MaskedArray):
+ p = coordinates.data
+ else:
+ p = coordinates
+
+ p_a = p[:-1, :-1]
+ p_b = p[:-1, 1:]
+ p_c = p[1:, 1:]
+ p_d = p[1:, :-1]
+ p_center = (p_a + p_b + p_c + p_d) / 4.0
+
+ triangles = np.concatenate((
+ p_a, p_b, p_center,
+ p_b, p_c, p_center,
+ p_c, p_d, p_center,
+ p_d, p_a, p_center,
+ ), axis=2)
+ triangles = triangles.reshape((meshWidth * meshHeight * 4, 3, 2))
+
+ c = self.get_facecolor().reshape((meshHeight + 1, meshWidth + 1, 4))
+ c_a = c[:-1, :-1]
+ c_b = c[:-1, 1:]
+ c_c = c[1:, 1:]
+ c_d = c[1:, :-1]
+ c_center = (c_a + c_b + c_c + c_d) / 4.0
+
+ colors = np.concatenate((
+ c_a, c_b, c_center,
+ c_b, c_c, c_center,
+ c_c, c_d, c_center,
+ c_d, c_a, c_center,
+ ), axis=2)
+ colors = colors.reshape((meshWidth * meshHeight * 4, 3, 4))
+
+ return triangles, colors
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ if not self.get_visible():
+ return
+ renderer.open_group(self.__class__.__name__, self.get_gid())
+ transform = self.get_transform()
+ transOffset = self.get_offset_transform()
+ offsets = self._offsets
+
+ if self.have_units():
+ if len(self._offsets):
+ xs = self.convert_xunits(self._offsets[:, 0])
+ ys = self.convert_yunits(self._offsets[:, 1])
+ offsets = np.column_stack([xs, ys])
+
+ self.update_scalarmappable()
+
+ if not transform.is_affine:
+ coordinates = self._coordinates.reshape((-1, 2))
+ coordinates = transform.transform(coordinates)
+ coordinates = coordinates.reshape(self._coordinates.shape)
+ transform = transforms.IdentityTransform()
+ else:
+ coordinates = self._coordinates
+
+ if not transOffset.is_affine:
+ offsets = transOffset.transform_non_affine(offsets)
+ transOffset = transOffset.get_affine()
+
+ gc = renderer.new_gc()
+ gc.set_snap(self.get_snap())
+ self._set_gc_clip(gc)
+ gc.set_linewidth(self.get_linewidth()[0])
+
+ if self._shading == 'gouraud':
+ triangles, colors = self.convert_mesh_to_triangles(
+ self._meshWidth, self._meshHeight, coordinates)
+ renderer.draw_gouraud_triangles(
+ gc, triangles, colors, transform.frozen())
+ else:
+ renderer.draw_quad_mesh(
+ gc, transform.frozen(), self._meshWidth, self._meshHeight,
+ coordinates, offsets, transOffset,
+ # Backends expect flattened rgba arrays (n*m, 4) for fc and ec
+ self.get_facecolor().reshape((-1, 4)),
+ self._antialiased, self.get_edgecolors().reshape((-1, 4)))
+ gc.restore()
+ renderer.close_group(self.__class__.__name__)
+ self.stale = False
+
+
+_artist_kwdoc = artist.kwdoc(Collection)
+for k in ('QuadMesh', 'TriMesh', 'PolyCollection', 'BrokenBarHCollection',
+ 'RegularPolyCollection', 'PathCollection',
+ 'StarPolygonCollection', 'PatchCollection',
+ 'CircleCollection', 'Collection',):
+ docstring.interpd.update({f'{k}_kwdoc': _artist_kwdoc})
+docstring.interpd.update(LineCollection_kwdoc=artist.kwdoc(LineCollection))
diff --git a/venv/Lib/site-packages/matplotlib/colorbar.py b/venv/Lib/site-packages/matplotlib/colorbar.py
new file mode 100644
index 0000000..31d9b61
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/colorbar.py
@@ -0,0 +1,1584 @@
+"""
+Colorbars are a visualization of the mapping from scalar values to colors.
+In Matplotlib they are drawn into a dedicated `~.axes.Axes`.
+
+.. note::
+ Colorbars are typically created through `.Figure.colorbar` or its pyplot
+ wrapper `.pyplot.colorbar`, which use `.make_axes` and `.Colorbar`
+ internally.
+
+ As an end-user, you most likely won't have to call the methods or
+ instantiate the classes in this module explicitly.
+
+:class:`ColorbarBase`
+ The base class with full colorbar drawing functionality.
+ It can be used as-is to make a colorbar for a given colormap;
+ a mappable object (e.g., image) is not needed.
+
+:class:`Colorbar`
+ On top of `.ColorbarBase` this connects the colorbar with a
+ `.ScalarMappable` such as an image or contour plot.
+
+:func:`make_axes`
+ Create an `~.axes.Axes` suitable for a colorbar. This functions can be
+ used with figures containing a single axes or with freely placed axes.
+
+:func:`make_axes_gridspec`
+ Create a `~.SubplotBase` suitable for a colorbar. This function should
+ be used for adding a colorbar to a `.GridSpec`.
+"""
+
+import copy
+import logging
+import textwrap
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib import _api, collections, cm, colors, contour, ticker
+import matplotlib.artist as martist
+import matplotlib.patches as mpatches
+import matplotlib.path as mpath
+import matplotlib.spines as mspines
+import matplotlib.transforms as mtransforms
+from matplotlib import docstring
+
+_log = logging.getLogger(__name__)
+
+_make_axes_param_doc = """
+location : None or {'left', 'right', 'top', 'bottom'}
+ The location, relative to the parent axes, where the colorbar axes
+ is created. It also determines the *orientation* of the colorbar
+ (colorbars on the left and right are vertical, colorbars at the top
+ and bottom are horizontal). If None, the location will come from the
+ *orientation* if it is set (vertical colorbars on the right, horizontal
+ ones at the bottom), or default to 'right' if *orientation* is unset.
+orientation : None or {'vertical', 'horizontal'}
+ The orientation of the colorbar. It is preferable to set the *location*
+ of the colorbar, as that also determines the *orientation*; passing
+ incompatible values for *location* and *orientation* raises an exception.
+fraction : float, default: 0.15
+ Fraction of original axes to use for colorbar.
+shrink : float, default: 1.0
+ Fraction by which to multiply the size of the colorbar.
+aspect : float, default: 20
+ Ratio of long to short dimensions.
+"""
+_make_axes_other_param_doc = """
+pad : float, default: 0.05 if vertical, 0.15 if horizontal
+ Fraction of original axes between colorbar and new image axes.
+anchor : (float, float), optional
+ The anchor point of the colorbar axes.
+ Defaults to (0.0, 0.5) if vertical; (0.5, 1.0) if horizontal.
+panchor : (float, float), or *False*, optional
+ The anchor point of the colorbar parent axes. If *False*, the parent
+ axes' anchor will be unchanged.
+ Defaults to (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal.
+"""
+
+_colormap_kw_doc = """
+
+ ============ ====================================================
+ Property Description
+ ============ ====================================================
+ *extend* {'neither', 'both', 'min', 'max'}
+ If not 'neither', make pointed end(s) for out-of-
+ range values. These are set for a given colormap
+ using the colormap set_under and set_over methods.
+ *extendfrac* {*None*, 'auto', length, lengths}
+ If set to *None*, both the minimum and maximum
+ triangular colorbar extensions with have a length of
+ 5% of the interior colorbar length (this is the
+ default setting). If set to 'auto', makes the
+ triangular colorbar extensions the same lengths as
+ the interior boxes (when *spacing* is set to
+ 'uniform') or the same lengths as the respective
+ adjacent interior boxes (when *spacing* is set to
+ 'proportional'). If a scalar, indicates the length
+ of both the minimum and maximum triangular colorbar
+ extensions as a fraction of the interior colorbar
+ length. A two-element sequence of fractions may also
+ be given, indicating the lengths of the minimum and
+ maximum colorbar extensions respectively as a
+ fraction of the interior colorbar length.
+ *extendrect* bool
+ If *False* the minimum and maximum colorbar extensions
+ will be triangular (the default). If *True* the
+ extensions will be rectangular.
+ *spacing* {'uniform', 'proportional'}
+ Uniform spacing gives each discrete color the same
+ space; proportional makes the space proportional to
+ the data interval.
+ *ticks* *None* or list of ticks or Locator
+ If None, ticks are determined automatically from the
+ input.
+ *format* None or str or Formatter
+ If None, `~.ticker.ScalarFormatter` is used.
+ If a format string is given, e.g., '%.3f', that is used.
+ An alternative `~.ticker.Formatter` may be given instead.
+ *drawedges* bool
+ Whether to draw lines at color boundaries.
+ *label* str
+ The label on the colorbar's long axis.
+ ============ ====================================================
+
+ The following will probably be useful only in the context of
+ indexed colors (that is, when the mappable has norm=NoNorm()),
+ or other unusual circumstances.
+
+ ============ ===================================================
+ Property Description
+ ============ ===================================================
+ *boundaries* None or a sequence
+ *values* None or a sequence which must be of length 1 less
+ than the sequence of *boundaries*. For each region
+ delimited by adjacent entries in *boundaries*, the
+ colormapped to the corresponding value in values
+ will be used.
+ ============ ===================================================
+
+"""
+
+docstring.interpd.update(colorbar_doc="""
+Add a colorbar to a plot.
+
+Parameters
+----------
+mappable
+ The `matplotlib.cm.ScalarMappable` (i.e., `~matplotlib.image.AxesImage`,
+ `~matplotlib.contour.ContourSet`, etc.) described by this colorbar.
+ This argument is mandatory for the `.Figure.colorbar` method but optional
+ for the `.pyplot.colorbar` function, which sets the default to the current
+ image.
+
+ Note that one can create a `.ScalarMappable` "on-the-fly" to generate
+ colorbars not attached to a previously drawn artist, e.g. ::
+
+ fig.colorbar(cm.ScalarMappable(norm=norm, cmap=cmap), ax=ax)
+
+cax : `~matplotlib.axes.Axes`, optional
+ Axes into which the colorbar will be drawn.
+
+ax : `~matplotlib.axes.Axes`, list of Axes, optional
+ One or more parent axes from which space for a new colorbar axes will be
+ stolen, if *cax* is None. This has no effect if *cax* is set.
+
+use_gridspec : bool, optional
+ If *cax* is ``None``, a new *cax* is created as an instance of Axes. If
+ *ax* is an instance of Subplot and *use_gridspec* is ``True``, *cax* is
+ created as an instance of Subplot using the :mod:`~.gridspec` module.
+
+Returns
+-------
+colorbar : `~matplotlib.colorbar.Colorbar`
+ See also its base class, `~matplotlib.colorbar.ColorbarBase`.
+
+Notes
+-----
+Additional keyword arguments are of two kinds:
+
+ axes properties:
+%s
+%s
+ colorbar properties:
+%s
+
+If *mappable* is a `~.contour.ContourSet`, its *extend* kwarg is included
+automatically.
+
+The *shrink* kwarg provides a simple way to scale the colorbar with respect
+to the axes. Note that if *cax* is specified, it determines the size of the
+colorbar and *shrink* and *aspect* kwargs are ignored.
+
+For more precise control, you can manually specify the positions of
+the axes objects in which the mappable and the colorbar are drawn. In
+this case, do not use any of the axes properties kwargs.
+
+It is known that some vector graphics viewers (svg and pdf) renders white gaps
+between segments of the colorbar. This is due to bugs in the viewers, not
+Matplotlib. As a workaround, the colorbar can be rendered with overlapping
+segments::
+
+ cbar = colorbar()
+ cbar.solids.set_edgecolor("face")
+ draw()
+
+However this has negative consequences in other circumstances, e.g. with
+semi-transparent images (alpha < 1) and colorbar extensions; therefore, this
+workaround is not used by default (see issue #1188).
+""" % (textwrap.indent(_make_axes_param_doc, " "),
+ textwrap.indent(_make_axes_other_param_doc, " "),
+ _colormap_kw_doc))
+
+# Deprecated since 3.4.
+colorbar_doc = docstring.interpd.params["colorbar_doc"]
+colormap_kw_doc = _colormap_kw_doc
+make_axes_kw_doc = _make_axes_param_doc + _make_axes_other_param_doc
+
+
+def _set_ticks_on_axis_warn(*args, **kw):
+ # a top level function which gets put in at the axes'
+ # set_xticks and set_yticks by ColorbarBase.__init__.
+ _api.warn_external("Use the colorbar set_ticks() method instead.")
+
+
+class _ColorbarAutoLocator(ticker.MaxNLocator):
+ """
+ AutoLocator for Colorbar
+
+ This locator is just a `.MaxNLocator` except the min and max are
+ clipped by the norm's min and max (i.e. vmin/vmax from the
+ image/pcolor/contour object). This is necessary so ticks don't
+ extrude into the "extend regions".
+ """
+
+ def __init__(self, colorbar):
+ """
+ This ticker needs to know the *colorbar* so that it can access
+ its *vmin* and *vmax*. Otherwise it is the same as
+ `~.ticker.AutoLocator`.
+ """
+
+ self._colorbar = colorbar
+ nbins = 'auto'
+ steps = [1, 2, 2.5, 5, 10]
+ super().__init__(nbins=nbins, steps=steps)
+
+ def tick_values(self, vmin, vmax):
+ # flip if needed:
+ if vmin > vmax:
+ vmin, vmax = vmax, vmin
+ vmin = max(vmin, self._colorbar.norm.vmin)
+ vmax = min(vmax, self._colorbar.norm.vmax)
+ ticks = super().tick_values(vmin, vmax)
+ rtol = (vmax - vmin) * 1e-10
+ return ticks[(ticks >= vmin - rtol) & (ticks <= vmax + rtol)]
+
+
+class _ColorbarAutoMinorLocator(ticker.AutoMinorLocator):
+ """
+ AutoMinorLocator for Colorbar
+
+ This locator is just a `.AutoMinorLocator` except the min and max are
+ clipped by the norm's min and max (i.e. vmin/vmax from the
+ image/pcolor/contour object). This is necessary so that the minorticks
+ don't extrude into the "extend regions".
+ """
+
+ def __init__(self, colorbar, n=None):
+ """
+ This ticker needs to know the *colorbar* so that it can access
+ its *vmin* and *vmax*.
+ """
+ self._colorbar = colorbar
+ self.ndivs = n
+ super().__init__(n=None)
+
+ def __call__(self):
+ vmin = self._colorbar.norm.vmin
+ vmax = self._colorbar.norm.vmax
+ ticks = super().__call__()
+ rtol = (vmax - vmin) * 1e-10
+ return ticks[(ticks >= vmin - rtol) & (ticks <= vmax + rtol)]
+
+
+class _ColorbarLogLocator(ticker.LogLocator):
+ """
+ LogLocator for Colorbarbar
+
+ This locator is just a `.LogLocator` except the min and max are
+ clipped by the norm's min and max (i.e. vmin/vmax from the
+ image/pcolor/contour object). This is necessary so ticks don't
+ extrude into the "extend regions".
+
+ """
+ def __init__(self, colorbar, *args, **kwargs):
+ """
+ This ticker needs to know the *colorbar* so that it can access
+ its *vmin* and *vmax*. Otherwise it is the same as
+ `~.ticker.LogLocator`. The ``*args`` and ``**kwargs`` are the
+ same as `~.ticker.LogLocator`.
+ """
+ self._colorbar = colorbar
+ super().__init__(*args, **kwargs)
+
+ def tick_values(self, vmin, vmax):
+ if vmin > vmax:
+ vmin, vmax = vmax, vmin
+ vmin = max(vmin, self._colorbar.norm.vmin)
+ vmax = min(vmax, self._colorbar.norm.vmax)
+ ticks = super().tick_values(vmin, vmax)
+ rtol = (np.log10(vmax) - np.log10(vmin)) * 1e-10
+ ticks = ticks[(np.log10(ticks) >= np.log10(vmin) - rtol) &
+ (np.log10(ticks) <= np.log10(vmax) + rtol)]
+ return ticks
+
+
+class _ColorbarSpine(mspines.Spine):
+ def __init__(self, axes):
+ super().__init__(axes, 'colorbar',
+ mpath.Path(np.empty((0, 2)), closed=True))
+
+ def get_window_extent(self, renderer=None):
+ # This Spine has no Axis associated with it, and doesn't need to adjust
+ # its location, so we can directly get the window extent from the
+ # super-super-class.
+ return mpatches.Patch.get_window_extent(self, renderer=renderer)
+
+ def set_xy(self, xy):
+ self._path = mpath.Path(xy, closed=True)
+ self.stale = True
+
+ def draw(self, renderer):
+ ret = mpatches.Patch.draw(self, renderer)
+ self.stale = False
+ return ret
+
+
+class ColorbarBase:
+ r"""
+ Draw a colorbar in an existing axes.
+
+ There are only some rare cases in which you would work directly with a
+ `.ColorbarBase` as an end-user. Typically, colorbars are used
+ with `.ScalarMappable`\s such as an `.AxesImage` generated via
+ `~.axes.Axes.imshow`. For these cases you will use `.Colorbar` and
+ likely create it via `.pyplot.colorbar` or `.Figure.colorbar`.
+
+ The main application of using a `.ColorbarBase` explicitly is drawing
+ colorbars that are not associated with other elements in the figure, e.g.
+ when showing a colormap by itself.
+
+ If the *cmap* kwarg is given but *boundaries* and *values* are left as
+ None, then the colormap will be displayed on a 0-1 scale. To show the
+ under- and over-value colors, specify the *norm* as::
+
+ norm=colors.Normalize(clip=False)
+
+ To show the colors versus index instead of on the 0-1 scale,
+ use::
+
+ norm=colors.NoNorm()
+
+ Useful public methods are :meth:`set_label` and :meth:`add_lines`.
+
+ Attributes
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The `~.axes.Axes` instance in which the colorbar is drawn.
+ lines : list
+ A list of `.LineCollection` (empty if no lines were drawn).
+ dividers : `.LineCollection`
+ A LineCollection (empty if *drawedges* is ``False``).
+
+ Parameters
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The `~.axes.Axes` instance in which the colorbar is drawn.
+ cmap : `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
+ The colormap to use.
+ norm : `~matplotlib.colors.Normalize`
+
+ alpha : float
+ The colorbar transparency between 0 (transparent) and 1 (opaque).
+
+ values
+
+ boundaries
+
+ orientation : {'vertical', 'horizontal'}
+
+ ticklocation : {'auto', 'left', 'right', 'top', 'bottom'}
+
+ extend : {'neither', 'both', 'min', 'max'}
+
+ spacing : {'uniform', 'proportional'}
+
+ ticks : `~matplotlib.ticker.Locator` or array-like of float
+
+ format : str or `~matplotlib.ticker.Formatter`
+
+ drawedges : bool
+
+ filled : bool
+
+ extendfrac
+
+ extendrec
+
+ label : str
+ """
+
+ n_rasterize = 50 # rasterize solids if number of colors >= n_rasterize
+
+ @_api.make_keyword_only("3.3", "cmap")
+ def __init__(self, ax, cmap=None,
+ norm=None,
+ alpha=None,
+ values=None,
+ boundaries=None,
+ orientation='vertical',
+ ticklocation='auto',
+ extend=None,
+ spacing='uniform', # uniform or proportional
+ ticks=None,
+ format=None,
+ drawedges=False,
+ filled=True,
+ extendfrac=None,
+ extendrect=False,
+ label='',
+ ):
+ _api.check_isinstance([colors.Colormap, None], cmap=cmap)
+ _api.check_in_list(
+ ['vertical', 'horizontal'], orientation=orientation)
+ _api.check_in_list(
+ ['auto', 'left', 'right', 'top', 'bottom'],
+ ticklocation=ticklocation)
+ _api.check_in_list(
+ ['uniform', 'proportional'], spacing=spacing)
+
+ self.ax = ax
+ # Bind some methods to the axes to warn users against using them.
+ ax.set_xticks = ax.set_yticks = _set_ticks_on_axis_warn
+ ax.set(navigate=False)
+
+ if cmap is None:
+ cmap = cm.get_cmap()
+ if norm is None:
+ norm = colors.Normalize()
+ if extend is None:
+ if hasattr(norm, 'extend'):
+ extend = norm.extend
+ else:
+ extend = 'neither'
+ self.alpha = alpha
+ self.cmap = cmap
+ self.norm = norm
+ self.values = values
+ self.boundaries = boundaries
+ self.extend = extend
+ self._inside = _api.check_getitem(
+ {'neither': slice(0, None), 'both': slice(1, -1),
+ 'min': slice(1, None), 'max': slice(0, -1)},
+ extend=extend)
+ self.spacing = spacing
+ self.orientation = orientation
+ self.drawedges = drawedges
+ self.filled = filled
+ self.extendfrac = extendfrac
+ self.extendrect = extendrect
+ self.solids = None
+ self.solids_patches = []
+ self.lines = []
+
+ for spine in ax.spines.values():
+ spine.set_visible(False)
+ self.outline = ax.spines['outline'] = _ColorbarSpine(ax)
+
+ self.patch = mpatches.Polygon(
+ np.empty((0, 2)),
+ color=mpl.rcParams['axes.facecolor'], linewidth=0.01, zorder=-1)
+ ax.add_artist(self.patch)
+
+ self.dividers = collections.LineCollection(
+ [],
+ colors=[mpl.rcParams['axes.edgecolor']],
+ linewidths=[0.5 * mpl.rcParams['axes.linewidth']])
+ self.ax.add_collection(self.dividers)
+
+ self.locator = None
+ self.formatter = None
+ self._manual_tick_data_values = None
+ self.__scale = None # linear, log10 for now. Hopefully more?
+
+ if ticklocation == 'auto':
+ ticklocation = 'bottom' if orientation == 'horizontal' else 'right'
+ self.ticklocation = ticklocation
+
+ self.set_label(label)
+ self._reset_locator_formatter_scale()
+
+ if np.iterable(ticks):
+ self.locator = ticker.FixedLocator(ticks, nbins=len(ticks))
+ else:
+ self.locator = ticks # Handle default in _ticker()
+
+ if isinstance(format, str):
+ self.formatter = ticker.FormatStrFormatter(format)
+ else:
+ self.formatter = format # Assume it is a Formatter or None
+ self.draw_all()
+
+ def _extend_lower(self):
+ """Return whether the lower limit is open ended."""
+ return self.extend in ('both', 'min')
+
+ def _extend_upper(self):
+ """Return whether the upper limit is open ended."""
+ return self.extend in ('both', 'max')
+
+ def draw_all(self):
+ """
+ Calculate any free parameters based on the current cmap and norm,
+ and do all the drawing.
+ """
+ self._config_axis() # Inline it after deprecation elapses.
+ # Set self._boundaries and self._values, including extensions.
+ self._process_values()
+ # Set self.vmin and self.vmax to first and last boundary, excluding
+ # extensions.
+ self.vmin, self.vmax = self._boundaries[self._inside][[0, -1]]
+ # Compute the X/Y mesh.
+ X, Y = self._mesh()
+ # Extract bounding polygon (the last entry's value (X[0, 1]) doesn't
+ # matter, it just matches the CLOSEPOLY code).
+ x = np.concatenate([X[[0, 1, -2, -1], 0], X[[-1, -2, 1, 0, 0], 1]])
+ y = np.concatenate([Y[[0, 1, -2, -1], 0], Y[[-1, -2, 1, 0, 0], 1]])
+ xy = np.column_stack([x, y])
+ # Configure axes limits, patch, and outline.
+ xmin, ymin = xy.min(axis=0)
+ xmax, ymax = xy.max(axis=0)
+ self.ax.set(xlim=(xmin, xmax), ylim=(ymin, ymax))
+ self.outline.set_xy(xy)
+ self.patch.set_xy(xy)
+ self.update_ticks()
+ if self.filled:
+ self._add_solids(X, Y, self._values[:, np.newaxis])
+
+ @_api.deprecated("3.3")
+ def config_axis(self):
+ self._config_axis()
+
+ def _config_axis(self):
+ """Set up long and short axis."""
+ ax = self.ax
+ if self.orientation == 'vertical':
+ long_axis, short_axis = ax.yaxis, ax.xaxis
+ if mpl.rcParams['ytick.minor.visible']:
+ self.minorticks_on()
+ else:
+ long_axis, short_axis = ax.xaxis, ax.yaxis
+ if mpl.rcParams['xtick.minor.visible']:
+ self.minorticks_on()
+ long_axis.set(label_position=self.ticklocation,
+ ticks_position=self.ticklocation)
+ short_axis.set_ticks([])
+ short_axis.set_ticks([], minor=True)
+ self.stale = True
+
+ def _get_ticker_locator_formatter(self):
+ """
+ Return the ``locator`` and ``formatter`` of the colorbar.
+
+ If they have not been defined (i.e. are *None*), suitable formatter
+ and locator instances will be created, attached to the respective
+ attributes and returned.
+ """
+ locator = self.locator
+ formatter = self.formatter
+ if locator is None:
+ if self.boundaries is None:
+ if isinstance(self.norm, colors.NoNorm):
+ nv = len(self._values)
+ base = 1 + int(nv / 10)
+ locator = ticker.IndexLocator(base=base, offset=0)
+ elif isinstance(self.norm, colors.BoundaryNorm):
+ b = self.norm.boundaries
+ locator = ticker.FixedLocator(b, nbins=10)
+ elif isinstance(self.norm, colors.LogNorm):
+ locator = _ColorbarLogLocator(self)
+ elif isinstance(self.norm, colors.SymLogNorm):
+ # The subs setting here should be replaced
+ # by logic in the locator.
+ locator = ticker.SymmetricalLogLocator(
+ subs=np.arange(1, 10),
+ linthresh=self.norm.linthresh,
+ base=10)
+ else:
+ if mpl.rcParams['_internal.classic_mode']:
+ locator = ticker.MaxNLocator()
+ else:
+ locator = _ColorbarAutoLocator(self)
+ else:
+ b = self._boundaries[self._inside]
+ locator = ticker.FixedLocator(b, nbins=10)
+
+ if formatter is None:
+ if isinstance(self.norm, colors.LogNorm):
+ formatter = ticker.LogFormatterSciNotation()
+ elif isinstance(self.norm, colors.SymLogNorm):
+ formatter = ticker.LogFormatterSciNotation(
+ linthresh=self.norm.linthresh)
+ else:
+ formatter = ticker.ScalarFormatter()
+ else:
+ formatter = self.formatter
+
+ self.locator = locator
+ self.formatter = formatter
+ _log.debug('locator: %r', locator)
+ return locator, formatter
+
+ def _use_auto_colorbar_locator(self):
+ """
+ Return if we should use an adjustable tick locator or a fixed
+ one. (check is used twice so factored out here...)
+ """
+ contouring = self.boundaries is not None and self.spacing == 'uniform'
+ return (type(self.norm) in [colors.Normalize, colors.LogNorm] and
+ not contouring)
+
+ def _reset_locator_formatter_scale(self):
+ """
+ Reset the locator et al to defaults. Any user-hardcoded changes
+ need to be re-entered if this gets called (either at init, or when
+ the mappable normal gets changed: Colorbar.update_normal)
+ """
+ self.locator = None
+ self.formatter = None
+ if isinstance(self.norm, colors.LogNorm):
+ # *both* axes are made log so that determining the
+ # mid point is easier.
+ self.ax.set_xscale('log')
+ self.ax.set_yscale('log')
+ self.minorticks_on()
+ self.__scale = 'log'
+ else:
+ self.ax.set_xscale('linear')
+ self.ax.set_yscale('linear')
+ if type(self.norm) is colors.Normalize:
+ self.__scale = 'linear'
+ else:
+ self.__scale = 'manual'
+
+ def update_ticks(self):
+ """
+ Force the update of the ticks and ticklabels. This must be
+ called whenever the tick locator and/or tick formatter changes.
+ """
+ ax = self.ax
+ # Get the locator and formatter; defaults to self.locator if not None.
+ locator, formatter = self._get_ticker_locator_formatter()
+ long_axis = ax.yaxis if self.orientation == 'vertical' else ax.xaxis
+ if self._use_auto_colorbar_locator():
+ _log.debug('Using auto colorbar locator %r on colorbar', locator)
+ long_axis.set_major_locator(locator)
+ long_axis.set_major_formatter(formatter)
+ else:
+ _log.debug('Using fixed locator on colorbar')
+ ticks, ticklabels, offset_string = self._ticker(locator, formatter)
+ long_axis.set_ticks(ticks)
+ long_axis.set_ticklabels(ticklabels)
+ long_axis.get_major_formatter().set_offset_string(offset_string)
+
+ def set_ticks(self, ticks, update_ticks=True):
+ """
+ Set tick locations.
+
+ Parameters
+ ----------
+ ticks : array-like or `~matplotlib.ticker.Locator` or None
+ The tick positions can be hard-coded by an array of values; or
+ they can be defined by a `.Locator`. Setting to *None* reverts
+ to using a default locator.
+
+ update_ticks : bool, default: True
+ If True, tick locations are updated immediately. If False, the
+ user has to call `update_ticks` later to update the ticks.
+
+ """
+ if np.iterable(ticks):
+ self.locator = ticker.FixedLocator(ticks, nbins=len(ticks))
+ else:
+ self.locator = ticks
+
+ if update_ticks:
+ self.update_ticks()
+ self.stale = True
+
+ def get_ticks(self, minor=False):
+ """Return the x ticks as a list of locations."""
+ if self._manual_tick_data_values is None:
+ ax = self.ax
+ long_axis = (
+ ax.yaxis if self.orientation == 'vertical' else ax.xaxis)
+ return long_axis.get_majorticklocs()
+ else:
+ # We made the axes manually, the old way, and the ylim is 0-1,
+ # so the majorticklocs are in those units, not data units.
+ return self._manual_tick_data_values
+
+ def set_ticklabels(self, ticklabels, update_ticks=True):
+ """
+ Set tick labels.
+
+ Tick labels are updated immediately unless *update_ticks* is *False*,
+ in which case one should call `.update_ticks` explicitly.
+ """
+ if isinstance(self.locator, ticker.FixedLocator):
+ self.formatter = ticker.FixedFormatter(ticklabels)
+ if update_ticks:
+ self.update_ticks()
+ else:
+ _api.warn_external("set_ticks() must have been called.")
+ self.stale = True
+
+ def minorticks_on(self):
+ """
+ Turn the minor ticks of the colorbar on without extruding
+ into the "extend regions".
+ """
+ ax = self.ax
+ long_axis = ax.yaxis if self.orientation == 'vertical' else ax.xaxis
+
+ if long_axis.get_scale() == 'log':
+ long_axis.set_minor_locator(_ColorbarLogLocator(self, base=10.,
+ subs='auto'))
+ long_axis.set_minor_formatter(ticker.LogFormatterSciNotation())
+ else:
+ long_axis.set_minor_locator(_ColorbarAutoMinorLocator(self))
+
+ def minorticks_off(self):
+ """Turn the minor ticks of the colorbar off."""
+ ax = self.ax
+ long_axis = ax.yaxis if self.orientation == 'vertical' else ax.xaxis
+ long_axis.set_minor_locator(ticker.NullLocator())
+
+ def set_label(self, label, *, loc=None, **kwargs):
+ """
+ Add a label to the long axis of the colorbar.
+
+ Parameters
+ ----------
+ label : str
+ The label text.
+ loc : str, optional
+ The location of the label.
+
+ - For horizontal orientation one of {'left', 'center', 'right'}
+ - For vertical orientation one of {'bottom', 'center', 'top'}
+
+ Defaults to :rc:`xaxis.labellocation` or :rc:`yaxis.labellocation`
+ depending on the orientation.
+ **kwargs
+ Keyword arguments are passed to `~.Axes.set_xlabel` /
+ `~.Axes.set_ylabel`.
+ Supported keywords are *labelpad* and `.Text` properties.
+ """
+ if self.orientation == "vertical":
+ self.ax.set_ylabel(label, loc=loc, **kwargs)
+ else:
+ self.ax.set_xlabel(label, loc=loc, **kwargs)
+ self.stale = True
+
+ def _add_solids(self, X, Y, C):
+ """Draw the colors; optionally add separators."""
+ # Cleanup previously set artists.
+ if self.solids is not None:
+ self.solids.remove()
+ for solid in self.solids_patches:
+ solid.remove()
+ # Add new artist(s), based on mappable type. Use individual patches if
+ # hatching is needed, pcolormesh otherwise.
+ mappable = getattr(self, 'mappable', None)
+ if (isinstance(mappable, contour.ContourSet)
+ and any(hatch is not None for hatch in mappable.hatches)):
+ self._add_solids_patches(X, Y, C, mappable)
+ else:
+ self._add_solids_pcolormesh(X, Y, C)
+ self.dividers.set_segments(
+ np.dstack([X, Y])[1:-1] if self.drawedges else [])
+
+ def _add_solids_pcolormesh(self, X, Y, C):
+ _log.debug('Setting pcolormesh')
+ if C.shape[0] == Y.shape[0]:
+ # trim the last one to be compatible with old behavior.
+ C = C[:-1]
+ self.solids = self.ax.pcolormesh(
+ X, Y, C, cmap=self.cmap, norm=self.norm, alpha=self.alpha,
+ edgecolors='none', shading='flat')
+ if not self.drawedges:
+ if len(self._y) >= self.n_rasterize:
+ self.solids.set_rasterized(True)
+
+ def _add_solids_patches(self, X, Y, C, mappable):
+ hatches = mappable.hatches * len(C) # Have enough hatches.
+ patches = []
+ for i in range(len(X) - 1):
+ xy = np.array([[X[i, 0], Y[i, 0]],
+ [X[i, 1], Y[i, 0]],
+ [X[i + 1, 1], Y[i + 1, 0]],
+ [X[i + 1, 0], Y[i + 1, 1]]])
+ patch = mpatches.PathPatch(mpath.Path(xy),
+ facecolor=self.cmap(self.norm(C[i][0])),
+ hatch=hatches[i], linewidth=0,
+ antialiased=False, alpha=self.alpha)
+ self.ax.add_patch(patch)
+ patches.append(patch)
+ self.solids_patches = patches
+
+ def add_lines(self, levels, colors, linewidths, erase=True):
+ """
+ Draw lines on the colorbar.
+
+ The lines are appended to the list :attr:`lines`.
+
+ Parameters
+ ----------
+ levels : array-like
+ The positions of the lines.
+ colors : color or list of colors
+ Either a single color applying to all lines or one color value for
+ each line.
+ linewidths : float or array-like
+ Either a single linewidth applying to all lines or one linewidth
+ for each line.
+ erase : bool, default: True
+ Whether to remove any previously added lines.
+ """
+ y = self._locate(levels)
+ rtol = (self._y[-1] - self._y[0]) * 1e-10
+ igood = (y < self._y[-1] + rtol) & (y > self._y[0] - rtol)
+ y = y[igood]
+ if np.iterable(colors):
+ colors = np.asarray(colors)[igood]
+ if np.iterable(linewidths):
+ linewidths = np.asarray(linewidths)[igood]
+ X, Y = np.meshgrid([self._y[0], self._y[-1]], y)
+ if self.orientation == 'vertical':
+ xy = np.stack([X, Y], axis=-1)
+ else:
+ xy = np.stack([Y, X], axis=-1)
+ col = collections.LineCollection(xy, linewidths=linewidths)
+
+ if erase and self.lines:
+ for lc in self.lines:
+ lc.remove()
+ self.lines = []
+ self.lines.append(col)
+ col.set_color(colors)
+ self.ax.add_collection(col)
+ self.stale = True
+
+ def _ticker(self, locator, formatter):
+ """
+ Return the sequence of ticks (colorbar data locations),
+ ticklabels (strings), and the corresponding offset string.
+ """
+ if isinstance(self.norm, colors.NoNorm) and self.boundaries is None:
+ intv = self._values[0], self._values[-1]
+ else:
+ intv = self.vmin, self.vmax
+ locator.create_dummy_axis(minpos=intv[0])
+ formatter.create_dummy_axis(minpos=intv[0])
+ locator.set_view_interval(*intv)
+ locator.set_data_interval(*intv)
+ formatter.set_view_interval(*intv)
+ formatter.set_data_interval(*intv)
+
+ b = np.array(locator())
+ if isinstance(locator, ticker.LogLocator):
+ eps = 1e-10
+ b = b[(b <= intv[1] * (1 + eps)) & (b >= intv[0] * (1 - eps))]
+ else:
+ eps = (intv[1] - intv[0]) * 1e-10
+ b = b[(b <= intv[1] + eps) & (b >= intv[0] - eps)]
+ self._manual_tick_data_values = b
+ ticks = self._locate(b)
+ ticklabels = formatter.format_ticks(b)
+ offset_string = formatter.get_offset()
+ return ticks, ticklabels, offset_string
+
+ def _process_values(self, b=None):
+ """
+ Set the :attr:`_boundaries` and :attr:`_values` attributes
+ based on the input boundaries and values. Input boundaries
+ can be *self.boundaries* or the argument *b*.
+ """
+ if b is None:
+ b = self.boundaries
+ if b is not None:
+ self._boundaries = np.asarray(b, dtype=float)
+ if self.values is None:
+ self._values = 0.5 * (self._boundaries[:-1]
+ + self._boundaries[1:])
+ if isinstance(self.norm, colors.NoNorm):
+ self._values = (self._values + 0.00001).astype(np.int16)
+ else:
+ self._values = np.array(self.values)
+ return
+ if self.values is not None:
+ self._values = np.array(self.values)
+ if self.boundaries is None:
+ b = np.zeros(len(self.values) + 1)
+ b[1:-1] = 0.5 * (self._values[:-1] + self._values[1:])
+ b[0] = 2.0 * b[1] - b[2]
+ b[-1] = 2.0 * b[-2] - b[-3]
+ self._boundaries = b
+ return
+ self._boundaries = np.array(self.boundaries)
+ return
+ # Neither boundaries nor values are specified;
+ # make reasonable ones based on cmap and norm.
+ if isinstance(self.norm, colors.NoNorm):
+ b = self._uniform_y(self.cmap.N + 1) * self.cmap.N - 0.5
+ v = np.zeros(len(b) - 1, dtype=np.int16)
+ v[self._inside] = np.arange(self.cmap.N, dtype=np.int16)
+ if self._extend_lower():
+ v[0] = -1
+ if self._extend_upper():
+ v[-1] = self.cmap.N
+ self._boundaries = b
+ self._values = v
+ return
+ elif isinstance(self.norm, colors.BoundaryNorm):
+ b = list(self.norm.boundaries)
+ if self._extend_lower():
+ b = [b[0] - 1] + b
+ if self._extend_upper():
+ b = b + [b[-1] + 1]
+ b = np.array(b)
+ v = np.zeros(len(b) - 1)
+ bi = self.norm.boundaries
+ v[self._inside] = 0.5 * (bi[:-1] + bi[1:])
+ if self._extend_lower():
+ v[0] = b[0] - 1
+ if self._extend_upper():
+ v[-1] = b[-1] + 1
+ self._boundaries = b
+ self._values = v
+ return
+ else:
+ if not self.norm.scaled():
+ self.norm.vmin = 0
+ self.norm.vmax = 1
+
+ self.norm.vmin, self.norm.vmax = mtransforms.nonsingular(
+ self.norm.vmin,
+ self.norm.vmax,
+ expander=0.1)
+
+ b = self.norm.inverse(self._uniform_y(self.cmap.N + 1))
+
+ if isinstance(self.norm, (colors.PowerNorm, colors.LogNorm)):
+ # If using a lognorm or powernorm, ensure extensions don't
+ # go negative
+ if self._extend_lower():
+ b[0] = 0.9 * b[0]
+ if self._extend_upper():
+ b[-1] = 1.1 * b[-1]
+ else:
+ if self._extend_lower():
+ b[0] = b[0] - 1
+ if self._extend_upper():
+ b[-1] = b[-1] + 1
+ self._process_values(b)
+
+ def _get_extension_lengths(self, frac, automin, automax, default=0.05):
+ """
+ Return the lengths of colorbar extensions.
+
+ This is a helper method for _uniform_y and _proportional_y.
+ """
+ # Set the default value.
+ extendlength = np.array([default, default])
+ if isinstance(frac, str):
+ _api.check_in_list(['auto'], extendfrac=frac.lower())
+ # Use the provided values when 'auto' is required.
+ extendlength[:] = [automin, automax]
+ elif frac is not None:
+ try:
+ # Try to set min and max extension fractions directly.
+ extendlength[:] = frac
+ # If frac is a sequence containing None then NaN may
+ # be encountered. This is an error.
+ if np.isnan(extendlength).any():
+ raise ValueError()
+ except (TypeError, ValueError) as err:
+ # Raise an error on encountering an invalid value for frac.
+ raise ValueError('invalid value for extendfrac') from err
+ return extendlength
+
+ def _uniform_y(self, N):
+ """
+ Return colorbar data coordinates for *N* uniformly
+ spaced boundaries, plus ends if required.
+ """
+ if self.extend == 'neither':
+ y = np.linspace(0, 1, N)
+ else:
+ automin = automax = 1. / (N - 1.)
+ extendlength = self._get_extension_lengths(self.extendfrac,
+ automin, automax,
+ default=0.05)
+ if self.extend == 'both':
+ y = np.zeros(N + 2, 'd')
+ y[0] = 0. - extendlength[0]
+ y[-1] = 1. + extendlength[1]
+ elif self.extend == 'min':
+ y = np.zeros(N + 1, 'd')
+ y[0] = 0. - extendlength[0]
+ else:
+ y = np.zeros(N + 1, 'd')
+ y[-1] = 1. + extendlength[1]
+ y[self._inside] = np.linspace(0, 1, N)
+ return y
+
+ def _proportional_y(self):
+ """
+ Return colorbar data coordinates for the boundaries of
+ a proportional colorbar.
+ """
+ if isinstance(self.norm, colors.BoundaryNorm):
+ y = (self._boundaries - self._boundaries[0])
+ y = y / (self._boundaries[-1] - self._boundaries[0])
+ else:
+ y = self.norm(self._boundaries.copy())
+ y = np.ma.filled(y, np.nan)
+ if self.extend == 'min':
+ # Exclude leftmost interval of y.
+ clen = y[-1] - y[1]
+ automin = (y[2] - y[1]) / clen
+ automax = (y[-1] - y[-2]) / clen
+ elif self.extend == 'max':
+ # Exclude rightmost interval in y.
+ clen = y[-2] - y[0]
+ automin = (y[1] - y[0]) / clen
+ automax = (y[-2] - y[-3]) / clen
+ elif self.extend == 'both':
+ # Exclude leftmost and rightmost intervals in y.
+ clen = y[-2] - y[1]
+ automin = (y[2] - y[1]) / clen
+ automax = (y[-2] - y[-3]) / clen
+ if self.extend in ('both', 'min', 'max'):
+ extendlength = self._get_extension_lengths(self.extendfrac,
+ automin, automax,
+ default=0.05)
+ if self.extend in ('both', 'min'):
+ y[0] = 0. - extendlength[0]
+ if self.extend in ('both', 'max'):
+ y[-1] = 1. + extendlength[1]
+ yi = y[self._inside]
+ norm = colors.Normalize(yi[0], yi[-1])
+ y[self._inside] = np.ma.filled(norm(yi), np.nan)
+ return y
+
+ def _mesh(self):
+ """
+ Return the coordinate arrays for the colorbar pcolormesh/patches.
+
+ These are scaled between vmin and vmax, and already handle colorbar
+ orientation.
+ """
+ # copy the norm and change the vmin and vmax to the vmin and
+ # vmax of the colorbar, not the norm. This allows the situation
+ # where the colormap has a narrower range than the colorbar, to
+ # accommodate extra contours:
+ norm = copy.copy(self.norm)
+ norm.vmin = self.vmin
+ norm.vmax = self.vmax
+ x = np.array([0.0, 1.0])
+ if self.spacing == 'uniform':
+ n_boundaries_no_extensions = len(self._boundaries[self._inside])
+ y = self._uniform_y(n_boundaries_no_extensions)
+ else:
+ y = self._proportional_y()
+ xmid = np.array([0.5])
+ if self.__scale != 'manual':
+ y = norm.inverse(y)
+ x = norm.inverse(x)
+ xmid = norm.inverse(xmid)
+ else:
+ # if a norm doesn't have a named scale, or
+ # we are not using a norm
+ dv = self.vmax - self.vmin
+ x = x * dv + self.vmin
+ y = y * dv + self.vmin
+ xmid = xmid * dv + self.vmin
+ self._y = y
+ X, Y = np.meshgrid(x, y)
+ if self._extend_lower() and not self.extendrect:
+ X[0, :] = xmid
+ if self._extend_upper() and not self.extendrect:
+ X[-1, :] = xmid
+ return (X, Y) if self.orientation == 'vertical' else (Y, X)
+
+ def _locate(self, x):
+ """
+ Given a set of color data values, return their
+ corresponding colorbar data coordinates.
+ """
+ if isinstance(self.norm, (colors.NoNorm, colors.BoundaryNorm)):
+ b = self._boundaries
+ xn = x
+ else:
+ # Do calculations using normalized coordinates so
+ # as to make the interpolation more accurate.
+ b = self.norm(self._boundaries, clip=False).filled()
+ xn = self.norm(x, clip=False).filled()
+
+ bunique = b
+ yunique = self._y
+ # trim extra b values at beginning and end if they are
+ # not unique. These are here for extended colorbars, and are not
+ # wanted for the interpolation.
+ if b[0] == b[1]:
+ bunique = bunique[1:]
+ yunique = yunique[1:]
+ if b[-1] == b[-2]:
+ bunique = bunique[:-1]
+ yunique = yunique[:-1]
+
+ z = np.interp(xn, bunique, yunique)
+ return z
+
+ def set_alpha(self, alpha):
+ """Set the transparency between 0 (transparent) and 1 (opaque)."""
+ self.alpha = alpha
+
+ def remove(self):
+ """Remove this colorbar from the figure."""
+ self.ax.remove()
+
+
+def _add_disjoint_kwargs(d, **kwargs):
+ """
+ Update dict *d* with entries in *kwargs*, which must be absent from *d*.
+ """
+ for k, v in kwargs.items():
+ if k in d:
+ _api.warn_deprecated(
+ "3.3", message=f"The {k!r} parameter to Colorbar has no "
+ "effect because it is overridden by the mappable; it is "
+ "deprecated since %(since)s and will be removed %(removal)s.")
+ d[k] = v
+
+
+class Colorbar(ColorbarBase):
+ """
+ This class connects a `ColorbarBase` to a `~.cm.ScalarMappable`
+ such as an `~.image.AxesImage` generated via `~.axes.Axes.imshow`.
+
+ .. note::
+ This class is not intended to be instantiated directly; instead, use
+ `.Figure.colorbar` or `.pyplot.colorbar` to create a colorbar.
+ """
+
+ def __init__(self, ax, mappable, **kwargs):
+ # Ensure the given mappable's norm has appropriate vmin and vmax set
+ # even if mappable.draw has not yet been called.
+ if mappable.get_array() is not None:
+ mappable.autoscale_None()
+
+ self.mappable = mappable
+ _add_disjoint_kwargs(kwargs, cmap=mappable.cmap, norm=mappable.norm)
+
+ if isinstance(mappable, contour.ContourSet):
+ cs = mappable
+ _add_disjoint_kwargs(
+ kwargs,
+ alpha=cs.get_alpha(),
+ boundaries=cs._levels,
+ values=cs.cvalues,
+ extend=cs.extend,
+ filled=cs.filled,
+ )
+ kwargs.setdefault(
+ 'ticks', ticker.FixedLocator(cs.levels, nbins=10))
+ super().__init__(ax, **kwargs)
+ if not cs.filled:
+ self.add_lines(cs)
+ else:
+ if getattr(mappable.cmap, 'colorbar_extend', False) is not False:
+ kwargs.setdefault('extend', mappable.cmap.colorbar_extend)
+ if isinstance(mappable, martist.Artist):
+ _add_disjoint_kwargs(kwargs, alpha=mappable.get_alpha())
+ super().__init__(ax, **kwargs)
+
+ mappable.colorbar = self
+ mappable.colorbar_cid = mappable.callbacksSM.connect(
+ 'changed', self.update_normal)
+
+ @_api.deprecated("3.3", alternative="update_normal")
+ def on_mappable_changed(self, mappable):
+ """
+ Update this colorbar to match the mappable's properties.
+
+ Typically this is automatically registered as an event handler
+ by :func:`colorbar_factory` and should not be called manually.
+ """
+ _log.debug('colorbar mappable changed')
+ self.update_normal(mappable)
+
+ def add_lines(self, CS, erase=True):
+ """
+ Add the lines from a non-filled `~.contour.ContourSet` to the colorbar.
+
+ Parameters
+ ----------
+ CS : `~.contour.ContourSet`
+ The line positions are taken from the ContourSet levels. The
+ ContourSet must not be filled.
+ erase : bool, default: True
+ Whether to remove any previously added lines.
+ """
+ if not isinstance(CS, contour.ContourSet) or CS.filled:
+ raise ValueError('add_lines is only for a ContourSet of lines')
+ tcolors = [c[0] for c in CS.tcolors]
+ tlinewidths = [t[0] for t in CS.tlinewidths]
+ # Wishlist: Make colorbar lines auto-follow changes in contour lines.
+ super().add_lines(CS.levels, tcolors, tlinewidths, erase=erase)
+
+ def update_normal(self, mappable):
+ """
+ Update solid patches, lines, etc.
+
+ This is meant to be called when the norm of the image or contour plot
+ to which this colorbar belongs changes.
+
+ If the norm on the mappable is different than before, this resets the
+ locator and formatter for the axis, so if these have been customized,
+ they will need to be customized again. However, if the norm only
+ changes values of *vmin*, *vmax* or *cmap* then the old formatter
+ and locator will be preserved.
+ """
+ _log.debug('colorbar update normal %r %r', mappable.norm, self.norm)
+ self.mappable = mappable
+ self.set_alpha(mappable.get_alpha())
+ self.cmap = mappable.cmap
+ if mappable.norm != self.norm:
+ self.norm = mappable.norm
+ self._reset_locator_formatter_scale()
+
+ self.draw_all()
+ if isinstance(self.mappable, contour.ContourSet):
+ CS = self.mappable
+ if not CS.filled:
+ self.add_lines(CS)
+ self.stale = True
+
+ @_api.deprecated("3.3", alternative="update_normal")
+ def update_bruteforce(self, mappable):
+ """
+ Destroy and rebuild the colorbar. This is
+ intended to become obsolete, and will probably be
+ deprecated and then removed. It is not called when
+ the pyplot.colorbar function or the Figure.colorbar
+ method are used to create the colorbar.
+ """
+ # We are using an ugly brute-force method: clearing and
+ # redrawing the whole thing. The problem is that if any
+ # properties have been changed by methods other than the
+ # colorbar methods, those changes will be lost.
+ self.ax.cla()
+ self.locator = None
+ self.formatter = None
+
+ # clearing the axes will delete outline, patch, solids, and lines:
+ for spine in self.ax.spines.values():
+ spine.set_visible(False)
+ self.outline = self.ax.spines['outline'] = _ColorbarSpine(self.ax)
+ self.patch = mpatches.Polygon(
+ np.empty((0, 2)),
+ color=mpl.rcParams['axes.facecolor'], linewidth=0.01, zorder=-1)
+ self.ax.add_artist(self.patch)
+ self.solids = None
+ self.lines = []
+ self.update_normal(mappable)
+ self.draw_all()
+ if isinstance(self.mappable, contour.ContourSet):
+ CS = self.mappable
+ if not CS.filled:
+ self.add_lines(CS)
+ #if self.lines is not None:
+ # tcolors = [c[0] for c in CS.tcolors]
+ # self.lines.set_color(tcolors)
+ #Fixme? Recalculate boundaries, ticks if vmin, vmax have changed.
+ #Fixme: Some refactoring may be needed; we should not
+ # be recalculating everything if there was a simple alpha
+ # change.
+
+ def remove(self):
+ """
+ Remove this colorbar from the figure.
+
+ If the colorbar was created with ``use_gridspec=True`` the previous
+ gridspec is restored.
+ """
+ super().remove()
+ self.mappable.callbacksSM.disconnect(self.mappable.colorbar_cid)
+ self.mappable.colorbar = None
+ self.mappable.colorbar_cid = None
+
+ try:
+ ax = self.mappable.axes
+ except AttributeError:
+ return
+
+ try:
+ gs = ax.get_subplotspec().get_gridspec()
+ subplotspec = gs.get_topmost_subplotspec()
+ except AttributeError:
+ # use_gridspec was False
+ pos = ax.get_position(original=True)
+ ax._set_position(pos)
+ else:
+ # use_gridspec was True
+ ax.set_subplotspec(subplotspec)
+
+
+def _normalize_location_orientation(location, orientation):
+ if location is None:
+ location = _api.check_getitem(
+ {None: "right", "vertical": "right", "horizontal": "bottom"},
+ orientation=orientation)
+ loc_settings = _api.check_getitem({
+ "left": {"location": "left", "orientation": "vertical",
+ "anchor": (1.0, 0.5), "panchor": (0.0, 0.5), "pad": 0.10},
+ "right": {"location": "right", "orientation": "vertical",
+ "anchor": (0.0, 0.5), "panchor": (1.0, 0.5), "pad": 0.05},
+ "top": {"location": "top", "orientation": "horizontal",
+ "anchor": (0.5, 0.0), "panchor": (0.5, 1.0), "pad": 0.05},
+ "bottom": {"location": "bottom", "orientation": "horizontal",
+ "anchor": (0.5, 1.0), "panchor": (0.5, 0.0), "pad": 0.15},
+ }, location=location)
+ if orientation is not None and orientation != loc_settings["orientation"]:
+ # Allow the user to pass both if they are consistent.
+ raise TypeError("location and orientation are mutually exclusive")
+ return loc_settings
+
+
+@docstring.Substitution(_make_axes_param_doc, _make_axes_other_param_doc)
+def make_axes(parents, location=None, orientation=None, fraction=0.15,
+ shrink=1.0, aspect=20, **kw):
+ """
+ Create an `~.axes.Axes` suitable for a colorbar.
+
+ The axes is placed in the figure of the *parents* axes, by resizing and
+ repositioning *parents*.
+
+ Parameters
+ ----------
+ parents : `~.axes.Axes` or list of `~.axes.Axes`
+ The Axes to use as parents for placing the colorbar.
+ %s
+
+ Returns
+ -------
+ cax : `~.axes.Axes`
+ The child axes.
+ kw : dict
+ The reduced keyword dictionary to be passed when creating the colorbar
+ instance.
+
+ Other Parameters
+ ----------------
+ %s
+ """
+ loc_settings = _normalize_location_orientation(location, orientation)
+ # put appropriate values into the kw dict for passing back to
+ # the Colorbar class
+ kw['orientation'] = loc_settings['orientation']
+ location = kw['ticklocation'] = loc_settings['location']
+
+ anchor = kw.pop('anchor', loc_settings['anchor'])
+ parent_anchor = kw.pop('panchor', loc_settings['panchor'])
+
+ parents_iterable = np.iterable(parents)
+ # turn parents into a list if it is not already. We do this w/ np
+ # because `plt.subplots` can return an ndarray and is natural to
+ # pass to `colorbar`.
+ parents = np.atleast_1d(parents).ravel()
+ fig = parents[0].get_figure()
+
+ pad0 = 0.05 if fig.get_constrained_layout() else loc_settings['pad']
+ pad = kw.pop('pad', pad0)
+
+ if not all(fig is ax.get_figure() for ax in parents):
+ raise ValueError('Unable to create a colorbar axes as not all '
+ 'parents share the same figure.')
+
+ # take a bounding box around all of the given axes
+ parents_bbox = mtransforms.Bbox.union(
+ [ax.get_position(original=True).frozen() for ax in parents])
+
+ pb = parents_bbox
+ if location in ('left', 'right'):
+ if location == 'left':
+ pbcb, _, pb1 = pb.splitx(fraction, fraction + pad)
+ else:
+ pb1, _, pbcb = pb.splitx(1 - fraction - pad, 1 - fraction)
+ pbcb = pbcb.shrunk(1.0, shrink).anchored(anchor, pbcb)
+ else:
+ if location == 'bottom':
+ pbcb, _, pb1 = pb.splity(fraction, fraction + pad)
+ else:
+ pb1, _, pbcb = pb.splity(1 - fraction - pad, 1 - fraction)
+ pbcb = pbcb.shrunk(shrink, 1.0).anchored(anchor, pbcb)
+
+ # define the aspect ratio in terms of y's per x rather than x's per y
+ aspect = 1.0 / aspect
+
+ # define a transform which takes us from old axes coordinates to
+ # new axes coordinates
+ shrinking_trans = mtransforms.BboxTransform(parents_bbox, pb1)
+
+ # transform each of the axes in parents using the new transform
+ for ax in parents:
+ new_posn = shrinking_trans.transform(ax.get_position(original=True))
+ new_posn = mtransforms.Bbox(new_posn)
+ ax._set_position(new_posn)
+ if parent_anchor is not False:
+ ax.set_anchor(parent_anchor)
+
+ cax = fig.add_axes(pbcb, label="")
+ for a in parents:
+ # tell the parent it has a colorbar
+ a._colorbars += [cax]
+ cax._colorbar_info = dict(
+ location=location,
+ parents=parents,
+ shrink=shrink,
+ anchor=anchor,
+ panchor=parent_anchor,
+ fraction=fraction,
+ aspect=aspect,
+ pad=pad)
+ # and we need to set the aspect ratio by hand...
+ cax.set_aspect(aspect, anchor=anchor, adjustable='box')
+
+ return cax, kw
+
+
+@docstring.Substitution(_make_axes_param_doc, _make_axes_other_param_doc)
+def make_axes_gridspec(parent, *, location=None, orientation=None,
+ fraction=0.15, shrink=1.0, aspect=20, **kw):
+ """
+ Create a `~.SubplotBase` suitable for a colorbar.
+
+ The axes is placed in the figure of the *parent* axes, by resizing and
+ repositioning *parent*.
+
+ This function is similar to `.make_axes`. Primary differences are
+
+ - `.make_axes_gridspec` should only be used with a `.SubplotBase` parent.
+
+ - `.make_axes` creates an `~.axes.Axes`; `.make_axes_gridspec` creates a
+ `.SubplotBase`.
+
+ - `.make_axes` updates the position of the parent. `.make_axes_gridspec`
+ replaces the ``grid_spec`` attribute of the parent with a new one.
+
+ While this function is meant to be compatible with `.make_axes`,
+ there could be some minor differences.
+
+ Parameters
+ ----------
+ parent : `~.axes.Axes`
+ The Axes to use as parent for placing the colorbar.
+ %s
+
+ Returns
+ -------
+ cax : `~.axes.SubplotBase`
+ The child axes.
+ kw : dict
+ The reduced keyword dictionary to be passed when creating the colorbar
+ instance.
+
+ Other Parameters
+ ----------------
+ %s
+ """
+
+ loc_settings = _normalize_location_orientation(location, orientation)
+ kw['orientation'] = loc_settings['orientation']
+ location = kw['ticklocation'] = loc_settings['location']
+
+ anchor = kw.pop('anchor', loc_settings['anchor'])
+ panchor = kw.pop('panchor', loc_settings['panchor'])
+ pad = kw.pop('pad', loc_settings["pad"])
+ wh_space = 2 * pad / (1 - pad)
+
+ if location in ('left', 'right'):
+ # for shrinking
+ height_ratios = [
+ (1-anchor[1])*(1-shrink), shrink, anchor[1]*(1-shrink)]
+
+ if location == 'left':
+ gs = parent.get_subplotspec().subgridspec(
+ 1, 2, wspace=wh_space,
+ width_ratios=[fraction, 1-fraction-pad])
+ ss_main = gs[1]
+ ss_cb = gs[0].subgridspec(
+ 3, 1, hspace=0, height_ratios=height_ratios)[1]
+ else:
+ gs = parent.get_subplotspec().subgridspec(
+ 1, 2, wspace=wh_space,
+ width_ratios=[1-fraction-pad, fraction])
+ ss_main = gs[0]
+ ss_cb = gs[1].subgridspec(
+ 3, 1, hspace=0, height_ratios=height_ratios)[1]
+ else:
+ # for shrinking
+ width_ratios = [
+ anchor[0]*(1-shrink), shrink, (1-anchor[0])*(1-shrink)]
+
+ if location == 'bottom':
+ gs = parent.get_subplotspec().subgridspec(
+ 2, 1, hspace=wh_space,
+ height_ratios=[1-fraction-pad, fraction])
+ ss_main = gs[0]
+ ss_cb = gs[1].subgridspec(
+ 1, 3, wspace=0, width_ratios=width_ratios)[1]
+ aspect = 1 / aspect
+ else:
+ gs = parent.get_subplotspec().subgridspec(
+ 2, 1, hspace=wh_space,
+ height_ratios=[fraction, 1-fraction-pad])
+ ss_main = gs[1]
+ ss_cb = gs[0].subgridspec(
+ 1, 3, wspace=0, width_ratios=width_ratios)[1]
+ aspect = 1 / aspect
+
+ parent.set_subplotspec(ss_main)
+ parent.set_anchor(loc_settings["panchor"])
+
+ fig = parent.get_figure()
+ cax = fig.add_subplot(ss_cb, label="")
+ cax.set_aspect(aspect, anchor=loc_settings["anchor"], adjustable='box')
+ return cax, kw
+
+
+@_api.deprecated("3.4", alternative="Colorbar")
+class ColorbarPatch(Colorbar):
+ pass
+
+
+@_api.deprecated("3.4", alternative="Colorbar")
+def colorbar_factory(cax, mappable, **kwargs):
+ """
+ Create a colorbar on the given axes for the given mappable.
+
+ .. note::
+ This is a low-level function to turn an existing axes into a colorbar
+ axes. Typically, you'll want to use `~.Figure.colorbar` instead, which
+ automatically handles creation and placement of a suitable axes as
+ well.
+
+ Parameters
+ ----------
+ cax : `~matplotlib.axes.Axes`
+ The `~.axes.Axes` to turn into a colorbar.
+ mappable : `~matplotlib.cm.ScalarMappable`
+ The mappable to be described by the colorbar.
+ **kwargs
+ Keyword arguments are passed to the respective colorbar class.
+
+ Returns
+ -------
+ `.Colorbar`
+ The created colorbar instance.
+ """
+ return Colorbar(cax, mappable, **kwargs)
diff --git a/venv/Lib/site-packages/matplotlib/colors.py b/venv/Lib/site-packages/matplotlib/colors.py
new file mode 100644
index 0000000..0bf1cb7
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/colors.py
@@ -0,0 +1,2385 @@
+"""
+A module for converting numbers or color arguments to *RGB* or *RGBA*.
+
+*RGB* and *RGBA* are sequences of, respectively, 3 or 4 floats in the
+range 0-1.
+
+This module includes functions and classes for color specification conversions,
+and for mapping numbers to colors in a 1-D array of colors called a colormap.
+
+Mapping data onto colors using a colormap typically involves two steps: a data
+array is first mapped onto the range 0-1 using a subclass of `Normalize`,
+then this number is mapped to a color using a subclass of `Colormap`. Two
+subclasses of `Colormap` provided here: `LinearSegmentedColormap`, which uses
+piecewise-linear interpolation to define colormaps, and `ListedColormap`, which
+makes a colormap from a list of colors.
+
+.. seealso::
+
+ :doc:`/tutorials/colors/colormap-manipulation` for examples of how to
+ make colormaps and
+
+ :doc:`/tutorials/colors/colormaps` for a list of built-in colormaps.
+
+ :doc:`/tutorials/colors/colormapnorms` for more details about data
+ normalization
+
+ More colormaps are available at palettable_.
+
+The module also provides functions for checking whether an object can be
+interpreted as a color (`is_color_like`), for converting such an object
+to an RGBA tuple (`to_rgba`) or to an HTML-like hex string in the
+"#rrggbb" format (`to_hex`), and a sequence of colors to an (n, 4)
+RGBA array (`to_rgba_array`). Caching is used for efficiency.
+
+Matplotlib recognizes the following formats to specify a color:
+
+* an RGB or RGBA (red, green, blue, alpha) tuple of float values in closed
+ interval ``[0, 1]`` (e.g., ``(0.1, 0.2, 0.5)`` or ``(0.1, 0.2, 0.5, 0.3)``);
+* a hex RGB or RGBA string (e.g., ``'#0f0f0f'`` or ``'#0f0f0f80'``;
+ case-insensitive);
+* a shorthand hex RGB or RGBA string, equivalent to the hex RGB or RGBA
+ string obtained by duplicating each character, (e.g., ``'#abc'``, equivalent
+ to ``'#aabbcc'``, or ``'#abcd'``, equivalent to ``'#aabbccdd'``;
+ case-insensitive);
+* a string representation of a float value in ``[0, 1]`` inclusive for gray
+ level (e.g., ``'0.5'``);
+* one of the characters ``{'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'}``, which
+ are short-hand notations for shades of blue, green, red, cyan, magenta,
+ yellow, black, and white. Note that the colors ``'g', 'c', 'm', 'y'`` do not
+ coincide with the X11/CSS4 colors. Their particular shades were chosen for
+ better visibility of colored lines against typical backgrounds.
+* a X11/CSS4 color name (case-insensitive);
+* a name from the `xkcd color survey`_, prefixed with ``'xkcd:'`` (e.g.,
+ ``'xkcd:sky blue'``; case insensitive);
+* one of the Tableau Colors from the 'T10' categorical palette (the default
+ color cycle): ``{'tab:blue', 'tab:orange', 'tab:green', 'tab:red',
+ 'tab:purple', 'tab:brown', 'tab:pink', 'tab:gray', 'tab:olive', 'tab:cyan'}``
+ (case-insensitive);
+* a "CN" color spec, i.e. 'C' followed by a number, which is an index into the
+ default property cycle (:rc:`axes.prop_cycle`); the indexing is intended to
+ occur at rendering time, and defaults to black if the cycle does not include
+ color.
+
+.. _palettable: https://jiffyclub.github.io/palettable/
+.. _xkcd color survey: https://xkcd.com/color/rgb/
+"""
+
+import base64
+from collections.abc import Sized, Sequence
+import copy
+import functools
+import inspect
+import io
+import itertools
+from numbers import Number
+import re
+from PIL import Image
+from PIL.PngImagePlugin import PngInfo
+
+import matplotlib as mpl
+import numpy as np
+from matplotlib import _api, cbook, scale
+from ._color_data import BASE_COLORS, TABLEAU_COLORS, CSS4_COLORS, XKCD_COLORS
+
+
+class _ColorMapping(dict):
+ def __init__(self, mapping):
+ super().__init__(mapping)
+ self.cache = {}
+
+ def __setitem__(self, key, value):
+ super().__setitem__(key, value)
+ self.cache.clear()
+
+ def __delitem__(self, key):
+ super().__delitem__(key)
+ self.cache.clear()
+
+
+_colors_full_map = {}
+# Set by reverse priority order.
+_colors_full_map.update(XKCD_COLORS)
+_colors_full_map.update({k.replace('grey', 'gray'): v
+ for k, v in XKCD_COLORS.items()
+ if 'grey' in k})
+_colors_full_map.update(CSS4_COLORS)
+_colors_full_map.update(TABLEAU_COLORS)
+_colors_full_map.update({k.replace('gray', 'grey'): v
+ for k, v in TABLEAU_COLORS.items()
+ if 'gray' in k})
+_colors_full_map.update(BASE_COLORS)
+_colors_full_map = _ColorMapping(_colors_full_map)
+
+_REPR_PNG_SIZE = (512, 64)
+
+
+def get_named_colors_mapping():
+ """Return the global mapping of names to named colors."""
+ return _colors_full_map
+
+
+def _sanitize_extrema(ex):
+ if ex is None:
+ return ex
+ try:
+ ret = ex.item()
+ except AttributeError:
+ ret = float(ex)
+ return ret
+
+
+def _is_nth_color(c):
+ """Return whether *c* can be interpreted as an item in the color cycle."""
+ return isinstance(c, str) and re.match(r"\AC[0-9]+\Z", c)
+
+
+def is_color_like(c):
+ """Return whether *c* can be interpreted as an RGB(A) color."""
+ # Special-case nth color syntax because it cannot be parsed during setup.
+ if _is_nth_color(c):
+ return True
+ try:
+ to_rgba(c)
+ except ValueError:
+ return False
+ else:
+ return True
+
+
+def _check_color_like(**kwargs):
+ """
+ For each *key, value* pair in *kwargs*, check that *value* is color-like.
+ """
+ for k, v in kwargs.items():
+ if not is_color_like(v):
+ raise ValueError(f"{v!r} is not a valid value for {k}")
+
+
+def same_color(c1, c2):
+ """
+ Return whether the colors *c1* and *c2* are the same.
+
+ *c1*, *c2* can be single colors or lists/arrays of colors.
+ """
+ c1 = to_rgba_array(c1)
+ c2 = to_rgba_array(c2)
+ n1 = max(c1.shape[0], 1) # 'none' results in shape (0, 4), but is 1-elem
+ n2 = max(c2.shape[0], 1) # 'none' results in shape (0, 4), but is 1-elem
+
+ if n1 != n2:
+ raise ValueError('Different number of elements passed.')
+ # The following shape test is needed to correctly handle comparisons with
+ # 'none', which results in a shape (0, 4) array and thus cannot be tested
+ # via value comparison.
+ return c1.shape == c2.shape and (c1 == c2).all()
+
+
+def to_rgba(c, alpha=None):
+ """
+ Convert *c* to an RGBA color.
+
+ Parameters
+ ----------
+ c : Matplotlib color or ``np.ma.masked``
+
+ alpha : float, optional
+ If *alpha* is not ``None``, it forces the alpha value, except if *c* is
+ ``"none"`` (case-insensitive), which always maps to ``(0, 0, 0, 0)``.
+
+ Returns
+ -------
+ tuple
+ Tuple of ``(r, g, b, a)`` scalars.
+ """
+ # Special-case nth color syntax because it should not be cached.
+ if _is_nth_color(c):
+ from matplotlib import rcParams
+ prop_cycler = rcParams['axes.prop_cycle']
+ colors = prop_cycler.by_key().get('color', ['k'])
+ c = colors[int(c[1:]) % len(colors)]
+ try:
+ rgba = _colors_full_map.cache[c, alpha]
+ except (KeyError, TypeError): # Not in cache, or unhashable.
+ rgba = None
+ if rgba is None: # Suppress exception chaining of cache lookup failure.
+ rgba = _to_rgba_no_colorcycle(c, alpha)
+ try:
+ _colors_full_map.cache[c, alpha] = rgba
+ except TypeError:
+ pass
+ return rgba
+
+
+def _to_rgba_no_colorcycle(c, alpha=None):
+ """
+ Convert *c* to an RGBA color, with no support for color-cycle syntax.
+
+ If *alpha* is not ``None``, it forces the alpha value, except if *c* is
+ ``"none"`` (case-insensitive), which always maps to ``(0, 0, 0, 0)``.
+ """
+ orig_c = c
+ if c is np.ma.masked:
+ return (0., 0., 0., 0.)
+ if isinstance(c, str):
+ if c.lower() == "none":
+ return (0., 0., 0., 0.)
+ # Named color.
+ try:
+ # This may turn c into a non-string, so we check again below.
+ c = _colors_full_map[c]
+ except KeyError:
+ if len(orig_c) != 1:
+ try:
+ c = _colors_full_map[c.lower()]
+ except KeyError:
+ pass
+ if isinstance(c, str):
+ # hex color in #rrggbb format.
+ match = re.match(r"\A#[a-fA-F0-9]{6}\Z", c)
+ if match:
+ return (tuple(int(n, 16) / 255
+ for n in [c[1:3], c[3:5], c[5:7]])
+ + (alpha if alpha is not None else 1.,))
+ # hex color in #rgb format, shorthand for #rrggbb.
+ match = re.match(r"\A#[a-fA-F0-9]{3}\Z", c)
+ if match:
+ return (tuple(int(n, 16) / 255
+ for n in [c[1]*2, c[2]*2, c[3]*2])
+ + (alpha if alpha is not None else 1.,))
+ # hex color with alpha in #rrggbbaa format.
+ match = re.match(r"\A#[a-fA-F0-9]{8}\Z", c)
+ if match:
+ color = [int(n, 16) / 255
+ for n in [c[1:3], c[3:5], c[5:7], c[7:9]]]
+ if alpha is not None:
+ color[-1] = alpha
+ return tuple(color)
+ # hex color with alpha in #rgba format, shorthand for #rrggbbaa.
+ match = re.match(r"\A#[a-fA-F0-9]{4}\Z", c)
+ if match:
+ color = [int(n, 16) / 255
+ for n in [c[1]*2, c[2]*2, c[3]*2, c[4]*2]]
+ if alpha is not None:
+ color[-1] = alpha
+ return tuple(color)
+ # string gray.
+ try:
+ c = float(c)
+ except ValueError:
+ pass
+ else:
+ if not (0 <= c <= 1):
+ raise ValueError(
+ f"Invalid string grayscale value {orig_c!r}. "
+ f"Value must be within 0-1 range")
+ return c, c, c, alpha if alpha is not None else 1.
+ raise ValueError(f"Invalid RGBA argument: {orig_c!r}")
+ # turn 2-D array into 1-D array
+ if isinstance(c, np.ndarray):
+ if c.ndim == 2 and c.shape[0] == 1:
+ c = c.reshape(-1)
+ # tuple color.
+ if not np.iterable(c):
+ raise ValueError(f"Invalid RGBA argument: {orig_c!r}")
+ if len(c) not in [3, 4]:
+ raise ValueError("RGBA sequence should have length 3 or 4")
+ if not all(isinstance(x, Number) for x in c):
+ # Checks that don't work: `map(float, ...)`, `np.array(..., float)` and
+ # `np.array(...).astype(float)` would all convert "0.5" to 0.5.
+ raise ValueError(f"Invalid RGBA argument: {orig_c!r}")
+ # Return a tuple to prevent the cached value from being modified.
+ c = tuple(map(float, c))
+ if len(c) == 3 and alpha is None:
+ alpha = 1
+ if alpha is not None:
+ c = c[:3] + (alpha,)
+ if any(elem < 0 or elem > 1 for elem in c):
+ raise ValueError("RGBA values should be within 0-1 range")
+ return c
+
+
+def to_rgba_array(c, alpha=None):
+ """
+ Convert *c* to a (n, 4) array of RGBA colors.
+
+ Parameters
+ ----------
+ c : Matplotlib color or array of colors
+ If *c* is a masked array, an ndarray is returned with a (0, 0, 0, 0)
+ row for each masked value or row in *c*.
+
+ alpha : float or sequence of floats, optional
+ If *alpha* is not ``None``, it forces the alpha value, except if *c* is
+ ``"none"`` (case-insensitive), which always maps to ``(0, 0, 0, 0)``.
+ If *alpha* is a sequence and *c* is a single color, *c* will be
+ repeated to match the length of *alpha*.
+
+ Returns
+ -------
+ array
+ (n, 4) array of RGBA colors.
+
+ """
+ # Special-case inputs that are already arrays, for performance. (If the
+ # array has the wrong kind or shape, raise the error during one-at-a-time
+ # conversion.)
+ if np.iterable(alpha):
+ alpha = np.asarray(alpha).ravel()
+ if (isinstance(c, np.ndarray) and c.dtype.kind in "if"
+ and c.ndim == 2 and c.shape[1] in [3, 4]):
+ mask = c.mask.any(axis=1) if np.ma.is_masked(c) else None
+ c = np.ma.getdata(c)
+ if np.iterable(alpha):
+ if c.shape[0] == 1 and alpha.shape[0] > 1:
+ c = np.tile(c, (alpha.shape[0], 1))
+ elif c.shape[0] != alpha.shape[0]:
+ raise ValueError("The number of colors must match the number"
+ " of alpha values if there are more than one"
+ " of each.")
+ if c.shape[1] == 3:
+ result = np.column_stack([c, np.zeros(len(c))])
+ result[:, -1] = alpha if alpha is not None else 1.
+ elif c.shape[1] == 4:
+ result = c.copy()
+ if alpha is not None:
+ result[:, -1] = alpha
+ if mask is not None:
+ result[mask] = 0
+ if np.any((result < 0) | (result > 1)):
+ raise ValueError("RGBA values should be within 0-1 range")
+ return result
+ # Handle single values.
+ # Note that this occurs *after* handling inputs that are already arrays, as
+ # `to_rgba(c, alpha)` (below) is expensive for such inputs, due to the need
+ # to format the array in the ValueError message(!).
+ if cbook._str_lower_equal(c, "none"):
+ return np.zeros((0, 4), float)
+ try:
+ if np.iterable(alpha):
+ return np.array([to_rgba(c, a) for a in alpha], float)
+ else:
+ return np.array([to_rgba(c, alpha)], float)
+ except (ValueError, TypeError):
+ pass
+
+ if isinstance(c, str):
+ raise ValueError("Using a string of single character colors as "
+ "a color sequence is not supported. The colors can "
+ "be passed as an explicit list instead.")
+
+ if len(c) == 0:
+ return np.zeros((0, 4), float)
+
+ # Quick path if the whole sequence can be directly converted to a numpy
+ # array in one shot.
+ if isinstance(c, Sequence):
+ lens = {len(cc) if isinstance(cc, (list, tuple)) else -1 for cc in c}
+ if lens == {3}:
+ rgba = np.column_stack([c, np.ones(len(c))])
+ elif lens == {4}:
+ rgba = np.array(c)
+ else:
+ rgba = np.array([to_rgba(cc) for cc in c])
+ else:
+ rgba = np.array([to_rgba(cc) for cc in c])
+
+ if alpha is not None:
+ rgba[:, 3] = alpha
+ return rgba
+
+
+def to_rgb(c):
+ """Convert *c* to an RGB color, silently dropping the alpha channel."""
+ return to_rgba(c)[:3]
+
+
+def to_hex(c, keep_alpha=False):
+ """
+ Convert *c* to a hex color.
+
+ Uses the ``#rrggbb`` format if *keep_alpha* is False (the default),
+ ``#rrggbbaa`` otherwise.
+ """
+ c = to_rgba(c)
+ if not keep_alpha:
+ c = c[:3]
+ return "#" + "".join(format(int(round(val * 255)), "02x") for val in c)
+
+
+### Backwards-compatible color-conversion API
+
+
+cnames = CSS4_COLORS
+hexColorPattern = re.compile(r"\A#[a-fA-F0-9]{6}\Z")
+rgb2hex = to_hex
+hex2color = to_rgb
+
+
+class ColorConverter:
+ """
+ A class only kept for backwards compatibility.
+
+ Its functionality is entirely provided by module-level functions.
+ """
+ colors = _colors_full_map
+ cache = _colors_full_map.cache
+ to_rgb = staticmethod(to_rgb)
+ to_rgba = staticmethod(to_rgba)
+ to_rgba_array = staticmethod(to_rgba_array)
+
+
+colorConverter = ColorConverter()
+
+
+### End of backwards-compatible color-conversion API
+
+
+def _create_lookup_table(N, data, gamma=1.0):
+ r"""
+ Create an *N* -element 1D lookup table.
+
+ This assumes a mapping :math:`f : [0, 1] \rightarrow [0, 1]`. The returned
+ data is an array of N values :math:`y = f(x)` where x is sampled from
+ [0, 1].
+
+ By default (*gamma* = 1) x is equidistantly sampled from [0, 1]. The
+ *gamma* correction factor :math:`\gamma` distorts this equidistant
+ sampling by :math:`x \rightarrow x^\gamma`.
+
+ Parameters
+ ----------
+ N : int
+ The number of elements of the created lookup table; at least 1.
+
+ data : (M, 3) array-like or callable
+ Defines the mapping :math:`f`.
+
+ If a (M, 3) array-like, the rows define values (x, y0, y1). The x
+ values must start with x=0, end with x=1, and all x values be in
+ increasing order.
+
+ A value between :math:`x_i` and :math:`x_{i+1}` is mapped to the range
+ :math:`y^1_{i-1} \ldots y^0_i` by linear interpolation.
+
+ For the simple case of a y-continuous mapping, y0 and y1 are identical.
+
+ The two values of y are to allow for discontinuous mapping functions.
+ E.g. a sawtooth with a period of 0.2 and an amplitude of 1 would be::
+
+ [(0, 1, 0), (0.2, 1, 0), (0.4, 1, 0), ..., [(1, 1, 0)]
+
+ In the special case of ``N == 1``, by convention the returned value
+ is y0 for x == 1.
+
+ If *data* is a callable, it must accept and return numpy arrays::
+
+ data(x : ndarray) -> ndarray
+
+ and map values between 0 - 1 to 0 - 1.
+
+ gamma : float
+ Gamma correction factor for input distribution x of the mapping.
+
+ See also https://en.wikipedia.org/wiki/Gamma_correction.
+
+ Returns
+ -------
+ array
+ The lookup table where ``lut[x * (N-1)]`` gives the closest value
+ for values of x between 0 and 1.
+
+ Notes
+ -----
+ This function is internally used for `.LinearSegmentedColormap`.
+ """
+
+ if callable(data):
+ xind = np.linspace(0, 1, N) ** gamma
+ lut = np.clip(np.array(data(xind), dtype=float), 0, 1)
+ return lut
+
+ try:
+ adata = np.array(data)
+ except Exception as err:
+ raise TypeError("data must be convertible to an array") from err
+ shape = adata.shape
+ if len(shape) != 2 or shape[1] != 3:
+ raise ValueError("data must be nx3 format")
+
+ x = adata[:, 0]
+ y0 = adata[:, 1]
+ y1 = adata[:, 2]
+
+ if x[0] != 0. or x[-1] != 1.0:
+ raise ValueError(
+ "data mapping points must start with x=0 and end with x=1")
+ if (np.diff(x) < 0).any():
+ raise ValueError("data mapping points must have x in increasing order")
+ # begin generation of lookup table
+ if N == 1:
+ # convention: use the y = f(x=1) value for a 1-element lookup table
+ lut = np.array(y0[-1])
+ else:
+ x = x * (N - 1)
+ xind = (N - 1) * np.linspace(0, 1, N) ** gamma
+ ind = np.searchsorted(x, xind)[1:-1]
+
+ distance = (xind[1:-1] - x[ind - 1]) / (x[ind] - x[ind - 1])
+ lut = np.concatenate([
+ [y1[0]],
+ distance * (y0[ind] - y1[ind - 1]) + y1[ind - 1],
+ [y0[-1]],
+ ])
+ # ensure that the lut is confined to values between 0 and 1 by clipping it
+ return np.clip(lut, 0.0, 1.0)
+
+
+def _warn_if_global_cmap_modified(cmap):
+ if getattr(cmap, '_global', False):
+ _api.warn_deprecated(
+ "3.3",
+ removal="3.6",
+ message="You are modifying the state of a globally registered "
+ "colormap. This has been deprecated since %(since)s and "
+ "%(removal)s, you will not be able to modify a "
+ "registered colormap in-place. To remove this warning, "
+ "you can make a copy of the colormap first. "
+ f'cmap = mpl.cm.get_cmap("{cmap.name}").copy()'
+ )
+
+
+class Colormap:
+ """
+ Baseclass for all scalar to RGBA mappings.
+
+ Typically, Colormap instances are used to convert data values (floats)
+ from the interval ``[0, 1]`` to the RGBA color that the respective
+ Colormap represents. For scaling of data into the ``[0, 1]`` interval see
+ `matplotlib.colors.Normalize`. Subclasses of `matplotlib.cm.ScalarMappable`
+ make heavy use of this ``data -> normalize -> map-to-color`` processing
+ chain.
+ """
+
+ def __init__(self, name, N=256):
+ """
+ Parameters
+ ----------
+ name : str
+ The name of the colormap.
+ N : int
+ The number of rgb quantization levels.
+ """
+ self.name = name
+ self.N = int(N) # ensure that N is always int
+ self._rgba_bad = (0.0, 0.0, 0.0, 0.0) # If bad, don't paint anything.
+ self._rgba_under = None
+ self._rgba_over = None
+ self._i_under = self.N
+ self._i_over = self.N + 1
+ self._i_bad = self.N + 2
+ self._isinit = False
+ #: When this colormap exists on a scalar mappable and colorbar_extend
+ #: is not False, colorbar creation will pick up ``colorbar_extend`` as
+ #: the default value for the ``extend`` keyword in the
+ #: `matplotlib.colorbar.Colorbar` constructor.
+ self.colorbar_extend = False
+
+ def __call__(self, X, alpha=None, bytes=False):
+ """
+ Parameters
+ ----------
+ X : float or int, ndarray or scalar
+ The data value(s) to convert to RGBA.
+ For floats, X should be in the interval ``[0.0, 1.0]`` to
+ return the RGBA values ``X*100`` percent along the Colormap line.
+ For integers, X should be in the interval ``[0, Colormap.N)`` to
+ return RGBA values *indexed* from the Colormap with index ``X``.
+ alpha : float or array-like or None
+ Alpha must be a scalar between 0 and 1, a sequence of such
+ floats with shape matching X, or None.
+ bytes : bool
+ If False (default), the returned RGBA values will be floats in the
+ interval ``[0, 1]`` otherwise they will be uint8s in the interval
+ ``[0, 255]``.
+
+ Returns
+ -------
+ Tuple of RGBA values if X is scalar, otherwise an array of
+ RGBA values with a shape of ``X.shape + (4, )``.
+ """
+ if not self._isinit:
+ self._init()
+
+ mask_bad = X.mask if np.ma.is_masked(X) else np.isnan(X) # Mask nan's.
+ xa = np.array(X, copy=True)
+ if not xa.dtype.isnative:
+ xa = xa.byteswap().newbyteorder() # Native byteorder is faster.
+ if xa.dtype.kind == "f":
+ with np.errstate(invalid="ignore"):
+ xa *= self.N
+ # Negative values are out of range, but astype(int) would
+ # truncate them towards zero.
+ xa[xa < 0] = -1
+ # xa == 1 (== N after multiplication) is not out of range.
+ xa[xa == self.N] = self.N - 1
+ # Avoid converting large positive values to negative integers.
+ np.clip(xa, -1, self.N, out=xa)
+ xa = xa.astype(int)
+ # Set the over-range indices before the under-range;
+ # otherwise the under-range values get converted to over-range.
+ xa[xa > self.N - 1] = self._i_over
+ xa[xa < 0] = self._i_under
+ xa[mask_bad] = self._i_bad
+
+ if bytes:
+ lut = (self._lut * 255).astype(np.uint8)
+ else:
+ lut = self._lut.copy() # Don't let alpha modify original _lut.
+
+ rgba = np.empty(shape=xa.shape + (4,), dtype=lut.dtype)
+ lut.take(xa, axis=0, mode='clip', out=rgba)
+
+ if alpha is not None:
+ if np.iterable(alpha):
+ alpha = np.asarray(alpha)
+ if alpha.shape != xa.shape:
+ raise ValueError("alpha is array-like but its shape"
+ " %s doesn't match that of X %s" %
+ (alpha.shape, xa.shape))
+ alpha = np.clip(alpha, 0, 1)
+ if bytes:
+ alpha = (alpha * 255).astype(np.uint8)
+ rgba[..., -1] = alpha
+
+ # If the "bad" color is all zeros, then ignore alpha input.
+ if (lut[-1] == 0).all() and np.any(mask_bad):
+ if np.iterable(mask_bad) and mask_bad.shape == xa.shape:
+ rgba[mask_bad] = (0, 0, 0, 0)
+ else:
+ rgba[..., :] = (0, 0, 0, 0)
+
+ if not np.iterable(X):
+ rgba = tuple(rgba)
+ return rgba
+
+ def __copy__(self):
+ cls = self.__class__
+ cmapobject = cls.__new__(cls)
+ cmapobject.__dict__.update(self.__dict__)
+ if self._isinit:
+ cmapobject._lut = np.copy(self._lut)
+ cmapobject._global = False
+ return cmapobject
+
+ def get_bad(self):
+ """Get the color for masked values."""
+ if not self._isinit:
+ self._init()
+ return np.array(self._lut[self._i_bad])
+
+ def set_bad(self, color='k', alpha=None):
+ """Set the color for masked values."""
+ _warn_if_global_cmap_modified(self)
+ self._rgba_bad = to_rgba(color, alpha)
+ if self._isinit:
+ self._set_extremes()
+
+ def get_under(self):
+ """Get the color for low out-of-range values."""
+ if not self._isinit:
+ self._init()
+ return np.array(self._lut[self._i_under])
+
+ def set_under(self, color='k', alpha=None):
+ """Set the color for low out-of-range values."""
+ _warn_if_global_cmap_modified(self)
+ self._rgba_under = to_rgba(color, alpha)
+ if self._isinit:
+ self._set_extremes()
+
+ def get_over(self):
+ """Get the color for high out-of-range values."""
+ if not self._isinit:
+ self._init()
+ return np.array(self._lut[self._i_over])
+
+ def set_over(self, color='k', alpha=None):
+ """Set the color for high out-of-range values."""
+ _warn_if_global_cmap_modified(self)
+ self._rgba_over = to_rgba(color, alpha)
+ if self._isinit:
+ self._set_extremes()
+
+ def set_extremes(self, *, bad=None, under=None, over=None):
+ """
+ Set the colors for masked (*bad*) values and, when ``norm.clip =
+ False``, low (*under*) and high (*over*) out-of-range values.
+ """
+ if bad is not None:
+ self.set_bad(bad)
+ if under is not None:
+ self.set_under(under)
+ if over is not None:
+ self.set_over(over)
+
+ def with_extremes(self, *, bad=None, under=None, over=None):
+ """
+ Return a copy of the colormap, for which the colors for masked (*bad*)
+ values and, when ``norm.clip = False``, low (*under*) and high (*over*)
+ out-of-range values, have been set accordingly.
+ """
+ new_cm = copy.copy(self)
+ new_cm.set_extremes(bad=bad, under=under, over=over)
+ return new_cm
+
+ def _set_extremes(self):
+ if self._rgba_under:
+ self._lut[self._i_under] = self._rgba_under
+ else:
+ self._lut[self._i_under] = self._lut[0]
+ if self._rgba_over:
+ self._lut[self._i_over] = self._rgba_over
+ else:
+ self._lut[self._i_over] = self._lut[self.N - 1]
+ self._lut[self._i_bad] = self._rgba_bad
+
+ def _init(self):
+ """Generate the lookup table, ``self._lut``."""
+ raise NotImplementedError("Abstract class only")
+
+ def is_gray(self):
+ """Return whether the colormap is grayscale."""
+ if not self._isinit:
+ self._init()
+ return (np.all(self._lut[:, 0] == self._lut[:, 1]) and
+ np.all(self._lut[:, 0] == self._lut[:, 2]))
+
+ def _resample(self, lutsize):
+ """Return a new colormap with *lutsize* entries."""
+ raise NotImplementedError()
+
+ def reversed(self, name=None):
+ """
+ Return a reversed instance of the Colormap.
+
+ .. note:: This function is not implemented for base class.
+
+ Parameters
+ ----------
+ name : str, optional
+ The name for the reversed colormap. If it's None the
+ name will be the name of the parent colormap + "_r".
+
+ See Also
+ --------
+ LinearSegmentedColormap.reversed
+ ListedColormap.reversed
+ """
+ raise NotImplementedError()
+
+ def _repr_png_(self):
+ """Generate a PNG representation of the Colormap."""
+ X = np.tile(np.linspace(0, 1, _REPR_PNG_SIZE[0]),
+ (_REPR_PNG_SIZE[1], 1))
+ pixels = self(X, bytes=True)
+ png_bytes = io.BytesIO()
+ title = self.name + ' colormap'
+ author = f'Matplotlib v{mpl.__version__}, https://matplotlib.org'
+ pnginfo = PngInfo()
+ pnginfo.add_text('Title', title)
+ pnginfo.add_text('Description', title)
+ pnginfo.add_text('Author', author)
+ pnginfo.add_text('Software', author)
+ Image.fromarray(pixels).save(png_bytes, format='png', pnginfo=pnginfo)
+ return png_bytes.getvalue()
+
+ def _repr_html_(self):
+ """Generate an HTML representation of the Colormap."""
+ png_bytes = self._repr_png_()
+ png_base64 = base64.b64encode(png_bytes).decode('ascii')
+ def color_block(color):
+ hex_color = to_hex(color, keep_alpha=True)
+ return (f'
')
+
+ return (''
+ f'{self.name} '
+ '
'
+ ' '
+ ''
+ '
'
+ f'{color_block(self.get_under())} under'
+ '
'
+ '
'
+ f'bad {color_block(self.get_bad())}'
+ '
'
+ '
'
+ f'over {color_block(self.get_over())}'
+ '
')
+
+ def copy(self):
+ """Return a copy of the colormap."""
+ return self.__copy__()
+
+
+class LinearSegmentedColormap(Colormap):
+ """
+ Colormap objects based on lookup tables using linear segments.
+
+ The lookup table is generated using linear interpolation for each
+ primary color, with the 0-1 domain divided into any number of
+ segments.
+ """
+
+ def __init__(self, name, segmentdata, N=256, gamma=1.0):
+ """
+ Create colormap from linear mapping segments
+
+ segmentdata argument is a dictionary with a red, green and blue
+ entries. Each entry should be a list of *x*, *y0*, *y1* tuples,
+ forming rows in a table. Entries for alpha are optional.
+
+ Example: suppose you want red to increase from 0 to 1 over
+ the bottom half, green to do the same over the middle half,
+ and blue over the top half. Then you would use::
+
+ cdict = {'red': [(0.0, 0.0, 0.0),
+ (0.5, 1.0, 1.0),
+ (1.0, 1.0, 1.0)],
+
+ 'green': [(0.0, 0.0, 0.0),
+ (0.25, 0.0, 0.0),
+ (0.75, 1.0, 1.0),
+ (1.0, 1.0, 1.0)],
+
+ 'blue': [(0.0, 0.0, 0.0),
+ (0.5, 0.0, 0.0),
+ (1.0, 1.0, 1.0)]}
+
+ Each row in the table for a given color is a sequence of
+ *x*, *y0*, *y1* tuples. In each sequence, *x* must increase
+ monotonically from 0 to 1. For any input value *z* falling
+ between *x[i]* and *x[i+1]*, the output value of a given color
+ will be linearly interpolated between *y1[i]* and *y0[i+1]*::
+
+ row i: x y0 y1
+ /
+ /
+ row i+1: x y0 y1
+
+ Hence y0 in the first row and y1 in the last row are never used.
+
+ See Also
+ --------
+ LinearSegmentedColormap.from_list
+ Static method; factory function for generating a smoothly-varying
+ LinearSegmentedColormap.
+ """
+ # True only if all colors in map are identical; needed for contouring.
+ self.monochrome = False
+ super().__init__(name, N)
+ self._segmentdata = segmentdata
+ self._gamma = gamma
+
+ def _init(self):
+ self._lut = np.ones((self.N + 3, 4), float)
+ self._lut[:-3, 0] = _create_lookup_table(
+ self.N, self._segmentdata['red'], self._gamma)
+ self._lut[:-3, 1] = _create_lookup_table(
+ self.N, self._segmentdata['green'], self._gamma)
+ self._lut[:-3, 2] = _create_lookup_table(
+ self.N, self._segmentdata['blue'], self._gamma)
+ if 'alpha' in self._segmentdata:
+ self._lut[:-3, 3] = _create_lookup_table(
+ self.N, self._segmentdata['alpha'], 1)
+ self._isinit = True
+ self._set_extremes()
+
+ def set_gamma(self, gamma):
+ """Set a new gamma value and regenerate colormap."""
+ self._gamma = gamma
+ self._init()
+
+ @staticmethod
+ def from_list(name, colors, N=256, gamma=1.0):
+ """
+ Create a `LinearSegmentedColormap` from a list of colors.
+
+ Parameters
+ ----------
+ name : str
+ The name of the colormap.
+ colors : array-like of colors or array-like of (value, color)
+ If only colors are given, they are equidistantly mapped from the
+ range :math:`[0, 1]`; i.e. 0 maps to ``colors[0]`` and 1 maps to
+ ``colors[-1]``.
+ If (value, color) pairs are given, the mapping is from *value*
+ to *color*. This can be used to divide the range unevenly.
+ N : int
+ The number of rgb quantization levels.
+ gamma : float
+ """
+ if not np.iterable(colors):
+ raise ValueError('colors must be iterable')
+
+ if (isinstance(colors[0], Sized) and len(colors[0]) == 2
+ and not isinstance(colors[0], str)):
+ # List of value, color pairs
+ vals, colors = zip(*colors)
+ else:
+ vals = np.linspace(0, 1, len(colors))
+
+ r, g, b, a = to_rgba_array(colors).T
+ cdict = {
+ "red": np.column_stack([vals, r, r]),
+ "green": np.column_stack([vals, g, g]),
+ "blue": np.column_stack([vals, b, b]),
+ "alpha": np.column_stack([vals, a, a]),
+ }
+
+ return LinearSegmentedColormap(name, cdict, N, gamma)
+
+ def _resample(self, lutsize):
+ """Return a new colormap with *lutsize* entries."""
+ new_cmap = LinearSegmentedColormap(self.name, self._segmentdata,
+ lutsize)
+ new_cmap._rgba_over = self._rgba_over
+ new_cmap._rgba_under = self._rgba_under
+ new_cmap._rgba_bad = self._rgba_bad
+ return new_cmap
+
+ # Helper ensuring picklability of the reversed cmap.
+ @staticmethod
+ def _reverser(func, x):
+ return func(1 - x)
+
+ def reversed(self, name=None):
+ """
+ Return a reversed instance of the Colormap.
+
+ Parameters
+ ----------
+ name : str, optional
+ The name for the reversed colormap. If it's None the
+ name will be the name of the parent colormap + "_r".
+
+ Returns
+ -------
+ LinearSegmentedColormap
+ The reversed colormap.
+ """
+ if name is None:
+ name = self.name + "_r"
+
+ # Using a partial object keeps the cmap picklable.
+ data_r = {key: (functools.partial(self._reverser, data)
+ if callable(data) else
+ [(1.0 - x, y1, y0) for x, y0, y1 in reversed(data)])
+ for key, data in self._segmentdata.items()}
+
+ new_cmap = LinearSegmentedColormap(name, data_r, self.N, self._gamma)
+ # Reverse the over/under values too
+ new_cmap._rgba_over = self._rgba_under
+ new_cmap._rgba_under = self._rgba_over
+ new_cmap._rgba_bad = self._rgba_bad
+ return new_cmap
+
+
+class ListedColormap(Colormap):
+ """
+ Colormap object generated from a list of colors.
+
+ This may be most useful when indexing directly into a colormap,
+ but it can also be used to generate special colormaps for ordinary
+ mapping.
+
+ Parameters
+ ----------
+ colors : list, array
+ List of Matplotlib color specifications, or an equivalent Nx3 or Nx4
+ floating point array (*N* rgb or rgba values).
+ name : str, optional
+ String to identify the colormap.
+ N : int, optional
+ Number of entries in the map. The default is *None*, in which case
+ there is one colormap entry for each element in the list of colors.
+ If ::
+
+ N < len(colors)
+
+ the list will be truncated at *N*. If ::
+
+ N > len(colors)
+
+ the list will be extended by repetition.
+ """
+ def __init__(self, colors, name='from_list', N=None):
+ self.monochrome = False # Are all colors identical? (for contour.py)
+ if N is None:
+ self.colors = colors
+ N = len(colors)
+ else:
+ if isinstance(colors, str):
+ self.colors = [colors] * N
+ self.monochrome = True
+ elif np.iterable(colors):
+ if len(colors) == 1:
+ self.monochrome = True
+ self.colors = list(
+ itertools.islice(itertools.cycle(colors), N))
+ else:
+ try:
+ gray = float(colors)
+ except TypeError:
+ pass
+ else:
+ self.colors = [gray] * N
+ self.monochrome = True
+ super().__init__(name, N)
+
+ def _init(self):
+ self._lut = np.zeros((self.N + 3, 4), float)
+ self._lut[:-3] = to_rgba_array(self.colors)
+ self._isinit = True
+ self._set_extremes()
+
+ def _resample(self, lutsize):
+ """Return a new colormap with *lutsize* entries."""
+ colors = self(np.linspace(0, 1, lutsize))
+ new_cmap = ListedColormap(colors, name=self.name)
+ # Keep the over/under values too
+ new_cmap._rgba_over = self._rgba_over
+ new_cmap._rgba_under = self._rgba_under
+ new_cmap._rgba_bad = self._rgba_bad
+ return new_cmap
+
+ def reversed(self, name=None):
+ """
+ Return a reversed instance of the Colormap.
+
+ Parameters
+ ----------
+ name : str, optional
+ The name for the reversed colormap. If it's None the
+ name will be the name of the parent colormap + "_r".
+
+ Returns
+ -------
+ ListedColormap
+ A reversed instance of the colormap.
+ """
+ if name is None:
+ name = self.name + "_r"
+
+ colors_r = list(reversed(self.colors))
+ new_cmap = ListedColormap(colors_r, name=name, N=self.N)
+ # Reverse the over/under values too
+ new_cmap._rgba_over = self._rgba_under
+ new_cmap._rgba_under = self._rgba_over
+ new_cmap._rgba_bad = self._rgba_bad
+ return new_cmap
+
+
+class Normalize:
+ """
+ A class which, when called, linearly normalizes data into the
+ ``[0.0, 1.0]`` interval.
+ """
+
+ def __init__(self, vmin=None, vmax=None, clip=False):
+ """
+ Parameters
+ ----------
+ vmin, vmax : float or None
+ If *vmin* and/or *vmax* is not given, they are initialized from the
+ minimum and maximum value, respectively, of the first input
+ processed; i.e., ``__call__(A)`` calls ``autoscale_None(A)``.
+
+ clip : bool, default: False
+ If ``True`` values falling outside the range ``[vmin, vmax]``,
+ are mapped to 0 or 1, whichever is closer, and masked values are
+ set to 1. If ``False`` masked values remain masked.
+
+ Clipping silently defeats the purpose of setting the over, under,
+ and masked colors in a colormap, so it is likely to lead to
+ surprises; therefore the default is ``clip=False``.
+
+ Notes
+ -----
+ Returns 0 if ``vmin == vmax``.
+ """
+ self.vmin = _sanitize_extrema(vmin)
+ self.vmax = _sanitize_extrema(vmax)
+ self.clip = clip
+ self._scale = scale.LinearScale(axis=None)
+
+ @staticmethod
+ def process_value(value):
+ """
+ Homogenize the input *value* for easy and efficient normalization.
+
+ *value* can be a scalar or sequence.
+
+ Returns
+ -------
+ result : masked array
+ Masked array with the same shape as *value*.
+ is_scalar : bool
+ Whether *value* is a scalar.
+
+ Notes
+ -----
+ Float dtypes are preserved; integer types with two bytes or smaller are
+ converted to np.float32, and larger types are converted to np.float64.
+ Preserving float32 when possible, and using in-place operations,
+ greatly improves speed for large arrays.
+ """
+ is_scalar = not np.iterable(value)
+ if is_scalar:
+ value = [value]
+ dtype = np.min_scalar_type(value)
+ if np.issubdtype(dtype, np.integer) or dtype.type is np.bool_:
+ # bool_/int8/int16 -> float32; int32/int64 -> float64
+ dtype = np.promote_types(dtype, np.float32)
+ # ensure data passed in as an ndarray subclass are interpreted as
+ # an ndarray. See issue #6622.
+ mask = np.ma.getmask(value)
+ data = np.asarray(value)
+ result = np.ma.array(data, mask=mask, dtype=dtype, copy=True)
+ return result, is_scalar
+
+ def __call__(self, value, clip=None):
+ """
+ Normalize *value* data in the ``[vmin, vmax]`` interval into the
+ ``[0.0, 1.0]`` interval and return it.
+
+ Parameters
+ ----------
+ value
+ Data to normalize.
+ clip : bool
+ If ``None``, defaults to ``self.clip`` (which defaults to
+ ``False``).
+
+ Notes
+ -----
+ If not already initialized, ``self.vmin`` and ``self.vmax`` are
+ initialized using ``self.autoscale_None(value)``.
+ """
+ if clip is None:
+ clip = self.clip
+
+ result, is_scalar = self.process_value(value)
+
+ self.autoscale_None(result)
+ # Convert at least to float, without losing precision.
+ (vmin,), _ = self.process_value(self.vmin)
+ (vmax,), _ = self.process_value(self.vmax)
+ if vmin == vmax:
+ result.fill(0) # Or should it be all masked? Or 0.5?
+ elif vmin > vmax:
+ raise ValueError("minvalue must be less than or equal to maxvalue")
+ else:
+ if clip:
+ mask = np.ma.getmask(result)
+ result = np.ma.array(np.clip(result.filled(vmax), vmin, vmax),
+ mask=mask)
+ # ma division is very slow; we can take a shortcut
+ resdat = result.data
+ resdat -= vmin
+ resdat /= (vmax - vmin)
+ result = np.ma.array(resdat, mask=result.mask, copy=False)
+ if is_scalar:
+ result = result[0]
+ return result
+
+ def inverse(self, value):
+ if not self.scaled():
+ raise ValueError("Not invertible until both vmin and vmax are set")
+ (vmin,), _ = self.process_value(self.vmin)
+ (vmax,), _ = self.process_value(self.vmax)
+
+ if np.iterable(value):
+ val = np.ma.asarray(value)
+ return vmin + val * (vmax - vmin)
+ else:
+ return vmin + value * (vmax - vmin)
+
+ def autoscale(self, A):
+ """Set *vmin*, *vmax* to min, max of *A*."""
+ A = np.asanyarray(A)
+ self.vmin = A.min()
+ self.vmax = A.max()
+
+ def autoscale_None(self, A):
+ """If vmin or vmax are not set, use the min/max of *A* to set them."""
+ A = np.asanyarray(A)
+ if self.vmin is None and A.size:
+ self.vmin = A.min()
+ if self.vmax is None and A.size:
+ self.vmax = A.max()
+
+ def scaled(self):
+ """Return whether vmin and vmax are set."""
+ return self.vmin is not None and self.vmax is not None
+
+
+class TwoSlopeNorm(Normalize):
+ def __init__(self, vcenter, vmin=None, vmax=None):
+ """
+ Normalize data with a set center.
+
+ Useful when mapping data with an unequal rates of change around a
+ conceptual center, e.g., data that range from -2 to 4, with 0 as
+ the midpoint.
+
+ Parameters
+ ----------
+ vcenter : float
+ The data value that defines ``0.5`` in the normalization.
+ vmin : float, optional
+ The data value that defines ``0.0`` in the normalization.
+ Defaults to the min value of the dataset.
+ vmax : float, optional
+ The data value that defines ``1.0`` in the normalization.
+ Defaults to the the max value of the dataset.
+
+ Examples
+ --------
+ This maps data value -4000 to 0., 0 to 0.5, and +10000 to 1.0; data
+ between is linearly interpolated::
+
+ >>> import matplotlib.colors as mcolors
+ >>> offset = mcolors.TwoSlopeNorm(vmin=-4000.,
+ vcenter=0., vmax=10000)
+ >>> data = [-4000., -2000., 0., 2500., 5000., 7500., 10000.]
+ >>> offset(data)
+ array([0., 0.25, 0.5, 0.625, 0.75, 0.875, 1.0])
+ """
+
+ self.vcenter = vcenter
+ self.vmin = vmin
+ self.vmax = vmax
+ if vcenter is not None and vmax is not None and vcenter >= vmax:
+ raise ValueError('vmin, vcenter, and vmax must be in '
+ 'ascending order')
+ if vcenter is not None and vmin is not None and vcenter <= vmin:
+ raise ValueError('vmin, vcenter, and vmax must be in '
+ 'ascending order')
+
+ def autoscale_None(self, A):
+ """
+ Get vmin and vmax, and then clip at vcenter
+ """
+ super().autoscale_None(A)
+ if self.vmin > self.vcenter:
+ self.vmin = self.vcenter
+ if self.vmax < self.vcenter:
+ self.vmax = self.vcenter
+
+ def __call__(self, value, clip=None):
+ """
+ Map value to the interval [0, 1]. The clip argument is unused.
+ """
+ result, is_scalar = self.process_value(value)
+ self.autoscale_None(result) # sets self.vmin, self.vmax if None
+
+ if not self.vmin <= self.vcenter <= self.vmax:
+ raise ValueError("vmin, vcenter, vmax must increase monotonically")
+ result = np.ma.masked_array(
+ np.interp(result, [self.vmin, self.vcenter, self.vmax],
+ [0, 0.5, 1.]), mask=np.ma.getmask(result))
+ if is_scalar:
+ result = np.atleast_1d(result)[0]
+ return result
+
+
+class CenteredNorm(Normalize):
+ def __init__(self, vcenter=0, halfrange=None, clip=False):
+ """
+ Normalize symmetrical data around a center (0 by default).
+
+ Unlike `TwoSlopeNorm`, `CenteredNorm` applies an equal rate of change
+ around the center.
+
+ Useful when mapping symmetrical data around a conceptual center
+ e.g., data that range from -2 to 4, with 0 as the midpoint, and
+ with equal rates of change around that midpoint.
+
+ Parameters
+ ----------
+ vcenter : float, default: 0
+ The data value that defines ``0.5`` in the normalization.
+ halfrange : float, optional
+ The range of data values that defines a range of ``0.5`` in the
+ normalization, so that *vcenter* - *halfrange* is ``0.0`` and
+ *vcenter* + *halfrange* is ``1.0`` in the normalization.
+ Defaults to the largest absolute difference to *vcenter* for
+ the values in the dataset.
+
+ Examples
+ --------
+ This maps data values -2 to 0.25, 0 to 0.5, and 4 to 1.0
+ (assuming equal rates of change above and below 0.0):
+
+ >>> import matplotlib.colors as mcolors
+ >>> norm = mcolors.CenteredNorm(halfrange=4.0)
+ >>> data = [-2., 0., 4.]
+ >>> norm(data)
+ array([0.25, 0.5 , 1. ])
+ """
+ self._vcenter = vcenter
+ self.vmin = None
+ self.vmax = None
+ # calling the halfrange setter to set vmin and vmax
+ self.halfrange = halfrange
+ self.clip = clip
+
+ def _set_vmin_vmax(self):
+ """
+ Set *vmin* and *vmax* based on *vcenter* and *halfrange*.
+ """
+ self.vmax = self._vcenter + self._halfrange
+ self.vmin = self._vcenter - self._halfrange
+
+ def autoscale(self, A):
+ """
+ Set *halfrange* to ``max(abs(A-vcenter))``, then set *vmin* and *vmax*.
+ """
+ A = np.asanyarray(A)
+ self._halfrange = max(self._vcenter-A.min(),
+ A.max()-self._vcenter)
+ self._set_vmin_vmax()
+
+ def autoscale_None(self, A):
+ """Set *vmin* and *vmax*."""
+ A = np.asanyarray(A)
+ if self._halfrange is None and A.size:
+ self.autoscale(A)
+
+ @property
+ def vcenter(self):
+ return self._vcenter
+
+ @vcenter.setter
+ def vcenter(self, vcenter):
+ self._vcenter = vcenter
+ if self.vmax is not None:
+ # recompute halfrange assuming vmin and vmax represent
+ # min and max of data
+ self._halfrange = max(self._vcenter-self.vmin,
+ self.vmax-self._vcenter)
+ self._set_vmin_vmax()
+
+ @property
+ def halfrange(self):
+ return self._halfrange
+
+ @halfrange.setter
+ def halfrange(self, halfrange):
+ if halfrange is None:
+ self._halfrange = None
+ self.vmin = None
+ self.vmax = None
+ else:
+ self._halfrange = abs(halfrange)
+
+ def __call__(self, value, clip=None):
+ if self._halfrange is not None:
+ # enforce symmetry, reset vmin and vmax
+ self._set_vmin_vmax()
+ return super().__call__(value, clip=clip)
+
+
+def _make_norm_from_scale(scale_cls, base_norm_cls=None, *, init=None):
+ """
+ Decorator for building a `.Normalize` subclass from a `.Scale` subclass.
+
+ After ::
+
+ @_make_norm_from_scale(scale_cls)
+ class norm_cls(Normalize):
+ ...
+
+ *norm_cls* is filled with methods so that normalization computations are
+ forwarded to *scale_cls* (i.e., *scale_cls* is the scale that would be used
+ for the colorbar of a mappable normalized with *norm_cls*).
+
+ If *init* is not passed, then the constructor signature of *norm_cls*
+ will be ``norm_cls(vmin=None, vmax=None, clip=False)``; these three
+ parameters will be forwarded to the base class (``Normalize.__init__``),
+ and a *scale_cls* object will be initialized with no arguments (other than
+ a dummy axis).
+
+ If the *scale_cls* constructor takes additional parameters, then *init*
+ should be passed to `_make_norm_from_scale`. It is a callable which is
+ *only* used for its signature. First, this signature will become the
+ signature of *norm_cls*. Second, the *norm_cls* constructor will bind the
+ parameters passed to it using this signature, extract the bound *vmin*,
+ *vmax*, and *clip* values, pass those to ``Normalize.__init__``, and
+ forward the remaining bound values (including any defaults defined by the
+ signature) to the *scale_cls* constructor.
+ """
+
+ if base_norm_cls is None:
+ return functools.partial(_make_norm_from_scale, scale_cls, init=init)
+
+ if init is None:
+ def init(vmin=None, vmax=None, clip=False): pass
+ bound_init_signature = inspect.signature(init)
+
+ class Norm(base_norm_cls):
+
+ def __init__(self, *args, **kwargs):
+ ba = bound_init_signature.bind(*args, **kwargs)
+ ba.apply_defaults()
+ super().__init__(
+ **{k: ba.arguments.pop(k) for k in ["vmin", "vmax", "clip"]})
+ self._scale = scale_cls(axis=None, **ba.arguments)
+ self._trf = self._scale.get_transform()
+
+ def __call__(self, value, clip=None):
+ value, is_scalar = self.process_value(value)
+ self.autoscale_None(value)
+ if self.vmin > self.vmax:
+ raise ValueError("vmin must be less or equal to vmax")
+ if self.vmin == self.vmax:
+ return np.full_like(value, 0)
+ if clip is None:
+ clip = self.clip
+ if clip:
+ value = np.clip(value, self.vmin, self.vmax)
+ t_value = self._trf.transform(value).reshape(np.shape(value))
+ t_vmin, t_vmax = self._trf.transform([self.vmin, self.vmax])
+ if not np.isfinite([t_vmin, t_vmax]).all():
+ raise ValueError("Invalid vmin or vmax")
+ t_value -= t_vmin
+ t_value /= (t_vmax - t_vmin)
+ t_value = np.ma.masked_invalid(t_value, copy=False)
+ return t_value[0] if is_scalar else t_value
+
+ def inverse(self, value):
+ if not self.scaled():
+ raise ValueError("Not invertible until scaled")
+ if self.vmin > self.vmax:
+ raise ValueError("vmin must be less or equal to vmax")
+ t_vmin, t_vmax = self._trf.transform([self.vmin, self.vmax])
+ if not np.isfinite([t_vmin, t_vmax]).all():
+ raise ValueError("Invalid vmin or vmax")
+ value, is_scalar = self.process_value(value)
+ rescaled = value * (t_vmax - t_vmin)
+ rescaled += t_vmin
+ value = (self._trf
+ .inverted()
+ .transform(rescaled)
+ .reshape(np.shape(value)))
+ return value[0] if is_scalar else value
+
+ Norm.__name__ = base_norm_cls.__name__
+ Norm.__qualname__ = base_norm_cls.__qualname__
+ Norm.__module__ = base_norm_cls.__module__
+ Norm.__init__.__signature__ = bound_init_signature.replace(parameters=[
+ inspect.Parameter("self", inspect.Parameter.POSITIONAL_OR_KEYWORD),
+ *bound_init_signature.parameters.values()])
+ return Norm
+
+
+@_make_norm_from_scale(
+ scale.FuncScale,
+ init=lambda functions, vmin=None, vmax=None, clip=False: None)
+class FuncNorm(Normalize):
+ """
+ Arbitrary normalization using functions for the forward and inverse.
+
+ Parameters
+ ----------
+ functions : (callable, callable)
+ two-tuple of the forward and inverse functions for the normalization.
+ The forward function must be monotonic.
+
+ Both functions must have the signature ::
+
+ def forward(values: array-like) -> array-like
+
+ vmin, vmax : float or None
+ If *vmin* and/or *vmax* is not given, they are initialized from the
+ minimum and maximum value, respectively, of the first input
+ processed; i.e., ``__call__(A)`` calls ``autoscale_None(A)``.
+
+ clip : bool, default: False
+ If ``True`` values falling outside the range ``[vmin, vmax]``,
+ are mapped to 0 or 1, whichever is closer, and masked values are
+ set to 1. If ``False`` masked values remain masked.
+
+ Clipping silently defeats the purpose of setting the over, under,
+ and masked colors in a colormap, so it is likely to lead to
+ surprises; therefore the default is ``clip=False``.
+ """
+
+
+@_make_norm_from_scale(functools.partial(scale.LogScale, nonpositive="mask"))
+class LogNorm(Normalize):
+ """Normalize a given value to the 0-1 range on a log scale."""
+
+ def autoscale(self, A):
+ # docstring inherited.
+ super().autoscale(np.ma.masked_less_equal(A, 0, copy=False))
+
+ def autoscale_None(self, A):
+ # docstring inherited.
+ super().autoscale_None(np.ma.masked_less_equal(A, 0, copy=False))
+
+
+@_make_norm_from_scale(
+ scale.SymmetricalLogScale,
+ init=lambda linthresh, linscale=1., vmin=None, vmax=None, clip=False, *,
+ base=10: None)
+class SymLogNorm(Normalize):
+ """
+ The symmetrical logarithmic scale is logarithmic in both the
+ positive and negative directions from the origin.
+
+ Since the values close to zero tend toward infinity, there is a
+ need to have a range around zero that is linear. The parameter
+ *linthresh* allows the user to specify the size of this range
+ (-*linthresh*, *linthresh*).
+
+ Parameters
+ ----------
+ linthresh : float
+ The range within which the plot is linear (to avoid having the plot
+ go to infinity around zero).
+ linscale : float, default: 1
+ This allows the linear range (-*linthresh* to *linthresh*) to be
+ stretched relative to the logarithmic range. Its value is the
+ number of decades to use for each half of the linear range. For
+ example, when *linscale* == 1.0 (the default), the space used for
+ the positive and negative halves of the linear range will be equal
+ to one decade in the logarithmic range.
+ base : float, default: 10
+ """
+
+ @property
+ def linthresh(self):
+ return self._scale.linthresh
+
+ @linthresh.setter
+ def linthresh(self, value):
+ self._scale.linthresh = value
+
+
+class PowerNorm(Normalize):
+ """
+ Linearly map a given value to the 0-1 range and then apply
+ a power-law normalization over that range.
+ """
+ def __init__(self, gamma, vmin=None, vmax=None, clip=False):
+ super().__init__(vmin, vmax, clip)
+ self.gamma = gamma
+
+ def __call__(self, value, clip=None):
+ if clip is None:
+ clip = self.clip
+
+ result, is_scalar = self.process_value(value)
+
+ self.autoscale_None(result)
+ gamma = self.gamma
+ vmin, vmax = self.vmin, self.vmax
+ if vmin > vmax:
+ raise ValueError("minvalue must be less than or equal to maxvalue")
+ elif vmin == vmax:
+ result.fill(0)
+ else:
+ if clip:
+ mask = np.ma.getmask(result)
+ result = np.ma.array(np.clip(result.filled(vmax), vmin, vmax),
+ mask=mask)
+ resdat = result.data
+ resdat -= vmin
+ resdat[resdat < 0] = 0
+ np.power(resdat, gamma, resdat)
+ resdat /= (vmax - vmin) ** gamma
+
+ result = np.ma.array(resdat, mask=result.mask, copy=False)
+ if is_scalar:
+ result = result[0]
+ return result
+
+ def inverse(self, value):
+ if not self.scaled():
+ raise ValueError("Not invertible until scaled")
+ gamma = self.gamma
+ vmin, vmax = self.vmin, self.vmax
+
+ if np.iterable(value):
+ val = np.ma.asarray(value)
+ return np.ma.power(val, 1. / gamma) * (vmax - vmin) + vmin
+ else:
+ return pow(value, 1. / gamma) * (vmax - vmin) + vmin
+
+
+class BoundaryNorm(Normalize):
+ """
+ Generate a colormap index based on discrete intervals.
+
+ Unlike `Normalize` or `LogNorm`, `BoundaryNorm` maps values to integers
+ instead of to the interval 0-1.
+
+ Mapping to the 0-1 interval could have been done via piece-wise linear
+ interpolation, but using integers seems simpler, and reduces the number of
+ conversions back and forth between integer and floating point.
+ """
+ def __init__(self, boundaries, ncolors, clip=False, *, extend='neither'):
+ """
+ Parameters
+ ----------
+ boundaries : array-like
+ Monotonically increasing sequence of at least 2 boundaries.
+ ncolors : int
+ Number of colors in the colormap to be used.
+ clip : bool, optional
+ If clip is ``True``, out of range values are mapped to 0 if they
+ are below ``boundaries[0]`` or mapped to ``ncolors - 1`` if they
+ are above ``boundaries[-1]``.
+
+ If clip is ``False``, out of range values are mapped to -1 if
+ they are below ``boundaries[0]`` or mapped to *ncolors* if they are
+ above ``boundaries[-1]``. These are then converted to valid indices
+ by `Colormap.__call__`.
+ extend : {'neither', 'both', 'min', 'max'}, default: 'neither'
+ Extend the number of bins to include one or both of the
+ regions beyond the boundaries. For example, if ``extend``
+ is 'min', then the color to which the region between the first
+ pair of boundaries is mapped will be distinct from the first
+ color in the colormap, and by default a
+ `~matplotlib.colorbar.Colorbar` will be drawn with
+ the triangle extension on the left or lower end.
+
+ Returns
+ -------
+ int16 scalar or array
+
+ Notes
+ -----
+ *boundaries* defines the edges of bins, and data falling within a bin
+ is mapped to the color with the same index.
+
+ If the number of bins, including any extensions, is less than
+ *ncolors*, the color index is chosen by linear interpolation, mapping
+ the ``[0, nbins - 1]`` range onto the ``[0, ncolors - 1]`` range.
+ """
+ if clip and extend != 'neither':
+ raise ValueError("'clip=True' is not compatible with 'extend'")
+ self.clip = clip
+ self.vmin = boundaries[0]
+ self.vmax = boundaries[-1]
+ self.boundaries = np.asarray(boundaries)
+ self.N = len(self.boundaries)
+ if self.N < 2:
+ raise ValueError("You must provide at least 2 boundaries "
+ f"(1 region) but you passed in {boundaries!r}")
+ self.Ncmap = ncolors
+ self.extend = extend
+
+ self._scale = None # don't use the default scale.
+
+ self._n_regions = self.N - 1 # number of colors needed
+ self._offset = 0
+ if extend in ('min', 'both'):
+ self._n_regions += 1
+ self._offset = 1
+ if extend in ('max', 'both'):
+ self._n_regions += 1
+ if self._n_regions > self.Ncmap:
+ raise ValueError(f"There are {self._n_regions} color bins "
+ "including extensions, but ncolors = "
+ f"{ncolors}; ncolors must equal or exceed the "
+ "number of bins")
+
+ def __call__(self, value, clip=None):
+ if clip is None:
+ clip = self.clip
+
+ xx, is_scalar = self.process_value(value)
+ mask = np.ma.getmaskarray(xx)
+ # Fill masked values a value above the upper boundary
+ xx = np.atleast_1d(xx.filled(self.vmax + 1))
+ if clip:
+ np.clip(xx, self.vmin, self.vmax, out=xx)
+ max_col = self.Ncmap - 1
+ else:
+ max_col = self.Ncmap
+ # this gives us the bins in the lookup table in the range
+ # [0, _n_regions - 1] (the offset is baked in in the init)
+ iret = np.digitize(xx, self.boundaries) - 1 + self._offset
+ # if we have more colors than regions, stretch the region
+ # index computed above to full range of the color bins. This
+ # will make use of the full range (but skip some of the colors
+ # in the middle) such that the first region is mapped to the
+ # first color and the last region is mapped to the last color.
+ if self.Ncmap > self._n_regions:
+ if self._n_regions == 1:
+ # special case the 1 region case, pick the middle color
+ iret[iret == 0] = (self.Ncmap - 1) // 2
+ else:
+ # otherwise linearly remap the values from the region index
+ # to the color index spaces
+ iret = (self.Ncmap - 1) / (self._n_regions - 1) * iret
+ # cast to 16bit integers in all cases
+ iret = iret.astype(np.int16)
+ iret[xx < self.vmin] = -1
+ iret[xx >= self.vmax] = max_col
+ ret = np.ma.array(iret, mask=mask)
+ if is_scalar:
+ ret = int(ret[0]) # assume python scalar
+ return ret
+
+ def inverse(self, value):
+ """
+ Raises
+ ------
+ ValueError
+ BoundaryNorm is not invertible, so calling this method will always
+ raise an error
+ """
+ raise ValueError("BoundaryNorm is not invertible")
+
+
+class NoNorm(Normalize):
+ """
+ Dummy replacement for `Normalize`, for the case where we want to use
+ indices directly in a `~matplotlib.cm.ScalarMappable`.
+ """
+ def __call__(self, value, clip=None):
+ return value
+
+ def inverse(self, value):
+ return value
+
+
+def rgb_to_hsv(arr):
+ """
+ Convert float rgb values (in the range [0, 1]), in a numpy array to hsv
+ values.
+
+ Parameters
+ ----------
+ arr : (..., 3) array-like
+ All values must be in the range [0, 1]
+
+ Returns
+ -------
+ (..., 3) ndarray
+ Colors converted to hsv values in range [0, 1]
+ """
+ arr = np.asarray(arr)
+
+ # check length of the last dimension, should be _some_ sort of rgb
+ if arr.shape[-1] != 3:
+ raise ValueError("Last dimension of input array must be 3; "
+ "shape {} was found.".format(arr.shape))
+
+ in_shape = arr.shape
+ arr = np.array(
+ arr, copy=False,
+ dtype=np.promote_types(arr.dtype, np.float32), # Don't work on ints.
+ ndmin=2, # In case input was 1D.
+ )
+ out = np.zeros_like(arr)
+ arr_max = arr.max(-1)
+ ipos = arr_max > 0
+ delta = arr.ptp(-1)
+ s = np.zeros_like(delta)
+ s[ipos] = delta[ipos] / arr_max[ipos]
+ ipos = delta > 0
+ # red is max
+ idx = (arr[..., 0] == arr_max) & ipos
+ out[idx, 0] = (arr[idx, 1] - arr[idx, 2]) / delta[idx]
+ # green is max
+ idx = (arr[..., 1] == arr_max) & ipos
+ out[idx, 0] = 2. + (arr[idx, 2] - arr[idx, 0]) / delta[idx]
+ # blue is max
+ idx = (arr[..., 2] == arr_max) & ipos
+ out[idx, 0] = 4. + (arr[idx, 0] - arr[idx, 1]) / delta[idx]
+
+ out[..., 0] = (out[..., 0] / 6.0) % 1.0
+ out[..., 1] = s
+ out[..., 2] = arr_max
+
+ return out.reshape(in_shape)
+
+
+def hsv_to_rgb(hsv):
+ """
+ Convert hsv values to rgb.
+
+ Parameters
+ ----------
+ hsv : (..., 3) array-like
+ All values assumed to be in range [0, 1]
+
+ Returns
+ -------
+ (..., 3) ndarray
+ Colors converted to RGB values in range [0, 1]
+ """
+ hsv = np.asarray(hsv)
+
+ # check length of the last dimension, should be _some_ sort of rgb
+ if hsv.shape[-1] != 3:
+ raise ValueError("Last dimension of input array must be 3; "
+ "shape {shp} was found.".format(shp=hsv.shape))
+
+ in_shape = hsv.shape
+ hsv = np.array(
+ hsv, copy=False,
+ dtype=np.promote_types(hsv.dtype, np.float32), # Don't work on ints.
+ ndmin=2, # In case input was 1D.
+ )
+
+ h = hsv[..., 0]
+ s = hsv[..., 1]
+ v = hsv[..., 2]
+
+ r = np.empty_like(h)
+ g = np.empty_like(h)
+ b = np.empty_like(h)
+
+ i = (h * 6.0).astype(int)
+ f = (h * 6.0) - i
+ p = v * (1.0 - s)
+ q = v * (1.0 - s * f)
+ t = v * (1.0 - s * (1.0 - f))
+
+ idx = i % 6 == 0
+ r[idx] = v[idx]
+ g[idx] = t[idx]
+ b[idx] = p[idx]
+
+ idx = i == 1
+ r[idx] = q[idx]
+ g[idx] = v[idx]
+ b[idx] = p[idx]
+
+ idx = i == 2
+ r[idx] = p[idx]
+ g[idx] = v[idx]
+ b[idx] = t[idx]
+
+ idx = i == 3
+ r[idx] = p[idx]
+ g[idx] = q[idx]
+ b[idx] = v[idx]
+
+ idx = i == 4
+ r[idx] = t[idx]
+ g[idx] = p[idx]
+ b[idx] = v[idx]
+
+ idx = i == 5
+ r[idx] = v[idx]
+ g[idx] = p[idx]
+ b[idx] = q[idx]
+
+ idx = s == 0
+ r[idx] = v[idx]
+ g[idx] = v[idx]
+ b[idx] = v[idx]
+
+ rgb = np.stack([r, g, b], axis=-1)
+
+ return rgb.reshape(in_shape)
+
+
+def _vector_magnitude(arr):
+ # things that don't work here:
+ # * np.linalg.norm: drops mask from ma.array
+ # * np.sum: drops mask from ma.array unless entire vector is masked
+ sum_sq = 0
+ for i in range(arr.shape[-1]):
+ sum_sq += arr[..., i, np.newaxis] ** 2
+ return np.sqrt(sum_sq)
+
+
+class LightSource:
+ """
+ Create a light source coming from the specified azimuth and elevation.
+ Angles are in degrees, with the azimuth measured
+ clockwise from north and elevation up from the zero plane of the surface.
+
+ `shade` is used to produce "shaded" rgb values for a data array.
+ `shade_rgb` can be used to combine an rgb image with an elevation map.
+ `hillshade` produces an illumination map of a surface.
+ """
+
+ def __init__(self, azdeg=315, altdeg=45, hsv_min_val=0, hsv_max_val=1,
+ hsv_min_sat=1, hsv_max_sat=0):
+ """
+ Specify the azimuth (measured clockwise from south) and altitude
+ (measured up from the plane of the surface) of the light source
+ in degrees.
+
+ Parameters
+ ----------
+ azdeg : float, default: 315 degrees (from the northwest)
+ The azimuth (0-360, degrees clockwise from North) of the light
+ source.
+ altdeg : float, default: 45 degrees
+ The altitude (0-90, degrees up from horizontal) of the light
+ source.
+
+ Notes
+ -----
+ For backwards compatibility, the parameters *hsv_min_val*,
+ *hsv_max_val*, *hsv_min_sat*, and *hsv_max_sat* may be supplied at
+ initialization as well. However, these parameters will only be used if
+ "blend_mode='hsv'" is passed into `shade` or `shade_rgb`.
+ See the documentation for `blend_hsv` for more details.
+ """
+ self.azdeg = azdeg
+ self.altdeg = altdeg
+ self.hsv_min_val = hsv_min_val
+ self.hsv_max_val = hsv_max_val
+ self.hsv_min_sat = hsv_min_sat
+ self.hsv_max_sat = hsv_max_sat
+
+ @property
+ def direction(self):
+ """The unit vector direction towards the light source."""
+ # Azimuth is in degrees clockwise from North. Convert to radians
+ # counterclockwise from East (mathematical notation).
+ az = np.radians(90 - self.azdeg)
+ alt = np.radians(self.altdeg)
+ return np.array([
+ np.cos(az) * np.cos(alt),
+ np.sin(az) * np.cos(alt),
+ np.sin(alt)
+ ])
+
+ def hillshade(self, elevation, vert_exag=1, dx=1, dy=1, fraction=1.):
+ """
+ Calculate the illumination intensity for a surface using the defined
+ azimuth and elevation for the light source.
+
+ This computes the normal vectors for the surface, and then passes them
+ on to `shade_normals`
+
+ Parameters
+ ----------
+ elevation : 2D array-like
+ The height values used to generate an illumination map
+ vert_exag : number, optional
+ The amount to exaggerate the elevation values by when calculating
+ illumination. This can be used either to correct for differences in
+ units between the x-y coordinate system and the elevation
+ coordinate system (e.g. decimal degrees vs. meters) or to
+ exaggerate or de-emphasize topographic effects.
+ dx : number, optional
+ The x-spacing (columns) of the input *elevation* grid.
+ dy : number, optional
+ The y-spacing (rows) of the input *elevation* grid.
+ fraction : number, optional
+ Increases or decreases the contrast of the hillshade. Values
+ greater than one will cause intermediate values to move closer to
+ full illumination or shadow (and clipping any values that move
+ beyond 0 or 1). Note that this is not visually or mathematically
+ the same as vertical exaggeration.
+
+ Returns
+ -------
+ ndarray
+ A 2D array of illumination values between 0-1, where 0 is
+ completely in shadow and 1 is completely illuminated.
+ """
+
+ # Because most image and raster GIS data has the first row in the array
+ # as the "top" of the image, dy is implicitly negative. This is
+ # consistent to what `imshow` assumes, as well.
+ dy = -dy
+
+ # compute the normal vectors from the partial derivatives
+ e_dy, e_dx = np.gradient(vert_exag * elevation, dy, dx)
+
+ # .view is to keep subclasses
+ normal = np.empty(elevation.shape + (3,)).view(type(elevation))
+ normal[..., 0] = -e_dx
+ normal[..., 1] = -e_dy
+ normal[..., 2] = 1
+ normal /= _vector_magnitude(normal)
+
+ return self.shade_normals(normal, fraction)
+
+ def shade_normals(self, normals, fraction=1.):
+ """
+ Calculate the illumination intensity for the normal vectors of a
+ surface using the defined azimuth and elevation for the light source.
+
+ Imagine an artificial sun placed at infinity in some azimuth and
+ elevation position illuminating our surface. The parts of the surface
+ that slope toward the sun should brighten while those sides facing away
+ should become darker.
+
+ Parameters
+ ----------
+ fraction : number, optional
+ Increases or decreases the contrast of the hillshade. Values
+ greater than one will cause intermediate values to move closer to
+ full illumination or shadow (and clipping any values that move
+ beyond 0 or 1). Note that this is not visually or mathematically
+ the same as vertical exaggeration.
+
+ Returns
+ -------
+ ndarray
+ A 2D array of illumination values between 0-1, where 0 is
+ completely in shadow and 1 is completely illuminated.
+ """
+
+ intensity = normals.dot(self.direction)
+
+ # Apply contrast stretch
+ imin, imax = intensity.min(), intensity.max()
+ intensity *= fraction
+
+ # Rescale to 0-1, keeping range before contrast stretch
+ # If constant slope, keep relative scaling (i.e. flat should be 0.5,
+ # fully occluded 0, etc.)
+ if (imax - imin) > 1e-6:
+ # Strictly speaking, this is incorrect. Negative values should be
+ # clipped to 0 because they're fully occluded. However, rescaling
+ # in this manner is consistent with the previous implementation and
+ # visually appears better than a "hard" clip.
+ intensity -= imin
+ intensity /= (imax - imin)
+ intensity = np.clip(intensity, 0, 1)
+
+ return intensity
+
+ def shade(self, data, cmap, norm=None, blend_mode='overlay', vmin=None,
+ vmax=None, vert_exag=1, dx=1, dy=1, fraction=1, **kwargs):
+ """
+ Combine colormapped data values with an illumination intensity map
+ (a.k.a. "hillshade") of the values.
+
+ Parameters
+ ----------
+ data : 2D array-like
+ The height values used to generate a shaded map.
+ cmap : `~matplotlib.colors.Colormap`
+ The colormap used to color the *data* array. Note that this must be
+ a `~matplotlib.colors.Colormap` instance. For example, rather than
+ passing in ``cmap='gist_earth'``, use
+ ``cmap=plt.get_cmap('gist_earth')`` instead.
+ norm : `~matplotlib.colors.Normalize` instance, optional
+ The normalization used to scale values before colormapping. If
+ None, the input will be linearly scaled between its min and max.
+ blend_mode : {'hsv', 'overlay', 'soft'} or callable, optional
+ The type of blending used to combine the colormapped data
+ values with the illumination intensity. Default is
+ "overlay". Note that for most topographic surfaces,
+ "overlay" or "soft" appear more visually realistic. If a
+ user-defined function is supplied, it is expected to
+ combine an MxNx3 RGB array of floats (ranging 0 to 1) with
+ an MxNx1 hillshade array (also 0 to 1). (Call signature
+ ``func(rgb, illum, **kwargs)``) Additional kwargs supplied
+ to this function will be passed on to the *blend_mode*
+ function.
+ vmin : float or None, optional
+ The minimum value used in colormapping *data*. If *None* the
+ minimum value in *data* is used. If *norm* is specified, then this
+ argument will be ignored.
+ vmax : float or None, optional
+ The maximum value used in colormapping *data*. If *None* the
+ maximum value in *data* is used. If *norm* is specified, then this
+ argument will be ignored.
+ vert_exag : number, optional
+ The amount to exaggerate the elevation values by when calculating
+ illumination. This can be used either to correct for differences in
+ units between the x-y coordinate system and the elevation
+ coordinate system (e.g. decimal degrees vs. meters) or to
+ exaggerate or de-emphasize topography.
+ dx : number, optional
+ The x-spacing (columns) of the input *elevation* grid.
+ dy : number, optional
+ The y-spacing (rows) of the input *elevation* grid.
+ fraction : number, optional
+ Increases or decreases the contrast of the hillshade. Values
+ greater than one will cause intermediate values to move closer to
+ full illumination or shadow (and clipping any values that move
+ beyond 0 or 1). Note that this is not visually or mathematically
+ the same as vertical exaggeration.
+ Additional kwargs are passed on to the *blend_mode* function.
+
+ Returns
+ -------
+ ndarray
+ An MxNx4 array of floats ranging between 0-1.
+ """
+ if vmin is None:
+ vmin = data.min()
+ if vmax is None:
+ vmax = data.max()
+ if norm is None:
+ norm = Normalize(vmin=vmin, vmax=vmax)
+
+ rgb0 = cmap(norm(data))
+ rgb1 = self.shade_rgb(rgb0, elevation=data, blend_mode=blend_mode,
+ vert_exag=vert_exag, dx=dx, dy=dy,
+ fraction=fraction, **kwargs)
+ # Don't overwrite the alpha channel, if present.
+ rgb0[..., :3] = rgb1[..., :3]
+ return rgb0
+
+ def shade_rgb(self, rgb, elevation, fraction=1., blend_mode='hsv',
+ vert_exag=1, dx=1, dy=1, **kwargs):
+ """
+ Use this light source to adjust the colors of the *rgb* input array to
+ give the impression of a shaded relief map with the given *elevation*.
+
+ Parameters
+ ----------
+ rgb : array-like
+ An (M, N, 3) RGB array, assumed to be in the range of 0 to 1.
+ elevation : array-like
+ An (M, N) array of the height values used to generate a shaded map.
+ fraction : number
+ Increases or decreases the contrast of the hillshade. Values
+ greater than one will cause intermediate values to move closer to
+ full illumination or shadow (and clipping any values that move
+ beyond 0 or 1). Note that this is not visually or mathematically
+ the same as vertical exaggeration.
+ blend_mode : {'hsv', 'overlay', 'soft'} or callable, optional
+ The type of blending used to combine the colormapped data values
+ with the illumination intensity. For backwards compatibility, this
+ defaults to "hsv". Note that for most topographic surfaces,
+ "overlay" or "soft" appear more visually realistic. If a
+ user-defined function is supplied, it is expected to combine an
+ MxNx3 RGB array of floats (ranging 0 to 1) with an MxNx1 hillshade
+ array (also 0 to 1). (Call signature
+ ``func(rgb, illum, **kwargs)``)
+ Additional kwargs supplied to this function will be passed on to
+ the *blend_mode* function.
+ vert_exag : number, optional
+ The amount to exaggerate the elevation values by when calculating
+ illumination. This can be used either to correct for differences in
+ units between the x-y coordinate system and the elevation
+ coordinate system (e.g. decimal degrees vs. meters) or to
+ exaggerate or de-emphasize topography.
+ dx : number, optional
+ The x-spacing (columns) of the input *elevation* grid.
+ dy : number, optional
+ The y-spacing (rows) of the input *elevation* grid.
+ Additional kwargs are passed on to the *blend_mode* function.
+
+ Returns
+ -------
+ ndarray
+ An (m, n, 3) array of floats ranging between 0-1.
+ """
+ # Calculate the "hillshade" intensity.
+ intensity = self.hillshade(elevation, vert_exag, dx, dy, fraction)
+ intensity = intensity[..., np.newaxis]
+
+ # Blend the hillshade and rgb data using the specified mode
+ lookup = {
+ 'hsv': self.blend_hsv,
+ 'soft': self.blend_soft_light,
+ 'overlay': self.blend_overlay,
+ }
+ if blend_mode in lookup:
+ blend = lookup[blend_mode](rgb, intensity, **kwargs)
+ else:
+ try:
+ blend = blend_mode(rgb, intensity, **kwargs)
+ except TypeError as err:
+ raise ValueError('"blend_mode" must be callable or one of {}'
+ .format(lookup.keys)) from err
+
+ # Only apply result where hillshade intensity isn't masked
+ if np.ma.is_masked(intensity):
+ mask = intensity.mask[..., 0]
+ for i in range(3):
+ blend[..., i][mask] = rgb[..., i][mask]
+
+ return blend
+
+ def blend_hsv(self, rgb, intensity, hsv_max_sat=None, hsv_max_val=None,
+ hsv_min_val=None, hsv_min_sat=None):
+ """
+ Take the input data array, convert to HSV values in the given colormap,
+ then adjust those color values to give the impression of a shaded
+ relief map with a specified light source. RGBA values are returned,
+ which can then be used to plot the shaded image with imshow.
+
+ The color of the resulting image will be darkened by moving the (s, v)
+ values (in hsv colorspace) toward (hsv_min_sat, hsv_min_val) in the
+ shaded regions, or lightened by sliding (s, v) toward (hsv_max_sat,
+ hsv_max_val) in regions that are illuminated. The default extremes are
+ chose so that completely shaded points are nearly black (s = 1, v = 0)
+ and completely illuminated points are nearly white (s = 0, v = 1).
+
+ Parameters
+ ----------
+ rgb : ndarray
+ An MxNx3 RGB array of floats ranging from 0 to 1 (color image).
+ intensity : ndarray
+ An MxNx1 array of floats ranging from 0 to 1 (grayscale image).
+ hsv_max_sat : number, default: 1
+ The maximum saturation value that the *intensity* map can shift the
+ output image to.
+ hsv_min_sat : number, optional
+ The minimum saturation value that the *intensity* map can shift the
+ output image to. Defaults to 0.
+ hsv_max_val : number, optional
+ The maximum value ("v" in "hsv") that the *intensity* map can shift
+ the output image to. Defaults to 1.
+ hsv_min_val : number, optional
+ The minimum value ("v" in "hsv") that the *intensity* map can shift
+ the output image to. Defaults to 0.
+
+ Returns
+ -------
+ ndarray
+ An MxNx3 RGB array representing the combined images.
+ """
+ # Backward compatibility...
+ if hsv_max_sat is None:
+ hsv_max_sat = self.hsv_max_sat
+ if hsv_max_val is None:
+ hsv_max_val = self.hsv_max_val
+ if hsv_min_sat is None:
+ hsv_min_sat = self.hsv_min_sat
+ if hsv_min_val is None:
+ hsv_min_val = self.hsv_min_val
+
+ # Expects a 2D intensity array scaled between -1 to 1...
+ intensity = intensity[..., 0]
+ intensity = 2 * intensity - 1
+
+ # Convert to rgb, then rgb to hsv
+ hsv = rgb_to_hsv(rgb[:, :, 0:3])
+ hue, sat, val = np.moveaxis(hsv, -1, 0)
+
+ # Modify hsv values (in place) to simulate illumination.
+ # putmask(A, mask, B) <=> A[mask] = B[mask]
+ np.putmask(sat, (np.abs(sat) > 1.e-10) & (intensity > 0),
+ (1 - intensity) * sat + intensity * hsv_max_sat)
+ np.putmask(sat, (np.abs(sat) > 1.e-10) & (intensity < 0),
+ (1 + intensity) * sat - intensity * hsv_min_sat)
+ np.putmask(val, intensity > 0,
+ (1 - intensity) * val + intensity * hsv_max_val)
+ np.putmask(val, intensity < 0,
+ (1 + intensity) * val - intensity * hsv_min_val)
+ np.clip(hsv[:, :, 1:], 0, 1, out=hsv[:, :, 1:])
+
+ # Convert modified hsv back to rgb.
+ return hsv_to_rgb(hsv)
+
+ def blend_soft_light(self, rgb, intensity):
+ """
+ Combine an rgb image with an intensity map using "soft light" blending,
+ using the "pegtop" formula.
+
+ Parameters
+ ----------
+ rgb : ndarray
+ An MxNx3 RGB array of floats ranging from 0 to 1 (color image).
+ intensity : ndarray
+ An MxNx1 array of floats ranging from 0 to 1 (grayscale image).
+
+ Returns
+ -------
+ ndarray
+ An MxNx3 RGB array representing the combined images.
+ """
+ return 2 * intensity * rgb + (1 - 2 * intensity) * rgb**2
+
+ def blend_overlay(self, rgb, intensity):
+ """
+ Combines an rgb image with an intensity map using "overlay" blending.
+
+ Parameters
+ ----------
+ rgb : ndarray
+ An MxNx3 RGB array of floats ranging from 0 to 1 (color image).
+ intensity : ndarray
+ An MxNx1 array of floats ranging from 0 to 1 (grayscale image).
+
+ Returns
+ -------
+ ndarray
+ An MxNx3 RGB array representing the combined images.
+ """
+ low = 2 * intensity * rgb
+ high = 1 - 2 * (1 - intensity) * (1 - rgb)
+ return np.where(rgb <= 0.5, low, high)
+
+
+def from_levels_and_colors(levels, colors, extend='neither'):
+ """
+ A helper routine to generate a cmap and a norm instance which
+ behave similar to contourf's levels and colors arguments.
+
+ Parameters
+ ----------
+ levels : sequence of numbers
+ The quantization levels used to construct the `BoundaryNorm`.
+ Value ``v`` is quantized to level ``i`` if ``lev[i] <= v < lev[i+1]``.
+ colors : sequence of colors
+ The fill color to use for each level. If *extend* is "neither" there
+ must be ``n_level - 1`` colors. For an *extend* of "min" or "max" add
+ one extra color, and for an *extend* of "both" add two colors.
+ extend : {'neither', 'min', 'max', 'both'}, optional
+ The behaviour when a value falls out of range of the given levels.
+ See `~.Axes.contourf` for details.
+
+ Returns
+ -------
+ cmap : `~matplotlib.colors.Normalize`
+ norm : `~matplotlib.colors.Colormap`
+ """
+ slice_map = {
+ 'both': slice(1, -1),
+ 'min': slice(1, None),
+ 'max': slice(0, -1),
+ 'neither': slice(0, None),
+ }
+ _api.check_in_list(slice_map, extend=extend)
+ color_slice = slice_map[extend]
+
+ n_data_colors = len(levels) - 1
+ n_expected = n_data_colors + color_slice.start - (color_slice.stop or 0)
+ if len(colors) != n_expected:
+ raise ValueError(
+ f'With extend == {extend!r} and {len(levels)} levels, '
+ f'expected {n_expected} colors, but got {len(colors)}')
+
+ cmap = ListedColormap(colors[color_slice], N=n_data_colors)
+
+ if extend in ['min', 'both']:
+ cmap.set_under(colors[0])
+ else:
+ cmap.set_under('none')
+
+ if extend in ['max', 'both']:
+ cmap.set_over(colors[-1])
+ else:
+ cmap.set_over('none')
+
+ cmap.colorbar_extend = extend
+
+ norm = BoundaryNorm(levels, ncolors=n_data_colors)
+ return cmap, norm
diff --git a/venv/Lib/site-packages/matplotlib/compat/__init__.py b/venv/Lib/site-packages/matplotlib/compat/__init__.py
new file mode 100644
index 0000000..1d38201
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/compat/__init__.py
@@ -0,0 +1,4 @@
+from matplotlib import _api
+
+
+_api.warn_deprecated("3.3", name=__name__, obj_type="module")
diff --git a/venv/Lib/site-packages/matplotlib/container.py b/venv/Lib/site-packages/matplotlib/container.py
new file mode 100644
index 0000000..c53cf9f
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/container.py
@@ -0,0 +1,142 @@
+from matplotlib.artist import Artist
+import matplotlib.cbook as cbook
+
+
+class Container(tuple):
+ """
+ Base class for containers.
+
+ Containers are classes that collect semantically related Artists such as
+ the bars of a bar plot.
+ """
+
+ def __repr__(self):
+ return ("<{} object of {} artists>"
+ .format(type(self).__name__, len(self)))
+
+ def __new__(cls, *args, **kwargs):
+ return tuple.__new__(cls, args[0])
+
+ def __init__(self, kl, label=None):
+ self._callbacks = cbook.CallbackRegistry()
+ self._remove_method = None
+ self.set_label(label)
+
+ def remove(self):
+ for c in cbook.flatten(
+ self, scalarp=lambda x: isinstance(x, Artist)):
+ if c is not None:
+ c.remove()
+ if self._remove_method:
+ self._remove_method(self)
+
+ def get_children(self):
+ return [child for child in cbook.flatten(self) if child is not None]
+
+ get_label = Artist.get_label
+ set_label = Artist.set_label
+ add_callback = Artist.add_callback
+ remove_callback = Artist.remove_callback
+ pchanged = Artist.pchanged
+
+
+class BarContainer(Container):
+ """
+ Container for the artists of bar plots (e.g. created by `.Axes.bar`).
+
+ The container can be treated as a tuple of the *patches* themselves.
+ Additionally, you can access these and further parameters by the
+ attributes.
+
+ Attributes
+ ----------
+ patches : list of :class:`~matplotlib.patches.Rectangle`
+ The artists of the bars.
+
+ errorbar : None or :class:`~matplotlib.container.ErrorbarContainer`
+ A container for the error bar artists if error bars are present.
+ *None* otherwise.
+
+ datavalues : None or array-like
+ The underlying data values corresponding to the bars.
+
+ orientation : {'vertical', 'horizontal'}, default: None
+ If 'vertical', the bars are assumed to be vertical.
+ If 'horizontal', the bars are assumed to be horizontal.
+
+ """
+
+ def __init__(self, patches, errorbar=None, *, datavalues=None,
+ orientation=None, **kwargs):
+ self.patches = patches
+ self.errorbar = errorbar
+ self.datavalues = datavalues
+ self.orientation = orientation
+ super().__init__(patches, **kwargs)
+
+
+class ErrorbarContainer(Container):
+ """
+ Container for the artists of error bars (e.g. created by `.Axes.errorbar`).
+
+ The container can be treated as the *lines* tuple itself.
+ Additionally, you can access these and further parameters by the
+ attributes.
+
+ Attributes
+ ----------
+ lines : tuple
+ Tuple of ``(data_line, caplines, barlinecols)``.
+
+ - data_line : :class:`~matplotlib.lines.Line2D` instance of
+ x, y plot markers and/or line.
+ - caplines : tuple of :class:`~matplotlib.lines.Line2D` instances of
+ the error bar caps.
+ - barlinecols : list of :class:`~matplotlib.collections.LineCollection`
+ with the horizontal and vertical error ranges.
+
+ has_xerr, has_yerr : bool
+ ``True`` if the errorbar has x/y errors.
+
+ """
+
+ def __init__(self, lines, has_xerr=False, has_yerr=False, **kwargs):
+ self.lines = lines
+ self.has_xerr = has_xerr
+ self.has_yerr = has_yerr
+ super().__init__(lines, **kwargs)
+
+
+class StemContainer(Container):
+ """
+ Container for the artists created in a :meth:`.Axes.stem` plot.
+
+ The container can be treated like a namedtuple ``(markerline, stemlines,
+ baseline)``.
+
+ Attributes
+ ----------
+ markerline : :class:`~matplotlib.lines.Line2D`
+ The artist of the markers at the stem heads.
+
+ stemlines : list of :class:`~matplotlib.lines.Line2D`
+ The artists of the vertical lines for all stems.
+
+ baseline : :class:`~matplotlib.lines.Line2D`
+ The artist of the horizontal baseline.
+ """
+ def __init__(self, markerline_stemlines_baseline, **kwargs):
+ """
+ Parameters
+ ----------
+ markerline_stemlines_baseline : tuple
+ Tuple of ``(markerline, stemlines, baseline)``.
+ ``markerline`` contains the `.LineCollection` of the markers,
+ ``stemlines`` is a `.LineCollection` of the main lines,
+ ``baseline`` is the `.Line2D` of the baseline.
+ """
+ markerline, stemlines, baseline = markerline_stemlines_baseline
+ self.markerline = markerline
+ self.stemlines = stemlines
+ self.baseline = baseline
+ super().__init__(markerline_stemlines_baseline, **kwargs)
diff --git a/venv/Lib/site-packages/matplotlib/contour.py b/venv/Lib/site-packages/matplotlib/contour.py
new file mode 100644
index 0000000..00db07a
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/contour.py
@@ -0,0 +1,1727 @@
+"""
+Classes to support contour plotting and labelling for the Axes class.
+"""
+
+from numbers import Integral
+
+import numpy as np
+from numpy import ma
+
+import matplotlib as mpl
+from matplotlib import _api
+import matplotlib.path as mpath
+import matplotlib.ticker as ticker
+import matplotlib.cm as cm
+import matplotlib.colors as mcolors
+import matplotlib.collections as mcoll
+import matplotlib.font_manager as font_manager
+import matplotlib.text as text
+import matplotlib.cbook as cbook
+import matplotlib.patches as mpatches
+import matplotlib.transforms as mtransforms
+
+# Import needed for adding manual selection capability to clabel
+from matplotlib.blocking_input import BlockingContourLabeler
+from matplotlib import docstring
+
+# We can't use a single line collection for contour because a line
+# collection can have only a single line style, and we want to be able to have
+# dashed negative contours, for example, and solid positive contours.
+# We could use a single polygon collection for filled contours, but it
+# seems better to keep line and filled contours similar, with one collection
+# per level.
+
+
+class ClabelText(text.Text):
+ """
+ Unlike the ordinary text, the get_rotation returns an updated
+ angle in the pixel coordinate assuming that the input rotation is
+ an angle in data coordinate (or whatever transform set).
+ """
+
+ def get_rotation(self):
+ new_angle, = self.get_transform().transform_angles(
+ [super().get_rotation()], [self.get_position()])
+ return new_angle
+
+
+class ContourLabeler:
+ """Mixin to provide labelling capability to `.ContourSet`."""
+
+ def clabel(self, levels=None, *,
+ fontsize=None, inline=True, inline_spacing=5, fmt=None,
+ colors=None, use_clabeltext=False, manual=False,
+ rightside_up=True, zorder=None):
+ """
+ Label a contour plot.
+
+ Adds labels to line contours in this `.ContourSet` (which inherits from
+ this mixin class).
+
+ Parameters
+ ----------
+ levels : array-like, optional
+ A list of level values, that should be labeled. The list must be
+ a subset of ``cs.levels``. If not given, all levels are labeled.
+
+ fontsize : str or float, default: :rc:`font.size`
+ Size in points or relative size e.g., 'smaller', 'x-large'.
+ See `.Text.set_size` for accepted string values.
+
+ colors : color or colors or None, default: None
+ The label colors:
+
+ - If *None*, the color of each label matches the color of
+ the corresponding contour.
+
+ - If one string color, e.g., *colors* = 'r' or *colors* =
+ 'red', all labels will be plotted in this color.
+
+ - If a tuple of colors (string, float, rgb, etc), different labels
+ will be plotted in different colors in the order specified.
+
+ inline : bool, default: True
+ If ``True`` the underlying contour is removed where the label is
+ placed.
+
+ inline_spacing : float, default: 5
+ Space in pixels to leave on each side of label when placing inline.
+
+ This spacing will be exact for labels at locations where the
+ contour is straight, less so for labels on curved contours.
+
+ fmt : `.Formatter` or str or callable or dict, optional
+ How the levels are formatted:
+
+ - If a `.Formatter`, it is used to format all levels at once, using
+ its `.Formatter.format_ticks` method.
+ - If a str, it is interpreted as a %-style format string.
+ - If a callable, it is called with one level at a time and should
+ return the corresponding label.
+ - If a dict, it should directly map levels to labels.
+
+ The default is to use a standard `.ScalarFormatter`.
+
+ manual : bool or iterable, default: False
+ If ``True``, contour labels will be placed manually using
+ mouse clicks. Click the first button near a contour to
+ add a label, click the second button (or potentially both
+ mouse buttons at once) to finish adding labels. The third
+ button can be used to remove the last label added, but
+ only if labels are not inline. Alternatively, the keyboard
+ can be used to select label locations (enter to end label
+ placement, delete or backspace act like the third mouse button,
+ and any other key will select a label location).
+
+ *manual* can also be an iterable object of (x, y) tuples.
+ Contour labels will be created as if mouse is clicked at each
+ (x, y) position.
+
+ rightside_up : bool, default: True
+ If ``True``, label rotations will always be plus
+ or minus 90 degrees from level.
+
+ use_clabeltext : bool, default: False
+ If ``True``, `.ClabelText` class (instead of `.Text`) is used to
+ create labels. `ClabelText` recalculates rotation angles
+ of texts during the drawing time, therefore this can be used if
+ aspect of the axes changes.
+
+ zorder : float or None, default: ``(2 + contour.get_zorder())``
+ zorder of the contour labels.
+
+ Returns
+ -------
+ labels
+ A list of `.Text` instances for the labels.
+ """
+
+ # clabel basically takes the input arguments and uses them to
+ # add a list of "label specific" attributes to the ContourSet
+ # object. These attributes are all of the form label* and names
+ # should be fairly self explanatory.
+ #
+ # Once these attributes are set, clabel passes control to the
+ # labels method (case of automatic label placement) or
+ # `BlockingContourLabeler` (case of manual label placement).
+
+ if fmt is None:
+ fmt = ticker.ScalarFormatter(useOffset=False)
+ fmt.create_dummy_axis()
+ self.labelFmt = fmt
+ self._use_clabeltext = use_clabeltext
+ # Detect if manual selection is desired and remove from argument list.
+ self.labelManual = manual
+ self.rightside_up = rightside_up
+ if zorder is None:
+ self._clabel_zorder = 2+self._contour_zorder
+ else:
+ self._clabel_zorder = zorder
+
+ if levels is None:
+ levels = self.levels
+ indices = list(range(len(self.cvalues)))
+ else:
+ levlabs = list(levels)
+ indices, levels = [], []
+ for i, lev in enumerate(self.levels):
+ if lev in levlabs:
+ indices.append(i)
+ levels.append(lev)
+ if len(levels) < len(levlabs):
+ raise ValueError(f"Specified levels {levlabs} don't match "
+ f"available levels {self.levels}")
+ self.labelLevelList = levels
+ self.labelIndiceList = indices
+
+ self.labelFontProps = font_manager.FontProperties()
+ self.labelFontProps.set_size(fontsize)
+ font_size_pts = self.labelFontProps.get_size_in_points()
+ self.labelFontSizeList = [font_size_pts] * len(levels)
+
+ if colors is None:
+ self.labelMappable = self
+ self.labelCValueList = np.take(self.cvalues, self.labelIndiceList)
+ else:
+ cmap = mcolors.ListedColormap(colors, N=len(self.labelLevelList))
+ self.labelCValueList = list(range(len(self.labelLevelList)))
+ self.labelMappable = cm.ScalarMappable(cmap=cmap,
+ norm=mcolors.NoNorm())
+
+ self.labelXYs = []
+
+ if np.iterable(self.labelManual):
+ for x, y in self.labelManual:
+ self.add_label_near(x, y, inline, inline_spacing)
+ elif self.labelManual:
+ print('Select label locations manually using first mouse button.')
+ print('End manual selection with second mouse button.')
+ if not inline:
+ print('Remove last label by clicking third mouse button.')
+ blocking_contour_labeler = BlockingContourLabeler(self)
+ blocking_contour_labeler(inline, inline_spacing)
+ else:
+ self.labels(inline, inline_spacing)
+
+ self.labelTextsList = cbook.silent_list('text.Text', self.labelTexts)
+ return self.labelTextsList
+
+ def print_label(self, linecontour, labelwidth):
+ """Return whether a contour is long enough to hold a label."""
+ return (len(linecontour) > 10 * labelwidth
+ or (np.ptp(linecontour, axis=0) > 1.2 * labelwidth).any())
+
+ def too_close(self, x, y, lw):
+ """Return whether a label is already near this location."""
+ thresh = (1.2 * lw) ** 2
+ return any((x - loc[0]) ** 2 + (y - loc[1]) ** 2 < thresh
+ for loc in self.labelXYs)
+
+ @_api.deprecated("3.4")
+ def get_label_coords(self, distances, XX, YY, ysize, lw):
+ """
+ Return x, y, and the index of a label location.
+
+ Labels are plotted at a location with the smallest
+ deviation of the contour from a straight line
+ unless there is another label nearby, in which case
+ the next best place on the contour is picked up.
+ If all such candidates are rejected, the beginning
+ of the contour is chosen.
+ """
+ hysize = int(ysize / 2)
+ adist = np.argsort(distances)
+
+ for ind in adist:
+ x, y = XX[ind][hysize], YY[ind][hysize]
+ if self.too_close(x, y, lw):
+ continue
+ return x, y, ind
+
+ ind = adist[0]
+ x, y = XX[ind][hysize], YY[ind][hysize]
+ return x, y, ind
+
+ def get_label_width(self, lev, fmt, fsize):
+ """
+ Return the width of the label in points.
+ """
+ if not isinstance(lev, str):
+ lev = self.get_text(lev, fmt)
+ fig = self.axes.figure
+ width = (text.Text(0, 0, lev, figure=fig,
+ size=fsize, fontproperties=self.labelFontProps)
+ .get_window_extent(mpl.tight_layout.get_renderer(fig)).width)
+ width *= 72 / fig.dpi
+ return width
+
+ def set_label_props(self, label, text, color):
+ """Set the label properties - color, fontsize, text."""
+ label.set_text(text)
+ label.set_color(color)
+ label.set_fontproperties(self.labelFontProps)
+ label.set_clip_box(self.axes.bbox)
+
+ def get_text(self, lev, fmt):
+ """Get the text of the label."""
+ if isinstance(lev, str):
+ return lev
+ elif isinstance(fmt, dict):
+ return fmt.get(lev, '%1.3f')
+ elif callable(getattr(fmt, "format_ticks", None)):
+ return fmt.format_ticks([*self.labelLevelList, lev])[-1]
+ elif callable(fmt):
+ return fmt(lev)
+ else:
+ return fmt % lev
+
+ def locate_label(self, linecontour, labelwidth):
+ """
+ Find good place to draw a label (relatively flat part of the contour).
+ """
+ ctr_size = len(linecontour)
+ n_blocks = int(np.ceil(ctr_size / labelwidth)) if labelwidth > 1 else 1
+ block_size = ctr_size if n_blocks == 1 else int(labelwidth)
+ # Split contour into blocks of length ``block_size``, filling the last
+ # block by cycling the contour start (per `np.resize` semantics). (Due
+ # to cycling, the index returned is taken modulo ctr_size.)
+ xx = np.resize(linecontour[:, 0], (n_blocks, block_size))
+ yy = np.resize(linecontour[:, 1], (n_blocks, block_size))
+ yfirst = yy[:, :1]
+ ylast = yy[:, -1:]
+ xfirst = xx[:, :1]
+ xlast = xx[:, -1:]
+ s = (yfirst - yy) * (xlast - xfirst) - (xfirst - xx) * (ylast - yfirst)
+ l = np.hypot(xlast - xfirst, ylast - yfirst)
+ # Ignore warning that divide by zero throws, as this is a valid option
+ with np.errstate(divide='ignore', invalid='ignore'):
+ distances = (abs(s) / l).sum(axis=-1)
+ # Labels are drawn in the middle of the block (``hbsize``) where the
+ # contour is the closest (per ``distances``) to a straight line, but
+ # not `too_close()` to a preexisting label.
+ hbsize = block_size // 2
+ adist = np.argsort(distances)
+ # If all candidates are `too_close()`, go back to the straightest part
+ # (``adist[0]``).
+ for idx in np.append(adist, adist[0]):
+ x, y = xx[idx, hbsize], yy[idx, hbsize]
+ if not self.too_close(x, y, labelwidth):
+ break
+ return x, y, (idx * block_size + hbsize) % ctr_size
+
+ def calc_label_rot_and_inline(self, slc, ind, lw, lc=None, spacing=5):
+ """
+ Calculate the appropriate label rotation given the linecontour
+ coordinates in screen units, the index of the label location and the
+ label width.
+
+ If *lc* is not None or empty, also break contours and compute
+ inlining.
+
+ *spacing* is the empty space to leave around the label, in pixels.
+
+ Both tasks are done together to avoid calculating path lengths
+ multiple times, which is relatively costly.
+
+ The method used here involves computing the path length along the
+ contour in pixel coordinates and then looking approximately (label
+ width / 2) away from central point to determine rotation and then to
+ break contour if desired.
+ """
+
+ if lc is None:
+ lc = []
+ # Half the label width
+ hlw = lw / 2.0
+
+ # Check if closed and, if so, rotate contour so label is at edge
+ closed = _is_closed_polygon(slc)
+ if closed:
+ slc = np.concatenate([slc[ind:-1], slc[:ind + 1]])
+ if len(lc): # Rotate lc also if not empty
+ lc = np.concatenate([lc[ind:-1], lc[:ind + 1]])
+ ind = 0
+
+ # Calculate path lengths
+ pl = np.zeros(slc.shape[0], dtype=float)
+ dx = np.diff(slc, axis=0)
+ pl[1:] = np.cumsum(np.hypot(dx[:, 0], dx[:, 1]))
+ pl = pl - pl[ind]
+
+ # Use linear interpolation to get points around label
+ xi = np.array([-hlw, hlw])
+ if closed: # Look at end also for closed contours
+ dp = np.array([pl[-1], 0])
+ else:
+ dp = np.zeros_like(xi)
+
+ # Get angle of vector between the two ends of the label - must be
+ # calculated in pixel space for text rotation to work correctly.
+ (dx,), (dy,) = (np.diff(np.interp(dp + xi, pl, slc_col))
+ for slc_col in slc.T)
+ rotation = np.rad2deg(np.arctan2(dy, dx))
+
+ if self.rightside_up:
+ # Fix angle so text is never upside-down
+ rotation = (rotation + 90) % 180 - 90
+
+ # Break contour if desired
+ nlc = []
+ if len(lc):
+ # Expand range by spacing
+ xi = dp + xi + np.array([-spacing, spacing])
+
+ # Get (integer) indices near points of interest; use -1 as marker
+ # for out of bounds.
+ I = np.interp(xi, pl, np.arange(len(pl)), left=-1, right=-1)
+ I = [np.floor(I[0]).astype(int), np.ceil(I[1]).astype(int)]
+ if I[0] != -1:
+ xy1 = [np.interp(xi[0], pl, lc_col) for lc_col in lc.T]
+ if I[1] != -1:
+ xy2 = [np.interp(xi[1], pl, lc_col) for lc_col in lc.T]
+
+ # Actually break contours
+ if closed:
+ # This will remove contour if shorter than label
+ if all(i != -1 for i in I):
+ nlc.append(np.row_stack([xy2, lc[I[1]:I[0]+1], xy1]))
+ else:
+ # These will remove pieces of contour if they have length zero
+ if I[0] != -1:
+ nlc.append(np.row_stack([lc[:I[0]+1], xy1]))
+ if I[1] != -1:
+ nlc.append(np.row_stack([xy2, lc[I[1]:]]))
+
+ # The current implementation removes contours completely
+ # covered by labels. Uncomment line below to keep
+ # original contour if this is the preferred behavior.
+ # if not len(nlc): nlc = [ lc ]
+
+ return rotation, nlc
+
+ def _get_label_text(self, x, y, rotation):
+ dx, dy = self.axes.transData.inverted().transform((x, y))
+ t = text.Text(dx, dy, rotation=rotation,
+ horizontalalignment='center',
+ verticalalignment='center', zorder=self._clabel_zorder)
+ return t
+
+ def _get_label_clabeltext(self, x, y, rotation):
+ # x, y, rotation is given in pixel coordinate. Convert them to
+ # the data coordinate and create a label using ClabelText
+ # class. This way, the rotation of the clabel is along the
+ # contour line always.
+ transDataInv = self.axes.transData.inverted()
+ dx, dy = transDataInv.transform((x, y))
+ drotation = transDataInv.transform_angles(np.array([rotation]),
+ np.array([[x, y]]))
+ t = ClabelText(dx, dy, rotation=drotation[0],
+ horizontalalignment='center',
+ verticalalignment='center', zorder=self._clabel_zorder)
+
+ return t
+
+ def _add_label(self, t, x, y, lev, cvalue):
+ color = self.labelMappable.to_rgba(cvalue, alpha=self.alpha)
+
+ _text = self.get_text(lev, self.labelFmt)
+ self.set_label_props(t, _text, color)
+ self.labelTexts.append(t)
+ self.labelCValues.append(cvalue)
+ self.labelXYs.append((x, y))
+
+ # Add label to plot here - useful for manual mode label selection
+ self.axes.add_artist(t)
+
+ def add_label(self, x, y, rotation, lev, cvalue):
+ """
+ Add contour label using :class:`~matplotlib.text.Text` class.
+ """
+ t = self._get_label_text(x, y, rotation)
+ self._add_label(t, x, y, lev, cvalue)
+
+ def add_label_clabeltext(self, x, y, rotation, lev, cvalue):
+ """
+ Add contour label using :class:`ClabelText` class.
+ """
+ # x, y, rotation is given in pixel coordinate. Convert them to
+ # the data coordinate and create a label using ClabelText
+ # class. This way, the rotation of the clabel is along the
+ # contour line always.
+ t = self._get_label_clabeltext(x, y, rotation)
+ self._add_label(t, x, y, lev, cvalue)
+
+ def add_label_near(self, x, y, inline=True, inline_spacing=5,
+ transform=None):
+ """
+ Add a label near the point ``(x, y)``.
+
+ Parameters
+ ----------
+ x, y : float
+ The approximate location of the label.
+ inline : bool, default: True
+ If *True* remove the segment of the contour beneath the label.
+ inline_spacing : int, default: 5
+ Space in pixels to leave on each side of label when placing
+ inline. This spacing will be exact for labels at locations where
+ the contour is straight, less so for labels on curved contours.
+ transform : `.Transform` or `False`, default: ``self.axes.transData``
+ A transform applied to ``(x, y)`` before labeling. The default
+ causes ``(x, y)`` to be interpreted as data coordinates. `False`
+ is a synonym for `.IdentityTransform`; i.e. ``(x, y)`` should be
+ interpreted as display coordinates.
+ """
+
+ if transform is None:
+ transform = self.axes.transData
+ if transform:
+ x, y = transform.transform((x, y))
+
+ # find the nearest contour _in screen units_
+ conmin, segmin, imin, xmin, ymin = self.find_nearest_contour(
+ x, y, self.labelIndiceList)[:5]
+
+ # calc_label_rot_and_inline() requires that (xmin, ymin)
+ # be a vertex in the path. So, if it isn't, add a vertex here
+ paths = self.collections[conmin].get_paths() # paths of correct coll.
+ lc = paths[segmin].vertices # vertices of correct segment
+ # Where should the new vertex be added in data-units?
+ xcmin = self.axes.transData.inverted().transform([xmin, ymin])
+ if not np.allclose(xcmin, lc[imin]):
+ # No vertex is close enough, so add a new point in the vertices and
+ # replace the path by the new one.
+ lc = np.insert(lc, imin, xcmin, axis=0)
+ paths[segmin] = mpath.Path(lc)
+
+ # Get index of nearest level in subset of levels used for labeling
+ lmin = self.labelIndiceList.index(conmin)
+
+ # Get label width for rotating labels and breaking contours
+ lw = self.get_label_width(self.labelLevelList[lmin],
+ self.labelFmt, self.labelFontSizeList[lmin])
+ # lw is in points.
+ lw *= self.axes.figure.dpi / 72 # scale to screen coordinates
+ # now lw in pixels
+
+ # Figure out label rotation.
+ rotation, nlc = self.calc_label_rot_and_inline(
+ self.axes.transData.transform(lc), # to pixel space.
+ imin, lw, lc if inline else None, inline_spacing)
+
+ self.add_label(xmin, ymin, rotation, self.labelLevelList[lmin],
+ self.labelCValueList[lmin])
+
+ if inline:
+ # Remove old, not looping over paths so we can do this up front
+ paths.pop(segmin)
+
+ # Add paths if not empty or single point
+ for n in nlc:
+ if len(n) > 1:
+ paths.append(mpath.Path(n))
+
+ def pop_label(self, index=-1):
+ """Defaults to removing last label, but any index can be supplied"""
+ self.labelCValues.pop(index)
+ t = self.labelTexts.pop(index)
+ t.remove()
+
+ def labels(self, inline, inline_spacing):
+
+ if self._use_clabeltext:
+ add_label = self.add_label_clabeltext
+ else:
+ add_label = self.add_label
+
+ for icon, lev, fsize, cvalue in zip(
+ self.labelIndiceList, self.labelLevelList,
+ self.labelFontSizeList, self.labelCValueList):
+
+ con = self.collections[icon]
+ trans = con.get_transform()
+ lw = self.get_label_width(lev, self.labelFmt, fsize)
+ lw *= self.axes.figure.dpi / 72 # scale to screen coordinates
+ additions = []
+ paths = con.get_paths()
+ for segNum, linepath in enumerate(paths):
+ lc = linepath.vertices # Line contour
+ slc = trans.transform(lc) # Line contour in screen coords
+
+ # Check if long enough for a label
+ if self.print_label(slc, lw):
+ x, y, ind = self.locate_label(slc, lw)
+
+ rotation, new = self.calc_label_rot_and_inline(
+ slc, ind, lw, lc if inline else None, inline_spacing)
+
+ # Actually add the label
+ add_label(x, y, rotation, lev, cvalue)
+
+ # If inline, add new contours
+ if inline:
+ for n in new:
+ # Add path if not empty or single point
+ if len(n) > 1:
+ additions.append(mpath.Path(n))
+ else: # If not adding label, keep old path
+ additions.append(linepath)
+
+ # After looping over all segments on a contour, replace old paths
+ # by new ones if inlining.
+ if inline:
+ paths[:] = additions
+
+
+def _is_closed_polygon(X):
+ """
+ Return whether first and last object in a sequence are the same. These are
+ presumably coordinates on a polygonal curve, in which case this function
+ tests if that curve is closed.
+ """
+ return np.allclose(X[0], X[-1], rtol=1e-10, atol=1e-13)
+
+
+def _find_closest_point_on_path(xys, p):
+ """
+ Parameters
+ ----------
+ xys : (N, 2) array-like
+ Coordinates of vertices.
+ p : (float, float)
+ Coordinates of point.
+
+ Returns
+ -------
+ d2min : float
+ Minimum square distance of *p* to *xys*.
+ proj : (float, float)
+ Projection of *p* onto *xys*.
+ imin : (int, int)
+ Consecutive indices of vertices of segment in *xys* where *proj* is.
+ Segments are considered as including their end-points; i.e if the
+ closest point on the path is a node in *xys* with index *i*, this
+ returns ``(i-1, i)``. For the special case where *xys* is a single
+ point, this returns ``(0, 0)``.
+ """
+ if len(xys) == 1:
+ return (((p - xys[0]) ** 2).sum(), xys[0], (0, 0))
+ dxys = xys[1:] - xys[:-1] # Individual segment vectors.
+ norms = (dxys ** 2).sum(axis=1)
+ norms[norms == 0] = 1 # For zero-length segment, replace 0/0 by 0/1.
+ rel_projs = np.clip( # Project onto each segment in relative 0-1 coords.
+ ((p - xys[:-1]) * dxys).sum(axis=1) / norms,
+ 0, 1)[:, None]
+ projs = xys[:-1] + rel_projs * dxys # Projs. onto each segment, in (x, y).
+ d2s = ((projs - p) ** 2).sum(axis=1) # Squared distances.
+ imin = np.argmin(d2s)
+ return (d2s[imin], projs[imin], (imin, imin+1))
+
+
+docstring.interpd.update(contour_set_attributes=r"""
+Attributes
+----------
+ax : `~matplotlib.axes.Axes`
+ The Axes object in which the contours are drawn.
+
+collections : `.silent_list` of `.LineCollection`\s or `.PathCollection`\s
+ The `.Artist`\s representing the contour. This is a list of
+ `.LineCollection`\s for line contours and a list of `.PathCollection`\s
+ for filled contours.
+
+levels : array
+ The values of the contour levels.
+
+layers : array
+ Same as levels for line contours; half-way between
+ levels for filled contours. See ``ContourSet._process_colors``.
+""")
+
+
+@docstring.dedent_interpd
+class ContourSet(cm.ScalarMappable, ContourLabeler):
+ """
+ Store a set of contour lines or filled regions.
+
+ User-callable method: `~.Axes.clabel`
+
+ Parameters
+ ----------
+ ax : `~.axes.Axes`
+
+ levels : [level0, level1, ..., leveln]
+ A list of floating point numbers indicating the contour levels.
+
+ allsegs : [level0segs, level1segs, ...]
+ List of all the polygon segments for all the *levels*.
+ For contour lines ``len(allsegs) == len(levels)``, and for
+ filled contour regions ``len(allsegs) = len(levels)-1``. The lists
+ should look like ::
+
+ level0segs = [polygon0, polygon1, ...]
+ polygon0 = [[x0, y0], [x1, y1], ...]
+
+ allkinds : ``None`` or [level0kinds, level1kinds, ...]
+ Optional list of all the polygon vertex kinds (code types), as
+ described and used in Path. This is used to allow multiply-
+ connected paths such as holes within filled polygons.
+ If not ``None``, ``len(allkinds) == len(allsegs)``. The lists
+ should look like ::
+
+ level0kinds = [polygon0kinds, ...]
+ polygon0kinds = [vertexcode0, vertexcode1, ...]
+
+ If *allkinds* is not ``None``, usually all polygons for a
+ particular contour level are grouped together so that
+ ``level0segs = [polygon0]`` and ``level0kinds = [polygon0kinds]``.
+
+ **kwargs
+ Keyword arguments are as described in the docstring of
+ `~.Axes.contour`.
+
+ %(contour_set_attributes)s
+ """
+
+ ax = _api.deprecated("3.3")(property(lambda self: self.axes))
+
+ def __init__(self, ax, *args,
+ levels=None, filled=False, linewidths=None, linestyles=None,
+ hatches=(None,), alpha=None, origin=None, extent=None,
+ cmap=None, colors=None, norm=None, vmin=None, vmax=None,
+ extend='neither', antialiased=None, nchunk=0, locator=None,
+ transform=None,
+ **kwargs):
+ """
+ Draw contour lines or filled regions, depending on
+ whether keyword arg *filled* is ``False`` (default) or ``True``.
+
+ Call signature::
+
+ ContourSet(ax, levels, allsegs, [allkinds], **kwargs)
+
+ Parameters
+ ----------
+ ax : `~.axes.Axes`
+ The `~.axes.Axes` object to draw on.
+
+ levels : [level0, level1, ..., leveln]
+ A list of floating point numbers indicating the contour
+ levels.
+
+ allsegs : [level0segs, level1segs, ...]
+ List of all the polygon segments for all the *levels*.
+ For contour lines ``len(allsegs) == len(levels)``, and for
+ filled contour regions ``len(allsegs) = len(levels)-1``. The lists
+ should look like ::
+
+ level0segs = [polygon0, polygon1, ...]
+ polygon0 = [[x0, y0], [x1, y1], ...]
+
+ allkinds : [level0kinds, level1kinds, ...], optional
+ Optional list of all the polygon vertex kinds (code types), as
+ described and used in Path. This is used to allow multiply-
+ connected paths such as holes within filled polygons.
+ If not ``None``, ``len(allkinds) == len(allsegs)``. The lists
+ should look like ::
+
+ level0kinds = [polygon0kinds, ...]
+ polygon0kinds = [vertexcode0, vertexcode1, ...]
+
+ If *allkinds* is not ``None``, usually all polygons for a
+ particular contour level are grouped together so that
+ ``level0segs = [polygon0]`` and ``level0kinds = [polygon0kinds]``.
+
+ **kwargs
+ Keyword arguments are as described in the docstring of
+ `~.Axes.contour`.
+ """
+ self.axes = ax
+ self.levels = levels
+ self.filled = filled
+ self.linewidths = linewidths
+ self.linestyles = linestyles
+ self.hatches = hatches
+ self.alpha = alpha
+ self.origin = origin
+ self.extent = extent
+ self.colors = colors
+ self.extend = extend
+ self.antialiased = antialiased
+ if self.antialiased is None and self.filled:
+ # Eliminate artifacts; we are not stroking the boundaries.
+ self.antialiased = False
+ # The default for line contours will be taken from the
+ # LineCollection default, which uses :rc:`lines.antialiased`.
+
+ self.nchunk = nchunk
+ self.locator = locator
+ if (isinstance(norm, mcolors.LogNorm)
+ or isinstance(self.locator, ticker.LogLocator)):
+ self.logscale = True
+ if norm is None:
+ norm = mcolors.LogNorm()
+ else:
+ self.logscale = False
+
+ _api.check_in_list([None, 'lower', 'upper', 'image'], origin=origin)
+ if self.extent is not None and len(self.extent) != 4:
+ raise ValueError(
+ "If given, 'extent' must be None or (x0, x1, y0, y1)")
+ if self.colors is not None and cmap is not None:
+ raise ValueError('Either colors or cmap must be None')
+ if self.origin == 'image':
+ self.origin = mpl.rcParams['image.origin']
+
+ self._transform = transform
+
+ kwargs = self._process_args(*args, **kwargs)
+ self._process_levels()
+
+ if self.colors is not None:
+ ncolors = len(self.levels)
+ if self.filled:
+ ncolors -= 1
+ i0 = 0
+
+ # Handle the case where colors are given for the extended
+ # parts of the contour.
+ extend_min = self.extend in ['min', 'both']
+ extend_max = self.extend in ['max', 'both']
+ use_set_under_over = False
+ # if we are extending the lower end, and we've been given enough
+ # colors then skip the first color in the resulting cmap. For the
+ # extend_max case we don't need to worry about passing more colors
+ # than ncolors as ListedColormap will clip.
+ total_levels = ncolors + int(extend_min) + int(extend_max)
+ if len(self.colors) == total_levels and (extend_min or extend_max):
+ use_set_under_over = True
+ if extend_min:
+ i0 = 1
+
+ cmap = mcolors.ListedColormap(self.colors[i0:None], N=ncolors)
+
+ if use_set_under_over:
+ if extend_min:
+ cmap.set_under(self.colors[0])
+ if extend_max:
+ cmap.set_over(self.colors[-1])
+
+ self.collections = cbook.silent_list(None)
+
+ # label lists must be initialized here
+ self.labelTexts = []
+ self.labelCValues = []
+
+ kw = {'cmap': cmap}
+ if norm is not None:
+ kw['norm'] = norm
+ # sets self.cmap, norm if needed;
+ cm.ScalarMappable.__init__(self, **kw)
+ if vmin is not None:
+ self.norm.vmin = vmin
+ if vmax is not None:
+ self.norm.vmax = vmax
+ self._process_colors()
+
+ self.allsegs, self.allkinds = self._get_allsegs_and_allkinds()
+
+ if self.filled:
+ if self.linewidths is not None:
+ _api.warn_external('linewidths is ignored by contourf')
+ # Lower and upper contour levels.
+ lowers, uppers = self._get_lowers_and_uppers()
+ # Ensure allkinds can be zipped below.
+ if self.allkinds is None:
+ self.allkinds = [None] * len(self.allsegs)
+ # Default zorder taken from Collection
+ self._contour_zorder = kwargs.pop('zorder', 1)
+
+ self.collections[:] = [
+ mcoll.PathCollection(
+ self._make_paths(segs, kinds),
+ antialiaseds=(self.antialiased,),
+ edgecolors='none',
+ alpha=self.alpha,
+ transform=self.get_transform(),
+ zorder=self._contour_zorder)
+ for level, level_upper, segs, kinds
+ in zip(lowers, uppers, self.allsegs, self.allkinds)]
+ else:
+ self.tlinewidths = tlinewidths = self._process_linewidths()
+ tlinestyles = self._process_linestyles()
+ aa = self.antialiased
+ if aa is not None:
+ aa = (self.antialiased,)
+ # Default zorder taken from LineCollection
+ self._contour_zorder = kwargs.pop('zorder', 2)
+
+ self.collections[:] = [
+ mcoll.LineCollection(
+ segs,
+ antialiaseds=aa,
+ linewidths=width,
+ linestyles=[lstyle],
+ alpha=self.alpha,
+ transform=self.get_transform(),
+ zorder=self._contour_zorder,
+ label='_nolegend_')
+ for level, width, lstyle, segs
+ in zip(self.levels, tlinewidths, tlinestyles, self.allsegs)]
+
+ for col in self.collections:
+ self.axes.add_collection(col, autolim=False)
+ col.sticky_edges.x[:] = [self._mins[0], self._maxs[0]]
+ col.sticky_edges.y[:] = [self._mins[1], self._maxs[1]]
+ self.axes.update_datalim([self._mins, self._maxs])
+ self.axes.autoscale_view(tight=True)
+
+ self.changed() # set the colors
+
+ if kwargs:
+ _api.warn_external(
+ 'The following kwargs were not used by contour: ' +
+ ", ".join(map(repr, kwargs))
+ )
+
+ def get_transform(self):
+ """
+ Return the :class:`~matplotlib.transforms.Transform`
+ instance used by this ContourSet.
+ """
+ if self._transform is None:
+ self._transform = self.axes.transData
+ elif (not isinstance(self._transform, mtransforms.Transform)
+ and hasattr(self._transform, '_as_mpl_transform')):
+ self._transform = self._transform._as_mpl_transform(self.axes)
+ return self._transform
+
+ def __getstate__(self):
+ state = self.__dict__.copy()
+ # the C object _contour_generator cannot currently be pickled. This
+ # isn't a big issue as it is not actually used once the contour has
+ # been calculated.
+ state['_contour_generator'] = None
+ return state
+
+ def legend_elements(self, variable_name='x', str_format=str):
+ """
+ Return a list of artists and labels suitable for passing through
+ to `~.Axes.legend` which represent this ContourSet.
+
+ The labels have the form "0 < x <= 1" stating the data ranges which
+ the artists represent.
+
+ Parameters
+ ----------
+ variable_name : str
+ The string used inside the inequality used on the labels.
+ str_format : function: float -> str
+ Function used to format the numbers in the labels.
+
+ Returns
+ -------
+ artists : list[`.Artist`]
+ A list of the artists.
+ labels : list[str]
+ A list of the labels.
+ """
+ artists = []
+ labels = []
+
+ if self.filled:
+ lowers, uppers = self._get_lowers_and_uppers()
+ n_levels = len(self.collections)
+
+ for i, (collection, lower, upper) in enumerate(
+ zip(self.collections, lowers, uppers)):
+ patch = mpatches.Rectangle(
+ (0, 0), 1, 1,
+ facecolor=collection.get_facecolor()[0],
+ hatch=collection.get_hatch(),
+ alpha=collection.get_alpha())
+ artists.append(patch)
+
+ lower = str_format(lower)
+ upper = str_format(upper)
+
+ if i == 0 and self.extend in ('min', 'both'):
+ labels.append(fr'${variable_name} \leq {lower}s$')
+ elif i == n_levels - 1 and self.extend in ('max', 'both'):
+ labels.append(fr'${variable_name} > {upper}s$')
+ else:
+ labels.append(fr'${lower} < {variable_name} \leq {upper}$')
+ else:
+ for collection, level in zip(self.collections, self.levels):
+
+ patch = mcoll.LineCollection(None)
+ patch.update_from(collection)
+
+ artists.append(patch)
+ # format the level for insertion into the labels
+ level = str_format(level)
+ labels.append(fr'${variable_name} = {level}$')
+
+ return artists, labels
+
+ def _process_args(self, *args, **kwargs):
+ """
+ Process *args* and *kwargs*; override in derived classes.
+
+ Must set self.levels, self.zmin and self.zmax, and update axes limits.
+ """
+ self.levels = args[0]
+ self.allsegs = args[1]
+ self.allkinds = args[2] if len(args) > 2 else None
+ self.zmax = np.max(self.levels)
+ self.zmin = np.min(self.levels)
+
+ # Check lengths of levels and allsegs.
+ if self.filled:
+ if len(self.allsegs) != len(self.levels) - 1:
+ raise ValueError('must be one less number of segments as '
+ 'levels')
+ else:
+ if len(self.allsegs) != len(self.levels):
+ raise ValueError('must be same number of segments as levels')
+
+ # Check length of allkinds.
+ if (self.allkinds is not None and
+ len(self.allkinds) != len(self.allsegs)):
+ raise ValueError('allkinds has different length to allsegs')
+
+ # Determine x, y bounds and update axes data limits.
+ flatseglist = [s for seg in self.allsegs for s in seg]
+ points = np.concatenate(flatseglist, axis=0)
+ self._mins = points.min(axis=0)
+ self._maxs = points.max(axis=0)
+
+ return kwargs
+
+ def _get_allsegs_and_allkinds(self):
+ """
+ Override in derived classes to create and return allsegs and allkinds.
+ allkinds can be None.
+ """
+ return self.allsegs, self.allkinds
+
+ def _get_lowers_and_uppers(self):
+ """
+ Return ``(lowers, uppers)`` for filled contours.
+ """
+ lowers = self._levels[:-1]
+ if self.zmin == lowers[0]:
+ # Include minimum values in lowest interval
+ lowers = lowers.copy() # so we don't change self._levels
+ if self.logscale:
+ lowers[0] = 0.99 * self.zmin
+ else:
+ lowers[0] -= 1
+ uppers = self._levels[1:]
+ return (lowers, uppers)
+
+ def _make_paths(self, segs, kinds):
+ if kinds is not None:
+ return [mpath.Path(seg, codes=kind)
+ for seg, kind in zip(segs, kinds)]
+ else:
+ return [mpath.Path(seg) for seg in segs]
+
+ def changed(self):
+ tcolors = [(tuple(rgba),)
+ for rgba in self.to_rgba(self.cvalues, alpha=self.alpha)]
+ self.tcolors = tcolors
+ hatches = self.hatches * len(tcolors)
+ for color, hatch, collection in zip(tcolors, hatches,
+ self.collections):
+ if self.filled:
+ collection.set_facecolor(color)
+ # update the collection's hatch (may be None)
+ collection.set_hatch(hatch)
+ else:
+ collection.set_color(color)
+ for label, cv in zip(self.labelTexts, self.labelCValues):
+ label.set_alpha(self.alpha)
+ label.set_color(self.labelMappable.to_rgba(cv))
+ # add label colors
+ cm.ScalarMappable.changed(self)
+
+ def _autolev(self, N):
+ """
+ Select contour levels to span the data.
+
+ The target number of levels, *N*, is used only when the
+ scale is not log and default locator is used.
+
+ We need two more levels for filled contours than for
+ line contours, because for the latter we need to specify
+ the lower and upper boundary of each range. For example,
+ a single contour boundary, say at z = 0, requires only
+ one contour line, but two filled regions, and therefore
+ three levels to provide boundaries for both regions.
+ """
+ if self.locator is None:
+ if self.logscale:
+ self.locator = ticker.LogLocator()
+ else:
+ self.locator = ticker.MaxNLocator(N + 1, min_n_ticks=1)
+
+ lev = self.locator.tick_values(self.zmin, self.zmax)
+
+ try:
+ if self.locator._symmetric:
+ return lev
+ except AttributeError:
+ pass
+
+ # Trim excess levels the locator may have supplied.
+ under = np.nonzero(lev < self.zmin)[0]
+ i0 = under[-1] if len(under) else 0
+ over = np.nonzero(lev > self.zmax)[0]
+ i1 = over[0] + 1 if len(over) else len(lev)
+ if self.extend in ('min', 'both'):
+ i0 += 1
+ if self.extend in ('max', 'both'):
+ i1 -= 1
+
+ if i1 - i0 < 3:
+ i0, i1 = 0, len(lev)
+
+ return lev[i0:i1]
+
+ def _process_contour_level_args(self, args):
+ """
+ Determine the contour levels and store in self.levels.
+ """
+ if self.levels is None:
+ if len(args) == 0:
+ levels_arg = 7 # Default, hard-wired.
+ else:
+ levels_arg = args[0]
+ else:
+ levels_arg = self.levels
+ if isinstance(levels_arg, Integral):
+ self.levels = self._autolev(levels_arg)
+ else:
+ self.levels = np.asarray(levels_arg).astype(np.float64)
+
+ if not self.filled:
+ inside = (self.levels > self.zmin) & (self.levels < self.zmax)
+ levels_in = self.levels[inside]
+ if len(levels_in) == 0:
+ self.levels = [self.zmin]
+ _api.warn_external(
+ "No contour levels were found within the data range.")
+
+ if self.filled and len(self.levels) < 2:
+ raise ValueError("Filled contours require at least 2 levels.")
+
+ if len(self.levels) > 1 and np.min(np.diff(self.levels)) <= 0.0:
+ raise ValueError("Contour levels must be increasing")
+
+ def _process_levels(self):
+ """
+ Assign values to :attr:`layers` based on :attr:`levels`,
+ adding extended layers as needed if contours are filled.
+
+ For line contours, layers simply coincide with levels;
+ a line is a thin layer. No extended levels are needed
+ with line contours.
+ """
+ # Make a private _levels to include extended regions; we
+ # want to leave the original levels attribute unchanged.
+ # (Colorbar needs this even for line contours.)
+ self._levels = list(self.levels)
+
+ if self.logscale:
+ lower, upper = 1e-250, 1e250
+ else:
+ lower, upper = -1e250, 1e250
+
+ if self.extend in ('both', 'min'):
+ self._levels.insert(0, lower)
+ if self.extend in ('both', 'max'):
+ self._levels.append(upper)
+ self._levels = np.asarray(self._levels)
+
+ if not self.filled:
+ self.layers = self.levels
+ return
+
+ # Layer values are mid-way between levels in screen space.
+ if self.logscale:
+ # Avoid overflow by taking sqrt before multiplying.
+ self.layers = (np.sqrt(self._levels[:-1])
+ * np.sqrt(self._levels[1:]))
+ else:
+ self.layers = 0.5 * (self._levels[:-1] + self._levels[1:])
+
+ def _process_colors(self):
+ """
+ Color argument processing for contouring.
+
+ Note that we base the colormapping on the contour levels
+ and layers, not on the actual range of the Z values. This
+ means we don't have to worry about bad values in Z, and we
+ always have the full dynamic range available for the selected
+ levels.
+
+ The color is based on the midpoint of the layer, except for
+ extended end layers. By default, the norm vmin and vmax
+ are the extreme values of the non-extended levels. Hence,
+ the layer color extremes are not the extreme values of
+ the colormap itself, but approach those values as the number
+ of levels increases. An advantage of this scheme is that
+ line contours, when added to filled contours, take on
+ colors that are consistent with those of the filled regions;
+ for example, a contour line on the boundary between two
+ regions will have a color intermediate between those
+ of the regions.
+
+ """
+ self.monochrome = self.cmap.monochrome
+ if self.colors is not None:
+ # Generate integers for direct indexing.
+ i0, i1 = 0, len(self.levels)
+ if self.filled:
+ i1 -= 1
+ # Out of range indices for over and under:
+ if self.extend in ('both', 'min'):
+ i0 -= 1
+ if self.extend in ('both', 'max'):
+ i1 += 1
+ self.cvalues = list(range(i0, i1))
+ self.set_norm(mcolors.NoNorm())
+ else:
+ self.cvalues = self.layers
+ self.set_array(self.levels)
+ self.autoscale_None()
+ if self.extend in ('both', 'max', 'min'):
+ self.norm.clip = False
+
+ # self.tcolors are set by the "changed" method
+
+ def _process_linewidths(self):
+ linewidths = self.linewidths
+ Nlev = len(self.levels)
+ if linewidths is None:
+ default_linewidth = mpl.rcParams['contour.linewidth']
+ if default_linewidth is None:
+ default_linewidth = mpl.rcParams['lines.linewidth']
+ tlinewidths = [(default_linewidth,)] * Nlev
+ else:
+ if not np.iterable(linewidths):
+ linewidths = [linewidths] * Nlev
+ else:
+ linewidths = list(linewidths)
+ if len(linewidths) < Nlev:
+ nreps = int(np.ceil(Nlev / len(linewidths)))
+ linewidths = linewidths * nreps
+ if len(linewidths) > Nlev:
+ linewidths = linewidths[:Nlev]
+ tlinewidths = [(w,) for w in linewidths]
+ return tlinewidths
+
+ def _process_linestyles(self):
+ linestyles = self.linestyles
+ Nlev = len(self.levels)
+ if linestyles is None:
+ tlinestyles = ['solid'] * Nlev
+ if self.monochrome:
+ neg_ls = mpl.rcParams['contour.negative_linestyle']
+ eps = - (self.zmax - self.zmin) * 1e-15
+ for i, lev in enumerate(self.levels):
+ if lev < eps:
+ tlinestyles[i] = neg_ls
+ else:
+ if isinstance(linestyles, str):
+ tlinestyles = [linestyles] * Nlev
+ elif np.iterable(linestyles):
+ tlinestyles = list(linestyles)
+ if len(tlinestyles) < Nlev:
+ nreps = int(np.ceil(Nlev / len(linestyles)))
+ tlinestyles = tlinestyles * nreps
+ if len(tlinestyles) > Nlev:
+ tlinestyles = tlinestyles[:Nlev]
+ else:
+ raise ValueError("Unrecognized type for linestyles kwarg")
+ return tlinestyles
+
+ def get_alpha(self):
+ """Return alpha to be applied to all ContourSet artists."""
+ return self.alpha
+
+ def set_alpha(self, alpha):
+ """
+ Set the alpha blending value for all ContourSet artists.
+ *alpha* must be between 0 (transparent) and 1 (opaque).
+ """
+ self.alpha = alpha
+ self.changed()
+
+ def find_nearest_contour(self, x, y, indices=None, pixel=True):
+ """
+ Find the point in the contour plot that is closest to ``(x, y)``.
+
+ Parameters
+ ----------
+ x, y: float
+ The reference point.
+ indices : list of int or None, default: None
+ Indices of contour levels to consider. If None (the default), all
+ levels are considered.
+ pixel : bool, default: True
+ If *True*, measure distance in pixel (screen) space, which is
+ useful for manual contour labeling; else, measure distance in axes
+ space.
+
+ Returns
+ -------
+ contour : `.Collection`
+ The contour that is closest to ``(x, y)``.
+ segment : int
+ The index of the `.Path` in *contour* that is closest to
+ ``(x, y)``.
+ index : int
+ The index of the path segment in *segment* that is closest to
+ ``(x, y)``.
+ xmin, ymin : float
+ The point in the contour plot that is closest to ``(x, y)``.
+ d2 : float
+ The squared distance from ``(xmin, ymin)`` to ``(x, y)``.
+ """
+
+ # This function uses a method that is probably quite
+ # inefficient based on converting each contour segment to
+ # pixel coordinates and then comparing the given point to
+ # those coordinates for each contour. This will probably be
+ # quite slow for complex contours, but for normal use it works
+ # sufficiently well that the time is not noticeable.
+ # Nonetheless, improvements could probably be made.
+
+ if indices is None:
+ indices = range(len(self.levels))
+
+ d2min = np.inf
+ conmin = None
+ segmin = None
+ xmin = None
+ ymin = None
+
+ point = np.array([x, y])
+
+ for icon in indices:
+ con = self.collections[icon]
+ trans = con.get_transform()
+ paths = con.get_paths()
+
+ for segNum, linepath in enumerate(paths):
+ lc = linepath.vertices
+ # transfer all data points to screen coordinates if desired
+ if pixel:
+ lc = trans.transform(lc)
+
+ d2, xc, leg = _find_closest_point_on_path(lc, point)
+ if d2 < d2min:
+ d2min = d2
+ conmin = icon
+ segmin = segNum
+ imin = leg[1]
+ xmin = xc[0]
+ ymin = xc[1]
+
+ return (conmin, segmin, imin, xmin, ymin, d2min)
+
+
+@docstring.dedent_interpd
+class QuadContourSet(ContourSet):
+ """
+ Create and store a set of contour lines or filled regions.
+
+ This class is typically not instantiated directly by the user but by
+ `~.Axes.contour` and `~.Axes.contourf`.
+
+ %(contour_set_attributes)s
+ """
+
+ def _process_args(self, *args, corner_mask=None, **kwargs):
+ """
+ Process args and kwargs.
+ """
+ if isinstance(args[0], QuadContourSet):
+ if self.levels is None:
+ self.levels = args[0].levels
+ self.zmin = args[0].zmin
+ self.zmax = args[0].zmax
+ self._corner_mask = args[0]._corner_mask
+ contour_generator = args[0]._contour_generator
+ self._mins = args[0]._mins
+ self._maxs = args[0]._maxs
+ else:
+ import matplotlib._contour as _contour
+
+ if corner_mask is None:
+ corner_mask = mpl.rcParams['contour.corner_mask']
+ self._corner_mask = corner_mask
+
+ x, y, z = self._contour_args(args, kwargs)
+
+ _mask = ma.getmask(z)
+ if _mask is ma.nomask or not _mask.any():
+ _mask = None
+
+ contour_generator = _contour.QuadContourGenerator(
+ x, y, z.filled(), _mask, self._corner_mask, self.nchunk)
+
+ t = self.get_transform()
+
+ # if the transform is not trans data, and some part of it
+ # contains transData, transform the xs and ys to data coordinates
+ if (t != self.axes.transData and
+ any(t.contains_branch_seperately(self.axes.transData))):
+ trans_to_data = t - self.axes.transData
+ pts = np.vstack([x.flat, y.flat]).T
+ transformed_pts = trans_to_data.transform(pts)
+ x = transformed_pts[..., 0]
+ y = transformed_pts[..., 1]
+
+ self._mins = [ma.min(x), ma.min(y)]
+ self._maxs = [ma.max(x), ma.max(y)]
+
+ self._contour_generator = contour_generator
+
+ return kwargs
+
+ def _get_allsegs_and_allkinds(self):
+ """Compute ``allsegs`` and ``allkinds`` using C extension."""
+ allsegs = []
+ if self.filled:
+ lowers, uppers = self._get_lowers_and_uppers()
+ allkinds = []
+ for level, level_upper in zip(lowers, uppers):
+ vertices, kinds = \
+ self._contour_generator.create_filled_contour(
+ level, level_upper)
+ allsegs.append(vertices)
+ allkinds.append(kinds)
+ else:
+ allkinds = None
+ for level in self.levels:
+ vertices = self._contour_generator.create_contour(level)
+ allsegs.append(vertices)
+ return allsegs, allkinds
+
+ def _contour_args(self, args, kwargs):
+ if self.filled:
+ fn = 'contourf'
+ else:
+ fn = 'contour'
+ Nargs = len(args)
+ if Nargs <= 2:
+ z = ma.asarray(args[0], dtype=np.float64)
+ x, y = self._initialize_x_y(z)
+ args = args[1:]
+ elif Nargs <= 4:
+ x, y, z = self._check_xyz(args[:3], kwargs)
+ args = args[3:]
+ else:
+ raise TypeError("Too many arguments to %s; see help(%s)" %
+ (fn, fn))
+ z = ma.masked_invalid(z, copy=False)
+ self.zmax = float(z.max())
+ self.zmin = float(z.min())
+ if self.logscale and self.zmin <= 0:
+ z = ma.masked_where(z <= 0, z)
+ _api.warn_external('Log scale: values of z <= 0 have been masked')
+ self.zmin = float(z.min())
+ self._process_contour_level_args(args)
+ return (x, y, z)
+
+ def _check_xyz(self, args, kwargs):
+ """
+ Check that the shapes of the input arrays match; if x and y are 1D,
+ convert them to 2D using meshgrid.
+ """
+ x, y = args[:2]
+ x, y = self.axes._process_unit_info([("x", x), ("y", y)], kwargs)
+
+ x = np.asarray(x, dtype=np.float64)
+ y = np.asarray(y, dtype=np.float64)
+ z = ma.asarray(args[2], dtype=np.float64)
+
+ if z.ndim != 2:
+ raise TypeError(f"Input z must be 2D, not {z.ndim}D")
+ if z.shape[0] < 2 or z.shape[1] < 2:
+ raise TypeError(f"Input z must be at least a (2, 2) shaped array, "
+ f"but has shape {z.shape}")
+ Ny, Nx = z.shape
+
+ if x.ndim != y.ndim:
+ raise TypeError(f"Number of dimensions of x ({x.ndim}) and y "
+ f"({y.ndim}) do not match")
+ if x.ndim == 1:
+ nx, = x.shape
+ ny, = y.shape
+ if nx != Nx:
+ raise TypeError(f"Length of x ({nx}) must match number of "
+ f"columns in z ({Nx})")
+ if ny != Ny:
+ raise TypeError(f"Length of y ({ny}) must match number of "
+ f"rows in z ({Ny})")
+ x, y = np.meshgrid(x, y)
+ elif x.ndim == 2:
+ if x.shape != z.shape:
+ raise TypeError(
+ f"Shapes of x {x.shape} and z {z.shape} do not match")
+ if y.shape != z.shape:
+ raise TypeError(
+ f"Shapes of y {y.shape} and z {z.shape} do not match")
+ else:
+ raise TypeError(f"Inputs x and y must be 1D or 2D, not {x.ndim}D")
+
+ return x, y, z
+
+ def _initialize_x_y(self, z):
+ """
+ Return X, Y arrays such that contour(Z) will match imshow(Z)
+ if origin is not None.
+ The center of pixel Z[i, j] depends on origin:
+ if origin is None, x = j, y = i;
+ if origin is 'lower', x = j + 0.5, y = i + 0.5;
+ if origin is 'upper', x = j + 0.5, y = Nrows - i - 0.5
+ If extent is not None, x and y will be scaled to match,
+ as in imshow.
+ If origin is None and extent is not None, then extent
+ will give the minimum and maximum values of x and y.
+ """
+ if z.ndim != 2:
+ raise TypeError(f"Input z must be 2D, not {z.ndim}D")
+ elif z.shape[0] < 2 or z.shape[1] < 2:
+ raise TypeError(f"Input z must be at least a (2, 2) shaped array, "
+ f"but has shape {z.shape}")
+ else:
+ Ny, Nx = z.shape
+ if self.origin is None: # Not for image-matching.
+ if self.extent is None:
+ return np.meshgrid(np.arange(Nx), np.arange(Ny))
+ else:
+ x0, x1, y0, y1 = self.extent
+ x = np.linspace(x0, x1, Nx)
+ y = np.linspace(y0, y1, Ny)
+ return np.meshgrid(x, y)
+ # Match image behavior:
+ if self.extent is None:
+ x0, x1, y0, y1 = (0, Nx, 0, Ny)
+ else:
+ x0, x1, y0, y1 = self.extent
+ dx = (x1 - x0) / Nx
+ dy = (y1 - y0) / Ny
+ x = x0 + (np.arange(Nx) + 0.5) * dx
+ y = y0 + (np.arange(Ny) + 0.5) * dy
+ if self.origin == 'upper':
+ y = y[::-1]
+ return np.meshgrid(x, y)
+
+ _contour_doc = """
+ `.contour` and `.contourf` draw contour lines and filled contours,
+ respectively. Except as noted, function signatures and return values
+ are the same for both versions.
+
+ Parameters
+ ----------
+ X, Y : array-like, optional
+ The coordinates of the values in *Z*.
+
+ *X* and *Y* must both be 2D with the same shape as *Z* (e.g.
+ created via `numpy.meshgrid`), or they must both be 1-D such
+ that ``len(X) == M`` is the number of columns in *Z* and
+ ``len(Y) == N`` is the number of rows in *Z*.
+
+ If not given, they are assumed to be integer indices, i.e.
+ ``X = range(M)``, ``Y = range(N)``.
+
+ Z : (M, N) array-like
+ The height values over which the contour is drawn.
+
+ levels : int or array-like, optional
+ Determines the number and positions of the contour lines / regions.
+
+ If an int *n*, use `~matplotlib.ticker.MaxNLocator`, which tries
+ to automatically choose no more than *n+1* "nice" contour levels
+ between *vmin* and *vmax*.
+
+ If array-like, draw contour lines at the specified levels.
+ The values must be in increasing order.
+
+ Returns
+ -------
+ `~.contour.QuadContourSet`
+
+ Other Parameters
+ ----------------
+ corner_mask : bool, default: :rc:`contour.corner_mask`
+ Enable/disable corner masking, which only has an effect if *Z* is
+ a masked array. If ``False``, any quad touching a masked point is
+ masked out. If ``True``, only the triangular corners of quads
+ nearest those points are always masked out, other triangular
+ corners comprising three unmasked points are contoured as usual.
+
+ colors : color string or sequence of colors, optional
+ The colors of the levels, i.e. the lines for `.contour` and the
+ areas for `.contourf`.
+
+ The sequence is cycled for the levels in ascending order. If the
+ sequence is shorter than the number of levels, it's repeated.
+
+ As a shortcut, single color strings may be used in place of
+ one-element lists, i.e. ``'red'`` instead of ``['red']`` to color
+ all levels with the same color. This shortcut does only work for
+ color strings, not for other ways of specifying colors.
+
+ By default (value *None*), the colormap specified by *cmap*
+ will be used.
+
+ alpha : float, default: 1
+ The alpha blending value, between 0 (transparent) and 1 (opaque).
+
+ cmap : str or `.Colormap`, default: :rc:`image.cmap`
+ A `.Colormap` instance or registered colormap name. The colormap
+ maps the level values to colors.
+
+ If both *colors* and *cmap* are given, an error is raised.
+
+ norm : `~matplotlib.colors.Normalize`, optional
+ If a colormap is used, the `.Normalize` instance scales the level
+ values to the canonical colormap range [0, 1] for mapping to
+ colors. If not given, the default linear scaling is used.
+
+ vmin, vmax : float, optional
+ If not *None*, either or both of these values will be supplied to
+ the `.Normalize` instance, overriding the default color scaling
+ based on *levels*.
+
+ origin : {*None*, 'upper', 'lower', 'image'}, default: None
+ Determines the orientation and exact position of *Z* by specifying
+ the position of ``Z[0, 0]``. This is only relevant, if *X*, *Y*
+ are not given.
+
+ - *None*: ``Z[0, 0]`` is at X=0, Y=0 in the lower left corner.
+ - 'lower': ``Z[0, 0]`` is at X=0.5, Y=0.5 in the lower left corner.
+ - 'upper': ``Z[0, 0]`` is at X=N+0.5, Y=0.5 in the upper left
+ corner.
+ - 'image': Use the value from :rc:`image.origin`.
+
+ extent : (x0, x1, y0, y1), optional
+ If *origin* is not *None*, then *extent* is interpreted as in
+ `.imshow`: it gives the outer pixel boundaries. In this case, the
+ position of Z[0, 0] is the center of the pixel, not a corner. If
+ *origin* is *None*, then (*x0*, *y0*) is the position of Z[0, 0],
+ and (*x1*, *y1*) is the position of Z[-1, -1].
+
+ This argument is ignored if *X* and *Y* are specified in the call
+ to contour.
+
+ locator : ticker.Locator subclass, optional
+ The locator is used to determine the contour levels if they
+ are not given explicitly via *levels*.
+ Defaults to `~.ticker.MaxNLocator`.
+
+ extend : {'neither', 'both', 'min', 'max'}, default: 'neither'
+ Determines the ``contourf``-coloring of values that are outside the
+ *levels* range.
+
+ If 'neither', values outside the *levels* range are not colored.
+ If 'min', 'max' or 'both', color the values below, above or below
+ and above the *levels* range.
+
+ Values below ``min(levels)`` and above ``max(levels)`` are mapped
+ to the under/over values of the `.Colormap`. Note that most
+ colormaps do not have dedicated colors for these by default, so
+ that the over and under values are the edge values of the colormap.
+ You may want to set these values explicitly using
+ `.Colormap.set_under` and `.Colormap.set_over`.
+
+ .. note::
+
+ An existing `.QuadContourSet` does not get notified if
+ properties of its colormap are changed. Therefore, an explicit
+ call `.QuadContourSet.changed()` is needed after modifying the
+ colormap. The explicit call can be left out, if a colorbar is
+ assigned to the `.QuadContourSet` because it internally calls
+ `.QuadContourSet.changed()`.
+
+ Example::
+
+ x = np.arange(1, 10)
+ y = x.reshape(-1, 1)
+ h = x * y
+
+ cs = plt.contourf(h, levels=[10, 30, 50],
+ colors=['#808080', '#A0A0A0', '#C0C0C0'], extend='both')
+ cs.cmap.set_over('red')
+ cs.cmap.set_under('blue')
+ cs.changed()
+
+ xunits, yunits : registered units, optional
+ Override axis units by specifying an instance of a
+ :class:`matplotlib.units.ConversionInterface`.
+
+ antialiased : bool, optional
+ Enable antialiasing, overriding the defaults. For
+ filled contours, the default is *True*. For line contours,
+ it is taken from :rc:`lines.antialiased`.
+
+ nchunk : int >= 0, optional
+ If 0, no subdivision of the domain. Specify a positive integer to
+ divide the domain into subdomains of *nchunk* by *nchunk* quads.
+ Chunking reduces the maximum length of polygons generated by the
+ contouring algorithm which reduces the rendering workload passed
+ on to the backend and also requires slightly less RAM. It can
+ however introduce rendering artifacts at chunk boundaries depending
+ on the backend, the *antialiased* flag and value of *alpha*.
+
+ linewidths : float or array-like, default: :rc:`contour.linewidth`
+ *Only applies to* `.contour`.
+
+ The line width of the contour lines.
+
+ If a number, all levels will be plotted with this linewidth.
+
+ If a sequence, the levels in ascending order will be plotted with
+ the linewidths in the order specified.
+
+ If None, this falls back to :rc:`lines.linewidth`.
+
+ linestyles : {*None*, 'solid', 'dashed', 'dashdot', 'dotted'}, optional
+ *Only applies to* `.contour`.
+
+ If *linestyles* is *None*, the default is 'solid' unless the lines
+ are monochrome. In that case, negative contours will take their
+ linestyle from :rc:`contour.negative_linestyle` setting.
+
+ *linestyles* can also be an iterable of the above strings
+ specifying a set of linestyles to be used. If this
+ iterable is shorter than the number of contour levels
+ it will be repeated as necessary.
+
+ hatches : list[str], optional
+ *Only applies to* `.contourf`.
+
+ A list of cross hatch patterns to use on the filled areas.
+ If None, no hatching will be added to the contour.
+ Hatching is supported in the PostScript, PDF, SVG and Agg
+ backends only.
+
+ Notes
+ -----
+ 1. `.contourf` differs from the MATLAB version in that it does not draw
+ the polygon edges. To draw edges, add line contours with calls to
+ `.contour`.
+
+ 2. `.contourf` fills intervals that are closed at the top; that is, for
+ boundaries *z1* and *z2*, the filled region is::
+
+ z1 < Z <= z2
+
+ except for the lowest interval, which is closed on both sides (i.e.
+ it includes the lowest value).
+ """
diff --git a/venv/Lib/site-packages/matplotlib/dates.py b/venv/Lib/site-packages/matplotlib/dates.py
new file mode 100644
index 0000000..8d226c0
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/dates.py
@@ -0,0 +1,1957 @@
+"""
+Matplotlib provides sophisticated date plotting capabilities, standing on the
+shoulders of python :mod:`datetime` and the add-on module :mod:`dateutil`.
+
+.. _date-format:
+
+Matplotlib date format
+----------------------
+
+Matplotlib represents dates using floating point numbers specifying the number
+of days since a default epoch of 1970-01-01 UTC; for example,
+1970-01-01, 06:00 is the floating point number 0.25. The formatters and
+locators require the use of `datetime.datetime` objects, so only dates between
+year 0001 and 9999 can be represented. Microsecond precision
+is achievable for (approximately) 70 years on either side of the epoch, and
+20 microseconds for the rest of the allowable range of dates (year 0001 to
+9999). The epoch can be changed at import time via `.dates.set_epoch` or
+:rc:`dates.epoch` to other dates if necessary; see
+:doc:`/gallery/ticks_and_spines/date_precision_and_epochs` for a discussion.
+
+.. note::
+
+ Before Matplotlib 3.3, the epoch was 0000-12-31 which lost modern
+ microsecond precision and also made the default axis limit of 0 an invalid
+ datetime. In 3.3 the epoch was changed as above. To convert old
+ ordinal floats to the new epoch, users can do::
+
+ new_ordinal = old_ordinal + mdates.date2num(np.datetime64('0000-12-31'))
+
+
+There are a number of helper functions to convert between :mod:`datetime`
+objects and Matplotlib dates:
+
+.. currentmodule:: matplotlib.dates
+
+.. autosummary::
+ :nosignatures:
+
+ datestr2num
+ date2num
+ num2date
+ num2timedelta
+ drange
+ set_epoch
+ get_epoch
+
+.. note::
+
+ Like Python's `datetime.datetime`, Matplotlib uses the Gregorian calendar
+ for all conversions between dates and floating point numbers. This practice
+ is not universal, and calendar differences can cause confusing
+ differences between what Python and Matplotlib give as the number of days
+ since 0001-01-01 and what other software and databases yield. For
+ example, the US Naval Observatory uses a calendar that switches
+ from Julian to Gregorian in October, 1582. Hence, using their
+ calculator, the number of days between 0001-01-01 and 2006-04-01 is
+ 732403, whereas using the Gregorian calendar via the datetime
+ module we find::
+
+ In [1]: date(2006, 4, 1).toordinal() - date(1, 1, 1).toordinal()
+ Out[1]: 732401
+
+All the Matplotlib date converters, tickers and formatters are timezone aware.
+If no explicit timezone is provided, :rc:`timezone` is assumed. If you want to
+use a custom time zone, pass a `datetime.tzinfo` instance with the tz keyword
+argument to `num2date`, `~.Axes.plot_date`, and any custom date tickers or
+locators you create.
+
+A wide range of specific and general purpose date tick locators and
+formatters are provided in this module. See
+:mod:`matplotlib.ticker` for general information on tick locators
+and formatters. These are described below.
+
+The dateutil_ module provides additional code to handle date ticking, making it
+easy to place ticks on any kinds of dates. See examples below.
+
+.. _dateutil: https://dateutil.readthedocs.io
+
+Date tickers
+------------
+
+Most of the date tickers can locate single or multiple values. For example::
+
+ # import constants for the days of the week
+ from matplotlib.dates import MO, TU, WE, TH, FR, SA, SU
+
+ # tick on mondays every week
+ loc = WeekdayLocator(byweekday=MO, tz=tz)
+
+ # tick on mondays and saturdays
+ loc = WeekdayLocator(byweekday=(MO, SA))
+
+In addition, most of the constructors take an interval argument::
+
+ # tick on mondays every second week
+ loc = WeekdayLocator(byweekday=MO, interval=2)
+
+The rrule locator allows completely general date ticking::
+
+ # tick every 5th easter
+ rule = rrulewrapper(YEARLY, byeaster=1, interval=5)
+ loc = RRuleLocator(rule)
+
+The available date tickers are:
+
+* `MicrosecondLocator`: Locate microseconds.
+
+* `SecondLocator`: Locate seconds.
+
+* `MinuteLocator`: Locate minutes.
+
+* `HourLocator`: Locate hours.
+
+* `DayLocator`: Locate specified days of the month.
+
+* `WeekdayLocator`: Locate days of the week, e.g., MO, TU.
+
+* `MonthLocator`: Locate months, e.g., 7 for July.
+
+* `YearLocator`: Locate years that are multiples of base.
+
+* `RRuleLocator`: Locate using a `matplotlib.dates.rrulewrapper`.
+ `.rrulewrapper` is a simple wrapper around dateutil_'s `dateutil.rrule` which
+ allow almost arbitrary date tick specifications. See :doc:`rrule example
+ `.
+
+* `AutoDateLocator`: On autoscale, this class picks the best `DateLocator`
+ (e.g., `RRuleLocator`) to set the view limits and the tick locations. If
+ called with ``interval_multiples=True`` it will make ticks line up with
+ sensible multiples of the tick intervals. E.g. if the interval is 4 hours,
+ it will pick hours 0, 4, 8, etc as ticks. This behaviour is not guaranteed
+ by default.
+
+Date formatters
+---------------
+
+The available date formatters are:
+
+* `AutoDateFormatter`: attempts to figure out the best format to use. This is
+ most useful when used with the `AutoDateLocator`.
+
+* `ConciseDateFormatter`: also attempts to figure out the best format to use,
+ and to make the format as compact as possible while still having complete
+ date information. This is most useful when used with the `AutoDateLocator`.
+
+* `DateFormatter`: use `~datetime.datetime.strftime` format strings.
+
+* `IndexDateFormatter`: date plots with implicit *x* indexing.
+"""
+
+import datetime
+import functools
+import logging
+import math
+import re
+
+from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY,
+ MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY,
+ SECONDLY)
+from dateutil.relativedelta import relativedelta
+import dateutil.parser
+import dateutil.tz
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib import _api, cbook, ticker, units
+
+__all__ = ('datestr2num', 'date2num', 'num2date', 'num2timedelta', 'drange',
+ 'epoch2num', 'num2epoch', 'set_epoch', 'get_epoch', 'DateFormatter',
+ 'ConciseDateFormatter', 'IndexDateFormatter', 'AutoDateFormatter',
+ 'DateLocator', 'RRuleLocator', 'AutoDateLocator', 'YearLocator',
+ 'MonthLocator', 'WeekdayLocator',
+ 'DayLocator', 'HourLocator', 'MinuteLocator',
+ 'SecondLocator', 'MicrosecondLocator',
+ 'rrule', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU',
+ 'YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY',
+ 'HOURLY', 'MINUTELY', 'SECONDLY', 'MICROSECONDLY', 'relativedelta',
+ 'DateConverter', 'ConciseDateConverter')
+
+
+_log = logging.getLogger(__name__)
+UTC = datetime.timezone.utc
+
+
+def _get_rc_timezone():
+ """Retrieve the preferred timezone from the rcParams dictionary."""
+ s = mpl.rcParams['timezone']
+ if s == 'UTC':
+ return UTC
+ return dateutil.tz.gettz(s)
+
+
+"""
+Time-related constants.
+"""
+EPOCH_OFFSET = float(datetime.datetime(1970, 1, 1).toordinal())
+# EPOCH_OFFSET is not used by matplotlib
+JULIAN_OFFSET = 1721424.5 # Julian date at 0000-12-31
+# note that the Julian day epoch is achievable w/
+# np.datetime64('-4713-11-24T12:00:00'); datetime64 is proleptic
+# Gregorian and BC has a one-year offset. So
+# np.datetime64('0000-12-31') - np.datetime64('-4713-11-24T12:00') = 1721424.5
+# Ref: https://en.wikipedia.org/wiki/Julian_day
+MICROSECONDLY = SECONDLY + 1
+HOURS_PER_DAY = 24.
+MIN_PER_HOUR = 60.
+SEC_PER_MIN = 60.
+MONTHS_PER_YEAR = 12.
+
+DAYS_PER_WEEK = 7.
+DAYS_PER_MONTH = 30.
+DAYS_PER_YEAR = 365.0
+
+MINUTES_PER_DAY = MIN_PER_HOUR * HOURS_PER_DAY
+
+SEC_PER_HOUR = SEC_PER_MIN * MIN_PER_HOUR
+SEC_PER_DAY = SEC_PER_HOUR * HOURS_PER_DAY
+SEC_PER_WEEK = SEC_PER_DAY * DAYS_PER_WEEK
+
+MUSECONDS_PER_DAY = 1e6 * SEC_PER_DAY
+
+MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY = (
+ MO, TU, WE, TH, FR, SA, SU)
+WEEKDAYS = (MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY)
+
+# default epoch: passed to np.datetime64...
+_epoch = None
+
+
+def _reset_epoch_test_example():
+ """
+ Reset the Matplotlib date epoch so it can be set again.
+
+ Only for use in tests and examples.
+ """
+ global _epoch
+ _epoch = None
+
+
+def set_epoch(epoch):
+ """
+ Set the epoch (origin for dates) for datetime calculations.
+
+ The default epoch is :rc:`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.
+
+ `~.dates.set_epoch` must be called before any dates are converted
+ (i.e. near the import section) or a RuntimeError will be raised.
+
+ See also :doc:`/gallery/ticks_and_spines/date_precision_and_epochs`.
+
+ Parameters
+ ----------
+ epoch : str
+ valid UTC date parsable by `numpy.datetime64` (do not include
+ timezone).
+
+ """
+ global _epoch
+ if _epoch is not None:
+ raise RuntimeError('set_epoch must be called before dates plotted.')
+ _epoch = epoch
+
+
+def get_epoch():
+ """
+ Get the epoch used by `.dates`.
+
+ Returns
+ -------
+ epoch : str
+ String for the epoch (parsable by `numpy.datetime64`).
+ """
+ global _epoch
+
+ if _epoch is None:
+ _epoch = mpl.rcParams['date.epoch']
+ return _epoch
+
+
+def _dt64_to_ordinalf(d):
+ """
+ Convert `numpy.datetime64` or an ndarray of those types to Gregorian
+ date as UTC float relative to the epoch (see `.get_epoch`). Roundoff
+ is float64 precision. Practically: microseconds for dates between
+ 290301 BC, 294241 AD, milliseconds for larger dates
+ (see `numpy.datetime64`).
+ """
+
+ # the "extra" ensures that we at least allow the dynamic range out to
+ # seconds. That should get out to +/-2e11 years.
+ dseconds = d.astype('datetime64[s]')
+ extra = (d - dseconds).astype('timedelta64[ns]')
+ t0 = np.datetime64(get_epoch(), 's')
+ dt = (dseconds - t0).astype(np.float64)
+ dt += extra.astype(np.float64) / 1.0e9
+ dt = dt / SEC_PER_DAY
+
+ NaT_int = np.datetime64('NaT').astype(np.int64)
+ d_int = d.astype(np.int64)
+ try:
+ dt[d_int == NaT_int] = np.nan
+ except TypeError:
+ if d_int == NaT_int:
+ dt = np.nan
+ return dt
+
+
+def _from_ordinalf(x, tz=None):
+ """
+ Convert Gregorian float of the date, preserving hours, minutes,
+ seconds and microseconds. Return value is a `.datetime`.
+
+ The input date *x* is a float in ordinal days at UTC, and the output will
+ be the specified `.datetime` object corresponding to that time in
+ timezone *tz*, or if *tz* is ``None``, in the timezone specified in
+ :rc:`timezone`.
+ """
+
+ if tz is None:
+ tz = _get_rc_timezone()
+
+ dt = (np.datetime64(get_epoch()) +
+ np.timedelta64(int(np.round(x * MUSECONDS_PER_DAY)), 'us'))
+ if dt < np.datetime64('0001-01-01') or dt >= np.datetime64('10000-01-01'):
+ raise ValueError(f'Date ordinal {x} converts to {dt} (using '
+ f'epoch {get_epoch()}), but Matplotlib dates must be '
+ 'between year 0001 and 9999.')
+ # convert from datetime64 to datetime:
+ dt = dt.tolist()
+
+ # datetime64 is always UTC:
+ dt = dt.replace(tzinfo=dateutil.tz.gettz('UTC'))
+ # but maybe we are working in a different timezone so move.
+ dt = dt.astimezone(tz)
+ # fix round off errors
+ if np.abs(x) > 70 * 365:
+ # if x is big, round off to nearest twenty microseconds.
+ # This avoids floating point roundoff error
+ ms = round(dt.microsecond / 20) * 20
+ if ms == 1000000:
+ dt = dt.replace(microsecond=0) + datetime.timedelta(seconds=1)
+ else:
+ dt = dt.replace(microsecond=ms)
+
+ return dt
+
+
+# a version of _from_ordinalf that can operate on numpy arrays
+_from_ordinalf_np_vectorized = np.vectorize(_from_ordinalf, otypes="O")
+
+
+# a version of dateutil.parser.parse that can operate on numpy arrays
+_dateutil_parser_parse_np_vectorized = np.vectorize(dateutil.parser.parse)
+
+
+def datestr2num(d, default=None):
+ """
+ Convert a date string to a datenum using `dateutil.parser.parse`.
+
+ Parameters
+ ----------
+ d : str or sequence of str
+ The dates to convert.
+
+ default : datetime.datetime, optional
+ The default date to use when fields are missing in *d*.
+ """
+ if isinstance(d, str):
+ dt = dateutil.parser.parse(d, default=default)
+ return date2num(dt)
+ else:
+ if default is not None:
+ d = [dateutil.parser.parse(s, default=default) for s in d]
+ d = np.asarray(d)
+ if not d.size:
+ return d
+ return date2num(_dateutil_parser_parse_np_vectorized(d))
+
+
+def date2num(d):
+ """
+ Convert datetime objects to Matplotlib dates.
+
+ Parameters
+ ----------
+ d : `datetime.datetime` or `numpy.datetime64` or sequences of these
+
+ Returns
+ -------
+ float or sequence of floats
+ Number of days since the epoch. See `.get_epoch` for the
+ epoch, which can be changed by :rc:`date.epoch` or `.set_epoch`. If
+ the epoch is "1970-01-01T00:00:00" (default) then noon Jan 1 1970
+ ("1970-01-01T12:00:00") returns 0.5.
+
+ Notes
+ -----
+ The Gregorian calendar is assumed; this is not universal practice.
+ For details see the module docstring.
+ """
+ if hasattr(d, "values"):
+ # this unpacks pandas series or dataframes...
+ d = d.values
+
+ # make an iterable, but save state to unpack later:
+ iterable = np.iterable(d)
+ if not iterable:
+ d = [d]
+
+ d = np.asarray(d)
+ # convert to datetime64 arrays, if not already:
+ if not np.issubdtype(d.dtype, np.datetime64):
+ # datetime arrays
+ if not d.size:
+ # deals with an empty array...
+ return d
+ tzi = getattr(d[0], 'tzinfo', None)
+ if tzi is not None:
+ # make datetime naive:
+ d = [dt.astimezone(UTC).replace(tzinfo=None) for dt in d]
+ d = np.asarray(d)
+ d = d.astype('datetime64[us]')
+
+ d = _dt64_to_ordinalf(d)
+
+ return d if iterable else d[0]
+
+
+def julian2num(j):
+ """
+ Convert a Julian date (or sequence) to a Matplotlib date (or sequence).
+
+ Parameters
+ ----------
+ j : float or sequence of floats
+ Julian dates (days relative to 4713 BC Jan 1, 12:00:00 Julian
+ calendar or 4714 BC Nov 24, 12:00:00, proleptic Gregorian calendar).
+
+ Returns
+ -------
+ float or sequence of floats
+ Matplotlib dates (days relative to `.get_epoch`).
+ """
+ ep = np.datetime64(get_epoch(), 'h').astype(float) / 24.
+ ep0 = np.datetime64('0000-12-31T00:00:00', 'h').astype(float) / 24.
+ # Julian offset defined above is relative to 0000-12-31, but we need
+ # relative to our current epoch:
+ dt = JULIAN_OFFSET - ep0 + ep
+ return np.subtract(j, dt) # Handles both scalar & nonscalar j.
+
+
+def num2julian(n):
+ """
+ Convert a Matplotlib date (or sequence) to a Julian date (or sequence).
+
+ Parameters
+ ----------
+ n : float or sequence of floats
+ Matplotlib dates (days relative to `.get_epoch`).
+
+ Returns
+ -------
+ float or sequence of floats
+ Julian dates (days relative to 4713 BC Jan 1, 12:00:00).
+ """
+ ep = np.datetime64(get_epoch(), 'h').astype(float) / 24.
+ ep0 = np.datetime64('0000-12-31T00:00:00', 'h').astype(float) / 24.
+ # Julian offset defined above is relative to 0000-12-31, but we need
+ # relative to our current epoch:
+ dt = JULIAN_OFFSET - ep0 + ep
+ return np.add(n, dt) # Handles both scalar & nonscalar j.
+
+
+def num2date(x, tz=None):
+ """
+ Convert Matplotlib dates to `~datetime.datetime` objects.
+
+ Parameters
+ ----------
+ x : float or sequence of floats
+ Number of days (fraction part represents hours, minutes, seconds)
+ since the epoch. See `.get_epoch` for the
+ epoch, which can be changed by :rc:`date.epoch` or `.set_epoch`.
+ tz : str, default: :rc:`timezone`
+ Timezone of *x*.
+
+ Returns
+ -------
+ `~datetime.datetime` or sequence of `~datetime.datetime`
+ Dates are returned in timezone *tz*.
+
+ If *x* is a sequence, a sequence of `~datetime.datetime` objects will
+ be returned.
+
+ Notes
+ -----
+ The addition of one here is a historical artifact. Also, note that the
+ Gregorian calendar is assumed; this is not universal practice.
+ For details, see the module docstring.
+ """
+ if tz is None:
+ tz = _get_rc_timezone()
+ return _from_ordinalf_np_vectorized(x, tz).tolist()
+
+
+_ordinalf_to_timedelta_np_vectorized = np.vectorize(
+ lambda x: datetime.timedelta(days=x), otypes="O")
+
+
+def num2timedelta(x):
+ """
+ Convert number of days to a `~datetime.timedelta` object.
+
+ If *x* is a sequence, a sequence of `~datetime.timedelta` objects will
+ be returned.
+
+ Parameters
+ ----------
+ x : float, sequence of floats
+ Number of days. The fraction part represents hours, minutes, seconds.
+
+ Returns
+ -------
+ `datetime.timedelta` or list[`datetime.timedelta`]
+ """
+ return _ordinalf_to_timedelta_np_vectorized(x).tolist()
+
+
+def drange(dstart, dend, delta):
+ """
+ Return a sequence of equally spaced Matplotlib dates.
+
+ The dates start at *dstart* and reach up to, but not including *dend*.
+ They are spaced by *delta*.
+
+ Parameters
+ ----------
+ dstart, dend : `~datetime.datetime`
+ The date limits.
+ delta : `datetime.timedelta`
+ Spacing of the dates.
+
+ Returns
+ -------
+ `numpy.array`
+ A list floats representing Matplotlib dates.
+
+ """
+ f1 = date2num(dstart)
+ f2 = date2num(dend)
+ step = delta.total_seconds() / SEC_PER_DAY
+
+ # calculate the difference between dend and dstart in times of delta
+ num = int(np.ceil((f2 - f1) / step))
+
+ # calculate end of the interval which will be generated
+ dinterval_end = dstart + num * delta
+
+ # ensure, that an half open interval will be generated [dstart, dend)
+ if dinterval_end >= dend:
+ # if the endpoint is greater than dend, just subtract one delta
+ dinterval_end -= delta
+ num -= 1
+
+ f2 = date2num(dinterval_end) # new float-endpoint
+ return np.linspace(f1, f2, num + 1)
+
+
+def _wrap_in_tex(text):
+ # Braces ensure dashes are not spaced like binary operators.
+ return '$\\mathdefault{' + text.replace('-', '{-}') + '}$'
+
+
+## date tickers and formatters ###
+
+
+class DateFormatter(ticker.Formatter):
+ """
+ Format a tick (in days since the epoch) with a
+ `~datetime.datetime.strftime` format string.
+ """
+
+ @_api.deprecated("3.3")
+ @property
+ def illegal_s(self):
+ return re.compile(r"((^|[^%])(%%)*%s)")
+
+ def __init__(self, fmt, tz=None, *, usetex=None):
+ """
+ Parameters
+ ----------
+ fmt : str
+ `~datetime.datetime.strftime` format string
+ tz : `datetime.tzinfo`, default: :rc:`timezone`
+ Ticks timezone.
+ usetex : bool, default: :rc:`text.usetex`
+ To enable/disable the use of TeX's math mode for rendering the
+ results of the formatter.
+ """
+ if tz is None:
+ tz = _get_rc_timezone()
+ self.fmt = fmt
+ self.tz = tz
+ self._usetex = (usetex if usetex is not None else
+ mpl.rcParams['text.usetex'])
+
+ def __call__(self, x, pos=0):
+ result = num2date(x, self.tz).strftime(self.fmt)
+ return _wrap_in_tex(result) if self._usetex else result
+
+ def set_tzinfo(self, tz):
+ self.tz = tz
+
+
+@_api.deprecated("3.3")
+class IndexDateFormatter(ticker.Formatter):
+ """Use with `.IndexLocator` to cycle format strings by index."""
+
+ def __init__(self, t, fmt, tz=None):
+ """
+ Parameters
+ ----------
+ t : list of float
+ A sequence of dates (floating point days).
+ fmt : str
+ A `~datetime.datetime.strftime` format string.
+ """
+ if tz is None:
+ tz = _get_rc_timezone()
+ self.t = t
+ self.fmt = fmt
+ self.tz = tz
+
+ def __call__(self, x, pos=0):
+ """Return the label for time *x* at position *pos*."""
+ ind = int(round(x))
+ if ind >= len(self.t) or ind <= 0:
+ return ''
+ return num2date(self.t[ind], self.tz).strftime(self.fmt)
+
+
+class ConciseDateFormatter(ticker.Formatter):
+ """
+ A `.Formatter` which attempts to figure out the best format to use for the
+ date, and to make it as compact as possible, but still be complete. This is
+ most useful when used with the `AutoDateLocator`::
+
+ >>> locator = AutoDateLocator()
+ >>> formatter = ConciseDateFormatter(locator)
+
+ Parameters
+ ----------
+ locator : `.ticker.Locator`
+ Locator that this axis is using.
+
+ tz : str, optional
+ Passed to `.dates.date2num`.
+
+ formats : list of 6 strings, optional
+ Format strings for 6 levels of tick labelling: mostly years,
+ months, days, hours, minutes, and seconds. Strings use
+ the same format codes as `~datetime.datetime.strftime`. Default is
+ ``['%Y', '%b', '%d', '%H:%M', '%H:%M', '%S.%f']``
+
+ zero_formats : list of 6 strings, optional
+ Format strings for tick labels that are "zeros" for a given tick
+ level. For instance, if most ticks are months, ticks around 1 Jan 2005
+ will be labeled "Dec", "2005", "Feb". The default is
+ ``['', '%Y', '%b', '%b-%d', '%H:%M', '%H:%M']``
+
+ offset_formats : list of 6 strings, optional
+ Format strings for the 6 levels that is applied to the "offset"
+ string found on the right side of an x-axis, or top of a y-axis.
+ Combined with the tick labels this should completely specify the
+ date. The default is::
+
+ ['', '%Y', '%Y-%b', '%Y-%b-%d', '%Y-%b-%d', '%Y-%b-%d %H:%M']
+
+ show_offset : bool, default: True
+ Whether to show the offset or not.
+
+ usetex : bool, default: :rc:`text.usetex`
+ To enable/disable the use of TeX's math mode for rendering the results
+ of the formatter.
+
+ Examples
+ --------
+ See :doc:`/gallery/ticks_and_spines/date_concise_formatter`
+
+ .. plot::
+
+ import datetime
+ import matplotlib.dates as mdates
+
+ base = datetime.datetime(2005, 2, 1)
+ dates = np.array([base + datetime.timedelta(hours=(2 * i))
+ for i in range(732)])
+ N = len(dates)
+ np.random.seed(19680801)
+ y = np.cumsum(np.random.randn(N))
+
+ fig, ax = plt.subplots(constrained_layout=True)
+ locator = mdates.AutoDateLocator()
+ formatter = mdates.ConciseDateFormatter(locator)
+ ax.xaxis.set_major_locator(locator)
+ ax.xaxis.set_major_formatter(formatter)
+
+ ax.plot(dates, y)
+ ax.set_title('Concise Date Formatter')
+
+ """
+
+ def __init__(self, locator, tz=None, formats=None, offset_formats=None,
+ zero_formats=None, show_offset=True, *, usetex=None):
+ """
+ Autoformat the date labels. The default format is used to form an
+ initial string, and then redundant elements are removed.
+ """
+ self._locator = locator
+ self._tz = tz
+ self.defaultfmt = '%Y'
+ # there are 6 levels with each level getting a specific format
+ # 0: mostly years, 1: months, 2: days,
+ # 3: hours, 4: minutes, 5: seconds
+ if formats:
+ if len(formats) != 6:
+ raise ValueError('formats argument must be a list of '
+ '6 format strings (or None)')
+ self.formats = formats
+ else:
+ self.formats = ['%Y', # ticks are mostly years
+ '%b', # ticks are mostly months
+ '%d', # ticks are mostly days
+ '%H:%M', # hrs
+ '%H:%M', # min
+ '%S.%f', # secs
+ ]
+ # fmt for zeros ticks at this level. These are
+ # ticks that should be labeled w/ info the level above.
+ # like 1 Jan can just be labelled "Jan". 02:02:00 can
+ # just be labeled 02:02.
+ if zero_formats:
+ if len(zero_formats) != 6:
+ raise ValueError('zero_formats argument must be a list of '
+ '6 format strings (or None)')
+ self.zero_formats = zero_formats
+ elif formats:
+ # use the users formats for the zero tick formats
+ self.zero_formats = [''] + self.formats[:-1]
+ else:
+ # make the defaults a bit nicer:
+ self.zero_formats = [''] + self.formats[:-1]
+ self.zero_formats[3] = '%b-%d'
+
+ if offset_formats:
+ if len(offset_formats) != 6:
+ raise ValueError('offsetfmts argument must be a list of '
+ '6 format strings (or None)')
+ self.offset_formats = offset_formats
+ else:
+ self.offset_formats = ['',
+ '%Y',
+ '%Y-%b',
+ '%Y-%b-%d',
+ '%Y-%b-%d',
+ '%Y-%b-%d %H:%M']
+ self.offset_string = ''
+ self.show_offset = show_offset
+ self._usetex = (usetex if usetex is not None else
+ mpl.rcParams['text.usetex'])
+
+ def __call__(self, x, pos=None):
+ formatter = DateFormatter(self.defaultfmt, self._tz,
+ usetex=self._usetex)
+ return formatter(x, pos=pos)
+
+ def format_ticks(self, values):
+ tickdatetime = [num2date(value, tz=self._tz) for value in values]
+ tickdate = np.array([tdt.timetuple()[:6] for tdt in tickdatetime])
+
+ # basic algorithm:
+ # 1) only display a part of the date if it changes over the ticks.
+ # 2) don't display the smaller part of the date if:
+ # it is always the same or if it is the start of the
+ # year, month, day etc.
+ # fmt for most ticks at this level
+ fmts = self.formats
+ # format beginnings of days, months, years, etc...
+ zerofmts = self.zero_formats
+ # offset fmt are for the offset in the upper left of the
+ # or lower right of the axis.
+ offsetfmts = self.offset_formats
+
+ # determine the level we will label at:
+ # mostly 0: years, 1: months, 2: days,
+ # 3: hours, 4: minutes, 5: seconds, 6: microseconds
+ for level in range(5, -1, -1):
+ if len(np.unique(tickdate[:, level])) > 1:
+ # level is less than 2 so a year is already present in the axis
+ if (level < 2):
+ self.show_offset = False
+ break
+ elif level == 0:
+ # all tickdate are the same, so only micros might be different
+ # set to the most precise (6: microseconds doesn't exist...)
+ level = 5
+
+ # level is the basic level we will label at.
+ # now loop through and decide the actual ticklabels
+ zerovals = [0, 1, 1, 0, 0, 0, 0]
+ labels = [''] * len(tickdate)
+ for nn in range(len(tickdate)):
+ if level < 5:
+ if tickdate[nn][level] == zerovals[level]:
+ fmt = zerofmts[level]
+ else:
+ fmt = fmts[level]
+ else:
+ # special handling for seconds + microseconds
+ if (tickdatetime[nn].second == tickdatetime[nn].microsecond
+ == 0):
+ fmt = zerofmts[level]
+ else:
+ fmt = fmts[level]
+ labels[nn] = tickdatetime[nn].strftime(fmt)
+
+ # special handling of seconds and microseconds:
+ # strip extra zeros and decimal if possible.
+ # this is complicated by two factors. 1) we have some level-4 strings
+ # here (i.e. 03:00, '0.50000', '1.000') 2) we would like to have the
+ # same number of decimals for each string (i.e. 0.5 and 1.0).
+ if level >= 5:
+ trailing_zeros = min(
+ (len(s) - len(s.rstrip('0')) for s in labels if '.' in s),
+ default=None)
+ if trailing_zeros:
+ for nn in range(len(labels)):
+ if '.' in labels[nn]:
+ labels[nn] = labels[nn][:-trailing_zeros].rstrip('.')
+
+ if self.show_offset:
+ # set the offset string:
+ self.offset_string = tickdatetime[-1].strftime(offsetfmts[level])
+ if self._usetex:
+ self.offset_string = _wrap_in_tex(self.offset_string)
+
+ if self._usetex:
+ return [_wrap_in_tex(l) for l in labels]
+ else:
+ return labels
+
+ def get_offset(self):
+ return self.offset_string
+
+ def format_data_short(self, value):
+ return num2date(value, tz=self._tz).strftime('%Y-%m-%d %H:%M:%S')
+
+
+class AutoDateFormatter(ticker.Formatter):
+ """
+ A `.Formatter` which attempts to figure out the best format to use. This
+ is most useful when used with the `AutoDateLocator`.
+
+ The AutoDateFormatter has a scale dictionary that maps the scale
+ of the tick (the distance in days between one major tick) and a
+ format string. The default looks like this::
+
+ self.scaled = {
+ DAYS_PER_YEAR: rcParams['date.autoformat.year'],
+ DAYS_PER_MONTH: rcParams['date.autoformat.month'],
+ 1.0: rcParams['date.autoformat.day'],
+ 1. / HOURS_PER_DAY: rcParams['date.autoformat.hour'],
+ 1. / (MINUTES_PER_DAY): rcParams['date.autoformat.minute'],
+ 1. / (SEC_PER_DAY): rcParams['date.autoformat.second'],
+ 1. / (MUSECONDS_PER_DAY): rcParams['date.autoformat.microsecond'],
+ }
+
+ The algorithm picks the key in the dictionary that is >= the
+ current scale and uses that format string. You can customize this
+ dictionary by doing::
+
+ >>> locator = AutoDateLocator()
+ >>> formatter = AutoDateFormatter(locator)
+ >>> formatter.scaled[1/(24.*60.)] = '%M:%S' # only show min and sec
+
+ A custom `.FuncFormatter` can also be used. The following example shows
+ how to use a custom format function to strip trailing zeros from decimal
+ seconds and adds the date to the first ticklabel::
+
+ >>> def my_format_function(x, pos=None):
+ ... x = matplotlib.dates.num2date(x)
+ ... if pos == 0:
+ ... fmt = '%D %H:%M:%S.%f'
+ ... else:
+ ... fmt = '%H:%M:%S.%f'
+ ... label = x.strftime(fmt)
+ ... label = label.rstrip("0")
+ ... label = label.rstrip(".")
+ ... return label
+ >>> from matplotlib.ticker import FuncFormatter
+ >>> formatter.scaled[1/(24.*60.)] = FuncFormatter(my_format_function)
+ """
+
+ # This can be improved by providing some user-level direction on
+ # how to choose the best format (precedence, etc...)
+
+ # Perhaps a 'struct' that has a field for each time-type where a
+ # zero would indicate "don't show" and a number would indicate
+ # "show" with some sort of priority. Same priorities could mean
+ # show all with the same priority.
+
+ # Or more simply, perhaps just a format string for each
+ # possibility...
+
+ def __init__(self, locator, tz=None, defaultfmt='%Y-%m-%d', *,
+ usetex=None):
+ """
+ Autoformat the date labels.
+
+ Parameters
+ ----------
+ locator : `.ticker.Locator`
+ Locator that this axis is using.
+
+ tz : str, optional
+ Passed to `.dates.date2num`.
+
+ defaultfmt : str
+ The default format to use if none of the values in ``self.scaled``
+ are greater than the unit returned by ``locator._get_unit()``.
+
+ usetex : bool, default: :rc:`text.usetex`
+ To enable/disable the use of TeX's math mode for rendering the
+ results of the formatter. If any entries in ``self.scaled`` are set
+ as functions, then it is up to the customized function to enable or
+ disable TeX's math mode itself.
+ """
+ self._locator = locator
+ self._tz = tz
+ self.defaultfmt = defaultfmt
+ self._formatter = DateFormatter(self.defaultfmt, tz)
+ rcParams = mpl.rcParams
+ self._usetex = (usetex if usetex is not None else
+ mpl.rcParams['text.usetex'])
+ self.scaled = {
+ DAYS_PER_YEAR: rcParams['date.autoformatter.year'],
+ DAYS_PER_MONTH: rcParams['date.autoformatter.month'],
+ 1: rcParams['date.autoformatter.day'],
+ 1 / HOURS_PER_DAY: rcParams['date.autoformatter.hour'],
+ 1 / MINUTES_PER_DAY: rcParams['date.autoformatter.minute'],
+ 1 / SEC_PER_DAY: rcParams['date.autoformatter.second'],
+ 1 / MUSECONDS_PER_DAY: rcParams['date.autoformatter.microsecond']
+ }
+
+ def _set_locator(self, locator):
+ self._locator = locator
+
+ def __call__(self, x, pos=None):
+ try:
+ locator_unit_scale = float(self._locator._get_unit())
+ except AttributeError:
+ locator_unit_scale = 1
+ # Pick the first scale which is greater than the locator unit.
+ fmt = next((fmt for scale, fmt in sorted(self.scaled.items())
+ if scale >= locator_unit_scale),
+ self.defaultfmt)
+
+ if isinstance(fmt, str):
+ self._formatter = DateFormatter(fmt, self._tz, usetex=self._usetex)
+ result = self._formatter(x, pos)
+ elif callable(fmt):
+ result = fmt(x, pos)
+ else:
+ raise TypeError('Unexpected type passed to {0!r}.'.format(self))
+
+ return result
+
+
+class rrulewrapper:
+ def __init__(self, freq, tzinfo=None, **kwargs):
+ kwargs['freq'] = freq
+ self._base_tzinfo = tzinfo
+
+ self._update_rrule(**kwargs)
+
+ def set(self, **kwargs):
+ self._construct.update(kwargs)
+
+ self._update_rrule(**self._construct)
+
+ def _update_rrule(self, **kwargs):
+ tzinfo = self._base_tzinfo
+
+ # rrule does not play nicely with time zones - especially pytz time
+ # zones, it's best to use naive zones and attach timezones once the
+ # datetimes are returned
+ if 'dtstart' in kwargs:
+ dtstart = kwargs['dtstart']
+ if dtstart.tzinfo is not None:
+ if tzinfo is None:
+ tzinfo = dtstart.tzinfo
+ else:
+ dtstart = dtstart.astimezone(tzinfo)
+
+ kwargs['dtstart'] = dtstart.replace(tzinfo=None)
+
+ if 'until' in kwargs:
+ until = kwargs['until']
+ if until.tzinfo is not None:
+ if tzinfo is not None:
+ until = until.astimezone(tzinfo)
+ else:
+ raise ValueError('until cannot be aware if dtstart '
+ 'is naive and tzinfo is None')
+
+ kwargs['until'] = until.replace(tzinfo=None)
+
+ self._construct = kwargs.copy()
+ self._tzinfo = tzinfo
+ self._rrule = rrule(**self._construct)
+
+ def _attach_tzinfo(self, dt, tzinfo):
+ # pytz zones are attached by "localizing" the datetime
+ if hasattr(tzinfo, 'localize'):
+ return tzinfo.localize(dt, is_dst=True)
+
+ return dt.replace(tzinfo=tzinfo)
+
+ def _aware_return_wrapper(self, f, returns_list=False):
+ """Decorator function that allows rrule methods to handle tzinfo."""
+ # This is only necessary if we're actually attaching a tzinfo
+ if self._tzinfo is None:
+ return f
+
+ # All datetime arguments must be naive. If they are not naive, they are
+ # converted to the _tzinfo zone before dropping the zone.
+ def normalize_arg(arg):
+ if isinstance(arg, datetime.datetime) and arg.tzinfo is not None:
+ if arg.tzinfo is not self._tzinfo:
+ arg = arg.astimezone(self._tzinfo)
+
+ return arg.replace(tzinfo=None)
+
+ return arg
+
+ def normalize_args(args, kwargs):
+ args = tuple(normalize_arg(arg) for arg in args)
+ kwargs = {kw: normalize_arg(arg) for kw, arg in kwargs.items()}
+
+ return args, kwargs
+
+ # There are two kinds of functions we care about - ones that return
+ # dates and ones that return lists of dates.
+ if not returns_list:
+ def inner_func(*args, **kwargs):
+ args, kwargs = normalize_args(args, kwargs)
+ dt = f(*args, **kwargs)
+ return self._attach_tzinfo(dt, self._tzinfo)
+ else:
+ def inner_func(*args, **kwargs):
+ args, kwargs = normalize_args(args, kwargs)
+ dts = f(*args, **kwargs)
+ return [self._attach_tzinfo(dt, self._tzinfo) for dt in dts]
+
+ return functools.wraps(f)(inner_func)
+
+ def __getattr__(self, name):
+ if name in self.__dict__:
+ return self.__dict__[name]
+
+ f = getattr(self._rrule, name)
+
+ if name in {'after', 'before'}:
+ return self._aware_return_wrapper(f)
+ elif name in {'xafter', 'xbefore', 'between'}:
+ return self._aware_return_wrapper(f, returns_list=True)
+ else:
+ return f
+
+ def __setstate__(self, state):
+ self.__dict__.update(state)
+
+
+class DateLocator(ticker.Locator):
+ """
+ Determines the tick locations when plotting dates.
+
+ This class is subclassed by other Locators and
+ is not meant to be used on its own.
+ """
+ hms0d = {'byhour': 0, 'byminute': 0, 'bysecond': 0}
+
+ def __init__(self, tz=None):
+ """
+ Parameters
+ ----------
+ tz : `datetime.tzinfo`
+ """
+ if tz is None:
+ tz = _get_rc_timezone()
+ self.tz = tz
+
+ def set_tzinfo(self, tz):
+ """
+ Set time zone info.
+ """
+ self.tz = tz
+
+ 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
+
+ return num2date(dmin, self.tz), num2date(dmax, self.tz)
+
+ def viewlim_to_dt(self):
+ """Convert the view interval to datetime objects."""
+ vmin, vmax = self.axis.get_view_interval()
+ if vmin > vmax:
+ vmin, vmax = vmax, vmin
+ return num2date(vmin, self.tz), num2date(vmax, self.tz)
+
+ def _get_unit(self):
+ """
+ Return how many days a unit of the locator is; used for
+ intelligent autoscaling.
+ """
+ return 1
+
+ def _get_interval(self):
+ """
+ Return the number of units for each tick.
+ """
+ return 1
+
+ def nonsingular(self, vmin, vmax):
+ """
+ Given the proposed upper and lower extent, adjust the range
+ if it is too close to being singular (i.e. a range of ~0).
+ """
+ if not np.isfinite(vmin) or not np.isfinite(vmax):
+ # Except if there is no data, then use 2000-2010 as default.
+ return (date2num(datetime.date(2000, 1, 1)),
+ date2num(datetime.date(2010, 1, 1)))
+ if vmax < vmin:
+ vmin, vmax = vmax, vmin
+ unit = self._get_unit()
+ interval = self._get_interval()
+ if abs(vmax - vmin) < 1e-6:
+ vmin -= 2 * unit * interval
+ vmax += 2 * unit * interval
+ return vmin, vmax
+
+
+class RRuleLocator(DateLocator):
+ # use the dateutil rrule instance
+
+ def __init__(self, o, tz=None):
+ super().__init__(tz)
+ self.rule = o
+
+ def __call__(self):
+ # if no data have been set, this will tank with a ValueError
+ try:
+ dmin, dmax = self.viewlim_to_dt()
+ except ValueError:
+ return []
+
+ return self.tick_values(dmin, dmax)
+
+ def tick_values(self, vmin, vmax):
+ delta = relativedelta(vmax, vmin)
+
+ # We need to cap at the endpoints of valid datetime
+ try:
+ start = vmin - delta
+ except (ValueError, OverflowError):
+ # cap
+ start = datetime.datetime(1, 1, 1, 0, 0, 0,
+ tzinfo=datetime.timezone.utc)
+
+ try:
+ stop = vmax + delta
+ except (ValueError, OverflowError):
+ # cap
+ stop = datetime.datetime(9999, 12, 31, 23, 59, 59,
+ tzinfo=datetime.timezone.utc)
+
+ self.rule.set(dtstart=start, until=stop)
+
+ dates = self.rule.between(vmin, vmax, True)
+ if len(dates) == 0:
+ return date2num([vmin, vmax])
+ return self.raise_if_exceeds(date2num(dates))
+
+ def _get_unit(self):
+ # docstring inherited
+ freq = self.rule._rrule._freq
+ return self.get_unit_generic(freq)
+
+ @staticmethod
+ def get_unit_generic(freq):
+ if freq == YEARLY:
+ return DAYS_PER_YEAR
+ elif freq == MONTHLY:
+ return DAYS_PER_MONTH
+ elif freq == WEEKLY:
+ return DAYS_PER_WEEK
+ elif freq == DAILY:
+ return 1.0
+ elif freq == HOURLY:
+ return 1.0 / HOURS_PER_DAY
+ elif freq == MINUTELY:
+ return 1.0 / MINUTES_PER_DAY
+ elif freq == SECONDLY:
+ return 1.0 / SEC_PER_DAY
+ else:
+ # error
+ return -1 # or should this just return '1'?
+
+ def _get_interval(self):
+ return self.rule._rrule._interval
+
+
+class AutoDateLocator(DateLocator):
+ """
+ On autoscale, this class picks the best `DateLocator` to set the view
+ limits and the tick locations.
+
+ Attributes
+ ----------
+ intervald : dict
+
+ Mapping of tick frequencies to multiples allowed for that ticking.
+ The default is ::
+
+ self.intervald = {
+ YEARLY : [1, 2, 4, 5, 10, 20, 40, 50, 100, 200, 400, 500,
+ 1000, 2000, 4000, 5000, 10000],
+ MONTHLY : [1, 2, 3, 4, 6],
+ DAILY : [1, 2, 3, 7, 14, 21],
+ HOURLY : [1, 2, 3, 4, 6, 12],
+ MINUTELY: [1, 5, 10, 15, 30],
+ SECONDLY: [1, 5, 10, 15, 30],
+ MICROSECONDLY: [1, 2, 5, 10, 20, 50, 100, 200, 500,
+ 1000, 2000, 5000, 10000, 20000, 50000,
+ 100000, 200000, 500000, 1000000],
+ }
+
+ where the keys are defined in `dateutil.rrule`.
+
+ The interval is used to specify multiples that are appropriate for
+ the frequency of ticking. For instance, every 7 days is sensible
+ for daily ticks, but for minutes/seconds, 15 or 30 make sense.
+
+ When customizing, you should only modify the values for the existing
+ keys. You should not add or delete entries.
+
+ Example for forcing ticks every 3 hours::
+
+ locator = AutoDateLocator()
+ locator.intervald[HOURLY] = [3] # only show every 3 hours
+ """
+
+ def __init__(self, tz=None, minticks=5, maxticks=None,
+ interval_multiples=True):
+ """
+ Parameters
+ ----------
+ tz : `datetime.tzinfo`
+ Ticks timezone.
+ minticks : int
+ The minimum number of ticks desired; controls whether ticks occur
+ yearly, monthly, etc.
+ maxticks : int
+ The maximum number of ticks desired; controls the interval between
+ ticks (ticking every other, every 3, etc.). For fine-grained
+ control, this can be a dictionary mapping individual rrule
+ frequency constants (YEARLY, MONTHLY, etc.) to their own maximum
+ number of ticks. This can be used to keep the number of ticks
+ appropriate to the format chosen in `AutoDateFormatter`. Any
+ frequency not specified in this dictionary is given a default
+ value.
+ interval_multiples : bool, default: True
+ Whether ticks should be chosen to be multiple of the interval,
+ locking them to 'nicer' locations. For example, this will force
+ the ticks to be at hours 0, 6, 12, 18 when hourly ticking is done
+ at 6 hour intervals.
+ """
+ super().__init__(tz)
+ self._freq = YEARLY
+ self._freqs = [YEARLY, MONTHLY, DAILY, HOURLY, MINUTELY,
+ SECONDLY, MICROSECONDLY]
+ self.minticks = minticks
+
+ self.maxticks = {YEARLY: 11, MONTHLY: 12, DAILY: 11, HOURLY: 12,
+ MINUTELY: 11, SECONDLY: 11, MICROSECONDLY: 8}
+ if maxticks is not None:
+ try:
+ self.maxticks.update(maxticks)
+ except TypeError:
+ # Assume we were given an integer. Use this as the maximum
+ # number of ticks for every frequency and create a
+ # dictionary for this
+ self.maxticks = dict.fromkeys(self._freqs, maxticks)
+ self.interval_multiples = interval_multiples
+ self.intervald = {
+ YEARLY: [1, 2, 4, 5, 10, 20, 40, 50, 100, 200, 400, 500,
+ 1000, 2000, 4000, 5000, 10000],
+ MONTHLY: [1, 2, 3, 4, 6],
+ DAILY: [1, 2, 3, 7, 14, 21],
+ HOURLY: [1, 2, 3, 4, 6, 12],
+ MINUTELY: [1, 5, 10, 15, 30],
+ SECONDLY: [1, 5, 10, 15, 30],
+ MICROSECONDLY: [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000,
+ 5000, 10000, 20000, 50000, 100000, 200000, 500000,
+ 1000000],
+ }
+ if interval_multiples:
+ # Swap "3" for "4" in the DAILY list; If we use 3 we get bad
+ # tick loc for months w/ 31 days: 1, 4, ..., 28, 31, 1
+ # If we use 4 then we get: 1, 5, ... 25, 29, 1
+ self.intervald[DAILY] = [1, 2, 4, 7, 14]
+
+ self._byranges = [None, range(1, 13), range(1, 32),
+ range(0, 24), range(0, 60), range(0, 60), None]
+
+ def __call__(self):
+ # docstring inherited
+ dmin, dmax = self.viewlim_to_dt()
+ locator = self.get_locator(dmin, dmax)
+ return locator()
+
+ def tick_values(self, vmin, vmax):
+ return self.get_locator(vmin, vmax).tick_values(vmin, vmax)
+
+ def nonsingular(self, vmin, vmax):
+ # whatever is thrown at us, we can scale the unit.
+ # But default nonsingular date plots at an ~4 year period.
+ if not np.isfinite(vmin) or not np.isfinite(vmax):
+ # Except if there is no data, then use 2000-2010 as default.
+ return (date2num(datetime.date(2000, 1, 1)),
+ date2num(datetime.date(2010, 1, 1)))
+ if vmax < vmin:
+ vmin, vmax = vmax, vmin
+ if vmin == vmax:
+ vmin = vmin - DAYS_PER_YEAR * 2
+ vmax = vmax + DAYS_PER_YEAR * 2
+ return vmin, vmax
+
+ def _get_unit(self):
+ if self._freq in [MICROSECONDLY]:
+ return 1. / MUSECONDS_PER_DAY
+ else:
+ return RRuleLocator.get_unit_generic(self._freq)
+
+ def get_locator(self, dmin, dmax):
+ """Pick the best locator based on a distance."""
+ delta = relativedelta(dmax, dmin)
+ tdelta = dmax - dmin
+
+ # take absolute difference
+ if dmin > dmax:
+ delta = -delta
+ tdelta = -tdelta
+ # The following uses a mix of calls to relativedelta and timedelta
+ # methods because there is incomplete overlap in the functionality of
+ # these similar functions, and it's best to avoid doing our own math
+ # whenever possible.
+ numYears = float(delta.years)
+ numMonths = numYears * MONTHS_PER_YEAR + delta.months
+ numDays = tdelta.days # Avoids estimates of days/month, days/year
+ numHours = numDays * HOURS_PER_DAY + delta.hours
+ numMinutes = numHours * MIN_PER_HOUR + delta.minutes
+ numSeconds = np.floor(tdelta.total_seconds())
+ numMicroseconds = np.floor(tdelta.total_seconds() * 1e6)
+
+ nums = [numYears, numMonths, numDays, numHours, numMinutes,
+ numSeconds, numMicroseconds]
+
+ use_rrule_locator = [True] * 6 + [False]
+
+ # Default setting of bymonth, etc. to pass to rrule
+ # [unused (for year), bymonth, bymonthday, byhour, byminute,
+ # bysecond, unused (for microseconds)]
+ byranges = [None, 1, 1, 0, 0, 0, None]
+
+ # Loop over all the frequencies and try to find one that gives at
+ # least a minticks tick positions. Once this is found, look for
+ # an interval from an list specific to that frequency that gives no
+ # more than maxticks tick positions. Also, set up some ranges
+ # (bymonth, etc.) as appropriate to be passed to rrulewrapper.
+ for i, (freq, num) in enumerate(zip(self._freqs, nums)):
+ # If this particular frequency doesn't give enough ticks, continue
+ if num < self.minticks:
+ # Since we're not using this particular frequency, set
+ # the corresponding by_ to None so the rrule can act as
+ # appropriate
+ byranges[i] = None
+ continue
+
+ # Find the first available interval that doesn't give too many
+ # ticks
+ for interval in self.intervald[freq]:
+ if num <= interval * (self.maxticks[freq] - 1):
+ break
+ else:
+ if not (self.interval_multiples and freq == DAILY):
+ _api.warn_external(
+ f"AutoDateLocator was unable to pick an appropriate "
+ f"interval for this date range. It may be necessary "
+ f"to add an interval value to the AutoDateLocator's "
+ f"intervald dictionary. Defaulting to {interval}.")
+
+ # Set some parameters as appropriate
+ self._freq = freq
+
+ if self._byranges[i] and self.interval_multiples:
+ byranges[i] = self._byranges[i][::interval]
+ if i in (DAILY, WEEKLY):
+ if interval == 14:
+ # just make first and 15th. Avoids 30th.
+ byranges[i] = [1, 15]
+ elif interval == 7:
+ byranges[i] = [1, 8, 15, 22]
+
+ interval = 1
+ else:
+ byranges[i] = self._byranges[i]
+ break
+ else:
+ interval = 1
+
+ if (freq == YEARLY) and self.interval_multiples:
+ locator = YearLocator(interval, tz=self.tz)
+ elif use_rrule_locator[i]:
+ _, bymonth, bymonthday, byhour, byminute, bysecond, _ = byranges
+ rrule = rrulewrapper(self._freq, interval=interval,
+ dtstart=dmin, until=dmax,
+ bymonth=bymonth, bymonthday=bymonthday,
+ byhour=byhour, byminute=byminute,
+ bysecond=bysecond)
+
+ locator = RRuleLocator(rrule, self.tz)
+ else:
+ locator = MicrosecondLocator(interval, tz=self.tz)
+ if date2num(dmin) > 70 * 365 and interval < 1000:
+ _api.warn_external(
+ 'Plotting microsecond time intervals for dates far from '
+ f'the epoch (time origin: {get_epoch()}) is not well-'
+ 'supported. See matplotlib.dates.set_epoch to change the '
+ 'epoch.')
+
+ locator.set_axis(self.axis)
+
+ if self.axis is not None:
+ locator.set_view_interval(*self.axis.get_view_interval())
+ locator.set_data_interval(*self.axis.get_data_interval())
+ return locator
+
+
+class YearLocator(DateLocator):
+ """
+ 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)
+ """
+ def __init__(self, base=1, month=1, day=1, tz=None):
+ """
+ Mark years that are multiple of base on a given month and day
+ (default jan 1).
+ """
+ super().__init__(tz)
+ self.base = ticker._Edge_integer(base, 0)
+ self.replaced = {'month': month,
+ 'day': day,
+ 'hour': 0,
+ 'minute': 0,
+ 'second': 0,
+ }
+ if not hasattr(tz, 'localize'):
+ # if tz is pytz, we need to do this w/ the localize fcn,
+ # otherwise datetime.replace works fine...
+ self.replaced['tzinfo'] = tz
+
+ def __call__(self):
+ # if no data have been set, this will tank with a ValueError
+ try:
+ dmin, dmax = self.viewlim_to_dt()
+ except ValueError:
+ return []
+
+ return self.tick_values(dmin, dmax)
+
+ def tick_values(self, vmin, vmax):
+ ymin = self.base.le(vmin.year) * self.base.step
+ ymax = self.base.ge(vmax.year) * self.base.step
+
+ vmin = vmin.replace(year=ymin, **self.replaced)
+ if hasattr(self.tz, 'localize'):
+ # look after pytz
+ if not vmin.tzinfo:
+ vmin = self.tz.localize(vmin, is_dst=True)
+
+ ticks = [vmin]
+
+ while True:
+ dt = ticks[-1]
+ if dt.year >= ymax:
+ return date2num(ticks)
+ year = dt.year + self.base.step
+ dt = dt.replace(year=year, **self.replaced)
+ if hasattr(self.tz, 'localize'):
+ # look after pytz
+ if not dt.tzinfo:
+ dt = self.tz.localize(dt, is_dst=True)
+
+ ticks.append(dt)
+
+
+class MonthLocator(RRuleLocator):
+ """
+ Make ticks on occurrences of each month, e.g., 1, 3, 12.
+ """
+ def __init__(self, bymonth=None, bymonthday=1, interval=1, tz=None):
+ """
+ Mark every month in *bymonth*; *bymonth* can be an int or
+ sequence. Default is ``range(1, 13)``, i.e. every month.
+
+ *interval* is the interval between each iteration. For
+ example, if ``interval=2``, mark every second occurrence.
+ """
+ if bymonth is None:
+ bymonth = range(1, 13)
+ elif isinstance(bymonth, np.ndarray):
+ # This fixes a bug in dateutil <= 2.3 which prevents the use of
+ # numpy arrays in (among other things) the bymonthday, byweekday
+ # and bymonth parameters.
+ bymonth = [x.item() for x in bymonth.astype(int)]
+
+ rule = rrulewrapper(MONTHLY, bymonth=bymonth, bymonthday=bymonthday,
+ interval=interval, **self.hms0d)
+ super().__init__(rule, tz)
+
+
+class WeekdayLocator(RRuleLocator):
+ """
+ Make ticks on occurrences of each weekday.
+ """
+
+ def __init__(self, byweekday=1, interval=1, tz=None):
+ """
+ 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 :mod:`dateutil.rrule`, which have been
+ imported into the :mod:`matplotlib.dates` namespace.
+
+ *interval* specifies the number of weeks to skip. For example,
+ ``interval=2`` plots every second week.
+ """
+ if isinstance(byweekday, np.ndarray):
+ # This fixes a bug in dateutil <= 2.3 which prevents the use of
+ # numpy arrays in (among other things) the bymonthday, byweekday
+ # and bymonth parameters.
+ [x.item() for x in byweekday.astype(int)]
+
+ rule = rrulewrapper(DAILY, byweekday=byweekday,
+ interval=interval, **self.hms0d)
+ super().__init__(rule, tz)
+
+
+class DayLocator(RRuleLocator):
+ """
+ Make ticks on occurrences of each day of the month. For example,
+ 1, 15, 30.
+ """
+ def __init__(self, bymonthday=None, interval=1, tz=None):
+ """
+ Mark every day in *bymonthday*; *bymonthday* can be an int or sequence.
+
+ Default is to tick every day of the month: ``bymonthday=range(1, 32)``.
+ """
+ if interval != int(interval) or interval < 1:
+ raise ValueError("interval must be an integer greater than 0")
+ if bymonthday is None:
+ bymonthday = range(1, 32)
+ elif isinstance(bymonthday, np.ndarray):
+ # This fixes a bug in dateutil <= 2.3 which prevents the use of
+ # numpy arrays in (among other things) the bymonthday, byweekday
+ # and bymonth parameters.
+ bymonthday = [x.item() for x in bymonthday.astype(int)]
+
+ rule = rrulewrapper(DAILY, bymonthday=bymonthday,
+ interval=interval, **self.hms0d)
+ super().__init__(rule, tz)
+
+
+class HourLocator(RRuleLocator):
+ """
+ Make ticks on occurrences of each hour.
+ """
+ def __init__(self, byhour=None, interval=1, tz=None):
+ """
+ Mark every hour in *byhour*; *byhour* can be an int or sequence.
+ Default is to tick every hour: ``byhour=range(24)``
+
+ *interval* is the interval between each iteration. For
+ example, if ``interval=2``, mark every second occurrence.
+ """
+ if byhour is None:
+ byhour = range(24)
+
+ rule = rrulewrapper(HOURLY, byhour=byhour, interval=interval,
+ byminute=0, bysecond=0)
+ super().__init__(rule, tz)
+
+
+class MinuteLocator(RRuleLocator):
+ """
+ Make ticks on occurrences of each minute.
+ """
+ def __init__(self, byminute=None, interval=1, tz=None):
+ """
+ Mark every minute in *byminute*; *byminute* can be an int or
+ sequence. Default is to tick every minute: ``byminute=range(60)``
+
+ *interval* is the interval between each iteration. For
+ example, if ``interval=2``, mark every second occurrence.
+ """
+ if byminute is None:
+ byminute = range(60)
+
+ rule = rrulewrapper(MINUTELY, byminute=byminute, interval=interval,
+ bysecond=0)
+ super().__init__(rule, tz)
+
+
+class SecondLocator(RRuleLocator):
+ """
+ Make ticks on occurrences of each second.
+ """
+ def __init__(self, bysecond=None, interval=1, tz=None):
+ """
+ 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.
+
+ """
+ if bysecond is None:
+ bysecond = range(60)
+
+ rule = rrulewrapper(SECONDLY, bysecond=bysecond, interval=interval)
+ super().__init__(rule, tz)
+
+
+class MicrosecondLocator(DateLocator):
+ """
+ Make ticks on regular intervals of one or more microsecond(s).
+
+ .. note::
+
+ By default, Matplotlib uses a floating point representation of time in
+ days since the epoch, so plotting data with
+ microsecond time resolution does not work well for
+ dates that are far (about 70 years) from the epoch (check with
+ `~.dates.get_epoch`).
+
+ If you want sub-microsecond resolution time plots, it is strongly
+ recommended to use floating point seconds, not datetime-like
+ time representation.
+
+ If you really must use datetime.datetime() or similar and still
+ need microsecond precision, change the time origin via
+ `.dates.set_epoch` to something closer to the dates being plotted.
+ See :doc:`/gallery/ticks_and_spines/date_precision_and_epochs`.
+
+ """
+ def __init__(self, interval=1, tz=None):
+ """
+ *interval* is the interval between each iteration. For
+ example, if ``interval=2``, mark every second microsecond.
+
+ """
+ self._interval = interval
+ self._wrapped_locator = ticker.MultipleLocator(interval)
+ self.tz = tz
+
+ def set_axis(self, axis):
+ self._wrapped_locator.set_axis(axis)
+ return super().set_axis(axis)
+
+ def set_view_interval(self, vmin, vmax):
+ self._wrapped_locator.set_view_interval(vmin, vmax)
+ return super().set_view_interval(vmin, vmax)
+
+ def set_data_interval(self, vmin, vmax):
+ self._wrapped_locator.set_data_interval(vmin, vmax)
+ return super().set_data_interval(vmin, vmax)
+
+ def __call__(self):
+ # if no data have been set, this will tank with a ValueError
+ try:
+ dmin, dmax = self.viewlim_to_dt()
+ except ValueError:
+ return []
+
+ return self.tick_values(dmin, dmax)
+
+ def tick_values(self, vmin, vmax):
+ nmin, nmax = date2num((vmin, vmax))
+ t0 = np.floor(nmin)
+ nmax = nmax - t0
+ nmin = nmin - t0
+ nmin *= MUSECONDS_PER_DAY
+ nmax *= MUSECONDS_PER_DAY
+
+ ticks = self._wrapped_locator.tick_values(nmin, nmax)
+
+ ticks = ticks / MUSECONDS_PER_DAY + t0
+ return ticks
+
+ def _get_unit(self):
+ # docstring inherited
+ return 1. / MUSECONDS_PER_DAY
+
+ def _get_interval(self):
+ # docstring inherited
+ return self._interval
+
+
+def epoch2num(e):
+ """
+ Convert UNIX time to days since Matplotlib epoch.
+
+ Parameters
+ ----------
+ e : list of floats
+ Time in seconds since 1970-01-01.
+
+ Returns
+ -------
+ `numpy.array`
+ Time in days since Matplotlib epoch (see `~.dates.get_epoch()`).
+ """
+
+ dt = (np.datetime64('1970-01-01T00:00:00', 's') -
+ np.datetime64(get_epoch(), 's')).astype(float)
+
+ return (dt + np.asarray(e)) / SEC_PER_DAY
+
+
+def num2epoch(d):
+ """
+ Convert days since Matplotlib epoch to UNIX time.
+
+ Parameters
+ ----------
+ d : list of floats
+ Time in days since Matplotlib epoch (see `~.dates.get_epoch()`).
+
+ Returns
+ -------
+ `numpy.array`
+ Time in seconds since 1970-01-01.
+ """
+ dt = (np.datetime64('1970-01-01T00:00:00', 's') -
+ np.datetime64(get_epoch(), 's')).astype(float)
+
+ return np.asarray(d) * SEC_PER_DAY - dt
+
+
+def date_ticker_factory(span, tz=None, numticks=5):
+ """
+ Create a date locator with *numticks* (approx) and a date formatter
+ for *span* in days. Return value is (locator, formatter).
+ """
+
+ if span == 0:
+ span = 1 / HOURS_PER_DAY
+
+ mins = span * MINUTES_PER_DAY
+ hrs = span * HOURS_PER_DAY
+ days = span
+ wks = span / DAYS_PER_WEEK
+ months = span / DAYS_PER_MONTH # Approx
+ years = span / DAYS_PER_YEAR # Approx
+
+ if years > numticks:
+ locator = YearLocator(int(years / numticks), tz=tz) # define
+ fmt = '%Y'
+ elif months > numticks:
+ locator = MonthLocator(tz=tz)
+ fmt = '%b %Y'
+ elif wks > numticks:
+ locator = WeekdayLocator(tz=tz)
+ fmt = '%a, %b %d'
+ elif days > numticks:
+ locator = DayLocator(interval=math.ceil(days / numticks), tz=tz)
+ fmt = '%b %d'
+ elif hrs > numticks:
+ locator = HourLocator(interval=math.ceil(hrs / numticks), tz=tz)
+ fmt = '%H:%M\n%b %d'
+ elif mins > numticks:
+ locator = MinuteLocator(interval=math.ceil(mins / numticks), tz=tz)
+ fmt = '%H:%M:%S'
+ else:
+ locator = MinuteLocator(tz=tz)
+ fmt = '%H:%M:%S'
+
+ formatter = DateFormatter(fmt, tz=tz)
+ return locator, formatter
+
+
+class DateConverter(units.ConversionInterface):
+ """
+ Converter for `datetime.date` and `datetime.datetime` data, or for
+ date/time data represented as it would be converted by `date2num`.
+
+ The 'unit' tag for such data is None or a tzinfo instance.
+ """
+
+ def __init__(self, *, interval_multiples=True):
+ self._interval_multiples = interval_multiples
+ super().__init__()
+
+ def axisinfo(self, unit, axis):
+ """
+ Return the `~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,
+ interval_multiples=self._interval_multiples)
+ 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))
+
+ @staticmethod
+ def convert(value, unit, axis):
+ """
+ If *value* is not already a number or sequence of numbers, convert it
+ with `date2num`.
+
+ The *unit* and *axis* arguments are not used.
+ """
+ return date2num(value)
+
+ @staticmethod
+ def default_units(x, axis):
+ """
+ Return the tzinfo instance of *x* or of its first element, or None
+ """
+ if isinstance(x, np.ndarray):
+ x = x.ravel()
+
+ try:
+ x = cbook.safe_first_element(x)
+ except (TypeError, StopIteration):
+ pass
+
+ try:
+ return x.tzinfo
+ except AttributeError:
+ pass
+ return None
+
+
+class ConciseDateConverter(DateConverter):
+ # docstring inherited
+
+ def __init__(self, formats=None, zero_formats=None, offset_formats=None,
+ show_offset=True, *, interval_multiples=True):
+ self._formats = formats
+ self._zero_formats = zero_formats
+ self._offset_formats = offset_formats
+ self._show_offset = show_offset
+ self._interval_multiples = interval_multiples
+ super().__init__()
+
+ def axisinfo(self, unit, axis):
+ # docstring inherited
+ tz = unit
+ majloc = AutoDateLocator(tz=tz,
+ interval_multiples=self._interval_multiples)
+ majfmt = ConciseDateFormatter(majloc, tz=tz, formats=self._formats,
+ zero_formats=self._zero_formats,
+ offset_formats=self._offset_formats,
+ show_offset=self._show_offset)
+ datemin = datetime.date(2000, 1, 1)
+ datemax = datetime.date(2010, 1, 1)
+ return units.AxisInfo(majloc=majloc, majfmt=majfmt, label='',
+ default_limits=(datemin, datemax))
+
+
+class _rcParam_helper:
+ """
+ This helper class is so that we can set the converter for dates
+ via the validator for the rcParams `date.converter` and
+ `date.interval_multiples`. Never instatiated.
+ """
+
+ conv_st = 'auto'
+ int_mult = True
+
+ @classmethod
+ def set_converter(cls, s):
+ """Called by validator for rcParams date.converter"""
+ if s not in ['concise', 'auto']:
+ raise ValueError('Converter must be one of "concise" or "auto"')
+ cls.conv_st = s
+ cls.register_converters()
+
+ @classmethod
+ def set_int_mult(cls, b):
+ """Called by validator for rcParams date.interval_multiples"""
+ cls.int_mult = b
+ cls.register_converters()
+
+ @classmethod
+ def register_converters(cls):
+ """
+ Helper to register the date converters when rcParams `date.converter`
+ and `date.interval_multiples` are changed. Called by the helpers
+ above.
+ """
+ if cls.conv_st == 'concise':
+ converter = ConciseDateConverter
+ else:
+ converter = DateConverter
+
+ interval_multiples = cls.int_mult
+ convert = converter(interval_multiples=interval_multiples)
+ units.registry[np.datetime64] = convert
+ units.registry[datetime.date] = convert
+ units.registry[datetime.datetime] = convert
diff --git a/venv/Lib/site-packages/matplotlib/docstring.py b/venv/Lib/site-packages/matplotlib/docstring.py
new file mode 100644
index 0000000..d0e661f
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/docstring.py
@@ -0,0 +1,77 @@
+import inspect
+
+from matplotlib import _api
+
+
+class Substitution:
+ """
+ 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"
+ """
+ def __init__(self, *args, **kwargs):
+ if args and kwargs:
+ raise TypeError("Only positional or keyword args are allowed")
+ self.params = args or kwargs
+
+ def __call__(self, func):
+ if func.__doc__:
+ func.__doc__ = inspect.cleandoc(func.__doc__) % self.params
+ return func
+
+ def update(self, *args, **kwargs):
+ """
+ Update ``self.params`` (which must be a dict) with the supplied args.
+ """
+ self.params.update(*args, **kwargs)
+
+ @classmethod
+ @_api.deprecated("3.3", alternative="assign to the params attribute")
+ def from_params(cls, params):
+ """
+ In the case where the params is a mutable sequence (list or
+ dictionary) and it may change before this class is called, one may
+ explicitly use a reference to the params rather than using *args or
+ **kwargs which will copy the values and not reference them.
+
+ :meta private:
+ """
+ result = cls()
+ result.params = params
+ return result
+
+
+def copy(source):
+ """Copy a docstring from another source function (if present)."""
+ def do_copy(target):
+ if source.__doc__:
+ target.__doc__ = source.__doc__
+ return target
+ return do_copy
+
+
+# Create a decorator that will house the various docstring snippets reused
+# throughout Matplotlib.
+interpd = Substitution()
+dedent_interpd = interpd
diff --git a/venv/Lib/site-packages/matplotlib/dviread.py b/venv/Lib/site-packages/matplotlib/dviread.py
new file mode 100644
index 0000000..579fe0e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/dviread.py
@@ -0,0 +1,1127 @@
+"""
+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:
+ ...
+"""
+
+from collections import namedtuple
+import enum
+from functools import lru_cache, partial, wraps
+import logging
+import os
+from pathlib import Path
+import re
+import struct
+import sys
+import textwrap
+
+import numpy as np
+
+from matplotlib import _api, cbook, rcParams
+
+_log = logging.getLogger(__name__)
+
+# Many dvi related files are looked for by external processes, require
+# additional parsing, and are used many times per rendering, which is why they
+# are cached using lru_cache().
+
+# Dvi is a bytecode format documented in
+# http://mirrors.ctan.org/systems/knuth/dist/texware/dvitype.web
+# http://texdoc.net/texmf-dist/doc/generic/knuth/texware/dvitype.pdf
+#
+# The file consists of a preamble, some number of pages, a postamble,
+# and a finale. Different opcodes are allowed in different contexts,
+# so the Dvi object has a parser state:
+#
+# pre: expecting the preamble
+# outer: between pages (followed by a page or the postamble,
+# also e.g. font definitions are allowed)
+# page: processing a page
+# post_post: state after the postamble (our current implementation
+# just stops reading)
+# finale: the finale (unimplemented in our current implementation)
+
+_dvistate = enum.Enum('DviState', 'pre outer inpage post_post finale')
+
+# The marks on a page consist of text and boxes. A page also has dimensions.
+Page = namedtuple('Page', 'text boxes height width descent')
+Text = namedtuple('Text', 'x y font glyph width')
+Box = namedtuple('Box', 'x y height width')
+
+
+# Opcode argument parsing
+#
+# Each of the following functions takes a Dvi object and delta,
+# which is the difference between the opcode and the minimum opcode
+# with the same meaning. Dvi opcodes often encode the number of
+# argument bytes in this delta.
+
+def _arg_raw(dvi, delta):
+ """Return *delta* without reading anything more from the dvi file."""
+ return delta
+
+
+def _arg(nbytes, signed, dvi, _):
+ """
+ Read *nbytes* bytes, returning the bytes interpreted as a signed integer
+ if *signed* is true, unsigned otherwise.
+ """
+ return dvi._arg(nbytes, signed)
+
+
+def _arg_slen(dvi, delta):
+ """
+ Signed, length *delta*
+
+ Read *delta* bytes, returning None if *delta* is zero, and the bytes
+ interpreted as a signed integer otherwise.
+ """
+ if delta == 0:
+ return None
+ return dvi._arg(delta, True)
+
+
+def _arg_slen1(dvi, delta):
+ """
+ Signed, length *delta*+1
+
+ Read *delta*+1 bytes, returning the bytes interpreted as signed.
+ """
+ return dvi._arg(delta+1, True)
+
+
+def _arg_ulen1(dvi, delta):
+ """
+ Unsigned length *delta*+1
+
+ Read *delta*+1 bytes, returning the bytes interpreted as unsigned.
+ """
+ return dvi._arg(delta+1, False)
+
+
+def _arg_olen1(dvi, delta):
+ """
+ Optionally signed, length *delta*+1
+
+ Read *delta*+1 bytes, returning the bytes interpreted as
+ unsigned integer for 0<=*delta*<3 and signed if *delta*==3.
+ """
+ return dvi._arg(delta + 1, delta == 3)
+
+
+_arg_mapping = dict(raw=_arg_raw,
+ u1=partial(_arg, 1, False),
+ u4=partial(_arg, 4, False),
+ s4=partial(_arg, 4, True),
+ slen=_arg_slen,
+ olen1=_arg_olen1,
+ slen1=_arg_slen1,
+ ulen1=_arg_ulen1)
+
+
+def _dispatch(table, min, max=None, state=None, args=('raw',)):
+ """
+ Decorator for dispatch by opcode. Sets the values in *table*
+ from *min* to *max* to this method, adds a check that the Dvi state
+ matches *state* if not None, reads arguments from the file according
+ to *args*.
+
+ *table*
+ the dispatch table to be filled in
+
+ *min*
+ minimum opcode for calling this function
+
+ *max*
+ maximum opcode for calling this function, None if only *min* is allowed
+
+ *state*
+ state of the Dvi object in which these opcodes are allowed
+
+ *args*
+ sequence of argument specifications:
+
+ ``'raw'``: opcode minus minimum
+ ``'u1'``: read one unsigned byte
+ ``'u4'``: read four bytes, treat as an unsigned number
+ ``'s4'``: read four bytes, treat as a signed number
+ ``'slen'``: read (opcode - minimum) bytes, treat as signed
+ ``'slen1'``: read (opcode - minimum + 1) bytes, treat as signed
+ ``'ulen1'``: read (opcode - minimum + 1) bytes, treat as unsigned
+ ``'olen1'``: read (opcode - minimum + 1) bytes, treat as unsigned
+ if under four bytes, signed if four bytes
+ """
+ def decorate(method):
+ get_args = [_arg_mapping[x] for x in args]
+
+ @wraps(method)
+ def wrapper(self, byte):
+ if state is not None and self.state != state:
+ raise ValueError("state precondition failed")
+ return method(self, *[f(self, byte-min) for f in get_args])
+ if max is None:
+ table[min] = wrapper
+ else:
+ for i in range(min, max+1):
+ assert table[i] is None
+ table[i] = wrapper
+ return wrapper
+ return decorate
+
+
+class Dvi:
+ """
+ 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))
+ """
+ # dispatch table
+ _dtable = [None] * 256
+ _dispatch = partial(_dispatch, _dtable)
+
+ def __init__(self, filename, dpi):
+ """
+ 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.
+ """
+ _log.debug('Dvi: %s', filename)
+ self.file = open(filename, 'rb')
+ self.dpi = dpi
+ self.fonts = {}
+ self.state = _dvistate.pre
+ self.baseline = self._get_baseline(filename)
+
+ def _get_baseline(self, filename):
+ if dict.__getitem__(rcParams, 'text.latex.preview'):
+ baseline = Path(filename).with_suffix(".baseline")
+ if baseline.exists():
+ height, depth, width = baseline.read_bytes().split()
+ return float(depth)
+ return None
+
+ def __enter__(self):
+ """Context manager enter method, does nothing."""
+ return self
+
+ def __exit__(self, etype, evalue, etrace):
+ """
+ Context manager exit method, closes the underlying file if it is open.
+ """
+ self.close()
+
+ def __iter__(self):
+ """
+ Iterate through the pages of the file.
+
+ Yields
+ ------
+ Page
+ Details of all the text and box objects on the page.
+ The Page tuple contains lists of Text and Box tuples and
+ the page dimensions, and the Text and Box tuples contain
+ coordinates transformed into a standard Cartesian
+ coordinate system at the dpi value given when initializing.
+ The coordinates are floating point numbers, but otherwise
+ precision is not lost and coordinate values are not clipped to
+ integers.
+ """
+ while self._read():
+ yield self._output()
+
+ def close(self):
+ """Close the underlying file if it is open."""
+ if not self.file.closed:
+ self.file.close()
+
+ def _output(self):
+ """
+ Output the text and boxes belonging to the most recent page.
+ page = dvi._output()
+ """
+ minx, miny, maxx, maxy = np.inf, np.inf, -np.inf, -np.inf
+ maxy_pure = -np.inf
+ for elt in self.text + self.boxes:
+ if isinstance(elt, Box):
+ x, y, h, w = elt
+ e = 0 # zero depth
+ else: # glyph
+ x, y, font, g, w = elt
+ h, e = font._height_depth_of(g)
+ minx = min(minx, x)
+ miny = min(miny, y - h)
+ maxx = max(maxx, x + w)
+ maxy = max(maxy, y + e)
+ maxy_pure = max(maxy_pure, y)
+ if self._baseline_v is not None:
+ maxy_pure = self._baseline_v # This should normally be the case.
+ self._baseline_v = None
+
+ if not self.text and not self.boxes: # Avoid infs/nans from inf+/-inf.
+ return Page(text=[], boxes=[], width=0, height=0, descent=0)
+
+ if self.dpi is None:
+ # special case for ease of debugging: output raw dvi coordinates
+ return Page(text=self.text, boxes=self.boxes,
+ width=maxx-minx, height=maxy_pure-miny,
+ descent=maxy-maxy_pure)
+
+ # convert from TeX's "scaled points" to dpi units
+ d = self.dpi / (72.27 * 2**16)
+ if self.baseline is None:
+ descent = (maxy - maxy_pure) * d
+ else:
+ descent = self.baseline
+
+ text = [Text((x-minx)*d, (maxy-y)*d - descent, f, g, w*d)
+ for (x, y, f, g, w) in self.text]
+ boxes = [Box((x-minx)*d, (maxy-y)*d - descent, h*d, w*d)
+ for (x, y, h, w) in self.boxes]
+
+ return Page(text=text, boxes=boxes, width=(maxx-minx)*d,
+ height=(maxy_pure-miny)*d, descent=descent)
+
+ def _read(self):
+ """
+ Read one page from the file. Return True if successful,
+ False if there were no more pages.
+ """
+ # Pages appear to start with the sequence
+ # bop (begin of page)
+ # xxx comment
+ # down
+ # push
+ # down
+ #
# if using xcolor
+ # down
+ # push
+ # down (possibly multiple)
+ # push <= here, v is the baseline position.
+ # etc.
+ # (dviasm is useful to explore this structure.)
+ # Thus, we use the vertical position at the first time the stack depth
+ # reaches 3, while at least three "downs" have been executed, as the
+ # baseline (the "down" count is necessary to handle xcolor).
+ downs = 0
+ self._baseline_v = None
+ while True:
+ byte = self.file.read(1)[0]
+ self._dtable[byte](self, byte)
+ downs += self._dtable[byte].__name__ == "_down"
+ if (self._baseline_v is None
+ and len(getattr(self, "stack", [])) == 3
+ and downs >= 4):
+ self._baseline_v = self.v
+ if byte == 140: # end of page
+ return True
+ if self.state is _dvistate.post_post: # end of file
+ self.close()
+ return False
+
+ def _arg(self, nbytes, signed=False):
+ """
+ Read and return an integer argument *nbytes* long.
+ Signedness is determined by the *signed* keyword.
+ """
+ buf = self.file.read(nbytes)
+ value = buf[0]
+ if signed and value >= 0x80:
+ value = value - 0x100
+ for b in buf[1:]:
+ value = 0x100*value + b
+ return value
+
+ @_dispatch(min=0, max=127, state=_dvistate.inpage)
+ def _set_char_immediate(self, char):
+ self._put_char_real(char)
+ self.h += self.fonts[self.f]._width_of(char)
+
+ @_dispatch(min=128, max=131, state=_dvistate.inpage, args=('olen1',))
+ def _set_char(self, char):
+ self._put_char_real(char)
+ self.h += self.fonts[self.f]._width_of(char)
+
+ @_dispatch(132, state=_dvistate.inpage, args=('s4', 's4'))
+ def _set_rule(self, a, b):
+ self._put_rule_real(a, b)
+ self.h += b
+
+ @_dispatch(min=133, max=136, state=_dvistate.inpage, args=('olen1',))
+ def _put_char(self, char):
+ self._put_char_real(char)
+
+ def _put_char_real(self, char):
+ font = self.fonts[self.f]
+ if font._vf is None:
+ self.text.append(Text(self.h, self.v, font, char,
+ font._width_of(char)))
+ else:
+ scale = font._scale
+ for x, y, f, g, w in font._vf[char].text:
+ newf = DviFont(scale=_mul2012(scale, f._scale),
+ tfm=f._tfm, texname=f.texname, vf=f._vf)
+ self.text.append(Text(self.h + _mul2012(x, scale),
+ self.v + _mul2012(y, scale),
+ newf, g, newf._width_of(g)))
+ self.boxes.extend([Box(self.h + _mul2012(x, scale),
+ self.v + _mul2012(y, scale),
+ _mul2012(a, scale), _mul2012(b, scale))
+ for x, y, a, b in font._vf[char].boxes])
+
+ @_dispatch(137, state=_dvistate.inpage, args=('s4', 's4'))
+ def _put_rule(self, a, b):
+ self._put_rule_real(a, b)
+
+ def _put_rule_real(self, a, b):
+ if a > 0 and b > 0:
+ self.boxes.append(Box(self.h, self.v, a, b))
+
+ @_dispatch(138)
+ def _nop(self, _):
+ pass
+
+ @_dispatch(139, state=_dvistate.outer, args=('s4',)*11)
+ def _bop(self, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, p):
+ self.state = _dvistate.inpage
+ self.h, self.v, self.w, self.x, self.y, self.z = 0, 0, 0, 0, 0, 0
+ self.stack = []
+ self.text = [] # list of Text objects
+ self.boxes = [] # list of Box objects
+
+ @_dispatch(140, state=_dvistate.inpage)
+ def _eop(self, _):
+ self.state = _dvistate.outer
+ del self.h, self.v, self.w, self.x, self.y, self.z, self.stack
+
+ @_dispatch(141, state=_dvistate.inpage)
+ def _push(self, _):
+ self.stack.append((self.h, self.v, self.w, self.x, self.y, self.z))
+
+ @_dispatch(142, state=_dvistate.inpage)
+ def _pop(self, _):
+ self.h, self.v, self.w, self.x, self.y, self.z = self.stack.pop()
+
+ @_dispatch(min=143, max=146, state=_dvistate.inpage, args=('slen1',))
+ def _right(self, b):
+ self.h += b
+
+ @_dispatch(min=147, max=151, state=_dvistate.inpage, args=('slen',))
+ def _right_w(self, new_w):
+ if new_w is not None:
+ self.w = new_w
+ self.h += self.w
+
+ @_dispatch(min=152, max=156, state=_dvistate.inpage, args=('slen',))
+ def _right_x(self, new_x):
+ if new_x is not None:
+ self.x = new_x
+ self.h += self.x
+
+ @_dispatch(min=157, max=160, state=_dvistate.inpage, args=('slen1',))
+ def _down(self, a):
+ self.v += a
+
+ @_dispatch(min=161, max=165, state=_dvistate.inpage, args=('slen',))
+ def _down_y(self, new_y):
+ if new_y is not None:
+ self.y = new_y
+ self.v += self.y
+
+ @_dispatch(min=166, max=170, state=_dvistate.inpage, args=('slen',))
+ def _down_z(self, new_z):
+ if new_z is not None:
+ self.z = new_z
+ self.v += self.z
+
+ @_dispatch(min=171, max=234, state=_dvistate.inpage)
+ def _fnt_num_immediate(self, k):
+ self.f = k
+
+ @_dispatch(min=235, max=238, state=_dvistate.inpage, args=('olen1',))
+ def _fnt_num(self, new_f):
+ self.f = new_f
+
+ @_dispatch(min=239, max=242, args=('ulen1',))
+ def _xxx(self, datalen):
+ special = self.file.read(datalen)
+ _log.debug(
+ 'Dvi._xxx: encountered special: %s',
+ ''.join([chr(ch) if 32 <= ch < 127 else '<%02x>' % ch
+ for ch in special]))
+
+ @_dispatch(min=243, max=246, args=('olen1', 'u4', 'u4', 'u4', 'u1', 'u1'))
+ def _fnt_def(self, k, c, s, d, a, l):
+ self._fnt_def_real(k, c, s, d, a, l)
+
+ def _fnt_def_real(self, k, c, s, d, a, l):
+ n = self.file.read(a + l)
+ fontname = n[-l:].decode('ascii')
+ tfm = _tfmfile(fontname)
+ if tfm is None:
+ raise FileNotFoundError("missing font metrics file: %s" % fontname)
+ if c != 0 and tfm.checksum != 0 and c != tfm.checksum:
+ raise ValueError('tfm checksum mismatch: %s' % n)
+
+ vf = _vffile(fontname)
+
+ self.fonts[k] = DviFont(scale=s, tfm=tfm, texname=n, vf=vf)
+
+ @_dispatch(247, state=_dvistate.pre, args=('u1', 'u4', 'u4', 'u4', 'u1'))
+ def _pre(self, i, num, den, mag, k):
+ self.file.read(k) # comment in the dvi file
+ if i != 2:
+ raise ValueError("Unknown dvi format %d" % i)
+ if num != 25400000 or den != 7227 * 2**16:
+ raise ValueError("Nonstandard units in dvi file")
+ # meaning: TeX always uses those exact values, so it
+ # should be enough for us to support those
+ # (There are 72.27 pt to an inch so 7227 pt =
+ # 7227 * 2**16 sp to 100 in. The numerator is multiplied
+ # by 10^5 to get units of 10**-7 meters.)
+ if mag != 1000:
+ raise ValueError("Nonstandard magnification in dvi file")
+ # meaning: LaTeX seems to frown on setting \mag, so
+ # I think we can assume this is constant
+ self.state = _dvistate.outer
+
+ @_dispatch(248, state=_dvistate.outer)
+ def _post(self, _):
+ self.state = _dvistate.post_post
+ # TODO: actually read the postamble and finale?
+ # currently post_post just triggers closing the file
+
+ @_dispatch(249)
+ def _post_post(self, _):
+ raise NotImplementedError
+
+ @_dispatch(min=250, max=255)
+ def _malformed(self, offset):
+ raise ValueError(f"unknown command: byte {250 + offset}")
+
+
+class DviFont:
+ """
+ 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
+ ----------
+ scale : float
+ Factor by which the font is scaled from its natural size.
+ tfm : Tfm
+ TeX font metrics for this font
+ texname : bytes
+ 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.
+ vf : Vf
+ A TeX "virtual font" file, or None if this font is not virtual.
+
+ Attributes
+ ----------
+ texname : bytes
+ size : float
+ Size of the font in Adobe points, converted from the slightly
+ smaller TeX points.
+ widths : list
+ Widths of glyphs in glyph-space units, typically 1/1000ths of
+ the point size.
+
+ """
+ __slots__ = ('texname', 'size', 'widths', '_scale', '_vf', '_tfm')
+
+ def __init__(self, scale, tfm, texname, vf):
+ _api.check_isinstance(bytes, texname=texname)
+ self._scale = scale
+ self._tfm = tfm
+ self.texname = texname
+ self._vf = vf
+ self.size = scale * (72.0 / (72.27 * 2**16))
+ try:
+ nchars = max(tfm.width) + 1
+ except ValueError:
+ nchars = 0
+ self.widths = [(1000*tfm.width.get(char, 0)) >> 20
+ for char in range(nchars)]
+
+ def __eq__(self, other):
+ return (type(self) == type(other)
+ and self.texname == other.texname and self.size == other.size)
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+ def __repr__(self):
+ return "<{}: {}>".format(type(self).__name__, self.texname)
+
+ def _width_of(self, char):
+ """Width of char in dvi units."""
+ width = self._tfm.width.get(char, None)
+ if width is not None:
+ return _mul2012(width, self._scale)
+ _log.debug('No width for char %d in font %s.', char, self.texname)
+ return 0
+
+ def _height_depth_of(self, char):
+ """Height and depth of char in dvi units."""
+ result = []
+ for metric, name in ((self._tfm.height, "height"),
+ (self._tfm.depth, "depth")):
+ value = metric.get(char, None)
+ if value is None:
+ _log.debug('No %s for char %d in font %s',
+ name, char, self.texname)
+ result.append(0)
+ else:
+ result.append(_mul2012(value, self._scale))
+ # cmsyXX (symbols font) glyph 0 ("minus") has a nonzero descent
+ # so that TeX aligns equations properly
+ # (https://tex.stackexchange.com/questions/526103/),
+ # but we actually care about the rasterization depth to align
+ # the dvipng-generated images.
+ if re.match(br'^cmsy\d+$', self.texname) and char == 0:
+ result[-1] = 0
+ return result
+
+
+class Vf(Dvi):
+ r"""
+ A virtual font (\*.vf file) containing subroutines for dvi files.
+
+ Parameters
+ ----------
+ filename : str 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
+ """
+
+ def __init__(self, filename):
+ super().__init__(filename, 0)
+ try:
+ self._first_font = None
+ self._chars = {}
+ self._read()
+ finally:
+ self.close()
+
+ def __getitem__(self, code):
+ return self._chars[code]
+
+ def _read(self):
+ """
+ Read one page from the file. Return True if successful,
+ False if there were no more pages.
+ """
+ packet_char, packet_ends = None, None
+ packet_len, packet_width = None, None
+ while True:
+ byte = self.file.read(1)[0]
+ # If we are in a packet, execute the dvi instructions
+ if self.state is _dvistate.inpage:
+ byte_at = self.file.tell()-1
+ if byte_at == packet_ends:
+ self._finalize_packet(packet_char, packet_width)
+ packet_len, packet_char, packet_width = None, None, None
+ # fall through to out-of-packet code
+ elif byte_at > packet_ends:
+ raise ValueError("Packet length mismatch in vf file")
+ else:
+ if byte in (139, 140) or byte >= 243:
+ raise ValueError(
+ "Inappropriate opcode %d in vf file" % byte)
+ Dvi._dtable[byte](self, byte)
+ continue
+
+ # We are outside a packet
+ if byte < 242: # a short packet (length given by byte)
+ packet_len = byte
+ packet_char, packet_width = self._arg(1), self._arg(3)
+ packet_ends = self._init_packet(byte)
+ self.state = _dvistate.inpage
+ elif byte == 242: # a long packet
+ packet_len, packet_char, packet_width = \
+ [self._arg(x) for x in (4, 4, 4)]
+ self._init_packet(packet_len)
+ elif 243 <= byte <= 246:
+ k = self._arg(byte - 242, byte == 246)
+ c, s, d, a, l = [self._arg(x) for x in (4, 4, 4, 1, 1)]
+ self._fnt_def_real(k, c, s, d, a, l)
+ if self._first_font is None:
+ self._first_font = k
+ elif byte == 247: # preamble
+ i, k = self._arg(1), self._arg(1)
+ x = self.file.read(k)
+ cs, ds = self._arg(4), self._arg(4)
+ self._pre(i, x, cs, ds)
+ elif byte == 248: # postamble (just some number of 248s)
+ break
+ else:
+ raise ValueError("Unknown vf opcode %d" % byte)
+
+ def _init_packet(self, pl):
+ if self.state != _dvistate.outer:
+ raise ValueError("Misplaced packet in vf file")
+ self.h, self.v, self.w, self.x, self.y, self.z = 0, 0, 0, 0, 0, 0
+ self.stack, self.text, self.boxes = [], [], []
+ self.f = self._first_font
+ return self.file.tell() + pl
+
+ def _finalize_packet(self, packet_char, packet_width):
+ self._chars[packet_char] = Page(
+ text=self.text, boxes=self.boxes, width=packet_width,
+ height=None, descent=None)
+ self.state = _dvistate.outer
+
+ def _pre(self, i, x, cs, ds):
+ if self.state is not _dvistate.pre:
+ raise ValueError("pre command in middle of vf file")
+ if i != 202:
+ raise ValueError("Unknown vf format %d" % i)
+ if len(x):
+ _log.debug('vf file comment: %s', x)
+ self.state = _dvistate.outer
+ # cs = checksum, ds = design size
+
+
+def _fix2comp(num):
+ """Convert from two's complement to negative."""
+ assert 0 <= num < 2**32
+ if num & 2**31:
+ return num - 2**32
+ else:
+ return num
+
+
+def _mul2012(num1, num2):
+ """Multiply two numbers in 20.12 fixed point format."""
+ # Separated into a function because >> has surprising precedence
+ return (num1*num2) >> 20
+
+
+class Tfm:
+ """
+ A TeX Font Metric file.
+
+ This implementation covers only the bare minimum needed by the Dvi class.
+
+ Parameters
+ ----------
+ filename : str or path-like
+
+ Attributes
+ ----------
+ checksum : int
+ Used for verifying against the dvi file.
+ design_size : int
+ Design size of the font (unknown units)
+ width, height, depth : dict
+ 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.
+ """
+ __slots__ = ('checksum', 'design_size', 'width', 'height', 'depth')
+
+ def __init__(self, filename):
+ _log.debug('opening tfm file %s', filename)
+ with open(filename, 'rb') as file:
+ header1 = file.read(24)
+ lh, bc, ec, nw, nh, nd = \
+ struct.unpack('!6H', header1[2:14])
+ _log.debug('lh=%d, bc=%d, ec=%d, nw=%d, nh=%d, nd=%d',
+ lh, bc, ec, nw, nh, nd)
+ header2 = file.read(4*lh)
+ self.checksum, self.design_size = \
+ struct.unpack('!2I', header2[:8])
+ # there is also encoding information etc.
+ char_info = file.read(4*(ec-bc+1))
+ widths = file.read(4*nw)
+ heights = file.read(4*nh)
+ depths = file.read(4*nd)
+
+ self.width, self.height, self.depth = {}, {}, {}
+ widths, heights, depths = \
+ [struct.unpack('!%dI' % (len(x)/4), x)
+ for x in (widths, heights, depths)]
+ for idx, char in enumerate(range(bc, ec+1)):
+ byte0 = char_info[4*idx]
+ byte1 = char_info[4*idx+1]
+ self.width[char] = _fix2comp(widths[byte0])
+ self.height[char] = _fix2comp(heights[byte1 >> 4])
+ self.depth[char] = _fix2comp(depths[byte1 & 0xf])
+
+
+PsFont = namedtuple('PsFont', 'texname psname effects encoding filename')
+
+
+class PsfontsMap:
+ """
+ A psfonts.map formatted file, mapping TeX fonts to PS fonts.
+
+ Parameters
+ ----------
+ filename : str 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.
+ :file:`psfonts.map`, :file:`pdftex.map`, or :file:`dvipdfm.map`.
+ The file :file:`psfonts.map` is used by :program:`dvips`,
+ :file:`pdftex.map` by :program:`pdfTeX`, and :file:`dvipdfm.map`
+ by :program:`dvipdfm`. :file:`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
+ """
+ __slots__ = ('_font', '_filename')
+
+ # Create a filename -> PsfontsMap cache, so that calling
+ # `PsfontsMap(filename)` with the same filename a second time immediately
+ # returns the same object.
+ @lru_cache()
+ def __new__(cls, filename):
+ self = object.__new__(cls)
+ self._font = {}
+ self._filename = os.fsdecode(filename)
+ with open(filename, 'rb') as file:
+ self._parse(file)
+ return self
+
+ def __getitem__(self, texname):
+ assert isinstance(texname, bytes)
+ try:
+ result = self._font[texname]
+ except KeyError:
+ fmt = ('A PostScript file for the font whose TeX name is "{0}" '
+ 'could not be found in the file "{1}". The dviread module '
+ 'can only handle fonts that have an associated PostScript '
+ 'font file. '
+ 'This problem can often be solved by installing '
+ 'a suitable PostScript font package in your (TeX) '
+ 'package manager.')
+ msg = fmt.format(texname.decode('ascii'), self._filename)
+ msg = textwrap.fill(msg, break_on_hyphens=False,
+ break_long_words=False)
+ _log.info(msg)
+ raise
+ fn, enc = result.filename, result.encoding
+ if fn is not None and not fn.startswith(b'/'):
+ fn = find_tex_file(fn)
+ if enc is not None and not enc.startswith(b'/'):
+ enc = find_tex_file(result.encoding)
+ return result._replace(filename=fn, encoding=enc)
+
+ def _parse(self, file):
+ """
+ Parse the font mapping file.
+
+ The format is, AFAIK: texname fontname [effects and filenames]
+ Effects are PostScript snippets like ".177 SlantFont",
+ filenames begin with one or two less-than signs. A filename
+ ending in enc is an encoding file, other filenames are font
+ files. This can be overridden with a left bracket: <[foobar
+ indicates an encoding file named foobar.
+
+ There is some difference between [^"]+ )" | # quoted encoding marked by [
+ "< (?P [^"]+.enc)" | # quoted encoding, ends in .enc
+ "< (?P [^"]+ )" | # quoted font file name
+ " (?P [^"]+ )" | # quoted effects or font name
+ <\[ (?P \S+ ) | # encoding marked by [
+ < (?P \S+ .enc) | # encoding, ends in .enc
+ < (?P \S+ ) | # font file name
+ (?P \S+ ) # effects or font name
+ )''')
+ effects_re = re.compile(
+ br'''(?x) (?P -?[0-9]*(?:\.[0-9]+)) \s* SlantFont
+ | (?P-?[0-9]*(?:\.[0-9]+)) \s* ExtendFont''')
+
+ lines = (line.strip()
+ for line in file
+ if not empty_re.match(line))
+ for line in lines:
+ effects, encoding, filename = b'', None, None
+ words = word_re.finditer(line)
+
+ # The named groups are mutually exclusive and are
+ # referenced below at an estimated order of probability of
+ # occurrence based on looking at my copy of pdftex.map.
+ # The font names are probably unquoted:
+ w = next(words)
+ texname = w.group('eff2') or w.group('eff1')
+ w = next(words)
+ psname = w.group('eff2') or w.group('eff1')
+
+ for w in words:
+ # Any effects are almost always quoted:
+ eff = w.group('eff1') or w.group('eff2')
+ if eff:
+ effects = eff
+ continue
+ # Encoding files usually have the .enc suffix
+ # and almost never need quoting:
+ enc = (w.group('enc4') or w.group('enc3') or
+ w.group('enc2') or w.group('enc1'))
+ if enc:
+ if encoding is not None:
+ _log.debug('Multiple encodings for %s = %s',
+ texname, psname)
+ encoding = enc
+ continue
+ # File names are probably unquoted:
+ filename = w.group('file2') or w.group('file1')
+
+ effects_dict = {}
+ for match in effects_re.finditer(effects):
+ slant = match.group('slant')
+ if slant:
+ effects_dict['slant'] = float(slant)
+ else:
+ effects_dict['extend'] = float(match.group('extend'))
+
+ self._font[texname] = PsFont(
+ texname=texname, psname=psname, effects=effects_dict,
+ encoding=encoding, filename=filename)
+
+
+@_api.deprecated("3.3")
+class Encoding:
+ r"""
+ Parse a \*.enc file referenced from a psfonts.map style file.
+
+ The format this class understands is a very limited subset of PostScript.
+
+ Usage (subject to change)::
+
+ for name in Encoding(filename):
+ whatever(name)
+
+ Parameters
+ ----------
+ filename : str or path-like
+
+ Attributes
+ ----------
+ encoding : list
+ List of character names
+ """
+ __slots__ = ('encoding',)
+
+ def __init__(self, filename):
+ with open(filename, 'rb') as file:
+ _log.debug('Parsing TeX encoding %s', filename)
+ self.encoding = self._parse(file)
+ _log.debug('Result: %s', self.encoding)
+
+ def __iter__(self):
+ yield from self.encoding
+
+ @staticmethod
+ def _parse(file):
+ lines = (line.split(b'%', 1)[0].strip() for line in file)
+ data = b''.join(lines)
+ beginning = data.find(b'[')
+ if beginning < 0:
+ raise ValueError("Cannot locate beginning of encoding in {}"
+ .format(file))
+ data = data[beginning:]
+ end = data.find(b']')
+ if end < 0:
+ raise ValueError("Cannot locate end of encoding in {}"
+ .format(file))
+ data = data[:end]
+ return re.findall(br'/([^][{}<>\s]+)', data)
+
+
+# Note: this function should ultimately replace the Encoding class, which
+# appears to be mostly broken: because it uses b''.join(), there is no
+# whitespace left between glyph names (only slashes) so the final re.findall
+# returns a single string with all glyph names. However this does not appear
+# to bother backend_pdf, so that needs to be investigated more. (The fixed
+# version below is necessary for textpath/backend_svg, though.)
+def _parse_enc(path):
+ r"""
+ Parses a \*.enc file referenced from a psfonts.map style file.
+ The format this class understands is a very limited subset of PostScript.
+
+ Parameters
+ ----------
+ path : os.PathLike
+
+ Returns
+ -------
+ list
+ The nth entry of the list is the PostScript glyph name of the nth
+ glyph.
+ """
+ no_comments = re.sub("%.*", "", Path(path).read_text(encoding="ascii"))
+ array = re.search(r"(?s)\[(.*)\]", no_comments).group(1)
+ lines = [line for line in array.split() if line]
+ if all(line.startswith("/") for line in lines):
+ return [line[1:] for line in lines]
+ else:
+ raise ValueError(
+ "Failed to parse {} as Postscript encoding".format(path))
+
+
+@lru_cache()
+def find_tex_file(filename, format=None):
+ """
+ Find a file in the texmf tree.
+
+ Calls :program:`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
+ ----------
+ filename : str or path-like
+ format : str or bytes
+ Used as the value of the ``--format`` option to :program:`kpsewhich`.
+ Could be e.g. 'tfm' or 'vf' to limit the search to that type of files.
+
+ References
+ ----------
+ .. [1] `Kpathsea documentation `_
+ The library that :program:`kpsewhich` is part of.
+ """
+
+ # we expect these to always be ascii encoded, but use utf-8
+ # out of caution
+ if isinstance(filename, bytes):
+ filename = filename.decode('utf-8', errors='replace')
+ if isinstance(format, bytes):
+ format = format.decode('utf-8', errors='replace')
+
+ if os.name == 'nt':
+ # On Windows only, kpathsea can use utf-8 for cmd args and output.
+ # The `command_line_encoding` environment variable is set to force it
+ # to always use utf-8 encoding. See Matplotlib issue #11848.
+ kwargs = {'env': {**os.environ, 'command_line_encoding': 'utf-8'},
+ 'encoding': 'utf-8'}
+ else: # On POSIX, run through the equivalent of os.fsdecode().
+ kwargs = {'encoding': sys.getfilesystemencoding(),
+ 'errors': 'surrogatescape'}
+
+ cmd = ['kpsewhich']
+ if format is not None:
+ cmd += ['--format=' + format]
+ cmd += [filename]
+ try:
+ result = cbook._check_and_log_subprocess(cmd, _log, **kwargs)
+ except (FileNotFoundError, RuntimeError):
+ return ''
+ return result.rstrip('\n')
+
+
+@lru_cache()
+def _fontfile(cls, suffix, texname):
+ filename = find_tex_file(texname + suffix)
+ return cls(filename) if filename else None
+
+
+_tfmfile = partial(_fontfile, Tfm, ".tfm")
+_vffile = partial(_fontfile, Vf, ".vf")
+
+
+if __name__ == '__main__':
+ from argparse import ArgumentParser
+ import itertools
+
+ parser = ArgumentParser()
+ parser.add_argument("filename")
+ parser.add_argument("dpi", nargs="?", type=float, default=None)
+ args = parser.parse_args()
+ with Dvi(args.filename, args.dpi) as dvi:
+ fontmap = PsfontsMap(find_tex_file('pdftex.map'))
+ for page in dvi:
+ print('=== new page ===')
+ for font, group in itertools.groupby(
+ page.text, lambda text: text.font):
+ print('font', font.texname, 'scaled', font._scale / 2 ** 20)
+ for text in group:
+ print(text.x, text.y, text.glyph,
+ chr(text.glyph) if chr(text.glyph).isprintable()
+ else ".",
+ text.width)
+ for x, y, w, h in page.boxes:
+ print(x, y, 'BOX', w, h)
diff --git a/venv/Lib/site-packages/matplotlib/figure.py b/venv/Lib/site-packages/matplotlib/figure.py
new file mode 100644
index 0000000..ba670f5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/figure.py
@@ -0,0 +1,3241 @@
+"""
+`matplotlib.figure` implements the following classes:
+
+`Figure`
+ Top level `~matplotlib.artist.Artist`, which holds all plot elements.
+ Many methods are implemented in `FigureBase`.
+
+`SubFigure`
+ A logical figure inside a figure, usually added to a figure (or parent
+ `SubFigure`) with `Figure.add_subfigure` or `Figure.subfigures` methods
+ (provisional API v3.4).
+
+`SubplotParams`
+ Control the default spacing between subplots.
+"""
+
+import inspect
+import logging
+from numbers import Integral
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib import docstring, projections
+from matplotlib import __version__ as _mpl_version
+
+import matplotlib.artist as martist
+from matplotlib.artist import (
+ Artist, allow_rasterization, _finalize_rasterization)
+from matplotlib.backend_bases import (
+ FigureCanvasBase, NonGuiException, MouseButton)
+import matplotlib._api as _api
+import matplotlib.cbook as cbook
+import matplotlib.colorbar as cbar
+import matplotlib.image as mimage
+
+from matplotlib.axes import Axes, SubplotBase, subplot_class_factory
+from matplotlib.blocking_input import BlockingMouseInput, BlockingKeyMouseInput
+from matplotlib.gridspec import GridSpec
+import matplotlib.legend as mlegend
+from matplotlib.patches import Rectangle
+from matplotlib.text import Text
+from matplotlib.transforms import (Affine2D, Bbox, BboxTransformTo,
+ TransformedBbox)
+import matplotlib._layoutgrid as layoutgrid
+
+_log = logging.getLogger(__name__)
+
+
+def _stale_figure_callback(self, val):
+ if self.figure:
+ self.figure.stale = val
+
+
+class _AxesStack(cbook.Stack):
+ """
+ Specialization of Stack, to handle all tracking of Axes in a Figure.
+
+ This stack stores ``ind, axes`` pairs, where ``ind`` is a serial index
+ tracking the order in which axes were added.
+
+ AxesStack is a callable; calling it returns the current axes.
+ """
+
+ def __init__(self):
+ super().__init__()
+ self._ind = 0
+
+ def as_list(self):
+ """
+ Return a list of the Axes instances that have been added to the figure.
+ """
+ return [a for i, a in sorted(self._elements)]
+
+ def _entry_from_axes(self, e):
+ return next(((ind, a) for ind, a in self._elements if a == e), None)
+
+ def remove(self, a):
+ """Remove the axes from the stack."""
+ super().remove(self._entry_from_axes(a))
+
+ def bubble(self, a):
+ """
+ Move the given axes, which must already exist in the stack, to the top.
+ """
+ return super().bubble(self._entry_from_axes(a))
+
+ def add(self, a):
+ """
+ Add Axes *a* to the stack.
+
+ If *a* is already on the stack, don't add it again.
+ """
+ # All the error checking may be unnecessary; but this method
+ # is called so seldom that the overhead is negligible.
+ _api.check_isinstance(Axes, a=a)
+
+ if a in self:
+ return
+
+ self._ind += 1
+ super().push((self._ind, a))
+
+ def __call__(self):
+ """
+ Return the active axes.
+
+ If no axes exists on the stack, then returns None.
+ """
+ if not len(self._elements):
+ return None
+ else:
+ index, axes = self._elements[self._pos]
+ return axes
+
+ def __contains__(self, a):
+ return a in self.as_list()
+
+
+class SubplotParams:
+ """
+ A class to hold the parameters for a subplot.
+ """
+ def __init__(self, left=None, bottom=None, right=None, top=None,
+ wspace=None, hspace=None):
+ """
+ Defaults are given by :rc:`figure.subplot.[name]`.
+
+ Parameters
+ ----------
+ left : float
+ The position of the left edge of the subplots,
+ as a fraction of the figure width.
+ right : float
+ The position of the right edge of the subplots,
+ as a fraction of the figure width.
+ bottom : float
+ The position of the bottom edge of the subplots,
+ as a fraction of the figure height.
+ top : float
+ The position of the top edge of the subplots,
+ as a fraction of the figure height.
+ wspace : float
+ The width of the padding between subplots,
+ as a fraction of the average Axes width.
+ hspace : float
+ The height of the padding between subplots,
+ as a fraction of the average Axes height.
+ """
+ self.validate = True
+ for key in ["left", "bottom", "right", "top", "wspace", "hspace"]:
+ setattr(self, key, mpl.rcParams[f"figure.subplot.{key}"])
+ self.update(left, bottom, right, top, wspace, hspace)
+
+ def update(self, left=None, bottom=None, right=None, top=None,
+ wspace=None, hspace=None):
+ """
+ Update the dimensions of the passed parameters. *None* means unchanged.
+ """
+ if self.validate:
+ if ((left if left is not None else self.left)
+ >= (right if right is not None else self.right)):
+ raise ValueError('left cannot be >= right')
+ if ((bottom if bottom is not None else self.bottom)
+ >= (top if top is not None else self.top)):
+ raise ValueError('bottom cannot be >= top')
+ if left is not None:
+ self.left = left
+ if right is not None:
+ self.right = right
+ if bottom is not None:
+ self.bottom = bottom
+ if top is not None:
+ self.top = top
+ if wspace is not None:
+ self.wspace = wspace
+ if hspace is not None:
+ self.hspace = hspace
+
+
+class FigureBase(Artist):
+ """
+ Base class for `.figure.Figure` and `.figure.SubFigure` containing the
+ methods that add artists to the figure or subfigure, create Axes, etc.
+ """
+ def __init__(self):
+ super().__init__()
+ # remove the non-figure artist _axes property
+ # as it makes no sense for a figure to be _in_ an axes
+ # this is used by the property methods in the artist base class
+ # which are over-ridden in this class
+ del self._axes
+
+ self._suptitle = None
+ self._supxlabel = None
+ self._supylabel = None
+
+ # constrained_layout:
+ self._layoutgrid = None
+
+ # groupers to keep track of x and y labels we want to align.
+ # see self.align_xlabels and self.align_ylabels and
+ # axis._get_tick_boxes_siblings
+ self._align_label_groups = {"x": cbook.Grouper(), "y": cbook.Grouper()}
+
+ self.figure = self
+ # list of child gridspecs for this figure
+ self._gridspecs = []
+ self._localaxes = _AxesStack() # track all axes and current axes
+ self.artists = []
+ self.lines = []
+ self.patches = []
+ self.texts = []
+ self.images = []
+ self.legends = []
+ self.subfigs = []
+ self.stale = True
+ self.suppressComposite = None
+
+ def _get_draw_artists(self, renderer):
+ """Also runs apply_aspect"""
+ artists = self.get_children()
+ for sfig in self.subfigs:
+ artists.remove(sfig)
+ childa = sfig.get_children()
+ for child in childa:
+ if child in artists:
+ artists.remove(child)
+
+ artists.remove(self.patch)
+ artists = sorted(
+ (artist for artist in artists if not artist.get_animated()),
+ key=lambda artist: artist.get_zorder())
+ for ax in self._localaxes.as_list():
+ locator = ax.get_axes_locator()
+ if locator:
+ pos = locator(ax, renderer)
+ ax.apply_aspect(pos)
+ else:
+ ax.apply_aspect()
+
+ for child in ax.get_children():
+ if hasattr(child, 'apply_aspect'):
+ locator = child.get_axes_locator()
+ if locator:
+ pos = locator(child, renderer)
+ child.apply_aspect(pos)
+ else:
+ child.apply_aspect()
+ return artists
+
+ def autofmt_xdate(
+ self, bottom=0.2, rotation=30, ha='right', which='major'):
+ """
+ Date ticklabels often overlap, so it is useful to rotate them
+ and right align them. Also, a common use case is a number of
+ subplots with shared x-axis where the x-axis is date data. The
+ ticklabels are often long, and it helps to rotate them on the
+ bottom subplot and turn them off on other subplots, as well as
+ turn off xlabels.
+
+ Parameters
+ ----------
+ bottom : float, default: 0.2
+ The bottom of the subplots for `subplots_adjust`.
+ rotation : float, default: 30 degrees
+ The rotation angle of the xtick labels in degrees.
+ ha : {'left', 'center', 'right'}, default: 'right'
+ The horizontal alignment of the xticklabels.
+ which : {'major', 'minor', 'both'}, default: 'major'
+ Selects which ticklabels to rotate.
+ """
+ if which is None:
+ _api.warn_deprecated(
+ "3.3", message="Support for passing which=None to mean "
+ "which='major' is deprecated since %(since)s and will be "
+ "removed %(removal)s.")
+ allsubplots = all(hasattr(ax, 'get_subplotspec') for ax in self.axes)
+ if len(self.axes) == 1:
+ for label in self.axes[0].get_xticklabels(which=which):
+ label.set_ha(ha)
+ label.set_rotation(rotation)
+ else:
+ if allsubplots:
+ for ax in self.get_axes():
+ if ax.get_subplotspec().is_last_row():
+ for label in ax.get_xticklabels(which=which):
+ label.set_ha(ha)
+ label.set_rotation(rotation)
+ else:
+ for label in ax.get_xticklabels(which=which):
+ label.set_visible(False)
+ ax.set_xlabel('')
+
+ if allsubplots:
+ self.subplots_adjust(bottom=bottom)
+ self.stale = True
+
+ def get_children(self):
+ """Get a list of artists contained in the figure."""
+ return [self.patch,
+ *self.artists,
+ *self._localaxes.as_list(),
+ *self.lines,
+ *self.patches,
+ *self.texts,
+ *self.images,
+ *self.legends,
+ *self.subfigs]
+
+ def contains(self, mouseevent):
+ """
+ Test whether the mouse event occurred on the figure.
+
+ Returns
+ -------
+ bool, {}
+ """
+ inside, info = self._default_contains(mouseevent, figure=self)
+ if inside is not None:
+ return inside, info
+ inside = self.bbox.contains(mouseevent.x, mouseevent.y)
+ return inside, {}
+
+ def get_window_extent(self, *args, **kwargs):
+ """
+ Return the figure bounding box in display space. Arguments are ignored.
+ """
+ return self.bbox
+
+ def _suplabels(self, t, info, **kwargs):
+ """
+ Add a centered %(name)s to the figure.
+
+ Parameters
+ ----------
+ t : str
+ The %(name)s text.
+ x : float, default: %(x0)s
+ The x location of the text in figure coordinates.
+ y : float, default: %(y0)s
+ The y location of the text in figure coordinates.
+ horizontalalignment, ha : {'center', 'left', 'right'}, default: %(ha)s
+ The horizontal alignment of the text relative to (*x*, *y*).
+ verticalalignment, va : {'top', 'center', 'bottom', 'baseline'}, \
+default: %(va)s
+ The vertical alignment of the text relative to (*x*, *y*).
+ fontsize, size : default: :rc:`figure.titlesize`
+ The font size of the text. See `.Text.set_size` for possible
+ values.
+ fontweight, weight : default: :rc:`figure.titleweight`
+ The font weight of the text. See `.Text.set_weight` for possible
+ values.
+
+ Returns
+ -------
+ text
+ The `.Text` instance of the %(name)s.
+
+ Other Parameters
+ ----------------
+ fontproperties : None or dict, optional
+ A dict of font properties. If *fontproperties* is given the
+ default values for font size and weight are taken from the
+ `.FontProperties` defaults. :rc:`figure.titlesize` and
+ :rc:`figure.titleweight` are ignored in this case.
+
+ **kwargs
+ Additional kwargs are `matplotlib.text.Text` properties.
+ """
+
+ suplab = getattr(self, info['name'])
+
+ x = kwargs.pop('x', None)
+ y = kwargs.pop('y', None)
+ autopos = x is None and y is None
+ if x is None:
+ x = info['x0']
+ if y is None:
+ y = info['y0']
+
+ if 'horizontalalignment' not in kwargs and 'ha' not in kwargs:
+ kwargs['horizontalalignment'] = info['ha']
+ if 'verticalalignment' not in kwargs and 'va' not in kwargs:
+ kwargs['verticalalignment'] = info['va']
+ if 'rotation' not in kwargs:
+ kwargs['rotation'] = info['rotation']
+
+ if 'fontproperties' not in kwargs:
+ if 'fontsize' not in kwargs and 'size' not in kwargs:
+ kwargs['size'] = mpl.rcParams['figure.titlesize']
+ if 'fontweight' not in kwargs and 'weight' not in kwargs:
+ kwargs['weight'] = mpl.rcParams['figure.titleweight']
+
+ sup = self.text(x, y, t, **kwargs)
+ if suplab is not None:
+ suplab.set_text(t)
+ suplab.set_position((x, y))
+ suplab.update_from(sup)
+ sup.remove()
+ else:
+ suplab = sup
+ suplab._autopos = autopos
+ setattr(self, info['name'], suplab)
+ self.stale = True
+ return suplab
+
+ @docstring.Substitution(x0=0.5, y0=0.98, name='suptitle', ha='center',
+ va='top')
+ @docstring.copy(_suplabels)
+ def suptitle(self, t, **kwargs):
+ # docstring from _suplabels...
+ info = {'name': '_suptitle', 'x0': 0.5, 'y0': 0.98,
+ 'ha': 'center', 'va': 'top', 'rotation': 0}
+ return self._suplabels(t, info, **kwargs)
+
+ @docstring.Substitution(x0=0.5, y0=0.01, name='supxlabel', ha='center',
+ va='bottom')
+ @docstring.copy(_suplabels)
+ def supxlabel(self, t, **kwargs):
+ # docstring from _suplabels...
+ info = {'name': '_supxlabel', 'x0': 0.5, 'y0': 0.01,
+ 'ha': 'center', 'va': 'bottom', 'rotation': 0}
+ return self._suplabels(t, info, **kwargs)
+
+ @docstring.Substitution(x0=0.02, y0=0.5, name='supylabel', ha='left',
+ va='center')
+ @docstring.copy(_suplabels)
+ def supylabel(self, t, **kwargs):
+ # docstring from _suplabels...
+ info = {'name': '_supylabel', 'x0': 0.02, 'y0': 0.5,
+ 'ha': 'left', 'va': 'center', 'rotation': 'vertical',
+ 'rotation_mode': 'anchor'}
+ return self._suplabels(t, info, **kwargs)
+
+ def get_edgecolor(self):
+ """Get the edge color of the Figure rectangle."""
+ return self.patch.get_edgecolor()
+
+ def get_facecolor(self):
+ """Get the face color of the Figure rectangle."""
+ return self.patch.get_facecolor()
+
+ def get_frameon(self):
+ """
+ Return the figure's background patch visibility, i.e.
+ whether the figure background will be drawn. Equivalent to
+ ``Figure.patch.get_visible()``.
+ """
+ return self.patch.get_visible()
+
+ def set_linewidth(self, linewidth):
+ """
+ Set the line width of the Figure rectangle.
+
+ Parameters
+ ----------
+ linewidth : number
+ """
+ self.patch.set_linewidth(linewidth)
+
+ def get_linewidth(self):
+ """
+ Get the line width of the Figure rectangle.
+ """
+ return self.patch.get_linewidth()
+
+ def set_edgecolor(self, color):
+ """
+ Set the edge color of the Figure rectangle.
+
+ Parameters
+ ----------
+ color : color
+ """
+ self.patch.set_edgecolor(color)
+
+ def set_facecolor(self, color):
+ """
+ Set the face color of the Figure rectangle.
+
+ Parameters
+ ----------
+ color : color
+ """
+ self.patch.set_facecolor(color)
+
+ def set_frameon(self, b):
+ """
+ Set the figure's background patch visibility, i.e.
+ whether the figure background will be drawn. Equivalent to
+ ``Figure.patch.set_visible()``.
+
+ Parameters
+ ----------
+ b : bool
+ """
+ self.patch.set_visible(b)
+ self.stale = True
+
+ frameon = property(get_frameon, set_frameon)
+
+ def add_artist(self, artist, clip=False):
+ """
+ Add an `.Artist` to the figure.
+
+ Usually artists are added to Axes objects using `.Axes.add_artist`;
+ this method can be used in the rare cases where one needs to add
+ artists directly to the figure instead.
+
+ Parameters
+ ----------
+ artist : `~matplotlib.artist.Artist`
+ The artist to add to the figure. If the added artist has no
+ transform previously set, its transform will be set to
+ ``figure.transSubfigure``.
+ clip : bool, default: False
+ Whether the added artist should be clipped by the figure patch.
+
+ Returns
+ -------
+ `~matplotlib.artist.Artist`
+ The added artist.
+ """
+ artist.set_figure(self)
+ self.artists.append(artist)
+ artist._remove_method = self.artists.remove
+
+ if not artist.is_transform_set():
+ artist.set_transform(self.transSubfigure)
+
+ if clip:
+ artist.set_clip_path(self.patch)
+
+ self.stale = True
+ return artist
+
+ @docstring.dedent_interpd
+ def add_axes(self, *args, **kwargs):
+ """
+ Add an Axes to the figure.
+
+ Call signatures::
+
+ add_axes(rect, projection=None, polar=False, **kwargs)
+ add_axes(ax)
+
+ Parameters
+ ----------
+ rect : sequence of float
+ The dimensions [left, bottom, width, height] of the new Axes. All
+ quantities are in fractions of figure width and height.
+
+ projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', \
+'polar', 'rectilinear', str}, optional
+ The projection type of the `~.axes.Axes`. *str* is the name of
+ a custom projection, see `~matplotlib.projections`. The default
+ None results in a 'rectilinear' projection.
+
+ polar : bool, default: False
+ If True, equivalent to projection='polar'.
+
+ axes_class : subclass type of `~.axes.Axes`, optional
+ The `.axes.Axes` subclass that is instantiated. This parameter
+ is incompatible with *projection* and *polar*. See
+ :ref:`axisartist_users-guide-index` for examples.
+
+ sharex, sharey : `~.axes.Axes`, optional
+ Share the x or y `~matplotlib.axis` with sharex and/or sharey.
+ The axis will have the same limits, ticks, and scale as the axis
+ of the shared axes.
+
+ label : str
+ A label for the returned Axes.
+
+ Returns
+ -------
+ `~.axes.Axes`, or a subclass of `~.axes.Axes`
+ The returned axes class depends on the projection used. It is
+ `~.axes.Axes` if rectilinear projection is used and
+ `.projections.polar.PolarAxes` if polar projection is used.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ This method also takes the keyword arguments for
+ the returned Axes class. The keyword arguments for the
+ rectilinear Axes class `~.axes.Axes` can be found in
+ the following table but there might also be other keyword
+ arguments if another projection is used, see the actual Axes
+ class.
+
+ %(Axes_kwdoc)s
+
+ Notes
+ -----
+ In rare circumstances, `.add_axes` may be called with a single
+ argument, an Axes instance already created in the present figure but
+ not in the figure's list of Axes.
+
+ See Also
+ --------
+ .Figure.add_subplot
+ .pyplot.subplot
+ .pyplot.axes
+ .Figure.subplots
+ .pyplot.subplots
+
+ Examples
+ --------
+ Some simple examples::
+
+ rect = l, b, w, h
+ fig = plt.figure()
+ fig.add_axes(rect)
+ fig.add_axes(rect, frameon=False, facecolor='g')
+ fig.add_axes(rect, polar=True)
+ ax = fig.add_axes(rect, projection='polar')
+ fig.delaxes(ax)
+ fig.add_axes(ax)
+ """
+
+ if not len(args) and 'rect' not in kwargs:
+ _api.warn_deprecated(
+ "3.3",
+ message="Calling add_axes() without argument is "
+ "deprecated since %(since)s and will be removed %(removal)s. "
+ "You may want to use add_subplot() instead.")
+ return
+ elif 'rect' in kwargs:
+ if len(args):
+ raise TypeError(
+ "add_axes() got multiple values for argument 'rect'")
+ args = (kwargs.pop('rect'), )
+
+ if isinstance(args[0], Axes):
+ a = args[0]
+ key = a._projection_init
+ if a.get_figure() is not self:
+ raise ValueError(
+ "The Axes must have been created in the present figure")
+ else:
+ rect = args[0]
+ if not np.isfinite(rect).all():
+ raise ValueError('all entries in rect must be finite '
+ 'not {}'.format(rect))
+ projection_class, pkw = self._process_projection_requirements(
+ *args, **kwargs)
+
+ # create the new axes using the axes class given
+ a = projection_class(self, rect, **pkw)
+ key = (projection_class, pkw)
+ return self._add_axes_internal(a, key)
+
+ @docstring.dedent_interpd
+ def add_subplot(self, *args, **kwargs):
+ """
+ Add an `~.axes.Axes` to the figure as part of a subplot arrangement.
+
+ Call signatures::
+
+ add_subplot(nrows, ncols, index, **kwargs)
+ add_subplot(pos, **kwargs)
+ add_subplot(ax)
+ add_subplot()
+
+ Parameters
+ ----------
+ *args : int, (int, int, *index*), or `.SubplotSpec`, default: (1, 1, 1)
+ The position of the subplot described by one of
+
+ - Three integers (*nrows*, *ncols*, *index*). The subplot will
+ take the *index* position on a grid with *nrows* rows and
+ *ncols* columns. *index* starts at 1 in the upper left corner
+ and increases to the right. *index* can also be a two-tuple
+ specifying the (*first*, *last*) indices (1-based, and including
+ *last*) of the subplot, e.g., ``fig.add_subplot(3, 1, (1, 2))``
+ makes a subplot that spans the upper 2/3 of the figure.
+ - A 3-digit integer. The digits are interpreted as if given
+ separately as three single-digit integers, i.e.
+ ``fig.add_subplot(235)`` is the same as
+ ``fig.add_subplot(2, 3, 5)``. Note that this can only be used
+ if there are no more than 9 subplots.
+ - A `.SubplotSpec`.
+
+ In rare circumstances, `.add_subplot` may be called with a single
+ argument, a subplot Axes instance already created in the
+ present figure but not in the figure's list of Axes.
+
+ projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', \
+'polar', 'rectilinear', str}, optional
+ The projection type of the subplot (`~.axes.Axes`). *str* is the
+ name of a custom projection, see `~matplotlib.projections`. The
+ default None results in a 'rectilinear' projection.
+
+ polar : bool, default: False
+ If True, equivalent to projection='polar'.
+
+ axes_class : subclass type of `~.axes.Axes`, optional
+ The `.axes.Axes` subclass that is instantiated. This parameter
+ is incompatible with *projection* and *polar*. See
+ :ref:`axisartist_users-guide-index` for examples.
+
+ sharex, sharey : `~.axes.Axes`, optional
+ Share the x or y `~matplotlib.axis` with sharex and/or sharey.
+ The axis will have the same limits, ticks, and scale as the axis
+ of the shared axes.
+
+ label : str
+ A label for the returned Axes.
+
+ Returns
+ -------
+ `.axes.SubplotBase`, or another subclass of `~.axes.Axes`
+
+ The Axes of the subplot. The returned Axes base class depends on
+ the projection used. It is `~.axes.Axes` if rectilinear projection
+ is used and `.projections.polar.PolarAxes` if polar projection
+ is used. The returned Axes is then a subplot subclass of the
+ base class.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ This method also takes the keyword arguments for the returned Axes
+ base class; except for the *figure* argument. The keyword arguments
+ for the rectilinear base class `~.axes.Axes` can be found in
+ the following table but there might also be other keyword
+ arguments if another projection is used.
+
+ %(Axes_kwdoc)s
+
+ See Also
+ --------
+ .Figure.add_axes
+ .pyplot.subplot
+ .pyplot.axes
+ .Figure.subplots
+ .pyplot.subplots
+
+ Examples
+ --------
+ ::
+
+ fig = plt.figure()
+
+ fig.add_subplot(231)
+ ax1 = fig.add_subplot(2, 3, 1) # equivalent but more general
+
+ fig.add_subplot(232, frameon=False) # subplot with no frame
+ fig.add_subplot(233, projection='polar') # polar subplot
+ fig.add_subplot(234, sharex=ax1) # subplot sharing x-axis with ax1
+ fig.add_subplot(235, facecolor="red") # red subplot
+
+ ax1.remove() # delete ax1 from the figure
+ fig.add_subplot(ax1) # add ax1 back to the figure
+ """
+ if 'figure' in kwargs:
+ # Axes itself allows for a 'figure' kwarg, but since we want to
+ # bind the created Axes to self, it is not allowed here.
+ raise TypeError(
+ "add_subplot() got an unexpected keyword argument 'figure'")
+
+ if len(args) == 1 and isinstance(args[0], SubplotBase):
+ ax = args[0]
+ key = ax._projection_init
+ if ax.get_figure() is not self:
+ raise ValueError("The Subplot must have been created in "
+ "the present figure")
+ else:
+ if not args:
+ args = (1, 1, 1)
+ # Normalize correct ijk values to (i, j, k) here so that
+ # add_subplot(211) == add_subplot(2, 1, 1). Invalid values will
+ # trigger errors later (via SubplotSpec._from_subplot_args).
+ if (len(args) == 1 and isinstance(args[0], Integral)
+ and 100 <= args[0] <= 999):
+ args = tuple(map(int, str(args[0])))
+ projection_class, pkw = self._process_projection_requirements(
+ *args, **kwargs)
+ ax = subplot_class_factory(projection_class)(self, *args, **pkw)
+ key = (projection_class, pkw)
+ return self._add_axes_internal(ax, key)
+
+ def _add_axes_internal(self, ax, key):
+ """Private helper for `add_axes` and `add_subplot`."""
+ self._axstack.add(ax)
+ self._localaxes.add(ax)
+ self.sca(ax)
+ ax._remove_method = self.delaxes
+ # this is to support plt.subplot's re-selection logic
+ ax._projection_init = key
+ self.stale = True
+ ax.stale_callback = _stale_figure_callback
+ return ax
+
+ @_api.make_keyword_only("3.3", "sharex")
+ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
+ squeeze=True, subplot_kw=None, gridspec_kw=None):
+ """
+ Add a set of subplots to this figure.
+
+ This utility wrapper makes it convenient to create common layouts of
+ subplots in a single call.
+
+ Parameters
+ ----------
+ nrows, ncols : int, default: 1
+ Number of rows/columns of the subplot grid.
+
+ sharex, sharey : bool or {'none', 'all', 'row', 'col'}, default: False
+ Controls sharing of properties among x (*sharex*) or y (*sharey*)
+ axes:
+
+ - True or 'all': x- or y-axis will be shared among all subplots.
+ - False or 'none': each subplot x- or y-axis will be independent.
+ - 'row': each subplot row will share an x- or y-axis.
+ - 'col': each subplot column will share an x- or y-axis.
+
+ When subplots have a shared x-axis along a column, only the x tick
+ labels of the bottom subplot are created. Similarly, when subplots
+ have a shared y-axis along a row, only the y tick labels of the
+ first column subplot are created. To later turn other subplots'
+ ticklabels on, use `~matplotlib.axes.Axes.tick_params`.
+
+ When subplots have a shared axis that has units, calling
+ `.Axis.set_units` will update each axis with the new units.
+
+ squeeze : bool, default: True
+ - If True, extra dimensions are squeezed out from the returned
+ array of Axes:
+
+ - if only one subplot is constructed (nrows=ncols=1), the
+ resulting single Axes object is returned as a scalar.
+ - for Nx1 or 1xM subplots, the returned object is a 1D numpy
+ object array of Axes objects.
+ - for NxM, subplots with N>1 and M>1 are returned as a 2D array.
+
+ - If False, no squeezing at all is done: the returned Axes object
+ is always a 2D array containing Axes instances, even if it ends
+ up being 1x1.
+
+ subplot_kw : dict, optional
+ Dict with keywords passed to the `.Figure.add_subplot` call used to
+ create each subplot.
+
+ gridspec_kw : dict, optional
+ Dict with keywords passed to the
+ `~matplotlib.gridspec.GridSpec` constructor used to create
+ the grid the subplots are placed on.
+
+ Returns
+ -------
+ `~.axes.Axes` or array of Axes
+ Either a single `~matplotlib.axes.Axes` object or an array of Axes
+ objects if more than one subplot was created. The dimensions of the
+ resulting array can be controlled with the *squeeze* keyword, see
+ above.
+
+ See Also
+ --------
+ .pyplot.subplots
+ .Figure.add_subplot
+ .pyplot.subplot
+
+ Examples
+ --------
+ ::
+
+ # First create some toy data:
+ x = np.linspace(0, 2*np.pi, 400)
+ y = np.sin(x**2)
+
+ # Create a figure
+ plt.figure()
+
+ # Create a subplot
+ ax = fig.subplots()
+ ax.plot(x, y)
+ ax.set_title('Simple plot')
+
+ # Create two subplots and unpack the output array immediately
+ ax1, ax2 = fig.subplots(1, 2, sharey=True)
+ ax1.plot(x, y)
+ ax1.set_title('Sharing Y axis')
+ ax2.scatter(x, y)
+
+ # Create four polar Axes and access them through the returned array
+ axes = fig.subplots(2, 2, subplot_kw=dict(projection='polar'))
+ axes[0, 0].plot(x, y)
+ axes[1, 1].scatter(x, y)
+
+ # Share a X axis with each column of subplots
+ fig.subplots(2, 2, sharex='col')
+
+ # Share a Y axis with each row of subplots
+ fig.subplots(2, 2, sharey='row')
+
+ # Share both X and Y axes with all subplots
+ fig.subplots(2, 2, sharex='all', sharey='all')
+
+ # Note that this is the same as
+ fig.subplots(2, 2, sharex=True, sharey=True)
+ """
+ if gridspec_kw is None:
+ gridspec_kw = {}
+ gs = self.add_gridspec(nrows, ncols, figure=self, **gridspec_kw)
+ axs = gs.subplots(sharex=sharex, sharey=sharey, squeeze=squeeze,
+ subplot_kw=subplot_kw)
+ return axs
+
+ def delaxes(self, ax):
+ """
+ Remove the `~.axes.Axes` *ax* from the figure; update the current Axes.
+ """
+
+ def _reset_locators_and_formatters(axis):
+ # Set the formatters and locators to be associated with axis
+ # (where previously they may have been associated with another
+ # Axis instance)
+ #
+ # Because set_major_formatter() etc. force isDefault_* to be False,
+ # we have to manually check if the original formatter was a
+ # default and manually set isDefault_* if that was the case.
+ majfmt = axis.get_major_formatter()
+ isDefault = majfmt.axis.isDefault_majfmt
+ axis.set_major_formatter(majfmt)
+ if isDefault:
+ majfmt.axis.isDefault_majfmt = True
+
+ majloc = axis.get_major_locator()
+ isDefault = majloc.axis.isDefault_majloc
+ axis.set_major_locator(majloc)
+ if isDefault:
+ majloc.axis.isDefault_majloc = True
+
+ minfmt = axis.get_minor_formatter()
+ isDefault = majloc.axis.isDefault_minfmt
+ axis.set_minor_formatter(minfmt)
+ if isDefault:
+ minfmt.axis.isDefault_minfmt = True
+
+ minloc = axis.get_minor_locator()
+ isDefault = majloc.axis.isDefault_minloc
+ axis.set_minor_locator(minloc)
+ if isDefault:
+ minloc.axis.isDefault_minloc = True
+
+ def _break_share_link(ax, grouper):
+ siblings = grouper.get_siblings(ax)
+ if len(siblings) > 1:
+ grouper.remove(ax)
+ for last_ax in siblings:
+ if ax is not last_ax:
+ return last_ax
+ return None
+
+ self._axstack.remove(ax)
+ self._axobservers.process("_axes_change_event", self)
+ self.stale = True
+ self._localaxes.remove(ax)
+
+ last_ax = _break_share_link(ax, ax._shared_y_axes)
+ if last_ax is not None:
+ _reset_locators_and_formatters(last_ax.yaxis)
+
+ last_ax = _break_share_link(ax, ax._shared_x_axes)
+ if last_ax is not None:
+ _reset_locators_and_formatters(last_ax.xaxis)
+
+ # Note: in the docstring below, the newlines in the examples after the
+ # calls to legend() allow replacing it with figlegend() to generate the
+ # docstring of pyplot.figlegend.
+
+ @docstring.dedent_interpd
+ def legend(self, *args, **kwargs):
+ """
+ Place a legend on the figure.
+
+ Call signatures::
+
+ legend()
+ legend(labels)
+ legend(handles, labels)
+
+ The call signatures correspond to these three different ways to use
+ this method:
+
+ **1. Automatic detection of elements to be shown in the legend**
+
+ The elements to be added to the legend are automatically determined,
+ when you do not pass in any extra arguments.
+
+ In this case, the labels are taken from the artist. You can specify
+ them either at artist creation or by calling the
+ :meth:`~.Artist.set_label` method on the artist::
+
+ ax.plot([1, 2, 3], label='Inline label')
+ fig.legend()
+
+ or::
+
+ line, = ax.plot([1, 2, 3])
+ line.set_label('Label via method')
+ fig.legend()
+
+ Specific lines can be excluded from the automatic legend element
+ selection by defining a label starting with an underscore.
+ This is default for all artists, so calling `.Figure.legend` without
+ any arguments and without setting the labels manually will result in
+ no legend being drawn.
+
+
+ **2. Labeling existing plot elements**
+
+ To make a legend for all artists on all Axes, call this function with
+ an iterable of strings, one for each legend item. For example::
+
+ fig, (ax1, ax2) = plt.subplots(1, 2)
+ ax1.plot([1, 3, 5], color='blue')
+ ax2.plot([2, 4, 6], color='red')
+ fig.legend(['the blues', 'the reds'])
+
+ Note: This call signature is discouraged, because the relation between
+ plot elements and labels is only implicit by their order and can
+ easily be mixed up.
+
+
+ **3. Explicitly defining the elements in the legend**
+
+ For full control of which artists have a legend entry, it is possible
+ to pass an iterable of legend artists followed by an iterable of
+ legend labels respectively::
+
+ fig.legend([line1, line2, line3], ['label1', 'label2', 'label3'])
+
+ Parameters
+ ----------
+ handles : list of `.Artist`, optional
+ A list of Artists (lines, patches) to be added to the legend.
+ Use this together with *labels*, if you need full control on what
+ is shown in the legend and the automatic mechanism described above
+ is not sufficient.
+
+ The length of handles and labels should be the same in this
+ case. If they are not, they are truncated to the smaller length.
+
+ labels : list of str, optional
+ A list of labels to show next to the artists.
+ Use this together with *handles*, if you need full control on what
+ is shown in the legend and the automatic mechanism described above
+ is not sufficient.
+
+ Returns
+ -------
+ `~matplotlib.legend.Legend`
+
+ Other Parameters
+ ----------------
+ %(_legend_kw_doc)s
+
+ See Also
+ --------
+ .Axes.legend
+
+ Notes
+ -----
+ Some artists are not supported by this function. See
+ :doc:`/tutorials/intermediate/legend_guide` for details.
+ """
+
+ handles, labels, extra_args, kwargs = mlegend._parse_legend_args(
+ self.axes,
+ *args,
+ **kwargs)
+ # check for third arg
+ if len(extra_args):
+ # _api.warn_deprecated(
+ # "2.1",
+ # message="Figure.legend will accept no more than two "
+ # "positional arguments in the future. Use "
+ # "'fig.legend(handles, labels, loc=location)' "
+ # "instead.")
+ # kwargs['loc'] = extra_args[0]
+ # extra_args = extra_args[1:]
+ pass
+ transform = kwargs.pop('bbox_transform', self.transSubfigure)
+ # explicitly set the bbox transform if the user hasn't.
+ l = mlegend.Legend(self, handles, labels, *extra_args,
+ bbox_transform=transform, **kwargs)
+ self.legends.append(l)
+ l._remove_method = self.legends.remove
+ self.stale = True
+ return l
+
+ @docstring.dedent_interpd
+ def text(self, x, y, s, fontdict=None, **kwargs):
+ """
+ Add text to figure.
+
+ Parameters
+ ----------
+ x, y : float
+ The position to place the text. By default, this is in figure
+ coordinates, floats in [0, 1]. The coordinate system can be changed
+ using the *transform* keyword.
+
+ s : str
+ The text string.
+
+ fontdict : dict, optional
+ A dictionary to override the default text properties. If not given,
+ the defaults are determined by :rc:`font.*`. Properties passed as
+ *kwargs* override the corresponding ones given in *fontdict*.
+
+ Returns
+ -------
+ `~.text.Text`
+
+ Other Parameters
+ ----------------
+ **kwargs : `~matplotlib.text.Text` properties
+ Other miscellaneous text parameters.
+
+ %(Text_kwdoc)s
+
+ See Also
+ --------
+ .Axes.text
+ .pyplot.text
+ """
+ effective_kwargs = {
+ 'transform': self.transSubfigure,
+ **(fontdict if fontdict is not None else {}),
+ **kwargs,
+ }
+ text = Text(x=x, y=y, text=s, **effective_kwargs)
+ text.set_figure(self)
+ text.stale_callback = _stale_figure_callback
+
+ self.texts.append(text)
+ text._remove_method = self.texts.remove
+ self.stale = True
+ return text
+
+ @docstring.dedent_interpd
+ def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
+ """%(colorbar_doc)s"""
+ if ax is None:
+ ax = self.gca()
+ if (hasattr(mappable, "axes") and ax is not mappable.axes
+ and cax is None):
+ _api.warn_deprecated(
+ "3.4", message="Starting from Matplotlib 3.6, colorbar() "
+ "will steal space from the mappable's axes, rather than "
+ "from the current axes, to place the colorbar. To "
+ "silence this warning, explicitly pass the 'ax' argument "
+ "to colorbar().")
+
+ # Store the value of gca so that we can set it back later on.
+ current_ax = self.gca()
+ if cax is None:
+ if (use_gridspec and isinstance(ax, SubplotBase)
+ and not self.get_constrained_layout()):
+ cax, kw = cbar.make_axes_gridspec(ax, **kw)
+ else:
+ cax, kw = cbar.make_axes(ax, **kw)
+
+ # need to remove kws that cannot be passed to Colorbar
+ NON_COLORBAR_KEYS = ['fraction', 'pad', 'shrink', 'aspect', 'anchor',
+ 'panchor']
+ cb_kw = {k: v for k, v in kw.items() if k not in NON_COLORBAR_KEYS}
+ cb = cbar.Colorbar(cax, mappable, **cb_kw)
+
+ self.sca(current_ax)
+ self.stale = True
+ return cb
+
+ def subplots_adjust(self, left=None, bottom=None, right=None, top=None,
+ wspace=None, hspace=None):
+ """
+ Adjust the subplot layout parameters.
+
+ Unset parameters are left unmodified; initial values are given by
+ :rc:`figure.subplot.[name]`.
+
+ Parameters
+ ----------
+ left : float, optional
+ The position of the left edge of the subplots,
+ as a fraction of the figure width.
+ right : float, optional
+ The position of the right edge of the subplots,
+ as a fraction of the figure width.
+ bottom : float, optional
+ The position of the bottom edge of the subplots,
+ as a fraction of the figure height.
+ top : float, optional
+ The position of the top edge of the subplots,
+ as a fraction of the figure height.
+ wspace : float, optional
+ The width of the padding between subplots,
+ as a fraction of the average Axes width.
+ hspace : float, optional
+ The height of the padding between subplots,
+ as a fraction of the average Axes height.
+ """
+ if self.get_constrained_layout():
+ self.set_constrained_layout(False)
+ _api.warn_external(
+ "This figure was using constrained_layout, but that is "
+ "incompatible with subplots_adjust and/or tight_layout; "
+ "disabling constrained_layout.")
+ self.subplotpars.update(left, bottom, right, top, wspace, hspace)
+ for ax in self.axes:
+ if isinstance(ax, SubplotBase):
+ ax._set_position(ax.get_subplotspec().get_position(self))
+ self.stale = True
+
+ def align_xlabels(self, axs=None):
+ """
+ Align the xlabels of subplots in the same subplot column if label
+ alignment is being done automatically (i.e. the label position is
+ not manually set).
+
+ Alignment persists for draw events after this is called.
+
+ If a label is on the bottom, it is aligned with labels on Axes that
+ also have their label on the bottom and that have the same
+ bottom-most subplot row. If the label is on the top,
+ it is aligned with labels on Axes with the same top-most row.
+
+ Parameters
+ ----------
+ axs : list of `~matplotlib.axes.Axes`
+ Optional list of (or ndarray) `~matplotlib.axes.Axes`
+ to align the xlabels.
+ Default is to align all Axes on the figure.
+
+ See Also
+ --------
+ matplotlib.figure.Figure.align_ylabels
+ matplotlib.figure.Figure.align_labels
+
+ Notes
+ -----
+ This assumes that ``axs`` are from the same `.GridSpec`, so that
+ their `.SubplotSpec` positions correspond to figure positions.
+
+ Examples
+ --------
+ Example with rotated xtick labels::
+
+ fig, axs = plt.subplots(1, 2)
+ for tick in axs[0].get_xticklabels():
+ tick.set_rotation(55)
+ axs[0].set_xlabel('XLabel 0')
+ axs[1].set_xlabel('XLabel 1')
+ fig.align_xlabels()
+ """
+ if axs is None:
+ axs = self.axes
+ axs = np.ravel(axs)
+ for ax in axs:
+ _log.debug(' Working on: %s', ax.get_xlabel())
+ rowspan = ax.get_subplotspec().rowspan
+ pos = ax.xaxis.get_label_position() # top or bottom
+ # Search through other axes for label positions that are same as
+ # this one and that share the appropriate row number.
+ # Add to a grouper associated with each axes of siblings.
+ # This list is inspected in `axis.draw` by
+ # `axis._update_label_position`.
+ for axc in axs:
+ if axc.xaxis.get_label_position() == pos:
+ rowspanc = axc.get_subplotspec().rowspan
+ if (pos == 'top' and rowspan.start == rowspanc.start or
+ pos == 'bottom' and rowspan.stop == rowspanc.stop):
+ # grouper for groups of xlabels to align
+ self._align_label_groups['x'].join(ax, axc)
+
+ def align_ylabels(self, axs=None):
+ """
+ Align the ylabels of subplots in the same subplot column if label
+ alignment is being done automatically (i.e. the label position is
+ not manually set).
+
+ Alignment persists for draw events after this is called.
+
+ If a label is on the left, it is aligned with labels on Axes that
+ also have their label on the left and that have the same
+ left-most subplot column. If the label is on the right,
+ it is aligned with labels on Axes with the same right-most column.
+
+ Parameters
+ ----------
+ axs : list of `~matplotlib.axes.Axes`
+ Optional list (or ndarray) of `~matplotlib.axes.Axes`
+ to align the ylabels.
+ Default is to align all Axes on the figure.
+
+ See Also
+ --------
+ matplotlib.figure.Figure.align_xlabels
+ matplotlib.figure.Figure.align_labels
+
+ Notes
+ -----
+ This assumes that ``axs`` are from the same `.GridSpec`, so that
+ their `.SubplotSpec` positions correspond to figure positions.
+
+ Examples
+ --------
+ Example with large yticks labels::
+
+ fig, axs = plt.subplots(2, 1)
+ axs[0].plot(np.arange(0, 1000, 50))
+ axs[0].set_ylabel('YLabel 0')
+ axs[1].set_ylabel('YLabel 1')
+ fig.align_ylabels()
+ """
+ if axs is None:
+ axs = self.axes
+ axs = np.ravel(axs)
+ for ax in axs:
+ _log.debug(' Working on: %s', ax.get_ylabel())
+ colspan = ax.get_subplotspec().colspan
+ pos = ax.yaxis.get_label_position() # left or right
+ # Search through other axes for label positions that are same as
+ # this one and that share the appropriate column number.
+ # Add to a list associated with each axes of siblings.
+ # This list is inspected in `axis.draw` by
+ # `axis._update_label_position`.
+ for axc in axs:
+ if axc.yaxis.get_label_position() == pos:
+ colspanc = axc.get_subplotspec().colspan
+ if (pos == 'left' and colspan.start == colspanc.start or
+ pos == 'right' and colspan.stop == colspanc.stop):
+ # grouper for groups of ylabels to align
+ self._align_label_groups['y'].join(ax, axc)
+
+ def align_labels(self, axs=None):
+ """
+ Align the xlabels and ylabels of subplots with the same subplots
+ row or column (respectively) if label alignment is being
+ done automatically (i.e. the label position is not manually set).
+
+ Alignment persists for draw events after this is called.
+
+ Parameters
+ ----------
+ axs : list of `~matplotlib.axes.Axes`
+ Optional list (or ndarray) of `~matplotlib.axes.Axes`
+ to align the labels.
+ Default is to align all Axes on the figure.
+
+ See Also
+ --------
+ matplotlib.figure.Figure.align_xlabels
+
+ matplotlib.figure.Figure.align_ylabels
+ """
+ self.align_xlabels(axs=axs)
+ self.align_ylabels(axs=axs)
+
+ def add_gridspec(self, nrows=1, ncols=1, **kwargs):
+ """
+ Return a `.GridSpec` that has this figure as a parent. This allows
+ complex layout of Axes in the figure.
+
+ Parameters
+ ----------
+ nrows : int, default: 1
+ Number of rows in grid.
+
+ ncols : int, default: 1
+ Number or columns in grid.
+
+ Returns
+ -------
+ `.GridSpec`
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Keyword arguments are passed to `.GridSpec`.
+
+ See Also
+ --------
+ matplotlib.pyplot.subplots
+
+ Examples
+ --------
+ Adding a subplot that spans two rows::
+
+ fig = plt.figure()
+ gs = fig.add_gridspec(2, 2)
+ ax1 = fig.add_subplot(gs[0, 0])
+ ax2 = fig.add_subplot(gs[1, 0])
+ # spans two rows:
+ ax3 = fig.add_subplot(gs[:, 1])
+
+ """
+
+ _ = kwargs.pop('figure', None) # pop in case user has added this...
+ gs = GridSpec(nrows=nrows, ncols=ncols, figure=self, **kwargs)
+ self._gridspecs.append(gs)
+ return gs
+
+ def subfigures(self, nrows=1, ncols=1, squeeze=True,
+ wspace=None, hspace=None,
+ width_ratios=None, height_ratios=None,
+ **kwargs):
+ """
+ Add a subfigure to this figure or subfigure.
+
+ A subfigure has the same artist methods as a figure, and is logically
+ the same as a figure, but cannot print itself.
+ See :doc:`/gallery/subplots_axes_and_figures/subfigures`.
+
+ Parameters
+ ----------
+ nrows, ncols : int, default: 1
+ Number of rows/columns of the subfigure grid.
+
+ squeeze : bool, default: True
+ If True, extra dimensions are squeezed out from the returned
+ array of subfigures.
+
+ wspace, hspace : float, default: None
+ The amount of width/height reserved for space between subfigures,
+ expressed as a fraction of the average subfigure width/height.
+ If not given, the values will be inferred from a figure or
+ rcParams when necessary.
+
+ width_ratios : array-like of length *ncols*, optional
+ Defines the relative widths of the columns. Each column gets a
+ relative width of ``width_ratios[i] / sum(width_ratios)``.
+ If not given, all columns will have the same width.
+
+ height_ratios : array-like of length *nrows*, optional
+ Defines the relative heights of the rows. Each row gets a
+ relative height of ``height_ratios[i] / sum(height_ratios)``.
+ If not given, all rows will have the same height.
+ """
+ gs = GridSpec(nrows=nrows, ncols=ncols, figure=self,
+ wspace=wspace, hspace=hspace,
+ width_ratios=width_ratios,
+ height_ratios=height_ratios)
+
+ sfarr = np.empty((nrows, ncols), dtype=object)
+ for i in range(ncols):
+ for j in range(nrows):
+ sfarr[j, i] = self.add_subfigure(gs[j, i], **kwargs)
+
+ if squeeze:
+ # Discarding unneeded dimensions that equal 1. If we only have one
+ # subfigure, just return it instead of a 1-element array.
+ return sfarr.item() if sfarr.size == 1 else sfarr.squeeze()
+ else:
+ # Returned axis array will be always 2-d, even if nrows=ncols=1.
+ return sfarr
+
+ return sfarr
+
+ def add_subfigure(self, subplotspec, **kwargs):
+ """
+ Add a `~.figure.SubFigure` to the figure as part of a subplot
+ arrangement.
+
+ Parameters
+ ----------
+ subplotspec : `.gridspec.SubplotSpec`
+ Defines the region in a parent gridspec where the subfigure will
+ be placed.
+
+ Returns
+ -------
+ `.figure.SubFigure`
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Are passed to the `~.figure.SubFigure` object.
+
+ See Also
+ --------
+ .Figure.subfigures
+ """
+ sf = SubFigure(self, subplotspec, **kwargs)
+ self.subfigs += [sf]
+ return sf
+
+ def sca(self, a):
+ """Set the current Axes to be *a* and return *a*."""
+ self._axstack.bubble(a)
+ self._axobservers.process("_axes_change_event", self)
+ return a
+
+ @docstring.dedent_interpd
+ def gca(self, **kwargs):
+ """
+ Get the current Axes, creating one if necessary.
+
+ The following kwargs are supported for ensuring the returned Axes
+ adheres to the given projection etc., and for Axes creation if
+ the active Axes does not exist:
+
+ %(Axes_kwdoc)s
+
+ """
+ if kwargs:
+ _api.warn_deprecated(
+ "3.4",
+ message="Calling gca() with keyword arguments was deprecated "
+ "in Matplotlib %(since)s. Starting %(removal)s, gca() will "
+ "take no keyword arguments. The gca() function should only be "
+ "used to get the current axes, or if no axes exist, create "
+ "new axes with default keyword arguments. To create a new "
+ "axes with non-default arguments, use plt.axes() or "
+ "plt.subplot().")
+ if self._axstack.empty():
+ return self.add_subplot(1, 1, 1, **kwargs)
+ else:
+ return self._axstack()
+
+ def _gci(self):
+ # Helper for `~matplotlib.pyplot.gci`. Do not use elsewhere.
+ """
+ Get the current colorable artist.
+
+ Specifically, returns the current `.ScalarMappable` instance (`.Image`
+ created by `imshow` or `figimage`, `.Collection` created by `pcolor` or
+ `scatter`, etc.), or *None* if no such instance has been defined.
+
+ The current image is an attribute of the current Axes, or the nearest
+ earlier Axes in the current figure that contains an image.
+
+ Notes
+ -----
+ Historically, the only colorable artists were images; hence the name
+ ``gci`` (get current image).
+ """
+ # Look first for an image in the current Axes:
+ if self._axstack.empty():
+ return None
+ im = self._axstack()._gci()
+ if im is not None:
+ return im
+
+ # If there is no image in the current Axes, search for
+ # one in a previously created Axes. Whether this makes
+ # sense is debatable, but it is the documented behavior.
+ for ax in reversed(self.axes):
+ im = ax._gci()
+ if im is not None:
+ return im
+ return None
+
+ def _process_projection_requirements(
+ self, *args, axes_class=None, polar=False, projection=None,
+ **kwargs):
+ """
+ Handle the args/kwargs to add_axes/add_subplot/gca, returning::
+
+ (axes_proj_class, proj_class_kwargs)
+
+ which can be used for new Axes initialization/identification.
+ """
+ if axes_class is not None:
+ if polar or projection is not None:
+ raise ValueError(
+ "Cannot combine 'axes_class' and 'projection' or 'polar'")
+ projection_class = axes_class
+ else:
+
+ if polar:
+ if projection is not None and projection != 'polar':
+ raise ValueError(
+ f"polar={polar}, yet projection={projection!r}. "
+ "Only one of these arguments should be supplied."
+ )
+ projection = 'polar'
+
+ if isinstance(projection, str) or projection is None:
+ projection_class = projections.get_projection_class(projection)
+ elif hasattr(projection, '_as_mpl_axes'):
+ projection_class, extra_kwargs = projection._as_mpl_axes()
+ kwargs.update(**extra_kwargs)
+ else:
+ raise TypeError(
+ f"projection must be a string, None or implement a "
+ f"_as_mpl_axes method, not {projection!r}")
+ if projection_class.__name__ == 'Axes3D':
+ kwargs.setdefault('auto_add_to_figure', False)
+ return projection_class, kwargs
+
+ def get_default_bbox_extra_artists(self):
+ bbox_artists = [artist for artist in self.get_children()
+ if (artist.get_visible() and artist.get_in_layout())]
+ for ax in self.axes:
+ if ax.get_visible():
+ bbox_artists.extend(ax.get_default_bbox_extra_artists())
+ return bbox_artists
+
+ def get_tightbbox(self, renderer, bbox_extra_artists=None):
+ """
+ Return a (tight) bounding box of the figure in inches.
+
+ Artists that have ``artist.set_in_layout(False)`` are not included
+ in the bbox.
+
+ Parameters
+ ----------
+ renderer : `.RendererBase` subclass
+ renderer that will be used to draw the figures (i.e.
+ ``fig.canvas.get_renderer()``)
+
+ bbox_extra_artists : list of `.Artist` or ``None``
+ List of artists to include in the tight bounding box. If
+ ``None`` (default), then all artist children of each Axes are
+ included in the tight bounding box.
+
+ Returns
+ -------
+ `.BboxBase`
+ containing the bounding box (in figure inches).
+ """
+
+ bb = []
+ if bbox_extra_artists is None:
+ artists = self.get_default_bbox_extra_artists()
+ else:
+ artists = bbox_extra_artists
+
+ for a in artists:
+ bbox = a.get_tightbbox(renderer)
+ if bbox is not None and (bbox.width != 0 or bbox.height != 0):
+ bb.append(bbox)
+
+ for ax in self.axes:
+ if ax.get_visible():
+ # some axes don't take the bbox_extra_artists kwarg so we
+ # need this conditional....
+ try:
+ bbox = ax.get_tightbbox(
+ renderer, bbox_extra_artists=bbox_extra_artists)
+ except TypeError:
+ bbox = ax.get_tightbbox(renderer)
+ bb.append(bbox)
+ bb = [b for b in bb
+ if (np.isfinite(b.width) and np.isfinite(b.height)
+ and (b.width != 0 or b.height != 0))]
+
+ if len(bb) == 0:
+ if hasattr(self, 'bbox_inches'):
+ return self.bbox_inches
+ else:
+ # subfigures do not have bbox_inches, but do have a bbox
+ bb = [self.bbox]
+
+ _bbox = Bbox.union(bb)
+
+ bbox_inches = TransformedBbox(_bbox, Affine2D().scale(1 / self.dpi))
+
+ return bbox_inches
+
+ @staticmethod
+ def _normalize_grid_string(layout):
+ if '\n' not in layout:
+ # single-line string
+ return [list(ln) for ln in layout.split(';')]
+ else:
+ # multi-line string
+ layout = inspect.cleandoc(layout)
+ return [list(ln) for ln in layout.strip('\n').split('\n')]
+
+ def subplot_mosaic(self, mosaic, *, subplot_kw=None, gridspec_kw=None,
+ empty_sentinel='.'):
+ """
+ Build a layout of Axes based on ASCII art or nested lists.
+
+ This is a helper function to build complex GridSpec layouts visually.
+
+ .. note ::
+
+ This API is provisional and may be revised in the future based on
+ early user feedback.
+
+
+ Parameters
+ ----------
+ mosaic : list of list of {hashable or nested} or str
+
+ A visual layout of how you want your Axes to be arranged
+ labeled as strings. For example ::
+
+ x = [['A panel', 'A panel', 'edge'],
+ ['C panel', '.', 'edge']]
+
+ Produces 4 Axes:
+
+ - 'A panel' which is 1 row high and spans the first two columns
+ - 'edge' which is 2 rows high and is on the right edge
+ - 'C panel' which in 1 row and 1 column wide in the bottom left
+ - a blank space 1 row and 1 column wide in the bottom center
+
+ Any of the entries in the layout can be a list of lists
+ of the same form to create nested layouts.
+
+ If input is a str, then it can either be a multi-line string of
+ the form ::
+
+ '''
+ AAE
+ C.E
+ '''
+
+ where each character is a column and each line is a row. Or it
+ can be a single-line string where rows are separated by ``;``::
+
+ 'AB;CC'
+
+ The string notation allows only single character Axes labels and
+ does not support nesting but is very terse.
+
+ subplot_kw : dict, optional
+ Dictionary with keywords passed to the `.Figure.add_subplot` call
+ used to create each subplot.
+
+ gridspec_kw : dict, optional
+ Dictionary with keywords passed to the `.GridSpec` constructor used
+ to create the grid the subplots are placed on.
+
+ empty_sentinel : object, optional
+ Entry in the layout to mean "leave this space empty". Defaults
+ to ``'.'``. Note, if *layout* is a string, it is processed via
+ `inspect.cleandoc` to remove leading white space, which may
+ interfere with using white-space as the empty sentinel.
+
+ Returns
+ -------
+ dict[label, Axes]
+ A dictionary mapping the labels to the Axes objects. The order of
+ the axes is left-to-right and top-to-bottom of their position in the
+ total layout.
+
+ """
+ subplot_kw = subplot_kw or {}
+ gridspec_kw = gridspec_kw or {}
+ # special-case string input
+ if isinstance(mosaic, str):
+ mosaic = self._normalize_grid_string(mosaic)
+
+ def _make_array(inp):
+ """
+ Convert input into 2D array
+
+ We need to have this internal function rather than
+ ``np.asarray(..., dtype=object)`` so that a list of lists
+ of lists does not get converted to an array of dimension >
+ 2
+
+ Returns
+ -------
+ 2D object array
+
+ """
+ r0, *rest = inp
+ if isinstance(r0, str):
+ raise ValueError('List mosaic specification must be 2D')
+ for j, r in enumerate(rest, start=1):
+ if isinstance(r, str):
+ raise ValueError('List mosaic specification must be 2D')
+ if len(r0) != len(r):
+ raise ValueError(
+ "All of the rows must be the same length, however "
+ f"the first row ({r0!r}) has length {len(r0)} "
+ f"and row {j} ({r!r}) has length {len(r)}."
+ )
+ out = np.zeros((len(inp), len(r0)), dtype=object)
+ for j, r in enumerate(inp):
+ for k, v in enumerate(r):
+ out[j, k] = v
+ return out
+
+ def _identify_keys_and_nested(mosaic):
+ """
+ Given a 2D object array, identify unique IDs and nested mosaics
+
+ Parameters
+ ----------
+ mosaic : 2D numpy object array
+
+ Returns
+ -------
+ unique_ids : tuple
+ The unique non-sub mosaic entries in this mosaic
+ nested : dict[tuple[int, int]], 2D object array
+ """
+ # make sure we preserve the user supplied order
+ unique_ids = cbook._OrderedSet()
+ nested = {}
+ for j, row in enumerate(mosaic):
+ for k, v in enumerate(row):
+ if v == empty_sentinel:
+ continue
+ elif not cbook.is_scalar_or_string(v):
+ nested[(j, k)] = _make_array(v)
+ else:
+ unique_ids.add(v)
+
+ return tuple(unique_ids), nested
+
+ def _do_layout(gs, mosaic, unique_ids, nested):
+ """
+ Recursively do the mosaic.
+
+ Parameters
+ ----------
+ gs : GridSpec
+ mosaic : 2D object array
+ The input converted to a 2D numpy array for this level.
+ unique_ids : tuple
+ The identified scalar labels at this level of nesting.
+ nested : dict[tuple[int, int]], 2D object array
+ The identified nested mosaics, if any.
+
+ Returns
+ -------
+ dict[label, Axes]
+ A flat dict of all of the Axes created.
+ """
+ rows, cols = mosaic.shape
+ output = dict()
+
+ # we need to merge together the Axes at this level and the axes
+ # in the (recursively) nested sub-mosaics so that we can add
+ # them to the figure in the "natural" order if you were to
+ # ravel in c-order all of the Axes that will be created
+ #
+ # This will stash the upper left index of each object (axes or
+ # nested mosaic) at this level
+ this_level = dict()
+
+ # go through the unique keys,
+ for name in unique_ids:
+ # sort out where each axes starts/ends
+ indx = np.argwhere(mosaic == name)
+ start_row, start_col = np.min(indx, axis=0)
+ end_row, end_col = np.max(indx, axis=0) + 1
+ # and construct the slice object
+ slc = (slice(start_row, end_row), slice(start_col, end_col))
+ # some light error checking
+ if (mosaic[slc] != name).any():
+ raise ValueError(
+ f"While trying to layout\n{mosaic!r}\n"
+ f"we found that the label {name!r} specifies a "
+ "non-rectangular or non-contiguous area.")
+ # and stash this slice for later
+ this_level[(start_row, start_col)] = (name, slc, 'axes')
+
+ # do the same thing for the nested mosaics (simpler because these
+ # can not be spans yet!)
+ for (j, k), nested_mosaic in nested.items():
+ this_level[(j, k)] = (None, nested_mosaic, 'nested')
+
+ # now go through the things in this level and add them
+ # in order left-to-right top-to-bottom
+ for key in sorted(this_level):
+ name, arg, method = this_level[key]
+ # we are doing some hokey function dispatch here based
+ # on the 'method' string stashed above to sort out if this
+ # element is an axes or a nested mosaic.
+ if method == 'axes':
+ slc = arg
+ # add a single axes
+ if name in output:
+ raise ValueError(f"There are duplicate keys {name} "
+ f"in the layout\n{mosaic!r}")
+ ax = self.add_subplot(
+ gs[slc], **{'label': str(name), **subplot_kw}
+ )
+ output[name] = ax
+ elif method == 'nested':
+ nested_mosaic = arg
+ j, k = key
+ # recursively add the nested mosaic
+ rows, cols = nested_mosaic.shape
+ nested_output = _do_layout(
+ gs[j, k].subgridspec(rows, cols, **gridspec_kw),
+ nested_mosaic,
+ *_identify_keys_and_nested(nested_mosaic)
+ )
+ overlap = set(output) & set(nested_output)
+ if overlap:
+ raise ValueError(
+ f"There are duplicate keys {overlap} "
+ f"between the outer layout\n{mosaic!r}\n"
+ f"and the nested layout\n{nested_mosaic}"
+ )
+ output.update(nested_output)
+ else:
+ raise RuntimeError("This should never happen")
+ return output
+
+ mosaic = _make_array(mosaic)
+ rows, cols = mosaic.shape
+ gs = self.add_gridspec(rows, cols, **gridspec_kw)
+ ret = _do_layout(gs, mosaic, *_identify_keys_and_nested(mosaic))
+ for k, ax in ret.items():
+ if isinstance(k, str):
+ ax.set_label(k)
+ return ret
+
+ def _set_artist_props(self, a):
+ if a != self:
+ a.set_figure(self)
+ a.stale_callback = _stale_figure_callback
+ a.set_transform(self.transSubfigure)
+
+
+class SubFigure(FigureBase):
+ """
+ Logical figure that can be placed inside a figure.
+
+ Typically instantiated using `.Figure.add_subfigure` or
+ `.SubFigure.add_subfigure`, or `.SubFigure.subfigures`. A subfigure has
+ the same methods as a figure except for those particularly tied to the size
+ or dpi of the figure, and is confined to a prescribed region of the figure.
+ For example the following puts two subfigures side-by-side::
+
+ fig = plt.figure()
+ sfigs = fig.subfigures(1, 2)
+ axsL = sfigs[0].subplots(1, 2)
+ axsR = sfigs[1].subplots(2, 1)
+
+ See :doc:`/gallery/subplots_axes_and_figures/subfigures`
+ """
+
+ def __init__(self, parent, subplotspec, *,
+ facecolor=None,
+ edgecolor=None,
+ linewidth=0.0,
+ frameon=None):
+ """
+ Parameters
+ ----------
+ parent : `.figure.Figure` or `.figure.SubFigure`
+ Figure or subfigure that contains the SubFigure. SubFigures
+ can be nested.
+
+ subplotspec : `.gridspec.SubplotSpec`
+ Defines the region in a parent gridspec where the subfigure will
+ be placed.
+
+ facecolor : default: :rc:`figure.facecolor`
+ The figure patch face color.
+
+ edgecolor : default: :rc:`figure.edgecolor`
+ The figure patch edge color.
+
+ linewidth : float
+ The linewidth of the frame (i.e. the edge linewidth of the figure
+ patch).
+
+ frameon : bool, default: :rc:`figure.frameon`
+ If ``False``, suppress drawing the figure background patch.
+ """
+ super().__init__()
+ if facecolor is None:
+ facecolor = mpl.rcParams['figure.facecolor']
+ if edgecolor is None:
+ edgecolor = mpl.rcParams['figure.edgecolor']
+ if frameon is None:
+ frameon = mpl.rcParams['figure.frameon']
+
+ self._subplotspec = subplotspec
+ self._parent = parent
+ self.figure = parent.figure
+ # subfigures use the parent axstack
+ self._axstack = parent._axstack
+ self.subplotpars = parent.subplotpars
+ self.dpi_scale_trans = parent.dpi_scale_trans
+ self._axobservers = parent._axobservers
+ self.dpi = parent.dpi
+ self.canvas = parent.canvas
+ self.transFigure = parent.transFigure
+ self.bbox_relative = None
+ self._redo_transform_rel_fig()
+ self.figbbox = self._parent.figbbox
+ self.bbox = TransformedBbox(self.bbox_relative,
+ self._parent.transSubfigure)
+ self.transSubfigure = BboxTransformTo(self.bbox)
+
+ self.patch = Rectangle(
+ xy=(0, 0), width=1, height=1, visible=frameon,
+ facecolor=facecolor, edgecolor=edgecolor, linewidth=linewidth,
+ # Don't let the figure patch influence bbox calculation.
+ in_layout=False, transform=self.transSubfigure)
+ self._set_artist_props(self.patch)
+ self.patch.set_antialiased(False)
+
+ if parent._layoutgrid is not None:
+ self.init_layoutgrid()
+
+ def _redo_transform_rel_fig(self, bbox=None):
+ """
+ Make the transSubfigure bbox relative to Figure transform.
+
+ Parameters
+ ----------
+ bbox : bbox or None
+ If not None, then the bbox is used for relative bounding box.
+ Otherwise it is calculated from the subplotspec.
+ """
+
+ if bbox is not None:
+ self.bbox_relative.p0 = bbox.p0
+ self.bbox_relative.p1 = bbox.p1
+ return
+
+ gs = self._subplotspec.get_gridspec()
+ # need to figure out *where* this subplotspec is.
+ wr = gs.get_width_ratios()
+ hr = gs.get_height_ratios()
+ nrows, ncols = gs.get_geometry()
+ if wr is None:
+ wr = np.ones(ncols)
+ else:
+ wr = np.array(wr)
+ if hr is None:
+ hr = np.ones(nrows)
+ else:
+ hr = np.array(hr)
+ widthf = np.sum(wr[self._subplotspec.colspan]) / np.sum(wr)
+ heightf = np.sum(hr[self._subplotspec.rowspan]) / np.sum(hr)
+
+ x0 = 0
+ if not self._subplotspec.is_first_col():
+ x0 += np.sum(wr[:self._subplotspec.colspan.start]) / np.sum(wr)
+
+ y0 = 0
+ if not self._subplotspec.is_last_row():
+ y0 += 1 - (np.sum(hr[:self._subplotspec.rowspan.stop]) /
+ np.sum(hr))
+
+ if self.bbox_relative is None:
+ self.bbox_relative = Bbox.from_bounds(x0, y0, widthf, heightf)
+ else:
+ self.bbox_relative.p0 = (x0, y0)
+ self.bbox_relative.p1 = (x0 + widthf, y0 + heightf)
+
+ def get_constrained_layout(self):
+ """
+ Return whether constrained layout is being used.
+
+ See :doc:`/tutorials/intermediate/constrainedlayout_guide`.
+ """
+ return self._parent.get_constrained_layout()
+
+ def get_constrained_layout_pads(self, relative=False):
+ """
+ Get padding for ``constrained_layout``.
+
+ Returns a list of ``w_pad, h_pad`` in inches and
+ ``wspace`` and ``hspace`` as fractions of the subplot.
+
+ See :doc:`/tutorials/intermediate/constrainedlayout_guide`.
+
+ Parameters
+ ----------
+ relative : bool
+ If `True`, then convert from inches to figure relative.
+ """
+ return self._parent.get_constrained_layout_pads(relative=relative)
+
+ def init_layoutgrid(self):
+ """Initialize the layoutgrid for use in constrained_layout."""
+ if self._layoutgrid is None:
+ gs = self._subplotspec.get_gridspec()
+ parent = gs._layoutgrid
+ if parent is not None:
+ self._layoutgrid = layoutgrid.LayoutGrid(
+ parent=parent,
+ name=(parent.name + '.' + 'panellb' +
+ layoutgrid.seq_id()),
+ parent_inner=True,
+ nrows=1, ncols=1,
+ parent_pos=(self._subplotspec.rowspan,
+ self._subplotspec.colspan))
+
+ def get_axes(self):
+ """
+ Return a list of Axes in the SubFigure. You can access and modify the
+ Axes in the Figure through this list.
+
+ Do not modify the list itself. Instead, use `~.SubFigure.add_axes`,
+ `~.SubFigure.add_subplot` or `~.SubFigure.delaxes` to add or remove an
+ Axes.
+
+ Note: This is equivalent to the property `~.SubFigure.axes`.
+ """
+ return self._localaxes.as_list()
+
+ axes = property(get_axes, doc="""
+ List of Axes in the SubFigure. You can access and modify the Axes
+ in the SubFigure through this list.
+
+ Do not modify the list itself. Instead, use `~.SubFigure.add_axes`,
+ `~.SubFigure.add_subplot` or `~.SubFigure.delaxes` to add or remove an
+ Axes.
+ """)
+
+ def draw(self, renderer):
+ # docstring inherited
+ self._cachedRenderer = renderer
+
+ # draw the figure bounding box, perhaps none for white figure
+ if not self.get_visible():
+ return
+
+ artists = self._get_draw_artists(renderer)
+
+ try:
+ renderer.open_group('subfigure', gid=self.get_gid())
+ self.patch.draw(renderer)
+ mimage._draw_list_compositing_images(renderer, self, artists)
+ for sfig in self.subfigs:
+ sfig.draw(renderer)
+ renderer.close_group('subfigure')
+
+ finally:
+ self.stale = False
+
+
+class Figure(FigureBase):
+ """
+ The top level container for all the plot elements.
+
+ The Figure instance supports callbacks through a *callbacks* attribute
+ which is a `.CallbackRegistry` instance. The events you can connect to
+ are 'dpi_changed', and the callback will be called with ``func(fig)`` where
+ fig is the `Figure` instance.
+
+ Attributes
+ ----------
+ patch
+ The `.Rectangle` instance representing the figure background patch.
+
+ suppressComposite
+ For multiple figure images, the figure will make composite images
+ depending on the renderer option_image_nocomposite function. If
+ *suppressComposite* is a boolean, this will override the renderer.
+ """
+
+ def __str__(self):
+ return "Figure(%gx%g)" % tuple(self.bbox.size)
+
+ def __repr__(self):
+ return "<{clsname} size {h:g}x{w:g} with {naxes} Axes>".format(
+ clsname=self.__class__.__name__,
+ h=self.bbox.size[0], w=self.bbox.size[1],
+ naxes=len(self.axes),
+ )
+
+ def __init__(self,
+ figsize=None,
+ dpi=None,
+ facecolor=None,
+ edgecolor=None,
+ linewidth=0.0,
+ frameon=None,
+ subplotpars=None, # rc figure.subplot.*
+ tight_layout=None, # rc figure.autolayout
+ constrained_layout=None, # rc figure.constrained_layout.use
+ ):
+ """
+ Parameters
+ ----------
+ figsize : 2-tuple of floats, default: :rc:`figure.figsize`
+ Figure dimension ``(width, height)`` in inches.
+
+ dpi : float, default: :rc:`figure.dpi`
+ Dots per inch.
+
+ facecolor : default: :rc:`figure.facecolor`
+ The figure patch facecolor.
+
+ edgecolor : default: :rc:`figure.edgecolor`
+ The figure patch edge color.
+
+ linewidth : float
+ The linewidth of the frame (i.e. the edge linewidth of the figure
+ patch).
+
+ frameon : bool, default: :rc:`figure.frameon`
+ If ``False``, suppress drawing the figure background patch.
+
+ subplotpars : `SubplotParams`
+ Subplot parameters. If not given, the default subplot
+ parameters :rc:`figure.subplot.*` are used.
+
+ tight_layout : bool or dict, default: :rc:`figure.autolayout`
+ If ``False`` use *subplotpars*. If ``True`` adjust subplot
+ parameters using `.tight_layout` with default padding.
+ When providing a dict containing the keys ``pad``, ``w_pad``,
+ ``h_pad``, and ``rect``, the default `.tight_layout` paddings
+ will be overridden.
+
+ constrained_layout : bool, default: :rc:`figure.constrained_layout.use`
+ If ``True`` use constrained layout to adjust positioning of plot
+ elements. Like ``tight_layout``, but designed to be more
+ flexible. See
+ :doc:`/tutorials/intermediate/constrainedlayout_guide`
+ for examples. (Note: does not work with `add_subplot` or
+ `~.pyplot.subplot2grid`.)
+ """
+ super().__init__()
+
+ self.callbacks = cbook.CallbackRegistry()
+ # Callbacks traditionally associated with the canvas (and exposed with
+ # a proxy property), but that actually need to be on the figure for
+ # pickling.
+ self._canvas_callbacks = cbook.CallbackRegistry()
+ self._button_pick_id = self._canvas_callbacks.connect(
+ 'button_press_event', lambda event: self.canvas.pick(event))
+ self._scroll_pick_id = self._canvas_callbacks.connect(
+ 'scroll_event', lambda event: self.canvas.pick(event))
+
+ if figsize is None:
+ figsize = mpl.rcParams['figure.figsize']
+ if dpi is None:
+ dpi = mpl.rcParams['figure.dpi']
+ if facecolor is None:
+ facecolor = mpl.rcParams['figure.facecolor']
+ if edgecolor is None:
+ edgecolor = mpl.rcParams['figure.edgecolor']
+ if frameon is None:
+ frameon = mpl.rcParams['figure.frameon']
+
+ if not np.isfinite(figsize).all() or (np.array(figsize) < 0).any():
+ raise ValueError('figure size must be positive finite not '
+ f'{figsize}')
+ self.bbox_inches = Bbox.from_bounds(0, 0, *figsize)
+
+ self.dpi_scale_trans = Affine2D().scale(dpi)
+ # do not use property as it will trigger
+ self._dpi = dpi
+ self.bbox = TransformedBbox(self.bbox_inches, self.dpi_scale_trans)
+ self.figbbox = self.bbox
+ self.transFigure = BboxTransformTo(self.bbox)
+ self.transSubfigure = self.transFigure
+
+ self.patch = Rectangle(
+ xy=(0, 0), width=1, height=1, visible=frameon,
+ facecolor=facecolor, edgecolor=edgecolor, linewidth=linewidth,
+ # Don't let the figure patch influence bbox calculation.
+ in_layout=False)
+ self._set_artist_props(self.patch)
+ self.patch.set_antialiased(False)
+
+ FigureCanvasBase(self) # Set self.canvas.
+
+ if subplotpars is None:
+ subplotpars = SubplotParams()
+
+ self.subplotpars = subplotpars
+
+ # constrained_layout:
+ self._layoutgrid = None
+ self._constrained = False
+
+ self.set_tight_layout(tight_layout)
+
+ self._axstack = _AxesStack() # track all figure axes and current axes
+ self.clf()
+ self._cachedRenderer = None
+
+ self.set_constrained_layout(constrained_layout)
+
+ # list of child gridspecs for this figure
+ self._gridspecs = []
+
+ # TODO: I'd like to dynamically add the _repr_html_ method
+ # to the figure in the right context, but then IPython doesn't
+ # use it, for some reason.
+
+ def _repr_html_(self):
+ # We can't use "isinstance" here, because then we'd end up importing
+ # webagg unconditionally.
+ if 'WebAgg' in type(self.canvas).__name__:
+ from matplotlib.backends import backend_webagg
+ return backend_webagg.ipython_inline_display(self)
+
+ def show(self, warn=True):
+ """
+ If using a GUI backend with pyplot, display the figure window.
+
+ If the figure was not created using `~.pyplot.figure`, it will lack
+ a `~.backend_bases.FigureManagerBase`, and this method will raise an
+ AttributeError.
+
+ .. warning::
+
+ This does not manage an GUI event loop. Consequently, the figure
+ may only be shown briefly or not shown at all if you or your
+ environment are not managing an event loop.
+
+ Proper use cases for `.Figure.show` include running this from a
+ GUI application or an IPython shell.
+
+ If you're running a pure python shell or executing a non-GUI
+ python script, you should use `matplotlib.pyplot.show` instead,
+ which takes care of managing the event loop for you.
+
+ Parameters
+ ----------
+ warn : bool, default: True
+ If ``True`` and we are not running headless (i.e. on Linux with an
+ unset DISPLAY), issue warning when called on a non-GUI backend.
+ """
+ if self.canvas.manager is None:
+ raise AttributeError(
+ "Figure.show works only for figures managed by pyplot, "
+ "normally created by pyplot.figure()")
+ try:
+ self.canvas.manager.show()
+ except NonGuiException as exc:
+ if warn:
+ _api.warn_external(str(exc))
+
+ def get_axes(self):
+ """
+ Return a list of Axes in the Figure. You can access and modify the
+ Axes in the Figure through this list.
+
+ Do not modify the list itself. Instead, use `~Figure.add_axes`,
+ `~.Figure.add_subplot` or `~.Figure.delaxes` to add or remove an Axes.
+
+ Note: This is equivalent to the property `~.Figure.axes`.
+ """
+ return self._axstack.as_list()
+
+ axes = property(get_axes, doc="""
+ List of Axes in the Figure. You can access and modify the Axes in the
+ Figure through this list.
+
+ Do not modify the list itself. Instead, use "`~Figure.add_axes`,
+ `~.Figure.add_subplot` or `~.Figure.delaxes` to add or remove an Axes.
+ """)
+
+ def _get_dpi(self):
+ return self._dpi
+
+ def _set_dpi(self, dpi, forward=True):
+ """
+ Parameters
+ ----------
+ dpi : float
+
+ forward : bool
+ Passed on to `~.Figure.set_size_inches`
+ """
+ if dpi == self._dpi:
+ # We don't want to cause undue events in backends.
+ return
+ self._dpi = dpi
+ self.dpi_scale_trans.clear().scale(dpi)
+ w, h = self.get_size_inches()
+ self.set_size_inches(w, h, forward=forward)
+ self.callbacks.process('dpi_changed', self)
+
+ dpi = property(_get_dpi, _set_dpi, doc="The resolution in dots per inch.")
+
+ def get_tight_layout(self):
+ """Return whether `.tight_layout` is called when drawing."""
+ return self._tight
+
+ def set_tight_layout(self, tight):
+ """
+ Set whether and how `.tight_layout` is called when drawing.
+
+ Parameters
+ ----------
+ tight : bool or dict with keys "pad", "w_pad", "h_pad", "rect" or None
+ If a bool, sets whether to call `.tight_layout` upon drawing.
+ If ``None``, use the ``figure.autolayout`` rcparam instead.
+ If a dict, pass it as kwargs to `.tight_layout`, overriding the
+ default paddings.
+ """
+ if tight is None:
+ tight = mpl.rcParams['figure.autolayout']
+ self._tight = bool(tight)
+ self._tight_parameters = tight if isinstance(tight, dict) else {}
+ self.stale = True
+
+ def get_constrained_layout(self):
+ """
+ Return whether constrained layout is being used.
+
+ See :doc:`/tutorials/intermediate/constrainedlayout_guide`.
+ """
+ return self._constrained
+
+ def set_constrained_layout(self, constrained):
+ """
+ Set whether ``constrained_layout`` is used upon drawing. If None,
+ :rc:`figure.constrained_layout.use` value will be used.
+
+ When providing a dict containing the keys `w_pad`, `h_pad`
+ the default ``constrained_layout`` paddings will be
+ overridden. These pads are in inches and default to 3.0/72.0.
+ ``w_pad`` is the width padding and ``h_pad`` is the height padding.
+
+ See :doc:`/tutorials/intermediate/constrainedlayout_guide`.
+
+ Parameters
+ ----------
+ constrained : bool or dict or None
+ """
+ self._constrained_layout_pads = dict()
+ self._constrained_layout_pads['w_pad'] = None
+ self._constrained_layout_pads['h_pad'] = None
+ self._constrained_layout_pads['wspace'] = None
+ self._constrained_layout_pads['hspace'] = None
+ if constrained is None:
+ constrained = mpl.rcParams['figure.constrained_layout.use']
+ self._constrained = bool(constrained)
+ if isinstance(constrained, dict):
+ self.set_constrained_layout_pads(**constrained)
+ else:
+ self.set_constrained_layout_pads()
+
+ self.init_layoutgrid()
+
+ self.stale = True
+
+ def set_constrained_layout_pads(self, **kwargs):
+ """
+ Set padding for ``constrained_layout``. Note the kwargs can be passed
+ as a dictionary ``fig.set_constrained_layout(**paddict)``.
+
+ See :doc:`/tutorials/intermediate/constrainedlayout_guide`.
+
+ Parameters
+ ----------
+ w_pad : float
+ Width padding in inches. This is the pad around Axes
+ and is meant to make sure there is enough room for fonts to
+ look good. Defaults to 3 pts = 0.04167 inches
+
+ h_pad : float
+ Height padding in inches. Defaults to 3 pts.
+
+ wspace : float
+ Width padding between subplots, expressed as a fraction of the
+ subplot width. The total padding ends up being w_pad + wspace.
+
+ hspace : float
+ Height padding between subplots, expressed as a fraction of the
+ subplot width. The total padding ends up being h_pad + hspace.
+
+ """
+
+ todo = ['w_pad', 'h_pad', 'wspace', 'hspace']
+ for td in todo:
+ if td in kwargs and kwargs[td] is not None:
+ self._constrained_layout_pads[td] = kwargs[td]
+ else:
+ self._constrained_layout_pads[td] = (
+ mpl.rcParams['figure.constrained_layout.' + td])
+
+ def get_constrained_layout_pads(self, relative=False):
+ """
+ Get padding for ``constrained_layout``.
+
+ Returns a list of ``w_pad, h_pad`` in inches and
+ ``wspace`` and ``hspace`` as fractions of the subplot.
+
+ See :doc:`/tutorials/intermediate/constrainedlayout_guide`.
+
+ Parameters
+ ----------
+ relative : bool
+ If `True`, then convert from inches to figure relative.
+ """
+ w_pad = self._constrained_layout_pads['w_pad']
+ h_pad = self._constrained_layout_pads['h_pad']
+ wspace = self._constrained_layout_pads['wspace']
+ hspace = self._constrained_layout_pads['hspace']
+
+ if relative and (w_pad is not None or h_pad is not None):
+ renderer0 = layoutgrid.get_renderer(self)
+ dpi = renderer0.dpi
+ w_pad = w_pad * dpi / renderer0.width
+ h_pad = h_pad * dpi / renderer0.height
+
+ return w_pad, h_pad, wspace, hspace
+
+ def set_canvas(self, canvas):
+ """
+ Set the canvas that contains the figure
+
+ Parameters
+ ----------
+ canvas : FigureCanvas
+ """
+ self.canvas = canvas
+
+ def figimage(self, X, xo=0, yo=0, alpha=None, norm=None, cmap=None,
+ vmin=None, vmax=None, origin=None, resize=False, **kwargs):
+ """
+ Add a non-resampled image to the figure.
+
+ The image is attached to the lower or upper left corner depending on
+ *origin*.
+
+ Parameters
+ ----------
+ X
+ The image data. This is an array of one of the following shapes:
+
+ - MxN: luminance (grayscale) values
+ - MxNx3: RGB values
+ - MxNx4: RGBA values
+
+ xo, yo : int
+ The *x*/*y* image offset in pixels.
+
+ alpha : None or float
+ The alpha blending value.
+
+ norm : `matplotlib.colors.Normalize`
+ A `.Normalize` instance to map the luminance to the
+ interval [0, 1].
+
+ cmap : str or `matplotlib.colors.Colormap`, default: :rc:`image.cmap`
+ The colormap to use.
+
+ vmin, vmax : float
+ If *norm* is not given, these values set the data limits for the
+ colormap.
+
+ origin : {'upper', 'lower'}, default: :rc:`image.origin`
+ Indicates where the [0, 0] index of the array is in the upper left
+ or lower left corner of the axes.
+
+ resize : bool
+ If *True*, resize the figure to match the given image size.
+
+ Returns
+ -------
+ `matplotlib.image.FigureImage`
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Additional kwargs are `.Artist` kwargs passed on to `.FigureImage`.
+
+ Notes
+ -----
+ figimage complements the Axes image (`~matplotlib.axes.Axes.imshow`)
+ which will be resampled to fit the current Axes. If you want
+ a resampled image to fill the entire figure, you can define an
+ `~matplotlib.axes.Axes` with extent [0, 0, 1, 1].
+
+ Examples
+ --------
+ ::
+
+ f = plt.figure()
+ nx = int(f.get_figwidth() * f.dpi)
+ ny = int(f.get_figheight() * f.dpi)
+ data = np.random.random((ny, nx))
+ f.figimage(data)
+ plt.show()
+ """
+ if resize:
+ dpi = self.get_dpi()
+ figsize = [x / dpi for x in (X.shape[1], X.shape[0])]
+ self.set_size_inches(figsize, forward=True)
+
+ im = mimage.FigureImage(self, cmap, norm, xo, yo, origin, **kwargs)
+ im.stale_callback = _stale_figure_callback
+
+ im.set_array(X)
+ im.set_alpha(alpha)
+ if norm is None:
+ im.set_clim(vmin, vmax)
+ self.images.append(im)
+ im._remove_method = self.images.remove
+ self.stale = True
+ return im
+
+ def set_size_inches(self, w, h=None, forward=True):
+ """
+ Set the figure size in inches.
+
+ Call signatures::
+
+ fig.set_size_inches(w, h) # OR
+ fig.set_size_inches((w, h))
+
+ Parameters
+ ----------
+ w : (float, float) or float
+ Width and height in inches (if height not specified as a separate
+ argument) or width.
+ h : float
+ Height in inches.
+ forward : bool, default: True
+ If ``True``, the canvas size is automatically updated, e.g.,
+ you can resize the figure window from the shell.
+
+ See Also
+ --------
+ matplotlib.figure.Figure.get_size_inches
+ matplotlib.figure.Figure.set_figwidth
+ matplotlib.figure.Figure.set_figheight
+
+ Notes
+ -----
+ To transform from pixels to inches divide by `Figure.dpi`.
+ """
+ if h is None: # Got called with a single pair as argument.
+ w, h = w
+ size = np.array([w, h])
+ if not np.isfinite(size).all() or (size < 0).any():
+ raise ValueError(f'figure size must be positive finite not {size}')
+ self.bbox_inches.p1 = size
+ if forward:
+ canvas = getattr(self, 'canvas')
+ if canvas is not None:
+ dpi_ratio = getattr(canvas, '_dpi_ratio', 1)
+ manager = getattr(canvas, 'manager', None)
+ if manager is not None:
+ manager.resize(*(size * self.dpi / dpi_ratio).astype(int))
+ self.stale = True
+
+ def get_size_inches(self):
+ """
+ Return the current size of the figure in inches.
+
+ Returns
+ -------
+ ndarray
+ The size (width, height) of the figure in inches.
+
+ See Also
+ --------
+ matplotlib.figure.Figure.set_size_inches
+ matplotlib.figure.Figure.get_figwidth
+ matplotlib.figure.Figure.get_figheight
+
+ Notes
+ -----
+ The size in pixels can be obtained by multiplying with `Figure.dpi`.
+ """
+ return np.array(self.bbox_inches.p1)
+
+ def get_figwidth(self):
+ """Return the figure width in inches."""
+ return self.bbox_inches.width
+
+ def get_figheight(self):
+ """Return the figure height in inches."""
+ return self.bbox_inches.height
+
+ def get_dpi(self):
+ """Return the resolution in dots per inch as a float."""
+ return self.dpi
+
+ def set_dpi(self, val):
+ """
+ Set the resolution of the figure in dots-per-inch.
+
+ Parameters
+ ----------
+ val : float
+ """
+ self.dpi = val
+ self.stale = True
+
+ def set_figwidth(self, val, forward=True):
+ """
+ Set the width of the figure in inches.
+
+ Parameters
+ ----------
+ val : float
+ forward : bool
+ See `set_size_inches`.
+
+ See Also
+ --------
+ matplotlib.figure.Figure.set_figheight
+ matplotlib.figure.Figure.set_size_inches
+ """
+ self.set_size_inches(val, self.get_figheight(), forward=forward)
+
+ def set_figheight(self, val, forward=True):
+ """
+ Set the height of the figure in inches.
+
+ Parameters
+ ----------
+ val : float
+ forward : bool
+ See `set_size_inches`.
+
+ See Also
+ --------
+ matplotlib.figure.Figure.set_figwidth
+ matplotlib.figure.Figure.set_size_inches
+ """
+ self.set_size_inches(self.get_figwidth(), val, forward=forward)
+
+ def clf(self, keep_observers=False):
+ """
+ Clear the figure.
+
+ Set *keep_observers* to True if, for example,
+ a gui widget is tracking the Axes in the figure.
+ """
+ self.suppressComposite = None
+ self.callbacks = cbook.CallbackRegistry()
+
+ for ax in tuple(self.axes): # Iterate over the copy.
+ ax.cla()
+ self.delaxes(ax) # removes ax from self._axstack
+
+ toolbar = getattr(self.canvas, 'toolbar', None)
+ if toolbar is not None:
+ toolbar.update()
+ self._axstack.clear()
+ self.artists = []
+ self.lines = []
+ self.patches = []
+ self.texts = []
+ self.images = []
+ self.legends = []
+ if not keep_observers:
+ self._axobservers = cbook.CallbackRegistry()
+ self._suptitle = None
+ self._supxlabel = None
+ self._supylabel = None
+
+ if self.get_constrained_layout():
+ self.init_layoutgrid()
+ self.stale = True
+
+ def clear(self, keep_observers=False):
+ """Clear the figure -- synonym for `clf`."""
+ self.clf(keep_observers=keep_observers)
+
+ @_finalize_rasterization
+ @allow_rasterization
+ def draw(self, renderer):
+ # docstring inherited
+ self._cachedRenderer = renderer
+
+ # draw the figure bounding box, perhaps none for white figure
+ if not self.get_visible():
+ return
+
+ artists = self._get_draw_artists(renderer)
+
+ try:
+ renderer.open_group('figure', gid=self.get_gid())
+ if self.get_constrained_layout() and self.axes:
+ self.execute_constrained_layout(renderer)
+ if self.get_tight_layout() and self.axes:
+ try:
+ self.tight_layout(**self._tight_parameters)
+ except ValueError:
+ pass
+ # ValueError can occur when resizing a window.
+
+ self.patch.draw(renderer)
+ mimage._draw_list_compositing_images(
+ renderer, self, artists, self.suppressComposite)
+
+ for sfig in self.subfigs:
+ sfig.draw(renderer)
+
+ renderer.close_group('figure')
+ finally:
+ self.stale = False
+
+ self.canvas.draw_event(renderer)
+
+ def draw_artist(self, a):
+ """
+ Draw `.Artist` *a* only.
+
+ This method can only be used after an initial draw of the figure,
+ because that creates and caches the renderer needed here.
+ """
+ if self._cachedRenderer is None:
+ raise AttributeError("draw_artist can only be used after an "
+ "initial draw which caches the renderer")
+ a.draw(self._cachedRenderer)
+
+ def __getstate__(self):
+ state = super().__getstate__()
+
+ # The canvas cannot currently be pickled, but this has the benefit
+ # of meaning that a figure can be detached from one canvas, and
+ # re-attached to another.
+ state.pop("canvas")
+
+ # Set cached renderer to None -- it can't be pickled.
+ state["_cachedRenderer"] = None
+
+ # add version information to the state
+ state['__mpl_version__'] = _mpl_version
+
+ # check whether the figure manager (if any) is registered with pyplot
+ from matplotlib import _pylab_helpers
+ if getattr(self.canvas, 'manager', None) \
+ in _pylab_helpers.Gcf.figs.values():
+ state['_restore_to_pylab'] = True
+
+ # set all the layoutgrid information to None. kiwisolver objects can't
+ # be pickled, so we lose the layout options at this point.
+ state.pop('_layoutgrid', None)
+
+ return state
+
+ def __setstate__(self, state):
+ version = state.pop('__mpl_version__')
+ restore_to_pylab = state.pop('_restore_to_pylab', False)
+
+ if version != _mpl_version:
+ _api.warn_external(
+ f"This figure was saved with matplotlib version {version} and "
+ f"is unlikely to function correctly.")
+
+ self.__dict__ = state
+
+ # re-initialise some of the unstored state information
+ FigureCanvasBase(self) # Set self.canvas.
+ self._layoutgrid = None
+
+ if restore_to_pylab:
+ # lazy import to avoid circularity
+ import matplotlib.pyplot as plt
+ import matplotlib._pylab_helpers as pylab_helpers
+ allnums = plt.get_fignums()
+ num = max(allnums) + 1 if allnums else 1
+ mgr = plt._backend_mod.new_figure_manager_given_figure(num, self)
+ pylab_helpers.Gcf._set_new_active_manager(mgr)
+ plt.draw_if_interactive()
+
+ self.stale = True
+
+ def add_axobserver(self, func):
+ """Whenever the Axes state change, ``func(self)`` will be called."""
+ # Connect a wrapper lambda and not func itself, to avoid it being
+ # weakref-collected.
+ self._axobservers.connect("_axes_change_event", lambda arg: func(arg))
+
+ def savefig(self, fname, *, transparent=None, **kwargs):
+ """
+ Save the current figure.
+
+ Call signature::
+
+ savefig(fname, dpi=None, facecolor='w', edgecolor='w',
+ orientation='portrait', papertype=None, format=None,
+ transparent=False, bbox_inches=None, pad_inches=0.1,
+ frameon=None, metadata=None)
+
+ The available output formats depend on the backend being used.
+
+ Parameters
+ ----------
+ fname : str or path-like or binary file-like
+ A path, or a Python file-like object, or
+ possibly some backend-dependent object such as
+ `matplotlib.backends.backend_pdf.PdfPages`.
+
+ If *format* is set, it determines the output format, and the file
+ is saved as *fname*. Note that *fname* is used verbatim, and there
+ is no attempt to make the extension, if any, of *fname* match
+ *format*, and no extension is appended.
+
+ If *format* is not set, then the format is inferred from the
+ extension of *fname*, if there is one. If *format* is not
+ set and *fname* has no extension, then the file is saved with
+ :rc:`savefig.format` and the appropriate extension is appended to
+ *fname*.
+
+ Other Parameters
+ ----------------
+ dpi : float or 'figure', default: :rc:`savefig.dpi`
+ The resolution in dots per inch. If 'figure', use the figure's
+ dpi value.
+
+ quality : int, default: :rc:`savefig.jpeg_quality`
+ Applicable only if *format* is 'jpg' or 'jpeg', ignored otherwise.
+
+ The image quality, on a scale from 1 (worst) to 95 (best).
+ Values above 95 should be avoided; 100 disables portions of
+ the JPEG compression algorithm, and results in large files
+ with hardly any gain in image quality.
+
+ This parameter is deprecated.
+
+ optimize : bool, default: False
+ Applicable only if *format* is 'jpg' or 'jpeg', ignored otherwise.
+
+ Whether the encoder should make an extra pass over the image
+ in order to select optimal encoder settings.
+
+ This parameter is deprecated.
+
+ progressive : bool, default: False
+ Applicable only if *format* is 'jpg' or 'jpeg', ignored otherwise.
+
+ Whether the image should be stored as a progressive JPEG file.
+
+ This parameter is deprecated.
+
+ facecolor : color or 'auto', default: :rc:`savefig.facecolor`
+ The facecolor of the figure. If 'auto', use the current figure
+ facecolor.
+
+ edgecolor : color or 'auto', default: :rc:`savefig.edgecolor`
+ The edgecolor of the figure. If 'auto', use the current figure
+ edgecolor.
+
+ orientation : {'landscape', 'portrait'}
+ Currently only supported by the postscript backend.
+
+ papertype : str
+ One of 'letter', 'legal', 'executive', 'ledger', 'a0' through
+ 'a10', 'b0' through 'b10'. Only supported for postscript
+ output.
+
+ format : str
+ The file format, e.g. 'png', 'pdf', 'svg', ... The behavior when
+ this is unset is documented under *fname*.
+
+ transparent : bool
+ If *True*, the Axes patches will all be transparent; the
+ figure patch will also be transparent unless facecolor
+ and/or edgecolor are specified via kwargs.
+ This is useful, for example, for displaying
+ a plot on top of a colored background on a web page. The
+ transparency of these patches will be restored to their
+ original values upon exit of this function.
+
+ bbox_inches : str or `.Bbox`, default: :rc:`savefig.bbox`
+ Bounding box in inches: only the given portion of the figure is
+ saved. If 'tight', try to figure out the tight bbox of the figure.
+
+ pad_inches : float, default: :rc:`savefig.pad_inches`
+ Amount of padding around the figure when bbox_inches is 'tight'.
+
+ bbox_extra_artists : list of `~matplotlib.artist.Artist`, optional
+ A list of extra artists that will be considered when the
+ tight bbox is calculated.
+
+ backend : str, optional
+ Use a non-default backend to render the file, e.g. to render a
+ png file with the "cairo" backend rather than the default "agg",
+ or a pdf file with the "pgf" backend rather than the default
+ "pdf". Note that the default backend is normally sufficient. See
+ :ref:`the-builtin-backends` for a list of valid backends for each
+ file format. Custom backends can be referenced as "module://...".
+
+ metadata : dict, optional
+ Key/value pairs to store in the image metadata. The supported keys
+ and defaults depend on the image format and backend:
+
+ - 'png' with Agg backend: See the parameter ``metadata`` of
+ `~.FigureCanvasAgg.print_png`.
+ - 'pdf' with pdf backend: See the parameter ``metadata`` of
+ `~.backend_pdf.PdfPages`.
+ - 'svg' with svg backend: See the parameter ``metadata`` of
+ `~.FigureCanvasSVG.print_svg`.
+ - 'eps' and 'ps' with PS backend: Only 'Creator' is supported.
+
+ pil_kwargs : dict, optional
+ Additional keyword arguments that are passed to
+ `PIL.Image.Image.save` when saving the figure.
+ """
+
+ kwargs.setdefault('dpi', mpl.rcParams['savefig.dpi'])
+ if transparent is None:
+ transparent = mpl.rcParams['savefig.transparent']
+
+ if transparent:
+ kwargs.setdefault('facecolor', 'none')
+ kwargs.setdefault('edgecolor', 'none')
+ original_axes_colors = []
+ for ax in self.axes:
+ patch = ax.patch
+ original_axes_colors.append((patch.get_facecolor(),
+ patch.get_edgecolor()))
+ patch.set_facecolor('none')
+ patch.set_edgecolor('none')
+
+ self.canvas.print_figure(fname, **kwargs)
+
+ if transparent:
+ for ax, cc in zip(self.axes, original_axes_colors):
+ ax.patch.set_facecolor(cc[0])
+ ax.patch.set_edgecolor(cc[1])
+
+ def ginput(self, n=1, timeout=30, show_clicks=True,
+ mouse_add=MouseButton.LEFT,
+ mouse_pop=MouseButton.RIGHT,
+ mouse_stop=MouseButton.MIDDLE):
+ """
+ Blocking call to interact with a figure.
+
+ Wait until the user clicks *n* times on the figure, and return the
+ coordinates of each click in a list.
+
+ There are three possible interactions:
+
+ - Add a point.
+ - Remove the most recently added point.
+ - Stop the interaction and return the points added so far.
+
+ The actions are assigned to mouse buttons via the arguments
+ *mouse_add*, *mouse_pop* and *mouse_stop*.
+
+ Parameters
+ ----------
+ n : int, default: 1
+ Number of mouse clicks to accumulate. If negative, accumulate
+ clicks until the input is terminated manually.
+ timeout : float, default: 30 seconds
+ Number of seconds to wait before timing out. If zero or negative
+ will never timeout.
+ show_clicks : bool, default: True
+ If True, show a red cross at the location of each click.
+ mouse_add : `.MouseButton` or None, default: `.MouseButton.LEFT`
+ Mouse button used to add points.
+ mouse_pop : `.MouseButton` or None, default: `.MouseButton.RIGHT`
+ Mouse button used to remove the most recently added point.
+ mouse_stop : `.MouseButton` or None, default: `.MouseButton.MIDDLE`
+ Mouse button used to stop input.
+
+ Returns
+ -------
+ list of tuples
+ A list of the clicked (x, y) coordinates.
+
+ Notes
+ -----
+ The keyboard can also be used to select points in case your mouse
+ does not have one or more of the buttons. The delete and backspace
+ keys act like right clicking (i.e., remove last point), the enter key
+ terminates input and any other key (not already used by the window
+ manager) selects a point.
+ """
+ blocking_mouse_input = BlockingMouseInput(self,
+ mouse_add=mouse_add,
+ mouse_pop=mouse_pop,
+ mouse_stop=mouse_stop)
+ return blocking_mouse_input(n=n, timeout=timeout,
+ show_clicks=show_clicks)
+
+ def waitforbuttonpress(self, timeout=-1):
+ """
+ Blocking call to interact with the figure.
+
+ Wait for user input and return True if a key was pressed, False if a
+ mouse button was pressed and None if no input was given within
+ *timeout* seconds. Negative values deactivate *timeout*.
+ """
+ blocking_input = BlockingKeyMouseInput(self)
+ return blocking_input(timeout=timeout)
+
+ def init_layoutgrid(self):
+ """Initialize the layoutgrid for use in constrained_layout."""
+ del(self._layoutgrid)
+ self._layoutgrid = layoutgrid.LayoutGrid(
+ parent=None, name='figlb')
+
+ def execute_constrained_layout(self, renderer=None):
+ """
+ Use ``layoutgrid`` to determine pos positions within Axes.
+
+ See also `.set_constrained_layout_pads`.
+ """
+
+ from matplotlib._constrained_layout import do_constrained_layout
+ from matplotlib.tight_layout import get_renderer
+
+ _log.debug('Executing constrainedlayout')
+ if self._layoutgrid is None:
+ _api.warn_external("Calling figure.constrained_layout, but "
+ "figure not setup to do constrained layout. "
+ "You either called GridSpec without the "
+ "figure keyword, you are using plt.subplot, "
+ "or you need to call figure or subplots "
+ "with the constrained_layout=True kwarg.")
+ return
+ w_pad, h_pad, wspace, hspace = self.get_constrained_layout_pads()
+ # convert to unit-relative lengths
+ fig = self
+ width, height = fig.get_size_inches()
+ w_pad = w_pad / width
+ h_pad = h_pad / height
+ if renderer is None:
+ renderer = get_renderer(fig)
+ do_constrained_layout(fig, renderer, h_pad, w_pad, hspace, wspace)
+
+ def tight_layout(self, *, pad=1.08, h_pad=None, w_pad=None, rect=None):
+ """
+ Adjust the padding between and around subplots.
+
+ To exclude an artist on the Axes from the bounding box calculation
+ that determines the subplot parameters (i.e. legend, or annotation),
+ set ``a.set_in_layout(False)`` for that artist.
+
+ Parameters
+ ----------
+ pad : float, default: 1.08
+ Padding between the figure edge and the edges of subplots,
+ as a fraction of the font size.
+ h_pad, w_pad : float, default: *pad*
+ Padding (height/width) between edges of adjacent subplots,
+ as a fraction of the font size.
+ rect : tuple (left, bottom, right, top), default: (0, 0, 1, 1)
+ A rectangle in normalized figure coordinates into which the whole
+ subplots area (including labels) will fit.
+
+ See Also
+ --------
+ .Figure.set_tight_layout
+ .pyplot.tight_layout
+ """
+
+ from .tight_layout import (
+ get_renderer, get_subplotspec_list, get_tight_layout_figure)
+ from contextlib import suppress
+ subplotspec_list = get_subplotspec_list(self.axes)
+ if None in subplotspec_list:
+ _api.warn_external("This figure includes Axes that are not "
+ "compatible with tight_layout, so results "
+ "might be incorrect.")
+
+ renderer = get_renderer(self)
+ ctx = (renderer._draw_disabled()
+ if hasattr(renderer, '_draw_disabled')
+ else suppress())
+ with ctx:
+ kwargs = get_tight_layout_figure(
+ self, self.axes, subplotspec_list, renderer,
+ pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
+ if kwargs:
+ self.subplots_adjust(**kwargs)
+
+
+def figaspect(arg):
+ """
+ Calculate the width and height for a figure with a specified aspect ratio.
+
+ While the height is taken from :rc:`figure.figsize`, the width is
+ adjusted to match the desired aspect ratio. Additionally, it is ensured
+ that the width is in the range [4., 16.] and the height is in the range
+ [2., 16.]. If necessary, the default height is adjusted to ensure this.
+
+ Parameters
+ ----------
+ arg : float or 2D array
+ If a float, this defines the aspect ratio (i.e. the ratio height /
+ width).
+ In case of an array the aspect ratio is number of rows / number of
+ columns, so that the array could be fitted in the figure undistorted.
+
+ Returns
+ -------
+ width, height : float
+ The figure size in inches.
+
+ Notes
+ -----
+ If you want to create an Axes within the figure, that still preserves the
+ aspect ratio, be sure to create it with equal width and height. See
+ examples below.
+
+ Thanks to Fernando Perez for this function.
+
+ Examples
+ --------
+ Make a figure twice as tall as it is wide::
+
+ w, h = figaspect(2.)
+ fig = Figure(figsize=(w, h))
+ ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
+ ax.imshow(A, **kwargs)
+
+ Make a figure with the proper aspect for an array::
+
+ A = rand(5, 3)
+ w, h = figaspect(A)
+ fig = Figure(figsize=(w, h))
+ ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
+ ax.imshow(A, **kwargs)
+ """
+
+ isarray = hasattr(arg, 'shape') and not np.isscalar(arg)
+
+ # min/max sizes to respect when autoscaling. If John likes the idea, they
+ # could become rc parameters, for now they're hardwired.
+ figsize_min = np.array((4.0, 2.0)) # min length for width/height
+ figsize_max = np.array((16.0, 16.0)) # max length for width/height
+
+ # Extract the aspect ratio of the array
+ if isarray:
+ nr, nc = arg.shape[:2]
+ arr_ratio = nr / nc
+ else:
+ arr_ratio = arg
+
+ # Height of user figure defaults
+ fig_height = mpl.rcParams['figure.figsize'][1]
+
+ # New size for the figure, keeping the aspect ratio of the caller
+ newsize = np.array((fig_height / arr_ratio, fig_height))
+
+ # Sanity checks, don't drop either dimension below figsize_min
+ newsize /= min(1.0, *(newsize / figsize_min))
+
+ # Avoid humongous windows as well
+ newsize /= max(1.0, *(newsize / figsize_max))
+
+ # Finally, if we have a really funky aspect ratio, break it but respect
+ # the min/max dimensions (we don't want figures 10 feet tall!)
+ newsize = np.clip(newsize, figsize_min, figsize_max)
+ return newsize
+
+
+docstring.interpd.update(Figure_kwdoc=martist.kwdoc(Figure))
diff --git a/venv/Lib/site-packages/matplotlib/font_manager.py b/venv/Lib/site-packages/matplotlib/font_manager.py
new file mode 100644
index 0000000..2b65c36
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/font_manager.py
@@ -0,0 +1,1448 @@
+"""
+A module for finding, managing, and using fonts across platforms.
+
+This module provides a single `FontManager` instance that can
+be shared across backends and platforms. The `findfont`
+function returns the best TrueType (TTF) font file in the local or
+system font path that matches the specified `FontProperties`
+instance. The `FontManager` also handles Adobe Font Metrics
+(AFM) font files for use by the PostScript backend.
+
+The design is based on the `W3C Cascading Style Sheet, Level 1 (CSS1)
+font specification `_.
+Future versions may implement the Level 2 or 2.1 specifications.
+"""
+
+# KNOWN ISSUES
+#
+# - documentation
+# - font variant is untested
+# - font stretch is incomplete
+# - font size is incomplete
+# - default font algorithm needs improvement and testing
+# - setWeights function needs improvement
+# - 'light' is an invalid weight value, remove it.
+
+from functools import lru_cache
+import json
+import logging
+from numbers import Number
+import os
+from pathlib import Path
+import re
+import subprocess
+import sys
+try:
+ import threading
+ from threading import Timer
+except ImportError:
+ import dummy_threading as threading
+ from dummy_threading import Timer
+
+import matplotlib as mpl
+from matplotlib import _api, afm, cbook, ft2font, rcParams
+from matplotlib.fontconfig_pattern import (
+ parse_fontconfig_pattern, generate_fontconfig_pattern)
+from matplotlib.rcsetup import _validators
+
+_log = logging.getLogger(__name__)
+
+font_scalings = {
+ 'xx-small': 0.579,
+ 'x-small': 0.694,
+ 'small': 0.833,
+ 'medium': 1.0,
+ 'large': 1.200,
+ 'x-large': 1.440,
+ 'xx-large': 1.728,
+ 'larger': 1.2,
+ 'smaller': 0.833,
+ None: 1.0,
+}
+stretch_dict = {
+ 'ultra-condensed': 100,
+ 'extra-condensed': 200,
+ 'condensed': 300,
+ 'semi-condensed': 400,
+ 'normal': 500,
+ 'semi-expanded': 600,
+ 'semi-extended': 600,
+ 'expanded': 700,
+ 'extended': 700,
+ 'extra-expanded': 800,
+ 'extra-extended': 800,
+ 'ultra-expanded': 900,
+ 'ultra-extended': 900,
+}
+weight_dict = {
+ 'ultralight': 100,
+ 'light': 200,
+ 'normal': 400,
+ 'regular': 400,
+ 'book': 400,
+ 'medium': 500,
+ 'roman': 500,
+ 'semibold': 600,
+ 'demibold': 600,
+ 'demi': 600,
+ 'bold': 700,
+ 'heavy': 800,
+ 'extra bold': 800,
+ 'black': 900,
+}
+_weight_regexes = [
+ # From fontconfig's FcFreeTypeQueryFaceInternal; not the same as
+ # weight_dict!
+ ("thin", 100),
+ ("extralight", 200),
+ ("ultralight", 200),
+ ("demilight", 350),
+ ("semilight", 350),
+ ("light", 300), # Needs to come *after* demi/semilight!
+ ("book", 380),
+ ("regular", 400),
+ ("normal", 400),
+ ("medium", 500),
+ ("demibold", 600),
+ ("demi", 600),
+ ("semibold", 600),
+ ("extrabold", 800),
+ ("superbold", 800),
+ ("ultrabold", 800),
+ ("bold", 700), # Needs to come *after* extra/super/ultrabold!
+ ("ultrablack", 1000),
+ ("superblack", 1000),
+ ("extrablack", 1000),
+ (r"\bultra", 1000),
+ ("black", 900), # Needs to come *after* ultra/super/extrablack!
+ ("heavy", 900),
+]
+font_family_aliases = {
+ 'serif',
+ 'sans-serif',
+ 'sans serif',
+ 'cursive',
+ 'fantasy',
+ 'monospace',
+ 'sans',
+}
+
+
+# OS Font paths
+try:
+ _HOME = Path.home()
+except Exception: # Exceptions thrown by home() are not specified...
+ _HOME = Path(os.devnull) # Just an arbitrary path with no children.
+MSFolders = \
+ r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'
+MSFontDirectories = [
+ r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts',
+ r'SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts']
+MSUserFontDirectories = [
+ str(_HOME / 'AppData/Local/Microsoft/Windows/Fonts'),
+ str(_HOME / 'AppData/Roaming/Microsoft/Windows/Fonts'),
+]
+X11FontDirectories = [
+ # an old standard installation point
+ "/usr/X11R6/lib/X11/fonts/TTF/",
+ "/usr/X11/lib/X11/fonts",
+ # here is the new standard location for fonts
+ "/usr/share/fonts/",
+ # documented as a good place to install new fonts
+ "/usr/local/share/fonts/",
+ # common application, not really useful
+ "/usr/lib/openoffice/share/fonts/truetype/",
+ # user fonts
+ str((Path(os.environ.get('XDG_DATA_HOME') or _HOME / ".local/share"))
+ / "fonts"),
+ str(_HOME / ".fonts"),
+]
+OSXFontDirectories = [
+ "/Library/Fonts/",
+ "/Network/Library/Fonts/",
+ "/System/Library/Fonts/",
+ # fonts installed via MacPorts
+ "/opt/local/share/fonts",
+ # user fonts
+ str(_HOME / "Library/Fonts"),
+]
+
+
+@lru_cache(64)
+def _cached_realpath(path):
+ return os.path.realpath(path)
+
+
+def get_fontext_synonyms(fontext):
+ """
+ Return a list of file extensions extensions that are synonyms for
+ the given file extension *fileext*.
+ """
+ return {
+ 'afm': ['afm'],
+ 'otf': ['otf', 'ttc', 'ttf'],
+ 'ttc': ['otf', 'ttc', 'ttf'],
+ 'ttf': ['otf', 'ttc', 'ttf'],
+ }[fontext]
+
+
+def list_fonts(directory, extensions):
+ """
+ Return a list of all fonts matching any of the extensions, found
+ recursively under the directory.
+ """
+ extensions = ["." + ext for ext in extensions]
+ return [os.path.join(dirpath, filename)
+ # os.walk ignores access errors, unlike Path.glob.
+ for dirpath, _, filenames in os.walk(directory)
+ for filename in filenames
+ if Path(filename).suffix.lower() in extensions]
+
+
+def win32FontDirectory():
+ r"""
+ Return the user-specified font directory for Win32. This is
+ looked up from the registry key ::
+
+ \\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Fonts
+
+ If the key is not found, ``%WINDIR%\Fonts`` will be returned.
+ """
+ import winreg
+ try:
+ with winreg.OpenKey(winreg.HKEY_CURRENT_USER, MSFolders) as user:
+ return winreg.QueryValueEx(user, 'Fonts')[0]
+ except OSError:
+ return os.path.join(os.environ['WINDIR'], 'Fonts')
+
+
+def _win32RegistryFonts(reg_domain, base_dir):
+ r"""
+ Search for fonts in the Windows registry.
+
+ Parameters
+ ----------
+ reg_domain : int
+ The top level registry domain (e.g. HKEY_LOCAL_MACHINE).
+
+ base_dir : str
+ The path to the folder where the font files are usually located (e.g.
+ C:\Windows\Fonts). If only the filename of the font is stored in the
+ registry, the absolute path is built relative to this base directory.
+
+ Returns
+ -------
+ `set`
+ `pathlib.Path` objects with the absolute path to the font files found.
+
+ """
+ import winreg
+ items = set()
+
+ for reg_path in MSFontDirectories:
+ try:
+ with winreg.OpenKey(reg_domain, reg_path) as local:
+ for j in range(winreg.QueryInfoKey(local)[1]):
+ # value may contain the filename of the font or its
+ # absolute path.
+ key, value, tp = winreg.EnumValue(local, j)
+ if not isinstance(value, str):
+ continue
+
+ # Work around for https://bugs.python.org/issue25778, which
+ # is fixed in Py>=3.6.1.
+ value = value.split("\0", 1)[0]
+
+ try:
+ # If value contains already an absolute path, then it
+ # is not changed further.
+ path = Path(base_dir, value).resolve()
+ except RuntimeError:
+ # Don't fail with invalid entries.
+ continue
+
+ items.add(path)
+ except (OSError, MemoryError):
+ continue
+
+ return items
+
+
+def win32InstalledFonts(directory=None, fontext='ttf'):
+ """
+ Search for fonts in the specified font directory, or use the
+ system directories if none given. Additionally, it is searched for user
+ fonts installed. A list of TrueType font filenames are returned by default,
+ or AFM fonts if *fontext* == 'afm'.
+ """
+ import winreg
+
+ if directory is None:
+ directory = win32FontDirectory()
+
+ fontext = ['.' + ext for ext in get_fontext_synonyms(fontext)]
+
+ items = set()
+
+ # System fonts
+ items.update(_win32RegistryFonts(winreg.HKEY_LOCAL_MACHINE, directory))
+
+ # User fonts
+ for userdir in MSUserFontDirectories:
+ items.update(_win32RegistryFonts(winreg.HKEY_CURRENT_USER, userdir))
+
+ # Keep only paths with matching file extension.
+ return [str(path) for path in items if path.suffix.lower() in fontext]
+
+
+@lru_cache()
+def _call_fc_list():
+ """Cache and list the font filenames known to `fc-list`."""
+ try:
+ if b'--format' not in subprocess.check_output(['fc-list', '--help']):
+ _log.warning( # fontconfig 2.7 implemented --format.
+ 'Matplotlib needs fontconfig>=2.7 to query system fonts.')
+ return []
+ out = subprocess.check_output(['fc-list', '--format=%{file}\\n'])
+ except (OSError, subprocess.CalledProcessError):
+ return []
+ return [os.fsdecode(fname) for fname in out.split(b'\n')]
+
+
+def get_fontconfig_fonts(fontext='ttf'):
+ """List font filenames known to `fc-list` having the given extension."""
+ fontext = ['.' + ext for ext in get_fontext_synonyms(fontext)]
+ return [fname for fname in _call_fc_list()
+ if Path(fname).suffix.lower() in fontext]
+
+
+def findSystemFonts(fontpaths=None, fontext='ttf'):
+ """
+ Search for fonts in the specified font paths. If no paths are
+ given, will use a standard set of system paths, as well as the
+ list of fonts tracked by fontconfig if fontconfig is installed and
+ available. A list of TrueType fonts are returned by default with
+ AFM fonts as an option.
+ """
+ fontfiles = set()
+ fontexts = get_fontext_synonyms(fontext)
+
+ if fontpaths is None:
+ if sys.platform == 'win32':
+ fontpaths = MSUserFontDirectories + [win32FontDirectory()]
+ # now get all installed fonts directly...
+ fontfiles.update(win32InstalledFonts(fontext=fontext))
+ else:
+ fontpaths = X11FontDirectories
+ if sys.platform == 'darwin':
+ fontpaths = [*X11FontDirectories, *OSXFontDirectories]
+ fontfiles.update(get_fontconfig_fonts(fontext))
+
+ elif isinstance(fontpaths, str):
+ fontpaths = [fontpaths]
+
+ for path in fontpaths:
+ fontfiles.update(map(os.path.abspath, list_fonts(path, fontexts)))
+
+ return [fname for fname in fontfiles if os.path.exists(fname)]
+
+
+class FontEntry:
+ """
+ A class for storing Font properties. It is used when populating
+ the font lookup dictionary.
+ """
+ def __init__(self,
+ fname ='',
+ name ='',
+ style ='normal',
+ variant='normal',
+ weight ='normal',
+ stretch='normal',
+ size ='medium',
+ ):
+ self.fname = fname
+ self.name = name
+ self.style = style
+ self.variant = variant
+ self.weight = weight
+ self.stretch = stretch
+ try:
+ self.size = str(float(size))
+ except ValueError:
+ self.size = size
+
+ def __repr__(self):
+ return "" % (
+ self.name, os.path.basename(self.fname), self.style, self.variant,
+ self.weight, self.stretch)
+
+
+def ttfFontProperty(font):
+ """
+ Extract information from a TrueType font file.
+
+ Parameters
+ ----------
+ font : `.FT2Font`
+ The TrueType font file from which information will be extracted.
+
+ Returns
+ -------
+ `FontEntry`
+ The extracted font properties.
+
+ """
+ name = font.family_name
+
+ # Styles are: italic, oblique, and normal (default)
+
+ sfnt = font.get_sfnt()
+ mac_key = (1, # platform: macintosh
+ 0, # id: roman
+ 0) # langid: english
+ ms_key = (3, # platform: microsoft
+ 1, # id: unicode_cs
+ 0x0409) # langid: english_united_states
+
+ # These tables are actually mac_roman-encoded, but mac_roman support may be
+ # missing in some alternative Python implementations and we are only going
+ # to look for ASCII substrings, where any ASCII-compatible encoding works
+ # - or big-endian UTF-16, since important Microsoft fonts use that.
+ sfnt2 = (sfnt.get((*mac_key, 2), b'').decode('latin-1').lower() or
+ sfnt.get((*ms_key, 2), b'').decode('utf_16_be').lower())
+ sfnt4 = (sfnt.get((*mac_key, 4), b'').decode('latin-1').lower() or
+ sfnt.get((*ms_key, 4), b'').decode('utf_16_be').lower())
+
+ if sfnt4.find('oblique') >= 0:
+ style = 'oblique'
+ elif sfnt4.find('italic') >= 0:
+ style = 'italic'
+ elif sfnt2.find('regular') >= 0:
+ style = 'normal'
+ elif font.style_flags & ft2font.ITALIC:
+ style = 'italic'
+ else:
+ style = 'normal'
+
+ # Variants are: small-caps and normal (default)
+
+ # !!!! Untested
+ if name.lower() in ['capitals', 'small-caps']:
+ variant = 'small-caps'
+ else:
+ variant = 'normal'
+
+ # The weight-guessing algorithm is directly translated from fontconfig
+ # 2.13.1's FcFreeTypeQueryFaceInternal (fcfreetype.c).
+ wws_subfamily = 22
+ typographic_subfamily = 16
+ font_subfamily = 2
+ styles = [
+ sfnt.get((*mac_key, wws_subfamily), b'').decode('latin-1'),
+ sfnt.get((*mac_key, typographic_subfamily), b'').decode('latin-1'),
+ sfnt.get((*mac_key, font_subfamily), b'').decode('latin-1'),
+ sfnt.get((*ms_key, wws_subfamily), b'').decode('utf-16-be'),
+ sfnt.get((*ms_key, typographic_subfamily), b'').decode('utf-16-be'),
+ sfnt.get((*ms_key, font_subfamily), b'').decode('utf-16-be'),
+ ]
+ styles = [*filter(None, styles)] or [font.style_name]
+
+ def get_weight(): # From fontconfig's FcFreeTypeQueryFaceInternal.
+ # OS/2 table weight.
+ os2 = font.get_sfnt_table("OS/2")
+ if os2 and os2["version"] != 0xffff:
+ return os2["usWeightClass"]
+ # PostScript font info weight.
+ try:
+ ps_font_info_weight = (
+ font.get_ps_font_info()["weight"].replace(" ", "") or "")
+ except ValueError:
+ pass
+ else:
+ for regex, weight in _weight_regexes:
+ if re.fullmatch(regex, ps_font_info_weight, re.I):
+ return weight
+ # Style name weight.
+ for style in styles:
+ style = style.replace(" ", "")
+ for regex, weight in _weight_regexes:
+ if re.search(regex, style, re.I):
+ return weight
+ if font.style_flags & ft2font.BOLD:
+ return 700 # "bold"
+ return 500 # "medium", not "regular"!
+
+ weight = int(get_weight())
+
+ # Stretch can be absolute and relative
+ # Absolute stretches are: ultra-condensed, extra-condensed, condensed,
+ # semi-condensed, normal, semi-expanded, expanded, extra-expanded,
+ # and ultra-expanded.
+ # Relative stretches are: wider, narrower
+ # Child value is: inherit
+
+ if any(word in sfnt4 for word in ['narrow', 'condensed', 'cond']):
+ stretch = 'condensed'
+ elif 'demi cond' in sfnt4:
+ stretch = 'semi-condensed'
+ elif any(word in sfnt4 for word in ['wide', 'expanded', 'extended']):
+ stretch = 'expanded'
+ else:
+ stretch = 'normal'
+
+ # Sizes can be absolute and relative.
+ # Absolute sizes are: xx-small, x-small, small, medium, large, x-large,
+ # and xx-large.
+ # Relative sizes are: larger, smaller
+ # Length value is an absolute font size, e.g., 12pt
+ # Percentage values are in 'em's. Most robust specification.
+
+ if not font.scalable:
+ raise NotImplementedError("Non-scalable fonts are not supported")
+ size = 'scalable'
+
+ return FontEntry(font.fname, name, style, variant, weight, stretch, size)
+
+
+def afmFontProperty(fontpath, font):
+ """
+ Extract information from an AFM font file.
+
+ Parameters
+ ----------
+ font : `.AFM`
+ The AFM font file from which information will be extracted.
+
+ Returns
+ -------
+ `FontEntry`
+ The extracted font properties.
+ """
+
+ name = font.get_familyname()
+ fontname = font.get_fontname().lower()
+
+ # Styles are: italic, oblique, and normal (default)
+
+ if font.get_angle() != 0 or 'italic' in name.lower():
+ style = 'italic'
+ elif 'oblique' in name.lower():
+ style = 'oblique'
+ else:
+ style = 'normal'
+
+ # Variants are: small-caps and normal (default)
+
+ # !!!! Untested
+ if name.lower() in ['capitals', 'small-caps']:
+ variant = 'small-caps'
+ else:
+ variant = 'normal'
+
+ weight = font.get_weight().lower()
+ if weight not in weight_dict:
+ weight = 'normal'
+
+ # Stretch can be absolute and relative
+ # Absolute stretches are: ultra-condensed, extra-condensed, condensed,
+ # semi-condensed, normal, semi-expanded, expanded, extra-expanded,
+ # and ultra-expanded.
+ # Relative stretches are: wider, narrower
+ # Child value is: inherit
+ if 'demi cond' in fontname:
+ stretch = 'semi-condensed'
+ elif any(word in fontname for word in ['narrow', 'cond']):
+ stretch = 'condensed'
+ elif any(word in fontname for word in ['wide', 'expanded', 'extended']):
+ stretch = 'expanded'
+ else:
+ stretch = 'normal'
+
+ # Sizes can be absolute and relative.
+ # Absolute sizes are: xx-small, x-small, small, medium, large, x-large,
+ # and xx-large.
+ # Relative sizes are: larger, smaller
+ # Length value is an absolute font size, e.g., 12pt
+ # Percentage values are in 'em's. Most robust specification.
+
+ # All AFM fonts are apparently scalable.
+
+ size = 'scalable'
+
+ return FontEntry(fontpath, name, style, variant, weight, stretch, size)
+
+
+class FontProperties:
+ """
+ A class for storing and manipulating font properties.
+
+ The font properties are the six properties described in the
+ `W3C Cascading Style Sheet, Level 1
+ `_ font
+ specification and *math_fontfamily* for math fonts:
+
+ - family: A list of font names in decreasing order of priority.
+ The items may include a generic font family name, either
+ 'sans-serif' (default), 'serif', 'cursive', 'fantasy', or 'monospace'.
+ In that case, the actual font to be used will be looked up
+ from the associated rcParam.
+
+ - style: Either 'normal' (default), 'italic' or 'oblique'.
+
+ - variant: Either 'normal' (default) or 'small-caps'.
+
+ - stretch: A numeric value in the range 0-1000 or one of
+ 'ultra-condensed', 'extra-condensed', 'condensed',
+ 'semi-condensed', 'normal' (default), 'semi-expanded', 'expanded',
+ 'extra-expanded' or 'ultra-expanded'.
+
+ - weight: A numeric value in the range 0-1000 or one of
+ 'ultralight', 'light', 'normal' (default), 'regular', 'book', 'medium',
+ 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy',
+ 'extra bold', 'black'.
+
+ - size: Either an relative value of 'xx-small', 'x-small',
+ 'small', 'medium', 'large', 'x-large', 'xx-large' or an
+ absolute font size, e.g., 10 (default).
+
+ - math_fontfamily: The family of fonts used to render math text; overrides
+ :rc:`mathtext.fontset`. Supported values are the same as the ones
+ supported by :rc:`mathtext.fontset`: 'dejavusans', 'dejavuserif', 'cm',
+ 'stix', 'stixsans' and 'custom'.
+
+ Alternatively, a font may be specified using the absolute path to a font
+ file, by using the *fname* kwarg. However, in this case, it is typically
+ simpler to just pass the path (as a `pathlib.Path`, not a `str`) to the
+ *font* kwarg of the `.Text` object.
+
+ The preferred usage of font sizes is to use the relative values,
+ e.g., 'large', instead of absolute font sizes, e.g., 12. This
+ approach allows all text sizes to be made larger or smaller based
+ on the font manager's default font size.
+
+ This class will also accept a fontconfig_ pattern_, if it is the only
+ argument provided. This support does not depend on fontconfig; we are
+ merely borrowing its pattern syntax for use here.
+
+ .. _fontconfig: https://www.freedesktop.org/wiki/Software/fontconfig/
+ .. _pattern:
+ https://www.freedesktop.org/software/fontconfig/fontconfig-user.html
+
+ Note that Matplotlib's internal font manager and fontconfig use a
+ different algorithm to lookup fonts, so the results of the same pattern
+ may be different in Matplotlib than in other applications that use
+ fontconfig.
+ """
+
+ def __init__(self,
+ family = None,
+ style = None,
+ variant= None,
+ weight = None,
+ stretch= None,
+ size = None,
+ fname = None, # if set, it's a hardcoded filename to use
+ math_fontfamily = None,
+ ):
+ self._family = _normalize_font_family(rcParams['font.family'])
+ self._slant = rcParams['font.style']
+ self._variant = rcParams['font.variant']
+ self._weight = rcParams['font.weight']
+ self._stretch = rcParams['font.stretch']
+ self._size = rcParams['font.size']
+ self._file = None
+ self._math_fontfamily = None
+
+ if isinstance(family, str):
+ # Treat family as a fontconfig pattern if it is the only
+ # parameter provided.
+ if (style is None and variant is None and weight is None and
+ stretch is None and size is None and fname is None):
+ self.set_fontconfig_pattern(family)
+ return
+
+ self.set_family(family)
+ self.set_style(style)
+ self.set_variant(variant)
+ self.set_weight(weight)
+ self.set_stretch(stretch)
+ self.set_file(fname)
+ self.set_size(size)
+ self.set_math_fontfamily(math_fontfamily)
+
+ @classmethod
+ def _from_any(cls, arg):
+ """
+ Generic constructor which can build a `.FontProperties` from any of the
+ following:
+
+ - a `.FontProperties`: it is passed through as is;
+ - `None`: a `.FontProperties` using rc values is used;
+ - an `os.PathLike`: it is used as path to the font file;
+ - a `str`: it is parsed as a fontconfig pattern;
+ - a `dict`: it is passed as ``**kwargs`` to `.FontProperties`.
+ """
+ if isinstance(arg, cls):
+ return arg
+ elif arg is None:
+ return cls()
+ elif isinstance(arg, os.PathLike):
+ return cls(fname=arg)
+ elif isinstance(arg, str):
+ return cls(arg)
+ else:
+ return cls(**arg)
+
+ def __hash__(self):
+ l = (tuple(self.get_family()),
+ self.get_slant(),
+ self.get_variant(),
+ self.get_weight(),
+ self.get_stretch(),
+ self.get_size_in_points(),
+ self.get_file(),
+ self.get_math_fontfamily())
+ return hash(l)
+
+ def __eq__(self, other):
+ return hash(self) == hash(other)
+
+ def __str__(self):
+ return self.get_fontconfig_pattern()
+
+ def get_family(self):
+ """
+ Return a list of font names that comprise the font family.
+ """
+ return self._family
+
+ def get_name(self):
+ """
+ Return the name of the font that best matches the font properties.
+ """
+ return get_font(findfont(self)).family_name
+
+ def get_style(self):
+ """
+ Return the font style. Values are: 'normal', 'italic' or 'oblique'.
+ """
+ return self._slant
+ get_slant = get_style
+
+ def get_variant(self):
+ """
+ Return the font variant. Values are: 'normal' or 'small-caps'.
+ """
+ return self._variant
+
+ def get_weight(self):
+ """
+ Set the font weight. Options are: A numeric value in the
+ range 0-1000 or one of 'light', 'normal', 'regular', 'book',
+ 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold',
+ 'heavy', 'extra bold', 'black'
+ """
+ return self._weight
+
+ def get_stretch(self):
+ """
+ Return the font stretch or width. Options are: 'ultra-condensed',
+ 'extra-condensed', 'condensed', 'semi-condensed', 'normal',
+ 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'.
+ """
+ return self._stretch
+
+ def get_size(self):
+ """
+ Return the font size.
+ """
+ return self._size
+
+ def get_size_in_points(self):
+ return self._size
+
+ def get_file(self):
+ """
+ Return the filename of the associated font.
+ """
+ return self._file
+
+ def get_fontconfig_pattern(self):
+ """
+ Get a fontconfig_ pattern_ suitable for looking up the font as
+ specified with fontconfig's ``fc-match`` utility.
+
+ This support does not depend on fontconfig; we are merely borrowing its
+ pattern syntax for use here.
+ """
+ return generate_fontconfig_pattern(self)
+
+ def set_family(self, family):
+ """
+ Change the font family. May be either an alias (generic name
+ is CSS parlance), such as: 'serif', 'sans-serif', 'cursive',
+ 'fantasy', or 'monospace', a real font name or a list of real
+ font names. Real font names are not supported when
+ :rc:`text.usetex` is `True`.
+ """
+ if family is None:
+ family = rcParams['font.family']
+ self._family = _normalize_font_family(family)
+ set_name = set_family
+
+ def set_style(self, style):
+ """
+ Set the font style. Values are: 'normal', 'italic' or 'oblique'.
+ """
+ if style is None:
+ style = rcParams['font.style']
+ _api.check_in_list(['normal', 'italic', 'oblique'], style=style)
+ self._slant = style
+ set_slant = set_style
+
+ def set_variant(self, variant):
+ """
+ Set the font variant. Values are: 'normal' or 'small-caps'.
+ """
+ if variant is None:
+ variant = rcParams['font.variant']
+ _api.check_in_list(['normal', 'small-caps'], variant=variant)
+ self._variant = variant
+
+ def set_weight(self, weight):
+ """
+ Set the font weight. May be either a numeric value in the
+ range 0-1000 or one of 'ultralight', 'light', 'normal',
+ 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold',
+ 'demi', 'bold', 'heavy', 'extra bold', 'black'
+ """
+ if weight is None:
+ weight = rcParams['font.weight']
+ try:
+ weight = int(weight)
+ if weight < 0 or weight > 1000:
+ raise ValueError()
+ except ValueError:
+ if weight not in weight_dict:
+ raise ValueError("weight is invalid")
+ self._weight = weight
+
+ def set_stretch(self, stretch):
+ """
+ Set the font stretch or width. Options are: 'ultra-condensed',
+ 'extra-condensed', 'condensed', 'semi-condensed', 'normal',
+ 'semi-expanded', 'expanded', 'extra-expanded' or
+ 'ultra-expanded', or a numeric value in the range 0-1000.
+ """
+ if stretch is None:
+ stretch = rcParams['font.stretch']
+ try:
+ stretch = int(stretch)
+ if stretch < 0 or stretch > 1000:
+ raise ValueError()
+ except ValueError as err:
+ if stretch not in stretch_dict:
+ raise ValueError("stretch is invalid") from err
+ self._stretch = stretch
+
+ def set_size(self, size):
+ """
+ Set the font size. Either an relative value of 'xx-small',
+ 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'
+ or an absolute font size, e.g., 12.
+ """
+ if size is None:
+ size = rcParams['font.size']
+ try:
+ size = float(size)
+ except ValueError:
+ try:
+ scale = font_scalings[size]
+ except KeyError as err:
+ raise ValueError(
+ "Size is invalid. Valid font size are "
+ + ", ".join(map(str, font_scalings))) from err
+ else:
+ size = scale * FontManager.get_default_size()
+ if size < 1.0:
+ _log.info('Fontsize %1.2f < 1.0 pt not allowed by FreeType. '
+ 'Setting fontsize = 1 pt', size)
+ size = 1.0
+ self._size = size
+
+ def set_file(self, file):
+ """
+ Set the filename of the fontfile to use. In this case, all
+ other properties will be ignored.
+ """
+ self._file = os.fspath(file) if file is not None else None
+
+ def set_fontconfig_pattern(self, pattern):
+ """
+ Set the properties by parsing a fontconfig_ *pattern*.
+
+ This support does not depend on fontconfig; we are merely borrowing its
+ pattern syntax for use here.
+ """
+ for key, val in parse_fontconfig_pattern(pattern).items():
+ if type(val) == list:
+ getattr(self, "set_" + key)(val[0])
+ else:
+ getattr(self, "set_" + key)(val)
+
+ def get_math_fontfamily(self):
+ """
+ Return the name of the font family used for math text.
+
+ The default font is :rc:`mathtext.fontset`.
+ """
+ return self._math_fontfamily
+
+ def set_math_fontfamily(self, fontfamily):
+ """
+ Set the font family for text in math mode.
+
+ If not set explicitly, :rc:`mathtext.fontset` will be used.
+
+ Parameters
+ ----------
+ fontfamily : str
+ The name of the font family.
+
+ Available font families are defined in the
+ matplotlibrc.template file
+ :ref:`here `
+
+ See Also
+ --------
+ .text.Text.get_math_fontfamily
+ """
+ if fontfamily is None:
+ fontfamily = rcParams['mathtext.fontset']
+ else:
+ valid_fonts = _validators['mathtext.fontset'].valid.values()
+ # _check_in_list() Validates the parameter math_fontfamily as
+ # if it were passed to rcParams['mathtext.fontset']
+ _api.check_in_list(valid_fonts, math_fontfamily=fontfamily)
+ self._math_fontfamily = fontfamily
+
+ def copy(self):
+ """Return a copy of self."""
+ new = type(self)()
+ vars(new).update(vars(self))
+ return new
+
+
+class _JSONEncoder(json.JSONEncoder):
+ def default(self, o):
+ if isinstance(o, FontManager):
+ return dict(o.__dict__, __class__='FontManager')
+ elif isinstance(o, FontEntry):
+ d = dict(o.__dict__, __class__='FontEntry')
+ try:
+ # Cache paths of fonts shipped with Matplotlib relative to the
+ # Matplotlib data path, which helps in the presence of venvs.
+ d["fname"] = str(
+ Path(d["fname"]).relative_to(mpl.get_data_path()))
+ except ValueError:
+ pass
+ return d
+ else:
+ return super().default(o)
+
+
+def _json_decode(o):
+ cls = o.pop('__class__', None)
+ if cls is None:
+ return o
+ elif cls == 'FontManager':
+ r = FontManager.__new__(FontManager)
+ r.__dict__.update(o)
+ return r
+ elif cls == 'FontEntry':
+ r = FontEntry.__new__(FontEntry)
+ r.__dict__.update(o)
+ if not os.path.isabs(r.fname):
+ r.fname = os.path.join(mpl.get_data_path(), r.fname)
+ return r
+ else:
+ raise ValueError("Don't know how to deserialize __class__=%s" % cls)
+
+
+def json_dump(data, filename):
+ """
+ Dump `FontManager` *data* as JSON to the file named *filename*.
+
+ See Also
+ --------
+ json_load
+
+ Notes
+ -----
+ File paths that are children of the Matplotlib data path (typically, fonts
+ shipped with Matplotlib) are stored relative to that data path (to remain
+ valid across virtualenvs).
+
+ This function temporarily locks the output file to prevent multiple
+ processes from overwriting one another's output.
+ """
+ with cbook._lock_path(filename), open(filename, 'w') as fh:
+ try:
+ json.dump(data, fh, cls=_JSONEncoder, indent=2)
+ except OSError as e:
+ _log.warning('Could not save font_manager cache {}'.format(e))
+
+
+def json_load(filename):
+ """
+ Load a `FontManager` from the JSON file named *filename*.
+
+ See Also
+ --------
+ json_dump
+ """
+ with open(filename, 'r') as fh:
+ return json.load(fh, object_hook=_json_decode)
+
+
+def _normalize_font_family(family):
+ if isinstance(family, str):
+ family = [family]
+ return family
+
+
+class FontManager:
+ """
+ On import, the `FontManager` singleton instance creates a list of ttf and
+ afm fonts and caches their `FontProperties`. The `FontManager.findfont`
+ method does a nearest neighbor search to find the font that most closely
+ matches the specification. If no good enough match is found, the default
+ font is returned.
+ """
+ # Increment this version number whenever the font cache data
+ # format or behavior has changed and requires a existing font
+ # cache files to be rebuilt.
+ __version__ = 330
+
+ def __init__(self, size=None, weight='normal'):
+ self._version = self.__version__
+
+ self.__default_weight = weight
+ self.default_size = size
+
+ paths = [cbook._get_data_path('fonts', subdir)
+ for subdir in ['ttf', 'afm', 'pdfcorefonts']]
+ # Create list of font paths
+ for pathname in ['TTFPATH', 'AFMPATH']:
+ if pathname in os.environ:
+ ttfpath = os.environ[pathname]
+ if ttfpath.find(';') >= 0: # win32 style
+ paths.extend(ttfpath.split(';'))
+ elif ttfpath.find(':') >= 0: # unix style
+ paths.extend(ttfpath.split(':'))
+ else:
+ paths.append(ttfpath)
+ _api.warn_deprecated(
+ "3.3", name=pathname, obj_type="environment variable",
+ alternative="FontManager.addfont()")
+ _log.debug('font search path %s', str(paths))
+ # Load TrueType fonts and create font dictionary.
+
+ self.defaultFamily = {
+ 'ttf': 'DejaVu Sans',
+ 'afm': 'Helvetica'}
+
+ self.afmlist = []
+ self.ttflist = []
+
+ # Delay the warning by 5s.
+ timer = Timer(5, lambda: _log.warning(
+ 'Matplotlib is building the font cache; this may take a moment.'))
+ timer.start()
+ try:
+ for fontext in ["afm", "ttf"]:
+ for path in [*findSystemFonts(paths, fontext=fontext),
+ *findSystemFonts(fontext=fontext)]:
+ try:
+ self.addfont(path)
+ except OSError as exc:
+ _log.info("Failed to open font file %s: %s", path, exc)
+ except Exception as exc:
+ _log.info("Failed to extract font properties from %s: "
+ "%s", path, exc)
+ finally:
+ timer.cancel()
+
+ def addfont(self, path):
+ """
+ Cache the properties of the font at *path* to make it available to the
+ `FontManager`. The type of font is inferred from the path suffix.
+
+ Parameters
+ ----------
+ path : str or path-like
+ """
+ if Path(path).suffix.lower() == ".afm":
+ with open(path, "rb") as fh:
+ font = afm.AFM(fh)
+ prop = afmFontProperty(path, font)
+ self.afmlist.append(prop)
+ else:
+ font = ft2font.FT2Font(path)
+ prop = ttfFontProperty(font)
+ self.ttflist.append(prop)
+
+ @property
+ def defaultFont(self):
+ # Lazily evaluated (findfont then caches the result) to avoid including
+ # the venv path in the json serialization.
+ return {ext: self.findfont(family, fontext=ext)
+ for ext, family in self.defaultFamily.items()}
+
+ def get_default_weight(self):
+ """
+ Return the default font weight.
+ """
+ return self.__default_weight
+
+ @staticmethod
+ def get_default_size():
+ """
+ Return the default font size.
+ """
+ return rcParams['font.size']
+
+ def set_default_weight(self, weight):
+ """
+ Set the default font weight. The initial value is 'normal'.
+ """
+ self.__default_weight = weight
+
+ @staticmethod
+ def _expand_aliases(family):
+ if family in ('sans', 'sans serif'):
+ family = 'sans-serif'
+ return rcParams['font.' + family]
+
+ # Each of the scoring functions below should return a value between
+ # 0.0 (perfect match) and 1.0 (terrible match)
+ def score_family(self, families, family2):
+ """
+ Return a match score between the list of font families in
+ *families* and the font family name *family2*.
+
+ An exact match at the head of the list returns 0.0.
+
+ A match further down the list will return between 0 and 1.
+
+ No match will return 1.0.
+ """
+ if not isinstance(families, (list, tuple)):
+ families = [families]
+ elif len(families) == 0:
+ return 1.0
+ family2 = family2.lower()
+ step = 1 / len(families)
+ for i, family1 in enumerate(families):
+ family1 = family1.lower()
+ if family1 in font_family_aliases:
+ options = [*map(str.lower, self._expand_aliases(family1))]
+ if family2 in options:
+ idx = options.index(family2)
+ return (i + (idx / len(options))) * step
+ elif family1 == family2:
+ # The score should be weighted by where in the
+ # list the font was found.
+ return i * step
+ return 1.0
+
+ def score_style(self, style1, style2):
+ """
+ Return a match score between *style1* and *style2*.
+
+ An exact match returns 0.0.
+
+ A match between 'italic' and 'oblique' returns 0.1.
+
+ No match returns 1.0.
+ """
+ if style1 == style2:
+ return 0.0
+ elif (style1 in ('italic', 'oblique')
+ and style2 in ('italic', 'oblique')):
+ return 0.1
+ return 1.0
+
+ def score_variant(self, variant1, variant2):
+ """
+ Return a match score between *variant1* and *variant2*.
+
+ An exact match returns 0.0, otherwise 1.0.
+ """
+ if variant1 == variant2:
+ return 0.0
+ else:
+ return 1.0
+
+ def score_stretch(self, stretch1, stretch2):
+ """
+ Return a match score between *stretch1* and *stretch2*.
+
+ The result is the absolute value of the difference between the
+ CSS numeric values of *stretch1* and *stretch2*, normalized
+ between 0.0 and 1.0.
+ """
+ try:
+ stretchval1 = int(stretch1)
+ except ValueError:
+ stretchval1 = stretch_dict.get(stretch1, 500)
+ try:
+ stretchval2 = int(stretch2)
+ except ValueError:
+ stretchval2 = stretch_dict.get(stretch2, 500)
+ return abs(stretchval1 - stretchval2) / 1000.0
+
+ def score_weight(self, weight1, weight2):
+ """
+ Return a match score between *weight1* and *weight2*.
+
+ The result is 0.0 if both weight1 and weight 2 are given as strings
+ and have the same value.
+
+ Otherwise, the result is the absolute value of the difference between
+ the CSS numeric values of *weight1* and *weight2*, normalized between
+ 0.05 and 1.0.
+ """
+ # exact match of the weight names, e.g. weight1 == weight2 == "regular"
+ if cbook._str_equal(weight1, weight2):
+ return 0.0
+ w1 = weight1 if isinstance(weight1, Number) else weight_dict[weight1]
+ w2 = weight2 if isinstance(weight2, Number) else weight_dict[weight2]
+ return 0.95 * (abs(w1 - w2) / 1000) + 0.05
+
+ def score_size(self, size1, size2):
+ """
+ Return a match score between *size1* and *size2*.
+
+ If *size2* (the size specified in the font file) is 'scalable', this
+ function always returns 0.0, since any font size can be generated.
+
+ Otherwise, the result is the absolute distance between *size1* and
+ *size2*, normalized so that the usual range of font sizes (6pt -
+ 72pt) will lie between 0.0 and 1.0.
+ """
+ if size2 == 'scalable':
+ return 0.0
+ # Size value should have already been
+ try:
+ sizeval1 = float(size1)
+ except ValueError:
+ sizeval1 = self.default_size * font_scalings[size1]
+ try:
+ sizeval2 = float(size2)
+ except ValueError:
+ return 1.0
+ return abs(sizeval1 - sizeval2) / 72
+
+ def findfont(self, prop, fontext='ttf', directory=None,
+ fallback_to_default=True, rebuild_if_missing=True):
+ """
+ Find a font that most closely matches the given font properties.
+
+ Parameters
+ ----------
+ prop : str or `~matplotlib.font_manager.FontProperties`
+ The font properties to search for. This can be either a
+ `.FontProperties` object or a string defining a
+ `fontconfig patterns`_.
+
+ fontext : {'ttf', 'afm'}, default: 'ttf'
+ The extension of the font file:
+
+ - 'ttf': TrueType and OpenType fonts (.ttf, .ttc, .otf)
+ - 'afm': Adobe Font Metrics (.afm)
+
+ directory : str, optional
+ If given, only search this directory and its subdirectories.
+
+ fallback_to_default : bool
+ If True, will fallback to the default font family (usually
+ "DejaVu Sans" or "Helvetica") if the first lookup hard-fails.
+
+ rebuild_if_missing : bool
+ Whether to rebuild the font cache and search again if the first
+ match appears to point to a nonexisting font (i.e., the font cache
+ contains outdated entries).
+
+ Returns
+ -------
+ str
+ The filename of the best matching font.
+
+ Notes
+ -----
+ This performs a nearest neighbor search. Each font is given a
+ similarity score to the target font properties. The first font with
+ the highest score is returned. If no matches below a certain
+ threshold are found, the default font (usually DejaVu Sans) is
+ returned.
+
+ The result is cached, so subsequent lookups don't have to
+ perform the O(n) nearest neighbor search.
+
+ See the `W3C Cascading Style Sheet, Level 1
+ `_ documentation
+ for a description of the font finding algorithm.
+
+ .. _fontconfig patterns:
+ https://www.freedesktop.org/software/fontconfig/fontconfig-user.html
+ """
+ # Pass the relevant rcParams (and the font manager, as `self`) to
+ # _findfont_cached so to prevent using a stale cache entry after an
+ # rcParam was changed.
+ rc_params = tuple(tuple(rcParams[key]) for key in [
+ "font.serif", "font.sans-serif", "font.cursive", "font.fantasy",
+ "font.monospace"])
+ return self._findfont_cached(
+ prop, fontext, directory, fallback_to_default, rebuild_if_missing,
+ rc_params)
+
+ @lru_cache()
+ def _findfont_cached(self, prop, fontext, directory, fallback_to_default,
+ rebuild_if_missing, rc_params):
+
+ prop = FontProperties._from_any(prop)
+
+ fname = prop.get_file()
+ if fname is not None:
+ return fname
+
+ if fontext == 'afm':
+ fontlist = self.afmlist
+ else:
+ fontlist = self.ttflist
+
+ best_score = 1e64
+ best_font = None
+
+ _log.debug('findfont: Matching %s.', prop)
+ for font in fontlist:
+ if (directory is not None and
+ Path(directory) not in Path(font.fname).parents):
+ continue
+ # Matching family should have top priority, so multiply it by 10.
+ score = (self.score_family(prop.get_family(), font.name) * 10
+ + self.score_style(prop.get_style(), font.style)
+ + self.score_variant(prop.get_variant(), font.variant)
+ + self.score_weight(prop.get_weight(), font.weight)
+ + self.score_stretch(prop.get_stretch(), font.stretch)
+ + self.score_size(prop.get_size(), font.size))
+ _log.debug('findfont: score(%s) = %s', font, score)
+ if score < best_score:
+ best_score = score
+ best_font = font
+ if score == 0:
+ break
+
+ if best_font is None or best_score >= 10.0:
+ if fallback_to_default:
+ _log.warning(
+ 'findfont: Font family %s not found. Falling back to %s.',
+ prop.get_family(), self.defaultFamily[fontext])
+ for family in map(str.lower, prop.get_family()):
+ if family in font_family_aliases:
+ _log.warning(
+ "findfont: Generic family %r not found because "
+ "none of the following families were found: %s",
+ family, ", ".join(self._expand_aliases(family)))
+ default_prop = prop.copy()
+ default_prop.set_family(self.defaultFamily[fontext])
+ return self.findfont(default_prop, fontext, directory,
+ fallback_to_default=False)
+ else:
+ raise ValueError(f"Failed to find font {prop}, and fallback "
+ f"to the default font was disabled")
+ else:
+ _log.debug('findfont: Matching %s to %s (%r) with score of %f.',
+ prop, best_font.name, best_font.fname, best_score)
+ result = best_font.fname
+
+ if not os.path.isfile(result):
+ if rebuild_if_missing:
+ _log.info(
+ 'findfont: Found a missing font file. Rebuilding cache.')
+ new_fm = _load_fontmanager(try_read_cache=False)
+ # Replace self by the new fontmanager, because users may have
+ # a reference to this specific instance.
+ # TODO: _load_fontmanager should really be (used by) a method
+ # modifying the instance in place.
+ vars(self).update(vars(new_fm))
+ return self.findfont(
+ prop, fontext, directory, rebuild_if_missing=False)
+ else:
+ raise ValueError("No valid font could be found")
+
+ return _cached_realpath(result)
+
+
+@lru_cache()
+def is_opentype_cff_font(filename):
+ """
+ Return whether the given font is a Postscript Compact Font Format Font
+ embedded in an OpenType wrapper. Used by the PostScript and PDF backends
+ that can not subset these fonts.
+ """
+ if os.path.splitext(filename)[1].lower() == '.otf':
+ with open(filename, 'rb') as fd:
+ return fd.read(4) == b"OTTO"
+ else:
+ return False
+
+
+@lru_cache(64)
+def _get_font(filename, hinting_factor, *, _kerning_factor, thread_id):
+ return ft2font.FT2Font(
+ filename, hinting_factor, _kerning_factor=_kerning_factor)
+
+
+# FT2Font objects cannot be used across fork()s because they reference the same
+# FT_Library object. While invalidating *all* existing FT2Fonts after a fork
+# would be too complicated to be worth it, the main way FT2Fonts get reused is
+# via the cache of _get_font, which we can empty upon forking (in Py3.7+).
+if hasattr(os, "register_at_fork"):
+ os.register_at_fork(after_in_child=_get_font.cache_clear)
+
+
+def get_font(filename, hinting_factor=None):
+ # Resolving the path avoids embedding the font twice in pdf/ps output if a
+ # single font is selected using two different relative paths.
+ filename = _cached_realpath(filename)
+ if hinting_factor is None:
+ hinting_factor = rcParams['text.hinting_factor']
+ # also key on the thread ID to prevent segfaults with multi-threading
+ return _get_font(filename, hinting_factor,
+ _kerning_factor=rcParams['text.kerning_factor'],
+ thread_id=threading.get_ident())
+
+
+def _load_fontmanager(*, try_read_cache=True):
+ fm_path = Path(
+ mpl.get_cachedir(), f"fontlist-v{FontManager.__version__}.json")
+ if try_read_cache:
+ try:
+ fm = json_load(fm_path)
+ except Exception as exc:
+ pass
+ else:
+ if getattr(fm, "_version", object()) == FontManager.__version__:
+ _log.debug("Using fontManager instance from %s", fm_path)
+ return fm
+ fm = FontManager()
+ json_dump(fm, fm_path)
+ _log.info("generated new fontManager")
+ return fm
+
+
+fontManager = _load_fontmanager()
+findfont = fontManager.findfont
diff --git a/venv/Lib/site-packages/matplotlib/fontconfig_pattern.py b/venv/Lib/site-packages/matplotlib/fontconfig_pattern.py
new file mode 100644
index 0000000..c47e19b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/fontconfig_pattern.py
@@ -0,0 +1,209 @@
+"""
+A module for parsing and generating `fontconfig patterns`_.
+
+.. _fontconfig patterns:
+ https://www.freedesktop.org/software/fontconfig/fontconfig-user.html
+"""
+
+# This class logically belongs in `matplotlib.font_manager`, but placing it
+# there would have created cyclical dependency problems, because it also needs
+# to be available from `matplotlib.rcsetup` (for parsing matplotlibrc files).
+
+from functools import lru_cache
+import re
+import numpy as np
+from pyparsing import (Literal, ZeroOrMore, Optional, Regex, StringEnd,
+ ParseException, Suppress)
+
+family_punc = r'\\\-:,'
+family_unescape = re.compile(r'\\([%s])' % family_punc).sub
+family_escape = re.compile(r'([%s])' % family_punc).sub
+
+value_punc = r'\\=_:,'
+value_unescape = re.compile(r'\\([%s])' % value_punc).sub
+value_escape = re.compile(r'([%s])' % value_punc).sub
+
+
+class FontconfigPatternParser:
+ """
+ A simple pyparsing-based parser for `fontconfig patterns`_.
+
+ .. _fontconfig patterns:
+ https://www.freedesktop.org/software/fontconfig/fontconfig-user.html
+ """
+
+ _constants = {
+ 'thin': ('weight', 'light'),
+ 'extralight': ('weight', 'light'),
+ 'ultralight': ('weight', 'light'),
+ 'light': ('weight', 'light'),
+ 'book': ('weight', 'book'),
+ 'regular': ('weight', 'regular'),
+ 'normal': ('weight', 'normal'),
+ 'medium': ('weight', 'medium'),
+ 'demibold': ('weight', 'demibold'),
+ 'semibold': ('weight', 'semibold'),
+ 'bold': ('weight', 'bold'),
+ 'extrabold': ('weight', 'extra bold'),
+ 'black': ('weight', 'black'),
+ 'heavy': ('weight', 'heavy'),
+ 'roman': ('slant', 'normal'),
+ 'italic': ('slant', 'italic'),
+ 'oblique': ('slant', 'oblique'),
+ 'ultracondensed': ('width', 'ultra-condensed'),
+ 'extracondensed': ('width', 'extra-condensed'),
+ 'condensed': ('width', 'condensed'),
+ 'semicondensed': ('width', 'semi-condensed'),
+ 'expanded': ('width', 'expanded'),
+ 'extraexpanded': ('width', 'extra-expanded'),
+ 'ultraexpanded': ('width', 'ultra-expanded')
+ }
+
+ def __init__(self):
+
+ family = Regex(
+ r'([^%s]|(\\[%s]))*' % (family_punc, family_punc)
+ ).setParseAction(self._family)
+
+ size = Regex(
+ r"([0-9]+\.?[0-9]*|\.[0-9]+)"
+ ).setParseAction(self._size)
+
+ name = Regex(
+ r'[a-z]+'
+ ).setParseAction(self._name)
+
+ value = Regex(
+ r'([^%s]|(\\[%s]))*' % (value_punc, value_punc)
+ ).setParseAction(self._value)
+
+ families = (
+ family
+ + ZeroOrMore(
+ Literal(',')
+ + family)
+ ).setParseAction(self._families)
+
+ point_sizes = (
+ size
+ + ZeroOrMore(
+ Literal(',')
+ + size)
+ ).setParseAction(self._point_sizes)
+
+ property = (
+ (name
+ + Suppress(Literal('='))
+ + value
+ + ZeroOrMore(
+ Suppress(Literal(','))
+ + value))
+ | name
+ ).setParseAction(self._property)
+
+ pattern = (
+ Optional(
+ families)
+ + Optional(
+ Literal('-')
+ + point_sizes)
+ + ZeroOrMore(
+ Literal(':')
+ + property)
+ + StringEnd()
+ )
+
+ self._parser = pattern
+ self.ParseException = ParseException
+
+ def parse(self, pattern):
+ """
+ Parse the given fontconfig *pattern* and return a dictionary
+ of key/value pairs useful for initializing a
+ `.font_manager.FontProperties` object.
+ """
+ props = self._properties = {}
+ try:
+ self._parser.parseString(pattern)
+ except self.ParseException as e:
+ raise ValueError(
+ "Could not parse font string: '%s'\n%s" % (pattern, e)) from e
+
+ self._properties = None
+
+ self._parser.resetCache()
+
+ return props
+
+ def _family(self, s, loc, tokens):
+ return [family_unescape(r'\1', str(tokens[0]))]
+
+ def _size(self, s, loc, tokens):
+ return [float(tokens[0])]
+
+ def _name(self, s, loc, tokens):
+ return [str(tokens[0])]
+
+ def _value(self, s, loc, tokens):
+ return [value_unescape(r'\1', str(tokens[0]))]
+
+ def _families(self, s, loc, tokens):
+ self._properties['family'] = [str(x) for x in tokens]
+ return []
+
+ def _point_sizes(self, s, loc, tokens):
+ self._properties['size'] = [str(x) for x in tokens]
+ return []
+
+ def _property(self, s, loc, tokens):
+ if len(tokens) == 1:
+ if tokens[0] in self._constants:
+ key, val = self._constants[tokens[0]]
+ self._properties.setdefault(key, []).append(val)
+ else:
+ key = tokens[0]
+ val = tokens[1:]
+ self._properties.setdefault(key, []).extend(val)
+ return []
+
+
+# `parse_fontconfig_pattern` is a bottleneck during the tests because it is
+# repeatedly called when the rcParams are reset (to validate the default
+# fonts). In practice, the cache size doesn't grow beyond a few dozen entries
+# during the test suite.
+parse_fontconfig_pattern = lru_cache()(FontconfigPatternParser().parse)
+
+
+def _escape_val(val, escape_func):
+ """
+ Given a string value or a list of string values, run each value through
+ the input escape function to make the values into legal font config
+ strings. The result is returned as a string.
+ """
+ if not np.iterable(val) or isinstance(val, str):
+ val = [val]
+
+ return ','.join(escape_func(r'\\\1', str(x)) for x in val
+ if x is not None)
+
+
+def generate_fontconfig_pattern(d):
+ """
+ Given a dictionary of key/value pairs, generates a fontconfig
+ pattern string.
+ """
+ props = []
+
+ # Family is added first w/o a keyword
+ family = d.get_family()
+ if family is not None and family != []:
+ props.append(_escape_val(family, family_escape))
+
+ # The other keys are added as key=value
+ for key in ['style', 'variant', 'weight', 'stretch', 'file', 'size']:
+ val = getattr(d, 'get_' + key)()
+ # Don't use 'if not val' because 0 is a valid input.
+ if val is not None and val != []:
+ props.append(":%s=%s" % (key, _escape_val(val, value_escape)))
+
+ return ''.join(props)
diff --git a/venv/Lib/site-packages/matplotlib/ft2font.cp38-win_amd64.pyd b/venv/Lib/site-packages/matplotlib/ft2font.cp38-win_amd64.pyd
new file mode 100644
index 0000000..f5eeb74
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/ft2font.cp38-win_amd64.pyd differ
diff --git a/venv/Lib/site-packages/matplotlib/gridspec.py b/venv/Lib/site-packages/matplotlib/gridspec.py
new file mode 100644
index 0000000..973d3d6
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/gridspec.py
@@ -0,0 +1,818 @@
+r"""
+:mod:`~matplotlib.gridspec` contains classes that help to layout multiple
+`~.axes.Axes` in a grid-like pattern within a figure.
+
+The `GridSpec` specifies the overall grid structure. Individual cells within
+the grid are referenced by `SubplotSpec`\s.
+
+See the tutorial :doc:`/tutorials/intermediate/gridspec` for a comprehensive
+usage guide.
+"""
+
+import copy
+import logging
+from numbers import Integral
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib import _api, _pylab_helpers, tight_layout, rcParams
+from matplotlib.transforms import Bbox
+import matplotlib._layoutgrid as layoutgrid
+
+
+_log = logging.getLogger(__name__)
+
+
+class GridSpecBase:
+ """
+ A base class of GridSpec that specifies the geometry of the grid
+ that a subplot will be placed.
+ """
+
+ def __init__(self, nrows, ncols, height_ratios=None, width_ratios=None):
+ """
+ Parameters
+ ----------
+ nrows, ncols : int
+ The number of rows and columns of the grid.
+ width_ratios : array-like of length *ncols*, optional
+ Defines the relative widths of the columns. Each column gets a
+ relative width of ``width_ratios[i] / sum(width_ratios)``.
+ If not given, all columns will have the same width.
+ height_ratios : array-like of length *nrows*, optional
+ Defines the relative heights of the rows. Each column gets a
+ relative height of ``height_ratios[i] / sum(height_ratios)``.
+ If not given, all rows will have the same height.
+ """
+ if not isinstance(nrows, Integral) or nrows <= 0:
+ raise ValueError(
+ f"Number of rows must be a positive integer, not {nrows}")
+ if not isinstance(ncols, Integral) or ncols <= 0:
+ raise ValueError(
+ f"Number of columns must be a positive integer, not {ncols}")
+ self._nrows, self._ncols = nrows, ncols
+ self.set_height_ratios(height_ratios)
+ self.set_width_ratios(width_ratios)
+
+ def __repr__(self):
+ height_arg = (', height_ratios=%r' % (self._row_height_ratios,)
+ if len(set(self._row_height_ratios)) != 1 else '')
+ width_arg = (', width_ratios=%r' % (self._col_width_ratios,)
+ if len(set(self._col_width_ratios)) != 1 else '')
+ return '{clsname}({nrows}, {ncols}{optionals})'.format(
+ clsname=self.__class__.__name__,
+ nrows=self._nrows,
+ ncols=self._ncols,
+ optionals=height_arg + width_arg,
+ )
+
+ nrows = property(lambda self: self._nrows,
+ doc="The number of rows in the grid.")
+ ncols = property(lambda self: self._ncols,
+ doc="The number of columns in the grid.")
+
+ def get_geometry(self):
+ """
+ Return a tuple containing the number of rows and columns in the grid.
+ """
+ return self._nrows, self._ncols
+
+ def get_subplot_params(self, figure=None):
+ # Must be implemented in subclasses
+ pass
+
+ def new_subplotspec(self, loc, rowspan=1, colspan=1):
+ """
+ Create and return a `.SubplotSpec` instance.
+
+ Parameters
+ ----------
+ loc : (int, int)
+ The position of the subplot in the grid as
+ ``(row_index, column_index)``.
+ rowspan, colspan : int, default: 1
+ The number of rows and columns the subplot should span in the grid.
+ """
+ loc1, loc2 = loc
+ subplotspec = self[loc1:loc1+rowspan, loc2:loc2+colspan]
+ return subplotspec
+
+ def set_width_ratios(self, width_ratios):
+ """
+ Set the relative widths of the columns.
+
+ *width_ratios* must be of length *ncols*. Each column gets a relative
+ width of ``width_ratios[i] / sum(width_ratios)``.
+ """
+ if width_ratios is None:
+ width_ratios = [1] * self._ncols
+ elif len(width_ratios) != self._ncols:
+ raise ValueError('Expected the given number of width ratios to '
+ 'match the number of columns of the grid')
+ self._col_width_ratios = width_ratios
+
+ def get_width_ratios(self):
+ """
+ Return the width ratios.
+
+ This is *None* if no width ratios have been set explicitly.
+ """
+ return self._col_width_ratios
+
+ def set_height_ratios(self, height_ratios):
+ """
+ Set the relative heights of the rows.
+
+ *height_ratios* must be of length *nrows*. Each row gets a relative
+ height of ``height_ratios[i] / sum(height_ratios)``.
+ """
+ if height_ratios is None:
+ height_ratios = [1] * self._nrows
+ elif len(height_ratios) != self._nrows:
+ raise ValueError('Expected the given number of height ratios to '
+ 'match the number of rows of the grid')
+ self._row_height_ratios = height_ratios
+
+ def get_height_ratios(self):
+ """
+ Return the height ratios.
+
+ This is *None* if no height ratios have been set explicitly.
+ """
+ return self._row_height_ratios
+
+ def get_grid_positions(self, fig, raw=False):
+ """
+ Return the positions of the grid cells in figure coordinates.
+
+ Parameters
+ ----------
+ fig : `~matplotlib.figure.Figure`
+ The figure the grid should be applied to. The subplot parameters
+ (margins and spacing between subplots) are taken from *fig*.
+ raw : bool, default: False
+ If *True*, the subplot parameters of the figure are not taken
+ into account. The grid spans the range [0, 1] in both directions
+ without margins and there is no space between grid cells. This is
+ used for constrained_layout.
+
+ Returns
+ -------
+ bottoms, tops, lefts, rights : array
+ The bottom, top, left, right positions of the grid cells in
+ figure coordinates.
+ """
+ nrows, ncols = self.get_geometry()
+
+ if raw:
+ left = 0.
+ right = 1.
+ bottom = 0.
+ top = 1.
+ wspace = 0.
+ hspace = 0.
+ else:
+ subplot_params = self.get_subplot_params(fig)
+ left = subplot_params.left
+ right = subplot_params.right
+ bottom = subplot_params.bottom
+ top = subplot_params.top
+ wspace = subplot_params.wspace
+ hspace = subplot_params.hspace
+ tot_width = right - left
+ tot_height = top - bottom
+
+ # calculate accumulated heights of columns
+ cell_h = tot_height / (nrows + hspace*(nrows-1))
+ sep_h = hspace * cell_h
+ norm = cell_h * nrows / sum(self._row_height_ratios)
+ cell_heights = [r * norm for r in self._row_height_ratios]
+ sep_heights = [0] + ([sep_h] * (nrows-1))
+ cell_hs = np.cumsum(np.column_stack([sep_heights, cell_heights]).flat)
+
+ # calculate accumulated widths of rows
+ cell_w = tot_width / (ncols + wspace*(ncols-1))
+ sep_w = wspace * cell_w
+ norm = cell_w * ncols / sum(self._col_width_ratios)
+ cell_widths = [r * norm for r in self._col_width_ratios]
+ sep_widths = [0] + ([sep_w] * (ncols-1))
+ cell_ws = np.cumsum(np.column_stack([sep_widths, cell_widths]).flat)
+
+ fig_tops, fig_bottoms = (top - cell_hs).reshape((-1, 2)).T
+ fig_lefts, fig_rights = (left + cell_ws).reshape((-1, 2)).T
+ return fig_bottoms, fig_tops, fig_lefts, fig_rights
+
+ @staticmethod
+ def _check_gridspec_exists(figure, nrows, ncols):
+ """
+ Check if the figure already has a gridspec with these dimensions,
+ or create a new one
+ """
+ for ax in figure.get_axes():
+ if hasattr(ax, 'get_subplotspec'):
+ gs = ax.get_subplotspec().get_gridspec()
+ if hasattr(gs, 'get_topmost_subplotspec'):
+ # This is needed for colorbar gridspec layouts.
+ # This is probably OK because this whole logic tree
+ # is for when the user is doing simple things with the
+ # add_subplot command. For complicated layouts
+ # like subgridspecs the proper gridspec is passed in...
+ gs = gs.get_topmost_subplotspec().get_gridspec()
+ if gs.get_geometry() == (nrows, ncols):
+ return gs
+ # else gridspec not found:
+ return GridSpec(nrows, ncols, figure=figure)
+
+ def __getitem__(self, key):
+ """Create and return a `.SubplotSpec` instance."""
+ nrows, ncols = self.get_geometry()
+
+ def _normalize(key, size, axis): # Includes last index.
+ orig_key = key
+ if isinstance(key, slice):
+ start, stop, _ = key.indices(size)
+ if stop > start:
+ return start, stop - 1
+ raise IndexError("GridSpec slice would result in no space "
+ "allocated for subplot")
+ else:
+ if key < 0:
+ key = key + size
+ if 0 <= key < size:
+ return key, key
+ elif axis is not None:
+ raise IndexError(f"index {orig_key} is out of bounds for "
+ f"axis {axis} with size {size}")
+ else: # flat index
+ raise IndexError(f"index {orig_key} is out of bounds for "
+ f"GridSpec with size {size}")
+
+ if isinstance(key, tuple):
+ try:
+ k1, k2 = key
+ except ValueError as err:
+ raise ValueError("Unrecognized subplot spec") from err
+ num1, num2 = np.ravel_multi_index(
+ [_normalize(k1, nrows, 0), _normalize(k2, ncols, 1)],
+ (nrows, ncols))
+ else: # Single key
+ num1, num2 = _normalize(key, nrows * ncols, None)
+
+ return SubplotSpec(self, num1, num2)
+
+ def subplots(self, *, sharex=False, sharey=False, squeeze=True,
+ subplot_kw=None):
+ """
+ Add all subplots specified by this `GridSpec` to its parent figure.
+
+ See `.Figure.subplots` for detailed documentation.
+ """
+
+ figure = self.figure
+
+ if figure is None:
+ raise ValueError("GridSpec.subplots() only works for GridSpecs "
+ "created with a parent figure")
+
+ if isinstance(sharex, bool):
+ sharex = "all" if sharex else "none"
+ if isinstance(sharey, bool):
+ sharey = "all" if sharey else "none"
+ # This check was added because it is very easy to type
+ # `subplots(1, 2, 1)` when `subplot(1, 2, 1)` was intended.
+ # In most cases, no error will ever occur, but mysterious behavior
+ # will result because what was intended to be the subplot index is
+ # instead treated as a bool for sharex. This check should go away
+ # once sharex becomes kwonly.
+ if isinstance(sharex, Integral):
+ _api.warn_external(
+ "sharex argument to subplots() was an integer. Did you "
+ "intend to use subplot() (without 's')?")
+ _api.check_in_list(["all", "row", "col", "none"],
+ sharex=sharex, sharey=sharey)
+ if subplot_kw is None:
+ subplot_kw = {}
+ # don't mutate kwargs passed by user...
+ subplot_kw = subplot_kw.copy()
+
+ # Create array to hold all axes.
+ axarr = np.empty((self._nrows, self._ncols), dtype=object)
+ for row in range(self._nrows):
+ for col in range(self._ncols):
+ shared_with = {"none": None, "all": axarr[0, 0],
+ "row": axarr[row, 0], "col": axarr[0, col]}
+ subplot_kw["sharex"] = shared_with[sharex]
+ subplot_kw["sharey"] = shared_with[sharey]
+ axarr[row, col] = figure.add_subplot(
+ self[row, col], **subplot_kw)
+
+ # turn off redundant tick labeling
+ if sharex in ["col", "all"]:
+ for ax in axarr[:-1, :].flat: # Remove bottom labels/offsettexts.
+ ax.xaxis.set_tick_params(which="both", labelbottom=False)
+ if ax.xaxis.offsetText.get_position()[1] == 0:
+ ax.xaxis.offsetText.set_visible(False)
+ for ax in axarr[1:, :].flat: # Remove top labels/offsettexts.
+ ax.xaxis.set_tick_params(which="both", labeltop=False)
+ if ax.xaxis.offsetText.get_position()[1] == 1:
+ ax.xaxis.offsetText.set_visible(False)
+ if sharey in ["row", "all"]:
+ for ax in axarr[:, 1:].flat: # Remove left labels/offsettexts.
+ ax.yaxis.set_tick_params(which="both", labelleft=False)
+ if ax.yaxis.offsetText.get_position()[0] == 0:
+ ax.yaxis.offsetText.set_visible(False)
+ for ax in axarr[:, :-1].flat: # Remove right labels/offsettexts.
+ ax.yaxis.set_tick_params(which="both", labelright=False)
+ if ax.yaxis.offsetText.get_position()[0] == 1:
+ ax.yaxis.offsetText.set_visible(False)
+
+ if squeeze:
+ # Discarding unneeded dimensions that equal 1. If we only have one
+ # subplot, just return it instead of a 1-element array.
+ return axarr.item() if axarr.size == 1 else axarr.squeeze()
+ else:
+ # Returned axis array will be always 2-d, even if nrows=ncols=1.
+ return axarr
+
+
+class GridSpec(GridSpecBase):
+ """
+ A grid layout to place subplots within a figure.
+
+ The location of the grid cells is determined in a similar way to
+ `~.figure.SubplotParams` using *left*, *right*, *top*, *bottom*, *wspace*
+ and *hspace*.
+ """
+ def __init__(self, nrows, ncols, figure=None,
+ left=None, bottom=None, right=None, top=None,
+ wspace=None, hspace=None,
+ width_ratios=None, height_ratios=None):
+ """
+ Parameters
+ ----------
+ nrows, ncols : int
+ The number of rows and columns of the grid.
+
+ figure : `~.figure.Figure`, optional
+ Only used for constrained layout to create a proper layoutgrid.
+
+ left, right, top, bottom : float, optional
+ Extent of the subplots as a fraction of figure width or height.
+ Left cannot be larger than right, and bottom cannot be larger than
+ top. If not given, the values will be inferred from a figure or
+ rcParams at draw time. See also `GridSpec.get_subplot_params`.
+
+ wspace : float, optional
+ The amount of width reserved for space between subplots,
+ expressed as a fraction of the average axis width.
+ If not given, the values will be inferred from a figure or
+ rcParams when necessary. See also `GridSpec.get_subplot_params`.
+
+ hspace : float, optional
+ The amount of height reserved for space between subplots,
+ expressed as a fraction of the average axis height.
+ If not given, the values will be inferred from a figure or
+ rcParams when necessary. See also `GridSpec.get_subplot_params`.
+
+ width_ratios : array-like of length *ncols*, optional
+ Defines the relative widths of the columns. Each column gets a
+ relative width of ``width_ratios[i] / sum(width_ratios)``.
+ If not given, all columns will have the same width.
+
+ height_ratios : array-like of length *nrows*, optional
+ Defines the relative heights of the rows. Each column gets a
+ relative height of ``height_ratios[i] / sum(height_ratios)``.
+ If not given, all rows will have the same height.
+
+ """
+ self.left = left
+ self.bottom = bottom
+ self.right = right
+ self.top = top
+ self.wspace = wspace
+ self.hspace = hspace
+ self.figure = figure
+
+ super().__init__(nrows, ncols,
+ width_ratios=width_ratios,
+ height_ratios=height_ratios)
+
+ # set up layoutgrid for constrained_layout:
+ self._layoutgrid = None
+ if self.figure is None or not self.figure.get_constrained_layout():
+ self._layoutgrid = None
+ else:
+ self._toplayoutbox = self.figure._layoutgrid
+ self._layoutgrid = layoutgrid.LayoutGrid(
+ parent=self.figure._layoutgrid,
+ parent_inner=True,
+ name=(self.figure._layoutgrid.name + '.gridspec' +
+ layoutgrid.seq_id()),
+ ncols=ncols, nrows=nrows, width_ratios=width_ratios,
+ height_ratios=height_ratios)
+
+ _AllowedKeys = ["left", "bottom", "right", "top", "wspace", "hspace"]
+
+ def __getstate__(self):
+ return {**self.__dict__, "_layoutgrid": None}
+
+ def update(self, **kwargs):
+ """
+ Update the subplot parameters of the grid.
+
+ Parameters that are not explicitly given are not changed. Setting a
+ parameter to *None* resets it to :rc:`figure.subplot.*`.
+
+ Parameters
+ ----------
+ left, right, top, bottom : float or None, optional
+ Extent of the subplots as a fraction of figure width or height.
+ wspace, hspace : float, optional
+ Spacing between the subplots as a fraction of the average subplot
+ width / height.
+ """
+ for k, v in kwargs.items():
+ if k in self._AllowedKeys:
+ setattr(self, k, v)
+ else:
+ raise AttributeError(f"{k} is an unknown keyword")
+ for figmanager in _pylab_helpers.Gcf.figs.values():
+ for ax in figmanager.canvas.figure.axes:
+ if isinstance(ax, mpl.axes.SubplotBase):
+ ss = ax.get_subplotspec().get_topmost_subplotspec()
+ if ss.get_gridspec() == self:
+ ax._set_position(
+ ax.get_subplotspec().get_position(ax.figure))
+
+ def get_subplot_params(self, figure=None):
+ """
+ Return the `~.SubplotParams` for the GridSpec.
+
+ In order of precedence the values are taken from
+
+ - non-*None* attributes of the GridSpec
+ - the provided *figure*
+ - :rc:`figure.subplot.*`
+ """
+ if figure is None:
+ kw = {k: rcParams["figure.subplot."+k] for k in self._AllowedKeys}
+ subplotpars = mpl.figure.SubplotParams(**kw)
+ else:
+ subplotpars = copy.copy(figure.subplotpars)
+
+ subplotpars.update(**{k: getattr(self, k) for k in self._AllowedKeys})
+
+ return subplotpars
+
+ def locally_modified_subplot_params(self):
+ """
+ Return a list of the names of the subplot parameters explicitly set
+ in the GridSpec.
+
+ This is a subset of the attributes of `.SubplotParams`.
+ """
+ return [k for k in self._AllowedKeys if getattr(self, k)]
+
+ def tight_layout(self, figure, renderer=None,
+ pad=1.08, h_pad=None, w_pad=None, rect=None):
+ """
+ Adjust subplot parameters to give specified padding.
+
+ Parameters
+ ----------
+ pad : float
+ Padding between the figure edge and the edges of subplots, as a
+ fraction of the font-size.
+ h_pad, w_pad : float, optional
+ Padding (height/width) between edges of adjacent subplots.
+ Defaults to *pad*.
+ rect : tuple of 4 floats, default: (0, 0, 1, 1), i.e. the whole figure
+ (left, bottom, right, top) rectangle in normalized figure
+ coordinates that the whole subplots area (including labels) will
+ fit into.
+ """
+
+ subplotspec_list = tight_layout.get_subplotspec_list(
+ figure.axes, grid_spec=self)
+ if None in subplotspec_list:
+ _api.warn_external("This figure includes Axes that are not "
+ "compatible with tight_layout, so results "
+ "might be incorrect.")
+
+ if renderer is None:
+ renderer = tight_layout.get_renderer(figure)
+
+ kwargs = tight_layout.get_tight_layout_figure(
+ figure, figure.axes, subplotspec_list, renderer,
+ pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
+ if kwargs:
+ self.update(**kwargs)
+
+
+class GridSpecFromSubplotSpec(GridSpecBase):
+ """
+ GridSpec whose subplot layout parameters are inherited from the
+ location specified by a given SubplotSpec.
+ """
+ def __init__(self, nrows, ncols,
+ subplot_spec,
+ wspace=None, hspace=None,
+ height_ratios=None, width_ratios=None):
+ """
+ The number of rows and number of columns of the grid need to
+ be set. An instance of SubplotSpec is also needed to be set
+ from which the layout parameters will be inherited. The wspace
+ and hspace of the layout can be optionally specified or the
+ default values (from the figure or rcParams) will be used.
+ """
+ self._wspace = wspace
+ self._hspace = hspace
+ self._subplot_spec = subplot_spec
+ self.figure = self._subplot_spec.get_gridspec().figure
+ super().__init__(nrows, ncols,
+ width_ratios=width_ratios,
+ height_ratios=height_ratios)
+ # do the layoutgrids for constrained_layout:
+ subspeclb = subplot_spec.get_gridspec()._layoutgrid
+ if subspeclb is None:
+ self._layoutgrid = None
+ else:
+ # this _toplayoutbox is a container that spans the cols and
+ # rows in the parent gridspec. Not yet implemented,
+ # but we do this so that it is possible to have subgridspec
+ # level artists.
+ self._toplayoutgrid = layoutgrid.LayoutGrid(
+ parent=subspeclb,
+ name=subspeclb.name + '.top' + layoutgrid.seq_id(),
+ nrows=1, ncols=1,
+ parent_pos=(subplot_spec.rowspan, subplot_spec.colspan))
+ self._layoutgrid = layoutgrid.LayoutGrid(
+ parent=self._toplayoutgrid,
+ name=(self._toplayoutgrid.name + '.gridspec' +
+ layoutgrid.seq_id()),
+ nrows=nrows, ncols=ncols,
+ width_ratios=width_ratios, height_ratios=height_ratios)
+
+ def get_subplot_params(self, figure=None):
+ """Return a dictionary of subplot layout parameters."""
+ hspace = (self._hspace if self._hspace is not None
+ else figure.subplotpars.hspace if figure is not None
+ else rcParams["figure.subplot.hspace"])
+ wspace = (self._wspace if self._wspace is not None
+ else figure.subplotpars.wspace if figure is not None
+ else rcParams["figure.subplot.wspace"])
+
+ figbox = self._subplot_spec.get_position(figure)
+ left, bottom, right, top = figbox.extents
+
+ return mpl.figure.SubplotParams(left=left, right=right,
+ bottom=bottom, top=top,
+ wspace=wspace, hspace=hspace)
+
+ def get_topmost_subplotspec(self):
+ """
+ Return the topmost `.SubplotSpec` instance associated with the subplot.
+ """
+ return self._subplot_spec.get_topmost_subplotspec()
+
+
+class SubplotSpec:
+ """
+ Specifies the location of a subplot in a `GridSpec`.
+
+ .. note::
+
+ Likely, you'll never instantiate a `SubplotSpec` yourself. Instead you
+ will typically obtain one from a `GridSpec` using item-access.
+
+ Parameters
+ ----------
+ gridspec : `~matplotlib.gridspec.GridSpec`
+ The GridSpec, which the subplot is referencing.
+ num1, num2 : int
+ The subplot will occupy the num1-th cell of the given
+ gridspec. If num2 is provided, the subplot will span between
+ num1-th cell and num2-th cell *inclusive*.
+
+ The index starts from 0.
+ """
+ def __init__(self, gridspec, num1, num2=None):
+ self._gridspec = gridspec
+ self.num1 = num1
+ self.num2 = num2
+
+ def __repr__(self):
+ return (f"{self.get_gridspec()}["
+ f"{self.rowspan.start}:{self.rowspan.stop}, "
+ f"{self.colspan.start}:{self.colspan.stop}]")
+
+ @staticmethod
+ def _from_subplot_args(figure, args):
+ """
+ Construct a `.SubplotSpec` from a parent `.Figure` and either
+
+ - a `.SubplotSpec` -- returned as is;
+ - one or three numbers -- a MATLAB-style subplot specifier.
+ """
+ message = ("Passing non-integers as three-element position "
+ "specification is deprecated since %(since)s and will be "
+ "removed %(removal)s.")
+ if len(args) == 1:
+ arg, = args
+ if isinstance(arg, SubplotSpec):
+ return arg
+ else:
+ if not isinstance(arg, Integral):
+ _api.warn_deprecated("3.3", message=message)
+ arg = str(arg)
+ try:
+ rows, cols, num = map(int, str(arg))
+ except ValueError:
+ raise ValueError(
+ f"Single argument to subplot must be a three-digit "
+ f"integer, not {arg}") from None
+ i = j = num
+ elif len(args) == 3:
+ rows, cols, num = args
+ if not (isinstance(rows, Integral) and isinstance(cols, Integral)):
+ _api.warn_deprecated("3.3", message=message)
+ rows, cols = map(int, [rows, cols])
+ gs = GridSpec(rows, cols, figure=figure)
+ if isinstance(num, tuple) and len(num) == 2:
+ if not all(isinstance(n, Integral) for n in num):
+ _api.warn_deprecated("3.3", message=message)
+ i, j = map(int, num)
+ else:
+ i, j = num
+ else:
+ if not isinstance(num, Integral):
+ _api.warn_deprecated("3.3", message=message)
+ num = int(num)
+ if num < 1 or num > rows*cols:
+ raise ValueError(
+ f"num must be 1 <= num <= {rows*cols}, not {num}")
+ i = j = num
+ else:
+ raise TypeError(f"subplot() takes 1 or 3 positional arguments but "
+ f"{len(args)} were given")
+
+ gs = GridSpec._check_gridspec_exists(figure, rows, cols)
+ if gs is None:
+ gs = GridSpec(rows, cols, figure=figure)
+ return gs[i-1:j]
+
+ # num2 is a property only to handle the case where it is None and someone
+ # mutates num1.
+
+ @property
+ def num2(self):
+ return self.num1 if self._num2 is None else self._num2
+
+ @num2.setter
+ def num2(self, value):
+ self._num2 = value
+
+ def __getstate__(self):
+ return {**self.__dict__}
+
+ def get_gridspec(self):
+ return self._gridspec
+
+ def get_geometry(self):
+ """
+ Return the subplot geometry as tuple ``(n_rows, n_cols, start, stop)``.
+
+ The indices *start* and *stop* define the range of the subplot within
+ the `GridSpec`. *stop* is inclusive (i.e. for a single cell
+ ``start == stop``).
+ """
+ rows, cols = self.get_gridspec().get_geometry()
+ return rows, cols, self.num1, self.num2
+
+ @_api.deprecated("3.3", alternative="rowspan, colspan")
+ def get_rows_columns(self):
+ """
+ Return the subplot row and column numbers as a tuple
+ ``(n_rows, n_cols, row_start, row_stop, col_start, col_stop)``.
+ """
+ gridspec = self.get_gridspec()
+ nrows, ncols = gridspec.get_geometry()
+ row_start, col_start = divmod(self.num1, ncols)
+ row_stop, col_stop = divmod(self.num2, ncols)
+ return nrows, ncols, row_start, row_stop, col_start, col_stop
+
+ @property
+ def rowspan(self):
+ """The rows spanned by this subplot, as a `range` object."""
+ ncols = self.get_gridspec().ncols
+ return range(self.num1 // ncols, self.num2 // ncols + 1)
+
+ @property
+ def colspan(self):
+ """The columns spanned by this subplot, as a `range` object."""
+ ncols = self.get_gridspec().ncols
+ # We explicitly support num2 referring to a column on num1's *left*, so
+ # we must sort the column indices here so that the range makes sense.
+ c1, c2 = sorted([self.num1 % ncols, self.num2 % ncols])
+ return range(c1, c2 + 1)
+
+ def is_first_row(self):
+ return self.rowspan.start == 0
+
+ def is_last_row(self):
+ return self.rowspan.stop == self.get_gridspec().nrows
+
+ def is_first_col(self):
+ return self.colspan.start == 0
+
+ def is_last_col(self):
+ return self.colspan.stop == self.get_gridspec().ncols
+
+ @_api.delete_parameter("3.4", "return_all")
+ def get_position(self, figure, return_all=False):
+ """
+ Update the subplot position from ``figure.subplotpars``.
+ """
+ gridspec = self.get_gridspec()
+ nrows, ncols = gridspec.get_geometry()
+ rows, cols = np.unravel_index([self.num1, self.num2], (nrows, ncols))
+ fig_bottoms, fig_tops, fig_lefts, fig_rights = \
+ gridspec.get_grid_positions(figure)
+
+ fig_bottom = fig_bottoms[rows].min()
+ fig_top = fig_tops[rows].max()
+ fig_left = fig_lefts[cols].min()
+ fig_right = fig_rights[cols].max()
+ figbox = Bbox.from_extents(fig_left, fig_bottom, fig_right, fig_top)
+
+ if return_all:
+ return figbox, rows[0], cols[0], nrows, ncols
+ else:
+ return figbox
+
+ def get_topmost_subplotspec(self):
+ """
+ Return the topmost `SubplotSpec` instance associated with the subplot.
+ """
+ gridspec = self.get_gridspec()
+ if hasattr(gridspec, "get_topmost_subplotspec"):
+ return gridspec.get_topmost_subplotspec()
+ else:
+ return self
+
+ def __eq__(self, other):
+ """
+ Two SubplotSpecs are considered equal if they refer to the same
+ position(s) in the same `GridSpec`.
+ """
+ # other may not even have the attributes we are checking.
+ return ((self._gridspec, self.num1, self.num2)
+ == (getattr(other, "_gridspec", object()),
+ getattr(other, "num1", object()),
+ getattr(other, "num2", object())))
+
+ def __hash__(self):
+ return hash((self._gridspec, self.num1, self.num2))
+
+ def subgridspec(self, nrows, ncols, **kwargs):
+ """
+ Create a GridSpec within this subplot.
+
+ The created `.GridSpecFromSubplotSpec` will have this `SubplotSpec` as
+ a parent.
+
+ Parameters
+ ----------
+ nrows : int
+ Number of rows in grid.
+
+ ncols : int
+ Number or columns in grid.
+
+ Returns
+ -------
+ `.GridSpecFromSubplotSpec`
+
+ Other Parameters
+ ----------------
+ **kwargs
+ All other parameters are passed to `.GridSpecFromSubplotSpec`.
+
+ See Also
+ --------
+ matplotlib.pyplot.subplots
+
+ Examples
+ --------
+ Adding three subplots in the space occupied by a single subplot::
+
+ fig = plt.figure()
+ gs0 = fig.add_gridspec(3, 1)
+ ax1 = fig.add_subplot(gs0[0])
+ ax2 = fig.add_subplot(gs0[1])
+ gssub = gs0[2].subgridspec(1, 3)
+ for i in range(3):
+ fig.add_subplot(gssub[0, i])
+ """
+ return GridSpecFromSubplotSpec(nrows, ncols, self, **kwargs)
diff --git a/venv/Lib/site-packages/matplotlib/hatch.py b/venv/Lib/site-packages/matplotlib/hatch.py
new file mode 100644
index 0000000..af674de
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/hatch.py
@@ -0,0 +1,231 @@
+"""Contains classes for generating hatch patterns."""
+
+import numpy as np
+
+from matplotlib import _api
+from matplotlib.path import Path
+
+
+class HatchPatternBase:
+ """The base class for a hatch pattern."""
+ pass
+
+
+class HorizontalHatch(HatchPatternBase):
+ def __init__(self, hatch, density):
+ self.num_lines = int((hatch.count('-') + hatch.count('+')) * density)
+ self.num_vertices = self.num_lines * 2
+
+ def set_vertices_and_codes(self, vertices, codes):
+ steps, stepsize = np.linspace(0.0, 1.0, self.num_lines, False,
+ retstep=True)
+ steps += stepsize / 2.
+ vertices[0::2, 0] = 0.0
+ vertices[0::2, 1] = steps
+ vertices[1::2, 0] = 1.0
+ vertices[1::2, 1] = steps
+ codes[0::2] = Path.MOVETO
+ codes[1::2] = Path.LINETO
+
+
+class VerticalHatch(HatchPatternBase):
+ def __init__(self, hatch, density):
+ self.num_lines = int((hatch.count('|') + hatch.count('+')) * density)
+ self.num_vertices = self.num_lines * 2
+
+ def set_vertices_and_codes(self, vertices, codes):
+ steps, stepsize = np.linspace(0.0, 1.0, self.num_lines, False,
+ retstep=True)
+ steps += stepsize / 2.
+ vertices[0::2, 0] = steps
+ vertices[0::2, 1] = 0.0
+ vertices[1::2, 0] = steps
+ vertices[1::2, 1] = 1.0
+ codes[0::2] = Path.MOVETO
+ codes[1::2] = Path.LINETO
+
+
+class NorthEastHatch(HatchPatternBase):
+ def __init__(self, hatch, density):
+ self.num_lines = int(
+ (hatch.count('/') + hatch.count('x') + hatch.count('X')) * density)
+ if self.num_lines:
+ self.num_vertices = (self.num_lines + 1) * 2
+ else:
+ self.num_vertices = 0
+
+ def set_vertices_and_codes(self, vertices, codes):
+ steps = np.linspace(-0.5, 0.5, self.num_lines + 1)
+ vertices[0::2, 0] = 0.0 + steps
+ vertices[0::2, 1] = 0.0 - steps
+ vertices[1::2, 0] = 1.0 + steps
+ vertices[1::2, 1] = 1.0 - steps
+ codes[0::2] = Path.MOVETO
+ codes[1::2] = Path.LINETO
+
+
+class SouthEastHatch(HatchPatternBase):
+ def __init__(self, hatch, density):
+ self.num_lines = int(
+ (hatch.count('\\') + hatch.count('x') + hatch.count('X'))
+ * density)
+ if self.num_lines:
+ self.num_vertices = (self.num_lines + 1) * 2
+ else:
+ self.num_vertices = 0
+
+ def set_vertices_and_codes(self, vertices, codes):
+ steps = np.linspace(-0.5, 0.5, self.num_lines + 1)
+ vertices[0::2, 0] = 0.0 + steps
+ vertices[0::2, 1] = 1.0 + steps
+ vertices[1::2, 0] = 1.0 + steps
+ vertices[1::2, 1] = 0.0 + steps
+ codes[0::2] = Path.MOVETO
+ codes[1::2] = Path.LINETO
+
+
+class Shapes(HatchPatternBase):
+ filled = False
+
+ def __init__(self, hatch, density):
+ if self.num_rows == 0:
+ self.num_shapes = 0
+ self.num_vertices = 0
+ else:
+ self.num_shapes = ((self.num_rows // 2 + 1) * (self.num_rows + 1) +
+ (self.num_rows // 2) * self.num_rows)
+ self.num_vertices = (self.num_shapes *
+ len(self.shape_vertices) *
+ (1 if self.filled else 2))
+
+ def set_vertices_and_codes(self, vertices, codes):
+ offset = 1.0 / self.num_rows
+ shape_vertices = self.shape_vertices * offset * self.size
+ if not self.filled:
+ inner_vertices = shape_vertices[::-1] * 0.9
+ shape_codes = self.shape_codes
+ shape_size = len(shape_vertices)
+
+ cursor = 0
+ for row in range(self.num_rows + 1):
+ if row % 2 == 0:
+ cols = np.linspace(0, 1, self.num_rows + 1)
+ else:
+ cols = np.linspace(offset / 2, 1 - offset / 2, self.num_rows)
+ row_pos = row * offset
+ for col_pos in cols:
+ vertices[cursor:cursor + shape_size] = (shape_vertices +
+ (col_pos, row_pos))
+ codes[cursor:cursor + shape_size] = shape_codes
+ cursor += shape_size
+ if not self.filled:
+ vertices[cursor:cursor + shape_size] = (inner_vertices +
+ (col_pos, row_pos))
+ codes[cursor:cursor + shape_size] = shape_codes
+ cursor += shape_size
+
+
+class Circles(Shapes):
+ def __init__(self, hatch, density):
+ path = Path.unit_circle()
+ self.shape_vertices = path.vertices
+ self.shape_codes = path.codes
+ super().__init__(hatch, density)
+
+
+class SmallCircles(Circles):
+ size = 0.2
+
+ def __init__(self, hatch, density):
+ self.num_rows = (hatch.count('o')) * density
+ super().__init__(hatch, density)
+
+
+class LargeCircles(Circles):
+ size = 0.35
+
+ def __init__(self, hatch, density):
+ self.num_rows = (hatch.count('O')) * density
+ super().__init__(hatch, density)
+
+
+# TODO: __init__ and class attributes override all attributes set by
+# SmallCircles. Should this class derive from Circles instead?
+class SmallFilledCircles(SmallCircles):
+ size = 0.1
+ filled = True
+
+ def __init__(self, hatch, density):
+ self.num_rows = (hatch.count('.')) * density
+ # Not super().__init__!
+ Circles.__init__(self, hatch, density)
+
+
+class Stars(Shapes):
+ size = 1.0 / 3.0
+ filled = True
+
+ def __init__(self, hatch, density):
+ self.num_rows = (hatch.count('*')) * density
+ path = Path.unit_regular_star(5)
+ self.shape_vertices = path.vertices
+ self.shape_codes = np.full(len(self.shape_vertices), Path.LINETO,
+ dtype=Path.code_type)
+ self.shape_codes[0] = Path.MOVETO
+ super().__init__(hatch, density)
+
+_hatch_types = [
+ HorizontalHatch,
+ VerticalHatch,
+ NorthEastHatch,
+ SouthEastHatch,
+ SmallCircles,
+ LargeCircles,
+ SmallFilledCircles,
+ Stars
+ ]
+
+
+def _validate_hatch_pattern(hatch):
+ valid_hatch_patterns = set(r'-+|/\xXoO.*')
+ if hatch is not None:
+ invalids = set(hatch).difference(valid_hatch_patterns)
+ if invalids:
+ valid = ''.join(sorted(valid_hatch_patterns))
+ invalids = ''.join(sorted(invalids))
+ _api.warn_deprecated(
+ '3.4',
+ message=f'hatch must consist of a string of "{valid}" or '
+ 'None, but found the following invalid values '
+ f'"{invalids}". Passing invalid values is deprecated '
+ 'since %(since)s and will become an error %(removal)s.'
+ )
+
+
+def get_path(hatchpattern, density=6):
+ """
+ Given a hatch specifier, *hatchpattern*, generates Path to render
+ the hatch in a unit square. *density* is the number of lines per
+ unit square.
+ """
+ density = int(density)
+
+ patterns = [hatch_type(hatchpattern, density)
+ for hatch_type in _hatch_types]
+ num_vertices = sum([pattern.num_vertices for pattern in patterns])
+
+ if num_vertices == 0:
+ return Path(np.empty((0, 2)))
+
+ vertices = np.empty((num_vertices, 2))
+ codes = np.empty(num_vertices, Path.code_type)
+
+ cursor = 0
+ for pattern in patterns:
+ if pattern.num_vertices != 0:
+ vertices_chunk = vertices[cursor:cursor + pattern.num_vertices]
+ codes_chunk = codes[cursor:cursor + pattern.num_vertices]
+ pattern.set_vertices_and_codes(vertices_chunk, codes_chunk)
+ cursor += pattern.num_vertices
+
+ return Path(vertices, codes)
diff --git a/venv/Lib/site-packages/matplotlib/image.py b/venv/Lib/site-packages/matplotlib/image.py
new file mode 100644
index 0000000..98e2b5e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/image.py
@@ -0,0 +1,1745 @@
+"""
+The image module supports basic image loading, rescaling and display
+operations.
+"""
+
+import math
+import os
+import logging
+from pathlib import Path
+
+import numpy as np
+import PIL.PngImagePlugin
+
+import matplotlib as mpl
+from matplotlib import _api
+import matplotlib.artist as martist
+from matplotlib.backend_bases import FigureCanvasBase
+import matplotlib.colors as mcolors
+import matplotlib.cm as cm
+import matplotlib.cbook as cbook
+# For clarity, names from _image are given explicitly in this module:
+import matplotlib._image as _image
+# For user convenience, the names from _image are also imported into
+# the image namespace:
+from matplotlib._image import *
+from matplotlib.transforms import (
+ Affine2D, BboxBase, Bbox, BboxTransform, BboxTransformTo,
+ IdentityTransform, TransformedBbox)
+
+_log = logging.getLogger(__name__)
+
+# map interpolation strings to module constants
+_interpd_ = {
+ 'antialiased': _image.NEAREST, # this will use nearest or Hanning...
+ 'none': _image.NEAREST, # fall back to nearest when not supported
+ 'nearest': _image.NEAREST,
+ 'bilinear': _image.BILINEAR,
+ 'bicubic': _image.BICUBIC,
+ 'spline16': _image.SPLINE16,
+ 'spline36': _image.SPLINE36,
+ 'hanning': _image.HANNING,
+ 'hamming': _image.HAMMING,
+ 'hermite': _image.HERMITE,
+ 'kaiser': _image.KAISER,
+ 'quadric': _image.QUADRIC,
+ 'catrom': _image.CATROM,
+ 'gaussian': _image.GAUSSIAN,
+ 'bessel': _image.BESSEL,
+ 'mitchell': _image.MITCHELL,
+ 'sinc': _image.SINC,
+ 'lanczos': _image.LANCZOS,
+ 'blackman': _image.BLACKMAN,
+}
+
+interpolations_names = set(_interpd_)
+
+
+def composite_images(images, renderer, magnification=1.0):
+ """
+ Composite a number of RGBA images into one. The images are
+ composited in the order in which they appear in the *images* list.
+
+ Parameters
+ ----------
+ images : list of Images
+ Each must have a `make_image` method. For each image,
+ `can_composite` should return `True`, though this is not
+ enforced by this function. Each image must have a purely
+ affine transformation with no shear.
+
+ renderer : `.RendererBase`
+
+ magnification : float, default: 1
+ The additional magnification to apply for the renderer in use.
+
+ Returns
+ -------
+ image : uint8 array (M, N, 4)
+ The composited RGBA image.
+ offset_x, offset_y : float
+ The (left, bottom) offset where the composited image should be placed
+ in the output figure.
+ """
+ if len(images) == 0:
+ return np.empty((0, 0, 4), dtype=np.uint8), 0, 0
+
+ parts = []
+ bboxes = []
+ for image in images:
+ data, x, y, trans = image.make_image(renderer, magnification)
+ if data is not None:
+ x *= magnification
+ y *= magnification
+ parts.append((data, x, y, image._get_scalar_alpha()))
+ bboxes.append(
+ Bbox([[x, y], [x + data.shape[1], y + data.shape[0]]]))
+
+ if len(parts) == 0:
+ return np.empty((0, 0, 4), dtype=np.uint8), 0, 0
+
+ bbox = Bbox.union(bboxes)
+
+ output = np.zeros(
+ (int(bbox.height), int(bbox.width), 4), dtype=np.uint8)
+
+ for data, x, y, alpha in parts:
+ trans = Affine2D().translate(x - bbox.x0, y - bbox.y0)
+ _image.resample(data, output, trans, _image.NEAREST,
+ resample=False, alpha=alpha)
+
+ return output, bbox.x0 / magnification, bbox.y0 / magnification
+
+
+def _draw_list_compositing_images(
+ renderer, parent, artists, suppress_composite=None):
+ """
+ Draw a sorted list of artists, compositing images into a single
+ image where possible.
+
+ For internal Matplotlib use only: It is here to reduce duplication
+ between `Figure.draw` and `Axes.draw`, but otherwise should not be
+ generally useful.
+ """
+ has_images = any(isinstance(x, _ImageBase) for x in artists)
+
+ # override the renderer default if suppressComposite is not None
+ not_composite = (suppress_composite if suppress_composite is not None
+ else renderer.option_image_nocomposite())
+
+ if not_composite or not has_images:
+ for a in artists:
+ a.draw(renderer)
+ else:
+ # Composite any adjacent images together
+ image_group = []
+ mag = renderer.get_image_magnification()
+
+ def flush_images():
+ if len(image_group) == 1:
+ image_group[0].draw(renderer)
+ elif len(image_group) > 1:
+ data, l, b = composite_images(image_group, renderer, mag)
+ if data.size != 0:
+ gc = renderer.new_gc()
+ gc.set_clip_rectangle(parent.bbox)
+ gc.set_clip_path(parent.get_clip_path())
+ renderer.draw_image(gc, round(l), round(b), data)
+ gc.restore()
+ del image_group[:]
+
+ for a in artists:
+ if (isinstance(a, _ImageBase) and a.can_composite() and
+ a.get_clip_on()):
+ image_group.append(a)
+ else:
+ flush_images()
+ a.draw(renderer)
+ flush_images()
+
+
+def _resample(
+ image_obj, data, out_shape, transform, *, resample=None, alpha=1):
+ """
+ Convenience wrapper around `._image.resample` to resample *data* to
+ *out_shape* (with a third dimension if *data* is RGBA) that takes care of
+ allocating the output array and fetching the relevant properties from the
+ Image object *image_obj*.
+ """
+
+ # decide if we need to apply anti-aliasing if the data is upsampled:
+ # compare the number of displayed pixels to the number of
+ # the data pixels.
+ interpolation = image_obj.get_interpolation()
+ if interpolation == 'antialiased':
+ # don't antialias if upsampling by an integer number or
+ # if zooming in more than a factor of 3
+ pos = np.array([[0, 0], [data.shape[1], data.shape[0]]])
+ disp = transform.transform(pos)
+ dispx = np.abs(np.diff(disp[:, 0]))
+ dispy = np.abs(np.diff(disp[:, 1]))
+ if ((dispx > 3 * data.shape[1] or
+ dispx == data.shape[1] or
+ dispx == 2 * data.shape[1]) and
+ (dispy > 3 * data.shape[0] or
+ dispy == data.shape[0] or
+ dispy == 2 * data.shape[0])):
+ interpolation = 'nearest'
+ else:
+ interpolation = 'hanning'
+ out = np.zeros(out_shape + data.shape[2:], data.dtype) # 2D->2D, 3D->3D.
+ if resample is None:
+ resample = image_obj.get_resample()
+ _image.resample(data, out, transform,
+ _interpd_[interpolation],
+ resample,
+ alpha,
+ image_obj.get_filternorm(),
+ image_obj.get_filterrad())
+ return out
+
+
+def _rgb_to_rgba(A):
+ """
+ Convert an RGB image to RGBA, as required by the image resample C++
+ extension.
+ """
+ rgba = np.zeros((A.shape[0], A.shape[1], 4), dtype=A.dtype)
+ rgba[:, :, :3] = A
+ if rgba.dtype == np.uint8:
+ rgba[:, :, 3] = 255
+ else:
+ rgba[:, :, 3] = 1.0
+ return rgba
+
+
+class _ImageBase(martist.Artist, cm.ScalarMappable):
+ """
+ Base class for images.
+
+ interpolation and cmap default to their rc settings
+
+ cmap is a colors.Colormap instance
+ norm is a colors.Normalize instance to map luminance to 0-1
+
+ extent is data axes (left, right, bottom, top) for making image plots
+ registered with data plots. Default is to label the pixel
+ centers with the zero-based row and column indices.
+
+ Additional kwargs are matplotlib.artist properties
+ """
+ zorder = 0
+
+ def __init__(self, ax,
+ cmap=None,
+ norm=None,
+ interpolation=None,
+ origin=None,
+ filternorm=True,
+ filterrad=4.0,
+ resample=False,
+ **kwargs
+ ):
+ martist.Artist.__init__(self)
+ cm.ScalarMappable.__init__(self, norm, cmap)
+ if origin is None:
+ origin = mpl.rcParams['image.origin']
+ _api.check_in_list(["upper", "lower"], origin=origin)
+ self.origin = origin
+ self.set_filternorm(filternorm)
+ self.set_filterrad(filterrad)
+ self.set_interpolation(interpolation)
+ self.set_resample(resample)
+ self.axes = ax
+
+ self._imcache = None
+
+ self.update(kwargs)
+
+ def __getstate__(self):
+ state = super().__getstate__()
+ # We can't pickle the C Image cached object.
+ state['_imcache'] = None
+ return state
+
+ def get_size(self):
+ """Return the size of the image as tuple (numrows, numcols)."""
+ if self._A is None:
+ raise RuntimeError('You must first set the image array')
+
+ return self._A.shape[:2]
+
+ def set_alpha(self, alpha):
+ """
+ Set the alpha value used for blending - not supported on all backends.
+
+ Parameters
+ ----------
+ alpha : float or 2D array-like or None
+ """
+ martist.Artist._set_alpha_for_array(self, alpha)
+ if np.ndim(alpha) not in (0, 2):
+ raise TypeError('alpha must be a float, two-dimensional '
+ 'array, or None')
+ self._imcache = None
+
+ def _get_scalar_alpha(self):
+ """
+ Get a scalar alpha value to be applied to the artist as a whole.
+
+ If the alpha value is a matrix, the method returns 1.0 because pixels
+ have individual alpha values (see `~._ImageBase._make_image` for
+ details). If the alpha value is a scalar, the method returns said value
+ to be applied to the artist as a whole because pixels do not have
+ individual alpha values.
+ """
+ return 1.0 if self._alpha is None or np.ndim(self._alpha) > 0 \
+ else self._alpha
+
+ def changed(self):
+ """
+ Call this whenever the mappable is changed so observers can update.
+ """
+ self._imcache = None
+ self._rgbacache = None
+ cm.ScalarMappable.changed(self)
+
+ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
+ unsampled=False, round_to_pixel_border=True):
+ """
+ Normalize, rescale, and colormap the image *A* from the given *in_bbox*
+ (in data space), to the given *out_bbox* (in pixel space) clipped to
+ the given *clip_bbox* (also in pixel space), and magnified by the
+ *magnification* factor.
+
+ *A* may be a greyscale image (M, N) with a dtype of float32, float64,
+ float128, uint16 or uint8, or an (M, N, 4) RGBA image with a dtype of
+ float32, float64, float128, or uint8.
+
+ If *unsampled* is True, the image will not be scaled, but an
+ appropriate affine transformation will be returned instead.
+
+ If *round_to_pixel_border* is True, the output image size will be
+ rounded to the nearest pixel boundary. This makes the images align
+ correctly with the axes. It should not be used if exact scaling is
+ needed, such as for `FigureImage`.
+
+ Returns
+ -------
+ image : (M, N, 4) uint8 array
+ The RGBA image, resampled unless *unsampled* is True.
+ x, y : float
+ The upper left corner where the image should be drawn, in pixel
+ space.
+ trans : Affine2D
+ The affine transformation from image to pixel space.
+ """
+ if A is None:
+ raise RuntimeError('You must first set the image '
+ 'array or the image attribute')
+ if A.size == 0:
+ raise RuntimeError("_make_image must get a non-empty image. "
+ "Your Artist's draw method must filter before "
+ "this method is called.")
+
+ clipped_bbox = Bbox.intersection(out_bbox, clip_bbox)
+
+ if clipped_bbox is None:
+ return None, 0, 0, None
+
+ out_width_base = clipped_bbox.width * magnification
+ out_height_base = clipped_bbox.height * magnification
+
+ if out_width_base == 0 or out_height_base == 0:
+ return None, 0, 0, None
+
+ if self.origin == 'upper':
+ # Flip the input image using a transform. This avoids the
+ # problem with flipping the array, which results in a copy
+ # when it is converted to contiguous in the C wrapper
+ t0 = Affine2D().translate(0, -A.shape[0]).scale(1, -1)
+ else:
+ t0 = IdentityTransform()
+
+ t0 += (
+ Affine2D()
+ .scale(
+ in_bbox.width / A.shape[1],
+ in_bbox.height / A.shape[0])
+ .translate(in_bbox.x0, in_bbox.y0)
+ + self.get_transform())
+
+ t = (t0
+ + (Affine2D()
+ .translate(-clipped_bbox.x0, -clipped_bbox.y0)
+ .scale(magnification)))
+
+ # So that the image is aligned with the edge of the axes, we want to
+ # round up the output width to the next integer. This also means
+ # scaling the transform slightly to account for the extra subpixel.
+ if (t.is_affine and round_to_pixel_border and
+ (out_width_base % 1.0 != 0.0 or out_height_base % 1.0 != 0.0)):
+ out_width = math.ceil(out_width_base)
+ out_height = math.ceil(out_height_base)
+ extra_width = (out_width - out_width_base) / out_width_base
+ extra_height = (out_height - out_height_base) / out_height_base
+ t += Affine2D().scale(1.0 + extra_width, 1.0 + extra_height)
+ else:
+ out_width = int(out_width_base)
+ out_height = int(out_height_base)
+ out_shape = (out_height, out_width)
+
+ if not unsampled:
+ if not (A.ndim == 2 or A.ndim == 3 and A.shape[-1] in (3, 4)):
+ raise ValueError(f"Invalid shape {A.shape} for image data")
+
+ if A.ndim == 2:
+ # if we are a 2D array, then we are running through the
+ # norm + colormap transformation. However, in general the
+ # input data is not going to match the size on the screen so we
+ # have to resample to the correct number of pixels
+
+ # TODO slice input array first
+ inp_dtype = A.dtype
+ a_min = A.min()
+ a_max = A.max()
+ # figure out the type we should scale to. For floats,
+ # leave as is. For integers cast to an appropriate-sized
+ # float. Small integers get smaller floats in an attempt
+ # to keep the memory footprint reasonable.
+ if a_min is np.ma.masked:
+ # all masked, so values don't matter
+ a_min, a_max = np.int32(0), np.int32(1)
+ if inp_dtype.kind == 'f':
+ scaled_dtype = A.dtype
+ # Cast to float64
+ if A.dtype not in (np.float32, np.float16):
+ if A.dtype != np.float64:
+ _api.warn_external(
+ f"Casting input data from '{A.dtype}' to "
+ f"'float64' for imshow")
+ scaled_dtype = np.float64
+ else:
+ # probably an integer of some type.
+ da = a_max.astype(np.float64) - a_min.astype(np.float64)
+ # give more breathing room if a big dynamic range
+ scaled_dtype = np.float64 if da > 1e8 else np.float32
+
+ # scale the input data to [.1, .9]. The Agg
+ # interpolators clip to [0, 1] internally, use a
+ # smaller input scale to identify which of the
+ # interpolated points need to be should be flagged as
+ # over / under.
+ # This may introduce numeric instabilities in very broadly
+ # scaled data
+ # Always copy, and don't allow array subtypes.
+ A_scaled = np.array(A, dtype=scaled_dtype)
+ # clip scaled data around norm if necessary.
+ # This is necessary for big numbers at the edge of
+ # float64's ability to represent changes. Applying
+ # a norm first would be good, but ruins the interpolation
+ # of over numbers.
+ self.norm.autoscale_None(A)
+ dv = np.float64(self.norm.vmax) - np.float64(self.norm.vmin)
+ vmid = np.float64(self.norm.vmin) + dv / 2
+ fact = 1e7 if scaled_dtype == np.float64 else 1e4
+ newmin = vmid - dv * fact
+ if newmin < a_min:
+ newmin = None
+ else:
+ a_min = np.float64(newmin)
+ newmax = vmid + dv * fact
+ if newmax > a_max:
+ newmax = None
+ else:
+ a_max = np.float64(newmax)
+ if newmax is not None or newmin is not None:
+ np.clip(A_scaled, newmin, newmax, out=A_scaled)
+
+ # used to rescale the raw data to [offset, 1-offset]
+ # so that the resampling code will run cleanly. Using
+ # dyadic numbers here could reduce the error, but
+ # would not full eliminate it and breaks a number of
+ # tests (due to the slightly different error bouncing
+ # some pixels across a boundary in the (very
+ # quantized) colormapping step).
+ offset = .1
+ frac = .8
+ # we need to run the vmin/vmax through the same rescaling
+ # that we run the raw data through because there are small
+ # errors in the round-trip due to float precision. If we
+ # do not run the vmin/vmax through the same pipeline we can
+ # have values close or equal to the boundaries end up on the
+ # wrong side.
+ vmin, vmax = self.norm.vmin, self.norm.vmax
+ if vmin is np.ma.masked:
+ vmin, vmax = a_min, a_max
+ vrange = np.array([vmin, vmax], dtype=scaled_dtype)
+
+ A_scaled -= a_min
+ vrange -= a_min
+ # a_min and a_max might be ndarray subclasses so use
+ # item to avoid errors
+ a_min = a_min.astype(scaled_dtype).item()
+ a_max = a_max.astype(scaled_dtype).item()
+
+ if a_min != a_max:
+ A_scaled /= ((a_max - a_min) / frac)
+ vrange /= ((a_max - a_min) / frac)
+ A_scaled += offset
+ vrange += offset
+ # resample the input data to the correct resolution and shape
+ A_resampled = _resample(self, A_scaled, out_shape, t)
+ # done with A_scaled now, remove from namespace to be sure!
+ del A_scaled
+ # un-scale the resampled data to approximately the
+ # original range things that interpolated to above /
+ # below the original min/max will still be above /
+ # below, but possibly clipped in the case of higher order
+ # interpolation + drastically changing data.
+ A_resampled -= offset
+ vrange -= offset
+ if a_min != a_max:
+ A_resampled *= ((a_max - a_min) / frac)
+ vrange *= ((a_max - a_min) / frac)
+ A_resampled += a_min
+ vrange += a_min
+ # if using NoNorm, cast back to the original datatype
+ if isinstance(self.norm, mcolors.NoNorm):
+ A_resampled = A_resampled.astype(A.dtype)
+
+ mask = (np.where(A.mask, np.float32(np.nan), np.float32(1))
+ if A.mask.shape == A.shape # nontrivial mask
+ else np.ones_like(A, np.float32))
+ # we always have to interpolate the mask to account for
+ # non-affine transformations
+ out_alpha = _resample(self, mask, out_shape, t, resample=True)
+ # done with the mask now, delete from namespace to be sure!
+ del mask
+ # Agg updates out_alpha in place. If the pixel has no image
+ # data it will not be updated (and still be 0 as we initialized
+ # it), if input data that would go into that output pixel than
+ # it will be `nan`, if all the input data for a pixel is good
+ # it will be 1, and if there is _some_ good data in that output
+ # pixel it will be between [0, 1] (such as a rotated image).
+ out_mask = np.isnan(out_alpha)
+ out_alpha[out_mask] = 1
+ # Apply the pixel-by-pixel alpha values if present
+ alpha = self.get_alpha()
+ if alpha is not None and np.ndim(alpha) > 0:
+ out_alpha *= _resample(self, alpha, out_shape,
+ t, resample=True)
+ # mask and run through the norm
+ resampled_masked = np.ma.masked_array(A_resampled, out_mask)
+ # we have re-set the vmin/vmax to account for small errors
+ # that may have moved input values in/out of range
+ s_vmin, s_vmax = vrange
+ if isinstance(self.norm, mcolors.LogNorm):
+ if s_vmin < 0:
+ s_vmin = max(s_vmin, np.finfo(scaled_dtype).eps)
+ with cbook._setattr_cm(self.norm,
+ vmin=s_vmin,
+ vmax=s_vmax,
+ ):
+ output = self.norm(resampled_masked)
+ else:
+ if A.shape[2] == 3:
+ A = _rgb_to_rgba(A)
+ alpha = self._get_scalar_alpha()
+ output_alpha = _resample( # resample alpha channel
+ self, A[..., 3], out_shape, t, alpha=alpha)
+ output = _resample( # resample rgb channels
+ self, _rgb_to_rgba(A[..., :3]), out_shape, t, alpha=alpha)
+ output[..., 3] = output_alpha # recombine rgb and alpha
+
+ # at this point output is either a 2D array of normed data
+ # (of int or float)
+ # or an RGBA array of re-sampled input
+ output = self.to_rgba(output, bytes=True, norm=False)
+ # output is now a correctly sized RGBA array of uint8
+
+ # Apply alpha *after* if the input was greyscale without a mask
+ if A.ndim == 2:
+ alpha = self._get_scalar_alpha()
+ alpha_channel = output[:, :, 3]
+ alpha_channel[:] = np.asarray(
+ np.asarray(alpha_channel, np.float32) * out_alpha * alpha,
+ np.uint8)
+
+ else:
+ if self._imcache is None:
+ self._imcache = self.to_rgba(A, bytes=True, norm=(A.ndim == 2))
+ output = self._imcache
+
+ # Subset the input image to only the part that will be
+ # displayed
+ subset = TransformedBbox(clip_bbox, t0.inverted()).frozen()
+ output = output[
+ int(max(subset.ymin, 0)):
+ int(min(subset.ymax + 1, output.shape[0])),
+ int(max(subset.xmin, 0)):
+ int(min(subset.xmax + 1, output.shape[1]))]
+
+ t = Affine2D().translate(
+ int(max(subset.xmin, 0)), int(max(subset.ymin, 0))) + t
+
+ return output, clipped_bbox.x0, clipped_bbox.y0, t
+
+ def make_image(self, renderer, magnification=1.0, unsampled=False):
+ """
+ Normalize, rescale, and colormap this image's data for rendering using
+ *renderer*, with the given *magnification*.
+
+ If *unsampled* is True, the image will not be scaled, but an
+ appropriate affine transformation will be returned instead.
+
+ Returns
+ -------
+ image : (M, N, 4) uint8 array
+ The RGBA image, resampled unless *unsampled* is True.
+ x, y : float
+ The upper left corner where the image should be drawn, in pixel
+ space.
+ trans : Affine2D
+ The affine transformation from image to pixel space.
+ """
+ raise NotImplementedError('The make_image method must be overridden')
+
+ def _check_unsampled_image(self):
+ """
+ Return whether the image is better to be drawn unsampled.
+
+ The derived class needs to override it.
+ """
+ return False
+
+ @martist.allow_rasterization
+ def draw(self, renderer, *args, **kwargs):
+ # if not visible, declare victory and return
+ if not self.get_visible():
+ self.stale = False
+ return
+ # for empty images, there is nothing to draw!
+ if self.get_array().size == 0:
+ self.stale = False
+ return
+ # actually render the image.
+ gc = renderer.new_gc()
+ self._set_gc_clip(gc)
+ gc.set_alpha(self._get_scalar_alpha())
+ gc.set_url(self.get_url())
+ gc.set_gid(self.get_gid())
+ if (renderer.option_scale_image() # Renderer supports transform kwarg.
+ and self._check_unsampled_image()
+ and self.get_transform().is_affine):
+ im, l, b, trans = self.make_image(renderer, unsampled=True)
+ if im is not None:
+ trans = Affine2D().scale(im.shape[1], im.shape[0]) + trans
+ renderer.draw_image(gc, l, b, im, trans)
+ else:
+ im, l, b, trans = self.make_image(
+ renderer, renderer.get_image_magnification())
+ if im is not None:
+ renderer.draw_image(gc, l, b, im)
+ gc.restore()
+ self.stale = False
+
+ def contains(self, mouseevent):
+ """Test whether the mouse event occurred within the image."""
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+ # 1) This doesn't work for figimage; but figimage also needs a fix
+ # below (as the check cannot use x/ydata and extents).
+ # 2) As long as the check below uses x/ydata, we need to test axes
+ # identity instead of `self.axes.contains(event)` because even if
+ # axes overlap, x/ydata is only valid for event.inaxes anyways.
+ if self.axes is not mouseevent.inaxes:
+ return False, {}
+ # TODO: make sure this is consistent with patch and patch
+ # collection on nonlinear transformed coordinates.
+ # TODO: consider returning image coordinates (shouldn't
+ # be too difficult given that the image is rectilinear
+ trans = self.get_transform().inverted()
+ x, y = trans.transform([mouseevent.x, mouseevent.y])
+ xmin, xmax, ymin, ymax = self.get_extent()
+ if xmin > xmax:
+ xmin, xmax = xmax, xmin
+ if ymin > ymax:
+ ymin, ymax = ymax, ymin
+
+ if x is not None and y is not None:
+ inside = (xmin <= x <= xmax) and (ymin <= y <= ymax)
+ else:
+ inside = False
+
+ return inside, {}
+
+ def write_png(self, fname):
+ """Write the image to png file *fname*."""
+ im = self.to_rgba(self._A[::-1] if self.origin == 'lower' else self._A,
+ bytes=True, norm=True)
+ PIL.Image.fromarray(im).save(fname, format="png")
+
+ def set_data(self, A):
+ """
+ Set the image array.
+
+ Note that this function does *not* update the normalization used.
+
+ Parameters
+ ----------
+ A : array-like or `PIL.Image.Image`
+ """
+ if isinstance(A, PIL.Image.Image):
+ A = pil_to_array(A) # Needed e.g. to apply png palette.
+ self._A = cbook.safe_masked_invalid(A, copy=True)
+
+ if (self._A.dtype != np.uint8 and
+ not np.can_cast(self._A.dtype, float, "same_kind")):
+ raise TypeError("Image data of dtype {} cannot be converted to "
+ "float".format(self._A.dtype))
+
+ if self._A.ndim == 3 and self._A.shape[-1] == 1:
+ # If just one dimension assume scalar and apply colormap
+ self._A = self._A[:, :, 0]
+
+ if not (self._A.ndim == 2
+ or self._A.ndim == 3 and self._A.shape[-1] in [3, 4]):
+ raise TypeError("Invalid shape {} for image data"
+ .format(self._A.shape))
+
+ if self._A.ndim == 3:
+ # If the input data has values outside the valid range (after
+ # normalisation), we issue a warning and then clip X to the bounds
+ # - otherwise casting wraps extreme values, hiding outliers and
+ # making reliable interpretation impossible.
+ high = 255 if np.issubdtype(self._A.dtype, np.integer) else 1
+ if self._A.min() < 0 or high < self._A.max():
+ _log.warning(
+ 'Clipping input data to the valid range for imshow with '
+ 'RGB data ([0..1] for floats or [0..255] for integers).'
+ )
+ self._A = np.clip(self._A, 0, high)
+ # Cast unsupported integer types to uint8
+ if self._A.dtype != np.uint8 and np.issubdtype(self._A.dtype,
+ np.integer):
+ self._A = self._A.astype(np.uint8)
+
+ self._imcache = None
+ self._rgbacache = None
+ self.stale = True
+
+ def set_array(self, A):
+ """
+ Retained for backwards compatibility - use set_data instead.
+
+ Parameters
+ ----------
+ A : array-like
+ """
+ # This also needs to be here to override the inherited
+ # cm.ScalarMappable.set_array method so it is not invoked by mistake.
+ self.set_data(A)
+
+ def get_interpolation(self):
+ """
+ Return the interpolation method the image uses when resizing.
+
+ One of 'antialiased', 'nearest', 'bilinear', 'bicubic', 'spline16',
+ 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
+ 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos',
+ or 'none'.
+ """
+ return self._interpolation
+
+ def set_interpolation(self, s):
+ """
+ Set the interpolation method the image uses when resizing.
+
+ If None, use :rc:`image.interpolation`. If 'none', the image is
+ shown as is without interpolating. 'none' is only supported in
+ agg, ps and pdf backends and will fall back to 'nearest' mode
+ for other backends.
+
+ Parameters
+ ----------
+ s : {'antialiased', 'nearest', 'bilinear', 'bicubic', 'spline16', \
+'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', 'catrom', \
+'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos', 'none'} or None
+ """
+ if s is None:
+ s = mpl.rcParams['image.interpolation']
+ s = s.lower()
+ _api.check_in_list(_interpd_, interpolation=s)
+ self._interpolation = s
+ self.stale = True
+
+ def can_composite(self):
+ """Return whether the image can be composited with its neighbors."""
+ trans = self.get_transform()
+ return (
+ self._interpolation != 'none' and
+ trans.is_affine and
+ trans.is_separable)
+
+ def set_resample(self, v):
+ """
+ Set whether image resampling is used.
+
+ Parameters
+ ----------
+ v : bool or None
+ If None, use :rc:`image.resample`.
+ """
+ if v is None:
+ v = mpl.rcParams['image.resample']
+ self._resample = v
+ self.stale = True
+
+ def get_resample(self):
+ """Return whether image resampling is used."""
+ return self._resample
+
+ def set_filternorm(self, filternorm):
+ """
+ Set whether the resize filter normalizes the weights.
+
+ See help for `~.Axes.imshow`.
+
+ Parameters
+ ----------
+ filternorm : bool
+ """
+ self._filternorm = bool(filternorm)
+ self.stale = True
+
+ def get_filternorm(self):
+ """Return whether the resize filter normalizes the weights."""
+ return self._filternorm
+
+ def set_filterrad(self, filterrad):
+ """
+ Set the resize filter radius only applicable to some
+ interpolation schemes -- see help for imshow
+
+ Parameters
+ ----------
+ filterrad : positive float
+ """
+ r = float(filterrad)
+ if r <= 0:
+ raise ValueError("The filter radius must be a positive number")
+ self._filterrad = r
+ self.stale = True
+
+ def get_filterrad(self):
+ """Return the filterrad setting."""
+ return self._filterrad
+
+
+class AxesImage(_ImageBase):
+ """
+ An image attached to an Axes.
+
+ Parameters
+ ----------
+ ax : `~.axes.Axes`
+ The axes the image will belong to.
+ cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
+ The Colormap instance or registered colormap name used to map scalar
+ data to colors.
+ norm : `~matplotlib.colors.Normalize`
+ Maps luminance to 0-1.
+ interpolation : str, default: :rc:`image.interpolation`
+ Supported values are 'none', 'antialiased', 'nearest', 'bilinear',
+ 'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite',
+ 'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell',
+ 'sinc', 'lanczos', 'blackman'.
+ origin : {'upper', 'lower'}, default: :rc:`image.origin`
+ Place the [0, 0] index of the array in the upper left or lower left
+ corner of the axes. The convention 'upper' is typically used for
+ matrices and images.
+ extent : tuple, optional
+ The data axes (left, right, bottom, top) for making image plots
+ registered with data plots. Default is to label the pixel
+ centers with the zero-based row and column indices.
+ filternorm : bool, default: True
+ A parameter for the antigrain image resize filter
+ (see the antigrain documentation).
+ If filternorm is set, the filter normalizes integer values and corrects
+ the rounding errors. It doesn't do anything with the source floating
+ point values, it corrects only integers according to the rule of 1.0
+ which means that any sum of pixel weights must be equal to 1.0. So,
+ the filter function must produce a graph of the proper shape.
+ filterrad : float > 0, default: 4
+ The filter radius for filters that have a radius parameter, i.e. when
+ interpolation is one of: 'sinc', 'lanczos' or 'blackman'.
+ resample : bool, default: False
+ When True, use a full resampling method. When False, only resample when
+ the output image is larger than the input image.
+ **kwargs : `.Artist` properties
+ """
+ def __str__(self):
+ return "AxesImage(%g,%g;%gx%g)" % tuple(self.axes.bbox.bounds)
+
+ def __init__(self, ax,
+ cmap=None,
+ norm=None,
+ interpolation=None,
+ origin=None,
+ extent=None,
+ filternorm=True,
+ filterrad=4.0,
+ resample=False,
+ **kwargs
+ ):
+
+ self._extent = extent
+
+ super().__init__(
+ ax,
+ cmap=cmap,
+ norm=norm,
+ interpolation=interpolation,
+ origin=origin,
+ filternorm=filternorm,
+ filterrad=filterrad,
+ resample=resample,
+ **kwargs
+ )
+
+ def get_window_extent(self, renderer=None):
+ x0, x1, y0, y1 = self._extent
+ bbox = Bbox.from_extents([x0, y0, x1, y1])
+ return bbox.transformed(self.axes.transData)
+
+ def make_image(self, renderer, magnification=1.0, unsampled=False):
+ # docstring inherited
+ trans = self.get_transform()
+ # image is created in the canvas coordinate.
+ x1, x2, y1, y2 = self.get_extent()
+ bbox = Bbox(np.array([[x1, y1], [x2, y2]]))
+ transformed_bbox = TransformedBbox(bbox, trans)
+ clip = ((self.get_clip_box() or self.axes.bbox) if self.get_clip_on()
+ else self.figure.bbox)
+ return self._make_image(self._A, bbox, transformed_bbox, clip,
+ magnification, unsampled=unsampled)
+
+ def _check_unsampled_image(self):
+ """Return whether the image would be better drawn unsampled."""
+ return self.get_interpolation() == "none"
+
+ def set_extent(self, extent):
+ """
+ Set the image extent.
+
+ Parameters
+ ----------
+ extent : 4-tuple of float
+ The position and size of the image as tuple
+ ``(left, right, bottom, top)`` in data coordinates.
+
+ Notes
+ -----
+ This updates ``ax.dataLim``, and, if autoscaling, sets ``ax.viewLim``
+ to tightly fit the image, regardless of ``dataLim``. Autoscaling
+ state is not changed, so following this with ``ax.autoscale_view()``
+ will redo the autoscaling in accord with ``dataLim``.
+ """
+ self._extent = xmin, xmax, ymin, ymax = extent
+ corners = (xmin, ymin), (xmax, ymax)
+ self.axes.update_datalim(corners)
+ self.sticky_edges.x[:] = [xmin, xmax]
+ self.sticky_edges.y[:] = [ymin, ymax]
+ if self.axes._autoscaleXon:
+ self.axes.set_xlim((xmin, xmax), auto=None)
+ if self.axes._autoscaleYon:
+ self.axes.set_ylim((ymin, ymax), auto=None)
+ self.stale = True
+
+ def get_extent(self):
+ """Return the image extent as tuple (left, right, bottom, top)."""
+ if self._extent is not None:
+ return self._extent
+ else:
+ sz = self.get_size()
+ numrows, numcols = sz
+ if self.origin == 'upper':
+ return (-0.5, numcols-0.5, numrows-0.5, -0.5)
+ else:
+ return (-0.5, numcols-0.5, -0.5, numrows-0.5)
+
+ def get_cursor_data(self, event):
+ """
+ Return the image value at the event position or *None* if the event is
+ outside the image.
+
+ See Also
+ --------
+ matplotlib.artist.Artist.get_cursor_data
+ """
+ xmin, xmax, ymin, ymax = self.get_extent()
+ if self.origin == 'upper':
+ ymin, ymax = ymax, ymin
+ arr = self.get_array()
+ data_extent = Bbox([[xmin, ymin], [xmax, ymax]])
+ array_extent = Bbox([[0, 0], [arr.shape[1], arr.shape[0]]])
+ trans = self.get_transform().inverted()
+ trans += BboxTransform(boxin=data_extent, boxout=array_extent)
+ point = trans.transform([event.x, event.y])
+ if any(np.isnan(point)):
+ return None
+ j, i = point.astype(int)
+ # Clip the coordinates at array bounds
+ if not (0 <= i < arr.shape[0]) or not (0 <= j < arr.shape[1]):
+ return None
+ else:
+ return arr[i, j]
+
+ def format_cursor_data(self, data):
+ if np.ndim(data) == 0 and self.colorbar:
+ return (
+ "["
+ + cbook.strip_math(
+ self.colorbar.formatter.format_data_short(data)).strip()
+ + "]")
+ else:
+ return super().format_cursor_data(data)
+
+
+class NonUniformImage(AxesImage):
+ mouseover = False # This class still needs its own get_cursor_data impl.
+
+ def __init__(self, ax, *, interpolation='nearest', **kwargs):
+ """
+ Parameters
+ ----------
+ interpolation : {'nearest', 'bilinear'}, default: 'nearest'
+
+ **kwargs
+ All other keyword arguments are identical to those of `.AxesImage`.
+ """
+ super().__init__(ax, **kwargs)
+ self.set_interpolation(interpolation)
+
+ def _check_unsampled_image(self):
+ """Return False. Do not use unsampled image."""
+ return False
+
+ is_grayscale = _api.deprecate_privatize_attribute("3.3")
+
+ def make_image(self, renderer, magnification=1.0, unsampled=False):
+ # docstring inherited
+ if self._A is None:
+ raise RuntimeError('You must first set the image array')
+ if unsampled:
+ raise ValueError('unsampled not supported on NonUniformImage')
+ A = self._A
+ if A.ndim == 2:
+ if A.dtype != np.uint8:
+ A = self.to_rgba(A, bytes=True)
+ self._is_grayscale = self.cmap.is_gray()
+ else:
+ A = np.repeat(A[:, :, np.newaxis], 4, 2)
+ A[:, :, 3] = 255
+ self._is_grayscale = True
+ else:
+ if A.dtype != np.uint8:
+ A = (255*A).astype(np.uint8)
+ if A.shape[2] == 3:
+ B = np.zeros(tuple([*A.shape[0:2], 4]), np.uint8)
+ B[:, :, 0:3] = A
+ B[:, :, 3] = 255
+ A = B
+ self._is_grayscale = False
+ vl = self.axes.viewLim
+ l, b, r, t = self.axes.bbox.extents
+ width = (round(r) + 0.5) - (round(l) - 0.5)
+ height = (round(t) + 0.5) - (round(b) - 0.5)
+ width *= magnification
+ height *= magnification
+ im = _image.pcolor(self._Ax, self._Ay, A,
+ int(height), int(width),
+ (vl.x0, vl.x1, vl.y0, vl.y1),
+ _interpd_[self._interpolation])
+ return im, l, b, IdentityTransform()
+
+ def set_data(self, x, y, A):
+ """
+ Set the grid for the pixel centers, and the pixel values.
+
+ Parameters
+ ----------
+ x, y : 1D array-like
+ Monotonic arrays of shapes (N,) and (M,), respectively, specifying
+ pixel centers.
+ A : array-like
+ (M, N) ndarray or masked array of values to be colormapped, or
+ (M, N, 3) RGB array, or (M, N, 4) RGBA array.
+ """
+ x = np.array(x, np.float32)
+ y = np.array(y, np.float32)
+ A = cbook.safe_masked_invalid(A, copy=True)
+ if not (x.ndim == y.ndim == 1 and A.shape[0:2] == y.shape + x.shape):
+ raise TypeError("Axes don't match array shape")
+ if A.ndim not in [2, 3]:
+ raise TypeError("Can only plot 2D or 3D data")
+ if A.ndim == 3 and A.shape[2] not in [1, 3, 4]:
+ raise TypeError("3D arrays must have three (RGB) "
+ "or four (RGBA) color components")
+ if A.ndim == 3 and A.shape[2] == 1:
+ A = A.squeeze(axis=-1)
+ self._A = A
+ self._Ax = x
+ self._Ay = y
+ self._imcache = None
+
+ self.stale = True
+
+ def set_array(self, *args):
+ raise NotImplementedError('Method not supported')
+
+ def set_interpolation(self, s):
+ """
+ Parameters
+ ----------
+ s : {'nearest', 'bilinear'} or None
+ If None, use :rc:`image.interpolation`.
+ """
+ if s is not None and s not in ('nearest', 'bilinear'):
+ raise NotImplementedError('Only nearest neighbor and '
+ 'bilinear interpolations are supported')
+ super().set_interpolation(s)
+
+ def get_extent(self):
+ if self._A is None:
+ raise RuntimeError('Must set data first')
+ return self._Ax[0], self._Ax[-1], self._Ay[0], self._Ay[-1]
+
+ def set_filternorm(self, s):
+ pass
+
+ def set_filterrad(self, s):
+ pass
+
+ def set_norm(self, norm):
+ if self._A is not None:
+ raise RuntimeError('Cannot change colors after loading data')
+ super().set_norm(norm)
+
+ def set_cmap(self, cmap):
+ if self._A is not None:
+ raise RuntimeError('Cannot change colors after loading data')
+ super().set_cmap(cmap)
+
+
+class PcolorImage(AxesImage):
+ """
+ Make a pcolor-style plot with an irregular rectangular grid.
+
+ This uses a variation of the original irregular image code,
+ and it is used by pcolorfast for the corresponding grid type.
+ """
+ def __init__(self, ax,
+ x=None,
+ y=None,
+ A=None,
+ cmap=None,
+ norm=None,
+ **kwargs
+ ):
+ """
+ Parameters
+ ----------
+ ax : `~.axes.Axes`
+ The axes the image will belong to.
+ x, y : 1D array-like, optional
+ Monotonic arrays of length N+1 and M+1, respectively, specifying
+ rectangle boundaries. If not given, will default to
+ ``range(N + 1)`` and ``range(M + 1)``, respectively.
+ A : array-like
+ The data to be color-coded. The interpretation depends on the
+ shape:
+
+ - (M, N) ndarray or masked array: values to be colormapped
+ - (M, N, 3): RGB array
+ - (M, N, 4): RGBA array
+
+ cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
+ The Colormap instance or registered colormap name used to map
+ scalar data to colors.
+ norm : `~matplotlib.colors.Normalize`
+ Maps luminance to 0-1.
+ **kwargs : `.Artist` properties
+ """
+ super().__init__(ax, norm=norm, cmap=cmap)
+ self.update(kwargs)
+ if A is not None:
+ self.set_data(x, y, A)
+
+ is_grayscale = _api.deprecate_privatize_attribute("3.3")
+
+ def make_image(self, renderer, magnification=1.0, unsampled=False):
+ # docstring inherited
+ if self._A is None:
+ raise RuntimeError('You must first set the image array')
+ if unsampled:
+ raise ValueError('unsampled not supported on PColorImage')
+ fc = self.axes.patch.get_facecolor()
+ bg = mcolors.to_rgba(fc, 0)
+ bg = (np.array(bg)*255).astype(np.uint8)
+ l, b, r, t = self.axes.bbox.extents
+ width = (round(r) + 0.5) - (round(l) - 0.5)
+ height = (round(t) + 0.5) - (round(b) - 0.5)
+ width = int(round(width * magnification))
+ height = int(round(height * magnification))
+ if self._rgbacache is None:
+ A = self.to_rgba(self._A, bytes=True)
+ self._rgbacache = A
+ if self._A.ndim == 2:
+ self._is_grayscale = self.cmap.is_gray()
+ else:
+ A = self._rgbacache
+ vl = self.axes.viewLim
+ im = _image.pcolor2(self._Ax, self._Ay, A,
+ height,
+ width,
+ (vl.x0, vl.x1, vl.y0, vl.y1),
+ bg)
+ return im, l, b, IdentityTransform()
+
+ def _check_unsampled_image(self):
+ return False
+
+ def set_data(self, x, y, A):
+ """
+ Set the grid for the rectangle boundaries, and the data values.
+
+ Parameters
+ ----------
+ x, y : 1D array-like, optional
+ Monotonic arrays of length N+1 and M+1, respectively, specifying
+ rectangle boundaries. If not given, will default to
+ ``range(N + 1)`` and ``range(M + 1)``, respectively.
+ A : array-like
+ The data to be color-coded. The interpretation depends on the
+ shape:
+
+ - (M, N) ndarray or masked array: values to be colormapped
+ - (M, N, 3): RGB array
+ - (M, N, 4): RGBA array
+ """
+ A = cbook.safe_masked_invalid(A, copy=True)
+ if x is None:
+ x = np.arange(0, A.shape[1]+1, dtype=np.float64)
+ else:
+ x = np.array(x, np.float64).ravel()
+ if y is None:
+ y = np.arange(0, A.shape[0]+1, dtype=np.float64)
+ else:
+ y = np.array(y, np.float64).ravel()
+
+ if A.shape[:2] != (y.size-1, x.size-1):
+ raise ValueError(
+ "Axes don't match array shape. Got %s, expected %s." %
+ (A.shape[:2], (y.size - 1, x.size - 1)))
+ if A.ndim not in [2, 3]:
+ raise ValueError("A must be 2D or 3D")
+ if A.ndim == 3 and A.shape[2] == 1:
+ A = A.squeeze(axis=-1)
+ self._is_grayscale = False
+ if A.ndim == 3:
+ if A.shape[2] in [3, 4]:
+ if ((A[:, :, 0] == A[:, :, 1]).all() and
+ (A[:, :, 0] == A[:, :, 2]).all()):
+ self._is_grayscale = True
+ else:
+ raise ValueError("3D arrays must have RGB or RGBA as last dim")
+
+ # For efficient cursor readout, ensure x and y are increasing.
+ if x[-1] < x[0]:
+ x = x[::-1]
+ A = A[:, ::-1]
+ if y[-1] < y[0]:
+ y = y[::-1]
+ A = A[::-1]
+
+ self._A = A
+ self._Ax = x
+ self._Ay = y
+ self._rgbacache = None
+ self.stale = True
+
+ def set_array(self, *args):
+ raise NotImplementedError('Method not supported')
+
+ def get_cursor_data(self, event):
+ # docstring inherited
+ x, y = event.xdata, event.ydata
+ if (x < self._Ax[0] or x > self._Ax[-1] or
+ y < self._Ay[0] or y > self._Ay[-1]):
+ return None
+ j = np.searchsorted(self._Ax, x) - 1
+ i = np.searchsorted(self._Ay, y) - 1
+ try:
+ return self._A[i, j]
+ except IndexError:
+ return None
+
+
+class FigureImage(_ImageBase):
+ """An image attached to a figure."""
+
+ zorder = 0
+
+ _interpolation = 'nearest'
+
+ def __init__(self, fig,
+ cmap=None,
+ norm=None,
+ offsetx=0,
+ offsety=0,
+ origin=None,
+ **kwargs
+ ):
+ """
+ cmap is a colors.Colormap instance
+ norm is a colors.Normalize instance to map luminance to 0-1
+
+ kwargs are an optional list of Artist keyword args
+ """
+ super().__init__(
+ None,
+ norm=norm,
+ cmap=cmap,
+ origin=origin
+ )
+ self.figure = fig
+ self.ox = offsetx
+ self.oy = offsety
+ self.update(kwargs)
+ self.magnification = 1.0
+
+ def get_extent(self):
+ """Return the image extent as tuple (left, right, bottom, top)."""
+ numrows, numcols = self.get_size()
+ return (-0.5 + self.ox, numcols-0.5 + self.ox,
+ -0.5 + self.oy, numrows-0.5 + self.oy)
+
+ def make_image(self, renderer, magnification=1.0, unsampled=False):
+ # docstring inherited
+ fac = renderer.dpi/self.figure.dpi
+ # fac here is to account for pdf, eps, svg backends where
+ # figure.dpi is set to 72. This means we need to scale the
+ # image (using magnification) and offset it appropriately.
+ bbox = Bbox([[self.ox/fac, self.oy/fac],
+ [(self.ox/fac + self._A.shape[1]),
+ (self.oy/fac + self._A.shape[0])]])
+ width, height = self.figure.get_size_inches()
+ width *= renderer.dpi
+ height *= renderer.dpi
+ clip = Bbox([[0, 0], [width, height]])
+ return self._make_image(
+ self._A, bbox, bbox, clip, magnification=magnification / fac,
+ unsampled=unsampled, round_to_pixel_border=False)
+
+ def set_data(self, A):
+ """Set the image array."""
+ cm.ScalarMappable.set_array(self,
+ cbook.safe_masked_invalid(A, copy=True))
+ self.stale = True
+
+
+class BboxImage(_ImageBase):
+ """The Image class whose size is determined by the given bbox."""
+
+ def __init__(self, bbox,
+ cmap=None,
+ norm=None,
+ interpolation=None,
+ origin=None,
+ filternorm=True,
+ filterrad=4.0,
+ resample=False,
+ **kwargs
+ ):
+ """
+ cmap is a colors.Colormap instance
+ norm is a colors.Normalize instance to map luminance to 0-1
+
+ kwargs are an optional list of Artist keyword args
+ """
+ super().__init__(
+ None,
+ cmap=cmap,
+ norm=norm,
+ interpolation=interpolation,
+ origin=origin,
+ filternorm=filternorm,
+ filterrad=filterrad,
+ resample=resample,
+ **kwargs
+ )
+ self.bbox = bbox
+
+ def get_window_extent(self, renderer=None):
+ if renderer is None:
+ renderer = self.get_figure()._cachedRenderer
+
+ if isinstance(self.bbox, BboxBase):
+ return self.bbox
+ elif callable(self.bbox):
+ return self.bbox(renderer)
+ else:
+ raise ValueError("Unknown type of bbox")
+
+ def contains(self, mouseevent):
+ """Test whether the mouse event occurred within the image."""
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+
+ if not self.get_visible(): # or self.get_figure()._renderer is None:
+ return False, {}
+
+ x, y = mouseevent.x, mouseevent.y
+ inside = self.get_window_extent().contains(x, y)
+
+ return inside, {}
+
+ def make_image(self, renderer, magnification=1.0, unsampled=False):
+ # docstring inherited
+ width, height = renderer.get_canvas_width_height()
+ bbox_in = self.get_window_extent(renderer).frozen()
+ bbox_in._points /= [width, height]
+ bbox_out = self.get_window_extent(renderer)
+ clip = Bbox([[0, 0], [width, height]])
+ self._transform = BboxTransformTo(clip)
+ return self._make_image(
+ self._A,
+ bbox_in, bbox_out, clip, magnification, unsampled=unsampled)
+
+
+def imread(fname, format=None):
+ """
+ Read an image from a file into an array.
+
+ Parameters
+ ----------
+ fname : str or file-like
+ The image file to read: a filename, a URL or a file-like object opened
+ in read-binary mode.
+
+ Passing a URL is deprecated. Please open the URL
+ for reading and pass the result to Pillow, e.g. with
+ ``PIL.Image.open(urllib.request.urlopen(url))``.
+ format : str, optional
+ The image file format assumed for reading the data. If not
+ given, the format is deduced from the filename. If nothing can
+ be deduced, PNG is tried.
+
+ Returns
+ -------
+ `numpy.array`
+ The image data. The returned array has shape
+
+ - (M, N) for grayscale images.
+ - (M, N, 3) for RGB images.
+ - (M, N, 4) for RGBA images.
+ """
+ # hide imports to speed initial import on systems with slow linkers
+ from urllib import parse
+
+ if format is None:
+ if isinstance(fname, str):
+ parsed = parse.urlparse(fname)
+ # If the string is a URL (Windows paths appear as if they have a
+ # length-1 scheme), assume png.
+ if len(parsed.scheme) > 1:
+ ext = 'png'
+ else:
+ ext = Path(fname).suffix.lower()[1:]
+ elif hasattr(fname, 'geturl'): # Returned by urlopen().
+ # We could try to parse the url's path and use the extension, but
+ # returning png is consistent with the block above. Note that this
+ # if clause has to come before checking for fname.name as
+ # urlopen("file:///...") also has a name attribute (with the fixed
+ # value "").
+ ext = 'png'
+ elif hasattr(fname, 'name'):
+ ext = Path(fname.name).suffix.lower()[1:]
+ else:
+ ext = 'png'
+ else:
+ ext = format
+ img_open = (
+ PIL.PngImagePlugin.PngImageFile if ext == 'png' else PIL.Image.open)
+ if isinstance(fname, str):
+ parsed = parse.urlparse(fname)
+ if len(parsed.scheme) > 1: # Pillow doesn't handle URLs directly.
+ _api.warn_deprecated(
+ "3.4", message="Directly reading images from URLs is "
+ "deprecated since %(since)s and will no longer be supported "
+ "%(removal)s. Please open the URL for reading and pass the "
+ "result to Pillow, e.g. with "
+ "``PIL.Image.open(urllib.request.urlopen(url))``.")
+ # hide imports to speed initial import on systems with slow linkers
+ from urllib import request
+ ssl_ctx = mpl._get_ssl_context()
+ if ssl_ctx is None:
+ _log.debug(
+ "Could not get certifi ssl context, https may not work."
+ )
+ with request.urlopen(fname, context=ssl_ctx) as response:
+ import io
+ try:
+ response.seek(0)
+ except (AttributeError, io.UnsupportedOperation):
+ response = io.BytesIO(response.read())
+ return imread(response, format=ext)
+ with img_open(fname) as image:
+ return (_pil_png_to_float_array(image)
+ if isinstance(image, PIL.PngImagePlugin.PngImageFile) else
+ pil_to_array(image))
+
+
+def imsave(fname, arr, vmin=None, vmax=None, cmap=None, format=None,
+ origin=None, dpi=100, *, metadata=None, pil_kwargs=None):
+ """
+ Save an array as an image file.
+
+ Parameters
+ ----------
+ fname : str or path-like or file-like
+ A path or a file-like object to store the image in.
+ If *format* is not set, then the output format is inferred from the
+ extension of *fname*, if any, and from :rc:`savefig.format` otherwise.
+ If *format* is set, it determines the output format.
+ arr : array-like
+ The image data. The shape can be one of
+ MxN (luminance), MxNx3 (RGB) or MxNx4 (RGBA).
+ vmin, vmax : float, optional
+ *vmin* and *vmax* set the color scaling for the image by fixing the
+ values that map to the colormap color limits. If either *vmin*
+ or *vmax* is None, that limit is determined from the *arr*
+ min/max value.
+ cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
+ A Colormap instance or registered colormap name. The colormap
+ maps scalar data to colors. It is ignored for RGB(A) data.
+ format : str, optional
+ The file format, e.g. 'png', 'pdf', 'svg', ... The behavior when this
+ is unset is documented under *fname*.
+ origin : {'upper', 'lower'}, default: :rc:`image.origin`
+ Indicates whether the ``(0, 0)`` index of the array is in the upper
+ left or lower left corner of the axes.
+ dpi : float
+ The DPI to store in the metadata of the file. This does not affect the
+ resolution of the output image. Depending on file format, this may be
+ rounded to the nearest integer.
+ metadata : dict, optional
+ Metadata in the image file. The supported keys depend on the output
+ format, see the documentation of the respective backends for more
+ information.
+ pil_kwargs : dict, optional
+ Keyword arguments passed to `PIL.Image.Image.save`. If the 'pnginfo'
+ key is present, it completely overrides *metadata*, including the
+ default 'Software' key.
+ """
+ from matplotlib.figure import Figure
+ if isinstance(fname, os.PathLike):
+ fname = os.fspath(fname)
+ if format is None:
+ format = (Path(fname).suffix[1:] if isinstance(fname, str)
+ else mpl.rcParams["savefig.format"]).lower()
+ if format in ["pdf", "ps", "eps", "svg"]:
+ # Vector formats that are not handled by PIL.
+ if pil_kwargs is not None:
+ raise ValueError(
+ f"Cannot use 'pil_kwargs' when saving to {format}")
+ fig = Figure(dpi=dpi, frameon=False)
+ fig.figimage(arr, cmap=cmap, vmin=vmin, vmax=vmax, origin=origin,
+ resize=True)
+ fig.savefig(fname, dpi=dpi, format=format, transparent=True,
+ metadata=metadata)
+ else:
+ # Don't bother creating an image; this avoids rounding errors on the
+ # size when dividing and then multiplying by dpi.
+ sm = cm.ScalarMappable(cmap=cmap)
+ sm.set_clim(vmin, vmax)
+ if origin is None:
+ origin = mpl.rcParams["image.origin"]
+ if origin == "lower":
+ arr = arr[::-1]
+ if (isinstance(arr, memoryview) and arr.format == "B"
+ and arr.ndim == 3 and arr.shape[-1] == 4):
+ # Such an ``arr`` would also be handled fine by sm.to_rgba (after
+ # casting with asarray), but it is useful to special-case it
+ # because that's what backend_agg passes, and can be in fact used
+ # as is, saving a few operations.
+ rgba = arr
+ else:
+ rgba = sm.to_rgba(arr, bytes=True)
+ if pil_kwargs is None:
+ pil_kwargs = {}
+ pil_shape = (rgba.shape[1], rgba.shape[0])
+ image = PIL.Image.frombuffer(
+ "RGBA", pil_shape, rgba, "raw", "RGBA", 0, 1)
+ if format == "png":
+ # Only use the metadata kwarg if pnginfo is not set, because the
+ # semantics of duplicate keys in pnginfo is unclear.
+ if "pnginfo" in pil_kwargs:
+ if metadata:
+ _api.warn_external("'metadata' is overridden by the "
+ "'pnginfo' entry in 'pil_kwargs'.")
+ else:
+ metadata = {
+ "Software": (f"Matplotlib version{mpl.__version__}, "
+ f"https://matplotlib.org/"),
+ **(metadata if metadata is not None else {}),
+ }
+ pil_kwargs["pnginfo"] = pnginfo = PIL.PngImagePlugin.PngInfo()
+ for k, v in metadata.items():
+ if v is not None:
+ pnginfo.add_text(k, v)
+ if format in ["jpg", "jpeg"]:
+ format = "jpeg" # Pillow doesn't recognize "jpg".
+ facecolor = mpl.rcParams["savefig.facecolor"]
+ if cbook._str_equal(facecolor, "auto"):
+ facecolor = mpl.rcParams["figure.facecolor"]
+ color = tuple(int(x * 255) for x in mcolors.to_rgb(facecolor))
+ background = PIL.Image.new("RGB", pil_shape, color)
+ background.paste(image, image)
+ image = background
+ pil_kwargs.setdefault("format", format)
+ pil_kwargs.setdefault("dpi", (dpi, dpi))
+ image.save(fname, **pil_kwargs)
+
+
+def pil_to_array(pilImage):
+ """
+ Load a `PIL image`_ and return it as a numpy int array.
+
+ .. _PIL image: https://pillow.readthedocs.io/en/latest/reference/Image.html
+
+ Returns
+ -------
+ numpy.array
+
+ The array shape depends on the image type:
+
+ - (M, N) for grayscale images.
+ - (M, N, 3) for RGB images.
+ - (M, N, 4) for RGBA images.
+ """
+ if pilImage.mode in ['RGBA', 'RGBX', 'RGB', 'L']:
+ # return MxNx4 RGBA, MxNx3 RBA, or MxN luminance array
+ return np.asarray(pilImage)
+ elif pilImage.mode.startswith('I;16'):
+ # return MxN luminance array of uint16
+ raw = pilImage.tobytes('raw', pilImage.mode)
+ if pilImage.mode.endswith('B'):
+ x = np.frombuffer(raw, '>u2')
+ else:
+ x = np.frombuffer(raw, '`.
+
+The `Legend` class is a container of legend handles and legend texts.
+
+The legend handler map specifies how to create legend handles from artists
+(lines, patches, etc.) in the axes or figures. Default legend handlers are
+defined in the :mod:`~matplotlib.legend_handler` module. While not all artist
+types are covered by the default legend handlers, custom legend handlers can be
+defined to support arbitrary objects.
+
+See the :doc:`legend guide ` for more
+information.
+"""
+
+import itertools
+import logging
+import time
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib import _api, docstring, colors
+from matplotlib.artist import Artist, allow_rasterization
+from matplotlib.cbook import silent_list
+from matplotlib.font_manager import FontProperties
+from matplotlib.lines import Line2D
+from matplotlib.patches import (Patch, Rectangle, Shadow, FancyBboxPatch,
+ StepPatch)
+from matplotlib.collections import (LineCollection, RegularPolyCollection,
+ CircleCollection, PathCollection,
+ PolyCollection)
+from matplotlib.transforms import Bbox, BboxBase, TransformedBbox
+from matplotlib.transforms import BboxTransformTo, BboxTransformFrom
+
+from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea
+from matplotlib.offsetbox import DraggableOffsetBox
+
+from matplotlib.container import ErrorbarContainer, BarContainer, StemContainer
+from . import legend_handler
+
+
+class DraggableLegend(DraggableOffsetBox):
+ def __init__(self, legend, use_blit=False, update="loc"):
+ """
+ Wrapper around a `.Legend` to support mouse dragging.
+
+ Parameters
+ ----------
+ legend : `.Legend`
+ The `.Legend` instance to wrap.
+ use_blit : bool, optional
+ Use blitting for faster image composition. For details see
+ :ref:`func-animation`.
+ update : {'loc', 'bbox'}, optional
+ If "loc", update the *loc* parameter of the legend upon finalizing.
+ If "bbox", update the *bbox_to_anchor* parameter.
+ """
+ self.legend = legend
+
+ _api.check_in_list(["loc", "bbox"], update=update)
+ self._update = update
+
+ super().__init__(legend, legend._legend_box, use_blit=use_blit)
+
+ def finalize_offset(self):
+ if self._update == "loc":
+ self._update_loc(self.get_loc_in_canvas())
+ elif self._update == "bbox":
+ self._bbox_to_anchor(self.get_loc_in_canvas())
+
+ def _update_loc(self, loc_in_canvas):
+ bbox = self.legend.get_bbox_to_anchor()
+ # if bbox has zero width or height, the transformation is
+ # ill-defined. Fall back to the default bbox_to_anchor.
+ if bbox.width == 0 or bbox.height == 0:
+ self.legend.set_bbox_to_anchor(None)
+ bbox = self.legend.get_bbox_to_anchor()
+ _bbox_transform = BboxTransformFrom(bbox)
+ self.legend._loc = tuple(_bbox_transform.transform(loc_in_canvas))
+
+ def _update_bbox_to_anchor(self, loc_in_canvas):
+ loc_in_bbox = self.legend.axes.transAxes.transform(loc_in_canvas)
+ self.legend.set_bbox_to_anchor(loc_in_bbox)
+
+
+docstring.interpd.update(_legend_kw_doc="""
+loc : str or pair of floats, default: :rc:`legend.loc` ('best' for axes, \
+'upper right' for figures)
+ The location of the legend.
+
+ The strings
+ ``'upper left', 'upper right', 'lower left', 'lower right'``
+ place the legend at the corresponding corner of the axes/figure.
+
+ The strings
+ ``'upper center', 'lower center', 'center left', 'center right'``
+ place the legend at the center of the corresponding edge of the
+ axes/figure.
+
+ The string ``'center'`` places the legend at the center of the axes/figure.
+
+ The string ``'best'`` places the legend at the location, among the nine
+ locations defined so far, with the minimum overlap with other drawn
+ artists. This option can be quite slow for plots with large amounts of
+ data; your plotting speed may benefit from providing a specific location.
+
+ The location can also be a 2-tuple giving the coordinates of the lower-left
+ corner of the legend in axes coordinates (in which case *bbox_to_anchor*
+ will be ignored).
+
+ For back-compatibility, ``'center right'`` (but no other location) can also
+ be spelled ``'right'``, and each "string" locations can also be given as a
+ numeric value:
+
+ =============== =============
+ Location String Location Code
+ =============== =============
+ 'best' 0
+ 'upper right' 1
+ 'upper left' 2
+ 'lower left' 3
+ 'lower right' 4
+ 'right' 5
+ 'center left' 6
+ 'center right' 7
+ 'lower center' 8
+ 'upper center' 9
+ 'center' 10
+ =============== =============
+
+bbox_to_anchor : `.BboxBase`, 2-tuple, or 4-tuple of floats
+ Box that is used to position the legend in conjunction with *loc*.
+ Defaults to `axes.bbox` (if called as a method to `.Axes.legend`) or
+ `figure.bbox` (if `.Figure.legend`). This argument allows arbitrary
+ placement of the legend.
+
+ Bbox coordinates are interpreted in the coordinate system given by
+ *bbox_transform*, with the default transform
+ Axes or Figure coordinates, depending on which ``legend`` is called.
+
+ If a 4-tuple or `.BboxBase` is given, then it specifies the bbox
+ ``(x, y, width, height)`` that the legend is placed in.
+ To put the legend in the best location in the bottom right
+ quadrant of the axes (or figure)::
+
+ loc='best', bbox_to_anchor=(0.5, 0., 0.5, 0.5)
+
+ A 2-tuple ``(x, y)`` places the corner of the legend specified by *loc* at
+ x, y. For example, to put the legend's upper right-hand corner in the
+ center of the axes (or figure) the following keywords can be used::
+
+ loc='upper right', bbox_to_anchor=(0.5, 0.5)
+
+ncol : int, default: 1
+ The number of columns that the legend has.
+
+prop : None or `matplotlib.font_manager.FontProperties` or dict
+ The font properties of the legend. If None (default), the current
+ :data:`matplotlib.rcParams` will be used.
+
+fontsize : int or {'xx-small', 'x-small', 'small', 'medium', 'large', \
+'x-large', 'xx-large'}
+ The font size of the legend. If the value is numeric the size will be the
+ absolute font size in points. String values are relative to the current
+ default font size. This argument is only used if *prop* is not specified.
+
+labelcolor : str or list
+ The color of the text in the legend. Either a valid color string
+ (for example, 'red'), or a list of color strings. The labelcolor can
+ also be made to match the color of the line or marker using 'linecolor',
+ 'markerfacecolor' (or 'mfc'), or 'markeredgecolor' (or 'mec').
+
+numpoints : int, default: :rc:`legend.numpoints`
+ The number of marker points in the legend when creating a legend
+ entry for a `.Line2D` (line).
+
+scatterpoints : int, default: :rc:`legend.scatterpoints`
+ The number of marker points in the legend when creating
+ a legend entry for a `.PathCollection` (scatter plot).
+
+scatteryoffsets : iterable of floats, default: ``[0.375, 0.5, 0.3125]``
+ The vertical offset (relative to the font size) for the markers
+ created for a scatter plot legend entry. 0.0 is at the base the
+ legend text, and 1.0 is at the top. To draw all markers at the
+ same height, set to ``[0.5]``.
+
+markerscale : float, default: :rc:`legend.markerscale`
+ The relative size of legend markers compared with the originally
+ drawn ones.
+
+markerfirst : bool, default: True
+ If *True*, legend marker is placed to the left of the legend label.
+ If *False*, legend marker is placed to the right of the legend label.
+
+frameon : bool, default: :rc:`legend.frameon`
+ Whether the legend should be drawn on a patch (frame).
+
+fancybox : bool, default: :rc:`legend.fancybox`
+ Whether round edges should be enabled around the `~.FancyBboxPatch` which
+ makes up the legend's background.
+
+shadow : bool, default: :rc:`legend.shadow`
+ Whether to draw a shadow behind the legend.
+
+framealpha : float, default: :rc:`legend.framealpha`
+ The alpha transparency of the legend's background.
+ If *shadow* is activated and *framealpha* is ``None``, the default value is
+ ignored.
+
+facecolor : "inherit" or color, default: :rc:`legend.facecolor`
+ The legend's background color.
+ If ``"inherit"``, use :rc:`axes.facecolor`.
+
+edgecolor : "inherit" or color, default: :rc:`legend.edgecolor`
+ The legend's background patch edge color.
+ If ``"inherit"``, use take :rc:`axes.edgecolor`.
+
+mode : {"expand", None}
+ If *mode* is set to ``"expand"`` the legend will be horizontally
+ expanded to fill the axes area (or *bbox_to_anchor* if defines
+ the legend's size).
+
+bbox_transform : None or `matplotlib.transforms.Transform`
+ The transform for the bounding box (*bbox_to_anchor*). For a value
+ of ``None`` (default) the Axes'
+ :data:`~matplotlib.axes.Axes.transAxes` transform will be used.
+
+title : str or None
+ The legend's title. Default is no title (``None``).
+
+title_fontsize : int or {'xx-small', 'x-small', 'small', 'medium', 'large', \
+'x-large', 'xx-large'}, default: :rc:`legend.title_fontsize`
+ The font size of the legend's title.
+
+borderpad : float, default: :rc:`legend.borderpad`
+ The fractional whitespace inside the legend border, in font-size units.
+
+labelspacing : float, default: :rc:`legend.labelspacing`
+ The vertical space between the legend entries, in font-size units.
+
+handlelength : float, default: :rc:`legend.handlelength`
+ The length of the legend handles, in font-size units.
+
+handletextpad : float, default: :rc:`legend.handletextpad`
+ The pad between the legend handle and text, in font-size units.
+
+borderaxespad : float, default: :rc:`legend.borderaxespad`
+ The pad between the axes and legend border, in font-size units.
+
+columnspacing : float, default: :rc:`legend.columnspacing`
+ The spacing between columns, in font-size units.
+
+handler_map : dict or None
+ The custom dictionary mapping instances or types to a legend
+ handler. This *handler_map* updates the default handler map
+ found at `matplotlib.legend.Legend.get_legend_handler_map`.
+""")
+
+
+class Legend(Artist):
+ """
+ Place a legend on the axes at location loc.
+
+ """
+ codes = {'best': 0, # only implemented for axes legends
+ 'upper right': 1,
+ 'upper left': 2,
+ 'lower left': 3,
+ 'lower right': 4,
+ 'right': 5,
+ 'center left': 6,
+ 'center right': 7,
+ 'lower center': 8,
+ 'upper center': 9,
+ 'center': 10,
+ }
+
+ zorder = 5
+
+ def __str__(self):
+ return "Legend"
+
+ @docstring.dedent_interpd
+ def __init__(self, parent, handles, labels,
+ loc=None,
+ numpoints=None, # the number of points in the legend line
+ markerscale=None, # the relative size of legend markers
+ # vs. original
+ markerfirst=True, # controls ordering (left-to-right) of
+ # legend marker and label
+ scatterpoints=None, # number of scatter points
+ scatteryoffsets=None,
+ prop=None, # properties for the legend texts
+ fontsize=None, # keyword to set font size directly
+ labelcolor=None, # keyword to set the text color
+
+ # spacing & pad defined as a fraction of the font-size
+ borderpad=None, # the whitespace inside the legend border
+ labelspacing=None, # the vertical space between the legend
+ # entries
+ handlelength=None, # the length of the legend handles
+ handleheight=None, # the height of the legend handles
+ handletextpad=None, # the pad between the legend handle
+ # and text
+ borderaxespad=None, # the pad between the axes and legend
+ # border
+ columnspacing=None, # spacing between columns
+
+ ncol=1, # number of columns
+ mode=None, # mode for horizontal distribution of columns.
+ # None, "expand"
+
+ fancybox=None, # True use a fancy box, false use a rounded
+ # box, none use rc
+ shadow=None,
+ title=None, # set a title for the legend
+ title_fontsize=None, # the font size for the title
+ framealpha=None, # set frame alpha
+ edgecolor=None, # frame patch edgecolor
+ facecolor=None, # frame patch facecolor
+
+ bbox_to_anchor=None, # bbox that the legend will be anchored.
+ bbox_transform=None, # transform for the bbox
+ frameon=None, # draw frame
+ handler_map=None,
+ ):
+ """
+ Parameters
+ ----------
+ parent : `~matplotlib.axes.Axes` or `.Figure`
+ The artist that contains the legend.
+
+ handles : list of `.Artist`
+ A list of Artists (lines, patches) to be added to the legend.
+
+ labels : list of str
+ A list of labels to show next to the artists. The length of handles
+ and labels should be the same. If they are not, they are truncated
+ to the smaller of both lengths.
+
+ Other Parameters
+ ----------------
+ %(_legend_kw_doc)s
+
+ Notes
+ -----
+ Users can specify any arbitrary location for the legend using the
+ *bbox_to_anchor* keyword argument. *bbox_to_anchor* can be a
+ `.BboxBase` (or derived therefrom) or a tuple of 2 or 4 floats.
+ See `set_bbox_to_anchor` for more detail.
+
+ The legend location can be specified by setting *loc* with a tuple of
+ 2 floats, which is interpreted as the lower-left corner of the legend
+ in the normalized axes coordinate.
+ """
+ # local import only to avoid circularity
+ from matplotlib.axes import Axes
+ from matplotlib.figure import Figure
+
+ super().__init__()
+
+ if prop is None:
+ if fontsize is not None:
+ self.prop = FontProperties(size=fontsize)
+ else:
+ self.prop = FontProperties(
+ size=mpl.rcParams["legend.fontsize"])
+ else:
+ self.prop = FontProperties._from_any(prop)
+ if isinstance(prop, dict) and "size" not in prop:
+ self.prop.set_size(mpl.rcParams["legend.fontsize"])
+
+ self._fontsize = self.prop.get_size_in_points()
+
+ self.texts = []
+ self.legendHandles = []
+ self._legend_title_box = None
+
+ #: A dictionary with the extra handler mappings for this Legend
+ #: instance.
+ self._custom_handler_map = handler_map
+
+ locals_view = locals()
+ for name in ["numpoints", "markerscale", "shadow", "columnspacing",
+ "scatterpoints", "handleheight", 'borderpad',
+ 'labelspacing', 'handlelength', 'handletextpad',
+ 'borderaxespad']:
+ if locals_view[name] is None:
+ value = mpl.rcParams["legend." + name]
+ else:
+ value = locals_view[name]
+ setattr(self, name, value)
+ del locals_view
+ # trim handles and labels if illegal label...
+ _lab, _hand = [], []
+ for label, handle in zip(labels, handles):
+ if isinstance(label, str) and label.startswith('_'):
+ _api.warn_external('The handle {!r} has a label of {!r} '
+ 'which cannot be automatically added to'
+ ' the legend.'.format(handle, label))
+ else:
+ _lab.append(label)
+ _hand.append(handle)
+ labels, handles = _lab, _hand
+
+ handles = list(handles)
+ if len(handles) < 2:
+ ncol = 1
+ self._ncol = ncol
+
+ if self.numpoints <= 0:
+ raise ValueError("numpoints must be > 0; it was %d" % numpoints)
+
+ # introduce y-offset for handles of the scatter plot
+ if scatteryoffsets is None:
+ self._scatteryoffsets = np.array([3. / 8., 4. / 8., 2.5 / 8.])
+ else:
+ self._scatteryoffsets = np.asarray(scatteryoffsets)
+ reps = self.scatterpoints // len(self._scatteryoffsets) + 1
+ self._scatteryoffsets = np.tile(self._scatteryoffsets,
+ reps)[:self.scatterpoints]
+
+ # _legend_box is a VPacker instance that contains all
+ # legend items and will be initialized from _init_legend_box()
+ # method.
+ self._legend_box = None
+
+ if isinstance(parent, Axes):
+ self.isaxes = True
+ self.axes = parent
+ self.set_figure(parent.figure)
+ elif isinstance(parent, Figure):
+ self.isaxes = False
+ self.set_figure(parent)
+ else:
+ raise TypeError("Legend needs either Axes or Figure as parent")
+ self.parent = parent
+
+ self._loc_used_default = loc is None
+ if loc is None:
+ loc = mpl.rcParams["legend.loc"]
+ if not self.isaxes and loc in [0, 'best']:
+ loc = 'upper right'
+ if isinstance(loc, str):
+ if loc not in self.codes:
+ raise ValueError(
+ "Unrecognized location {!r}. Valid locations are\n\t{}\n"
+ .format(loc, '\n\t'.join(self.codes)))
+ else:
+ loc = self.codes[loc]
+ if not self.isaxes and loc == 0:
+ raise ValueError(
+ "Automatic legend placement (loc='best') not implemented for "
+ "figure legend.")
+
+ self._mode = mode
+ self.set_bbox_to_anchor(bbox_to_anchor, bbox_transform)
+
+ # We use FancyBboxPatch to draw a legend frame. The location
+ # and size of the box will be updated during the drawing time.
+
+ if facecolor is None:
+ facecolor = mpl.rcParams["legend.facecolor"]
+ if facecolor == 'inherit':
+ facecolor = mpl.rcParams["axes.facecolor"]
+
+ if edgecolor is None:
+ edgecolor = mpl.rcParams["legend.edgecolor"]
+ if edgecolor == 'inherit':
+ edgecolor = mpl.rcParams["axes.edgecolor"]
+
+ if fancybox is None:
+ fancybox = mpl.rcParams["legend.fancybox"]
+
+ self.legendPatch = FancyBboxPatch(
+ xy=(0, 0), width=1, height=1,
+ facecolor=facecolor, edgecolor=edgecolor,
+ # If shadow is used, default to alpha=1 (#8943).
+ alpha=(framealpha if framealpha is not None
+ else 1 if shadow
+ else mpl.rcParams["legend.framealpha"]),
+ # The width and height of the legendPatch will be set (in draw())
+ # to the length that includes the padding. Thus we set pad=0 here.
+ boxstyle=("round,pad=0,rounding_size=0.2" if fancybox
+ else "square,pad=0"),
+ mutation_scale=self._fontsize,
+ snap=True,
+ visible=(frameon if frameon is not None
+ else mpl.rcParams["legend.frameon"])
+ )
+ self._set_artist_props(self.legendPatch)
+
+ # init with null renderer
+ self._init_legend_box(handles, labels, markerfirst)
+
+ tmp = self._loc_used_default
+ self._set_loc(loc)
+ self._loc_used_default = tmp # ignore changes done by _set_loc
+
+ # figure out title fontsize:
+ if title_fontsize is None:
+ title_fontsize = mpl.rcParams['legend.title_fontsize']
+ tprop = FontProperties(size=title_fontsize)
+ self.set_title(title, prop=tprop)
+ self._draggable = None
+
+ # set the text color
+
+ color_getters = { # getter function depends on line or patch
+ 'linecolor': ['get_color', 'get_facecolor'],
+ 'markerfacecolor': ['get_markerfacecolor', 'get_facecolor'],
+ 'mfc': ['get_markerfacecolor', 'get_facecolor'],
+ 'markeredgecolor': ['get_markeredgecolor', 'get_edgecolor'],
+ 'mec': ['get_markeredgecolor', 'get_edgecolor'],
+ }
+ if labelcolor is None:
+ pass
+ elif isinstance(labelcolor, str) and labelcolor in color_getters:
+ getter_names = color_getters[labelcolor]
+ for handle, text in zip(self.legendHandles, self.texts):
+ for getter_name in getter_names:
+ try:
+ color = getattr(handle, getter_name)()
+ text.set_color(color)
+ break
+ except AttributeError:
+ pass
+ elif np.iterable(labelcolor):
+ for text, color in zip(self.texts,
+ itertools.cycle(
+ colors.to_rgba_array(labelcolor))):
+ text.set_color(color)
+ else:
+ raise ValueError("Invalid argument for labelcolor : %s" %
+ str(labelcolor))
+
+ def _set_artist_props(self, a):
+ """
+ Set the boilerplate props for artists added to axes.
+ """
+ a.set_figure(self.figure)
+ if self.isaxes:
+ # a.set_axes(self.axes)
+ a.axes = self.axes
+
+ a.set_transform(self.get_transform())
+
+ def _set_loc(self, loc):
+ # find_offset function will be provided to _legend_box and
+ # _legend_box will draw itself at the location of the return
+ # value of the find_offset.
+ self._loc_used_default = False
+ self._loc_real = loc
+ self.stale = True
+ self._legend_box.set_offset(self._findoffset)
+
+ def _get_loc(self):
+ return self._loc_real
+
+ _loc = property(_get_loc, _set_loc)
+
+ def _findoffset(self, width, height, xdescent, ydescent, renderer):
+ """Helper function to locate the legend."""
+
+ if self._loc == 0: # "best".
+ x, y = self._find_best_position(width, height, renderer)
+ elif self._loc in Legend.codes.values(): # Fixed location.
+ bbox = Bbox.from_bounds(0, 0, width, height)
+ x, y = self._get_anchored_bbox(self._loc, bbox,
+ self.get_bbox_to_anchor(),
+ renderer)
+ else: # Axes or figure coordinates.
+ fx, fy = self._loc
+ bbox = self.get_bbox_to_anchor()
+ x, y = bbox.x0 + bbox.width * fx, bbox.y0 + bbox.height * fy
+
+ return x + xdescent, y + ydescent
+
+ @allow_rasterization
+ def draw(self, renderer):
+ # docstring inherited
+ if not self.get_visible():
+ return
+
+ renderer.open_group('legend', gid=self.get_gid())
+
+ fontsize = renderer.points_to_pixels(self._fontsize)
+
+ # if mode == fill, set the width of the legend_box to the
+ # width of the parent (minus pads)
+ if self._mode in ["expand"]:
+ pad = 2 * (self.borderaxespad + self.borderpad) * fontsize
+ self._legend_box.set_width(self.get_bbox_to_anchor().width - pad)
+
+ # update the location and size of the legend. This needs to
+ # be done in any case to clip the figure right.
+ bbox = self._legend_box.get_window_extent(renderer)
+ self.legendPatch.set_bounds(bbox.x0, bbox.y0, bbox.width, bbox.height)
+ self.legendPatch.set_mutation_scale(fontsize)
+
+ if self.shadow:
+ Shadow(self.legendPatch, 2, -2).draw(renderer)
+
+ self.legendPatch.draw(renderer)
+ self._legend_box.draw(renderer)
+
+ renderer.close_group('legend')
+ self.stale = False
+
+ # _default_handler_map defines the default mapping between plot
+ # elements and the legend handlers.
+
+ _default_handler_map = {
+ StemContainer: legend_handler.HandlerStem(),
+ ErrorbarContainer: legend_handler.HandlerErrorbar(),
+ Line2D: legend_handler.HandlerLine2D(),
+ Patch: legend_handler.HandlerPatch(),
+ StepPatch: legend_handler.HandlerStepPatch(),
+ LineCollection: legend_handler.HandlerLineCollection(),
+ RegularPolyCollection: legend_handler.HandlerRegularPolyCollection(),
+ CircleCollection: legend_handler.HandlerCircleCollection(),
+ BarContainer: legend_handler.HandlerPatch(
+ update_func=legend_handler.update_from_first_child),
+ tuple: legend_handler.HandlerTuple(),
+ PathCollection: legend_handler.HandlerPathCollection(),
+ PolyCollection: legend_handler.HandlerPolyCollection()
+ }
+
+ # (get|set|update)_default_handler_maps are public interfaces to
+ # modify the default handler map.
+
+ @classmethod
+ def get_default_handler_map(cls):
+ """
+ A class method that returns the default handler map.
+ """
+ return cls._default_handler_map
+
+ @classmethod
+ def set_default_handler_map(cls, handler_map):
+ """
+ A class method to set the default handler map.
+ """
+ cls._default_handler_map = handler_map
+
+ @classmethod
+ def update_default_handler_map(cls, handler_map):
+ """
+ A class method to update the default handler map.
+ """
+ cls._default_handler_map.update(handler_map)
+
+ def get_legend_handler_map(self):
+ """
+ Return the handler map.
+ """
+
+ default_handler_map = self.get_default_handler_map()
+
+ if self._custom_handler_map:
+ hm = default_handler_map.copy()
+ hm.update(self._custom_handler_map)
+ return hm
+ else:
+ return default_handler_map
+
+ @staticmethod
+ def get_legend_handler(legend_handler_map, orig_handle):
+ """
+ Return a legend handler from *legend_handler_map* that
+ corresponds to *orig_handler*.
+
+ *legend_handler_map* should be a dictionary object (that is
+ returned by the get_legend_handler_map method).
+
+ It first checks if the *orig_handle* itself is a key in the
+ *legend_handler_map* and return the associated value.
+ Otherwise, it checks for each of the classes in its
+ method-resolution-order. If no matching key is found, it
+ returns ``None``.
+ """
+ try:
+ return legend_handler_map[orig_handle]
+ except (TypeError, KeyError): # TypeError if unhashable.
+ pass
+ for handle_type in type(orig_handle).mro():
+ try:
+ return legend_handler_map[handle_type]
+ except KeyError:
+ pass
+ return None
+
+ def _init_legend_box(self, handles, labels, markerfirst=True):
+ """
+ Initialize the legend_box. The legend_box is an instance of
+ the OffsetBox, which is packed with legend handles and
+ texts. Once packed, their location is calculated during the
+ drawing time.
+ """
+
+ fontsize = self._fontsize
+
+ # legend_box is a HPacker, horizontally packed with
+ # columns. Each column is a VPacker, vertically packed with
+ # legend items. Each legend item is HPacker packed with
+ # legend handleBox and labelBox. handleBox is an instance of
+ # offsetbox.DrawingArea which contains legend handle. labelBox
+ # is an instance of offsetbox.TextArea which contains legend
+ # text.
+
+ text_list = [] # the list of text instances
+ handle_list = [] # the list of text instances
+ handles_and_labels = []
+
+ label_prop = dict(verticalalignment='baseline',
+ horizontalalignment='left',
+ fontproperties=self.prop,
+ )
+
+ # The approximate height and descent of text. These values are
+ # only used for plotting the legend handle.
+ descent = 0.35 * fontsize * (self.handleheight - 0.7)
+ # 0.35 and 0.7 are just heuristic numbers and may need to be improved.
+ height = fontsize * self.handleheight - descent
+ # each handle needs to be drawn inside a box of (x, y, w, h) =
+ # (0, -descent, width, height). And their coordinates should
+ # be given in the display coordinates.
+
+ # The transformation of each handle will be automatically set
+ # to self.get_transform(). If the artist does not use its
+ # default transform (e.g., Collections), you need to
+ # manually set their transform to the self.get_transform().
+ legend_handler_map = self.get_legend_handler_map()
+
+ for orig_handle, lab in zip(handles, labels):
+ handler = self.get_legend_handler(legend_handler_map, orig_handle)
+ if handler is None:
+ _api.warn_external(
+ "Legend does not support {!r} instances.\nA proxy artist "
+ "may be used instead.\nSee: "
+ "https://matplotlib.org/users/legend_guide.html"
+ "#creating-artists-specifically-for-adding-to-the-legend-"
+ "aka-proxy-artists".format(orig_handle))
+ # We don't have a handle for this artist, so we just defer
+ # to None.
+ handle_list.append(None)
+ else:
+ textbox = TextArea(lab, textprops=label_prop,
+ multilinebaseline=True)
+ handlebox = DrawingArea(width=self.handlelength * fontsize,
+ height=height,
+ xdescent=0., ydescent=descent)
+
+ text_list.append(textbox._text)
+ # Create the artist for the legend which represents the
+ # original artist/handle.
+ handle_list.append(handler.legend_artist(self, orig_handle,
+ fontsize, handlebox))
+ handles_and_labels.append((handlebox, textbox))
+
+ if handles_and_labels:
+ # We calculate number of rows in each column. The first
+ # (num_largecol) columns will have (nrows+1) rows, and remaining
+ # (num_smallcol) columns will have (nrows) rows.
+ ncol = min(self._ncol, len(handles_and_labels))
+ nrows, num_largecol = divmod(len(handles_and_labels), ncol)
+ num_smallcol = ncol - num_largecol
+ # starting index of each column and number of rows in it.
+ rows_per_col = [nrows + 1] * num_largecol + [nrows] * num_smallcol
+ start_idxs = np.concatenate([[0], np.cumsum(rows_per_col)[:-1]])
+ cols = zip(start_idxs, rows_per_col)
+ else:
+ cols = []
+
+ columnbox = []
+ for i0, di in cols:
+ # pack handleBox and labelBox into itemBox
+ itemBoxes = [HPacker(pad=0,
+ sep=self.handletextpad * fontsize,
+ children=[h, t] if markerfirst else [t, h],
+ align="baseline")
+ for h, t in handles_and_labels[i0:i0 + di]]
+ # pack columnBox
+ alignment = "baseline" if markerfirst else "right"
+ columnbox.append(VPacker(pad=0,
+ sep=self.labelspacing * fontsize,
+ align=alignment,
+ children=itemBoxes))
+
+ mode = "expand" if self._mode == "expand" else "fixed"
+ sep = self.columnspacing * fontsize
+ self._legend_handle_box = HPacker(pad=0,
+ sep=sep, align="baseline",
+ mode=mode,
+ children=columnbox)
+ self._legend_title_box = TextArea("")
+ self._legend_box = VPacker(pad=self.borderpad * fontsize,
+ sep=self.labelspacing * fontsize,
+ align="center",
+ children=[self._legend_title_box,
+ self._legend_handle_box])
+ self._legend_box.set_figure(self.figure)
+ self.texts = text_list
+ self.legendHandles = handle_list
+
+ def _auto_legend_data(self):
+ """
+ Return display coordinates for hit testing for "best" positioning.
+
+ Returns
+ -------
+ bboxes
+ List of bounding boxes of all patches.
+ lines
+ List of `.Path` corresponding to each line.
+ offsets
+ List of (x, y) offsets of all collection.
+ """
+ assert self.isaxes # always holds, as this is only called internally
+ ax = self.parent
+ lines = [line.get_transform().transform_path(line.get_path())
+ for line in ax.lines]
+ bboxes = [patch.get_bbox().transformed(patch.get_data_transform())
+ if isinstance(patch, Rectangle) else
+ patch.get_path().get_extents(patch.get_transform())
+ for patch in ax.patches]
+ offsets = []
+ for handle in ax.collections:
+ _, transOffset, hoffsets, _ = handle._prepare_points()
+ for offset in transOffset.transform(hoffsets):
+ offsets.append(offset)
+ return bboxes, lines, offsets
+
+ def get_children(self):
+ # docstring inherited
+ return [self._legend_box, self.get_frame()]
+
+ def get_frame(self):
+ """Return the `~.patches.Rectangle` used to frame the legend."""
+ return self.legendPatch
+
+ def get_lines(self):
+ r"""Return the list of `~.lines.Line2D`\s in the legend."""
+ return [h for h in self.legendHandles if isinstance(h, Line2D)]
+
+ def get_patches(self):
+ r"""Return the list of `~.patches.Patch`\s in the legend."""
+ return silent_list('Patch',
+ [h for h in self.legendHandles
+ if isinstance(h, Patch)])
+
+ def get_texts(self):
+ r"""Return the list of `~.text.Text`\s in the legend."""
+ return silent_list('Text', self.texts)
+
+ def set_title(self, title, prop=None):
+ """
+ Set the legend title. Fontproperties can be optionally set
+ with *prop* parameter.
+ """
+ self._legend_title_box._text.set_text(title)
+ if title:
+ self._legend_title_box._text.set_visible(True)
+ self._legend_title_box.set_visible(True)
+ else:
+ self._legend_title_box._text.set_visible(False)
+ self._legend_title_box.set_visible(False)
+
+ if prop is not None:
+ self._legend_title_box._text.set_fontproperties(prop)
+
+ self.stale = True
+
+ def get_title(self):
+ """Return the `.Text` instance for the legend title."""
+ return self._legend_title_box._text
+
+ def get_window_extent(self, renderer=None):
+ # docstring inherited
+ if renderer is None:
+ renderer = self.figure._cachedRenderer
+ return self._legend_box.get_window_extent(renderer=renderer)
+
+ def get_tightbbox(self, renderer):
+ """
+ Like `.Legend.get_window_extent`, but uses the box for the legend.
+
+ Parameters
+ ----------
+ renderer : `.RendererBase` subclass
+ renderer that will be used to draw the figures (i.e.
+ ``fig.canvas.get_renderer()``)
+
+ Returns
+ -------
+ `.BboxBase`
+ The bounding box in figure pixel coordinates.
+ """
+ return self._legend_box.get_window_extent(renderer)
+
+ def get_frame_on(self):
+ """Get whether the legend box patch is drawn."""
+ return self.legendPatch.get_visible()
+
+ def set_frame_on(self, b):
+ """
+ Set whether the legend box patch is drawn.
+
+ Parameters
+ ----------
+ b : bool
+ """
+ self.legendPatch.set_visible(b)
+ self.stale = True
+
+ draw_frame = set_frame_on # Backcompat alias.
+
+ def get_bbox_to_anchor(self):
+ """Return the bbox that the legend will be anchored to."""
+ if self._bbox_to_anchor is None:
+ return self.parent.bbox
+ else:
+ return self._bbox_to_anchor
+
+ def set_bbox_to_anchor(self, bbox, transform=None):
+ """
+ Set the bbox that the legend will be anchored to.
+
+ Parameters
+ ----------
+ bbox : `~matplotlib.transforms.BboxBase` or tuple
+ The bounding box can be specified in the following ways:
+
+ - A `.BboxBase` instance
+ - A tuple of ``(left, bottom, width, height)`` in the given
+ transform (normalized axes coordinate if None)
+ - A tuple of ``(left, bottom)`` where the width and height will be
+ assumed to be zero.
+ - *None*, to remove the bbox anchoring, and use the parent bbox.
+
+ transform : `~matplotlib.transforms.Transform`, optional
+ A transform to apply to the bounding box. If not specified, this
+ will use a transform to the bounding box of the parent.
+ """
+ if bbox is None:
+ self._bbox_to_anchor = None
+ return
+ elif isinstance(bbox, BboxBase):
+ self._bbox_to_anchor = bbox
+ else:
+ try:
+ l = len(bbox)
+ except TypeError as err:
+ raise ValueError("Invalid argument for bbox : %s" %
+ str(bbox)) from err
+
+ if l == 2:
+ bbox = [bbox[0], bbox[1], 0, 0]
+
+ self._bbox_to_anchor = Bbox.from_bounds(*bbox)
+
+ if transform is None:
+ transform = BboxTransformTo(self.parent.bbox)
+
+ self._bbox_to_anchor = TransformedBbox(self._bbox_to_anchor,
+ transform)
+ self.stale = True
+
+ def _get_anchored_bbox(self, loc, bbox, parentbbox, renderer):
+ """
+ Place the *bbox* inside the *parentbbox* according to a given
+ location code. Return the (x, y) coordinate of the bbox.
+
+ Parameters
+ ----------
+ loc : int
+ A location code in range(1, 11). This corresponds to the possible
+ values for ``self._loc``, excluding "best".
+ bbox : `~matplotlib.transforms.Bbox`
+ bbox to be placed, in display coordinates.
+ parentbbox : `~matplotlib.transforms.Bbox`
+ A parent box which will contain the bbox, in display coordinates.
+
+ """
+ assert loc in range(1, 11) # called only internally
+
+ BEST, UR, UL, LL, LR, R, CL, CR, LC, UC, C = range(11)
+
+ anchor_coefs = {UR: "NE",
+ UL: "NW",
+ LL: "SW",
+ LR: "SE",
+ R: "E",
+ CL: "W",
+ CR: "E",
+ LC: "S",
+ UC: "N",
+ C: "C"}
+
+ c = anchor_coefs[loc]
+
+ fontsize = renderer.points_to_pixels(self._fontsize)
+ container = parentbbox.padded(-self.borderaxespad * fontsize)
+ anchored_box = bbox.anchored(c, container=container)
+ return anchored_box.x0, anchored_box.y0
+
+ def _find_best_position(self, width, height, renderer, consider=None):
+ """
+ Determine the best location to place the legend.
+
+ *consider* is a list of ``(x, y)`` pairs to consider as a potential
+ lower-left corner of the legend. All are display coords.
+ """
+ assert self.isaxes # always holds, as this is only called internally
+
+ start_time = time.perf_counter()
+
+ bboxes, lines, offsets = self._auto_legend_data()
+
+ bbox = Bbox.from_bounds(0, 0, width, height)
+ if consider is None:
+ consider = [self._get_anchored_bbox(x, bbox,
+ self.get_bbox_to_anchor(),
+ renderer)
+ for x in range(1, len(self.codes))]
+
+ candidates = []
+ for idx, (l, b) in enumerate(consider):
+ legendBox = Bbox.from_bounds(l, b, width, height)
+ badness = 0
+ # XXX TODO: If markers are present, it would be good to take them
+ # into account when checking vertex overlaps in the next line.
+ badness = (sum(legendBox.count_contains(line.vertices)
+ for line in lines)
+ + legendBox.count_contains(offsets)
+ + legendBox.count_overlaps(bboxes)
+ + sum(line.intersects_bbox(legendBox, filled=False)
+ for line in lines))
+ if badness == 0:
+ return l, b
+ # Include the index to favor lower codes in case of a tie.
+ candidates.append((badness, idx, (l, b)))
+
+ _, _, (l, b) = min(candidates)
+
+ if self._loc_used_default and time.perf_counter() - start_time > 1:
+ _api.warn_external(
+ 'Creating legend with loc="best" can be slow with large '
+ 'amounts of data.')
+
+ return l, b
+
+ def contains(self, event):
+ inside, info = self._default_contains(event)
+ if inside is not None:
+ return inside, info
+ return self.legendPatch.contains(event)
+
+ def set_draggable(self, state, use_blit=False, update='loc'):
+ """
+ Enable or disable mouse dragging support of the legend.
+
+ Parameters
+ ----------
+ state : bool
+ Whether mouse dragging is enabled.
+ use_blit : bool, optional
+ Use blitting for faster image composition. For details see
+ :ref:`func-animation`.
+ update : {'loc', 'bbox'}, optional
+ The legend parameter to be changed when dragged:
+
+ - 'loc': update the *loc* parameter of the legend
+ - 'bbox': update the *bbox_to_anchor* parameter of the legend
+
+ Returns
+ -------
+ `.DraggableLegend` or *None*
+ If *state* is ``True`` this returns the `.DraggableLegend` helper
+ instance. Otherwise this returns *None*.
+ """
+ if state:
+ if self._draggable is None:
+ self._draggable = DraggableLegend(self,
+ use_blit,
+ update=update)
+ else:
+ if self._draggable is not None:
+ self._draggable.disconnect()
+ self._draggable = None
+ return self._draggable
+
+ def get_draggable(self):
+ """Return ``True`` if the legend is draggable, ``False`` otherwise."""
+ return self._draggable is not None
+
+
+# Helper functions to parse legend arguments for both `figure.legend` and
+# `axes.legend`:
+def _get_legend_handles(axs, legend_handler_map=None):
+ """
+ Return a generator of artists that can be used as handles in
+ a legend.
+
+ """
+ handles_original = []
+ for ax in axs:
+ handles_original += (ax.lines + ax.patches +
+ ax.collections + ax.containers)
+ # support parasite axes:
+ if hasattr(ax, 'parasites'):
+ for axx in ax.parasites:
+ handles_original += (axx.lines + axx.patches +
+ axx.collections + axx.containers)
+
+ handler_map = Legend.get_default_handler_map()
+
+ if legend_handler_map is not None:
+ handler_map = handler_map.copy()
+ handler_map.update(legend_handler_map)
+
+ has_handler = Legend.get_legend_handler
+
+ for handle in handles_original:
+ label = handle.get_label()
+ if label != '_nolegend_' and has_handler(handler_map, handle):
+ yield handle
+
+
+def _get_legend_handles_labels(axs, legend_handler_map=None):
+ """
+ Return handles and labels for legend, internal method.
+
+ """
+ handles = []
+ labels = []
+
+ for handle in _get_legend_handles(axs, legend_handler_map):
+ label = handle.get_label()
+ if label and not label.startswith('_'):
+ handles.append(handle)
+ labels.append(label)
+ return handles, labels
+
+
+def _parse_legend_args(axs, *args, handles=None, labels=None, **kwargs):
+ """
+ Get the handles and labels from the calls to either ``figure.legend``
+ or ``axes.legend``.
+
+ The parser is a bit involved because we support::
+
+ legend()
+ legend(labels)
+ legend(handles, labels)
+ legend(labels=labels)
+ legend(handles=handles)
+ legend(handles=handles, labels=labels)
+
+ The behavior for a mixture of positional and keyword handles and labels
+ is undefined and issues a warning.
+
+ Parameters
+ ----------
+ axs : list of `.Axes`
+ If handles are not given explicitly, the artists in these Axes are
+ used as handles.
+ *args : tuple
+ Positional parameters passed to ``legend()``.
+ handles
+ The value of the keyword argument ``legend(handles=...)``, or *None*
+ if that keyword argument was not used.
+ labels
+ The value of the keyword argument ``legend(labels=...)``, or *None*
+ if that keyword argument was not used.
+ **kwargs
+ All other keyword arguments passed to ``legend()``.
+
+ Returns
+ -------
+ handles : list of `.Artist`
+ The legend handles.
+ labels : list of str
+ The legend labels.
+ extra_args : tuple
+ *args* with positional handles and labels removed.
+ kwargs : dict
+ *kwargs* with keywords handles and labels removed.
+
+ """
+ log = logging.getLogger(__name__)
+
+ handlers = kwargs.get('handler_map', {}) or {}
+ extra_args = ()
+
+ if (handles is not None or labels is not None) and args:
+ _api.warn_external("You have mixed positional and keyword arguments, "
+ "some input may be discarded.")
+
+ # if got both handles and labels as kwargs, make same length
+ if handles and labels:
+ handles, labels = zip(*zip(handles, labels))
+
+ elif handles is not None and labels is None:
+ labels = [handle.get_label() for handle in handles]
+
+ elif labels is not None and handles is None:
+ # Get as many handles as there are labels.
+ handles = [handle for handle, label
+ in zip(_get_legend_handles(axs, handlers), labels)]
+
+ # No arguments - automatically detect labels and handles.
+ elif len(args) == 0:
+ handles, labels = _get_legend_handles_labels(axs, handlers)
+ if not handles:
+ log.warning('No handles with labels found to put in legend.')
+
+ # One argument. User defined labels - automatic handle detection.
+ elif len(args) == 1:
+ labels, = args
+ if any(isinstance(l, Artist) for l in labels):
+ raise TypeError("A single argument passed to legend() must be a "
+ "list of labels, but found an Artist in there.")
+
+ # Get as many handles as there are labels.
+ handles = [handle for handle, label
+ in zip(_get_legend_handles(axs, handlers), labels)]
+
+ # Two arguments:
+ # * user defined handles and labels
+ elif len(args) >= 2:
+ handles, labels = args[:2]
+ extra_args = args[2:]
+
+ else:
+ raise TypeError('Invalid arguments to legend.')
+
+ return handles, labels, extra_args, kwargs
diff --git a/venv/Lib/site-packages/matplotlib/legend_handler.py b/venv/Lib/site-packages/matplotlib/legend_handler.py
new file mode 100644
index 0000000..45fb759
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/legend_handler.py
@@ -0,0 +1,770 @@
+"""
+Default legend handlers.
+
+It is strongly encouraged to have read the :doc:`legend guide
+` before this documentation.
+
+Legend handlers are expected to be a callable object with a following
+signature. ::
+
+ legend_handler(legend, orig_handle, fontsize, handlebox)
+
+Where *legend* is the legend itself, *orig_handle* is the original
+plot, *fontsize* is the fontsize in pixels, and *handlebox* is a
+OffsetBox instance. Within the call, you should create relevant
+artists (using relevant properties from the *legend* and/or
+*orig_handle*) and add them into the handlebox. The artists needs to
+be scaled according to the fontsize (note that the size is in pixel,
+i.e., this is dpi-scaled value).
+
+This module includes definition of several legend handler classes
+derived from the base class (HandlerBase) with the following method::
+
+ def legend_artist(self, legend, orig_handle, fontsize, handlebox)
+"""
+
+from itertools import cycle
+
+import numpy as np
+
+from matplotlib import cbook
+from matplotlib.lines import Line2D
+from matplotlib.patches import Rectangle
+import matplotlib.collections as mcoll
+import matplotlib.colors as mcolors
+
+
+def update_from_first_child(tgt, src):
+ first_child = next(iter(src.get_children()), None)
+ if first_child is not None:
+ tgt.update_from(first_child)
+
+
+class HandlerBase:
+ """
+ A Base class for default legend handlers.
+
+ The derived classes are meant to override *create_artists* method, which
+ has a following signature.::
+
+ def create_artists(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize,
+ trans):
+
+ The overridden method needs to create artists of the given
+ transform that fits in the given dimension (xdescent, ydescent,
+ width, height) that are scaled by fontsize if necessary.
+
+ """
+ def __init__(self, xpad=0., ypad=0., update_func=None):
+ self._xpad, self._ypad = xpad, ypad
+ self._update_prop_func = update_func
+
+ def _update_prop(self, legend_handle, orig_handle):
+ if self._update_prop_func is None:
+ self._default_update_prop(legend_handle, orig_handle)
+ else:
+ self._update_prop_func(legend_handle, orig_handle)
+
+ def _default_update_prop(self, legend_handle, orig_handle):
+ legend_handle.update_from(orig_handle)
+
+ def update_prop(self, legend_handle, orig_handle, legend):
+
+ self._update_prop(legend_handle, orig_handle)
+
+ legend._set_artist_props(legend_handle)
+ legend_handle.set_clip_box(None)
+ legend_handle.set_clip_path(None)
+
+ def adjust_drawing_area(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize,
+ ):
+ xdescent = xdescent - self._xpad * fontsize
+ ydescent = ydescent - self._ypad * fontsize
+ width = width - self._xpad * fontsize
+ height = height - self._ypad * fontsize
+ return xdescent, ydescent, width, height
+
+ def legend_artist(self, legend, orig_handle,
+ fontsize, handlebox):
+ """
+ Return the artist that this HandlerBase generates for the given
+ original artist/handle.
+
+ Parameters
+ ----------
+ legend : `~matplotlib.legend.Legend`
+ The legend for which these legend artists are being created.
+ orig_handle : :class:`matplotlib.artist.Artist` or similar
+ The object for which these legend artists are being created.
+ fontsize : int
+ The fontsize in pixels. The artists being created should
+ be scaled according to the given fontsize.
+ handlebox : `matplotlib.offsetbox.OffsetBox`
+ The box which has been created to hold this legend entry's
+ artists. Artists created in the `legend_artist` method must
+ be added to this handlebox inside this method.
+
+ """
+ xdescent, ydescent, width, height = self.adjust_drawing_area(
+ legend, orig_handle,
+ handlebox.xdescent, handlebox.ydescent,
+ handlebox.width, handlebox.height,
+ fontsize)
+ artists = self.create_artists(legend, orig_handle,
+ xdescent, ydescent, width, height,
+ fontsize, handlebox.get_transform())
+
+ # create_artists will return a list of artists.
+ for a in artists:
+ handlebox.add_artist(a)
+
+ # we only return the first artist
+ return artists[0]
+
+ def create_artists(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize,
+ trans):
+ raise NotImplementedError('Derived must override')
+
+
+class HandlerNpoints(HandlerBase):
+ """
+ A legend handler that shows *numpoints* points in the legend entry.
+ """
+ def __init__(self, marker_pad=0.3, numpoints=None, **kw):
+ """
+ Parameters
+ ----------
+ marker_pad : float
+ Padding between points in legend entry.
+
+ numpoints : int
+ Number of points to show in legend entry.
+
+ Notes
+ -----
+ Any other keyword arguments are given to `HandlerBase`.
+ """
+ super().__init__(**kw)
+
+ self._numpoints = numpoints
+ self._marker_pad = marker_pad
+
+ def get_numpoints(self, legend):
+ if self._numpoints is None:
+ return legend.numpoints
+ else:
+ return self._numpoints
+
+ def get_xdata(self, legend, xdescent, ydescent, width, height, fontsize):
+ numpoints = self.get_numpoints(legend)
+ if numpoints > 1:
+ # we put some pad here to compensate the size of the marker
+ pad = self._marker_pad * fontsize
+ xdata = np.linspace(-xdescent + pad,
+ -xdescent + width - pad,
+ numpoints)
+ xdata_marker = xdata
+ else:
+ xdata = [-xdescent, -xdescent + width]
+ xdata_marker = [-xdescent + 0.5 * width]
+ return xdata, xdata_marker
+
+
+class HandlerNpointsYoffsets(HandlerNpoints):
+ """
+ A legend handler that shows *numpoints* in the legend, and allows them to
+ be individually offset in the y-direction.
+ """
+ def __init__(self, numpoints=None, yoffsets=None, **kw):
+ """
+ Parameters
+ ----------
+ numpoints : int
+ Number of points to show in legend entry.
+
+ yoffsets : array of floats
+ Length *numpoints* list of y offsets for each point in
+ legend entry.
+
+ Notes
+ -----
+ Any other keyword arguments are given to `HandlerNpoints`.
+ """
+ super().__init__(numpoints=numpoints, **kw)
+ self._yoffsets = yoffsets
+
+ def get_ydata(self, legend, xdescent, ydescent, width, height, fontsize):
+ if self._yoffsets is None:
+ ydata = height * legend._scatteryoffsets
+ else:
+ ydata = height * np.asarray(self._yoffsets)
+
+ return ydata
+
+
+class HandlerLine2D(HandlerNpoints):
+ """
+ Handler for `.Line2D` instances.
+ """
+ def __init__(self, marker_pad=0.3, numpoints=None, **kw):
+ """
+ Parameters
+ ----------
+ marker_pad : float
+ Padding between points in legend entry.
+
+ numpoints : int
+ Number of points to show in legend entry.
+
+ Notes
+ -----
+ Any other keyword arguments are given to `HandlerNpoints`.
+ """
+ super().__init__(marker_pad=marker_pad, numpoints=numpoints, **kw)
+
+ def create_artists(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize,
+ trans):
+
+ xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
+ width, height, fontsize)
+
+ ydata = np.full_like(xdata, ((height - ydescent) / 2))
+ legline = Line2D(xdata, ydata)
+
+ self.update_prop(legline, orig_handle, legend)
+ legline.set_drawstyle('default')
+ legline.set_marker("")
+
+ legline_marker = Line2D(xdata_marker, ydata[:len(xdata_marker)])
+ self.update_prop(legline_marker, orig_handle, legend)
+ legline_marker.set_linestyle('None')
+ if legend.markerscale != 1:
+ newsz = legline_marker.get_markersize() * legend.markerscale
+ legline_marker.set_markersize(newsz)
+ # we don't want to add this to the return list because
+ # the texts and handles are assumed to be in one-to-one
+ # correspondence.
+ legline._legmarker = legline_marker
+
+ legline.set_transform(trans)
+ legline_marker.set_transform(trans)
+
+ return [legline, legline_marker]
+
+
+class HandlerPatch(HandlerBase):
+ """
+ Handler for `.Patch` instances.
+ """
+ def __init__(self, patch_func=None, **kw):
+ """
+ Parameters
+ ----------
+ patch_func : callable, optional
+ The function that creates the legend key artist.
+ *patch_func* should have the signature::
+
+ def patch_func(legend=legend, orig_handle=orig_handle,
+ xdescent=xdescent, ydescent=ydescent,
+ width=width, height=height, fontsize=fontsize)
+
+ Subsequently the created artist will have its ``update_prop``
+ method called and the appropriate transform will be applied.
+
+ Notes
+ -----
+ Any other keyword arguments are given to `HandlerBase`.
+ """
+ super().__init__(**kw)
+ self._patch_func = patch_func
+
+ def _create_patch(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize):
+ if self._patch_func is None:
+ p = Rectangle(xy=(-xdescent, -ydescent),
+ width=width, height=height)
+ else:
+ p = self._patch_func(legend=legend, orig_handle=orig_handle,
+ xdescent=xdescent, ydescent=ydescent,
+ width=width, height=height, fontsize=fontsize)
+ return p
+
+ def create_artists(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize, trans):
+ p = self._create_patch(legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize)
+ self.update_prop(p, orig_handle, legend)
+ p.set_transform(trans)
+ return [p]
+
+
+class HandlerStepPatch(HandlerBase):
+ """
+ Handler for `~.matplotlib.patches.StepPatch` instances.
+ """
+ def __init__(self, **kw):
+ """
+ Any other keyword arguments are given to `HandlerBase`.
+ """
+ super().__init__(**kw)
+
+ def _create_patch(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize):
+ p = Rectangle(xy=(-xdescent, -ydescent),
+ color=orig_handle.get_facecolor(),
+ width=width, height=height)
+ return p
+
+ # Unfilled StepPatch should show as a line
+ def _create_line(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize):
+
+ # Overwrite manually because patch and line properties don't mix
+ legline = Line2D([0, width], [height/2, height/2],
+ color=orig_handle.get_edgecolor(),
+ linestyle=orig_handle.get_linestyle(),
+ linewidth=orig_handle.get_linewidth(),
+ )
+
+ legline.set_drawstyle('default')
+ legline.set_marker("")
+ return legline
+
+ def create_artists(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize, trans):
+ if orig_handle.get_fill() or (orig_handle.get_hatch() is not None):
+ p = self._create_patch(legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize)
+ self.update_prop(p, orig_handle, legend)
+ else:
+ p = self._create_line(legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize)
+ p.set_transform(trans)
+ return [p]
+
+
+class HandlerLineCollection(HandlerLine2D):
+ """
+ Handler for `.LineCollection` instances.
+ """
+ def get_numpoints(self, legend):
+ if self._numpoints is None:
+ return legend.scatterpoints
+ else:
+ return self._numpoints
+
+ def _default_update_prop(self, legend_handle, orig_handle):
+ lw = orig_handle.get_linewidths()[0]
+ dashes = orig_handle._us_linestyles[0]
+ color = orig_handle.get_colors()[0]
+ legend_handle.set_color(color)
+ legend_handle.set_linestyle(dashes)
+ legend_handle.set_linewidth(lw)
+
+ def create_artists(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize, trans):
+
+ xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
+ width, height, fontsize)
+ ydata = np.full_like(xdata, (height - ydescent) / 2)
+ legline = Line2D(xdata, ydata)
+
+ self.update_prop(legline, orig_handle, legend)
+ legline.set_transform(trans)
+
+ return [legline]
+
+
+class HandlerRegularPolyCollection(HandlerNpointsYoffsets):
+ r"""Handler for `.RegularPolyCollection`\s."""
+
+ def __init__(self, yoffsets=None, sizes=None, **kw):
+ super().__init__(yoffsets=yoffsets, **kw)
+
+ self._sizes = sizes
+
+ def get_numpoints(self, legend):
+ if self._numpoints is None:
+ return legend.scatterpoints
+ else:
+ return self._numpoints
+
+ def get_sizes(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize):
+ if self._sizes is None:
+ handle_sizes = orig_handle.get_sizes()
+ if not len(handle_sizes):
+ handle_sizes = [1]
+ size_max = max(handle_sizes) * legend.markerscale ** 2
+ size_min = min(handle_sizes) * legend.markerscale ** 2
+
+ numpoints = self.get_numpoints(legend)
+ if numpoints < 4:
+ sizes = [.5 * (size_max + size_min), size_max,
+ size_min][:numpoints]
+ else:
+ rng = (size_max - size_min)
+ sizes = rng * np.linspace(0, 1, numpoints) + size_min
+ else:
+ sizes = self._sizes
+
+ return sizes
+
+ def update_prop(self, legend_handle, orig_handle, legend):
+
+ self._update_prop(legend_handle, orig_handle)
+
+ legend_handle.set_figure(legend.figure)
+ # legend._set_artist_props(legend_handle)
+ legend_handle.set_clip_box(None)
+ legend_handle.set_clip_path(None)
+
+ def create_collection(self, orig_handle, sizes, offsets, transOffset):
+ p = type(orig_handle)(orig_handle.get_numsides(),
+ rotation=orig_handle.get_rotation(),
+ sizes=sizes,
+ offsets=offsets,
+ transOffset=transOffset,
+ )
+ return p
+
+ def create_artists(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize,
+ trans):
+ xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
+ width, height, fontsize)
+
+ ydata = self.get_ydata(legend, xdescent, ydescent,
+ width, height, fontsize)
+
+ sizes = self.get_sizes(legend, orig_handle, xdescent, ydescent,
+ width, height, fontsize)
+
+ p = self.create_collection(orig_handle, sizes,
+ offsets=list(zip(xdata_marker, ydata)),
+ transOffset=trans)
+
+ self.update_prop(p, orig_handle, legend)
+ p._transOffset = trans
+ return [p]
+
+
+class HandlerPathCollection(HandlerRegularPolyCollection):
+ r"""Handler for `.PathCollection`\s, which are used by `~.Axes.scatter`."""
+ def create_collection(self, orig_handle, sizes, offsets, transOffset):
+ p = type(orig_handle)([orig_handle.get_paths()[0]],
+ sizes=sizes,
+ offsets=offsets,
+ transOffset=transOffset,
+ )
+ return p
+
+
+class HandlerCircleCollection(HandlerRegularPolyCollection):
+ r"""Handler for `.CircleCollection`\s."""
+ def create_collection(self, orig_handle, sizes, offsets, transOffset):
+ p = type(orig_handle)(sizes,
+ offsets=offsets,
+ transOffset=transOffset,
+ )
+ return p
+
+
+class HandlerErrorbar(HandlerLine2D):
+ """Handler for Errorbars."""
+
+ def __init__(self, xerr_size=0.5, yerr_size=None,
+ marker_pad=0.3, numpoints=None, **kw):
+
+ self._xerr_size = xerr_size
+ self._yerr_size = yerr_size
+
+ super().__init__(marker_pad=marker_pad, numpoints=numpoints, **kw)
+
+ def get_err_size(self, legend, xdescent, ydescent,
+ width, height, fontsize):
+ xerr_size = self._xerr_size * fontsize
+
+ if self._yerr_size is None:
+ yerr_size = xerr_size
+ else:
+ yerr_size = self._yerr_size * fontsize
+
+ return xerr_size, yerr_size
+
+ def create_artists(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize,
+ trans):
+
+ plotlines, caplines, barlinecols = orig_handle
+
+ xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
+ width, height, fontsize)
+
+ ydata = np.full_like(xdata, (height - ydescent) / 2)
+ legline = Line2D(xdata, ydata)
+
+ xdata_marker = np.asarray(xdata_marker)
+ ydata_marker = np.asarray(ydata[:len(xdata_marker)])
+
+ xerr_size, yerr_size = self.get_err_size(legend, xdescent, ydescent,
+ width, height, fontsize)
+
+ legline_marker = Line2D(xdata_marker, ydata_marker)
+
+ # when plotlines are None (only errorbars are drawn), we just
+ # make legline invisible.
+ if plotlines is None:
+ legline.set_visible(False)
+ legline_marker.set_visible(False)
+ else:
+ self.update_prop(legline, plotlines, legend)
+
+ legline.set_drawstyle('default')
+ legline.set_marker('None')
+
+ self.update_prop(legline_marker, plotlines, legend)
+ legline_marker.set_linestyle('None')
+
+ if legend.markerscale != 1:
+ newsz = legline_marker.get_markersize() * legend.markerscale
+ legline_marker.set_markersize(newsz)
+
+ handle_barlinecols = []
+ handle_caplines = []
+
+ if orig_handle.has_xerr:
+ verts = [((x - xerr_size, y), (x + xerr_size, y))
+ for x, y in zip(xdata_marker, ydata_marker)]
+ coll = mcoll.LineCollection(verts)
+ self.update_prop(coll, barlinecols[0], legend)
+ handle_barlinecols.append(coll)
+
+ if caplines:
+ capline_left = Line2D(xdata_marker - xerr_size, ydata_marker)
+ capline_right = Line2D(xdata_marker + xerr_size, ydata_marker)
+ self.update_prop(capline_left, caplines[0], legend)
+ self.update_prop(capline_right, caplines[0], legend)
+ capline_left.set_marker("|")
+ capline_right.set_marker("|")
+
+ handle_caplines.append(capline_left)
+ handle_caplines.append(capline_right)
+
+ if orig_handle.has_yerr:
+ verts = [((x, y - yerr_size), (x, y + yerr_size))
+ for x, y in zip(xdata_marker, ydata_marker)]
+ coll = mcoll.LineCollection(verts)
+ self.update_prop(coll, barlinecols[0], legend)
+ handle_barlinecols.append(coll)
+
+ if caplines:
+ capline_left = Line2D(xdata_marker, ydata_marker - yerr_size)
+ capline_right = Line2D(xdata_marker, ydata_marker + yerr_size)
+ self.update_prop(capline_left, caplines[0], legend)
+ self.update_prop(capline_right, caplines[0], legend)
+ capline_left.set_marker("_")
+ capline_right.set_marker("_")
+
+ handle_caplines.append(capline_left)
+ handle_caplines.append(capline_right)
+
+ artists = [
+ *handle_barlinecols, *handle_caplines, legline, legline_marker,
+ ]
+ for artist in artists:
+ artist.set_transform(trans)
+ return artists
+
+
+class HandlerStem(HandlerNpointsYoffsets):
+ """
+ Handler for plots produced by `~.Axes.stem`.
+ """
+ def __init__(self, marker_pad=0.3, numpoints=None,
+ bottom=None, yoffsets=None, **kw):
+ """
+ Parameters
+ ----------
+ marker_pad : float, default: 0.3
+ Padding between points in legend entry.
+
+ numpoints : int, optional
+ Number of points to show in legend entry.
+
+ bottom : float, optional
+
+ yoffsets : array of floats, optional
+ Length *numpoints* list of y offsets for each point in
+ legend entry.
+
+ Notes
+ -----
+ Any other keyword arguments are given to `HandlerNpointsYoffsets`.
+ """
+
+ super().__init__(marker_pad=marker_pad, numpoints=numpoints,
+ yoffsets=yoffsets, **kw)
+ self._bottom = bottom
+
+ def get_ydata(self, legend, xdescent, ydescent, width, height, fontsize):
+ if self._yoffsets is None:
+ ydata = height * (0.5 * legend._scatteryoffsets + 0.5)
+ else:
+ ydata = height * np.asarray(self._yoffsets)
+
+ return ydata
+
+ def create_artists(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize,
+ trans):
+ markerline, stemlines, baseline = orig_handle
+ # Check to see if the stemcontainer is storing lines as a list or a
+ # LineCollection. Eventually using a list will be removed, and this
+ # logic can also be removed.
+ using_linecoll = isinstance(stemlines, mcoll.LineCollection)
+
+ xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
+ width, height, fontsize)
+
+ ydata = self.get_ydata(legend, xdescent, ydescent,
+ width, height, fontsize)
+
+ if self._bottom is None:
+ bottom = 0.
+ else:
+ bottom = self._bottom
+
+ leg_markerline = Line2D(xdata_marker, ydata[:len(xdata_marker)])
+ self.update_prop(leg_markerline, markerline, legend)
+
+ leg_stemlines = [Line2D([x, x], [bottom, y])
+ for x, y in zip(xdata_marker, ydata)]
+
+ if using_linecoll:
+ # change the function used by update_prop() from the default
+ # to one that handles LineCollection
+ with cbook._setattr_cm(
+ self, _update_prop_func=self._copy_collection_props):
+ for line in leg_stemlines:
+ self.update_prop(line, stemlines, legend)
+
+ else:
+ for lm, m in zip(leg_stemlines, stemlines):
+ self.update_prop(lm, m, legend)
+
+ leg_baseline = Line2D([np.min(xdata), np.max(xdata)],
+ [bottom, bottom])
+ self.update_prop(leg_baseline, baseline, legend)
+
+ artists = [*leg_stemlines, leg_baseline, leg_markerline]
+ for artist in artists:
+ artist.set_transform(trans)
+ return artists
+
+ def _copy_collection_props(self, legend_handle, orig_handle):
+ """
+ Copy properties from the `.LineCollection` *orig_handle* to the
+ `.Line2D` *legend_handle*.
+ """
+ legend_handle.set_color(orig_handle.get_color()[0])
+ legend_handle.set_linestyle(orig_handle.get_linestyle()[0])
+
+
+class HandlerTuple(HandlerBase):
+ """
+ Handler for Tuple.
+
+ Additional kwargs are passed through to `HandlerBase`.
+
+ Parameters
+ ----------
+ ndivide : int, default: 1
+ The number of sections to divide the legend area into. If None,
+ use the length of the input tuple.
+ pad : float, default: :rc:`legend.borderpad`
+ Padding in units of fraction of font size.
+ """
+
+ def __init__(self, ndivide=1, pad=None, **kwargs):
+ self._ndivide = ndivide
+ self._pad = pad
+ super().__init__(**kwargs)
+
+ def create_artists(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize,
+ trans):
+
+ handler_map = legend.get_legend_handler_map()
+
+ if self._ndivide is None:
+ ndivide = len(orig_handle)
+ else:
+ ndivide = self._ndivide
+
+ if self._pad is None:
+ pad = legend.borderpad * fontsize
+ else:
+ pad = self._pad * fontsize
+
+ if ndivide > 1:
+ width = (width - pad * (ndivide - 1)) / ndivide
+
+ xds_cycle = cycle(xdescent - (width + pad) * np.arange(ndivide))
+
+ a_list = []
+ for handle1 in orig_handle:
+ handler = legend.get_legend_handler(handler_map, handle1)
+ _a_list = handler.create_artists(
+ legend, handle1,
+ next(xds_cycle), ydescent, width, height, fontsize, trans)
+ a_list.extend(_a_list)
+
+ return a_list
+
+
+class HandlerPolyCollection(HandlerBase):
+ """
+ Handler for `.PolyCollection` used in `~.Axes.fill_between` and
+ `~.Axes.stackplot`.
+ """
+ def _update_prop(self, legend_handle, orig_handle):
+ def first_color(colors):
+ if colors is None:
+ return None
+ colors = mcolors.to_rgba_array(colors)
+ if len(colors):
+ return colors[0]
+ else:
+ return "none"
+
+ def get_first(prop_array):
+ if len(prop_array):
+ return prop_array[0]
+ else:
+ return None
+ edgecolor = getattr(orig_handle, '_original_edgecolor',
+ orig_handle.get_edgecolor())
+ legend_handle.set_edgecolor(first_color(edgecolor))
+ facecolor = getattr(orig_handle, '_original_facecolor',
+ orig_handle.get_facecolor())
+ legend_handle.set_facecolor(first_color(facecolor))
+ legend_handle.set_fill(orig_handle.get_fill())
+ legend_handle.set_hatch(orig_handle.get_hatch())
+ legend_handle.set_linewidth(get_first(orig_handle.get_linewidths()))
+ legend_handle.set_linestyle(get_first(orig_handle.get_linestyles()))
+ legend_handle.set_transform(get_first(orig_handle.get_transforms()))
+ legend_handle.set_figure(orig_handle.get_figure())
+ legend_handle.set_alpha(orig_handle.get_alpha())
+
+ def create_artists(self, legend, orig_handle,
+ xdescent, ydescent, width, height, fontsize, trans):
+ p = Rectangle(xy=(-xdescent, -ydescent),
+ width=width, height=height)
+ self.update_prop(p, orig_handle, legend)
+ p.set_transform(trans)
+ return [p]
diff --git a/venv/Lib/site-packages/matplotlib/lines.py b/venv/Lib/site-packages/matplotlib/lines.py
new file mode 100644
index 0000000..1203862
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/lines.py
@@ -0,0 +1,1562 @@
+"""
+The 2D line class which can draw with a variety of line styles, markers and
+colors.
+"""
+
+from numbers import Integral, Number, Real
+import logging
+
+import numpy as np
+
+import matplotlib as mpl
+from . import _api, artist, cbook, colors as mcolors, docstring, rcParams
+from .artist import Artist, allow_rasterization
+from .cbook import (
+ _to_unmasked_float_array, ls_mapper, ls_mapper_r, STEP_LOOKUP_MAP)
+from .markers import MarkerStyle
+from .path import Path
+from .transforms import Bbox, BboxTransformTo, TransformedPath
+from ._enums import JoinStyle, CapStyle
+
+# Imported here for backward compatibility, even though they don't
+# really belong.
+from . import _path
+from .markers import (
+ CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN,
+ CARETLEFTBASE, CARETRIGHTBASE, CARETUPBASE, CARETDOWNBASE,
+ TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN)
+
+_log = logging.getLogger(__name__)
+
+
+def _get_dash_pattern(style):
+ """Convert linestyle to dash pattern."""
+ # go from short hand -> full strings
+ if isinstance(style, str):
+ style = ls_mapper.get(style, style)
+ # un-dashed styles
+ if style in ['solid', 'None']:
+ offset = 0
+ dashes = None
+ # dashed styles
+ elif style in ['dashed', 'dashdot', 'dotted']:
+ offset = 0
+ dashes = tuple(rcParams['lines.{}_pattern'.format(style)])
+ #
+ elif isinstance(style, tuple):
+ offset, dashes = style
+ if offset is None:
+ _api.warn_deprecated(
+ "3.3", message="Passing the dash offset as None is deprecated "
+ "since %(since)s and support for it will be removed "
+ "%(removal)s; pass it as zero instead.")
+ offset = 0
+ else:
+ raise ValueError('Unrecognized linestyle: %s' % str(style))
+
+ # normalize offset to be positive and shorter than the dash cycle
+ if dashes is not None:
+ dsum = sum(dashes)
+ if dsum:
+ offset %= dsum
+
+ return offset, dashes
+
+
+def _scale_dashes(offset, dashes, lw):
+ if not rcParams['lines.scale_dashes']:
+ return offset, dashes
+ scaled_offset = offset * lw
+ scaled_dashes = ([x * lw if x is not None else None for x in dashes]
+ if dashes is not None else None)
+ return scaled_offset, scaled_dashes
+
+
+def segment_hits(cx, cy, x, y, radius):
+ """
+ Return the indices of the segments in the polyline with coordinates (*cx*,
+ *cy*) that are within a distance *radius* of the point (*x*, *y*).
+ """
+ # Process single points specially
+ if len(x) <= 1:
+ res, = np.nonzero((cx - x) ** 2 + (cy - y) ** 2 <= radius ** 2)
+ return res
+
+ # We need to lop the last element off a lot.
+ xr, yr = x[:-1], y[:-1]
+
+ # Only look at line segments whose nearest point to C on the line
+ # lies within the segment.
+ dx, dy = x[1:] - xr, y[1:] - yr
+ Lnorm_sq = dx ** 2 + dy ** 2 # Possibly want to eliminate Lnorm==0
+ u = ((cx - xr) * dx + (cy - yr) * dy) / Lnorm_sq
+ candidates = (u >= 0) & (u <= 1)
+
+ # Note that there is a little area near one side of each point
+ # which will be near neither segment, and another which will
+ # be near both, depending on the angle of the lines. The
+ # following radius test eliminates these ambiguities.
+ point_hits = (cx - x) ** 2 + (cy - y) ** 2 <= radius ** 2
+ candidates = candidates & ~(point_hits[:-1] | point_hits[1:])
+
+ # For those candidates which remain, determine how far they lie away
+ # from the line.
+ px, py = xr + u * dx, yr + u * dy
+ line_hits = (cx - px) ** 2 + (cy - py) ** 2 <= radius ** 2
+ line_hits = line_hits & candidates
+ points, = point_hits.ravel().nonzero()
+ lines, = line_hits.ravel().nonzero()
+ return np.concatenate((points, lines))
+
+
+def _mark_every_path(markevery, tpath, affine, ax_transform):
+ """
+ Helper function that sorts out how to deal the input
+ `markevery` and returns the points where markers should be drawn.
+
+ Takes in the `markevery` value and the line path and returns the
+ sub-sampled path.
+ """
+ # pull out the two bits of data we want from the path
+ codes, verts = tpath.codes, tpath.vertices
+
+ def _slice_or_none(in_v, slc):
+ """Helper function to cope with `codes` being an ndarray or `None`."""
+ if in_v is None:
+ return None
+ return in_v[slc]
+
+ # if just an int, assume starting at 0 and make a tuple
+ if isinstance(markevery, Integral):
+ markevery = (0, markevery)
+ # if just a float, assume starting at 0.0 and make a tuple
+ elif isinstance(markevery, Real):
+ markevery = (0.0, markevery)
+
+ if isinstance(markevery, tuple):
+ if len(markevery) != 2:
+ raise ValueError('`markevery` is a tuple but its len is not 2; '
+ 'markevery={}'.format(markevery))
+ start, step = markevery
+ # if step is an int, old behavior
+ if isinstance(step, Integral):
+ # tuple of 2 int is for backwards compatibility,
+ if not isinstance(start, Integral):
+ raise ValueError(
+ '`markevery` is a tuple with len 2 and second element is '
+ 'an int, but the first element is not an int; markevery={}'
+ .format(markevery))
+ # just return, we are done here
+
+ return Path(verts[slice(start, None, step)],
+ _slice_or_none(codes, slice(start, None, step)))
+
+ elif isinstance(step, Real):
+ if not isinstance(start, Real):
+ raise ValueError(
+ '`markevery` is a tuple with len 2 and second element is '
+ 'a float, but the first element is not a float or an int; '
+ 'markevery={}'.format(markevery))
+ # calc cumulative distance along path (in display coords):
+ disp_coords = affine.transform(tpath.vertices)
+ delta = np.empty((len(disp_coords), 2))
+ delta[0, :] = 0
+ delta[1:, :] = disp_coords[1:, :] - disp_coords[:-1, :]
+ delta = np.hypot(*delta.T).cumsum()
+ # calc distance between markers along path based on the axes
+ # bounding box diagonal being a distance of unity:
+ (x0, y0), (x1, y1) = ax_transform.transform([[0, 0], [1, 1]])
+ scale = np.hypot(x1 - x0, y1 - y0)
+ marker_delta = np.arange(start * scale, delta[-1], step * scale)
+ # find closest actual data point that is closest to
+ # the theoretical distance along the path:
+ inds = np.abs(delta[np.newaxis, :] - marker_delta[:, np.newaxis])
+ inds = inds.argmin(axis=1)
+ inds = np.unique(inds)
+ # return, we are done here
+ return Path(verts[inds], _slice_or_none(codes, inds))
+ else:
+ raise ValueError(
+ f"markevery={markevery!r} is a tuple with len 2, but its "
+ f"second element is not an int or a float")
+
+ elif isinstance(markevery, slice):
+ # mazol tov, it's already a slice, just return
+ return Path(verts[markevery], _slice_or_none(codes, markevery))
+
+ elif np.iterable(markevery):
+ # fancy indexing
+ try:
+ return Path(verts[markevery], _slice_or_none(codes, markevery))
+ except (ValueError, IndexError) as err:
+ raise ValueError(
+ f"markevery={markevery!r} is iterable but not a valid numpy "
+ f"fancy index") from err
+ else:
+ raise ValueError(f"markevery={markevery!r} is not a recognized value")
+
+
+@cbook._define_aliases({
+ "antialiased": ["aa"],
+ "color": ["c"],
+ "drawstyle": ["ds"],
+ "linestyle": ["ls"],
+ "linewidth": ["lw"],
+ "markeredgecolor": ["mec"],
+ "markeredgewidth": ["mew"],
+ "markerfacecolor": ["mfc"],
+ "markerfacecoloralt": ["mfcalt"],
+ "markersize": ["ms"],
+})
+class Line2D(Artist):
+ """
+ A line - the line can have both a solid linestyle connecting all
+ the vertices, and a marker at each vertex. Additionally, the
+ drawing of the solid line is influenced by the drawstyle, e.g., one
+ can create "stepped" lines in various styles.
+ """
+
+ lineStyles = _lineStyles = { # hidden names deprecated
+ '-': '_draw_solid',
+ '--': '_draw_dashed',
+ '-.': '_draw_dash_dot',
+ ':': '_draw_dotted',
+ 'None': '_draw_nothing',
+ ' ': '_draw_nothing',
+ '': '_draw_nothing',
+ }
+
+ _drawStyles_l = {
+ 'default': '_draw_lines',
+ 'steps-mid': '_draw_steps_mid',
+ 'steps-pre': '_draw_steps_pre',
+ 'steps-post': '_draw_steps_post',
+ }
+
+ _drawStyles_s = {
+ 'steps': '_draw_steps_pre',
+ }
+
+ # drawStyles should now be deprecated.
+ drawStyles = {**_drawStyles_l, **_drawStyles_s}
+ # Need a list ordered with long names first:
+ drawStyleKeys = [*_drawStyles_l, *_drawStyles_s]
+
+ # Referenced here to maintain API. These are defined in
+ # MarkerStyle
+ markers = MarkerStyle.markers
+ filled_markers = MarkerStyle.filled_markers
+ fillStyles = MarkerStyle.fillstyles
+
+ zorder = 2
+
+ @_api.deprecated("3.4")
+ @_api.classproperty
+ def validCap(cls):
+ return tuple(cs.value for cs in CapStyle)
+
+ @_api.deprecated("3.4")
+ @_api.classproperty
+ def validJoin(cls):
+ return tuple(js.value for js in JoinStyle)
+
+ def __str__(self):
+ if self._label != "":
+ return f"Line2D({self._label})"
+ elif self._x is None:
+ return "Line2D()"
+ elif len(self._x) > 3:
+ return "Line2D((%g,%g),(%g,%g),...,(%g,%g))" % (
+ self._x[0], self._y[0], self._x[0],
+ self._y[0], self._x[-1], self._y[-1])
+ else:
+ return "Line2D(%s)" % ",".join(
+ map("({:g},{:g})".format, self._x, self._y))
+
+ def __init__(self, xdata, ydata,
+ linewidth=None, # all Nones default to rc
+ linestyle=None,
+ color=None,
+ marker=None,
+ markersize=None,
+ markeredgewidth=None,
+ markeredgecolor=None,
+ markerfacecolor=None,
+ markerfacecoloralt='none',
+ fillstyle=None,
+ antialiased=None,
+ dash_capstyle=None,
+ solid_capstyle=None,
+ dash_joinstyle=None,
+ solid_joinstyle=None,
+ pickradius=5,
+ drawstyle=None,
+ markevery=None,
+ **kwargs
+ ):
+ """
+ Create a `.Line2D` instance with *x* and *y* data in sequences of
+ *xdata*, *ydata*.
+
+ Additional keyword arguments are `.Line2D` properties:
+
+ %(Line2D_kwdoc)s
+
+ See :meth:`set_linestyle` for a description of the line styles,
+ :meth:`set_marker` for a description of the markers, and
+ :meth:`set_drawstyle` for a description of the draw styles.
+
+ """
+ super().__init__()
+
+ #convert sequences to numpy arrays
+ if not np.iterable(xdata):
+ raise RuntimeError('xdata must be a sequence')
+ if not np.iterable(ydata):
+ raise RuntimeError('ydata must be a sequence')
+
+ if linewidth is None:
+ linewidth = rcParams['lines.linewidth']
+
+ if linestyle is None:
+ linestyle = rcParams['lines.linestyle']
+ if marker is None:
+ marker = rcParams['lines.marker']
+ if markerfacecolor is None:
+ markerfacecolor = rcParams['lines.markerfacecolor']
+ if markeredgecolor is None:
+ markeredgecolor = rcParams['lines.markeredgecolor']
+ if color is None:
+ color = rcParams['lines.color']
+
+ if markersize is None:
+ markersize = rcParams['lines.markersize']
+ if antialiased is None:
+ antialiased = rcParams['lines.antialiased']
+ if dash_capstyle is None:
+ dash_capstyle = rcParams['lines.dash_capstyle']
+ if dash_joinstyle is None:
+ dash_joinstyle = rcParams['lines.dash_joinstyle']
+ if solid_capstyle is None:
+ solid_capstyle = rcParams['lines.solid_capstyle']
+ if solid_joinstyle is None:
+ solid_joinstyle = rcParams['lines.solid_joinstyle']
+
+ if drawstyle is None:
+ drawstyle = 'default'
+
+ self._dashcapstyle = None
+ self._dashjoinstyle = None
+ self._solidjoinstyle = None
+ self._solidcapstyle = None
+ self.set_dash_capstyle(dash_capstyle)
+ self.set_dash_joinstyle(dash_joinstyle)
+ self.set_solid_capstyle(solid_capstyle)
+ self.set_solid_joinstyle(solid_joinstyle)
+
+ self._linestyles = None
+ self._drawstyle = None
+ self._linewidth = linewidth
+
+ # scaled dash + offset
+ self._dashSeq = None
+ self._dashOffset = 0
+ # unscaled dash + offset
+ # this is needed scaling the dash pattern by linewidth
+ self._us_dashSeq = None
+ self._us_dashOffset = 0
+
+ self.set_linewidth(linewidth)
+ self.set_linestyle(linestyle)
+ self.set_drawstyle(drawstyle)
+
+ self._color = None
+ self.set_color(color)
+ self._marker = MarkerStyle(marker, fillstyle)
+
+ self._markevery = None
+ self._markersize = None
+ self._antialiased = None
+
+ self.set_markevery(markevery)
+ self.set_antialiased(antialiased)
+ self.set_markersize(markersize)
+
+ self._markeredgecolor = None
+ self._markeredgewidth = None
+ self._markerfacecolor = None
+ self._markerfacecoloralt = None
+
+ self.set_markerfacecolor(markerfacecolor)
+ self.set_markerfacecoloralt(markerfacecoloralt)
+ self.set_markeredgecolor(markeredgecolor)
+ self.set_markeredgewidth(markeredgewidth)
+
+ # update kwargs before updating data to give the caller a
+ # chance to init axes (and hence unit support)
+ self.update(kwargs)
+ self.pickradius = pickradius
+ self.ind_offset = 0
+ if (isinstance(self._picker, Number) and
+ not isinstance(self._picker, bool)):
+ self.pickradius = self._picker
+
+ self._xorig = np.asarray([])
+ self._yorig = np.asarray([])
+ self._invalidx = True
+ self._invalidy = True
+ self._x = None
+ self._y = None
+ self._xy = None
+ self._path = None
+ self._transformed_path = None
+ self._subslice = False
+ self._x_filled = None # used in subslicing; only x is needed
+
+ self.set_data(xdata, ydata)
+
+ def contains(self, mouseevent):
+ """
+ Test whether *mouseevent* occurred on the line.
+
+ An event is deemed to have occurred "on" the line if it is less
+ than ``self.pickradius`` (default: 5 points) away from it. Use
+ `~.Line2D.get_pickradius` or `~.Line2D.set_pickradius` to get or set
+ the pick radius.
+
+ Parameters
+ ----------
+ mouseevent : `matplotlib.backend_bases.MouseEvent`
+
+ Returns
+ -------
+ contains : bool
+ Whether any values are within the radius.
+ details : dict
+ A dictionary ``{'ind': pointlist}``, where *pointlist* is a
+ list of points of the line that are within the pickradius around
+ the event position.
+
+ TODO: sort returned indices by distance
+ """
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+
+ # Make sure we have data to plot
+ if self._invalidy or self._invalidx:
+ self.recache()
+ if len(self._xy) == 0:
+ return False, {}
+
+ # Convert points to pixels
+ transformed_path = self._get_transformed_path()
+ path, affine = transformed_path.get_transformed_path_and_affine()
+ path = affine.transform_path(path)
+ xy = path.vertices
+ xt = xy[:, 0]
+ yt = xy[:, 1]
+
+ # Convert pick radius from points to pixels
+ if self.figure is None:
+ _log.warning('no figure set when check if mouse is on line')
+ pixels = self.pickradius
+ else:
+ pixels = self.figure.dpi / 72. * self.pickradius
+
+ # The math involved in checking for containment (here and inside of
+ # segment_hits) assumes that it is OK to overflow, so temporarily set
+ # the error flags accordingly.
+ with np.errstate(all='ignore'):
+ # Check for collision
+ if self._linestyle in ['None', None]:
+ # If no line, return the nearby point(s)
+ ind, = np.nonzero(
+ (xt - mouseevent.x) ** 2 + (yt - mouseevent.y) ** 2
+ <= pixels ** 2)
+ else:
+ # If line, return the nearby segment(s)
+ ind = segment_hits(mouseevent.x, mouseevent.y, xt, yt, pixels)
+ if self._drawstyle.startswith("steps"):
+ ind //= 2
+
+ ind += self.ind_offset
+
+ # Return the point(s) within radius
+ return len(ind) > 0, dict(ind=ind)
+
+ def get_pickradius(self):
+ """
+ Return the pick radius used for containment tests.
+
+ See `.contains` for more details.
+ """
+ return self._pickradius
+
+ def set_pickradius(self, d):
+ """
+ Set the pick radius used for containment tests.
+
+ See `.contains` for more details.
+
+ Parameters
+ ----------
+ d : float
+ Pick radius, in points.
+ """
+ if not isinstance(d, Number) or d < 0:
+ raise ValueError("pick radius should be a distance")
+ self._pickradius = d
+
+ pickradius = property(get_pickradius, set_pickradius)
+
+ def get_fillstyle(self):
+ """
+ Return the marker fill style.
+
+ See also `~.Line2D.set_fillstyle`.
+ """
+ return self._marker.get_fillstyle()
+
+ def set_fillstyle(self, fs):
+ """
+ Set the marker fill style.
+
+ Parameters
+ ----------
+ fs : {'full', 'left', 'right', 'bottom', 'top', 'none'}
+ Possible values:
+
+ - 'full': Fill the whole marker with the *markerfacecolor*.
+ - 'left', 'right', 'bottom', 'top': Fill the marker half at
+ the given side with the *markerfacecolor*. The other
+ half of the marker is filled with *markerfacecoloralt*.
+ - 'none': No filling.
+
+ For examples see :ref:`marker_fill_styles`.
+ """
+ self.set_marker(MarkerStyle(self._marker.get_marker(), fs))
+ self.stale = True
+
+ def set_markevery(self, every):
+ """
+ Set the markevery property to subsample the plot when using markers.
+
+ e.g., if ``every=5``, every 5-th marker will be plotted.
+
+ Parameters
+ ----------
+ every : None or int or (int, int) or slice or list[int] or float or \
+(float, float) or list[bool]
+ Which markers to plot.
+
+ - every=None, every point will be plotted.
+ - every=N, every N-th marker will be plotted starting with
+ marker 0.
+ - every=(start, N), every N-th marker, starting at point
+ start, will be plotted.
+ - every=slice(start, end, N), every N-th marker, starting at
+ point start, up to but not including point end, will be plotted.
+ - every=[i, j, m, n], only markers at points i, j, m, and n
+ will be plotted.
+ - every=[True, False, True], positions that are True will be
+ plotted.
+ - every=0.1, (i.e. a float) then markers will be spaced at
+ approximately equal distances along the line; the distance
+ along the line between markers is determined by multiplying the
+ display-coordinate distance of the axes bounding-box diagonal
+ by the value of every.
+ - every=(0.5, 0.1) (i.e. a length-2 tuple of float), the same
+ functionality as every=0.1 is exhibited but the first marker will
+ be 0.5 multiplied by the display-coordinate-diagonal-distance
+ along the line.
+
+ For examples see
+ :doc:`/gallery/lines_bars_and_markers/markevery_demo`.
+
+ Notes
+ -----
+ Setting the markevery property will only show markers at actual data
+ points. When using float arguments to set the markevery property
+ on irregularly spaced data, the markers will likely not appear evenly
+ spaced because the actual data points do not coincide with the
+ theoretical spacing between markers.
+
+ When using a start offset to specify the first marker, the offset will
+ be from the first data point which may be different from the first
+ the visible data point if the plot is zoomed in.
+
+ If zooming in on a plot when using float arguments then the actual
+ data points that have markers will change because the distance between
+ markers is always determined from the display-coordinates
+ axes-bounding-box-diagonal regardless of the actual axes data limits.
+
+ """
+ self._markevery = every
+ self.stale = True
+
+ def get_markevery(self):
+ """
+ Return the markevery setting for marker subsampling.
+
+ See also `~.Line2D.set_markevery`.
+ """
+ return self._markevery
+
+ def set_picker(self, p):
+ """
+ Sets the event picker details for the line.
+
+ Parameters
+ ----------
+ p : float or callable[[Artist, Event], tuple[bool, dict]]
+ If a float, it is used as the pick radius in points.
+ """
+ if callable(p):
+ self._contains = p
+ else:
+ self.pickradius = p
+ self._picker = p
+
+ def get_window_extent(self, renderer):
+ bbox = Bbox([[0, 0], [0, 0]])
+ trans_data_to_xy = self.get_transform().transform
+ bbox.update_from_data_xy(trans_data_to_xy(self.get_xydata()),
+ ignore=True)
+ # correct for marker size, if any
+ if self._marker:
+ ms = (self._markersize / 72.0 * self.figure.dpi) * 0.5
+ bbox = bbox.padded(ms)
+ return bbox
+
+ @Artist.axes.setter
+ def axes(self, ax):
+ # call the set method from the base-class property
+ Artist.axes.fset(self, ax)
+ if ax is not None:
+ for axis in ax._get_axis_map().values():
+ axis.callbacks._pickled_cids.add(
+ axis.callbacks.connect('units', self.recache_always))
+
+ def set_data(self, *args):
+ """
+ Set the x and y data.
+
+ Parameters
+ ----------
+ *args : (2, N) array or two 1D arrays
+ """
+ if len(args) == 1:
+ (x, y), = args
+ else:
+ x, y = args
+
+ self.set_xdata(x)
+ self.set_ydata(y)
+
+ def recache_always(self):
+ self.recache(always=True)
+
+ def recache(self, always=False):
+ if always or self._invalidx:
+ xconv = self.convert_xunits(self._xorig)
+ x = _to_unmasked_float_array(xconv).ravel()
+ else:
+ x = self._x
+ if always or self._invalidy:
+ yconv = self.convert_yunits(self._yorig)
+ y = _to_unmasked_float_array(yconv).ravel()
+ else:
+ y = self._y
+
+ self._xy = np.column_stack(np.broadcast_arrays(x, y)).astype(float)
+ self._x, self._y = self._xy.T # views
+
+ self._subslice = False
+ if (self.axes and len(x) > 1000 and self._is_sorted(x) and
+ self.axes.name == 'rectilinear' and
+ self.axes.get_xscale() == 'linear' and
+ self._markevery is None and
+ self.get_clip_on()):
+ self._subslice = True
+ nanmask = np.isnan(x)
+ if nanmask.any():
+ self._x_filled = self._x.copy()
+ indices = np.arange(len(x))
+ self._x_filled[nanmask] = np.interp(
+ indices[nanmask], indices[~nanmask], self._x[~nanmask])
+ else:
+ self._x_filled = self._x
+
+ if self._path is not None:
+ interpolation_steps = self._path._interpolation_steps
+ else:
+ interpolation_steps = 1
+ xy = STEP_LOOKUP_MAP[self._drawstyle](*self._xy.T)
+ self._path = Path(np.asarray(xy).T,
+ _interpolation_steps=interpolation_steps)
+ self._transformed_path = None
+ self._invalidx = False
+ self._invalidy = False
+
+ def _transform_path(self, subslice=None):
+ """
+ Puts a TransformedPath instance at self._transformed_path;
+ all invalidation of the transform is then handled by the
+ TransformedPath instance.
+ """
+ # Masked arrays are now handled by the Path class itself
+ if subslice is not None:
+ xy = STEP_LOOKUP_MAP[self._drawstyle](*self._xy[subslice, :].T)
+ _path = Path(np.asarray(xy).T,
+ _interpolation_steps=self._path._interpolation_steps)
+ else:
+ _path = self._path
+ self._transformed_path = TransformedPath(_path, self.get_transform())
+
+ def _get_transformed_path(self):
+ """
+ Return the :class:`~matplotlib.transforms.TransformedPath` instance
+ of this line.
+ """
+ if self._transformed_path is None:
+ self._transform_path()
+ return self._transformed_path
+
+ def set_transform(self, t):
+ """
+ Set the Transformation instance used by this artist.
+
+ Parameters
+ ----------
+ t : `matplotlib.transforms.Transform`
+ """
+ super().set_transform(t)
+ self._invalidx = True
+ self._invalidy = True
+ self.stale = True
+
+ def _is_sorted(self, x):
+ """Return whether x is sorted in ascending order."""
+ # We don't handle the monotonically decreasing case.
+ return _path.is_sorted(x)
+
+ @allow_rasterization
+ def draw(self, renderer):
+ # docstring inherited
+
+ if not self.get_visible():
+ return
+
+ if self._invalidy or self._invalidx:
+ self.recache()
+ self.ind_offset = 0 # Needed for contains() method.
+ if self._subslice and self.axes:
+ x0, x1 = self.axes.get_xbound()
+ i0 = self._x_filled.searchsorted(x0, 'left')
+ i1 = self._x_filled.searchsorted(x1, 'right')
+ subslice = slice(max(i0 - 1, 0), i1 + 1)
+ self.ind_offset = subslice.start
+ self._transform_path(subslice)
+ else:
+ subslice = None
+
+ if self.get_path_effects():
+ from matplotlib.patheffects import PathEffectRenderer
+ renderer = PathEffectRenderer(self.get_path_effects(), renderer)
+
+ renderer.open_group('line2d', self.get_gid())
+ if self._lineStyles[self._linestyle] != '_draw_nothing':
+ tpath, affine = (self._get_transformed_path()
+ .get_transformed_path_and_affine())
+ if len(tpath.vertices):
+ gc = renderer.new_gc()
+ self._set_gc_clip(gc)
+ gc.set_url(self.get_url())
+
+ lc_rgba = mcolors.to_rgba(self._color, self._alpha)
+ gc.set_foreground(lc_rgba, isRGBA=True)
+
+ gc.set_antialiased(self._antialiased)
+ gc.set_linewidth(self._linewidth)
+
+ if self.is_dashed():
+ cap = self._dashcapstyle
+ join = self._dashjoinstyle
+ else:
+ cap = self._solidcapstyle
+ join = self._solidjoinstyle
+ gc.set_joinstyle(join)
+ gc.set_capstyle(cap)
+ gc.set_snap(self.get_snap())
+ if self.get_sketch_params() is not None:
+ gc.set_sketch_params(*self.get_sketch_params())
+
+ gc.set_dashes(self._dashOffset, self._dashSeq)
+ renderer.draw_path(gc, tpath, affine.frozen())
+ gc.restore()
+
+ if self._marker and self._markersize > 0:
+ gc = renderer.new_gc()
+ self._set_gc_clip(gc)
+ gc.set_url(self.get_url())
+ gc.set_linewidth(self._markeredgewidth)
+ gc.set_antialiased(self._antialiased)
+
+ ec_rgba = mcolors.to_rgba(
+ self.get_markeredgecolor(), self._alpha)
+ fc_rgba = mcolors.to_rgba(
+ self._get_markerfacecolor(), self._alpha)
+ fcalt_rgba = mcolors.to_rgba(
+ self._get_markerfacecolor(alt=True), self._alpha)
+ # If the edgecolor is "auto", it is set according to the *line*
+ # color but inherits the alpha value of the *face* color, if any.
+ if (cbook._str_equal(self._markeredgecolor, "auto")
+ and not cbook._str_lower_equal(
+ self.get_markerfacecolor(), "none")):
+ ec_rgba = ec_rgba[:3] + (fc_rgba[3],)
+ gc.set_foreground(ec_rgba, isRGBA=True)
+ if self.get_sketch_params() is not None:
+ scale, length, randomness = self.get_sketch_params()
+ gc.set_sketch_params(scale/2, length/2, 2*randomness)
+
+ marker = self._marker
+
+ # Markers *must* be drawn ignoring the drawstyle (but don't pay the
+ # recaching if drawstyle is already "default").
+ if self.get_drawstyle() != "default":
+ with cbook._setattr_cm(
+ self, _drawstyle="default", _transformed_path=None):
+ self.recache()
+ self._transform_path(subslice)
+ tpath, affine = (self._get_transformed_path()
+ .get_transformed_points_and_affine())
+ else:
+ tpath, affine = (self._get_transformed_path()
+ .get_transformed_points_and_affine())
+
+ if len(tpath.vertices):
+ # subsample the markers if markevery is not None
+ markevery = self.get_markevery()
+ if markevery is not None:
+ subsampled = _mark_every_path(markevery, tpath,
+ affine, self.axes.transAxes)
+ else:
+ subsampled = tpath
+
+ snap = marker.get_snap_threshold()
+ if isinstance(snap, Real):
+ snap = renderer.points_to_pixels(self._markersize) >= snap
+ gc.set_snap(snap)
+ gc.set_joinstyle(marker.get_joinstyle())
+ gc.set_capstyle(marker.get_capstyle())
+ marker_path = marker.get_path()
+ marker_trans = marker.get_transform()
+ w = renderer.points_to_pixels(self._markersize)
+
+ if cbook._str_equal(marker.get_marker(), ","):
+ gc.set_linewidth(0)
+ else:
+ # Don't scale for pixels, and don't stroke them
+ marker_trans = marker_trans.scale(w)
+ renderer.draw_markers(gc, marker_path, marker_trans,
+ subsampled, affine.frozen(),
+ fc_rgba)
+
+ alt_marker_path = marker.get_alt_path()
+ if alt_marker_path:
+ alt_marker_trans = marker.get_alt_transform()
+ alt_marker_trans = alt_marker_trans.scale(w)
+ renderer.draw_markers(
+ gc, alt_marker_path, alt_marker_trans, subsampled,
+ affine.frozen(), fcalt_rgba)
+
+ gc.restore()
+
+ renderer.close_group('line2d')
+ self.stale = False
+
+ def get_antialiased(self):
+ """Return whether antialiased rendering is used."""
+ return self._antialiased
+
+ def get_color(self):
+ """
+ Return the line color.
+
+ See also `~.Line2D.set_color`.
+ """
+ return self._color
+
+ def get_drawstyle(self):
+ """
+ Return the drawstyle.
+
+ See also `~.Line2D.set_drawstyle`.
+ """
+ return self._drawstyle
+
+ def get_linestyle(self):
+ """
+ Return the linestyle.
+
+ See also `~.Line2D.set_linestyle`.
+ """
+ return self._linestyle
+
+ def get_linewidth(self):
+ """
+ Return the linewidth in points.
+
+ See also `~.Line2D.set_linewidth`.
+ """
+ return self._linewidth
+
+ def get_marker(self):
+ """
+ Return the line marker.
+
+ See also `~.Line2D.set_marker`.
+ """
+ return self._marker.get_marker()
+
+ def get_markeredgecolor(self):
+ """
+ Return the marker edge color.
+
+ See also `~.Line2D.set_markeredgecolor`.
+ """
+ mec = self._markeredgecolor
+ if cbook._str_equal(mec, 'auto'):
+ if rcParams['_internal.classic_mode']:
+ if self._marker.get_marker() in ('.', ','):
+ return self._color
+ if (self._marker.is_filled()
+ and self._marker.get_fillstyle() != 'none'):
+ return 'k' # Bad hard-wired default...
+ return self._color
+ else:
+ return mec
+
+ def get_markeredgewidth(self):
+ """
+ Return the marker edge width in points.
+
+ See also `~.Line2D.set_markeredgewidth`.
+ """
+ return self._markeredgewidth
+
+ def _get_markerfacecolor(self, alt=False):
+ if self._marker.get_fillstyle() == 'none':
+ return 'none'
+ fc = self._markerfacecoloralt if alt else self._markerfacecolor
+ if cbook._str_lower_equal(fc, 'auto'):
+ return self._color
+ else:
+ return fc
+
+ def get_markerfacecolor(self):
+ """
+ Return the marker face color.
+
+ See also `~.Line2D.set_markerfacecolor`.
+ """
+ return self._get_markerfacecolor(alt=False)
+
+ def get_markerfacecoloralt(self):
+ """
+ Return the alternate marker face color.
+
+ See also `~.Line2D.set_markerfacecoloralt`.
+ """
+ return self._get_markerfacecolor(alt=True)
+
+ def get_markersize(self):
+ """
+ Return the marker size in points.
+
+ See also `~.Line2D.set_markersize`.
+ """
+ return self._markersize
+
+ def get_data(self, orig=True):
+ """
+ Return the line data as an ``(xdata, ydata)`` pair.
+
+ If *orig* is *True*, return the original data.
+ """
+ return self.get_xdata(orig=orig), self.get_ydata(orig=orig)
+
+ def get_xdata(self, orig=True):
+ """
+ Return the xdata.
+
+ If *orig* is *True*, return the original data, else the
+ processed data.
+ """
+ if orig:
+ return self._xorig
+ if self._invalidx:
+ self.recache()
+ return self._x
+
+ def get_ydata(self, orig=True):
+ """
+ Return the ydata.
+
+ If *orig* is *True*, return the original data, else the
+ processed data.
+ """
+ if orig:
+ return self._yorig
+ if self._invalidy:
+ self.recache()
+ return self._y
+
+ def get_path(self):
+ """
+ Return the :class:`~matplotlib.path.Path` object associated
+ with this line.
+ """
+ if self._invalidy or self._invalidx:
+ self.recache()
+ return self._path
+
+ def get_xydata(self):
+ """
+ Return the *xy* data as a Nx2 numpy array.
+ """
+ if self._invalidy or self._invalidx:
+ self.recache()
+ return self._xy
+
+ def set_antialiased(self, b):
+ """
+ Set whether to use antialiased rendering.
+
+ Parameters
+ ----------
+ b : bool
+ """
+ if self._antialiased != b:
+ self.stale = True
+ self._antialiased = b
+
+ def set_color(self, color):
+ """
+ Set the color of the line.
+
+ Parameters
+ ----------
+ color : color
+ """
+ if not cbook._str_equal(color, 'auto'):
+ mcolors._check_color_like(color=color)
+ self._color = color
+ self.stale = True
+
+ def set_drawstyle(self, drawstyle):
+ """
+ Set the drawstyle of the plot.
+
+ The drawstyle determines how the points are connected.
+
+ Parameters
+ ----------
+ drawstyle : {'default', 'steps', 'steps-pre', 'steps-mid', \
+'steps-post'}, default: 'default'
+ For 'default', the points are connected with straight lines.
+
+ The steps variants connect the points with step-like lines,
+ i.e. horizontal lines with vertical steps. They differ in the
+ location of the step:
+
+ - 'steps-pre': The step is at the beginning of the line segment,
+ i.e. the line will be at the y-value of point to the right.
+ - 'steps-mid': The step is halfway between the points.
+ - 'steps-post: The step is at the end of the line segment,
+ i.e. the line will be at the y-value of the point to the left.
+ - 'steps' is equal to 'steps-pre' and is maintained for
+ backward-compatibility.
+
+ For examples see :doc:`/gallery/lines_bars_and_markers/step_demo`.
+ """
+ if drawstyle is None:
+ drawstyle = 'default'
+ _api.check_in_list(self.drawStyles, drawstyle=drawstyle)
+ if self._drawstyle != drawstyle:
+ self.stale = True
+ # invalidate to trigger a recache of the path
+ self._invalidx = True
+ self._drawstyle = drawstyle
+
+ def set_linewidth(self, w):
+ """
+ Set the line width in points.
+
+ Parameters
+ ----------
+ w : float
+ Line width, in points.
+ """
+ w = float(w)
+
+ if self._linewidth != w:
+ self.stale = True
+ self._linewidth = w
+ # rescale the dashes + offset
+ self._dashOffset, self._dashSeq = _scale_dashes(
+ self._us_dashOffset, self._us_dashSeq, self._linewidth)
+
+ def set_linestyle(self, ls):
+ """
+ Set the linestyle of the line.
+
+ Parameters
+ ----------
+ ls : {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
+ Possible values:
+
+ - A string:
+
+ =============================== =================
+ Linestyle Description
+ =============================== =================
+ ``'-'`` or ``'solid'`` solid line
+ ``'--'`` or ``'dashed'`` dashed line
+ ``'-.'`` or ``'dashdot'`` dash-dotted line
+ ``':'`` or ``'dotted'`` dotted line
+ ``'None'`` or ``' '`` or ``''`` draw nothing
+ =============================== =================
+
+ - Alternatively a dash tuple of the following form can be
+ provided::
+
+ (offset, onoffseq)
+
+ where ``onoffseq`` is an even length tuple of on and off ink
+ in points. See also :meth:`set_dashes`.
+
+ For examples see :doc:`/gallery/lines_bars_and_markers/linestyles`.
+ """
+ if isinstance(ls, str):
+ if ls in [' ', '', 'none']:
+ ls = 'None'
+
+ _api.check_in_list([*self._lineStyles, *ls_mapper_r], ls=ls)
+ if ls not in self._lineStyles:
+ ls = ls_mapper_r[ls]
+ self._linestyle = ls
+ else:
+ self._linestyle = '--'
+
+ # get the unscaled dashes
+ self._us_dashOffset, self._us_dashSeq = _get_dash_pattern(ls)
+ # compute the linewidth scaled dashes
+ self._dashOffset, self._dashSeq = _scale_dashes(
+ self._us_dashOffset, self._us_dashSeq, self._linewidth)
+
+ @docstring.interpd
+ def set_marker(self, marker):
+ """
+ Set the line marker.
+
+ Parameters
+ ----------
+ marker : marker style string, `~.path.Path` or `~.markers.MarkerStyle`
+ See `~matplotlib.markers` for full description of possible
+ arguments.
+ """
+ self._marker = MarkerStyle(marker, self._marker.get_fillstyle())
+ self.stale = True
+
+ def set_markeredgecolor(self, ec):
+ """
+ Set the marker edge color.
+
+ Parameters
+ ----------
+ ec : color
+ """
+ if ec is None:
+ ec = 'auto'
+ if (self._markeredgecolor is None
+ or np.any(self._markeredgecolor != ec)):
+ self.stale = True
+ self._markeredgecolor = ec
+
+ def set_markeredgewidth(self, ew):
+ """
+ Set the marker edge width in points.
+
+ Parameters
+ ----------
+ ew : float
+ Marker edge width, in points.
+ """
+ if ew is None:
+ ew = rcParams['lines.markeredgewidth']
+ if self._markeredgewidth != ew:
+ self.stale = True
+ self._markeredgewidth = ew
+
+ def set_markerfacecolor(self, fc):
+ """
+ Set the marker face color.
+
+ Parameters
+ ----------
+ fc : color
+ """
+ if fc is None:
+ fc = 'auto'
+ if np.any(self._markerfacecolor != fc):
+ self.stale = True
+ self._markerfacecolor = fc
+
+ def set_markerfacecoloralt(self, fc):
+ """
+ Set the alternate marker face color.
+
+ Parameters
+ ----------
+ fc : color
+ """
+ if fc is None:
+ fc = 'auto'
+ if np.any(self._markerfacecoloralt != fc):
+ self.stale = True
+ self._markerfacecoloralt = fc
+
+ def set_markersize(self, sz):
+ """
+ Set the marker size in points.
+
+ Parameters
+ ----------
+ sz : float
+ Marker size, in points.
+ """
+ sz = float(sz)
+ if self._markersize != sz:
+ self.stale = True
+ self._markersize = sz
+
+ def set_xdata(self, x):
+ """
+ Set the data array for x.
+
+ Parameters
+ ----------
+ x : 1D array
+ """
+ self._xorig = x
+ self._invalidx = True
+ self.stale = True
+
+ def set_ydata(self, y):
+ """
+ Set the data array for y.
+
+ Parameters
+ ----------
+ y : 1D array
+ """
+ self._yorig = y
+ self._invalidy = True
+ self.stale = True
+
+ def set_dashes(self, seq):
+ """
+ Set the dash sequence.
+
+ The dash sequence is a sequence of floats of even length describing
+ the length of dashes and spaces in points.
+
+ For example, (5, 2, 1, 2) describes a sequence of 5 point and 1 point
+ dashes separated by 2 point spaces.
+
+ Parameters
+ ----------
+ seq : sequence of floats (on/off ink in points) or (None, None)
+ If *seq* is empty or ``(None, None)``, the linestyle will be set
+ to solid.
+ """
+ if seq == (None, None) or len(seq) == 0:
+ self.set_linestyle('-')
+ else:
+ self.set_linestyle((0, seq))
+
+ def update_from(self, other):
+ """Copy properties from *other* to self."""
+ super().update_from(other)
+ self._linestyle = other._linestyle
+ self._linewidth = other._linewidth
+ self._color = other._color
+ self._markersize = other._markersize
+ self._markerfacecolor = other._markerfacecolor
+ self._markerfacecoloralt = other._markerfacecoloralt
+ self._markeredgecolor = other._markeredgecolor
+ self._markeredgewidth = other._markeredgewidth
+ self._dashSeq = other._dashSeq
+ self._us_dashSeq = other._us_dashSeq
+ self._dashOffset = other._dashOffset
+ self._us_dashOffset = other._us_dashOffset
+ self._dashcapstyle = other._dashcapstyle
+ self._dashjoinstyle = other._dashjoinstyle
+ self._solidcapstyle = other._solidcapstyle
+ self._solidjoinstyle = other._solidjoinstyle
+
+ self._linestyle = other._linestyle
+ self._marker = MarkerStyle(marker=other._marker)
+ self._drawstyle = other._drawstyle
+
+ @docstring.interpd
+ def set_dash_joinstyle(self, s):
+ """
+ How to join segments of the line if it `~Line2D.is_dashed`.
+
+ Parameters
+ ----------
+ s : `.JoinStyle` or %(JoinStyle)s
+ """
+ js = JoinStyle(s)
+ if self._dashjoinstyle != js:
+ self.stale = True
+ self._dashjoinstyle = js
+
+ @docstring.interpd
+ def set_solid_joinstyle(self, s):
+ """
+ How to join segments if the line is solid (not `~Line2D.is_dashed`).
+
+ Parameters
+ ----------
+ s : `.JoinStyle` or %(JoinStyle)s
+ """
+ js = JoinStyle(s)
+ if self._solidjoinstyle != js:
+ self.stale = True
+ self._solidjoinstyle = js
+
+ def get_dash_joinstyle(self):
+ """
+ Return the `.JoinStyle` for dashed lines.
+
+ See also `~.Line2D.set_dash_joinstyle`.
+ """
+ return self._dashjoinstyle.name
+
+ def get_solid_joinstyle(self):
+ """
+ Return the `.JoinStyle` for solid lines.
+
+ See also `~.Line2D.set_solid_joinstyle`.
+ """
+ return self._solidjoinstyle.name
+
+ @docstring.interpd
+ def set_dash_capstyle(self, s):
+ """
+ How to draw the end caps if the line is `~Line2D.is_dashed`.
+
+ Parameters
+ ----------
+ s : `.CapStyle` or %(CapStyle)s
+ """
+ cs = CapStyle(s)
+ if self._dashcapstyle != cs:
+ self.stale = True
+ self._dashcapstyle = cs
+
+ @docstring.interpd
+ def set_solid_capstyle(self, s):
+ """
+ How to draw the end caps if the line is solid (not `~Line2D.is_dashed`)
+
+ Parameters
+ ----------
+ s : `.CapStyle` or %(CapStyle)s
+ """
+ cs = CapStyle(s)
+ if self._solidcapstyle != cs:
+ self.stale = True
+ self._solidcapstyle = cs
+
+ def get_dash_capstyle(self):
+ """
+ Return the `.CapStyle` for dashed lines.
+
+ See also `~.Line2D.set_dash_capstyle`.
+ """
+ return self._dashcapstyle.name
+
+ def get_solid_capstyle(self):
+ """
+ Return the `.CapStyle` for solid lines.
+
+ See also `~.Line2D.set_solid_capstyle`.
+ """
+ return self._solidcapstyle.name
+
+ def is_dashed(self):
+ """
+ Return whether line has a dashed linestyle.
+
+ A custom linestyle is assumed to be dashed, we do not inspect the
+ ``onoffseq`` directly.
+
+ See also `~.Line2D.set_linestyle`.
+ """
+ return self._linestyle in ('--', '-.', ':')
+
+
+class _AxLine(Line2D):
+ """
+ A helper class that implements `~.Axes.axline`, by recomputing the artist
+ transform at draw time.
+ """
+
+ def __init__(self, xy1, xy2, slope, **kwargs):
+ super().__init__([0, 1], [0, 1], **kwargs)
+
+ if (xy2 is None and slope is None or
+ xy2 is not None and slope is not None):
+ raise TypeError(
+ "Exactly one of 'xy2' and 'slope' must be given")
+
+ self._slope = slope
+ self._xy1 = xy1
+ self._xy2 = xy2
+
+ def get_transform(self):
+ ax = self.axes
+ points_transform = self._transform - ax.transData + ax.transScale
+
+ if self._xy2 is not None:
+ # two points were given
+ (x1, y1), (x2, y2) = \
+ points_transform.transform([self._xy1, self._xy2])
+ dx = x2 - x1
+ dy = y2 - y1
+ if np.allclose(x1, x2):
+ if np.allclose(y1, y2):
+ raise ValueError(
+ f"Cannot draw a line through two identical points "
+ f"(x={(x1, x2)}, y={(y1, y2)})")
+ slope = np.inf
+ else:
+ slope = dy / dx
+ else:
+ # one point and a slope were given
+ x1, y1 = points_transform.transform(self._xy1)
+ slope = self._slope
+ (vxlo, vylo), (vxhi, vyhi) = ax.transScale.transform(ax.viewLim)
+ # General case: find intersections with view limits in either
+ # direction, and draw between the middle two points.
+ if np.isclose(slope, 0):
+ start = vxlo, y1
+ stop = vxhi, y1
+ elif np.isinf(slope):
+ start = x1, vylo
+ stop = x1, vyhi
+ else:
+ _, start, stop, _ = sorted([
+ (vxlo, y1 + (vxlo - x1) * slope),
+ (vxhi, y1 + (vxhi - x1) * slope),
+ (x1 + (vylo - y1) / slope, vylo),
+ (x1 + (vyhi - y1) / slope, vyhi),
+ ])
+ return (BboxTransformTo(Bbox([start, stop]))
+ + ax.transLimits + ax.transAxes)
+
+ def draw(self, renderer):
+ self._transformed_path = None # Force regen.
+ super().draw(renderer)
+
+
+class VertexSelector:
+ """
+ Manage the callbacks to maintain a list of selected vertices for
+ `.Line2D`. Derived classes should override
+ :meth:`~matplotlib.lines.VertexSelector.process_selected` to do
+ something with the picks.
+
+ Here is an example which highlights the selected verts with red
+ circles::
+
+ import numpy as np
+ import matplotlib.pyplot as plt
+ import matplotlib.lines as lines
+
+ class HighlightSelected(lines.VertexSelector):
+ def __init__(self, line, fmt='ro', **kwargs):
+ lines.VertexSelector.__init__(self, line)
+ self.markers, = self.axes.plot([], [], fmt, **kwargs)
+
+ def process_selected(self, ind, xs, ys):
+ self.markers.set_data(xs, ys)
+ self.canvas.draw()
+
+ fig, ax = plt.subplots()
+ x, y = np.random.rand(2, 30)
+ line, = ax.plot(x, y, 'bs-', picker=5)
+
+ selector = HighlightSelected(line)
+ plt.show()
+
+ """
+ def __init__(self, line):
+ """
+ Initialize the class with a `.Line2D` instance. The line should
+ already be added to some :class:`matplotlib.axes.Axes` instance and
+ should have the picker property set.
+ """
+ if line.axes is None:
+ raise RuntimeError('You must first add the line to the Axes')
+
+ if line.get_picker() is None:
+ raise RuntimeError('You must first set the picker property '
+ 'of the line')
+
+ self.axes = line.axes
+ self.line = line
+ self.canvas = self.axes.figure.canvas
+ self.cid = self.canvas.mpl_connect('pick_event', self.onpick)
+
+ self.ind = set()
+
+ def process_selected(self, ind, xs, ys):
+ """
+ Default "do nothing" implementation of the
+ :meth:`process_selected` method.
+
+ Parameters
+ ----------
+ ind : list of int
+ The indices of the selected vertices.
+ xs, ys : array-like
+ The coordinates of the selected vertices.
+ """
+ pass
+
+ def onpick(self, event):
+ """When the line is picked, update the set of selected indices."""
+ if event.artist is not self.line:
+ return
+ self.ind ^= set(event.ind)
+ ind = sorted(self.ind)
+ xdata, ydata = self.line.get_data()
+ self.process_selected(ind, xdata[ind], ydata[ind])
+
+
+lineStyles = Line2D._lineStyles
+lineMarkers = MarkerStyle.markers
+drawStyles = Line2D.drawStyles
+fillStyles = MarkerStyle.fillstyles
+
+docstring.interpd.update(Line2D_kwdoc=artist.kwdoc(Line2D))
+
+# You can not set the docstring of an instancemethod,
+# but you can on the underlying function. Go figure.
+docstring.interpd(Line2D.__init__)
diff --git a/venv/Lib/site-packages/matplotlib/markers.py b/venv/Lib/site-packages/matplotlib/markers.py
new file mode 100644
index 0000000..ae2bb3d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/markers.py
@@ -0,0 +1,841 @@
+r"""
+Functions to handle markers; used by the marker functionality of
+`~matplotlib.axes.Axes.plot`, `~matplotlib.axes.Axes.scatter`, and
+`~matplotlib.axes.Axes.errorbar`.
+
+All possible markers are defined here:
+
+============================== ====== =========================================
+marker symbol description
+============================== ====== =========================================
+``"."`` |m00| point
+``","`` |m01| pixel
+``"o"`` |m02| circle
+``"v"`` |m03| triangle_down
+``"^"`` |m04| triangle_up
+``"<"`` |m05| triangle_left
+``">"`` |m06| triangle_right
+``"1"`` |m07| tri_down
+``"2"`` |m08| tri_up
+``"3"`` |m09| tri_left
+``"4"`` |m10| tri_right
+``"8"`` |m11| octagon
+``"s"`` |m12| square
+``"p"`` |m13| pentagon
+``"P"`` |m23| plus (filled)
+``"*"`` |m14| star
+``"h"`` |m15| hexagon1
+``"H"`` |m16| hexagon2
+``"+"`` |m17| plus
+``"x"`` |m18| x
+``"X"`` |m24| x (filled)
+``"D"`` |m19| diamond
+``"d"`` |m20| thin_diamond
+``"|"`` |m21| vline
+``"_"`` |m22| hline
+``0`` (``TICKLEFT``) |m25| tickleft
+``1`` (``TICKRIGHT``) |m26| tickright
+``2`` (``TICKUP``) |m27| tickup
+``3`` (``TICKDOWN``) |m28| tickdown
+``4`` (``CARETLEFT``) |m29| caretleft
+``5`` (``CARETRIGHT``) |m30| caretright
+``6`` (``CARETUP``) |m31| caretup
+``7`` (``CARETDOWN``) |m32| caretdown
+``8`` (``CARETLEFTBASE``) |m33| caretleft (centered at base)
+``9`` (``CARETRIGHTBASE``) |m34| caretright (centered at base)
+``10`` (``CARETUPBASE``) |m35| caretup (centered at base)
+``11`` (``CARETDOWNBASE``) |m36| caretdown (centered at base)
+``"None"``, ``" "`` or ``""`` nothing
+``'$...$'`` |m37| Render the string using mathtext.
+ E.g ``"$f$"`` for marker showing the
+ letter ``f``.
+``verts`` A list of (x, y) pairs used for Path
+ vertices. The center of the marker is
+ located at (0, 0) and the size is
+ normalized, such that the created path
+ is encapsulated inside the unit cell.
+path A `~matplotlib.path.Path` instance.
+``(numsides, 0, angle)`` A regular polygon with ``numsides``
+ sides, rotated by ``angle``.
+``(numsides, 1, angle)`` A star-like symbol with ``numsides``
+ sides, rotated by ``angle``.
+``(numsides, 2, angle)`` An asterisk with ``numsides`` sides,
+ rotated by ``angle``.
+============================== ====== =========================================
+
+``None`` is the default which means 'nothing', however this table is
+referred to from other docs for the valid inputs from marker inputs and in
+those cases ``None`` still means 'default'.
+
+Note that special symbols can be defined via the
+:doc:`STIX math font `,
+e.g. ``"$\u266B$"``. For an overview over the STIX font symbols refer to the
+`STIX font table `_.
+Also see the :doc:`/gallery/text_labels_and_annotations/stix_fonts_demo`.
+
+Integer numbers from ``0`` to ``11`` create lines and triangles. Those are
+equally accessible via capitalized variables, like ``CARETDOWNBASE``.
+Hence the following are equivalent::
+
+ plt.plot([1, 2, 3], marker=11)
+ plt.plot([1, 2, 3], marker=matplotlib.markers.CARETDOWNBASE)
+
+Examples showing the use of markers:
+
+* :doc:`/gallery/lines_bars_and_markers/marker_reference`
+* :doc:`/gallery/shapes_and_collections/marker_path`
+* :doc:`/gallery/lines_bars_and_markers/scatter_star_poly`
+
+
+.. |m00| image:: /_static/markers/m00.png
+.. |m01| image:: /_static/markers/m01.png
+.. |m02| image:: /_static/markers/m02.png
+.. |m03| image:: /_static/markers/m03.png
+.. |m04| image:: /_static/markers/m04.png
+.. |m05| image:: /_static/markers/m05.png
+.. |m06| image:: /_static/markers/m06.png
+.. |m07| image:: /_static/markers/m07.png
+.. |m08| image:: /_static/markers/m08.png
+.. |m09| image:: /_static/markers/m09.png
+.. |m10| image:: /_static/markers/m10.png
+.. |m11| image:: /_static/markers/m11.png
+.. |m12| image:: /_static/markers/m12.png
+.. |m13| image:: /_static/markers/m13.png
+.. |m14| image:: /_static/markers/m14.png
+.. |m15| image:: /_static/markers/m15.png
+.. |m16| image:: /_static/markers/m16.png
+.. |m17| image:: /_static/markers/m17.png
+.. |m18| image:: /_static/markers/m18.png
+.. |m19| image:: /_static/markers/m19.png
+.. |m20| image:: /_static/markers/m20.png
+.. |m21| image:: /_static/markers/m21.png
+.. |m22| image:: /_static/markers/m22.png
+.. |m23| image:: /_static/markers/m23.png
+.. |m24| image:: /_static/markers/m24.png
+.. |m25| image:: /_static/markers/m25.png
+.. |m26| image:: /_static/markers/m26.png
+.. |m27| image:: /_static/markers/m27.png
+.. |m28| image:: /_static/markers/m28.png
+.. |m29| image:: /_static/markers/m29.png
+.. |m30| image:: /_static/markers/m30.png
+.. |m31| image:: /_static/markers/m31.png
+.. |m32| image:: /_static/markers/m32.png
+.. |m33| image:: /_static/markers/m33.png
+.. |m34| image:: /_static/markers/m34.png
+.. |m35| image:: /_static/markers/m35.png
+.. |m36| image:: /_static/markers/m36.png
+.. |m37| image:: /_static/markers/m37.png
+"""
+
+from collections.abc import Sized
+
+import numpy as np
+
+from . import _api, cbook, rcParams
+from .path import Path
+from .transforms import IdentityTransform, Affine2D
+from ._enums import JoinStyle, CapStyle
+
+# special-purpose marker identifiers:
+(TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN,
+ CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN,
+ CARETLEFTBASE, CARETRIGHTBASE, CARETUPBASE, CARETDOWNBASE) = range(12)
+
+_empty_path = Path(np.empty((0, 2)))
+
+
+class MarkerStyle:
+ """
+ A class representing marker types.
+
+ Instances are immutable. If you need to change anything, create a new
+ instance.
+
+ Attributes
+ ----------
+ markers : list
+ All known markers.
+ filled_markers : list
+ All known filled markers. This is a subset of *markers*.
+ fillstyles : list
+ The supported fillstyles.
+ """
+
+ markers = {
+ '.': 'point',
+ ',': 'pixel',
+ 'o': 'circle',
+ 'v': 'triangle_down',
+ '^': 'triangle_up',
+ '<': 'triangle_left',
+ '>': 'triangle_right',
+ '1': 'tri_down',
+ '2': 'tri_up',
+ '3': 'tri_left',
+ '4': 'tri_right',
+ '8': 'octagon',
+ 's': 'square',
+ 'p': 'pentagon',
+ '*': 'star',
+ 'h': 'hexagon1',
+ 'H': 'hexagon2',
+ '+': 'plus',
+ 'x': 'x',
+ 'D': 'diamond',
+ 'd': 'thin_diamond',
+ '|': 'vline',
+ '_': 'hline',
+ 'P': 'plus_filled',
+ 'X': 'x_filled',
+ TICKLEFT: 'tickleft',
+ TICKRIGHT: 'tickright',
+ TICKUP: 'tickup',
+ TICKDOWN: 'tickdown',
+ CARETLEFT: 'caretleft',
+ CARETRIGHT: 'caretright',
+ CARETUP: 'caretup',
+ CARETDOWN: 'caretdown',
+ CARETLEFTBASE: 'caretleftbase',
+ CARETRIGHTBASE: 'caretrightbase',
+ CARETUPBASE: 'caretupbase',
+ CARETDOWNBASE: 'caretdownbase',
+ "None": 'nothing',
+ None: 'nothing',
+ ' ': 'nothing',
+ '': 'nothing'
+ }
+
+ # Just used for informational purposes. is_filled()
+ # is calculated in the _set_* functions.
+ filled_markers = (
+ 'o', 'v', '^', '<', '>', '8', 's', 'p', '*', 'h', 'H', 'D', 'd',
+ 'P', 'X')
+
+ fillstyles = ('full', 'left', 'right', 'bottom', 'top', 'none')
+ _half_fillstyles = ('left', 'right', 'bottom', 'top')
+
+ # TODO: Is this ever used as a non-constant?
+ _point_size_reduction = 0.5
+
+ def __init__(self, marker=None, fillstyle=None):
+ """
+ Parameters
+ ----------
+ marker : str, array-like, Path, MarkerStyle, or None, default: None
+ - Another instance of *MarkerStyle* copies the details of that
+ ``marker``.
+ - *None* means no marker.
+ - For other possible marker values see the module docstring
+ `matplotlib.markers`.
+
+ fillstyle : str, default: 'full'
+ One of 'full', 'left', 'right', 'bottom', 'top', 'none'.
+ """
+ self._marker_function = None
+ self._set_fillstyle(fillstyle)
+ self._set_marker(marker)
+
+ def _recache(self):
+ if self._marker_function is None:
+ return
+ self._path = _empty_path
+ self._transform = IdentityTransform()
+ self._alt_path = None
+ self._alt_transform = None
+ self._snap_threshold = None
+ self._joinstyle = JoinStyle.round
+ self._capstyle = CapStyle.butt
+ # Initial guess: Assume the marker is filled unless the fillstyle is
+ # set to 'none'. The marker function will override this for unfilled
+ # markers.
+ self._filled = self._fillstyle != 'none'
+ self._marker_function()
+
+ def __bool__(self):
+ return bool(len(self._path.vertices))
+
+ def is_filled(self):
+ return self._filled
+
+ def get_fillstyle(self):
+ return self._fillstyle
+
+ @_api.deprecated("3.4", alternative="a new marker")
+ def set_fillstyle(self, fillstyle):
+ return self._set_fillstyle(fillstyle)
+
+ def _set_fillstyle(self, fillstyle):
+ """
+ Set the fillstyle.
+
+ Parameters
+ ----------
+ fillstyle : {'full', 'left', 'right', 'bottom', 'top', 'none'}
+ The part of the marker surface that is colored with
+ markerfacecolor.
+ """
+ if fillstyle is None:
+ fillstyle = rcParams['markers.fillstyle']
+ _api.check_in_list(self.fillstyles, fillstyle=fillstyle)
+ self._fillstyle = fillstyle
+ self._recache()
+
+ def get_joinstyle(self):
+ return self._joinstyle
+
+ def get_capstyle(self):
+ return self._capstyle
+
+ def get_marker(self):
+ return self._marker
+
+ @_api.deprecated("3.4", alternative="a new marker")
+ def set_marker(self, marker):
+ return self._set_marker(marker)
+
+ def _set_marker(self, marker):
+ """
+ Set the marker.
+
+ Parameters
+ ----------
+ marker : str, array-like, Path, MarkerStyle, or None, default: None
+ - Another instance of *MarkerStyle* copies the details of that
+ ``marker``.
+ - *None* means no marker.
+ - For other possible marker values see the module docstring
+ `matplotlib.markers`.
+ """
+ if (isinstance(marker, np.ndarray) and marker.ndim == 2 and
+ marker.shape[1] == 2):
+ self._marker_function = self._set_vertices
+ elif isinstance(marker, str) and cbook.is_math_text(marker):
+ self._marker_function = self._set_mathtext_path
+ elif isinstance(marker, Path):
+ self._marker_function = self._set_path_marker
+ elif (isinstance(marker, Sized) and len(marker) in (2, 3) and
+ marker[1] in (0, 1, 2)):
+ self._marker_function = self._set_tuple_marker
+ elif (not isinstance(marker, (np.ndarray, list)) and
+ marker in self.markers):
+ self._marker_function = getattr(
+ self, '_set_' + self.markers[marker])
+ elif isinstance(marker, MarkerStyle):
+ self.__dict__.update(marker.__dict__)
+ else:
+ try:
+ Path(marker)
+ self._marker_function = self._set_vertices
+ except ValueError as err:
+ raise ValueError('Unrecognized marker style {!r}'
+ .format(marker)) from err
+
+ if not isinstance(marker, MarkerStyle):
+ self._marker = marker
+ self._recache()
+
+ def get_path(self):
+ """
+ Return a `.Path` for the primary part of the marker.
+
+ For unfilled markers this is the whole marker, for filled markers,
+ this is the area to be drawn with *markerfacecolor*.
+ """
+ return self._path
+
+ def get_transform(self):
+ """
+ Return the transform to be applied to the `.Path` from
+ `MarkerStyle.get_path()`.
+ """
+ return self._transform.frozen()
+
+ def get_alt_path(self):
+ """
+ Return a `.Path` for the alternate part of the marker.
+
+ For unfilled markers, this is *None*; for filled markers, this is the
+ area to be drawn with *markerfacecoloralt*.
+ """
+ return self._alt_path
+
+ def get_alt_transform(self):
+ """
+ Return the transform to be applied to the `.Path` from
+ `MarkerStyle.get_alt_path()`.
+ """
+ return self._alt_transform.frozen()
+
+ def get_snap_threshold(self):
+ return self._snap_threshold
+
+ def _set_nothing(self):
+ self._filled = False
+
+ def _set_custom_marker(self, path):
+ rescale = np.max(np.abs(path.vertices)) # max of x's and y's.
+ self._transform = Affine2D().scale(0.5 / rescale)
+ self._path = path
+
+ def _set_path_marker(self):
+ self._set_custom_marker(self._marker)
+
+ def _set_vertices(self):
+ self._set_custom_marker(Path(self._marker))
+
+ def _set_tuple_marker(self):
+ marker = self._marker
+ if len(marker) == 2:
+ numsides, rotation = marker[0], 0.0
+ elif len(marker) == 3:
+ numsides, rotation = marker[0], marker[2]
+ symstyle = marker[1]
+ if symstyle == 0:
+ self._path = Path.unit_regular_polygon(numsides)
+ self._joinstyle = JoinStyle.miter
+ elif symstyle == 1:
+ self._path = Path.unit_regular_star(numsides)
+ self._joinstyle = JoinStyle.bevel
+ elif symstyle == 2:
+ self._path = Path.unit_regular_asterisk(numsides)
+ self._filled = False
+ self._joinstyle = JoinStyle.bevel
+ else:
+ raise ValueError(f"Unexpected tuple marker: {marker}")
+ self._transform = Affine2D().scale(0.5).rotate_deg(rotation)
+
+ def _set_mathtext_path(self):
+ """
+ Draws mathtext markers '$...$' using TextPath object.
+
+ Submitted by tcb
+ """
+ from matplotlib.text import TextPath
+
+ # again, the properties could be initialised just once outside
+ # this function
+ text = TextPath(xy=(0, 0), s=self.get_marker(),
+ usetex=rcParams['text.usetex'])
+ if len(text.vertices) == 0:
+ return
+
+ xmin, ymin = text.vertices.min(axis=0)
+ xmax, ymax = text.vertices.max(axis=0)
+ width = xmax - xmin
+ height = ymax - ymin
+ max_dim = max(width, height)
+ self._transform = Affine2D() \
+ .translate(-xmin + 0.5 * -width, -ymin + 0.5 * -height) \
+ .scale(1.0 / max_dim)
+ self._path = text
+ self._snap = False
+
+ def _half_fill(self):
+ return self.get_fillstyle() in self._half_fillstyles
+
+ def _set_circle(self, reduction=1.0):
+ self._transform = Affine2D().scale(0.5 * reduction)
+ self._snap_threshold = np.inf
+ if not self._half_fill():
+ self._path = Path.unit_circle()
+ else:
+ self._path = self._alt_path = Path.unit_circle_righthalf()
+ fs = self.get_fillstyle()
+ self._transform.rotate_deg(
+ {'right': 0, 'top': 90, 'left': 180, 'bottom': 270}[fs])
+ self._alt_transform = self._transform.frozen().rotate_deg(180.)
+
+ def _set_pixel(self):
+ self._path = Path.unit_rectangle()
+ # Ideally, you'd want -0.5, -0.5 here, but then the snapping
+ # algorithm in the Agg backend will round this to a 2x2
+ # rectangle from (-1, -1) to (1, 1). By offsetting it
+ # slightly, we can force it to be (0, 0) to (1, 1), which both
+ # makes it only be a single pixel and places it correctly
+ # aligned to 1-width stroking (i.e. the ticks). This hack is
+ # the best of a number of bad alternatives, mainly because the
+ # backends are not aware of what marker is actually being used
+ # beyond just its path data.
+ self._transform = Affine2D().translate(-0.49999, -0.49999)
+ self._snap_threshold = None
+
+ def _set_point(self):
+ self._set_circle(reduction=self._point_size_reduction)
+
+ _triangle_path = Path([[0, 1], [-1, -1], [1, -1], [0, 1]], closed=True)
+ # Going down halfway looks to small. Golden ratio is too far.
+ _triangle_path_u = Path([[0, 1], [-3/5, -1/5], [3/5, -1/5], [0, 1]],
+ closed=True)
+ _triangle_path_d = Path(
+ [[-3/5, -1/5], [3/5, -1/5], [1, -1], [-1, -1], [-3/5, -1/5]],
+ closed=True)
+ _triangle_path_l = Path([[0, 1], [0, -1], [-1, -1], [0, 1]], closed=True)
+ _triangle_path_r = Path([[0, 1], [0, -1], [1, -1], [0, 1]], closed=True)
+
+ def _set_triangle(self, rot, skip):
+ self._transform = Affine2D().scale(0.5).rotate_deg(rot)
+ self._snap_threshold = 5.0
+
+ if not self._half_fill():
+ self._path = self._triangle_path
+ else:
+ mpaths = [self._triangle_path_u,
+ self._triangle_path_l,
+ self._triangle_path_d,
+ self._triangle_path_r]
+
+ fs = self.get_fillstyle()
+ if fs == 'top':
+ self._path = mpaths[(0 + skip) % 4]
+ self._alt_path = mpaths[(2 + skip) % 4]
+ elif fs == 'bottom':
+ self._path = mpaths[(2 + skip) % 4]
+ self._alt_path = mpaths[(0 + skip) % 4]
+ elif fs == 'left':
+ self._path = mpaths[(1 + skip) % 4]
+ self._alt_path = mpaths[(3 + skip) % 4]
+ else:
+ self._path = mpaths[(3 + skip) % 4]
+ self._alt_path = mpaths[(1 + skip) % 4]
+
+ self._alt_transform = self._transform
+
+ self._joinstyle = JoinStyle.miter
+
+ def _set_triangle_up(self):
+ return self._set_triangle(0.0, 0)
+
+ def _set_triangle_down(self):
+ return self._set_triangle(180.0, 2)
+
+ def _set_triangle_left(self):
+ return self._set_triangle(90.0, 3)
+
+ def _set_triangle_right(self):
+ return self._set_triangle(270.0, 1)
+
+ def _set_square(self):
+ self._transform = Affine2D().translate(-0.5, -0.5)
+ self._snap_threshold = 2.0
+ if not self._half_fill():
+ self._path = Path.unit_rectangle()
+ else:
+ # Build a bottom filled square out of two rectangles, one filled.
+ self._path = Path([[0.0, 0.0], [1.0, 0.0], [1.0, 0.5],
+ [0.0, 0.5], [0.0, 0.0]])
+ self._alt_path = Path([[0.0, 0.5], [1.0, 0.5], [1.0, 1.0],
+ [0.0, 1.0], [0.0, 0.5]])
+ fs = self.get_fillstyle()
+ rotate = {'bottom': 0, 'right': 90, 'top': 180, 'left': 270}[fs]
+ self._transform.rotate_deg(rotate)
+ self._alt_transform = self._transform
+
+ self._joinstyle = JoinStyle.miter
+
+ def _set_diamond(self):
+ self._transform = Affine2D().translate(-0.5, -0.5).rotate_deg(45)
+ self._snap_threshold = 5.0
+ if not self._half_fill():
+ self._path = Path.unit_rectangle()
+ else:
+ self._path = Path([[0, 0], [1, 0], [1, 1], [0, 0]])
+ self._alt_path = Path([[0, 0], [0, 1], [1, 1], [0, 0]])
+ fs = self.get_fillstyle()
+ rotate = {'right': 0, 'top': 90, 'left': 180, 'bottom': 270}[fs]
+ self._transform.rotate_deg(rotate)
+ self._alt_transform = self._transform
+ self._joinstyle = JoinStyle.miter
+
+ def _set_thin_diamond(self):
+ self._set_diamond()
+ self._transform.scale(0.6, 1.0)
+
+ def _set_pentagon(self):
+ self._transform = Affine2D().scale(0.5)
+ self._snap_threshold = 5.0
+
+ polypath = Path.unit_regular_polygon(5)
+
+ if not self._half_fill():
+ self._path = polypath
+ else:
+ verts = polypath.vertices
+ y = (1 + np.sqrt(5)) / 4.
+ top = Path(verts[[0, 1, 4, 0]])
+ bottom = Path(verts[[1, 2, 3, 4, 1]])
+ left = Path([verts[0], verts[1], verts[2], [0, -y], verts[0]])
+ right = Path([verts[0], verts[4], verts[3], [0, -y], verts[0]])
+ self._path, self._alt_path = {
+ 'top': (top, bottom), 'bottom': (bottom, top),
+ 'left': (left, right), 'right': (right, left),
+ }[self.get_fillstyle()]
+ self._alt_transform = self._transform
+
+ self._joinstyle = JoinStyle.miter
+
+ def _set_star(self):
+ self._transform = Affine2D().scale(0.5)
+ self._snap_threshold = 5.0
+
+ polypath = Path.unit_regular_star(5, innerCircle=0.381966)
+
+ if not self._half_fill():
+ self._path = polypath
+ else:
+ verts = polypath.vertices
+ top = Path(np.concatenate([verts[0:4], verts[7:10], verts[0:1]]))
+ bottom = Path(np.concatenate([verts[3:8], verts[3:4]]))
+ left = Path(np.concatenate([verts[0:6], verts[0:1]]))
+ right = Path(np.concatenate([verts[0:1], verts[5:10], verts[0:1]]))
+ self._path, self._alt_path = {
+ 'top': (top, bottom), 'bottom': (bottom, top),
+ 'left': (left, right), 'right': (right, left),
+ }[self.get_fillstyle()]
+ self._alt_transform = self._transform
+
+ self._joinstyle = JoinStyle.bevel
+
+ def _set_hexagon1(self):
+ self._transform = Affine2D().scale(0.5)
+ self._snap_threshold = None
+
+ polypath = Path.unit_regular_polygon(6)
+
+ if not self._half_fill():
+ self._path = polypath
+ else:
+ verts = polypath.vertices
+ # not drawing inside lines
+ x = np.abs(np.cos(5 * np.pi / 6.))
+ top = Path(np.concatenate([[(-x, 0)], verts[[1, 0, 5]], [(x, 0)]]))
+ bottom = Path(np.concatenate([[(-x, 0)], verts[2:5], [(x, 0)]]))
+ left = Path(verts[0:4])
+ right = Path(verts[[0, 5, 4, 3]])
+ self._path, self._alt_path = {
+ 'top': (top, bottom), 'bottom': (bottom, top),
+ 'left': (left, right), 'right': (right, left),
+ }[self.get_fillstyle()]
+ self._alt_transform = self._transform
+
+ self._joinstyle = JoinStyle.miter
+
+ def _set_hexagon2(self):
+ self._transform = Affine2D().scale(0.5).rotate_deg(30)
+ self._snap_threshold = None
+
+ polypath = Path.unit_regular_polygon(6)
+
+ if not self._half_fill():
+ self._path = polypath
+ else:
+ verts = polypath.vertices
+ # not drawing inside lines
+ x, y = np.sqrt(3) / 4, 3 / 4.
+ top = Path(verts[[1, 0, 5, 4, 1]])
+ bottom = Path(verts[1:5])
+ left = Path(np.concatenate([
+ [(x, y)], verts[:3], [(-x, -y), (x, y)]]))
+ right = Path(np.concatenate([
+ [(x, y)], verts[5:2:-1], [(-x, -y)]]))
+ self._path, self._alt_path = {
+ 'top': (top, bottom), 'bottom': (bottom, top),
+ 'left': (left, right), 'right': (right, left),
+ }[self.get_fillstyle()]
+ self._alt_transform = self._transform
+
+ self._joinstyle = JoinStyle.miter
+
+ def _set_octagon(self):
+ self._transform = Affine2D().scale(0.5)
+ self._snap_threshold = 5.0
+
+ polypath = Path.unit_regular_polygon(8)
+
+ if not self._half_fill():
+ self._transform.rotate_deg(22.5)
+ self._path = polypath
+ else:
+ x = np.sqrt(2.) / 4.
+ self._path = self._alt_path = Path(
+ [[0, -1], [0, 1], [-x, 1], [-1, x],
+ [-1, -x], [-x, -1], [0, -1]])
+ fs = self.get_fillstyle()
+ self._transform.rotate_deg(
+ {'left': 0, 'bottom': 90, 'right': 180, 'top': 270}[fs])
+ self._alt_transform = self._transform.frozen().rotate_deg(180.0)
+
+ self._joinstyle = JoinStyle.miter
+
+ _line_marker_path = Path([[0.0, -1.0], [0.0, 1.0]])
+
+ def _set_vline(self):
+ self._transform = Affine2D().scale(0.5)
+ self._snap_threshold = 1.0
+ self._filled = False
+ self._path = self._line_marker_path
+
+ def _set_hline(self):
+ self._set_vline()
+ self._transform = self._transform.rotate_deg(90)
+
+ _tickhoriz_path = Path([[0.0, 0.0], [1.0, 0.0]])
+
+ def _set_tickleft(self):
+ self._transform = Affine2D().scale(-1.0, 1.0)
+ self._snap_threshold = 1.0
+ self._filled = False
+ self._path = self._tickhoriz_path
+
+ def _set_tickright(self):
+ self._transform = Affine2D().scale(1.0, 1.0)
+ self._snap_threshold = 1.0
+ self._filled = False
+ self._path = self._tickhoriz_path
+
+ _tickvert_path = Path([[-0.0, 0.0], [-0.0, 1.0]])
+
+ def _set_tickup(self):
+ self._transform = Affine2D().scale(1.0, 1.0)
+ self._snap_threshold = 1.0
+ self._filled = False
+ self._path = self._tickvert_path
+
+ def _set_tickdown(self):
+ self._transform = Affine2D().scale(1.0, -1.0)
+ self._snap_threshold = 1.0
+ self._filled = False
+ self._path = self._tickvert_path
+
+ _tri_path = Path([[0.0, 0.0], [0.0, -1.0],
+ [0.0, 0.0], [0.8, 0.5],
+ [0.0, 0.0], [-0.8, 0.5]],
+ [Path.MOVETO, Path.LINETO,
+ Path.MOVETO, Path.LINETO,
+ Path.MOVETO, Path.LINETO])
+
+ def _set_tri_down(self):
+ self._transform = Affine2D().scale(0.5)
+ self._snap_threshold = 5.0
+ self._filled = False
+ self._path = self._tri_path
+
+ def _set_tri_up(self):
+ self._set_tri_down()
+ self._transform = self._transform.rotate_deg(180)
+
+ def _set_tri_left(self):
+ self._set_tri_down()
+ self._transform = self._transform.rotate_deg(270)
+
+ def _set_tri_right(self):
+ self._set_tri_down()
+ self._transform = self._transform.rotate_deg(90)
+
+ _caret_path = Path([[-1.0, 1.5], [0.0, 0.0], [1.0, 1.5]])
+
+ def _set_caretdown(self):
+ self._transform = Affine2D().scale(0.5)
+ self._snap_threshold = 3.0
+ self._filled = False
+ self._path = self._caret_path
+ self._joinstyle = JoinStyle.miter
+
+ def _set_caretup(self):
+ self._set_caretdown()
+ self._transform = self._transform.rotate_deg(180)
+
+ def _set_caretleft(self):
+ self._set_caretdown()
+ self._transform = self._transform.rotate_deg(270)
+
+ def _set_caretright(self):
+ self._set_caretdown()
+ self._transform = self._transform.rotate_deg(90)
+
+ _caret_path_base = Path([[-1.0, 0.0], [0.0, -1.5], [1.0, 0]])
+
+ def _set_caretdownbase(self):
+ self._set_caretdown()
+ self._path = self._caret_path_base
+
+ def _set_caretupbase(self):
+ self._set_caretdownbase()
+ self._transform = self._transform.rotate_deg(180)
+
+ def _set_caretleftbase(self):
+ self._set_caretdownbase()
+ self._transform = self._transform.rotate_deg(270)
+
+ def _set_caretrightbase(self):
+ self._set_caretdownbase()
+ self._transform = self._transform.rotate_deg(90)
+
+ _plus_path = Path([[-1.0, 0.0], [1.0, 0.0],
+ [0.0, -1.0], [0.0, 1.0]],
+ [Path.MOVETO, Path.LINETO,
+ Path.MOVETO, Path.LINETO])
+
+ def _set_plus(self):
+ self._transform = Affine2D().scale(0.5)
+ self._snap_threshold = 1.0
+ self._filled = False
+ self._path = self._plus_path
+
+ _x_path = Path([[-1.0, -1.0], [1.0, 1.0],
+ [-1.0, 1.0], [1.0, -1.0]],
+ [Path.MOVETO, Path.LINETO,
+ Path.MOVETO, Path.LINETO])
+
+ def _set_x(self):
+ self._transform = Affine2D().scale(0.5)
+ self._snap_threshold = 3.0
+ self._filled = False
+ self._path = self._x_path
+
+ _plus_filled_path = Path(
+ np.array([(-1, -3), (+1, -3), (+1, -1), (+3, -1), (+3, +1), (+1, +1),
+ (+1, +3), (-1, +3), (-1, +1), (-3, +1), (-3, -1), (-1, -1),
+ (-1, -3)]) / 6, closed=True)
+ _plus_filled_path_t = Path(
+ np.array([(+3, 0), (+3, +1), (+1, +1), (+1, +3),
+ (-1, +3), (-1, +1), (-3, +1), (-3, 0),
+ (+3, 0)]) / 6, closed=True)
+
+ def _set_plus_filled(self):
+ self._transform = Affine2D()
+ self._snap_threshold = 5.0
+ self._joinstyle = JoinStyle.miter
+ fs = self.get_fillstyle()
+ if not self._half_fill():
+ self._path = self._plus_filled_path
+ else:
+ # Rotate top half path to support all partitions
+ self._path = self._alt_path = self._plus_filled_path_t
+ fs = self.get_fillstyle()
+ self._transform.rotate_deg(
+ {'top': 0, 'left': 90, 'bottom': 180, 'right': 270}[fs])
+ self._alt_transform = self._transform.frozen().rotate_deg(180)
+
+ _x_filled_path = Path(
+ np.array([(-1, -2), (0, -1), (+1, -2), (+2, -1), (+1, 0), (+2, +1),
+ (+1, +2), (0, +1), (-1, +2), (-2, +1), (-1, 0), (-2, -1),
+ (-1, -2)]) / 4,
+ closed=True)
+ _x_filled_path_t = Path(
+ np.array([(+1, 0), (+2, +1), (+1, +2), (0, +1),
+ (-1, +2), (-2, +1), (-1, 0), (+1, 0)]) / 4,
+ closed=True)
+
+ def _set_x_filled(self):
+ self._transform = Affine2D()
+ self._snap_threshold = 5.0
+ self._joinstyle = JoinStyle.miter
+ if not self._half_fill():
+ self._path = self._x_filled_path
+ else:
+ # Rotate top half path to support all partitions
+ self._path = self._alt_path = self._x_filled_path_t
+ fs = self.get_fillstyle()
+ self._transform.rotate_deg(
+ {'top': 0, 'left': 90, 'bottom': 180, 'right': 270}[fs])
+ self._alt_transform = self._transform.frozen().rotate_deg(180)
diff --git a/venv/Lib/site-packages/matplotlib/mathtext.py b/venv/Lib/site-packages/matplotlib/mathtext.py
new file mode 100644
index 0000000..f2eb39d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mathtext.py
@@ -0,0 +1,622 @@
+r"""
+A module for parsing a subset of the TeX math syntax and rendering it to a
+Matplotlib backend.
+
+For a tutorial of its usage, see :doc:`/tutorials/text/mathtext`. This
+document is primarily concerned with implementation details.
+
+The module uses pyparsing_ to parse the TeX expression.
+
+.. _pyparsing: https://pypi.org/project/pyparsing/
+
+The Bakoma distribution of the TeX Computer Modern fonts, and STIX
+fonts are supported. There is experimental support for using
+arbitrary fonts, but results may vary without proper tweaking and
+metrics for those fonts.
+"""
+
+from collections import namedtuple
+import functools
+from io import StringIO
+import logging
+import types
+
+import numpy as np
+from PIL import Image
+
+from matplotlib import _api, colors as mcolors, rcParams, _mathtext
+from matplotlib.ft2font import FT2Image, LOAD_NO_HINTING
+from matplotlib.font_manager import FontProperties
+# Backcompat imports, all are deprecated as of 3.4.
+from matplotlib._mathtext import ( # noqa: F401
+ SHRINK_FACTOR, GROW_FACTOR, NUM_SIZE_LEVELS)
+from matplotlib._mathtext_data import ( # noqa: F401
+ latex_to_bakoma, latex_to_cmex, latex_to_standard, stix_virtual_fonts,
+ tex2uni)
+
+_log = logging.getLogger(__name__)
+
+
+get_unicode_index = _mathtext.get_unicode_index
+get_unicode_index.__module__ = __name__
+
+
+class MathtextBackend:
+ """
+ The base class for the mathtext backend-specific code. `MathtextBackend`
+ subclasses interface between mathtext and specific Matplotlib graphics
+ backends.
+
+ Subclasses need to override the following:
+
+ - :meth:`render_glyph`
+ - :meth:`render_rect_filled`
+ - :meth:`get_results`
+
+ And optionally, if you need to use a FreeType hinting style:
+
+ - :meth:`get_hinting_type`
+ """
+ def __init__(self):
+ self.width = 0
+ self.height = 0
+ self.depth = 0
+
+ def set_canvas_size(self, w, h, d):
+ """Set the dimension of the drawing canvas."""
+ self.width = w
+ self.height = h
+ self.depth = d
+
+ def render_glyph(self, ox, oy, info):
+ """
+ Draw a glyph described by *info* to the reference point (*ox*,
+ *oy*).
+ """
+ raise NotImplementedError()
+
+ def render_rect_filled(self, x1, y1, x2, y2):
+ """
+ Draw a filled black rectangle from (*x1*, *y1*) to (*x2*, *y2*).
+ """
+ raise NotImplementedError()
+
+ def get_results(self, box):
+ """
+ Return a backend-specific tuple to return to the backend after
+ all processing is done.
+ """
+ raise NotImplementedError()
+
+ def get_hinting_type(self):
+ """
+ Get the FreeType hinting type to use with this particular
+ backend.
+ """
+ return LOAD_NO_HINTING
+
+
+class MathtextBackendAgg(MathtextBackend):
+ """
+ Render glyphs and rectangles to an FTImage buffer, which is later
+ transferred to the Agg image by the Agg backend.
+ """
+ def __init__(self):
+ self.ox = 0
+ self.oy = 0
+ self.image = None
+ self.mode = 'bbox'
+ self.bbox = [0, 0, 0, 0]
+ super().__init__()
+
+ def _update_bbox(self, x1, y1, x2, y2):
+ self.bbox = [min(self.bbox[0], x1),
+ min(self.bbox[1], y1),
+ max(self.bbox[2], x2),
+ max(self.bbox[3], y2)]
+
+ def set_canvas_size(self, w, h, d):
+ super().set_canvas_size(w, h, d)
+ if self.mode != 'bbox':
+ self.image = FT2Image(np.ceil(w), np.ceil(h + max(d, 0)))
+
+ def render_glyph(self, ox, oy, info):
+ if self.mode == 'bbox':
+ self._update_bbox(ox + info.metrics.xmin,
+ oy - info.metrics.ymax,
+ ox + info.metrics.xmax,
+ oy - info.metrics.ymin)
+ else:
+ info.font.draw_glyph_to_bitmap(
+ self.image, ox, oy - info.metrics.iceberg, info.glyph,
+ antialiased=rcParams['text.antialiased'])
+
+ def render_rect_filled(self, x1, y1, x2, y2):
+ if self.mode == 'bbox':
+ self._update_bbox(x1, y1, x2, y2)
+ else:
+ height = max(int(y2 - y1) - 1, 0)
+ if height == 0:
+ center = (y2 + y1) / 2.0
+ y = int(center - (height + 1) / 2.0)
+ else:
+ y = int(y1)
+ self.image.draw_rect_filled(int(x1), y, np.ceil(x2), y + height)
+
+ def get_results(self, box, used_characters):
+ self.mode = 'bbox'
+ orig_height = box.height
+ orig_depth = box.depth
+ _mathtext.ship(0, 0, box)
+ bbox = self.bbox
+ bbox = [bbox[0] - 1, bbox[1] - 1, bbox[2] + 1, bbox[3] + 1]
+ self.mode = 'render'
+ self.set_canvas_size(
+ bbox[2] - bbox[0],
+ (bbox[3] - bbox[1]) - orig_depth,
+ (bbox[3] - bbox[1]) - orig_height)
+ _mathtext.ship(-bbox[0], -bbox[1], box)
+ result = (self.ox,
+ self.oy,
+ self.width,
+ self.height + self.depth,
+ self.depth,
+ self.image,
+ used_characters)
+ self.image = None
+ return result
+
+ def get_hinting_type(self):
+ from matplotlib.backends import backend_agg
+ return backend_agg.get_hinting_flag()
+
+
+@_api.deprecated("3.4", alternative="mathtext.math_to_image")
+class MathtextBackendBitmap(MathtextBackendAgg):
+ def get_results(self, box, used_characters):
+ ox, oy, width, height, depth, image, characters = \
+ super().get_results(box, used_characters)
+ return image, depth
+
+
+@_api.deprecated("3.4", alternative="MathtextBackendPath")
+class MathtextBackendPs(MathtextBackend):
+ """
+ Store information to write a mathtext rendering to the PostScript backend.
+ """
+
+ _PSResult = namedtuple(
+ "_PSResult", "width height depth pswriter used_characters")
+
+ def __init__(self):
+ self.pswriter = StringIO()
+ self.lastfont = None
+
+ def render_glyph(self, ox, oy, info):
+ oy = self.height - oy + info.offset
+ postscript_name = info.postscript_name
+ fontsize = info.fontsize
+
+ if (postscript_name, fontsize) != self.lastfont:
+ self.lastfont = postscript_name, fontsize
+ self.pswriter.write(
+ f"/{postscript_name} findfont\n"
+ f"{fontsize} scalefont\n"
+ f"setfont\n")
+
+ self.pswriter.write(
+ f"{ox:f} {oy:f} moveto\n"
+ f"/{info.symbol_name} glyphshow\n")
+
+ def render_rect_filled(self, x1, y1, x2, y2):
+ ps = "%f %f %f %f rectfill\n" % (
+ x1, self.height - y2, x2 - x1, y2 - y1)
+ self.pswriter.write(ps)
+
+ def get_results(self, box, used_characters):
+ _mathtext.ship(0, 0, box)
+ return self._PSResult(self.width,
+ self.height + self.depth,
+ self.depth,
+ self.pswriter,
+ used_characters)
+
+
+@_api.deprecated("3.4", alternative="MathtextBackendPath")
+class MathtextBackendPdf(MathtextBackend):
+ """Store information to write a mathtext rendering to the PDF backend."""
+
+ _PDFResult = namedtuple(
+ "_PDFResult", "width height depth glyphs rects used_characters")
+
+ def __init__(self):
+ self.glyphs = []
+ self.rects = []
+
+ def render_glyph(self, ox, oy, info):
+ filename = info.font.fname
+ oy = self.height - oy + info.offset
+ self.glyphs.append(
+ (ox, oy, filename, info.fontsize,
+ info.num, info.symbol_name))
+
+ def render_rect_filled(self, x1, y1, x2, y2):
+ self.rects.append((x1, self.height - y2, x2 - x1, y2 - y1))
+
+ def get_results(self, box, used_characters):
+ _mathtext.ship(0, 0, box)
+ return self._PDFResult(self.width,
+ self.height + self.depth,
+ self.depth,
+ self.glyphs,
+ self.rects,
+ used_characters)
+
+
+@_api.deprecated("3.4", alternative="MathtextBackendPath")
+class MathtextBackendSvg(MathtextBackend):
+ """
+ Store information to write a mathtext rendering to the SVG
+ backend.
+ """
+ def __init__(self):
+ self.svg_glyphs = []
+ self.svg_rects = []
+
+ def render_glyph(self, ox, oy, info):
+ oy = self.height - oy + info.offset
+
+ self.svg_glyphs.append(
+ (info.font, info.fontsize, info.num, ox, oy, info.metrics))
+
+ def render_rect_filled(self, x1, y1, x2, y2):
+ self.svg_rects.append(
+ (x1, self.height - y1 + 1, x2 - x1, y2 - y1))
+
+ def get_results(self, box, used_characters):
+ _mathtext.ship(0, 0, box)
+ svg_elements = types.SimpleNamespace(svg_glyphs=self.svg_glyphs,
+ svg_rects=self.svg_rects)
+ return (self.width,
+ self.height + self.depth,
+ self.depth,
+ svg_elements,
+ used_characters)
+
+
+class MathtextBackendPath(MathtextBackend):
+ """
+ Store information to write a mathtext rendering to the text path
+ machinery.
+ """
+
+ _Result = namedtuple("_Result", "width height depth glyphs rects")
+
+ def __init__(self):
+ self.glyphs = []
+ self.rects = []
+
+ def render_glyph(self, ox, oy, info):
+ oy = self.height - oy + info.offset
+ self.glyphs.append((info.font, info.fontsize, info.num, ox, oy))
+
+ def render_rect_filled(self, x1, y1, x2, y2):
+ self.rects.append((x1, self.height - y2, x2 - x1, y2 - y1))
+
+ def get_results(self, box, used_characters):
+ _mathtext.ship(0, 0, box)
+ return self._Result(self.width,
+ self.height + self.depth,
+ self.depth,
+ self.glyphs,
+ self.rects)
+
+
+@_api.deprecated("3.4", alternative="MathtextBackendPath")
+class MathtextBackendCairo(MathtextBackend):
+ """
+ Store information to write a mathtext rendering to the Cairo
+ backend.
+ """
+
+ def __init__(self):
+ self.glyphs = []
+ self.rects = []
+
+ def render_glyph(self, ox, oy, info):
+ oy = oy - info.offset - self.height
+ thetext = chr(info.num)
+ self.glyphs.append(
+ (info.font, info.fontsize, thetext, ox, oy))
+
+ def render_rect_filled(self, x1, y1, x2, y2):
+ self.rects.append(
+ (x1, y1 - self.height, x2 - x1, y2 - y1))
+
+ def get_results(self, box, used_characters):
+ _mathtext.ship(0, 0, box)
+ return (self.width,
+ self.height + self.depth,
+ self.depth,
+ self.glyphs,
+ self.rects)
+
+
+for _cls_name in [
+ "Fonts",
+ *[c.__name__ for c in _mathtext.Fonts.__subclasses__()],
+ "FontConstantsBase",
+ *[c.__name__ for c in _mathtext.FontConstantsBase.__subclasses__()],
+ "Node",
+ *[c.__name__ for c in _mathtext.Node.__subclasses__()],
+ "Ship", "Parser",
+]:
+ globals()[_cls_name] = _api.deprecated("3.4")(
+ type(_cls_name, (getattr(_mathtext, _cls_name),), {}))
+
+
+class MathTextWarning(Warning):
+ pass
+
+
+@_api.deprecated("3.3")
+class GlueSpec:
+ """See `Glue`."""
+
+ def __init__(self, width=0., stretch=0., stretch_order=0,
+ shrink=0., shrink_order=0):
+ self.width = width
+ self.stretch = stretch
+ self.stretch_order = stretch_order
+ self.shrink = shrink
+ self.shrink_order = shrink_order
+
+ def copy(self):
+ return GlueSpec(
+ self.width,
+ self.stretch,
+ self.stretch_order,
+ self.shrink,
+ self.shrink_order)
+
+ @classmethod
+ def factory(cls, glue_type):
+ return cls._types[glue_type]
+
+
+with _api.suppress_matplotlib_deprecation_warning():
+ GlueSpec._types = {k: GlueSpec(**v._asdict())
+ for k, v in _mathtext._GlueSpec._named.items()}
+
+
+@_api.deprecated("3.4")
+def ship(ox, oy, box):
+ _mathtext.ship(ox, oy, box)
+
+
+##############################################################################
+# MAIN
+
+
+class MathTextParser:
+ _parser = None
+
+ _backend_mapping = {
+ 'bitmap': MathtextBackendBitmap,
+ 'agg': MathtextBackendAgg,
+ 'ps': MathtextBackendPs,
+ 'pdf': MathtextBackendPdf,
+ 'svg': MathtextBackendSvg,
+ 'path': MathtextBackendPath,
+ 'cairo': MathtextBackendCairo,
+ 'macosx': MathtextBackendAgg,
+ }
+ _font_type_mapping = {
+ 'cm': _mathtext.BakomaFonts,
+ 'dejavuserif': _mathtext.DejaVuSerifFonts,
+ 'dejavusans': _mathtext.DejaVuSansFonts,
+ 'stix': _mathtext.StixFonts,
+ 'stixsans': _mathtext.StixSansFonts,
+ 'custom': _mathtext.UnicodeFonts,
+ }
+
+ def __init__(self, output):
+ """Create a MathTextParser for the given backend *output*."""
+ self._output = output.lower()
+
+ def parse(self, s, dpi=72, prop=None, *, _force_standard_ps_fonts=False):
+ """
+ Parse the given math expression *s* at the given *dpi*. If *prop* is
+ provided, it is a `.FontProperties` object specifying the "default"
+ font to use in the math expression, used for all non-math text.
+
+ The results are cached, so multiple calls to `parse`
+ with the same expression should be fast.
+ """
+ if _force_standard_ps_fonts:
+ _api.warn_deprecated(
+ "3.4",
+ removal="3.5",
+ message=(
+ "Mathtext using only standard PostScript fonts has "
+ "been likely to produce wrong output for a while, "
+ "has been deprecated in %(since)s and will be removed "
+ "in %(removal)s, after which ps.useafm will have no "
+ "effect on mathtext."
+ )
+ )
+
+ # lru_cache can't decorate parse() directly because the ps.useafm and
+ # mathtext.fontset rcParams also affect the parse (e.g. by affecting
+ # the glyph metrics).
+ return self._parse_cached(s, dpi, prop, _force_standard_ps_fonts)
+
+ @functools.lru_cache(50)
+ def _parse_cached(self, s, dpi, prop, force_standard_ps_fonts):
+ if prop is None:
+ prop = FontProperties()
+
+ fontset_class = (
+ _mathtext.StandardPsFonts if force_standard_ps_fonts
+ else _api.check_getitem(
+ self._font_type_mapping, fontset=prop.get_math_fontfamily()))
+ backend = self._backend_mapping[self._output]()
+ font_output = fontset_class(prop, backend)
+
+ fontsize = prop.get_size_in_points()
+
+ # This is a class variable so we don't rebuild the parser
+ # with each request.
+ if self._parser is None:
+ self.__class__._parser = _mathtext.Parser()
+
+ box = self._parser.parse(s, font_output, fontsize, dpi)
+ font_output.set_canvas_size(box.width, box.height, box.depth)
+ return font_output.get_results(box)
+
+ @_api.deprecated("3.4", alternative="mathtext.math_to_image")
+ def to_mask(self, texstr, dpi=120, fontsize=14):
+ r"""
+ Convert a mathtext string to a grayscale array and depth.
+
+ Parameters
+ ----------
+ texstr : str
+ A valid mathtext string, e.g., r'IQ: $\sigma_i=15$'.
+ dpi : float
+ The dots-per-inch setting used to render the text.
+ fontsize : int
+ The font size in points
+
+ Returns
+ -------
+ array : 2D uint8 alpha
+ Mask array of rasterized tex.
+ depth : int
+ Offset of the baseline from the bottom of the image, in pixels.
+ """
+ assert self._output == "bitmap"
+ prop = FontProperties(size=fontsize)
+ ftimage, depth = self.parse(texstr, dpi=dpi, prop=prop)
+ return np.asarray(ftimage), depth
+
+ @_api.deprecated("3.4", alternative="mathtext.math_to_image")
+ def to_rgba(self, texstr, color='black', dpi=120, fontsize=14):
+ r"""
+ Convert a mathtext string to an RGBA array and depth.
+
+ Parameters
+ ----------
+ texstr : str
+ A valid mathtext string, e.g., r'IQ: $\sigma_i=15$'.
+ color : color
+ The text color.
+ dpi : float
+ The dots-per-inch setting used to render the text.
+ fontsize : int
+ The font size in points.
+
+ Returns
+ -------
+ array : (M, N, 4) array
+ RGBA color values of rasterized tex, colorized with *color*.
+ depth : int
+ Offset of the baseline from the bottom of the image, in pixels.
+ """
+ x, depth = self.to_mask(texstr, dpi=dpi, fontsize=fontsize)
+
+ r, g, b, a = mcolors.to_rgba(color)
+ RGBA = np.zeros((x.shape[0], x.shape[1], 4), dtype=np.uint8)
+ RGBA[:, :, 0] = 255 * r
+ RGBA[:, :, 1] = 255 * g
+ RGBA[:, :, 2] = 255 * b
+ RGBA[:, :, 3] = x
+ return RGBA, depth
+
+ @_api.deprecated("3.4", alternative="mathtext.math_to_image")
+ def to_png(self, filename, texstr, color='black', dpi=120, fontsize=14):
+ r"""
+ Render a tex expression to a PNG file.
+
+ Parameters
+ ----------
+ filename
+ A writable filename or fileobject.
+ texstr : str
+ A valid mathtext string, e.g., r'IQ: $\sigma_i=15$'.
+ color : color
+ The text color.
+ dpi : float
+ The dots-per-inch setting used to render the text.
+ fontsize : int
+ The font size in points.
+
+ Returns
+ -------
+ int
+ Offset of the baseline from the bottom of the image, in pixels.
+ """
+ rgba, depth = self.to_rgba(
+ texstr, color=color, dpi=dpi, fontsize=fontsize)
+ Image.fromarray(rgba).save(filename, format="png")
+ return depth
+
+ @_api.deprecated("3.4", alternative="mathtext.math_to_image")
+ def get_depth(self, texstr, dpi=120, fontsize=14):
+ r"""
+ Get the depth of a mathtext string.
+
+ Parameters
+ ----------
+ texstr : str
+ A valid mathtext string, e.g., r'IQ: $\sigma_i=15$'.
+ dpi : float
+ The dots-per-inch setting used to render the text.
+
+ Returns
+ -------
+ int
+ Offset of the baseline from the bottom of the image, in pixels.
+ """
+ assert self._output == "bitmap"
+ prop = FontProperties(size=fontsize)
+ ftimage, depth = self.parse(texstr, dpi=dpi, prop=prop)
+ return depth
+
+
+def math_to_image(s, filename_or_obj, prop=None, dpi=None, format=None):
+ """
+ Given a math expression, renders it in a closely-clipped bounding
+ box to an image file.
+
+ Parameters
+ ----------
+ s : str
+ A math expression. The math portion must be enclosed in dollar signs.
+ filename_or_obj : str or path-like or file-like
+ Where to write the image data.
+ prop : `.FontProperties`, optional
+ The size and style of the text.
+ dpi : float, optional
+ The output dpi. If not set, the dpi is determined as for
+ `.Figure.savefig`.
+ format : str, optional
+ The output format, e.g., 'svg', 'pdf', 'ps' or 'png'. If not set, the
+ format is determined as for `.Figure.savefig`.
+ """
+ from matplotlib import figure
+ # backend_agg supports all of the core output formats
+ from matplotlib.backends import backend_agg
+
+ if prop is None:
+ prop = FontProperties()
+
+ parser = MathTextParser('path')
+ width, height, depth, _, _ = parser.parse(s, dpi=72, prop=prop)
+
+ fig = figure.Figure(figsize=(width / 72.0, height / 72.0))
+ fig.text(0, depth/height, s, fontproperties=prop)
+ backend_agg.FigureCanvasAgg(fig)
+ fig.savefig(filename_or_obj, dpi=dpi, format=format)
+
+ return depth
diff --git a/venv/Lib/site-packages/matplotlib/mlab.py b/venv/Lib/site-packages/matplotlib/mlab.py
new file mode 100644
index 0000000..b6f6173
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mlab.py
@@ -0,0 +1,987 @@
+"""
+Numerical python functions written for compatibility with MATLAB
+commands with the same names. Most numerical python functions can be found in
+the `numpy` and `scipy` libraries. What remains here is code for performing
+spectral computations.
+
+Spectral functions
+------------------
+
+`cohere`
+ Coherence (normalized cross spectral density)
+
+`csd`
+ Cross spectral density using Welch's average periodogram
+
+`detrend`
+ Remove the mean or best fit line from an array
+
+`psd`
+ Power spectral density using Welch's average periodogram
+
+`specgram`
+ Spectrogram (spectrum over segments of time)
+
+`complex_spectrum`
+ Return the complex-valued frequency spectrum of a signal
+
+`magnitude_spectrum`
+ Return the magnitude of the frequency spectrum of a signal
+
+`angle_spectrum`
+ Return the angle (wrapped phase) of the frequency spectrum of a signal
+
+`phase_spectrum`
+ Return the phase (unwrapped angle) of the frequency spectrum of a signal
+
+`detrend_mean`
+ Remove the mean from a line.
+
+`detrend_linear`
+ Remove the best fit line from a line.
+
+`detrend_none`
+ Return the original line.
+
+`stride_windows`
+ Get all windows in an array in a memory-efficient manner
+"""
+
+import functools
+from numbers import Number
+
+import numpy as np
+
+from matplotlib import _api
+import matplotlib.cbook as cbook
+from matplotlib import docstring
+
+
+def window_hanning(x):
+ """
+ Return x times the hanning window of len(x).
+
+ See Also
+ --------
+ window_none : Another window algorithm.
+ """
+ return np.hanning(len(x))*x
+
+
+def window_none(x):
+ """
+ No window function; simply return x.
+
+ See Also
+ --------
+ window_hanning : Another window algorithm.
+ """
+ return x
+
+
+def detrend(x, key=None, axis=None):
+ """
+ Return x with its trend removed.
+
+ Parameters
+ ----------
+ x : array or sequence
+ Array or sequence containing the data.
+
+ key : {'default', 'constant', 'mean', 'linear', 'none'} or function
+ The detrending algorithm to use. 'default', 'mean', and 'constant' are
+ the same as `detrend_mean`. 'linear' is the same as `detrend_linear`.
+ 'none' is the same as `detrend_none`. The default is 'mean'. See the
+ corresponding functions for more details regarding the algorithms. Can
+ also be a function that carries out the detrend operation.
+
+ axis : int
+ The axis along which to do the detrending.
+
+ See Also
+ --------
+ detrend_mean : Implementation of the 'mean' algorithm.
+ detrend_linear : Implementation of the 'linear' algorithm.
+ detrend_none : Implementation of the 'none' algorithm.
+ """
+ if key is None or key in ['constant', 'mean', 'default']:
+ return detrend(x, key=detrend_mean, axis=axis)
+ elif key == 'linear':
+ return detrend(x, key=detrend_linear, axis=axis)
+ elif key == 'none':
+ return detrend(x, key=detrend_none, axis=axis)
+ elif callable(key):
+ x = np.asarray(x)
+ if axis is not None and axis + 1 > x.ndim:
+ raise ValueError(f'axis(={axis}) out of bounds')
+ if (axis is None and x.ndim == 0) or (not axis and x.ndim == 1):
+ return key(x)
+ # try to use the 'axis' argument if the function supports it,
+ # otherwise use apply_along_axis to do it
+ try:
+ return key(x, axis=axis)
+ except TypeError:
+ return np.apply_along_axis(key, axis=axis, arr=x)
+ else:
+ raise ValueError(
+ f"Unknown value for key: {key!r}, must be one of: 'default', "
+ f"'constant', 'mean', 'linear', or a function")
+
+
+def detrend_mean(x, axis=None):
+ """
+ Return x minus the mean(x).
+
+ Parameters
+ ----------
+ x : array or sequence
+ Array or sequence containing the data
+ Can have any dimensionality
+
+ axis : int
+ The axis along which to take the mean. See numpy.mean for a
+ description of this argument.
+
+ See Also
+ --------
+ detrend_linear : Another detrend algorithm.
+ detrend_none : Another detrend algorithm.
+ detrend : A wrapper around all the detrend algorithms.
+ """
+ x = np.asarray(x)
+
+ if axis is not None and axis+1 > x.ndim:
+ raise ValueError('axis(=%s) out of bounds' % axis)
+
+ return x - x.mean(axis, keepdims=True)
+
+
+def detrend_none(x, axis=None):
+ """
+ Return x: no detrending.
+
+ Parameters
+ ----------
+ x : any object
+ An object containing the data
+
+ axis : int
+ This parameter is ignored.
+ It is included for compatibility with detrend_mean
+
+ See Also
+ --------
+ detrend_mean : Another detrend algorithm.
+ detrend_linear : Another detrend algorithm.
+ detrend : A wrapper around all the detrend algorithms.
+ """
+ return x
+
+
+def detrend_linear(y):
+ """
+ Return x minus best fit line; 'linear' detrending.
+
+ Parameters
+ ----------
+ y : 0-D or 1-D array or sequence
+ Array or sequence containing the data
+
+ axis : int
+ The axis along which to take the mean. See numpy.mean for a
+ description of this argument.
+
+ See Also
+ --------
+ detrend_mean : Another detrend algorithm.
+ detrend_none : Another detrend algorithm.
+ detrend : A wrapper around all the detrend algorithms.
+ """
+ # This is faster than an algorithm based on linalg.lstsq.
+ y = np.asarray(y)
+
+ if y.ndim > 1:
+ raise ValueError('y cannot have ndim > 1')
+
+ # short-circuit 0-D array.
+ if not y.ndim:
+ return np.array(0., dtype=y.dtype)
+
+ x = np.arange(y.size, dtype=float)
+
+ C = np.cov(x, y, bias=1)
+ b = C[0, 1]/C[0, 0]
+
+ a = y.mean() - b*x.mean()
+ return y - (b*x + a)
+
+
+def stride_windows(x, n, noverlap=None, axis=0):
+ """
+ Get all windows of x with length n as a single array,
+ using strides to avoid data duplication.
+
+ .. warning::
+
+ It is not safe to write to the output array. Multiple
+ elements may point to the same piece of memory,
+ so modifying one value may change others.
+
+ Parameters
+ ----------
+ x : 1D array or sequence
+ Array or sequence containing the data.
+ n : int
+ The number of data points in each window.
+ noverlap : int, default: 0 (no overlap)
+ The overlap between adjacent windows.
+ axis : int
+ The axis along which the windows will run.
+
+ References
+ ----------
+ `stackoverflow: Rolling window for 1D arrays in Numpy?
+ `_
+ `stackoverflow: Using strides for an efficient moving average filter
+ `_
+ """
+ if noverlap is None:
+ noverlap = 0
+
+ if noverlap >= n:
+ raise ValueError('noverlap must be less than n')
+ if n < 1:
+ raise ValueError('n cannot be less than 1')
+
+ x = np.asarray(x)
+
+ if x.ndim != 1:
+ raise ValueError('only 1-dimensional arrays can be used')
+ if n == 1 and noverlap == 0:
+ if axis == 0:
+ return x[np.newaxis]
+ else:
+ return x[np.newaxis].transpose()
+ if n > x.size:
+ raise ValueError('n cannot be greater than the length of x')
+
+ # np.lib.stride_tricks.as_strided easily leads to memory corruption for
+ # non integer shape and strides, i.e. noverlap or n. See #3845.
+ noverlap = int(noverlap)
+ n = int(n)
+
+ step = n - noverlap
+ if axis == 0:
+ shape = (n, (x.shape[-1]-noverlap)//step)
+ strides = (x.strides[0], step*x.strides[0])
+ else:
+ shape = ((x.shape[-1]-noverlap)//step, n)
+ strides = (step*x.strides[0], x.strides[0])
+ return np.lib.stride_tricks.as_strided(x, shape=shape, strides=strides)
+
+
+def _spectral_helper(x, y=None, NFFT=None, Fs=None, detrend_func=None,
+ window=None, noverlap=None, pad_to=None,
+ sides=None, scale_by_freq=None, mode=None):
+ """
+ Private helper implementing the common parts between the psd, csd,
+ spectrogram and complex, magnitude, angle, and phase spectrums.
+ """
+ if y is None:
+ # if y is None use x for y
+ same_data = True
+ else:
+ # The checks for if y is x are so that we can use the same function to
+ # implement the core of psd(), csd(), and spectrogram() without doing
+ # extra calculations. We return the unaveraged Pxy, freqs, and t.
+ same_data = y is x
+
+ if Fs is None:
+ Fs = 2
+ if noverlap is None:
+ noverlap = 0
+ if detrend_func is None:
+ detrend_func = detrend_none
+ if window is None:
+ window = window_hanning
+
+ # if NFFT is set to None use the whole signal
+ if NFFT is None:
+ NFFT = 256
+
+ if mode is None or mode == 'default':
+ mode = 'psd'
+ _api.check_in_list(
+ ['default', 'psd', 'complex', 'magnitude', 'angle', 'phase'],
+ mode=mode)
+
+ if not same_data and mode != 'psd':
+ raise ValueError("x and y must be equal if mode is not 'psd'")
+
+ # Make sure we're dealing with a numpy array. If y and x were the same
+ # object to start with, keep them that way
+ x = np.asarray(x)
+ if not same_data:
+ y = np.asarray(y)
+
+ if sides is None or sides == 'default':
+ if np.iscomplexobj(x):
+ sides = 'twosided'
+ else:
+ sides = 'onesided'
+ _api.check_in_list(['default', 'onesided', 'twosided'], sides=sides)
+
+ # zero pad x and y up to NFFT if they are shorter than NFFT
+ if len(x) < NFFT:
+ n = len(x)
+ x = np.resize(x, NFFT)
+ x[n:] = 0
+
+ if not same_data and len(y) < NFFT:
+ n = len(y)
+ y = np.resize(y, NFFT)
+ y[n:] = 0
+
+ if pad_to is None:
+ pad_to = NFFT
+
+ if mode != 'psd':
+ scale_by_freq = False
+ elif scale_by_freq is None:
+ scale_by_freq = True
+
+ # For real x, ignore the negative frequencies unless told otherwise
+ if sides == 'twosided':
+ numFreqs = pad_to
+ if pad_to % 2:
+ freqcenter = (pad_to - 1)//2 + 1
+ else:
+ freqcenter = pad_to//2
+ scaling_factor = 1.
+ elif sides == 'onesided':
+ if pad_to % 2:
+ numFreqs = (pad_to + 1)//2
+ else:
+ numFreqs = pad_to//2 + 1
+ scaling_factor = 2.
+
+ if not np.iterable(window):
+ window = window(np.ones(NFFT, x.dtype))
+ if len(window) != NFFT:
+ raise ValueError(
+ "The window length must match the data's first dimension")
+
+ result = stride_windows(x, NFFT, noverlap, axis=0)
+ result = detrend(result, detrend_func, axis=0)
+ result = result * window.reshape((-1, 1))
+ result = np.fft.fft(result, n=pad_to, axis=0)[:numFreqs, :]
+ freqs = np.fft.fftfreq(pad_to, 1/Fs)[:numFreqs]
+
+ if not same_data:
+ # if same_data is False, mode must be 'psd'
+ resultY = stride_windows(y, NFFT, noverlap)
+ resultY = detrend(resultY, detrend_func, axis=0)
+ resultY = resultY * window.reshape((-1, 1))
+ resultY = np.fft.fft(resultY, n=pad_to, axis=0)[:numFreqs, :]
+ result = np.conj(result) * resultY
+ elif mode == 'psd':
+ result = np.conj(result) * result
+ elif mode == 'magnitude':
+ result = np.abs(result) / np.abs(window).sum()
+ elif mode == 'angle' or mode == 'phase':
+ # we unwrap the phase later to handle the onesided vs. twosided case
+ result = np.angle(result)
+ elif mode == 'complex':
+ result /= np.abs(window).sum()
+
+ if mode == 'psd':
+
+ # Also include scaling factors for one-sided densities and dividing by
+ # the sampling frequency, if desired. Scale everything, except the DC
+ # component and the NFFT/2 component:
+
+ # if we have a even number of frequencies, don't scale NFFT/2
+ if not NFFT % 2:
+ slc = slice(1, -1, None)
+ # if we have an odd number, just don't scale DC
+ else:
+ slc = slice(1, None, None)
+
+ result[slc] *= scaling_factor
+
+ # MATLAB divides by the sampling frequency so that density function
+ # has units of dB/Hz and can be integrated by the plotted frequency
+ # values. Perform the same scaling here.
+ if scale_by_freq:
+ result /= Fs
+ # Scale the spectrum by the norm of the window to compensate for
+ # windowing loss; see Bendat & Piersol Sec 11.5.2.
+ result /= (np.abs(window)**2).sum()
+ else:
+ # In this case, preserve power in the segment, not amplitude
+ result /= np.abs(window).sum()**2
+
+ t = np.arange(NFFT/2, len(x) - NFFT/2 + 1, NFFT - noverlap)/Fs
+
+ if sides == 'twosided':
+ # center the frequency range at zero
+ freqs = np.roll(freqs, -freqcenter, axis=0)
+ result = np.roll(result, -freqcenter, axis=0)
+ elif not pad_to % 2:
+ # get the last value correctly, it is negative otherwise
+ freqs[-1] *= -1
+
+ # we unwrap the phase here to handle the onesided vs. twosided case
+ if mode == 'phase':
+ result = np.unwrap(result, axis=0)
+
+ return result, freqs, t
+
+
+def _single_spectrum_helper(
+ mode, x, Fs=None, window=None, pad_to=None, sides=None):
+ """
+ Private helper implementing the commonality between the complex, magnitude,
+ angle, and phase spectrums.
+ """
+ _api.check_in_list(['complex', 'magnitude', 'angle', 'phase'], mode=mode)
+
+ if pad_to is None:
+ pad_to = len(x)
+
+ spec, freqs, _ = _spectral_helper(x=x, y=None, NFFT=len(x), Fs=Fs,
+ detrend_func=detrend_none, window=window,
+ noverlap=0, pad_to=pad_to,
+ sides=sides,
+ scale_by_freq=False,
+ mode=mode)
+ if mode != 'complex':
+ spec = spec.real
+
+ if spec.ndim == 2 and spec.shape[1] == 1:
+ spec = spec[:, 0]
+
+ return spec, freqs
+
+
+# Split out these keyword docs so that they can be used elsewhere
+docstring.interpd.update(
+ Spectral="""\
+Fs : float, default: 2
+ The sampling frequency (samples per time unit). It is used to calculate
+ the Fourier frequencies, *freqs*, in cycles per time unit.
+
+window : callable or ndarray, default: `.window_hanning`
+ A function or a vector of length *NFFT*. To create window vectors see
+ `.window_hanning`, `.window_none`, `numpy.blackman`, `numpy.hamming`,
+ `numpy.bartlett`, `scipy.signal`, `scipy.signal.get_window`, etc. If a
+ function is passed as the argument, it must take a data segment as an
+ argument and return the windowed version of the segment.
+
+sides : {'default', 'onesided', 'twosided'}, optional
+ Which sides of the spectrum to return. 'default' is one-sided for real
+ data and two-sided for complex data. 'onesided' forces the return of a
+ one-sided spectrum, while 'twosided' forces two-sided.""",
+
+ Single_Spectrum="""\
+pad_to : int, optional
+ The number of points to which the data segment is padded when performing
+ the FFT. While not increasing the actual resolution of the spectrum (the
+ minimum distance between resolvable peaks), this can give more points in
+ the plot, allowing for more detail. This corresponds to the *n* parameter
+ in the call to fft(). The default is None, which sets *pad_to* equal to
+ the length of the input signal (i.e. no padding).""",
+
+ PSD="""\
+pad_to : int, optional
+ The number of points to which the data segment is padded when performing
+ the FFT. This can be different from *NFFT*, which specifies the number
+ of data points used. While not increasing the actual resolution of the
+ spectrum (the minimum distance between resolvable peaks), this can give
+ more points in the plot, allowing for more detail. This corresponds to
+ the *n* parameter in the call to fft(). The default is None, which sets
+ *pad_to* equal to *NFFT*
+
+NFFT : int, default: 256
+ The number of data points used in each block for the FFT. A power 2 is
+ most efficient. This should *NOT* be used to get zero padding, or the
+ scaling of the result will be incorrect; use *pad_to* for this instead.
+
+detrend : {'none', 'mean', 'linear'} or callable, default: 'none'
+ The function applied to each segment before fft-ing, designed to remove
+ the mean or linear trend. Unlike in MATLAB, where the *detrend* parameter
+ is a vector, in Matplotlib is it a function. The :mod:`~matplotlib.mlab`
+ module defines `.detrend_none`, `.detrend_mean`, and `.detrend_linear`,
+ but you can use a custom function as well. You can also use a string to
+ choose one of the functions: 'none' calls `.detrend_none`. 'mean' calls
+ `.detrend_mean`. 'linear' calls `.detrend_linear`.
+
+scale_by_freq : bool, default: True
+ Whether the resulting density values should be scaled by the scaling
+ frequency, which gives density in units of Hz^-1. This allows for
+ integration over the returned frequency values. The default is True for
+ MATLAB compatibility.""")
+
+
+@docstring.dedent_interpd
+def psd(x, NFFT=None, Fs=None, detrend=None, window=None,
+ noverlap=None, pad_to=None, sides=None, scale_by_freq=None):
+ r"""
+ Compute the power spectral density.
+
+ The power spectral density :math:`P_{xx}` by Welch's average
+ periodogram method. The vector *x* is divided into *NFFT* length
+ segments. Each segment is detrended by function *detrend* and
+ windowed by function *window*. *noverlap* gives the length of
+ the overlap between segments. The :math:`|\mathrm{fft}(i)|^2`
+ of each segment :math:`i` are averaged to compute :math:`P_{xx}`.
+
+ If len(*x*) < *NFFT*, it will be zero padded to *NFFT*.
+
+ Parameters
+ ----------
+ x : 1-D array or sequence
+ Array or sequence containing the data
+
+ %(Spectral)s
+
+ %(PSD)s
+
+ noverlap : int, default: 0 (no overlap)
+ The number of points of overlap between segments.
+
+ Returns
+ -------
+ Pxx : 1-D array
+ The values for the power spectrum :math:`P_{xx}` (real valued)
+
+ freqs : 1-D array
+ The frequencies corresponding to the elements in *Pxx*
+
+ References
+ ----------
+ Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John
+ Wiley & Sons (1986)
+
+ See Also
+ --------
+ specgram
+ `specgram` differs in the default overlap; in not returning the mean of
+ the segment periodograms; and in returning the times of the segments.
+
+ magnitude_spectrum : returns the magnitude spectrum.
+
+ csd : returns the spectral density between two signals.
+ """
+ Pxx, freqs = csd(x=x, y=None, NFFT=NFFT, Fs=Fs, detrend=detrend,
+ window=window, noverlap=noverlap, pad_to=pad_to,
+ sides=sides, scale_by_freq=scale_by_freq)
+ return Pxx.real, freqs
+
+
+@docstring.dedent_interpd
+def csd(x, y, NFFT=None, Fs=None, detrend=None, window=None,
+ noverlap=None, pad_to=None, sides=None, scale_by_freq=None):
+ """
+ Compute the cross-spectral density.
+
+ The cross spectral density :math:`P_{xy}` by Welch's average
+ periodogram method. The vectors *x* and *y* are divided into
+ *NFFT* length segments. Each segment is detrended by function
+ *detrend* and windowed by function *window*. *noverlap* gives
+ the length of the overlap between segments. The product of
+ the direct FFTs of *x* and *y* are averaged over each segment
+ to compute :math:`P_{xy}`, with a scaling to correct for power
+ loss due to windowing.
+
+ If len(*x*) < *NFFT* or len(*y*) < *NFFT*, they will be zero
+ padded to *NFFT*.
+
+ Parameters
+ ----------
+ x, y : 1-D arrays or sequences
+ Arrays or sequences containing the data
+
+ %(Spectral)s
+
+ %(PSD)s
+
+ noverlap : int, default: 0 (no overlap)
+ The number of points of overlap between segments.
+
+ Returns
+ -------
+ Pxy : 1-D array
+ The values for the cross spectrum :math:`P_{xy}` before scaling (real
+ valued)
+
+ freqs : 1-D array
+ The frequencies corresponding to the elements in *Pxy*
+
+ References
+ ----------
+ Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John
+ Wiley & Sons (1986)
+
+ See Also
+ --------
+ psd : equivalent to setting ``y = x``.
+ """
+ if NFFT is None:
+ NFFT = 256
+ Pxy, freqs, _ = _spectral_helper(x=x, y=y, NFFT=NFFT, Fs=Fs,
+ detrend_func=detrend, window=window,
+ noverlap=noverlap, pad_to=pad_to,
+ sides=sides, scale_by_freq=scale_by_freq,
+ mode='psd')
+
+ if Pxy.ndim == 2:
+ if Pxy.shape[1] > 1:
+ Pxy = Pxy.mean(axis=1)
+ else:
+ Pxy = Pxy[:, 0]
+ return Pxy, freqs
+
+
+_single_spectrum_docs = """\
+Compute the {quantity} of *x*.
+Data is padded to a length of *pad_to* and the windowing function *window* is
+applied to the signal.
+
+Parameters
+----------
+x : 1-D array or sequence
+ Array or sequence containing the data
+
+{Spectral}
+
+{Single_Spectrum}
+
+Returns
+-------
+spectrum : 1-D array
+ The {quantity}.
+freqs : 1-D array
+ The frequencies corresponding to the elements in *spectrum*.
+
+See Also
+--------
+psd
+ Returns the power spectral density.
+complex_spectrum
+ Returns the complex-valued frequency spectrum.
+magnitude_spectrum
+ Returns the absolute value of the `complex_spectrum`.
+angle_spectrum
+ Returns the angle of the `complex_spectrum`.
+phase_spectrum
+ Returns the phase (unwrapped angle) of the `complex_spectrum`.
+specgram
+ Can return the complex spectrum of segments within the signal.
+"""
+
+
+complex_spectrum = functools.partial(_single_spectrum_helper, "complex")
+complex_spectrum.__doc__ = _single_spectrum_docs.format(
+ quantity="complex-valued frequency spectrum",
+ **docstring.interpd.params)
+magnitude_spectrum = functools.partial(_single_spectrum_helper, "magnitude")
+magnitude_spectrum.__doc__ = _single_spectrum_docs.format(
+ quantity="magnitude (absolute value) of the frequency spectrum",
+ **docstring.interpd.params)
+angle_spectrum = functools.partial(_single_spectrum_helper, "angle")
+angle_spectrum.__doc__ = _single_spectrum_docs.format(
+ quantity="angle of the frequency spectrum (wrapped phase spectrum)",
+ **docstring.interpd.params)
+phase_spectrum = functools.partial(_single_spectrum_helper, "phase")
+phase_spectrum.__doc__ = _single_spectrum_docs.format(
+ quantity="phase of the frequency spectrum (unwrapped phase spectrum)",
+ **docstring.interpd.params)
+
+
+@docstring.dedent_interpd
+def specgram(x, NFFT=None, Fs=None, detrend=None, window=None,
+ noverlap=None, pad_to=None, sides=None, scale_by_freq=None,
+ mode=None):
+ """
+ Compute a spectrogram.
+
+ Compute and plot a spectrogram of data in x. Data are split into
+ NFFT length segments and the spectrum of each section is
+ computed. The windowing function window is applied to each
+ segment, and the amount of overlap of each segment is
+ specified with noverlap.
+
+ Parameters
+ ----------
+ x : array-like
+ 1-D array or sequence.
+
+ %(Spectral)s
+
+ %(PSD)s
+
+ noverlap : int, default: 128
+ The number of points of overlap between blocks.
+ mode : str, default: 'psd'
+ What sort of spectrum to use:
+ 'psd'
+ Returns the power spectral density.
+ 'complex'
+ Returns the complex-valued frequency spectrum.
+ 'magnitude'
+ Returns the magnitude spectrum.
+ 'angle'
+ Returns the phase spectrum without unwrapping.
+ 'phase'
+ Returns the phase spectrum with unwrapping.
+
+ Returns
+ -------
+ spectrum : array-like
+ 2D array, columns are the periodograms of successive segments.
+
+ freqs : array-like
+ 1-D array, frequencies corresponding to the rows in *spectrum*.
+
+ t : array-like
+ 1-D array, the times corresponding to midpoints of segments
+ (i.e the columns in *spectrum*).
+
+ See Also
+ --------
+ psd : differs in the overlap and in the return values.
+ complex_spectrum : similar, but with complex valued frequencies.
+ magnitude_spectrum : similar single segment when mode is 'magnitude'.
+ angle_spectrum : similar to single segment when mode is 'angle'.
+ phase_spectrum : similar to single segment when mode is 'phase'.
+
+ Notes
+ -----
+ detrend and scale_by_freq only apply when *mode* is set to 'psd'.
+
+ """
+ if noverlap is None:
+ noverlap = 128 # default in _spectral_helper() is noverlap = 0
+ if NFFT is None:
+ NFFT = 256 # same default as in _spectral_helper()
+ if len(x) <= NFFT:
+ _api.warn_external("Only one segment is calculated since parameter "
+ f"NFFT (={NFFT}) >= signal length (={len(x)}).")
+
+ spec, freqs, t = _spectral_helper(x=x, y=None, NFFT=NFFT, Fs=Fs,
+ detrend_func=detrend, window=window,
+ noverlap=noverlap, pad_to=pad_to,
+ sides=sides,
+ scale_by_freq=scale_by_freq,
+ mode=mode)
+
+ if mode != 'complex':
+ spec = spec.real # Needed since helper implements generically
+
+ return spec, freqs, t
+
+
+@docstring.dedent_interpd
+def cohere(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning,
+ noverlap=0, pad_to=None, sides='default', scale_by_freq=None):
+ r"""
+ The coherence between *x* and *y*. Coherence is the normalized
+ cross spectral density:
+
+ .. math::
+
+ C_{xy} = \frac{|P_{xy}|^2}{P_{xx}P_{yy}}
+
+ Parameters
+ ----------
+ x, y
+ Array or sequence containing the data
+
+ %(Spectral)s
+
+ %(PSD)s
+
+ noverlap : int, default: 0 (no overlap)
+ The number of points of overlap between segments.
+
+ Returns
+ -------
+ Cxy : 1-D array
+ The coherence vector.
+ freqs : 1-D array
+ The frequencies for the elements in *Cxy*.
+
+ See Also
+ --------
+ :func:`psd`, :func:`csd` :
+ For information about the methods used to compute :math:`P_{xy}`,
+ :math:`P_{xx}` and :math:`P_{yy}`.
+ """
+ if len(x) < 2 * NFFT:
+ raise ValueError(
+ "Coherence is calculated by averaging over *NFFT* length "
+ "segments. Your signal is too short for your choice of *NFFT*.")
+ Pxx, f = psd(x, NFFT, Fs, detrend, window, noverlap, pad_to, sides,
+ scale_by_freq)
+ Pyy, f = psd(y, NFFT, Fs, detrend, window, noverlap, pad_to, sides,
+ scale_by_freq)
+ Pxy, f = csd(x, y, NFFT, Fs, detrend, window, noverlap, pad_to, sides,
+ scale_by_freq)
+ Cxy = np.abs(Pxy) ** 2 / (Pxx * Pyy)
+ return Cxy, f
+
+
+class GaussianKDE:
+ """
+ Representation of a kernel-density estimate using Gaussian kernels.
+
+ Parameters
+ ----------
+ dataset : array-like
+ Datapoints to estimate from. In case of univariate data this is a 1-D
+ array, otherwise a 2D array with shape (# of dims, # of data).
+
+ bw_method : str, scalar or callable, optional
+ The method used to calculate the estimator bandwidth. This can be
+ 'scott', 'silverman', a scalar constant or a callable. If a
+ scalar, this will be used directly as `kde.factor`. If a
+ callable, it should take a `GaussianKDE` instance as only
+ parameter and return a scalar. If None (default), 'scott' is used.
+
+ Attributes
+ ----------
+ dataset : ndarray
+ The dataset with which `gaussian_kde` was initialized.
+
+ dim : int
+ Number of dimensions.
+
+ num_dp : int
+ Number of datapoints.
+
+ factor : float
+ The bandwidth factor, obtained from `kde.covariance_factor`, with which
+ the covariance matrix is multiplied.
+
+ covariance : ndarray
+ The covariance matrix of *dataset*, scaled by the calculated bandwidth
+ (`kde.factor`).
+
+ inv_cov : ndarray
+ The inverse of *covariance*.
+
+ Methods
+ -------
+ kde.evaluate(points) : ndarray
+ Evaluate the estimated pdf on a provided set of points.
+
+ kde(points) : ndarray
+ Same as kde.evaluate(points)
+
+ """
+
+ # This implementation with minor modification was too good to pass up.
+ # from scipy: https://github.com/scipy/scipy/blob/master/scipy/stats/kde.py
+
+ def __init__(self, dataset, bw_method=None):
+ self.dataset = np.atleast_2d(dataset)
+ if not np.array(self.dataset).size > 1:
+ raise ValueError("`dataset` input should have multiple elements.")
+
+ self.dim, self.num_dp = np.array(self.dataset).shape
+
+ if bw_method is None:
+ pass
+ elif cbook._str_equal(bw_method, 'scott'):
+ self.covariance_factor = self.scotts_factor
+ elif cbook._str_equal(bw_method, 'silverman'):
+ self.covariance_factor = self.silverman_factor
+ elif isinstance(bw_method, Number):
+ self._bw_method = 'use constant'
+ self.covariance_factor = lambda: bw_method
+ elif callable(bw_method):
+ self._bw_method = bw_method
+ self.covariance_factor = lambda: self._bw_method(self)
+ else:
+ raise ValueError("`bw_method` should be 'scott', 'silverman', a "
+ "scalar or a callable")
+
+ # Computes the covariance matrix for each Gaussian kernel using
+ # covariance_factor().
+
+ self.factor = self.covariance_factor()
+ # Cache covariance and inverse covariance of the data
+ if not hasattr(self, '_data_inv_cov'):
+ self.data_covariance = np.atleast_2d(
+ np.cov(
+ self.dataset,
+ rowvar=1,
+ bias=False))
+ self.data_inv_cov = np.linalg.inv(self.data_covariance)
+
+ self.covariance = self.data_covariance * self.factor ** 2
+ self.inv_cov = self.data_inv_cov / self.factor ** 2
+ self.norm_factor = (np.sqrt(np.linalg.det(2 * np.pi * self.covariance))
+ * self.num_dp)
+
+ def scotts_factor(self):
+ return np.power(self.num_dp, -1. / (self.dim + 4))
+
+ def silverman_factor(self):
+ return np.power(
+ self.num_dp * (self.dim + 2.0) / 4.0, -1. / (self.dim + 4))
+
+ # Default method to calculate bandwidth, can be overwritten by subclass
+ covariance_factor = scotts_factor
+
+ def evaluate(self, points):
+ """
+ Evaluate the estimated pdf on a set of points.
+
+ Parameters
+ ----------
+ points : (# of dimensions, # of points)-array
+ Alternatively, a (# of dimensions,) vector can be passed in and
+ treated as a single point.
+
+ Returns
+ -------
+ (# of points,)-array
+ The values at each point.
+
+ Raises
+ ------
+ ValueError : if the dimensionality of the input points is different
+ than the dimensionality of the KDE.
+
+ """
+ points = np.atleast_2d(points)
+
+ dim, num_m = np.array(points).shape
+ if dim != self.dim:
+ raise ValueError("points have dimension {}, dataset has dimension "
+ "{}".format(dim, self.dim))
+
+ result = np.zeros(num_m)
+
+ if num_m >= self.num_dp:
+ # there are more points than data, so loop over data
+ for i in range(self.num_dp):
+ diff = self.dataset[:, i, np.newaxis] - points
+ tdiff = np.dot(self.inv_cov, diff)
+ energy = np.sum(diff * tdiff, axis=0) / 2.0
+ result = result + np.exp(-energy)
+ else:
+ # loop over points
+ for i in range(num_m):
+ diff = self.dataset - points[:, i, np.newaxis]
+ tdiff = np.dot(self.inv_cov, diff)
+ energy = np.sum(diff * tdiff, axis=0) / 2.0
+ result[i] = np.sum(np.exp(-energy), axis=0)
+
+ result = result / self.norm_factor
+
+ return result
+
+ __call__ = evaluate
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmex10.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmex10.afm
new file mode 100644
index 0000000..b9e318f
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmex10.afm
@@ -0,0 +1,220 @@
+StartFontMetrics 2.0
+Comment Creation Date: Thu Jun 21 22:23:20 1990
+Comment UniqueID 5000774
+FontName CMEX10
+EncodingScheme FontSpecific
+FullName CMEX10
+FamilyName Computer Modern
+Weight Medium
+ItalicAngle 0
+IsFixedPitch false
+Version 1.00
+Notice Copyright (c) 1997 American Mathematical Society. All Rights Reserved.
+Comment Computer Modern fonts were designed by Donald E. Knuth
+FontBBox -24 -2960 1454 772
+XHeight 430.556
+Comment CapHeight 0
+Ascender 750
+Comment Descender -1760
+Descender -2960
+Comment FontID CMEX
+Comment DesignSize 10 (pts)
+Comment CharacterCodingScheme TeX math extension
+Comment Space 0 0 0
+Comment ExtraSpace 0
+Comment Quad 1000
+Comment DefaultRuleThickness 40
+Comment BigOpSpacing 111.111 166.667 200 600 100
+Comment Ascendible characters (74) % macro - PS charname
+Comment Ascending 0, 16, 18, 32, 48 % ( - parenleft
+Comment Ascending 1, 17, 19, 33, 49 % ) - parenright
+Comment Ascending 2, 104, 20, 34, 50 % [ - bracketleft
+Comment Ascending 3, 105, 21, 35, 51 % ] - bracketright
+Comment Ascending 4, 106, 22, 36, 52 % lfloor - floorleft
+Comment Ascending 5, 107, 23, 37, 53 % rfloor - floorright
+Comment Ascending 6, 108, 24, 38, 54 % lceil - ceilingleft
+Comment Ascending 7, 109, 25, 39, 55 % rceil - ceilingright
+Comment Ascending 8, 110, 26, 40, 56 % { - braceleft
+Comment Ascending 9, 111, 27, 41, 57 % } - braceright
+Comment Ascending 10, 68, 28, 42 % < - anglebracketleft
+Comment Ascending 11, 69, 29, 43 % > - anglebracketright
+Comment Ascending 14, 46, 30, 44 % / - slash
+Comment Ascending 15, 47, 31, 45 % \ - backslash
+Comment Ascending 70, 71 % bigsqcup - unionsq
+Comment Ascending 72, 73 % oint - contintegral
+Comment Ascending 74, 75 % bigodot - circledot
+Comment Ascending 76, 77 % bigoplus - circleplus
+Comment Ascending 78, 79 % bigotimes - circlemultiply
+Comment Ascending 80, 88 % sum - summation
+Comment Ascending 81, 89 % prod - product
+Comment Ascending 82, 90 % int - integral
+Comment Ascending 83, 91 % bigcup - union
+Comment Ascending 84, 92 % bigcap - intersection
+Comment Ascending 85, 93 % biguplus - unionmulti
+Comment Ascending 86, 94 % bigwedge - logicaland
+Comment Ascending 87, 95 % bigvee - logicalor
+Comment Ascending 96, 97 % coprod - coproduct
+Comment Ascending 98, 99, 100 % widehat - hatwide
+Comment Ascending 101, 102, 103 % widetilde - tildewide
+Comment Ascending 112, 113, 114, 115, 116 % radical - sqrt
+Comment Extensible characters (28)
+Comment Extensible 12 top 0 mid 0 bot 0 rep 12 % vert - thin bar
+Comment Extensible 13 top 0 mid 0 bot 0 rep 13 % Vert - thin double bar
+Comment Extensible 48 top 48 mid 0 bot 64 rep 66 % ( - parenleft
+Comment Extensible 49 top 49 mid 0 bot 65 rep 67 % ) - parenright
+Comment Extensible 50 top 50 mid 0 bot 52 rep 54 % [ - bracketleft
+Comment Extensible 51 top 51 mid 0 bot 53 rep 55 % ] - bracketright
+Comment Extensible 52 top 0 mid 0 bot 52 rep 54 % lfloor - floorleft
+Comment Extensible 53 top 0 mid 0 bot 53 rep 55 % rfloor - floorright
+Comment Extensible 54 top 50 mid 0 bot 0 rep 54 % lceil - ceilingleft
+Comment Extensible 55 top 51 mid 0 bot 0 rep 55 % rceil - ceilingright
+Comment Extensible 56 top 56 mid 60 bot 58 rep 62 % { - braceleft
+Comment Extensible 57 top 57 mid 61 bot 59 rep 62 % } - braceright
+Comment Extensible 58 top 56 mid 0 bot 58 rep 62 % lgroup
+Comment Extensible 59 top 57 mid 0 bot 59 rep 62 % rgroup
+Comment Extensible 60 top 0 mid 0 bot 0 rep 63 % arrowvert
+Comment Extensible 61 top 0 mid 0 bot 0 rep 119 % Arrowvert
+Comment Extensible 62 top 0 mid 0 bot 0 rep 62 % bracevert
+Comment Extensible 63 top 120 mid 0 bot 121 rep 63 % updownarrow
+Comment Extensible 64 top 56 mid 0 bot 59 rep 62 % lmoustache
+Comment Extensible 65 top 57 mid 0 bot 58 rep 62 % rmoustache
+Comment Extensible 66 top 0 mid 0 bot 0 rep 66 % parenleftexten
+Comment Extensible 67 top 0 mid 0 bot 0 rep 67 % parenrightexten
+Comment Extensible 116 top 118 mid 0 bot 116 rep 117 % radical
+Comment Extensible 119 top 126 mid 0 bot 127 rep 119 % Updownarrow
+Comment Extensible 120 top 120 mid 0 bot 0 rep 63 % uparrow
+Comment Extensible 121 top 0 mid 0 bot 121 rep 63 % downarrow
+Comment Extensible 126 top 126 mid 0 bot 0 rep 119 % Uparrow
+Comment Extensible 127 top 0 mid 0 bot 127 rep 119 % Downarrow
+StartCharMetrics 129
+C 0 ; WX 458.333 ; N parenleftbig ; B 152 -1159 413 40 ;
+C 1 ; WX 458.333 ; N parenrightbig ; B 44 -1159 305 40 ;
+C 2 ; WX 416.667 ; N bracketleftbig ; B 202 -1159 394 40 ;
+C 3 ; WX 416.667 ; N bracketrightbig ; B 22 -1159 214 40 ;
+C 4 ; WX 472.222 ; N floorleftbig ; B 202 -1159 449 40 ;
+C 5 ; WX 472.222 ; N floorrightbig ; B 22 -1159 269 40 ;
+C 6 ; WX 472.222 ; N ceilingleftbig ; B 202 -1159 449 40 ;
+C 7 ; WX 472.222 ; N ceilingrightbig ; B 22 -1159 269 40 ;
+C 8 ; WX 583.333 ; N braceleftbig ; B 113 -1159 469 40 ;
+C 9 ; WX 583.333 ; N bracerightbig ; B 113 -1159 469 40 ;
+C 10 ; WX 472.222 ; N angbracketleftbig ; B 98 -1160 393 40 ;
+C 11 ; WX 472.222 ; N angbracketrightbig ; B 78 -1160 373 40 ;
+C 12 ; WX 333.333 ; N vextendsingle ; B 145 -621 188 21 ;
+C 13 ; WX 555.556 ; N vextenddouble ; B 145 -621 410 21 ;
+C 14 ; WX 577.778 ; N slashbig ; B 56 -1159 521 40 ;
+C 15 ; WX 577.778 ; N backslashbig ; B 56 -1159 521 40 ;
+C 16 ; WX 597.222 ; N parenleftBig ; B 180 -1759 560 40 ;
+C 17 ; WX 597.222 ; N parenrightBig ; B 36 -1759 416 40 ;
+C 18 ; WX 736.111 ; N parenleftbigg ; B 208 -2359 700 40 ;
+C 19 ; WX 736.111 ; N parenrightbigg ; B 35 -2359 527 40 ;
+C 20 ; WX 527.778 ; N bracketleftbigg ; B 250 -2359 513 40 ;
+C 21 ; WX 527.778 ; N bracketrightbigg ; B 14 -2359 277 40 ;
+C 22 ; WX 583.333 ; N floorleftbigg ; B 250 -2359 568 40 ;
+C 23 ; WX 583.333 ; N floorrightbigg ; B 14 -2359 332 40 ;
+C 24 ; WX 583.333 ; N ceilingleftbigg ; B 250 -2359 568 40 ;
+C 25 ; WX 583.333 ; N ceilingrightbigg ; B 14 -2359 332 40 ;
+C 26 ; WX 750 ; N braceleftbigg ; B 131 -2359 618 40 ;
+C 27 ; WX 750 ; N bracerightbigg ; B 131 -2359 618 40 ;
+C 28 ; WX 750 ; N angbracketleftbigg ; B 125 -2359 652 40 ;
+C 29 ; WX 750 ; N angbracketrightbigg ; B 97 -2359 624 40 ;
+C 30 ; WX 1044.44 ; N slashbigg ; B 56 -2359 987 40 ;
+C 31 ; WX 1044.44 ; N backslashbigg ; B 56 -2359 987 40 ;
+C 32 ; WX 791.667 ; N parenleftBigg ; B 236 -2959 757 40 ;
+C 33 ; WX 791.667 ; N parenrightBigg ; B 34 -2959 555 40 ;
+C 34 ; WX 583.333 ; N bracketleftBigg ; B 275 -2959 571 40 ;
+C 35 ; WX 583.333 ; N bracketrightBigg ; B 11 -2959 307 40 ;
+C 36 ; WX 638.889 ; N floorleftBigg ; B 275 -2959 627 40 ;
+C 37 ; WX 638.889 ; N floorrightBigg ; B 11 -2959 363 40 ;
+C 38 ; WX 638.889 ; N ceilingleftBigg ; B 275 -2959 627 40 ;
+C 39 ; WX 638.889 ; N ceilingrightBigg ; B 11 -2959 363 40 ;
+C 40 ; WX 805.556 ; N braceleftBigg ; B 144 -2959 661 40 ;
+C 41 ; WX 805.556 ; N bracerightBigg ; B 144 -2959 661 40 ;
+C 42 ; WX 805.556 ; N angbracketleftBigg ; B 139 -2960 697 40 ;
+C 43 ; WX 805.556 ; N angbracketrightBigg ; B 108 -2960 666 40 ;
+C 44 ; WX 1277.78 ; N slashBigg ; B 56 -2959 1221 40 ;
+C 45 ; WX 1277.78 ; N backslashBigg ; B 56 -2959 1221 40 ;
+C 46 ; WX 811.111 ; N slashBig ; B 56 -1759 754 40 ;
+C 47 ; WX 811.111 ; N backslashBig ; B 56 -1759 754 40 ;
+C 48 ; WX 875 ; N parenlefttp ; B 291 -1770 842 39 ;
+C 49 ; WX 875 ; N parenrighttp ; B 32 -1770 583 39 ;
+C 50 ; WX 666.667 ; N bracketlefttp ; B 326 -1760 659 39 ;
+C 51 ; WX 666.667 ; N bracketrighttp ; B 7 -1760 340 39 ;
+C 52 ; WX 666.667 ; N bracketleftbt ; B 326 -1759 659 40 ;
+C 53 ; WX 666.667 ; N bracketrightbt ; B 7 -1759 340 40 ;
+C 54 ; WX 666.667 ; N bracketleftex ; B 326 -601 395 1 ;
+C 55 ; WX 666.667 ; N bracketrightex ; B 271 -601 340 1 ;
+C 56 ; WX 888.889 ; N bracelefttp ; B 384 -910 718 -1 ;
+C 57 ; WX 888.889 ; N bracerighttp ; B 170 -910 504 -1 ;
+C 58 ; WX 888.889 ; N braceleftbt ; B 384 -899 718 10 ;
+C 59 ; WX 888.889 ; N bracerightbt ; B 170 -899 504 10 ;
+C 60 ; WX 888.889 ; N braceleftmid ; B 170 -1810 504 10 ;
+C 61 ; WX 888.889 ; N bracerightmid ; B 384 -1810 718 10 ;
+C 62 ; WX 888.889 ; N braceex ; B 384 -310 504 10 ;
+C 63 ; WX 666.667 ; N arrowvertex ; B 312 -601 355 1 ;
+C 64 ; WX 875 ; N parenleftbt ; B 291 -1759 842 50 ;
+C 65 ; WX 875 ; N parenrightbt ; B 32 -1759 583 50 ;
+C 66 ; WX 875 ; N parenleftex ; B 291 -610 402 10 ;
+C 67 ; WX 875 ; N parenrightex ; B 472 -610 583 10 ;
+C 68 ; WX 611.111 ; N angbracketleftBig ; B 112 -1759 522 40 ;
+C 69 ; WX 611.111 ; N angbracketrightBig ; B 88 -1759 498 40 ;
+C 70 ; WX 833.333 ; N unionsqtext ; B 56 -1000 776 0 ;
+C 71 ; WX 1111.11 ; N unionsqdisplay ; B 56 -1400 1054 0 ;
+C 72 ; WX 472.222 ; N contintegraltext ; B 56 -1111 609 0 ;
+C 73 ; WX 555.556 ; N contintegraldisplay ; B 56 -2222 943 0 ;
+C 74 ; WX 1111.11 ; N circledottext ; B 56 -1000 1054 0 ;
+C 75 ; WX 1511.11 ; N circledotdisplay ; B 56 -1400 1454 0 ;
+C 76 ; WX 1111.11 ; N circleplustext ; B 56 -1000 1054 0 ;
+C 77 ; WX 1511.11 ; N circleplusdisplay ; B 56 -1400 1454 0 ;
+C 78 ; WX 1111.11 ; N circlemultiplytext ; B 56 -1000 1054 0 ;
+C 79 ; WX 1511.11 ; N circlemultiplydisplay ; B 56 -1400 1454 0 ;
+C 80 ; WX 1055.56 ; N summationtext ; B 56 -1000 999 0 ;
+C 81 ; WX 944.444 ; N producttext ; B 56 -1000 887 0 ;
+C 82 ; WX 472.222 ; N integraltext ; B 56 -1111 609 0 ;
+C 83 ; WX 833.333 ; N uniontext ; B 56 -1000 776 0 ;
+C 84 ; WX 833.333 ; N intersectiontext ; B 56 -1000 776 0 ;
+C 85 ; WX 833.333 ; N unionmultitext ; B 56 -1000 776 0 ;
+C 86 ; WX 833.333 ; N logicalandtext ; B 56 -1000 776 0 ;
+C 87 ; WX 833.333 ; N logicalortext ; B 56 -1000 776 0 ;
+C 88 ; WX 1444.44 ; N summationdisplay ; B 56 -1400 1387 0 ;
+C 89 ; WX 1277.78 ; N productdisplay ; B 56 -1400 1221 0 ;
+C 90 ; WX 555.556 ; N integraldisplay ; B 56 -2222 943 0 ;
+C 91 ; WX 1111.11 ; N uniondisplay ; B 56 -1400 1054 0 ;
+C 92 ; WX 1111.11 ; N intersectiondisplay ; B 56 -1400 1054 0 ;
+C 93 ; WX 1111.11 ; N unionmultidisplay ; B 56 -1400 1054 0 ;
+C 94 ; WX 1111.11 ; N logicalanddisplay ; B 56 -1400 1054 0 ;
+C 95 ; WX 1111.11 ; N logicalordisplay ; B 56 -1400 1054 0 ;
+C 96 ; WX 944.444 ; N coproducttext ; B 56 -1000 887 0 ;
+C 97 ; WX 1277.78 ; N coproductdisplay ; B 56 -1400 1221 0 ;
+C 98 ; WX 555.556 ; N hatwide ; B -5 562 561 744 ;
+C 99 ; WX 1000 ; N hatwider ; B -4 575 1003 772 ;
+C 100 ; WX 1444.44 ; N hatwidest ; B -3 575 1446 772 ;
+C 101 ; WX 555.556 ; N tildewide ; B 0 608 555 722 ;
+C 102 ; WX 1000 ; N tildewider ; B 0 624 999 750 ;
+C 103 ; WX 1444.44 ; N tildewidest ; B 0 623 1443 750 ;
+C 104 ; WX 472.222 ; N bracketleftBig ; B 226 -1759 453 40 ;
+C 105 ; WX 472.222 ; N bracketrightBig ; B 18 -1759 245 40 ;
+C 106 ; WX 527.778 ; N floorleftBig ; B 226 -1759 509 40 ;
+C 107 ; WX 527.778 ; N floorrightBig ; B 18 -1759 301 40 ;
+C 108 ; WX 527.778 ; N ceilingleftBig ; B 226 -1759 509 40 ;
+C 109 ; WX 527.778 ; N ceilingrightBig ; B 18 -1759 301 40 ;
+C 110 ; WX 666.667 ; N braceleftBig ; B 119 -1759 547 40 ;
+C 111 ; WX 666.667 ; N bracerightBig ; B 119 -1759 547 40 ;
+C 112 ; WX 1000 ; N radicalbig ; B 110 -1160 1020 40 ;
+C 113 ; WX 1000 ; N radicalBig ; B 110 -1760 1020 40 ;
+C 114 ; WX 1000 ; N radicalbigg ; B 111 -2360 1020 40 ;
+C 115 ; WX 1000 ; N radicalBigg ; B 111 -2960 1020 40 ;
+C 116 ; WX 1055.56 ; N radicalbt ; B 111 -1800 742 20 ;
+C 117 ; WX 1055.56 ; N radicalvertex ; B 702 -620 742 20 ;
+C 118 ; WX 1055.56 ; N radicaltp ; B 702 -580 1076 40 ;
+C 119 ; WX 777.778 ; N arrowvertexdbl ; B 257 -601 521 1 ;
+C 120 ; WX 666.667 ; N arrowtp ; B 111 -600 556 0 ;
+C 121 ; WX 666.667 ; N arrowbt ; B 111 -600 556 0 ;
+C 122 ; WX 450 ; N bracehtipdownleft ; B -24 -214 460 120 ;
+C 123 ; WX 450 ; N bracehtipdownright ; B -10 -214 474 120 ;
+C 124 ; WX 450 ; N bracehtipupleft ; B -24 0 460 334 ;
+C 125 ; WX 450 ; N bracehtipupright ; B -10 0 474 334 ;
+C 126 ; WX 777.778 ; N arrowdbltp ; B 56 -600 722 -1 ;
+C 127 ; WX 777.778 ; N arrowdblbt ; B 56 -599 722 0 ;
+C -1 ; WX 333.333 ; N space ; B 0 0 0 0 ;
+EndCharMetrics
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmmi10.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmmi10.afm
new file mode 100644
index 0000000..f47d6ba
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmmi10.afm
@@ -0,0 +1,326 @@
+StartFontMetrics 2.0
+Comment Creation Date: Thu Jun 21 22:23:22 1990
+Comment UniqueID 5000785
+FontName CMMI10
+EncodingScheme FontSpecific
+FullName CMMI10
+FamilyName Computer Modern
+Weight Medium
+ItalicAngle -14.04
+IsFixedPitch false
+Version 1.00A
+Notice Copyright (c) 1997 American Mathematical Society. All Rights Reserved.
+Comment Computer Modern fonts were designed by Donald E. Knuth
+FontBBox -32 -250 1048 750
+CapHeight 683.333
+XHeight 430.556
+Ascender 694.444
+Descender -194.444
+Comment FontID CMMI
+Comment DesignSize 10 (pts)
+Comment CharacterCodingScheme TeX math italic
+Comment Space 0 0 0
+Comment Quad 1000
+StartCharMetrics 129
+C 0 ; WX 615.276 ; N Gamma ; B 39 0 723 680 ;
+C 1 ; WX 833.333 ; N Delta ; B 49 0 787 716 ;
+C 2 ; WX 762.774 ; N Theta ; B 50 -22 739 705 ;
+C 3 ; WX 694.444 ; N Lambda ; B 35 0 666 716 ;
+C 4 ; WX 742.361 ; N Xi ; B 53 0 777 677 ;
+C 5 ; WX 831.25 ; N Pi ; B 39 0 880 680 ;
+C 6 ; WX 779.861 ; N Sigma ; B 59 0 807 683 ;
+C 7 ; WX 583.333 ; N Upsilon ; B 29 0 700 705 ;
+C 8 ; WX 666.667 ; N Phi ; B 24 0 642 683 ;
+C 9 ; WX 612.221 ; N Psi ; B 28 0 692 683 ;
+C 10 ; WX 772.396 ; N Omega ; B 80 0 785 705 ;
+C 11 ; WX 639.7 ; N alpha ; B 41 -11 601 442 ;
+C 12 ; WX 565.625 ; N beta ; B 25 -194 590 705 ;
+C 13 ; WX 517.73 ; N gamma ; B 18 -215 542 442 ;
+C 14 ; WX 444.444 ; N delta ; B 41 -12 452 705 ;
+C 15 ; WX 405.902 ; N epsilon1 ; B 47 -11 376 431 ;
+C 16 ; WX 437.5 ; N zeta ; B 47 -205 474 697 ;
+C 17 ; WX 496.53 ; N eta ; B 29 -216 496 442 ;
+C 18 ; WX 469.442 ; N theta ; B 42 -11 455 705 ;
+C 19 ; WX 353.935 ; N iota ; B 56 -11 324 442 ;
+C 20 ; WX 576.159 ; N kappa ; B 55 -11 546 442 ;
+C 21 ; WX 583.333 ; N lambda ; B 53 -13 547 694 ;
+C 22 ; WX 602.548 ; N mu ; B 30 -216 572 442 ;
+C 23 ; WX 493.981 ; N nu ; B 53 0 524 442 ;
+C 24 ; WX 437.5 ; N xi ; B 24 -205 446 697 ;
+C 25 ; WX 570.025 ; N pi ; B 27 -11 567 431 ;
+C 26 ; WX 517.014 ; N rho ; B 30 -216 502 442 ;
+C 27 ; WX 571.429 ; N sigma ; B 38 -11 567 431 ;
+C 28 ; WX 437.153 ; N tau ; B 27 -12 511 431 ;
+C 29 ; WX 540.278 ; N upsilon ; B 29 -11 524 443 ;
+C 30 ; WX 595.833 ; N phi ; B 49 -205 573 694 ;
+C 31 ; WX 625.691 ; N chi ; B 32 -205 594 442 ;
+C 32 ; WX 651.39 ; N psi ; B 29 -205 635 694 ;
+C 33 ; WX 622.453 ; N omega ; B 13 -11 605 443 ;
+C 34 ; WX 466.316 ; N epsilon ; B 27 -22 428 453 ;
+C 35 ; WX 591.438 ; N theta1 ; B 29 -11 561 705 ;
+C 36 ; WX 828.125 ; N pi1 ; B 27 -11 817 431 ;
+C 37 ; WX 517.014 ; N rho1 ; B 74 -194 502 442 ;
+C 38 ; WX 362.846 ; N sigma1 ; B 32 -108 408 442 ;
+C 39 ; WX 654.165 ; N phi1 ; B 50 -218 619 442 ;
+C 40 ; WX 1000 ; N arrowlefttophalf ; B 56 230 943 428 ;
+C 41 ; WX 1000 ; N arrowleftbothalf ; B 56 72 943 270 ;
+C 42 ; WX 1000 ; N arrowrighttophalf ; B 56 230 943 428 ;
+C 43 ; WX 1000 ; N arrowrightbothalf ; B 56 72 943 270 ;
+C 44 ; WX 277.778 ; N arrowhookleft ; B 56 230 221 464 ;
+C 45 ; WX 277.778 ; N arrowhookright ; B 56 230 221 464 ;
+C 46 ; WX 500 ; N triangleright ; B 27 -4 472 504 ;
+C 47 ; WX 500 ; N triangleleft ; B 27 -4 472 504 ;
+C 48 ; WX 500 ; N zerooldstyle ; B 40 -22 459 453 ;
+C 49 ; WX 500 ; N oneoldstyle ; B 92 0 418 453 ;
+C 50 ; WX 500 ; N twooldstyle ; B 44 0 449 453 ;
+C 51 ; WX 500 ; N threeoldstyle ; B 42 -216 457 453 ;
+C 52 ; WX 500 ; N fouroldstyle ; B 28 -194 471 464 ;
+C 53 ; WX 500 ; N fiveoldstyle ; B 50 -216 449 453 ;
+C 54 ; WX 500 ; N sixoldstyle ; B 42 -22 457 666 ;
+C 55 ; WX 500 ; N sevenoldstyle ; B 56 -216 485 463 ;
+C 56 ; WX 500 ; N eightoldstyle ; B 42 -22 457 666 ;
+C 57 ; WX 500 ; N nineoldstyle ; B 42 -216 457 453 ;
+C 58 ; WX 277.778 ; N period ; B 86 0 192 106 ;
+C 59 ; WX 277.778 ; N comma ; B 86 -193 203 106 ;
+C 60 ; WX 777.778 ; N less ; B 83 -39 694 539 ;
+C 61 ; WX 500 ; N slash ; B 56 -250 443 750 ;
+C 62 ; WX 777.778 ; N greater ; B 83 -39 694 539 ;
+C 63 ; WX 500 ; N star ; B 4 16 496 486 ;
+C 64 ; WX 530.902 ; N partialdiff ; B 40 -22 566 716 ;
+C 65 ; WX 750 ; N A ; B 35 0 722 716 ;
+C 66 ; WX 758.508 ; N B ; B 42 0 756 683 ;
+C 67 ; WX 714.72 ; N C ; B 51 -22 759 705 ;
+C 68 ; WX 827.915 ; N D ; B 41 0 803 683 ;
+C 69 ; WX 738.193 ; N E ; B 39 0 765 680 ;
+C 70 ; WX 643.055 ; N F ; B 39 0 751 680 ;
+C 71 ; WX 786.247 ; N G ; B 51 -22 760 705 ;
+C 72 ; WX 831.25 ; N H ; B 39 0 881 683 ;
+C 73 ; WX 439.583 ; N I ; B 34 0 498 683 ;
+C 74 ; WX 554.512 ; N J ; B 73 -22 633 683 ;
+C 75 ; WX 849.305 ; N K ; B 39 0 889 683 ;
+C 76 ; WX 680.556 ; N L ; B 39 0 643 683 ;
+C 77 ; WX 970.138 ; N M ; B 43 0 1044 683 ;
+C 78 ; WX 803.471 ; N N ; B 39 0 881 683 ;
+C 79 ; WX 762.774 ; N O ; B 50 -22 739 705 ;
+C 80 ; WX 642.012 ; N P ; B 41 0 753 683 ;
+C 81 ; WX 790.553 ; N Q ; B 50 -194 739 705 ;
+C 82 ; WX 759.288 ; N R ; B 41 -22 755 683 ;
+C 83 ; WX 613.193 ; N S ; B 53 -22 645 705 ;
+C 84 ; WX 584.375 ; N T ; B 24 0 704 677 ;
+C 85 ; WX 682.776 ; N U ; B 68 -22 760 683 ;
+C 86 ; WX 583.333 ; N V ; B 56 -22 769 683 ;
+C 87 ; WX 944.444 ; N W ; B 55 -22 1048 683 ;
+C 88 ; WX 828.472 ; N X ; B 27 0 851 683 ;
+C 89 ; WX 580.556 ; N Y ; B 34 0 762 683 ;
+C 90 ; WX 682.638 ; N Z ; B 59 0 722 683 ;
+C 91 ; WX 388.889 ; N flat ; B 56 -22 332 750 ;
+C 92 ; WX 388.889 ; N natural ; B 79 -217 309 728 ;
+C 93 ; WX 388.889 ; N sharp ; B 56 -216 332 716 ;
+C 94 ; WX 1000 ; N slurbelow ; B 56 133 943 371 ;
+C 95 ; WX 1000 ; N slurabove ; B 56 130 943 381 ;
+C 96 ; WX 416.667 ; N lscript ; B 11 -12 398 705 ;
+C 97 ; WX 528.588 ; N a ; B 40 -11 498 442 ;
+C 98 ; WX 429.165 ; N b ; B 47 -11 415 694 ;
+C 99 ; WX 432.755 ; N c ; B 41 -11 430 442 ;
+C 100 ; WX 520.486 ; N d ; B 40 -11 517 694 ;
+C 101 ; WX 465.625 ; N e ; B 46 -11 430 442 ;
+C 102 ; WX 489.583 ; N f ; B 53 -205 552 705 ;
+C 103 ; WX 476.967 ; N g ; B 16 -205 474 442 ;
+C 104 ; WX 576.159 ; N h ; B 55 -11 546 694 ;
+C 105 ; WX 344.511 ; N i ; B 29 -11 293 661 ;
+C 106 ; WX 411.805 ; N j ; B -13 -205 397 661 ;
+C 107 ; WX 520.602 ; N k ; B 55 -11 508 694 ;
+C 108 ; WX 298.378 ; N l ; B 46 -11 260 694 ;
+C 109 ; WX 878.012 ; N m ; B 29 -11 848 442 ;
+C 110 ; WX 600.233 ; N n ; B 29 -11 571 442 ;
+C 111 ; WX 484.721 ; N o ; B 41 -11 469 442 ;
+C 112 ; WX 503.125 ; N p ; B -32 -194 490 442 ;
+C 113 ; WX 446.412 ; N q ; B 40 -194 453 442 ;
+C 114 ; WX 451.158 ; N r ; B 29 -11 436 442 ;
+C 115 ; WX 468.75 ; N s ; B 52 -11 419 442 ;
+C 116 ; WX 361.111 ; N t ; B 23 -11 330 626 ;
+C 117 ; WX 572.456 ; N u ; B 29 -11 543 442 ;
+C 118 ; WX 484.722 ; N v ; B 29 -11 468 443 ;
+C 119 ; WX 715.916 ; N w ; B 29 -11 691 443 ;
+C 120 ; WX 571.527 ; N x ; B 29 -11 527 442 ;
+C 121 ; WX 490.28 ; N y ; B 29 -205 490 442 ;
+C 122 ; WX 465.048 ; N z ; B 43 -11 467 442 ;
+C 123 ; WX 322.454 ; N dotlessi ; B 29 -11 293 442 ;
+C 124 ; WX 384.028 ; N dotlessj ; B -13 -205 360 442 ;
+C 125 ; WX 636.457 ; N weierstrass ; B 76 -216 618 453 ;
+C 126 ; WX 500 ; N vector ; B 182 516 625 714 ;
+C 127 ; WX 277.778 ; N tie ; B 264 538 651 665 ;
+C -1 ; WX 333.333 ; N space ; B 0 0 0 0 ;
+EndCharMetrics
+Comment The following are bogus kern pairs for TeX positioning of accents
+StartKernData
+StartKernPairs 166
+KPX Gamma slash -55.556
+KPX Gamma comma -111.111
+KPX Gamma period -111.111
+KPX Gamma tie 83.333
+KPX Delta tie 166.667
+KPX Theta tie 83.333
+KPX Lambda tie 166.667
+KPX Xi tie 83.333
+KPX Pi slash -55.556
+KPX Pi comma -55.556
+KPX Pi period -55.556
+KPX Pi tie 55.556
+KPX Sigma tie 83.333
+KPX Upsilon slash -55.556
+KPX Upsilon comma -111.111
+KPX Upsilon period -111.111
+KPX Upsilon tie 55.556
+KPX Phi tie 83.333
+KPX Psi slash -55.556
+KPX Psi comma -55.556
+KPX Psi period -55.556
+KPX Psi tie 55.556
+KPX Omega tie 83.333
+KPX alpha tie 27.778
+KPX beta tie 83.333
+KPX delta comma -55.556
+KPX delta period -55.556
+KPX delta tie 55.556
+KPX epsilon1 tie 55.556
+KPX zeta tie 83.333
+KPX eta tie 55.556
+KPX theta tie 83.333
+KPX iota tie 55.556
+KPX mu tie 27.778
+KPX nu comma -55.556
+KPX nu period -55.556
+KPX nu tie 27.778
+KPX xi tie 111.111
+KPX rho tie 83.333
+KPX sigma comma -55.556
+KPX sigma period -55.556
+KPX tau comma -55.556
+KPX tau period -55.556
+KPX tau tie 27.778
+KPX upsilon tie 27.778
+KPX phi tie 83.333
+KPX chi tie 55.556
+KPX psi tie 111.111
+KPX epsilon tie 83.333
+KPX theta1 tie 83.333
+KPX rho1 tie 83.333
+KPX sigma1 tie 83.333
+KPX phi1 tie 83.333
+KPX slash Delta -55.556
+KPX slash A -55.556
+KPX slash M -55.556
+KPX slash N -55.556
+KPX slash Y 55.556
+KPX slash Z -55.556
+KPX partialdiff tie 83.333
+KPX A tie 138.889
+KPX B tie 83.333
+KPX C slash -27.778
+KPX C comma -55.556
+KPX C period -55.556
+KPX C tie 83.333
+KPX D tie 55.556
+KPX E tie 83.333
+KPX F slash -55.556
+KPX F comma -111.111
+KPX F period -111.111
+KPX F tie 83.333
+KPX G tie 83.333
+KPX H slash -55.556
+KPX H comma -55.556
+KPX H period -55.556
+KPX H tie 55.556
+KPX I tie 111.111
+KPX J slash -55.556
+KPX J comma -111.111
+KPX J period -111.111
+KPX J tie 166.667
+KPX K slash -55.556
+KPX K comma -55.556
+KPX K period -55.556
+KPX K tie 55.556
+KPX L tie 27.778
+KPX M slash -55.556
+KPX M comma -55.556
+KPX M period -55.556
+KPX M tie 83.333
+KPX N slash -83.333
+KPX N slash -27.778
+KPX N comma -55.556
+KPX N period -55.556
+KPX N tie 83.333
+KPX O tie 83.333
+KPX P slash -55.556
+KPX P comma -111.111
+KPX P period -111.111
+KPX P tie 83.333
+KPX Q tie 83.333
+KPX R tie 83.333
+KPX S slash -55.556
+KPX S comma -55.556
+KPX S period -55.556
+KPX S tie 83.333
+KPX T slash -27.778
+KPX T comma -55.556
+KPX T period -55.556
+KPX T tie 83.333
+KPX U comma -111.111
+KPX U period -111.111
+KPX U slash -55.556
+KPX U tie 27.778
+KPX V comma -166.667
+KPX V period -166.667
+KPX V slash -111.111
+KPX W comma -166.667
+KPX W period -166.667
+KPX W slash -111.111
+KPX X slash -83.333
+KPX X slash -27.778
+KPX X comma -55.556
+KPX X period -55.556
+KPX X tie 83.333
+KPX Y comma -166.667
+KPX Y period -166.667
+KPX Y slash -111.111
+KPX Z slash -55.556
+KPX Z comma -55.556
+KPX Z period -55.556
+KPX Z tie 83.333
+KPX lscript tie 111.111
+KPX c tie 55.556
+KPX d Y 55.556
+KPX d Z -55.556
+KPX d j -111.111
+KPX d f -166.667
+KPX d tie 166.667
+KPX e tie 55.556
+KPX f comma -55.556
+KPX f period -55.556
+KPX f tie 166.667
+KPX g tie 27.778
+KPX h tie -27.778
+KPX j comma -55.556
+KPX j period -55.556
+KPX l tie 83.333
+KPX o tie 55.556
+KPX p tie 83.333
+KPX q tie 83.333
+KPX r comma -55.556
+KPX r period -55.556
+KPX r tie 55.556
+KPX s tie 55.556
+KPX t tie 83.333
+KPX u tie 27.778
+KPX v tie 27.778
+KPX w tie 83.333
+KPX x tie 27.778
+KPX y tie 55.556
+KPX z tie 55.556
+KPX dotlessi tie 27.778
+KPX dotlessj tie 83.333
+KPX weierstrass tie 111.111
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmr10.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmr10.afm
new file mode 100644
index 0000000..4d586fe
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmr10.afm
@@ -0,0 +1,343 @@
+StartFontMetrics 2.0
+Comment Creation Date: Thu Jun 21 22:23:28 1990
+Comment UniqueID 5000793
+FontName CMR10
+EncodingScheme FontSpecific
+FullName CMR10
+FamilyName Computer Modern
+Weight Medium
+ItalicAngle 0.0
+IsFixedPitch false
+Version 1.00B
+Notice Copyright (c) 1997 American Mathematical Society. All Rights Reserved.
+Comment Computer Modern fonts were designed by Donald E. Knuth
+FontBBox -40 -250 1009 969
+CapHeight 683.333
+XHeight 430.556
+Ascender 694.444
+Descender -194.444
+Comment FontID CMR
+Comment DesignSize 10 (pts)
+Comment CharacterCodingScheme TeX text
+Comment Space 333.333 166.667 111.111
+Comment ExtraSpace 111.111
+Comment Quad 1000
+StartCharMetrics 129
+C 0 ; WX 625 ; N Gamma ; B 33 0 582 680 ;
+C 1 ; WX 833.333 ; N Delta ; B 47 0 785 716 ;
+C 2 ; WX 777.778 ; N Theta ; B 56 -22 721 705 ;
+C 3 ; WX 694.444 ; N Lambda ; B 32 0 661 716 ;
+C 4 ; WX 666.667 ; N Xi ; B 42 0 624 677 ;
+C 5 ; WX 750 ; N Pi ; B 33 0 716 680 ;
+C 6 ; WX 722.222 ; N Sigma ; B 56 0 665 683 ;
+C 7 ; WX 777.778 ; N Upsilon ; B 56 0 721 705 ;
+C 8 ; WX 722.222 ; N Phi ; B 56 0 665 683 ;
+C 9 ; WX 777.778 ; N Psi ; B 57 0 720 683 ;
+C 10 ; WX 722.222 ; N Omega ; B 44 0 677 705 ;
+C 11 ; WX 583.333 ; N ff ; B 27 0 628 705 ; L i ffi ; L l ffl ;
+C 12 ; WX 555.556 ; N fi ; B 27 0 527 705 ;
+C 13 ; WX 555.556 ; N fl ; B 27 0 527 705 ;
+C 14 ; WX 833.333 ; N ffi ; B 27 0 804 705 ;
+C 15 ; WX 833.333 ; N ffl ; B 27 0 804 705 ;
+C 16 ; WX 277.778 ; N dotlessi ; B 33 0 247 442 ;
+C 17 ; WX 305.556 ; N dotlessj ; B -40 -205 210 442 ;
+C 18 ; WX 500 ; N grave ; B 107 510 293 698 ;
+C 19 ; WX 500 ; N acute ; B 206 510 392 698 ;
+C 20 ; WX 500 ; N caron ; B 118 516 381 638 ;
+C 21 ; WX 500 ; N breve ; B 100 522 399 694 ;
+C 22 ; WX 500 ; N macron ; B 69 559 430 590 ;
+C 23 ; WX 750 ; N ring ; B 279 541 470 716 ;
+C 24 ; WX 444.444 ; N cedilla ; B 131 -203 367 -22 ;
+C 25 ; WX 500 ; N germandbls ; B 28 -11 471 705 ;
+C 26 ; WX 722.222 ; N ae ; B 45 -11 693 448 ;
+C 27 ; WX 777.778 ; N oe ; B 28 -11 749 448 ;
+C 28 ; WX 500 ; N oslash ; B 35 -102 464 534 ;
+C 29 ; WX 902.778 ; N AE ; B 32 0 874 683 ;
+C 30 ; WX 1013.89 ; N OE ; B 70 -22 985 705 ;
+C 31 ; WX 777.778 ; N Oslash ; B 56 -56 721 739 ;
+C 32 ; WX 277.778 ; N suppress ; B 27 280 262 392 ;
+C 33 ; WX 277.778 ; N exclam ; B 86 0 192 716 ; L quoteleft exclamdown ;
+C 34 ; WX 500 ; N quotedblright ; B 33 395 347 694 ;
+C 35 ; WX 833.333 ; N numbersign ; B 56 -194 776 694 ;
+C 36 ; WX 500 ; N dollar ; B 56 -56 443 750 ;
+C 37 ; WX 833.333 ; N percent ; B 56 -56 776 750 ;
+C 38 ; WX 777.778 ; N ampersand ; B 42 -22 727 716 ;
+C 39 ; WX 277.778 ; N quoteright ; B 86 395 206 694 ; L quoteright quotedblright ;
+C 40 ; WX 388.889 ; N parenleft ; B 99 -250 331 750 ;
+C 41 ; WX 388.889 ; N parenright ; B 57 -250 289 750 ;
+C 42 ; WX 500 ; N asterisk ; B 65 319 434 750 ;
+C 43 ; WX 777.778 ; N plus ; B 56 -83 721 583 ;
+C 44 ; WX 277.778 ; N comma ; B 86 -193 203 106 ;
+C 45 ; WX 333.333 ; N hyphen ; B 11 187 276 245 ; L hyphen endash ;
+C 46 ; WX 277.778 ; N period ; B 86 0 192 106 ;
+C 47 ; WX 500 ; N slash ; B 56 -250 443 750 ;
+C 48 ; WX 500 ; N zero ; B 39 -22 460 666 ;
+C 49 ; WX 500 ; N one ; B 89 0 419 666 ;
+C 50 ; WX 500 ; N two ; B 50 0 449 666 ;
+C 51 ; WX 500 ; N three ; B 42 -22 457 666 ;
+C 52 ; WX 500 ; N four ; B 28 0 471 677 ;
+C 53 ; WX 500 ; N five ; B 50 -22 449 666 ;
+C 54 ; WX 500 ; N six ; B 42 -22 457 666 ;
+C 55 ; WX 500 ; N seven ; B 56 -22 485 676 ;
+C 56 ; WX 500 ; N eight ; B 42 -22 457 666 ;
+C 57 ; WX 500 ; N nine ; B 42 -22 457 666 ;
+C 58 ; WX 277.778 ; N colon ; B 86 0 192 431 ;
+C 59 ; WX 277.778 ; N semicolon ; B 86 -193 195 431 ;
+C 60 ; WX 277.778 ; N exclamdown ; B 86 -216 192 500 ;
+C 61 ; WX 777.778 ; N equal ; B 56 133 721 367 ;
+C 62 ; WX 472.222 ; N questiondown ; B 56 -205 415 500 ;
+C 63 ; WX 472.222 ; N question ; B 56 0 415 705 ; L quoteleft questiondown ;
+C 64 ; WX 777.778 ; N at ; B 56 -11 721 705 ;
+C 65 ; WX 750 ; N A ; B 32 0 717 716 ;
+C 66 ; WX 708.333 ; N B ; B 36 0 651 683 ;
+C 67 ; WX 722.222 ; N C ; B 56 -22 665 705 ;
+C 68 ; WX 763.889 ; N D ; B 35 0 707 683 ;
+C 69 ; WX 680.556 ; N E ; B 33 0 652 680 ;
+C 70 ; WX 652.778 ; N F ; B 33 0 610 680 ;
+C 71 ; WX 784.722 ; N G ; B 56 -22 735 705 ;
+C 72 ; WX 750 ; N H ; B 33 0 716 683 ;
+C 73 ; WX 361.111 ; N I ; B 28 0 333 683 ;
+C 74 ; WX 513.889 ; N J ; B 41 -22 465 683 ;
+C 75 ; WX 777.778 ; N K ; B 33 0 736 683 ;
+C 76 ; WX 625 ; N L ; B 33 0 582 683 ;
+C 77 ; WX 916.667 ; N M ; B 37 0 879 683 ;
+C 78 ; WX 750 ; N N ; B 33 0 716 683 ;
+C 79 ; WX 777.778 ; N O ; B 56 -22 721 705 ;
+C 80 ; WX 680.556 ; N P ; B 35 0 624 683 ;
+C 81 ; WX 777.778 ; N Q ; B 56 -194 727 705 ;
+C 82 ; WX 736.111 ; N R ; B 35 -22 732 683 ;
+C 83 ; WX 555.556 ; N S ; B 56 -22 499 705 ;
+C 84 ; WX 722.222 ; N T ; B 36 0 685 677 ;
+C 85 ; WX 750 ; N U ; B 33 -22 716 683 ;
+C 86 ; WX 750 ; N V ; B 19 -22 730 683 ;
+C 87 ; WX 1027.78 ; N W ; B 18 -22 1009 683 ;
+C 88 ; WX 750 ; N X ; B 24 0 726 683 ;
+C 89 ; WX 750 ; N Y ; B 11 0 738 683 ;
+C 90 ; WX 611.111 ; N Z ; B 56 0 560 683 ;
+C 91 ; WX 277.778 ; N bracketleft ; B 118 -250 255 750 ;
+C 92 ; WX 500 ; N quotedblleft ; B 152 394 466 693 ;
+C 93 ; WX 277.778 ; N bracketright ; B 22 -250 159 750 ;
+C 94 ; WX 500 ; N circumflex ; B 116 540 383 694 ;
+C 95 ; WX 277.778 ; N dotaccent ; B 85 563 192 669 ;
+C 96 ; WX 277.778 ; N quoteleft ; B 72 394 192 693 ; L quoteleft quotedblleft ;
+C 97 ; WX 500 ; N a ; B 42 -11 493 448 ;
+C 98 ; WX 555.556 ; N b ; B 28 -11 521 694 ;
+C 99 ; WX 444.444 ; N c ; B 34 -11 415 448 ;
+C 100 ; WX 555.556 ; N d ; B 34 -11 527 694 ;
+C 101 ; WX 444.444 ; N e ; B 28 -11 415 448 ;
+C 102 ; WX 305.556 ; N f ; B 33 0 357 705 ; L i fi ; L f ff ; L l fl ;
+C 103 ; WX 500 ; N g ; B 28 -206 485 453 ;
+C 104 ; WX 555.556 ; N h ; B 32 0 535 694 ;
+C 105 ; WX 277.778 ; N i ; B 33 0 247 669 ;
+C 106 ; WX 305.556 ; N j ; B -40 -205 210 669 ;
+C 107 ; WX 527.778 ; N k ; B 28 0 511 694 ;
+C 108 ; WX 277.778 ; N l ; B 33 0 255 694 ;
+C 109 ; WX 833.333 ; N m ; B 32 0 813 442 ;
+C 110 ; WX 555.556 ; N n ; B 32 0 535 442 ;
+C 111 ; WX 500 ; N o ; B 28 -11 471 448 ;
+C 112 ; WX 555.556 ; N p ; B 28 -194 521 442 ;
+C 113 ; WX 527.778 ; N q ; B 34 -194 527 442 ;
+C 114 ; WX 391.667 ; N r ; B 28 0 364 442 ;
+C 115 ; WX 394.444 ; N s ; B 33 -11 360 448 ;
+C 116 ; WX 388.889 ; N t ; B 19 -11 332 615 ;
+C 117 ; WX 555.556 ; N u ; B 32 -11 535 442 ;
+C 118 ; WX 527.778 ; N v ; B 19 -11 508 431 ;
+C 119 ; WX 722.222 ; N w ; B 18 -11 703 431 ;
+C 120 ; WX 527.778 ; N x ; B 12 0 516 431 ;
+C 121 ; WX 527.778 ; N y ; B 19 -205 508 431 ;
+C 122 ; WX 444.444 ; N z ; B 28 0 401 431 ;
+C 123 ; WX 500 ; N endash ; B 0 255 499 277 ; L hyphen emdash ;
+C 124 ; WX 1000 ; N emdash ; B 0 255 999 277 ;
+C 125 ; WX 500 ; N hungarumlaut ; B 128 513 420 699 ;
+C 126 ; WX 500 ; N tilde ; B 83 575 416 668 ;
+C 127 ; WX 500 ; N dieresis ; B 103 569 396 669 ;
+C -1 ; WX 333.333 ; N space ; B 0 0 0 0 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 183
+KPX ff quoteright 77.778
+KPX ff question 77.778
+KPX ff exclam 77.778
+KPX ff parenright 77.778
+KPX ff bracketright 77.778
+KPX suppress l -277.778
+KPX suppress L -319.444
+KPX quoteright question 111.111
+KPX quoteright exclam 111.111
+KPX A t -27.778
+KPX A C -27.778
+KPX A O -27.778
+KPX A G -27.778
+KPX A U -27.778
+KPX A Q -27.778
+KPX A T -83.333
+KPX A Y -83.333
+KPX A V -111.111
+KPX A W -111.111
+KPX D X -27.778
+KPX D W -27.778
+KPX D A -27.778
+KPX D V -27.778
+KPX D Y -27.778
+KPX F o -83.333
+KPX F e -83.333
+KPX F u -83.333
+KPX F r -83.333
+KPX F a -83.333
+KPX F A -111.111
+KPX F O -27.778
+KPX F C -27.778
+KPX F G -27.778
+KPX F Q -27.778
+KPX I I 27.778
+KPX K O -27.778
+KPX K C -27.778
+KPX K G -27.778
+KPX K Q -27.778
+KPX L T -83.333
+KPX L Y -83.333
+KPX L V -111.111
+KPX L W -111.111
+KPX O X -27.778
+KPX O W -27.778
+KPX O A -27.778
+KPX O V -27.778
+KPX O Y -27.778
+KPX P A -83.333
+KPX P o -27.778
+KPX P e -27.778
+KPX P a -27.778
+KPX P period -83.333
+KPX P comma -83.333
+KPX R t -27.778
+KPX R C -27.778
+KPX R O -27.778
+KPX R G -27.778
+KPX R U -27.778
+KPX R Q -27.778
+KPX R T -83.333
+KPX R Y -83.333
+KPX R V -111.111
+KPX R W -111.111
+KPX T y -27.778
+KPX T e -83.333
+KPX T o -83.333
+KPX T r -83.333
+KPX T a -83.333
+KPX T A -83.333
+KPX T u -83.333
+KPX V o -83.333
+KPX V e -83.333
+KPX V u -83.333
+KPX V r -83.333
+KPX V a -83.333
+KPX V A -111.111
+KPX V O -27.778
+KPX V C -27.778
+KPX V G -27.778
+KPX V Q -27.778
+KPX W o -83.333
+KPX W e -83.333
+KPX W u -83.333
+KPX W r -83.333
+KPX W a -83.333
+KPX W A -111.111
+KPX W O -27.778
+KPX W C -27.778
+KPX W G -27.778
+KPX W Q -27.778
+KPX X O -27.778
+KPX X C -27.778
+KPX X G -27.778
+KPX X Q -27.778
+KPX Y e -83.333
+KPX Y o -83.333
+KPX Y r -83.333
+KPX Y a -83.333
+KPX Y A -83.333
+KPX Y u -83.333
+KPX a v -27.778
+KPX a j 55.556
+KPX a y -27.778
+KPX a w -27.778
+KPX b e 27.778
+KPX b o 27.778
+KPX b x -27.778
+KPX b d 27.778
+KPX b c 27.778
+KPX b q 27.778
+KPX b v -27.778
+KPX b j 55.556
+KPX b y -27.778
+KPX b w -27.778
+KPX c h -27.778
+KPX c k -27.778
+KPX f quoteright 77.778
+KPX f question 77.778
+KPX f exclam 77.778
+KPX f parenright 77.778
+KPX f bracketright 77.778
+KPX g j 27.778
+KPX h t -27.778
+KPX h u -27.778
+KPX h b -27.778
+KPX h y -27.778
+KPX h v -27.778
+KPX h w -27.778
+KPX k a -55.556
+KPX k e -27.778
+KPX k a -27.778
+KPX k o -27.778
+KPX k c -27.778
+KPX m t -27.778
+KPX m u -27.778
+KPX m b -27.778
+KPX m y -27.778
+KPX m v -27.778
+KPX m w -27.778
+KPX n t -27.778
+KPX n u -27.778
+KPX n b -27.778
+KPX n y -27.778
+KPX n v -27.778
+KPX n w -27.778
+KPX o e 27.778
+KPX o o 27.778
+KPX o x -27.778
+KPX o d 27.778
+KPX o c 27.778
+KPX o q 27.778
+KPX o v -27.778
+KPX o j 55.556
+KPX o y -27.778
+KPX o w -27.778
+KPX p e 27.778
+KPX p o 27.778
+KPX p x -27.778
+KPX p d 27.778
+KPX p c 27.778
+KPX p q 27.778
+KPX p v -27.778
+KPX p j 55.556
+KPX p y -27.778
+KPX p w -27.778
+KPX t y -27.778
+KPX t w -27.778
+KPX u w -27.778
+KPX v a -55.556
+KPX v e -27.778
+KPX v a -27.778
+KPX v o -27.778
+KPX v c -27.778
+KPX w e -27.778
+KPX w a -27.778
+KPX w o -27.778
+KPX w c -27.778
+KPX y o -27.778
+KPX y e -27.778
+KPX y a -27.778
+KPX y period -83.333
+KPX y comma -83.333
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmsy10.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmsy10.afm
new file mode 100644
index 0000000..09e9487
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmsy10.afm
@@ -0,0 +1,195 @@
+StartFontMetrics 2.0
+Comment Creation Date: Thu Jun 21 22:23:44 1990
+Comment UniqueID 5000820
+FontName CMSY10
+EncodingScheme FontSpecific
+FullName CMSY10
+FamilyName Computer Modern
+Weight Medium
+ItalicAngle -14.035
+IsFixedPitch false
+Version 1.00
+Notice Copyright (c) 1997 American Mathematical Society. All Rights Reserved.
+Comment Computer Modern fonts were designed by Donald E. Knuth
+FontBBox -29 -960 1116 775
+CapHeight 683.333
+XHeight 430.556
+Ascender 694.444
+Descender -960
+Comment FontID CMSY
+Comment DesignSize 10 (pts)
+Comment CharacterCodingScheme TeX math symbols
+Comment Space 0 0 0
+Comment ExtraSpace 0
+Comment Quad 1000
+Comment Num 676.508 393.732 443.731
+Comment Denom 685.951 344.841
+Comment Sup 412.892 362.892 288.889
+Comment Sub 150 247.217
+Comment Supdrop 386.108
+Comment Subdrop 50
+Comment Delim 2390 1010
+Comment Axisheight 250
+StartCharMetrics 129
+C 0 ; WX 777.778 ; N minus ; B 83 230 694 270 ;
+C 1 ; WX 277.778 ; N periodcentered ; B 86 197 192 303 ;
+C 2 ; WX 777.778 ; N multiply ; B 147 9 630 491 ;
+C 3 ; WX 500 ; N asteriskmath ; B 65 34 434 465 ;
+C 4 ; WX 777.778 ; N divide ; B 56 -30 722 530 ;
+C 5 ; WX 500 ; N diamondmath ; B 11 11 489 489 ;
+C 6 ; WX 777.778 ; N plusminus ; B 56 0 721 666 ;
+C 7 ; WX 777.778 ; N minusplus ; B 56 -166 721 500 ;
+C 8 ; WX 777.778 ; N circleplus ; B 56 -83 721 583 ;
+C 9 ; WX 777.778 ; N circleminus ; B 56 -83 721 583 ;
+C 10 ; WX 777.778 ; N circlemultiply ; B 56 -83 721 583 ;
+C 11 ; WX 777.778 ; N circledivide ; B 56 -83 721 583 ;
+C 12 ; WX 777.778 ; N circledot ; B 56 -83 721 583 ;
+C 13 ; WX 1000 ; N circlecopyrt ; B 56 -216 943 716 ;
+C 14 ; WX 500 ; N openbullet ; B 56 56 443 444 ;
+C 15 ; WX 500 ; N bullet ; B 56 56 443 444 ;
+C 16 ; WX 777.778 ; N equivasymptotic ; B 56 16 721 484 ;
+C 17 ; WX 777.778 ; N equivalence ; B 56 36 721 464 ;
+C 18 ; WX 777.778 ; N reflexsubset ; B 83 -137 694 636 ;
+C 19 ; WX 777.778 ; N reflexsuperset ; B 83 -137 694 636 ;
+C 20 ; WX 777.778 ; N lessequal ; B 83 -137 694 636 ;
+C 21 ; WX 777.778 ; N greaterequal ; B 83 -137 694 636 ;
+C 22 ; WX 777.778 ; N precedesequal ; B 83 -137 694 636 ;
+C 23 ; WX 777.778 ; N followsequal ; B 83 -137 694 636 ;
+C 24 ; WX 777.778 ; N similar ; B 56 133 721 367 ;
+C 25 ; WX 777.778 ; N approxequal ; B 56 56 721 483 ;
+C 26 ; WX 777.778 ; N propersubset ; B 83 -40 694 540 ;
+C 27 ; WX 777.778 ; N propersuperset ; B 83 -40 694 540 ;
+C 28 ; WX 1000 ; N lessmuch ; B 56 -66 943 566 ;
+C 29 ; WX 1000 ; N greatermuch ; B 56 -66 943 566 ;
+C 30 ; WX 777.778 ; N precedes ; B 83 -40 694 539 ;
+C 31 ; WX 777.778 ; N follows ; B 83 -40 694 539 ;
+C 32 ; WX 1000 ; N arrowleft ; B 57 72 943 428 ;
+C 33 ; WX 1000 ; N arrowright ; B 56 72 942 428 ;
+C 34 ; WX 500 ; N arrowup ; B 72 -194 428 693 ;
+C 35 ; WX 500 ; N arrowdown ; B 72 -193 428 694 ;
+C 36 ; WX 1000 ; N arrowboth ; B 57 72 942 428 ;
+C 37 ; WX 1000 ; N arrownortheast ; B 56 -193 946 697 ;
+C 38 ; WX 1000 ; N arrowsoutheast ; B 56 -197 946 693 ;
+C 39 ; WX 777.778 ; N similarequal ; B 56 36 721 464 ;
+C 40 ; WX 1000 ; N arrowdblleft ; B 57 -25 943 525 ;
+C 41 ; WX 1000 ; N arrowdblright ; B 56 -25 942 525 ;
+C 42 ; WX 611.111 ; N arrowdblup ; B 30 -194 580 694 ;
+C 43 ; WX 611.111 ; N arrowdbldown ; B 30 -194 580 694 ;
+C 44 ; WX 1000 ; N arrowdblboth ; B 35 -25 964 525 ;
+C 45 ; WX 1000 ; N arrownorthwest ; B 53 -193 943 697 ;
+C 46 ; WX 1000 ; N arrowsouthwest ; B 53 -197 943 693 ;
+C 47 ; WX 777.778 ; N proportional ; B 56 -11 722 442 ;
+C 48 ; WX 275 ; N prime ; B 29 45 262 559 ;
+C 49 ; WX 1000 ; N infinity ; B 56 -11 943 442 ;
+C 50 ; WX 666.667 ; N element ; B 83 -40 583 540 ;
+C 51 ; WX 666.667 ; N owner ; B 83 -40 583 540 ;
+C 52 ; WX 888.889 ; N triangle ; B 59 0 829 716 ;
+C 53 ; WX 888.889 ; N triangleinv ; B 59 -216 829 500 ;
+C 54 ; WX 0 ; N negationslash ; B 139 -216 638 716 ;
+C 55 ; WX 0 ; N mapsto ; B 56 64 124 436 ;
+C 56 ; WX 555.556 ; N universal ; B 0 -22 556 694 ;
+C 57 ; WX 555.556 ; N existential ; B 56 0 499 694 ;
+C 58 ; WX 666.667 ; N logicalnot ; B 56 89 610 356 ;
+C 59 ; WX 500 ; N emptyset ; B 47 -78 452 772 ;
+C 60 ; WX 722.222 ; N Rfractur ; B 46 -22 714 716 ;
+C 61 ; WX 722.222 ; N Ifractur ; B 56 -11 693 705 ;
+C 62 ; WX 777.778 ; N latticetop ; B 56 0 722 666 ;
+C 63 ; WX 777.778 ; N perpendicular ; B 56 0 722 666 ;
+C 64 ; WX 611.111 ; N aleph ; B 56 0 554 693 ;
+C 65 ; WX 798.469 ; N A ; B 27 -50 798 722 ;
+C 66 ; WX 656.808 ; N B ; B 30 -22 665 706 ;
+C 67 ; WX 526.527 ; N C ; B 12 -24 534 705 ;
+C 68 ; WX 771.391 ; N D ; B 20 0 766 683 ;
+C 69 ; WX 527.778 ; N E ; B 28 -22 565 705 ;
+C 70 ; WX 718.75 ; N F ; B 17 -33 829 683 ;
+C 71 ; WX 594.864 ; N G ; B 44 -119 601 705 ;
+C 72 ; WX 844.516 ; N H ; B 20 -47 818 683 ;
+C 73 ; WX 544.513 ; N I ; B -24 0 635 683 ;
+C 74 ; WX 677.778 ; N J ; B 47 -119 840 683 ;
+C 75 ; WX 761.949 ; N K ; B 30 -22 733 705 ;
+C 76 ; WX 689.723 ; N L ; B 31 -22 656 705 ;
+C 77 ; WX 1200.9 ; N M ; B 27 -50 1116 705 ;
+C 78 ; WX 820.489 ; N N ; B -29 -50 978 775 ;
+C 79 ; WX 796.112 ; N O ; B 57 -22 777 705 ;
+C 80 ; WX 695.558 ; N P ; B 20 -50 733 683 ;
+C 81 ; WX 816.667 ; N Q ; B 113 -124 788 705 ;
+C 82 ; WX 847.502 ; N R ; B 20 -22 837 683 ;
+C 83 ; WX 605.556 ; N S ; B 18 -22 642 705 ;
+C 84 ; WX 544.643 ; N T ; B 29 0 798 717 ;
+C 85 ; WX 625.83 ; N U ; B -17 -28 688 683 ;
+C 86 ; WX 612.781 ; N V ; B 35 -45 660 683 ;
+C 87 ; WX 987.782 ; N W ; B 35 -45 1036 683 ;
+C 88 ; WX 713.295 ; N X ; B 50 0 808 683 ;
+C 89 ; WX 668.335 ; N Y ; B 31 -135 717 683 ;
+C 90 ; WX 724.724 ; N Z ; B 37 0 767 683 ;
+C 91 ; WX 666.667 ; N union ; B 56 -22 610 598 ;
+C 92 ; WX 666.667 ; N intersection ; B 56 -22 610 598 ;
+C 93 ; WX 666.667 ; N unionmulti ; B 56 -22 610 598 ;
+C 94 ; WX 666.667 ; N logicaland ; B 56 -22 610 598 ;
+C 95 ; WX 666.667 ; N logicalor ; B 56 -22 610 598 ;
+C 96 ; WX 611.111 ; N turnstileleft ; B 56 0 554 694 ;
+C 97 ; WX 611.111 ; N turnstileright ; B 56 0 554 694 ;
+C 98 ; WX 444.444 ; N floorleft ; B 174 -250 422 750 ;
+C 99 ; WX 444.444 ; N floorright ; B 21 -250 269 750 ;
+C 100 ; WX 444.444 ; N ceilingleft ; B 174 -250 422 750 ;
+C 101 ; WX 444.444 ; N ceilingright ; B 21 -250 269 750 ;
+C 102 ; WX 500 ; N braceleft ; B 72 -250 427 750 ;
+C 103 ; WX 500 ; N braceright ; B 72 -250 427 750 ;
+C 104 ; WX 388.889 ; N angbracketleft ; B 110 -250 332 750 ;
+C 105 ; WX 388.889 ; N angbracketright ; B 56 -250 278 750 ;
+C 106 ; WX 277.778 ; N bar ; B 119 -250 159 750 ;
+C 107 ; WX 500 ; N bardbl ; B 132 -250 367 750 ;
+C 108 ; WX 500 ; N arrowbothv ; B 72 -272 428 772 ;
+C 109 ; WX 611.111 ; N arrowdblbothv ; B 30 -272 580 772 ;
+C 110 ; WX 500 ; N backslash ; B 56 -250 443 750 ;
+C 111 ; WX 277.778 ; N wreathproduct ; B 56 -83 221 583 ;
+C 112 ; WX 833.333 ; N radical ; B 73 -960 853 40 ;
+C 113 ; WX 750 ; N coproduct ; B 36 0 713 683 ;
+C 114 ; WX 833.333 ; N nabla ; B 47 -33 785 683 ;
+C 115 ; WX 416.667 ; N integral ; B 56 -216 471 716 ;
+C 116 ; WX 666.667 ; N unionsq ; B 61 0 605 598 ;
+C 117 ; WX 666.667 ; N intersectionsq ; B 61 0 605 598 ;
+C 118 ; WX 777.778 ; N subsetsqequal ; B 83 -137 714 636 ;
+C 119 ; WX 777.778 ; N supersetsqequal ; B 63 -137 694 636 ;
+C 120 ; WX 444.444 ; N section ; B 69 -205 374 705 ;
+C 121 ; WX 444.444 ; N dagger ; B 56 -216 387 705 ;
+C 122 ; WX 444.444 ; N daggerdbl ; B 56 -205 387 705 ;
+C 123 ; WX 611.111 ; N paragraph ; B 56 -194 582 694 ;
+C 124 ; WX 777.778 ; N club ; B 28 -130 750 727 ;
+C 125 ; WX 777.778 ; N diamond ; B 56 -163 722 727 ;
+C 126 ; WX 777.778 ; N heart ; B 56 -33 722 716 ;
+C 127 ; WX 777.778 ; N spade ; B 56 -130 722 727 ;
+C -1 ; WX 333.333 ; N space ; B 0 0 0 0 ;
+EndCharMetrics
+Comment The following are bogus kern pairs for TeX positioning of accents
+StartKernData
+StartKernPairs 26
+KPX A prime 194.444
+KPX B prime 138.889
+KPX C prime 138.889
+KPX D prime 83.333
+KPX E prime 111.111
+KPX F prime 111.111
+KPX G prime 111.111
+KPX H prime 111.111
+KPX I prime 27.778
+KPX J prime 166.667
+KPX K prime 55.556
+KPX L prime 138.889
+KPX M prime 138.889
+KPX N prime 83.333
+KPX O prime 111.111
+KPX P prime 83.333
+KPX Q prime 111.111
+KPX R prime 83.333
+KPX S prime 138.889
+KPX T prime 27.778
+KPX U prime 83.333
+KPX V prime 27.778
+KPX W prime 83.333
+KPX X prime 138.889
+KPX Y prime 83.333
+KPX Z prime 138.889
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmtt10.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmtt10.afm
new file mode 100644
index 0000000..d6ec19b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/cmtt10.afm
@@ -0,0 +1,156 @@
+StartFontMetrics 2.0
+Comment Creation Date: Thu Jun 21 22:23:51 1990
+Comment UniqueID 5000832
+FontName CMTT10
+EncodingScheme FontSpecific
+FullName CMTT10
+FamilyName Computer Modern
+Weight Medium
+ItalicAngle 0.0
+IsFixedPitch true
+Version 1.00B
+Notice Copyright (c) 1997 American Mathematical Society. All Rights Reserved.
+Comment Computer Modern fonts were designed by Donald E. Knuth
+FontBBox -4 -235 731 800
+CapHeight 611.111
+XHeight 430.556
+Ascender 611.111
+Descender -222.222
+Comment FontID CMTT
+Comment DesignSize 10 (pts)
+Comment CharacterCodingScheme TeX typewriter text
+Comment Space 525 0 0
+Comment ExtraSpace 525
+Comment Quad 1050
+StartCharMetrics 129
+C 0 ; WX 525 ; N Gamma ; B 32 0 488 611 ;
+C 1 ; WX 525 ; N Delta ; B 34 0 490 623 ;
+C 2 ; WX 525 ; N Theta ; B 56 -11 468 622 ;
+C 3 ; WX 525 ; N Lambda ; B 29 0 495 623 ;
+C 4 ; WX 525 ; N Xi ; B 33 0 491 611 ;
+C 5 ; WX 525 ; N Pi ; B 22 0 502 611 ;
+C 6 ; WX 525 ; N Sigma ; B 40 0 484 611 ;
+C 7 ; WX 525 ; N Upsilon ; B 38 0 486 622 ;
+C 8 ; WX 525 ; N Phi ; B 40 0 484 611 ;
+C 9 ; WX 525 ; N Psi ; B 38 0 486 611 ;
+C 10 ; WX 525 ; N Omega ; B 32 0 492 622 ;
+C 11 ; WX 525 ; N arrowup ; B 59 0 465 611 ;
+C 12 ; WX 525 ; N arrowdown ; B 59 0 465 611 ;
+C 13 ; WX 525 ; N quotesingle ; B 217 328 309 622 ;
+C 14 ; WX 525 ; N exclamdown ; B 212 -233 312 389 ;
+C 15 ; WX 525 ; N questiondown ; B 62 -228 462 389 ;
+C 16 ; WX 525 ; N dotlessi ; B 78 0 455 431 ;
+C 17 ; WX 525 ; N dotlessj ; B 48 -228 368 431 ;
+C 18 ; WX 525 ; N grave ; B 117 477 329 611 ;
+C 19 ; WX 525 ; N acute ; B 195 477 407 611 ;
+C 20 ; WX 525 ; N caron ; B 101 454 423 572 ;
+C 21 ; WX 525 ; N breve ; B 86 498 438 611 ;
+C 22 ; WX 525 ; N macron ; B 73 514 451 577 ;
+C 23 ; WX 525 ; N ring ; B 181 499 343 619 ;
+C 24 ; WX 525 ; N cedilla ; B 162 -208 428 45 ;
+C 25 ; WX 525 ; N germandbls ; B 17 -6 495 617 ;
+C 26 ; WX 525 ; N ae ; B 33 -6 504 440 ;
+C 27 ; WX 525 ; N oe ; B 19 -6 505 440 ;
+C 28 ; WX 525 ; N oslash ; B 43 -140 481 571 ;
+C 29 ; WX 525 ; N AE ; B 23 0 499 611 ;
+C 30 ; WX 525 ; N OE ; B 29 -11 502 622 ;
+C 31 ; WX 525 ; N Oslash ; B 56 -85 468 696 ;
+C 32 ; WX 525 ; N visiblespace ; B 44 -132 480 240 ;
+C 33 ; WX 525 ; N exclam ; B 212 0 312 622 ; L quoteleft exclamdown ;
+C 34 ; WX 525 ; N quotedbl ; B 126 328 398 622 ;
+C 35 ; WX 525 ; N numbersign ; B 35 0 489 611 ;
+C 36 ; WX 525 ; N dollar ; B 58 -83 466 694 ;
+C 37 ; WX 525 ; N percent ; B 35 -83 489 694 ;
+C 38 ; WX 525 ; N ampersand ; B 28 -11 490 622 ;
+C 39 ; WX 525 ; N quoteright ; B 180 302 341 611 ;
+C 40 ; WX 525 ; N parenleft ; B 173 -82 437 694 ;
+C 41 ; WX 525 ; N parenright ; B 88 -82 352 694 ;
+C 42 ; WX 525 ; N asterisk ; B 68 90 456 521 ;
+C 43 ; WX 525 ; N plus ; B 38 81 486 531 ;
+C 44 ; WX 525 ; N comma ; B 180 -139 346 125 ;
+C 45 ; WX 525 ; N hyphen ; B 56 271 468 341 ;
+C 46 ; WX 525 ; N period ; B 200 0 325 125 ;
+C 47 ; WX 525 ; N slash ; B 58 -83 466 694 ;
+C 48 ; WX 525 ; N zero ; B 50 -11 474 622 ;
+C 49 ; WX 525 ; N one ; B 105 0 442 622 ;
+C 50 ; WX 525 ; N two ; B 52 0 472 622 ;
+C 51 ; WX 525 ; N three ; B 44 -11 480 622 ;
+C 52 ; WX 525 ; N four ; B 29 0 495 623 ;
+C 53 ; WX 525 ; N five ; B 52 -11 472 611 ;
+C 54 ; WX 525 ; N six ; B 53 -11 471 622 ;
+C 55 ; WX 525 ; N seven ; B 44 -11 480 627 ;
+C 56 ; WX 525 ; N eight ; B 44 -11 480 622 ;
+C 57 ; WX 525 ; N nine ; B 53 -11 471 622 ;
+C 58 ; WX 525 ; N colon ; B 200 0 325 431 ;
+C 59 ; WX 525 ; N semicolon ; B 180 -139 330 431 ;
+C 60 ; WX 525 ; N less ; B 56 56 468 556 ;
+C 61 ; WX 525 ; N equal ; B 38 195 486 417 ;
+C 62 ; WX 525 ; N greater ; B 56 56 468 556 ;
+C 63 ; WX 525 ; N question ; B 62 0 462 617 ; L quoteleft questiondown ;
+C 64 ; WX 525 ; N at ; B 44 -6 480 617 ;
+C 65 ; WX 525 ; N A ; B 27 0 497 623 ;
+C 66 ; WX 525 ; N B ; B 23 0 482 611 ;
+C 67 ; WX 525 ; N C ; B 40 -11 484 622 ;
+C 68 ; WX 525 ; N D ; B 19 0 485 611 ;
+C 69 ; WX 525 ; N E ; B 26 0 502 611 ;
+C 70 ; WX 525 ; N F ; B 28 0 490 611 ;
+C 71 ; WX 525 ; N G ; B 38 -11 496 622 ;
+C 72 ; WX 525 ; N H ; B 22 0 502 611 ;
+C 73 ; WX 525 ; N I ; B 79 0 446 611 ;
+C 74 ; WX 525 ; N J ; B 71 -11 478 611 ;
+C 75 ; WX 525 ; N K ; B 26 0 495 611 ;
+C 76 ; WX 525 ; N L ; B 32 0 488 611 ;
+C 77 ; WX 525 ; N M ; B 17 0 507 611 ;
+C 78 ; WX 525 ; N N ; B 28 0 496 611 ;
+C 79 ; WX 525 ; N O ; B 56 -11 468 622 ;
+C 80 ; WX 525 ; N P ; B 26 0 480 611 ;
+C 81 ; WX 525 ; N Q ; B 56 -139 468 622 ;
+C 82 ; WX 525 ; N R ; B 22 -11 522 611 ;
+C 83 ; WX 525 ; N S ; B 52 -11 472 622 ;
+C 84 ; WX 525 ; N T ; B 26 0 498 611 ;
+C 85 ; WX 525 ; N U ; B 4 -11 520 611 ;
+C 86 ; WX 525 ; N V ; B 18 -8 506 611 ;
+C 87 ; WX 525 ; N W ; B 11 -8 513 611 ;
+C 88 ; WX 525 ; N X ; B 27 0 496 611 ;
+C 89 ; WX 525 ; N Y ; B 19 0 505 611 ;
+C 90 ; WX 525 ; N Z ; B 48 0 481 611 ;
+C 91 ; WX 525 ; N bracketleft ; B 222 -83 483 694 ;
+C 92 ; WX 525 ; N backslash ; B 58 -83 466 694 ;
+C 93 ; WX 525 ; N bracketright ; B 41 -83 302 694 ;
+C 94 ; WX 525 ; N asciicircum ; B 100 471 424 611 ;
+C 95 ; WX 525 ; N underscore ; B 56 -95 468 -25 ;
+C 96 ; WX 525 ; N quoteleft ; B 183 372 344 681 ;
+C 97 ; WX 525 ; N a ; B 55 -6 524 440 ;
+C 98 ; WX 525 ; N b ; B 12 -6 488 611 ;
+C 99 ; WX 525 ; N c ; B 73 -6 466 440 ;
+C 100 ; WX 525 ; N d ; B 36 -6 512 611 ;
+C 101 ; WX 525 ; N e ; B 55 -6 464 440 ;
+C 102 ; WX 525 ; N f ; B 42 0 437 617 ;
+C 103 ; WX 525 ; N g ; B 29 -229 509 442 ;
+C 104 ; WX 525 ; N h ; B 12 0 512 611 ;
+C 105 ; WX 525 ; N i ; B 78 0 455 612 ;
+C 106 ; WX 525 ; N j ; B 48 -228 368 612 ;
+C 107 ; WX 525 ; N k ; B 21 0 508 611 ;
+C 108 ; WX 525 ; N l ; B 58 0 467 611 ;
+C 109 ; WX 525 ; N m ; B -4 0 516 437 ;
+C 110 ; WX 525 ; N n ; B 12 0 512 437 ;
+C 111 ; WX 525 ; N o ; B 57 -6 467 440 ;
+C 112 ; WX 525 ; N p ; B 12 -222 488 437 ;
+C 113 ; WX 525 ; N q ; B 40 -222 537 437 ;
+C 114 ; WX 525 ; N r ; B 32 0 487 437 ;
+C 115 ; WX 525 ; N s ; B 72 -6 459 440 ;
+C 116 ; WX 525 ; N t ; B 25 -6 449 554 ;
+C 117 ; WX 525 ; N u ; B 12 -6 512 431 ;
+C 118 ; WX 525 ; N v ; B 24 -4 500 431 ;
+C 119 ; WX 525 ; N w ; B 16 -4 508 431 ;
+C 120 ; WX 525 ; N x ; B 27 0 496 431 ;
+C 121 ; WX 525 ; N y ; B 26 -228 500 431 ;
+C 122 ; WX 525 ; N z ; B 33 0 475 431 ;
+C 123 ; WX 525 ; N braceleft ; B 57 -83 467 694 ;
+C 124 ; WX 525 ; N bar ; B 227 -83 297 694 ;
+C 125 ; WX 525 ; N braceright ; B 57 -83 467 694 ;
+C 126 ; WX 525 ; N asciitilde ; B 87 491 437 611 ;
+C 127 ; WX 525 ; N dieresis ; B 110 512 414 612 ;
+C -1 ; WX 525 ; N space ; B 0 0 0 0 ;
+EndCharMetrics
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pagd8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pagd8a.afm
new file mode 100644
index 0000000..69eebba
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pagd8a.afm
@@ -0,0 +1,576 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990, 1991 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Mon Mar 4 13:46:34 1991
+Comment UniqueID 34370
+Comment VMusage 24954 31846
+FontName AvantGarde-Demi
+FullName ITC Avant Garde Gothic Demi
+FamilyName ITC Avant Garde Gothic
+Weight Demi
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -123 -251 1222 1021
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.007
+Notice Copyright (c) 1985, 1987, 1989, 1990, 1991 Adobe Systems Incorporated. All Rights Reserved.ITC Avant Garde Gothic is a registered trademark of International Typeface Corporation.
+EncodingScheme AdobeStandardEncoding
+CapHeight 740
+XHeight 555
+Ascender 740
+Descender -185
+StartCharMetrics 228
+C 32 ; WX 280 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 280 ; N exclam ; B 73 0 206 740 ;
+C 34 ; WX 360 ; N quotedbl ; B 19 444 341 740 ;
+C 35 ; WX 560 ; N numbersign ; B 29 0 525 700 ;
+C 36 ; WX 560 ; N dollar ; B 58 -86 501 857 ;
+C 37 ; WX 860 ; N percent ; B 36 -15 822 755 ;
+C 38 ; WX 680 ; N ampersand ; B 34 -15 665 755 ;
+C 39 ; WX 280 ; N quoteright ; B 72 466 205 740 ;
+C 40 ; WX 380 ; N parenleft ; B 74 -157 350 754 ;
+C 41 ; WX 380 ; N parenright ; B 37 -157 313 754 ;
+C 42 ; WX 440 ; N asterisk ; B 67 457 374 755 ;
+C 43 ; WX 600 ; N plus ; B 48 0 552 506 ;
+C 44 ; WX 280 ; N comma ; B 73 -141 206 133 ;
+C 45 ; WX 420 ; N hyphen ; B 71 230 349 348 ;
+C 46 ; WX 280 ; N period ; B 73 0 206 133 ;
+C 47 ; WX 460 ; N slash ; B 6 -100 454 740 ;
+C 48 ; WX 560 ; N zero ; B 32 -15 529 755 ;
+C 49 ; WX 560 ; N one ; B 137 0 363 740 ;
+C 50 ; WX 560 ; N two ; B 36 0 523 755 ;
+C 51 ; WX 560 ; N three ; B 28 -15 532 755 ;
+C 52 ; WX 560 ; N four ; B 15 0 545 740 ;
+C 53 ; WX 560 ; N five ; B 25 -15 535 740 ;
+C 54 ; WX 560 ; N six ; B 23 -15 536 739 ;
+C 55 ; WX 560 ; N seven ; B 62 0 498 740 ;
+C 56 ; WX 560 ; N eight ; B 33 -15 527 755 ;
+C 57 ; WX 560 ; N nine ; B 24 0 537 754 ;
+C 58 ; WX 280 ; N colon ; B 73 0 206 555 ;
+C 59 ; WX 280 ; N semicolon ; B 73 -141 206 555 ;
+C 60 ; WX 600 ; N less ; B 46 -8 554 514 ;
+C 61 ; WX 600 ; N equal ; B 48 81 552 425 ;
+C 62 ; WX 600 ; N greater ; B 46 -8 554 514 ;
+C 63 ; WX 560 ; N question ; B 38 0 491 755 ;
+C 64 ; WX 740 ; N at ; B 50 -12 750 712 ;
+C 65 ; WX 740 ; N A ; B 7 0 732 740 ;
+C 66 ; WX 580 ; N B ; B 70 0 551 740 ;
+C 67 ; WX 780 ; N C ; B 34 -15 766 755 ;
+C 68 ; WX 700 ; N D ; B 63 0 657 740 ;
+C 69 ; WX 520 ; N E ; B 61 0 459 740 ;
+C 70 ; WX 480 ; N F ; B 61 0 438 740 ;
+C 71 ; WX 840 ; N G ; B 27 -15 817 755 ;
+C 72 ; WX 680 ; N H ; B 71 0 610 740 ;
+C 73 ; WX 280 ; N I ; B 72 0 209 740 ;
+C 74 ; WX 480 ; N J ; B 2 -15 409 740 ;
+C 75 ; WX 620 ; N K ; B 89 0 620 740 ;
+C 76 ; WX 440 ; N L ; B 72 0 435 740 ;
+C 77 ; WX 900 ; N M ; B 63 0 837 740 ;
+C 78 ; WX 740 ; N N ; B 70 0 671 740 ;
+C 79 ; WX 840 ; N O ; B 33 -15 807 755 ;
+C 80 ; WX 560 ; N P ; B 72 0 545 740 ;
+C 81 ; WX 840 ; N Q ; B 32 -15 824 755 ;
+C 82 ; WX 580 ; N R ; B 64 0 565 740 ;
+C 83 ; WX 520 ; N S ; B 12 -15 493 755 ;
+C 84 ; WX 420 ; N T ; B 6 0 418 740 ;
+C 85 ; WX 640 ; N U ; B 55 -15 585 740 ;
+C 86 ; WX 700 ; N V ; B 8 0 695 740 ;
+C 87 ; WX 900 ; N W ; B 7 0 899 740 ;
+C 88 ; WX 680 ; N X ; B 4 0 676 740 ;
+C 89 ; WX 620 ; N Y ; B -2 0 622 740 ;
+C 90 ; WX 500 ; N Z ; B 19 0 481 740 ;
+C 91 ; WX 320 ; N bracketleft ; B 66 -157 284 754 ;
+C 92 ; WX 640 ; N backslash ; B 96 -100 544 740 ;
+C 93 ; WX 320 ; N bracketright ; B 36 -157 254 754 ;
+C 94 ; WX 600 ; N asciicircum ; B 73 375 527 740 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 280 ; N quoteleft ; B 72 466 205 740 ;
+C 97 ; WX 660 ; N a ; B 27 -18 613 574 ;
+C 98 ; WX 660 ; N b ; B 47 -18 632 740 ;
+C 99 ; WX 640 ; N c ; B 37 -18 610 574 ;
+C 100 ; WX 660 ; N d ; B 34 -18 618 740 ;
+C 101 ; WX 640 ; N e ; B 31 -18 610 577 ;
+C 102 ; WX 280 ; N f ; B 15 0 280 755 ; L i fi ; L l fl ;
+C 103 ; WX 660 ; N g ; B 32 -226 623 574 ;
+C 104 ; WX 600 ; N h ; B 54 0 546 740 ;
+C 105 ; WX 240 ; N i ; B 53 0 186 740 ;
+C 106 ; WX 260 ; N j ; B 16 -185 205 740 ;
+C 107 ; WX 580 ; N k ; B 80 0 571 740 ;
+C 108 ; WX 240 ; N l ; B 54 0 187 740 ;
+C 109 ; WX 940 ; N m ; B 54 0 887 574 ;
+C 110 ; WX 600 ; N n ; B 54 0 547 574 ;
+C 111 ; WX 640 ; N o ; B 25 -18 615 574 ;
+C 112 ; WX 660 ; N p ; B 47 -185 629 574 ;
+C 113 ; WX 660 ; N q ; B 31 -185 613 574 ;
+C 114 ; WX 320 ; N r ; B 63 0 317 574 ;
+C 115 ; WX 440 ; N s ; B 19 -18 421 574 ;
+C 116 ; WX 300 ; N t ; B 21 0 299 740 ;
+C 117 ; WX 600 ; N u ; B 50 -18 544 555 ;
+C 118 ; WX 560 ; N v ; B 3 0 556 555 ;
+C 119 ; WX 800 ; N w ; B 11 0 789 555 ;
+C 120 ; WX 560 ; N x ; B 3 0 556 555 ;
+C 121 ; WX 580 ; N y ; B 8 -185 571 555 ;
+C 122 ; WX 460 ; N z ; B 20 0 442 555 ;
+C 123 ; WX 340 ; N braceleft ; B -3 -191 317 747 ;
+C 124 ; WX 600 ; N bar ; B 233 -100 366 740 ;
+C 125 ; WX 340 ; N braceright ; B 23 -191 343 747 ;
+C 126 ; WX 600 ; N asciitilde ; B 67 160 533 347 ;
+C 161 ; WX 280 ; N exclamdown ; B 74 -185 207 555 ;
+C 162 ; WX 560 ; N cent ; B 43 39 517 715 ;
+C 163 ; WX 560 ; N sterling ; B -2 0 562 755 ;
+C 164 ; WX 160 ; N fraction ; B -123 0 282 740 ;
+C 165 ; WX 560 ; N yen ; B -10 0 570 740 ;
+C 166 ; WX 560 ; N florin ; B 0 -151 512 824 ;
+C 167 ; WX 560 ; N section ; B 28 -158 530 755 ;
+C 168 ; WX 560 ; N currency ; B 27 69 534 577 ;
+C 169 ; WX 220 ; N quotesingle ; B 44 444 177 740 ;
+C 170 ; WX 480 ; N quotedblleft ; B 70 466 410 740 ;
+C 171 ; WX 460 ; N guillemotleft ; B 61 108 400 469 ;
+C 172 ; WX 240 ; N guilsinglleft ; B 50 108 190 469 ;
+C 173 ; WX 240 ; N guilsinglright ; B 50 108 190 469 ;
+C 174 ; WX 520 ; N fi ; B 25 0 461 755 ;
+C 175 ; WX 520 ; N fl ; B 25 0 461 755 ;
+C 177 ; WX 500 ; N endash ; B 35 230 465 348 ;
+C 178 ; WX 560 ; N dagger ; B 51 -142 509 740 ;
+C 179 ; WX 560 ; N daggerdbl ; B 51 -142 509 740 ;
+C 180 ; WX 280 ; N periodcentered ; B 73 187 206 320 ;
+C 182 ; WX 600 ; N paragraph ; B -7 -103 607 740 ;
+C 183 ; WX 600 ; N bullet ; B 148 222 453 532 ;
+C 184 ; WX 280 ; N quotesinglbase ; B 72 -141 205 133 ;
+C 185 ; WX 480 ; N quotedblbase ; B 70 -141 410 133 ;
+C 186 ; WX 480 ; N quotedblright ; B 70 466 410 740 ;
+C 187 ; WX 460 ; N guillemotright ; B 61 108 400 469 ;
+C 188 ; WX 1000 ; N ellipsis ; B 100 0 899 133 ;
+C 189 ; WX 1280 ; N perthousand ; B 36 -15 1222 755 ;
+C 191 ; WX 560 ; N questiondown ; B 68 -200 521 555 ;
+C 193 ; WX 420 ; N grave ; B 50 624 329 851 ;
+C 194 ; WX 420 ; N acute ; B 91 624 370 849 ;
+C 195 ; WX 540 ; N circumflex ; B 71 636 470 774 ;
+C 196 ; WX 480 ; N tilde ; B 44 636 437 767 ;
+C 197 ; WX 420 ; N macron ; B 72 648 349 759 ;
+C 198 ; WX 480 ; N breve ; B 42 633 439 770 ;
+C 199 ; WX 280 ; N dotaccent ; B 74 636 207 769 ;
+C 200 ; WX 500 ; N dieresis ; B 78 636 422 769 ;
+C 202 ; WX 360 ; N ring ; B 73 619 288 834 ;
+C 203 ; WX 340 ; N cedilla ; B 98 -251 298 6 ;
+C 205 ; WX 700 ; N hungarumlaut ; B 132 610 609 862 ;
+C 206 ; WX 340 ; N ogonek ; B 79 -195 262 9 ;
+C 207 ; WX 540 ; N caron ; B 71 636 470 774 ;
+C 208 ; WX 1000 ; N emdash ; B 35 230 965 348 ;
+C 225 ; WX 900 ; N AE ; B -5 0 824 740 ;
+C 227 ; WX 360 ; N ordfeminine ; B 19 438 334 755 ;
+C 232 ; WX 480 ; N Lslash ; B 26 0 460 740 ;
+C 233 ; WX 840 ; N Oslash ; B 33 -71 807 814 ;
+C 234 ; WX 1060 ; N OE ; B 37 -15 1007 755 ;
+C 235 ; WX 360 ; N ordmasculine ; B 23 438 338 755 ;
+C 241 ; WX 1080 ; N ae ; B 29 -18 1048 574 ;
+C 245 ; WX 240 ; N dotlessi ; B 53 0 186 555 ;
+C 248 ; WX 320 ; N lslash ; B 34 0 305 740 ;
+C 249 ; WX 660 ; N oslash ; B 35 -50 625 608 ;
+C 250 ; WX 1080 ; N oe ; B 30 -18 1050 574 ;
+C 251 ; WX 600 ; N germandbls ; B 51 -18 585 755 ;
+C -1 ; WX 640 ; N ecircumflex ; B 31 -18 610 774 ;
+C -1 ; WX 640 ; N edieresis ; B 31 -18 610 769 ;
+C -1 ; WX 660 ; N aacute ; B 27 -18 613 849 ;
+C -1 ; WX 740 ; N registered ; B -12 -12 752 752 ;
+C -1 ; WX 240 ; N icircumflex ; B -79 0 320 774 ;
+C -1 ; WX 600 ; N udieresis ; B 50 -18 544 769 ;
+C -1 ; WX 640 ; N ograve ; B 25 -18 615 851 ;
+C -1 ; WX 600 ; N uacute ; B 50 -18 544 849 ;
+C -1 ; WX 600 ; N ucircumflex ; B 50 -18 544 774 ;
+C -1 ; WX 740 ; N Aacute ; B 7 0 732 1019 ;
+C -1 ; WX 240 ; N igrave ; B -65 0 214 851 ;
+C -1 ; WX 280 ; N Icircumflex ; B -59 0 340 944 ;
+C -1 ; WX 640 ; N ccedilla ; B 37 -251 610 574 ;
+C -1 ; WX 660 ; N adieresis ; B 27 -18 613 769 ;
+C -1 ; WX 520 ; N Ecircumflex ; B 61 0 460 944 ;
+C -1 ; WX 440 ; N scaron ; B 19 -18 421 774 ;
+C -1 ; WX 660 ; N thorn ; B 47 -185 629 740 ;
+C -1 ; WX 1000 ; N trademark ; B 9 296 821 740 ;
+C -1 ; WX 640 ; N egrave ; B 31 -18 610 851 ;
+C -1 ; WX 336 ; N threesuperior ; B 8 287 328 749 ;
+C -1 ; WX 460 ; N zcaron ; B 20 0 455 774 ;
+C -1 ; WX 660 ; N atilde ; B 27 -18 613 767 ;
+C -1 ; WX 660 ; N aring ; B 27 -18 613 834 ;
+C -1 ; WX 640 ; N ocircumflex ; B 25 -18 615 774 ;
+C -1 ; WX 520 ; N Edieresis ; B 61 0 459 939 ;
+C -1 ; WX 840 ; N threequarters ; B 18 0 803 749 ;
+C -1 ; WX 580 ; N ydieresis ; B 8 -185 571 769 ;
+C -1 ; WX 580 ; N yacute ; B 8 -185 571 849 ;
+C -1 ; WX 240 ; N iacute ; B 26 0 305 849 ;
+C -1 ; WX 740 ; N Acircumflex ; B 7 0 732 944 ;
+C -1 ; WX 640 ; N Uacute ; B 55 -15 585 1019 ;
+C -1 ; WX 640 ; N eacute ; B 31 -18 610 849 ;
+C -1 ; WX 840 ; N Ograve ; B 33 -15 807 1021 ;
+C -1 ; WX 660 ; N agrave ; B 27 -18 613 851 ;
+C -1 ; WX 640 ; N Udieresis ; B 55 -15 585 939 ;
+C -1 ; WX 660 ; N acircumflex ; B 27 -18 613 774 ;
+C -1 ; WX 280 ; N Igrave ; B -45 0 234 1021 ;
+C -1 ; WX 336 ; N twosuperior ; B 13 296 322 749 ;
+C -1 ; WX 640 ; N Ugrave ; B 55 -15 585 1021 ;
+C -1 ; WX 840 ; N onequarter ; B 92 0 746 740 ;
+C -1 ; WX 640 ; N Ucircumflex ; B 55 -15 585 944 ;
+C -1 ; WX 520 ; N Scaron ; B 12 -15 493 944 ;
+C -1 ; WX 280 ; N Idieresis ; B -32 0 312 939 ;
+C -1 ; WX 240 ; N idieresis ; B -52 0 292 769 ;
+C -1 ; WX 520 ; N Egrave ; B 61 0 459 1021 ;
+C -1 ; WX 840 ; N Oacute ; B 33 -15 807 1019 ;
+C -1 ; WX 600 ; N divide ; B 48 -20 552 526 ;
+C -1 ; WX 740 ; N Atilde ; B 7 0 732 937 ;
+C -1 ; WX 740 ; N Aring ; B 7 0 732 969 ;
+C -1 ; WX 840 ; N Odieresis ; B 33 -15 807 939 ;
+C -1 ; WX 740 ; N Adieresis ; B 7 0 732 939 ;
+C -1 ; WX 740 ; N Ntilde ; B 70 0 671 937 ;
+C -1 ; WX 500 ; N Zcaron ; B 19 0 481 944 ;
+C -1 ; WX 560 ; N Thorn ; B 72 0 545 740 ;
+C -1 ; WX 280 ; N Iacute ; B 46 0 325 1019 ;
+C -1 ; WX 600 ; N plusminus ; B 48 -62 552 556 ;
+C -1 ; WX 600 ; N multiply ; B 59 12 541 494 ;
+C -1 ; WX 520 ; N Eacute ; B 61 0 459 1019 ;
+C -1 ; WX 620 ; N Ydieresis ; B -2 0 622 939 ;
+C -1 ; WX 336 ; N onesuperior ; B 72 296 223 740 ;
+C -1 ; WX 600 ; N ugrave ; B 50 -18 544 851 ;
+C -1 ; WX 600 ; N logicalnot ; B 48 108 552 425 ;
+C -1 ; WX 600 ; N ntilde ; B 54 0 547 767 ;
+C -1 ; WX 840 ; N Otilde ; B 33 -15 807 937 ;
+C -1 ; WX 640 ; N otilde ; B 25 -18 615 767 ;
+C -1 ; WX 780 ; N Ccedilla ; B 34 -251 766 755 ;
+C -1 ; WX 740 ; N Agrave ; B 7 0 732 1021 ;
+C -1 ; WX 840 ; N onehalf ; B 62 0 771 740 ;
+C -1 ; WX 742 ; N Eth ; B 25 0 691 740 ;
+C -1 ; WX 400 ; N degree ; B 57 426 343 712 ;
+C -1 ; WX 620 ; N Yacute ; B -2 0 622 1019 ;
+C -1 ; WX 840 ; N Ocircumflex ; B 33 -15 807 944 ;
+C -1 ; WX 640 ; N oacute ; B 25 -18 615 849 ;
+C -1 ; WX 576 ; N mu ; B 38 -187 539 555 ;
+C -1 ; WX 600 ; N minus ; B 48 193 552 313 ;
+C -1 ; WX 640 ; N eth ; B 27 -18 616 754 ;
+C -1 ; WX 640 ; N odieresis ; B 25 -18 615 769 ;
+C -1 ; WX 740 ; N copyright ; B -12 -12 752 752 ;
+C -1 ; WX 600 ; N brokenbar ; B 233 -100 366 740 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 218
+
+KPX A y -50
+KPX A w -65
+KPX A v -70
+KPX A u -20
+KPX A quoteright -90
+KPX A Y -80
+KPX A W -60
+KPX A V -102
+KPX A U -40
+KPX A T -25
+KPX A Q -50
+KPX A O -50
+KPX A G -40
+KPX A C -40
+
+KPX B A -10
+
+KPX C A -40
+
+KPX D period -20
+KPX D comma -20
+KPX D Y -45
+KPX D W -25
+KPX D V -50
+KPX D A -50
+
+KPX F period -129
+KPX F e -20
+KPX F comma -162
+KPX F a -20
+KPX F A -75
+
+KPX G period -20
+KPX G comma -20
+KPX G Y -15
+
+KPX J period -15
+KPX J a -20
+KPX J A -30
+
+KPX K y -20
+KPX K u -15
+KPX K o -45
+KPX K e -40
+KPX K O -30
+
+KPX L y -23
+KPX L quoteright -30
+KPX L quotedblright -30
+KPX L Y -80
+KPX L W -55
+KPX L V -85
+KPX L T -46
+
+KPX O period -30
+KPX O comma -30
+KPX O Y -30
+KPX O X -30
+KPX O W -20
+KPX O V -45
+KPX O T -15
+KPX O A -60
+
+KPX P period -200
+KPX P o -20
+KPX P e -20
+KPX P comma -220
+KPX P a -20
+KPX P A -100
+
+KPX Q comma 20
+
+KPX R W 25
+KPX R V -10
+KPX R U 25
+KPX R T 40
+KPX R O 25
+
+KPX S comma 20
+
+KPX T y -10
+KPX T w -55
+KPX T u -46
+KPX T semicolon -29
+KPX T r -30
+KPX T period -91
+KPX T o -49
+KPX T hyphen -75
+KPX T e -49
+KPX T comma -82
+KPX T colon -15
+KPX T a -70
+KPX T O -15
+KPX T A -25
+
+KPX U period -20
+KPX U comma -20
+KPX U A -40
+
+KPX V u -55
+KPX V semicolon -33
+KPX V period -145
+KPX V o -101
+KPX V i -15
+KPX V hyphen -75
+KPX V e -101
+KPX V comma -145
+KPX V colon -18
+KPX V a -95
+KPX V O -45
+KPX V G -20
+KPX V A -102
+
+KPX W y -15
+KPX W u -30
+KPX W semicolon -33
+KPX W period -106
+KPX W o -46
+KPX W i -10
+KPX W hyphen -35
+KPX W e -47
+KPX W comma -106
+KPX W colon -15
+KPX W a -50
+KPX W O -20
+KPX W A -58
+
+KPX Y u -52
+KPX Y semicolon -23
+KPX Y period -145
+KPX Y o -89
+KPX Y hyphen -100
+KPX Y e -89
+KPX Y comma -145
+KPX Y colon -10
+KPX Y a -93
+KPX Y O -30
+KPX Y A -80
+
+KPX a t 5
+KPX a p 20
+KPX a b 5
+
+KPX b y -20
+KPX b v -20
+
+KPX c y -20
+KPX c l -15
+KPX c k -15
+
+KPX comma space -50
+KPX comma quoteright -70
+KPX comma quotedblright -70
+
+KPX e y -20
+KPX e x -20
+KPX e w -20
+KPX e v -20
+
+KPX f period -40
+KPX f o -20
+KPX f l -15
+KPX f i -15
+KPX f f -20
+KPX f dotlessi -15
+KPX f comma -40
+KPX f a -15
+
+KPX g i 25
+KPX g a 15
+
+KPX h y -30
+
+KPX k y -5
+KPX k o -30
+KPX k e -40
+
+KPX m y -20
+KPX m u -20
+
+KPX n y -15
+KPX n v -30
+
+KPX o y -20
+KPX o x -30
+KPX o w -20
+KPX o v -30
+
+KPX p y -20
+
+KPX period space -50
+KPX period quoteright -70
+KPX period quotedblright -70
+
+KPX quotedblleft A -50
+
+KPX quotedblright space -50
+
+KPX quoteleft quoteleft -80
+KPX quoteleft A -50
+
+KPX quoteright v -10
+KPX quoteright t 10
+KPX quoteright space -50
+KPX quoteright s -15
+KPX quoteright r -20
+KPX quoteright quoteright -80
+KPX quoteright d -50
+
+KPX r y 40
+KPX r v 40
+KPX r u 20
+KPX r t 20
+KPX r s 20
+KPX r q -8
+KPX r period -73
+KPX r p 20
+KPX r o -15
+KPX r n 21
+KPX r m 15
+KPX r l 20
+KPX r k 5
+KPX r i 20
+KPX r hyphen -60
+KPX r g 1
+KPX r e -4
+KPX r d -6
+KPX r comma -75
+KPX r c -7
+
+KPX s period 20
+KPX s comma 20
+
+KPX space quoteleft -50
+KPX space quotedblleft -50
+KPX space Y -60
+KPX space W -25
+KPX space V -80
+KPX space T -25
+KPX space A -20
+
+KPX v period -90
+KPX v o -20
+KPX v e -20
+KPX v comma -90
+KPX v a -30
+
+KPX w period -90
+KPX w o -30
+KPX w e -20
+KPX w comma -90
+KPX w a -30
+
+KPX x e -20
+
+KPX y period -100
+KPX y o -30
+KPX y e -20
+KPX y comma -100
+KPX y c -35
+KPX y a -30
+EndKernPairs
+EndKernData
+StartComposites 56
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 160 170 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 100 170 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 120 170 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 160 170 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 190 135 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 130 170 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 50 170 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex -10 170 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 10 170 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 50 170 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute -45 170 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -130 170 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -110 170 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave -95 170 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 130 170 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 210 170 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 150 170 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 170 170 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 210 170 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 180 170 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron -10 170 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 145 170 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 50 170 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 70 170 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 75 170 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 135 170 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 60 170 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 5 170 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 120 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 60 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 80 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 120 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 150 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 90 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 110 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 50 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 70 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 110 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -65 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -150 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -130 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -115 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 60 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 110 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 50 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 70 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 110 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 80 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron -50 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 125 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 30 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 50 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 55 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 115 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 40 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron -15 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pagdo8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pagdo8a.afm
new file mode 100644
index 0000000..c348b11
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pagdo8a.afm
@@ -0,0 +1,576 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990, 1991 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Mon Mar 4 13:49:44 1991
+Comment UniqueID 34373
+Comment VMusage 6550 39938
+FontName AvantGarde-DemiOblique
+FullName ITC Avant Garde Gothic Demi Oblique
+FamilyName ITC Avant Garde Gothic
+Weight Demi
+ItalicAngle -10.5
+IsFixedPitch false
+FontBBox -123 -251 1256 1021
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.007
+Notice Copyright (c) 1985, 1987, 1989, 1990, 1991 Adobe Systems Incorporated. All Rights Reserved.ITC Avant Garde Gothic is a registered trademark of International Typeface Corporation.
+EncodingScheme AdobeStandardEncoding
+CapHeight 740
+XHeight 555
+Ascender 740
+Descender -185
+StartCharMetrics 228
+C 32 ; WX 280 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 280 ; N exclam ; B 73 0 343 740 ;
+C 34 ; WX 360 ; N quotedbl ; B 127 444 478 740 ;
+C 35 ; WX 560 ; N numbersign ; B 66 0 618 700 ;
+C 36 ; WX 560 ; N dollar ; B 99 -86 582 857 ;
+C 37 ; WX 860 ; N percent ; B 139 -15 856 755 ;
+C 38 ; WX 680 ; N ampersand ; B 71 -15 742 755 ;
+C 39 ; WX 280 ; N quoteright ; B 159 466 342 740 ;
+C 40 ; WX 380 ; N parenleft ; B 120 -157 490 754 ;
+C 41 ; WX 380 ; N parenright ; B 8 -157 378 754 ;
+C 42 ; WX 440 ; N asterisk ; B 174 457 492 755 ;
+C 43 ; WX 600 ; N plus ; B 84 0 610 506 ;
+C 44 ; WX 280 ; N comma ; B 48 -141 231 133 ;
+C 45 ; WX 420 ; N hyphen ; B 114 230 413 348 ;
+C 46 ; WX 280 ; N period ; B 73 0 231 133 ;
+C 47 ; WX 460 ; N slash ; B -13 -100 591 740 ;
+C 48 ; WX 560 ; N zero ; B 70 -15 628 755 ;
+C 49 ; WX 560 ; N one ; B 230 0 500 740 ;
+C 50 ; WX 560 ; N two ; B 44 0 622 755 ;
+C 51 ; WX 560 ; N three ; B 67 -15 585 755 ;
+C 52 ; WX 560 ; N four ; B 36 0 604 740 ;
+C 53 ; WX 560 ; N five ; B 64 -15 600 740 ;
+C 54 ; WX 560 ; N six ; B 64 -15 587 739 ;
+C 55 ; WX 560 ; N seven ; B 83 0 635 740 ;
+C 56 ; WX 560 ; N eight ; B 71 -15 590 755 ;
+C 57 ; WX 560 ; N nine ; B 110 0 633 754 ;
+C 58 ; WX 280 ; N colon ; B 73 0 309 555 ;
+C 59 ; WX 280 ; N semicolon ; B 48 -141 309 555 ;
+C 60 ; WX 600 ; N less ; B 84 -8 649 514 ;
+C 61 ; WX 600 ; N equal ; B 63 81 631 425 ;
+C 62 ; WX 600 ; N greater ; B 45 -8 610 514 ;
+C 63 ; WX 560 ; N question ; B 135 0 593 755 ;
+C 64 ; WX 740 ; N at ; B 109 -12 832 712 ;
+C 65 ; WX 740 ; N A ; B 7 0 732 740 ;
+C 66 ; WX 580 ; N B ; B 70 0 610 740 ;
+C 67 ; WX 780 ; N C ; B 97 -15 864 755 ;
+C 68 ; WX 700 ; N D ; B 63 0 732 740 ;
+C 69 ; WX 520 ; N E ; B 61 0 596 740 ;
+C 70 ; WX 480 ; N F ; B 61 0 575 740 ;
+C 71 ; WX 840 ; N G ; B 89 -15 887 755 ;
+C 72 ; WX 680 ; N H ; B 71 0 747 740 ;
+C 73 ; WX 280 ; N I ; B 72 0 346 740 ;
+C 74 ; WX 480 ; N J ; B 34 -15 546 740 ;
+C 75 ; WX 620 ; N K ; B 89 0 757 740 ;
+C 76 ; WX 440 ; N L ; B 72 0 459 740 ;
+C 77 ; WX 900 ; N M ; B 63 0 974 740 ;
+C 78 ; WX 740 ; N N ; B 70 0 808 740 ;
+C 79 ; WX 840 ; N O ; B 95 -15 882 755 ;
+C 80 ; WX 560 ; N P ; B 72 0 645 740 ;
+C 81 ; WX 840 ; N Q ; B 94 -15 882 755 ;
+C 82 ; WX 580 ; N R ; B 64 0 656 740 ;
+C 83 ; WX 520 ; N S ; B 49 -15 578 755 ;
+C 84 ; WX 420 ; N T ; B 119 0 555 740 ;
+C 85 ; WX 640 ; N U ; B 97 -15 722 740 ;
+C 86 ; WX 700 ; N V ; B 145 0 832 740 ;
+C 87 ; WX 900 ; N W ; B 144 0 1036 740 ;
+C 88 ; WX 680 ; N X ; B 4 0 813 740 ;
+C 89 ; WX 620 ; N Y ; B 135 0 759 740 ;
+C 90 ; WX 500 ; N Z ; B 19 0 599 740 ;
+C 91 ; WX 320 ; N bracketleft ; B 89 -157 424 754 ;
+C 92 ; WX 640 ; N backslash ; B 233 -100 525 740 ;
+C 93 ; WX 320 ; N bracketright ; B 7 -157 342 754 ;
+C 94 ; WX 600 ; N asciicircum ; B 142 375 596 740 ;
+C 95 ; WX 500 ; N underscore ; B -23 -125 486 -75 ;
+C 96 ; WX 280 ; N quoteleft ; B 158 466 341 740 ;
+C 97 ; WX 660 ; N a ; B 73 -18 716 574 ;
+C 98 ; WX 660 ; N b ; B 47 -18 689 740 ;
+C 99 ; WX 640 ; N c ; B 84 -18 679 574 ;
+C 100 ; WX 660 ; N d ; B 80 -18 755 740 ;
+C 101 ; WX 640 ; N e ; B 77 -18 667 577 ;
+C 102 ; WX 280 ; N f ; B 62 0 420 755 ; L i fi ; L l fl ;
+C 103 ; WX 660 ; N g ; B 33 -226 726 574 ;
+C 104 ; WX 600 ; N h ; B 54 0 614 740 ;
+C 105 ; WX 240 ; N i ; B 53 0 323 740 ;
+C 106 ; WX 260 ; N j ; B -18 -185 342 740 ;
+C 107 ; WX 580 ; N k ; B 80 0 648 740 ;
+C 108 ; WX 240 ; N l ; B 54 0 324 740 ;
+C 109 ; WX 940 ; N m ; B 54 0 954 574 ;
+C 110 ; WX 600 ; N n ; B 54 0 613 574 ;
+C 111 ; WX 640 ; N o ; B 71 -18 672 574 ;
+C 112 ; WX 660 ; N p ; B 13 -185 686 574 ;
+C 113 ; WX 660 ; N q ; B 78 -185 716 574 ;
+C 114 ; WX 320 ; N r ; B 63 0 423 574 ;
+C 115 ; WX 440 ; N s ; B 49 -18 483 574 ;
+C 116 ; WX 300 ; N t ; B 86 0 402 740 ;
+C 117 ; WX 600 ; N u ; B 87 -18 647 555 ;
+C 118 ; WX 560 ; N v ; B 106 0 659 555 ;
+C 119 ; WX 800 ; N w ; B 114 0 892 555 ;
+C 120 ; WX 560 ; N x ; B 3 0 632 555 ;
+C 121 ; WX 580 ; N y ; B 75 -185 674 555 ;
+C 122 ; WX 460 ; N z ; B 20 0 528 555 ;
+C 123 ; WX 340 ; N braceleft ; B 40 -191 455 747 ;
+C 124 ; WX 600 ; N bar ; B 214 -100 503 740 ;
+C 125 ; WX 340 ; N braceright ; B -12 -191 405 747 ;
+C 126 ; WX 600 ; N asciitilde ; B 114 160 579 347 ;
+C 161 ; WX 280 ; N exclamdown ; B 40 -185 310 555 ;
+C 162 ; WX 560 ; N cent ; B 110 39 599 715 ;
+C 163 ; WX 560 ; N sterling ; B 38 0 615 755 ;
+C 164 ; WX 160 ; N fraction ; B -123 0 419 740 ;
+C 165 ; WX 560 ; N yen ; B 83 0 707 740 ;
+C 166 ; WX 560 ; N florin ; B -27 -151 664 824 ;
+C 167 ; WX 560 ; N section ; B 65 -158 602 755 ;
+C 168 ; WX 560 ; N currency ; B 53 69 628 577 ;
+C 169 ; WX 220 ; N quotesingle ; B 152 444 314 740 ;
+C 170 ; WX 480 ; N quotedblleft ; B 156 466 546 740 ;
+C 171 ; WX 460 ; N guillemotleft ; B 105 108 487 469 ;
+C 172 ; WX 240 ; N guilsinglleft ; B 94 108 277 469 ;
+C 173 ; WX 240 ; N guilsinglright ; B 70 108 253 469 ;
+C 174 ; WX 520 ; N fi ; B 72 0 598 755 ;
+C 175 ; WX 520 ; N fl ; B 72 0 598 755 ;
+C 177 ; WX 500 ; N endash ; B 78 230 529 348 ;
+C 178 ; WX 560 ; N dagger ; B 133 -142 612 740 ;
+C 179 ; WX 560 ; N daggerdbl ; B 63 -142 618 740 ;
+C 180 ; WX 280 ; N periodcentered ; B 108 187 265 320 ;
+C 182 ; WX 600 ; N paragraph ; B 90 -103 744 740 ;
+C 183 ; WX 600 ; N bullet ; B 215 222 526 532 ;
+C 184 ; WX 280 ; N quotesinglbase ; B 47 -141 230 133 ;
+C 185 ; WX 480 ; N quotedblbase ; B 45 -141 435 133 ;
+C 186 ; WX 480 ; N quotedblright ; B 157 466 547 740 ;
+C 187 ; WX 460 ; N guillemotright ; B 81 108 463 469 ;
+C 188 ; WX 1000 ; N ellipsis ; B 100 0 924 133 ;
+C 189 ; WX 1280 ; N perthousand ; B 139 -15 1256 755 ;
+C 191 ; WX 560 ; N questiondown ; B 69 -200 527 555 ;
+C 193 ; WX 420 ; N grave ; B 189 624 462 851 ;
+C 194 ; WX 420 ; N acute ; B 224 624 508 849 ;
+C 195 ; WX 540 ; N circumflex ; B 189 636 588 774 ;
+C 196 ; WX 480 ; N tilde ; B 178 636 564 767 ;
+C 197 ; WX 420 ; N macron ; B 192 648 490 759 ;
+C 198 ; WX 480 ; N breve ; B 185 633 582 770 ;
+C 199 ; WX 280 ; N dotaccent ; B 192 636 350 769 ;
+C 200 ; WX 500 ; N dieresis ; B 196 636 565 769 ;
+C 202 ; WX 360 ; N ring ; B 206 619 424 834 ;
+C 203 ; WX 340 ; N cedilla ; B 67 -251 272 6 ;
+C 205 ; WX 700 ; N hungarumlaut ; B 258 610 754 862 ;
+C 206 ; WX 340 ; N ogonek ; B 59 -195 243 9 ;
+C 207 ; WX 540 ; N caron ; B 214 636 613 774 ;
+C 208 ; WX 1000 ; N emdash ; B 78 230 1029 348 ;
+C 225 ; WX 900 ; N AE ; B -5 0 961 740 ;
+C 227 ; WX 360 ; N ordfeminine ; B 127 438 472 755 ;
+C 232 ; WX 480 ; N Lslash ; B 68 0 484 740 ;
+C 233 ; WX 840 ; N Oslash ; B 94 -71 891 814 ;
+C 234 ; WX 1060 ; N OE ; B 98 -15 1144 755 ;
+C 235 ; WX 360 ; N ordmasculine ; B 131 438 451 755 ;
+C 241 ; WX 1080 ; N ae ; B 75 -18 1105 574 ;
+C 245 ; WX 240 ; N dotlessi ; B 53 0 289 555 ;
+C 248 ; WX 320 ; N lslash ; B 74 0 404 740 ;
+C 249 ; WX 660 ; N oslash ; B 81 -50 685 608 ;
+C 250 ; WX 1080 ; N oe ; B 76 -18 1108 574 ;
+C 251 ; WX 600 ; N germandbls ; B 51 -18 629 755 ;
+C -1 ; WX 640 ; N ecircumflex ; B 77 -18 667 774 ;
+C -1 ; WX 640 ; N edieresis ; B 77 -18 667 769 ;
+C -1 ; WX 660 ; N aacute ; B 73 -18 716 849 ;
+C -1 ; WX 740 ; N registered ; B 50 -12 827 752 ;
+C -1 ; WX 240 ; N icircumflex ; B 39 0 438 774 ;
+C -1 ; WX 600 ; N udieresis ; B 87 -18 647 769 ;
+C -1 ; WX 640 ; N ograve ; B 71 -18 672 851 ;
+C -1 ; WX 600 ; N uacute ; B 87 -18 647 849 ;
+C -1 ; WX 600 ; N ucircumflex ; B 87 -18 647 774 ;
+C -1 ; WX 740 ; N Aacute ; B 7 0 732 1019 ;
+C -1 ; WX 240 ; N igrave ; B 53 0 347 851 ;
+C -1 ; WX 280 ; N Icircumflex ; B 72 0 489 944 ;
+C -1 ; WX 640 ; N ccedilla ; B 83 -251 679 574 ;
+C -1 ; WX 660 ; N adieresis ; B 73 -18 716 769 ;
+C -1 ; WX 520 ; N Ecircumflex ; B 61 0 609 944 ;
+C -1 ; WX 440 ; N scaron ; B 49 -18 563 774 ;
+C -1 ; WX 660 ; N thorn ; B 13 -185 686 740 ;
+C -1 ; WX 1000 ; N trademark ; B 131 296 958 740 ;
+C -1 ; WX 640 ; N egrave ; B 77 -18 667 851 ;
+C -1 ; WX 336 ; N threesuperior ; B 87 287 413 749 ;
+C -1 ; WX 460 ; N zcaron ; B 20 0 598 774 ;
+C -1 ; WX 660 ; N atilde ; B 73 -18 716 767 ;
+C -1 ; WX 660 ; N aring ; B 73 -18 716 834 ;
+C -1 ; WX 640 ; N ocircumflex ; B 71 -18 672 774 ;
+C -1 ; WX 520 ; N Edieresis ; B 61 0 606 939 ;
+C -1 ; WX 840 ; N threequarters ; B 97 0 836 749 ;
+C -1 ; WX 580 ; N ydieresis ; B 75 -185 674 769 ;
+C -1 ; WX 580 ; N yacute ; B 75 -185 674 849 ;
+C -1 ; WX 240 ; N iacute ; B 53 0 443 849 ;
+C -1 ; WX 740 ; N Acircumflex ; B 7 0 732 944 ;
+C -1 ; WX 640 ; N Uacute ; B 97 -15 722 1019 ;
+C -1 ; WX 640 ; N eacute ; B 77 -18 667 849 ;
+C -1 ; WX 840 ; N Ograve ; B 95 -15 882 1021 ;
+C -1 ; WX 660 ; N agrave ; B 73 -18 716 851 ;
+C -1 ; WX 640 ; N Udieresis ; B 97 -15 722 939 ;
+C -1 ; WX 660 ; N acircumflex ; B 73 -18 716 774 ;
+C -1 ; WX 280 ; N Igrave ; B 72 0 398 1021 ;
+C -1 ; WX 336 ; N twosuperior ; B 73 296 436 749 ;
+C -1 ; WX 640 ; N Ugrave ; B 97 -15 722 1021 ;
+C -1 ; WX 840 ; N onequarter ; B 187 0 779 740 ;
+C -1 ; WX 640 ; N Ucircumflex ; B 97 -15 722 944 ;
+C -1 ; WX 520 ; N Scaron ; B 49 -15 635 944 ;
+C -1 ; WX 280 ; N Idieresis ; B 72 0 486 939 ;
+C -1 ; WX 240 ; N idieresis ; B 53 0 435 769 ;
+C -1 ; WX 520 ; N Egrave ; B 61 0 596 1021 ;
+C -1 ; WX 840 ; N Oacute ; B 95 -15 882 1019 ;
+C -1 ; WX 600 ; N divide ; B 84 -20 610 526 ;
+C -1 ; WX 740 ; N Atilde ; B 7 0 732 937 ;
+C -1 ; WX 740 ; N Aring ; B 7 0 732 969 ;
+C -1 ; WX 840 ; N Odieresis ; B 95 -15 882 939 ;
+C -1 ; WX 740 ; N Adieresis ; B 7 0 732 939 ;
+C -1 ; WX 740 ; N Ntilde ; B 70 0 808 937 ;
+C -1 ; WX 500 ; N Zcaron ; B 19 0 650 944 ;
+C -1 ; WX 560 ; N Thorn ; B 72 0 619 740 ;
+C -1 ; WX 280 ; N Iacute ; B 72 0 494 1019 ;
+C -1 ; WX 600 ; N plusminus ; B 37 -62 626 556 ;
+C -1 ; WX 600 ; N multiply ; B 76 12 617 494 ;
+C -1 ; WX 520 ; N Eacute ; B 61 0 596 1019 ;
+C -1 ; WX 620 ; N Ydieresis ; B 135 0 759 939 ;
+C -1 ; WX 336 ; N onesuperior ; B 182 296 360 740 ;
+C -1 ; WX 600 ; N ugrave ; B 87 -18 647 851 ;
+C -1 ; WX 600 ; N logicalnot ; B 105 108 631 425 ;
+C -1 ; WX 600 ; N ntilde ; B 54 0 624 767 ;
+C -1 ; WX 840 ; N Otilde ; B 95 -15 882 937 ;
+C -1 ; WX 640 ; N otilde ; B 71 -18 672 767 ;
+C -1 ; WX 780 ; N Ccedilla ; B 97 -251 864 755 ;
+C -1 ; WX 740 ; N Agrave ; B 7 0 732 1021 ;
+C -1 ; WX 840 ; N onehalf ; B 157 0 830 740 ;
+C -1 ; WX 742 ; N Eth ; B 83 0 766 740 ;
+C -1 ; WX 400 ; N degree ; B 160 426 451 712 ;
+C -1 ; WX 620 ; N Yacute ; B 135 0 759 1019 ;
+C -1 ; WX 840 ; N Ocircumflex ; B 95 -15 882 944 ;
+C -1 ; WX 640 ; N oacute ; B 71 -18 672 849 ;
+C -1 ; WX 576 ; N mu ; B 3 -187 642 555 ;
+C -1 ; WX 600 ; N minus ; B 84 193 610 313 ;
+C -1 ; WX 640 ; N eth ; B 73 -18 699 754 ;
+C -1 ; WX 640 ; N odieresis ; B 71 -18 672 769 ;
+C -1 ; WX 740 ; N copyright ; B 50 -12 827 752 ;
+C -1 ; WX 600 ; N brokenbar ; B 214 -100 503 740 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 218
+
+KPX A y -50
+KPX A w -65
+KPX A v -70
+KPX A u -20
+KPX A quoteright -90
+KPX A Y -80
+KPX A W -60
+KPX A V -102
+KPX A U -40
+KPX A T -25
+KPX A Q -50
+KPX A O -50
+KPX A G -40
+KPX A C -40
+
+KPX B A -10
+
+KPX C A -40
+
+KPX D period -20
+KPX D comma -20
+KPX D Y -45
+KPX D W -25
+KPX D V -50
+KPX D A -50
+
+KPX F period -129
+KPX F e -20
+KPX F comma -162
+KPX F a -20
+KPX F A -75
+
+KPX G period -20
+KPX G comma -20
+KPX G Y -15
+
+KPX J period -15
+KPX J a -20
+KPX J A -30
+
+KPX K y -20
+KPX K u -15
+KPX K o -45
+KPX K e -40
+KPX K O -30
+
+KPX L y -23
+KPX L quoteright -30
+KPX L quotedblright -30
+KPX L Y -80
+KPX L W -55
+KPX L V -85
+KPX L T -46
+
+KPX O period -30
+KPX O comma -30
+KPX O Y -30
+KPX O X -30
+KPX O W -20
+KPX O V -45
+KPX O T -15
+KPX O A -60
+
+KPX P period -200
+KPX P o -20
+KPX P e -20
+KPX P comma -220
+KPX P a -20
+KPX P A -100
+
+KPX Q comma 20
+
+KPX R W 25
+KPX R V -10
+KPX R U 25
+KPX R T 40
+KPX R O 25
+
+KPX S comma 20
+
+KPX T y -10
+KPX T w -55
+KPX T u -46
+KPX T semicolon -29
+KPX T r -30
+KPX T period -91
+KPX T o -49
+KPX T hyphen -75
+KPX T e -49
+KPX T comma -82
+KPX T colon -15
+KPX T a -70
+KPX T O -15
+KPX T A -25
+
+KPX U period -20
+KPX U comma -20
+KPX U A -40
+
+KPX V u -55
+KPX V semicolon -33
+KPX V period -145
+KPX V o -101
+KPX V i -15
+KPX V hyphen -75
+KPX V e -101
+KPX V comma -145
+KPX V colon -18
+KPX V a -95
+KPX V O -45
+KPX V G -20
+KPX V A -102
+
+KPX W y -15
+KPX W u -30
+KPX W semicolon -33
+KPX W period -106
+KPX W o -46
+KPX W i -10
+KPX W hyphen -35
+KPX W e -47
+KPX W comma -106
+KPX W colon -15
+KPX W a -50
+KPX W O -20
+KPX W A -58
+
+KPX Y u -52
+KPX Y semicolon -23
+KPX Y period -145
+KPX Y o -89
+KPX Y hyphen -100
+KPX Y e -89
+KPX Y comma -145
+KPX Y colon -10
+KPX Y a -93
+KPX Y O -30
+KPX Y A -80
+
+KPX a t 5
+KPX a p 20
+KPX a b 5
+
+KPX b y -20
+KPX b v -20
+
+KPX c y -20
+KPX c l -15
+KPX c k -15
+
+KPX comma space -50
+KPX comma quoteright -70
+KPX comma quotedblright -70
+
+KPX e y -20
+KPX e x -20
+KPX e w -20
+KPX e v -20
+
+KPX f period -40
+KPX f o -20
+KPX f l -15
+KPX f i -15
+KPX f f -20
+KPX f dotlessi -15
+KPX f comma -40
+KPX f a -15
+
+KPX g i 25
+KPX g a 15
+
+KPX h y -30
+
+KPX k y -5
+KPX k o -30
+KPX k e -40
+
+KPX m y -20
+KPX m u -20
+
+KPX n y -15
+KPX n v -30
+
+KPX o y -20
+KPX o x -30
+KPX o w -20
+KPX o v -30
+
+KPX p y -20
+
+KPX period space -50
+KPX period quoteright -70
+KPX period quotedblright -70
+
+KPX quotedblleft A -50
+
+KPX quotedblright space -50
+
+KPX quoteleft quoteleft -80
+KPX quoteleft A -50
+
+KPX quoteright v -10
+KPX quoteright t 10
+KPX quoteright space -50
+KPX quoteright s -15
+KPX quoteright r -20
+KPX quoteright quoteright -80
+KPX quoteright d -50
+
+KPX r y 40
+KPX r v 40
+KPX r u 20
+KPX r t 20
+KPX r s 20
+KPX r q -8
+KPX r period -73
+KPX r p 20
+KPX r o -15
+KPX r n 21
+KPX r m 15
+KPX r l 20
+KPX r k 5
+KPX r i 20
+KPX r hyphen -60
+KPX r g 1
+KPX r e -4
+KPX r d -6
+KPX r comma -75
+KPX r c -7
+
+KPX s period 20
+KPX s comma 20
+
+KPX space quoteleft -50
+KPX space quotedblleft -50
+KPX space Y -60
+KPX space W -25
+KPX space V -80
+KPX space T -25
+KPX space A -20
+
+KPX v period -90
+KPX v o -20
+KPX v e -20
+KPX v comma -90
+KPX v a -30
+
+KPX w period -90
+KPX w o -30
+KPX w e -20
+KPX w comma -90
+KPX w a -30
+
+KPX x e -20
+
+KPX y period -100
+KPX y o -30
+KPX y e -20
+KPX y comma -100
+KPX y c -35
+KPX y a -30
+EndKernPairs
+EndKernData
+StartComposites 56
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 192 170 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 132 170 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 152 170 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 192 170 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 215 135 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 162 170 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 82 170 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 22 170 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 42 170 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 82 170 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute -13 170 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -98 170 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -78 170 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave -63 170 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 162 170 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 242 170 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 182 170 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 202 170 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 242 170 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 212 170 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 22 170 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 177 170 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 82 170 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 102 170 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 107 170 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 167 170 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 92 170 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 37 170 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 120 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 60 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 80 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 120 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 150 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 90 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 110 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 50 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 70 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 110 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -65 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -150 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -130 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -115 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 60 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 110 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 50 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 70 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 110 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 80 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron -50 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 125 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 30 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 50 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 55 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 115 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 40 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron -15 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pagk8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pagk8a.afm
new file mode 100644
index 0000000..53b03bb
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pagk8a.afm
@@ -0,0 +1,573 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990, 1991 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Mon Mar 4 13:37:31 1991
+Comment UniqueID 34364
+Comment VMusage 24225 31117
+FontName AvantGarde-Book
+FullName ITC Avant Garde Gothic Book
+FamilyName ITC Avant Garde Gothic
+Weight Book
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -113 -222 1148 955
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.006
+Notice Copyright (c) 1985, 1987, 1989, 1990, 1991 Adobe Systems Incorporated. All Rights Reserved.ITC Avant Garde Gothic is a registered trademark of International Typeface Corporation.
+EncodingScheme AdobeStandardEncoding
+CapHeight 740
+XHeight 547
+Ascender 740
+Descender -192
+StartCharMetrics 228
+C 32 ; WX 277 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 295 ; N exclam ; B 111 0 185 740 ;
+C 34 ; WX 309 ; N quotedbl ; B 36 444 273 740 ;
+C 35 ; WX 554 ; N numbersign ; B 33 0 521 740 ;
+C 36 ; WX 554 ; N dollar ; B 70 -70 485 811 ;
+C 37 ; WX 775 ; N percent ; B 21 -13 753 751 ;
+C 38 ; WX 757 ; N ampersand ; B 56 -12 736 753 ;
+C 39 ; WX 351 ; N quoteright ; B 94 546 256 740 ;
+C 40 ; WX 369 ; N parenleft ; B 47 -205 355 757 ;
+C 41 ; WX 369 ; N parenright ; B 14 -205 322 757 ;
+C 42 ; WX 425 ; N asterisk ; B 58 446 367 740 ;
+C 43 ; WX 606 ; N plus ; B 51 0 555 506 ;
+C 44 ; WX 277 ; N comma ; B 14 -67 176 126 ;
+C 45 ; WX 332 ; N hyphen ; B 30 248 302 315 ;
+C 46 ; WX 277 ; N period ; B 102 0 176 126 ;
+C 47 ; WX 437 ; N slash ; B 44 -100 403 740 ;
+C 48 ; WX 554 ; N zero ; B 29 -13 525 753 ;
+C 49 ; WX 554 ; N one ; B 135 0 336 740 ;
+C 50 ; WX 554 ; N two ; B 40 0 514 753 ;
+C 51 ; WX 554 ; N three ; B 34 -13 506 753 ;
+C 52 ; WX 554 ; N four ; B 14 0 528 740 ;
+C 53 ; WX 554 ; N five ; B 26 -13 530 740 ;
+C 54 ; WX 554 ; N six ; B 24 -13 530 739 ;
+C 55 ; WX 554 ; N seven ; B 63 0 491 740 ;
+C 56 ; WX 554 ; N eight ; B 41 -13 513 753 ;
+C 57 ; WX 554 ; N nine ; B 24 0 530 752 ;
+C 58 ; WX 277 ; N colon ; B 102 0 176 548 ;
+C 59 ; WX 277 ; N semicolon ; B 14 -67 176 548 ;
+C 60 ; WX 606 ; N less ; B 46 -8 554 514 ;
+C 61 ; WX 606 ; N equal ; B 51 118 555 388 ;
+C 62 ; WX 606 ; N greater ; B 52 -8 560 514 ;
+C 63 ; WX 591 ; N question ; B 64 0 526 752 ;
+C 64 ; WX 867 ; N at ; B 65 -13 803 753 ;
+C 65 ; WX 740 ; N A ; B 12 0 729 740 ;
+C 66 ; WX 574 ; N B ; B 74 0 544 740 ;
+C 67 ; WX 813 ; N C ; B 43 -13 771 752 ;
+C 68 ; WX 744 ; N D ; B 74 0 699 740 ;
+C 69 ; WX 536 ; N E ; B 70 0 475 740 ;
+C 70 ; WX 485 ; N F ; B 70 0 444 740 ;
+C 71 ; WX 872 ; N G ; B 40 -13 828 753 ;
+C 72 ; WX 683 ; N H ; B 76 0 607 740 ;
+C 73 ; WX 226 ; N I ; B 76 0 150 740 ;
+C 74 ; WX 482 ; N J ; B 6 -13 402 740 ;
+C 75 ; WX 591 ; N K ; B 81 0 591 740 ;
+C 76 ; WX 462 ; N L ; B 82 0 462 740 ;
+C 77 ; WX 919 ; N M ; B 76 0 843 740 ;
+C 78 ; WX 740 ; N N ; B 75 0 664 740 ;
+C 79 ; WX 869 ; N O ; B 43 -13 826 753 ;
+C 80 ; WX 592 ; N P ; B 75 0 564 740 ;
+C 81 ; WX 871 ; N Q ; B 40 -13 837 753 ;
+C 82 ; WX 607 ; N R ; B 70 0 572 740 ;
+C 83 ; WX 498 ; N S ; B 22 -13 473 753 ;
+C 84 ; WX 426 ; N T ; B 6 0 419 740 ;
+C 85 ; WX 655 ; N U ; B 75 -13 579 740 ;
+C 86 ; WX 702 ; N V ; B 8 0 693 740 ;
+C 87 ; WX 960 ; N W ; B 11 0 950 740 ;
+C 88 ; WX 609 ; N X ; B 8 0 602 740 ;
+C 89 ; WX 592 ; N Y ; B 1 0 592 740 ;
+C 90 ; WX 480 ; N Z ; B 12 0 470 740 ;
+C 91 ; WX 351 ; N bracketleft ; B 133 -179 337 753 ;
+C 92 ; WX 605 ; N backslash ; B 118 -100 477 740 ;
+C 93 ; WX 351 ; N bracketright ; B 14 -179 218 753 ;
+C 94 ; WX 606 ; N asciicircum ; B 53 307 553 740 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 351 ; N quoteleft ; B 95 546 257 740 ;
+C 97 ; WX 683 ; N a ; B 42 -13 621 561 ;
+C 98 ; WX 682 ; N b ; B 68 -13 647 740 ;
+C 99 ; WX 647 ; N c ; B 41 -13 607 561 ;
+C 100 ; WX 685 ; N d ; B 39 -13 618 740 ;
+C 101 ; WX 650 ; N e ; B 38 -13 608 561 ;
+C 102 ; WX 314 ; N f ; B 19 0 314 753 ; L i fi ; L l fl ;
+C 103 ; WX 673 ; N g ; B 37 -215 606 561 ;
+C 104 ; WX 610 ; N h ; B 62 0 543 740 ;
+C 105 ; WX 200 ; N i ; B 65 0 135 740 ;
+C 106 ; WX 203 ; N j ; B -44 -192 137 740 ;
+C 107 ; WX 502 ; N k ; B 70 0 498 740 ;
+C 108 ; WX 200 ; N l ; B 65 0 135 740 ;
+C 109 ; WX 938 ; N m ; B 66 0 872 561 ;
+C 110 ; WX 610 ; N n ; B 65 0 546 561 ;
+C 111 ; WX 655 ; N o ; B 42 -13 614 561 ;
+C 112 ; WX 682 ; N p ; B 64 -192 643 561 ;
+C 113 ; WX 682 ; N q ; B 37 -192 616 561 ;
+C 114 ; WX 301 ; N r ; B 65 0 291 561 ;
+C 115 ; WX 388 ; N s ; B 24 -13 364 561 ;
+C 116 ; WX 339 ; N t ; B 14 0 330 740 ;
+C 117 ; WX 608 ; N u ; B 62 -13 541 547 ;
+C 118 ; WX 554 ; N v ; B 7 0 546 547 ;
+C 119 ; WX 831 ; N w ; B 13 0 820 547 ;
+C 120 ; WX 480 ; N x ; B 12 0 468 547 ;
+C 121 ; WX 536 ; N y ; B 15 -192 523 547 ;
+C 122 ; WX 425 ; N z ; B 10 0 415 547 ;
+C 123 ; WX 351 ; N braceleft ; B 70 -189 331 740 ;
+C 124 ; WX 672 ; N bar ; B 299 -100 373 740 ;
+C 125 ; WX 351 ; N braceright ; B 20 -189 281 740 ;
+C 126 ; WX 606 ; N asciitilde ; B 72 179 534 319 ;
+C 161 ; WX 295 ; N exclamdown ; B 110 -192 184 548 ;
+C 162 ; WX 554 ; N cent ; B 48 62 510 707 ;
+C 163 ; WX 554 ; N sterling ; B 4 0 552 753 ;
+C 164 ; WX 166 ; N fraction ; B -113 0 280 740 ;
+C 165 ; WX 554 ; N yen ; B 4 0 550 740 ;
+C 166 ; WX 554 ; N florin ; B -12 -153 518 818 ;
+C 167 ; WX 615 ; N section ; B 85 -141 529 753 ;
+C 168 ; WX 554 ; N currency ; B 8 42 546 580 ;
+C 169 ; WX 198 ; N quotesingle ; B 59 444 140 740 ;
+C 170 ; WX 502 ; N quotedblleft ; B 97 546 406 740 ;
+C 171 ; WX 425 ; N guillemotleft ; B 40 81 386 481 ;
+C 172 ; WX 251 ; N guilsinglleft ; B 40 81 212 481 ;
+C 173 ; WX 251 ; N guilsinglright ; B 39 81 211 481 ;
+C 174 ; WX 487 ; N fi ; B 19 0 422 753 ;
+C 175 ; WX 485 ; N fl ; B 19 0 420 753 ;
+C 177 ; WX 500 ; N endash ; B 35 248 465 315 ;
+C 178 ; WX 553 ; N dagger ; B 59 -133 493 740 ;
+C 179 ; WX 553 ; N daggerdbl ; B 59 -133 493 740 ;
+C 180 ; WX 277 ; N periodcentered ; B 102 190 176 316 ;
+C 182 ; WX 564 ; N paragraph ; B 22 -110 551 740 ;
+C 183 ; WX 606 ; N bullet ; B 150 222 455 532 ;
+C 184 ; WX 354 ; N quotesinglbase ; B 89 -68 251 126 ;
+C 185 ; WX 502 ; N quotedblbase ; B 89 -68 399 126 ;
+C 186 ; WX 484 ; N quotedblright ; B 96 546 405 740 ;
+C 187 ; WX 425 ; N guillemotright ; B 39 81 385 481 ;
+C 188 ; WX 1000 ; N ellipsis ; B 130 0 870 126 ;
+C 189 ; WX 1174 ; N perthousand ; B 25 -13 1148 751 ;
+C 191 ; WX 591 ; N questiondown ; B 65 -205 527 548 ;
+C 193 ; WX 378 ; N grave ; B 69 619 300 786 ;
+C 194 ; WX 375 ; N acute ; B 78 619 309 786 ;
+C 195 ; WX 502 ; N circumflex ; B 74 639 428 764 ;
+C 196 ; WX 439 ; N tilde ; B 47 651 392 754 ;
+C 197 ; WX 485 ; N macron ; B 73 669 411 736 ;
+C 198 ; WX 453 ; N breve ; B 52 651 401 754 ;
+C 199 ; WX 222 ; N dotaccent ; B 74 639 148 765 ;
+C 200 ; WX 369 ; N dieresis ; B 73 639 295 765 ;
+C 202 ; WX 332 ; N ring ; B 62 600 269 807 ;
+C 203 ; WX 324 ; N cedilla ; B 80 -222 254 0 ;
+C 205 ; WX 552 ; N hungarumlaut ; B 119 605 453 800 ;
+C 206 ; WX 302 ; N ogonek ; B 73 -191 228 0 ;
+C 207 ; WX 502 ; N caron ; B 68 639 423 764 ;
+C 208 ; WX 1000 ; N emdash ; B 35 248 965 315 ;
+C 225 ; WX 992 ; N AE ; B -20 0 907 740 ;
+C 227 ; WX 369 ; N ordfeminine ; B -3 407 356 753 ;
+C 232 ; WX 517 ; N Lslash ; B 59 0 517 740 ;
+C 233 ; WX 868 ; N Oslash ; B 43 -83 826 819 ;
+C 234 ; WX 1194 ; N OE ; B 45 -13 1142 753 ;
+C 235 ; WX 369 ; N ordmasculine ; B 12 407 356 753 ;
+C 241 ; WX 1157 ; N ae ; B 34 -13 1113 561 ;
+C 245 ; WX 200 ; N dotlessi ; B 65 0 135 547 ;
+C 248 ; WX 300 ; N lslash ; B 43 0 259 740 ;
+C 249 ; WX 653 ; N oslash ; B 41 -64 613 614 ;
+C 250 ; WX 1137 ; N oe ; B 34 -13 1104 561 ;
+C 251 ; WX 554 ; N germandbls ; B 61 -13 525 753 ;
+C -1 ; WX 650 ; N ecircumflex ; B 38 -13 608 764 ;
+C -1 ; WX 650 ; N edieresis ; B 38 -13 608 765 ;
+C -1 ; WX 683 ; N aacute ; B 42 -13 621 786 ;
+C -1 ; WX 747 ; N registered ; B -9 -12 755 752 ;
+C -1 ; WX 200 ; N icircumflex ; B -77 0 277 764 ;
+C -1 ; WX 608 ; N udieresis ; B 62 -13 541 765 ;
+C -1 ; WX 655 ; N ograve ; B 42 -13 614 786 ;
+C -1 ; WX 608 ; N uacute ; B 62 -13 541 786 ;
+C -1 ; WX 608 ; N ucircumflex ; B 62 -13 541 764 ;
+C -1 ; WX 740 ; N Aacute ; B 12 0 729 949 ;
+C -1 ; WX 200 ; N igrave ; B -60 0 171 786 ;
+C -1 ; WX 226 ; N Icircumflex ; B -64 0 290 927 ;
+C -1 ; WX 647 ; N ccedilla ; B 41 -222 607 561 ;
+C -1 ; WX 683 ; N adieresis ; B 42 -13 621 765 ;
+C -1 ; WX 536 ; N Ecircumflex ; B 70 0 475 927 ;
+C -1 ; WX 388 ; N scaron ; B 11 -13 366 764 ;
+C -1 ; WX 682 ; N thorn ; B 64 -192 643 740 ;
+C -1 ; WX 1000 ; N trademark ; B 9 296 816 740 ;
+C -1 ; WX 650 ; N egrave ; B 38 -13 608 786 ;
+C -1 ; WX 332 ; N threesuperior ; B 18 289 318 747 ;
+C -1 ; WX 425 ; N zcaron ; B 10 0 415 764 ;
+C -1 ; WX 683 ; N atilde ; B 42 -13 621 754 ;
+C -1 ; WX 683 ; N aring ; B 42 -13 621 807 ;
+C -1 ; WX 655 ; N ocircumflex ; B 42 -13 614 764 ;
+C -1 ; WX 536 ; N Edieresis ; B 70 0 475 928 ;
+C -1 ; WX 831 ; N threequarters ; B 46 0 784 747 ;
+C -1 ; WX 536 ; N ydieresis ; B 15 -192 523 765 ;
+C -1 ; WX 536 ; N yacute ; B 15 -192 523 786 ;
+C -1 ; WX 200 ; N iacute ; B 31 0 262 786 ;
+C -1 ; WX 740 ; N Acircumflex ; B 12 0 729 927 ;
+C -1 ; WX 655 ; N Uacute ; B 75 -13 579 949 ;
+C -1 ; WX 650 ; N eacute ; B 38 -13 608 786 ;
+C -1 ; WX 869 ; N Ograve ; B 43 -13 826 949 ;
+C -1 ; WX 683 ; N agrave ; B 42 -13 621 786 ;
+C -1 ; WX 655 ; N Udieresis ; B 75 -13 579 928 ;
+C -1 ; WX 683 ; N acircumflex ; B 42 -13 621 764 ;
+C -1 ; WX 226 ; N Igrave ; B -47 0 184 949 ;
+C -1 ; WX 332 ; N twosuperior ; B 19 296 318 747 ;
+C -1 ; WX 655 ; N Ugrave ; B 75 -13 579 949 ;
+C -1 ; WX 831 ; N onequarter ; B 100 0 729 740 ;
+C -1 ; WX 655 ; N Ucircumflex ; B 75 -13 579 927 ;
+C -1 ; WX 498 ; N Scaron ; B 22 -13 473 927 ;
+C -1 ; WX 226 ; N Idieresis ; B 2 0 224 928 ;
+C -1 ; WX 200 ; N idieresis ; B -11 0 211 765 ;
+C -1 ; WX 536 ; N Egrave ; B 70 0 475 949 ;
+C -1 ; WX 869 ; N Oacute ; B 43 -13 826 949 ;
+C -1 ; WX 606 ; N divide ; B 51 -13 555 519 ;
+C -1 ; WX 740 ; N Atilde ; B 12 0 729 917 ;
+C -1 ; WX 740 ; N Aring ; B 12 0 729 955 ;
+C -1 ; WX 869 ; N Odieresis ; B 43 -13 826 928 ;
+C -1 ; WX 740 ; N Adieresis ; B 12 0 729 928 ;
+C -1 ; WX 740 ; N Ntilde ; B 75 0 664 917 ;
+C -1 ; WX 480 ; N Zcaron ; B 12 0 470 927 ;
+C -1 ; WX 592 ; N Thorn ; B 60 0 549 740 ;
+C -1 ; WX 226 ; N Iacute ; B 44 0 275 949 ;
+C -1 ; WX 606 ; N plusminus ; B 51 -24 555 518 ;
+C -1 ; WX 606 ; N multiply ; B 74 24 533 482 ;
+C -1 ; WX 536 ; N Eacute ; B 70 0 475 949 ;
+C -1 ; WX 592 ; N Ydieresis ; B 1 0 592 928 ;
+C -1 ; WX 332 ; N onesuperior ; B 63 296 198 740 ;
+C -1 ; WX 608 ; N ugrave ; B 62 -13 541 786 ;
+C -1 ; WX 606 ; N logicalnot ; B 51 109 555 388 ;
+C -1 ; WX 610 ; N ntilde ; B 65 0 546 754 ;
+C -1 ; WX 869 ; N Otilde ; B 43 -13 826 917 ;
+C -1 ; WX 655 ; N otilde ; B 42 -13 614 754 ;
+C -1 ; WX 813 ; N Ccedilla ; B 43 -222 771 752 ;
+C -1 ; WX 740 ; N Agrave ; B 12 0 729 949 ;
+C -1 ; WX 831 ; N onehalf ; B 81 0 750 740 ;
+C -1 ; WX 790 ; N Eth ; B 40 0 739 740 ;
+C -1 ; WX 400 ; N degree ; B 56 421 344 709 ;
+C -1 ; WX 592 ; N Yacute ; B 1 0 592 949 ;
+C -1 ; WX 869 ; N Ocircumflex ; B 43 -13 826 927 ;
+C -1 ; WX 655 ; N oacute ; B 42 -13 614 786 ;
+C -1 ; WX 608 ; N mu ; B 80 -184 527 547 ;
+C -1 ; WX 606 ; N minus ; B 51 219 555 287 ;
+C -1 ; WX 655 ; N eth ; B 42 -12 614 753 ;
+C -1 ; WX 655 ; N odieresis ; B 42 -13 614 765 ;
+C -1 ; WX 747 ; N copyright ; B -9 -12 755 752 ;
+C -1 ; WX 672 ; N brokenbar ; B 299 -100 373 740 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 216
+
+KPX A y -62
+KPX A w -65
+KPX A v -70
+KPX A u -20
+KPX A quoteright -100
+KPX A quotedblright -100
+KPX A Y -92
+KPX A W -60
+KPX A V -102
+KPX A U -40
+KPX A T -45
+KPX A Q -40
+KPX A O -50
+KPX A G -40
+KPX A C -40
+
+KPX B A -10
+
+KPX C A -40
+
+KPX D period -20
+KPX D comma -20
+KPX D Y -30
+KPX D W -10
+KPX D V -50
+KPX D A -50
+
+KPX F period -160
+KPX F e -20
+KPX F comma -180
+KPX F a -20
+KPX F A -75
+
+KPX G period -20
+KPX G comma -20
+KPX G Y -20
+
+KPX J period -15
+KPX J a -20
+KPX J A -30
+
+KPX K o -15
+KPX K e -20
+KPX K O -20
+
+KPX L y -23
+KPX L quoteright -130
+KPX L quotedblright -130
+KPX L Y -91
+KPX L W -67
+KPX L V -113
+KPX L T -46
+
+KPX O period -30
+KPX O comma -30
+KPX O Y -30
+KPX O X -30
+KPX O W -20
+KPX O V -60
+KPX O T -30
+KPX O A -60
+
+KPX P period -300
+KPX P o -60
+KPX P e -20
+KPX P comma -280
+KPX P a -20
+KPX P A -114
+
+KPX Q comma 20
+
+KPX R Y -10
+KPX R W 10
+KPX R V -10
+KPX R T 6
+
+KPX S comma 20
+
+KPX T y -50
+KPX T w -55
+KPX T u -46
+KPX T semicolon -29
+KPX T r -30
+KPX T period -91
+KPX T o -70
+KPX T i 10
+KPX T hyphen -75
+KPX T e -49
+KPX T comma -82
+KPX T colon -15
+KPX T a -90
+KPX T O -30
+KPX T A -45
+
+KPX U period -20
+KPX U comma -20
+KPX U A -40
+
+KPX V u -40
+KPX V semicolon -33
+KPX V period -165
+KPX V o -101
+KPX V i -5
+KPX V hyphen -75
+KPX V e -101
+KPX V comma -145
+KPX V colon -18
+KPX V a -104
+KPX V O -60
+KPX V G -20
+KPX V A -102
+
+KPX W y -2
+KPX W u -30
+KPX W semicolon -33
+KPX W period -106
+KPX W o -46
+KPX W i 6
+KPX W hyphen -35
+KPX W e -47
+KPX W comma -106
+KPX W colon -15
+KPX W a -50
+KPX W O -20
+KPX W A -58
+
+KPX Y u -52
+KPX Y semicolon -23
+KPX Y period -175
+KPX Y o -89
+KPX Y hyphen -85
+KPX Y e -89
+KPX Y comma -145
+KPX Y colon -10
+KPX Y a -93
+KPX Y O -30
+KPX Y A -92
+
+KPX a p 20
+KPX a b 20
+
+KPX b y -20
+KPX b v -20
+
+KPX c y -20
+KPX c k -15
+
+KPX comma space -110
+KPX comma quoteright -120
+KPX comma quotedblright -120
+
+KPX e y -20
+KPX e w -20
+KPX e v -20
+
+KPX f period -50
+KPX f o -40
+KPX f l -30
+KPX f i -34
+KPX f f -60
+KPX f e -20
+KPX f dotlessi -34
+KPX f comma -50
+KPX f a -40
+
+KPX g a -15
+
+KPX h y -30
+
+KPX k y -5
+KPX k e -15
+
+KPX m y -20
+KPX m u -20
+KPX m a -20
+
+KPX n y -15
+KPX n v -20
+
+KPX o y -20
+KPX o x -15
+KPX o w -20
+KPX o v -30
+
+KPX p y -20
+
+KPX period space -110
+KPX period quoteright -120
+KPX period quotedblright -120
+
+KPX quotedblleft quoteleft -35
+KPX quotedblleft A -100
+
+KPX quotedblright space -110
+
+KPX quoteleft quoteleft -203
+KPX quoteleft A -100
+
+KPX quoteright v -30
+KPX quoteright t 10
+KPX quoteright space -110
+KPX quoteright s -15
+KPX quoteright r -20
+KPX quoteright quoteright -203
+KPX quoteright quotedblright -35
+KPX quoteright d -110
+
+KPX r y 40
+KPX r v 40
+KPX r u 20
+KPX r t 20
+KPX r s 20
+KPX r q -8
+KPX r period -73
+KPX r p 20
+KPX r o -20
+KPX r n 21
+KPX r m 28
+KPX r l 20
+KPX r k 20
+KPX r i 20
+KPX r hyphen -60
+KPX r g -15
+KPX r e -4
+KPX r d -6
+KPX r comma -75
+KPX r c -20
+KPX r a -20
+
+KPX s period 20
+KPX s comma 20
+
+KPX space quoteleft -110
+KPX space quotedblleft -110
+KPX space Y -60
+KPX space W -25
+KPX space V -50
+KPX space T -25
+KPX space A -20
+
+KPX v period -130
+KPX v o -30
+KPX v e -20
+KPX v comma -100
+KPX v a -30
+
+KPX w period -100
+KPX w o -30
+KPX w h 15
+KPX w e -20
+KPX w comma -90
+KPX w a -30
+
+KPX y period -125
+KPX y o -30
+KPX y e -20
+KPX y comma -110
+KPX y a -30
+EndKernPairs
+EndKernData
+StartComposites 56
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 183 163 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 119 163 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 186 163 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 181 163 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 204 148 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 151 163 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 81 163 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 17 163 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 84 163 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 79 163 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute -34 163 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -138 163 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -71 163 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave -116 163 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 151 163 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 247 163 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 184 163 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 250 163 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 246 163 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 215 163 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron -2 163 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 160 163 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 77 163 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 143 163 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 119 163 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 129 163 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 112 163 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron -11 163 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 154 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 91 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 157 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 153 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 176 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 122 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 138 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 74 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 141 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 136 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -47 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -151 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -84 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -129 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 86 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 140 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 77 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 143 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 139 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 108 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron -57 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 137 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 53 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 120 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 95 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 101 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 84 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron -38 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pagko8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pagko8a.afm
new file mode 100644
index 0000000..e0e75f3
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pagko8a.afm
@@ -0,0 +1,573 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990, 1991 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Mon Mar 4 13:41:11 1991
+Comment UniqueID 34367
+Comment VMusage 6555 39267
+FontName AvantGarde-BookOblique
+FullName ITC Avant Garde Gothic Book Oblique
+FamilyName ITC Avant Garde Gothic
+Weight Book
+ItalicAngle -10.5
+IsFixedPitch false
+FontBBox -113 -222 1279 955
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.006
+Notice Copyright (c) 1985, 1987, 1989, 1990, 1991 Adobe Systems Incorporated. All Rights Reserved.ITC Avant Garde Gothic is a registered trademark of International Typeface Corporation.
+EncodingScheme AdobeStandardEncoding
+CapHeight 740
+XHeight 547
+Ascender 740
+Descender -192
+StartCharMetrics 228
+C 32 ; WX 277 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 295 ; N exclam ; B 111 0 322 740 ;
+C 34 ; WX 309 ; N quotedbl ; B 130 444 410 740 ;
+C 35 ; WX 554 ; N numbersign ; B 71 0 620 740 ;
+C 36 ; WX 554 ; N dollar ; B 107 -70 581 811 ;
+C 37 ; WX 775 ; N percent ; B 124 -13 787 751 ;
+C 38 ; WX 757 ; N ampersand ; B 92 -12 775 753 ;
+C 39 ; WX 351 ; N quoteright ; B 195 546 393 740 ;
+C 40 ; WX 369 ; N parenleft ; B 89 -205 495 757 ;
+C 41 ; WX 369 ; N parenright ; B -24 -205 382 757 ;
+C 42 ; WX 425 ; N asterisk ; B 170 446 479 740 ;
+C 43 ; WX 606 ; N plus ; B 92 0 608 506 ;
+C 44 ; WX 277 ; N comma ; B 2 -67 199 126 ;
+C 45 ; WX 332 ; N hyphen ; B 76 248 360 315 ;
+C 46 ; WX 277 ; N period ; B 102 0 199 126 ;
+C 47 ; WX 437 ; N slash ; B 25 -100 540 740 ;
+C 48 ; WX 554 ; N zero ; B 71 -13 622 753 ;
+C 49 ; WX 554 ; N one ; B 260 0 473 740 ;
+C 50 ; WX 554 ; N two ; B 40 0 615 753 ;
+C 51 ; WX 554 ; N three ; B 73 -13 565 753 ;
+C 52 ; WX 554 ; N four ; B 39 0 598 740 ;
+C 53 ; WX 554 ; N five ; B 69 -13 605 740 ;
+C 54 ; WX 554 ; N six ; B 65 -13 580 739 ;
+C 55 ; WX 554 ; N seven ; B 110 0 628 740 ;
+C 56 ; WX 554 ; N eight ; B 77 -13 580 753 ;
+C 57 ; WX 554 ; N nine ; B 111 0 626 752 ;
+C 58 ; WX 277 ; N colon ; B 102 0 278 548 ;
+C 59 ; WX 277 ; N semicolon ; B 2 -67 278 548 ;
+C 60 ; WX 606 ; N less ; B 87 -8 649 514 ;
+C 61 ; WX 606 ; N equal ; B 73 118 627 388 ;
+C 62 ; WX 606 ; N greater ; B 51 -8 613 514 ;
+C 63 ; WX 591 ; N question ; B 158 0 628 752 ;
+C 64 ; WX 867 ; N at ; B 126 -13 888 753 ;
+C 65 ; WX 740 ; N A ; B 12 0 729 740 ;
+C 66 ; WX 574 ; N B ; B 74 0 606 740 ;
+C 67 ; WX 813 ; N C ; B 105 -13 870 752 ;
+C 68 ; WX 744 ; N D ; B 74 0 773 740 ;
+C 69 ; WX 536 ; N E ; B 70 0 612 740 ;
+C 70 ; WX 485 ; N F ; B 70 0 581 740 ;
+C 71 ; WX 872 ; N G ; B 103 -13 891 753 ;
+C 72 ; WX 683 ; N H ; B 76 0 744 740 ;
+C 73 ; WX 226 ; N I ; B 76 0 287 740 ;
+C 74 ; WX 482 ; N J ; B 37 -13 539 740 ;
+C 75 ; WX 591 ; N K ; B 81 0 728 740 ;
+C 76 ; WX 462 ; N L ; B 82 0 474 740 ;
+C 77 ; WX 919 ; N M ; B 76 0 980 740 ;
+C 78 ; WX 740 ; N N ; B 75 0 801 740 ;
+C 79 ; WX 869 ; N O ; B 105 -13 901 753 ;
+C 80 ; WX 592 ; N P ; B 75 0 664 740 ;
+C 81 ; WX 871 ; N Q ; B 102 -13 912 753 ;
+C 82 ; WX 607 ; N R ; B 70 0 669 740 ;
+C 83 ; WX 498 ; N S ; B 57 -13 561 753 ;
+C 84 ; WX 426 ; N T ; B 131 0 556 740 ;
+C 85 ; WX 655 ; N U ; B 118 -13 716 740 ;
+C 86 ; WX 702 ; N V ; B 145 0 830 740 ;
+C 87 ; WX 960 ; N W ; B 148 0 1087 740 ;
+C 88 ; WX 609 ; N X ; B 8 0 724 740 ;
+C 89 ; WX 592 ; N Y ; B 138 0 729 740 ;
+C 90 ; WX 480 ; N Z ; B 12 0 596 740 ;
+C 91 ; WX 351 ; N bracketleft ; B 145 -179 477 753 ;
+C 92 ; WX 605 ; N backslash ; B 255 -100 458 740 ;
+C 93 ; WX 351 ; N bracketright ; B -19 -179 312 753 ;
+C 94 ; WX 606 ; N asciicircum ; B 110 307 610 740 ;
+C 95 ; WX 500 ; N underscore ; B -23 -125 486 -75 ;
+C 96 ; WX 351 ; N quoteleft ; B 232 546 358 740 ;
+C 97 ; WX 683 ; N a ; B 88 -13 722 561 ;
+C 98 ; WX 682 ; N b ; B 68 -13 703 740 ;
+C 99 ; WX 647 ; N c ; B 87 -13 678 561 ;
+C 100 ; WX 685 ; N d ; B 85 -13 755 740 ;
+C 101 ; WX 650 ; N e ; B 84 -13 664 561 ;
+C 102 ; WX 314 ; N f ; B 104 0 454 753 ; L i fi ; L l fl ;
+C 103 ; WX 673 ; N g ; B 56 -215 707 561 ;
+C 104 ; WX 610 ; N h ; B 62 0 606 740 ;
+C 105 ; WX 200 ; N i ; B 65 0 272 740 ;
+C 106 ; WX 203 ; N j ; B -80 -192 274 740 ;
+C 107 ; WX 502 ; N k ; B 70 0 588 740 ;
+C 108 ; WX 200 ; N l ; B 65 0 272 740 ;
+C 109 ; WX 938 ; N m ; B 66 0 938 561 ;
+C 110 ; WX 610 ; N n ; B 65 0 609 561 ;
+C 111 ; WX 655 ; N o ; B 88 -13 669 561 ;
+C 112 ; WX 682 ; N p ; B 28 -192 699 561 ;
+C 113 ; WX 682 ; N q ; B 83 -192 717 561 ;
+C 114 ; WX 301 ; N r ; B 65 0 395 561 ;
+C 115 ; WX 388 ; N s ; B 49 -13 424 561 ;
+C 116 ; WX 339 ; N t ; B 104 0 431 740 ;
+C 117 ; WX 608 ; N u ; B 100 -13 642 547 ;
+C 118 ; WX 554 ; N v ; B 108 0 647 547 ;
+C 119 ; WX 831 ; N w ; B 114 0 921 547 ;
+C 120 ; WX 480 ; N x ; B 12 0 569 547 ;
+C 121 ; WX 536 ; N y ; B 97 -192 624 547 ;
+C 122 ; WX 425 ; N z ; B 10 0 498 547 ;
+C 123 ; WX 351 ; N braceleft ; B 115 -189 468 740 ;
+C 124 ; WX 672 ; N bar ; B 280 -100 510 740 ;
+C 125 ; WX 351 ; N braceright ; B -15 -189 338 740 ;
+C 126 ; WX 606 ; N asciitilde ; B 114 179 584 319 ;
+C 161 ; WX 295 ; N exclamdown ; B 74 -192 286 548 ;
+C 162 ; WX 554 ; N cent ; B 115 62 596 707 ;
+C 163 ; WX 554 ; N sterling ; B 29 0 614 753 ;
+C 164 ; WX 166 ; N fraction ; B -113 0 417 740 ;
+C 165 ; WX 554 ; N yen ; B 75 0 687 740 ;
+C 166 ; WX 554 ; N florin ; B -39 -153 669 818 ;
+C 167 ; WX 615 ; N section ; B 118 -141 597 753 ;
+C 168 ; WX 554 ; N currency ; B 24 42 645 580 ;
+C 169 ; WX 198 ; N quotesingle ; B 153 444 277 740 ;
+C 170 ; WX 502 ; N quotedblleft ; B 234 546 507 740 ;
+C 171 ; WX 425 ; N guillemotleft ; B 92 81 469 481 ;
+C 172 ; WX 251 ; N guilsinglleft ; B 92 81 295 481 ;
+C 173 ; WX 251 ; N guilsinglright ; B 60 81 263 481 ;
+C 174 ; WX 487 ; N fi ; B 104 0 559 753 ;
+C 175 ; WX 485 ; N fl ; B 104 0 557 753 ;
+C 177 ; WX 500 ; N endash ; B 81 248 523 315 ;
+C 178 ; WX 553 ; N dagger ; B 146 -133 593 740 ;
+C 179 ; WX 553 ; N daggerdbl ; B 72 -133 593 740 ;
+C 180 ; WX 277 ; N periodcentered ; B 137 190 235 316 ;
+C 182 ; WX 564 ; N paragraph ; B 119 -110 688 740 ;
+C 183 ; WX 606 ; N bullet ; B 217 222 528 532 ;
+C 184 ; WX 354 ; N quotesinglbase ; B 76 -68 274 126 ;
+C 185 ; WX 502 ; N quotedblbase ; B 76 -68 422 126 ;
+C 186 ; WX 484 ; N quotedblright ; B 197 546 542 740 ;
+C 187 ; WX 425 ; N guillemotright ; B 60 81 437 481 ;
+C 188 ; WX 1000 ; N ellipsis ; B 130 0 893 126 ;
+C 189 ; WX 1174 ; N perthousand ; B 128 -13 1182 751 ;
+C 191 ; WX 591 ; N questiondown ; B 64 -205 534 548 ;
+C 193 ; WX 378 ; N grave ; B 204 619 425 786 ;
+C 194 ; WX 375 ; N acute ; B 203 619 444 786 ;
+C 195 ; WX 502 ; N circumflex ; B 192 639 546 764 ;
+C 196 ; WX 439 ; N tilde ; B 179 651 520 754 ;
+C 197 ; WX 485 ; N macron ; B 197 669 547 736 ;
+C 198 ; WX 453 ; N breve ; B 192 651 541 754 ;
+C 199 ; WX 222 ; N dotaccent ; B 192 639 290 765 ;
+C 200 ; WX 369 ; N dieresis ; B 191 639 437 765 ;
+C 202 ; WX 332 ; N ring ; B 191 600 401 807 ;
+C 203 ; WX 324 ; N cedilla ; B 52 -222 231 0 ;
+C 205 ; WX 552 ; N hungarumlaut ; B 239 605 594 800 ;
+C 206 ; WX 302 ; N ogonek ; B 53 -191 202 0 ;
+C 207 ; WX 502 ; N caron ; B 210 639 565 764 ;
+C 208 ; WX 1000 ; N emdash ; B 81 248 1023 315 ;
+C 225 ; WX 992 ; N AE ; B -20 0 1044 740 ;
+C 227 ; WX 369 ; N ordfeminine ; B 102 407 494 753 ;
+C 232 ; WX 517 ; N Lslash ; B 107 0 529 740 ;
+C 233 ; WX 868 ; N Oslash ; B 76 -83 929 819 ;
+C 234 ; WX 1194 ; N OE ; B 107 -13 1279 753 ;
+C 235 ; WX 369 ; N ordmasculine ; B 116 407 466 753 ;
+C 241 ; WX 1157 ; N ae ; B 80 -13 1169 561 ;
+C 245 ; WX 200 ; N dotlessi ; B 65 0 236 547 ;
+C 248 ; WX 300 ; N lslash ; B 95 0 354 740 ;
+C 249 ; WX 653 ; N oslash ; B 51 -64 703 614 ;
+C 250 ; WX 1137 ; N oe ; B 80 -13 1160 561 ;
+C 251 ; WX 554 ; N germandbls ; B 61 -13 578 753 ;
+C -1 ; WX 650 ; N ecircumflex ; B 84 -13 664 764 ;
+C -1 ; WX 650 ; N edieresis ; B 84 -13 664 765 ;
+C -1 ; WX 683 ; N aacute ; B 88 -13 722 786 ;
+C -1 ; WX 747 ; N registered ; B 53 -12 830 752 ;
+C -1 ; WX 200 ; N icircumflex ; B 41 0 395 764 ;
+C -1 ; WX 608 ; N udieresis ; B 100 -13 642 765 ;
+C -1 ; WX 655 ; N ograve ; B 88 -13 669 786 ;
+C -1 ; WX 608 ; N uacute ; B 100 -13 642 786 ;
+C -1 ; WX 608 ; N ucircumflex ; B 100 -13 642 764 ;
+C -1 ; WX 740 ; N Aacute ; B 12 0 729 949 ;
+C -1 ; WX 200 ; N igrave ; B 65 0 296 786 ;
+C -1 ; WX 226 ; N Icircumflex ; B 76 0 439 927 ;
+C -1 ; WX 647 ; N ccedilla ; B 87 -222 678 561 ;
+C -1 ; WX 683 ; N adieresis ; B 88 -13 722 765 ;
+C -1 ; WX 536 ; N Ecircumflex ; B 70 0 612 927 ;
+C -1 ; WX 388 ; N scaron ; B 49 -13 508 764 ;
+C -1 ; WX 682 ; N thorn ; B 28 -192 699 740 ;
+C -1 ; WX 1000 ; N trademark ; B 137 296 953 740 ;
+C -1 ; WX 650 ; N egrave ; B 84 -13 664 786 ;
+C -1 ; WX 332 ; N threesuperior ; B 98 289 408 747 ;
+C -1 ; WX 425 ; N zcaron ; B 10 0 527 764 ;
+C -1 ; WX 683 ; N atilde ; B 88 -13 722 754 ;
+C -1 ; WX 683 ; N aring ; B 88 -13 722 807 ;
+C -1 ; WX 655 ; N ocircumflex ; B 88 -13 669 764 ;
+C -1 ; WX 536 ; N Edieresis ; B 70 0 612 928 ;
+C -1 ; WX 831 ; N threequarters ; B 126 0 825 747 ;
+C -1 ; WX 536 ; N ydieresis ; B 97 -192 624 765 ;
+C -1 ; WX 536 ; N yacute ; B 97 -192 624 786 ;
+C -1 ; WX 200 ; N iacute ; B 65 0 397 786 ;
+C -1 ; WX 740 ; N Acircumflex ; B 12 0 729 927 ;
+C -1 ; WX 655 ; N Uacute ; B 118 -13 716 949 ;
+C -1 ; WX 650 ; N eacute ; B 84 -13 664 786 ;
+C -1 ; WX 869 ; N Ograve ; B 105 -13 901 949 ;
+C -1 ; WX 683 ; N agrave ; B 88 -13 722 786 ;
+C -1 ; WX 655 ; N Udieresis ; B 118 -13 716 928 ;
+C -1 ; WX 683 ; N acircumflex ; B 88 -13 722 764 ;
+C -1 ; WX 226 ; N Igrave ; B 76 0 340 949 ;
+C -1 ; WX 332 ; N twosuperior ; B 74 296 433 747 ;
+C -1 ; WX 655 ; N Ugrave ; B 118 -13 716 949 ;
+C -1 ; WX 831 ; N onequarter ; B 183 0 770 740 ;
+C -1 ; WX 655 ; N Ucircumflex ; B 118 -13 716 927 ;
+C -1 ; WX 498 ; N Scaron ; B 57 -13 593 927 ;
+C -1 ; WX 226 ; N Idieresis ; B 76 0 396 928 ;
+C -1 ; WX 200 ; N idieresis ; B 65 0 353 765 ;
+C -1 ; WX 536 ; N Egrave ; B 70 0 612 949 ;
+C -1 ; WX 869 ; N Oacute ; B 105 -13 901 949 ;
+C -1 ; WX 606 ; N divide ; B 92 -13 608 519 ;
+C -1 ; WX 740 ; N Atilde ; B 12 0 729 917 ;
+C -1 ; WX 740 ; N Aring ; B 12 0 729 955 ;
+C -1 ; WX 869 ; N Odieresis ; B 105 -13 901 928 ;
+C -1 ; WX 740 ; N Adieresis ; B 12 0 729 928 ;
+C -1 ; WX 740 ; N Ntilde ; B 75 0 801 917 ;
+C -1 ; WX 480 ; N Zcaron ; B 12 0 596 927 ;
+C -1 ; WX 592 ; N Thorn ; B 60 0 621 740 ;
+C -1 ; WX 226 ; N Iacute ; B 76 0 440 949 ;
+C -1 ; WX 606 ; N plusminus ; B 47 -24 618 518 ;
+C -1 ; WX 606 ; N multiply ; B 87 24 612 482 ;
+C -1 ; WX 536 ; N Eacute ; B 70 0 612 949 ;
+C -1 ; WX 592 ; N Ydieresis ; B 138 0 729 928 ;
+C -1 ; WX 332 ; N onesuperior ; B 190 296 335 740 ;
+C -1 ; WX 608 ; N ugrave ; B 100 -13 642 786 ;
+C -1 ; WX 606 ; N logicalnot ; B 110 109 627 388 ;
+C -1 ; WX 610 ; N ntilde ; B 65 0 609 754 ;
+C -1 ; WX 869 ; N Otilde ; B 105 -13 901 917 ;
+C -1 ; WX 655 ; N otilde ; B 88 -13 669 754 ;
+C -1 ; WX 813 ; N Ccedilla ; B 105 -222 870 752 ;
+C -1 ; WX 740 ; N Agrave ; B 12 0 729 949 ;
+C -1 ; WX 831 ; N onehalf ; B 164 0 810 740 ;
+C -1 ; WX 790 ; N Eth ; B 104 0 813 740 ;
+C -1 ; WX 400 ; N degree ; B 158 421 451 709 ;
+C -1 ; WX 592 ; N Yacute ; B 138 0 729 949 ;
+C -1 ; WX 869 ; N Ocircumflex ; B 105 -13 901 927 ;
+C -1 ; WX 655 ; N oacute ; B 88 -13 669 786 ;
+C -1 ; WX 608 ; N mu ; B 46 -184 628 547 ;
+C -1 ; WX 606 ; N minus ; B 92 219 608 287 ;
+C -1 ; WX 655 ; N eth ; B 88 -12 675 753 ;
+C -1 ; WX 655 ; N odieresis ; B 88 -13 669 765 ;
+C -1 ; WX 747 ; N copyright ; B 53 -12 830 752 ;
+C -1 ; WX 672 ; N brokenbar ; B 280 -100 510 740 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 216
+
+KPX A y -62
+KPX A w -65
+KPX A v -70
+KPX A u -20
+KPX A quoteright -100
+KPX A quotedblright -100
+KPX A Y -92
+KPX A W -60
+KPX A V -102
+KPX A U -40
+KPX A T -45
+KPX A Q -40
+KPX A O -50
+KPX A G -40
+KPX A C -40
+
+KPX B A -10
+
+KPX C A -40
+
+KPX D period -20
+KPX D comma -20
+KPX D Y -30
+KPX D W -10
+KPX D V -50
+KPX D A -50
+
+KPX F period -160
+KPX F e -20
+KPX F comma -180
+KPX F a -20
+KPX F A -75
+
+KPX G period -20
+KPX G comma -20
+KPX G Y -20
+
+KPX J period -15
+KPX J a -20
+KPX J A -30
+
+KPX K o -15
+KPX K e -20
+KPX K O -20
+
+KPX L y -23
+KPX L quoteright -130
+KPX L quotedblright -130
+KPX L Y -91
+KPX L W -67
+KPX L V -113
+KPX L T -46
+
+KPX O period -30
+KPX O comma -30
+KPX O Y -30
+KPX O X -30
+KPX O W -20
+KPX O V -60
+KPX O T -30
+KPX O A -60
+
+KPX P period -300
+KPX P o -60
+KPX P e -20
+KPX P comma -280
+KPX P a -20
+KPX P A -114
+
+KPX Q comma 20
+
+KPX R Y -10
+KPX R W 10
+KPX R V -10
+KPX R T 6
+
+KPX S comma 20
+
+KPX T y -50
+KPX T w -55
+KPX T u -46
+KPX T semicolon -29
+KPX T r -30
+KPX T period -91
+KPX T o -70
+KPX T i 10
+KPX T hyphen -75
+KPX T e -49
+KPX T comma -82
+KPX T colon -15
+KPX T a -90
+KPX T O -30
+KPX T A -45
+
+KPX U period -20
+KPX U comma -20
+KPX U A -40
+
+KPX V u -40
+KPX V semicolon -33
+KPX V period -165
+KPX V o -101
+KPX V i -5
+KPX V hyphen -75
+KPX V e -101
+KPX V comma -145
+KPX V colon -18
+KPX V a -104
+KPX V O -60
+KPX V G -20
+KPX V A -102
+
+KPX W y -2
+KPX W u -30
+KPX W semicolon -33
+KPX W period -106
+KPX W o -46
+KPX W i 6
+KPX W hyphen -35
+KPX W e -47
+KPX W comma -106
+KPX W colon -15
+KPX W a -50
+KPX W O -20
+KPX W A -58
+
+KPX Y u -52
+KPX Y semicolon -23
+KPX Y period -175
+KPX Y o -89
+KPX Y hyphen -85
+KPX Y e -89
+KPX Y comma -145
+KPX Y colon -10
+KPX Y a -93
+KPX Y O -30
+KPX Y A -92
+
+KPX a p 20
+KPX a b 20
+
+KPX b y -20
+KPX b v -20
+
+KPX c y -20
+KPX c k -15
+
+KPX comma space -110
+KPX comma quoteright -120
+KPX comma quotedblright -120
+
+KPX e y -20
+KPX e w -20
+KPX e v -20
+
+KPX f period -50
+KPX f o -40
+KPX f l -30
+KPX f i -34
+KPX f f -60
+KPX f e -20
+KPX f dotlessi -34
+KPX f comma -50
+KPX f a -40
+
+KPX g a -15
+
+KPX h y -30
+
+KPX k y -5
+KPX k e -15
+
+KPX m y -20
+KPX m u -20
+KPX m a -20
+
+KPX n y -15
+KPX n v -20
+
+KPX o y -20
+KPX o x -15
+KPX o w -20
+KPX o v -30
+
+KPX p y -20
+
+KPX period space -110
+KPX period quoteright -120
+KPX period quotedblright -120
+
+KPX quotedblleft quoteleft -35
+KPX quotedblleft A -100
+
+KPX quotedblright space -110
+
+KPX quoteleft quoteleft -203
+KPX quoteleft A -100
+
+KPX quoteright v -30
+KPX quoteright t 10
+KPX quoteright space -110
+KPX quoteright s -15
+KPX quoteright r -20
+KPX quoteright quoteright -203
+KPX quoteright quotedblright -35
+KPX quoteright d -110
+
+KPX r y 40
+KPX r v 40
+KPX r u 20
+KPX r t 20
+KPX r s 20
+KPX r q -8
+KPX r period -73
+KPX r p 20
+KPX r o -20
+KPX r n 21
+KPX r m 28
+KPX r l 20
+KPX r k 20
+KPX r i 20
+KPX r hyphen -60
+KPX r g -15
+KPX r e -4
+KPX r d -6
+KPX r comma -75
+KPX r c -20
+KPX r a -20
+
+KPX s period 20
+KPX s comma 20
+
+KPX space quoteleft -110
+KPX space quotedblleft -110
+KPX space Y -60
+KPX space W -25
+KPX space V -50
+KPX space T -25
+KPX space A -20
+
+KPX v period -130
+KPX v o -30
+KPX v e -20
+KPX v comma -100
+KPX v a -30
+
+KPX w period -100
+KPX w o -30
+KPX w h 15
+KPX w e -20
+KPX w comma -90
+KPX w a -30
+
+KPX y period -125
+KPX y o -30
+KPX y e -20
+KPX y comma -110
+KPX y a -30
+EndKernPairs
+EndKernData
+StartComposites 56
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 213 163 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 149 163 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 216 163 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 211 163 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 231 148 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 181 163 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 111 163 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 47 163 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 114 163 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 109 163 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute -4 163 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -108 163 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -41 163 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave -86 163 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 181 163 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 277 163 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 214 163 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 280 163 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 276 163 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 245 163 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 28 163 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 190 163 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 107 163 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 173 163 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 149 163 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 159 163 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 142 163 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 19 163 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 154 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 91 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 157 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 153 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 176 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 122 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 138 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 74 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 141 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 136 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -47 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -151 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -84 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -129 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 86 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 140 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 77 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 143 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 139 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 108 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron -57 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 137 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 53 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 120 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 95 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 101 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 84 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron -38 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pbkd8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pbkd8a.afm
new file mode 100644
index 0000000..036be6d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pbkd8a.afm
@@ -0,0 +1,415 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1992 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Tue Jan 21 16:13:29 1992
+Comment UniqueID 37831
+Comment VMusage 31983 38875
+FontName Bookman-Demi
+FullName ITC Bookman Demi
+FamilyName ITC Bookman
+Weight Demi
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -194 -250 1346 934
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.004
+Notice Copyright (c) 1985, 1987, 1989, 1992 Adobe Systems Incorporated. All Rights Reserved.ITC Bookman is a registered trademark of International Typeface Corporation.
+EncodingScheme AdobeStandardEncoding
+CapHeight 681
+XHeight 502
+Ascender 725
+Descender -212
+StartCharMetrics 228
+C 32 ; WX 340 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 360 ; N exclam ; B 82 -8 282 698 ;
+C 34 ; WX 420 ; N quotedbl ; B 11 379 369 698 ;
+C 35 ; WX 660 ; N numbersign ; B 84 0 576 681 ;
+C 36 ; WX 660 ; N dollar ; B 48 -119 620 805 ;
+C 37 ; WX 940 ; N percent ; B 12 -8 924 698 ;
+C 38 ; WX 800 ; N ampersand ; B 21 -17 772 698 ;
+C 39 ; WX 320 ; N quoteright ; B 82 440 242 698 ;
+C 40 ; WX 320 ; N parenleft ; B 48 -150 289 749 ;
+C 41 ; WX 320 ; N parenright ; B 20 -150 262 749 ;
+C 42 ; WX 460 ; N asterisk ; B 62 317 405 697 ;
+C 43 ; WX 600 ; N plus ; B 51 9 555 514 ;
+C 44 ; WX 340 ; N comma ; B 78 -124 257 162 ;
+C 45 ; WX 360 ; N hyphen ; B 20 210 340 318 ;
+C 46 ; WX 340 ; N period ; B 76 -8 258 172 ;
+C 47 ; WX 600 ; N slash ; B 50 -149 555 725 ;
+C 48 ; WX 660 ; N zero ; B 30 -17 639 698 ;
+C 49 ; WX 660 ; N one ; B 137 0 568 681 ;
+C 50 ; WX 660 ; N two ; B 41 0 628 698 ;
+C 51 ; WX 660 ; N three ; B 37 -17 631 698 ;
+C 52 ; WX 660 ; N four ; B 19 0 649 681 ;
+C 53 ; WX 660 ; N five ; B 44 -17 623 723 ;
+C 54 ; WX 660 ; N six ; B 34 -17 634 698 ;
+C 55 ; WX 660 ; N seven ; B 36 0 632 681 ;
+C 56 ; WX 660 ; N eight ; B 36 -17 633 698 ;
+C 57 ; WX 660 ; N nine ; B 33 -17 636 698 ;
+C 58 ; WX 340 ; N colon ; B 76 -8 258 515 ;
+C 59 ; WX 340 ; N semicolon ; B 75 -124 259 515 ;
+C 60 ; WX 600 ; N less ; B 49 -9 558 542 ;
+C 61 ; WX 600 ; N equal ; B 51 109 555 421 ;
+C 62 ; WX 600 ; N greater ; B 48 -9 557 542 ;
+C 63 ; WX 660 ; N question ; B 61 -8 608 698 ;
+C 64 ; WX 820 ; N at ; B 60 -17 758 698 ;
+C 65 ; WX 720 ; N A ; B -34 0 763 681 ;
+C 66 ; WX 720 ; N B ; B 20 0 693 681 ;
+C 67 ; WX 740 ; N C ; B 35 -17 724 698 ;
+C 68 ; WX 780 ; N D ; B 20 0 748 681 ;
+C 69 ; WX 720 ; N E ; B 20 0 724 681 ;
+C 70 ; WX 680 ; N F ; B 20 0 686 681 ;
+C 71 ; WX 780 ; N G ; B 35 -17 773 698 ;
+C 72 ; WX 820 ; N H ; B 20 0 800 681 ;
+C 73 ; WX 400 ; N I ; B 20 0 379 681 ;
+C 74 ; WX 640 ; N J ; B -12 -17 622 681 ;
+C 75 ; WX 800 ; N K ; B 20 0 796 681 ;
+C 76 ; WX 640 ; N L ; B 20 0 668 681 ;
+C 77 ; WX 940 ; N M ; B 20 0 924 681 ;
+C 78 ; WX 740 ; N N ; B 20 0 724 681 ;
+C 79 ; WX 800 ; N O ; B 35 -17 769 698 ;
+C 80 ; WX 660 ; N P ; B 20 0 658 681 ;
+C 81 ; WX 800 ; N Q ; B 35 -226 775 698 ;
+C 82 ; WX 780 ; N R ; B 20 0 783 681 ;
+C 83 ; WX 660 ; N S ; B 21 -17 639 698 ;
+C 84 ; WX 700 ; N T ; B -4 0 703 681 ;
+C 85 ; WX 740 ; N U ; B 15 -17 724 681 ;
+C 86 ; WX 720 ; N V ; B -20 0 730 681 ;
+C 87 ; WX 940 ; N W ; B -20 0 963 681 ;
+C 88 ; WX 780 ; N X ; B 1 0 770 681 ;
+C 89 ; WX 700 ; N Y ; B -20 0 718 681 ;
+C 90 ; WX 640 ; N Z ; B 6 0 635 681 ;
+C 91 ; WX 300 ; N bracketleft ; B 75 -138 285 725 ;
+C 92 ; WX 600 ; N backslash ; B 50 0 555 725 ;
+C 93 ; WX 300 ; N bracketright ; B 21 -138 231 725 ;
+C 94 ; WX 600 ; N asciicircum ; B 52 281 554 681 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 320 ; N quoteleft ; B 82 440 242 698 ;
+C 97 ; WX 580 ; N a ; B 28 -8 588 515 ;
+C 98 ; WX 600 ; N b ; B -20 -8 568 725 ;
+C 99 ; WX 580 ; N c ; B 31 -8 550 515 ;
+C 100 ; WX 640 ; N d ; B 31 -8 622 725 ;
+C 101 ; WX 580 ; N e ; B 31 -8 548 515 ;
+C 102 ; WX 380 ; N f ; B 22 0 461 741 ; L i fi ; L l fl ;
+C 103 ; WX 580 ; N g ; B 9 -243 583 595 ;
+C 104 ; WX 680 ; N h ; B 22 0 654 725 ;
+C 105 ; WX 360 ; N i ; B 22 0 335 729 ;
+C 106 ; WX 340 ; N j ; B -94 -221 278 729 ;
+C 107 ; WX 660 ; N k ; B 22 0 643 725 ;
+C 108 ; WX 340 ; N l ; B 9 0 322 725 ;
+C 109 ; WX 1000 ; N m ; B 22 0 980 515 ;
+C 110 ; WX 680 ; N n ; B 22 0 652 515 ;
+C 111 ; WX 620 ; N o ; B 31 -8 585 515 ;
+C 112 ; WX 640 ; N p ; B 22 -212 611 515 ;
+C 113 ; WX 620 ; N q ; B 31 -212 633 515 ;
+C 114 ; WX 460 ; N r ; B 22 0 462 502 ;
+C 115 ; WX 520 ; N s ; B 22 -8 492 515 ;
+C 116 ; WX 460 ; N t ; B 22 -8 445 660 ;
+C 117 ; WX 660 ; N u ; B 22 -8 653 502 ;
+C 118 ; WX 600 ; N v ; B -6 0 593 502 ;
+C 119 ; WX 800 ; N w ; B -6 0 810 502 ;
+C 120 ; WX 600 ; N x ; B 8 0 591 502 ;
+C 121 ; WX 620 ; N y ; B 6 -221 613 502 ;
+C 122 ; WX 560 ; N z ; B 22 0 547 502 ;
+C 123 ; WX 320 ; N braceleft ; B 14 -139 301 726 ;
+C 124 ; WX 600 ; N bar ; B 243 -250 362 750 ;
+C 125 ; WX 320 ; N braceright ; B 15 -140 302 725 ;
+C 126 ; WX 600 ; N asciitilde ; B 51 162 555 368 ;
+C 161 ; WX 360 ; N exclamdown ; B 84 -191 284 515 ;
+C 162 ; WX 660 ; N cent ; B 133 17 535 674 ;
+C 163 ; WX 660 ; N sterling ; B 10 -17 659 698 ;
+C 164 ; WX 120 ; N fraction ; B -194 0 312 681 ;
+C 165 ; WX 660 ; N yen ; B -28 0 696 681 ;
+C 166 ; WX 660 ; N florin ; B -46 -209 674 749 ;
+C 167 ; WX 600 ; N section ; B 36 -153 560 698 ;
+C 168 ; WX 660 ; N currency ; B 77 88 584 593 ;
+C 169 ; WX 240 ; N quotesingle ; B 42 379 178 698 ;
+C 170 ; WX 540 ; N quotedblleft ; B 82 439 449 698 ;
+C 171 ; WX 400 ; N guillemotleft ; B 34 101 360 457 ;
+C 172 ; WX 220 ; N guilsinglleft ; B 34 101 188 457 ;
+C 173 ; WX 220 ; N guilsinglright ; B 34 101 188 457 ;
+C 174 ; WX 740 ; N fi ; B 22 0 710 741 ;
+C 175 ; WX 740 ; N fl ; B 22 0 710 741 ;
+C 177 ; WX 500 ; N endash ; B -25 212 525 318 ;
+C 178 ; WX 440 ; N dagger ; B 33 -156 398 698 ;
+C 179 ; WX 380 ; N daggerdbl ; B 8 -156 380 698 ;
+C 180 ; WX 340 ; N periodcentered ; B 76 175 258 355 ;
+C 182 ; WX 800 ; N paragraph ; B 51 0 698 681 ;
+C 183 ; WX 460 ; N bullet ; B 60 170 404 511 ;
+C 184 ; WX 320 ; N quotesinglbase ; B 82 -114 242 144 ;
+C 185 ; WX 540 ; N quotedblbase ; B 82 -114 450 144 ;
+C 186 ; WX 540 ; N quotedblright ; B 82 440 449 698 ;
+C 187 ; WX 400 ; N guillemotright ; B 34 101 360 457 ;
+C 188 ; WX 1000 ; N ellipsis ; B 76 -8 924 172 ;
+C 189 ; WX 1360 ; N perthousand ; B 12 -8 1346 698 ;
+C 191 ; WX 660 ; N questiondown ; B 62 -191 609 515 ;
+C 193 ; WX 400 ; N grave ; B 68 547 327 730 ;
+C 194 ; WX 400 ; N acute ; B 68 547 327 731 ;
+C 195 ; WX 500 ; N circumflex ; B 68 555 430 731 ;
+C 196 ; WX 480 ; N tilde ; B 69 556 421 691 ;
+C 197 ; WX 460 ; N macron ; B 68 577 383 663 ;
+C 198 ; WX 500 ; N breve ; B 68 553 429 722 ;
+C 199 ; WX 320 ; N dotaccent ; B 68 536 259 730 ;
+C 200 ; WX 500 ; N dieresis ; B 68 560 441 698 ;
+C 202 ; WX 340 ; N ring ; B 68 552 275 755 ;
+C 203 ; WX 360 ; N cedilla ; B 68 -213 284 0 ;
+C 205 ; WX 440 ; N hungarumlaut ; B 68 554 365 741 ;
+C 206 ; WX 320 ; N ogonek ; B 68 -163 246 0 ;
+C 207 ; WX 500 ; N caron ; B 68 541 430 717 ;
+C 208 ; WX 1000 ; N emdash ; B -25 212 1025 318 ;
+C 225 ; WX 1140 ; N AE ; B -34 0 1149 681 ;
+C 227 ; WX 400 ; N ordfeminine ; B 27 383 396 698 ;
+C 232 ; WX 640 ; N Lslash ; B 20 0 668 681 ;
+C 233 ; WX 800 ; N Oslash ; B 35 -110 771 781 ;
+C 234 ; WX 1220 ; N OE ; B 35 -17 1219 698 ;
+C 235 ; WX 400 ; N ordmasculine ; B 17 383 383 698 ;
+C 241 ; WX 880 ; N ae ; B 28 -8 852 515 ;
+C 245 ; WX 360 ; N dotlessi ; B 22 0 335 502 ;
+C 248 ; WX 340 ; N lslash ; B 9 0 322 725 ;
+C 249 ; WX 620 ; N oslash ; B 31 -40 586 551 ;
+C 250 ; WX 940 ; N oe ; B 31 -8 908 515 ;
+C 251 ; WX 660 ; N germandbls ; B -61 -91 644 699 ;
+C -1 ; WX 580 ; N ecircumflex ; B 31 -8 548 731 ;
+C -1 ; WX 580 ; N edieresis ; B 31 -8 548 698 ;
+C -1 ; WX 580 ; N aacute ; B 28 -8 588 731 ;
+C -1 ; WX 740 ; N registered ; B 23 -17 723 698 ;
+C -1 ; WX 360 ; N icircumflex ; B -2 0 360 731 ;
+C -1 ; WX 660 ; N udieresis ; B 22 -8 653 698 ;
+C -1 ; WX 620 ; N ograve ; B 31 -8 585 730 ;
+C -1 ; WX 660 ; N uacute ; B 22 -8 653 731 ;
+C -1 ; WX 660 ; N ucircumflex ; B 22 -8 653 731 ;
+C -1 ; WX 720 ; N Aacute ; B -34 0 763 910 ;
+C -1 ; WX 360 ; N igrave ; B 22 0 335 730 ;
+C -1 ; WX 400 ; N Icircumflex ; B 18 0 380 910 ;
+C -1 ; WX 580 ; N ccedilla ; B 31 -213 550 515 ;
+C -1 ; WX 580 ; N adieresis ; B 28 -8 588 698 ;
+C -1 ; WX 720 ; N Ecircumflex ; B 20 0 724 910 ;
+C -1 ; WX 520 ; N scaron ; B 22 -8 492 717 ;
+C -1 ; WX 640 ; N thorn ; B 22 -212 611 725 ;
+C -1 ; WX 980 ; N trademark ; B 42 277 982 681 ;
+C -1 ; WX 580 ; N egrave ; B 31 -8 548 730 ;
+C -1 ; WX 396 ; N threesuperior ; B 5 269 391 698 ;
+C -1 ; WX 560 ; N zcaron ; B 22 0 547 717 ;
+C -1 ; WX 580 ; N atilde ; B 28 -8 588 691 ;
+C -1 ; WX 580 ; N aring ; B 28 -8 588 755 ;
+C -1 ; WX 620 ; N ocircumflex ; B 31 -8 585 731 ;
+C -1 ; WX 720 ; N Edieresis ; B 20 0 724 877 ;
+C -1 ; WX 990 ; N threequarters ; B 15 0 967 692 ;
+C -1 ; WX 620 ; N ydieresis ; B 6 -221 613 698 ;
+C -1 ; WX 620 ; N yacute ; B 6 -221 613 731 ;
+C -1 ; WX 360 ; N iacute ; B 22 0 335 731 ;
+C -1 ; WX 720 ; N Acircumflex ; B -34 0 763 910 ;
+C -1 ; WX 740 ; N Uacute ; B 15 -17 724 910 ;
+C -1 ; WX 580 ; N eacute ; B 31 -8 548 731 ;
+C -1 ; WX 800 ; N Ograve ; B 35 -17 769 909 ;
+C -1 ; WX 580 ; N agrave ; B 28 -8 588 730 ;
+C -1 ; WX 740 ; N Udieresis ; B 15 -17 724 877 ;
+C -1 ; WX 580 ; N acircumflex ; B 28 -8 588 731 ;
+C -1 ; WX 400 ; N Igrave ; B 20 0 379 909 ;
+C -1 ; WX 396 ; N twosuperior ; B 14 279 396 698 ;
+C -1 ; WX 740 ; N Ugrave ; B 15 -17 724 909 ;
+C -1 ; WX 990 ; N onequarter ; B 65 0 967 681 ;
+C -1 ; WX 740 ; N Ucircumflex ; B 15 -17 724 910 ;
+C -1 ; WX 660 ; N Scaron ; B 21 -17 639 896 ;
+C -1 ; WX 400 ; N Idieresis ; B 18 0 391 877 ;
+C -1 ; WX 360 ; N idieresis ; B -2 0 371 698 ;
+C -1 ; WX 720 ; N Egrave ; B 20 0 724 909 ;
+C -1 ; WX 800 ; N Oacute ; B 35 -17 769 910 ;
+C -1 ; WX 600 ; N divide ; B 51 9 555 521 ;
+C -1 ; WX 720 ; N Atilde ; B -34 0 763 870 ;
+C -1 ; WX 720 ; N Aring ; B -34 0 763 934 ;
+C -1 ; WX 800 ; N Odieresis ; B 35 -17 769 877 ;
+C -1 ; WX 720 ; N Adieresis ; B -34 0 763 877 ;
+C -1 ; WX 740 ; N Ntilde ; B 20 0 724 870 ;
+C -1 ; WX 640 ; N Zcaron ; B 6 0 635 896 ;
+C -1 ; WX 660 ; N Thorn ; B 20 0 658 681 ;
+C -1 ; WX 400 ; N Iacute ; B 20 0 379 910 ;
+C -1 ; WX 600 ; N plusminus ; B 51 0 555 514 ;
+C -1 ; WX 600 ; N multiply ; B 48 10 552 514 ;
+C -1 ; WX 720 ; N Eacute ; B 20 0 724 910 ;
+C -1 ; WX 700 ; N Ydieresis ; B -20 0 718 877 ;
+C -1 ; WX 396 ; N onesuperior ; B 65 279 345 687 ;
+C -1 ; WX 660 ; N ugrave ; B 22 -8 653 730 ;
+C -1 ; WX 600 ; N logicalnot ; B 51 129 555 421 ;
+C -1 ; WX 680 ; N ntilde ; B 22 0 652 691 ;
+C -1 ; WX 800 ; N Otilde ; B 35 -17 769 870 ;
+C -1 ; WX 620 ; N otilde ; B 31 -8 585 691 ;
+C -1 ; WX 740 ; N Ccedilla ; B 35 -213 724 698 ;
+C -1 ; WX 720 ; N Agrave ; B -34 0 763 909 ;
+C -1 ; WX 990 ; N onehalf ; B 65 0 980 681 ;
+C -1 ; WX 780 ; N Eth ; B 20 0 748 681 ;
+C -1 ; WX 400 ; N degree ; B 50 398 350 698 ;
+C -1 ; WX 700 ; N Yacute ; B -20 0 718 910 ;
+C -1 ; WX 800 ; N Ocircumflex ; B 35 -17 769 910 ;
+C -1 ; WX 620 ; N oacute ; B 31 -8 585 731 ;
+C -1 ; WX 660 ; N mu ; B 22 -221 653 502 ;
+C -1 ; WX 600 ; N minus ; B 51 207 555 323 ;
+C -1 ; WX 620 ; N eth ; B 31 -8 585 741 ;
+C -1 ; WX 620 ; N odieresis ; B 31 -8 585 698 ;
+C -1 ; WX 740 ; N copyright ; B 23 -17 723 698 ;
+C -1 ; WX 600 ; N brokenbar ; B 243 -175 362 675 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 90
+
+KPX A y -1
+KPX A w -9
+KPX A v -8
+KPX A Y -52
+KPX A W -20
+KPX A V -68
+KPX A T -40
+
+KPX F period -132
+KPX F comma -130
+KPX F A -59
+
+KPX L y 19
+KPX L Y -35
+KPX L W -41
+KPX L V -50
+KPX L T -4
+
+KPX P period -128
+KPX P comma -129
+KPX P A -46
+
+KPX R y -8
+KPX R Y -20
+KPX R W -24
+KPX R V -29
+KPX R T -4
+
+KPX T semicolon 5
+KPX T s -10
+KPX T r 27
+KPX T period -122
+KPX T o -28
+KPX T i 27
+KPX T hyphen -10
+KPX T e -29
+KPX T comma -122
+KPX T colon 7
+KPX T c -29
+KPX T a -24
+KPX T A -42
+
+KPX V y 12
+KPX V u -11
+KPX V semicolon -38
+KPX V r -15
+KPX V period -105
+KPX V o -79
+KPX V i 15
+KPX V hyphen -10
+KPX V e -80
+KPX V comma -103
+KPX V colon -37
+KPX V a -74
+KPX V A -88
+
+KPX W y 12
+KPX W u -11
+KPX W semicolon -38
+KPX W r -15
+KPX W period -105
+KPX W o -78
+KPX W i 15
+KPX W hyphen -10
+KPX W e -79
+KPX W comma -103
+KPX W colon -37
+KPX W a -73
+KPX W A -60
+
+KPX Y v 24
+KPX Y u -13
+KPX Y semicolon -34
+KPX Y q -66
+KPX Y period -105
+KPX Y p -23
+KPX Y o -66
+KPX Y i 2
+KPX Y hyphen -10
+KPX Y e -67
+KPX Y comma -103
+KPX Y colon -32
+KPX Y a -60
+KPX Y A -56
+
+KPX f f 21
+
+KPX r q -9
+KPX r period -102
+KPX r o -9
+KPX r n 20
+KPX r m 20
+KPX r hyphen -10
+KPX r h -23
+KPX r g -9
+KPX r f 20
+KPX r e -10
+KPX r d -10
+KPX r comma -101
+KPX r c -9
+EndKernPairs
+EndKernData
+StartComposites 56
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 160 179 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 110 179 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 110 179 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 160 179 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 190 179 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 120 179 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 160 179 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 110 179 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 110 179 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 160 179 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 0 179 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -50 179 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -50 179 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 0 179 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 130 179 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 200 179 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 150 179 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 150 179 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 200 179 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 160 179 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 80 179 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 170 179 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 120 179 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 120 179 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 170 179 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 150 179 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 100 179 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 70 179 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 90 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 40 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 40 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 90 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 100 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 30 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 90 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 40 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 40 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 90 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -20 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -70 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -70 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -20 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 80 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 110 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 60 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 60 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 110 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 50 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 10 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 130 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 80 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 80 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 130 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 110 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 60 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 30 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pbkdi8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pbkdi8a.afm
new file mode 100644
index 0000000..c2da47a
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pbkdi8a.afm
@@ -0,0 +1,417 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1992 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Tue Jan 21 16:12:43 1992
+Comment UniqueID 37832
+Comment VMusage 32139 39031
+FontName Bookman-DemiItalic
+FullName ITC Bookman Demi Italic
+FamilyName ITC Bookman
+Weight Demi
+ItalicAngle -10
+IsFixedPitch false
+FontBBox -231 -250 1333 941
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.004
+Notice Copyright (c) 1985, 1987, 1989, 1992 Adobe Systems Incorporated. All Rights Reserved.ITC Bookman is a registered trademark of International Typeface Corporation.
+EncodingScheme AdobeStandardEncoding
+CapHeight 681
+XHeight 515
+Ascender 732
+Descender -213
+StartCharMetrics 228
+C 32 ; WX 340 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 320 ; N exclam ; B 86 -8 366 698 ;
+C 34 ; WX 380 ; N quotedbl ; B 140 371 507 697 ;
+C 35 ; WX 680 ; N numbersign ; B 157 0 649 681 ;
+C 36 ; WX 680 ; N dollar ; B 45 -164 697 790 ;
+C 37 ; WX 880 ; N percent ; B 106 -17 899 698 ;
+C 38 ; WX 980 ; N ampersand ; B 48 -17 1016 698 ;
+C 39 ; WX 320 ; N quoteright ; B 171 420 349 698 ;
+C 40 ; WX 260 ; N parenleft ; B 31 -134 388 741 ;
+C 41 ; WX 260 ; N parenright ; B -35 -134 322 741 ;
+C 42 ; WX 460 ; N asterisk ; B 126 346 508 698 ;
+C 43 ; WX 600 ; N plus ; B 91 9 595 514 ;
+C 44 ; WX 340 ; N comma ; B 100 -124 298 185 ;
+C 45 ; WX 280 ; N hyphen ; B 59 218 319 313 ;
+C 46 ; WX 340 ; N period ; B 106 -8 296 177 ;
+C 47 ; WX 360 ; N slash ; B 9 -106 502 742 ;
+C 48 ; WX 680 ; N zero ; B 87 -17 703 698 ;
+C 49 ; WX 680 ; N one ; B 123 0 565 681 ;
+C 50 ; WX 680 ; N two ; B 67 0 674 698 ;
+C 51 ; WX 680 ; N three ; B 72 -17 683 698 ;
+C 52 ; WX 680 ; N four ; B 63 0 708 681 ;
+C 53 ; WX 680 ; N five ; B 78 -17 669 681 ;
+C 54 ; WX 680 ; N six ; B 88 -17 704 698 ;
+C 55 ; WX 680 ; N seven ; B 123 0 739 681 ;
+C 56 ; WX 680 ; N eight ; B 68 -17 686 698 ;
+C 57 ; WX 680 ; N nine ; B 71 -17 712 698 ;
+C 58 ; WX 340 ; N colon ; B 106 -8 356 515 ;
+C 59 ; WX 340 ; N semicolon ; B 100 -124 352 515 ;
+C 60 ; WX 620 ; N less ; B 79 -9 588 540 ;
+C 61 ; WX 600 ; N equal ; B 91 109 595 421 ;
+C 62 ; WX 620 ; N greater ; B 89 -9 598 540 ;
+C 63 ; WX 620 ; N question ; B 145 -8 668 698 ;
+C 64 ; WX 780 ; N at ; B 80 -17 790 698 ;
+C 65 ; WX 720 ; N A ; B -27 0 769 681 ;
+C 66 ; WX 720 ; N B ; B 14 0 762 681 ;
+C 67 ; WX 700 ; N C ; B 78 -17 754 698 ;
+C 68 ; WX 760 ; N D ; B 14 0 805 681 ;
+C 69 ; WX 720 ; N E ; B 14 0 777 681 ;
+C 70 ; WX 660 ; N F ; B 14 0 763 681 ;
+C 71 ; WX 760 ; N G ; B 77 -17 828 698 ;
+C 72 ; WX 800 ; N H ; B 14 0 910 681 ;
+C 73 ; WX 380 ; N I ; B 14 0 485 681 ;
+C 74 ; WX 620 ; N J ; B 8 -17 721 681 ;
+C 75 ; WX 780 ; N K ; B 14 0 879 681 ;
+C 76 ; WX 640 ; N L ; B 14 0 725 681 ;
+C 77 ; WX 860 ; N M ; B 14 0 970 681 ;
+C 78 ; WX 740 ; N N ; B 14 0 845 681 ;
+C 79 ; WX 760 ; N O ; B 78 -17 806 698 ;
+C 80 ; WX 640 ; N P ; B -6 0 724 681 ;
+C 81 ; WX 760 ; N Q ; B 37 -213 805 698 ;
+C 82 ; WX 740 ; N R ; B 14 0 765 681 ;
+C 83 ; WX 700 ; N S ; B 59 -17 731 698 ;
+C 84 ; WX 700 ; N T ; B 70 0 802 681 ;
+C 85 ; WX 740 ; N U ; B 112 -17 855 681 ;
+C 86 ; WX 660 ; N V ; B 72 0 819 681 ;
+C 87 ; WX 1000 ; N W ; B 72 0 1090 681 ;
+C 88 ; WX 740 ; N X ; B -7 0 835 681 ;
+C 89 ; WX 660 ; N Y ; B 72 0 817 681 ;
+C 90 ; WX 680 ; N Z ; B 23 0 740 681 ;
+C 91 ; WX 260 ; N bracketleft ; B 9 -118 374 741 ;
+C 92 ; WX 580 ; N backslash ; B 73 0 575 741 ;
+C 93 ; WX 260 ; N bracketright ; B -18 -118 347 741 ;
+C 94 ; WX 620 ; N asciicircum ; B 92 281 594 681 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 320 ; N quoteleft ; B 155 420 333 698 ;
+C 97 ; WX 680 ; N a ; B 84 -8 735 515 ;
+C 98 ; WX 600 ; N b ; B 57 -8 633 732 ;
+C 99 ; WX 560 ; N c ; B 58 -8 597 515 ;
+C 100 ; WX 680 ; N d ; B 60 -8 714 732 ;
+C 101 ; WX 560 ; N e ; B 59 -8 596 515 ;
+C 102 ; WX 420 ; N f ; B -192 -213 641 741 ; L i fi ; L l fl ;
+C 103 ; WX 620 ; N g ; B 21 -213 669 515 ;
+C 104 ; WX 700 ; N h ; B 93 -8 736 732 ;
+C 105 ; WX 380 ; N i ; B 83 -8 420 755 ;
+C 106 ; WX 320 ; N j ; B -160 -213 392 755 ;
+C 107 ; WX 700 ; N k ; B 97 -8 732 732 ;
+C 108 ; WX 380 ; N l ; B 109 -8 410 732 ;
+C 109 ; WX 960 ; N m ; B 83 -8 996 515 ;
+C 110 ; WX 680 ; N n ; B 83 -8 715 515 ;
+C 111 ; WX 600 ; N o ; B 59 -8 627 515 ;
+C 112 ; WX 660 ; N p ; B -24 -213 682 515 ;
+C 113 ; WX 620 ; N q ; B 60 -213 640 515 ;
+C 114 ; WX 500 ; N r ; B 84 0 582 515 ;
+C 115 ; WX 540 ; N s ; B 32 -8 573 515 ;
+C 116 ; WX 440 ; N t ; B 106 -8 488 658 ;
+C 117 ; WX 680 ; N u ; B 83 -8 720 507 ;
+C 118 ; WX 540 ; N v ; B 56 -8 572 515 ;
+C 119 ; WX 860 ; N w ; B 56 -8 891 515 ;
+C 120 ; WX 620 ; N x ; B 10 -8 654 515 ;
+C 121 ; WX 600 ; N y ; B 25 -213 642 507 ;
+C 122 ; WX 560 ; N z ; B 36 -8 586 515 ;
+C 123 ; WX 300 ; N braceleft ; B 49 -123 413 742 ;
+C 124 ; WX 620 ; N bar ; B 303 -250 422 750 ;
+C 125 ; WX 300 ; N braceright ; B -8 -114 356 751 ;
+C 126 ; WX 620 ; N asciitilde ; B 101 162 605 368 ;
+C 161 ; WX 320 ; N exclamdown ; B 64 -191 344 515 ;
+C 162 ; WX 680 ; N cent ; B 161 25 616 718 ;
+C 163 ; WX 680 ; N sterling ; B 0 -17 787 698 ;
+C 164 ; WX 120 ; N fraction ; B -144 0 382 681 ;
+C 165 ; WX 680 ; N yen ; B 92 0 782 681 ;
+C 166 ; WX 680 ; N florin ; B -28 -199 743 741 ;
+C 167 ; WX 620 ; N section ; B 46 -137 638 698 ;
+C 168 ; WX 680 ; N currency ; B 148 85 637 571 ;
+C 169 ; WX 180 ; N quotesingle ; B 126 370 295 696 ;
+C 170 ; WX 520 ; N quotedblleft ; B 156 420 545 698 ;
+C 171 ; WX 380 ; N guillemotleft ; B 62 84 406 503 ;
+C 172 ; WX 220 ; N guilsinglleft ; B 62 84 249 503 ;
+C 173 ; WX 220 ; N guilsinglright ; B 62 84 249 503 ;
+C 174 ; WX 820 ; N fi ; B -191 -213 850 741 ;
+C 175 ; WX 820 ; N fl ; B -191 -213 850 741 ;
+C 177 ; WX 500 ; N endash ; B 40 219 573 311 ;
+C 178 ; WX 420 ; N dagger ; B 89 -137 466 698 ;
+C 179 ; WX 420 ; N daggerdbl ; B 79 -137 486 698 ;
+C 180 ; WX 340 ; N periodcentered ; B 126 173 316 358 ;
+C 182 ; WX 680 ; N paragraph ; B 137 0 715 681 ;
+C 183 ; WX 360 ; N bullet ; B 60 170 404 511 ;
+C 184 ; WX 300 ; N quotesinglbase ; B 106 -112 284 166 ;
+C 185 ; WX 520 ; N quotedblbase ; B 106 -112 495 166 ;
+C 186 ; WX 520 ; N quotedblright ; B 171 420 560 698 ;
+C 187 ; WX 380 ; N guillemotright ; B 62 84 406 503 ;
+C 188 ; WX 1000 ; N ellipsis ; B 86 -8 942 177 ;
+C 189 ; WX 1360 ; N perthousand ; B 106 -17 1333 698 ;
+C 191 ; WX 620 ; N questiondown ; B 83 -189 606 515 ;
+C 193 ; WX 380 ; N grave ; B 193 566 424 771 ;
+C 194 ; WX 340 ; N acute ; B 176 566 407 771 ;
+C 195 ; WX 480 ; N circumflex ; B 183 582 523 749 ;
+C 196 ; WX 480 ; N tilde ; B 178 587 533 709 ;
+C 197 ; WX 480 ; N macron ; B 177 603 531 691 ;
+C 198 ; WX 460 ; N breve ; B 177 577 516 707 ;
+C 199 ; WX 380 ; N dotaccent ; B 180 570 345 734 ;
+C 200 ; WX 520 ; N dieresis ; B 180 570 569 734 ;
+C 202 ; WX 360 ; N ring ; B 185 558 406 775 ;
+C 203 ; WX 360 ; N cedilla ; B 68 -220 289 -8 ;
+C 205 ; WX 560 ; N hungarumlaut ; B 181 560 616 775 ;
+C 206 ; WX 320 ; N ogonek ; B 68 -182 253 0 ;
+C 207 ; WX 480 ; N caron ; B 183 582 523 749 ;
+C 208 ; WX 1000 ; N emdash ; B 40 219 1073 311 ;
+C 225 ; WX 1140 ; N AE ; B -27 0 1207 681 ;
+C 227 ; WX 440 ; N ordfeminine ; B 118 400 495 685 ;
+C 232 ; WX 640 ; N Lslash ; B 14 0 724 681 ;
+C 233 ; WX 760 ; N Oslash ; B 21 -29 847 725 ;
+C 234 ; WX 1180 ; N OE ; B 94 -17 1245 698 ;
+C 235 ; WX 440 ; N ordmasculine ; B 127 400 455 685 ;
+C 241 ; WX 880 ; N ae ; B 39 -8 913 515 ;
+C 245 ; WX 380 ; N dotlessi ; B 83 -8 420 507 ;
+C 248 ; WX 380 ; N lslash ; B 63 -8 412 732 ;
+C 249 ; WX 600 ; N oslash ; B 17 -54 661 571 ;
+C 250 ; WX 920 ; N oe ; B 48 -8 961 515 ;
+C 251 ; WX 660 ; N germandbls ; B -231 -213 702 741 ;
+C -1 ; WX 560 ; N ecircumflex ; B 59 -8 596 749 ;
+C -1 ; WX 560 ; N edieresis ; B 59 -8 596 734 ;
+C -1 ; WX 680 ; N aacute ; B 84 -8 735 771 ;
+C -1 ; WX 780 ; N registered ; B 83 -17 783 698 ;
+C -1 ; WX 380 ; N icircumflex ; B 83 -8 433 749 ;
+C -1 ; WX 680 ; N udieresis ; B 83 -8 720 734 ;
+C -1 ; WX 600 ; N ograve ; B 59 -8 627 771 ;
+C -1 ; WX 680 ; N uacute ; B 83 -8 720 771 ;
+C -1 ; WX 680 ; N ucircumflex ; B 83 -8 720 749 ;
+C -1 ; WX 720 ; N Aacute ; B -27 0 769 937 ;
+C -1 ; WX 380 ; N igrave ; B 83 -8 424 771 ;
+C -1 ; WX 380 ; N Icircumflex ; B 14 0 493 915 ;
+C -1 ; WX 560 ; N ccedilla ; B 58 -220 597 515 ;
+C -1 ; WX 680 ; N adieresis ; B 84 -8 735 734 ;
+C -1 ; WX 720 ; N Ecircumflex ; B 14 0 777 915 ;
+C -1 ; WX 540 ; N scaron ; B 32 -8 573 749 ;
+C -1 ; WX 660 ; N thorn ; B -24 -213 682 732 ;
+C -1 ; WX 940 ; N trademark ; B 42 277 982 681 ;
+C -1 ; WX 560 ; N egrave ; B 59 -8 596 771 ;
+C -1 ; WX 408 ; N threesuperior ; B 86 269 483 698 ;
+C -1 ; WX 560 ; N zcaron ; B 36 -8 586 749 ;
+C -1 ; WX 680 ; N atilde ; B 84 -8 735 709 ;
+C -1 ; WX 680 ; N aring ; B 84 -8 735 775 ;
+C -1 ; WX 600 ; N ocircumflex ; B 59 -8 627 749 ;
+C -1 ; WX 720 ; N Edieresis ; B 14 0 777 900 ;
+C -1 ; WX 1020 ; N threequarters ; B 86 0 1054 691 ;
+C -1 ; WX 600 ; N ydieresis ; B 25 -213 642 734 ;
+C -1 ; WX 600 ; N yacute ; B 25 -213 642 771 ;
+C -1 ; WX 380 ; N iacute ; B 83 -8 420 771 ;
+C -1 ; WX 720 ; N Acircumflex ; B -27 0 769 915 ;
+C -1 ; WX 740 ; N Uacute ; B 112 -17 855 937 ;
+C -1 ; WX 560 ; N eacute ; B 59 -8 596 771 ;
+C -1 ; WX 760 ; N Ograve ; B 78 -17 806 937 ;
+C -1 ; WX 680 ; N agrave ; B 84 -8 735 771 ;
+C -1 ; WX 740 ; N Udieresis ; B 112 -17 855 900 ;
+C -1 ; WX 680 ; N acircumflex ; B 84 -8 735 749 ;
+C -1 ; WX 380 ; N Igrave ; B 14 0 485 937 ;
+C -1 ; WX 408 ; N twosuperior ; B 91 279 485 698 ;
+C -1 ; WX 740 ; N Ugrave ; B 112 -17 855 937 ;
+C -1 ; WX 1020 ; N onequarter ; B 118 0 1054 681 ;
+C -1 ; WX 740 ; N Ucircumflex ; B 112 -17 855 915 ;
+C -1 ; WX 700 ; N Scaron ; B 59 -17 731 915 ;
+C -1 ; WX 380 ; N Idieresis ; B 14 0 499 900 ;
+C -1 ; WX 380 ; N idieresis ; B 83 -8 479 734 ;
+C -1 ; WX 720 ; N Egrave ; B 14 0 777 937 ;
+C -1 ; WX 760 ; N Oacute ; B 78 -17 806 937 ;
+C -1 ; WX 600 ; N divide ; B 91 9 595 521 ;
+C -1 ; WX 720 ; N Atilde ; B -27 0 769 875 ;
+C -1 ; WX 720 ; N Aring ; B -27 0 769 941 ;
+C -1 ; WX 760 ; N Odieresis ; B 78 -17 806 900 ;
+C -1 ; WX 720 ; N Adieresis ; B -27 0 769 900 ;
+C -1 ; WX 740 ; N Ntilde ; B 14 0 845 875 ;
+C -1 ; WX 680 ; N Zcaron ; B 23 0 740 915 ;
+C -1 ; WX 640 ; N Thorn ; B -6 0 701 681 ;
+C -1 ; WX 380 ; N Iacute ; B 14 0 485 937 ;
+C -1 ; WX 600 ; N plusminus ; B 91 0 595 514 ;
+C -1 ; WX 600 ; N multiply ; B 91 10 595 514 ;
+C -1 ; WX 720 ; N Eacute ; B 14 0 777 937 ;
+C -1 ; WX 660 ; N Ydieresis ; B 72 0 817 900 ;
+C -1 ; WX 408 ; N onesuperior ; B 118 279 406 688 ;
+C -1 ; WX 680 ; N ugrave ; B 83 -8 720 771 ;
+C -1 ; WX 620 ; N logicalnot ; B 81 129 585 421 ;
+C -1 ; WX 680 ; N ntilde ; B 83 -8 715 709 ;
+C -1 ; WX 760 ; N Otilde ; B 78 -17 806 875 ;
+C -1 ; WX 600 ; N otilde ; B 59 -8 627 709 ;
+C -1 ; WX 700 ; N Ccedilla ; B 78 -220 754 698 ;
+C -1 ; WX 720 ; N Agrave ; B -27 0 769 937 ;
+C -1 ; WX 1020 ; N onehalf ; B 118 0 1036 681 ;
+C -1 ; WX 760 ; N Eth ; B 14 0 805 681 ;
+C -1 ; WX 400 ; N degree ; B 130 398 430 698 ;
+C -1 ; WX 660 ; N Yacute ; B 72 0 817 937 ;
+C -1 ; WX 760 ; N Ocircumflex ; B 78 -17 806 915 ;
+C -1 ; WX 600 ; N oacute ; B 59 -8 627 771 ;
+C -1 ; WX 680 ; N mu ; B 54 -213 720 507 ;
+C -1 ; WX 600 ; N minus ; B 91 207 595 323 ;
+C -1 ; WX 600 ; N eth ; B 59 -8 662 741 ;
+C -1 ; WX 600 ; N odieresis ; B 59 -8 627 734 ;
+C -1 ; WX 780 ; N copyright ; B 83 -17 783 698 ;
+C -1 ; WX 620 ; N brokenbar ; B 303 -175 422 675 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 92
+
+KPX A y 20
+KPX A w 20
+KPX A v 20
+KPX A Y -25
+KPX A W -35
+KPX A V -40
+KPX A T -17
+
+KPX F period -105
+KPX F comma -98
+KPX F A -35
+
+KPX L y 62
+KPX L Y -5
+KPX L W -15
+KPX L V -19
+KPX L T -26
+
+KPX P period -105
+KPX P comma -98
+KPX P A -31
+
+KPX R y 27
+KPX R Y 4
+KPX R W -4
+KPX R V -8
+KPX R T -3
+
+KPX T y 56
+KPX T w 69
+KPX T u 42
+KPX T semicolon 31
+KPX T s -1
+KPX T r 41
+KPX T period -107
+KPX T o -5
+KPX T i 42
+KPX T hyphen -20
+KPX T e -10
+KPX T comma -100
+KPX T colon 26
+KPX T c -8
+KPX T a -8
+KPX T A -42
+
+KPX V y 17
+KPX V u -1
+KPX V semicolon -22
+KPX V r 2
+KPX V period -115
+KPX V o -50
+KPX V i 32
+KPX V hyphen -20
+KPX V e -50
+KPX V comma -137
+KPX V colon -28
+KPX V a -50
+KPX V A -50
+
+KPX W y -51
+KPX W u -69
+KPX W semicolon -81
+KPX W r -66
+KPX W period -183
+KPX W o -100
+KPX W i -36
+KPX W hyphen -22
+KPX W e -100
+KPX W comma -201
+KPX W colon -86
+KPX W a -100
+KPX W A -77
+
+KPX Y v 26
+KPX Y u -1
+KPX Y semicolon -4
+KPX Y q -43
+KPX Y period -113
+KPX Y o -41
+KPX Y i 20
+KPX Y hyphen -20
+KPX Y e -46
+KPX Y comma -106
+KPX Y colon -9
+KPX Y a -45
+KPX Y A -30
+
+KPX f f 10
+
+KPX r q -3
+KPX r period -120
+KPX r o -1
+KPX r n 39
+KPX r m 39
+KPX r hyphen -20
+KPX r h -35
+KPX r g -23
+KPX r f 42
+KPX r e -6
+KPX r d -3
+KPX r comma -113
+KPX r c -5
+EndKernPairs
+EndKernData
+StartComposites 56
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 190 166 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 120 166 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 100 166 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 170 166 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 200 166 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 120 166 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 190 166 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 120 166 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 100 166 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 170 166 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 20 166 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -30 166 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -70 166 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 0 166 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 130 166 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 210 166 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 140 166 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 140 166 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 190 166 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 140 166 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 110 166 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 200 166 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 130 166 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 130 166 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 180 166 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 160 166 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 70 166 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 100 166 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 170 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 100 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 80 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 150 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 160 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 100 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 110 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 60 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 20 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 90 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute 0 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -90 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -90 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave 0 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 60 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 130 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 60 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 40 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 110 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 60 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 30 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 170 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 100 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 80 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 150 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 130 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 40 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 40 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pbkl8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pbkl8a.afm
new file mode 100644
index 0000000..8b79ea7
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pbkl8a.afm
@@ -0,0 +1,407 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1992 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Tue Jan 21 16:15:53 1992
+Comment UniqueID 37833
+Comment VMusage 32321 39213
+FontName Bookman-Light
+FullName ITC Bookman Light
+FamilyName ITC Bookman
+Weight Light
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -188 -251 1266 908
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.004
+Notice Copyright (c) 1985, 1987, 1989, 1992 Adobe Systems Incorporated. All Rights Reserved.ITC Bookman is a registered trademark of International Typeface Corporation.
+EncodingScheme AdobeStandardEncoding
+CapHeight 681
+XHeight 484
+Ascender 717
+Descender -228
+StartCharMetrics 228
+C 32 ; WX 320 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 300 ; N exclam ; B 75 -8 219 698 ;
+C 34 ; WX 380 ; N quotedbl ; B 56 458 323 698 ;
+C 35 ; WX 620 ; N numbersign ; B 65 0 556 681 ;
+C 36 ; WX 620 ; N dollar ; B 34 -109 593 791 ;
+C 37 ; WX 900 ; N percent ; B 22 -8 873 698 ;
+C 38 ; WX 800 ; N ampersand ; B 45 -17 787 698 ;
+C 39 ; WX 220 ; N quoteright ; B 46 480 178 698 ;
+C 40 ; WX 300 ; N parenleft ; B 76 -145 278 727 ;
+C 41 ; WX 300 ; N parenright ; B 17 -146 219 727 ;
+C 42 ; WX 440 ; N asterisk ; B 54 325 391 698 ;
+C 43 ; WX 600 ; N plus ; B 51 8 555 513 ;
+C 44 ; WX 320 ; N comma ; B 90 -114 223 114 ;
+C 45 ; WX 400 ; N hyphen ; B 50 232 350 292 ;
+C 46 ; WX 320 ; N period ; B 92 -8 220 123 ;
+C 47 ; WX 600 ; N slash ; B 74 -149 532 717 ;
+C 48 ; WX 620 ; N zero ; B 40 -17 586 698 ;
+C 49 ; WX 620 ; N one ; B 160 0 501 681 ;
+C 50 ; WX 620 ; N two ; B 42 0 576 698 ;
+C 51 ; WX 620 ; N three ; B 40 -17 576 698 ;
+C 52 ; WX 620 ; N four ; B 25 0 600 681 ;
+C 53 ; WX 620 ; N five ; B 60 -17 584 717 ;
+C 54 ; WX 620 ; N six ; B 45 -17 590 698 ;
+C 55 ; WX 620 ; N seven ; B 60 0 586 681 ;
+C 56 ; WX 620 ; N eight ; B 44 -17 583 698 ;
+C 57 ; WX 620 ; N nine ; B 37 -17 576 698 ;
+C 58 ; WX 320 ; N colon ; B 92 -8 220 494 ;
+C 59 ; WX 320 ; N semicolon ; B 90 -114 223 494 ;
+C 60 ; WX 600 ; N less ; B 49 -2 558 526 ;
+C 61 ; WX 600 ; N equal ; B 51 126 555 398 ;
+C 62 ; WX 600 ; N greater ; B 48 -2 557 526 ;
+C 63 ; WX 540 ; N question ; B 27 -8 514 698 ;
+C 64 ; WX 820 ; N at ; B 55 -17 755 698 ;
+C 65 ; WX 680 ; N A ; B -37 0 714 681 ;
+C 66 ; WX 740 ; N B ; B 31 0 702 681 ;
+C 67 ; WX 740 ; N C ; B 44 -17 702 698 ;
+C 68 ; WX 800 ; N D ; B 31 0 752 681 ;
+C 69 ; WX 720 ; N E ; B 31 0 705 681 ;
+C 70 ; WX 640 ; N F ; B 31 0 654 681 ;
+C 71 ; WX 800 ; N G ; B 44 -17 778 698 ;
+C 72 ; WX 800 ; N H ; B 31 0 769 681 ;
+C 73 ; WX 340 ; N I ; B 31 0 301 681 ;
+C 74 ; WX 600 ; N J ; B -23 -17 567 681 ;
+C 75 ; WX 720 ; N K ; B 31 0 750 681 ;
+C 76 ; WX 600 ; N L ; B 31 0 629 681 ;
+C 77 ; WX 920 ; N M ; B 26 0 894 681 ;
+C 78 ; WX 740 ; N N ; B 26 0 722 681 ;
+C 79 ; WX 800 ; N O ; B 44 -17 758 698 ;
+C 80 ; WX 620 ; N P ; B 31 0 613 681 ;
+C 81 ; WX 820 ; N Q ; B 44 -189 769 698 ;
+C 82 ; WX 720 ; N R ; B 31 0 757 681 ;
+C 83 ; WX 660 ; N S ; B 28 -17 634 698 ;
+C 84 ; WX 620 ; N T ; B -37 0 656 681 ;
+C 85 ; WX 780 ; N U ; B 25 -17 754 681 ;
+C 86 ; WX 700 ; N V ; B -30 0 725 681 ;
+C 87 ; WX 960 ; N W ; B -30 0 984 681 ;
+C 88 ; WX 720 ; N X ; B -30 0 755 681 ;
+C 89 ; WX 640 ; N Y ; B -30 0 666 681 ;
+C 90 ; WX 640 ; N Z ; B 10 0 656 681 ;
+C 91 ; WX 300 ; N bracketleft ; B 92 -136 258 717 ;
+C 92 ; WX 600 ; N backslash ; B 74 0 532 717 ;
+C 93 ; WX 300 ; N bracketright ; B 41 -136 207 717 ;
+C 94 ; WX 600 ; N asciicircum ; B 52 276 554 681 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 220 ; N quoteleft ; B 46 479 178 698 ;
+C 97 ; WX 580 ; N a ; B 35 -8 587 494 ;
+C 98 ; WX 620 ; N b ; B -2 -8 582 717 ;
+C 99 ; WX 520 ; N c ; B 37 -8 498 494 ;
+C 100 ; WX 620 ; N d ; B 37 -8 591 717 ;
+C 101 ; WX 520 ; N e ; B 37 -8 491 494 ;
+C 102 ; WX 320 ; N f ; B 20 0 414 734 ; L i fi ; L l fl ;
+C 103 ; WX 540 ; N g ; B 17 -243 542 567 ;
+C 104 ; WX 660 ; N h ; B 20 0 643 717 ;
+C 105 ; WX 300 ; N i ; B 20 0 288 654 ;
+C 106 ; WX 300 ; N j ; B -109 -251 214 654 ;
+C 107 ; WX 620 ; N k ; B 20 0 628 717 ;
+C 108 ; WX 300 ; N l ; B 20 0 286 717 ;
+C 109 ; WX 940 ; N m ; B 17 0 928 494 ;
+C 110 ; WX 660 ; N n ; B 20 0 649 494 ;
+C 111 ; WX 560 ; N o ; B 37 -8 526 494 ;
+C 112 ; WX 620 ; N p ; B 20 -228 583 494 ;
+C 113 ; WX 580 ; N q ; B 37 -228 589 494 ;
+C 114 ; WX 440 ; N r ; B 20 0 447 494 ;
+C 115 ; WX 520 ; N s ; B 40 -8 487 494 ;
+C 116 ; WX 380 ; N t ; B 20 -8 388 667 ;
+C 117 ; WX 680 ; N u ; B 20 -8 653 484 ;
+C 118 ; WX 520 ; N v ; B -23 0 534 484 ;
+C 119 ; WX 780 ; N w ; B -19 0 804 484 ;
+C 120 ; WX 560 ; N x ; B -16 0 576 484 ;
+C 121 ; WX 540 ; N y ; B -23 -236 549 484 ;
+C 122 ; WX 480 ; N z ; B 7 0 476 484 ;
+C 123 ; WX 280 ; N braceleft ; B 21 -136 260 717 ;
+C 124 ; WX 600 ; N bar ; B 264 -250 342 750 ;
+C 125 ; WX 280 ; N braceright ; B 21 -136 260 717 ;
+C 126 ; WX 600 ; N asciitilde ; B 52 173 556 352 ;
+C 161 ; WX 300 ; N exclamdown ; B 75 -214 219 494 ;
+C 162 ; WX 620 ; N cent ; B 116 20 511 651 ;
+C 163 ; WX 620 ; N sterling ; B 8 -17 631 698 ;
+C 164 ; WX 140 ; N fraction ; B -188 0 335 681 ;
+C 165 ; WX 620 ; N yen ; B -22 0 647 681 ;
+C 166 ; WX 620 ; N florin ; B -29 -155 633 749 ;
+C 167 ; WX 520 ; N section ; B 33 -178 486 698 ;
+C 168 ; WX 620 ; N currency ; B 58 89 563 591 ;
+C 169 ; WX 220 ; N quotesingle ; B 67 458 153 698 ;
+C 170 ; WX 400 ; N quotedblleft ; B 46 479 348 698 ;
+C 171 ; WX 360 ; N guillemotleft ; B 51 89 312 437 ;
+C 172 ; WX 240 ; N guilsinglleft ; B 51 89 189 437 ;
+C 173 ; WX 240 ; N guilsinglright ; B 51 89 189 437 ;
+C 174 ; WX 620 ; N fi ; B 20 0 608 734 ;
+C 175 ; WX 620 ; N fl ; B 20 0 606 734 ;
+C 177 ; WX 500 ; N endash ; B -15 232 515 292 ;
+C 178 ; WX 540 ; N dagger ; B 79 -156 455 698 ;
+C 179 ; WX 540 ; N daggerdbl ; B 79 -156 455 698 ;
+C 180 ; WX 320 ; N periodcentered ; B 92 196 220 327 ;
+C 182 ; WX 600 ; N paragraph ; B 14 0 577 681 ;
+C 183 ; WX 460 ; N bullet ; B 60 170 404 511 ;
+C 184 ; WX 220 ; N quotesinglbase ; B 46 -108 178 110 ;
+C 185 ; WX 400 ; N quotedblbase ; B 46 -108 348 110 ;
+C 186 ; WX 400 ; N quotedblright ; B 46 480 348 698 ;
+C 187 ; WX 360 ; N guillemotright ; B 51 89 312 437 ;
+C 188 ; WX 1000 ; N ellipsis ; B 101 -8 898 123 ;
+C 189 ; WX 1280 ; N perthousand ; B 22 -8 1266 698 ;
+C 191 ; WX 540 ; N questiondown ; B 23 -217 510 494 ;
+C 193 ; WX 340 ; N grave ; B 68 571 274 689 ;
+C 194 ; WX 340 ; N acute ; B 68 571 274 689 ;
+C 195 ; WX 420 ; N circumflex ; B 68 567 352 685 ;
+C 196 ; WX 440 ; N tilde ; B 68 572 375 661 ;
+C 197 ; WX 440 ; N macron ; B 68 587 364 635 ;
+C 198 ; WX 460 ; N breve ; B 68 568 396 687 ;
+C 199 ; WX 260 ; N dotaccent ; B 68 552 186 672 ;
+C 200 ; WX 420 ; N dieresis ; B 68 552 349 674 ;
+C 202 ; WX 320 ; N ring ; B 68 546 252 731 ;
+C 203 ; WX 320 ; N cedilla ; B 68 -200 257 0 ;
+C 205 ; WX 380 ; N hungarumlaut ; B 68 538 311 698 ;
+C 206 ; WX 320 ; N ogonek ; B 68 -145 245 0 ;
+C 207 ; WX 420 ; N caron ; B 68 554 352 672 ;
+C 208 ; WX 1000 ; N emdash ; B -15 232 1015 292 ;
+C 225 ; WX 1260 ; N AE ; B -36 0 1250 681 ;
+C 227 ; WX 420 ; N ordfeminine ; B 49 395 393 698 ;
+C 232 ; WX 600 ; N Lslash ; B 31 0 629 681 ;
+C 233 ; WX 800 ; N Oslash ; B 44 -53 758 733 ;
+C 234 ; WX 1240 ; N OE ; B 44 -17 1214 698 ;
+C 235 ; WX 420 ; N ordmasculine ; B 56 394 361 698 ;
+C 241 ; WX 860 ; N ae ; B 35 -8 832 494 ;
+C 245 ; WX 300 ; N dotlessi ; B 20 0 288 484 ;
+C 248 ; WX 320 ; N lslash ; B 20 0 291 717 ;
+C 249 ; WX 560 ; N oslash ; B 37 -40 526 534 ;
+C 250 ; WX 900 ; N oe ; B 37 -8 876 494 ;
+C 251 ; WX 660 ; N germandbls ; B -109 -110 614 698 ;
+C -1 ; WX 520 ; N ecircumflex ; B 37 -8 491 685 ;
+C -1 ; WX 520 ; N edieresis ; B 37 -8 491 674 ;
+C -1 ; WX 580 ; N aacute ; B 35 -8 587 689 ;
+C -1 ; WX 740 ; N registered ; B 23 -17 723 698 ;
+C -1 ; WX 300 ; N icircumflex ; B 8 0 292 685 ;
+C -1 ; WX 680 ; N udieresis ; B 20 -8 653 674 ;
+C -1 ; WX 560 ; N ograve ; B 37 -8 526 689 ;
+C -1 ; WX 680 ; N uacute ; B 20 -8 653 689 ;
+C -1 ; WX 680 ; N ucircumflex ; B 20 -8 653 685 ;
+C -1 ; WX 680 ; N Aacute ; B -37 0 714 866 ;
+C -1 ; WX 300 ; N igrave ; B 20 0 288 689 ;
+C -1 ; WX 340 ; N Icircumflex ; B 28 0 312 862 ;
+C -1 ; WX 520 ; N ccedilla ; B 37 -200 498 494 ;
+C -1 ; WX 580 ; N adieresis ; B 35 -8 587 674 ;
+C -1 ; WX 720 ; N Ecircumflex ; B 31 0 705 862 ;
+C -1 ; WX 520 ; N scaron ; B 40 -8 487 672 ;
+C -1 ; WX 620 ; N thorn ; B 20 -228 583 717 ;
+C -1 ; WX 980 ; N trademark ; B 34 277 930 681 ;
+C -1 ; WX 520 ; N egrave ; B 37 -8 491 689 ;
+C -1 ; WX 372 ; N threesuperior ; B 12 269 360 698 ;
+C -1 ; WX 480 ; N zcaron ; B 7 0 476 672 ;
+C -1 ; WX 580 ; N atilde ; B 35 -8 587 661 ;
+C -1 ; WX 580 ; N aring ; B 35 -8 587 731 ;
+C -1 ; WX 560 ; N ocircumflex ; B 37 -8 526 685 ;
+C -1 ; WX 720 ; N Edieresis ; B 31 0 705 851 ;
+C -1 ; WX 930 ; N threequarters ; B 52 0 889 691 ;
+C -1 ; WX 540 ; N ydieresis ; B -23 -236 549 674 ;
+C -1 ; WX 540 ; N yacute ; B -23 -236 549 689 ;
+C -1 ; WX 300 ; N iacute ; B 20 0 288 689 ;
+C -1 ; WX 680 ; N Acircumflex ; B -37 0 714 862 ;
+C -1 ; WX 780 ; N Uacute ; B 25 -17 754 866 ;
+C -1 ; WX 520 ; N eacute ; B 37 -8 491 689 ;
+C -1 ; WX 800 ; N Ograve ; B 44 -17 758 866 ;
+C -1 ; WX 580 ; N agrave ; B 35 -8 587 689 ;
+C -1 ; WX 780 ; N Udieresis ; B 25 -17 754 851 ;
+C -1 ; WX 580 ; N acircumflex ; B 35 -8 587 685 ;
+C -1 ; WX 340 ; N Igrave ; B 31 0 301 866 ;
+C -1 ; WX 372 ; N twosuperior ; B 20 279 367 698 ;
+C -1 ; WX 780 ; N Ugrave ; B 25 -17 754 866 ;
+C -1 ; WX 930 ; N onequarter ; B 80 0 869 681 ;
+C -1 ; WX 780 ; N Ucircumflex ; B 25 -17 754 862 ;
+C -1 ; WX 660 ; N Scaron ; B 28 -17 634 849 ;
+C -1 ; WX 340 ; N Idieresis ; B 28 0 309 851 ;
+C -1 ; WX 300 ; N idieresis ; B 8 0 289 674 ;
+C -1 ; WX 720 ; N Egrave ; B 31 0 705 866 ;
+C -1 ; WX 800 ; N Oacute ; B 44 -17 758 866 ;
+C -1 ; WX 600 ; N divide ; B 51 10 555 514 ;
+C -1 ; WX 680 ; N Atilde ; B -37 0 714 838 ;
+C -1 ; WX 680 ; N Aring ; B -37 0 714 908 ;
+C -1 ; WX 800 ; N Odieresis ; B 44 -17 758 851 ;
+C -1 ; WX 680 ; N Adieresis ; B -37 0 714 851 ;
+C -1 ; WX 740 ; N Ntilde ; B 26 0 722 838 ;
+C -1 ; WX 640 ; N Zcaron ; B 10 0 656 849 ;
+C -1 ; WX 620 ; N Thorn ; B 31 0 613 681 ;
+C -1 ; WX 340 ; N Iacute ; B 31 0 301 866 ;
+C -1 ; WX 600 ; N plusminus ; B 51 0 555 513 ;
+C -1 ; WX 600 ; N multiply ; B 51 9 555 513 ;
+C -1 ; WX 720 ; N Eacute ; B 31 0 705 866 ;
+C -1 ; WX 640 ; N Ydieresis ; B -30 0 666 851 ;
+C -1 ; WX 372 ; N onesuperior ; B 80 279 302 688 ;
+C -1 ; WX 680 ; N ugrave ; B 20 -8 653 689 ;
+C -1 ; WX 600 ; N logicalnot ; B 51 128 555 398 ;
+C -1 ; WX 660 ; N ntilde ; B 20 0 649 661 ;
+C -1 ; WX 800 ; N Otilde ; B 44 -17 758 838 ;
+C -1 ; WX 560 ; N otilde ; B 37 -8 526 661 ;
+C -1 ; WX 740 ; N Ccedilla ; B 44 -200 702 698 ;
+C -1 ; WX 680 ; N Agrave ; B -37 0 714 866 ;
+C -1 ; WX 930 ; N onehalf ; B 80 0 885 681 ;
+C -1 ; WX 800 ; N Eth ; B 31 0 752 681 ;
+C -1 ; WX 400 ; N degree ; B 50 398 350 698 ;
+C -1 ; WX 640 ; N Yacute ; B -30 0 666 866 ;
+C -1 ; WX 800 ; N Ocircumflex ; B 44 -17 758 862 ;
+C -1 ; WX 560 ; N oacute ; B 37 -8 526 689 ;
+C -1 ; WX 680 ; N mu ; B 20 -251 653 484 ;
+C -1 ; WX 600 ; N minus ; B 51 224 555 300 ;
+C -1 ; WX 560 ; N eth ; B 37 -8 526 734 ;
+C -1 ; WX 560 ; N odieresis ; B 37 -8 526 674 ;
+C -1 ; WX 740 ; N copyright ; B 24 -17 724 698 ;
+C -1 ; WX 600 ; N brokenbar ; B 264 -175 342 675 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 82
+
+KPX A y 32
+KPX A w 4
+KPX A v 7
+KPX A Y -35
+KPX A W -40
+KPX A V -56
+KPX A T 1
+
+KPX F period -46
+KPX F comma -41
+KPX F A -21
+
+KPX L y 79
+KPX L Y 13
+KPX L W 1
+KPX L V -4
+KPX L T 28
+
+KPX P period -60
+KPX P comma -55
+KPX P A -8
+
+KPX R y 59
+KPX R Y 26
+KPX R W 13
+KPX R V 8
+KPX R T 71
+
+KPX T s 16
+KPX T r 38
+KPX T period -33
+KPX T o 15
+KPX T i 42
+KPX T hyphen 90
+KPX T e 13
+KPX T comma -28
+KPX T c 14
+KPX T a 17
+KPX T A 1
+
+KPX V y 15
+KPX V u -38
+KPX V r -41
+KPX V period -40
+KPX V o -71
+KPX V i -20
+KPX V hyphen 11
+KPX V e -72
+KPX V comma -34
+KPX V a -69
+KPX V A -66
+
+KPX W y 15
+KPX W u -38
+KPX W r -41
+KPX W period -40
+KPX W o -68
+KPX W i -20
+KPX W hyphen 11
+KPX W e -69
+KPX W comma -34
+KPX W a -66
+KPX W A -64
+
+KPX Y v 15
+KPX Y u -38
+KPX Y q -55
+KPX Y period -40
+KPX Y p -31
+KPX Y o -57
+KPX Y i -37
+KPX Y hyphen 11
+KPX Y e -58
+KPX Y comma -34
+KPX Y a -54
+KPX Y A -53
+
+KPX f f 29
+
+KPX r q 9
+KPX r period -64
+KPX r o 8
+KPX r n 31
+KPX r m 31
+KPX r hyphen 70
+KPX r h -21
+KPX r g -4
+KPX r f 33
+KPX r e 7
+KPX r d 7
+KPX r comma -58
+KPX r c 7
+EndKernPairs
+EndKernData
+StartComposites 56
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 200 177 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 130 177 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 130 177 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 140 177 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 180 177 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 120 177 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 220 177 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 150 177 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 150 177 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 160 177 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 20 177 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -40 177 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -40 177 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave -20 177 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 150 177 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 260 177 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 190 177 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 190 177 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 200 177 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 180 177 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 120 177 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 250 177 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 180 177 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 180 177 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 190 177 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 150 177 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 110 177 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 110 177 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 120 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 80 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 80 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 120 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 130 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 70 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 90 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 50 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 50 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 90 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -20 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -60 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -60 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -20 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 110 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 110 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 70 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 70 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 110 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 60 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 50 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 170 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 130 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 130 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 170 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 100 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 60 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 30 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pbkli8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pbkli8a.afm
new file mode 100644
index 0000000..419c319
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pbkli8a.afm
@@ -0,0 +1,410 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1992 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Tue Jan 21 16:12:06 1992
+Comment UniqueID 37830
+Comment VMusage 33139 40031
+FontName Bookman-LightItalic
+FullName ITC Bookman Light Italic
+FamilyName ITC Bookman
+Weight Light
+ItalicAngle -10
+IsFixedPitch false
+FontBBox -228 -250 1269 883
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.004
+Notice Copyright (c) 1985, 1987, 1989, 1992 Adobe Systems Incorporated. All Rights Reserved.ITC Bookman is a registered trademark of International Typeface Corporation.
+EncodingScheme AdobeStandardEncoding
+CapHeight 681
+XHeight 494
+Ascender 717
+Descender -212
+StartCharMetrics 228
+C 32 ; WX 300 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 320 ; N exclam ; B 103 -8 342 698 ;
+C 34 ; WX 360 ; N quotedbl ; B 107 468 402 698 ;
+C 35 ; WX 620 ; N numbersign ; B 107 0 598 681 ;
+C 36 ; WX 620 ; N dollar ; B 78 -85 619 762 ;
+C 37 ; WX 800 ; N percent ; B 56 -8 811 691 ;
+C 38 ; WX 820 ; N ampersand ; B 65 -18 848 698 ;
+C 39 ; WX 280 ; N quoteright ; B 148 470 288 698 ;
+C 40 ; WX 280 ; N parenleft ; B 96 -146 383 727 ;
+C 41 ; WX 280 ; N parenright ; B -8 -146 279 727 ;
+C 42 ; WX 440 ; N asterisk ; B 139 324 505 698 ;
+C 43 ; WX 600 ; N plus ; B 91 43 595 548 ;
+C 44 ; WX 300 ; N comma ; B 88 -115 227 112 ;
+C 45 ; WX 320 ; N hyphen ; B 78 269 336 325 ;
+C 46 ; WX 300 ; N period ; B 96 -8 231 127 ;
+C 47 ; WX 600 ; N slash ; B 104 -149 562 717 ;
+C 48 ; WX 620 ; N zero ; B 86 -17 646 698 ;
+C 49 ; WX 620 ; N one ; B 154 0 500 681 ;
+C 50 ; WX 620 ; N two ; B 66 0 636 698 ;
+C 51 ; WX 620 ; N three ; B 55 -17 622 698 ;
+C 52 ; WX 620 ; N four ; B 69 0 634 681 ;
+C 53 ; WX 620 ; N five ; B 70 -17 614 681 ;
+C 54 ; WX 620 ; N six ; B 89 -17 657 698 ;
+C 55 ; WX 620 ; N seven ; B 143 0 672 681 ;
+C 56 ; WX 620 ; N eight ; B 61 -17 655 698 ;
+C 57 ; WX 620 ; N nine ; B 77 -17 649 698 ;
+C 58 ; WX 300 ; N colon ; B 96 -8 292 494 ;
+C 59 ; WX 300 ; N semicolon ; B 88 -114 292 494 ;
+C 60 ; WX 600 ; N less ; B 79 33 588 561 ;
+C 61 ; WX 600 ; N equal ; B 91 161 595 433 ;
+C 62 ; WX 600 ; N greater ; B 93 33 602 561 ;
+C 63 ; WX 540 ; N question ; B 114 -8 604 698 ;
+C 64 ; WX 780 ; N at ; B 102 -17 802 698 ;
+C 65 ; WX 700 ; N A ; B -25 0 720 681 ;
+C 66 ; WX 720 ; N B ; B 21 0 746 681 ;
+C 67 ; WX 720 ; N C ; B 88 -17 746 698 ;
+C 68 ; WX 740 ; N D ; B 21 0 782 681 ;
+C 69 ; WX 680 ; N E ; B 21 0 736 681 ;
+C 70 ; WX 620 ; N F ; B 21 0 743 681 ;
+C 71 ; WX 760 ; N G ; B 88 -17 813 698 ;
+C 72 ; WX 800 ; N H ; B 21 0 888 681 ;
+C 73 ; WX 320 ; N I ; B 21 0 412 681 ;
+C 74 ; WX 560 ; N J ; B -2 -17 666 681 ;
+C 75 ; WX 720 ; N K ; B 21 0 804 681 ;
+C 76 ; WX 580 ; N L ; B 21 0 656 681 ;
+C 77 ; WX 860 ; N M ; B 18 0 956 681 ;
+C 78 ; WX 720 ; N N ; B 18 0 823 681 ;
+C 79 ; WX 760 ; N O ; B 88 -17 799 698 ;
+C 80 ; WX 600 ; N P ; B 21 0 681 681 ;
+C 81 ; WX 780 ; N Q ; B 61 -191 812 698 ;
+C 82 ; WX 700 ; N R ; B 21 0 736 681 ;
+C 83 ; WX 640 ; N S ; B 61 -17 668 698 ;
+C 84 ; WX 600 ; N T ; B 50 0 725 681 ;
+C 85 ; WX 720 ; N U ; B 118 -17 842 681 ;
+C 86 ; WX 680 ; N V ; B 87 0 815 681 ;
+C 87 ; WX 960 ; N W ; B 87 0 1095 681 ;
+C 88 ; WX 700 ; N X ; B -25 0 815 681 ;
+C 89 ; WX 660 ; N Y ; B 87 0 809 681 ;
+C 90 ; WX 580 ; N Z ; B 8 0 695 681 ;
+C 91 ; WX 260 ; N bracketleft ; B 56 -136 351 717 ;
+C 92 ; WX 600 ; N backslash ; B 84 0 542 717 ;
+C 93 ; WX 260 ; N bracketright ; B 15 -136 309 717 ;
+C 94 ; WX 600 ; N asciicircum ; B 97 276 599 681 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 280 ; N quoteleft ; B 191 470 330 698 ;
+C 97 ; WX 620 ; N a ; B 71 -8 686 494 ;
+C 98 ; WX 600 ; N b ; B 88 -8 621 717 ;
+C 99 ; WX 480 ; N c ; B 65 -8 522 494 ;
+C 100 ; WX 640 ; N d ; B 65 -8 695 717 ;
+C 101 ; WX 540 ; N e ; B 65 -8 575 494 ;
+C 102 ; WX 340 ; N f ; B -160 -218 557 725 ; L i fi ; L l fl ;
+C 103 ; WX 560 ; N g ; B 4 -221 581 494 ;
+C 104 ; WX 620 ; N h ; B 88 -8 689 717 ;
+C 105 ; WX 280 ; N i ; B 88 -8 351 663 ;
+C 106 ; WX 280 ; N j ; B -200 -221 308 663 ;
+C 107 ; WX 600 ; N k ; B 88 -8 657 717 ;
+C 108 ; WX 280 ; N l ; B 100 -8 342 717 ;
+C 109 ; WX 880 ; N m ; B 88 -8 952 494 ;
+C 110 ; WX 620 ; N n ; B 88 -8 673 494 ;
+C 111 ; WX 540 ; N o ; B 65 -8 572 494 ;
+C 112 ; WX 600 ; N p ; B -24 -212 620 494 ;
+C 113 ; WX 560 ; N q ; B 65 -212 584 494 ;
+C 114 ; WX 400 ; N r ; B 88 0 481 494 ;
+C 115 ; WX 540 ; N s ; B 65 -8 547 494 ;
+C 116 ; WX 340 ; N t ; B 88 -8 411 664 ;
+C 117 ; WX 620 ; N u ; B 88 -8 686 484 ;
+C 118 ; WX 540 ; N v ; B 88 -8 562 494 ;
+C 119 ; WX 880 ; N w ; B 88 -8 893 494 ;
+C 120 ; WX 540 ; N x ; B 9 -8 626 494 ;
+C 121 ; WX 600 ; N y ; B 60 -221 609 484 ;
+C 122 ; WX 520 ; N z ; B 38 -8 561 494 ;
+C 123 ; WX 360 ; N braceleft ; B 122 -191 442 717 ;
+C 124 ; WX 600 ; N bar ; B 294 -250 372 750 ;
+C 125 ; WX 380 ; N braceright ; B 13 -191 333 717 ;
+C 126 ; WX 600 ; N asciitilde ; B 91 207 595 386 ;
+C 161 ; WX 320 ; N exclamdown ; B 73 -213 301 494 ;
+C 162 ; WX 620 ; N cent ; B 148 -29 596 715 ;
+C 163 ; WX 620 ; N sterling ; B 4 -17 702 698 ;
+C 164 ; WX 20 ; N fraction ; B -228 0 323 681 ;
+C 165 ; WX 620 ; N yen ; B 71 0 735 681 ;
+C 166 ; WX 620 ; N florin ; B -26 -218 692 725 ;
+C 167 ; WX 620 ; N section ; B 38 -178 638 698 ;
+C 168 ; WX 620 ; N currency ; B 100 89 605 591 ;
+C 169 ; WX 200 ; N quotesingle ; B 99 473 247 698 ;
+C 170 ; WX 440 ; N quotedblleft ; B 191 470 493 698 ;
+C 171 ; WX 300 ; N guillemotleft ; B 70 129 313 434 ;
+C 172 ; WX 180 ; N guilsinglleft ; B 75 129 208 434 ;
+C 173 ; WX 180 ; N guilsinglright ; B 70 129 203 434 ;
+C 174 ; WX 640 ; N fi ; B -159 -222 709 725 ;
+C 175 ; WX 660 ; N fl ; B -159 -218 713 725 ;
+C 177 ; WX 500 ; N endash ; B 33 269 561 325 ;
+C 178 ; WX 620 ; N dagger ; B 192 -130 570 698 ;
+C 179 ; WX 620 ; N daggerdbl ; B 144 -122 566 698 ;
+C 180 ; WX 300 ; N periodcentered ; B 137 229 272 364 ;
+C 182 ; WX 620 ; N paragraph ; B 112 0 718 681 ;
+C 183 ; WX 460 ; N bullet ; B 100 170 444 511 ;
+C 184 ; WX 320 ; N quotesinglbase ; B 87 -114 226 113 ;
+C 185 ; WX 480 ; N quotedblbase ; B 87 -114 390 113 ;
+C 186 ; WX 440 ; N quotedblright ; B 148 470 451 698 ;
+C 187 ; WX 300 ; N guillemotright ; B 60 129 303 434 ;
+C 188 ; WX 1000 ; N ellipsis ; B 99 -8 900 127 ;
+C 189 ; WX 1180 ; N perthousand ; B 56 -8 1199 691 ;
+C 191 ; WX 540 ; N questiondown ; B 18 -212 508 494 ;
+C 193 ; WX 340 ; N grave ; B 182 551 377 706 ;
+C 194 ; WX 320 ; N acute ; B 178 551 373 706 ;
+C 195 ; WX 440 ; N circumflex ; B 176 571 479 685 ;
+C 196 ; WX 440 ; N tilde ; B 180 586 488 671 ;
+C 197 ; WX 440 ; N macron ; B 178 599 484 658 ;
+C 198 ; WX 440 ; N breve ; B 191 577 500 680 ;
+C 199 ; WX 260 ; N dotaccent ; B 169 543 290 664 ;
+C 200 ; WX 420 ; N dieresis ; B 185 569 467 688 ;
+C 202 ; WX 300 ; N ring ; B 178 551 334 706 ;
+C 203 ; WX 320 ; N cedilla ; B 45 -178 240 0 ;
+C 205 ; WX 340 ; N hungarumlaut ; B 167 547 402 738 ;
+C 206 ; WX 260 ; N ogonek ; B 51 -173 184 0 ;
+C 207 ; WX 440 ; N caron ; B 178 571 481 684 ;
+C 208 ; WX 1000 ; N emdash ; B 33 269 1061 325 ;
+C 225 ; WX 1220 ; N AE ; B -45 0 1269 681 ;
+C 227 ; WX 440 ; N ordfeminine ; B 130 396 513 698 ;
+C 232 ; WX 580 ; N Lslash ; B 21 0 656 681 ;
+C 233 ; WX 760 ; N Oslash ; B 88 -95 799 777 ;
+C 234 ; WX 1180 ; N OE ; B 88 -17 1237 698 ;
+C 235 ; WX 400 ; N ordmasculine ; B 139 396 455 698 ;
+C 241 ; WX 880 ; N ae ; B 71 -8 918 494 ;
+C 245 ; WX 280 ; N dotlessi ; B 88 -8 351 484 ;
+C 248 ; WX 340 ; N lslash ; B 50 -8 398 717 ;
+C 249 ; WX 540 ; N oslash ; B 65 -49 571 532 ;
+C 250 ; WX 900 ; N oe ; B 65 -8 948 494 ;
+C 251 ; WX 620 ; N germandbls ; B -121 -111 653 698 ;
+C -1 ; WX 540 ; N ecircumflex ; B 65 -8 575 685 ;
+C -1 ; WX 540 ; N edieresis ; B 65 -8 575 688 ;
+C -1 ; WX 620 ; N aacute ; B 71 -8 686 706 ;
+C -1 ; WX 740 ; N registered ; B 84 -17 784 698 ;
+C -1 ; WX 280 ; N icircumflex ; B 76 -8 379 685 ;
+C -1 ; WX 620 ; N udieresis ; B 88 -8 686 688 ;
+C -1 ; WX 540 ; N ograve ; B 65 -8 572 706 ;
+C -1 ; WX 620 ; N uacute ; B 88 -8 686 706 ;
+C -1 ; WX 620 ; N ucircumflex ; B 88 -8 686 685 ;
+C -1 ; WX 700 ; N Aacute ; B -25 0 720 883 ;
+C -1 ; WX 280 ; N igrave ; B 88 -8 351 706 ;
+C -1 ; WX 320 ; N Icircumflex ; B 21 0 449 862 ;
+C -1 ; WX 480 ; N ccedilla ; B 65 -178 522 494 ;
+C -1 ; WX 620 ; N adieresis ; B 71 -8 686 688 ;
+C -1 ; WX 680 ; N Ecircumflex ; B 21 0 736 862 ;
+C -1 ; WX 540 ; N scaron ; B 65 -8 547 684 ;
+C -1 ; WX 600 ; N thorn ; B -24 -212 620 717 ;
+C -1 ; WX 980 ; N trademark ; B 69 277 965 681 ;
+C -1 ; WX 540 ; N egrave ; B 65 -8 575 706 ;
+C -1 ; WX 372 ; N threesuperior ; B 70 269 439 698 ;
+C -1 ; WX 520 ; N zcaron ; B 38 -8 561 684 ;
+C -1 ; WX 620 ; N atilde ; B 71 -8 686 671 ;
+C -1 ; WX 620 ; N aring ; B 71 -8 686 706 ;
+C -1 ; WX 540 ; N ocircumflex ; B 65 -8 572 685 ;
+C -1 ; WX 680 ; N Edieresis ; B 21 0 736 865 ;
+C -1 ; WX 930 ; N threequarters ; B 99 0 913 691 ;
+C -1 ; WX 600 ; N ydieresis ; B 60 -221 609 688 ;
+C -1 ; WX 600 ; N yacute ; B 60 -221 609 706 ;
+C -1 ; WX 280 ; N iacute ; B 88 -8 351 706 ;
+C -1 ; WX 700 ; N Acircumflex ; B -25 0 720 862 ;
+C -1 ; WX 720 ; N Uacute ; B 118 -17 842 883 ;
+C -1 ; WX 540 ; N eacute ; B 65 -8 575 706 ;
+C -1 ; WX 760 ; N Ograve ; B 88 -17 799 883 ;
+C -1 ; WX 620 ; N agrave ; B 71 -8 686 706 ;
+C -1 ; WX 720 ; N Udieresis ; B 118 -17 842 865 ;
+C -1 ; WX 620 ; N acircumflex ; B 71 -8 686 685 ;
+C -1 ; WX 320 ; N Igrave ; B 21 0 412 883 ;
+C -1 ; WX 372 ; N twosuperior ; B 68 279 439 698 ;
+C -1 ; WX 720 ; N Ugrave ; B 118 -17 842 883 ;
+C -1 ; WX 930 ; N onequarter ; B 91 0 913 681 ;
+C -1 ; WX 720 ; N Ucircumflex ; B 118 -17 842 862 ;
+C -1 ; WX 640 ; N Scaron ; B 61 -17 668 861 ;
+C -1 ; WX 320 ; N Idieresis ; B 21 0 447 865 ;
+C -1 ; WX 280 ; N idieresis ; B 88 -8 377 688 ;
+C -1 ; WX 680 ; N Egrave ; B 21 0 736 883 ;
+C -1 ; WX 760 ; N Oacute ; B 88 -17 799 883 ;
+C -1 ; WX 600 ; N divide ; B 91 46 595 548 ;
+C -1 ; WX 700 ; N Atilde ; B -25 0 720 848 ;
+C -1 ; WX 700 ; N Aring ; B -25 0 720 883 ;
+C -1 ; WX 760 ; N Odieresis ; B 88 -17 799 865 ;
+C -1 ; WX 700 ; N Adieresis ; B -25 0 720 865 ;
+C -1 ; WX 720 ; N Ntilde ; B 18 0 823 848 ;
+C -1 ; WX 580 ; N Zcaron ; B 8 0 695 861 ;
+C -1 ; WX 600 ; N Thorn ; B 21 0 656 681 ;
+C -1 ; WX 320 ; N Iacute ; B 21 0 412 883 ;
+C -1 ; WX 600 ; N plusminus ; B 91 0 595 548 ;
+C -1 ; WX 600 ; N multiply ; B 91 44 595 548 ;
+C -1 ; WX 680 ; N Eacute ; B 21 0 736 883 ;
+C -1 ; WX 660 ; N Ydieresis ; B 87 0 809 865 ;
+C -1 ; WX 372 ; N onesuperior ; B 114 279 339 688 ;
+C -1 ; WX 620 ; N ugrave ; B 88 -8 686 706 ;
+C -1 ; WX 600 ; N logicalnot ; B 91 163 595 433 ;
+C -1 ; WX 620 ; N ntilde ; B 88 -8 673 671 ;
+C -1 ; WX 760 ; N Otilde ; B 88 -17 799 848 ;
+C -1 ; WX 540 ; N otilde ; B 65 -8 572 671 ;
+C -1 ; WX 720 ; N Ccedilla ; B 88 -178 746 698 ;
+C -1 ; WX 700 ; N Agrave ; B -25 0 720 883 ;
+C -1 ; WX 930 ; N onehalf ; B 91 0 925 681 ;
+C -1 ; WX 740 ; N Eth ; B 21 0 782 681 ;
+C -1 ; WX 400 ; N degree ; B 120 398 420 698 ;
+C -1 ; WX 660 ; N Yacute ; B 87 0 809 883 ;
+C -1 ; WX 760 ; N Ocircumflex ; B 88 -17 799 862 ;
+C -1 ; WX 540 ; N oacute ; B 65 -8 572 706 ;
+C -1 ; WX 620 ; N mu ; B 53 -221 686 484 ;
+C -1 ; WX 600 ; N minus ; B 91 259 595 335 ;
+C -1 ; WX 540 ; N eth ; B 65 -8 642 725 ;
+C -1 ; WX 540 ; N odieresis ; B 65 -8 572 688 ;
+C -1 ; WX 740 ; N copyright ; B 84 -17 784 698 ;
+C -1 ; WX 600 ; N brokenbar ; B 294 -175 372 675 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 85
+
+KPX A Y -62
+KPX A W -73
+KPX A V -78
+KPX A T -5
+
+KPX F period -97
+KPX F comma -98
+KPX F A -16
+
+KPX L y 20
+KPX L Y 7
+KPX L W 9
+KPX L V 4
+
+KPX P period -105
+KPX P comma -106
+KPX P A -30
+
+KPX R Y 11
+KPX R W 2
+KPX R V 2
+KPX R T 65
+
+KPX T semicolon 48
+KPX T s -7
+KPX T r 67
+KPX T period -78
+KPX T o 14
+KPX T i 71
+KPX T hyphen 20
+KPX T e 10
+KPX T comma -79
+KPX T colon 48
+KPX T c 16
+KPX T a 9
+KPX T A -14
+
+KPX V y -14
+KPX V u -10
+KPX V semicolon -44
+KPX V r -20
+KPX V period -100
+KPX V o -70
+KPX V i 3
+KPX V hyphen 20
+KPX V e -70
+KPX V comma -109
+KPX V colon -35
+KPX V a -70
+KPX V A -70
+
+KPX W y -14
+KPX W u -20
+KPX W semicolon -42
+KPX W r -30
+KPX W period -100
+KPX W o -60
+KPX W i 3
+KPX W hyphen 20
+KPX W e -60
+KPX W comma -109
+KPX W colon -35
+KPX W a -60
+KPX W A -60
+
+KPX Y v -19
+KPX Y u -31
+KPX Y semicolon -40
+KPX Y q -72
+KPX Y period -100
+KPX Y p -37
+KPX Y o -75
+KPX Y i -11
+KPX Y hyphen 20
+KPX Y e -78
+KPX Y comma -109
+KPX Y colon -35
+KPX Y a -79
+KPX Y A -82
+
+KPX f f -19
+
+KPX r q -14
+KPX r period -134
+KPX r o -10
+KPX r n 38
+KPX r m 37
+KPX r hyphen 20
+KPX r h -20
+KPX r g -3
+KPX r f -9
+KPX r e -15
+KPX r d -9
+KPX r comma -143
+KPX r c -8
+EndKernPairs
+EndKernData
+StartComposites 56
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 200 177 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 130 177 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 140 177 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 160 177 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 220 177 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 130 177 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 210 177 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 140 177 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 150 177 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 150 177 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 30 177 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -30 177 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -20 177 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave -30 177 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 130 177 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 250 177 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 190 177 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 200 177 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 210 177 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 190 177 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 100 177 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 230 177 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 170 177 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 180 177 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 170 177 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 200 177 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 140 177 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 70 177 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 120 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 70 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 80 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 110 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 140 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 60 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 90 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 30 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 40 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 80 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -40 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -100 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -90 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -60 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 60 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 80 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 20 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 40 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 80 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 30 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 30 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 120 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 60 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 70 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 110 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 140 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 70 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 20 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pcrb8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pcrb8a.afm
new file mode 100644
index 0000000..baf3a51
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pcrb8a.afm
@@ -0,0 +1,344 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1989, 1990, 1991, Adobe Systems Incorporated. All rights reserved.
+Comment Creation Date: Tue Sep 17 14:02:41 1991
+Comment UniqueID 36384
+Comment VMusage 31992 40360
+FontName Courier-Bold
+FullName Courier Bold
+FamilyName Courier
+Weight Bold
+ItalicAngle 0
+IsFixedPitch true
+FontBBox -113 -250 749 801
+UnderlinePosition -100
+UnderlineThickness 50
+Version 002.004
+Notice Copyright (c) 1989, 1990, 1991, Adobe Systems Incorporated. All rights reserved.
+EncodingScheme AdobeStandardEncoding
+CapHeight 562
+XHeight 439
+Ascender 626
+Descender -142
+StartCharMetrics 260
+C 32 ; WX 600 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 600 ; N exclam ; B 202 -15 398 572 ;
+C 34 ; WX 600 ; N quotedbl ; B 135 277 465 562 ;
+C 35 ; WX 600 ; N numbersign ; B 56 -45 544 651 ;
+C 36 ; WX 600 ; N dollar ; B 82 -126 519 666 ;
+C 37 ; WX 600 ; N percent ; B 5 -15 595 616 ;
+C 38 ; WX 600 ; N ampersand ; B 36 -15 546 543 ;
+C 39 ; WX 600 ; N quoteright ; B 171 277 423 562 ;
+C 40 ; WX 600 ; N parenleft ; B 219 -102 461 616 ;
+C 41 ; WX 600 ; N parenright ; B 139 -102 381 616 ;
+C 42 ; WX 600 ; N asterisk ; B 91 219 509 601 ;
+C 43 ; WX 600 ; N plus ; B 71 39 529 478 ;
+C 44 ; WX 600 ; N comma ; B 123 -111 393 174 ;
+C 45 ; WX 600 ; N hyphen ; B 100 203 500 313 ;
+C 46 ; WX 600 ; N period ; B 192 -15 408 171 ;
+C 47 ; WX 600 ; N slash ; B 98 -77 502 626 ;
+C 48 ; WX 600 ; N zero ; B 87 -15 513 616 ;
+C 49 ; WX 600 ; N one ; B 81 0 539 616 ;
+C 50 ; WX 600 ; N two ; B 61 0 499 616 ;
+C 51 ; WX 600 ; N three ; B 63 -15 501 616 ;
+C 52 ; WX 600 ; N four ; B 53 0 507 616 ;
+C 53 ; WX 600 ; N five ; B 70 -15 521 601 ;
+C 54 ; WX 600 ; N six ; B 90 -15 521 616 ;
+C 55 ; WX 600 ; N seven ; B 55 0 494 601 ;
+C 56 ; WX 600 ; N eight ; B 83 -15 517 616 ;
+C 57 ; WX 600 ; N nine ; B 79 -15 510 616 ;
+C 58 ; WX 600 ; N colon ; B 191 -15 407 425 ;
+C 59 ; WX 600 ; N semicolon ; B 123 -111 408 425 ;
+C 60 ; WX 600 ; N less ; B 66 15 523 501 ;
+C 61 ; WX 600 ; N equal ; B 71 118 529 398 ;
+C 62 ; WX 600 ; N greater ; B 77 15 534 501 ;
+C 63 ; WX 600 ; N question ; B 98 -14 501 580 ;
+C 64 ; WX 600 ; N at ; B 16 -15 584 616 ;
+C 65 ; WX 600 ; N A ; B -9 0 609 562 ;
+C 66 ; WX 600 ; N B ; B 30 0 573 562 ;
+C 67 ; WX 600 ; N C ; B 22 -18 560 580 ;
+C 68 ; WX 600 ; N D ; B 30 0 594 562 ;
+C 69 ; WX 600 ; N E ; B 25 0 560 562 ;
+C 70 ; WX 600 ; N F ; B 39 0 570 562 ;
+C 71 ; WX 600 ; N G ; B 22 -18 594 580 ;
+C 72 ; WX 600 ; N H ; B 20 0 580 562 ;
+C 73 ; WX 600 ; N I ; B 77 0 523 562 ;
+C 74 ; WX 600 ; N J ; B 37 -18 601 562 ;
+C 75 ; WX 600 ; N K ; B 21 0 599 562 ;
+C 76 ; WX 600 ; N L ; B 39 0 578 562 ;
+C 77 ; WX 600 ; N M ; B -2 0 602 562 ;
+C 78 ; WX 600 ; N N ; B 8 -12 610 562 ;
+C 79 ; WX 600 ; N O ; B 22 -18 578 580 ;
+C 80 ; WX 600 ; N P ; B 48 0 559 562 ;
+C 81 ; WX 600 ; N Q ; B 32 -138 578 580 ;
+C 82 ; WX 600 ; N R ; B 24 0 599 562 ;
+C 83 ; WX 600 ; N S ; B 47 -22 553 582 ;
+C 84 ; WX 600 ; N T ; B 21 0 579 562 ;
+C 85 ; WX 600 ; N U ; B 4 -18 596 562 ;
+C 86 ; WX 600 ; N V ; B -13 0 613 562 ;
+C 87 ; WX 600 ; N W ; B -18 0 618 562 ;
+C 88 ; WX 600 ; N X ; B 12 0 588 562 ;
+C 89 ; WX 600 ; N Y ; B 12 0 589 562 ;
+C 90 ; WX 600 ; N Z ; B 62 0 539 562 ;
+C 91 ; WX 600 ; N bracketleft ; B 245 -102 475 616 ;
+C 92 ; WX 600 ; N backslash ; B 99 -77 503 626 ;
+C 93 ; WX 600 ; N bracketright ; B 125 -102 355 616 ;
+C 94 ; WX 600 ; N asciicircum ; B 108 250 492 616 ;
+C 95 ; WX 600 ; N underscore ; B 0 -125 600 -75 ;
+C 96 ; WX 600 ; N quoteleft ; B 178 277 428 562 ;
+C 97 ; WX 600 ; N a ; B 35 -15 570 454 ;
+C 98 ; WX 600 ; N b ; B 0 -15 584 626 ;
+C 99 ; WX 600 ; N c ; B 40 -15 545 459 ;
+C 100 ; WX 600 ; N d ; B 20 -15 591 626 ;
+C 101 ; WX 600 ; N e ; B 40 -15 563 454 ;
+C 102 ; WX 600 ; N f ; B 83 0 547 626 ; L i fi ; L l fl ;
+C 103 ; WX 600 ; N g ; B 30 -146 580 454 ;
+C 104 ; WX 600 ; N h ; B 5 0 592 626 ;
+C 105 ; WX 600 ; N i ; B 77 0 523 658 ;
+C 106 ; WX 600 ; N j ; B 63 -146 440 658 ;
+C 107 ; WX 600 ; N k ; B 20 0 585 626 ;
+C 108 ; WX 600 ; N l ; B 77 0 523 626 ;
+C 109 ; WX 600 ; N m ; B -22 0 626 454 ;
+C 110 ; WX 600 ; N n ; B 18 0 592 454 ;
+C 111 ; WX 600 ; N o ; B 30 -15 570 454 ;
+C 112 ; WX 600 ; N p ; B -1 -142 570 454 ;
+C 113 ; WX 600 ; N q ; B 20 -142 591 454 ;
+C 114 ; WX 600 ; N r ; B 47 0 580 454 ;
+C 115 ; WX 600 ; N s ; B 68 -17 535 459 ;
+C 116 ; WX 600 ; N t ; B 47 -15 532 562 ;
+C 117 ; WX 600 ; N u ; B -1 -15 569 439 ;
+C 118 ; WX 600 ; N v ; B -1 0 601 439 ;
+C 119 ; WX 600 ; N w ; B -18 0 618 439 ;
+C 120 ; WX 600 ; N x ; B 6 0 594 439 ;
+C 121 ; WX 600 ; N y ; B -4 -142 601 439 ;
+C 122 ; WX 600 ; N z ; B 81 0 520 439 ;
+C 123 ; WX 600 ; N braceleft ; B 160 -102 464 616 ;
+C 124 ; WX 600 ; N bar ; B 255 -250 345 750 ;
+C 125 ; WX 600 ; N braceright ; B 136 -102 440 616 ;
+C 126 ; WX 600 ; N asciitilde ; B 71 153 530 356 ;
+C 161 ; WX 600 ; N exclamdown ; B 202 -146 398 449 ;
+C 162 ; WX 600 ; N cent ; B 66 -49 518 614 ;
+C 163 ; WX 600 ; N sterling ; B 72 -28 558 611 ;
+C 164 ; WX 600 ; N fraction ; B 25 -60 576 661 ;
+C 165 ; WX 600 ; N yen ; B 10 0 590 562 ;
+C 166 ; WX 600 ; N florin ; B -30 -131 572 616 ;
+C 167 ; WX 600 ; N section ; B 83 -70 517 580 ;
+C 168 ; WX 600 ; N currency ; B 54 49 546 517 ;
+C 169 ; WX 600 ; N quotesingle ; B 227 277 373 562 ;
+C 170 ; WX 600 ; N quotedblleft ; B 71 277 535 562 ;
+C 171 ; WX 600 ; N guillemotleft ; B 8 70 553 446 ;
+C 172 ; WX 600 ; N guilsinglleft ; B 141 70 459 446 ;
+C 173 ; WX 600 ; N guilsinglright ; B 141 70 459 446 ;
+C 174 ; WX 600 ; N fi ; B 12 0 593 626 ;
+C 175 ; WX 600 ; N fl ; B 12 0 593 626 ;
+C 177 ; WX 600 ; N endash ; B 65 203 535 313 ;
+C 178 ; WX 600 ; N dagger ; B 106 -70 494 580 ;
+C 179 ; WX 600 ; N daggerdbl ; B 106 -70 494 580 ;
+C 180 ; WX 600 ; N periodcentered ; B 196 165 404 351 ;
+C 182 ; WX 600 ; N paragraph ; B 6 -70 576 580 ;
+C 183 ; WX 600 ; N bullet ; B 140 132 460 430 ;
+C 184 ; WX 600 ; N quotesinglbase ; B 175 -142 427 143 ;
+C 185 ; WX 600 ; N quotedblbase ; B 65 -142 529 143 ;
+C 186 ; WX 600 ; N quotedblright ; B 61 277 525 562 ;
+C 187 ; WX 600 ; N guillemotright ; B 47 70 592 446 ;
+C 188 ; WX 600 ; N ellipsis ; B 26 -15 574 116 ;
+C 189 ; WX 600 ; N perthousand ; B -113 -15 713 616 ;
+C 191 ; WX 600 ; N questiondown ; B 99 -146 502 449 ;
+C 193 ; WX 600 ; N grave ; B 132 508 395 661 ;
+C 194 ; WX 600 ; N acute ; B 205 508 468 661 ;
+C 195 ; WX 600 ; N circumflex ; B 103 483 497 657 ;
+C 196 ; WX 600 ; N tilde ; B 89 493 512 636 ;
+C 197 ; WX 600 ; N macron ; B 88 505 512 585 ;
+C 198 ; WX 600 ; N breve ; B 83 468 517 631 ;
+C 199 ; WX 600 ; N dotaccent ; B 230 485 370 625 ;
+C 200 ; WX 600 ; N dieresis ; B 128 485 472 625 ;
+C 202 ; WX 600 ; N ring ; B 198 481 402 678 ;
+C 203 ; WX 600 ; N cedilla ; B 205 -206 387 0 ;
+C 205 ; WX 600 ; N hungarumlaut ; B 68 488 588 661 ;
+C 206 ; WX 600 ; N ogonek ; B 169 -199 367 0 ;
+C 207 ; WX 600 ; N caron ; B 103 493 497 667 ;
+C 208 ; WX 600 ; N emdash ; B -10 203 610 313 ;
+C 225 ; WX 600 ; N AE ; B -29 0 602 562 ;
+C 227 ; WX 600 ; N ordfeminine ; B 147 196 453 580 ;
+C 232 ; WX 600 ; N Lslash ; B 39 0 578 562 ;
+C 233 ; WX 600 ; N Oslash ; B 22 -22 578 584 ;
+C 234 ; WX 600 ; N OE ; B -25 0 595 562 ;
+C 235 ; WX 600 ; N ordmasculine ; B 147 196 453 580 ;
+C 241 ; WX 600 ; N ae ; B -4 -15 601 454 ;
+C 245 ; WX 600 ; N dotlessi ; B 77 0 523 439 ;
+C 248 ; WX 600 ; N lslash ; B 77 0 523 626 ;
+C 249 ; WX 600 ; N oslash ; B 30 -24 570 463 ;
+C 250 ; WX 600 ; N oe ; B -18 -15 611 454 ;
+C 251 ; WX 600 ; N germandbls ; B 22 -15 596 626 ;
+C -1 ; WX 600 ; N Odieresis ; B 22 -18 578 748 ;
+C -1 ; WX 600 ; N logicalnot ; B 71 103 529 413 ;
+C -1 ; WX 600 ; N minus ; B 71 203 529 313 ;
+C -1 ; WX 600 ; N merge ; B 137 -15 464 487 ;
+C -1 ; WX 600 ; N degree ; B 86 243 474 616 ;
+C -1 ; WX 600 ; N dectab ; B 8 0 592 320 ;
+C -1 ; WX 600 ; N ll ; B -12 0 600 626 ;
+C -1 ; WX 600 ; N IJ ; B -8 -18 622 562 ;
+C -1 ; WX 600 ; N Eacute ; B 25 0 560 784 ;
+C -1 ; WX 600 ; N Ocircumflex ; B 22 -18 578 780 ;
+C -1 ; WX 600 ; N ucircumflex ; B -1 -15 569 657 ;
+C -1 ; WX 600 ; N left ; B 65 44 535 371 ;
+C -1 ; WX 600 ; N threesuperior ; B 138 222 433 616 ;
+C -1 ; WX 600 ; N up ; B 136 0 463 447 ;
+C -1 ; WX 600 ; N multiply ; B 81 39 520 478 ;
+C -1 ; WX 600 ; N Scaron ; B 47 -22 553 790 ;
+C -1 ; WX 600 ; N tab ; B 19 0 581 562 ;
+C -1 ; WX 600 ; N Ucircumflex ; B 4 -18 596 780 ;
+C -1 ; WX 600 ; N divide ; B 71 16 529 500 ;
+C -1 ; WX 600 ; N Acircumflex ; B -9 0 609 780 ;
+C -1 ; WX 600 ; N eacute ; B 40 -15 563 661 ;
+C -1 ; WX 600 ; N uacute ; B -1 -15 569 661 ;
+C -1 ; WX 600 ; N Aacute ; B -9 0 609 784 ;
+C -1 ; WX 600 ; N copyright ; B 0 -18 600 580 ;
+C -1 ; WX 600 ; N twosuperior ; B 143 230 436 616 ;
+C -1 ; WX 600 ; N Ecircumflex ; B 25 0 560 780 ;
+C -1 ; WX 600 ; N ntilde ; B 18 0 592 636 ;
+C -1 ; WX 600 ; N down ; B 137 -15 464 439 ;
+C -1 ; WX 600 ; N center ; B 40 14 560 580 ;
+C -1 ; WX 600 ; N onesuperior ; B 153 230 447 616 ;
+C -1 ; WX 600 ; N ij ; B 6 -146 574 658 ;
+C -1 ; WX 600 ; N edieresis ; B 40 -15 563 625 ;
+C -1 ; WX 600 ; N graybox ; B 76 0 525 599 ;
+C -1 ; WX 600 ; N odieresis ; B 30 -15 570 625 ;
+C -1 ; WX 600 ; N Ograve ; B 22 -18 578 784 ;
+C -1 ; WX 600 ; N threequarters ; B -47 -60 648 661 ;
+C -1 ; WX 600 ; N plusminus ; B 71 24 529 515 ;
+C -1 ; WX 600 ; N prescription ; B 24 -15 599 562 ;
+C -1 ; WX 600 ; N eth ; B 58 -27 543 626 ;
+C -1 ; WX 600 ; N largebullet ; B 248 229 352 333 ;
+C -1 ; WX 600 ; N egrave ; B 40 -15 563 661 ;
+C -1 ; WX 600 ; N ccedilla ; B 40 -206 545 459 ;
+C -1 ; WX 600 ; N notegraphic ; B 77 -15 523 572 ;
+C -1 ; WX 600 ; N Udieresis ; B 4 -18 596 748 ;
+C -1 ; WX 600 ; N Gcaron ; B 22 -18 594 790 ;
+C -1 ; WX 600 ; N arrowdown ; B 144 -15 456 608 ;
+C -1 ; WX 600 ; N format ; B 5 -146 115 601 ;
+C -1 ; WX 600 ; N Otilde ; B 22 -18 578 759 ;
+C -1 ; WX 600 ; N Idieresis ; B 77 0 523 748 ;
+C -1 ; WX 600 ; N adieresis ; B 35 -15 570 625 ;
+C -1 ; WX 600 ; N ecircumflex ; B 40 -15 563 657 ;
+C -1 ; WX 600 ; N Eth ; B 30 0 594 562 ;
+C -1 ; WX 600 ; N onequarter ; B -56 -60 656 661 ;
+C -1 ; WX 600 ; N LL ; B -45 0 645 562 ;
+C -1 ; WX 600 ; N agrave ; B 35 -15 570 661 ;
+C -1 ; WX 600 ; N Zcaron ; B 62 0 539 790 ;
+C -1 ; WX 600 ; N Scedilla ; B 47 -206 553 582 ;
+C -1 ; WX 600 ; N Idot ; B 77 0 523 748 ;
+C -1 ; WX 600 ; N Iacute ; B 77 0 523 784 ;
+C -1 ; WX 600 ; N indent ; B 65 45 535 372 ;
+C -1 ; WX 600 ; N Ugrave ; B 4 -18 596 784 ;
+C -1 ; WX 600 ; N scaron ; B 68 -17 535 667 ;
+C -1 ; WX 600 ; N overscore ; B 0 579 600 629 ;
+C -1 ; WX 600 ; N Aring ; B -9 0 609 801 ;
+C -1 ; WX 600 ; N Ccedilla ; B 22 -206 560 580 ;
+C -1 ; WX 600 ; N Igrave ; B 77 0 523 784 ;
+C -1 ; WX 600 ; N brokenbar ; B 255 -175 345 675 ;
+C -1 ; WX 600 ; N Oacute ; B 22 -18 578 784 ;
+C -1 ; WX 600 ; N otilde ; B 30 -15 570 636 ;
+C -1 ; WX 600 ; N Yacute ; B 12 0 589 784 ;
+C -1 ; WX 600 ; N lira ; B 72 -28 558 611 ;
+C -1 ; WX 600 ; N Icircumflex ; B 77 0 523 780 ;
+C -1 ; WX 600 ; N Atilde ; B -9 0 609 759 ;
+C -1 ; WX 600 ; N Uacute ; B 4 -18 596 784 ;
+C -1 ; WX 600 ; N Ydieresis ; B 12 0 589 748 ;
+C -1 ; WX 600 ; N ydieresis ; B -4 -142 601 625 ;
+C -1 ; WX 600 ; N idieresis ; B 77 0 523 625 ;
+C -1 ; WX 600 ; N Adieresis ; B -9 0 609 748 ;
+C -1 ; WX 600 ; N mu ; B -1 -142 569 439 ;
+C -1 ; WX 600 ; N trademark ; B -9 230 749 562 ;
+C -1 ; WX 600 ; N oacute ; B 30 -15 570 661 ;
+C -1 ; WX 600 ; N acircumflex ; B 35 -15 570 657 ;
+C -1 ; WX 600 ; N Agrave ; B -9 0 609 784 ;
+C -1 ; WX 600 ; N return ; B 19 0 581 562 ;
+C -1 ; WX 600 ; N atilde ; B 35 -15 570 636 ;
+C -1 ; WX 600 ; N square ; B 19 0 581 562 ;
+C -1 ; WX 600 ; N registered ; B 0 -18 600 580 ;
+C -1 ; WX 600 ; N stop ; B 19 0 581 562 ;
+C -1 ; WX 600 ; N udieresis ; B -1 -15 569 625 ;
+C -1 ; WX 600 ; N arrowup ; B 144 3 456 626 ;
+C -1 ; WX 600 ; N igrave ; B 77 0 523 661 ;
+C -1 ; WX 600 ; N Edieresis ; B 25 0 560 748 ;
+C -1 ; WX 600 ; N zcaron ; B 81 0 520 667 ;
+C -1 ; WX 600 ; N arrowboth ; B -24 143 624 455 ;
+C -1 ; WX 600 ; N gcaron ; B 30 -146 580 667 ;
+C -1 ; WX 600 ; N arrowleft ; B -24 143 634 455 ;
+C -1 ; WX 600 ; N aacute ; B 35 -15 570 661 ;
+C -1 ; WX 600 ; N ocircumflex ; B 30 -15 570 657 ;
+C -1 ; WX 600 ; N scedilla ; B 68 -206 535 459 ;
+C -1 ; WX 600 ; N ograve ; B 30 -15 570 661 ;
+C -1 ; WX 600 ; N onehalf ; B -47 -60 648 661 ;
+C -1 ; WX 600 ; N ugrave ; B -1 -15 569 661 ;
+C -1 ; WX 600 ; N Ntilde ; B 8 -12 610 759 ;
+C -1 ; WX 600 ; N iacute ; B 77 0 523 661 ;
+C -1 ; WX 600 ; N arrowright ; B -34 143 624 455 ;
+C -1 ; WX 600 ; N Thorn ; B 48 0 557 562 ;
+C -1 ; WX 600 ; N Egrave ; B 25 0 560 784 ;
+C -1 ; WX 600 ; N thorn ; B -14 -142 570 626 ;
+C -1 ; WX 600 ; N aring ; B 35 -15 570 678 ;
+C -1 ; WX 600 ; N yacute ; B -4 -142 601 661 ;
+C -1 ; WX 600 ; N icircumflex ; B 63 0 523 657 ;
+EndCharMetrics
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 30 123 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex -30 123 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis -20 123 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave -50 123 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring -10 123 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde -30 123 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 30 123 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 0 123 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 0 123 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 0 123 ;
+CC Gcaron 2 ; PCC G 0 0 ; PCC caron 10 123 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 0 123 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 0 123 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 0 123 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 0 123 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 0 123 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 0 123 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 0 123 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 0 123 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 0 123 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 0 123 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 0 123 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 30 123 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 0 123 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 0 123 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave -30 123 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 30 123 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 0 123 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 0 123 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 0 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex -20 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis -10 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave -30 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 0 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 0 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 0 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 0 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 0 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 0 0 ;
+CC gcaron 2 ; PCC g 0 0 ; PCC caron -40 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute 0 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -40 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -40 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave 0 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 0 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 0 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 0 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 0 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 0 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 0 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 0 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 0 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex -20 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis -20 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave -30 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 30 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 10 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 0 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pcrbo8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pcrbo8a.afm
new file mode 100644
index 0000000..6e2c742
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pcrbo8a.afm
@@ -0,0 +1,344 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1989, 1990, 1991, Adobe Systems Incorporated. All rights reserved.
+Comment Creation Date: Tue Sep 17 14:13:24 1991
+Comment UniqueID 36389
+Comment VMusage 10055 54684
+FontName Courier-BoldOblique
+FullName Courier Bold Oblique
+FamilyName Courier
+Weight Bold
+ItalicAngle -12
+IsFixedPitch true
+FontBBox -56 -250 868 801
+UnderlinePosition -100
+UnderlineThickness 50
+Version 002.004
+Notice Copyright (c) 1989, 1990, 1991, Adobe Systems Incorporated. All rights reserved.
+EncodingScheme AdobeStandardEncoding
+CapHeight 562
+XHeight 439
+Ascender 626
+Descender -142
+StartCharMetrics 260
+C 32 ; WX 600 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 600 ; N exclam ; B 216 -15 495 572 ;
+C 34 ; WX 600 ; N quotedbl ; B 212 277 584 562 ;
+C 35 ; WX 600 ; N numbersign ; B 88 -45 640 651 ;
+C 36 ; WX 600 ; N dollar ; B 87 -126 629 666 ;
+C 37 ; WX 600 ; N percent ; B 102 -15 624 616 ;
+C 38 ; WX 600 ; N ampersand ; B 62 -15 594 543 ;
+C 39 ; WX 600 ; N quoteright ; B 230 277 542 562 ;
+C 40 ; WX 600 ; N parenleft ; B 266 -102 592 616 ;
+C 41 ; WX 600 ; N parenright ; B 117 -102 444 616 ;
+C 42 ; WX 600 ; N asterisk ; B 179 219 597 601 ;
+C 43 ; WX 600 ; N plus ; B 114 39 596 478 ;
+C 44 ; WX 600 ; N comma ; B 99 -111 430 174 ;
+C 45 ; WX 600 ; N hyphen ; B 143 203 567 313 ;
+C 46 ; WX 600 ; N period ; B 207 -15 426 171 ;
+C 47 ; WX 600 ; N slash ; B 91 -77 626 626 ;
+C 48 ; WX 600 ; N zero ; B 136 -15 592 616 ;
+C 49 ; WX 600 ; N one ; B 93 0 561 616 ;
+C 50 ; WX 600 ; N two ; B 61 0 593 616 ;
+C 51 ; WX 600 ; N three ; B 72 -15 571 616 ;
+C 52 ; WX 600 ; N four ; B 82 0 558 616 ;
+C 53 ; WX 600 ; N five ; B 77 -15 621 601 ;
+C 54 ; WX 600 ; N six ; B 136 -15 652 616 ;
+C 55 ; WX 600 ; N seven ; B 147 0 622 601 ;
+C 56 ; WX 600 ; N eight ; B 115 -15 604 616 ;
+C 57 ; WX 600 ; N nine ; B 76 -15 592 616 ;
+C 58 ; WX 600 ; N colon ; B 206 -15 479 425 ;
+C 59 ; WX 600 ; N semicolon ; B 99 -111 480 425 ;
+C 60 ; WX 600 ; N less ; B 121 15 612 501 ;
+C 61 ; WX 600 ; N equal ; B 96 118 614 398 ;
+C 62 ; WX 600 ; N greater ; B 97 15 589 501 ;
+C 63 ; WX 600 ; N question ; B 183 -14 591 580 ;
+C 64 ; WX 600 ; N at ; B 66 -15 641 616 ;
+C 65 ; WX 600 ; N A ; B -9 0 631 562 ;
+C 66 ; WX 600 ; N B ; B 30 0 629 562 ;
+C 67 ; WX 600 ; N C ; B 75 -18 674 580 ;
+C 68 ; WX 600 ; N D ; B 30 0 664 562 ;
+C 69 ; WX 600 ; N E ; B 25 0 669 562 ;
+C 70 ; WX 600 ; N F ; B 39 0 683 562 ;
+C 71 ; WX 600 ; N G ; B 75 -18 674 580 ;
+C 72 ; WX 600 ; N H ; B 20 0 699 562 ;
+C 73 ; WX 600 ; N I ; B 77 0 642 562 ;
+C 74 ; WX 600 ; N J ; B 59 -18 720 562 ;
+C 75 ; WX 600 ; N K ; B 21 0 691 562 ;
+C 76 ; WX 600 ; N L ; B 39 0 635 562 ;
+C 77 ; WX 600 ; N M ; B -2 0 721 562 ;
+C 78 ; WX 600 ; N N ; B 8 -12 729 562 ;
+C 79 ; WX 600 ; N O ; B 74 -18 645 580 ;
+C 80 ; WX 600 ; N P ; B 48 0 642 562 ;
+C 81 ; WX 600 ; N Q ; B 84 -138 636 580 ;
+C 82 ; WX 600 ; N R ; B 24 0 617 562 ;
+C 83 ; WX 600 ; N S ; B 54 -22 672 582 ;
+C 84 ; WX 600 ; N T ; B 86 0 678 562 ;
+C 85 ; WX 600 ; N U ; B 101 -18 715 562 ;
+C 86 ; WX 600 ; N V ; B 84 0 732 562 ;
+C 87 ; WX 600 ; N W ; B 84 0 737 562 ;
+C 88 ; WX 600 ; N X ; B 12 0 689 562 ;
+C 89 ; WX 600 ; N Y ; B 109 0 708 562 ;
+C 90 ; WX 600 ; N Z ; B 62 0 636 562 ;
+C 91 ; WX 600 ; N bracketleft ; B 223 -102 606 616 ;
+C 92 ; WX 600 ; N backslash ; B 223 -77 496 626 ;
+C 93 ; WX 600 ; N bracketright ; B 103 -102 486 616 ;
+C 94 ; WX 600 ; N asciicircum ; B 171 250 555 616 ;
+C 95 ; WX 600 ; N underscore ; B -27 -125 584 -75 ;
+C 96 ; WX 600 ; N quoteleft ; B 297 277 487 562 ;
+C 97 ; WX 600 ; N a ; B 62 -15 592 454 ;
+C 98 ; WX 600 ; N b ; B 13 -15 636 626 ;
+C 99 ; WX 600 ; N c ; B 81 -15 631 459 ;
+C 100 ; WX 600 ; N d ; B 61 -15 644 626 ;
+C 101 ; WX 600 ; N e ; B 81 -15 604 454 ;
+C 102 ; WX 600 ; N f ; B 83 0 677 626 ; L i fi ; L l fl ;
+C 103 ; WX 600 ; N g ; B 41 -146 673 454 ;
+C 104 ; WX 600 ; N h ; B 18 0 614 626 ;
+C 105 ; WX 600 ; N i ; B 77 0 545 658 ;
+C 106 ; WX 600 ; N j ; B 37 -146 580 658 ;
+C 107 ; WX 600 ; N k ; B 33 0 642 626 ;
+C 108 ; WX 600 ; N l ; B 77 0 545 626 ;
+C 109 ; WX 600 ; N m ; B -22 0 648 454 ;
+C 110 ; WX 600 ; N n ; B 18 0 614 454 ;
+C 111 ; WX 600 ; N o ; B 71 -15 622 454 ;
+C 112 ; WX 600 ; N p ; B -31 -142 622 454 ;
+C 113 ; WX 600 ; N q ; B 61 -142 684 454 ;
+C 114 ; WX 600 ; N r ; B 47 0 654 454 ;
+C 115 ; WX 600 ; N s ; B 67 -17 607 459 ;
+C 116 ; WX 600 ; N t ; B 118 -15 566 562 ;
+C 117 ; WX 600 ; N u ; B 70 -15 591 439 ;
+C 118 ; WX 600 ; N v ; B 70 0 694 439 ;
+C 119 ; WX 600 ; N w ; B 53 0 711 439 ;
+C 120 ; WX 600 ; N x ; B 6 0 670 439 ;
+C 121 ; WX 600 ; N y ; B -20 -142 694 439 ;
+C 122 ; WX 600 ; N z ; B 81 0 613 439 ;
+C 123 ; WX 600 ; N braceleft ; B 204 -102 595 616 ;
+C 124 ; WX 600 ; N bar ; B 202 -250 504 750 ;
+C 125 ; WX 600 ; N braceright ; B 114 -102 506 616 ;
+C 126 ; WX 600 ; N asciitilde ; B 120 153 589 356 ;
+C 161 ; WX 600 ; N exclamdown ; B 197 -146 477 449 ;
+C 162 ; WX 600 ; N cent ; B 121 -49 604 614 ;
+C 163 ; WX 600 ; N sterling ; B 107 -28 650 611 ;
+C 164 ; WX 600 ; N fraction ; B 22 -60 707 661 ;
+C 165 ; WX 600 ; N yen ; B 98 0 709 562 ;
+C 166 ; WX 600 ; N florin ; B -56 -131 701 616 ;
+C 167 ; WX 600 ; N section ; B 74 -70 619 580 ;
+C 168 ; WX 600 ; N currency ; B 77 49 643 517 ;
+C 169 ; WX 600 ; N quotesingle ; B 304 277 492 562 ;
+C 170 ; WX 600 ; N quotedblleft ; B 190 277 594 562 ;
+C 171 ; WX 600 ; N guillemotleft ; B 63 70 638 446 ;
+C 172 ; WX 600 ; N guilsinglleft ; B 196 70 544 446 ;
+C 173 ; WX 600 ; N guilsinglright ; B 166 70 514 446 ;
+C 174 ; WX 600 ; N fi ; B 12 0 643 626 ;
+C 175 ; WX 600 ; N fl ; B 12 0 643 626 ;
+C 177 ; WX 600 ; N endash ; B 108 203 602 313 ;
+C 178 ; WX 600 ; N dagger ; B 176 -70 586 580 ;
+C 179 ; WX 600 ; N daggerdbl ; B 122 -70 586 580 ;
+C 180 ; WX 600 ; N periodcentered ; B 249 165 461 351 ;
+C 182 ; WX 600 ; N paragraph ; B 61 -70 699 580 ;
+C 183 ; WX 600 ; N bullet ; B 197 132 523 430 ;
+C 184 ; WX 600 ; N quotesinglbase ; B 145 -142 457 143 ;
+C 185 ; WX 600 ; N quotedblbase ; B 35 -142 559 143 ;
+C 186 ; WX 600 ; N quotedblright ; B 120 277 644 562 ;
+C 187 ; WX 600 ; N guillemotright ; B 72 70 647 446 ;
+C 188 ; WX 600 ; N ellipsis ; B 35 -15 586 116 ;
+C 189 ; WX 600 ; N perthousand ; B -44 -15 742 616 ;
+C 191 ; WX 600 ; N questiondown ; B 101 -146 509 449 ;
+C 193 ; WX 600 ; N grave ; B 272 508 503 661 ;
+C 194 ; WX 600 ; N acute ; B 313 508 608 661 ;
+C 195 ; WX 600 ; N circumflex ; B 212 483 606 657 ;
+C 196 ; WX 600 ; N tilde ; B 200 493 642 636 ;
+C 197 ; WX 600 ; N macron ; B 195 505 636 585 ;
+C 198 ; WX 600 ; N breve ; B 217 468 651 631 ;
+C 199 ; WX 600 ; N dotaccent ; B 346 485 490 625 ;
+C 200 ; WX 600 ; N dieresis ; B 244 485 592 625 ;
+C 202 ; WX 600 ; N ring ; B 319 481 528 678 ;
+C 203 ; WX 600 ; N cedilla ; B 169 -206 367 0 ;
+C 205 ; WX 600 ; N hungarumlaut ; B 172 488 728 661 ;
+C 206 ; WX 600 ; N ogonek ; B 144 -199 350 0 ;
+C 207 ; WX 600 ; N caron ; B 238 493 632 667 ;
+C 208 ; WX 600 ; N emdash ; B 33 203 677 313 ;
+C 225 ; WX 600 ; N AE ; B -29 0 707 562 ;
+C 227 ; WX 600 ; N ordfeminine ; B 189 196 526 580 ;
+C 232 ; WX 600 ; N Lslash ; B 39 0 635 562 ;
+C 233 ; WX 600 ; N Oslash ; B 48 -22 672 584 ;
+C 234 ; WX 600 ; N OE ; B 26 0 700 562 ;
+C 235 ; WX 600 ; N ordmasculine ; B 189 196 542 580 ;
+C 241 ; WX 600 ; N ae ; B 21 -15 651 454 ;
+C 245 ; WX 600 ; N dotlessi ; B 77 0 545 439 ;
+C 248 ; WX 600 ; N lslash ; B 77 0 578 626 ;
+C 249 ; WX 600 ; N oslash ; B 55 -24 637 463 ;
+C 250 ; WX 600 ; N oe ; B 19 -15 661 454 ;
+C 251 ; WX 600 ; N germandbls ; B 22 -15 628 626 ;
+C -1 ; WX 600 ; N Odieresis ; B 74 -18 645 748 ;
+C -1 ; WX 600 ; N logicalnot ; B 135 103 617 413 ;
+C -1 ; WX 600 ; N minus ; B 114 203 596 313 ;
+C -1 ; WX 600 ; N merge ; B 168 -15 533 487 ;
+C -1 ; WX 600 ; N degree ; B 173 243 569 616 ;
+C -1 ; WX 600 ; N dectab ; B 8 0 615 320 ;
+C -1 ; WX 600 ; N ll ; B 1 0 653 626 ;
+C -1 ; WX 600 ; N IJ ; B -8 -18 741 562 ;
+C -1 ; WX 600 ; N Eacute ; B 25 0 669 784 ;
+C -1 ; WX 600 ; N Ocircumflex ; B 74 -18 645 780 ;
+C -1 ; WX 600 ; N ucircumflex ; B 70 -15 591 657 ;
+C -1 ; WX 600 ; N left ; B 109 44 589 371 ;
+C -1 ; WX 600 ; N threesuperior ; B 193 222 525 616 ;
+C -1 ; WX 600 ; N up ; B 196 0 523 447 ;
+C -1 ; WX 600 ; N multiply ; B 105 39 606 478 ;
+C -1 ; WX 600 ; N Scaron ; B 54 -22 672 790 ;
+C -1 ; WX 600 ; N tab ; B 19 0 641 562 ;
+C -1 ; WX 600 ; N Ucircumflex ; B 101 -18 715 780 ;
+C -1 ; WX 600 ; N divide ; B 114 16 596 500 ;
+C -1 ; WX 600 ; N Acircumflex ; B -9 0 631 780 ;
+C -1 ; WX 600 ; N eacute ; B 81 -15 608 661 ;
+C -1 ; WX 600 ; N uacute ; B 70 -15 608 661 ;
+C -1 ; WX 600 ; N Aacute ; B -9 0 665 784 ;
+C -1 ; WX 600 ; N copyright ; B 53 -18 667 580 ;
+C -1 ; WX 600 ; N twosuperior ; B 192 230 541 616 ;
+C -1 ; WX 600 ; N Ecircumflex ; B 25 0 669 780 ;
+C -1 ; WX 600 ; N ntilde ; B 18 0 642 636 ;
+C -1 ; WX 600 ; N down ; B 168 -15 496 439 ;
+C -1 ; WX 600 ; N center ; B 103 14 623 580 ;
+C -1 ; WX 600 ; N onesuperior ; B 213 230 514 616 ;
+C -1 ; WX 600 ; N ij ; B 6 -146 714 658 ;
+C -1 ; WX 600 ; N edieresis ; B 81 -15 604 625 ;
+C -1 ; WX 600 ; N graybox ; B 76 0 652 599 ;
+C -1 ; WX 600 ; N odieresis ; B 71 -15 622 625 ;
+C -1 ; WX 600 ; N Ograve ; B 74 -18 645 784 ;
+C -1 ; WX 600 ; N threequarters ; B 8 -60 698 661 ;
+C -1 ; WX 600 ; N plusminus ; B 76 24 614 515 ;
+C -1 ; WX 600 ; N prescription ; B 24 -15 632 562 ;
+C -1 ; WX 600 ; N eth ; B 93 -27 661 626 ;
+C -1 ; WX 600 ; N largebullet ; B 307 229 413 333 ;
+C -1 ; WX 600 ; N egrave ; B 81 -15 604 661 ;
+C -1 ; WX 600 ; N ccedilla ; B 81 -206 631 459 ;
+C -1 ; WX 600 ; N notegraphic ; B 91 -15 619 572 ;
+C -1 ; WX 600 ; N Udieresis ; B 101 -18 715 748 ;
+C -1 ; WX 600 ; N Gcaron ; B 75 -18 674 790 ;
+C -1 ; WX 600 ; N arrowdown ; B 174 -15 486 608 ;
+C -1 ; WX 600 ; N format ; B -26 -146 243 601 ;
+C -1 ; WX 600 ; N Otilde ; B 74 -18 668 759 ;
+C -1 ; WX 600 ; N Idieresis ; B 77 0 642 748 ;
+C -1 ; WX 600 ; N adieresis ; B 62 -15 592 625 ;
+C -1 ; WX 600 ; N ecircumflex ; B 81 -15 606 657 ;
+C -1 ; WX 600 ; N Eth ; B 30 0 664 562 ;
+C -1 ; WX 600 ; N onequarter ; B 14 -60 706 661 ;
+C -1 ; WX 600 ; N LL ; B -45 0 694 562 ;
+C -1 ; WX 600 ; N agrave ; B 62 -15 592 661 ;
+C -1 ; WX 600 ; N Zcaron ; B 62 0 659 790 ;
+C -1 ; WX 600 ; N Scedilla ; B 54 -206 672 582 ;
+C -1 ; WX 600 ; N Idot ; B 77 0 642 748 ;
+C -1 ; WX 600 ; N Iacute ; B 77 0 642 784 ;
+C -1 ; WX 600 ; N indent ; B 99 45 579 372 ;
+C -1 ; WX 600 ; N Ugrave ; B 101 -18 715 784 ;
+C -1 ; WX 600 ; N scaron ; B 67 -17 632 667 ;
+C -1 ; WX 600 ; N overscore ; B 123 579 734 629 ;
+C -1 ; WX 600 ; N Aring ; B -9 0 631 801 ;
+C -1 ; WX 600 ; N Ccedilla ; B 74 -206 674 580 ;
+C -1 ; WX 600 ; N Igrave ; B 77 0 642 784 ;
+C -1 ; WX 600 ; N brokenbar ; B 218 -175 488 675 ;
+C -1 ; WX 600 ; N Oacute ; B 74 -18 645 784 ;
+C -1 ; WX 600 ; N otilde ; B 71 -15 642 636 ;
+C -1 ; WX 600 ; N Yacute ; B 109 0 708 784 ;
+C -1 ; WX 600 ; N lira ; B 107 -28 650 611 ;
+C -1 ; WX 600 ; N Icircumflex ; B 77 0 642 780 ;
+C -1 ; WX 600 ; N Atilde ; B -9 0 638 759 ;
+C -1 ; WX 600 ; N Uacute ; B 101 -18 715 784 ;
+C -1 ; WX 600 ; N Ydieresis ; B 109 0 708 748 ;
+C -1 ; WX 600 ; N ydieresis ; B -20 -142 694 625 ;
+C -1 ; WX 600 ; N idieresis ; B 77 0 552 625 ;
+C -1 ; WX 600 ; N Adieresis ; B -9 0 631 748 ;
+C -1 ; WX 600 ; N mu ; B 50 -142 591 439 ;
+C -1 ; WX 600 ; N trademark ; B 86 230 868 562 ;
+C -1 ; WX 600 ; N oacute ; B 71 -15 622 661 ;
+C -1 ; WX 600 ; N acircumflex ; B 62 -15 592 657 ;
+C -1 ; WX 600 ; N Agrave ; B -9 0 631 784 ;
+C -1 ; WX 600 ; N return ; B 79 0 700 562 ;
+C -1 ; WX 600 ; N atilde ; B 62 -15 642 636 ;
+C -1 ; WX 600 ; N square ; B 19 0 700 562 ;
+C -1 ; WX 600 ; N registered ; B 53 -18 667 580 ;
+C -1 ; WX 600 ; N stop ; B 19 0 700 562 ;
+C -1 ; WX 600 ; N udieresis ; B 70 -15 591 625 ;
+C -1 ; WX 600 ; N arrowup ; B 244 3 556 626 ;
+C -1 ; WX 600 ; N igrave ; B 77 0 545 661 ;
+C -1 ; WX 600 ; N Edieresis ; B 25 0 669 748 ;
+C -1 ; WX 600 ; N zcaron ; B 81 0 632 667 ;
+C -1 ; WX 600 ; N arrowboth ; B 40 143 688 455 ;
+C -1 ; WX 600 ; N gcaron ; B 41 -146 673 667 ;
+C -1 ; WX 600 ; N arrowleft ; B 40 143 708 455 ;
+C -1 ; WX 600 ; N aacute ; B 62 -15 608 661 ;
+C -1 ; WX 600 ; N ocircumflex ; B 71 -15 622 657 ;
+C -1 ; WX 600 ; N scedilla ; B 67 -206 607 459 ;
+C -1 ; WX 600 ; N ograve ; B 71 -15 622 661 ;
+C -1 ; WX 600 ; N onehalf ; B 23 -60 715 661 ;
+C -1 ; WX 600 ; N ugrave ; B 70 -15 591 661 ;
+C -1 ; WX 600 ; N Ntilde ; B 8 -12 729 759 ;
+C -1 ; WX 600 ; N iacute ; B 77 0 608 661 ;
+C -1 ; WX 600 ; N arrowright ; B 20 143 688 455 ;
+C -1 ; WX 600 ; N Thorn ; B 48 0 619 562 ;
+C -1 ; WX 600 ; N Egrave ; B 25 0 669 784 ;
+C -1 ; WX 600 ; N thorn ; B -31 -142 622 626 ;
+C -1 ; WX 600 ; N aring ; B 62 -15 592 678 ;
+C -1 ; WX 600 ; N yacute ; B -20 -142 694 661 ;
+C -1 ; WX 600 ; N icircumflex ; B 77 0 566 657 ;
+EndCharMetrics
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 56 123 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex -4 123 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 6 123 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave -24 123 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 16 123 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde -4 123 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 56 123 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 26 123 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 26 123 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 26 123 ;
+CC Gcaron 2 ; PCC G 0 0 ; PCC caron 36 123 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 26 123 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 26 123 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 26 123 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 26 123 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 26 123 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 26 123 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 26 123 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 26 123 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 26 123 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 26 123 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 26 123 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 56 123 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 26 123 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 26 123 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave -4 123 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 56 123 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 26 123 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 26 123 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 0 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex -20 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis -10 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave -30 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 0 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 0 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 0 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 0 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 0 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 0 0 ;
+CC gcaron 2 ; PCC g 0 0 ; PCC caron -40 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute 0 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -40 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -40 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave 0 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 0 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 0 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 0 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 0 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 0 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 0 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 0 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 0 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex -20 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis -20 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave -30 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 30 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 10 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 0 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pcrr8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pcrr8a.afm
new file mode 100644
index 0000000..f60ec94
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pcrr8a.afm
@@ -0,0 +1,344 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1989, 1990, 1991 Adobe Systems Incorporated. All rights reserved.
+Comment Creation Date: Tue Sep 17 07:47:21 1991
+Comment UniqueID 36347
+Comment VMusage 31037 39405
+FontName Courier
+FullName Courier
+FamilyName Courier
+Weight Medium
+ItalicAngle 0
+IsFixedPitch true
+FontBBox -28 -250 628 805
+UnderlinePosition -100
+UnderlineThickness 50
+Version 002.004
+Notice Copyright (c) 1989, 1990, 1991 Adobe Systems Incorporated. All rights reserved.
+EncodingScheme AdobeStandardEncoding
+CapHeight 562
+XHeight 426
+Ascender 629
+Descender -157
+StartCharMetrics 260
+C 32 ; WX 600 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 600 ; N exclam ; B 236 -15 364 572 ;
+C 34 ; WX 600 ; N quotedbl ; B 187 328 413 562 ;
+C 35 ; WX 600 ; N numbersign ; B 93 -32 507 639 ;
+C 36 ; WX 600 ; N dollar ; B 105 -126 496 662 ;
+C 37 ; WX 600 ; N percent ; B 81 -15 518 622 ;
+C 38 ; WX 600 ; N ampersand ; B 63 -15 538 543 ;
+C 39 ; WX 600 ; N quoteright ; B 213 328 376 562 ;
+C 40 ; WX 600 ; N parenleft ; B 269 -108 440 622 ;
+C 41 ; WX 600 ; N parenright ; B 160 -108 331 622 ;
+C 42 ; WX 600 ; N asterisk ; B 116 257 484 607 ;
+C 43 ; WX 600 ; N plus ; B 80 44 520 470 ;
+C 44 ; WX 600 ; N comma ; B 181 -112 344 122 ;
+C 45 ; WX 600 ; N hyphen ; B 103 231 497 285 ;
+C 46 ; WX 600 ; N period ; B 229 -15 371 109 ;
+C 47 ; WX 600 ; N slash ; B 125 -80 475 629 ;
+C 48 ; WX 600 ; N zero ; B 106 -15 494 622 ;
+C 49 ; WX 600 ; N one ; B 96 0 505 622 ;
+C 50 ; WX 600 ; N two ; B 70 0 471 622 ;
+C 51 ; WX 600 ; N three ; B 75 -15 466 622 ;
+C 52 ; WX 600 ; N four ; B 78 0 500 622 ;
+C 53 ; WX 600 ; N five ; B 92 -15 497 607 ;
+C 54 ; WX 600 ; N six ; B 111 -15 497 622 ;
+C 55 ; WX 600 ; N seven ; B 82 0 483 607 ;
+C 56 ; WX 600 ; N eight ; B 102 -15 498 622 ;
+C 57 ; WX 600 ; N nine ; B 96 -15 489 622 ;
+C 58 ; WX 600 ; N colon ; B 229 -15 371 385 ;
+C 59 ; WX 600 ; N semicolon ; B 181 -112 371 385 ;
+C 60 ; WX 600 ; N less ; B 41 42 519 472 ;
+C 61 ; WX 600 ; N equal ; B 80 138 520 376 ;
+C 62 ; WX 600 ; N greater ; B 66 42 544 472 ;
+C 63 ; WX 600 ; N question ; B 129 -15 492 572 ;
+C 64 ; WX 600 ; N at ; B 77 -15 533 622 ;
+C 65 ; WX 600 ; N A ; B 3 0 597 562 ;
+C 66 ; WX 600 ; N B ; B 43 0 559 562 ;
+C 67 ; WX 600 ; N C ; B 41 -18 540 580 ;
+C 68 ; WX 600 ; N D ; B 43 0 574 562 ;
+C 69 ; WX 600 ; N E ; B 53 0 550 562 ;
+C 70 ; WX 600 ; N F ; B 53 0 545 562 ;
+C 71 ; WX 600 ; N G ; B 31 -18 575 580 ;
+C 72 ; WX 600 ; N H ; B 32 0 568 562 ;
+C 73 ; WX 600 ; N I ; B 96 0 504 562 ;
+C 74 ; WX 600 ; N J ; B 34 -18 566 562 ;
+C 75 ; WX 600 ; N K ; B 38 0 582 562 ;
+C 76 ; WX 600 ; N L ; B 47 0 554 562 ;
+C 77 ; WX 600 ; N M ; B 4 0 596 562 ;
+C 78 ; WX 600 ; N N ; B 7 -13 593 562 ;
+C 79 ; WX 600 ; N O ; B 43 -18 557 580 ;
+C 80 ; WX 600 ; N P ; B 79 0 558 562 ;
+C 81 ; WX 600 ; N Q ; B 43 -138 557 580 ;
+C 82 ; WX 600 ; N R ; B 38 0 588 562 ;
+C 83 ; WX 600 ; N S ; B 72 -20 529 580 ;
+C 84 ; WX 600 ; N T ; B 38 0 563 562 ;
+C 85 ; WX 600 ; N U ; B 17 -18 583 562 ;
+C 86 ; WX 600 ; N V ; B -4 -13 604 562 ;
+C 87 ; WX 600 ; N W ; B -3 -13 603 562 ;
+C 88 ; WX 600 ; N X ; B 23 0 577 562 ;
+C 89 ; WX 600 ; N Y ; B 24 0 576 562 ;
+C 90 ; WX 600 ; N Z ; B 86 0 514 562 ;
+C 91 ; WX 600 ; N bracketleft ; B 269 -108 442 622 ;
+C 92 ; WX 600 ; N backslash ; B 118 -80 482 629 ;
+C 93 ; WX 600 ; N bracketright ; B 158 -108 331 622 ;
+C 94 ; WX 600 ; N asciicircum ; B 94 354 506 622 ;
+C 95 ; WX 600 ; N underscore ; B 0 -125 600 -75 ;
+C 96 ; WX 600 ; N quoteleft ; B 224 328 387 562 ;
+C 97 ; WX 600 ; N a ; B 53 -15 559 441 ;
+C 98 ; WX 600 ; N b ; B 14 -15 575 629 ;
+C 99 ; WX 600 ; N c ; B 66 -15 529 441 ;
+C 100 ; WX 600 ; N d ; B 45 -15 591 629 ;
+C 101 ; WX 600 ; N e ; B 66 -15 548 441 ;
+C 102 ; WX 600 ; N f ; B 114 0 531 629 ; L i fi ; L l fl ;
+C 103 ; WX 600 ; N g ; B 45 -157 566 441 ;
+C 104 ; WX 600 ; N h ; B 18 0 582 629 ;
+C 105 ; WX 600 ; N i ; B 95 0 505 657 ;
+C 106 ; WX 600 ; N j ; B 82 -157 410 657 ;
+C 107 ; WX 600 ; N k ; B 43 0 580 629 ;
+C 108 ; WX 600 ; N l ; B 95 0 505 629 ;
+C 109 ; WX 600 ; N m ; B -5 0 605 441 ;
+C 110 ; WX 600 ; N n ; B 26 0 575 441 ;
+C 111 ; WX 600 ; N o ; B 62 -15 538 441 ;
+C 112 ; WX 600 ; N p ; B 9 -157 555 441 ;
+C 113 ; WX 600 ; N q ; B 45 -157 591 441 ;
+C 114 ; WX 600 ; N r ; B 60 0 559 441 ;
+C 115 ; WX 600 ; N s ; B 80 -15 513 441 ;
+C 116 ; WX 600 ; N t ; B 87 -15 530 561 ;
+C 117 ; WX 600 ; N u ; B 21 -15 562 426 ;
+C 118 ; WX 600 ; N v ; B 10 -10 590 426 ;
+C 119 ; WX 600 ; N w ; B -4 -10 604 426 ;
+C 120 ; WX 600 ; N x ; B 20 0 580 426 ;
+C 121 ; WX 600 ; N y ; B 7 -157 592 426 ;
+C 122 ; WX 600 ; N z ; B 99 0 502 426 ;
+C 123 ; WX 600 ; N braceleft ; B 182 -108 437 622 ;
+C 124 ; WX 600 ; N bar ; B 275 -250 326 750 ;
+C 125 ; WX 600 ; N braceright ; B 163 -108 418 622 ;
+C 126 ; WX 600 ; N asciitilde ; B 63 197 540 320 ;
+C 161 ; WX 600 ; N exclamdown ; B 236 -157 364 430 ;
+C 162 ; WX 600 ; N cent ; B 96 -49 500 614 ;
+C 163 ; WX 600 ; N sterling ; B 84 -21 521 611 ;
+C 164 ; WX 600 ; N fraction ; B 92 -57 509 665 ;
+C 165 ; WX 600 ; N yen ; B 26 0 574 562 ;
+C 166 ; WX 600 ; N florin ; B 4 -143 539 622 ;
+C 167 ; WX 600 ; N section ; B 113 -78 488 580 ;
+C 168 ; WX 600 ; N currency ; B 73 58 527 506 ;
+C 169 ; WX 600 ; N quotesingle ; B 259 328 341 562 ;
+C 170 ; WX 600 ; N quotedblleft ; B 143 328 471 562 ;
+C 171 ; WX 600 ; N guillemotleft ; B 37 70 563 446 ;
+C 172 ; WX 600 ; N guilsinglleft ; B 149 70 451 446 ;
+C 173 ; WX 600 ; N guilsinglright ; B 149 70 451 446 ;
+C 174 ; WX 600 ; N fi ; B 3 0 597 629 ;
+C 175 ; WX 600 ; N fl ; B 3 0 597 629 ;
+C 177 ; WX 600 ; N endash ; B 75 231 525 285 ;
+C 178 ; WX 600 ; N dagger ; B 141 -78 459 580 ;
+C 179 ; WX 600 ; N daggerdbl ; B 141 -78 459 580 ;
+C 180 ; WX 600 ; N periodcentered ; B 222 189 378 327 ;
+C 182 ; WX 600 ; N paragraph ; B 50 -78 511 562 ;
+C 183 ; WX 600 ; N bullet ; B 172 130 428 383 ;
+C 184 ; WX 600 ; N quotesinglbase ; B 213 -134 376 100 ;
+C 185 ; WX 600 ; N quotedblbase ; B 143 -134 457 100 ;
+C 186 ; WX 600 ; N quotedblright ; B 143 328 457 562 ;
+C 187 ; WX 600 ; N guillemotright ; B 37 70 563 446 ;
+C 188 ; WX 600 ; N ellipsis ; B 37 -15 563 111 ;
+C 189 ; WX 600 ; N perthousand ; B 3 -15 600 622 ;
+C 191 ; WX 600 ; N questiondown ; B 108 -157 471 430 ;
+C 193 ; WX 600 ; N grave ; B 151 497 378 672 ;
+C 194 ; WX 600 ; N acute ; B 242 497 469 672 ;
+C 195 ; WX 600 ; N circumflex ; B 124 477 476 654 ;
+C 196 ; WX 600 ; N tilde ; B 105 489 503 606 ;
+C 197 ; WX 600 ; N macron ; B 120 525 480 565 ;
+C 198 ; WX 600 ; N breve ; B 153 501 447 609 ;
+C 199 ; WX 600 ; N dotaccent ; B 249 477 352 580 ;
+C 200 ; WX 600 ; N dieresis ; B 148 492 453 595 ;
+C 202 ; WX 600 ; N ring ; B 218 463 382 627 ;
+C 203 ; WX 600 ; N cedilla ; B 224 -151 362 10 ;
+C 205 ; WX 600 ; N hungarumlaut ; B 133 497 540 672 ;
+C 206 ; WX 600 ; N ogonek ; B 227 -151 370 0 ;
+C 207 ; WX 600 ; N caron ; B 124 492 476 669 ;
+C 208 ; WX 600 ; N emdash ; B 0 231 600 285 ;
+C 225 ; WX 600 ; N AE ; B 3 0 550 562 ;
+C 227 ; WX 600 ; N ordfeminine ; B 156 249 442 580 ;
+C 232 ; WX 600 ; N Lslash ; B 47 0 554 562 ;
+C 233 ; WX 600 ; N Oslash ; B 43 -80 557 629 ;
+C 234 ; WX 600 ; N OE ; B 7 0 567 562 ;
+C 235 ; WX 600 ; N ordmasculine ; B 157 249 443 580 ;
+C 241 ; WX 600 ; N ae ; B 19 -15 570 441 ;
+C 245 ; WX 600 ; N dotlessi ; B 95 0 505 426 ;
+C 248 ; WX 600 ; N lslash ; B 95 0 505 629 ;
+C 249 ; WX 600 ; N oslash ; B 62 -80 538 506 ;
+C 250 ; WX 600 ; N oe ; B 19 -15 559 441 ;
+C 251 ; WX 600 ; N germandbls ; B 48 -15 588 629 ;
+C -1 ; WX 600 ; N Odieresis ; B 43 -18 557 731 ;
+C -1 ; WX 600 ; N logicalnot ; B 87 108 513 369 ;
+C -1 ; WX 600 ; N minus ; B 80 232 520 283 ;
+C -1 ; WX 600 ; N merge ; B 160 -15 440 436 ;
+C -1 ; WX 600 ; N degree ; B 123 269 477 622 ;
+C -1 ; WX 600 ; N dectab ; B 18 0 582 227 ;
+C -1 ; WX 600 ; N ll ; B 18 0 567 629 ;
+C -1 ; WX 600 ; N IJ ; B 32 -18 583 562 ;
+C -1 ; WX 600 ; N Eacute ; B 53 0 550 793 ;
+C -1 ; WX 600 ; N Ocircumflex ; B 43 -18 557 775 ;
+C -1 ; WX 600 ; N ucircumflex ; B 21 -15 562 654 ;
+C -1 ; WX 600 ; N left ; B 70 68 530 348 ;
+C -1 ; WX 600 ; N threesuperior ; B 155 240 406 622 ;
+C -1 ; WX 600 ; N up ; B 160 0 440 437 ;
+C -1 ; WX 600 ; N multiply ; B 87 43 515 470 ;
+C -1 ; WX 600 ; N Scaron ; B 72 -20 529 805 ;
+C -1 ; WX 600 ; N tab ; B 19 0 581 562 ;
+C -1 ; WX 600 ; N Ucircumflex ; B 17 -18 583 775 ;
+C -1 ; WX 600 ; N divide ; B 87 48 513 467 ;
+C -1 ; WX 600 ; N Acircumflex ; B 3 0 597 775 ;
+C -1 ; WX 600 ; N eacute ; B 66 -15 548 672 ;
+C -1 ; WX 600 ; N uacute ; B 21 -15 562 672 ;
+C -1 ; WX 600 ; N Aacute ; B 3 0 597 793 ;
+C -1 ; WX 600 ; N copyright ; B 0 -18 600 580 ;
+C -1 ; WX 600 ; N twosuperior ; B 177 249 424 622 ;
+C -1 ; WX 600 ; N Ecircumflex ; B 53 0 550 775 ;
+C -1 ; WX 600 ; N ntilde ; B 26 0 575 606 ;
+C -1 ; WX 600 ; N down ; B 160 -15 440 426 ;
+C -1 ; WX 600 ; N center ; B 40 14 560 580 ;
+C -1 ; WX 600 ; N onesuperior ; B 172 249 428 622 ;
+C -1 ; WX 600 ; N ij ; B 37 -157 490 657 ;
+C -1 ; WX 600 ; N edieresis ; B 66 -15 548 595 ;
+C -1 ; WX 600 ; N graybox ; B 76 0 525 599 ;
+C -1 ; WX 600 ; N odieresis ; B 62 -15 538 595 ;
+C -1 ; WX 600 ; N Ograve ; B 43 -18 557 793 ;
+C -1 ; WX 600 ; N threequarters ; B 8 -56 593 666 ;
+C -1 ; WX 600 ; N plusminus ; B 87 44 513 558 ;
+C -1 ; WX 600 ; N prescription ; B 27 -15 577 562 ;
+C -1 ; WX 600 ; N eth ; B 62 -15 538 629 ;
+C -1 ; WX 600 ; N largebullet ; B 261 220 339 297 ;
+C -1 ; WX 600 ; N egrave ; B 66 -15 548 672 ;
+C -1 ; WX 600 ; N ccedilla ; B 66 -151 529 441 ;
+C -1 ; WX 600 ; N notegraphic ; B 136 -15 464 572 ;
+C -1 ; WX 600 ; N Udieresis ; B 17 -18 583 731 ;
+C -1 ; WX 600 ; N Gcaron ; B 31 -18 575 805 ;
+C -1 ; WX 600 ; N arrowdown ; B 116 -15 484 608 ;
+C -1 ; WX 600 ; N format ; B 5 -157 56 607 ;
+C -1 ; WX 600 ; N Otilde ; B 43 -18 557 732 ;
+C -1 ; WX 600 ; N Idieresis ; B 96 0 504 731 ;
+C -1 ; WX 600 ; N adieresis ; B 53 -15 559 595 ;
+C -1 ; WX 600 ; N ecircumflex ; B 66 -15 548 654 ;
+C -1 ; WX 600 ; N Eth ; B 30 0 574 562 ;
+C -1 ; WX 600 ; N onequarter ; B 0 -57 600 665 ;
+C -1 ; WX 600 ; N LL ; B 8 0 592 562 ;
+C -1 ; WX 600 ; N agrave ; B 53 -15 559 672 ;
+C -1 ; WX 600 ; N Zcaron ; B 86 0 514 805 ;
+C -1 ; WX 600 ; N Scedilla ; B 72 -151 529 580 ;
+C -1 ; WX 600 ; N Idot ; B 96 0 504 716 ;
+C -1 ; WX 600 ; N Iacute ; B 96 0 504 793 ;
+C -1 ; WX 600 ; N indent ; B 70 68 530 348 ;
+C -1 ; WX 600 ; N Ugrave ; B 17 -18 583 793 ;
+C -1 ; WX 600 ; N scaron ; B 80 -15 513 669 ;
+C -1 ; WX 600 ; N overscore ; B 0 579 600 629 ;
+C -1 ; WX 600 ; N Aring ; B 3 0 597 753 ;
+C -1 ; WX 600 ; N Ccedilla ; B 41 -151 540 580 ;
+C -1 ; WX 600 ; N Igrave ; B 96 0 504 793 ;
+C -1 ; WX 600 ; N brokenbar ; B 275 -175 326 675 ;
+C -1 ; WX 600 ; N Oacute ; B 43 -18 557 793 ;
+C -1 ; WX 600 ; N otilde ; B 62 -15 538 606 ;
+C -1 ; WX 600 ; N Yacute ; B 24 0 576 793 ;
+C -1 ; WX 600 ; N lira ; B 73 -21 521 611 ;
+C -1 ; WX 600 ; N Icircumflex ; B 96 0 504 775 ;
+C -1 ; WX 600 ; N Atilde ; B 3 0 597 732 ;
+C -1 ; WX 600 ; N Uacute ; B 17 -18 583 793 ;
+C -1 ; WX 600 ; N Ydieresis ; B 24 0 576 731 ;
+C -1 ; WX 600 ; N ydieresis ; B 7 -157 592 595 ;
+C -1 ; WX 600 ; N idieresis ; B 95 0 505 595 ;
+C -1 ; WX 600 ; N Adieresis ; B 3 0 597 731 ;
+C -1 ; WX 600 ; N mu ; B 21 -157 562 426 ;
+C -1 ; WX 600 ; N trademark ; B -23 263 623 562 ;
+C -1 ; WX 600 ; N oacute ; B 62 -15 538 672 ;
+C -1 ; WX 600 ; N acircumflex ; B 53 -15 559 654 ;
+C -1 ; WX 600 ; N Agrave ; B 3 0 597 793 ;
+C -1 ; WX 600 ; N return ; B 19 0 581 562 ;
+C -1 ; WX 600 ; N atilde ; B 53 -15 559 606 ;
+C -1 ; WX 600 ; N square ; B 19 0 581 562 ;
+C -1 ; WX 600 ; N registered ; B 0 -18 600 580 ;
+C -1 ; WX 600 ; N stop ; B 19 0 581 562 ;
+C -1 ; WX 600 ; N udieresis ; B 21 -15 562 595 ;
+C -1 ; WX 600 ; N arrowup ; B 116 0 484 623 ;
+C -1 ; WX 600 ; N igrave ; B 95 0 505 672 ;
+C -1 ; WX 600 ; N Edieresis ; B 53 0 550 731 ;
+C -1 ; WX 600 ; N zcaron ; B 99 0 502 669 ;
+C -1 ; WX 600 ; N arrowboth ; B -28 115 628 483 ;
+C -1 ; WX 600 ; N gcaron ; B 45 -157 566 669 ;
+C -1 ; WX 600 ; N arrowleft ; B -24 115 624 483 ;
+C -1 ; WX 600 ; N aacute ; B 53 -15 559 672 ;
+C -1 ; WX 600 ; N ocircumflex ; B 62 -15 538 654 ;
+C -1 ; WX 600 ; N scedilla ; B 80 -151 513 441 ;
+C -1 ; WX 600 ; N ograve ; B 62 -15 538 672 ;
+C -1 ; WX 600 ; N onehalf ; B 0 -57 611 665 ;
+C -1 ; WX 600 ; N ugrave ; B 21 -15 562 672 ;
+C -1 ; WX 600 ; N Ntilde ; B 7 -13 593 732 ;
+C -1 ; WX 600 ; N iacute ; B 95 0 505 672 ;
+C -1 ; WX 600 ; N arrowright ; B -24 115 624 483 ;
+C -1 ; WX 600 ; N Thorn ; B 79 0 538 562 ;
+C -1 ; WX 600 ; N Egrave ; B 53 0 550 793 ;
+C -1 ; WX 600 ; N thorn ; B -6 -157 555 629 ;
+C -1 ; WX 600 ; N aring ; B 53 -15 559 627 ;
+C -1 ; WX 600 ; N yacute ; B 7 -157 592 672 ;
+C -1 ; WX 600 ; N icircumflex ; B 94 0 505 654 ;
+EndCharMetrics
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 20 121 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex -30 121 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis -30 136 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave -30 121 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring -15 126 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 0 126 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 30 121 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 0 121 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 0 136 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 0 121 ;
+CC Gcaron 2 ; PCC G 0 0 ; PCC caron 0 136 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 0 121 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 0 121 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 0 136 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 0 121 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 0 126 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 0 121 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 0 121 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 0 136 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 0 121 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 0 126 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 30 136 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 30 121 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 0 121 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 0 136 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave -30 121 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 30 121 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 0 136 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 0 136 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 0 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 0 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 0 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 0 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 0 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 0 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 0 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 0 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 0 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 0 0 ;
+CC gcaron 2 ; PCC g 0 0 ; PCC caron -30 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute 0 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -30 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -30 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -30 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 0 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 0 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 0 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 0 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 0 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 0 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 0 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute -10 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex -10 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 0 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave -30 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute -20 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis -10 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 10 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pcrro8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pcrro8a.afm
new file mode 100644
index 0000000..b053a4c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pcrro8a.afm
@@ -0,0 +1,344 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1989, 1990, 1991 Adobe Systems Incorporated. All rights reserved.
+Comment Creation Date: Tue Sep 17 09:42:19 1991
+Comment UniqueID 36350
+Comment VMusage 9174 52297
+FontName Courier-Oblique
+FullName Courier Oblique
+FamilyName Courier
+Weight Medium
+ItalicAngle -12
+IsFixedPitch true
+FontBBox -28 -250 742 805
+UnderlinePosition -100
+UnderlineThickness 50
+Version 002.004
+Notice Copyright (c) 1989, 1990, 1991 Adobe Systems Incorporated. All rights reserved.
+EncodingScheme AdobeStandardEncoding
+CapHeight 562
+XHeight 426
+Ascender 629
+Descender -157
+StartCharMetrics 260
+C 32 ; WX 600 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 600 ; N exclam ; B 243 -15 464 572 ;
+C 34 ; WX 600 ; N quotedbl ; B 273 328 532 562 ;
+C 35 ; WX 600 ; N numbersign ; B 133 -32 596 639 ;
+C 36 ; WX 600 ; N dollar ; B 108 -126 596 662 ;
+C 37 ; WX 600 ; N percent ; B 134 -15 599 622 ;
+C 38 ; WX 600 ; N ampersand ; B 87 -15 580 543 ;
+C 39 ; WX 600 ; N quoteright ; B 283 328 495 562 ;
+C 40 ; WX 600 ; N parenleft ; B 313 -108 572 622 ;
+C 41 ; WX 600 ; N parenright ; B 137 -108 396 622 ;
+C 42 ; WX 600 ; N asterisk ; B 212 257 580 607 ;
+C 43 ; WX 600 ; N plus ; B 129 44 580 470 ;
+C 44 ; WX 600 ; N comma ; B 157 -112 370 122 ;
+C 45 ; WX 600 ; N hyphen ; B 152 231 558 285 ;
+C 46 ; WX 600 ; N period ; B 238 -15 382 109 ;
+C 47 ; WX 600 ; N slash ; B 112 -80 604 629 ;
+C 48 ; WX 600 ; N zero ; B 154 -15 575 622 ;
+C 49 ; WX 600 ; N one ; B 98 0 515 622 ;
+C 50 ; WX 600 ; N two ; B 70 0 568 622 ;
+C 51 ; WX 600 ; N three ; B 82 -15 538 622 ;
+C 52 ; WX 600 ; N four ; B 108 0 541 622 ;
+C 53 ; WX 600 ; N five ; B 99 -15 589 607 ;
+C 54 ; WX 600 ; N six ; B 155 -15 629 622 ;
+C 55 ; WX 600 ; N seven ; B 182 0 612 607 ;
+C 56 ; WX 600 ; N eight ; B 132 -15 588 622 ;
+C 57 ; WX 600 ; N nine ; B 93 -15 574 622 ;
+C 58 ; WX 600 ; N colon ; B 238 -15 441 385 ;
+C 59 ; WX 600 ; N semicolon ; B 157 -112 441 385 ;
+C 60 ; WX 600 ; N less ; B 96 42 610 472 ;
+C 61 ; WX 600 ; N equal ; B 109 138 600 376 ;
+C 62 ; WX 600 ; N greater ; B 85 42 599 472 ;
+C 63 ; WX 600 ; N question ; B 222 -15 583 572 ;
+C 64 ; WX 600 ; N at ; B 127 -15 582 622 ;
+C 65 ; WX 600 ; N A ; B 3 0 607 562 ;
+C 66 ; WX 600 ; N B ; B 43 0 616 562 ;
+C 67 ; WX 600 ; N C ; B 93 -18 655 580 ;
+C 68 ; WX 600 ; N D ; B 43 0 645 562 ;
+C 69 ; WX 600 ; N E ; B 53 0 660 562 ;
+C 70 ; WX 600 ; N F ; B 53 0 660 562 ;
+C 71 ; WX 600 ; N G ; B 83 -18 645 580 ;
+C 72 ; WX 600 ; N H ; B 32 0 687 562 ;
+C 73 ; WX 600 ; N I ; B 96 0 623 562 ;
+C 74 ; WX 600 ; N J ; B 52 -18 685 562 ;
+C 75 ; WX 600 ; N K ; B 38 0 671 562 ;
+C 76 ; WX 600 ; N L ; B 47 0 607 562 ;
+C 77 ; WX 600 ; N M ; B 4 0 715 562 ;
+C 78 ; WX 600 ; N N ; B 7 -13 712 562 ;
+C 79 ; WX 600 ; N O ; B 94 -18 625 580 ;
+C 80 ; WX 600 ; N P ; B 79 0 644 562 ;
+C 81 ; WX 600 ; N Q ; B 95 -138 625 580 ;
+C 82 ; WX 600 ; N R ; B 38 0 598 562 ;
+C 83 ; WX 600 ; N S ; B 76 -20 650 580 ;
+C 84 ; WX 600 ; N T ; B 108 0 665 562 ;
+C 85 ; WX 600 ; N U ; B 125 -18 702 562 ;
+C 86 ; WX 600 ; N V ; B 105 -13 723 562 ;
+C 87 ; WX 600 ; N W ; B 106 -13 722 562 ;
+C 88 ; WX 600 ; N X ; B 23 0 675 562 ;
+C 89 ; WX 600 ; N Y ; B 133 0 695 562 ;
+C 90 ; WX 600 ; N Z ; B 86 0 610 562 ;
+C 91 ; WX 600 ; N bracketleft ; B 246 -108 574 622 ;
+C 92 ; WX 600 ; N backslash ; B 249 -80 468 629 ;
+C 93 ; WX 600 ; N bracketright ; B 135 -108 463 622 ;
+C 94 ; WX 600 ; N asciicircum ; B 175 354 587 622 ;
+C 95 ; WX 600 ; N underscore ; B -27 -125 584 -75 ;
+C 96 ; WX 600 ; N quoteleft ; B 343 328 457 562 ;
+C 97 ; WX 600 ; N a ; B 76 -15 569 441 ;
+C 98 ; WX 600 ; N b ; B 29 -15 625 629 ;
+C 99 ; WX 600 ; N c ; B 106 -15 608 441 ;
+C 100 ; WX 600 ; N d ; B 85 -15 640 629 ;
+C 101 ; WX 600 ; N e ; B 106 -15 598 441 ;
+C 102 ; WX 600 ; N f ; B 114 0 662 629 ; L i fi ; L l fl ;
+C 103 ; WX 600 ; N g ; B 61 -157 657 441 ;
+C 104 ; WX 600 ; N h ; B 33 0 592 629 ;
+C 105 ; WX 600 ; N i ; B 95 0 515 657 ;
+C 106 ; WX 600 ; N j ; B 52 -157 550 657 ;
+C 107 ; WX 600 ; N k ; B 58 0 633 629 ;
+C 108 ; WX 600 ; N l ; B 95 0 515 629 ;
+C 109 ; WX 600 ; N m ; B -5 0 615 441 ;
+C 110 ; WX 600 ; N n ; B 26 0 585 441 ;
+C 111 ; WX 600 ; N o ; B 102 -15 588 441 ;
+C 112 ; WX 600 ; N p ; B -24 -157 605 441 ;
+C 113 ; WX 600 ; N q ; B 85 -157 682 441 ;
+C 114 ; WX 600 ; N r ; B 60 0 636 441 ;
+C 115 ; WX 600 ; N s ; B 78 -15 584 441 ;
+C 116 ; WX 600 ; N t ; B 167 -15 561 561 ;
+C 117 ; WX 600 ; N u ; B 101 -15 572 426 ;
+C 118 ; WX 600 ; N v ; B 90 -10 681 426 ;
+C 119 ; WX 600 ; N w ; B 76 -10 695 426 ;
+C 120 ; WX 600 ; N x ; B 20 0 655 426 ;
+C 121 ; WX 600 ; N y ; B -4 -157 683 426 ;
+C 122 ; WX 600 ; N z ; B 99 0 593 426 ;
+C 123 ; WX 600 ; N braceleft ; B 233 -108 569 622 ;
+C 124 ; WX 600 ; N bar ; B 222 -250 485 750 ;
+C 125 ; WX 600 ; N braceright ; B 140 -108 477 622 ;
+C 126 ; WX 600 ; N asciitilde ; B 116 197 600 320 ;
+C 161 ; WX 600 ; N exclamdown ; B 225 -157 445 430 ;
+C 162 ; WX 600 ; N cent ; B 151 -49 588 614 ;
+C 163 ; WX 600 ; N sterling ; B 124 -21 621 611 ;
+C 164 ; WX 600 ; N fraction ; B 84 -57 646 665 ;
+C 165 ; WX 600 ; N yen ; B 120 0 693 562 ;
+C 166 ; WX 600 ; N florin ; B -26 -143 671 622 ;
+C 167 ; WX 600 ; N section ; B 104 -78 590 580 ;
+C 168 ; WX 600 ; N currency ; B 94 58 628 506 ;
+C 169 ; WX 600 ; N quotesingle ; B 345 328 460 562 ;
+C 170 ; WX 600 ; N quotedblleft ; B 262 328 541 562 ;
+C 171 ; WX 600 ; N guillemotleft ; B 92 70 652 446 ;
+C 172 ; WX 600 ; N guilsinglleft ; B 204 70 540 446 ;
+C 173 ; WX 600 ; N guilsinglright ; B 170 70 506 446 ;
+C 174 ; WX 600 ; N fi ; B 3 0 619 629 ;
+C 175 ; WX 600 ; N fl ; B 3 0 619 629 ;
+C 177 ; WX 600 ; N endash ; B 124 231 586 285 ;
+C 178 ; WX 600 ; N dagger ; B 217 -78 546 580 ;
+C 179 ; WX 600 ; N daggerdbl ; B 163 -78 546 580 ;
+C 180 ; WX 600 ; N periodcentered ; B 275 189 434 327 ;
+C 182 ; WX 600 ; N paragraph ; B 100 -78 630 562 ;
+C 183 ; WX 600 ; N bullet ; B 224 130 485 383 ;
+C 184 ; WX 600 ; N quotesinglbase ; B 185 -134 397 100 ;
+C 185 ; WX 600 ; N quotedblbase ; B 115 -134 478 100 ;
+C 186 ; WX 600 ; N quotedblright ; B 213 328 576 562 ;
+C 187 ; WX 600 ; N guillemotright ; B 58 70 618 446 ;
+C 188 ; WX 600 ; N ellipsis ; B 46 -15 575 111 ;
+C 189 ; WX 600 ; N perthousand ; B 59 -15 627 622 ;
+C 191 ; WX 600 ; N questiondown ; B 105 -157 466 430 ;
+C 193 ; WX 600 ; N grave ; B 294 497 484 672 ;
+C 194 ; WX 600 ; N acute ; B 348 497 612 672 ;
+C 195 ; WX 600 ; N circumflex ; B 229 477 581 654 ;
+C 196 ; WX 600 ; N tilde ; B 212 489 629 606 ;
+C 197 ; WX 600 ; N macron ; B 232 525 600 565 ;
+C 198 ; WX 600 ; N breve ; B 279 501 576 609 ;
+C 199 ; WX 600 ; N dotaccent ; B 360 477 466 580 ;
+C 200 ; WX 600 ; N dieresis ; B 262 492 570 595 ;
+C 202 ; WX 600 ; N ring ; B 332 463 500 627 ;
+C 203 ; WX 600 ; N cedilla ; B 197 -151 344 10 ;
+C 205 ; WX 600 ; N hungarumlaut ; B 239 497 683 672 ;
+C 206 ; WX 600 ; N ogonek ; B 207 -151 348 0 ;
+C 207 ; WX 600 ; N caron ; B 262 492 614 669 ;
+C 208 ; WX 600 ; N emdash ; B 49 231 661 285 ;
+C 225 ; WX 600 ; N AE ; B 3 0 655 562 ;
+C 227 ; WX 600 ; N ordfeminine ; B 209 249 512 580 ;
+C 232 ; WX 600 ; N Lslash ; B 47 0 607 562 ;
+C 233 ; WX 600 ; N Oslash ; B 94 -80 625 629 ;
+C 234 ; WX 600 ; N OE ; B 59 0 672 562 ;
+C 235 ; WX 600 ; N ordmasculine ; B 210 249 535 580 ;
+C 241 ; WX 600 ; N ae ; B 41 -15 626 441 ;
+C 245 ; WX 600 ; N dotlessi ; B 95 0 515 426 ;
+C 248 ; WX 600 ; N lslash ; B 95 0 583 629 ;
+C 249 ; WX 600 ; N oslash ; B 102 -80 588 506 ;
+C 250 ; WX 600 ; N oe ; B 54 -15 615 441 ;
+C 251 ; WX 600 ; N germandbls ; B 48 -15 617 629 ;
+C -1 ; WX 600 ; N Odieresis ; B 94 -18 625 731 ;
+C -1 ; WX 600 ; N logicalnot ; B 155 108 591 369 ;
+C -1 ; WX 600 ; N minus ; B 129 232 580 283 ;
+C -1 ; WX 600 ; N merge ; B 187 -15 503 436 ;
+C -1 ; WX 600 ; N degree ; B 214 269 576 622 ;
+C -1 ; WX 600 ; N dectab ; B 18 0 593 227 ;
+C -1 ; WX 600 ; N ll ; B 33 0 616 629 ;
+C -1 ; WX 600 ; N IJ ; B 32 -18 702 562 ;
+C -1 ; WX 600 ; N Eacute ; B 53 0 668 793 ;
+C -1 ; WX 600 ; N Ocircumflex ; B 94 -18 625 775 ;
+C -1 ; WX 600 ; N ucircumflex ; B 101 -15 572 654 ;
+C -1 ; WX 600 ; N left ; B 114 68 580 348 ;
+C -1 ; WX 600 ; N threesuperior ; B 213 240 501 622 ;
+C -1 ; WX 600 ; N up ; B 223 0 503 437 ;
+C -1 ; WX 600 ; N multiply ; B 103 43 607 470 ;
+C -1 ; WX 600 ; N Scaron ; B 76 -20 673 805 ;
+C -1 ; WX 600 ; N tab ; B 19 0 641 562 ;
+C -1 ; WX 600 ; N Ucircumflex ; B 125 -18 702 775 ;
+C -1 ; WX 600 ; N divide ; B 136 48 573 467 ;
+C -1 ; WX 600 ; N Acircumflex ; B 3 0 607 775 ;
+C -1 ; WX 600 ; N eacute ; B 106 -15 612 672 ;
+C -1 ; WX 600 ; N uacute ; B 101 -15 602 672 ;
+C -1 ; WX 600 ; N Aacute ; B 3 0 658 793 ;
+C -1 ; WX 600 ; N copyright ; B 53 -18 667 580 ;
+C -1 ; WX 600 ; N twosuperior ; B 230 249 535 622 ;
+C -1 ; WX 600 ; N Ecircumflex ; B 53 0 660 775 ;
+C -1 ; WX 600 ; N ntilde ; B 26 0 629 606 ;
+C -1 ; WX 600 ; N down ; B 187 -15 467 426 ;
+C -1 ; WX 600 ; N center ; B 103 14 623 580 ;
+C -1 ; WX 600 ; N onesuperior ; B 231 249 491 622 ;
+C -1 ; WX 600 ; N ij ; B 37 -157 630 657 ;
+C -1 ; WX 600 ; N edieresis ; B 106 -15 598 595 ;
+C -1 ; WX 600 ; N graybox ; B 76 0 652 599 ;
+C -1 ; WX 600 ; N odieresis ; B 102 -15 588 595 ;
+C -1 ; WX 600 ; N Ograve ; B 94 -18 625 793 ;
+C -1 ; WX 600 ; N threequarters ; B 73 -56 659 666 ;
+C -1 ; WX 600 ; N plusminus ; B 96 44 594 558 ;
+C -1 ; WX 600 ; N prescription ; B 27 -15 617 562 ;
+C -1 ; WX 600 ; N eth ; B 102 -15 639 629 ;
+C -1 ; WX 600 ; N largebullet ; B 315 220 395 297 ;
+C -1 ; WX 600 ; N egrave ; B 106 -15 598 672 ;
+C -1 ; WX 600 ; N ccedilla ; B 106 -151 614 441 ;
+C -1 ; WX 600 ; N notegraphic ; B 143 -15 564 572 ;
+C -1 ; WX 600 ; N Udieresis ; B 125 -18 702 731 ;
+C -1 ; WX 600 ; N Gcaron ; B 83 -18 645 805 ;
+C -1 ; WX 600 ; N arrowdown ; B 152 -15 520 608 ;
+C -1 ; WX 600 ; N format ; B -28 -157 185 607 ;
+C -1 ; WX 600 ; N Otilde ; B 94 -18 656 732 ;
+C -1 ; WX 600 ; N Idieresis ; B 96 0 623 731 ;
+C -1 ; WX 600 ; N adieresis ; B 76 -15 570 595 ;
+C -1 ; WX 600 ; N ecircumflex ; B 106 -15 598 654 ;
+C -1 ; WX 600 ; N Eth ; B 43 0 645 562 ;
+C -1 ; WX 600 ; N onequarter ; B 65 -57 674 665 ;
+C -1 ; WX 600 ; N LL ; B 8 0 647 562 ;
+C -1 ; WX 600 ; N agrave ; B 76 -15 569 672 ;
+C -1 ; WX 600 ; N Zcaron ; B 86 0 643 805 ;
+C -1 ; WX 600 ; N Scedilla ; B 76 -151 650 580 ;
+C -1 ; WX 600 ; N Idot ; B 96 0 623 716 ;
+C -1 ; WX 600 ; N Iacute ; B 96 0 638 793 ;
+C -1 ; WX 600 ; N indent ; B 108 68 574 348 ;
+C -1 ; WX 600 ; N Ugrave ; B 125 -18 702 793 ;
+C -1 ; WX 600 ; N scaron ; B 78 -15 614 669 ;
+C -1 ; WX 600 ; N overscore ; B 123 579 734 629 ;
+C -1 ; WX 600 ; N Aring ; B 3 0 607 753 ;
+C -1 ; WX 600 ; N Ccedilla ; B 93 -151 658 580 ;
+C -1 ; WX 600 ; N Igrave ; B 96 0 623 793 ;
+C -1 ; WX 600 ; N brokenbar ; B 238 -175 469 675 ;
+C -1 ; WX 600 ; N Oacute ; B 94 -18 638 793 ;
+C -1 ; WX 600 ; N otilde ; B 102 -15 629 606 ;
+C -1 ; WX 600 ; N Yacute ; B 133 0 695 793 ;
+C -1 ; WX 600 ; N lira ; B 118 -21 621 611 ;
+C -1 ; WX 600 ; N Icircumflex ; B 96 0 623 775 ;
+C -1 ; WX 600 ; N Atilde ; B 3 0 656 732 ;
+C -1 ; WX 600 ; N Uacute ; B 125 -18 702 793 ;
+C -1 ; WX 600 ; N Ydieresis ; B 133 0 695 731 ;
+C -1 ; WX 600 ; N ydieresis ; B -4 -157 683 595 ;
+C -1 ; WX 600 ; N idieresis ; B 95 0 540 595 ;
+C -1 ; WX 600 ; N Adieresis ; B 3 0 607 731 ;
+C -1 ; WX 600 ; N mu ; B 72 -157 572 426 ;
+C -1 ; WX 600 ; N trademark ; B 75 263 742 562 ;
+C -1 ; WX 600 ; N oacute ; B 102 -15 612 672 ;
+C -1 ; WX 600 ; N acircumflex ; B 76 -15 581 654 ;
+C -1 ; WX 600 ; N Agrave ; B 3 0 607 793 ;
+C -1 ; WX 600 ; N return ; B 79 0 700 562 ;
+C -1 ; WX 600 ; N atilde ; B 76 -15 629 606 ;
+C -1 ; WX 600 ; N square ; B 19 0 700 562 ;
+C -1 ; WX 600 ; N registered ; B 53 -18 667 580 ;
+C -1 ; WX 600 ; N stop ; B 19 0 700 562 ;
+C -1 ; WX 600 ; N udieresis ; B 101 -15 572 595 ;
+C -1 ; WX 600 ; N arrowup ; B 209 0 577 623 ;
+C -1 ; WX 600 ; N igrave ; B 95 0 515 672 ;
+C -1 ; WX 600 ; N Edieresis ; B 53 0 660 731 ;
+C -1 ; WX 600 ; N zcaron ; B 99 0 624 669 ;
+C -1 ; WX 600 ; N arrowboth ; B 36 115 692 483 ;
+C -1 ; WX 600 ; N gcaron ; B 61 -157 657 669 ;
+C -1 ; WX 600 ; N arrowleft ; B 40 115 693 483 ;
+C -1 ; WX 600 ; N aacute ; B 76 -15 612 672 ;
+C -1 ; WX 600 ; N ocircumflex ; B 102 -15 588 654 ;
+C -1 ; WX 600 ; N scedilla ; B 78 -151 584 441 ;
+C -1 ; WX 600 ; N ograve ; B 102 -15 588 672 ;
+C -1 ; WX 600 ; N onehalf ; B 65 -57 669 665 ;
+C -1 ; WX 600 ; N ugrave ; B 101 -15 572 672 ;
+C -1 ; WX 600 ; N Ntilde ; B 7 -13 712 732 ;
+C -1 ; WX 600 ; N iacute ; B 95 0 612 672 ;
+C -1 ; WX 600 ; N arrowright ; B 34 115 688 483 ;
+C -1 ; WX 600 ; N Thorn ; B 79 0 606 562 ;
+C -1 ; WX 600 ; N Egrave ; B 53 0 660 793 ;
+C -1 ; WX 600 ; N thorn ; B -24 -157 605 629 ;
+C -1 ; WX 600 ; N aring ; B 76 -15 569 627 ;
+C -1 ; WX 600 ; N yacute ; B -4 -157 683 672 ;
+C -1 ; WX 600 ; N icircumflex ; B 95 0 551 654 ;
+EndCharMetrics
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 46 121 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex -4 121 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis -1 136 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave -4 121 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 12 126 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 27 126 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 56 121 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 26 121 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 29 136 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 26 121 ;
+CC Gcaron 2 ; PCC G 0 0 ; PCC caron 29 136 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 26 121 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 26 121 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 29 136 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 26 121 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 27 126 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 26 121 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 26 121 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 29 136 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 26 121 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 27 126 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 59 136 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 56 121 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 26 121 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 29 136 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave -4 121 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 56 121 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 29 136 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 29 136 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 0 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 0 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 0 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 0 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 0 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 0 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 0 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 0 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 0 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 0 0 ;
+CC gcaron 2 ; PCC g 0 0 ; PCC caron -30 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute 0 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -30 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -30 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -30 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 0 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 0 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 0 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 0 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 0 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 0 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 0 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute -10 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex -10 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 0 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave -30 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute -20 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis -10 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 10 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvb8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvb8a.afm
new file mode 100644
index 0000000..a1e1b33
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvb8a.afm
@@ -0,0 +1,570 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu Mar 15 09:43:00 1990
+Comment UniqueID 28357
+Comment VMusage 26878 33770
+FontName Helvetica-Bold
+FullName Helvetica Bold
+FamilyName Helvetica
+Weight Bold
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -170 -228 1003 962
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.007
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 718
+XHeight 532
+Ascender 718
+Descender -207
+StartCharMetrics 228
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 90 0 244 718 ;
+C 34 ; WX 474 ; N quotedbl ; B 98 447 376 718 ;
+C 35 ; WX 556 ; N numbersign ; B 18 0 538 698 ;
+C 36 ; WX 556 ; N dollar ; B 30 -115 523 775 ;
+C 37 ; WX 889 ; N percent ; B 28 -19 861 710 ;
+C 38 ; WX 722 ; N ampersand ; B 54 -19 701 718 ;
+C 39 ; WX 278 ; N quoteright ; B 69 445 209 718 ;
+C 40 ; WX 333 ; N parenleft ; B 35 -208 314 734 ;
+C 41 ; WX 333 ; N parenright ; B 19 -208 298 734 ;
+C 42 ; WX 389 ; N asterisk ; B 27 387 362 718 ;
+C 43 ; WX 584 ; N plus ; B 40 0 544 506 ;
+C 44 ; WX 278 ; N comma ; B 64 -168 214 146 ;
+C 45 ; WX 333 ; N hyphen ; B 27 215 306 345 ;
+C 46 ; WX 278 ; N period ; B 64 0 214 146 ;
+C 47 ; WX 278 ; N slash ; B -33 -19 311 737 ;
+C 48 ; WX 556 ; N zero ; B 32 -19 524 710 ;
+C 49 ; WX 556 ; N one ; B 69 0 378 710 ;
+C 50 ; WX 556 ; N two ; B 26 0 511 710 ;
+C 51 ; WX 556 ; N three ; B 27 -19 516 710 ;
+C 52 ; WX 556 ; N four ; B 27 0 526 710 ;
+C 53 ; WX 556 ; N five ; B 27 -19 516 698 ;
+C 54 ; WX 556 ; N six ; B 31 -19 520 710 ;
+C 55 ; WX 556 ; N seven ; B 25 0 528 698 ;
+C 56 ; WX 556 ; N eight ; B 32 -19 524 710 ;
+C 57 ; WX 556 ; N nine ; B 30 -19 522 710 ;
+C 58 ; WX 333 ; N colon ; B 92 0 242 512 ;
+C 59 ; WX 333 ; N semicolon ; B 92 -168 242 512 ;
+C 60 ; WX 584 ; N less ; B 38 -8 546 514 ;
+C 61 ; WX 584 ; N equal ; B 40 87 544 419 ;
+C 62 ; WX 584 ; N greater ; B 38 -8 546 514 ;
+C 63 ; WX 611 ; N question ; B 60 0 556 727 ;
+C 64 ; WX 975 ; N at ; B 118 -19 856 737 ;
+C 65 ; WX 722 ; N A ; B 20 0 702 718 ;
+C 66 ; WX 722 ; N B ; B 76 0 669 718 ;
+C 67 ; WX 722 ; N C ; B 44 -19 684 737 ;
+C 68 ; WX 722 ; N D ; B 76 0 685 718 ;
+C 69 ; WX 667 ; N E ; B 76 0 621 718 ;
+C 70 ; WX 611 ; N F ; B 76 0 587 718 ;
+C 71 ; WX 778 ; N G ; B 44 -19 713 737 ;
+C 72 ; WX 722 ; N H ; B 71 0 651 718 ;
+C 73 ; WX 278 ; N I ; B 64 0 214 718 ;
+C 74 ; WX 556 ; N J ; B 22 -18 484 718 ;
+C 75 ; WX 722 ; N K ; B 87 0 722 718 ;
+C 76 ; WX 611 ; N L ; B 76 0 583 718 ;
+C 77 ; WX 833 ; N M ; B 69 0 765 718 ;
+C 78 ; WX 722 ; N N ; B 69 0 654 718 ;
+C 79 ; WX 778 ; N O ; B 44 -19 734 737 ;
+C 80 ; WX 667 ; N P ; B 76 0 627 718 ;
+C 81 ; WX 778 ; N Q ; B 44 -52 737 737 ;
+C 82 ; WX 722 ; N R ; B 76 0 677 718 ;
+C 83 ; WX 667 ; N S ; B 39 -19 629 737 ;
+C 84 ; WX 611 ; N T ; B 14 0 598 718 ;
+C 85 ; WX 722 ; N U ; B 72 -19 651 718 ;
+C 86 ; WX 667 ; N V ; B 19 0 648 718 ;
+C 87 ; WX 944 ; N W ; B 16 0 929 718 ;
+C 88 ; WX 667 ; N X ; B 14 0 653 718 ;
+C 89 ; WX 667 ; N Y ; B 15 0 653 718 ;
+C 90 ; WX 611 ; N Z ; B 25 0 586 718 ;
+C 91 ; WX 333 ; N bracketleft ; B 63 -196 309 722 ;
+C 92 ; WX 278 ; N backslash ; B -33 -19 311 737 ;
+C 93 ; WX 333 ; N bracketright ; B 24 -196 270 722 ;
+C 94 ; WX 584 ; N asciicircum ; B 62 323 522 698 ;
+C 95 ; WX 556 ; N underscore ; B 0 -125 556 -75 ;
+C 96 ; WX 278 ; N quoteleft ; B 69 454 209 727 ;
+C 97 ; WX 556 ; N a ; B 29 -14 527 546 ;
+C 98 ; WX 611 ; N b ; B 61 -14 578 718 ;
+C 99 ; WX 556 ; N c ; B 34 -14 524 546 ;
+C 100 ; WX 611 ; N d ; B 34 -14 551 718 ;
+C 101 ; WX 556 ; N e ; B 23 -14 528 546 ;
+C 102 ; WX 333 ; N f ; B 10 0 318 727 ; L i fi ; L l fl ;
+C 103 ; WX 611 ; N g ; B 40 -217 553 546 ;
+C 104 ; WX 611 ; N h ; B 65 0 546 718 ;
+C 105 ; WX 278 ; N i ; B 69 0 209 725 ;
+C 106 ; WX 278 ; N j ; B 3 -214 209 725 ;
+C 107 ; WX 556 ; N k ; B 69 0 562 718 ;
+C 108 ; WX 278 ; N l ; B 69 0 209 718 ;
+C 109 ; WX 889 ; N m ; B 64 0 826 546 ;
+C 110 ; WX 611 ; N n ; B 65 0 546 546 ;
+C 111 ; WX 611 ; N o ; B 34 -14 578 546 ;
+C 112 ; WX 611 ; N p ; B 62 -207 578 546 ;
+C 113 ; WX 611 ; N q ; B 34 -207 552 546 ;
+C 114 ; WX 389 ; N r ; B 64 0 373 546 ;
+C 115 ; WX 556 ; N s ; B 30 -14 519 546 ;
+C 116 ; WX 333 ; N t ; B 10 -6 309 676 ;
+C 117 ; WX 611 ; N u ; B 66 -14 545 532 ;
+C 118 ; WX 556 ; N v ; B 13 0 543 532 ;
+C 119 ; WX 778 ; N w ; B 10 0 769 532 ;
+C 120 ; WX 556 ; N x ; B 15 0 541 532 ;
+C 121 ; WX 556 ; N y ; B 10 -214 539 532 ;
+C 122 ; WX 500 ; N z ; B 20 0 480 532 ;
+C 123 ; WX 389 ; N braceleft ; B 48 -196 365 722 ;
+C 124 ; WX 280 ; N bar ; B 84 -19 196 737 ;
+C 125 ; WX 389 ; N braceright ; B 24 -196 341 722 ;
+C 126 ; WX 584 ; N asciitilde ; B 61 163 523 343 ;
+C 161 ; WX 333 ; N exclamdown ; B 90 -186 244 532 ;
+C 162 ; WX 556 ; N cent ; B 34 -118 524 628 ;
+C 163 ; WX 556 ; N sterling ; B 28 -16 541 718 ;
+C 164 ; WX 167 ; N fraction ; B -170 -19 336 710 ;
+C 165 ; WX 556 ; N yen ; B -9 0 565 698 ;
+C 166 ; WX 556 ; N florin ; B -10 -210 516 737 ;
+C 167 ; WX 556 ; N section ; B 34 -184 522 727 ;
+C 168 ; WX 556 ; N currency ; B -3 76 559 636 ;
+C 169 ; WX 238 ; N quotesingle ; B 70 447 168 718 ;
+C 170 ; WX 500 ; N quotedblleft ; B 64 454 436 727 ;
+C 171 ; WX 556 ; N guillemotleft ; B 88 76 468 484 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 83 76 250 484 ;
+C 173 ; WX 333 ; N guilsinglright ; B 83 76 250 484 ;
+C 174 ; WX 611 ; N fi ; B 10 0 542 727 ;
+C 175 ; WX 611 ; N fl ; B 10 0 542 727 ;
+C 177 ; WX 556 ; N endash ; B 0 227 556 333 ;
+C 178 ; WX 556 ; N dagger ; B 36 -171 520 718 ;
+C 179 ; WX 556 ; N daggerdbl ; B 36 -171 520 718 ;
+C 180 ; WX 278 ; N periodcentered ; B 58 172 220 334 ;
+C 182 ; WX 556 ; N paragraph ; B -8 -191 539 700 ;
+C 183 ; WX 350 ; N bullet ; B 10 194 340 524 ;
+C 184 ; WX 278 ; N quotesinglbase ; B 69 -146 209 127 ;
+C 185 ; WX 500 ; N quotedblbase ; B 64 -146 436 127 ;
+C 186 ; WX 500 ; N quotedblright ; B 64 445 436 718 ;
+C 187 ; WX 556 ; N guillemotright ; B 88 76 468 484 ;
+C 188 ; WX 1000 ; N ellipsis ; B 92 0 908 146 ;
+C 189 ; WX 1000 ; N perthousand ; B -3 -19 1003 710 ;
+C 191 ; WX 611 ; N questiondown ; B 55 -195 551 532 ;
+C 193 ; WX 333 ; N grave ; B -23 604 225 750 ;
+C 194 ; WX 333 ; N acute ; B 108 604 356 750 ;
+C 195 ; WX 333 ; N circumflex ; B -10 604 343 750 ;
+C 196 ; WX 333 ; N tilde ; B -17 610 350 737 ;
+C 197 ; WX 333 ; N macron ; B -6 604 339 678 ;
+C 198 ; WX 333 ; N breve ; B -2 604 335 750 ;
+C 199 ; WX 333 ; N dotaccent ; B 104 614 230 729 ;
+C 200 ; WX 333 ; N dieresis ; B 6 614 327 729 ;
+C 202 ; WX 333 ; N ring ; B 59 568 275 776 ;
+C 203 ; WX 333 ; N cedilla ; B 6 -228 245 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 9 604 486 750 ;
+C 206 ; WX 333 ; N ogonek ; B 71 -228 304 0 ;
+C 207 ; WX 333 ; N caron ; B -10 604 343 750 ;
+C 208 ; WX 1000 ; N emdash ; B 0 227 1000 333 ;
+C 225 ; WX 1000 ; N AE ; B 5 0 954 718 ;
+C 227 ; WX 370 ; N ordfeminine ; B 22 276 347 737 ;
+C 232 ; WX 611 ; N Lslash ; B -20 0 583 718 ;
+C 233 ; WX 778 ; N Oslash ; B 33 -27 744 745 ;
+C 234 ; WX 1000 ; N OE ; B 37 -19 961 737 ;
+C 235 ; WX 365 ; N ordmasculine ; B 6 276 360 737 ;
+C 241 ; WX 889 ; N ae ; B 29 -14 858 546 ;
+C 245 ; WX 278 ; N dotlessi ; B 69 0 209 532 ;
+C 248 ; WX 278 ; N lslash ; B -18 0 296 718 ;
+C 249 ; WX 611 ; N oslash ; B 22 -29 589 560 ;
+C 250 ; WX 944 ; N oe ; B 34 -14 912 546 ;
+C 251 ; WX 611 ; N germandbls ; B 69 -14 579 731 ;
+C -1 ; WX 611 ; N Zcaron ; B 25 0 586 936 ;
+C -1 ; WX 556 ; N ccedilla ; B 34 -228 524 546 ;
+C -1 ; WX 556 ; N ydieresis ; B 10 -214 539 729 ;
+C -1 ; WX 556 ; N atilde ; B 29 -14 527 737 ;
+C -1 ; WX 278 ; N icircumflex ; B -37 0 316 750 ;
+C -1 ; WX 333 ; N threesuperior ; B 8 271 326 710 ;
+C -1 ; WX 556 ; N ecircumflex ; B 23 -14 528 750 ;
+C -1 ; WX 611 ; N thorn ; B 62 -208 578 718 ;
+C -1 ; WX 556 ; N egrave ; B 23 -14 528 750 ;
+C -1 ; WX 333 ; N twosuperior ; B 9 283 324 710 ;
+C -1 ; WX 556 ; N eacute ; B 23 -14 528 750 ;
+C -1 ; WX 611 ; N otilde ; B 34 -14 578 737 ;
+C -1 ; WX 722 ; N Aacute ; B 20 0 702 936 ;
+C -1 ; WX 611 ; N ocircumflex ; B 34 -14 578 750 ;
+C -1 ; WX 556 ; N yacute ; B 10 -214 539 750 ;
+C -1 ; WX 611 ; N udieresis ; B 66 -14 545 729 ;
+C -1 ; WX 834 ; N threequarters ; B 16 -19 799 710 ;
+C -1 ; WX 556 ; N acircumflex ; B 29 -14 527 750 ;
+C -1 ; WX 722 ; N Eth ; B -5 0 685 718 ;
+C -1 ; WX 556 ; N edieresis ; B 23 -14 528 729 ;
+C -1 ; WX 611 ; N ugrave ; B 66 -14 545 750 ;
+C -1 ; WX 1000 ; N trademark ; B 44 306 956 718 ;
+C -1 ; WX 611 ; N ograve ; B 34 -14 578 750 ;
+C -1 ; WX 556 ; N scaron ; B 30 -14 519 750 ;
+C -1 ; WX 278 ; N Idieresis ; B -21 0 300 915 ;
+C -1 ; WX 611 ; N uacute ; B 66 -14 545 750 ;
+C -1 ; WX 556 ; N agrave ; B 29 -14 527 750 ;
+C -1 ; WX 611 ; N ntilde ; B 65 0 546 737 ;
+C -1 ; WX 556 ; N aring ; B 29 -14 527 776 ;
+C -1 ; WX 500 ; N zcaron ; B 20 0 480 750 ;
+C -1 ; WX 278 ; N Icircumflex ; B -37 0 316 936 ;
+C -1 ; WX 722 ; N Ntilde ; B 69 0 654 923 ;
+C -1 ; WX 611 ; N ucircumflex ; B 66 -14 545 750 ;
+C -1 ; WX 667 ; N Ecircumflex ; B 76 0 621 936 ;
+C -1 ; WX 278 ; N Iacute ; B 64 0 329 936 ;
+C -1 ; WX 722 ; N Ccedilla ; B 44 -228 684 737 ;
+C -1 ; WX 778 ; N Odieresis ; B 44 -19 734 915 ;
+C -1 ; WX 667 ; N Scaron ; B 39 -19 629 936 ;
+C -1 ; WX 667 ; N Edieresis ; B 76 0 621 915 ;
+C -1 ; WX 278 ; N Igrave ; B -50 0 214 936 ;
+C -1 ; WX 556 ; N adieresis ; B 29 -14 527 729 ;
+C -1 ; WX 778 ; N Ograve ; B 44 -19 734 936 ;
+C -1 ; WX 667 ; N Egrave ; B 76 0 621 936 ;
+C -1 ; WX 667 ; N Ydieresis ; B 15 0 653 915 ;
+C -1 ; WX 737 ; N registered ; B -11 -19 748 737 ;
+C -1 ; WX 778 ; N Otilde ; B 44 -19 734 923 ;
+C -1 ; WX 834 ; N onequarter ; B 26 -19 766 710 ;
+C -1 ; WX 722 ; N Ugrave ; B 72 -19 651 936 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 72 -19 651 936 ;
+C -1 ; WX 667 ; N Thorn ; B 76 0 627 718 ;
+C -1 ; WX 584 ; N divide ; B 40 -42 544 548 ;
+C -1 ; WX 722 ; N Atilde ; B 20 0 702 923 ;
+C -1 ; WX 722 ; N Uacute ; B 72 -19 651 936 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 44 -19 734 936 ;
+C -1 ; WX 584 ; N logicalnot ; B 40 108 544 419 ;
+C -1 ; WX 722 ; N Aring ; B 20 0 702 962 ;
+C -1 ; WX 278 ; N idieresis ; B -21 0 300 729 ;
+C -1 ; WX 278 ; N iacute ; B 69 0 329 750 ;
+C -1 ; WX 556 ; N aacute ; B 29 -14 527 750 ;
+C -1 ; WX 584 ; N plusminus ; B 40 0 544 506 ;
+C -1 ; WX 584 ; N multiply ; B 40 1 545 505 ;
+C -1 ; WX 722 ; N Udieresis ; B 72 -19 651 915 ;
+C -1 ; WX 584 ; N minus ; B 40 197 544 309 ;
+C -1 ; WX 333 ; N onesuperior ; B 26 283 237 710 ;
+C -1 ; WX 667 ; N Eacute ; B 76 0 621 936 ;
+C -1 ; WX 722 ; N Acircumflex ; B 20 0 702 936 ;
+C -1 ; WX 737 ; N copyright ; B -11 -19 749 737 ;
+C -1 ; WX 722 ; N Agrave ; B 20 0 702 936 ;
+C -1 ; WX 611 ; N odieresis ; B 34 -14 578 729 ;
+C -1 ; WX 611 ; N oacute ; B 34 -14 578 750 ;
+C -1 ; WX 400 ; N degree ; B 57 426 343 712 ;
+C -1 ; WX 278 ; N igrave ; B -50 0 209 750 ;
+C -1 ; WX 611 ; N mu ; B 66 -207 545 532 ;
+C -1 ; WX 778 ; N Oacute ; B 44 -19 734 936 ;
+C -1 ; WX 611 ; N eth ; B 34 -14 578 737 ;
+C -1 ; WX 722 ; N Adieresis ; B 20 0 702 915 ;
+C -1 ; WX 667 ; N Yacute ; B 15 0 653 936 ;
+C -1 ; WX 280 ; N brokenbar ; B 84 -19 196 737 ;
+C -1 ; WX 834 ; N onehalf ; B 26 -19 794 710 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 209
+
+KPX A y -30
+KPX A w -30
+KPX A v -40
+KPX A u -30
+KPX A Y -110
+KPX A W -60
+KPX A V -80
+KPX A U -50
+KPX A T -90
+KPX A Q -40
+KPX A O -40
+KPX A G -50
+KPX A C -40
+
+KPX B U -10
+KPX B A -30
+
+KPX D period -30
+KPX D comma -30
+KPX D Y -70
+KPX D W -40
+KPX D V -40
+KPX D A -40
+
+KPX F period -100
+KPX F comma -100
+KPX F a -20
+KPX F A -80
+
+KPX J u -20
+KPX J period -20
+KPX J comma -20
+KPX J A -20
+
+KPX K y -40
+KPX K u -30
+KPX K o -35
+KPX K e -15
+KPX K O -30
+
+KPX L y -30
+KPX L quoteright -140
+KPX L quotedblright -140
+KPX L Y -120
+KPX L W -80
+KPX L V -110
+KPX L T -90
+
+KPX O period -40
+KPX O comma -40
+KPX O Y -70
+KPX O X -50
+KPX O W -50
+KPX O V -50
+KPX O T -40
+KPX O A -50
+
+KPX P period -120
+KPX P o -40
+KPX P e -30
+KPX P comma -120
+KPX P a -30
+KPX P A -100
+
+KPX Q period 20
+KPX Q comma 20
+KPX Q U -10
+
+KPX R Y -50
+KPX R W -40
+KPX R V -50
+KPX R U -20
+KPX R T -20
+KPX R O -20
+
+KPX T y -60
+KPX T w -60
+KPX T u -90
+KPX T semicolon -40
+KPX T r -80
+KPX T period -80
+KPX T o -80
+KPX T hyphen -120
+KPX T e -60
+KPX T comma -80
+KPX T colon -40
+KPX T a -80
+KPX T O -40
+KPX T A -90
+
+KPX U period -30
+KPX U comma -30
+KPX U A -50
+
+KPX V u -60
+KPX V semicolon -40
+KPX V period -120
+KPX V o -90
+KPX V hyphen -80
+KPX V e -50
+KPX V comma -120
+KPX V colon -40
+KPX V a -60
+KPX V O -50
+KPX V G -50
+KPX V A -80
+
+KPX W y -20
+KPX W u -45
+KPX W semicolon -10
+KPX W period -80
+KPX W o -60
+KPX W hyphen -40
+KPX W e -35
+KPX W comma -80
+KPX W colon -10
+KPX W a -40
+KPX W O -20
+KPX W A -60
+
+KPX Y u -100
+KPX Y semicolon -50
+KPX Y period -100
+KPX Y o -100
+KPX Y e -80
+KPX Y comma -100
+KPX Y colon -50
+KPX Y a -90
+KPX Y O -70
+KPX Y A -110
+
+KPX a y -20
+KPX a w -15
+KPX a v -15
+KPX a g -10
+
+KPX b y -20
+KPX b v -20
+KPX b u -20
+KPX b l -10
+
+KPX c y -10
+KPX c l -20
+KPX c k -20
+KPX c h -10
+
+KPX colon space -40
+
+KPX comma space -40
+KPX comma quoteright -120
+KPX comma quotedblright -120
+
+KPX d y -15
+KPX d w -15
+KPX d v -15
+KPX d d -10
+
+KPX e y -15
+KPX e x -15
+KPX e w -15
+KPX e v -15
+KPX e period 20
+KPX e comma 10
+
+KPX f quoteright 30
+KPX f quotedblright 30
+KPX f period -10
+KPX f o -20
+KPX f e -10
+KPX f comma -10
+
+KPX g g -10
+KPX g e 10
+
+KPX h y -20
+
+KPX k o -15
+
+KPX l y -15
+KPX l w -15
+
+KPX m y -30
+KPX m u -20
+
+KPX n y -20
+KPX n v -40
+KPX n u -10
+
+KPX o y -20
+KPX o x -30
+KPX o w -15
+KPX o v -20
+
+KPX p y -15
+
+KPX period space -40
+KPX period quoteright -120
+KPX period quotedblright -120
+
+KPX quotedblright space -80
+
+KPX quoteleft quoteleft -46
+
+KPX quoteright v -20
+KPX quoteright space -80
+KPX quoteright s -60
+KPX quoteright r -40
+KPX quoteright quoteright -46
+KPX quoteright l -20
+KPX quoteright d -80
+
+KPX r y 10
+KPX r v 10
+KPX r t 20
+KPX r s -15
+KPX r q -20
+KPX r period -60
+KPX r o -20
+KPX r hyphen -20
+KPX r g -15
+KPX r d -20
+KPX r comma -60
+KPX r c -20
+
+KPX s w -15
+
+KPX semicolon space -40
+
+KPX space quoteleft -60
+KPX space quotedblleft -80
+KPX space Y -120
+KPX space W -80
+KPX space V -80
+KPX space T -100
+
+KPX v period -80
+KPX v o -30
+KPX v comma -80
+KPX v a -20
+
+KPX w period -40
+KPX w o -20
+KPX w comma -40
+
+KPX x e -10
+
+KPX y period -80
+KPX y o -25
+KPX y e -10
+KPX y comma -80
+KPX y a -30
+
+KPX z e 10
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 195 186 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 195 186 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 195 186 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 195 186 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 195 186 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 195 186 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 215 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 167 186 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 167 186 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 167 186 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 167 186 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute -27 186 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -27 186 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -27 186 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave -27 186 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 195 186 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 223 186 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 223 186 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 223 186 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 223 186 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 223 186 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 167 186 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 195 186 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 195 186 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 195 186 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 195 186 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 167 186 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 167 186 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 139 186 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 112 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 112 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 112 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 112 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 112 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 112 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 132 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 112 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 112 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 112 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 112 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -27 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -27 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -27 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -27 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 139 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 139 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 139 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 139 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 139 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 139 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 112 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 139 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 139 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 139 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 139 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 112 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 112 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 84 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvb8an.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvb8an.afm
new file mode 100644
index 0000000..b7c6969
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvb8an.afm
@@ -0,0 +1,570 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu Mar 15 11:47:27 1990
+Comment UniqueID 28398
+Comment VMusage 7614 43068
+FontName Helvetica-Narrow-Bold
+FullName Helvetica Narrow Bold
+FamilyName Helvetica
+Weight Bold
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -139 -228 822 962
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.007
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 718
+XHeight 532
+Ascender 718
+Descender -207
+StartCharMetrics 228
+C 32 ; WX 228 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 273 ; N exclam ; B 74 0 200 718 ;
+C 34 ; WX 389 ; N quotedbl ; B 80 447 308 718 ;
+C 35 ; WX 456 ; N numbersign ; B 15 0 441 698 ;
+C 36 ; WX 456 ; N dollar ; B 25 -115 429 775 ;
+C 37 ; WX 729 ; N percent ; B 23 -19 706 710 ;
+C 38 ; WX 592 ; N ampersand ; B 44 -19 575 718 ;
+C 39 ; WX 228 ; N quoteright ; B 57 445 171 718 ;
+C 40 ; WX 273 ; N parenleft ; B 29 -208 257 734 ;
+C 41 ; WX 273 ; N parenright ; B 16 -208 244 734 ;
+C 42 ; WX 319 ; N asterisk ; B 22 387 297 718 ;
+C 43 ; WX 479 ; N plus ; B 33 0 446 506 ;
+C 44 ; WX 228 ; N comma ; B 52 -168 175 146 ;
+C 45 ; WX 273 ; N hyphen ; B 22 215 251 345 ;
+C 46 ; WX 228 ; N period ; B 52 0 175 146 ;
+C 47 ; WX 228 ; N slash ; B -27 -19 255 737 ;
+C 48 ; WX 456 ; N zero ; B 26 -19 430 710 ;
+C 49 ; WX 456 ; N one ; B 57 0 310 710 ;
+C 50 ; WX 456 ; N two ; B 21 0 419 710 ;
+C 51 ; WX 456 ; N three ; B 22 -19 423 710 ;
+C 52 ; WX 456 ; N four ; B 22 0 431 710 ;
+C 53 ; WX 456 ; N five ; B 22 -19 423 698 ;
+C 54 ; WX 456 ; N six ; B 25 -19 426 710 ;
+C 55 ; WX 456 ; N seven ; B 20 0 433 698 ;
+C 56 ; WX 456 ; N eight ; B 26 -19 430 710 ;
+C 57 ; WX 456 ; N nine ; B 25 -19 428 710 ;
+C 58 ; WX 273 ; N colon ; B 75 0 198 512 ;
+C 59 ; WX 273 ; N semicolon ; B 75 -168 198 512 ;
+C 60 ; WX 479 ; N less ; B 31 -8 448 514 ;
+C 61 ; WX 479 ; N equal ; B 33 87 446 419 ;
+C 62 ; WX 479 ; N greater ; B 31 -8 448 514 ;
+C 63 ; WX 501 ; N question ; B 49 0 456 727 ;
+C 64 ; WX 800 ; N at ; B 97 -19 702 737 ;
+C 65 ; WX 592 ; N A ; B 16 0 576 718 ;
+C 66 ; WX 592 ; N B ; B 62 0 549 718 ;
+C 67 ; WX 592 ; N C ; B 36 -19 561 737 ;
+C 68 ; WX 592 ; N D ; B 62 0 562 718 ;
+C 69 ; WX 547 ; N E ; B 62 0 509 718 ;
+C 70 ; WX 501 ; N F ; B 62 0 481 718 ;
+C 71 ; WX 638 ; N G ; B 36 -19 585 737 ;
+C 72 ; WX 592 ; N H ; B 58 0 534 718 ;
+C 73 ; WX 228 ; N I ; B 52 0 175 718 ;
+C 74 ; WX 456 ; N J ; B 18 -18 397 718 ;
+C 75 ; WX 592 ; N K ; B 71 0 592 718 ;
+C 76 ; WX 501 ; N L ; B 62 0 478 718 ;
+C 77 ; WX 683 ; N M ; B 57 0 627 718 ;
+C 78 ; WX 592 ; N N ; B 57 0 536 718 ;
+C 79 ; WX 638 ; N O ; B 36 -19 602 737 ;
+C 80 ; WX 547 ; N P ; B 62 0 514 718 ;
+C 81 ; WX 638 ; N Q ; B 36 -52 604 737 ;
+C 82 ; WX 592 ; N R ; B 62 0 555 718 ;
+C 83 ; WX 547 ; N S ; B 32 -19 516 737 ;
+C 84 ; WX 501 ; N T ; B 11 0 490 718 ;
+C 85 ; WX 592 ; N U ; B 59 -19 534 718 ;
+C 86 ; WX 547 ; N V ; B 16 0 531 718 ;
+C 87 ; WX 774 ; N W ; B 13 0 762 718 ;
+C 88 ; WX 547 ; N X ; B 11 0 535 718 ;
+C 89 ; WX 547 ; N Y ; B 12 0 535 718 ;
+C 90 ; WX 501 ; N Z ; B 20 0 481 718 ;
+C 91 ; WX 273 ; N bracketleft ; B 52 -196 253 722 ;
+C 92 ; WX 228 ; N backslash ; B -27 -19 255 737 ;
+C 93 ; WX 273 ; N bracketright ; B 20 -196 221 722 ;
+C 94 ; WX 479 ; N asciicircum ; B 51 323 428 698 ;
+C 95 ; WX 456 ; N underscore ; B 0 -125 456 -75 ;
+C 96 ; WX 228 ; N quoteleft ; B 57 454 171 727 ;
+C 97 ; WX 456 ; N a ; B 24 -14 432 546 ;
+C 98 ; WX 501 ; N b ; B 50 -14 474 718 ;
+C 99 ; WX 456 ; N c ; B 28 -14 430 546 ;
+C 100 ; WX 501 ; N d ; B 28 -14 452 718 ;
+C 101 ; WX 456 ; N e ; B 19 -14 433 546 ;
+C 102 ; WX 273 ; N f ; B 8 0 261 727 ; L i fi ; L l fl ;
+C 103 ; WX 501 ; N g ; B 33 -217 453 546 ;
+C 104 ; WX 501 ; N h ; B 53 0 448 718 ;
+C 105 ; WX 228 ; N i ; B 57 0 171 725 ;
+C 106 ; WX 228 ; N j ; B 2 -214 171 725 ;
+C 107 ; WX 456 ; N k ; B 57 0 461 718 ;
+C 108 ; WX 228 ; N l ; B 57 0 171 718 ;
+C 109 ; WX 729 ; N m ; B 52 0 677 546 ;
+C 110 ; WX 501 ; N n ; B 53 0 448 546 ;
+C 111 ; WX 501 ; N o ; B 28 -14 474 546 ;
+C 112 ; WX 501 ; N p ; B 51 -207 474 546 ;
+C 113 ; WX 501 ; N q ; B 28 -207 453 546 ;
+C 114 ; WX 319 ; N r ; B 52 0 306 546 ;
+C 115 ; WX 456 ; N s ; B 25 -14 426 546 ;
+C 116 ; WX 273 ; N t ; B 8 -6 253 676 ;
+C 117 ; WX 501 ; N u ; B 54 -14 447 532 ;
+C 118 ; WX 456 ; N v ; B 11 0 445 532 ;
+C 119 ; WX 638 ; N w ; B 8 0 631 532 ;
+C 120 ; WX 456 ; N x ; B 12 0 444 532 ;
+C 121 ; WX 456 ; N y ; B 8 -214 442 532 ;
+C 122 ; WX 410 ; N z ; B 16 0 394 532 ;
+C 123 ; WX 319 ; N braceleft ; B 39 -196 299 722 ;
+C 124 ; WX 230 ; N bar ; B 69 -19 161 737 ;
+C 125 ; WX 319 ; N braceright ; B 20 -196 280 722 ;
+C 126 ; WX 479 ; N asciitilde ; B 50 163 429 343 ;
+C 161 ; WX 273 ; N exclamdown ; B 74 -186 200 532 ;
+C 162 ; WX 456 ; N cent ; B 28 -118 430 628 ;
+C 163 ; WX 456 ; N sterling ; B 23 -16 444 718 ;
+C 164 ; WX 137 ; N fraction ; B -139 -19 276 710 ;
+C 165 ; WX 456 ; N yen ; B -7 0 463 698 ;
+C 166 ; WX 456 ; N florin ; B -8 -210 423 737 ;
+C 167 ; WX 456 ; N section ; B 28 -184 428 727 ;
+C 168 ; WX 456 ; N currency ; B -2 76 458 636 ;
+C 169 ; WX 195 ; N quotesingle ; B 57 447 138 718 ;
+C 170 ; WX 410 ; N quotedblleft ; B 52 454 358 727 ;
+C 171 ; WX 456 ; N guillemotleft ; B 72 76 384 484 ;
+C 172 ; WX 273 ; N guilsinglleft ; B 68 76 205 484 ;
+C 173 ; WX 273 ; N guilsinglright ; B 68 76 205 484 ;
+C 174 ; WX 501 ; N fi ; B 8 0 444 727 ;
+C 175 ; WX 501 ; N fl ; B 8 0 444 727 ;
+C 177 ; WX 456 ; N endash ; B 0 227 456 333 ;
+C 178 ; WX 456 ; N dagger ; B 30 -171 426 718 ;
+C 179 ; WX 456 ; N daggerdbl ; B 30 -171 426 718 ;
+C 180 ; WX 228 ; N periodcentered ; B 48 172 180 334 ;
+C 182 ; WX 456 ; N paragraph ; B -7 -191 442 700 ;
+C 183 ; WX 287 ; N bullet ; B 8 194 279 524 ;
+C 184 ; WX 228 ; N quotesinglbase ; B 57 -146 171 127 ;
+C 185 ; WX 410 ; N quotedblbase ; B 52 -146 358 127 ;
+C 186 ; WX 410 ; N quotedblright ; B 52 445 358 718 ;
+C 187 ; WX 456 ; N guillemotright ; B 72 76 384 484 ;
+C 188 ; WX 820 ; N ellipsis ; B 75 0 745 146 ;
+C 189 ; WX 820 ; N perthousand ; B -2 -19 822 710 ;
+C 191 ; WX 501 ; N questiondown ; B 45 -195 452 532 ;
+C 193 ; WX 273 ; N grave ; B -19 604 184 750 ;
+C 194 ; WX 273 ; N acute ; B 89 604 292 750 ;
+C 195 ; WX 273 ; N circumflex ; B -8 604 281 750 ;
+C 196 ; WX 273 ; N tilde ; B -14 610 287 737 ;
+C 197 ; WX 273 ; N macron ; B -5 604 278 678 ;
+C 198 ; WX 273 ; N breve ; B -2 604 275 750 ;
+C 199 ; WX 273 ; N dotaccent ; B 85 614 189 729 ;
+C 200 ; WX 273 ; N dieresis ; B 5 614 268 729 ;
+C 202 ; WX 273 ; N ring ; B 48 568 225 776 ;
+C 203 ; WX 273 ; N cedilla ; B 5 -228 201 0 ;
+C 205 ; WX 273 ; N hungarumlaut ; B 7 604 399 750 ;
+C 206 ; WX 273 ; N ogonek ; B 58 -228 249 0 ;
+C 207 ; WX 273 ; N caron ; B -8 604 281 750 ;
+C 208 ; WX 820 ; N emdash ; B 0 227 820 333 ;
+C 225 ; WX 820 ; N AE ; B 4 0 782 718 ;
+C 227 ; WX 303 ; N ordfeminine ; B 18 276 285 737 ;
+C 232 ; WX 501 ; N Lslash ; B -16 0 478 718 ;
+C 233 ; WX 638 ; N Oslash ; B 27 -27 610 745 ;
+C 234 ; WX 820 ; N OE ; B 30 -19 788 737 ;
+C 235 ; WX 299 ; N ordmasculine ; B 5 276 295 737 ;
+C 241 ; WX 729 ; N ae ; B 24 -14 704 546 ;
+C 245 ; WX 228 ; N dotlessi ; B 57 0 171 532 ;
+C 248 ; WX 228 ; N lslash ; B -15 0 243 718 ;
+C 249 ; WX 501 ; N oslash ; B 18 -29 483 560 ;
+C 250 ; WX 774 ; N oe ; B 28 -14 748 546 ;
+C 251 ; WX 501 ; N germandbls ; B 57 -14 475 731 ;
+C -1 ; WX 501 ; N Zcaron ; B 20 0 481 936 ;
+C -1 ; WX 456 ; N ccedilla ; B 28 -228 430 546 ;
+C -1 ; WX 456 ; N ydieresis ; B 8 -214 442 729 ;
+C -1 ; WX 456 ; N atilde ; B 24 -14 432 737 ;
+C -1 ; WX 228 ; N icircumflex ; B -30 0 259 750 ;
+C -1 ; WX 273 ; N threesuperior ; B 7 271 267 710 ;
+C -1 ; WX 456 ; N ecircumflex ; B 19 -14 433 750 ;
+C -1 ; WX 501 ; N thorn ; B 51 -208 474 718 ;
+C -1 ; WX 456 ; N egrave ; B 19 -14 433 750 ;
+C -1 ; WX 273 ; N twosuperior ; B 7 283 266 710 ;
+C -1 ; WX 456 ; N eacute ; B 19 -14 433 750 ;
+C -1 ; WX 501 ; N otilde ; B 28 -14 474 737 ;
+C -1 ; WX 592 ; N Aacute ; B 16 0 576 936 ;
+C -1 ; WX 501 ; N ocircumflex ; B 28 -14 474 750 ;
+C -1 ; WX 456 ; N yacute ; B 8 -214 442 750 ;
+C -1 ; WX 501 ; N udieresis ; B 54 -14 447 729 ;
+C -1 ; WX 684 ; N threequarters ; B 13 -19 655 710 ;
+C -1 ; WX 456 ; N acircumflex ; B 24 -14 432 750 ;
+C -1 ; WX 592 ; N Eth ; B -4 0 562 718 ;
+C -1 ; WX 456 ; N edieresis ; B 19 -14 433 729 ;
+C -1 ; WX 501 ; N ugrave ; B 54 -14 447 750 ;
+C -1 ; WX 820 ; N trademark ; B 36 306 784 718 ;
+C -1 ; WX 501 ; N ograve ; B 28 -14 474 750 ;
+C -1 ; WX 456 ; N scaron ; B 25 -14 426 750 ;
+C -1 ; WX 228 ; N Idieresis ; B -17 0 246 915 ;
+C -1 ; WX 501 ; N uacute ; B 54 -14 447 750 ;
+C -1 ; WX 456 ; N agrave ; B 24 -14 432 750 ;
+C -1 ; WX 501 ; N ntilde ; B 53 0 448 737 ;
+C -1 ; WX 456 ; N aring ; B 24 -14 432 776 ;
+C -1 ; WX 410 ; N zcaron ; B 16 0 394 750 ;
+C -1 ; WX 228 ; N Icircumflex ; B -30 0 259 936 ;
+C -1 ; WX 592 ; N Ntilde ; B 57 0 536 923 ;
+C -1 ; WX 501 ; N ucircumflex ; B 54 -14 447 750 ;
+C -1 ; WX 547 ; N Ecircumflex ; B 62 0 509 936 ;
+C -1 ; WX 228 ; N Iacute ; B 52 0 270 936 ;
+C -1 ; WX 592 ; N Ccedilla ; B 36 -228 561 737 ;
+C -1 ; WX 638 ; N Odieresis ; B 36 -19 602 915 ;
+C -1 ; WX 547 ; N Scaron ; B 32 -19 516 936 ;
+C -1 ; WX 547 ; N Edieresis ; B 62 0 509 915 ;
+C -1 ; WX 228 ; N Igrave ; B -41 0 175 936 ;
+C -1 ; WX 456 ; N adieresis ; B 24 -14 432 729 ;
+C -1 ; WX 638 ; N Ograve ; B 36 -19 602 936 ;
+C -1 ; WX 547 ; N Egrave ; B 62 0 509 936 ;
+C -1 ; WX 547 ; N Ydieresis ; B 12 0 535 915 ;
+C -1 ; WX 604 ; N registered ; B -9 -19 613 737 ;
+C -1 ; WX 638 ; N Otilde ; B 36 -19 602 923 ;
+C -1 ; WX 684 ; N onequarter ; B 21 -19 628 710 ;
+C -1 ; WX 592 ; N Ugrave ; B 59 -19 534 936 ;
+C -1 ; WX 592 ; N Ucircumflex ; B 59 -19 534 936 ;
+C -1 ; WX 547 ; N Thorn ; B 62 0 514 718 ;
+C -1 ; WX 479 ; N divide ; B 33 -42 446 548 ;
+C -1 ; WX 592 ; N Atilde ; B 16 0 576 923 ;
+C -1 ; WX 592 ; N Uacute ; B 59 -19 534 936 ;
+C -1 ; WX 638 ; N Ocircumflex ; B 36 -19 602 936 ;
+C -1 ; WX 479 ; N logicalnot ; B 33 108 446 419 ;
+C -1 ; WX 592 ; N Aring ; B 16 0 576 962 ;
+C -1 ; WX 228 ; N idieresis ; B -17 0 246 729 ;
+C -1 ; WX 228 ; N iacute ; B 57 0 270 750 ;
+C -1 ; WX 456 ; N aacute ; B 24 -14 432 750 ;
+C -1 ; WX 479 ; N plusminus ; B 33 0 446 506 ;
+C -1 ; WX 479 ; N multiply ; B 33 1 447 505 ;
+C -1 ; WX 592 ; N Udieresis ; B 59 -19 534 915 ;
+C -1 ; WX 479 ; N minus ; B 33 197 446 309 ;
+C -1 ; WX 273 ; N onesuperior ; B 21 283 194 710 ;
+C -1 ; WX 547 ; N Eacute ; B 62 0 509 936 ;
+C -1 ; WX 592 ; N Acircumflex ; B 16 0 576 936 ;
+C -1 ; WX 604 ; N copyright ; B -9 -19 614 737 ;
+C -1 ; WX 592 ; N Agrave ; B 16 0 576 936 ;
+C -1 ; WX 501 ; N odieresis ; B 28 -14 474 729 ;
+C -1 ; WX 501 ; N oacute ; B 28 -14 474 750 ;
+C -1 ; WX 328 ; N degree ; B 47 426 281 712 ;
+C -1 ; WX 228 ; N igrave ; B -41 0 171 750 ;
+C -1 ; WX 501 ; N mu ; B 54 -207 447 532 ;
+C -1 ; WX 638 ; N Oacute ; B 36 -19 602 936 ;
+C -1 ; WX 501 ; N eth ; B 28 -14 474 737 ;
+C -1 ; WX 592 ; N Adieresis ; B 16 0 576 915 ;
+C -1 ; WX 547 ; N Yacute ; B 12 0 535 936 ;
+C -1 ; WX 230 ; N brokenbar ; B 69 -19 161 737 ;
+C -1 ; WX 684 ; N onehalf ; B 21 -19 651 710 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 209
+
+KPX A y -24
+KPX A w -24
+KPX A v -32
+KPX A u -24
+KPX A Y -89
+KPX A W -48
+KPX A V -65
+KPX A U -40
+KPX A T -73
+KPX A Q -32
+KPX A O -32
+KPX A G -40
+KPX A C -32
+
+KPX B U -7
+KPX B A -24
+
+KPX D period -24
+KPX D comma -24
+KPX D Y -56
+KPX D W -32
+KPX D V -32
+KPX D A -32
+
+KPX F period -81
+KPX F comma -81
+KPX F a -15
+KPX F A -65
+
+KPX J u -15
+KPX J period -15
+KPX J comma -15
+KPX J A -15
+
+KPX K y -32
+KPX K u -24
+KPX K o -28
+KPX K e -11
+KPX K O -24
+
+KPX L y -24
+KPX L quoteright -114
+KPX L quotedblright -114
+KPX L Y -97
+KPX L W -65
+KPX L V -89
+KPX L T -73
+
+KPX O period -32
+KPX O comma -32
+KPX O Y -56
+KPX O X -40
+KPX O W -40
+KPX O V -40
+KPX O T -32
+KPX O A -40
+
+KPX P period -97
+KPX P o -32
+KPX P e -24
+KPX P comma -97
+KPX P a -24
+KPX P A -81
+
+KPX Q period 16
+KPX Q comma 16
+KPX Q U -7
+
+KPX R Y -40
+KPX R W -32
+KPX R V -40
+KPX R U -15
+KPX R T -15
+KPX R O -15
+
+KPX T y -48
+KPX T w -48
+KPX T u -73
+KPX T semicolon -32
+KPX T r -65
+KPX T period -65
+KPX T o -65
+KPX T hyphen -97
+KPX T e -48
+KPX T comma -65
+KPX T colon -32
+KPX T a -65
+KPX T O -32
+KPX T A -73
+
+KPX U period -24
+KPX U comma -24
+KPX U A -40
+
+KPX V u -48
+KPX V semicolon -32
+KPX V period -97
+KPX V o -73
+KPX V hyphen -65
+KPX V e -40
+KPX V comma -97
+KPX V colon -32
+KPX V a -48
+KPX V O -40
+KPX V G -40
+KPX V A -65
+
+KPX W y -15
+KPX W u -36
+KPX W semicolon -7
+KPX W period -65
+KPX W o -48
+KPX W hyphen -32
+KPX W e -28
+KPX W comma -65
+KPX W colon -7
+KPX W a -32
+KPX W O -15
+KPX W A -48
+
+KPX Y u -81
+KPX Y semicolon -40
+KPX Y period -81
+KPX Y o -81
+KPX Y e -65
+KPX Y comma -81
+KPX Y colon -40
+KPX Y a -73
+KPX Y O -56
+KPX Y A -89
+
+KPX a y -15
+KPX a w -11
+KPX a v -11
+KPX a g -7
+
+KPX b y -15
+KPX b v -15
+KPX b u -15
+KPX b l -7
+
+KPX c y -7
+KPX c l -15
+KPX c k -15
+KPX c h -7
+
+KPX colon space -32
+
+KPX comma space -32
+KPX comma quoteright -97
+KPX comma quotedblright -97
+
+KPX d y -11
+KPX d w -11
+KPX d v -11
+KPX d d -7
+
+KPX e y -11
+KPX e x -11
+KPX e w -11
+KPX e v -11
+KPX e period 16
+KPX e comma 8
+
+KPX f quoteright 25
+KPX f quotedblright 25
+KPX f period -7
+KPX f o -15
+KPX f e -7
+KPX f comma -7
+
+KPX g g -7
+KPX g e 8
+
+KPX h y -15
+
+KPX k o -11
+
+KPX l y -11
+KPX l w -11
+
+KPX m y -24
+KPX m u -15
+
+KPX n y -15
+KPX n v -32
+KPX n u -7
+
+KPX o y -15
+KPX o x -24
+KPX o w -11
+KPX o v -15
+
+KPX p y -11
+
+KPX period space -32
+KPX period quoteright -97
+KPX period quotedblright -97
+
+KPX quotedblright space -65
+
+KPX quoteleft quoteleft -37
+
+KPX quoteright v -15
+KPX quoteright space -65
+KPX quoteright s -48
+KPX quoteright r -32
+KPX quoteright quoteright -37
+KPX quoteright l -15
+KPX quoteright d -65
+
+KPX r y 8
+KPX r v 8
+KPX r t 16
+KPX r s -11
+KPX r q -15
+KPX r period -48
+KPX r o -15
+KPX r hyphen -15
+KPX r g -11
+KPX r d -15
+KPX r comma -48
+KPX r c -15
+
+KPX s w -11
+
+KPX semicolon space -32
+
+KPX space quoteleft -48
+KPX space quotedblleft -65
+KPX space Y -97
+KPX space W -65
+KPX space V -65
+KPX space T -81
+
+KPX v period -65
+KPX v o -24
+KPX v comma -65
+KPX v a -15
+
+KPX w period -32
+KPX w o -15
+KPX w comma -32
+
+KPX x e -7
+
+KPX y period -65
+KPX y o -20
+KPX y e -7
+KPX y comma -65
+KPX y a -24
+
+KPX z e 8
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 160 186 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 160 186 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 160 186 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 160 186 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 160 186 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 160 186 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 176 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 137 186 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 137 186 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 137 186 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 137 186 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute -22 186 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -22 186 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -22 186 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave -22 186 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 160 186 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 183 186 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 183 186 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 183 186 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 183 186 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 183 186 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 137 186 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 160 186 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 160 186 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 160 186 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 160 186 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 137 186 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 137 186 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 114 186 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 92 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 92 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 92 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 92 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 92 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 92 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 108 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 92 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 92 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 92 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 92 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -22 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -22 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -22 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -22 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 114 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 114 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 114 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 114 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 114 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 114 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 92 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 114 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 114 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 114 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 114 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 92 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 92 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 69 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvbo8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvbo8a.afm
new file mode 100644
index 0000000..b6cff41
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvbo8a.afm
@@ -0,0 +1,570 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu Mar 15 10:44:33 1990
+Comment UniqueID 28371
+Comment VMusage 7614 43068
+FontName Helvetica-BoldOblique
+FullName Helvetica Bold Oblique
+FamilyName Helvetica
+Weight Bold
+ItalicAngle -12
+IsFixedPitch false
+FontBBox -174 -228 1114 962
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.007
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 718
+XHeight 532
+Ascender 718
+Descender -207
+StartCharMetrics 228
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 94 0 397 718 ;
+C 34 ; WX 474 ; N quotedbl ; B 193 447 529 718 ;
+C 35 ; WX 556 ; N numbersign ; B 60 0 644 698 ;
+C 36 ; WX 556 ; N dollar ; B 67 -115 622 775 ;
+C 37 ; WX 889 ; N percent ; B 136 -19 901 710 ;
+C 38 ; WX 722 ; N ampersand ; B 89 -19 732 718 ;
+C 39 ; WX 278 ; N quoteright ; B 167 445 362 718 ;
+C 40 ; WX 333 ; N parenleft ; B 76 -208 470 734 ;
+C 41 ; WX 333 ; N parenright ; B -25 -208 369 734 ;
+C 42 ; WX 389 ; N asterisk ; B 146 387 481 718 ;
+C 43 ; WX 584 ; N plus ; B 82 0 610 506 ;
+C 44 ; WX 278 ; N comma ; B 28 -168 245 146 ;
+C 45 ; WX 333 ; N hyphen ; B 73 215 379 345 ;
+C 46 ; WX 278 ; N period ; B 64 0 245 146 ;
+C 47 ; WX 278 ; N slash ; B -37 -19 468 737 ;
+C 48 ; WX 556 ; N zero ; B 86 -19 617 710 ;
+C 49 ; WX 556 ; N one ; B 173 0 529 710 ;
+C 50 ; WX 556 ; N two ; B 26 0 619 710 ;
+C 51 ; WX 556 ; N three ; B 65 -19 608 710 ;
+C 52 ; WX 556 ; N four ; B 60 0 598 710 ;
+C 53 ; WX 556 ; N five ; B 64 -19 636 698 ;
+C 54 ; WX 556 ; N six ; B 85 -19 619 710 ;
+C 55 ; WX 556 ; N seven ; B 125 0 676 698 ;
+C 56 ; WX 556 ; N eight ; B 69 -19 616 710 ;
+C 57 ; WX 556 ; N nine ; B 78 -19 615 710 ;
+C 58 ; WX 333 ; N colon ; B 92 0 351 512 ;
+C 59 ; WX 333 ; N semicolon ; B 56 -168 351 512 ;
+C 60 ; WX 584 ; N less ; B 82 -8 655 514 ;
+C 61 ; WX 584 ; N equal ; B 58 87 633 419 ;
+C 62 ; WX 584 ; N greater ; B 36 -8 609 514 ;
+C 63 ; WX 611 ; N question ; B 165 0 671 727 ;
+C 64 ; WX 975 ; N at ; B 186 -19 954 737 ;
+C 65 ; WX 722 ; N A ; B 20 0 702 718 ;
+C 66 ; WX 722 ; N B ; B 76 0 764 718 ;
+C 67 ; WX 722 ; N C ; B 107 -19 789 737 ;
+C 68 ; WX 722 ; N D ; B 76 0 777 718 ;
+C 69 ; WX 667 ; N E ; B 76 0 757 718 ;
+C 70 ; WX 611 ; N F ; B 76 0 740 718 ;
+C 71 ; WX 778 ; N G ; B 108 -19 817 737 ;
+C 72 ; WX 722 ; N H ; B 71 0 804 718 ;
+C 73 ; WX 278 ; N I ; B 64 0 367 718 ;
+C 74 ; WX 556 ; N J ; B 60 -18 637 718 ;
+C 75 ; WX 722 ; N K ; B 87 0 858 718 ;
+C 76 ; WX 611 ; N L ; B 76 0 611 718 ;
+C 77 ; WX 833 ; N M ; B 69 0 918 718 ;
+C 78 ; WX 722 ; N N ; B 69 0 807 718 ;
+C 79 ; WX 778 ; N O ; B 107 -19 823 737 ;
+C 80 ; WX 667 ; N P ; B 76 0 738 718 ;
+C 81 ; WX 778 ; N Q ; B 107 -52 823 737 ;
+C 82 ; WX 722 ; N R ; B 76 0 778 718 ;
+C 83 ; WX 667 ; N S ; B 81 -19 718 737 ;
+C 84 ; WX 611 ; N T ; B 140 0 751 718 ;
+C 85 ; WX 722 ; N U ; B 116 -19 804 718 ;
+C 86 ; WX 667 ; N V ; B 172 0 801 718 ;
+C 87 ; WX 944 ; N W ; B 169 0 1082 718 ;
+C 88 ; WX 667 ; N X ; B 14 0 791 718 ;
+C 89 ; WX 667 ; N Y ; B 168 0 806 718 ;
+C 90 ; WX 611 ; N Z ; B 25 0 737 718 ;
+C 91 ; WX 333 ; N bracketleft ; B 21 -196 462 722 ;
+C 92 ; WX 278 ; N backslash ; B 124 -19 307 737 ;
+C 93 ; WX 333 ; N bracketright ; B -18 -196 423 722 ;
+C 94 ; WX 584 ; N asciicircum ; B 131 323 591 698 ;
+C 95 ; WX 556 ; N underscore ; B -27 -125 540 -75 ;
+C 96 ; WX 278 ; N quoteleft ; B 165 454 361 727 ;
+C 97 ; WX 556 ; N a ; B 55 -14 583 546 ;
+C 98 ; WX 611 ; N b ; B 61 -14 645 718 ;
+C 99 ; WX 556 ; N c ; B 79 -14 599 546 ;
+C 100 ; WX 611 ; N d ; B 82 -14 704 718 ;
+C 101 ; WX 556 ; N e ; B 70 -14 593 546 ;
+C 102 ; WX 333 ; N f ; B 87 0 469 727 ; L i fi ; L l fl ;
+C 103 ; WX 611 ; N g ; B 38 -217 666 546 ;
+C 104 ; WX 611 ; N h ; B 65 0 629 718 ;
+C 105 ; WX 278 ; N i ; B 69 0 363 725 ;
+C 106 ; WX 278 ; N j ; B -42 -214 363 725 ;
+C 107 ; WX 556 ; N k ; B 69 0 670 718 ;
+C 108 ; WX 278 ; N l ; B 69 0 362 718 ;
+C 109 ; WX 889 ; N m ; B 64 0 909 546 ;
+C 110 ; WX 611 ; N n ; B 65 0 629 546 ;
+C 111 ; WX 611 ; N o ; B 82 -14 643 546 ;
+C 112 ; WX 611 ; N p ; B 18 -207 645 546 ;
+C 113 ; WX 611 ; N q ; B 80 -207 665 546 ;
+C 114 ; WX 389 ; N r ; B 64 0 489 546 ;
+C 115 ; WX 556 ; N s ; B 63 -14 584 546 ;
+C 116 ; WX 333 ; N t ; B 100 -6 422 676 ;
+C 117 ; WX 611 ; N u ; B 98 -14 658 532 ;
+C 118 ; WX 556 ; N v ; B 126 0 656 532 ;
+C 119 ; WX 778 ; N w ; B 123 0 882 532 ;
+C 120 ; WX 556 ; N x ; B 15 0 648 532 ;
+C 121 ; WX 556 ; N y ; B 42 -214 652 532 ;
+C 122 ; WX 500 ; N z ; B 20 0 583 532 ;
+C 123 ; WX 389 ; N braceleft ; B 94 -196 518 722 ;
+C 124 ; WX 280 ; N bar ; B 80 -19 353 737 ;
+C 125 ; WX 389 ; N braceright ; B -18 -196 407 722 ;
+C 126 ; WX 584 ; N asciitilde ; B 115 163 577 343 ;
+C 161 ; WX 333 ; N exclamdown ; B 50 -186 353 532 ;
+C 162 ; WX 556 ; N cent ; B 79 -118 599 628 ;
+C 163 ; WX 556 ; N sterling ; B 50 -16 635 718 ;
+C 164 ; WX 167 ; N fraction ; B -174 -19 487 710 ;
+C 165 ; WX 556 ; N yen ; B 60 0 713 698 ;
+C 166 ; WX 556 ; N florin ; B -50 -210 669 737 ;
+C 167 ; WX 556 ; N section ; B 61 -184 598 727 ;
+C 168 ; WX 556 ; N currency ; B 27 76 680 636 ;
+C 169 ; WX 238 ; N quotesingle ; B 165 447 321 718 ;
+C 170 ; WX 500 ; N quotedblleft ; B 160 454 588 727 ;
+C 171 ; WX 556 ; N guillemotleft ; B 135 76 571 484 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 130 76 353 484 ;
+C 173 ; WX 333 ; N guilsinglright ; B 99 76 322 484 ;
+C 174 ; WX 611 ; N fi ; B 87 0 696 727 ;
+C 175 ; WX 611 ; N fl ; B 87 0 695 727 ;
+C 177 ; WX 556 ; N endash ; B 48 227 627 333 ;
+C 178 ; WX 556 ; N dagger ; B 118 -171 626 718 ;
+C 179 ; WX 556 ; N daggerdbl ; B 46 -171 628 718 ;
+C 180 ; WX 278 ; N periodcentered ; B 110 172 276 334 ;
+C 182 ; WX 556 ; N paragraph ; B 98 -191 688 700 ;
+C 183 ; WX 350 ; N bullet ; B 83 194 420 524 ;
+C 184 ; WX 278 ; N quotesinglbase ; B 41 -146 236 127 ;
+C 185 ; WX 500 ; N quotedblbase ; B 36 -146 463 127 ;
+C 186 ; WX 500 ; N quotedblright ; B 162 445 589 718 ;
+C 187 ; WX 556 ; N guillemotright ; B 104 76 540 484 ;
+C 188 ; WX 1000 ; N ellipsis ; B 92 0 939 146 ;
+C 189 ; WX 1000 ; N perthousand ; B 76 -19 1038 710 ;
+C 191 ; WX 611 ; N questiondown ; B 53 -195 559 532 ;
+C 193 ; WX 333 ; N grave ; B 136 604 353 750 ;
+C 194 ; WX 333 ; N acute ; B 236 604 515 750 ;
+C 195 ; WX 333 ; N circumflex ; B 118 604 471 750 ;
+C 196 ; WX 333 ; N tilde ; B 113 610 507 737 ;
+C 197 ; WX 333 ; N macron ; B 122 604 483 678 ;
+C 198 ; WX 333 ; N breve ; B 156 604 494 750 ;
+C 199 ; WX 333 ; N dotaccent ; B 235 614 385 729 ;
+C 200 ; WX 333 ; N dieresis ; B 137 614 482 729 ;
+C 202 ; WX 333 ; N ring ; B 200 568 420 776 ;
+C 203 ; WX 333 ; N cedilla ; B -37 -228 220 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 137 604 645 750 ;
+C 206 ; WX 333 ; N ogonek ; B 41 -228 264 0 ;
+C 207 ; WX 333 ; N caron ; B 149 604 502 750 ;
+C 208 ; WX 1000 ; N emdash ; B 48 227 1071 333 ;
+C 225 ; WX 1000 ; N AE ; B 5 0 1100 718 ;
+C 227 ; WX 370 ; N ordfeminine ; B 92 276 465 737 ;
+C 232 ; WX 611 ; N Lslash ; B 34 0 611 718 ;
+C 233 ; WX 778 ; N Oslash ; B 35 -27 894 745 ;
+C 234 ; WX 1000 ; N OE ; B 99 -19 1114 737 ;
+C 235 ; WX 365 ; N ordmasculine ; B 92 276 485 737 ;
+C 241 ; WX 889 ; N ae ; B 56 -14 923 546 ;
+C 245 ; WX 278 ; N dotlessi ; B 69 0 322 532 ;
+C 248 ; WX 278 ; N lslash ; B 40 0 407 718 ;
+C 249 ; WX 611 ; N oslash ; B 22 -29 701 560 ;
+C 250 ; WX 944 ; N oe ; B 82 -14 977 546 ;
+C 251 ; WX 611 ; N germandbls ; B 69 -14 657 731 ;
+C -1 ; WX 611 ; N Zcaron ; B 25 0 737 936 ;
+C -1 ; WX 556 ; N ccedilla ; B 79 -228 599 546 ;
+C -1 ; WX 556 ; N ydieresis ; B 42 -214 652 729 ;
+C -1 ; WX 556 ; N atilde ; B 55 -14 619 737 ;
+C -1 ; WX 278 ; N icircumflex ; B 69 0 444 750 ;
+C -1 ; WX 333 ; N threesuperior ; B 91 271 441 710 ;
+C -1 ; WX 556 ; N ecircumflex ; B 70 -14 593 750 ;
+C -1 ; WX 611 ; N thorn ; B 18 -208 645 718 ;
+C -1 ; WX 556 ; N egrave ; B 70 -14 593 750 ;
+C -1 ; WX 333 ; N twosuperior ; B 69 283 449 710 ;
+C -1 ; WX 556 ; N eacute ; B 70 -14 627 750 ;
+C -1 ; WX 611 ; N otilde ; B 82 -14 646 737 ;
+C -1 ; WX 722 ; N Aacute ; B 20 0 750 936 ;
+C -1 ; WX 611 ; N ocircumflex ; B 82 -14 643 750 ;
+C -1 ; WX 556 ; N yacute ; B 42 -214 652 750 ;
+C -1 ; WX 611 ; N udieresis ; B 98 -14 658 729 ;
+C -1 ; WX 834 ; N threequarters ; B 99 -19 839 710 ;
+C -1 ; WX 556 ; N acircumflex ; B 55 -14 583 750 ;
+C -1 ; WX 722 ; N Eth ; B 62 0 777 718 ;
+C -1 ; WX 556 ; N edieresis ; B 70 -14 594 729 ;
+C -1 ; WX 611 ; N ugrave ; B 98 -14 658 750 ;
+C -1 ; WX 1000 ; N trademark ; B 179 306 1109 718 ;
+C -1 ; WX 611 ; N ograve ; B 82 -14 643 750 ;
+C -1 ; WX 556 ; N scaron ; B 63 -14 614 750 ;
+C -1 ; WX 278 ; N Idieresis ; B 64 0 494 915 ;
+C -1 ; WX 611 ; N uacute ; B 98 -14 658 750 ;
+C -1 ; WX 556 ; N agrave ; B 55 -14 583 750 ;
+C -1 ; WX 611 ; N ntilde ; B 65 0 646 737 ;
+C -1 ; WX 556 ; N aring ; B 55 -14 583 776 ;
+C -1 ; WX 500 ; N zcaron ; B 20 0 586 750 ;
+C -1 ; WX 278 ; N Icircumflex ; B 64 0 484 936 ;
+C -1 ; WX 722 ; N Ntilde ; B 69 0 807 923 ;
+C -1 ; WX 611 ; N ucircumflex ; B 98 -14 658 750 ;
+C -1 ; WX 667 ; N Ecircumflex ; B 76 0 757 936 ;
+C -1 ; WX 278 ; N Iacute ; B 64 0 528 936 ;
+C -1 ; WX 722 ; N Ccedilla ; B 107 -228 789 737 ;
+C -1 ; WX 778 ; N Odieresis ; B 107 -19 823 915 ;
+C -1 ; WX 667 ; N Scaron ; B 81 -19 718 936 ;
+C -1 ; WX 667 ; N Edieresis ; B 76 0 757 915 ;
+C -1 ; WX 278 ; N Igrave ; B 64 0 367 936 ;
+C -1 ; WX 556 ; N adieresis ; B 55 -14 594 729 ;
+C -1 ; WX 778 ; N Ograve ; B 107 -19 823 936 ;
+C -1 ; WX 667 ; N Egrave ; B 76 0 757 936 ;
+C -1 ; WX 667 ; N Ydieresis ; B 168 0 806 915 ;
+C -1 ; WX 737 ; N registered ; B 55 -19 834 737 ;
+C -1 ; WX 778 ; N Otilde ; B 107 -19 823 923 ;
+C -1 ; WX 834 ; N onequarter ; B 132 -19 806 710 ;
+C -1 ; WX 722 ; N Ugrave ; B 116 -19 804 936 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 116 -19 804 936 ;
+C -1 ; WX 667 ; N Thorn ; B 76 0 716 718 ;
+C -1 ; WX 584 ; N divide ; B 82 -42 610 548 ;
+C -1 ; WX 722 ; N Atilde ; B 20 0 741 923 ;
+C -1 ; WX 722 ; N Uacute ; B 116 -19 804 936 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 107 -19 823 936 ;
+C -1 ; WX 584 ; N logicalnot ; B 105 108 633 419 ;
+C -1 ; WX 722 ; N Aring ; B 20 0 702 962 ;
+C -1 ; WX 278 ; N idieresis ; B 69 0 455 729 ;
+C -1 ; WX 278 ; N iacute ; B 69 0 488 750 ;
+C -1 ; WX 556 ; N aacute ; B 55 -14 627 750 ;
+C -1 ; WX 584 ; N plusminus ; B 40 0 625 506 ;
+C -1 ; WX 584 ; N multiply ; B 57 1 635 505 ;
+C -1 ; WX 722 ; N Udieresis ; B 116 -19 804 915 ;
+C -1 ; WX 584 ; N minus ; B 82 197 610 309 ;
+C -1 ; WX 333 ; N onesuperior ; B 148 283 388 710 ;
+C -1 ; WX 667 ; N Eacute ; B 76 0 757 936 ;
+C -1 ; WX 722 ; N Acircumflex ; B 20 0 706 936 ;
+C -1 ; WX 737 ; N copyright ; B 56 -19 835 737 ;
+C -1 ; WX 722 ; N Agrave ; B 20 0 702 936 ;
+C -1 ; WX 611 ; N odieresis ; B 82 -14 643 729 ;
+C -1 ; WX 611 ; N oacute ; B 82 -14 654 750 ;
+C -1 ; WX 400 ; N degree ; B 175 426 467 712 ;
+C -1 ; WX 278 ; N igrave ; B 69 0 326 750 ;
+C -1 ; WX 611 ; N mu ; B 22 -207 658 532 ;
+C -1 ; WX 778 ; N Oacute ; B 107 -19 823 936 ;
+C -1 ; WX 611 ; N eth ; B 82 -14 670 737 ;
+C -1 ; WX 722 ; N Adieresis ; B 20 0 716 915 ;
+C -1 ; WX 667 ; N Yacute ; B 168 0 806 936 ;
+C -1 ; WX 280 ; N brokenbar ; B 80 -19 353 737 ;
+C -1 ; WX 834 ; N onehalf ; B 132 -19 858 710 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 209
+
+KPX A y -30
+KPX A w -30
+KPX A v -40
+KPX A u -30
+KPX A Y -110
+KPX A W -60
+KPX A V -80
+KPX A U -50
+KPX A T -90
+KPX A Q -40
+KPX A O -40
+KPX A G -50
+KPX A C -40
+
+KPX B U -10
+KPX B A -30
+
+KPX D period -30
+KPX D comma -30
+KPX D Y -70
+KPX D W -40
+KPX D V -40
+KPX D A -40
+
+KPX F period -100
+KPX F comma -100
+KPX F a -20
+KPX F A -80
+
+KPX J u -20
+KPX J period -20
+KPX J comma -20
+KPX J A -20
+
+KPX K y -40
+KPX K u -30
+KPX K o -35
+KPX K e -15
+KPX K O -30
+
+KPX L y -30
+KPX L quoteright -140
+KPX L quotedblright -140
+KPX L Y -120
+KPX L W -80
+KPX L V -110
+KPX L T -90
+
+KPX O period -40
+KPX O comma -40
+KPX O Y -70
+KPX O X -50
+KPX O W -50
+KPX O V -50
+KPX O T -40
+KPX O A -50
+
+KPX P period -120
+KPX P o -40
+KPX P e -30
+KPX P comma -120
+KPX P a -30
+KPX P A -100
+
+KPX Q period 20
+KPX Q comma 20
+KPX Q U -10
+
+KPX R Y -50
+KPX R W -40
+KPX R V -50
+KPX R U -20
+KPX R T -20
+KPX R O -20
+
+KPX T y -60
+KPX T w -60
+KPX T u -90
+KPX T semicolon -40
+KPX T r -80
+KPX T period -80
+KPX T o -80
+KPX T hyphen -120
+KPX T e -60
+KPX T comma -80
+KPX T colon -40
+KPX T a -80
+KPX T O -40
+KPX T A -90
+
+KPX U period -30
+KPX U comma -30
+KPX U A -50
+
+KPX V u -60
+KPX V semicolon -40
+KPX V period -120
+KPX V o -90
+KPX V hyphen -80
+KPX V e -50
+KPX V comma -120
+KPX V colon -40
+KPX V a -60
+KPX V O -50
+KPX V G -50
+KPX V A -80
+
+KPX W y -20
+KPX W u -45
+KPX W semicolon -10
+KPX W period -80
+KPX W o -60
+KPX W hyphen -40
+KPX W e -35
+KPX W comma -80
+KPX W colon -10
+KPX W a -40
+KPX W O -20
+KPX W A -60
+
+KPX Y u -100
+KPX Y semicolon -50
+KPX Y period -100
+KPX Y o -100
+KPX Y e -80
+KPX Y comma -100
+KPX Y colon -50
+KPX Y a -90
+KPX Y O -70
+KPX Y A -110
+
+KPX a y -20
+KPX a w -15
+KPX a v -15
+KPX a g -10
+
+KPX b y -20
+KPX b v -20
+KPX b u -20
+KPX b l -10
+
+KPX c y -10
+KPX c l -20
+KPX c k -20
+KPX c h -10
+
+KPX colon space -40
+
+KPX comma space -40
+KPX comma quoteright -120
+KPX comma quotedblright -120
+
+KPX d y -15
+KPX d w -15
+KPX d v -15
+KPX d d -10
+
+KPX e y -15
+KPX e x -15
+KPX e w -15
+KPX e v -15
+KPX e period 20
+KPX e comma 10
+
+KPX f quoteright 30
+KPX f quotedblright 30
+KPX f period -10
+KPX f o -20
+KPX f e -10
+KPX f comma -10
+
+KPX g g -10
+KPX g e 10
+
+KPX h y -20
+
+KPX k o -15
+
+KPX l y -15
+KPX l w -15
+
+KPX m y -30
+KPX m u -20
+
+KPX n y -20
+KPX n v -40
+KPX n u -10
+
+KPX o y -20
+KPX o x -30
+KPX o w -15
+KPX o v -20
+
+KPX p y -15
+
+KPX period space -40
+KPX period quoteright -120
+KPX period quotedblright -120
+
+KPX quotedblright space -80
+
+KPX quoteleft quoteleft -46
+
+KPX quoteright v -20
+KPX quoteright space -80
+KPX quoteright s -60
+KPX quoteright r -40
+KPX quoteright quoteright -46
+KPX quoteright l -20
+KPX quoteright d -80
+
+KPX r y 10
+KPX r v 10
+KPX r t 20
+KPX r s -15
+KPX r q -20
+KPX r period -60
+KPX r o -20
+KPX r hyphen -20
+KPX r g -15
+KPX r d -20
+KPX r comma -60
+KPX r c -20
+
+KPX s w -15
+
+KPX semicolon space -40
+
+KPX space quoteleft -60
+KPX space quotedblleft -80
+KPX space Y -120
+KPX space W -80
+KPX space V -80
+KPX space T -100
+
+KPX v period -80
+KPX v o -30
+KPX v comma -80
+KPX v a -20
+
+KPX w period -40
+KPX w o -20
+KPX w comma -40
+
+KPX x e -10
+
+KPX y period -80
+KPX y o -25
+KPX y e -10
+KPX y comma -80
+KPX y a -30
+
+KPX z e 10
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 235 186 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 235 186 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 235 186 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 235 186 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 235 186 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 235 186 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 215 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 207 186 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 207 186 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 207 186 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 207 186 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 13 186 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 13 186 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 13 186 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 13 186 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 235 186 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 263 186 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 263 186 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 263 186 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 263 186 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 263 186 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 207 186 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 235 186 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 235 186 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 235 186 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 235 186 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 207 186 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 207 186 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 179 186 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 112 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 112 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 112 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 112 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 112 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 112 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 132 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 112 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 112 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 112 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 112 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -27 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -27 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -27 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -27 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 139 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 139 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 139 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 139 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 139 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 139 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 112 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 139 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 139 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 139 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 139 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 112 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 112 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 84 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvbo8an.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvbo8an.afm
new file mode 100644
index 0000000..1a38001
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvbo8an.afm
@@ -0,0 +1,570 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu Mar 15 12:08:57 1990
+Comment UniqueID 28407
+Comment VMusage 7614 43068
+FontName Helvetica-Narrow-BoldOblique
+FullName Helvetica Narrow Bold Oblique
+FamilyName Helvetica
+Weight Bold
+ItalicAngle -12
+IsFixedPitch false
+FontBBox -143 -228 913 962
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.007
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 718
+XHeight 532
+Ascender 718
+Descender -207
+StartCharMetrics 228
+C 32 ; WX 228 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 273 ; N exclam ; B 77 0 325 718 ;
+C 34 ; WX 389 ; N quotedbl ; B 158 447 433 718 ;
+C 35 ; WX 456 ; N numbersign ; B 49 0 528 698 ;
+C 36 ; WX 456 ; N dollar ; B 55 -115 510 775 ;
+C 37 ; WX 729 ; N percent ; B 112 -19 739 710 ;
+C 38 ; WX 592 ; N ampersand ; B 73 -19 600 718 ;
+C 39 ; WX 228 ; N quoteright ; B 137 445 297 718 ;
+C 40 ; WX 273 ; N parenleft ; B 62 -208 385 734 ;
+C 41 ; WX 273 ; N parenright ; B -21 -208 302 734 ;
+C 42 ; WX 319 ; N asterisk ; B 120 387 394 718 ;
+C 43 ; WX 479 ; N plus ; B 67 0 500 506 ;
+C 44 ; WX 228 ; N comma ; B 23 -168 201 146 ;
+C 45 ; WX 273 ; N hyphen ; B 60 215 311 345 ;
+C 46 ; WX 228 ; N period ; B 52 0 201 146 ;
+C 47 ; WX 228 ; N slash ; B -30 -19 383 737 ;
+C 48 ; WX 456 ; N zero ; B 71 -19 506 710 ;
+C 49 ; WX 456 ; N one ; B 142 0 434 710 ;
+C 50 ; WX 456 ; N two ; B 21 0 508 710 ;
+C 51 ; WX 456 ; N three ; B 54 -19 499 710 ;
+C 52 ; WX 456 ; N four ; B 50 0 490 710 ;
+C 53 ; WX 456 ; N five ; B 53 -19 522 698 ;
+C 54 ; WX 456 ; N six ; B 70 -19 507 710 ;
+C 55 ; WX 456 ; N seven ; B 102 0 555 698 ;
+C 56 ; WX 456 ; N eight ; B 57 -19 505 710 ;
+C 57 ; WX 456 ; N nine ; B 64 -19 504 710 ;
+C 58 ; WX 273 ; N colon ; B 75 0 288 512 ;
+C 59 ; WX 273 ; N semicolon ; B 46 -168 288 512 ;
+C 60 ; WX 479 ; N less ; B 67 -8 537 514 ;
+C 61 ; WX 479 ; N equal ; B 48 87 519 419 ;
+C 62 ; WX 479 ; N greater ; B 30 -8 500 514 ;
+C 63 ; WX 501 ; N question ; B 135 0 550 727 ;
+C 64 ; WX 800 ; N at ; B 152 -19 782 737 ;
+C 65 ; WX 592 ; N A ; B 16 0 576 718 ;
+C 66 ; WX 592 ; N B ; B 62 0 626 718 ;
+C 67 ; WX 592 ; N C ; B 88 -19 647 737 ;
+C 68 ; WX 592 ; N D ; B 62 0 637 718 ;
+C 69 ; WX 547 ; N E ; B 62 0 620 718 ;
+C 70 ; WX 501 ; N F ; B 62 0 606 718 ;
+C 71 ; WX 638 ; N G ; B 89 -19 670 737 ;
+C 72 ; WX 592 ; N H ; B 58 0 659 718 ;
+C 73 ; WX 228 ; N I ; B 52 0 301 718 ;
+C 74 ; WX 456 ; N J ; B 49 -18 522 718 ;
+C 75 ; WX 592 ; N K ; B 71 0 703 718 ;
+C 76 ; WX 501 ; N L ; B 62 0 501 718 ;
+C 77 ; WX 683 ; N M ; B 57 0 752 718 ;
+C 78 ; WX 592 ; N N ; B 57 0 661 718 ;
+C 79 ; WX 638 ; N O ; B 88 -19 675 737 ;
+C 80 ; WX 547 ; N P ; B 62 0 605 718 ;
+C 81 ; WX 638 ; N Q ; B 88 -52 675 737 ;
+C 82 ; WX 592 ; N R ; B 62 0 638 718 ;
+C 83 ; WX 547 ; N S ; B 66 -19 588 737 ;
+C 84 ; WX 501 ; N T ; B 114 0 615 718 ;
+C 85 ; WX 592 ; N U ; B 96 -19 659 718 ;
+C 86 ; WX 547 ; N V ; B 141 0 656 718 ;
+C 87 ; WX 774 ; N W ; B 138 0 887 718 ;
+C 88 ; WX 547 ; N X ; B 11 0 648 718 ;
+C 89 ; WX 547 ; N Y ; B 137 0 661 718 ;
+C 90 ; WX 501 ; N Z ; B 20 0 604 718 ;
+C 91 ; WX 273 ; N bracketleft ; B 17 -196 379 722 ;
+C 92 ; WX 228 ; N backslash ; B 101 -19 252 737 ;
+C 93 ; WX 273 ; N bracketright ; B -14 -196 347 722 ;
+C 94 ; WX 479 ; N asciicircum ; B 107 323 484 698 ;
+C 95 ; WX 456 ; N underscore ; B -22 -125 443 -75 ;
+C 96 ; WX 228 ; N quoteleft ; B 136 454 296 727 ;
+C 97 ; WX 456 ; N a ; B 45 -14 478 546 ;
+C 98 ; WX 501 ; N b ; B 50 -14 529 718 ;
+C 99 ; WX 456 ; N c ; B 65 -14 491 546 ;
+C 100 ; WX 501 ; N d ; B 67 -14 577 718 ;
+C 101 ; WX 456 ; N e ; B 58 -14 486 546 ;
+C 102 ; WX 273 ; N f ; B 71 0 385 727 ; L i fi ; L l fl ;
+C 103 ; WX 501 ; N g ; B 31 -217 546 546 ;
+C 104 ; WX 501 ; N h ; B 53 0 516 718 ;
+C 105 ; WX 228 ; N i ; B 57 0 298 725 ;
+C 106 ; WX 228 ; N j ; B -35 -214 298 725 ;
+C 107 ; WX 456 ; N k ; B 57 0 549 718 ;
+C 108 ; WX 228 ; N l ; B 57 0 297 718 ;
+C 109 ; WX 729 ; N m ; B 52 0 746 546 ;
+C 110 ; WX 501 ; N n ; B 53 0 516 546 ;
+C 111 ; WX 501 ; N o ; B 67 -14 527 546 ;
+C 112 ; WX 501 ; N p ; B 15 -207 529 546 ;
+C 113 ; WX 501 ; N q ; B 66 -207 545 546 ;
+C 114 ; WX 319 ; N r ; B 52 0 401 546 ;
+C 115 ; WX 456 ; N s ; B 52 -14 479 546 ;
+C 116 ; WX 273 ; N t ; B 82 -6 346 676 ;
+C 117 ; WX 501 ; N u ; B 80 -14 540 532 ;
+C 118 ; WX 456 ; N v ; B 103 0 538 532 ;
+C 119 ; WX 638 ; N w ; B 101 0 723 532 ;
+C 120 ; WX 456 ; N x ; B 12 0 531 532 ;
+C 121 ; WX 456 ; N y ; B 34 -214 535 532 ;
+C 122 ; WX 410 ; N z ; B 16 0 478 532 ;
+C 123 ; WX 319 ; N braceleft ; B 77 -196 425 722 ;
+C 124 ; WX 230 ; N bar ; B 66 -19 289 737 ;
+C 125 ; WX 319 ; N braceright ; B -14 -196 333 722 ;
+C 126 ; WX 479 ; N asciitilde ; B 94 163 473 343 ;
+C 161 ; WX 273 ; N exclamdown ; B 41 -186 290 532 ;
+C 162 ; WX 456 ; N cent ; B 65 -118 491 628 ;
+C 163 ; WX 456 ; N sterling ; B 41 -16 520 718 ;
+C 164 ; WX 137 ; N fraction ; B -143 -19 399 710 ;
+C 165 ; WX 456 ; N yen ; B 49 0 585 698 ;
+C 166 ; WX 456 ; N florin ; B -41 -210 548 737 ;
+C 167 ; WX 456 ; N section ; B 50 -184 491 727 ;
+C 168 ; WX 456 ; N currency ; B 22 76 558 636 ;
+C 169 ; WX 195 ; N quotesingle ; B 135 447 263 718 ;
+C 170 ; WX 410 ; N quotedblleft ; B 132 454 482 727 ;
+C 171 ; WX 456 ; N guillemotleft ; B 111 76 468 484 ;
+C 172 ; WX 273 ; N guilsinglleft ; B 106 76 289 484 ;
+C 173 ; WX 273 ; N guilsinglright ; B 81 76 264 484 ;
+C 174 ; WX 501 ; N fi ; B 71 0 571 727 ;
+C 175 ; WX 501 ; N fl ; B 71 0 570 727 ;
+C 177 ; WX 456 ; N endash ; B 40 227 514 333 ;
+C 178 ; WX 456 ; N dagger ; B 97 -171 513 718 ;
+C 179 ; WX 456 ; N daggerdbl ; B 38 -171 515 718 ;
+C 180 ; WX 228 ; N periodcentered ; B 90 172 226 334 ;
+C 182 ; WX 456 ; N paragraph ; B 80 -191 564 700 ;
+C 183 ; WX 287 ; N bullet ; B 68 194 345 524 ;
+C 184 ; WX 228 ; N quotesinglbase ; B 34 -146 194 127 ;
+C 185 ; WX 410 ; N quotedblbase ; B 29 -146 380 127 ;
+C 186 ; WX 410 ; N quotedblright ; B 132 445 483 718 ;
+C 187 ; WX 456 ; N guillemotright ; B 85 76 443 484 ;
+C 188 ; WX 820 ; N ellipsis ; B 75 0 770 146 ;
+C 189 ; WX 820 ; N perthousand ; B 62 -19 851 710 ;
+C 191 ; WX 501 ; N questiondown ; B 44 -195 459 532 ;
+C 193 ; WX 273 ; N grave ; B 112 604 290 750 ;
+C 194 ; WX 273 ; N acute ; B 194 604 423 750 ;
+C 195 ; WX 273 ; N circumflex ; B 97 604 387 750 ;
+C 196 ; WX 273 ; N tilde ; B 92 610 415 737 ;
+C 197 ; WX 273 ; N macron ; B 100 604 396 678 ;
+C 198 ; WX 273 ; N breve ; B 128 604 405 750 ;
+C 199 ; WX 273 ; N dotaccent ; B 192 614 316 729 ;
+C 200 ; WX 273 ; N dieresis ; B 112 614 395 729 ;
+C 202 ; WX 273 ; N ring ; B 164 568 344 776 ;
+C 203 ; WX 273 ; N cedilla ; B -30 -228 180 0 ;
+C 205 ; WX 273 ; N hungarumlaut ; B 113 604 529 750 ;
+C 206 ; WX 273 ; N ogonek ; B 33 -228 216 0 ;
+C 207 ; WX 273 ; N caron ; B 123 604 412 750 ;
+C 208 ; WX 820 ; N emdash ; B 40 227 878 333 ;
+C 225 ; WX 820 ; N AE ; B 4 0 902 718 ;
+C 227 ; WX 303 ; N ordfeminine ; B 75 276 381 737 ;
+C 232 ; WX 501 ; N Lslash ; B 28 0 501 718 ;
+C 233 ; WX 638 ; N Oslash ; B 29 -27 733 745 ;
+C 234 ; WX 820 ; N OE ; B 81 -19 913 737 ;
+C 235 ; WX 299 ; N ordmasculine ; B 75 276 398 737 ;
+C 241 ; WX 729 ; N ae ; B 46 -14 757 546 ;
+C 245 ; WX 228 ; N dotlessi ; B 57 0 264 532 ;
+C 248 ; WX 228 ; N lslash ; B 33 0 334 718 ;
+C 249 ; WX 501 ; N oslash ; B 18 -29 575 560 ;
+C 250 ; WX 774 ; N oe ; B 67 -14 801 546 ;
+C 251 ; WX 501 ; N germandbls ; B 57 -14 539 731 ;
+C -1 ; WX 501 ; N Zcaron ; B 20 0 604 936 ;
+C -1 ; WX 456 ; N ccedilla ; B 65 -228 491 546 ;
+C -1 ; WX 456 ; N ydieresis ; B 34 -214 535 729 ;
+C -1 ; WX 456 ; N atilde ; B 45 -14 507 737 ;
+C -1 ; WX 228 ; N icircumflex ; B 57 0 364 750 ;
+C -1 ; WX 273 ; N threesuperior ; B 75 271 361 710 ;
+C -1 ; WX 456 ; N ecircumflex ; B 58 -14 486 750 ;
+C -1 ; WX 501 ; N thorn ; B 15 -208 529 718 ;
+C -1 ; WX 456 ; N egrave ; B 58 -14 486 750 ;
+C -1 ; WX 273 ; N twosuperior ; B 57 283 368 710 ;
+C -1 ; WX 456 ; N eacute ; B 58 -14 514 750 ;
+C -1 ; WX 501 ; N otilde ; B 67 -14 529 737 ;
+C -1 ; WX 592 ; N Aacute ; B 16 0 615 936 ;
+C -1 ; WX 501 ; N ocircumflex ; B 67 -14 527 750 ;
+C -1 ; WX 456 ; N yacute ; B 34 -214 535 750 ;
+C -1 ; WX 501 ; N udieresis ; B 80 -14 540 729 ;
+C -1 ; WX 684 ; N threequarters ; B 82 -19 688 710 ;
+C -1 ; WX 456 ; N acircumflex ; B 45 -14 478 750 ;
+C -1 ; WX 592 ; N Eth ; B 51 0 637 718 ;
+C -1 ; WX 456 ; N edieresis ; B 58 -14 487 729 ;
+C -1 ; WX 501 ; N ugrave ; B 80 -14 540 750 ;
+C -1 ; WX 820 ; N trademark ; B 146 306 909 718 ;
+C -1 ; WX 501 ; N ograve ; B 67 -14 527 750 ;
+C -1 ; WX 456 ; N scaron ; B 52 -14 504 750 ;
+C -1 ; WX 228 ; N Idieresis ; B 52 0 405 915 ;
+C -1 ; WX 501 ; N uacute ; B 80 -14 540 750 ;
+C -1 ; WX 456 ; N agrave ; B 45 -14 478 750 ;
+C -1 ; WX 501 ; N ntilde ; B 53 0 529 737 ;
+C -1 ; WX 456 ; N aring ; B 45 -14 478 776 ;
+C -1 ; WX 410 ; N zcaron ; B 16 0 481 750 ;
+C -1 ; WX 228 ; N Icircumflex ; B 52 0 397 936 ;
+C -1 ; WX 592 ; N Ntilde ; B 57 0 661 923 ;
+C -1 ; WX 501 ; N ucircumflex ; B 80 -14 540 750 ;
+C -1 ; WX 547 ; N Ecircumflex ; B 62 0 620 936 ;
+C -1 ; WX 228 ; N Iacute ; B 52 0 433 936 ;
+C -1 ; WX 592 ; N Ccedilla ; B 88 -228 647 737 ;
+C -1 ; WX 638 ; N Odieresis ; B 88 -19 675 915 ;
+C -1 ; WX 547 ; N Scaron ; B 66 -19 588 936 ;
+C -1 ; WX 547 ; N Edieresis ; B 62 0 620 915 ;
+C -1 ; WX 228 ; N Igrave ; B 52 0 301 936 ;
+C -1 ; WX 456 ; N adieresis ; B 45 -14 487 729 ;
+C -1 ; WX 638 ; N Ograve ; B 88 -19 675 936 ;
+C -1 ; WX 547 ; N Egrave ; B 62 0 620 936 ;
+C -1 ; WX 547 ; N Ydieresis ; B 137 0 661 915 ;
+C -1 ; WX 604 ; N registered ; B 45 -19 684 737 ;
+C -1 ; WX 638 ; N Otilde ; B 88 -19 675 923 ;
+C -1 ; WX 684 ; N onequarter ; B 108 -19 661 710 ;
+C -1 ; WX 592 ; N Ugrave ; B 96 -19 659 936 ;
+C -1 ; WX 592 ; N Ucircumflex ; B 96 -19 659 936 ;
+C -1 ; WX 547 ; N Thorn ; B 62 0 588 718 ;
+C -1 ; WX 479 ; N divide ; B 67 -42 500 548 ;
+C -1 ; WX 592 ; N Atilde ; B 16 0 608 923 ;
+C -1 ; WX 592 ; N Uacute ; B 96 -19 659 936 ;
+C -1 ; WX 638 ; N Ocircumflex ; B 88 -19 675 936 ;
+C -1 ; WX 479 ; N logicalnot ; B 86 108 519 419 ;
+C -1 ; WX 592 ; N Aring ; B 16 0 576 962 ;
+C -1 ; WX 228 ; N idieresis ; B 57 0 373 729 ;
+C -1 ; WX 228 ; N iacute ; B 57 0 400 750 ;
+C -1 ; WX 456 ; N aacute ; B 45 -14 514 750 ;
+C -1 ; WX 479 ; N plusminus ; B 33 0 512 506 ;
+C -1 ; WX 479 ; N multiply ; B 47 1 520 505 ;
+C -1 ; WX 592 ; N Udieresis ; B 96 -19 659 915 ;
+C -1 ; WX 479 ; N minus ; B 67 197 500 309 ;
+C -1 ; WX 273 ; N onesuperior ; B 121 283 318 710 ;
+C -1 ; WX 547 ; N Eacute ; B 62 0 620 936 ;
+C -1 ; WX 592 ; N Acircumflex ; B 16 0 579 936 ;
+C -1 ; WX 604 ; N copyright ; B 46 -19 685 737 ;
+C -1 ; WX 592 ; N Agrave ; B 16 0 576 936 ;
+C -1 ; WX 501 ; N odieresis ; B 67 -14 527 729 ;
+C -1 ; WX 501 ; N oacute ; B 67 -14 537 750 ;
+C -1 ; WX 328 ; N degree ; B 143 426 383 712 ;
+C -1 ; WX 228 ; N igrave ; B 57 0 268 750 ;
+C -1 ; WX 501 ; N mu ; B 18 -207 540 532 ;
+C -1 ; WX 638 ; N Oacute ; B 88 -19 675 936 ;
+C -1 ; WX 501 ; N eth ; B 67 -14 549 737 ;
+C -1 ; WX 592 ; N Adieresis ; B 16 0 588 915 ;
+C -1 ; WX 547 ; N Yacute ; B 137 0 661 936 ;
+C -1 ; WX 230 ; N brokenbar ; B 66 -19 289 737 ;
+C -1 ; WX 684 ; N onehalf ; B 108 -19 704 710 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 209
+
+KPX A y -30
+KPX A w -30
+KPX A v -40
+KPX A u -30
+KPX A Y -110
+KPX A W -60
+KPX A V -80
+KPX A U -50
+KPX A T -90
+KPX A Q -40
+KPX A O -40
+KPX A G -50
+KPX A C -40
+
+KPX B U -10
+KPX B A -30
+
+KPX D period -30
+KPX D comma -30
+KPX D Y -70
+KPX D W -40
+KPX D V -40
+KPX D A -40
+
+KPX F period -100
+KPX F comma -100
+KPX F a -20
+KPX F A -80
+
+KPX J u -20
+KPX J period -20
+KPX J comma -20
+KPX J A -20
+
+KPX K y -40
+KPX K u -30
+KPX K o -35
+KPX K e -15
+KPX K O -30
+
+KPX L y -30
+KPX L quoteright -140
+KPX L quotedblright -140
+KPX L Y -120
+KPX L W -80
+KPX L V -110
+KPX L T -90
+
+KPX O period -40
+KPX O comma -40
+KPX O Y -70
+KPX O X -50
+KPX O W -50
+KPX O V -50
+KPX O T -40
+KPX O A -50
+
+KPX P period -120
+KPX P o -40
+KPX P e -30
+KPX P comma -120
+KPX P a -30
+KPX P A -100
+
+KPX Q period 20
+KPX Q comma 20
+KPX Q U -10
+
+KPX R Y -50
+KPX R W -40
+KPX R V -50
+KPX R U -20
+KPX R T -20
+KPX R O -20
+
+KPX T y -60
+KPX T w -60
+KPX T u -90
+KPX T semicolon -40
+KPX T r -80
+KPX T period -80
+KPX T o -80
+KPX T hyphen -120
+KPX T e -60
+KPX T comma -80
+KPX T colon -40
+KPX T a -80
+KPX T O -40
+KPX T A -90
+
+KPX U period -30
+KPX U comma -30
+KPX U A -50
+
+KPX V u -60
+KPX V semicolon -40
+KPX V period -120
+KPX V o -90
+KPX V hyphen -80
+KPX V e -50
+KPX V comma -120
+KPX V colon -40
+KPX V a -60
+KPX V O -50
+KPX V G -50
+KPX V A -80
+
+KPX W y -20
+KPX W u -45
+KPX W semicolon -10
+KPX W period -80
+KPX W o -60
+KPX W hyphen -40
+KPX W e -35
+KPX W comma -80
+KPX W colon -10
+KPX W a -40
+KPX W O -20
+KPX W A -60
+
+KPX Y u -100
+KPX Y semicolon -50
+KPX Y period -100
+KPX Y o -100
+KPX Y e -80
+KPX Y comma -100
+KPX Y colon -50
+KPX Y a -90
+KPX Y O -70
+KPX Y A -110
+
+KPX a y -20
+KPX a w -15
+KPX a v -15
+KPX a g -10
+
+KPX b y -20
+KPX b v -20
+KPX b u -20
+KPX b l -10
+
+KPX c y -10
+KPX c l -20
+KPX c k -20
+KPX c h -10
+
+KPX colon space -40
+
+KPX comma space -40
+KPX comma quoteright -120
+KPX comma quotedblright -120
+
+KPX d y -15
+KPX d w -15
+KPX d v -15
+KPX d d -10
+
+KPX e y -15
+KPX e x -15
+KPX e w -15
+KPX e v -15
+KPX e period 20
+KPX e comma 10
+
+KPX f quoteright 30
+KPX f quotedblright 30
+KPX f period -10
+KPX f o -20
+KPX f e -10
+KPX f comma -10
+
+KPX g g -10
+KPX g e 10
+
+KPX h y -20
+
+KPX k o -15
+
+KPX l y -15
+KPX l w -15
+
+KPX m y -30
+KPX m u -20
+
+KPX n y -20
+KPX n v -40
+KPX n u -10
+
+KPX o y -20
+KPX o x -30
+KPX o w -15
+KPX o v -20
+
+KPX p y -15
+
+KPX period space -40
+KPX period quoteright -120
+KPX period quotedblright -120
+
+KPX quotedblright space -80
+
+KPX quoteleft quoteleft -46
+
+KPX quoteright v -20
+KPX quoteright space -80
+KPX quoteright s -60
+KPX quoteright r -40
+KPX quoteright quoteright -46
+KPX quoteright l -20
+KPX quoteright d -80
+
+KPX r y 10
+KPX r v 10
+KPX r t 20
+KPX r s -15
+KPX r q -20
+KPX r period -60
+KPX r o -20
+KPX r hyphen -20
+KPX r g -15
+KPX r d -20
+KPX r comma -60
+KPX r c -20
+
+KPX s w -15
+
+KPX semicolon space -40
+
+KPX space quoteleft -60
+KPX space quotedblleft -80
+KPX space Y -120
+KPX space W -80
+KPX space V -80
+KPX space T -100
+
+KPX v period -80
+KPX v o -30
+KPX v comma -80
+KPX v a -20
+
+KPX w period -40
+KPX w o -20
+KPX w comma -40
+
+KPX x e -10
+
+KPX y period -80
+KPX y o -25
+KPX y e -10
+KPX y comma -80
+KPX y a -30
+
+KPX z e 10
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 192 186 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 192 186 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 192 186 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 192 186 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 192 186 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 192 186 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 176 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 169 186 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 169 186 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 169 186 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 169 186 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 10 186 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 10 186 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 10 186 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 10 186 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 192 186 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 215 186 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 215 186 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 215 186 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 215 186 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 215 186 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 169 186 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 192 186 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 192 186 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 192 186 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 192 186 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 169 186 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 169 186 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 146 186 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 92 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 92 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 92 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 92 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 92 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 92 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 108 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 92 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 92 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 92 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 92 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -22 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -22 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -22 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -22 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 114 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 114 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 114 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 114 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 114 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 114 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 92 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 114 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 114 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 114 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 114 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 92 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 92 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 69 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvl8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvl8a.afm
new file mode 100644
index 0000000..b02ffac
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvl8a.afm
@@ -0,0 +1,445 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1988 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date:Mon Jan 11 16:46:06 PST 1988
+FontName Helvetica-Light
+EncodingScheme AdobeStandardEncoding
+FullName Helvetica Light
+FamilyName Helvetica
+Weight Light
+ItalicAngle 0.0
+IsFixedPitch false
+UnderlinePosition -90
+UnderlineThickness 58
+Version 001.002
+Notice Copyright (c) 1985, 1987, 1988 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype Company.
+FontBBox -164 -212 1000 979
+CapHeight 720
+XHeight 518
+Descender -204
+Ascender 720
+StartCharMetrics 228
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 130 0 203 720 ;
+C 34 ; WX 278 ; N quotedbl ; B 57 494 220 720 ;
+C 35 ; WX 556 ; N numbersign ; B 27 0 530 698 ;
+C 36 ; WX 556 ; N dollar ; B 37 -95 518 766 ;
+C 37 ; WX 889 ; N percent ; B 67 -14 821 705 ;
+C 38 ; WX 667 ; N ampersand ; B 41 -19 644 720 ;
+C 39 ; WX 222 ; N quoteright ; B 80 495 153 720 ;
+C 40 ; WX 333 ; N parenleft ; B 55 -191 277 739 ;
+C 41 ; WX 333 ; N parenright ; B 56 -191 278 739 ;
+C 42 ; WX 389 ; N asterisk ; B 44 434 344 720 ;
+C 43 ; WX 660 ; N plus ; B 80 0 580 500 ;
+C 44 ; WX 278 ; N comma ; B 102 -137 175 88 ;
+C 45 ; WX 333 ; N hyphen ; B 40 229 293 291 ;
+C 46 ; WX 278 ; N period ; B 102 0 175 88 ;
+C 47 ; WX 278 ; N slash ; B -3 -90 288 739 ;
+C 48 ; WX 556 ; N zero ; B 39 -14 516 705 ;
+C 49 ; WX 556 ; N one ; B 120 0 366 705 ;
+C 50 ; WX 556 ; N two ; B 48 0 515 705 ;
+C 51 ; WX 556 ; N three ; B 34 -14 512 705 ;
+C 52 ; WX 556 ; N four ; B 36 0 520 698 ;
+C 53 ; WX 556 ; N five ; B 35 -14 506 698 ;
+C 54 ; WX 556 ; N six ; B 41 -14 514 705 ;
+C 55 ; WX 556 ; N seven ; B 59 0 508 698 ;
+C 56 ; WX 556 ; N eight ; B 44 -14 512 705 ;
+C 57 ; WX 556 ; N nine ; B 41 -14 515 705 ;
+C 58 ; WX 278 ; N colon ; B 102 0 175 492 ;
+C 59 ; WX 278 ; N semicolon ; B 102 -137 175 492 ;
+C 60 ; WX 660 ; N less ; B 80 -6 580 505 ;
+C 61 ; WX 660 ; N equal ; B 80 124 580 378 ;
+C 62 ; WX 660 ; N greater ; B 80 -6 580 505 ;
+C 63 ; WX 500 ; N question ; B 37 0 472 739 ;
+C 64 ; WX 800 ; N at ; B 40 -19 760 739 ;
+C 65 ; WX 667 ; N A ; B 15 0 651 720 ;
+C 66 ; WX 667 ; N B ; B 81 0 610 720 ;
+C 67 ; WX 722 ; N C ; B 48 -19 670 739 ;
+C 68 ; WX 722 ; N D ; B 81 0 669 720 ;
+C 69 ; WX 611 ; N E ; B 81 0 570 720 ;
+C 70 ; WX 556 ; N F ; B 74 0 538 720 ;
+C 71 ; WX 778 ; N G ; B 53 -19 695 739 ;
+C 72 ; WX 722 ; N H ; B 80 0 642 720 ;
+C 73 ; WX 278 ; N I ; B 105 0 173 720 ;
+C 74 ; WX 500 ; N J ; B 22 -19 415 720 ;
+C 75 ; WX 667 ; N K ; B 85 0 649 720 ;
+C 76 ; WX 556 ; N L ; B 81 0 535 720 ;
+C 77 ; WX 833 ; N M ; B 78 0 755 720 ;
+C 78 ; WX 722 ; N N ; B 79 0 642 720 ;
+C 79 ; WX 778 ; N O ; B 53 -19 724 739 ;
+C 80 ; WX 611 ; N P ; B 78 0 576 720 ;
+C 81 ; WX 778 ; N Q ; B 48 -52 719 739 ;
+C 82 ; WX 667 ; N R ; B 80 0 612 720 ;
+C 83 ; WX 611 ; N S ; B 43 -19 567 739 ;
+C 84 ; WX 556 ; N T ; B 16 0 540 720 ;
+C 85 ; WX 722 ; N U ; B 82 -19 640 720 ;
+C 86 ; WX 611 ; N V ; B 18 0 593 720 ;
+C 87 ; WX 889 ; N W ; B 14 0 875 720 ;
+C 88 ; WX 611 ; N X ; B 18 0 592 720 ;
+C 89 ; WX 611 ; N Y ; B 12 0 598 720 ;
+C 90 ; WX 611 ; N Z ; B 31 0 579 720 ;
+C 91 ; WX 333 ; N bracketleft ; B 91 -191 282 739 ;
+C 92 ; WX 278 ; N backslash ; B -46 0 324 739 ;
+C 93 ; WX 333 ; N bracketright ; B 51 -191 242 739 ;
+C 94 ; WX 660 ; N asciicircum ; B 73 245 586 698 ;
+C 95 ; WX 500 ; N underscore ; B 0 -119 500 -61 ;
+C 96 ; WX 222 ; N quoteleft ; B 69 495 142 720 ;
+C 97 ; WX 556 ; N a ; B 46 -14 534 532 ;
+C 98 ; WX 611 ; N b ; B 79 -14 555 720 ;
+C 99 ; WX 556 ; N c ; B 47 -14 508 532 ;
+C 100 ; WX 611 ; N d ; B 56 -14 532 720 ;
+C 101 ; WX 556 ; N e ; B 45 -14 511 532 ;
+C 102 ; WX 278 ; N f ; B 20 0 257 734 ; L i fi ; L l fl ;
+C 103 ; WX 611 ; N g ; B 56 -212 532 532 ;
+C 104 ; WX 556 ; N h ; B 72 0 483 720 ;
+C 105 ; WX 222 ; N i ; B 78 0 144 720 ;
+C 106 ; WX 222 ; N j ; B 5 -204 151 720 ;
+C 107 ; WX 500 ; N k ; B 68 0 487 720 ;
+C 108 ; WX 222 ; N l ; B 81 0 141 720 ;
+C 109 ; WX 833 ; N m ; B 64 0 768 532 ;
+C 110 ; WX 556 ; N n ; B 72 0 483 532 ;
+C 111 ; WX 556 ; N o ; B 38 -14 518 532 ;
+C 112 ; WX 611 ; N p ; B 79 -204 555 532 ;
+C 113 ; WX 611 ; N q ; B 56 -204 532 532 ;
+C 114 ; WX 333 ; N r ; B 75 0 306 532 ;
+C 115 ; WX 500 ; N s ; B 46 -14 454 532 ;
+C 116 ; WX 278 ; N t ; B 20 -14 254 662 ;
+C 117 ; WX 556 ; N u ; B 72 -14 483 518 ;
+C 118 ; WX 500 ; N v ; B 17 0 483 518 ;
+C 119 ; WX 722 ; N w ; B 15 0 707 518 ;
+C 120 ; WX 500 ; N x ; B 18 0 481 518 ;
+C 121 ; WX 500 ; N y ; B 18 -204 482 518 ;
+C 122 ; WX 500 ; N z ; B 33 0 467 518 ;
+C 123 ; WX 333 ; N braceleft ; B 45 -191 279 739 ;
+C 124 ; WX 222 ; N bar ; B 81 0 141 739 ;
+C 125 ; WX 333 ; N braceright ; B 51 -187 285 743 ;
+C 126 ; WX 660 ; N asciitilde ; B 80 174 580 339 ;
+C 161 ; WX 333 ; N exclamdown ; B 130 -187 203 532 ;
+C 162 ; WX 556 ; N cent ; B 45 -141 506 647 ;
+C 163 ; WX 556 ; N sterling ; B 25 -14 530 705 ;
+C 164 ; WX 167 ; N fraction ; B -164 -14 331 705 ;
+C 165 ; WX 556 ; N yen ; B 4 0 552 720 ;
+C 166 ; WX 556 ; N florin ; B 13 -196 539 734 ;
+C 167 ; WX 556 ; N section ; B 48 -181 508 739 ;
+C 168 ; WX 556 ; N currency ; B 27 50 529 553 ;
+C 169 ; WX 222 ; N quotesingle ; B 85 494 137 720 ;
+C 170 ; WX 389 ; N quotedblleft ; B 86 495 310 720 ;
+C 171 ; WX 556 ; N guillemotleft ; B 113 117 443 404 ;
+C 172 ; WX 389 ; N guilsinglleft ; B 121 117 267 404 ;
+C 173 ; WX 389 ; N guilsinglright ; B 122 117 268 404 ;
+C 174 ; WX 500 ; N fi ; B 13 0 435 734 ;
+C 175 ; WX 500 ; N fl ; B 13 0 432 734 ;
+C 177 ; WX 500 ; N endash ; B 0 238 500 282 ;
+C 178 ; WX 556 ; N dagger ; B 37 -166 519 720 ;
+C 179 ; WX 556 ; N daggerdbl ; B 37 -166 519 720 ;
+C 180 ; WX 278 ; N periodcentered ; B 90 301 187 398 ;
+C 182 ; WX 650 ; N paragraph ; B 66 -146 506 720 ;
+C 183 ; WX 500 ; N bullet ; B 70 180 430 540 ;
+C 184 ; WX 222 ; N quotesinglbase ; B 80 -137 153 88 ;
+C 185 ; WX 389 ; N quotedblbase ; B 79 -137 303 88 ;
+C 186 ; WX 389 ; N quotedblright ; B 79 495 303 720 ;
+C 187 ; WX 556 ; N guillemotright ; B 113 117 443 404 ;
+C 188 ; WX 1000 ; N ellipsis ; B 131 0 870 88 ;
+C 189 ; WX 1000 ; N perthousand ; B 14 -14 985 705 ;
+C 191 ; WX 500 ; N questiondown ; B 28 -207 463 532 ;
+C 193 ; WX 333 ; N grave ; B 45 574 234 713 ;
+C 194 ; WX 333 ; N acute ; B 109 574 297 713 ;
+C 195 ; WX 333 ; N circumflex ; B 24 574 318 713 ;
+C 196 ; WX 333 ; N tilde ; B 16 586 329 688 ;
+C 197 ; WX 333 ; N macron ; B 23 612 319 657 ;
+C 198 ; WX 333 ; N breve ; B 28 580 316 706 ;
+C 199 ; WX 333 ; N dotaccent ; B 134 584 199 686 ;
+C 200 ; WX 333 ; N dieresis ; B 60 584 284 686 ;
+C 202 ; WX 333 ; N ring ; B 67 578 266 777 ;
+C 203 ; WX 333 ; N cedilla ; B 54 -207 257 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 109 574 459 713 ;
+C 206 ; WX 333 ; N ogonek ; B 74 -190 228 0 ;
+C 207 ; WX 333 ; N caron ; B 24 574 318 713 ;
+C 208 ; WX 1000 ; N emdash ; B 0 238 1000 282 ;
+C 225 ; WX 1000 ; N AE ; B 5 0 960 720 ;
+C 227 ; WX 334 ; N ordfeminine ; B 8 307 325 739 ;
+C 232 ; WX 556 ; N Lslash ; B 0 0 535 720 ;
+C 233 ; WX 778 ; N Oslash ; B 42 -37 736 747 ;
+C 234 ; WX 1000 ; N OE ; B 41 -19 967 739 ;
+C 235 ; WX 334 ; N ordmasculine ; B 11 307 323 739 ;
+C 241 ; WX 889 ; N ae ; B 39 -14 847 532 ;
+C 245 ; WX 222 ; N dotlessi ; B 78 0 138 518 ;
+C 248 ; WX 222 ; N lslash ; B 10 0 212 720 ;
+C 249 ; WX 556 ; N oslash ; B 35 -23 521 541 ;
+C 250 ; WX 944 ; N oe ; B 36 -14 904 532 ;
+C 251 ; WX 500 ; N germandbls ; B 52 -14 459 734 ;
+C -1 ; WX 667 ; N Aacute ; B 15 0 651 915 ;
+C -1 ; WX 667 ; N Acircumflex ; B 15 0 651 915 ;
+C -1 ; WX 667 ; N Adieresis ; B 15 0 651 888 ;
+C -1 ; WX 667 ; N Agrave ; B 15 0 651 915 ;
+C -1 ; WX 667 ; N Aring ; B 15 0 651 979 ;
+C -1 ; WX 667 ; N Atilde ; B 15 0 651 890 ;
+C -1 ; WX 722 ; N Ccedilla ; B 48 -207 670 739 ;
+C -1 ; WX 611 ; N Eacute ; B 81 0 570 915 ;
+C -1 ; WX 611 ; N Ecircumflex ; B 81 0 570 915 ;
+C -1 ; WX 611 ; N Edieresis ; B 81 0 570 888 ;
+C -1 ; WX 611 ; N Egrave ; B 81 0 570 915 ;
+C -1 ; WX 722 ; N Eth ; B 10 0 669 720 ;
+C -1 ; WX 278 ; N Iacute ; B 62 0 250 915 ;
+C -1 ; WX 278 ; N Icircumflex ; B -23 0 271 915 ;
+C -1 ; WX 278 ; N Idieresis ; B 13 0 237 888 ;
+C -1 ; WX 278 ; N Igrave ; B 18 0 207 915 ;
+C -1 ; WX 722 ; N Ntilde ; B 79 0 642 890 ;
+C -1 ; WX 778 ; N Oacute ; B 53 -19 724 915 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 53 -19 724 915 ;
+C -1 ; WX 778 ; N Odieresis ; B 53 -19 724 888 ;
+C -1 ; WX 778 ; N Ograve ; B 53 -19 724 915 ;
+C -1 ; WX 778 ; N Otilde ; B 53 -19 724 890 ;
+C -1 ; WX 611 ; N Scaron ; B 43 -19 567 915 ;
+C -1 ; WX 611 ; N Thorn ; B 78 0 576 720 ;
+C -1 ; WX 722 ; N Uacute ; B 82 -19 640 915 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 82 -19 640 915 ;
+C -1 ; WX 722 ; N Udieresis ; B 82 -19 640 888 ;
+C -1 ; WX 722 ; N Ugrave ; B 82 -19 640 915 ;
+C -1 ; WX 611 ; N Yacute ; B 12 0 598 915 ;
+C -1 ; WX 611 ; N Ydieresis ; B 12 0 598 888 ;
+C -1 ; WX 611 ; N Zcaron ; B 31 0 579 915 ;
+C -1 ; WX 556 ; N aacute ; B 46 -14 534 713 ;
+C -1 ; WX 556 ; N acircumflex ; B 46 -14 534 713 ;
+C -1 ; WX 556 ; N adieresis ; B 46 -14 534 686 ;
+C -1 ; WX 556 ; N agrave ; B 46 -14 534 713 ;
+C -1 ; WX 556 ; N aring ; B 46 -14 534 777 ;
+C -1 ; WX 556 ; N atilde ; B 46 -14 534 688 ;
+C -1 ; WX 222 ; N brokenbar ; B 81 0 141 739 ;
+C -1 ; WX 556 ; N ccedilla ; B 47 -207 508 532 ;
+C -1 ; WX 800 ; N copyright ; B 21 -19 779 739 ;
+C -1 ; WX 400 ; N degree ; B 50 405 350 705 ;
+C -1 ; WX 660 ; N divide ; B 80 0 580 500 ;
+C -1 ; WX 556 ; N eacute ; B 45 -14 511 713 ;
+C -1 ; WX 556 ; N ecircumflex ; B 45 -14 511 713 ;
+C -1 ; WX 556 ; N edieresis ; B 45 -14 511 686 ;
+C -1 ; WX 556 ; N egrave ; B 45 -14 511 713 ;
+C -1 ; WX 556 ; N eth ; B 38 -14 518 739 ;
+C -1 ; WX 222 ; N iacute ; B 34 0 222 713 ;
+C -1 ; WX 222 ; N icircumflex ; B -51 0 243 713 ;
+C -1 ; WX 222 ; N idieresis ; B -15 0 209 686 ;
+C -1 ; WX 222 ; N igrave ; B -10 0 179 713 ;
+C -1 ; WX 660 ; N logicalnot ; B 80 112 580 378 ;
+C -1 ; WX 660 ; N minus ; B 80 220 580 280 ;
+C -1 ; WX 556 ; N mu ; B 72 -204 483 518 ;
+C -1 ; WX 660 ; N multiply ; B 83 6 578 500 ;
+C -1 ; WX 556 ; N ntilde ; B 72 0 483 688 ;
+C -1 ; WX 556 ; N oacute ; B 38 -14 518 713 ;
+C -1 ; WX 556 ; N ocircumflex ; B 38 -14 518 713 ;
+C -1 ; WX 556 ; N odieresis ; B 38 -14 518 686 ;
+C -1 ; WX 556 ; N ograve ; B 38 -14 518 713 ;
+C -1 ; WX 834 ; N onehalf ; B 40 -14 794 739 ;
+C -1 ; WX 834 ; N onequarter ; B 40 -14 794 739 ;
+C -1 ; WX 333 ; N onesuperior ; B 87 316 247 739 ;
+C -1 ; WX 556 ; N otilde ; B 38 -14 518 688 ;
+C -1 ; WX 660 ; N plusminus ; B 80 0 580 500 ;
+C -1 ; WX 800 ; N registered ; B 21 -19 779 739 ;
+C -1 ; WX 500 ; N scaron ; B 46 -14 454 713 ;
+C -1 ; WX 611 ; N thorn ; B 79 -204 555 720 ;
+C -1 ; WX 834 ; N threequarters ; B 40 -14 794 739 ;
+C -1 ; WX 333 ; N threesuperior ; B 11 308 322 739 ;
+C -1 ; WX 940 ; N trademark ; B 29 299 859 720 ;
+C -1 ; WX 333 ; N twosuperior ; B 15 316 318 739 ;
+C -1 ; WX 556 ; N uacute ; B 72 -14 483 713 ;
+C -1 ; WX 556 ; N ucircumflex ; B 72 -14 483 713 ;
+C -1 ; WX 556 ; N udieresis ; B 72 -14 483 686 ;
+C -1 ; WX 556 ; N ugrave ; B 72 -14 483 713 ;
+C -1 ; WX 500 ; N yacute ; B 18 -204 482 713 ;
+C -1 ; WX 500 ; N ydieresis ; B 18 -204 482 686 ;
+C -1 ; WX 500 ; N zcaron ; B 33 0 467 713 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 115
+
+KPX A y -18
+KPX A w -18
+KPX A v -18
+KPX A quoteright -74
+KPX A Y -74
+KPX A W -37
+KPX A V -74
+KPX A T -92
+
+KPX F period -129
+KPX F comma -129
+KPX F A -55
+
+KPX L y -37
+KPX L quoteright -74
+KPX L Y -111
+KPX L W -55
+KPX L V -92
+KPX L T -92
+
+KPX P period -129
+KPX P comma -129
+KPX P A -74
+
+KPX R y 0
+KPX R Y -37
+KPX R W -18
+KPX R V -18
+KPX R T -18
+
+KPX T y -84
+KPX T w -84
+KPX T u -92
+KPX T semicolon -111
+KPX T s -111
+KPX T r -92
+KPX T period -111
+KPX T o -111
+KPX T i 0
+KPX T hyphen -129
+KPX T e -111
+KPX T comma -111
+KPX T colon -111
+KPX T c -111
+KPX T a -111
+KPX T A -92
+
+KPX V y -18
+KPX V u -37
+KPX V semicolon -74
+KPX V r -37
+KPX V period -129
+KPX V o -55
+KPX V i -18
+KPX V hyphen -55
+KPX V e -55
+KPX V comma -129
+KPX V colon -74
+KPX V a -55
+KPX V A -74
+
+KPX W y 0
+KPX W u -18
+KPX W semicolon -18
+KPX W r -18
+KPX W period -74
+KPX W o -18
+KPX W i 0
+KPX W hyphen 0
+KPX W e -18
+KPX W comma -74
+KPX W colon -18
+KPX W a -37
+KPX W A -37
+
+KPX Y v -40
+KPX Y u -37
+KPX Y semicolon -92
+KPX Y q -92
+KPX Y period -111
+KPX Y p -37
+KPX Y o -92
+KPX Y i -20
+KPX Y hyphen -111
+KPX Y e -92
+KPX Y comma -111
+KPX Y colon -92
+KPX Y a -92
+KPX Y A -74
+
+KPX f quoteright 18
+KPX f f -18
+
+KPX quoteleft quoteleft -18
+
+KPX quoteright t -18
+KPX quoteright s -74
+KPX quoteright quoteright -18
+
+KPX r z 0
+KPX r y 18
+KPX r x 0
+KPX r w 0
+KPX r v 0
+KPX r u 0
+KPX r t 18
+KPX r r 0
+KPX r quoteright 0
+KPX r q -18
+KPX r period -92
+KPX r o -18
+KPX r n 18
+KPX r m 18
+KPX r hyphen -55
+KPX r h 0
+KPX r g 0
+KPX r f 18
+KPX r e -18
+KPX r d -18
+KPX r comma -92
+KPX r c -18
+
+KPX v period -74
+KPX v comma -74
+
+KPX w period -55
+KPX w comma -55
+
+KPX y period -92
+KPX y comma -92
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 139 202 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 83 0 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 139 202 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 83 0 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 194 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 111 0 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 139 202 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 83 0 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 139 202 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 83 0 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 194 202 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 194 202 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 194 202 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 194 202 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 111 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 111 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 111 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 111 0 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute -47 202 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -47 202 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -47 202 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave -27 202 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -75 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -75 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -75 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -55 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 139 202 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 139 202 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 139 202 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 139 202 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 111 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 111 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 111 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 111 0 ;
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 167 202 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 167 202 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 167 202 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 167 202 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 111 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 111 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 111 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 111 0 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 222 202 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 222 202 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 222 202 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 222 202 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 111 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 111 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 111 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 111 0 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 167 202 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 111 0 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 194 202 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 111 0 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 222 202 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 111 0 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 187 202 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 111 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvlo8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvlo8a.afm
new file mode 100644
index 0000000..96612d1
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvlo8a.afm
@@ -0,0 +1,445 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1988 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date:Mon Jan 11 17:38:44 PST 1988
+FontName Helvetica-LightOblique
+EncodingScheme AdobeStandardEncoding
+FullName Helvetica Light Oblique
+FamilyName Helvetica
+Weight Light
+ItalicAngle -12.0
+IsFixedPitch false
+UnderlinePosition -90
+UnderlineThickness 58
+Version 001.002
+Notice Copyright (c) 1985, 1987, 1988 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype Company.
+FontBBox -167 -212 1110 979
+CapHeight 720
+XHeight 518
+Descender -204
+Ascender 720
+StartCharMetrics 228
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 130 0 356 720 ;
+C 34 ; WX 278 ; N quotedbl ; B 162 494 373 720 ;
+C 35 ; WX 556 ; N numbersign ; B 75 0 633 698 ;
+C 36 ; WX 556 ; N dollar ; B 75 -95 613 766 ;
+C 37 ; WX 889 ; N percent ; B 176 -14 860 705 ;
+C 38 ; WX 667 ; N ampersand ; B 77 -19 646 720 ;
+C 39 ; WX 222 ; N quoteright ; B 185 495 306 720 ;
+C 40 ; WX 333 ; N parenleft ; B 97 -191 434 739 ;
+C 41 ; WX 333 ; N parenright ; B 15 -191 353 739 ;
+C 42 ; WX 389 ; N asterisk ; B 172 434 472 720 ;
+C 43 ; WX 660 ; N plus ; B 127 0 640 500 ;
+C 44 ; WX 278 ; N comma ; B 73 -137 194 88 ;
+C 45 ; WX 333 ; N hyphen ; B 89 229 355 291 ;
+C 46 ; WX 278 ; N period ; B 102 0 194 88 ;
+C 47 ; WX 278 ; N slash ; B -22 -90 445 739 ;
+C 48 ; WX 556 ; N zero ; B 93 -14 609 705 ;
+C 49 ; WX 556 ; N one ; B 231 0 516 705 ;
+C 50 ; WX 556 ; N two ; B 48 0 628 705 ;
+C 51 ; WX 556 ; N three ; B 74 -14 605 705 ;
+C 52 ; WX 556 ; N four ; B 73 0 570 698 ;
+C 53 ; WX 556 ; N five ; B 71 -14 616 698 ;
+C 54 ; WX 556 ; N six ; B 94 -14 617 705 ;
+C 55 ; WX 556 ; N seven ; B 152 0 656 698 ;
+C 56 ; WX 556 ; N eight ; B 80 -14 601 705 ;
+C 57 ; WX 556 ; N nine ; B 84 -14 607 705 ;
+C 58 ; WX 278 ; N colon ; B 102 0 280 492 ;
+C 59 ; WX 278 ; N semicolon ; B 73 -137 280 492 ;
+C 60 ; WX 660 ; N less ; B 129 -6 687 505 ;
+C 61 ; WX 660 ; N equal ; B 106 124 660 378 ;
+C 62 ; WX 660 ; N greater ; B 79 -6 640 505 ;
+C 63 ; WX 500 ; N question ; B 148 0 594 739 ;
+C 64 ; WX 800 ; N at ; B 108 -19 857 739 ;
+C 65 ; WX 667 ; N A ; B 15 0 651 720 ;
+C 66 ; WX 667 ; N B ; B 81 0 697 720 ;
+C 67 ; WX 722 ; N C ; B 111 -19 771 739 ;
+C 68 ; WX 722 ; N D ; B 81 0 758 720 ;
+C 69 ; WX 611 ; N E ; B 81 0 713 720 ;
+C 70 ; WX 556 ; N F ; B 74 0 691 720 ;
+C 71 ; WX 778 ; N G ; B 116 -19 796 739 ;
+C 72 ; WX 722 ; N H ; B 80 0 795 720 ;
+C 73 ; WX 278 ; N I ; B 105 0 326 720 ;
+C 74 ; WX 500 ; N J ; B 58 -19 568 720 ;
+C 75 ; WX 667 ; N K ; B 85 0 752 720 ;
+C 76 ; WX 556 ; N L ; B 81 0 547 720 ;
+C 77 ; WX 833 ; N M ; B 78 0 908 720 ;
+C 78 ; WX 722 ; N N ; B 79 0 795 720 ;
+C 79 ; WX 778 ; N O ; B 117 -19 812 739 ;
+C 80 ; WX 611 ; N P ; B 78 0 693 720 ;
+C 81 ; WX 778 ; N Q ; B 112 -52 808 739 ;
+C 82 ; WX 667 ; N R ; B 80 0 726 720 ;
+C 83 ; WX 611 ; N S ; B 82 -19 663 739 ;
+C 84 ; WX 556 ; N T ; B 157 0 693 720 ;
+C 85 ; WX 722 ; N U ; B 129 -19 793 720 ;
+C 86 ; WX 611 ; N V ; B 171 0 746 720 ;
+C 87 ; WX 889 ; N W ; B 167 0 1028 720 ;
+C 88 ; WX 611 ; N X ; B 18 0 734 720 ;
+C 89 ; WX 611 ; N Y ; B 165 0 751 720 ;
+C 90 ; WX 611 ; N Z ; B 31 0 729 720 ;
+C 91 ; WX 333 ; N bracketleft ; B 50 -191 439 739 ;
+C 92 ; WX 278 ; N backslash ; B 111 0 324 739 ;
+C 93 ; WX 333 ; N bracketright ; B 10 -191 399 739 ;
+C 94 ; WX 660 ; N asciicircum ; B 125 245 638 698 ;
+C 95 ; WX 500 ; N underscore ; B -25 -119 487 -61 ;
+C 96 ; WX 222 ; N quoteleft ; B 174 495 295 720 ;
+C 97 ; WX 556 ; N a ; B 71 -14 555 532 ;
+C 98 ; WX 611 ; N b ; B 79 -14 619 720 ;
+C 99 ; WX 556 ; N c ; B 92 -14 576 532 ;
+C 100 ; WX 611 ; N d ; B 101 -14 685 720 ;
+C 101 ; WX 556 ; N e ; B 90 -14 575 532 ;
+C 102 ; WX 278 ; N f ; B 97 0 412 734 ; L i fi ; L l fl ;
+C 103 ; WX 611 ; N g ; B 56 -212 642 532 ;
+C 104 ; WX 556 ; N h ; B 72 0 565 720 ;
+C 105 ; WX 222 ; N i ; B 81 0 297 720 ;
+C 106 ; WX 222 ; N j ; B -38 -204 304 720 ;
+C 107 ; WX 500 ; N k ; B 68 0 574 720 ;
+C 108 ; WX 222 ; N l ; B 81 0 294 720 ;
+C 109 ; WX 833 ; N m ; B 64 0 848 532 ;
+C 110 ; WX 556 ; N n ; B 72 0 565 532 ;
+C 111 ; WX 556 ; N o ; B 84 -14 582 532 ;
+C 112 ; WX 611 ; N p ; B 36 -204 620 532 ;
+C 113 ; WX 611 ; N q ; B 102 -204 642 532 ;
+C 114 ; WX 333 ; N r ; B 75 0 419 532 ;
+C 115 ; WX 500 ; N s ; B 78 -14 519 532 ;
+C 116 ; WX 278 ; N t ; B 108 -14 360 662 ;
+C 117 ; WX 556 ; N u ; B 103 -14 593 518 ;
+C 118 ; WX 500 ; N v ; B 127 0 593 518 ;
+C 119 ; WX 722 ; N w ; B 125 0 817 518 ;
+C 120 ; WX 500 ; N x ; B 18 0 584 518 ;
+C 121 ; WX 500 ; N y ; B 26 -204 592 518 ;
+C 122 ; WX 500 ; N z ; B 33 0 564 518 ;
+C 123 ; WX 333 ; N braceleft ; B 103 -191 436 739 ;
+C 124 ; WX 222 ; N bar ; B 81 0 298 739 ;
+C 125 ; WX 333 ; N braceright ; B 12 -187 344 743 ;
+C 126 ; WX 660 ; N asciitilde ; B 127 174 645 339 ;
+C 161 ; WX 333 ; N exclamdown ; B 90 -187 316 532 ;
+C 162 ; WX 556 ; N cent ; B 90 -141 574 647 ;
+C 163 ; WX 556 ; N sterling ; B 51 -14 613 705 ;
+C 164 ; WX 167 ; N fraction ; B -167 -14 481 705 ;
+C 165 ; WX 556 ; N yen ; B 110 0 705 720 ;
+C 166 ; WX 556 ; N florin ; B -26 -196 691 734 ;
+C 167 ; WX 556 ; N section ; B 91 -181 581 739 ;
+C 168 ; WX 556 ; N currency ; B 55 50 629 553 ;
+C 169 ; WX 222 ; N quotesingle ; B 190 494 290 720 ;
+C 170 ; WX 389 ; N quotedblleft ; B 191 495 463 720 ;
+C 171 ; WX 556 ; N guillemotleft ; B 161 117 529 404 ;
+C 172 ; WX 389 ; N guilsinglleft ; B 169 117 353 404 ;
+C 173 ; WX 389 ; N guilsinglright ; B 147 117 330 404 ;
+C 174 ; WX 500 ; N fi ; B 92 0 588 734 ;
+C 175 ; WX 500 ; N fl ; B 92 0 585 734 ;
+C 177 ; WX 500 ; N endash ; B 51 238 560 282 ;
+C 178 ; WX 556 ; N dagger ; B 130 -166 623 720 ;
+C 179 ; WX 556 ; N daggerdbl ; B 49 -166 625 720 ;
+C 180 ; WX 278 ; N periodcentered ; B 163 301 262 398 ;
+C 182 ; WX 650 ; N paragraph ; B 174 -146 659 720 ;
+C 183 ; WX 500 ; N bullet ; B 142 180 510 540 ;
+C 184 ; WX 222 ; N quotesinglbase ; B 51 -137 172 88 ;
+C 185 ; WX 389 ; N quotedblbase ; B 50 -137 322 88 ;
+C 186 ; WX 389 ; N quotedblright ; B 184 495 456 720 ;
+C 187 ; WX 556 ; N guillemotright ; B 138 117 505 404 ;
+C 188 ; WX 1000 ; N ellipsis ; B 131 0 889 88 ;
+C 189 ; WX 1000 ; N perthousand ; B 83 -14 1020 705 ;
+C 191 ; WX 500 ; N questiondown ; B 19 -207 465 532 ;
+C 193 ; WX 333 ; N grave ; B 197 574 356 713 ;
+C 194 ; WX 333 ; N acute ; B 231 574 449 713 ;
+C 195 ; WX 333 ; N circumflex ; B 146 574 440 713 ;
+C 196 ; WX 333 ; N tilde ; B 141 586 475 688 ;
+C 197 ; WX 333 ; N macron ; B 153 612 459 657 ;
+C 198 ; WX 333 ; N breve ; B 177 580 466 706 ;
+C 199 ; WX 333 ; N dotaccent ; B 258 584 345 686 ;
+C 200 ; WX 333 ; N dieresis ; B 184 584 430 686 ;
+C 202 ; WX 333 ; N ring ; B 209 578 412 777 ;
+C 203 ; WX 333 ; N cedilla ; B 14 -207 233 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 231 574 611 713 ;
+C 206 ; WX 333 ; N ogonek ; B 50 -190 199 0 ;
+C 207 ; WX 333 ; N caron ; B 176 574 470 713 ;
+C 208 ; WX 1000 ; N emdash ; B 51 238 1060 282 ;
+C 225 ; WX 1000 ; N AE ; B 5 0 1101 720 ;
+C 227 ; WX 334 ; N ordfeminine ; B 73 307 423 739 ;
+C 232 ; WX 556 ; N Lslash ; B 68 0 547 720 ;
+C 233 ; WX 778 ; N Oslash ; B 41 -37 887 747 ;
+C 234 ; WX 1000 ; N OE ; B 104 -19 1110 739 ;
+C 235 ; WX 334 ; N ordmasculine ; B 76 307 450 739 ;
+C 241 ; WX 889 ; N ae ; B 63 -14 913 532 ;
+C 245 ; WX 222 ; N dotlessi ; B 78 0 248 518 ;
+C 248 ; WX 222 ; N lslash ; B 74 0 316 720 ;
+C 249 ; WX 556 ; N oslash ; B 36 -23 629 541 ;
+C 250 ; WX 944 ; N oe ; B 82 -14 970 532 ;
+C 251 ; WX 500 ; N germandbls ; B 52 -14 554 734 ;
+C -1 ; WX 667 ; N Aacute ; B 15 0 659 915 ;
+C -1 ; WX 667 ; N Acircumflex ; B 15 0 651 915 ;
+C -1 ; WX 667 ; N Adieresis ; B 15 0 651 888 ;
+C -1 ; WX 667 ; N Agrave ; B 15 0 651 915 ;
+C -1 ; WX 667 ; N Aring ; B 15 0 651 979 ;
+C -1 ; WX 667 ; N Atilde ; B 15 0 685 890 ;
+C -1 ; WX 722 ; N Ccedilla ; B 111 -207 771 739 ;
+C -1 ; WX 611 ; N Eacute ; B 81 0 713 915 ;
+C -1 ; WX 611 ; N Ecircumflex ; B 81 0 713 915 ;
+C -1 ; WX 611 ; N Edieresis ; B 81 0 713 888 ;
+C -1 ; WX 611 ; N Egrave ; B 81 0 713 915 ;
+C -1 ; WX 722 ; N Eth ; B 81 0 758 720 ;
+C -1 ; WX 278 ; N Iacute ; B 105 0 445 915 ;
+C -1 ; WX 278 ; N Icircumflex ; B 105 0 436 915 ;
+C -1 ; WX 278 ; N Idieresis ; B 105 0 426 888 ;
+C -1 ; WX 278 ; N Igrave ; B 105 0 372 915 ;
+C -1 ; WX 722 ; N Ntilde ; B 79 0 795 890 ;
+C -1 ; WX 778 ; N Oacute ; B 117 -19 812 915 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 117 -19 812 915 ;
+C -1 ; WX 778 ; N Odieresis ; B 117 -19 812 888 ;
+C -1 ; WX 778 ; N Ograve ; B 117 -19 812 915 ;
+C -1 ; WX 778 ; N Otilde ; B 117 -19 812 890 ;
+C -1 ; WX 611 ; N Scaron ; B 82 -19 663 915 ;
+C -1 ; WX 611 ; N Thorn ; B 78 0 661 720 ;
+C -1 ; WX 722 ; N Uacute ; B 129 -19 793 915 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 129 -19 793 915 ;
+C -1 ; WX 722 ; N Udieresis ; B 129 -19 793 888 ;
+C -1 ; WX 722 ; N Ugrave ; B 129 -19 793 915 ;
+C -1 ; WX 611 ; N Yacute ; B 165 0 751 915 ;
+C -1 ; WX 611 ; N Ydieresis ; B 165 0 751 888 ;
+C -1 ; WX 611 ; N Zcaron ; B 31 0 729 915 ;
+C -1 ; WX 556 ; N aacute ; B 71 -14 561 713 ;
+C -1 ; WX 556 ; N acircumflex ; B 71 -14 555 713 ;
+C -1 ; WX 556 ; N adieresis ; B 71 -14 555 686 ;
+C -1 ; WX 556 ; N agrave ; B 71 -14 555 713 ;
+C -1 ; WX 556 ; N aring ; B 71 -14 555 777 ;
+C -1 ; WX 556 ; N atilde ; B 71 -14 587 688 ;
+C -1 ; WX 222 ; N brokenbar ; B 81 0 298 739 ;
+C -1 ; WX 556 ; N ccedilla ; B 92 -207 576 532 ;
+C -1 ; WX 800 ; N copyright ; B 89 -19 864 739 ;
+C -1 ; WX 400 ; N degree ; B 165 405 471 705 ;
+C -1 ; WX 660 ; N divide ; B 127 0 640 500 ;
+C -1 ; WX 556 ; N eacute ; B 90 -14 575 713 ;
+C -1 ; WX 556 ; N ecircumflex ; B 90 -14 575 713 ;
+C -1 ; WX 556 ; N edieresis ; B 90 -14 575 686 ;
+C -1 ; WX 556 ; N egrave ; B 90 -14 575 713 ;
+C -1 ; WX 556 ; N eth ; B 84 -14 582 739 ;
+C -1 ; WX 222 ; N iacute ; B 78 0 374 713 ;
+C -1 ; WX 222 ; N icircumflex ; B 71 0 365 713 ;
+C -1 ; WX 222 ; N idieresis ; B 78 0 355 686 ;
+C -1 ; WX 222 ; N igrave ; B 78 0 301 713 ;
+C -1 ; WX 660 ; N logicalnot ; B 148 112 660 378 ;
+C -1 ; WX 660 ; N minus ; B 127 220 640 280 ;
+C -1 ; WX 556 ; N mu ; B 29 -204 593 518 ;
+C -1 ; WX 660 ; N multiply ; B 92 6 677 500 ;
+C -1 ; WX 556 ; N ntilde ; B 72 0 587 688 ;
+C -1 ; WX 556 ; N oacute ; B 84 -14 582 713 ;
+C -1 ; WX 556 ; N ocircumflex ; B 84 -14 582 713 ;
+C -1 ; WX 556 ; N odieresis ; B 84 -14 582 686 ;
+C -1 ; WX 556 ; N ograve ; B 84 -14 582 713 ;
+C -1 ; WX 834 ; N onehalf ; B 125 -14 862 739 ;
+C -1 ; WX 834 ; N onequarter ; B 165 -14 823 739 ;
+C -1 ; WX 333 ; N onesuperior ; B 221 316 404 739 ;
+C -1 ; WX 556 ; N otilde ; B 84 -14 587 688 ;
+C -1 ; WX 660 ; N plusminus ; B 80 0 650 500 ;
+C -1 ; WX 800 ; N registered ; B 89 -19 864 739 ;
+C -1 ; WX 500 ; N scaron ; B 78 -14 554 713 ;
+C -1 ; WX 611 ; N thorn ; B 36 -204 620 720 ;
+C -1 ; WX 834 ; N threequarters ; B 131 -14 853 739 ;
+C -1 ; WX 333 ; N threesuperior ; B 102 308 444 739 ;
+C -1 ; WX 940 ; N trademark ; B 174 299 1012 720 ;
+C -1 ; WX 333 ; N twosuperior ; B 82 316 453 739 ;
+C -1 ; WX 556 ; N uacute ; B 103 -14 593 713 ;
+C -1 ; WX 556 ; N ucircumflex ; B 103 -14 593 713 ;
+C -1 ; WX 556 ; N udieresis ; B 103 -14 593 686 ;
+C -1 ; WX 556 ; N ugrave ; B 103 -14 593 713 ;
+C -1 ; WX 500 ; N yacute ; B 26 -204 592 713 ;
+C -1 ; WX 500 ; N ydieresis ; B 26 -204 592 686 ;
+C -1 ; WX 500 ; N zcaron ; B 33 0 564 713 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 115
+
+KPX A y -18
+KPX A w -18
+KPX A v -18
+KPX A quoteright -74
+KPX A Y -74
+KPX A W -37
+KPX A V -74
+KPX A T -92
+
+KPX F period -129
+KPX F comma -129
+KPX F A -55
+
+KPX L y -37
+KPX L quoteright -74
+KPX L Y -111
+KPX L W -55
+KPX L V -92
+KPX L T -92
+
+KPX P period -129
+KPX P comma -129
+KPX P A -74
+
+KPX R y 0
+KPX R Y -37
+KPX R W -18
+KPX R V -18
+KPX R T -18
+
+KPX T y -84
+KPX T w -84
+KPX T u -92
+KPX T semicolon -111
+KPX T s -111
+KPX T r -92
+KPX T period -111
+KPX T o -111
+KPX T i 0
+KPX T hyphen -129
+KPX T e -111
+KPX T comma -111
+KPX T colon -111
+KPX T c -111
+KPX T a -111
+KPX T A -92
+
+KPX V y -18
+KPX V u -37
+KPX V semicolon -74
+KPX V r -37
+KPX V period -129
+KPX V o -55
+KPX V i -18
+KPX V hyphen -55
+KPX V e -55
+KPX V comma -129
+KPX V colon -74
+KPX V a -55
+KPX V A -74
+
+KPX W y 0
+KPX W u -18
+KPX W semicolon -18
+KPX W r -18
+KPX W period -74
+KPX W o -18
+KPX W i 0
+KPX W hyphen 0
+KPX W e -18
+KPX W comma -74
+KPX W colon -18
+KPX W a -37
+KPX W A -37
+
+KPX Y v -40
+KPX Y u -37
+KPX Y semicolon -92
+KPX Y q -92
+KPX Y period -111
+KPX Y p -37
+KPX Y o -92
+KPX Y i -20
+KPX Y hyphen -111
+KPX Y e -92
+KPX Y comma -111
+KPX Y colon -92
+KPX Y a -92
+KPX Y A -74
+
+KPX f quoteright 18
+KPX f f -18
+
+KPX quoteleft quoteleft -18
+
+KPX quoteright t -18
+KPX quoteright s -74
+KPX quoteright quoteright -18
+
+KPX r z 0
+KPX r y 18
+KPX r x 0
+KPX r w 0
+KPX r v 0
+KPX r u 0
+KPX r t 18
+KPX r r 0
+KPX r quoteright 0
+KPX r q -18
+KPX r period -92
+KPX r o -18
+KPX r n 18
+KPX r m 18
+KPX r hyphen -55
+KPX r h 0
+KPX r g 0
+KPX r f 18
+KPX r e -18
+KPX r d -18
+KPX r comma -92
+KPX r c -18
+
+KPX v period -74
+KPX v comma -74
+
+KPX w period -55
+KPX w comma -55
+
+KPX y period -92
+KPX y comma -92
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 139 202 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 83 0 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 139 202 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 83 0 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 194 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 111 0 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 139 202 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 83 0 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 139 202 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 83 0 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 194 202 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 194 202 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 194 202 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 194 202 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 111 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 111 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 111 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 111 0 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute -47 202 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -47 202 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -47 202 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave -27 202 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -75 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -75 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -75 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -55 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 139 202 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 139 202 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 139 202 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 139 202 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 111 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 111 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 111 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 111 0 ;
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 167 202 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 167 202 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 167 202 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 167 202 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 111 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 111 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 111 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 111 0 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 222 202 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 222 202 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 222 202 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 222 202 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 111 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 111 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 111 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 111 0 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 167 202 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 111 0 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 194 202 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 111 0 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 222 202 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 111 0 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 187 202 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 111 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvr8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvr8a.afm
new file mode 100644
index 0000000..1eb3b44
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvr8a.afm
@@ -0,0 +1,612 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights reserved.
+Comment Creation Date: Thu Mar 15 08:58:00 1990
+Comment UniqueID 28352
+Comment VMusage 26389 33281
+FontName Helvetica
+FullName Helvetica
+FamilyName Helvetica
+Weight Medium
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -166 -225 1000 931
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.006
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights reserved.Helvetica is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 718
+XHeight 523
+Ascender 718
+Descender -207
+StartCharMetrics 228
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 278 ; N exclam ; B 90 0 187 718 ;
+C 34 ; WX 355 ; N quotedbl ; B 70 463 285 718 ;
+C 35 ; WX 556 ; N numbersign ; B 28 0 529 688 ;
+C 36 ; WX 556 ; N dollar ; B 32 -115 520 775 ;
+C 37 ; WX 889 ; N percent ; B 39 -19 850 703 ;
+C 38 ; WX 667 ; N ampersand ; B 44 -15 645 718 ;
+C 39 ; WX 222 ; N quoteright ; B 53 463 157 718 ;
+C 40 ; WX 333 ; N parenleft ; B 68 -207 299 733 ;
+C 41 ; WX 333 ; N parenright ; B 34 -207 265 733 ;
+C 42 ; WX 389 ; N asterisk ; B 39 431 349 718 ;
+C 43 ; WX 584 ; N plus ; B 39 0 545 505 ;
+C 44 ; WX 278 ; N comma ; B 87 -147 191 106 ;
+C 45 ; WX 333 ; N hyphen ; B 44 232 289 322 ;
+C 46 ; WX 278 ; N period ; B 87 0 191 106 ;
+C 47 ; WX 278 ; N slash ; B -17 -19 295 737 ;
+C 48 ; WX 556 ; N zero ; B 37 -19 519 703 ;
+C 49 ; WX 556 ; N one ; B 101 0 359 703 ;
+C 50 ; WX 556 ; N two ; B 26 0 507 703 ;
+C 51 ; WX 556 ; N three ; B 34 -19 522 703 ;
+C 52 ; WX 556 ; N four ; B 25 0 523 703 ;
+C 53 ; WX 556 ; N five ; B 32 -19 514 688 ;
+C 54 ; WX 556 ; N six ; B 38 -19 518 703 ;
+C 55 ; WX 556 ; N seven ; B 37 0 523 688 ;
+C 56 ; WX 556 ; N eight ; B 38 -19 517 703 ;
+C 57 ; WX 556 ; N nine ; B 42 -19 514 703 ;
+C 58 ; WX 278 ; N colon ; B 87 0 191 516 ;
+C 59 ; WX 278 ; N semicolon ; B 87 -147 191 516 ;
+C 60 ; WX 584 ; N less ; B 48 11 536 495 ;
+C 61 ; WX 584 ; N equal ; B 39 115 545 390 ;
+C 62 ; WX 584 ; N greater ; B 48 11 536 495 ;
+C 63 ; WX 556 ; N question ; B 56 0 492 727 ;
+C 64 ; WX 1015 ; N at ; B 147 -19 868 737 ;
+C 65 ; WX 667 ; N A ; B 14 0 654 718 ;
+C 66 ; WX 667 ; N B ; B 74 0 627 718 ;
+C 67 ; WX 722 ; N C ; B 44 -19 681 737 ;
+C 68 ; WX 722 ; N D ; B 81 0 674 718 ;
+C 69 ; WX 667 ; N E ; B 86 0 616 718 ;
+C 70 ; WX 611 ; N F ; B 86 0 583 718 ;
+C 71 ; WX 778 ; N G ; B 48 -19 704 737 ;
+C 72 ; WX 722 ; N H ; B 77 0 646 718 ;
+C 73 ; WX 278 ; N I ; B 91 0 188 718 ;
+C 74 ; WX 500 ; N J ; B 17 -19 428 718 ;
+C 75 ; WX 667 ; N K ; B 76 0 663 718 ;
+C 76 ; WX 556 ; N L ; B 76 0 537 718 ;
+C 77 ; WX 833 ; N M ; B 73 0 761 718 ;
+C 78 ; WX 722 ; N N ; B 76 0 646 718 ;
+C 79 ; WX 778 ; N O ; B 39 -19 739 737 ;
+C 80 ; WX 667 ; N P ; B 86 0 622 718 ;
+C 81 ; WX 778 ; N Q ; B 39 -56 739 737 ;
+C 82 ; WX 722 ; N R ; B 88 0 684 718 ;
+C 83 ; WX 667 ; N S ; B 49 -19 620 737 ;
+C 84 ; WX 611 ; N T ; B 14 0 597 718 ;
+C 85 ; WX 722 ; N U ; B 79 -19 644 718 ;
+C 86 ; WX 667 ; N V ; B 20 0 647 718 ;
+C 87 ; WX 944 ; N W ; B 16 0 928 718 ;
+C 88 ; WX 667 ; N X ; B 19 0 648 718 ;
+C 89 ; WX 667 ; N Y ; B 14 0 653 718 ;
+C 90 ; WX 611 ; N Z ; B 23 0 588 718 ;
+C 91 ; WX 278 ; N bracketleft ; B 63 -196 250 722 ;
+C 92 ; WX 278 ; N backslash ; B -17 -19 295 737 ;
+C 93 ; WX 278 ; N bracketright ; B 28 -196 215 722 ;
+C 94 ; WX 469 ; N asciicircum ; B -14 264 483 688 ;
+C 95 ; WX 556 ; N underscore ; B 0 -125 556 -75 ;
+C 96 ; WX 222 ; N quoteleft ; B 65 470 169 725 ;
+C 97 ; WX 556 ; N a ; B 36 -15 530 538 ;
+C 98 ; WX 556 ; N b ; B 58 -15 517 718 ;
+C 99 ; WX 500 ; N c ; B 30 -15 477 538 ;
+C 100 ; WX 556 ; N d ; B 35 -15 499 718 ;
+C 101 ; WX 556 ; N e ; B 40 -15 516 538 ;
+C 102 ; WX 278 ; N f ; B 14 0 262 728 ; L i fi ; L l fl ;
+C 103 ; WX 556 ; N g ; B 40 -220 499 538 ;
+C 104 ; WX 556 ; N h ; B 65 0 491 718 ;
+C 105 ; WX 222 ; N i ; B 67 0 155 718 ;
+C 106 ; WX 222 ; N j ; B -16 -210 155 718 ;
+C 107 ; WX 500 ; N k ; B 67 0 501 718 ;
+C 108 ; WX 222 ; N l ; B 67 0 155 718 ;
+C 109 ; WX 833 ; N m ; B 65 0 769 538 ;
+C 110 ; WX 556 ; N n ; B 65 0 491 538 ;
+C 111 ; WX 556 ; N o ; B 35 -14 521 538 ;
+C 112 ; WX 556 ; N p ; B 58 -207 517 538 ;
+C 113 ; WX 556 ; N q ; B 35 -207 494 538 ;
+C 114 ; WX 333 ; N r ; B 77 0 332 538 ;
+C 115 ; WX 500 ; N s ; B 32 -15 464 538 ;
+C 116 ; WX 278 ; N t ; B 14 -7 257 669 ;
+C 117 ; WX 556 ; N u ; B 68 -15 489 523 ;
+C 118 ; WX 500 ; N v ; B 8 0 492 523 ;
+C 119 ; WX 722 ; N w ; B 14 0 709 523 ;
+C 120 ; WX 500 ; N x ; B 11 0 490 523 ;
+C 121 ; WX 500 ; N y ; B 11 -214 489 523 ;
+C 122 ; WX 500 ; N z ; B 31 0 469 523 ;
+C 123 ; WX 334 ; N braceleft ; B 42 -196 292 722 ;
+C 124 ; WX 260 ; N bar ; B 94 -19 167 737 ;
+C 125 ; WX 334 ; N braceright ; B 42 -196 292 722 ;
+C 126 ; WX 584 ; N asciitilde ; B 61 180 523 326 ;
+C 161 ; WX 333 ; N exclamdown ; B 118 -195 215 523 ;
+C 162 ; WX 556 ; N cent ; B 51 -115 513 623 ;
+C 163 ; WX 556 ; N sterling ; B 33 -16 539 718 ;
+C 164 ; WX 167 ; N fraction ; B -166 -19 333 703 ;
+C 165 ; WX 556 ; N yen ; B 3 0 553 688 ;
+C 166 ; WX 556 ; N florin ; B -11 -207 501 737 ;
+C 167 ; WX 556 ; N section ; B 43 -191 512 737 ;
+C 168 ; WX 556 ; N currency ; B 28 99 528 603 ;
+C 169 ; WX 191 ; N quotesingle ; B 59 463 132 718 ;
+C 170 ; WX 333 ; N quotedblleft ; B 38 470 307 725 ;
+C 171 ; WX 556 ; N guillemotleft ; B 97 108 459 446 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 88 108 245 446 ;
+C 173 ; WX 333 ; N guilsinglright ; B 88 108 245 446 ;
+C 174 ; WX 500 ; N fi ; B 14 0 434 728 ;
+C 175 ; WX 500 ; N fl ; B 14 0 432 728 ;
+C 177 ; WX 556 ; N endash ; B 0 240 556 313 ;
+C 178 ; WX 556 ; N dagger ; B 43 -159 514 718 ;
+C 179 ; WX 556 ; N daggerdbl ; B 43 -159 514 718 ;
+C 180 ; WX 278 ; N periodcentered ; B 77 190 202 315 ;
+C 182 ; WX 537 ; N paragraph ; B 18 -173 497 718 ;
+C 183 ; WX 350 ; N bullet ; B 18 202 333 517 ;
+C 184 ; WX 222 ; N quotesinglbase ; B 53 -149 157 106 ;
+C 185 ; WX 333 ; N quotedblbase ; B 26 -149 295 106 ;
+C 186 ; WX 333 ; N quotedblright ; B 26 463 295 718 ;
+C 187 ; WX 556 ; N guillemotright ; B 97 108 459 446 ;
+C 188 ; WX 1000 ; N ellipsis ; B 115 0 885 106 ;
+C 189 ; WX 1000 ; N perthousand ; B 7 -19 994 703 ;
+C 191 ; WX 611 ; N questiondown ; B 91 -201 527 525 ;
+C 193 ; WX 333 ; N grave ; B 14 593 211 734 ;
+C 194 ; WX 333 ; N acute ; B 122 593 319 734 ;
+C 195 ; WX 333 ; N circumflex ; B 21 593 312 734 ;
+C 196 ; WX 333 ; N tilde ; B -4 606 337 722 ;
+C 197 ; WX 333 ; N macron ; B 10 627 323 684 ;
+C 198 ; WX 333 ; N breve ; B 13 595 321 731 ;
+C 199 ; WX 333 ; N dotaccent ; B 121 604 212 706 ;
+C 200 ; WX 333 ; N dieresis ; B 40 604 293 706 ;
+C 202 ; WX 333 ; N ring ; B 75 572 259 756 ;
+C 203 ; WX 333 ; N cedilla ; B 45 -225 259 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 31 593 409 734 ;
+C 206 ; WX 333 ; N ogonek ; B 73 -225 287 0 ;
+C 207 ; WX 333 ; N caron ; B 21 593 312 734 ;
+C 208 ; WX 1000 ; N emdash ; B 0 240 1000 313 ;
+C 225 ; WX 1000 ; N AE ; B 8 0 951 718 ;
+C 227 ; WX 370 ; N ordfeminine ; B 24 304 346 737 ;
+C 232 ; WX 556 ; N Lslash ; B -20 0 537 718 ;
+C 233 ; WX 778 ; N Oslash ; B 39 -19 740 737 ;
+C 234 ; WX 1000 ; N OE ; B 36 -19 965 737 ;
+C 235 ; WX 365 ; N ordmasculine ; B 25 304 341 737 ;
+C 241 ; WX 889 ; N ae ; B 36 -15 847 538 ;
+C 245 ; WX 278 ; N dotlessi ; B 95 0 183 523 ;
+C 248 ; WX 222 ; N lslash ; B -20 0 242 718 ;
+C 249 ; WX 611 ; N oslash ; B 28 -22 537 545 ;
+C 250 ; WX 944 ; N oe ; B 35 -15 902 538 ;
+C 251 ; WX 611 ; N germandbls ; B 67 -15 571 728 ;
+C -1 ; WX 611 ; N Zcaron ; B 23 0 588 929 ;
+C -1 ; WX 500 ; N ccedilla ; B 30 -225 477 538 ;
+C -1 ; WX 500 ; N ydieresis ; B 11 -214 489 706 ;
+C -1 ; WX 556 ; N atilde ; B 36 -15 530 722 ;
+C -1 ; WX 278 ; N icircumflex ; B -6 0 285 734 ;
+C -1 ; WX 333 ; N threesuperior ; B 5 270 325 703 ;
+C -1 ; WX 556 ; N ecircumflex ; B 40 -15 516 734 ;
+C -1 ; WX 556 ; N thorn ; B 58 -207 517 718 ;
+C -1 ; WX 556 ; N egrave ; B 40 -15 516 734 ;
+C -1 ; WX 333 ; N twosuperior ; B 4 281 323 703 ;
+C -1 ; WX 556 ; N eacute ; B 40 -15 516 734 ;
+C -1 ; WX 556 ; N otilde ; B 35 -14 521 722 ;
+C -1 ; WX 667 ; N Aacute ; B 14 0 654 929 ;
+C -1 ; WX 556 ; N ocircumflex ; B 35 -14 521 734 ;
+C -1 ; WX 500 ; N yacute ; B 11 -214 489 734 ;
+C -1 ; WX 556 ; N udieresis ; B 68 -15 489 706 ;
+C -1 ; WX 834 ; N threequarters ; B 45 -19 810 703 ;
+C -1 ; WX 556 ; N acircumflex ; B 36 -15 530 734 ;
+C -1 ; WX 722 ; N Eth ; B 0 0 674 718 ;
+C -1 ; WX 556 ; N edieresis ; B 40 -15 516 706 ;
+C -1 ; WX 556 ; N ugrave ; B 68 -15 489 734 ;
+C -1 ; WX 1000 ; N trademark ; B 46 306 903 718 ;
+C -1 ; WX 556 ; N ograve ; B 35 -14 521 734 ;
+C -1 ; WX 500 ; N scaron ; B 32 -15 464 734 ;
+C -1 ; WX 278 ; N Idieresis ; B 13 0 266 901 ;
+C -1 ; WX 556 ; N uacute ; B 68 -15 489 734 ;
+C -1 ; WX 556 ; N agrave ; B 36 -15 530 734 ;
+C -1 ; WX 556 ; N ntilde ; B 65 0 491 722 ;
+C -1 ; WX 556 ; N aring ; B 36 -15 530 756 ;
+C -1 ; WX 500 ; N zcaron ; B 31 0 469 734 ;
+C -1 ; WX 278 ; N Icircumflex ; B -6 0 285 929 ;
+C -1 ; WX 722 ; N Ntilde ; B 76 0 646 917 ;
+C -1 ; WX 556 ; N ucircumflex ; B 68 -15 489 734 ;
+C -1 ; WX 667 ; N Ecircumflex ; B 86 0 616 929 ;
+C -1 ; WX 278 ; N Iacute ; B 91 0 292 929 ;
+C -1 ; WX 722 ; N Ccedilla ; B 44 -225 681 737 ;
+C -1 ; WX 778 ; N Odieresis ; B 39 -19 739 901 ;
+C -1 ; WX 667 ; N Scaron ; B 49 -19 620 929 ;
+C -1 ; WX 667 ; N Edieresis ; B 86 0 616 901 ;
+C -1 ; WX 278 ; N Igrave ; B -13 0 188 929 ;
+C -1 ; WX 556 ; N adieresis ; B 36 -15 530 706 ;
+C -1 ; WX 778 ; N Ograve ; B 39 -19 739 929 ;
+C -1 ; WX 667 ; N Egrave ; B 86 0 616 929 ;
+C -1 ; WX 667 ; N Ydieresis ; B 14 0 653 901 ;
+C -1 ; WX 737 ; N registered ; B -14 -19 752 737 ;
+C -1 ; WX 778 ; N Otilde ; B 39 -19 739 917 ;
+C -1 ; WX 834 ; N onequarter ; B 73 -19 756 703 ;
+C -1 ; WX 722 ; N Ugrave ; B 79 -19 644 929 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 79 -19 644 929 ;
+C -1 ; WX 667 ; N Thorn ; B 86 0 622 718 ;
+C -1 ; WX 584 ; N divide ; B 39 -19 545 524 ;
+C -1 ; WX 667 ; N Atilde ; B 14 0 654 917 ;
+C -1 ; WX 722 ; N Uacute ; B 79 -19 644 929 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 39 -19 739 929 ;
+C -1 ; WX 584 ; N logicalnot ; B 39 108 545 390 ;
+C -1 ; WX 667 ; N Aring ; B 14 0 654 931 ;
+C -1 ; WX 278 ; N idieresis ; B 13 0 266 706 ;
+C -1 ; WX 278 ; N iacute ; B 95 0 292 734 ;
+C -1 ; WX 556 ; N aacute ; B 36 -15 530 734 ;
+C -1 ; WX 584 ; N plusminus ; B 39 0 545 506 ;
+C -1 ; WX 584 ; N multiply ; B 39 0 545 506 ;
+C -1 ; WX 722 ; N Udieresis ; B 79 -19 644 901 ;
+C -1 ; WX 584 ; N minus ; B 39 216 545 289 ;
+C -1 ; WX 333 ; N onesuperior ; B 43 281 222 703 ;
+C -1 ; WX 667 ; N Eacute ; B 86 0 616 929 ;
+C -1 ; WX 667 ; N Acircumflex ; B 14 0 654 929 ;
+C -1 ; WX 737 ; N copyright ; B -14 -19 752 737 ;
+C -1 ; WX 667 ; N Agrave ; B 14 0 654 929 ;
+C -1 ; WX 556 ; N odieresis ; B 35 -14 521 706 ;
+C -1 ; WX 556 ; N oacute ; B 35 -14 521 734 ;
+C -1 ; WX 400 ; N degree ; B 54 411 346 703 ;
+C -1 ; WX 278 ; N igrave ; B -13 0 184 734 ;
+C -1 ; WX 556 ; N mu ; B 68 -207 489 523 ;
+C -1 ; WX 778 ; N Oacute ; B 39 -19 739 929 ;
+C -1 ; WX 556 ; N eth ; B 35 -15 522 737 ;
+C -1 ; WX 667 ; N Adieresis ; B 14 0 654 901 ;
+C -1 ; WX 667 ; N Yacute ; B 14 0 653 929 ;
+C -1 ; WX 260 ; N brokenbar ; B 94 -19 167 737 ;
+C -1 ; WX 834 ; N onehalf ; B 43 -19 773 703 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 250
+
+KPX A y -40
+KPX A w -40
+KPX A v -40
+KPX A u -30
+KPX A Y -100
+KPX A W -50
+KPX A V -70
+KPX A U -50
+KPX A T -120
+KPX A Q -30
+KPX A O -30
+KPX A G -30
+KPX A C -30
+
+KPX B period -20
+KPX B comma -20
+KPX B U -10
+
+KPX C period -30
+KPX C comma -30
+
+KPX D period -70
+KPX D comma -70
+KPX D Y -90
+KPX D W -40
+KPX D V -70
+KPX D A -40
+
+KPX F r -45
+KPX F period -150
+KPX F o -30
+KPX F e -30
+KPX F comma -150
+KPX F a -50
+KPX F A -80
+
+KPX J u -20
+KPX J period -30
+KPX J comma -30
+KPX J a -20
+KPX J A -20
+
+KPX K y -50
+KPX K u -30
+KPX K o -40
+KPX K e -40
+KPX K O -50
+
+KPX L y -30
+KPX L quoteright -160
+KPX L quotedblright -140
+KPX L Y -140
+KPX L W -70
+KPX L V -110
+KPX L T -110
+
+KPX O period -40
+KPX O comma -40
+KPX O Y -70
+KPX O X -60
+KPX O W -30
+KPX O V -50
+KPX O T -40
+KPX O A -20
+
+KPX P period -180
+KPX P o -50
+KPX P e -50
+KPX P comma -180
+KPX P a -40
+KPX P A -120
+
+KPX Q U -10
+
+KPX R Y -50
+KPX R W -30
+KPX R V -50
+KPX R U -40
+KPX R T -30
+KPX R O -20
+
+KPX S period -20
+KPX S comma -20
+
+KPX T y -120
+KPX T w -120
+KPX T u -120
+KPX T semicolon -20
+KPX T r -120
+KPX T period -120
+KPX T o -120
+KPX T hyphen -140
+KPX T e -120
+KPX T comma -120
+KPX T colon -20
+KPX T a -120
+KPX T O -40
+KPX T A -120
+
+KPX U period -40
+KPX U comma -40
+KPX U A -40
+
+KPX V u -70
+KPX V semicolon -40
+KPX V period -125
+KPX V o -80
+KPX V hyphen -80
+KPX V e -80
+KPX V comma -125
+KPX V colon -40
+KPX V a -70
+KPX V O -40
+KPX V G -40
+KPX V A -80
+
+KPX W y -20
+KPX W u -30
+KPX W period -80
+KPX W o -30
+KPX W hyphen -40
+KPX W e -30
+KPX W comma -80
+KPX W a -40
+KPX W O -20
+KPX W A -50
+
+KPX Y u -110
+KPX Y semicolon -60
+KPX Y period -140
+KPX Y o -140
+KPX Y i -20
+KPX Y hyphen -140
+KPX Y e -140
+KPX Y comma -140
+KPX Y colon -60
+KPX Y a -140
+KPX Y O -85
+KPX Y A -110
+
+KPX a y -30
+KPX a w -20
+KPX a v -20
+
+KPX b y -20
+KPX b v -20
+KPX b u -20
+KPX b period -40
+KPX b l -20
+KPX b comma -40
+KPX b b -10
+
+KPX c k -20
+KPX c comma -15
+
+KPX colon space -50
+
+KPX comma quoteright -100
+KPX comma quotedblright -100
+
+KPX e y -20
+KPX e x -30
+KPX e w -20
+KPX e v -30
+KPX e period -15
+KPX e comma -15
+
+KPX f quoteright 50
+KPX f quotedblright 60
+KPX f period -30
+KPX f o -30
+KPX f e -30
+KPX f dotlessi -28
+KPX f comma -30
+KPX f a -30
+
+KPX g r -10
+
+KPX h y -30
+
+KPX k o -20
+KPX k e -20
+
+KPX m y -15
+KPX m u -10
+
+KPX n y -15
+KPX n v -20
+KPX n u -10
+
+KPX o y -30
+KPX o x -30
+KPX o w -15
+KPX o v -15
+KPX o period -40
+KPX o comma -40
+
+KPX oslash z -55
+KPX oslash y -70
+KPX oslash x -85
+KPX oslash w -70
+KPX oslash v -70
+KPX oslash u -55
+KPX oslash t -55
+KPX oslash s -55
+KPX oslash r -55
+KPX oslash q -55
+KPX oslash period -95
+KPX oslash p -55
+KPX oslash o -55
+KPX oslash n -55
+KPX oslash m -55
+KPX oslash l -55
+KPX oslash k -55
+KPX oslash j -55
+KPX oslash i -55
+KPX oslash h -55
+KPX oslash g -55
+KPX oslash f -55
+KPX oslash e -55
+KPX oslash d -55
+KPX oslash comma -95
+KPX oslash c -55
+KPX oslash b -55
+KPX oslash a -55
+
+KPX p y -30
+KPX p period -35
+KPX p comma -35
+
+KPX period space -60
+KPX period quoteright -100
+KPX period quotedblright -100
+
+KPX quotedblright space -40
+
+KPX quoteleft quoteleft -57
+
+KPX quoteright space -70
+KPX quoteright s -50
+KPX quoteright r -50
+KPX quoteright quoteright -57
+KPX quoteright d -50
+
+KPX r y 30
+KPX r v 30
+KPX r u 15
+KPX r t 40
+KPX r semicolon 30
+KPX r period -50
+KPX r p 30
+KPX r n 25
+KPX r m 25
+KPX r l 15
+KPX r k 15
+KPX r i 15
+KPX r comma -50
+KPX r colon 30
+KPX r a -10
+
+KPX s w -30
+KPX s period -15
+KPX s comma -15
+
+KPX semicolon space -50
+
+KPX space quoteleft -60
+KPX space quotedblleft -30
+KPX space Y -90
+KPX space W -40
+KPX space V -50
+KPX space T -50
+
+KPX v period -80
+KPX v o -25
+KPX v e -25
+KPX v comma -80
+KPX v a -25
+
+KPX w period -60
+KPX w o -10
+KPX w e -10
+KPX w comma -60
+KPX w a -15
+
+KPX x e -30
+
+KPX y period -100
+KPX y o -20
+KPX y e -20
+KPX y comma -100
+KPX y a -20
+
+KPX z o -15
+KPX z e -15
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 167 195 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 167 195 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 167 195 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 167 195 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 167 175 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 167 195 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 195 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 167 195 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 167 195 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 167 195 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 167 195 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute -27 195 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -27 195 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -27 195 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave -27 195 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 205 195 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 223 195 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 223 195 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 223 195 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 223 195 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 223 195 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 167 195 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 195 195 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 195 195 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 195 195 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 195 195 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 167 195 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 167 195 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 139 195 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 112 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 112 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 112 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 112 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 112 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 102 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 84 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 112 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 112 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 112 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 112 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -27 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -27 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -27 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -27 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 102 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 112 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 112 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 112 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 112 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 112 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 84 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 112 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 112 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 112 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 112 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 84 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 84 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 84 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvr8an.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvr8an.afm
new file mode 100644
index 0000000..5a08aa8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvr8an.afm
@@ -0,0 +1,612 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights reserved.
+Comment Creation Date: Thu Mar 15 11:04:57 1990
+Comment UniqueID 28380
+Comment VMusage 7572 42473
+FontName Helvetica-Narrow
+FullName Helvetica Narrow
+FamilyName Helvetica
+Weight Medium
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -136 -225 820 931
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.006
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights reserved.Helvetica is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 718
+XHeight 523
+Ascender 718
+Descender -207
+StartCharMetrics 228
+C 32 ; WX 228 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 228 ; N exclam ; B 74 0 153 718 ;
+C 34 ; WX 291 ; N quotedbl ; B 57 463 234 718 ;
+C 35 ; WX 456 ; N numbersign ; B 23 0 434 688 ;
+C 36 ; WX 456 ; N dollar ; B 26 -115 426 775 ;
+C 37 ; WX 729 ; N percent ; B 32 -19 697 703 ;
+C 38 ; WX 547 ; N ampersand ; B 36 -15 529 718 ;
+C 39 ; WX 182 ; N quoteright ; B 43 463 129 718 ;
+C 40 ; WX 273 ; N parenleft ; B 56 -207 245 733 ;
+C 41 ; WX 273 ; N parenright ; B 28 -207 217 733 ;
+C 42 ; WX 319 ; N asterisk ; B 32 431 286 718 ;
+C 43 ; WX 479 ; N plus ; B 32 0 447 505 ;
+C 44 ; WX 228 ; N comma ; B 71 -147 157 106 ;
+C 45 ; WX 273 ; N hyphen ; B 36 232 237 322 ;
+C 46 ; WX 228 ; N period ; B 71 0 157 106 ;
+C 47 ; WX 228 ; N slash ; B -14 -19 242 737 ;
+C 48 ; WX 456 ; N zero ; B 30 -19 426 703 ;
+C 49 ; WX 456 ; N one ; B 83 0 294 703 ;
+C 50 ; WX 456 ; N two ; B 21 0 416 703 ;
+C 51 ; WX 456 ; N three ; B 28 -19 428 703 ;
+C 52 ; WX 456 ; N four ; B 20 0 429 703 ;
+C 53 ; WX 456 ; N five ; B 26 -19 421 688 ;
+C 54 ; WX 456 ; N six ; B 31 -19 425 703 ;
+C 55 ; WX 456 ; N seven ; B 30 0 429 688 ;
+C 56 ; WX 456 ; N eight ; B 31 -19 424 703 ;
+C 57 ; WX 456 ; N nine ; B 34 -19 421 703 ;
+C 58 ; WX 228 ; N colon ; B 71 0 157 516 ;
+C 59 ; WX 228 ; N semicolon ; B 71 -147 157 516 ;
+C 60 ; WX 479 ; N less ; B 39 11 440 495 ;
+C 61 ; WX 479 ; N equal ; B 32 115 447 390 ;
+C 62 ; WX 479 ; N greater ; B 39 11 440 495 ;
+C 63 ; WX 456 ; N question ; B 46 0 403 727 ;
+C 64 ; WX 832 ; N at ; B 121 -19 712 737 ;
+C 65 ; WX 547 ; N A ; B 11 0 536 718 ;
+C 66 ; WX 547 ; N B ; B 61 0 514 718 ;
+C 67 ; WX 592 ; N C ; B 36 -19 558 737 ;
+C 68 ; WX 592 ; N D ; B 66 0 553 718 ;
+C 69 ; WX 547 ; N E ; B 71 0 505 718 ;
+C 70 ; WX 501 ; N F ; B 71 0 478 718 ;
+C 71 ; WX 638 ; N G ; B 39 -19 577 737 ;
+C 72 ; WX 592 ; N H ; B 63 0 530 718 ;
+C 73 ; WX 228 ; N I ; B 75 0 154 718 ;
+C 74 ; WX 410 ; N J ; B 14 -19 351 718 ;
+C 75 ; WX 547 ; N K ; B 62 0 544 718 ;
+C 76 ; WX 456 ; N L ; B 62 0 440 718 ;
+C 77 ; WX 683 ; N M ; B 60 0 624 718 ;
+C 78 ; WX 592 ; N N ; B 62 0 530 718 ;
+C 79 ; WX 638 ; N O ; B 32 -19 606 737 ;
+C 80 ; WX 547 ; N P ; B 71 0 510 718 ;
+C 81 ; WX 638 ; N Q ; B 32 -56 606 737 ;
+C 82 ; WX 592 ; N R ; B 72 0 561 718 ;
+C 83 ; WX 547 ; N S ; B 40 -19 508 737 ;
+C 84 ; WX 501 ; N T ; B 11 0 490 718 ;
+C 85 ; WX 592 ; N U ; B 65 -19 528 718 ;
+C 86 ; WX 547 ; N V ; B 16 0 531 718 ;
+C 87 ; WX 774 ; N W ; B 13 0 761 718 ;
+C 88 ; WX 547 ; N X ; B 16 0 531 718 ;
+C 89 ; WX 547 ; N Y ; B 11 0 535 718 ;
+C 90 ; WX 501 ; N Z ; B 19 0 482 718 ;
+C 91 ; WX 228 ; N bracketleft ; B 52 -196 205 722 ;
+C 92 ; WX 228 ; N backslash ; B -14 -19 242 737 ;
+C 93 ; WX 228 ; N bracketright ; B 23 -196 176 722 ;
+C 94 ; WX 385 ; N asciicircum ; B -11 264 396 688 ;
+C 95 ; WX 456 ; N underscore ; B 0 -125 456 -75 ;
+C 96 ; WX 182 ; N quoteleft ; B 53 470 139 725 ;
+C 97 ; WX 456 ; N a ; B 30 -15 435 538 ;
+C 98 ; WX 456 ; N b ; B 48 -15 424 718 ;
+C 99 ; WX 410 ; N c ; B 25 -15 391 538 ;
+C 100 ; WX 456 ; N d ; B 29 -15 409 718 ;
+C 101 ; WX 456 ; N e ; B 33 -15 423 538 ;
+C 102 ; WX 228 ; N f ; B 11 0 215 728 ; L i fi ; L l fl ;
+C 103 ; WX 456 ; N g ; B 33 -220 409 538 ;
+C 104 ; WX 456 ; N h ; B 53 0 403 718 ;
+C 105 ; WX 182 ; N i ; B 55 0 127 718 ;
+C 106 ; WX 182 ; N j ; B -13 -210 127 718 ;
+C 107 ; WX 410 ; N k ; B 55 0 411 718 ;
+C 108 ; WX 182 ; N l ; B 55 0 127 718 ;
+C 109 ; WX 683 ; N m ; B 53 0 631 538 ;
+C 110 ; WX 456 ; N n ; B 53 0 403 538 ;
+C 111 ; WX 456 ; N o ; B 29 -14 427 538 ;
+C 112 ; WX 456 ; N p ; B 48 -207 424 538 ;
+C 113 ; WX 456 ; N q ; B 29 -207 405 538 ;
+C 114 ; WX 273 ; N r ; B 63 0 272 538 ;
+C 115 ; WX 410 ; N s ; B 26 -15 380 538 ;
+C 116 ; WX 228 ; N t ; B 11 -7 211 669 ;
+C 117 ; WX 456 ; N u ; B 56 -15 401 523 ;
+C 118 ; WX 410 ; N v ; B 7 0 403 523 ;
+C 119 ; WX 592 ; N w ; B 11 0 581 523 ;
+C 120 ; WX 410 ; N x ; B 9 0 402 523 ;
+C 121 ; WX 410 ; N y ; B 9 -214 401 523 ;
+C 122 ; WX 410 ; N z ; B 25 0 385 523 ;
+C 123 ; WX 274 ; N braceleft ; B 34 -196 239 722 ;
+C 124 ; WX 213 ; N bar ; B 77 -19 137 737 ;
+C 125 ; WX 274 ; N braceright ; B 34 -196 239 722 ;
+C 126 ; WX 479 ; N asciitilde ; B 50 180 429 326 ;
+C 161 ; WX 273 ; N exclamdown ; B 97 -195 176 523 ;
+C 162 ; WX 456 ; N cent ; B 42 -115 421 623 ;
+C 163 ; WX 456 ; N sterling ; B 27 -16 442 718 ;
+C 164 ; WX 137 ; N fraction ; B -136 -19 273 703 ;
+C 165 ; WX 456 ; N yen ; B 2 0 453 688 ;
+C 166 ; WX 456 ; N florin ; B -9 -207 411 737 ;
+C 167 ; WX 456 ; N section ; B 35 -191 420 737 ;
+C 168 ; WX 456 ; N currency ; B 23 99 433 603 ;
+C 169 ; WX 157 ; N quotesingle ; B 48 463 108 718 ;
+C 170 ; WX 273 ; N quotedblleft ; B 31 470 252 725 ;
+C 171 ; WX 456 ; N guillemotleft ; B 80 108 376 446 ;
+C 172 ; WX 273 ; N guilsinglleft ; B 72 108 201 446 ;
+C 173 ; WX 273 ; N guilsinglright ; B 72 108 201 446 ;
+C 174 ; WX 410 ; N fi ; B 11 0 356 728 ;
+C 175 ; WX 410 ; N fl ; B 11 0 354 728 ;
+C 177 ; WX 456 ; N endash ; B 0 240 456 313 ;
+C 178 ; WX 456 ; N dagger ; B 35 -159 421 718 ;
+C 179 ; WX 456 ; N daggerdbl ; B 35 -159 421 718 ;
+C 180 ; WX 228 ; N periodcentered ; B 63 190 166 315 ;
+C 182 ; WX 440 ; N paragraph ; B 15 -173 408 718 ;
+C 183 ; WX 287 ; N bullet ; B 15 202 273 517 ;
+C 184 ; WX 182 ; N quotesinglbase ; B 43 -149 129 106 ;
+C 185 ; WX 273 ; N quotedblbase ; B 21 -149 242 106 ;
+C 186 ; WX 273 ; N quotedblright ; B 21 463 242 718 ;
+C 187 ; WX 456 ; N guillemotright ; B 80 108 376 446 ;
+C 188 ; WX 820 ; N ellipsis ; B 94 0 726 106 ;
+C 189 ; WX 820 ; N perthousand ; B 6 -19 815 703 ;
+C 191 ; WX 501 ; N questiondown ; B 75 -201 432 525 ;
+C 193 ; WX 273 ; N grave ; B 11 593 173 734 ;
+C 194 ; WX 273 ; N acute ; B 100 593 262 734 ;
+C 195 ; WX 273 ; N circumflex ; B 17 593 256 734 ;
+C 196 ; WX 273 ; N tilde ; B -3 606 276 722 ;
+C 197 ; WX 273 ; N macron ; B 8 627 265 684 ;
+C 198 ; WX 273 ; N breve ; B 11 595 263 731 ;
+C 199 ; WX 273 ; N dotaccent ; B 99 604 174 706 ;
+C 200 ; WX 273 ; N dieresis ; B 33 604 240 706 ;
+C 202 ; WX 273 ; N ring ; B 61 572 212 756 ;
+C 203 ; WX 273 ; N cedilla ; B 37 -225 212 0 ;
+C 205 ; WX 273 ; N hungarumlaut ; B 25 593 335 734 ;
+C 206 ; WX 273 ; N ogonek ; B 60 -225 235 0 ;
+C 207 ; WX 273 ; N caron ; B 17 593 256 734 ;
+C 208 ; WX 820 ; N emdash ; B 0 240 820 313 ;
+C 225 ; WX 820 ; N AE ; B 7 0 780 718 ;
+C 227 ; WX 303 ; N ordfeminine ; B 20 304 284 737 ;
+C 232 ; WX 456 ; N Lslash ; B -16 0 440 718 ;
+C 233 ; WX 638 ; N Oslash ; B 32 -19 607 737 ;
+C 234 ; WX 820 ; N OE ; B 30 -19 791 737 ;
+C 235 ; WX 299 ; N ordmasculine ; B 20 304 280 737 ;
+C 241 ; WX 729 ; N ae ; B 30 -15 695 538 ;
+C 245 ; WX 228 ; N dotlessi ; B 78 0 150 523 ;
+C 248 ; WX 182 ; N lslash ; B -16 0 198 718 ;
+C 249 ; WX 501 ; N oslash ; B 23 -22 440 545 ;
+C 250 ; WX 774 ; N oe ; B 29 -15 740 538 ;
+C 251 ; WX 501 ; N germandbls ; B 55 -15 468 728 ;
+C -1 ; WX 501 ; N Zcaron ; B 19 0 482 929 ;
+C -1 ; WX 410 ; N ccedilla ; B 25 -225 391 538 ;
+C -1 ; WX 410 ; N ydieresis ; B 9 -214 401 706 ;
+C -1 ; WX 456 ; N atilde ; B 30 -15 435 722 ;
+C -1 ; WX 228 ; N icircumflex ; B -5 0 234 734 ;
+C -1 ; WX 273 ; N threesuperior ; B 4 270 266 703 ;
+C -1 ; WX 456 ; N ecircumflex ; B 33 -15 423 734 ;
+C -1 ; WX 456 ; N thorn ; B 48 -207 424 718 ;
+C -1 ; WX 456 ; N egrave ; B 33 -15 423 734 ;
+C -1 ; WX 273 ; N twosuperior ; B 3 281 265 703 ;
+C -1 ; WX 456 ; N eacute ; B 33 -15 423 734 ;
+C -1 ; WX 456 ; N otilde ; B 29 -14 427 722 ;
+C -1 ; WX 547 ; N Aacute ; B 11 0 536 929 ;
+C -1 ; WX 456 ; N ocircumflex ; B 29 -14 427 734 ;
+C -1 ; WX 410 ; N yacute ; B 9 -214 401 734 ;
+C -1 ; WX 456 ; N udieresis ; B 56 -15 401 706 ;
+C -1 ; WX 684 ; N threequarters ; B 37 -19 664 703 ;
+C -1 ; WX 456 ; N acircumflex ; B 30 -15 435 734 ;
+C -1 ; WX 592 ; N Eth ; B 0 0 553 718 ;
+C -1 ; WX 456 ; N edieresis ; B 33 -15 423 706 ;
+C -1 ; WX 456 ; N ugrave ; B 56 -15 401 734 ;
+C -1 ; WX 820 ; N trademark ; B 38 306 740 718 ;
+C -1 ; WX 456 ; N ograve ; B 29 -14 427 734 ;
+C -1 ; WX 410 ; N scaron ; B 26 -15 380 734 ;
+C -1 ; WX 228 ; N Idieresis ; B 11 0 218 901 ;
+C -1 ; WX 456 ; N uacute ; B 56 -15 401 734 ;
+C -1 ; WX 456 ; N agrave ; B 30 -15 435 734 ;
+C -1 ; WX 456 ; N ntilde ; B 53 0 403 722 ;
+C -1 ; WX 456 ; N aring ; B 30 -15 435 756 ;
+C -1 ; WX 410 ; N zcaron ; B 25 0 385 734 ;
+C -1 ; WX 228 ; N Icircumflex ; B -5 0 234 929 ;
+C -1 ; WX 592 ; N Ntilde ; B 62 0 530 917 ;
+C -1 ; WX 456 ; N ucircumflex ; B 56 -15 401 734 ;
+C -1 ; WX 547 ; N Ecircumflex ; B 71 0 505 929 ;
+C -1 ; WX 228 ; N Iacute ; B 75 0 239 929 ;
+C -1 ; WX 592 ; N Ccedilla ; B 36 -225 558 737 ;
+C -1 ; WX 638 ; N Odieresis ; B 32 -19 606 901 ;
+C -1 ; WX 547 ; N Scaron ; B 40 -19 508 929 ;
+C -1 ; WX 547 ; N Edieresis ; B 71 0 505 901 ;
+C -1 ; WX 228 ; N Igrave ; B -11 0 154 929 ;
+C -1 ; WX 456 ; N adieresis ; B 30 -15 435 706 ;
+C -1 ; WX 638 ; N Ograve ; B 32 -19 606 929 ;
+C -1 ; WX 547 ; N Egrave ; B 71 0 505 929 ;
+C -1 ; WX 547 ; N Ydieresis ; B 11 0 535 901 ;
+C -1 ; WX 604 ; N registered ; B -11 -19 617 737 ;
+C -1 ; WX 638 ; N Otilde ; B 32 -19 606 917 ;
+C -1 ; WX 684 ; N onequarter ; B 60 -19 620 703 ;
+C -1 ; WX 592 ; N Ugrave ; B 65 -19 528 929 ;
+C -1 ; WX 592 ; N Ucircumflex ; B 65 -19 528 929 ;
+C -1 ; WX 547 ; N Thorn ; B 71 0 510 718 ;
+C -1 ; WX 479 ; N divide ; B 32 -19 447 524 ;
+C -1 ; WX 547 ; N Atilde ; B 11 0 536 917 ;
+C -1 ; WX 592 ; N Uacute ; B 65 -19 528 929 ;
+C -1 ; WX 638 ; N Ocircumflex ; B 32 -19 606 929 ;
+C -1 ; WX 479 ; N logicalnot ; B 32 108 447 390 ;
+C -1 ; WX 547 ; N Aring ; B 11 0 536 931 ;
+C -1 ; WX 228 ; N idieresis ; B 11 0 218 706 ;
+C -1 ; WX 228 ; N iacute ; B 78 0 239 734 ;
+C -1 ; WX 456 ; N aacute ; B 30 -15 435 734 ;
+C -1 ; WX 479 ; N plusminus ; B 32 0 447 506 ;
+C -1 ; WX 479 ; N multiply ; B 32 0 447 506 ;
+C -1 ; WX 592 ; N Udieresis ; B 65 -19 528 901 ;
+C -1 ; WX 479 ; N minus ; B 32 216 447 289 ;
+C -1 ; WX 273 ; N onesuperior ; B 35 281 182 703 ;
+C -1 ; WX 547 ; N Eacute ; B 71 0 505 929 ;
+C -1 ; WX 547 ; N Acircumflex ; B 11 0 536 929 ;
+C -1 ; WX 604 ; N copyright ; B -11 -19 617 737 ;
+C -1 ; WX 547 ; N Agrave ; B 11 0 536 929 ;
+C -1 ; WX 456 ; N odieresis ; B 29 -14 427 706 ;
+C -1 ; WX 456 ; N oacute ; B 29 -14 427 734 ;
+C -1 ; WX 328 ; N degree ; B 44 411 284 703 ;
+C -1 ; WX 228 ; N igrave ; B -11 0 151 734 ;
+C -1 ; WX 456 ; N mu ; B 56 -207 401 523 ;
+C -1 ; WX 638 ; N Oacute ; B 32 -19 606 929 ;
+C -1 ; WX 456 ; N eth ; B 29 -15 428 737 ;
+C -1 ; WX 547 ; N Adieresis ; B 11 0 536 901 ;
+C -1 ; WX 547 ; N Yacute ; B 11 0 535 929 ;
+C -1 ; WX 213 ; N brokenbar ; B 77 -19 137 737 ;
+C -1 ; WX 684 ; N onehalf ; B 35 -19 634 703 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 250
+
+KPX A y -32
+KPX A w -32
+KPX A v -32
+KPX A u -24
+KPX A Y -81
+KPX A W -40
+KPX A V -56
+KPX A U -40
+KPX A T -97
+KPX A Q -24
+KPX A O -24
+KPX A G -24
+KPX A C -24
+
+KPX B period -15
+KPX B comma -15
+KPX B U -7
+
+KPX C period -24
+KPX C comma -24
+
+KPX D period -56
+KPX D comma -56
+KPX D Y -73
+KPX D W -32
+KPX D V -56
+KPX D A -32
+
+KPX F r -36
+KPX F period -122
+KPX F o -24
+KPX F e -24
+KPX F comma -122
+KPX F a -40
+KPX F A -65
+
+KPX J u -15
+KPX J period -24
+KPX J comma -24
+KPX J a -15
+KPX J A -15
+
+KPX K y -40
+KPX K u -24
+KPX K o -32
+KPX K e -32
+KPX K O -40
+
+KPX L y -24
+KPX L quoteright -130
+KPX L quotedblright -114
+KPX L Y -114
+KPX L W -56
+KPX L V -89
+KPX L T -89
+
+KPX O period -32
+KPX O comma -32
+KPX O Y -56
+KPX O X -48
+KPX O W -24
+KPX O V -40
+KPX O T -32
+KPX O A -15
+
+KPX P period -147
+KPX P o -40
+KPX P e -40
+KPX P comma -147
+KPX P a -32
+KPX P A -97
+
+KPX Q U -7
+
+KPX R Y -40
+KPX R W -24
+KPX R V -40
+KPX R U -32
+KPX R T -24
+KPX R O -15
+
+KPX S period -15
+KPX S comma -15
+
+KPX T y -97
+KPX T w -97
+KPX T u -97
+KPX T semicolon -15
+KPX T r -97
+KPX T period -97
+KPX T o -97
+KPX T hyphen -114
+KPX T e -97
+KPX T comma -97
+KPX T colon -15
+KPX T a -97
+KPX T O -32
+KPX T A -97
+
+KPX U period -32
+KPX U comma -32
+KPX U A -32
+
+KPX V u -56
+KPX V semicolon -32
+KPX V period -102
+KPX V o -65
+KPX V hyphen -65
+KPX V e -65
+KPX V comma -102
+KPX V colon -32
+KPX V a -56
+KPX V O -32
+KPX V G -32
+KPX V A -65
+
+KPX W y -15
+KPX W u -24
+KPX W period -65
+KPX W o -24
+KPX W hyphen -32
+KPX W e -24
+KPX W comma -65
+KPX W a -32
+KPX W O -15
+KPX W A -40
+
+KPX Y u -89
+KPX Y semicolon -48
+KPX Y period -114
+KPX Y o -114
+KPX Y i -15
+KPX Y hyphen -114
+KPX Y e -114
+KPX Y comma -114
+KPX Y colon -48
+KPX Y a -114
+KPX Y O -69
+KPX Y A -89
+
+KPX a y -24
+KPX a w -15
+KPX a v -15
+
+KPX b y -15
+KPX b v -15
+KPX b u -15
+KPX b period -32
+KPX b l -15
+KPX b comma -32
+KPX b b -7
+
+KPX c k -15
+KPX c comma -11
+
+KPX colon space -40
+
+KPX comma quoteright -81
+KPX comma quotedblright -81
+
+KPX e y -15
+KPX e x -24
+KPX e w -15
+KPX e v -24
+KPX e period -11
+KPX e comma -11
+
+KPX f quoteright 41
+KPX f quotedblright 49
+KPX f period -24
+KPX f o -24
+KPX f e -24
+KPX f dotlessi -22
+KPX f comma -24
+KPX f a -24
+
+KPX g r -7
+
+KPX h y -24
+
+KPX k o -15
+KPX k e -15
+
+KPX m y -11
+KPX m u -7
+
+KPX n y -11
+KPX n v -15
+KPX n u -7
+
+KPX o y -24
+KPX o x -24
+KPX o w -11
+KPX o v -11
+KPX o period -32
+KPX o comma -32
+
+KPX oslash z -44
+KPX oslash y -56
+KPX oslash x -69
+KPX oslash w -56
+KPX oslash v -56
+KPX oslash u -44
+KPX oslash t -44
+KPX oslash s -44
+KPX oslash r -44
+KPX oslash q -44
+KPX oslash period -77
+KPX oslash p -44
+KPX oslash o -44
+KPX oslash n -44
+KPX oslash m -44
+KPX oslash l -44
+KPX oslash k -44
+KPX oslash j -44
+KPX oslash i -44
+KPX oslash h -44
+KPX oslash g -44
+KPX oslash f -44
+KPX oslash e -44
+KPX oslash d -44
+KPX oslash comma -77
+KPX oslash c -44
+KPX oslash b -44
+KPX oslash a -44
+
+KPX p y -24
+KPX p period -28
+KPX p comma -28
+
+KPX period space -48
+KPX period quoteright -81
+KPX period quotedblright -81
+
+KPX quotedblright space -32
+
+KPX quoteleft quoteleft -46
+
+KPX quoteright space -56
+KPX quoteright s -40
+KPX quoteright r -40
+KPX quoteright quoteright -46
+KPX quoteright d -40
+
+KPX r y 25
+KPX r v 25
+KPX r u 12
+KPX r t 33
+KPX r semicolon 25
+KPX r period -40
+KPX r p 25
+KPX r n 21
+KPX r m 21
+KPX r l 12
+KPX r k 12
+KPX r i 12
+KPX r comma -40
+KPX r colon 25
+KPX r a -7
+
+KPX s w -24
+KPX s period -11
+KPX s comma -11
+
+KPX semicolon space -40
+
+KPX space quoteleft -48
+KPX space quotedblleft -24
+KPX space Y -73
+KPX space W -32
+KPX space V -40
+KPX space T -40
+
+KPX v period -65
+KPX v o -20
+KPX v e -20
+KPX v comma -65
+KPX v a -20
+
+KPX w period -48
+KPX w o -7
+KPX w e -7
+KPX w comma -48
+KPX w a -11
+
+KPX x e -24
+
+KPX y period -81
+KPX y o -15
+KPX y e -15
+KPX y comma -81
+KPX y a -15
+
+KPX z o -11
+KPX z e -11
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 137 195 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 137 195 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 137 195 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 137 195 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 137 175 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 137 195 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 160 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 137 195 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 137 195 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 137 195 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 137 195 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute -22 195 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -22 195 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -22 195 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave -22 195 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 168 195 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 183 195 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 183 195 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 183 195 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 183 195 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 183 195 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 137 195 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 160 195 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 160 195 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 160 195 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 160 195 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 137 195 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 137 195 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 114 195 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 92 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 92 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 92 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 92 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 92 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 84 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 69 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 92 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 92 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 92 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 92 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -22 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -22 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -22 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -22 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 84 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 92 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 92 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 92 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 92 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 92 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 69 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 92 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 92 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 92 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 92 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 69 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 69 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 69 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvro8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvro8a.afm
new file mode 100644
index 0000000..3d69eb7
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvro8a.afm
@@ -0,0 +1,612 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights reserved.
+Comment Creation Date: Thu Mar 15 10:24:18 1990
+Comment UniqueID 28362
+Comment VMusage 7572 42473
+FontName Helvetica-Oblique
+FullName Helvetica Oblique
+FamilyName Helvetica
+Weight Medium
+ItalicAngle -12
+IsFixedPitch false
+FontBBox -170 -225 1116 931
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.006
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights reserved.Helvetica is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 718
+XHeight 523
+Ascender 718
+Descender -207
+StartCharMetrics 228
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 278 ; N exclam ; B 90 0 340 718 ;
+C 34 ; WX 355 ; N quotedbl ; B 168 463 438 718 ;
+C 35 ; WX 556 ; N numbersign ; B 73 0 631 688 ;
+C 36 ; WX 556 ; N dollar ; B 69 -115 617 775 ;
+C 37 ; WX 889 ; N percent ; B 147 -19 889 703 ;
+C 38 ; WX 667 ; N ampersand ; B 77 -15 647 718 ;
+C 39 ; WX 222 ; N quoteright ; B 151 463 310 718 ;
+C 40 ; WX 333 ; N parenleft ; B 108 -207 454 733 ;
+C 41 ; WX 333 ; N parenright ; B -9 -207 337 733 ;
+C 42 ; WX 389 ; N asterisk ; B 165 431 475 718 ;
+C 43 ; WX 584 ; N plus ; B 85 0 606 505 ;
+C 44 ; WX 278 ; N comma ; B 56 -147 214 106 ;
+C 45 ; WX 333 ; N hyphen ; B 93 232 357 322 ;
+C 46 ; WX 278 ; N period ; B 87 0 214 106 ;
+C 47 ; WX 278 ; N slash ; B -21 -19 452 737 ;
+C 48 ; WX 556 ; N zero ; B 93 -19 608 703 ;
+C 49 ; WX 556 ; N one ; B 207 0 508 703 ;
+C 50 ; WX 556 ; N two ; B 26 0 617 703 ;
+C 51 ; WX 556 ; N three ; B 75 -19 610 703 ;
+C 52 ; WX 556 ; N four ; B 61 0 576 703 ;
+C 53 ; WX 556 ; N five ; B 68 -19 621 688 ;
+C 54 ; WX 556 ; N six ; B 91 -19 615 703 ;
+C 55 ; WX 556 ; N seven ; B 137 0 669 688 ;
+C 56 ; WX 556 ; N eight ; B 74 -19 607 703 ;
+C 57 ; WX 556 ; N nine ; B 82 -19 609 703 ;
+C 58 ; WX 278 ; N colon ; B 87 0 301 516 ;
+C 59 ; WX 278 ; N semicolon ; B 56 -147 301 516 ;
+C 60 ; WX 584 ; N less ; B 94 11 641 495 ;
+C 61 ; WX 584 ; N equal ; B 63 115 628 390 ;
+C 62 ; WX 584 ; N greater ; B 50 11 597 495 ;
+C 63 ; WX 556 ; N question ; B 161 0 610 727 ;
+C 64 ; WX 1015 ; N at ; B 215 -19 965 737 ;
+C 65 ; WX 667 ; N A ; B 14 0 654 718 ;
+C 66 ; WX 667 ; N B ; B 74 0 712 718 ;
+C 67 ; WX 722 ; N C ; B 108 -19 782 737 ;
+C 68 ; WX 722 ; N D ; B 81 0 764 718 ;
+C 69 ; WX 667 ; N E ; B 86 0 762 718 ;
+C 70 ; WX 611 ; N F ; B 86 0 736 718 ;
+C 71 ; WX 778 ; N G ; B 111 -19 799 737 ;
+C 72 ; WX 722 ; N H ; B 77 0 799 718 ;
+C 73 ; WX 278 ; N I ; B 91 0 341 718 ;
+C 74 ; WX 500 ; N J ; B 47 -19 581 718 ;
+C 75 ; WX 667 ; N K ; B 76 0 808 718 ;
+C 76 ; WX 556 ; N L ; B 76 0 555 718 ;
+C 77 ; WX 833 ; N M ; B 73 0 914 718 ;
+C 78 ; WX 722 ; N N ; B 76 0 799 718 ;
+C 79 ; WX 778 ; N O ; B 105 -19 826 737 ;
+C 80 ; WX 667 ; N P ; B 86 0 737 718 ;
+C 81 ; WX 778 ; N Q ; B 105 -56 826 737 ;
+C 82 ; WX 722 ; N R ; B 88 0 773 718 ;
+C 83 ; WX 667 ; N S ; B 90 -19 713 737 ;
+C 84 ; WX 611 ; N T ; B 148 0 750 718 ;
+C 85 ; WX 722 ; N U ; B 123 -19 797 718 ;
+C 86 ; WX 667 ; N V ; B 173 0 800 718 ;
+C 87 ; WX 944 ; N W ; B 169 0 1081 718 ;
+C 88 ; WX 667 ; N X ; B 19 0 790 718 ;
+C 89 ; WX 667 ; N Y ; B 167 0 806 718 ;
+C 90 ; WX 611 ; N Z ; B 23 0 741 718 ;
+C 91 ; WX 278 ; N bracketleft ; B 21 -196 403 722 ;
+C 92 ; WX 278 ; N backslash ; B 140 -19 291 737 ;
+C 93 ; WX 278 ; N bracketright ; B -14 -196 368 722 ;
+C 94 ; WX 469 ; N asciicircum ; B 42 264 539 688 ;
+C 95 ; WX 556 ; N underscore ; B -27 -125 540 -75 ;
+C 96 ; WX 222 ; N quoteleft ; B 165 470 323 725 ;
+C 97 ; WX 556 ; N a ; B 61 -15 559 538 ;
+C 98 ; WX 556 ; N b ; B 58 -15 584 718 ;
+C 99 ; WX 500 ; N c ; B 74 -15 553 538 ;
+C 100 ; WX 556 ; N d ; B 84 -15 652 718 ;
+C 101 ; WX 556 ; N e ; B 84 -15 578 538 ;
+C 102 ; WX 278 ; N f ; B 86 0 416 728 ; L i fi ; L l fl ;
+C 103 ; WX 556 ; N g ; B 42 -220 610 538 ;
+C 104 ; WX 556 ; N h ; B 65 0 573 718 ;
+C 105 ; WX 222 ; N i ; B 67 0 308 718 ;
+C 106 ; WX 222 ; N j ; B -60 -210 308 718 ;
+C 107 ; WX 500 ; N k ; B 67 0 600 718 ;
+C 108 ; WX 222 ; N l ; B 67 0 308 718 ;
+C 109 ; WX 833 ; N m ; B 65 0 852 538 ;
+C 110 ; WX 556 ; N n ; B 65 0 573 538 ;
+C 111 ; WX 556 ; N o ; B 83 -14 585 538 ;
+C 112 ; WX 556 ; N p ; B 14 -207 584 538 ;
+C 113 ; WX 556 ; N q ; B 84 -207 605 538 ;
+C 114 ; WX 333 ; N r ; B 77 0 446 538 ;
+C 115 ; WX 500 ; N s ; B 63 -15 529 538 ;
+C 116 ; WX 278 ; N t ; B 102 -7 368 669 ;
+C 117 ; WX 556 ; N u ; B 94 -15 600 523 ;
+C 118 ; WX 500 ; N v ; B 119 0 603 523 ;
+C 119 ; WX 722 ; N w ; B 125 0 820 523 ;
+C 120 ; WX 500 ; N x ; B 11 0 594 523 ;
+C 121 ; WX 500 ; N y ; B 15 -214 600 523 ;
+C 122 ; WX 500 ; N z ; B 31 0 571 523 ;
+C 123 ; WX 334 ; N braceleft ; B 92 -196 445 722 ;
+C 124 ; WX 260 ; N bar ; B 90 -19 324 737 ;
+C 125 ; WX 334 ; N braceright ; B 0 -196 354 722 ;
+C 126 ; WX 584 ; N asciitilde ; B 111 180 580 326 ;
+C 161 ; WX 333 ; N exclamdown ; B 77 -195 326 523 ;
+C 162 ; WX 556 ; N cent ; B 95 -115 584 623 ;
+C 163 ; WX 556 ; N sterling ; B 49 -16 634 718 ;
+C 164 ; WX 167 ; N fraction ; B -170 -19 482 703 ;
+C 165 ; WX 556 ; N yen ; B 81 0 699 688 ;
+C 166 ; WX 556 ; N florin ; B -52 -207 654 737 ;
+C 167 ; WX 556 ; N section ; B 76 -191 584 737 ;
+C 168 ; WX 556 ; N currency ; B 60 99 646 603 ;
+C 169 ; WX 191 ; N quotesingle ; B 157 463 285 718 ;
+C 170 ; WX 333 ; N quotedblleft ; B 138 470 461 725 ;
+C 171 ; WX 556 ; N guillemotleft ; B 146 108 554 446 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 137 108 340 446 ;
+C 173 ; WX 333 ; N guilsinglright ; B 111 108 314 446 ;
+C 174 ; WX 500 ; N fi ; B 86 0 587 728 ;
+C 175 ; WX 500 ; N fl ; B 86 0 585 728 ;
+C 177 ; WX 556 ; N endash ; B 51 240 623 313 ;
+C 178 ; WX 556 ; N dagger ; B 135 -159 622 718 ;
+C 179 ; WX 556 ; N daggerdbl ; B 52 -159 623 718 ;
+C 180 ; WX 278 ; N periodcentered ; B 129 190 257 315 ;
+C 182 ; WX 537 ; N paragraph ; B 126 -173 650 718 ;
+C 183 ; WX 350 ; N bullet ; B 91 202 413 517 ;
+C 184 ; WX 222 ; N quotesinglbase ; B 21 -149 180 106 ;
+C 185 ; WX 333 ; N quotedblbase ; B -6 -149 318 106 ;
+C 186 ; WX 333 ; N quotedblright ; B 124 463 448 718 ;
+C 187 ; WX 556 ; N guillemotright ; B 120 108 528 446 ;
+C 188 ; WX 1000 ; N ellipsis ; B 115 0 908 106 ;
+C 189 ; WX 1000 ; N perthousand ; B 88 -19 1029 703 ;
+C 191 ; WX 611 ; N questiondown ; B 85 -201 534 525 ;
+C 193 ; WX 333 ; N grave ; B 170 593 337 734 ;
+C 194 ; WX 333 ; N acute ; B 248 593 475 734 ;
+C 195 ; WX 333 ; N circumflex ; B 147 593 438 734 ;
+C 196 ; WX 333 ; N tilde ; B 125 606 490 722 ;
+C 197 ; WX 333 ; N macron ; B 143 627 468 684 ;
+C 198 ; WX 333 ; N breve ; B 167 595 476 731 ;
+C 199 ; WX 333 ; N dotaccent ; B 249 604 362 706 ;
+C 200 ; WX 333 ; N dieresis ; B 168 604 443 706 ;
+C 202 ; WX 333 ; N ring ; B 214 572 402 756 ;
+C 203 ; WX 333 ; N cedilla ; B 2 -225 232 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 157 593 565 734 ;
+C 206 ; WX 333 ; N ogonek ; B 43 -225 249 0 ;
+C 207 ; WX 333 ; N caron ; B 177 593 468 734 ;
+C 208 ; WX 1000 ; N emdash ; B 51 240 1067 313 ;
+C 225 ; WX 1000 ; N AE ; B 8 0 1097 718 ;
+C 227 ; WX 370 ; N ordfeminine ; B 100 304 449 737 ;
+C 232 ; WX 556 ; N Lslash ; B 41 0 555 718 ;
+C 233 ; WX 778 ; N Oslash ; B 43 -19 890 737 ;
+C 234 ; WX 1000 ; N OE ; B 98 -19 1116 737 ;
+C 235 ; WX 365 ; N ordmasculine ; B 100 304 468 737 ;
+C 241 ; WX 889 ; N ae ; B 61 -15 909 538 ;
+C 245 ; WX 278 ; N dotlessi ; B 95 0 294 523 ;
+C 248 ; WX 222 ; N lslash ; B 41 0 347 718 ;
+C 249 ; WX 611 ; N oslash ; B 29 -22 647 545 ;
+C 250 ; WX 944 ; N oe ; B 83 -15 964 538 ;
+C 251 ; WX 611 ; N germandbls ; B 67 -15 658 728 ;
+C -1 ; WX 611 ; N Zcaron ; B 23 0 741 929 ;
+C -1 ; WX 500 ; N ccedilla ; B 74 -225 553 538 ;
+C -1 ; WX 500 ; N ydieresis ; B 15 -214 600 706 ;
+C -1 ; WX 556 ; N atilde ; B 61 -15 592 722 ;
+C -1 ; WX 278 ; N icircumflex ; B 95 0 411 734 ;
+C -1 ; WX 333 ; N threesuperior ; B 90 270 436 703 ;
+C -1 ; WX 556 ; N ecircumflex ; B 84 -15 578 734 ;
+C -1 ; WX 556 ; N thorn ; B 14 -207 584 718 ;
+C -1 ; WX 556 ; N egrave ; B 84 -15 578 734 ;
+C -1 ; WX 333 ; N twosuperior ; B 64 281 449 703 ;
+C -1 ; WX 556 ; N eacute ; B 84 -15 587 734 ;
+C -1 ; WX 556 ; N otilde ; B 83 -14 602 722 ;
+C -1 ; WX 667 ; N Aacute ; B 14 0 683 929 ;
+C -1 ; WX 556 ; N ocircumflex ; B 83 -14 585 734 ;
+C -1 ; WX 500 ; N yacute ; B 15 -214 600 734 ;
+C -1 ; WX 556 ; N udieresis ; B 94 -15 600 706 ;
+C -1 ; WX 834 ; N threequarters ; B 130 -19 861 703 ;
+C -1 ; WX 556 ; N acircumflex ; B 61 -15 559 734 ;
+C -1 ; WX 722 ; N Eth ; B 69 0 764 718 ;
+C -1 ; WX 556 ; N edieresis ; B 84 -15 578 706 ;
+C -1 ; WX 556 ; N ugrave ; B 94 -15 600 734 ;
+C -1 ; WX 1000 ; N trademark ; B 186 306 1056 718 ;
+C -1 ; WX 556 ; N ograve ; B 83 -14 585 734 ;
+C -1 ; WX 500 ; N scaron ; B 63 -15 552 734 ;
+C -1 ; WX 278 ; N Idieresis ; B 91 0 458 901 ;
+C -1 ; WX 556 ; N uacute ; B 94 -15 600 734 ;
+C -1 ; WX 556 ; N agrave ; B 61 -15 559 734 ;
+C -1 ; WX 556 ; N ntilde ; B 65 0 592 722 ;
+C -1 ; WX 556 ; N aring ; B 61 -15 559 756 ;
+C -1 ; WX 500 ; N zcaron ; B 31 0 571 734 ;
+C -1 ; WX 278 ; N Icircumflex ; B 91 0 452 929 ;
+C -1 ; WX 722 ; N Ntilde ; B 76 0 799 917 ;
+C -1 ; WX 556 ; N ucircumflex ; B 94 -15 600 734 ;
+C -1 ; WX 667 ; N Ecircumflex ; B 86 0 762 929 ;
+C -1 ; WX 278 ; N Iacute ; B 91 0 489 929 ;
+C -1 ; WX 722 ; N Ccedilla ; B 108 -225 782 737 ;
+C -1 ; WX 778 ; N Odieresis ; B 105 -19 826 901 ;
+C -1 ; WX 667 ; N Scaron ; B 90 -19 713 929 ;
+C -1 ; WX 667 ; N Edieresis ; B 86 0 762 901 ;
+C -1 ; WX 278 ; N Igrave ; B 91 0 351 929 ;
+C -1 ; WX 556 ; N adieresis ; B 61 -15 559 706 ;
+C -1 ; WX 778 ; N Ograve ; B 105 -19 826 929 ;
+C -1 ; WX 667 ; N Egrave ; B 86 0 762 929 ;
+C -1 ; WX 667 ; N Ydieresis ; B 167 0 806 901 ;
+C -1 ; WX 737 ; N registered ; B 54 -19 837 737 ;
+C -1 ; WX 778 ; N Otilde ; B 105 -19 826 917 ;
+C -1 ; WX 834 ; N onequarter ; B 150 -19 802 703 ;
+C -1 ; WX 722 ; N Ugrave ; B 123 -19 797 929 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 123 -19 797 929 ;
+C -1 ; WX 667 ; N Thorn ; B 86 0 712 718 ;
+C -1 ; WX 584 ; N divide ; B 85 -19 606 524 ;
+C -1 ; WX 667 ; N Atilde ; B 14 0 699 917 ;
+C -1 ; WX 722 ; N Uacute ; B 123 -19 797 929 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 105 -19 826 929 ;
+C -1 ; WX 584 ; N logicalnot ; B 106 108 628 390 ;
+C -1 ; WX 667 ; N Aring ; B 14 0 654 931 ;
+C -1 ; WX 278 ; N idieresis ; B 95 0 416 706 ;
+C -1 ; WX 278 ; N iacute ; B 95 0 448 734 ;
+C -1 ; WX 556 ; N aacute ; B 61 -15 587 734 ;
+C -1 ; WX 584 ; N plusminus ; B 39 0 618 506 ;
+C -1 ; WX 584 ; N multiply ; B 50 0 642 506 ;
+C -1 ; WX 722 ; N Udieresis ; B 123 -19 797 901 ;
+C -1 ; WX 584 ; N minus ; B 85 216 606 289 ;
+C -1 ; WX 333 ; N onesuperior ; B 166 281 371 703 ;
+C -1 ; WX 667 ; N Eacute ; B 86 0 762 929 ;
+C -1 ; WX 667 ; N Acircumflex ; B 14 0 654 929 ;
+C -1 ; WX 737 ; N copyright ; B 54 -19 837 737 ;
+C -1 ; WX 667 ; N Agrave ; B 14 0 654 929 ;
+C -1 ; WX 556 ; N odieresis ; B 83 -14 585 706 ;
+C -1 ; WX 556 ; N oacute ; B 83 -14 587 734 ;
+C -1 ; WX 400 ; N degree ; B 169 411 468 703 ;
+C -1 ; WX 278 ; N igrave ; B 95 0 310 734 ;
+C -1 ; WX 556 ; N mu ; B 24 -207 600 523 ;
+C -1 ; WX 778 ; N Oacute ; B 105 -19 826 929 ;
+C -1 ; WX 556 ; N eth ; B 81 -15 617 737 ;
+C -1 ; WX 667 ; N Adieresis ; B 14 0 654 901 ;
+C -1 ; WX 667 ; N Yacute ; B 167 0 806 929 ;
+C -1 ; WX 260 ; N brokenbar ; B 90 -19 324 737 ;
+C -1 ; WX 834 ; N onehalf ; B 114 -19 839 703 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 250
+
+KPX A y -40
+KPX A w -40
+KPX A v -40
+KPX A u -30
+KPX A Y -100
+KPX A W -50
+KPX A V -70
+KPX A U -50
+KPX A T -120
+KPX A Q -30
+KPX A O -30
+KPX A G -30
+KPX A C -30
+
+KPX B period -20
+KPX B comma -20
+KPX B U -10
+
+KPX C period -30
+KPX C comma -30
+
+KPX D period -70
+KPX D comma -70
+KPX D Y -90
+KPX D W -40
+KPX D V -70
+KPX D A -40
+
+KPX F r -45
+KPX F period -150
+KPX F o -30
+KPX F e -30
+KPX F comma -150
+KPX F a -50
+KPX F A -80
+
+KPX J u -20
+KPX J period -30
+KPX J comma -30
+KPX J a -20
+KPX J A -20
+
+KPX K y -50
+KPX K u -30
+KPX K o -40
+KPX K e -40
+KPX K O -50
+
+KPX L y -30
+KPX L quoteright -160
+KPX L quotedblright -140
+KPX L Y -140
+KPX L W -70
+KPX L V -110
+KPX L T -110
+
+KPX O period -40
+KPX O comma -40
+KPX O Y -70
+KPX O X -60
+KPX O W -30
+KPX O V -50
+KPX O T -40
+KPX O A -20
+
+KPX P period -180
+KPX P o -50
+KPX P e -50
+KPX P comma -180
+KPX P a -40
+KPX P A -120
+
+KPX Q U -10
+
+KPX R Y -50
+KPX R W -30
+KPX R V -50
+KPX R U -40
+KPX R T -30
+KPX R O -20
+
+KPX S period -20
+KPX S comma -20
+
+KPX T y -120
+KPX T w -120
+KPX T u -120
+KPX T semicolon -20
+KPX T r -120
+KPX T period -120
+KPX T o -120
+KPX T hyphen -140
+KPX T e -120
+KPX T comma -120
+KPX T colon -20
+KPX T a -120
+KPX T O -40
+KPX T A -120
+
+KPX U period -40
+KPX U comma -40
+KPX U A -40
+
+KPX V u -70
+KPX V semicolon -40
+KPX V period -125
+KPX V o -80
+KPX V hyphen -80
+KPX V e -80
+KPX V comma -125
+KPX V colon -40
+KPX V a -70
+KPX V O -40
+KPX V G -40
+KPX V A -80
+
+KPX W y -20
+KPX W u -30
+KPX W period -80
+KPX W o -30
+KPX W hyphen -40
+KPX W e -30
+KPX W comma -80
+KPX W a -40
+KPX W O -20
+KPX W A -50
+
+KPX Y u -110
+KPX Y semicolon -60
+KPX Y period -140
+KPX Y o -140
+KPX Y i -20
+KPX Y hyphen -140
+KPX Y e -140
+KPX Y comma -140
+KPX Y colon -60
+KPX Y a -140
+KPX Y O -85
+KPX Y A -110
+
+KPX a y -30
+KPX a w -20
+KPX a v -20
+
+KPX b y -20
+KPX b v -20
+KPX b u -20
+KPX b period -40
+KPX b l -20
+KPX b comma -40
+KPX b b -10
+
+KPX c k -20
+KPX c comma -15
+
+KPX colon space -50
+
+KPX comma quoteright -100
+KPX comma quotedblright -100
+
+KPX e y -20
+KPX e x -30
+KPX e w -20
+KPX e v -30
+KPX e period -15
+KPX e comma -15
+
+KPX f quoteright 50
+KPX f quotedblright 60
+KPX f period -30
+KPX f o -30
+KPX f e -30
+KPX f dotlessi -28
+KPX f comma -30
+KPX f a -30
+
+KPX g r -10
+
+KPX h y -30
+
+KPX k o -20
+KPX k e -20
+
+KPX m y -15
+KPX m u -10
+
+KPX n y -15
+KPX n v -20
+KPX n u -10
+
+KPX o y -30
+KPX o x -30
+KPX o w -15
+KPX o v -15
+KPX o period -40
+KPX o comma -40
+
+KPX oslash z -55
+KPX oslash y -70
+KPX oslash x -85
+KPX oslash w -70
+KPX oslash v -70
+KPX oslash u -55
+KPX oslash t -55
+KPX oslash s -55
+KPX oslash r -55
+KPX oslash q -55
+KPX oslash period -95
+KPX oslash p -55
+KPX oslash o -55
+KPX oslash n -55
+KPX oslash m -55
+KPX oslash l -55
+KPX oslash k -55
+KPX oslash j -55
+KPX oslash i -55
+KPX oslash h -55
+KPX oslash g -55
+KPX oslash f -55
+KPX oslash e -55
+KPX oslash d -55
+KPX oslash comma -95
+KPX oslash c -55
+KPX oslash b -55
+KPX oslash a -55
+
+KPX p y -30
+KPX p period -35
+KPX p comma -35
+
+KPX period space -60
+KPX period quoteright -100
+KPX period quotedblright -100
+
+KPX quotedblright space -40
+
+KPX quoteleft quoteleft -57
+
+KPX quoteright space -70
+KPX quoteright s -50
+KPX quoteright r -50
+KPX quoteright quoteright -57
+KPX quoteright d -50
+
+KPX r y 30
+KPX r v 30
+KPX r u 15
+KPX r t 40
+KPX r semicolon 30
+KPX r period -50
+KPX r p 30
+KPX r n 25
+KPX r m 25
+KPX r l 15
+KPX r k 15
+KPX r i 15
+KPX r comma -50
+KPX r colon 30
+KPX r a -10
+
+KPX s w -30
+KPX s period -15
+KPX s comma -15
+
+KPX semicolon space -50
+
+KPX space quoteleft -60
+KPX space quotedblleft -30
+KPX space Y -90
+KPX space W -40
+KPX space V -50
+KPX space T -50
+
+KPX v period -80
+KPX v o -25
+KPX v e -25
+KPX v comma -80
+KPX v a -25
+
+KPX w period -60
+KPX w o -10
+KPX w e -10
+KPX w comma -60
+KPX w a -15
+
+KPX x e -30
+
+KPX y period -100
+KPX y o -20
+KPX y e -20
+KPX y comma -100
+KPX y a -20
+
+KPX z o -15
+KPX z e -15
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 208 195 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 208 195 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 208 195 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 208 195 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 204 175 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 208 195 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 195 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 208 195 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 208 195 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 208 195 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 208 195 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 14 195 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 14 195 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 14 195 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 14 195 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 246 195 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 264 195 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 264 195 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 264 195 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 264 195 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 264 195 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 208 195 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 236 195 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 236 195 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 236 195 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 236 195 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 208 195 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 208 195 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 180 195 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 112 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 112 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 112 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 112 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 112 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 102 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 84 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 112 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 112 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 112 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 112 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -27 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -27 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -27 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -27 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 102 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 112 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 112 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 112 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 112 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 112 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 84 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 112 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 112 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 112 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 112 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 84 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 84 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 84 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvro8an.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvro8an.afm
new file mode 100644
index 0000000..f757319
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/phvro8an.afm
@@ -0,0 +1,612 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights reserved.
+Comment Creation Date: Thu Mar 15 11:25:48 1990
+Comment UniqueID 28389
+Comment VMusage 7572 42473
+FontName Helvetica-Narrow-Oblique
+FullName Helvetica Narrow Oblique
+FamilyName Helvetica
+Weight Medium
+ItalicAngle -12
+IsFixedPitch false
+FontBBox -139 -225 915 931
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.006
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights reserved.Helvetica is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 718
+XHeight 523
+Ascender 718
+Descender -207
+StartCharMetrics 228
+C 32 ; WX 228 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 228 ; N exclam ; B 74 0 278 718 ;
+C 34 ; WX 291 ; N quotedbl ; B 138 463 359 718 ;
+C 35 ; WX 456 ; N numbersign ; B 60 0 517 688 ;
+C 36 ; WX 456 ; N dollar ; B 57 -115 506 775 ;
+C 37 ; WX 729 ; N percent ; B 120 -19 729 703 ;
+C 38 ; WX 547 ; N ampersand ; B 63 -15 530 718 ;
+C 39 ; WX 182 ; N quoteright ; B 124 463 254 718 ;
+C 40 ; WX 273 ; N parenleft ; B 89 -207 372 733 ;
+C 41 ; WX 273 ; N parenright ; B -7 -207 276 733 ;
+C 42 ; WX 319 ; N asterisk ; B 135 431 389 718 ;
+C 43 ; WX 479 ; N plus ; B 70 0 497 505 ;
+C 44 ; WX 228 ; N comma ; B 46 -147 175 106 ;
+C 45 ; WX 273 ; N hyphen ; B 77 232 293 322 ;
+C 46 ; WX 228 ; N period ; B 71 0 175 106 ;
+C 47 ; WX 228 ; N slash ; B -17 -19 370 737 ;
+C 48 ; WX 456 ; N zero ; B 77 -19 499 703 ;
+C 49 ; WX 456 ; N one ; B 170 0 417 703 ;
+C 50 ; WX 456 ; N two ; B 21 0 506 703 ;
+C 51 ; WX 456 ; N three ; B 61 -19 500 703 ;
+C 52 ; WX 456 ; N four ; B 50 0 472 703 ;
+C 53 ; WX 456 ; N five ; B 55 -19 509 688 ;
+C 54 ; WX 456 ; N six ; B 74 -19 504 703 ;
+C 55 ; WX 456 ; N seven ; B 112 0 549 688 ;
+C 56 ; WX 456 ; N eight ; B 60 -19 497 703 ;
+C 57 ; WX 456 ; N nine ; B 67 -19 499 703 ;
+C 58 ; WX 228 ; N colon ; B 71 0 247 516 ;
+C 59 ; WX 228 ; N semicolon ; B 46 -147 247 516 ;
+C 60 ; WX 479 ; N less ; B 77 11 526 495 ;
+C 61 ; WX 479 ; N equal ; B 52 115 515 390 ;
+C 62 ; WX 479 ; N greater ; B 41 11 490 495 ;
+C 63 ; WX 456 ; N question ; B 132 0 500 727 ;
+C 64 ; WX 832 ; N at ; B 176 -19 791 737 ;
+C 65 ; WX 547 ; N A ; B 11 0 536 718 ;
+C 66 ; WX 547 ; N B ; B 61 0 583 718 ;
+C 67 ; WX 592 ; N C ; B 88 -19 640 737 ;
+C 68 ; WX 592 ; N D ; B 66 0 626 718 ;
+C 69 ; WX 547 ; N E ; B 71 0 625 718 ;
+C 70 ; WX 501 ; N F ; B 71 0 603 718 ;
+C 71 ; WX 638 ; N G ; B 91 -19 655 737 ;
+C 72 ; WX 592 ; N H ; B 63 0 655 718 ;
+C 73 ; WX 228 ; N I ; B 75 0 279 718 ;
+C 74 ; WX 410 ; N J ; B 39 -19 476 718 ;
+C 75 ; WX 547 ; N K ; B 62 0 662 718 ;
+C 76 ; WX 456 ; N L ; B 62 0 455 718 ;
+C 77 ; WX 683 ; N M ; B 60 0 749 718 ;
+C 78 ; WX 592 ; N N ; B 62 0 655 718 ;
+C 79 ; WX 638 ; N O ; B 86 -19 677 737 ;
+C 80 ; WX 547 ; N P ; B 71 0 604 718 ;
+C 81 ; WX 638 ; N Q ; B 86 -56 677 737 ;
+C 82 ; WX 592 ; N R ; B 72 0 634 718 ;
+C 83 ; WX 547 ; N S ; B 74 -19 584 737 ;
+C 84 ; WX 501 ; N T ; B 122 0 615 718 ;
+C 85 ; WX 592 ; N U ; B 101 -19 653 718 ;
+C 86 ; WX 547 ; N V ; B 142 0 656 718 ;
+C 87 ; WX 774 ; N W ; B 138 0 886 718 ;
+C 88 ; WX 547 ; N X ; B 16 0 647 718 ;
+C 89 ; WX 547 ; N Y ; B 137 0 661 718 ;
+C 90 ; WX 501 ; N Z ; B 19 0 607 718 ;
+C 91 ; WX 228 ; N bracketleft ; B 17 -196 331 722 ;
+C 92 ; WX 228 ; N backslash ; B 115 -19 239 737 ;
+C 93 ; WX 228 ; N bracketright ; B -11 -196 302 722 ;
+C 94 ; WX 385 ; N asciicircum ; B 35 264 442 688 ;
+C 95 ; WX 456 ; N underscore ; B -22 -125 443 -75 ;
+C 96 ; WX 182 ; N quoteleft ; B 135 470 265 725 ;
+C 97 ; WX 456 ; N a ; B 50 -15 458 538 ;
+C 98 ; WX 456 ; N b ; B 48 -15 479 718 ;
+C 99 ; WX 410 ; N c ; B 61 -15 454 538 ;
+C 100 ; WX 456 ; N d ; B 69 -15 534 718 ;
+C 101 ; WX 456 ; N e ; B 69 -15 474 538 ;
+C 102 ; WX 228 ; N f ; B 71 0 341 728 ; L i fi ; L l fl ;
+C 103 ; WX 456 ; N g ; B 34 -220 500 538 ;
+C 104 ; WX 456 ; N h ; B 53 0 470 718 ;
+C 105 ; WX 182 ; N i ; B 55 0 252 718 ;
+C 106 ; WX 182 ; N j ; B -49 -210 252 718 ;
+C 107 ; WX 410 ; N k ; B 55 0 492 718 ;
+C 108 ; WX 182 ; N l ; B 55 0 252 718 ;
+C 109 ; WX 683 ; N m ; B 53 0 699 538 ;
+C 110 ; WX 456 ; N n ; B 53 0 470 538 ;
+C 111 ; WX 456 ; N o ; B 68 -14 479 538 ;
+C 112 ; WX 456 ; N p ; B 11 -207 479 538 ;
+C 113 ; WX 456 ; N q ; B 69 -207 496 538 ;
+C 114 ; WX 273 ; N r ; B 63 0 365 538 ;
+C 115 ; WX 410 ; N s ; B 52 -15 434 538 ;
+C 116 ; WX 228 ; N t ; B 84 -7 302 669 ;
+C 117 ; WX 456 ; N u ; B 77 -15 492 523 ;
+C 118 ; WX 410 ; N v ; B 98 0 495 523 ;
+C 119 ; WX 592 ; N w ; B 103 0 673 523 ;
+C 120 ; WX 410 ; N x ; B 9 0 487 523 ;
+C 121 ; WX 410 ; N y ; B 12 -214 492 523 ;
+C 122 ; WX 410 ; N z ; B 25 0 468 523 ;
+C 123 ; WX 274 ; N braceleft ; B 75 -196 365 722 ;
+C 124 ; WX 213 ; N bar ; B 74 -19 265 737 ;
+C 125 ; WX 274 ; N braceright ; B 0 -196 291 722 ;
+C 126 ; WX 479 ; N asciitilde ; B 91 180 476 326 ;
+C 161 ; WX 273 ; N exclamdown ; B 63 -195 267 523 ;
+C 162 ; WX 456 ; N cent ; B 78 -115 479 623 ;
+C 163 ; WX 456 ; N sterling ; B 40 -16 520 718 ;
+C 164 ; WX 137 ; N fraction ; B -139 -19 396 703 ;
+C 165 ; WX 456 ; N yen ; B 67 0 573 688 ;
+C 166 ; WX 456 ; N florin ; B -43 -207 537 737 ;
+C 167 ; WX 456 ; N section ; B 63 -191 479 737 ;
+C 168 ; WX 456 ; N currency ; B 49 99 530 603 ;
+C 169 ; WX 157 ; N quotesingle ; B 129 463 233 718 ;
+C 170 ; WX 273 ; N quotedblleft ; B 113 470 378 725 ;
+C 171 ; WX 456 ; N guillemotleft ; B 120 108 454 446 ;
+C 172 ; WX 273 ; N guilsinglleft ; B 112 108 279 446 ;
+C 173 ; WX 273 ; N guilsinglright ; B 91 108 257 446 ;
+C 174 ; WX 410 ; N fi ; B 71 0 481 728 ;
+C 175 ; WX 410 ; N fl ; B 71 0 479 728 ;
+C 177 ; WX 456 ; N endash ; B 42 240 510 313 ;
+C 178 ; WX 456 ; N dagger ; B 110 -159 510 718 ;
+C 179 ; WX 456 ; N daggerdbl ; B 43 -159 511 718 ;
+C 180 ; WX 228 ; N periodcentered ; B 106 190 211 315 ;
+C 182 ; WX 440 ; N paragraph ; B 103 -173 533 718 ;
+C 183 ; WX 287 ; N bullet ; B 74 202 339 517 ;
+C 184 ; WX 182 ; N quotesinglbase ; B 17 -149 147 106 ;
+C 185 ; WX 273 ; N quotedblbase ; B -5 -149 260 106 ;
+C 186 ; WX 273 ; N quotedblright ; B 102 463 367 718 ;
+C 187 ; WX 456 ; N guillemotright ; B 98 108 433 446 ;
+C 188 ; WX 820 ; N ellipsis ; B 94 0 744 106 ;
+C 189 ; WX 820 ; N perthousand ; B 72 -19 844 703 ;
+C 191 ; WX 501 ; N questiondown ; B 70 -201 438 525 ;
+C 193 ; WX 273 ; N grave ; B 139 593 276 734 ;
+C 194 ; WX 273 ; N acute ; B 203 593 390 734 ;
+C 195 ; WX 273 ; N circumflex ; B 121 593 359 734 ;
+C 196 ; WX 273 ; N tilde ; B 102 606 402 722 ;
+C 197 ; WX 273 ; N macron ; B 117 627 384 684 ;
+C 198 ; WX 273 ; N breve ; B 137 595 391 731 ;
+C 199 ; WX 273 ; N dotaccent ; B 204 604 297 706 ;
+C 200 ; WX 273 ; N dieresis ; B 138 604 363 706 ;
+C 202 ; WX 273 ; N ring ; B 175 572 330 756 ;
+C 203 ; WX 273 ; N cedilla ; B 2 -225 191 0 ;
+C 205 ; WX 273 ; N hungarumlaut ; B 129 593 463 734 ;
+C 206 ; WX 273 ; N ogonek ; B 35 -225 204 0 ;
+C 207 ; WX 273 ; N caron ; B 145 593 384 734 ;
+C 208 ; WX 820 ; N emdash ; B 42 240 875 313 ;
+C 225 ; WX 820 ; N AE ; B 7 0 899 718 ;
+C 227 ; WX 303 ; N ordfeminine ; B 82 304 368 737 ;
+C 232 ; WX 456 ; N Lslash ; B 34 0 455 718 ;
+C 233 ; WX 638 ; N Oslash ; B 35 -19 730 737 ;
+C 234 ; WX 820 ; N OE ; B 80 -19 915 737 ;
+C 235 ; WX 299 ; N ordmasculine ; B 82 304 384 737 ;
+C 241 ; WX 729 ; N ae ; B 50 -15 746 538 ;
+C 245 ; WX 228 ; N dotlessi ; B 78 0 241 523 ;
+C 248 ; WX 182 ; N lslash ; B 34 0 284 718 ;
+C 249 ; WX 501 ; N oslash ; B 24 -22 531 545 ;
+C 250 ; WX 774 ; N oe ; B 68 -15 791 538 ;
+C 251 ; WX 501 ; N germandbls ; B 55 -15 539 728 ;
+C -1 ; WX 501 ; N Zcaron ; B 19 0 607 929 ;
+C -1 ; WX 410 ; N ccedilla ; B 61 -225 454 538 ;
+C -1 ; WX 410 ; N ydieresis ; B 12 -214 492 706 ;
+C -1 ; WX 456 ; N atilde ; B 50 -15 486 722 ;
+C -1 ; WX 228 ; N icircumflex ; B 78 0 337 734 ;
+C -1 ; WX 273 ; N threesuperior ; B 74 270 358 703 ;
+C -1 ; WX 456 ; N ecircumflex ; B 69 -15 474 734 ;
+C -1 ; WX 456 ; N thorn ; B 11 -207 479 718 ;
+C -1 ; WX 456 ; N egrave ; B 69 -15 474 734 ;
+C -1 ; WX 273 ; N twosuperior ; B 52 281 368 703 ;
+C -1 ; WX 456 ; N eacute ; B 69 -15 481 734 ;
+C -1 ; WX 456 ; N otilde ; B 68 -14 494 722 ;
+C -1 ; WX 547 ; N Aacute ; B 11 0 560 929 ;
+C -1 ; WX 456 ; N ocircumflex ; B 68 -14 479 734 ;
+C -1 ; WX 410 ; N yacute ; B 12 -214 492 734 ;
+C -1 ; WX 456 ; N udieresis ; B 77 -15 492 706 ;
+C -1 ; WX 684 ; N threequarters ; B 106 -19 706 703 ;
+C -1 ; WX 456 ; N acircumflex ; B 50 -15 458 734 ;
+C -1 ; WX 592 ; N Eth ; B 57 0 626 718 ;
+C -1 ; WX 456 ; N edieresis ; B 69 -15 474 706 ;
+C -1 ; WX 456 ; N ugrave ; B 77 -15 492 734 ;
+C -1 ; WX 820 ; N trademark ; B 152 306 866 718 ;
+C -1 ; WX 456 ; N ograve ; B 68 -14 479 734 ;
+C -1 ; WX 410 ; N scaron ; B 52 -15 453 734 ;
+C -1 ; WX 228 ; N Idieresis ; B 75 0 375 901 ;
+C -1 ; WX 456 ; N uacute ; B 77 -15 492 734 ;
+C -1 ; WX 456 ; N agrave ; B 50 -15 458 734 ;
+C -1 ; WX 456 ; N ntilde ; B 53 0 486 722 ;
+C -1 ; WX 456 ; N aring ; B 50 -15 458 756 ;
+C -1 ; WX 410 ; N zcaron ; B 25 0 468 734 ;
+C -1 ; WX 228 ; N Icircumflex ; B 75 0 371 929 ;
+C -1 ; WX 592 ; N Ntilde ; B 62 0 655 917 ;
+C -1 ; WX 456 ; N ucircumflex ; B 77 -15 492 734 ;
+C -1 ; WX 547 ; N Ecircumflex ; B 71 0 625 929 ;
+C -1 ; WX 228 ; N Iacute ; B 75 0 401 929 ;
+C -1 ; WX 592 ; N Ccedilla ; B 88 -225 640 737 ;
+C -1 ; WX 638 ; N Odieresis ; B 86 -19 677 901 ;
+C -1 ; WX 547 ; N Scaron ; B 74 -19 584 929 ;
+C -1 ; WX 547 ; N Edieresis ; B 71 0 625 901 ;
+C -1 ; WX 228 ; N Igrave ; B 75 0 288 929 ;
+C -1 ; WX 456 ; N adieresis ; B 50 -15 458 706 ;
+C -1 ; WX 638 ; N Ograve ; B 86 -19 677 929 ;
+C -1 ; WX 547 ; N Egrave ; B 71 0 625 929 ;
+C -1 ; WX 547 ; N Ydieresis ; B 137 0 661 901 ;
+C -1 ; WX 604 ; N registered ; B 44 -19 687 737 ;
+C -1 ; WX 638 ; N Otilde ; B 86 -19 677 917 ;
+C -1 ; WX 684 ; N onequarter ; B 123 -19 658 703 ;
+C -1 ; WX 592 ; N Ugrave ; B 101 -19 653 929 ;
+C -1 ; WX 592 ; N Ucircumflex ; B 101 -19 653 929 ;
+C -1 ; WX 547 ; N Thorn ; B 71 0 584 718 ;
+C -1 ; WX 479 ; N divide ; B 70 -19 497 524 ;
+C -1 ; WX 547 ; N Atilde ; B 11 0 573 917 ;
+C -1 ; WX 592 ; N Uacute ; B 101 -19 653 929 ;
+C -1 ; WX 638 ; N Ocircumflex ; B 86 -19 677 929 ;
+C -1 ; WX 479 ; N logicalnot ; B 87 108 515 390 ;
+C -1 ; WX 547 ; N Aring ; B 11 0 536 931 ;
+C -1 ; WX 228 ; N idieresis ; B 78 0 341 706 ;
+C -1 ; WX 228 ; N iacute ; B 78 0 367 734 ;
+C -1 ; WX 456 ; N aacute ; B 50 -15 481 734 ;
+C -1 ; WX 479 ; N plusminus ; B 32 0 507 506 ;
+C -1 ; WX 479 ; N multiply ; B 41 0 526 506 ;
+C -1 ; WX 592 ; N Udieresis ; B 101 -19 653 901 ;
+C -1 ; WX 479 ; N minus ; B 70 216 497 289 ;
+C -1 ; WX 273 ; N onesuperior ; B 136 281 305 703 ;
+C -1 ; WX 547 ; N Eacute ; B 71 0 625 929 ;
+C -1 ; WX 547 ; N Acircumflex ; B 11 0 536 929 ;
+C -1 ; WX 604 ; N copyright ; B 44 -19 687 737 ;
+C -1 ; WX 547 ; N Agrave ; B 11 0 536 929 ;
+C -1 ; WX 456 ; N odieresis ; B 68 -14 479 706 ;
+C -1 ; WX 456 ; N oacute ; B 68 -14 481 734 ;
+C -1 ; WX 328 ; N degree ; B 138 411 384 703 ;
+C -1 ; WX 228 ; N igrave ; B 78 0 254 734 ;
+C -1 ; WX 456 ; N mu ; B 20 -207 492 523 ;
+C -1 ; WX 638 ; N Oacute ; B 86 -19 677 929 ;
+C -1 ; WX 456 ; N eth ; B 67 -15 506 737 ;
+C -1 ; WX 547 ; N Adieresis ; B 11 0 536 901 ;
+C -1 ; WX 547 ; N Yacute ; B 137 0 661 929 ;
+C -1 ; WX 213 ; N brokenbar ; B 74 -19 265 737 ;
+C -1 ; WX 684 ; N onehalf ; B 93 -19 688 703 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 250
+
+KPX A y -40
+KPX A w -40
+KPX A v -40
+KPX A u -30
+KPX A Y -100
+KPX A W -50
+KPX A V -70
+KPX A U -50
+KPX A T -120
+KPX A Q -30
+KPX A O -30
+KPX A G -30
+KPX A C -30
+
+KPX B period -20
+KPX B comma -20
+KPX B U -10
+
+KPX C period -30
+KPX C comma -30
+
+KPX D period -70
+KPX D comma -70
+KPX D Y -90
+KPX D W -40
+KPX D V -70
+KPX D A -40
+
+KPX F r -45
+KPX F period -150
+KPX F o -30
+KPX F e -30
+KPX F comma -150
+KPX F a -50
+KPX F A -80
+
+KPX J u -20
+KPX J period -30
+KPX J comma -30
+KPX J a -20
+KPX J A -20
+
+KPX K y -50
+KPX K u -30
+KPX K o -40
+KPX K e -40
+KPX K O -50
+
+KPX L y -30
+KPX L quoteright -160
+KPX L quotedblright -140
+KPX L Y -140
+KPX L W -70
+KPX L V -110
+KPX L T -110
+
+KPX O period -40
+KPX O comma -40
+KPX O Y -70
+KPX O X -60
+KPX O W -30
+KPX O V -50
+KPX O T -40
+KPX O A -20
+
+KPX P period -180
+KPX P o -50
+KPX P e -50
+KPX P comma -180
+KPX P a -40
+KPX P A -120
+
+KPX Q U -10
+
+KPX R Y -50
+KPX R W -30
+KPX R V -50
+KPX R U -40
+KPX R T -30
+KPX R O -20
+
+KPX S period -20
+KPX S comma -20
+
+KPX T y -120
+KPX T w -120
+KPX T u -120
+KPX T semicolon -20
+KPX T r -120
+KPX T period -120
+KPX T o -120
+KPX T hyphen -140
+KPX T e -120
+KPX T comma -120
+KPX T colon -20
+KPX T a -120
+KPX T O -40
+KPX T A -120
+
+KPX U period -40
+KPX U comma -40
+KPX U A -40
+
+KPX V u -70
+KPX V semicolon -40
+KPX V period -125
+KPX V o -80
+KPX V hyphen -80
+KPX V e -80
+KPX V comma -125
+KPX V colon -40
+KPX V a -70
+KPX V O -40
+KPX V G -40
+KPX V A -80
+
+KPX W y -20
+KPX W u -30
+KPX W period -80
+KPX W o -30
+KPX W hyphen -40
+KPX W e -30
+KPX W comma -80
+KPX W a -40
+KPX W O -20
+KPX W A -50
+
+KPX Y u -110
+KPX Y semicolon -60
+KPX Y period -140
+KPX Y o -140
+KPX Y i -20
+KPX Y hyphen -140
+KPX Y e -140
+KPX Y comma -140
+KPX Y colon -60
+KPX Y a -140
+KPX Y O -85
+KPX Y A -110
+
+KPX a y -30
+KPX a w -20
+KPX a v -20
+
+KPX b y -20
+KPX b v -20
+KPX b u -20
+KPX b period -40
+KPX b l -20
+KPX b comma -40
+KPX b b -10
+
+KPX c k -20
+KPX c comma -15
+
+KPX colon space -50
+
+KPX comma quoteright -100
+KPX comma quotedblright -100
+
+KPX e y -20
+KPX e x -30
+KPX e w -20
+KPX e v -30
+KPX e period -15
+KPX e comma -15
+
+KPX f quoteright 50
+KPX f quotedblright 60
+KPX f period -30
+KPX f o -30
+KPX f e -30
+KPX f dotlessi -28
+KPX f comma -30
+KPX f a -30
+
+KPX g r -10
+
+KPX h y -30
+
+KPX k o -20
+KPX k e -20
+
+KPX m y -15
+KPX m u -10
+
+KPX n y -15
+KPX n v -20
+KPX n u -10
+
+KPX o y -30
+KPX o x -30
+KPX o w -15
+KPX o v -15
+KPX o period -40
+KPX o comma -40
+
+KPX oslash z -55
+KPX oslash y -70
+KPX oslash x -85
+KPX oslash w -70
+KPX oslash v -70
+KPX oslash u -55
+KPX oslash t -55
+KPX oslash s -55
+KPX oslash r -55
+KPX oslash q -55
+KPX oslash period -95
+KPX oslash p -55
+KPX oslash o -55
+KPX oslash n -55
+KPX oslash m -55
+KPX oslash l -55
+KPX oslash k -55
+KPX oslash j -55
+KPX oslash i -55
+KPX oslash h -55
+KPX oslash g -55
+KPX oslash f -55
+KPX oslash e -55
+KPX oslash d -55
+KPX oslash comma -95
+KPX oslash c -55
+KPX oslash b -55
+KPX oslash a -55
+
+KPX p y -30
+KPX p period -35
+KPX p comma -35
+
+KPX period space -60
+KPX period quoteright -100
+KPX period quotedblright -100
+
+KPX quotedblright space -40
+
+KPX quoteleft quoteleft -57
+
+KPX quoteright space -70
+KPX quoteright s -50
+KPX quoteright r -50
+KPX quoteright quoteright -57
+KPX quoteright d -50
+
+KPX r y 30
+KPX r v 30
+KPX r u 15
+KPX r t 40
+KPX r semicolon 30
+KPX r period -50
+KPX r p 30
+KPX r n 25
+KPX r m 25
+KPX r l 15
+KPX r k 15
+KPX r i 15
+KPX r comma -50
+KPX r colon 30
+KPX r a -10
+
+KPX s w -30
+KPX s period -15
+KPX s comma -15
+
+KPX semicolon space -50
+
+KPX space quoteleft -60
+KPX space quotedblleft -30
+KPX space Y -90
+KPX space W -40
+KPX space V -50
+KPX space T -50
+
+KPX v period -80
+KPX v o -25
+KPX v e -25
+KPX v comma -80
+KPX v a -25
+
+KPX w period -60
+KPX w o -10
+KPX w e -10
+KPX w comma -60
+KPX w a -15
+
+KPX x e -30
+
+KPX y period -100
+KPX y o -20
+KPX y e -20
+KPX y comma -100
+KPX y a -20
+
+KPX z o -15
+KPX z e -15
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 171 195 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 171 195 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 171 195 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 171 195 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 167 175 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 171 195 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 160 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 171 195 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 171 195 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 171 195 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 171 195 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 12 195 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 12 195 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 12 195 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 12 195 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 202 195 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 217 195 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 217 195 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 217 195 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 217 195 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 217 195 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 171 195 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 194 195 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 194 195 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 194 195 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 194 195 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 171 195 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 171 195 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 148 195 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 92 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 92 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 92 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 92 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 92 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 84 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 69 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 92 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 92 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 92 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 92 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -22 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -22 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -22 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -22 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 84 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 92 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 92 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 92 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 92 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 92 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 69 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 92 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 92 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 92 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 92 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 69 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 69 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 69 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pncb8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pncb8a.afm
new file mode 100644
index 0000000..ba1fed6
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pncb8a.afm
@@ -0,0 +1,472 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1988, 1991 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Tue May 28 16:48:12 1991
+Comment UniqueID 35031
+Comment VMusage 30773 37665
+FontName NewCenturySchlbk-Bold
+FullName New Century Schoolbook Bold
+FamilyName New Century Schoolbook
+Weight Bold
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -165 -250 1000 988
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.009
+Notice Copyright (c) 1985, 1987, 1988, 1991 Adobe Systems Incorporated. All Rights Reserved.
+EncodingScheme AdobeStandardEncoding
+CapHeight 722
+XHeight 475
+Ascender 737
+Descender -205
+StartCharMetrics 228
+C 32 ; WX 287 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 296 ; N exclam ; B 53 -15 243 737 ;
+C 34 ; WX 333 ; N quotedbl ; B 0 378 333 737 ;
+C 35 ; WX 574 ; N numbersign ; B 36 0 538 690 ;
+C 36 ; WX 574 ; N dollar ; B 25 -141 549 810 ;
+C 37 ; WX 833 ; N percent ; B 14 -15 819 705 ;
+C 38 ; WX 852 ; N ampersand ; B 34 -15 818 737 ;
+C 39 ; WX 241 ; N quoteright ; B 22 378 220 737 ;
+C 40 ; WX 389 ; N parenleft ; B 77 -117 345 745 ;
+C 41 ; WX 389 ; N parenright ; B 44 -117 312 745 ;
+C 42 ; WX 500 ; N asterisk ; B 54 302 446 737 ;
+C 43 ; WX 606 ; N plus ; B 50 0 556 506 ;
+C 44 ; WX 278 ; N comma ; B 40 -184 238 175 ;
+C 45 ; WX 333 ; N hyphen ; B 42 174 291 302 ;
+C 46 ; WX 278 ; N period ; B 44 -15 234 175 ;
+C 47 ; WX 278 ; N slash ; B -42 -15 320 737 ;
+C 48 ; WX 574 ; N zero ; B 27 -15 547 705 ;
+C 49 ; WX 574 ; N one ; B 83 0 491 705 ;
+C 50 ; WX 574 ; N two ; B 19 0 531 705 ;
+C 51 ; WX 574 ; N three ; B 23 -15 531 705 ;
+C 52 ; WX 574 ; N four ; B 19 0 547 705 ;
+C 53 ; WX 574 ; N five ; B 32 -15 534 705 ;
+C 54 ; WX 574 ; N six ; B 27 -15 547 705 ;
+C 55 ; WX 574 ; N seven ; B 45 -15 547 705 ;
+C 56 ; WX 574 ; N eight ; B 27 -15 548 705 ;
+C 57 ; WX 574 ; N nine ; B 27 -15 547 705 ;
+C 58 ; WX 278 ; N colon ; B 44 -15 234 485 ;
+C 59 ; WX 278 ; N semicolon ; B 40 -184 238 485 ;
+C 60 ; WX 606 ; N less ; B 50 -9 556 515 ;
+C 61 ; WX 606 ; N equal ; B 50 103 556 403 ;
+C 62 ; WX 606 ; N greater ; B 50 -9 556 515 ;
+C 63 ; WX 500 ; N question ; B 23 -15 477 737 ;
+C 64 ; WX 747 ; N at ; B -2 -15 750 737 ;
+C 65 ; WX 759 ; N A ; B -19 0 778 737 ;
+C 66 ; WX 778 ; N B ; B 19 0 739 722 ;
+C 67 ; WX 778 ; N C ; B 39 -15 723 737 ;
+C 68 ; WX 833 ; N D ; B 19 0 794 722 ;
+C 69 ; WX 759 ; N E ; B 19 0 708 722 ;
+C 70 ; WX 722 ; N F ; B 19 0 697 722 ;
+C 71 ; WX 833 ; N G ; B 39 -15 818 737 ;
+C 72 ; WX 870 ; N H ; B 19 0 851 722 ;
+C 73 ; WX 444 ; N I ; B 29 0 415 722 ;
+C 74 ; WX 648 ; N J ; B 6 -15 642 722 ;
+C 75 ; WX 815 ; N K ; B 19 0 822 722 ;
+C 76 ; WX 722 ; N L ; B 19 0 703 722 ;
+C 77 ; WX 981 ; N M ; B 10 0 971 722 ;
+C 78 ; WX 833 ; N N ; B 5 -10 828 722 ;
+C 79 ; WX 833 ; N O ; B 39 -15 794 737 ;
+C 80 ; WX 759 ; N P ; B 24 0 735 722 ;
+C 81 ; WX 833 ; N Q ; B 39 -189 808 737 ;
+C 82 ; WX 815 ; N R ; B 19 -15 815 722 ;
+C 83 ; WX 667 ; N S ; B 51 -15 634 737 ;
+C 84 ; WX 722 ; N T ; B 16 0 706 722 ;
+C 85 ; WX 833 ; N U ; B 14 -15 825 722 ;
+C 86 ; WX 759 ; N V ; B -19 -10 778 722 ;
+C 87 ; WX 981 ; N W ; B 7 -10 974 722 ;
+C 88 ; WX 722 ; N X ; B -12 0 734 722 ;
+C 89 ; WX 722 ; N Y ; B -12 0 734 722 ;
+C 90 ; WX 667 ; N Z ; B 28 0 639 722 ;
+C 91 ; WX 389 ; N bracketleft ; B 84 -109 339 737 ;
+C 92 ; WX 606 ; N backslash ; B 122 -15 484 737 ;
+C 93 ; WX 389 ; N bracketright ; B 50 -109 305 737 ;
+C 94 ; WX 606 ; N asciicircum ; B 66 325 540 690 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 241 ; N quoteleft ; B 22 378 220 737 ;
+C 97 ; WX 611 ; N a ; B 40 -15 601 485 ;
+C 98 ; WX 648 ; N b ; B 4 -15 616 737 ;
+C 99 ; WX 556 ; N c ; B 32 -15 524 485 ;
+C 100 ; WX 667 ; N d ; B 32 -15 644 737 ;
+C 101 ; WX 574 ; N e ; B 32 -15 542 485 ;
+C 102 ; WX 389 ; N f ; B 11 0 461 737 ; L i fi ; L l fl ;
+C 103 ; WX 611 ; N g ; B 30 -205 623 535 ;
+C 104 ; WX 685 ; N h ; B 17 0 662 737 ;
+C 105 ; WX 370 ; N i ; B 26 0 338 737 ;
+C 106 ; WX 352 ; N j ; B -86 -205 271 737 ;
+C 107 ; WX 667 ; N k ; B 17 0 662 737 ;
+C 108 ; WX 352 ; N l ; B 17 0 329 737 ;
+C 109 ; WX 963 ; N m ; B 17 0 940 485 ;
+C 110 ; WX 685 ; N n ; B 17 0 662 485 ;
+C 111 ; WX 611 ; N o ; B 32 -15 579 485 ;
+C 112 ; WX 667 ; N p ; B 17 -205 629 485 ;
+C 113 ; WX 648 ; N q ; B 32 -205 638 485 ;
+C 114 ; WX 519 ; N r ; B 17 0 516 485 ;
+C 115 ; WX 500 ; N s ; B 48 -15 476 485 ;
+C 116 ; WX 426 ; N t ; B 21 -15 405 675 ;
+C 117 ; WX 685 ; N u ; B 17 -15 668 475 ;
+C 118 ; WX 611 ; N v ; B 12 -10 599 475 ;
+C 119 ; WX 889 ; N w ; B 16 -10 873 475 ;
+C 120 ; WX 611 ; N x ; B 12 0 599 475 ;
+C 121 ; WX 611 ; N y ; B 12 -205 599 475 ;
+C 122 ; WX 537 ; N z ; B 38 0 499 475 ;
+C 123 ; WX 389 ; N braceleft ; B 36 -109 313 737 ;
+C 124 ; WX 606 ; N bar ; B 249 -250 357 750 ;
+C 125 ; WX 389 ; N braceright ; B 76 -109 353 737 ;
+C 126 ; WX 606 ; N asciitilde ; B 72 160 534 346 ;
+C 161 ; WX 296 ; N exclamdown ; B 53 -205 243 547 ;
+C 162 ; WX 574 ; N cent ; B 32 -102 528 572 ;
+C 163 ; WX 574 ; N sterling ; B 16 -15 558 705 ;
+C 164 ; WX 167 ; N fraction ; B -165 -15 332 705 ;
+C 165 ; WX 574 ; N yen ; B -10 0 584 690 ;
+C 166 ; WX 574 ; N florin ; B 14 -205 548 737 ;
+C 167 ; WX 500 ; N section ; B 62 -86 438 737 ;
+C 168 ; WX 574 ; N currency ; B 27 84 547 605 ;
+C 169 ; WX 241 ; N quotesingle ; B 53 378 189 737 ;
+C 170 ; WX 481 ; N quotedblleft ; B 22 378 459 737 ;
+C 171 ; WX 500 ; N guillemotleft ; B 46 79 454 397 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 62 79 271 397 ;
+C 173 ; WX 333 ; N guilsinglright ; B 62 79 271 397 ;
+C 174 ; WX 685 ; N fi ; B 11 0 666 737 ;
+C 175 ; WX 685 ; N fl ; B 11 0 666 737 ;
+C 177 ; WX 500 ; N endash ; B 0 184 500 292 ;
+C 178 ; WX 500 ; N dagger ; B 39 -101 461 737 ;
+C 179 ; WX 500 ; N daggerdbl ; B 39 -89 461 737 ;
+C 180 ; WX 278 ; N periodcentered ; B 53 200 225 372 ;
+C 182 ; WX 747 ; N paragraph ; B 96 -71 631 722 ;
+C 183 ; WX 606 ; N bullet ; B 122 180 484 542 ;
+C 184 ; WX 241 ; N quotesinglbase ; B 22 -184 220 175 ;
+C 185 ; WX 481 ; N quotedblbase ; B 22 -184 459 175 ;
+C 186 ; WX 481 ; N quotedblright ; B 22 378 459 737 ;
+C 187 ; WX 500 ; N guillemotright ; B 46 79 454 397 ;
+C 188 ; WX 1000 ; N ellipsis ; B 72 -15 928 175 ;
+C 189 ; WX 1000 ; N perthousand ; B 7 -15 993 705 ;
+C 191 ; WX 500 ; N questiondown ; B 23 -205 477 547 ;
+C 193 ; WX 333 ; N grave ; B 2 547 249 737 ;
+C 194 ; WX 333 ; N acute ; B 84 547 331 737 ;
+C 195 ; WX 333 ; N circumflex ; B -10 547 344 725 ;
+C 196 ; WX 333 ; N tilde ; B -24 563 357 705 ;
+C 197 ; WX 333 ; N macron ; B -6 582 339 664 ;
+C 198 ; WX 333 ; N breve ; B 9 547 324 714 ;
+C 199 ; WX 333 ; N dotaccent ; B 95 552 237 694 ;
+C 200 ; WX 333 ; N dieresis ; B -12 552 345 694 ;
+C 202 ; WX 333 ; N ring ; B 58 545 274 761 ;
+C 203 ; WX 333 ; N cedilla ; B 17 -224 248 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B -16 547 431 737 ;
+C 206 ; WX 333 ; N ogonek ; B 168 -163 346 3 ;
+C 207 ; WX 333 ; N caron ; B -10 547 344 725 ;
+C 208 ; WX 1000 ; N emdash ; B 0 184 1000 292 ;
+C 225 ; WX 981 ; N AE ; B -29 0 963 722 ;
+C 227 ; WX 367 ; N ordfeminine ; B 1 407 393 705 ;
+C 232 ; WX 722 ; N Lslash ; B 19 0 703 722 ;
+C 233 ; WX 833 ; N Oslash ; B 39 -53 794 775 ;
+C 234 ; WX 1000 ; N OE ; B 0 0 982 722 ;
+C 235 ; WX 367 ; N ordmasculine ; B 1 407 366 705 ;
+C 241 ; WX 870 ; N ae ; B 32 -15 838 485 ;
+C 245 ; WX 370 ; N dotlessi ; B 26 0 338 475 ;
+C 248 ; WX 352 ; N lslash ; B 17 0 329 737 ;
+C 249 ; WX 611 ; N oslash ; B 32 -103 579 573 ;
+C 250 ; WX 907 ; N oe ; B 32 -15 875 485 ;
+C 251 ; WX 611 ; N germandbls ; B -2 -15 580 737 ;
+C -1 ; WX 574 ; N ecircumflex ; B 32 -15 542 725 ;
+C -1 ; WX 574 ; N edieresis ; B 32 -15 542 694 ;
+C -1 ; WX 611 ; N aacute ; B 40 -15 601 737 ;
+C -1 ; WX 747 ; N registered ; B -2 -15 750 737 ;
+C -1 ; WX 370 ; N icircumflex ; B 9 0 363 725 ;
+C -1 ; WX 685 ; N udieresis ; B 17 -15 668 694 ;
+C -1 ; WX 611 ; N ograve ; B 32 -15 579 737 ;
+C -1 ; WX 685 ; N uacute ; B 17 -15 668 737 ;
+C -1 ; WX 685 ; N ucircumflex ; B 17 -15 668 725 ;
+C -1 ; WX 759 ; N Aacute ; B -19 0 778 964 ;
+C -1 ; WX 370 ; N igrave ; B 21 0 338 737 ;
+C -1 ; WX 444 ; N Icircumflex ; B 29 0 415 952 ;
+C -1 ; WX 556 ; N ccedilla ; B 32 -224 524 485 ;
+C -1 ; WX 611 ; N adieresis ; B 40 -15 601 694 ;
+C -1 ; WX 759 ; N Ecircumflex ; B 19 0 708 952 ;
+C -1 ; WX 500 ; N scaron ; B 48 -15 476 725 ;
+C -1 ; WX 667 ; N thorn ; B 17 -205 629 737 ;
+C -1 ; WX 1000 ; N trademark ; B 6 317 982 722 ;
+C -1 ; WX 574 ; N egrave ; B 32 -15 542 737 ;
+C -1 ; WX 344 ; N threesuperior ; B -3 273 355 705 ;
+C -1 ; WX 537 ; N zcaron ; B 38 0 499 725 ;
+C -1 ; WX 611 ; N atilde ; B 40 -15 601 705 ;
+C -1 ; WX 611 ; N aring ; B 40 -15 601 761 ;
+C -1 ; WX 611 ; N ocircumflex ; B 32 -15 579 725 ;
+C -1 ; WX 759 ; N Edieresis ; B 19 0 708 921 ;
+C -1 ; WX 861 ; N threequarters ; B 15 -15 838 705 ;
+C -1 ; WX 611 ; N ydieresis ; B 12 -205 599 694 ;
+C -1 ; WX 611 ; N yacute ; B 12 -205 599 737 ;
+C -1 ; WX 370 ; N iacute ; B 26 0 350 737 ;
+C -1 ; WX 759 ; N Acircumflex ; B -19 0 778 952 ;
+C -1 ; WX 833 ; N Uacute ; B 14 -15 825 964 ;
+C -1 ; WX 574 ; N eacute ; B 32 -15 542 737 ;
+C -1 ; WX 833 ; N Ograve ; B 39 -15 794 964 ;
+C -1 ; WX 611 ; N agrave ; B 40 -15 601 737 ;
+C -1 ; WX 833 ; N Udieresis ; B 14 -15 825 921 ;
+C -1 ; WX 611 ; N acircumflex ; B 40 -15 601 725 ;
+C -1 ; WX 444 ; N Igrave ; B 29 0 415 964 ;
+C -1 ; WX 344 ; N twosuperior ; B -3 282 350 705 ;
+C -1 ; WX 833 ; N Ugrave ; B 14 -15 825 964 ;
+C -1 ; WX 861 ; N onequarter ; B 31 -15 838 705 ;
+C -1 ; WX 833 ; N Ucircumflex ; B 14 -15 825 952 ;
+C -1 ; WX 667 ; N Scaron ; B 51 -15 634 952 ;
+C -1 ; WX 444 ; N Idieresis ; B 29 0 415 921 ;
+C -1 ; WX 370 ; N idieresis ; B 7 0 364 694 ;
+C -1 ; WX 759 ; N Egrave ; B 19 0 708 964 ;
+C -1 ; WX 833 ; N Oacute ; B 39 -15 794 964 ;
+C -1 ; WX 606 ; N divide ; B 50 -40 556 546 ;
+C -1 ; WX 759 ; N Atilde ; B -19 0 778 932 ;
+C -1 ; WX 759 ; N Aring ; B -19 0 778 988 ;
+C -1 ; WX 833 ; N Odieresis ; B 39 -15 794 921 ;
+C -1 ; WX 759 ; N Adieresis ; B -19 0 778 921 ;
+C -1 ; WX 833 ; N Ntilde ; B 5 -10 828 932 ;
+C -1 ; WX 667 ; N Zcaron ; B 28 0 639 952 ;
+C -1 ; WX 759 ; N Thorn ; B 24 0 735 722 ;
+C -1 ; WX 444 ; N Iacute ; B 29 0 415 964 ;
+C -1 ; WX 606 ; N plusminus ; B 50 0 556 506 ;
+C -1 ; WX 606 ; N multiply ; B 65 15 541 491 ;
+C -1 ; WX 759 ; N Eacute ; B 19 0 708 964 ;
+C -1 ; WX 722 ; N Ydieresis ; B -12 0 734 921 ;
+C -1 ; WX 344 ; N onesuperior ; B 31 282 309 705 ;
+C -1 ; WX 685 ; N ugrave ; B 17 -15 668 737 ;
+C -1 ; WX 606 ; N logicalnot ; B 50 103 556 403 ;
+C -1 ; WX 685 ; N ntilde ; B 17 0 662 705 ;
+C -1 ; WX 833 ; N Otilde ; B 39 -15 794 932 ;
+C -1 ; WX 611 ; N otilde ; B 32 -15 579 705 ;
+C -1 ; WX 778 ; N Ccedilla ; B 39 -224 723 737 ;
+C -1 ; WX 759 ; N Agrave ; B -19 0 778 964 ;
+C -1 ; WX 861 ; N onehalf ; B 31 -15 838 705 ;
+C -1 ; WX 833 ; N Eth ; B 19 0 794 722 ;
+C -1 ; WX 400 ; N degree ; B 57 419 343 705 ;
+C -1 ; WX 722 ; N Yacute ; B -12 0 734 964 ;
+C -1 ; WX 833 ; N Ocircumflex ; B 39 -15 794 952 ;
+C -1 ; WX 611 ; N oacute ; B 32 -15 579 737 ;
+C -1 ; WX 685 ; N mu ; B 17 -205 668 475 ;
+C -1 ; WX 606 ; N minus ; B 50 199 556 307 ;
+C -1 ; WX 611 ; N eth ; B 32 -15 579 737 ;
+C -1 ; WX 611 ; N odieresis ; B 32 -15 579 694 ;
+C -1 ; WX 747 ; N copyright ; B -2 -15 750 737 ;
+C -1 ; WX 606 ; N brokenbar ; B 249 -175 357 675 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 128
+
+KPX A y -18
+KPX A w -18
+KPX A v -18
+KPX A quoteright -74
+KPX A quotedblright -74
+KPX A Y -91
+KPX A W -74
+KPX A V -74
+KPX A U -18
+KPX A T -55
+
+KPX C period -18
+KPX C comma -18
+
+KPX D period -25
+KPX D comma -25
+
+KPX F r -18
+KPX F period -125
+KPX F o -55
+KPX F i -18
+KPX F e -55
+KPX F comma -125
+KPX F a -74
+
+KPX J u -18
+KPX J period -55
+KPX J o -18
+KPX J e -18
+KPX J comma -55
+KPX J a -18
+KPX J A -18
+
+KPX K y -25
+KPX K u -18
+
+KPX L y -25
+KPX L quoteright -100
+KPX L quotedblright -100
+KPX L Y -74
+KPX L W -74
+KPX L V -100
+KPX L T -100
+
+KPX N period -18
+KPX N comma -18
+
+KPX O period -25
+KPX O comma -25
+KPX O T 10
+
+KPX P period -150
+KPX P o -55
+KPX P e -55
+KPX P comma -150
+KPX P a -55
+KPX P A -74
+
+KPX S period -18
+KPX S comma -18
+
+KPX T u -18
+KPX T r -18
+KPX T period -100
+KPX T o -74
+KPX T i -18
+KPX T hyphen -125
+KPX T e -74
+KPX T comma -100
+KPX T a -74
+KPX T O 10
+KPX T A -55
+
+KPX U period -25
+KPX U comma -25
+KPX U A -18
+
+KPX V u -55
+KPX V semicolon -37
+KPX V period -125
+KPX V o -74
+KPX V i -18
+KPX V hyphen -100
+KPX V e -74
+KPX V comma -125
+KPX V colon -37
+KPX V a -74
+KPX V A -74
+
+KPX W y -25
+KPX W u -37
+KPX W semicolon -55
+KPX W period -100
+KPX W o -74
+KPX W i -18
+KPX W hyphen -100
+KPX W e -74
+KPX W comma -100
+KPX W colon -55
+KPX W a -74
+KPX W A -74
+
+KPX Y u -55
+KPX Y semicolon -25
+KPX Y period -100
+KPX Y o -100
+KPX Y i -18
+KPX Y hyphen -125
+KPX Y e -100
+KPX Y comma -100
+KPX Y colon -25
+KPX Y a -100
+KPX Y A -91
+
+KPX colon space -18
+
+KPX comma space -18
+KPX comma quoteright -18
+KPX comma quotedblright -18
+
+KPX f quoteright 75
+KPX f quotedblright 75
+
+KPX period space -18
+KPX period quoteright -18
+KPX period quotedblright -18
+
+KPX quotedblleft A -74
+
+KPX quotedblright space -18
+
+KPX quoteleft A -74
+
+KPX quoteright s -25
+KPX quoteright d -25
+
+KPX r period -74
+KPX r comma -74
+
+KPX semicolon space -18
+
+KPX space quoteleft -18
+KPX space quotedblleft -18
+KPX space Y -18
+KPX space W -18
+KPX space V -18
+KPX space T -18
+KPX space A -18
+
+KPX v period -100
+KPX v comma -100
+
+KPX w period -100
+KPX w comma -100
+
+KPX y period -100
+KPX y comma -100
+EndKernPairs
+EndKernData
+StartComposites 56
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 213 227 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 213 227 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 213 227 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 213 227 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 213 227 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 213 227 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 213 227 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 213 227 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 213 227 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 213 227 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 56 227 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 56 227 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 56 227 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 56 227 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 250 227 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 250 227 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 250 227 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 250 227 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 250 227 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 250 227 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 167 227 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 250 227 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 250 227 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 250 227 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 250 227 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 195 227 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 195 227 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 167 227 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 139 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 139 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 139 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 139 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 139 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 139 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 121 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 121 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 121 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 121 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute 19 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex 19 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis 19 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave 19 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 176 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 139 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 139 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 139 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 139 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 139 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 84 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 176 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 176 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 176 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 176 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 139 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 139 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 102 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pncbi8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pncbi8a.afm
new file mode 100644
index 0000000..7871147
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pncbi8a.afm
@@ -0,0 +1,602 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Tue May 28 16:56:07 1991
+Comment UniqueID 35034
+Comment VMusage 31030 37922
+FontName NewCenturySchlbk-BoldItalic
+FullName New Century Schoolbook Bold Italic
+FamilyName New Century Schoolbook
+Weight Bold
+ItalicAngle -16
+IsFixedPitch false
+FontBBox -205 -250 1147 991
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.007
+Notice Copyright (c) 1985, 1987, 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.
+EncodingScheme AdobeStandardEncoding
+CapHeight 722
+XHeight 477
+Ascender 737
+Descender -205
+StartCharMetrics 228
+C 32 ; WX 287 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 0 -15 333 737 ;
+C 34 ; WX 400 ; N quotedbl ; B 66 388 428 737 ;
+C 35 ; WX 574 ; N numbersign ; B 30 0 544 690 ;
+C 36 ; WX 574 ; N dollar ; B 9 -120 565 810 ;
+C 37 ; WX 889 ; N percent ; B 54 -28 835 727 ;
+C 38 ; WX 889 ; N ampersand ; B 32 -15 823 737 ;
+C 39 ; WX 259 ; N quoteright ; B 48 388 275 737 ;
+C 40 ; WX 407 ; N parenleft ; B 72 -117 454 745 ;
+C 41 ; WX 407 ; N parenright ; B -70 -117 310 745 ;
+C 42 ; WX 500 ; N asterisk ; B 58 301 498 737 ;
+C 43 ; WX 606 ; N plus ; B 50 0 556 506 ;
+C 44 ; WX 287 ; N comma ; B -57 -192 170 157 ;
+C 45 ; WX 333 ; N hyphen ; B 2 177 263 299 ;
+C 46 ; WX 287 ; N period ; B -20 -15 152 157 ;
+C 47 ; WX 278 ; N slash ; B -41 -15 320 737 ;
+C 48 ; WX 574 ; N zero ; B 21 -15 553 705 ;
+C 49 ; WX 574 ; N one ; B 25 0 489 705 ;
+C 50 ; WX 574 ; N two ; B -38 -3 538 705 ;
+C 51 ; WX 574 ; N three ; B -7 -15 536 705 ;
+C 52 ; WX 574 ; N four ; B -13 0 544 705 ;
+C 53 ; WX 574 ; N five ; B 0 -15 574 705 ;
+C 54 ; WX 574 ; N six ; B 31 -15 574 705 ;
+C 55 ; WX 574 ; N seven ; B 64 -15 593 705 ;
+C 56 ; WX 574 ; N eight ; B 0 -15 552 705 ;
+C 57 ; WX 574 ; N nine ; B 0 -15 543 705 ;
+C 58 ; WX 287 ; N colon ; B -20 -15 237 477 ;
+C 59 ; WX 287 ; N semicolon ; B -57 -192 237 477 ;
+C 60 ; WX 606 ; N less ; B 50 -9 556 515 ;
+C 61 ; WX 606 ; N equal ; B 50 103 556 403 ;
+C 62 ; WX 606 ; N greater ; B 50 -8 556 514 ;
+C 63 ; WX 481 ; N question ; B 79 -15 451 737 ;
+C 64 ; WX 747 ; N at ; B -4 -15 751 737 ;
+C 65 ; WX 741 ; N A ; B -75 0 716 737 ;
+C 66 ; WX 759 ; N B ; B -50 0 721 722 ;
+C 67 ; WX 759 ; N C ; B 37 -15 759 737 ;
+C 68 ; WX 833 ; N D ; B -47 0 796 722 ;
+C 69 ; WX 741 ; N E ; B -41 0 730 722 ;
+C 70 ; WX 704 ; N F ; B -41 0 730 722 ;
+C 71 ; WX 815 ; N G ; B 37 -15 805 737 ;
+C 72 ; WX 870 ; N H ; B -41 0 911 722 ;
+C 73 ; WX 444 ; N I ; B -41 0 485 722 ;
+C 74 ; WX 667 ; N J ; B -20 -15 708 722 ;
+C 75 ; WX 778 ; N K ; B -41 0 832 722 ;
+C 76 ; WX 704 ; N L ; B -41 0 670 722 ;
+C 77 ; WX 944 ; N M ; B -44 0 988 722 ;
+C 78 ; WX 852 ; N N ; B -61 -10 913 722 ;
+C 79 ; WX 833 ; N O ; B 37 -15 796 737 ;
+C 80 ; WX 741 ; N P ; B -41 0 730 722 ;
+C 81 ; WX 833 ; N Q ; B 37 -189 796 737 ;
+C 82 ; WX 796 ; N R ; B -41 -15 749 722 ;
+C 83 ; WX 685 ; N S ; B 1 -15 666 737 ;
+C 84 ; WX 722 ; N T ; B 41 0 759 722 ;
+C 85 ; WX 833 ; N U ; B 88 -15 900 722 ;
+C 86 ; WX 741 ; N V ; B 32 -10 802 722 ;
+C 87 ; WX 944 ; N W ; B 40 -10 1000 722 ;
+C 88 ; WX 741 ; N X ; B -82 0 801 722 ;
+C 89 ; WX 704 ; N Y ; B 13 0 775 722 ;
+C 90 ; WX 704 ; N Z ; B -33 0 711 722 ;
+C 91 ; WX 407 ; N bracketleft ; B 1 -109 464 737 ;
+C 92 ; WX 606 ; N backslash ; B 161 -15 445 737 ;
+C 93 ; WX 407 ; N bracketright ; B -101 -109 362 737 ;
+C 94 ; WX 606 ; N asciicircum ; B 66 325 540 690 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 259 ; N quoteleft ; B 47 388 274 737 ;
+C 97 ; WX 667 ; N a ; B 6 -15 636 477 ;
+C 98 ; WX 611 ; N b ; B 29 -15 557 737 ;
+C 99 ; WX 537 ; N c ; B 0 -15 482 477 ;
+C 100 ; WX 667 ; N d ; B 0 -15 660 737 ;
+C 101 ; WX 519 ; N e ; B 0 -15 479 477 ;
+C 102 ; WX 389 ; N f ; B -48 -205 550 737 ; L i fi ; L l fl ;
+C 103 ; WX 611 ; N g ; B -63 -205 604 528 ;
+C 104 ; WX 685 ; N h ; B 0 -15 639 737 ;
+C 105 ; WX 389 ; N i ; B 32 -15 345 737 ;
+C 106 ; WX 370 ; N j ; B -205 -205 347 737 ;
+C 107 ; WX 648 ; N k ; B -11 -15 578 737 ;
+C 108 ; WX 389 ; N l ; B 32 -15 375 737 ;
+C 109 ; WX 944 ; N m ; B 0 -15 909 477 ;
+C 110 ; WX 685 ; N n ; B 0 -15 639 477 ;
+C 111 ; WX 574 ; N o ; B 0 -15 530 477 ;
+C 112 ; WX 648 ; N p ; B -119 -205 590 477 ;
+C 113 ; WX 630 ; N q ; B 0 -205 587 477 ;
+C 114 ; WX 519 ; N r ; B 0 0 527 486 ;
+C 115 ; WX 481 ; N s ; B 0 -15 435 477 ;
+C 116 ; WX 407 ; N t ; B 24 -15 403 650 ;
+C 117 ; WX 685 ; N u ; B 30 -15 635 477 ;
+C 118 ; WX 556 ; N v ; B 30 -15 496 477 ;
+C 119 ; WX 833 ; N w ; B 30 -15 773 477 ;
+C 120 ; WX 574 ; N x ; B -46 -15 574 477 ;
+C 121 ; WX 519 ; N y ; B -66 -205 493 477 ;
+C 122 ; WX 519 ; N z ; B -19 -15 473 477 ;
+C 123 ; WX 407 ; N braceleft ; B 52 -109 408 737 ;
+C 124 ; WX 606 ; N bar ; B 249 -250 357 750 ;
+C 125 ; WX 407 ; N braceright ; B -25 -109 331 737 ;
+C 126 ; WX 606 ; N asciitilde ; B 72 160 534 346 ;
+C 161 ; WX 333 ; N exclamdown ; B -44 -205 289 547 ;
+C 162 ; WX 574 ; N cent ; B 30 -144 512 578 ;
+C 163 ; WX 574 ; N sterling ; B -18 -15 566 705 ;
+C 164 ; WX 167 ; N fraction ; B -166 -15 333 705 ;
+C 165 ; WX 574 ; N yen ; B 17 0 629 690 ;
+C 166 ; WX 574 ; N florin ; B -43 -205 575 737 ;
+C 167 ; WX 500 ; N section ; B -30 -146 515 737 ;
+C 168 ; WX 574 ; N currency ; B 27 84 547 605 ;
+C 169 ; WX 287 ; N quotesingle ; B 112 388 250 737 ;
+C 170 ; WX 481 ; N quotedblleft ; B 54 388 521 737 ;
+C 171 ; WX 481 ; N guillemotleft ; B -35 69 449 407 ;
+C 172 ; WX 278 ; N guilsinglleft ; B -25 69 244 407 ;
+C 173 ; WX 278 ; N guilsinglright ; B -26 69 243 407 ;
+C 174 ; WX 685 ; N fi ; B -70 -205 641 737 ;
+C 175 ; WX 685 ; N fl ; B -70 -205 671 737 ;
+C 177 ; WX 500 ; N endash ; B -47 189 479 287 ;
+C 178 ; WX 500 ; N dagger ; B 48 -146 508 737 ;
+C 179 ; WX 500 ; N daggerdbl ; B -60 -150 508 737 ;
+C 180 ; WX 287 ; N periodcentered ; B 57 200 229 372 ;
+C 182 ; WX 650 ; N paragraph ; B 25 -131 681 722 ;
+C 183 ; WX 606 ; N bullet ; B 122 180 484 542 ;
+C 184 ; WX 259 ; N quotesinglbase ; B -57 -192 170 157 ;
+C 185 ; WX 481 ; N quotedblbase ; B -57 -192 412 157 ;
+C 186 ; WX 481 ; N quotedblright ; B 43 388 510 737 ;
+C 187 ; WX 481 ; N guillemotright ; B -31 69 453 407 ;
+C 188 ; WX 1000 ; N ellipsis ; B 81 -15 919 157 ;
+C 189 ; WX 1167 ; N perthousand ; B 20 -28 1147 727 ;
+C 191 ; WX 481 ; N questiondown ; B 0 -205 372 547 ;
+C 193 ; WX 333 ; N grave ; B 74 538 294 722 ;
+C 194 ; WX 333 ; N acute ; B 123 538 372 722 ;
+C 195 ; WX 333 ; N circumflex ; B 23 533 365 705 ;
+C 196 ; WX 333 ; N tilde ; B 28 561 398 690 ;
+C 197 ; WX 333 ; N macron ; B 47 573 404 649 ;
+C 198 ; WX 333 ; N breve ; B 67 535 390 698 ;
+C 199 ; WX 333 ; N dotaccent ; B 145 546 289 690 ;
+C 200 ; WX 333 ; N dieresis ; B 33 546 393 690 ;
+C 202 ; WX 333 ; N ring ; B 111 522 335 746 ;
+C 203 ; WX 333 ; N cedilla ; B -21 -220 225 3 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 15 538 480 722 ;
+C 206 ; WX 333 ; N ogonek ; B 68 -155 246 -10 ;
+C 207 ; WX 333 ; N caron ; B 60 531 403 705 ;
+C 208 ; WX 1000 ; N emdash ; B -47 189 979 287 ;
+C 225 ; WX 889 ; N AE ; B -86 0 915 722 ;
+C 227 ; WX 412 ; N ordfeminine ; B 47 407 460 705 ;
+C 232 ; WX 704 ; N Lslash ; B -41 0 670 722 ;
+C 233 ; WX 833 ; N Oslash ; B 35 -68 798 790 ;
+C 234 ; WX 963 ; N OE ; B 29 0 989 722 ;
+C 235 ; WX 356 ; N ordmasculine ; B 42 407 394 705 ;
+C 241 ; WX 815 ; N ae ; B -18 -15 775 477 ;
+C 245 ; WX 389 ; N dotlessi ; B 32 -15 345 477 ;
+C 248 ; WX 389 ; N lslash ; B 5 -15 390 737 ;
+C 249 ; WX 574 ; N oslash ; B 0 -121 530 583 ;
+C 250 ; WX 852 ; N oe ; B -6 -15 812 477 ;
+C 251 ; WX 574 ; N germandbls ; B -91 -205 540 737 ;
+C -1 ; WX 519 ; N ecircumflex ; B 0 -15 479 705 ;
+C -1 ; WX 519 ; N edieresis ; B 0 -15 486 690 ;
+C -1 ; WX 667 ; N aacute ; B 6 -15 636 722 ;
+C -1 ; WX 747 ; N registered ; B -2 -15 750 737 ;
+C -1 ; WX 389 ; N icircumflex ; B 21 -15 363 698 ;
+C -1 ; WX 685 ; N udieresis ; B 30 -15 635 690 ;
+C -1 ; WX 574 ; N ograve ; B 0 -15 530 722 ;
+C -1 ; WX 685 ; N uacute ; B 30 -15 635 722 ;
+C -1 ; WX 685 ; N ucircumflex ; B 30 -15 635 705 ;
+C -1 ; WX 741 ; N Aacute ; B -75 0 716 947 ;
+C -1 ; WX 389 ; N igrave ; B 32 -15 345 715 ;
+C -1 ; WX 444 ; N Icircumflex ; B -41 0 485 930 ;
+C -1 ; WX 537 ; N ccedilla ; B 0 -220 482 477 ;
+C -1 ; WX 667 ; N adieresis ; B 6 -15 636 690 ;
+C -1 ; WX 741 ; N Ecircumflex ; B -41 0 730 930 ;
+C -1 ; WX 481 ; N scaron ; B 0 -15 477 705 ;
+C -1 ; WX 648 ; N thorn ; B -119 -205 590 737 ;
+C -1 ; WX 950 ; N trademark ; B 42 317 1017 722 ;
+C -1 ; WX 519 ; N egrave ; B 0 -15 479 722 ;
+C -1 ; WX 344 ; N threesuperior ; B 3 273 361 705 ;
+C -1 ; WX 519 ; N zcaron ; B -19 -15 473 695 ;
+C -1 ; WX 667 ; N atilde ; B 6 -15 636 690 ;
+C -1 ; WX 667 ; N aring ; B 6 -15 636 746 ;
+C -1 ; WX 574 ; N ocircumflex ; B 0 -15 530 705 ;
+C -1 ; WX 741 ; N Edieresis ; B -41 0 730 915 ;
+C -1 ; WX 861 ; N threequarters ; B 35 -15 789 705 ;
+C -1 ; WX 519 ; N ydieresis ; B -66 -205 493 690 ;
+C -1 ; WX 519 ; N yacute ; B -66 -205 493 722 ;
+C -1 ; WX 389 ; N iacute ; B 32 -15 370 715 ;
+C -1 ; WX 741 ; N Acircumflex ; B -75 0 716 930 ;
+C -1 ; WX 833 ; N Uacute ; B 88 -15 900 947 ;
+C -1 ; WX 519 ; N eacute ; B 0 -15 479 722 ;
+C -1 ; WX 833 ; N Ograve ; B 37 -15 796 947 ;
+C -1 ; WX 667 ; N agrave ; B 6 -15 636 722 ;
+C -1 ; WX 833 ; N Udieresis ; B 88 -15 900 915 ;
+C -1 ; WX 667 ; N acircumflex ; B 6 -15 636 705 ;
+C -1 ; WX 444 ; N Igrave ; B -41 0 485 947 ;
+C -1 ; WX 344 ; N twosuperior ; B -17 280 362 705 ;
+C -1 ; WX 833 ; N Ugrave ; B 88 -15 900 947 ;
+C -1 ; WX 861 ; N onequarter ; B 17 -15 789 705 ;
+C -1 ; WX 833 ; N Ucircumflex ; B 88 -15 900 930 ;
+C -1 ; WX 685 ; N Scaron ; B 1 -15 666 930 ;
+C -1 ; WX 444 ; N Idieresis ; B -41 0 509 915 ;
+C -1 ; WX 389 ; N idieresis ; B 31 -15 391 683 ;
+C -1 ; WX 741 ; N Egrave ; B -41 0 730 947 ;
+C -1 ; WX 833 ; N Oacute ; B 37 -15 796 947 ;
+C -1 ; WX 606 ; N divide ; B 50 -40 556 546 ;
+C -1 ; WX 741 ; N Atilde ; B -75 0 716 915 ;
+C -1 ; WX 741 ; N Aring ; B -75 0 716 991 ;
+C -1 ; WX 833 ; N Odieresis ; B 37 -15 796 915 ;
+C -1 ; WX 741 ; N Adieresis ; B -75 0 716 915 ;
+C -1 ; WX 852 ; N Ntilde ; B -61 -10 913 915 ;
+C -1 ; WX 704 ; N Zcaron ; B -33 0 711 930 ;
+C -1 ; WX 741 ; N Thorn ; B -41 0 690 722 ;
+C -1 ; WX 444 ; N Iacute ; B -41 0 488 947 ;
+C -1 ; WX 606 ; N plusminus ; B 50 0 556 506 ;
+C -1 ; WX 606 ; N multiply ; B 65 15 541 491 ;
+C -1 ; WX 741 ; N Eacute ; B -41 0 730 947 ;
+C -1 ; WX 704 ; N Ydieresis ; B 13 0 775 915 ;
+C -1 ; WX 344 ; N onesuperior ; B 19 282 326 705 ;
+C -1 ; WX 685 ; N ugrave ; B 30 -15 635 722 ;
+C -1 ; WX 606 ; N logicalnot ; B 50 103 556 403 ;
+C -1 ; WX 685 ; N ntilde ; B 0 -15 639 690 ;
+C -1 ; WX 833 ; N Otilde ; B 37 -15 796 915 ;
+C -1 ; WX 574 ; N otilde ; B 0 -15 530 690 ;
+C -1 ; WX 759 ; N Ccedilla ; B 37 -220 759 737 ;
+C -1 ; WX 741 ; N Agrave ; B -75 0 716 947 ;
+C -1 ; WX 861 ; N onehalf ; B 17 -15 798 705 ;
+C -1 ; WX 833 ; N Eth ; B -47 0 796 722 ;
+C -1 ; WX 400 ; N degree ; B 86 419 372 705 ;
+C -1 ; WX 704 ; N Yacute ; B 13 0 775 947 ;
+C -1 ; WX 833 ; N Ocircumflex ; B 37 -15 796 930 ;
+C -1 ; WX 574 ; N oacute ; B 0 -15 530 722 ;
+C -1 ; WX 685 ; N mu ; B -89 -205 635 477 ;
+C -1 ; WX 606 ; N minus ; B 50 199 556 307 ;
+C -1 ; WX 574 ; N eth ; B 0 -15 530 752 ;
+C -1 ; WX 574 ; N odieresis ; B 0 -15 530 690 ;
+C -1 ; WX 747 ; N copyright ; B -2 -15 750 737 ;
+C -1 ; WX 606 ; N brokenbar ; B 249 -175 357 675 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 239
+
+KPX A y -33
+KPX A w -25
+KPX A v -10
+KPX A u -15
+KPX A quoteright -95
+KPX A quotedblright -95
+KPX A Y -70
+KPX A W -84
+KPX A V -100
+KPX A U -32
+KPX A T 5
+KPX A Q 5
+KPX A O 5
+KPX A G 5
+KPX A C 5
+
+KPX B period 15
+KPX B comma 15
+KPX B U 15
+KPX B A -11
+
+KPX C A -5
+
+KPX D period -11
+KPX D comma -11
+KPX D Y 6
+KPX D W -11
+KPX D V -18
+
+KPX F r -27
+KPX F period -91
+KPX F o -47
+KPX F i -41
+KPX F e -41
+KPX F comma -91
+KPX F a -47
+KPX F A -79
+
+KPX J u -39
+KPX J period -74
+KPX J o -40
+KPX J e -33
+KPX J comma -74
+KPX J a -40
+KPX J A -30
+
+KPX K y -48
+KPX K u -4
+KPX K o -4
+KPX K e 18
+
+KPX L y -30
+KPX L quoteright -100
+KPX L quotedblright -100
+KPX L Y -55
+KPX L W -69
+KPX L V -97
+KPX L T -75
+
+KPX N period -49
+KPX N comma -49
+
+KPX O period -18
+KPX O comma -18
+KPX O X -18
+KPX O W -15
+KPX O V -24
+KPX O A -5
+
+KPX P period -100
+KPX P o -40
+KPX P e -33
+KPX P comma -100
+KPX P a -40
+KPX P A -80
+
+KPX R W -14
+KPX R V -24
+
+KPX S period -18
+KPX S comma -18
+
+KPX T y -30
+KPX T w -30
+KPX T u -22
+KPX T r -9
+KPX T period -55
+KPX T o -40
+KPX T i -22
+KPX T hyphen -75
+KPX T h -9
+KPX T e -33
+KPX T comma -55
+KPX T a -40
+KPX T O 11
+KPX T A -60
+
+KPX U period -25
+KPX U comma -25
+KPX U A -42
+
+KPX V u -70
+KPX V semicolon 6
+KPX V period -94
+KPX V o -71
+KPX V i -35
+KPX V hyphen -94
+KPX V e -66
+KPX V comma -94
+KPX V colon -49
+KPX V a -55
+KPX V O -19
+KPX V G -12
+KPX V A -100
+
+KPX W y -41
+KPX W u -25
+KPX W semicolon -22
+KPX W period -86
+KPX W o -33
+KPX W i -27
+KPX W hyphen -61
+KPX W h 5
+KPX W e -39
+KPX W comma -86
+KPX W colon -22
+KPX W a -33
+KPX W O -11
+KPX W A -66
+
+KPX Y u -58
+KPX Y semicolon -55
+KPX Y period -91
+KPX Y o -77
+KPX Y i -22
+KPX Y hyphen -91
+KPX Y e -71
+KPX Y comma -91
+KPX Y colon -55
+KPX Y a -77
+KPX Y A -79
+
+KPX a y -8
+KPX a w -8
+KPX a v 6
+
+KPX b y -6
+KPX b v 8
+KPX b period 6
+KPX b comma 6
+
+KPX c y -20
+KPX c period -8
+KPX c l -13
+KPX c k -8
+KPX c h -18
+KPX c comma -8
+
+KPX colon space -18
+
+KPX comma space -18
+KPX comma quoteright -18
+KPX comma quotedblright -18
+
+KPX d y -15
+KPX d w -15
+
+KPX e y -15
+KPX e x -5
+KPX e w -15
+KPX e p -11
+KPX e g -4
+KPX e b -8
+
+KPX f quoteright 105
+KPX f quotedblright 105
+KPX f period -28
+KPX f o 7
+KPX f l 7
+KPX f i 7
+KPX f e 14
+KPX f dotlessi 7
+KPX f comma -28
+KPX f a 8
+
+KPX g y -11
+KPX g r 11
+KPX g period -5
+KPX g comma -5
+
+KPX h y -20
+
+KPX i v 7
+
+KPX k y -15
+KPX k o -22
+KPX k e -16
+
+KPX l y -7
+KPX l w -7
+
+KPX m y -20
+KPX m u -11
+
+KPX n y -20
+KPX n v -7
+KPX n u -11
+
+KPX o y -11
+KPX o w -8
+KPX o v 6
+
+KPX p y -4
+KPX p period 8
+KPX p comma 8
+
+KPX period space -18
+KPX period quoteright -18
+KPX period quotedblright -18
+
+KPX quotedblleft quoteleft 20
+KPX quotedblleft A -60
+
+KPX quotedblright space -18
+
+KPX quoteleft A -80
+
+KPX quoteright v -16
+KPX quoteright t -22
+KPX quoteright s -46
+KPX quoteright r -9
+KPX quoteright l -22
+KPX quoteright d -41
+
+KPX r y -20
+KPX r v -7
+KPX r u -11
+KPX r t -11
+KPX r semicolon 9
+KPX r s -20
+KPX r quoteright 9
+KPX r period -90
+KPX r p -17
+KPX r o -11
+KPX r l -14
+KPX r k 9
+KPX r i -14
+KPX r hyphen -16
+KPX r g -11
+KPX r e -7
+KPX r d -7
+KPX r comma -90
+KPX r colon 9
+KPX r a -11
+
+KPX s period 11
+KPX s comma 11
+
+KPX semicolon space -18
+
+KPX space quotedblleft -18
+KPX space Y -18
+KPX space W -33
+KPX space V -24
+KPX space T -18
+KPX space A -22
+
+KPX v period -11
+KPX v o -6
+KPX v comma -11
+KPX v a -6
+
+KPX w period -17
+KPX w o -14
+KPX w e -8
+KPX w comma -17
+KPX w a -14
+
+KPX x e 5
+
+KPX y period -25
+KPX y o 8
+KPX y e 15
+KPX y comma -25
+KPX y a 8
+
+KPX z e 4
+EndKernPairs
+EndKernData
+StartComposites 56
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 259 225 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 259 225 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 259 225 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 259 225 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 229 245 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 259 225 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 296 225 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 296 225 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 296 225 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 296 225 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 116 225 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 116 225 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 116 225 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 116 225 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 326 225 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 315 225 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 315 225 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 315 225 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 315 225 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 315 225 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 206 225 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 340 225 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 340 225 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 340 225 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 340 225 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 246 225 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 236 225 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 226 225 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 167 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 167 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 167 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 167 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 167 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 167 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 93 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 93 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 93 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 93 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -2 -7 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -2 -7 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -2 -7 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -2 -7 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 176 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 121 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 121 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 121 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 121 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 121 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 74 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 176 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 176 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 176 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 176 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 93 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 93 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 63 -10 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pncr8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pncr8a.afm
new file mode 100644
index 0000000..b9f616c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pncr8a.afm
@@ -0,0 +1,524 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Tue May 28 16:31:51 1991
+Comment UniqueID 35025
+Comment VMusage 30420 37312
+FontName NewCenturySchlbk-Roman
+FullName New Century Schoolbook Roman
+FamilyName New Century Schoolbook
+Weight Roman
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -195 -250 1000 965
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.007
+Notice Copyright (c) 1985, 1987, 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.
+EncodingScheme AdobeStandardEncoding
+CapHeight 722
+XHeight 464
+Ascender 737
+Descender -205
+StartCharMetrics 228
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 296 ; N exclam ; B 86 -15 210 737 ;
+C 34 ; WX 389 ; N quotedbl ; B 61 443 328 737 ;
+C 35 ; WX 556 ; N numbersign ; B 28 0 528 690 ;
+C 36 ; WX 556 ; N dollar ; B 45 -138 511 813 ;
+C 37 ; WX 833 ; N percent ; B 43 -15 790 705 ;
+C 38 ; WX 815 ; N ampersand ; B 51 -15 775 737 ;
+C 39 ; WX 204 ; N quoteright ; B 25 443 179 737 ;
+C 40 ; WX 333 ; N parenleft ; B 40 -117 279 745 ;
+C 41 ; WX 333 ; N parenright ; B 54 -117 293 745 ;
+C 42 ; WX 500 ; N asterisk ; B 57 306 443 737 ;
+C 43 ; WX 606 ; N plus ; B 50 0 556 506 ;
+C 44 ; WX 278 ; N comma ; B 62 -185 216 109 ;
+C 45 ; WX 333 ; N hyphen ; B 42 199 291 277 ;
+C 46 ; WX 278 ; N period ; B 77 -15 201 109 ;
+C 47 ; WX 278 ; N slash ; B -32 -15 310 737 ;
+C 48 ; WX 556 ; N zero ; B 42 -15 514 705 ;
+C 49 ; WX 556 ; N one ; B 100 0 496 705 ;
+C 50 ; WX 556 ; N two ; B 35 0 505 705 ;
+C 51 ; WX 556 ; N three ; B 42 -15 498 705 ;
+C 52 ; WX 556 ; N four ; B 28 0 528 705 ;
+C 53 ; WX 556 ; N five ; B 46 -15 502 705 ;
+C 54 ; WX 556 ; N six ; B 41 -15 515 705 ;
+C 55 ; WX 556 ; N seven ; B 59 -15 508 705 ;
+C 56 ; WX 556 ; N eight ; B 42 -15 514 705 ;
+C 57 ; WX 556 ; N nine ; B 41 -15 515 705 ;
+C 58 ; WX 278 ; N colon ; B 77 -15 201 474 ;
+C 59 ; WX 278 ; N semicolon ; B 62 -185 216 474 ;
+C 60 ; WX 606 ; N less ; B 50 -8 556 514 ;
+C 61 ; WX 606 ; N equal ; B 50 117 556 389 ;
+C 62 ; WX 606 ; N greater ; B 50 -8 556 514 ;
+C 63 ; WX 444 ; N question ; B 29 -15 415 737 ;
+C 64 ; WX 737 ; N at ; B -8 -15 744 737 ;
+C 65 ; WX 722 ; N A ; B -8 0 730 737 ;
+C 66 ; WX 722 ; N B ; B 29 0 669 722 ;
+C 67 ; WX 722 ; N C ; B 45 -15 668 737 ;
+C 68 ; WX 778 ; N D ; B 29 0 733 722 ;
+C 69 ; WX 722 ; N E ; B 29 0 663 722 ;
+C 70 ; WX 667 ; N F ; B 29 0 638 722 ;
+C 71 ; WX 778 ; N G ; B 45 -15 775 737 ;
+C 72 ; WX 833 ; N H ; B 29 0 804 722 ;
+C 73 ; WX 407 ; N I ; B 38 0 369 722 ;
+C 74 ; WX 556 ; N J ; B 5 -15 540 722 ;
+C 75 ; WX 778 ; N K ; B 29 0 803 722 ;
+C 76 ; WX 667 ; N L ; B 29 0 644 722 ;
+C 77 ; WX 944 ; N M ; B 29 0 915 722 ;
+C 78 ; WX 815 ; N N ; B 24 -15 791 722 ;
+C 79 ; WX 778 ; N O ; B 45 -15 733 737 ;
+C 80 ; WX 667 ; N P ; B 29 0 650 722 ;
+C 81 ; WX 778 ; N Q ; B 45 -190 748 737 ;
+C 82 ; WX 722 ; N R ; B 29 -15 713 722 ;
+C 83 ; WX 630 ; N S ; B 47 -15 583 737 ;
+C 84 ; WX 667 ; N T ; B 19 0 648 722 ;
+C 85 ; WX 815 ; N U ; B 16 -15 799 722 ;
+C 86 ; WX 722 ; N V ; B -8 -10 730 722 ;
+C 87 ; WX 981 ; N W ; B 5 -10 976 722 ;
+C 88 ; WX 704 ; N X ; B -8 0 712 722 ;
+C 89 ; WX 704 ; N Y ; B -11 0 715 722 ;
+C 90 ; WX 611 ; N Z ; B 24 0 576 722 ;
+C 91 ; WX 333 ; N bracketleft ; B 126 -109 315 737 ;
+C 92 ; WX 606 ; N backslash ; B 132 -15 474 737 ;
+C 93 ; WX 333 ; N bracketright ; B 18 -109 207 737 ;
+C 94 ; WX 606 ; N asciicircum ; B 89 325 517 690 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 204 ; N quoteleft ; B 25 443 179 737 ;
+C 97 ; WX 556 ; N a ; B 44 -15 542 479 ;
+C 98 ; WX 556 ; N b ; B 10 -15 522 737 ;
+C 99 ; WX 444 ; N c ; B 34 -15 426 479 ;
+C 100 ; WX 574 ; N d ; B 34 -15 552 737 ;
+C 101 ; WX 500 ; N e ; B 34 -15 466 479 ;
+C 102 ; WX 333 ; N f ; B 18 0 437 737 ; L i fi ; L l fl ;
+C 103 ; WX 537 ; N g ; B 23 -205 542 494 ;
+C 104 ; WX 611 ; N h ; B 7 0 592 737 ;
+C 105 ; WX 315 ; N i ; B 18 0 286 722 ;
+C 106 ; WX 296 ; N j ; B -86 -205 216 722 ;
+C 107 ; WX 593 ; N k ; B 10 0 589 737 ;
+C 108 ; WX 315 ; N l ; B 18 0 286 737 ;
+C 109 ; WX 889 ; N m ; B 26 0 863 479 ;
+C 110 ; WX 611 ; N n ; B 22 0 589 479 ;
+C 111 ; WX 500 ; N o ; B 34 -15 466 479 ;
+C 112 ; WX 574 ; N p ; B 22 -205 540 479 ;
+C 113 ; WX 556 ; N q ; B 34 -205 552 479 ;
+C 114 ; WX 444 ; N r ; B 18 0 434 479 ;
+C 115 ; WX 463 ; N s ; B 46 -15 417 479 ;
+C 116 ; WX 389 ; N t ; B 18 -15 371 666 ;
+C 117 ; WX 611 ; N u ; B 22 -15 589 464 ;
+C 118 ; WX 537 ; N v ; B -6 -10 515 464 ;
+C 119 ; WX 778 ; N w ; B 1 -10 749 464 ;
+C 120 ; WX 537 ; N x ; B 8 0 529 464 ;
+C 121 ; WX 537 ; N y ; B 4 -205 533 464 ;
+C 122 ; WX 481 ; N z ; B 42 0 439 464 ;
+C 123 ; WX 333 ; N braceleft ; B 54 -109 279 737 ;
+C 124 ; WX 606 ; N bar ; B 267 -250 339 750 ;
+C 125 ; WX 333 ; N braceright ; B 54 -109 279 737 ;
+C 126 ; WX 606 ; N asciitilde ; B 72 184 534 322 ;
+C 161 ; WX 296 ; N exclamdown ; B 86 -205 210 547 ;
+C 162 ; WX 556 ; N cent ; B 74 -141 482 584 ;
+C 163 ; WX 556 ; N sterling ; B 18 -15 538 705 ;
+C 164 ; WX 167 ; N fraction ; B -195 -15 362 705 ;
+C 165 ; WX 556 ; N yen ; B -1 0 557 690 ;
+C 166 ; WX 556 ; N florin ; B 0 -205 538 737 ;
+C 167 ; WX 500 ; N section ; B 55 -147 445 737 ;
+C 168 ; WX 556 ; N currency ; B 26 93 530 597 ;
+C 169 ; WX 204 ; N quotesingle ; B 59 443 145 737 ;
+C 170 ; WX 389 ; N quotedblleft ; B 25 443 364 737 ;
+C 171 ; WX 426 ; N guillemotleft ; B 39 78 387 398 ;
+C 172 ; WX 259 ; N guilsinglleft ; B 39 78 220 398 ;
+C 173 ; WX 259 ; N guilsinglright ; B 39 78 220 398 ;
+C 174 ; WX 611 ; N fi ; B 18 0 582 737 ;
+C 175 ; WX 611 ; N fl ; B 18 0 582 737 ;
+C 177 ; WX 556 ; N endash ; B 0 208 556 268 ;
+C 178 ; WX 500 ; N dagger ; B 42 -147 458 737 ;
+C 179 ; WX 500 ; N daggerdbl ; B 42 -149 458 737 ;
+C 180 ; WX 278 ; N periodcentered ; B 71 238 207 374 ;
+C 182 ; WX 606 ; N paragraph ; B 60 -132 546 722 ;
+C 183 ; WX 606 ; N bullet ; B 122 180 484 542 ;
+C 184 ; WX 204 ; N quotesinglbase ; B 25 -185 179 109 ;
+C 185 ; WX 389 ; N quotedblbase ; B 25 -185 364 109 ;
+C 186 ; WX 389 ; N quotedblright ; B 25 443 364 737 ;
+C 187 ; WX 426 ; N guillemotright ; B 39 78 387 398 ;
+C 188 ; WX 1000 ; N ellipsis ; B 105 -15 895 109 ;
+C 189 ; WX 1000 ; N perthousand ; B 6 -15 994 705 ;
+C 191 ; WX 444 ; N questiondown ; B 29 -205 415 547 ;
+C 193 ; WX 333 ; N grave ; B 17 528 242 699 ;
+C 194 ; WX 333 ; N acute ; B 91 528 316 699 ;
+C 195 ; WX 333 ; N circumflex ; B 10 528 323 695 ;
+C 196 ; WX 333 ; N tilde ; B 1 553 332 655 ;
+C 197 ; WX 333 ; N macron ; B 10 568 323 623 ;
+C 198 ; WX 333 ; N breve ; B 25 528 308 685 ;
+C 199 ; WX 333 ; N dotaccent ; B 116 543 218 645 ;
+C 200 ; WX 333 ; N dieresis ; B 16 543 317 645 ;
+C 202 ; WX 333 ; N ring ; B 66 522 266 722 ;
+C 203 ; WX 333 ; N cedilla ; B 29 -215 237 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B -9 528 416 699 ;
+C 206 ; WX 333 ; N ogonek ; B 68 -215 254 0 ;
+C 207 ; WX 333 ; N caron ; B 10 528 323 695 ;
+C 208 ; WX 1000 ; N emdash ; B 0 208 1000 268 ;
+C 225 ; WX 1000 ; N AE ; B 0 0 962 722 ;
+C 227 ; WX 334 ; N ordfeminine ; B -4 407 338 705 ;
+C 232 ; WX 667 ; N Lslash ; B 29 0 644 722 ;
+C 233 ; WX 778 ; N Oslash ; B 45 -56 733 778 ;
+C 234 ; WX 1000 ; N OE ; B 21 0 979 722 ;
+C 235 ; WX 300 ; N ordmasculine ; B 4 407 296 705 ;
+C 241 ; WX 796 ; N ae ; B 34 -15 762 479 ;
+C 245 ; WX 315 ; N dotlessi ; B 18 0 286 464 ;
+C 248 ; WX 315 ; N lslash ; B 18 0 286 737 ;
+C 249 ; WX 500 ; N oslash ; B 34 -97 466 561 ;
+C 250 ; WX 833 ; N oe ; B 34 -15 799 479 ;
+C 251 ; WX 574 ; N germandbls ; B 30 -15 537 737 ;
+C -1 ; WX 500 ; N ecircumflex ; B 34 -15 466 695 ;
+C -1 ; WX 500 ; N edieresis ; B 34 -15 466 645 ;
+C -1 ; WX 556 ; N aacute ; B 44 -15 542 699 ;
+C -1 ; WX 737 ; N registered ; B -8 -15 744 737 ;
+C -1 ; WX 315 ; N icircumflex ; B 1 0 314 695 ;
+C -1 ; WX 611 ; N udieresis ; B 22 -15 589 645 ;
+C -1 ; WX 500 ; N ograve ; B 34 -15 466 699 ;
+C -1 ; WX 611 ; N uacute ; B 22 -15 589 699 ;
+C -1 ; WX 611 ; N ucircumflex ; B 22 -15 589 695 ;
+C -1 ; WX 722 ; N Aacute ; B -8 0 730 937 ;
+C -1 ; WX 315 ; N igrave ; B 8 0 286 699 ;
+C -1 ; WX 407 ; N Icircumflex ; B 38 0 369 933 ;
+C -1 ; WX 444 ; N ccedilla ; B 34 -215 426 479 ;
+C -1 ; WX 556 ; N adieresis ; B 44 -15 542 645 ;
+C -1 ; WX 722 ; N Ecircumflex ; B 29 0 663 933 ;
+C -1 ; WX 463 ; N scaron ; B 46 -15 417 695 ;
+C -1 ; WX 574 ; N thorn ; B 22 -205 540 737 ;
+C -1 ; WX 1000 ; N trademark ; B 32 318 968 722 ;
+C -1 ; WX 500 ; N egrave ; B 34 -15 466 699 ;
+C -1 ; WX 333 ; N threesuperior ; B 18 273 315 705 ;
+C -1 ; WX 481 ; N zcaron ; B 42 0 439 695 ;
+C -1 ; WX 556 ; N atilde ; B 44 -15 542 655 ;
+C -1 ; WX 556 ; N aring ; B 44 -15 542 732 ;
+C -1 ; WX 500 ; N ocircumflex ; B 34 -15 466 695 ;
+C -1 ; WX 722 ; N Edieresis ; B 29 0 663 883 ;
+C -1 ; WX 834 ; N threequarters ; B 28 -15 795 705 ;
+C -1 ; WX 537 ; N ydieresis ; B 4 -205 533 645 ;
+C -1 ; WX 537 ; N yacute ; B 4 -205 533 699 ;
+C -1 ; WX 315 ; N iacute ; B 18 0 307 699 ;
+C -1 ; WX 722 ; N Acircumflex ; B -8 0 730 933 ;
+C -1 ; WX 815 ; N Uacute ; B 16 -15 799 937 ;
+C -1 ; WX 500 ; N eacute ; B 34 -15 466 699 ;
+C -1 ; WX 778 ; N Ograve ; B 45 -15 733 937 ;
+C -1 ; WX 556 ; N agrave ; B 44 -15 542 699 ;
+C -1 ; WX 815 ; N Udieresis ; B 16 -15 799 883 ;
+C -1 ; WX 556 ; N acircumflex ; B 44 -15 542 695 ;
+C -1 ; WX 407 ; N Igrave ; B 38 0 369 937 ;
+C -1 ; WX 333 ; N twosuperior ; B 14 282 319 705 ;
+C -1 ; WX 815 ; N Ugrave ; B 16 -15 799 937 ;
+C -1 ; WX 834 ; N onequarter ; B 39 -15 795 705 ;
+C -1 ; WX 815 ; N Ucircumflex ; B 16 -15 799 933 ;
+C -1 ; WX 630 ; N Scaron ; B 47 -15 583 933 ;
+C -1 ; WX 407 ; N Idieresis ; B 38 0 369 883 ;
+C -1 ; WX 315 ; N idieresis ; B 7 0 308 645 ;
+C -1 ; WX 722 ; N Egrave ; B 29 0 663 937 ;
+C -1 ; WX 778 ; N Oacute ; B 45 -15 733 937 ;
+C -1 ; WX 606 ; N divide ; B 50 -22 556 528 ;
+C -1 ; WX 722 ; N Atilde ; B -8 0 730 893 ;
+C -1 ; WX 722 ; N Aring ; B -8 0 730 965 ;
+C -1 ; WX 778 ; N Odieresis ; B 45 -15 733 883 ;
+C -1 ; WX 722 ; N Adieresis ; B -8 0 730 883 ;
+C -1 ; WX 815 ; N Ntilde ; B 24 -15 791 893 ;
+C -1 ; WX 611 ; N Zcaron ; B 24 0 576 933 ;
+C -1 ; WX 667 ; N Thorn ; B 29 0 650 722 ;
+C -1 ; WX 407 ; N Iacute ; B 38 0 369 937 ;
+C -1 ; WX 606 ; N plusminus ; B 50 0 556 506 ;
+C -1 ; WX 606 ; N multiply ; B 74 24 532 482 ;
+C -1 ; WX 722 ; N Eacute ; B 29 0 663 937 ;
+C -1 ; WX 704 ; N Ydieresis ; B -11 0 715 883 ;
+C -1 ; WX 333 ; N onesuperior ; B 39 282 294 705 ;
+C -1 ; WX 611 ; N ugrave ; B 22 -15 589 699 ;
+C -1 ; WX 606 ; N logicalnot ; B 50 108 556 389 ;
+C -1 ; WX 611 ; N ntilde ; B 22 0 589 655 ;
+C -1 ; WX 778 ; N Otilde ; B 45 -15 733 893 ;
+C -1 ; WX 500 ; N otilde ; B 34 -15 466 655 ;
+C -1 ; WX 722 ; N Ccedilla ; B 45 -215 668 737 ;
+C -1 ; WX 722 ; N Agrave ; B -8 0 730 937 ;
+C -1 ; WX 834 ; N onehalf ; B 39 -15 820 705 ;
+C -1 ; WX 778 ; N Eth ; B 29 0 733 722 ;
+C -1 ; WX 400 ; N degree ; B 57 419 343 705 ;
+C -1 ; WX 704 ; N Yacute ; B -11 0 715 937 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 45 -15 733 933 ;
+C -1 ; WX 500 ; N oacute ; B 34 -15 466 699 ;
+C -1 ; WX 611 ; N mu ; B 22 -205 589 464 ;
+C -1 ; WX 606 ; N minus ; B 50 217 556 289 ;
+C -1 ; WX 500 ; N eth ; B 34 -15 466 752 ;
+C -1 ; WX 500 ; N odieresis ; B 34 -15 466 645 ;
+C -1 ; WX 737 ; N copyright ; B -8 -15 744 737 ;
+C -1 ; WX 606 ; N brokenbar ; B 267 -175 339 675 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 169
+
+KPX A y -37
+KPX A w -25
+KPX A v -37
+KPX A quoteright -74
+KPX A quotedblright -74
+KPX A Y -75
+KPX A W -50
+KPX A V -75
+KPX A U -30
+KPX A T -18
+
+KPX B period -37
+KPX B comma -37
+KPX B A -18
+
+KPX C period -37
+KPX C comma -37
+KPX C A -18
+
+KPX D period -37
+KPX D comma -37
+KPX D Y -18
+KPX D V -18
+
+KPX F r -10
+KPX F period -125
+KPX F o -55
+KPX F i -10
+KPX F e -55
+KPX F comma -125
+KPX F a -65
+KPX F A -50
+
+KPX G period -37
+KPX G comma -37
+
+KPX J u -25
+KPX J period -74
+KPX J o -25
+KPX J e -25
+KPX J comma -74
+KPX J a -25
+KPX J A -18
+
+KPX K y -25
+KPX K o 10
+KPX K e 10
+
+KPX L y -25
+KPX L quoteright -100
+KPX L quotedblright -100
+KPX L Y -74
+KPX L W -74
+KPX L V -91
+KPX L T -75
+
+KPX N period -55
+KPX N comma -55
+
+KPX O period -37
+KPX O comma -37
+KPX O Y -18
+KPX O V -18
+KPX O T 10
+
+KPX P period -125
+KPX P o -37
+KPX P e -37
+KPX P comma -125
+KPX P a -37
+KPX P A -55
+
+KPX Q period -25
+KPX Q comma -25
+
+KPX S period -37
+KPX S comma -37
+
+KPX T semicolon -37
+KPX T period -125
+KPX T o -55
+KPX T hyphen -100
+KPX T e -55
+KPX T comma -125
+KPX T colon -37
+KPX T a -55
+KPX T O 10
+KPX T A -18
+
+KPX U period -100
+KPX U comma -100
+KPX U A -30
+
+KPX V u -75
+KPX V semicolon -75
+KPX V period -125
+KPX V o -75
+KPX V i -18
+KPX V hyphen -100
+KPX V e -75
+KPX V comma -125
+KPX V colon -75
+KPX V a -85
+KPX V O -18
+KPX V A -74
+
+KPX W y -55
+KPX W u -55
+KPX W semicolon -100
+KPX W period -125
+KPX W o -60
+KPX W i -18
+KPX W hyphen -100
+KPX W e -60
+KPX W comma -125
+KPX W colon -100
+KPX W a -75
+KPX W A -50
+
+KPX Y u -91
+KPX Y semicolon -75
+KPX Y period -100
+KPX Y o -100
+KPX Y i -18
+KPX Y hyphen -125
+KPX Y e -100
+KPX Y comma -100
+KPX Y colon -75
+KPX Y a -100
+KPX Y O -18
+KPX Y A -75
+
+KPX a y -10
+KPX a w -10
+KPX a v -10
+
+KPX b period -18
+KPX b comma -18
+
+KPX c period -18
+KPX c l -7
+KPX c k -7
+KPX c h -7
+KPX c comma -18
+
+KPX colon space -37
+
+KPX comma space -37
+KPX comma quoteright -37
+KPX comma quotedblright -37
+
+KPX e period -18
+KPX e comma -18
+
+KPX f quoteright 100
+KPX f quotedblright 100
+KPX f period -37
+KPX f comma -37
+
+KPX g period -25
+KPX g comma -25
+
+KPX o period -18
+KPX o comma -18
+
+KPX p period -18
+KPX p comma -18
+
+KPX period space -37
+KPX period quoteright -37
+KPX period quotedblright -37
+
+KPX quotedblleft A -74
+
+KPX quotedblright space -37
+
+KPX quoteleft quoteleft -25
+KPX quoteleft A -74
+
+KPX quoteright s -25
+KPX quoteright quoteright -25
+KPX quoteright d -37
+
+KPX r period -100
+KPX r hyphen -37
+KPX r comma -100
+
+KPX s period -25
+KPX s comma -25
+
+KPX semicolon space -37
+
+KPX space quoteleft -37
+KPX space quotedblleft -37
+KPX space Y -37
+KPX space W -37
+KPX space V -37
+KPX space T -37
+KPX space A -37
+
+KPX v period -125
+KPX v comma -125
+
+KPX w period -125
+KPX w comma -125
+KPX w a -18
+
+KPX y period -125
+KPX y comma -125
+EndKernPairs
+EndKernData
+StartComposites 56
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 195 238 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 195 238 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 195 238 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 195 238 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 195 243 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 195 238 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 195 238 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 195 238 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 195 238 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 195 238 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 37 238 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 37 238 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 37 238 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 37 238 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 241 238 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 223 238 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 223 238 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 223 238 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 223 238 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 223 238 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 149 238 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 241 238 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 241 238 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 241 238 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 241 238 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 216 238 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 186 238 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 139 238 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 112 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 112 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 112 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 112 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 112 10 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 112 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 84 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 84 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 84 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 84 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -9 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -9 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -9 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -9 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 139 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 84 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 84 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 84 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 84 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 84 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 65 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 139 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 139 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 139 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 139 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 102 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 102 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 74 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pncri8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pncri8a.afm
new file mode 100644
index 0000000..6dfd6a2
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pncri8a.afm
@@ -0,0 +1,536 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Tue May 28 16:40:04 1991
+Comment UniqueID 35028
+Comment VMusage 31423 38315
+FontName NewCenturySchlbk-Italic
+FullName New Century Schoolbook Italic
+FamilyName New Century Schoolbook
+Weight Medium
+ItalicAngle -16
+IsFixedPitch false
+FontBBox -166 -250 994 958
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.006
+Notice Copyright (c) 1985, 1987, 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.
+EncodingScheme AdobeStandardEncoding
+CapHeight 722
+XHeight 466
+Ascender 737
+Descender -205
+StartCharMetrics 228
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 17 -15 303 737 ;
+C 34 ; WX 400 ; N quotedbl ; B 127 463 363 737 ;
+C 35 ; WX 556 ; N numbersign ; B 28 0 528 690 ;
+C 36 ; WX 556 ; N dollar ; B 4 -142 536 808 ;
+C 37 ; WX 833 ; N percent ; B 43 -15 790 705 ;
+C 38 ; WX 852 ; N ampersand ; B 24 -15 773 737 ;
+C 39 ; WX 204 ; N quoteright ; B 39 463 229 737 ;
+C 40 ; WX 333 ; N parenleft ; B 53 -117 411 745 ;
+C 41 ; WX 333 ; N parenright ; B -93 -117 265 745 ;
+C 42 ; WX 500 ; N asterisk ; B 80 318 500 737 ;
+C 43 ; WX 606 ; N plus ; B 50 0 556 506 ;
+C 44 ; WX 278 ; N comma ; B -39 -165 151 109 ;
+C 45 ; WX 333 ; N hyphen ; B 32 202 259 274 ;
+C 46 ; WX 278 ; N period ; B 17 -15 141 109 ;
+C 47 ; WX 606 ; N slash ; B 132 -15 474 737 ;
+C 48 ; WX 556 ; N zero ; B 30 -15 526 705 ;
+C 49 ; WX 556 ; N one ; B 50 0 459 705 ;
+C 50 ; WX 556 ; N two ; B -37 0 506 705 ;
+C 51 ; WX 556 ; N three ; B -2 -15 506 705 ;
+C 52 ; WX 556 ; N four ; B -8 0 512 705 ;
+C 53 ; WX 556 ; N five ; B 4 -15 540 705 ;
+C 54 ; WX 556 ; N six ; B 36 -15 548 705 ;
+C 55 ; WX 556 ; N seven ; B 69 -15 561 705 ;
+C 56 ; WX 556 ; N eight ; B 6 -15 526 705 ;
+C 57 ; WX 556 ; N nine ; B 8 -15 520 705 ;
+C 58 ; WX 278 ; N colon ; B 17 -15 229 466 ;
+C 59 ; WX 278 ; N semicolon ; B -39 -165 229 466 ;
+C 60 ; WX 606 ; N less ; B 36 -8 542 514 ;
+C 61 ; WX 606 ; N equal ; B 50 117 556 389 ;
+C 62 ; WX 606 ; N greater ; B 64 -8 570 514 ;
+C 63 ; WX 444 ; N question ; B 102 -15 417 737 ;
+C 64 ; WX 747 ; N at ; B -2 -15 750 737 ;
+C 65 ; WX 704 ; N A ; B -87 0 668 737 ;
+C 66 ; WX 722 ; N B ; B -33 0 670 722 ;
+C 67 ; WX 722 ; N C ; B 40 -15 712 737 ;
+C 68 ; WX 778 ; N D ; B -33 0 738 722 ;
+C 69 ; WX 722 ; N E ; B -33 0 700 722 ;
+C 70 ; WX 667 ; N F ; B -33 0 700 722 ;
+C 71 ; WX 778 ; N G ; B 40 -15 763 737 ;
+C 72 ; WX 833 ; N H ; B -33 0 866 722 ;
+C 73 ; WX 407 ; N I ; B -33 0 435 722 ;
+C 74 ; WX 611 ; N J ; B -14 -15 651 722 ;
+C 75 ; WX 741 ; N K ; B -33 0 816 722 ;
+C 76 ; WX 667 ; N L ; B -33 0 627 722 ;
+C 77 ; WX 944 ; N M ; B -33 0 977 722 ;
+C 78 ; WX 815 ; N N ; B -51 -15 866 722 ;
+C 79 ; WX 778 ; N O ; B 40 -15 738 737 ;
+C 80 ; WX 667 ; N P ; B -33 0 667 722 ;
+C 81 ; WX 778 ; N Q ; B 40 -190 738 737 ;
+C 82 ; WX 741 ; N R ; B -45 -15 692 722 ;
+C 83 ; WX 667 ; N S ; B -6 -15 638 737 ;
+C 84 ; WX 685 ; N T ; B 40 0 725 722 ;
+C 85 ; WX 815 ; N U ; B 93 -15 867 722 ;
+C 86 ; WX 704 ; N V ; B 36 -10 779 722 ;
+C 87 ; WX 926 ; N W ; B 53 -10 978 722 ;
+C 88 ; WX 704 ; N X ; B -75 0 779 722 ;
+C 89 ; WX 685 ; N Y ; B 31 0 760 722 ;
+C 90 ; WX 667 ; N Z ; B -25 0 667 722 ;
+C 91 ; WX 333 ; N bracketleft ; B -55 -109 388 737 ;
+C 92 ; WX 606 ; N backslash ; B 132 -15 474 737 ;
+C 93 ; WX 333 ; N bracketright ; B -77 -109 366 737 ;
+C 94 ; WX 606 ; N asciicircum ; B 89 325 517 690 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 204 ; N quoteleft ; B 39 463 229 737 ;
+C 97 ; WX 574 ; N a ; B 2 -15 524 466 ;
+C 98 ; WX 556 ; N b ; B 32 -15 488 737 ;
+C 99 ; WX 444 ; N c ; B 2 -15 394 466 ;
+C 100 ; WX 611 ; N d ; B 2 -15 585 737 ;
+C 101 ; WX 444 ; N e ; B -6 -15 388 466 ;
+C 102 ; WX 333 ; N f ; B -68 -205 470 737 ; L i fi ; L l fl ;
+C 103 ; WX 537 ; N g ; B -79 -205 523 497 ;
+C 104 ; WX 611 ; N h ; B 14 -15 562 737 ;
+C 105 ; WX 333 ; N i ; B 29 -15 282 715 ;
+C 106 ; WX 315 ; N j ; B -166 -205 318 715 ;
+C 107 ; WX 556 ; N k ; B 0 -15 497 737 ;
+C 108 ; WX 333 ; N l ; B 14 -15 292 737 ;
+C 109 ; WX 889 ; N m ; B 14 -15 840 466 ;
+C 110 ; WX 611 ; N n ; B 14 -15 562 466 ;
+C 111 ; WX 500 ; N o ; B 2 -15 450 466 ;
+C 112 ; WX 574 ; N p ; B -101 -205 506 466 ;
+C 113 ; WX 556 ; N q ; B 2 -205 500 466 ;
+C 114 ; WX 444 ; N r ; B 10 0 434 466 ;
+C 115 ; WX 444 ; N s ; B 2 -15 394 466 ;
+C 116 ; WX 352 ; N t ; B 24 -15 328 619 ;
+C 117 ; WX 611 ; N u ; B 44 -15 556 466 ;
+C 118 ; WX 519 ; N v ; B 31 -15 447 466 ;
+C 119 ; WX 778 ; N w ; B 31 -15 706 466 ;
+C 120 ; WX 500 ; N x ; B -33 -15 471 466 ;
+C 121 ; WX 500 ; N y ; B -83 -205 450 466 ;
+C 122 ; WX 463 ; N z ; B -33 -15 416 466 ;
+C 123 ; WX 333 ; N braceleft ; B 38 -109 394 737 ;
+C 124 ; WX 606 ; N bar ; B 267 -250 339 750 ;
+C 125 ; WX 333 ; N braceright ; B -87 -109 269 737 ;
+C 126 ; WX 606 ; N asciitilde ; B 72 184 534 322 ;
+C 161 ; WX 333 ; N exclamdown ; B -22 -205 264 547 ;
+C 162 ; WX 556 ; N cent ; B 62 -144 486 580 ;
+C 163 ; WX 556 ; N sterling ; B -13 -15 544 705 ;
+C 164 ; WX 167 ; N fraction ; B -134 -15 301 705 ;
+C 165 ; WX 556 ; N yen ; B 40 0 624 690 ;
+C 166 ; WX 556 ; N florin ; B -58 -205 569 737 ;
+C 167 ; WX 500 ; N section ; B -10 -147 480 737 ;
+C 168 ; WX 556 ; N currency ; B 26 93 530 597 ;
+C 169 ; WX 278 ; N quotesingle ; B 151 463 237 737 ;
+C 170 ; WX 389 ; N quotedblleft ; B 39 463 406 737 ;
+C 171 ; WX 426 ; N guillemotleft ; B -15 74 402 402 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 40 74 259 402 ;
+C 173 ; WX 333 ; N guilsinglright ; B 40 74 259 402 ;
+C 174 ; WX 611 ; N fi ; B -68 -205 555 737 ;
+C 175 ; WX 611 ; N fl ; B -68 -205 587 737 ;
+C 177 ; WX 500 ; N endash ; B -27 208 487 268 ;
+C 178 ; WX 500 ; N dagger ; B 51 -147 506 737 ;
+C 179 ; WX 500 ; N daggerdbl ; B -54 -147 506 737 ;
+C 180 ; WX 278 ; N periodcentered ; B 71 238 207 374 ;
+C 182 ; WX 650 ; N paragraph ; B 48 -132 665 722 ;
+C 183 ; WX 606 ; N bullet ; B 122 180 484 542 ;
+C 184 ; WX 204 ; N quotesinglbase ; B -78 -165 112 109 ;
+C 185 ; WX 389 ; N quotedblbase ; B -78 -165 289 109 ;
+C 186 ; WX 389 ; N quotedblright ; B 39 463 406 737 ;
+C 187 ; WX 426 ; N guillemotright ; B -15 74 402 402 ;
+C 188 ; WX 1000 ; N ellipsis ; B 59 -15 849 109 ;
+C 189 ; WX 1000 ; N perthousand ; B 6 -15 994 705 ;
+C 191 ; WX 444 ; N questiondown ; B -3 -205 312 547 ;
+C 193 ; WX 333 ; N grave ; B 71 518 262 690 ;
+C 194 ; WX 333 ; N acute ; B 132 518 355 690 ;
+C 195 ; WX 333 ; N circumflex ; B 37 518 331 690 ;
+C 196 ; WX 333 ; N tilde ; B 52 547 383 649 ;
+C 197 ; WX 333 ; N macron ; B 52 560 363 610 ;
+C 198 ; WX 333 ; N breve ; B 69 518 370 677 ;
+C 199 ; WX 333 ; N dotaccent ; B 146 544 248 646 ;
+C 200 ; WX 333 ; N dieresis ; B 59 544 359 646 ;
+C 202 ; WX 333 ; N ring ; B 114 512 314 712 ;
+C 203 ; WX 333 ; N cedilla ; B 3 -215 215 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 32 518 455 690 ;
+C 206 ; WX 333 ; N ogonek ; B 68 -215 254 0 ;
+C 207 ; WX 333 ; N caron ; B 73 518 378 690 ;
+C 208 ; WX 1000 ; N emdash ; B -27 208 987 268 ;
+C 225 ; WX 870 ; N AE ; B -87 0 888 722 ;
+C 227 ; WX 422 ; N ordfeminine ; B 72 416 420 705 ;
+C 232 ; WX 667 ; N Lslash ; B -33 0 627 722 ;
+C 233 ; WX 778 ; N Oslash ; B 16 -68 748 780 ;
+C 234 ; WX 981 ; N OE ; B 40 0 975 722 ;
+C 235 ; WX 372 ; N ordmasculine ; B 66 416 370 705 ;
+C 241 ; WX 722 ; N ae ; B -18 -15 666 466 ;
+C 245 ; WX 333 ; N dotlessi ; B 29 -15 282 466 ;
+C 248 ; WX 333 ; N lslash ; B -25 -15 340 737 ;
+C 249 ; WX 500 ; N oslash ; B 2 -121 450 549 ;
+C 250 ; WX 778 ; N oe ; B 2 -15 722 466 ;
+C 251 ; WX 556 ; N germandbls ; B -76 -205 525 737 ;
+C -1 ; WX 444 ; N ecircumflex ; B -6 -15 388 690 ;
+C -1 ; WX 444 ; N edieresis ; B -6 -15 415 646 ;
+C -1 ; WX 574 ; N aacute ; B 2 -15 524 690 ;
+C -1 ; WX 747 ; N registered ; B -2 -15 750 737 ;
+C -1 ; WX 333 ; N icircumflex ; B 29 -15 331 690 ;
+C -1 ; WX 611 ; N udieresis ; B 44 -15 556 646 ;
+C -1 ; WX 500 ; N ograve ; B 2 -15 450 690 ;
+C -1 ; WX 611 ; N uacute ; B 44 -15 556 690 ;
+C -1 ; WX 611 ; N ucircumflex ; B 44 -15 556 690 ;
+C -1 ; WX 704 ; N Aacute ; B -87 0 668 946 ;
+C -1 ; WX 333 ; N igrave ; B 29 -15 282 690 ;
+C -1 ; WX 407 ; N Icircumflex ; B -33 0 435 946 ;
+C -1 ; WX 444 ; N ccedilla ; B 2 -215 394 466 ;
+C -1 ; WX 574 ; N adieresis ; B 2 -15 524 646 ;
+C -1 ; WX 722 ; N Ecircumflex ; B -33 0 700 946 ;
+C -1 ; WX 444 ; N scaron ; B 2 -15 434 690 ;
+C -1 ; WX 574 ; N thorn ; B -101 -205 506 737 ;
+C -1 ; WX 950 ; N trademark ; B 32 318 968 722 ;
+C -1 ; WX 444 ; N egrave ; B -6 -15 388 690 ;
+C -1 ; WX 333 ; N threesuperior ; B 22 273 359 705 ;
+C -1 ; WX 463 ; N zcaron ; B -33 -15 443 690 ;
+C -1 ; WX 574 ; N atilde ; B 2 -15 524 649 ;
+C -1 ; WX 574 ; N aring ; B 2 -15 524 712 ;
+C -1 ; WX 500 ; N ocircumflex ; B 2 -15 450 690 ;
+C -1 ; WX 722 ; N Edieresis ; B -33 0 700 902 ;
+C -1 ; WX 834 ; N threequarters ; B 22 -15 782 705 ;
+C -1 ; WX 500 ; N ydieresis ; B -83 -205 450 646 ;
+C -1 ; WX 500 ; N yacute ; B -83 -205 450 690 ;
+C -1 ; WX 333 ; N iacute ; B 29 -15 355 690 ;
+C -1 ; WX 704 ; N Acircumflex ; B -87 0 668 946 ;
+C -1 ; WX 815 ; N Uacute ; B 93 -15 867 946 ;
+C -1 ; WX 444 ; N eacute ; B -6 -15 411 690 ;
+C -1 ; WX 778 ; N Ograve ; B 40 -15 738 946 ;
+C -1 ; WX 574 ; N agrave ; B 2 -15 524 690 ;
+C -1 ; WX 815 ; N Udieresis ; B 93 -15 867 902 ;
+C -1 ; WX 574 ; N acircumflex ; B 2 -15 524 690 ;
+C -1 ; WX 407 ; N Igrave ; B -33 0 435 946 ;
+C -1 ; WX 333 ; N twosuperior ; B 0 282 359 705 ;
+C -1 ; WX 815 ; N Ugrave ; B 93 -15 867 946 ;
+C -1 ; WX 834 ; N onequarter ; B 34 -15 782 705 ;
+C -1 ; WX 815 ; N Ucircumflex ; B 93 -15 867 946 ;
+C -1 ; WX 667 ; N Scaron ; B -6 -15 638 946 ;
+C -1 ; WX 407 ; N Idieresis ; B -33 0 456 902 ;
+C -1 ; WX 333 ; N idieresis ; B 29 -15 359 646 ;
+C -1 ; WX 722 ; N Egrave ; B -33 0 700 946 ;
+C -1 ; WX 778 ; N Oacute ; B 40 -15 738 946 ;
+C -1 ; WX 606 ; N divide ; B 50 -22 556 528 ;
+C -1 ; WX 704 ; N Atilde ; B -87 0 668 905 ;
+C -1 ; WX 704 ; N Aring ; B -87 0 668 958 ;
+C -1 ; WX 778 ; N Odieresis ; B 40 -15 738 902 ;
+C -1 ; WX 704 ; N Adieresis ; B -87 0 668 902 ;
+C -1 ; WX 815 ; N Ntilde ; B -51 -15 866 905 ;
+C -1 ; WX 667 ; N Zcaron ; B -25 0 667 946 ;
+C -1 ; WX 667 ; N Thorn ; B -33 0 627 722 ;
+C -1 ; WX 407 ; N Iacute ; B -33 0 452 946 ;
+C -1 ; WX 606 ; N plusminus ; B 50 0 556 506 ;
+C -1 ; WX 606 ; N multiply ; B 74 24 532 482 ;
+C -1 ; WX 722 ; N Eacute ; B -33 0 700 946 ;
+C -1 ; WX 685 ; N Ydieresis ; B 31 0 760 902 ;
+C -1 ; WX 333 ; N onesuperior ; B 34 282 311 705 ;
+C -1 ; WX 611 ; N ugrave ; B 44 -15 556 690 ;
+C -1 ; WX 606 ; N logicalnot ; B 50 108 556 389 ;
+C -1 ; WX 611 ; N ntilde ; B 14 -15 562 649 ;
+C -1 ; WX 778 ; N Otilde ; B 40 -15 738 905 ;
+C -1 ; WX 500 ; N otilde ; B 2 -15 467 649 ;
+C -1 ; WX 722 ; N Ccedilla ; B 40 -215 712 737 ;
+C -1 ; WX 704 ; N Agrave ; B -87 0 668 946 ;
+C -1 ; WX 834 ; N onehalf ; B 34 -15 776 705 ;
+C -1 ; WX 778 ; N Eth ; B -33 0 738 722 ;
+C -1 ; WX 400 ; N degree ; B 86 419 372 705 ;
+C -1 ; WX 685 ; N Yacute ; B 31 0 760 946 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 40 -15 738 946 ;
+C -1 ; WX 500 ; N oacute ; B 2 -15 450 690 ;
+C -1 ; WX 611 ; N mu ; B -60 -205 556 466 ;
+C -1 ; WX 606 ; N minus ; B 50 217 556 289 ;
+C -1 ; WX 500 ; N eth ; B 2 -15 450 737 ;
+C -1 ; WX 500 ; N odieresis ; B 2 -15 450 646 ;
+C -1 ; WX 747 ; N copyright ; B -2 -15 750 737 ;
+C -1 ; WX 606 ; N brokenbar ; B 267 -175 339 675 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 181
+
+KPX A y -55
+KPX A w -18
+KPX A v -18
+KPX A u -18
+KPX A quoteright -125
+KPX A quotedblright -125
+KPX A Y -55
+KPX A W -74
+KPX A V -74
+KPX A U -37
+KPX A T -30
+KPX A Q -18
+KPX A O -18
+KPX A G -18
+KPX A C -18
+
+KPX B period -50
+KPX B comma -50
+
+KPX C period -50
+KPX C comma -50
+
+KPX D period -50
+KPX D comma -50
+KPX D Y -18
+KPX D W -18
+KPX D V -18
+
+KPX F r -55
+KPX F period -125
+KPX F o -55
+KPX F i -10
+KPX F e -55
+KPX F comma -125
+KPX F a -55
+KPX F A -35
+
+KPX G period -50
+KPX G comma -50
+
+KPX J u -18
+KPX J period -100
+KPX J o -37
+KPX J e -37
+KPX J comma -100
+KPX J a -37
+KPX J A -18
+
+KPX L y -50
+KPX L quoteright -125
+KPX L quotedblright -125
+KPX L Y -100
+KPX L W -100
+KPX L V -100
+KPX L T -100
+
+KPX N period -60
+KPX N comma -60
+
+KPX O period -50
+KPX O comma -50
+KPX O Y -18
+KPX O X -18
+KPX O V -18
+KPX O T 18
+
+KPX P period -125
+KPX P o -55
+KPX P e -55
+KPX P comma -125
+KPX P a -55
+KPX P A -50
+
+KPX Q period -20
+KPX Q comma -20
+
+KPX R Y -18
+KPX R W -18
+KPX R V -18
+KPX R U -18
+
+KPX S period -50
+KPX S comma -50
+
+KPX T y -50
+KPX T w -50
+KPX T u -50
+KPX T semicolon -50
+KPX T r -50
+KPX T period -100
+KPX T o -74
+KPX T i -18
+KPX T hyphen -100
+KPX T h -25
+KPX T e -74
+KPX T comma -100
+KPX T colon -50
+KPX T a -74
+KPX T O 18
+
+KPX U period -100
+KPX U comma -100
+KPX U A -18
+
+KPX V u -75
+KPX V semicolon -75
+KPX V period -100
+KPX V o -75
+KPX V i -50
+KPX V hyphen -100
+KPX V e -75
+KPX V comma -100
+KPX V colon -75
+KPX V a -75
+KPX V A -37
+
+KPX W y -55
+KPX W u -55
+KPX W semicolon -75
+KPX W period -100
+KPX W o -55
+KPX W i -20
+KPX W hyphen -75
+KPX W h -20
+KPX W e -55
+KPX W comma -100
+KPX W colon -75
+KPX W a -55
+KPX W A -55
+
+KPX Y u -100
+KPX Y semicolon -75
+KPX Y period -100
+KPX Y o -100
+KPX Y i -25
+KPX Y hyphen -100
+KPX Y e -100
+KPX Y comma -100
+KPX Y colon -75
+KPX Y a -100
+KPX Y A -55
+
+KPX b period -50
+KPX b comma -50
+KPX b b -10
+
+KPX c period -50
+KPX c k -18
+KPX c h -18
+KPX c comma -50
+
+KPX colon space -37
+
+KPX comma space -37
+KPX comma quoteright -37
+KPX comma quotedblright -37
+
+KPX e period -37
+KPX e comma -37
+
+KPX f quoteright 75
+KPX f quotedblright 75
+KPX f period -75
+KPX f o -10
+KPX f comma -75
+
+KPX g period -50
+KPX g comma -50
+
+KPX l y -10
+
+KPX o period -50
+KPX o comma -50
+
+KPX p period -50
+KPX p comma -50
+
+KPX period space -37
+KPX period quoteright -37
+KPX period quotedblright -37
+
+KPX quotedblleft A -75
+
+KPX quotedblright space -37
+
+KPX quoteleft quoteleft -37
+KPX quoteleft A -75
+
+KPX quoteright s -25
+KPX quoteright quoteright -37
+KPX quoteright d -37
+
+KPX r semicolon -25
+KPX r s -10
+KPX r period -125
+KPX r k -18
+KPX r hyphen -75
+KPX r comma -125
+KPX r colon -25
+
+KPX s period -50
+KPX s comma -50
+
+KPX semicolon space -37
+
+KPX space quoteleft -37
+KPX space quotedblleft -37
+KPX space Y -37
+KPX space W -37
+KPX space V -37
+KPX space T -37
+KPX space A -37
+
+KPX v period -75
+KPX v comma -75
+
+KPX w period -75
+KPX w comma -75
+
+KPX y period -75
+KPX y comma -75
+EndKernPairs
+EndKernData
+StartComposites 56
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 246 256 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 246 256 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 231 256 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 246 256 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 216 246 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 231 256 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 255 256 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 255 256 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 255 256 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 255 256 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 97 256 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 97 256 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 97 256 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 97 256 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 301 256 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 283 256 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 283 256 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 283 256 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 283 256 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 283 256 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 227 256 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 301 256 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 301 256 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 301 256 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 301 256 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 256 256 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 236 256 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 227 256 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 121 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 121 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 121 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 121 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 121 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 121 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 56 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 56 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 56 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 56 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute 0 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex 0 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis 0 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave 0 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 139 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 84 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 84 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 84 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 84 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 84 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 56 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 139 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 139 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 139 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 139 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 84 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 84 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 65 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pplb8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pplb8a.afm
new file mode 100644
index 0000000..de7698d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pplb8a.afm
@@ -0,0 +1,434 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Mon Jul 2 22:26:30 1990
+Comment UniqueID 31793
+Comment VMusage 36031 46923
+FontName Palatino-Bold
+FullName Palatino Bold
+FamilyName Palatino
+Weight Bold
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -152 -266 1000 924
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.005
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.Palatino is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 681
+XHeight 471
+Ascender 720
+Descender -258
+StartCharMetrics 228
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 278 ; N exclam ; B 63 -12 219 688 ;
+C 34 ; WX 402 ; N quotedbl ; B 22 376 380 695 ;
+C 35 ; WX 500 ; N numbersign ; B 4 0 496 673 ;
+C 36 ; WX 500 ; N dollar ; B 28 -114 472 721 ;
+C 37 ; WX 889 ; N percent ; B 61 -9 828 714 ;
+C 38 ; WX 833 ; N ampersand ; B 52 -17 813 684 ;
+C 39 ; WX 278 ; N quoteright ; B 29 405 249 695 ;
+C 40 ; WX 333 ; N parenleft ; B 65 -104 305 723 ;
+C 41 ; WX 333 ; N parenright ; B 28 -104 268 723 ;
+C 42 ; WX 444 ; N asterisk ; B 44 332 399 695 ;
+C 43 ; WX 606 ; N plus ; B 51 0 555 505 ;
+C 44 ; WX 250 ; N comma ; B -6 -166 227 141 ;
+C 45 ; WX 333 ; N hyphen ; B 16 195 317 305 ;
+C 46 ; WX 250 ; N period ; B 47 -12 203 144 ;
+C 47 ; WX 296 ; N slash ; B -9 -17 305 720 ;
+C 48 ; WX 500 ; N zero ; B 33 -17 468 660 ;
+C 49 ; WX 500 ; N one ; B 35 -3 455 670 ;
+C 50 ; WX 500 ; N two ; B 25 -3 472 660 ;
+C 51 ; WX 500 ; N three ; B 22 -17 458 660 ;
+C 52 ; WX 500 ; N four ; B 12 -3 473 672 ;
+C 53 ; WX 500 ; N five ; B 42 -17 472 656 ;
+C 54 ; WX 500 ; N six ; B 37 -17 469 660 ;
+C 55 ; WX 500 ; N seven ; B 46 -3 493 656 ;
+C 56 ; WX 500 ; N eight ; B 34 -17 467 660 ;
+C 57 ; WX 500 ; N nine ; B 31 -17 463 660 ;
+C 58 ; WX 250 ; N colon ; B 47 -12 203 454 ;
+C 59 ; WX 250 ; N semicolon ; B -6 -166 227 454 ;
+C 60 ; WX 606 ; N less ; B 49 -15 558 519 ;
+C 61 ; WX 606 ; N equal ; B 51 114 555 396 ;
+C 62 ; WX 606 ; N greater ; B 49 -15 558 519 ;
+C 63 ; WX 444 ; N question ; B 43 -12 411 687 ;
+C 64 ; WX 747 ; N at ; B 42 -12 704 681 ;
+C 65 ; WX 778 ; N A ; B 24 -3 757 686 ;
+C 66 ; WX 667 ; N B ; B 39 -3 611 681 ;
+C 67 ; WX 722 ; N C ; B 44 -17 695 695 ;
+C 68 ; WX 833 ; N D ; B 35 -3 786 681 ;
+C 69 ; WX 611 ; N E ; B 39 -4 577 681 ;
+C 70 ; WX 556 ; N F ; B 28 -3 539 681 ;
+C 71 ; WX 833 ; N G ; B 47 -17 776 695 ;
+C 72 ; WX 833 ; N H ; B 36 -3 796 681 ;
+C 73 ; WX 389 ; N I ; B 39 -3 350 681 ;
+C 74 ; WX 389 ; N J ; B -11 -213 350 681 ;
+C 75 ; WX 778 ; N K ; B 39 -3 763 681 ;
+C 76 ; WX 611 ; N L ; B 39 -4 577 681 ;
+C 77 ; WX 1000 ; N M ; B 32 -10 968 681 ;
+C 78 ; WX 833 ; N N ; B 35 -16 798 681 ;
+C 79 ; WX 833 ; N O ; B 47 -17 787 695 ;
+C 80 ; WX 611 ; N P ; B 39 -3 594 681 ;
+C 81 ; WX 833 ; N Q ; B 47 -184 787 695 ;
+C 82 ; WX 722 ; N R ; B 39 -3 708 681 ;
+C 83 ; WX 611 ; N S ; B 57 -17 559 695 ;
+C 84 ; WX 667 ; N T ; B 17 -3 650 681 ;
+C 85 ; WX 778 ; N U ; B 26 -17 760 681 ;
+C 86 ; WX 778 ; N V ; B 20 -3 763 681 ;
+C 87 ; WX 1000 ; N W ; B 17 -3 988 686 ;
+C 88 ; WX 667 ; N X ; B 17 -3 650 695 ;
+C 89 ; WX 667 ; N Y ; B 15 -3 660 695 ;
+C 90 ; WX 667 ; N Z ; B 24 -3 627 681 ;
+C 91 ; WX 333 ; N bracketleft ; B 73 -104 291 720 ;
+C 92 ; WX 606 ; N backslash ; B 72 0 534 720 ;
+C 93 ; WX 333 ; N bracketright ; B 42 -104 260 720 ;
+C 94 ; WX 606 ; N asciicircum ; B 52 275 554 678 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 278 ; N quoteleft ; B 29 405 249 695 ;
+C 97 ; WX 500 ; N a ; B 40 -17 478 471 ;
+C 98 ; WX 611 ; N b ; B 10 -17 556 720 ;
+C 99 ; WX 444 ; N c ; B 37 -17 414 471 ;
+C 100 ; WX 611 ; N d ; B 42 -17 577 720 ;
+C 101 ; WX 500 ; N e ; B 42 -17 461 471 ;
+C 102 ; WX 389 ; N f ; B 34 -3 381 720 ; L i fi ; L l fl ;
+C 103 ; WX 556 ; N g ; B 26 -266 535 471 ;
+C 104 ; WX 611 ; N h ; B 24 -3 587 720 ;
+C 105 ; WX 333 ; N i ; B 34 -3 298 706 ;
+C 106 ; WX 333 ; N j ; B 3 -266 241 706 ;
+C 107 ; WX 611 ; N k ; B 21 -3 597 720 ;
+C 108 ; WX 333 ; N l ; B 24 -3 296 720 ;
+C 109 ; WX 889 ; N m ; B 24 -3 864 471 ;
+C 110 ; WX 611 ; N n ; B 24 -3 587 471 ;
+C 111 ; WX 556 ; N o ; B 40 -17 517 471 ;
+C 112 ; WX 611 ; N p ; B 29 -258 567 471 ;
+C 113 ; WX 611 ; N q ; B 52 -258 589 471 ;
+C 114 ; WX 389 ; N r ; B 30 -3 389 471 ;
+C 115 ; WX 444 ; N s ; B 39 -17 405 471 ;
+C 116 ; WX 333 ; N t ; B 22 -17 324 632 ;
+C 117 ; WX 611 ; N u ; B 25 -17 583 471 ;
+C 118 ; WX 556 ; N v ; B 11 -3 545 459 ;
+C 119 ; WX 833 ; N w ; B 13 -3 820 471 ;
+C 120 ; WX 500 ; N x ; B 20 -3 483 471 ;
+C 121 ; WX 556 ; N y ; B 10 -266 546 459 ;
+C 122 ; WX 500 ; N z ; B 16 -3 464 459 ;
+C 123 ; WX 310 ; N braceleft ; B 5 -117 288 725 ;
+C 124 ; WX 606 ; N bar ; B 260 0 346 720 ;
+C 125 ; WX 310 ; N braceright ; B 22 -117 305 725 ;
+C 126 ; WX 606 ; N asciitilde ; B 51 155 555 342 ;
+C 161 ; WX 278 ; N exclamdown ; B 59 -227 215 471 ;
+C 162 ; WX 500 ; N cent ; B 73 -106 450 554 ;
+C 163 ; WX 500 ; N sterling ; B -2 -19 501 676 ;
+C 164 ; WX 167 ; N fraction ; B -152 0 320 660 ;
+C 165 ; WX 500 ; N yen ; B 17 -3 483 695 ;
+C 166 ; WX 500 ; N florin ; B 11 -242 490 703 ;
+C 167 ; WX 500 ; N section ; B 30 -217 471 695 ;
+C 168 ; WX 500 ; N currency ; B 32 96 468 533 ;
+C 169 ; WX 227 ; N quotesingle ; B 45 376 181 695 ;
+C 170 ; WX 500 ; N quotedblleft ; B 34 405 466 695 ;
+C 171 ; WX 500 ; N guillemotleft ; B 36 44 463 438 ;
+C 172 ; WX 389 ; N guilsinglleft ; B 82 44 307 438 ;
+C 173 ; WX 389 ; N guilsinglright ; B 82 44 307 438 ;
+C 174 ; WX 611 ; N fi ; B 10 -3 595 720 ;
+C 175 ; WX 611 ; N fl ; B 17 -3 593 720 ;
+C 177 ; WX 500 ; N endash ; B 0 208 500 291 ;
+C 178 ; WX 500 ; N dagger ; B 29 -6 472 682 ;
+C 179 ; WX 500 ; N daggerdbl ; B 32 -245 468 682 ;
+C 180 ; WX 250 ; N periodcentered ; B 47 179 203 335 ;
+C 182 ; WX 641 ; N paragraph ; B 19 -161 599 683 ;
+C 183 ; WX 606 ; N bullet ; B 131 172 475 516 ;
+C 184 ; WX 333 ; N quotesinglbase ; B 56 -160 276 130 ;
+C 185 ; WX 500 ; N quotedblbase ; B 34 -160 466 130 ;
+C 186 ; WX 500 ; N quotedblright ; B 34 405 466 695 ;
+C 187 ; WX 500 ; N guillemotright ; B 37 44 464 438 ;
+C 188 ; WX 1000 ; N ellipsis ; B 89 -12 911 144 ;
+C 189 ; WX 1000 ; N perthousand ; B 33 -9 982 724 ;
+C 191 ; WX 444 ; N questiondown ; B 33 -231 401 471 ;
+C 193 ; WX 333 ; N grave ; B 18 506 256 691 ;
+C 194 ; WX 333 ; N acute ; B 78 506 316 691 ;
+C 195 ; WX 333 ; N circumflex ; B -2 506 335 681 ;
+C 196 ; WX 333 ; N tilde ; B -16 535 349 661 ;
+C 197 ; WX 333 ; N macron ; B 1 538 332 609 ;
+C 198 ; WX 333 ; N breve ; B 15 506 318 669 ;
+C 199 ; WX 333 ; N dotaccent ; B 100 537 234 671 ;
+C 200 ; WX 333 ; N dieresis ; B -8 537 341 671 ;
+C 202 ; WX 333 ; N ring ; B 67 500 267 700 ;
+C 203 ; WX 333 ; N cedilla ; B 73 -225 300 -7 ;
+C 205 ; WX 333 ; N hungarumlaut ; B -56 506 390 691 ;
+C 206 ; WX 333 ; N ogonek ; B 60 -246 274 -17 ;
+C 207 ; WX 333 ; N caron ; B -2 510 335 685 ;
+C 208 ; WX 1000 ; N emdash ; B 0 208 1000 291 ;
+C 225 ; WX 1000 ; N AE ; B 12 -4 954 681 ;
+C 227 ; WX 438 ; N ordfeminine ; B 77 367 361 660 ;
+C 232 ; WX 611 ; N Lslash ; B 16 -4 577 681 ;
+C 233 ; WX 833 ; N Oslash ; B 32 -20 808 698 ;
+C 234 ; WX 1000 ; N OE ; B 43 -17 985 695 ;
+C 235 ; WX 488 ; N ordmasculine ; B 89 367 399 660 ;
+C 241 ; WX 778 ; N ae ; B 46 -17 731 471 ;
+C 245 ; WX 333 ; N dotlessi ; B 34 -3 298 471 ;
+C 248 ; WX 333 ; N lslash ; B -4 -3 334 720 ;
+C 249 ; WX 556 ; N oslash ; B 23 -18 534 471 ;
+C 250 ; WX 833 ; N oe ; B 48 -17 799 471 ;
+C 251 ; WX 611 ; N germandbls ; B 30 -17 565 720 ;
+C -1 ; WX 667 ; N Zcaron ; B 24 -3 627 909 ;
+C -1 ; WX 444 ; N ccedilla ; B 37 -225 414 471 ;
+C -1 ; WX 556 ; N ydieresis ; B 10 -266 546 691 ;
+C -1 ; WX 500 ; N atilde ; B 40 -17 478 673 ;
+C -1 ; WX 333 ; N icircumflex ; B -2 -3 335 701 ;
+C -1 ; WX 300 ; N threesuperior ; B 9 261 292 667 ;
+C -1 ; WX 500 ; N ecircumflex ; B 42 -17 461 701 ;
+C -1 ; WX 611 ; N thorn ; B 17 -258 563 720 ;
+C -1 ; WX 500 ; N egrave ; B 42 -17 461 711 ;
+C -1 ; WX 300 ; N twosuperior ; B 5 261 295 660 ;
+C -1 ; WX 500 ; N eacute ; B 42 -17 461 711 ;
+C -1 ; WX 556 ; N otilde ; B 40 -17 517 673 ;
+C -1 ; WX 778 ; N Aacute ; B 24 -3 757 915 ;
+C -1 ; WX 556 ; N ocircumflex ; B 40 -17 517 701 ;
+C -1 ; WX 556 ; N yacute ; B 10 -266 546 711 ;
+C -1 ; WX 611 ; N udieresis ; B 25 -17 583 691 ;
+C -1 ; WX 750 ; N threequarters ; B 15 -2 735 667 ;
+C -1 ; WX 500 ; N acircumflex ; B 40 -17 478 701 ;
+C -1 ; WX 833 ; N Eth ; B 10 -3 786 681 ;
+C -1 ; WX 500 ; N edieresis ; B 42 -17 461 691 ;
+C -1 ; WX 611 ; N ugrave ; B 25 -17 583 711 ;
+C -1 ; WX 998 ; N trademark ; B 38 274 961 678 ;
+C -1 ; WX 556 ; N ograve ; B 40 -17 517 711 ;
+C -1 ; WX 444 ; N scaron ; B 39 -17 405 693 ;
+C -1 ; WX 389 ; N Idieresis ; B 20 -3 369 895 ;
+C -1 ; WX 611 ; N uacute ; B 25 -17 583 711 ;
+C -1 ; WX 500 ; N agrave ; B 40 -17 478 711 ;
+C -1 ; WX 611 ; N ntilde ; B 24 -3 587 673 ;
+C -1 ; WX 500 ; N aring ; B 40 -17 478 700 ;
+C -1 ; WX 500 ; N zcaron ; B 16 -3 464 693 ;
+C -1 ; WX 389 ; N Icircumflex ; B 26 -3 363 905 ;
+C -1 ; WX 833 ; N Ntilde ; B 35 -16 798 885 ;
+C -1 ; WX 611 ; N ucircumflex ; B 25 -17 583 701 ;
+C -1 ; WX 611 ; N Ecircumflex ; B 39 -4 577 905 ;
+C -1 ; WX 389 ; N Iacute ; B 39 -3 350 915 ;
+C -1 ; WX 722 ; N Ccedilla ; B 44 -225 695 695 ;
+C -1 ; WX 833 ; N Odieresis ; B 47 -17 787 895 ;
+C -1 ; WX 611 ; N Scaron ; B 57 -17 559 909 ;
+C -1 ; WX 611 ; N Edieresis ; B 39 -4 577 895 ;
+C -1 ; WX 389 ; N Igrave ; B 39 -3 350 915 ;
+C -1 ; WX 500 ; N adieresis ; B 40 -17 478 691 ;
+C -1 ; WX 833 ; N Ograve ; B 47 -17 787 915 ;
+C -1 ; WX 611 ; N Egrave ; B 39 -4 577 915 ;
+C -1 ; WX 667 ; N Ydieresis ; B 15 -3 660 895 ;
+C -1 ; WX 747 ; N registered ; B 26 -17 720 695 ;
+C -1 ; WX 833 ; N Otilde ; B 47 -17 787 885 ;
+C -1 ; WX 750 ; N onequarter ; B 19 -2 735 665 ;
+C -1 ; WX 778 ; N Ugrave ; B 26 -17 760 915 ;
+C -1 ; WX 778 ; N Ucircumflex ; B 26 -17 760 905 ;
+C -1 ; WX 611 ; N Thorn ; B 39 -3 574 681 ;
+C -1 ; WX 606 ; N divide ; B 51 0 555 510 ;
+C -1 ; WX 778 ; N Atilde ; B 24 -3 757 885 ;
+C -1 ; WX 778 ; N Uacute ; B 26 -17 760 915 ;
+C -1 ; WX 833 ; N Ocircumflex ; B 47 -17 787 905 ;
+C -1 ; WX 606 ; N logicalnot ; B 51 114 555 396 ;
+C -1 ; WX 778 ; N Aring ; B 24 -3 757 924 ;
+C -1 ; WX 333 ; N idieresis ; B -8 -3 341 691 ;
+C -1 ; WX 333 ; N iacute ; B 34 -3 316 711 ;
+C -1 ; WX 500 ; N aacute ; B 40 -17 478 711 ;
+C -1 ; WX 606 ; N plusminus ; B 51 0 555 505 ;
+C -1 ; WX 606 ; N multiply ; B 72 21 534 483 ;
+C -1 ; WX 778 ; N Udieresis ; B 26 -17 760 895 ;
+C -1 ; WX 606 ; N minus ; B 51 212 555 298 ;
+C -1 ; WX 300 ; N onesuperior ; B 14 261 287 665 ;
+C -1 ; WX 611 ; N Eacute ; B 39 -4 577 915 ;
+C -1 ; WX 778 ; N Acircumflex ; B 24 -3 757 905 ;
+C -1 ; WX 747 ; N copyright ; B 26 -17 720 695 ;
+C -1 ; WX 778 ; N Agrave ; B 24 -3 757 915 ;
+C -1 ; WX 556 ; N odieresis ; B 40 -17 517 691 ;
+C -1 ; WX 556 ; N oacute ; B 40 -17 517 711 ;
+C -1 ; WX 400 ; N degree ; B 50 360 350 660 ;
+C -1 ; WX 333 ; N igrave ; B 18 -3 298 711 ;
+C -1 ; WX 611 ; N mu ; B 25 -225 583 471 ;
+C -1 ; WX 833 ; N Oacute ; B 47 -17 787 915 ;
+C -1 ; WX 556 ; N eth ; B 40 -17 517 720 ;
+C -1 ; WX 778 ; N Adieresis ; B 24 -3 757 895 ;
+C -1 ; WX 667 ; N Yacute ; B 15 -3 660 915 ;
+C -1 ; WX 606 ; N brokenbar ; B 260 0 346 720 ;
+C -1 ; WX 750 ; N onehalf ; B 9 -2 745 665 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 101
+
+KPX A y -70
+KPX A w -70
+KPX A v -70
+KPX A space -18
+KPX A quoteright -92
+KPX A Y -111
+KPX A W -90
+KPX A V -129
+KPX A T -92
+
+KPX F period -111
+KPX F comma -111
+KPX F A -55
+
+KPX L y -74
+KPX L space -18
+KPX L quoteright -74
+KPX L Y -92
+KPX L W -92
+KPX L V -92
+KPX L T -74
+
+KPX P period -129
+KPX P comma -129
+KPX P A -74
+
+KPX R y -30
+KPX R Y -55
+KPX R W -37
+KPX R V -74
+KPX R T -55
+
+KPX T y -90
+KPX T w -90
+KPX T u -129
+KPX T semicolon -74
+KPX T s -111
+KPX T r -111
+KPX T period -92
+KPX T o -111
+KPX T i -55
+KPX T hyphen -92
+KPX T e -111
+KPX T comma -92
+KPX T colon -74
+KPX T c -129
+KPX T a -111
+KPX T A -92
+
+KPX V y -90
+KPX V u -92
+KPX V semicolon -74
+KPX V r -111
+KPX V period -129
+KPX V o -111
+KPX V i -55
+KPX V hyphen -92
+KPX V e -111
+KPX V comma -129
+KPX V colon -74
+KPX V a -111
+KPX V A -129
+
+KPX W y -74
+KPX W u -74
+KPX W semicolon -37
+KPX W r -74
+KPX W period -37
+KPX W o -74
+KPX W i -37
+KPX W hyphen -37
+KPX W e -74
+KPX W comma -92
+KPX W colon -37
+KPX W a -74
+KPX W A -90
+
+KPX Y v -74
+KPX Y u -74
+KPX Y semicolon -55
+KPX Y q -92
+KPX Y period -74
+KPX Y p -74
+KPX Y o -74
+KPX Y i -55
+KPX Y hyphen -74
+KPX Y e -74
+KPX Y comma -74
+KPX Y colon -55
+KPX Y a -74
+KPX Y A -55
+
+KPX f quoteright 37
+KPX f f -18
+
+KPX one one -37
+
+KPX quoteleft quoteleft -55
+
+KPX quoteright t -18
+KPX quoteright space -55
+KPX quoteright s -55
+KPX quoteright quoteright -55
+
+KPX r quoteright 55
+KPX r period -55
+KPX r hyphen -18
+KPX r comma -55
+
+KPX v period -111
+KPX v comma -111
+
+KPX w period -92
+KPX w comma -92
+
+KPX y period -92
+KPX y comma -92
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 223 224 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 211 224 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 223 224 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 215 224 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 223 224 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 223 224 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 195 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 139 224 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 139 224 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 139 224 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 139 224 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 28 224 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 28 224 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 28 224 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 28 224 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 250 224 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 250 224 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 250 224 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 250 224 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 250 224 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 250 224 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 139 224 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 235 224 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 235 224 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 235 224 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 223 224 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 211 224 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 199 224 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 167 224 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 84 20 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 84 20 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 84 20 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 84 20 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 84 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 84 12 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 56 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 84 20 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 96 20 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 92 20 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 84 20 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute 0 20 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex 0 20 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis 0 20 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave 0 20 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 139 12 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 112 20 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 112 20 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 112 20 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 112 20 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 112 12 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 56 8 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 151 20 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 139 20 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 139 20 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 131 20 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 144 20 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 124 20 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 84 8 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pplbi8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pplbi8a.afm
new file mode 100644
index 0000000..e161d04
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pplbi8a.afm
@@ -0,0 +1,441 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Mon Jul 2 22:48:39 1990
+Comment UniqueID 31799
+Comment VMusage 37656 48548
+FontName Palatino-BoldItalic
+FullName Palatino Bold Italic
+FamilyName Palatino
+Weight Bold
+ItalicAngle -10
+IsFixedPitch false
+FontBBox -170 -271 1073 926
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.005
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.Palatino is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 681
+XHeight 469
+Ascender 726
+Descender -271
+StartCharMetrics 228
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 58 -17 322 695 ;
+C 34 ; WX 500 ; N quotedbl ; B 137 467 493 720 ;
+C 35 ; WX 500 ; N numbersign ; B 4 0 496 673 ;
+C 36 ; WX 500 ; N dollar ; B 20 -108 477 737 ;
+C 37 ; WX 889 ; N percent ; B 56 -17 790 697 ;
+C 38 ; WX 833 ; N ampersand ; B 74 -17 811 695 ;
+C 39 ; WX 278 ; N quoteright ; B 76 431 302 720 ;
+C 40 ; WX 333 ; N parenleft ; B 58 -129 368 723 ;
+C 41 ; WX 333 ; N parenright ; B -12 -129 298 723 ;
+C 42 ; WX 444 ; N asterisk ; B 84 332 439 695 ;
+C 43 ; WX 606 ; N plus ; B 50 -5 556 501 ;
+C 44 ; WX 250 ; N comma ; B -33 -164 208 147 ;
+C 45 ; WX 389 ; N hyphen ; B 37 198 362 300 ;
+C 46 ; WX 250 ; N period ; B 48 -17 187 135 ;
+C 47 ; WX 315 ; N slash ; B 1 -17 315 720 ;
+C 48 ; WX 500 ; N zero ; B 42 -17 490 683 ;
+C 49 ; WX 500 ; N one ; B 41 -3 434 678 ;
+C 50 ; WX 500 ; N two ; B 1 -3 454 683 ;
+C 51 ; WX 500 ; N three ; B 8 -17 450 683 ;
+C 52 ; WX 500 ; N four ; B 3 -3 487 683 ;
+C 53 ; WX 500 ; N five ; B 14 -17 481 675 ;
+C 54 ; WX 500 ; N six ; B 39 -17 488 683 ;
+C 55 ; WX 500 ; N seven ; B 69 -3 544 674 ;
+C 56 ; WX 500 ; N eight ; B 26 -17 484 683 ;
+C 57 ; WX 500 ; N nine ; B 27 -17 491 683 ;
+C 58 ; WX 250 ; N colon ; B 38 -17 236 452 ;
+C 59 ; WX 250 ; N semicolon ; B -33 -164 247 452 ;
+C 60 ; WX 606 ; N less ; B 49 -21 558 517 ;
+C 61 ; WX 606 ; N equal ; B 51 106 555 390 ;
+C 62 ; WX 606 ; N greater ; B 48 -21 557 517 ;
+C 63 ; WX 444 ; N question ; B 91 -17 450 695 ;
+C 64 ; WX 833 ; N at ; B 82 -12 744 681 ;
+C 65 ; WX 722 ; N A ; B -35 -3 685 683 ;
+C 66 ; WX 667 ; N B ; B 8 -3 629 681 ;
+C 67 ; WX 685 ; N C ; B 69 -17 695 695 ;
+C 68 ; WX 778 ; N D ; B 0 -3 747 682 ;
+C 69 ; WX 611 ; N E ; B 11 -3 606 681 ;
+C 70 ; WX 556 ; N F ; B -6 -3 593 681 ;
+C 71 ; WX 778 ; N G ; B 72 -17 750 695 ;
+C 72 ; WX 778 ; N H ; B -12 -3 826 681 ;
+C 73 ; WX 389 ; N I ; B -1 -3 412 681 ;
+C 74 ; WX 389 ; N J ; B -29 -207 417 681 ;
+C 75 ; WX 722 ; N K ; B -10 -3 746 681 ;
+C 76 ; WX 611 ; N L ; B 26 -3 578 681 ;
+C 77 ; WX 944 ; N M ; B -23 -17 985 681 ;
+C 78 ; WX 778 ; N N ; B -2 -3 829 681 ;
+C 79 ; WX 833 ; N O ; B 76 -17 794 695 ;
+C 80 ; WX 667 ; N P ; B 11 -3 673 681 ;
+C 81 ; WX 833 ; N Q ; B 76 -222 794 695 ;
+C 82 ; WX 722 ; N R ; B 4 -3 697 681 ;
+C 83 ; WX 556 ; N S ; B 50 -17 517 695 ;
+C 84 ; WX 611 ; N T ; B 56 -3 674 681 ;
+C 85 ; WX 778 ; N U ; B 83 -17 825 681 ;
+C 86 ; WX 667 ; N V ; B 67 -3 745 681 ;
+C 87 ; WX 1000 ; N W ; B 67 -3 1073 689 ;
+C 88 ; WX 722 ; N X ; B -9 -3 772 681 ;
+C 89 ; WX 611 ; N Y ; B 54 -3 675 695 ;
+C 90 ; WX 667 ; N Z ; B 1 -3 676 681 ;
+C 91 ; WX 333 ; N bracketleft ; B 45 -102 381 723 ;
+C 92 ; WX 606 ; N backslash ; B 72 0 534 720 ;
+C 93 ; WX 333 ; N bracketright ; B -21 -102 315 723 ;
+C 94 ; WX 606 ; N asciicircum ; B 63 275 543 678 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 278 ; N quoteleft ; B 65 431 291 720 ;
+C 97 ; WX 556 ; N a ; B 44 -17 519 470 ;
+C 98 ; WX 537 ; N b ; B 44 -17 494 726 ;
+C 99 ; WX 444 ; N c ; B 32 -17 436 469 ;
+C 100 ; WX 556 ; N d ; B 38 -17 550 726 ;
+C 101 ; WX 444 ; N e ; B 28 -17 418 469 ;
+C 102 ; WX 333 ; N f ; B -130 -271 449 726 ; L i fi ; L l fl ;
+C 103 ; WX 500 ; N g ; B -50 -271 529 469 ;
+C 104 ; WX 556 ; N h ; B 22 -17 522 726 ;
+C 105 ; WX 333 ; N i ; B 26 -17 312 695 ;
+C 106 ; WX 333 ; N j ; B -64 -271 323 695 ;
+C 107 ; WX 556 ; N k ; B 34 -17 528 726 ;
+C 108 ; WX 333 ; N l ; B 64 -17 318 726 ;
+C 109 ; WX 833 ; N m ; B 19 -17 803 469 ;
+C 110 ; WX 556 ; N n ; B 17 -17 521 469 ;
+C 111 ; WX 556 ; N o ; B 48 -17 502 469 ;
+C 112 ; WX 556 ; N p ; B -21 -271 516 469 ;
+C 113 ; WX 537 ; N q ; B 32 -271 513 469 ;
+C 114 ; WX 389 ; N r ; B 20 -17 411 469 ;
+C 115 ; WX 444 ; N s ; B 25 -17 406 469 ;
+C 116 ; WX 389 ; N t ; B 42 -17 409 636 ;
+C 117 ; WX 556 ; N u ; B 22 -17 521 469 ;
+C 118 ; WX 556 ; N v ; B 19 -17 513 469 ;
+C 119 ; WX 833 ; N w ; B 27 -17 802 469 ;
+C 120 ; WX 500 ; N x ; B -8 -17 500 469 ;
+C 121 ; WX 556 ; N y ; B 13 -271 541 469 ;
+C 122 ; WX 500 ; N z ; B 31 -17 470 469 ;
+C 123 ; WX 333 ; N braceleft ; B 18 -105 334 720 ;
+C 124 ; WX 606 ; N bar ; B 259 0 347 720 ;
+C 125 ; WX 333 ; N braceright ; B -1 -105 315 720 ;
+C 126 ; WX 606 ; N asciitilde ; B 51 151 555 346 ;
+C 161 ; WX 333 ; N exclamdown ; B 2 -225 259 479 ;
+C 162 ; WX 500 ; N cent ; B 52 -105 456 547 ;
+C 163 ; WX 500 ; N sterling ; B 21 -5 501 683 ;
+C 164 ; WX 167 ; N fraction ; B -170 0 338 683 ;
+C 165 ; WX 500 ; N yen ; B 11 -3 538 695 ;
+C 166 ; WX 500 ; N florin ; B 8 -242 479 690 ;
+C 167 ; WX 556 ; N section ; B 47 -151 497 695 ;
+C 168 ; WX 500 ; N currency ; B 32 96 468 533 ;
+C 169 ; WX 250 ; N quotesingle ; B 127 467 293 720 ;
+C 170 ; WX 500 ; N quotedblleft ; B 65 431 511 720 ;
+C 171 ; WX 500 ; N guillemotleft ; B 35 43 458 446 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 60 43 292 446 ;
+C 173 ; WX 333 ; N guilsinglright ; B 35 40 267 443 ;
+C 174 ; WX 611 ; N fi ; B -130 -271 588 726 ;
+C 175 ; WX 611 ; N fl ; B -130 -271 631 726 ;
+C 177 ; WX 500 ; N endash ; B -12 214 512 282 ;
+C 178 ; WX 556 ; N dagger ; B 67 -3 499 685 ;
+C 179 ; WX 556 ; N daggerdbl ; B 33 -153 537 693 ;
+C 180 ; WX 250 ; N periodcentered ; B 67 172 206 324 ;
+C 182 ; WX 556 ; N paragraph ; B 14 -204 629 681 ;
+C 183 ; WX 606 ; N bullet ; B 131 172 475 516 ;
+C 184 ; WX 250 ; N quotesinglbase ; B -3 -144 220 145 ;
+C 185 ; WX 500 ; N quotedblbase ; B -18 -144 424 145 ;
+C 186 ; WX 500 ; N quotedblright ; B 73 431 519 720 ;
+C 187 ; WX 500 ; N guillemotright ; B 35 40 458 443 ;
+C 188 ; WX 1000 ; N ellipsis ; B 91 -17 896 135 ;
+C 189 ; WX 1000 ; N perthousand ; B 65 -17 912 691 ;
+C 191 ; WX 444 ; N questiondown ; B -12 -226 347 479 ;
+C 193 ; WX 333 ; N grave ; B 110 518 322 699 ;
+C 194 ; WX 333 ; N acute ; B 153 518 392 699 ;
+C 195 ; WX 333 ; N circumflex ; B 88 510 415 684 ;
+C 196 ; WX 333 ; N tilde ; B 82 535 441 654 ;
+C 197 ; WX 333 ; N macron ; B 76 538 418 608 ;
+C 198 ; WX 333 ; N breve ; B 96 518 412 680 ;
+C 199 ; WX 333 ; N dotaccent ; B 202 537 325 668 ;
+C 200 ; WX 333 ; N dieresis ; B 90 537 426 668 ;
+C 202 ; WX 556 ; N ring ; B 277 514 477 714 ;
+C 203 ; WX 333 ; N cedilla ; B 12 -218 248 5 ;
+C 205 ; WX 333 ; N hungarumlaut ; B -28 518 409 699 ;
+C 206 ; WX 333 ; N ogonek ; B 32 -206 238 -17 ;
+C 207 ; WX 333 ; N caron ; B 113 510 445 684 ;
+C 208 ; WX 1000 ; N emdash ; B -12 214 1012 282 ;
+C 225 ; WX 944 ; N AE ; B -29 -3 927 681 ;
+C 227 ; WX 333 ; N ordfeminine ; B 47 391 355 684 ;
+C 232 ; WX 611 ; N Lslash ; B 6 -3 578 681 ;
+C 233 ; WX 833 ; N Oslash ; B 57 -54 797 730 ;
+C 234 ; WX 944 ; N OE ; B 39 -17 961 695 ;
+C 235 ; WX 333 ; N ordmasculine ; B 51 391 346 683 ;
+C 241 ; WX 738 ; N ae ; B 44 -17 711 469 ;
+C 245 ; WX 333 ; N dotlessi ; B 26 -17 293 469 ;
+C 248 ; WX 333 ; N lslash ; B 13 -17 365 726 ;
+C 249 ; WX 556 ; N oslash ; B 14 -50 522 506 ;
+C 250 ; WX 778 ; N oe ; B 48 -17 755 469 ;
+C 251 ; WX 556 ; N germandbls ; B -131 -271 549 726 ;
+C -1 ; WX 667 ; N Zcaron ; B 1 -3 676 896 ;
+C -1 ; WX 444 ; N ccedilla ; B 32 -218 436 469 ;
+C -1 ; WX 556 ; N ydieresis ; B 13 -271 541 688 ;
+C -1 ; WX 556 ; N atilde ; B 44 -17 553 666 ;
+C -1 ; WX 333 ; N icircumflex ; B 26 -17 403 704 ;
+C -1 ; WX 300 ; N threesuperior ; B 23 263 310 683 ;
+C -1 ; WX 444 ; N ecircumflex ; B 28 -17 471 704 ;
+C -1 ; WX 556 ; N thorn ; B -21 -271 516 726 ;
+C -1 ; WX 444 ; N egrave ; B 28 -17 418 719 ;
+C -1 ; WX 300 ; N twosuperior ; B 26 271 321 683 ;
+C -1 ; WX 444 ; N eacute ; B 28 -17 448 719 ;
+C -1 ; WX 556 ; N otilde ; B 48 -17 553 666 ;
+C -1 ; WX 722 ; N Aacute ; B -35 -3 685 911 ;
+C -1 ; WX 556 ; N ocircumflex ; B 48 -17 515 704 ;
+C -1 ; WX 556 ; N yacute ; B 13 -271 541 719 ;
+C -1 ; WX 556 ; N udieresis ; B 22 -17 538 688 ;
+C -1 ; WX 750 ; N threequarters ; B 18 -2 732 683 ;
+C -1 ; WX 556 ; N acircumflex ; B 44 -17 527 704 ;
+C -1 ; WX 778 ; N Eth ; B 0 -3 747 682 ;
+C -1 ; WX 444 ; N edieresis ; B 28 -17 482 688 ;
+C -1 ; WX 556 ; N ugrave ; B 22 -17 521 719 ;
+C -1 ; WX 1000 ; N trademark ; B 38 274 961 678 ;
+C -1 ; WX 556 ; N ograve ; B 48 -17 502 719 ;
+C -1 ; WX 444 ; N scaron ; B 25 -17 489 692 ;
+C -1 ; WX 389 ; N Idieresis ; B -1 -3 454 880 ;
+C -1 ; WX 556 ; N uacute ; B 22 -17 521 719 ;
+C -1 ; WX 556 ; N agrave ; B 44 -17 519 719 ;
+C -1 ; WX 556 ; N ntilde ; B 17 -17 553 666 ;
+C -1 ; WX 556 ; N aring ; B 44 -17 519 714 ;
+C -1 ; WX 500 ; N zcaron ; B 31 -17 517 692 ;
+C -1 ; WX 389 ; N Icircumflex ; B -1 -3 443 896 ;
+C -1 ; WX 778 ; N Ntilde ; B -2 -3 829 866 ;
+C -1 ; WX 556 ; N ucircumflex ; B 22 -17 521 704 ;
+C -1 ; WX 611 ; N Ecircumflex ; B 11 -3 606 896 ;
+C -1 ; WX 389 ; N Iacute ; B -1 -3 420 911 ;
+C -1 ; WX 685 ; N Ccedilla ; B 69 -218 695 695 ;
+C -1 ; WX 833 ; N Odieresis ; B 76 -17 794 880 ;
+C -1 ; WX 556 ; N Scaron ; B 50 -17 557 896 ;
+C -1 ; WX 611 ; N Edieresis ; B 11 -3 606 880 ;
+C -1 ; WX 389 ; N Igrave ; B -1 -3 412 911 ;
+C -1 ; WX 556 ; N adieresis ; B 44 -17 538 688 ;
+C -1 ; WX 833 ; N Ograve ; B 76 -17 794 911 ;
+C -1 ; WX 611 ; N Egrave ; B 11 -3 606 911 ;
+C -1 ; WX 611 ; N Ydieresis ; B 54 -3 675 880 ;
+C -1 ; WX 747 ; N registered ; B 26 -17 720 695 ;
+C -1 ; WX 833 ; N Otilde ; B 76 -17 794 866 ;
+C -1 ; WX 750 ; N onequarter ; B 18 -2 732 683 ;
+C -1 ; WX 778 ; N Ugrave ; B 83 -17 825 911 ;
+C -1 ; WX 778 ; N Ucircumflex ; B 83 -17 825 896 ;
+C -1 ; WX 667 ; N Thorn ; B 11 -3 644 681 ;
+C -1 ; WX 606 ; N divide ; B 50 -5 556 501 ;
+C -1 ; WX 722 ; N Atilde ; B -35 -3 685 866 ;
+C -1 ; WX 778 ; N Uacute ; B 83 -17 825 911 ;
+C -1 ; WX 833 ; N Ocircumflex ; B 76 -17 794 896 ;
+C -1 ; WX 606 ; N logicalnot ; B 51 107 555 390 ;
+C -1 ; WX 722 ; N Aring ; B -35 -3 685 926 ;
+C -1 ; WX 333 ; N idieresis ; B 26 -17 426 688 ;
+C -1 ; WX 333 ; N iacute ; B 26 -17 392 719 ;
+C -1 ; WX 556 ; N aacute ; B 44 -17 519 719 ;
+C -1 ; WX 606 ; N plusminus ; B 50 0 556 501 ;
+C -1 ; WX 606 ; N multiply ; B 72 17 534 479 ;
+C -1 ; WX 778 ; N Udieresis ; B 83 -17 825 880 ;
+C -1 ; WX 606 ; N minus ; B 51 204 555 292 ;
+C -1 ; WX 300 ; N onesuperior ; B 41 271 298 680 ;
+C -1 ; WX 611 ; N Eacute ; B 11 -3 606 911 ;
+C -1 ; WX 722 ; N Acircumflex ; B -35 -3 685 896 ;
+C -1 ; WX 747 ; N copyright ; B 26 -17 720 695 ;
+C -1 ; WX 722 ; N Agrave ; B -35 -3 685 911 ;
+C -1 ; WX 556 ; N odieresis ; B 48 -17 538 688 ;
+C -1 ; WX 556 ; N oacute ; B 48 -17 504 719 ;
+C -1 ; WX 400 ; N degree ; B 50 383 350 683 ;
+C -1 ; WX 333 ; N igrave ; B 26 -17 322 719 ;
+C -1 ; WX 556 ; N mu ; B -15 -232 521 469 ;
+C -1 ; WX 833 ; N Oacute ; B 76 -17 794 911 ;
+C -1 ; WX 556 ; N eth ; B 48 -17 546 726 ;
+C -1 ; WX 722 ; N Adieresis ; B -35 -3 685 880 ;
+C -1 ; WX 611 ; N Yacute ; B 54 -3 675 911 ;
+C -1 ; WX 606 ; N brokenbar ; B 259 0 347 720 ;
+C -1 ; WX 750 ; N onehalf ; B 14 -2 736 683 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 108
+
+KPX A y -55
+KPX A w -37
+KPX A v -55
+KPX A space -55
+KPX A quoteright -55
+KPX A Y -74
+KPX A W -74
+KPX A V -74
+KPX A T -55
+
+KPX F space -18
+KPX F period -111
+KPX F comma -111
+KPX F A -74
+
+KPX L y -37
+KPX L space -18
+KPX L quoteright -55
+KPX L Y -74
+KPX L W -74
+KPX L V -74
+KPX L T -74
+
+KPX P space -55
+KPX P period -129
+KPX P comma -129
+KPX P A -92
+
+KPX R y -20
+KPX R Y -37
+KPX R W -55
+KPX R V -55
+KPX R T -37
+
+KPX T y -80
+KPX T w -50
+KPX T u -92
+KPX T semicolon -55
+KPX T s -92
+KPX T r -92
+KPX T period -55
+KPX T o -111
+KPX T i -74
+KPX T hyphen -92
+KPX T e -111
+KPX T comma -55
+KPX T colon -55
+KPX T c -92
+KPX T a -111
+KPX T O -18
+KPX T A -55
+
+KPX V y -50
+KPX V u -50
+KPX V semicolon -37
+KPX V r -74
+KPX V period -111
+KPX V o -74
+KPX V i -50
+KPX V hyphen -37
+KPX V e -74
+KPX V comma -111
+KPX V colon -37
+KPX V a -92
+KPX V A -74
+
+KPX W y -30
+KPX W u -30
+KPX W semicolon -18
+KPX W r -30
+KPX W period -55
+KPX W o -55
+KPX W i -30
+KPX W e -55
+KPX W comma -55
+KPX W colon -28
+KPX W a -74
+KPX W A -74
+
+KPX Y v -30
+KPX Y u -50
+KPX Y semicolon -55
+KPX Y q -92
+KPX Y period -55
+KPX Y p -74
+KPX Y o -111
+KPX Y i -54
+KPX Y hyphen -55
+KPX Y e -92
+KPX Y comma -55
+KPX Y colon -55
+KPX Y a -111
+KPX Y A -55
+
+KPX f quoteright 37
+KPX f f -37
+
+KPX one one -55
+
+KPX quoteleft quoteleft -55
+
+KPX quoteright t -18
+KPX quoteright space -37
+KPX quoteright s -37
+KPX quoteright quoteright -55
+
+KPX r quoteright 55
+KPX r q -18
+KPX r period -55
+KPX r o -18
+KPX r h -18
+KPX r g -18
+KPX r e -18
+KPX r comma -55
+KPX r c -18
+
+KPX v period -55
+KPX v comma -55
+
+KPX w period -55
+KPX w comma -55
+
+KPX y period -37
+KPX y comma -37
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 195 212 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 195 212 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 195 212 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 195 212 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 83 212 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 195 212 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 176 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 139 212 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 139 212 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 139 212 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 139 212 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 28 212 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 28 212 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 28 212 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 28 212 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 223 212 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 250 212 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 250 212 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 250 212 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 250 212 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 250 212 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 112 212 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 223 212 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 223 212 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 223 212 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 211 212 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 151 212 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 139 212 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 167 212 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 112 20 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 112 20 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 112 20 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 112 20 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 0 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 112 12 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 56 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 56 20 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 56 20 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 56 20 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 56 20 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute 0 20 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -12 20 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis 0 20 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave 0 20 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 112 12 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 112 20 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 100 20 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 112 20 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 112 20 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 112 12 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 44 8 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 112 20 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 100 20 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 112 20 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 112 20 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 112 20 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 112 20 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 72 8 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pplr8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pplr8a.afm
new file mode 100644
index 0000000..6566b16
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pplr8a.afm
@@ -0,0 +1,445 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Mon Jul 2 22:14:17 1990
+Comment UniqueID 31790
+Comment VMusage 36445 47337
+FontName Palatino-Roman
+FullName Palatino Roman
+FamilyName Palatino
+Weight Roman
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -166 -283 1021 927
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.005
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.Palatino is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 692
+XHeight 469
+Ascender 726
+Descender -281
+StartCharMetrics 228
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 278 ; N exclam ; B 81 -5 197 694 ;
+C 34 ; WX 371 ; N quotedbl ; B 52 469 319 709 ;
+C 35 ; WX 500 ; N numbersign ; B 4 0 495 684 ;
+C 36 ; WX 500 ; N dollar ; B 30 -116 471 731 ;
+C 37 ; WX 840 ; N percent ; B 39 -20 802 709 ;
+C 38 ; WX 778 ; N ampersand ; B 43 -20 753 689 ;
+C 39 ; WX 278 ; N quoteright ; B 45 446 233 709 ;
+C 40 ; WX 333 ; N parenleft ; B 60 -215 301 726 ;
+C 41 ; WX 333 ; N parenright ; B 32 -215 273 726 ;
+C 42 ; WX 389 ; N asterisk ; B 32 342 359 689 ;
+C 43 ; WX 606 ; N plus ; B 51 7 555 512 ;
+C 44 ; WX 250 ; N comma ; B 16 -155 218 123 ;
+C 45 ; WX 333 ; N hyphen ; B 17 215 312 287 ;
+C 46 ; WX 250 ; N period ; B 67 -5 183 111 ;
+C 47 ; WX 606 ; N slash ; B 87 -119 519 726 ;
+C 48 ; WX 500 ; N zero ; B 29 -20 465 689 ;
+C 49 ; WX 500 ; N one ; B 60 -3 418 694 ;
+C 50 ; WX 500 ; N two ; B 16 -3 468 689 ;
+C 51 ; WX 500 ; N three ; B 15 -20 462 689 ;
+C 52 ; WX 500 ; N four ; B 2 -3 472 694 ;
+C 53 ; WX 500 ; N five ; B 13 -20 459 689 ;
+C 54 ; WX 500 ; N six ; B 32 -20 468 689 ;
+C 55 ; WX 500 ; N seven ; B 44 -3 497 689 ;
+C 56 ; WX 500 ; N eight ; B 30 -20 464 689 ;
+C 57 ; WX 500 ; N nine ; B 20 -20 457 689 ;
+C 58 ; WX 250 ; N colon ; B 66 -5 182 456 ;
+C 59 ; WX 250 ; N semicolon ; B 16 -153 218 456 ;
+C 60 ; WX 606 ; N less ; B 57 0 558 522 ;
+C 61 ; WX 606 ; N equal ; B 51 136 555 386 ;
+C 62 ; WX 606 ; N greater ; B 48 0 549 522 ;
+C 63 ; WX 444 ; N question ; B 43 -5 395 694 ;
+C 64 ; WX 747 ; N at ; B 24 -20 724 694 ;
+C 65 ; WX 778 ; N A ; B 15 -3 756 700 ;
+C 66 ; WX 611 ; N B ; B 26 -3 576 692 ;
+C 67 ; WX 709 ; N C ; B 22 -20 670 709 ;
+C 68 ; WX 774 ; N D ; B 22 -3 751 692 ;
+C 69 ; WX 611 ; N E ; B 22 -3 572 692 ;
+C 70 ; WX 556 ; N F ; B 22 -3 536 692 ;
+C 71 ; WX 763 ; N G ; B 22 -20 728 709 ;
+C 72 ; WX 832 ; N H ; B 22 -3 810 692 ;
+C 73 ; WX 337 ; N I ; B 22 -3 315 692 ;
+C 74 ; WX 333 ; N J ; B -15 -194 311 692 ;
+C 75 ; WX 726 ; N K ; B 22 -3 719 692 ;
+C 76 ; WX 611 ; N L ; B 22 -3 586 692 ;
+C 77 ; WX 946 ; N M ; B 16 -13 926 692 ;
+C 78 ; WX 831 ; N N ; B 17 -20 813 692 ;
+C 79 ; WX 786 ; N O ; B 22 -20 764 709 ;
+C 80 ; WX 604 ; N P ; B 22 -3 580 692 ;
+C 81 ; WX 786 ; N Q ; B 22 -176 764 709 ;
+C 82 ; WX 668 ; N R ; B 22 -3 669 692 ;
+C 83 ; WX 525 ; N S ; B 24 -20 503 709 ;
+C 84 ; WX 613 ; N T ; B 18 -3 595 692 ;
+C 85 ; WX 778 ; N U ; B 12 -20 759 692 ;
+C 86 ; WX 722 ; N V ; B 8 -9 706 692 ;
+C 87 ; WX 1000 ; N W ; B 8 -9 984 700 ;
+C 88 ; WX 667 ; N X ; B 14 -3 648 700 ;
+C 89 ; WX 667 ; N Y ; B 9 -3 654 704 ;
+C 90 ; WX 667 ; N Z ; B 15 -3 638 692 ;
+C 91 ; WX 333 ; N bracketleft ; B 79 -184 288 726 ;
+C 92 ; WX 606 ; N backslash ; B 81 0 512 726 ;
+C 93 ; WX 333 ; N bracketright ; B 45 -184 254 726 ;
+C 94 ; WX 606 ; N asciicircum ; B 51 283 554 689 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 278 ; N quoteleft ; B 45 446 233 709 ;
+C 97 ; WX 500 ; N a ; B 32 -12 471 469 ;
+C 98 ; WX 553 ; N b ; B -15 -12 508 726 ;
+C 99 ; WX 444 ; N c ; B 26 -20 413 469 ;
+C 100 ; WX 611 ; N d ; B 35 -12 579 726 ;
+C 101 ; WX 479 ; N e ; B 26 -20 448 469 ;
+C 102 ; WX 333 ; N f ; B 23 -3 341 728 ; L i fi ; L l fl ;
+C 103 ; WX 556 ; N g ; B 32 -283 544 469 ;
+C 104 ; WX 582 ; N h ; B 6 -3 572 726 ;
+C 105 ; WX 291 ; N i ; B 21 -3 271 687 ;
+C 106 ; WX 234 ; N j ; B -40 -283 167 688 ;
+C 107 ; WX 556 ; N k ; B 21 -12 549 726 ;
+C 108 ; WX 291 ; N l ; B 21 -3 271 726 ;
+C 109 ; WX 883 ; N m ; B 16 -3 869 469 ;
+C 110 ; WX 582 ; N n ; B 6 -3 572 469 ;
+C 111 ; WX 546 ; N o ; B 32 -20 514 469 ;
+C 112 ; WX 601 ; N p ; B 8 -281 554 469 ;
+C 113 ; WX 560 ; N q ; B 35 -281 560 469 ;
+C 114 ; WX 395 ; N r ; B 21 -3 374 469 ;
+C 115 ; WX 424 ; N s ; B 30 -20 391 469 ;
+C 116 ; WX 326 ; N t ; B 22 -12 319 621 ;
+C 117 ; WX 603 ; N u ; B 18 -12 581 469 ;
+C 118 ; WX 565 ; N v ; B 6 -7 539 459 ;
+C 119 ; WX 834 ; N w ; B 6 -7 808 469 ;
+C 120 ; WX 516 ; N x ; B 20 -3 496 469 ;
+C 121 ; WX 556 ; N y ; B 12 -283 544 459 ;
+C 122 ; WX 500 ; N z ; B 16 -3 466 462 ;
+C 123 ; WX 333 ; N braceleft ; B 58 -175 289 726 ;
+C 124 ; WX 606 ; N bar ; B 275 0 331 726 ;
+C 125 ; WX 333 ; N braceright ; B 44 -175 275 726 ;
+C 126 ; WX 606 ; N asciitilde ; B 51 176 555 347 ;
+C 161 ; WX 278 ; N exclamdown ; B 81 -225 197 469 ;
+C 162 ; WX 500 ; N cent ; B 61 -101 448 562 ;
+C 163 ; WX 500 ; N sterling ; B 12 -13 478 694 ;
+C 164 ; WX 167 ; N fraction ; B -166 0 337 689 ;
+C 165 ; WX 500 ; N yen ; B 5 -3 496 701 ;
+C 166 ; WX 500 ; N florin ; B 0 -262 473 706 ;
+C 167 ; WX 500 ; N section ; B 26 -219 465 709 ;
+C 168 ; WX 500 ; N currency ; B 30 96 470 531 ;
+C 169 ; WX 208 ; N quotesingle ; B 61 469 147 709 ;
+C 170 ; WX 500 ; N quotedblleft ; B 51 446 449 709 ;
+C 171 ; WX 500 ; N guillemotleft ; B 50 71 450 428 ;
+C 172 ; WX 331 ; N guilsinglleft ; B 66 71 265 428 ;
+C 173 ; WX 331 ; N guilsinglright ; B 66 71 265 428 ;
+C 174 ; WX 605 ; N fi ; B 23 -3 587 728 ;
+C 175 ; WX 608 ; N fl ; B 23 -3 590 728 ;
+C 177 ; WX 500 ; N endash ; B 0 219 500 277 ;
+C 178 ; WX 500 ; N dagger ; B 34 -5 466 694 ;
+C 179 ; WX 500 ; N daggerdbl ; B 34 -249 466 694 ;
+C 180 ; WX 250 ; N periodcentered ; B 67 203 183 319 ;
+C 182 ; WX 628 ; N paragraph ; B 39 -150 589 694 ;
+C 183 ; WX 606 ; N bullet ; B 131 172 475 516 ;
+C 184 ; WX 278 ; N quotesinglbase ; B 22 -153 210 110 ;
+C 185 ; WX 500 ; N quotedblbase ; B 51 -153 449 110 ;
+C 186 ; WX 500 ; N quotedblright ; B 51 446 449 709 ;
+C 187 ; WX 500 ; N guillemotright ; B 50 71 450 428 ;
+C 188 ; WX 1000 ; N ellipsis ; B 109 -5 891 111 ;
+C 189 ; WX 1144 ; N perthousand ; B 123 -20 1021 709 ;
+C 191 ; WX 444 ; N questiondown ; B 43 -231 395 469 ;
+C 193 ; WX 333 ; N grave ; B 31 506 255 677 ;
+C 194 ; WX 333 ; N acute ; B 78 506 302 677 ;
+C 195 ; WX 333 ; N circumflex ; B 11 510 323 677 ;
+C 196 ; WX 333 ; N tilde ; B 2 535 332 640 ;
+C 197 ; WX 333 ; N macron ; B 11 538 323 591 ;
+C 198 ; WX 333 ; N breve ; B 26 506 308 664 ;
+C 199 ; WX 250 ; N dotaccent ; B 75 537 175 637 ;
+C 200 ; WX 333 ; N dieresis ; B 17 537 316 637 ;
+C 202 ; WX 333 ; N ring ; B 67 496 267 696 ;
+C 203 ; WX 333 ; N cedilla ; B 96 -225 304 -10 ;
+C 205 ; WX 380 ; N hungarumlaut ; B 3 506 377 687 ;
+C 206 ; WX 313 ; N ogonek ; B 68 -165 245 -20 ;
+C 207 ; WX 333 ; N caron ; B 11 510 323 677 ;
+C 208 ; WX 1000 ; N emdash ; B 0 219 1000 277 ;
+C 225 ; WX 944 ; N AE ; B -10 -3 908 692 ;
+C 227 ; WX 333 ; N ordfeminine ; B 24 422 310 709 ;
+C 232 ; WX 611 ; N Lslash ; B 6 -3 586 692 ;
+C 233 ; WX 833 ; N Oslash ; B 30 -20 797 709 ;
+C 234 ; WX 998 ; N OE ; B 22 -20 962 709 ;
+C 235 ; WX 333 ; N ordmasculine ; B 10 416 323 709 ;
+C 241 ; WX 758 ; N ae ; B 30 -20 732 469 ;
+C 245 ; WX 287 ; N dotlessi ; B 21 -3 271 469 ;
+C 248 ; WX 291 ; N lslash ; B -14 -3 306 726 ;
+C 249 ; WX 556 ; N oslash ; B 16 -23 530 474 ;
+C 250 ; WX 827 ; N oe ; B 32 -20 800 469 ;
+C 251 ; WX 556 ; N germandbls ; B 23 -9 519 731 ;
+C -1 ; WX 667 ; N Zcaron ; B 15 -3 638 908 ;
+C -1 ; WX 444 ; N ccedilla ; B 26 -225 413 469 ;
+C -1 ; WX 556 ; N ydieresis ; B 12 -283 544 657 ;
+C -1 ; WX 500 ; N atilde ; B 32 -12 471 652 ;
+C -1 ; WX 287 ; N icircumflex ; B -12 -3 300 697 ;
+C -1 ; WX 300 ; N threesuperior ; B 1 266 299 689 ;
+C -1 ; WX 479 ; N ecircumflex ; B 26 -20 448 697 ;
+C -1 ; WX 601 ; N thorn ; B -2 -281 544 726 ;
+C -1 ; WX 479 ; N egrave ; B 26 -20 448 697 ;
+C -1 ; WX 300 ; N twosuperior ; B 0 273 301 689 ;
+C -1 ; WX 479 ; N eacute ; B 26 -20 448 697 ;
+C -1 ; WX 546 ; N otilde ; B 32 -20 514 652 ;
+C -1 ; WX 778 ; N Aacute ; B 15 -3 756 908 ;
+C -1 ; WX 546 ; N ocircumflex ; B 32 -20 514 697 ;
+C -1 ; WX 556 ; N yacute ; B 12 -283 544 697 ;
+C -1 ; WX 603 ; N udieresis ; B 18 -12 581 657 ;
+C -1 ; WX 750 ; N threequarters ; B 15 -3 735 689 ;
+C -1 ; WX 500 ; N acircumflex ; B 32 -12 471 697 ;
+C -1 ; WX 774 ; N Eth ; B 14 -3 751 692 ;
+C -1 ; WX 479 ; N edieresis ; B 26 -20 448 657 ;
+C -1 ; WX 603 ; N ugrave ; B 18 -12 581 697 ;
+C -1 ; WX 979 ; N trademark ; B 40 285 939 689 ;
+C -1 ; WX 546 ; N ograve ; B 32 -20 514 697 ;
+C -1 ; WX 424 ; N scaron ; B 30 -20 391 685 ;
+C -1 ; WX 337 ; N Idieresis ; B 19 -3 318 868 ;
+C -1 ; WX 603 ; N uacute ; B 18 -12 581 697 ;
+C -1 ; WX 500 ; N agrave ; B 32 -12 471 697 ;
+C -1 ; WX 582 ; N ntilde ; B 6 -3 572 652 ;
+C -1 ; WX 500 ; N aring ; B 32 -12 471 716 ;
+C -1 ; WX 500 ; N zcaron ; B 16 -3 466 685 ;
+C -1 ; WX 337 ; N Icircumflex ; B 13 -3 325 908 ;
+C -1 ; WX 831 ; N Ntilde ; B 17 -20 813 871 ;
+C -1 ; WX 603 ; N ucircumflex ; B 18 -12 581 697 ;
+C -1 ; WX 611 ; N Ecircumflex ; B 22 -3 572 908 ;
+C -1 ; WX 337 ; N Iacute ; B 22 -3 315 908 ;
+C -1 ; WX 709 ; N Ccedilla ; B 22 -225 670 709 ;
+C -1 ; WX 786 ; N Odieresis ; B 22 -20 764 868 ;
+C -1 ; WX 525 ; N Scaron ; B 24 -20 503 908 ;
+C -1 ; WX 611 ; N Edieresis ; B 22 -3 572 868 ;
+C -1 ; WX 337 ; N Igrave ; B 22 -3 315 908 ;
+C -1 ; WX 500 ; N adieresis ; B 32 -12 471 657 ;
+C -1 ; WX 786 ; N Ograve ; B 22 -20 764 908 ;
+C -1 ; WX 611 ; N Egrave ; B 22 -3 572 908 ;
+C -1 ; WX 667 ; N Ydieresis ; B 9 -3 654 868 ;
+C -1 ; WX 747 ; N registered ; B 11 -18 736 706 ;
+C -1 ; WX 786 ; N Otilde ; B 22 -20 764 883 ;
+C -1 ; WX 750 ; N onequarter ; B 30 -3 727 692 ;
+C -1 ; WX 778 ; N Ugrave ; B 12 -20 759 908 ;
+C -1 ; WX 778 ; N Ucircumflex ; B 12 -20 759 908 ;
+C -1 ; WX 604 ; N Thorn ; B 32 -3 574 692 ;
+C -1 ; WX 606 ; N divide ; B 51 10 555 512 ;
+C -1 ; WX 778 ; N Atilde ; B 15 -3 756 871 ;
+C -1 ; WX 778 ; N Uacute ; B 12 -20 759 908 ;
+C -1 ; WX 786 ; N Ocircumflex ; B 22 -20 764 908 ;
+C -1 ; WX 606 ; N logicalnot ; B 51 120 551 386 ;
+C -1 ; WX 778 ; N Aring ; B 15 -3 756 927 ;
+C -1 ; WX 287 ; N idieresis ; B -6 -3 293 657 ;
+C -1 ; WX 287 ; N iacute ; B 21 -3 279 697 ;
+C -1 ; WX 500 ; N aacute ; B 32 -12 471 697 ;
+C -1 ; WX 606 ; N plusminus ; B 51 0 555 512 ;
+C -1 ; WX 606 ; N multiply ; B 83 36 523 474 ;
+C -1 ; WX 778 ; N Udieresis ; B 12 -20 759 868 ;
+C -1 ; WX 606 ; N minus ; B 51 233 555 289 ;
+C -1 ; WX 300 ; N onesuperior ; B 31 273 269 692 ;
+C -1 ; WX 611 ; N Eacute ; B 22 -3 572 908 ;
+C -1 ; WX 778 ; N Acircumflex ; B 15 -3 756 908 ;
+C -1 ; WX 747 ; N copyright ; B 11 -18 736 706 ;
+C -1 ; WX 778 ; N Agrave ; B 15 -3 756 908 ;
+C -1 ; WX 546 ; N odieresis ; B 32 -20 514 657 ;
+C -1 ; WX 546 ; N oacute ; B 32 -20 514 697 ;
+C -1 ; WX 400 ; N degree ; B 50 389 350 689 ;
+C -1 ; WX 287 ; N igrave ; B 8 -3 271 697 ;
+C -1 ; WX 603 ; N mu ; B 18 -236 581 469 ;
+C -1 ; WX 786 ; N Oacute ; B 22 -20 764 908 ;
+C -1 ; WX 546 ; N eth ; B 32 -20 504 728 ;
+C -1 ; WX 778 ; N Adieresis ; B 15 -3 756 868 ;
+C -1 ; WX 667 ; N Yacute ; B 9 -3 654 908 ;
+C -1 ; WX 606 ; N brokenbar ; B 275 0 331 726 ;
+C -1 ; WX 750 ; N onehalf ; B 15 -3 735 692 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 111
+
+KPX A y -74
+KPX A w -74
+KPX A v -92
+KPX A space -55
+KPX A quoteright -74
+KPX A Y -111
+KPX A W -74
+KPX A V -111
+KPX A T -74
+
+KPX F period -92
+KPX F comma -92
+KPX F A -74
+
+KPX L y -55
+KPX L space -37
+KPX L quoteright -74
+KPX L Y -92
+KPX L W -74
+KPX L V -92
+KPX L T -74
+
+KPX P space -18
+KPX P period -129
+KPX P comma -129
+KPX P A -92
+
+KPX R y -37
+KPX R Y -37
+KPX R W -37
+KPX R V -55
+KPX R T -37
+
+KPX T y -90
+KPX T w -90
+KPX T u -90
+KPX T semicolon -55
+KPX T s -90
+KPX T r -90
+KPX T period -74
+KPX T o -92
+KPX T i -55
+KPX T hyphen -55
+KPX T e -92
+KPX T comma -74
+KPX T colon -55
+KPX T c -111
+KPX T a -92
+KPX T O -18
+KPX T A -74
+
+KPX V y -92
+KPX V u -92
+KPX V semicolon -55
+KPX V r -92
+KPX V period -129
+KPX V o -111
+KPX V i -55
+KPX V hyphen -74
+KPX V e -111
+KPX V comma -129
+KPX V colon -55
+KPX V a -92
+KPX V A -111
+
+KPX W y -50
+KPX W u -50
+KPX W semicolon -18
+KPX W r -74
+KPX W period -92
+KPX W o -92
+KPX W i -55
+KPX W hyphen -55
+KPX W e -92
+KPX W comma -92
+KPX W colon -18
+KPX W a -92
+KPX W A -92
+
+KPX Y v -90
+KPX Y u -90
+KPX Y space -18
+KPX Y semicolon -74
+KPX Y q -90
+KPX Y period -111
+KPX Y p -111
+KPX Y o -92
+KPX Y i -55
+KPX Y hyphen -92
+KPX Y e -92
+KPX Y comma -111
+KPX Y colon -74
+KPX Y a -92
+KPX Y A -92
+
+KPX f quoteright 55
+KPX f f -18
+
+KPX one one -55
+
+KPX quoteleft quoteleft -37
+
+KPX quoteright quoteright -37
+
+KPX r u -8
+KPX r quoteright 74
+KPX r q -18
+KPX r period -74
+KPX r o -18
+KPX r hyphen -18
+KPX r h -18
+KPX r g -18
+KPX r e -18
+KPX r d -18
+KPX r comma -74
+KPX r c -18
+
+KPX space Y -18
+KPX space A -37
+
+KPX v period -111
+KPX v comma -111
+
+KPX w period -92
+KPX w comma -92
+
+KPX y period -111
+KPX y comma -111
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 229 231 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 223 231 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 223 231 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 215 231 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 223 231 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 223 231 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 188 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 139 231 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 139 231 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 139 231 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 139 231 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 2 231 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 2 231 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 2 231 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 2 231 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 249 231 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 227 231 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 227 231 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 227 231 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 227 231 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 227 243 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 96 231 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 255 231 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 247 231 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 223 231 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 223 231 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 203 231 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 191 231 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 179 231 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 84 20 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 72 20 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 72 20 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 60 20 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 72 20 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 72 12 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 56 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 97 20 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 85 20 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 73 20 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 73 20 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -23 20 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -23 20 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -23 20 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -23 20 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 113 12 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 107 20 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 107 20 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 107 20 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 95 20 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 107 12 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 46 8 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 159 20 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 135 20 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 135 20 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 111 20 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 144 20 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 112 20 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 84 8 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pplri8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pplri8a.afm
new file mode 100644
index 0000000..01bdcf0
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pplri8a.afm
@@ -0,0 +1,439 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Mon Jul 2 22:37:33 1990
+Comment UniqueID 31796
+Comment VMusage 37415 48307
+FontName Palatino-Italic
+FullName Palatino Italic
+FamilyName Palatino
+Weight Medium
+ItalicAngle -10
+IsFixedPitch false
+FontBBox -170 -276 1010 918
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.005
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.Palatino is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 692
+XHeight 482
+Ascender 733
+Descender -276
+StartCharMetrics 228
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 76 -8 292 733 ;
+C 34 ; WX 500 ; N quotedbl ; B 140 508 455 733 ;
+C 35 ; WX 500 ; N numbersign ; B 4 0 495 692 ;
+C 36 ; WX 500 ; N dollar ; B 15 -113 452 733 ;
+C 37 ; WX 889 ; N percent ; B 74 -7 809 710 ;
+C 38 ; WX 778 ; N ampersand ; B 47 -18 766 692 ;
+C 39 ; WX 278 ; N quoteright ; B 78 488 258 733 ;
+C 40 ; WX 333 ; N parenleft ; B 54 -106 331 733 ;
+C 41 ; WX 333 ; N parenright ; B 2 -106 279 733 ;
+C 42 ; WX 389 ; N asterisk ; B 76 368 400 706 ;
+C 43 ; WX 606 ; N plus ; B 51 0 555 504 ;
+C 44 ; WX 250 ; N comma ; B 8 -143 203 123 ;
+C 45 ; WX 333 ; N hyphen ; B 19 223 304 281 ;
+C 46 ; WX 250 ; N period ; B 53 -5 158 112 ;
+C 47 ; WX 296 ; N slash ; B -40 -119 392 733 ;
+C 48 ; WX 500 ; N zero ; B 36 -11 480 699 ;
+C 49 ; WX 500 ; N one ; B 54 -3 398 699 ;
+C 50 ; WX 500 ; N two ; B 12 -3 437 699 ;
+C 51 ; WX 500 ; N three ; B 22 -11 447 699 ;
+C 52 ; WX 500 ; N four ; B 15 -3 478 699 ;
+C 53 ; WX 500 ; N five ; B 14 -11 491 693 ;
+C 54 ; WX 500 ; N six ; B 49 -11 469 699 ;
+C 55 ; WX 500 ; N seven ; B 53 -3 502 692 ;
+C 56 ; WX 500 ; N eight ; B 36 -11 469 699 ;
+C 57 ; WX 500 ; N nine ; B 32 -11 468 699 ;
+C 58 ; WX 250 ; N colon ; B 44 -5 207 458 ;
+C 59 ; WX 250 ; N semicolon ; B -9 -146 219 456 ;
+C 60 ; WX 606 ; N less ; B 53 -6 554 516 ;
+C 61 ; WX 606 ; N equal ; B 51 126 555 378 ;
+C 62 ; WX 606 ; N greater ; B 53 -6 554 516 ;
+C 63 ; WX 500 ; N question ; B 114 -8 427 706 ;
+C 64 ; WX 747 ; N at ; B 27 -18 718 706 ;
+C 65 ; WX 722 ; N A ; B -19 -3 677 705 ;
+C 66 ; WX 611 ; N B ; B 26 -6 559 692 ;
+C 67 ; WX 667 ; N C ; B 45 -18 651 706 ;
+C 68 ; WX 778 ; N D ; B 28 -3 741 692 ;
+C 69 ; WX 611 ; N E ; B 30 -3 570 692 ;
+C 70 ; WX 556 ; N F ; B 0 -3 548 692 ;
+C 71 ; WX 722 ; N G ; B 50 -18 694 706 ;
+C 72 ; WX 778 ; N H ; B -3 -3 800 692 ;
+C 73 ; WX 333 ; N I ; B 7 -3 354 692 ;
+C 74 ; WX 333 ; N J ; B -35 -206 358 692 ;
+C 75 ; WX 667 ; N K ; B 13 -3 683 692 ;
+C 76 ; WX 556 ; N L ; B 16 -3 523 692 ;
+C 77 ; WX 944 ; N M ; B -19 -18 940 692 ;
+C 78 ; WX 778 ; N N ; B 2 -11 804 692 ;
+C 79 ; WX 778 ; N O ; B 53 -18 748 706 ;
+C 80 ; WX 611 ; N P ; B 9 -3 594 692 ;
+C 81 ; WX 778 ; N Q ; B 53 -201 748 706 ;
+C 82 ; WX 667 ; N R ; B 9 -3 639 692 ;
+C 83 ; WX 556 ; N S ; B 42 -18 506 706 ;
+C 84 ; WX 611 ; N T ; B 53 -3 635 692 ;
+C 85 ; WX 778 ; N U ; B 88 -18 798 692 ;
+C 86 ; WX 722 ; N V ; B 75 -8 754 692 ;
+C 87 ; WX 944 ; N W ; B 71 -8 980 700 ;
+C 88 ; WX 722 ; N X ; B 20 -3 734 692 ;
+C 89 ; WX 667 ; N Y ; B 52 -3 675 705 ;
+C 90 ; WX 667 ; N Z ; B 20 -3 637 692 ;
+C 91 ; WX 333 ; N bracketleft ; B 18 -100 326 733 ;
+C 92 ; WX 606 ; N backslash ; B 81 0 513 733 ;
+C 93 ; WX 333 ; N bracketright ; B 7 -100 315 733 ;
+C 94 ; WX 606 ; N asciicircum ; B 51 283 554 689 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 278 ; N quoteleft ; B 78 488 258 733 ;
+C 97 ; WX 444 ; N a ; B 4 -11 406 482 ;
+C 98 ; WX 463 ; N b ; B 37 -11 433 733 ;
+C 99 ; WX 407 ; N c ; B 25 -11 389 482 ;
+C 100 ; WX 500 ; N d ; B 17 -11 483 733 ;
+C 101 ; WX 389 ; N e ; B 15 -11 374 482 ;
+C 102 ; WX 278 ; N f ; B -162 -276 413 733 ; L i fi ; L l fl ;
+C 103 ; WX 500 ; N g ; B -37 -276 498 482 ;
+C 104 ; WX 500 ; N h ; B 10 -9 471 733 ;
+C 105 ; WX 278 ; N i ; B 34 -9 264 712 ;
+C 106 ; WX 278 ; N j ; B -70 -276 265 712 ;
+C 107 ; WX 444 ; N k ; B 8 -9 449 733 ;
+C 108 ; WX 278 ; N l ; B 36 -9 251 733 ;
+C 109 ; WX 778 ; N m ; B 24 -9 740 482 ;
+C 110 ; WX 556 ; N n ; B 24 -9 514 482 ;
+C 111 ; WX 444 ; N o ; B 17 -11 411 482 ;
+C 112 ; WX 500 ; N p ; B -7 -276 465 482 ;
+C 113 ; WX 463 ; N q ; B 24 -276 432 482 ;
+C 114 ; WX 389 ; N r ; B 26 -9 384 482 ;
+C 115 ; WX 389 ; N s ; B 9 -11 345 482 ;
+C 116 ; WX 333 ; N t ; B 41 -9 310 646 ;
+C 117 ; WX 556 ; N u ; B 32 -11 512 482 ;
+C 118 ; WX 500 ; N v ; B 21 -11 477 482 ;
+C 119 ; WX 722 ; N w ; B 21 -11 699 482 ;
+C 120 ; WX 500 ; N x ; B 9 -11 484 482 ;
+C 121 ; WX 500 ; N y ; B -8 -276 490 482 ;
+C 122 ; WX 444 ; N z ; B -1 -11 416 482 ;
+C 123 ; WX 333 ; N braceleft ; B 15 -100 319 733 ;
+C 124 ; WX 606 ; N bar ; B 275 0 331 733 ;
+C 125 ; WX 333 ; N braceright ; B 14 -100 318 733 ;
+C 126 ; WX 606 ; N asciitilde ; B 51 168 555 339 ;
+C 161 ; WX 333 ; N exclamdown ; B 15 -276 233 467 ;
+C 162 ; WX 500 ; N cent ; B 56 -96 418 551 ;
+C 163 ; WX 500 ; N sterling ; B 2 -18 479 708 ;
+C 164 ; WX 167 ; N fraction ; B -170 0 337 699 ;
+C 165 ; WX 500 ; N yen ; B 35 -3 512 699 ;
+C 166 ; WX 500 ; N florin ; B 5 -276 470 708 ;
+C 167 ; WX 500 ; N section ; B 14 -220 463 706 ;
+C 168 ; WX 500 ; N currency ; B 14 115 486 577 ;
+C 169 ; WX 333 ; N quotesingle ; B 140 508 288 733 ;
+C 170 ; WX 500 ; N quotedblleft ; B 98 488 475 733 ;
+C 171 ; WX 500 ; N guillemotleft ; B 57 70 437 440 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 57 70 270 440 ;
+C 173 ; WX 333 ; N guilsinglright ; B 63 70 276 440 ;
+C 174 ; WX 528 ; N fi ; B -162 -276 502 733 ;
+C 175 ; WX 545 ; N fl ; B -162 -276 520 733 ;
+C 177 ; WX 500 ; N endash ; B -10 228 510 278 ;
+C 178 ; WX 500 ; N dagger ; B 48 0 469 692 ;
+C 179 ; WX 500 ; N daggerdbl ; B 10 -162 494 692 ;
+C 180 ; WX 250 ; N periodcentered ; B 53 195 158 312 ;
+C 182 ; WX 500 ; N paragraph ; B 33 -224 611 692 ;
+C 183 ; WX 500 ; N bullet ; B 86 182 430 526 ;
+C 184 ; WX 278 ; N quotesinglbase ; B 27 -122 211 120 ;
+C 185 ; WX 500 ; N quotedblbase ; B 43 -122 424 120 ;
+C 186 ; WX 500 ; N quotedblright ; B 98 488 475 733 ;
+C 187 ; WX 500 ; N guillemotright ; B 63 70 443 440 ;
+C 188 ; WX 1000 ; N ellipsis ; B 102 -5 873 112 ;
+C 189 ; WX 1000 ; N perthousand ; B 72 -6 929 717 ;
+C 191 ; WX 500 ; N questiondown ; B 57 -246 370 467 ;
+C 193 ; WX 333 ; N grave ; B 86 518 310 687 ;
+C 194 ; WX 333 ; N acute ; B 122 518 346 687 ;
+C 195 ; WX 333 ; N circumflex ; B 56 510 350 679 ;
+C 196 ; WX 333 ; N tilde ; B 63 535 390 638 ;
+C 197 ; WX 333 ; N macron ; B 74 538 386 589 ;
+C 198 ; WX 333 ; N breve ; B 92 518 393 677 ;
+C 199 ; WX 333 ; N dotaccent ; B 175 537 283 645 ;
+C 200 ; WX 333 ; N dieresis ; B 78 537 378 637 ;
+C 202 ; WX 333 ; N ring ; B 159 508 359 708 ;
+C 203 ; WX 333 ; N cedilla ; B -9 -216 202 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 46 518 385 730 ;
+C 206 ; WX 333 ; N ogonek ; B 38 -207 196 -18 ;
+C 207 ; WX 333 ; N caron ; B 104 510 409 679 ;
+C 208 ; WX 1000 ; N emdash ; B -10 228 1010 278 ;
+C 225 ; WX 941 ; N AE ; B -4 -3 902 692 ;
+C 227 ; WX 333 ; N ordfeminine ; B 60 404 321 699 ;
+C 232 ; WX 556 ; N Lslash ; B -16 -3 523 692 ;
+C 233 ; WX 778 ; N Oslash ; B 32 -39 762 721 ;
+C 234 ; WX 1028 ; N OE ; B 56 -18 989 706 ;
+C 235 ; WX 333 ; N ordmasculine ; B 66 404 322 699 ;
+C 241 ; WX 638 ; N ae ; B 1 -11 623 482 ;
+C 245 ; WX 278 ; N dotlessi ; B 34 -9 241 482 ;
+C 248 ; WX 278 ; N lslash ; B -10 -9 302 733 ;
+C 249 ; WX 444 ; N oslash ; B -18 -24 460 510 ;
+C 250 ; WX 669 ; N oe ; B 17 -11 654 482 ;
+C 251 ; WX 500 ; N germandbls ; B -160 -276 488 733 ;
+C -1 ; WX 667 ; N Zcaron ; B 20 -3 637 907 ;
+C -1 ; WX 407 ; N ccedilla ; B 25 -216 389 482 ;
+C -1 ; WX 500 ; N ydieresis ; B -8 -276 490 657 ;
+C -1 ; WX 444 ; N atilde ; B 4 -11 446 650 ;
+C -1 ; WX 278 ; N icircumflex ; B 29 -9 323 699 ;
+C -1 ; WX 300 ; N threesuperior ; B 28 273 304 699 ;
+C -1 ; WX 389 ; N ecircumflex ; B 15 -11 398 699 ;
+C -1 ; WX 500 ; N thorn ; B -39 -276 433 733 ;
+C -1 ; WX 389 ; N egrave ; B 15 -11 374 707 ;
+C -1 ; WX 300 ; N twosuperior ; B 13 278 290 699 ;
+C -1 ; WX 389 ; N eacute ; B 15 -11 394 707 ;
+C -1 ; WX 444 ; N otilde ; B 17 -11 446 650 ;
+C -1 ; WX 722 ; N Aacute ; B -19 -3 677 897 ;
+C -1 ; WX 444 ; N ocircumflex ; B 17 -11 411 699 ;
+C -1 ; WX 500 ; N yacute ; B -8 -276 490 707 ;
+C -1 ; WX 556 ; N udieresis ; B 32 -11 512 657 ;
+C -1 ; WX 750 ; N threequarters ; B 35 -2 715 699 ;
+C -1 ; WX 444 ; N acircumflex ; B 4 -11 406 699 ;
+C -1 ; WX 778 ; N Eth ; B 19 -3 741 692 ;
+C -1 ; WX 389 ; N edieresis ; B 15 -11 406 657 ;
+C -1 ; WX 556 ; N ugrave ; B 32 -11 512 707 ;
+C -1 ; WX 1000 ; N trademark ; B 52 285 951 689 ;
+C -1 ; WX 444 ; N ograve ; B 17 -11 411 707 ;
+C -1 ; WX 389 ; N scaron ; B 9 -11 419 687 ;
+C -1 ; WX 333 ; N Idieresis ; B 7 -3 418 847 ;
+C -1 ; WX 556 ; N uacute ; B 32 -11 512 707 ;
+C -1 ; WX 444 ; N agrave ; B 4 -11 406 707 ;
+C -1 ; WX 556 ; N ntilde ; B 24 -9 514 650 ;
+C -1 ; WX 444 ; N aring ; B 4 -11 406 728 ;
+C -1 ; WX 444 ; N zcaron ; B -1 -11 447 687 ;
+C -1 ; WX 333 ; N Icircumflex ; B 7 -3 390 889 ;
+C -1 ; WX 778 ; N Ntilde ; B 2 -11 804 866 ;
+C -1 ; WX 556 ; N ucircumflex ; B 32 -11 512 699 ;
+C -1 ; WX 611 ; N Ecircumflex ; B 30 -3 570 889 ;
+C -1 ; WX 333 ; N Iacute ; B 7 -3 406 897 ;
+C -1 ; WX 667 ; N Ccedilla ; B 45 -216 651 706 ;
+C -1 ; WX 778 ; N Odieresis ; B 53 -18 748 847 ;
+C -1 ; WX 556 ; N Scaron ; B 42 -18 539 907 ;
+C -1 ; WX 611 ; N Edieresis ; B 30 -3 570 847 ;
+C -1 ; WX 333 ; N Igrave ; B 7 -3 354 897 ;
+C -1 ; WX 444 ; N adieresis ; B 4 -11 434 657 ;
+C -1 ; WX 778 ; N Ograve ; B 53 -18 748 897 ;
+C -1 ; WX 611 ; N Egrave ; B 30 -3 570 897 ;
+C -1 ; WX 667 ; N Ydieresis ; B 52 -3 675 847 ;
+C -1 ; WX 747 ; N registered ; B 11 -18 736 706 ;
+C -1 ; WX 778 ; N Otilde ; B 53 -18 748 866 ;
+C -1 ; WX 750 ; N onequarter ; B 31 -2 715 699 ;
+C -1 ; WX 778 ; N Ugrave ; B 88 -18 798 897 ;
+C -1 ; WX 778 ; N Ucircumflex ; B 88 -18 798 889 ;
+C -1 ; WX 611 ; N Thorn ; B 9 -3 570 692 ;
+C -1 ; WX 606 ; N divide ; B 51 0 555 504 ;
+C -1 ; WX 722 ; N Atilde ; B -19 -3 677 866 ;
+C -1 ; WX 778 ; N Uacute ; B 88 -18 798 897 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 53 -18 748 889 ;
+C -1 ; WX 606 ; N logicalnot ; B 51 118 555 378 ;
+C -1 ; WX 722 ; N Aring ; B -19 -3 677 918 ;
+C -1 ; WX 278 ; N idieresis ; B 34 -9 351 657 ;
+C -1 ; WX 278 ; N iacute ; B 34 -9 331 707 ;
+C -1 ; WX 444 ; N aacute ; B 4 -11 414 707 ;
+C -1 ; WX 606 ; N plusminus ; B 51 0 555 504 ;
+C -1 ; WX 606 ; N multiply ; B 83 36 523 474 ;
+C -1 ; WX 778 ; N Udieresis ; B 88 -18 798 847 ;
+C -1 ; WX 606 ; N minus ; B 51 224 555 280 ;
+C -1 ; WX 300 ; N onesuperior ; B 61 278 285 699 ;
+C -1 ; WX 611 ; N Eacute ; B 30 -3 570 897 ;
+C -1 ; WX 722 ; N Acircumflex ; B -19 -3 677 889 ;
+C -1 ; WX 747 ; N copyright ; B 11 -18 736 706 ;
+C -1 ; WX 722 ; N Agrave ; B -19 -3 677 897 ;
+C -1 ; WX 444 ; N odieresis ; B 17 -11 434 657 ;
+C -1 ; WX 444 ; N oacute ; B 17 -11 414 707 ;
+C -1 ; WX 400 ; N degree ; B 90 389 390 689 ;
+C -1 ; WX 278 ; N igrave ; B 34 -9 271 707 ;
+C -1 ; WX 556 ; N mu ; B 15 -226 512 482 ;
+C -1 ; WX 778 ; N Oacute ; B 53 -18 748 897 ;
+C -1 ; WX 444 ; N eth ; B 17 -11 478 733 ;
+C -1 ; WX 722 ; N Adieresis ; B -19 -3 677 847 ;
+C -1 ; WX 667 ; N Yacute ; B 52 -3 675 897 ;
+C -1 ; WX 606 ; N brokenbar ; B 275 0 331 733 ;
+C -1 ; WX 750 ; N onehalf ; B 31 -2 721 699 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 106
+
+KPX A y -55
+KPX A w -37
+KPX A v -37
+KPX A space -37
+KPX A quoteright -55
+KPX A Y -55
+KPX A W -55
+KPX A V -74
+KPX A T -55
+
+KPX F period -111
+KPX F comma -111
+KPX F A -111
+
+KPX L y -37
+KPX L space -18
+KPX L quoteright -37
+KPX L Y -74
+KPX L W -74
+KPX L V -74
+KPX L T -74
+
+KPX P period -129
+KPX P comma -129
+KPX P A -129
+
+KPX R y -37
+KPX R Y -55
+KPX R W -55
+KPX R V -74
+KPX R T -55
+
+KPX T y -92
+KPX T w -92
+KPX T u -111
+KPX T semicolon -74
+KPX T s -111
+KPX T r -111
+KPX T period -74
+KPX T o -111
+KPX T i -55
+KPX T hyphen -55
+KPX T e -111
+KPX T comma -74
+KPX T colon -74
+KPX T c -111
+KPX T a -111
+KPX T O -18
+KPX T A -92
+
+KPX V y -74
+KPX V u -74
+KPX V semicolon -37
+KPX V r -92
+KPX V period -129
+KPX V o -74
+KPX V i -74
+KPX V hyphen -55
+KPX V e -92
+KPX V comma -129
+KPX V colon -37
+KPX V a -74
+KPX V A -210
+
+KPX W y -20
+KPX W u -20
+KPX W semicolon -18
+KPX W r -20
+KPX W period -55
+KPX W o -20
+KPX W i -20
+KPX W hyphen -18
+KPX W e -20
+KPX W comma -55
+KPX W colon -18
+KPX W a -20
+KPX W A -92
+
+KPX Y v -74
+KPX Y u -92
+KPX Y semicolon -74
+KPX Y q -92
+KPX Y period -92
+KPX Y p -74
+KPX Y o -111
+KPX Y i -55
+KPX Y hyphen -74
+KPX Y e -111
+KPX Y comma -92
+KPX Y colon -74
+KPX Y a -92
+KPX Y A -92
+
+KPX f quoteright 55
+
+KPX one one -55
+
+KPX quoteleft quoteleft -74
+
+KPX quoteright t -37
+KPX quoteright space -55
+KPX quoteright s -55
+KPX quoteright quoteright -74
+
+KPX r quoteright 37
+KPX r q -18
+KPX r period -74
+KPX r o -18
+KPX r h -18
+KPX r g -18
+KPX r e -18
+KPX r comma -74
+KPX r c -18
+
+KPX v period -55
+KPX v comma -55
+
+KPX w period -55
+KPX w comma -55
+
+KPX y period -37
+KPX y comma -37
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 271 210 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 261 210 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 255 210 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 235 210 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 235 210 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 255 228 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 207 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 199 210 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 179 210 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 179 210 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 167 210 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 60 210 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 40 210 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 40 210 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 28 210 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 263 228 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 283 210 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 263 210 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 255 210 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 251 210 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 263 228 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 130 228 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 277 210 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 255 210 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 235 210 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 235 210 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 227 210 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 187 210 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 179 228 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 68 20 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 56 20 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 56 20 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 44 20 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 36 20 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 56 12 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 37 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 48 20 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 48 20 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 28 20 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 16 20 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -15 20 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -27 20 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -27 20 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -39 20 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 112 12 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 68 20 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 56 20 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 56 20 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 36 20 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 56 12 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 10 8 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 124 20 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 112 20 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 112 20 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 100 20 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 96 20 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 84 20 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 38 8 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/psyr.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/psyr.afm
new file mode 100644
index 0000000..1cdbdae
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/psyr.afm
@@ -0,0 +1,209 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights reserved.
+Comment Creation Date: Wed Jan 17 21:48:26 1990
+Comment UniqueID 27004
+Comment VMusage 28489 37622
+FontName Symbol
+FullName Symbol
+FamilyName Symbol
+Weight Medium
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -180 -293 1090 1010
+UnderlinePosition -98
+UnderlineThickness 54
+Version 001.007
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights reserved.
+EncodingScheme FontSpecific
+StartCharMetrics 189
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 128 -17 240 672 ;
+C 34 ; WX 713 ; N universal ; B 31 0 681 705 ;
+C 35 ; WX 500 ; N numbersign ; B 20 -16 481 673 ;
+C 36 ; WX 549 ; N existential ; B 25 0 478 707 ;
+C 37 ; WX 833 ; N percent ; B 63 -36 771 655 ;
+C 38 ; WX 778 ; N ampersand ; B 41 -18 750 661 ;
+C 39 ; WX 439 ; N suchthat ; B 48 -17 414 500 ;
+C 40 ; WX 333 ; N parenleft ; B 53 -191 300 673 ;
+C 41 ; WX 333 ; N parenright ; B 30 -191 277 673 ;
+C 42 ; WX 500 ; N asteriskmath ; B 65 134 427 551 ;
+C 43 ; WX 549 ; N plus ; B 10 0 539 533 ;
+C 44 ; WX 250 ; N comma ; B 56 -152 194 104 ;
+C 45 ; WX 549 ; N minus ; B 11 233 535 288 ;
+C 46 ; WX 250 ; N period ; B 69 -17 181 95 ;
+C 47 ; WX 278 ; N slash ; B 0 -18 254 646 ;
+C 48 ; WX 500 ; N zero ; B 23 -17 471 685 ;
+C 49 ; WX 500 ; N one ; B 117 0 390 673 ;
+C 50 ; WX 500 ; N two ; B 25 0 475 686 ;
+C 51 ; WX 500 ; N three ; B 39 -17 435 685 ;
+C 52 ; WX 500 ; N four ; B 16 0 469 685 ;
+C 53 ; WX 500 ; N five ; B 29 -17 443 685 ;
+C 54 ; WX 500 ; N six ; B 36 -17 467 685 ;
+C 55 ; WX 500 ; N seven ; B 24 -16 448 673 ;
+C 56 ; WX 500 ; N eight ; B 54 -18 440 685 ;
+C 57 ; WX 500 ; N nine ; B 31 -18 460 685 ;
+C 58 ; WX 278 ; N colon ; B 81 -17 193 460 ;
+C 59 ; WX 278 ; N semicolon ; B 83 -152 221 460 ;
+C 60 ; WX 549 ; N less ; B 26 0 523 522 ;
+C 61 ; WX 549 ; N equal ; B 11 141 537 390 ;
+C 62 ; WX 549 ; N greater ; B 26 0 523 522 ;
+C 63 ; WX 444 ; N question ; B 70 -17 412 686 ;
+C 64 ; WX 549 ; N congruent ; B 11 0 537 475 ;
+C 65 ; WX 722 ; N Alpha ; B 4 0 684 673 ;
+C 66 ; WX 667 ; N Beta ; B 29 0 592 673 ;
+C 67 ; WX 722 ; N Chi ; B -9 0 704 673 ;
+C 68 ; WX 612 ; N Delta ; B 6 0 608 688 ;
+C 69 ; WX 611 ; N Epsilon ; B 32 0 617 673 ;
+C 70 ; WX 763 ; N Phi ; B 26 0 741 673 ;
+C 71 ; WX 603 ; N Gamma ; B 24 0 609 673 ;
+C 72 ; WX 722 ; N Eta ; B 39 0 729 673 ;
+C 73 ; WX 333 ; N Iota ; B 32 0 316 673 ;
+C 74 ; WX 631 ; N theta1 ; B 18 -18 623 689 ;
+C 75 ; WX 722 ; N Kappa ; B 35 0 722 673 ;
+C 76 ; WX 686 ; N Lambda ; B 6 0 680 688 ;
+C 77 ; WX 889 ; N Mu ; B 28 0 887 673 ;
+C 78 ; WX 722 ; N Nu ; B 29 -8 720 673 ;
+C 79 ; WX 722 ; N Omicron ; B 41 -17 715 685 ;
+C 80 ; WX 768 ; N Pi ; B 25 0 745 673 ;
+C 81 ; WX 741 ; N Theta ; B 41 -17 715 685 ;
+C 82 ; WX 556 ; N Rho ; B 28 0 563 673 ;
+C 83 ; WX 592 ; N Sigma ; B 5 0 589 673 ;
+C 84 ; WX 611 ; N Tau ; B 33 0 607 673 ;
+C 85 ; WX 690 ; N Upsilon ; B -8 0 694 673 ;
+C 86 ; WX 439 ; N sigma1 ; B 40 -233 436 500 ;
+C 87 ; WX 768 ; N Omega ; B 34 0 736 688 ;
+C 88 ; WX 645 ; N Xi ; B 40 0 599 673 ;
+C 89 ; WX 795 ; N Psi ; B 15 0 781 684 ;
+C 90 ; WX 611 ; N Zeta ; B 44 0 636 673 ;
+C 91 ; WX 333 ; N bracketleft ; B 86 -155 299 674 ;
+C 92 ; WX 863 ; N therefore ; B 163 0 701 478 ;
+C 93 ; WX 333 ; N bracketright ; B 33 -155 246 674 ;
+C 94 ; WX 658 ; N perpendicular ; B 15 0 652 674 ;
+C 95 ; WX 500 ; N underscore ; B -2 -252 502 -206 ;
+C 96 ; WX 500 ; N radicalex ; B 480 881 1090 917 ;
+C 97 ; WX 631 ; N alpha ; B 41 -18 622 500 ;
+C 98 ; WX 549 ; N beta ; B 61 -223 515 741 ;
+C 99 ; WX 549 ; N chi ; B 12 -231 522 499 ;
+C 100 ; WX 494 ; N delta ; B 40 -19 481 740 ;
+C 101 ; WX 439 ; N epsilon ; B 22 -19 427 502 ;
+C 102 ; WX 521 ; N phi ; B 27 -224 490 671 ;
+C 103 ; WX 411 ; N gamma ; B 5 -225 484 499 ;
+C 104 ; WX 603 ; N eta ; B 0 -202 527 514 ;
+C 105 ; WX 329 ; N iota ; B 0 -17 301 503 ;
+C 106 ; WX 603 ; N phi1 ; B 36 -224 587 499 ;
+C 107 ; WX 549 ; N kappa ; B 33 0 558 501 ;
+C 108 ; WX 549 ; N lambda ; B 24 -17 548 739 ;
+C 109 ; WX 576 ; N mu ; B 33 -223 567 500 ;
+C 110 ; WX 521 ; N nu ; B -9 -16 475 507 ;
+C 111 ; WX 549 ; N omicron ; B 35 -19 501 499 ;
+C 112 ; WX 549 ; N pi ; B 10 -19 530 487 ;
+C 113 ; WX 521 ; N theta ; B 43 -17 485 690 ;
+C 114 ; WX 549 ; N rho ; B 50 -230 490 499 ;
+C 115 ; WX 603 ; N sigma ; B 30 -21 588 500 ;
+C 116 ; WX 439 ; N tau ; B 10 -19 418 500 ;
+C 117 ; WX 576 ; N upsilon ; B 7 -18 535 507 ;
+C 118 ; WX 713 ; N omega1 ; B 12 -18 671 583 ;
+C 119 ; WX 686 ; N omega ; B 42 -17 684 500 ;
+C 120 ; WX 493 ; N xi ; B 27 -224 469 766 ;
+C 121 ; WX 686 ; N psi ; B 12 -228 701 500 ;
+C 122 ; WX 494 ; N zeta ; B 60 -225 467 756 ;
+C 123 ; WX 480 ; N braceleft ; B 58 -183 397 673 ;
+C 124 ; WX 200 ; N bar ; B 65 -177 135 673 ;
+C 125 ; WX 480 ; N braceright ; B 79 -183 418 673 ;
+C 126 ; WX 549 ; N similar ; B 17 203 529 307 ;
+C 161 ; WX 620 ; N Upsilon1 ; B -2 0 610 685 ;
+C 162 ; WX 247 ; N minute ; B 27 459 228 735 ;
+C 163 ; WX 549 ; N lessequal ; B 29 0 526 639 ;
+C 164 ; WX 167 ; N fraction ; B -180 -12 340 677 ;
+C 165 ; WX 713 ; N infinity ; B 26 124 688 404 ;
+C 166 ; WX 500 ; N florin ; B 2 -193 494 686 ;
+C 167 ; WX 753 ; N club ; B 86 -26 660 533 ;
+C 168 ; WX 753 ; N diamond ; B 142 -36 600 550 ;
+C 169 ; WX 753 ; N heart ; B 117 -33 631 532 ;
+C 170 ; WX 753 ; N spade ; B 113 -36 629 548 ;
+C 171 ; WX 1042 ; N arrowboth ; B 24 -15 1024 511 ;
+C 172 ; WX 987 ; N arrowleft ; B 32 -15 942 511 ;
+C 173 ; WX 603 ; N arrowup ; B 45 0 571 910 ;
+C 174 ; WX 987 ; N arrowright ; B 49 -15 959 511 ;
+C 175 ; WX 603 ; N arrowdown ; B 45 -22 571 888 ;
+C 176 ; WX 400 ; N degree ; B 50 385 350 685 ;
+C 177 ; WX 549 ; N plusminus ; B 10 0 539 645 ;
+C 178 ; WX 411 ; N second ; B 20 459 413 737 ;
+C 179 ; WX 549 ; N greaterequal ; B 29 0 526 639 ;
+C 180 ; WX 549 ; N multiply ; B 17 8 533 524 ;
+C 181 ; WX 713 ; N proportional ; B 27 123 639 404 ;
+C 182 ; WX 494 ; N partialdiff ; B 26 -20 462 746 ;
+C 183 ; WX 460 ; N bullet ; B 50 113 410 473 ;
+C 184 ; WX 549 ; N divide ; B 10 71 536 456 ;
+C 185 ; WX 549 ; N notequal ; B 15 -25 540 549 ;
+C 186 ; WX 549 ; N equivalence ; B 14 82 538 443 ;
+C 187 ; WX 549 ; N approxequal ; B 14 135 527 394 ;
+C 188 ; WX 1000 ; N ellipsis ; B 111 -17 889 95 ;
+C 189 ; WX 603 ; N arrowvertex ; B 280 -120 336 1010 ;
+C 190 ; WX 1000 ; N arrowhorizex ; B -60 220 1050 276 ;
+C 191 ; WX 658 ; N carriagereturn ; B 15 -16 602 629 ;
+C 192 ; WX 823 ; N aleph ; B 175 -18 661 658 ;
+C 193 ; WX 686 ; N Ifraktur ; B 10 -53 578 740 ;
+C 194 ; WX 795 ; N Rfraktur ; B 26 -15 759 734 ;
+C 195 ; WX 987 ; N weierstrass ; B 159 -211 870 573 ;
+C 196 ; WX 768 ; N circlemultiply ; B 43 -17 733 673 ;
+C 197 ; WX 768 ; N circleplus ; B 43 -15 733 675 ;
+C 198 ; WX 823 ; N emptyset ; B 39 -24 781 719 ;
+C 199 ; WX 768 ; N intersection ; B 40 0 732 509 ;
+C 200 ; WX 768 ; N union ; B 40 -17 732 492 ;
+C 201 ; WX 713 ; N propersuperset ; B 20 0 673 470 ;
+C 202 ; WX 713 ; N reflexsuperset ; B 20 -125 673 470 ;
+C 203 ; WX 713 ; N notsubset ; B 36 -70 690 540 ;
+C 204 ; WX 713 ; N propersubset ; B 37 0 690 470 ;
+C 205 ; WX 713 ; N reflexsubset ; B 37 -125 690 470 ;
+C 206 ; WX 713 ; N element ; B 45 0 505 468 ;
+C 207 ; WX 713 ; N notelement ; B 45 -58 505 555 ;
+C 208 ; WX 768 ; N angle ; B 26 0 738 673 ;
+C 209 ; WX 713 ; N gradient ; B 36 -19 681 718 ;
+C 210 ; WX 790 ; N registerserif ; B 50 -17 740 673 ;
+C 211 ; WX 790 ; N copyrightserif ; B 51 -15 741 675 ;
+C 212 ; WX 890 ; N trademarkserif ; B 18 293 855 673 ;
+C 213 ; WX 823 ; N product ; B 25 -101 803 751 ;
+C 214 ; WX 549 ; N radical ; B 10 -38 515 917 ;
+C 215 ; WX 250 ; N dotmath ; B 69 210 169 310 ;
+C 216 ; WX 713 ; N logicalnot ; B 15 0 680 288 ;
+C 217 ; WX 603 ; N logicaland ; B 23 0 583 454 ;
+C 218 ; WX 603 ; N logicalor ; B 30 0 578 477 ;
+C 219 ; WX 1042 ; N arrowdblboth ; B 27 -20 1023 510 ;
+C 220 ; WX 987 ; N arrowdblleft ; B 30 -15 939 513 ;
+C 221 ; WX 603 ; N arrowdblup ; B 39 2 567 911 ;
+C 222 ; WX 987 ; N arrowdblright ; B 45 -20 954 508 ;
+C 223 ; WX 603 ; N arrowdbldown ; B 44 -19 572 890 ;
+C 224 ; WX 494 ; N lozenge ; B 18 0 466 745 ;
+C 225 ; WX 329 ; N angleleft ; B 25 -198 306 746 ;
+C 226 ; WX 790 ; N registersans ; B 50 -20 740 670 ;
+C 227 ; WX 790 ; N copyrightsans ; B 49 -15 739 675 ;
+C 228 ; WX 786 ; N trademarksans ; B 5 293 725 673 ;
+C 229 ; WX 713 ; N summation ; B 14 -108 695 752 ;
+C 230 ; WX 384 ; N parenlefttp ; B 40 -293 436 926 ;
+C 231 ; WX 384 ; N parenleftex ; B 40 -85 92 925 ;
+C 232 ; WX 384 ; N parenleftbt ; B 40 -293 436 926 ;
+C 233 ; WX 384 ; N bracketlefttp ; B 0 -80 341 926 ;
+C 234 ; WX 384 ; N bracketleftex ; B 0 -79 55 925 ;
+C 235 ; WX 384 ; N bracketleftbt ; B 0 -80 340 926 ;
+C 236 ; WX 494 ; N bracelefttp ; B 201 -75 439 926 ;
+C 237 ; WX 494 ; N braceleftmid ; B 14 -85 255 935 ;
+C 238 ; WX 494 ; N braceleftbt ; B 201 -70 439 926 ;
+C 239 ; WX 494 ; N braceex ; B 201 -80 255 935 ;
+C 241 ; WX 329 ; N angleright ; B 21 -198 302 746 ;
+C 242 ; WX 274 ; N integral ; B 2 -107 291 916 ;
+C 243 ; WX 686 ; N integraltp ; B 332 -83 715 921 ;
+C 244 ; WX 686 ; N integralex ; B 332 -88 415 975 ;
+C 245 ; WX 686 ; N integralbt ; B 39 -81 415 921 ;
+C 246 ; WX 384 ; N parenrighttp ; B 54 -293 450 926 ;
+C 247 ; WX 384 ; N parenrightex ; B 398 -85 450 925 ;
+C 248 ; WX 384 ; N parenrightbt ; B 54 -293 450 926 ;
+C 249 ; WX 384 ; N bracketrighttp ; B 22 -80 360 926 ;
+C 250 ; WX 384 ; N bracketrightex ; B 305 -79 360 925 ;
+C 251 ; WX 384 ; N bracketrightbt ; B 20 -80 360 926 ;
+C 252 ; WX 494 ; N bracerighttp ; B 17 -75 255 926 ;
+C 253 ; WX 494 ; N bracerightmid ; B 201 -85 442 935 ;
+C 254 ; WX 494 ; N bracerightbt ; B 17 -70 255 926 ;
+C -1 ; WX 790 ; N apple ; B 56 -3 733 808 ;
+EndCharMetrics
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/ptmb8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/ptmb8a.afm
new file mode 100644
index 0000000..55207f9
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/ptmb8a.afm
@@ -0,0 +1,648 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Tue Mar 20 12:17:14 1990
+Comment UniqueID 28417
+Comment VMusage 30458 37350
+FontName Times-Bold
+FullName Times Bold
+FamilyName Times
+Weight Bold
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -168 -218 1000 935
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.007
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.Times is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 676
+XHeight 461
+Ascender 676
+Descender -205
+StartCharMetrics 228
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 81 -13 251 691 ;
+C 34 ; WX 555 ; N quotedbl ; B 83 404 472 691 ;
+C 35 ; WX 500 ; N numbersign ; B 4 0 496 700 ;
+C 36 ; WX 500 ; N dollar ; B 29 -99 472 750 ;
+C 37 ; WX 1000 ; N percent ; B 124 -14 877 692 ;
+C 38 ; WX 833 ; N ampersand ; B 62 -16 787 691 ;
+C 39 ; WX 333 ; N quoteright ; B 79 356 263 691 ;
+C 40 ; WX 333 ; N parenleft ; B 46 -168 306 694 ;
+C 41 ; WX 333 ; N parenright ; B 27 -168 287 694 ;
+C 42 ; WX 500 ; N asterisk ; B 56 255 447 691 ;
+C 43 ; WX 570 ; N plus ; B 33 0 537 506 ;
+C 44 ; WX 250 ; N comma ; B 39 -180 223 155 ;
+C 45 ; WX 333 ; N hyphen ; B 44 171 287 287 ;
+C 46 ; WX 250 ; N period ; B 41 -13 210 156 ;
+C 47 ; WX 278 ; N slash ; B -24 -19 302 691 ;
+C 48 ; WX 500 ; N zero ; B 24 -13 476 688 ;
+C 49 ; WX 500 ; N one ; B 65 0 442 688 ;
+C 50 ; WX 500 ; N two ; B 17 0 478 688 ;
+C 51 ; WX 500 ; N three ; B 16 -14 468 688 ;
+C 52 ; WX 500 ; N four ; B 19 0 475 688 ;
+C 53 ; WX 500 ; N five ; B 22 -8 470 676 ;
+C 54 ; WX 500 ; N six ; B 28 -13 475 688 ;
+C 55 ; WX 500 ; N seven ; B 17 0 477 676 ;
+C 56 ; WX 500 ; N eight ; B 28 -13 472 688 ;
+C 57 ; WX 500 ; N nine ; B 26 -13 473 688 ;
+C 58 ; WX 333 ; N colon ; B 82 -13 251 472 ;
+C 59 ; WX 333 ; N semicolon ; B 82 -180 266 472 ;
+C 60 ; WX 570 ; N less ; B 31 -8 539 514 ;
+C 61 ; WX 570 ; N equal ; B 33 107 537 399 ;
+C 62 ; WX 570 ; N greater ; B 31 -8 539 514 ;
+C 63 ; WX 500 ; N question ; B 57 -13 445 689 ;
+C 64 ; WX 930 ; N at ; B 108 -19 822 691 ;
+C 65 ; WX 722 ; N A ; B 9 0 689 690 ;
+C 66 ; WX 667 ; N B ; B 16 0 619 676 ;
+C 67 ; WX 722 ; N C ; B 49 -19 687 691 ;
+C 68 ; WX 722 ; N D ; B 14 0 690 676 ;
+C 69 ; WX 667 ; N E ; B 16 0 641 676 ;
+C 70 ; WX 611 ; N F ; B 16 0 583 676 ;
+C 71 ; WX 778 ; N G ; B 37 -19 755 691 ;
+C 72 ; WX 778 ; N H ; B 21 0 759 676 ;
+C 73 ; WX 389 ; N I ; B 20 0 370 676 ;
+C 74 ; WX 500 ; N J ; B 3 -96 479 676 ;
+C 75 ; WX 778 ; N K ; B 30 0 769 676 ;
+C 76 ; WX 667 ; N L ; B 19 0 638 676 ;
+C 77 ; WX 944 ; N M ; B 14 0 921 676 ;
+C 78 ; WX 722 ; N N ; B 16 -18 701 676 ;
+C 79 ; WX 778 ; N O ; B 35 -19 743 691 ;
+C 80 ; WX 611 ; N P ; B 16 0 600 676 ;
+C 81 ; WX 778 ; N Q ; B 35 -176 743 691 ;
+C 82 ; WX 722 ; N R ; B 26 0 715 676 ;
+C 83 ; WX 556 ; N S ; B 35 -19 513 692 ;
+C 84 ; WX 667 ; N T ; B 31 0 636 676 ;
+C 85 ; WX 722 ; N U ; B 16 -19 701 676 ;
+C 86 ; WX 722 ; N V ; B 16 -18 701 676 ;
+C 87 ; WX 1000 ; N W ; B 19 -15 981 676 ;
+C 88 ; WX 722 ; N X ; B 16 0 699 676 ;
+C 89 ; WX 722 ; N Y ; B 15 0 699 676 ;
+C 90 ; WX 667 ; N Z ; B 28 0 634 676 ;
+C 91 ; WX 333 ; N bracketleft ; B 67 -149 301 678 ;
+C 92 ; WX 278 ; N backslash ; B -25 -19 303 691 ;
+C 93 ; WX 333 ; N bracketright ; B 32 -149 266 678 ;
+C 94 ; WX 581 ; N asciicircum ; B 73 311 509 676 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 333 ; N quoteleft ; B 70 356 254 691 ;
+C 97 ; WX 500 ; N a ; B 25 -14 488 473 ;
+C 98 ; WX 556 ; N b ; B 17 -14 521 676 ;
+C 99 ; WX 444 ; N c ; B 25 -14 430 473 ;
+C 100 ; WX 556 ; N d ; B 25 -14 534 676 ;
+C 101 ; WX 444 ; N e ; B 25 -14 426 473 ;
+C 102 ; WX 333 ; N f ; B 14 0 389 691 ; L i fi ; L l fl ;
+C 103 ; WX 500 ; N g ; B 28 -206 483 473 ;
+C 104 ; WX 556 ; N h ; B 16 0 534 676 ;
+C 105 ; WX 278 ; N i ; B 16 0 255 691 ;
+C 106 ; WX 333 ; N j ; B -57 -203 263 691 ;
+C 107 ; WX 556 ; N k ; B 22 0 543 676 ;
+C 108 ; WX 278 ; N l ; B 16 0 255 676 ;
+C 109 ; WX 833 ; N m ; B 16 0 814 473 ;
+C 110 ; WX 556 ; N n ; B 21 0 539 473 ;
+C 111 ; WX 500 ; N o ; B 25 -14 476 473 ;
+C 112 ; WX 556 ; N p ; B 19 -205 524 473 ;
+C 113 ; WX 556 ; N q ; B 34 -205 536 473 ;
+C 114 ; WX 444 ; N r ; B 29 0 434 473 ;
+C 115 ; WX 389 ; N s ; B 25 -14 361 473 ;
+C 116 ; WX 333 ; N t ; B 20 -12 332 630 ;
+C 117 ; WX 556 ; N u ; B 16 -14 537 461 ;
+C 118 ; WX 500 ; N v ; B 21 -14 485 461 ;
+C 119 ; WX 722 ; N w ; B 23 -14 707 461 ;
+C 120 ; WX 500 ; N x ; B 12 0 484 461 ;
+C 121 ; WX 500 ; N y ; B 16 -205 480 461 ;
+C 122 ; WX 444 ; N z ; B 21 0 420 461 ;
+C 123 ; WX 394 ; N braceleft ; B 22 -175 340 698 ;
+C 124 ; WX 220 ; N bar ; B 66 -19 154 691 ;
+C 125 ; WX 394 ; N braceright ; B 54 -175 372 698 ;
+C 126 ; WX 520 ; N asciitilde ; B 29 173 491 333 ;
+C 161 ; WX 333 ; N exclamdown ; B 82 -203 252 501 ;
+C 162 ; WX 500 ; N cent ; B 53 -140 458 588 ;
+C 163 ; WX 500 ; N sterling ; B 21 -14 477 684 ;
+C 164 ; WX 167 ; N fraction ; B -168 -12 329 688 ;
+C 165 ; WX 500 ; N yen ; B -64 0 547 676 ;
+C 166 ; WX 500 ; N florin ; B 0 -155 498 706 ;
+C 167 ; WX 500 ; N section ; B 57 -132 443 691 ;
+C 168 ; WX 500 ; N currency ; B -26 61 526 613 ;
+C 169 ; WX 278 ; N quotesingle ; B 75 404 204 691 ;
+C 170 ; WX 500 ; N quotedblleft ; B 32 356 486 691 ;
+C 171 ; WX 500 ; N guillemotleft ; B 23 36 473 415 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 51 36 305 415 ;
+C 173 ; WX 333 ; N guilsinglright ; B 28 36 282 415 ;
+C 174 ; WX 556 ; N fi ; B 14 0 536 691 ;
+C 175 ; WX 556 ; N fl ; B 14 0 536 691 ;
+C 177 ; WX 500 ; N endash ; B 0 181 500 271 ;
+C 178 ; WX 500 ; N dagger ; B 47 -134 453 691 ;
+C 179 ; WX 500 ; N daggerdbl ; B 45 -132 456 691 ;
+C 180 ; WX 250 ; N periodcentered ; B 41 248 210 417 ;
+C 182 ; WX 540 ; N paragraph ; B 0 -186 519 676 ;
+C 183 ; WX 350 ; N bullet ; B 35 198 315 478 ;
+C 184 ; WX 333 ; N quotesinglbase ; B 79 -180 263 155 ;
+C 185 ; WX 500 ; N quotedblbase ; B 14 -180 468 155 ;
+C 186 ; WX 500 ; N quotedblright ; B 14 356 468 691 ;
+C 187 ; WX 500 ; N guillemotright ; B 27 36 477 415 ;
+C 188 ; WX 1000 ; N ellipsis ; B 82 -13 917 156 ;
+C 189 ; WX 1000 ; N perthousand ; B 7 -29 995 706 ;
+C 191 ; WX 500 ; N questiondown ; B 55 -201 443 501 ;
+C 193 ; WX 333 ; N grave ; B 8 528 246 713 ;
+C 194 ; WX 333 ; N acute ; B 86 528 324 713 ;
+C 195 ; WX 333 ; N circumflex ; B -2 528 335 704 ;
+C 196 ; WX 333 ; N tilde ; B -16 547 349 674 ;
+C 197 ; WX 333 ; N macron ; B 1 565 331 637 ;
+C 198 ; WX 333 ; N breve ; B 15 528 318 691 ;
+C 199 ; WX 333 ; N dotaccent ; B 103 537 230 667 ;
+C 200 ; WX 333 ; N dieresis ; B -2 537 335 667 ;
+C 202 ; WX 333 ; N ring ; B 60 527 273 740 ;
+C 203 ; WX 333 ; N cedilla ; B 68 -218 294 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B -13 528 425 713 ;
+C 206 ; WX 333 ; N ogonek ; B 90 -173 319 44 ;
+C 207 ; WX 333 ; N caron ; B -2 528 335 704 ;
+C 208 ; WX 1000 ; N emdash ; B 0 181 1000 271 ;
+C 225 ; WX 1000 ; N AE ; B 4 0 951 676 ;
+C 227 ; WX 300 ; N ordfeminine ; B -1 397 301 688 ;
+C 232 ; WX 667 ; N Lslash ; B 19 0 638 676 ;
+C 233 ; WX 778 ; N Oslash ; B 35 -74 743 737 ;
+C 234 ; WX 1000 ; N OE ; B 22 -5 981 684 ;
+C 235 ; WX 330 ; N ordmasculine ; B 18 397 312 688 ;
+C 241 ; WX 722 ; N ae ; B 33 -14 693 473 ;
+C 245 ; WX 278 ; N dotlessi ; B 16 0 255 461 ;
+C 248 ; WX 278 ; N lslash ; B -22 0 303 676 ;
+C 249 ; WX 500 ; N oslash ; B 25 -92 476 549 ;
+C 250 ; WX 722 ; N oe ; B 22 -14 696 473 ;
+C 251 ; WX 556 ; N germandbls ; B 19 -12 517 691 ;
+C -1 ; WX 667 ; N Zcaron ; B 28 0 634 914 ;
+C -1 ; WX 444 ; N ccedilla ; B 25 -218 430 473 ;
+C -1 ; WX 500 ; N ydieresis ; B 16 -205 480 667 ;
+C -1 ; WX 500 ; N atilde ; B 25 -14 488 674 ;
+C -1 ; WX 278 ; N icircumflex ; B -36 0 301 704 ;
+C -1 ; WX 300 ; N threesuperior ; B 3 268 297 688 ;
+C -1 ; WX 444 ; N ecircumflex ; B 25 -14 426 704 ;
+C -1 ; WX 556 ; N thorn ; B 19 -205 524 676 ;
+C -1 ; WX 444 ; N egrave ; B 25 -14 426 713 ;
+C -1 ; WX 300 ; N twosuperior ; B 0 275 300 688 ;
+C -1 ; WX 444 ; N eacute ; B 25 -14 426 713 ;
+C -1 ; WX 500 ; N otilde ; B 25 -14 476 674 ;
+C -1 ; WX 722 ; N Aacute ; B 9 0 689 923 ;
+C -1 ; WX 500 ; N ocircumflex ; B 25 -14 476 704 ;
+C -1 ; WX 500 ; N yacute ; B 16 -205 480 713 ;
+C -1 ; WX 556 ; N udieresis ; B 16 -14 537 667 ;
+C -1 ; WX 750 ; N threequarters ; B 23 -12 733 688 ;
+C -1 ; WX 500 ; N acircumflex ; B 25 -14 488 704 ;
+C -1 ; WX 722 ; N Eth ; B 6 0 690 676 ;
+C -1 ; WX 444 ; N edieresis ; B 25 -14 426 667 ;
+C -1 ; WX 556 ; N ugrave ; B 16 -14 537 713 ;
+C -1 ; WX 1000 ; N trademark ; B 24 271 977 676 ;
+C -1 ; WX 500 ; N ograve ; B 25 -14 476 713 ;
+C -1 ; WX 389 ; N scaron ; B 25 -14 363 704 ;
+C -1 ; WX 389 ; N Idieresis ; B 20 0 370 877 ;
+C -1 ; WX 556 ; N uacute ; B 16 -14 537 713 ;
+C -1 ; WX 500 ; N agrave ; B 25 -14 488 713 ;
+C -1 ; WX 556 ; N ntilde ; B 21 0 539 674 ;
+C -1 ; WX 500 ; N aring ; B 25 -14 488 740 ;
+C -1 ; WX 444 ; N zcaron ; B 21 0 420 704 ;
+C -1 ; WX 389 ; N Icircumflex ; B 20 0 370 914 ;
+C -1 ; WX 722 ; N Ntilde ; B 16 -18 701 884 ;
+C -1 ; WX 556 ; N ucircumflex ; B 16 -14 537 704 ;
+C -1 ; WX 667 ; N Ecircumflex ; B 16 0 641 914 ;
+C -1 ; WX 389 ; N Iacute ; B 20 0 370 923 ;
+C -1 ; WX 722 ; N Ccedilla ; B 49 -218 687 691 ;
+C -1 ; WX 778 ; N Odieresis ; B 35 -19 743 877 ;
+C -1 ; WX 556 ; N Scaron ; B 35 -19 513 914 ;
+C -1 ; WX 667 ; N Edieresis ; B 16 0 641 877 ;
+C -1 ; WX 389 ; N Igrave ; B 20 0 370 923 ;
+C -1 ; WX 500 ; N adieresis ; B 25 -14 488 667 ;
+C -1 ; WX 778 ; N Ograve ; B 35 -19 743 923 ;
+C -1 ; WX 667 ; N Egrave ; B 16 0 641 923 ;
+C -1 ; WX 722 ; N Ydieresis ; B 15 0 699 877 ;
+C -1 ; WX 747 ; N registered ; B 26 -19 721 691 ;
+C -1 ; WX 778 ; N Otilde ; B 35 -19 743 884 ;
+C -1 ; WX 750 ; N onequarter ; B 28 -12 743 688 ;
+C -1 ; WX 722 ; N Ugrave ; B 16 -19 701 923 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 16 -19 701 914 ;
+C -1 ; WX 611 ; N Thorn ; B 16 0 600 676 ;
+C -1 ; WX 570 ; N divide ; B 33 -31 537 537 ;
+C -1 ; WX 722 ; N Atilde ; B 9 0 689 884 ;
+C -1 ; WX 722 ; N Uacute ; B 16 -19 701 923 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 35 -19 743 914 ;
+C -1 ; WX 570 ; N logicalnot ; B 33 108 537 399 ;
+C -1 ; WX 722 ; N Aring ; B 9 0 689 935 ;
+C -1 ; WX 278 ; N idieresis ; B -36 0 301 667 ;
+C -1 ; WX 278 ; N iacute ; B 16 0 290 713 ;
+C -1 ; WX 500 ; N aacute ; B 25 -14 488 713 ;
+C -1 ; WX 570 ; N plusminus ; B 33 0 537 506 ;
+C -1 ; WX 570 ; N multiply ; B 48 16 522 490 ;
+C -1 ; WX 722 ; N Udieresis ; B 16 -19 701 877 ;
+C -1 ; WX 570 ; N minus ; B 33 209 537 297 ;
+C -1 ; WX 300 ; N onesuperior ; B 28 275 273 688 ;
+C -1 ; WX 667 ; N Eacute ; B 16 0 641 923 ;
+C -1 ; WX 722 ; N Acircumflex ; B 9 0 689 914 ;
+C -1 ; WX 747 ; N copyright ; B 26 -19 721 691 ;
+C -1 ; WX 722 ; N Agrave ; B 9 0 689 923 ;
+C -1 ; WX 500 ; N odieresis ; B 25 -14 476 667 ;
+C -1 ; WX 500 ; N oacute ; B 25 -14 476 713 ;
+C -1 ; WX 400 ; N degree ; B 57 402 343 688 ;
+C -1 ; WX 278 ; N igrave ; B -26 0 255 713 ;
+C -1 ; WX 556 ; N mu ; B 33 -206 536 461 ;
+C -1 ; WX 778 ; N Oacute ; B 35 -19 743 923 ;
+C -1 ; WX 500 ; N eth ; B 25 -14 476 691 ;
+C -1 ; WX 722 ; N Adieresis ; B 9 0 689 877 ;
+C -1 ; WX 722 ; N Yacute ; B 15 0 699 928 ;
+C -1 ; WX 220 ; N brokenbar ; B 66 -19 154 691 ;
+C -1 ; WX 750 ; N onehalf ; B -7 -12 775 688 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 283
+
+KPX A y -74
+KPX A w -90
+KPX A v -100
+KPX A u -50
+KPX A quoteright -74
+KPX A quotedblright 0
+KPX A p -25
+KPX A Y -100
+KPX A W -130
+KPX A V -145
+KPX A U -50
+KPX A T -95
+KPX A Q -45
+KPX A O -45
+KPX A G -55
+KPX A C -55
+
+KPX B period 0
+KPX B comma 0
+KPX B U -10
+KPX B A -30
+
+KPX D period -20
+KPX D comma 0
+KPX D Y -40
+KPX D W -40
+KPX D V -40
+KPX D A -35
+
+KPX F r 0
+KPX F period -110
+KPX F o -25
+KPX F i 0
+KPX F e -25
+KPX F comma -92
+KPX F a -25
+KPX F A -90
+
+KPX G period 0
+KPX G comma 0
+
+KPX J u -15
+KPX J period -20
+KPX J o -15
+KPX J e -15
+KPX J comma 0
+KPX J a -15
+KPX J A -30
+
+KPX K y -45
+KPX K u -15
+KPX K o -25
+KPX K e -25
+KPX K O -30
+
+KPX L y -55
+KPX L quoteright -110
+KPX L quotedblright -20
+KPX L Y -92
+KPX L W -92
+KPX L V -92
+KPX L T -92
+
+KPX N period 0
+KPX N comma 0
+KPX N A -20
+
+KPX O period 0
+KPX O comma 0
+KPX O Y -50
+KPX O X -40
+KPX O W -50
+KPX O V -50
+KPX O T -40
+KPX O A -40
+
+KPX P period -110
+KPX P o -20
+KPX P e -20
+KPX P comma -92
+KPX P a -10
+KPX P A -74
+
+KPX Q period -20
+KPX Q comma 0
+KPX Q U -10
+
+KPX R Y -35
+KPX R W -35
+KPX R V -55
+KPX R U -30
+KPX R T -40
+KPX R O -30
+
+KPX S period 0
+KPX S comma 0
+
+KPX T y -74
+KPX T w -74
+KPX T u -92
+KPX T semicolon -74
+KPX T r -74
+KPX T period -90
+KPX T o -92
+KPX T i -18
+KPX T hyphen -92
+KPX T h 0
+KPX T e -92
+KPX T comma -74
+KPX T colon -74
+KPX T a -92
+KPX T O -18
+KPX T A -90
+
+KPX U period -50
+KPX U comma -50
+KPX U A -60
+
+KPX V u -92
+KPX V semicolon -92
+KPX V period -145
+KPX V o -100
+KPX V i -37
+KPX V hyphen -74
+KPX V e -100
+KPX V comma -129
+KPX V colon -92
+KPX V a -92
+KPX V O -45
+KPX V G -30
+KPX V A -135
+
+KPX W y -60
+KPX W u -50
+KPX W semicolon -55
+KPX W period -92
+KPX W o -75
+KPX W i -18
+KPX W hyphen -37
+KPX W h 0
+KPX W e -65
+KPX W comma -92
+KPX W colon -55
+KPX W a -65
+KPX W O -10
+KPX W A -120
+
+KPX Y u -92
+KPX Y semicolon -92
+KPX Y period -92
+KPX Y o -111
+KPX Y i -37
+KPX Y hyphen -92
+KPX Y e -111
+KPX Y comma -92
+KPX Y colon -92
+KPX Y a -85
+KPX Y O -35
+KPX Y A -110
+
+KPX a y 0
+KPX a w 0
+KPX a v -25
+KPX a t 0
+KPX a p 0
+KPX a g 0
+KPX a b 0
+
+KPX b y 0
+KPX b v -15
+KPX b u -20
+KPX b period -40
+KPX b l 0
+KPX b comma 0
+KPX b b -10
+
+KPX c y 0
+KPX c period 0
+KPX c l 0
+KPX c k 0
+KPX c h 0
+KPX c comma 0
+
+KPX colon space 0
+
+KPX comma space 0
+KPX comma quoteright -55
+KPX comma quotedblright -45
+
+KPX d y 0
+KPX d w -15
+KPX d v 0
+KPX d period 0
+KPX d d 0
+KPX d comma 0
+
+KPX e y 0
+KPX e x 0
+KPX e w 0
+KPX e v -15
+KPX e period 0
+KPX e p 0
+KPX e g 0
+KPX e comma 0
+KPX e b 0
+
+KPX f quoteright 55
+KPX f quotedblright 50
+KPX f period -15
+KPX f o -25
+KPX f l 0
+KPX f i -25
+KPX f f 0
+KPX f e 0
+KPX f dotlessi -35
+KPX f comma -15
+KPX f a 0
+
+KPX g y 0
+KPX g r 0
+KPX g period -15
+KPX g o 0
+KPX g i 0
+KPX g g 0
+KPX g e 0
+KPX g comma 0
+KPX g a 0
+
+KPX h y -15
+
+KPX i v -10
+
+KPX k y -15
+KPX k o -15
+KPX k e -10
+
+KPX l y 0
+KPX l w 0
+
+KPX m y 0
+KPX m u 0
+
+KPX n y 0
+KPX n v -40
+KPX n u 0
+
+KPX o y 0
+KPX o x 0
+KPX o w -10
+KPX o v -10
+KPX o g 0
+
+KPX p y 0
+
+KPX period quoteright -55
+KPX period quotedblright -55
+
+KPX quotedblleft quoteleft 0
+KPX quotedblleft A -10
+
+KPX quotedblright space 0
+
+KPX quoteleft quoteleft -63
+KPX quoteleft A -10
+
+KPX quoteright v -20
+KPX quoteright t 0
+KPX quoteright space -74
+KPX quoteright s -37
+KPX quoteright r -20
+KPX quoteright quoteright -63
+KPX quoteright quotedblright 0
+KPX quoteright l 0
+KPX quoteright d -20
+
+KPX r y 0
+KPX r v -10
+KPX r u 0
+KPX r t 0
+KPX r s 0
+KPX r r 0
+KPX r q -18
+KPX r period -100
+KPX r p -10
+KPX r o -18
+KPX r n -15
+KPX r m 0
+KPX r l 0
+KPX r k 0
+KPX r i 0
+KPX r hyphen -37
+KPX r g -10
+KPX r e -18
+KPX r d 0
+KPX r comma -92
+KPX r c -18
+KPX r a 0
+
+KPX s w 0
+
+KPX space quoteleft 0
+KPX space quotedblleft 0
+KPX space Y -55
+KPX space W -30
+KPX space V -45
+KPX space T -30
+KPX space A -55
+
+KPX v period -70
+KPX v o -10
+KPX v e -10
+KPX v comma -55
+KPX v a -10
+
+KPX w period -70
+KPX w o -10
+KPX w h 0
+KPX w e 0
+KPX w comma -55
+KPX w a 0
+
+KPX x e 0
+
+KPX y period -70
+KPX y o -25
+KPX y e -10
+KPX y comma -55
+KPX y a 0
+
+KPX z o 0
+KPX z e 0
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 188 210 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 188 210 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 188 210 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 188 210 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 180 195 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 188 210 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 208 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 174 210 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 174 210 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 174 210 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 174 210 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 28 210 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 28 210 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 28 210 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 28 210 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 195 210 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 223 210 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 223 210 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 223 210 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 223 210 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 223 210 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 112 210 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 222 210 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 222 210 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 222 210 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 222 210 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 210 215 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 215 210 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 167 210 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 77 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 77 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 77 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 77 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 77 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 77 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 69 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 62 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 62 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 62 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 62 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -34 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -34 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -34 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -34 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 112 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 84 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 84 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 84 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 84 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 84 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 28 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 105 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 105 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 105 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 105 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 84 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 84 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 56 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/ptmbi8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/ptmbi8a.afm
new file mode 100644
index 0000000..25ab54e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/ptmbi8a.afm
@@ -0,0 +1,648 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Tue Mar 20 13:14:55 1990
+Comment UniqueID 28425
+Comment VMusage 32721 39613
+FontName Times-BoldItalic
+FullName Times Bold Italic
+FamilyName Times
+Weight Bold
+ItalicAngle -15
+IsFixedPitch false
+FontBBox -200 -218 996 921
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.009
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.Times is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 669
+XHeight 462
+Ascender 699
+Descender -205
+StartCharMetrics 228
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 389 ; N exclam ; B 67 -13 370 684 ;
+C 34 ; WX 555 ; N quotedbl ; B 136 398 536 685 ;
+C 35 ; WX 500 ; N numbersign ; B -33 0 533 700 ;
+C 36 ; WX 500 ; N dollar ; B -20 -100 497 733 ;
+C 37 ; WX 833 ; N percent ; B 39 -10 793 692 ;
+C 38 ; WX 778 ; N ampersand ; B 5 -19 699 682 ;
+C 39 ; WX 333 ; N quoteright ; B 98 369 302 685 ;
+C 40 ; WX 333 ; N parenleft ; B 28 -179 344 685 ;
+C 41 ; WX 333 ; N parenright ; B -44 -179 271 685 ;
+C 42 ; WX 500 ; N asterisk ; B 65 249 456 685 ;
+C 43 ; WX 570 ; N plus ; B 33 0 537 506 ;
+C 44 ; WX 250 ; N comma ; B -60 -182 144 134 ;
+C 45 ; WX 333 ; N hyphen ; B 2 166 271 282 ;
+C 46 ; WX 250 ; N period ; B -9 -13 139 135 ;
+C 47 ; WX 278 ; N slash ; B -64 -18 342 685 ;
+C 48 ; WX 500 ; N zero ; B 17 -14 477 683 ;
+C 49 ; WX 500 ; N one ; B 5 0 419 683 ;
+C 50 ; WX 500 ; N two ; B -27 0 446 683 ;
+C 51 ; WX 500 ; N three ; B -15 -13 450 683 ;
+C 52 ; WX 500 ; N four ; B -15 0 503 683 ;
+C 53 ; WX 500 ; N five ; B -11 -13 487 669 ;
+C 54 ; WX 500 ; N six ; B 23 -15 509 679 ;
+C 55 ; WX 500 ; N seven ; B 52 0 525 669 ;
+C 56 ; WX 500 ; N eight ; B 3 -13 476 683 ;
+C 57 ; WX 500 ; N nine ; B -12 -10 475 683 ;
+C 58 ; WX 333 ; N colon ; B 23 -13 264 459 ;
+C 59 ; WX 333 ; N semicolon ; B -25 -183 264 459 ;
+C 60 ; WX 570 ; N less ; B 31 -8 539 514 ;
+C 61 ; WX 570 ; N equal ; B 33 107 537 399 ;
+C 62 ; WX 570 ; N greater ; B 31 -8 539 514 ;
+C 63 ; WX 500 ; N question ; B 79 -13 470 684 ;
+C 64 ; WX 832 ; N at ; B 63 -18 770 685 ;
+C 65 ; WX 667 ; N A ; B -67 0 593 683 ;
+C 66 ; WX 667 ; N B ; B -24 0 624 669 ;
+C 67 ; WX 667 ; N C ; B 32 -18 677 685 ;
+C 68 ; WX 722 ; N D ; B -46 0 685 669 ;
+C 69 ; WX 667 ; N E ; B -27 0 653 669 ;
+C 70 ; WX 667 ; N F ; B -13 0 660 669 ;
+C 71 ; WX 722 ; N G ; B 21 -18 706 685 ;
+C 72 ; WX 778 ; N H ; B -24 0 799 669 ;
+C 73 ; WX 389 ; N I ; B -32 0 406 669 ;
+C 74 ; WX 500 ; N J ; B -46 -99 524 669 ;
+C 75 ; WX 667 ; N K ; B -21 0 702 669 ;
+C 76 ; WX 611 ; N L ; B -22 0 590 669 ;
+C 77 ; WX 889 ; N M ; B -29 -12 917 669 ;
+C 78 ; WX 722 ; N N ; B -27 -15 748 669 ;
+C 79 ; WX 722 ; N O ; B 27 -18 691 685 ;
+C 80 ; WX 611 ; N P ; B -27 0 613 669 ;
+C 81 ; WX 722 ; N Q ; B 27 -208 691 685 ;
+C 82 ; WX 667 ; N R ; B -29 0 623 669 ;
+C 83 ; WX 556 ; N S ; B 2 -18 526 685 ;
+C 84 ; WX 611 ; N T ; B 50 0 650 669 ;
+C 85 ; WX 722 ; N U ; B 67 -18 744 669 ;
+C 86 ; WX 667 ; N V ; B 65 -18 715 669 ;
+C 87 ; WX 889 ; N W ; B 65 -18 940 669 ;
+C 88 ; WX 667 ; N X ; B -24 0 694 669 ;
+C 89 ; WX 611 ; N Y ; B 73 0 659 669 ;
+C 90 ; WX 611 ; N Z ; B -11 0 590 669 ;
+C 91 ; WX 333 ; N bracketleft ; B -37 -159 362 674 ;
+C 92 ; WX 278 ; N backslash ; B -1 -18 279 685 ;
+C 93 ; WX 333 ; N bracketright ; B -56 -157 343 674 ;
+C 94 ; WX 570 ; N asciicircum ; B 67 304 503 669 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 333 ; N quoteleft ; B 128 369 332 685 ;
+C 97 ; WX 500 ; N a ; B -21 -14 455 462 ;
+C 98 ; WX 500 ; N b ; B -14 -13 444 699 ;
+C 99 ; WX 444 ; N c ; B -5 -13 392 462 ;
+C 100 ; WX 500 ; N d ; B -21 -13 517 699 ;
+C 101 ; WX 444 ; N e ; B 5 -13 398 462 ;
+C 102 ; WX 333 ; N f ; B -169 -205 446 698 ; L i fi ; L l fl ;
+C 103 ; WX 500 ; N g ; B -52 -203 478 462 ;
+C 104 ; WX 556 ; N h ; B -13 -9 498 699 ;
+C 105 ; WX 278 ; N i ; B 2 -9 263 684 ;
+C 106 ; WX 278 ; N j ; B -189 -207 279 684 ;
+C 107 ; WX 500 ; N k ; B -23 -8 483 699 ;
+C 108 ; WX 278 ; N l ; B 2 -9 290 699 ;
+C 109 ; WX 778 ; N m ; B -14 -9 722 462 ;
+C 110 ; WX 556 ; N n ; B -6 -9 493 462 ;
+C 111 ; WX 500 ; N o ; B -3 -13 441 462 ;
+C 112 ; WX 500 ; N p ; B -120 -205 446 462 ;
+C 113 ; WX 500 ; N q ; B 1 -205 471 462 ;
+C 114 ; WX 389 ; N r ; B -21 0 389 462 ;
+C 115 ; WX 389 ; N s ; B -19 -13 333 462 ;
+C 116 ; WX 278 ; N t ; B -11 -9 281 594 ;
+C 117 ; WX 556 ; N u ; B 15 -9 492 462 ;
+C 118 ; WX 444 ; N v ; B 16 -13 401 462 ;
+C 119 ; WX 667 ; N w ; B 16 -13 614 462 ;
+C 120 ; WX 500 ; N x ; B -46 -13 469 462 ;
+C 121 ; WX 444 ; N y ; B -94 -205 392 462 ;
+C 122 ; WX 389 ; N z ; B -43 -78 368 449 ;
+C 123 ; WX 348 ; N braceleft ; B 5 -187 436 686 ;
+C 124 ; WX 220 ; N bar ; B 66 -18 154 685 ;
+C 125 ; WX 348 ; N braceright ; B -129 -187 302 686 ;
+C 126 ; WX 570 ; N asciitilde ; B 54 173 516 333 ;
+C 161 ; WX 389 ; N exclamdown ; B 19 -205 322 492 ;
+C 162 ; WX 500 ; N cent ; B 42 -143 439 576 ;
+C 163 ; WX 500 ; N sterling ; B -32 -12 510 683 ;
+C 164 ; WX 167 ; N fraction ; B -169 -14 324 683 ;
+C 165 ; WX 500 ; N yen ; B 33 0 628 669 ;
+C 166 ; WX 500 ; N florin ; B -87 -156 537 707 ;
+C 167 ; WX 500 ; N section ; B 36 -143 459 685 ;
+C 168 ; WX 500 ; N currency ; B -26 34 526 586 ;
+C 169 ; WX 278 ; N quotesingle ; B 128 398 268 685 ;
+C 170 ; WX 500 ; N quotedblleft ; B 53 369 513 685 ;
+C 171 ; WX 500 ; N guillemotleft ; B 12 32 468 415 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 32 32 303 415 ;
+C 173 ; WX 333 ; N guilsinglright ; B 10 32 281 415 ;
+C 174 ; WX 556 ; N fi ; B -188 -205 514 703 ;
+C 175 ; WX 556 ; N fl ; B -186 -205 553 704 ;
+C 177 ; WX 500 ; N endash ; B -40 178 477 269 ;
+C 178 ; WX 500 ; N dagger ; B 91 -145 494 685 ;
+C 179 ; WX 500 ; N daggerdbl ; B 10 -139 493 685 ;
+C 180 ; WX 250 ; N periodcentered ; B 51 257 199 405 ;
+C 182 ; WX 500 ; N paragraph ; B -57 -193 562 669 ;
+C 183 ; WX 350 ; N bullet ; B 0 175 350 525 ;
+C 184 ; WX 333 ; N quotesinglbase ; B -5 -182 199 134 ;
+C 185 ; WX 500 ; N quotedblbase ; B -57 -182 403 134 ;
+C 186 ; WX 500 ; N quotedblright ; B 53 369 513 685 ;
+C 187 ; WX 500 ; N guillemotright ; B 12 32 468 415 ;
+C 188 ; WX 1000 ; N ellipsis ; B 40 -13 852 135 ;
+C 189 ; WX 1000 ; N perthousand ; B 7 -29 996 706 ;
+C 191 ; WX 500 ; N questiondown ; B 30 -205 421 492 ;
+C 193 ; WX 333 ; N grave ; B 85 516 297 697 ;
+C 194 ; WX 333 ; N acute ; B 139 516 379 697 ;
+C 195 ; WX 333 ; N circumflex ; B 40 516 367 690 ;
+C 196 ; WX 333 ; N tilde ; B 48 536 407 655 ;
+C 197 ; WX 333 ; N macron ; B 51 553 393 623 ;
+C 198 ; WX 333 ; N breve ; B 71 516 387 678 ;
+C 199 ; WX 333 ; N dotaccent ; B 163 525 293 655 ;
+C 200 ; WX 333 ; N dieresis ; B 55 525 397 655 ;
+C 202 ; WX 333 ; N ring ; B 127 516 340 729 ;
+C 203 ; WX 333 ; N cedilla ; B -80 -218 156 5 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 69 516 498 697 ;
+C 206 ; WX 333 ; N ogonek ; B -40 -173 189 44 ;
+C 207 ; WX 333 ; N caron ; B 79 516 411 690 ;
+C 208 ; WX 1000 ; N emdash ; B -40 178 977 269 ;
+C 225 ; WX 944 ; N AE ; B -64 0 918 669 ;
+C 227 ; WX 266 ; N ordfeminine ; B 16 399 330 685 ;
+C 232 ; WX 611 ; N Lslash ; B -22 0 590 669 ;
+C 233 ; WX 722 ; N Oslash ; B 27 -125 691 764 ;
+C 234 ; WX 944 ; N OE ; B 23 -8 946 677 ;
+C 235 ; WX 300 ; N ordmasculine ; B 56 400 347 685 ;
+C 241 ; WX 722 ; N ae ; B -5 -13 673 462 ;
+C 245 ; WX 278 ; N dotlessi ; B 2 -9 238 462 ;
+C 248 ; WX 278 ; N lslash ; B -13 -9 301 699 ;
+C 249 ; WX 500 ; N oslash ; B -3 -119 441 560 ;
+C 250 ; WX 722 ; N oe ; B 6 -13 674 462 ;
+C 251 ; WX 500 ; N germandbls ; B -200 -200 473 705 ;
+C -1 ; WX 611 ; N Zcaron ; B -11 0 590 897 ;
+C -1 ; WX 444 ; N ccedilla ; B -24 -218 392 462 ;
+C -1 ; WX 444 ; N ydieresis ; B -94 -205 438 655 ;
+C -1 ; WX 500 ; N atilde ; B -21 -14 491 655 ;
+C -1 ; WX 278 ; N icircumflex ; B -2 -9 325 690 ;
+C -1 ; WX 300 ; N threesuperior ; B 17 265 321 683 ;
+C -1 ; WX 444 ; N ecircumflex ; B 5 -13 423 690 ;
+C -1 ; WX 500 ; N thorn ; B -120 -205 446 699 ;
+C -1 ; WX 444 ; N egrave ; B 5 -13 398 697 ;
+C -1 ; WX 300 ; N twosuperior ; B 2 274 313 683 ;
+C -1 ; WX 444 ; N eacute ; B 5 -13 435 697 ;
+C -1 ; WX 500 ; N otilde ; B -3 -13 491 655 ;
+C -1 ; WX 667 ; N Aacute ; B -67 0 593 904 ;
+C -1 ; WX 500 ; N ocircumflex ; B -3 -13 451 690 ;
+C -1 ; WX 444 ; N yacute ; B -94 -205 435 697 ;
+C -1 ; WX 556 ; N udieresis ; B 15 -9 494 655 ;
+C -1 ; WX 750 ; N threequarters ; B 7 -14 726 683 ;
+C -1 ; WX 500 ; N acircumflex ; B -21 -14 455 690 ;
+C -1 ; WX 722 ; N Eth ; B -31 0 700 669 ;
+C -1 ; WX 444 ; N edieresis ; B 5 -13 443 655 ;
+C -1 ; WX 556 ; N ugrave ; B 15 -9 492 697 ;
+C -1 ; WX 1000 ; N trademark ; B 32 263 968 669 ;
+C -1 ; WX 500 ; N ograve ; B -3 -13 441 697 ;
+C -1 ; WX 389 ; N scaron ; B -19 -13 439 690 ;
+C -1 ; WX 389 ; N Idieresis ; B -32 0 445 862 ;
+C -1 ; WX 556 ; N uacute ; B 15 -9 492 697 ;
+C -1 ; WX 500 ; N agrave ; B -21 -14 455 697 ;
+C -1 ; WX 556 ; N ntilde ; B -6 -9 504 655 ;
+C -1 ; WX 500 ; N aring ; B -21 -14 455 729 ;
+C -1 ; WX 389 ; N zcaron ; B -43 -78 424 690 ;
+C -1 ; WX 389 ; N Icircumflex ; B -32 0 420 897 ;
+C -1 ; WX 722 ; N Ntilde ; B -27 -15 748 862 ;
+C -1 ; WX 556 ; N ucircumflex ; B 15 -9 492 690 ;
+C -1 ; WX 667 ; N Ecircumflex ; B -27 0 653 897 ;
+C -1 ; WX 389 ; N Iacute ; B -32 0 412 904 ;
+C -1 ; WX 667 ; N Ccedilla ; B 32 -218 677 685 ;
+C -1 ; WX 722 ; N Odieresis ; B 27 -18 691 862 ;
+C -1 ; WX 556 ; N Scaron ; B 2 -18 526 897 ;
+C -1 ; WX 667 ; N Edieresis ; B -27 0 653 862 ;
+C -1 ; WX 389 ; N Igrave ; B -32 0 406 904 ;
+C -1 ; WX 500 ; N adieresis ; B -21 -14 471 655 ;
+C -1 ; WX 722 ; N Ograve ; B 27 -18 691 904 ;
+C -1 ; WX 667 ; N Egrave ; B -27 0 653 904 ;
+C -1 ; WX 611 ; N Ydieresis ; B 73 0 659 862 ;
+C -1 ; WX 747 ; N registered ; B 30 -18 718 685 ;
+C -1 ; WX 722 ; N Otilde ; B 27 -18 691 862 ;
+C -1 ; WX 750 ; N onequarter ; B 7 -14 721 683 ;
+C -1 ; WX 722 ; N Ugrave ; B 67 -18 744 904 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 67 -18 744 897 ;
+C -1 ; WX 611 ; N Thorn ; B -27 0 573 669 ;
+C -1 ; WX 570 ; N divide ; B 33 -29 537 535 ;
+C -1 ; WX 667 ; N Atilde ; B -67 0 593 862 ;
+C -1 ; WX 722 ; N Uacute ; B 67 -18 744 904 ;
+C -1 ; WX 722 ; N Ocircumflex ; B 27 -18 691 897 ;
+C -1 ; WX 606 ; N logicalnot ; B 51 108 555 399 ;
+C -1 ; WX 667 ; N Aring ; B -67 0 593 921 ;
+C -1 ; WX 278 ; N idieresis ; B 2 -9 360 655 ;
+C -1 ; WX 278 ; N iacute ; B 2 -9 352 697 ;
+C -1 ; WX 500 ; N aacute ; B -21 -14 463 697 ;
+C -1 ; WX 570 ; N plusminus ; B 33 0 537 506 ;
+C -1 ; WX 570 ; N multiply ; B 48 16 522 490 ;
+C -1 ; WX 722 ; N Udieresis ; B 67 -18 744 862 ;
+C -1 ; WX 606 ; N minus ; B 51 209 555 297 ;
+C -1 ; WX 300 ; N onesuperior ; B 30 274 301 683 ;
+C -1 ; WX 667 ; N Eacute ; B -27 0 653 904 ;
+C -1 ; WX 667 ; N Acircumflex ; B -67 0 593 897 ;
+C -1 ; WX 747 ; N copyright ; B 30 -18 718 685 ;
+C -1 ; WX 667 ; N Agrave ; B -67 0 593 904 ;
+C -1 ; WX 500 ; N odieresis ; B -3 -13 466 655 ;
+C -1 ; WX 500 ; N oacute ; B -3 -13 463 697 ;
+C -1 ; WX 400 ; N degree ; B 83 397 369 683 ;
+C -1 ; WX 278 ; N igrave ; B 2 -9 260 697 ;
+C -1 ; WX 576 ; N mu ; B -60 -207 516 449 ;
+C -1 ; WX 722 ; N Oacute ; B 27 -18 691 904 ;
+C -1 ; WX 500 ; N eth ; B -3 -13 454 699 ;
+C -1 ; WX 667 ; N Adieresis ; B -67 0 593 862 ;
+C -1 ; WX 611 ; N Yacute ; B 73 0 659 904 ;
+C -1 ; WX 220 ; N brokenbar ; B 66 -18 154 685 ;
+C -1 ; WX 750 ; N onehalf ; B -9 -14 723 683 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 283
+
+KPX A y -74
+KPX A w -74
+KPX A v -74
+KPX A u -30
+KPX A quoteright -74
+KPX A quotedblright 0
+KPX A p 0
+KPX A Y -70
+KPX A W -100
+KPX A V -95
+KPX A U -50
+KPX A T -55
+KPX A Q -55
+KPX A O -50
+KPX A G -60
+KPX A C -65
+
+KPX B period 0
+KPX B comma 0
+KPX B U -10
+KPX B A -25
+
+KPX D period 0
+KPX D comma 0
+KPX D Y -50
+KPX D W -40
+KPX D V -50
+KPX D A -25
+
+KPX F r -50
+KPX F period -129
+KPX F o -70
+KPX F i -40
+KPX F e -100
+KPX F comma -129
+KPX F a -95
+KPX F A -100
+
+KPX G period 0
+KPX G comma 0
+
+KPX J u -40
+KPX J period -10
+KPX J o -40
+KPX J e -40
+KPX J comma -10
+KPX J a -40
+KPX J A -25
+
+KPX K y -20
+KPX K u -20
+KPX K o -25
+KPX K e -25
+KPX K O -30
+
+KPX L y -37
+KPX L quoteright -55
+KPX L quotedblright 0
+KPX L Y -37
+KPX L W -37
+KPX L V -37
+KPX L T -18
+
+KPX N period 0
+KPX N comma 0
+KPX N A -30
+
+KPX O period 0
+KPX O comma 0
+KPX O Y -50
+KPX O X -40
+KPX O W -50
+KPX O V -50
+KPX O T -40
+KPX O A -40
+
+KPX P period -129
+KPX P o -55
+KPX P e -50
+KPX P comma -129
+KPX P a -40
+KPX P A -85
+
+KPX Q period 0
+KPX Q comma 0
+KPX Q U -10
+
+KPX R Y -18
+KPX R W -18
+KPX R V -18
+KPX R U -40
+KPX R T -30
+KPX R O -40
+
+KPX S period 0
+KPX S comma 0
+
+KPX T y -37
+KPX T w -37
+KPX T u -37
+KPX T semicolon -74
+KPX T r -37
+KPX T period -92
+KPX T o -95
+KPX T i -37
+KPX T hyphen -92
+KPX T h 0
+KPX T e -92
+KPX T comma -92
+KPX T colon -74
+KPX T a -92
+KPX T O -18
+KPX T A -55
+
+KPX U period 0
+KPX U comma 0
+KPX U A -45
+
+KPX V u -55
+KPX V semicolon -74
+KPX V period -129
+KPX V o -111
+KPX V i -55
+KPX V hyphen -70
+KPX V e -111
+KPX V comma -129
+KPX V colon -74
+KPX V a -111
+KPX V O -30
+KPX V G -10
+KPX V A -85
+
+KPX W y -55
+KPX W u -55
+KPX W semicolon -55
+KPX W period -74
+KPX W o -80
+KPX W i -37
+KPX W hyphen -50
+KPX W h 0
+KPX W e -90
+KPX W comma -74
+KPX W colon -55
+KPX W a -85
+KPX W O -15
+KPX W A -74
+
+KPX Y u -92
+KPX Y semicolon -92
+KPX Y period -74
+KPX Y o -111
+KPX Y i -55
+KPX Y hyphen -92
+KPX Y e -111
+KPX Y comma -92
+KPX Y colon -92
+KPX Y a -92
+KPX Y O -25
+KPX Y A -74
+
+KPX a y 0
+KPX a w 0
+KPX a v 0
+KPX a t 0
+KPX a p 0
+KPX a g 0
+KPX a b 0
+
+KPX b y 0
+KPX b v 0
+KPX b u -20
+KPX b period -40
+KPX b l 0
+KPX b comma 0
+KPX b b -10
+
+KPX c y 0
+KPX c period 0
+KPX c l 0
+KPX c k -10
+KPX c h -10
+KPX c comma 0
+
+KPX colon space 0
+
+KPX comma space 0
+KPX comma quoteright -95
+KPX comma quotedblright -95
+
+KPX d y 0
+KPX d w 0
+KPX d v 0
+KPX d period 0
+KPX d d 0
+KPX d comma 0
+
+KPX e y 0
+KPX e x 0
+KPX e w 0
+KPX e v 0
+KPX e period 0
+KPX e p 0
+KPX e g 0
+KPX e comma 0
+KPX e b -10
+
+KPX f quoteright 55
+KPX f quotedblright 0
+KPX f period -10
+KPX f o -10
+KPX f l 0
+KPX f i 0
+KPX f f -18
+KPX f e -10
+KPX f dotlessi -30
+KPX f comma -10
+KPX f a 0
+
+KPX g y 0
+KPX g r 0
+KPX g period 0
+KPX g o 0
+KPX g i 0
+KPX g g 0
+KPX g e 0
+KPX g comma 0
+KPX g a 0
+
+KPX h y 0
+
+KPX i v 0
+
+KPX k y 0
+KPX k o -10
+KPX k e -30
+
+KPX l y 0
+KPX l w 0
+
+KPX m y 0
+KPX m u 0
+
+KPX n y 0
+KPX n v -40
+KPX n u 0
+
+KPX o y -10
+KPX o x -10
+KPX o w -25
+KPX o v -15
+KPX o g 0
+
+KPX p y 0
+
+KPX period quoteright -95
+KPX period quotedblright -95
+
+KPX quotedblleft quoteleft 0
+KPX quotedblleft A 0
+
+KPX quotedblright space 0
+
+KPX quoteleft quoteleft -74
+KPX quoteleft A 0
+
+KPX quoteright v -15
+KPX quoteright t -37
+KPX quoteright space -74
+KPX quoteright s -74
+KPX quoteright r -15
+KPX quoteright quoteright -74
+KPX quoteright quotedblright 0
+KPX quoteright l 0
+KPX quoteright d -15
+
+KPX r y 0
+KPX r v 0
+KPX r u 0
+KPX r t 0
+KPX r s 0
+KPX r r 0
+KPX r q 0
+KPX r period -65
+KPX r p 0
+KPX r o 0
+KPX r n 0
+KPX r m 0
+KPX r l 0
+KPX r k 0
+KPX r i 0
+KPX r hyphen 0
+KPX r g 0
+KPX r e 0
+KPX r d 0
+KPX r comma -65
+KPX r c 0
+KPX r a 0
+
+KPX s w 0
+
+KPX space quoteleft 0
+KPX space quotedblleft 0
+KPX space Y -70
+KPX space W -70
+KPX space V -70
+KPX space T 0
+KPX space A -37
+
+KPX v period -37
+KPX v o -15
+KPX v e -15
+KPX v comma -37
+KPX v a 0
+
+KPX w period -37
+KPX w o -15
+KPX w h 0
+KPX w e -10
+KPX w comma -37
+KPX w a -10
+
+KPX x e -10
+
+KPX y period -37
+KPX y o 0
+KPX y e 0
+KPX y comma -37
+KPX y a 0
+
+KPX z o 0
+KPX z e 0
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 172 207 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 187 207 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 167 207 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 172 207 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 157 192 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 167 207 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 167 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 172 207 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 187 207 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 187 207 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 172 207 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 33 207 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 53 207 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 48 207 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 33 207 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 210 207 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 200 207 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 230 207 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 215 207 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 200 207 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 215 207 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 112 207 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 210 207 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 230 207 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 230 207 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 200 207 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 154 207 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 169 207 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 139 207 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 84 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 84 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 74 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 74 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 84 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 84 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 56 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 56 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 56 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 46 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 46 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -27 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -42 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -37 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -37 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 97 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 84 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 84 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 69 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 74 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 84 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 28 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 112 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 112 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 97 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 102 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 56 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 41 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 13 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/ptmr8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/ptmr8a.afm
new file mode 100644
index 0000000..e5092b5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/ptmr8a.afm
@@ -0,0 +1,648 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Tue Mar 20 12:15:44 1990
+Comment UniqueID 28416
+Comment VMusage 30487 37379
+FontName Times-Roman
+FullName Times Roman
+FamilyName Times
+Weight Roman
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -168 -218 1000 898
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.007
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.Times is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 662
+XHeight 450
+Ascender 683
+Descender -217
+StartCharMetrics 228
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 130 -9 238 676 ;
+C 34 ; WX 408 ; N quotedbl ; B 77 431 331 676 ;
+C 35 ; WX 500 ; N numbersign ; B 5 0 496 662 ;
+C 36 ; WX 500 ; N dollar ; B 44 -87 457 727 ;
+C 37 ; WX 833 ; N percent ; B 61 -13 772 676 ;
+C 38 ; WX 778 ; N ampersand ; B 42 -13 750 676 ;
+C 39 ; WX 333 ; N quoteright ; B 79 433 218 676 ;
+C 40 ; WX 333 ; N parenleft ; B 48 -177 304 676 ;
+C 41 ; WX 333 ; N parenright ; B 29 -177 285 676 ;
+C 42 ; WX 500 ; N asterisk ; B 69 265 432 676 ;
+C 43 ; WX 564 ; N plus ; B 30 0 534 506 ;
+C 44 ; WX 250 ; N comma ; B 56 -141 195 102 ;
+C 45 ; WX 333 ; N hyphen ; B 39 194 285 257 ;
+C 46 ; WX 250 ; N period ; B 70 -11 181 100 ;
+C 47 ; WX 278 ; N slash ; B -9 -14 287 676 ;
+C 48 ; WX 500 ; N zero ; B 24 -14 476 676 ;
+C 49 ; WX 500 ; N one ; B 111 0 394 676 ;
+C 50 ; WX 500 ; N two ; B 30 0 475 676 ;
+C 51 ; WX 500 ; N three ; B 43 -14 431 676 ;
+C 52 ; WX 500 ; N four ; B 12 0 472 676 ;
+C 53 ; WX 500 ; N five ; B 32 -14 438 688 ;
+C 54 ; WX 500 ; N six ; B 34 -14 468 684 ;
+C 55 ; WX 500 ; N seven ; B 20 -8 449 662 ;
+C 56 ; WX 500 ; N eight ; B 56 -14 445 676 ;
+C 57 ; WX 500 ; N nine ; B 30 -22 459 676 ;
+C 58 ; WX 278 ; N colon ; B 81 -11 192 459 ;
+C 59 ; WX 278 ; N semicolon ; B 80 -141 219 459 ;
+C 60 ; WX 564 ; N less ; B 28 -8 536 514 ;
+C 61 ; WX 564 ; N equal ; B 30 120 534 386 ;
+C 62 ; WX 564 ; N greater ; B 28 -8 536 514 ;
+C 63 ; WX 444 ; N question ; B 68 -8 414 676 ;
+C 64 ; WX 921 ; N at ; B 116 -14 809 676 ;
+C 65 ; WX 722 ; N A ; B 15 0 706 674 ;
+C 66 ; WX 667 ; N B ; B 17 0 593 662 ;
+C 67 ; WX 667 ; N C ; B 28 -14 633 676 ;
+C 68 ; WX 722 ; N D ; B 16 0 685 662 ;
+C 69 ; WX 611 ; N E ; B 12 0 597 662 ;
+C 70 ; WX 556 ; N F ; B 12 0 546 662 ;
+C 71 ; WX 722 ; N G ; B 32 -14 709 676 ;
+C 72 ; WX 722 ; N H ; B 19 0 702 662 ;
+C 73 ; WX 333 ; N I ; B 18 0 315 662 ;
+C 74 ; WX 389 ; N J ; B 10 -14 370 662 ;
+C 75 ; WX 722 ; N K ; B 34 0 723 662 ;
+C 76 ; WX 611 ; N L ; B 12 0 598 662 ;
+C 77 ; WX 889 ; N M ; B 12 0 863 662 ;
+C 78 ; WX 722 ; N N ; B 12 -11 707 662 ;
+C 79 ; WX 722 ; N O ; B 34 -14 688 676 ;
+C 80 ; WX 556 ; N P ; B 16 0 542 662 ;
+C 81 ; WX 722 ; N Q ; B 34 -178 701 676 ;
+C 82 ; WX 667 ; N R ; B 17 0 659 662 ;
+C 83 ; WX 556 ; N S ; B 42 -14 491 676 ;
+C 84 ; WX 611 ; N T ; B 17 0 593 662 ;
+C 85 ; WX 722 ; N U ; B 14 -14 705 662 ;
+C 86 ; WX 722 ; N V ; B 16 -11 697 662 ;
+C 87 ; WX 944 ; N W ; B 5 -11 932 662 ;
+C 88 ; WX 722 ; N X ; B 10 0 704 662 ;
+C 89 ; WX 722 ; N Y ; B 22 0 703 662 ;
+C 90 ; WX 611 ; N Z ; B 9 0 597 662 ;
+C 91 ; WX 333 ; N bracketleft ; B 88 -156 299 662 ;
+C 92 ; WX 278 ; N backslash ; B -9 -14 287 676 ;
+C 93 ; WX 333 ; N bracketright ; B 34 -156 245 662 ;
+C 94 ; WX 469 ; N asciicircum ; B 24 297 446 662 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 333 ; N quoteleft ; B 115 433 254 676 ;
+C 97 ; WX 444 ; N a ; B 37 -10 442 460 ;
+C 98 ; WX 500 ; N b ; B 3 -10 468 683 ;
+C 99 ; WX 444 ; N c ; B 25 -10 412 460 ;
+C 100 ; WX 500 ; N d ; B 27 -10 491 683 ;
+C 101 ; WX 444 ; N e ; B 25 -10 424 460 ;
+C 102 ; WX 333 ; N f ; B 20 0 383 683 ; L i fi ; L l fl ;
+C 103 ; WX 500 ; N g ; B 28 -218 470 460 ;
+C 104 ; WX 500 ; N h ; B 9 0 487 683 ;
+C 105 ; WX 278 ; N i ; B 16 0 253 683 ;
+C 106 ; WX 278 ; N j ; B -70 -218 194 683 ;
+C 107 ; WX 500 ; N k ; B 7 0 505 683 ;
+C 108 ; WX 278 ; N l ; B 19 0 257 683 ;
+C 109 ; WX 778 ; N m ; B 16 0 775 460 ;
+C 110 ; WX 500 ; N n ; B 16 0 485 460 ;
+C 111 ; WX 500 ; N o ; B 29 -10 470 460 ;
+C 112 ; WX 500 ; N p ; B 5 -217 470 460 ;
+C 113 ; WX 500 ; N q ; B 24 -217 488 460 ;
+C 114 ; WX 333 ; N r ; B 5 0 335 460 ;
+C 115 ; WX 389 ; N s ; B 51 -10 348 460 ;
+C 116 ; WX 278 ; N t ; B 13 -10 279 579 ;
+C 117 ; WX 500 ; N u ; B 9 -10 479 450 ;
+C 118 ; WX 500 ; N v ; B 19 -14 477 450 ;
+C 119 ; WX 722 ; N w ; B 21 -14 694 450 ;
+C 120 ; WX 500 ; N x ; B 17 0 479 450 ;
+C 121 ; WX 500 ; N y ; B 14 -218 475 450 ;
+C 122 ; WX 444 ; N z ; B 27 0 418 450 ;
+C 123 ; WX 480 ; N braceleft ; B 100 -181 350 680 ;
+C 124 ; WX 200 ; N bar ; B 67 -14 133 676 ;
+C 125 ; WX 480 ; N braceright ; B 130 -181 380 680 ;
+C 126 ; WX 541 ; N asciitilde ; B 40 183 502 323 ;
+C 161 ; WX 333 ; N exclamdown ; B 97 -218 205 467 ;
+C 162 ; WX 500 ; N cent ; B 53 -138 448 579 ;
+C 163 ; WX 500 ; N sterling ; B 12 -8 490 676 ;
+C 164 ; WX 167 ; N fraction ; B -168 -14 331 676 ;
+C 165 ; WX 500 ; N yen ; B -53 0 512 662 ;
+C 166 ; WX 500 ; N florin ; B 7 -189 490 676 ;
+C 167 ; WX 500 ; N section ; B 70 -148 426 676 ;
+C 168 ; WX 500 ; N currency ; B -22 58 522 602 ;
+C 169 ; WX 180 ; N quotesingle ; B 48 431 133 676 ;
+C 170 ; WX 444 ; N quotedblleft ; B 43 433 414 676 ;
+C 171 ; WX 500 ; N guillemotleft ; B 42 33 456 416 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 63 33 285 416 ;
+C 173 ; WX 333 ; N guilsinglright ; B 48 33 270 416 ;
+C 174 ; WX 556 ; N fi ; B 31 0 521 683 ;
+C 175 ; WX 556 ; N fl ; B 32 0 521 683 ;
+C 177 ; WX 500 ; N endash ; B 0 201 500 250 ;
+C 178 ; WX 500 ; N dagger ; B 59 -149 442 676 ;
+C 179 ; WX 500 ; N daggerdbl ; B 58 -153 442 676 ;
+C 180 ; WX 250 ; N periodcentered ; B 70 199 181 310 ;
+C 182 ; WX 453 ; N paragraph ; B -22 -154 450 662 ;
+C 183 ; WX 350 ; N bullet ; B 40 196 310 466 ;
+C 184 ; WX 333 ; N quotesinglbase ; B 79 -141 218 102 ;
+C 185 ; WX 444 ; N quotedblbase ; B 45 -141 416 102 ;
+C 186 ; WX 444 ; N quotedblright ; B 30 433 401 676 ;
+C 187 ; WX 500 ; N guillemotright ; B 44 33 458 416 ;
+C 188 ; WX 1000 ; N ellipsis ; B 111 -11 888 100 ;
+C 189 ; WX 1000 ; N perthousand ; B 7 -19 994 706 ;
+C 191 ; WX 444 ; N questiondown ; B 30 -218 376 466 ;
+C 193 ; WX 333 ; N grave ; B 19 507 242 678 ;
+C 194 ; WX 333 ; N acute ; B 93 507 317 678 ;
+C 195 ; WX 333 ; N circumflex ; B 11 507 322 674 ;
+C 196 ; WX 333 ; N tilde ; B 1 532 331 638 ;
+C 197 ; WX 333 ; N macron ; B 11 547 322 601 ;
+C 198 ; WX 333 ; N breve ; B 26 507 307 664 ;
+C 199 ; WX 333 ; N dotaccent ; B 118 523 216 623 ;
+C 200 ; WX 333 ; N dieresis ; B 18 523 315 623 ;
+C 202 ; WX 333 ; N ring ; B 67 512 266 711 ;
+C 203 ; WX 333 ; N cedilla ; B 52 -215 261 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B -3 507 377 678 ;
+C 206 ; WX 333 ; N ogonek ; B 64 -165 249 0 ;
+C 207 ; WX 333 ; N caron ; B 11 507 322 674 ;
+C 208 ; WX 1000 ; N emdash ; B 0 201 1000 250 ;
+C 225 ; WX 889 ; N AE ; B 0 0 863 662 ;
+C 227 ; WX 276 ; N ordfeminine ; B 4 394 270 676 ;
+C 232 ; WX 611 ; N Lslash ; B 12 0 598 662 ;
+C 233 ; WX 722 ; N Oslash ; B 34 -80 688 734 ;
+C 234 ; WX 889 ; N OE ; B 30 -6 885 668 ;
+C 235 ; WX 310 ; N ordmasculine ; B 6 394 304 676 ;
+C 241 ; WX 667 ; N ae ; B 38 -10 632 460 ;
+C 245 ; WX 278 ; N dotlessi ; B 16 0 253 460 ;
+C 248 ; WX 278 ; N lslash ; B 19 0 259 683 ;
+C 249 ; WX 500 ; N oslash ; B 29 -112 470 551 ;
+C 250 ; WX 722 ; N oe ; B 30 -10 690 460 ;
+C 251 ; WX 500 ; N germandbls ; B 12 -9 468 683 ;
+C -1 ; WX 611 ; N Zcaron ; B 9 0 597 886 ;
+C -1 ; WX 444 ; N ccedilla ; B 25 -215 412 460 ;
+C -1 ; WX 500 ; N ydieresis ; B 14 -218 475 623 ;
+C -1 ; WX 444 ; N atilde ; B 37 -10 442 638 ;
+C -1 ; WX 278 ; N icircumflex ; B -16 0 295 674 ;
+C -1 ; WX 300 ; N threesuperior ; B 15 262 291 676 ;
+C -1 ; WX 444 ; N ecircumflex ; B 25 -10 424 674 ;
+C -1 ; WX 500 ; N thorn ; B 5 -217 470 683 ;
+C -1 ; WX 444 ; N egrave ; B 25 -10 424 678 ;
+C -1 ; WX 300 ; N twosuperior ; B 1 270 296 676 ;
+C -1 ; WX 444 ; N eacute ; B 25 -10 424 678 ;
+C -1 ; WX 500 ; N otilde ; B 29 -10 470 638 ;
+C -1 ; WX 722 ; N Aacute ; B 15 0 706 890 ;
+C -1 ; WX 500 ; N ocircumflex ; B 29 -10 470 674 ;
+C -1 ; WX 500 ; N yacute ; B 14 -218 475 678 ;
+C -1 ; WX 500 ; N udieresis ; B 9 -10 479 623 ;
+C -1 ; WX 750 ; N threequarters ; B 15 -14 718 676 ;
+C -1 ; WX 444 ; N acircumflex ; B 37 -10 442 674 ;
+C -1 ; WX 722 ; N Eth ; B 16 0 685 662 ;
+C -1 ; WX 444 ; N edieresis ; B 25 -10 424 623 ;
+C -1 ; WX 500 ; N ugrave ; B 9 -10 479 678 ;
+C -1 ; WX 980 ; N trademark ; B 30 256 957 662 ;
+C -1 ; WX 500 ; N ograve ; B 29 -10 470 678 ;
+C -1 ; WX 389 ; N scaron ; B 39 -10 350 674 ;
+C -1 ; WX 333 ; N Idieresis ; B 18 0 315 835 ;
+C -1 ; WX 500 ; N uacute ; B 9 -10 479 678 ;
+C -1 ; WX 444 ; N agrave ; B 37 -10 442 678 ;
+C -1 ; WX 500 ; N ntilde ; B 16 0 485 638 ;
+C -1 ; WX 444 ; N aring ; B 37 -10 442 711 ;
+C -1 ; WX 444 ; N zcaron ; B 27 0 418 674 ;
+C -1 ; WX 333 ; N Icircumflex ; B 11 0 322 886 ;
+C -1 ; WX 722 ; N Ntilde ; B 12 -11 707 850 ;
+C -1 ; WX 500 ; N ucircumflex ; B 9 -10 479 674 ;
+C -1 ; WX 611 ; N Ecircumflex ; B 12 0 597 886 ;
+C -1 ; WX 333 ; N Iacute ; B 18 0 317 890 ;
+C -1 ; WX 667 ; N Ccedilla ; B 28 -215 633 676 ;
+C -1 ; WX 722 ; N Odieresis ; B 34 -14 688 835 ;
+C -1 ; WX 556 ; N Scaron ; B 42 -14 491 886 ;
+C -1 ; WX 611 ; N Edieresis ; B 12 0 597 835 ;
+C -1 ; WX 333 ; N Igrave ; B 18 0 315 890 ;
+C -1 ; WX 444 ; N adieresis ; B 37 -10 442 623 ;
+C -1 ; WX 722 ; N Ograve ; B 34 -14 688 890 ;
+C -1 ; WX 611 ; N Egrave ; B 12 0 597 890 ;
+C -1 ; WX 722 ; N Ydieresis ; B 22 0 703 835 ;
+C -1 ; WX 760 ; N registered ; B 38 -14 722 676 ;
+C -1 ; WX 722 ; N Otilde ; B 34 -14 688 850 ;
+C -1 ; WX 750 ; N onequarter ; B 37 -14 718 676 ;
+C -1 ; WX 722 ; N Ugrave ; B 14 -14 705 890 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 14 -14 705 886 ;
+C -1 ; WX 556 ; N Thorn ; B 16 0 542 662 ;
+C -1 ; WX 564 ; N divide ; B 30 -10 534 516 ;
+C -1 ; WX 722 ; N Atilde ; B 15 0 706 850 ;
+C -1 ; WX 722 ; N Uacute ; B 14 -14 705 890 ;
+C -1 ; WX 722 ; N Ocircumflex ; B 34 -14 688 886 ;
+C -1 ; WX 564 ; N logicalnot ; B 30 108 534 386 ;
+C -1 ; WX 722 ; N Aring ; B 15 0 706 898 ;
+C -1 ; WX 278 ; N idieresis ; B -9 0 288 623 ;
+C -1 ; WX 278 ; N iacute ; B 16 0 290 678 ;
+C -1 ; WX 444 ; N aacute ; B 37 -10 442 678 ;
+C -1 ; WX 564 ; N plusminus ; B 30 0 534 506 ;
+C -1 ; WX 564 ; N multiply ; B 38 8 527 497 ;
+C -1 ; WX 722 ; N Udieresis ; B 14 -14 705 835 ;
+C -1 ; WX 564 ; N minus ; B 30 220 534 286 ;
+C -1 ; WX 300 ; N onesuperior ; B 57 270 248 676 ;
+C -1 ; WX 611 ; N Eacute ; B 12 0 597 890 ;
+C -1 ; WX 722 ; N Acircumflex ; B 15 0 706 886 ;
+C -1 ; WX 760 ; N copyright ; B 38 -14 722 676 ;
+C -1 ; WX 722 ; N Agrave ; B 15 0 706 890 ;
+C -1 ; WX 500 ; N odieresis ; B 29 -10 470 623 ;
+C -1 ; WX 500 ; N oacute ; B 29 -10 470 678 ;
+C -1 ; WX 400 ; N degree ; B 57 390 343 676 ;
+C -1 ; WX 278 ; N igrave ; B -8 0 253 678 ;
+C -1 ; WX 500 ; N mu ; B 36 -218 512 450 ;
+C -1 ; WX 722 ; N Oacute ; B 34 -14 688 890 ;
+C -1 ; WX 500 ; N eth ; B 29 -10 471 686 ;
+C -1 ; WX 722 ; N Adieresis ; B 15 0 706 835 ;
+C -1 ; WX 722 ; N Yacute ; B 22 0 703 890 ;
+C -1 ; WX 200 ; N brokenbar ; B 67 -14 133 676 ;
+C -1 ; WX 750 ; N onehalf ; B 31 -14 746 676 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 283
+
+KPX A y -92
+KPX A w -92
+KPX A v -74
+KPX A u 0
+KPX A quoteright -111
+KPX A quotedblright 0
+KPX A p 0
+KPX A Y -105
+KPX A W -90
+KPX A V -135
+KPX A U -55
+KPX A T -111
+KPX A Q -55
+KPX A O -55
+KPX A G -40
+KPX A C -40
+
+KPX B period 0
+KPX B comma 0
+KPX B U -10
+KPX B A -35
+
+KPX D period 0
+KPX D comma 0
+KPX D Y -55
+KPX D W -30
+KPX D V -40
+KPX D A -40
+
+KPX F r 0
+KPX F period -80
+KPX F o -15
+KPX F i 0
+KPX F e 0
+KPX F comma -80
+KPX F a -15
+KPX F A -74
+
+KPX G period 0
+KPX G comma 0
+
+KPX J u 0
+KPX J period 0
+KPX J o 0
+KPX J e 0
+KPX J comma 0
+KPX J a 0
+KPX J A -60
+
+KPX K y -25
+KPX K u -15
+KPX K o -35
+KPX K e -25
+KPX K O -30
+
+KPX L y -55
+KPX L quoteright -92
+KPX L quotedblright 0
+KPX L Y -100
+KPX L W -74
+KPX L V -100
+KPX L T -92
+
+KPX N period 0
+KPX N comma 0
+KPX N A -35
+
+KPX O period 0
+KPX O comma 0
+KPX O Y -50
+KPX O X -40
+KPX O W -35
+KPX O V -50
+KPX O T -40
+KPX O A -35
+
+KPX P period -111
+KPX P o 0
+KPX P e 0
+KPX P comma -111
+KPX P a -15
+KPX P A -92
+
+KPX Q period 0
+KPX Q comma 0
+KPX Q U -10
+
+KPX R Y -65
+KPX R W -55
+KPX R V -80
+KPX R U -40
+KPX R T -60
+KPX R O -40
+
+KPX S period 0
+KPX S comma 0
+
+KPX T y -80
+KPX T w -80
+KPX T u -45
+KPX T semicolon -55
+KPX T r -35
+KPX T period -74
+KPX T o -80
+KPX T i -35
+KPX T hyphen -92
+KPX T h 0
+KPX T e -70
+KPX T comma -74
+KPX T colon -50
+KPX T a -80
+KPX T O -18
+KPX T A -93
+
+KPX U period 0
+KPX U comma 0
+KPX U A -40
+
+KPX V u -75
+KPX V semicolon -74
+KPX V period -129
+KPX V o -129
+KPX V i -60
+KPX V hyphen -100
+KPX V e -111
+KPX V comma -129
+KPX V colon -74
+KPX V a -111
+KPX V O -40
+KPX V G -15
+KPX V A -135
+
+KPX W y -73
+KPX W u -50
+KPX W semicolon -37
+KPX W period -92
+KPX W o -80
+KPX W i -40
+KPX W hyphen -65
+KPX W h 0
+KPX W e -80
+KPX W comma -92
+KPX W colon -37
+KPX W a -80
+KPX W O -10
+KPX W A -120
+
+KPX Y u -111
+KPX Y semicolon -92
+KPX Y period -129
+KPX Y o -110
+KPX Y i -55
+KPX Y hyphen -111
+KPX Y e -100
+KPX Y comma -129
+KPX Y colon -92
+KPX Y a -100
+KPX Y O -30
+KPX Y A -120
+
+KPX a y 0
+KPX a w -15
+KPX a v -20
+KPX a t 0
+KPX a p 0
+KPX a g 0
+KPX a b 0
+
+KPX b y 0
+KPX b v -15
+KPX b u -20
+KPX b period -40
+KPX b l 0
+KPX b comma 0
+KPX b b 0
+
+KPX c y -15
+KPX c period 0
+KPX c l 0
+KPX c k 0
+KPX c h 0
+KPX c comma 0
+
+KPX colon space 0
+
+KPX comma space 0
+KPX comma quoteright -70
+KPX comma quotedblright -70
+
+KPX d y 0
+KPX d w 0
+KPX d v 0
+KPX d period 0
+KPX d d 0
+KPX d comma 0
+
+KPX e y -15
+KPX e x -15
+KPX e w -25
+KPX e v -25
+KPX e period 0
+KPX e p 0
+KPX e g -15
+KPX e comma 0
+KPX e b 0
+
+KPX f quoteright 55
+KPX f quotedblright 0
+KPX f period 0
+KPX f o 0
+KPX f l 0
+KPX f i -20
+KPX f f -25
+KPX f e 0
+KPX f dotlessi -50
+KPX f comma 0
+KPX f a -10
+
+KPX g y 0
+KPX g r 0
+KPX g period 0
+KPX g o 0
+KPX g i 0
+KPX g g 0
+KPX g e 0
+KPX g comma 0
+KPX g a -5
+
+KPX h y -5
+
+KPX i v -25
+
+KPX k y -15
+KPX k o -10
+KPX k e -10
+
+KPX l y 0
+KPX l w -10
+
+KPX m y 0
+KPX m u 0
+
+KPX n y -15
+KPX n v -40
+KPX n u 0
+
+KPX o y -10
+KPX o x 0
+KPX o w -25
+KPX o v -15
+KPX o g 0
+
+KPX p y -10
+
+KPX period quoteright -70
+KPX period quotedblright -70
+
+KPX quotedblleft quoteleft 0
+KPX quotedblleft A -80
+
+KPX quotedblright space 0
+
+KPX quoteleft quoteleft -74
+KPX quoteleft A -80
+
+KPX quoteright v -50
+KPX quoteright t -18
+KPX quoteright space -74
+KPX quoteright s -55
+KPX quoteright r -50
+KPX quoteright quoteright -74
+KPX quoteright quotedblright 0
+KPX quoteright l -10
+KPX quoteright d -50
+
+KPX r y 0
+KPX r v 0
+KPX r u 0
+KPX r t 0
+KPX r s 0
+KPX r r 0
+KPX r q 0
+KPX r period -55
+KPX r p 0
+KPX r o 0
+KPX r n 0
+KPX r m 0
+KPX r l 0
+KPX r k 0
+KPX r i 0
+KPX r hyphen -20
+KPX r g -18
+KPX r e 0
+KPX r d 0
+KPX r comma -40
+KPX r c 0
+KPX r a 0
+
+KPX s w 0
+
+KPX space quoteleft 0
+KPX space quotedblleft 0
+KPX space Y -90
+KPX space W -30
+KPX space V -50
+KPX space T -18
+KPX space A -55
+
+KPX v period -65
+KPX v o -20
+KPX v e -15
+KPX v comma -65
+KPX v a -25
+
+KPX w period -65
+KPX w o -10
+KPX w h 0
+KPX w e 0
+KPX w comma -65
+KPX w a -10
+
+KPX x e -15
+
+KPX y period -65
+KPX y o 0
+KPX y e 0
+KPX y comma -65
+KPX y a 0
+
+KPX z o 0
+KPX z e 0
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 195 212 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 195 212 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 195 212 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 195 212 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 185 187 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 195 212 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 167 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 139 212 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 139 212 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 139 212 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 139 212 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 0 212 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 0 212 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 0 212 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 0 212 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 195 212 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 195 212 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 195 212 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 195 212 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 195 212 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 195 212 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 112 212 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 195 212 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 195 212 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 195 212 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 195 212 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 195 212 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 195 212 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 139 212 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 56 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 56 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 56 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 56 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 56 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 56 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 56 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 56 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 56 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 56 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 56 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -27 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -27 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -27 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -27 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 84 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 84 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 84 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 84 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 84 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 84 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 28 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 84 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 84 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 84 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 84 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 84 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 84 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 56 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/ptmri8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/ptmri8a.afm
new file mode 100644
index 0000000..6d7a003
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/ptmri8a.afm
@@ -0,0 +1,648 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Tue Mar 20 13:14:56 1990
+Comment UniqueID 28427
+Comment VMusage 32912 39804
+FontName Times-Italic
+FullName Times Italic
+FamilyName Times
+Weight Medium
+ItalicAngle -15.5
+IsFixedPitch false
+FontBBox -169 -217 1010 883
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.007
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.Times is a trademark of Linotype AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 653
+XHeight 441
+Ascender 683
+Descender -205
+StartCharMetrics 228
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 39 -11 302 667 ;
+C 34 ; WX 420 ; N quotedbl ; B 144 421 432 666 ;
+C 35 ; WX 500 ; N numbersign ; B 2 0 540 676 ;
+C 36 ; WX 500 ; N dollar ; B 31 -89 497 731 ;
+C 37 ; WX 833 ; N percent ; B 79 -13 790 676 ;
+C 38 ; WX 778 ; N ampersand ; B 76 -18 723 666 ;
+C 39 ; WX 333 ; N quoteright ; B 151 436 290 666 ;
+C 40 ; WX 333 ; N parenleft ; B 42 -181 315 669 ;
+C 41 ; WX 333 ; N parenright ; B 16 -180 289 669 ;
+C 42 ; WX 500 ; N asterisk ; B 128 255 492 666 ;
+C 43 ; WX 675 ; N plus ; B 86 0 590 506 ;
+C 44 ; WX 250 ; N comma ; B -4 -129 135 101 ;
+C 45 ; WX 333 ; N hyphen ; B 49 192 282 255 ;
+C 46 ; WX 250 ; N period ; B 27 -11 138 100 ;
+C 47 ; WX 278 ; N slash ; B -65 -18 386 666 ;
+C 48 ; WX 500 ; N zero ; B 32 -7 497 676 ;
+C 49 ; WX 500 ; N one ; B 49 0 409 676 ;
+C 50 ; WX 500 ; N two ; B 12 0 452 676 ;
+C 51 ; WX 500 ; N three ; B 15 -7 465 676 ;
+C 52 ; WX 500 ; N four ; B 1 0 479 676 ;
+C 53 ; WX 500 ; N five ; B 15 -7 491 666 ;
+C 54 ; WX 500 ; N six ; B 30 -7 521 686 ;
+C 55 ; WX 500 ; N seven ; B 75 -8 537 666 ;
+C 56 ; WX 500 ; N eight ; B 30 -7 493 676 ;
+C 57 ; WX 500 ; N nine ; B 23 -17 492 676 ;
+C 58 ; WX 333 ; N colon ; B 50 -11 261 441 ;
+C 59 ; WX 333 ; N semicolon ; B 27 -129 261 441 ;
+C 60 ; WX 675 ; N less ; B 84 -8 592 514 ;
+C 61 ; WX 675 ; N equal ; B 86 120 590 386 ;
+C 62 ; WX 675 ; N greater ; B 84 -8 592 514 ;
+C 63 ; WX 500 ; N question ; B 132 -12 472 664 ;
+C 64 ; WX 920 ; N at ; B 118 -18 806 666 ;
+C 65 ; WX 611 ; N A ; B -51 0 564 668 ;
+C 66 ; WX 611 ; N B ; B -8 0 588 653 ;
+C 67 ; WX 667 ; N C ; B 66 -18 689 666 ;
+C 68 ; WX 722 ; N D ; B -8 0 700 653 ;
+C 69 ; WX 611 ; N E ; B -1 0 634 653 ;
+C 70 ; WX 611 ; N F ; B 8 0 645 653 ;
+C 71 ; WX 722 ; N G ; B 52 -18 722 666 ;
+C 72 ; WX 722 ; N H ; B -8 0 767 653 ;
+C 73 ; WX 333 ; N I ; B -8 0 384 653 ;
+C 74 ; WX 444 ; N J ; B -6 -18 491 653 ;
+C 75 ; WX 667 ; N K ; B 7 0 722 653 ;
+C 76 ; WX 556 ; N L ; B -8 0 559 653 ;
+C 77 ; WX 833 ; N M ; B -18 0 873 653 ;
+C 78 ; WX 667 ; N N ; B -20 -15 727 653 ;
+C 79 ; WX 722 ; N O ; B 60 -18 699 666 ;
+C 80 ; WX 611 ; N P ; B 0 0 605 653 ;
+C 81 ; WX 722 ; N Q ; B 59 -182 699 666 ;
+C 82 ; WX 611 ; N R ; B -13 0 588 653 ;
+C 83 ; WX 500 ; N S ; B 17 -18 508 667 ;
+C 84 ; WX 556 ; N T ; B 59 0 633 653 ;
+C 85 ; WX 722 ; N U ; B 102 -18 765 653 ;
+C 86 ; WX 611 ; N V ; B 76 -18 688 653 ;
+C 87 ; WX 833 ; N W ; B 71 -18 906 653 ;
+C 88 ; WX 611 ; N X ; B -29 0 655 653 ;
+C 89 ; WX 556 ; N Y ; B 78 0 633 653 ;
+C 90 ; WX 556 ; N Z ; B -6 0 606 653 ;
+C 91 ; WX 389 ; N bracketleft ; B 21 -153 391 663 ;
+C 92 ; WX 278 ; N backslash ; B -41 -18 319 666 ;
+C 93 ; WX 389 ; N bracketright ; B 12 -153 382 663 ;
+C 94 ; WX 422 ; N asciicircum ; B 0 301 422 666 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 333 ; N quoteleft ; B 171 436 310 666 ;
+C 97 ; WX 500 ; N a ; B 17 -11 476 441 ;
+C 98 ; WX 500 ; N b ; B 23 -11 473 683 ;
+C 99 ; WX 444 ; N c ; B 30 -11 425 441 ;
+C 100 ; WX 500 ; N d ; B 15 -13 527 683 ;
+C 101 ; WX 444 ; N e ; B 31 -11 412 441 ;
+C 102 ; WX 278 ; N f ; B -147 -207 424 678 ; L i fi ; L l fl ;
+C 103 ; WX 500 ; N g ; B 8 -206 472 441 ;
+C 104 ; WX 500 ; N h ; B 19 -9 478 683 ;
+C 105 ; WX 278 ; N i ; B 49 -11 264 654 ;
+C 106 ; WX 278 ; N j ; B -124 -207 276 654 ;
+C 107 ; WX 444 ; N k ; B 14 -11 461 683 ;
+C 108 ; WX 278 ; N l ; B 41 -11 279 683 ;
+C 109 ; WX 722 ; N m ; B 12 -9 704 441 ;
+C 110 ; WX 500 ; N n ; B 14 -9 474 441 ;
+C 111 ; WX 500 ; N o ; B 27 -11 468 441 ;
+C 112 ; WX 500 ; N p ; B -75 -205 469 441 ;
+C 113 ; WX 500 ; N q ; B 25 -209 483 441 ;
+C 114 ; WX 389 ; N r ; B 45 0 412 441 ;
+C 115 ; WX 389 ; N s ; B 16 -13 366 442 ;
+C 116 ; WX 278 ; N t ; B 37 -11 296 546 ;
+C 117 ; WX 500 ; N u ; B 42 -11 475 441 ;
+C 118 ; WX 444 ; N v ; B 21 -18 426 441 ;
+C 119 ; WX 667 ; N w ; B 16 -18 648 441 ;
+C 120 ; WX 444 ; N x ; B -27 -11 447 441 ;
+C 121 ; WX 444 ; N y ; B -24 -206 426 441 ;
+C 122 ; WX 389 ; N z ; B -2 -81 380 428 ;
+C 123 ; WX 400 ; N braceleft ; B 51 -177 407 687 ;
+C 124 ; WX 275 ; N bar ; B 105 -18 171 666 ;
+C 125 ; WX 400 ; N braceright ; B -7 -177 349 687 ;
+C 126 ; WX 541 ; N asciitilde ; B 40 183 502 323 ;
+C 161 ; WX 389 ; N exclamdown ; B 59 -205 322 473 ;
+C 162 ; WX 500 ; N cent ; B 77 -143 472 560 ;
+C 163 ; WX 500 ; N sterling ; B 10 -6 517 670 ;
+C 164 ; WX 167 ; N fraction ; B -169 -10 337 676 ;
+C 165 ; WX 500 ; N yen ; B 27 0 603 653 ;
+C 166 ; WX 500 ; N florin ; B 25 -182 507 682 ;
+C 167 ; WX 500 ; N section ; B 53 -162 461 666 ;
+C 168 ; WX 500 ; N currency ; B -22 53 522 597 ;
+C 169 ; WX 214 ; N quotesingle ; B 132 421 241 666 ;
+C 170 ; WX 556 ; N quotedblleft ; B 166 436 514 666 ;
+C 171 ; WX 500 ; N guillemotleft ; B 53 37 445 403 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 51 37 281 403 ;
+C 173 ; WX 333 ; N guilsinglright ; B 52 37 282 403 ;
+C 174 ; WX 500 ; N fi ; B -141 -207 481 681 ;
+C 175 ; WX 500 ; N fl ; B -141 -204 518 682 ;
+C 177 ; WX 500 ; N endash ; B -6 197 505 243 ;
+C 178 ; WX 500 ; N dagger ; B 101 -159 488 666 ;
+C 179 ; WX 500 ; N daggerdbl ; B 22 -143 491 666 ;
+C 180 ; WX 250 ; N periodcentered ; B 70 199 181 310 ;
+C 182 ; WX 523 ; N paragraph ; B 55 -123 616 653 ;
+C 183 ; WX 350 ; N bullet ; B 40 191 310 461 ;
+C 184 ; WX 333 ; N quotesinglbase ; B 44 -129 183 101 ;
+C 185 ; WX 556 ; N quotedblbase ; B 57 -129 405 101 ;
+C 186 ; WX 556 ; N quotedblright ; B 151 436 499 666 ;
+C 187 ; WX 500 ; N guillemotright ; B 55 37 447 403 ;
+C 188 ; WX 889 ; N ellipsis ; B 57 -11 762 100 ;
+C 189 ; WX 1000 ; N perthousand ; B 25 -19 1010 706 ;
+C 191 ; WX 500 ; N questiondown ; B 28 -205 368 471 ;
+C 193 ; WX 333 ; N grave ; B 121 492 311 664 ;
+C 194 ; WX 333 ; N acute ; B 180 494 403 664 ;
+C 195 ; WX 333 ; N circumflex ; B 91 492 385 661 ;
+C 196 ; WX 333 ; N tilde ; B 100 517 427 624 ;
+C 197 ; WX 333 ; N macron ; B 99 532 411 583 ;
+C 198 ; WX 333 ; N breve ; B 117 492 418 650 ;
+C 199 ; WX 333 ; N dotaccent ; B 207 508 305 606 ;
+C 200 ; WX 333 ; N dieresis ; B 107 508 405 606 ;
+C 202 ; WX 333 ; N ring ; B 155 492 355 691 ;
+C 203 ; WX 333 ; N cedilla ; B -30 -217 182 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 93 494 486 664 ;
+C 206 ; WX 333 ; N ogonek ; B -20 -169 200 40 ;
+C 207 ; WX 333 ; N caron ; B 121 492 426 661 ;
+C 208 ; WX 889 ; N emdash ; B -6 197 894 243 ;
+C 225 ; WX 889 ; N AE ; B -27 0 911 653 ;
+C 227 ; WX 276 ; N ordfeminine ; B 42 406 352 676 ;
+C 232 ; WX 556 ; N Lslash ; B -8 0 559 653 ;
+C 233 ; WX 722 ; N Oslash ; B 60 -105 699 722 ;
+C 234 ; WX 944 ; N OE ; B 49 -8 964 666 ;
+C 235 ; WX 310 ; N ordmasculine ; B 67 406 362 676 ;
+C 241 ; WX 667 ; N ae ; B 23 -11 640 441 ;
+C 245 ; WX 278 ; N dotlessi ; B 49 -11 235 441 ;
+C 248 ; WX 278 ; N lslash ; B 37 -11 307 683 ;
+C 249 ; WX 500 ; N oslash ; B 28 -135 469 554 ;
+C 250 ; WX 667 ; N oe ; B 20 -12 646 441 ;
+C 251 ; WX 500 ; N germandbls ; B -168 -207 493 679 ;
+C -1 ; WX 556 ; N Zcaron ; B -6 0 606 873 ;
+C -1 ; WX 444 ; N ccedilla ; B 26 -217 425 441 ;
+C -1 ; WX 444 ; N ydieresis ; B -24 -206 441 606 ;
+C -1 ; WX 500 ; N atilde ; B 17 -11 511 624 ;
+C -1 ; WX 278 ; N icircumflex ; B 34 -11 328 661 ;
+C -1 ; WX 300 ; N threesuperior ; B 43 268 339 676 ;
+C -1 ; WX 444 ; N ecircumflex ; B 31 -11 441 661 ;
+C -1 ; WX 500 ; N thorn ; B -75 -205 469 683 ;
+C -1 ; WX 444 ; N egrave ; B 31 -11 412 664 ;
+C -1 ; WX 300 ; N twosuperior ; B 33 271 324 676 ;
+C -1 ; WX 444 ; N eacute ; B 31 -11 459 664 ;
+C -1 ; WX 500 ; N otilde ; B 27 -11 496 624 ;
+C -1 ; WX 611 ; N Aacute ; B -51 0 564 876 ;
+C -1 ; WX 500 ; N ocircumflex ; B 27 -11 468 661 ;
+C -1 ; WX 444 ; N yacute ; B -24 -206 459 664 ;
+C -1 ; WX 500 ; N udieresis ; B 42 -11 479 606 ;
+C -1 ; WX 750 ; N threequarters ; B 23 -10 736 676 ;
+C -1 ; WX 500 ; N acircumflex ; B 17 -11 476 661 ;
+C -1 ; WX 722 ; N Eth ; B -8 0 700 653 ;
+C -1 ; WX 444 ; N edieresis ; B 31 -11 451 606 ;
+C -1 ; WX 500 ; N ugrave ; B 42 -11 475 664 ;
+C -1 ; WX 980 ; N trademark ; B 30 247 957 653 ;
+C -1 ; WX 500 ; N ograve ; B 27 -11 468 664 ;
+C -1 ; WX 389 ; N scaron ; B 16 -13 454 661 ;
+C -1 ; WX 333 ; N Idieresis ; B -8 0 435 818 ;
+C -1 ; WX 500 ; N uacute ; B 42 -11 477 664 ;
+C -1 ; WX 500 ; N agrave ; B 17 -11 476 664 ;
+C -1 ; WX 500 ; N ntilde ; B 14 -9 476 624 ;
+C -1 ; WX 500 ; N aring ; B 17 -11 476 691 ;
+C -1 ; WX 389 ; N zcaron ; B -2 -81 434 661 ;
+C -1 ; WX 333 ; N Icircumflex ; B -8 0 425 873 ;
+C -1 ; WX 667 ; N Ntilde ; B -20 -15 727 836 ;
+C -1 ; WX 500 ; N ucircumflex ; B 42 -11 475 661 ;
+C -1 ; WX 611 ; N Ecircumflex ; B -1 0 634 873 ;
+C -1 ; WX 333 ; N Iacute ; B -8 0 413 876 ;
+C -1 ; WX 667 ; N Ccedilla ; B 66 -217 689 666 ;
+C -1 ; WX 722 ; N Odieresis ; B 60 -18 699 818 ;
+C -1 ; WX 500 ; N Scaron ; B 17 -18 520 873 ;
+C -1 ; WX 611 ; N Edieresis ; B -1 0 634 818 ;
+C -1 ; WX 333 ; N Igrave ; B -8 0 384 876 ;
+C -1 ; WX 500 ; N adieresis ; B 17 -11 489 606 ;
+C -1 ; WX 722 ; N Ograve ; B 60 -18 699 876 ;
+C -1 ; WX 611 ; N Egrave ; B -1 0 634 876 ;
+C -1 ; WX 556 ; N Ydieresis ; B 78 0 633 818 ;
+C -1 ; WX 760 ; N registered ; B 41 -18 719 666 ;
+C -1 ; WX 722 ; N Otilde ; B 60 -18 699 836 ;
+C -1 ; WX 750 ; N onequarter ; B 33 -10 736 676 ;
+C -1 ; WX 722 ; N Ugrave ; B 102 -18 765 876 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 102 -18 765 873 ;
+C -1 ; WX 611 ; N Thorn ; B 0 0 569 653 ;
+C -1 ; WX 675 ; N divide ; B 86 -11 590 517 ;
+C -1 ; WX 611 ; N Atilde ; B -51 0 566 836 ;
+C -1 ; WX 722 ; N Uacute ; B 102 -18 765 876 ;
+C -1 ; WX 722 ; N Ocircumflex ; B 60 -18 699 873 ;
+C -1 ; WX 675 ; N logicalnot ; B 86 108 590 386 ;
+C -1 ; WX 611 ; N Aring ; B -51 0 564 883 ;
+C -1 ; WX 278 ; N idieresis ; B 49 -11 353 606 ;
+C -1 ; WX 278 ; N iacute ; B 49 -11 356 664 ;
+C -1 ; WX 500 ; N aacute ; B 17 -11 487 664 ;
+C -1 ; WX 675 ; N plusminus ; B 86 0 590 506 ;
+C -1 ; WX 675 ; N multiply ; B 93 8 582 497 ;
+C -1 ; WX 722 ; N Udieresis ; B 102 -18 765 818 ;
+C -1 ; WX 675 ; N minus ; B 86 220 590 286 ;
+C -1 ; WX 300 ; N onesuperior ; B 43 271 284 676 ;
+C -1 ; WX 611 ; N Eacute ; B -1 0 634 876 ;
+C -1 ; WX 611 ; N Acircumflex ; B -51 0 564 873 ;
+C -1 ; WX 760 ; N copyright ; B 41 -18 719 666 ;
+C -1 ; WX 611 ; N Agrave ; B -51 0 564 876 ;
+C -1 ; WX 500 ; N odieresis ; B 27 -11 489 606 ;
+C -1 ; WX 500 ; N oacute ; B 27 -11 487 664 ;
+C -1 ; WX 400 ; N degree ; B 101 390 387 676 ;
+C -1 ; WX 278 ; N igrave ; B 49 -11 284 664 ;
+C -1 ; WX 500 ; N mu ; B -30 -209 497 428 ;
+C -1 ; WX 722 ; N Oacute ; B 60 -18 699 876 ;
+C -1 ; WX 500 ; N eth ; B 27 -11 482 683 ;
+C -1 ; WX 611 ; N Adieresis ; B -51 0 564 818 ;
+C -1 ; WX 556 ; N Yacute ; B 78 0 633 876 ;
+C -1 ; WX 275 ; N brokenbar ; B 105 -18 171 666 ;
+C -1 ; WX 750 ; N onehalf ; B 34 -10 749 676 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 283
+
+KPX A y -55
+KPX A w -55
+KPX A v -55
+KPX A u -20
+KPX A quoteright -37
+KPX A quotedblright 0
+KPX A p 0
+KPX A Y -55
+KPX A W -95
+KPX A V -105
+KPX A U -50
+KPX A T -37
+KPX A Q -40
+KPX A O -40
+KPX A G -35
+KPX A C -30
+
+KPX B period 0
+KPX B comma 0
+KPX B U -10
+KPX B A -25
+
+KPX D period 0
+KPX D comma 0
+KPX D Y -40
+KPX D W -40
+KPX D V -40
+KPX D A -35
+
+KPX F r -55
+KPX F period -135
+KPX F o -105
+KPX F i -45
+KPX F e -75
+KPX F comma -135
+KPX F a -75
+KPX F A -115
+
+KPX G period 0
+KPX G comma 0
+
+KPX J u -35
+KPX J period -25
+KPX J o -25
+KPX J e -25
+KPX J comma -25
+KPX J a -35
+KPX J A -40
+
+KPX K y -40
+KPX K u -40
+KPX K o -40
+KPX K e -35
+KPX K O -50
+
+KPX L y -30
+KPX L quoteright -37
+KPX L quotedblright 0
+KPX L Y -20
+KPX L W -55
+KPX L V -55
+KPX L T -20
+
+KPX N period 0
+KPX N comma 0
+KPX N A -27
+
+KPX O period 0
+KPX O comma 0
+KPX O Y -50
+KPX O X -40
+KPX O W -50
+KPX O V -50
+KPX O T -40
+KPX O A -55
+
+KPX P period -135
+KPX P o -80
+KPX P e -80
+KPX P comma -135
+KPX P a -80
+KPX P A -90
+
+KPX Q period 0
+KPX Q comma 0
+KPX Q U -10
+
+KPX R Y -18
+KPX R W -18
+KPX R V -18
+KPX R U -40
+KPX R T 0
+KPX R O -40
+
+KPX S period 0
+KPX S comma 0
+
+KPX T y -74
+KPX T w -74
+KPX T u -55
+KPX T semicolon -65
+KPX T r -55
+KPX T period -74
+KPX T o -92
+KPX T i -55
+KPX T hyphen -74
+KPX T h 0
+KPX T e -92
+KPX T comma -74
+KPX T colon -55
+KPX T a -92
+KPX T O -18
+KPX T A -50
+
+KPX U period -25
+KPX U comma -25
+KPX U A -40
+
+KPX V u -74
+KPX V semicolon -74
+KPX V period -129
+KPX V o -111
+KPX V i -74
+KPX V hyphen -55
+KPX V e -111
+KPX V comma -129
+KPX V colon -65
+KPX V a -111
+KPX V O -30
+KPX V G 0
+KPX V A -60
+
+KPX W y -70
+KPX W u -55
+KPX W semicolon -65
+KPX W period -92
+KPX W o -92
+KPX W i -55
+KPX W hyphen -37
+KPX W h 0
+KPX W e -92
+KPX W comma -92
+KPX W colon -65
+KPX W a -92
+KPX W O -25
+KPX W A -60
+
+KPX Y u -92
+KPX Y semicolon -65
+KPX Y period -92
+KPX Y o -92
+KPX Y i -74
+KPX Y hyphen -74
+KPX Y e -92
+KPX Y comma -92
+KPX Y colon -65
+KPX Y a -92
+KPX Y O -15
+KPX Y A -50
+
+KPX a y 0
+KPX a w 0
+KPX a v 0
+KPX a t 0
+KPX a p 0
+KPX a g -10
+KPX a b 0
+
+KPX b y 0
+KPX b v 0
+KPX b u -20
+KPX b period -40
+KPX b l 0
+KPX b comma 0
+KPX b b 0
+
+KPX c y 0
+KPX c period 0
+KPX c l 0
+KPX c k -20
+KPX c h -15
+KPX c comma 0
+
+KPX colon space 0
+
+KPX comma space 0
+KPX comma quoteright -140
+KPX comma quotedblright -140
+
+KPX d y 0
+KPX d w 0
+KPX d v 0
+KPX d period 0
+KPX d d 0
+KPX d comma 0
+
+KPX e y -30
+KPX e x -20
+KPX e w -15
+KPX e v -15
+KPX e period -15
+KPX e p 0
+KPX e g -40
+KPX e comma -10
+KPX e b 0
+
+KPX f quoteright 92
+KPX f quotedblright 0
+KPX f period -15
+KPX f o 0
+KPX f l 0
+KPX f i -20
+KPX f f -18
+KPX f e 0
+KPX f dotlessi -60
+KPX f comma -10
+KPX f a 0
+
+KPX g y 0
+KPX g r 0
+KPX g period -15
+KPX g o 0
+KPX g i 0
+KPX g g -10
+KPX g e -10
+KPX g comma -10
+KPX g a 0
+
+KPX h y 0
+
+KPX i v 0
+
+KPX k y -10
+KPX k o -10
+KPX k e -10
+
+KPX l y 0
+KPX l w 0
+
+KPX m y 0
+KPX m u 0
+
+KPX n y 0
+KPX n v -40
+KPX n u 0
+
+KPX o y 0
+KPX o x 0
+KPX o w 0
+KPX o v -10
+KPX o g -10
+
+KPX p y 0
+
+KPX period quoteright -140
+KPX period quotedblright -140
+
+KPX quotedblleft quoteleft 0
+KPX quotedblleft A 0
+
+KPX quotedblright space 0
+
+KPX quoteleft quoteleft -111
+KPX quoteleft A 0
+
+KPX quoteright v -10
+KPX quoteright t -30
+KPX quoteright space -111
+KPX quoteright s -40
+KPX quoteright r -25
+KPX quoteright quoteright -111
+KPX quoteright quotedblright 0
+KPX quoteright l 0
+KPX quoteright d -25
+
+KPX r y 0
+KPX r v 0
+KPX r u 0
+KPX r t 0
+KPX r s -10
+KPX r r 0
+KPX r q -37
+KPX r period -111
+KPX r p 0
+KPX r o -45
+KPX r n 0
+KPX r m 0
+KPX r l 0
+KPX r k 0
+KPX r i 0
+KPX r hyphen -20
+KPX r g -37
+KPX r e -37
+KPX r d -37
+KPX r comma -111
+KPX r c -37
+KPX r a -15
+
+KPX s w 0
+
+KPX space quoteleft 0
+KPX space quotedblleft 0
+KPX space Y -75
+KPX space W -40
+KPX space V -35
+KPX space T -18
+KPX space A -18
+
+KPX v period -74
+KPX v o 0
+KPX v e 0
+KPX v comma -74
+KPX v a 0
+
+KPX w period -74
+KPX w o 0
+KPX w h 0
+KPX w e 0
+KPX w comma -74
+KPX w a 0
+
+KPX x e 0
+
+KPX y period -55
+KPX y o 0
+KPX y e 0
+KPX y comma -55
+KPX y a 0
+
+KPX z o 0
+KPX z e 0
+EndKernPairs
+EndKernData
+StartComposites 58
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 139 212 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 144 212 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 139 212 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 149 212 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 129 192 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 139 212 ;
+CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 167 0 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 149 212 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 169 212 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 159 212 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 149 212 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 10 212 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 40 212 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 30 212 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 10 212 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 177 212 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 195 212 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 230 212 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 230 212 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 205 212 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 215 212 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 94 212 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 195 212 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 215 212 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 225 212 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 215 212 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 132 212 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 142 212 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 112 212 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 84 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 84 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 84 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 84 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 84 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 84 0 ;
+CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 56 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 56 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 56 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 46 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 56 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -47 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -57 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -52 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -27 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 49 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 84 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 74 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 84 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 84 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde 69 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron 28 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 74 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 74 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 74 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 84 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 56 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 36 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 8 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/putb8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/putb8a.afm
new file mode 100644
index 0000000..2eaa540
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/putb8a.afm
@@ -0,0 +1,1005 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Fri Jan 17 15:08:52 1992
+Comment UniqueID 37705
+Comment VMusage 33078 39970
+FontName Utopia-Bold
+FullName Utopia Bold
+FamilyName Utopia
+Weight Bold
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -155 -250 1249 916
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.002
+Notice Copyright (c) 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.Utopia is a registered trademark of Adobe Systems Incorporated.
+EncodingScheme AdobeStandardEncoding
+CapHeight 692
+XHeight 490
+Ascender 742
+Descender -230
+StartCharMetrics 228
+C 32 ; WX 210 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 278 ; N exclam ; B 47 -12 231 707 ;
+C 34 ; WX 473 ; N quotedbl ; B 71 407 402 707 ;
+C 35 ; WX 560 ; N numbersign ; B 14 0 547 668 ;
+C 36 ; WX 560 ; N dollar ; B 38 -104 524 748 ;
+C 37 ; WX 887 ; N percent ; B 40 -31 847 701 ;
+C 38 ; WX 748 ; N ampersand ; B 45 -12 734 680 ;
+C 39 ; WX 252 ; N quoteright ; B 40 387 212 707 ;
+C 40 ; WX 365 ; N parenleft ; B 99 -135 344 699 ;
+C 41 ; WX 365 ; N parenright ; B 21 -135 266 699 ;
+C 42 ; WX 442 ; N asterisk ; B 40 315 402 707 ;
+C 43 ; WX 600 ; N plus ; B 58 0 542 490 ;
+C 44 ; WX 280 ; N comma ; B 40 -167 226 180 ;
+C 45 ; WX 392 ; N hyphen ; B 65 203 328 298 ;
+C 46 ; WX 280 ; N period ; B 48 -12 232 174 ;
+C 47 ; WX 378 ; N slash ; B 34 -15 344 707 ;
+C 48 ; WX 560 ; N zero ; B 31 -12 530 680 ;
+C 49 ; WX 560 ; N one ; B 102 0 459 680 ;
+C 50 ; WX 560 ; N two ; B 30 0 539 680 ;
+C 51 ; WX 560 ; N three ; B 27 -12 519 680 ;
+C 52 ; WX 560 ; N four ; B 19 0 533 668 ;
+C 53 ; WX 560 ; N five ; B 43 -12 519 668 ;
+C 54 ; WX 560 ; N six ; B 30 -12 537 680 ;
+C 55 ; WX 560 ; N seven ; B 34 -12 530 668 ;
+C 56 ; WX 560 ; N eight ; B 27 -12 533 680 ;
+C 57 ; WX 560 ; N nine ; B 34 -12 523 680 ;
+C 58 ; WX 280 ; N colon ; B 48 -12 232 490 ;
+C 59 ; WX 280 ; N semicolon ; B 40 -167 232 490 ;
+C 60 ; WX 600 ; N less ; B 61 5 539 493 ;
+C 61 ; WX 600 ; N equal ; B 58 103 542 397 ;
+C 62 ; WX 600 ; N greater ; B 61 5 539 493 ;
+C 63 ; WX 456 ; N question ; B 20 -12 433 707 ;
+C 64 ; WX 833 ; N at ; B 45 -15 797 707 ;
+C 65 ; WX 644 ; N A ; B -28 0 663 692 ;
+C 66 ; WX 683 ; N B ; B 33 0 645 692 ;
+C 67 ; WX 689 ; N C ; B 42 -15 654 707 ;
+C 68 ; WX 777 ; N D ; B 33 0 735 692 ;
+C 69 ; WX 629 ; N E ; B 33 0 604 692 ;
+C 70 ; WX 593 ; N F ; B 37 0 568 692 ;
+C 71 ; WX 726 ; N G ; B 42 -15 709 707 ;
+C 72 ; WX 807 ; N H ; B 33 0 774 692 ;
+C 73 ; WX 384 ; N I ; B 33 0 351 692 ;
+C 74 ; WX 386 ; N J ; B 6 -114 361 692 ;
+C 75 ; WX 707 ; N K ; B 33 -6 719 692 ;
+C 76 ; WX 585 ; N L ; B 33 0 584 692 ;
+C 77 ; WX 918 ; N M ; B 23 0 885 692 ;
+C 78 ; WX 739 ; N N ; B 25 0 719 692 ;
+C 79 ; WX 768 ; N O ; B 42 -15 726 707 ;
+C 80 ; WX 650 ; N P ; B 33 0 623 692 ;
+C 81 ; WX 768 ; N Q ; B 42 -193 726 707 ;
+C 82 ; WX 684 ; N R ; B 33 0 686 692 ;
+C 83 ; WX 561 ; N S ; B 42 -15 533 707 ;
+C 84 ; WX 624 ; N T ; B 15 0 609 692 ;
+C 85 ; WX 786 ; N U ; B 29 -15 757 692 ;
+C 86 ; WX 645 ; N V ; B -16 0 679 692 ;
+C 87 ; WX 933 ; N W ; B -10 0 960 692 ;
+C 88 ; WX 634 ; N X ; B -19 0 671 692 ;
+C 89 ; WX 617 ; N Y ; B -12 0 655 692 ;
+C 90 ; WX 614 ; N Z ; B 0 0 606 692 ;
+C 91 ; WX 335 ; N bracketleft ; B 123 -128 308 692 ;
+C 92 ; WX 379 ; N backslash ; B 34 -15 345 707 ;
+C 93 ; WX 335 ; N bracketright ; B 27 -128 212 692 ;
+C 94 ; WX 600 ; N asciicircum ; B 56 215 544 668 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 252 ; N quoteleft ; B 40 399 212 719 ;
+C 97 ; WX 544 ; N a ; B 41 -12 561 502 ;
+C 98 ; WX 605 ; N b ; B 15 -12 571 742 ;
+C 99 ; WX 494 ; N c ; B 34 -12 484 502 ;
+C 100 ; WX 605 ; N d ; B 34 -12 596 742 ;
+C 101 ; WX 519 ; N e ; B 34 -12 505 502 ;
+C 102 ; WX 342 ; N f ; B 27 0 421 742 ; L i fi ; L l fl ;
+C 103 ; WX 533 ; N g ; B 25 -242 546 512 ;
+C 104 ; WX 631 ; N h ; B 19 0 622 742 ;
+C 105 ; WX 316 ; N i ; B 26 0 307 720 ;
+C 106 ; WX 316 ; N j ; B -12 -232 260 720 ;
+C 107 ; WX 582 ; N k ; B 19 0 595 742 ;
+C 108 ; WX 309 ; N l ; B 19 0 300 742 ;
+C 109 ; WX 948 ; N m ; B 26 0 939 502 ;
+C 110 ; WX 638 ; N n ; B 26 0 629 502 ;
+C 111 ; WX 585 ; N o ; B 34 -12 551 502 ;
+C 112 ; WX 615 ; N p ; B 19 -230 581 502 ;
+C 113 ; WX 597 ; N q ; B 34 -230 596 502 ;
+C 114 ; WX 440 ; N r ; B 26 0 442 502 ;
+C 115 ; WX 446 ; N s ; B 38 -12 425 502 ;
+C 116 ; WX 370 ; N t ; B 32 -12 373 616 ;
+C 117 ; WX 629 ; N u ; B 23 -12 620 502 ;
+C 118 ; WX 520 ; N v ; B -8 0 546 490 ;
+C 119 ; WX 774 ; N w ; B -10 0 802 490 ;
+C 120 ; WX 522 ; N x ; B -15 0 550 490 ;
+C 121 ; WX 524 ; N y ; B -12 -242 557 490 ;
+C 122 ; WX 483 ; N z ; B -1 0 480 490 ;
+C 123 ; WX 365 ; N braceleft ; B 74 -128 325 692 ;
+C 124 ; WX 284 ; N bar ; B 94 -250 190 750 ;
+C 125 ; WX 365 ; N braceright ; B 40 -128 291 692 ;
+C 126 ; WX 600 ; N asciitilde ; B 50 158 551 339 ;
+C 161 ; WX 278 ; N exclamdown ; B 47 -217 231 502 ;
+C 162 ; WX 560 ; N cent ; B 39 -15 546 678 ;
+C 163 ; WX 560 ; N sterling ; B 21 0 555 679 ;
+C 164 ; WX 100 ; N fraction ; B -155 -27 255 695 ;
+C 165 ; WX 560 ; N yen ; B 3 0 562 668 ;
+C 166 ; WX 560 ; N florin ; B -40 -135 562 691 ;
+C 167 ; WX 566 ; N section ; B 35 -115 531 707 ;
+C 168 ; WX 560 ; N currency ; B 21 73 539 596 ;
+C 169 ; WX 252 ; N quotesingle ; B 57 407 196 707 ;
+C 170 ; WX 473 ; N quotedblleft ; B 40 399 433 719 ;
+C 171 ; WX 487 ; N guillemotleft ; B 40 37 452 464 ;
+C 172 ; WX 287 ; N guilsinglleft ; B 40 37 252 464 ;
+C 173 ; WX 287 ; N guilsinglright ; B 35 37 247 464 ;
+C 174 ; WX 639 ; N fi ; B 27 0 630 742 ;
+C 175 ; WX 639 ; N fl ; B 27 0 630 742 ;
+C 177 ; WX 500 ; N endash ; B 0 209 500 292 ;
+C 178 ; WX 510 ; N dagger ; B 35 -125 475 707 ;
+C 179 ; WX 486 ; N daggerdbl ; B 35 -119 451 707 ;
+C 180 ; WX 280 ; N periodcentered ; B 48 156 232 342 ;
+C 182 ; WX 552 ; N paragraph ; B 35 -101 527 692 ;
+C 183 ; WX 455 ; N bullet ; B 50 174 405 529 ;
+C 184 ; WX 252 ; N quotesinglbase ; B 40 -153 212 167 ;
+C 185 ; WX 473 ; N quotedblbase ; B 40 -153 433 167 ;
+C 186 ; WX 473 ; N quotedblright ; B 40 387 433 707 ;
+C 187 ; WX 487 ; N guillemotright ; B 35 37 447 464 ;
+C 188 ; WX 1000 ; N ellipsis ; B 75 -12 925 174 ;
+C 189 ; WX 1289 ; N perthousand ; B 40 -31 1249 701 ;
+C 191 ; WX 456 ; N questiondown ; B 23 -217 436 502 ;
+C 193 ; WX 430 ; N grave ; B 40 511 312 740 ;
+C 194 ; WX 430 ; N acute ; B 119 511 391 740 ;
+C 195 ; WX 430 ; N circumflex ; B 28 520 402 747 ;
+C 196 ; WX 430 ; N tilde ; B 2 553 427 706 ;
+C 197 ; WX 430 ; N macron ; B 60 587 371 674 ;
+C 198 ; WX 430 ; N breve ; B 56 556 375 716 ;
+C 199 ; WX 430 ; N dotaccent ; B 136 561 294 710 ;
+C 200 ; WX 430 ; N dieresis ; B 16 561 414 710 ;
+C 202 ; WX 430 ; N ring ; B 96 540 334 762 ;
+C 203 ; WX 430 ; N cedilla ; B 136 -246 335 0 ;
+C 205 ; WX 430 ; N hungarumlaut ; B 64 521 446 751 ;
+C 206 ; WX 430 ; N ogonek ; B 105 -246 325 0 ;
+C 207 ; WX 430 ; N caron ; B 28 520 402 747 ;
+C 208 ; WX 1000 ; N emdash ; B 0 209 1000 292 ;
+C 225 ; WX 879 ; N AE ; B -77 0 854 692 ;
+C 227 ; WX 405 ; N ordfeminine ; B 28 265 395 590 ;
+C 232 ; WX 591 ; N Lslash ; B 30 0 590 692 ;
+C 233 ; WX 768 ; N Oslash ; B 42 -61 726 747 ;
+C 234 ; WX 1049 ; N OE ; B 42 0 1024 692 ;
+C 235 ; WX 427 ; N ordmasculine ; B 28 265 399 590 ;
+C 241 ; WX 806 ; N ae ; B 41 -12 792 502 ;
+C 245 ; WX 316 ; N dotlessi ; B 26 0 307 502 ;
+C 248 ; WX 321 ; N lslash ; B 16 0 332 742 ;
+C 249 ; WX 585 ; N oslash ; B 34 -51 551 535 ;
+C 250 ; WX 866 ; N oe ; B 34 -12 852 502 ;
+C 251 ; WX 662 ; N germandbls ; B 29 -12 647 742 ;
+C -1 ; WX 402 ; N onesuperior ; B 71 272 324 680 ;
+C -1 ; WX 600 ; N minus ; B 58 210 542 290 ;
+C -1 ; WX 396 ; N degree ; B 35 360 361 680 ;
+C -1 ; WX 585 ; N oacute ; B 34 -12 551 755 ;
+C -1 ; WX 768 ; N Odieresis ; B 42 -15 726 881 ;
+C -1 ; WX 585 ; N odieresis ; B 34 -12 551 710 ;
+C -1 ; WX 629 ; N Eacute ; B 33 0 604 904 ;
+C -1 ; WX 629 ; N ucircumflex ; B 23 -12 620 747 ;
+C -1 ; WX 900 ; N onequarter ; B 73 -27 814 695 ;
+C -1 ; WX 600 ; N logicalnot ; B 58 95 542 397 ;
+C -1 ; WX 629 ; N Ecircumflex ; B 33 0 604 905 ;
+C -1 ; WX 900 ; N onehalf ; B 53 -27 849 695 ;
+C -1 ; WX 768 ; N Otilde ; B 42 -15 726 876 ;
+C -1 ; WX 629 ; N uacute ; B 23 -12 620 740 ;
+C -1 ; WX 519 ; N eacute ; B 34 -12 505 755 ;
+C -1 ; WX 316 ; N iacute ; B 26 0 369 740 ;
+C -1 ; WX 629 ; N Egrave ; B 33 0 604 904 ;
+C -1 ; WX 316 ; N icircumflex ; B -28 0 346 747 ;
+C -1 ; WX 629 ; N mu ; B 23 -242 620 502 ;
+C -1 ; WX 284 ; N brokenbar ; B 94 -175 190 675 ;
+C -1 ; WX 609 ; N thorn ; B 13 -230 575 722 ;
+C -1 ; WX 644 ; N Aring ; B -28 0 663 872 ;
+C -1 ; WX 524 ; N yacute ; B -12 -242 557 740 ;
+C -1 ; WX 617 ; N Ydieresis ; B -12 0 655 881 ;
+C -1 ; WX 1090 ; N trademark ; B 38 277 1028 692 ;
+C -1 ; WX 800 ; N registered ; B 36 -15 764 707 ;
+C -1 ; WX 585 ; N ocircumflex ; B 34 -12 551 747 ;
+C -1 ; WX 644 ; N Agrave ; B -28 0 663 904 ;
+C -1 ; WX 561 ; N Scaron ; B 42 -15 533 916 ;
+C -1 ; WX 786 ; N Ugrave ; B 29 -15 757 904 ;
+C -1 ; WX 629 ; N Edieresis ; B 33 0 604 881 ;
+C -1 ; WX 786 ; N Uacute ; B 29 -15 757 904 ;
+C -1 ; WX 585 ; N otilde ; B 34 -12 551 706 ;
+C -1 ; WX 638 ; N ntilde ; B 26 0 629 706 ;
+C -1 ; WX 524 ; N ydieresis ; B -12 -242 557 710 ;
+C -1 ; WX 644 ; N Aacute ; B -28 0 663 904 ;
+C -1 ; WX 585 ; N eth ; B 34 -12 551 742 ;
+C -1 ; WX 544 ; N acircumflex ; B 41 -12 561 747 ;
+C -1 ; WX 544 ; N aring ; B 41 -12 561 762 ;
+C -1 ; WX 768 ; N Ograve ; B 42 -15 726 904 ;
+C -1 ; WX 494 ; N ccedilla ; B 34 -246 484 502 ;
+C -1 ; WX 600 ; N multiply ; B 75 20 525 476 ;
+C -1 ; WX 600 ; N divide ; B 58 6 542 494 ;
+C -1 ; WX 402 ; N twosuperior ; B 29 272 382 680 ;
+C -1 ; WX 739 ; N Ntilde ; B 25 0 719 876 ;
+C -1 ; WX 629 ; N ugrave ; B 23 -12 620 740 ;
+C -1 ; WX 786 ; N Ucircumflex ; B 29 -15 757 905 ;
+C -1 ; WX 644 ; N Atilde ; B -28 0 663 876 ;
+C -1 ; WX 483 ; N zcaron ; B -1 0 480 747 ;
+C -1 ; WX 316 ; N idieresis ; B -37 0 361 710 ;
+C -1 ; WX 644 ; N Acircumflex ; B -28 0 663 905 ;
+C -1 ; WX 384 ; N Icircumflex ; B 4 0 380 905 ;
+C -1 ; WX 617 ; N Yacute ; B -12 0 655 904 ;
+C -1 ; WX 768 ; N Oacute ; B 42 -15 726 904 ;
+C -1 ; WX 644 ; N Adieresis ; B -28 0 663 881 ;
+C -1 ; WX 614 ; N Zcaron ; B 0 0 606 916 ;
+C -1 ; WX 544 ; N agrave ; B 41 -12 561 755 ;
+C -1 ; WX 402 ; N threesuperior ; B 30 265 368 680 ;
+C -1 ; WX 585 ; N ograve ; B 34 -12 551 755 ;
+C -1 ; WX 900 ; N threequarters ; B 40 -27 842 695 ;
+C -1 ; WX 783 ; N Eth ; B 35 0 741 692 ;
+C -1 ; WX 600 ; N plusminus ; B 58 0 542 549 ;
+C -1 ; WX 629 ; N udieresis ; B 23 -12 620 710 ;
+C -1 ; WX 519 ; N edieresis ; B 34 -12 505 710 ;
+C -1 ; WX 544 ; N aacute ; B 41 -12 561 755 ;
+C -1 ; WX 316 ; N igrave ; B -47 0 307 740 ;
+C -1 ; WX 384 ; N Idieresis ; B -13 0 397 881 ;
+C -1 ; WX 544 ; N adieresis ; B 41 -12 561 710 ;
+C -1 ; WX 384 ; N Iacute ; B 33 0 423 904 ;
+C -1 ; WX 800 ; N copyright ; B 36 -15 764 707 ;
+C -1 ; WX 384 ; N Igrave ; B -31 0 351 904 ;
+C -1 ; WX 689 ; N Ccedilla ; B 42 -246 654 707 ;
+C -1 ; WX 446 ; N scaron ; B 38 -12 425 747 ;
+C -1 ; WX 519 ; N egrave ; B 34 -12 505 755 ;
+C -1 ; WX 768 ; N Ocircumflex ; B 42 -15 726 905 ;
+C -1 ; WX 640 ; N Thorn ; B 33 0 622 692 ;
+C -1 ; WX 544 ; N atilde ; B 41 -12 561 706 ;
+C -1 ; WX 786 ; N Udieresis ; B 29 -15 757 881 ;
+C -1 ; WX 519 ; N ecircumflex ; B 34 -12 505 747 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 685
+
+KPX A z 25
+KPX A y -40
+KPX A w -42
+KPX A v -48
+KPX A u -18
+KPX A t -12
+KPX A s 6
+KPX A quoteright -110
+KPX A quotedblright -80
+KPX A q -6
+KPX A p -18
+KPX A o -12
+KPX A e -6
+KPX A d -12
+KPX A c -12
+KPX A b -12
+KPX A a -6
+KPX A Y -64
+KPX A X -18
+KPX A W -54
+KPX A V -70
+KPX A U -40
+KPX A T -58
+KPX A Q -18
+KPX A O -18
+KPX A G -18
+KPX A C -18
+
+KPX B y -18
+KPX B u -12
+KPX B r -12
+KPX B o -6
+KPX B l -15
+KPX B k -15
+KPX B i -12
+KPX B h -15
+KPX B e -6
+KPX B b -10
+KPX B a -12
+KPX B W -20
+KPX B V -20
+KPX B U -25
+KPX B T -20
+
+KPX C z -5
+KPX C y -24
+KPX C u -18
+KPX C r -6
+KPX C o -12
+KPX C e -12
+KPX C a -16
+KPX C Q -6
+KPX C O -6
+KPX C G -6
+KPX C C -6
+
+KPX D u -12
+KPX D r -12
+KPX D period -40
+KPX D o -5
+KPX D i -12
+KPX D h -18
+KPX D e -5
+KPX D comma -40
+KPX D a -15
+KPX D Y -60
+KPX D W -40
+KPX D V -40
+
+KPX E y -30
+KPX E w -24
+KPX E v -24
+KPX E u -12
+KPX E t -18
+KPX E s -12
+KPX E r -4
+KPX E q -6
+KPX E period 10
+KPX E p -18
+KPX E o -6
+KPX E n -4
+KPX E m -4
+KPX E j -6
+KPX E i -6
+KPX E g -6
+KPX E e -6
+KPX E d -6
+KPX E comma 10
+KPX E c -6
+KPX E b -5
+KPX E a -4
+KPX E Y -6
+KPX E W -6
+KPX E V -6
+
+KPX F y -18
+KPX F u -12
+KPX F r -36
+KPX F quoteright 20
+KPX F quotedblright 20
+KPX F period -150
+KPX F o -36
+KPX F l -12
+KPX F i -22
+KPX F e -36
+KPX F comma -150
+KPX F a -48
+KPX F A -60
+
+KPX G y -12
+KPX G u -12
+KPX G r -18
+KPX G quotedblright -20
+KPX G n -18
+KPX G l -6
+KPX G i -12
+KPX G h -12
+KPX G a -12
+
+KPX H y -24
+KPX H u -26
+KPX H o -30
+KPX H i -18
+KPX H e -30
+KPX H a -25
+
+KPX I z -6
+KPX I y -6
+KPX I x -6
+KPX I w -18
+KPX I v -24
+KPX I u -26
+KPX I t -24
+KPX I s -18
+KPX I r -12
+KPX I p -26
+KPX I o -30
+KPX I n -18
+KPX I m -18
+KPX I l -6
+KPX I k -6
+KPX I h -6
+KPX I g -6
+KPX I f -6
+KPX I e -30
+KPX I d -30
+KPX I c -30
+KPX I b -6
+KPX I a -24
+
+KPX J y -20
+KPX J u -36
+KPX J o -35
+KPX J i -20
+KPX J e -35
+KPX J bracketright 15
+KPX J braceright 15
+KPX J a -36
+
+KPX K y -70
+KPX K w -60
+KPX K v -80
+KPX K u -42
+KPX K o -30
+KPX K l 10
+KPX K i 6
+KPX K h 10
+KPX K e -18
+KPX K a -6
+KPX K Q -36
+KPX K O -36
+KPX K G -36
+KPX K C -36
+KPX K A 20
+
+KPX L y -52
+KPX L w -58
+KPX L u -12
+KPX L quoteright -130
+KPX L quotedblright -130
+KPX L l 6
+KPX L j -6
+KPX L Y -70
+KPX L W -78
+KPX L V -95
+KPX L U -32
+KPX L T -80
+KPX L Q -12
+KPX L O -12
+KPX L G -12
+KPX L C -12
+KPX L A 30
+
+KPX M y -24
+KPX M u -36
+KPX M o -30
+KPX M n -6
+KPX M j -12
+KPX M i -12
+KPX M e -30
+KPX M d -30
+KPX M c -30
+KPX M a -25
+
+KPX N y -24
+KPX N u -30
+KPX N o -30
+KPX N i -24
+KPX N e -30
+KPX N a -30
+
+KPX O z -6
+KPX O u -6
+KPX O t -6
+KPX O s -6
+KPX O r -10
+KPX O q -6
+KPX O period -40
+KPX O p -10
+KPX O o -6
+KPX O n -10
+KPX O m -10
+KPX O l -15
+KPX O k -15
+KPX O i -6
+KPX O h -15
+KPX O g -6
+KPX O e -6
+KPX O d -6
+KPX O comma -40
+KPX O c -6
+KPX O b -15
+KPX O a -12
+KPX O Y -50
+KPX O X -40
+KPX O W -35
+KPX O V -35
+KPX O T -40
+KPX O A -30
+
+KPX P y 10
+KPX P u -18
+KPX P t -6
+KPX P s -30
+KPX P r -12
+KPX P quoteright 20
+KPX P quotedblright 20
+KPX P period -200
+KPX P o -36
+KPX P n -12
+KPX P l -15
+KPX P i -6
+KPX P hyphen -30
+KPX P h -15
+KPX P e -36
+KPX P comma -200
+KPX P a -36
+KPX P I -20
+KPX P H -20
+KPX P E -20
+KPX P A -85
+
+KPX Q u -6
+KPX Q a -18
+KPX Q Y -50
+KPX Q X -40
+KPX Q W -35
+KPX Q V -35
+KPX Q U -25
+KPX Q T -40
+KPX Q A -30
+
+KPX R y -20
+KPX R u -12
+KPX R t -25
+KPX R quoteright -10
+KPX R quotedblright -10
+KPX R o -12
+KPX R e -18
+KPX R a -6
+KPX R Y -32
+KPX R X 20
+KPX R W -18
+KPX R V -26
+KPX R U -30
+KPX R T -20
+KPX R Q -10
+KPX R O -10
+KPX R G -10
+KPX R C -10
+
+KPX S y -35
+KPX S w -30
+KPX S v -40
+KPX S u -24
+KPX S t -24
+KPX S r -10
+KPX S quoteright -15
+KPX S quotedblright -15
+KPX S p -24
+KPX S n -24
+KPX S m -24
+KPX S l -18
+KPX S k -24
+KPX S j -30
+KPX S i -12
+KPX S h -12
+KPX S a -18
+
+KPX T z -64
+KPX T y -74
+KPX T w -72
+KPX T u -74
+KPX T semicolon -50
+KPX T s -82
+KPX T r -74
+KPX T quoteright 24
+KPX T quotedblright 24
+KPX T period -95
+KPX T parenright 40
+KPX T o -90
+KPX T m -72
+KPX T i -28
+KPX T hyphen -110
+KPX T endash -40
+KPX T emdash -60
+KPX T e -80
+KPX T comma -95
+KPX T bracketright 40
+KPX T braceright 30
+KPX T a -90
+KPX T Y 12
+KPX T X 10
+KPX T W 15
+KPX T V 6
+KPX T T 30
+KPX T S -12
+KPX T Q -25
+KPX T O -25
+KPX T G -25
+KPX T C -25
+KPX T A -52
+
+KPX U z -35
+KPX U y -30
+KPX U x -30
+KPX U v -30
+KPX U t -36
+KPX U s -45
+KPX U r -50
+KPX U p -50
+KPX U n -50
+KPX U m -50
+KPX U l -12
+KPX U k -12
+KPX U i -22
+KPX U h -6
+KPX U g -40
+KPX U f -20
+KPX U d -40
+KPX U c -40
+KPX U b -12
+KPX U a -50
+KPX U A -50
+
+KPX V y -36
+KPX V u -50
+KPX V semicolon -45
+KPX V r -75
+KPX V quoteright 50
+KPX V quotedblright 36
+KPX V period -135
+KPX V parenright 80
+KPX V o -70
+KPX V i 20
+KPX V hyphen -90
+KPX V emdash -20
+KPX V e -70
+KPX V comma -135
+KPX V colon -45
+KPX V bracketright 80
+KPX V braceright 80
+KPX V a -70
+KPX V Q -20
+KPX V O -20
+KPX V G -20
+KPX V C -20
+KPX V A -60
+
+KPX W y -50
+KPX W u -46
+KPX W t -30
+KPX W semicolon -40
+KPX W r -50
+KPX W quoteright 40
+KPX W quotedblright 24
+KPX W period -100
+KPX W parenright 80
+KPX W o -60
+KPX W m -50
+KPX W i 5
+KPX W hyphen -70
+KPX W h 20
+KPX W e -60
+KPX W d -60
+KPX W comma -100
+KPX W colon -40
+KPX W bracketright 80
+KPX W braceright 70
+KPX W a -75
+KPX W T 30
+KPX W Q -20
+KPX W O -20
+KPX W G -20
+KPX W C -20
+KPX W A -58
+
+KPX X y -40
+KPX X u -24
+KPX X quoteright 15
+KPX X e -6
+KPX X a -6
+KPX X Q -24
+KPX X O -30
+KPX X G -30
+KPX X C -30
+KPX X A 20
+
+KPX Y v -50
+KPX Y u -65
+KPX Y t -46
+KPX Y semicolon -37
+KPX Y quoteright 50
+KPX Y quotedblright 36
+KPX Y q -100
+KPX Y period -90
+KPX Y parenright 60
+KPX Y o -90
+KPX Y l 25
+KPX Y i 15
+KPX Y hyphen -100
+KPX Y endash -30
+KPX Y emdash -50
+KPX Y e -90
+KPX Y d -90
+KPX Y comma -90
+KPX Y colon -60
+KPX Y bracketright 80
+KPX Y braceright 64
+KPX Y a -80
+KPX Y Y 12
+KPX Y X 12
+KPX Y W 12
+KPX Y V 12
+KPX Y T 30
+KPX Y Q -40
+KPX Y O -40
+KPX Y G -40
+KPX Y C -40
+KPX Y A -55
+
+KPX Z y -36
+KPX Z w -36
+KPX Z u -6
+KPX Z o -12
+KPX Z i -12
+KPX Z e -6
+KPX Z a -6
+KPX Z Q -18
+KPX Z O -18
+KPX Z G -18
+KPX Z C -18
+KPX Z A 25
+
+KPX a quoteright -45
+KPX a quotedblright -40
+
+KPX b y -15
+KPX b w -20
+KPX b v -20
+KPX b quoteright -45
+KPX b quotedblright -40
+KPX b period -10
+KPX b comma -10
+
+KPX braceleft Y 64
+KPX braceleft W 64
+KPX braceleft V 64
+KPX braceleft T 25
+KPX braceleft J 50
+
+KPX bracketleft Y 64
+KPX bracketleft W 64
+KPX bracketleft V 64
+KPX bracketleft T 35
+KPX bracketleft J 60
+
+KPX c quoteright -5
+
+KPX colon space -20
+
+KPX comma space -40
+KPX comma quoteright -100
+KPX comma quotedblright -100
+
+KPX d quoteright -24
+KPX d quotedblright -24
+
+KPX e z -4
+KPX e quoteright -25
+KPX e quotedblright -20
+
+KPX f quotesingle 70
+KPX f quoteright 68
+KPX f quotedblright 68
+KPX f period -10
+KPX f parenright 110
+KPX f comma -20
+KPX f bracketright 100
+KPX f braceright 80
+
+KPX g y 20
+KPX g p 20
+KPX g f 20
+KPX g comma 10
+
+KPX h quoteright -60
+KPX h quotedblright -60
+
+KPX i quoteright -20
+KPX i quotedblright -20
+
+KPX j quoteright -20
+KPX j quotedblright -20
+KPX j period -10
+KPX j comma -10
+
+KPX k quoteright -30
+KPX k quotedblright -30
+
+KPX l quoteright -24
+KPX l quotedblright -24
+
+KPX m quoteright -60
+KPX m quotedblright -60
+
+KPX n quoteright -60
+KPX n quotedblright -60
+
+KPX o z -12
+KPX o y -25
+KPX o x -18
+KPX o w -30
+KPX o v -30
+KPX o quoteright -45
+KPX o quotedblright -40
+KPX o period -10
+KPX o comma -10
+
+KPX p z -10
+KPX p y -15
+KPX p w -15
+KPX p quoteright -45
+KPX p quotedblright -60
+KPX p period -10
+KPX p comma -10
+
+KPX parenleft Y 64
+KPX parenleft W 64
+KPX parenleft V 64
+KPX parenleft T 50
+KPX parenleft J 50
+
+KPX period space -40
+KPX period quoteright -100
+KPX period quotedblright -100
+
+KPX q quoteright -50
+KPX q quotedblright -50
+KPX q period -10
+KPX q comma -10
+
+KPX quotedblleft z -26
+KPX quotedblleft w 10
+KPX quotedblleft u -40
+KPX quotedblleft t -40
+KPX quotedblleft s -32
+KPX quotedblleft r -40
+KPX quotedblleft q -70
+KPX quotedblleft p -40
+KPX quotedblleft o -70
+KPX quotedblleft n -40
+KPX quotedblleft m -40
+KPX quotedblleft g -50
+KPX quotedblleft f -30
+KPX quotedblleft e -70
+KPX quotedblleft d -70
+KPX quotedblleft c -70
+KPX quotedblleft a -60
+KPX quotedblleft Y 30
+KPX quotedblleft X 20
+KPX quotedblleft W 40
+KPX quotedblleft V 40
+KPX quotedblleft T 18
+KPX quotedblleft J -24
+KPX quotedblleft A -122
+
+KPX quotedblright space -40
+KPX quotedblright period -100
+KPX quotedblright comma -100
+
+KPX quoteleft z -26
+KPX quoteleft y -5
+KPX quoteleft x -5
+KPX quoteleft w 5
+KPX quoteleft v -5
+KPX quoteleft u -25
+KPX quoteleft t -25
+KPX quoteleft s -40
+KPX quoteleft r -40
+KPX quoteleft quoteleft -30
+KPX quoteleft q -70
+KPX quoteleft p -40
+KPX quoteleft o -70
+KPX quoteleft n -40
+KPX quoteleft m -40
+KPX quoteleft g -50
+KPX quoteleft f -10
+KPX quoteleft e -70
+KPX quoteleft d -70
+KPX quoteleft c -70
+KPX quoteleft a -60
+KPX quoteleft Y 35
+KPX quoteleft X 30
+KPX quoteleft W 35
+KPX quoteleft V 35
+KPX quoteleft T 35
+KPX quoteleft J -24
+KPX quoteleft A -122
+
+KPX quoteright v -20
+KPX quoteright t -50
+KPX quoteright space -40
+KPX quoteright s -70
+KPX quoteright r -42
+KPX quoteright quoteright -30
+KPX quoteright period -100
+KPX quoteright m -42
+KPX quoteright l -6
+KPX quoteright d -100
+KPX quoteright comma -100
+
+KPX r z 20
+KPX r y 18
+KPX r x 12
+KPX r w 30
+KPX r v 30
+KPX r u 8
+KPX r t 8
+KPX r semicolon 20
+KPX r quoteright -20
+KPX r quotedblright -10
+KPX r q -6
+KPX r period -60
+KPX r o -6
+KPX r n 8
+KPX r m 8
+KPX r l -10
+KPX r k -10
+KPX r i 8
+KPX r hyphen -60
+KPX r h -10
+KPX r g 5
+KPX r f 8
+KPX r emdash -20
+KPX r e -20
+KPX r d -20
+KPX r comma -80
+KPX r colon 20
+KPX r c -20
+
+KPX s quoteright -40
+KPX s quotedblright -40
+
+KPX semicolon space -20
+
+KPX space quotesinglbase -100
+KPX space quoteleft -40
+KPX space quotedblleft -40
+KPX space quotedblbase -100
+KPX space Y -60
+KPX space W -60
+KPX space V -60
+KPX space T -40
+
+KPX t period 15
+KPX t comma 10
+
+KPX u quoteright -60
+KPX u quotedblright -60
+
+KPX v semicolon 20
+KPX v quoteright 5
+KPX v quotedblright 10
+KPX v q -15
+KPX v period -75
+KPX v o -15
+KPX v e -15
+KPX v d -15
+KPX v comma -90
+KPX v colon 20
+KPX v c -15
+KPX v a -15
+
+KPX w semicolon 20
+KPX w quoteright 15
+KPX w quotedblright 20
+KPX w q -10
+KPX w period -60
+KPX w o -10
+KPX w e -10
+KPX w d -10
+KPX w comma -68
+KPX w colon 20
+KPX w c -10
+
+KPX x quoteright -25
+KPX x quotedblright -20
+KPX x q -6
+KPX x o -6
+KPX x e -12
+KPX x d -12
+KPX x c -12
+
+KPX y semicolon 20
+KPX y quoteright 5
+KPX y quotedblright 10
+KPX y period -72
+KPX y hyphen -20
+KPX y comma -72
+KPX y colon 20
+
+KPX z quoteright -20
+KPX z quotedblright -20
+KPX z o -6
+KPX z e -6
+KPX z d -6
+KPX z c -6
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/putbi8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/putbi8a.afm
new file mode 100644
index 0000000..5e83848
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/putbi8a.afm
@@ -0,0 +1,1017 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Fri Jan 17 15:47:44 1992
+Comment UniqueID 37716
+Comment VMusage 34427 41319
+FontName Utopia-BoldItalic
+FullName Utopia Bold Italic
+FamilyName Utopia
+Weight Bold
+ItalicAngle -13
+IsFixedPitch false
+FontBBox -176 -250 1262 916
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.002
+Notice Copyright (c) 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.Utopia is a registered trademark of Adobe Systems Incorporated.
+EncodingScheme AdobeStandardEncoding
+CapHeight 692
+XHeight 502
+Ascender 742
+Descender -242
+StartCharMetrics 228
+C 32 ; WX 210 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 285 ; N exclam ; B 35 -12 336 707 ;
+C 34 ; WX 455 ; N quotedbl ; B 142 407 496 707 ;
+C 35 ; WX 560 ; N numbersign ; B 37 0 606 668 ;
+C 36 ; WX 560 ; N dollar ; B 32 -104 588 748 ;
+C 37 ; WX 896 ; N percent ; B 106 -31 861 702 ;
+C 38 ; WX 752 ; N ampersand ; B 62 -12 736 680 ;
+C 39 ; WX 246 ; N quoteright ; B 95 387 294 707 ;
+C 40 ; WX 350 ; N parenleft ; B 87 -135 438 699 ;
+C 41 ; WX 350 ; N parenright ; B -32 -135 319 699 ;
+C 42 ; WX 500 ; N asterisk ; B 121 315 528 707 ;
+C 43 ; WX 600 ; N plus ; B 83 0 567 490 ;
+C 44 ; WX 280 ; N comma ; B -9 -167 207 180 ;
+C 45 ; WX 392 ; N hyphen ; B 71 203 354 298 ;
+C 46 ; WX 280 ; N period ; B 32 -12 212 166 ;
+C 47 ; WX 260 ; N slash ; B -16 -15 370 707 ;
+C 48 ; WX 560 ; N zero ; B 57 -12 583 680 ;
+C 49 ; WX 560 ; N one ; B 72 0 470 680 ;
+C 50 ; WX 560 ; N two ; B 4 0 578 680 ;
+C 51 ; WX 560 ; N three ; B 21 -12 567 680 ;
+C 52 ; WX 560 ; N four ; B 28 0 557 668 ;
+C 53 ; WX 560 ; N five ; B 23 -12 593 668 ;
+C 54 ; WX 560 ; N six ; B 56 -12 586 680 ;
+C 55 ; WX 560 ; N seven ; B 112 -12 632 668 ;
+C 56 ; WX 560 ; N eight ; B 37 -12 584 680 ;
+C 57 ; WX 560 ; N nine ; B 48 -12 570 680 ;
+C 58 ; WX 280 ; N colon ; B 32 -12 280 490 ;
+C 59 ; WX 280 ; N semicolon ; B -9 -167 280 490 ;
+C 60 ; WX 600 ; N less ; B 66 5 544 495 ;
+C 61 ; WX 600 ; N equal ; B 83 103 567 397 ;
+C 62 ; WX 600 ; N greater ; B 86 5 564 495 ;
+C 63 ; WX 454 ; N question ; B 115 -12 515 707 ;
+C 64 ; WX 828 ; N at ; B 90 -15 842 707 ;
+C 65 ; WX 634 ; N A ; B -59 0 639 692 ;
+C 66 ; WX 680 ; N B ; B 5 0 689 692 ;
+C 67 ; WX 672 ; N C ; B 76 -15 742 707 ;
+C 68 ; WX 774 ; N D ; B 5 0 784 692 ;
+C 69 ; WX 622 ; N E ; B 5 0 687 692 ;
+C 70 ; WX 585 ; N F ; B 5 0 683 692 ;
+C 71 ; WX 726 ; N G ; B 76 -15 756 707 ;
+C 72 ; WX 800 ; N H ; B 5 0 880 692 ;
+C 73 ; WX 386 ; N I ; B 5 0 466 692 ;
+C 74 ; WX 388 ; N J ; B -50 -114 477 692 ;
+C 75 ; WX 688 ; N K ; B 5 -6 823 692 ;
+C 76 ; WX 586 ; N L ; B 5 0 591 692 ;
+C 77 ; WX 921 ; N M ; B 0 0 998 692 ;
+C 78 ; WX 741 ; N N ; B -5 0 838 692 ;
+C 79 ; WX 761 ; N O ; B 78 -15 768 707 ;
+C 80 ; WX 660 ; N P ; B 5 0 694 692 ;
+C 81 ; WX 761 ; N Q ; B 78 -193 768 707 ;
+C 82 ; WX 681 ; N R ; B 5 0 696 692 ;
+C 83 ; WX 551 ; N S ; B 31 -15 570 707 ;
+C 84 ; WX 616 ; N T ; B 91 0 722 692 ;
+C 85 ; WX 776 ; N U ; B 115 -15 867 692 ;
+C 86 ; WX 630 ; N V ; B 92 0 783 692 ;
+C 87 ; WX 920 ; N W ; B 80 0 1062 692 ;
+C 88 ; WX 630 ; N X ; B -56 0 744 692 ;
+C 89 ; WX 622 ; N Y ; B 92 0 765 692 ;
+C 90 ; WX 618 ; N Z ; B -30 0 714 692 ;
+C 91 ; WX 350 ; N bracketleft ; B 56 -128 428 692 ;
+C 92 ; WX 460 ; N backslash ; B 114 -15 425 707 ;
+C 93 ; WX 350 ; N bracketright ; B -22 -128 350 692 ;
+C 94 ; WX 600 ; N asciicircum ; B 79 215 567 668 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 246 ; N quoteleft ; B 114 399 313 719 ;
+C 97 ; WX 596 ; N a ; B 26 -12 612 502 ;
+C 98 ; WX 586 ; N b ; B 34 -12 592 742 ;
+C 99 ; WX 456 ; N c ; B 38 -12 498 502 ;
+C 100 ; WX 609 ; N d ; B 29 -12 651 742 ;
+C 101 ; WX 476 ; N e ; B 38 -12 497 502 ;
+C 102 ; WX 348 ; N f ; B -129 -242 553 742 ; L i fi ; L l fl ;
+C 103 ; WX 522 ; N g ; B -14 -242 609 512 ;
+C 104 ; WX 629 ; N h ; B 44 -12 631 742 ;
+C 105 ; WX 339 ; N i ; B 66 -12 357 720 ;
+C 106 ; WX 333 ; N j ; B -120 -242 364 720 ;
+C 107 ; WX 570 ; N k ; B 39 -12 604 742 ;
+C 108 ; WX 327 ; N l ; B 62 -12 360 742 ;
+C 109 ; WX 914 ; N m ; B 46 -12 917 502 ;
+C 110 ; WX 635 ; N n ; B 45 -12 639 502 ;
+C 111 ; WX 562 ; N o ; B 42 -12 556 502 ;
+C 112 ; WX 606 ; N p ; B 0 -242 613 502 ;
+C 113 ; WX 584 ; N q ; B 29 -242 604 513 ;
+C 114 ; WX 440 ; N r ; B 51 -12 497 502 ;
+C 115 ; WX 417 ; N s ; B 10 -12 432 502 ;
+C 116 ; WX 359 ; N t ; B 68 -12 428 641 ;
+C 117 ; WX 634 ; N u ; B 71 -12 643 502 ;
+C 118 ; WX 518 ; N v ; B 68 -12 547 502 ;
+C 119 ; WX 795 ; N w ; B 70 -12 826 502 ;
+C 120 ; WX 516 ; N x ; B -26 -12 546 502 ;
+C 121 ; WX 489 ; N y ; B -49 -242 532 502 ;
+C 122 ; WX 466 ; N z ; B -17 -12 506 490 ;
+C 123 ; WX 340 ; N braceleft ; B 90 -128 439 692 ;
+C 124 ; WX 265 ; N bar ; B 117 -250 221 750 ;
+C 125 ; WX 340 ; N braceright ; B -42 -128 307 692 ;
+C 126 ; WX 600 ; N asciitilde ; B 70 157 571 338 ;
+C 161 ; WX 285 ; N exclamdown ; B -13 -217 288 502 ;
+C 162 ; WX 560 ; N cent ; B 80 -21 611 668 ;
+C 163 ; WX 560 ; N sterling ; B -4 0 583 679 ;
+C 164 ; WX 100 ; N fraction ; B -176 -27 370 695 ;
+C 165 ; WX 560 ; N yen ; B 65 0 676 668 ;
+C 166 ; WX 560 ; N florin ; B -16 -135 635 691 ;
+C 167 ; WX 568 ; N section ; B 64 -115 559 707 ;
+C 168 ; WX 560 ; N currency ; B 60 73 578 596 ;
+C 169 ; WX 246 ; N quotesingle ; B 134 376 285 707 ;
+C 170 ; WX 455 ; N quotedblleft ; B 114 399 522 719 ;
+C 171 ; WX 560 ; N guillemotleft ; B 90 37 533 464 ;
+C 172 ; WX 360 ; N guilsinglleft ; B 90 37 333 464 ;
+C 173 ; WX 360 ; N guilsinglright ; B 58 37 301 464 ;
+C 174 ; WX 651 ; N fi ; B -129 -242 655 742 ;
+C 175 ; WX 652 ; N fl ; B -129 -242 685 742 ;
+C 177 ; WX 500 ; N endash ; B 12 209 531 292 ;
+C 178 ; WX 514 ; N dagger ; B 101 -125 545 707 ;
+C 179 ; WX 490 ; N daggerdbl ; B 32 -119 528 707 ;
+C 180 ; WX 280 ; N periodcentered ; B 67 161 247 339 ;
+C 182 ; WX 580 ; N paragraph ; B 110 -101 653 692 ;
+C 183 ; WX 465 ; N bullet ; B 99 174 454 529 ;
+C 184 ; WX 246 ; N quotesinglbase ; B -17 -153 182 167 ;
+C 185 ; WX 455 ; N quotedblbase ; B -17 -153 391 167 ;
+C 186 ; WX 455 ; N quotedblright ; B 95 387 503 707 ;
+C 187 ; WX 560 ; N guillemotright ; B 58 37 502 464 ;
+C 188 ; WX 1000 ; N ellipsis ; B 85 -12 931 166 ;
+C 189 ; WX 1297 ; N perthousand ; B 106 -31 1262 702 ;
+C 191 ; WX 454 ; N questiondown ; B -10 -217 391 502 ;
+C 193 ; WX 400 ; N grave ; B 109 511 381 740 ;
+C 194 ; WX 400 ; N acute ; B 186 511 458 740 ;
+C 195 ; WX 400 ; N circumflex ; B 93 520 471 747 ;
+C 196 ; WX 400 ; N tilde ; B 94 549 502 697 ;
+C 197 ; WX 400 ; N macron ; B 133 592 459 664 ;
+C 198 ; WX 400 ; N breve ; B 146 556 469 714 ;
+C 199 ; WX 402 ; N dotaccent ; B 220 561 378 710 ;
+C 200 ; WX 400 ; N dieresis ; B 106 561 504 710 ;
+C 202 ; WX 400 ; N ring ; B 166 529 423 762 ;
+C 203 ; WX 400 ; N cedilla ; B 85 -246 292 0 ;
+C 205 ; WX 400 ; N hungarumlaut ; B 158 546 482 750 ;
+C 206 ; WX 350 ; N ogonek ; B 38 -246 253 0 ;
+C 207 ; WX 400 ; N caron ; B 130 520 508 747 ;
+C 208 ; WX 1000 ; N emdash ; B 12 209 1031 292 ;
+C 225 ; WX 890 ; N AE ; B -107 0 958 692 ;
+C 227 ; WX 444 ; N ordfeminine ; B 62 265 482 590 ;
+C 232 ; WX 592 ; N Lslash ; B 11 0 597 692 ;
+C 233 ; WX 761 ; N Oslash ; B 77 -51 769 734 ;
+C 234 ; WX 1016 ; N OE ; B 76 0 1084 692 ;
+C 235 ; WX 412 ; N ordmasculine ; B 86 265 446 590 ;
+C 241 ; WX 789 ; N ae ; B 26 -12 810 509 ;
+C 245 ; WX 339 ; N dotlessi ; B 66 -12 343 502 ;
+C 248 ; WX 339 ; N lslash ; B 18 -12 420 742 ;
+C 249 ; WX 562 ; N oslash ; B 42 -69 556 549 ;
+C 250 ; WX 811 ; N oe ; B 42 -12 832 502 ;
+C 251 ; WX 628 ; N germandbls ; B -129 -242 692 742 ;
+C -1 ; WX 402 ; N onesuperior ; B 84 272 361 680 ;
+C -1 ; WX 600 ; N minus ; B 83 210 567 290 ;
+C -1 ; WX 375 ; N degree ; B 93 360 425 680 ;
+C -1 ; WX 562 ; N oacute ; B 42 -12 572 755 ;
+C -1 ; WX 761 ; N Odieresis ; B 78 -15 768 881 ;
+C -1 ; WX 562 ; N odieresis ; B 42 -12 585 710 ;
+C -1 ; WX 622 ; N Eacute ; B 5 0 687 904 ;
+C -1 ; WX 634 ; N ucircumflex ; B 71 -12 643 747 ;
+C -1 ; WX 940 ; N onequarter ; B 104 -27 849 695 ;
+C -1 ; WX 600 ; N logicalnot ; B 83 95 567 397 ;
+C -1 ; WX 622 ; N Ecircumflex ; B 5 0 687 905 ;
+C -1 ; WX 940 ; N onehalf ; B 90 -27 898 695 ;
+C -1 ; WX 761 ; N Otilde ; B 78 -15 768 876 ;
+C -1 ; WX 634 ; N uacute ; B 71 -12 643 740 ;
+C -1 ; WX 476 ; N eacute ; B 38 -12 545 755 ;
+C -1 ; WX 339 ; N iacute ; B 66 -12 438 740 ;
+C -1 ; WX 622 ; N Egrave ; B 5 0 687 904 ;
+C -1 ; WX 339 ; N icircumflex ; B 38 -12 416 747 ;
+C -1 ; WX 634 ; N mu ; B -3 -230 643 502 ;
+C -1 ; WX 265 ; N brokenbar ; B 117 -175 221 675 ;
+C -1 ; WX 600 ; N thorn ; B -6 -242 607 700 ;
+C -1 ; WX 634 ; N Aring ; B -59 0 639 879 ;
+C -1 ; WX 489 ; N yacute ; B -49 -242 553 740 ;
+C -1 ; WX 622 ; N Ydieresis ; B 92 0 765 881 ;
+C -1 ; WX 1100 ; N trademark ; B 103 277 1093 692 ;
+C -1 ; WX 824 ; N registered ; B 91 -15 819 707 ;
+C -1 ; WX 562 ; N ocircumflex ; B 42 -12 556 747 ;
+C -1 ; WX 634 ; N Agrave ; B -59 0 639 904 ;
+C -1 ; WX 551 ; N Scaron ; B 31 -15 612 916 ;
+C -1 ; WX 776 ; N Ugrave ; B 115 -15 867 904 ;
+C -1 ; WX 622 ; N Edieresis ; B 5 0 687 881 ;
+C -1 ; WX 776 ; N Uacute ; B 115 -15 867 904 ;
+C -1 ; WX 562 ; N otilde ; B 42 -12 583 697 ;
+C -1 ; WX 635 ; N ntilde ; B 45 -12 639 697 ;
+C -1 ; WX 489 ; N ydieresis ; B -49 -242 532 710 ;
+C -1 ; WX 634 ; N Aacute ; B -59 0 678 904 ;
+C -1 ; WX 562 ; N eth ; B 42 -12 558 742 ;
+C -1 ; WX 596 ; N acircumflex ; B 26 -12 612 747 ;
+C -1 ; WX 596 ; N aring ; B 26 -12 612 762 ;
+C -1 ; WX 761 ; N Ograve ; B 78 -15 768 904 ;
+C -1 ; WX 456 ; N ccedilla ; B 38 -246 498 502 ;
+C -1 ; WX 600 ; N multiply ; B 110 22 560 478 ;
+C -1 ; WX 600 ; N divide ; B 63 7 547 493 ;
+C -1 ; WX 402 ; N twosuperior ; B 29 272 423 680 ;
+C -1 ; WX 741 ; N Ntilde ; B -5 0 838 876 ;
+C -1 ; WX 634 ; N ugrave ; B 71 -12 643 740 ;
+C -1 ; WX 776 ; N Ucircumflex ; B 115 -15 867 905 ;
+C -1 ; WX 634 ; N Atilde ; B -59 0 662 876 ;
+C -1 ; WX 466 ; N zcaron ; B -17 -12 526 747 ;
+C -1 ; WX 339 ; N idieresis ; B 46 -12 444 710 ;
+C -1 ; WX 634 ; N Acircumflex ; B -59 0 639 905 ;
+C -1 ; WX 386 ; N Icircumflex ; B 5 0 506 905 ;
+C -1 ; WX 622 ; N Yacute ; B 92 0 765 904 ;
+C -1 ; WX 761 ; N Oacute ; B 78 -15 768 904 ;
+C -1 ; WX 634 ; N Adieresis ; B -59 0 652 881 ;
+C -1 ; WX 618 ; N Zcaron ; B -30 0 714 916 ;
+C -1 ; WX 596 ; N agrave ; B 26 -12 612 755 ;
+C -1 ; WX 402 ; N threesuperior ; B 59 265 421 680 ;
+C -1 ; WX 562 ; N ograve ; B 42 -12 556 755 ;
+C -1 ; WX 940 ; N threequarters ; B 95 -27 876 695 ;
+C -1 ; WX 780 ; N Eth ; B 11 0 790 692 ;
+C -1 ; WX 600 ; N plusminus ; B 83 0 567 549 ;
+C -1 ; WX 634 ; N udieresis ; B 71 -12 643 710 ;
+C -1 ; WX 476 ; N edieresis ; B 38 -12 542 710 ;
+C -1 ; WX 596 ; N aacute ; B 26 -12 621 755 ;
+C -1 ; WX 339 ; N igrave ; B 39 -12 343 740 ;
+C -1 ; WX 386 ; N Idieresis ; B 5 0 533 881 ;
+C -1 ; WX 596 ; N adieresis ; B 26 -12 612 710 ;
+C -1 ; WX 386 ; N Iacute ; B 5 0 549 904 ;
+C -1 ; WX 824 ; N copyright ; B 91 -15 819 707 ;
+C -1 ; WX 386 ; N Igrave ; B 5 0 466 904 ;
+C -1 ; WX 672 ; N Ccedilla ; B 76 -246 742 707 ;
+C -1 ; WX 417 ; N scaron ; B 10 -12 522 747 ;
+C -1 ; WX 476 ; N egrave ; B 38 -12 497 755 ;
+C -1 ; WX 761 ; N Ocircumflex ; B 78 -15 768 905 ;
+C -1 ; WX 629 ; N Thorn ; B 5 0 660 692 ;
+C -1 ; WX 596 ; N atilde ; B 26 -12 612 697 ;
+C -1 ; WX 776 ; N Udieresis ; B 115 -15 867 881 ;
+C -1 ; WX 476 ; N ecircumflex ; B 38 -12 524 747 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 697
+
+KPX A z 18
+KPX A y -40
+KPX A x 16
+KPX A w -30
+KPX A v -30
+KPX A u -18
+KPX A t -6
+KPX A s 6
+KPX A r -6
+KPX A quoteright -92
+KPX A quotedblright -92
+KPX A p -6
+KPX A o -18
+KPX A n -12
+KPX A m -12
+KPX A l -18
+KPX A h -6
+KPX A d 4
+KPX A c -6
+KPX A b -6
+KPX A a 10
+KPX A Y -56
+KPX A X -8
+KPX A W -46
+KPX A V -75
+KPX A U -50
+KPX A T -60
+KPX A Q -30
+KPX A O -30
+KPX A G -30
+KPX A C -30
+
+KPX B y -6
+KPX B u -12
+KPX B r -6
+KPX B quoteright -20
+KPX B quotedblright -32
+KPX B o 6
+KPX B l -20
+KPX B k -10
+KPX B i -12
+KPX B h -15
+KPX B e 4
+KPX B a 10
+KPX B W -30
+KPX B V -45
+KPX B U -30
+KPX B T -20
+
+KPX C z -6
+KPX C y -18
+KPX C u -12
+KPX C r -12
+KPX C quoteright 12
+KPX C quotedblright 20
+KPX C i -6
+KPX C e -6
+KPX C a -6
+KPX C Q -12
+KPX C O -12
+KPX C G -12
+KPX C C -12
+
+KPX D y 18
+KPX D quoteright -20
+KPX D quotedblright -20
+KPX D period -20
+KPX D o 6
+KPX D h -15
+KPX D e 6
+KPX D comma -20
+KPX D a 6
+KPX D Y -80
+KPX D W -40
+KPX D V -65
+
+KPX E z -6
+KPX E y -24
+KPX E x 15
+KPX E w -30
+KPX E v -18
+KPX E u -24
+KPX E t -18
+KPX E s -6
+KPX E r -6
+KPX E quoteright 10
+KPX E q 10
+KPX E period 15
+KPX E p -12
+KPX E n -12
+KPX E m -12
+KPX E l -6
+KPX E j -6
+KPX E i -12
+KPX E g -12
+KPX E d 10
+KPX E comma 15
+KPX E a 10
+
+KPX F y -12
+KPX F u -24
+KPX F r -12
+KPX F quoteright 40
+KPX F quotedblright 35
+KPX F period -120
+KPX F o -24
+KPX F i -6
+KPX F e -24
+KPX F comma -110
+KPX F a -30
+KPX F A -45
+
+KPX G y -25
+KPX G u -22
+KPX G r -22
+KPX G quoteright -30
+KPX G quotedblright -30
+KPX G n -22
+KPX G l -24
+KPX G i -12
+KPX G h -18
+KPX G e 5
+
+KPX H y -18
+KPX H u -30
+KPX H o -25
+KPX H i -25
+KPX H e -25
+KPX H a -25
+
+KPX I z -20
+KPX I y -6
+KPX I x -6
+KPX I w -30
+KPX I v -30
+KPX I u -30
+KPX I t -18
+KPX I s -18
+KPX I r -12
+KPX I p -18
+KPX I o -25
+KPX I n -18
+KPX I m -18
+KPX I l -6
+KPX I k -6
+KPX I j -20
+KPX I i -10
+KPX I g -24
+KPX I f -6
+KPX I e -25
+KPX I d -15
+KPX I c -25
+KPX I b -6
+KPX I a -15
+
+KPX J y -12
+KPX J u -32
+KPX J quoteright 6
+KPX J quotedblright 6
+KPX J o -36
+KPX J i -30
+KPX J e -30
+KPX J braceright 15
+KPX J a -36
+
+KPX K y -70
+KPX K w -36
+KPX K v -30
+KPX K u -30
+KPX K r -24
+KPX K quoteright 36
+KPX K quotedblright 36
+KPX K o -30
+KPX K n -24
+KPX K l 10
+KPX K i -12
+KPX K h 15
+KPX K e -30
+KPX K a -12
+KPX K Q -50
+KPX K O -50
+KPX K G -50
+KPX K C -50
+KPX K A 15
+
+KPX L y -70
+KPX L w -30
+KPX L u -18
+KPX L quoteright -110
+KPX L quotedblright -110
+KPX L l -16
+KPX L j -18
+KPX L i -18
+KPX L Y -80
+KPX L W -78
+KPX L V -110
+KPX L U -42
+KPX L T -100
+KPX L Q -48
+KPX L O -48
+KPX L G -48
+KPX L C -48
+KPX L A 40
+
+KPX M y -18
+KPX M u -24
+KPX M quoteright 6
+KPX M quotedblright 6
+KPX M o -25
+KPX M n -20
+KPX M j -35
+KPX M i -20
+KPX M e -25
+KPX M d -20
+KPX M c -25
+KPX M a -20
+
+KPX N y -18
+KPX N u -24
+KPX N o -18
+KPX N i -12
+KPX N e -16
+KPX N a -22
+
+KPX O z -6
+KPX O y 12
+KPX O u -6
+KPX O t -6
+KPX O s -6
+KPX O r -6
+KPX O quoteright -20
+KPX O quotedblright -20
+KPX O q 6
+KPX O period -10
+KPX O p -6
+KPX O n -6
+KPX O m -6
+KPX O l -15
+KPX O k -10
+KPX O j -6
+KPX O h -10
+KPX O g -6
+KPX O e 6
+KPX O d 6
+KPX O comma -10
+KPX O a 6
+KPX O Y -70
+KPX O X -30
+KPX O W -35
+KPX O V -50
+KPX O T -42
+KPX O A -8
+
+KPX P y 6
+KPX P u -18
+KPX P t -6
+KPX P s -24
+KPX P r -6
+KPX P quoteright -12
+KPX P period -170
+KPX P o -24
+KPX P n -12
+KPX P l -20
+KPX P h -20
+KPX P e -24
+KPX P comma -170
+KPX P a -40
+KPX P I -45
+KPX P H -45
+KPX P E -45
+KPX P A -70
+
+KPX Q u -6
+KPX Q quoteright -20
+KPX Q quotedblright -38
+KPX Q a -6
+KPX Q Y -70
+KPX Q X -12
+KPX Q W -35
+KPX Q V -50
+KPX Q U -30
+KPX Q T -36
+KPX Q A -18
+
+KPX R y -6
+KPX R u -12
+KPX R quoteright -22
+KPX R quotedblright -22
+KPX R o -20
+KPX R e -12
+KPX R Y -45
+KPX R X 15
+KPX R W -25
+KPX R V -35
+KPX R U -40
+KPX R T -18
+KPX R Q -8
+KPX R O -8
+KPX R G -8
+KPX R C -8
+KPX R A 15
+
+KPX S y -30
+KPX S w -30
+KPX S v -20
+KPX S u -18
+KPX S t -18
+KPX S r -20
+KPX S quoteright -38
+KPX S quotedblright -50
+KPX S p -18
+KPX S n -24
+KPX S m -24
+KPX S l -20
+KPX S k -18
+KPX S j -25
+KPX S i -20
+KPX S h -12
+KPX S e -6
+
+KPX T z -48
+KPX T y -52
+KPX T w -54
+KPX T u -54
+KPX T semicolon -6
+KPX T s -60
+KPX T r -54
+KPX T quoteright 36
+KPX T quotedblright 36
+KPX T period -70
+KPX T parenright 25
+KPX T o -78
+KPX T m -54
+KPX T i -22
+KPX T hyphen -100
+KPX T h 6
+KPX T endash -40
+KPX T emdash -40
+KPX T e -78
+KPX T comma -90
+KPX T bracketright 20
+KPX T braceright 30
+KPX T a -78
+KPX T Y 12
+KPX T X 18
+KPX T W 30
+KPX T V 20
+KPX T T 40
+KPX T Q -6
+KPX T O -6
+KPX T G -6
+KPX T C -6
+KPX T A -40
+
+KPX U z -18
+KPX U x -30
+KPX U v -20
+KPX U t -24
+KPX U s -40
+KPX U r -30
+KPX U p -30
+KPX U n -30
+KPX U m -30
+KPX U l -12
+KPX U k -12
+KPX U i -24
+KPX U h -6
+KPX U g -30
+KPX U f -10
+KPX U d -30
+KPX U c -30
+KPX U b -6
+KPX U a -30
+KPX U A -40
+
+KPX V y -34
+KPX V u -42
+KPX V semicolon -45
+KPX V r -55
+KPX V quoteright 46
+KPX V quotedblright 60
+KPX V period -110
+KPX V parenright 64
+KPX V o -55
+KPX V i 15
+KPX V hyphen -60
+KPX V endash -20
+KPX V emdash -20
+KPX V e -55
+KPX V comma -110
+KPX V colon -18
+KPX V bracketright 64
+KPX V braceright 64
+KPX V a -80
+KPX V T 12
+KPX V A -70
+
+KPX W y -36
+KPX W u -30
+KPX W t -10
+KPX W semicolon -12
+KPX W r -30
+KPX W quoteright 42
+KPX W quotedblright 55
+KPX W period -80
+KPX W parenright 55
+KPX W o -55
+KPX W m -30
+KPX W i 5
+KPX W hyphen -40
+KPX W h 16
+KPX W e -55
+KPX W d -60
+KPX W comma -80
+KPX W colon -12
+KPX W bracketright 64
+KPX W braceright 64
+KPX W a -60
+KPX W T 30
+KPX W Q -5
+KPX W O -5
+KPX W G -5
+KPX W C -5
+KPX W A -45
+
+KPX X y -40
+KPX X u -30
+KPX X r -6
+KPX X quoteright 24
+KPX X quotedblright 40
+KPX X i -6
+KPX X e -18
+KPX X a -6
+KPX X Y -6
+KPX X W -6
+KPX X Q -45
+KPX X O -45
+KPX X G -45
+KPX X C -45
+
+KPX Y v -60
+KPX Y u -70
+KPX Y t -32
+KPX Y semicolon -20
+KPX Y quoteright 56
+KPX Y quotedblright 70
+KPX Y q -100
+KPX Y period -80
+KPX Y parenright 5
+KPX Y o -95
+KPX Y l 15
+KPX Y i 15
+KPX Y hyphen -110
+KPX Y endash -40
+KPX Y emdash -40
+KPX Y e -95
+KPX Y d -85
+KPX Y comma -80
+KPX Y colon -20
+KPX Y bracketright 64
+KPX Y braceright 64
+KPX Y a -85
+KPX Y Y 12
+KPX Y X 12
+KPX Y W 12
+KPX Y V 6
+KPX Y T 30
+KPX Y Q -25
+KPX Y O -25
+KPX Y G -25
+KPX Y C -25
+KPX Y A -40
+
+KPX Z y -36
+KPX Z w -36
+KPX Z u -12
+KPX Z quoteright 18
+KPX Z quotedblright 18
+KPX Z o -6
+KPX Z i -12
+KPX Z e -6
+KPX Z a -6
+KPX Z Q -20
+KPX Z O -20
+KPX Z G -20
+KPX Z C -20
+KPX Z A 30
+
+KPX a quoteright -54
+KPX a quotedblright -54
+
+KPX b y -6
+KPX b w -5
+KPX b v -5
+KPX b quoteright -30
+KPX b quotedblright -30
+KPX b period -15
+KPX b comma -15
+
+KPX braceleft Y 64
+KPX braceleft W 64
+KPX braceleft V 64
+KPX braceleft T 40
+KPX braceleft J 60
+
+KPX bracketleft Y 60
+KPX bracketleft W 64
+KPX bracketleft V 64
+KPX bracketleft T 35
+KPX bracketleft J 30
+
+KPX c quoteright 5
+KPX c quotedblright 5
+
+KPX colon space -30
+
+KPX comma space -40
+KPX comma quoteright -100
+KPX comma quotedblright -100
+
+KPX d quoteright -12
+KPX d quotedblright -12
+KPX d period 15
+KPX d comma 15
+
+KPX e y 6
+KPX e x -10
+KPX e w -10
+KPX e v -10
+KPX e quoteright -25
+KPX e quotedblright -25
+
+KPX f quoteright 120
+KPX f quotedblright 120
+KPX f period -30
+KPX f parenright 100
+KPX f comma -30
+KPX f bracketright 110
+KPX f braceright 110
+
+KPX g y 50
+KPX g quotedblright -20
+KPX g p 30
+KPX g f 42
+KPX g comma 20
+
+KPX h quoteright -78
+KPX h quotedblright -78
+
+KPX i quoteright -20
+KPX i quotedblright -20
+
+KPX j quoteright -20
+KPX j quotedblright -20
+KPX j period -20
+KPX j comma -20
+
+KPX k quoteright -38
+KPX k quotedblright -38
+
+KPX l quoteright -12
+KPX l quotedblright -12
+
+KPX m quoteright -78
+KPX m quotedblright -78
+
+KPX n quoteright -88
+KPX n quotedblright -88
+
+KPX o y -12
+KPX o x -20
+KPX o w -25
+KPX o v -25
+KPX o quoteright -50
+KPX o quotedblright -50
+KPX o period -10
+KPX o comma -10
+
+KPX p w -6
+KPX p quoteright -30
+KPX p quotedblright -52
+KPX p period -15
+KPX p comma -15
+
+KPX parenleft Y 64
+KPX parenleft W 64
+KPX parenleft V 64
+KPX parenleft T 30
+KPX parenleft J 50
+
+KPX period space -40
+KPX period quoteright -100
+KPX period quotedblright -100
+
+KPX q quoteright -40
+KPX q quotedblright -40
+KPX q period -10
+KPX q comma -5
+
+KPX quotedblleft z -30
+KPX quotedblleft x -60
+KPX quotedblleft w -12
+KPX quotedblleft v -12
+KPX quotedblleft u -12
+KPX quotedblleft t 5
+KPX quotedblleft s -30
+KPX quotedblleft r -12
+KPX quotedblleft q -50
+KPX quotedblleft p -12
+KPX quotedblleft o -30
+KPX quotedblleft n -12
+KPX quotedblleft m -12
+KPX quotedblleft l 10
+KPX quotedblleft k 10
+KPX quotedblleft h 10
+KPX quotedblleft g -30
+KPX quotedblleft e -30
+KPX quotedblleft d -50
+KPX quotedblleft c -30
+KPX quotedblleft b 24
+KPX quotedblleft a -50
+KPX quotedblleft Y 30
+KPX quotedblleft X 45
+KPX quotedblleft W 55
+KPX quotedblleft V 40
+KPX quotedblleft T 36
+KPX quotedblleft A -100
+
+KPX quotedblright space -50
+KPX quotedblright period -200
+KPX quotedblright comma -200
+
+KPX quoteleft z -30
+KPX quoteleft y 30
+KPX quoteleft x -10
+KPX quoteleft w -12
+KPX quoteleft u -12
+KPX quoteleft t -30
+KPX quoteleft s -30
+KPX quoteleft r -12
+KPX quoteleft q -30
+KPX quoteleft p -12
+KPX quoteleft o -30
+KPX quoteleft n -12
+KPX quoteleft m -12
+KPX quoteleft l 10
+KPX quoteleft k 10
+KPX quoteleft h 10
+KPX quoteleft g -30
+KPX quoteleft e -30
+KPX quoteleft d -30
+KPX quoteleft c -30
+KPX quoteleft b 24
+KPX quoteleft a -30
+KPX quoteleft Y 12
+KPX quoteleft X 46
+KPX quoteleft W 46
+KPX quoteleft V 28
+KPX quoteleft T 36
+KPX quoteleft A -100
+
+KPX quoteright v -20
+KPX quoteright space -50
+KPX quoteright s -45
+KPX quoteright r -12
+KPX quoteright period -140
+KPX quoteright m -12
+KPX quoteright l -12
+KPX quoteright d -65
+KPX quoteright comma -140
+
+KPX r z 20
+KPX r y 18
+KPX r x 12
+KPX r w 6
+KPX r v 6
+KPX r t 8
+KPX r semicolon 20
+KPX r quoteright -6
+KPX r quotedblright -6
+KPX r q -24
+KPX r period -100
+KPX r o -6
+KPX r l -12
+KPX r k -12
+KPX r hyphen -40
+KPX r h -10
+KPX r f 8
+KPX r endash -20
+KPX r e -26
+KPX r d -25
+KPX r comma -100
+KPX r colon 20
+KPX r c -12
+KPX r a -25
+
+KPX s quoteright -25
+KPX s quotedblright -30
+
+KPX semicolon space -30
+
+KPX space quotesinglbase -60
+KPX space quoteleft -60
+KPX space quotedblleft -60
+KPX space quotedblbase -60
+KPX space Y -70
+KPX space W -50
+KPX space V -70
+KPX space T -50
+KPX space A -50
+
+KPX t quoteright 15
+KPX t quotedblright 15
+KPX t period 15
+KPX t comma 15
+
+KPX u quoteright -65
+KPX u quotedblright -78
+KPX u period 20
+KPX u comma 20
+
+KPX v quoteright -10
+KPX v quotedblright -10
+KPX v q -6
+KPX v period -62
+KPX v o -6
+KPX v e -6
+KPX v d -6
+KPX v comma -62
+KPX v c -6
+KPX v a -6
+
+KPX w quoteright -10
+KPX w quotedblright -10
+KPX w period -40
+KPX w comma -50
+
+KPX x y 12
+KPX x w -6
+KPX x quoteright -30
+KPX x quotedblright -30
+KPX x q -6
+KPX x o -6
+KPX x e -6
+KPX x d -6
+KPX x c -6
+
+KPX y quoteright -10
+KPX y quotedblright -10
+KPX y q -10
+KPX y period -56
+KPX y d -10
+KPX y comma -56
+
+KPX z quoteright -40
+KPX z quotedblright -40
+KPX z o -6
+KPX z e -6
+KPX z d -6
+KPX z c -6
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/putr8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/putr8a.afm
new file mode 100644
index 0000000..be1bb78
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/putr8a.afm
@@ -0,0 +1,1029 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Fri Jan 17 13:38:17 1992
+Comment UniqueID 37674
+Comment VMusage 32991 39883
+FontName Utopia-Regular
+FullName Utopia Regular
+FamilyName Utopia
+Weight Regular
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -158 -250 1158 890
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.002
+Notice Copyright (c) 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.Utopia is a registered trademark of Adobe Systems Incorporated.
+EncodingScheme AdobeStandardEncoding
+CapHeight 692
+XHeight 490
+Ascender 742
+Descender -230
+StartCharMetrics 228
+C 32 ; WX 225 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 242 ; N exclam ; B 58 -12 184 707 ;
+C 34 ; WX 458 ; N quotedbl ; B 101 464 358 742 ;
+C 35 ; WX 530 ; N numbersign ; B 11 0 519 668 ;
+C 36 ; WX 530 ; N dollar ; B 44 -102 487 743 ;
+C 37 ; WX 838 ; N percent ; B 50 -25 788 700 ;
+C 38 ; WX 706 ; N ampersand ; B 46 -12 692 680 ;
+C 39 ; WX 278 ; N quoteright ; B 72 472 207 742 ;
+C 40 ; WX 350 ; N parenleft ; B 105 -128 325 692 ;
+C 41 ; WX 350 ; N parenright ; B 25 -128 245 692 ;
+C 42 ; WX 412 ; N asterisk ; B 50 356 363 707 ;
+C 43 ; WX 570 ; N plus ; B 43 0 527 490 ;
+C 44 ; WX 265 ; N comma ; B 51 -141 193 141 ;
+C 45 ; WX 392 ; N hyphen ; B 74 216 319 286 ;
+C 46 ; WX 265 ; N period ; B 70 -12 196 116 ;
+C 47 ; WX 460 ; N slash ; B 92 -15 369 707 ;
+C 48 ; WX 530 ; N zero ; B 41 -12 489 680 ;
+C 49 ; WX 530 ; N one ; B 109 0 437 680 ;
+C 50 ; WX 530 ; N two ; B 27 0 485 680 ;
+C 51 ; WX 530 ; N three ; B 27 -12 473 680 ;
+C 52 ; WX 530 ; N four ; B 19 0 493 668 ;
+C 53 ; WX 530 ; N five ; B 40 -12 480 668 ;
+C 54 ; WX 530 ; N six ; B 44 -12 499 680 ;
+C 55 ; WX 530 ; N seven ; B 41 -12 497 668 ;
+C 56 ; WX 530 ; N eight ; B 42 -12 488 680 ;
+C 57 ; WX 530 ; N nine ; B 36 -12 477 680 ;
+C 58 ; WX 265 ; N colon ; B 70 -12 196 490 ;
+C 59 ; WX 265 ; N semicolon ; B 51 -141 196 490 ;
+C 60 ; WX 570 ; N less ; B 46 1 524 499 ;
+C 61 ; WX 570 ; N equal ; B 43 111 527 389 ;
+C 62 ; WX 570 ; N greater ; B 46 1 524 499 ;
+C 63 ; WX 389 ; N question ; B 29 -12 359 707 ;
+C 64 ; WX 793 ; N at ; B 46 -15 755 707 ;
+C 65 ; WX 635 ; N A ; B -29 0 650 692 ;
+C 66 ; WX 646 ; N B ; B 35 0 595 692 ;
+C 67 ; WX 684 ; N C ; B 48 -15 649 707 ;
+C 68 ; WX 779 ; N D ; B 35 0 731 692 ;
+C 69 ; WX 606 ; N E ; B 35 0 577 692 ;
+C 70 ; WX 580 ; N F ; B 35 0 543 692 ;
+C 71 ; WX 734 ; N G ; B 48 -15 725 707 ;
+C 72 ; WX 798 ; N H ; B 35 0 763 692 ;
+C 73 ; WX 349 ; N I ; B 35 0 314 692 ;
+C 74 ; WX 350 ; N J ; B 0 -114 323 692 ;
+C 75 ; WX 658 ; N K ; B 35 -5 671 692 ;
+C 76 ; WX 568 ; N L ; B 35 0 566 692 ;
+C 77 ; WX 944 ; N M ; B 33 0 909 692 ;
+C 78 ; WX 780 ; N N ; B 34 0 753 692 ;
+C 79 ; WX 762 ; N O ; B 48 -15 714 707 ;
+C 80 ; WX 600 ; N P ; B 35 0 574 692 ;
+C 81 ; WX 762 ; N Q ; B 48 -193 714 707 ;
+C 82 ; WX 644 ; N R ; B 35 0 638 692 ;
+C 83 ; WX 541 ; N S ; B 50 -15 504 707 ;
+C 84 ; WX 621 ; N T ; B 22 0 599 692 ;
+C 85 ; WX 791 ; N U ; B 29 -15 762 692 ;
+C 86 ; WX 634 ; N V ; B -18 0 678 692 ;
+C 87 ; WX 940 ; N W ; B -13 0 977 692 ;
+C 88 ; WX 624 ; N X ; B -19 0 657 692 ;
+C 89 ; WX 588 ; N Y ; B -12 0 632 692 ;
+C 90 ; WX 610 ; N Z ; B 9 0 594 692 ;
+C 91 ; WX 330 ; N bracketleft ; B 133 -128 292 692 ;
+C 92 ; WX 460 ; N backslash ; B 91 -15 369 707 ;
+C 93 ; WX 330 ; N bracketright ; B 38 -128 197 692 ;
+C 94 ; WX 570 ; N asciicircum ; B 56 228 514 668 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 278 ; N quoteleft ; B 72 478 207 748 ;
+C 97 ; WX 523 ; N a ; B 49 -12 525 502 ;
+C 98 ; WX 598 ; N b ; B 20 -12 549 742 ;
+C 99 ; WX 496 ; N c ; B 49 -12 473 502 ;
+C 100 ; WX 598 ; N d ; B 49 -12 583 742 ;
+C 101 ; WX 514 ; N e ; B 49 -12 481 502 ;
+C 102 ; WX 319 ; N f ; B 30 0 389 742 ; L i fi ; L l fl ;
+C 103 ; WX 520 ; N g ; B 42 -242 525 512 ;
+C 104 ; WX 607 ; N h ; B 21 0 592 742 ;
+C 105 ; WX 291 ; N i ; B 32 0 276 715 ;
+C 106 ; WX 280 ; N j ; B -33 -242 214 715 ;
+C 107 ; WX 524 ; N k ; B 20 -5 538 742 ;
+C 108 ; WX 279 ; N l ; B 20 0 264 742 ;
+C 109 ; WX 923 ; N m ; B 32 0 908 502 ;
+C 110 ; WX 619 ; N n ; B 32 0 604 502 ;
+C 111 ; WX 577 ; N o ; B 49 -12 528 502 ;
+C 112 ; WX 608 ; N p ; B 25 -230 559 502 ;
+C 113 ; WX 591 ; N q ; B 49 -230 583 502 ;
+C 114 ; WX 389 ; N r ; B 32 0 386 502 ;
+C 115 ; WX 436 ; N s ; B 47 -12 400 502 ;
+C 116 ; WX 344 ; N t ; B 31 -12 342 616 ;
+C 117 ; WX 606 ; N u ; B 26 -12 591 502 ;
+C 118 ; WX 504 ; N v ; B 1 0 529 490 ;
+C 119 ; WX 768 ; N w ; B -2 0 792 490 ;
+C 120 ; WX 486 ; N x ; B 1 0 509 490 ;
+C 121 ; WX 506 ; N y ; B -5 -242 528 490 ;
+C 122 ; WX 480 ; N z ; B 19 0 462 490 ;
+C 123 ; WX 340 ; N braceleft ; B 79 -128 298 692 ;
+C 124 ; WX 228 ; N bar ; B 80 -250 148 750 ;
+C 125 ; WX 340 ; N braceright ; B 42 -128 261 692 ;
+C 126 ; WX 570 ; N asciitilde ; B 73 175 497 317 ;
+C 161 ; WX 242 ; N exclamdown ; B 58 -217 184 502 ;
+C 162 ; WX 530 ; N cent ; B 37 -10 487 675 ;
+C 163 ; WX 530 ; N sterling ; B 27 0 510 680 ;
+C 164 ; WX 150 ; N fraction ; B -158 -27 308 695 ;
+C 165 ; WX 530 ; N yen ; B -2 0 525 668 ;
+C 166 ; WX 530 ; N florin ; B -2 -135 522 691 ;
+C 167 ; WX 554 ; N section ; B 46 -115 507 707 ;
+C 168 ; WX 530 ; N currency ; B 25 90 505 578 ;
+C 169 ; WX 278 ; N quotesingle ; B 93 464 185 742 ;
+C 170 ; WX 458 ; N quotedblleft ; B 72 478 387 748 ;
+C 171 ; WX 442 ; N guillemotleft ; B 41 41 401 435 ;
+C 172 ; WX 257 ; N guilsinglleft ; B 41 41 216 435 ;
+C 173 ; WX 257 ; N guilsinglright ; B 41 41 216 435 ;
+C 174 ; WX 610 ; N fi ; B 30 0 595 742 ;
+C 175 ; WX 610 ; N fl ; B 30 0 595 742 ;
+C 177 ; WX 500 ; N endash ; B 0 221 500 279 ;
+C 178 ; WX 504 ; N dagger ; B 45 -125 459 717 ;
+C 179 ; WX 488 ; N daggerdbl ; B 45 -119 443 717 ;
+C 180 ; WX 265 ; N periodcentered ; B 70 188 196 316 ;
+C 182 ; WX 555 ; N paragraph ; B 64 -101 529 692 ;
+C 183 ; WX 409 ; N bullet ; B 45 192 364 512 ;
+C 184 ; WX 278 ; N quotesinglbase ; B 72 -125 207 145 ;
+C 185 ; WX 458 ; N quotedblbase ; B 72 -125 387 145 ;
+C 186 ; WX 458 ; N quotedblright ; B 72 472 387 742 ;
+C 187 ; WX 442 ; N guillemotright ; B 41 41 401 435 ;
+C 188 ; WX 1000 ; N ellipsis ; B 104 -12 896 116 ;
+C 189 ; WX 1208 ; N perthousand ; B 50 -25 1158 700 ;
+C 191 ; WX 389 ; N questiondown ; B 30 -217 360 502 ;
+C 193 ; WX 400 ; N grave ; B 49 542 271 723 ;
+C 194 ; WX 400 ; N acute ; B 129 542 351 723 ;
+C 195 ; WX 400 ; N circumflex ; B 47 541 353 720 ;
+C 196 ; WX 400 ; N tilde ; B 22 563 377 682 ;
+C 197 ; WX 400 ; N macron ; B 56 597 344 656 ;
+C 198 ; WX 400 ; N breve ; B 63 568 337 704 ;
+C 199 ; WX 400 ; N dotaccent ; B 140 570 260 683 ;
+C 200 ; WX 400 ; N dieresis ; B 36 570 364 683 ;
+C 202 ; WX 400 ; N ring ; B 92 550 308 752 ;
+C 203 ; WX 400 ; N cedilla ; B 163 -230 329 0 ;
+C 205 ; WX 400 ; N hungarumlaut ; B 101 546 380 750 ;
+C 206 ; WX 400 ; N ogonek ; B 103 -230 295 0 ;
+C 207 ; WX 400 ; N caron ; B 47 541 353 720 ;
+C 208 ; WX 1000 ; N emdash ; B 0 221 1000 279 ;
+C 225 ; WX 876 ; N AE ; B -63 0 847 692 ;
+C 227 ; WX 390 ; N ordfeminine ; B 40 265 364 590 ;
+C 232 ; WX 574 ; N Lslash ; B 36 0 572 692 ;
+C 233 ; WX 762 ; N Oslash ; B 48 -53 714 739 ;
+C 234 ; WX 1025 ; N OE ; B 48 0 996 692 ;
+C 235 ; WX 398 ; N ordmasculine ; B 35 265 363 590 ;
+C 241 ; WX 797 ; N ae ; B 49 -12 764 502 ;
+C 245 ; WX 291 ; N dotlessi ; B 32 0 276 502 ;
+C 248 ; WX 294 ; N lslash ; B 14 0 293 742 ;
+C 249 ; WX 577 ; N oslash ; B 49 -41 528 532 ;
+C 250 ; WX 882 ; N oe ; B 49 -12 849 502 ;
+C 251 ; WX 601 ; N germandbls ; B 22 -12 573 742 ;
+C -1 ; WX 380 ; N onesuperior ; B 81 272 307 680 ;
+C -1 ; WX 570 ; N minus ; B 43 221 527 279 ;
+C -1 ; WX 350 ; N degree ; B 37 404 313 680 ;
+C -1 ; WX 577 ; N oacute ; B 49 -12 528 723 ;
+C -1 ; WX 762 ; N Odieresis ; B 48 -15 714 841 ;
+C -1 ; WX 577 ; N odieresis ; B 49 -12 528 683 ;
+C -1 ; WX 606 ; N Eacute ; B 35 0 577 890 ;
+C -1 ; WX 606 ; N ucircumflex ; B 26 -12 591 720 ;
+C -1 ; WX 860 ; N onequarter ; B 65 -27 795 695 ;
+C -1 ; WX 570 ; N logicalnot ; B 43 102 527 389 ;
+C -1 ; WX 606 ; N Ecircumflex ; B 35 0 577 876 ;
+C -1 ; WX 860 ; N onehalf ; B 58 -27 807 695 ;
+C -1 ; WX 762 ; N Otilde ; B 48 -15 714 842 ;
+C -1 ; WX 606 ; N uacute ; B 26 -12 591 723 ;
+C -1 ; WX 514 ; N eacute ; B 49 -12 481 723 ;
+C -1 ; WX 291 ; N iacute ; B 32 0 317 723 ;
+C -1 ; WX 606 ; N Egrave ; B 35 0 577 890 ;
+C -1 ; WX 291 ; N icircumflex ; B -3 0 304 720 ;
+C -1 ; WX 606 ; N mu ; B 26 -246 591 502 ;
+C -1 ; WX 228 ; N brokenbar ; B 80 -175 148 675 ;
+C -1 ; WX 606 ; N thorn ; B 23 -230 557 722 ;
+C -1 ; WX 627 ; N Aring ; B -32 0 647 861 ;
+C -1 ; WX 506 ; N yacute ; B -5 -242 528 723 ;
+C -1 ; WX 588 ; N Ydieresis ; B -12 0 632 841 ;
+C -1 ; WX 1100 ; N trademark ; B 45 277 1048 692 ;
+C -1 ; WX 818 ; N registered ; B 45 -15 773 707 ;
+C -1 ; WX 577 ; N ocircumflex ; B 49 -12 528 720 ;
+C -1 ; WX 635 ; N Agrave ; B -29 0 650 890 ;
+C -1 ; WX 541 ; N Scaron ; B 50 -15 504 882 ;
+C -1 ; WX 791 ; N Ugrave ; B 29 -15 762 890 ;
+C -1 ; WX 606 ; N Edieresis ; B 35 0 577 841 ;
+C -1 ; WX 791 ; N Uacute ; B 29 -15 762 890 ;
+C -1 ; WX 577 ; N otilde ; B 49 -12 528 682 ;
+C -1 ; WX 619 ; N ntilde ; B 32 0 604 682 ;
+C -1 ; WX 506 ; N ydieresis ; B -5 -242 528 683 ;
+C -1 ; WX 635 ; N Aacute ; B -29 0 650 890 ;
+C -1 ; WX 577 ; N eth ; B 49 -12 528 742 ;
+C -1 ; WX 523 ; N acircumflex ; B 49 -12 525 720 ;
+C -1 ; WX 523 ; N aring ; B 49 -12 525 752 ;
+C -1 ; WX 762 ; N Ograve ; B 48 -15 714 890 ;
+C -1 ; WX 496 ; N ccedilla ; B 49 -230 473 502 ;
+C -1 ; WX 570 ; N multiply ; B 63 22 507 478 ;
+C -1 ; WX 570 ; N divide ; B 43 26 527 474 ;
+C -1 ; WX 380 ; N twosuperior ; B 32 272 348 680 ;
+C -1 ; WX 780 ; N Ntilde ; B 34 0 753 842 ;
+C -1 ; WX 606 ; N ugrave ; B 26 -12 591 723 ;
+C -1 ; WX 791 ; N Ucircumflex ; B 29 -15 762 876 ;
+C -1 ; WX 635 ; N Atilde ; B -29 0 650 842 ;
+C -1 ; WX 480 ; N zcaron ; B 19 0 462 720 ;
+C -1 ; WX 291 ; N idieresis ; B -19 0 310 683 ;
+C -1 ; WX 635 ; N Acircumflex ; B -29 0 650 876 ;
+C -1 ; WX 349 ; N Icircumflex ; B 22 0 328 876 ;
+C -1 ; WX 588 ; N Yacute ; B -12 0 632 890 ;
+C -1 ; WX 762 ; N Oacute ; B 48 -15 714 890 ;
+C -1 ; WX 635 ; N Adieresis ; B -29 0 650 841 ;
+C -1 ; WX 610 ; N Zcaron ; B 9 0 594 882 ;
+C -1 ; WX 523 ; N agrave ; B 49 -12 525 723 ;
+C -1 ; WX 380 ; N threesuperior ; B 36 265 339 680 ;
+C -1 ; WX 577 ; N ograve ; B 49 -12 528 723 ;
+C -1 ; WX 860 ; N threequarters ; B 50 -27 808 695 ;
+C -1 ; WX 785 ; N Eth ; B 20 0 737 692 ;
+C -1 ; WX 570 ; N plusminus ; B 43 0 527 556 ;
+C -1 ; WX 606 ; N udieresis ; B 26 -12 591 683 ;
+C -1 ; WX 514 ; N edieresis ; B 49 -12 481 683 ;
+C -1 ; WX 523 ; N aacute ; B 49 -12 525 723 ;
+C -1 ; WX 291 ; N igrave ; B -35 0 276 723 ;
+C -1 ; WX 349 ; N Idieresis ; B 13 0 337 841 ;
+C -1 ; WX 523 ; N adieresis ; B 49 -12 525 683 ;
+C -1 ; WX 349 ; N Iacute ; B 35 0 371 890 ;
+C -1 ; WX 818 ; N copyright ; B 45 -15 773 707 ;
+C -1 ; WX 349 ; N Igrave ; B -17 0 314 890 ;
+C -1 ; WX 680 ; N Ccedilla ; B 48 -230 649 707 ;
+C -1 ; WX 436 ; N scaron ; B 47 -12 400 720 ;
+C -1 ; WX 514 ; N egrave ; B 49 -12 481 723 ;
+C -1 ; WX 762 ; N Ocircumflex ; B 48 -15 714 876 ;
+C -1 ; WX 593 ; N Thorn ; B 35 0 556 692 ;
+C -1 ; WX 523 ; N atilde ; B 49 -12 525 682 ;
+C -1 ; WX 791 ; N Udieresis ; B 29 -15 762 841 ;
+C -1 ; WX 514 ; N ecircumflex ; B 49 -12 481 720 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 712
+
+KPX A z 6
+KPX A y -50
+KPX A w -45
+KPX A v -60
+KPX A u -25
+KPX A t -12
+KPX A quoteright -120
+KPX A quotedblright -120
+KPX A q -6
+KPX A p -18
+KPX A o -12
+KPX A e -6
+KPX A d -12
+KPX A c -12
+KPX A b -12
+KPX A Y -70
+KPX A X -6
+KPX A W -58
+KPX A V -72
+KPX A U -50
+KPX A T -70
+KPX A Q -24
+KPX A O -24
+KPX A G -24
+KPX A C -24
+
+KPX B y -18
+KPX B u -12
+KPX B r -12
+KPX B period -30
+KPX B o -6
+KPX B l -12
+KPX B i -12
+KPX B h -12
+KPX B e -6
+KPX B comma -20
+KPX B a -12
+KPX B W -25
+KPX B V -20
+KPX B U -20
+KPX B T -20
+
+KPX C z -18
+KPX C y -24
+KPX C u -18
+KPX C r -6
+KPX C o -12
+KPX C e -12
+KPX C a -12
+KPX C Q -6
+KPX C O -6
+KPX C G -6
+KPX C C -6
+
+KPX D y 6
+KPX D u -12
+KPX D r -12
+KPX D quoteright -20
+KPX D quotedblright -20
+KPX D period -60
+KPX D i -6
+KPX D h -12
+KPX D e -6
+KPX D comma -50
+KPX D a -6
+KPX D Y -45
+KPX D W -35
+KPX D V -35
+
+KPX E z -6
+KPX E y -30
+KPX E x -6
+KPX E w -24
+KPX E v -24
+KPX E u -12
+KPX E t -18
+KPX E r -4
+KPX E q -6
+KPX E p -18
+KPX E o -6
+KPX E n -4
+KPX E m -4
+KPX E l 5
+KPX E k 5
+KPX E j -6
+KPX E i -6
+KPX E g -6
+KPX E f -12
+KPX E e -6
+KPX E d -6
+KPX E c -6
+KPX E b -12
+KPX E Y -6
+KPX E W -6
+KPX E V -6
+
+KPX F y -18
+KPX F u -12
+KPX F r -20
+KPX F period -180
+KPX F o -36
+KPX F l -12
+KPX F i -10
+KPX F endash 20
+KPX F e -36
+KPX F comma -180
+KPX F a -48
+KPX F A -60
+
+KPX G y -18
+KPX G u -12
+KPX G r -5
+KPX G o 5
+KPX G n -5
+KPX G l -6
+KPX G i -12
+KPX G h -12
+KPX G e 5
+KPX G a -12
+
+KPX H y -24
+KPX H u -26
+KPX H o -30
+KPX H i -18
+KPX H e -30
+KPX H a -24
+
+KPX I z -6
+KPX I y -6
+KPX I x -6
+KPX I w -18
+KPX I v -24
+KPX I u -26
+KPX I t -24
+KPX I s -18
+KPX I r -12
+KPX I p -26
+KPX I o -30
+KPX I n -18
+KPX I m -18
+KPX I l -6
+KPX I k -6
+KPX I h -6
+KPX I g -10
+KPX I f -6
+KPX I e -30
+KPX I d -30
+KPX I c -30
+KPX I b -6
+KPX I a -24
+
+KPX J y -12
+KPX J u -36
+KPX J o -30
+KPX J i -20
+KPX J e -30
+KPX J bracketright 20
+KPX J braceright 20
+KPX J a -36
+
+KPX K y -60
+KPX K w -70
+KPX K v -70
+KPX K u -42
+KPX K o -30
+KPX K i 6
+KPX K e -24
+KPX K a -12
+KPX K Q -42
+KPX K O -42
+KPX K G -42
+KPX K C -42
+
+KPX L y -52
+KPX L w -58
+KPX L u -12
+KPX L quoteright -130
+KPX L quotedblright -50
+KPX L l 6
+KPX L j -6
+KPX L Y -70
+KPX L W -90
+KPX L V -100
+KPX L U -24
+KPX L T -100
+KPX L Q -18
+KPX L O -10
+KPX L G -18
+KPX L C -18
+KPX L A 12
+
+KPX M y -24
+KPX M u -36
+KPX M o -30
+KPX M n -6
+KPX M j -12
+KPX M i -12
+KPX M e -30
+KPX M d -30
+KPX M c -30
+KPX M a -12
+
+KPX N y -24
+KPX N u -30
+KPX N o -30
+KPX N i -24
+KPX N e -30
+KPX N a -30
+
+KPX O z -6
+KPX O u -6
+KPX O t -6
+KPX O s -6
+KPX O q -6
+KPX O period -60
+KPX O p -6
+KPX O o -6
+KPX O n -5
+KPX O m -5
+KPX O l -6
+KPX O k -6
+KPX O i -5
+KPX O h -12
+KPX O g -6
+KPX O e -6
+KPX O d -6
+KPX O comma -50
+KPX O c -6
+KPX O a -12
+KPX O Y -55
+KPX O X -24
+KPX O W -30
+KPX O V -18
+KPX O T -30
+KPX O A -18
+
+KPX P u -12
+KPX P t -6
+KPX P s -24
+KPX P r -12
+KPX P period -200
+KPX P o -30
+KPX P n -12
+KPX P l -6
+KPX P hyphen -40
+KPX P h -6
+KPX P e -30
+KPX P comma -200
+KPX P a -36
+KPX P I -6
+KPX P H -12
+KPX P E -6
+KPX P A -55
+
+KPX Q u -6
+KPX Q a -18
+KPX Q Y -30
+KPX Q X -24
+KPX Q W -24
+KPX Q V -18
+KPX Q U -30
+KPX Q T -24
+KPX Q A -18
+
+KPX R y -20
+KPX R u -12
+KPX R quoteright -20
+KPX R quotedblright -20
+KPX R o -20
+KPX R hyphen -30
+KPX R e -20
+KPX R d -20
+KPX R a -12
+KPX R Y -45
+KPX R W -24
+KPX R V -32
+KPX R U -30
+KPX R T -32
+KPX R Q -24
+KPX R O -24
+KPX R G -24
+KPX R C -24
+
+KPX S y -25
+KPX S w -30
+KPX S v -30
+KPX S u -24
+KPX S t -24
+KPX S r -20
+KPX S quoteright -10
+KPX S quotedblright -10
+KPX S q -5
+KPX S p -24
+KPX S o -12
+KPX S n -20
+KPX S m -20
+KPX S l -18
+KPX S k -24
+KPX S j -12
+KPX S i -20
+KPX S h -12
+KPX S e -12
+KPX S a -18
+
+KPX T z -64
+KPX T y -84
+KPX T w -100
+KPX T u -82
+KPX T semicolon -56
+KPX T s -82
+KPX T r -82
+KPX T quoteright 24
+KPX T period -110
+KPX T parenright 54
+KPX T o -100
+KPX T m -82
+KPX T i -34
+KPX T hyphen -100
+KPX T endash -50
+KPX T emdash -50
+KPX T e -100
+KPX T comma -110
+KPX T colon -50
+KPX T bracketright 54
+KPX T braceright 54
+KPX T a -100
+KPX T Y 12
+KPX T X 18
+KPX T W 6
+KPX T V 6
+KPX T T 12
+KPX T S -12
+KPX T Q -18
+KPX T O -18
+KPX T G -18
+KPX T C -18
+KPX T A -65
+
+KPX U z -30
+KPX U y -20
+KPX U x -30
+KPX U v -20
+KPX U t -36
+KPX U s -40
+KPX U r -40
+KPX U p -42
+KPX U n -40
+KPX U m -40
+KPX U l -12
+KPX U k -12
+KPX U i -28
+KPX U h -6
+KPX U g -50
+KPX U f -12
+KPX U d -45
+KPX U c -45
+KPX U b -12
+KPX U a -40
+KPX U A -40
+
+KPX V y -36
+KPX V u -40
+KPX V semicolon -45
+KPX V r -70
+KPX V quoteright 36
+KPX V quotedblright 20
+KPX V period -140
+KPX V parenright 85
+KPX V o -70
+KPX V i 6
+KPX V hyphen -60
+KPX V endash -20
+KPX V emdash -20
+KPX V e -70
+KPX V comma -140
+KPX V colon -45
+KPX V bracketright 64
+KPX V braceright 64
+KPX V a -60
+KPX V T 6
+KPX V Q -12
+KPX V O -12
+KPX V G -12
+KPX V C -12
+KPX V A -60
+
+KPX W y -50
+KPX W u -46
+KPX W semicolon -40
+KPX W r -45
+KPX W quoteright 36
+KPX W quotedblright 20
+KPX W period -110
+KPX W parenright 85
+KPX W o -65
+KPX W m -45
+KPX W i -10
+KPX W hyphen -40
+KPX W e -65
+KPX W d -65
+KPX W comma -100
+KPX W colon -40
+KPX W bracketright 64
+KPX W braceright 64
+KPX W a -60
+KPX W T 18
+KPX W Q -6
+KPX W O -6
+KPX W G -6
+KPX W C -6
+KPX W A -48
+
+KPX X y -18
+KPX X u -24
+KPX X quoteright 15
+KPX X e -6
+KPX X a -6
+KPX X Q -24
+KPX X O -30
+KPX X G -30
+KPX X C -30
+KPX X A 6
+
+KPX Y v -50
+KPX Y u -54
+KPX Y t -46
+KPX Y semicolon -37
+KPX Y quoteright 36
+KPX Y quotedblright 20
+KPX Y q -100
+KPX Y period -90
+KPX Y parenright 60
+KPX Y o -90
+KPX Y l 10
+KPX Y hyphen -50
+KPX Y emdash -20
+KPX Y e -90
+KPX Y d -90
+KPX Y comma -90
+KPX Y colon -50
+KPX Y bracketright 64
+KPX Y braceright 64
+KPX Y a -68
+KPX Y Y 12
+KPX Y X 12
+KPX Y W 12
+KPX Y V 12
+KPX Y T 12
+KPX Y Q -18
+KPX Y O -18
+KPX Y G -18
+KPX Y C -18
+KPX Y A -32
+
+KPX Z y -36
+KPX Z w -36
+KPX Z u -6
+KPX Z o -12
+KPX Z i -12
+KPX Z e -6
+KPX Z a -6
+KPX Z Q -20
+KPX Z O -20
+KPX Z G -30
+KPX Z C -20
+KPX Z A 20
+
+KPX a quoteright -70
+KPX a quotedblright -80
+
+KPX b y -25
+KPX b w -30
+KPX b v -35
+KPX b quoteright -70
+KPX b quotedblright -70
+KPX b period -40
+KPX b comma -40
+
+KPX braceleft Y 64
+KPX braceleft W 64
+KPX braceleft V 64
+KPX braceleft T 54
+KPX braceleft J 80
+
+KPX bracketleft Y 64
+KPX bracketleft W 64
+KPX bracketleft V 64
+KPX bracketleft T 54
+KPX bracketleft J 80
+
+KPX c quoteright -28
+KPX c quotedblright -28
+KPX c period -10
+
+KPX comma quoteright -50
+KPX comma quotedblright -50
+
+KPX d quoteright -24
+KPX d quotedblright -24
+
+KPX e z -4
+KPX e quoteright -60
+KPX e quotedblright -60
+KPX e period -20
+KPX e comma -20
+
+KPX f quotesingle 30
+KPX f quoteright 65
+KPX f quotedblright 56
+KPX f quotedbl 30
+KPX f parenright 100
+KPX f bracketright 100
+KPX f braceright 100
+
+KPX g quoteright -18
+KPX g quotedblright -10
+
+KPX h quoteright -80
+KPX h quotedblright -80
+
+KPX j quoteright -20
+KPX j quotedblright -20
+KPX j period -30
+KPX j comma -30
+
+KPX k quoteright -40
+KPX k quotedblright -40
+
+KPX l quoteright -10
+KPX l quotedblright -10
+
+KPX m quoteright -80
+KPX m quotedblright -80
+
+KPX n quoteright -80
+KPX n quotedblright -80
+
+KPX o z -12
+KPX o y -30
+KPX o x -18
+KPX o w -30
+KPX o v -30
+KPX o quoteright -70
+KPX o quotedblright -70
+KPX o period -40
+KPX o comma -40
+
+KPX p z -20
+KPX p y -25
+KPX p w -30
+KPX p quoteright -70
+KPX p quotedblright -70
+KPX p period -40
+KPX p comma -40
+
+KPX parenleft Y 64
+KPX parenleft W 64
+KPX parenleft V 64
+KPX parenleft T 64
+KPX parenleft J 80
+
+KPX period quoteright -50
+KPX period quotedblright -50
+
+KPX q quoteright -50
+KPX q quotedblright -50
+KPX q period -20
+KPX q comma -10
+
+KPX quotedblleft z -60
+KPX quotedblleft y -30
+KPX quotedblleft x -40
+KPX quotedblleft w -20
+KPX quotedblleft v -20
+KPX quotedblleft u -40
+KPX quotedblleft t -40
+KPX quotedblleft s -50
+KPX quotedblleft r -50
+KPX quotedblleft q -80
+KPX quotedblleft p -50
+KPX quotedblleft o -80
+KPX quotedblleft n -50
+KPX quotedblleft m -50
+KPX quotedblleft g -70
+KPX quotedblleft f -50
+KPX quotedblleft e -80
+KPX quotedblleft d -80
+KPX quotedblleft c -80
+KPX quotedblleft a -70
+KPX quotedblleft Z -20
+KPX quotedblleft Y 12
+KPX quotedblleft W 18
+KPX quotedblleft V 18
+KPX quotedblleft U -20
+KPX quotedblleft T 10
+KPX quotedblleft S -20
+KPX quotedblleft R -20
+KPX quotedblleft Q -20
+KPX quotedblleft P -20
+KPX quotedblleft O -30
+KPX quotedblleft N -20
+KPX quotedblleft M -20
+KPX quotedblleft L -20
+KPX quotedblleft K -20
+KPX quotedblleft J -40
+KPX quotedblleft I -20
+KPX quotedblleft H -20
+KPX quotedblleft G -30
+KPX quotedblleft F -20
+KPX quotedblleft E -20
+KPX quotedblleft D -20
+KPX quotedblleft C -30
+KPX quotedblleft B -20
+KPX quotedblleft A -130
+
+KPX quotedblright period -130
+KPX quotedblright comma -130
+
+KPX quoteleft z -40
+KPX quoteleft y -35
+KPX quoteleft x -30
+KPX quoteleft w -20
+KPX quoteleft v -20
+KPX quoteleft u -50
+KPX quoteleft t -40
+KPX quoteleft s -45
+KPX quoteleft r -50
+KPX quoteleft quoteleft -72
+KPX quoteleft q -70
+KPX quoteleft p -50
+KPX quoteleft o -70
+KPX quoteleft n -50
+KPX quoteleft m -50
+KPX quoteleft g -65
+KPX quoteleft f -40
+KPX quoteleft e -70
+KPX quoteleft d -70
+KPX quoteleft c -70
+KPX quoteleft a -60
+KPX quoteleft Z -20
+KPX quoteleft Y 18
+KPX quoteleft X 12
+KPX quoteleft W 18
+KPX quoteleft V 18
+KPX quoteleft U -20
+KPX quoteleft T 10
+KPX quoteleft R -20
+KPX quoteleft Q -20
+KPX quoteleft P -20
+KPX quoteleft O -30
+KPX quoteleft N -20
+KPX quoteleft M -20
+KPX quoteleft L -20
+KPX quoteleft K -20
+KPX quoteleft J -40
+KPX quoteleft I -20
+KPX quoteleft H -20
+KPX quoteleft G -40
+KPX quoteleft F -20
+KPX quoteleft E -20
+KPX quoteleft D -20
+KPX quoteleft C -30
+KPX quoteleft B -20
+KPX quoteleft A -130
+
+KPX quoteright v -40
+KPX quoteright t -75
+KPX quoteright s -110
+KPX quoteright r -70
+KPX quoteright quoteright -72
+KPX quoteright period -130
+KPX quoteright m -70
+KPX quoteright l -6
+KPX quoteright d -120
+KPX quoteright comma -130
+
+KPX r z 10
+KPX r y 18
+KPX r x 12
+KPX r w 18
+KPX r v 18
+KPX r u 8
+KPX r t 8
+KPX r semicolon 10
+KPX r quoteright -20
+KPX r quotedblright -20
+KPX r q -6
+KPX r period -60
+KPX r o -6
+KPX r n 8
+KPX r m 8
+KPX r k -6
+KPX r i 8
+KPX r hyphen -20
+KPX r h 6
+KPX r g -6
+KPX r f 8
+KPX r e -20
+KPX r d -20
+KPX r comma -60
+KPX r colon 10
+KPX r c -20
+KPX r a -10
+
+KPX s quoteright -40
+KPX s quotedblright -40
+KPX s period -20
+KPX s comma -10
+
+KPX space quotesinglbase -60
+KPX space quoteleft -40
+KPX space quotedblleft -40
+KPX space quotedblbase -60
+KPX space Y -60
+KPX space W -60
+KPX space V -60
+KPX space T -36
+
+KPX t quoteright -18
+KPX t quotedblright -18
+
+KPX u quoteright -30
+KPX u quotedblright -30
+
+KPX v semicolon 10
+KPX v quoteright 20
+KPX v quotedblright 20
+KPX v q -10
+KPX v period -90
+KPX v o -5
+KPX v e -5
+KPX v d -10
+KPX v comma -90
+KPX v colon 10
+KPX v c -6
+KPX v a -6
+
+KPX w semicolon 10
+KPX w quoteright 20
+KPX w quotedblright 20
+KPX w q -6
+KPX w period -80
+KPX w e -6
+KPX w d -6
+KPX w comma -75
+KPX w colon 10
+KPX w c -6
+
+KPX x quoteright -10
+KPX x quotedblright -20
+KPX x q -6
+KPX x o -6
+KPX x d -12
+KPX x c -12
+
+KPX y semicolon 10
+KPX y q -6
+KPX y period -95
+KPX y o -6
+KPX y hyphen -30
+KPX y e -6
+KPX y d -6
+KPX y comma -85
+KPX y colon 10
+KPX y c -6
+
+KPX z quoteright -20
+KPX z quotedblright -30
+KPX z o -6
+KPX z e -6
+KPX z d -6
+KPX z c -6
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/putri8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/putri8a.afm
new file mode 100644
index 0000000..b3dd45b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/putri8a.afm
@@ -0,0 +1,1008 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Fri Jan 17 13:15:45 1992
+Comment UniqueID 37666
+Comment VMusage 34143 41035
+FontName Utopia-Italic
+FullName Utopia Italic
+FamilyName Utopia
+Weight Regular
+ItalicAngle -13
+IsFixedPitch false
+FontBBox -201 -250 1170 890
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.002
+Notice Copyright (c) 1989, 1991 Adobe Systems Incorporated. All Rights Reserved.Utopia is a registered trademark of Adobe Systems Incorporated.
+EncodingScheme AdobeStandardEncoding
+CapHeight 692
+XHeight 502
+Ascender 742
+Descender -242
+StartCharMetrics 228
+C 32 ; WX 225 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 240 ; N exclam ; B 34 -12 290 707 ;
+C 34 ; WX 402 ; N quotedbl ; B 171 469 454 742 ;
+C 35 ; WX 530 ; N numbersign ; B 54 0 585 668 ;
+C 36 ; WX 530 ; N dollar ; B 31 -109 551 743 ;
+C 37 ; WX 826 ; N percent ; B 98 -25 795 702 ;
+C 38 ; WX 725 ; N ampersand ; B 60 -12 703 680 ;
+C 39 ; WX 216 ; N quoteright ; B 112 482 265 742 ;
+C 40 ; WX 350 ; N parenleft ; B 106 -128 458 692 ;
+C 41 ; WX 350 ; N parenright ; B -46 -128 306 692 ;
+C 42 ; WX 412 ; N asterisk ; B 106 356 458 707 ;
+C 43 ; WX 570 ; N plus ; B 58 0 542 490 ;
+C 44 ; WX 265 ; N comma ; B 11 -134 173 142 ;
+C 45 ; WX 392 ; N hyphen ; B 82 216 341 286 ;
+C 46 ; WX 265 ; N period ; B 47 -12 169 113 ;
+C 47 ; WX 270 ; N slash ; B 0 -15 341 707 ;
+C 48 ; WX 530 ; N zero ; B 60 -12 541 680 ;
+C 49 ; WX 530 ; N one ; B 74 0 429 680 ;
+C 50 ; WX 530 ; N two ; B -2 0 538 680 ;
+C 51 ; WX 530 ; N three ; B 19 -12 524 680 ;
+C 52 ; WX 530 ; N four ; B 32 0 509 668 ;
+C 53 ; WX 530 ; N five ; B 24 -12 550 668 ;
+C 54 ; WX 530 ; N six ; B 56 -12 551 680 ;
+C 55 ; WX 530 ; N seven ; B 130 -12 600 668 ;
+C 56 ; WX 530 ; N eight ; B 46 -12 535 680 ;
+C 57 ; WX 530 ; N nine ; B 51 -12 536 680 ;
+C 58 ; WX 265 ; N colon ; B 47 -12 248 490 ;
+C 59 ; WX 265 ; N semicolon ; B 11 -134 248 490 ;
+C 60 ; WX 570 ; N less ; B 51 1 529 497 ;
+C 61 ; WX 570 ; N equal ; B 58 111 542 389 ;
+C 62 ; WX 570 ; N greater ; B 51 1 529 497 ;
+C 63 ; WX 425 ; N question ; B 115 -12 456 707 ;
+C 64 ; WX 794 ; N at ; B 88 -15 797 707 ;
+C 65 ; WX 624 ; N A ; B -58 0 623 692 ;
+C 66 ; WX 632 ; N B ; B 3 0 636 692 ;
+C 67 ; WX 661 ; N C ; B 79 -15 723 707 ;
+C 68 ; WX 763 ; N D ; B 5 0 767 692 ;
+C 69 ; WX 596 ; N E ; B 3 0 657 692 ;
+C 70 ; WX 571 ; N F ; B 3 0 660 692 ;
+C 71 ; WX 709 ; N G ; B 79 -15 737 707 ;
+C 72 ; WX 775 ; N H ; B 5 0 857 692 ;
+C 73 ; WX 345 ; N I ; B 5 0 428 692 ;
+C 74 ; WX 352 ; N J ; B -78 -119 436 692 ;
+C 75 ; WX 650 ; N K ; B 5 -5 786 692 ;
+C 76 ; WX 565 ; N L ; B 5 0 568 692 ;
+C 77 ; WX 920 ; N M ; B -4 0 1002 692 ;
+C 78 ; WX 763 ; N N ; B -4 0 855 692 ;
+C 79 ; WX 753 ; N O ; B 79 -15 754 707 ;
+C 80 ; WX 614 ; N P ; B 5 0 646 692 ;
+C 81 ; WX 753 ; N Q ; B 79 -203 754 707 ;
+C 82 ; WX 640 ; N R ; B 5 0 642 692 ;
+C 83 ; WX 533 ; N S ; B 34 -15 542 707 ;
+C 84 ; WX 606 ; N T ; B 102 0 708 692 ;
+C 85 ; WX 794 ; N U ; B 131 -15 880 692 ;
+C 86 ; WX 637 ; N V ; B 96 0 786 692 ;
+C 87 ; WX 946 ; N W ; B 86 0 1075 692 ;
+C 88 ; WX 632 ; N X ; B -36 0 735 692 ;
+C 89 ; WX 591 ; N Y ; B 96 0 744 692 ;
+C 90 ; WX 622 ; N Z ; B -20 0 703 692 ;
+C 91 ; WX 330 ; N bracketleft ; B 69 -128 414 692 ;
+C 92 ; WX 390 ; N backslash ; B 89 -15 371 707 ;
+C 93 ; WX 330 ; N bracketright ; B -21 -128 324 692 ;
+C 94 ; WX 570 ; N asciicircum ; B 83 228 547 668 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 216 ; N quoteleft ; B 130 488 283 748 ;
+C 97 ; WX 561 ; N a ; B 31 -12 563 502 ;
+C 98 ; WX 559 ; N b ; B 47 -12 557 742 ;
+C 99 ; WX 441 ; N c ; B 46 -12 465 502 ;
+C 100 ; WX 587 ; N d ; B 37 -12 612 742 ;
+C 101 ; WX 453 ; N e ; B 45 -12 471 502 ;
+C 102 ; WX 315 ; N f ; B -107 -242 504 742 ; L i fi ; L l fl ;
+C 103 ; WX 499 ; N g ; B -5 -242 573 512 ;
+C 104 ; WX 607 ; N h ; B 57 -12 588 742 ;
+C 105 ; WX 317 ; N i ; B 79 -12 328 715 ;
+C 106 ; WX 309 ; N j ; B -95 -242 330 715 ;
+C 107 ; WX 545 ; N k ; B 57 -12 567 742 ;
+C 108 ; WX 306 ; N l ; B 76 -12 331 742 ;
+C 109 ; WX 912 ; N m ; B 63 -12 894 502 ;
+C 110 ; WX 618 ; N n ; B 63 -12 600 502 ;
+C 111 ; WX 537 ; N o ; B 49 -12 522 502 ;
+C 112 ; WX 590 ; N p ; B 22 -242 586 502 ;
+C 113 ; WX 559 ; N q ; B 38 -242 567 525 ;
+C 114 ; WX 402 ; N r ; B 69 -12 448 502 ;
+C 115 ; WX 389 ; N s ; B 19 -12 397 502 ;
+C 116 ; WX 341 ; N t ; B 84 -12 404 616 ;
+C 117 ; WX 618 ; N u ; B 89 -12 609 502 ;
+C 118 ; WX 510 ; N v ; B 84 -12 528 502 ;
+C 119 ; WX 785 ; N w ; B 87 -12 808 502 ;
+C 120 ; WX 516 ; N x ; B -4 -12 531 502 ;
+C 121 ; WX 468 ; N y ; B -40 -242 505 502 ;
+C 122 ; WX 468 ; N z ; B 4 -12 483 490 ;
+C 123 ; WX 340 ; N braceleft ; B 100 -128 423 692 ;
+C 124 ; WX 270 ; N bar ; B 130 -250 198 750 ;
+C 125 ; WX 340 ; N braceright ; B -20 -128 302 692 ;
+C 126 ; WX 570 ; N asciitilde ; B 98 176 522 318 ;
+C 161 ; WX 240 ; N exclamdown ; B -18 -217 238 502 ;
+C 162 ; WX 530 ; N cent ; B 94 -21 563 669 ;
+C 163 ; WX 530 ; N sterling ; B 9 0 549 680 ;
+C 164 ; WX 100 ; N fraction ; B -201 -24 369 698 ;
+C 165 ; WX 530 ; N yen ; B 72 0 645 668 ;
+C 166 ; WX 530 ; N florin ; B 4 -135 588 691 ;
+C 167 ; WX 530 ; N section ; B 55 -115 533 707 ;
+C 168 ; WX 530 ; N currency ; B 56 90 536 578 ;
+C 169 ; WX 216 ; N quotesingle ; B 161 469 274 742 ;
+C 170 ; WX 402 ; N quotedblleft ; B 134 488 473 748 ;
+C 171 ; WX 462 ; N guillemotleft ; B 79 41 470 435 ;
+C 172 ; WX 277 ; N guilsinglleft ; B 71 41 267 435 ;
+C 173 ; WX 277 ; N guilsinglright ; B 44 41 240 435 ;
+C 174 ; WX 607 ; N fi ; B -107 -242 589 742 ;
+C 175 ; WX 603 ; N fl ; B -107 -242 628 742 ;
+C 177 ; WX 500 ; N endash ; B 12 221 524 279 ;
+C 178 ; WX 500 ; N dagger ; B 101 -125 519 717 ;
+C 179 ; WX 490 ; N daggerdbl ; B 39 -119 509 717 ;
+C 180 ; WX 265 ; N periodcentered ; B 89 187 211 312 ;
+C 182 ; WX 560 ; N paragraph ; B 109 -101 637 692 ;
+C 183 ; WX 500 ; N bullet ; B 110 192 429 512 ;
+C 184 ; WX 216 ; N quotesinglbase ; B -7 -109 146 151 ;
+C 185 ; WX 402 ; N quotedblbase ; B -7 -109 332 151 ;
+C 186 ; WX 402 ; N quotedblright ; B 107 484 446 744 ;
+C 187 ; WX 462 ; N guillemotright ; B 29 41 420 435 ;
+C 188 ; WX 1000 ; N ellipsis ; B 85 -12 873 113 ;
+C 189 ; WX 1200 ; N perthousand ; B 98 -25 1170 702 ;
+C 191 ; WX 425 ; N questiondown ; B 3 -217 344 502 ;
+C 193 ; WX 400 ; N grave ; B 146 542 368 723 ;
+C 194 ; WX 400 ; N acute ; B 214 542 436 723 ;
+C 195 ; WX 400 ; N circumflex ; B 187 546 484 720 ;
+C 196 ; WX 400 ; N tilde ; B 137 563 492 682 ;
+C 197 ; WX 400 ; N macron ; B 193 597 489 656 ;
+C 198 ; WX 400 ; N breve ; B 227 568 501 698 ;
+C 199 ; WX 402 ; N dotaccent ; B 252 570 359 680 ;
+C 200 ; WX 400 ; N dieresis ; B 172 572 487 682 ;
+C 202 ; WX 400 ; N ring ; B 186 550 402 752 ;
+C 203 ; WX 400 ; N cedilla ; B 62 -230 241 0 ;
+C 205 ; WX 400 ; N hungarumlaut ; B 176 546 455 750 ;
+C 206 ; WX 350 ; N ogonek ; B 68 -219 248 0 ;
+C 207 ; WX 400 ; N caron ; B 213 557 510 731 ;
+C 208 ; WX 1000 ; N emdash ; B 12 221 1024 279 ;
+C 225 ; WX 880 ; N AE ; B -88 0 941 692 ;
+C 227 ; WX 425 ; N ordfeminine ; B 77 265 460 590 ;
+C 232 ; WX 571 ; N Lslash ; B 11 0 574 692 ;
+C 233 ; WX 753 ; N Oslash ; B 79 -45 754 736 ;
+C 234 ; WX 1020 ; N OE ; B 79 0 1081 692 ;
+C 235 ; WX 389 ; N ordmasculine ; B 86 265 420 590 ;
+C 241 ; WX 779 ; N ae ; B 34 -12 797 514 ;
+C 245 ; WX 317 ; N dotlessi ; B 79 -12 299 502 ;
+C 248 ; WX 318 ; N lslash ; B 45 -12 376 742 ;
+C 249 ; WX 537 ; N oslash ; B 49 -39 522 529 ;
+C 250 ; WX 806 ; N oe ; B 49 -12 824 502 ;
+C 251 ; WX 577 ; N germandbls ; B -107 -242 630 742 ;
+C -1 ; WX 370 ; N onesuperior ; B 90 272 326 680 ;
+C -1 ; WX 570 ; N minus ; B 58 221 542 279 ;
+C -1 ; WX 400 ; N degree ; B 152 404 428 680 ;
+C -1 ; WX 537 ; N oacute ; B 49 -12 530 723 ;
+C -1 ; WX 753 ; N Odieresis ; B 79 -15 754 848 ;
+C -1 ; WX 537 ; N odieresis ; B 49 -12 532 682 ;
+C -1 ; WX 596 ; N Eacute ; B 3 0 657 890 ;
+C -1 ; WX 618 ; N ucircumflex ; B 89 -12 609 720 ;
+C -1 ; WX 890 ; N onequarter ; B 97 -24 805 698 ;
+C -1 ; WX 570 ; N logicalnot ; B 58 102 542 389 ;
+C -1 ; WX 596 ; N Ecircumflex ; B 3 0 657 876 ;
+C -1 ; WX 890 ; N onehalf ; B 71 -24 812 698 ;
+C -1 ; WX 753 ; N Otilde ; B 79 -15 754 842 ;
+C -1 ; WX 618 ; N uacute ; B 89 -12 609 723 ;
+C -1 ; WX 453 ; N eacute ; B 45 -12 508 723 ;
+C -1 ; WX 317 ; N iacute ; B 79 -12 398 723 ;
+C -1 ; WX 596 ; N Egrave ; B 3 0 657 890 ;
+C -1 ; WX 317 ; N icircumflex ; B 79 -12 383 720 ;
+C -1 ; WX 618 ; N mu ; B 11 -232 609 502 ;
+C -1 ; WX 270 ; N brokenbar ; B 130 -175 198 675 ;
+C -1 ; WX 584 ; N thorn ; B 16 -242 580 700 ;
+C -1 ; WX 624 ; N Aring ; B -58 0 623 861 ;
+C -1 ; WX 468 ; N yacute ; B -40 -242 505 723 ;
+C -1 ; WX 591 ; N Ydieresis ; B 96 0 744 848 ;
+C -1 ; WX 1100 ; N trademark ; B 91 277 1094 692 ;
+C -1 ; WX 836 ; N registered ; B 91 -15 819 707 ;
+C -1 ; WX 537 ; N ocircumflex ; B 49 -12 522 720 ;
+C -1 ; WX 624 ; N Agrave ; B -58 0 623 890 ;
+C -1 ; WX 533 ; N Scaron ; B 34 -15 561 888 ;
+C -1 ; WX 794 ; N Ugrave ; B 131 -15 880 890 ;
+C -1 ; WX 596 ; N Edieresis ; B 3 0 657 848 ;
+C -1 ; WX 794 ; N Uacute ; B 131 -15 880 890 ;
+C -1 ; WX 537 ; N otilde ; B 49 -12 525 682 ;
+C -1 ; WX 618 ; N ntilde ; B 63 -12 600 682 ;
+C -1 ; WX 468 ; N ydieresis ; B -40 -242 513 682 ;
+C -1 ; WX 624 ; N Aacute ; B -58 0 642 890 ;
+C -1 ; WX 537 ; N eth ; B 47 -12 521 742 ;
+C -1 ; WX 561 ; N acircumflex ; B 31 -12 563 720 ;
+C -1 ; WX 561 ; N aring ; B 31 -12 563 752 ;
+C -1 ; WX 753 ; N Ograve ; B 79 -15 754 890 ;
+C -1 ; WX 441 ; N ccedilla ; B 46 -230 465 502 ;
+C -1 ; WX 570 ; N multiply ; B 88 22 532 478 ;
+C -1 ; WX 570 ; N divide ; B 58 25 542 475 ;
+C -1 ; WX 370 ; N twosuperior ; B 35 272 399 680 ;
+C -1 ; WX 763 ; N Ntilde ; B -4 0 855 842 ;
+C -1 ; WX 618 ; N ugrave ; B 89 -12 609 723 ;
+C -1 ; WX 794 ; N Ucircumflex ; B 131 -15 880 876 ;
+C -1 ; WX 624 ; N Atilde ; B -58 0 623 842 ;
+C -1 ; WX 468 ; N zcaron ; B 4 -12 484 731 ;
+C -1 ; WX 317 ; N idieresis ; B 79 -12 398 682 ;
+C -1 ; WX 624 ; N Acircumflex ; B -58 0 623 876 ;
+C -1 ; WX 345 ; N Icircumflex ; B 5 0 453 876 ;
+C -1 ; WX 591 ; N Yacute ; B 96 0 744 890 ;
+C -1 ; WX 753 ; N Oacute ; B 79 -15 754 890 ;
+C -1 ; WX 624 ; N Adieresis ; B -58 0 623 848 ;
+C -1 ; WX 622 ; N Zcaron ; B -20 0 703 888 ;
+C -1 ; WX 561 ; N agrave ; B 31 -12 563 723 ;
+C -1 ; WX 370 ; N threesuperior ; B 59 265 389 680 ;
+C -1 ; WX 537 ; N ograve ; B 49 -12 522 723 ;
+C -1 ; WX 890 ; N threequarters ; B 105 -24 816 698 ;
+C -1 ; WX 770 ; N Eth ; B 12 0 774 692 ;
+C -1 ; WX 570 ; N plusminus ; B 58 0 542 556 ;
+C -1 ; WX 618 ; N udieresis ; B 89 -12 609 682 ;
+C -1 ; WX 453 ; N edieresis ; B 45 -12 490 682 ;
+C -1 ; WX 561 ; N aacute ; B 31 -12 571 723 ;
+C -1 ; WX 317 ; N igrave ; B 55 -12 299 723 ;
+C -1 ; WX 345 ; N Idieresis ; B 5 0 461 848 ;
+C -1 ; WX 561 ; N adieresis ; B 31 -12 563 682 ;
+C -1 ; WX 345 ; N Iacute ; B 5 0 506 890 ;
+C -1 ; WX 836 ; N copyright ; B 91 -15 819 707 ;
+C -1 ; WX 345 ; N Igrave ; B 5 0 428 890 ;
+C -1 ; WX 661 ; N Ccedilla ; B 79 -230 723 707 ;
+C -1 ; WX 389 ; N scaron ; B 19 -12 457 731 ;
+C -1 ; WX 453 ; N egrave ; B 45 -12 471 723 ;
+C -1 ; WX 753 ; N Ocircumflex ; B 79 -15 754 876 ;
+C -1 ; WX 604 ; N Thorn ; B 5 0 616 692 ;
+C -1 ; WX 561 ; N atilde ; B 31 -12 563 682 ;
+C -1 ; WX 794 ; N Udieresis ; B 131 -15 880 848 ;
+C -1 ; WX 453 ; N ecircumflex ; B 45 -12 475 720 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 690
+
+KPX A y -20
+KPX A x 10
+KPX A w -30
+KPX A v -30
+KPX A u -10
+KPX A t -6
+KPX A s 15
+KPX A r -12
+KPX A quoteright -110
+KPX A quotedblright -110
+KPX A q 10
+KPX A p -12
+KPX A o -10
+KPX A n -18
+KPX A m -18
+KPX A l -18
+KPX A j 6
+KPX A h -6
+KPX A d 10
+KPX A c -6
+KPX A b -6
+KPX A a 12
+KPX A Y -76
+KPX A X -8
+KPX A W -80
+KPX A V -90
+KPX A U -60
+KPX A T -72
+KPX A Q -30
+KPX A O -30
+KPX A G -30
+KPX A C -30
+
+KPX B y -6
+KPX B u -20
+KPX B r -15
+KPX B quoteright -40
+KPX B quotedblright -30
+KPX B o 6
+KPX B l -20
+KPX B k -15
+KPX B i -12
+KPX B h -15
+KPX B e 6
+KPX B a 12
+KPX B W -20
+KPX B V -50
+KPX B U -50
+KPX B T -20
+
+KPX C z -6
+KPX C y -18
+KPX C u -18
+KPX C quotedblright 20
+KPX C i -5
+KPX C e -6
+KPX C a -6
+
+KPX D y 18
+KPX D u -10
+KPX D quoteright -40
+KPX D quotedblright -50
+KPX D period -30
+KPX D o 6
+KPX D i 6
+KPX D h -25
+KPX D e 6
+KPX D comma -20
+KPX D a 6
+KPX D Y -70
+KPX D W -50
+KPX D V -60
+
+KPX E z -6
+KPX E y -18
+KPX E x 5
+KPX E w -20
+KPX E v -18
+KPX E u -24
+KPX E t -18
+KPX E s 5
+KPX E r -6
+KPX E quoteright 10
+KPX E quotedblright 10
+KPX E q 10
+KPX E period 10
+KPX E p -12
+KPX E o -6
+KPX E n -12
+KPX E m -12
+KPX E l -12
+KPX E k -10
+KPX E j -6
+KPX E i -12
+KPX E g -12
+KPX E e 5
+KPX E d 10
+KPX E comma 10
+KPX E b -6
+
+KPX F y -12
+KPX F u -30
+KPX F r -18
+KPX F quoteright 15
+KPX F quotedblright 35
+KPX F period -180
+KPX F o -30
+KPX F l -6
+KPX F i -12
+KPX F e -30
+KPX F comma -170
+KPX F a -30
+KPX F A -45
+
+KPX G y -16
+KPX G u -22
+KPX G r -22
+KPX G quoteright -20
+KPX G quotedblright -20
+KPX G o 10
+KPX G n -22
+KPX G l -24
+KPX G i -12
+KPX G h -18
+KPX G e 10
+KPX G a 5
+
+KPX H y -18
+KPX H u -30
+KPX H quoteright 10
+KPX H quotedblright 10
+KPX H o -12
+KPX H i -12
+KPX H e -12
+KPX H a -12
+
+KPX I z -20
+KPX I y -6
+KPX I x -6
+KPX I w -30
+KPX I v -30
+KPX I u -30
+KPX I t -18
+KPX I s -18
+KPX I r -12
+KPX I quoteright 10
+KPX I quotedblright 10
+KPX I p -18
+KPX I o -12
+KPX I n -18
+KPX I m -18
+KPX I l -6
+KPX I k -6
+KPX I g -12
+KPX I f -6
+KPX I d -6
+KPX I c -12
+KPX I b -6
+KPX I a -6
+
+KPX J y -12
+KPX J u -36
+KPX J quoteright 6
+KPX J quotedblright 15
+KPX J o -36
+KPX J i -30
+KPX J e -36
+KPX J braceright 10
+KPX J a -36
+
+KPX K y -40
+KPX K w -30
+KPX K v -20
+KPX K u -24
+KPX K r -12
+KPX K quoteright 25
+KPX K quotedblright 40
+KPX K o -24
+KPX K n -18
+KPX K i -6
+KPX K h 6
+KPX K e -12
+KPX K a -6
+KPX K Q -24
+KPX K O -24
+KPX K G -24
+KPX K C -24
+
+KPX L y -55
+KPX L w -30
+KPX L u -18
+KPX L quoteright -110
+KPX L quotedblright -110
+KPX L l -16
+KPX L j -18
+KPX L i -18
+KPX L a 10
+KPX L Y -80
+KPX L W -90
+KPX L V -110
+KPX L U -42
+KPX L T -80
+KPX L Q -48
+KPX L O -48
+KPX L G -48
+KPX L C -48
+KPX L A 30
+
+KPX M y -18
+KPX M u -24
+KPX M quoteright 6
+KPX M quotedblright 15
+KPX M o -25
+KPX M n -12
+KPX M j -18
+KPX M i -12
+KPX M e -20
+KPX M d -10
+KPX M c -20
+KPX M a -6
+
+KPX N y -18
+KPX N u -24
+KPX N quoteright 10
+KPX N quotedblright 10
+KPX N o -25
+KPX N i -12
+KPX N e -20
+KPX N a -22
+
+KPX O z -6
+KPX O y 12
+KPX O w -10
+KPX O v -10
+KPX O u -6
+KPX O t -6
+KPX O s -6
+KPX O r -6
+KPX O quoteright -40
+KPX O quotedblright -40
+KPX O q 5
+KPX O period -20
+KPX O p -6
+KPX O n -6
+KPX O m -6
+KPX O l -20
+KPX O k -10
+KPX O j -6
+KPX O h -10
+KPX O g -6
+KPX O e 5
+KPX O d 6
+KPX O comma -10
+KPX O c 5
+KPX O b -6
+KPX O a 5
+KPX O Y -75
+KPX O X -30
+KPX O W -40
+KPX O V -60
+KPX O T -48
+KPX O A -18
+
+KPX P y 6
+KPX P u -18
+KPX P t -6
+KPX P s -24
+KPX P r -6
+KPX P period -220
+KPX P o -24
+KPX P n -12
+KPX P l -25
+KPX P h -15
+KPX P e -24
+KPX P comma -220
+KPX P a -24
+KPX P I -30
+KPX P H -30
+KPX P E -30
+KPX P A -75
+
+KPX Q u -6
+KPX Q quoteright -40
+KPX Q quotedblright -50
+KPX Q a -6
+KPX Q Y -70
+KPX Q X -12
+KPX Q W -35
+KPX Q V -60
+KPX Q U -35
+KPX Q T -36
+KPX Q A -18
+
+KPX R y -14
+KPX R u -12
+KPX R quoteright -30
+KPX R quotedblright -20
+KPX R o -12
+KPX R hyphen -20
+KPX R e -12
+KPX R Y -50
+KPX R W -30
+KPX R V -40
+KPX R U -40
+KPX R T -30
+KPX R Q -10
+KPX R O -10
+KPX R G -10
+KPX R C -10
+KPX R A -6
+
+KPX S y -30
+KPX S w -30
+KPX S v -30
+KPX S u -18
+KPX S t -30
+KPX S r -20
+KPX S quoteright -38
+KPX S quotedblright -30
+KPX S p -18
+KPX S n -24
+KPX S m -24
+KPX S l -30
+KPX S k -24
+KPX S j -25
+KPX S i -30
+KPX S h -30
+KPX S e -6
+
+KPX T z -70
+KPX T y -60
+KPX T w -64
+KPX T u -74
+KPX T semicolon -36
+KPX T s -72
+KPX T r -64
+KPX T quoteright 45
+KPX T quotedblright 50
+KPX T period -100
+KPX T parenright 54
+KPX T o -90
+KPX T m -64
+KPX T i -34
+KPX T hyphen -100
+KPX T endash -60
+KPX T emdash -60
+KPX T e -90
+KPX T comma -110
+KPX T colon -10
+KPX T bracketright 45
+KPX T braceright 54
+KPX T a -90
+KPX T Y 12
+KPX T X 18
+KPX T W 6
+KPX T T 18
+KPX T Q -12
+KPX T O -12
+KPX T G -12
+KPX T C -12
+KPX T A -56
+
+KPX U z -30
+KPX U x -40
+KPX U t -24
+KPX U s -30
+KPX U r -30
+KPX U quoteright 10
+KPX U quotedblright 10
+KPX U p -40
+KPX U n -45
+KPX U m -45
+KPX U l -12
+KPX U k -12
+KPX U i -24
+KPX U h -6
+KPX U g -30
+KPX U d -40
+KPX U c -35
+KPX U b -6
+KPX U a -40
+KPX U A -45
+
+KPX V y -46
+KPX V u -42
+KPX V semicolon -35
+KPX V r -50
+KPX V quoteright 75
+KPX V quotedblright 70
+KPX V period -130
+KPX V parenright 64
+KPX V o -62
+KPX V i -10
+KPX V hyphen -60
+KPX V endash -20
+KPX V emdash -20
+KPX V e -52
+KPX V comma -120
+KPX V colon -18
+KPX V bracketright 64
+KPX V braceright 64
+KPX V a -60
+KPX V T 6
+KPX V A -70
+
+KPX W y -42
+KPX W u -56
+KPX W t -20
+KPX W semicolon -28
+KPX W r -40
+KPX W quoteright 55
+KPX W quotedblright 60
+KPX W period -108
+KPX W parenright 64
+KPX W o -60
+KPX W m -35
+KPX W i -10
+KPX W hyphen -40
+KPX W endash -2
+KPX W emdash -10
+KPX W e -54
+KPX W d -50
+KPX W comma -108
+KPX W colon -28
+KPX W bracketright 55
+KPX W braceright 64
+KPX W a -60
+KPX W T 12
+KPX W Q -10
+KPX W O -10
+KPX W G -10
+KPX W C -10
+KPX W A -58
+
+KPX X y -35
+KPX X u -30
+KPX X r -6
+KPX X quoteright 35
+KPX X quotedblright 15
+KPX X i -6
+KPX X e -10
+KPX X a 5
+KPX X Y -6
+KPX X W -6
+KPX X Q -30
+KPX X O -30
+KPX X G -30
+KPX X C -30
+KPX X A -18
+
+KPX Y v -50
+KPX Y u -58
+KPX Y t -32
+KPX Y semicolon -36
+KPX Y quoteright 65
+KPX Y quotedblright 70
+KPX Y q -100
+KPX Y period -90
+KPX Y parenright 60
+KPX Y o -72
+KPX Y l 10
+KPX Y hyphen -95
+KPX Y endash -20
+KPX Y emdash -20
+KPX Y e -72
+KPX Y d -80
+KPX Y comma -80
+KPX Y colon -36
+KPX Y bracketright 64
+KPX Y braceright 75
+KPX Y a -82
+KPX Y Y 12
+KPX Y X 12
+KPX Y W 12
+KPX Y V 6
+KPX Y T 25
+KPX Y Q -5
+KPX Y O -5
+KPX Y G -5
+KPX Y C -5
+KPX Y A -36
+
+KPX Z y -36
+KPX Z w -36
+KPX Z u -12
+KPX Z quoteright 10
+KPX Z quotedblright 10
+KPX Z o -6
+KPX Z i -12
+KPX Z e -6
+KPX Z a -6
+KPX Z Q -30
+KPX Z O -30
+KPX Z G -30
+KPX Z C -30
+KPX Z A 12
+
+KPX a quoteright -40
+KPX a quotedblright -40
+
+KPX b y -6
+KPX b w -15
+KPX b v -15
+KPX b quoteright -50
+KPX b quotedblright -50
+KPX b period -40
+KPX b comma -30
+
+KPX braceleft Y 64
+KPX braceleft W 64
+KPX braceleft V 64
+KPX braceleft T 54
+KPX braceleft J 80
+
+KPX bracketleft Y 64
+KPX bracketleft W 64
+KPX bracketleft V 64
+KPX bracketleft T 54
+KPX bracketleft J 80
+
+KPX c quoteright -20
+KPX c quotedblright -20
+
+KPX colon space -30
+
+KPX comma space -40
+KPX comma quoteright -80
+KPX comma quotedblright -80
+
+KPX d quoteright -12
+KPX d quotedblright -12
+
+KPX e x -10
+KPX e w -10
+KPX e quoteright -30
+KPX e quotedblright -30
+
+KPX f quoteright 110
+KPX f quotedblright 110
+KPX f period -20
+KPX f parenright 100
+KPX f comma -20
+KPX f bracketright 90
+KPX f braceright 90
+
+KPX g y 30
+KPX g p 12
+KPX g f 42
+
+KPX h quoteright -80
+KPX h quotedblright -80
+
+KPX j quoteright -20
+KPX j quotedblright -20
+KPX j period -35
+KPX j comma -20
+
+KPX k quoteright -30
+KPX k quotedblright -50
+
+KPX m quoteright -80
+KPX m quotedblright -80
+
+KPX n quoteright -80
+KPX n quotedblright -80
+
+KPX o z -10
+KPX o y -20
+KPX o x -20
+KPX o w -30
+KPX o v -35
+KPX o quoteright -60
+KPX o quotedblright -50
+KPX o period -30
+KPX o comma -20
+
+KPX p z -10
+KPX p w -15
+KPX p quoteright -50
+KPX p quotedblright -70
+KPX p period -30
+KPX p comma -20
+
+KPX parenleft Y 75
+KPX parenleft W 75
+KPX parenleft V 75
+KPX parenleft T 64
+KPX parenleft J 80
+
+KPX period space -40
+KPX period quoteright -80
+KPX period quotedblright -80
+
+KPX q quoteright -20
+KPX q quotedblright -30
+KPX q period -20
+KPX q comma -10
+
+KPX quotedblleft z -30
+KPX quotedblleft x -40
+KPX quotedblleft w -12
+KPX quotedblleft v -12
+KPX quotedblleft u -12
+KPX quotedblleft t -12
+KPX quotedblleft s -30
+KPX quotedblleft r -12
+KPX quotedblleft q -40
+KPX quotedblleft p -12
+KPX quotedblleft o -30
+KPX quotedblleft n -12
+KPX quotedblleft m -12
+KPX quotedblleft l 10
+KPX quotedblleft k 10
+KPX quotedblleft h 10
+KPX quotedblleft g -30
+KPX quotedblleft e -40
+KPX quotedblleft d -40
+KPX quotedblleft c -40
+KPX quotedblleft b 24
+KPX quotedblleft a -60
+KPX quotedblleft Y 12
+KPX quotedblleft X 28
+KPX quotedblleft W 28
+KPX quotedblleft V 28
+KPX quotedblleft T 36
+KPX quotedblleft A -90
+
+KPX quotedblright space -40
+KPX quotedblright period -100
+KPX quotedblright comma -100
+
+KPX quoteleft z -30
+KPX quoteleft y -10
+KPX quoteleft x -40
+KPX quoteleft w -12
+KPX quoteleft v -12
+KPX quoteleft u -12
+KPX quoteleft t -12
+KPX quoteleft s -30
+KPX quoteleft r -12
+KPX quoteleft quoteleft -18
+KPX quoteleft q -30
+KPX quoteleft p -12
+KPX quoteleft o -30
+KPX quoteleft n -12
+KPX quoteleft m -12
+KPX quoteleft l 10
+KPX quoteleft k 10
+KPX quoteleft h 10
+KPX quoteleft g -30
+KPX quoteleft e -30
+KPX quoteleft d -30
+KPX quoteleft c -30
+KPX quoteleft b 24
+KPX quoteleft a -45
+KPX quoteleft Y 12
+KPX quoteleft X 28
+KPX quoteleft W 28
+KPX quoteleft V 28
+KPX quoteleft T 36
+KPX quoteleft A -90
+
+KPX quoteright v -35
+KPX quoteright t -35
+KPX quoteright space -40
+KPX quoteright s -55
+KPX quoteright r -25
+KPX quoteright quoteright -18
+KPX quoteright period -100
+KPX quoteright m -25
+KPX quoteright l -12
+KPX quoteright d -70
+KPX quoteright comma -100
+
+KPX r y 18
+KPX r w 6
+KPX r v 6
+KPX r t 8
+KPX r quotedblright -15
+KPX r q -24
+KPX r period -120
+KPX r o -6
+KPX r l -20
+KPX r k -20
+KPX r hyphen -30
+KPX r h -20
+KPX r f 8
+KPX r emdash -20
+KPX r e -26
+KPX r d -26
+KPX r comma -110
+KPX r c -12
+KPX r a -20
+
+KPX s quoteright -40
+KPX s quotedblright -45
+
+KPX semicolon space -30
+
+KPX space quotesinglbase -30
+KPX space quoteleft -40
+KPX space quotedblleft -40
+KPX space quotedblbase -30
+KPX space Y -70
+KPX space W -70
+KPX space V -70
+
+KPX t quoteright 10
+KPX t quotedblright -10
+
+KPX u quoteright -55
+KPX u quotedblright -50
+
+KPX v quoteright -20
+KPX v quotedblright -30
+KPX v q -6
+KPX v period -70
+KPX v o -6
+KPX v e -6
+KPX v d -6
+KPX v comma -70
+KPX v c -6
+KPX v a -6
+
+KPX w quoteright -20
+KPX w quotedblright -30
+KPX w period -62
+KPX w comma -62
+
+KPX x y 12
+KPX x w -6
+KPX x quoteright -40
+KPX x quotedblright -50
+KPX x q -6
+KPX x o -6
+KPX x e -6
+KPX x d -6
+KPX x c -6
+
+KPX y quoteright -10
+KPX y quotedblright -20
+KPX y period -70
+KPX y emdash 40
+KPX y comma -60
+
+KPX z quoteright -40
+KPX z quotedblright -50
+KPX z o -6
+KPX z e -6
+KPX z d -6
+KPX z c -6
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pzcmi8a.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pzcmi8a.afm
new file mode 100644
index 0000000..6efb57a
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pzcmi8a.afm
@@ -0,0 +1,480 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Fri Dec 28 16:35:46 1990
+Comment UniqueID 33936
+Comment VMusage 34559 41451
+FontName ZapfChancery-MediumItalic
+FullName ITC Zapf Chancery Medium Italic
+FamilyName ITC Zapf Chancery
+Weight Medium
+ItalicAngle -14
+IsFixedPitch false
+FontBBox -181 -314 1065 831
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.007
+Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.ITC Zapf Chancery is a registered trademark of International Typeface Corporation.
+EncodingScheme AdobeStandardEncoding
+CapHeight 708
+XHeight 438
+Ascender 714
+Descender -314
+StartCharMetrics 228
+C 32 ; WX 220 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 280 ; N exclam ; B 119 -14 353 610 ;
+C 34 ; WX 220 ; N quotedbl ; B 120 343 333 610 ;
+C 35 ; WX 440 ; N numbersign ; B 83 0 521 594 ;
+C 36 ; WX 440 ; N dollar ; B 60 -144 508 709 ;
+C 37 ; WX 680 ; N percent ; B 132 -160 710 700 ;
+C 38 ; WX 780 ; N ampersand ; B 126 -16 915 610 ;
+C 39 ; WX 240 ; N quoteright ; B 168 343 338 610 ;
+C 40 ; WX 260 ; N parenleft ; B 96 -216 411 664 ;
+C 41 ; WX 220 ; N parenright ; B -13 -216 302 664 ;
+C 42 ; WX 420 ; N asterisk ; B 139 263 479 610 ;
+C 43 ; WX 520 ; N plus ; B 117 0 543 426 ;
+C 44 ; WX 220 ; N comma ; B 25 -140 213 148 ;
+C 45 ; WX 280 ; N hyphen ; B 69 190 334 248 ;
+C 46 ; WX 220 ; N period ; B 102 -14 228 128 ;
+C 47 ; WX 340 ; N slash ; B 74 -16 458 610 ;
+C 48 ; WX 440 ; N zero ; B 79 -16 538 610 ;
+C 49 ; WX 440 ; N one ; B 41 0 428 610 ;
+C 50 ; WX 440 ; N two ; B 17 -16 485 610 ;
+C 51 ; WX 440 ; N three ; B 1 -16 485 610 ;
+C 52 ; WX 440 ; N four ; B 77 -35 499 610 ;
+C 53 ; WX 440 ; N five ; B 60 -16 595 679 ;
+C 54 ; WX 440 ; N six ; B 90 -16 556 610 ;
+C 55 ; WX 440 ; N seven ; B 157 -33 561 645 ;
+C 56 ; WX 440 ; N eight ; B 65 -16 529 610 ;
+C 57 ; WX 440 ; N nine ; B 32 -16 517 610 ;
+C 58 ; WX 260 ; N colon ; B 98 -14 296 438 ;
+C 59 ; WX 240 ; N semicolon ; B 29 -140 299 438 ;
+C 60 ; WX 520 ; N less ; B 139 0 527 468 ;
+C 61 ; WX 520 ; N equal ; B 117 86 543 340 ;
+C 62 ; WX 520 ; N greater ; B 139 0 527 468 ;
+C 63 ; WX 380 ; N question ; B 150 -14 455 610 ;
+C 64 ; WX 700 ; N at ; B 127 -16 753 610 ;
+C 65 ; WX 620 ; N A ; B 13 -16 697 632 ;
+C 66 ; WX 600 ; N B ; B 85 -6 674 640 ;
+C 67 ; WX 520 ; N C ; B 93 -16 631 610 ;
+C 68 ; WX 700 ; N D ; B 86 -6 768 640 ;
+C 69 ; WX 620 ; N E ; B 91 -12 709 618 ;
+C 70 ; WX 580 ; N F ; B 120 -118 793 629 ;
+C 71 ; WX 620 ; N G ; B 148 -242 709 610 ;
+C 72 ; WX 680 ; N H ; B 18 -16 878 708 ;
+C 73 ; WX 380 ; N I ; B 99 0 504 594 ;
+C 74 ; WX 400 ; N J ; B -14 -147 538 594 ;
+C 75 ; WX 660 ; N K ; B 53 -153 844 610 ;
+C 76 ; WX 580 ; N L ; B 53 -16 657 610 ;
+C 77 ; WX 840 ; N M ; B 58 -16 1020 722 ;
+C 78 ; WX 700 ; N N ; B 85 -168 915 708 ;
+C 79 ; WX 600 ; N O ; B 94 -16 660 610 ;
+C 80 ; WX 540 ; N P ; B 42 0 658 628 ;
+C 81 ; WX 600 ; N Q ; B 84 -177 775 610 ;
+C 82 ; WX 600 ; N R ; B 58 -168 805 640 ;
+C 83 ; WX 460 ; N S ; B 45 -81 558 610 ;
+C 84 ; WX 500 ; N T ; B 63 0 744 667 ;
+C 85 ; WX 740 ; N U ; B 126 -16 792 617 ;
+C 86 ; WX 640 ; N V ; B 124 -16 810 714 ;
+C 87 ; WX 880 ; N W ; B 94 -16 1046 723 ;
+C 88 ; WX 560 ; N X ; B -30 -16 699 610 ;
+C 89 ; WX 560 ; N Y ; B 41 -168 774 647 ;
+C 90 ; WX 620 ; N Z ; B 42 -19 669 624 ;
+C 91 ; WX 240 ; N bracketleft ; B -13 -207 405 655 ;
+C 92 ; WX 480 ; N backslash ; B 140 -16 524 610 ;
+C 93 ; WX 320 ; N bracketright ; B -27 -207 391 655 ;
+C 94 ; WX 520 ; N asciicircum ; B 132 239 532 594 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 240 ; N quoteleft ; B 169 343 339 610 ;
+C 97 ; WX 420 ; N a ; B 92 -15 485 438 ;
+C 98 ; WX 420 ; N b ; B 82 -23 492 714 ;
+C 99 ; WX 340 ; N c ; B 87 -14 406 438 ;
+C 100 ; WX 440 ; N d ; B 102 -14 651 714 ;
+C 101 ; WX 340 ; N e ; B 87 -14 403 438 ;
+C 102 ; WX 320 ; N f ; B -119 -314 547 714 ; L i fi ; L l fl ;
+C 103 ; WX 400 ; N g ; B -108 -314 503 438 ;
+C 104 ; WX 440 ; N h ; B 55 -14 524 714 ;
+C 105 ; WX 240 ; N i ; B 100 -14 341 635 ;
+C 106 ; WX 220 ; N j ; B -112 -314 332 635 ;
+C 107 ; WX 440 ; N k ; B 87 -184 628 714 ;
+C 108 ; WX 240 ; N l ; B 102 -14 480 714 ;
+C 109 ; WX 620 ; N m ; B 86 -14 704 438 ;
+C 110 ; WX 460 ; N n ; B 101 -14 544 438 ;
+C 111 ; WX 400 ; N o ; B 87 -14 449 438 ;
+C 112 ; WX 440 ; N p ; B -23 -314 484 432 ;
+C 113 ; WX 400 ; N q ; B 87 -300 490 510 ;
+C 114 ; WX 300 ; N r ; B 101 -14 424 438 ;
+C 115 ; WX 320 ; N s ; B 46 -14 403 438 ;
+C 116 ; WX 320 ; N t ; B 106 -14 426 539 ;
+C 117 ; WX 460 ; N u ; B 102 -14 528 438 ;
+C 118 ; WX 440 ; N v ; B 87 -14 533 488 ;
+C 119 ; WX 680 ; N w ; B 87 -14 782 488 ;
+C 120 ; WX 420 ; N x ; B 70 -195 589 438 ;
+C 121 ; WX 400 ; N y ; B -24 -314 483 438 ;
+C 122 ; WX 440 ; N z ; B 26 -14 508 445 ;
+C 123 ; WX 240 ; N braceleft ; B 55 -207 383 655 ;
+C 124 ; WX 520 ; N bar ; B 320 -16 378 714 ;
+C 125 ; WX 240 ; N braceright ; B -10 -207 318 655 ;
+C 126 ; WX 520 ; N asciitilde ; B 123 186 539 320 ;
+C 161 ; WX 280 ; N exclamdown ; B 72 -186 306 438 ;
+C 162 ; WX 440 ; N cent ; B 122 -134 476 543 ;
+C 163 ; WX 440 ; N sterling ; B -16 -52 506 610 ;
+C 164 ; WX 60 ; N fraction ; B -181 -16 320 610 ;
+C 165 ; WX 440 ; N yen ; B -1 -168 613 647 ;
+C 166 ; WX 440 ; N florin ; B -64 -314 582 610 ;
+C 167 ; WX 420 ; N section ; B 53 -215 514 610 ;
+C 168 ; WX 440 ; N currency ; B 50 85 474 509 ;
+C 169 ; WX 160 ; N quotesingle ; B 145 343 215 610 ;
+C 170 ; WX 340 ; N quotedblleft ; B 169 343 464 610 ;
+C 171 ; WX 340 ; N guillemotleft ; B 98 24 356 414 ;
+C 172 ; WX 240 ; N guilsinglleft ; B 98 24 258 414 ;
+C 173 ; WX 260 ; N guilsinglright ; B 106 24 266 414 ;
+C 174 ; WX 520 ; N fi ; B -124 -314 605 714 ;
+C 175 ; WX 520 ; N fl ; B -124 -314 670 714 ;
+C 177 ; WX 500 ; N endash ; B 51 199 565 239 ;
+C 178 ; WX 460 ; N dagger ; B 138 -37 568 610 ;
+C 179 ; WX 480 ; N daggerdbl ; B 138 -59 533 610 ;
+C 180 ; WX 220 ; N periodcentered ; B 139 208 241 310 ;
+C 182 ; WX 500 ; N paragraph ; B 105 -199 638 594 ;
+C 183 ; WX 600 ; N bullet ; B 228 149 524 445 ;
+C 184 ; WX 180 ; N quotesinglbase ; B 21 -121 191 146 ;
+C 185 ; WX 280 ; N quotedblbase ; B -14 -121 281 146 ;
+C 186 ; WX 360 ; N quotedblright ; B 158 343 453 610 ;
+C 187 ; WX 380 ; N guillemotright ; B 117 24 375 414 ;
+C 188 ; WX 1000 ; N ellipsis ; B 124 -14 916 128 ;
+C 189 ; WX 960 ; N perthousand ; B 112 -160 1005 700 ;
+C 191 ; WX 400 ; N questiondown ; B 82 -186 387 438 ;
+C 193 ; WX 220 ; N grave ; B 193 492 339 659 ;
+C 194 ; WX 300 ; N acute ; B 265 492 422 659 ;
+C 195 ; WX 340 ; N circumflex ; B 223 482 443 649 ;
+C 196 ; WX 440 ; N tilde ; B 243 543 522 619 ;
+C 197 ; WX 440 ; N macron ; B 222 544 465 578 ;
+C 198 ; WX 440 ; N breve ; B 253 522 501 631 ;
+C 199 ; WX 220 ; N dotaccent ; B 236 522 328 610 ;
+C 200 ; WX 360 ; N dieresis ; B 243 522 469 610 ;
+C 202 ; WX 300 ; N ring ; B 240 483 416 659 ;
+C 203 ; WX 300 ; N cedilla ; B 12 -191 184 6 ;
+C 205 ; WX 400 ; N hungarumlaut ; B 208 492 495 659 ;
+C 206 ; WX 280 ; N ogonek ; B 38 -191 233 6 ;
+C 207 ; WX 340 ; N caron ; B 254 492 474 659 ;
+C 208 ; WX 1000 ; N emdash ; B 51 199 1065 239 ;
+C 225 ; WX 740 ; N AE ; B -21 -16 799 594 ;
+C 227 ; WX 260 ; N ordfeminine ; B 111 338 386 610 ;
+C 232 ; WX 580 ; N Lslash ; B 49 -16 657 610 ;
+C 233 ; WX 660 ; N Oslash ; B 83 -78 751 672 ;
+C 234 ; WX 820 ; N OE ; B 63 -16 909 610 ;
+C 235 ; WX 260 ; N ordmasculine ; B 128 339 373 610 ;
+C 241 ; WX 540 ; N ae ; B 67 -14 624 468 ;
+C 245 ; WX 240 ; N dotlessi ; B 100 -14 306 438 ;
+C 248 ; WX 300 ; N lslash ; B 121 -14 515 714 ;
+C 249 ; WX 440 ; N oslash ; B 46 -64 540 488 ;
+C 250 ; WX 560 ; N oe ; B 78 -14 628 438 ;
+C 251 ; WX 420 ; N germandbls ; B -127 -314 542 714 ;
+C -1 ; WX 340 ; N ecircumflex ; B 87 -14 433 649 ;
+C -1 ; WX 340 ; N edieresis ; B 87 -14 449 610 ;
+C -1 ; WX 420 ; N aacute ; B 92 -15 492 659 ;
+C -1 ; WX 740 ; N registered ; B 137 -16 763 610 ;
+C -1 ; WX 240 ; N icircumflex ; B 100 -14 363 649 ;
+C -1 ; WX 460 ; N udieresis ; B 102 -14 528 610 ;
+C -1 ; WX 400 ; N ograve ; B 87 -14 449 659 ;
+C -1 ; WX 460 ; N uacute ; B 102 -14 528 659 ;
+C -1 ; WX 460 ; N ucircumflex ; B 102 -14 528 649 ;
+C -1 ; WX 620 ; N Aacute ; B 13 -16 702 821 ;
+C -1 ; WX 240 ; N igrave ; B 100 -14 306 659 ;
+C -1 ; WX 380 ; N Icircumflex ; B 99 0 504 821 ;
+C -1 ; WX 340 ; N ccedilla ; B 62 -191 406 438 ;
+C -1 ; WX 420 ; N adieresis ; B 92 -15 485 610 ;
+C -1 ; WX 620 ; N Ecircumflex ; B 91 -12 709 821 ;
+C -1 ; WX 320 ; N scaron ; B 46 -14 464 659 ;
+C -1 ; WX 440 ; N thorn ; B -38 -314 505 714 ;
+C -1 ; WX 1000 ; N trademark ; B 127 187 1046 594 ;
+C -1 ; WX 340 ; N egrave ; B 87 -14 403 659 ;
+C -1 ; WX 264 ; N threesuperior ; B 59 234 348 610 ;
+C -1 ; WX 440 ; N zcaron ; B 26 -14 514 659 ;
+C -1 ; WX 420 ; N atilde ; B 92 -15 522 619 ;
+C -1 ; WX 420 ; N aring ; B 92 -15 485 659 ;
+C -1 ; WX 400 ; N ocircumflex ; B 87 -14 453 649 ;
+C -1 ; WX 620 ; N Edieresis ; B 91 -12 709 762 ;
+C -1 ; WX 660 ; N threequarters ; B 39 -16 706 610 ;
+C -1 ; WX 400 ; N ydieresis ; B -24 -314 483 610 ;
+C -1 ; WX 400 ; N yacute ; B -24 -314 483 659 ;
+C -1 ; WX 240 ; N iacute ; B 100 -14 392 659 ;
+C -1 ; WX 620 ; N Acircumflex ; B 13 -16 697 821 ;
+C -1 ; WX 740 ; N Uacute ; B 126 -16 792 821 ;
+C -1 ; WX 340 ; N eacute ; B 87 -14 462 659 ;
+C -1 ; WX 600 ; N Ograve ; B 94 -16 660 821 ;
+C -1 ; WX 420 ; N agrave ; B 92 -15 485 659 ;
+C -1 ; WX 740 ; N Udieresis ; B 126 -16 792 762 ;
+C -1 ; WX 420 ; N acircumflex ; B 92 -15 485 649 ;
+C -1 ; WX 380 ; N Igrave ; B 99 0 504 821 ;
+C -1 ; WX 264 ; N twosuperior ; B 72 234 354 610 ;
+C -1 ; WX 740 ; N Ugrave ; B 126 -16 792 821 ;
+C -1 ; WX 660 ; N onequarter ; B 56 -16 702 610 ;
+C -1 ; WX 740 ; N Ucircumflex ; B 126 -16 792 821 ;
+C -1 ; WX 460 ; N Scaron ; B 45 -81 594 831 ;
+C -1 ; WX 380 ; N Idieresis ; B 99 0 519 762 ;
+C -1 ; WX 240 ; N idieresis ; B 100 -14 369 610 ;
+C -1 ; WX 620 ; N Egrave ; B 91 -12 709 821 ;
+C -1 ; WX 600 ; N Oacute ; B 94 -16 660 821 ;
+C -1 ; WX 520 ; N divide ; B 117 -14 543 440 ;
+C -1 ; WX 620 ; N Atilde ; B 13 -16 702 771 ;
+C -1 ; WX 620 ; N Aring ; B 13 -16 697 831 ;
+C -1 ; WX 600 ; N Odieresis ; B 94 -16 660 762 ;
+C -1 ; WX 620 ; N Adieresis ; B 13 -16 709 762 ;
+C -1 ; WX 700 ; N Ntilde ; B 85 -168 915 761 ;
+C -1 ; WX 620 ; N Zcaron ; B 42 -19 669 831 ;
+C -1 ; WX 540 ; N Thorn ; B 52 0 647 623 ;
+C -1 ; WX 380 ; N Iacute ; B 99 0 532 821 ;
+C -1 ; WX 520 ; N plusminus ; B 117 0 543 436 ;
+C -1 ; WX 520 ; N multiply ; B 133 16 527 410 ;
+C -1 ; WX 620 ; N Eacute ; B 91 -12 709 821 ;
+C -1 ; WX 560 ; N Ydieresis ; B 41 -168 774 762 ;
+C -1 ; WX 264 ; N onesuperior ; B 83 244 311 610 ;
+C -1 ; WX 460 ; N ugrave ; B 102 -14 528 659 ;
+C -1 ; WX 520 ; N logicalnot ; B 117 86 543 340 ;
+C -1 ; WX 460 ; N ntilde ; B 101 -14 544 619 ;
+C -1 ; WX 600 ; N Otilde ; B 94 -16 660 761 ;
+C -1 ; WX 400 ; N otilde ; B 87 -14 502 619 ;
+C -1 ; WX 520 ; N Ccedilla ; B 93 -191 631 610 ;
+C -1 ; WX 620 ; N Agrave ; B 13 -16 697 821 ;
+C -1 ; WX 660 ; N onehalf ; B 56 -16 702 610 ;
+C -1 ; WX 700 ; N Eth ; B 86 -6 768 640 ;
+C -1 ; WX 400 ; N degree ; B 171 324 457 610 ;
+C -1 ; WX 560 ; N Yacute ; B 41 -168 774 821 ;
+C -1 ; WX 600 ; N Ocircumflex ; B 94 -16 660 821 ;
+C -1 ; WX 400 ; N oacute ; B 87 -14 482 659 ;
+C -1 ; WX 460 ; N mu ; B 7 -314 523 438 ;
+C -1 ; WX 520 ; N minus ; B 117 184 543 242 ;
+C -1 ; WX 400 ; N eth ; B 87 -14 522 714 ;
+C -1 ; WX 400 ; N odieresis ; B 87 -14 479 610 ;
+C -1 ; WX 740 ; N copyright ; B 137 -16 763 610 ;
+C -1 ; WX 520 ; N brokenbar ; B 320 -16 378 714 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 131
+
+KPX A quoteright -40
+KPX A quotedblright -40
+KPX A U -10
+KPX A T 10
+KPX A Q 10
+KPX A O 10
+KPX A G -30
+KPX A C 20
+
+KPX D period -30
+KPX D comma -20
+KPX D Y 10
+KPX D A -10
+
+KPX F period -40
+KPX F i 10
+KPX F comma -30
+
+KPX G period -20
+KPX G comma -10
+
+KPX J period -20
+KPX J comma -10
+
+KPX K u -20
+KPX K o -20
+KPX K e -20
+
+KPX L y -10
+KPX L quoteright -25
+KPX L quotedblright -25
+KPX L W -10
+KPX L V -20
+
+KPX O period -20
+KPX O comma -10
+KPX O Y 10
+KPX O T 20
+KPX O A -20
+
+KPX P period -50
+KPX P o -10
+KPX P e -10
+KPX P comma -40
+KPX P a -20
+KPX P A -10
+
+KPX Q U -10
+
+KPX R Y 10
+KPX R W 10
+KPX R T 20
+
+KPX T o -20
+KPX T i 20
+KPX T hyphen -20
+KPX T h 20
+KPX T e -20
+KPX T a -20
+KPX T O 30
+KPX T A 10
+
+KPX V period -100
+KPX V o -20
+KPX V e -20
+KPX V comma -90
+KPX V a -20
+KPX V O 10
+KPX V G -20
+
+KPX W period -50
+KPX W o -20
+KPX W i 10
+KPX W h 10
+KPX W e -20
+KPX W comma -40
+KPX W a -20
+KPX W O 10
+
+KPX Y u -20
+KPX Y period -50
+KPX Y o -50
+KPX Y i 10
+KPX Y e -40
+KPX Y comma -40
+KPX Y a -60
+
+KPX b period -30
+KPX b l -20
+KPX b comma -20
+KPX b b -20
+
+KPX c k -10
+
+KPX comma quoteright -70
+KPX comma quotedblright -70
+
+KPX d w -20
+KPX d v -10
+KPX d d -40
+
+KPX e y 10
+
+KPX f quoteright 30
+KPX f quotedblright 30
+KPX f period -50
+KPX f f -50
+KPX f e -10
+KPX f comma -40
+KPX f a -20
+
+KPX g y 10
+KPX g period -30
+KPX g i 10
+KPX g e 10
+KPX g comma -20
+KPX g a 10
+
+KPX k y 10
+KPX k o -10
+KPX k e -20
+
+KPX m y 10
+KPX m u 10
+
+KPX n y 20
+
+KPX o period -30
+KPX o comma -20
+
+KPX p period -30
+KPX p p -10
+KPX p comma -20
+
+KPX period quoteright -80
+KPX period quotedblright -80
+
+KPX quotedblleft quoteleft 20
+KPX quotedblleft A 10
+
+KPX quoteleft quoteleft -115
+KPX quoteleft A 10
+
+KPX quoteright v 30
+KPX quoteright t 20
+KPX quoteright s -25
+KPX quoteright r 30
+KPX quoteright quoteright -115
+KPX quoteright quotedblright 20
+KPX quoteright l 20
+
+KPX r period -50
+KPX r i 10
+KPX r comma -40
+
+KPX s period -20
+KPX s comma -10
+
+KPX v period -30
+KPX v comma -20
+
+KPX w period -30
+KPX w o 10
+KPX w h 20
+KPX w comma -20
+EndKernPairs
+EndKernData
+StartComposites 56
+CC Aacute 2 ; PCC A 0 0 ; PCC acute 280 162 ;
+CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 240 172 ;
+CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 240 152 ;
+CC Agrave 2 ; PCC A 0 0 ; PCC grave 250 162 ;
+CC Aring 2 ; PCC A 0 0 ; PCC ring 260 172 ;
+CC Atilde 2 ; PCC A 0 0 ; PCC tilde 180 152 ;
+CC Eacute 2 ; PCC E 0 0 ; PCC acute 230 162 ;
+CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 180 172 ;
+CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 170 152 ;
+CC Egrave 2 ; PCC E 0 0 ; PCC grave 220 162 ;
+CC Iacute 2 ; PCC I 0 0 ; PCC acute 110 162 ;
+CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 60 172 ;
+CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 50 152 ;
+CC Igrave 2 ; PCC I 0 0 ; PCC grave 100 162 ;
+CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 210 142 ;
+CC Oacute 2 ; PCC O 0 0 ; PCC acute 160 162 ;
+CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 130 172 ;
+CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 120 152 ;
+CC Ograve 2 ; PCC O 0 0 ; PCC grave 150 162 ;
+CC Otilde 2 ; PCC O 0 0 ; PCC tilde 90 142 ;
+CC Scaron 2 ; PCC S 0 0 ; PCC caron 120 172 ;
+CC Uacute 2 ; PCC U 0 0 ; PCC acute 310 162 ;
+CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 260 172 ;
+CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 260 152 ;
+CC Ugrave 2 ; PCC U 0 0 ; PCC grave 270 162 ;
+CC Yacute 2 ; PCC Y 0 0 ; PCC acute 220 162 ;
+CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 170 152 ;
+CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 130 172 ;
+CC aacute 2 ; PCC a 0 0 ; PCC acute 70 0 ;
+CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 20 0 ;
+CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 10 0 ;
+CC agrave 2 ; PCC a 0 0 ; PCC grave 80 0 ;
+CC aring 2 ; PCC a 0 0 ; PCC ring 60 0 ;
+CC atilde 2 ; PCC a 0 0 ; PCC tilde 0 0 ;
+CC eacute 2 ; PCC e 0 0 ; PCC acute 40 0 ;
+CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex -10 0 ;
+CC edieresis 2 ; PCC e 0 0 ; PCC dieresis -20 0 ;
+CC egrave 2 ; PCC e 0 0 ; PCC grave 30 0 ;
+CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -30 0 ;
+CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -80 0 ;
+CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -100 0 ;
+CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -40 0 ;
+CC ntilde 2 ; PCC n 0 0 ; PCC tilde 10 0 ;
+CC oacute 2 ; PCC o 0 0 ; PCC acute 60 0 ;
+CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 10 0 ;
+CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 10 0 ;
+CC ograve 2 ; PCC o 0 0 ; PCC grave 60 0 ;
+CC otilde 2 ; PCC o 0 0 ; PCC tilde -20 0 ;
+CC scaron 2 ; PCC s 0 0 ; PCC caron -10 0 ;
+CC uacute 2 ; PCC u 0 0 ; PCC acute 70 0 ;
+CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 30 0 ;
+CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 20 0 ;
+CC ugrave 2 ; PCC u 0 0 ; PCC grave 50 0 ;
+CC yacute 2 ; PCC y 0 0 ; PCC acute 60 0 ;
+CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 0 0 ;
+CC zcaron 2 ; PCC z 0 0 ; PCC caron 40 0 ;
+EndComposites
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pzdr.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pzdr.afm
new file mode 100644
index 0000000..6b98e8d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/afm/pzdr.afm
@@ -0,0 +1,222 @@
+StartFontMetrics 2.0
+Comment Copyright (c) 1985, 1987, 1988, 1989 Adobe Systems Incorporated. All rights reserved.
+Comment Creation Date: Fri Dec 1 12:57:42 1989
+Comment UniqueID 26200
+Comment VMusage 39281 49041
+FontName ZapfDingbats
+FullName ITC Zapf Dingbats
+FamilyName ITC Zapf Dingbats
+Weight Medium
+ItalicAngle 0
+IsFixedPitch false
+FontBBox -1 -143 981 820
+UnderlinePosition -98
+UnderlineThickness 54
+Version 001.004
+Notice Copyright (c) 1985, 1987, 1988, 1989 Adobe Systems Incorporated. All rights reserved.ITC Zapf Dingbats is a registered trademark of International Typeface Corporation.
+EncodingScheme FontSpecific
+StartCharMetrics 202
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 974 ; N a1 ; B 35 72 939 621 ;
+C 34 ; WX 961 ; N a2 ; B 35 81 927 611 ;
+C 35 ; WX 974 ; N a202 ; B 35 72 939 621 ;
+C 36 ; WX 980 ; N a3 ; B 35 0 945 692 ;
+C 37 ; WX 719 ; N a4 ; B 34 139 685 566 ;
+C 38 ; WX 789 ; N a5 ; B 35 -14 755 705 ;
+C 39 ; WX 790 ; N a119 ; B 35 -14 755 705 ;
+C 40 ; WX 791 ; N a118 ; B 35 -13 761 705 ;
+C 41 ; WX 690 ; N a117 ; B 35 138 655 553 ;
+C 42 ; WX 960 ; N a11 ; B 35 123 925 568 ;
+C 43 ; WX 939 ; N a12 ; B 35 134 904 559 ;
+C 44 ; WX 549 ; N a13 ; B 29 -11 516 705 ;
+C 45 ; WX 855 ; N a14 ; B 34 59 820 632 ;
+C 46 ; WX 911 ; N a15 ; B 35 50 876 642 ;
+C 47 ; WX 933 ; N a16 ; B 35 139 899 550 ;
+C 48 ; WX 911 ; N a105 ; B 35 50 876 642 ;
+C 49 ; WX 945 ; N a17 ; B 35 139 909 553 ;
+C 50 ; WX 974 ; N a18 ; B 35 104 938 587 ;
+C 51 ; WX 755 ; N a19 ; B 34 -13 721 705 ;
+C 52 ; WX 846 ; N a20 ; B 36 -14 811 705 ;
+C 53 ; WX 762 ; N a21 ; B 35 0 727 692 ;
+C 54 ; WX 761 ; N a22 ; B 35 0 727 692 ;
+C 55 ; WX 571 ; N a23 ; B -1 -68 571 661 ;
+C 56 ; WX 677 ; N a24 ; B 36 -13 642 705 ;
+C 57 ; WX 763 ; N a25 ; B 35 0 728 692 ;
+C 58 ; WX 760 ; N a26 ; B 35 0 726 692 ;
+C 59 ; WX 759 ; N a27 ; B 35 0 725 692 ;
+C 60 ; WX 754 ; N a28 ; B 35 0 720 692 ;
+C 61 ; WX 494 ; N a6 ; B 35 0 460 692 ;
+C 62 ; WX 552 ; N a7 ; B 35 0 517 692 ;
+C 63 ; WX 537 ; N a8 ; B 35 0 503 692 ;
+C 64 ; WX 577 ; N a9 ; B 35 96 542 596 ;
+C 65 ; WX 692 ; N a10 ; B 35 -14 657 705 ;
+C 66 ; WX 786 ; N a29 ; B 35 -14 751 705 ;
+C 67 ; WX 788 ; N a30 ; B 35 -14 752 705 ;
+C 68 ; WX 788 ; N a31 ; B 35 -14 753 705 ;
+C 69 ; WX 790 ; N a32 ; B 35 -14 756 705 ;
+C 70 ; WX 793 ; N a33 ; B 35 -13 759 705 ;
+C 71 ; WX 794 ; N a34 ; B 35 -13 759 705 ;
+C 72 ; WX 816 ; N a35 ; B 35 -14 782 705 ;
+C 73 ; WX 823 ; N a36 ; B 35 -14 787 705 ;
+C 74 ; WX 789 ; N a37 ; B 35 -14 754 705 ;
+C 75 ; WX 841 ; N a38 ; B 35 -14 807 705 ;
+C 76 ; WX 823 ; N a39 ; B 35 -14 789 705 ;
+C 77 ; WX 833 ; N a40 ; B 35 -14 798 705 ;
+C 78 ; WX 816 ; N a41 ; B 35 -13 782 705 ;
+C 79 ; WX 831 ; N a42 ; B 35 -14 796 705 ;
+C 80 ; WX 923 ; N a43 ; B 35 -14 888 705 ;
+C 81 ; WX 744 ; N a44 ; B 35 0 710 692 ;
+C 82 ; WX 723 ; N a45 ; B 35 0 688 692 ;
+C 83 ; WX 749 ; N a46 ; B 35 0 714 692 ;
+C 84 ; WX 790 ; N a47 ; B 34 -14 756 705 ;
+C 85 ; WX 792 ; N a48 ; B 35 -14 758 705 ;
+C 86 ; WX 695 ; N a49 ; B 35 -14 661 706 ;
+C 87 ; WX 776 ; N a50 ; B 35 -6 741 699 ;
+C 88 ; WX 768 ; N a51 ; B 35 -7 734 699 ;
+C 89 ; WX 792 ; N a52 ; B 35 -14 757 705 ;
+C 90 ; WX 759 ; N a53 ; B 35 0 725 692 ;
+C 91 ; WX 707 ; N a54 ; B 35 -13 672 704 ;
+C 92 ; WX 708 ; N a55 ; B 35 -14 672 705 ;
+C 93 ; WX 682 ; N a56 ; B 35 -14 647 705 ;
+C 94 ; WX 701 ; N a57 ; B 35 -14 666 705 ;
+C 95 ; WX 826 ; N a58 ; B 35 -14 791 705 ;
+C 96 ; WX 815 ; N a59 ; B 35 -14 780 705 ;
+C 97 ; WX 789 ; N a60 ; B 35 -14 754 705 ;
+C 98 ; WX 789 ; N a61 ; B 35 -14 754 705 ;
+C 99 ; WX 707 ; N a62 ; B 34 -14 673 705 ;
+C 100 ; WX 687 ; N a63 ; B 36 0 651 692 ;
+C 101 ; WX 696 ; N a64 ; B 35 0 661 691 ;
+C 102 ; WX 689 ; N a65 ; B 35 0 655 692 ;
+C 103 ; WX 786 ; N a66 ; B 34 -14 751 705 ;
+C 104 ; WX 787 ; N a67 ; B 35 -14 752 705 ;
+C 105 ; WX 713 ; N a68 ; B 35 -14 678 705 ;
+C 106 ; WX 791 ; N a69 ; B 35 -14 756 705 ;
+C 107 ; WX 785 ; N a70 ; B 36 -14 751 705 ;
+C 108 ; WX 791 ; N a71 ; B 35 -14 757 705 ;
+C 109 ; WX 873 ; N a72 ; B 35 -14 838 705 ;
+C 110 ; WX 761 ; N a73 ; B 35 0 726 692 ;
+C 111 ; WX 762 ; N a74 ; B 35 0 727 692 ;
+C 112 ; WX 762 ; N a203 ; B 35 0 727 692 ;
+C 113 ; WX 759 ; N a75 ; B 35 0 725 692 ;
+C 114 ; WX 759 ; N a204 ; B 35 0 725 692 ;
+C 115 ; WX 892 ; N a76 ; B 35 0 858 705 ;
+C 116 ; WX 892 ; N a77 ; B 35 -14 858 692 ;
+C 117 ; WX 788 ; N a78 ; B 35 -14 754 705 ;
+C 118 ; WX 784 ; N a79 ; B 35 -14 749 705 ;
+C 119 ; WX 438 ; N a81 ; B 35 -14 403 705 ;
+C 120 ; WX 138 ; N a82 ; B 35 0 104 692 ;
+C 121 ; WX 277 ; N a83 ; B 35 0 242 692 ;
+C 122 ; WX 415 ; N a84 ; B 35 0 380 692 ;
+C 123 ; WX 392 ; N a97 ; B 35 263 357 705 ;
+C 124 ; WX 392 ; N a98 ; B 34 263 357 705 ;
+C 125 ; WX 668 ; N a99 ; B 35 263 633 705 ;
+C 126 ; WX 668 ; N a100 ; B 36 263 634 705 ;
+C 161 ; WX 732 ; N a101 ; B 35 -143 697 806 ;
+C 162 ; WX 544 ; N a102 ; B 56 -14 488 706 ;
+C 163 ; WX 544 ; N a103 ; B 34 -14 508 705 ;
+C 164 ; WX 910 ; N a104 ; B 35 40 875 651 ;
+C 165 ; WX 667 ; N a106 ; B 35 -14 633 705 ;
+C 166 ; WX 760 ; N a107 ; B 35 -14 726 705 ;
+C 167 ; WX 760 ; N a108 ; B 0 121 758 569 ;
+C 168 ; WX 776 ; N a112 ; B 35 0 741 705 ;
+C 169 ; WX 595 ; N a111 ; B 34 -14 560 705 ;
+C 170 ; WX 694 ; N a110 ; B 35 -14 659 705 ;
+C 171 ; WX 626 ; N a109 ; B 34 0 591 705 ;
+C 172 ; WX 788 ; N a120 ; B 35 -14 754 705 ;
+C 173 ; WX 788 ; N a121 ; B 35 -14 754 705 ;
+C 174 ; WX 788 ; N a122 ; B 35 -14 754 705 ;
+C 175 ; WX 788 ; N a123 ; B 35 -14 754 705 ;
+C 176 ; WX 788 ; N a124 ; B 35 -14 754 705 ;
+C 177 ; WX 788 ; N a125 ; B 35 -14 754 705 ;
+C 178 ; WX 788 ; N a126 ; B 35 -14 754 705 ;
+C 179 ; WX 788 ; N a127 ; B 35 -14 754 705 ;
+C 180 ; WX 788 ; N a128 ; B 35 -14 754 705 ;
+C 181 ; WX 788 ; N a129 ; B 35 -14 754 705 ;
+C 182 ; WX 788 ; N a130 ; B 35 -14 754 705 ;
+C 183 ; WX 788 ; N a131 ; B 35 -14 754 705 ;
+C 184 ; WX 788 ; N a132 ; B 35 -14 754 705 ;
+C 185 ; WX 788 ; N a133 ; B 35 -14 754 705 ;
+C 186 ; WX 788 ; N a134 ; B 35 -14 754 705 ;
+C 187 ; WX 788 ; N a135 ; B 35 -14 754 705 ;
+C 188 ; WX 788 ; N a136 ; B 35 -14 754 705 ;
+C 189 ; WX 788 ; N a137 ; B 35 -14 754 705 ;
+C 190 ; WX 788 ; N a138 ; B 35 -14 754 705 ;
+C 191 ; WX 788 ; N a139 ; B 35 -14 754 705 ;
+C 192 ; WX 788 ; N a140 ; B 35 -14 754 705 ;
+C 193 ; WX 788 ; N a141 ; B 35 -14 754 705 ;
+C 194 ; WX 788 ; N a142 ; B 35 -14 754 705 ;
+C 195 ; WX 788 ; N a143 ; B 35 -14 754 705 ;
+C 196 ; WX 788 ; N a144 ; B 35 -14 754 705 ;
+C 197 ; WX 788 ; N a145 ; B 35 -14 754 705 ;
+C 198 ; WX 788 ; N a146 ; B 35 -14 754 705 ;
+C 199 ; WX 788 ; N a147 ; B 35 -14 754 705 ;
+C 200 ; WX 788 ; N a148 ; B 35 -14 754 705 ;
+C 201 ; WX 788 ; N a149 ; B 35 -14 754 705 ;
+C 202 ; WX 788 ; N a150 ; B 35 -14 754 705 ;
+C 203 ; WX 788 ; N a151 ; B 35 -14 754 705 ;
+C 204 ; WX 788 ; N a152 ; B 35 -14 754 705 ;
+C 205 ; WX 788 ; N a153 ; B 35 -14 754 705 ;
+C 206 ; WX 788 ; N a154 ; B 35 -14 754 705 ;
+C 207 ; WX 788 ; N a155 ; B 35 -14 754 705 ;
+C 208 ; WX 788 ; N a156 ; B 35 -14 754 705 ;
+C 209 ; WX 788 ; N a157 ; B 35 -14 754 705 ;
+C 210 ; WX 788 ; N a158 ; B 35 -14 754 705 ;
+C 211 ; WX 788 ; N a159 ; B 35 -14 754 705 ;
+C 212 ; WX 894 ; N a160 ; B 35 58 860 634 ;
+C 213 ; WX 838 ; N a161 ; B 35 152 803 540 ;
+C 214 ; WX 1016 ; N a163 ; B 34 152 981 540 ;
+C 215 ; WX 458 ; N a164 ; B 35 -127 422 820 ;
+C 216 ; WX 748 ; N a196 ; B 35 94 698 597 ;
+C 217 ; WX 924 ; N a165 ; B 35 140 890 552 ;
+C 218 ; WX 748 ; N a192 ; B 35 94 698 597 ;
+C 219 ; WX 918 ; N a166 ; B 35 166 884 526 ;
+C 220 ; WX 927 ; N a167 ; B 35 32 892 660 ;
+C 221 ; WX 928 ; N a168 ; B 35 129 891 562 ;
+C 222 ; WX 928 ; N a169 ; B 35 128 893 563 ;
+C 223 ; WX 834 ; N a170 ; B 35 155 799 537 ;
+C 224 ; WX 873 ; N a171 ; B 35 93 838 599 ;
+C 225 ; WX 828 ; N a172 ; B 35 104 791 588 ;
+C 226 ; WX 924 ; N a173 ; B 35 98 889 594 ;
+C 227 ; WX 924 ; N a162 ; B 35 98 889 594 ;
+C 228 ; WX 917 ; N a174 ; B 35 0 882 692 ;
+C 229 ; WX 930 ; N a175 ; B 35 84 896 608 ;
+C 230 ; WX 931 ; N a176 ; B 35 84 896 608 ;
+C 231 ; WX 463 ; N a177 ; B 35 -99 429 791 ;
+C 232 ; WX 883 ; N a178 ; B 35 71 848 623 ;
+C 233 ; WX 836 ; N a179 ; B 35 44 802 648 ;
+C 234 ; WX 836 ; N a193 ; B 35 44 802 648 ;
+C 235 ; WX 867 ; N a180 ; B 35 101 832 591 ;
+C 236 ; WX 867 ; N a199 ; B 35 101 832 591 ;
+C 237 ; WX 696 ; N a181 ; B 35 44 661 648 ;
+C 238 ; WX 696 ; N a200 ; B 35 44 661 648 ;
+C 239 ; WX 874 ; N a182 ; B 35 77 840 619 ;
+C 241 ; WX 874 ; N a201 ; B 35 73 840 615 ;
+C 242 ; WX 760 ; N a183 ; B 35 0 725 692 ;
+C 243 ; WX 946 ; N a184 ; B 35 160 911 533 ;
+C 244 ; WX 771 ; N a197 ; B 34 37 736 655 ;
+C 245 ; WX 865 ; N a185 ; B 35 207 830 481 ;
+C 246 ; WX 771 ; N a194 ; B 34 37 736 655 ;
+C 247 ; WX 888 ; N a198 ; B 34 -19 853 712 ;
+C 248 ; WX 967 ; N a186 ; B 35 124 932 568 ;
+C 249 ; WX 888 ; N a195 ; B 34 -19 853 712 ;
+C 250 ; WX 831 ; N a187 ; B 35 113 796 579 ;
+C 251 ; WX 873 ; N a188 ; B 36 118 838 578 ;
+C 252 ; WX 927 ; N a189 ; B 35 150 891 542 ;
+C 253 ; WX 970 ; N a190 ; B 35 76 931 616 ;
+C 254 ; WX 918 ; N a191 ; B 34 99 884 593 ;
+C -1 ; WX 410 ; N a86 ; B 35 0 375 692 ;
+C -1 ; WX 509 ; N a85 ; B 35 0 475 692 ;
+C -1 ; WX 334 ; N a95 ; B 35 0 299 692 ;
+C -1 ; WX 509 ; N a205 ; B 35 0 475 692 ;
+C -1 ; WX 390 ; N a89 ; B 35 -14 356 705 ;
+C -1 ; WX 234 ; N a87 ; B 35 -14 199 705 ;
+C -1 ; WX 276 ; N a91 ; B 35 0 242 692 ;
+C -1 ; WX 390 ; N a90 ; B 35 -14 355 705 ;
+C -1 ; WX 410 ; N a206 ; B 35 0 375 692 ;
+C -1 ; WX 317 ; N a94 ; B 35 0 283 692 ;
+C -1 ; WX 317 ; N a93 ; B 35 0 283 692 ;
+C -1 ; WX 276 ; N a92 ; B 35 0 242 692 ;
+C -1 ; WX 334 ; N a96 ; B 35 0 299 692 ;
+C -1 ; WX 234 ; N a88 ; B 35 -14 199 705 ;
+EndCharMetrics
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Courier-Bold.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Courier-Bold.afm
new file mode 100644
index 0000000..eb80542
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Courier-Bold.afm
@@ -0,0 +1,342 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1989, 1990, 1991, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Mon Jun 23 16:28:00 1997
+Comment UniqueID 43048
+Comment VMusage 41139 52164
+FontName Courier-Bold
+FullName Courier Bold
+FamilyName Courier
+Weight Bold
+ItalicAngle 0
+IsFixedPitch true
+CharacterSet ExtendedRoman
+FontBBox -113 -250 749 801
+UnderlinePosition -100
+UnderlineThickness 50
+Version 003.000
+Notice Copyright (c) 1989, 1990, 1991, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
+EncodingScheme AdobeStandardEncoding
+CapHeight 562
+XHeight 439
+Ascender 629
+Descender -157
+StdHW 84
+StdVW 106
+StartCharMetrics 315
+C 32 ; WX 600 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 600 ; N exclam ; B 202 -15 398 572 ;
+C 34 ; WX 600 ; N quotedbl ; B 135 277 465 562 ;
+C 35 ; WX 600 ; N numbersign ; B 56 -45 544 651 ;
+C 36 ; WX 600 ; N dollar ; B 82 -126 519 666 ;
+C 37 ; WX 600 ; N percent ; B 5 -15 595 616 ;
+C 38 ; WX 600 ; N ampersand ; B 36 -15 546 543 ;
+C 39 ; WX 600 ; N quoteright ; B 171 277 423 562 ;
+C 40 ; WX 600 ; N parenleft ; B 219 -102 461 616 ;
+C 41 ; WX 600 ; N parenright ; B 139 -102 381 616 ;
+C 42 ; WX 600 ; N asterisk ; B 91 219 509 601 ;
+C 43 ; WX 600 ; N plus ; B 71 39 529 478 ;
+C 44 ; WX 600 ; N comma ; B 123 -111 393 174 ;
+C 45 ; WX 600 ; N hyphen ; B 100 203 500 313 ;
+C 46 ; WX 600 ; N period ; B 192 -15 408 171 ;
+C 47 ; WX 600 ; N slash ; B 98 -77 502 626 ;
+C 48 ; WX 600 ; N zero ; B 87 -15 513 616 ;
+C 49 ; WX 600 ; N one ; B 81 0 539 616 ;
+C 50 ; WX 600 ; N two ; B 61 0 499 616 ;
+C 51 ; WX 600 ; N three ; B 63 -15 501 616 ;
+C 52 ; WX 600 ; N four ; B 53 0 507 616 ;
+C 53 ; WX 600 ; N five ; B 70 -15 521 601 ;
+C 54 ; WX 600 ; N six ; B 90 -15 521 616 ;
+C 55 ; WX 600 ; N seven ; B 55 0 494 601 ;
+C 56 ; WX 600 ; N eight ; B 83 -15 517 616 ;
+C 57 ; WX 600 ; N nine ; B 79 -15 510 616 ;
+C 58 ; WX 600 ; N colon ; B 191 -15 407 425 ;
+C 59 ; WX 600 ; N semicolon ; B 123 -111 408 425 ;
+C 60 ; WX 600 ; N less ; B 66 15 523 501 ;
+C 61 ; WX 600 ; N equal ; B 71 118 529 398 ;
+C 62 ; WX 600 ; N greater ; B 77 15 534 501 ;
+C 63 ; WX 600 ; N question ; B 98 -14 501 580 ;
+C 64 ; WX 600 ; N at ; B 16 -15 584 616 ;
+C 65 ; WX 600 ; N A ; B -9 0 609 562 ;
+C 66 ; WX 600 ; N B ; B 30 0 573 562 ;
+C 67 ; WX 600 ; N C ; B 22 -18 560 580 ;
+C 68 ; WX 600 ; N D ; B 30 0 594 562 ;
+C 69 ; WX 600 ; N E ; B 25 0 560 562 ;
+C 70 ; WX 600 ; N F ; B 39 0 570 562 ;
+C 71 ; WX 600 ; N G ; B 22 -18 594 580 ;
+C 72 ; WX 600 ; N H ; B 20 0 580 562 ;
+C 73 ; WX 600 ; N I ; B 77 0 523 562 ;
+C 74 ; WX 600 ; N J ; B 37 -18 601 562 ;
+C 75 ; WX 600 ; N K ; B 21 0 599 562 ;
+C 76 ; WX 600 ; N L ; B 39 0 578 562 ;
+C 77 ; WX 600 ; N M ; B -2 0 602 562 ;
+C 78 ; WX 600 ; N N ; B 8 -12 610 562 ;
+C 79 ; WX 600 ; N O ; B 22 -18 578 580 ;
+C 80 ; WX 600 ; N P ; B 48 0 559 562 ;
+C 81 ; WX 600 ; N Q ; B 32 -138 578 580 ;
+C 82 ; WX 600 ; N R ; B 24 0 599 562 ;
+C 83 ; WX 600 ; N S ; B 47 -22 553 582 ;
+C 84 ; WX 600 ; N T ; B 21 0 579 562 ;
+C 85 ; WX 600 ; N U ; B 4 -18 596 562 ;
+C 86 ; WX 600 ; N V ; B -13 0 613 562 ;
+C 87 ; WX 600 ; N W ; B -18 0 618 562 ;
+C 88 ; WX 600 ; N X ; B 12 0 588 562 ;
+C 89 ; WX 600 ; N Y ; B 12 0 589 562 ;
+C 90 ; WX 600 ; N Z ; B 62 0 539 562 ;
+C 91 ; WX 600 ; N bracketleft ; B 245 -102 475 616 ;
+C 92 ; WX 600 ; N backslash ; B 99 -77 503 626 ;
+C 93 ; WX 600 ; N bracketright ; B 125 -102 355 616 ;
+C 94 ; WX 600 ; N asciicircum ; B 108 250 492 616 ;
+C 95 ; WX 600 ; N underscore ; B 0 -125 600 -75 ;
+C 96 ; WX 600 ; N quoteleft ; B 178 277 428 562 ;
+C 97 ; WX 600 ; N a ; B 35 -15 570 454 ;
+C 98 ; WX 600 ; N b ; B 0 -15 584 626 ;
+C 99 ; WX 600 ; N c ; B 40 -15 545 459 ;
+C 100 ; WX 600 ; N d ; B 20 -15 591 626 ;
+C 101 ; WX 600 ; N e ; B 40 -15 563 454 ;
+C 102 ; WX 600 ; N f ; B 83 0 547 626 ; L i fi ; L l fl ;
+C 103 ; WX 600 ; N g ; B 30 -146 580 454 ;
+C 104 ; WX 600 ; N h ; B 5 0 592 626 ;
+C 105 ; WX 600 ; N i ; B 77 0 523 658 ;
+C 106 ; WX 600 ; N j ; B 63 -146 440 658 ;
+C 107 ; WX 600 ; N k ; B 20 0 585 626 ;
+C 108 ; WX 600 ; N l ; B 77 0 523 626 ;
+C 109 ; WX 600 ; N m ; B -22 0 626 454 ;
+C 110 ; WX 600 ; N n ; B 18 0 592 454 ;
+C 111 ; WX 600 ; N o ; B 30 -15 570 454 ;
+C 112 ; WX 600 ; N p ; B -1 -142 570 454 ;
+C 113 ; WX 600 ; N q ; B 20 -142 591 454 ;
+C 114 ; WX 600 ; N r ; B 47 0 580 454 ;
+C 115 ; WX 600 ; N s ; B 68 -17 535 459 ;
+C 116 ; WX 600 ; N t ; B 47 -15 532 562 ;
+C 117 ; WX 600 ; N u ; B -1 -15 569 439 ;
+C 118 ; WX 600 ; N v ; B -1 0 601 439 ;
+C 119 ; WX 600 ; N w ; B -18 0 618 439 ;
+C 120 ; WX 600 ; N x ; B 6 0 594 439 ;
+C 121 ; WX 600 ; N y ; B -4 -142 601 439 ;
+C 122 ; WX 600 ; N z ; B 81 0 520 439 ;
+C 123 ; WX 600 ; N braceleft ; B 160 -102 464 616 ;
+C 124 ; WX 600 ; N bar ; B 255 -250 345 750 ;
+C 125 ; WX 600 ; N braceright ; B 136 -102 440 616 ;
+C 126 ; WX 600 ; N asciitilde ; B 71 153 530 356 ;
+C 161 ; WX 600 ; N exclamdown ; B 202 -146 398 449 ;
+C 162 ; WX 600 ; N cent ; B 66 -49 518 614 ;
+C 163 ; WX 600 ; N sterling ; B 72 -28 558 611 ;
+C 164 ; WX 600 ; N fraction ; B 25 -60 576 661 ;
+C 165 ; WX 600 ; N yen ; B 10 0 590 562 ;
+C 166 ; WX 600 ; N florin ; B -30 -131 572 616 ;
+C 167 ; WX 600 ; N section ; B 83 -70 517 580 ;
+C 168 ; WX 600 ; N currency ; B 54 49 546 517 ;
+C 169 ; WX 600 ; N quotesingle ; B 227 277 373 562 ;
+C 170 ; WX 600 ; N quotedblleft ; B 71 277 535 562 ;
+C 171 ; WX 600 ; N guillemotleft ; B 8 70 553 446 ;
+C 172 ; WX 600 ; N guilsinglleft ; B 141 70 459 446 ;
+C 173 ; WX 600 ; N guilsinglright ; B 141 70 459 446 ;
+C 174 ; WX 600 ; N fi ; B 12 0 593 626 ;
+C 175 ; WX 600 ; N fl ; B 12 0 593 626 ;
+C 177 ; WX 600 ; N endash ; B 65 203 535 313 ;
+C 178 ; WX 600 ; N dagger ; B 106 -70 494 580 ;
+C 179 ; WX 600 ; N daggerdbl ; B 106 -70 494 580 ;
+C 180 ; WX 600 ; N periodcentered ; B 196 165 404 351 ;
+C 182 ; WX 600 ; N paragraph ; B 6 -70 576 580 ;
+C 183 ; WX 600 ; N bullet ; B 140 132 460 430 ;
+C 184 ; WX 600 ; N quotesinglbase ; B 175 -142 427 143 ;
+C 185 ; WX 600 ; N quotedblbase ; B 65 -142 529 143 ;
+C 186 ; WX 600 ; N quotedblright ; B 61 277 525 562 ;
+C 187 ; WX 600 ; N guillemotright ; B 47 70 592 446 ;
+C 188 ; WX 600 ; N ellipsis ; B 26 -15 574 116 ;
+C 189 ; WX 600 ; N perthousand ; B -113 -15 713 616 ;
+C 191 ; WX 600 ; N questiondown ; B 99 -146 502 449 ;
+C 193 ; WX 600 ; N grave ; B 132 508 395 661 ;
+C 194 ; WX 600 ; N acute ; B 205 508 468 661 ;
+C 195 ; WX 600 ; N circumflex ; B 103 483 497 657 ;
+C 196 ; WX 600 ; N tilde ; B 89 493 512 636 ;
+C 197 ; WX 600 ; N macron ; B 88 505 512 585 ;
+C 198 ; WX 600 ; N breve ; B 83 468 517 631 ;
+C 199 ; WX 600 ; N dotaccent ; B 230 498 370 638 ;
+C 200 ; WX 600 ; N dieresis ; B 128 498 472 638 ;
+C 202 ; WX 600 ; N ring ; B 198 481 402 678 ;
+C 203 ; WX 600 ; N cedilla ; B 205 -206 387 0 ;
+C 205 ; WX 600 ; N hungarumlaut ; B 68 488 588 661 ;
+C 206 ; WX 600 ; N ogonek ; B 169 -199 400 0 ;
+C 207 ; WX 600 ; N caron ; B 103 493 497 667 ;
+C 208 ; WX 600 ; N emdash ; B -10 203 610 313 ;
+C 225 ; WX 600 ; N AE ; B -29 0 602 562 ;
+C 227 ; WX 600 ; N ordfeminine ; B 147 196 453 580 ;
+C 232 ; WX 600 ; N Lslash ; B 39 0 578 562 ;
+C 233 ; WX 600 ; N Oslash ; B 22 -22 578 584 ;
+C 234 ; WX 600 ; N OE ; B -25 0 595 562 ;
+C 235 ; WX 600 ; N ordmasculine ; B 147 196 453 580 ;
+C 241 ; WX 600 ; N ae ; B -4 -15 601 454 ;
+C 245 ; WX 600 ; N dotlessi ; B 77 0 523 439 ;
+C 248 ; WX 600 ; N lslash ; B 77 0 523 626 ;
+C 249 ; WX 600 ; N oslash ; B 30 -24 570 463 ;
+C 250 ; WX 600 ; N oe ; B -18 -15 611 454 ;
+C 251 ; WX 600 ; N germandbls ; B 22 -15 596 626 ;
+C -1 ; WX 600 ; N Idieresis ; B 77 0 523 761 ;
+C -1 ; WX 600 ; N eacute ; B 40 -15 563 661 ;
+C -1 ; WX 600 ; N abreve ; B 35 -15 570 661 ;
+C -1 ; WX 600 ; N uhungarumlaut ; B -1 -15 628 661 ;
+C -1 ; WX 600 ; N ecaron ; B 40 -15 563 667 ;
+C -1 ; WX 600 ; N Ydieresis ; B 12 0 589 761 ;
+C -1 ; WX 600 ; N divide ; B 71 16 529 500 ;
+C -1 ; WX 600 ; N Yacute ; B 12 0 589 784 ;
+C -1 ; WX 600 ; N Acircumflex ; B -9 0 609 780 ;
+C -1 ; WX 600 ; N aacute ; B 35 -15 570 661 ;
+C -1 ; WX 600 ; N Ucircumflex ; B 4 -18 596 780 ;
+C -1 ; WX 600 ; N yacute ; B -4 -142 601 661 ;
+C -1 ; WX 600 ; N scommaaccent ; B 68 -250 535 459 ;
+C -1 ; WX 600 ; N ecircumflex ; B 40 -15 563 657 ;
+C -1 ; WX 600 ; N Uring ; B 4 -18 596 801 ;
+C -1 ; WX 600 ; N Udieresis ; B 4 -18 596 761 ;
+C -1 ; WX 600 ; N aogonek ; B 35 -199 586 454 ;
+C -1 ; WX 600 ; N Uacute ; B 4 -18 596 784 ;
+C -1 ; WX 600 ; N uogonek ; B -1 -199 585 439 ;
+C -1 ; WX 600 ; N Edieresis ; B 25 0 560 761 ;
+C -1 ; WX 600 ; N Dcroat ; B 30 0 594 562 ;
+C -1 ; WX 600 ; N commaaccent ; B 205 -250 397 -57 ;
+C -1 ; WX 600 ; N copyright ; B 0 -18 600 580 ;
+C -1 ; WX 600 ; N Emacron ; B 25 0 560 708 ;
+C -1 ; WX 600 ; N ccaron ; B 40 -15 545 667 ;
+C -1 ; WX 600 ; N aring ; B 35 -15 570 678 ;
+C -1 ; WX 600 ; N Ncommaaccent ; B 8 -250 610 562 ;
+C -1 ; WX 600 ; N lacute ; B 77 0 523 801 ;
+C -1 ; WX 600 ; N agrave ; B 35 -15 570 661 ;
+C -1 ; WX 600 ; N Tcommaaccent ; B 21 -250 579 562 ;
+C -1 ; WX 600 ; N Cacute ; B 22 -18 560 784 ;
+C -1 ; WX 600 ; N atilde ; B 35 -15 570 636 ;
+C -1 ; WX 600 ; N Edotaccent ; B 25 0 560 761 ;
+C -1 ; WX 600 ; N scaron ; B 68 -17 535 667 ;
+C -1 ; WX 600 ; N scedilla ; B 68 -206 535 459 ;
+C -1 ; WX 600 ; N iacute ; B 77 0 523 661 ;
+C -1 ; WX 600 ; N lozenge ; B 66 0 534 740 ;
+C -1 ; WX 600 ; N Rcaron ; B 24 0 599 790 ;
+C -1 ; WX 600 ; N Gcommaaccent ; B 22 -250 594 580 ;
+C -1 ; WX 600 ; N ucircumflex ; B -1 -15 569 657 ;
+C -1 ; WX 600 ; N acircumflex ; B 35 -15 570 657 ;
+C -1 ; WX 600 ; N Amacron ; B -9 0 609 708 ;
+C -1 ; WX 600 ; N rcaron ; B 47 0 580 667 ;
+C -1 ; WX 600 ; N ccedilla ; B 40 -206 545 459 ;
+C -1 ; WX 600 ; N Zdotaccent ; B 62 0 539 761 ;
+C -1 ; WX 600 ; N Thorn ; B 48 0 557 562 ;
+C -1 ; WX 600 ; N Omacron ; B 22 -18 578 708 ;
+C -1 ; WX 600 ; N Racute ; B 24 0 599 784 ;
+C -1 ; WX 600 ; N Sacute ; B 47 -22 553 784 ;
+C -1 ; WX 600 ; N dcaron ; B 20 -15 727 626 ;
+C -1 ; WX 600 ; N Umacron ; B 4 -18 596 708 ;
+C -1 ; WX 600 ; N uring ; B -1 -15 569 678 ;
+C -1 ; WX 600 ; N threesuperior ; B 138 222 433 616 ;
+C -1 ; WX 600 ; N Ograve ; B 22 -18 578 784 ;
+C -1 ; WX 600 ; N Agrave ; B -9 0 609 784 ;
+C -1 ; WX 600 ; N Abreve ; B -9 0 609 784 ;
+C -1 ; WX 600 ; N multiply ; B 81 39 520 478 ;
+C -1 ; WX 600 ; N uacute ; B -1 -15 569 661 ;
+C -1 ; WX 600 ; N Tcaron ; B 21 0 579 790 ;
+C -1 ; WX 600 ; N partialdiff ; B 63 -38 537 728 ;
+C -1 ; WX 600 ; N ydieresis ; B -4 -142 601 638 ;
+C -1 ; WX 600 ; N Nacute ; B 8 -12 610 784 ;
+C -1 ; WX 600 ; N icircumflex ; B 73 0 523 657 ;
+C -1 ; WX 600 ; N Ecircumflex ; B 25 0 560 780 ;
+C -1 ; WX 600 ; N adieresis ; B 35 -15 570 638 ;
+C -1 ; WX 600 ; N edieresis ; B 40 -15 563 638 ;
+C -1 ; WX 600 ; N cacute ; B 40 -15 545 661 ;
+C -1 ; WX 600 ; N nacute ; B 18 0 592 661 ;
+C -1 ; WX 600 ; N umacron ; B -1 -15 569 585 ;
+C -1 ; WX 600 ; N Ncaron ; B 8 -12 610 790 ;
+C -1 ; WX 600 ; N Iacute ; B 77 0 523 784 ;
+C -1 ; WX 600 ; N plusminus ; B 71 24 529 515 ;
+C -1 ; WX 600 ; N brokenbar ; B 255 -175 345 675 ;
+C -1 ; WX 600 ; N registered ; B 0 -18 600 580 ;
+C -1 ; WX 600 ; N Gbreve ; B 22 -18 594 784 ;
+C -1 ; WX 600 ; N Idotaccent ; B 77 0 523 761 ;
+C -1 ; WX 600 ; N summation ; B 15 -10 586 706 ;
+C -1 ; WX 600 ; N Egrave ; B 25 0 560 784 ;
+C -1 ; WX 600 ; N racute ; B 47 0 580 661 ;
+C -1 ; WX 600 ; N omacron ; B 30 -15 570 585 ;
+C -1 ; WX 600 ; N Zacute ; B 62 0 539 784 ;
+C -1 ; WX 600 ; N Zcaron ; B 62 0 539 790 ;
+C -1 ; WX 600 ; N greaterequal ; B 26 0 523 696 ;
+C -1 ; WX 600 ; N Eth ; B 30 0 594 562 ;
+C -1 ; WX 600 ; N Ccedilla ; B 22 -206 560 580 ;
+C -1 ; WX 600 ; N lcommaaccent ; B 77 -250 523 626 ;
+C -1 ; WX 600 ; N tcaron ; B 47 -15 532 703 ;
+C -1 ; WX 600 ; N eogonek ; B 40 -199 563 454 ;
+C -1 ; WX 600 ; N Uogonek ; B 4 -199 596 562 ;
+C -1 ; WX 600 ; N Aacute ; B -9 0 609 784 ;
+C -1 ; WX 600 ; N Adieresis ; B -9 0 609 761 ;
+C -1 ; WX 600 ; N egrave ; B 40 -15 563 661 ;
+C -1 ; WX 600 ; N zacute ; B 81 0 520 661 ;
+C -1 ; WX 600 ; N iogonek ; B 77 -199 523 658 ;
+C -1 ; WX 600 ; N Oacute ; B 22 -18 578 784 ;
+C -1 ; WX 600 ; N oacute ; B 30 -15 570 661 ;
+C -1 ; WX 600 ; N amacron ; B 35 -15 570 585 ;
+C -1 ; WX 600 ; N sacute ; B 68 -17 535 661 ;
+C -1 ; WX 600 ; N idieresis ; B 77 0 523 618 ;
+C -1 ; WX 600 ; N Ocircumflex ; B 22 -18 578 780 ;
+C -1 ; WX 600 ; N Ugrave ; B 4 -18 596 784 ;
+C -1 ; WX 600 ; N Delta ; B 6 0 594 688 ;
+C -1 ; WX 600 ; N thorn ; B -14 -142 570 626 ;
+C -1 ; WX 600 ; N twosuperior ; B 143 230 436 616 ;
+C -1 ; WX 600 ; N Odieresis ; B 22 -18 578 761 ;
+C -1 ; WX 600 ; N mu ; B -1 -142 569 439 ;
+C -1 ; WX 600 ; N igrave ; B 77 0 523 661 ;
+C -1 ; WX 600 ; N ohungarumlaut ; B 30 -15 668 661 ;
+C -1 ; WX 600 ; N Eogonek ; B 25 -199 576 562 ;
+C -1 ; WX 600 ; N dcroat ; B 20 -15 591 626 ;
+C -1 ; WX 600 ; N threequarters ; B -47 -60 648 661 ;
+C -1 ; WX 600 ; N Scedilla ; B 47 -206 553 582 ;
+C -1 ; WX 600 ; N lcaron ; B 77 0 597 626 ;
+C -1 ; WX 600 ; N Kcommaaccent ; B 21 -250 599 562 ;
+C -1 ; WX 600 ; N Lacute ; B 39 0 578 784 ;
+C -1 ; WX 600 ; N trademark ; B -9 230 749 562 ;
+C -1 ; WX 600 ; N edotaccent ; B 40 -15 563 638 ;
+C -1 ; WX 600 ; N Igrave ; B 77 0 523 784 ;
+C -1 ; WX 600 ; N Imacron ; B 77 0 523 708 ;
+C -1 ; WX 600 ; N Lcaron ; B 39 0 637 562 ;
+C -1 ; WX 600 ; N onehalf ; B -47 -60 648 661 ;
+C -1 ; WX 600 ; N lessequal ; B 26 0 523 696 ;
+C -1 ; WX 600 ; N ocircumflex ; B 30 -15 570 657 ;
+C -1 ; WX 600 ; N ntilde ; B 18 0 592 636 ;
+C -1 ; WX 600 ; N Uhungarumlaut ; B 4 -18 638 784 ;
+C -1 ; WX 600 ; N Eacute ; B 25 0 560 784 ;
+C -1 ; WX 600 ; N emacron ; B 40 -15 563 585 ;
+C -1 ; WX 600 ; N gbreve ; B 30 -146 580 661 ;
+C -1 ; WX 600 ; N onequarter ; B -56 -60 656 661 ;
+C -1 ; WX 600 ; N Scaron ; B 47 -22 553 790 ;
+C -1 ; WX 600 ; N Scommaaccent ; B 47 -250 553 582 ;
+C -1 ; WX 600 ; N Ohungarumlaut ; B 22 -18 628 784 ;
+C -1 ; WX 600 ; N degree ; B 86 243 474 616 ;
+C -1 ; WX 600 ; N ograve ; B 30 -15 570 661 ;
+C -1 ; WX 600 ; N Ccaron ; B 22 -18 560 790 ;
+C -1 ; WX 600 ; N ugrave ; B -1 -15 569 661 ;
+C -1 ; WX 600 ; N radical ; B -19 -104 473 778 ;
+C -1 ; WX 600 ; N Dcaron ; B 30 0 594 790 ;
+C -1 ; WX 600 ; N rcommaaccent ; B 47 -250 580 454 ;
+C -1 ; WX 600 ; N Ntilde ; B 8 -12 610 759 ;
+C -1 ; WX 600 ; N otilde ; B 30 -15 570 636 ;
+C -1 ; WX 600 ; N Rcommaaccent ; B 24 -250 599 562 ;
+C -1 ; WX 600 ; N Lcommaaccent ; B 39 -250 578 562 ;
+C -1 ; WX 600 ; N Atilde ; B -9 0 609 759 ;
+C -1 ; WX 600 ; N Aogonek ; B -9 -199 625 562 ;
+C -1 ; WX 600 ; N Aring ; B -9 0 609 801 ;
+C -1 ; WX 600 ; N Otilde ; B 22 -18 578 759 ;
+C -1 ; WX 600 ; N zdotaccent ; B 81 0 520 638 ;
+C -1 ; WX 600 ; N Ecaron ; B 25 0 560 790 ;
+C -1 ; WX 600 ; N Iogonek ; B 77 -199 523 562 ;
+C -1 ; WX 600 ; N kcommaaccent ; B 20 -250 585 626 ;
+C -1 ; WX 600 ; N minus ; B 71 203 529 313 ;
+C -1 ; WX 600 ; N Icircumflex ; B 77 0 523 780 ;
+C -1 ; WX 600 ; N ncaron ; B 18 0 592 667 ;
+C -1 ; WX 600 ; N tcommaaccent ; B 47 -250 532 562 ;
+C -1 ; WX 600 ; N logicalnot ; B 71 103 529 413 ;
+C -1 ; WX 600 ; N odieresis ; B 30 -15 570 638 ;
+C -1 ; WX 600 ; N udieresis ; B -1 -15 569 638 ;
+C -1 ; WX 600 ; N notequal ; B 12 -47 537 563 ;
+C -1 ; WX 600 ; N gcommaaccent ; B 30 -146 580 714 ;
+C -1 ; WX 600 ; N eth ; B 58 -27 543 626 ;
+C -1 ; WX 600 ; N zcaron ; B 81 0 520 667 ;
+C -1 ; WX 600 ; N ncommaaccent ; B 18 -250 592 454 ;
+C -1 ; WX 600 ; N onesuperior ; B 153 230 447 616 ;
+C -1 ; WX 600 ; N imacron ; B 77 0 523 585 ;
+C -1 ; WX 600 ; N Euro ; B 0 0 0 0 ;
+EndCharMetrics
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Courier-BoldOblique.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Courier-BoldOblique.afm
new file mode 100644
index 0000000..29d3b8b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Courier-BoldOblique.afm
@@ -0,0 +1,342 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1989, 1990, 1991, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Mon Jun 23 16:28:46 1997
+Comment UniqueID 43049
+Comment VMusage 17529 79244
+FontName Courier-BoldOblique
+FullName Courier Bold Oblique
+FamilyName Courier
+Weight Bold
+ItalicAngle -12
+IsFixedPitch true
+CharacterSet ExtendedRoman
+FontBBox -57 -250 869 801
+UnderlinePosition -100
+UnderlineThickness 50
+Version 003.000
+Notice Copyright (c) 1989, 1990, 1991, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
+EncodingScheme AdobeStandardEncoding
+CapHeight 562
+XHeight 439
+Ascender 629
+Descender -157
+StdHW 84
+StdVW 106
+StartCharMetrics 315
+C 32 ; WX 600 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 600 ; N exclam ; B 215 -15 495 572 ;
+C 34 ; WX 600 ; N quotedbl ; B 211 277 585 562 ;
+C 35 ; WX 600 ; N numbersign ; B 88 -45 641 651 ;
+C 36 ; WX 600 ; N dollar ; B 87 -126 630 666 ;
+C 37 ; WX 600 ; N percent ; B 101 -15 625 616 ;
+C 38 ; WX 600 ; N ampersand ; B 61 -15 595 543 ;
+C 39 ; WX 600 ; N quoteright ; B 229 277 543 562 ;
+C 40 ; WX 600 ; N parenleft ; B 265 -102 592 616 ;
+C 41 ; WX 600 ; N parenright ; B 117 -102 444 616 ;
+C 42 ; WX 600 ; N asterisk ; B 179 219 598 601 ;
+C 43 ; WX 600 ; N plus ; B 114 39 596 478 ;
+C 44 ; WX 600 ; N comma ; B 99 -111 430 174 ;
+C 45 ; WX 600 ; N hyphen ; B 143 203 567 313 ;
+C 46 ; WX 600 ; N period ; B 206 -15 427 171 ;
+C 47 ; WX 600 ; N slash ; B 90 -77 626 626 ;
+C 48 ; WX 600 ; N zero ; B 135 -15 593 616 ;
+C 49 ; WX 600 ; N one ; B 93 0 562 616 ;
+C 50 ; WX 600 ; N two ; B 61 0 594 616 ;
+C 51 ; WX 600 ; N three ; B 71 -15 571 616 ;
+C 52 ; WX 600 ; N four ; B 81 0 559 616 ;
+C 53 ; WX 600 ; N five ; B 77 -15 621 601 ;
+C 54 ; WX 600 ; N six ; B 135 -15 652 616 ;
+C 55 ; WX 600 ; N seven ; B 147 0 622 601 ;
+C 56 ; WX 600 ; N eight ; B 115 -15 604 616 ;
+C 57 ; WX 600 ; N nine ; B 75 -15 592 616 ;
+C 58 ; WX 600 ; N colon ; B 205 -15 480 425 ;
+C 59 ; WX 600 ; N semicolon ; B 99 -111 481 425 ;
+C 60 ; WX 600 ; N less ; B 120 15 613 501 ;
+C 61 ; WX 600 ; N equal ; B 96 118 614 398 ;
+C 62 ; WX 600 ; N greater ; B 97 15 589 501 ;
+C 63 ; WX 600 ; N question ; B 183 -14 592 580 ;
+C 64 ; WX 600 ; N at ; B 65 -15 642 616 ;
+C 65 ; WX 600 ; N A ; B -9 0 632 562 ;
+C 66 ; WX 600 ; N B ; B 30 0 630 562 ;
+C 67 ; WX 600 ; N C ; B 74 -18 675 580 ;
+C 68 ; WX 600 ; N D ; B 30 0 664 562 ;
+C 69 ; WX 600 ; N E ; B 25 0 670 562 ;
+C 70 ; WX 600 ; N F ; B 39 0 684 562 ;
+C 71 ; WX 600 ; N G ; B 74 -18 675 580 ;
+C 72 ; WX 600 ; N H ; B 20 0 700 562 ;
+C 73 ; WX 600 ; N I ; B 77 0 643 562 ;
+C 74 ; WX 600 ; N J ; B 58 -18 721 562 ;
+C 75 ; WX 600 ; N K ; B 21 0 692 562 ;
+C 76 ; WX 600 ; N L ; B 39 0 636 562 ;
+C 77 ; WX 600 ; N M ; B -2 0 722 562 ;
+C 78 ; WX 600 ; N N ; B 8 -12 730 562 ;
+C 79 ; WX 600 ; N O ; B 74 -18 645 580 ;
+C 80 ; WX 600 ; N P ; B 48 0 643 562 ;
+C 81 ; WX 600 ; N Q ; B 83 -138 636 580 ;
+C 82 ; WX 600 ; N R ; B 24 0 617 562 ;
+C 83 ; WX 600 ; N S ; B 54 -22 673 582 ;
+C 84 ; WX 600 ; N T ; B 86 0 679 562 ;
+C 85 ; WX 600 ; N U ; B 101 -18 716 562 ;
+C 86 ; WX 600 ; N V ; B 84 0 733 562 ;
+C 87 ; WX 600 ; N W ; B 79 0 738 562 ;
+C 88 ; WX 600 ; N X ; B 12 0 690 562 ;
+C 89 ; WX 600 ; N Y ; B 109 0 709 562 ;
+C 90 ; WX 600 ; N Z ; B 62 0 637 562 ;
+C 91 ; WX 600 ; N bracketleft ; B 223 -102 606 616 ;
+C 92 ; WX 600 ; N backslash ; B 222 -77 496 626 ;
+C 93 ; WX 600 ; N bracketright ; B 103 -102 486 616 ;
+C 94 ; WX 600 ; N asciicircum ; B 171 250 556 616 ;
+C 95 ; WX 600 ; N underscore ; B -27 -125 585 -75 ;
+C 96 ; WX 600 ; N quoteleft ; B 297 277 487 562 ;
+C 97 ; WX 600 ; N a ; B 61 -15 593 454 ;
+C 98 ; WX 600 ; N b ; B 13 -15 636 626 ;
+C 99 ; WX 600 ; N c ; B 81 -15 631 459 ;
+C 100 ; WX 600 ; N d ; B 60 -15 645 626 ;
+C 101 ; WX 600 ; N e ; B 81 -15 605 454 ;
+C 102 ; WX 600 ; N f ; B 83 0 677 626 ; L i fi ; L l fl ;
+C 103 ; WX 600 ; N g ; B 40 -146 674 454 ;
+C 104 ; WX 600 ; N h ; B 18 0 615 626 ;
+C 105 ; WX 600 ; N i ; B 77 0 546 658 ;
+C 106 ; WX 600 ; N j ; B 36 -146 580 658 ;
+C 107 ; WX 600 ; N k ; B 33 0 643 626 ;
+C 108 ; WX 600 ; N l ; B 77 0 546 626 ;
+C 109 ; WX 600 ; N m ; B -22 0 649 454 ;
+C 110 ; WX 600 ; N n ; B 18 0 615 454 ;
+C 111 ; WX 600 ; N o ; B 71 -15 622 454 ;
+C 112 ; WX 600 ; N p ; B -32 -142 622 454 ;
+C 113 ; WX 600 ; N q ; B 60 -142 685 454 ;
+C 114 ; WX 600 ; N r ; B 47 0 655 454 ;
+C 115 ; WX 600 ; N s ; B 66 -17 608 459 ;
+C 116 ; WX 600 ; N t ; B 118 -15 567 562 ;
+C 117 ; WX 600 ; N u ; B 70 -15 592 439 ;
+C 118 ; WX 600 ; N v ; B 70 0 695 439 ;
+C 119 ; WX 600 ; N w ; B 53 0 712 439 ;
+C 120 ; WX 600 ; N x ; B 6 0 671 439 ;
+C 121 ; WX 600 ; N y ; B -21 -142 695 439 ;
+C 122 ; WX 600 ; N z ; B 81 0 614 439 ;
+C 123 ; WX 600 ; N braceleft ; B 203 -102 595 616 ;
+C 124 ; WX 600 ; N bar ; B 201 -250 505 750 ;
+C 125 ; WX 600 ; N braceright ; B 114 -102 506 616 ;
+C 126 ; WX 600 ; N asciitilde ; B 120 153 590 356 ;
+C 161 ; WX 600 ; N exclamdown ; B 196 -146 477 449 ;
+C 162 ; WX 600 ; N cent ; B 121 -49 605 614 ;
+C 163 ; WX 600 ; N sterling ; B 106 -28 650 611 ;
+C 164 ; WX 600 ; N fraction ; B 22 -60 708 661 ;
+C 165 ; WX 600 ; N yen ; B 98 0 710 562 ;
+C 166 ; WX 600 ; N florin ; B -57 -131 702 616 ;
+C 167 ; WX 600 ; N section ; B 74 -70 620 580 ;
+C 168 ; WX 600 ; N currency ; B 77 49 644 517 ;
+C 169 ; WX 600 ; N quotesingle ; B 303 277 493 562 ;
+C 170 ; WX 600 ; N quotedblleft ; B 190 277 594 562 ;
+C 171 ; WX 600 ; N guillemotleft ; B 62 70 639 446 ;
+C 172 ; WX 600 ; N guilsinglleft ; B 195 70 545 446 ;
+C 173 ; WX 600 ; N guilsinglright ; B 165 70 514 446 ;
+C 174 ; WX 600 ; N fi ; B 12 0 644 626 ;
+C 175 ; WX 600 ; N fl ; B 12 0 644 626 ;
+C 177 ; WX 600 ; N endash ; B 108 203 602 313 ;
+C 178 ; WX 600 ; N dagger ; B 175 -70 586 580 ;
+C 179 ; WX 600 ; N daggerdbl ; B 121 -70 587 580 ;
+C 180 ; WX 600 ; N periodcentered ; B 248 165 461 351 ;
+C 182 ; WX 600 ; N paragraph ; B 61 -70 700 580 ;
+C 183 ; WX 600 ; N bullet ; B 196 132 523 430 ;
+C 184 ; WX 600 ; N quotesinglbase ; B 144 -142 458 143 ;
+C 185 ; WX 600 ; N quotedblbase ; B 34 -142 560 143 ;
+C 186 ; WX 600 ; N quotedblright ; B 119 277 645 562 ;
+C 187 ; WX 600 ; N guillemotright ; B 71 70 647 446 ;
+C 188 ; WX 600 ; N ellipsis ; B 35 -15 587 116 ;
+C 189 ; WX 600 ; N perthousand ; B -45 -15 743 616 ;
+C 191 ; WX 600 ; N questiondown ; B 100 -146 509 449 ;
+C 193 ; WX 600 ; N grave ; B 272 508 503 661 ;
+C 194 ; WX 600 ; N acute ; B 312 508 609 661 ;
+C 195 ; WX 600 ; N circumflex ; B 212 483 607 657 ;
+C 196 ; WX 600 ; N tilde ; B 199 493 643 636 ;
+C 197 ; WX 600 ; N macron ; B 195 505 637 585 ;
+C 198 ; WX 600 ; N breve ; B 217 468 652 631 ;
+C 199 ; WX 600 ; N dotaccent ; B 348 498 493 638 ;
+C 200 ; WX 600 ; N dieresis ; B 246 498 595 638 ;
+C 202 ; WX 600 ; N ring ; B 319 481 528 678 ;
+C 203 ; WX 600 ; N cedilla ; B 168 -206 368 0 ;
+C 205 ; WX 600 ; N hungarumlaut ; B 171 488 729 661 ;
+C 206 ; WX 600 ; N ogonek ; B 143 -199 367 0 ;
+C 207 ; WX 600 ; N caron ; B 238 493 633 667 ;
+C 208 ; WX 600 ; N emdash ; B 33 203 677 313 ;
+C 225 ; WX 600 ; N AE ; B -29 0 708 562 ;
+C 227 ; WX 600 ; N ordfeminine ; B 188 196 526 580 ;
+C 232 ; WX 600 ; N Lslash ; B 39 0 636 562 ;
+C 233 ; WX 600 ; N Oslash ; B 48 -22 673 584 ;
+C 234 ; WX 600 ; N OE ; B 26 0 701 562 ;
+C 235 ; WX 600 ; N ordmasculine ; B 188 196 543 580 ;
+C 241 ; WX 600 ; N ae ; B 21 -15 652 454 ;
+C 245 ; WX 600 ; N dotlessi ; B 77 0 546 439 ;
+C 248 ; WX 600 ; N lslash ; B 77 0 587 626 ;
+C 249 ; WX 600 ; N oslash ; B 54 -24 638 463 ;
+C 250 ; WX 600 ; N oe ; B 18 -15 662 454 ;
+C 251 ; WX 600 ; N germandbls ; B 22 -15 629 626 ;
+C -1 ; WX 600 ; N Idieresis ; B 77 0 643 761 ;
+C -1 ; WX 600 ; N eacute ; B 81 -15 609 661 ;
+C -1 ; WX 600 ; N abreve ; B 61 -15 658 661 ;
+C -1 ; WX 600 ; N uhungarumlaut ; B 70 -15 769 661 ;
+C -1 ; WX 600 ; N ecaron ; B 81 -15 633 667 ;
+C -1 ; WX 600 ; N Ydieresis ; B 109 0 709 761 ;
+C -1 ; WX 600 ; N divide ; B 114 16 596 500 ;
+C -1 ; WX 600 ; N Yacute ; B 109 0 709 784 ;
+C -1 ; WX 600 ; N Acircumflex ; B -9 0 632 780 ;
+C -1 ; WX 600 ; N aacute ; B 61 -15 609 661 ;
+C -1 ; WX 600 ; N Ucircumflex ; B 101 -18 716 780 ;
+C -1 ; WX 600 ; N yacute ; B -21 -142 695 661 ;
+C -1 ; WX 600 ; N scommaaccent ; B 66 -250 608 459 ;
+C -1 ; WX 600 ; N ecircumflex ; B 81 -15 607 657 ;
+C -1 ; WX 600 ; N Uring ; B 101 -18 716 801 ;
+C -1 ; WX 600 ; N Udieresis ; B 101 -18 716 761 ;
+C -1 ; WX 600 ; N aogonek ; B 61 -199 593 454 ;
+C -1 ; WX 600 ; N Uacute ; B 101 -18 716 784 ;
+C -1 ; WX 600 ; N uogonek ; B 70 -199 592 439 ;
+C -1 ; WX 600 ; N Edieresis ; B 25 0 670 761 ;
+C -1 ; WX 600 ; N Dcroat ; B 30 0 664 562 ;
+C -1 ; WX 600 ; N commaaccent ; B 151 -250 385 -57 ;
+C -1 ; WX 600 ; N copyright ; B 53 -18 667 580 ;
+C -1 ; WX 600 ; N Emacron ; B 25 0 670 708 ;
+C -1 ; WX 600 ; N ccaron ; B 81 -15 633 667 ;
+C -1 ; WX 600 ; N aring ; B 61 -15 593 678 ;
+C -1 ; WX 600 ; N Ncommaaccent ; B 8 -250 730 562 ;
+C -1 ; WX 600 ; N lacute ; B 77 0 639 801 ;
+C -1 ; WX 600 ; N agrave ; B 61 -15 593 661 ;
+C -1 ; WX 600 ; N Tcommaaccent ; B 86 -250 679 562 ;
+C -1 ; WX 600 ; N Cacute ; B 74 -18 675 784 ;
+C -1 ; WX 600 ; N atilde ; B 61 -15 643 636 ;
+C -1 ; WX 600 ; N Edotaccent ; B 25 0 670 761 ;
+C -1 ; WX 600 ; N scaron ; B 66 -17 633 667 ;
+C -1 ; WX 600 ; N scedilla ; B 66 -206 608 459 ;
+C -1 ; WX 600 ; N iacute ; B 77 0 609 661 ;
+C -1 ; WX 600 ; N lozenge ; B 145 0 614 740 ;
+C -1 ; WX 600 ; N Rcaron ; B 24 0 659 790 ;
+C -1 ; WX 600 ; N Gcommaaccent ; B 74 -250 675 580 ;
+C -1 ; WX 600 ; N ucircumflex ; B 70 -15 597 657 ;
+C -1 ; WX 600 ; N acircumflex ; B 61 -15 607 657 ;
+C -1 ; WX 600 ; N Amacron ; B -9 0 633 708 ;
+C -1 ; WX 600 ; N rcaron ; B 47 0 655 667 ;
+C -1 ; WX 600 ; N ccedilla ; B 81 -206 631 459 ;
+C -1 ; WX 600 ; N Zdotaccent ; B 62 0 637 761 ;
+C -1 ; WX 600 ; N Thorn ; B 48 0 620 562 ;
+C -1 ; WX 600 ; N Omacron ; B 74 -18 663 708 ;
+C -1 ; WX 600 ; N Racute ; B 24 0 665 784 ;
+C -1 ; WX 600 ; N Sacute ; B 54 -22 673 784 ;
+C -1 ; WX 600 ; N dcaron ; B 60 -15 861 626 ;
+C -1 ; WX 600 ; N Umacron ; B 101 -18 716 708 ;
+C -1 ; WX 600 ; N uring ; B 70 -15 592 678 ;
+C -1 ; WX 600 ; N threesuperior ; B 193 222 526 616 ;
+C -1 ; WX 600 ; N Ograve ; B 74 -18 645 784 ;
+C -1 ; WX 600 ; N Agrave ; B -9 0 632 784 ;
+C -1 ; WX 600 ; N Abreve ; B -9 0 684 784 ;
+C -1 ; WX 600 ; N multiply ; B 104 39 606 478 ;
+C -1 ; WX 600 ; N uacute ; B 70 -15 599 661 ;
+C -1 ; WX 600 ; N Tcaron ; B 86 0 679 790 ;
+C -1 ; WX 600 ; N partialdiff ; B 91 -38 627 728 ;
+C -1 ; WX 600 ; N ydieresis ; B -21 -142 695 638 ;
+C -1 ; WX 600 ; N Nacute ; B 8 -12 730 784 ;
+C -1 ; WX 600 ; N icircumflex ; B 77 0 577 657 ;
+C -1 ; WX 600 ; N Ecircumflex ; B 25 0 670 780 ;
+C -1 ; WX 600 ; N adieresis ; B 61 -15 595 638 ;
+C -1 ; WX 600 ; N edieresis ; B 81 -15 605 638 ;
+C -1 ; WX 600 ; N cacute ; B 81 -15 649 661 ;
+C -1 ; WX 600 ; N nacute ; B 18 0 639 661 ;
+C -1 ; WX 600 ; N umacron ; B 70 -15 637 585 ;
+C -1 ; WX 600 ; N Ncaron ; B 8 -12 730 790 ;
+C -1 ; WX 600 ; N Iacute ; B 77 0 643 784 ;
+C -1 ; WX 600 ; N plusminus ; B 76 24 614 515 ;
+C -1 ; WX 600 ; N brokenbar ; B 217 -175 489 675 ;
+C -1 ; WX 600 ; N registered ; B 53 -18 667 580 ;
+C -1 ; WX 600 ; N Gbreve ; B 74 -18 684 784 ;
+C -1 ; WX 600 ; N Idotaccent ; B 77 0 643 761 ;
+C -1 ; WX 600 ; N summation ; B 15 -10 672 706 ;
+C -1 ; WX 600 ; N Egrave ; B 25 0 670 784 ;
+C -1 ; WX 600 ; N racute ; B 47 0 655 661 ;
+C -1 ; WX 600 ; N omacron ; B 71 -15 637 585 ;
+C -1 ; WX 600 ; N Zacute ; B 62 0 665 784 ;
+C -1 ; WX 600 ; N Zcaron ; B 62 0 659 790 ;
+C -1 ; WX 600 ; N greaterequal ; B 26 0 627 696 ;
+C -1 ; WX 600 ; N Eth ; B 30 0 664 562 ;
+C -1 ; WX 600 ; N Ccedilla ; B 74 -206 675 580 ;
+C -1 ; WX 600 ; N lcommaaccent ; B 77 -250 546 626 ;
+C -1 ; WX 600 ; N tcaron ; B 118 -15 627 703 ;
+C -1 ; WX 600 ; N eogonek ; B 81 -199 605 454 ;
+C -1 ; WX 600 ; N Uogonek ; B 101 -199 716 562 ;
+C -1 ; WX 600 ; N Aacute ; B -9 0 655 784 ;
+C -1 ; WX 600 ; N Adieresis ; B -9 0 632 761 ;
+C -1 ; WX 600 ; N egrave ; B 81 -15 605 661 ;
+C -1 ; WX 600 ; N zacute ; B 81 0 614 661 ;
+C -1 ; WX 600 ; N iogonek ; B 77 -199 546 658 ;
+C -1 ; WX 600 ; N Oacute ; B 74 -18 645 784 ;
+C -1 ; WX 600 ; N oacute ; B 71 -15 649 661 ;
+C -1 ; WX 600 ; N amacron ; B 61 -15 637 585 ;
+C -1 ; WX 600 ; N sacute ; B 66 -17 609 661 ;
+C -1 ; WX 600 ; N idieresis ; B 77 0 561 618 ;
+C -1 ; WX 600 ; N Ocircumflex ; B 74 -18 645 780 ;
+C -1 ; WX 600 ; N Ugrave ; B 101 -18 716 784 ;
+C -1 ; WX 600 ; N Delta ; B 6 0 594 688 ;
+C -1 ; WX 600 ; N thorn ; B -32 -142 622 626 ;
+C -1 ; WX 600 ; N twosuperior ; B 191 230 542 616 ;
+C -1 ; WX 600 ; N Odieresis ; B 74 -18 645 761 ;
+C -1 ; WX 600 ; N mu ; B 49 -142 592 439 ;
+C -1 ; WX 600 ; N igrave ; B 77 0 546 661 ;
+C -1 ; WX 600 ; N ohungarumlaut ; B 71 -15 809 661 ;
+C -1 ; WX 600 ; N Eogonek ; B 25 -199 670 562 ;
+C -1 ; WX 600 ; N dcroat ; B 60 -15 712 626 ;
+C -1 ; WX 600 ; N threequarters ; B 8 -60 699 661 ;
+C -1 ; WX 600 ; N Scedilla ; B 54 -206 673 582 ;
+C -1 ; WX 600 ; N lcaron ; B 77 0 731 626 ;
+C -1 ; WX 600 ; N Kcommaaccent ; B 21 -250 692 562 ;
+C -1 ; WX 600 ; N Lacute ; B 39 0 636 784 ;
+C -1 ; WX 600 ; N trademark ; B 86 230 869 562 ;
+C -1 ; WX 600 ; N edotaccent ; B 81 -15 605 638 ;
+C -1 ; WX 600 ; N Igrave ; B 77 0 643 784 ;
+C -1 ; WX 600 ; N Imacron ; B 77 0 663 708 ;
+C -1 ; WX 600 ; N Lcaron ; B 39 0 757 562 ;
+C -1 ; WX 600 ; N onehalf ; B 22 -60 716 661 ;
+C -1 ; WX 600 ; N lessequal ; B 26 0 671 696 ;
+C -1 ; WX 600 ; N ocircumflex ; B 71 -15 622 657 ;
+C -1 ; WX 600 ; N ntilde ; B 18 0 643 636 ;
+C -1 ; WX 600 ; N Uhungarumlaut ; B 101 -18 805 784 ;
+C -1 ; WX 600 ; N Eacute ; B 25 0 670 784 ;
+C -1 ; WX 600 ; N emacron ; B 81 -15 637 585 ;
+C -1 ; WX 600 ; N gbreve ; B 40 -146 674 661 ;
+C -1 ; WX 600 ; N onequarter ; B 13 -60 707 661 ;
+C -1 ; WX 600 ; N Scaron ; B 54 -22 689 790 ;
+C -1 ; WX 600 ; N Scommaaccent ; B 54 -250 673 582 ;
+C -1 ; WX 600 ; N Ohungarumlaut ; B 74 -18 795 784 ;
+C -1 ; WX 600 ; N degree ; B 173 243 570 616 ;
+C -1 ; WX 600 ; N ograve ; B 71 -15 622 661 ;
+C -1 ; WX 600 ; N Ccaron ; B 74 -18 689 790 ;
+C -1 ; WX 600 ; N ugrave ; B 70 -15 592 661 ;
+C -1 ; WX 600 ; N radical ; B 67 -104 635 778 ;
+C -1 ; WX 600 ; N Dcaron ; B 30 0 664 790 ;
+C -1 ; WX 600 ; N rcommaaccent ; B 47 -250 655 454 ;
+C -1 ; WX 600 ; N Ntilde ; B 8 -12 730 759 ;
+C -1 ; WX 600 ; N otilde ; B 71 -15 643 636 ;
+C -1 ; WX 600 ; N Rcommaaccent ; B 24 -250 617 562 ;
+C -1 ; WX 600 ; N Lcommaaccent ; B 39 -250 636 562 ;
+C -1 ; WX 600 ; N Atilde ; B -9 0 669 759 ;
+C -1 ; WX 600 ; N Aogonek ; B -9 -199 632 562 ;
+C -1 ; WX 600 ; N Aring ; B -9 0 632 801 ;
+C -1 ; WX 600 ; N Otilde ; B 74 -18 669 759 ;
+C -1 ; WX 600 ; N zdotaccent ; B 81 0 614 638 ;
+C -1 ; WX 600 ; N Ecaron ; B 25 0 670 790 ;
+C -1 ; WX 600 ; N Iogonek ; B 77 -199 643 562 ;
+C -1 ; WX 600 ; N kcommaaccent ; B 33 -250 643 626 ;
+C -1 ; WX 600 ; N minus ; B 114 203 596 313 ;
+C -1 ; WX 600 ; N Icircumflex ; B 77 0 643 780 ;
+C -1 ; WX 600 ; N ncaron ; B 18 0 633 667 ;
+C -1 ; WX 600 ; N tcommaaccent ; B 118 -250 567 562 ;
+C -1 ; WX 600 ; N logicalnot ; B 135 103 617 413 ;
+C -1 ; WX 600 ; N odieresis ; B 71 -15 622 638 ;
+C -1 ; WX 600 ; N udieresis ; B 70 -15 595 638 ;
+C -1 ; WX 600 ; N notequal ; B 30 -47 626 563 ;
+C -1 ; WX 600 ; N gcommaaccent ; B 40 -146 674 714 ;
+C -1 ; WX 600 ; N eth ; B 93 -27 661 626 ;
+C -1 ; WX 600 ; N zcaron ; B 81 0 643 667 ;
+C -1 ; WX 600 ; N ncommaaccent ; B 18 -250 615 454 ;
+C -1 ; WX 600 ; N onesuperior ; B 212 230 514 616 ;
+C -1 ; WX 600 ; N imacron ; B 77 0 575 585 ;
+C -1 ; WX 600 ; N Euro ; B 0 0 0 0 ;
+EndCharMetrics
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Courier-Oblique.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Courier-Oblique.afm
new file mode 100644
index 0000000..3dc163f
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Courier-Oblique.afm
@@ -0,0 +1,342 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu May 1 17:37:52 1997
+Comment UniqueID 43051
+Comment VMusage 16248 75829
+FontName Courier-Oblique
+FullName Courier Oblique
+FamilyName Courier
+Weight Medium
+ItalicAngle -12
+IsFixedPitch true
+CharacterSet ExtendedRoman
+FontBBox -27 -250 849 805
+UnderlinePosition -100
+UnderlineThickness 50
+Version 003.000
+Notice Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
+EncodingScheme AdobeStandardEncoding
+CapHeight 562
+XHeight 426
+Ascender 629
+Descender -157
+StdHW 51
+StdVW 51
+StartCharMetrics 315
+C 32 ; WX 600 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 600 ; N exclam ; B 243 -15 464 572 ;
+C 34 ; WX 600 ; N quotedbl ; B 273 328 532 562 ;
+C 35 ; WX 600 ; N numbersign ; B 133 -32 596 639 ;
+C 36 ; WX 600 ; N dollar ; B 108 -126 596 662 ;
+C 37 ; WX 600 ; N percent ; B 134 -15 599 622 ;
+C 38 ; WX 600 ; N ampersand ; B 87 -15 580 543 ;
+C 39 ; WX 600 ; N quoteright ; B 283 328 495 562 ;
+C 40 ; WX 600 ; N parenleft ; B 313 -108 572 622 ;
+C 41 ; WX 600 ; N parenright ; B 137 -108 396 622 ;
+C 42 ; WX 600 ; N asterisk ; B 212 257 580 607 ;
+C 43 ; WX 600 ; N plus ; B 129 44 580 470 ;
+C 44 ; WX 600 ; N comma ; B 157 -112 370 122 ;
+C 45 ; WX 600 ; N hyphen ; B 152 231 558 285 ;
+C 46 ; WX 600 ; N period ; B 238 -15 382 109 ;
+C 47 ; WX 600 ; N slash ; B 112 -80 604 629 ;
+C 48 ; WX 600 ; N zero ; B 154 -15 575 622 ;
+C 49 ; WX 600 ; N one ; B 98 0 515 622 ;
+C 50 ; WX 600 ; N two ; B 70 0 568 622 ;
+C 51 ; WX 600 ; N three ; B 82 -15 538 622 ;
+C 52 ; WX 600 ; N four ; B 108 0 541 622 ;
+C 53 ; WX 600 ; N five ; B 99 -15 589 607 ;
+C 54 ; WX 600 ; N six ; B 155 -15 629 622 ;
+C 55 ; WX 600 ; N seven ; B 182 0 612 607 ;
+C 56 ; WX 600 ; N eight ; B 132 -15 588 622 ;
+C 57 ; WX 600 ; N nine ; B 93 -15 574 622 ;
+C 58 ; WX 600 ; N colon ; B 238 -15 441 385 ;
+C 59 ; WX 600 ; N semicolon ; B 157 -112 441 385 ;
+C 60 ; WX 600 ; N less ; B 96 42 610 472 ;
+C 61 ; WX 600 ; N equal ; B 109 138 600 376 ;
+C 62 ; WX 600 ; N greater ; B 85 42 599 472 ;
+C 63 ; WX 600 ; N question ; B 222 -15 583 572 ;
+C 64 ; WX 600 ; N at ; B 127 -15 582 622 ;
+C 65 ; WX 600 ; N A ; B 3 0 607 562 ;
+C 66 ; WX 600 ; N B ; B 43 0 616 562 ;
+C 67 ; WX 600 ; N C ; B 93 -18 655 580 ;
+C 68 ; WX 600 ; N D ; B 43 0 645 562 ;
+C 69 ; WX 600 ; N E ; B 53 0 660 562 ;
+C 70 ; WX 600 ; N F ; B 53 0 660 562 ;
+C 71 ; WX 600 ; N G ; B 83 -18 645 580 ;
+C 72 ; WX 600 ; N H ; B 32 0 687 562 ;
+C 73 ; WX 600 ; N I ; B 96 0 623 562 ;
+C 74 ; WX 600 ; N J ; B 52 -18 685 562 ;
+C 75 ; WX 600 ; N K ; B 38 0 671 562 ;
+C 76 ; WX 600 ; N L ; B 47 0 607 562 ;
+C 77 ; WX 600 ; N M ; B 4 0 715 562 ;
+C 78 ; WX 600 ; N N ; B 7 -13 712 562 ;
+C 79 ; WX 600 ; N O ; B 94 -18 625 580 ;
+C 80 ; WX 600 ; N P ; B 79 0 644 562 ;
+C 81 ; WX 600 ; N Q ; B 95 -138 625 580 ;
+C 82 ; WX 600 ; N R ; B 38 0 598 562 ;
+C 83 ; WX 600 ; N S ; B 76 -20 650 580 ;
+C 84 ; WX 600 ; N T ; B 108 0 665 562 ;
+C 85 ; WX 600 ; N U ; B 125 -18 702 562 ;
+C 86 ; WX 600 ; N V ; B 105 -13 723 562 ;
+C 87 ; WX 600 ; N W ; B 106 -13 722 562 ;
+C 88 ; WX 600 ; N X ; B 23 0 675 562 ;
+C 89 ; WX 600 ; N Y ; B 133 0 695 562 ;
+C 90 ; WX 600 ; N Z ; B 86 0 610 562 ;
+C 91 ; WX 600 ; N bracketleft ; B 246 -108 574 622 ;
+C 92 ; WX 600 ; N backslash ; B 249 -80 468 629 ;
+C 93 ; WX 600 ; N bracketright ; B 135 -108 463 622 ;
+C 94 ; WX 600 ; N asciicircum ; B 175 354 587 622 ;
+C 95 ; WX 600 ; N underscore ; B -27 -125 584 -75 ;
+C 96 ; WX 600 ; N quoteleft ; B 343 328 457 562 ;
+C 97 ; WX 600 ; N a ; B 76 -15 569 441 ;
+C 98 ; WX 600 ; N b ; B 29 -15 625 629 ;
+C 99 ; WX 600 ; N c ; B 106 -15 608 441 ;
+C 100 ; WX 600 ; N d ; B 85 -15 640 629 ;
+C 101 ; WX 600 ; N e ; B 106 -15 598 441 ;
+C 102 ; WX 600 ; N f ; B 114 0 662 629 ; L i fi ; L l fl ;
+C 103 ; WX 600 ; N g ; B 61 -157 657 441 ;
+C 104 ; WX 600 ; N h ; B 33 0 592 629 ;
+C 105 ; WX 600 ; N i ; B 95 0 515 657 ;
+C 106 ; WX 600 ; N j ; B 52 -157 550 657 ;
+C 107 ; WX 600 ; N k ; B 58 0 633 629 ;
+C 108 ; WX 600 ; N l ; B 95 0 515 629 ;
+C 109 ; WX 600 ; N m ; B -5 0 615 441 ;
+C 110 ; WX 600 ; N n ; B 26 0 585 441 ;
+C 111 ; WX 600 ; N o ; B 102 -15 588 441 ;
+C 112 ; WX 600 ; N p ; B -24 -157 605 441 ;
+C 113 ; WX 600 ; N q ; B 85 -157 682 441 ;
+C 114 ; WX 600 ; N r ; B 60 0 636 441 ;
+C 115 ; WX 600 ; N s ; B 78 -15 584 441 ;
+C 116 ; WX 600 ; N t ; B 167 -15 561 561 ;
+C 117 ; WX 600 ; N u ; B 101 -15 572 426 ;
+C 118 ; WX 600 ; N v ; B 90 -10 681 426 ;
+C 119 ; WX 600 ; N w ; B 76 -10 695 426 ;
+C 120 ; WX 600 ; N x ; B 20 0 655 426 ;
+C 121 ; WX 600 ; N y ; B -4 -157 683 426 ;
+C 122 ; WX 600 ; N z ; B 99 0 593 426 ;
+C 123 ; WX 600 ; N braceleft ; B 233 -108 569 622 ;
+C 124 ; WX 600 ; N bar ; B 222 -250 485 750 ;
+C 125 ; WX 600 ; N braceright ; B 140 -108 477 622 ;
+C 126 ; WX 600 ; N asciitilde ; B 116 197 600 320 ;
+C 161 ; WX 600 ; N exclamdown ; B 225 -157 445 430 ;
+C 162 ; WX 600 ; N cent ; B 151 -49 588 614 ;
+C 163 ; WX 600 ; N sterling ; B 124 -21 621 611 ;
+C 164 ; WX 600 ; N fraction ; B 84 -57 646 665 ;
+C 165 ; WX 600 ; N yen ; B 120 0 693 562 ;
+C 166 ; WX 600 ; N florin ; B -26 -143 671 622 ;
+C 167 ; WX 600 ; N section ; B 104 -78 590 580 ;
+C 168 ; WX 600 ; N currency ; B 94 58 628 506 ;
+C 169 ; WX 600 ; N quotesingle ; B 345 328 460 562 ;
+C 170 ; WX 600 ; N quotedblleft ; B 262 328 541 562 ;
+C 171 ; WX 600 ; N guillemotleft ; B 92 70 652 446 ;
+C 172 ; WX 600 ; N guilsinglleft ; B 204 70 540 446 ;
+C 173 ; WX 600 ; N guilsinglright ; B 170 70 506 446 ;
+C 174 ; WX 600 ; N fi ; B 3 0 619 629 ;
+C 175 ; WX 600 ; N fl ; B 3 0 619 629 ;
+C 177 ; WX 600 ; N endash ; B 124 231 586 285 ;
+C 178 ; WX 600 ; N dagger ; B 217 -78 546 580 ;
+C 179 ; WX 600 ; N daggerdbl ; B 163 -78 546 580 ;
+C 180 ; WX 600 ; N periodcentered ; B 275 189 434 327 ;
+C 182 ; WX 600 ; N paragraph ; B 100 -78 630 562 ;
+C 183 ; WX 600 ; N bullet ; B 224 130 485 383 ;
+C 184 ; WX 600 ; N quotesinglbase ; B 185 -134 397 100 ;
+C 185 ; WX 600 ; N quotedblbase ; B 115 -134 478 100 ;
+C 186 ; WX 600 ; N quotedblright ; B 213 328 576 562 ;
+C 187 ; WX 600 ; N guillemotright ; B 58 70 618 446 ;
+C 188 ; WX 600 ; N ellipsis ; B 46 -15 575 111 ;
+C 189 ; WX 600 ; N perthousand ; B 59 -15 627 622 ;
+C 191 ; WX 600 ; N questiondown ; B 105 -157 466 430 ;
+C 193 ; WX 600 ; N grave ; B 294 497 484 672 ;
+C 194 ; WX 600 ; N acute ; B 348 497 612 672 ;
+C 195 ; WX 600 ; N circumflex ; B 229 477 581 654 ;
+C 196 ; WX 600 ; N tilde ; B 212 489 629 606 ;
+C 197 ; WX 600 ; N macron ; B 232 525 600 565 ;
+C 198 ; WX 600 ; N breve ; B 279 501 576 609 ;
+C 199 ; WX 600 ; N dotaccent ; B 373 537 478 640 ;
+C 200 ; WX 600 ; N dieresis ; B 272 537 579 640 ;
+C 202 ; WX 600 ; N ring ; B 332 463 500 627 ;
+C 203 ; WX 600 ; N cedilla ; B 197 -151 344 10 ;
+C 205 ; WX 600 ; N hungarumlaut ; B 239 497 683 672 ;
+C 206 ; WX 600 ; N ogonek ; B 189 -172 377 4 ;
+C 207 ; WX 600 ; N caron ; B 262 492 614 669 ;
+C 208 ; WX 600 ; N emdash ; B 49 231 661 285 ;
+C 225 ; WX 600 ; N AE ; B 3 0 655 562 ;
+C 227 ; WX 600 ; N ordfeminine ; B 209 249 512 580 ;
+C 232 ; WX 600 ; N Lslash ; B 47 0 607 562 ;
+C 233 ; WX 600 ; N Oslash ; B 94 -80 625 629 ;
+C 234 ; WX 600 ; N OE ; B 59 0 672 562 ;
+C 235 ; WX 600 ; N ordmasculine ; B 210 249 535 580 ;
+C 241 ; WX 600 ; N ae ; B 41 -15 626 441 ;
+C 245 ; WX 600 ; N dotlessi ; B 95 0 515 426 ;
+C 248 ; WX 600 ; N lslash ; B 95 0 587 629 ;
+C 249 ; WX 600 ; N oslash ; B 102 -80 588 506 ;
+C 250 ; WX 600 ; N oe ; B 54 -15 615 441 ;
+C 251 ; WX 600 ; N germandbls ; B 48 -15 617 629 ;
+C -1 ; WX 600 ; N Idieresis ; B 96 0 623 753 ;
+C -1 ; WX 600 ; N eacute ; B 106 -15 612 672 ;
+C -1 ; WX 600 ; N abreve ; B 76 -15 576 609 ;
+C -1 ; WX 600 ; N uhungarumlaut ; B 101 -15 723 672 ;
+C -1 ; WX 600 ; N ecaron ; B 106 -15 614 669 ;
+C -1 ; WX 600 ; N Ydieresis ; B 133 0 695 753 ;
+C -1 ; WX 600 ; N divide ; B 136 48 573 467 ;
+C -1 ; WX 600 ; N Yacute ; B 133 0 695 805 ;
+C -1 ; WX 600 ; N Acircumflex ; B 3 0 607 787 ;
+C -1 ; WX 600 ; N aacute ; B 76 -15 612 672 ;
+C -1 ; WX 600 ; N Ucircumflex ; B 125 -18 702 787 ;
+C -1 ; WX 600 ; N yacute ; B -4 -157 683 672 ;
+C -1 ; WX 600 ; N scommaaccent ; B 78 -250 584 441 ;
+C -1 ; WX 600 ; N ecircumflex ; B 106 -15 598 654 ;
+C -1 ; WX 600 ; N Uring ; B 125 -18 702 760 ;
+C -1 ; WX 600 ; N Udieresis ; B 125 -18 702 753 ;
+C -1 ; WX 600 ; N aogonek ; B 76 -172 569 441 ;
+C -1 ; WX 600 ; N Uacute ; B 125 -18 702 805 ;
+C -1 ; WX 600 ; N uogonek ; B 101 -172 572 426 ;
+C -1 ; WX 600 ; N Edieresis ; B 53 0 660 753 ;
+C -1 ; WX 600 ; N Dcroat ; B 43 0 645 562 ;
+C -1 ; WX 600 ; N commaaccent ; B 145 -250 323 -58 ;
+C -1 ; WX 600 ; N copyright ; B 53 -18 667 580 ;
+C -1 ; WX 600 ; N Emacron ; B 53 0 660 698 ;
+C -1 ; WX 600 ; N ccaron ; B 106 -15 614 669 ;
+C -1 ; WX 600 ; N aring ; B 76 -15 569 627 ;
+C -1 ; WX 600 ; N Ncommaaccent ; B 7 -250 712 562 ;
+C -1 ; WX 600 ; N lacute ; B 95 0 640 805 ;
+C -1 ; WX 600 ; N agrave ; B 76 -15 569 672 ;
+C -1 ; WX 600 ; N Tcommaaccent ; B 108 -250 665 562 ;
+C -1 ; WX 600 ; N Cacute ; B 93 -18 655 805 ;
+C -1 ; WX 600 ; N atilde ; B 76 -15 629 606 ;
+C -1 ; WX 600 ; N Edotaccent ; B 53 0 660 753 ;
+C -1 ; WX 600 ; N scaron ; B 78 -15 614 669 ;
+C -1 ; WX 600 ; N scedilla ; B 78 -151 584 441 ;
+C -1 ; WX 600 ; N iacute ; B 95 0 612 672 ;
+C -1 ; WX 600 ; N lozenge ; B 94 0 519 706 ;
+C -1 ; WX 600 ; N Rcaron ; B 38 0 642 802 ;
+C -1 ; WX 600 ; N Gcommaaccent ; B 83 -250 645 580 ;
+C -1 ; WX 600 ; N ucircumflex ; B 101 -15 572 654 ;
+C -1 ; WX 600 ; N acircumflex ; B 76 -15 581 654 ;
+C -1 ; WX 600 ; N Amacron ; B 3 0 607 698 ;
+C -1 ; WX 600 ; N rcaron ; B 60 0 636 669 ;
+C -1 ; WX 600 ; N ccedilla ; B 106 -151 614 441 ;
+C -1 ; WX 600 ; N Zdotaccent ; B 86 0 610 753 ;
+C -1 ; WX 600 ; N Thorn ; B 79 0 606 562 ;
+C -1 ; WX 600 ; N Omacron ; B 94 -18 628 698 ;
+C -1 ; WX 600 ; N Racute ; B 38 0 670 805 ;
+C -1 ; WX 600 ; N Sacute ; B 76 -20 650 805 ;
+C -1 ; WX 600 ; N dcaron ; B 85 -15 849 629 ;
+C -1 ; WX 600 ; N Umacron ; B 125 -18 702 698 ;
+C -1 ; WX 600 ; N uring ; B 101 -15 572 627 ;
+C -1 ; WX 600 ; N threesuperior ; B 213 240 501 622 ;
+C -1 ; WX 600 ; N Ograve ; B 94 -18 625 805 ;
+C -1 ; WX 600 ; N Agrave ; B 3 0 607 805 ;
+C -1 ; WX 600 ; N Abreve ; B 3 0 607 732 ;
+C -1 ; WX 600 ; N multiply ; B 103 43 607 470 ;
+C -1 ; WX 600 ; N uacute ; B 101 -15 602 672 ;
+C -1 ; WX 600 ; N Tcaron ; B 108 0 665 802 ;
+C -1 ; WX 600 ; N partialdiff ; B 45 -38 546 710 ;
+C -1 ; WX 600 ; N ydieresis ; B -4 -157 683 620 ;
+C -1 ; WX 600 ; N Nacute ; B 7 -13 712 805 ;
+C -1 ; WX 600 ; N icircumflex ; B 95 0 551 654 ;
+C -1 ; WX 600 ; N Ecircumflex ; B 53 0 660 787 ;
+C -1 ; WX 600 ; N adieresis ; B 76 -15 575 620 ;
+C -1 ; WX 600 ; N edieresis ; B 106 -15 598 620 ;
+C -1 ; WX 600 ; N cacute ; B 106 -15 612 672 ;
+C -1 ; WX 600 ; N nacute ; B 26 0 602 672 ;
+C -1 ; WX 600 ; N umacron ; B 101 -15 600 565 ;
+C -1 ; WX 600 ; N Ncaron ; B 7 -13 712 802 ;
+C -1 ; WX 600 ; N Iacute ; B 96 0 640 805 ;
+C -1 ; WX 600 ; N plusminus ; B 96 44 594 558 ;
+C -1 ; WX 600 ; N brokenbar ; B 238 -175 469 675 ;
+C -1 ; WX 600 ; N registered ; B 53 -18 667 580 ;
+C -1 ; WX 600 ; N Gbreve ; B 83 -18 645 732 ;
+C -1 ; WX 600 ; N Idotaccent ; B 96 0 623 753 ;
+C -1 ; WX 600 ; N summation ; B 15 -10 670 706 ;
+C -1 ; WX 600 ; N Egrave ; B 53 0 660 805 ;
+C -1 ; WX 600 ; N racute ; B 60 0 636 672 ;
+C -1 ; WX 600 ; N omacron ; B 102 -15 600 565 ;
+C -1 ; WX 600 ; N Zacute ; B 86 0 670 805 ;
+C -1 ; WX 600 ; N Zcaron ; B 86 0 642 802 ;
+C -1 ; WX 600 ; N greaterequal ; B 98 0 594 710 ;
+C -1 ; WX 600 ; N Eth ; B 43 0 645 562 ;
+C -1 ; WX 600 ; N Ccedilla ; B 93 -151 658 580 ;
+C -1 ; WX 600 ; N lcommaaccent ; B 95 -250 515 629 ;
+C -1 ; WX 600 ; N tcaron ; B 167 -15 587 717 ;
+C -1 ; WX 600 ; N eogonek ; B 106 -172 598 441 ;
+C -1 ; WX 600 ; N Uogonek ; B 124 -172 702 562 ;
+C -1 ; WX 600 ; N Aacute ; B 3 0 660 805 ;
+C -1 ; WX 600 ; N Adieresis ; B 3 0 607 753 ;
+C -1 ; WX 600 ; N egrave ; B 106 -15 598 672 ;
+C -1 ; WX 600 ; N zacute ; B 99 0 612 672 ;
+C -1 ; WX 600 ; N iogonek ; B 95 -172 515 657 ;
+C -1 ; WX 600 ; N Oacute ; B 94 -18 640 805 ;
+C -1 ; WX 600 ; N oacute ; B 102 -15 612 672 ;
+C -1 ; WX 600 ; N amacron ; B 76 -15 600 565 ;
+C -1 ; WX 600 ; N sacute ; B 78 -15 612 672 ;
+C -1 ; WX 600 ; N idieresis ; B 95 0 545 620 ;
+C -1 ; WX 600 ; N Ocircumflex ; B 94 -18 625 787 ;
+C -1 ; WX 600 ; N Ugrave ; B 125 -18 702 805 ;
+C -1 ; WX 600 ; N Delta ; B 6 0 598 688 ;
+C -1 ; WX 600 ; N thorn ; B -24 -157 605 629 ;
+C -1 ; WX 600 ; N twosuperior ; B 230 249 535 622 ;
+C -1 ; WX 600 ; N Odieresis ; B 94 -18 625 753 ;
+C -1 ; WX 600 ; N mu ; B 72 -157 572 426 ;
+C -1 ; WX 600 ; N igrave ; B 95 0 515 672 ;
+C -1 ; WX 600 ; N ohungarumlaut ; B 102 -15 723 672 ;
+C -1 ; WX 600 ; N Eogonek ; B 53 -172 660 562 ;
+C -1 ; WX 600 ; N dcroat ; B 85 -15 704 629 ;
+C -1 ; WX 600 ; N threequarters ; B 73 -56 659 666 ;
+C -1 ; WX 600 ; N Scedilla ; B 76 -151 650 580 ;
+C -1 ; WX 600 ; N lcaron ; B 95 0 667 629 ;
+C -1 ; WX 600 ; N Kcommaaccent ; B 38 -250 671 562 ;
+C -1 ; WX 600 ; N Lacute ; B 47 0 607 805 ;
+C -1 ; WX 600 ; N trademark ; B 75 263 742 562 ;
+C -1 ; WX 600 ; N edotaccent ; B 106 -15 598 620 ;
+C -1 ; WX 600 ; N Igrave ; B 96 0 623 805 ;
+C -1 ; WX 600 ; N Imacron ; B 96 0 628 698 ;
+C -1 ; WX 600 ; N Lcaron ; B 47 0 632 562 ;
+C -1 ; WX 600 ; N onehalf ; B 65 -57 669 665 ;
+C -1 ; WX 600 ; N lessequal ; B 98 0 645 710 ;
+C -1 ; WX 600 ; N ocircumflex ; B 102 -15 588 654 ;
+C -1 ; WX 600 ; N ntilde ; B 26 0 629 606 ;
+C -1 ; WX 600 ; N Uhungarumlaut ; B 125 -18 761 805 ;
+C -1 ; WX 600 ; N Eacute ; B 53 0 670 805 ;
+C -1 ; WX 600 ; N emacron ; B 106 -15 600 565 ;
+C -1 ; WX 600 ; N gbreve ; B 61 -157 657 609 ;
+C -1 ; WX 600 ; N onequarter ; B 65 -57 674 665 ;
+C -1 ; WX 600 ; N Scaron ; B 76 -20 672 802 ;
+C -1 ; WX 600 ; N Scommaaccent ; B 76 -250 650 580 ;
+C -1 ; WX 600 ; N Ohungarumlaut ; B 94 -18 751 805 ;
+C -1 ; WX 600 ; N degree ; B 214 269 576 622 ;
+C -1 ; WX 600 ; N ograve ; B 102 -15 588 672 ;
+C -1 ; WX 600 ; N Ccaron ; B 93 -18 672 802 ;
+C -1 ; WX 600 ; N ugrave ; B 101 -15 572 672 ;
+C -1 ; WX 600 ; N radical ; B 85 -15 765 792 ;
+C -1 ; WX 600 ; N Dcaron ; B 43 0 645 802 ;
+C -1 ; WX 600 ; N rcommaaccent ; B 60 -250 636 441 ;
+C -1 ; WX 600 ; N Ntilde ; B 7 -13 712 729 ;
+C -1 ; WX 600 ; N otilde ; B 102 -15 629 606 ;
+C -1 ; WX 600 ; N Rcommaaccent ; B 38 -250 598 562 ;
+C -1 ; WX 600 ; N Lcommaaccent ; B 47 -250 607 562 ;
+C -1 ; WX 600 ; N Atilde ; B 3 0 655 729 ;
+C -1 ; WX 600 ; N Aogonek ; B 3 -172 607 562 ;
+C -1 ; WX 600 ; N Aring ; B 3 0 607 750 ;
+C -1 ; WX 600 ; N Otilde ; B 94 -18 655 729 ;
+C -1 ; WX 600 ; N zdotaccent ; B 99 0 593 620 ;
+C -1 ; WX 600 ; N Ecaron ; B 53 0 660 802 ;
+C -1 ; WX 600 ; N Iogonek ; B 96 -172 623 562 ;
+C -1 ; WX 600 ; N kcommaaccent ; B 58 -250 633 629 ;
+C -1 ; WX 600 ; N minus ; B 129 232 580 283 ;
+C -1 ; WX 600 ; N Icircumflex ; B 96 0 623 787 ;
+C -1 ; WX 600 ; N ncaron ; B 26 0 614 669 ;
+C -1 ; WX 600 ; N tcommaaccent ; B 165 -250 561 561 ;
+C -1 ; WX 600 ; N logicalnot ; B 155 108 591 369 ;
+C -1 ; WX 600 ; N odieresis ; B 102 -15 588 620 ;
+C -1 ; WX 600 ; N udieresis ; B 101 -15 575 620 ;
+C -1 ; WX 600 ; N notequal ; B 43 -16 621 529 ;
+C -1 ; WX 600 ; N gcommaaccent ; B 61 -157 657 708 ;
+C -1 ; WX 600 ; N eth ; B 102 -15 639 629 ;
+C -1 ; WX 600 ; N zcaron ; B 99 0 624 669 ;
+C -1 ; WX 600 ; N ncommaaccent ; B 26 -250 585 441 ;
+C -1 ; WX 600 ; N onesuperior ; B 231 249 491 622 ;
+C -1 ; WX 600 ; N imacron ; B 95 0 543 565 ;
+C -1 ; WX 600 ; N Euro ; B 0 0 0 0 ;
+EndCharMetrics
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Courier.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Courier.afm
new file mode 100644
index 0000000..2f7be81
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Courier.afm
@@ -0,0 +1,342 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu May 1 17:27:09 1997
+Comment UniqueID 43050
+Comment VMusage 39754 50779
+FontName Courier
+FullName Courier
+FamilyName Courier
+Weight Medium
+ItalicAngle 0
+IsFixedPitch true
+CharacterSet ExtendedRoman
+FontBBox -23 -250 715 805
+UnderlinePosition -100
+UnderlineThickness 50
+Version 003.000
+Notice Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
+EncodingScheme AdobeStandardEncoding
+CapHeight 562
+XHeight 426
+Ascender 629
+Descender -157
+StdHW 51
+StdVW 51
+StartCharMetrics 315
+C 32 ; WX 600 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 600 ; N exclam ; B 236 -15 364 572 ;
+C 34 ; WX 600 ; N quotedbl ; B 187 328 413 562 ;
+C 35 ; WX 600 ; N numbersign ; B 93 -32 507 639 ;
+C 36 ; WX 600 ; N dollar ; B 105 -126 496 662 ;
+C 37 ; WX 600 ; N percent ; B 81 -15 518 622 ;
+C 38 ; WX 600 ; N ampersand ; B 63 -15 538 543 ;
+C 39 ; WX 600 ; N quoteright ; B 213 328 376 562 ;
+C 40 ; WX 600 ; N parenleft ; B 269 -108 440 622 ;
+C 41 ; WX 600 ; N parenright ; B 160 -108 331 622 ;
+C 42 ; WX 600 ; N asterisk ; B 116 257 484 607 ;
+C 43 ; WX 600 ; N plus ; B 80 44 520 470 ;
+C 44 ; WX 600 ; N comma ; B 181 -112 344 122 ;
+C 45 ; WX 600 ; N hyphen ; B 103 231 497 285 ;
+C 46 ; WX 600 ; N period ; B 229 -15 371 109 ;
+C 47 ; WX 600 ; N slash ; B 125 -80 475 629 ;
+C 48 ; WX 600 ; N zero ; B 106 -15 494 622 ;
+C 49 ; WX 600 ; N one ; B 96 0 505 622 ;
+C 50 ; WX 600 ; N two ; B 70 0 471 622 ;
+C 51 ; WX 600 ; N three ; B 75 -15 466 622 ;
+C 52 ; WX 600 ; N four ; B 78 0 500 622 ;
+C 53 ; WX 600 ; N five ; B 92 -15 497 607 ;
+C 54 ; WX 600 ; N six ; B 111 -15 497 622 ;
+C 55 ; WX 600 ; N seven ; B 82 0 483 607 ;
+C 56 ; WX 600 ; N eight ; B 102 -15 498 622 ;
+C 57 ; WX 600 ; N nine ; B 96 -15 489 622 ;
+C 58 ; WX 600 ; N colon ; B 229 -15 371 385 ;
+C 59 ; WX 600 ; N semicolon ; B 181 -112 371 385 ;
+C 60 ; WX 600 ; N less ; B 41 42 519 472 ;
+C 61 ; WX 600 ; N equal ; B 80 138 520 376 ;
+C 62 ; WX 600 ; N greater ; B 66 42 544 472 ;
+C 63 ; WX 600 ; N question ; B 129 -15 492 572 ;
+C 64 ; WX 600 ; N at ; B 77 -15 533 622 ;
+C 65 ; WX 600 ; N A ; B 3 0 597 562 ;
+C 66 ; WX 600 ; N B ; B 43 0 559 562 ;
+C 67 ; WX 600 ; N C ; B 41 -18 540 580 ;
+C 68 ; WX 600 ; N D ; B 43 0 574 562 ;
+C 69 ; WX 600 ; N E ; B 53 0 550 562 ;
+C 70 ; WX 600 ; N F ; B 53 0 545 562 ;
+C 71 ; WX 600 ; N G ; B 31 -18 575 580 ;
+C 72 ; WX 600 ; N H ; B 32 0 568 562 ;
+C 73 ; WX 600 ; N I ; B 96 0 504 562 ;
+C 74 ; WX 600 ; N J ; B 34 -18 566 562 ;
+C 75 ; WX 600 ; N K ; B 38 0 582 562 ;
+C 76 ; WX 600 ; N L ; B 47 0 554 562 ;
+C 77 ; WX 600 ; N M ; B 4 0 596 562 ;
+C 78 ; WX 600 ; N N ; B 7 -13 593 562 ;
+C 79 ; WX 600 ; N O ; B 43 -18 557 580 ;
+C 80 ; WX 600 ; N P ; B 79 0 558 562 ;
+C 81 ; WX 600 ; N Q ; B 43 -138 557 580 ;
+C 82 ; WX 600 ; N R ; B 38 0 588 562 ;
+C 83 ; WX 600 ; N S ; B 72 -20 529 580 ;
+C 84 ; WX 600 ; N T ; B 38 0 563 562 ;
+C 85 ; WX 600 ; N U ; B 17 -18 583 562 ;
+C 86 ; WX 600 ; N V ; B -4 -13 604 562 ;
+C 87 ; WX 600 ; N W ; B -3 -13 603 562 ;
+C 88 ; WX 600 ; N X ; B 23 0 577 562 ;
+C 89 ; WX 600 ; N Y ; B 24 0 576 562 ;
+C 90 ; WX 600 ; N Z ; B 86 0 514 562 ;
+C 91 ; WX 600 ; N bracketleft ; B 269 -108 442 622 ;
+C 92 ; WX 600 ; N backslash ; B 118 -80 482 629 ;
+C 93 ; WX 600 ; N bracketright ; B 158 -108 331 622 ;
+C 94 ; WX 600 ; N asciicircum ; B 94 354 506 622 ;
+C 95 ; WX 600 ; N underscore ; B 0 -125 600 -75 ;
+C 96 ; WX 600 ; N quoteleft ; B 224 328 387 562 ;
+C 97 ; WX 600 ; N a ; B 53 -15 559 441 ;
+C 98 ; WX 600 ; N b ; B 14 -15 575 629 ;
+C 99 ; WX 600 ; N c ; B 66 -15 529 441 ;
+C 100 ; WX 600 ; N d ; B 45 -15 591 629 ;
+C 101 ; WX 600 ; N e ; B 66 -15 548 441 ;
+C 102 ; WX 600 ; N f ; B 114 0 531 629 ; L i fi ; L l fl ;
+C 103 ; WX 600 ; N g ; B 45 -157 566 441 ;
+C 104 ; WX 600 ; N h ; B 18 0 582 629 ;
+C 105 ; WX 600 ; N i ; B 95 0 505 657 ;
+C 106 ; WX 600 ; N j ; B 82 -157 410 657 ;
+C 107 ; WX 600 ; N k ; B 43 0 580 629 ;
+C 108 ; WX 600 ; N l ; B 95 0 505 629 ;
+C 109 ; WX 600 ; N m ; B -5 0 605 441 ;
+C 110 ; WX 600 ; N n ; B 26 0 575 441 ;
+C 111 ; WX 600 ; N o ; B 62 -15 538 441 ;
+C 112 ; WX 600 ; N p ; B 9 -157 555 441 ;
+C 113 ; WX 600 ; N q ; B 45 -157 591 441 ;
+C 114 ; WX 600 ; N r ; B 60 0 559 441 ;
+C 115 ; WX 600 ; N s ; B 80 -15 513 441 ;
+C 116 ; WX 600 ; N t ; B 87 -15 530 561 ;
+C 117 ; WX 600 ; N u ; B 21 -15 562 426 ;
+C 118 ; WX 600 ; N v ; B 10 -10 590 426 ;
+C 119 ; WX 600 ; N w ; B -4 -10 604 426 ;
+C 120 ; WX 600 ; N x ; B 20 0 580 426 ;
+C 121 ; WX 600 ; N y ; B 7 -157 592 426 ;
+C 122 ; WX 600 ; N z ; B 99 0 502 426 ;
+C 123 ; WX 600 ; N braceleft ; B 182 -108 437 622 ;
+C 124 ; WX 600 ; N bar ; B 275 -250 326 750 ;
+C 125 ; WX 600 ; N braceright ; B 163 -108 418 622 ;
+C 126 ; WX 600 ; N asciitilde ; B 63 197 540 320 ;
+C 161 ; WX 600 ; N exclamdown ; B 236 -157 364 430 ;
+C 162 ; WX 600 ; N cent ; B 96 -49 500 614 ;
+C 163 ; WX 600 ; N sterling ; B 84 -21 521 611 ;
+C 164 ; WX 600 ; N fraction ; B 92 -57 509 665 ;
+C 165 ; WX 600 ; N yen ; B 26 0 574 562 ;
+C 166 ; WX 600 ; N florin ; B 4 -143 539 622 ;
+C 167 ; WX 600 ; N section ; B 113 -78 488 580 ;
+C 168 ; WX 600 ; N currency ; B 73 58 527 506 ;
+C 169 ; WX 600 ; N quotesingle ; B 259 328 341 562 ;
+C 170 ; WX 600 ; N quotedblleft ; B 143 328 471 562 ;
+C 171 ; WX 600 ; N guillemotleft ; B 37 70 563 446 ;
+C 172 ; WX 600 ; N guilsinglleft ; B 149 70 451 446 ;
+C 173 ; WX 600 ; N guilsinglright ; B 149 70 451 446 ;
+C 174 ; WX 600 ; N fi ; B 3 0 597 629 ;
+C 175 ; WX 600 ; N fl ; B 3 0 597 629 ;
+C 177 ; WX 600 ; N endash ; B 75 231 525 285 ;
+C 178 ; WX 600 ; N dagger ; B 141 -78 459 580 ;
+C 179 ; WX 600 ; N daggerdbl ; B 141 -78 459 580 ;
+C 180 ; WX 600 ; N periodcentered ; B 222 189 378 327 ;
+C 182 ; WX 600 ; N paragraph ; B 50 -78 511 562 ;
+C 183 ; WX 600 ; N bullet ; B 172 130 428 383 ;
+C 184 ; WX 600 ; N quotesinglbase ; B 213 -134 376 100 ;
+C 185 ; WX 600 ; N quotedblbase ; B 143 -134 457 100 ;
+C 186 ; WX 600 ; N quotedblright ; B 143 328 457 562 ;
+C 187 ; WX 600 ; N guillemotright ; B 37 70 563 446 ;
+C 188 ; WX 600 ; N ellipsis ; B 37 -15 563 111 ;
+C 189 ; WX 600 ; N perthousand ; B 3 -15 600 622 ;
+C 191 ; WX 600 ; N questiondown ; B 108 -157 471 430 ;
+C 193 ; WX 600 ; N grave ; B 151 497 378 672 ;
+C 194 ; WX 600 ; N acute ; B 242 497 469 672 ;
+C 195 ; WX 600 ; N circumflex ; B 124 477 476 654 ;
+C 196 ; WX 600 ; N tilde ; B 105 489 503 606 ;
+C 197 ; WX 600 ; N macron ; B 120 525 480 565 ;
+C 198 ; WX 600 ; N breve ; B 153 501 447 609 ;
+C 199 ; WX 600 ; N dotaccent ; B 249 537 352 640 ;
+C 200 ; WX 600 ; N dieresis ; B 148 537 453 640 ;
+C 202 ; WX 600 ; N ring ; B 218 463 382 627 ;
+C 203 ; WX 600 ; N cedilla ; B 224 -151 362 10 ;
+C 205 ; WX 600 ; N hungarumlaut ; B 133 497 540 672 ;
+C 206 ; WX 600 ; N ogonek ; B 211 -172 407 4 ;
+C 207 ; WX 600 ; N caron ; B 124 492 476 669 ;
+C 208 ; WX 600 ; N emdash ; B 0 231 600 285 ;
+C 225 ; WX 600 ; N AE ; B 3 0 550 562 ;
+C 227 ; WX 600 ; N ordfeminine ; B 156 249 442 580 ;
+C 232 ; WX 600 ; N Lslash ; B 47 0 554 562 ;
+C 233 ; WX 600 ; N Oslash ; B 43 -80 557 629 ;
+C 234 ; WX 600 ; N OE ; B 7 0 567 562 ;
+C 235 ; WX 600 ; N ordmasculine ; B 157 249 443 580 ;
+C 241 ; WX 600 ; N ae ; B 19 -15 570 441 ;
+C 245 ; WX 600 ; N dotlessi ; B 95 0 505 426 ;
+C 248 ; WX 600 ; N lslash ; B 95 0 505 629 ;
+C 249 ; WX 600 ; N oslash ; B 62 -80 538 506 ;
+C 250 ; WX 600 ; N oe ; B 19 -15 559 441 ;
+C 251 ; WX 600 ; N germandbls ; B 48 -15 588 629 ;
+C -1 ; WX 600 ; N Idieresis ; B 96 0 504 753 ;
+C -1 ; WX 600 ; N eacute ; B 66 -15 548 672 ;
+C -1 ; WX 600 ; N abreve ; B 53 -15 559 609 ;
+C -1 ; WX 600 ; N uhungarumlaut ; B 21 -15 580 672 ;
+C -1 ; WX 600 ; N ecaron ; B 66 -15 548 669 ;
+C -1 ; WX 600 ; N Ydieresis ; B 24 0 576 753 ;
+C -1 ; WX 600 ; N divide ; B 87 48 513 467 ;
+C -1 ; WX 600 ; N Yacute ; B 24 0 576 805 ;
+C -1 ; WX 600 ; N Acircumflex ; B 3 0 597 787 ;
+C -1 ; WX 600 ; N aacute ; B 53 -15 559 672 ;
+C -1 ; WX 600 ; N Ucircumflex ; B 17 -18 583 787 ;
+C -1 ; WX 600 ; N yacute ; B 7 -157 592 672 ;
+C -1 ; WX 600 ; N scommaaccent ; B 80 -250 513 441 ;
+C -1 ; WX 600 ; N ecircumflex ; B 66 -15 548 654 ;
+C -1 ; WX 600 ; N Uring ; B 17 -18 583 760 ;
+C -1 ; WX 600 ; N Udieresis ; B 17 -18 583 753 ;
+C -1 ; WX 600 ; N aogonek ; B 53 -172 587 441 ;
+C -1 ; WX 600 ; N Uacute ; B 17 -18 583 805 ;
+C -1 ; WX 600 ; N uogonek ; B 21 -172 590 426 ;
+C -1 ; WX 600 ; N Edieresis ; B 53 0 550 753 ;
+C -1 ; WX 600 ; N Dcroat ; B 30 0 574 562 ;
+C -1 ; WX 600 ; N commaaccent ; B 198 -250 335 -58 ;
+C -1 ; WX 600 ; N copyright ; B 0 -18 600 580 ;
+C -1 ; WX 600 ; N Emacron ; B 53 0 550 698 ;
+C -1 ; WX 600 ; N ccaron ; B 66 -15 529 669 ;
+C -1 ; WX 600 ; N aring ; B 53 -15 559 627 ;
+C -1 ; WX 600 ; N Ncommaaccent ; B 7 -250 593 562 ;
+C -1 ; WX 600 ; N lacute ; B 95 0 505 805 ;
+C -1 ; WX 600 ; N agrave ; B 53 -15 559 672 ;
+C -1 ; WX 600 ; N Tcommaaccent ; B 38 -250 563 562 ;
+C -1 ; WX 600 ; N Cacute ; B 41 -18 540 805 ;
+C -1 ; WX 600 ; N atilde ; B 53 -15 559 606 ;
+C -1 ; WX 600 ; N Edotaccent ; B 53 0 550 753 ;
+C -1 ; WX 600 ; N scaron ; B 80 -15 513 669 ;
+C -1 ; WX 600 ; N scedilla ; B 80 -151 513 441 ;
+C -1 ; WX 600 ; N iacute ; B 95 0 505 672 ;
+C -1 ; WX 600 ; N lozenge ; B 18 0 443 706 ;
+C -1 ; WX 600 ; N Rcaron ; B 38 0 588 802 ;
+C -1 ; WX 600 ; N Gcommaaccent ; B 31 -250 575 580 ;
+C -1 ; WX 600 ; N ucircumflex ; B 21 -15 562 654 ;
+C -1 ; WX 600 ; N acircumflex ; B 53 -15 559 654 ;
+C -1 ; WX 600 ; N Amacron ; B 3 0 597 698 ;
+C -1 ; WX 600 ; N rcaron ; B 60 0 559 669 ;
+C -1 ; WX 600 ; N ccedilla ; B 66 -151 529 441 ;
+C -1 ; WX 600 ; N Zdotaccent ; B 86 0 514 753 ;
+C -1 ; WX 600 ; N Thorn ; B 79 0 538 562 ;
+C -1 ; WX 600 ; N Omacron ; B 43 -18 557 698 ;
+C -1 ; WX 600 ; N Racute ; B 38 0 588 805 ;
+C -1 ; WX 600 ; N Sacute ; B 72 -20 529 805 ;
+C -1 ; WX 600 ; N dcaron ; B 45 -15 715 629 ;
+C -1 ; WX 600 ; N Umacron ; B 17 -18 583 698 ;
+C -1 ; WX 600 ; N uring ; B 21 -15 562 627 ;
+C -1 ; WX 600 ; N threesuperior ; B 155 240 406 622 ;
+C -1 ; WX 600 ; N Ograve ; B 43 -18 557 805 ;
+C -1 ; WX 600 ; N Agrave ; B 3 0 597 805 ;
+C -1 ; WX 600 ; N Abreve ; B 3 0 597 732 ;
+C -1 ; WX 600 ; N multiply ; B 87 43 515 470 ;
+C -1 ; WX 600 ; N uacute ; B 21 -15 562 672 ;
+C -1 ; WX 600 ; N Tcaron ; B 38 0 563 802 ;
+C -1 ; WX 600 ; N partialdiff ; B 17 -38 459 710 ;
+C -1 ; WX 600 ; N ydieresis ; B 7 -157 592 620 ;
+C -1 ; WX 600 ; N Nacute ; B 7 -13 593 805 ;
+C -1 ; WX 600 ; N icircumflex ; B 94 0 505 654 ;
+C -1 ; WX 600 ; N Ecircumflex ; B 53 0 550 787 ;
+C -1 ; WX 600 ; N adieresis ; B 53 -15 559 620 ;
+C -1 ; WX 600 ; N edieresis ; B 66 -15 548 620 ;
+C -1 ; WX 600 ; N cacute ; B 66 -15 529 672 ;
+C -1 ; WX 600 ; N nacute ; B 26 0 575 672 ;
+C -1 ; WX 600 ; N umacron ; B 21 -15 562 565 ;
+C -1 ; WX 600 ; N Ncaron ; B 7 -13 593 802 ;
+C -1 ; WX 600 ; N Iacute ; B 96 0 504 805 ;
+C -1 ; WX 600 ; N plusminus ; B 87 44 513 558 ;
+C -1 ; WX 600 ; N brokenbar ; B 275 -175 326 675 ;
+C -1 ; WX 600 ; N registered ; B 0 -18 600 580 ;
+C -1 ; WX 600 ; N Gbreve ; B 31 -18 575 732 ;
+C -1 ; WX 600 ; N Idotaccent ; B 96 0 504 753 ;
+C -1 ; WX 600 ; N summation ; B 15 -10 585 706 ;
+C -1 ; WX 600 ; N Egrave ; B 53 0 550 805 ;
+C -1 ; WX 600 ; N racute ; B 60 0 559 672 ;
+C -1 ; WX 600 ; N omacron ; B 62 -15 538 565 ;
+C -1 ; WX 600 ; N Zacute ; B 86 0 514 805 ;
+C -1 ; WX 600 ; N Zcaron ; B 86 0 514 802 ;
+C -1 ; WX 600 ; N greaterequal ; B 98 0 502 710 ;
+C -1 ; WX 600 ; N Eth ; B 30 0 574 562 ;
+C -1 ; WX 600 ; N Ccedilla ; B 41 -151 540 580 ;
+C -1 ; WX 600 ; N lcommaaccent ; B 95 -250 505 629 ;
+C -1 ; WX 600 ; N tcaron ; B 87 -15 530 717 ;
+C -1 ; WX 600 ; N eogonek ; B 66 -172 548 441 ;
+C -1 ; WX 600 ; N Uogonek ; B 17 -172 583 562 ;
+C -1 ; WX 600 ; N Aacute ; B 3 0 597 805 ;
+C -1 ; WX 600 ; N Adieresis ; B 3 0 597 753 ;
+C -1 ; WX 600 ; N egrave ; B 66 -15 548 672 ;
+C -1 ; WX 600 ; N zacute ; B 99 0 502 672 ;
+C -1 ; WX 600 ; N iogonek ; B 95 -172 505 657 ;
+C -1 ; WX 600 ; N Oacute ; B 43 -18 557 805 ;
+C -1 ; WX 600 ; N oacute ; B 62 -15 538 672 ;
+C -1 ; WX 600 ; N amacron ; B 53 -15 559 565 ;
+C -1 ; WX 600 ; N sacute ; B 80 -15 513 672 ;
+C -1 ; WX 600 ; N idieresis ; B 95 0 505 620 ;
+C -1 ; WX 600 ; N Ocircumflex ; B 43 -18 557 787 ;
+C -1 ; WX 600 ; N Ugrave ; B 17 -18 583 805 ;
+C -1 ; WX 600 ; N Delta ; B 6 0 598 688 ;
+C -1 ; WX 600 ; N thorn ; B -6 -157 555 629 ;
+C -1 ; WX 600 ; N twosuperior ; B 177 249 424 622 ;
+C -1 ; WX 600 ; N Odieresis ; B 43 -18 557 753 ;
+C -1 ; WX 600 ; N mu ; B 21 -157 562 426 ;
+C -1 ; WX 600 ; N igrave ; B 95 0 505 672 ;
+C -1 ; WX 600 ; N ohungarumlaut ; B 62 -15 580 672 ;
+C -1 ; WX 600 ; N Eogonek ; B 53 -172 561 562 ;
+C -1 ; WX 600 ; N dcroat ; B 45 -15 591 629 ;
+C -1 ; WX 600 ; N threequarters ; B 8 -56 593 666 ;
+C -1 ; WX 600 ; N Scedilla ; B 72 -151 529 580 ;
+C -1 ; WX 600 ; N lcaron ; B 95 0 533 629 ;
+C -1 ; WX 600 ; N Kcommaaccent ; B 38 -250 582 562 ;
+C -1 ; WX 600 ; N Lacute ; B 47 0 554 805 ;
+C -1 ; WX 600 ; N trademark ; B -23 263 623 562 ;
+C -1 ; WX 600 ; N edotaccent ; B 66 -15 548 620 ;
+C -1 ; WX 600 ; N Igrave ; B 96 0 504 805 ;
+C -1 ; WX 600 ; N Imacron ; B 96 0 504 698 ;
+C -1 ; WX 600 ; N Lcaron ; B 47 0 554 562 ;
+C -1 ; WX 600 ; N onehalf ; B 0 -57 611 665 ;
+C -1 ; WX 600 ; N lessequal ; B 98 0 502 710 ;
+C -1 ; WX 600 ; N ocircumflex ; B 62 -15 538 654 ;
+C -1 ; WX 600 ; N ntilde ; B 26 0 575 606 ;
+C -1 ; WX 600 ; N Uhungarumlaut ; B 17 -18 590 805 ;
+C -1 ; WX 600 ; N Eacute ; B 53 0 550 805 ;
+C -1 ; WX 600 ; N emacron ; B 66 -15 548 565 ;
+C -1 ; WX 600 ; N gbreve ; B 45 -157 566 609 ;
+C -1 ; WX 600 ; N onequarter ; B 0 -57 600 665 ;
+C -1 ; WX 600 ; N Scaron ; B 72 -20 529 802 ;
+C -1 ; WX 600 ; N Scommaaccent ; B 72 -250 529 580 ;
+C -1 ; WX 600 ; N Ohungarumlaut ; B 43 -18 580 805 ;
+C -1 ; WX 600 ; N degree ; B 123 269 477 622 ;
+C -1 ; WX 600 ; N ograve ; B 62 -15 538 672 ;
+C -1 ; WX 600 ; N Ccaron ; B 41 -18 540 802 ;
+C -1 ; WX 600 ; N ugrave ; B 21 -15 562 672 ;
+C -1 ; WX 600 ; N radical ; B 3 -15 597 792 ;
+C -1 ; WX 600 ; N Dcaron ; B 43 0 574 802 ;
+C -1 ; WX 600 ; N rcommaaccent ; B 60 -250 559 441 ;
+C -1 ; WX 600 ; N Ntilde ; B 7 -13 593 729 ;
+C -1 ; WX 600 ; N otilde ; B 62 -15 538 606 ;
+C -1 ; WX 600 ; N Rcommaaccent ; B 38 -250 588 562 ;
+C -1 ; WX 600 ; N Lcommaaccent ; B 47 -250 554 562 ;
+C -1 ; WX 600 ; N Atilde ; B 3 0 597 729 ;
+C -1 ; WX 600 ; N Aogonek ; B 3 -172 608 562 ;
+C -1 ; WX 600 ; N Aring ; B 3 0 597 750 ;
+C -1 ; WX 600 ; N Otilde ; B 43 -18 557 729 ;
+C -1 ; WX 600 ; N zdotaccent ; B 99 0 502 620 ;
+C -1 ; WX 600 ; N Ecaron ; B 53 0 550 802 ;
+C -1 ; WX 600 ; N Iogonek ; B 96 -172 504 562 ;
+C -1 ; WX 600 ; N kcommaaccent ; B 43 -250 580 629 ;
+C -1 ; WX 600 ; N minus ; B 80 232 520 283 ;
+C -1 ; WX 600 ; N Icircumflex ; B 96 0 504 787 ;
+C -1 ; WX 600 ; N ncaron ; B 26 0 575 669 ;
+C -1 ; WX 600 ; N tcommaaccent ; B 87 -250 530 561 ;
+C -1 ; WX 600 ; N logicalnot ; B 87 108 513 369 ;
+C -1 ; WX 600 ; N odieresis ; B 62 -15 538 620 ;
+C -1 ; WX 600 ; N udieresis ; B 21 -15 562 620 ;
+C -1 ; WX 600 ; N notequal ; B 15 -16 540 529 ;
+C -1 ; WX 600 ; N gcommaaccent ; B 45 -157 566 708 ;
+C -1 ; WX 600 ; N eth ; B 62 -15 538 629 ;
+C -1 ; WX 600 ; N zcaron ; B 99 0 502 669 ;
+C -1 ; WX 600 ; N ncommaaccent ; B 26 -250 575 441 ;
+C -1 ; WX 600 ; N onesuperior ; B 172 249 428 622 ;
+C -1 ; WX 600 ; N imacron ; B 95 0 505 565 ;
+C -1 ; WX 600 ; N Euro ; B 0 0 0 0 ;
+EndCharMetrics
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-Bold.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-Bold.afm
new file mode 100644
index 0000000..837c594
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-Bold.afm
@@ -0,0 +1,2827 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu May 1 12:43:52 1997
+Comment UniqueID 43052
+Comment VMusage 37169 48194
+FontName Helvetica-Bold
+FullName Helvetica Bold
+FamilyName Helvetica
+Weight Bold
+ItalicAngle 0
+IsFixedPitch false
+CharacterSet ExtendedRoman
+FontBBox -170 -228 1003 962
+UnderlinePosition -100
+UnderlineThickness 50
+Version 002.000
+Notice Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 718
+XHeight 532
+Ascender 718
+Descender -207
+StdHW 118
+StdVW 140
+StartCharMetrics 315
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 90 0 244 718 ;
+C 34 ; WX 474 ; N quotedbl ; B 98 447 376 718 ;
+C 35 ; WX 556 ; N numbersign ; B 18 0 538 698 ;
+C 36 ; WX 556 ; N dollar ; B 30 -115 523 775 ;
+C 37 ; WX 889 ; N percent ; B 28 -19 861 710 ;
+C 38 ; WX 722 ; N ampersand ; B 54 -19 701 718 ;
+C 39 ; WX 278 ; N quoteright ; B 69 445 209 718 ;
+C 40 ; WX 333 ; N parenleft ; B 35 -208 314 734 ;
+C 41 ; WX 333 ; N parenright ; B 19 -208 298 734 ;
+C 42 ; WX 389 ; N asterisk ; B 27 387 362 718 ;
+C 43 ; WX 584 ; N plus ; B 40 0 544 506 ;
+C 44 ; WX 278 ; N comma ; B 64 -168 214 146 ;
+C 45 ; WX 333 ; N hyphen ; B 27 215 306 345 ;
+C 46 ; WX 278 ; N period ; B 64 0 214 146 ;
+C 47 ; WX 278 ; N slash ; B -33 -19 311 737 ;
+C 48 ; WX 556 ; N zero ; B 32 -19 524 710 ;
+C 49 ; WX 556 ; N one ; B 69 0 378 710 ;
+C 50 ; WX 556 ; N two ; B 26 0 511 710 ;
+C 51 ; WX 556 ; N three ; B 27 -19 516 710 ;
+C 52 ; WX 556 ; N four ; B 27 0 526 710 ;
+C 53 ; WX 556 ; N five ; B 27 -19 516 698 ;
+C 54 ; WX 556 ; N six ; B 31 -19 520 710 ;
+C 55 ; WX 556 ; N seven ; B 25 0 528 698 ;
+C 56 ; WX 556 ; N eight ; B 32 -19 524 710 ;
+C 57 ; WX 556 ; N nine ; B 30 -19 522 710 ;
+C 58 ; WX 333 ; N colon ; B 92 0 242 512 ;
+C 59 ; WX 333 ; N semicolon ; B 92 -168 242 512 ;
+C 60 ; WX 584 ; N less ; B 38 -8 546 514 ;
+C 61 ; WX 584 ; N equal ; B 40 87 544 419 ;
+C 62 ; WX 584 ; N greater ; B 38 -8 546 514 ;
+C 63 ; WX 611 ; N question ; B 60 0 556 727 ;
+C 64 ; WX 975 ; N at ; B 118 -19 856 737 ;
+C 65 ; WX 722 ; N A ; B 20 0 702 718 ;
+C 66 ; WX 722 ; N B ; B 76 0 669 718 ;
+C 67 ; WX 722 ; N C ; B 44 -19 684 737 ;
+C 68 ; WX 722 ; N D ; B 76 0 685 718 ;
+C 69 ; WX 667 ; N E ; B 76 0 621 718 ;
+C 70 ; WX 611 ; N F ; B 76 0 587 718 ;
+C 71 ; WX 778 ; N G ; B 44 -19 713 737 ;
+C 72 ; WX 722 ; N H ; B 71 0 651 718 ;
+C 73 ; WX 278 ; N I ; B 64 0 214 718 ;
+C 74 ; WX 556 ; N J ; B 22 -18 484 718 ;
+C 75 ; WX 722 ; N K ; B 87 0 722 718 ;
+C 76 ; WX 611 ; N L ; B 76 0 583 718 ;
+C 77 ; WX 833 ; N M ; B 69 0 765 718 ;
+C 78 ; WX 722 ; N N ; B 69 0 654 718 ;
+C 79 ; WX 778 ; N O ; B 44 -19 734 737 ;
+C 80 ; WX 667 ; N P ; B 76 0 627 718 ;
+C 81 ; WX 778 ; N Q ; B 44 -52 737 737 ;
+C 82 ; WX 722 ; N R ; B 76 0 677 718 ;
+C 83 ; WX 667 ; N S ; B 39 -19 629 737 ;
+C 84 ; WX 611 ; N T ; B 14 0 598 718 ;
+C 85 ; WX 722 ; N U ; B 72 -19 651 718 ;
+C 86 ; WX 667 ; N V ; B 19 0 648 718 ;
+C 87 ; WX 944 ; N W ; B 16 0 929 718 ;
+C 88 ; WX 667 ; N X ; B 14 0 653 718 ;
+C 89 ; WX 667 ; N Y ; B 15 0 653 718 ;
+C 90 ; WX 611 ; N Z ; B 25 0 586 718 ;
+C 91 ; WX 333 ; N bracketleft ; B 63 -196 309 722 ;
+C 92 ; WX 278 ; N backslash ; B -33 -19 311 737 ;
+C 93 ; WX 333 ; N bracketright ; B 24 -196 270 722 ;
+C 94 ; WX 584 ; N asciicircum ; B 62 323 522 698 ;
+C 95 ; WX 556 ; N underscore ; B 0 -125 556 -75 ;
+C 96 ; WX 278 ; N quoteleft ; B 69 454 209 727 ;
+C 97 ; WX 556 ; N a ; B 29 -14 527 546 ;
+C 98 ; WX 611 ; N b ; B 61 -14 578 718 ;
+C 99 ; WX 556 ; N c ; B 34 -14 524 546 ;
+C 100 ; WX 611 ; N d ; B 34 -14 551 718 ;
+C 101 ; WX 556 ; N e ; B 23 -14 528 546 ;
+C 102 ; WX 333 ; N f ; B 10 0 318 727 ; L i fi ; L l fl ;
+C 103 ; WX 611 ; N g ; B 40 -217 553 546 ;
+C 104 ; WX 611 ; N h ; B 65 0 546 718 ;
+C 105 ; WX 278 ; N i ; B 69 0 209 725 ;
+C 106 ; WX 278 ; N j ; B 3 -214 209 725 ;
+C 107 ; WX 556 ; N k ; B 69 0 562 718 ;
+C 108 ; WX 278 ; N l ; B 69 0 209 718 ;
+C 109 ; WX 889 ; N m ; B 64 0 826 546 ;
+C 110 ; WX 611 ; N n ; B 65 0 546 546 ;
+C 111 ; WX 611 ; N o ; B 34 -14 578 546 ;
+C 112 ; WX 611 ; N p ; B 62 -207 578 546 ;
+C 113 ; WX 611 ; N q ; B 34 -207 552 546 ;
+C 114 ; WX 389 ; N r ; B 64 0 373 546 ;
+C 115 ; WX 556 ; N s ; B 30 -14 519 546 ;
+C 116 ; WX 333 ; N t ; B 10 -6 309 676 ;
+C 117 ; WX 611 ; N u ; B 66 -14 545 532 ;
+C 118 ; WX 556 ; N v ; B 13 0 543 532 ;
+C 119 ; WX 778 ; N w ; B 10 0 769 532 ;
+C 120 ; WX 556 ; N x ; B 15 0 541 532 ;
+C 121 ; WX 556 ; N y ; B 10 -214 539 532 ;
+C 122 ; WX 500 ; N z ; B 20 0 480 532 ;
+C 123 ; WX 389 ; N braceleft ; B 48 -196 365 722 ;
+C 124 ; WX 280 ; N bar ; B 84 -225 196 775 ;
+C 125 ; WX 389 ; N braceright ; B 24 -196 341 722 ;
+C 126 ; WX 584 ; N asciitilde ; B 61 163 523 343 ;
+C 161 ; WX 333 ; N exclamdown ; B 90 -186 244 532 ;
+C 162 ; WX 556 ; N cent ; B 34 -118 524 628 ;
+C 163 ; WX 556 ; N sterling ; B 28 -16 541 718 ;
+C 164 ; WX 167 ; N fraction ; B -170 -19 336 710 ;
+C 165 ; WX 556 ; N yen ; B -9 0 565 698 ;
+C 166 ; WX 556 ; N florin ; B -10 -210 516 737 ;
+C 167 ; WX 556 ; N section ; B 34 -184 522 727 ;
+C 168 ; WX 556 ; N currency ; B -3 76 559 636 ;
+C 169 ; WX 238 ; N quotesingle ; B 70 447 168 718 ;
+C 170 ; WX 500 ; N quotedblleft ; B 64 454 436 727 ;
+C 171 ; WX 556 ; N guillemotleft ; B 88 76 468 484 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 83 76 250 484 ;
+C 173 ; WX 333 ; N guilsinglright ; B 83 76 250 484 ;
+C 174 ; WX 611 ; N fi ; B 10 0 542 727 ;
+C 175 ; WX 611 ; N fl ; B 10 0 542 727 ;
+C 177 ; WX 556 ; N endash ; B 0 227 556 333 ;
+C 178 ; WX 556 ; N dagger ; B 36 -171 520 718 ;
+C 179 ; WX 556 ; N daggerdbl ; B 36 -171 520 718 ;
+C 180 ; WX 278 ; N periodcentered ; B 58 172 220 334 ;
+C 182 ; WX 556 ; N paragraph ; B -8 -191 539 700 ;
+C 183 ; WX 350 ; N bullet ; B 10 194 340 524 ;
+C 184 ; WX 278 ; N quotesinglbase ; B 69 -146 209 127 ;
+C 185 ; WX 500 ; N quotedblbase ; B 64 -146 436 127 ;
+C 186 ; WX 500 ; N quotedblright ; B 64 445 436 718 ;
+C 187 ; WX 556 ; N guillemotright ; B 88 76 468 484 ;
+C 188 ; WX 1000 ; N ellipsis ; B 92 0 908 146 ;
+C 189 ; WX 1000 ; N perthousand ; B -3 -19 1003 710 ;
+C 191 ; WX 611 ; N questiondown ; B 55 -195 551 532 ;
+C 193 ; WX 333 ; N grave ; B -23 604 225 750 ;
+C 194 ; WX 333 ; N acute ; B 108 604 356 750 ;
+C 195 ; WX 333 ; N circumflex ; B -10 604 343 750 ;
+C 196 ; WX 333 ; N tilde ; B -17 610 350 737 ;
+C 197 ; WX 333 ; N macron ; B -6 604 339 678 ;
+C 198 ; WX 333 ; N breve ; B -2 604 335 750 ;
+C 199 ; WX 333 ; N dotaccent ; B 104 614 230 729 ;
+C 200 ; WX 333 ; N dieresis ; B 6 614 327 729 ;
+C 202 ; WX 333 ; N ring ; B 59 568 275 776 ;
+C 203 ; WX 333 ; N cedilla ; B 6 -228 245 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 9 604 486 750 ;
+C 206 ; WX 333 ; N ogonek ; B 71 -228 304 0 ;
+C 207 ; WX 333 ; N caron ; B -10 604 343 750 ;
+C 208 ; WX 1000 ; N emdash ; B 0 227 1000 333 ;
+C 225 ; WX 1000 ; N AE ; B 5 0 954 718 ;
+C 227 ; WX 370 ; N ordfeminine ; B 22 401 347 737 ;
+C 232 ; WX 611 ; N Lslash ; B -20 0 583 718 ;
+C 233 ; WX 778 ; N Oslash ; B 33 -27 744 745 ;
+C 234 ; WX 1000 ; N OE ; B 37 -19 961 737 ;
+C 235 ; WX 365 ; N ordmasculine ; B 6 401 360 737 ;
+C 241 ; WX 889 ; N ae ; B 29 -14 858 546 ;
+C 245 ; WX 278 ; N dotlessi ; B 69 0 209 532 ;
+C 248 ; WX 278 ; N lslash ; B -18 0 296 718 ;
+C 249 ; WX 611 ; N oslash ; B 22 -29 589 560 ;
+C 250 ; WX 944 ; N oe ; B 34 -14 912 546 ;
+C 251 ; WX 611 ; N germandbls ; B 69 -14 579 731 ;
+C -1 ; WX 278 ; N Idieresis ; B -21 0 300 915 ;
+C -1 ; WX 556 ; N eacute ; B 23 -14 528 750 ;
+C -1 ; WX 556 ; N abreve ; B 29 -14 527 750 ;
+C -1 ; WX 611 ; N uhungarumlaut ; B 66 -14 625 750 ;
+C -1 ; WX 556 ; N ecaron ; B 23 -14 528 750 ;
+C -1 ; WX 667 ; N Ydieresis ; B 15 0 653 915 ;
+C -1 ; WX 584 ; N divide ; B 40 -42 544 548 ;
+C -1 ; WX 667 ; N Yacute ; B 15 0 653 936 ;
+C -1 ; WX 722 ; N Acircumflex ; B 20 0 702 936 ;
+C -1 ; WX 556 ; N aacute ; B 29 -14 527 750 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 72 -19 651 936 ;
+C -1 ; WX 556 ; N yacute ; B 10 -214 539 750 ;
+C -1 ; WX 556 ; N scommaaccent ; B 30 -228 519 546 ;
+C -1 ; WX 556 ; N ecircumflex ; B 23 -14 528 750 ;
+C -1 ; WX 722 ; N Uring ; B 72 -19 651 962 ;
+C -1 ; WX 722 ; N Udieresis ; B 72 -19 651 915 ;
+C -1 ; WX 556 ; N aogonek ; B 29 -224 545 546 ;
+C -1 ; WX 722 ; N Uacute ; B 72 -19 651 936 ;
+C -1 ; WX 611 ; N uogonek ; B 66 -228 545 532 ;
+C -1 ; WX 667 ; N Edieresis ; B 76 0 621 915 ;
+C -1 ; WX 722 ; N Dcroat ; B -5 0 685 718 ;
+C -1 ; WX 250 ; N commaaccent ; B 64 -228 199 -50 ;
+C -1 ; WX 737 ; N copyright ; B -11 -19 749 737 ;
+C -1 ; WX 667 ; N Emacron ; B 76 0 621 864 ;
+C -1 ; WX 556 ; N ccaron ; B 34 -14 524 750 ;
+C -1 ; WX 556 ; N aring ; B 29 -14 527 776 ;
+C -1 ; WX 722 ; N Ncommaaccent ; B 69 -228 654 718 ;
+C -1 ; WX 278 ; N lacute ; B 69 0 329 936 ;
+C -1 ; WX 556 ; N agrave ; B 29 -14 527 750 ;
+C -1 ; WX 611 ; N Tcommaaccent ; B 14 -228 598 718 ;
+C -1 ; WX 722 ; N Cacute ; B 44 -19 684 936 ;
+C -1 ; WX 556 ; N atilde ; B 29 -14 527 737 ;
+C -1 ; WX 667 ; N Edotaccent ; B 76 0 621 915 ;
+C -1 ; WX 556 ; N scaron ; B 30 -14 519 750 ;
+C -1 ; WX 556 ; N scedilla ; B 30 -228 519 546 ;
+C -1 ; WX 278 ; N iacute ; B 69 0 329 750 ;
+C -1 ; WX 494 ; N lozenge ; B 10 0 484 745 ;
+C -1 ; WX 722 ; N Rcaron ; B 76 0 677 936 ;
+C -1 ; WX 778 ; N Gcommaaccent ; B 44 -228 713 737 ;
+C -1 ; WX 611 ; N ucircumflex ; B 66 -14 545 750 ;
+C -1 ; WX 556 ; N acircumflex ; B 29 -14 527 750 ;
+C -1 ; WX 722 ; N Amacron ; B 20 0 702 864 ;
+C -1 ; WX 389 ; N rcaron ; B 18 0 373 750 ;
+C -1 ; WX 556 ; N ccedilla ; B 34 -228 524 546 ;
+C -1 ; WX 611 ; N Zdotaccent ; B 25 0 586 915 ;
+C -1 ; WX 667 ; N Thorn ; B 76 0 627 718 ;
+C -1 ; WX 778 ; N Omacron ; B 44 -19 734 864 ;
+C -1 ; WX 722 ; N Racute ; B 76 0 677 936 ;
+C -1 ; WX 667 ; N Sacute ; B 39 -19 629 936 ;
+C -1 ; WX 743 ; N dcaron ; B 34 -14 750 718 ;
+C -1 ; WX 722 ; N Umacron ; B 72 -19 651 864 ;
+C -1 ; WX 611 ; N uring ; B 66 -14 545 776 ;
+C -1 ; WX 333 ; N threesuperior ; B 8 271 326 710 ;
+C -1 ; WX 778 ; N Ograve ; B 44 -19 734 936 ;
+C -1 ; WX 722 ; N Agrave ; B 20 0 702 936 ;
+C -1 ; WX 722 ; N Abreve ; B 20 0 702 936 ;
+C -1 ; WX 584 ; N multiply ; B 40 1 545 505 ;
+C -1 ; WX 611 ; N uacute ; B 66 -14 545 750 ;
+C -1 ; WX 611 ; N Tcaron ; B 14 0 598 936 ;
+C -1 ; WX 494 ; N partialdiff ; B 11 -21 494 750 ;
+C -1 ; WX 556 ; N ydieresis ; B 10 -214 539 729 ;
+C -1 ; WX 722 ; N Nacute ; B 69 0 654 936 ;
+C -1 ; WX 278 ; N icircumflex ; B -37 0 316 750 ;
+C -1 ; WX 667 ; N Ecircumflex ; B 76 0 621 936 ;
+C -1 ; WX 556 ; N adieresis ; B 29 -14 527 729 ;
+C -1 ; WX 556 ; N edieresis ; B 23 -14 528 729 ;
+C -1 ; WX 556 ; N cacute ; B 34 -14 524 750 ;
+C -1 ; WX 611 ; N nacute ; B 65 0 546 750 ;
+C -1 ; WX 611 ; N umacron ; B 66 -14 545 678 ;
+C -1 ; WX 722 ; N Ncaron ; B 69 0 654 936 ;
+C -1 ; WX 278 ; N Iacute ; B 64 0 329 936 ;
+C -1 ; WX 584 ; N plusminus ; B 40 0 544 506 ;
+C -1 ; WX 280 ; N brokenbar ; B 84 -150 196 700 ;
+C -1 ; WX 737 ; N registered ; B -11 -19 748 737 ;
+C -1 ; WX 778 ; N Gbreve ; B 44 -19 713 936 ;
+C -1 ; WX 278 ; N Idotaccent ; B 64 0 214 915 ;
+C -1 ; WX 600 ; N summation ; B 14 -10 585 706 ;
+C -1 ; WX 667 ; N Egrave ; B 76 0 621 936 ;
+C -1 ; WX 389 ; N racute ; B 64 0 384 750 ;
+C -1 ; WX 611 ; N omacron ; B 34 -14 578 678 ;
+C -1 ; WX 611 ; N Zacute ; B 25 0 586 936 ;
+C -1 ; WX 611 ; N Zcaron ; B 25 0 586 936 ;
+C -1 ; WX 549 ; N greaterequal ; B 26 0 523 704 ;
+C -1 ; WX 722 ; N Eth ; B -5 0 685 718 ;
+C -1 ; WX 722 ; N Ccedilla ; B 44 -228 684 737 ;
+C -1 ; WX 278 ; N lcommaaccent ; B 69 -228 213 718 ;
+C -1 ; WX 389 ; N tcaron ; B 10 -6 421 878 ;
+C -1 ; WX 556 ; N eogonek ; B 23 -228 528 546 ;
+C -1 ; WX 722 ; N Uogonek ; B 72 -228 651 718 ;
+C -1 ; WX 722 ; N Aacute ; B 20 0 702 936 ;
+C -1 ; WX 722 ; N Adieresis ; B 20 0 702 915 ;
+C -1 ; WX 556 ; N egrave ; B 23 -14 528 750 ;
+C -1 ; WX 500 ; N zacute ; B 20 0 480 750 ;
+C -1 ; WX 278 ; N iogonek ; B 16 -224 249 725 ;
+C -1 ; WX 778 ; N Oacute ; B 44 -19 734 936 ;
+C -1 ; WX 611 ; N oacute ; B 34 -14 578 750 ;
+C -1 ; WX 556 ; N amacron ; B 29 -14 527 678 ;
+C -1 ; WX 556 ; N sacute ; B 30 -14 519 750 ;
+C -1 ; WX 278 ; N idieresis ; B -21 0 300 729 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 44 -19 734 936 ;
+C -1 ; WX 722 ; N Ugrave ; B 72 -19 651 936 ;
+C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
+C -1 ; WX 611 ; N thorn ; B 62 -208 578 718 ;
+C -1 ; WX 333 ; N twosuperior ; B 9 283 324 710 ;
+C -1 ; WX 778 ; N Odieresis ; B 44 -19 734 915 ;
+C -1 ; WX 611 ; N mu ; B 66 -207 545 532 ;
+C -1 ; WX 278 ; N igrave ; B -50 0 209 750 ;
+C -1 ; WX 611 ; N ohungarumlaut ; B 34 -14 625 750 ;
+C -1 ; WX 667 ; N Eogonek ; B 76 -224 639 718 ;
+C -1 ; WX 611 ; N dcroat ; B 34 -14 650 718 ;
+C -1 ; WX 834 ; N threequarters ; B 16 -19 799 710 ;
+C -1 ; WX 667 ; N Scedilla ; B 39 -228 629 737 ;
+C -1 ; WX 400 ; N lcaron ; B 69 0 408 718 ;
+C -1 ; WX 722 ; N Kcommaaccent ; B 87 -228 722 718 ;
+C -1 ; WX 611 ; N Lacute ; B 76 0 583 936 ;
+C -1 ; WX 1000 ; N trademark ; B 44 306 956 718 ;
+C -1 ; WX 556 ; N edotaccent ; B 23 -14 528 729 ;
+C -1 ; WX 278 ; N Igrave ; B -50 0 214 936 ;
+C -1 ; WX 278 ; N Imacron ; B -33 0 312 864 ;
+C -1 ; WX 611 ; N Lcaron ; B 76 0 583 718 ;
+C -1 ; WX 834 ; N onehalf ; B 26 -19 794 710 ;
+C -1 ; WX 549 ; N lessequal ; B 29 0 526 704 ;
+C -1 ; WX 611 ; N ocircumflex ; B 34 -14 578 750 ;
+C -1 ; WX 611 ; N ntilde ; B 65 0 546 737 ;
+C -1 ; WX 722 ; N Uhungarumlaut ; B 72 -19 681 936 ;
+C -1 ; WX 667 ; N Eacute ; B 76 0 621 936 ;
+C -1 ; WX 556 ; N emacron ; B 23 -14 528 678 ;
+C -1 ; WX 611 ; N gbreve ; B 40 -217 553 750 ;
+C -1 ; WX 834 ; N onequarter ; B 26 -19 766 710 ;
+C -1 ; WX 667 ; N Scaron ; B 39 -19 629 936 ;
+C -1 ; WX 667 ; N Scommaaccent ; B 39 -228 629 737 ;
+C -1 ; WX 778 ; N Ohungarumlaut ; B 44 -19 734 936 ;
+C -1 ; WX 400 ; N degree ; B 57 426 343 712 ;
+C -1 ; WX 611 ; N ograve ; B 34 -14 578 750 ;
+C -1 ; WX 722 ; N Ccaron ; B 44 -19 684 936 ;
+C -1 ; WX 611 ; N ugrave ; B 66 -14 545 750 ;
+C -1 ; WX 549 ; N radical ; B 10 -46 512 850 ;
+C -1 ; WX 722 ; N Dcaron ; B 76 0 685 936 ;
+C -1 ; WX 389 ; N rcommaaccent ; B 64 -228 373 546 ;
+C -1 ; WX 722 ; N Ntilde ; B 69 0 654 923 ;
+C -1 ; WX 611 ; N otilde ; B 34 -14 578 737 ;
+C -1 ; WX 722 ; N Rcommaaccent ; B 76 -228 677 718 ;
+C -1 ; WX 611 ; N Lcommaaccent ; B 76 -228 583 718 ;
+C -1 ; WX 722 ; N Atilde ; B 20 0 702 923 ;
+C -1 ; WX 722 ; N Aogonek ; B 20 -224 742 718 ;
+C -1 ; WX 722 ; N Aring ; B 20 0 702 962 ;
+C -1 ; WX 778 ; N Otilde ; B 44 -19 734 923 ;
+C -1 ; WX 500 ; N zdotaccent ; B 20 0 480 729 ;
+C -1 ; WX 667 ; N Ecaron ; B 76 0 621 936 ;
+C -1 ; WX 278 ; N Iogonek ; B -11 -228 222 718 ;
+C -1 ; WX 556 ; N kcommaaccent ; B 69 -228 562 718 ;
+C -1 ; WX 584 ; N minus ; B 40 197 544 309 ;
+C -1 ; WX 278 ; N Icircumflex ; B -37 0 316 936 ;
+C -1 ; WX 611 ; N ncaron ; B 65 0 546 750 ;
+C -1 ; WX 333 ; N tcommaaccent ; B 10 -228 309 676 ;
+C -1 ; WX 584 ; N logicalnot ; B 40 108 544 419 ;
+C -1 ; WX 611 ; N odieresis ; B 34 -14 578 729 ;
+C -1 ; WX 611 ; N udieresis ; B 66 -14 545 729 ;
+C -1 ; WX 549 ; N notequal ; B 15 -49 540 570 ;
+C -1 ; WX 611 ; N gcommaaccent ; B 40 -217 553 850 ;
+C -1 ; WX 611 ; N eth ; B 34 -14 578 737 ;
+C -1 ; WX 500 ; N zcaron ; B 20 0 480 750 ;
+C -1 ; WX 611 ; N ncommaaccent ; B 65 -228 546 546 ;
+C -1 ; WX 333 ; N onesuperior ; B 26 283 237 710 ;
+C -1 ; WX 278 ; N imacron ; B -8 0 285 678 ;
+C -1 ; WX 556 ; N Euro ; B 0 0 0 0 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 2481
+KPX A C -40
+KPX A Cacute -40
+KPX A Ccaron -40
+KPX A Ccedilla -40
+KPX A G -50
+KPX A Gbreve -50
+KPX A Gcommaaccent -50
+KPX A O -40
+KPX A Oacute -40
+KPX A Ocircumflex -40
+KPX A Odieresis -40
+KPX A Ograve -40
+KPX A Ohungarumlaut -40
+KPX A Omacron -40
+KPX A Oslash -40
+KPX A Otilde -40
+KPX A Q -40
+KPX A T -90
+KPX A Tcaron -90
+KPX A Tcommaaccent -90
+KPX A U -50
+KPX A Uacute -50
+KPX A Ucircumflex -50
+KPX A Udieresis -50
+KPX A Ugrave -50
+KPX A Uhungarumlaut -50
+KPX A Umacron -50
+KPX A Uogonek -50
+KPX A Uring -50
+KPX A V -80
+KPX A W -60
+KPX A Y -110
+KPX A Yacute -110
+KPX A Ydieresis -110
+KPX A u -30
+KPX A uacute -30
+KPX A ucircumflex -30
+KPX A udieresis -30
+KPX A ugrave -30
+KPX A uhungarumlaut -30
+KPX A umacron -30
+KPX A uogonek -30
+KPX A uring -30
+KPX A v -40
+KPX A w -30
+KPX A y -30
+KPX A yacute -30
+KPX A ydieresis -30
+KPX Aacute C -40
+KPX Aacute Cacute -40
+KPX Aacute Ccaron -40
+KPX Aacute Ccedilla -40
+KPX Aacute G -50
+KPX Aacute Gbreve -50
+KPX Aacute Gcommaaccent -50
+KPX Aacute O -40
+KPX Aacute Oacute -40
+KPX Aacute Ocircumflex -40
+KPX Aacute Odieresis -40
+KPX Aacute Ograve -40
+KPX Aacute Ohungarumlaut -40
+KPX Aacute Omacron -40
+KPX Aacute Oslash -40
+KPX Aacute Otilde -40
+KPX Aacute Q -40
+KPX Aacute T -90
+KPX Aacute Tcaron -90
+KPX Aacute Tcommaaccent -90
+KPX Aacute U -50
+KPX Aacute Uacute -50
+KPX Aacute Ucircumflex -50
+KPX Aacute Udieresis -50
+KPX Aacute Ugrave -50
+KPX Aacute Uhungarumlaut -50
+KPX Aacute Umacron -50
+KPX Aacute Uogonek -50
+KPX Aacute Uring -50
+KPX Aacute V -80
+KPX Aacute W -60
+KPX Aacute Y -110
+KPX Aacute Yacute -110
+KPX Aacute Ydieresis -110
+KPX Aacute u -30
+KPX Aacute uacute -30
+KPX Aacute ucircumflex -30
+KPX Aacute udieresis -30
+KPX Aacute ugrave -30
+KPX Aacute uhungarumlaut -30
+KPX Aacute umacron -30
+KPX Aacute uogonek -30
+KPX Aacute uring -30
+KPX Aacute v -40
+KPX Aacute w -30
+KPX Aacute y -30
+KPX Aacute yacute -30
+KPX Aacute ydieresis -30
+KPX Abreve C -40
+KPX Abreve Cacute -40
+KPX Abreve Ccaron -40
+KPX Abreve Ccedilla -40
+KPX Abreve G -50
+KPX Abreve Gbreve -50
+KPX Abreve Gcommaaccent -50
+KPX Abreve O -40
+KPX Abreve Oacute -40
+KPX Abreve Ocircumflex -40
+KPX Abreve Odieresis -40
+KPX Abreve Ograve -40
+KPX Abreve Ohungarumlaut -40
+KPX Abreve Omacron -40
+KPX Abreve Oslash -40
+KPX Abreve Otilde -40
+KPX Abreve Q -40
+KPX Abreve T -90
+KPX Abreve Tcaron -90
+KPX Abreve Tcommaaccent -90
+KPX Abreve U -50
+KPX Abreve Uacute -50
+KPX Abreve Ucircumflex -50
+KPX Abreve Udieresis -50
+KPX Abreve Ugrave -50
+KPX Abreve Uhungarumlaut -50
+KPX Abreve Umacron -50
+KPX Abreve Uogonek -50
+KPX Abreve Uring -50
+KPX Abreve V -80
+KPX Abreve W -60
+KPX Abreve Y -110
+KPX Abreve Yacute -110
+KPX Abreve Ydieresis -110
+KPX Abreve u -30
+KPX Abreve uacute -30
+KPX Abreve ucircumflex -30
+KPX Abreve udieresis -30
+KPX Abreve ugrave -30
+KPX Abreve uhungarumlaut -30
+KPX Abreve umacron -30
+KPX Abreve uogonek -30
+KPX Abreve uring -30
+KPX Abreve v -40
+KPX Abreve w -30
+KPX Abreve y -30
+KPX Abreve yacute -30
+KPX Abreve ydieresis -30
+KPX Acircumflex C -40
+KPX Acircumflex Cacute -40
+KPX Acircumflex Ccaron -40
+KPX Acircumflex Ccedilla -40
+KPX Acircumflex G -50
+KPX Acircumflex Gbreve -50
+KPX Acircumflex Gcommaaccent -50
+KPX Acircumflex O -40
+KPX Acircumflex Oacute -40
+KPX Acircumflex Ocircumflex -40
+KPX Acircumflex Odieresis -40
+KPX Acircumflex Ograve -40
+KPX Acircumflex Ohungarumlaut -40
+KPX Acircumflex Omacron -40
+KPX Acircumflex Oslash -40
+KPX Acircumflex Otilde -40
+KPX Acircumflex Q -40
+KPX Acircumflex T -90
+KPX Acircumflex Tcaron -90
+KPX Acircumflex Tcommaaccent -90
+KPX Acircumflex U -50
+KPX Acircumflex Uacute -50
+KPX Acircumflex Ucircumflex -50
+KPX Acircumflex Udieresis -50
+KPX Acircumflex Ugrave -50
+KPX Acircumflex Uhungarumlaut -50
+KPX Acircumflex Umacron -50
+KPX Acircumflex Uogonek -50
+KPX Acircumflex Uring -50
+KPX Acircumflex V -80
+KPX Acircumflex W -60
+KPX Acircumflex Y -110
+KPX Acircumflex Yacute -110
+KPX Acircumflex Ydieresis -110
+KPX Acircumflex u -30
+KPX Acircumflex uacute -30
+KPX Acircumflex ucircumflex -30
+KPX Acircumflex udieresis -30
+KPX Acircumflex ugrave -30
+KPX Acircumflex uhungarumlaut -30
+KPX Acircumflex umacron -30
+KPX Acircumflex uogonek -30
+KPX Acircumflex uring -30
+KPX Acircumflex v -40
+KPX Acircumflex w -30
+KPX Acircumflex y -30
+KPX Acircumflex yacute -30
+KPX Acircumflex ydieresis -30
+KPX Adieresis C -40
+KPX Adieresis Cacute -40
+KPX Adieresis Ccaron -40
+KPX Adieresis Ccedilla -40
+KPX Adieresis G -50
+KPX Adieresis Gbreve -50
+KPX Adieresis Gcommaaccent -50
+KPX Adieresis O -40
+KPX Adieresis Oacute -40
+KPX Adieresis Ocircumflex -40
+KPX Adieresis Odieresis -40
+KPX Adieresis Ograve -40
+KPX Adieresis Ohungarumlaut -40
+KPX Adieresis Omacron -40
+KPX Adieresis Oslash -40
+KPX Adieresis Otilde -40
+KPX Adieresis Q -40
+KPX Adieresis T -90
+KPX Adieresis Tcaron -90
+KPX Adieresis Tcommaaccent -90
+KPX Adieresis U -50
+KPX Adieresis Uacute -50
+KPX Adieresis Ucircumflex -50
+KPX Adieresis Udieresis -50
+KPX Adieresis Ugrave -50
+KPX Adieresis Uhungarumlaut -50
+KPX Adieresis Umacron -50
+KPX Adieresis Uogonek -50
+KPX Adieresis Uring -50
+KPX Adieresis V -80
+KPX Adieresis W -60
+KPX Adieresis Y -110
+KPX Adieresis Yacute -110
+KPX Adieresis Ydieresis -110
+KPX Adieresis u -30
+KPX Adieresis uacute -30
+KPX Adieresis ucircumflex -30
+KPX Adieresis udieresis -30
+KPX Adieresis ugrave -30
+KPX Adieresis uhungarumlaut -30
+KPX Adieresis umacron -30
+KPX Adieresis uogonek -30
+KPX Adieresis uring -30
+KPX Adieresis v -40
+KPX Adieresis w -30
+KPX Adieresis y -30
+KPX Adieresis yacute -30
+KPX Adieresis ydieresis -30
+KPX Agrave C -40
+KPX Agrave Cacute -40
+KPX Agrave Ccaron -40
+KPX Agrave Ccedilla -40
+KPX Agrave G -50
+KPX Agrave Gbreve -50
+KPX Agrave Gcommaaccent -50
+KPX Agrave O -40
+KPX Agrave Oacute -40
+KPX Agrave Ocircumflex -40
+KPX Agrave Odieresis -40
+KPX Agrave Ograve -40
+KPX Agrave Ohungarumlaut -40
+KPX Agrave Omacron -40
+KPX Agrave Oslash -40
+KPX Agrave Otilde -40
+KPX Agrave Q -40
+KPX Agrave T -90
+KPX Agrave Tcaron -90
+KPX Agrave Tcommaaccent -90
+KPX Agrave U -50
+KPX Agrave Uacute -50
+KPX Agrave Ucircumflex -50
+KPX Agrave Udieresis -50
+KPX Agrave Ugrave -50
+KPX Agrave Uhungarumlaut -50
+KPX Agrave Umacron -50
+KPX Agrave Uogonek -50
+KPX Agrave Uring -50
+KPX Agrave V -80
+KPX Agrave W -60
+KPX Agrave Y -110
+KPX Agrave Yacute -110
+KPX Agrave Ydieresis -110
+KPX Agrave u -30
+KPX Agrave uacute -30
+KPX Agrave ucircumflex -30
+KPX Agrave udieresis -30
+KPX Agrave ugrave -30
+KPX Agrave uhungarumlaut -30
+KPX Agrave umacron -30
+KPX Agrave uogonek -30
+KPX Agrave uring -30
+KPX Agrave v -40
+KPX Agrave w -30
+KPX Agrave y -30
+KPX Agrave yacute -30
+KPX Agrave ydieresis -30
+KPX Amacron C -40
+KPX Amacron Cacute -40
+KPX Amacron Ccaron -40
+KPX Amacron Ccedilla -40
+KPX Amacron G -50
+KPX Amacron Gbreve -50
+KPX Amacron Gcommaaccent -50
+KPX Amacron O -40
+KPX Amacron Oacute -40
+KPX Amacron Ocircumflex -40
+KPX Amacron Odieresis -40
+KPX Amacron Ograve -40
+KPX Amacron Ohungarumlaut -40
+KPX Amacron Omacron -40
+KPX Amacron Oslash -40
+KPX Amacron Otilde -40
+KPX Amacron Q -40
+KPX Amacron T -90
+KPX Amacron Tcaron -90
+KPX Amacron Tcommaaccent -90
+KPX Amacron U -50
+KPX Amacron Uacute -50
+KPX Amacron Ucircumflex -50
+KPX Amacron Udieresis -50
+KPX Amacron Ugrave -50
+KPX Amacron Uhungarumlaut -50
+KPX Amacron Umacron -50
+KPX Amacron Uogonek -50
+KPX Amacron Uring -50
+KPX Amacron V -80
+KPX Amacron W -60
+KPX Amacron Y -110
+KPX Amacron Yacute -110
+KPX Amacron Ydieresis -110
+KPX Amacron u -30
+KPX Amacron uacute -30
+KPX Amacron ucircumflex -30
+KPX Amacron udieresis -30
+KPX Amacron ugrave -30
+KPX Amacron uhungarumlaut -30
+KPX Amacron umacron -30
+KPX Amacron uogonek -30
+KPX Amacron uring -30
+KPX Amacron v -40
+KPX Amacron w -30
+KPX Amacron y -30
+KPX Amacron yacute -30
+KPX Amacron ydieresis -30
+KPX Aogonek C -40
+KPX Aogonek Cacute -40
+KPX Aogonek Ccaron -40
+KPX Aogonek Ccedilla -40
+KPX Aogonek G -50
+KPX Aogonek Gbreve -50
+KPX Aogonek Gcommaaccent -50
+KPX Aogonek O -40
+KPX Aogonek Oacute -40
+KPX Aogonek Ocircumflex -40
+KPX Aogonek Odieresis -40
+KPX Aogonek Ograve -40
+KPX Aogonek Ohungarumlaut -40
+KPX Aogonek Omacron -40
+KPX Aogonek Oslash -40
+KPX Aogonek Otilde -40
+KPX Aogonek Q -40
+KPX Aogonek T -90
+KPX Aogonek Tcaron -90
+KPX Aogonek Tcommaaccent -90
+KPX Aogonek U -50
+KPX Aogonek Uacute -50
+KPX Aogonek Ucircumflex -50
+KPX Aogonek Udieresis -50
+KPX Aogonek Ugrave -50
+KPX Aogonek Uhungarumlaut -50
+KPX Aogonek Umacron -50
+KPX Aogonek Uogonek -50
+KPX Aogonek Uring -50
+KPX Aogonek V -80
+KPX Aogonek W -60
+KPX Aogonek Y -110
+KPX Aogonek Yacute -110
+KPX Aogonek Ydieresis -110
+KPX Aogonek u -30
+KPX Aogonek uacute -30
+KPX Aogonek ucircumflex -30
+KPX Aogonek udieresis -30
+KPX Aogonek ugrave -30
+KPX Aogonek uhungarumlaut -30
+KPX Aogonek umacron -30
+KPX Aogonek uogonek -30
+KPX Aogonek uring -30
+KPX Aogonek v -40
+KPX Aogonek w -30
+KPX Aogonek y -30
+KPX Aogonek yacute -30
+KPX Aogonek ydieresis -30
+KPX Aring C -40
+KPX Aring Cacute -40
+KPX Aring Ccaron -40
+KPX Aring Ccedilla -40
+KPX Aring G -50
+KPX Aring Gbreve -50
+KPX Aring Gcommaaccent -50
+KPX Aring O -40
+KPX Aring Oacute -40
+KPX Aring Ocircumflex -40
+KPX Aring Odieresis -40
+KPX Aring Ograve -40
+KPX Aring Ohungarumlaut -40
+KPX Aring Omacron -40
+KPX Aring Oslash -40
+KPX Aring Otilde -40
+KPX Aring Q -40
+KPX Aring T -90
+KPX Aring Tcaron -90
+KPX Aring Tcommaaccent -90
+KPX Aring U -50
+KPX Aring Uacute -50
+KPX Aring Ucircumflex -50
+KPX Aring Udieresis -50
+KPX Aring Ugrave -50
+KPX Aring Uhungarumlaut -50
+KPX Aring Umacron -50
+KPX Aring Uogonek -50
+KPX Aring Uring -50
+KPX Aring V -80
+KPX Aring W -60
+KPX Aring Y -110
+KPX Aring Yacute -110
+KPX Aring Ydieresis -110
+KPX Aring u -30
+KPX Aring uacute -30
+KPX Aring ucircumflex -30
+KPX Aring udieresis -30
+KPX Aring ugrave -30
+KPX Aring uhungarumlaut -30
+KPX Aring umacron -30
+KPX Aring uogonek -30
+KPX Aring uring -30
+KPX Aring v -40
+KPX Aring w -30
+KPX Aring y -30
+KPX Aring yacute -30
+KPX Aring ydieresis -30
+KPX Atilde C -40
+KPX Atilde Cacute -40
+KPX Atilde Ccaron -40
+KPX Atilde Ccedilla -40
+KPX Atilde G -50
+KPX Atilde Gbreve -50
+KPX Atilde Gcommaaccent -50
+KPX Atilde O -40
+KPX Atilde Oacute -40
+KPX Atilde Ocircumflex -40
+KPX Atilde Odieresis -40
+KPX Atilde Ograve -40
+KPX Atilde Ohungarumlaut -40
+KPX Atilde Omacron -40
+KPX Atilde Oslash -40
+KPX Atilde Otilde -40
+KPX Atilde Q -40
+KPX Atilde T -90
+KPX Atilde Tcaron -90
+KPX Atilde Tcommaaccent -90
+KPX Atilde U -50
+KPX Atilde Uacute -50
+KPX Atilde Ucircumflex -50
+KPX Atilde Udieresis -50
+KPX Atilde Ugrave -50
+KPX Atilde Uhungarumlaut -50
+KPX Atilde Umacron -50
+KPX Atilde Uogonek -50
+KPX Atilde Uring -50
+KPX Atilde V -80
+KPX Atilde W -60
+KPX Atilde Y -110
+KPX Atilde Yacute -110
+KPX Atilde Ydieresis -110
+KPX Atilde u -30
+KPX Atilde uacute -30
+KPX Atilde ucircumflex -30
+KPX Atilde udieresis -30
+KPX Atilde ugrave -30
+KPX Atilde uhungarumlaut -30
+KPX Atilde umacron -30
+KPX Atilde uogonek -30
+KPX Atilde uring -30
+KPX Atilde v -40
+KPX Atilde w -30
+KPX Atilde y -30
+KPX Atilde yacute -30
+KPX Atilde ydieresis -30
+KPX B A -30
+KPX B Aacute -30
+KPX B Abreve -30
+KPX B Acircumflex -30
+KPX B Adieresis -30
+KPX B Agrave -30
+KPX B Amacron -30
+KPX B Aogonek -30
+KPX B Aring -30
+KPX B Atilde -30
+KPX B U -10
+KPX B Uacute -10
+KPX B Ucircumflex -10
+KPX B Udieresis -10
+KPX B Ugrave -10
+KPX B Uhungarumlaut -10
+KPX B Umacron -10
+KPX B Uogonek -10
+KPX B Uring -10
+KPX D A -40
+KPX D Aacute -40
+KPX D Abreve -40
+KPX D Acircumflex -40
+KPX D Adieresis -40
+KPX D Agrave -40
+KPX D Amacron -40
+KPX D Aogonek -40
+KPX D Aring -40
+KPX D Atilde -40
+KPX D V -40
+KPX D W -40
+KPX D Y -70
+KPX D Yacute -70
+KPX D Ydieresis -70
+KPX D comma -30
+KPX D period -30
+KPX Dcaron A -40
+KPX Dcaron Aacute -40
+KPX Dcaron Abreve -40
+KPX Dcaron Acircumflex -40
+KPX Dcaron Adieresis -40
+KPX Dcaron Agrave -40
+KPX Dcaron Amacron -40
+KPX Dcaron Aogonek -40
+KPX Dcaron Aring -40
+KPX Dcaron Atilde -40
+KPX Dcaron V -40
+KPX Dcaron W -40
+KPX Dcaron Y -70
+KPX Dcaron Yacute -70
+KPX Dcaron Ydieresis -70
+KPX Dcaron comma -30
+KPX Dcaron period -30
+KPX Dcroat A -40
+KPX Dcroat Aacute -40
+KPX Dcroat Abreve -40
+KPX Dcroat Acircumflex -40
+KPX Dcroat Adieresis -40
+KPX Dcroat Agrave -40
+KPX Dcroat Amacron -40
+KPX Dcroat Aogonek -40
+KPX Dcroat Aring -40
+KPX Dcroat Atilde -40
+KPX Dcroat V -40
+KPX Dcroat W -40
+KPX Dcroat Y -70
+KPX Dcroat Yacute -70
+KPX Dcroat Ydieresis -70
+KPX Dcroat comma -30
+KPX Dcroat period -30
+KPX F A -80
+KPX F Aacute -80
+KPX F Abreve -80
+KPX F Acircumflex -80
+KPX F Adieresis -80
+KPX F Agrave -80
+KPX F Amacron -80
+KPX F Aogonek -80
+KPX F Aring -80
+KPX F Atilde -80
+KPX F a -20
+KPX F aacute -20
+KPX F abreve -20
+KPX F acircumflex -20
+KPX F adieresis -20
+KPX F agrave -20
+KPX F amacron -20
+KPX F aogonek -20
+KPX F aring -20
+KPX F atilde -20
+KPX F comma -100
+KPX F period -100
+KPX J A -20
+KPX J Aacute -20
+KPX J Abreve -20
+KPX J Acircumflex -20
+KPX J Adieresis -20
+KPX J Agrave -20
+KPX J Amacron -20
+KPX J Aogonek -20
+KPX J Aring -20
+KPX J Atilde -20
+KPX J comma -20
+KPX J period -20
+KPX J u -20
+KPX J uacute -20
+KPX J ucircumflex -20
+KPX J udieresis -20
+KPX J ugrave -20
+KPX J uhungarumlaut -20
+KPX J umacron -20
+KPX J uogonek -20
+KPX J uring -20
+KPX K O -30
+KPX K Oacute -30
+KPX K Ocircumflex -30
+KPX K Odieresis -30
+KPX K Ograve -30
+KPX K Ohungarumlaut -30
+KPX K Omacron -30
+KPX K Oslash -30
+KPX K Otilde -30
+KPX K e -15
+KPX K eacute -15
+KPX K ecaron -15
+KPX K ecircumflex -15
+KPX K edieresis -15
+KPX K edotaccent -15
+KPX K egrave -15
+KPX K emacron -15
+KPX K eogonek -15
+KPX K o -35
+KPX K oacute -35
+KPX K ocircumflex -35
+KPX K odieresis -35
+KPX K ograve -35
+KPX K ohungarumlaut -35
+KPX K omacron -35
+KPX K oslash -35
+KPX K otilde -35
+KPX K u -30
+KPX K uacute -30
+KPX K ucircumflex -30
+KPX K udieresis -30
+KPX K ugrave -30
+KPX K uhungarumlaut -30
+KPX K umacron -30
+KPX K uogonek -30
+KPX K uring -30
+KPX K y -40
+KPX K yacute -40
+KPX K ydieresis -40
+KPX Kcommaaccent O -30
+KPX Kcommaaccent Oacute -30
+KPX Kcommaaccent Ocircumflex -30
+KPX Kcommaaccent Odieresis -30
+KPX Kcommaaccent Ograve -30
+KPX Kcommaaccent Ohungarumlaut -30
+KPX Kcommaaccent Omacron -30
+KPX Kcommaaccent Oslash -30
+KPX Kcommaaccent Otilde -30
+KPX Kcommaaccent e -15
+KPX Kcommaaccent eacute -15
+KPX Kcommaaccent ecaron -15
+KPX Kcommaaccent ecircumflex -15
+KPX Kcommaaccent edieresis -15
+KPX Kcommaaccent edotaccent -15
+KPX Kcommaaccent egrave -15
+KPX Kcommaaccent emacron -15
+KPX Kcommaaccent eogonek -15
+KPX Kcommaaccent o -35
+KPX Kcommaaccent oacute -35
+KPX Kcommaaccent ocircumflex -35
+KPX Kcommaaccent odieresis -35
+KPX Kcommaaccent ograve -35
+KPX Kcommaaccent ohungarumlaut -35
+KPX Kcommaaccent omacron -35
+KPX Kcommaaccent oslash -35
+KPX Kcommaaccent otilde -35
+KPX Kcommaaccent u -30
+KPX Kcommaaccent uacute -30
+KPX Kcommaaccent ucircumflex -30
+KPX Kcommaaccent udieresis -30
+KPX Kcommaaccent ugrave -30
+KPX Kcommaaccent uhungarumlaut -30
+KPX Kcommaaccent umacron -30
+KPX Kcommaaccent uogonek -30
+KPX Kcommaaccent uring -30
+KPX Kcommaaccent y -40
+KPX Kcommaaccent yacute -40
+KPX Kcommaaccent ydieresis -40
+KPX L T -90
+KPX L Tcaron -90
+KPX L Tcommaaccent -90
+KPX L V -110
+KPX L W -80
+KPX L Y -120
+KPX L Yacute -120
+KPX L Ydieresis -120
+KPX L quotedblright -140
+KPX L quoteright -140
+KPX L y -30
+KPX L yacute -30
+KPX L ydieresis -30
+KPX Lacute T -90
+KPX Lacute Tcaron -90
+KPX Lacute Tcommaaccent -90
+KPX Lacute V -110
+KPX Lacute W -80
+KPX Lacute Y -120
+KPX Lacute Yacute -120
+KPX Lacute Ydieresis -120
+KPX Lacute quotedblright -140
+KPX Lacute quoteright -140
+KPX Lacute y -30
+KPX Lacute yacute -30
+KPX Lacute ydieresis -30
+KPX Lcommaaccent T -90
+KPX Lcommaaccent Tcaron -90
+KPX Lcommaaccent Tcommaaccent -90
+KPX Lcommaaccent V -110
+KPX Lcommaaccent W -80
+KPX Lcommaaccent Y -120
+KPX Lcommaaccent Yacute -120
+KPX Lcommaaccent Ydieresis -120
+KPX Lcommaaccent quotedblright -140
+KPX Lcommaaccent quoteright -140
+KPX Lcommaaccent y -30
+KPX Lcommaaccent yacute -30
+KPX Lcommaaccent ydieresis -30
+KPX Lslash T -90
+KPX Lslash Tcaron -90
+KPX Lslash Tcommaaccent -90
+KPX Lslash V -110
+KPX Lslash W -80
+KPX Lslash Y -120
+KPX Lslash Yacute -120
+KPX Lslash Ydieresis -120
+KPX Lslash quotedblright -140
+KPX Lslash quoteright -140
+KPX Lslash y -30
+KPX Lslash yacute -30
+KPX Lslash ydieresis -30
+KPX O A -50
+KPX O Aacute -50
+KPX O Abreve -50
+KPX O Acircumflex -50
+KPX O Adieresis -50
+KPX O Agrave -50
+KPX O Amacron -50
+KPX O Aogonek -50
+KPX O Aring -50
+KPX O Atilde -50
+KPX O T -40
+KPX O Tcaron -40
+KPX O Tcommaaccent -40
+KPX O V -50
+KPX O W -50
+KPX O X -50
+KPX O Y -70
+KPX O Yacute -70
+KPX O Ydieresis -70
+KPX O comma -40
+KPX O period -40
+KPX Oacute A -50
+KPX Oacute Aacute -50
+KPX Oacute Abreve -50
+KPX Oacute Acircumflex -50
+KPX Oacute Adieresis -50
+KPX Oacute Agrave -50
+KPX Oacute Amacron -50
+KPX Oacute Aogonek -50
+KPX Oacute Aring -50
+KPX Oacute Atilde -50
+KPX Oacute T -40
+KPX Oacute Tcaron -40
+KPX Oacute Tcommaaccent -40
+KPX Oacute V -50
+KPX Oacute W -50
+KPX Oacute X -50
+KPX Oacute Y -70
+KPX Oacute Yacute -70
+KPX Oacute Ydieresis -70
+KPX Oacute comma -40
+KPX Oacute period -40
+KPX Ocircumflex A -50
+KPX Ocircumflex Aacute -50
+KPX Ocircumflex Abreve -50
+KPX Ocircumflex Acircumflex -50
+KPX Ocircumflex Adieresis -50
+KPX Ocircumflex Agrave -50
+KPX Ocircumflex Amacron -50
+KPX Ocircumflex Aogonek -50
+KPX Ocircumflex Aring -50
+KPX Ocircumflex Atilde -50
+KPX Ocircumflex T -40
+KPX Ocircumflex Tcaron -40
+KPX Ocircumflex Tcommaaccent -40
+KPX Ocircumflex V -50
+KPX Ocircumflex W -50
+KPX Ocircumflex X -50
+KPX Ocircumflex Y -70
+KPX Ocircumflex Yacute -70
+KPX Ocircumflex Ydieresis -70
+KPX Ocircumflex comma -40
+KPX Ocircumflex period -40
+KPX Odieresis A -50
+KPX Odieresis Aacute -50
+KPX Odieresis Abreve -50
+KPX Odieresis Acircumflex -50
+KPX Odieresis Adieresis -50
+KPX Odieresis Agrave -50
+KPX Odieresis Amacron -50
+KPX Odieresis Aogonek -50
+KPX Odieresis Aring -50
+KPX Odieresis Atilde -50
+KPX Odieresis T -40
+KPX Odieresis Tcaron -40
+KPX Odieresis Tcommaaccent -40
+KPX Odieresis V -50
+KPX Odieresis W -50
+KPX Odieresis X -50
+KPX Odieresis Y -70
+KPX Odieresis Yacute -70
+KPX Odieresis Ydieresis -70
+KPX Odieresis comma -40
+KPX Odieresis period -40
+KPX Ograve A -50
+KPX Ograve Aacute -50
+KPX Ograve Abreve -50
+KPX Ograve Acircumflex -50
+KPX Ograve Adieresis -50
+KPX Ograve Agrave -50
+KPX Ograve Amacron -50
+KPX Ograve Aogonek -50
+KPX Ograve Aring -50
+KPX Ograve Atilde -50
+KPX Ograve T -40
+KPX Ograve Tcaron -40
+KPX Ograve Tcommaaccent -40
+KPX Ograve V -50
+KPX Ograve W -50
+KPX Ograve X -50
+KPX Ograve Y -70
+KPX Ograve Yacute -70
+KPX Ograve Ydieresis -70
+KPX Ograve comma -40
+KPX Ograve period -40
+KPX Ohungarumlaut A -50
+KPX Ohungarumlaut Aacute -50
+KPX Ohungarumlaut Abreve -50
+KPX Ohungarumlaut Acircumflex -50
+KPX Ohungarumlaut Adieresis -50
+KPX Ohungarumlaut Agrave -50
+KPX Ohungarumlaut Amacron -50
+KPX Ohungarumlaut Aogonek -50
+KPX Ohungarumlaut Aring -50
+KPX Ohungarumlaut Atilde -50
+KPX Ohungarumlaut T -40
+KPX Ohungarumlaut Tcaron -40
+KPX Ohungarumlaut Tcommaaccent -40
+KPX Ohungarumlaut V -50
+KPX Ohungarumlaut W -50
+KPX Ohungarumlaut X -50
+KPX Ohungarumlaut Y -70
+KPX Ohungarumlaut Yacute -70
+KPX Ohungarumlaut Ydieresis -70
+KPX Ohungarumlaut comma -40
+KPX Ohungarumlaut period -40
+KPX Omacron A -50
+KPX Omacron Aacute -50
+KPX Omacron Abreve -50
+KPX Omacron Acircumflex -50
+KPX Omacron Adieresis -50
+KPX Omacron Agrave -50
+KPX Omacron Amacron -50
+KPX Omacron Aogonek -50
+KPX Omacron Aring -50
+KPX Omacron Atilde -50
+KPX Omacron T -40
+KPX Omacron Tcaron -40
+KPX Omacron Tcommaaccent -40
+KPX Omacron V -50
+KPX Omacron W -50
+KPX Omacron X -50
+KPX Omacron Y -70
+KPX Omacron Yacute -70
+KPX Omacron Ydieresis -70
+KPX Omacron comma -40
+KPX Omacron period -40
+KPX Oslash A -50
+KPX Oslash Aacute -50
+KPX Oslash Abreve -50
+KPX Oslash Acircumflex -50
+KPX Oslash Adieresis -50
+KPX Oslash Agrave -50
+KPX Oslash Amacron -50
+KPX Oslash Aogonek -50
+KPX Oslash Aring -50
+KPX Oslash Atilde -50
+KPX Oslash T -40
+KPX Oslash Tcaron -40
+KPX Oslash Tcommaaccent -40
+KPX Oslash V -50
+KPX Oslash W -50
+KPX Oslash X -50
+KPX Oslash Y -70
+KPX Oslash Yacute -70
+KPX Oslash Ydieresis -70
+KPX Oslash comma -40
+KPX Oslash period -40
+KPX Otilde A -50
+KPX Otilde Aacute -50
+KPX Otilde Abreve -50
+KPX Otilde Acircumflex -50
+KPX Otilde Adieresis -50
+KPX Otilde Agrave -50
+KPX Otilde Amacron -50
+KPX Otilde Aogonek -50
+KPX Otilde Aring -50
+KPX Otilde Atilde -50
+KPX Otilde T -40
+KPX Otilde Tcaron -40
+KPX Otilde Tcommaaccent -40
+KPX Otilde V -50
+KPX Otilde W -50
+KPX Otilde X -50
+KPX Otilde Y -70
+KPX Otilde Yacute -70
+KPX Otilde Ydieresis -70
+KPX Otilde comma -40
+KPX Otilde period -40
+KPX P A -100
+KPX P Aacute -100
+KPX P Abreve -100
+KPX P Acircumflex -100
+KPX P Adieresis -100
+KPX P Agrave -100
+KPX P Amacron -100
+KPX P Aogonek -100
+KPX P Aring -100
+KPX P Atilde -100
+KPX P a -30
+KPX P aacute -30
+KPX P abreve -30
+KPX P acircumflex -30
+KPX P adieresis -30
+KPX P agrave -30
+KPX P amacron -30
+KPX P aogonek -30
+KPX P aring -30
+KPX P atilde -30
+KPX P comma -120
+KPX P e -30
+KPX P eacute -30
+KPX P ecaron -30
+KPX P ecircumflex -30
+KPX P edieresis -30
+KPX P edotaccent -30
+KPX P egrave -30
+KPX P emacron -30
+KPX P eogonek -30
+KPX P o -40
+KPX P oacute -40
+KPX P ocircumflex -40
+KPX P odieresis -40
+KPX P ograve -40
+KPX P ohungarumlaut -40
+KPX P omacron -40
+KPX P oslash -40
+KPX P otilde -40
+KPX P period -120
+KPX Q U -10
+KPX Q Uacute -10
+KPX Q Ucircumflex -10
+KPX Q Udieresis -10
+KPX Q Ugrave -10
+KPX Q Uhungarumlaut -10
+KPX Q Umacron -10
+KPX Q Uogonek -10
+KPX Q Uring -10
+KPX Q comma 20
+KPX Q period 20
+KPX R O -20
+KPX R Oacute -20
+KPX R Ocircumflex -20
+KPX R Odieresis -20
+KPX R Ograve -20
+KPX R Ohungarumlaut -20
+KPX R Omacron -20
+KPX R Oslash -20
+KPX R Otilde -20
+KPX R T -20
+KPX R Tcaron -20
+KPX R Tcommaaccent -20
+KPX R U -20
+KPX R Uacute -20
+KPX R Ucircumflex -20
+KPX R Udieresis -20
+KPX R Ugrave -20
+KPX R Uhungarumlaut -20
+KPX R Umacron -20
+KPX R Uogonek -20
+KPX R Uring -20
+KPX R V -50
+KPX R W -40
+KPX R Y -50
+KPX R Yacute -50
+KPX R Ydieresis -50
+KPX Racute O -20
+KPX Racute Oacute -20
+KPX Racute Ocircumflex -20
+KPX Racute Odieresis -20
+KPX Racute Ograve -20
+KPX Racute Ohungarumlaut -20
+KPX Racute Omacron -20
+KPX Racute Oslash -20
+KPX Racute Otilde -20
+KPX Racute T -20
+KPX Racute Tcaron -20
+KPX Racute Tcommaaccent -20
+KPX Racute U -20
+KPX Racute Uacute -20
+KPX Racute Ucircumflex -20
+KPX Racute Udieresis -20
+KPX Racute Ugrave -20
+KPX Racute Uhungarumlaut -20
+KPX Racute Umacron -20
+KPX Racute Uogonek -20
+KPX Racute Uring -20
+KPX Racute V -50
+KPX Racute W -40
+KPX Racute Y -50
+KPX Racute Yacute -50
+KPX Racute Ydieresis -50
+KPX Rcaron O -20
+KPX Rcaron Oacute -20
+KPX Rcaron Ocircumflex -20
+KPX Rcaron Odieresis -20
+KPX Rcaron Ograve -20
+KPX Rcaron Ohungarumlaut -20
+KPX Rcaron Omacron -20
+KPX Rcaron Oslash -20
+KPX Rcaron Otilde -20
+KPX Rcaron T -20
+KPX Rcaron Tcaron -20
+KPX Rcaron Tcommaaccent -20
+KPX Rcaron U -20
+KPX Rcaron Uacute -20
+KPX Rcaron Ucircumflex -20
+KPX Rcaron Udieresis -20
+KPX Rcaron Ugrave -20
+KPX Rcaron Uhungarumlaut -20
+KPX Rcaron Umacron -20
+KPX Rcaron Uogonek -20
+KPX Rcaron Uring -20
+KPX Rcaron V -50
+KPX Rcaron W -40
+KPX Rcaron Y -50
+KPX Rcaron Yacute -50
+KPX Rcaron Ydieresis -50
+KPX Rcommaaccent O -20
+KPX Rcommaaccent Oacute -20
+KPX Rcommaaccent Ocircumflex -20
+KPX Rcommaaccent Odieresis -20
+KPX Rcommaaccent Ograve -20
+KPX Rcommaaccent Ohungarumlaut -20
+KPX Rcommaaccent Omacron -20
+KPX Rcommaaccent Oslash -20
+KPX Rcommaaccent Otilde -20
+KPX Rcommaaccent T -20
+KPX Rcommaaccent Tcaron -20
+KPX Rcommaaccent Tcommaaccent -20
+KPX Rcommaaccent U -20
+KPX Rcommaaccent Uacute -20
+KPX Rcommaaccent Ucircumflex -20
+KPX Rcommaaccent Udieresis -20
+KPX Rcommaaccent Ugrave -20
+KPX Rcommaaccent Uhungarumlaut -20
+KPX Rcommaaccent Umacron -20
+KPX Rcommaaccent Uogonek -20
+KPX Rcommaaccent Uring -20
+KPX Rcommaaccent V -50
+KPX Rcommaaccent W -40
+KPX Rcommaaccent Y -50
+KPX Rcommaaccent Yacute -50
+KPX Rcommaaccent Ydieresis -50
+KPX T A -90
+KPX T Aacute -90
+KPX T Abreve -90
+KPX T Acircumflex -90
+KPX T Adieresis -90
+KPX T Agrave -90
+KPX T Amacron -90
+KPX T Aogonek -90
+KPX T Aring -90
+KPX T Atilde -90
+KPX T O -40
+KPX T Oacute -40
+KPX T Ocircumflex -40
+KPX T Odieresis -40
+KPX T Ograve -40
+KPX T Ohungarumlaut -40
+KPX T Omacron -40
+KPX T Oslash -40
+KPX T Otilde -40
+KPX T a -80
+KPX T aacute -80
+KPX T abreve -80
+KPX T acircumflex -80
+KPX T adieresis -80
+KPX T agrave -80
+KPX T amacron -80
+KPX T aogonek -80
+KPX T aring -80
+KPX T atilde -80
+KPX T colon -40
+KPX T comma -80
+KPX T e -60
+KPX T eacute -60
+KPX T ecaron -60
+KPX T ecircumflex -60
+KPX T edieresis -60
+KPX T edotaccent -60
+KPX T egrave -60
+KPX T emacron -60
+KPX T eogonek -60
+KPX T hyphen -120
+KPX T o -80
+KPX T oacute -80
+KPX T ocircumflex -80
+KPX T odieresis -80
+KPX T ograve -80
+KPX T ohungarumlaut -80
+KPX T omacron -80
+KPX T oslash -80
+KPX T otilde -80
+KPX T period -80
+KPX T r -80
+KPX T racute -80
+KPX T rcommaaccent -80
+KPX T semicolon -40
+KPX T u -90
+KPX T uacute -90
+KPX T ucircumflex -90
+KPX T udieresis -90
+KPX T ugrave -90
+KPX T uhungarumlaut -90
+KPX T umacron -90
+KPX T uogonek -90
+KPX T uring -90
+KPX T w -60
+KPX T y -60
+KPX T yacute -60
+KPX T ydieresis -60
+KPX Tcaron A -90
+KPX Tcaron Aacute -90
+KPX Tcaron Abreve -90
+KPX Tcaron Acircumflex -90
+KPX Tcaron Adieresis -90
+KPX Tcaron Agrave -90
+KPX Tcaron Amacron -90
+KPX Tcaron Aogonek -90
+KPX Tcaron Aring -90
+KPX Tcaron Atilde -90
+KPX Tcaron O -40
+KPX Tcaron Oacute -40
+KPX Tcaron Ocircumflex -40
+KPX Tcaron Odieresis -40
+KPX Tcaron Ograve -40
+KPX Tcaron Ohungarumlaut -40
+KPX Tcaron Omacron -40
+KPX Tcaron Oslash -40
+KPX Tcaron Otilde -40
+KPX Tcaron a -80
+KPX Tcaron aacute -80
+KPX Tcaron abreve -80
+KPX Tcaron acircumflex -80
+KPX Tcaron adieresis -80
+KPX Tcaron agrave -80
+KPX Tcaron amacron -80
+KPX Tcaron aogonek -80
+KPX Tcaron aring -80
+KPX Tcaron atilde -80
+KPX Tcaron colon -40
+KPX Tcaron comma -80
+KPX Tcaron e -60
+KPX Tcaron eacute -60
+KPX Tcaron ecaron -60
+KPX Tcaron ecircumflex -60
+KPX Tcaron edieresis -60
+KPX Tcaron edotaccent -60
+KPX Tcaron egrave -60
+KPX Tcaron emacron -60
+KPX Tcaron eogonek -60
+KPX Tcaron hyphen -120
+KPX Tcaron o -80
+KPX Tcaron oacute -80
+KPX Tcaron ocircumflex -80
+KPX Tcaron odieresis -80
+KPX Tcaron ograve -80
+KPX Tcaron ohungarumlaut -80
+KPX Tcaron omacron -80
+KPX Tcaron oslash -80
+KPX Tcaron otilde -80
+KPX Tcaron period -80
+KPX Tcaron r -80
+KPX Tcaron racute -80
+KPX Tcaron rcommaaccent -80
+KPX Tcaron semicolon -40
+KPX Tcaron u -90
+KPX Tcaron uacute -90
+KPX Tcaron ucircumflex -90
+KPX Tcaron udieresis -90
+KPX Tcaron ugrave -90
+KPX Tcaron uhungarumlaut -90
+KPX Tcaron umacron -90
+KPX Tcaron uogonek -90
+KPX Tcaron uring -90
+KPX Tcaron w -60
+KPX Tcaron y -60
+KPX Tcaron yacute -60
+KPX Tcaron ydieresis -60
+KPX Tcommaaccent A -90
+KPX Tcommaaccent Aacute -90
+KPX Tcommaaccent Abreve -90
+KPX Tcommaaccent Acircumflex -90
+KPX Tcommaaccent Adieresis -90
+KPX Tcommaaccent Agrave -90
+KPX Tcommaaccent Amacron -90
+KPX Tcommaaccent Aogonek -90
+KPX Tcommaaccent Aring -90
+KPX Tcommaaccent Atilde -90
+KPX Tcommaaccent O -40
+KPX Tcommaaccent Oacute -40
+KPX Tcommaaccent Ocircumflex -40
+KPX Tcommaaccent Odieresis -40
+KPX Tcommaaccent Ograve -40
+KPX Tcommaaccent Ohungarumlaut -40
+KPX Tcommaaccent Omacron -40
+KPX Tcommaaccent Oslash -40
+KPX Tcommaaccent Otilde -40
+KPX Tcommaaccent a -80
+KPX Tcommaaccent aacute -80
+KPX Tcommaaccent abreve -80
+KPX Tcommaaccent acircumflex -80
+KPX Tcommaaccent adieresis -80
+KPX Tcommaaccent agrave -80
+KPX Tcommaaccent amacron -80
+KPX Tcommaaccent aogonek -80
+KPX Tcommaaccent aring -80
+KPX Tcommaaccent atilde -80
+KPX Tcommaaccent colon -40
+KPX Tcommaaccent comma -80
+KPX Tcommaaccent e -60
+KPX Tcommaaccent eacute -60
+KPX Tcommaaccent ecaron -60
+KPX Tcommaaccent ecircumflex -60
+KPX Tcommaaccent edieresis -60
+KPX Tcommaaccent edotaccent -60
+KPX Tcommaaccent egrave -60
+KPX Tcommaaccent emacron -60
+KPX Tcommaaccent eogonek -60
+KPX Tcommaaccent hyphen -120
+KPX Tcommaaccent o -80
+KPX Tcommaaccent oacute -80
+KPX Tcommaaccent ocircumflex -80
+KPX Tcommaaccent odieresis -80
+KPX Tcommaaccent ograve -80
+KPX Tcommaaccent ohungarumlaut -80
+KPX Tcommaaccent omacron -80
+KPX Tcommaaccent oslash -80
+KPX Tcommaaccent otilde -80
+KPX Tcommaaccent period -80
+KPX Tcommaaccent r -80
+KPX Tcommaaccent racute -80
+KPX Tcommaaccent rcommaaccent -80
+KPX Tcommaaccent semicolon -40
+KPX Tcommaaccent u -90
+KPX Tcommaaccent uacute -90
+KPX Tcommaaccent ucircumflex -90
+KPX Tcommaaccent udieresis -90
+KPX Tcommaaccent ugrave -90
+KPX Tcommaaccent uhungarumlaut -90
+KPX Tcommaaccent umacron -90
+KPX Tcommaaccent uogonek -90
+KPX Tcommaaccent uring -90
+KPX Tcommaaccent w -60
+KPX Tcommaaccent y -60
+KPX Tcommaaccent yacute -60
+KPX Tcommaaccent ydieresis -60
+KPX U A -50
+KPX U Aacute -50
+KPX U Abreve -50
+KPX U Acircumflex -50
+KPX U Adieresis -50
+KPX U Agrave -50
+KPX U Amacron -50
+KPX U Aogonek -50
+KPX U Aring -50
+KPX U Atilde -50
+KPX U comma -30
+KPX U period -30
+KPX Uacute A -50
+KPX Uacute Aacute -50
+KPX Uacute Abreve -50
+KPX Uacute Acircumflex -50
+KPX Uacute Adieresis -50
+KPX Uacute Agrave -50
+KPX Uacute Amacron -50
+KPX Uacute Aogonek -50
+KPX Uacute Aring -50
+KPX Uacute Atilde -50
+KPX Uacute comma -30
+KPX Uacute period -30
+KPX Ucircumflex A -50
+KPX Ucircumflex Aacute -50
+KPX Ucircumflex Abreve -50
+KPX Ucircumflex Acircumflex -50
+KPX Ucircumflex Adieresis -50
+KPX Ucircumflex Agrave -50
+KPX Ucircumflex Amacron -50
+KPX Ucircumflex Aogonek -50
+KPX Ucircumflex Aring -50
+KPX Ucircumflex Atilde -50
+KPX Ucircumflex comma -30
+KPX Ucircumflex period -30
+KPX Udieresis A -50
+KPX Udieresis Aacute -50
+KPX Udieresis Abreve -50
+KPX Udieresis Acircumflex -50
+KPX Udieresis Adieresis -50
+KPX Udieresis Agrave -50
+KPX Udieresis Amacron -50
+KPX Udieresis Aogonek -50
+KPX Udieresis Aring -50
+KPX Udieresis Atilde -50
+KPX Udieresis comma -30
+KPX Udieresis period -30
+KPX Ugrave A -50
+KPX Ugrave Aacute -50
+KPX Ugrave Abreve -50
+KPX Ugrave Acircumflex -50
+KPX Ugrave Adieresis -50
+KPX Ugrave Agrave -50
+KPX Ugrave Amacron -50
+KPX Ugrave Aogonek -50
+KPX Ugrave Aring -50
+KPX Ugrave Atilde -50
+KPX Ugrave comma -30
+KPX Ugrave period -30
+KPX Uhungarumlaut A -50
+KPX Uhungarumlaut Aacute -50
+KPX Uhungarumlaut Abreve -50
+KPX Uhungarumlaut Acircumflex -50
+KPX Uhungarumlaut Adieresis -50
+KPX Uhungarumlaut Agrave -50
+KPX Uhungarumlaut Amacron -50
+KPX Uhungarumlaut Aogonek -50
+KPX Uhungarumlaut Aring -50
+KPX Uhungarumlaut Atilde -50
+KPX Uhungarumlaut comma -30
+KPX Uhungarumlaut period -30
+KPX Umacron A -50
+KPX Umacron Aacute -50
+KPX Umacron Abreve -50
+KPX Umacron Acircumflex -50
+KPX Umacron Adieresis -50
+KPX Umacron Agrave -50
+KPX Umacron Amacron -50
+KPX Umacron Aogonek -50
+KPX Umacron Aring -50
+KPX Umacron Atilde -50
+KPX Umacron comma -30
+KPX Umacron period -30
+KPX Uogonek A -50
+KPX Uogonek Aacute -50
+KPX Uogonek Abreve -50
+KPX Uogonek Acircumflex -50
+KPX Uogonek Adieresis -50
+KPX Uogonek Agrave -50
+KPX Uogonek Amacron -50
+KPX Uogonek Aogonek -50
+KPX Uogonek Aring -50
+KPX Uogonek Atilde -50
+KPX Uogonek comma -30
+KPX Uogonek period -30
+KPX Uring A -50
+KPX Uring Aacute -50
+KPX Uring Abreve -50
+KPX Uring Acircumflex -50
+KPX Uring Adieresis -50
+KPX Uring Agrave -50
+KPX Uring Amacron -50
+KPX Uring Aogonek -50
+KPX Uring Aring -50
+KPX Uring Atilde -50
+KPX Uring comma -30
+KPX Uring period -30
+KPX V A -80
+KPX V Aacute -80
+KPX V Abreve -80
+KPX V Acircumflex -80
+KPX V Adieresis -80
+KPX V Agrave -80
+KPX V Amacron -80
+KPX V Aogonek -80
+KPX V Aring -80
+KPX V Atilde -80
+KPX V G -50
+KPX V Gbreve -50
+KPX V Gcommaaccent -50
+KPX V O -50
+KPX V Oacute -50
+KPX V Ocircumflex -50
+KPX V Odieresis -50
+KPX V Ograve -50
+KPX V Ohungarumlaut -50
+KPX V Omacron -50
+KPX V Oslash -50
+KPX V Otilde -50
+KPX V a -60
+KPX V aacute -60
+KPX V abreve -60
+KPX V acircumflex -60
+KPX V adieresis -60
+KPX V agrave -60
+KPX V amacron -60
+KPX V aogonek -60
+KPX V aring -60
+KPX V atilde -60
+KPX V colon -40
+KPX V comma -120
+KPX V e -50
+KPX V eacute -50
+KPX V ecaron -50
+KPX V ecircumflex -50
+KPX V edieresis -50
+KPX V edotaccent -50
+KPX V egrave -50
+KPX V emacron -50
+KPX V eogonek -50
+KPX V hyphen -80
+KPX V o -90
+KPX V oacute -90
+KPX V ocircumflex -90
+KPX V odieresis -90
+KPX V ograve -90
+KPX V ohungarumlaut -90
+KPX V omacron -90
+KPX V oslash -90
+KPX V otilde -90
+KPX V period -120
+KPX V semicolon -40
+KPX V u -60
+KPX V uacute -60
+KPX V ucircumflex -60
+KPX V udieresis -60
+KPX V ugrave -60
+KPX V uhungarumlaut -60
+KPX V umacron -60
+KPX V uogonek -60
+KPX V uring -60
+KPX W A -60
+KPX W Aacute -60
+KPX W Abreve -60
+KPX W Acircumflex -60
+KPX W Adieresis -60
+KPX W Agrave -60
+KPX W Amacron -60
+KPX W Aogonek -60
+KPX W Aring -60
+KPX W Atilde -60
+KPX W O -20
+KPX W Oacute -20
+KPX W Ocircumflex -20
+KPX W Odieresis -20
+KPX W Ograve -20
+KPX W Ohungarumlaut -20
+KPX W Omacron -20
+KPX W Oslash -20
+KPX W Otilde -20
+KPX W a -40
+KPX W aacute -40
+KPX W abreve -40
+KPX W acircumflex -40
+KPX W adieresis -40
+KPX W agrave -40
+KPX W amacron -40
+KPX W aogonek -40
+KPX W aring -40
+KPX W atilde -40
+KPX W colon -10
+KPX W comma -80
+KPX W e -35
+KPX W eacute -35
+KPX W ecaron -35
+KPX W ecircumflex -35
+KPX W edieresis -35
+KPX W edotaccent -35
+KPX W egrave -35
+KPX W emacron -35
+KPX W eogonek -35
+KPX W hyphen -40
+KPX W o -60
+KPX W oacute -60
+KPX W ocircumflex -60
+KPX W odieresis -60
+KPX W ograve -60
+KPX W ohungarumlaut -60
+KPX W omacron -60
+KPX W oslash -60
+KPX W otilde -60
+KPX W period -80
+KPX W semicolon -10
+KPX W u -45
+KPX W uacute -45
+KPX W ucircumflex -45
+KPX W udieresis -45
+KPX W ugrave -45
+KPX W uhungarumlaut -45
+KPX W umacron -45
+KPX W uogonek -45
+KPX W uring -45
+KPX W y -20
+KPX W yacute -20
+KPX W ydieresis -20
+KPX Y A -110
+KPX Y Aacute -110
+KPX Y Abreve -110
+KPX Y Acircumflex -110
+KPX Y Adieresis -110
+KPX Y Agrave -110
+KPX Y Amacron -110
+KPX Y Aogonek -110
+KPX Y Aring -110
+KPX Y Atilde -110
+KPX Y O -70
+KPX Y Oacute -70
+KPX Y Ocircumflex -70
+KPX Y Odieresis -70
+KPX Y Ograve -70
+KPX Y Ohungarumlaut -70
+KPX Y Omacron -70
+KPX Y Oslash -70
+KPX Y Otilde -70
+KPX Y a -90
+KPX Y aacute -90
+KPX Y abreve -90
+KPX Y acircumflex -90
+KPX Y adieresis -90
+KPX Y agrave -90
+KPX Y amacron -90
+KPX Y aogonek -90
+KPX Y aring -90
+KPX Y atilde -90
+KPX Y colon -50
+KPX Y comma -100
+KPX Y e -80
+KPX Y eacute -80
+KPX Y ecaron -80
+KPX Y ecircumflex -80
+KPX Y edieresis -80
+KPX Y edotaccent -80
+KPX Y egrave -80
+KPX Y emacron -80
+KPX Y eogonek -80
+KPX Y o -100
+KPX Y oacute -100
+KPX Y ocircumflex -100
+KPX Y odieresis -100
+KPX Y ograve -100
+KPX Y ohungarumlaut -100
+KPX Y omacron -100
+KPX Y oslash -100
+KPX Y otilde -100
+KPX Y period -100
+KPX Y semicolon -50
+KPX Y u -100
+KPX Y uacute -100
+KPX Y ucircumflex -100
+KPX Y udieresis -100
+KPX Y ugrave -100
+KPX Y uhungarumlaut -100
+KPX Y umacron -100
+KPX Y uogonek -100
+KPX Y uring -100
+KPX Yacute A -110
+KPX Yacute Aacute -110
+KPX Yacute Abreve -110
+KPX Yacute Acircumflex -110
+KPX Yacute Adieresis -110
+KPX Yacute Agrave -110
+KPX Yacute Amacron -110
+KPX Yacute Aogonek -110
+KPX Yacute Aring -110
+KPX Yacute Atilde -110
+KPX Yacute O -70
+KPX Yacute Oacute -70
+KPX Yacute Ocircumflex -70
+KPX Yacute Odieresis -70
+KPX Yacute Ograve -70
+KPX Yacute Ohungarumlaut -70
+KPX Yacute Omacron -70
+KPX Yacute Oslash -70
+KPX Yacute Otilde -70
+KPX Yacute a -90
+KPX Yacute aacute -90
+KPX Yacute abreve -90
+KPX Yacute acircumflex -90
+KPX Yacute adieresis -90
+KPX Yacute agrave -90
+KPX Yacute amacron -90
+KPX Yacute aogonek -90
+KPX Yacute aring -90
+KPX Yacute atilde -90
+KPX Yacute colon -50
+KPX Yacute comma -100
+KPX Yacute e -80
+KPX Yacute eacute -80
+KPX Yacute ecaron -80
+KPX Yacute ecircumflex -80
+KPX Yacute edieresis -80
+KPX Yacute edotaccent -80
+KPX Yacute egrave -80
+KPX Yacute emacron -80
+KPX Yacute eogonek -80
+KPX Yacute o -100
+KPX Yacute oacute -100
+KPX Yacute ocircumflex -100
+KPX Yacute odieresis -100
+KPX Yacute ograve -100
+KPX Yacute ohungarumlaut -100
+KPX Yacute omacron -100
+KPX Yacute oslash -100
+KPX Yacute otilde -100
+KPX Yacute period -100
+KPX Yacute semicolon -50
+KPX Yacute u -100
+KPX Yacute uacute -100
+KPX Yacute ucircumflex -100
+KPX Yacute udieresis -100
+KPX Yacute ugrave -100
+KPX Yacute uhungarumlaut -100
+KPX Yacute umacron -100
+KPX Yacute uogonek -100
+KPX Yacute uring -100
+KPX Ydieresis A -110
+KPX Ydieresis Aacute -110
+KPX Ydieresis Abreve -110
+KPX Ydieresis Acircumflex -110
+KPX Ydieresis Adieresis -110
+KPX Ydieresis Agrave -110
+KPX Ydieresis Amacron -110
+KPX Ydieresis Aogonek -110
+KPX Ydieresis Aring -110
+KPX Ydieresis Atilde -110
+KPX Ydieresis O -70
+KPX Ydieresis Oacute -70
+KPX Ydieresis Ocircumflex -70
+KPX Ydieresis Odieresis -70
+KPX Ydieresis Ograve -70
+KPX Ydieresis Ohungarumlaut -70
+KPX Ydieresis Omacron -70
+KPX Ydieresis Oslash -70
+KPX Ydieresis Otilde -70
+KPX Ydieresis a -90
+KPX Ydieresis aacute -90
+KPX Ydieresis abreve -90
+KPX Ydieresis acircumflex -90
+KPX Ydieresis adieresis -90
+KPX Ydieresis agrave -90
+KPX Ydieresis amacron -90
+KPX Ydieresis aogonek -90
+KPX Ydieresis aring -90
+KPX Ydieresis atilde -90
+KPX Ydieresis colon -50
+KPX Ydieresis comma -100
+KPX Ydieresis e -80
+KPX Ydieresis eacute -80
+KPX Ydieresis ecaron -80
+KPX Ydieresis ecircumflex -80
+KPX Ydieresis edieresis -80
+KPX Ydieresis edotaccent -80
+KPX Ydieresis egrave -80
+KPX Ydieresis emacron -80
+KPX Ydieresis eogonek -80
+KPX Ydieresis o -100
+KPX Ydieresis oacute -100
+KPX Ydieresis ocircumflex -100
+KPX Ydieresis odieresis -100
+KPX Ydieresis ograve -100
+KPX Ydieresis ohungarumlaut -100
+KPX Ydieresis omacron -100
+KPX Ydieresis oslash -100
+KPX Ydieresis otilde -100
+KPX Ydieresis period -100
+KPX Ydieresis semicolon -50
+KPX Ydieresis u -100
+KPX Ydieresis uacute -100
+KPX Ydieresis ucircumflex -100
+KPX Ydieresis udieresis -100
+KPX Ydieresis ugrave -100
+KPX Ydieresis uhungarumlaut -100
+KPX Ydieresis umacron -100
+KPX Ydieresis uogonek -100
+KPX Ydieresis uring -100
+KPX a g -10
+KPX a gbreve -10
+KPX a gcommaaccent -10
+KPX a v -15
+KPX a w -15
+KPX a y -20
+KPX a yacute -20
+KPX a ydieresis -20
+KPX aacute g -10
+KPX aacute gbreve -10
+KPX aacute gcommaaccent -10
+KPX aacute v -15
+KPX aacute w -15
+KPX aacute y -20
+KPX aacute yacute -20
+KPX aacute ydieresis -20
+KPX abreve g -10
+KPX abreve gbreve -10
+KPX abreve gcommaaccent -10
+KPX abreve v -15
+KPX abreve w -15
+KPX abreve y -20
+KPX abreve yacute -20
+KPX abreve ydieresis -20
+KPX acircumflex g -10
+KPX acircumflex gbreve -10
+KPX acircumflex gcommaaccent -10
+KPX acircumflex v -15
+KPX acircumflex w -15
+KPX acircumflex y -20
+KPX acircumflex yacute -20
+KPX acircumflex ydieresis -20
+KPX adieresis g -10
+KPX adieresis gbreve -10
+KPX adieresis gcommaaccent -10
+KPX adieresis v -15
+KPX adieresis w -15
+KPX adieresis y -20
+KPX adieresis yacute -20
+KPX adieresis ydieresis -20
+KPX agrave g -10
+KPX agrave gbreve -10
+KPX agrave gcommaaccent -10
+KPX agrave v -15
+KPX agrave w -15
+KPX agrave y -20
+KPX agrave yacute -20
+KPX agrave ydieresis -20
+KPX amacron g -10
+KPX amacron gbreve -10
+KPX amacron gcommaaccent -10
+KPX amacron v -15
+KPX amacron w -15
+KPX amacron y -20
+KPX amacron yacute -20
+KPX amacron ydieresis -20
+KPX aogonek g -10
+KPX aogonek gbreve -10
+KPX aogonek gcommaaccent -10
+KPX aogonek v -15
+KPX aogonek w -15
+KPX aogonek y -20
+KPX aogonek yacute -20
+KPX aogonek ydieresis -20
+KPX aring g -10
+KPX aring gbreve -10
+KPX aring gcommaaccent -10
+KPX aring v -15
+KPX aring w -15
+KPX aring y -20
+KPX aring yacute -20
+KPX aring ydieresis -20
+KPX atilde g -10
+KPX atilde gbreve -10
+KPX atilde gcommaaccent -10
+KPX atilde v -15
+KPX atilde w -15
+KPX atilde y -20
+KPX atilde yacute -20
+KPX atilde ydieresis -20
+KPX b l -10
+KPX b lacute -10
+KPX b lcommaaccent -10
+KPX b lslash -10
+KPX b u -20
+KPX b uacute -20
+KPX b ucircumflex -20
+KPX b udieresis -20
+KPX b ugrave -20
+KPX b uhungarumlaut -20
+KPX b umacron -20
+KPX b uogonek -20
+KPX b uring -20
+KPX b v -20
+KPX b y -20
+KPX b yacute -20
+KPX b ydieresis -20
+KPX c h -10
+KPX c k -20
+KPX c kcommaaccent -20
+KPX c l -20
+KPX c lacute -20
+KPX c lcommaaccent -20
+KPX c lslash -20
+KPX c y -10
+KPX c yacute -10
+KPX c ydieresis -10
+KPX cacute h -10
+KPX cacute k -20
+KPX cacute kcommaaccent -20
+KPX cacute l -20
+KPX cacute lacute -20
+KPX cacute lcommaaccent -20
+KPX cacute lslash -20
+KPX cacute y -10
+KPX cacute yacute -10
+KPX cacute ydieresis -10
+KPX ccaron h -10
+KPX ccaron k -20
+KPX ccaron kcommaaccent -20
+KPX ccaron l -20
+KPX ccaron lacute -20
+KPX ccaron lcommaaccent -20
+KPX ccaron lslash -20
+KPX ccaron y -10
+KPX ccaron yacute -10
+KPX ccaron ydieresis -10
+KPX ccedilla h -10
+KPX ccedilla k -20
+KPX ccedilla kcommaaccent -20
+KPX ccedilla l -20
+KPX ccedilla lacute -20
+KPX ccedilla lcommaaccent -20
+KPX ccedilla lslash -20
+KPX ccedilla y -10
+KPX ccedilla yacute -10
+KPX ccedilla ydieresis -10
+KPX colon space -40
+KPX comma quotedblright -120
+KPX comma quoteright -120
+KPX comma space -40
+KPX d d -10
+KPX d dcroat -10
+KPX d v -15
+KPX d w -15
+KPX d y -15
+KPX d yacute -15
+KPX d ydieresis -15
+KPX dcroat d -10
+KPX dcroat dcroat -10
+KPX dcroat v -15
+KPX dcroat w -15
+KPX dcroat y -15
+KPX dcroat yacute -15
+KPX dcroat ydieresis -15
+KPX e comma 10
+KPX e period 20
+KPX e v -15
+KPX e w -15
+KPX e x -15
+KPX e y -15
+KPX e yacute -15
+KPX e ydieresis -15
+KPX eacute comma 10
+KPX eacute period 20
+KPX eacute v -15
+KPX eacute w -15
+KPX eacute x -15
+KPX eacute y -15
+KPX eacute yacute -15
+KPX eacute ydieresis -15
+KPX ecaron comma 10
+KPX ecaron period 20
+KPX ecaron v -15
+KPX ecaron w -15
+KPX ecaron x -15
+KPX ecaron y -15
+KPX ecaron yacute -15
+KPX ecaron ydieresis -15
+KPX ecircumflex comma 10
+KPX ecircumflex period 20
+KPX ecircumflex v -15
+KPX ecircumflex w -15
+KPX ecircumflex x -15
+KPX ecircumflex y -15
+KPX ecircumflex yacute -15
+KPX ecircumflex ydieresis -15
+KPX edieresis comma 10
+KPX edieresis period 20
+KPX edieresis v -15
+KPX edieresis w -15
+KPX edieresis x -15
+KPX edieresis y -15
+KPX edieresis yacute -15
+KPX edieresis ydieresis -15
+KPX edotaccent comma 10
+KPX edotaccent period 20
+KPX edotaccent v -15
+KPX edotaccent w -15
+KPX edotaccent x -15
+KPX edotaccent y -15
+KPX edotaccent yacute -15
+KPX edotaccent ydieresis -15
+KPX egrave comma 10
+KPX egrave period 20
+KPX egrave v -15
+KPX egrave w -15
+KPX egrave x -15
+KPX egrave y -15
+KPX egrave yacute -15
+KPX egrave ydieresis -15
+KPX emacron comma 10
+KPX emacron period 20
+KPX emacron v -15
+KPX emacron w -15
+KPX emacron x -15
+KPX emacron y -15
+KPX emacron yacute -15
+KPX emacron ydieresis -15
+KPX eogonek comma 10
+KPX eogonek period 20
+KPX eogonek v -15
+KPX eogonek w -15
+KPX eogonek x -15
+KPX eogonek y -15
+KPX eogonek yacute -15
+KPX eogonek ydieresis -15
+KPX f comma -10
+KPX f e -10
+KPX f eacute -10
+KPX f ecaron -10
+KPX f ecircumflex -10
+KPX f edieresis -10
+KPX f edotaccent -10
+KPX f egrave -10
+KPX f emacron -10
+KPX f eogonek -10
+KPX f o -20
+KPX f oacute -20
+KPX f ocircumflex -20
+KPX f odieresis -20
+KPX f ograve -20
+KPX f ohungarumlaut -20
+KPX f omacron -20
+KPX f oslash -20
+KPX f otilde -20
+KPX f period -10
+KPX f quotedblright 30
+KPX f quoteright 30
+KPX g e 10
+KPX g eacute 10
+KPX g ecaron 10
+KPX g ecircumflex 10
+KPX g edieresis 10
+KPX g edotaccent 10
+KPX g egrave 10
+KPX g emacron 10
+KPX g eogonek 10
+KPX g g -10
+KPX g gbreve -10
+KPX g gcommaaccent -10
+KPX gbreve e 10
+KPX gbreve eacute 10
+KPX gbreve ecaron 10
+KPX gbreve ecircumflex 10
+KPX gbreve edieresis 10
+KPX gbreve edotaccent 10
+KPX gbreve egrave 10
+KPX gbreve emacron 10
+KPX gbreve eogonek 10
+KPX gbreve g -10
+KPX gbreve gbreve -10
+KPX gbreve gcommaaccent -10
+KPX gcommaaccent e 10
+KPX gcommaaccent eacute 10
+KPX gcommaaccent ecaron 10
+KPX gcommaaccent ecircumflex 10
+KPX gcommaaccent edieresis 10
+KPX gcommaaccent edotaccent 10
+KPX gcommaaccent egrave 10
+KPX gcommaaccent emacron 10
+KPX gcommaaccent eogonek 10
+KPX gcommaaccent g -10
+KPX gcommaaccent gbreve -10
+KPX gcommaaccent gcommaaccent -10
+KPX h y -20
+KPX h yacute -20
+KPX h ydieresis -20
+KPX k o -15
+KPX k oacute -15
+KPX k ocircumflex -15
+KPX k odieresis -15
+KPX k ograve -15
+KPX k ohungarumlaut -15
+KPX k omacron -15
+KPX k oslash -15
+KPX k otilde -15
+KPX kcommaaccent o -15
+KPX kcommaaccent oacute -15
+KPX kcommaaccent ocircumflex -15
+KPX kcommaaccent odieresis -15
+KPX kcommaaccent ograve -15
+KPX kcommaaccent ohungarumlaut -15
+KPX kcommaaccent omacron -15
+KPX kcommaaccent oslash -15
+KPX kcommaaccent otilde -15
+KPX l w -15
+KPX l y -15
+KPX l yacute -15
+KPX l ydieresis -15
+KPX lacute w -15
+KPX lacute y -15
+KPX lacute yacute -15
+KPX lacute ydieresis -15
+KPX lcommaaccent w -15
+KPX lcommaaccent y -15
+KPX lcommaaccent yacute -15
+KPX lcommaaccent ydieresis -15
+KPX lslash w -15
+KPX lslash y -15
+KPX lslash yacute -15
+KPX lslash ydieresis -15
+KPX m u -20
+KPX m uacute -20
+KPX m ucircumflex -20
+KPX m udieresis -20
+KPX m ugrave -20
+KPX m uhungarumlaut -20
+KPX m umacron -20
+KPX m uogonek -20
+KPX m uring -20
+KPX m y -30
+KPX m yacute -30
+KPX m ydieresis -30
+KPX n u -10
+KPX n uacute -10
+KPX n ucircumflex -10
+KPX n udieresis -10
+KPX n ugrave -10
+KPX n uhungarumlaut -10
+KPX n umacron -10
+KPX n uogonek -10
+KPX n uring -10
+KPX n v -40
+KPX n y -20
+KPX n yacute -20
+KPX n ydieresis -20
+KPX nacute u -10
+KPX nacute uacute -10
+KPX nacute ucircumflex -10
+KPX nacute udieresis -10
+KPX nacute ugrave -10
+KPX nacute uhungarumlaut -10
+KPX nacute umacron -10
+KPX nacute uogonek -10
+KPX nacute uring -10
+KPX nacute v -40
+KPX nacute y -20
+KPX nacute yacute -20
+KPX nacute ydieresis -20
+KPX ncaron u -10
+KPX ncaron uacute -10
+KPX ncaron ucircumflex -10
+KPX ncaron udieresis -10
+KPX ncaron ugrave -10
+KPX ncaron uhungarumlaut -10
+KPX ncaron umacron -10
+KPX ncaron uogonek -10
+KPX ncaron uring -10
+KPX ncaron v -40
+KPX ncaron y -20
+KPX ncaron yacute -20
+KPX ncaron ydieresis -20
+KPX ncommaaccent u -10
+KPX ncommaaccent uacute -10
+KPX ncommaaccent ucircumflex -10
+KPX ncommaaccent udieresis -10
+KPX ncommaaccent ugrave -10
+KPX ncommaaccent uhungarumlaut -10
+KPX ncommaaccent umacron -10
+KPX ncommaaccent uogonek -10
+KPX ncommaaccent uring -10
+KPX ncommaaccent v -40
+KPX ncommaaccent y -20
+KPX ncommaaccent yacute -20
+KPX ncommaaccent ydieresis -20
+KPX ntilde u -10
+KPX ntilde uacute -10
+KPX ntilde ucircumflex -10
+KPX ntilde udieresis -10
+KPX ntilde ugrave -10
+KPX ntilde uhungarumlaut -10
+KPX ntilde umacron -10
+KPX ntilde uogonek -10
+KPX ntilde uring -10
+KPX ntilde v -40
+KPX ntilde y -20
+KPX ntilde yacute -20
+KPX ntilde ydieresis -20
+KPX o v -20
+KPX o w -15
+KPX o x -30
+KPX o y -20
+KPX o yacute -20
+KPX o ydieresis -20
+KPX oacute v -20
+KPX oacute w -15
+KPX oacute x -30
+KPX oacute y -20
+KPX oacute yacute -20
+KPX oacute ydieresis -20
+KPX ocircumflex v -20
+KPX ocircumflex w -15
+KPX ocircumflex x -30
+KPX ocircumflex y -20
+KPX ocircumflex yacute -20
+KPX ocircumflex ydieresis -20
+KPX odieresis v -20
+KPX odieresis w -15
+KPX odieresis x -30
+KPX odieresis y -20
+KPX odieresis yacute -20
+KPX odieresis ydieresis -20
+KPX ograve v -20
+KPX ograve w -15
+KPX ograve x -30
+KPX ograve y -20
+KPX ograve yacute -20
+KPX ograve ydieresis -20
+KPX ohungarumlaut v -20
+KPX ohungarumlaut w -15
+KPX ohungarumlaut x -30
+KPX ohungarumlaut y -20
+KPX ohungarumlaut yacute -20
+KPX ohungarumlaut ydieresis -20
+KPX omacron v -20
+KPX omacron w -15
+KPX omacron x -30
+KPX omacron y -20
+KPX omacron yacute -20
+KPX omacron ydieresis -20
+KPX oslash v -20
+KPX oslash w -15
+KPX oslash x -30
+KPX oslash y -20
+KPX oslash yacute -20
+KPX oslash ydieresis -20
+KPX otilde v -20
+KPX otilde w -15
+KPX otilde x -30
+KPX otilde y -20
+KPX otilde yacute -20
+KPX otilde ydieresis -20
+KPX p y -15
+KPX p yacute -15
+KPX p ydieresis -15
+KPX period quotedblright -120
+KPX period quoteright -120
+KPX period space -40
+KPX quotedblright space -80
+KPX quoteleft quoteleft -46
+KPX quoteright d -80
+KPX quoteright dcroat -80
+KPX quoteright l -20
+KPX quoteright lacute -20
+KPX quoteright lcommaaccent -20
+KPX quoteright lslash -20
+KPX quoteright quoteright -46
+KPX quoteright r -40
+KPX quoteright racute -40
+KPX quoteright rcaron -40
+KPX quoteright rcommaaccent -40
+KPX quoteright s -60
+KPX quoteright sacute -60
+KPX quoteright scaron -60
+KPX quoteright scedilla -60
+KPX quoteright scommaaccent -60
+KPX quoteright space -80
+KPX quoteright v -20
+KPX r c -20
+KPX r cacute -20
+KPX r ccaron -20
+KPX r ccedilla -20
+KPX r comma -60
+KPX r d -20
+KPX r dcroat -20
+KPX r g -15
+KPX r gbreve -15
+KPX r gcommaaccent -15
+KPX r hyphen -20
+KPX r o -20
+KPX r oacute -20
+KPX r ocircumflex -20
+KPX r odieresis -20
+KPX r ograve -20
+KPX r ohungarumlaut -20
+KPX r omacron -20
+KPX r oslash -20
+KPX r otilde -20
+KPX r period -60
+KPX r q -20
+KPX r s -15
+KPX r sacute -15
+KPX r scaron -15
+KPX r scedilla -15
+KPX r scommaaccent -15
+KPX r t 20
+KPX r tcommaaccent 20
+KPX r v 10
+KPX r y 10
+KPX r yacute 10
+KPX r ydieresis 10
+KPX racute c -20
+KPX racute cacute -20
+KPX racute ccaron -20
+KPX racute ccedilla -20
+KPX racute comma -60
+KPX racute d -20
+KPX racute dcroat -20
+KPX racute g -15
+KPX racute gbreve -15
+KPX racute gcommaaccent -15
+KPX racute hyphen -20
+KPX racute o -20
+KPX racute oacute -20
+KPX racute ocircumflex -20
+KPX racute odieresis -20
+KPX racute ograve -20
+KPX racute ohungarumlaut -20
+KPX racute omacron -20
+KPX racute oslash -20
+KPX racute otilde -20
+KPX racute period -60
+KPX racute q -20
+KPX racute s -15
+KPX racute sacute -15
+KPX racute scaron -15
+KPX racute scedilla -15
+KPX racute scommaaccent -15
+KPX racute t 20
+KPX racute tcommaaccent 20
+KPX racute v 10
+KPX racute y 10
+KPX racute yacute 10
+KPX racute ydieresis 10
+KPX rcaron c -20
+KPX rcaron cacute -20
+KPX rcaron ccaron -20
+KPX rcaron ccedilla -20
+KPX rcaron comma -60
+KPX rcaron d -20
+KPX rcaron dcroat -20
+KPX rcaron g -15
+KPX rcaron gbreve -15
+KPX rcaron gcommaaccent -15
+KPX rcaron hyphen -20
+KPX rcaron o -20
+KPX rcaron oacute -20
+KPX rcaron ocircumflex -20
+KPX rcaron odieresis -20
+KPX rcaron ograve -20
+KPX rcaron ohungarumlaut -20
+KPX rcaron omacron -20
+KPX rcaron oslash -20
+KPX rcaron otilde -20
+KPX rcaron period -60
+KPX rcaron q -20
+KPX rcaron s -15
+KPX rcaron sacute -15
+KPX rcaron scaron -15
+KPX rcaron scedilla -15
+KPX rcaron scommaaccent -15
+KPX rcaron t 20
+KPX rcaron tcommaaccent 20
+KPX rcaron v 10
+KPX rcaron y 10
+KPX rcaron yacute 10
+KPX rcaron ydieresis 10
+KPX rcommaaccent c -20
+KPX rcommaaccent cacute -20
+KPX rcommaaccent ccaron -20
+KPX rcommaaccent ccedilla -20
+KPX rcommaaccent comma -60
+KPX rcommaaccent d -20
+KPX rcommaaccent dcroat -20
+KPX rcommaaccent g -15
+KPX rcommaaccent gbreve -15
+KPX rcommaaccent gcommaaccent -15
+KPX rcommaaccent hyphen -20
+KPX rcommaaccent o -20
+KPX rcommaaccent oacute -20
+KPX rcommaaccent ocircumflex -20
+KPX rcommaaccent odieresis -20
+KPX rcommaaccent ograve -20
+KPX rcommaaccent ohungarumlaut -20
+KPX rcommaaccent omacron -20
+KPX rcommaaccent oslash -20
+KPX rcommaaccent otilde -20
+KPX rcommaaccent period -60
+KPX rcommaaccent q -20
+KPX rcommaaccent s -15
+KPX rcommaaccent sacute -15
+KPX rcommaaccent scaron -15
+KPX rcommaaccent scedilla -15
+KPX rcommaaccent scommaaccent -15
+KPX rcommaaccent t 20
+KPX rcommaaccent tcommaaccent 20
+KPX rcommaaccent v 10
+KPX rcommaaccent y 10
+KPX rcommaaccent yacute 10
+KPX rcommaaccent ydieresis 10
+KPX s w -15
+KPX sacute w -15
+KPX scaron w -15
+KPX scedilla w -15
+KPX scommaaccent w -15
+KPX semicolon space -40
+KPX space T -100
+KPX space Tcaron -100
+KPX space Tcommaaccent -100
+KPX space V -80
+KPX space W -80
+KPX space Y -120
+KPX space Yacute -120
+KPX space Ydieresis -120
+KPX space quotedblleft -80
+KPX space quoteleft -60
+KPX v a -20
+KPX v aacute -20
+KPX v abreve -20
+KPX v acircumflex -20
+KPX v adieresis -20
+KPX v agrave -20
+KPX v amacron -20
+KPX v aogonek -20
+KPX v aring -20
+KPX v atilde -20
+KPX v comma -80
+KPX v o -30
+KPX v oacute -30
+KPX v ocircumflex -30
+KPX v odieresis -30
+KPX v ograve -30
+KPX v ohungarumlaut -30
+KPX v omacron -30
+KPX v oslash -30
+KPX v otilde -30
+KPX v period -80
+KPX w comma -40
+KPX w o -20
+KPX w oacute -20
+KPX w ocircumflex -20
+KPX w odieresis -20
+KPX w ograve -20
+KPX w ohungarumlaut -20
+KPX w omacron -20
+KPX w oslash -20
+KPX w otilde -20
+KPX w period -40
+KPX x e -10
+KPX x eacute -10
+KPX x ecaron -10
+KPX x ecircumflex -10
+KPX x edieresis -10
+KPX x edotaccent -10
+KPX x egrave -10
+KPX x emacron -10
+KPX x eogonek -10
+KPX y a -30
+KPX y aacute -30
+KPX y abreve -30
+KPX y acircumflex -30
+KPX y adieresis -30
+KPX y agrave -30
+KPX y amacron -30
+KPX y aogonek -30
+KPX y aring -30
+KPX y atilde -30
+KPX y comma -80
+KPX y e -10
+KPX y eacute -10
+KPX y ecaron -10
+KPX y ecircumflex -10
+KPX y edieresis -10
+KPX y edotaccent -10
+KPX y egrave -10
+KPX y emacron -10
+KPX y eogonek -10
+KPX y o -25
+KPX y oacute -25
+KPX y ocircumflex -25
+KPX y odieresis -25
+KPX y ograve -25
+KPX y ohungarumlaut -25
+KPX y omacron -25
+KPX y oslash -25
+KPX y otilde -25
+KPX y period -80
+KPX yacute a -30
+KPX yacute aacute -30
+KPX yacute abreve -30
+KPX yacute acircumflex -30
+KPX yacute adieresis -30
+KPX yacute agrave -30
+KPX yacute amacron -30
+KPX yacute aogonek -30
+KPX yacute aring -30
+KPX yacute atilde -30
+KPX yacute comma -80
+KPX yacute e -10
+KPX yacute eacute -10
+KPX yacute ecaron -10
+KPX yacute ecircumflex -10
+KPX yacute edieresis -10
+KPX yacute edotaccent -10
+KPX yacute egrave -10
+KPX yacute emacron -10
+KPX yacute eogonek -10
+KPX yacute o -25
+KPX yacute oacute -25
+KPX yacute ocircumflex -25
+KPX yacute odieresis -25
+KPX yacute ograve -25
+KPX yacute ohungarumlaut -25
+KPX yacute omacron -25
+KPX yacute oslash -25
+KPX yacute otilde -25
+KPX yacute period -80
+KPX ydieresis a -30
+KPX ydieresis aacute -30
+KPX ydieresis abreve -30
+KPX ydieresis acircumflex -30
+KPX ydieresis adieresis -30
+KPX ydieresis agrave -30
+KPX ydieresis amacron -30
+KPX ydieresis aogonek -30
+KPX ydieresis aring -30
+KPX ydieresis atilde -30
+KPX ydieresis comma -80
+KPX ydieresis e -10
+KPX ydieresis eacute -10
+KPX ydieresis ecaron -10
+KPX ydieresis ecircumflex -10
+KPX ydieresis edieresis -10
+KPX ydieresis edotaccent -10
+KPX ydieresis egrave -10
+KPX ydieresis emacron -10
+KPX ydieresis eogonek -10
+KPX ydieresis o -25
+KPX ydieresis oacute -25
+KPX ydieresis ocircumflex -25
+KPX ydieresis odieresis -25
+KPX ydieresis ograve -25
+KPX ydieresis ohungarumlaut -25
+KPX ydieresis omacron -25
+KPX ydieresis oslash -25
+KPX ydieresis otilde -25
+KPX ydieresis period -80
+KPX z e 10
+KPX z eacute 10
+KPX z ecaron 10
+KPX z ecircumflex 10
+KPX z edieresis 10
+KPX z edotaccent 10
+KPX z egrave 10
+KPX z emacron 10
+KPX z eogonek 10
+KPX zacute e 10
+KPX zacute eacute 10
+KPX zacute ecaron 10
+KPX zacute ecircumflex 10
+KPX zacute edieresis 10
+KPX zacute edotaccent 10
+KPX zacute egrave 10
+KPX zacute emacron 10
+KPX zacute eogonek 10
+KPX zcaron e 10
+KPX zcaron eacute 10
+KPX zcaron ecaron 10
+KPX zcaron ecircumflex 10
+KPX zcaron edieresis 10
+KPX zcaron edotaccent 10
+KPX zcaron egrave 10
+KPX zcaron emacron 10
+KPX zcaron eogonek 10
+KPX zdotaccent e 10
+KPX zdotaccent eacute 10
+KPX zdotaccent ecaron 10
+KPX zdotaccent ecircumflex 10
+KPX zdotaccent edieresis 10
+KPX zdotaccent edotaccent 10
+KPX zdotaccent egrave 10
+KPX zdotaccent emacron 10
+KPX zdotaccent eogonek 10
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-BoldOblique.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-BoldOblique.afm
new file mode 100644
index 0000000..1715b21
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-BoldOblique.afm
@@ -0,0 +1,2827 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu May 1 12:45:12 1997
+Comment UniqueID 43053
+Comment VMusage 14482 68586
+FontName Helvetica-BoldOblique
+FullName Helvetica Bold Oblique
+FamilyName Helvetica
+Weight Bold
+ItalicAngle -12
+IsFixedPitch false
+CharacterSet ExtendedRoman
+FontBBox -174 -228 1114 962
+UnderlinePosition -100
+UnderlineThickness 50
+Version 002.000
+Notice Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 718
+XHeight 532
+Ascender 718
+Descender -207
+StdHW 118
+StdVW 140
+StartCharMetrics 315
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 94 0 397 718 ;
+C 34 ; WX 474 ; N quotedbl ; B 193 447 529 718 ;
+C 35 ; WX 556 ; N numbersign ; B 60 0 644 698 ;
+C 36 ; WX 556 ; N dollar ; B 67 -115 622 775 ;
+C 37 ; WX 889 ; N percent ; B 136 -19 901 710 ;
+C 38 ; WX 722 ; N ampersand ; B 89 -19 732 718 ;
+C 39 ; WX 278 ; N quoteright ; B 167 445 362 718 ;
+C 40 ; WX 333 ; N parenleft ; B 76 -208 470 734 ;
+C 41 ; WX 333 ; N parenright ; B -25 -208 369 734 ;
+C 42 ; WX 389 ; N asterisk ; B 146 387 481 718 ;
+C 43 ; WX 584 ; N plus ; B 82 0 610 506 ;
+C 44 ; WX 278 ; N comma ; B 28 -168 245 146 ;
+C 45 ; WX 333 ; N hyphen ; B 73 215 379 345 ;
+C 46 ; WX 278 ; N period ; B 64 0 245 146 ;
+C 47 ; WX 278 ; N slash ; B -37 -19 468 737 ;
+C 48 ; WX 556 ; N zero ; B 86 -19 617 710 ;
+C 49 ; WX 556 ; N one ; B 173 0 529 710 ;
+C 50 ; WX 556 ; N two ; B 26 0 619 710 ;
+C 51 ; WX 556 ; N three ; B 65 -19 608 710 ;
+C 52 ; WX 556 ; N four ; B 60 0 598 710 ;
+C 53 ; WX 556 ; N five ; B 64 -19 636 698 ;
+C 54 ; WX 556 ; N six ; B 85 -19 619 710 ;
+C 55 ; WX 556 ; N seven ; B 125 0 676 698 ;
+C 56 ; WX 556 ; N eight ; B 69 -19 616 710 ;
+C 57 ; WX 556 ; N nine ; B 78 -19 615 710 ;
+C 58 ; WX 333 ; N colon ; B 92 0 351 512 ;
+C 59 ; WX 333 ; N semicolon ; B 56 -168 351 512 ;
+C 60 ; WX 584 ; N less ; B 82 -8 655 514 ;
+C 61 ; WX 584 ; N equal ; B 58 87 633 419 ;
+C 62 ; WX 584 ; N greater ; B 36 -8 609 514 ;
+C 63 ; WX 611 ; N question ; B 165 0 671 727 ;
+C 64 ; WX 975 ; N at ; B 186 -19 954 737 ;
+C 65 ; WX 722 ; N A ; B 20 0 702 718 ;
+C 66 ; WX 722 ; N B ; B 76 0 764 718 ;
+C 67 ; WX 722 ; N C ; B 107 -19 789 737 ;
+C 68 ; WX 722 ; N D ; B 76 0 777 718 ;
+C 69 ; WX 667 ; N E ; B 76 0 757 718 ;
+C 70 ; WX 611 ; N F ; B 76 0 740 718 ;
+C 71 ; WX 778 ; N G ; B 108 -19 817 737 ;
+C 72 ; WX 722 ; N H ; B 71 0 804 718 ;
+C 73 ; WX 278 ; N I ; B 64 0 367 718 ;
+C 74 ; WX 556 ; N J ; B 60 -18 637 718 ;
+C 75 ; WX 722 ; N K ; B 87 0 858 718 ;
+C 76 ; WX 611 ; N L ; B 76 0 611 718 ;
+C 77 ; WX 833 ; N M ; B 69 0 918 718 ;
+C 78 ; WX 722 ; N N ; B 69 0 807 718 ;
+C 79 ; WX 778 ; N O ; B 107 -19 823 737 ;
+C 80 ; WX 667 ; N P ; B 76 0 738 718 ;
+C 81 ; WX 778 ; N Q ; B 107 -52 823 737 ;
+C 82 ; WX 722 ; N R ; B 76 0 778 718 ;
+C 83 ; WX 667 ; N S ; B 81 -19 718 737 ;
+C 84 ; WX 611 ; N T ; B 140 0 751 718 ;
+C 85 ; WX 722 ; N U ; B 116 -19 804 718 ;
+C 86 ; WX 667 ; N V ; B 172 0 801 718 ;
+C 87 ; WX 944 ; N W ; B 169 0 1082 718 ;
+C 88 ; WX 667 ; N X ; B 14 0 791 718 ;
+C 89 ; WX 667 ; N Y ; B 168 0 806 718 ;
+C 90 ; WX 611 ; N Z ; B 25 0 737 718 ;
+C 91 ; WX 333 ; N bracketleft ; B 21 -196 462 722 ;
+C 92 ; WX 278 ; N backslash ; B 124 -19 307 737 ;
+C 93 ; WX 333 ; N bracketright ; B -18 -196 423 722 ;
+C 94 ; WX 584 ; N asciicircum ; B 131 323 591 698 ;
+C 95 ; WX 556 ; N underscore ; B -27 -125 540 -75 ;
+C 96 ; WX 278 ; N quoteleft ; B 165 454 361 727 ;
+C 97 ; WX 556 ; N a ; B 55 -14 583 546 ;
+C 98 ; WX 611 ; N b ; B 61 -14 645 718 ;
+C 99 ; WX 556 ; N c ; B 79 -14 599 546 ;
+C 100 ; WX 611 ; N d ; B 82 -14 704 718 ;
+C 101 ; WX 556 ; N e ; B 70 -14 593 546 ;
+C 102 ; WX 333 ; N f ; B 87 0 469 727 ; L i fi ; L l fl ;
+C 103 ; WX 611 ; N g ; B 38 -217 666 546 ;
+C 104 ; WX 611 ; N h ; B 65 0 629 718 ;
+C 105 ; WX 278 ; N i ; B 69 0 363 725 ;
+C 106 ; WX 278 ; N j ; B -42 -214 363 725 ;
+C 107 ; WX 556 ; N k ; B 69 0 670 718 ;
+C 108 ; WX 278 ; N l ; B 69 0 362 718 ;
+C 109 ; WX 889 ; N m ; B 64 0 909 546 ;
+C 110 ; WX 611 ; N n ; B 65 0 629 546 ;
+C 111 ; WX 611 ; N o ; B 82 -14 643 546 ;
+C 112 ; WX 611 ; N p ; B 18 -207 645 546 ;
+C 113 ; WX 611 ; N q ; B 80 -207 665 546 ;
+C 114 ; WX 389 ; N r ; B 64 0 489 546 ;
+C 115 ; WX 556 ; N s ; B 63 -14 584 546 ;
+C 116 ; WX 333 ; N t ; B 100 -6 422 676 ;
+C 117 ; WX 611 ; N u ; B 98 -14 658 532 ;
+C 118 ; WX 556 ; N v ; B 126 0 656 532 ;
+C 119 ; WX 778 ; N w ; B 123 0 882 532 ;
+C 120 ; WX 556 ; N x ; B 15 0 648 532 ;
+C 121 ; WX 556 ; N y ; B 42 -214 652 532 ;
+C 122 ; WX 500 ; N z ; B 20 0 583 532 ;
+C 123 ; WX 389 ; N braceleft ; B 94 -196 518 722 ;
+C 124 ; WX 280 ; N bar ; B 36 -225 361 775 ;
+C 125 ; WX 389 ; N braceright ; B -18 -196 407 722 ;
+C 126 ; WX 584 ; N asciitilde ; B 115 163 577 343 ;
+C 161 ; WX 333 ; N exclamdown ; B 50 -186 353 532 ;
+C 162 ; WX 556 ; N cent ; B 79 -118 599 628 ;
+C 163 ; WX 556 ; N sterling ; B 50 -16 635 718 ;
+C 164 ; WX 167 ; N fraction ; B -174 -19 487 710 ;
+C 165 ; WX 556 ; N yen ; B 60 0 713 698 ;
+C 166 ; WX 556 ; N florin ; B -50 -210 669 737 ;
+C 167 ; WX 556 ; N section ; B 61 -184 598 727 ;
+C 168 ; WX 556 ; N currency ; B 27 76 680 636 ;
+C 169 ; WX 238 ; N quotesingle ; B 165 447 321 718 ;
+C 170 ; WX 500 ; N quotedblleft ; B 160 454 588 727 ;
+C 171 ; WX 556 ; N guillemotleft ; B 135 76 571 484 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 130 76 353 484 ;
+C 173 ; WX 333 ; N guilsinglright ; B 99 76 322 484 ;
+C 174 ; WX 611 ; N fi ; B 87 0 696 727 ;
+C 175 ; WX 611 ; N fl ; B 87 0 695 727 ;
+C 177 ; WX 556 ; N endash ; B 48 227 627 333 ;
+C 178 ; WX 556 ; N dagger ; B 118 -171 626 718 ;
+C 179 ; WX 556 ; N daggerdbl ; B 46 -171 628 718 ;
+C 180 ; WX 278 ; N periodcentered ; B 110 172 276 334 ;
+C 182 ; WX 556 ; N paragraph ; B 98 -191 688 700 ;
+C 183 ; WX 350 ; N bullet ; B 83 194 420 524 ;
+C 184 ; WX 278 ; N quotesinglbase ; B 41 -146 236 127 ;
+C 185 ; WX 500 ; N quotedblbase ; B 36 -146 463 127 ;
+C 186 ; WX 500 ; N quotedblright ; B 162 445 589 718 ;
+C 187 ; WX 556 ; N guillemotright ; B 104 76 540 484 ;
+C 188 ; WX 1000 ; N ellipsis ; B 92 0 939 146 ;
+C 189 ; WX 1000 ; N perthousand ; B 76 -19 1038 710 ;
+C 191 ; WX 611 ; N questiondown ; B 53 -195 559 532 ;
+C 193 ; WX 333 ; N grave ; B 136 604 353 750 ;
+C 194 ; WX 333 ; N acute ; B 236 604 515 750 ;
+C 195 ; WX 333 ; N circumflex ; B 118 604 471 750 ;
+C 196 ; WX 333 ; N tilde ; B 113 610 507 737 ;
+C 197 ; WX 333 ; N macron ; B 122 604 483 678 ;
+C 198 ; WX 333 ; N breve ; B 156 604 494 750 ;
+C 199 ; WX 333 ; N dotaccent ; B 235 614 385 729 ;
+C 200 ; WX 333 ; N dieresis ; B 137 614 482 729 ;
+C 202 ; WX 333 ; N ring ; B 200 568 420 776 ;
+C 203 ; WX 333 ; N cedilla ; B -37 -228 220 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 137 604 645 750 ;
+C 206 ; WX 333 ; N ogonek ; B 41 -228 264 0 ;
+C 207 ; WX 333 ; N caron ; B 149 604 502 750 ;
+C 208 ; WX 1000 ; N emdash ; B 48 227 1071 333 ;
+C 225 ; WX 1000 ; N AE ; B 5 0 1100 718 ;
+C 227 ; WX 370 ; N ordfeminine ; B 125 401 465 737 ;
+C 232 ; WX 611 ; N Lslash ; B 34 0 611 718 ;
+C 233 ; WX 778 ; N Oslash ; B 35 -27 894 745 ;
+C 234 ; WX 1000 ; N OE ; B 99 -19 1114 737 ;
+C 235 ; WX 365 ; N ordmasculine ; B 123 401 485 737 ;
+C 241 ; WX 889 ; N ae ; B 56 -14 923 546 ;
+C 245 ; WX 278 ; N dotlessi ; B 69 0 322 532 ;
+C 248 ; WX 278 ; N lslash ; B 40 0 407 718 ;
+C 249 ; WX 611 ; N oslash ; B 22 -29 701 560 ;
+C 250 ; WX 944 ; N oe ; B 82 -14 977 546 ;
+C 251 ; WX 611 ; N germandbls ; B 69 -14 657 731 ;
+C -1 ; WX 278 ; N Idieresis ; B 64 0 494 915 ;
+C -1 ; WX 556 ; N eacute ; B 70 -14 627 750 ;
+C -1 ; WX 556 ; N abreve ; B 55 -14 606 750 ;
+C -1 ; WX 611 ; N uhungarumlaut ; B 98 -14 784 750 ;
+C -1 ; WX 556 ; N ecaron ; B 70 -14 614 750 ;
+C -1 ; WX 667 ; N Ydieresis ; B 168 0 806 915 ;
+C -1 ; WX 584 ; N divide ; B 82 -42 610 548 ;
+C -1 ; WX 667 ; N Yacute ; B 168 0 806 936 ;
+C -1 ; WX 722 ; N Acircumflex ; B 20 0 706 936 ;
+C -1 ; WX 556 ; N aacute ; B 55 -14 627 750 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 116 -19 804 936 ;
+C -1 ; WX 556 ; N yacute ; B 42 -214 652 750 ;
+C -1 ; WX 556 ; N scommaaccent ; B 63 -228 584 546 ;
+C -1 ; WX 556 ; N ecircumflex ; B 70 -14 593 750 ;
+C -1 ; WX 722 ; N Uring ; B 116 -19 804 962 ;
+C -1 ; WX 722 ; N Udieresis ; B 116 -19 804 915 ;
+C -1 ; WX 556 ; N aogonek ; B 55 -224 583 546 ;
+C -1 ; WX 722 ; N Uacute ; B 116 -19 804 936 ;
+C -1 ; WX 611 ; N uogonek ; B 98 -228 658 532 ;
+C -1 ; WX 667 ; N Edieresis ; B 76 0 757 915 ;
+C -1 ; WX 722 ; N Dcroat ; B 62 0 777 718 ;
+C -1 ; WX 250 ; N commaaccent ; B 16 -228 188 -50 ;
+C -1 ; WX 737 ; N copyright ; B 56 -19 835 737 ;
+C -1 ; WX 667 ; N Emacron ; B 76 0 757 864 ;
+C -1 ; WX 556 ; N ccaron ; B 79 -14 614 750 ;
+C -1 ; WX 556 ; N aring ; B 55 -14 583 776 ;
+C -1 ; WX 722 ; N Ncommaaccent ; B 69 -228 807 718 ;
+C -1 ; WX 278 ; N lacute ; B 69 0 528 936 ;
+C -1 ; WX 556 ; N agrave ; B 55 -14 583 750 ;
+C -1 ; WX 611 ; N Tcommaaccent ; B 140 -228 751 718 ;
+C -1 ; WX 722 ; N Cacute ; B 107 -19 789 936 ;
+C -1 ; WX 556 ; N atilde ; B 55 -14 619 737 ;
+C -1 ; WX 667 ; N Edotaccent ; B 76 0 757 915 ;
+C -1 ; WX 556 ; N scaron ; B 63 -14 614 750 ;
+C -1 ; WX 556 ; N scedilla ; B 63 -228 584 546 ;
+C -1 ; WX 278 ; N iacute ; B 69 0 488 750 ;
+C -1 ; WX 494 ; N lozenge ; B 90 0 564 745 ;
+C -1 ; WX 722 ; N Rcaron ; B 76 0 778 936 ;
+C -1 ; WX 778 ; N Gcommaaccent ; B 108 -228 817 737 ;
+C -1 ; WX 611 ; N ucircumflex ; B 98 -14 658 750 ;
+C -1 ; WX 556 ; N acircumflex ; B 55 -14 583 750 ;
+C -1 ; WX 722 ; N Amacron ; B 20 0 718 864 ;
+C -1 ; WX 389 ; N rcaron ; B 64 0 530 750 ;
+C -1 ; WX 556 ; N ccedilla ; B 79 -228 599 546 ;
+C -1 ; WX 611 ; N Zdotaccent ; B 25 0 737 915 ;
+C -1 ; WX 667 ; N Thorn ; B 76 0 716 718 ;
+C -1 ; WX 778 ; N Omacron ; B 107 -19 823 864 ;
+C -1 ; WX 722 ; N Racute ; B 76 0 778 936 ;
+C -1 ; WX 667 ; N Sacute ; B 81 -19 722 936 ;
+C -1 ; WX 743 ; N dcaron ; B 82 -14 903 718 ;
+C -1 ; WX 722 ; N Umacron ; B 116 -19 804 864 ;
+C -1 ; WX 611 ; N uring ; B 98 -14 658 776 ;
+C -1 ; WX 333 ; N threesuperior ; B 91 271 441 710 ;
+C -1 ; WX 778 ; N Ograve ; B 107 -19 823 936 ;
+C -1 ; WX 722 ; N Agrave ; B 20 0 702 936 ;
+C -1 ; WX 722 ; N Abreve ; B 20 0 729 936 ;
+C -1 ; WX 584 ; N multiply ; B 57 1 635 505 ;
+C -1 ; WX 611 ; N uacute ; B 98 -14 658 750 ;
+C -1 ; WX 611 ; N Tcaron ; B 140 0 751 936 ;
+C -1 ; WX 494 ; N partialdiff ; B 43 -21 585 750 ;
+C -1 ; WX 556 ; N ydieresis ; B 42 -214 652 729 ;
+C -1 ; WX 722 ; N Nacute ; B 69 0 807 936 ;
+C -1 ; WX 278 ; N icircumflex ; B 69 0 444 750 ;
+C -1 ; WX 667 ; N Ecircumflex ; B 76 0 757 936 ;
+C -1 ; WX 556 ; N adieresis ; B 55 -14 594 729 ;
+C -1 ; WX 556 ; N edieresis ; B 70 -14 594 729 ;
+C -1 ; WX 556 ; N cacute ; B 79 -14 627 750 ;
+C -1 ; WX 611 ; N nacute ; B 65 0 654 750 ;
+C -1 ; WX 611 ; N umacron ; B 98 -14 658 678 ;
+C -1 ; WX 722 ; N Ncaron ; B 69 0 807 936 ;
+C -1 ; WX 278 ; N Iacute ; B 64 0 528 936 ;
+C -1 ; WX 584 ; N plusminus ; B 40 0 625 506 ;
+C -1 ; WX 280 ; N brokenbar ; B 52 -150 345 700 ;
+C -1 ; WX 737 ; N registered ; B 55 -19 834 737 ;
+C -1 ; WX 778 ; N Gbreve ; B 108 -19 817 936 ;
+C -1 ; WX 278 ; N Idotaccent ; B 64 0 397 915 ;
+C -1 ; WX 600 ; N summation ; B 14 -10 670 706 ;
+C -1 ; WX 667 ; N Egrave ; B 76 0 757 936 ;
+C -1 ; WX 389 ; N racute ; B 64 0 543 750 ;
+C -1 ; WX 611 ; N omacron ; B 82 -14 643 678 ;
+C -1 ; WX 611 ; N Zacute ; B 25 0 737 936 ;
+C -1 ; WX 611 ; N Zcaron ; B 25 0 737 936 ;
+C -1 ; WX 549 ; N greaterequal ; B 26 0 629 704 ;
+C -1 ; WX 722 ; N Eth ; B 62 0 777 718 ;
+C -1 ; WX 722 ; N Ccedilla ; B 107 -228 789 737 ;
+C -1 ; WX 278 ; N lcommaaccent ; B 30 -228 362 718 ;
+C -1 ; WX 389 ; N tcaron ; B 100 -6 608 878 ;
+C -1 ; WX 556 ; N eogonek ; B 70 -228 593 546 ;
+C -1 ; WX 722 ; N Uogonek ; B 116 -228 804 718 ;
+C -1 ; WX 722 ; N Aacute ; B 20 0 750 936 ;
+C -1 ; WX 722 ; N Adieresis ; B 20 0 716 915 ;
+C -1 ; WX 556 ; N egrave ; B 70 -14 593 750 ;
+C -1 ; WX 500 ; N zacute ; B 20 0 599 750 ;
+C -1 ; WX 278 ; N iogonek ; B -14 -224 363 725 ;
+C -1 ; WX 778 ; N Oacute ; B 107 -19 823 936 ;
+C -1 ; WX 611 ; N oacute ; B 82 -14 654 750 ;
+C -1 ; WX 556 ; N amacron ; B 55 -14 595 678 ;
+C -1 ; WX 556 ; N sacute ; B 63 -14 627 750 ;
+C -1 ; WX 278 ; N idieresis ; B 69 0 455 729 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 107 -19 823 936 ;
+C -1 ; WX 722 ; N Ugrave ; B 116 -19 804 936 ;
+C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
+C -1 ; WX 611 ; N thorn ; B 18 -208 645 718 ;
+C -1 ; WX 333 ; N twosuperior ; B 69 283 449 710 ;
+C -1 ; WX 778 ; N Odieresis ; B 107 -19 823 915 ;
+C -1 ; WX 611 ; N mu ; B 22 -207 658 532 ;
+C -1 ; WX 278 ; N igrave ; B 69 0 326 750 ;
+C -1 ; WX 611 ; N ohungarumlaut ; B 82 -14 784 750 ;
+C -1 ; WX 667 ; N Eogonek ; B 76 -224 757 718 ;
+C -1 ; WX 611 ; N dcroat ; B 82 -14 789 718 ;
+C -1 ; WX 834 ; N threequarters ; B 99 -19 839 710 ;
+C -1 ; WX 667 ; N Scedilla ; B 81 -228 718 737 ;
+C -1 ; WX 400 ; N lcaron ; B 69 0 561 718 ;
+C -1 ; WX 722 ; N Kcommaaccent ; B 87 -228 858 718 ;
+C -1 ; WX 611 ; N Lacute ; B 76 0 611 936 ;
+C -1 ; WX 1000 ; N trademark ; B 179 306 1109 718 ;
+C -1 ; WX 556 ; N edotaccent ; B 70 -14 593 729 ;
+C -1 ; WX 278 ; N Igrave ; B 64 0 367 936 ;
+C -1 ; WX 278 ; N Imacron ; B 64 0 496 864 ;
+C -1 ; WX 611 ; N Lcaron ; B 76 0 643 718 ;
+C -1 ; WX 834 ; N onehalf ; B 132 -19 858 710 ;
+C -1 ; WX 549 ; N lessequal ; B 29 0 676 704 ;
+C -1 ; WX 611 ; N ocircumflex ; B 82 -14 643 750 ;
+C -1 ; WX 611 ; N ntilde ; B 65 0 646 737 ;
+C -1 ; WX 722 ; N Uhungarumlaut ; B 116 -19 880 936 ;
+C -1 ; WX 667 ; N Eacute ; B 76 0 757 936 ;
+C -1 ; WX 556 ; N emacron ; B 70 -14 595 678 ;
+C -1 ; WX 611 ; N gbreve ; B 38 -217 666 750 ;
+C -1 ; WX 834 ; N onequarter ; B 132 -19 806 710 ;
+C -1 ; WX 667 ; N Scaron ; B 81 -19 718 936 ;
+C -1 ; WX 667 ; N Scommaaccent ; B 81 -228 718 737 ;
+C -1 ; WX 778 ; N Ohungarumlaut ; B 107 -19 908 936 ;
+C -1 ; WX 400 ; N degree ; B 175 426 467 712 ;
+C -1 ; WX 611 ; N ograve ; B 82 -14 643 750 ;
+C -1 ; WX 722 ; N Ccaron ; B 107 -19 789 936 ;
+C -1 ; WX 611 ; N ugrave ; B 98 -14 658 750 ;
+C -1 ; WX 549 ; N radical ; B 112 -46 689 850 ;
+C -1 ; WX 722 ; N Dcaron ; B 76 0 777 936 ;
+C -1 ; WX 389 ; N rcommaaccent ; B 26 -228 489 546 ;
+C -1 ; WX 722 ; N Ntilde ; B 69 0 807 923 ;
+C -1 ; WX 611 ; N otilde ; B 82 -14 646 737 ;
+C -1 ; WX 722 ; N Rcommaaccent ; B 76 -228 778 718 ;
+C -1 ; WX 611 ; N Lcommaaccent ; B 76 -228 611 718 ;
+C -1 ; WX 722 ; N Atilde ; B 20 0 741 923 ;
+C -1 ; WX 722 ; N Aogonek ; B 20 -224 702 718 ;
+C -1 ; WX 722 ; N Aring ; B 20 0 702 962 ;
+C -1 ; WX 778 ; N Otilde ; B 107 -19 823 923 ;
+C -1 ; WX 500 ; N zdotaccent ; B 20 0 583 729 ;
+C -1 ; WX 667 ; N Ecaron ; B 76 0 757 936 ;
+C -1 ; WX 278 ; N Iogonek ; B -41 -228 367 718 ;
+C -1 ; WX 556 ; N kcommaaccent ; B 69 -228 670 718 ;
+C -1 ; WX 584 ; N minus ; B 82 197 610 309 ;
+C -1 ; WX 278 ; N Icircumflex ; B 64 0 484 936 ;
+C -1 ; WX 611 ; N ncaron ; B 65 0 641 750 ;
+C -1 ; WX 333 ; N tcommaaccent ; B 58 -228 422 676 ;
+C -1 ; WX 584 ; N logicalnot ; B 105 108 633 419 ;
+C -1 ; WX 611 ; N odieresis ; B 82 -14 643 729 ;
+C -1 ; WX 611 ; N udieresis ; B 98 -14 658 729 ;
+C -1 ; WX 549 ; N notequal ; B 32 -49 630 570 ;
+C -1 ; WX 611 ; N gcommaaccent ; B 38 -217 666 850 ;
+C -1 ; WX 611 ; N eth ; B 82 -14 670 737 ;
+C -1 ; WX 500 ; N zcaron ; B 20 0 586 750 ;
+C -1 ; WX 611 ; N ncommaaccent ; B 65 -228 629 546 ;
+C -1 ; WX 333 ; N onesuperior ; B 148 283 388 710 ;
+C -1 ; WX 278 ; N imacron ; B 69 0 429 678 ;
+C -1 ; WX 556 ; N Euro ; B 0 0 0 0 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 2481
+KPX A C -40
+KPX A Cacute -40
+KPX A Ccaron -40
+KPX A Ccedilla -40
+KPX A G -50
+KPX A Gbreve -50
+KPX A Gcommaaccent -50
+KPX A O -40
+KPX A Oacute -40
+KPX A Ocircumflex -40
+KPX A Odieresis -40
+KPX A Ograve -40
+KPX A Ohungarumlaut -40
+KPX A Omacron -40
+KPX A Oslash -40
+KPX A Otilde -40
+KPX A Q -40
+KPX A T -90
+KPX A Tcaron -90
+KPX A Tcommaaccent -90
+KPX A U -50
+KPX A Uacute -50
+KPX A Ucircumflex -50
+KPX A Udieresis -50
+KPX A Ugrave -50
+KPX A Uhungarumlaut -50
+KPX A Umacron -50
+KPX A Uogonek -50
+KPX A Uring -50
+KPX A V -80
+KPX A W -60
+KPX A Y -110
+KPX A Yacute -110
+KPX A Ydieresis -110
+KPX A u -30
+KPX A uacute -30
+KPX A ucircumflex -30
+KPX A udieresis -30
+KPX A ugrave -30
+KPX A uhungarumlaut -30
+KPX A umacron -30
+KPX A uogonek -30
+KPX A uring -30
+KPX A v -40
+KPX A w -30
+KPX A y -30
+KPX A yacute -30
+KPX A ydieresis -30
+KPX Aacute C -40
+KPX Aacute Cacute -40
+KPX Aacute Ccaron -40
+KPX Aacute Ccedilla -40
+KPX Aacute G -50
+KPX Aacute Gbreve -50
+KPX Aacute Gcommaaccent -50
+KPX Aacute O -40
+KPX Aacute Oacute -40
+KPX Aacute Ocircumflex -40
+KPX Aacute Odieresis -40
+KPX Aacute Ograve -40
+KPX Aacute Ohungarumlaut -40
+KPX Aacute Omacron -40
+KPX Aacute Oslash -40
+KPX Aacute Otilde -40
+KPX Aacute Q -40
+KPX Aacute T -90
+KPX Aacute Tcaron -90
+KPX Aacute Tcommaaccent -90
+KPX Aacute U -50
+KPX Aacute Uacute -50
+KPX Aacute Ucircumflex -50
+KPX Aacute Udieresis -50
+KPX Aacute Ugrave -50
+KPX Aacute Uhungarumlaut -50
+KPX Aacute Umacron -50
+KPX Aacute Uogonek -50
+KPX Aacute Uring -50
+KPX Aacute V -80
+KPX Aacute W -60
+KPX Aacute Y -110
+KPX Aacute Yacute -110
+KPX Aacute Ydieresis -110
+KPX Aacute u -30
+KPX Aacute uacute -30
+KPX Aacute ucircumflex -30
+KPX Aacute udieresis -30
+KPX Aacute ugrave -30
+KPX Aacute uhungarumlaut -30
+KPX Aacute umacron -30
+KPX Aacute uogonek -30
+KPX Aacute uring -30
+KPX Aacute v -40
+KPX Aacute w -30
+KPX Aacute y -30
+KPX Aacute yacute -30
+KPX Aacute ydieresis -30
+KPX Abreve C -40
+KPX Abreve Cacute -40
+KPX Abreve Ccaron -40
+KPX Abreve Ccedilla -40
+KPX Abreve G -50
+KPX Abreve Gbreve -50
+KPX Abreve Gcommaaccent -50
+KPX Abreve O -40
+KPX Abreve Oacute -40
+KPX Abreve Ocircumflex -40
+KPX Abreve Odieresis -40
+KPX Abreve Ograve -40
+KPX Abreve Ohungarumlaut -40
+KPX Abreve Omacron -40
+KPX Abreve Oslash -40
+KPX Abreve Otilde -40
+KPX Abreve Q -40
+KPX Abreve T -90
+KPX Abreve Tcaron -90
+KPX Abreve Tcommaaccent -90
+KPX Abreve U -50
+KPX Abreve Uacute -50
+KPX Abreve Ucircumflex -50
+KPX Abreve Udieresis -50
+KPX Abreve Ugrave -50
+KPX Abreve Uhungarumlaut -50
+KPX Abreve Umacron -50
+KPX Abreve Uogonek -50
+KPX Abreve Uring -50
+KPX Abreve V -80
+KPX Abreve W -60
+KPX Abreve Y -110
+KPX Abreve Yacute -110
+KPX Abreve Ydieresis -110
+KPX Abreve u -30
+KPX Abreve uacute -30
+KPX Abreve ucircumflex -30
+KPX Abreve udieresis -30
+KPX Abreve ugrave -30
+KPX Abreve uhungarumlaut -30
+KPX Abreve umacron -30
+KPX Abreve uogonek -30
+KPX Abreve uring -30
+KPX Abreve v -40
+KPX Abreve w -30
+KPX Abreve y -30
+KPX Abreve yacute -30
+KPX Abreve ydieresis -30
+KPX Acircumflex C -40
+KPX Acircumflex Cacute -40
+KPX Acircumflex Ccaron -40
+KPX Acircumflex Ccedilla -40
+KPX Acircumflex G -50
+KPX Acircumflex Gbreve -50
+KPX Acircumflex Gcommaaccent -50
+KPX Acircumflex O -40
+KPX Acircumflex Oacute -40
+KPX Acircumflex Ocircumflex -40
+KPX Acircumflex Odieresis -40
+KPX Acircumflex Ograve -40
+KPX Acircumflex Ohungarumlaut -40
+KPX Acircumflex Omacron -40
+KPX Acircumflex Oslash -40
+KPX Acircumflex Otilde -40
+KPX Acircumflex Q -40
+KPX Acircumflex T -90
+KPX Acircumflex Tcaron -90
+KPX Acircumflex Tcommaaccent -90
+KPX Acircumflex U -50
+KPX Acircumflex Uacute -50
+KPX Acircumflex Ucircumflex -50
+KPX Acircumflex Udieresis -50
+KPX Acircumflex Ugrave -50
+KPX Acircumflex Uhungarumlaut -50
+KPX Acircumflex Umacron -50
+KPX Acircumflex Uogonek -50
+KPX Acircumflex Uring -50
+KPX Acircumflex V -80
+KPX Acircumflex W -60
+KPX Acircumflex Y -110
+KPX Acircumflex Yacute -110
+KPX Acircumflex Ydieresis -110
+KPX Acircumflex u -30
+KPX Acircumflex uacute -30
+KPX Acircumflex ucircumflex -30
+KPX Acircumflex udieresis -30
+KPX Acircumflex ugrave -30
+KPX Acircumflex uhungarumlaut -30
+KPX Acircumflex umacron -30
+KPX Acircumflex uogonek -30
+KPX Acircumflex uring -30
+KPX Acircumflex v -40
+KPX Acircumflex w -30
+KPX Acircumflex y -30
+KPX Acircumflex yacute -30
+KPX Acircumflex ydieresis -30
+KPX Adieresis C -40
+KPX Adieresis Cacute -40
+KPX Adieresis Ccaron -40
+KPX Adieresis Ccedilla -40
+KPX Adieresis G -50
+KPX Adieresis Gbreve -50
+KPX Adieresis Gcommaaccent -50
+KPX Adieresis O -40
+KPX Adieresis Oacute -40
+KPX Adieresis Ocircumflex -40
+KPX Adieresis Odieresis -40
+KPX Adieresis Ograve -40
+KPX Adieresis Ohungarumlaut -40
+KPX Adieresis Omacron -40
+KPX Adieresis Oslash -40
+KPX Adieresis Otilde -40
+KPX Adieresis Q -40
+KPX Adieresis T -90
+KPX Adieresis Tcaron -90
+KPX Adieresis Tcommaaccent -90
+KPX Adieresis U -50
+KPX Adieresis Uacute -50
+KPX Adieresis Ucircumflex -50
+KPX Adieresis Udieresis -50
+KPX Adieresis Ugrave -50
+KPX Adieresis Uhungarumlaut -50
+KPX Adieresis Umacron -50
+KPX Adieresis Uogonek -50
+KPX Adieresis Uring -50
+KPX Adieresis V -80
+KPX Adieresis W -60
+KPX Adieresis Y -110
+KPX Adieresis Yacute -110
+KPX Adieresis Ydieresis -110
+KPX Adieresis u -30
+KPX Adieresis uacute -30
+KPX Adieresis ucircumflex -30
+KPX Adieresis udieresis -30
+KPX Adieresis ugrave -30
+KPX Adieresis uhungarumlaut -30
+KPX Adieresis umacron -30
+KPX Adieresis uogonek -30
+KPX Adieresis uring -30
+KPX Adieresis v -40
+KPX Adieresis w -30
+KPX Adieresis y -30
+KPX Adieresis yacute -30
+KPX Adieresis ydieresis -30
+KPX Agrave C -40
+KPX Agrave Cacute -40
+KPX Agrave Ccaron -40
+KPX Agrave Ccedilla -40
+KPX Agrave G -50
+KPX Agrave Gbreve -50
+KPX Agrave Gcommaaccent -50
+KPX Agrave O -40
+KPX Agrave Oacute -40
+KPX Agrave Ocircumflex -40
+KPX Agrave Odieresis -40
+KPX Agrave Ograve -40
+KPX Agrave Ohungarumlaut -40
+KPX Agrave Omacron -40
+KPX Agrave Oslash -40
+KPX Agrave Otilde -40
+KPX Agrave Q -40
+KPX Agrave T -90
+KPX Agrave Tcaron -90
+KPX Agrave Tcommaaccent -90
+KPX Agrave U -50
+KPX Agrave Uacute -50
+KPX Agrave Ucircumflex -50
+KPX Agrave Udieresis -50
+KPX Agrave Ugrave -50
+KPX Agrave Uhungarumlaut -50
+KPX Agrave Umacron -50
+KPX Agrave Uogonek -50
+KPX Agrave Uring -50
+KPX Agrave V -80
+KPX Agrave W -60
+KPX Agrave Y -110
+KPX Agrave Yacute -110
+KPX Agrave Ydieresis -110
+KPX Agrave u -30
+KPX Agrave uacute -30
+KPX Agrave ucircumflex -30
+KPX Agrave udieresis -30
+KPX Agrave ugrave -30
+KPX Agrave uhungarumlaut -30
+KPX Agrave umacron -30
+KPX Agrave uogonek -30
+KPX Agrave uring -30
+KPX Agrave v -40
+KPX Agrave w -30
+KPX Agrave y -30
+KPX Agrave yacute -30
+KPX Agrave ydieresis -30
+KPX Amacron C -40
+KPX Amacron Cacute -40
+KPX Amacron Ccaron -40
+KPX Amacron Ccedilla -40
+KPX Amacron G -50
+KPX Amacron Gbreve -50
+KPX Amacron Gcommaaccent -50
+KPX Amacron O -40
+KPX Amacron Oacute -40
+KPX Amacron Ocircumflex -40
+KPX Amacron Odieresis -40
+KPX Amacron Ograve -40
+KPX Amacron Ohungarumlaut -40
+KPX Amacron Omacron -40
+KPX Amacron Oslash -40
+KPX Amacron Otilde -40
+KPX Amacron Q -40
+KPX Amacron T -90
+KPX Amacron Tcaron -90
+KPX Amacron Tcommaaccent -90
+KPX Amacron U -50
+KPX Amacron Uacute -50
+KPX Amacron Ucircumflex -50
+KPX Amacron Udieresis -50
+KPX Amacron Ugrave -50
+KPX Amacron Uhungarumlaut -50
+KPX Amacron Umacron -50
+KPX Amacron Uogonek -50
+KPX Amacron Uring -50
+KPX Amacron V -80
+KPX Amacron W -60
+KPX Amacron Y -110
+KPX Amacron Yacute -110
+KPX Amacron Ydieresis -110
+KPX Amacron u -30
+KPX Amacron uacute -30
+KPX Amacron ucircumflex -30
+KPX Amacron udieresis -30
+KPX Amacron ugrave -30
+KPX Amacron uhungarumlaut -30
+KPX Amacron umacron -30
+KPX Amacron uogonek -30
+KPX Amacron uring -30
+KPX Amacron v -40
+KPX Amacron w -30
+KPX Amacron y -30
+KPX Amacron yacute -30
+KPX Amacron ydieresis -30
+KPX Aogonek C -40
+KPX Aogonek Cacute -40
+KPX Aogonek Ccaron -40
+KPX Aogonek Ccedilla -40
+KPX Aogonek G -50
+KPX Aogonek Gbreve -50
+KPX Aogonek Gcommaaccent -50
+KPX Aogonek O -40
+KPX Aogonek Oacute -40
+KPX Aogonek Ocircumflex -40
+KPX Aogonek Odieresis -40
+KPX Aogonek Ograve -40
+KPX Aogonek Ohungarumlaut -40
+KPX Aogonek Omacron -40
+KPX Aogonek Oslash -40
+KPX Aogonek Otilde -40
+KPX Aogonek Q -40
+KPX Aogonek T -90
+KPX Aogonek Tcaron -90
+KPX Aogonek Tcommaaccent -90
+KPX Aogonek U -50
+KPX Aogonek Uacute -50
+KPX Aogonek Ucircumflex -50
+KPX Aogonek Udieresis -50
+KPX Aogonek Ugrave -50
+KPX Aogonek Uhungarumlaut -50
+KPX Aogonek Umacron -50
+KPX Aogonek Uogonek -50
+KPX Aogonek Uring -50
+KPX Aogonek V -80
+KPX Aogonek W -60
+KPX Aogonek Y -110
+KPX Aogonek Yacute -110
+KPX Aogonek Ydieresis -110
+KPX Aogonek u -30
+KPX Aogonek uacute -30
+KPX Aogonek ucircumflex -30
+KPX Aogonek udieresis -30
+KPX Aogonek ugrave -30
+KPX Aogonek uhungarumlaut -30
+KPX Aogonek umacron -30
+KPX Aogonek uogonek -30
+KPX Aogonek uring -30
+KPX Aogonek v -40
+KPX Aogonek w -30
+KPX Aogonek y -30
+KPX Aogonek yacute -30
+KPX Aogonek ydieresis -30
+KPX Aring C -40
+KPX Aring Cacute -40
+KPX Aring Ccaron -40
+KPX Aring Ccedilla -40
+KPX Aring G -50
+KPX Aring Gbreve -50
+KPX Aring Gcommaaccent -50
+KPX Aring O -40
+KPX Aring Oacute -40
+KPX Aring Ocircumflex -40
+KPX Aring Odieresis -40
+KPX Aring Ograve -40
+KPX Aring Ohungarumlaut -40
+KPX Aring Omacron -40
+KPX Aring Oslash -40
+KPX Aring Otilde -40
+KPX Aring Q -40
+KPX Aring T -90
+KPX Aring Tcaron -90
+KPX Aring Tcommaaccent -90
+KPX Aring U -50
+KPX Aring Uacute -50
+KPX Aring Ucircumflex -50
+KPX Aring Udieresis -50
+KPX Aring Ugrave -50
+KPX Aring Uhungarumlaut -50
+KPX Aring Umacron -50
+KPX Aring Uogonek -50
+KPX Aring Uring -50
+KPX Aring V -80
+KPX Aring W -60
+KPX Aring Y -110
+KPX Aring Yacute -110
+KPX Aring Ydieresis -110
+KPX Aring u -30
+KPX Aring uacute -30
+KPX Aring ucircumflex -30
+KPX Aring udieresis -30
+KPX Aring ugrave -30
+KPX Aring uhungarumlaut -30
+KPX Aring umacron -30
+KPX Aring uogonek -30
+KPX Aring uring -30
+KPX Aring v -40
+KPX Aring w -30
+KPX Aring y -30
+KPX Aring yacute -30
+KPX Aring ydieresis -30
+KPX Atilde C -40
+KPX Atilde Cacute -40
+KPX Atilde Ccaron -40
+KPX Atilde Ccedilla -40
+KPX Atilde G -50
+KPX Atilde Gbreve -50
+KPX Atilde Gcommaaccent -50
+KPX Atilde O -40
+KPX Atilde Oacute -40
+KPX Atilde Ocircumflex -40
+KPX Atilde Odieresis -40
+KPX Atilde Ograve -40
+KPX Atilde Ohungarumlaut -40
+KPX Atilde Omacron -40
+KPX Atilde Oslash -40
+KPX Atilde Otilde -40
+KPX Atilde Q -40
+KPX Atilde T -90
+KPX Atilde Tcaron -90
+KPX Atilde Tcommaaccent -90
+KPX Atilde U -50
+KPX Atilde Uacute -50
+KPX Atilde Ucircumflex -50
+KPX Atilde Udieresis -50
+KPX Atilde Ugrave -50
+KPX Atilde Uhungarumlaut -50
+KPX Atilde Umacron -50
+KPX Atilde Uogonek -50
+KPX Atilde Uring -50
+KPX Atilde V -80
+KPX Atilde W -60
+KPX Atilde Y -110
+KPX Atilde Yacute -110
+KPX Atilde Ydieresis -110
+KPX Atilde u -30
+KPX Atilde uacute -30
+KPX Atilde ucircumflex -30
+KPX Atilde udieresis -30
+KPX Atilde ugrave -30
+KPX Atilde uhungarumlaut -30
+KPX Atilde umacron -30
+KPX Atilde uogonek -30
+KPX Atilde uring -30
+KPX Atilde v -40
+KPX Atilde w -30
+KPX Atilde y -30
+KPX Atilde yacute -30
+KPX Atilde ydieresis -30
+KPX B A -30
+KPX B Aacute -30
+KPX B Abreve -30
+KPX B Acircumflex -30
+KPX B Adieresis -30
+KPX B Agrave -30
+KPX B Amacron -30
+KPX B Aogonek -30
+KPX B Aring -30
+KPX B Atilde -30
+KPX B U -10
+KPX B Uacute -10
+KPX B Ucircumflex -10
+KPX B Udieresis -10
+KPX B Ugrave -10
+KPX B Uhungarumlaut -10
+KPX B Umacron -10
+KPX B Uogonek -10
+KPX B Uring -10
+KPX D A -40
+KPX D Aacute -40
+KPX D Abreve -40
+KPX D Acircumflex -40
+KPX D Adieresis -40
+KPX D Agrave -40
+KPX D Amacron -40
+KPX D Aogonek -40
+KPX D Aring -40
+KPX D Atilde -40
+KPX D V -40
+KPX D W -40
+KPX D Y -70
+KPX D Yacute -70
+KPX D Ydieresis -70
+KPX D comma -30
+KPX D period -30
+KPX Dcaron A -40
+KPX Dcaron Aacute -40
+KPX Dcaron Abreve -40
+KPX Dcaron Acircumflex -40
+KPX Dcaron Adieresis -40
+KPX Dcaron Agrave -40
+KPX Dcaron Amacron -40
+KPX Dcaron Aogonek -40
+KPX Dcaron Aring -40
+KPX Dcaron Atilde -40
+KPX Dcaron V -40
+KPX Dcaron W -40
+KPX Dcaron Y -70
+KPX Dcaron Yacute -70
+KPX Dcaron Ydieresis -70
+KPX Dcaron comma -30
+KPX Dcaron period -30
+KPX Dcroat A -40
+KPX Dcroat Aacute -40
+KPX Dcroat Abreve -40
+KPX Dcroat Acircumflex -40
+KPX Dcroat Adieresis -40
+KPX Dcroat Agrave -40
+KPX Dcroat Amacron -40
+KPX Dcroat Aogonek -40
+KPX Dcroat Aring -40
+KPX Dcroat Atilde -40
+KPX Dcroat V -40
+KPX Dcroat W -40
+KPX Dcroat Y -70
+KPX Dcroat Yacute -70
+KPX Dcroat Ydieresis -70
+KPX Dcroat comma -30
+KPX Dcroat period -30
+KPX F A -80
+KPX F Aacute -80
+KPX F Abreve -80
+KPX F Acircumflex -80
+KPX F Adieresis -80
+KPX F Agrave -80
+KPX F Amacron -80
+KPX F Aogonek -80
+KPX F Aring -80
+KPX F Atilde -80
+KPX F a -20
+KPX F aacute -20
+KPX F abreve -20
+KPX F acircumflex -20
+KPX F adieresis -20
+KPX F agrave -20
+KPX F amacron -20
+KPX F aogonek -20
+KPX F aring -20
+KPX F atilde -20
+KPX F comma -100
+KPX F period -100
+KPX J A -20
+KPX J Aacute -20
+KPX J Abreve -20
+KPX J Acircumflex -20
+KPX J Adieresis -20
+KPX J Agrave -20
+KPX J Amacron -20
+KPX J Aogonek -20
+KPX J Aring -20
+KPX J Atilde -20
+KPX J comma -20
+KPX J period -20
+KPX J u -20
+KPX J uacute -20
+KPX J ucircumflex -20
+KPX J udieresis -20
+KPX J ugrave -20
+KPX J uhungarumlaut -20
+KPX J umacron -20
+KPX J uogonek -20
+KPX J uring -20
+KPX K O -30
+KPX K Oacute -30
+KPX K Ocircumflex -30
+KPX K Odieresis -30
+KPX K Ograve -30
+KPX K Ohungarumlaut -30
+KPX K Omacron -30
+KPX K Oslash -30
+KPX K Otilde -30
+KPX K e -15
+KPX K eacute -15
+KPX K ecaron -15
+KPX K ecircumflex -15
+KPX K edieresis -15
+KPX K edotaccent -15
+KPX K egrave -15
+KPX K emacron -15
+KPX K eogonek -15
+KPX K o -35
+KPX K oacute -35
+KPX K ocircumflex -35
+KPX K odieresis -35
+KPX K ograve -35
+KPX K ohungarumlaut -35
+KPX K omacron -35
+KPX K oslash -35
+KPX K otilde -35
+KPX K u -30
+KPX K uacute -30
+KPX K ucircumflex -30
+KPX K udieresis -30
+KPX K ugrave -30
+KPX K uhungarumlaut -30
+KPX K umacron -30
+KPX K uogonek -30
+KPX K uring -30
+KPX K y -40
+KPX K yacute -40
+KPX K ydieresis -40
+KPX Kcommaaccent O -30
+KPX Kcommaaccent Oacute -30
+KPX Kcommaaccent Ocircumflex -30
+KPX Kcommaaccent Odieresis -30
+KPX Kcommaaccent Ograve -30
+KPX Kcommaaccent Ohungarumlaut -30
+KPX Kcommaaccent Omacron -30
+KPX Kcommaaccent Oslash -30
+KPX Kcommaaccent Otilde -30
+KPX Kcommaaccent e -15
+KPX Kcommaaccent eacute -15
+KPX Kcommaaccent ecaron -15
+KPX Kcommaaccent ecircumflex -15
+KPX Kcommaaccent edieresis -15
+KPX Kcommaaccent edotaccent -15
+KPX Kcommaaccent egrave -15
+KPX Kcommaaccent emacron -15
+KPX Kcommaaccent eogonek -15
+KPX Kcommaaccent o -35
+KPX Kcommaaccent oacute -35
+KPX Kcommaaccent ocircumflex -35
+KPX Kcommaaccent odieresis -35
+KPX Kcommaaccent ograve -35
+KPX Kcommaaccent ohungarumlaut -35
+KPX Kcommaaccent omacron -35
+KPX Kcommaaccent oslash -35
+KPX Kcommaaccent otilde -35
+KPX Kcommaaccent u -30
+KPX Kcommaaccent uacute -30
+KPX Kcommaaccent ucircumflex -30
+KPX Kcommaaccent udieresis -30
+KPX Kcommaaccent ugrave -30
+KPX Kcommaaccent uhungarumlaut -30
+KPX Kcommaaccent umacron -30
+KPX Kcommaaccent uogonek -30
+KPX Kcommaaccent uring -30
+KPX Kcommaaccent y -40
+KPX Kcommaaccent yacute -40
+KPX Kcommaaccent ydieresis -40
+KPX L T -90
+KPX L Tcaron -90
+KPX L Tcommaaccent -90
+KPX L V -110
+KPX L W -80
+KPX L Y -120
+KPX L Yacute -120
+KPX L Ydieresis -120
+KPX L quotedblright -140
+KPX L quoteright -140
+KPX L y -30
+KPX L yacute -30
+KPX L ydieresis -30
+KPX Lacute T -90
+KPX Lacute Tcaron -90
+KPX Lacute Tcommaaccent -90
+KPX Lacute V -110
+KPX Lacute W -80
+KPX Lacute Y -120
+KPX Lacute Yacute -120
+KPX Lacute Ydieresis -120
+KPX Lacute quotedblright -140
+KPX Lacute quoteright -140
+KPX Lacute y -30
+KPX Lacute yacute -30
+KPX Lacute ydieresis -30
+KPX Lcommaaccent T -90
+KPX Lcommaaccent Tcaron -90
+KPX Lcommaaccent Tcommaaccent -90
+KPX Lcommaaccent V -110
+KPX Lcommaaccent W -80
+KPX Lcommaaccent Y -120
+KPX Lcommaaccent Yacute -120
+KPX Lcommaaccent Ydieresis -120
+KPX Lcommaaccent quotedblright -140
+KPX Lcommaaccent quoteright -140
+KPX Lcommaaccent y -30
+KPX Lcommaaccent yacute -30
+KPX Lcommaaccent ydieresis -30
+KPX Lslash T -90
+KPX Lslash Tcaron -90
+KPX Lslash Tcommaaccent -90
+KPX Lslash V -110
+KPX Lslash W -80
+KPX Lslash Y -120
+KPX Lslash Yacute -120
+KPX Lslash Ydieresis -120
+KPX Lslash quotedblright -140
+KPX Lslash quoteright -140
+KPX Lslash y -30
+KPX Lslash yacute -30
+KPX Lslash ydieresis -30
+KPX O A -50
+KPX O Aacute -50
+KPX O Abreve -50
+KPX O Acircumflex -50
+KPX O Adieresis -50
+KPX O Agrave -50
+KPX O Amacron -50
+KPX O Aogonek -50
+KPX O Aring -50
+KPX O Atilde -50
+KPX O T -40
+KPX O Tcaron -40
+KPX O Tcommaaccent -40
+KPX O V -50
+KPX O W -50
+KPX O X -50
+KPX O Y -70
+KPX O Yacute -70
+KPX O Ydieresis -70
+KPX O comma -40
+KPX O period -40
+KPX Oacute A -50
+KPX Oacute Aacute -50
+KPX Oacute Abreve -50
+KPX Oacute Acircumflex -50
+KPX Oacute Adieresis -50
+KPX Oacute Agrave -50
+KPX Oacute Amacron -50
+KPX Oacute Aogonek -50
+KPX Oacute Aring -50
+KPX Oacute Atilde -50
+KPX Oacute T -40
+KPX Oacute Tcaron -40
+KPX Oacute Tcommaaccent -40
+KPX Oacute V -50
+KPX Oacute W -50
+KPX Oacute X -50
+KPX Oacute Y -70
+KPX Oacute Yacute -70
+KPX Oacute Ydieresis -70
+KPX Oacute comma -40
+KPX Oacute period -40
+KPX Ocircumflex A -50
+KPX Ocircumflex Aacute -50
+KPX Ocircumflex Abreve -50
+KPX Ocircumflex Acircumflex -50
+KPX Ocircumflex Adieresis -50
+KPX Ocircumflex Agrave -50
+KPX Ocircumflex Amacron -50
+KPX Ocircumflex Aogonek -50
+KPX Ocircumflex Aring -50
+KPX Ocircumflex Atilde -50
+KPX Ocircumflex T -40
+KPX Ocircumflex Tcaron -40
+KPX Ocircumflex Tcommaaccent -40
+KPX Ocircumflex V -50
+KPX Ocircumflex W -50
+KPX Ocircumflex X -50
+KPX Ocircumflex Y -70
+KPX Ocircumflex Yacute -70
+KPX Ocircumflex Ydieresis -70
+KPX Ocircumflex comma -40
+KPX Ocircumflex period -40
+KPX Odieresis A -50
+KPX Odieresis Aacute -50
+KPX Odieresis Abreve -50
+KPX Odieresis Acircumflex -50
+KPX Odieresis Adieresis -50
+KPX Odieresis Agrave -50
+KPX Odieresis Amacron -50
+KPX Odieresis Aogonek -50
+KPX Odieresis Aring -50
+KPX Odieresis Atilde -50
+KPX Odieresis T -40
+KPX Odieresis Tcaron -40
+KPX Odieresis Tcommaaccent -40
+KPX Odieresis V -50
+KPX Odieresis W -50
+KPX Odieresis X -50
+KPX Odieresis Y -70
+KPX Odieresis Yacute -70
+KPX Odieresis Ydieresis -70
+KPX Odieresis comma -40
+KPX Odieresis period -40
+KPX Ograve A -50
+KPX Ograve Aacute -50
+KPX Ograve Abreve -50
+KPX Ograve Acircumflex -50
+KPX Ograve Adieresis -50
+KPX Ograve Agrave -50
+KPX Ograve Amacron -50
+KPX Ograve Aogonek -50
+KPX Ograve Aring -50
+KPX Ograve Atilde -50
+KPX Ograve T -40
+KPX Ograve Tcaron -40
+KPX Ograve Tcommaaccent -40
+KPX Ograve V -50
+KPX Ograve W -50
+KPX Ograve X -50
+KPX Ograve Y -70
+KPX Ograve Yacute -70
+KPX Ograve Ydieresis -70
+KPX Ograve comma -40
+KPX Ograve period -40
+KPX Ohungarumlaut A -50
+KPX Ohungarumlaut Aacute -50
+KPX Ohungarumlaut Abreve -50
+KPX Ohungarumlaut Acircumflex -50
+KPX Ohungarumlaut Adieresis -50
+KPX Ohungarumlaut Agrave -50
+KPX Ohungarumlaut Amacron -50
+KPX Ohungarumlaut Aogonek -50
+KPX Ohungarumlaut Aring -50
+KPX Ohungarumlaut Atilde -50
+KPX Ohungarumlaut T -40
+KPX Ohungarumlaut Tcaron -40
+KPX Ohungarumlaut Tcommaaccent -40
+KPX Ohungarumlaut V -50
+KPX Ohungarumlaut W -50
+KPX Ohungarumlaut X -50
+KPX Ohungarumlaut Y -70
+KPX Ohungarumlaut Yacute -70
+KPX Ohungarumlaut Ydieresis -70
+KPX Ohungarumlaut comma -40
+KPX Ohungarumlaut period -40
+KPX Omacron A -50
+KPX Omacron Aacute -50
+KPX Omacron Abreve -50
+KPX Omacron Acircumflex -50
+KPX Omacron Adieresis -50
+KPX Omacron Agrave -50
+KPX Omacron Amacron -50
+KPX Omacron Aogonek -50
+KPX Omacron Aring -50
+KPX Omacron Atilde -50
+KPX Omacron T -40
+KPX Omacron Tcaron -40
+KPX Omacron Tcommaaccent -40
+KPX Omacron V -50
+KPX Omacron W -50
+KPX Omacron X -50
+KPX Omacron Y -70
+KPX Omacron Yacute -70
+KPX Omacron Ydieresis -70
+KPX Omacron comma -40
+KPX Omacron period -40
+KPX Oslash A -50
+KPX Oslash Aacute -50
+KPX Oslash Abreve -50
+KPX Oslash Acircumflex -50
+KPX Oslash Adieresis -50
+KPX Oslash Agrave -50
+KPX Oslash Amacron -50
+KPX Oslash Aogonek -50
+KPX Oslash Aring -50
+KPX Oslash Atilde -50
+KPX Oslash T -40
+KPX Oslash Tcaron -40
+KPX Oslash Tcommaaccent -40
+KPX Oslash V -50
+KPX Oslash W -50
+KPX Oslash X -50
+KPX Oslash Y -70
+KPX Oslash Yacute -70
+KPX Oslash Ydieresis -70
+KPX Oslash comma -40
+KPX Oslash period -40
+KPX Otilde A -50
+KPX Otilde Aacute -50
+KPX Otilde Abreve -50
+KPX Otilde Acircumflex -50
+KPX Otilde Adieresis -50
+KPX Otilde Agrave -50
+KPX Otilde Amacron -50
+KPX Otilde Aogonek -50
+KPX Otilde Aring -50
+KPX Otilde Atilde -50
+KPX Otilde T -40
+KPX Otilde Tcaron -40
+KPX Otilde Tcommaaccent -40
+KPX Otilde V -50
+KPX Otilde W -50
+KPX Otilde X -50
+KPX Otilde Y -70
+KPX Otilde Yacute -70
+KPX Otilde Ydieresis -70
+KPX Otilde comma -40
+KPX Otilde period -40
+KPX P A -100
+KPX P Aacute -100
+KPX P Abreve -100
+KPX P Acircumflex -100
+KPX P Adieresis -100
+KPX P Agrave -100
+KPX P Amacron -100
+KPX P Aogonek -100
+KPX P Aring -100
+KPX P Atilde -100
+KPX P a -30
+KPX P aacute -30
+KPX P abreve -30
+KPX P acircumflex -30
+KPX P adieresis -30
+KPX P agrave -30
+KPX P amacron -30
+KPX P aogonek -30
+KPX P aring -30
+KPX P atilde -30
+KPX P comma -120
+KPX P e -30
+KPX P eacute -30
+KPX P ecaron -30
+KPX P ecircumflex -30
+KPX P edieresis -30
+KPX P edotaccent -30
+KPX P egrave -30
+KPX P emacron -30
+KPX P eogonek -30
+KPX P o -40
+KPX P oacute -40
+KPX P ocircumflex -40
+KPX P odieresis -40
+KPX P ograve -40
+KPX P ohungarumlaut -40
+KPX P omacron -40
+KPX P oslash -40
+KPX P otilde -40
+KPX P period -120
+KPX Q U -10
+KPX Q Uacute -10
+KPX Q Ucircumflex -10
+KPX Q Udieresis -10
+KPX Q Ugrave -10
+KPX Q Uhungarumlaut -10
+KPX Q Umacron -10
+KPX Q Uogonek -10
+KPX Q Uring -10
+KPX Q comma 20
+KPX Q period 20
+KPX R O -20
+KPX R Oacute -20
+KPX R Ocircumflex -20
+KPX R Odieresis -20
+KPX R Ograve -20
+KPX R Ohungarumlaut -20
+KPX R Omacron -20
+KPX R Oslash -20
+KPX R Otilde -20
+KPX R T -20
+KPX R Tcaron -20
+KPX R Tcommaaccent -20
+KPX R U -20
+KPX R Uacute -20
+KPX R Ucircumflex -20
+KPX R Udieresis -20
+KPX R Ugrave -20
+KPX R Uhungarumlaut -20
+KPX R Umacron -20
+KPX R Uogonek -20
+KPX R Uring -20
+KPX R V -50
+KPX R W -40
+KPX R Y -50
+KPX R Yacute -50
+KPX R Ydieresis -50
+KPX Racute O -20
+KPX Racute Oacute -20
+KPX Racute Ocircumflex -20
+KPX Racute Odieresis -20
+KPX Racute Ograve -20
+KPX Racute Ohungarumlaut -20
+KPX Racute Omacron -20
+KPX Racute Oslash -20
+KPX Racute Otilde -20
+KPX Racute T -20
+KPX Racute Tcaron -20
+KPX Racute Tcommaaccent -20
+KPX Racute U -20
+KPX Racute Uacute -20
+KPX Racute Ucircumflex -20
+KPX Racute Udieresis -20
+KPX Racute Ugrave -20
+KPX Racute Uhungarumlaut -20
+KPX Racute Umacron -20
+KPX Racute Uogonek -20
+KPX Racute Uring -20
+KPX Racute V -50
+KPX Racute W -40
+KPX Racute Y -50
+KPX Racute Yacute -50
+KPX Racute Ydieresis -50
+KPX Rcaron O -20
+KPX Rcaron Oacute -20
+KPX Rcaron Ocircumflex -20
+KPX Rcaron Odieresis -20
+KPX Rcaron Ograve -20
+KPX Rcaron Ohungarumlaut -20
+KPX Rcaron Omacron -20
+KPX Rcaron Oslash -20
+KPX Rcaron Otilde -20
+KPX Rcaron T -20
+KPX Rcaron Tcaron -20
+KPX Rcaron Tcommaaccent -20
+KPX Rcaron U -20
+KPX Rcaron Uacute -20
+KPX Rcaron Ucircumflex -20
+KPX Rcaron Udieresis -20
+KPX Rcaron Ugrave -20
+KPX Rcaron Uhungarumlaut -20
+KPX Rcaron Umacron -20
+KPX Rcaron Uogonek -20
+KPX Rcaron Uring -20
+KPX Rcaron V -50
+KPX Rcaron W -40
+KPX Rcaron Y -50
+KPX Rcaron Yacute -50
+KPX Rcaron Ydieresis -50
+KPX Rcommaaccent O -20
+KPX Rcommaaccent Oacute -20
+KPX Rcommaaccent Ocircumflex -20
+KPX Rcommaaccent Odieresis -20
+KPX Rcommaaccent Ograve -20
+KPX Rcommaaccent Ohungarumlaut -20
+KPX Rcommaaccent Omacron -20
+KPX Rcommaaccent Oslash -20
+KPX Rcommaaccent Otilde -20
+KPX Rcommaaccent T -20
+KPX Rcommaaccent Tcaron -20
+KPX Rcommaaccent Tcommaaccent -20
+KPX Rcommaaccent U -20
+KPX Rcommaaccent Uacute -20
+KPX Rcommaaccent Ucircumflex -20
+KPX Rcommaaccent Udieresis -20
+KPX Rcommaaccent Ugrave -20
+KPX Rcommaaccent Uhungarumlaut -20
+KPX Rcommaaccent Umacron -20
+KPX Rcommaaccent Uogonek -20
+KPX Rcommaaccent Uring -20
+KPX Rcommaaccent V -50
+KPX Rcommaaccent W -40
+KPX Rcommaaccent Y -50
+KPX Rcommaaccent Yacute -50
+KPX Rcommaaccent Ydieresis -50
+KPX T A -90
+KPX T Aacute -90
+KPX T Abreve -90
+KPX T Acircumflex -90
+KPX T Adieresis -90
+KPX T Agrave -90
+KPX T Amacron -90
+KPX T Aogonek -90
+KPX T Aring -90
+KPX T Atilde -90
+KPX T O -40
+KPX T Oacute -40
+KPX T Ocircumflex -40
+KPX T Odieresis -40
+KPX T Ograve -40
+KPX T Ohungarumlaut -40
+KPX T Omacron -40
+KPX T Oslash -40
+KPX T Otilde -40
+KPX T a -80
+KPX T aacute -80
+KPX T abreve -80
+KPX T acircumflex -80
+KPX T adieresis -80
+KPX T agrave -80
+KPX T amacron -80
+KPX T aogonek -80
+KPX T aring -80
+KPX T atilde -80
+KPX T colon -40
+KPX T comma -80
+KPX T e -60
+KPX T eacute -60
+KPX T ecaron -60
+KPX T ecircumflex -60
+KPX T edieresis -60
+KPX T edotaccent -60
+KPX T egrave -60
+KPX T emacron -60
+KPX T eogonek -60
+KPX T hyphen -120
+KPX T o -80
+KPX T oacute -80
+KPX T ocircumflex -80
+KPX T odieresis -80
+KPX T ograve -80
+KPX T ohungarumlaut -80
+KPX T omacron -80
+KPX T oslash -80
+KPX T otilde -80
+KPX T period -80
+KPX T r -80
+KPX T racute -80
+KPX T rcommaaccent -80
+KPX T semicolon -40
+KPX T u -90
+KPX T uacute -90
+KPX T ucircumflex -90
+KPX T udieresis -90
+KPX T ugrave -90
+KPX T uhungarumlaut -90
+KPX T umacron -90
+KPX T uogonek -90
+KPX T uring -90
+KPX T w -60
+KPX T y -60
+KPX T yacute -60
+KPX T ydieresis -60
+KPX Tcaron A -90
+KPX Tcaron Aacute -90
+KPX Tcaron Abreve -90
+KPX Tcaron Acircumflex -90
+KPX Tcaron Adieresis -90
+KPX Tcaron Agrave -90
+KPX Tcaron Amacron -90
+KPX Tcaron Aogonek -90
+KPX Tcaron Aring -90
+KPX Tcaron Atilde -90
+KPX Tcaron O -40
+KPX Tcaron Oacute -40
+KPX Tcaron Ocircumflex -40
+KPX Tcaron Odieresis -40
+KPX Tcaron Ograve -40
+KPX Tcaron Ohungarumlaut -40
+KPX Tcaron Omacron -40
+KPX Tcaron Oslash -40
+KPX Tcaron Otilde -40
+KPX Tcaron a -80
+KPX Tcaron aacute -80
+KPX Tcaron abreve -80
+KPX Tcaron acircumflex -80
+KPX Tcaron adieresis -80
+KPX Tcaron agrave -80
+KPX Tcaron amacron -80
+KPX Tcaron aogonek -80
+KPX Tcaron aring -80
+KPX Tcaron atilde -80
+KPX Tcaron colon -40
+KPX Tcaron comma -80
+KPX Tcaron e -60
+KPX Tcaron eacute -60
+KPX Tcaron ecaron -60
+KPX Tcaron ecircumflex -60
+KPX Tcaron edieresis -60
+KPX Tcaron edotaccent -60
+KPX Tcaron egrave -60
+KPX Tcaron emacron -60
+KPX Tcaron eogonek -60
+KPX Tcaron hyphen -120
+KPX Tcaron o -80
+KPX Tcaron oacute -80
+KPX Tcaron ocircumflex -80
+KPX Tcaron odieresis -80
+KPX Tcaron ograve -80
+KPX Tcaron ohungarumlaut -80
+KPX Tcaron omacron -80
+KPX Tcaron oslash -80
+KPX Tcaron otilde -80
+KPX Tcaron period -80
+KPX Tcaron r -80
+KPX Tcaron racute -80
+KPX Tcaron rcommaaccent -80
+KPX Tcaron semicolon -40
+KPX Tcaron u -90
+KPX Tcaron uacute -90
+KPX Tcaron ucircumflex -90
+KPX Tcaron udieresis -90
+KPX Tcaron ugrave -90
+KPX Tcaron uhungarumlaut -90
+KPX Tcaron umacron -90
+KPX Tcaron uogonek -90
+KPX Tcaron uring -90
+KPX Tcaron w -60
+KPX Tcaron y -60
+KPX Tcaron yacute -60
+KPX Tcaron ydieresis -60
+KPX Tcommaaccent A -90
+KPX Tcommaaccent Aacute -90
+KPX Tcommaaccent Abreve -90
+KPX Tcommaaccent Acircumflex -90
+KPX Tcommaaccent Adieresis -90
+KPX Tcommaaccent Agrave -90
+KPX Tcommaaccent Amacron -90
+KPX Tcommaaccent Aogonek -90
+KPX Tcommaaccent Aring -90
+KPX Tcommaaccent Atilde -90
+KPX Tcommaaccent O -40
+KPX Tcommaaccent Oacute -40
+KPX Tcommaaccent Ocircumflex -40
+KPX Tcommaaccent Odieresis -40
+KPX Tcommaaccent Ograve -40
+KPX Tcommaaccent Ohungarumlaut -40
+KPX Tcommaaccent Omacron -40
+KPX Tcommaaccent Oslash -40
+KPX Tcommaaccent Otilde -40
+KPX Tcommaaccent a -80
+KPX Tcommaaccent aacute -80
+KPX Tcommaaccent abreve -80
+KPX Tcommaaccent acircumflex -80
+KPX Tcommaaccent adieresis -80
+KPX Tcommaaccent agrave -80
+KPX Tcommaaccent amacron -80
+KPX Tcommaaccent aogonek -80
+KPX Tcommaaccent aring -80
+KPX Tcommaaccent atilde -80
+KPX Tcommaaccent colon -40
+KPX Tcommaaccent comma -80
+KPX Tcommaaccent e -60
+KPX Tcommaaccent eacute -60
+KPX Tcommaaccent ecaron -60
+KPX Tcommaaccent ecircumflex -60
+KPX Tcommaaccent edieresis -60
+KPX Tcommaaccent edotaccent -60
+KPX Tcommaaccent egrave -60
+KPX Tcommaaccent emacron -60
+KPX Tcommaaccent eogonek -60
+KPX Tcommaaccent hyphen -120
+KPX Tcommaaccent o -80
+KPX Tcommaaccent oacute -80
+KPX Tcommaaccent ocircumflex -80
+KPX Tcommaaccent odieresis -80
+KPX Tcommaaccent ograve -80
+KPX Tcommaaccent ohungarumlaut -80
+KPX Tcommaaccent omacron -80
+KPX Tcommaaccent oslash -80
+KPX Tcommaaccent otilde -80
+KPX Tcommaaccent period -80
+KPX Tcommaaccent r -80
+KPX Tcommaaccent racute -80
+KPX Tcommaaccent rcommaaccent -80
+KPX Tcommaaccent semicolon -40
+KPX Tcommaaccent u -90
+KPX Tcommaaccent uacute -90
+KPX Tcommaaccent ucircumflex -90
+KPX Tcommaaccent udieresis -90
+KPX Tcommaaccent ugrave -90
+KPX Tcommaaccent uhungarumlaut -90
+KPX Tcommaaccent umacron -90
+KPX Tcommaaccent uogonek -90
+KPX Tcommaaccent uring -90
+KPX Tcommaaccent w -60
+KPX Tcommaaccent y -60
+KPX Tcommaaccent yacute -60
+KPX Tcommaaccent ydieresis -60
+KPX U A -50
+KPX U Aacute -50
+KPX U Abreve -50
+KPX U Acircumflex -50
+KPX U Adieresis -50
+KPX U Agrave -50
+KPX U Amacron -50
+KPX U Aogonek -50
+KPX U Aring -50
+KPX U Atilde -50
+KPX U comma -30
+KPX U period -30
+KPX Uacute A -50
+KPX Uacute Aacute -50
+KPX Uacute Abreve -50
+KPX Uacute Acircumflex -50
+KPX Uacute Adieresis -50
+KPX Uacute Agrave -50
+KPX Uacute Amacron -50
+KPX Uacute Aogonek -50
+KPX Uacute Aring -50
+KPX Uacute Atilde -50
+KPX Uacute comma -30
+KPX Uacute period -30
+KPX Ucircumflex A -50
+KPX Ucircumflex Aacute -50
+KPX Ucircumflex Abreve -50
+KPX Ucircumflex Acircumflex -50
+KPX Ucircumflex Adieresis -50
+KPX Ucircumflex Agrave -50
+KPX Ucircumflex Amacron -50
+KPX Ucircumflex Aogonek -50
+KPX Ucircumflex Aring -50
+KPX Ucircumflex Atilde -50
+KPX Ucircumflex comma -30
+KPX Ucircumflex period -30
+KPX Udieresis A -50
+KPX Udieresis Aacute -50
+KPX Udieresis Abreve -50
+KPX Udieresis Acircumflex -50
+KPX Udieresis Adieresis -50
+KPX Udieresis Agrave -50
+KPX Udieresis Amacron -50
+KPX Udieresis Aogonek -50
+KPX Udieresis Aring -50
+KPX Udieresis Atilde -50
+KPX Udieresis comma -30
+KPX Udieresis period -30
+KPX Ugrave A -50
+KPX Ugrave Aacute -50
+KPX Ugrave Abreve -50
+KPX Ugrave Acircumflex -50
+KPX Ugrave Adieresis -50
+KPX Ugrave Agrave -50
+KPX Ugrave Amacron -50
+KPX Ugrave Aogonek -50
+KPX Ugrave Aring -50
+KPX Ugrave Atilde -50
+KPX Ugrave comma -30
+KPX Ugrave period -30
+KPX Uhungarumlaut A -50
+KPX Uhungarumlaut Aacute -50
+KPX Uhungarumlaut Abreve -50
+KPX Uhungarumlaut Acircumflex -50
+KPX Uhungarumlaut Adieresis -50
+KPX Uhungarumlaut Agrave -50
+KPX Uhungarumlaut Amacron -50
+KPX Uhungarumlaut Aogonek -50
+KPX Uhungarumlaut Aring -50
+KPX Uhungarumlaut Atilde -50
+KPX Uhungarumlaut comma -30
+KPX Uhungarumlaut period -30
+KPX Umacron A -50
+KPX Umacron Aacute -50
+KPX Umacron Abreve -50
+KPX Umacron Acircumflex -50
+KPX Umacron Adieresis -50
+KPX Umacron Agrave -50
+KPX Umacron Amacron -50
+KPX Umacron Aogonek -50
+KPX Umacron Aring -50
+KPX Umacron Atilde -50
+KPX Umacron comma -30
+KPX Umacron period -30
+KPX Uogonek A -50
+KPX Uogonek Aacute -50
+KPX Uogonek Abreve -50
+KPX Uogonek Acircumflex -50
+KPX Uogonek Adieresis -50
+KPX Uogonek Agrave -50
+KPX Uogonek Amacron -50
+KPX Uogonek Aogonek -50
+KPX Uogonek Aring -50
+KPX Uogonek Atilde -50
+KPX Uogonek comma -30
+KPX Uogonek period -30
+KPX Uring A -50
+KPX Uring Aacute -50
+KPX Uring Abreve -50
+KPX Uring Acircumflex -50
+KPX Uring Adieresis -50
+KPX Uring Agrave -50
+KPX Uring Amacron -50
+KPX Uring Aogonek -50
+KPX Uring Aring -50
+KPX Uring Atilde -50
+KPX Uring comma -30
+KPX Uring period -30
+KPX V A -80
+KPX V Aacute -80
+KPX V Abreve -80
+KPX V Acircumflex -80
+KPX V Adieresis -80
+KPX V Agrave -80
+KPX V Amacron -80
+KPX V Aogonek -80
+KPX V Aring -80
+KPX V Atilde -80
+KPX V G -50
+KPX V Gbreve -50
+KPX V Gcommaaccent -50
+KPX V O -50
+KPX V Oacute -50
+KPX V Ocircumflex -50
+KPX V Odieresis -50
+KPX V Ograve -50
+KPX V Ohungarumlaut -50
+KPX V Omacron -50
+KPX V Oslash -50
+KPX V Otilde -50
+KPX V a -60
+KPX V aacute -60
+KPX V abreve -60
+KPX V acircumflex -60
+KPX V adieresis -60
+KPX V agrave -60
+KPX V amacron -60
+KPX V aogonek -60
+KPX V aring -60
+KPX V atilde -60
+KPX V colon -40
+KPX V comma -120
+KPX V e -50
+KPX V eacute -50
+KPX V ecaron -50
+KPX V ecircumflex -50
+KPX V edieresis -50
+KPX V edotaccent -50
+KPX V egrave -50
+KPX V emacron -50
+KPX V eogonek -50
+KPX V hyphen -80
+KPX V o -90
+KPX V oacute -90
+KPX V ocircumflex -90
+KPX V odieresis -90
+KPX V ograve -90
+KPX V ohungarumlaut -90
+KPX V omacron -90
+KPX V oslash -90
+KPX V otilde -90
+KPX V period -120
+KPX V semicolon -40
+KPX V u -60
+KPX V uacute -60
+KPX V ucircumflex -60
+KPX V udieresis -60
+KPX V ugrave -60
+KPX V uhungarumlaut -60
+KPX V umacron -60
+KPX V uogonek -60
+KPX V uring -60
+KPX W A -60
+KPX W Aacute -60
+KPX W Abreve -60
+KPX W Acircumflex -60
+KPX W Adieresis -60
+KPX W Agrave -60
+KPX W Amacron -60
+KPX W Aogonek -60
+KPX W Aring -60
+KPX W Atilde -60
+KPX W O -20
+KPX W Oacute -20
+KPX W Ocircumflex -20
+KPX W Odieresis -20
+KPX W Ograve -20
+KPX W Ohungarumlaut -20
+KPX W Omacron -20
+KPX W Oslash -20
+KPX W Otilde -20
+KPX W a -40
+KPX W aacute -40
+KPX W abreve -40
+KPX W acircumflex -40
+KPX W adieresis -40
+KPX W agrave -40
+KPX W amacron -40
+KPX W aogonek -40
+KPX W aring -40
+KPX W atilde -40
+KPX W colon -10
+KPX W comma -80
+KPX W e -35
+KPX W eacute -35
+KPX W ecaron -35
+KPX W ecircumflex -35
+KPX W edieresis -35
+KPX W edotaccent -35
+KPX W egrave -35
+KPX W emacron -35
+KPX W eogonek -35
+KPX W hyphen -40
+KPX W o -60
+KPX W oacute -60
+KPX W ocircumflex -60
+KPX W odieresis -60
+KPX W ograve -60
+KPX W ohungarumlaut -60
+KPX W omacron -60
+KPX W oslash -60
+KPX W otilde -60
+KPX W period -80
+KPX W semicolon -10
+KPX W u -45
+KPX W uacute -45
+KPX W ucircumflex -45
+KPX W udieresis -45
+KPX W ugrave -45
+KPX W uhungarumlaut -45
+KPX W umacron -45
+KPX W uogonek -45
+KPX W uring -45
+KPX W y -20
+KPX W yacute -20
+KPX W ydieresis -20
+KPX Y A -110
+KPX Y Aacute -110
+KPX Y Abreve -110
+KPX Y Acircumflex -110
+KPX Y Adieresis -110
+KPX Y Agrave -110
+KPX Y Amacron -110
+KPX Y Aogonek -110
+KPX Y Aring -110
+KPX Y Atilde -110
+KPX Y O -70
+KPX Y Oacute -70
+KPX Y Ocircumflex -70
+KPX Y Odieresis -70
+KPX Y Ograve -70
+KPX Y Ohungarumlaut -70
+KPX Y Omacron -70
+KPX Y Oslash -70
+KPX Y Otilde -70
+KPX Y a -90
+KPX Y aacute -90
+KPX Y abreve -90
+KPX Y acircumflex -90
+KPX Y adieresis -90
+KPX Y agrave -90
+KPX Y amacron -90
+KPX Y aogonek -90
+KPX Y aring -90
+KPX Y atilde -90
+KPX Y colon -50
+KPX Y comma -100
+KPX Y e -80
+KPX Y eacute -80
+KPX Y ecaron -80
+KPX Y ecircumflex -80
+KPX Y edieresis -80
+KPX Y edotaccent -80
+KPX Y egrave -80
+KPX Y emacron -80
+KPX Y eogonek -80
+KPX Y o -100
+KPX Y oacute -100
+KPX Y ocircumflex -100
+KPX Y odieresis -100
+KPX Y ograve -100
+KPX Y ohungarumlaut -100
+KPX Y omacron -100
+KPX Y oslash -100
+KPX Y otilde -100
+KPX Y period -100
+KPX Y semicolon -50
+KPX Y u -100
+KPX Y uacute -100
+KPX Y ucircumflex -100
+KPX Y udieresis -100
+KPX Y ugrave -100
+KPX Y uhungarumlaut -100
+KPX Y umacron -100
+KPX Y uogonek -100
+KPX Y uring -100
+KPX Yacute A -110
+KPX Yacute Aacute -110
+KPX Yacute Abreve -110
+KPX Yacute Acircumflex -110
+KPX Yacute Adieresis -110
+KPX Yacute Agrave -110
+KPX Yacute Amacron -110
+KPX Yacute Aogonek -110
+KPX Yacute Aring -110
+KPX Yacute Atilde -110
+KPX Yacute O -70
+KPX Yacute Oacute -70
+KPX Yacute Ocircumflex -70
+KPX Yacute Odieresis -70
+KPX Yacute Ograve -70
+KPX Yacute Ohungarumlaut -70
+KPX Yacute Omacron -70
+KPX Yacute Oslash -70
+KPX Yacute Otilde -70
+KPX Yacute a -90
+KPX Yacute aacute -90
+KPX Yacute abreve -90
+KPX Yacute acircumflex -90
+KPX Yacute adieresis -90
+KPX Yacute agrave -90
+KPX Yacute amacron -90
+KPX Yacute aogonek -90
+KPX Yacute aring -90
+KPX Yacute atilde -90
+KPX Yacute colon -50
+KPX Yacute comma -100
+KPX Yacute e -80
+KPX Yacute eacute -80
+KPX Yacute ecaron -80
+KPX Yacute ecircumflex -80
+KPX Yacute edieresis -80
+KPX Yacute edotaccent -80
+KPX Yacute egrave -80
+KPX Yacute emacron -80
+KPX Yacute eogonek -80
+KPX Yacute o -100
+KPX Yacute oacute -100
+KPX Yacute ocircumflex -100
+KPX Yacute odieresis -100
+KPX Yacute ograve -100
+KPX Yacute ohungarumlaut -100
+KPX Yacute omacron -100
+KPX Yacute oslash -100
+KPX Yacute otilde -100
+KPX Yacute period -100
+KPX Yacute semicolon -50
+KPX Yacute u -100
+KPX Yacute uacute -100
+KPX Yacute ucircumflex -100
+KPX Yacute udieresis -100
+KPX Yacute ugrave -100
+KPX Yacute uhungarumlaut -100
+KPX Yacute umacron -100
+KPX Yacute uogonek -100
+KPX Yacute uring -100
+KPX Ydieresis A -110
+KPX Ydieresis Aacute -110
+KPX Ydieresis Abreve -110
+KPX Ydieresis Acircumflex -110
+KPX Ydieresis Adieresis -110
+KPX Ydieresis Agrave -110
+KPX Ydieresis Amacron -110
+KPX Ydieresis Aogonek -110
+KPX Ydieresis Aring -110
+KPX Ydieresis Atilde -110
+KPX Ydieresis O -70
+KPX Ydieresis Oacute -70
+KPX Ydieresis Ocircumflex -70
+KPX Ydieresis Odieresis -70
+KPX Ydieresis Ograve -70
+KPX Ydieresis Ohungarumlaut -70
+KPX Ydieresis Omacron -70
+KPX Ydieresis Oslash -70
+KPX Ydieresis Otilde -70
+KPX Ydieresis a -90
+KPX Ydieresis aacute -90
+KPX Ydieresis abreve -90
+KPX Ydieresis acircumflex -90
+KPX Ydieresis adieresis -90
+KPX Ydieresis agrave -90
+KPX Ydieresis amacron -90
+KPX Ydieresis aogonek -90
+KPX Ydieresis aring -90
+KPX Ydieresis atilde -90
+KPX Ydieresis colon -50
+KPX Ydieresis comma -100
+KPX Ydieresis e -80
+KPX Ydieresis eacute -80
+KPX Ydieresis ecaron -80
+KPX Ydieresis ecircumflex -80
+KPX Ydieresis edieresis -80
+KPX Ydieresis edotaccent -80
+KPX Ydieresis egrave -80
+KPX Ydieresis emacron -80
+KPX Ydieresis eogonek -80
+KPX Ydieresis o -100
+KPX Ydieresis oacute -100
+KPX Ydieresis ocircumflex -100
+KPX Ydieresis odieresis -100
+KPX Ydieresis ograve -100
+KPX Ydieresis ohungarumlaut -100
+KPX Ydieresis omacron -100
+KPX Ydieresis oslash -100
+KPX Ydieresis otilde -100
+KPX Ydieresis period -100
+KPX Ydieresis semicolon -50
+KPX Ydieresis u -100
+KPX Ydieresis uacute -100
+KPX Ydieresis ucircumflex -100
+KPX Ydieresis udieresis -100
+KPX Ydieresis ugrave -100
+KPX Ydieresis uhungarumlaut -100
+KPX Ydieresis umacron -100
+KPX Ydieresis uogonek -100
+KPX Ydieresis uring -100
+KPX a g -10
+KPX a gbreve -10
+KPX a gcommaaccent -10
+KPX a v -15
+KPX a w -15
+KPX a y -20
+KPX a yacute -20
+KPX a ydieresis -20
+KPX aacute g -10
+KPX aacute gbreve -10
+KPX aacute gcommaaccent -10
+KPX aacute v -15
+KPX aacute w -15
+KPX aacute y -20
+KPX aacute yacute -20
+KPX aacute ydieresis -20
+KPX abreve g -10
+KPX abreve gbreve -10
+KPX abreve gcommaaccent -10
+KPX abreve v -15
+KPX abreve w -15
+KPX abreve y -20
+KPX abreve yacute -20
+KPX abreve ydieresis -20
+KPX acircumflex g -10
+KPX acircumflex gbreve -10
+KPX acircumflex gcommaaccent -10
+KPX acircumflex v -15
+KPX acircumflex w -15
+KPX acircumflex y -20
+KPX acircumflex yacute -20
+KPX acircumflex ydieresis -20
+KPX adieresis g -10
+KPX adieresis gbreve -10
+KPX adieresis gcommaaccent -10
+KPX adieresis v -15
+KPX adieresis w -15
+KPX adieresis y -20
+KPX adieresis yacute -20
+KPX adieresis ydieresis -20
+KPX agrave g -10
+KPX agrave gbreve -10
+KPX agrave gcommaaccent -10
+KPX agrave v -15
+KPX agrave w -15
+KPX agrave y -20
+KPX agrave yacute -20
+KPX agrave ydieresis -20
+KPX amacron g -10
+KPX amacron gbreve -10
+KPX amacron gcommaaccent -10
+KPX amacron v -15
+KPX amacron w -15
+KPX amacron y -20
+KPX amacron yacute -20
+KPX amacron ydieresis -20
+KPX aogonek g -10
+KPX aogonek gbreve -10
+KPX aogonek gcommaaccent -10
+KPX aogonek v -15
+KPX aogonek w -15
+KPX aogonek y -20
+KPX aogonek yacute -20
+KPX aogonek ydieresis -20
+KPX aring g -10
+KPX aring gbreve -10
+KPX aring gcommaaccent -10
+KPX aring v -15
+KPX aring w -15
+KPX aring y -20
+KPX aring yacute -20
+KPX aring ydieresis -20
+KPX atilde g -10
+KPX atilde gbreve -10
+KPX atilde gcommaaccent -10
+KPX atilde v -15
+KPX atilde w -15
+KPX atilde y -20
+KPX atilde yacute -20
+KPX atilde ydieresis -20
+KPX b l -10
+KPX b lacute -10
+KPX b lcommaaccent -10
+KPX b lslash -10
+KPX b u -20
+KPX b uacute -20
+KPX b ucircumflex -20
+KPX b udieresis -20
+KPX b ugrave -20
+KPX b uhungarumlaut -20
+KPX b umacron -20
+KPX b uogonek -20
+KPX b uring -20
+KPX b v -20
+KPX b y -20
+KPX b yacute -20
+KPX b ydieresis -20
+KPX c h -10
+KPX c k -20
+KPX c kcommaaccent -20
+KPX c l -20
+KPX c lacute -20
+KPX c lcommaaccent -20
+KPX c lslash -20
+KPX c y -10
+KPX c yacute -10
+KPX c ydieresis -10
+KPX cacute h -10
+KPX cacute k -20
+KPX cacute kcommaaccent -20
+KPX cacute l -20
+KPX cacute lacute -20
+KPX cacute lcommaaccent -20
+KPX cacute lslash -20
+KPX cacute y -10
+KPX cacute yacute -10
+KPX cacute ydieresis -10
+KPX ccaron h -10
+KPX ccaron k -20
+KPX ccaron kcommaaccent -20
+KPX ccaron l -20
+KPX ccaron lacute -20
+KPX ccaron lcommaaccent -20
+KPX ccaron lslash -20
+KPX ccaron y -10
+KPX ccaron yacute -10
+KPX ccaron ydieresis -10
+KPX ccedilla h -10
+KPX ccedilla k -20
+KPX ccedilla kcommaaccent -20
+KPX ccedilla l -20
+KPX ccedilla lacute -20
+KPX ccedilla lcommaaccent -20
+KPX ccedilla lslash -20
+KPX ccedilla y -10
+KPX ccedilla yacute -10
+KPX ccedilla ydieresis -10
+KPX colon space -40
+KPX comma quotedblright -120
+KPX comma quoteright -120
+KPX comma space -40
+KPX d d -10
+KPX d dcroat -10
+KPX d v -15
+KPX d w -15
+KPX d y -15
+KPX d yacute -15
+KPX d ydieresis -15
+KPX dcroat d -10
+KPX dcroat dcroat -10
+KPX dcroat v -15
+KPX dcroat w -15
+KPX dcroat y -15
+KPX dcroat yacute -15
+KPX dcroat ydieresis -15
+KPX e comma 10
+KPX e period 20
+KPX e v -15
+KPX e w -15
+KPX e x -15
+KPX e y -15
+KPX e yacute -15
+KPX e ydieresis -15
+KPX eacute comma 10
+KPX eacute period 20
+KPX eacute v -15
+KPX eacute w -15
+KPX eacute x -15
+KPX eacute y -15
+KPX eacute yacute -15
+KPX eacute ydieresis -15
+KPX ecaron comma 10
+KPX ecaron period 20
+KPX ecaron v -15
+KPX ecaron w -15
+KPX ecaron x -15
+KPX ecaron y -15
+KPX ecaron yacute -15
+KPX ecaron ydieresis -15
+KPX ecircumflex comma 10
+KPX ecircumflex period 20
+KPX ecircumflex v -15
+KPX ecircumflex w -15
+KPX ecircumflex x -15
+KPX ecircumflex y -15
+KPX ecircumflex yacute -15
+KPX ecircumflex ydieresis -15
+KPX edieresis comma 10
+KPX edieresis period 20
+KPX edieresis v -15
+KPX edieresis w -15
+KPX edieresis x -15
+KPX edieresis y -15
+KPX edieresis yacute -15
+KPX edieresis ydieresis -15
+KPX edotaccent comma 10
+KPX edotaccent period 20
+KPX edotaccent v -15
+KPX edotaccent w -15
+KPX edotaccent x -15
+KPX edotaccent y -15
+KPX edotaccent yacute -15
+KPX edotaccent ydieresis -15
+KPX egrave comma 10
+KPX egrave period 20
+KPX egrave v -15
+KPX egrave w -15
+KPX egrave x -15
+KPX egrave y -15
+KPX egrave yacute -15
+KPX egrave ydieresis -15
+KPX emacron comma 10
+KPX emacron period 20
+KPX emacron v -15
+KPX emacron w -15
+KPX emacron x -15
+KPX emacron y -15
+KPX emacron yacute -15
+KPX emacron ydieresis -15
+KPX eogonek comma 10
+KPX eogonek period 20
+KPX eogonek v -15
+KPX eogonek w -15
+KPX eogonek x -15
+KPX eogonek y -15
+KPX eogonek yacute -15
+KPX eogonek ydieresis -15
+KPX f comma -10
+KPX f e -10
+KPX f eacute -10
+KPX f ecaron -10
+KPX f ecircumflex -10
+KPX f edieresis -10
+KPX f edotaccent -10
+KPX f egrave -10
+KPX f emacron -10
+KPX f eogonek -10
+KPX f o -20
+KPX f oacute -20
+KPX f ocircumflex -20
+KPX f odieresis -20
+KPX f ograve -20
+KPX f ohungarumlaut -20
+KPX f omacron -20
+KPX f oslash -20
+KPX f otilde -20
+KPX f period -10
+KPX f quotedblright 30
+KPX f quoteright 30
+KPX g e 10
+KPX g eacute 10
+KPX g ecaron 10
+KPX g ecircumflex 10
+KPX g edieresis 10
+KPX g edotaccent 10
+KPX g egrave 10
+KPX g emacron 10
+KPX g eogonek 10
+KPX g g -10
+KPX g gbreve -10
+KPX g gcommaaccent -10
+KPX gbreve e 10
+KPX gbreve eacute 10
+KPX gbreve ecaron 10
+KPX gbreve ecircumflex 10
+KPX gbreve edieresis 10
+KPX gbreve edotaccent 10
+KPX gbreve egrave 10
+KPX gbreve emacron 10
+KPX gbreve eogonek 10
+KPX gbreve g -10
+KPX gbreve gbreve -10
+KPX gbreve gcommaaccent -10
+KPX gcommaaccent e 10
+KPX gcommaaccent eacute 10
+KPX gcommaaccent ecaron 10
+KPX gcommaaccent ecircumflex 10
+KPX gcommaaccent edieresis 10
+KPX gcommaaccent edotaccent 10
+KPX gcommaaccent egrave 10
+KPX gcommaaccent emacron 10
+KPX gcommaaccent eogonek 10
+KPX gcommaaccent g -10
+KPX gcommaaccent gbreve -10
+KPX gcommaaccent gcommaaccent -10
+KPX h y -20
+KPX h yacute -20
+KPX h ydieresis -20
+KPX k o -15
+KPX k oacute -15
+KPX k ocircumflex -15
+KPX k odieresis -15
+KPX k ograve -15
+KPX k ohungarumlaut -15
+KPX k omacron -15
+KPX k oslash -15
+KPX k otilde -15
+KPX kcommaaccent o -15
+KPX kcommaaccent oacute -15
+KPX kcommaaccent ocircumflex -15
+KPX kcommaaccent odieresis -15
+KPX kcommaaccent ograve -15
+KPX kcommaaccent ohungarumlaut -15
+KPX kcommaaccent omacron -15
+KPX kcommaaccent oslash -15
+KPX kcommaaccent otilde -15
+KPX l w -15
+KPX l y -15
+KPX l yacute -15
+KPX l ydieresis -15
+KPX lacute w -15
+KPX lacute y -15
+KPX lacute yacute -15
+KPX lacute ydieresis -15
+KPX lcommaaccent w -15
+KPX lcommaaccent y -15
+KPX lcommaaccent yacute -15
+KPX lcommaaccent ydieresis -15
+KPX lslash w -15
+KPX lslash y -15
+KPX lslash yacute -15
+KPX lslash ydieresis -15
+KPX m u -20
+KPX m uacute -20
+KPX m ucircumflex -20
+KPX m udieresis -20
+KPX m ugrave -20
+KPX m uhungarumlaut -20
+KPX m umacron -20
+KPX m uogonek -20
+KPX m uring -20
+KPX m y -30
+KPX m yacute -30
+KPX m ydieresis -30
+KPX n u -10
+KPX n uacute -10
+KPX n ucircumflex -10
+KPX n udieresis -10
+KPX n ugrave -10
+KPX n uhungarumlaut -10
+KPX n umacron -10
+KPX n uogonek -10
+KPX n uring -10
+KPX n v -40
+KPX n y -20
+KPX n yacute -20
+KPX n ydieresis -20
+KPX nacute u -10
+KPX nacute uacute -10
+KPX nacute ucircumflex -10
+KPX nacute udieresis -10
+KPX nacute ugrave -10
+KPX nacute uhungarumlaut -10
+KPX nacute umacron -10
+KPX nacute uogonek -10
+KPX nacute uring -10
+KPX nacute v -40
+KPX nacute y -20
+KPX nacute yacute -20
+KPX nacute ydieresis -20
+KPX ncaron u -10
+KPX ncaron uacute -10
+KPX ncaron ucircumflex -10
+KPX ncaron udieresis -10
+KPX ncaron ugrave -10
+KPX ncaron uhungarumlaut -10
+KPX ncaron umacron -10
+KPX ncaron uogonek -10
+KPX ncaron uring -10
+KPX ncaron v -40
+KPX ncaron y -20
+KPX ncaron yacute -20
+KPX ncaron ydieresis -20
+KPX ncommaaccent u -10
+KPX ncommaaccent uacute -10
+KPX ncommaaccent ucircumflex -10
+KPX ncommaaccent udieresis -10
+KPX ncommaaccent ugrave -10
+KPX ncommaaccent uhungarumlaut -10
+KPX ncommaaccent umacron -10
+KPX ncommaaccent uogonek -10
+KPX ncommaaccent uring -10
+KPX ncommaaccent v -40
+KPX ncommaaccent y -20
+KPX ncommaaccent yacute -20
+KPX ncommaaccent ydieresis -20
+KPX ntilde u -10
+KPX ntilde uacute -10
+KPX ntilde ucircumflex -10
+KPX ntilde udieresis -10
+KPX ntilde ugrave -10
+KPX ntilde uhungarumlaut -10
+KPX ntilde umacron -10
+KPX ntilde uogonek -10
+KPX ntilde uring -10
+KPX ntilde v -40
+KPX ntilde y -20
+KPX ntilde yacute -20
+KPX ntilde ydieresis -20
+KPX o v -20
+KPX o w -15
+KPX o x -30
+KPX o y -20
+KPX o yacute -20
+KPX o ydieresis -20
+KPX oacute v -20
+KPX oacute w -15
+KPX oacute x -30
+KPX oacute y -20
+KPX oacute yacute -20
+KPX oacute ydieresis -20
+KPX ocircumflex v -20
+KPX ocircumflex w -15
+KPX ocircumflex x -30
+KPX ocircumflex y -20
+KPX ocircumflex yacute -20
+KPX ocircumflex ydieresis -20
+KPX odieresis v -20
+KPX odieresis w -15
+KPX odieresis x -30
+KPX odieresis y -20
+KPX odieresis yacute -20
+KPX odieresis ydieresis -20
+KPX ograve v -20
+KPX ograve w -15
+KPX ograve x -30
+KPX ograve y -20
+KPX ograve yacute -20
+KPX ograve ydieresis -20
+KPX ohungarumlaut v -20
+KPX ohungarumlaut w -15
+KPX ohungarumlaut x -30
+KPX ohungarumlaut y -20
+KPX ohungarumlaut yacute -20
+KPX ohungarumlaut ydieresis -20
+KPX omacron v -20
+KPX omacron w -15
+KPX omacron x -30
+KPX omacron y -20
+KPX omacron yacute -20
+KPX omacron ydieresis -20
+KPX oslash v -20
+KPX oslash w -15
+KPX oslash x -30
+KPX oslash y -20
+KPX oslash yacute -20
+KPX oslash ydieresis -20
+KPX otilde v -20
+KPX otilde w -15
+KPX otilde x -30
+KPX otilde y -20
+KPX otilde yacute -20
+KPX otilde ydieresis -20
+KPX p y -15
+KPX p yacute -15
+KPX p ydieresis -15
+KPX period quotedblright -120
+KPX period quoteright -120
+KPX period space -40
+KPX quotedblright space -80
+KPX quoteleft quoteleft -46
+KPX quoteright d -80
+KPX quoteright dcroat -80
+KPX quoteright l -20
+KPX quoteright lacute -20
+KPX quoteright lcommaaccent -20
+KPX quoteright lslash -20
+KPX quoteright quoteright -46
+KPX quoteright r -40
+KPX quoteright racute -40
+KPX quoteright rcaron -40
+KPX quoteright rcommaaccent -40
+KPX quoteright s -60
+KPX quoteright sacute -60
+KPX quoteright scaron -60
+KPX quoteright scedilla -60
+KPX quoteright scommaaccent -60
+KPX quoteright space -80
+KPX quoteright v -20
+KPX r c -20
+KPX r cacute -20
+KPX r ccaron -20
+KPX r ccedilla -20
+KPX r comma -60
+KPX r d -20
+KPX r dcroat -20
+KPX r g -15
+KPX r gbreve -15
+KPX r gcommaaccent -15
+KPX r hyphen -20
+KPX r o -20
+KPX r oacute -20
+KPX r ocircumflex -20
+KPX r odieresis -20
+KPX r ograve -20
+KPX r ohungarumlaut -20
+KPX r omacron -20
+KPX r oslash -20
+KPX r otilde -20
+KPX r period -60
+KPX r q -20
+KPX r s -15
+KPX r sacute -15
+KPX r scaron -15
+KPX r scedilla -15
+KPX r scommaaccent -15
+KPX r t 20
+KPX r tcommaaccent 20
+KPX r v 10
+KPX r y 10
+KPX r yacute 10
+KPX r ydieresis 10
+KPX racute c -20
+KPX racute cacute -20
+KPX racute ccaron -20
+KPX racute ccedilla -20
+KPX racute comma -60
+KPX racute d -20
+KPX racute dcroat -20
+KPX racute g -15
+KPX racute gbreve -15
+KPX racute gcommaaccent -15
+KPX racute hyphen -20
+KPX racute o -20
+KPX racute oacute -20
+KPX racute ocircumflex -20
+KPX racute odieresis -20
+KPX racute ograve -20
+KPX racute ohungarumlaut -20
+KPX racute omacron -20
+KPX racute oslash -20
+KPX racute otilde -20
+KPX racute period -60
+KPX racute q -20
+KPX racute s -15
+KPX racute sacute -15
+KPX racute scaron -15
+KPX racute scedilla -15
+KPX racute scommaaccent -15
+KPX racute t 20
+KPX racute tcommaaccent 20
+KPX racute v 10
+KPX racute y 10
+KPX racute yacute 10
+KPX racute ydieresis 10
+KPX rcaron c -20
+KPX rcaron cacute -20
+KPX rcaron ccaron -20
+KPX rcaron ccedilla -20
+KPX rcaron comma -60
+KPX rcaron d -20
+KPX rcaron dcroat -20
+KPX rcaron g -15
+KPX rcaron gbreve -15
+KPX rcaron gcommaaccent -15
+KPX rcaron hyphen -20
+KPX rcaron o -20
+KPX rcaron oacute -20
+KPX rcaron ocircumflex -20
+KPX rcaron odieresis -20
+KPX rcaron ograve -20
+KPX rcaron ohungarumlaut -20
+KPX rcaron omacron -20
+KPX rcaron oslash -20
+KPX rcaron otilde -20
+KPX rcaron period -60
+KPX rcaron q -20
+KPX rcaron s -15
+KPX rcaron sacute -15
+KPX rcaron scaron -15
+KPX rcaron scedilla -15
+KPX rcaron scommaaccent -15
+KPX rcaron t 20
+KPX rcaron tcommaaccent 20
+KPX rcaron v 10
+KPX rcaron y 10
+KPX rcaron yacute 10
+KPX rcaron ydieresis 10
+KPX rcommaaccent c -20
+KPX rcommaaccent cacute -20
+KPX rcommaaccent ccaron -20
+KPX rcommaaccent ccedilla -20
+KPX rcommaaccent comma -60
+KPX rcommaaccent d -20
+KPX rcommaaccent dcroat -20
+KPX rcommaaccent g -15
+KPX rcommaaccent gbreve -15
+KPX rcommaaccent gcommaaccent -15
+KPX rcommaaccent hyphen -20
+KPX rcommaaccent o -20
+KPX rcommaaccent oacute -20
+KPX rcommaaccent ocircumflex -20
+KPX rcommaaccent odieresis -20
+KPX rcommaaccent ograve -20
+KPX rcommaaccent ohungarumlaut -20
+KPX rcommaaccent omacron -20
+KPX rcommaaccent oslash -20
+KPX rcommaaccent otilde -20
+KPX rcommaaccent period -60
+KPX rcommaaccent q -20
+KPX rcommaaccent s -15
+KPX rcommaaccent sacute -15
+KPX rcommaaccent scaron -15
+KPX rcommaaccent scedilla -15
+KPX rcommaaccent scommaaccent -15
+KPX rcommaaccent t 20
+KPX rcommaaccent tcommaaccent 20
+KPX rcommaaccent v 10
+KPX rcommaaccent y 10
+KPX rcommaaccent yacute 10
+KPX rcommaaccent ydieresis 10
+KPX s w -15
+KPX sacute w -15
+KPX scaron w -15
+KPX scedilla w -15
+KPX scommaaccent w -15
+KPX semicolon space -40
+KPX space T -100
+KPX space Tcaron -100
+KPX space Tcommaaccent -100
+KPX space V -80
+KPX space W -80
+KPX space Y -120
+KPX space Yacute -120
+KPX space Ydieresis -120
+KPX space quotedblleft -80
+KPX space quoteleft -60
+KPX v a -20
+KPX v aacute -20
+KPX v abreve -20
+KPX v acircumflex -20
+KPX v adieresis -20
+KPX v agrave -20
+KPX v amacron -20
+KPX v aogonek -20
+KPX v aring -20
+KPX v atilde -20
+KPX v comma -80
+KPX v o -30
+KPX v oacute -30
+KPX v ocircumflex -30
+KPX v odieresis -30
+KPX v ograve -30
+KPX v ohungarumlaut -30
+KPX v omacron -30
+KPX v oslash -30
+KPX v otilde -30
+KPX v period -80
+KPX w comma -40
+KPX w o -20
+KPX w oacute -20
+KPX w ocircumflex -20
+KPX w odieresis -20
+KPX w ograve -20
+KPX w ohungarumlaut -20
+KPX w omacron -20
+KPX w oslash -20
+KPX w otilde -20
+KPX w period -40
+KPX x e -10
+KPX x eacute -10
+KPX x ecaron -10
+KPX x ecircumflex -10
+KPX x edieresis -10
+KPX x edotaccent -10
+KPX x egrave -10
+KPX x emacron -10
+KPX x eogonek -10
+KPX y a -30
+KPX y aacute -30
+KPX y abreve -30
+KPX y acircumflex -30
+KPX y adieresis -30
+KPX y agrave -30
+KPX y amacron -30
+KPX y aogonek -30
+KPX y aring -30
+KPX y atilde -30
+KPX y comma -80
+KPX y e -10
+KPX y eacute -10
+KPX y ecaron -10
+KPX y ecircumflex -10
+KPX y edieresis -10
+KPX y edotaccent -10
+KPX y egrave -10
+KPX y emacron -10
+KPX y eogonek -10
+KPX y o -25
+KPX y oacute -25
+KPX y ocircumflex -25
+KPX y odieresis -25
+KPX y ograve -25
+KPX y ohungarumlaut -25
+KPX y omacron -25
+KPX y oslash -25
+KPX y otilde -25
+KPX y period -80
+KPX yacute a -30
+KPX yacute aacute -30
+KPX yacute abreve -30
+KPX yacute acircumflex -30
+KPX yacute adieresis -30
+KPX yacute agrave -30
+KPX yacute amacron -30
+KPX yacute aogonek -30
+KPX yacute aring -30
+KPX yacute atilde -30
+KPX yacute comma -80
+KPX yacute e -10
+KPX yacute eacute -10
+KPX yacute ecaron -10
+KPX yacute ecircumflex -10
+KPX yacute edieresis -10
+KPX yacute edotaccent -10
+KPX yacute egrave -10
+KPX yacute emacron -10
+KPX yacute eogonek -10
+KPX yacute o -25
+KPX yacute oacute -25
+KPX yacute ocircumflex -25
+KPX yacute odieresis -25
+KPX yacute ograve -25
+KPX yacute ohungarumlaut -25
+KPX yacute omacron -25
+KPX yacute oslash -25
+KPX yacute otilde -25
+KPX yacute period -80
+KPX ydieresis a -30
+KPX ydieresis aacute -30
+KPX ydieresis abreve -30
+KPX ydieresis acircumflex -30
+KPX ydieresis adieresis -30
+KPX ydieresis agrave -30
+KPX ydieresis amacron -30
+KPX ydieresis aogonek -30
+KPX ydieresis aring -30
+KPX ydieresis atilde -30
+KPX ydieresis comma -80
+KPX ydieresis e -10
+KPX ydieresis eacute -10
+KPX ydieresis ecaron -10
+KPX ydieresis ecircumflex -10
+KPX ydieresis edieresis -10
+KPX ydieresis edotaccent -10
+KPX ydieresis egrave -10
+KPX ydieresis emacron -10
+KPX ydieresis eogonek -10
+KPX ydieresis o -25
+KPX ydieresis oacute -25
+KPX ydieresis ocircumflex -25
+KPX ydieresis odieresis -25
+KPX ydieresis ograve -25
+KPX ydieresis ohungarumlaut -25
+KPX ydieresis omacron -25
+KPX ydieresis oslash -25
+KPX ydieresis otilde -25
+KPX ydieresis period -80
+KPX z e 10
+KPX z eacute 10
+KPX z ecaron 10
+KPX z ecircumflex 10
+KPX z edieresis 10
+KPX z edotaccent 10
+KPX z egrave 10
+KPX z emacron 10
+KPX z eogonek 10
+KPX zacute e 10
+KPX zacute eacute 10
+KPX zacute ecaron 10
+KPX zacute ecircumflex 10
+KPX zacute edieresis 10
+KPX zacute edotaccent 10
+KPX zacute egrave 10
+KPX zacute emacron 10
+KPX zacute eogonek 10
+KPX zcaron e 10
+KPX zcaron eacute 10
+KPX zcaron ecaron 10
+KPX zcaron ecircumflex 10
+KPX zcaron edieresis 10
+KPX zcaron edotaccent 10
+KPX zcaron egrave 10
+KPX zcaron emacron 10
+KPX zcaron eogonek 10
+KPX zdotaccent e 10
+KPX zdotaccent eacute 10
+KPX zdotaccent ecaron 10
+KPX zdotaccent ecircumflex 10
+KPX zdotaccent edieresis 10
+KPX zdotaccent edotaccent 10
+KPX zdotaccent egrave 10
+KPX zdotaccent emacron 10
+KPX zdotaccent eogonek 10
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-Oblique.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-Oblique.afm
new file mode 100644
index 0000000..7a7af00
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica-Oblique.afm
@@ -0,0 +1,3051 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu May 1 12:44:31 1997
+Comment UniqueID 43055
+Comment VMusage 14960 69346
+FontName Helvetica-Oblique
+FullName Helvetica Oblique
+FamilyName Helvetica
+Weight Medium
+ItalicAngle -12
+IsFixedPitch false
+CharacterSet ExtendedRoman
+FontBBox -170 -225 1116 931
+UnderlinePosition -100
+UnderlineThickness 50
+Version 002.000
+Notice Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 718
+XHeight 523
+Ascender 718
+Descender -207
+StdHW 76
+StdVW 88
+StartCharMetrics 315
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 278 ; N exclam ; B 90 0 340 718 ;
+C 34 ; WX 355 ; N quotedbl ; B 168 463 438 718 ;
+C 35 ; WX 556 ; N numbersign ; B 73 0 631 688 ;
+C 36 ; WX 556 ; N dollar ; B 69 -115 617 775 ;
+C 37 ; WX 889 ; N percent ; B 147 -19 889 703 ;
+C 38 ; WX 667 ; N ampersand ; B 77 -15 647 718 ;
+C 39 ; WX 222 ; N quoteright ; B 151 463 310 718 ;
+C 40 ; WX 333 ; N parenleft ; B 108 -207 454 733 ;
+C 41 ; WX 333 ; N parenright ; B -9 -207 337 733 ;
+C 42 ; WX 389 ; N asterisk ; B 165 431 475 718 ;
+C 43 ; WX 584 ; N plus ; B 85 0 606 505 ;
+C 44 ; WX 278 ; N comma ; B 56 -147 214 106 ;
+C 45 ; WX 333 ; N hyphen ; B 93 232 357 322 ;
+C 46 ; WX 278 ; N period ; B 87 0 214 106 ;
+C 47 ; WX 278 ; N slash ; B -21 -19 452 737 ;
+C 48 ; WX 556 ; N zero ; B 93 -19 608 703 ;
+C 49 ; WX 556 ; N one ; B 207 0 508 703 ;
+C 50 ; WX 556 ; N two ; B 26 0 617 703 ;
+C 51 ; WX 556 ; N three ; B 75 -19 610 703 ;
+C 52 ; WX 556 ; N four ; B 61 0 576 703 ;
+C 53 ; WX 556 ; N five ; B 68 -19 621 688 ;
+C 54 ; WX 556 ; N six ; B 91 -19 615 703 ;
+C 55 ; WX 556 ; N seven ; B 137 0 669 688 ;
+C 56 ; WX 556 ; N eight ; B 74 -19 607 703 ;
+C 57 ; WX 556 ; N nine ; B 82 -19 609 703 ;
+C 58 ; WX 278 ; N colon ; B 87 0 301 516 ;
+C 59 ; WX 278 ; N semicolon ; B 56 -147 301 516 ;
+C 60 ; WX 584 ; N less ; B 94 11 641 495 ;
+C 61 ; WX 584 ; N equal ; B 63 115 628 390 ;
+C 62 ; WX 584 ; N greater ; B 50 11 597 495 ;
+C 63 ; WX 556 ; N question ; B 161 0 610 727 ;
+C 64 ; WX 1015 ; N at ; B 215 -19 965 737 ;
+C 65 ; WX 667 ; N A ; B 14 0 654 718 ;
+C 66 ; WX 667 ; N B ; B 74 0 712 718 ;
+C 67 ; WX 722 ; N C ; B 108 -19 782 737 ;
+C 68 ; WX 722 ; N D ; B 81 0 764 718 ;
+C 69 ; WX 667 ; N E ; B 86 0 762 718 ;
+C 70 ; WX 611 ; N F ; B 86 0 736 718 ;
+C 71 ; WX 778 ; N G ; B 111 -19 799 737 ;
+C 72 ; WX 722 ; N H ; B 77 0 799 718 ;
+C 73 ; WX 278 ; N I ; B 91 0 341 718 ;
+C 74 ; WX 500 ; N J ; B 47 -19 581 718 ;
+C 75 ; WX 667 ; N K ; B 76 0 808 718 ;
+C 76 ; WX 556 ; N L ; B 76 0 555 718 ;
+C 77 ; WX 833 ; N M ; B 73 0 914 718 ;
+C 78 ; WX 722 ; N N ; B 76 0 799 718 ;
+C 79 ; WX 778 ; N O ; B 105 -19 826 737 ;
+C 80 ; WX 667 ; N P ; B 86 0 737 718 ;
+C 81 ; WX 778 ; N Q ; B 105 -56 826 737 ;
+C 82 ; WX 722 ; N R ; B 88 0 773 718 ;
+C 83 ; WX 667 ; N S ; B 90 -19 713 737 ;
+C 84 ; WX 611 ; N T ; B 148 0 750 718 ;
+C 85 ; WX 722 ; N U ; B 123 -19 797 718 ;
+C 86 ; WX 667 ; N V ; B 173 0 800 718 ;
+C 87 ; WX 944 ; N W ; B 169 0 1081 718 ;
+C 88 ; WX 667 ; N X ; B 19 0 790 718 ;
+C 89 ; WX 667 ; N Y ; B 167 0 806 718 ;
+C 90 ; WX 611 ; N Z ; B 23 0 741 718 ;
+C 91 ; WX 278 ; N bracketleft ; B 21 -196 403 722 ;
+C 92 ; WX 278 ; N backslash ; B 140 -19 291 737 ;
+C 93 ; WX 278 ; N bracketright ; B -14 -196 368 722 ;
+C 94 ; WX 469 ; N asciicircum ; B 42 264 539 688 ;
+C 95 ; WX 556 ; N underscore ; B -27 -125 540 -75 ;
+C 96 ; WX 222 ; N quoteleft ; B 165 470 323 725 ;
+C 97 ; WX 556 ; N a ; B 61 -15 559 538 ;
+C 98 ; WX 556 ; N b ; B 58 -15 584 718 ;
+C 99 ; WX 500 ; N c ; B 74 -15 553 538 ;
+C 100 ; WX 556 ; N d ; B 84 -15 652 718 ;
+C 101 ; WX 556 ; N e ; B 84 -15 578 538 ;
+C 102 ; WX 278 ; N f ; B 86 0 416 728 ; L i fi ; L l fl ;
+C 103 ; WX 556 ; N g ; B 42 -220 610 538 ;
+C 104 ; WX 556 ; N h ; B 65 0 573 718 ;
+C 105 ; WX 222 ; N i ; B 67 0 308 718 ;
+C 106 ; WX 222 ; N j ; B -60 -210 308 718 ;
+C 107 ; WX 500 ; N k ; B 67 0 600 718 ;
+C 108 ; WX 222 ; N l ; B 67 0 308 718 ;
+C 109 ; WX 833 ; N m ; B 65 0 852 538 ;
+C 110 ; WX 556 ; N n ; B 65 0 573 538 ;
+C 111 ; WX 556 ; N o ; B 83 -14 585 538 ;
+C 112 ; WX 556 ; N p ; B 14 -207 584 538 ;
+C 113 ; WX 556 ; N q ; B 84 -207 605 538 ;
+C 114 ; WX 333 ; N r ; B 77 0 446 538 ;
+C 115 ; WX 500 ; N s ; B 63 -15 529 538 ;
+C 116 ; WX 278 ; N t ; B 102 -7 368 669 ;
+C 117 ; WX 556 ; N u ; B 94 -15 600 523 ;
+C 118 ; WX 500 ; N v ; B 119 0 603 523 ;
+C 119 ; WX 722 ; N w ; B 125 0 820 523 ;
+C 120 ; WX 500 ; N x ; B 11 0 594 523 ;
+C 121 ; WX 500 ; N y ; B 15 -214 600 523 ;
+C 122 ; WX 500 ; N z ; B 31 0 571 523 ;
+C 123 ; WX 334 ; N braceleft ; B 92 -196 445 722 ;
+C 124 ; WX 260 ; N bar ; B 46 -225 332 775 ;
+C 125 ; WX 334 ; N braceright ; B 0 -196 354 722 ;
+C 126 ; WX 584 ; N asciitilde ; B 111 180 580 326 ;
+C 161 ; WX 333 ; N exclamdown ; B 77 -195 326 523 ;
+C 162 ; WX 556 ; N cent ; B 95 -115 584 623 ;
+C 163 ; WX 556 ; N sterling ; B 49 -16 634 718 ;
+C 164 ; WX 167 ; N fraction ; B -170 -19 482 703 ;
+C 165 ; WX 556 ; N yen ; B 81 0 699 688 ;
+C 166 ; WX 556 ; N florin ; B -52 -207 654 737 ;
+C 167 ; WX 556 ; N section ; B 76 -191 584 737 ;
+C 168 ; WX 556 ; N currency ; B 60 99 646 603 ;
+C 169 ; WX 191 ; N quotesingle ; B 157 463 285 718 ;
+C 170 ; WX 333 ; N quotedblleft ; B 138 470 461 725 ;
+C 171 ; WX 556 ; N guillemotleft ; B 146 108 554 446 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 137 108 340 446 ;
+C 173 ; WX 333 ; N guilsinglright ; B 111 108 314 446 ;
+C 174 ; WX 500 ; N fi ; B 86 0 587 728 ;
+C 175 ; WX 500 ; N fl ; B 86 0 585 728 ;
+C 177 ; WX 556 ; N endash ; B 51 240 623 313 ;
+C 178 ; WX 556 ; N dagger ; B 135 -159 622 718 ;
+C 179 ; WX 556 ; N daggerdbl ; B 52 -159 623 718 ;
+C 180 ; WX 278 ; N periodcentered ; B 129 190 257 315 ;
+C 182 ; WX 537 ; N paragraph ; B 126 -173 650 718 ;
+C 183 ; WX 350 ; N bullet ; B 91 202 413 517 ;
+C 184 ; WX 222 ; N quotesinglbase ; B 21 -149 180 106 ;
+C 185 ; WX 333 ; N quotedblbase ; B -6 -149 318 106 ;
+C 186 ; WX 333 ; N quotedblright ; B 124 463 448 718 ;
+C 187 ; WX 556 ; N guillemotright ; B 120 108 528 446 ;
+C 188 ; WX 1000 ; N ellipsis ; B 115 0 908 106 ;
+C 189 ; WX 1000 ; N perthousand ; B 88 -19 1029 703 ;
+C 191 ; WX 611 ; N questiondown ; B 85 -201 534 525 ;
+C 193 ; WX 333 ; N grave ; B 170 593 337 734 ;
+C 194 ; WX 333 ; N acute ; B 248 593 475 734 ;
+C 195 ; WX 333 ; N circumflex ; B 147 593 438 734 ;
+C 196 ; WX 333 ; N tilde ; B 125 606 490 722 ;
+C 197 ; WX 333 ; N macron ; B 143 627 468 684 ;
+C 198 ; WX 333 ; N breve ; B 167 595 476 731 ;
+C 199 ; WX 333 ; N dotaccent ; B 249 604 362 706 ;
+C 200 ; WX 333 ; N dieresis ; B 168 604 443 706 ;
+C 202 ; WX 333 ; N ring ; B 214 572 402 756 ;
+C 203 ; WX 333 ; N cedilla ; B 2 -225 232 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 157 593 565 734 ;
+C 206 ; WX 333 ; N ogonek ; B 43 -225 249 0 ;
+C 207 ; WX 333 ; N caron ; B 177 593 468 734 ;
+C 208 ; WX 1000 ; N emdash ; B 51 240 1067 313 ;
+C 225 ; WX 1000 ; N AE ; B 8 0 1097 718 ;
+C 227 ; WX 370 ; N ordfeminine ; B 127 405 449 737 ;
+C 232 ; WX 556 ; N Lslash ; B 41 0 555 718 ;
+C 233 ; WX 778 ; N Oslash ; B 43 -19 890 737 ;
+C 234 ; WX 1000 ; N OE ; B 98 -19 1116 737 ;
+C 235 ; WX 365 ; N ordmasculine ; B 141 405 468 737 ;
+C 241 ; WX 889 ; N ae ; B 61 -15 909 538 ;
+C 245 ; WX 278 ; N dotlessi ; B 95 0 294 523 ;
+C 248 ; WX 222 ; N lslash ; B 41 0 347 718 ;
+C 249 ; WX 611 ; N oslash ; B 29 -22 647 545 ;
+C 250 ; WX 944 ; N oe ; B 83 -15 964 538 ;
+C 251 ; WX 611 ; N germandbls ; B 67 -15 658 728 ;
+C -1 ; WX 278 ; N Idieresis ; B 91 0 458 901 ;
+C -1 ; WX 556 ; N eacute ; B 84 -15 587 734 ;
+C -1 ; WX 556 ; N abreve ; B 61 -15 578 731 ;
+C -1 ; WX 556 ; N uhungarumlaut ; B 94 -15 677 734 ;
+C -1 ; WX 556 ; N ecaron ; B 84 -15 580 734 ;
+C -1 ; WX 667 ; N Ydieresis ; B 167 0 806 901 ;
+C -1 ; WX 584 ; N divide ; B 85 -19 606 524 ;
+C -1 ; WX 667 ; N Yacute ; B 167 0 806 929 ;
+C -1 ; WX 667 ; N Acircumflex ; B 14 0 654 929 ;
+C -1 ; WX 556 ; N aacute ; B 61 -15 587 734 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 123 -19 797 929 ;
+C -1 ; WX 500 ; N yacute ; B 15 -214 600 734 ;
+C -1 ; WX 500 ; N scommaaccent ; B 63 -225 529 538 ;
+C -1 ; WX 556 ; N ecircumflex ; B 84 -15 578 734 ;
+C -1 ; WX 722 ; N Uring ; B 123 -19 797 931 ;
+C -1 ; WX 722 ; N Udieresis ; B 123 -19 797 901 ;
+C -1 ; WX 556 ; N aogonek ; B 61 -220 559 538 ;
+C -1 ; WX 722 ; N Uacute ; B 123 -19 797 929 ;
+C -1 ; WX 556 ; N uogonek ; B 94 -225 600 523 ;
+C -1 ; WX 667 ; N Edieresis ; B 86 0 762 901 ;
+C -1 ; WX 722 ; N Dcroat ; B 69 0 764 718 ;
+C -1 ; WX 250 ; N commaaccent ; B 39 -225 172 -40 ;
+C -1 ; WX 737 ; N copyright ; B 54 -19 837 737 ;
+C -1 ; WX 667 ; N Emacron ; B 86 0 762 879 ;
+C -1 ; WX 500 ; N ccaron ; B 74 -15 553 734 ;
+C -1 ; WX 556 ; N aring ; B 61 -15 559 756 ;
+C -1 ; WX 722 ; N Ncommaaccent ; B 76 -225 799 718 ;
+C -1 ; WX 222 ; N lacute ; B 67 0 461 929 ;
+C -1 ; WX 556 ; N agrave ; B 61 -15 559 734 ;
+C -1 ; WX 611 ; N Tcommaaccent ; B 148 -225 750 718 ;
+C -1 ; WX 722 ; N Cacute ; B 108 -19 782 929 ;
+C -1 ; WX 556 ; N atilde ; B 61 -15 592 722 ;
+C -1 ; WX 667 ; N Edotaccent ; B 86 0 762 901 ;
+C -1 ; WX 500 ; N scaron ; B 63 -15 552 734 ;
+C -1 ; WX 500 ; N scedilla ; B 63 -225 529 538 ;
+C -1 ; WX 278 ; N iacute ; B 95 0 448 734 ;
+C -1 ; WX 471 ; N lozenge ; B 88 0 540 728 ;
+C -1 ; WX 722 ; N Rcaron ; B 88 0 773 929 ;
+C -1 ; WX 778 ; N Gcommaaccent ; B 111 -225 799 737 ;
+C -1 ; WX 556 ; N ucircumflex ; B 94 -15 600 734 ;
+C -1 ; WX 556 ; N acircumflex ; B 61 -15 559 734 ;
+C -1 ; WX 667 ; N Amacron ; B 14 0 677 879 ;
+C -1 ; WX 333 ; N rcaron ; B 77 0 508 734 ;
+C -1 ; WX 500 ; N ccedilla ; B 74 -225 553 538 ;
+C -1 ; WX 611 ; N Zdotaccent ; B 23 0 741 901 ;
+C -1 ; WX 667 ; N Thorn ; B 86 0 712 718 ;
+C -1 ; WX 778 ; N Omacron ; B 105 -19 826 879 ;
+C -1 ; WX 722 ; N Racute ; B 88 0 773 929 ;
+C -1 ; WX 667 ; N Sacute ; B 90 -19 713 929 ;
+C -1 ; WX 643 ; N dcaron ; B 84 -15 808 718 ;
+C -1 ; WX 722 ; N Umacron ; B 123 -19 797 879 ;
+C -1 ; WX 556 ; N uring ; B 94 -15 600 756 ;
+C -1 ; WX 333 ; N threesuperior ; B 90 270 436 703 ;
+C -1 ; WX 778 ; N Ograve ; B 105 -19 826 929 ;
+C -1 ; WX 667 ; N Agrave ; B 14 0 654 929 ;
+C -1 ; WX 667 ; N Abreve ; B 14 0 685 926 ;
+C -1 ; WX 584 ; N multiply ; B 50 0 642 506 ;
+C -1 ; WX 556 ; N uacute ; B 94 -15 600 734 ;
+C -1 ; WX 611 ; N Tcaron ; B 148 0 750 929 ;
+C -1 ; WX 476 ; N partialdiff ; B 41 -38 550 714 ;
+C -1 ; WX 500 ; N ydieresis ; B 15 -214 600 706 ;
+C -1 ; WX 722 ; N Nacute ; B 76 0 799 929 ;
+C -1 ; WX 278 ; N icircumflex ; B 95 0 411 734 ;
+C -1 ; WX 667 ; N Ecircumflex ; B 86 0 762 929 ;
+C -1 ; WX 556 ; N adieresis ; B 61 -15 559 706 ;
+C -1 ; WX 556 ; N edieresis ; B 84 -15 578 706 ;
+C -1 ; WX 500 ; N cacute ; B 74 -15 559 734 ;
+C -1 ; WX 556 ; N nacute ; B 65 0 587 734 ;
+C -1 ; WX 556 ; N umacron ; B 94 -15 600 684 ;
+C -1 ; WX 722 ; N Ncaron ; B 76 0 799 929 ;
+C -1 ; WX 278 ; N Iacute ; B 91 0 489 929 ;
+C -1 ; WX 584 ; N plusminus ; B 39 0 618 506 ;
+C -1 ; WX 260 ; N brokenbar ; B 62 -150 316 700 ;
+C -1 ; WX 737 ; N registered ; B 54 -19 837 737 ;
+C -1 ; WX 778 ; N Gbreve ; B 111 -19 799 926 ;
+C -1 ; WX 278 ; N Idotaccent ; B 91 0 377 901 ;
+C -1 ; WX 600 ; N summation ; B 15 -10 671 706 ;
+C -1 ; WX 667 ; N Egrave ; B 86 0 762 929 ;
+C -1 ; WX 333 ; N racute ; B 77 0 475 734 ;
+C -1 ; WX 556 ; N omacron ; B 83 -14 585 684 ;
+C -1 ; WX 611 ; N Zacute ; B 23 0 741 929 ;
+C -1 ; WX 611 ; N Zcaron ; B 23 0 741 929 ;
+C -1 ; WX 549 ; N greaterequal ; B 26 0 620 674 ;
+C -1 ; WX 722 ; N Eth ; B 69 0 764 718 ;
+C -1 ; WX 722 ; N Ccedilla ; B 108 -225 782 737 ;
+C -1 ; WX 222 ; N lcommaaccent ; B 25 -225 308 718 ;
+C -1 ; WX 317 ; N tcaron ; B 102 -7 501 808 ;
+C -1 ; WX 556 ; N eogonek ; B 84 -225 578 538 ;
+C -1 ; WX 722 ; N Uogonek ; B 123 -225 797 718 ;
+C -1 ; WX 667 ; N Aacute ; B 14 0 683 929 ;
+C -1 ; WX 667 ; N Adieresis ; B 14 0 654 901 ;
+C -1 ; WX 556 ; N egrave ; B 84 -15 578 734 ;
+C -1 ; WX 500 ; N zacute ; B 31 0 571 734 ;
+C -1 ; WX 222 ; N iogonek ; B -61 -225 308 718 ;
+C -1 ; WX 778 ; N Oacute ; B 105 -19 826 929 ;
+C -1 ; WX 556 ; N oacute ; B 83 -14 587 734 ;
+C -1 ; WX 556 ; N amacron ; B 61 -15 580 684 ;
+C -1 ; WX 500 ; N sacute ; B 63 -15 559 734 ;
+C -1 ; WX 278 ; N idieresis ; B 95 0 416 706 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 105 -19 826 929 ;
+C -1 ; WX 722 ; N Ugrave ; B 123 -19 797 929 ;
+C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
+C -1 ; WX 556 ; N thorn ; B 14 -207 584 718 ;
+C -1 ; WX 333 ; N twosuperior ; B 64 281 449 703 ;
+C -1 ; WX 778 ; N Odieresis ; B 105 -19 826 901 ;
+C -1 ; WX 556 ; N mu ; B 24 -207 600 523 ;
+C -1 ; WX 278 ; N igrave ; B 95 0 310 734 ;
+C -1 ; WX 556 ; N ohungarumlaut ; B 83 -14 677 734 ;
+C -1 ; WX 667 ; N Eogonek ; B 86 -220 762 718 ;
+C -1 ; WX 556 ; N dcroat ; B 84 -15 689 718 ;
+C -1 ; WX 834 ; N threequarters ; B 130 -19 861 703 ;
+C -1 ; WX 667 ; N Scedilla ; B 90 -225 713 737 ;
+C -1 ; WX 299 ; N lcaron ; B 67 0 464 718 ;
+C -1 ; WX 667 ; N Kcommaaccent ; B 76 -225 808 718 ;
+C -1 ; WX 556 ; N Lacute ; B 76 0 555 929 ;
+C -1 ; WX 1000 ; N trademark ; B 186 306 1056 718 ;
+C -1 ; WX 556 ; N edotaccent ; B 84 -15 578 706 ;
+C -1 ; WX 278 ; N Igrave ; B 91 0 351 929 ;
+C -1 ; WX 278 ; N Imacron ; B 91 0 483 879 ;
+C -1 ; WX 556 ; N Lcaron ; B 76 0 570 718 ;
+C -1 ; WX 834 ; N onehalf ; B 114 -19 839 703 ;
+C -1 ; WX 549 ; N lessequal ; B 26 0 666 674 ;
+C -1 ; WX 556 ; N ocircumflex ; B 83 -14 585 734 ;
+C -1 ; WX 556 ; N ntilde ; B 65 0 592 722 ;
+C -1 ; WX 722 ; N Uhungarumlaut ; B 123 -19 801 929 ;
+C -1 ; WX 667 ; N Eacute ; B 86 0 762 929 ;
+C -1 ; WX 556 ; N emacron ; B 84 -15 580 684 ;
+C -1 ; WX 556 ; N gbreve ; B 42 -220 610 731 ;
+C -1 ; WX 834 ; N onequarter ; B 150 -19 802 703 ;
+C -1 ; WX 667 ; N Scaron ; B 90 -19 713 929 ;
+C -1 ; WX 667 ; N Scommaaccent ; B 90 -225 713 737 ;
+C -1 ; WX 778 ; N Ohungarumlaut ; B 105 -19 829 929 ;
+C -1 ; WX 400 ; N degree ; B 169 411 468 703 ;
+C -1 ; WX 556 ; N ograve ; B 83 -14 585 734 ;
+C -1 ; WX 722 ; N Ccaron ; B 108 -19 782 929 ;
+C -1 ; WX 556 ; N ugrave ; B 94 -15 600 734 ;
+C -1 ; WX 453 ; N radical ; B 79 -80 617 762 ;
+C -1 ; WX 722 ; N Dcaron ; B 81 0 764 929 ;
+C -1 ; WX 333 ; N rcommaaccent ; B 30 -225 446 538 ;
+C -1 ; WX 722 ; N Ntilde ; B 76 0 799 917 ;
+C -1 ; WX 556 ; N otilde ; B 83 -14 602 722 ;
+C -1 ; WX 722 ; N Rcommaaccent ; B 88 -225 773 718 ;
+C -1 ; WX 556 ; N Lcommaaccent ; B 76 -225 555 718 ;
+C -1 ; WX 667 ; N Atilde ; B 14 0 699 917 ;
+C -1 ; WX 667 ; N Aogonek ; B 14 -225 654 718 ;
+C -1 ; WX 667 ; N Aring ; B 14 0 654 931 ;
+C -1 ; WX 778 ; N Otilde ; B 105 -19 826 917 ;
+C -1 ; WX 500 ; N zdotaccent ; B 31 0 571 706 ;
+C -1 ; WX 667 ; N Ecaron ; B 86 0 762 929 ;
+C -1 ; WX 278 ; N Iogonek ; B -33 -225 341 718 ;
+C -1 ; WX 500 ; N kcommaaccent ; B 67 -225 600 718 ;
+C -1 ; WX 584 ; N minus ; B 85 216 606 289 ;
+C -1 ; WX 278 ; N Icircumflex ; B 91 0 452 929 ;
+C -1 ; WX 556 ; N ncaron ; B 65 0 580 734 ;
+C -1 ; WX 278 ; N tcommaaccent ; B 63 -225 368 669 ;
+C -1 ; WX 584 ; N logicalnot ; B 106 108 628 390 ;
+C -1 ; WX 556 ; N odieresis ; B 83 -14 585 706 ;
+C -1 ; WX 556 ; N udieresis ; B 94 -15 600 706 ;
+C -1 ; WX 549 ; N notequal ; B 34 -35 623 551 ;
+C -1 ; WX 556 ; N gcommaaccent ; B 42 -220 610 822 ;
+C -1 ; WX 556 ; N eth ; B 81 -15 617 737 ;
+C -1 ; WX 500 ; N zcaron ; B 31 0 571 734 ;
+C -1 ; WX 556 ; N ncommaaccent ; B 65 -225 573 538 ;
+C -1 ; WX 333 ; N onesuperior ; B 166 281 371 703 ;
+C -1 ; WX 278 ; N imacron ; B 95 0 417 684 ;
+C -1 ; WX 556 ; N Euro ; B 0 0 0 0 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 2705
+KPX A C -30
+KPX A Cacute -30
+KPX A Ccaron -30
+KPX A Ccedilla -30
+KPX A G -30
+KPX A Gbreve -30
+KPX A Gcommaaccent -30
+KPX A O -30
+KPX A Oacute -30
+KPX A Ocircumflex -30
+KPX A Odieresis -30
+KPX A Ograve -30
+KPX A Ohungarumlaut -30
+KPX A Omacron -30
+KPX A Oslash -30
+KPX A Otilde -30
+KPX A Q -30
+KPX A T -120
+KPX A Tcaron -120
+KPX A Tcommaaccent -120
+KPX A U -50
+KPX A Uacute -50
+KPX A Ucircumflex -50
+KPX A Udieresis -50
+KPX A Ugrave -50
+KPX A Uhungarumlaut -50
+KPX A Umacron -50
+KPX A Uogonek -50
+KPX A Uring -50
+KPX A V -70
+KPX A W -50
+KPX A Y -100
+KPX A Yacute -100
+KPX A Ydieresis -100
+KPX A u -30
+KPX A uacute -30
+KPX A ucircumflex -30
+KPX A udieresis -30
+KPX A ugrave -30
+KPX A uhungarumlaut -30
+KPX A umacron -30
+KPX A uogonek -30
+KPX A uring -30
+KPX A v -40
+KPX A w -40
+KPX A y -40
+KPX A yacute -40
+KPX A ydieresis -40
+KPX Aacute C -30
+KPX Aacute Cacute -30
+KPX Aacute Ccaron -30
+KPX Aacute Ccedilla -30
+KPX Aacute G -30
+KPX Aacute Gbreve -30
+KPX Aacute Gcommaaccent -30
+KPX Aacute O -30
+KPX Aacute Oacute -30
+KPX Aacute Ocircumflex -30
+KPX Aacute Odieresis -30
+KPX Aacute Ograve -30
+KPX Aacute Ohungarumlaut -30
+KPX Aacute Omacron -30
+KPX Aacute Oslash -30
+KPX Aacute Otilde -30
+KPX Aacute Q -30
+KPX Aacute T -120
+KPX Aacute Tcaron -120
+KPX Aacute Tcommaaccent -120
+KPX Aacute U -50
+KPX Aacute Uacute -50
+KPX Aacute Ucircumflex -50
+KPX Aacute Udieresis -50
+KPX Aacute Ugrave -50
+KPX Aacute Uhungarumlaut -50
+KPX Aacute Umacron -50
+KPX Aacute Uogonek -50
+KPX Aacute Uring -50
+KPX Aacute V -70
+KPX Aacute W -50
+KPX Aacute Y -100
+KPX Aacute Yacute -100
+KPX Aacute Ydieresis -100
+KPX Aacute u -30
+KPX Aacute uacute -30
+KPX Aacute ucircumflex -30
+KPX Aacute udieresis -30
+KPX Aacute ugrave -30
+KPX Aacute uhungarumlaut -30
+KPX Aacute umacron -30
+KPX Aacute uogonek -30
+KPX Aacute uring -30
+KPX Aacute v -40
+KPX Aacute w -40
+KPX Aacute y -40
+KPX Aacute yacute -40
+KPX Aacute ydieresis -40
+KPX Abreve C -30
+KPX Abreve Cacute -30
+KPX Abreve Ccaron -30
+KPX Abreve Ccedilla -30
+KPX Abreve G -30
+KPX Abreve Gbreve -30
+KPX Abreve Gcommaaccent -30
+KPX Abreve O -30
+KPX Abreve Oacute -30
+KPX Abreve Ocircumflex -30
+KPX Abreve Odieresis -30
+KPX Abreve Ograve -30
+KPX Abreve Ohungarumlaut -30
+KPX Abreve Omacron -30
+KPX Abreve Oslash -30
+KPX Abreve Otilde -30
+KPX Abreve Q -30
+KPX Abreve T -120
+KPX Abreve Tcaron -120
+KPX Abreve Tcommaaccent -120
+KPX Abreve U -50
+KPX Abreve Uacute -50
+KPX Abreve Ucircumflex -50
+KPX Abreve Udieresis -50
+KPX Abreve Ugrave -50
+KPX Abreve Uhungarumlaut -50
+KPX Abreve Umacron -50
+KPX Abreve Uogonek -50
+KPX Abreve Uring -50
+KPX Abreve V -70
+KPX Abreve W -50
+KPX Abreve Y -100
+KPX Abreve Yacute -100
+KPX Abreve Ydieresis -100
+KPX Abreve u -30
+KPX Abreve uacute -30
+KPX Abreve ucircumflex -30
+KPX Abreve udieresis -30
+KPX Abreve ugrave -30
+KPX Abreve uhungarumlaut -30
+KPX Abreve umacron -30
+KPX Abreve uogonek -30
+KPX Abreve uring -30
+KPX Abreve v -40
+KPX Abreve w -40
+KPX Abreve y -40
+KPX Abreve yacute -40
+KPX Abreve ydieresis -40
+KPX Acircumflex C -30
+KPX Acircumflex Cacute -30
+KPX Acircumflex Ccaron -30
+KPX Acircumflex Ccedilla -30
+KPX Acircumflex G -30
+KPX Acircumflex Gbreve -30
+KPX Acircumflex Gcommaaccent -30
+KPX Acircumflex O -30
+KPX Acircumflex Oacute -30
+KPX Acircumflex Ocircumflex -30
+KPX Acircumflex Odieresis -30
+KPX Acircumflex Ograve -30
+KPX Acircumflex Ohungarumlaut -30
+KPX Acircumflex Omacron -30
+KPX Acircumflex Oslash -30
+KPX Acircumflex Otilde -30
+KPX Acircumflex Q -30
+KPX Acircumflex T -120
+KPX Acircumflex Tcaron -120
+KPX Acircumflex Tcommaaccent -120
+KPX Acircumflex U -50
+KPX Acircumflex Uacute -50
+KPX Acircumflex Ucircumflex -50
+KPX Acircumflex Udieresis -50
+KPX Acircumflex Ugrave -50
+KPX Acircumflex Uhungarumlaut -50
+KPX Acircumflex Umacron -50
+KPX Acircumflex Uogonek -50
+KPX Acircumflex Uring -50
+KPX Acircumflex V -70
+KPX Acircumflex W -50
+KPX Acircumflex Y -100
+KPX Acircumflex Yacute -100
+KPX Acircumflex Ydieresis -100
+KPX Acircumflex u -30
+KPX Acircumflex uacute -30
+KPX Acircumflex ucircumflex -30
+KPX Acircumflex udieresis -30
+KPX Acircumflex ugrave -30
+KPX Acircumflex uhungarumlaut -30
+KPX Acircumflex umacron -30
+KPX Acircumflex uogonek -30
+KPX Acircumflex uring -30
+KPX Acircumflex v -40
+KPX Acircumflex w -40
+KPX Acircumflex y -40
+KPX Acircumflex yacute -40
+KPX Acircumflex ydieresis -40
+KPX Adieresis C -30
+KPX Adieresis Cacute -30
+KPX Adieresis Ccaron -30
+KPX Adieresis Ccedilla -30
+KPX Adieresis G -30
+KPX Adieresis Gbreve -30
+KPX Adieresis Gcommaaccent -30
+KPX Adieresis O -30
+KPX Adieresis Oacute -30
+KPX Adieresis Ocircumflex -30
+KPX Adieresis Odieresis -30
+KPX Adieresis Ograve -30
+KPX Adieresis Ohungarumlaut -30
+KPX Adieresis Omacron -30
+KPX Adieresis Oslash -30
+KPX Adieresis Otilde -30
+KPX Adieresis Q -30
+KPX Adieresis T -120
+KPX Adieresis Tcaron -120
+KPX Adieresis Tcommaaccent -120
+KPX Adieresis U -50
+KPX Adieresis Uacute -50
+KPX Adieresis Ucircumflex -50
+KPX Adieresis Udieresis -50
+KPX Adieresis Ugrave -50
+KPX Adieresis Uhungarumlaut -50
+KPX Adieresis Umacron -50
+KPX Adieresis Uogonek -50
+KPX Adieresis Uring -50
+KPX Adieresis V -70
+KPX Adieresis W -50
+KPX Adieresis Y -100
+KPX Adieresis Yacute -100
+KPX Adieresis Ydieresis -100
+KPX Adieresis u -30
+KPX Adieresis uacute -30
+KPX Adieresis ucircumflex -30
+KPX Adieresis udieresis -30
+KPX Adieresis ugrave -30
+KPX Adieresis uhungarumlaut -30
+KPX Adieresis umacron -30
+KPX Adieresis uogonek -30
+KPX Adieresis uring -30
+KPX Adieresis v -40
+KPX Adieresis w -40
+KPX Adieresis y -40
+KPX Adieresis yacute -40
+KPX Adieresis ydieresis -40
+KPX Agrave C -30
+KPX Agrave Cacute -30
+KPX Agrave Ccaron -30
+KPX Agrave Ccedilla -30
+KPX Agrave G -30
+KPX Agrave Gbreve -30
+KPX Agrave Gcommaaccent -30
+KPX Agrave O -30
+KPX Agrave Oacute -30
+KPX Agrave Ocircumflex -30
+KPX Agrave Odieresis -30
+KPX Agrave Ograve -30
+KPX Agrave Ohungarumlaut -30
+KPX Agrave Omacron -30
+KPX Agrave Oslash -30
+KPX Agrave Otilde -30
+KPX Agrave Q -30
+KPX Agrave T -120
+KPX Agrave Tcaron -120
+KPX Agrave Tcommaaccent -120
+KPX Agrave U -50
+KPX Agrave Uacute -50
+KPX Agrave Ucircumflex -50
+KPX Agrave Udieresis -50
+KPX Agrave Ugrave -50
+KPX Agrave Uhungarumlaut -50
+KPX Agrave Umacron -50
+KPX Agrave Uogonek -50
+KPX Agrave Uring -50
+KPX Agrave V -70
+KPX Agrave W -50
+KPX Agrave Y -100
+KPX Agrave Yacute -100
+KPX Agrave Ydieresis -100
+KPX Agrave u -30
+KPX Agrave uacute -30
+KPX Agrave ucircumflex -30
+KPX Agrave udieresis -30
+KPX Agrave ugrave -30
+KPX Agrave uhungarumlaut -30
+KPX Agrave umacron -30
+KPX Agrave uogonek -30
+KPX Agrave uring -30
+KPX Agrave v -40
+KPX Agrave w -40
+KPX Agrave y -40
+KPX Agrave yacute -40
+KPX Agrave ydieresis -40
+KPX Amacron C -30
+KPX Amacron Cacute -30
+KPX Amacron Ccaron -30
+KPX Amacron Ccedilla -30
+KPX Amacron G -30
+KPX Amacron Gbreve -30
+KPX Amacron Gcommaaccent -30
+KPX Amacron O -30
+KPX Amacron Oacute -30
+KPX Amacron Ocircumflex -30
+KPX Amacron Odieresis -30
+KPX Amacron Ograve -30
+KPX Amacron Ohungarumlaut -30
+KPX Amacron Omacron -30
+KPX Amacron Oslash -30
+KPX Amacron Otilde -30
+KPX Amacron Q -30
+KPX Amacron T -120
+KPX Amacron Tcaron -120
+KPX Amacron Tcommaaccent -120
+KPX Amacron U -50
+KPX Amacron Uacute -50
+KPX Amacron Ucircumflex -50
+KPX Amacron Udieresis -50
+KPX Amacron Ugrave -50
+KPX Amacron Uhungarumlaut -50
+KPX Amacron Umacron -50
+KPX Amacron Uogonek -50
+KPX Amacron Uring -50
+KPX Amacron V -70
+KPX Amacron W -50
+KPX Amacron Y -100
+KPX Amacron Yacute -100
+KPX Amacron Ydieresis -100
+KPX Amacron u -30
+KPX Amacron uacute -30
+KPX Amacron ucircumflex -30
+KPX Amacron udieresis -30
+KPX Amacron ugrave -30
+KPX Amacron uhungarumlaut -30
+KPX Amacron umacron -30
+KPX Amacron uogonek -30
+KPX Amacron uring -30
+KPX Amacron v -40
+KPX Amacron w -40
+KPX Amacron y -40
+KPX Amacron yacute -40
+KPX Amacron ydieresis -40
+KPX Aogonek C -30
+KPX Aogonek Cacute -30
+KPX Aogonek Ccaron -30
+KPX Aogonek Ccedilla -30
+KPX Aogonek G -30
+KPX Aogonek Gbreve -30
+KPX Aogonek Gcommaaccent -30
+KPX Aogonek O -30
+KPX Aogonek Oacute -30
+KPX Aogonek Ocircumflex -30
+KPX Aogonek Odieresis -30
+KPX Aogonek Ograve -30
+KPX Aogonek Ohungarumlaut -30
+KPX Aogonek Omacron -30
+KPX Aogonek Oslash -30
+KPX Aogonek Otilde -30
+KPX Aogonek Q -30
+KPX Aogonek T -120
+KPX Aogonek Tcaron -120
+KPX Aogonek Tcommaaccent -120
+KPX Aogonek U -50
+KPX Aogonek Uacute -50
+KPX Aogonek Ucircumflex -50
+KPX Aogonek Udieresis -50
+KPX Aogonek Ugrave -50
+KPX Aogonek Uhungarumlaut -50
+KPX Aogonek Umacron -50
+KPX Aogonek Uogonek -50
+KPX Aogonek Uring -50
+KPX Aogonek V -70
+KPX Aogonek W -50
+KPX Aogonek Y -100
+KPX Aogonek Yacute -100
+KPX Aogonek Ydieresis -100
+KPX Aogonek u -30
+KPX Aogonek uacute -30
+KPX Aogonek ucircumflex -30
+KPX Aogonek udieresis -30
+KPX Aogonek ugrave -30
+KPX Aogonek uhungarumlaut -30
+KPX Aogonek umacron -30
+KPX Aogonek uogonek -30
+KPX Aogonek uring -30
+KPX Aogonek v -40
+KPX Aogonek w -40
+KPX Aogonek y -40
+KPX Aogonek yacute -40
+KPX Aogonek ydieresis -40
+KPX Aring C -30
+KPX Aring Cacute -30
+KPX Aring Ccaron -30
+KPX Aring Ccedilla -30
+KPX Aring G -30
+KPX Aring Gbreve -30
+KPX Aring Gcommaaccent -30
+KPX Aring O -30
+KPX Aring Oacute -30
+KPX Aring Ocircumflex -30
+KPX Aring Odieresis -30
+KPX Aring Ograve -30
+KPX Aring Ohungarumlaut -30
+KPX Aring Omacron -30
+KPX Aring Oslash -30
+KPX Aring Otilde -30
+KPX Aring Q -30
+KPX Aring T -120
+KPX Aring Tcaron -120
+KPX Aring Tcommaaccent -120
+KPX Aring U -50
+KPX Aring Uacute -50
+KPX Aring Ucircumflex -50
+KPX Aring Udieresis -50
+KPX Aring Ugrave -50
+KPX Aring Uhungarumlaut -50
+KPX Aring Umacron -50
+KPX Aring Uogonek -50
+KPX Aring Uring -50
+KPX Aring V -70
+KPX Aring W -50
+KPX Aring Y -100
+KPX Aring Yacute -100
+KPX Aring Ydieresis -100
+KPX Aring u -30
+KPX Aring uacute -30
+KPX Aring ucircumflex -30
+KPX Aring udieresis -30
+KPX Aring ugrave -30
+KPX Aring uhungarumlaut -30
+KPX Aring umacron -30
+KPX Aring uogonek -30
+KPX Aring uring -30
+KPX Aring v -40
+KPX Aring w -40
+KPX Aring y -40
+KPX Aring yacute -40
+KPX Aring ydieresis -40
+KPX Atilde C -30
+KPX Atilde Cacute -30
+KPX Atilde Ccaron -30
+KPX Atilde Ccedilla -30
+KPX Atilde G -30
+KPX Atilde Gbreve -30
+KPX Atilde Gcommaaccent -30
+KPX Atilde O -30
+KPX Atilde Oacute -30
+KPX Atilde Ocircumflex -30
+KPX Atilde Odieresis -30
+KPX Atilde Ograve -30
+KPX Atilde Ohungarumlaut -30
+KPX Atilde Omacron -30
+KPX Atilde Oslash -30
+KPX Atilde Otilde -30
+KPX Atilde Q -30
+KPX Atilde T -120
+KPX Atilde Tcaron -120
+KPX Atilde Tcommaaccent -120
+KPX Atilde U -50
+KPX Atilde Uacute -50
+KPX Atilde Ucircumflex -50
+KPX Atilde Udieresis -50
+KPX Atilde Ugrave -50
+KPX Atilde Uhungarumlaut -50
+KPX Atilde Umacron -50
+KPX Atilde Uogonek -50
+KPX Atilde Uring -50
+KPX Atilde V -70
+KPX Atilde W -50
+KPX Atilde Y -100
+KPX Atilde Yacute -100
+KPX Atilde Ydieresis -100
+KPX Atilde u -30
+KPX Atilde uacute -30
+KPX Atilde ucircumflex -30
+KPX Atilde udieresis -30
+KPX Atilde ugrave -30
+KPX Atilde uhungarumlaut -30
+KPX Atilde umacron -30
+KPX Atilde uogonek -30
+KPX Atilde uring -30
+KPX Atilde v -40
+KPX Atilde w -40
+KPX Atilde y -40
+KPX Atilde yacute -40
+KPX Atilde ydieresis -40
+KPX B U -10
+KPX B Uacute -10
+KPX B Ucircumflex -10
+KPX B Udieresis -10
+KPX B Ugrave -10
+KPX B Uhungarumlaut -10
+KPX B Umacron -10
+KPX B Uogonek -10
+KPX B Uring -10
+KPX B comma -20
+KPX B period -20
+KPX C comma -30
+KPX C period -30
+KPX Cacute comma -30
+KPX Cacute period -30
+KPX Ccaron comma -30
+KPX Ccaron period -30
+KPX Ccedilla comma -30
+KPX Ccedilla period -30
+KPX D A -40
+KPX D Aacute -40
+KPX D Abreve -40
+KPX D Acircumflex -40
+KPX D Adieresis -40
+KPX D Agrave -40
+KPX D Amacron -40
+KPX D Aogonek -40
+KPX D Aring -40
+KPX D Atilde -40
+KPX D V -70
+KPX D W -40
+KPX D Y -90
+KPX D Yacute -90
+KPX D Ydieresis -90
+KPX D comma -70
+KPX D period -70
+KPX Dcaron A -40
+KPX Dcaron Aacute -40
+KPX Dcaron Abreve -40
+KPX Dcaron Acircumflex -40
+KPX Dcaron Adieresis -40
+KPX Dcaron Agrave -40
+KPX Dcaron Amacron -40
+KPX Dcaron Aogonek -40
+KPX Dcaron Aring -40
+KPX Dcaron Atilde -40
+KPX Dcaron V -70
+KPX Dcaron W -40
+KPX Dcaron Y -90
+KPX Dcaron Yacute -90
+KPX Dcaron Ydieresis -90
+KPX Dcaron comma -70
+KPX Dcaron period -70
+KPX Dcroat A -40
+KPX Dcroat Aacute -40
+KPX Dcroat Abreve -40
+KPX Dcroat Acircumflex -40
+KPX Dcroat Adieresis -40
+KPX Dcroat Agrave -40
+KPX Dcroat Amacron -40
+KPX Dcroat Aogonek -40
+KPX Dcroat Aring -40
+KPX Dcroat Atilde -40
+KPX Dcroat V -70
+KPX Dcroat W -40
+KPX Dcroat Y -90
+KPX Dcroat Yacute -90
+KPX Dcroat Ydieresis -90
+KPX Dcroat comma -70
+KPX Dcroat period -70
+KPX F A -80
+KPX F Aacute -80
+KPX F Abreve -80
+KPX F Acircumflex -80
+KPX F Adieresis -80
+KPX F Agrave -80
+KPX F Amacron -80
+KPX F Aogonek -80
+KPX F Aring -80
+KPX F Atilde -80
+KPX F a -50
+KPX F aacute -50
+KPX F abreve -50
+KPX F acircumflex -50
+KPX F adieresis -50
+KPX F agrave -50
+KPX F amacron -50
+KPX F aogonek -50
+KPX F aring -50
+KPX F atilde -50
+KPX F comma -150
+KPX F e -30
+KPX F eacute -30
+KPX F ecaron -30
+KPX F ecircumflex -30
+KPX F edieresis -30
+KPX F edotaccent -30
+KPX F egrave -30
+KPX F emacron -30
+KPX F eogonek -30
+KPX F o -30
+KPX F oacute -30
+KPX F ocircumflex -30
+KPX F odieresis -30
+KPX F ograve -30
+KPX F ohungarumlaut -30
+KPX F omacron -30
+KPX F oslash -30
+KPX F otilde -30
+KPX F period -150
+KPX F r -45
+KPX F racute -45
+KPX F rcaron -45
+KPX F rcommaaccent -45
+KPX J A -20
+KPX J Aacute -20
+KPX J Abreve -20
+KPX J Acircumflex -20
+KPX J Adieresis -20
+KPX J Agrave -20
+KPX J Amacron -20
+KPX J Aogonek -20
+KPX J Aring -20
+KPX J Atilde -20
+KPX J a -20
+KPX J aacute -20
+KPX J abreve -20
+KPX J acircumflex -20
+KPX J adieresis -20
+KPX J agrave -20
+KPX J amacron -20
+KPX J aogonek -20
+KPX J aring -20
+KPX J atilde -20
+KPX J comma -30
+KPX J period -30
+KPX J u -20
+KPX J uacute -20
+KPX J ucircumflex -20
+KPX J udieresis -20
+KPX J ugrave -20
+KPX J uhungarumlaut -20
+KPX J umacron -20
+KPX J uogonek -20
+KPX J uring -20
+KPX K O -50
+KPX K Oacute -50
+KPX K Ocircumflex -50
+KPX K Odieresis -50
+KPX K Ograve -50
+KPX K Ohungarumlaut -50
+KPX K Omacron -50
+KPX K Oslash -50
+KPX K Otilde -50
+KPX K e -40
+KPX K eacute -40
+KPX K ecaron -40
+KPX K ecircumflex -40
+KPX K edieresis -40
+KPX K edotaccent -40
+KPX K egrave -40
+KPX K emacron -40
+KPX K eogonek -40
+KPX K o -40
+KPX K oacute -40
+KPX K ocircumflex -40
+KPX K odieresis -40
+KPX K ograve -40
+KPX K ohungarumlaut -40
+KPX K omacron -40
+KPX K oslash -40
+KPX K otilde -40
+KPX K u -30
+KPX K uacute -30
+KPX K ucircumflex -30
+KPX K udieresis -30
+KPX K ugrave -30
+KPX K uhungarumlaut -30
+KPX K umacron -30
+KPX K uogonek -30
+KPX K uring -30
+KPX K y -50
+KPX K yacute -50
+KPX K ydieresis -50
+KPX Kcommaaccent O -50
+KPX Kcommaaccent Oacute -50
+KPX Kcommaaccent Ocircumflex -50
+KPX Kcommaaccent Odieresis -50
+KPX Kcommaaccent Ograve -50
+KPX Kcommaaccent Ohungarumlaut -50
+KPX Kcommaaccent Omacron -50
+KPX Kcommaaccent Oslash -50
+KPX Kcommaaccent Otilde -50
+KPX Kcommaaccent e -40
+KPX Kcommaaccent eacute -40
+KPX Kcommaaccent ecaron -40
+KPX Kcommaaccent ecircumflex -40
+KPX Kcommaaccent edieresis -40
+KPX Kcommaaccent edotaccent -40
+KPX Kcommaaccent egrave -40
+KPX Kcommaaccent emacron -40
+KPX Kcommaaccent eogonek -40
+KPX Kcommaaccent o -40
+KPX Kcommaaccent oacute -40
+KPX Kcommaaccent ocircumflex -40
+KPX Kcommaaccent odieresis -40
+KPX Kcommaaccent ograve -40
+KPX Kcommaaccent ohungarumlaut -40
+KPX Kcommaaccent omacron -40
+KPX Kcommaaccent oslash -40
+KPX Kcommaaccent otilde -40
+KPX Kcommaaccent u -30
+KPX Kcommaaccent uacute -30
+KPX Kcommaaccent ucircumflex -30
+KPX Kcommaaccent udieresis -30
+KPX Kcommaaccent ugrave -30
+KPX Kcommaaccent uhungarumlaut -30
+KPX Kcommaaccent umacron -30
+KPX Kcommaaccent uogonek -30
+KPX Kcommaaccent uring -30
+KPX Kcommaaccent y -50
+KPX Kcommaaccent yacute -50
+KPX Kcommaaccent ydieresis -50
+KPX L T -110
+KPX L Tcaron -110
+KPX L Tcommaaccent -110
+KPX L V -110
+KPX L W -70
+KPX L Y -140
+KPX L Yacute -140
+KPX L Ydieresis -140
+KPX L quotedblright -140
+KPX L quoteright -160
+KPX L y -30
+KPX L yacute -30
+KPX L ydieresis -30
+KPX Lacute T -110
+KPX Lacute Tcaron -110
+KPX Lacute Tcommaaccent -110
+KPX Lacute V -110
+KPX Lacute W -70
+KPX Lacute Y -140
+KPX Lacute Yacute -140
+KPX Lacute Ydieresis -140
+KPX Lacute quotedblright -140
+KPX Lacute quoteright -160
+KPX Lacute y -30
+KPX Lacute yacute -30
+KPX Lacute ydieresis -30
+KPX Lcaron T -110
+KPX Lcaron Tcaron -110
+KPX Lcaron Tcommaaccent -110
+KPX Lcaron V -110
+KPX Lcaron W -70
+KPX Lcaron Y -140
+KPX Lcaron Yacute -140
+KPX Lcaron Ydieresis -140
+KPX Lcaron quotedblright -140
+KPX Lcaron quoteright -160
+KPX Lcaron y -30
+KPX Lcaron yacute -30
+KPX Lcaron ydieresis -30
+KPX Lcommaaccent T -110
+KPX Lcommaaccent Tcaron -110
+KPX Lcommaaccent Tcommaaccent -110
+KPX Lcommaaccent V -110
+KPX Lcommaaccent W -70
+KPX Lcommaaccent Y -140
+KPX Lcommaaccent Yacute -140
+KPX Lcommaaccent Ydieresis -140
+KPX Lcommaaccent quotedblright -140
+KPX Lcommaaccent quoteright -160
+KPX Lcommaaccent y -30
+KPX Lcommaaccent yacute -30
+KPX Lcommaaccent ydieresis -30
+KPX Lslash T -110
+KPX Lslash Tcaron -110
+KPX Lslash Tcommaaccent -110
+KPX Lslash V -110
+KPX Lslash W -70
+KPX Lslash Y -140
+KPX Lslash Yacute -140
+KPX Lslash Ydieresis -140
+KPX Lslash quotedblright -140
+KPX Lslash quoteright -160
+KPX Lslash y -30
+KPX Lslash yacute -30
+KPX Lslash ydieresis -30
+KPX O A -20
+KPX O Aacute -20
+KPX O Abreve -20
+KPX O Acircumflex -20
+KPX O Adieresis -20
+KPX O Agrave -20
+KPX O Amacron -20
+KPX O Aogonek -20
+KPX O Aring -20
+KPX O Atilde -20
+KPX O T -40
+KPX O Tcaron -40
+KPX O Tcommaaccent -40
+KPX O V -50
+KPX O W -30
+KPX O X -60
+KPX O Y -70
+KPX O Yacute -70
+KPX O Ydieresis -70
+KPX O comma -40
+KPX O period -40
+KPX Oacute A -20
+KPX Oacute Aacute -20
+KPX Oacute Abreve -20
+KPX Oacute Acircumflex -20
+KPX Oacute Adieresis -20
+KPX Oacute Agrave -20
+KPX Oacute Amacron -20
+KPX Oacute Aogonek -20
+KPX Oacute Aring -20
+KPX Oacute Atilde -20
+KPX Oacute T -40
+KPX Oacute Tcaron -40
+KPX Oacute Tcommaaccent -40
+KPX Oacute V -50
+KPX Oacute W -30
+KPX Oacute X -60
+KPX Oacute Y -70
+KPX Oacute Yacute -70
+KPX Oacute Ydieresis -70
+KPX Oacute comma -40
+KPX Oacute period -40
+KPX Ocircumflex A -20
+KPX Ocircumflex Aacute -20
+KPX Ocircumflex Abreve -20
+KPX Ocircumflex Acircumflex -20
+KPX Ocircumflex Adieresis -20
+KPX Ocircumflex Agrave -20
+KPX Ocircumflex Amacron -20
+KPX Ocircumflex Aogonek -20
+KPX Ocircumflex Aring -20
+KPX Ocircumflex Atilde -20
+KPX Ocircumflex T -40
+KPX Ocircumflex Tcaron -40
+KPX Ocircumflex Tcommaaccent -40
+KPX Ocircumflex V -50
+KPX Ocircumflex W -30
+KPX Ocircumflex X -60
+KPX Ocircumflex Y -70
+KPX Ocircumflex Yacute -70
+KPX Ocircumflex Ydieresis -70
+KPX Ocircumflex comma -40
+KPX Ocircumflex period -40
+KPX Odieresis A -20
+KPX Odieresis Aacute -20
+KPX Odieresis Abreve -20
+KPX Odieresis Acircumflex -20
+KPX Odieresis Adieresis -20
+KPX Odieresis Agrave -20
+KPX Odieresis Amacron -20
+KPX Odieresis Aogonek -20
+KPX Odieresis Aring -20
+KPX Odieresis Atilde -20
+KPX Odieresis T -40
+KPX Odieresis Tcaron -40
+KPX Odieresis Tcommaaccent -40
+KPX Odieresis V -50
+KPX Odieresis W -30
+KPX Odieresis X -60
+KPX Odieresis Y -70
+KPX Odieresis Yacute -70
+KPX Odieresis Ydieresis -70
+KPX Odieresis comma -40
+KPX Odieresis period -40
+KPX Ograve A -20
+KPX Ograve Aacute -20
+KPX Ograve Abreve -20
+KPX Ograve Acircumflex -20
+KPX Ograve Adieresis -20
+KPX Ograve Agrave -20
+KPX Ograve Amacron -20
+KPX Ograve Aogonek -20
+KPX Ograve Aring -20
+KPX Ograve Atilde -20
+KPX Ograve T -40
+KPX Ograve Tcaron -40
+KPX Ograve Tcommaaccent -40
+KPX Ograve V -50
+KPX Ograve W -30
+KPX Ograve X -60
+KPX Ograve Y -70
+KPX Ograve Yacute -70
+KPX Ograve Ydieresis -70
+KPX Ograve comma -40
+KPX Ograve period -40
+KPX Ohungarumlaut A -20
+KPX Ohungarumlaut Aacute -20
+KPX Ohungarumlaut Abreve -20
+KPX Ohungarumlaut Acircumflex -20
+KPX Ohungarumlaut Adieresis -20
+KPX Ohungarumlaut Agrave -20
+KPX Ohungarumlaut Amacron -20
+KPX Ohungarumlaut Aogonek -20
+KPX Ohungarumlaut Aring -20
+KPX Ohungarumlaut Atilde -20
+KPX Ohungarumlaut T -40
+KPX Ohungarumlaut Tcaron -40
+KPX Ohungarumlaut Tcommaaccent -40
+KPX Ohungarumlaut V -50
+KPX Ohungarumlaut W -30
+KPX Ohungarumlaut X -60
+KPX Ohungarumlaut Y -70
+KPX Ohungarumlaut Yacute -70
+KPX Ohungarumlaut Ydieresis -70
+KPX Ohungarumlaut comma -40
+KPX Ohungarumlaut period -40
+KPX Omacron A -20
+KPX Omacron Aacute -20
+KPX Omacron Abreve -20
+KPX Omacron Acircumflex -20
+KPX Omacron Adieresis -20
+KPX Omacron Agrave -20
+KPX Omacron Amacron -20
+KPX Omacron Aogonek -20
+KPX Omacron Aring -20
+KPX Omacron Atilde -20
+KPX Omacron T -40
+KPX Omacron Tcaron -40
+KPX Omacron Tcommaaccent -40
+KPX Omacron V -50
+KPX Omacron W -30
+KPX Omacron X -60
+KPX Omacron Y -70
+KPX Omacron Yacute -70
+KPX Omacron Ydieresis -70
+KPX Omacron comma -40
+KPX Omacron period -40
+KPX Oslash A -20
+KPX Oslash Aacute -20
+KPX Oslash Abreve -20
+KPX Oslash Acircumflex -20
+KPX Oslash Adieresis -20
+KPX Oslash Agrave -20
+KPX Oslash Amacron -20
+KPX Oslash Aogonek -20
+KPX Oslash Aring -20
+KPX Oslash Atilde -20
+KPX Oslash T -40
+KPX Oslash Tcaron -40
+KPX Oslash Tcommaaccent -40
+KPX Oslash V -50
+KPX Oslash W -30
+KPX Oslash X -60
+KPX Oslash Y -70
+KPX Oslash Yacute -70
+KPX Oslash Ydieresis -70
+KPX Oslash comma -40
+KPX Oslash period -40
+KPX Otilde A -20
+KPX Otilde Aacute -20
+KPX Otilde Abreve -20
+KPX Otilde Acircumflex -20
+KPX Otilde Adieresis -20
+KPX Otilde Agrave -20
+KPX Otilde Amacron -20
+KPX Otilde Aogonek -20
+KPX Otilde Aring -20
+KPX Otilde Atilde -20
+KPX Otilde T -40
+KPX Otilde Tcaron -40
+KPX Otilde Tcommaaccent -40
+KPX Otilde V -50
+KPX Otilde W -30
+KPX Otilde X -60
+KPX Otilde Y -70
+KPX Otilde Yacute -70
+KPX Otilde Ydieresis -70
+KPX Otilde comma -40
+KPX Otilde period -40
+KPX P A -120
+KPX P Aacute -120
+KPX P Abreve -120
+KPX P Acircumflex -120
+KPX P Adieresis -120
+KPX P Agrave -120
+KPX P Amacron -120
+KPX P Aogonek -120
+KPX P Aring -120
+KPX P Atilde -120
+KPX P a -40
+KPX P aacute -40
+KPX P abreve -40
+KPX P acircumflex -40
+KPX P adieresis -40
+KPX P agrave -40
+KPX P amacron -40
+KPX P aogonek -40
+KPX P aring -40
+KPX P atilde -40
+KPX P comma -180
+KPX P e -50
+KPX P eacute -50
+KPX P ecaron -50
+KPX P ecircumflex -50
+KPX P edieresis -50
+KPX P edotaccent -50
+KPX P egrave -50
+KPX P emacron -50
+KPX P eogonek -50
+KPX P o -50
+KPX P oacute -50
+KPX P ocircumflex -50
+KPX P odieresis -50
+KPX P ograve -50
+KPX P ohungarumlaut -50
+KPX P omacron -50
+KPX P oslash -50
+KPX P otilde -50
+KPX P period -180
+KPX Q U -10
+KPX Q Uacute -10
+KPX Q Ucircumflex -10
+KPX Q Udieresis -10
+KPX Q Ugrave -10
+KPX Q Uhungarumlaut -10
+KPX Q Umacron -10
+KPX Q Uogonek -10
+KPX Q Uring -10
+KPX R O -20
+KPX R Oacute -20
+KPX R Ocircumflex -20
+KPX R Odieresis -20
+KPX R Ograve -20
+KPX R Ohungarumlaut -20
+KPX R Omacron -20
+KPX R Oslash -20
+KPX R Otilde -20
+KPX R T -30
+KPX R Tcaron -30
+KPX R Tcommaaccent -30
+KPX R U -40
+KPX R Uacute -40
+KPX R Ucircumflex -40
+KPX R Udieresis -40
+KPX R Ugrave -40
+KPX R Uhungarumlaut -40
+KPX R Umacron -40
+KPX R Uogonek -40
+KPX R Uring -40
+KPX R V -50
+KPX R W -30
+KPX R Y -50
+KPX R Yacute -50
+KPX R Ydieresis -50
+KPX Racute O -20
+KPX Racute Oacute -20
+KPX Racute Ocircumflex -20
+KPX Racute Odieresis -20
+KPX Racute Ograve -20
+KPX Racute Ohungarumlaut -20
+KPX Racute Omacron -20
+KPX Racute Oslash -20
+KPX Racute Otilde -20
+KPX Racute T -30
+KPX Racute Tcaron -30
+KPX Racute Tcommaaccent -30
+KPX Racute U -40
+KPX Racute Uacute -40
+KPX Racute Ucircumflex -40
+KPX Racute Udieresis -40
+KPX Racute Ugrave -40
+KPX Racute Uhungarumlaut -40
+KPX Racute Umacron -40
+KPX Racute Uogonek -40
+KPX Racute Uring -40
+KPX Racute V -50
+KPX Racute W -30
+KPX Racute Y -50
+KPX Racute Yacute -50
+KPX Racute Ydieresis -50
+KPX Rcaron O -20
+KPX Rcaron Oacute -20
+KPX Rcaron Ocircumflex -20
+KPX Rcaron Odieresis -20
+KPX Rcaron Ograve -20
+KPX Rcaron Ohungarumlaut -20
+KPX Rcaron Omacron -20
+KPX Rcaron Oslash -20
+KPX Rcaron Otilde -20
+KPX Rcaron T -30
+KPX Rcaron Tcaron -30
+KPX Rcaron Tcommaaccent -30
+KPX Rcaron U -40
+KPX Rcaron Uacute -40
+KPX Rcaron Ucircumflex -40
+KPX Rcaron Udieresis -40
+KPX Rcaron Ugrave -40
+KPX Rcaron Uhungarumlaut -40
+KPX Rcaron Umacron -40
+KPX Rcaron Uogonek -40
+KPX Rcaron Uring -40
+KPX Rcaron V -50
+KPX Rcaron W -30
+KPX Rcaron Y -50
+KPX Rcaron Yacute -50
+KPX Rcaron Ydieresis -50
+KPX Rcommaaccent O -20
+KPX Rcommaaccent Oacute -20
+KPX Rcommaaccent Ocircumflex -20
+KPX Rcommaaccent Odieresis -20
+KPX Rcommaaccent Ograve -20
+KPX Rcommaaccent Ohungarumlaut -20
+KPX Rcommaaccent Omacron -20
+KPX Rcommaaccent Oslash -20
+KPX Rcommaaccent Otilde -20
+KPX Rcommaaccent T -30
+KPX Rcommaaccent Tcaron -30
+KPX Rcommaaccent Tcommaaccent -30
+KPX Rcommaaccent U -40
+KPX Rcommaaccent Uacute -40
+KPX Rcommaaccent Ucircumflex -40
+KPX Rcommaaccent Udieresis -40
+KPX Rcommaaccent Ugrave -40
+KPX Rcommaaccent Uhungarumlaut -40
+KPX Rcommaaccent Umacron -40
+KPX Rcommaaccent Uogonek -40
+KPX Rcommaaccent Uring -40
+KPX Rcommaaccent V -50
+KPX Rcommaaccent W -30
+KPX Rcommaaccent Y -50
+KPX Rcommaaccent Yacute -50
+KPX Rcommaaccent Ydieresis -50
+KPX S comma -20
+KPX S period -20
+KPX Sacute comma -20
+KPX Sacute period -20
+KPX Scaron comma -20
+KPX Scaron period -20
+KPX Scedilla comma -20
+KPX Scedilla period -20
+KPX Scommaaccent comma -20
+KPX Scommaaccent period -20
+KPX T A -120
+KPX T Aacute -120
+KPX T Abreve -120
+KPX T Acircumflex -120
+KPX T Adieresis -120
+KPX T Agrave -120
+KPX T Amacron -120
+KPX T Aogonek -120
+KPX T Aring -120
+KPX T Atilde -120
+KPX T O -40
+KPX T Oacute -40
+KPX T Ocircumflex -40
+KPX T Odieresis -40
+KPX T Ograve -40
+KPX T Ohungarumlaut -40
+KPX T Omacron -40
+KPX T Oslash -40
+KPX T Otilde -40
+KPX T a -120
+KPX T aacute -120
+KPX T abreve -60
+KPX T acircumflex -120
+KPX T adieresis -120
+KPX T agrave -120
+KPX T amacron -60
+KPX T aogonek -120
+KPX T aring -120
+KPX T atilde -60
+KPX T colon -20
+KPX T comma -120
+KPX T e -120
+KPX T eacute -120
+KPX T ecaron -120
+KPX T ecircumflex -120
+KPX T edieresis -120
+KPX T edotaccent -120
+KPX T egrave -60
+KPX T emacron -60
+KPX T eogonek -120
+KPX T hyphen -140
+KPX T o -120
+KPX T oacute -120
+KPX T ocircumflex -120
+KPX T odieresis -120
+KPX T ograve -120
+KPX T ohungarumlaut -120
+KPX T omacron -60
+KPX T oslash -120
+KPX T otilde -60
+KPX T period -120
+KPX T r -120
+KPX T racute -120
+KPX T rcaron -120
+KPX T rcommaaccent -120
+KPX T semicolon -20
+KPX T u -120
+KPX T uacute -120
+KPX T ucircumflex -120
+KPX T udieresis -120
+KPX T ugrave -120
+KPX T uhungarumlaut -120
+KPX T umacron -60
+KPX T uogonek -120
+KPX T uring -120
+KPX T w -120
+KPX T y -120
+KPX T yacute -120
+KPX T ydieresis -60
+KPX Tcaron A -120
+KPX Tcaron Aacute -120
+KPX Tcaron Abreve -120
+KPX Tcaron Acircumflex -120
+KPX Tcaron Adieresis -120
+KPX Tcaron Agrave -120
+KPX Tcaron Amacron -120
+KPX Tcaron Aogonek -120
+KPX Tcaron Aring -120
+KPX Tcaron Atilde -120
+KPX Tcaron O -40
+KPX Tcaron Oacute -40
+KPX Tcaron Ocircumflex -40
+KPX Tcaron Odieresis -40
+KPX Tcaron Ograve -40
+KPX Tcaron Ohungarumlaut -40
+KPX Tcaron Omacron -40
+KPX Tcaron Oslash -40
+KPX Tcaron Otilde -40
+KPX Tcaron a -120
+KPX Tcaron aacute -120
+KPX Tcaron abreve -60
+KPX Tcaron acircumflex -120
+KPX Tcaron adieresis -120
+KPX Tcaron agrave -120
+KPX Tcaron amacron -60
+KPX Tcaron aogonek -120
+KPX Tcaron aring -120
+KPX Tcaron atilde -60
+KPX Tcaron colon -20
+KPX Tcaron comma -120
+KPX Tcaron e -120
+KPX Tcaron eacute -120
+KPX Tcaron ecaron -120
+KPX Tcaron ecircumflex -120
+KPX Tcaron edieresis -120
+KPX Tcaron edotaccent -120
+KPX Tcaron egrave -60
+KPX Tcaron emacron -60
+KPX Tcaron eogonek -120
+KPX Tcaron hyphen -140
+KPX Tcaron o -120
+KPX Tcaron oacute -120
+KPX Tcaron ocircumflex -120
+KPX Tcaron odieresis -120
+KPX Tcaron ograve -120
+KPX Tcaron ohungarumlaut -120
+KPX Tcaron omacron -60
+KPX Tcaron oslash -120
+KPX Tcaron otilde -60
+KPX Tcaron period -120
+KPX Tcaron r -120
+KPX Tcaron racute -120
+KPX Tcaron rcaron -120
+KPX Tcaron rcommaaccent -120
+KPX Tcaron semicolon -20
+KPX Tcaron u -120
+KPX Tcaron uacute -120
+KPX Tcaron ucircumflex -120
+KPX Tcaron udieresis -120
+KPX Tcaron ugrave -120
+KPX Tcaron uhungarumlaut -120
+KPX Tcaron umacron -60
+KPX Tcaron uogonek -120
+KPX Tcaron uring -120
+KPX Tcaron w -120
+KPX Tcaron y -120
+KPX Tcaron yacute -120
+KPX Tcaron ydieresis -60
+KPX Tcommaaccent A -120
+KPX Tcommaaccent Aacute -120
+KPX Tcommaaccent Abreve -120
+KPX Tcommaaccent Acircumflex -120
+KPX Tcommaaccent Adieresis -120
+KPX Tcommaaccent Agrave -120
+KPX Tcommaaccent Amacron -120
+KPX Tcommaaccent Aogonek -120
+KPX Tcommaaccent Aring -120
+KPX Tcommaaccent Atilde -120
+KPX Tcommaaccent O -40
+KPX Tcommaaccent Oacute -40
+KPX Tcommaaccent Ocircumflex -40
+KPX Tcommaaccent Odieresis -40
+KPX Tcommaaccent Ograve -40
+KPX Tcommaaccent Ohungarumlaut -40
+KPX Tcommaaccent Omacron -40
+KPX Tcommaaccent Oslash -40
+KPX Tcommaaccent Otilde -40
+KPX Tcommaaccent a -120
+KPX Tcommaaccent aacute -120
+KPX Tcommaaccent abreve -60
+KPX Tcommaaccent acircumflex -120
+KPX Tcommaaccent adieresis -120
+KPX Tcommaaccent agrave -120
+KPX Tcommaaccent amacron -60
+KPX Tcommaaccent aogonek -120
+KPX Tcommaaccent aring -120
+KPX Tcommaaccent atilde -60
+KPX Tcommaaccent colon -20
+KPX Tcommaaccent comma -120
+KPX Tcommaaccent e -120
+KPX Tcommaaccent eacute -120
+KPX Tcommaaccent ecaron -120
+KPX Tcommaaccent ecircumflex -120
+KPX Tcommaaccent edieresis -120
+KPX Tcommaaccent edotaccent -120
+KPX Tcommaaccent egrave -60
+KPX Tcommaaccent emacron -60
+KPX Tcommaaccent eogonek -120
+KPX Tcommaaccent hyphen -140
+KPX Tcommaaccent o -120
+KPX Tcommaaccent oacute -120
+KPX Tcommaaccent ocircumflex -120
+KPX Tcommaaccent odieresis -120
+KPX Tcommaaccent ograve -120
+KPX Tcommaaccent ohungarumlaut -120
+KPX Tcommaaccent omacron -60
+KPX Tcommaaccent oslash -120
+KPX Tcommaaccent otilde -60
+KPX Tcommaaccent period -120
+KPX Tcommaaccent r -120
+KPX Tcommaaccent racute -120
+KPX Tcommaaccent rcaron -120
+KPX Tcommaaccent rcommaaccent -120
+KPX Tcommaaccent semicolon -20
+KPX Tcommaaccent u -120
+KPX Tcommaaccent uacute -120
+KPX Tcommaaccent ucircumflex -120
+KPX Tcommaaccent udieresis -120
+KPX Tcommaaccent ugrave -120
+KPX Tcommaaccent uhungarumlaut -120
+KPX Tcommaaccent umacron -60
+KPX Tcommaaccent uogonek -120
+KPX Tcommaaccent uring -120
+KPX Tcommaaccent w -120
+KPX Tcommaaccent y -120
+KPX Tcommaaccent yacute -120
+KPX Tcommaaccent ydieresis -60
+KPX U A -40
+KPX U Aacute -40
+KPX U Abreve -40
+KPX U Acircumflex -40
+KPX U Adieresis -40
+KPX U Agrave -40
+KPX U Amacron -40
+KPX U Aogonek -40
+KPX U Aring -40
+KPX U Atilde -40
+KPX U comma -40
+KPX U period -40
+KPX Uacute A -40
+KPX Uacute Aacute -40
+KPX Uacute Abreve -40
+KPX Uacute Acircumflex -40
+KPX Uacute Adieresis -40
+KPX Uacute Agrave -40
+KPX Uacute Amacron -40
+KPX Uacute Aogonek -40
+KPX Uacute Aring -40
+KPX Uacute Atilde -40
+KPX Uacute comma -40
+KPX Uacute period -40
+KPX Ucircumflex A -40
+KPX Ucircumflex Aacute -40
+KPX Ucircumflex Abreve -40
+KPX Ucircumflex Acircumflex -40
+KPX Ucircumflex Adieresis -40
+KPX Ucircumflex Agrave -40
+KPX Ucircumflex Amacron -40
+KPX Ucircumflex Aogonek -40
+KPX Ucircumflex Aring -40
+KPX Ucircumflex Atilde -40
+KPX Ucircumflex comma -40
+KPX Ucircumflex period -40
+KPX Udieresis A -40
+KPX Udieresis Aacute -40
+KPX Udieresis Abreve -40
+KPX Udieresis Acircumflex -40
+KPX Udieresis Adieresis -40
+KPX Udieresis Agrave -40
+KPX Udieresis Amacron -40
+KPX Udieresis Aogonek -40
+KPX Udieresis Aring -40
+KPX Udieresis Atilde -40
+KPX Udieresis comma -40
+KPX Udieresis period -40
+KPX Ugrave A -40
+KPX Ugrave Aacute -40
+KPX Ugrave Abreve -40
+KPX Ugrave Acircumflex -40
+KPX Ugrave Adieresis -40
+KPX Ugrave Agrave -40
+KPX Ugrave Amacron -40
+KPX Ugrave Aogonek -40
+KPX Ugrave Aring -40
+KPX Ugrave Atilde -40
+KPX Ugrave comma -40
+KPX Ugrave period -40
+KPX Uhungarumlaut A -40
+KPX Uhungarumlaut Aacute -40
+KPX Uhungarumlaut Abreve -40
+KPX Uhungarumlaut Acircumflex -40
+KPX Uhungarumlaut Adieresis -40
+KPX Uhungarumlaut Agrave -40
+KPX Uhungarumlaut Amacron -40
+KPX Uhungarumlaut Aogonek -40
+KPX Uhungarumlaut Aring -40
+KPX Uhungarumlaut Atilde -40
+KPX Uhungarumlaut comma -40
+KPX Uhungarumlaut period -40
+KPX Umacron A -40
+KPX Umacron Aacute -40
+KPX Umacron Abreve -40
+KPX Umacron Acircumflex -40
+KPX Umacron Adieresis -40
+KPX Umacron Agrave -40
+KPX Umacron Amacron -40
+KPX Umacron Aogonek -40
+KPX Umacron Aring -40
+KPX Umacron Atilde -40
+KPX Umacron comma -40
+KPX Umacron period -40
+KPX Uogonek A -40
+KPX Uogonek Aacute -40
+KPX Uogonek Abreve -40
+KPX Uogonek Acircumflex -40
+KPX Uogonek Adieresis -40
+KPX Uogonek Agrave -40
+KPX Uogonek Amacron -40
+KPX Uogonek Aogonek -40
+KPX Uogonek Aring -40
+KPX Uogonek Atilde -40
+KPX Uogonek comma -40
+KPX Uogonek period -40
+KPX Uring A -40
+KPX Uring Aacute -40
+KPX Uring Abreve -40
+KPX Uring Acircumflex -40
+KPX Uring Adieresis -40
+KPX Uring Agrave -40
+KPX Uring Amacron -40
+KPX Uring Aogonek -40
+KPX Uring Aring -40
+KPX Uring Atilde -40
+KPX Uring comma -40
+KPX Uring period -40
+KPX V A -80
+KPX V Aacute -80
+KPX V Abreve -80
+KPX V Acircumflex -80
+KPX V Adieresis -80
+KPX V Agrave -80
+KPX V Amacron -80
+KPX V Aogonek -80
+KPX V Aring -80
+KPX V Atilde -80
+KPX V G -40
+KPX V Gbreve -40
+KPX V Gcommaaccent -40
+KPX V O -40
+KPX V Oacute -40
+KPX V Ocircumflex -40
+KPX V Odieresis -40
+KPX V Ograve -40
+KPX V Ohungarumlaut -40
+KPX V Omacron -40
+KPX V Oslash -40
+KPX V Otilde -40
+KPX V a -70
+KPX V aacute -70
+KPX V abreve -70
+KPX V acircumflex -70
+KPX V adieresis -70
+KPX V agrave -70
+KPX V amacron -70
+KPX V aogonek -70
+KPX V aring -70
+KPX V atilde -70
+KPX V colon -40
+KPX V comma -125
+KPX V e -80
+KPX V eacute -80
+KPX V ecaron -80
+KPX V ecircumflex -80
+KPX V edieresis -80
+KPX V edotaccent -80
+KPX V egrave -80
+KPX V emacron -80
+KPX V eogonek -80
+KPX V hyphen -80
+KPX V o -80
+KPX V oacute -80
+KPX V ocircumflex -80
+KPX V odieresis -80
+KPX V ograve -80
+KPX V ohungarumlaut -80
+KPX V omacron -80
+KPX V oslash -80
+KPX V otilde -80
+KPX V period -125
+KPX V semicolon -40
+KPX V u -70
+KPX V uacute -70
+KPX V ucircumflex -70
+KPX V udieresis -70
+KPX V ugrave -70
+KPX V uhungarumlaut -70
+KPX V umacron -70
+KPX V uogonek -70
+KPX V uring -70
+KPX W A -50
+KPX W Aacute -50
+KPX W Abreve -50
+KPX W Acircumflex -50
+KPX W Adieresis -50
+KPX W Agrave -50
+KPX W Amacron -50
+KPX W Aogonek -50
+KPX W Aring -50
+KPX W Atilde -50
+KPX W O -20
+KPX W Oacute -20
+KPX W Ocircumflex -20
+KPX W Odieresis -20
+KPX W Ograve -20
+KPX W Ohungarumlaut -20
+KPX W Omacron -20
+KPX W Oslash -20
+KPX W Otilde -20
+KPX W a -40
+KPX W aacute -40
+KPX W abreve -40
+KPX W acircumflex -40
+KPX W adieresis -40
+KPX W agrave -40
+KPX W amacron -40
+KPX W aogonek -40
+KPX W aring -40
+KPX W atilde -40
+KPX W comma -80
+KPX W e -30
+KPX W eacute -30
+KPX W ecaron -30
+KPX W ecircumflex -30
+KPX W edieresis -30
+KPX W edotaccent -30
+KPX W egrave -30
+KPX W emacron -30
+KPX W eogonek -30
+KPX W hyphen -40
+KPX W o -30
+KPX W oacute -30
+KPX W ocircumflex -30
+KPX W odieresis -30
+KPX W ograve -30
+KPX W ohungarumlaut -30
+KPX W omacron -30
+KPX W oslash -30
+KPX W otilde -30
+KPX W period -80
+KPX W u -30
+KPX W uacute -30
+KPX W ucircumflex -30
+KPX W udieresis -30
+KPX W ugrave -30
+KPX W uhungarumlaut -30
+KPX W umacron -30
+KPX W uogonek -30
+KPX W uring -30
+KPX W y -20
+KPX W yacute -20
+KPX W ydieresis -20
+KPX Y A -110
+KPX Y Aacute -110
+KPX Y Abreve -110
+KPX Y Acircumflex -110
+KPX Y Adieresis -110
+KPX Y Agrave -110
+KPX Y Amacron -110
+KPX Y Aogonek -110
+KPX Y Aring -110
+KPX Y Atilde -110
+KPX Y O -85
+KPX Y Oacute -85
+KPX Y Ocircumflex -85
+KPX Y Odieresis -85
+KPX Y Ograve -85
+KPX Y Ohungarumlaut -85
+KPX Y Omacron -85
+KPX Y Oslash -85
+KPX Y Otilde -85
+KPX Y a -140
+KPX Y aacute -140
+KPX Y abreve -70
+KPX Y acircumflex -140
+KPX Y adieresis -140
+KPX Y agrave -140
+KPX Y amacron -70
+KPX Y aogonek -140
+KPX Y aring -140
+KPX Y atilde -140
+KPX Y colon -60
+KPX Y comma -140
+KPX Y e -140
+KPX Y eacute -140
+KPX Y ecaron -140
+KPX Y ecircumflex -140
+KPX Y edieresis -140
+KPX Y edotaccent -140
+KPX Y egrave -140
+KPX Y emacron -70
+KPX Y eogonek -140
+KPX Y hyphen -140
+KPX Y i -20
+KPX Y iacute -20
+KPX Y iogonek -20
+KPX Y o -140
+KPX Y oacute -140
+KPX Y ocircumflex -140
+KPX Y odieresis -140
+KPX Y ograve -140
+KPX Y ohungarumlaut -140
+KPX Y omacron -140
+KPX Y oslash -140
+KPX Y otilde -140
+KPX Y period -140
+KPX Y semicolon -60
+KPX Y u -110
+KPX Y uacute -110
+KPX Y ucircumflex -110
+KPX Y udieresis -110
+KPX Y ugrave -110
+KPX Y uhungarumlaut -110
+KPX Y umacron -110
+KPX Y uogonek -110
+KPX Y uring -110
+KPX Yacute A -110
+KPX Yacute Aacute -110
+KPX Yacute Abreve -110
+KPX Yacute Acircumflex -110
+KPX Yacute Adieresis -110
+KPX Yacute Agrave -110
+KPX Yacute Amacron -110
+KPX Yacute Aogonek -110
+KPX Yacute Aring -110
+KPX Yacute Atilde -110
+KPX Yacute O -85
+KPX Yacute Oacute -85
+KPX Yacute Ocircumflex -85
+KPX Yacute Odieresis -85
+KPX Yacute Ograve -85
+KPX Yacute Ohungarumlaut -85
+KPX Yacute Omacron -85
+KPX Yacute Oslash -85
+KPX Yacute Otilde -85
+KPX Yacute a -140
+KPX Yacute aacute -140
+KPX Yacute abreve -70
+KPX Yacute acircumflex -140
+KPX Yacute adieresis -140
+KPX Yacute agrave -140
+KPX Yacute amacron -70
+KPX Yacute aogonek -140
+KPX Yacute aring -140
+KPX Yacute atilde -70
+KPX Yacute colon -60
+KPX Yacute comma -140
+KPX Yacute e -140
+KPX Yacute eacute -140
+KPX Yacute ecaron -140
+KPX Yacute ecircumflex -140
+KPX Yacute edieresis -140
+KPX Yacute edotaccent -140
+KPX Yacute egrave -140
+KPX Yacute emacron -70
+KPX Yacute eogonek -140
+KPX Yacute hyphen -140
+KPX Yacute i -20
+KPX Yacute iacute -20
+KPX Yacute iogonek -20
+KPX Yacute o -140
+KPX Yacute oacute -140
+KPX Yacute ocircumflex -140
+KPX Yacute odieresis -140
+KPX Yacute ograve -140
+KPX Yacute ohungarumlaut -140
+KPX Yacute omacron -70
+KPX Yacute oslash -140
+KPX Yacute otilde -140
+KPX Yacute period -140
+KPX Yacute semicolon -60
+KPX Yacute u -110
+KPX Yacute uacute -110
+KPX Yacute ucircumflex -110
+KPX Yacute udieresis -110
+KPX Yacute ugrave -110
+KPX Yacute uhungarumlaut -110
+KPX Yacute umacron -110
+KPX Yacute uogonek -110
+KPX Yacute uring -110
+KPX Ydieresis A -110
+KPX Ydieresis Aacute -110
+KPX Ydieresis Abreve -110
+KPX Ydieresis Acircumflex -110
+KPX Ydieresis Adieresis -110
+KPX Ydieresis Agrave -110
+KPX Ydieresis Amacron -110
+KPX Ydieresis Aogonek -110
+KPX Ydieresis Aring -110
+KPX Ydieresis Atilde -110
+KPX Ydieresis O -85
+KPX Ydieresis Oacute -85
+KPX Ydieresis Ocircumflex -85
+KPX Ydieresis Odieresis -85
+KPX Ydieresis Ograve -85
+KPX Ydieresis Ohungarumlaut -85
+KPX Ydieresis Omacron -85
+KPX Ydieresis Oslash -85
+KPX Ydieresis Otilde -85
+KPX Ydieresis a -140
+KPX Ydieresis aacute -140
+KPX Ydieresis abreve -70
+KPX Ydieresis acircumflex -140
+KPX Ydieresis adieresis -140
+KPX Ydieresis agrave -140
+KPX Ydieresis amacron -70
+KPX Ydieresis aogonek -140
+KPX Ydieresis aring -140
+KPX Ydieresis atilde -70
+KPX Ydieresis colon -60
+KPX Ydieresis comma -140
+KPX Ydieresis e -140
+KPX Ydieresis eacute -140
+KPX Ydieresis ecaron -140
+KPX Ydieresis ecircumflex -140
+KPX Ydieresis edieresis -140
+KPX Ydieresis edotaccent -140
+KPX Ydieresis egrave -140
+KPX Ydieresis emacron -70
+KPX Ydieresis eogonek -140
+KPX Ydieresis hyphen -140
+KPX Ydieresis i -20
+KPX Ydieresis iacute -20
+KPX Ydieresis iogonek -20
+KPX Ydieresis o -140
+KPX Ydieresis oacute -140
+KPX Ydieresis ocircumflex -140
+KPX Ydieresis odieresis -140
+KPX Ydieresis ograve -140
+KPX Ydieresis ohungarumlaut -140
+KPX Ydieresis omacron -140
+KPX Ydieresis oslash -140
+KPX Ydieresis otilde -140
+KPX Ydieresis period -140
+KPX Ydieresis semicolon -60
+KPX Ydieresis u -110
+KPX Ydieresis uacute -110
+KPX Ydieresis ucircumflex -110
+KPX Ydieresis udieresis -110
+KPX Ydieresis ugrave -110
+KPX Ydieresis uhungarumlaut -110
+KPX Ydieresis umacron -110
+KPX Ydieresis uogonek -110
+KPX Ydieresis uring -110
+KPX a v -20
+KPX a w -20
+KPX a y -30
+KPX a yacute -30
+KPX a ydieresis -30
+KPX aacute v -20
+KPX aacute w -20
+KPX aacute y -30
+KPX aacute yacute -30
+KPX aacute ydieresis -30
+KPX abreve v -20
+KPX abreve w -20
+KPX abreve y -30
+KPX abreve yacute -30
+KPX abreve ydieresis -30
+KPX acircumflex v -20
+KPX acircumflex w -20
+KPX acircumflex y -30
+KPX acircumflex yacute -30
+KPX acircumflex ydieresis -30
+KPX adieresis v -20
+KPX adieresis w -20
+KPX adieresis y -30
+KPX adieresis yacute -30
+KPX adieresis ydieresis -30
+KPX agrave v -20
+KPX agrave w -20
+KPX agrave y -30
+KPX agrave yacute -30
+KPX agrave ydieresis -30
+KPX amacron v -20
+KPX amacron w -20
+KPX amacron y -30
+KPX amacron yacute -30
+KPX amacron ydieresis -30
+KPX aogonek v -20
+KPX aogonek w -20
+KPX aogonek y -30
+KPX aogonek yacute -30
+KPX aogonek ydieresis -30
+KPX aring v -20
+KPX aring w -20
+KPX aring y -30
+KPX aring yacute -30
+KPX aring ydieresis -30
+KPX atilde v -20
+KPX atilde w -20
+KPX atilde y -30
+KPX atilde yacute -30
+KPX atilde ydieresis -30
+KPX b b -10
+KPX b comma -40
+KPX b l -20
+KPX b lacute -20
+KPX b lcommaaccent -20
+KPX b lslash -20
+KPX b period -40
+KPX b u -20
+KPX b uacute -20
+KPX b ucircumflex -20
+KPX b udieresis -20
+KPX b ugrave -20
+KPX b uhungarumlaut -20
+KPX b umacron -20
+KPX b uogonek -20
+KPX b uring -20
+KPX b v -20
+KPX b y -20
+KPX b yacute -20
+KPX b ydieresis -20
+KPX c comma -15
+KPX c k -20
+KPX c kcommaaccent -20
+KPX cacute comma -15
+KPX cacute k -20
+KPX cacute kcommaaccent -20
+KPX ccaron comma -15
+KPX ccaron k -20
+KPX ccaron kcommaaccent -20
+KPX ccedilla comma -15
+KPX ccedilla k -20
+KPX ccedilla kcommaaccent -20
+KPX colon space -50
+KPX comma quotedblright -100
+KPX comma quoteright -100
+KPX e comma -15
+KPX e period -15
+KPX e v -30
+KPX e w -20
+KPX e x -30
+KPX e y -20
+KPX e yacute -20
+KPX e ydieresis -20
+KPX eacute comma -15
+KPX eacute period -15
+KPX eacute v -30
+KPX eacute w -20
+KPX eacute x -30
+KPX eacute y -20
+KPX eacute yacute -20
+KPX eacute ydieresis -20
+KPX ecaron comma -15
+KPX ecaron period -15
+KPX ecaron v -30
+KPX ecaron w -20
+KPX ecaron x -30
+KPX ecaron y -20
+KPX ecaron yacute -20
+KPX ecaron ydieresis -20
+KPX ecircumflex comma -15
+KPX ecircumflex period -15
+KPX ecircumflex v -30
+KPX ecircumflex w -20
+KPX ecircumflex x -30
+KPX ecircumflex y -20
+KPX ecircumflex yacute -20
+KPX ecircumflex ydieresis -20
+KPX edieresis comma -15
+KPX edieresis period -15
+KPX edieresis v -30
+KPX edieresis w -20
+KPX edieresis x -30
+KPX edieresis y -20
+KPX edieresis yacute -20
+KPX edieresis ydieresis -20
+KPX edotaccent comma -15
+KPX edotaccent period -15
+KPX edotaccent v -30
+KPX edotaccent w -20
+KPX edotaccent x -30
+KPX edotaccent y -20
+KPX edotaccent yacute -20
+KPX edotaccent ydieresis -20
+KPX egrave comma -15
+KPX egrave period -15
+KPX egrave v -30
+KPX egrave w -20
+KPX egrave x -30
+KPX egrave y -20
+KPX egrave yacute -20
+KPX egrave ydieresis -20
+KPX emacron comma -15
+KPX emacron period -15
+KPX emacron v -30
+KPX emacron w -20
+KPX emacron x -30
+KPX emacron y -20
+KPX emacron yacute -20
+KPX emacron ydieresis -20
+KPX eogonek comma -15
+KPX eogonek period -15
+KPX eogonek v -30
+KPX eogonek w -20
+KPX eogonek x -30
+KPX eogonek y -20
+KPX eogonek yacute -20
+KPX eogonek ydieresis -20
+KPX f a -30
+KPX f aacute -30
+KPX f abreve -30
+KPX f acircumflex -30
+KPX f adieresis -30
+KPX f agrave -30
+KPX f amacron -30
+KPX f aogonek -30
+KPX f aring -30
+KPX f atilde -30
+KPX f comma -30
+KPX f dotlessi -28
+KPX f e -30
+KPX f eacute -30
+KPX f ecaron -30
+KPX f ecircumflex -30
+KPX f edieresis -30
+KPX f edotaccent -30
+KPX f egrave -30
+KPX f emacron -30
+KPX f eogonek -30
+KPX f o -30
+KPX f oacute -30
+KPX f ocircumflex -30
+KPX f odieresis -30
+KPX f ograve -30
+KPX f ohungarumlaut -30
+KPX f omacron -30
+KPX f oslash -30
+KPX f otilde -30
+KPX f period -30
+KPX f quotedblright 60
+KPX f quoteright 50
+KPX g r -10
+KPX g racute -10
+KPX g rcaron -10
+KPX g rcommaaccent -10
+KPX gbreve r -10
+KPX gbreve racute -10
+KPX gbreve rcaron -10
+KPX gbreve rcommaaccent -10
+KPX gcommaaccent r -10
+KPX gcommaaccent racute -10
+KPX gcommaaccent rcaron -10
+KPX gcommaaccent rcommaaccent -10
+KPX h y -30
+KPX h yacute -30
+KPX h ydieresis -30
+KPX k e -20
+KPX k eacute -20
+KPX k ecaron -20
+KPX k ecircumflex -20
+KPX k edieresis -20
+KPX k edotaccent -20
+KPX k egrave -20
+KPX k emacron -20
+KPX k eogonek -20
+KPX k o -20
+KPX k oacute -20
+KPX k ocircumflex -20
+KPX k odieresis -20
+KPX k ograve -20
+KPX k ohungarumlaut -20
+KPX k omacron -20
+KPX k oslash -20
+KPX k otilde -20
+KPX kcommaaccent e -20
+KPX kcommaaccent eacute -20
+KPX kcommaaccent ecaron -20
+KPX kcommaaccent ecircumflex -20
+KPX kcommaaccent edieresis -20
+KPX kcommaaccent edotaccent -20
+KPX kcommaaccent egrave -20
+KPX kcommaaccent emacron -20
+KPX kcommaaccent eogonek -20
+KPX kcommaaccent o -20
+KPX kcommaaccent oacute -20
+KPX kcommaaccent ocircumflex -20
+KPX kcommaaccent odieresis -20
+KPX kcommaaccent ograve -20
+KPX kcommaaccent ohungarumlaut -20
+KPX kcommaaccent omacron -20
+KPX kcommaaccent oslash -20
+KPX kcommaaccent otilde -20
+KPX m u -10
+KPX m uacute -10
+KPX m ucircumflex -10
+KPX m udieresis -10
+KPX m ugrave -10
+KPX m uhungarumlaut -10
+KPX m umacron -10
+KPX m uogonek -10
+KPX m uring -10
+KPX m y -15
+KPX m yacute -15
+KPX m ydieresis -15
+KPX n u -10
+KPX n uacute -10
+KPX n ucircumflex -10
+KPX n udieresis -10
+KPX n ugrave -10
+KPX n uhungarumlaut -10
+KPX n umacron -10
+KPX n uogonek -10
+KPX n uring -10
+KPX n v -20
+KPX n y -15
+KPX n yacute -15
+KPX n ydieresis -15
+KPX nacute u -10
+KPX nacute uacute -10
+KPX nacute ucircumflex -10
+KPX nacute udieresis -10
+KPX nacute ugrave -10
+KPX nacute uhungarumlaut -10
+KPX nacute umacron -10
+KPX nacute uogonek -10
+KPX nacute uring -10
+KPX nacute v -20
+KPX nacute y -15
+KPX nacute yacute -15
+KPX nacute ydieresis -15
+KPX ncaron u -10
+KPX ncaron uacute -10
+KPX ncaron ucircumflex -10
+KPX ncaron udieresis -10
+KPX ncaron ugrave -10
+KPX ncaron uhungarumlaut -10
+KPX ncaron umacron -10
+KPX ncaron uogonek -10
+KPX ncaron uring -10
+KPX ncaron v -20
+KPX ncaron y -15
+KPX ncaron yacute -15
+KPX ncaron ydieresis -15
+KPX ncommaaccent u -10
+KPX ncommaaccent uacute -10
+KPX ncommaaccent ucircumflex -10
+KPX ncommaaccent udieresis -10
+KPX ncommaaccent ugrave -10
+KPX ncommaaccent uhungarumlaut -10
+KPX ncommaaccent umacron -10
+KPX ncommaaccent uogonek -10
+KPX ncommaaccent uring -10
+KPX ncommaaccent v -20
+KPX ncommaaccent y -15
+KPX ncommaaccent yacute -15
+KPX ncommaaccent ydieresis -15
+KPX ntilde u -10
+KPX ntilde uacute -10
+KPX ntilde ucircumflex -10
+KPX ntilde udieresis -10
+KPX ntilde ugrave -10
+KPX ntilde uhungarumlaut -10
+KPX ntilde umacron -10
+KPX ntilde uogonek -10
+KPX ntilde uring -10
+KPX ntilde v -20
+KPX ntilde y -15
+KPX ntilde yacute -15
+KPX ntilde ydieresis -15
+KPX o comma -40
+KPX o period -40
+KPX o v -15
+KPX o w -15
+KPX o x -30
+KPX o y -30
+KPX o yacute -30
+KPX o ydieresis -30
+KPX oacute comma -40
+KPX oacute period -40
+KPX oacute v -15
+KPX oacute w -15
+KPX oacute x -30
+KPX oacute y -30
+KPX oacute yacute -30
+KPX oacute ydieresis -30
+KPX ocircumflex comma -40
+KPX ocircumflex period -40
+KPX ocircumflex v -15
+KPX ocircumflex w -15
+KPX ocircumflex x -30
+KPX ocircumflex y -30
+KPX ocircumflex yacute -30
+KPX ocircumflex ydieresis -30
+KPX odieresis comma -40
+KPX odieresis period -40
+KPX odieresis v -15
+KPX odieresis w -15
+KPX odieresis x -30
+KPX odieresis y -30
+KPX odieresis yacute -30
+KPX odieresis ydieresis -30
+KPX ograve comma -40
+KPX ograve period -40
+KPX ograve v -15
+KPX ograve w -15
+KPX ograve x -30
+KPX ograve y -30
+KPX ograve yacute -30
+KPX ograve ydieresis -30
+KPX ohungarumlaut comma -40
+KPX ohungarumlaut period -40
+KPX ohungarumlaut v -15
+KPX ohungarumlaut w -15
+KPX ohungarumlaut x -30
+KPX ohungarumlaut y -30
+KPX ohungarumlaut yacute -30
+KPX ohungarumlaut ydieresis -30
+KPX omacron comma -40
+KPX omacron period -40
+KPX omacron v -15
+KPX omacron w -15
+KPX omacron x -30
+KPX omacron y -30
+KPX omacron yacute -30
+KPX omacron ydieresis -30
+KPX oslash a -55
+KPX oslash aacute -55
+KPX oslash abreve -55
+KPX oslash acircumflex -55
+KPX oslash adieresis -55
+KPX oslash agrave -55
+KPX oslash amacron -55
+KPX oslash aogonek -55
+KPX oslash aring -55
+KPX oslash atilde -55
+KPX oslash b -55
+KPX oslash c -55
+KPX oslash cacute -55
+KPX oslash ccaron -55
+KPX oslash ccedilla -55
+KPX oslash comma -95
+KPX oslash d -55
+KPX oslash dcroat -55
+KPX oslash e -55
+KPX oslash eacute -55
+KPX oslash ecaron -55
+KPX oslash ecircumflex -55
+KPX oslash edieresis -55
+KPX oslash edotaccent -55
+KPX oslash egrave -55
+KPX oslash emacron -55
+KPX oslash eogonek -55
+KPX oslash f -55
+KPX oslash g -55
+KPX oslash gbreve -55
+KPX oslash gcommaaccent -55
+KPX oslash h -55
+KPX oslash i -55
+KPX oslash iacute -55
+KPX oslash icircumflex -55
+KPX oslash idieresis -55
+KPX oslash igrave -55
+KPX oslash imacron -55
+KPX oslash iogonek -55
+KPX oslash j -55
+KPX oslash k -55
+KPX oslash kcommaaccent -55
+KPX oslash l -55
+KPX oslash lacute -55
+KPX oslash lcommaaccent -55
+KPX oslash lslash -55
+KPX oslash m -55
+KPX oslash n -55
+KPX oslash nacute -55
+KPX oslash ncaron -55
+KPX oslash ncommaaccent -55
+KPX oslash ntilde -55
+KPX oslash o -55
+KPX oslash oacute -55
+KPX oslash ocircumflex -55
+KPX oslash odieresis -55
+KPX oslash ograve -55
+KPX oslash ohungarumlaut -55
+KPX oslash omacron -55
+KPX oslash oslash -55
+KPX oslash otilde -55
+KPX oslash p -55
+KPX oslash period -95
+KPX oslash q -55
+KPX oslash r -55
+KPX oslash racute -55
+KPX oslash rcaron -55
+KPX oslash rcommaaccent -55
+KPX oslash s -55
+KPX oslash sacute -55
+KPX oslash scaron -55
+KPX oslash scedilla -55
+KPX oslash scommaaccent -55
+KPX oslash t -55
+KPX oslash tcommaaccent -55
+KPX oslash u -55
+KPX oslash uacute -55
+KPX oslash ucircumflex -55
+KPX oslash udieresis -55
+KPX oslash ugrave -55
+KPX oslash uhungarumlaut -55
+KPX oslash umacron -55
+KPX oslash uogonek -55
+KPX oslash uring -55
+KPX oslash v -70
+KPX oslash w -70
+KPX oslash x -85
+KPX oslash y -70
+KPX oslash yacute -70
+KPX oslash ydieresis -70
+KPX oslash z -55
+KPX oslash zacute -55
+KPX oslash zcaron -55
+KPX oslash zdotaccent -55
+KPX otilde comma -40
+KPX otilde period -40
+KPX otilde v -15
+KPX otilde w -15
+KPX otilde x -30
+KPX otilde y -30
+KPX otilde yacute -30
+KPX otilde ydieresis -30
+KPX p comma -35
+KPX p period -35
+KPX p y -30
+KPX p yacute -30
+KPX p ydieresis -30
+KPX period quotedblright -100
+KPX period quoteright -100
+KPX period space -60
+KPX quotedblright space -40
+KPX quoteleft quoteleft -57
+KPX quoteright d -50
+KPX quoteright dcroat -50
+KPX quoteright quoteright -57
+KPX quoteright r -50
+KPX quoteright racute -50
+KPX quoteright rcaron -50
+KPX quoteright rcommaaccent -50
+KPX quoteright s -50
+KPX quoteright sacute -50
+KPX quoteright scaron -50
+KPX quoteright scedilla -50
+KPX quoteright scommaaccent -50
+KPX quoteright space -70
+KPX r a -10
+KPX r aacute -10
+KPX r abreve -10
+KPX r acircumflex -10
+KPX r adieresis -10
+KPX r agrave -10
+KPX r amacron -10
+KPX r aogonek -10
+KPX r aring -10
+KPX r atilde -10
+KPX r colon 30
+KPX r comma -50
+KPX r i 15
+KPX r iacute 15
+KPX r icircumflex 15
+KPX r idieresis 15
+KPX r igrave 15
+KPX r imacron 15
+KPX r iogonek 15
+KPX r k 15
+KPX r kcommaaccent 15
+KPX r l 15
+KPX r lacute 15
+KPX r lcommaaccent 15
+KPX r lslash 15
+KPX r m 25
+KPX r n 25
+KPX r nacute 25
+KPX r ncaron 25
+KPX r ncommaaccent 25
+KPX r ntilde 25
+KPX r p 30
+KPX r period -50
+KPX r semicolon 30
+KPX r t 40
+KPX r tcommaaccent 40
+KPX r u 15
+KPX r uacute 15
+KPX r ucircumflex 15
+KPX r udieresis 15
+KPX r ugrave 15
+KPX r uhungarumlaut 15
+KPX r umacron 15
+KPX r uogonek 15
+KPX r uring 15
+KPX r v 30
+KPX r y 30
+KPX r yacute 30
+KPX r ydieresis 30
+KPX racute a -10
+KPX racute aacute -10
+KPX racute abreve -10
+KPX racute acircumflex -10
+KPX racute adieresis -10
+KPX racute agrave -10
+KPX racute amacron -10
+KPX racute aogonek -10
+KPX racute aring -10
+KPX racute atilde -10
+KPX racute colon 30
+KPX racute comma -50
+KPX racute i 15
+KPX racute iacute 15
+KPX racute icircumflex 15
+KPX racute idieresis 15
+KPX racute igrave 15
+KPX racute imacron 15
+KPX racute iogonek 15
+KPX racute k 15
+KPX racute kcommaaccent 15
+KPX racute l 15
+KPX racute lacute 15
+KPX racute lcommaaccent 15
+KPX racute lslash 15
+KPX racute m 25
+KPX racute n 25
+KPX racute nacute 25
+KPX racute ncaron 25
+KPX racute ncommaaccent 25
+KPX racute ntilde 25
+KPX racute p 30
+KPX racute period -50
+KPX racute semicolon 30
+KPX racute t 40
+KPX racute tcommaaccent 40
+KPX racute u 15
+KPX racute uacute 15
+KPX racute ucircumflex 15
+KPX racute udieresis 15
+KPX racute ugrave 15
+KPX racute uhungarumlaut 15
+KPX racute umacron 15
+KPX racute uogonek 15
+KPX racute uring 15
+KPX racute v 30
+KPX racute y 30
+KPX racute yacute 30
+KPX racute ydieresis 30
+KPX rcaron a -10
+KPX rcaron aacute -10
+KPX rcaron abreve -10
+KPX rcaron acircumflex -10
+KPX rcaron adieresis -10
+KPX rcaron agrave -10
+KPX rcaron amacron -10
+KPX rcaron aogonek -10
+KPX rcaron aring -10
+KPX rcaron atilde -10
+KPX rcaron colon 30
+KPX rcaron comma -50
+KPX rcaron i 15
+KPX rcaron iacute 15
+KPX rcaron icircumflex 15
+KPX rcaron idieresis 15
+KPX rcaron igrave 15
+KPX rcaron imacron 15
+KPX rcaron iogonek 15
+KPX rcaron k 15
+KPX rcaron kcommaaccent 15
+KPX rcaron l 15
+KPX rcaron lacute 15
+KPX rcaron lcommaaccent 15
+KPX rcaron lslash 15
+KPX rcaron m 25
+KPX rcaron n 25
+KPX rcaron nacute 25
+KPX rcaron ncaron 25
+KPX rcaron ncommaaccent 25
+KPX rcaron ntilde 25
+KPX rcaron p 30
+KPX rcaron period -50
+KPX rcaron semicolon 30
+KPX rcaron t 40
+KPX rcaron tcommaaccent 40
+KPX rcaron u 15
+KPX rcaron uacute 15
+KPX rcaron ucircumflex 15
+KPX rcaron udieresis 15
+KPX rcaron ugrave 15
+KPX rcaron uhungarumlaut 15
+KPX rcaron umacron 15
+KPX rcaron uogonek 15
+KPX rcaron uring 15
+KPX rcaron v 30
+KPX rcaron y 30
+KPX rcaron yacute 30
+KPX rcaron ydieresis 30
+KPX rcommaaccent a -10
+KPX rcommaaccent aacute -10
+KPX rcommaaccent abreve -10
+KPX rcommaaccent acircumflex -10
+KPX rcommaaccent adieresis -10
+KPX rcommaaccent agrave -10
+KPX rcommaaccent amacron -10
+KPX rcommaaccent aogonek -10
+KPX rcommaaccent aring -10
+KPX rcommaaccent atilde -10
+KPX rcommaaccent colon 30
+KPX rcommaaccent comma -50
+KPX rcommaaccent i 15
+KPX rcommaaccent iacute 15
+KPX rcommaaccent icircumflex 15
+KPX rcommaaccent idieresis 15
+KPX rcommaaccent igrave 15
+KPX rcommaaccent imacron 15
+KPX rcommaaccent iogonek 15
+KPX rcommaaccent k 15
+KPX rcommaaccent kcommaaccent 15
+KPX rcommaaccent l 15
+KPX rcommaaccent lacute 15
+KPX rcommaaccent lcommaaccent 15
+KPX rcommaaccent lslash 15
+KPX rcommaaccent m 25
+KPX rcommaaccent n 25
+KPX rcommaaccent nacute 25
+KPX rcommaaccent ncaron 25
+KPX rcommaaccent ncommaaccent 25
+KPX rcommaaccent ntilde 25
+KPX rcommaaccent p 30
+KPX rcommaaccent period -50
+KPX rcommaaccent semicolon 30
+KPX rcommaaccent t 40
+KPX rcommaaccent tcommaaccent 40
+KPX rcommaaccent u 15
+KPX rcommaaccent uacute 15
+KPX rcommaaccent ucircumflex 15
+KPX rcommaaccent udieresis 15
+KPX rcommaaccent ugrave 15
+KPX rcommaaccent uhungarumlaut 15
+KPX rcommaaccent umacron 15
+KPX rcommaaccent uogonek 15
+KPX rcommaaccent uring 15
+KPX rcommaaccent v 30
+KPX rcommaaccent y 30
+KPX rcommaaccent yacute 30
+KPX rcommaaccent ydieresis 30
+KPX s comma -15
+KPX s period -15
+KPX s w -30
+KPX sacute comma -15
+KPX sacute period -15
+KPX sacute w -30
+KPX scaron comma -15
+KPX scaron period -15
+KPX scaron w -30
+KPX scedilla comma -15
+KPX scedilla period -15
+KPX scedilla w -30
+KPX scommaaccent comma -15
+KPX scommaaccent period -15
+KPX scommaaccent w -30
+KPX semicolon space -50
+KPX space T -50
+KPX space Tcaron -50
+KPX space Tcommaaccent -50
+KPX space V -50
+KPX space W -40
+KPX space Y -90
+KPX space Yacute -90
+KPX space Ydieresis -90
+KPX space quotedblleft -30
+KPX space quoteleft -60
+KPX v a -25
+KPX v aacute -25
+KPX v abreve -25
+KPX v acircumflex -25
+KPX v adieresis -25
+KPX v agrave -25
+KPX v amacron -25
+KPX v aogonek -25
+KPX v aring -25
+KPX v atilde -25
+KPX v comma -80
+KPX v e -25
+KPX v eacute -25
+KPX v ecaron -25
+KPX v ecircumflex -25
+KPX v edieresis -25
+KPX v edotaccent -25
+KPX v egrave -25
+KPX v emacron -25
+KPX v eogonek -25
+KPX v o -25
+KPX v oacute -25
+KPX v ocircumflex -25
+KPX v odieresis -25
+KPX v ograve -25
+KPX v ohungarumlaut -25
+KPX v omacron -25
+KPX v oslash -25
+KPX v otilde -25
+KPX v period -80
+KPX w a -15
+KPX w aacute -15
+KPX w abreve -15
+KPX w acircumflex -15
+KPX w adieresis -15
+KPX w agrave -15
+KPX w amacron -15
+KPX w aogonek -15
+KPX w aring -15
+KPX w atilde -15
+KPX w comma -60
+KPX w e -10
+KPX w eacute -10
+KPX w ecaron -10
+KPX w ecircumflex -10
+KPX w edieresis -10
+KPX w edotaccent -10
+KPX w egrave -10
+KPX w emacron -10
+KPX w eogonek -10
+KPX w o -10
+KPX w oacute -10
+KPX w ocircumflex -10
+KPX w odieresis -10
+KPX w ograve -10
+KPX w ohungarumlaut -10
+KPX w omacron -10
+KPX w oslash -10
+KPX w otilde -10
+KPX w period -60
+KPX x e -30
+KPX x eacute -30
+KPX x ecaron -30
+KPX x ecircumflex -30
+KPX x edieresis -30
+KPX x edotaccent -30
+KPX x egrave -30
+KPX x emacron -30
+KPX x eogonek -30
+KPX y a -20
+KPX y aacute -20
+KPX y abreve -20
+KPX y acircumflex -20
+KPX y adieresis -20
+KPX y agrave -20
+KPX y amacron -20
+KPX y aogonek -20
+KPX y aring -20
+KPX y atilde -20
+KPX y comma -100
+KPX y e -20
+KPX y eacute -20
+KPX y ecaron -20
+KPX y ecircumflex -20
+KPX y edieresis -20
+KPX y edotaccent -20
+KPX y egrave -20
+KPX y emacron -20
+KPX y eogonek -20
+KPX y o -20
+KPX y oacute -20
+KPX y ocircumflex -20
+KPX y odieresis -20
+KPX y ograve -20
+KPX y ohungarumlaut -20
+KPX y omacron -20
+KPX y oslash -20
+KPX y otilde -20
+KPX y period -100
+KPX yacute a -20
+KPX yacute aacute -20
+KPX yacute abreve -20
+KPX yacute acircumflex -20
+KPX yacute adieresis -20
+KPX yacute agrave -20
+KPX yacute amacron -20
+KPX yacute aogonek -20
+KPX yacute aring -20
+KPX yacute atilde -20
+KPX yacute comma -100
+KPX yacute e -20
+KPX yacute eacute -20
+KPX yacute ecaron -20
+KPX yacute ecircumflex -20
+KPX yacute edieresis -20
+KPX yacute edotaccent -20
+KPX yacute egrave -20
+KPX yacute emacron -20
+KPX yacute eogonek -20
+KPX yacute o -20
+KPX yacute oacute -20
+KPX yacute ocircumflex -20
+KPX yacute odieresis -20
+KPX yacute ograve -20
+KPX yacute ohungarumlaut -20
+KPX yacute omacron -20
+KPX yacute oslash -20
+KPX yacute otilde -20
+KPX yacute period -100
+KPX ydieresis a -20
+KPX ydieresis aacute -20
+KPX ydieresis abreve -20
+KPX ydieresis acircumflex -20
+KPX ydieresis adieresis -20
+KPX ydieresis agrave -20
+KPX ydieresis amacron -20
+KPX ydieresis aogonek -20
+KPX ydieresis aring -20
+KPX ydieresis atilde -20
+KPX ydieresis comma -100
+KPX ydieresis e -20
+KPX ydieresis eacute -20
+KPX ydieresis ecaron -20
+KPX ydieresis ecircumflex -20
+KPX ydieresis edieresis -20
+KPX ydieresis edotaccent -20
+KPX ydieresis egrave -20
+KPX ydieresis emacron -20
+KPX ydieresis eogonek -20
+KPX ydieresis o -20
+KPX ydieresis oacute -20
+KPX ydieresis ocircumflex -20
+KPX ydieresis odieresis -20
+KPX ydieresis ograve -20
+KPX ydieresis ohungarumlaut -20
+KPX ydieresis omacron -20
+KPX ydieresis oslash -20
+KPX ydieresis otilde -20
+KPX ydieresis period -100
+KPX z e -15
+KPX z eacute -15
+KPX z ecaron -15
+KPX z ecircumflex -15
+KPX z edieresis -15
+KPX z edotaccent -15
+KPX z egrave -15
+KPX z emacron -15
+KPX z eogonek -15
+KPX z o -15
+KPX z oacute -15
+KPX z ocircumflex -15
+KPX z odieresis -15
+KPX z ograve -15
+KPX z ohungarumlaut -15
+KPX z omacron -15
+KPX z oslash -15
+KPX z otilde -15
+KPX zacute e -15
+KPX zacute eacute -15
+KPX zacute ecaron -15
+KPX zacute ecircumflex -15
+KPX zacute edieresis -15
+KPX zacute edotaccent -15
+KPX zacute egrave -15
+KPX zacute emacron -15
+KPX zacute eogonek -15
+KPX zacute o -15
+KPX zacute oacute -15
+KPX zacute ocircumflex -15
+KPX zacute odieresis -15
+KPX zacute ograve -15
+KPX zacute ohungarumlaut -15
+KPX zacute omacron -15
+KPX zacute oslash -15
+KPX zacute otilde -15
+KPX zcaron e -15
+KPX zcaron eacute -15
+KPX zcaron ecaron -15
+KPX zcaron ecircumflex -15
+KPX zcaron edieresis -15
+KPX zcaron edotaccent -15
+KPX zcaron egrave -15
+KPX zcaron emacron -15
+KPX zcaron eogonek -15
+KPX zcaron o -15
+KPX zcaron oacute -15
+KPX zcaron ocircumflex -15
+KPX zcaron odieresis -15
+KPX zcaron ograve -15
+KPX zcaron ohungarumlaut -15
+KPX zcaron omacron -15
+KPX zcaron oslash -15
+KPX zcaron otilde -15
+KPX zdotaccent e -15
+KPX zdotaccent eacute -15
+KPX zdotaccent ecaron -15
+KPX zdotaccent ecircumflex -15
+KPX zdotaccent edieresis -15
+KPX zdotaccent edotaccent -15
+KPX zdotaccent egrave -15
+KPX zdotaccent emacron -15
+KPX zdotaccent eogonek -15
+KPX zdotaccent o -15
+KPX zdotaccent oacute -15
+KPX zdotaccent ocircumflex -15
+KPX zdotaccent odieresis -15
+KPX zdotaccent ograve -15
+KPX zdotaccent ohungarumlaut -15
+KPX zdotaccent omacron -15
+KPX zdotaccent oslash -15
+KPX zdotaccent otilde -15
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica.afm
new file mode 100644
index 0000000..bd32af5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Helvetica.afm
@@ -0,0 +1,3051 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu May 1 12:38:23 1997
+Comment UniqueID 43054
+Comment VMusage 37069 48094
+FontName Helvetica
+FullName Helvetica
+FamilyName Helvetica
+Weight Medium
+ItalicAngle 0
+IsFixedPitch false
+CharacterSet ExtendedRoman
+FontBBox -166 -225 1000 931
+UnderlinePosition -100
+UnderlineThickness 50
+Version 002.000
+Notice Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 718
+XHeight 523
+Ascender 718
+Descender -207
+StdHW 76
+StdVW 88
+StartCharMetrics 315
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 278 ; N exclam ; B 90 0 187 718 ;
+C 34 ; WX 355 ; N quotedbl ; B 70 463 285 718 ;
+C 35 ; WX 556 ; N numbersign ; B 28 0 529 688 ;
+C 36 ; WX 556 ; N dollar ; B 32 -115 520 775 ;
+C 37 ; WX 889 ; N percent ; B 39 -19 850 703 ;
+C 38 ; WX 667 ; N ampersand ; B 44 -15 645 718 ;
+C 39 ; WX 222 ; N quoteright ; B 53 463 157 718 ;
+C 40 ; WX 333 ; N parenleft ; B 68 -207 299 733 ;
+C 41 ; WX 333 ; N parenright ; B 34 -207 265 733 ;
+C 42 ; WX 389 ; N asterisk ; B 39 431 349 718 ;
+C 43 ; WX 584 ; N plus ; B 39 0 545 505 ;
+C 44 ; WX 278 ; N comma ; B 87 -147 191 106 ;
+C 45 ; WX 333 ; N hyphen ; B 44 232 289 322 ;
+C 46 ; WX 278 ; N period ; B 87 0 191 106 ;
+C 47 ; WX 278 ; N slash ; B -17 -19 295 737 ;
+C 48 ; WX 556 ; N zero ; B 37 -19 519 703 ;
+C 49 ; WX 556 ; N one ; B 101 0 359 703 ;
+C 50 ; WX 556 ; N two ; B 26 0 507 703 ;
+C 51 ; WX 556 ; N three ; B 34 -19 522 703 ;
+C 52 ; WX 556 ; N four ; B 25 0 523 703 ;
+C 53 ; WX 556 ; N five ; B 32 -19 514 688 ;
+C 54 ; WX 556 ; N six ; B 38 -19 518 703 ;
+C 55 ; WX 556 ; N seven ; B 37 0 523 688 ;
+C 56 ; WX 556 ; N eight ; B 38 -19 517 703 ;
+C 57 ; WX 556 ; N nine ; B 42 -19 514 703 ;
+C 58 ; WX 278 ; N colon ; B 87 0 191 516 ;
+C 59 ; WX 278 ; N semicolon ; B 87 -147 191 516 ;
+C 60 ; WX 584 ; N less ; B 48 11 536 495 ;
+C 61 ; WX 584 ; N equal ; B 39 115 545 390 ;
+C 62 ; WX 584 ; N greater ; B 48 11 536 495 ;
+C 63 ; WX 556 ; N question ; B 56 0 492 727 ;
+C 64 ; WX 1015 ; N at ; B 147 -19 868 737 ;
+C 65 ; WX 667 ; N A ; B 14 0 654 718 ;
+C 66 ; WX 667 ; N B ; B 74 0 627 718 ;
+C 67 ; WX 722 ; N C ; B 44 -19 681 737 ;
+C 68 ; WX 722 ; N D ; B 81 0 674 718 ;
+C 69 ; WX 667 ; N E ; B 86 0 616 718 ;
+C 70 ; WX 611 ; N F ; B 86 0 583 718 ;
+C 71 ; WX 778 ; N G ; B 48 -19 704 737 ;
+C 72 ; WX 722 ; N H ; B 77 0 646 718 ;
+C 73 ; WX 278 ; N I ; B 91 0 188 718 ;
+C 74 ; WX 500 ; N J ; B 17 -19 428 718 ;
+C 75 ; WX 667 ; N K ; B 76 0 663 718 ;
+C 76 ; WX 556 ; N L ; B 76 0 537 718 ;
+C 77 ; WX 833 ; N M ; B 73 0 761 718 ;
+C 78 ; WX 722 ; N N ; B 76 0 646 718 ;
+C 79 ; WX 778 ; N O ; B 39 -19 739 737 ;
+C 80 ; WX 667 ; N P ; B 86 0 622 718 ;
+C 81 ; WX 778 ; N Q ; B 39 -56 739 737 ;
+C 82 ; WX 722 ; N R ; B 88 0 684 718 ;
+C 83 ; WX 667 ; N S ; B 49 -19 620 737 ;
+C 84 ; WX 611 ; N T ; B 14 0 597 718 ;
+C 85 ; WX 722 ; N U ; B 79 -19 644 718 ;
+C 86 ; WX 667 ; N V ; B 20 0 647 718 ;
+C 87 ; WX 944 ; N W ; B 16 0 928 718 ;
+C 88 ; WX 667 ; N X ; B 19 0 648 718 ;
+C 89 ; WX 667 ; N Y ; B 14 0 653 718 ;
+C 90 ; WX 611 ; N Z ; B 23 0 588 718 ;
+C 91 ; WX 278 ; N bracketleft ; B 63 -196 250 722 ;
+C 92 ; WX 278 ; N backslash ; B -17 -19 295 737 ;
+C 93 ; WX 278 ; N bracketright ; B 28 -196 215 722 ;
+C 94 ; WX 469 ; N asciicircum ; B -14 264 483 688 ;
+C 95 ; WX 556 ; N underscore ; B 0 -125 556 -75 ;
+C 96 ; WX 222 ; N quoteleft ; B 65 470 169 725 ;
+C 97 ; WX 556 ; N a ; B 36 -15 530 538 ;
+C 98 ; WX 556 ; N b ; B 58 -15 517 718 ;
+C 99 ; WX 500 ; N c ; B 30 -15 477 538 ;
+C 100 ; WX 556 ; N d ; B 35 -15 499 718 ;
+C 101 ; WX 556 ; N e ; B 40 -15 516 538 ;
+C 102 ; WX 278 ; N f ; B 14 0 262 728 ; L i fi ; L l fl ;
+C 103 ; WX 556 ; N g ; B 40 -220 499 538 ;
+C 104 ; WX 556 ; N h ; B 65 0 491 718 ;
+C 105 ; WX 222 ; N i ; B 67 0 155 718 ;
+C 106 ; WX 222 ; N j ; B -16 -210 155 718 ;
+C 107 ; WX 500 ; N k ; B 67 0 501 718 ;
+C 108 ; WX 222 ; N l ; B 67 0 155 718 ;
+C 109 ; WX 833 ; N m ; B 65 0 769 538 ;
+C 110 ; WX 556 ; N n ; B 65 0 491 538 ;
+C 111 ; WX 556 ; N o ; B 35 -14 521 538 ;
+C 112 ; WX 556 ; N p ; B 58 -207 517 538 ;
+C 113 ; WX 556 ; N q ; B 35 -207 494 538 ;
+C 114 ; WX 333 ; N r ; B 77 0 332 538 ;
+C 115 ; WX 500 ; N s ; B 32 -15 464 538 ;
+C 116 ; WX 278 ; N t ; B 14 -7 257 669 ;
+C 117 ; WX 556 ; N u ; B 68 -15 489 523 ;
+C 118 ; WX 500 ; N v ; B 8 0 492 523 ;
+C 119 ; WX 722 ; N w ; B 14 0 709 523 ;
+C 120 ; WX 500 ; N x ; B 11 0 490 523 ;
+C 121 ; WX 500 ; N y ; B 11 -214 489 523 ;
+C 122 ; WX 500 ; N z ; B 31 0 469 523 ;
+C 123 ; WX 334 ; N braceleft ; B 42 -196 292 722 ;
+C 124 ; WX 260 ; N bar ; B 94 -225 167 775 ;
+C 125 ; WX 334 ; N braceright ; B 42 -196 292 722 ;
+C 126 ; WX 584 ; N asciitilde ; B 61 180 523 326 ;
+C 161 ; WX 333 ; N exclamdown ; B 118 -195 215 523 ;
+C 162 ; WX 556 ; N cent ; B 51 -115 513 623 ;
+C 163 ; WX 556 ; N sterling ; B 33 -16 539 718 ;
+C 164 ; WX 167 ; N fraction ; B -166 -19 333 703 ;
+C 165 ; WX 556 ; N yen ; B 3 0 553 688 ;
+C 166 ; WX 556 ; N florin ; B -11 -207 501 737 ;
+C 167 ; WX 556 ; N section ; B 43 -191 512 737 ;
+C 168 ; WX 556 ; N currency ; B 28 99 528 603 ;
+C 169 ; WX 191 ; N quotesingle ; B 59 463 132 718 ;
+C 170 ; WX 333 ; N quotedblleft ; B 38 470 307 725 ;
+C 171 ; WX 556 ; N guillemotleft ; B 97 108 459 446 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 88 108 245 446 ;
+C 173 ; WX 333 ; N guilsinglright ; B 88 108 245 446 ;
+C 174 ; WX 500 ; N fi ; B 14 0 434 728 ;
+C 175 ; WX 500 ; N fl ; B 14 0 432 728 ;
+C 177 ; WX 556 ; N endash ; B 0 240 556 313 ;
+C 178 ; WX 556 ; N dagger ; B 43 -159 514 718 ;
+C 179 ; WX 556 ; N daggerdbl ; B 43 -159 514 718 ;
+C 180 ; WX 278 ; N periodcentered ; B 77 190 202 315 ;
+C 182 ; WX 537 ; N paragraph ; B 18 -173 497 718 ;
+C 183 ; WX 350 ; N bullet ; B 18 202 333 517 ;
+C 184 ; WX 222 ; N quotesinglbase ; B 53 -149 157 106 ;
+C 185 ; WX 333 ; N quotedblbase ; B 26 -149 295 106 ;
+C 186 ; WX 333 ; N quotedblright ; B 26 463 295 718 ;
+C 187 ; WX 556 ; N guillemotright ; B 97 108 459 446 ;
+C 188 ; WX 1000 ; N ellipsis ; B 115 0 885 106 ;
+C 189 ; WX 1000 ; N perthousand ; B 7 -19 994 703 ;
+C 191 ; WX 611 ; N questiondown ; B 91 -201 527 525 ;
+C 193 ; WX 333 ; N grave ; B 14 593 211 734 ;
+C 194 ; WX 333 ; N acute ; B 122 593 319 734 ;
+C 195 ; WX 333 ; N circumflex ; B 21 593 312 734 ;
+C 196 ; WX 333 ; N tilde ; B -4 606 337 722 ;
+C 197 ; WX 333 ; N macron ; B 10 627 323 684 ;
+C 198 ; WX 333 ; N breve ; B 13 595 321 731 ;
+C 199 ; WX 333 ; N dotaccent ; B 121 604 212 706 ;
+C 200 ; WX 333 ; N dieresis ; B 40 604 293 706 ;
+C 202 ; WX 333 ; N ring ; B 75 572 259 756 ;
+C 203 ; WX 333 ; N cedilla ; B 45 -225 259 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 31 593 409 734 ;
+C 206 ; WX 333 ; N ogonek ; B 73 -225 287 0 ;
+C 207 ; WX 333 ; N caron ; B 21 593 312 734 ;
+C 208 ; WX 1000 ; N emdash ; B 0 240 1000 313 ;
+C 225 ; WX 1000 ; N AE ; B 8 0 951 718 ;
+C 227 ; WX 370 ; N ordfeminine ; B 24 405 346 737 ;
+C 232 ; WX 556 ; N Lslash ; B -20 0 537 718 ;
+C 233 ; WX 778 ; N Oslash ; B 39 -19 740 737 ;
+C 234 ; WX 1000 ; N OE ; B 36 -19 965 737 ;
+C 235 ; WX 365 ; N ordmasculine ; B 25 405 341 737 ;
+C 241 ; WX 889 ; N ae ; B 36 -15 847 538 ;
+C 245 ; WX 278 ; N dotlessi ; B 95 0 183 523 ;
+C 248 ; WX 222 ; N lslash ; B -20 0 242 718 ;
+C 249 ; WX 611 ; N oslash ; B 28 -22 537 545 ;
+C 250 ; WX 944 ; N oe ; B 35 -15 902 538 ;
+C 251 ; WX 611 ; N germandbls ; B 67 -15 571 728 ;
+C -1 ; WX 278 ; N Idieresis ; B 13 0 266 901 ;
+C -1 ; WX 556 ; N eacute ; B 40 -15 516 734 ;
+C -1 ; WX 556 ; N abreve ; B 36 -15 530 731 ;
+C -1 ; WX 556 ; N uhungarumlaut ; B 68 -15 521 734 ;
+C -1 ; WX 556 ; N ecaron ; B 40 -15 516 734 ;
+C -1 ; WX 667 ; N Ydieresis ; B 14 0 653 901 ;
+C -1 ; WX 584 ; N divide ; B 39 -19 545 524 ;
+C -1 ; WX 667 ; N Yacute ; B 14 0 653 929 ;
+C -1 ; WX 667 ; N Acircumflex ; B 14 0 654 929 ;
+C -1 ; WX 556 ; N aacute ; B 36 -15 530 734 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 79 -19 644 929 ;
+C -1 ; WX 500 ; N yacute ; B 11 -214 489 734 ;
+C -1 ; WX 500 ; N scommaaccent ; B 32 -225 464 538 ;
+C -1 ; WX 556 ; N ecircumflex ; B 40 -15 516 734 ;
+C -1 ; WX 722 ; N Uring ; B 79 -19 644 931 ;
+C -1 ; WX 722 ; N Udieresis ; B 79 -19 644 901 ;
+C -1 ; WX 556 ; N aogonek ; B 36 -220 547 538 ;
+C -1 ; WX 722 ; N Uacute ; B 79 -19 644 929 ;
+C -1 ; WX 556 ; N uogonek ; B 68 -225 519 523 ;
+C -1 ; WX 667 ; N Edieresis ; B 86 0 616 901 ;
+C -1 ; WX 722 ; N Dcroat ; B 0 0 674 718 ;
+C -1 ; WX 250 ; N commaaccent ; B 87 -225 181 -40 ;
+C -1 ; WX 737 ; N copyright ; B -14 -19 752 737 ;
+C -1 ; WX 667 ; N Emacron ; B 86 0 616 879 ;
+C -1 ; WX 500 ; N ccaron ; B 30 -15 477 734 ;
+C -1 ; WX 556 ; N aring ; B 36 -15 530 756 ;
+C -1 ; WX 722 ; N Ncommaaccent ; B 76 -225 646 718 ;
+C -1 ; WX 222 ; N lacute ; B 67 0 264 929 ;
+C -1 ; WX 556 ; N agrave ; B 36 -15 530 734 ;
+C -1 ; WX 611 ; N Tcommaaccent ; B 14 -225 597 718 ;
+C -1 ; WX 722 ; N Cacute ; B 44 -19 681 929 ;
+C -1 ; WX 556 ; N atilde ; B 36 -15 530 722 ;
+C -1 ; WX 667 ; N Edotaccent ; B 86 0 616 901 ;
+C -1 ; WX 500 ; N scaron ; B 32 -15 464 734 ;
+C -1 ; WX 500 ; N scedilla ; B 32 -225 464 538 ;
+C -1 ; WX 278 ; N iacute ; B 95 0 292 734 ;
+C -1 ; WX 471 ; N lozenge ; B 10 0 462 728 ;
+C -1 ; WX 722 ; N Rcaron ; B 88 0 684 929 ;
+C -1 ; WX 778 ; N Gcommaaccent ; B 48 -225 704 737 ;
+C -1 ; WX 556 ; N ucircumflex ; B 68 -15 489 734 ;
+C -1 ; WX 556 ; N acircumflex ; B 36 -15 530 734 ;
+C -1 ; WX 667 ; N Amacron ; B 14 0 654 879 ;
+C -1 ; WX 333 ; N rcaron ; B 61 0 352 734 ;
+C -1 ; WX 500 ; N ccedilla ; B 30 -225 477 538 ;
+C -1 ; WX 611 ; N Zdotaccent ; B 23 0 588 901 ;
+C -1 ; WX 667 ; N Thorn ; B 86 0 622 718 ;
+C -1 ; WX 778 ; N Omacron ; B 39 -19 739 879 ;
+C -1 ; WX 722 ; N Racute ; B 88 0 684 929 ;
+C -1 ; WX 667 ; N Sacute ; B 49 -19 620 929 ;
+C -1 ; WX 643 ; N dcaron ; B 35 -15 655 718 ;
+C -1 ; WX 722 ; N Umacron ; B 79 -19 644 879 ;
+C -1 ; WX 556 ; N uring ; B 68 -15 489 756 ;
+C -1 ; WX 333 ; N threesuperior ; B 5 270 325 703 ;
+C -1 ; WX 778 ; N Ograve ; B 39 -19 739 929 ;
+C -1 ; WX 667 ; N Agrave ; B 14 0 654 929 ;
+C -1 ; WX 667 ; N Abreve ; B 14 0 654 926 ;
+C -1 ; WX 584 ; N multiply ; B 39 0 545 506 ;
+C -1 ; WX 556 ; N uacute ; B 68 -15 489 734 ;
+C -1 ; WX 611 ; N Tcaron ; B 14 0 597 929 ;
+C -1 ; WX 476 ; N partialdiff ; B 13 -38 463 714 ;
+C -1 ; WX 500 ; N ydieresis ; B 11 -214 489 706 ;
+C -1 ; WX 722 ; N Nacute ; B 76 0 646 929 ;
+C -1 ; WX 278 ; N icircumflex ; B -6 0 285 734 ;
+C -1 ; WX 667 ; N Ecircumflex ; B 86 0 616 929 ;
+C -1 ; WX 556 ; N adieresis ; B 36 -15 530 706 ;
+C -1 ; WX 556 ; N edieresis ; B 40 -15 516 706 ;
+C -1 ; WX 500 ; N cacute ; B 30 -15 477 734 ;
+C -1 ; WX 556 ; N nacute ; B 65 0 491 734 ;
+C -1 ; WX 556 ; N umacron ; B 68 -15 489 684 ;
+C -1 ; WX 722 ; N Ncaron ; B 76 0 646 929 ;
+C -1 ; WX 278 ; N Iacute ; B 91 0 292 929 ;
+C -1 ; WX 584 ; N plusminus ; B 39 0 545 506 ;
+C -1 ; WX 260 ; N brokenbar ; B 94 -150 167 700 ;
+C -1 ; WX 737 ; N registered ; B -14 -19 752 737 ;
+C -1 ; WX 778 ; N Gbreve ; B 48 -19 704 926 ;
+C -1 ; WX 278 ; N Idotaccent ; B 91 0 188 901 ;
+C -1 ; WX 600 ; N summation ; B 15 -10 586 706 ;
+C -1 ; WX 667 ; N Egrave ; B 86 0 616 929 ;
+C -1 ; WX 333 ; N racute ; B 77 0 332 734 ;
+C -1 ; WX 556 ; N omacron ; B 35 -14 521 684 ;
+C -1 ; WX 611 ; N Zacute ; B 23 0 588 929 ;
+C -1 ; WX 611 ; N Zcaron ; B 23 0 588 929 ;
+C -1 ; WX 549 ; N greaterequal ; B 26 0 523 674 ;
+C -1 ; WX 722 ; N Eth ; B 0 0 674 718 ;
+C -1 ; WX 722 ; N Ccedilla ; B 44 -225 681 737 ;
+C -1 ; WX 222 ; N lcommaaccent ; B 67 -225 167 718 ;
+C -1 ; WX 317 ; N tcaron ; B 14 -7 329 808 ;
+C -1 ; WX 556 ; N eogonek ; B 40 -225 516 538 ;
+C -1 ; WX 722 ; N Uogonek ; B 79 -225 644 718 ;
+C -1 ; WX 667 ; N Aacute ; B 14 0 654 929 ;
+C -1 ; WX 667 ; N Adieresis ; B 14 0 654 901 ;
+C -1 ; WX 556 ; N egrave ; B 40 -15 516 734 ;
+C -1 ; WX 500 ; N zacute ; B 31 0 469 734 ;
+C -1 ; WX 222 ; N iogonek ; B -31 -225 183 718 ;
+C -1 ; WX 778 ; N Oacute ; B 39 -19 739 929 ;
+C -1 ; WX 556 ; N oacute ; B 35 -14 521 734 ;
+C -1 ; WX 556 ; N amacron ; B 36 -15 530 684 ;
+C -1 ; WX 500 ; N sacute ; B 32 -15 464 734 ;
+C -1 ; WX 278 ; N idieresis ; B 13 0 266 706 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 39 -19 739 929 ;
+C -1 ; WX 722 ; N Ugrave ; B 79 -19 644 929 ;
+C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
+C -1 ; WX 556 ; N thorn ; B 58 -207 517 718 ;
+C -1 ; WX 333 ; N twosuperior ; B 4 281 323 703 ;
+C -1 ; WX 778 ; N Odieresis ; B 39 -19 739 901 ;
+C -1 ; WX 556 ; N mu ; B 68 -207 489 523 ;
+C -1 ; WX 278 ; N igrave ; B -13 0 184 734 ;
+C -1 ; WX 556 ; N ohungarumlaut ; B 35 -14 521 734 ;
+C -1 ; WX 667 ; N Eogonek ; B 86 -220 633 718 ;
+C -1 ; WX 556 ; N dcroat ; B 35 -15 550 718 ;
+C -1 ; WX 834 ; N threequarters ; B 45 -19 810 703 ;
+C -1 ; WX 667 ; N Scedilla ; B 49 -225 620 737 ;
+C -1 ; WX 299 ; N lcaron ; B 67 0 311 718 ;
+C -1 ; WX 667 ; N Kcommaaccent ; B 76 -225 663 718 ;
+C -1 ; WX 556 ; N Lacute ; B 76 0 537 929 ;
+C -1 ; WX 1000 ; N trademark ; B 46 306 903 718 ;
+C -1 ; WX 556 ; N edotaccent ; B 40 -15 516 706 ;
+C -1 ; WX 278 ; N Igrave ; B -13 0 188 929 ;
+C -1 ; WX 278 ; N Imacron ; B -17 0 296 879 ;
+C -1 ; WX 556 ; N Lcaron ; B 76 0 537 718 ;
+C -1 ; WX 834 ; N onehalf ; B 43 -19 773 703 ;
+C -1 ; WX 549 ; N lessequal ; B 26 0 523 674 ;
+C -1 ; WX 556 ; N ocircumflex ; B 35 -14 521 734 ;
+C -1 ; WX 556 ; N ntilde ; B 65 0 491 722 ;
+C -1 ; WX 722 ; N Uhungarumlaut ; B 79 -19 644 929 ;
+C -1 ; WX 667 ; N Eacute ; B 86 0 616 929 ;
+C -1 ; WX 556 ; N emacron ; B 40 -15 516 684 ;
+C -1 ; WX 556 ; N gbreve ; B 40 -220 499 731 ;
+C -1 ; WX 834 ; N onequarter ; B 73 -19 756 703 ;
+C -1 ; WX 667 ; N Scaron ; B 49 -19 620 929 ;
+C -1 ; WX 667 ; N Scommaaccent ; B 49 -225 620 737 ;
+C -1 ; WX 778 ; N Ohungarumlaut ; B 39 -19 739 929 ;
+C -1 ; WX 400 ; N degree ; B 54 411 346 703 ;
+C -1 ; WX 556 ; N ograve ; B 35 -14 521 734 ;
+C -1 ; WX 722 ; N Ccaron ; B 44 -19 681 929 ;
+C -1 ; WX 556 ; N ugrave ; B 68 -15 489 734 ;
+C -1 ; WX 453 ; N radical ; B -4 -80 458 762 ;
+C -1 ; WX 722 ; N Dcaron ; B 81 0 674 929 ;
+C -1 ; WX 333 ; N rcommaaccent ; B 77 -225 332 538 ;
+C -1 ; WX 722 ; N Ntilde ; B 76 0 646 917 ;
+C -1 ; WX 556 ; N otilde ; B 35 -14 521 722 ;
+C -1 ; WX 722 ; N Rcommaaccent ; B 88 -225 684 718 ;
+C -1 ; WX 556 ; N Lcommaaccent ; B 76 -225 537 718 ;
+C -1 ; WX 667 ; N Atilde ; B 14 0 654 917 ;
+C -1 ; WX 667 ; N Aogonek ; B 14 -225 654 718 ;
+C -1 ; WX 667 ; N Aring ; B 14 0 654 931 ;
+C -1 ; WX 778 ; N Otilde ; B 39 -19 739 917 ;
+C -1 ; WX 500 ; N zdotaccent ; B 31 0 469 706 ;
+C -1 ; WX 667 ; N Ecaron ; B 86 0 616 929 ;
+C -1 ; WX 278 ; N Iogonek ; B -3 -225 211 718 ;
+C -1 ; WX 500 ; N kcommaaccent ; B 67 -225 501 718 ;
+C -1 ; WX 584 ; N minus ; B 39 216 545 289 ;
+C -1 ; WX 278 ; N Icircumflex ; B -6 0 285 929 ;
+C -1 ; WX 556 ; N ncaron ; B 65 0 491 734 ;
+C -1 ; WX 278 ; N tcommaaccent ; B 14 -225 257 669 ;
+C -1 ; WX 584 ; N logicalnot ; B 39 108 545 390 ;
+C -1 ; WX 556 ; N odieresis ; B 35 -14 521 706 ;
+C -1 ; WX 556 ; N udieresis ; B 68 -15 489 706 ;
+C -1 ; WX 549 ; N notequal ; B 12 -35 537 551 ;
+C -1 ; WX 556 ; N gcommaaccent ; B 40 -220 499 822 ;
+C -1 ; WX 556 ; N eth ; B 35 -15 522 737 ;
+C -1 ; WX 500 ; N zcaron ; B 31 0 469 734 ;
+C -1 ; WX 556 ; N ncommaaccent ; B 65 -225 491 538 ;
+C -1 ; WX 333 ; N onesuperior ; B 43 281 222 703 ;
+C -1 ; WX 278 ; N imacron ; B 5 0 272 684 ;
+C -1 ; WX 556 ; N Euro ; B 0 0 0 0 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 2705
+KPX A C -30
+KPX A Cacute -30
+KPX A Ccaron -30
+KPX A Ccedilla -30
+KPX A G -30
+KPX A Gbreve -30
+KPX A Gcommaaccent -30
+KPX A O -30
+KPX A Oacute -30
+KPX A Ocircumflex -30
+KPX A Odieresis -30
+KPX A Ograve -30
+KPX A Ohungarumlaut -30
+KPX A Omacron -30
+KPX A Oslash -30
+KPX A Otilde -30
+KPX A Q -30
+KPX A T -120
+KPX A Tcaron -120
+KPX A Tcommaaccent -120
+KPX A U -50
+KPX A Uacute -50
+KPX A Ucircumflex -50
+KPX A Udieresis -50
+KPX A Ugrave -50
+KPX A Uhungarumlaut -50
+KPX A Umacron -50
+KPX A Uogonek -50
+KPX A Uring -50
+KPX A V -70
+KPX A W -50
+KPX A Y -100
+KPX A Yacute -100
+KPX A Ydieresis -100
+KPX A u -30
+KPX A uacute -30
+KPX A ucircumflex -30
+KPX A udieresis -30
+KPX A ugrave -30
+KPX A uhungarumlaut -30
+KPX A umacron -30
+KPX A uogonek -30
+KPX A uring -30
+KPX A v -40
+KPX A w -40
+KPX A y -40
+KPX A yacute -40
+KPX A ydieresis -40
+KPX Aacute C -30
+KPX Aacute Cacute -30
+KPX Aacute Ccaron -30
+KPX Aacute Ccedilla -30
+KPX Aacute G -30
+KPX Aacute Gbreve -30
+KPX Aacute Gcommaaccent -30
+KPX Aacute O -30
+KPX Aacute Oacute -30
+KPX Aacute Ocircumflex -30
+KPX Aacute Odieresis -30
+KPX Aacute Ograve -30
+KPX Aacute Ohungarumlaut -30
+KPX Aacute Omacron -30
+KPX Aacute Oslash -30
+KPX Aacute Otilde -30
+KPX Aacute Q -30
+KPX Aacute T -120
+KPX Aacute Tcaron -120
+KPX Aacute Tcommaaccent -120
+KPX Aacute U -50
+KPX Aacute Uacute -50
+KPX Aacute Ucircumflex -50
+KPX Aacute Udieresis -50
+KPX Aacute Ugrave -50
+KPX Aacute Uhungarumlaut -50
+KPX Aacute Umacron -50
+KPX Aacute Uogonek -50
+KPX Aacute Uring -50
+KPX Aacute V -70
+KPX Aacute W -50
+KPX Aacute Y -100
+KPX Aacute Yacute -100
+KPX Aacute Ydieresis -100
+KPX Aacute u -30
+KPX Aacute uacute -30
+KPX Aacute ucircumflex -30
+KPX Aacute udieresis -30
+KPX Aacute ugrave -30
+KPX Aacute uhungarumlaut -30
+KPX Aacute umacron -30
+KPX Aacute uogonek -30
+KPX Aacute uring -30
+KPX Aacute v -40
+KPX Aacute w -40
+KPX Aacute y -40
+KPX Aacute yacute -40
+KPX Aacute ydieresis -40
+KPX Abreve C -30
+KPX Abreve Cacute -30
+KPX Abreve Ccaron -30
+KPX Abreve Ccedilla -30
+KPX Abreve G -30
+KPX Abreve Gbreve -30
+KPX Abreve Gcommaaccent -30
+KPX Abreve O -30
+KPX Abreve Oacute -30
+KPX Abreve Ocircumflex -30
+KPX Abreve Odieresis -30
+KPX Abreve Ograve -30
+KPX Abreve Ohungarumlaut -30
+KPX Abreve Omacron -30
+KPX Abreve Oslash -30
+KPX Abreve Otilde -30
+KPX Abreve Q -30
+KPX Abreve T -120
+KPX Abreve Tcaron -120
+KPX Abreve Tcommaaccent -120
+KPX Abreve U -50
+KPX Abreve Uacute -50
+KPX Abreve Ucircumflex -50
+KPX Abreve Udieresis -50
+KPX Abreve Ugrave -50
+KPX Abreve Uhungarumlaut -50
+KPX Abreve Umacron -50
+KPX Abreve Uogonek -50
+KPX Abreve Uring -50
+KPX Abreve V -70
+KPX Abreve W -50
+KPX Abreve Y -100
+KPX Abreve Yacute -100
+KPX Abreve Ydieresis -100
+KPX Abreve u -30
+KPX Abreve uacute -30
+KPX Abreve ucircumflex -30
+KPX Abreve udieresis -30
+KPX Abreve ugrave -30
+KPX Abreve uhungarumlaut -30
+KPX Abreve umacron -30
+KPX Abreve uogonek -30
+KPX Abreve uring -30
+KPX Abreve v -40
+KPX Abreve w -40
+KPX Abreve y -40
+KPX Abreve yacute -40
+KPX Abreve ydieresis -40
+KPX Acircumflex C -30
+KPX Acircumflex Cacute -30
+KPX Acircumflex Ccaron -30
+KPX Acircumflex Ccedilla -30
+KPX Acircumflex G -30
+KPX Acircumflex Gbreve -30
+KPX Acircumflex Gcommaaccent -30
+KPX Acircumflex O -30
+KPX Acircumflex Oacute -30
+KPX Acircumflex Ocircumflex -30
+KPX Acircumflex Odieresis -30
+KPX Acircumflex Ograve -30
+KPX Acircumflex Ohungarumlaut -30
+KPX Acircumflex Omacron -30
+KPX Acircumflex Oslash -30
+KPX Acircumflex Otilde -30
+KPX Acircumflex Q -30
+KPX Acircumflex T -120
+KPX Acircumflex Tcaron -120
+KPX Acircumflex Tcommaaccent -120
+KPX Acircumflex U -50
+KPX Acircumflex Uacute -50
+KPX Acircumflex Ucircumflex -50
+KPX Acircumflex Udieresis -50
+KPX Acircumflex Ugrave -50
+KPX Acircumflex Uhungarumlaut -50
+KPX Acircumflex Umacron -50
+KPX Acircumflex Uogonek -50
+KPX Acircumflex Uring -50
+KPX Acircumflex V -70
+KPX Acircumflex W -50
+KPX Acircumflex Y -100
+KPX Acircumflex Yacute -100
+KPX Acircumflex Ydieresis -100
+KPX Acircumflex u -30
+KPX Acircumflex uacute -30
+KPX Acircumflex ucircumflex -30
+KPX Acircumflex udieresis -30
+KPX Acircumflex ugrave -30
+KPX Acircumflex uhungarumlaut -30
+KPX Acircumflex umacron -30
+KPX Acircumflex uogonek -30
+KPX Acircumflex uring -30
+KPX Acircumflex v -40
+KPX Acircumflex w -40
+KPX Acircumflex y -40
+KPX Acircumflex yacute -40
+KPX Acircumflex ydieresis -40
+KPX Adieresis C -30
+KPX Adieresis Cacute -30
+KPX Adieresis Ccaron -30
+KPX Adieresis Ccedilla -30
+KPX Adieresis G -30
+KPX Adieresis Gbreve -30
+KPX Adieresis Gcommaaccent -30
+KPX Adieresis O -30
+KPX Adieresis Oacute -30
+KPX Adieresis Ocircumflex -30
+KPX Adieresis Odieresis -30
+KPX Adieresis Ograve -30
+KPX Adieresis Ohungarumlaut -30
+KPX Adieresis Omacron -30
+KPX Adieresis Oslash -30
+KPX Adieresis Otilde -30
+KPX Adieresis Q -30
+KPX Adieresis T -120
+KPX Adieresis Tcaron -120
+KPX Adieresis Tcommaaccent -120
+KPX Adieresis U -50
+KPX Adieresis Uacute -50
+KPX Adieresis Ucircumflex -50
+KPX Adieresis Udieresis -50
+KPX Adieresis Ugrave -50
+KPX Adieresis Uhungarumlaut -50
+KPX Adieresis Umacron -50
+KPX Adieresis Uogonek -50
+KPX Adieresis Uring -50
+KPX Adieresis V -70
+KPX Adieresis W -50
+KPX Adieresis Y -100
+KPX Adieresis Yacute -100
+KPX Adieresis Ydieresis -100
+KPX Adieresis u -30
+KPX Adieresis uacute -30
+KPX Adieresis ucircumflex -30
+KPX Adieresis udieresis -30
+KPX Adieresis ugrave -30
+KPX Adieresis uhungarumlaut -30
+KPX Adieresis umacron -30
+KPX Adieresis uogonek -30
+KPX Adieresis uring -30
+KPX Adieresis v -40
+KPX Adieresis w -40
+KPX Adieresis y -40
+KPX Adieresis yacute -40
+KPX Adieresis ydieresis -40
+KPX Agrave C -30
+KPX Agrave Cacute -30
+KPX Agrave Ccaron -30
+KPX Agrave Ccedilla -30
+KPX Agrave G -30
+KPX Agrave Gbreve -30
+KPX Agrave Gcommaaccent -30
+KPX Agrave O -30
+KPX Agrave Oacute -30
+KPX Agrave Ocircumflex -30
+KPX Agrave Odieresis -30
+KPX Agrave Ograve -30
+KPX Agrave Ohungarumlaut -30
+KPX Agrave Omacron -30
+KPX Agrave Oslash -30
+KPX Agrave Otilde -30
+KPX Agrave Q -30
+KPX Agrave T -120
+KPX Agrave Tcaron -120
+KPX Agrave Tcommaaccent -120
+KPX Agrave U -50
+KPX Agrave Uacute -50
+KPX Agrave Ucircumflex -50
+KPX Agrave Udieresis -50
+KPX Agrave Ugrave -50
+KPX Agrave Uhungarumlaut -50
+KPX Agrave Umacron -50
+KPX Agrave Uogonek -50
+KPX Agrave Uring -50
+KPX Agrave V -70
+KPX Agrave W -50
+KPX Agrave Y -100
+KPX Agrave Yacute -100
+KPX Agrave Ydieresis -100
+KPX Agrave u -30
+KPX Agrave uacute -30
+KPX Agrave ucircumflex -30
+KPX Agrave udieresis -30
+KPX Agrave ugrave -30
+KPX Agrave uhungarumlaut -30
+KPX Agrave umacron -30
+KPX Agrave uogonek -30
+KPX Agrave uring -30
+KPX Agrave v -40
+KPX Agrave w -40
+KPX Agrave y -40
+KPX Agrave yacute -40
+KPX Agrave ydieresis -40
+KPX Amacron C -30
+KPX Amacron Cacute -30
+KPX Amacron Ccaron -30
+KPX Amacron Ccedilla -30
+KPX Amacron G -30
+KPX Amacron Gbreve -30
+KPX Amacron Gcommaaccent -30
+KPX Amacron O -30
+KPX Amacron Oacute -30
+KPX Amacron Ocircumflex -30
+KPX Amacron Odieresis -30
+KPX Amacron Ograve -30
+KPX Amacron Ohungarumlaut -30
+KPX Amacron Omacron -30
+KPX Amacron Oslash -30
+KPX Amacron Otilde -30
+KPX Amacron Q -30
+KPX Amacron T -120
+KPX Amacron Tcaron -120
+KPX Amacron Tcommaaccent -120
+KPX Amacron U -50
+KPX Amacron Uacute -50
+KPX Amacron Ucircumflex -50
+KPX Amacron Udieresis -50
+KPX Amacron Ugrave -50
+KPX Amacron Uhungarumlaut -50
+KPX Amacron Umacron -50
+KPX Amacron Uogonek -50
+KPX Amacron Uring -50
+KPX Amacron V -70
+KPX Amacron W -50
+KPX Amacron Y -100
+KPX Amacron Yacute -100
+KPX Amacron Ydieresis -100
+KPX Amacron u -30
+KPX Amacron uacute -30
+KPX Amacron ucircumflex -30
+KPX Amacron udieresis -30
+KPX Amacron ugrave -30
+KPX Amacron uhungarumlaut -30
+KPX Amacron umacron -30
+KPX Amacron uogonek -30
+KPX Amacron uring -30
+KPX Amacron v -40
+KPX Amacron w -40
+KPX Amacron y -40
+KPX Amacron yacute -40
+KPX Amacron ydieresis -40
+KPX Aogonek C -30
+KPX Aogonek Cacute -30
+KPX Aogonek Ccaron -30
+KPX Aogonek Ccedilla -30
+KPX Aogonek G -30
+KPX Aogonek Gbreve -30
+KPX Aogonek Gcommaaccent -30
+KPX Aogonek O -30
+KPX Aogonek Oacute -30
+KPX Aogonek Ocircumflex -30
+KPX Aogonek Odieresis -30
+KPX Aogonek Ograve -30
+KPX Aogonek Ohungarumlaut -30
+KPX Aogonek Omacron -30
+KPX Aogonek Oslash -30
+KPX Aogonek Otilde -30
+KPX Aogonek Q -30
+KPX Aogonek T -120
+KPX Aogonek Tcaron -120
+KPX Aogonek Tcommaaccent -120
+KPX Aogonek U -50
+KPX Aogonek Uacute -50
+KPX Aogonek Ucircumflex -50
+KPX Aogonek Udieresis -50
+KPX Aogonek Ugrave -50
+KPX Aogonek Uhungarumlaut -50
+KPX Aogonek Umacron -50
+KPX Aogonek Uogonek -50
+KPX Aogonek Uring -50
+KPX Aogonek V -70
+KPX Aogonek W -50
+KPX Aogonek Y -100
+KPX Aogonek Yacute -100
+KPX Aogonek Ydieresis -100
+KPX Aogonek u -30
+KPX Aogonek uacute -30
+KPX Aogonek ucircumflex -30
+KPX Aogonek udieresis -30
+KPX Aogonek ugrave -30
+KPX Aogonek uhungarumlaut -30
+KPX Aogonek umacron -30
+KPX Aogonek uogonek -30
+KPX Aogonek uring -30
+KPX Aogonek v -40
+KPX Aogonek w -40
+KPX Aogonek y -40
+KPX Aogonek yacute -40
+KPX Aogonek ydieresis -40
+KPX Aring C -30
+KPX Aring Cacute -30
+KPX Aring Ccaron -30
+KPX Aring Ccedilla -30
+KPX Aring G -30
+KPX Aring Gbreve -30
+KPX Aring Gcommaaccent -30
+KPX Aring O -30
+KPX Aring Oacute -30
+KPX Aring Ocircumflex -30
+KPX Aring Odieresis -30
+KPX Aring Ograve -30
+KPX Aring Ohungarumlaut -30
+KPX Aring Omacron -30
+KPX Aring Oslash -30
+KPX Aring Otilde -30
+KPX Aring Q -30
+KPX Aring T -120
+KPX Aring Tcaron -120
+KPX Aring Tcommaaccent -120
+KPX Aring U -50
+KPX Aring Uacute -50
+KPX Aring Ucircumflex -50
+KPX Aring Udieresis -50
+KPX Aring Ugrave -50
+KPX Aring Uhungarumlaut -50
+KPX Aring Umacron -50
+KPX Aring Uogonek -50
+KPX Aring Uring -50
+KPX Aring V -70
+KPX Aring W -50
+KPX Aring Y -100
+KPX Aring Yacute -100
+KPX Aring Ydieresis -100
+KPX Aring u -30
+KPX Aring uacute -30
+KPX Aring ucircumflex -30
+KPX Aring udieresis -30
+KPX Aring ugrave -30
+KPX Aring uhungarumlaut -30
+KPX Aring umacron -30
+KPX Aring uogonek -30
+KPX Aring uring -30
+KPX Aring v -40
+KPX Aring w -40
+KPX Aring y -40
+KPX Aring yacute -40
+KPX Aring ydieresis -40
+KPX Atilde C -30
+KPX Atilde Cacute -30
+KPX Atilde Ccaron -30
+KPX Atilde Ccedilla -30
+KPX Atilde G -30
+KPX Atilde Gbreve -30
+KPX Atilde Gcommaaccent -30
+KPX Atilde O -30
+KPX Atilde Oacute -30
+KPX Atilde Ocircumflex -30
+KPX Atilde Odieresis -30
+KPX Atilde Ograve -30
+KPX Atilde Ohungarumlaut -30
+KPX Atilde Omacron -30
+KPX Atilde Oslash -30
+KPX Atilde Otilde -30
+KPX Atilde Q -30
+KPX Atilde T -120
+KPX Atilde Tcaron -120
+KPX Atilde Tcommaaccent -120
+KPX Atilde U -50
+KPX Atilde Uacute -50
+KPX Atilde Ucircumflex -50
+KPX Atilde Udieresis -50
+KPX Atilde Ugrave -50
+KPX Atilde Uhungarumlaut -50
+KPX Atilde Umacron -50
+KPX Atilde Uogonek -50
+KPX Atilde Uring -50
+KPX Atilde V -70
+KPX Atilde W -50
+KPX Atilde Y -100
+KPX Atilde Yacute -100
+KPX Atilde Ydieresis -100
+KPX Atilde u -30
+KPX Atilde uacute -30
+KPX Atilde ucircumflex -30
+KPX Atilde udieresis -30
+KPX Atilde ugrave -30
+KPX Atilde uhungarumlaut -30
+KPX Atilde umacron -30
+KPX Atilde uogonek -30
+KPX Atilde uring -30
+KPX Atilde v -40
+KPX Atilde w -40
+KPX Atilde y -40
+KPX Atilde yacute -40
+KPX Atilde ydieresis -40
+KPX B U -10
+KPX B Uacute -10
+KPX B Ucircumflex -10
+KPX B Udieresis -10
+KPX B Ugrave -10
+KPX B Uhungarumlaut -10
+KPX B Umacron -10
+KPX B Uogonek -10
+KPX B Uring -10
+KPX B comma -20
+KPX B period -20
+KPX C comma -30
+KPX C period -30
+KPX Cacute comma -30
+KPX Cacute period -30
+KPX Ccaron comma -30
+KPX Ccaron period -30
+KPX Ccedilla comma -30
+KPX Ccedilla period -30
+KPX D A -40
+KPX D Aacute -40
+KPX D Abreve -40
+KPX D Acircumflex -40
+KPX D Adieresis -40
+KPX D Agrave -40
+KPX D Amacron -40
+KPX D Aogonek -40
+KPX D Aring -40
+KPX D Atilde -40
+KPX D V -70
+KPX D W -40
+KPX D Y -90
+KPX D Yacute -90
+KPX D Ydieresis -90
+KPX D comma -70
+KPX D period -70
+KPX Dcaron A -40
+KPX Dcaron Aacute -40
+KPX Dcaron Abreve -40
+KPX Dcaron Acircumflex -40
+KPX Dcaron Adieresis -40
+KPX Dcaron Agrave -40
+KPX Dcaron Amacron -40
+KPX Dcaron Aogonek -40
+KPX Dcaron Aring -40
+KPX Dcaron Atilde -40
+KPX Dcaron V -70
+KPX Dcaron W -40
+KPX Dcaron Y -90
+KPX Dcaron Yacute -90
+KPX Dcaron Ydieresis -90
+KPX Dcaron comma -70
+KPX Dcaron period -70
+KPX Dcroat A -40
+KPX Dcroat Aacute -40
+KPX Dcroat Abreve -40
+KPX Dcroat Acircumflex -40
+KPX Dcroat Adieresis -40
+KPX Dcroat Agrave -40
+KPX Dcroat Amacron -40
+KPX Dcroat Aogonek -40
+KPX Dcroat Aring -40
+KPX Dcroat Atilde -40
+KPX Dcroat V -70
+KPX Dcroat W -40
+KPX Dcroat Y -90
+KPX Dcroat Yacute -90
+KPX Dcroat Ydieresis -90
+KPX Dcroat comma -70
+KPX Dcroat period -70
+KPX F A -80
+KPX F Aacute -80
+KPX F Abreve -80
+KPX F Acircumflex -80
+KPX F Adieresis -80
+KPX F Agrave -80
+KPX F Amacron -80
+KPX F Aogonek -80
+KPX F Aring -80
+KPX F Atilde -80
+KPX F a -50
+KPX F aacute -50
+KPX F abreve -50
+KPX F acircumflex -50
+KPX F adieresis -50
+KPX F agrave -50
+KPX F amacron -50
+KPX F aogonek -50
+KPX F aring -50
+KPX F atilde -50
+KPX F comma -150
+KPX F e -30
+KPX F eacute -30
+KPX F ecaron -30
+KPX F ecircumflex -30
+KPX F edieresis -30
+KPX F edotaccent -30
+KPX F egrave -30
+KPX F emacron -30
+KPX F eogonek -30
+KPX F o -30
+KPX F oacute -30
+KPX F ocircumflex -30
+KPX F odieresis -30
+KPX F ograve -30
+KPX F ohungarumlaut -30
+KPX F omacron -30
+KPX F oslash -30
+KPX F otilde -30
+KPX F period -150
+KPX F r -45
+KPX F racute -45
+KPX F rcaron -45
+KPX F rcommaaccent -45
+KPX J A -20
+KPX J Aacute -20
+KPX J Abreve -20
+KPX J Acircumflex -20
+KPX J Adieresis -20
+KPX J Agrave -20
+KPX J Amacron -20
+KPX J Aogonek -20
+KPX J Aring -20
+KPX J Atilde -20
+KPX J a -20
+KPX J aacute -20
+KPX J abreve -20
+KPX J acircumflex -20
+KPX J adieresis -20
+KPX J agrave -20
+KPX J amacron -20
+KPX J aogonek -20
+KPX J aring -20
+KPX J atilde -20
+KPX J comma -30
+KPX J period -30
+KPX J u -20
+KPX J uacute -20
+KPX J ucircumflex -20
+KPX J udieresis -20
+KPX J ugrave -20
+KPX J uhungarumlaut -20
+KPX J umacron -20
+KPX J uogonek -20
+KPX J uring -20
+KPX K O -50
+KPX K Oacute -50
+KPX K Ocircumflex -50
+KPX K Odieresis -50
+KPX K Ograve -50
+KPX K Ohungarumlaut -50
+KPX K Omacron -50
+KPX K Oslash -50
+KPX K Otilde -50
+KPX K e -40
+KPX K eacute -40
+KPX K ecaron -40
+KPX K ecircumflex -40
+KPX K edieresis -40
+KPX K edotaccent -40
+KPX K egrave -40
+KPX K emacron -40
+KPX K eogonek -40
+KPX K o -40
+KPX K oacute -40
+KPX K ocircumflex -40
+KPX K odieresis -40
+KPX K ograve -40
+KPX K ohungarumlaut -40
+KPX K omacron -40
+KPX K oslash -40
+KPX K otilde -40
+KPX K u -30
+KPX K uacute -30
+KPX K ucircumflex -30
+KPX K udieresis -30
+KPX K ugrave -30
+KPX K uhungarumlaut -30
+KPX K umacron -30
+KPX K uogonek -30
+KPX K uring -30
+KPX K y -50
+KPX K yacute -50
+KPX K ydieresis -50
+KPX Kcommaaccent O -50
+KPX Kcommaaccent Oacute -50
+KPX Kcommaaccent Ocircumflex -50
+KPX Kcommaaccent Odieresis -50
+KPX Kcommaaccent Ograve -50
+KPX Kcommaaccent Ohungarumlaut -50
+KPX Kcommaaccent Omacron -50
+KPX Kcommaaccent Oslash -50
+KPX Kcommaaccent Otilde -50
+KPX Kcommaaccent e -40
+KPX Kcommaaccent eacute -40
+KPX Kcommaaccent ecaron -40
+KPX Kcommaaccent ecircumflex -40
+KPX Kcommaaccent edieresis -40
+KPX Kcommaaccent edotaccent -40
+KPX Kcommaaccent egrave -40
+KPX Kcommaaccent emacron -40
+KPX Kcommaaccent eogonek -40
+KPX Kcommaaccent o -40
+KPX Kcommaaccent oacute -40
+KPX Kcommaaccent ocircumflex -40
+KPX Kcommaaccent odieresis -40
+KPX Kcommaaccent ograve -40
+KPX Kcommaaccent ohungarumlaut -40
+KPX Kcommaaccent omacron -40
+KPX Kcommaaccent oslash -40
+KPX Kcommaaccent otilde -40
+KPX Kcommaaccent u -30
+KPX Kcommaaccent uacute -30
+KPX Kcommaaccent ucircumflex -30
+KPX Kcommaaccent udieresis -30
+KPX Kcommaaccent ugrave -30
+KPX Kcommaaccent uhungarumlaut -30
+KPX Kcommaaccent umacron -30
+KPX Kcommaaccent uogonek -30
+KPX Kcommaaccent uring -30
+KPX Kcommaaccent y -50
+KPX Kcommaaccent yacute -50
+KPX Kcommaaccent ydieresis -50
+KPX L T -110
+KPX L Tcaron -110
+KPX L Tcommaaccent -110
+KPX L V -110
+KPX L W -70
+KPX L Y -140
+KPX L Yacute -140
+KPX L Ydieresis -140
+KPX L quotedblright -140
+KPX L quoteright -160
+KPX L y -30
+KPX L yacute -30
+KPX L ydieresis -30
+KPX Lacute T -110
+KPX Lacute Tcaron -110
+KPX Lacute Tcommaaccent -110
+KPX Lacute V -110
+KPX Lacute W -70
+KPX Lacute Y -140
+KPX Lacute Yacute -140
+KPX Lacute Ydieresis -140
+KPX Lacute quotedblright -140
+KPX Lacute quoteright -160
+KPX Lacute y -30
+KPX Lacute yacute -30
+KPX Lacute ydieresis -30
+KPX Lcaron T -110
+KPX Lcaron Tcaron -110
+KPX Lcaron Tcommaaccent -110
+KPX Lcaron V -110
+KPX Lcaron W -70
+KPX Lcaron Y -140
+KPX Lcaron Yacute -140
+KPX Lcaron Ydieresis -140
+KPX Lcaron quotedblright -140
+KPX Lcaron quoteright -160
+KPX Lcaron y -30
+KPX Lcaron yacute -30
+KPX Lcaron ydieresis -30
+KPX Lcommaaccent T -110
+KPX Lcommaaccent Tcaron -110
+KPX Lcommaaccent Tcommaaccent -110
+KPX Lcommaaccent V -110
+KPX Lcommaaccent W -70
+KPX Lcommaaccent Y -140
+KPX Lcommaaccent Yacute -140
+KPX Lcommaaccent Ydieresis -140
+KPX Lcommaaccent quotedblright -140
+KPX Lcommaaccent quoteright -160
+KPX Lcommaaccent y -30
+KPX Lcommaaccent yacute -30
+KPX Lcommaaccent ydieresis -30
+KPX Lslash T -110
+KPX Lslash Tcaron -110
+KPX Lslash Tcommaaccent -110
+KPX Lslash V -110
+KPX Lslash W -70
+KPX Lslash Y -140
+KPX Lslash Yacute -140
+KPX Lslash Ydieresis -140
+KPX Lslash quotedblright -140
+KPX Lslash quoteright -160
+KPX Lslash y -30
+KPX Lslash yacute -30
+KPX Lslash ydieresis -30
+KPX O A -20
+KPX O Aacute -20
+KPX O Abreve -20
+KPX O Acircumflex -20
+KPX O Adieresis -20
+KPX O Agrave -20
+KPX O Amacron -20
+KPX O Aogonek -20
+KPX O Aring -20
+KPX O Atilde -20
+KPX O T -40
+KPX O Tcaron -40
+KPX O Tcommaaccent -40
+KPX O V -50
+KPX O W -30
+KPX O X -60
+KPX O Y -70
+KPX O Yacute -70
+KPX O Ydieresis -70
+KPX O comma -40
+KPX O period -40
+KPX Oacute A -20
+KPX Oacute Aacute -20
+KPX Oacute Abreve -20
+KPX Oacute Acircumflex -20
+KPX Oacute Adieresis -20
+KPX Oacute Agrave -20
+KPX Oacute Amacron -20
+KPX Oacute Aogonek -20
+KPX Oacute Aring -20
+KPX Oacute Atilde -20
+KPX Oacute T -40
+KPX Oacute Tcaron -40
+KPX Oacute Tcommaaccent -40
+KPX Oacute V -50
+KPX Oacute W -30
+KPX Oacute X -60
+KPX Oacute Y -70
+KPX Oacute Yacute -70
+KPX Oacute Ydieresis -70
+KPX Oacute comma -40
+KPX Oacute period -40
+KPX Ocircumflex A -20
+KPX Ocircumflex Aacute -20
+KPX Ocircumflex Abreve -20
+KPX Ocircumflex Acircumflex -20
+KPX Ocircumflex Adieresis -20
+KPX Ocircumflex Agrave -20
+KPX Ocircumflex Amacron -20
+KPX Ocircumflex Aogonek -20
+KPX Ocircumflex Aring -20
+KPX Ocircumflex Atilde -20
+KPX Ocircumflex T -40
+KPX Ocircumflex Tcaron -40
+KPX Ocircumflex Tcommaaccent -40
+KPX Ocircumflex V -50
+KPX Ocircumflex W -30
+KPX Ocircumflex X -60
+KPX Ocircumflex Y -70
+KPX Ocircumflex Yacute -70
+KPX Ocircumflex Ydieresis -70
+KPX Ocircumflex comma -40
+KPX Ocircumflex period -40
+KPX Odieresis A -20
+KPX Odieresis Aacute -20
+KPX Odieresis Abreve -20
+KPX Odieresis Acircumflex -20
+KPX Odieresis Adieresis -20
+KPX Odieresis Agrave -20
+KPX Odieresis Amacron -20
+KPX Odieresis Aogonek -20
+KPX Odieresis Aring -20
+KPX Odieresis Atilde -20
+KPX Odieresis T -40
+KPX Odieresis Tcaron -40
+KPX Odieresis Tcommaaccent -40
+KPX Odieresis V -50
+KPX Odieresis W -30
+KPX Odieresis X -60
+KPX Odieresis Y -70
+KPX Odieresis Yacute -70
+KPX Odieresis Ydieresis -70
+KPX Odieresis comma -40
+KPX Odieresis period -40
+KPX Ograve A -20
+KPX Ograve Aacute -20
+KPX Ograve Abreve -20
+KPX Ograve Acircumflex -20
+KPX Ograve Adieresis -20
+KPX Ograve Agrave -20
+KPX Ograve Amacron -20
+KPX Ograve Aogonek -20
+KPX Ograve Aring -20
+KPX Ograve Atilde -20
+KPX Ograve T -40
+KPX Ograve Tcaron -40
+KPX Ograve Tcommaaccent -40
+KPX Ograve V -50
+KPX Ograve W -30
+KPX Ograve X -60
+KPX Ograve Y -70
+KPX Ograve Yacute -70
+KPX Ograve Ydieresis -70
+KPX Ograve comma -40
+KPX Ograve period -40
+KPX Ohungarumlaut A -20
+KPX Ohungarumlaut Aacute -20
+KPX Ohungarumlaut Abreve -20
+KPX Ohungarumlaut Acircumflex -20
+KPX Ohungarumlaut Adieresis -20
+KPX Ohungarumlaut Agrave -20
+KPX Ohungarumlaut Amacron -20
+KPX Ohungarumlaut Aogonek -20
+KPX Ohungarumlaut Aring -20
+KPX Ohungarumlaut Atilde -20
+KPX Ohungarumlaut T -40
+KPX Ohungarumlaut Tcaron -40
+KPX Ohungarumlaut Tcommaaccent -40
+KPX Ohungarumlaut V -50
+KPX Ohungarumlaut W -30
+KPX Ohungarumlaut X -60
+KPX Ohungarumlaut Y -70
+KPX Ohungarumlaut Yacute -70
+KPX Ohungarumlaut Ydieresis -70
+KPX Ohungarumlaut comma -40
+KPX Ohungarumlaut period -40
+KPX Omacron A -20
+KPX Omacron Aacute -20
+KPX Omacron Abreve -20
+KPX Omacron Acircumflex -20
+KPX Omacron Adieresis -20
+KPX Omacron Agrave -20
+KPX Omacron Amacron -20
+KPX Omacron Aogonek -20
+KPX Omacron Aring -20
+KPX Omacron Atilde -20
+KPX Omacron T -40
+KPX Omacron Tcaron -40
+KPX Omacron Tcommaaccent -40
+KPX Omacron V -50
+KPX Omacron W -30
+KPX Omacron X -60
+KPX Omacron Y -70
+KPX Omacron Yacute -70
+KPX Omacron Ydieresis -70
+KPX Omacron comma -40
+KPX Omacron period -40
+KPX Oslash A -20
+KPX Oslash Aacute -20
+KPX Oslash Abreve -20
+KPX Oslash Acircumflex -20
+KPX Oslash Adieresis -20
+KPX Oslash Agrave -20
+KPX Oslash Amacron -20
+KPX Oslash Aogonek -20
+KPX Oslash Aring -20
+KPX Oslash Atilde -20
+KPX Oslash T -40
+KPX Oslash Tcaron -40
+KPX Oslash Tcommaaccent -40
+KPX Oslash V -50
+KPX Oslash W -30
+KPX Oslash X -60
+KPX Oslash Y -70
+KPX Oslash Yacute -70
+KPX Oslash Ydieresis -70
+KPX Oslash comma -40
+KPX Oslash period -40
+KPX Otilde A -20
+KPX Otilde Aacute -20
+KPX Otilde Abreve -20
+KPX Otilde Acircumflex -20
+KPX Otilde Adieresis -20
+KPX Otilde Agrave -20
+KPX Otilde Amacron -20
+KPX Otilde Aogonek -20
+KPX Otilde Aring -20
+KPX Otilde Atilde -20
+KPX Otilde T -40
+KPX Otilde Tcaron -40
+KPX Otilde Tcommaaccent -40
+KPX Otilde V -50
+KPX Otilde W -30
+KPX Otilde X -60
+KPX Otilde Y -70
+KPX Otilde Yacute -70
+KPX Otilde Ydieresis -70
+KPX Otilde comma -40
+KPX Otilde period -40
+KPX P A -120
+KPX P Aacute -120
+KPX P Abreve -120
+KPX P Acircumflex -120
+KPX P Adieresis -120
+KPX P Agrave -120
+KPX P Amacron -120
+KPX P Aogonek -120
+KPX P Aring -120
+KPX P Atilde -120
+KPX P a -40
+KPX P aacute -40
+KPX P abreve -40
+KPX P acircumflex -40
+KPX P adieresis -40
+KPX P agrave -40
+KPX P amacron -40
+KPX P aogonek -40
+KPX P aring -40
+KPX P atilde -40
+KPX P comma -180
+KPX P e -50
+KPX P eacute -50
+KPX P ecaron -50
+KPX P ecircumflex -50
+KPX P edieresis -50
+KPX P edotaccent -50
+KPX P egrave -50
+KPX P emacron -50
+KPX P eogonek -50
+KPX P o -50
+KPX P oacute -50
+KPX P ocircumflex -50
+KPX P odieresis -50
+KPX P ograve -50
+KPX P ohungarumlaut -50
+KPX P omacron -50
+KPX P oslash -50
+KPX P otilde -50
+KPX P period -180
+KPX Q U -10
+KPX Q Uacute -10
+KPX Q Ucircumflex -10
+KPX Q Udieresis -10
+KPX Q Ugrave -10
+KPX Q Uhungarumlaut -10
+KPX Q Umacron -10
+KPX Q Uogonek -10
+KPX Q Uring -10
+KPX R O -20
+KPX R Oacute -20
+KPX R Ocircumflex -20
+KPX R Odieresis -20
+KPX R Ograve -20
+KPX R Ohungarumlaut -20
+KPX R Omacron -20
+KPX R Oslash -20
+KPX R Otilde -20
+KPX R T -30
+KPX R Tcaron -30
+KPX R Tcommaaccent -30
+KPX R U -40
+KPX R Uacute -40
+KPX R Ucircumflex -40
+KPX R Udieresis -40
+KPX R Ugrave -40
+KPX R Uhungarumlaut -40
+KPX R Umacron -40
+KPX R Uogonek -40
+KPX R Uring -40
+KPX R V -50
+KPX R W -30
+KPX R Y -50
+KPX R Yacute -50
+KPX R Ydieresis -50
+KPX Racute O -20
+KPX Racute Oacute -20
+KPX Racute Ocircumflex -20
+KPX Racute Odieresis -20
+KPX Racute Ograve -20
+KPX Racute Ohungarumlaut -20
+KPX Racute Omacron -20
+KPX Racute Oslash -20
+KPX Racute Otilde -20
+KPX Racute T -30
+KPX Racute Tcaron -30
+KPX Racute Tcommaaccent -30
+KPX Racute U -40
+KPX Racute Uacute -40
+KPX Racute Ucircumflex -40
+KPX Racute Udieresis -40
+KPX Racute Ugrave -40
+KPX Racute Uhungarumlaut -40
+KPX Racute Umacron -40
+KPX Racute Uogonek -40
+KPX Racute Uring -40
+KPX Racute V -50
+KPX Racute W -30
+KPX Racute Y -50
+KPX Racute Yacute -50
+KPX Racute Ydieresis -50
+KPX Rcaron O -20
+KPX Rcaron Oacute -20
+KPX Rcaron Ocircumflex -20
+KPX Rcaron Odieresis -20
+KPX Rcaron Ograve -20
+KPX Rcaron Ohungarumlaut -20
+KPX Rcaron Omacron -20
+KPX Rcaron Oslash -20
+KPX Rcaron Otilde -20
+KPX Rcaron T -30
+KPX Rcaron Tcaron -30
+KPX Rcaron Tcommaaccent -30
+KPX Rcaron U -40
+KPX Rcaron Uacute -40
+KPX Rcaron Ucircumflex -40
+KPX Rcaron Udieresis -40
+KPX Rcaron Ugrave -40
+KPX Rcaron Uhungarumlaut -40
+KPX Rcaron Umacron -40
+KPX Rcaron Uogonek -40
+KPX Rcaron Uring -40
+KPX Rcaron V -50
+KPX Rcaron W -30
+KPX Rcaron Y -50
+KPX Rcaron Yacute -50
+KPX Rcaron Ydieresis -50
+KPX Rcommaaccent O -20
+KPX Rcommaaccent Oacute -20
+KPX Rcommaaccent Ocircumflex -20
+KPX Rcommaaccent Odieresis -20
+KPX Rcommaaccent Ograve -20
+KPX Rcommaaccent Ohungarumlaut -20
+KPX Rcommaaccent Omacron -20
+KPX Rcommaaccent Oslash -20
+KPX Rcommaaccent Otilde -20
+KPX Rcommaaccent T -30
+KPX Rcommaaccent Tcaron -30
+KPX Rcommaaccent Tcommaaccent -30
+KPX Rcommaaccent U -40
+KPX Rcommaaccent Uacute -40
+KPX Rcommaaccent Ucircumflex -40
+KPX Rcommaaccent Udieresis -40
+KPX Rcommaaccent Ugrave -40
+KPX Rcommaaccent Uhungarumlaut -40
+KPX Rcommaaccent Umacron -40
+KPX Rcommaaccent Uogonek -40
+KPX Rcommaaccent Uring -40
+KPX Rcommaaccent V -50
+KPX Rcommaaccent W -30
+KPX Rcommaaccent Y -50
+KPX Rcommaaccent Yacute -50
+KPX Rcommaaccent Ydieresis -50
+KPX S comma -20
+KPX S period -20
+KPX Sacute comma -20
+KPX Sacute period -20
+KPX Scaron comma -20
+KPX Scaron period -20
+KPX Scedilla comma -20
+KPX Scedilla period -20
+KPX Scommaaccent comma -20
+KPX Scommaaccent period -20
+KPX T A -120
+KPX T Aacute -120
+KPX T Abreve -120
+KPX T Acircumflex -120
+KPX T Adieresis -120
+KPX T Agrave -120
+KPX T Amacron -120
+KPX T Aogonek -120
+KPX T Aring -120
+KPX T Atilde -120
+KPX T O -40
+KPX T Oacute -40
+KPX T Ocircumflex -40
+KPX T Odieresis -40
+KPX T Ograve -40
+KPX T Ohungarumlaut -40
+KPX T Omacron -40
+KPX T Oslash -40
+KPX T Otilde -40
+KPX T a -120
+KPX T aacute -120
+KPX T abreve -60
+KPX T acircumflex -120
+KPX T adieresis -120
+KPX T agrave -120
+KPX T amacron -60
+KPX T aogonek -120
+KPX T aring -120
+KPX T atilde -60
+KPX T colon -20
+KPX T comma -120
+KPX T e -120
+KPX T eacute -120
+KPX T ecaron -120
+KPX T ecircumflex -120
+KPX T edieresis -120
+KPX T edotaccent -120
+KPX T egrave -60
+KPX T emacron -60
+KPX T eogonek -120
+KPX T hyphen -140
+KPX T o -120
+KPX T oacute -120
+KPX T ocircumflex -120
+KPX T odieresis -120
+KPX T ograve -120
+KPX T ohungarumlaut -120
+KPX T omacron -60
+KPX T oslash -120
+KPX T otilde -60
+KPX T period -120
+KPX T r -120
+KPX T racute -120
+KPX T rcaron -120
+KPX T rcommaaccent -120
+KPX T semicolon -20
+KPX T u -120
+KPX T uacute -120
+KPX T ucircumflex -120
+KPX T udieresis -120
+KPX T ugrave -120
+KPX T uhungarumlaut -120
+KPX T umacron -60
+KPX T uogonek -120
+KPX T uring -120
+KPX T w -120
+KPX T y -120
+KPX T yacute -120
+KPX T ydieresis -60
+KPX Tcaron A -120
+KPX Tcaron Aacute -120
+KPX Tcaron Abreve -120
+KPX Tcaron Acircumflex -120
+KPX Tcaron Adieresis -120
+KPX Tcaron Agrave -120
+KPX Tcaron Amacron -120
+KPX Tcaron Aogonek -120
+KPX Tcaron Aring -120
+KPX Tcaron Atilde -120
+KPX Tcaron O -40
+KPX Tcaron Oacute -40
+KPX Tcaron Ocircumflex -40
+KPX Tcaron Odieresis -40
+KPX Tcaron Ograve -40
+KPX Tcaron Ohungarumlaut -40
+KPX Tcaron Omacron -40
+KPX Tcaron Oslash -40
+KPX Tcaron Otilde -40
+KPX Tcaron a -120
+KPX Tcaron aacute -120
+KPX Tcaron abreve -60
+KPX Tcaron acircumflex -120
+KPX Tcaron adieresis -120
+KPX Tcaron agrave -120
+KPX Tcaron amacron -60
+KPX Tcaron aogonek -120
+KPX Tcaron aring -120
+KPX Tcaron atilde -60
+KPX Tcaron colon -20
+KPX Tcaron comma -120
+KPX Tcaron e -120
+KPX Tcaron eacute -120
+KPX Tcaron ecaron -120
+KPX Tcaron ecircumflex -120
+KPX Tcaron edieresis -120
+KPX Tcaron edotaccent -120
+KPX Tcaron egrave -60
+KPX Tcaron emacron -60
+KPX Tcaron eogonek -120
+KPX Tcaron hyphen -140
+KPX Tcaron o -120
+KPX Tcaron oacute -120
+KPX Tcaron ocircumflex -120
+KPX Tcaron odieresis -120
+KPX Tcaron ograve -120
+KPX Tcaron ohungarumlaut -120
+KPX Tcaron omacron -60
+KPX Tcaron oslash -120
+KPX Tcaron otilde -60
+KPX Tcaron period -120
+KPX Tcaron r -120
+KPX Tcaron racute -120
+KPX Tcaron rcaron -120
+KPX Tcaron rcommaaccent -120
+KPX Tcaron semicolon -20
+KPX Tcaron u -120
+KPX Tcaron uacute -120
+KPX Tcaron ucircumflex -120
+KPX Tcaron udieresis -120
+KPX Tcaron ugrave -120
+KPX Tcaron uhungarumlaut -120
+KPX Tcaron umacron -60
+KPX Tcaron uogonek -120
+KPX Tcaron uring -120
+KPX Tcaron w -120
+KPX Tcaron y -120
+KPX Tcaron yacute -120
+KPX Tcaron ydieresis -60
+KPX Tcommaaccent A -120
+KPX Tcommaaccent Aacute -120
+KPX Tcommaaccent Abreve -120
+KPX Tcommaaccent Acircumflex -120
+KPX Tcommaaccent Adieresis -120
+KPX Tcommaaccent Agrave -120
+KPX Tcommaaccent Amacron -120
+KPX Tcommaaccent Aogonek -120
+KPX Tcommaaccent Aring -120
+KPX Tcommaaccent Atilde -120
+KPX Tcommaaccent O -40
+KPX Tcommaaccent Oacute -40
+KPX Tcommaaccent Ocircumflex -40
+KPX Tcommaaccent Odieresis -40
+KPX Tcommaaccent Ograve -40
+KPX Tcommaaccent Ohungarumlaut -40
+KPX Tcommaaccent Omacron -40
+KPX Tcommaaccent Oslash -40
+KPX Tcommaaccent Otilde -40
+KPX Tcommaaccent a -120
+KPX Tcommaaccent aacute -120
+KPX Tcommaaccent abreve -60
+KPX Tcommaaccent acircumflex -120
+KPX Tcommaaccent adieresis -120
+KPX Tcommaaccent agrave -120
+KPX Tcommaaccent amacron -60
+KPX Tcommaaccent aogonek -120
+KPX Tcommaaccent aring -120
+KPX Tcommaaccent atilde -60
+KPX Tcommaaccent colon -20
+KPX Tcommaaccent comma -120
+KPX Tcommaaccent e -120
+KPX Tcommaaccent eacute -120
+KPX Tcommaaccent ecaron -120
+KPX Tcommaaccent ecircumflex -120
+KPX Tcommaaccent edieresis -120
+KPX Tcommaaccent edotaccent -120
+KPX Tcommaaccent egrave -60
+KPX Tcommaaccent emacron -60
+KPX Tcommaaccent eogonek -120
+KPX Tcommaaccent hyphen -140
+KPX Tcommaaccent o -120
+KPX Tcommaaccent oacute -120
+KPX Tcommaaccent ocircumflex -120
+KPX Tcommaaccent odieresis -120
+KPX Tcommaaccent ograve -120
+KPX Tcommaaccent ohungarumlaut -120
+KPX Tcommaaccent omacron -60
+KPX Tcommaaccent oslash -120
+KPX Tcommaaccent otilde -60
+KPX Tcommaaccent period -120
+KPX Tcommaaccent r -120
+KPX Tcommaaccent racute -120
+KPX Tcommaaccent rcaron -120
+KPX Tcommaaccent rcommaaccent -120
+KPX Tcommaaccent semicolon -20
+KPX Tcommaaccent u -120
+KPX Tcommaaccent uacute -120
+KPX Tcommaaccent ucircumflex -120
+KPX Tcommaaccent udieresis -120
+KPX Tcommaaccent ugrave -120
+KPX Tcommaaccent uhungarumlaut -120
+KPX Tcommaaccent umacron -60
+KPX Tcommaaccent uogonek -120
+KPX Tcommaaccent uring -120
+KPX Tcommaaccent w -120
+KPX Tcommaaccent y -120
+KPX Tcommaaccent yacute -120
+KPX Tcommaaccent ydieresis -60
+KPX U A -40
+KPX U Aacute -40
+KPX U Abreve -40
+KPX U Acircumflex -40
+KPX U Adieresis -40
+KPX U Agrave -40
+KPX U Amacron -40
+KPX U Aogonek -40
+KPX U Aring -40
+KPX U Atilde -40
+KPX U comma -40
+KPX U period -40
+KPX Uacute A -40
+KPX Uacute Aacute -40
+KPX Uacute Abreve -40
+KPX Uacute Acircumflex -40
+KPX Uacute Adieresis -40
+KPX Uacute Agrave -40
+KPX Uacute Amacron -40
+KPX Uacute Aogonek -40
+KPX Uacute Aring -40
+KPX Uacute Atilde -40
+KPX Uacute comma -40
+KPX Uacute period -40
+KPX Ucircumflex A -40
+KPX Ucircumflex Aacute -40
+KPX Ucircumflex Abreve -40
+KPX Ucircumflex Acircumflex -40
+KPX Ucircumflex Adieresis -40
+KPX Ucircumflex Agrave -40
+KPX Ucircumflex Amacron -40
+KPX Ucircumflex Aogonek -40
+KPX Ucircumflex Aring -40
+KPX Ucircumflex Atilde -40
+KPX Ucircumflex comma -40
+KPX Ucircumflex period -40
+KPX Udieresis A -40
+KPX Udieresis Aacute -40
+KPX Udieresis Abreve -40
+KPX Udieresis Acircumflex -40
+KPX Udieresis Adieresis -40
+KPX Udieresis Agrave -40
+KPX Udieresis Amacron -40
+KPX Udieresis Aogonek -40
+KPX Udieresis Aring -40
+KPX Udieresis Atilde -40
+KPX Udieresis comma -40
+KPX Udieresis period -40
+KPX Ugrave A -40
+KPX Ugrave Aacute -40
+KPX Ugrave Abreve -40
+KPX Ugrave Acircumflex -40
+KPX Ugrave Adieresis -40
+KPX Ugrave Agrave -40
+KPX Ugrave Amacron -40
+KPX Ugrave Aogonek -40
+KPX Ugrave Aring -40
+KPX Ugrave Atilde -40
+KPX Ugrave comma -40
+KPX Ugrave period -40
+KPX Uhungarumlaut A -40
+KPX Uhungarumlaut Aacute -40
+KPX Uhungarumlaut Abreve -40
+KPX Uhungarumlaut Acircumflex -40
+KPX Uhungarumlaut Adieresis -40
+KPX Uhungarumlaut Agrave -40
+KPX Uhungarumlaut Amacron -40
+KPX Uhungarumlaut Aogonek -40
+KPX Uhungarumlaut Aring -40
+KPX Uhungarumlaut Atilde -40
+KPX Uhungarumlaut comma -40
+KPX Uhungarumlaut period -40
+KPX Umacron A -40
+KPX Umacron Aacute -40
+KPX Umacron Abreve -40
+KPX Umacron Acircumflex -40
+KPX Umacron Adieresis -40
+KPX Umacron Agrave -40
+KPX Umacron Amacron -40
+KPX Umacron Aogonek -40
+KPX Umacron Aring -40
+KPX Umacron Atilde -40
+KPX Umacron comma -40
+KPX Umacron period -40
+KPX Uogonek A -40
+KPX Uogonek Aacute -40
+KPX Uogonek Abreve -40
+KPX Uogonek Acircumflex -40
+KPX Uogonek Adieresis -40
+KPX Uogonek Agrave -40
+KPX Uogonek Amacron -40
+KPX Uogonek Aogonek -40
+KPX Uogonek Aring -40
+KPX Uogonek Atilde -40
+KPX Uogonek comma -40
+KPX Uogonek period -40
+KPX Uring A -40
+KPX Uring Aacute -40
+KPX Uring Abreve -40
+KPX Uring Acircumflex -40
+KPX Uring Adieresis -40
+KPX Uring Agrave -40
+KPX Uring Amacron -40
+KPX Uring Aogonek -40
+KPX Uring Aring -40
+KPX Uring Atilde -40
+KPX Uring comma -40
+KPX Uring period -40
+KPX V A -80
+KPX V Aacute -80
+KPX V Abreve -80
+KPX V Acircumflex -80
+KPX V Adieresis -80
+KPX V Agrave -80
+KPX V Amacron -80
+KPX V Aogonek -80
+KPX V Aring -80
+KPX V Atilde -80
+KPX V G -40
+KPX V Gbreve -40
+KPX V Gcommaaccent -40
+KPX V O -40
+KPX V Oacute -40
+KPX V Ocircumflex -40
+KPX V Odieresis -40
+KPX V Ograve -40
+KPX V Ohungarumlaut -40
+KPX V Omacron -40
+KPX V Oslash -40
+KPX V Otilde -40
+KPX V a -70
+KPX V aacute -70
+KPX V abreve -70
+KPX V acircumflex -70
+KPX V adieresis -70
+KPX V agrave -70
+KPX V amacron -70
+KPX V aogonek -70
+KPX V aring -70
+KPX V atilde -70
+KPX V colon -40
+KPX V comma -125
+KPX V e -80
+KPX V eacute -80
+KPX V ecaron -80
+KPX V ecircumflex -80
+KPX V edieresis -80
+KPX V edotaccent -80
+KPX V egrave -80
+KPX V emacron -80
+KPX V eogonek -80
+KPX V hyphen -80
+KPX V o -80
+KPX V oacute -80
+KPX V ocircumflex -80
+KPX V odieresis -80
+KPX V ograve -80
+KPX V ohungarumlaut -80
+KPX V omacron -80
+KPX V oslash -80
+KPX V otilde -80
+KPX V period -125
+KPX V semicolon -40
+KPX V u -70
+KPX V uacute -70
+KPX V ucircumflex -70
+KPX V udieresis -70
+KPX V ugrave -70
+KPX V uhungarumlaut -70
+KPX V umacron -70
+KPX V uogonek -70
+KPX V uring -70
+KPX W A -50
+KPX W Aacute -50
+KPX W Abreve -50
+KPX W Acircumflex -50
+KPX W Adieresis -50
+KPX W Agrave -50
+KPX W Amacron -50
+KPX W Aogonek -50
+KPX W Aring -50
+KPX W Atilde -50
+KPX W O -20
+KPX W Oacute -20
+KPX W Ocircumflex -20
+KPX W Odieresis -20
+KPX W Ograve -20
+KPX W Ohungarumlaut -20
+KPX W Omacron -20
+KPX W Oslash -20
+KPX W Otilde -20
+KPX W a -40
+KPX W aacute -40
+KPX W abreve -40
+KPX W acircumflex -40
+KPX W adieresis -40
+KPX W agrave -40
+KPX W amacron -40
+KPX W aogonek -40
+KPX W aring -40
+KPX W atilde -40
+KPX W comma -80
+KPX W e -30
+KPX W eacute -30
+KPX W ecaron -30
+KPX W ecircumflex -30
+KPX W edieresis -30
+KPX W edotaccent -30
+KPX W egrave -30
+KPX W emacron -30
+KPX W eogonek -30
+KPX W hyphen -40
+KPX W o -30
+KPX W oacute -30
+KPX W ocircumflex -30
+KPX W odieresis -30
+KPX W ograve -30
+KPX W ohungarumlaut -30
+KPX W omacron -30
+KPX W oslash -30
+KPX W otilde -30
+KPX W period -80
+KPX W u -30
+KPX W uacute -30
+KPX W ucircumflex -30
+KPX W udieresis -30
+KPX W ugrave -30
+KPX W uhungarumlaut -30
+KPX W umacron -30
+KPX W uogonek -30
+KPX W uring -30
+KPX W y -20
+KPX W yacute -20
+KPX W ydieresis -20
+KPX Y A -110
+KPX Y Aacute -110
+KPX Y Abreve -110
+KPX Y Acircumflex -110
+KPX Y Adieresis -110
+KPX Y Agrave -110
+KPX Y Amacron -110
+KPX Y Aogonek -110
+KPX Y Aring -110
+KPX Y Atilde -110
+KPX Y O -85
+KPX Y Oacute -85
+KPX Y Ocircumflex -85
+KPX Y Odieresis -85
+KPX Y Ograve -85
+KPX Y Ohungarumlaut -85
+KPX Y Omacron -85
+KPX Y Oslash -85
+KPX Y Otilde -85
+KPX Y a -140
+KPX Y aacute -140
+KPX Y abreve -70
+KPX Y acircumflex -140
+KPX Y adieresis -140
+KPX Y agrave -140
+KPX Y amacron -70
+KPX Y aogonek -140
+KPX Y aring -140
+KPX Y atilde -140
+KPX Y colon -60
+KPX Y comma -140
+KPX Y e -140
+KPX Y eacute -140
+KPX Y ecaron -140
+KPX Y ecircumflex -140
+KPX Y edieresis -140
+KPX Y edotaccent -140
+KPX Y egrave -140
+KPX Y emacron -70
+KPX Y eogonek -140
+KPX Y hyphen -140
+KPX Y i -20
+KPX Y iacute -20
+KPX Y iogonek -20
+KPX Y o -140
+KPX Y oacute -140
+KPX Y ocircumflex -140
+KPX Y odieresis -140
+KPX Y ograve -140
+KPX Y ohungarumlaut -140
+KPX Y omacron -140
+KPX Y oslash -140
+KPX Y otilde -140
+KPX Y period -140
+KPX Y semicolon -60
+KPX Y u -110
+KPX Y uacute -110
+KPX Y ucircumflex -110
+KPX Y udieresis -110
+KPX Y ugrave -110
+KPX Y uhungarumlaut -110
+KPX Y umacron -110
+KPX Y uogonek -110
+KPX Y uring -110
+KPX Yacute A -110
+KPX Yacute Aacute -110
+KPX Yacute Abreve -110
+KPX Yacute Acircumflex -110
+KPX Yacute Adieresis -110
+KPX Yacute Agrave -110
+KPX Yacute Amacron -110
+KPX Yacute Aogonek -110
+KPX Yacute Aring -110
+KPX Yacute Atilde -110
+KPX Yacute O -85
+KPX Yacute Oacute -85
+KPX Yacute Ocircumflex -85
+KPX Yacute Odieresis -85
+KPX Yacute Ograve -85
+KPX Yacute Ohungarumlaut -85
+KPX Yacute Omacron -85
+KPX Yacute Oslash -85
+KPX Yacute Otilde -85
+KPX Yacute a -140
+KPX Yacute aacute -140
+KPX Yacute abreve -70
+KPX Yacute acircumflex -140
+KPX Yacute adieresis -140
+KPX Yacute agrave -140
+KPX Yacute amacron -70
+KPX Yacute aogonek -140
+KPX Yacute aring -140
+KPX Yacute atilde -70
+KPX Yacute colon -60
+KPX Yacute comma -140
+KPX Yacute e -140
+KPX Yacute eacute -140
+KPX Yacute ecaron -140
+KPX Yacute ecircumflex -140
+KPX Yacute edieresis -140
+KPX Yacute edotaccent -140
+KPX Yacute egrave -140
+KPX Yacute emacron -70
+KPX Yacute eogonek -140
+KPX Yacute hyphen -140
+KPX Yacute i -20
+KPX Yacute iacute -20
+KPX Yacute iogonek -20
+KPX Yacute o -140
+KPX Yacute oacute -140
+KPX Yacute ocircumflex -140
+KPX Yacute odieresis -140
+KPX Yacute ograve -140
+KPX Yacute ohungarumlaut -140
+KPX Yacute omacron -70
+KPX Yacute oslash -140
+KPX Yacute otilde -140
+KPX Yacute period -140
+KPX Yacute semicolon -60
+KPX Yacute u -110
+KPX Yacute uacute -110
+KPX Yacute ucircumflex -110
+KPX Yacute udieresis -110
+KPX Yacute ugrave -110
+KPX Yacute uhungarumlaut -110
+KPX Yacute umacron -110
+KPX Yacute uogonek -110
+KPX Yacute uring -110
+KPX Ydieresis A -110
+KPX Ydieresis Aacute -110
+KPX Ydieresis Abreve -110
+KPX Ydieresis Acircumflex -110
+KPX Ydieresis Adieresis -110
+KPX Ydieresis Agrave -110
+KPX Ydieresis Amacron -110
+KPX Ydieresis Aogonek -110
+KPX Ydieresis Aring -110
+KPX Ydieresis Atilde -110
+KPX Ydieresis O -85
+KPX Ydieresis Oacute -85
+KPX Ydieresis Ocircumflex -85
+KPX Ydieresis Odieresis -85
+KPX Ydieresis Ograve -85
+KPX Ydieresis Ohungarumlaut -85
+KPX Ydieresis Omacron -85
+KPX Ydieresis Oslash -85
+KPX Ydieresis Otilde -85
+KPX Ydieresis a -140
+KPX Ydieresis aacute -140
+KPX Ydieresis abreve -70
+KPX Ydieresis acircumflex -140
+KPX Ydieresis adieresis -140
+KPX Ydieresis agrave -140
+KPX Ydieresis amacron -70
+KPX Ydieresis aogonek -140
+KPX Ydieresis aring -140
+KPX Ydieresis atilde -70
+KPX Ydieresis colon -60
+KPX Ydieresis comma -140
+KPX Ydieresis e -140
+KPX Ydieresis eacute -140
+KPX Ydieresis ecaron -140
+KPX Ydieresis ecircumflex -140
+KPX Ydieresis edieresis -140
+KPX Ydieresis edotaccent -140
+KPX Ydieresis egrave -140
+KPX Ydieresis emacron -70
+KPX Ydieresis eogonek -140
+KPX Ydieresis hyphen -140
+KPX Ydieresis i -20
+KPX Ydieresis iacute -20
+KPX Ydieresis iogonek -20
+KPX Ydieresis o -140
+KPX Ydieresis oacute -140
+KPX Ydieresis ocircumflex -140
+KPX Ydieresis odieresis -140
+KPX Ydieresis ograve -140
+KPX Ydieresis ohungarumlaut -140
+KPX Ydieresis omacron -140
+KPX Ydieresis oslash -140
+KPX Ydieresis otilde -140
+KPX Ydieresis period -140
+KPX Ydieresis semicolon -60
+KPX Ydieresis u -110
+KPX Ydieresis uacute -110
+KPX Ydieresis ucircumflex -110
+KPX Ydieresis udieresis -110
+KPX Ydieresis ugrave -110
+KPX Ydieresis uhungarumlaut -110
+KPX Ydieresis umacron -110
+KPX Ydieresis uogonek -110
+KPX Ydieresis uring -110
+KPX a v -20
+KPX a w -20
+KPX a y -30
+KPX a yacute -30
+KPX a ydieresis -30
+KPX aacute v -20
+KPX aacute w -20
+KPX aacute y -30
+KPX aacute yacute -30
+KPX aacute ydieresis -30
+KPX abreve v -20
+KPX abreve w -20
+KPX abreve y -30
+KPX abreve yacute -30
+KPX abreve ydieresis -30
+KPX acircumflex v -20
+KPX acircumflex w -20
+KPX acircumflex y -30
+KPX acircumflex yacute -30
+KPX acircumflex ydieresis -30
+KPX adieresis v -20
+KPX adieresis w -20
+KPX adieresis y -30
+KPX adieresis yacute -30
+KPX adieresis ydieresis -30
+KPX agrave v -20
+KPX agrave w -20
+KPX agrave y -30
+KPX agrave yacute -30
+KPX agrave ydieresis -30
+KPX amacron v -20
+KPX amacron w -20
+KPX amacron y -30
+KPX amacron yacute -30
+KPX amacron ydieresis -30
+KPX aogonek v -20
+KPX aogonek w -20
+KPX aogonek y -30
+KPX aogonek yacute -30
+KPX aogonek ydieresis -30
+KPX aring v -20
+KPX aring w -20
+KPX aring y -30
+KPX aring yacute -30
+KPX aring ydieresis -30
+KPX atilde v -20
+KPX atilde w -20
+KPX atilde y -30
+KPX atilde yacute -30
+KPX atilde ydieresis -30
+KPX b b -10
+KPX b comma -40
+KPX b l -20
+KPX b lacute -20
+KPX b lcommaaccent -20
+KPX b lslash -20
+KPX b period -40
+KPX b u -20
+KPX b uacute -20
+KPX b ucircumflex -20
+KPX b udieresis -20
+KPX b ugrave -20
+KPX b uhungarumlaut -20
+KPX b umacron -20
+KPX b uogonek -20
+KPX b uring -20
+KPX b v -20
+KPX b y -20
+KPX b yacute -20
+KPX b ydieresis -20
+KPX c comma -15
+KPX c k -20
+KPX c kcommaaccent -20
+KPX cacute comma -15
+KPX cacute k -20
+KPX cacute kcommaaccent -20
+KPX ccaron comma -15
+KPX ccaron k -20
+KPX ccaron kcommaaccent -20
+KPX ccedilla comma -15
+KPX ccedilla k -20
+KPX ccedilla kcommaaccent -20
+KPX colon space -50
+KPX comma quotedblright -100
+KPX comma quoteright -100
+KPX e comma -15
+KPX e period -15
+KPX e v -30
+KPX e w -20
+KPX e x -30
+KPX e y -20
+KPX e yacute -20
+KPX e ydieresis -20
+KPX eacute comma -15
+KPX eacute period -15
+KPX eacute v -30
+KPX eacute w -20
+KPX eacute x -30
+KPX eacute y -20
+KPX eacute yacute -20
+KPX eacute ydieresis -20
+KPX ecaron comma -15
+KPX ecaron period -15
+KPX ecaron v -30
+KPX ecaron w -20
+KPX ecaron x -30
+KPX ecaron y -20
+KPX ecaron yacute -20
+KPX ecaron ydieresis -20
+KPX ecircumflex comma -15
+KPX ecircumflex period -15
+KPX ecircumflex v -30
+KPX ecircumflex w -20
+KPX ecircumflex x -30
+KPX ecircumflex y -20
+KPX ecircumflex yacute -20
+KPX ecircumflex ydieresis -20
+KPX edieresis comma -15
+KPX edieresis period -15
+KPX edieresis v -30
+KPX edieresis w -20
+KPX edieresis x -30
+KPX edieresis y -20
+KPX edieresis yacute -20
+KPX edieresis ydieresis -20
+KPX edotaccent comma -15
+KPX edotaccent period -15
+KPX edotaccent v -30
+KPX edotaccent w -20
+KPX edotaccent x -30
+KPX edotaccent y -20
+KPX edotaccent yacute -20
+KPX edotaccent ydieresis -20
+KPX egrave comma -15
+KPX egrave period -15
+KPX egrave v -30
+KPX egrave w -20
+KPX egrave x -30
+KPX egrave y -20
+KPX egrave yacute -20
+KPX egrave ydieresis -20
+KPX emacron comma -15
+KPX emacron period -15
+KPX emacron v -30
+KPX emacron w -20
+KPX emacron x -30
+KPX emacron y -20
+KPX emacron yacute -20
+KPX emacron ydieresis -20
+KPX eogonek comma -15
+KPX eogonek period -15
+KPX eogonek v -30
+KPX eogonek w -20
+KPX eogonek x -30
+KPX eogonek y -20
+KPX eogonek yacute -20
+KPX eogonek ydieresis -20
+KPX f a -30
+KPX f aacute -30
+KPX f abreve -30
+KPX f acircumflex -30
+KPX f adieresis -30
+KPX f agrave -30
+KPX f amacron -30
+KPX f aogonek -30
+KPX f aring -30
+KPX f atilde -30
+KPX f comma -30
+KPX f dotlessi -28
+KPX f e -30
+KPX f eacute -30
+KPX f ecaron -30
+KPX f ecircumflex -30
+KPX f edieresis -30
+KPX f edotaccent -30
+KPX f egrave -30
+KPX f emacron -30
+KPX f eogonek -30
+KPX f o -30
+KPX f oacute -30
+KPX f ocircumflex -30
+KPX f odieresis -30
+KPX f ograve -30
+KPX f ohungarumlaut -30
+KPX f omacron -30
+KPX f oslash -30
+KPX f otilde -30
+KPX f period -30
+KPX f quotedblright 60
+KPX f quoteright 50
+KPX g r -10
+KPX g racute -10
+KPX g rcaron -10
+KPX g rcommaaccent -10
+KPX gbreve r -10
+KPX gbreve racute -10
+KPX gbreve rcaron -10
+KPX gbreve rcommaaccent -10
+KPX gcommaaccent r -10
+KPX gcommaaccent racute -10
+KPX gcommaaccent rcaron -10
+KPX gcommaaccent rcommaaccent -10
+KPX h y -30
+KPX h yacute -30
+KPX h ydieresis -30
+KPX k e -20
+KPX k eacute -20
+KPX k ecaron -20
+KPX k ecircumflex -20
+KPX k edieresis -20
+KPX k edotaccent -20
+KPX k egrave -20
+KPX k emacron -20
+KPX k eogonek -20
+KPX k o -20
+KPX k oacute -20
+KPX k ocircumflex -20
+KPX k odieresis -20
+KPX k ograve -20
+KPX k ohungarumlaut -20
+KPX k omacron -20
+KPX k oslash -20
+KPX k otilde -20
+KPX kcommaaccent e -20
+KPX kcommaaccent eacute -20
+KPX kcommaaccent ecaron -20
+KPX kcommaaccent ecircumflex -20
+KPX kcommaaccent edieresis -20
+KPX kcommaaccent edotaccent -20
+KPX kcommaaccent egrave -20
+KPX kcommaaccent emacron -20
+KPX kcommaaccent eogonek -20
+KPX kcommaaccent o -20
+KPX kcommaaccent oacute -20
+KPX kcommaaccent ocircumflex -20
+KPX kcommaaccent odieresis -20
+KPX kcommaaccent ograve -20
+KPX kcommaaccent ohungarumlaut -20
+KPX kcommaaccent omacron -20
+KPX kcommaaccent oslash -20
+KPX kcommaaccent otilde -20
+KPX m u -10
+KPX m uacute -10
+KPX m ucircumflex -10
+KPX m udieresis -10
+KPX m ugrave -10
+KPX m uhungarumlaut -10
+KPX m umacron -10
+KPX m uogonek -10
+KPX m uring -10
+KPX m y -15
+KPX m yacute -15
+KPX m ydieresis -15
+KPX n u -10
+KPX n uacute -10
+KPX n ucircumflex -10
+KPX n udieresis -10
+KPX n ugrave -10
+KPX n uhungarumlaut -10
+KPX n umacron -10
+KPX n uogonek -10
+KPX n uring -10
+KPX n v -20
+KPX n y -15
+KPX n yacute -15
+KPX n ydieresis -15
+KPX nacute u -10
+KPX nacute uacute -10
+KPX nacute ucircumflex -10
+KPX nacute udieresis -10
+KPX nacute ugrave -10
+KPX nacute uhungarumlaut -10
+KPX nacute umacron -10
+KPX nacute uogonek -10
+KPX nacute uring -10
+KPX nacute v -20
+KPX nacute y -15
+KPX nacute yacute -15
+KPX nacute ydieresis -15
+KPX ncaron u -10
+KPX ncaron uacute -10
+KPX ncaron ucircumflex -10
+KPX ncaron udieresis -10
+KPX ncaron ugrave -10
+KPX ncaron uhungarumlaut -10
+KPX ncaron umacron -10
+KPX ncaron uogonek -10
+KPX ncaron uring -10
+KPX ncaron v -20
+KPX ncaron y -15
+KPX ncaron yacute -15
+KPX ncaron ydieresis -15
+KPX ncommaaccent u -10
+KPX ncommaaccent uacute -10
+KPX ncommaaccent ucircumflex -10
+KPX ncommaaccent udieresis -10
+KPX ncommaaccent ugrave -10
+KPX ncommaaccent uhungarumlaut -10
+KPX ncommaaccent umacron -10
+KPX ncommaaccent uogonek -10
+KPX ncommaaccent uring -10
+KPX ncommaaccent v -20
+KPX ncommaaccent y -15
+KPX ncommaaccent yacute -15
+KPX ncommaaccent ydieresis -15
+KPX ntilde u -10
+KPX ntilde uacute -10
+KPX ntilde ucircumflex -10
+KPX ntilde udieresis -10
+KPX ntilde ugrave -10
+KPX ntilde uhungarumlaut -10
+KPX ntilde umacron -10
+KPX ntilde uogonek -10
+KPX ntilde uring -10
+KPX ntilde v -20
+KPX ntilde y -15
+KPX ntilde yacute -15
+KPX ntilde ydieresis -15
+KPX o comma -40
+KPX o period -40
+KPX o v -15
+KPX o w -15
+KPX o x -30
+KPX o y -30
+KPX o yacute -30
+KPX o ydieresis -30
+KPX oacute comma -40
+KPX oacute period -40
+KPX oacute v -15
+KPX oacute w -15
+KPX oacute x -30
+KPX oacute y -30
+KPX oacute yacute -30
+KPX oacute ydieresis -30
+KPX ocircumflex comma -40
+KPX ocircumflex period -40
+KPX ocircumflex v -15
+KPX ocircumflex w -15
+KPX ocircumflex x -30
+KPX ocircumflex y -30
+KPX ocircumflex yacute -30
+KPX ocircumflex ydieresis -30
+KPX odieresis comma -40
+KPX odieresis period -40
+KPX odieresis v -15
+KPX odieresis w -15
+KPX odieresis x -30
+KPX odieresis y -30
+KPX odieresis yacute -30
+KPX odieresis ydieresis -30
+KPX ograve comma -40
+KPX ograve period -40
+KPX ograve v -15
+KPX ograve w -15
+KPX ograve x -30
+KPX ograve y -30
+KPX ograve yacute -30
+KPX ograve ydieresis -30
+KPX ohungarumlaut comma -40
+KPX ohungarumlaut period -40
+KPX ohungarumlaut v -15
+KPX ohungarumlaut w -15
+KPX ohungarumlaut x -30
+KPX ohungarumlaut y -30
+KPX ohungarumlaut yacute -30
+KPX ohungarumlaut ydieresis -30
+KPX omacron comma -40
+KPX omacron period -40
+KPX omacron v -15
+KPX omacron w -15
+KPX omacron x -30
+KPX omacron y -30
+KPX omacron yacute -30
+KPX omacron ydieresis -30
+KPX oslash a -55
+KPX oslash aacute -55
+KPX oslash abreve -55
+KPX oslash acircumflex -55
+KPX oslash adieresis -55
+KPX oslash agrave -55
+KPX oslash amacron -55
+KPX oslash aogonek -55
+KPX oslash aring -55
+KPX oslash atilde -55
+KPX oslash b -55
+KPX oslash c -55
+KPX oslash cacute -55
+KPX oslash ccaron -55
+KPX oslash ccedilla -55
+KPX oslash comma -95
+KPX oslash d -55
+KPX oslash dcroat -55
+KPX oslash e -55
+KPX oslash eacute -55
+KPX oslash ecaron -55
+KPX oslash ecircumflex -55
+KPX oslash edieresis -55
+KPX oslash edotaccent -55
+KPX oslash egrave -55
+KPX oslash emacron -55
+KPX oslash eogonek -55
+KPX oslash f -55
+KPX oslash g -55
+KPX oslash gbreve -55
+KPX oslash gcommaaccent -55
+KPX oslash h -55
+KPX oslash i -55
+KPX oslash iacute -55
+KPX oslash icircumflex -55
+KPX oslash idieresis -55
+KPX oslash igrave -55
+KPX oslash imacron -55
+KPX oslash iogonek -55
+KPX oslash j -55
+KPX oslash k -55
+KPX oslash kcommaaccent -55
+KPX oslash l -55
+KPX oslash lacute -55
+KPX oslash lcommaaccent -55
+KPX oslash lslash -55
+KPX oslash m -55
+KPX oslash n -55
+KPX oslash nacute -55
+KPX oslash ncaron -55
+KPX oslash ncommaaccent -55
+KPX oslash ntilde -55
+KPX oslash o -55
+KPX oslash oacute -55
+KPX oslash ocircumflex -55
+KPX oslash odieresis -55
+KPX oslash ograve -55
+KPX oslash ohungarumlaut -55
+KPX oslash omacron -55
+KPX oslash oslash -55
+KPX oslash otilde -55
+KPX oslash p -55
+KPX oslash period -95
+KPX oslash q -55
+KPX oslash r -55
+KPX oslash racute -55
+KPX oslash rcaron -55
+KPX oslash rcommaaccent -55
+KPX oslash s -55
+KPX oslash sacute -55
+KPX oslash scaron -55
+KPX oslash scedilla -55
+KPX oslash scommaaccent -55
+KPX oslash t -55
+KPX oslash tcommaaccent -55
+KPX oslash u -55
+KPX oslash uacute -55
+KPX oslash ucircumflex -55
+KPX oslash udieresis -55
+KPX oslash ugrave -55
+KPX oslash uhungarumlaut -55
+KPX oslash umacron -55
+KPX oslash uogonek -55
+KPX oslash uring -55
+KPX oslash v -70
+KPX oslash w -70
+KPX oslash x -85
+KPX oslash y -70
+KPX oslash yacute -70
+KPX oslash ydieresis -70
+KPX oslash z -55
+KPX oslash zacute -55
+KPX oslash zcaron -55
+KPX oslash zdotaccent -55
+KPX otilde comma -40
+KPX otilde period -40
+KPX otilde v -15
+KPX otilde w -15
+KPX otilde x -30
+KPX otilde y -30
+KPX otilde yacute -30
+KPX otilde ydieresis -30
+KPX p comma -35
+KPX p period -35
+KPX p y -30
+KPX p yacute -30
+KPX p ydieresis -30
+KPX period quotedblright -100
+KPX period quoteright -100
+KPX period space -60
+KPX quotedblright space -40
+KPX quoteleft quoteleft -57
+KPX quoteright d -50
+KPX quoteright dcroat -50
+KPX quoteright quoteright -57
+KPX quoteright r -50
+KPX quoteright racute -50
+KPX quoteright rcaron -50
+KPX quoteright rcommaaccent -50
+KPX quoteright s -50
+KPX quoteright sacute -50
+KPX quoteright scaron -50
+KPX quoteright scedilla -50
+KPX quoteright scommaaccent -50
+KPX quoteright space -70
+KPX r a -10
+KPX r aacute -10
+KPX r abreve -10
+KPX r acircumflex -10
+KPX r adieresis -10
+KPX r agrave -10
+KPX r amacron -10
+KPX r aogonek -10
+KPX r aring -10
+KPX r atilde -10
+KPX r colon 30
+KPX r comma -50
+KPX r i 15
+KPX r iacute 15
+KPX r icircumflex 15
+KPX r idieresis 15
+KPX r igrave 15
+KPX r imacron 15
+KPX r iogonek 15
+KPX r k 15
+KPX r kcommaaccent 15
+KPX r l 15
+KPX r lacute 15
+KPX r lcommaaccent 15
+KPX r lslash 15
+KPX r m 25
+KPX r n 25
+KPX r nacute 25
+KPX r ncaron 25
+KPX r ncommaaccent 25
+KPX r ntilde 25
+KPX r p 30
+KPX r period -50
+KPX r semicolon 30
+KPX r t 40
+KPX r tcommaaccent 40
+KPX r u 15
+KPX r uacute 15
+KPX r ucircumflex 15
+KPX r udieresis 15
+KPX r ugrave 15
+KPX r uhungarumlaut 15
+KPX r umacron 15
+KPX r uogonek 15
+KPX r uring 15
+KPX r v 30
+KPX r y 30
+KPX r yacute 30
+KPX r ydieresis 30
+KPX racute a -10
+KPX racute aacute -10
+KPX racute abreve -10
+KPX racute acircumflex -10
+KPX racute adieresis -10
+KPX racute agrave -10
+KPX racute amacron -10
+KPX racute aogonek -10
+KPX racute aring -10
+KPX racute atilde -10
+KPX racute colon 30
+KPX racute comma -50
+KPX racute i 15
+KPX racute iacute 15
+KPX racute icircumflex 15
+KPX racute idieresis 15
+KPX racute igrave 15
+KPX racute imacron 15
+KPX racute iogonek 15
+KPX racute k 15
+KPX racute kcommaaccent 15
+KPX racute l 15
+KPX racute lacute 15
+KPX racute lcommaaccent 15
+KPX racute lslash 15
+KPX racute m 25
+KPX racute n 25
+KPX racute nacute 25
+KPX racute ncaron 25
+KPX racute ncommaaccent 25
+KPX racute ntilde 25
+KPX racute p 30
+KPX racute period -50
+KPX racute semicolon 30
+KPX racute t 40
+KPX racute tcommaaccent 40
+KPX racute u 15
+KPX racute uacute 15
+KPX racute ucircumflex 15
+KPX racute udieresis 15
+KPX racute ugrave 15
+KPX racute uhungarumlaut 15
+KPX racute umacron 15
+KPX racute uogonek 15
+KPX racute uring 15
+KPX racute v 30
+KPX racute y 30
+KPX racute yacute 30
+KPX racute ydieresis 30
+KPX rcaron a -10
+KPX rcaron aacute -10
+KPX rcaron abreve -10
+KPX rcaron acircumflex -10
+KPX rcaron adieresis -10
+KPX rcaron agrave -10
+KPX rcaron amacron -10
+KPX rcaron aogonek -10
+KPX rcaron aring -10
+KPX rcaron atilde -10
+KPX rcaron colon 30
+KPX rcaron comma -50
+KPX rcaron i 15
+KPX rcaron iacute 15
+KPX rcaron icircumflex 15
+KPX rcaron idieresis 15
+KPX rcaron igrave 15
+KPX rcaron imacron 15
+KPX rcaron iogonek 15
+KPX rcaron k 15
+KPX rcaron kcommaaccent 15
+KPX rcaron l 15
+KPX rcaron lacute 15
+KPX rcaron lcommaaccent 15
+KPX rcaron lslash 15
+KPX rcaron m 25
+KPX rcaron n 25
+KPX rcaron nacute 25
+KPX rcaron ncaron 25
+KPX rcaron ncommaaccent 25
+KPX rcaron ntilde 25
+KPX rcaron p 30
+KPX rcaron period -50
+KPX rcaron semicolon 30
+KPX rcaron t 40
+KPX rcaron tcommaaccent 40
+KPX rcaron u 15
+KPX rcaron uacute 15
+KPX rcaron ucircumflex 15
+KPX rcaron udieresis 15
+KPX rcaron ugrave 15
+KPX rcaron uhungarumlaut 15
+KPX rcaron umacron 15
+KPX rcaron uogonek 15
+KPX rcaron uring 15
+KPX rcaron v 30
+KPX rcaron y 30
+KPX rcaron yacute 30
+KPX rcaron ydieresis 30
+KPX rcommaaccent a -10
+KPX rcommaaccent aacute -10
+KPX rcommaaccent abreve -10
+KPX rcommaaccent acircumflex -10
+KPX rcommaaccent adieresis -10
+KPX rcommaaccent agrave -10
+KPX rcommaaccent amacron -10
+KPX rcommaaccent aogonek -10
+KPX rcommaaccent aring -10
+KPX rcommaaccent atilde -10
+KPX rcommaaccent colon 30
+KPX rcommaaccent comma -50
+KPX rcommaaccent i 15
+KPX rcommaaccent iacute 15
+KPX rcommaaccent icircumflex 15
+KPX rcommaaccent idieresis 15
+KPX rcommaaccent igrave 15
+KPX rcommaaccent imacron 15
+KPX rcommaaccent iogonek 15
+KPX rcommaaccent k 15
+KPX rcommaaccent kcommaaccent 15
+KPX rcommaaccent l 15
+KPX rcommaaccent lacute 15
+KPX rcommaaccent lcommaaccent 15
+KPX rcommaaccent lslash 15
+KPX rcommaaccent m 25
+KPX rcommaaccent n 25
+KPX rcommaaccent nacute 25
+KPX rcommaaccent ncaron 25
+KPX rcommaaccent ncommaaccent 25
+KPX rcommaaccent ntilde 25
+KPX rcommaaccent p 30
+KPX rcommaaccent period -50
+KPX rcommaaccent semicolon 30
+KPX rcommaaccent t 40
+KPX rcommaaccent tcommaaccent 40
+KPX rcommaaccent u 15
+KPX rcommaaccent uacute 15
+KPX rcommaaccent ucircumflex 15
+KPX rcommaaccent udieresis 15
+KPX rcommaaccent ugrave 15
+KPX rcommaaccent uhungarumlaut 15
+KPX rcommaaccent umacron 15
+KPX rcommaaccent uogonek 15
+KPX rcommaaccent uring 15
+KPX rcommaaccent v 30
+KPX rcommaaccent y 30
+KPX rcommaaccent yacute 30
+KPX rcommaaccent ydieresis 30
+KPX s comma -15
+KPX s period -15
+KPX s w -30
+KPX sacute comma -15
+KPX sacute period -15
+KPX sacute w -30
+KPX scaron comma -15
+KPX scaron period -15
+KPX scaron w -30
+KPX scedilla comma -15
+KPX scedilla period -15
+KPX scedilla w -30
+KPX scommaaccent comma -15
+KPX scommaaccent period -15
+KPX scommaaccent w -30
+KPX semicolon space -50
+KPX space T -50
+KPX space Tcaron -50
+KPX space Tcommaaccent -50
+KPX space V -50
+KPX space W -40
+KPX space Y -90
+KPX space Yacute -90
+KPX space Ydieresis -90
+KPX space quotedblleft -30
+KPX space quoteleft -60
+KPX v a -25
+KPX v aacute -25
+KPX v abreve -25
+KPX v acircumflex -25
+KPX v adieresis -25
+KPX v agrave -25
+KPX v amacron -25
+KPX v aogonek -25
+KPX v aring -25
+KPX v atilde -25
+KPX v comma -80
+KPX v e -25
+KPX v eacute -25
+KPX v ecaron -25
+KPX v ecircumflex -25
+KPX v edieresis -25
+KPX v edotaccent -25
+KPX v egrave -25
+KPX v emacron -25
+KPX v eogonek -25
+KPX v o -25
+KPX v oacute -25
+KPX v ocircumflex -25
+KPX v odieresis -25
+KPX v ograve -25
+KPX v ohungarumlaut -25
+KPX v omacron -25
+KPX v oslash -25
+KPX v otilde -25
+KPX v period -80
+KPX w a -15
+KPX w aacute -15
+KPX w abreve -15
+KPX w acircumflex -15
+KPX w adieresis -15
+KPX w agrave -15
+KPX w amacron -15
+KPX w aogonek -15
+KPX w aring -15
+KPX w atilde -15
+KPX w comma -60
+KPX w e -10
+KPX w eacute -10
+KPX w ecaron -10
+KPX w ecircumflex -10
+KPX w edieresis -10
+KPX w edotaccent -10
+KPX w egrave -10
+KPX w emacron -10
+KPX w eogonek -10
+KPX w o -10
+KPX w oacute -10
+KPX w ocircumflex -10
+KPX w odieresis -10
+KPX w ograve -10
+KPX w ohungarumlaut -10
+KPX w omacron -10
+KPX w oslash -10
+KPX w otilde -10
+KPX w period -60
+KPX x e -30
+KPX x eacute -30
+KPX x ecaron -30
+KPX x ecircumflex -30
+KPX x edieresis -30
+KPX x edotaccent -30
+KPX x egrave -30
+KPX x emacron -30
+KPX x eogonek -30
+KPX y a -20
+KPX y aacute -20
+KPX y abreve -20
+KPX y acircumflex -20
+KPX y adieresis -20
+KPX y agrave -20
+KPX y amacron -20
+KPX y aogonek -20
+KPX y aring -20
+KPX y atilde -20
+KPX y comma -100
+KPX y e -20
+KPX y eacute -20
+KPX y ecaron -20
+KPX y ecircumflex -20
+KPX y edieresis -20
+KPX y edotaccent -20
+KPX y egrave -20
+KPX y emacron -20
+KPX y eogonek -20
+KPX y o -20
+KPX y oacute -20
+KPX y ocircumflex -20
+KPX y odieresis -20
+KPX y ograve -20
+KPX y ohungarumlaut -20
+KPX y omacron -20
+KPX y oslash -20
+KPX y otilde -20
+KPX y period -100
+KPX yacute a -20
+KPX yacute aacute -20
+KPX yacute abreve -20
+KPX yacute acircumflex -20
+KPX yacute adieresis -20
+KPX yacute agrave -20
+KPX yacute amacron -20
+KPX yacute aogonek -20
+KPX yacute aring -20
+KPX yacute atilde -20
+KPX yacute comma -100
+KPX yacute e -20
+KPX yacute eacute -20
+KPX yacute ecaron -20
+KPX yacute ecircumflex -20
+KPX yacute edieresis -20
+KPX yacute edotaccent -20
+KPX yacute egrave -20
+KPX yacute emacron -20
+KPX yacute eogonek -20
+KPX yacute o -20
+KPX yacute oacute -20
+KPX yacute ocircumflex -20
+KPX yacute odieresis -20
+KPX yacute ograve -20
+KPX yacute ohungarumlaut -20
+KPX yacute omacron -20
+KPX yacute oslash -20
+KPX yacute otilde -20
+KPX yacute period -100
+KPX ydieresis a -20
+KPX ydieresis aacute -20
+KPX ydieresis abreve -20
+KPX ydieresis acircumflex -20
+KPX ydieresis adieresis -20
+KPX ydieresis agrave -20
+KPX ydieresis amacron -20
+KPX ydieresis aogonek -20
+KPX ydieresis aring -20
+KPX ydieresis atilde -20
+KPX ydieresis comma -100
+KPX ydieresis e -20
+KPX ydieresis eacute -20
+KPX ydieresis ecaron -20
+KPX ydieresis ecircumflex -20
+KPX ydieresis edieresis -20
+KPX ydieresis edotaccent -20
+KPX ydieresis egrave -20
+KPX ydieresis emacron -20
+KPX ydieresis eogonek -20
+KPX ydieresis o -20
+KPX ydieresis oacute -20
+KPX ydieresis ocircumflex -20
+KPX ydieresis odieresis -20
+KPX ydieresis ograve -20
+KPX ydieresis ohungarumlaut -20
+KPX ydieresis omacron -20
+KPX ydieresis oslash -20
+KPX ydieresis otilde -20
+KPX ydieresis period -100
+KPX z e -15
+KPX z eacute -15
+KPX z ecaron -15
+KPX z ecircumflex -15
+KPX z edieresis -15
+KPX z edotaccent -15
+KPX z egrave -15
+KPX z emacron -15
+KPX z eogonek -15
+KPX z o -15
+KPX z oacute -15
+KPX z ocircumflex -15
+KPX z odieresis -15
+KPX z ograve -15
+KPX z ohungarumlaut -15
+KPX z omacron -15
+KPX z oslash -15
+KPX z otilde -15
+KPX zacute e -15
+KPX zacute eacute -15
+KPX zacute ecaron -15
+KPX zacute ecircumflex -15
+KPX zacute edieresis -15
+KPX zacute edotaccent -15
+KPX zacute egrave -15
+KPX zacute emacron -15
+KPX zacute eogonek -15
+KPX zacute o -15
+KPX zacute oacute -15
+KPX zacute ocircumflex -15
+KPX zacute odieresis -15
+KPX zacute ograve -15
+KPX zacute ohungarumlaut -15
+KPX zacute omacron -15
+KPX zacute oslash -15
+KPX zacute otilde -15
+KPX zcaron e -15
+KPX zcaron eacute -15
+KPX zcaron ecaron -15
+KPX zcaron ecircumflex -15
+KPX zcaron edieresis -15
+KPX zcaron edotaccent -15
+KPX zcaron egrave -15
+KPX zcaron emacron -15
+KPX zcaron eogonek -15
+KPX zcaron o -15
+KPX zcaron oacute -15
+KPX zcaron ocircumflex -15
+KPX zcaron odieresis -15
+KPX zcaron ograve -15
+KPX zcaron ohungarumlaut -15
+KPX zcaron omacron -15
+KPX zcaron oslash -15
+KPX zcaron otilde -15
+KPX zdotaccent e -15
+KPX zdotaccent eacute -15
+KPX zdotaccent ecaron -15
+KPX zdotaccent ecircumflex -15
+KPX zdotaccent edieresis -15
+KPX zdotaccent edotaccent -15
+KPX zdotaccent egrave -15
+KPX zdotaccent emacron -15
+KPX zdotaccent eogonek -15
+KPX zdotaccent o -15
+KPX zdotaccent oacute -15
+KPX zdotaccent ocircumflex -15
+KPX zdotaccent odieresis -15
+KPX zdotaccent ograve -15
+KPX zdotaccent ohungarumlaut -15
+KPX zdotaccent omacron -15
+KPX zdotaccent oslash -15
+KPX zdotaccent otilde -15
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Symbol.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Symbol.afm
new file mode 100644
index 0000000..6a5386a
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Symbol.afm
@@ -0,0 +1,213 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All rights reserved.
+Comment Creation Date: Thu May 1 15:12:25 1997
+Comment UniqueID 43064
+Comment VMusage 30820 39997
+FontName Symbol
+FullName Symbol
+FamilyName Symbol
+Weight Medium
+ItalicAngle 0
+IsFixedPitch false
+CharacterSet Special
+FontBBox -180 -293 1090 1010
+UnderlinePosition -100
+UnderlineThickness 50
+Version 001.008
+Notice Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All rights reserved.
+EncodingScheme FontSpecific
+StdHW 92
+StdVW 85
+StartCharMetrics 190
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 128 -17 240 672 ;
+C 34 ; WX 713 ; N universal ; B 31 0 681 705 ;
+C 35 ; WX 500 ; N numbersign ; B 20 -16 481 673 ;
+C 36 ; WX 549 ; N existential ; B 25 0 478 707 ;
+C 37 ; WX 833 ; N percent ; B 63 -36 771 655 ;
+C 38 ; WX 778 ; N ampersand ; B 41 -18 750 661 ;
+C 39 ; WX 439 ; N suchthat ; B 48 -17 414 500 ;
+C 40 ; WX 333 ; N parenleft ; B 53 -191 300 673 ;
+C 41 ; WX 333 ; N parenright ; B 30 -191 277 673 ;
+C 42 ; WX 500 ; N asteriskmath ; B 65 134 427 551 ;
+C 43 ; WX 549 ; N plus ; B 10 0 539 533 ;
+C 44 ; WX 250 ; N comma ; B 56 -152 194 104 ;
+C 45 ; WX 549 ; N minus ; B 11 233 535 288 ;
+C 46 ; WX 250 ; N period ; B 69 -17 181 95 ;
+C 47 ; WX 278 ; N slash ; B 0 -18 254 646 ;
+C 48 ; WX 500 ; N zero ; B 24 -14 476 685 ;
+C 49 ; WX 500 ; N one ; B 117 0 390 673 ;
+C 50 ; WX 500 ; N two ; B 25 0 475 685 ;
+C 51 ; WX 500 ; N three ; B 43 -14 435 685 ;
+C 52 ; WX 500 ; N four ; B 15 0 469 685 ;
+C 53 ; WX 500 ; N five ; B 32 -14 445 690 ;
+C 54 ; WX 500 ; N six ; B 34 -14 468 685 ;
+C 55 ; WX 500 ; N seven ; B 24 -16 448 673 ;
+C 56 ; WX 500 ; N eight ; B 56 -14 445 685 ;
+C 57 ; WX 500 ; N nine ; B 30 -18 459 685 ;
+C 58 ; WX 278 ; N colon ; B 81 -17 193 460 ;
+C 59 ; WX 278 ; N semicolon ; B 83 -152 221 460 ;
+C 60 ; WX 549 ; N less ; B 26 0 523 522 ;
+C 61 ; WX 549 ; N equal ; B 11 141 537 390 ;
+C 62 ; WX 549 ; N greater ; B 26 0 523 522 ;
+C 63 ; WX 444 ; N question ; B 70 -17 412 686 ;
+C 64 ; WX 549 ; N congruent ; B 11 0 537 475 ;
+C 65 ; WX 722 ; N Alpha ; B 4 0 684 673 ;
+C 66 ; WX 667 ; N Beta ; B 29 0 592 673 ;
+C 67 ; WX 722 ; N Chi ; B -9 0 704 673 ;
+C 68 ; WX 612 ; N Delta ; B 6 0 608 688 ;
+C 69 ; WX 611 ; N Epsilon ; B 32 0 617 673 ;
+C 70 ; WX 763 ; N Phi ; B 26 0 741 673 ;
+C 71 ; WX 603 ; N Gamma ; B 24 0 609 673 ;
+C 72 ; WX 722 ; N Eta ; B 39 0 729 673 ;
+C 73 ; WX 333 ; N Iota ; B 32 0 316 673 ;
+C 74 ; WX 631 ; N theta1 ; B 18 -18 623 689 ;
+C 75 ; WX 722 ; N Kappa ; B 35 0 722 673 ;
+C 76 ; WX 686 ; N Lambda ; B 6 0 680 688 ;
+C 77 ; WX 889 ; N Mu ; B 28 0 887 673 ;
+C 78 ; WX 722 ; N Nu ; B 29 -8 720 673 ;
+C 79 ; WX 722 ; N Omicron ; B 41 -17 715 685 ;
+C 80 ; WX 768 ; N Pi ; B 25 0 745 673 ;
+C 81 ; WX 741 ; N Theta ; B 41 -17 715 685 ;
+C 82 ; WX 556 ; N Rho ; B 28 0 563 673 ;
+C 83 ; WX 592 ; N Sigma ; B 5 0 589 673 ;
+C 84 ; WX 611 ; N Tau ; B 33 0 607 673 ;
+C 85 ; WX 690 ; N Upsilon ; B -8 0 694 673 ;
+C 86 ; WX 439 ; N sigma1 ; B 40 -233 436 500 ;
+C 87 ; WX 768 ; N Omega ; B 34 0 736 688 ;
+C 88 ; WX 645 ; N Xi ; B 40 0 599 673 ;
+C 89 ; WX 795 ; N Psi ; B 15 0 781 684 ;
+C 90 ; WX 611 ; N Zeta ; B 44 0 636 673 ;
+C 91 ; WX 333 ; N bracketleft ; B 86 -155 299 674 ;
+C 92 ; WX 863 ; N therefore ; B 163 0 701 487 ;
+C 93 ; WX 333 ; N bracketright ; B 33 -155 246 674 ;
+C 94 ; WX 658 ; N perpendicular ; B 15 0 652 674 ;
+C 95 ; WX 500 ; N underscore ; B -2 -125 502 -75 ;
+C 96 ; WX 500 ; N radicalex ; B 480 881 1090 917 ;
+C 97 ; WX 631 ; N alpha ; B 41 -18 622 500 ;
+C 98 ; WX 549 ; N beta ; B 61 -223 515 741 ;
+C 99 ; WX 549 ; N chi ; B 12 -231 522 499 ;
+C 100 ; WX 494 ; N delta ; B 40 -19 481 740 ;
+C 101 ; WX 439 ; N epsilon ; B 22 -19 427 502 ;
+C 102 ; WX 521 ; N phi ; B 28 -224 492 673 ;
+C 103 ; WX 411 ; N gamma ; B 5 -225 484 499 ;
+C 104 ; WX 603 ; N eta ; B 0 -202 527 514 ;
+C 105 ; WX 329 ; N iota ; B 0 -17 301 503 ;
+C 106 ; WX 603 ; N phi1 ; B 36 -224 587 499 ;
+C 107 ; WX 549 ; N kappa ; B 33 0 558 501 ;
+C 108 ; WX 549 ; N lambda ; B 24 -17 548 739 ;
+C 109 ; WX 576 ; N mu ; B 33 -223 567 500 ;
+C 110 ; WX 521 ; N nu ; B -9 -16 475 507 ;
+C 111 ; WX 549 ; N omicron ; B 35 -19 501 499 ;
+C 112 ; WX 549 ; N pi ; B 10 -19 530 487 ;
+C 113 ; WX 521 ; N theta ; B 43 -17 485 690 ;
+C 114 ; WX 549 ; N rho ; B 50 -230 490 499 ;
+C 115 ; WX 603 ; N sigma ; B 30 -21 588 500 ;
+C 116 ; WX 439 ; N tau ; B 10 -19 418 500 ;
+C 117 ; WX 576 ; N upsilon ; B 7 -18 535 507 ;
+C 118 ; WX 713 ; N omega1 ; B 12 -18 671 583 ;
+C 119 ; WX 686 ; N omega ; B 42 -17 684 500 ;
+C 120 ; WX 493 ; N xi ; B 27 -224 469 766 ;
+C 121 ; WX 686 ; N psi ; B 12 -228 701 500 ;
+C 122 ; WX 494 ; N zeta ; B 60 -225 467 756 ;
+C 123 ; WX 480 ; N braceleft ; B 58 -183 397 673 ;
+C 124 ; WX 200 ; N bar ; B 65 -293 135 707 ;
+C 125 ; WX 480 ; N braceright ; B 79 -183 418 673 ;
+C 126 ; WX 549 ; N similar ; B 17 203 529 307 ;
+C 160 ; WX 750 ; N Euro ; B 20 -12 714 685 ;
+C 161 ; WX 620 ; N Upsilon1 ; B -2 0 610 685 ;
+C 162 ; WX 247 ; N minute ; B 27 459 228 735 ;
+C 163 ; WX 549 ; N lessequal ; B 29 0 526 639 ;
+C 164 ; WX 167 ; N fraction ; B -180 -12 340 677 ;
+C 165 ; WX 713 ; N infinity ; B 26 124 688 404 ;
+C 166 ; WX 500 ; N florin ; B 2 -193 494 686 ;
+C 167 ; WX 753 ; N club ; B 86 -26 660 533 ;
+C 168 ; WX 753 ; N diamond ; B 142 -36 600 550 ;
+C 169 ; WX 753 ; N heart ; B 117 -33 631 532 ;
+C 170 ; WX 753 ; N spade ; B 113 -36 629 548 ;
+C 171 ; WX 1042 ; N arrowboth ; B 24 -15 1024 511 ;
+C 172 ; WX 987 ; N arrowleft ; B 32 -15 942 511 ;
+C 173 ; WX 603 ; N arrowup ; B 45 0 571 910 ;
+C 174 ; WX 987 ; N arrowright ; B 49 -15 959 511 ;
+C 175 ; WX 603 ; N arrowdown ; B 45 -22 571 888 ;
+C 176 ; WX 400 ; N degree ; B 50 385 350 685 ;
+C 177 ; WX 549 ; N plusminus ; B 10 0 539 645 ;
+C 178 ; WX 411 ; N second ; B 20 459 413 737 ;
+C 179 ; WX 549 ; N greaterequal ; B 29 0 526 639 ;
+C 180 ; WX 549 ; N multiply ; B 17 8 533 524 ;
+C 181 ; WX 713 ; N proportional ; B 27 123 639 404 ;
+C 182 ; WX 494 ; N partialdiff ; B 26 -20 462 746 ;
+C 183 ; WX 460 ; N bullet ; B 50 113 410 473 ;
+C 184 ; WX 549 ; N divide ; B 10 71 536 456 ;
+C 185 ; WX 549 ; N notequal ; B 15 -25 540 549 ;
+C 186 ; WX 549 ; N equivalence ; B 14 82 538 443 ;
+C 187 ; WX 549 ; N approxequal ; B 14 135 527 394 ;
+C 188 ; WX 1000 ; N ellipsis ; B 111 -17 889 95 ;
+C 189 ; WX 603 ; N arrowvertex ; B 280 -120 336 1010 ;
+C 190 ; WX 1000 ; N arrowhorizex ; B -60 220 1050 276 ;
+C 191 ; WX 658 ; N carriagereturn ; B 15 -16 602 629 ;
+C 192 ; WX 823 ; N aleph ; B 175 -18 661 658 ;
+C 193 ; WX 686 ; N Ifraktur ; B 10 -53 578 740 ;
+C 194 ; WX 795 ; N Rfraktur ; B 26 -15 759 734 ;
+C 195 ; WX 987 ; N weierstrass ; B 159 -211 870 573 ;
+C 196 ; WX 768 ; N circlemultiply ; B 43 -17 733 673 ;
+C 197 ; WX 768 ; N circleplus ; B 43 -15 733 675 ;
+C 198 ; WX 823 ; N emptyset ; B 39 -24 781 719 ;
+C 199 ; WX 768 ; N intersection ; B 40 0 732 509 ;
+C 200 ; WX 768 ; N union ; B 40 -17 732 492 ;
+C 201 ; WX 713 ; N propersuperset ; B 20 0 673 470 ;
+C 202 ; WX 713 ; N reflexsuperset ; B 20 -125 673 470 ;
+C 203 ; WX 713 ; N notsubset ; B 36 -70 690 540 ;
+C 204 ; WX 713 ; N propersubset ; B 37 0 690 470 ;
+C 205 ; WX 713 ; N reflexsubset ; B 37 -125 690 470 ;
+C 206 ; WX 713 ; N element ; B 45 0 505 468 ;
+C 207 ; WX 713 ; N notelement ; B 45 -58 505 555 ;
+C 208 ; WX 768 ; N angle ; B 26 0 738 673 ;
+C 209 ; WX 713 ; N gradient ; B 36 -19 681 718 ;
+C 210 ; WX 790 ; N registerserif ; B 50 -17 740 673 ;
+C 211 ; WX 790 ; N copyrightserif ; B 51 -15 741 675 ;
+C 212 ; WX 890 ; N trademarkserif ; B 18 293 855 673 ;
+C 213 ; WX 823 ; N product ; B 25 -101 803 751 ;
+C 214 ; WX 549 ; N radical ; B 10 -38 515 917 ;
+C 215 ; WX 250 ; N dotmath ; B 69 210 169 310 ;
+C 216 ; WX 713 ; N logicalnot ; B 15 0 680 288 ;
+C 217 ; WX 603 ; N logicaland ; B 23 0 583 454 ;
+C 218 ; WX 603 ; N logicalor ; B 30 0 578 477 ;
+C 219 ; WX 1042 ; N arrowdblboth ; B 27 -20 1023 510 ;
+C 220 ; WX 987 ; N arrowdblleft ; B 30 -15 939 513 ;
+C 221 ; WX 603 ; N arrowdblup ; B 39 2 567 911 ;
+C 222 ; WX 987 ; N arrowdblright ; B 45 -20 954 508 ;
+C 223 ; WX 603 ; N arrowdbldown ; B 44 -19 572 890 ;
+C 224 ; WX 494 ; N lozenge ; B 18 0 466 745 ;
+C 225 ; WX 329 ; N angleleft ; B 25 -198 306 746 ;
+C 226 ; WX 790 ; N registersans ; B 50 -20 740 670 ;
+C 227 ; WX 790 ; N copyrightsans ; B 49 -15 739 675 ;
+C 228 ; WX 786 ; N trademarksans ; B 5 293 725 673 ;
+C 229 ; WX 713 ; N summation ; B 14 -108 695 752 ;
+C 230 ; WX 384 ; N parenlefttp ; B 24 -293 436 926 ;
+C 231 ; WX 384 ; N parenleftex ; B 24 -85 108 925 ;
+C 232 ; WX 384 ; N parenleftbt ; B 24 -293 436 926 ;
+C 233 ; WX 384 ; N bracketlefttp ; B 0 -80 349 926 ;
+C 234 ; WX 384 ; N bracketleftex ; B 0 -79 77 925 ;
+C 235 ; WX 384 ; N bracketleftbt ; B 0 -80 349 926 ;
+C 236 ; WX 494 ; N bracelefttp ; B 209 -85 445 925 ;
+C 237 ; WX 494 ; N braceleftmid ; B 20 -85 284 935 ;
+C 238 ; WX 494 ; N braceleftbt ; B 209 -75 445 935 ;
+C 239 ; WX 494 ; N braceex ; B 209 -85 284 935 ;
+C 241 ; WX 329 ; N angleright ; B 21 -198 302 746 ;
+C 242 ; WX 274 ; N integral ; B 2 -107 291 916 ;
+C 243 ; WX 686 ; N integraltp ; B 308 -88 675 920 ;
+C 244 ; WX 686 ; N integralex ; B 308 -88 378 975 ;
+C 245 ; WX 686 ; N integralbt ; B 11 -87 378 921 ;
+C 246 ; WX 384 ; N parenrighttp ; B 54 -293 466 926 ;
+C 247 ; WX 384 ; N parenrightex ; B 382 -85 466 925 ;
+C 248 ; WX 384 ; N parenrightbt ; B 54 -293 466 926 ;
+C 249 ; WX 384 ; N bracketrighttp ; B 22 -80 371 926 ;
+C 250 ; WX 384 ; N bracketrightex ; B 294 -79 371 925 ;
+C 251 ; WX 384 ; N bracketrightbt ; B 22 -80 371 926 ;
+C 252 ; WX 494 ; N bracerighttp ; B 48 -85 284 925 ;
+C 253 ; WX 494 ; N bracerightmid ; B 209 -85 473 935 ;
+C 254 ; WX 494 ; N bracerightbt ; B 48 -75 284 935 ;
+C -1 ; WX 790 ; N apple ; B 56 -3 733 808 ;
+EndCharMetrics
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Times-Bold.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Times-Bold.afm
new file mode 100644
index 0000000..559ebae
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Times-Bold.afm
@@ -0,0 +1,2588 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu May 1 12:52:56 1997
+Comment UniqueID 43065
+Comment VMusage 41636 52661
+FontName Times-Bold
+FullName Times Bold
+FamilyName Times
+Weight Bold
+ItalicAngle 0
+IsFixedPitch false
+CharacterSet ExtendedRoman
+FontBBox -168 -218 1000 935
+UnderlinePosition -100
+UnderlineThickness 50
+Version 002.000
+Notice Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.Times is a trademark of Linotype-Hell AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 676
+XHeight 461
+Ascender 683
+Descender -217
+StdHW 44
+StdVW 139
+StartCharMetrics 315
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 81 -13 251 691 ;
+C 34 ; WX 555 ; N quotedbl ; B 83 404 472 691 ;
+C 35 ; WX 500 ; N numbersign ; B 4 0 496 700 ;
+C 36 ; WX 500 ; N dollar ; B 29 -99 472 750 ;
+C 37 ; WX 1000 ; N percent ; B 124 -14 877 692 ;
+C 38 ; WX 833 ; N ampersand ; B 62 -16 787 691 ;
+C 39 ; WX 333 ; N quoteright ; B 79 356 263 691 ;
+C 40 ; WX 333 ; N parenleft ; B 46 -168 306 694 ;
+C 41 ; WX 333 ; N parenright ; B 27 -168 287 694 ;
+C 42 ; WX 500 ; N asterisk ; B 56 255 447 691 ;
+C 43 ; WX 570 ; N plus ; B 33 0 537 506 ;
+C 44 ; WX 250 ; N comma ; B 39 -180 223 155 ;
+C 45 ; WX 333 ; N hyphen ; B 44 171 287 287 ;
+C 46 ; WX 250 ; N period ; B 41 -13 210 156 ;
+C 47 ; WX 278 ; N slash ; B -24 -19 302 691 ;
+C 48 ; WX 500 ; N zero ; B 24 -13 476 688 ;
+C 49 ; WX 500 ; N one ; B 65 0 442 688 ;
+C 50 ; WX 500 ; N two ; B 17 0 478 688 ;
+C 51 ; WX 500 ; N three ; B 16 -14 468 688 ;
+C 52 ; WX 500 ; N four ; B 19 0 475 688 ;
+C 53 ; WX 500 ; N five ; B 22 -8 470 676 ;
+C 54 ; WX 500 ; N six ; B 28 -13 475 688 ;
+C 55 ; WX 500 ; N seven ; B 17 0 477 676 ;
+C 56 ; WX 500 ; N eight ; B 28 -13 472 688 ;
+C 57 ; WX 500 ; N nine ; B 26 -13 473 688 ;
+C 58 ; WX 333 ; N colon ; B 82 -13 251 472 ;
+C 59 ; WX 333 ; N semicolon ; B 82 -180 266 472 ;
+C 60 ; WX 570 ; N less ; B 31 -8 539 514 ;
+C 61 ; WX 570 ; N equal ; B 33 107 537 399 ;
+C 62 ; WX 570 ; N greater ; B 31 -8 539 514 ;
+C 63 ; WX 500 ; N question ; B 57 -13 445 689 ;
+C 64 ; WX 930 ; N at ; B 108 -19 822 691 ;
+C 65 ; WX 722 ; N A ; B 9 0 689 690 ;
+C 66 ; WX 667 ; N B ; B 16 0 619 676 ;
+C 67 ; WX 722 ; N C ; B 49 -19 687 691 ;
+C 68 ; WX 722 ; N D ; B 14 0 690 676 ;
+C 69 ; WX 667 ; N E ; B 16 0 641 676 ;
+C 70 ; WX 611 ; N F ; B 16 0 583 676 ;
+C 71 ; WX 778 ; N G ; B 37 -19 755 691 ;
+C 72 ; WX 778 ; N H ; B 21 0 759 676 ;
+C 73 ; WX 389 ; N I ; B 20 0 370 676 ;
+C 74 ; WX 500 ; N J ; B 3 -96 479 676 ;
+C 75 ; WX 778 ; N K ; B 30 0 769 676 ;
+C 76 ; WX 667 ; N L ; B 19 0 638 676 ;
+C 77 ; WX 944 ; N M ; B 14 0 921 676 ;
+C 78 ; WX 722 ; N N ; B 16 -18 701 676 ;
+C 79 ; WX 778 ; N O ; B 35 -19 743 691 ;
+C 80 ; WX 611 ; N P ; B 16 0 600 676 ;
+C 81 ; WX 778 ; N Q ; B 35 -176 743 691 ;
+C 82 ; WX 722 ; N R ; B 26 0 715 676 ;
+C 83 ; WX 556 ; N S ; B 35 -19 513 692 ;
+C 84 ; WX 667 ; N T ; B 31 0 636 676 ;
+C 85 ; WX 722 ; N U ; B 16 -19 701 676 ;
+C 86 ; WX 722 ; N V ; B 16 -18 701 676 ;
+C 87 ; WX 1000 ; N W ; B 19 -15 981 676 ;
+C 88 ; WX 722 ; N X ; B 16 0 699 676 ;
+C 89 ; WX 722 ; N Y ; B 15 0 699 676 ;
+C 90 ; WX 667 ; N Z ; B 28 0 634 676 ;
+C 91 ; WX 333 ; N bracketleft ; B 67 -149 301 678 ;
+C 92 ; WX 278 ; N backslash ; B -25 -19 303 691 ;
+C 93 ; WX 333 ; N bracketright ; B 32 -149 266 678 ;
+C 94 ; WX 581 ; N asciicircum ; B 73 311 509 676 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 333 ; N quoteleft ; B 70 356 254 691 ;
+C 97 ; WX 500 ; N a ; B 25 -14 488 473 ;
+C 98 ; WX 556 ; N b ; B 17 -14 521 676 ;
+C 99 ; WX 444 ; N c ; B 25 -14 430 473 ;
+C 100 ; WX 556 ; N d ; B 25 -14 534 676 ;
+C 101 ; WX 444 ; N e ; B 25 -14 426 473 ;
+C 102 ; WX 333 ; N f ; B 14 0 389 691 ; L i fi ; L l fl ;
+C 103 ; WX 500 ; N g ; B 28 -206 483 473 ;
+C 104 ; WX 556 ; N h ; B 16 0 534 676 ;
+C 105 ; WX 278 ; N i ; B 16 0 255 691 ;
+C 106 ; WX 333 ; N j ; B -57 -203 263 691 ;
+C 107 ; WX 556 ; N k ; B 22 0 543 676 ;
+C 108 ; WX 278 ; N l ; B 16 0 255 676 ;
+C 109 ; WX 833 ; N m ; B 16 0 814 473 ;
+C 110 ; WX 556 ; N n ; B 21 0 539 473 ;
+C 111 ; WX 500 ; N o ; B 25 -14 476 473 ;
+C 112 ; WX 556 ; N p ; B 19 -205 524 473 ;
+C 113 ; WX 556 ; N q ; B 34 -205 536 473 ;
+C 114 ; WX 444 ; N r ; B 29 0 434 473 ;
+C 115 ; WX 389 ; N s ; B 25 -14 361 473 ;
+C 116 ; WX 333 ; N t ; B 20 -12 332 630 ;
+C 117 ; WX 556 ; N u ; B 16 -14 537 461 ;
+C 118 ; WX 500 ; N v ; B 21 -14 485 461 ;
+C 119 ; WX 722 ; N w ; B 23 -14 707 461 ;
+C 120 ; WX 500 ; N x ; B 12 0 484 461 ;
+C 121 ; WX 500 ; N y ; B 16 -205 480 461 ;
+C 122 ; WX 444 ; N z ; B 21 0 420 461 ;
+C 123 ; WX 394 ; N braceleft ; B 22 -175 340 698 ;
+C 124 ; WX 220 ; N bar ; B 66 -218 154 782 ;
+C 125 ; WX 394 ; N braceright ; B 54 -175 372 698 ;
+C 126 ; WX 520 ; N asciitilde ; B 29 173 491 333 ;
+C 161 ; WX 333 ; N exclamdown ; B 82 -203 252 501 ;
+C 162 ; WX 500 ; N cent ; B 53 -140 458 588 ;
+C 163 ; WX 500 ; N sterling ; B 21 -14 477 684 ;
+C 164 ; WX 167 ; N fraction ; B -168 -12 329 688 ;
+C 165 ; WX 500 ; N yen ; B -64 0 547 676 ;
+C 166 ; WX 500 ; N florin ; B 0 -155 498 706 ;
+C 167 ; WX 500 ; N section ; B 57 -132 443 691 ;
+C 168 ; WX 500 ; N currency ; B -26 61 526 613 ;
+C 169 ; WX 278 ; N quotesingle ; B 75 404 204 691 ;
+C 170 ; WX 500 ; N quotedblleft ; B 32 356 486 691 ;
+C 171 ; WX 500 ; N guillemotleft ; B 23 36 473 415 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 51 36 305 415 ;
+C 173 ; WX 333 ; N guilsinglright ; B 28 36 282 415 ;
+C 174 ; WX 556 ; N fi ; B 14 0 536 691 ;
+C 175 ; WX 556 ; N fl ; B 14 0 536 691 ;
+C 177 ; WX 500 ; N endash ; B 0 181 500 271 ;
+C 178 ; WX 500 ; N dagger ; B 47 -134 453 691 ;
+C 179 ; WX 500 ; N daggerdbl ; B 45 -132 456 691 ;
+C 180 ; WX 250 ; N periodcentered ; B 41 248 210 417 ;
+C 182 ; WX 540 ; N paragraph ; B 0 -186 519 676 ;
+C 183 ; WX 350 ; N bullet ; B 35 198 315 478 ;
+C 184 ; WX 333 ; N quotesinglbase ; B 79 -180 263 155 ;
+C 185 ; WX 500 ; N quotedblbase ; B 14 -180 468 155 ;
+C 186 ; WX 500 ; N quotedblright ; B 14 356 468 691 ;
+C 187 ; WX 500 ; N guillemotright ; B 27 36 477 415 ;
+C 188 ; WX 1000 ; N ellipsis ; B 82 -13 917 156 ;
+C 189 ; WX 1000 ; N perthousand ; B 7 -29 995 706 ;
+C 191 ; WX 500 ; N questiondown ; B 55 -201 443 501 ;
+C 193 ; WX 333 ; N grave ; B 8 528 246 713 ;
+C 194 ; WX 333 ; N acute ; B 86 528 324 713 ;
+C 195 ; WX 333 ; N circumflex ; B -2 528 335 704 ;
+C 196 ; WX 333 ; N tilde ; B -16 547 349 674 ;
+C 197 ; WX 333 ; N macron ; B 1 565 331 637 ;
+C 198 ; WX 333 ; N breve ; B 15 528 318 691 ;
+C 199 ; WX 333 ; N dotaccent ; B 103 536 258 691 ;
+C 200 ; WX 333 ; N dieresis ; B -2 537 335 667 ;
+C 202 ; WX 333 ; N ring ; B 60 527 273 740 ;
+C 203 ; WX 333 ; N cedilla ; B 68 -218 294 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B -13 528 425 713 ;
+C 206 ; WX 333 ; N ogonek ; B 90 -193 319 24 ;
+C 207 ; WX 333 ; N caron ; B -2 528 335 704 ;
+C 208 ; WX 1000 ; N emdash ; B 0 181 1000 271 ;
+C 225 ; WX 1000 ; N AE ; B 4 0 951 676 ;
+C 227 ; WX 300 ; N ordfeminine ; B -1 397 301 688 ;
+C 232 ; WX 667 ; N Lslash ; B 19 0 638 676 ;
+C 233 ; WX 778 ; N Oslash ; B 35 -74 743 737 ;
+C 234 ; WX 1000 ; N OE ; B 22 -5 981 684 ;
+C 235 ; WX 330 ; N ordmasculine ; B 18 397 312 688 ;
+C 241 ; WX 722 ; N ae ; B 33 -14 693 473 ;
+C 245 ; WX 278 ; N dotlessi ; B 16 0 255 461 ;
+C 248 ; WX 278 ; N lslash ; B -22 0 303 676 ;
+C 249 ; WX 500 ; N oslash ; B 25 -92 476 549 ;
+C 250 ; WX 722 ; N oe ; B 22 -14 696 473 ;
+C 251 ; WX 556 ; N germandbls ; B 19 -12 517 691 ;
+C -1 ; WX 389 ; N Idieresis ; B 20 0 370 877 ;
+C -1 ; WX 444 ; N eacute ; B 25 -14 426 713 ;
+C -1 ; WX 500 ; N abreve ; B 25 -14 488 691 ;
+C -1 ; WX 556 ; N uhungarumlaut ; B 16 -14 557 713 ;
+C -1 ; WX 444 ; N ecaron ; B 25 -14 426 704 ;
+C -1 ; WX 722 ; N Ydieresis ; B 15 0 699 877 ;
+C -1 ; WX 570 ; N divide ; B 33 -31 537 537 ;
+C -1 ; WX 722 ; N Yacute ; B 15 0 699 923 ;
+C -1 ; WX 722 ; N Acircumflex ; B 9 0 689 914 ;
+C -1 ; WX 500 ; N aacute ; B 25 -14 488 713 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 16 -19 701 914 ;
+C -1 ; WX 500 ; N yacute ; B 16 -205 480 713 ;
+C -1 ; WX 389 ; N scommaaccent ; B 25 -218 361 473 ;
+C -1 ; WX 444 ; N ecircumflex ; B 25 -14 426 704 ;
+C -1 ; WX 722 ; N Uring ; B 16 -19 701 935 ;
+C -1 ; WX 722 ; N Udieresis ; B 16 -19 701 877 ;
+C -1 ; WX 500 ; N aogonek ; B 25 -193 504 473 ;
+C -1 ; WX 722 ; N Uacute ; B 16 -19 701 923 ;
+C -1 ; WX 556 ; N uogonek ; B 16 -193 539 461 ;
+C -1 ; WX 667 ; N Edieresis ; B 16 0 641 877 ;
+C -1 ; WX 722 ; N Dcroat ; B 6 0 690 676 ;
+C -1 ; WX 250 ; N commaaccent ; B 47 -218 203 -50 ;
+C -1 ; WX 747 ; N copyright ; B 26 -19 721 691 ;
+C -1 ; WX 667 ; N Emacron ; B 16 0 641 847 ;
+C -1 ; WX 444 ; N ccaron ; B 25 -14 430 704 ;
+C -1 ; WX 500 ; N aring ; B 25 -14 488 740 ;
+C -1 ; WX 722 ; N Ncommaaccent ; B 16 -188 701 676 ;
+C -1 ; WX 278 ; N lacute ; B 16 0 297 923 ;
+C -1 ; WX 500 ; N agrave ; B 25 -14 488 713 ;
+C -1 ; WX 667 ; N Tcommaaccent ; B 31 -218 636 676 ;
+C -1 ; WX 722 ; N Cacute ; B 49 -19 687 923 ;
+C -1 ; WX 500 ; N atilde ; B 25 -14 488 674 ;
+C -1 ; WX 667 ; N Edotaccent ; B 16 0 641 901 ;
+C -1 ; WX 389 ; N scaron ; B 25 -14 363 704 ;
+C -1 ; WX 389 ; N scedilla ; B 25 -218 361 473 ;
+C -1 ; WX 278 ; N iacute ; B 16 0 289 713 ;
+C -1 ; WX 494 ; N lozenge ; B 10 0 484 745 ;
+C -1 ; WX 722 ; N Rcaron ; B 26 0 715 914 ;
+C -1 ; WX 778 ; N Gcommaaccent ; B 37 -218 755 691 ;
+C -1 ; WX 556 ; N ucircumflex ; B 16 -14 537 704 ;
+C -1 ; WX 500 ; N acircumflex ; B 25 -14 488 704 ;
+C -1 ; WX 722 ; N Amacron ; B 9 0 689 847 ;
+C -1 ; WX 444 ; N rcaron ; B 29 0 434 704 ;
+C -1 ; WX 444 ; N ccedilla ; B 25 -218 430 473 ;
+C -1 ; WX 667 ; N Zdotaccent ; B 28 0 634 901 ;
+C -1 ; WX 611 ; N Thorn ; B 16 0 600 676 ;
+C -1 ; WX 778 ; N Omacron ; B 35 -19 743 847 ;
+C -1 ; WX 722 ; N Racute ; B 26 0 715 923 ;
+C -1 ; WX 556 ; N Sacute ; B 35 -19 513 923 ;
+C -1 ; WX 672 ; N dcaron ; B 25 -14 681 682 ;
+C -1 ; WX 722 ; N Umacron ; B 16 -19 701 847 ;
+C -1 ; WX 556 ; N uring ; B 16 -14 537 740 ;
+C -1 ; WX 300 ; N threesuperior ; B 3 268 297 688 ;
+C -1 ; WX 778 ; N Ograve ; B 35 -19 743 923 ;
+C -1 ; WX 722 ; N Agrave ; B 9 0 689 923 ;
+C -1 ; WX 722 ; N Abreve ; B 9 0 689 901 ;
+C -1 ; WX 570 ; N multiply ; B 48 16 522 490 ;
+C -1 ; WX 556 ; N uacute ; B 16 -14 537 713 ;
+C -1 ; WX 667 ; N Tcaron ; B 31 0 636 914 ;
+C -1 ; WX 494 ; N partialdiff ; B 11 -21 494 750 ;
+C -1 ; WX 500 ; N ydieresis ; B 16 -205 480 667 ;
+C -1 ; WX 722 ; N Nacute ; B 16 -18 701 923 ;
+C -1 ; WX 278 ; N icircumflex ; B -37 0 300 704 ;
+C -1 ; WX 667 ; N Ecircumflex ; B 16 0 641 914 ;
+C -1 ; WX 500 ; N adieresis ; B 25 -14 488 667 ;
+C -1 ; WX 444 ; N edieresis ; B 25 -14 426 667 ;
+C -1 ; WX 444 ; N cacute ; B 25 -14 430 713 ;
+C -1 ; WX 556 ; N nacute ; B 21 0 539 713 ;
+C -1 ; WX 556 ; N umacron ; B 16 -14 537 637 ;
+C -1 ; WX 722 ; N Ncaron ; B 16 -18 701 914 ;
+C -1 ; WX 389 ; N Iacute ; B 20 0 370 923 ;
+C -1 ; WX 570 ; N plusminus ; B 33 0 537 506 ;
+C -1 ; WX 220 ; N brokenbar ; B 66 -143 154 707 ;
+C -1 ; WX 747 ; N registered ; B 26 -19 721 691 ;
+C -1 ; WX 778 ; N Gbreve ; B 37 -19 755 901 ;
+C -1 ; WX 389 ; N Idotaccent ; B 20 0 370 901 ;
+C -1 ; WX 600 ; N summation ; B 14 -10 585 706 ;
+C -1 ; WX 667 ; N Egrave ; B 16 0 641 923 ;
+C -1 ; WX 444 ; N racute ; B 29 0 434 713 ;
+C -1 ; WX 500 ; N omacron ; B 25 -14 476 637 ;
+C -1 ; WX 667 ; N Zacute ; B 28 0 634 923 ;
+C -1 ; WX 667 ; N Zcaron ; B 28 0 634 914 ;
+C -1 ; WX 549 ; N greaterequal ; B 26 0 523 704 ;
+C -1 ; WX 722 ; N Eth ; B 6 0 690 676 ;
+C -1 ; WX 722 ; N Ccedilla ; B 49 -218 687 691 ;
+C -1 ; WX 278 ; N lcommaaccent ; B 16 -218 255 676 ;
+C -1 ; WX 416 ; N tcaron ; B 20 -12 425 815 ;
+C -1 ; WX 444 ; N eogonek ; B 25 -193 426 473 ;
+C -1 ; WX 722 ; N Uogonek ; B 16 -193 701 676 ;
+C -1 ; WX 722 ; N Aacute ; B 9 0 689 923 ;
+C -1 ; WX 722 ; N Adieresis ; B 9 0 689 877 ;
+C -1 ; WX 444 ; N egrave ; B 25 -14 426 713 ;
+C -1 ; WX 444 ; N zacute ; B 21 0 420 713 ;
+C -1 ; WX 278 ; N iogonek ; B 16 -193 274 691 ;
+C -1 ; WX 778 ; N Oacute ; B 35 -19 743 923 ;
+C -1 ; WX 500 ; N oacute ; B 25 -14 476 713 ;
+C -1 ; WX 500 ; N amacron ; B 25 -14 488 637 ;
+C -1 ; WX 389 ; N sacute ; B 25 -14 361 713 ;
+C -1 ; WX 278 ; N idieresis ; B -37 0 300 667 ;
+C -1 ; WX 778 ; N Ocircumflex ; B 35 -19 743 914 ;
+C -1 ; WX 722 ; N Ugrave ; B 16 -19 701 923 ;
+C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
+C -1 ; WX 556 ; N thorn ; B 19 -205 524 676 ;
+C -1 ; WX 300 ; N twosuperior ; B 0 275 300 688 ;
+C -1 ; WX 778 ; N Odieresis ; B 35 -19 743 877 ;
+C -1 ; WX 556 ; N mu ; B 33 -206 536 461 ;
+C -1 ; WX 278 ; N igrave ; B -27 0 255 713 ;
+C -1 ; WX 500 ; N ohungarumlaut ; B 25 -14 529 713 ;
+C -1 ; WX 667 ; N Eogonek ; B 16 -193 644 676 ;
+C -1 ; WX 556 ; N dcroat ; B 25 -14 534 676 ;
+C -1 ; WX 750 ; N threequarters ; B 23 -12 733 688 ;
+C -1 ; WX 556 ; N Scedilla ; B 35 -218 513 692 ;
+C -1 ; WX 394 ; N lcaron ; B 16 0 412 682 ;
+C -1 ; WX 778 ; N Kcommaaccent ; B 30 -218 769 676 ;
+C -1 ; WX 667 ; N Lacute ; B 19 0 638 923 ;
+C -1 ; WX 1000 ; N trademark ; B 24 271 977 676 ;
+C -1 ; WX 444 ; N edotaccent ; B 25 -14 426 691 ;
+C -1 ; WX 389 ; N Igrave ; B 20 0 370 923 ;
+C -1 ; WX 389 ; N Imacron ; B 20 0 370 847 ;
+C -1 ; WX 667 ; N Lcaron ; B 19 0 652 682 ;
+C -1 ; WX 750 ; N onehalf ; B -7 -12 775 688 ;
+C -1 ; WX 549 ; N lessequal ; B 29 0 526 704 ;
+C -1 ; WX 500 ; N ocircumflex ; B 25 -14 476 704 ;
+C -1 ; WX 556 ; N ntilde ; B 21 0 539 674 ;
+C -1 ; WX 722 ; N Uhungarumlaut ; B 16 -19 701 923 ;
+C -1 ; WX 667 ; N Eacute ; B 16 0 641 923 ;
+C -1 ; WX 444 ; N emacron ; B 25 -14 426 637 ;
+C -1 ; WX 500 ; N gbreve ; B 28 -206 483 691 ;
+C -1 ; WX 750 ; N onequarter ; B 28 -12 743 688 ;
+C -1 ; WX 556 ; N Scaron ; B 35 -19 513 914 ;
+C -1 ; WX 556 ; N Scommaaccent ; B 35 -218 513 692 ;
+C -1 ; WX 778 ; N Ohungarumlaut ; B 35 -19 743 923 ;
+C -1 ; WX 400 ; N degree ; B 57 402 343 688 ;
+C -1 ; WX 500 ; N ograve ; B 25 -14 476 713 ;
+C -1 ; WX 722 ; N Ccaron ; B 49 -19 687 914 ;
+C -1 ; WX 556 ; N ugrave ; B 16 -14 537 713 ;
+C -1 ; WX 549 ; N radical ; B 10 -46 512 850 ;
+C -1 ; WX 722 ; N Dcaron ; B 14 0 690 914 ;
+C -1 ; WX 444 ; N rcommaaccent ; B 29 -218 434 473 ;
+C -1 ; WX 722 ; N Ntilde ; B 16 -18 701 884 ;
+C -1 ; WX 500 ; N otilde ; B 25 -14 476 674 ;
+C -1 ; WX 722 ; N Rcommaaccent ; B 26 -218 715 676 ;
+C -1 ; WX 667 ; N Lcommaaccent ; B 19 -218 638 676 ;
+C -1 ; WX 722 ; N Atilde ; B 9 0 689 884 ;
+C -1 ; WX 722 ; N Aogonek ; B 9 -193 699 690 ;
+C -1 ; WX 722 ; N Aring ; B 9 0 689 935 ;
+C -1 ; WX 778 ; N Otilde ; B 35 -19 743 884 ;
+C -1 ; WX 444 ; N zdotaccent ; B 21 0 420 691 ;
+C -1 ; WX 667 ; N Ecaron ; B 16 0 641 914 ;
+C -1 ; WX 389 ; N Iogonek ; B 20 -193 370 676 ;
+C -1 ; WX 556 ; N kcommaaccent ; B 22 -218 543 676 ;
+C -1 ; WX 570 ; N minus ; B 33 209 537 297 ;
+C -1 ; WX 389 ; N Icircumflex ; B 20 0 370 914 ;
+C -1 ; WX 556 ; N ncaron ; B 21 0 539 704 ;
+C -1 ; WX 333 ; N tcommaaccent ; B 20 -218 332 630 ;
+C -1 ; WX 570 ; N logicalnot ; B 33 108 537 399 ;
+C -1 ; WX 500 ; N odieresis ; B 25 -14 476 667 ;
+C -1 ; WX 556 ; N udieresis ; B 16 -14 537 667 ;
+C -1 ; WX 549 ; N notequal ; B 15 -49 540 570 ;
+C -1 ; WX 500 ; N gcommaaccent ; B 28 -206 483 829 ;
+C -1 ; WX 500 ; N eth ; B 25 -14 476 691 ;
+C -1 ; WX 444 ; N zcaron ; B 21 0 420 704 ;
+C -1 ; WX 556 ; N ncommaaccent ; B 21 -218 539 473 ;
+C -1 ; WX 300 ; N onesuperior ; B 28 275 273 688 ;
+C -1 ; WX 278 ; N imacron ; B -8 0 272 637 ;
+C -1 ; WX 500 ; N Euro ; B 0 0 0 0 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 2242
+KPX A C -55
+KPX A Cacute -55
+KPX A Ccaron -55
+KPX A Ccedilla -55
+KPX A G -55
+KPX A Gbreve -55
+KPX A Gcommaaccent -55
+KPX A O -45
+KPX A Oacute -45
+KPX A Ocircumflex -45
+KPX A Odieresis -45
+KPX A Ograve -45
+KPX A Ohungarumlaut -45
+KPX A Omacron -45
+KPX A Oslash -45
+KPX A Otilde -45
+KPX A Q -45
+KPX A T -95
+KPX A Tcaron -95
+KPX A Tcommaaccent -95
+KPX A U -50
+KPX A Uacute -50
+KPX A Ucircumflex -50
+KPX A Udieresis -50
+KPX A Ugrave -50
+KPX A Uhungarumlaut -50
+KPX A Umacron -50
+KPX A Uogonek -50
+KPX A Uring -50
+KPX A V -145
+KPX A W -130
+KPX A Y -100
+KPX A Yacute -100
+KPX A Ydieresis -100
+KPX A p -25
+KPX A quoteright -74
+KPX A u -50
+KPX A uacute -50
+KPX A ucircumflex -50
+KPX A udieresis -50
+KPX A ugrave -50
+KPX A uhungarumlaut -50
+KPX A umacron -50
+KPX A uogonek -50
+KPX A uring -50
+KPX A v -100
+KPX A w -90
+KPX A y -74
+KPX A yacute -74
+KPX A ydieresis -74
+KPX Aacute C -55
+KPX Aacute Cacute -55
+KPX Aacute Ccaron -55
+KPX Aacute Ccedilla -55
+KPX Aacute G -55
+KPX Aacute Gbreve -55
+KPX Aacute Gcommaaccent -55
+KPX Aacute O -45
+KPX Aacute Oacute -45
+KPX Aacute Ocircumflex -45
+KPX Aacute Odieresis -45
+KPX Aacute Ograve -45
+KPX Aacute Ohungarumlaut -45
+KPX Aacute Omacron -45
+KPX Aacute Oslash -45
+KPX Aacute Otilde -45
+KPX Aacute Q -45
+KPX Aacute T -95
+KPX Aacute Tcaron -95
+KPX Aacute Tcommaaccent -95
+KPX Aacute U -50
+KPX Aacute Uacute -50
+KPX Aacute Ucircumflex -50
+KPX Aacute Udieresis -50
+KPX Aacute Ugrave -50
+KPX Aacute Uhungarumlaut -50
+KPX Aacute Umacron -50
+KPX Aacute Uogonek -50
+KPX Aacute Uring -50
+KPX Aacute V -145
+KPX Aacute W -130
+KPX Aacute Y -100
+KPX Aacute Yacute -100
+KPX Aacute Ydieresis -100
+KPX Aacute p -25
+KPX Aacute quoteright -74
+KPX Aacute u -50
+KPX Aacute uacute -50
+KPX Aacute ucircumflex -50
+KPX Aacute udieresis -50
+KPX Aacute ugrave -50
+KPX Aacute uhungarumlaut -50
+KPX Aacute umacron -50
+KPX Aacute uogonek -50
+KPX Aacute uring -50
+KPX Aacute v -100
+KPX Aacute w -90
+KPX Aacute y -74
+KPX Aacute yacute -74
+KPX Aacute ydieresis -74
+KPX Abreve C -55
+KPX Abreve Cacute -55
+KPX Abreve Ccaron -55
+KPX Abreve Ccedilla -55
+KPX Abreve G -55
+KPX Abreve Gbreve -55
+KPX Abreve Gcommaaccent -55
+KPX Abreve O -45
+KPX Abreve Oacute -45
+KPX Abreve Ocircumflex -45
+KPX Abreve Odieresis -45
+KPX Abreve Ograve -45
+KPX Abreve Ohungarumlaut -45
+KPX Abreve Omacron -45
+KPX Abreve Oslash -45
+KPX Abreve Otilde -45
+KPX Abreve Q -45
+KPX Abreve T -95
+KPX Abreve Tcaron -95
+KPX Abreve Tcommaaccent -95
+KPX Abreve U -50
+KPX Abreve Uacute -50
+KPX Abreve Ucircumflex -50
+KPX Abreve Udieresis -50
+KPX Abreve Ugrave -50
+KPX Abreve Uhungarumlaut -50
+KPX Abreve Umacron -50
+KPX Abreve Uogonek -50
+KPX Abreve Uring -50
+KPX Abreve V -145
+KPX Abreve W -130
+KPX Abreve Y -100
+KPX Abreve Yacute -100
+KPX Abreve Ydieresis -100
+KPX Abreve p -25
+KPX Abreve quoteright -74
+KPX Abreve u -50
+KPX Abreve uacute -50
+KPX Abreve ucircumflex -50
+KPX Abreve udieresis -50
+KPX Abreve ugrave -50
+KPX Abreve uhungarumlaut -50
+KPX Abreve umacron -50
+KPX Abreve uogonek -50
+KPX Abreve uring -50
+KPX Abreve v -100
+KPX Abreve w -90
+KPX Abreve y -74
+KPX Abreve yacute -74
+KPX Abreve ydieresis -74
+KPX Acircumflex C -55
+KPX Acircumflex Cacute -55
+KPX Acircumflex Ccaron -55
+KPX Acircumflex Ccedilla -55
+KPX Acircumflex G -55
+KPX Acircumflex Gbreve -55
+KPX Acircumflex Gcommaaccent -55
+KPX Acircumflex O -45
+KPX Acircumflex Oacute -45
+KPX Acircumflex Ocircumflex -45
+KPX Acircumflex Odieresis -45
+KPX Acircumflex Ograve -45
+KPX Acircumflex Ohungarumlaut -45
+KPX Acircumflex Omacron -45
+KPX Acircumflex Oslash -45
+KPX Acircumflex Otilde -45
+KPX Acircumflex Q -45
+KPX Acircumflex T -95
+KPX Acircumflex Tcaron -95
+KPX Acircumflex Tcommaaccent -95
+KPX Acircumflex U -50
+KPX Acircumflex Uacute -50
+KPX Acircumflex Ucircumflex -50
+KPX Acircumflex Udieresis -50
+KPX Acircumflex Ugrave -50
+KPX Acircumflex Uhungarumlaut -50
+KPX Acircumflex Umacron -50
+KPX Acircumflex Uogonek -50
+KPX Acircumflex Uring -50
+KPX Acircumflex V -145
+KPX Acircumflex W -130
+KPX Acircumflex Y -100
+KPX Acircumflex Yacute -100
+KPX Acircumflex Ydieresis -100
+KPX Acircumflex p -25
+KPX Acircumflex quoteright -74
+KPX Acircumflex u -50
+KPX Acircumflex uacute -50
+KPX Acircumflex ucircumflex -50
+KPX Acircumflex udieresis -50
+KPX Acircumflex ugrave -50
+KPX Acircumflex uhungarumlaut -50
+KPX Acircumflex umacron -50
+KPX Acircumflex uogonek -50
+KPX Acircumflex uring -50
+KPX Acircumflex v -100
+KPX Acircumflex w -90
+KPX Acircumflex y -74
+KPX Acircumflex yacute -74
+KPX Acircumflex ydieresis -74
+KPX Adieresis C -55
+KPX Adieresis Cacute -55
+KPX Adieresis Ccaron -55
+KPX Adieresis Ccedilla -55
+KPX Adieresis G -55
+KPX Adieresis Gbreve -55
+KPX Adieresis Gcommaaccent -55
+KPX Adieresis O -45
+KPX Adieresis Oacute -45
+KPX Adieresis Ocircumflex -45
+KPX Adieresis Odieresis -45
+KPX Adieresis Ograve -45
+KPX Adieresis Ohungarumlaut -45
+KPX Adieresis Omacron -45
+KPX Adieresis Oslash -45
+KPX Adieresis Otilde -45
+KPX Adieresis Q -45
+KPX Adieresis T -95
+KPX Adieresis Tcaron -95
+KPX Adieresis Tcommaaccent -95
+KPX Adieresis U -50
+KPX Adieresis Uacute -50
+KPX Adieresis Ucircumflex -50
+KPX Adieresis Udieresis -50
+KPX Adieresis Ugrave -50
+KPX Adieresis Uhungarumlaut -50
+KPX Adieresis Umacron -50
+KPX Adieresis Uogonek -50
+KPX Adieresis Uring -50
+KPX Adieresis V -145
+KPX Adieresis W -130
+KPX Adieresis Y -100
+KPX Adieresis Yacute -100
+KPX Adieresis Ydieresis -100
+KPX Adieresis p -25
+KPX Adieresis quoteright -74
+KPX Adieresis u -50
+KPX Adieresis uacute -50
+KPX Adieresis ucircumflex -50
+KPX Adieresis udieresis -50
+KPX Adieresis ugrave -50
+KPX Adieresis uhungarumlaut -50
+KPX Adieresis umacron -50
+KPX Adieresis uogonek -50
+KPX Adieresis uring -50
+KPX Adieresis v -100
+KPX Adieresis w -90
+KPX Adieresis y -74
+KPX Adieresis yacute -74
+KPX Adieresis ydieresis -74
+KPX Agrave C -55
+KPX Agrave Cacute -55
+KPX Agrave Ccaron -55
+KPX Agrave Ccedilla -55
+KPX Agrave G -55
+KPX Agrave Gbreve -55
+KPX Agrave Gcommaaccent -55
+KPX Agrave O -45
+KPX Agrave Oacute -45
+KPX Agrave Ocircumflex -45
+KPX Agrave Odieresis -45
+KPX Agrave Ograve -45
+KPX Agrave Ohungarumlaut -45
+KPX Agrave Omacron -45
+KPX Agrave Oslash -45
+KPX Agrave Otilde -45
+KPX Agrave Q -45
+KPX Agrave T -95
+KPX Agrave Tcaron -95
+KPX Agrave Tcommaaccent -95
+KPX Agrave U -50
+KPX Agrave Uacute -50
+KPX Agrave Ucircumflex -50
+KPX Agrave Udieresis -50
+KPX Agrave Ugrave -50
+KPX Agrave Uhungarumlaut -50
+KPX Agrave Umacron -50
+KPX Agrave Uogonek -50
+KPX Agrave Uring -50
+KPX Agrave V -145
+KPX Agrave W -130
+KPX Agrave Y -100
+KPX Agrave Yacute -100
+KPX Agrave Ydieresis -100
+KPX Agrave p -25
+KPX Agrave quoteright -74
+KPX Agrave u -50
+KPX Agrave uacute -50
+KPX Agrave ucircumflex -50
+KPX Agrave udieresis -50
+KPX Agrave ugrave -50
+KPX Agrave uhungarumlaut -50
+KPX Agrave umacron -50
+KPX Agrave uogonek -50
+KPX Agrave uring -50
+KPX Agrave v -100
+KPX Agrave w -90
+KPX Agrave y -74
+KPX Agrave yacute -74
+KPX Agrave ydieresis -74
+KPX Amacron C -55
+KPX Amacron Cacute -55
+KPX Amacron Ccaron -55
+KPX Amacron Ccedilla -55
+KPX Amacron G -55
+KPX Amacron Gbreve -55
+KPX Amacron Gcommaaccent -55
+KPX Amacron O -45
+KPX Amacron Oacute -45
+KPX Amacron Ocircumflex -45
+KPX Amacron Odieresis -45
+KPX Amacron Ograve -45
+KPX Amacron Ohungarumlaut -45
+KPX Amacron Omacron -45
+KPX Amacron Oslash -45
+KPX Amacron Otilde -45
+KPX Amacron Q -45
+KPX Amacron T -95
+KPX Amacron Tcaron -95
+KPX Amacron Tcommaaccent -95
+KPX Amacron U -50
+KPX Amacron Uacute -50
+KPX Amacron Ucircumflex -50
+KPX Amacron Udieresis -50
+KPX Amacron Ugrave -50
+KPX Amacron Uhungarumlaut -50
+KPX Amacron Umacron -50
+KPX Amacron Uogonek -50
+KPX Amacron Uring -50
+KPX Amacron V -145
+KPX Amacron W -130
+KPX Amacron Y -100
+KPX Amacron Yacute -100
+KPX Amacron Ydieresis -100
+KPX Amacron p -25
+KPX Amacron quoteright -74
+KPX Amacron u -50
+KPX Amacron uacute -50
+KPX Amacron ucircumflex -50
+KPX Amacron udieresis -50
+KPX Amacron ugrave -50
+KPX Amacron uhungarumlaut -50
+KPX Amacron umacron -50
+KPX Amacron uogonek -50
+KPX Amacron uring -50
+KPX Amacron v -100
+KPX Amacron w -90
+KPX Amacron y -74
+KPX Amacron yacute -74
+KPX Amacron ydieresis -74
+KPX Aogonek C -55
+KPX Aogonek Cacute -55
+KPX Aogonek Ccaron -55
+KPX Aogonek Ccedilla -55
+KPX Aogonek G -55
+KPX Aogonek Gbreve -55
+KPX Aogonek Gcommaaccent -55
+KPX Aogonek O -45
+KPX Aogonek Oacute -45
+KPX Aogonek Ocircumflex -45
+KPX Aogonek Odieresis -45
+KPX Aogonek Ograve -45
+KPX Aogonek Ohungarumlaut -45
+KPX Aogonek Omacron -45
+KPX Aogonek Oslash -45
+KPX Aogonek Otilde -45
+KPX Aogonek Q -45
+KPX Aogonek T -95
+KPX Aogonek Tcaron -95
+KPX Aogonek Tcommaaccent -95
+KPX Aogonek U -50
+KPX Aogonek Uacute -50
+KPX Aogonek Ucircumflex -50
+KPX Aogonek Udieresis -50
+KPX Aogonek Ugrave -50
+KPX Aogonek Uhungarumlaut -50
+KPX Aogonek Umacron -50
+KPX Aogonek Uogonek -50
+KPX Aogonek Uring -50
+KPX Aogonek V -145
+KPX Aogonek W -130
+KPX Aogonek Y -100
+KPX Aogonek Yacute -100
+KPX Aogonek Ydieresis -100
+KPX Aogonek p -25
+KPX Aogonek quoteright -74
+KPX Aogonek u -50
+KPX Aogonek uacute -50
+KPX Aogonek ucircumflex -50
+KPX Aogonek udieresis -50
+KPX Aogonek ugrave -50
+KPX Aogonek uhungarumlaut -50
+KPX Aogonek umacron -50
+KPX Aogonek uogonek -50
+KPX Aogonek uring -50
+KPX Aogonek v -100
+KPX Aogonek w -90
+KPX Aogonek y -34
+KPX Aogonek yacute -34
+KPX Aogonek ydieresis -34
+KPX Aring C -55
+KPX Aring Cacute -55
+KPX Aring Ccaron -55
+KPX Aring Ccedilla -55
+KPX Aring G -55
+KPX Aring Gbreve -55
+KPX Aring Gcommaaccent -55
+KPX Aring O -45
+KPX Aring Oacute -45
+KPX Aring Ocircumflex -45
+KPX Aring Odieresis -45
+KPX Aring Ograve -45
+KPX Aring Ohungarumlaut -45
+KPX Aring Omacron -45
+KPX Aring Oslash -45
+KPX Aring Otilde -45
+KPX Aring Q -45
+KPX Aring T -95
+KPX Aring Tcaron -95
+KPX Aring Tcommaaccent -95
+KPX Aring U -50
+KPX Aring Uacute -50
+KPX Aring Ucircumflex -50
+KPX Aring Udieresis -50
+KPX Aring Ugrave -50
+KPX Aring Uhungarumlaut -50
+KPX Aring Umacron -50
+KPX Aring Uogonek -50
+KPX Aring Uring -50
+KPX Aring V -145
+KPX Aring W -130
+KPX Aring Y -100
+KPX Aring Yacute -100
+KPX Aring Ydieresis -100
+KPX Aring p -25
+KPX Aring quoteright -74
+KPX Aring u -50
+KPX Aring uacute -50
+KPX Aring ucircumflex -50
+KPX Aring udieresis -50
+KPX Aring ugrave -50
+KPX Aring uhungarumlaut -50
+KPX Aring umacron -50
+KPX Aring uogonek -50
+KPX Aring uring -50
+KPX Aring v -100
+KPX Aring w -90
+KPX Aring y -74
+KPX Aring yacute -74
+KPX Aring ydieresis -74
+KPX Atilde C -55
+KPX Atilde Cacute -55
+KPX Atilde Ccaron -55
+KPX Atilde Ccedilla -55
+KPX Atilde G -55
+KPX Atilde Gbreve -55
+KPX Atilde Gcommaaccent -55
+KPX Atilde O -45
+KPX Atilde Oacute -45
+KPX Atilde Ocircumflex -45
+KPX Atilde Odieresis -45
+KPX Atilde Ograve -45
+KPX Atilde Ohungarumlaut -45
+KPX Atilde Omacron -45
+KPX Atilde Oslash -45
+KPX Atilde Otilde -45
+KPX Atilde Q -45
+KPX Atilde T -95
+KPX Atilde Tcaron -95
+KPX Atilde Tcommaaccent -95
+KPX Atilde U -50
+KPX Atilde Uacute -50
+KPX Atilde Ucircumflex -50
+KPX Atilde Udieresis -50
+KPX Atilde Ugrave -50
+KPX Atilde Uhungarumlaut -50
+KPX Atilde Umacron -50
+KPX Atilde Uogonek -50
+KPX Atilde Uring -50
+KPX Atilde V -145
+KPX Atilde W -130
+KPX Atilde Y -100
+KPX Atilde Yacute -100
+KPX Atilde Ydieresis -100
+KPX Atilde p -25
+KPX Atilde quoteright -74
+KPX Atilde u -50
+KPX Atilde uacute -50
+KPX Atilde ucircumflex -50
+KPX Atilde udieresis -50
+KPX Atilde ugrave -50
+KPX Atilde uhungarumlaut -50
+KPX Atilde umacron -50
+KPX Atilde uogonek -50
+KPX Atilde uring -50
+KPX Atilde v -100
+KPX Atilde w -90
+KPX Atilde y -74
+KPX Atilde yacute -74
+KPX Atilde ydieresis -74
+KPX B A -30
+KPX B Aacute -30
+KPX B Abreve -30
+KPX B Acircumflex -30
+KPX B Adieresis -30
+KPX B Agrave -30
+KPX B Amacron -30
+KPX B Aogonek -30
+KPX B Aring -30
+KPX B Atilde -30
+KPX B U -10
+KPX B Uacute -10
+KPX B Ucircumflex -10
+KPX B Udieresis -10
+KPX B Ugrave -10
+KPX B Uhungarumlaut -10
+KPX B Umacron -10
+KPX B Uogonek -10
+KPX B Uring -10
+KPX D A -35
+KPX D Aacute -35
+KPX D Abreve -35
+KPX D Acircumflex -35
+KPX D Adieresis -35
+KPX D Agrave -35
+KPX D Amacron -35
+KPX D Aogonek -35
+KPX D Aring -35
+KPX D Atilde -35
+KPX D V -40
+KPX D W -40
+KPX D Y -40
+KPX D Yacute -40
+KPX D Ydieresis -40
+KPX D period -20
+KPX Dcaron A -35
+KPX Dcaron Aacute -35
+KPX Dcaron Abreve -35
+KPX Dcaron Acircumflex -35
+KPX Dcaron Adieresis -35
+KPX Dcaron Agrave -35
+KPX Dcaron Amacron -35
+KPX Dcaron Aogonek -35
+KPX Dcaron Aring -35
+KPX Dcaron Atilde -35
+KPX Dcaron V -40
+KPX Dcaron W -40
+KPX Dcaron Y -40
+KPX Dcaron Yacute -40
+KPX Dcaron Ydieresis -40
+KPX Dcaron period -20
+KPX Dcroat A -35
+KPX Dcroat Aacute -35
+KPX Dcroat Abreve -35
+KPX Dcroat Acircumflex -35
+KPX Dcroat Adieresis -35
+KPX Dcroat Agrave -35
+KPX Dcroat Amacron -35
+KPX Dcroat Aogonek -35
+KPX Dcroat Aring -35
+KPX Dcroat Atilde -35
+KPX Dcroat V -40
+KPX Dcroat W -40
+KPX Dcroat Y -40
+KPX Dcroat Yacute -40
+KPX Dcroat Ydieresis -40
+KPX Dcroat period -20
+KPX F A -90
+KPX F Aacute -90
+KPX F Abreve -90
+KPX F Acircumflex -90
+KPX F Adieresis -90
+KPX F Agrave -90
+KPX F Amacron -90
+KPX F Aogonek -90
+KPX F Aring -90
+KPX F Atilde -90
+KPX F a -25
+KPX F aacute -25
+KPX F abreve -25
+KPX F acircumflex -25
+KPX F adieresis -25
+KPX F agrave -25
+KPX F amacron -25
+KPX F aogonek -25
+KPX F aring -25
+KPX F atilde -25
+KPX F comma -92
+KPX F e -25
+KPX F eacute -25
+KPX F ecaron -25
+KPX F ecircumflex -25
+KPX F edieresis -25
+KPX F edotaccent -25
+KPX F egrave -25
+KPX F emacron -25
+KPX F eogonek -25
+KPX F o -25
+KPX F oacute -25
+KPX F ocircumflex -25
+KPX F odieresis -25
+KPX F ograve -25
+KPX F ohungarumlaut -25
+KPX F omacron -25
+KPX F oslash -25
+KPX F otilde -25
+KPX F period -110
+KPX J A -30
+KPX J Aacute -30
+KPX J Abreve -30
+KPX J Acircumflex -30
+KPX J Adieresis -30
+KPX J Agrave -30
+KPX J Amacron -30
+KPX J Aogonek -30
+KPX J Aring -30
+KPX J Atilde -30
+KPX J a -15
+KPX J aacute -15
+KPX J abreve -15
+KPX J acircumflex -15
+KPX J adieresis -15
+KPX J agrave -15
+KPX J amacron -15
+KPX J aogonek -15
+KPX J aring -15
+KPX J atilde -15
+KPX J e -15
+KPX J eacute -15
+KPX J ecaron -15
+KPX J ecircumflex -15
+KPX J edieresis -15
+KPX J edotaccent -15
+KPX J egrave -15
+KPX J emacron -15
+KPX J eogonek -15
+KPX J o -15
+KPX J oacute -15
+KPX J ocircumflex -15
+KPX J odieresis -15
+KPX J ograve -15
+KPX J ohungarumlaut -15
+KPX J omacron -15
+KPX J oslash -15
+KPX J otilde -15
+KPX J period -20
+KPX J u -15
+KPX J uacute -15
+KPX J ucircumflex -15
+KPX J udieresis -15
+KPX J ugrave -15
+KPX J uhungarumlaut -15
+KPX J umacron -15
+KPX J uogonek -15
+KPX J uring -15
+KPX K O -30
+KPX K Oacute -30
+KPX K Ocircumflex -30
+KPX K Odieresis -30
+KPX K Ograve -30
+KPX K Ohungarumlaut -30
+KPX K Omacron -30
+KPX K Oslash -30
+KPX K Otilde -30
+KPX K e -25
+KPX K eacute -25
+KPX K ecaron -25
+KPX K ecircumflex -25
+KPX K edieresis -25
+KPX K edotaccent -25
+KPX K egrave -25
+KPX K emacron -25
+KPX K eogonek -25
+KPX K o -25
+KPX K oacute -25
+KPX K ocircumflex -25
+KPX K odieresis -25
+KPX K ograve -25
+KPX K ohungarumlaut -25
+KPX K omacron -25
+KPX K oslash -25
+KPX K otilde -25
+KPX K u -15
+KPX K uacute -15
+KPX K ucircumflex -15
+KPX K udieresis -15
+KPX K ugrave -15
+KPX K uhungarumlaut -15
+KPX K umacron -15
+KPX K uogonek -15
+KPX K uring -15
+KPX K y -45
+KPX K yacute -45
+KPX K ydieresis -45
+KPX Kcommaaccent O -30
+KPX Kcommaaccent Oacute -30
+KPX Kcommaaccent Ocircumflex -30
+KPX Kcommaaccent Odieresis -30
+KPX Kcommaaccent Ograve -30
+KPX Kcommaaccent Ohungarumlaut -30
+KPX Kcommaaccent Omacron -30
+KPX Kcommaaccent Oslash -30
+KPX Kcommaaccent Otilde -30
+KPX Kcommaaccent e -25
+KPX Kcommaaccent eacute -25
+KPX Kcommaaccent ecaron -25
+KPX Kcommaaccent ecircumflex -25
+KPX Kcommaaccent edieresis -25
+KPX Kcommaaccent edotaccent -25
+KPX Kcommaaccent egrave -25
+KPX Kcommaaccent emacron -25
+KPX Kcommaaccent eogonek -25
+KPX Kcommaaccent o -25
+KPX Kcommaaccent oacute -25
+KPX Kcommaaccent ocircumflex -25
+KPX Kcommaaccent odieresis -25
+KPX Kcommaaccent ograve -25
+KPX Kcommaaccent ohungarumlaut -25
+KPX Kcommaaccent omacron -25
+KPX Kcommaaccent oslash -25
+KPX Kcommaaccent otilde -25
+KPX Kcommaaccent u -15
+KPX Kcommaaccent uacute -15
+KPX Kcommaaccent ucircumflex -15
+KPX Kcommaaccent udieresis -15
+KPX Kcommaaccent ugrave -15
+KPX Kcommaaccent uhungarumlaut -15
+KPX Kcommaaccent umacron -15
+KPX Kcommaaccent uogonek -15
+KPX Kcommaaccent uring -15
+KPX Kcommaaccent y -45
+KPX Kcommaaccent yacute -45
+KPX Kcommaaccent ydieresis -45
+KPX L T -92
+KPX L Tcaron -92
+KPX L Tcommaaccent -92
+KPX L V -92
+KPX L W -92
+KPX L Y -92
+KPX L Yacute -92
+KPX L Ydieresis -92
+KPX L quotedblright -20
+KPX L quoteright -110
+KPX L y -55
+KPX L yacute -55
+KPX L ydieresis -55
+KPX Lacute T -92
+KPX Lacute Tcaron -92
+KPX Lacute Tcommaaccent -92
+KPX Lacute V -92
+KPX Lacute W -92
+KPX Lacute Y -92
+KPX Lacute Yacute -92
+KPX Lacute Ydieresis -92
+KPX Lacute quotedblright -20
+KPX Lacute quoteright -110
+KPX Lacute y -55
+KPX Lacute yacute -55
+KPX Lacute ydieresis -55
+KPX Lcommaaccent T -92
+KPX Lcommaaccent Tcaron -92
+KPX Lcommaaccent Tcommaaccent -92
+KPX Lcommaaccent V -92
+KPX Lcommaaccent W -92
+KPX Lcommaaccent Y -92
+KPX Lcommaaccent Yacute -92
+KPX Lcommaaccent Ydieresis -92
+KPX Lcommaaccent quotedblright -20
+KPX Lcommaaccent quoteright -110
+KPX Lcommaaccent y -55
+KPX Lcommaaccent yacute -55
+KPX Lcommaaccent ydieresis -55
+KPX Lslash T -92
+KPX Lslash Tcaron -92
+KPX Lslash Tcommaaccent -92
+KPX Lslash V -92
+KPX Lslash W -92
+KPX Lslash Y -92
+KPX Lslash Yacute -92
+KPX Lslash Ydieresis -92
+KPX Lslash quotedblright -20
+KPX Lslash quoteright -110
+KPX Lslash y -55
+KPX Lslash yacute -55
+KPX Lslash ydieresis -55
+KPX N A -20
+KPX N Aacute -20
+KPX N Abreve -20
+KPX N Acircumflex -20
+KPX N Adieresis -20
+KPX N Agrave -20
+KPX N Amacron -20
+KPX N Aogonek -20
+KPX N Aring -20
+KPX N Atilde -20
+KPX Nacute A -20
+KPX Nacute Aacute -20
+KPX Nacute Abreve -20
+KPX Nacute Acircumflex -20
+KPX Nacute Adieresis -20
+KPX Nacute Agrave -20
+KPX Nacute Amacron -20
+KPX Nacute Aogonek -20
+KPX Nacute Aring -20
+KPX Nacute Atilde -20
+KPX Ncaron A -20
+KPX Ncaron Aacute -20
+KPX Ncaron Abreve -20
+KPX Ncaron Acircumflex -20
+KPX Ncaron Adieresis -20
+KPX Ncaron Agrave -20
+KPX Ncaron Amacron -20
+KPX Ncaron Aogonek -20
+KPX Ncaron Aring -20
+KPX Ncaron Atilde -20
+KPX Ncommaaccent A -20
+KPX Ncommaaccent Aacute -20
+KPX Ncommaaccent Abreve -20
+KPX Ncommaaccent Acircumflex -20
+KPX Ncommaaccent Adieresis -20
+KPX Ncommaaccent Agrave -20
+KPX Ncommaaccent Amacron -20
+KPX Ncommaaccent Aogonek -20
+KPX Ncommaaccent Aring -20
+KPX Ncommaaccent Atilde -20
+KPX Ntilde A -20
+KPX Ntilde Aacute -20
+KPX Ntilde Abreve -20
+KPX Ntilde Acircumflex -20
+KPX Ntilde Adieresis -20
+KPX Ntilde Agrave -20
+KPX Ntilde Amacron -20
+KPX Ntilde Aogonek -20
+KPX Ntilde Aring -20
+KPX Ntilde Atilde -20
+KPX O A -40
+KPX O Aacute -40
+KPX O Abreve -40
+KPX O Acircumflex -40
+KPX O Adieresis -40
+KPX O Agrave -40
+KPX O Amacron -40
+KPX O Aogonek -40
+KPX O Aring -40
+KPX O Atilde -40
+KPX O T -40
+KPX O Tcaron -40
+KPX O Tcommaaccent -40
+KPX O V -50
+KPX O W -50
+KPX O X -40
+KPX O Y -50
+KPX O Yacute -50
+KPX O Ydieresis -50
+KPX Oacute A -40
+KPX Oacute Aacute -40
+KPX Oacute Abreve -40
+KPX Oacute Acircumflex -40
+KPX Oacute Adieresis -40
+KPX Oacute Agrave -40
+KPX Oacute Amacron -40
+KPX Oacute Aogonek -40
+KPX Oacute Aring -40
+KPX Oacute Atilde -40
+KPX Oacute T -40
+KPX Oacute Tcaron -40
+KPX Oacute Tcommaaccent -40
+KPX Oacute V -50
+KPX Oacute W -50
+KPX Oacute X -40
+KPX Oacute Y -50
+KPX Oacute Yacute -50
+KPX Oacute Ydieresis -50
+KPX Ocircumflex A -40
+KPX Ocircumflex Aacute -40
+KPX Ocircumflex Abreve -40
+KPX Ocircumflex Acircumflex -40
+KPX Ocircumflex Adieresis -40
+KPX Ocircumflex Agrave -40
+KPX Ocircumflex Amacron -40
+KPX Ocircumflex Aogonek -40
+KPX Ocircumflex Aring -40
+KPX Ocircumflex Atilde -40
+KPX Ocircumflex T -40
+KPX Ocircumflex Tcaron -40
+KPX Ocircumflex Tcommaaccent -40
+KPX Ocircumflex V -50
+KPX Ocircumflex W -50
+KPX Ocircumflex X -40
+KPX Ocircumflex Y -50
+KPX Ocircumflex Yacute -50
+KPX Ocircumflex Ydieresis -50
+KPX Odieresis A -40
+KPX Odieresis Aacute -40
+KPX Odieresis Abreve -40
+KPX Odieresis Acircumflex -40
+KPX Odieresis Adieresis -40
+KPX Odieresis Agrave -40
+KPX Odieresis Amacron -40
+KPX Odieresis Aogonek -40
+KPX Odieresis Aring -40
+KPX Odieresis Atilde -40
+KPX Odieresis T -40
+KPX Odieresis Tcaron -40
+KPX Odieresis Tcommaaccent -40
+KPX Odieresis V -50
+KPX Odieresis W -50
+KPX Odieresis X -40
+KPX Odieresis Y -50
+KPX Odieresis Yacute -50
+KPX Odieresis Ydieresis -50
+KPX Ograve A -40
+KPX Ograve Aacute -40
+KPX Ograve Abreve -40
+KPX Ograve Acircumflex -40
+KPX Ograve Adieresis -40
+KPX Ograve Agrave -40
+KPX Ograve Amacron -40
+KPX Ograve Aogonek -40
+KPX Ograve Aring -40
+KPX Ograve Atilde -40
+KPX Ograve T -40
+KPX Ograve Tcaron -40
+KPX Ograve Tcommaaccent -40
+KPX Ograve V -50
+KPX Ograve W -50
+KPX Ograve X -40
+KPX Ograve Y -50
+KPX Ograve Yacute -50
+KPX Ograve Ydieresis -50
+KPX Ohungarumlaut A -40
+KPX Ohungarumlaut Aacute -40
+KPX Ohungarumlaut Abreve -40
+KPX Ohungarumlaut Acircumflex -40
+KPX Ohungarumlaut Adieresis -40
+KPX Ohungarumlaut Agrave -40
+KPX Ohungarumlaut Amacron -40
+KPX Ohungarumlaut Aogonek -40
+KPX Ohungarumlaut Aring -40
+KPX Ohungarumlaut Atilde -40
+KPX Ohungarumlaut T -40
+KPX Ohungarumlaut Tcaron -40
+KPX Ohungarumlaut Tcommaaccent -40
+KPX Ohungarumlaut V -50
+KPX Ohungarumlaut W -50
+KPX Ohungarumlaut X -40
+KPX Ohungarumlaut Y -50
+KPX Ohungarumlaut Yacute -50
+KPX Ohungarumlaut Ydieresis -50
+KPX Omacron A -40
+KPX Omacron Aacute -40
+KPX Omacron Abreve -40
+KPX Omacron Acircumflex -40
+KPX Omacron Adieresis -40
+KPX Omacron Agrave -40
+KPX Omacron Amacron -40
+KPX Omacron Aogonek -40
+KPX Omacron Aring -40
+KPX Omacron Atilde -40
+KPX Omacron T -40
+KPX Omacron Tcaron -40
+KPX Omacron Tcommaaccent -40
+KPX Omacron V -50
+KPX Omacron W -50
+KPX Omacron X -40
+KPX Omacron Y -50
+KPX Omacron Yacute -50
+KPX Omacron Ydieresis -50
+KPX Oslash A -40
+KPX Oslash Aacute -40
+KPX Oslash Abreve -40
+KPX Oslash Acircumflex -40
+KPX Oslash Adieresis -40
+KPX Oslash Agrave -40
+KPX Oslash Amacron -40
+KPX Oslash Aogonek -40
+KPX Oslash Aring -40
+KPX Oslash Atilde -40
+KPX Oslash T -40
+KPX Oslash Tcaron -40
+KPX Oslash Tcommaaccent -40
+KPX Oslash V -50
+KPX Oslash W -50
+KPX Oslash X -40
+KPX Oslash Y -50
+KPX Oslash Yacute -50
+KPX Oslash Ydieresis -50
+KPX Otilde A -40
+KPX Otilde Aacute -40
+KPX Otilde Abreve -40
+KPX Otilde Acircumflex -40
+KPX Otilde Adieresis -40
+KPX Otilde Agrave -40
+KPX Otilde Amacron -40
+KPX Otilde Aogonek -40
+KPX Otilde Aring -40
+KPX Otilde Atilde -40
+KPX Otilde T -40
+KPX Otilde Tcaron -40
+KPX Otilde Tcommaaccent -40
+KPX Otilde V -50
+KPX Otilde W -50
+KPX Otilde X -40
+KPX Otilde Y -50
+KPX Otilde Yacute -50
+KPX Otilde Ydieresis -50
+KPX P A -74
+KPX P Aacute -74
+KPX P Abreve -74
+KPX P Acircumflex -74
+KPX P Adieresis -74
+KPX P Agrave -74
+KPX P Amacron -74
+KPX P Aogonek -74
+KPX P Aring -74
+KPX P Atilde -74
+KPX P a -10
+KPX P aacute -10
+KPX P abreve -10
+KPX P acircumflex -10
+KPX P adieresis -10
+KPX P agrave -10
+KPX P amacron -10
+KPX P aogonek -10
+KPX P aring -10
+KPX P atilde -10
+KPX P comma -92
+KPX P e -20
+KPX P eacute -20
+KPX P ecaron -20
+KPX P ecircumflex -20
+KPX P edieresis -20
+KPX P edotaccent -20
+KPX P egrave -20
+KPX P emacron -20
+KPX P eogonek -20
+KPX P o -20
+KPX P oacute -20
+KPX P ocircumflex -20
+KPX P odieresis -20
+KPX P ograve -20
+KPX P ohungarumlaut -20
+KPX P omacron -20
+KPX P oslash -20
+KPX P otilde -20
+KPX P period -110
+KPX Q U -10
+KPX Q Uacute -10
+KPX Q Ucircumflex -10
+KPX Q Udieresis -10
+KPX Q Ugrave -10
+KPX Q Uhungarumlaut -10
+KPX Q Umacron -10
+KPX Q Uogonek -10
+KPX Q Uring -10
+KPX Q period -20
+KPX R O -30
+KPX R Oacute -30
+KPX R Ocircumflex -30
+KPX R Odieresis -30
+KPX R Ograve -30
+KPX R Ohungarumlaut -30
+KPX R Omacron -30
+KPX R Oslash -30
+KPX R Otilde -30
+KPX R T -40
+KPX R Tcaron -40
+KPX R Tcommaaccent -40
+KPX R U -30
+KPX R Uacute -30
+KPX R Ucircumflex -30
+KPX R Udieresis -30
+KPX R Ugrave -30
+KPX R Uhungarumlaut -30
+KPX R Umacron -30
+KPX R Uogonek -30
+KPX R Uring -30
+KPX R V -55
+KPX R W -35
+KPX R Y -35
+KPX R Yacute -35
+KPX R Ydieresis -35
+KPX Racute O -30
+KPX Racute Oacute -30
+KPX Racute Ocircumflex -30
+KPX Racute Odieresis -30
+KPX Racute Ograve -30
+KPX Racute Ohungarumlaut -30
+KPX Racute Omacron -30
+KPX Racute Oslash -30
+KPX Racute Otilde -30
+KPX Racute T -40
+KPX Racute Tcaron -40
+KPX Racute Tcommaaccent -40
+KPX Racute U -30
+KPX Racute Uacute -30
+KPX Racute Ucircumflex -30
+KPX Racute Udieresis -30
+KPX Racute Ugrave -30
+KPX Racute Uhungarumlaut -30
+KPX Racute Umacron -30
+KPX Racute Uogonek -30
+KPX Racute Uring -30
+KPX Racute V -55
+KPX Racute W -35
+KPX Racute Y -35
+KPX Racute Yacute -35
+KPX Racute Ydieresis -35
+KPX Rcaron O -30
+KPX Rcaron Oacute -30
+KPX Rcaron Ocircumflex -30
+KPX Rcaron Odieresis -30
+KPX Rcaron Ograve -30
+KPX Rcaron Ohungarumlaut -30
+KPX Rcaron Omacron -30
+KPX Rcaron Oslash -30
+KPX Rcaron Otilde -30
+KPX Rcaron T -40
+KPX Rcaron Tcaron -40
+KPX Rcaron Tcommaaccent -40
+KPX Rcaron U -30
+KPX Rcaron Uacute -30
+KPX Rcaron Ucircumflex -30
+KPX Rcaron Udieresis -30
+KPX Rcaron Ugrave -30
+KPX Rcaron Uhungarumlaut -30
+KPX Rcaron Umacron -30
+KPX Rcaron Uogonek -30
+KPX Rcaron Uring -30
+KPX Rcaron V -55
+KPX Rcaron W -35
+KPX Rcaron Y -35
+KPX Rcaron Yacute -35
+KPX Rcaron Ydieresis -35
+KPX Rcommaaccent O -30
+KPX Rcommaaccent Oacute -30
+KPX Rcommaaccent Ocircumflex -30
+KPX Rcommaaccent Odieresis -30
+KPX Rcommaaccent Ograve -30
+KPX Rcommaaccent Ohungarumlaut -30
+KPX Rcommaaccent Omacron -30
+KPX Rcommaaccent Oslash -30
+KPX Rcommaaccent Otilde -30
+KPX Rcommaaccent T -40
+KPX Rcommaaccent Tcaron -40
+KPX Rcommaaccent Tcommaaccent -40
+KPX Rcommaaccent U -30
+KPX Rcommaaccent Uacute -30
+KPX Rcommaaccent Ucircumflex -30
+KPX Rcommaaccent Udieresis -30
+KPX Rcommaaccent Ugrave -30
+KPX Rcommaaccent Uhungarumlaut -30
+KPX Rcommaaccent Umacron -30
+KPX Rcommaaccent Uogonek -30
+KPX Rcommaaccent Uring -30
+KPX Rcommaaccent V -55
+KPX Rcommaaccent W -35
+KPX Rcommaaccent Y -35
+KPX Rcommaaccent Yacute -35
+KPX Rcommaaccent Ydieresis -35
+KPX T A -90
+KPX T Aacute -90
+KPX T Abreve -90
+KPX T Acircumflex -90
+KPX T Adieresis -90
+KPX T Agrave -90
+KPX T Amacron -90
+KPX T Aogonek -90
+KPX T Aring -90
+KPX T Atilde -90
+KPX T O -18
+KPX T Oacute -18
+KPX T Ocircumflex -18
+KPX T Odieresis -18
+KPX T Ograve -18
+KPX T Ohungarumlaut -18
+KPX T Omacron -18
+KPX T Oslash -18
+KPX T Otilde -18
+KPX T a -92
+KPX T aacute -92
+KPX T abreve -52
+KPX T acircumflex -52
+KPX T adieresis -52
+KPX T agrave -52
+KPX T amacron -52
+KPX T aogonek -92
+KPX T aring -92
+KPX T atilde -52
+KPX T colon -74
+KPX T comma -74
+KPX T e -92
+KPX T eacute -92
+KPX T ecaron -92
+KPX T ecircumflex -92
+KPX T edieresis -52
+KPX T edotaccent -92
+KPX T egrave -52
+KPX T emacron -52
+KPX T eogonek -92
+KPX T hyphen -92
+KPX T i -18
+KPX T iacute -18
+KPX T iogonek -18
+KPX T o -92
+KPX T oacute -92
+KPX T ocircumflex -92
+KPX T odieresis -92
+KPX T ograve -92
+KPX T ohungarumlaut -92
+KPX T omacron -92
+KPX T oslash -92
+KPX T otilde -92
+KPX T period -90
+KPX T r -74
+KPX T racute -74
+KPX T rcaron -74
+KPX T rcommaaccent -74
+KPX T semicolon -74
+KPX T u -92
+KPX T uacute -92
+KPX T ucircumflex -92
+KPX T udieresis -92
+KPX T ugrave -92
+KPX T uhungarumlaut -92
+KPX T umacron -92
+KPX T uogonek -92
+KPX T uring -92
+KPX T w -74
+KPX T y -34
+KPX T yacute -34
+KPX T ydieresis -34
+KPX Tcaron A -90
+KPX Tcaron Aacute -90
+KPX Tcaron Abreve -90
+KPX Tcaron Acircumflex -90
+KPX Tcaron Adieresis -90
+KPX Tcaron Agrave -90
+KPX Tcaron Amacron -90
+KPX Tcaron Aogonek -90
+KPX Tcaron Aring -90
+KPX Tcaron Atilde -90
+KPX Tcaron O -18
+KPX Tcaron Oacute -18
+KPX Tcaron Ocircumflex -18
+KPX Tcaron Odieresis -18
+KPX Tcaron Ograve -18
+KPX Tcaron Ohungarumlaut -18
+KPX Tcaron Omacron -18
+KPX Tcaron Oslash -18
+KPX Tcaron Otilde -18
+KPX Tcaron a -92
+KPX Tcaron aacute -92
+KPX Tcaron abreve -52
+KPX Tcaron acircumflex -52
+KPX Tcaron adieresis -52
+KPX Tcaron agrave -52
+KPX Tcaron amacron -52
+KPX Tcaron aogonek -92
+KPX Tcaron aring -92
+KPX Tcaron atilde -52
+KPX Tcaron colon -74
+KPX Tcaron comma -74
+KPX Tcaron e -92
+KPX Tcaron eacute -92
+KPX Tcaron ecaron -92
+KPX Tcaron ecircumflex -92
+KPX Tcaron edieresis -52
+KPX Tcaron edotaccent -92
+KPX Tcaron egrave -52
+KPX Tcaron emacron -52
+KPX Tcaron eogonek -92
+KPX Tcaron hyphen -92
+KPX Tcaron i -18
+KPX Tcaron iacute -18
+KPX Tcaron iogonek -18
+KPX Tcaron o -92
+KPX Tcaron oacute -92
+KPX Tcaron ocircumflex -92
+KPX Tcaron odieresis -92
+KPX Tcaron ograve -92
+KPX Tcaron ohungarumlaut -92
+KPX Tcaron omacron -92
+KPX Tcaron oslash -92
+KPX Tcaron otilde -92
+KPX Tcaron period -90
+KPX Tcaron r -74
+KPX Tcaron racute -74
+KPX Tcaron rcaron -74
+KPX Tcaron rcommaaccent -74
+KPX Tcaron semicolon -74
+KPX Tcaron u -92
+KPX Tcaron uacute -92
+KPX Tcaron ucircumflex -92
+KPX Tcaron udieresis -92
+KPX Tcaron ugrave -92
+KPX Tcaron uhungarumlaut -92
+KPX Tcaron umacron -92
+KPX Tcaron uogonek -92
+KPX Tcaron uring -92
+KPX Tcaron w -74
+KPX Tcaron y -34
+KPX Tcaron yacute -34
+KPX Tcaron ydieresis -34
+KPX Tcommaaccent A -90
+KPX Tcommaaccent Aacute -90
+KPX Tcommaaccent Abreve -90
+KPX Tcommaaccent Acircumflex -90
+KPX Tcommaaccent Adieresis -90
+KPX Tcommaaccent Agrave -90
+KPX Tcommaaccent Amacron -90
+KPX Tcommaaccent Aogonek -90
+KPX Tcommaaccent Aring -90
+KPX Tcommaaccent Atilde -90
+KPX Tcommaaccent O -18
+KPX Tcommaaccent Oacute -18
+KPX Tcommaaccent Ocircumflex -18
+KPX Tcommaaccent Odieresis -18
+KPX Tcommaaccent Ograve -18
+KPX Tcommaaccent Ohungarumlaut -18
+KPX Tcommaaccent Omacron -18
+KPX Tcommaaccent Oslash -18
+KPX Tcommaaccent Otilde -18
+KPX Tcommaaccent a -92
+KPX Tcommaaccent aacute -92
+KPX Tcommaaccent abreve -52
+KPX Tcommaaccent acircumflex -52
+KPX Tcommaaccent adieresis -52
+KPX Tcommaaccent agrave -52
+KPX Tcommaaccent amacron -52
+KPX Tcommaaccent aogonek -92
+KPX Tcommaaccent aring -92
+KPX Tcommaaccent atilde -52
+KPX Tcommaaccent colon -74
+KPX Tcommaaccent comma -74
+KPX Tcommaaccent e -92
+KPX Tcommaaccent eacute -92
+KPX Tcommaaccent ecaron -92
+KPX Tcommaaccent ecircumflex -92
+KPX Tcommaaccent edieresis -52
+KPX Tcommaaccent edotaccent -92
+KPX Tcommaaccent egrave -52
+KPX Tcommaaccent emacron -52
+KPX Tcommaaccent eogonek -92
+KPX Tcommaaccent hyphen -92
+KPX Tcommaaccent i -18
+KPX Tcommaaccent iacute -18
+KPX Tcommaaccent iogonek -18
+KPX Tcommaaccent o -92
+KPX Tcommaaccent oacute -92
+KPX Tcommaaccent ocircumflex -92
+KPX Tcommaaccent odieresis -92
+KPX Tcommaaccent ograve -92
+KPX Tcommaaccent ohungarumlaut -92
+KPX Tcommaaccent omacron -92
+KPX Tcommaaccent oslash -92
+KPX Tcommaaccent otilde -92
+KPX Tcommaaccent period -90
+KPX Tcommaaccent r -74
+KPX Tcommaaccent racute -74
+KPX Tcommaaccent rcaron -74
+KPX Tcommaaccent rcommaaccent -74
+KPX Tcommaaccent semicolon -74
+KPX Tcommaaccent u -92
+KPX Tcommaaccent uacute -92
+KPX Tcommaaccent ucircumflex -92
+KPX Tcommaaccent udieresis -92
+KPX Tcommaaccent ugrave -92
+KPX Tcommaaccent uhungarumlaut -92
+KPX Tcommaaccent umacron -92
+KPX Tcommaaccent uogonek -92
+KPX Tcommaaccent uring -92
+KPX Tcommaaccent w -74
+KPX Tcommaaccent y -34
+KPX Tcommaaccent yacute -34
+KPX Tcommaaccent ydieresis -34
+KPX U A -60
+KPX U Aacute -60
+KPX U Abreve -60
+KPX U Acircumflex -60
+KPX U Adieresis -60
+KPX U Agrave -60
+KPX U Amacron -60
+KPX U Aogonek -60
+KPX U Aring -60
+KPX U Atilde -60
+KPX U comma -50
+KPX U period -50
+KPX Uacute A -60
+KPX Uacute Aacute -60
+KPX Uacute Abreve -60
+KPX Uacute Acircumflex -60
+KPX Uacute Adieresis -60
+KPX Uacute Agrave -60
+KPX Uacute Amacron -60
+KPX Uacute Aogonek -60
+KPX Uacute Aring -60
+KPX Uacute Atilde -60
+KPX Uacute comma -50
+KPX Uacute period -50
+KPX Ucircumflex A -60
+KPX Ucircumflex Aacute -60
+KPX Ucircumflex Abreve -60
+KPX Ucircumflex Acircumflex -60
+KPX Ucircumflex Adieresis -60
+KPX Ucircumflex Agrave -60
+KPX Ucircumflex Amacron -60
+KPX Ucircumflex Aogonek -60
+KPX Ucircumflex Aring -60
+KPX Ucircumflex Atilde -60
+KPX Ucircumflex comma -50
+KPX Ucircumflex period -50
+KPX Udieresis A -60
+KPX Udieresis Aacute -60
+KPX Udieresis Abreve -60
+KPX Udieresis Acircumflex -60
+KPX Udieresis Adieresis -60
+KPX Udieresis Agrave -60
+KPX Udieresis Amacron -60
+KPX Udieresis Aogonek -60
+KPX Udieresis Aring -60
+KPX Udieresis Atilde -60
+KPX Udieresis comma -50
+KPX Udieresis period -50
+KPX Ugrave A -60
+KPX Ugrave Aacute -60
+KPX Ugrave Abreve -60
+KPX Ugrave Acircumflex -60
+KPX Ugrave Adieresis -60
+KPX Ugrave Agrave -60
+KPX Ugrave Amacron -60
+KPX Ugrave Aogonek -60
+KPX Ugrave Aring -60
+KPX Ugrave Atilde -60
+KPX Ugrave comma -50
+KPX Ugrave period -50
+KPX Uhungarumlaut A -60
+KPX Uhungarumlaut Aacute -60
+KPX Uhungarumlaut Abreve -60
+KPX Uhungarumlaut Acircumflex -60
+KPX Uhungarumlaut Adieresis -60
+KPX Uhungarumlaut Agrave -60
+KPX Uhungarumlaut Amacron -60
+KPX Uhungarumlaut Aogonek -60
+KPX Uhungarumlaut Aring -60
+KPX Uhungarumlaut Atilde -60
+KPX Uhungarumlaut comma -50
+KPX Uhungarumlaut period -50
+KPX Umacron A -60
+KPX Umacron Aacute -60
+KPX Umacron Abreve -60
+KPX Umacron Acircumflex -60
+KPX Umacron Adieresis -60
+KPX Umacron Agrave -60
+KPX Umacron Amacron -60
+KPX Umacron Aogonek -60
+KPX Umacron Aring -60
+KPX Umacron Atilde -60
+KPX Umacron comma -50
+KPX Umacron period -50
+KPX Uogonek A -60
+KPX Uogonek Aacute -60
+KPX Uogonek Abreve -60
+KPX Uogonek Acircumflex -60
+KPX Uogonek Adieresis -60
+KPX Uogonek Agrave -60
+KPX Uogonek Amacron -60
+KPX Uogonek Aogonek -60
+KPX Uogonek Aring -60
+KPX Uogonek Atilde -60
+KPX Uogonek comma -50
+KPX Uogonek period -50
+KPX Uring A -60
+KPX Uring Aacute -60
+KPX Uring Abreve -60
+KPX Uring Acircumflex -60
+KPX Uring Adieresis -60
+KPX Uring Agrave -60
+KPX Uring Amacron -60
+KPX Uring Aogonek -60
+KPX Uring Aring -60
+KPX Uring Atilde -60
+KPX Uring comma -50
+KPX Uring period -50
+KPX V A -135
+KPX V Aacute -135
+KPX V Abreve -135
+KPX V Acircumflex -135
+KPX V Adieresis -135
+KPX V Agrave -135
+KPX V Amacron -135
+KPX V Aogonek -135
+KPX V Aring -135
+KPX V Atilde -135
+KPX V G -30
+KPX V Gbreve -30
+KPX V Gcommaaccent -30
+KPX V O -45
+KPX V Oacute -45
+KPX V Ocircumflex -45
+KPX V Odieresis -45
+KPX V Ograve -45
+KPX V Ohungarumlaut -45
+KPX V Omacron -45
+KPX V Oslash -45
+KPX V Otilde -45
+KPX V a -92
+KPX V aacute -92
+KPX V abreve -92
+KPX V acircumflex -92
+KPX V adieresis -92
+KPX V agrave -92
+KPX V amacron -92
+KPX V aogonek -92
+KPX V aring -92
+KPX V atilde -92
+KPX V colon -92
+KPX V comma -129
+KPX V e -100
+KPX V eacute -100
+KPX V ecaron -100
+KPX V ecircumflex -100
+KPX V edieresis -100
+KPX V edotaccent -100
+KPX V egrave -100
+KPX V emacron -100
+KPX V eogonek -100
+KPX V hyphen -74
+KPX V i -37
+KPX V iacute -37
+KPX V icircumflex -37
+KPX V idieresis -37
+KPX V igrave -37
+KPX V imacron -37
+KPX V iogonek -37
+KPX V o -100
+KPX V oacute -100
+KPX V ocircumflex -100
+KPX V odieresis -100
+KPX V ograve -100
+KPX V ohungarumlaut -100
+KPX V omacron -100
+KPX V oslash -100
+KPX V otilde -100
+KPX V period -145
+KPX V semicolon -92
+KPX V u -92
+KPX V uacute -92
+KPX V ucircumflex -92
+KPX V udieresis -92
+KPX V ugrave -92
+KPX V uhungarumlaut -92
+KPX V umacron -92
+KPX V uogonek -92
+KPX V uring -92
+KPX W A -120
+KPX W Aacute -120
+KPX W Abreve -120
+KPX W Acircumflex -120
+KPX W Adieresis -120
+KPX W Agrave -120
+KPX W Amacron -120
+KPX W Aogonek -120
+KPX W Aring -120
+KPX W Atilde -120
+KPX W O -10
+KPX W Oacute -10
+KPX W Ocircumflex -10
+KPX W Odieresis -10
+KPX W Ograve -10
+KPX W Ohungarumlaut -10
+KPX W Omacron -10
+KPX W Oslash -10
+KPX W Otilde -10
+KPX W a -65
+KPX W aacute -65
+KPX W abreve -65
+KPX W acircumflex -65
+KPX W adieresis -65
+KPX W agrave -65
+KPX W amacron -65
+KPX W aogonek -65
+KPX W aring -65
+KPX W atilde -65
+KPX W colon -55
+KPX W comma -92
+KPX W e -65
+KPX W eacute -65
+KPX W ecaron -65
+KPX W ecircumflex -65
+KPX W edieresis -65
+KPX W edotaccent -65
+KPX W egrave -65
+KPX W emacron -65
+KPX W eogonek -65
+KPX W hyphen -37
+KPX W i -18
+KPX W iacute -18
+KPX W iogonek -18
+KPX W o -75
+KPX W oacute -75
+KPX W ocircumflex -75
+KPX W odieresis -75
+KPX W ograve -75
+KPX W ohungarumlaut -75
+KPX W omacron -75
+KPX W oslash -75
+KPX W otilde -75
+KPX W period -92
+KPX W semicolon -55
+KPX W u -50
+KPX W uacute -50
+KPX W ucircumflex -50
+KPX W udieresis -50
+KPX W ugrave -50
+KPX W uhungarumlaut -50
+KPX W umacron -50
+KPX W uogonek -50
+KPX W uring -50
+KPX W y -60
+KPX W yacute -60
+KPX W ydieresis -60
+KPX Y A -110
+KPX Y Aacute -110
+KPX Y Abreve -110
+KPX Y Acircumflex -110
+KPX Y Adieresis -110
+KPX Y Agrave -110
+KPX Y Amacron -110
+KPX Y Aogonek -110
+KPX Y Aring -110
+KPX Y Atilde -110
+KPX Y O -35
+KPX Y Oacute -35
+KPX Y Ocircumflex -35
+KPX Y Odieresis -35
+KPX Y Ograve -35
+KPX Y Ohungarumlaut -35
+KPX Y Omacron -35
+KPX Y Oslash -35
+KPX Y Otilde -35
+KPX Y a -85
+KPX Y aacute -85
+KPX Y abreve -85
+KPX Y acircumflex -85
+KPX Y adieresis -85
+KPX Y agrave -85
+KPX Y amacron -85
+KPX Y aogonek -85
+KPX Y aring -85
+KPX Y atilde -85
+KPX Y colon -92
+KPX Y comma -92
+KPX Y e -111
+KPX Y eacute -111
+KPX Y ecaron -111
+KPX Y ecircumflex -111
+KPX Y edieresis -71
+KPX Y edotaccent -111
+KPX Y egrave -71
+KPX Y emacron -71
+KPX Y eogonek -111
+KPX Y hyphen -92
+KPX Y i -37
+KPX Y iacute -37
+KPX Y iogonek -37
+KPX Y o -111
+KPX Y oacute -111
+KPX Y ocircumflex -111
+KPX Y odieresis -111
+KPX Y ograve -111
+KPX Y ohungarumlaut -111
+KPX Y omacron -111
+KPX Y oslash -111
+KPX Y otilde -111
+KPX Y period -92
+KPX Y semicolon -92
+KPX Y u -92
+KPX Y uacute -92
+KPX Y ucircumflex -92
+KPX Y udieresis -92
+KPX Y ugrave -92
+KPX Y uhungarumlaut -92
+KPX Y umacron -92
+KPX Y uogonek -92
+KPX Y uring -92
+KPX Yacute A -110
+KPX Yacute Aacute -110
+KPX Yacute Abreve -110
+KPX Yacute Acircumflex -110
+KPX Yacute Adieresis -110
+KPX Yacute Agrave -110
+KPX Yacute Amacron -110
+KPX Yacute Aogonek -110
+KPX Yacute Aring -110
+KPX Yacute Atilde -110
+KPX Yacute O -35
+KPX Yacute Oacute -35
+KPX Yacute Ocircumflex -35
+KPX Yacute Odieresis -35
+KPX Yacute Ograve -35
+KPX Yacute Ohungarumlaut -35
+KPX Yacute Omacron -35
+KPX Yacute Oslash -35
+KPX Yacute Otilde -35
+KPX Yacute a -85
+KPX Yacute aacute -85
+KPX Yacute abreve -85
+KPX Yacute acircumflex -85
+KPX Yacute adieresis -85
+KPX Yacute agrave -85
+KPX Yacute amacron -85
+KPX Yacute aogonek -85
+KPX Yacute aring -85
+KPX Yacute atilde -85
+KPX Yacute colon -92
+KPX Yacute comma -92
+KPX Yacute e -111
+KPX Yacute eacute -111
+KPX Yacute ecaron -111
+KPX Yacute ecircumflex -111
+KPX Yacute edieresis -71
+KPX Yacute edotaccent -111
+KPX Yacute egrave -71
+KPX Yacute emacron -71
+KPX Yacute eogonek -111
+KPX Yacute hyphen -92
+KPX Yacute i -37
+KPX Yacute iacute -37
+KPX Yacute iogonek -37
+KPX Yacute o -111
+KPX Yacute oacute -111
+KPX Yacute ocircumflex -111
+KPX Yacute odieresis -111
+KPX Yacute ograve -111
+KPX Yacute ohungarumlaut -111
+KPX Yacute omacron -111
+KPX Yacute oslash -111
+KPX Yacute otilde -111
+KPX Yacute period -92
+KPX Yacute semicolon -92
+KPX Yacute u -92
+KPX Yacute uacute -92
+KPX Yacute ucircumflex -92
+KPX Yacute udieresis -92
+KPX Yacute ugrave -92
+KPX Yacute uhungarumlaut -92
+KPX Yacute umacron -92
+KPX Yacute uogonek -92
+KPX Yacute uring -92
+KPX Ydieresis A -110
+KPX Ydieresis Aacute -110
+KPX Ydieresis Abreve -110
+KPX Ydieresis Acircumflex -110
+KPX Ydieresis Adieresis -110
+KPX Ydieresis Agrave -110
+KPX Ydieresis Amacron -110
+KPX Ydieresis Aogonek -110
+KPX Ydieresis Aring -110
+KPX Ydieresis Atilde -110
+KPX Ydieresis O -35
+KPX Ydieresis Oacute -35
+KPX Ydieresis Ocircumflex -35
+KPX Ydieresis Odieresis -35
+KPX Ydieresis Ograve -35
+KPX Ydieresis Ohungarumlaut -35
+KPX Ydieresis Omacron -35
+KPX Ydieresis Oslash -35
+KPX Ydieresis Otilde -35
+KPX Ydieresis a -85
+KPX Ydieresis aacute -85
+KPX Ydieresis abreve -85
+KPX Ydieresis acircumflex -85
+KPX Ydieresis adieresis -85
+KPX Ydieresis agrave -85
+KPX Ydieresis amacron -85
+KPX Ydieresis aogonek -85
+KPX Ydieresis aring -85
+KPX Ydieresis atilde -85
+KPX Ydieresis colon -92
+KPX Ydieresis comma -92
+KPX Ydieresis e -111
+KPX Ydieresis eacute -111
+KPX Ydieresis ecaron -111
+KPX Ydieresis ecircumflex -111
+KPX Ydieresis edieresis -71
+KPX Ydieresis edotaccent -111
+KPX Ydieresis egrave -71
+KPX Ydieresis emacron -71
+KPX Ydieresis eogonek -111
+KPX Ydieresis hyphen -92
+KPX Ydieresis i -37
+KPX Ydieresis iacute -37
+KPX Ydieresis iogonek -37
+KPX Ydieresis o -111
+KPX Ydieresis oacute -111
+KPX Ydieresis ocircumflex -111
+KPX Ydieresis odieresis -111
+KPX Ydieresis ograve -111
+KPX Ydieresis ohungarumlaut -111
+KPX Ydieresis omacron -111
+KPX Ydieresis oslash -111
+KPX Ydieresis otilde -111
+KPX Ydieresis period -92
+KPX Ydieresis semicolon -92
+KPX Ydieresis u -92
+KPX Ydieresis uacute -92
+KPX Ydieresis ucircumflex -92
+KPX Ydieresis udieresis -92
+KPX Ydieresis ugrave -92
+KPX Ydieresis uhungarumlaut -92
+KPX Ydieresis umacron -92
+KPX Ydieresis uogonek -92
+KPX Ydieresis uring -92
+KPX a v -25
+KPX aacute v -25
+KPX abreve v -25
+KPX acircumflex v -25
+KPX adieresis v -25
+KPX agrave v -25
+KPX amacron v -25
+KPX aogonek v -25
+KPX aring v -25
+KPX atilde v -25
+KPX b b -10
+KPX b period -40
+KPX b u -20
+KPX b uacute -20
+KPX b ucircumflex -20
+KPX b udieresis -20
+KPX b ugrave -20
+KPX b uhungarumlaut -20
+KPX b umacron -20
+KPX b uogonek -20
+KPX b uring -20
+KPX b v -15
+KPX comma quotedblright -45
+KPX comma quoteright -55
+KPX d w -15
+KPX dcroat w -15
+KPX e v -15
+KPX eacute v -15
+KPX ecaron v -15
+KPX ecircumflex v -15
+KPX edieresis v -15
+KPX edotaccent v -15
+KPX egrave v -15
+KPX emacron v -15
+KPX eogonek v -15
+KPX f comma -15
+KPX f dotlessi -35
+KPX f i -25
+KPX f o -25
+KPX f oacute -25
+KPX f ocircumflex -25
+KPX f odieresis -25
+KPX f ograve -25
+KPX f ohungarumlaut -25
+KPX f omacron -25
+KPX f oslash -25
+KPX f otilde -25
+KPX f period -15
+KPX f quotedblright 50
+KPX f quoteright 55
+KPX g period -15
+KPX gbreve period -15
+KPX gcommaaccent period -15
+KPX h y -15
+KPX h yacute -15
+KPX h ydieresis -15
+KPX i v -10
+KPX iacute v -10
+KPX icircumflex v -10
+KPX idieresis v -10
+KPX igrave v -10
+KPX imacron v -10
+KPX iogonek v -10
+KPX k e -10
+KPX k eacute -10
+KPX k ecaron -10
+KPX k ecircumflex -10
+KPX k edieresis -10
+KPX k edotaccent -10
+KPX k egrave -10
+KPX k emacron -10
+KPX k eogonek -10
+KPX k o -15
+KPX k oacute -15
+KPX k ocircumflex -15
+KPX k odieresis -15
+KPX k ograve -15
+KPX k ohungarumlaut -15
+KPX k omacron -15
+KPX k oslash -15
+KPX k otilde -15
+KPX k y -15
+KPX k yacute -15
+KPX k ydieresis -15
+KPX kcommaaccent e -10
+KPX kcommaaccent eacute -10
+KPX kcommaaccent ecaron -10
+KPX kcommaaccent ecircumflex -10
+KPX kcommaaccent edieresis -10
+KPX kcommaaccent edotaccent -10
+KPX kcommaaccent egrave -10
+KPX kcommaaccent emacron -10
+KPX kcommaaccent eogonek -10
+KPX kcommaaccent o -15
+KPX kcommaaccent oacute -15
+KPX kcommaaccent ocircumflex -15
+KPX kcommaaccent odieresis -15
+KPX kcommaaccent ograve -15
+KPX kcommaaccent ohungarumlaut -15
+KPX kcommaaccent omacron -15
+KPX kcommaaccent oslash -15
+KPX kcommaaccent otilde -15
+KPX kcommaaccent y -15
+KPX kcommaaccent yacute -15
+KPX kcommaaccent ydieresis -15
+KPX n v -40
+KPX nacute v -40
+KPX ncaron v -40
+KPX ncommaaccent v -40
+KPX ntilde v -40
+KPX o v -10
+KPX o w -10
+KPX oacute v -10
+KPX oacute w -10
+KPX ocircumflex v -10
+KPX ocircumflex w -10
+KPX odieresis v -10
+KPX odieresis w -10
+KPX ograve v -10
+KPX ograve w -10
+KPX ohungarumlaut v -10
+KPX ohungarumlaut w -10
+KPX omacron v -10
+KPX omacron w -10
+KPX oslash v -10
+KPX oslash w -10
+KPX otilde v -10
+KPX otilde w -10
+KPX period quotedblright -55
+KPX period quoteright -55
+KPX quotedblleft A -10
+KPX quotedblleft Aacute -10
+KPX quotedblleft Abreve -10
+KPX quotedblleft Acircumflex -10
+KPX quotedblleft Adieresis -10
+KPX quotedblleft Agrave -10
+KPX quotedblleft Amacron -10
+KPX quotedblleft Aogonek -10
+KPX quotedblleft Aring -10
+KPX quotedblleft Atilde -10
+KPX quoteleft A -10
+KPX quoteleft Aacute -10
+KPX quoteleft Abreve -10
+KPX quoteleft Acircumflex -10
+KPX quoteleft Adieresis -10
+KPX quoteleft Agrave -10
+KPX quoteleft Amacron -10
+KPX quoteleft Aogonek -10
+KPX quoteleft Aring -10
+KPX quoteleft Atilde -10
+KPX quoteleft quoteleft -63
+KPX quoteright d -20
+KPX quoteright dcroat -20
+KPX quoteright quoteright -63
+KPX quoteright r -20
+KPX quoteright racute -20
+KPX quoteright rcaron -20
+KPX quoteright rcommaaccent -20
+KPX quoteright s -37
+KPX quoteright sacute -37
+KPX quoteright scaron -37
+KPX quoteright scedilla -37
+KPX quoteright scommaaccent -37
+KPX quoteright space -74
+KPX quoteright v -20
+KPX r c -18
+KPX r cacute -18
+KPX r ccaron -18
+KPX r ccedilla -18
+KPX r comma -92
+KPX r e -18
+KPX r eacute -18
+KPX r ecaron -18
+KPX r ecircumflex -18
+KPX r edieresis -18
+KPX r edotaccent -18
+KPX r egrave -18
+KPX r emacron -18
+KPX r eogonek -18
+KPX r g -10
+KPX r gbreve -10
+KPX r gcommaaccent -10
+KPX r hyphen -37
+KPX r n -15
+KPX r nacute -15
+KPX r ncaron -15
+KPX r ncommaaccent -15
+KPX r ntilde -15
+KPX r o -18
+KPX r oacute -18
+KPX r ocircumflex -18
+KPX r odieresis -18
+KPX r ograve -18
+KPX r ohungarumlaut -18
+KPX r omacron -18
+KPX r oslash -18
+KPX r otilde -18
+KPX r p -10
+KPX r period -100
+KPX r q -18
+KPX r v -10
+KPX racute c -18
+KPX racute cacute -18
+KPX racute ccaron -18
+KPX racute ccedilla -18
+KPX racute comma -92
+KPX racute e -18
+KPX racute eacute -18
+KPX racute ecaron -18
+KPX racute ecircumflex -18
+KPX racute edieresis -18
+KPX racute edotaccent -18
+KPX racute egrave -18
+KPX racute emacron -18
+KPX racute eogonek -18
+KPX racute g -10
+KPX racute gbreve -10
+KPX racute gcommaaccent -10
+KPX racute hyphen -37
+KPX racute n -15
+KPX racute nacute -15
+KPX racute ncaron -15
+KPX racute ncommaaccent -15
+KPX racute ntilde -15
+KPX racute o -18
+KPX racute oacute -18
+KPX racute ocircumflex -18
+KPX racute odieresis -18
+KPX racute ograve -18
+KPX racute ohungarumlaut -18
+KPX racute omacron -18
+KPX racute oslash -18
+KPX racute otilde -18
+KPX racute p -10
+KPX racute period -100
+KPX racute q -18
+KPX racute v -10
+KPX rcaron c -18
+KPX rcaron cacute -18
+KPX rcaron ccaron -18
+KPX rcaron ccedilla -18
+KPX rcaron comma -92
+KPX rcaron e -18
+KPX rcaron eacute -18
+KPX rcaron ecaron -18
+KPX rcaron ecircumflex -18
+KPX rcaron edieresis -18
+KPX rcaron edotaccent -18
+KPX rcaron egrave -18
+KPX rcaron emacron -18
+KPX rcaron eogonek -18
+KPX rcaron g -10
+KPX rcaron gbreve -10
+KPX rcaron gcommaaccent -10
+KPX rcaron hyphen -37
+KPX rcaron n -15
+KPX rcaron nacute -15
+KPX rcaron ncaron -15
+KPX rcaron ncommaaccent -15
+KPX rcaron ntilde -15
+KPX rcaron o -18
+KPX rcaron oacute -18
+KPX rcaron ocircumflex -18
+KPX rcaron odieresis -18
+KPX rcaron ograve -18
+KPX rcaron ohungarumlaut -18
+KPX rcaron omacron -18
+KPX rcaron oslash -18
+KPX rcaron otilde -18
+KPX rcaron p -10
+KPX rcaron period -100
+KPX rcaron q -18
+KPX rcaron v -10
+KPX rcommaaccent c -18
+KPX rcommaaccent cacute -18
+KPX rcommaaccent ccaron -18
+KPX rcommaaccent ccedilla -18
+KPX rcommaaccent comma -92
+KPX rcommaaccent e -18
+KPX rcommaaccent eacute -18
+KPX rcommaaccent ecaron -18
+KPX rcommaaccent ecircumflex -18
+KPX rcommaaccent edieresis -18
+KPX rcommaaccent edotaccent -18
+KPX rcommaaccent egrave -18
+KPX rcommaaccent emacron -18
+KPX rcommaaccent eogonek -18
+KPX rcommaaccent g -10
+KPX rcommaaccent gbreve -10
+KPX rcommaaccent gcommaaccent -10
+KPX rcommaaccent hyphen -37
+KPX rcommaaccent n -15
+KPX rcommaaccent nacute -15
+KPX rcommaaccent ncaron -15
+KPX rcommaaccent ncommaaccent -15
+KPX rcommaaccent ntilde -15
+KPX rcommaaccent o -18
+KPX rcommaaccent oacute -18
+KPX rcommaaccent ocircumflex -18
+KPX rcommaaccent odieresis -18
+KPX rcommaaccent ograve -18
+KPX rcommaaccent ohungarumlaut -18
+KPX rcommaaccent omacron -18
+KPX rcommaaccent oslash -18
+KPX rcommaaccent otilde -18
+KPX rcommaaccent p -10
+KPX rcommaaccent period -100
+KPX rcommaaccent q -18
+KPX rcommaaccent v -10
+KPX space A -55
+KPX space Aacute -55
+KPX space Abreve -55
+KPX space Acircumflex -55
+KPX space Adieresis -55
+KPX space Agrave -55
+KPX space Amacron -55
+KPX space Aogonek -55
+KPX space Aring -55
+KPX space Atilde -55
+KPX space T -30
+KPX space Tcaron -30
+KPX space Tcommaaccent -30
+KPX space V -45
+KPX space W -30
+KPX space Y -55
+KPX space Yacute -55
+KPX space Ydieresis -55
+KPX v a -10
+KPX v aacute -10
+KPX v abreve -10
+KPX v acircumflex -10
+KPX v adieresis -10
+KPX v agrave -10
+KPX v amacron -10
+KPX v aogonek -10
+KPX v aring -10
+KPX v atilde -10
+KPX v comma -55
+KPX v e -10
+KPX v eacute -10
+KPX v ecaron -10
+KPX v ecircumflex -10
+KPX v edieresis -10
+KPX v edotaccent -10
+KPX v egrave -10
+KPX v emacron -10
+KPX v eogonek -10
+KPX v o -10
+KPX v oacute -10
+KPX v ocircumflex -10
+KPX v odieresis -10
+KPX v ograve -10
+KPX v ohungarumlaut -10
+KPX v omacron -10
+KPX v oslash -10
+KPX v otilde -10
+KPX v period -70
+KPX w comma -55
+KPX w o -10
+KPX w oacute -10
+KPX w ocircumflex -10
+KPX w odieresis -10
+KPX w ograve -10
+KPX w ohungarumlaut -10
+KPX w omacron -10
+KPX w oslash -10
+KPX w otilde -10
+KPX w period -70
+KPX y comma -55
+KPX y e -10
+KPX y eacute -10
+KPX y ecaron -10
+KPX y ecircumflex -10
+KPX y edieresis -10
+KPX y edotaccent -10
+KPX y egrave -10
+KPX y emacron -10
+KPX y eogonek -10
+KPX y o -25
+KPX y oacute -25
+KPX y ocircumflex -25
+KPX y odieresis -25
+KPX y ograve -25
+KPX y ohungarumlaut -25
+KPX y omacron -25
+KPX y oslash -25
+KPX y otilde -25
+KPX y period -70
+KPX yacute comma -55
+KPX yacute e -10
+KPX yacute eacute -10
+KPX yacute ecaron -10
+KPX yacute ecircumflex -10
+KPX yacute edieresis -10
+KPX yacute edotaccent -10
+KPX yacute egrave -10
+KPX yacute emacron -10
+KPX yacute eogonek -10
+KPX yacute o -25
+KPX yacute oacute -25
+KPX yacute ocircumflex -25
+KPX yacute odieresis -25
+KPX yacute ograve -25
+KPX yacute ohungarumlaut -25
+KPX yacute omacron -25
+KPX yacute oslash -25
+KPX yacute otilde -25
+KPX yacute period -70
+KPX ydieresis comma -55
+KPX ydieresis e -10
+KPX ydieresis eacute -10
+KPX ydieresis ecaron -10
+KPX ydieresis ecircumflex -10
+KPX ydieresis edieresis -10
+KPX ydieresis edotaccent -10
+KPX ydieresis egrave -10
+KPX ydieresis emacron -10
+KPX ydieresis eogonek -10
+KPX ydieresis o -25
+KPX ydieresis oacute -25
+KPX ydieresis ocircumflex -25
+KPX ydieresis odieresis -25
+KPX ydieresis ograve -25
+KPX ydieresis ohungarumlaut -25
+KPX ydieresis omacron -25
+KPX ydieresis oslash -25
+KPX ydieresis otilde -25
+KPX ydieresis period -70
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Times-BoldItalic.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Times-BoldItalic.afm
new file mode 100644
index 0000000..2301dfd
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Times-BoldItalic.afm
@@ -0,0 +1,2384 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu May 1 13:04:06 1997
+Comment UniqueID 43066
+Comment VMusage 45874 56899
+FontName Times-BoldItalic
+FullName Times Bold Italic
+FamilyName Times
+Weight Bold
+ItalicAngle -15
+IsFixedPitch false
+CharacterSet ExtendedRoman
+FontBBox -200 -218 996 921
+UnderlinePosition -100
+UnderlineThickness 50
+Version 002.000
+Notice Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.Times is a trademark of Linotype-Hell AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 669
+XHeight 462
+Ascender 683
+Descender -217
+StdHW 42
+StdVW 121
+StartCharMetrics 315
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 389 ; N exclam ; B 67 -13 370 684 ;
+C 34 ; WX 555 ; N quotedbl ; B 136 398 536 685 ;
+C 35 ; WX 500 ; N numbersign ; B -33 0 533 700 ;
+C 36 ; WX 500 ; N dollar ; B -20 -100 497 733 ;
+C 37 ; WX 833 ; N percent ; B 39 -10 793 692 ;
+C 38 ; WX 778 ; N ampersand ; B 5 -19 699 682 ;
+C 39 ; WX 333 ; N quoteright ; B 98 369 302 685 ;
+C 40 ; WX 333 ; N parenleft ; B 28 -179 344 685 ;
+C 41 ; WX 333 ; N parenright ; B -44 -179 271 685 ;
+C 42 ; WX 500 ; N asterisk ; B 65 249 456 685 ;
+C 43 ; WX 570 ; N plus ; B 33 0 537 506 ;
+C 44 ; WX 250 ; N comma ; B -60 -182 144 134 ;
+C 45 ; WX 333 ; N hyphen ; B 2 166 271 282 ;
+C 46 ; WX 250 ; N period ; B -9 -13 139 135 ;
+C 47 ; WX 278 ; N slash ; B -64 -18 342 685 ;
+C 48 ; WX 500 ; N zero ; B 17 -14 477 683 ;
+C 49 ; WX 500 ; N one ; B 5 0 419 683 ;
+C 50 ; WX 500 ; N two ; B -27 0 446 683 ;
+C 51 ; WX 500 ; N three ; B -15 -13 450 683 ;
+C 52 ; WX 500 ; N four ; B -15 0 503 683 ;
+C 53 ; WX 500 ; N five ; B -11 -13 487 669 ;
+C 54 ; WX 500 ; N six ; B 23 -15 509 679 ;
+C 55 ; WX 500 ; N seven ; B 52 0 525 669 ;
+C 56 ; WX 500 ; N eight ; B 3 -13 476 683 ;
+C 57 ; WX 500 ; N nine ; B -12 -10 475 683 ;
+C 58 ; WX 333 ; N colon ; B 23 -13 264 459 ;
+C 59 ; WX 333 ; N semicolon ; B -25 -183 264 459 ;
+C 60 ; WX 570 ; N less ; B 31 -8 539 514 ;
+C 61 ; WX 570 ; N equal ; B 33 107 537 399 ;
+C 62 ; WX 570 ; N greater ; B 31 -8 539 514 ;
+C 63 ; WX 500 ; N question ; B 79 -13 470 684 ;
+C 64 ; WX 832 ; N at ; B 63 -18 770 685 ;
+C 65 ; WX 667 ; N A ; B -67 0 593 683 ;
+C 66 ; WX 667 ; N B ; B -24 0 624 669 ;
+C 67 ; WX 667 ; N C ; B 32 -18 677 685 ;
+C 68 ; WX 722 ; N D ; B -46 0 685 669 ;
+C 69 ; WX 667 ; N E ; B -27 0 653 669 ;
+C 70 ; WX 667 ; N F ; B -13 0 660 669 ;
+C 71 ; WX 722 ; N G ; B 21 -18 706 685 ;
+C 72 ; WX 778 ; N H ; B -24 0 799 669 ;
+C 73 ; WX 389 ; N I ; B -32 0 406 669 ;
+C 74 ; WX 500 ; N J ; B -46 -99 524 669 ;
+C 75 ; WX 667 ; N K ; B -21 0 702 669 ;
+C 76 ; WX 611 ; N L ; B -22 0 590 669 ;
+C 77 ; WX 889 ; N M ; B -29 -12 917 669 ;
+C 78 ; WX 722 ; N N ; B -27 -15 748 669 ;
+C 79 ; WX 722 ; N O ; B 27 -18 691 685 ;
+C 80 ; WX 611 ; N P ; B -27 0 613 669 ;
+C 81 ; WX 722 ; N Q ; B 27 -208 691 685 ;
+C 82 ; WX 667 ; N R ; B -29 0 623 669 ;
+C 83 ; WX 556 ; N S ; B 2 -18 526 685 ;
+C 84 ; WX 611 ; N T ; B 50 0 650 669 ;
+C 85 ; WX 722 ; N U ; B 67 -18 744 669 ;
+C 86 ; WX 667 ; N V ; B 65 -18 715 669 ;
+C 87 ; WX 889 ; N W ; B 65 -18 940 669 ;
+C 88 ; WX 667 ; N X ; B -24 0 694 669 ;
+C 89 ; WX 611 ; N Y ; B 73 0 659 669 ;
+C 90 ; WX 611 ; N Z ; B -11 0 590 669 ;
+C 91 ; WX 333 ; N bracketleft ; B -37 -159 362 674 ;
+C 92 ; WX 278 ; N backslash ; B -1 -18 279 685 ;
+C 93 ; WX 333 ; N bracketright ; B -56 -157 343 674 ;
+C 94 ; WX 570 ; N asciicircum ; B 67 304 503 669 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 333 ; N quoteleft ; B 128 369 332 685 ;
+C 97 ; WX 500 ; N a ; B -21 -14 455 462 ;
+C 98 ; WX 500 ; N b ; B -14 -13 444 699 ;
+C 99 ; WX 444 ; N c ; B -5 -13 392 462 ;
+C 100 ; WX 500 ; N d ; B -21 -13 517 699 ;
+C 101 ; WX 444 ; N e ; B 5 -13 398 462 ;
+C 102 ; WX 333 ; N f ; B -169 -205 446 698 ; L i fi ; L l fl ;
+C 103 ; WX 500 ; N g ; B -52 -203 478 462 ;
+C 104 ; WX 556 ; N h ; B -13 -9 498 699 ;
+C 105 ; WX 278 ; N i ; B 2 -9 263 684 ;
+C 106 ; WX 278 ; N j ; B -189 -207 279 684 ;
+C 107 ; WX 500 ; N k ; B -23 -8 483 699 ;
+C 108 ; WX 278 ; N l ; B 2 -9 290 699 ;
+C 109 ; WX 778 ; N m ; B -14 -9 722 462 ;
+C 110 ; WX 556 ; N n ; B -6 -9 493 462 ;
+C 111 ; WX 500 ; N o ; B -3 -13 441 462 ;
+C 112 ; WX 500 ; N p ; B -120 -205 446 462 ;
+C 113 ; WX 500 ; N q ; B 1 -205 471 462 ;
+C 114 ; WX 389 ; N r ; B -21 0 389 462 ;
+C 115 ; WX 389 ; N s ; B -19 -13 333 462 ;
+C 116 ; WX 278 ; N t ; B -11 -9 281 594 ;
+C 117 ; WX 556 ; N u ; B 15 -9 492 462 ;
+C 118 ; WX 444 ; N v ; B 16 -13 401 462 ;
+C 119 ; WX 667 ; N w ; B 16 -13 614 462 ;
+C 120 ; WX 500 ; N x ; B -46 -13 469 462 ;
+C 121 ; WX 444 ; N y ; B -94 -205 392 462 ;
+C 122 ; WX 389 ; N z ; B -43 -78 368 449 ;
+C 123 ; WX 348 ; N braceleft ; B 5 -187 436 686 ;
+C 124 ; WX 220 ; N bar ; B 66 -218 154 782 ;
+C 125 ; WX 348 ; N braceright ; B -129 -187 302 686 ;
+C 126 ; WX 570 ; N asciitilde ; B 54 173 516 333 ;
+C 161 ; WX 389 ; N exclamdown ; B 19 -205 322 492 ;
+C 162 ; WX 500 ; N cent ; B 42 -143 439 576 ;
+C 163 ; WX 500 ; N sterling ; B -32 -12 510 683 ;
+C 164 ; WX 167 ; N fraction ; B -169 -14 324 683 ;
+C 165 ; WX 500 ; N yen ; B 33 0 628 669 ;
+C 166 ; WX 500 ; N florin ; B -87 -156 537 707 ;
+C 167 ; WX 500 ; N section ; B 36 -143 459 685 ;
+C 168 ; WX 500 ; N currency ; B -26 34 526 586 ;
+C 169 ; WX 278 ; N quotesingle ; B 128 398 268 685 ;
+C 170 ; WX 500 ; N quotedblleft ; B 53 369 513 685 ;
+C 171 ; WX 500 ; N guillemotleft ; B 12 32 468 415 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 32 32 303 415 ;
+C 173 ; WX 333 ; N guilsinglright ; B 10 32 281 415 ;
+C 174 ; WX 556 ; N fi ; B -188 -205 514 703 ;
+C 175 ; WX 556 ; N fl ; B -186 -205 553 704 ;
+C 177 ; WX 500 ; N endash ; B -40 178 477 269 ;
+C 178 ; WX 500 ; N dagger ; B 91 -145 494 685 ;
+C 179 ; WX 500 ; N daggerdbl ; B 10 -139 493 685 ;
+C 180 ; WX 250 ; N periodcentered ; B 51 257 199 405 ;
+C 182 ; WX 500 ; N paragraph ; B -57 -193 562 669 ;
+C 183 ; WX 350 ; N bullet ; B 0 175 350 525 ;
+C 184 ; WX 333 ; N quotesinglbase ; B -5 -182 199 134 ;
+C 185 ; WX 500 ; N quotedblbase ; B -57 -182 403 134 ;
+C 186 ; WX 500 ; N quotedblright ; B 53 369 513 685 ;
+C 187 ; WX 500 ; N guillemotright ; B 12 32 468 415 ;
+C 188 ; WX 1000 ; N ellipsis ; B 40 -13 852 135 ;
+C 189 ; WX 1000 ; N perthousand ; B 7 -29 996 706 ;
+C 191 ; WX 500 ; N questiondown ; B 30 -205 421 492 ;
+C 193 ; WX 333 ; N grave ; B 85 516 297 697 ;
+C 194 ; WX 333 ; N acute ; B 139 516 379 697 ;
+C 195 ; WX 333 ; N circumflex ; B 40 516 367 690 ;
+C 196 ; WX 333 ; N tilde ; B 48 536 407 655 ;
+C 197 ; WX 333 ; N macron ; B 51 553 393 623 ;
+C 198 ; WX 333 ; N breve ; B 71 516 387 678 ;
+C 199 ; WX 333 ; N dotaccent ; B 163 550 298 684 ;
+C 200 ; WX 333 ; N dieresis ; B 55 550 402 684 ;
+C 202 ; WX 333 ; N ring ; B 127 516 340 729 ;
+C 203 ; WX 333 ; N cedilla ; B -80 -218 156 5 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 69 516 498 697 ;
+C 206 ; WX 333 ; N ogonek ; B 15 -183 244 34 ;
+C 207 ; WX 333 ; N caron ; B 79 516 411 690 ;
+C 208 ; WX 1000 ; N emdash ; B -40 178 977 269 ;
+C 225 ; WX 944 ; N AE ; B -64 0 918 669 ;
+C 227 ; WX 266 ; N ordfeminine ; B 16 399 330 685 ;
+C 232 ; WX 611 ; N Lslash ; B -22 0 590 669 ;
+C 233 ; WX 722 ; N Oslash ; B 27 -125 691 764 ;
+C 234 ; WX 944 ; N OE ; B 23 -8 946 677 ;
+C 235 ; WX 300 ; N ordmasculine ; B 56 400 347 685 ;
+C 241 ; WX 722 ; N ae ; B -5 -13 673 462 ;
+C 245 ; WX 278 ; N dotlessi ; B 2 -9 238 462 ;
+C 248 ; WX 278 ; N lslash ; B -7 -9 307 699 ;
+C 249 ; WX 500 ; N oslash ; B -3 -119 441 560 ;
+C 250 ; WX 722 ; N oe ; B 6 -13 674 462 ;
+C 251 ; WX 500 ; N germandbls ; B -200 -200 473 705 ;
+C -1 ; WX 389 ; N Idieresis ; B -32 0 450 862 ;
+C -1 ; WX 444 ; N eacute ; B 5 -13 435 697 ;
+C -1 ; WX 500 ; N abreve ; B -21 -14 471 678 ;
+C -1 ; WX 556 ; N uhungarumlaut ; B 15 -9 610 697 ;
+C -1 ; WX 444 ; N ecaron ; B 5 -13 467 690 ;
+C -1 ; WX 611 ; N Ydieresis ; B 73 0 659 862 ;
+C -1 ; WX 570 ; N divide ; B 33 -29 537 535 ;
+C -1 ; WX 611 ; N Yacute ; B 73 0 659 904 ;
+C -1 ; WX 667 ; N Acircumflex ; B -67 0 593 897 ;
+C -1 ; WX 500 ; N aacute ; B -21 -14 463 697 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 67 -18 744 897 ;
+C -1 ; WX 444 ; N yacute ; B -94 -205 435 697 ;
+C -1 ; WX 389 ; N scommaaccent ; B -19 -218 333 462 ;
+C -1 ; WX 444 ; N ecircumflex ; B 5 -13 423 690 ;
+C -1 ; WX 722 ; N Uring ; B 67 -18 744 921 ;
+C -1 ; WX 722 ; N Udieresis ; B 67 -18 744 862 ;
+C -1 ; WX 500 ; N aogonek ; B -21 -183 455 462 ;
+C -1 ; WX 722 ; N Uacute ; B 67 -18 744 904 ;
+C -1 ; WX 556 ; N uogonek ; B 15 -183 492 462 ;
+C -1 ; WX 667 ; N Edieresis ; B -27 0 653 862 ;
+C -1 ; WX 722 ; N Dcroat ; B -31 0 700 669 ;
+C -1 ; WX 250 ; N commaaccent ; B -36 -218 131 -50 ;
+C -1 ; WX 747 ; N copyright ; B 30 -18 718 685 ;
+C -1 ; WX 667 ; N Emacron ; B -27 0 653 830 ;
+C -1 ; WX 444 ; N ccaron ; B -5 -13 467 690 ;
+C -1 ; WX 500 ; N aring ; B -21 -14 455 729 ;
+C -1 ; WX 722 ; N Ncommaaccent ; B -27 -218 748 669 ;
+C -1 ; WX 278 ; N lacute ; B 2 -9 392 904 ;
+C -1 ; WX 500 ; N agrave ; B -21 -14 455 697 ;
+C -1 ; WX 611 ; N Tcommaaccent ; B 50 -218 650 669 ;
+C -1 ; WX 667 ; N Cacute ; B 32 -18 677 904 ;
+C -1 ; WX 500 ; N atilde ; B -21 -14 491 655 ;
+C -1 ; WX 667 ; N Edotaccent ; B -27 0 653 862 ;
+C -1 ; WX 389 ; N scaron ; B -19 -13 424 690 ;
+C -1 ; WX 389 ; N scedilla ; B -19 -218 333 462 ;
+C -1 ; WX 278 ; N iacute ; B 2 -9 352 697 ;
+C -1 ; WX 494 ; N lozenge ; B 10 0 484 745 ;
+C -1 ; WX 667 ; N Rcaron ; B -29 0 623 897 ;
+C -1 ; WX 722 ; N Gcommaaccent ; B 21 -218 706 685 ;
+C -1 ; WX 556 ; N ucircumflex ; B 15 -9 492 690 ;
+C -1 ; WX 500 ; N acircumflex ; B -21 -14 455 690 ;
+C -1 ; WX 667 ; N Amacron ; B -67 0 593 830 ;
+C -1 ; WX 389 ; N rcaron ; B -21 0 424 690 ;
+C -1 ; WX 444 ; N ccedilla ; B -5 -218 392 462 ;
+C -1 ; WX 611 ; N Zdotaccent ; B -11 0 590 862 ;
+C -1 ; WX 611 ; N Thorn ; B -27 0 573 669 ;
+C -1 ; WX 722 ; N Omacron ; B 27 -18 691 830 ;
+C -1 ; WX 667 ; N Racute ; B -29 0 623 904 ;
+C -1 ; WX 556 ; N Sacute ; B 2 -18 531 904 ;
+C -1 ; WX 608 ; N dcaron ; B -21 -13 675 708 ;
+C -1 ; WX 722 ; N Umacron ; B 67 -18 744 830 ;
+C -1 ; WX 556 ; N uring ; B 15 -9 492 729 ;
+C -1 ; WX 300 ; N threesuperior ; B 17 265 321 683 ;
+C -1 ; WX 722 ; N Ograve ; B 27 -18 691 904 ;
+C -1 ; WX 667 ; N Agrave ; B -67 0 593 904 ;
+C -1 ; WX 667 ; N Abreve ; B -67 0 593 885 ;
+C -1 ; WX 570 ; N multiply ; B 48 16 522 490 ;
+C -1 ; WX 556 ; N uacute ; B 15 -9 492 697 ;
+C -1 ; WX 611 ; N Tcaron ; B 50 0 650 897 ;
+C -1 ; WX 494 ; N partialdiff ; B 11 -21 494 750 ;
+C -1 ; WX 444 ; N ydieresis ; B -94 -205 443 655 ;
+C -1 ; WX 722 ; N Nacute ; B -27 -15 748 904 ;
+C -1 ; WX 278 ; N icircumflex ; B -3 -9 324 690 ;
+C -1 ; WX 667 ; N Ecircumflex ; B -27 0 653 897 ;
+C -1 ; WX 500 ; N adieresis ; B -21 -14 476 655 ;
+C -1 ; WX 444 ; N edieresis ; B 5 -13 448 655 ;
+C -1 ; WX 444 ; N cacute ; B -5 -13 435 697 ;
+C -1 ; WX 556 ; N nacute ; B -6 -9 493 697 ;
+C -1 ; WX 556 ; N umacron ; B 15 -9 492 623 ;
+C -1 ; WX 722 ; N Ncaron ; B -27 -15 748 897 ;
+C -1 ; WX 389 ; N Iacute ; B -32 0 432 904 ;
+C -1 ; WX 570 ; N plusminus ; B 33 0 537 506 ;
+C -1 ; WX 220 ; N brokenbar ; B 66 -143 154 707 ;
+C -1 ; WX 747 ; N registered ; B 30 -18 718 685 ;
+C -1 ; WX 722 ; N Gbreve ; B 21 -18 706 885 ;
+C -1 ; WX 389 ; N Idotaccent ; B -32 0 406 862 ;
+C -1 ; WX 600 ; N summation ; B 14 -10 585 706 ;
+C -1 ; WX 667 ; N Egrave ; B -27 0 653 904 ;
+C -1 ; WX 389 ; N racute ; B -21 0 407 697 ;
+C -1 ; WX 500 ; N omacron ; B -3 -13 462 623 ;
+C -1 ; WX 611 ; N Zacute ; B -11 0 590 904 ;
+C -1 ; WX 611 ; N Zcaron ; B -11 0 590 897 ;
+C -1 ; WX 549 ; N greaterequal ; B 26 0 523 704 ;
+C -1 ; WX 722 ; N Eth ; B -31 0 700 669 ;
+C -1 ; WX 667 ; N Ccedilla ; B 32 -218 677 685 ;
+C -1 ; WX 278 ; N lcommaaccent ; B -42 -218 290 699 ;
+C -1 ; WX 366 ; N tcaron ; B -11 -9 434 754 ;
+C -1 ; WX 444 ; N eogonek ; B 5 -183 398 462 ;
+C -1 ; WX 722 ; N Uogonek ; B 67 -183 744 669 ;
+C -1 ; WX 667 ; N Aacute ; B -67 0 593 904 ;
+C -1 ; WX 667 ; N Adieresis ; B -67 0 593 862 ;
+C -1 ; WX 444 ; N egrave ; B 5 -13 398 697 ;
+C -1 ; WX 389 ; N zacute ; B -43 -78 407 697 ;
+C -1 ; WX 278 ; N iogonek ; B -20 -183 263 684 ;
+C -1 ; WX 722 ; N Oacute ; B 27 -18 691 904 ;
+C -1 ; WX 500 ; N oacute ; B -3 -13 463 697 ;
+C -1 ; WX 500 ; N amacron ; B -21 -14 467 623 ;
+C -1 ; WX 389 ; N sacute ; B -19 -13 407 697 ;
+C -1 ; WX 278 ; N idieresis ; B 2 -9 364 655 ;
+C -1 ; WX 722 ; N Ocircumflex ; B 27 -18 691 897 ;
+C -1 ; WX 722 ; N Ugrave ; B 67 -18 744 904 ;
+C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
+C -1 ; WX 500 ; N thorn ; B -120 -205 446 699 ;
+C -1 ; WX 300 ; N twosuperior ; B 2 274 313 683 ;
+C -1 ; WX 722 ; N Odieresis ; B 27 -18 691 862 ;
+C -1 ; WX 576 ; N mu ; B -60 -207 516 449 ;
+C -1 ; WX 278 ; N igrave ; B 2 -9 259 697 ;
+C -1 ; WX 500 ; N ohungarumlaut ; B -3 -13 582 697 ;
+C -1 ; WX 667 ; N Eogonek ; B -27 -183 653 669 ;
+C -1 ; WX 500 ; N dcroat ; B -21 -13 552 699 ;
+C -1 ; WX 750 ; N threequarters ; B 7 -14 726 683 ;
+C -1 ; WX 556 ; N Scedilla ; B 2 -218 526 685 ;
+C -1 ; WX 382 ; N lcaron ; B 2 -9 448 708 ;
+C -1 ; WX 667 ; N Kcommaaccent ; B -21 -218 702 669 ;
+C -1 ; WX 611 ; N Lacute ; B -22 0 590 904 ;
+C -1 ; WX 1000 ; N trademark ; B 32 263 968 669 ;
+C -1 ; WX 444 ; N edotaccent ; B 5 -13 398 655 ;
+C -1 ; WX 389 ; N Igrave ; B -32 0 406 904 ;
+C -1 ; WX 389 ; N Imacron ; B -32 0 461 830 ;
+C -1 ; WX 611 ; N Lcaron ; B -22 0 671 718 ;
+C -1 ; WX 750 ; N onehalf ; B -9 -14 723 683 ;
+C -1 ; WX 549 ; N lessequal ; B 29 0 526 704 ;
+C -1 ; WX 500 ; N ocircumflex ; B -3 -13 451 690 ;
+C -1 ; WX 556 ; N ntilde ; B -6 -9 504 655 ;
+C -1 ; WX 722 ; N Uhungarumlaut ; B 67 -18 744 904 ;
+C -1 ; WX 667 ; N Eacute ; B -27 0 653 904 ;
+C -1 ; WX 444 ; N emacron ; B 5 -13 439 623 ;
+C -1 ; WX 500 ; N gbreve ; B -52 -203 478 678 ;
+C -1 ; WX 750 ; N onequarter ; B 7 -14 721 683 ;
+C -1 ; WX 556 ; N Scaron ; B 2 -18 553 897 ;
+C -1 ; WX 556 ; N Scommaaccent ; B 2 -218 526 685 ;
+C -1 ; WX 722 ; N Ohungarumlaut ; B 27 -18 723 904 ;
+C -1 ; WX 400 ; N degree ; B 83 397 369 683 ;
+C -1 ; WX 500 ; N ograve ; B -3 -13 441 697 ;
+C -1 ; WX 667 ; N Ccaron ; B 32 -18 677 897 ;
+C -1 ; WX 556 ; N ugrave ; B 15 -9 492 697 ;
+C -1 ; WX 549 ; N radical ; B 10 -46 512 850 ;
+C -1 ; WX 722 ; N Dcaron ; B -46 0 685 897 ;
+C -1 ; WX 389 ; N rcommaaccent ; B -67 -218 389 462 ;
+C -1 ; WX 722 ; N Ntilde ; B -27 -15 748 862 ;
+C -1 ; WX 500 ; N otilde ; B -3 -13 491 655 ;
+C -1 ; WX 667 ; N Rcommaaccent ; B -29 -218 623 669 ;
+C -1 ; WX 611 ; N Lcommaaccent ; B -22 -218 590 669 ;
+C -1 ; WX 667 ; N Atilde ; B -67 0 593 862 ;
+C -1 ; WX 667 ; N Aogonek ; B -67 -183 604 683 ;
+C -1 ; WX 667 ; N Aring ; B -67 0 593 921 ;
+C -1 ; WX 722 ; N Otilde ; B 27 -18 691 862 ;
+C -1 ; WX 389 ; N zdotaccent ; B -43 -78 368 655 ;
+C -1 ; WX 667 ; N Ecaron ; B -27 0 653 897 ;
+C -1 ; WX 389 ; N Iogonek ; B -32 -183 406 669 ;
+C -1 ; WX 500 ; N kcommaaccent ; B -23 -218 483 699 ;
+C -1 ; WX 606 ; N minus ; B 51 209 555 297 ;
+C -1 ; WX 389 ; N Icircumflex ; B -32 0 450 897 ;
+C -1 ; WX 556 ; N ncaron ; B -6 -9 523 690 ;
+C -1 ; WX 278 ; N tcommaaccent ; B -62 -218 281 594 ;
+C -1 ; WX 606 ; N logicalnot ; B 51 108 555 399 ;
+C -1 ; WX 500 ; N odieresis ; B -3 -13 471 655 ;
+C -1 ; WX 556 ; N udieresis ; B 15 -9 499 655 ;
+C -1 ; WX 549 ; N notequal ; B 15 -49 540 570 ;
+C -1 ; WX 500 ; N gcommaaccent ; B -52 -203 478 767 ;
+C -1 ; WX 500 ; N eth ; B -3 -13 454 699 ;
+C -1 ; WX 389 ; N zcaron ; B -43 -78 424 690 ;
+C -1 ; WX 556 ; N ncommaaccent ; B -6 -218 493 462 ;
+C -1 ; WX 300 ; N onesuperior ; B 30 274 301 683 ;
+C -1 ; WX 278 ; N imacron ; B 2 -9 294 623 ;
+C -1 ; WX 500 ; N Euro ; B 0 0 0 0 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 2038
+KPX A C -65
+KPX A Cacute -65
+KPX A Ccaron -65
+KPX A Ccedilla -65
+KPX A G -60
+KPX A Gbreve -60
+KPX A Gcommaaccent -60
+KPX A O -50
+KPX A Oacute -50
+KPX A Ocircumflex -50
+KPX A Odieresis -50
+KPX A Ograve -50
+KPX A Ohungarumlaut -50
+KPX A Omacron -50
+KPX A Oslash -50
+KPX A Otilde -50
+KPX A Q -55
+KPX A T -55
+KPX A Tcaron -55
+KPX A Tcommaaccent -55
+KPX A U -50
+KPX A Uacute -50
+KPX A Ucircumflex -50
+KPX A Udieresis -50
+KPX A Ugrave -50
+KPX A Uhungarumlaut -50
+KPX A Umacron -50
+KPX A Uogonek -50
+KPX A Uring -50
+KPX A V -95
+KPX A W -100
+KPX A Y -70
+KPX A Yacute -70
+KPX A Ydieresis -70
+KPX A quoteright -74
+KPX A u -30
+KPX A uacute -30
+KPX A ucircumflex -30
+KPX A udieresis -30
+KPX A ugrave -30
+KPX A uhungarumlaut -30
+KPX A umacron -30
+KPX A uogonek -30
+KPX A uring -30
+KPX A v -74
+KPX A w -74
+KPX A y -74
+KPX A yacute -74
+KPX A ydieresis -74
+KPX Aacute C -65
+KPX Aacute Cacute -65
+KPX Aacute Ccaron -65
+KPX Aacute Ccedilla -65
+KPX Aacute G -60
+KPX Aacute Gbreve -60
+KPX Aacute Gcommaaccent -60
+KPX Aacute O -50
+KPX Aacute Oacute -50
+KPX Aacute Ocircumflex -50
+KPX Aacute Odieresis -50
+KPX Aacute Ograve -50
+KPX Aacute Ohungarumlaut -50
+KPX Aacute Omacron -50
+KPX Aacute Oslash -50
+KPX Aacute Otilde -50
+KPX Aacute Q -55
+KPX Aacute T -55
+KPX Aacute Tcaron -55
+KPX Aacute Tcommaaccent -55
+KPX Aacute U -50
+KPX Aacute Uacute -50
+KPX Aacute Ucircumflex -50
+KPX Aacute Udieresis -50
+KPX Aacute Ugrave -50
+KPX Aacute Uhungarumlaut -50
+KPX Aacute Umacron -50
+KPX Aacute Uogonek -50
+KPX Aacute Uring -50
+KPX Aacute V -95
+KPX Aacute W -100
+KPX Aacute Y -70
+KPX Aacute Yacute -70
+KPX Aacute Ydieresis -70
+KPX Aacute quoteright -74
+KPX Aacute u -30
+KPX Aacute uacute -30
+KPX Aacute ucircumflex -30
+KPX Aacute udieresis -30
+KPX Aacute ugrave -30
+KPX Aacute uhungarumlaut -30
+KPX Aacute umacron -30
+KPX Aacute uogonek -30
+KPX Aacute uring -30
+KPX Aacute v -74
+KPX Aacute w -74
+KPX Aacute y -74
+KPX Aacute yacute -74
+KPX Aacute ydieresis -74
+KPX Abreve C -65
+KPX Abreve Cacute -65
+KPX Abreve Ccaron -65
+KPX Abreve Ccedilla -65
+KPX Abreve G -60
+KPX Abreve Gbreve -60
+KPX Abreve Gcommaaccent -60
+KPX Abreve O -50
+KPX Abreve Oacute -50
+KPX Abreve Ocircumflex -50
+KPX Abreve Odieresis -50
+KPX Abreve Ograve -50
+KPX Abreve Ohungarumlaut -50
+KPX Abreve Omacron -50
+KPX Abreve Oslash -50
+KPX Abreve Otilde -50
+KPX Abreve Q -55
+KPX Abreve T -55
+KPX Abreve Tcaron -55
+KPX Abreve Tcommaaccent -55
+KPX Abreve U -50
+KPX Abreve Uacute -50
+KPX Abreve Ucircumflex -50
+KPX Abreve Udieresis -50
+KPX Abreve Ugrave -50
+KPX Abreve Uhungarumlaut -50
+KPX Abreve Umacron -50
+KPX Abreve Uogonek -50
+KPX Abreve Uring -50
+KPX Abreve V -95
+KPX Abreve W -100
+KPX Abreve Y -70
+KPX Abreve Yacute -70
+KPX Abreve Ydieresis -70
+KPX Abreve quoteright -74
+KPX Abreve u -30
+KPX Abreve uacute -30
+KPX Abreve ucircumflex -30
+KPX Abreve udieresis -30
+KPX Abreve ugrave -30
+KPX Abreve uhungarumlaut -30
+KPX Abreve umacron -30
+KPX Abreve uogonek -30
+KPX Abreve uring -30
+KPX Abreve v -74
+KPX Abreve w -74
+KPX Abreve y -74
+KPX Abreve yacute -74
+KPX Abreve ydieresis -74
+KPX Acircumflex C -65
+KPX Acircumflex Cacute -65
+KPX Acircumflex Ccaron -65
+KPX Acircumflex Ccedilla -65
+KPX Acircumflex G -60
+KPX Acircumflex Gbreve -60
+KPX Acircumflex Gcommaaccent -60
+KPX Acircumflex O -50
+KPX Acircumflex Oacute -50
+KPX Acircumflex Ocircumflex -50
+KPX Acircumflex Odieresis -50
+KPX Acircumflex Ograve -50
+KPX Acircumflex Ohungarumlaut -50
+KPX Acircumflex Omacron -50
+KPX Acircumflex Oslash -50
+KPX Acircumflex Otilde -50
+KPX Acircumflex Q -55
+KPX Acircumflex T -55
+KPX Acircumflex Tcaron -55
+KPX Acircumflex Tcommaaccent -55
+KPX Acircumflex U -50
+KPX Acircumflex Uacute -50
+KPX Acircumflex Ucircumflex -50
+KPX Acircumflex Udieresis -50
+KPX Acircumflex Ugrave -50
+KPX Acircumflex Uhungarumlaut -50
+KPX Acircumflex Umacron -50
+KPX Acircumflex Uogonek -50
+KPX Acircumflex Uring -50
+KPX Acircumflex V -95
+KPX Acircumflex W -100
+KPX Acircumflex Y -70
+KPX Acircumflex Yacute -70
+KPX Acircumflex Ydieresis -70
+KPX Acircumflex quoteright -74
+KPX Acircumflex u -30
+KPX Acircumflex uacute -30
+KPX Acircumflex ucircumflex -30
+KPX Acircumflex udieresis -30
+KPX Acircumflex ugrave -30
+KPX Acircumflex uhungarumlaut -30
+KPX Acircumflex umacron -30
+KPX Acircumflex uogonek -30
+KPX Acircumflex uring -30
+KPX Acircumflex v -74
+KPX Acircumflex w -74
+KPX Acircumflex y -74
+KPX Acircumflex yacute -74
+KPX Acircumflex ydieresis -74
+KPX Adieresis C -65
+KPX Adieresis Cacute -65
+KPX Adieresis Ccaron -65
+KPX Adieresis Ccedilla -65
+KPX Adieresis G -60
+KPX Adieresis Gbreve -60
+KPX Adieresis Gcommaaccent -60
+KPX Adieresis O -50
+KPX Adieresis Oacute -50
+KPX Adieresis Ocircumflex -50
+KPX Adieresis Odieresis -50
+KPX Adieresis Ograve -50
+KPX Adieresis Ohungarumlaut -50
+KPX Adieresis Omacron -50
+KPX Adieresis Oslash -50
+KPX Adieresis Otilde -50
+KPX Adieresis Q -55
+KPX Adieresis T -55
+KPX Adieresis Tcaron -55
+KPX Adieresis Tcommaaccent -55
+KPX Adieresis U -50
+KPX Adieresis Uacute -50
+KPX Adieresis Ucircumflex -50
+KPX Adieresis Udieresis -50
+KPX Adieresis Ugrave -50
+KPX Adieresis Uhungarumlaut -50
+KPX Adieresis Umacron -50
+KPX Adieresis Uogonek -50
+KPX Adieresis Uring -50
+KPX Adieresis V -95
+KPX Adieresis W -100
+KPX Adieresis Y -70
+KPX Adieresis Yacute -70
+KPX Adieresis Ydieresis -70
+KPX Adieresis quoteright -74
+KPX Adieresis u -30
+KPX Adieresis uacute -30
+KPX Adieresis ucircumflex -30
+KPX Adieresis udieresis -30
+KPX Adieresis ugrave -30
+KPX Adieresis uhungarumlaut -30
+KPX Adieresis umacron -30
+KPX Adieresis uogonek -30
+KPX Adieresis uring -30
+KPX Adieresis v -74
+KPX Adieresis w -74
+KPX Adieresis y -74
+KPX Adieresis yacute -74
+KPX Adieresis ydieresis -74
+KPX Agrave C -65
+KPX Agrave Cacute -65
+KPX Agrave Ccaron -65
+KPX Agrave Ccedilla -65
+KPX Agrave G -60
+KPX Agrave Gbreve -60
+KPX Agrave Gcommaaccent -60
+KPX Agrave O -50
+KPX Agrave Oacute -50
+KPX Agrave Ocircumflex -50
+KPX Agrave Odieresis -50
+KPX Agrave Ograve -50
+KPX Agrave Ohungarumlaut -50
+KPX Agrave Omacron -50
+KPX Agrave Oslash -50
+KPX Agrave Otilde -50
+KPX Agrave Q -55
+KPX Agrave T -55
+KPX Agrave Tcaron -55
+KPX Agrave Tcommaaccent -55
+KPX Agrave U -50
+KPX Agrave Uacute -50
+KPX Agrave Ucircumflex -50
+KPX Agrave Udieresis -50
+KPX Agrave Ugrave -50
+KPX Agrave Uhungarumlaut -50
+KPX Agrave Umacron -50
+KPX Agrave Uogonek -50
+KPX Agrave Uring -50
+KPX Agrave V -95
+KPX Agrave W -100
+KPX Agrave Y -70
+KPX Agrave Yacute -70
+KPX Agrave Ydieresis -70
+KPX Agrave quoteright -74
+KPX Agrave u -30
+KPX Agrave uacute -30
+KPX Agrave ucircumflex -30
+KPX Agrave udieresis -30
+KPX Agrave ugrave -30
+KPX Agrave uhungarumlaut -30
+KPX Agrave umacron -30
+KPX Agrave uogonek -30
+KPX Agrave uring -30
+KPX Agrave v -74
+KPX Agrave w -74
+KPX Agrave y -74
+KPX Agrave yacute -74
+KPX Agrave ydieresis -74
+KPX Amacron C -65
+KPX Amacron Cacute -65
+KPX Amacron Ccaron -65
+KPX Amacron Ccedilla -65
+KPX Amacron G -60
+KPX Amacron Gbreve -60
+KPX Amacron Gcommaaccent -60
+KPX Amacron O -50
+KPX Amacron Oacute -50
+KPX Amacron Ocircumflex -50
+KPX Amacron Odieresis -50
+KPX Amacron Ograve -50
+KPX Amacron Ohungarumlaut -50
+KPX Amacron Omacron -50
+KPX Amacron Oslash -50
+KPX Amacron Otilde -50
+KPX Amacron Q -55
+KPX Amacron T -55
+KPX Amacron Tcaron -55
+KPX Amacron Tcommaaccent -55
+KPX Amacron U -50
+KPX Amacron Uacute -50
+KPX Amacron Ucircumflex -50
+KPX Amacron Udieresis -50
+KPX Amacron Ugrave -50
+KPX Amacron Uhungarumlaut -50
+KPX Amacron Umacron -50
+KPX Amacron Uogonek -50
+KPX Amacron Uring -50
+KPX Amacron V -95
+KPX Amacron W -100
+KPX Amacron Y -70
+KPX Amacron Yacute -70
+KPX Amacron Ydieresis -70
+KPX Amacron quoteright -74
+KPX Amacron u -30
+KPX Amacron uacute -30
+KPX Amacron ucircumflex -30
+KPX Amacron udieresis -30
+KPX Amacron ugrave -30
+KPX Amacron uhungarumlaut -30
+KPX Amacron umacron -30
+KPX Amacron uogonek -30
+KPX Amacron uring -30
+KPX Amacron v -74
+KPX Amacron w -74
+KPX Amacron y -74
+KPX Amacron yacute -74
+KPX Amacron ydieresis -74
+KPX Aogonek C -65
+KPX Aogonek Cacute -65
+KPX Aogonek Ccaron -65
+KPX Aogonek Ccedilla -65
+KPX Aogonek G -60
+KPX Aogonek Gbreve -60
+KPX Aogonek Gcommaaccent -60
+KPX Aogonek O -50
+KPX Aogonek Oacute -50
+KPX Aogonek Ocircumflex -50
+KPX Aogonek Odieresis -50
+KPX Aogonek Ograve -50
+KPX Aogonek Ohungarumlaut -50
+KPX Aogonek Omacron -50
+KPX Aogonek Oslash -50
+KPX Aogonek Otilde -50
+KPX Aogonek Q -55
+KPX Aogonek T -55
+KPX Aogonek Tcaron -55
+KPX Aogonek Tcommaaccent -55
+KPX Aogonek U -50
+KPX Aogonek Uacute -50
+KPX Aogonek Ucircumflex -50
+KPX Aogonek Udieresis -50
+KPX Aogonek Ugrave -50
+KPX Aogonek Uhungarumlaut -50
+KPX Aogonek Umacron -50
+KPX Aogonek Uogonek -50
+KPX Aogonek Uring -50
+KPX Aogonek V -95
+KPX Aogonek W -100
+KPX Aogonek Y -70
+KPX Aogonek Yacute -70
+KPX Aogonek Ydieresis -70
+KPX Aogonek quoteright -74
+KPX Aogonek u -30
+KPX Aogonek uacute -30
+KPX Aogonek ucircumflex -30
+KPX Aogonek udieresis -30
+KPX Aogonek ugrave -30
+KPX Aogonek uhungarumlaut -30
+KPX Aogonek umacron -30
+KPX Aogonek uogonek -30
+KPX Aogonek uring -30
+KPX Aogonek v -74
+KPX Aogonek w -74
+KPX Aogonek y -34
+KPX Aogonek yacute -34
+KPX Aogonek ydieresis -34
+KPX Aring C -65
+KPX Aring Cacute -65
+KPX Aring Ccaron -65
+KPX Aring Ccedilla -65
+KPX Aring G -60
+KPX Aring Gbreve -60
+KPX Aring Gcommaaccent -60
+KPX Aring O -50
+KPX Aring Oacute -50
+KPX Aring Ocircumflex -50
+KPX Aring Odieresis -50
+KPX Aring Ograve -50
+KPX Aring Ohungarumlaut -50
+KPX Aring Omacron -50
+KPX Aring Oslash -50
+KPX Aring Otilde -50
+KPX Aring Q -55
+KPX Aring T -55
+KPX Aring Tcaron -55
+KPX Aring Tcommaaccent -55
+KPX Aring U -50
+KPX Aring Uacute -50
+KPX Aring Ucircumflex -50
+KPX Aring Udieresis -50
+KPX Aring Ugrave -50
+KPX Aring Uhungarumlaut -50
+KPX Aring Umacron -50
+KPX Aring Uogonek -50
+KPX Aring Uring -50
+KPX Aring V -95
+KPX Aring W -100
+KPX Aring Y -70
+KPX Aring Yacute -70
+KPX Aring Ydieresis -70
+KPX Aring quoteright -74
+KPX Aring u -30
+KPX Aring uacute -30
+KPX Aring ucircumflex -30
+KPX Aring udieresis -30
+KPX Aring ugrave -30
+KPX Aring uhungarumlaut -30
+KPX Aring umacron -30
+KPX Aring uogonek -30
+KPX Aring uring -30
+KPX Aring v -74
+KPX Aring w -74
+KPX Aring y -74
+KPX Aring yacute -74
+KPX Aring ydieresis -74
+KPX Atilde C -65
+KPX Atilde Cacute -65
+KPX Atilde Ccaron -65
+KPX Atilde Ccedilla -65
+KPX Atilde G -60
+KPX Atilde Gbreve -60
+KPX Atilde Gcommaaccent -60
+KPX Atilde O -50
+KPX Atilde Oacute -50
+KPX Atilde Ocircumflex -50
+KPX Atilde Odieresis -50
+KPX Atilde Ograve -50
+KPX Atilde Ohungarumlaut -50
+KPX Atilde Omacron -50
+KPX Atilde Oslash -50
+KPX Atilde Otilde -50
+KPX Atilde Q -55
+KPX Atilde T -55
+KPX Atilde Tcaron -55
+KPX Atilde Tcommaaccent -55
+KPX Atilde U -50
+KPX Atilde Uacute -50
+KPX Atilde Ucircumflex -50
+KPX Atilde Udieresis -50
+KPX Atilde Ugrave -50
+KPX Atilde Uhungarumlaut -50
+KPX Atilde Umacron -50
+KPX Atilde Uogonek -50
+KPX Atilde Uring -50
+KPX Atilde V -95
+KPX Atilde W -100
+KPX Atilde Y -70
+KPX Atilde Yacute -70
+KPX Atilde Ydieresis -70
+KPX Atilde quoteright -74
+KPX Atilde u -30
+KPX Atilde uacute -30
+KPX Atilde ucircumflex -30
+KPX Atilde udieresis -30
+KPX Atilde ugrave -30
+KPX Atilde uhungarumlaut -30
+KPX Atilde umacron -30
+KPX Atilde uogonek -30
+KPX Atilde uring -30
+KPX Atilde v -74
+KPX Atilde w -74
+KPX Atilde y -74
+KPX Atilde yacute -74
+KPX Atilde ydieresis -74
+KPX B A -25
+KPX B Aacute -25
+KPX B Abreve -25
+KPX B Acircumflex -25
+KPX B Adieresis -25
+KPX B Agrave -25
+KPX B Amacron -25
+KPX B Aogonek -25
+KPX B Aring -25
+KPX B Atilde -25
+KPX B U -10
+KPX B Uacute -10
+KPX B Ucircumflex -10
+KPX B Udieresis -10
+KPX B Ugrave -10
+KPX B Uhungarumlaut -10
+KPX B Umacron -10
+KPX B Uogonek -10
+KPX B Uring -10
+KPX D A -25
+KPX D Aacute -25
+KPX D Abreve -25
+KPX D Acircumflex -25
+KPX D Adieresis -25
+KPX D Agrave -25
+KPX D Amacron -25
+KPX D Aogonek -25
+KPX D Aring -25
+KPX D Atilde -25
+KPX D V -50
+KPX D W -40
+KPX D Y -50
+KPX D Yacute -50
+KPX D Ydieresis -50
+KPX Dcaron A -25
+KPX Dcaron Aacute -25
+KPX Dcaron Abreve -25
+KPX Dcaron Acircumflex -25
+KPX Dcaron Adieresis -25
+KPX Dcaron Agrave -25
+KPX Dcaron Amacron -25
+KPX Dcaron Aogonek -25
+KPX Dcaron Aring -25
+KPX Dcaron Atilde -25
+KPX Dcaron V -50
+KPX Dcaron W -40
+KPX Dcaron Y -50
+KPX Dcaron Yacute -50
+KPX Dcaron Ydieresis -50
+KPX Dcroat A -25
+KPX Dcroat Aacute -25
+KPX Dcroat Abreve -25
+KPX Dcroat Acircumflex -25
+KPX Dcroat Adieresis -25
+KPX Dcroat Agrave -25
+KPX Dcroat Amacron -25
+KPX Dcroat Aogonek -25
+KPX Dcroat Aring -25
+KPX Dcroat Atilde -25
+KPX Dcroat V -50
+KPX Dcroat W -40
+KPX Dcroat Y -50
+KPX Dcroat Yacute -50
+KPX Dcroat Ydieresis -50
+KPX F A -100
+KPX F Aacute -100
+KPX F Abreve -100
+KPX F Acircumflex -100
+KPX F Adieresis -100
+KPX F Agrave -100
+KPX F Amacron -100
+KPX F Aogonek -100
+KPX F Aring -100
+KPX F Atilde -100
+KPX F a -95
+KPX F aacute -95
+KPX F abreve -95
+KPX F acircumflex -95
+KPX F adieresis -95
+KPX F agrave -95
+KPX F amacron -95
+KPX F aogonek -95
+KPX F aring -95
+KPX F atilde -95
+KPX F comma -129
+KPX F e -100
+KPX F eacute -100
+KPX F ecaron -100
+KPX F ecircumflex -100
+KPX F edieresis -100
+KPX F edotaccent -100
+KPX F egrave -100
+KPX F emacron -100
+KPX F eogonek -100
+KPX F i -40
+KPX F iacute -40
+KPX F icircumflex -40
+KPX F idieresis -40
+KPX F igrave -40
+KPX F imacron -40
+KPX F iogonek -40
+KPX F o -70
+KPX F oacute -70
+KPX F ocircumflex -70
+KPX F odieresis -70
+KPX F ograve -70
+KPX F ohungarumlaut -70
+KPX F omacron -70
+KPX F oslash -70
+KPX F otilde -70
+KPX F period -129
+KPX F r -50
+KPX F racute -50
+KPX F rcaron -50
+KPX F rcommaaccent -50
+KPX J A -25
+KPX J Aacute -25
+KPX J Abreve -25
+KPX J Acircumflex -25
+KPX J Adieresis -25
+KPX J Agrave -25
+KPX J Amacron -25
+KPX J Aogonek -25
+KPX J Aring -25
+KPX J Atilde -25
+KPX J a -40
+KPX J aacute -40
+KPX J abreve -40
+KPX J acircumflex -40
+KPX J adieresis -40
+KPX J agrave -40
+KPX J amacron -40
+KPX J aogonek -40
+KPX J aring -40
+KPX J atilde -40
+KPX J comma -10
+KPX J e -40
+KPX J eacute -40
+KPX J ecaron -40
+KPX J ecircumflex -40
+KPX J edieresis -40
+KPX J edotaccent -40
+KPX J egrave -40
+KPX J emacron -40
+KPX J eogonek -40
+KPX J o -40
+KPX J oacute -40
+KPX J ocircumflex -40
+KPX J odieresis -40
+KPX J ograve -40
+KPX J ohungarumlaut -40
+KPX J omacron -40
+KPX J oslash -40
+KPX J otilde -40
+KPX J period -10
+KPX J u -40
+KPX J uacute -40
+KPX J ucircumflex -40
+KPX J udieresis -40
+KPX J ugrave -40
+KPX J uhungarumlaut -40
+KPX J umacron -40
+KPX J uogonek -40
+KPX J uring -40
+KPX K O -30
+KPX K Oacute -30
+KPX K Ocircumflex -30
+KPX K Odieresis -30
+KPX K Ograve -30
+KPX K Ohungarumlaut -30
+KPX K Omacron -30
+KPX K Oslash -30
+KPX K Otilde -30
+KPX K e -25
+KPX K eacute -25
+KPX K ecaron -25
+KPX K ecircumflex -25
+KPX K edieresis -25
+KPX K edotaccent -25
+KPX K egrave -25
+KPX K emacron -25
+KPX K eogonek -25
+KPX K o -25
+KPX K oacute -25
+KPX K ocircumflex -25
+KPX K odieresis -25
+KPX K ograve -25
+KPX K ohungarumlaut -25
+KPX K omacron -25
+KPX K oslash -25
+KPX K otilde -25
+KPX K u -20
+KPX K uacute -20
+KPX K ucircumflex -20
+KPX K udieresis -20
+KPX K ugrave -20
+KPX K uhungarumlaut -20
+KPX K umacron -20
+KPX K uogonek -20
+KPX K uring -20
+KPX K y -20
+KPX K yacute -20
+KPX K ydieresis -20
+KPX Kcommaaccent O -30
+KPX Kcommaaccent Oacute -30
+KPX Kcommaaccent Ocircumflex -30
+KPX Kcommaaccent Odieresis -30
+KPX Kcommaaccent Ograve -30
+KPX Kcommaaccent Ohungarumlaut -30
+KPX Kcommaaccent Omacron -30
+KPX Kcommaaccent Oslash -30
+KPX Kcommaaccent Otilde -30
+KPX Kcommaaccent e -25
+KPX Kcommaaccent eacute -25
+KPX Kcommaaccent ecaron -25
+KPX Kcommaaccent ecircumflex -25
+KPX Kcommaaccent edieresis -25
+KPX Kcommaaccent edotaccent -25
+KPX Kcommaaccent egrave -25
+KPX Kcommaaccent emacron -25
+KPX Kcommaaccent eogonek -25
+KPX Kcommaaccent o -25
+KPX Kcommaaccent oacute -25
+KPX Kcommaaccent ocircumflex -25
+KPX Kcommaaccent odieresis -25
+KPX Kcommaaccent ograve -25
+KPX Kcommaaccent ohungarumlaut -25
+KPX Kcommaaccent omacron -25
+KPX Kcommaaccent oslash -25
+KPX Kcommaaccent otilde -25
+KPX Kcommaaccent u -20
+KPX Kcommaaccent uacute -20
+KPX Kcommaaccent ucircumflex -20
+KPX Kcommaaccent udieresis -20
+KPX Kcommaaccent ugrave -20
+KPX Kcommaaccent uhungarumlaut -20
+KPX Kcommaaccent umacron -20
+KPX Kcommaaccent uogonek -20
+KPX Kcommaaccent uring -20
+KPX Kcommaaccent y -20
+KPX Kcommaaccent yacute -20
+KPX Kcommaaccent ydieresis -20
+KPX L T -18
+KPX L Tcaron -18
+KPX L Tcommaaccent -18
+KPX L V -37
+KPX L W -37
+KPX L Y -37
+KPX L Yacute -37
+KPX L Ydieresis -37
+KPX L quoteright -55
+KPX L y -37
+KPX L yacute -37
+KPX L ydieresis -37
+KPX Lacute T -18
+KPX Lacute Tcaron -18
+KPX Lacute Tcommaaccent -18
+KPX Lacute V -37
+KPX Lacute W -37
+KPX Lacute Y -37
+KPX Lacute Yacute -37
+KPX Lacute Ydieresis -37
+KPX Lacute quoteright -55
+KPX Lacute y -37
+KPX Lacute yacute -37
+KPX Lacute ydieresis -37
+KPX Lcommaaccent T -18
+KPX Lcommaaccent Tcaron -18
+KPX Lcommaaccent Tcommaaccent -18
+KPX Lcommaaccent V -37
+KPX Lcommaaccent W -37
+KPX Lcommaaccent Y -37
+KPX Lcommaaccent Yacute -37
+KPX Lcommaaccent Ydieresis -37
+KPX Lcommaaccent quoteright -55
+KPX Lcommaaccent y -37
+KPX Lcommaaccent yacute -37
+KPX Lcommaaccent ydieresis -37
+KPX Lslash T -18
+KPX Lslash Tcaron -18
+KPX Lslash Tcommaaccent -18
+KPX Lslash V -37
+KPX Lslash W -37
+KPX Lslash Y -37
+KPX Lslash Yacute -37
+KPX Lslash Ydieresis -37
+KPX Lslash quoteright -55
+KPX Lslash y -37
+KPX Lslash yacute -37
+KPX Lslash ydieresis -37
+KPX N A -30
+KPX N Aacute -30
+KPX N Abreve -30
+KPX N Acircumflex -30
+KPX N Adieresis -30
+KPX N Agrave -30
+KPX N Amacron -30
+KPX N Aogonek -30
+KPX N Aring -30
+KPX N Atilde -30
+KPX Nacute A -30
+KPX Nacute Aacute -30
+KPX Nacute Abreve -30
+KPX Nacute Acircumflex -30
+KPX Nacute Adieresis -30
+KPX Nacute Agrave -30
+KPX Nacute Amacron -30
+KPX Nacute Aogonek -30
+KPX Nacute Aring -30
+KPX Nacute Atilde -30
+KPX Ncaron A -30
+KPX Ncaron Aacute -30
+KPX Ncaron Abreve -30
+KPX Ncaron Acircumflex -30
+KPX Ncaron Adieresis -30
+KPX Ncaron Agrave -30
+KPX Ncaron Amacron -30
+KPX Ncaron Aogonek -30
+KPX Ncaron Aring -30
+KPX Ncaron Atilde -30
+KPX Ncommaaccent A -30
+KPX Ncommaaccent Aacute -30
+KPX Ncommaaccent Abreve -30
+KPX Ncommaaccent Acircumflex -30
+KPX Ncommaaccent Adieresis -30
+KPX Ncommaaccent Agrave -30
+KPX Ncommaaccent Amacron -30
+KPX Ncommaaccent Aogonek -30
+KPX Ncommaaccent Aring -30
+KPX Ncommaaccent Atilde -30
+KPX Ntilde A -30
+KPX Ntilde Aacute -30
+KPX Ntilde Abreve -30
+KPX Ntilde Acircumflex -30
+KPX Ntilde Adieresis -30
+KPX Ntilde Agrave -30
+KPX Ntilde Amacron -30
+KPX Ntilde Aogonek -30
+KPX Ntilde Aring -30
+KPX Ntilde Atilde -30
+KPX O A -40
+KPX O Aacute -40
+KPX O Abreve -40
+KPX O Acircumflex -40
+KPX O Adieresis -40
+KPX O Agrave -40
+KPX O Amacron -40
+KPX O Aogonek -40
+KPX O Aring -40
+KPX O Atilde -40
+KPX O T -40
+KPX O Tcaron -40
+KPX O Tcommaaccent -40
+KPX O V -50
+KPX O W -50
+KPX O X -40
+KPX O Y -50
+KPX O Yacute -50
+KPX O Ydieresis -50
+KPX Oacute A -40
+KPX Oacute Aacute -40
+KPX Oacute Abreve -40
+KPX Oacute Acircumflex -40
+KPX Oacute Adieresis -40
+KPX Oacute Agrave -40
+KPX Oacute Amacron -40
+KPX Oacute Aogonek -40
+KPX Oacute Aring -40
+KPX Oacute Atilde -40
+KPX Oacute T -40
+KPX Oacute Tcaron -40
+KPX Oacute Tcommaaccent -40
+KPX Oacute V -50
+KPX Oacute W -50
+KPX Oacute X -40
+KPX Oacute Y -50
+KPX Oacute Yacute -50
+KPX Oacute Ydieresis -50
+KPX Ocircumflex A -40
+KPX Ocircumflex Aacute -40
+KPX Ocircumflex Abreve -40
+KPX Ocircumflex Acircumflex -40
+KPX Ocircumflex Adieresis -40
+KPX Ocircumflex Agrave -40
+KPX Ocircumflex Amacron -40
+KPX Ocircumflex Aogonek -40
+KPX Ocircumflex Aring -40
+KPX Ocircumflex Atilde -40
+KPX Ocircumflex T -40
+KPX Ocircumflex Tcaron -40
+KPX Ocircumflex Tcommaaccent -40
+KPX Ocircumflex V -50
+KPX Ocircumflex W -50
+KPX Ocircumflex X -40
+KPX Ocircumflex Y -50
+KPX Ocircumflex Yacute -50
+KPX Ocircumflex Ydieresis -50
+KPX Odieresis A -40
+KPX Odieresis Aacute -40
+KPX Odieresis Abreve -40
+KPX Odieresis Acircumflex -40
+KPX Odieresis Adieresis -40
+KPX Odieresis Agrave -40
+KPX Odieresis Amacron -40
+KPX Odieresis Aogonek -40
+KPX Odieresis Aring -40
+KPX Odieresis Atilde -40
+KPX Odieresis T -40
+KPX Odieresis Tcaron -40
+KPX Odieresis Tcommaaccent -40
+KPX Odieresis V -50
+KPX Odieresis W -50
+KPX Odieresis X -40
+KPX Odieresis Y -50
+KPX Odieresis Yacute -50
+KPX Odieresis Ydieresis -50
+KPX Ograve A -40
+KPX Ograve Aacute -40
+KPX Ograve Abreve -40
+KPX Ograve Acircumflex -40
+KPX Ograve Adieresis -40
+KPX Ograve Agrave -40
+KPX Ograve Amacron -40
+KPX Ograve Aogonek -40
+KPX Ograve Aring -40
+KPX Ograve Atilde -40
+KPX Ograve T -40
+KPX Ograve Tcaron -40
+KPX Ograve Tcommaaccent -40
+KPX Ograve V -50
+KPX Ograve W -50
+KPX Ograve X -40
+KPX Ograve Y -50
+KPX Ograve Yacute -50
+KPX Ograve Ydieresis -50
+KPX Ohungarumlaut A -40
+KPX Ohungarumlaut Aacute -40
+KPX Ohungarumlaut Abreve -40
+KPX Ohungarumlaut Acircumflex -40
+KPX Ohungarumlaut Adieresis -40
+KPX Ohungarumlaut Agrave -40
+KPX Ohungarumlaut Amacron -40
+KPX Ohungarumlaut Aogonek -40
+KPX Ohungarumlaut Aring -40
+KPX Ohungarumlaut Atilde -40
+KPX Ohungarumlaut T -40
+KPX Ohungarumlaut Tcaron -40
+KPX Ohungarumlaut Tcommaaccent -40
+KPX Ohungarumlaut V -50
+KPX Ohungarumlaut W -50
+KPX Ohungarumlaut X -40
+KPX Ohungarumlaut Y -50
+KPX Ohungarumlaut Yacute -50
+KPX Ohungarumlaut Ydieresis -50
+KPX Omacron A -40
+KPX Omacron Aacute -40
+KPX Omacron Abreve -40
+KPX Omacron Acircumflex -40
+KPX Omacron Adieresis -40
+KPX Omacron Agrave -40
+KPX Omacron Amacron -40
+KPX Omacron Aogonek -40
+KPX Omacron Aring -40
+KPX Omacron Atilde -40
+KPX Omacron T -40
+KPX Omacron Tcaron -40
+KPX Omacron Tcommaaccent -40
+KPX Omacron V -50
+KPX Omacron W -50
+KPX Omacron X -40
+KPX Omacron Y -50
+KPX Omacron Yacute -50
+KPX Omacron Ydieresis -50
+KPX Oslash A -40
+KPX Oslash Aacute -40
+KPX Oslash Abreve -40
+KPX Oslash Acircumflex -40
+KPX Oslash Adieresis -40
+KPX Oslash Agrave -40
+KPX Oslash Amacron -40
+KPX Oslash Aogonek -40
+KPX Oslash Aring -40
+KPX Oslash Atilde -40
+KPX Oslash T -40
+KPX Oslash Tcaron -40
+KPX Oslash Tcommaaccent -40
+KPX Oslash V -50
+KPX Oslash W -50
+KPX Oslash X -40
+KPX Oslash Y -50
+KPX Oslash Yacute -50
+KPX Oslash Ydieresis -50
+KPX Otilde A -40
+KPX Otilde Aacute -40
+KPX Otilde Abreve -40
+KPX Otilde Acircumflex -40
+KPX Otilde Adieresis -40
+KPX Otilde Agrave -40
+KPX Otilde Amacron -40
+KPX Otilde Aogonek -40
+KPX Otilde Aring -40
+KPX Otilde Atilde -40
+KPX Otilde T -40
+KPX Otilde Tcaron -40
+KPX Otilde Tcommaaccent -40
+KPX Otilde V -50
+KPX Otilde W -50
+KPX Otilde X -40
+KPX Otilde Y -50
+KPX Otilde Yacute -50
+KPX Otilde Ydieresis -50
+KPX P A -85
+KPX P Aacute -85
+KPX P Abreve -85
+KPX P Acircumflex -85
+KPX P Adieresis -85
+KPX P Agrave -85
+KPX P Amacron -85
+KPX P Aogonek -85
+KPX P Aring -85
+KPX P Atilde -85
+KPX P a -40
+KPX P aacute -40
+KPX P abreve -40
+KPX P acircumflex -40
+KPX P adieresis -40
+KPX P agrave -40
+KPX P amacron -40
+KPX P aogonek -40
+KPX P aring -40
+KPX P atilde -40
+KPX P comma -129
+KPX P e -50
+KPX P eacute -50
+KPX P ecaron -50
+KPX P ecircumflex -50
+KPX P edieresis -50
+KPX P edotaccent -50
+KPX P egrave -50
+KPX P emacron -50
+KPX P eogonek -50
+KPX P o -55
+KPX P oacute -55
+KPX P ocircumflex -55
+KPX P odieresis -55
+KPX P ograve -55
+KPX P ohungarumlaut -55
+KPX P omacron -55
+KPX P oslash -55
+KPX P otilde -55
+KPX P period -129
+KPX Q U -10
+KPX Q Uacute -10
+KPX Q Ucircumflex -10
+KPX Q Udieresis -10
+KPX Q Ugrave -10
+KPX Q Uhungarumlaut -10
+KPX Q Umacron -10
+KPX Q Uogonek -10
+KPX Q Uring -10
+KPX R O -40
+KPX R Oacute -40
+KPX R Ocircumflex -40
+KPX R Odieresis -40
+KPX R Ograve -40
+KPX R Ohungarumlaut -40
+KPX R Omacron -40
+KPX R Oslash -40
+KPX R Otilde -40
+KPX R T -30
+KPX R Tcaron -30
+KPX R Tcommaaccent -30
+KPX R U -40
+KPX R Uacute -40
+KPX R Ucircumflex -40
+KPX R Udieresis -40
+KPX R Ugrave -40
+KPX R Uhungarumlaut -40
+KPX R Umacron -40
+KPX R Uogonek -40
+KPX R Uring -40
+KPX R V -18
+KPX R W -18
+KPX R Y -18
+KPX R Yacute -18
+KPX R Ydieresis -18
+KPX Racute O -40
+KPX Racute Oacute -40
+KPX Racute Ocircumflex -40
+KPX Racute Odieresis -40
+KPX Racute Ograve -40
+KPX Racute Ohungarumlaut -40
+KPX Racute Omacron -40
+KPX Racute Oslash -40
+KPX Racute Otilde -40
+KPX Racute T -30
+KPX Racute Tcaron -30
+KPX Racute Tcommaaccent -30
+KPX Racute U -40
+KPX Racute Uacute -40
+KPX Racute Ucircumflex -40
+KPX Racute Udieresis -40
+KPX Racute Ugrave -40
+KPX Racute Uhungarumlaut -40
+KPX Racute Umacron -40
+KPX Racute Uogonek -40
+KPX Racute Uring -40
+KPX Racute V -18
+KPX Racute W -18
+KPX Racute Y -18
+KPX Racute Yacute -18
+KPX Racute Ydieresis -18
+KPX Rcaron O -40
+KPX Rcaron Oacute -40
+KPX Rcaron Ocircumflex -40
+KPX Rcaron Odieresis -40
+KPX Rcaron Ograve -40
+KPX Rcaron Ohungarumlaut -40
+KPX Rcaron Omacron -40
+KPX Rcaron Oslash -40
+KPX Rcaron Otilde -40
+KPX Rcaron T -30
+KPX Rcaron Tcaron -30
+KPX Rcaron Tcommaaccent -30
+KPX Rcaron U -40
+KPX Rcaron Uacute -40
+KPX Rcaron Ucircumflex -40
+KPX Rcaron Udieresis -40
+KPX Rcaron Ugrave -40
+KPX Rcaron Uhungarumlaut -40
+KPX Rcaron Umacron -40
+KPX Rcaron Uogonek -40
+KPX Rcaron Uring -40
+KPX Rcaron V -18
+KPX Rcaron W -18
+KPX Rcaron Y -18
+KPX Rcaron Yacute -18
+KPX Rcaron Ydieresis -18
+KPX Rcommaaccent O -40
+KPX Rcommaaccent Oacute -40
+KPX Rcommaaccent Ocircumflex -40
+KPX Rcommaaccent Odieresis -40
+KPX Rcommaaccent Ograve -40
+KPX Rcommaaccent Ohungarumlaut -40
+KPX Rcommaaccent Omacron -40
+KPX Rcommaaccent Oslash -40
+KPX Rcommaaccent Otilde -40
+KPX Rcommaaccent T -30
+KPX Rcommaaccent Tcaron -30
+KPX Rcommaaccent Tcommaaccent -30
+KPX Rcommaaccent U -40
+KPX Rcommaaccent Uacute -40
+KPX Rcommaaccent Ucircumflex -40
+KPX Rcommaaccent Udieresis -40
+KPX Rcommaaccent Ugrave -40
+KPX Rcommaaccent Uhungarumlaut -40
+KPX Rcommaaccent Umacron -40
+KPX Rcommaaccent Uogonek -40
+KPX Rcommaaccent Uring -40
+KPX Rcommaaccent V -18
+KPX Rcommaaccent W -18
+KPX Rcommaaccent Y -18
+KPX Rcommaaccent Yacute -18
+KPX Rcommaaccent Ydieresis -18
+KPX T A -55
+KPX T Aacute -55
+KPX T Abreve -55
+KPX T Acircumflex -55
+KPX T Adieresis -55
+KPX T Agrave -55
+KPX T Amacron -55
+KPX T Aogonek -55
+KPX T Aring -55
+KPX T Atilde -55
+KPX T O -18
+KPX T Oacute -18
+KPX T Ocircumflex -18
+KPX T Odieresis -18
+KPX T Ograve -18
+KPX T Ohungarumlaut -18
+KPX T Omacron -18
+KPX T Oslash -18
+KPX T Otilde -18
+KPX T a -92
+KPX T aacute -92
+KPX T abreve -92
+KPX T acircumflex -92
+KPX T adieresis -92
+KPX T agrave -92
+KPX T amacron -92
+KPX T aogonek -92
+KPX T aring -92
+KPX T atilde -92
+KPX T colon -74
+KPX T comma -92
+KPX T e -92
+KPX T eacute -92
+KPX T ecaron -92
+KPX T ecircumflex -92
+KPX T edieresis -52
+KPX T edotaccent -92
+KPX T egrave -52
+KPX T emacron -52
+KPX T eogonek -92
+KPX T hyphen -92
+KPX T i -37
+KPX T iacute -37
+KPX T iogonek -37
+KPX T o -95
+KPX T oacute -95
+KPX T ocircumflex -95
+KPX T odieresis -95
+KPX T ograve -95
+KPX T ohungarumlaut -95
+KPX T omacron -95
+KPX T oslash -95
+KPX T otilde -95
+KPX T period -92
+KPX T r -37
+KPX T racute -37
+KPX T rcaron -37
+KPX T rcommaaccent -37
+KPX T semicolon -74
+KPX T u -37
+KPX T uacute -37
+KPX T ucircumflex -37
+KPX T udieresis -37
+KPX T ugrave -37
+KPX T uhungarumlaut -37
+KPX T umacron -37
+KPX T uogonek -37
+KPX T uring -37
+KPX T w -37
+KPX T y -37
+KPX T yacute -37
+KPX T ydieresis -37
+KPX Tcaron A -55
+KPX Tcaron Aacute -55
+KPX Tcaron Abreve -55
+KPX Tcaron Acircumflex -55
+KPX Tcaron Adieresis -55
+KPX Tcaron Agrave -55
+KPX Tcaron Amacron -55
+KPX Tcaron Aogonek -55
+KPX Tcaron Aring -55
+KPX Tcaron Atilde -55
+KPX Tcaron O -18
+KPX Tcaron Oacute -18
+KPX Tcaron Ocircumflex -18
+KPX Tcaron Odieresis -18
+KPX Tcaron Ograve -18
+KPX Tcaron Ohungarumlaut -18
+KPX Tcaron Omacron -18
+KPX Tcaron Oslash -18
+KPX Tcaron Otilde -18
+KPX Tcaron a -92
+KPX Tcaron aacute -92
+KPX Tcaron abreve -92
+KPX Tcaron acircumflex -92
+KPX Tcaron adieresis -92
+KPX Tcaron agrave -92
+KPX Tcaron amacron -92
+KPX Tcaron aogonek -92
+KPX Tcaron aring -92
+KPX Tcaron atilde -92
+KPX Tcaron colon -74
+KPX Tcaron comma -92
+KPX Tcaron e -92
+KPX Tcaron eacute -92
+KPX Tcaron ecaron -92
+KPX Tcaron ecircumflex -92
+KPX Tcaron edieresis -52
+KPX Tcaron edotaccent -92
+KPX Tcaron egrave -52
+KPX Tcaron emacron -52
+KPX Tcaron eogonek -92
+KPX Tcaron hyphen -92
+KPX Tcaron i -37
+KPX Tcaron iacute -37
+KPX Tcaron iogonek -37
+KPX Tcaron o -95
+KPX Tcaron oacute -95
+KPX Tcaron ocircumflex -95
+KPX Tcaron odieresis -95
+KPX Tcaron ograve -95
+KPX Tcaron ohungarumlaut -95
+KPX Tcaron omacron -95
+KPX Tcaron oslash -95
+KPX Tcaron otilde -95
+KPX Tcaron period -92
+KPX Tcaron r -37
+KPX Tcaron racute -37
+KPX Tcaron rcaron -37
+KPX Tcaron rcommaaccent -37
+KPX Tcaron semicolon -74
+KPX Tcaron u -37
+KPX Tcaron uacute -37
+KPX Tcaron ucircumflex -37
+KPX Tcaron udieresis -37
+KPX Tcaron ugrave -37
+KPX Tcaron uhungarumlaut -37
+KPX Tcaron umacron -37
+KPX Tcaron uogonek -37
+KPX Tcaron uring -37
+KPX Tcaron w -37
+KPX Tcaron y -37
+KPX Tcaron yacute -37
+KPX Tcaron ydieresis -37
+KPX Tcommaaccent A -55
+KPX Tcommaaccent Aacute -55
+KPX Tcommaaccent Abreve -55
+KPX Tcommaaccent Acircumflex -55
+KPX Tcommaaccent Adieresis -55
+KPX Tcommaaccent Agrave -55
+KPX Tcommaaccent Amacron -55
+KPX Tcommaaccent Aogonek -55
+KPX Tcommaaccent Aring -55
+KPX Tcommaaccent Atilde -55
+KPX Tcommaaccent O -18
+KPX Tcommaaccent Oacute -18
+KPX Tcommaaccent Ocircumflex -18
+KPX Tcommaaccent Odieresis -18
+KPX Tcommaaccent Ograve -18
+KPX Tcommaaccent Ohungarumlaut -18
+KPX Tcommaaccent Omacron -18
+KPX Tcommaaccent Oslash -18
+KPX Tcommaaccent Otilde -18
+KPX Tcommaaccent a -92
+KPX Tcommaaccent aacute -92
+KPX Tcommaaccent abreve -92
+KPX Tcommaaccent acircumflex -92
+KPX Tcommaaccent adieresis -92
+KPX Tcommaaccent agrave -92
+KPX Tcommaaccent amacron -92
+KPX Tcommaaccent aogonek -92
+KPX Tcommaaccent aring -92
+KPX Tcommaaccent atilde -92
+KPX Tcommaaccent colon -74
+KPX Tcommaaccent comma -92
+KPX Tcommaaccent e -92
+KPX Tcommaaccent eacute -92
+KPX Tcommaaccent ecaron -92
+KPX Tcommaaccent ecircumflex -92
+KPX Tcommaaccent edieresis -52
+KPX Tcommaaccent edotaccent -92
+KPX Tcommaaccent egrave -52
+KPX Tcommaaccent emacron -52
+KPX Tcommaaccent eogonek -92
+KPX Tcommaaccent hyphen -92
+KPX Tcommaaccent i -37
+KPX Tcommaaccent iacute -37
+KPX Tcommaaccent iogonek -37
+KPX Tcommaaccent o -95
+KPX Tcommaaccent oacute -95
+KPX Tcommaaccent ocircumflex -95
+KPX Tcommaaccent odieresis -95
+KPX Tcommaaccent ograve -95
+KPX Tcommaaccent ohungarumlaut -95
+KPX Tcommaaccent omacron -95
+KPX Tcommaaccent oslash -95
+KPX Tcommaaccent otilde -95
+KPX Tcommaaccent period -92
+KPX Tcommaaccent r -37
+KPX Tcommaaccent racute -37
+KPX Tcommaaccent rcaron -37
+KPX Tcommaaccent rcommaaccent -37
+KPX Tcommaaccent semicolon -74
+KPX Tcommaaccent u -37
+KPX Tcommaaccent uacute -37
+KPX Tcommaaccent ucircumflex -37
+KPX Tcommaaccent udieresis -37
+KPX Tcommaaccent ugrave -37
+KPX Tcommaaccent uhungarumlaut -37
+KPX Tcommaaccent umacron -37
+KPX Tcommaaccent uogonek -37
+KPX Tcommaaccent uring -37
+KPX Tcommaaccent w -37
+KPX Tcommaaccent y -37
+KPX Tcommaaccent yacute -37
+KPX Tcommaaccent ydieresis -37
+KPX U A -45
+KPX U Aacute -45
+KPX U Abreve -45
+KPX U Acircumflex -45
+KPX U Adieresis -45
+KPX U Agrave -45
+KPX U Amacron -45
+KPX U Aogonek -45
+KPX U Aring -45
+KPX U Atilde -45
+KPX Uacute A -45
+KPX Uacute Aacute -45
+KPX Uacute Abreve -45
+KPX Uacute Acircumflex -45
+KPX Uacute Adieresis -45
+KPX Uacute Agrave -45
+KPX Uacute Amacron -45
+KPX Uacute Aogonek -45
+KPX Uacute Aring -45
+KPX Uacute Atilde -45
+KPX Ucircumflex A -45
+KPX Ucircumflex Aacute -45
+KPX Ucircumflex Abreve -45
+KPX Ucircumflex Acircumflex -45
+KPX Ucircumflex Adieresis -45
+KPX Ucircumflex Agrave -45
+KPX Ucircumflex Amacron -45
+KPX Ucircumflex Aogonek -45
+KPX Ucircumflex Aring -45
+KPX Ucircumflex Atilde -45
+KPX Udieresis A -45
+KPX Udieresis Aacute -45
+KPX Udieresis Abreve -45
+KPX Udieresis Acircumflex -45
+KPX Udieresis Adieresis -45
+KPX Udieresis Agrave -45
+KPX Udieresis Amacron -45
+KPX Udieresis Aogonek -45
+KPX Udieresis Aring -45
+KPX Udieresis Atilde -45
+KPX Ugrave A -45
+KPX Ugrave Aacute -45
+KPX Ugrave Abreve -45
+KPX Ugrave Acircumflex -45
+KPX Ugrave Adieresis -45
+KPX Ugrave Agrave -45
+KPX Ugrave Amacron -45
+KPX Ugrave Aogonek -45
+KPX Ugrave Aring -45
+KPX Ugrave Atilde -45
+KPX Uhungarumlaut A -45
+KPX Uhungarumlaut Aacute -45
+KPX Uhungarumlaut Abreve -45
+KPX Uhungarumlaut Acircumflex -45
+KPX Uhungarumlaut Adieresis -45
+KPX Uhungarumlaut Agrave -45
+KPX Uhungarumlaut Amacron -45
+KPX Uhungarumlaut Aogonek -45
+KPX Uhungarumlaut Aring -45
+KPX Uhungarumlaut Atilde -45
+KPX Umacron A -45
+KPX Umacron Aacute -45
+KPX Umacron Abreve -45
+KPX Umacron Acircumflex -45
+KPX Umacron Adieresis -45
+KPX Umacron Agrave -45
+KPX Umacron Amacron -45
+KPX Umacron Aogonek -45
+KPX Umacron Aring -45
+KPX Umacron Atilde -45
+KPX Uogonek A -45
+KPX Uogonek Aacute -45
+KPX Uogonek Abreve -45
+KPX Uogonek Acircumflex -45
+KPX Uogonek Adieresis -45
+KPX Uogonek Agrave -45
+KPX Uogonek Amacron -45
+KPX Uogonek Aogonek -45
+KPX Uogonek Aring -45
+KPX Uogonek Atilde -45
+KPX Uring A -45
+KPX Uring Aacute -45
+KPX Uring Abreve -45
+KPX Uring Acircumflex -45
+KPX Uring Adieresis -45
+KPX Uring Agrave -45
+KPX Uring Amacron -45
+KPX Uring Aogonek -45
+KPX Uring Aring -45
+KPX Uring Atilde -45
+KPX V A -85
+KPX V Aacute -85
+KPX V Abreve -85
+KPX V Acircumflex -85
+KPX V Adieresis -85
+KPX V Agrave -85
+KPX V Amacron -85
+KPX V Aogonek -85
+KPX V Aring -85
+KPX V Atilde -85
+KPX V G -10
+KPX V Gbreve -10
+KPX V Gcommaaccent -10
+KPX V O -30
+KPX V Oacute -30
+KPX V Ocircumflex -30
+KPX V Odieresis -30
+KPX V Ograve -30
+KPX V Ohungarumlaut -30
+KPX V Omacron -30
+KPX V Oslash -30
+KPX V Otilde -30
+KPX V a -111
+KPX V aacute -111
+KPX V abreve -111
+KPX V acircumflex -111
+KPX V adieresis -111
+KPX V agrave -111
+KPX V amacron -111
+KPX V aogonek -111
+KPX V aring -111
+KPX V atilde -111
+KPX V colon -74
+KPX V comma -129
+KPX V e -111
+KPX V eacute -111
+KPX V ecaron -111
+KPX V ecircumflex -111
+KPX V edieresis -71
+KPX V edotaccent -111
+KPX V egrave -71
+KPX V emacron -71
+KPX V eogonek -111
+KPX V hyphen -70
+KPX V i -55
+KPX V iacute -55
+KPX V iogonek -55
+KPX V o -111
+KPX V oacute -111
+KPX V ocircumflex -111
+KPX V odieresis -111
+KPX V ograve -111
+KPX V ohungarumlaut -111
+KPX V omacron -111
+KPX V oslash -111
+KPX V otilde -111
+KPX V period -129
+KPX V semicolon -74
+KPX V u -55
+KPX V uacute -55
+KPX V ucircumflex -55
+KPX V udieresis -55
+KPX V ugrave -55
+KPX V uhungarumlaut -55
+KPX V umacron -55
+KPX V uogonek -55
+KPX V uring -55
+KPX W A -74
+KPX W Aacute -74
+KPX W Abreve -74
+KPX W Acircumflex -74
+KPX W Adieresis -74
+KPX W Agrave -74
+KPX W Amacron -74
+KPX W Aogonek -74
+KPX W Aring -74
+KPX W Atilde -74
+KPX W O -15
+KPX W Oacute -15
+KPX W Ocircumflex -15
+KPX W Odieresis -15
+KPX W Ograve -15
+KPX W Ohungarumlaut -15
+KPX W Omacron -15
+KPX W Oslash -15
+KPX W Otilde -15
+KPX W a -85
+KPX W aacute -85
+KPX W abreve -85
+KPX W acircumflex -85
+KPX W adieresis -85
+KPX W agrave -85
+KPX W amacron -85
+KPX W aogonek -85
+KPX W aring -85
+KPX W atilde -85
+KPX W colon -55
+KPX W comma -74
+KPX W e -90
+KPX W eacute -90
+KPX W ecaron -90
+KPX W ecircumflex -90
+KPX W edieresis -50
+KPX W edotaccent -90
+KPX W egrave -50
+KPX W emacron -50
+KPX W eogonek -90
+KPX W hyphen -50
+KPX W i -37
+KPX W iacute -37
+KPX W iogonek -37
+KPX W o -80
+KPX W oacute -80
+KPX W ocircumflex -80
+KPX W odieresis -80
+KPX W ograve -80
+KPX W ohungarumlaut -80
+KPX W omacron -80
+KPX W oslash -80
+KPX W otilde -80
+KPX W period -74
+KPX W semicolon -55
+KPX W u -55
+KPX W uacute -55
+KPX W ucircumflex -55
+KPX W udieresis -55
+KPX W ugrave -55
+KPX W uhungarumlaut -55
+KPX W umacron -55
+KPX W uogonek -55
+KPX W uring -55
+KPX W y -55
+KPX W yacute -55
+KPX W ydieresis -55
+KPX Y A -74
+KPX Y Aacute -74
+KPX Y Abreve -74
+KPX Y Acircumflex -74
+KPX Y Adieresis -74
+KPX Y Agrave -74
+KPX Y Amacron -74
+KPX Y Aogonek -74
+KPX Y Aring -74
+KPX Y Atilde -74
+KPX Y O -25
+KPX Y Oacute -25
+KPX Y Ocircumflex -25
+KPX Y Odieresis -25
+KPX Y Ograve -25
+KPX Y Ohungarumlaut -25
+KPX Y Omacron -25
+KPX Y Oslash -25
+KPX Y Otilde -25
+KPX Y a -92
+KPX Y aacute -92
+KPX Y abreve -92
+KPX Y acircumflex -92
+KPX Y adieresis -92
+KPX Y agrave -92
+KPX Y amacron -92
+KPX Y aogonek -92
+KPX Y aring -92
+KPX Y atilde -92
+KPX Y colon -92
+KPX Y comma -92
+KPX Y e -111
+KPX Y eacute -111
+KPX Y ecaron -111
+KPX Y ecircumflex -71
+KPX Y edieresis -71
+KPX Y edotaccent -111
+KPX Y egrave -71
+KPX Y emacron -71
+KPX Y eogonek -111
+KPX Y hyphen -92
+KPX Y i -55
+KPX Y iacute -55
+KPX Y iogonek -55
+KPX Y o -111
+KPX Y oacute -111
+KPX Y ocircumflex -111
+KPX Y odieresis -111
+KPX Y ograve -111
+KPX Y ohungarumlaut -111
+KPX Y omacron -111
+KPX Y oslash -111
+KPX Y otilde -111
+KPX Y period -74
+KPX Y semicolon -92
+KPX Y u -92
+KPX Y uacute -92
+KPX Y ucircumflex -92
+KPX Y udieresis -92
+KPX Y ugrave -92
+KPX Y uhungarumlaut -92
+KPX Y umacron -92
+KPX Y uogonek -92
+KPX Y uring -92
+KPX Yacute A -74
+KPX Yacute Aacute -74
+KPX Yacute Abreve -74
+KPX Yacute Acircumflex -74
+KPX Yacute Adieresis -74
+KPX Yacute Agrave -74
+KPX Yacute Amacron -74
+KPX Yacute Aogonek -74
+KPX Yacute Aring -74
+KPX Yacute Atilde -74
+KPX Yacute O -25
+KPX Yacute Oacute -25
+KPX Yacute Ocircumflex -25
+KPX Yacute Odieresis -25
+KPX Yacute Ograve -25
+KPX Yacute Ohungarumlaut -25
+KPX Yacute Omacron -25
+KPX Yacute Oslash -25
+KPX Yacute Otilde -25
+KPX Yacute a -92
+KPX Yacute aacute -92
+KPX Yacute abreve -92
+KPX Yacute acircumflex -92
+KPX Yacute adieresis -92
+KPX Yacute agrave -92
+KPX Yacute amacron -92
+KPX Yacute aogonek -92
+KPX Yacute aring -92
+KPX Yacute atilde -92
+KPX Yacute colon -92
+KPX Yacute comma -92
+KPX Yacute e -111
+KPX Yacute eacute -111
+KPX Yacute ecaron -111
+KPX Yacute ecircumflex -71
+KPX Yacute edieresis -71
+KPX Yacute edotaccent -111
+KPX Yacute egrave -71
+KPX Yacute emacron -71
+KPX Yacute eogonek -111
+KPX Yacute hyphen -92
+KPX Yacute i -55
+KPX Yacute iacute -55
+KPX Yacute iogonek -55
+KPX Yacute o -111
+KPX Yacute oacute -111
+KPX Yacute ocircumflex -111
+KPX Yacute odieresis -111
+KPX Yacute ograve -111
+KPX Yacute ohungarumlaut -111
+KPX Yacute omacron -111
+KPX Yacute oslash -111
+KPX Yacute otilde -111
+KPX Yacute period -74
+KPX Yacute semicolon -92
+KPX Yacute u -92
+KPX Yacute uacute -92
+KPX Yacute ucircumflex -92
+KPX Yacute udieresis -92
+KPX Yacute ugrave -92
+KPX Yacute uhungarumlaut -92
+KPX Yacute umacron -92
+KPX Yacute uogonek -92
+KPX Yacute uring -92
+KPX Ydieresis A -74
+KPX Ydieresis Aacute -74
+KPX Ydieresis Abreve -74
+KPX Ydieresis Acircumflex -74
+KPX Ydieresis Adieresis -74
+KPX Ydieresis Agrave -74
+KPX Ydieresis Amacron -74
+KPX Ydieresis Aogonek -74
+KPX Ydieresis Aring -74
+KPX Ydieresis Atilde -74
+KPX Ydieresis O -25
+KPX Ydieresis Oacute -25
+KPX Ydieresis Ocircumflex -25
+KPX Ydieresis Odieresis -25
+KPX Ydieresis Ograve -25
+KPX Ydieresis Ohungarumlaut -25
+KPX Ydieresis Omacron -25
+KPX Ydieresis Oslash -25
+KPX Ydieresis Otilde -25
+KPX Ydieresis a -92
+KPX Ydieresis aacute -92
+KPX Ydieresis abreve -92
+KPX Ydieresis acircumflex -92
+KPX Ydieresis adieresis -92
+KPX Ydieresis agrave -92
+KPX Ydieresis amacron -92
+KPX Ydieresis aogonek -92
+KPX Ydieresis aring -92
+KPX Ydieresis atilde -92
+KPX Ydieresis colon -92
+KPX Ydieresis comma -92
+KPX Ydieresis e -111
+KPX Ydieresis eacute -111
+KPX Ydieresis ecaron -111
+KPX Ydieresis ecircumflex -71
+KPX Ydieresis edieresis -71
+KPX Ydieresis edotaccent -111
+KPX Ydieresis egrave -71
+KPX Ydieresis emacron -71
+KPX Ydieresis eogonek -111
+KPX Ydieresis hyphen -92
+KPX Ydieresis i -55
+KPX Ydieresis iacute -55
+KPX Ydieresis iogonek -55
+KPX Ydieresis o -111
+KPX Ydieresis oacute -111
+KPX Ydieresis ocircumflex -111
+KPX Ydieresis odieresis -111
+KPX Ydieresis ograve -111
+KPX Ydieresis ohungarumlaut -111
+KPX Ydieresis omacron -111
+KPX Ydieresis oslash -111
+KPX Ydieresis otilde -111
+KPX Ydieresis period -74
+KPX Ydieresis semicolon -92
+KPX Ydieresis u -92
+KPX Ydieresis uacute -92
+KPX Ydieresis ucircumflex -92
+KPX Ydieresis udieresis -92
+KPX Ydieresis ugrave -92
+KPX Ydieresis uhungarumlaut -92
+KPX Ydieresis umacron -92
+KPX Ydieresis uogonek -92
+KPX Ydieresis uring -92
+KPX b b -10
+KPX b period -40
+KPX b u -20
+KPX b uacute -20
+KPX b ucircumflex -20
+KPX b udieresis -20
+KPX b ugrave -20
+KPX b uhungarumlaut -20
+KPX b umacron -20
+KPX b uogonek -20
+KPX b uring -20
+KPX c h -10
+KPX c k -10
+KPX c kcommaaccent -10
+KPX cacute h -10
+KPX cacute k -10
+KPX cacute kcommaaccent -10
+KPX ccaron h -10
+KPX ccaron k -10
+KPX ccaron kcommaaccent -10
+KPX ccedilla h -10
+KPX ccedilla k -10
+KPX ccedilla kcommaaccent -10
+KPX comma quotedblright -95
+KPX comma quoteright -95
+KPX e b -10
+KPX eacute b -10
+KPX ecaron b -10
+KPX ecircumflex b -10
+KPX edieresis b -10
+KPX edotaccent b -10
+KPX egrave b -10
+KPX emacron b -10
+KPX eogonek b -10
+KPX f comma -10
+KPX f dotlessi -30
+KPX f e -10
+KPX f eacute -10
+KPX f edotaccent -10
+KPX f eogonek -10
+KPX f f -18
+KPX f o -10
+KPX f oacute -10
+KPX f ocircumflex -10
+KPX f ograve -10
+KPX f ohungarumlaut -10
+KPX f oslash -10
+KPX f otilde -10
+KPX f period -10
+KPX f quoteright 55
+KPX k e -30
+KPX k eacute -30
+KPX k ecaron -30
+KPX k ecircumflex -30
+KPX k edieresis -30
+KPX k edotaccent -30
+KPX k egrave -30
+KPX k emacron -30
+KPX k eogonek -30
+KPX k o -10
+KPX k oacute -10
+KPX k ocircumflex -10
+KPX k odieresis -10
+KPX k ograve -10
+KPX k ohungarumlaut -10
+KPX k omacron -10
+KPX k oslash -10
+KPX k otilde -10
+KPX kcommaaccent e -30
+KPX kcommaaccent eacute -30
+KPX kcommaaccent ecaron -30
+KPX kcommaaccent ecircumflex -30
+KPX kcommaaccent edieresis -30
+KPX kcommaaccent edotaccent -30
+KPX kcommaaccent egrave -30
+KPX kcommaaccent emacron -30
+KPX kcommaaccent eogonek -30
+KPX kcommaaccent o -10
+KPX kcommaaccent oacute -10
+KPX kcommaaccent ocircumflex -10
+KPX kcommaaccent odieresis -10
+KPX kcommaaccent ograve -10
+KPX kcommaaccent ohungarumlaut -10
+KPX kcommaaccent omacron -10
+KPX kcommaaccent oslash -10
+KPX kcommaaccent otilde -10
+KPX n v -40
+KPX nacute v -40
+KPX ncaron v -40
+KPX ncommaaccent v -40
+KPX ntilde v -40
+KPX o v -15
+KPX o w -25
+KPX o x -10
+KPX o y -10
+KPX o yacute -10
+KPX o ydieresis -10
+KPX oacute v -15
+KPX oacute w -25
+KPX oacute x -10
+KPX oacute y -10
+KPX oacute yacute -10
+KPX oacute ydieresis -10
+KPX ocircumflex v -15
+KPX ocircumflex w -25
+KPX ocircumflex x -10
+KPX ocircumflex y -10
+KPX ocircumflex yacute -10
+KPX ocircumflex ydieresis -10
+KPX odieresis v -15
+KPX odieresis w -25
+KPX odieresis x -10
+KPX odieresis y -10
+KPX odieresis yacute -10
+KPX odieresis ydieresis -10
+KPX ograve v -15
+KPX ograve w -25
+KPX ograve x -10
+KPX ograve y -10
+KPX ograve yacute -10
+KPX ograve ydieresis -10
+KPX ohungarumlaut v -15
+KPX ohungarumlaut w -25
+KPX ohungarumlaut x -10
+KPX ohungarumlaut y -10
+KPX ohungarumlaut yacute -10
+KPX ohungarumlaut ydieresis -10
+KPX omacron v -15
+KPX omacron w -25
+KPX omacron x -10
+KPX omacron y -10
+KPX omacron yacute -10
+KPX omacron ydieresis -10
+KPX oslash v -15
+KPX oslash w -25
+KPX oslash x -10
+KPX oslash y -10
+KPX oslash yacute -10
+KPX oslash ydieresis -10
+KPX otilde v -15
+KPX otilde w -25
+KPX otilde x -10
+KPX otilde y -10
+KPX otilde yacute -10
+KPX otilde ydieresis -10
+KPX period quotedblright -95
+KPX period quoteright -95
+KPX quoteleft quoteleft -74
+KPX quoteright d -15
+KPX quoteright dcroat -15
+KPX quoteright quoteright -74
+KPX quoteright r -15
+KPX quoteright racute -15
+KPX quoteright rcaron -15
+KPX quoteright rcommaaccent -15
+KPX quoteright s -74
+KPX quoteright sacute -74
+KPX quoteright scaron -74
+KPX quoteright scedilla -74
+KPX quoteright scommaaccent -74
+KPX quoteright space -74
+KPX quoteright t -37
+KPX quoteright tcommaaccent -37
+KPX quoteright v -15
+KPX r comma -65
+KPX r period -65
+KPX racute comma -65
+KPX racute period -65
+KPX rcaron comma -65
+KPX rcaron period -65
+KPX rcommaaccent comma -65
+KPX rcommaaccent period -65
+KPX space A -37
+KPX space Aacute -37
+KPX space Abreve -37
+KPX space Acircumflex -37
+KPX space Adieresis -37
+KPX space Agrave -37
+KPX space Amacron -37
+KPX space Aogonek -37
+KPX space Aring -37
+KPX space Atilde -37
+KPX space V -70
+KPX space W -70
+KPX space Y -70
+KPX space Yacute -70
+KPX space Ydieresis -70
+KPX v comma -37
+KPX v e -15
+KPX v eacute -15
+KPX v ecaron -15
+KPX v ecircumflex -15
+KPX v edieresis -15
+KPX v edotaccent -15
+KPX v egrave -15
+KPX v emacron -15
+KPX v eogonek -15
+KPX v o -15
+KPX v oacute -15
+KPX v ocircumflex -15
+KPX v odieresis -15
+KPX v ograve -15
+KPX v ohungarumlaut -15
+KPX v omacron -15
+KPX v oslash -15
+KPX v otilde -15
+KPX v period -37
+KPX w a -10
+KPX w aacute -10
+KPX w abreve -10
+KPX w acircumflex -10
+KPX w adieresis -10
+KPX w agrave -10
+KPX w amacron -10
+KPX w aogonek -10
+KPX w aring -10
+KPX w atilde -10
+KPX w comma -37
+KPX w e -10
+KPX w eacute -10
+KPX w ecaron -10
+KPX w ecircumflex -10
+KPX w edieresis -10
+KPX w edotaccent -10
+KPX w egrave -10
+KPX w emacron -10
+KPX w eogonek -10
+KPX w o -15
+KPX w oacute -15
+KPX w ocircumflex -15
+KPX w odieresis -15
+KPX w ograve -15
+KPX w ohungarumlaut -15
+KPX w omacron -15
+KPX w oslash -15
+KPX w otilde -15
+KPX w period -37
+KPX x e -10
+KPX x eacute -10
+KPX x ecaron -10
+KPX x ecircumflex -10
+KPX x edieresis -10
+KPX x edotaccent -10
+KPX x egrave -10
+KPX x emacron -10
+KPX x eogonek -10
+KPX y comma -37
+KPX y period -37
+KPX yacute comma -37
+KPX yacute period -37
+KPX ydieresis comma -37
+KPX ydieresis period -37
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Times-Italic.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Times-Italic.afm
new file mode 100644
index 0000000..b0eaee4
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Times-Italic.afm
@@ -0,0 +1,2667 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu May 1 12:56:55 1997
+Comment UniqueID 43067
+Comment VMusage 47727 58752
+FontName Times-Italic
+FullName Times Italic
+FamilyName Times
+Weight Medium
+ItalicAngle -15.5
+IsFixedPitch false
+CharacterSet ExtendedRoman
+FontBBox -169 -217 1010 883
+UnderlinePosition -100
+UnderlineThickness 50
+Version 002.000
+Notice Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.Times is a trademark of Linotype-Hell AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 653
+XHeight 441
+Ascender 683
+Descender -217
+StdHW 32
+StdVW 76
+StartCharMetrics 315
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 39 -11 302 667 ;
+C 34 ; WX 420 ; N quotedbl ; B 144 421 432 666 ;
+C 35 ; WX 500 ; N numbersign ; B 2 0 540 676 ;
+C 36 ; WX 500 ; N dollar ; B 31 -89 497 731 ;
+C 37 ; WX 833 ; N percent ; B 79 -13 790 676 ;
+C 38 ; WX 778 ; N ampersand ; B 76 -18 723 666 ;
+C 39 ; WX 333 ; N quoteright ; B 151 436 290 666 ;
+C 40 ; WX 333 ; N parenleft ; B 42 -181 315 669 ;
+C 41 ; WX 333 ; N parenright ; B 16 -180 289 669 ;
+C 42 ; WX 500 ; N asterisk ; B 128 255 492 666 ;
+C 43 ; WX 675 ; N plus ; B 86 0 590 506 ;
+C 44 ; WX 250 ; N comma ; B -4 -129 135 101 ;
+C 45 ; WX 333 ; N hyphen ; B 49 192 282 255 ;
+C 46 ; WX 250 ; N period ; B 27 -11 138 100 ;
+C 47 ; WX 278 ; N slash ; B -65 -18 386 666 ;
+C 48 ; WX 500 ; N zero ; B 32 -7 497 676 ;
+C 49 ; WX 500 ; N one ; B 49 0 409 676 ;
+C 50 ; WX 500 ; N two ; B 12 0 452 676 ;
+C 51 ; WX 500 ; N three ; B 15 -7 465 676 ;
+C 52 ; WX 500 ; N four ; B 1 0 479 676 ;
+C 53 ; WX 500 ; N five ; B 15 -7 491 666 ;
+C 54 ; WX 500 ; N six ; B 30 -7 521 686 ;
+C 55 ; WX 500 ; N seven ; B 75 -8 537 666 ;
+C 56 ; WX 500 ; N eight ; B 30 -7 493 676 ;
+C 57 ; WX 500 ; N nine ; B 23 -17 492 676 ;
+C 58 ; WX 333 ; N colon ; B 50 -11 261 441 ;
+C 59 ; WX 333 ; N semicolon ; B 27 -129 261 441 ;
+C 60 ; WX 675 ; N less ; B 84 -8 592 514 ;
+C 61 ; WX 675 ; N equal ; B 86 120 590 386 ;
+C 62 ; WX 675 ; N greater ; B 84 -8 592 514 ;
+C 63 ; WX 500 ; N question ; B 132 -12 472 664 ;
+C 64 ; WX 920 ; N at ; B 118 -18 806 666 ;
+C 65 ; WX 611 ; N A ; B -51 0 564 668 ;
+C 66 ; WX 611 ; N B ; B -8 0 588 653 ;
+C 67 ; WX 667 ; N C ; B 66 -18 689 666 ;
+C 68 ; WX 722 ; N D ; B -8 0 700 653 ;
+C 69 ; WX 611 ; N E ; B -1 0 634 653 ;
+C 70 ; WX 611 ; N F ; B 8 0 645 653 ;
+C 71 ; WX 722 ; N G ; B 52 -18 722 666 ;
+C 72 ; WX 722 ; N H ; B -8 0 767 653 ;
+C 73 ; WX 333 ; N I ; B -8 0 384 653 ;
+C 74 ; WX 444 ; N J ; B -6 -18 491 653 ;
+C 75 ; WX 667 ; N K ; B 7 0 722 653 ;
+C 76 ; WX 556 ; N L ; B -8 0 559 653 ;
+C 77 ; WX 833 ; N M ; B -18 0 873 653 ;
+C 78 ; WX 667 ; N N ; B -20 -15 727 653 ;
+C 79 ; WX 722 ; N O ; B 60 -18 699 666 ;
+C 80 ; WX 611 ; N P ; B 0 0 605 653 ;
+C 81 ; WX 722 ; N Q ; B 59 -182 699 666 ;
+C 82 ; WX 611 ; N R ; B -13 0 588 653 ;
+C 83 ; WX 500 ; N S ; B 17 -18 508 667 ;
+C 84 ; WX 556 ; N T ; B 59 0 633 653 ;
+C 85 ; WX 722 ; N U ; B 102 -18 765 653 ;
+C 86 ; WX 611 ; N V ; B 76 -18 688 653 ;
+C 87 ; WX 833 ; N W ; B 71 -18 906 653 ;
+C 88 ; WX 611 ; N X ; B -29 0 655 653 ;
+C 89 ; WX 556 ; N Y ; B 78 0 633 653 ;
+C 90 ; WX 556 ; N Z ; B -6 0 606 653 ;
+C 91 ; WX 389 ; N bracketleft ; B 21 -153 391 663 ;
+C 92 ; WX 278 ; N backslash ; B -41 -18 319 666 ;
+C 93 ; WX 389 ; N bracketright ; B 12 -153 382 663 ;
+C 94 ; WX 422 ; N asciicircum ; B 0 301 422 666 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 333 ; N quoteleft ; B 171 436 310 666 ;
+C 97 ; WX 500 ; N a ; B 17 -11 476 441 ;
+C 98 ; WX 500 ; N b ; B 23 -11 473 683 ;
+C 99 ; WX 444 ; N c ; B 30 -11 425 441 ;
+C 100 ; WX 500 ; N d ; B 15 -13 527 683 ;
+C 101 ; WX 444 ; N e ; B 31 -11 412 441 ;
+C 102 ; WX 278 ; N f ; B -147 -207 424 678 ; L i fi ; L l fl ;
+C 103 ; WX 500 ; N g ; B 8 -206 472 441 ;
+C 104 ; WX 500 ; N h ; B 19 -9 478 683 ;
+C 105 ; WX 278 ; N i ; B 49 -11 264 654 ;
+C 106 ; WX 278 ; N j ; B -124 -207 276 654 ;
+C 107 ; WX 444 ; N k ; B 14 -11 461 683 ;
+C 108 ; WX 278 ; N l ; B 41 -11 279 683 ;
+C 109 ; WX 722 ; N m ; B 12 -9 704 441 ;
+C 110 ; WX 500 ; N n ; B 14 -9 474 441 ;
+C 111 ; WX 500 ; N o ; B 27 -11 468 441 ;
+C 112 ; WX 500 ; N p ; B -75 -205 469 441 ;
+C 113 ; WX 500 ; N q ; B 25 -209 483 441 ;
+C 114 ; WX 389 ; N r ; B 45 0 412 441 ;
+C 115 ; WX 389 ; N s ; B 16 -13 366 442 ;
+C 116 ; WX 278 ; N t ; B 37 -11 296 546 ;
+C 117 ; WX 500 ; N u ; B 42 -11 475 441 ;
+C 118 ; WX 444 ; N v ; B 21 -18 426 441 ;
+C 119 ; WX 667 ; N w ; B 16 -18 648 441 ;
+C 120 ; WX 444 ; N x ; B -27 -11 447 441 ;
+C 121 ; WX 444 ; N y ; B -24 -206 426 441 ;
+C 122 ; WX 389 ; N z ; B -2 -81 380 428 ;
+C 123 ; WX 400 ; N braceleft ; B 51 -177 407 687 ;
+C 124 ; WX 275 ; N bar ; B 105 -217 171 783 ;
+C 125 ; WX 400 ; N braceright ; B -7 -177 349 687 ;
+C 126 ; WX 541 ; N asciitilde ; B 40 183 502 323 ;
+C 161 ; WX 389 ; N exclamdown ; B 59 -205 322 473 ;
+C 162 ; WX 500 ; N cent ; B 77 -143 472 560 ;
+C 163 ; WX 500 ; N sterling ; B 10 -6 517 670 ;
+C 164 ; WX 167 ; N fraction ; B -169 -10 337 676 ;
+C 165 ; WX 500 ; N yen ; B 27 0 603 653 ;
+C 166 ; WX 500 ; N florin ; B 25 -182 507 682 ;
+C 167 ; WX 500 ; N section ; B 53 -162 461 666 ;
+C 168 ; WX 500 ; N currency ; B -22 53 522 597 ;
+C 169 ; WX 214 ; N quotesingle ; B 132 421 241 666 ;
+C 170 ; WX 556 ; N quotedblleft ; B 166 436 514 666 ;
+C 171 ; WX 500 ; N guillemotleft ; B 53 37 445 403 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 51 37 281 403 ;
+C 173 ; WX 333 ; N guilsinglright ; B 52 37 282 403 ;
+C 174 ; WX 500 ; N fi ; B -141 -207 481 681 ;
+C 175 ; WX 500 ; N fl ; B -141 -204 518 682 ;
+C 177 ; WX 500 ; N endash ; B -6 197 505 243 ;
+C 178 ; WX 500 ; N dagger ; B 101 -159 488 666 ;
+C 179 ; WX 500 ; N daggerdbl ; B 22 -143 491 666 ;
+C 180 ; WX 250 ; N periodcentered ; B 70 199 181 310 ;
+C 182 ; WX 523 ; N paragraph ; B 55 -123 616 653 ;
+C 183 ; WX 350 ; N bullet ; B 40 191 310 461 ;
+C 184 ; WX 333 ; N quotesinglbase ; B 44 -129 183 101 ;
+C 185 ; WX 556 ; N quotedblbase ; B 57 -129 405 101 ;
+C 186 ; WX 556 ; N quotedblright ; B 151 436 499 666 ;
+C 187 ; WX 500 ; N guillemotright ; B 55 37 447 403 ;
+C 188 ; WX 889 ; N ellipsis ; B 57 -11 762 100 ;
+C 189 ; WX 1000 ; N perthousand ; B 25 -19 1010 706 ;
+C 191 ; WX 500 ; N questiondown ; B 28 -205 368 471 ;
+C 193 ; WX 333 ; N grave ; B 121 492 311 664 ;
+C 194 ; WX 333 ; N acute ; B 180 494 403 664 ;
+C 195 ; WX 333 ; N circumflex ; B 91 492 385 661 ;
+C 196 ; WX 333 ; N tilde ; B 100 517 427 624 ;
+C 197 ; WX 333 ; N macron ; B 99 532 411 583 ;
+C 198 ; WX 333 ; N breve ; B 117 492 418 650 ;
+C 199 ; WX 333 ; N dotaccent ; B 207 548 305 646 ;
+C 200 ; WX 333 ; N dieresis ; B 107 548 405 646 ;
+C 202 ; WX 333 ; N ring ; B 155 492 355 691 ;
+C 203 ; WX 333 ; N cedilla ; B -30 -217 182 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B 93 494 486 664 ;
+C 206 ; WX 333 ; N ogonek ; B 20 -169 203 40 ;
+C 207 ; WX 333 ; N caron ; B 121 492 426 661 ;
+C 208 ; WX 889 ; N emdash ; B -6 197 894 243 ;
+C 225 ; WX 889 ; N AE ; B -27 0 911 653 ;
+C 227 ; WX 276 ; N ordfeminine ; B 42 406 352 676 ;
+C 232 ; WX 556 ; N Lslash ; B -8 0 559 653 ;
+C 233 ; WX 722 ; N Oslash ; B 60 -105 699 722 ;
+C 234 ; WX 944 ; N OE ; B 49 -8 964 666 ;
+C 235 ; WX 310 ; N ordmasculine ; B 67 406 362 676 ;
+C 241 ; WX 667 ; N ae ; B 23 -11 640 441 ;
+C 245 ; WX 278 ; N dotlessi ; B 49 -11 235 441 ;
+C 248 ; WX 278 ; N lslash ; B 41 -11 312 683 ;
+C 249 ; WX 500 ; N oslash ; B 28 -135 469 554 ;
+C 250 ; WX 667 ; N oe ; B 20 -12 646 441 ;
+C 251 ; WX 500 ; N germandbls ; B -168 -207 493 679 ;
+C -1 ; WX 333 ; N Idieresis ; B -8 0 435 818 ;
+C -1 ; WX 444 ; N eacute ; B 31 -11 459 664 ;
+C -1 ; WX 500 ; N abreve ; B 17 -11 502 650 ;
+C -1 ; WX 500 ; N uhungarumlaut ; B 42 -11 580 664 ;
+C -1 ; WX 444 ; N ecaron ; B 31 -11 482 661 ;
+C -1 ; WX 556 ; N Ydieresis ; B 78 0 633 818 ;
+C -1 ; WX 675 ; N divide ; B 86 -11 590 517 ;
+C -1 ; WX 556 ; N Yacute ; B 78 0 633 876 ;
+C -1 ; WX 611 ; N Acircumflex ; B -51 0 564 873 ;
+C -1 ; WX 500 ; N aacute ; B 17 -11 487 664 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 102 -18 765 873 ;
+C -1 ; WX 444 ; N yacute ; B -24 -206 459 664 ;
+C -1 ; WX 389 ; N scommaaccent ; B 16 -217 366 442 ;
+C -1 ; WX 444 ; N ecircumflex ; B 31 -11 441 661 ;
+C -1 ; WX 722 ; N Uring ; B 102 -18 765 883 ;
+C -1 ; WX 722 ; N Udieresis ; B 102 -18 765 818 ;
+C -1 ; WX 500 ; N aogonek ; B 17 -169 476 441 ;
+C -1 ; WX 722 ; N Uacute ; B 102 -18 765 876 ;
+C -1 ; WX 500 ; N uogonek ; B 42 -169 477 441 ;
+C -1 ; WX 611 ; N Edieresis ; B -1 0 634 818 ;
+C -1 ; WX 722 ; N Dcroat ; B -8 0 700 653 ;
+C -1 ; WX 250 ; N commaaccent ; B 8 -217 133 -50 ;
+C -1 ; WX 760 ; N copyright ; B 41 -18 719 666 ;
+C -1 ; WX 611 ; N Emacron ; B -1 0 634 795 ;
+C -1 ; WX 444 ; N ccaron ; B 30 -11 482 661 ;
+C -1 ; WX 500 ; N aring ; B 17 -11 476 691 ;
+C -1 ; WX 667 ; N Ncommaaccent ; B -20 -187 727 653 ;
+C -1 ; WX 278 ; N lacute ; B 41 -11 395 876 ;
+C -1 ; WX 500 ; N agrave ; B 17 -11 476 664 ;
+C -1 ; WX 556 ; N Tcommaaccent ; B 59 -217 633 653 ;
+C -1 ; WX 667 ; N Cacute ; B 66 -18 690 876 ;
+C -1 ; WX 500 ; N atilde ; B 17 -11 511 624 ;
+C -1 ; WX 611 ; N Edotaccent ; B -1 0 634 818 ;
+C -1 ; WX 389 ; N scaron ; B 16 -13 454 661 ;
+C -1 ; WX 389 ; N scedilla ; B 16 -217 366 442 ;
+C -1 ; WX 278 ; N iacute ; B 49 -11 355 664 ;
+C -1 ; WX 471 ; N lozenge ; B 13 0 459 724 ;
+C -1 ; WX 611 ; N Rcaron ; B -13 0 588 873 ;
+C -1 ; WX 722 ; N Gcommaaccent ; B 52 -217 722 666 ;
+C -1 ; WX 500 ; N ucircumflex ; B 42 -11 475 661 ;
+C -1 ; WX 500 ; N acircumflex ; B 17 -11 476 661 ;
+C -1 ; WX 611 ; N Amacron ; B -51 0 564 795 ;
+C -1 ; WX 389 ; N rcaron ; B 45 0 434 661 ;
+C -1 ; WX 444 ; N ccedilla ; B 30 -217 425 441 ;
+C -1 ; WX 556 ; N Zdotaccent ; B -6 0 606 818 ;
+C -1 ; WX 611 ; N Thorn ; B 0 0 569 653 ;
+C -1 ; WX 722 ; N Omacron ; B 60 -18 699 795 ;
+C -1 ; WX 611 ; N Racute ; B -13 0 588 876 ;
+C -1 ; WX 500 ; N Sacute ; B 17 -18 508 876 ;
+C -1 ; WX 544 ; N dcaron ; B 15 -13 658 683 ;
+C -1 ; WX 722 ; N Umacron ; B 102 -18 765 795 ;
+C -1 ; WX 500 ; N uring ; B 42 -11 475 691 ;
+C -1 ; WX 300 ; N threesuperior ; B 43 268 339 676 ;
+C -1 ; WX 722 ; N Ograve ; B 60 -18 699 876 ;
+C -1 ; WX 611 ; N Agrave ; B -51 0 564 876 ;
+C -1 ; WX 611 ; N Abreve ; B -51 0 564 862 ;
+C -1 ; WX 675 ; N multiply ; B 93 8 582 497 ;
+C -1 ; WX 500 ; N uacute ; B 42 -11 477 664 ;
+C -1 ; WX 556 ; N Tcaron ; B 59 0 633 873 ;
+C -1 ; WX 476 ; N partialdiff ; B 17 -38 459 710 ;
+C -1 ; WX 444 ; N ydieresis ; B -24 -206 441 606 ;
+C -1 ; WX 667 ; N Nacute ; B -20 -15 727 876 ;
+C -1 ; WX 278 ; N icircumflex ; B 33 -11 327 661 ;
+C -1 ; WX 611 ; N Ecircumflex ; B -1 0 634 873 ;
+C -1 ; WX 500 ; N adieresis ; B 17 -11 489 606 ;
+C -1 ; WX 444 ; N edieresis ; B 31 -11 451 606 ;
+C -1 ; WX 444 ; N cacute ; B 30 -11 459 664 ;
+C -1 ; WX 500 ; N nacute ; B 14 -9 477 664 ;
+C -1 ; WX 500 ; N umacron ; B 42 -11 485 583 ;
+C -1 ; WX 667 ; N Ncaron ; B -20 -15 727 873 ;
+C -1 ; WX 333 ; N Iacute ; B -8 0 433 876 ;
+C -1 ; WX 675 ; N plusminus ; B 86 0 590 506 ;
+C -1 ; WX 275 ; N brokenbar ; B 105 -142 171 708 ;
+C -1 ; WX 760 ; N registered ; B 41 -18 719 666 ;
+C -1 ; WX 722 ; N Gbreve ; B 52 -18 722 862 ;
+C -1 ; WX 333 ; N Idotaccent ; B -8 0 384 818 ;
+C -1 ; WX 600 ; N summation ; B 15 -10 585 706 ;
+C -1 ; WX 611 ; N Egrave ; B -1 0 634 876 ;
+C -1 ; WX 389 ; N racute ; B 45 0 431 664 ;
+C -1 ; WX 500 ; N omacron ; B 27 -11 495 583 ;
+C -1 ; WX 556 ; N Zacute ; B -6 0 606 876 ;
+C -1 ; WX 556 ; N Zcaron ; B -6 0 606 873 ;
+C -1 ; WX 549 ; N greaterequal ; B 26 0 523 658 ;
+C -1 ; WX 722 ; N Eth ; B -8 0 700 653 ;
+C -1 ; WX 667 ; N Ccedilla ; B 66 -217 689 666 ;
+C -1 ; WX 278 ; N lcommaaccent ; B 22 -217 279 683 ;
+C -1 ; WX 300 ; N tcaron ; B 37 -11 407 681 ;
+C -1 ; WX 444 ; N eogonek ; B 31 -169 412 441 ;
+C -1 ; WX 722 ; N Uogonek ; B 102 -184 765 653 ;
+C -1 ; WX 611 ; N Aacute ; B -51 0 564 876 ;
+C -1 ; WX 611 ; N Adieresis ; B -51 0 564 818 ;
+C -1 ; WX 444 ; N egrave ; B 31 -11 412 664 ;
+C -1 ; WX 389 ; N zacute ; B -2 -81 431 664 ;
+C -1 ; WX 278 ; N iogonek ; B 49 -169 264 654 ;
+C -1 ; WX 722 ; N Oacute ; B 60 -18 699 876 ;
+C -1 ; WX 500 ; N oacute ; B 27 -11 487 664 ;
+C -1 ; WX 500 ; N amacron ; B 17 -11 495 583 ;
+C -1 ; WX 389 ; N sacute ; B 16 -13 431 664 ;
+C -1 ; WX 278 ; N idieresis ; B 49 -11 352 606 ;
+C -1 ; WX 722 ; N Ocircumflex ; B 60 -18 699 873 ;
+C -1 ; WX 722 ; N Ugrave ; B 102 -18 765 876 ;
+C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
+C -1 ; WX 500 ; N thorn ; B -75 -205 469 683 ;
+C -1 ; WX 300 ; N twosuperior ; B 33 271 324 676 ;
+C -1 ; WX 722 ; N Odieresis ; B 60 -18 699 818 ;
+C -1 ; WX 500 ; N mu ; B -30 -209 497 428 ;
+C -1 ; WX 278 ; N igrave ; B 49 -11 284 664 ;
+C -1 ; WX 500 ; N ohungarumlaut ; B 27 -11 590 664 ;
+C -1 ; WX 611 ; N Eogonek ; B -1 -169 634 653 ;
+C -1 ; WX 500 ; N dcroat ; B 15 -13 572 683 ;
+C -1 ; WX 750 ; N threequarters ; B 23 -10 736 676 ;
+C -1 ; WX 500 ; N Scedilla ; B 17 -217 508 667 ;
+C -1 ; WX 300 ; N lcaron ; B 41 -11 407 683 ;
+C -1 ; WX 667 ; N Kcommaaccent ; B 7 -217 722 653 ;
+C -1 ; WX 556 ; N Lacute ; B -8 0 559 876 ;
+C -1 ; WX 980 ; N trademark ; B 30 247 957 653 ;
+C -1 ; WX 444 ; N edotaccent ; B 31 -11 412 606 ;
+C -1 ; WX 333 ; N Igrave ; B -8 0 384 876 ;
+C -1 ; WX 333 ; N Imacron ; B -8 0 441 795 ;
+C -1 ; WX 611 ; N Lcaron ; B -8 0 586 653 ;
+C -1 ; WX 750 ; N onehalf ; B 34 -10 749 676 ;
+C -1 ; WX 549 ; N lessequal ; B 26 0 523 658 ;
+C -1 ; WX 500 ; N ocircumflex ; B 27 -11 468 661 ;
+C -1 ; WX 500 ; N ntilde ; B 14 -9 476 624 ;
+C -1 ; WX 722 ; N Uhungarumlaut ; B 102 -18 765 876 ;
+C -1 ; WX 611 ; N Eacute ; B -1 0 634 876 ;
+C -1 ; WX 444 ; N emacron ; B 31 -11 457 583 ;
+C -1 ; WX 500 ; N gbreve ; B 8 -206 487 650 ;
+C -1 ; WX 750 ; N onequarter ; B 33 -10 736 676 ;
+C -1 ; WX 500 ; N Scaron ; B 17 -18 520 873 ;
+C -1 ; WX 500 ; N Scommaaccent ; B 17 -217 508 667 ;
+C -1 ; WX 722 ; N Ohungarumlaut ; B 60 -18 699 876 ;
+C -1 ; WX 400 ; N degree ; B 101 390 387 676 ;
+C -1 ; WX 500 ; N ograve ; B 27 -11 468 664 ;
+C -1 ; WX 667 ; N Ccaron ; B 66 -18 689 873 ;
+C -1 ; WX 500 ; N ugrave ; B 42 -11 475 664 ;
+C -1 ; WX 453 ; N radical ; B 2 -60 452 768 ;
+C -1 ; WX 722 ; N Dcaron ; B -8 0 700 873 ;
+C -1 ; WX 389 ; N rcommaaccent ; B -3 -217 412 441 ;
+C -1 ; WX 667 ; N Ntilde ; B -20 -15 727 836 ;
+C -1 ; WX 500 ; N otilde ; B 27 -11 496 624 ;
+C -1 ; WX 611 ; N Rcommaaccent ; B -13 -187 588 653 ;
+C -1 ; WX 556 ; N Lcommaaccent ; B -8 -217 559 653 ;
+C -1 ; WX 611 ; N Atilde ; B -51 0 566 836 ;
+C -1 ; WX 611 ; N Aogonek ; B -51 -169 566 668 ;
+C -1 ; WX 611 ; N Aring ; B -51 0 564 883 ;
+C -1 ; WX 722 ; N Otilde ; B 60 -18 699 836 ;
+C -1 ; WX 389 ; N zdotaccent ; B -2 -81 380 606 ;
+C -1 ; WX 611 ; N Ecaron ; B -1 0 634 873 ;
+C -1 ; WX 333 ; N Iogonek ; B -8 -169 384 653 ;
+C -1 ; WX 444 ; N kcommaaccent ; B 14 -187 461 683 ;
+C -1 ; WX 675 ; N minus ; B 86 220 590 286 ;
+C -1 ; WX 333 ; N Icircumflex ; B -8 0 425 873 ;
+C -1 ; WX 500 ; N ncaron ; B 14 -9 510 661 ;
+C -1 ; WX 278 ; N tcommaaccent ; B 2 -217 296 546 ;
+C -1 ; WX 675 ; N logicalnot ; B 86 108 590 386 ;
+C -1 ; WX 500 ; N odieresis ; B 27 -11 489 606 ;
+C -1 ; WX 500 ; N udieresis ; B 42 -11 479 606 ;
+C -1 ; WX 549 ; N notequal ; B 12 -29 537 541 ;
+C -1 ; WX 500 ; N gcommaaccent ; B 8 -206 472 706 ;
+C -1 ; WX 500 ; N eth ; B 27 -11 482 683 ;
+C -1 ; WX 389 ; N zcaron ; B -2 -81 434 661 ;
+C -1 ; WX 500 ; N ncommaaccent ; B 14 -187 474 441 ;
+C -1 ; WX 300 ; N onesuperior ; B 43 271 284 676 ;
+C -1 ; WX 278 ; N imacron ; B 46 -11 311 583 ;
+C -1 ; WX 500 ; N Euro ; B 0 0 0 0 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 2321
+KPX A C -30
+KPX A Cacute -30
+KPX A Ccaron -30
+KPX A Ccedilla -30
+KPX A G -35
+KPX A Gbreve -35
+KPX A Gcommaaccent -35
+KPX A O -40
+KPX A Oacute -40
+KPX A Ocircumflex -40
+KPX A Odieresis -40
+KPX A Ograve -40
+KPX A Ohungarumlaut -40
+KPX A Omacron -40
+KPX A Oslash -40
+KPX A Otilde -40
+KPX A Q -40
+KPX A T -37
+KPX A Tcaron -37
+KPX A Tcommaaccent -37
+KPX A U -50
+KPX A Uacute -50
+KPX A Ucircumflex -50
+KPX A Udieresis -50
+KPX A Ugrave -50
+KPX A Uhungarumlaut -50
+KPX A Umacron -50
+KPX A Uogonek -50
+KPX A Uring -50
+KPX A V -105
+KPX A W -95
+KPX A Y -55
+KPX A Yacute -55
+KPX A Ydieresis -55
+KPX A quoteright -37
+KPX A u -20
+KPX A uacute -20
+KPX A ucircumflex -20
+KPX A udieresis -20
+KPX A ugrave -20
+KPX A uhungarumlaut -20
+KPX A umacron -20
+KPX A uogonek -20
+KPX A uring -20
+KPX A v -55
+KPX A w -55
+KPX A y -55
+KPX A yacute -55
+KPX A ydieresis -55
+KPX Aacute C -30
+KPX Aacute Cacute -30
+KPX Aacute Ccaron -30
+KPX Aacute Ccedilla -30
+KPX Aacute G -35
+KPX Aacute Gbreve -35
+KPX Aacute Gcommaaccent -35
+KPX Aacute O -40
+KPX Aacute Oacute -40
+KPX Aacute Ocircumflex -40
+KPX Aacute Odieresis -40
+KPX Aacute Ograve -40
+KPX Aacute Ohungarumlaut -40
+KPX Aacute Omacron -40
+KPX Aacute Oslash -40
+KPX Aacute Otilde -40
+KPX Aacute Q -40
+KPX Aacute T -37
+KPX Aacute Tcaron -37
+KPX Aacute Tcommaaccent -37
+KPX Aacute U -50
+KPX Aacute Uacute -50
+KPX Aacute Ucircumflex -50
+KPX Aacute Udieresis -50
+KPX Aacute Ugrave -50
+KPX Aacute Uhungarumlaut -50
+KPX Aacute Umacron -50
+KPX Aacute Uogonek -50
+KPX Aacute Uring -50
+KPX Aacute V -105
+KPX Aacute W -95
+KPX Aacute Y -55
+KPX Aacute Yacute -55
+KPX Aacute Ydieresis -55
+KPX Aacute quoteright -37
+KPX Aacute u -20
+KPX Aacute uacute -20
+KPX Aacute ucircumflex -20
+KPX Aacute udieresis -20
+KPX Aacute ugrave -20
+KPX Aacute uhungarumlaut -20
+KPX Aacute umacron -20
+KPX Aacute uogonek -20
+KPX Aacute uring -20
+KPX Aacute v -55
+KPX Aacute w -55
+KPX Aacute y -55
+KPX Aacute yacute -55
+KPX Aacute ydieresis -55
+KPX Abreve C -30
+KPX Abreve Cacute -30
+KPX Abreve Ccaron -30
+KPX Abreve Ccedilla -30
+KPX Abreve G -35
+KPX Abreve Gbreve -35
+KPX Abreve Gcommaaccent -35
+KPX Abreve O -40
+KPX Abreve Oacute -40
+KPX Abreve Ocircumflex -40
+KPX Abreve Odieresis -40
+KPX Abreve Ograve -40
+KPX Abreve Ohungarumlaut -40
+KPX Abreve Omacron -40
+KPX Abreve Oslash -40
+KPX Abreve Otilde -40
+KPX Abreve Q -40
+KPX Abreve T -37
+KPX Abreve Tcaron -37
+KPX Abreve Tcommaaccent -37
+KPX Abreve U -50
+KPX Abreve Uacute -50
+KPX Abreve Ucircumflex -50
+KPX Abreve Udieresis -50
+KPX Abreve Ugrave -50
+KPX Abreve Uhungarumlaut -50
+KPX Abreve Umacron -50
+KPX Abreve Uogonek -50
+KPX Abreve Uring -50
+KPX Abreve V -105
+KPX Abreve W -95
+KPX Abreve Y -55
+KPX Abreve Yacute -55
+KPX Abreve Ydieresis -55
+KPX Abreve quoteright -37
+KPX Abreve u -20
+KPX Abreve uacute -20
+KPX Abreve ucircumflex -20
+KPX Abreve udieresis -20
+KPX Abreve ugrave -20
+KPX Abreve uhungarumlaut -20
+KPX Abreve umacron -20
+KPX Abreve uogonek -20
+KPX Abreve uring -20
+KPX Abreve v -55
+KPX Abreve w -55
+KPX Abreve y -55
+KPX Abreve yacute -55
+KPX Abreve ydieresis -55
+KPX Acircumflex C -30
+KPX Acircumflex Cacute -30
+KPX Acircumflex Ccaron -30
+KPX Acircumflex Ccedilla -30
+KPX Acircumflex G -35
+KPX Acircumflex Gbreve -35
+KPX Acircumflex Gcommaaccent -35
+KPX Acircumflex O -40
+KPX Acircumflex Oacute -40
+KPX Acircumflex Ocircumflex -40
+KPX Acircumflex Odieresis -40
+KPX Acircumflex Ograve -40
+KPX Acircumflex Ohungarumlaut -40
+KPX Acircumflex Omacron -40
+KPX Acircumflex Oslash -40
+KPX Acircumflex Otilde -40
+KPX Acircumflex Q -40
+KPX Acircumflex T -37
+KPX Acircumflex Tcaron -37
+KPX Acircumflex Tcommaaccent -37
+KPX Acircumflex U -50
+KPX Acircumflex Uacute -50
+KPX Acircumflex Ucircumflex -50
+KPX Acircumflex Udieresis -50
+KPX Acircumflex Ugrave -50
+KPX Acircumflex Uhungarumlaut -50
+KPX Acircumflex Umacron -50
+KPX Acircumflex Uogonek -50
+KPX Acircumflex Uring -50
+KPX Acircumflex V -105
+KPX Acircumflex W -95
+KPX Acircumflex Y -55
+KPX Acircumflex Yacute -55
+KPX Acircumflex Ydieresis -55
+KPX Acircumflex quoteright -37
+KPX Acircumflex u -20
+KPX Acircumflex uacute -20
+KPX Acircumflex ucircumflex -20
+KPX Acircumflex udieresis -20
+KPX Acircumflex ugrave -20
+KPX Acircumflex uhungarumlaut -20
+KPX Acircumflex umacron -20
+KPX Acircumflex uogonek -20
+KPX Acircumflex uring -20
+KPX Acircumflex v -55
+KPX Acircumflex w -55
+KPX Acircumflex y -55
+KPX Acircumflex yacute -55
+KPX Acircumflex ydieresis -55
+KPX Adieresis C -30
+KPX Adieresis Cacute -30
+KPX Adieresis Ccaron -30
+KPX Adieresis Ccedilla -30
+KPX Adieresis G -35
+KPX Adieresis Gbreve -35
+KPX Adieresis Gcommaaccent -35
+KPX Adieresis O -40
+KPX Adieresis Oacute -40
+KPX Adieresis Ocircumflex -40
+KPX Adieresis Odieresis -40
+KPX Adieresis Ograve -40
+KPX Adieresis Ohungarumlaut -40
+KPX Adieresis Omacron -40
+KPX Adieresis Oslash -40
+KPX Adieresis Otilde -40
+KPX Adieresis Q -40
+KPX Adieresis T -37
+KPX Adieresis Tcaron -37
+KPX Adieresis Tcommaaccent -37
+KPX Adieresis U -50
+KPX Adieresis Uacute -50
+KPX Adieresis Ucircumflex -50
+KPX Adieresis Udieresis -50
+KPX Adieresis Ugrave -50
+KPX Adieresis Uhungarumlaut -50
+KPX Adieresis Umacron -50
+KPX Adieresis Uogonek -50
+KPX Adieresis Uring -50
+KPX Adieresis V -105
+KPX Adieresis W -95
+KPX Adieresis Y -55
+KPX Adieresis Yacute -55
+KPX Adieresis Ydieresis -55
+KPX Adieresis quoteright -37
+KPX Adieresis u -20
+KPX Adieresis uacute -20
+KPX Adieresis ucircumflex -20
+KPX Adieresis udieresis -20
+KPX Adieresis ugrave -20
+KPX Adieresis uhungarumlaut -20
+KPX Adieresis umacron -20
+KPX Adieresis uogonek -20
+KPX Adieresis uring -20
+KPX Adieresis v -55
+KPX Adieresis w -55
+KPX Adieresis y -55
+KPX Adieresis yacute -55
+KPX Adieresis ydieresis -55
+KPX Agrave C -30
+KPX Agrave Cacute -30
+KPX Agrave Ccaron -30
+KPX Agrave Ccedilla -30
+KPX Agrave G -35
+KPX Agrave Gbreve -35
+KPX Agrave Gcommaaccent -35
+KPX Agrave O -40
+KPX Agrave Oacute -40
+KPX Agrave Ocircumflex -40
+KPX Agrave Odieresis -40
+KPX Agrave Ograve -40
+KPX Agrave Ohungarumlaut -40
+KPX Agrave Omacron -40
+KPX Agrave Oslash -40
+KPX Agrave Otilde -40
+KPX Agrave Q -40
+KPX Agrave T -37
+KPX Agrave Tcaron -37
+KPX Agrave Tcommaaccent -37
+KPX Agrave U -50
+KPX Agrave Uacute -50
+KPX Agrave Ucircumflex -50
+KPX Agrave Udieresis -50
+KPX Agrave Ugrave -50
+KPX Agrave Uhungarumlaut -50
+KPX Agrave Umacron -50
+KPX Agrave Uogonek -50
+KPX Agrave Uring -50
+KPX Agrave V -105
+KPX Agrave W -95
+KPX Agrave Y -55
+KPX Agrave Yacute -55
+KPX Agrave Ydieresis -55
+KPX Agrave quoteright -37
+KPX Agrave u -20
+KPX Agrave uacute -20
+KPX Agrave ucircumflex -20
+KPX Agrave udieresis -20
+KPX Agrave ugrave -20
+KPX Agrave uhungarumlaut -20
+KPX Agrave umacron -20
+KPX Agrave uogonek -20
+KPX Agrave uring -20
+KPX Agrave v -55
+KPX Agrave w -55
+KPX Agrave y -55
+KPX Agrave yacute -55
+KPX Agrave ydieresis -55
+KPX Amacron C -30
+KPX Amacron Cacute -30
+KPX Amacron Ccaron -30
+KPX Amacron Ccedilla -30
+KPX Amacron G -35
+KPX Amacron Gbreve -35
+KPX Amacron Gcommaaccent -35
+KPX Amacron O -40
+KPX Amacron Oacute -40
+KPX Amacron Ocircumflex -40
+KPX Amacron Odieresis -40
+KPX Amacron Ograve -40
+KPX Amacron Ohungarumlaut -40
+KPX Amacron Omacron -40
+KPX Amacron Oslash -40
+KPX Amacron Otilde -40
+KPX Amacron Q -40
+KPX Amacron T -37
+KPX Amacron Tcaron -37
+KPX Amacron Tcommaaccent -37
+KPX Amacron U -50
+KPX Amacron Uacute -50
+KPX Amacron Ucircumflex -50
+KPX Amacron Udieresis -50
+KPX Amacron Ugrave -50
+KPX Amacron Uhungarumlaut -50
+KPX Amacron Umacron -50
+KPX Amacron Uogonek -50
+KPX Amacron Uring -50
+KPX Amacron V -105
+KPX Amacron W -95
+KPX Amacron Y -55
+KPX Amacron Yacute -55
+KPX Amacron Ydieresis -55
+KPX Amacron quoteright -37
+KPX Amacron u -20
+KPX Amacron uacute -20
+KPX Amacron ucircumflex -20
+KPX Amacron udieresis -20
+KPX Amacron ugrave -20
+KPX Amacron uhungarumlaut -20
+KPX Amacron umacron -20
+KPX Amacron uogonek -20
+KPX Amacron uring -20
+KPX Amacron v -55
+KPX Amacron w -55
+KPX Amacron y -55
+KPX Amacron yacute -55
+KPX Amacron ydieresis -55
+KPX Aogonek C -30
+KPX Aogonek Cacute -30
+KPX Aogonek Ccaron -30
+KPX Aogonek Ccedilla -30
+KPX Aogonek G -35
+KPX Aogonek Gbreve -35
+KPX Aogonek Gcommaaccent -35
+KPX Aogonek O -40
+KPX Aogonek Oacute -40
+KPX Aogonek Ocircumflex -40
+KPX Aogonek Odieresis -40
+KPX Aogonek Ograve -40
+KPX Aogonek Ohungarumlaut -40
+KPX Aogonek Omacron -40
+KPX Aogonek Oslash -40
+KPX Aogonek Otilde -40
+KPX Aogonek Q -40
+KPX Aogonek T -37
+KPX Aogonek Tcaron -37
+KPX Aogonek Tcommaaccent -37
+KPX Aogonek U -50
+KPX Aogonek Uacute -50
+KPX Aogonek Ucircumflex -50
+KPX Aogonek Udieresis -50
+KPX Aogonek Ugrave -50
+KPX Aogonek Uhungarumlaut -50
+KPX Aogonek Umacron -50
+KPX Aogonek Uogonek -50
+KPX Aogonek Uring -50
+KPX Aogonek V -105
+KPX Aogonek W -95
+KPX Aogonek Y -55
+KPX Aogonek Yacute -55
+KPX Aogonek Ydieresis -55
+KPX Aogonek quoteright -37
+KPX Aogonek u -20
+KPX Aogonek uacute -20
+KPX Aogonek ucircumflex -20
+KPX Aogonek udieresis -20
+KPX Aogonek ugrave -20
+KPX Aogonek uhungarumlaut -20
+KPX Aogonek umacron -20
+KPX Aogonek uogonek -20
+KPX Aogonek uring -20
+KPX Aogonek v -55
+KPX Aogonek w -55
+KPX Aogonek y -55
+KPX Aogonek yacute -55
+KPX Aogonek ydieresis -55
+KPX Aring C -30
+KPX Aring Cacute -30
+KPX Aring Ccaron -30
+KPX Aring Ccedilla -30
+KPX Aring G -35
+KPX Aring Gbreve -35
+KPX Aring Gcommaaccent -35
+KPX Aring O -40
+KPX Aring Oacute -40
+KPX Aring Ocircumflex -40
+KPX Aring Odieresis -40
+KPX Aring Ograve -40
+KPX Aring Ohungarumlaut -40
+KPX Aring Omacron -40
+KPX Aring Oslash -40
+KPX Aring Otilde -40
+KPX Aring Q -40
+KPX Aring T -37
+KPX Aring Tcaron -37
+KPX Aring Tcommaaccent -37
+KPX Aring U -50
+KPX Aring Uacute -50
+KPX Aring Ucircumflex -50
+KPX Aring Udieresis -50
+KPX Aring Ugrave -50
+KPX Aring Uhungarumlaut -50
+KPX Aring Umacron -50
+KPX Aring Uogonek -50
+KPX Aring Uring -50
+KPX Aring V -105
+KPX Aring W -95
+KPX Aring Y -55
+KPX Aring Yacute -55
+KPX Aring Ydieresis -55
+KPX Aring quoteright -37
+KPX Aring u -20
+KPX Aring uacute -20
+KPX Aring ucircumflex -20
+KPX Aring udieresis -20
+KPX Aring ugrave -20
+KPX Aring uhungarumlaut -20
+KPX Aring umacron -20
+KPX Aring uogonek -20
+KPX Aring uring -20
+KPX Aring v -55
+KPX Aring w -55
+KPX Aring y -55
+KPX Aring yacute -55
+KPX Aring ydieresis -55
+KPX Atilde C -30
+KPX Atilde Cacute -30
+KPX Atilde Ccaron -30
+KPX Atilde Ccedilla -30
+KPX Atilde G -35
+KPX Atilde Gbreve -35
+KPX Atilde Gcommaaccent -35
+KPX Atilde O -40
+KPX Atilde Oacute -40
+KPX Atilde Ocircumflex -40
+KPX Atilde Odieresis -40
+KPX Atilde Ograve -40
+KPX Atilde Ohungarumlaut -40
+KPX Atilde Omacron -40
+KPX Atilde Oslash -40
+KPX Atilde Otilde -40
+KPX Atilde Q -40
+KPX Atilde T -37
+KPX Atilde Tcaron -37
+KPX Atilde Tcommaaccent -37
+KPX Atilde U -50
+KPX Atilde Uacute -50
+KPX Atilde Ucircumflex -50
+KPX Atilde Udieresis -50
+KPX Atilde Ugrave -50
+KPX Atilde Uhungarumlaut -50
+KPX Atilde Umacron -50
+KPX Atilde Uogonek -50
+KPX Atilde Uring -50
+KPX Atilde V -105
+KPX Atilde W -95
+KPX Atilde Y -55
+KPX Atilde Yacute -55
+KPX Atilde Ydieresis -55
+KPX Atilde quoteright -37
+KPX Atilde u -20
+KPX Atilde uacute -20
+KPX Atilde ucircumflex -20
+KPX Atilde udieresis -20
+KPX Atilde ugrave -20
+KPX Atilde uhungarumlaut -20
+KPX Atilde umacron -20
+KPX Atilde uogonek -20
+KPX Atilde uring -20
+KPX Atilde v -55
+KPX Atilde w -55
+KPX Atilde y -55
+KPX Atilde yacute -55
+KPX Atilde ydieresis -55
+KPX B A -25
+KPX B Aacute -25
+KPX B Abreve -25
+KPX B Acircumflex -25
+KPX B Adieresis -25
+KPX B Agrave -25
+KPX B Amacron -25
+KPX B Aogonek -25
+KPX B Aring -25
+KPX B Atilde -25
+KPX B U -10
+KPX B Uacute -10
+KPX B Ucircumflex -10
+KPX B Udieresis -10
+KPX B Ugrave -10
+KPX B Uhungarumlaut -10
+KPX B Umacron -10
+KPX B Uogonek -10
+KPX B Uring -10
+KPX D A -35
+KPX D Aacute -35
+KPX D Abreve -35
+KPX D Acircumflex -35
+KPX D Adieresis -35
+KPX D Agrave -35
+KPX D Amacron -35
+KPX D Aogonek -35
+KPX D Aring -35
+KPX D Atilde -35
+KPX D V -40
+KPX D W -40
+KPX D Y -40
+KPX D Yacute -40
+KPX D Ydieresis -40
+KPX Dcaron A -35
+KPX Dcaron Aacute -35
+KPX Dcaron Abreve -35
+KPX Dcaron Acircumflex -35
+KPX Dcaron Adieresis -35
+KPX Dcaron Agrave -35
+KPX Dcaron Amacron -35
+KPX Dcaron Aogonek -35
+KPX Dcaron Aring -35
+KPX Dcaron Atilde -35
+KPX Dcaron V -40
+KPX Dcaron W -40
+KPX Dcaron Y -40
+KPX Dcaron Yacute -40
+KPX Dcaron Ydieresis -40
+KPX Dcroat A -35
+KPX Dcroat Aacute -35
+KPX Dcroat Abreve -35
+KPX Dcroat Acircumflex -35
+KPX Dcroat Adieresis -35
+KPX Dcroat Agrave -35
+KPX Dcroat Amacron -35
+KPX Dcroat Aogonek -35
+KPX Dcroat Aring -35
+KPX Dcroat Atilde -35
+KPX Dcroat V -40
+KPX Dcroat W -40
+KPX Dcroat Y -40
+KPX Dcroat Yacute -40
+KPX Dcroat Ydieresis -40
+KPX F A -115
+KPX F Aacute -115
+KPX F Abreve -115
+KPX F Acircumflex -115
+KPX F Adieresis -115
+KPX F Agrave -115
+KPX F Amacron -115
+KPX F Aogonek -115
+KPX F Aring -115
+KPX F Atilde -115
+KPX F a -75
+KPX F aacute -75
+KPX F abreve -75
+KPX F acircumflex -75
+KPX F adieresis -75
+KPX F agrave -75
+KPX F amacron -75
+KPX F aogonek -75
+KPX F aring -75
+KPX F atilde -75
+KPX F comma -135
+KPX F e -75
+KPX F eacute -75
+KPX F ecaron -75
+KPX F ecircumflex -75
+KPX F edieresis -75
+KPX F edotaccent -75
+KPX F egrave -75
+KPX F emacron -75
+KPX F eogonek -75
+KPX F i -45
+KPX F iacute -45
+KPX F icircumflex -45
+KPX F idieresis -45
+KPX F igrave -45
+KPX F imacron -45
+KPX F iogonek -45
+KPX F o -105
+KPX F oacute -105
+KPX F ocircumflex -105
+KPX F odieresis -105
+KPX F ograve -105
+KPX F ohungarumlaut -105
+KPX F omacron -105
+KPX F oslash -105
+KPX F otilde -105
+KPX F period -135
+KPX F r -55
+KPX F racute -55
+KPX F rcaron -55
+KPX F rcommaaccent -55
+KPX J A -40
+KPX J Aacute -40
+KPX J Abreve -40
+KPX J Acircumflex -40
+KPX J Adieresis -40
+KPX J Agrave -40
+KPX J Amacron -40
+KPX J Aogonek -40
+KPX J Aring -40
+KPX J Atilde -40
+KPX J a -35
+KPX J aacute -35
+KPX J abreve -35
+KPX J acircumflex -35
+KPX J adieresis -35
+KPX J agrave -35
+KPX J amacron -35
+KPX J aogonek -35
+KPX J aring -35
+KPX J atilde -35
+KPX J comma -25
+KPX J e -25
+KPX J eacute -25
+KPX J ecaron -25
+KPX J ecircumflex -25
+KPX J edieresis -25
+KPX J edotaccent -25
+KPX J egrave -25
+KPX J emacron -25
+KPX J eogonek -25
+KPX J o -25
+KPX J oacute -25
+KPX J ocircumflex -25
+KPX J odieresis -25
+KPX J ograve -25
+KPX J ohungarumlaut -25
+KPX J omacron -25
+KPX J oslash -25
+KPX J otilde -25
+KPX J period -25
+KPX J u -35
+KPX J uacute -35
+KPX J ucircumflex -35
+KPX J udieresis -35
+KPX J ugrave -35
+KPX J uhungarumlaut -35
+KPX J umacron -35
+KPX J uogonek -35
+KPX J uring -35
+KPX K O -50
+KPX K Oacute -50
+KPX K Ocircumflex -50
+KPX K Odieresis -50
+KPX K Ograve -50
+KPX K Ohungarumlaut -50
+KPX K Omacron -50
+KPX K Oslash -50
+KPX K Otilde -50
+KPX K e -35
+KPX K eacute -35
+KPX K ecaron -35
+KPX K ecircumflex -35
+KPX K edieresis -35
+KPX K edotaccent -35
+KPX K egrave -35
+KPX K emacron -35
+KPX K eogonek -35
+KPX K o -40
+KPX K oacute -40
+KPX K ocircumflex -40
+KPX K odieresis -40
+KPX K ograve -40
+KPX K ohungarumlaut -40
+KPX K omacron -40
+KPX K oslash -40
+KPX K otilde -40
+KPX K u -40
+KPX K uacute -40
+KPX K ucircumflex -40
+KPX K udieresis -40
+KPX K ugrave -40
+KPX K uhungarumlaut -40
+KPX K umacron -40
+KPX K uogonek -40
+KPX K uring -40
+KPX K y -40
+KPX K yacute -40
+KPX K ydieresis -40
+KPX Kcommaaccent O -50
+KPX Kcommaaccent Oacute -50
+KPX Kcommaaccent Ocircumflex -50
+KPX Kcommaaccent Odieresis -50
+KPX Kcommaaccent Ograve -50
+KPX Kcommaaccent Ohungarumlaut -50
+KPX Kcommaaccent Omacron -50
+KPX Kcommaaccent Oslash -50
+KPX Kcommaaccent Otilde -50
+KPX Kcommaaccent e -35
+KPX Kcommaaccent eacute -35
+KPX Kcommaaccent ecaron -35
+KPX Kcommaaccent ecircumflex -35
+KPX Kcommaaccent edieresis -35
+KPX Kcommaaccent edotaccent -35
+KPX Kcommaaccent egrave -35
+KPX Kcommaaccent emacron -35
+KPX Kcommaaccent eogonek -35
+KPX Kcommaaccent o -40
+KPX Kcommaaccent oacute -40
+KPX Kcommaaccent ocircumflex -40
+KPX Kcommaaccent odieresis -40
+KPX Kcommaaccent ograve -40
+KPX Kcommaaccent ohungarumlaut -40
+KPX Kcommaaccent omacron -40
+KPX Kcommaaccent oslash -40
+KPX Kcommaaccent otilde -40
+KPX Kcommaaccent u -40
+KPX Kcommaaccent uacute -40
+KPX Kcommaaccent ucircumflex -40
+KPX Kcommaaccent udieresis -40
+KPX Kcommaaccent ugrave -40
+KPX Kcommaaccent uhungarumlaut -40
+KPX Kcommaaccent umacron -40
+KPX Kcommaaccent uogonek -40
+KPX Kcommaaccent uring -40
+KPX Kcommaaccent y -40
+KPX Kcommaaccent yacute -40
+KPX Kcommaaccent ydieresis -40
+KPX L T -20
+KPX L Tcaron -20
+KPX L Tcommaaccent -20
+KPX L V -55
+KPX L W -55
+KPX L Y -20
+KPX L Yacute -20
+KPX L Ydieresis -20
+KPX L quoteright -37
+KPX L y -30
+KPX L yacute -30
+KPX L ydieresis -30
+KPX Lacute T -20
+KPX Lacute Tcaron -20
+KPX Lacute Tcommaaccent -20
+KPX Lacute V -55
+KPX Lacute W -55
+KPX Lacute Y -20
+KPX Lacute Yacute -20
+KPX Lacute Ydieresis -20
+KPX Lacute quoteright -37
+KPX Lacute y -30
+KPX Lacute yacute -30
+KPX Lacute ydieresis -30
+KPX Lcommaaccent T -20
+KPX Lcommaaccent Tcaron -20
+KPX Lcommaaccent Tcommaaccent -20
+KPX Lcommaaccent V -55
+KPX Lcommaaccent W -55
+KPX Lcommaaccent Y -20
+KPX Lcommaaccent Yacute -20
+KPX Lcommaaccent Ydieresis -20
+KPX Lcommaaccent quoteright -37
+KPX Lcommaaccent y -30
+KPX Lcommaaccent yacute -30
+KPX Lcommaaccent ydieresis -30
+KPX Lslash T -20
+KPX Lslash Tcaron -20
+KPX Lslash Tcommaaccent -20
+KPX Lslash V -55
+KPX Lslash W -55
+KPX Lslash Y -20
+KPX Lslash Yacute -20
+KPX Lslash Ydieresis -20
+KPX Lslash quoteright -37
+KPX Lslash y -30
+KPX Lslash yacute -30
+KPX Lslash ydieresis -30
+KPX N A -27
+KPX N Aacute -27
+KPX N Abreve -27
+KPX N Acircumflex -27
+KPX N Adieresis -27
+KPX N Agrave -27
+KPX N Amacron -27
+KPX N Aogonek -27
+KPX N Aring -27
+KPX N Atilde -27
+KPX Nacute A -27
+KPX Nacute Aacute -27
+KPX Nacute Abreve -27
+KPX Nacute Acircumflex -27
+KPX Nacute Adieresis -27
+KPX Nacute Agrave -27
+KPX Nacute Amacron -27
+KPX Nacute Aogonek -27
+KPX Nacute Aring -27
+KPX Nacute Atilde -27
+KPX Ncaron A -27
+KPX Ncaron Aacute -27
+KPX Ncaron Abreve -27
+KPX Ncaron Acircumflex -27
+KPX Ncaron Adieresis -27
+KPX Ncaron Agrave -27
+KPX Ncaron Amacron -27
+KPX Ncaron Aogonek -27
+KPX Ncaron Aring -27
+KPX Ncaron Atilde -27
+KPX Ncommaaccent A -27
+KPX Ncommaaccent Aacute -27
+KPX Ncommaaccent Abreve -27
+KPX Ncommaaccent Acircumflex -27
+KPX Ncommaaccent Adieresis -27
+KPX Ncommaaccent Agrave -27
+KPX Ncommaaccent Amacron -27
+KPX Ncommaaccent Aogonek -27
+KPX Ncommaaccent Aring -27
+KPX Ncommaaccent Atilde -27
+KPX Ntilde A -27
+KPX Ntilde Aacute -27
+KPX Ntilde Abreve -27
+KPX Ntilde Acircumflex -27
+KPX Ntilde Adieresis -27
+KPX Ntilde Agrave -27
+KPX Ntilde Amacron -27
+KPX Ntilde Aogonek -27
+KPX Ntilde Aring -27
+KPX Ntilde Atilde -27
+KPX O A -55
+KPX O Aacute -55
+KPX O Abreve -55
+KPX O Acircumflex -55
+KPX O Adieresis -55
+KPX O Agrave -55
+KPX O Amacron -55
+KPX O Aogonek -55
+KPX O Aring -55
+KPX O Atilde -55
+KPX O T -40
+KPX O Tcaron -40
+KPX O Tcommaaccent -40
+KPX O V -50
+KPX O W -50
+KPX O X -40
+KPX O Y -50
+KPX O Yacute -50
+KPX O Ydieresis -50
+KPX Oacute A -55
+KPX Oacute Aacute -55
+KPX Oacute Abreve -55
+KPX Oacute Acircumflex -55
+KPX Oacute Adieresis -55
+KPX Oacute Agrave -55
+KPX Oacute Amacron -55
+KPX Oacute Aogonek -55
+KPX Oacute Aring -55
+KPX Oacute Atilde -55
+KPX Oacute T -40
+KPX Oacute Tcaron -40
+KPX Oacute Tcommaaccent -40
+KPX Oacute V -50
+KPX Oacute W -50
+KPX Oacute X -40
+KPX Oacute Y -50
+KPX Oacute Yacute -50
+KPX Oacute Ydieresis -50
+KPX Ocircumflex A -55
+KPX Ocircumflex Aacute -55
+KPX Ocircumflex Abreve -55
+KPX Ocircumflex Acircumflex -55
+KPX Ocircumflex Adieresis -55
+KPX Ocircumflex Agrave -55
+KPX Ocircumflex Amacron -55
+KPX Ocircumflex Aogonek -55
+KPX Ocircumflex Aring -55
+KPX Ocircumflex Atilde -55
+KPX Ocircumflex T -40
+KPX Ocircumflex Tcaron -40
+KPX Ocircumflex Tcommaaccent -40
+KPX Ocircumflex V -50
+KPX Ocircumflex W -50
+KPX Ocircumflex X -40
+KPX Ocircumflex Y -50
+KPX Ocircumflex Yacute -50
+KPX Ocircumflex Ydieresis -50
+KPX Odieresis A -55
+KPX Odieresis Aacute -55
+KPX Odieresis Abreve -55
+KPX Odieresis Acircumflex -55
+KPX Odieresis Adieresis -55
+KPX Odieresis Agrave -55
+KPX Odieresis Amacron -55
+KPX Odieresis Aogonek -55
+KPX Odieresis Aring -55
+KPX Odieresis Atilde -55
+KPX Odieresis T -40
+KPX Odieresis Tcaron -40
+KPX Odieresis Tcommaaccent -40
+KPX Odieresis V -50
+KPX Odieresis W -50
+KPX Odieresis X -40
+KPX Odieresis Y -50
+KPX Odieresis Yacute -50
+KPX Odieresis Ydieresis -50
+KPX Ograve A -55
+KPX Ograve Aacute -55
+KPX Ograve Abreve -55
+KPX Ograve Acircumflex -55
+KPX Ograve Adieresis -55
+KPX Ograve Agrave -55
+KPX Ograve Amacron -55
+KPX Ograve Aogonek -55
+KPX Ograve Aring -55
+KPX Ograve Atilde -55
+KPX Ograve T -40
+KPX Ograve Tcaron -40
+KPX Ograve Tcommaaccent -40
+KPX Ograve V -50
+KPX Ograve W -50
+KPX Ograve X -40
+KPX Ograve Y -50
+KPX Ograve Yacute -50
+KPX Ograve Ydieresis -50
+KPX Ohungarumlaut A -55
+KPX Ohungarumlaut Aacute -55
+KPX Ohungarumlaut Abreve -55
+KPX Ohungarumlaut Acircumflex -55
+KPX Ohungarumlaut Adieresis -55
+KPX Ohungarumlaut Agrave -55
+KPX Ohungarumlaut Amacron -55
+KPX Ohungarumlaut Aogonek -55
+KPX Ohungarumlaut Aring -55
+KPX Ohungarumlaut Atilde -55
+KPX Ohungarumlaut T -40
+KPX Ohungarumlaut Tcaron -40
+KPX Ohungarumlaut Tcommaaccent -40
+KPX Ohungarumlaut V -50
+KPX Ohungarumlaut W -50
+KPX Ohungarumlaut X -40
+KPX Ohungarumlaut Y -50
+KPX Ohungarumlaut Yacute -50
+KPX Ohungarumlaut Ydieresis -50
+KPX Omacron A -55
+KPX Omacron Aacute -55
+KPX Omacron Abreve -55
+KPX Omacron Acircumflex -55
+KPX Omacron Adieresis -55
+KPX Omacron Agrave -55
+KPX Omacron Amacron -55
+KPX Omacron Aogonek -55
+KPX Omacron Aring -55
+KPX Omacron Atilde -55
+KPX Omacron T -40
+KPX Omacron Tcaron -40
+KPX Omacron Tcommaaccent -40
+KPX Omacron V -50
+KPX Omacron W -50
+KPX Omacron X -40
+KPX Omacron Y -50
+KPX Omacron Yacute -50
+KPX Omacron Ydieresis -50
+KPX Oslash A -55
+KPX Oslash Aacute -55
+KPX Oslash Abreve -55
+KPX Oslash Acircumflex -55
+KPX Oslash Adieresis -55
+KPX Oslash Agrave -55
+KPX Oslash Amacron -55
+KPX Oslash Aogonek -55
+KPX Oslash Aring -55
+KPX Oslash Atilde -55
+KPX Oslash T -40
+KPX Oslash Tcaron -40
+KPX Oslash Tcommaaccent -40
+KPX Oslash V -50
+KPX Oslash W -50
+KPX Oslash X -40
+KPX Oslash Y -50
+KPX Oslash Yacute -50
+KPX Oslash Ydieresis -50
+KPX Otilde A -55
+KPX Otilde Aacute -55
+KPX Otilde Abreve -55
+KPX Otilde Acircumflex -55
+KPX Otilde Adieresis -55
+KPX Otilde Agrave -55
+KPX Otilde Amacron -55
+KPX Otilde Aogonek -55
+KPX Otilde Aring -55
+KPX Otilde Atilde -55
+KPX Otilde T -40
+KPX Otilde Tcaron -40
+KPX Otilde Tcommaaccent -40
+KPX Otilde V -50
+KPX Otilde W -50
+KPX Otilde X -40
+KPX Otilde Y -50
+KPX Otilde Yacute -50
+KPX Otilde Ydieresis -50
+KPX P A -90
+KPX P Aacute -90
+KPX P Abreve -90
+KPX P Acircumflex -90
+KPX P Adieresis -90
+KPX P Agrave -90
+KPX P Amacron -90
+KPX P Aogonek -90
+KPX P Aring -90
+KPX P Atilde -90
+KPX P a -80
+KPX P aacute -80
+KPX P abreve -80
+KPX P acircumflex -80
+KPX P adieresis -80
+KPX P agrave -80
+KPX P amacron -80
+KPX P aogonek -80
+KPX P aring -80
+KPX P atilde -80
+KPX P comma -135
+KPX P e -80
+KPX P eacute -80
+KPX P ecaron -80
+KPX P ecircumflex -80
+KPX P edieresis -80
+KPX P edotaccent -80
+KPX P egrave -80
+KPX P emacron -80
+KPX P eogonek -80
+KPX P o -80
+KPX P oacute -80
+KPX P ocircumflex -80
+KPX P odieresis -80
+KPX P ograve -80
+KPX P ohungarumlaut -80
+KPX P omacron -80
+KPX P oslash -80
+KPX P otilde -80
+KPX P period -135
+KPX Q U -10
+KPX Q Uacute -10
+KPX Q Ucircumflex -10
+KPX Q Udieresis -10
+KPX Q Ugrave -10
+KPX Q Uhungarumlaut -10
+KPX Q Umacron -10
+KPX Q Uogonek -10
+KPX Q Uring -10
+KPX R O -40
+KPX R Oacute -40
+KPX R Ocircumflex -40
+KPX R Odieresis -40
+KPX R Ograve -40
+KPX R Ohungarumlaut -40
+KPX R Omacron -40
+KPX R Oslash -40
+KPX R Otilde -40
+KPX R U -40
+KPX R Uacute -40
+KPX R Ucircumflex -40
+KPX R Udieresis -40
+KPX R Ugrave -40
+KPX R Uhungarumlaut -40
+KPX R Umacron -40
+KPX R Uogonek -40
+KPX R Uring -40
+KPX R V -18
+KPX R W -18
+KPX R Y -18
+KPX R Yacute -18
+KPX R Ydieresis -18
+KPX Racute O -40
+KPX Racute Oacute -40
+KPX Racute Ocircumflex -40
+KPX Racute Odieresis -40
+KPX Racute Ograve -40
+KPX Racute Ohungarumlaut -40
+KPX Racute Omacron -40
+KPX Racute Oslash -40
+KPX Racute Otilde -40
+KPX Racute U -40
+KPX Racute Uacute -40
+KPX Racute Ucircumflex -40
+KPX Racute Udieresis -40
+KPX Racute Ugrave -40
+KPX Racute Uhungarumlaut -40
+KPX Racute Umacron -40
+KPX Racute Uogonek -40
+KPX Racute Uring -40
+KPX Racute V -18
+KPX Racute W -18
+KPX Racute Y -18
+KPX Racute Yacute -18
+KPX Racute Ydieresis -18
+KPX Rcaron O -40
+KPX Rcaron Oacute -40
+KPX Rcaron Ocircumflex -40
+KPX Rcaron Odieresis -40
+KPX Rcaron Ograve -40
+KPX Rcaron Ohungarumlaut -40
+KPX Rcaron Omacron -40
+KPX Rcaron Oslash -40
+KPX Rcaron Otilde -40
+KPX Rcaron U -40
+KPX Rcaron Uacute -40
+KPX Rcaron Ucircumflex -40
+KPX Rcaron Udieresis -40
+KPX Rcaron Ugrave -40
+KPX Rcaron Uhungarumlaut -40
+KPX Rcaron Umacron -40
+KPX Rcaron Uogonek -40
+KPX Rcaron Uring -40
+KPX Rcaron V -18
+KPX Rcaron W -18
+KPX Rcaron Y -18
+KPX Rcaron Yacute -18
+KPX Rcaron Ydieresis -18
+KPX Rcommaaccent O -40
+KPX Rcommaaccent Oacute -40
+KPX Rcommaaccent Ocircumflex -40
+KPX Rcommaaccent Odieresis -40
+KPX Rcommaaccent Ograve -40
+KPX Rcommaaccent Ohungarumlaut -40
+KPX Rcommaaccent Omacron -40
+KPX Rcommaaccent Oslash -40
+KPX Rcommaaccent Otilde -40
+KPX Rcommaaccent U -40
+KPX Rcommaaccent Uacute -40
+KPX Rcommaaccent Ucircumflex -40
+KPX Rcommaaccent Udieresis -40
+KPX Rcommaaccent Ugrave -40
+KPX Rcommaaccent Uhungarumlaut -40
+KPX Rcommaaccent Umacron -40
+KPX Rcommaaccent Uogonek -40
+KPX Rcommaaccent Uring -40
+KPX Rcommaaccent V -18
+KPX Rcommaaccent W -18
+KPX Rcommaaccent Y -18
+KPX Rcommaaccent Yacute -18
+KPX Rcommaaccent Ydieresis -18
+KPX T A -50
+KPX T Aacute -50
+KPX T Abreve -50
+KPX T Acircumflex -50
+KPX T Adieresis -50
+KPX T Agrave -50
+KPX T Amacron -50
+KPX T Aogonek -50
+KPX T Aring -50
+KPX T Atilde -50
+KPX T O -18
+KPX T Oacute -18
+KPX T Ocircumflex -18
+KPX T Odieresis -18
+KPX T Ograve -18
+KPX T Ohungarumlaut -18
+KPX T Omacron -18
+KPX T Oslash -18
+KPX T Otilde -18
+KPX T a -92
+KPX T aacute -92
+KPX T abreve -92
+KPX T acircumflex -92
+KPX T adieresis -92
+KPX T agrave -92
+KPX T amacron -92
+KPX T aogonek -92
+KPX T aring -92
+KPX T atilde -92
+KPX T colon -55
+KPX T comma -74
+KPX T e -92
+KPX T eacute -92
+KPX T ecaron -92
+KPX T ecircumflex -52
+KPX T edieresis -52
+KPX T edotaccent -92
+KPX T egrave -52
+KPX T emacron -52
+KPX T eogonek -92
+KPX T hyphen -74
+KPX T i -55
+KPX T iacute -55
+KPX T iogonek -55
+KPX T o -92
+KPX T oacute -92
+KPX T ocircumflex -92
+KPX T odieresis -92
+KPX T ograve -92
+KPX T ohungarumlaut -92
+KPX T omacron -92
+KPX T oslash -92
+KPX T otilde -92
+KPX T period -74
+KPX T r -55
+KPX T racute -55
+KPX T rcaron -55
+KPX T rcommaaccent -55
+KPX T semicolon -65
+KPX T u -55
+KPX T uacute -55
+KPX T ucircumflex -55
+KPX T udieresis -55
+KPX T ugrave -55
+KPX T uhungarumlaut -55
+KPX T umacron -55
+KPX T uogonek -55
+KPX T uring -55
+KPX T w -74
+KPX T y -74
+KPX T yacute -74
+KPX T ydieresis -34
+KPX Tcaron A -50
+KPX Tcaron Aacute -50
+KPX Tcaron Abreve -50
+KPX Tcaron Acircumflex -50
+KPX Tcaron Adieresis -50
+KPX Tcaron Agrave -50
+KPX Tcaron Amacron -50
+KPX Tcaron Aogonek -50
+KPX Tcaron Aring -50
+KPX Tcaron Atilde -50
+KPX Tcaron O -18
+KPX Tcaron Oacute -18
+KPX Tcaron Ocircumflex -18
+KPX Tcaron Odieresis -18
+KPX Tcaron Ograve -18
+KPX Tcaron Ohungarumlaut -18
+KPX Tcaron Omacron -18
+KPX Tcaron Oslash -18
+KPX Tcaron Otilde -18
+KPX Tcaron a -92
+KPX Tcaron aacute -92
+KPX Tcaron abreve -92
+KPX Tcaron acircumflex -92
+KPX Tcaron adieresis -92
+KPX Tcaron agrave -92
+KPX Tcaron amacron -92
+KPX Tcaron aogonek -92
+KPX Tcaron aring -92
+KPX Tcaron atilde -92
+KPX Tcaron colon -55
+KPX Tcaron comma -74
+KPX Tcaron e -92
+KPX Tcaron eacute -92
+KPX Tcaron ecaron -92
+KPX Tcaron ecircumflex -52
+KPX Tcaron edieresis -52
+KPX Tcaron edotaccent -92
+KPX Tcaron egrave -52
+KPX Tcaron emacron -52
+KPX Tcaron eogonek -92
+KPX Tcaron hyphen -74
+KPX Tcaron i -55
+KPX Tcaron iacute -55
+KPX Tcaron iogonek -55
+KPX Tcaron o -92
+KPX Tcaron oacute -92
+KPX Tcaron ocircumflex -92
+KPX Tcaron odieresis -92
+KPX Tcaron ograve -92
+KPX Tcaron ohungarumlaut -92
+KPX Tcaron omacron -92
+KPX Tcaron oslash -92
+KPX Tcaron otilde -92
+KPX Tcaron period -74
+KPX Tcaron r -55
+KPX Tcaron racute -55
+KPX Tcaron rcaron -55
+KPX Tcaron rcommaaccent -55
+KPX Tcaron semicolon -65
+KPX Tcaron u -55
+KPX Tcaron uacute -55
+KPX Tcaron ucircumflex -55
+KPX Tcaron udieresis -55
+KPX Tcaron ugrave -55
+KPX Tcaron uhungarumlaut -55
+KPX Tcaron umacron -55
+KPX Tcaron uogonek -55
+KPX Tcaron uring -55
+KPX Tcaron w -74
+KPX Tcaron y -74
+KPX Tcaron yacute -74
+KPX Tcaron ydieresis -34
+KPX Tcommaaccent A -50
+KPX Tcommaaccent Aacute -50
+KPX Tcommaaccent Abreve -50
+KPX Tcommaaccent Acircumflex -50
+KPX Tcommaaccent Adieresis -50
+KPX Tcommaaccent Agrave -50
+KPX Tcommaaccent Amacron -50
+KPX Tcommaaccent Aogonek -50
+KPX Tcommaaccent Aring -50
+KPX Tcommaaccent Atilde -50
+KPX Tcommaaccent O -18
+KPX Tcommaaccent Oacute -18
+KPX Tcommaaccent Ocircumflex -18
+KPX Tcommaaccent Odieresis -18
+KPX Tcommaaccent Ograve -18
+KPX Tcommaaccent Ohungarumlaut -18
+KPX Tcommaaccent Omacron -18
+KPX Tcommaaccent Oslash -18
+KPX Tcommaaccent Otilde -18
+KPX Tcommaaccent a -92
+KPX Tcommaaccent aacute -92
+KPX Tcommaaccent abreve -92
+KPX Tcommaaccent acircumflex -92
+KPX Tcommaaccent adieresis -92
+KPX Tcommaaccent agrave -92
+KPX Tcommaaccent amacron -92
+KPX Tcommaaccent aogonek -92
+KPX Tcommaaccent aring -92
+KPX Tcommaaccent atilde -92
+KPX Tcommaaccent colon -55
+KPX Tcommaaccent comma -74
+KPX Tcommaaccent e -92
+KPX Tcommaaccent eacute -92
+KPX Tcommaaccent ecaron -92
+KPX Tcommaaccent ecircumflex -52
+KPX Tcommaaccent edieresis -52
+KPX Tcommaaccent edotaccent -92
+KPX Tcommaaccent egrave -52
+KPX Tcommaaccent emacron -52
+KPX Tcommaaccent eogonek -92
+KPX Tcommaaccent hyphen -74
+KPX Tcommaaccent i -55
+KPX Tcommaaccent iacute -55
+KPX Tcommaaccent iogonek -55
+KPX Tcommaaccent o -92
+KPX Tcommaaccent oacute -92
+KPX Tcommaaccent ocircumflex -92
+KPX Tcommaaccent odieresis -92
+KPX Tcommaaccent ograve -92
+KPX Tcommaaccent ohungarumlaut -92
+KPX Tcommaaccent omacron -92
+KPX Tcommaaccent oslash -92
+KPX Tcommaaccent otilde -92
+KPX Tcommaaccent period -74
+KPX Tcommaaccent r -55
+KPX Tcommaaccent racute -55
+KPX Tcommaaccent rcaron -55
+KPX Tcommaaccent rcommaaccent -55
+KPX Tcommaaccent semicolon -65
+KPX Tcommaaccent u -55
+KPX Tcommaaccent uacute -55
+KPX Tcommaaccent ucircumflex -55
+KPX Tcommaaccent udieresis -55
+KPX Tcommaaccent ugrave -55
+KPX Tcommaaccent uhungarumlaut -55
+KPX Tcommaaccent umacron -55
+KPX Tcommaaccent uogonek -55
+KPX Tcommaaccent uring -55
+KPX Tcommaaccent w -74
+KPX Tcommaaccent y -74
+KPX Tcommaaccent yacute -74
+KPX Tcommaaccent ydieresis -34
+KPX U A -40
+KPX U Aacute -40
+KPX U Abreve -40
+KPX U Acircumflex -40
+KPX U Adieresis -40
+KPX U Agrave -40
+KPX U Amacron -40
+KPX U Aogonek -40
+KPX U Aring -40
+KPX U Atilde -40
+KPX U comma -25
+KPX U period -25
+KPX Uacute A -40
+KPX Uacute Aacute -40
+KPX Uacute Abreve -40
+KPX Uacute Acircumflex -40
+KPX Uacute Adieresis -40
+KPX Uacute Agrave -40
+KPX Uacute Amacron -40
+KPX Uacute Aogonek -40
+KPX Uacute Aring -40
+KPX Uacute Atilde -40
+KPX Uacute comma -25
+KPX Uacute period -25
+KPX Ucircumflex A -40
+KPX Ucircumflex Aacute -40
+KPX Ucircumflex Abreve -40
+KPX Ucircumflex Acircumflex -40
+KPX Ucircumflex Adieresis -40
+KPX Ucircumflex Agrave -40
+KPX Ucircumflex Amacron -40
+KPX Ucircumflex Aogonek -40
+KPX Ucircumflex Aring -40
+KPX Ucircumflex Atilde -40
+KPX Ucircumflex comma -25
+KPX Ucircumflex period -25
+KPX Udieresis A -40
+KPX Udieresis Aacute -40
+KPX Udieresis Abreve -40
+KPX Udieresis Acircumflex -40
+KPX Udieresis Adieresis -40
+KPX Udieresis Agrave -40
+KPX Udieresis Amacron -40
+KPX Udieresis Aogonek -40
+KPX Udieresis Aring -40
+KPX Udieresis Atilde -40
+KPX Udieresis comma -25
+KPX Udieresis period -25
+KPX Ugrave A -40
+KPX Ugrave Aacute -40
+KPX Ugrave Abreve -40
+KPX Ugrave Acircumflex -40
+KPX Ugrave Adieresis -40
+KPX Ugrave Agrave -40
+KPX Ugrave Amacron -40
+KPX Ugrave Aogonek -40
+KPX Ugrave Aring -40
+KPX Ugrave Atilde -40
+KPX Ugrave comma -25
+KPX Ugrave period -25
+KPX Uhungarumlaut A -40
+KPX Uhungarumlaut Aacute -40
+KPX Uhungarumlaut Abreve -40
+KPX Uhungarumlaut Acircumflex -40
+KPX Uhungarumlaut Adieresis -40
+KPX Uhungarumlaut Agrave -40
+KPX Uhungarumlaut Amacron -40
+KPX Uhungarumlaut Aogonek -40
+KPX Uhungarumlaut Aring -40
+KPX Uhungarumlaut Atilde -40
+KPX Uhungarumlaut comma -25
+KPX Uhungarumlaut period -25
+KPX Umacron A -40
+KPX Umacron Aacute -40
+KPX Umacron Abreve -40
+KPX Umacron Acircumflex -40
+KPX Umacron Adieresis -40
+KPX Umacron Agrave -40
+KPX Umacron Amacron -40
+KPX Umacron Aogonek -40
+KPX Umacron Aring -40
+KPX Umacron Atilde -40
+KPX Umacron comma -25
+KPX Umacron period -25
+KPX Uogonek A -40
+KPX Uogonek Aacute -40
+KPX Uogonek Abreve -40
+KPX Uogonek Acircumflex -40
+KPX Uogonek Adieresis -40
+KPX Uogonek Agrave -40
+KPX Uogonek Amacron -40
+KPX Uogonek Aogonek -40
+KPX Uogonek Aring -40
+KPX Uogonek Atilde -40
+KPX Uogonek comma -25
+KPX Uogonek period -25
+KPX Uring A -40
+KPX Uring Aacute -40
+KPX Uring Abreve -40
+KPX Uring Acircumflex -40
+KPX Uring Adieresis -40
+KPX Uring Agrave -40
+KPX Uring Amacron -40
+KPX Uring Aogonek -40
+KPX Uring Aring -40
+KPX Uring Atilde -40
+KPX Uring comma -25
+KPX Uring period -25
+KPX V A -60
+KPX V Aacute -60
+KPX V Abreve -60
+KPX V Acircumflex -60
+KPX V Adieresis -60
+KPX V Agrave -60
+KPX V Amacron -60
+KPX V Aogonek -60
+KPX V Aring -60
+KPX V Atilde -60
+KPX V O -30
+KPX V Oacute -30
+KPX V Ocircumflex -30
+KPX V Odieresis -30
+KPX V Ograve -30
+KPX V Ohungarumlaut -30
+KPX V Omacron -30
+KPX V Oslash -30
+KPX V Otilde -30
+KPX V a -111
+KPX V aacute -111
+KPX V abreve -111
+KPX V acircumflex -111
+KPX V adieresis -111
+KPX V agrave -111
+KPX V amacron -111
+KPX V aogonek -111
+KPX V aring -111
+KPX V atilde -111
+KPX V colon -65
+KPX V comma -129
+KPX V e -111
+KPX V eacute -111
+KPX V ecaron -111
+KPX V ecircumflex -111
+KPX V edieresis -71
+KPX V edotaccent -111
+KPX V egrave -71
+KPX V emacron -71
+KPX V eogonek -111
+KPX V hyphen -55
+KPX V i -74
+KPX V iacute -74
+KPX V icircumflex -34
+KPX V idieresis -34
+KPX V igrave -34
+KPX V imacron -34
+KPX V iogonek -74
+KPX V o -111
+KPX V oacute -111
+KPX V ocircumflex -111
+KPX V odieresis -111
+KPX V ograve -111
+KPX V ohungarumlaut -111
+KPX V omacron -111
+KPX V oslash -111
+KPX V otilde -111
+KPX V period -129
+KPX V semicolon -74
+KPX V u -74
+KPX V uacute -74
+KPX V ucircumflex -74
+KPX V udieresis -74
+KPX V ugrave -74
+KPX V uhungarumlaut -74
+KPX V umacron -74
+KPX V uogonek -74
+KPX V uring -74
+KPX W A -60
+KPX W Aacute -60
+KPX W Abreve -60
+KPX W Acircumflex -60
+KPX W Adieresis -60
+KPX W Agrave -60
+KPX W Amacron -60
+KPX W Aogonek -60
+KPX W Aring -60
+KPX W Atilde -60
+KPX W O -25
+KPX W Oacute -25
+KPX W Ocircumflex -25
+KPX W Odieresis -25
+KPX W Ograve -25
+KPX W Ohungarumlaut -25
+KPX W Omacron -25
+KPX W Oslash -25
+KPX W Otilde -25
+KPX W a -92
+KPX W aacute -92
+KPX W abreve -92
+KPX W acircumflex -92
+KPX W adieresis -92
+KPX W agrave -92
+KPX W amacron -92
+KPX W aogonek -92
+KPX W aring -92
+KPX W atilde -92
+KPX W colon -65
+KPX W comma -92
+KPX W e -92
+KPX W eacute -92
+KPX W ecaron -92
+KPX W ecircumflex -92
+KPX W edieresis -52
+KPX W edotaccent -92
+KPX W egrave -52
+KPX W emacron -52
+KPX W eogonek -92
+KPX W hyphen -37
+KPX W i -55
+KPX W iacute -55
+KPX W iogonek -55
+KPX W o -92
+KPX W oacute -92
+KPX W ocircumflex -92
+KPX W odieresis -92
+KPX W ograve -92
+KPX W ohungarumlaut -92
+KPX W omacron -92
+KPX W oslash -92
+KPX W otilde -92
+KPX W period -92
+KPX W semicolon -65
+KPX W u -55
+KPX W uacute -55
+KPX W ucircumflex -55
+KPX W udieresis -55
+KPX W ugrave -55
+KPX W uhungarumlaut -55
+KPX W umacron -55
+KPX W uogonek -55
+KPX W uring -55
+KPX W y -70
+KPX W yacute -70
+KPX W ydieresis -70
+KPX Y A -50
+KPX Y Aacute -50
+KPX Y Abreve -50
+KPX Y Acircumflex -50
+KPX Y Adieresis -50
+KPX Y Agrave -50
+KPX Y Amacron -50
+KPX Y Aogonek -50
+KPX Y Aring -50
+KPX Y Atilde -50
+KPX Y O -15
+KPX Y Oacute -15
+KPX Y Ocircumflex -15
+KPX Y Odieresis -15
+KPX Y Ograve -15
+KPX Y Ohungarumlaut -15
+KPX Y Omacron -15
+KPX Y Oslash -15
+KPX Y Otilde -15
+KPX Y a -92
+KPX Y aacute -92
+KPX Y abreve -92
+KPX Y acircumflex -92
+KPX Y adieresis -92
+KPX Y agrave -92
+KPX Y amacron -92
+KPX Y aogonek -92
+KPX Y aring -92
+KPX Y atilde -92
+KPX Y colon -65
+KPX Y comma -92
+KPX Y e -92
+KPX Y eacute -92
+KPX Y ecaron -92
+KPX Y ecircumflex -92
+KPX Y edieresis -52
+KPX Y edotaccent -92
+KPX Y egrave -52
+KPX Y emacron -52
+KPX Y eogonek -92
+KPX Y hyphen -74
+KPX Y i -74
+KPX Y iacute -74
+KPX Y icircumflex -34
+KPX Y idieresis -34
+KPX Y igrave -34
+KPX Y imacron -34
+KPX Y iogonek -74
+KPX Y o -92
+KPX Y oacute -92
+KPX Y ocircumflex -92
+KPX Y odieresis -92
+KPX Y ograve -92
+KPX Y ohungarumlaut -92
+KPX Y omacron -92
+KPX Y oslash -92
+KPX Y otilde -92
+KPX Y period -92
+KPX Y semicolon -65
+KPX Y u -92
+KPX Y uacute -92
+KPX Y ucircumflex -92
+KPX Y udieresis -92
+KPX Y ugrave -92
+KPX Y uhungarumlaut -92
+KPX Y umacron -92
+KPX Y uogonek -92
+KPX Y uring -92
+KPX Yacute A -50
+KPX Yacute Aacute -50
+KPX Yacute Abreve -50
+KPX Yacute Acircumflex -50
+KPX Yacute Adieresis -50
+KPX Yacute Agrave -50
+KPX Yacute Amacron -50
+KPX Yacute Aogonek -50
+KPX Yacute Aring -50
+KPX Yacute Atilde -50
+KPX Yacute O -15
+KPX Yacute Oacute -15
+KPX Yacute Ocircumflex -15
+KPX Yacute Odieresis -15
+KPX Yacute Ograve -15
+KPX Yacute Ohungarumlaut -15
+KPX Yacute Omacron -15
+KPX Yacute Oslash -15
+KPX Yacute Otilde -15
+KPX Yacute a -92
+KPX Yacute aacute -92
+KPX Yacute abreve -92
+KPX Yacute acircumflex -92
+KPX Yacute adieresis -92
+KPX Yacute agrave -92
+KPX Yacute amacron -92
+KPX Yacute aogonek -92
+KPX Yacute aring -92
+KPX Yacute atilde -92
+KPX Yacute colon -65
+KPX Yacute comma -92
+KPX Yacute e -92
+KPX Yacute eacute -92
+KPX Yacute ecaron -92
+KPX Yacute ecircumflex -92
+KPX Yacute edieresis -52
+KPX Yacute edotaccent -92
+KPX Yacute egrave -52
+KPX Yacute emacron -52
+KPX Yacute eogonek -92
+KPX Yacute hyphen -74
+KPX Yacute i -74
+KPX Yacute iacute -74
+KPX Yacute icircumflex -34
+KPX Yacute idieresis -34
+KPX Yacute igrave -34
+KPX Yacute imacron -34
+KPX Yacute iogonek -74
+KPX Yacute o -92
+KPX Yacute oacute -92
+KPX Yacute ocircumflex -92
+KPX Yacute odieresis -92
+KPX Yacute ograve -92
+KPX Yacute ohungarumlaut -92
+KPX Yacute omacron -92
+KPX Yacute oslash -92
+KPX Yacute otilde -92
+KPX Yacute period -92
+KPX Yacute semicolon -65
+KPX Yacute u -92
+KPX Yacute uacute -92
+KPX Yacute ucircumflex -92
+KPX Yacute udieresis -92
+KPX Yacute ugrave -92
+KPX Yacute uhungarumlaut -92
+KPX Yacute umacron -92
+KPX Yacute uogonek -92
+KPX Yacute uring -92
+KPX Ydieresis A -50
+KPX Ydieresis Aacute -50
+KPX Ydieresis Abreve -50
+KPX Ydieresis Acircumflex -50
+KPX Ydieresis Adieresis -50
+KPX Ydieresis Agrave -50
+KPX Ydieresis Amacron -50
+KPX Ydieresis Aogonek -50
+KPX Ydieresis Aring -50
+KPX Ydieresis Atilde -50
+KPX Ydieresis O -15
+KPX Ydieresis Oacute -15
+KPX Ydieresis Ocircumflex -15
+KPX Ydieresis Odieresis -15
+KPX Ydieresis Ograve -15
+KPX Ydieresis Ohungarumlaut -15
+KPX Ydieresis Omacron -15
+KPX Ydieresis Oslash -15
+KPX Ydieresis Otilde -15
+KPX Ydieresis a -92
+KPX Ydieresis aacute -92
+KPX Ydieresis abreve -92
+KPX Ydieresis acircumflex -92
+KPX Ydieresis adieresis -92
+KPX Ydieresis agrave -92
+KPX Ydieresis amacron -92
+KPX Ydieresis aogonek -92
+KPX Ydieresis aring -92
+KPX Ydieresis atilde -92
+KPX Ydieresis colon -65
+KPX Ydieresis comma -92
+KPX Ydieresis e -92
+KPX Ydieresis eacute -92
+KPX Ydieresis ecaron -92
+KPX Ydieresis ecircumflex -92
+KPX Ydieresis edieresis -52
+KPX Ydieresis edotaccent -92
+KPX Ydieresis egrave -52
+KPX Ydieresis emacron -52
+KPX Ydieresis eogonek -92
+KPX Ydieresis hyphen -74
+KPX Ydieresis i -74
+KPX Ydieresis iacute -74
+KPX Ydieresis icircumflex -34
+KPX Ydieresis idieresis -34
+KPX Ydieresis igrave -34
+KPX Ydieresis imacron -34
+KPX Ydieresis iogonek -74
+KPX Ydieresis o -92
+KPX Ydieresis oacute -92
+KPX Ydieresis ocircumflex -92
+KPX Ydieresis odieresis -92
+KPX Ydieresis ograve -92
+KPX Ydieresis ohungarumlaut -92
+KPX Ydieresis omacron -92
+KPX Ydieresis oslash -92
+KPX Ydieresis otilde -92
+KPX Ydieresis period -92
+KPX Ydieresis semicolon -65
+KPX Ydieresis u -92
+KPX Ydieresis uacute -92
+KPX Ydieresis ucircumflex -92
+KPX Ydieresis udieresis -92
+KPX Ydieresis ugrave -92
+KPX Ydieresis uhungarumlaut -92
+KPX Ydieresis umacron -92
+KPX Ydieresis uogonek -92
+KPX Ydieresis uring -92
+KPX a g -10
+KPX a gbreve -10
+KPX a gcommaaccent -10
+KPX aacute g -10
+KPX aacute gbreve -10
+KPX aacute gcommaaccent -10
+KPX abreve g -10
+KPX abreve gbreve -10
+KPX abreve gcommaaccent -10
+KPX acircumflex g -10
+KPX acircumflex gbreve -10
+KPX acircumflex gcommaaccent -10
+KPX adieresis g -10
+KPX adieresis gbreve -10
+KPX adieresis gcommaaccent -10
+KPX agrave g -10
+KPX agrave gbreve -10
+KPX agrave gcommaaccent -10
+KPX amacron g -10
+KPX amacron gbreve -10
+KPX amacron gcommaaccent -10
+KPX aogonek g -10
+KPX aogonek gbreve -10
+KPX aogonek gcommaaccent -10
+KPX aring g -10
+KPX aring gbreve -10
+KPX aring gcommaaccent -10
+KPX atilde g -10
+KPX atilde gbreve -10
+KPX atilde gcommaaccent -10
+KPX b period -40
+KPX b u -20
+KPX b uacute -20
+KPX b ucircumflex -20
+KPX b udieresis -20
+KPX b ugrave -20
+KPX b uhungarumlaut -20
+KPX b umacron -20
+KPX b uogonek -20
+KPX b uring -20
+KPX c h -15
+KPX c k -20
+KPX c kcommaaccent -20
+KPX cacute h -15
+KPX cacute k -20
+KPX cacute kcommaaccent -20
+KPX ccaron h -15
+KPX ccaron k -20
+KPX ccaron kcommaaccent -20
+KPX ccedilla h -15
+KPX ccedilla k -20
+KPX ccedilla kcommaaccent -20
+KPX comma quotedblright -140
+KPX comma quoteright -140
+KPX e comma -10
+KPX e g -40
+KPX e gbreve -40
+KPX e gcommaaccent -40
+KPX e period -15
+KPX e v -15
+KPX e w -15
+KPX e x -20
+KPX e y -30
+KPX e yacute -30
+KPX e ydieresis -30
+KPX eacute comma -10
+KPX eacute g -40
+KPX eacute gbreve -40
+KPX eacute gcommaaccent -40
+KPX eacute period -15
+KPX eacute v -15
+KPX eacute w -15
+KPX eacute x -20
+KPX eacute y -30
+KPX eacute yacute -30
+KPX eacute ydieresis -30
+KPX ecaron comma -10
+KPX ecaron g -40
+KPX ecaron gbreve -40
+KPX ecaron gcommaaccent -40
+KPX ecaron period -15
+KPX ecaron v -15
+KPX ecaron w -15
+KPX ecaron x -20
+KPX ecaron y -30
+KPX ecaron yacute -30
+KPX ecaron ydieresis -30
+KPX ecircumflex comma -10
+KPX ecircumflex g -40
+KPX ecircumflex gbreve -40
+KPX ecircumflex gcommaaccent -40
+KPX ecircumflex period -15
+KPX ecircumflex v -15
+KPX ecircumflex w -15
+KPX ecircumflex x -20
+KPX ecircumflex y -30
+KPX ecircumflex yacute -30
+KPX ecircumflex ydieresis -30
+KPX edieresis comma -10
+KPX edieresis g -40
+KPX edieresis gbreve -40
+KPX edieresis gcommaaccent -40
+KPX edieresis period -15
+KPX edieresis v -15
+KPX edieresis w -15
+KPX edieresis x -20
+KPX edieresis y -30
+KPX edieresis yacute -30
+KPX edieresis ydieresis -30
+KPX edotaccent comma -10
+KPX edotaccent g -40
+KPX edotaccent gbreve -40
+KPX edotaccent gcommaaccent -40
+KPX edotaccent period -15
+KPX edotaccent v -15
+KPX edotaccent w -15
+KPX edotaccent x -20
+KPX edotaccent y -30
+KPX edotaccent yacute -30
+KPX edotaccent ydieresis -30
+KPX egrave comma -10
+KPX egrave g -40
+KPX egrave gbreve -40
+KPX egrave gcommaaccent -40
+KPX egrave period -15
+KPX egrave v -15
+KPX egrave w -15
+KPX egrave x -20
+KPX egrave y -30
+KPX egrave yacute -30
+KPX egrave ydieresis -30
+KPX emacron comma -10
+KPX emacron g -40
+KPX emacron gbreve -40
+KPX emacron gcommaaccent -40
+KPX emacron period -15
+KPX emacron v -15
+KPX emacron w -15
+KPX emacron x -20
+KPX emacron y -30
+KPX emacron yacute -30
+KPX emacron ydieresis -30
+KPX eogonek comma -10
+KPX eogonek g -40
+KPX eogonek gbreve -40
+KPX eogonek gcommaaccent -40
+KPX eogonek period -15
+KPX eogonek v -15
+KPX eogonek w -15
+KPX eogonek x -20
+KPX eogonek y -30
+KPX eogonek yacute -30
+KPX eogonek ydieresis -30
+KPX f comma -10
+KPX f dotlessi -60
+KPX f f -18
+KPX f i -20
+KPX f iogonek -20
+KPX f period -15
+KPX f quoteright 92
+KPX g comma -10
+KPX g e -10
+KPX g eacute -10
+KPX g ecaron -10
+KPX g ecircumflex -10
+KPX g edieresis -10
+KPX g edotaccent -10
+KPX g egrave -10
+KPX g emacron -10
+KPX g eogonek -10
+KPX g g -10
+KPX g gbreve -10
+KPX g gcommaaccent -10
+KPX g period -15
+KPX gbreve comma -10
+KPX gbreve e -10
+KPX gbreve eacute -10
+KPX gbreve ecaron -10
+KPX gbreve ecircumflex -10
+KPX gbreve edieresis -10
+KPX gbreve edotaccent -10
+KPX gbreve egrave -10
+KPX gbreve emacron -10
+KPX gbreve eogonek -10
+KPX gbreve g -10
+KPX gbreve gbreve -10
+KPX gbreve gcommaaccent -10
+KPX gbreve period -15
+KPX gcommaaccent comma -10
+KPX gcommaaccent e -10
+KPX gcommaaccent eacute -10
+KPX gcommaaccent ecaron -10
+KPX gcommaaccent ecircumflex -10
+KPX gcommaaccent edieresis -10
+KPX gcommaaccent edotaccent -10
+KPX gcommaaccent egrave -10
+KPX gcommaaccent emacron -10
+KPX gcommaaccent eogonek -10
+KPX gcommaaccent g -10
+KPX gcommaaccent gbreve -10
+KPX gcommaaccent gcommaaccent -10
+KPX gcommaaccent period -15
+KPX k e -10
+KPX k eacute -10
+KPX k ecaron -10
+KPX k ecircumflex -10
+KPX k edieresis -10
+KPX k edotaccent -10
+KPX k egrave -10
+KPX k emacron -10
+KPX k eogonek -10
+KPX k o -10
+KPX k oacute -10
+KPX k ocircumflex -10
+KPX k odieresis -10
+KPX k ograve -10
+KPX k ohungarumlaut -10
+KPX k omacron -10
+KPX k oslash -10
+KPX k otilde -10
+KPX k y -10
+KPX k yacute -10
+KPX k ydieresis -10
+KPX kcommaaccent e -10
+KPX kcommaaccent eacute -10
+KPX kcommaaccent ecaron -10
+KPX kcommaaccent ecircumflex -10
+KPX kcommaaccent edieresis -10
+KPX kcommaaccent edotaccent -10
+KPX kcommaaccent egrave -10
+KPX kcommaaccent emacron -10
+KPX kcommaaccent eogonek -10
+KPX kcommaaccent o -10
+KPX kcommaaccent oacute -10
+KPX kcommaaccent ocircumflex -10
+KPX kcommaaccent odieresis -10
+KPX kcommaaccent ograve -10
+KPX kcommaaccent ohungarumlaut -10
+KPX kcommaaccent omacron -10
+KPX kcommaaccent oslash -10
+KPX kcommaaccent otilde -10
+KPX kcommaaccent y -10
+KPX kcommaaccent yacute -10
+KPX kcommaaccent ydieresis -10
+KPX n v -40
+KPX nacute v -40
+KPX ncaron v -40
+KPX ncommaaccent v -40
+KPX ntilde v -40
+KPX o g -10
+KPX o gbreve -10
+KPX o gcommaaccent -10
+KPX o v -10
+KPX oacute g -10
+KPX oacute gbreve -10
+KPX oacute gcommaaccent -10
+KPX oacute v -10
+KPX ocircumflex g -10
+KPX ocircumflex gbreve -10
+KPX ocircumflex gcommaaccent -10
+KPX ocircumflex v -10
+KPX odieresis g -10
+KPX odieresis gbreve -10
+KPX odieresis gcommaaccent -10
+KPX odieresis v -10
+KPX ograve g -10
+KPX ograve gbreve -10
+KPX ograve gcommaaccent -10
+KPX ograve v -10
+KPX ohungarumlaut g -10
+KPX ohungarumlaut gbreve -10
+KPX ohungarumlaut gcommaaccent -10
+KPX ohungarumlaut v -10
+KPX omacron g -10
+KPX omacron gbreve -10
+KPX omacron gcommaaccent -10
+KPX omacron v -10
+KPX oslash g -10
+KPX oslash gbreve -10
+KPX oslash gcommaaccent -10
+KPX oslash v -10
+KPX otilde g -10
+KPX otilde gbreve -10
+KPX otilde gcommaaccent -10
+KPX otilde v -10
+KPX period quotedblright -140
+KPX period quoteright -140
+KPX quoteleft quoteleft -111
+KPX quoteright d -25
+KPX quoteright dcroat -25
+KPX quoteright quoteright -111
+KPX quoteright r -25
+KPX quoteright racute -25
+KPX quoteright rcaron -25
+KPX quoteright rcommaaccent -25
+KPX quoteright s -40
+KPX quoteright sacute -40
+KPX quoteright scaron -40
+KPX quoteright scedilla -40
+KPX quoteright scommaaccent -40
+KPX quoteright space -111
+KPX quoteright t -30
+KPX quoteright tcommaaccent -30
+KPX quoteright v -10
+KPX r a -15
+KPX r aacute -15
+KPX r abreve -15
+KPX r acircumflex -15
+KPX r adieresis -15
+KPX r agrave -15
+KPX r amacron -15
+KPX r aogonek -15
+KPX r aring -15
+KPX r atilde -15
+KPX r c -37
+KPX r cacute -37
+KPX r ccaron -37
+KPX r ccedilla -37
+KPX r comma -111
+KPX r d -37
+KPX r dcroat -37
+KPX r e -37
+KPX r eacute -37
+KPX r ecaron -37
+KPX r ecircumflex -37
+KPX r edieresis -37
+KPX r edotaccent -37
+KPX r egrave -37
+KPX r emacron -37
+KPX r eogonek -37
+KPX r g -37
+KPX r gbreve -37
+KPX r gcommaaccent -37
+KPX r hyphen -20
+KPX r o -45
+KPX r oacute -45
+KPX r ocircumflex -45
+KPX r odieresis -45
+KPX r ograve -45
+KPX r ohungarumlaut -45
+KPX r omacron -45
+KPX r oslash -45
+KPX r otilde -45
+KPX r period -111
+KPX r q -37
+KPX r s -10
+KPX r sacute -10
+KPX r scaron -10
+KPX r scedilla -10
+KPX r scommaaccent -10
+KPX racute a -15
+KPX racute aacute -15
+KPX racute abreve -15
+KPX racute acircumflex -15
+KPX racute adieresis -15
+KPX racute agrave -15
+KPX racute amacron -15
+KPX racute aogonek -15
+KPX racute aring -15
+KPX racute atilde -15
+KPX racute c -37
+KPX racute cacute -37
+KPX racute ccaron -37
+KPX racute ccedilla -37
+KPX racute comma -111
+KPX racute d -37
+KPX racute dcroat -37
+KPX racute e -37
+KPX racute eacute -37
+KPX racute ecaron -37
+KPX racute ecircumflex -37
+KPX racute edieresis -37
+KPX racute edotaccent -37
+KPX racute egrave -37
+KPX racute emacron -37
+KPX racute eogonek -37
+KPX racute g -37
+KPX racute gbreve -37
+KPX racute gcommaaccent -37
+KPX racute hyphen -20
+KPX racute o -45
+KPX racute oacute -45
+KPX racute ocircumflex -45
+KPX racute odieresis -45
+KPX racute ograve -45
+KPX racute ohungarumlaut -45
+KPX racute omacron -45
+KPX racute oslash -45
+KPX racute otilde -45
+KPX racute period -111
+KPX racute q -37
+KPX racute s -10
+KPX racute sacute -10
+KPX racute scaron -10
+KPX racute scedilla -10
+KPX racute scommaaccent -10
+KPX rcaron a -15
+KPX rcaron aacute -15
+KPX rcaron abreve -15
+KPX rcaron acircumflex -15
+KPX rcaron adieresis -15
+KPX rcaron agrave -15
+KPX rcaron amacron -15
+KPX rcaron aogonek -15
+KPX rcaron aring -15
+KPX rcaron atilde -15
+KPX rcaron c -37
+KPX rcaron cacute -37
+KPX rcaron ccaron -37
+KPX rcaron ccedilla -37
+KPX rcaron comma -111
+KPX rcaron d -37
+KPX rcaron dcroat -37
+KPX rcaron e -37
+KPX rcaron eacute -37
+KPX rcaron ecaron -37
+KPX rcaron ecircumflex -37
+KPX rcaron edieresis -37
+KPX rcaron edotaccent -37
+KPX rcaron egrave -37
+KPX rcaron emacron -37
+KPX rcaron eogonek -37
+KPX rcaron g -37
+KPX rcaron gbreve -37
+KPX rcaron gcommaaccent -37
+KPX rcaron hyphen -20
+KPX rcaron o -45
+KPX rcaron oacute -45
+KPX rcaron ocircumflex -45
+KPX rcaron odieresis -45
+KPX rcaron ograve -45
+KPX rcaron ohungarumlaut -45
+KPX rcaron omacron -45
+KPX rcaron oslash -45
+KPX rcaron otilde -45
+KPX rcaron period -111
+KPX rcaron q -37
+KPX rcaron s -10
+KPX rcaron sacute -10
+KPX rcaron scaron -10
+KPX rcaron scedilla -10
+KPX rcaron scommaaccent -10
+KPX rcommaaccent a -15
+KPX rcommaaccent aacute -15
+KPX rcommaaccent abreve -15
+KPX rcommaaccent acircumflex -15
+KPX rcommaaccent adieresis -15
+KPX rcommaaccent agrave -15
+KPX rcommaaccent amacron -15
+KPX rcommaaccent aogonek -15
+KPX rcommaaccent aring -15
+KPX rcommaaccent atilde -15
+KPX rcommaaccent c -37
+KPX rcommaaccent cacute -37
+KPX rcommaaccent ccaron -37
+KPX rcommaaccent ccedilla -37
+KPX rcommaaccent comma -111
+KPX rcommaaccent d -37
+KPX rcommaaccent dcroat -37
+KPX rcommaaccent e -37
+KPX rcommaaccent eacute -37
+KPX rcommaaccent ecaron -37
+KPX rcommaaccent ecircumflex -37
+KPX rcommaaccent edieresis -37
+KPX rcommaaccent edotaccent -37
+KPX rcommaaccent egrave -37
+KPX rcommaaccent emacron -37
+KPX rcommaaccent eogonek -37
+KPX rcommaaccent g -37
+KPX rcommaaccent gbreve -37
+KPX rcommaaccent gcommaaccent -37
+KPX rcommaaccent hyphen -20
+KPX rcommaaccent o -45
+KPX rcommaaccent oacute -45
+KPX rcommaaccent ocircumflex -45
+KPX rcommaaccent odieresis -45
+KPX rcommaaccent ograve -45
+KPX rcommaaccent ohungarumlaut -45
+KPX rcommaaccent omacron -45
+KPX rcommaaccent oslash -45
+KPX rcommaaccent otilde -45
+KPX rcommaaccent period -111
+KPX rcommaaccent q -37
+KPX rcommaaccent s -10
+KPX rcommaaccent sacute -10
+KPX rcommaaccent scaron -10
+KPX rcommaaccent scedilla -10
+KPX rcommaaccent scommaaccent -10
+KPX space A -18
+KPX space Aacute -18
+KPX space Abreve -18
+KPX space Acircumflex -18
+KPX space Adieresis -18
+KPX space Agrave -18
+KPX space Amacron -18
+KPX space Aogonek -18
+KPX space Aring -18
+KPX space Atilde -18
+KPX space T -18
+KPX space Tcaron -18
+KPX space Tcommaaccent -18
+KPX space V -35
+KPX space W -40
+KPX space Y -75
+KPX space Yacute -75
+KPX space Ydieresis -75
+KPX v comma -74
+KPX v period -74
+KPX w comma -74
+KPX w period -74
+KPX y comma -55
+KPX y period -55
+KPX yacute comma -55
+KPX yacute period -55
+KPX ydieresis comma -55
+KPX ydieresis period -55
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Times-Roman.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Times-Roman.afm
new file mode 100644
index 0000000..a0953f2
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/Times-Roman.afm
@@ -0,0 +1,2419 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu May 1 12:49:17 1997
+Comment UniqueID 43068
+Comment VMusage 43909 54934
+FontName Times-Roman
+FullName Times Roman
+FamilyName Times
+Weight Roman
+ItalicAngle 0
+IsFixedPitch false
+CharacterSet ExtendedRoman
+FontBBox -168 -218 1000 898
+UnderlinePosition -100
+UnderlineThickness 50
+Version 002.000
+Notice Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.Times is a trademark of Linotype-Hell AG and/or its subsidiaries.
+EncodingScheme AdobeStandardEncoding
+CapHeight 662
+XHeight 450
+Ascender 683
+Descender -217
+StdHW 28
+StdVW 84
+StartCharMetrics 315
+C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 333 ; N exclam ; B 130 -9 238 676 ;
+C 34 ; WX 408 ; N quotedbl ; B 77 431 331 676 ;
+C 35 ; WX 500 ; N numbersign ; B 5 0 496 662 ;
+C 36 ; WX 500 ; N dollar ; B 44 -87 457 727 ;
+C 37 ; WX 833 ; N percent ; B 61 -13 772 676 ;
+C 38 ; WX 778 ; N ampersand ; B 42 -13 750 676 ;
+C 39 ; WX 333 ; N quoteright ; B 79 433 218 676 ;
+C 40 ; WX 333 ; N parenleft ; B 48 -177 304 676 ;
+C 41 ; WX 333 ; N parenright ; B 29 -177 285 676 ;
+C 42 ; WX 500 ; N asterisk ; B 69 265 432 676 ;
+C 43 ; WX 564 ; N plus ; B 30 0 534 506 ;
+C 44 ; WX 250 ; N comma ; B 56 -141 195 102 ;
+C 45 ; WX 333 ; N hyphen ; B 39 194 285 257 ;
+C 46 ; WX 250 ; N period ; B 70 -11 181 100 ;
+C 47 ; WX 278 ; N slash ; B -9 -14 287 676 ;
+C 48 ; WX 500 ; N zero ; B 24 -14 476 676 ;
+C 49 ; WX 500 ; N one ; B 111 0 394 676 ;
+C 50 ; WX 500 ; N two ; B 30 0 475 676 ;
+C 51 ; WX 500 ; N three ; B 43 -14 431 676 ;
+C 52 ; WX 500 ; N four ; B 12 0 472 676 ;
+C 53 ; WX 500 ; N five ; B 32 -14 438 688 ;
+C 54 ; WX 500 ; N six ; B 34 -14 468 684 ;
+C 55 ; WX 500 ; N seven ; B 20 -8 449 662 ;
+C 56 ; WX 500 ; N eight ; B 56 -14 445 676 ;
+C 57 ; WX 500 ; N nine ; B 30 -22 459 676 ;
+C 58 ; WX 278 ; N colon ; B 81 -11 192 459 ;
+C 59 ; WX 278 ; N semicolon ; B 80 -141 219 459 ;
+C 60 ; WX 564 ; N less ; B 28 -8 536 514 ;
+C 61 ; WX 564 ; N equal ; B 30 120 534 386 ;
+C 62 ; WX 564 ; N greater ; B 28 -8 536 514 ;
+C 63 ; WX 444 ; N question ; B 68 -8 414 676 ;
+C 64 ; WX 921 ; N at ; B 116 -14 809 676 ;
+C 65 ; WX 722 ; N A ; B 15 0 706 674 ;
+C 66 ; WX 667 ; N B ; B 17 0 593 662 ;
+C 67 ; WX 667 ; N C ; B 28 -14 633 676 ;
+C 68 ; WX 722 ; N D ; B 16 0 685 662 ;
+C 69 ; WX 611 ; N E ; B 12 0 597 662 ;
+C 70 ; WX 556 ; N F ; B 12 0 546 662 ;
+C 71 ; WX 722 ; N G ; B 32 -14 709 676 ;
+C 72 ; WX 722 ; N H ; B 19 0 702 662 ;
+C 73 ; WX 333 ; N I ; B 18 0 315 662 ;
+C 74 ; WX 389 ; N J ; B 10 -14 370 662 ;
+C 75 ; WX 722 ; N K ; B 34 0 723 662 ;
+C 76 ; WX 611 ; N L ; B 12 0 598 662 ;
+C 77 ; WX 889 ; N M ; B 12 0 863 662 ;
+C 78 ; WX 722 ; N N ; B 12 -11 707 662 ;
+C 79 ; WX 722 ; N O ; B 34 -14 688 676 ;
+C 80 ; WX 556 ; N P ; B 16 0 542 662 ;
+C 81 ; WX 722 ; N Q ; B 34 -178 701 676 ;
+C 82 ; WX 667 ; N R ; B 17 0 659 662 ;
+C 83 ; WX 556 ; N S ; B 42 -14 491 676 ;
+C 84 ; WX 611 ; N T ; B 17 0 593 662 ;
+C 85 ; WX 722 ; N U ; B 14 -14 705 662 ;
+C 86 ; WX 722 ; N V ; B 16 -11 697 662 ;
+C 87 ; WX 944 ; N W ; B 5 -11 932 662 ;
+C 88 ; WX 722 ; N X ; B 10 0 704 662 ;
+C 89 ; WX 722 ; N Y ; B 22 0 703 662 ;
+C 90 ; WX 611 ; N Z ; B 9 0 597 662 ;
+C 91 ; WX 333 ; N bracketleft ; B 88 -156 299 662 ;
+C 92 ; WX 278 ; N backslash ; B -9 -14 287 676 ;
+C 93 ; WX 333 ; N bracketright ; B 34 -156 245 662 ;
+C 94 ; WX 469 ; N asciicircum ; B 24 297 446 662 ;
+C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
+C 96 ; WX 333 ; N quoteleft ; B 115 433 254 676 ;
+C 97 ; WX 444 ; N a ; B 37 -10 442 460 ;
+C 98 ; WX 500 ; N b ; B 3 -10 468 683 ;
+C 99 ; WX 444 ; N c ; B 25 -10 412 460 ;
+C 100 ; WX 500 ; N d ; B 27 -10 491 683 ;
+C 101 ; WX 444 ; N e ; B 25 -10 424 460 ;
+C 102 ; WX 333 ; N f ; B 20 0 383 683 ; L i fi ; L l fl ;
+C 103 ; WX 500 ; N g ; B 28 -218 470 460 ;
+C 104 ; WX 500 ; N h ; B 9 0 487 683 ;
+C 105 ; WX 278 ; N i ; B 16 0 253 683 ;
+C 106 ; WX 278 ; N j ; B -70 -218 194 683 ;
+C 107 ; WX 500 ; N k ; B 7 0 505 683 ;
+C 108 ; WX 278 ; N l ; B 19 0 257 683 ;
+C 109 ; WX 778 ; N m ; B 16 0 775 460 ;
+C 110 ; WX 500 ; N n ; B 16 0 485 460 ;
+C 111 ; WX 500 ; N o ; B 29 -10 470 460 ;
+C 112 ; WX 500 ; N p ; B 5 -217 470 460 ;
+C 113 ; WX 500 ; N q ; B 24 -217 488 460 ;
+C 114 ; WX 333 ; N r ; B 5 0 335 460 ;
+C 115 ; WX 389 ; N s ; B 51 -10 348 460 ;
+C 116 ; WX 278 ; N t ; B 13 -10 279 579 ;
+C 117 ; WX 500 ; N u ; B 9 -10 479 450 ;
+C 118 ; WX 500 ; N v ; B 19 -14 477 450 ;
+C 119 ; WX 722 ; N w ; B 21 -14 694 450 ;
+C 120 ; WX 500 ; N x ; B 17 0 479 450 ;
+C 121 ; WX 500 ; N y ; B 14 -218 475 450 ;
+C 122 ; WX 444 ; N z ; B 27 0 418 450 ;
+C 123 ; WX 480 ; N braceleft ; B 100 -181 350 680 ;
+C 124 ; WX 200 ; N bar ; B 67 -218 133 782 ;
+C 125 ; WX 480 ; N braceright ; B 130 -181 380 680 ;
+C 126 ; WX 541 ; N asciitilde ; B 40 183 502 323 ;
+C 161 ; WX 333 ; N exclamdown ; B 97 -218 205 467 ;
+C 162 ; WX 500 ; N cent ; B 53 -138 448 579 ;
+C 163 ; WX 500 ; N sterling ; B 12 -8 490 676 ;
+C 164 ; WX 167 ; N fraction ; B -168 -14 331 676 ;
+C 165 ; WX 500 ; N yen ; B -53 0 512 662 ;
+C 166 ; WX 500 ; N florin ; B 7 -189 490 676 ;
+C 167 ; WX 500 ; N section ; B 70 -148 426 676 ;
+C 168 ; WX 500 ; N currency ; B -22 58 522 602 ;
+C 169 ; WX 180 ; N quotesingle ; B 48 431 133 676 ;
+C 170 ; WX 444 ; N quotedblleft ; B 43 433 414 676 ;
+C 171 ; WX 500 ; N guillemotleft ; B 42 33 456 416 ;
+C 172 ; WX 333 ; N guilsinglleft ; B 63 33 285 416 ;
+C 173 ; WX 333 ; N guilsinglright ; B 48 33 270 416 ;
+C 174 ; WX 556 ; N fi ; B 31 0 521 683 ;
+C 175 ; WX 556 ; N fl ; B 32 0 521 683 ;
+C 177 ; WX 500 ; N endash ; B 0 201 500 250 ;
+C 178 ; WX 500 ; N dagger ; B 59 -149 442 676 ;
+C 179 ; WX 500 ; N daggerdbl ; B 58 -153 442 676 ;
+C 180 ; WX 250 ; N periodcentered ; B 70 199 181 310 ;
+C 182 ; WX 453 ; N paragraph ; B -22 -154 450 662 ;
+C 183 ; WX 350 ; N bullet ; B 40 196 310 466 ;
+C 184 ; WX 333 ; N quotesinglbase ; B 79 -141 218 102 ;
+C 185 ; WX 444 ; N quotedblbase ; B 45 -141 416 102 ;
+C 186 ; WX 444 ; N quotedblright ; B 30 433 401 676 ;
+C 187 ; WX 500 ; N guillemotright ; B 44 33 458 416 ;
+C 188 ; WX 1000 ; N ellipsis ; B 111 -11 888 100 ;
+C 189 ; WX 1000 ; N perthousand ; B 7 -19 994 706 ;
+C 191 ; WX 444 ; N questiondown ; B 30 -218 376 466 ;
+C 193 ; WX 333 ; N grave ; B 19 507 242 678 ;
+C 194 ; WX 333 ; N acute ; B 93 507 317 678 ;
+C 195 ; WX 333 ; N circumflex ; B 11 507 322 674 ;
+C 196 ; WX 333 ; N tilde ; B 1 532 331 638 ;
+C 197 ; WX 333 ; N macron ; B 11 547 322 601 ;
+C 198 ; WX 333 ; N breve ; B 26 507 307 664 ;
+C 199 ; WX 333 ; N dotaccent ; B 118 581 216 681 ;
+C 200 ; WX 333 ; N dieresis ; B 18 581 315 681 ;
+C 202 ; WX 333 ; N ring ; B 67 512 266 711 ;
+C 203 ; WX 333 ; N cedilla ; B 52 -215 261 0 ;
+C 205 ; WX 333 ; N hungarumlaut ; B -3 507 377 678 ;
+C 206 ; WX 333 ; N ogonek ; B 62 -165 243 0 ;
+C 207 ; WX 333 ; N caron ; B 11 507 322 674 ;
+C 208 ; WX 1000 ; N emdash ; B 0 201 1000 250 ;
+C 225 ; WX 889 ; N AE ; B 0 0 863 662 ;
+C 227 ; WX 276 ; N ordfeminine ; B 4 394 270 676 ;
+C 232 ; WX 611 ; N Lslash ; B 12 0 598 662 ;
+C 233 ; WX 722 ; N Oslash ; B 34 -80 688 734 ;
+C 234 ; WX 889 ; N OE ; B 30 -6 885 668 ;
+C 235 ; WX 310 ; N ordmasculine ; B 6 394 304 676 ;
+C 241 ; WX 667 ; N ae ; B 38 -10 632 460 ;
+C 245 ; WX 278 ; N dotlessi ; B 16 0 253 460 ;
+C 248 ; WX 278 ; N lslash ; B 19 0 259 683 ;
+C 249 ; WX 500 ; N oslash ; B 29 -112 470 551 ;
+C 250 ; WX 722 ; N oe ; B 30 -10 690 460 ;
+C 251 ; WX 500 ; N germandbls ; B 12 -9 468 683 ;
+C -1 ; WX 333 ; N Idieresis ; B 18 0 315 835 ;
+C -1 ; WX 444 ; N eacute ; B 25 -10 424 678 ;
+C -1 ; WX 444 ; N abreve ; B 37 -10 442 664 ;
+C -1 ; WX 500 ; N uhungarumlaut ; B 9 -10 501 678 ;
+C -1 ; WX 444 ; N ecaron ; B 25 -10 424 674 ;
+C -1 ; WX 722 ; N Ydieresis ; B 22 0 703 835 ;
+C -1 ; WX 564 ; N divide ; B 30 -10 534 516 ;
+C -1 ; WX 722 ; N Yacute ; B 22 0 703 890 ;
+C -1 ; WX 722 ; N Acircumflex ; B 15 0 706 886 ;
+C -1 ; WX 444 ; N aacute ; B 37 -10 442 678 ;
+C -1 ; WX 722 ; N Ucircumflex ; B 14 -14 705 886 ;
+C -1 ; WX 500 ; N yacute ; B 14 -218 475 678 ;
+C -1 ; WX 389 ; N scommaaccent ; B 51 -218 348 460 ;
+C -1 ; WX 444 ; N ecircumflex ; B 25 -10 424 674 ;
+C -1 ; WX 722 ; N Uring ; B 14 -14 705 898 ;
+C -1 ; WX 722 ; N Udieresis ; B 14 -14 705 835 ;
+C -1 ; WX 444 ; N aogonek ; B 37 -165 469 460 ;
+C -1 ; WX 722 ; N Uacute ; B 14 -14 705 890 ;
+C -1 ; WX 500 ; N uogonek ; B 9 -155 487 450 ;
+C -1 ; WX 611 ; N Edieresis ; B 12 0 597 835 ;
+C -1 ; WX 722 ; N Dcroat ; B 16 0 685 662 ;
+C -1 ; WX 250 ; N commaaccent ; B 59 -218 184 -50 ;
+C -1 ; WX 760 ; N copyright ; B 38 -14 722 676 ;
+C -1 ; WX 611 ; N Emacron ; B 12 0 597 813 ;
+C -1 ; WX 444 ; N ccaron ; B 25 -10 412 674 ;
+C -1 ; WX 444 ; N aring ; B 37 -10 442 711 ;
+C -1 ; WX 722 ; N Ncommaaccent ; B 12 -198 707 662 ;
+C -1 ; WX 278 ; N lacute ; B 19 0 290 890 ;
+C -1 ; WX 444 ; N agrave ; B 37 -10 442 678 ;
+C -1 ; WX 611 ; N Tcommaaccent ; B 17 -218 593 662 ;
+C -1 ; WX 667 ; N Cacute ; B 28 -14 633 890 ;
+C -1 ; WX 444 ; N atilde ; B 37 -10 442 638 ;
+C -1 ; WX 611 ; N Edotaccent ; B 12 0 597 835 ;
+C -1 ; WX 389 ; N scaron ; B 39 -10 350 674 ;
+C -1 ; WX 389 ; N scedilla ; B 51 -215 348 460 ;
+C -1 ; WX 278 ; N iacute ; B 16 0 290 678 ;
+C -1 ; WX 471 ; N lozenge ; B 13 0 459 724 ;
+C -1 ; WX 667 ; N Rcaron ; B 17 0 659 886 ;
+C -1 ; WX 722 ; N Gcommaaccent ; B 32 -218 709 676 ;
+C -1 ; WX 500 ; N ucircumflex ; B 9 -10 479 674 ;
+C -1 ; WX 444 ; N acircumflex ; B 37 -10 442 674 ;
+C -1 ; WX 722 ; N Amacron ; B 15 0 706 813 ;
+C -1 ; WX 333 ; N rcaron ; B 5 0 335 674 ;
+C -1 ; WX 444 ; N ccedilla ; B 25 -215 412 460 ;
+C -1 ; WX 611 ; N Zdotaccent ; B 9 0 597 835 ;
+C -1 ; WX 556 ; N Thorn ; B 16 0 542 662 ;
+C -1 ; WX 722 ; N Omacron ; B 34 -14 688 813 ;
+C -1 ; WX 667 ; N Racute ; B 17 0 659 890 ;
+C -1 ; WX 556 ; N Sacute ; B 42 -14 491 890 ;
+C -1 ; WX 588 ; N dcaron ; B 27 -10 589 695 ;
+C -1 ; WX 722 ; N Umacron ; B 14 -14 705 813 ;
+C -1 ; WX 500 ; N uring ; B 9 -10 479 711 ;
+C -1 ; WX 300 ; N threesuperior ; B 15 262 291 676 ;
+C -1 ; WX 722 ; N Ograve ; B 34 -14 688 890 ;
+C -1 ; WX 722 ; N Agrave ; B 15 0 706 890 ;
+C -1 ; WX 722 ; N Abreve ; B 15 0 706 876 ;
+C -1 ; WX 564 ; N multiply ; B 38 8 527 497 ;
+C -1 ; WX 500 ; N uacute ; B 9 -10 479 678 ;
+C -1 ; WX 611 ; N Tcaron ; B 17 0 593 886 ;
+C -1 ; WX 476 ; N partialdiff ; B 17 -38 459 710 ;
+C -1 ; WX 500 ; N ydieresis ; B 14 -218 475 623 ;
+C -1 ; WX 722 ; N Nacute ; B 12 -11 707 890 ;
+C -1 ; WX 278 ; N icircumflex ; B -16 0 295 674 ;
+C -1 ; WX 611 ; N Ecircumflex ; B 12 0 597 886 ;
+C -1 ; WX 444 ; N adieresis ; B 37 -10 442 623 ;
+C -1 ; WX 444 ; N edieresis ; B 25 -10 424 623 ;
+C -1 ; WX 444 ; N cacute ; B 25 -10 413 678 ;
+C -1 ; WX 500 ; N nacute ; B 16 0 485 678 ;
+C -1 ; WX 500 ; N umacron ; B 9 -10 479 601 ;
+C -1 ; WX 722 ; N Ncaron ; B 12 -11 707 886 ;
+C -1 ; WX 333 ; N Iacute ; B 18 0 317 890 ;
+C -1 ; WX 564 ; N plusminus ; B 30 0 534 506 ;
+C -1 ; WX 200 ; N brokenbar ; B 67 -143 133 707 ;
+C -1 ; WX 760 ; N registered ; B 38 -14 722 676 ;
+C -1 ; WX 722 ; N Gbreve ; B 32 -14 709 876 ;
+C -1 ; WX 333 ; N Idotaccent ; B 18 0 315 835 ;
+C -1 ; WX 600 ; N summation ; B 15 -10 585 706 ;
+C -1 ; WX 611 ; N Egrave ; B 12 0 597 890 ;
+C -1 ; WX 333 ; N racute ; B 5 0 335 678 ;
+C -1 ; WX 500 ; N omacron ; B 29 -10 470 601 ;
+C -1 ; WX 611 ; N Zacute ; B 9 0 597 890 ;
+C -1 ; WX 611 ; N Zcaron ; B 9 0 597 886 ;
+C -1 ; WX 549 ; N greaterequal ; B 26 0 523 666 ;
+C -1 ; WX 722 ; N Eth ; B 16 0 685 662 ;
+C -1 ; WX 667 ; N Ccedilla ; B 28 -215 633 676 ;
+C -1 ; WX 278 ; N lcommaaccent ; B 19 -218 257 683 ;
+C -1 ; WX 326 ; N tcaron ; B 13 -10 318 722 ;
+C -1 ; WX 444 ; N eogonek ; B 25 -165 424 460 ;
+C -1 ; WX 722 ; N Uogonek ; B 14 -165 705 662 ;
+C -1 ; WX 722 ; N Aacute ; B 15 0 706 890 ;
+C -1 ; WX 722 ; N Adieresis ; B 15 0 706 835 ;
+C -1 ; WX 444 ; N egrave ; B 25 -10 424 678 ;
+C -1 ; WX 444 ; N zacute ; B 27 0 418 678 ;
+C -1 ; WX 278 ; N iogonek ; B 16 -165 265 683 ;
+C -1 ; WX 722 ; N Oacute ; B 34 -14 688 890 ;
+C -1 ; WX 500 ; N oacute ; B 29 -10 470 678 ;
+C -1 ; WX 444 ; N amacron ; B 37 -10 442 601 ;
+C -1 ; WX 389 ; N sacute ; B 51 -10 348 678 ;
+C -1 ; WX 278 ; N idieresis ; B -9 0 288 623 ;
+C -1 ; WX 722 ; N Ocircumflex ; B 34 -14 688 886 ;
+C -1 ; WX 722 ; N Ugrave ; B 14 -14 705 890 ;
+C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
+C -1 ; WX 500 ; N thorn ; B 5 -217 470 683 ;
+C -1 ; WX 300 ; N twosuperior ; B 1 270 296 676 ;
+C -1 ; WX 722 ; N Odieresis ; B 34 -14 688 835 ;
+C -1 ; WX 500 ; N mu ; B 36 -218 512 450 ;
+C -1 ; WX 278 ; N igrave ; B -8 0 253 678 ;
+C -1 ; WX 500 ; N ohungarumlaut ; B 29 -10 491 678 ;
+C -1 ; WX 611 ; N Eogonek ; B 12 -165 597 662 ;
+C -1 ; WX 500 ; N dcroat ; B 27 -10 500 683 ;
+C -1 ; WX 750 ; N threequarters ; B 15 -14 718 676 ;
+C -1 ; WX 556 ; N Scedilla ; B 42 -215 491 676 ;
+C -1 ; WX 344 ; N lcaron ; B 19 0 347 695 ;
+C -1 ; WX 722 ; N Kcommaaccent ; B 34 -198 723 662 ;
+C -1 ; WX 611 ; N Lacute ; B 12 0 598 890 ;
+C -1 ; WX 980 ; N trademark ; B 30 256 957 662 ;
+C -1 ; WX 444 ; N edotaccent ; B 25 -10 424 623 ;
+C -1 ; WX 333 ; N Igrave ; B 18 0 315 890 ;
+C -1 ; WX 333 ; N Imacron ; B 11 0 322 813 ;
+C -1 ; WX 611 ; N Lcaron ; B 12 0 598 676 ;
+C -1 ; WX 750 ; N onehalf ; B 31 -14 746 676 ;
+C -1 ; WX 549 ; N lessequal ; B 26 0 523 666 ;
+C -1 ; WX 500 ; N ocircumflex ; B 29 -10 470 674 ;
+C -1 ; WX 500 ; N ntilde ; B 16 0 485 638 ;
+C -1 ; WX 722 ; N Uhungarumlaut ; B 14 -14 705 890 ;
+C -1 ; WX 611 ; N Eacute ; B 12 0 597 890 ;
+C -1 ; WX 444 ; N emacron ; B 25 -10 424 601 ;
+C -1 ; WX 500 ; N gbreve ; B 28 -218 470 664 ;
+C -1 ; WX 750 ; N onequarter ; B 37 -14 718 676 ;
+C -1 ; WX 556 ; N Scaron ; B 42 -14 491 886 ;
+C -1 ; WX 556 ; N Scommaaccent ; B 42 -218 491 676 ;
+C -1 ; WX 722 ; N Ohungarumlaut ; B 34 -14 688 890 ;
+C -1 ; WX 400 ; N degree ; B 57 390 343 676 ;
+C -1 ; WX 500 ; N ograve ; B 29 -10 470 678 ;
+C -1 ; WX 667 ; N Ccaron ; B 28 -14 633 886 ;
+C -1 ; WX 500 ; N ugrave ; B 9 -10 479 678 ;
+C -1 ; WX 453 ; N radical ; B 2 -60 452 768 ;
+C -1 ; WX 722 ; N Dcaron ; B 16 0 685 886 ;
+C -1 ; WX 333 ; N rcommaaccent ; B 5 -218 335 460 ;
+C -1 ; WX 722 ; N Ntilde ; B 12 -11 707 850 ;
+C -1 ; WX 500 ; N otilde ; B 29 -10 470 638 ;
+C -1 ; WX 667 ; N Rcommaaccent ; B 17 -198 659 662 ;
+C -1 ; WX 611 ; N Lcommaaccent ; B 12 -218 598 662 ;
+C -1 ; WX 722 ; N Atilde ; B 15 0 706 850 ;
+C -1 ; WX 722 ; N Aogonek ; B 15 -165 738 674 ;
+C -1 ; WX 722 ; N Aring ; B 15 0 706 898 ;
+C -1 ; WX 722 ; N Otilde ; B 34 -14 688 850 ;
+C -1 ; WX 444 ; N zdotaccent ; B 27 0 418 623 ;
+C -1 ; WX 611 ; N Ecaron ; B 12 0 597 886 ;
+C -1 ; WX 333 ; N Iogonek ; B 18 -165 315 662 ;
+C -1 ; WX 500 ; N kcommaaccent ; B 7 -218 505 683 ;
+C -1 ; WX 564 ; N minus ; B 30 220 534 286 ;
+C -1 ; WX 333 ; N Icircumflex ; B 11 0 322 886 ;
+C -1 ; WX 500 ; N ncaron ; B 16 0 485 674 ;
+C -1 ; WX 278 ; N tcommaaccent ; B 13 -218 279 579 ;
+C -1 ; WX 564 ; N logicalnot ; B 30 108 534 386 ;
+C -1 ; WX 500 ; N odieresis ; B 29 -10 470 623 ;
+C -1 ; WX 500 ; N udieresis ; B 9 -10 479 623 ;
+C -1 ; WX 549 ; N notequal ; B 12 -31 537 547 ;
+C -1 ; WX 500 ; N gcommaaccent ; B 28 -218 470 749 ;
+C -1 ; WX 500 ; N eth ; B 29 -10 471 686 ;
+C -1 ; WX 444 ; N zcaron ; B 27 0 418 674 ;
+C -1 ; WX 500 ; N ncommaaccent ; B 16 -218 485 460 ;
+C -1 ; WX 300 ; N onesuperior ; B 57 270 248 676 ;
+C -1 ; WX 278 ; N imacron ; B 6 0 271 601 ;
+C -1 ; WX 500 ; N Euro ; B 0 0 0 0 ;
+EndCharMetrics
+StartKernData
+StartKernPairs 2073
+KPX A C -40
+KPX A Cacute -40
+KPX A Ccaron -40
+KPX A Ccedilla -40
+KPX A G -40
+KPX A Gbreve -40
+KPX A Gcommaaccent -40
+KPX A O -55
+KPX A Oacute -55
+KPX A Ocircumflex -55
+KPX A Odieresis -55
+KPX A Ograve -55
+KPX A Ohungarumlaut -55
+KPX A Omacron -55
+KPX A Oslash -55
+KPX A Otilde -55
+KPX A Q -55
+KPX A T -111
+KPX A Tcaron -111
+KPX A Tcommaaccent -111
+KPX A U -55
+KPX A Uacute -55
+KPX A Ucircumflex -55
+KPX A Udieresis -55
+KPX A Ugrave -55
+KPX A Uhungarumlaut -55
+KPX A Umacron -55
+KPX A Uogonek -55
+KPX A Uring -55
+KPX A V -135
+KPX A W -90
+KPX A Y -105
+KPX A Yacute -105
+KPX A Ydieresis -105
+KPX A quoteright -111
+KPX A v -74
+KPX A w -92
+KPX A y -92
+KPX A yacute -92
+KPX A ydieresis -92
+KPX Aacute C -40
+KPX Aacute Cacute -40
+KPX Aacute Ccaron -40
+KPX Aacute Ccedilla -40
+KPX Aacute G -40
+KPX Aacute Gbreve -40
+KPX Aacute Gcommaaccent -40
+KPX Aacute O -55
+KPX Aacute Oacute -55
+KPX Aacute Ocircumflex -55
+KPX Aacute Odieresis -55
+KPX Aacute Ograve -55
+KPX Aacute Ohungarumlaut -55
+KPX Aacute Omacron -55
+KPX Aacute Oslash -55
+KPX Aacute Otilde -55
+KPX Aacute Q -55
+KPX Aacute T -111
+KPX Aacute Tcaron -111
+KPX Aacute Tcommaaccent -111
+KPX Aacute U -55
+KPX Aacute Uacute -55
+KPX Aacute Ucircumflex -55
+KPX Aacute Udieresis -55
+KPX Aacute Ugrave -55
+KPX Aacute Uhungarumlaut -55
+KPX Aacute Umacron -55
+KPX Aacute Uogonek -55
+KPX Aacute Uring -55
+KPX Aacute V -135
+KPX Aacute W -90
+KPX Aacute Y -105
+KPX Aacute Yacute -105
+KPX Aacute Ydieresis -105
+KPX Aacute quoteright -111
+KPX Aacute v -74
+KPX Aacute w -92
+KPX Aacute y -92
+KPX Aacute yacute -92
+KPX Aacute ydieresis -92
+KPX Abreve C -40
+KPX Abreve Cacute -40
+KPX Abreve Ccaron -40
+KPX Abreve Ccedilla -40
+KPX Abreve G -40
+KPX Abreve Gbreve -40
+KPX Abreve Gcommaaccent -40
+KPX Abreve O -55
+KPX Abreve Oacute -55
+KPX Abreve Ocircumflex -55
+KPX Abreve Odieresis -55
+KPX Abreve Ograve -55
+KPX Abreve Ohungarumlaut -55
+KPX Abreve Omacron -55
+KPX Abreve Oslash -55
+KPX Abreve Otilde -55
+KPX Abreve Q -55
+KPX Abreve T -111
+KPX Abreve Tcaron -111
+KPX Abreve Tcommaaccent -111
+KPX Abreve U -55
+KPX Abreve Uacute -55
+KPX Abreve Ucircumflex -55
+KPX Abreve Udieresis -55
+KPX Abreve Ugrave -55
+KPX Abreve Uhungarumlaut -55
+KPX Abreve Umacron -55
+KPX Abreve Uogonek -55
+KPX Abreve Uring -55
+KPX Abreve V -135
+KPX Abreve W -90
+KPX Abreve Y -105
+KPX Abreve Yacute -105
+KPX Abreve Ydieresis -105
+KPX Abreve quoteright -111
+KPX Abreve v -74
+KPX Abreve w -92
+KPX Abreve y -92
+KPX Abreve yacute -92
+KPX Abreve ydieresis -92
+KPX Acircumflex C -40
+KPX Acircumflex Cacute -40
+KPX Acircumflex Ccaron -40
+KPX Acircumflex Ccedilla -40
+KPX Acircumflex G -40
+KPX Acircumflex Gbreve -40
+KPX Acircumflex Gcommaaccent -40
+KPX Acircumflex O -55
+KPX Acircumflex Oacute -55
+KPX Acircumflex Ocircumflex -55
+KPX Acircumflex Odieresis -55
+KPX Acircumflex Ograve -55
+KPX Acircumflex Ohungarumlaut -55
+KPX Acircumflex Omacron -55
+KPX Acircumflex Oslash -55
+KPX Acircumflex Otilde -55
+KPX Acircumflex Q -55
+KPX Acircumflex T -111
+KPX Acircumflex Tcaron -111
+KPX Acircumflex Tcommaaccent -111
+KPX Acircumflex U -55
+KPX Acircumflex Uacute -55
+KPX Acircumflex Ucircumflex -55
+KPX Acircumflex Udieresis -55
+KPX Acircumflex Ugrave -55
+KPX Acircumflex Uhungarumlaut -55
+KPX Acircumflex Umacron -55
+KPX Acircumflex Uogonek -55
+KPX Acircumflex Uring -55
+KPX Acircumflex V -135
+KPX Acircumflex W -90
+KPX Acircumflex Y -105
+KPX Acircumflex Yacute -105
+KPX Acircumflex Ydieresis -105
+KPX Acircumflex quoteright -111
+KPX Acircumflex v -74
+KPX Acircumflex w -92
+KPX Acircumflex y -92
+KPX Acircumflex yacute -92
+KPX Acircumflex ydieresis -92
+KPX Adieresis C -40
+KPX Adieresis Cacute -40
+KPX Adieresis Ccaron -40
+KPX Adieresis Ccedilla -40
+KPX Adieresis G -40
+KPX Adieresis Gbreve -40
+KPX Adieresis Gcommaaccent -40
+KPX Adieresis O -55
+KPX Adieresis Oacute -55
+KPX Adieresis Ocircumflex -55
+KPX Adieresis Odieresis -55
+KPX Adieresis Ograve -55
+KPX Adieresis Ohungarumlaut -55
+KPX Adieresis Omacron -55
+KPX Adieresis Oslash -55
+KPX Adieresis Otilde -55
+KPX Adieresis Q -55
+KPX Adieresis T -111
+KPX Adieresis Tcaron -111
+KPX Adieresis Tcommaaccent -111
+KPX Adieresis U -55
+KPX Adieresis Uacute -55
+KPX Adieresis Ucircumflex -55
+KPX Adieresis Udieresis -55
+KPX Adieresis Ugrave -55
+KPX Adieresis Uhungarumlaut -55
+KPX Adieresis Umacron -55
+KPX Adieresis Uogonek -55
+KPX Adieresis Uring -55
+KPX Adieresis V -135
+KPX Adieresis W -90
+KPX Adieresis Y -105
+KPX Adieresis Yacute -105
+KPX Adieresis Ydieresis -105
+KPX Adieresis quoteright -111
+KPX Adieresis v -74
+KPX Adieresis w -92
+KPX Adieresis y -92
+KPX Adieresis yacute -92
+KPX Adieresis ydieresis -92
+KPX Agrave C -40
+KPX Agrave Cacute -40
+KPX Agrave Ccaron -40
+KPX Agrave Ccedilla -40
+KPX Agrave G -40
+KPX Agrave Gbreve -40
+KPX Agrave Gcommaaccent -40
+KPX Agrave O -55
+KPX Agrave Oacute -55
+KPX Agrave Ocircumflex -55
+KPX Agrave Odieresis -55
+KPX Agrave Ograve -55
+KPX Agrave Ohungarumlaut -55
+KPX Agrave Omacron -55
+KPX Agrave Oslash -55
+KPX Agrave Otilde -55
+KPX Agrave Q -55
+KPX Agrave T -111
+KPX Agrave Tcaron -111
+KPX Agrave Tcommaaccent -111
+KPX Agrave U -55
+KPX Agrave Uacute -55
+KPX Agrave Ucircumflex -55
+KPX Agrave Udieresis -55
+KPX Agrave Ugrave -55
+KPX Agrave Uhungarumlaut -55
+KPX Agrave Umacron -55
+KPX Agrave Uogonek -55
+KPX Agrave Uring -55
+KPX Agrave V -135
+KPX Agrave W -90
+KPX Agrave Y -105
+KPX Agrave Yacute -105
+KPX Agrave Ydieresis -105
+KPX Agrave quoteright -111
+KPX Agrave v -74
+KPX Agrave w -92
+KPX Agrave y -92
+KPX Agrave yacute -92
+KPX Agrave ydieresis -92
+KPX Amacron C -40
+KPX Amacron Cacute -40
+KPX Amacron Ccaron -40
+KPX Amacron Ccedilla -40
+KPX Amacron G -40
+KPX Amacron Gbreve -40
+KPX Amacron Gcommaaccent -40
+KPX Amacron O -55
+KPX Amacron Oacute -55
+KPX Amacron Ocircumflex -55
+KPX Amacron Odieresis -55
+KPX Amacron Ograve -55
+KPX Amacron Ohungarumlaut -55
+KPX Amacron Omacron -55
+KPX Amacron Oslash -55
+KPX Amacron Otilde -55
+KPX Amacron Q -55
+KPX Amacron T -111
+KPX Amacron Tcaron -111
+KPX Amacron Tcommaaccent -111
+KPX Amacron U -55
+KPX Amacron Uacute -55
+KPX Amacron Ucircumflex -55
+KPX Amacron Udieresis -55
+KPX Amacron Ugrave -55
+KPX Amacron Uhungarumlaut -55
+KPX Amacron Umacron -55
+KPX Amacron Uogonek -55
+KPX Amacron Uring -55
+KPX Amacron V -135
+KPX Amacron W -90
+KPX Amacron Y -105
+KPX Amacron Yacute -105
+KPX Amacron Ydieresis -105
+KPX Amacron quoteright -111
+KPX Amacron v -74
+KPX Amacron w -92
+KPX Amacron y -92
+KPX Amacron yacute -92
+KPX Amacron ydieresis -92
+KPX Aogonek C -40
+KPX Aogonek Cacute -40
+KPX Aogonek Ccaron -40
+KPX Aogonek Ccedilla -40
+KPX Aogonek G -40
+KPX Aogonek Gbreve -40
+KPX Aogonek Gcommaaccent -40
+KPX Aogonek O -55
+KPX Aogonek Oacute -55
+KPX Aogonek Ocircumflex -55
+KPX Aogonek Odieresis -55
+KPX Aogonek Ograve -55
+KPX Aogonek Ohungarumlaut -55
+KPX Aogonek Omacron -55
+KPX Aogonek Oslash -55
+KPX Aogonek Otilde -55
+KPX Aogonek Q -55
+KPX Aogonek T -111
+KPX Aogonek Tcaron -111
+KPX Aogonek Tcommaaccent -111
+KPX Aogonek U -55
+KPX Aogonek Uacute -55
+KPX Aogonek Ucircumflex -55
+KPX Aogonek Udieresis -55
+KPX Aogonek Ugrave -55
+KPX Aogonek Uhungarumlaut -55
+KPX Aogonek Umacron -55
+KPX Aogonek Uogonek -55
+KPX Aogonek Uring -55
+KPX Aogonek V -135
+KPX Aogonek W -90
+KPX Aogonek Y -105
+KPX Aogonek Yacute -105
+KPX Aogonek Ydieresis -105
+KPX Aogonek quoteright -111
+KPX Aogonek v -74
+KPX Aogonek w -52
+KPX Aogonek y -52
+KPX Aogonek yacute -52
+KPX Aogonek ydieresis -52
+KPX Aring C -40
+KPX Aring Cacute -40
+KPX Aring Ccaron -40
+KPX Aring Ccedilla -40
+KPX Aring G -40
+KPX Aring Gbreve -40
+KPX Aring Gcommaaccent -40
+KPX Aring O -55
+KPX Aring Oacute -55
+KPX Aring Ocircumflex -55
+KPX Aring Odieresis -55
+KPX Aring Ograve -55
+KPX Aring Ohungarumlaut -55
+KPX Aring Omacron -55
+KPX Aring Oslash -55
+KPX Aring Otilde -55
+KPX Aring Q -55
+KPX Aring T -111
+KPX Aring Tcaron -111
+KPX Aring Tcommaaccent -111
+KPX Aring U -55
+KPX Aring Uacute -55
+KPX Aring Ucircumflex -55
+KPX Aring Udieresis -55
+KPX Aring Ugrave -55
+KPX Aring Uhungarumlaut -55
+KPX Aring Umacron -55
+KPX Aring Uogonek -55
+KPX Aring Uring -55
+KPX Aring V -135
+KPX Aring W -90
+KPX Aring Y -105
+KPX Aring Yacute -105
+KPX Aring Ydieresis -105
+KPX Aring quoteright -111
+KPX Aring v -74
+KPX Aring w -92
+KPX Aring y -92
+KPX Aring yacute -92
+KPX Aring ydieresis -92
+KPX Atilde C -40
+KPX Atilde Cacute -40
+KPX Atilde Ccaron -40
+KPX Atilde Ccedilla -40
+KPX Atilde G -40
+KPX Atilde Gbreve -40
+KPX Atilde Gcommaaccent -40
+KPX Atilde O -55
+KPX Atilde Oacute -55
+KPX Atilde Ocircumflex -55
+KPX Atilde Odieresis -55
+KPX Atilde Ograve -55
+KPX Atilde Ohungarumlaut -55
+KPX Atilde Omacron -55
+KPX Atilde Oslash -55
+KPX Atilde Otilde -55
+KPX Atilde Q -55
+KPX Atilde T -111
+KPX Atilde Tcaron -111
+KPX Atilde Tcommaaccent -111
+KPX Atilde U -55
+KPX Atilde Uacute -55
+KPX Atilde Ucircumflex -55
+KPX Atilde Udieresis -55
+KPX Atilde Ugrave -55
+KPX Atilde Uhungarumlaut -55
+KPX Atilde Umacron -55
+KPX Atilde Uogonek -55
+KPX Atilde Uring -55
+KPX Atilde V -135
+KPX Atilde W -90
+KPX Atilde Y -105
+KPX Atilde Yacute -105
+KPX Atilde Ydieresis -105
+KPX Atilde quoteright -111
+KPX Atilde v -74
+KPX Atilde w -92
+KPX Atilde y -92
+KPX Atilde yacute -92
+KPX Atilde ydieresis -92
+KPX B A -35
+KPX B Aacute -35
+KPX B Abreve -35
+KPX B Acircumflex -35
+KPX B Adieresis -35
+KPX B Agrave -35
+KPX B Amacron -35
+KPX B Aogonek -35
+KPX B Aring -35
+KPX B Atilde -35
+KPX B U -10
+KPX B Uacute -10
+KPX B Ucircumflex -10
+KPX B Udieresis -10
+KPX B Ugrave -10
+KPX B Uhungarumlaut -10
+KPX B Umacron -10
+KPX B Uogonek -10
+KPX B Uring -10
+KPX D A -40
+KPX D Aacute -40
+KPX D Abreve -40
+KPX D Acircumflex -40
+KPX D Adieresis -40
+KPX D Agrave -40
+KPX D Amacron -40
+KPX D Aogonek -40
+KPX D Aring -40
+KPX D Atilde -40
+KPX D V -40
+KPX D W -30
+KPX D Y -55
+KPX D Yacute -55
+KPX D Ydieresis -55
+KPX Dcaron A -40
+KPX Dcaron Aacute -40
+KPX Dcaron Abreve -40
+KPX Dcaron Acircumflex -40
+KPX Dcaron Adieresis -40
+KPX Dcaron Agrave -40
+KPX Dcaron Amacron -40
+KPX Dcaron Aogonek -40
+KPX Dcaron Aring -40
+KPX Dcaron Atilde -40
+KPX Dcaron V -40
+KPX Dcaron W -30
+KPX Dcaron Y -55
+KPX Dcaron Yacute -55
+KPX Dcaron Ydieresis -55
+KPX Dcroat A -40
+KPX Dcroat Aacute -40
+KPX Dcroat Abreve -40
+KPX Dcroat Acircumflex -40
+KPX Dcroat Adieresis -40
+KPX Dcroat Agrave -40
+KPX Dcroat Amacron -40
+KPX Dcroat Aogonek -40
+KPX Dcroat Aring -40
+KPX Dcroat Atilde -40
+KPX Dcroat V -40
+KPX Dcroat W -30
+KPX Dcroat Y -55
+KPX Dcroat Yacute -55
+KPX Dcroat Ydieresis -55
+KPX F A -74
+KPX F Aacute -74
+KPX F Abreve -74
+KPX F Acircumflex -74
+KPX F Adieresis -74
+KPX F Agrave -74
+KPX F Amacron -74
+KPX F Aogonek -74
+KPX F Aring -74
+KPX F Atilde -74
+KPX F a -15
+KPX F aacute -15
+KPX F abreve -15
+KPX F acircumflex -15
+KPX F adieresis -15
+KPX F agrave -15
+KPX F amacron -15
+KPX F aogonek -15
+KPX F aring -15
+KPX F atilde -15
+KPX F comma -80
+KPX F o -15
+KPX F oacute -15
+KPX F ocircumflex -15
+KPX F odieresis -15
+KPX F ograve -15
+KPX F ohungarumlaut -15
+KPX F omacron -15
+KPX F oslash -15
+KPX F otilde -15
+KPX F period -80
+KPX J A -60
+KPX J Aacute -60
+KPX J Abreve -60
+KPX J Acircumflex -60
+KPX J Adieresis -60
+KPX J Agrave -60
+KPX J Amacron -60
+KPX J Aogonek -60
+KPX J Aring -60
+KPX J Atilde -60
+KPX K O -30
+KPX K Oacute -30
+KPX K Ocircumflex -30
+KPX K Odieresis -30
+KPX K Ograve -30
+KPX K Ohungarumlaut -30
+KPX K Omacron -30
+KPX K Oslash -30
+KPX K Otilde -30
+KPX K e -25
+KPX K eacute -25
+KPX K ecaron -25
+KPX K ecircumflex -25
+KPX K edieresis -25
+KPX K edotaccent -25
+KPX K egrave -25
+KPX K emacron -25
+KPX K eogonek -25
+KPX K o -35
+KPX K oacute -35
+KPX K ocircumflex -35
+KPX K odieresis -35
+KPX K ograve -35
+KPX K ohungarumlaut -35
+KPX K omacron -35
+KPX K oslash -35
+KPX K otilde -35
+KPX K u -15
+KPX K uacute -15
+KPX K ucircumflex -15
+KPX K udieresis -15
+KPX K ugrave -15
+KPX K uhungarumlaut -15
+KPX K umacron -15
+KPX K uogonek -15
+KPX K uring -15
+KPX K y -25
+KPX K yacute -25
+KPX K ydieresis -25
+KPX Kcommaaccent O -30
+KPX Kcommaaccent Oacute -30
+KPX Kcommaaccent Ocircumflex -30
+KPX Kcommaaccent Odieresis -30
+KPX Kcommaaccent Ograve -30
+KPX Kcommaaccent Ohungarumlaut -30
+KPX Kcommaaccent Omacron -30
+KPX Kcommaaccent Oslash -30
+KPX Kcommaaccent Otilde -30
+KPX Kcommaaccent e -25
+KPX Kcommaaccent eacute -25
+KPX Kcommaaccent ecaron -25
+KPX Kcommaaccent ecircumflex -25
+KPX Kcommaaccent edieresis -25
+KPX Kcommaaccent edotaccent -25
+KPX Kcommaaccent egrave -25
+KPX Kcommaaccent emacron -25
+KPX Kcommaaccent eogonek -25
+KPX Kcommaaccent o -35
+KPX Kcommaaccent oacute -35
+KPX Kcommaaccent ocircumflex -35
+KPX Kcommaaccent odieresis -35
+KPX Kcommaaccent ograve -35
+KPX Kcommaaccent ohungarumlaut -35
+KPX Kcommaaccent omacron -35
+KPX Kcommaaccent oslash -35
+KPX Kcommaaccent otilde -35
+KPX Kcommaaccent u -15
+KPX Kcommaaccent uacute -15
+KPX Kcommaaccent ucircumflex -15
+KPX Kcommaaccent udieresis -15
+KPX Kcommaaccent ugrave -15
+KPX Kcommaaccent uhungarumlaut -15
+KPX Kcommaaccent umacron -15
+KPX Kcommaaccent uogonek -15
+KPX Kcommaaccent uring -15
+KPX Kcommaaccent y -25
+KPX Kcommaaccent yacute -25
+KPX Kcommaaccent ydieresis -25
+KPX L T -92
+KPX L Tcaron -92
+KPX L Tcommaaccent -92
+KPX L V -100
+KPX L W -74
+KPX L Y -100
+KPX L Yacute -100
+KPX L Ydieresis -100
+KPX L quoteright -92
+KPX L y -55
+KPX L yacute -55
+KPX L ydieresis -55
+KPX Lacute T -92
+KPX Lacute Tcaron -92
+KPX Lacute Tcommaaccent -92
+KPX Lacute V -100
+KPX Lacute W -74
+KPX Lacute Y -100
+KPX Lacute Yacute -100
+KPX Lacute Ydieresis -100
+KPX Lacute quoteright -92
+KPX Lacute y -55
+KPX Lacute yacute -55
+KPX Lacute ydieresis -55
+KPX Lcaron quoteright -92
+KPX Lcaron y -55
+KPX Lcaron yacute -55
+KPX Lcaron ydieresis -55
+KPX Lcommaaccent T -92
+KPX Lcommaaccent Tcaron -92
+KPX Lcommaaccent Tcommaaccent -92
+KPX Lcommaaccent V -100
+KPX Lcommaaccent W -74
+KPX Lcommaaccent Y -100
+KPX Lcommaaccent Yacute -100
+KPX Lcommaaccent Ydieresis -100
+KPX Lcommaaccent quoteright -92
+KPX Lcommaaccent y -55
+KPX Lcommaaccent yacute -55
+KPX Lcommaaccent ydieresis -55
+KPX Lslash T -92
+KPX Lslash Tcaron -92
+KPX Lslash Tcommaaccent -92
+KPX Lslash V -100
+KPX Lslash W -74
+KPX Lslash Y -100
+KPX Lslash Yacute -100
+KPX Lslash Ydieresis -100
+KPX Lslash quoteright -92
+KPX Lslash y -55
+KPX Lslash yacute -55
+KPX Lslash ydieresis -55
+KPX N A -35
+KPX N Aacute -35
+KPX N Abreve -35
+KPX N Acircumflex -35
+KPX N Adieresis -35
+KPX N Agrave -35
+KPX N Amacron -35
+KPX N Aogonek -35
+KPX N Aring -35
+KPX N Atilde -35
+KPX Nacute A -35
+KPX Nacute Aacute -35
+KPX Nacute Abreve -35
+KPX Nacute Acircumflex -35
+KPX Nacute Adieresis -35
+KPX Nacute Agrave -35
+KPX Nacute Amacron -35
+KPX Nacute Aogonek -35
+KPX Nacute Aring -35
+KPX Nacute Atilde -35
+KPX Ncaron A -35
+KPX Ncaron Aacute -35
+KPX Ncaron Abreve -35
+KPX Ncaron Acircumflex -35
+KPX Ncaron Adieresis -35
+KPX Ncaron Agrave -35
+KPX Ncaron Amacron -35
+KPX Ncaron Aogonek -35
+KPX Ncaron Aring -35
+KPX Ncaron Atilde -35
+KPX Ncommaaccent A -35
+KPX Ncommaaccent Aacute -35
+KPX Ncommaaccent Abreve -35
+KPX Ncommaaccent Acircumflex -35
+KPX Ncommaaccent Adieresis -35
+KPX Ncommaaccent Agrave -35
+KPX Ncommaaccent Amacron -35
+KPX Ncommaaccent Aogonek -35
+KPX Ncommaaccent Aring -35
+KPX Ncommaaccent Atilde -35
+KPX Ntilde A -35
+KPX Ntilde Aacute -35
+KPX Ntilde Abreve -35
+KPX Ntilde Acircumflex -35
+KPX Ntilde Adieresis -35
+KPX Ntilde Agrave -35
+KPX Ntilde Amacron -35
+KPX Ntilde Aogonek -35
+KPX Ntilde Aring -35
+KPX Ntilde Atilde -35
+KPX O A -35
+KPX O Aacute -35
+KPX O Abreve -35
+KPX O Acircumflex -35
+KPX O Adieresis -35
+KPX O Agrave -35
+KPX O Amacron -35
+KPX O Aogonek -35
+KPX O Aring -35
+KPX O Atilde -35
+KPX O T -40
+KPX O Tcaron -40
+KPX O Tcommaaccent -40
+KPX O V -50
+KPX O W -35
+KPX O X -40
+KPX O Y -50
+KPX O Yacute -50
+KPX O Ydieresis -50
+KPX Oacute A -35
+KPX Oacute Aacute -35
+KPX Oacute Abreve -35
+KPX Oacute Acircumflex -35
+KPX Oacute Adieresis -35
+KPX Oacute Agrave -35
+KPX Oacute Amacron -35
+KPX Oacute Aogonek -35
+KPX Oacute Aring -35
+KPX Oacute Atilde -35
+KPX Oacute T -40
+KPX Oacute Tcaron -40
+KPX Oacute Tcommaaccent -40
+KPX Oacute V -50
+KPX Oacute W -35
+KPX Oacute X -40
+KPX Oacute Y -50
+KPX Oacute Yacute -50
+KPX Oacute Ydieresis -50
+KPX Ocircumflex A -35
+KPX Ocircumflex Aacute -35
+KPX Ocircumflex Abreve -35
+KPX Ocircumflex Acircumflex -35
+KPX Ocircumflex Adieresis -35
+KPX Ocircumflex Agrave -35
+KPX Ocircumflex Amacron -35
+KPX Ocircumflex Aogonek -35
+KPX Ocircumflex Aring -35
+KPX Ocircumflex Atilde -35
+KPX Ocircumflex T -40
+KPX Ocircumflex Tcaron -40
+KPX Ocircumflex Tcommaaccent -40
+KPX Ocircumflex V -50
+KPX Ocircumflex W -35
+KPX Ocircumflex X -40
+KPX Ocircumflex Y -50
+KPX Ocircumflex Yacute -50
+KPX Ocircumflex Ydieresis -50
+KPX Odieresis A -35
+KPX Odieresis Aacute -35
+KPX Odieresis Abreve -35
+KPX Odieresis Acircumflex -35
+KPX Odieresis Adieresis -35
+KPX Odieresis Agrave -35
+KPX Odieresis Amacron -35
+KPX Odieresis Aogonek -35
+KPX Odieresis Aring -35
+KPX Odieresis Atilde -35
+KPX Odieresis T -40
+KPX Odieresis Tcaron -40
+KPX Odieresis Tcommaaccent -40
+KPX Odieresis V -50
+KPX Odieresis W -35
+KPX Odieresis X -40
+KPX Odieresis Y -50
+KPX Odieresis Yacute -50
+KPX Odieresis Ydieresis -50
+KPX Ograve A -35
+KPX Ograve Aacute -35
+KPX Ograve Abreve -35
+KPX Ograve Acircumflex -35
+KPX Ograve Adieresis -35
+KPX Ograve Agrave -35
+KPX Ograve Amacron -35
+KPX Ograve Aogonek -35
+KPX Ograve Aring -35
+KPX Ograve Atilde -35
+KPX Ograve T -40
+KPX Ograve Tcaron -40
+KPX Ograve Tcommaaccent -40
+KPX Ograve V -50
+KPX Ograve W -35
+KPX Ograve X -40
+KPX Ograve Y -50
+KPX Ograve Yacute -50
+KPX Ograve Ydieresis -50
+KPX Ohungarumlaut A -35
+KPX Ohungarumlaut Aacute -35
+KPX Ohungarumlaut Abreve -35
+KPX Ohungarumlaut Acircumflex -35
+KPX Ohungarumlaut Adieresis -35
+KPX Ohungarumlaut Agrave -35
+KPX Ohungarumlaut Amacron -35
+KPX Ohungarumlaut Aogonek -35
+KPX Ohungarumlaut Aring -35
+KPX Ohungarumlaut Atilde -35
+KPX Ohungarumlaut T -40
+KPX Ohungarumlaut Tcaron -40
+KPX Ohungarumlaut Tcommaaccent -40
+KPX Ohungarumlaut V -50
+KPX Ohungarumlaut W -35
+KPX Ohungarumlaut X -40
+KPX Ohungarumlaut Y -50
+KPX Ohungarumlaut Yacute -50
+KPX Ohungarumlaut Ydieresis -50
+KPX Omacron A -35
+KPX Omacron Aacute -35
+KPX Omacron Abreve -35
+KPX Omacron Acircumflex -35
+KPX Omacron Adieresis -35
+KPX Omacron Agrave -35
+KPX Omacron Amacron -35
+KPX Omacron Aogonek -35
+KPX Omacron Aring -35
+KPX Omacron Atilde -35
+KPX Omacron T -40
+KPX Omacron Tcaron -40
+KPX Omacron Tcommaaccent -40
+KPX Omacron V -50
+KPX Omacron W -35
+KPX Omacron X -40
+KPX Omacron Y -50
+KPX Omacron Yacute -50
+KPX Omacron Ydieresis -50
+KPX Oslash A -35
+KPX Oslash Aacute -35
+KPX Oslash Abreve -35
+KPX Oslash Acircumflex -35
+KPX Oslash Adieresis -35
+KPX Oslash Agrave -35
+KPX Oslash Amacron -35
+KPX Oslash Aogonek -35
+KPX Oslash Aring -35
+KPX Oslash Atilde -35
+KPX Oslash T -40
+KPX Oslash Tcaron -40
+KPX Oslash Tcommaaccent -40
+KPX Oslash V -50
+KPX Oslash W -35
+KPX Oslash X -40
+KPX Oslash Y -50
+KPX Oslash Yacute -50
+KPX Oslash Ydieresis -50
+KPX Otilde A -35
+KPX Otilde Aacute -35
+KPX Otilde Abreve -35
+KPX Otilde Acircumflex -35
+KPX Otilde Adieresis -35
+KPX Otilde Agrave -35
+KPX Otilde Amacron -35
+KPX Otilde Aogonek -35
+KPX Otilde Aring -35
+KPX Otilde Atilde -35
+KPX Otilde T -40
+KPX Otilde Tcaron -40
+KPX Otilde Tcommaaccent -40
+KPX Otilde V -50
+KPX Otilde W -35
+KPX Otilde X -40
+KPX Otilde Y -50
+KPX Otilde Yacute -50
+KPX Otilde Ydieresis -50
+KPX P A -92
+KPX P Aacute -92
+KPX P Abreve -92
+KPX P Acircumflex -92
+KPX P Adieresis -92
+KPX P Agrave -92
+KPX P Amacron -92
+KPX P Aogonek -92
+KPX P Aring -92
+KPX P Atilde -92
+KPX P a -15
+KPX P aacute -15
+KPX P abreve -15
+KPX P acircumflex -15
+KPX P adieresis -15
+KPX P agrave -15
+KPX P amacron -15
+KPX P aogonek -15
+KPX P aring -15
+KPX P atilde -15
+KPX P comma -111
+KPX P period -111
+KPX Q U -10
+KPX Q Uacute -10
+KPX Q Ucircumflex -10
+KPX Q Udieresis -10
+KPX Q Ugrave -10
+KPX Q Uhungarumlaut -10
+KPX Q Umacron -10
+KPX Q Uogonek -10
+KPX Q Uring -10
+KPX R O -40
+KPX R Oacute -40
+KPX R Ocircumflex -40
+KPX R Odieresis -40
+KPX R Ograve -40
+KPX R Ohungarumlaut -40
+KPX R Omacron -40
+KPX R Oslash -40
+KPX R Otilde -40
+KPX R T -60
+KPX R Tcaron -60
+KPX R Tcommaaccent -60
+KPX R U -40
+KPX R Uacute -40
+KPX R Ucircumflex -40
+KPX R Udieresis -40
+KPX R Ugrave -40
+KPX R Uhungarumlaut -40
+KPX R Umacron -40
+KPX R Uogonek -40
+KPX R Uring -40
+KPX R V -80
+KPX R W -55
+KPX R Y -65
+KPX R Yacute -65
+KPX R Ydieresis -65
+KPX Racute O -40
+KPX Racute Oacute -40
+KPX Racute Ocircumflex -40
+KPX Racute Odieresis -40
+KPX Racute Ograve -40
+KPX Racute Ohungarumlaut -40
+KPX Racute Omacron -40
+KPX Racute Oslash -40
+KPX Racute Otilde -40
+KPX Racute T -60
+KPX Racute Tcaron -60
+KPX Racute Tcommaaccent -60
+KPX Racute U -40
+KPX Racute Uacute -40
+KPX Racute Ucircumflex -40
+KPX Racute Udieresis -40
+KPX Racute Ugrave -40
+KPX Racute Uhungarumlaut -40
+KPX Racute Umacron -40
+KPX Racute Uogonek -40
+KPX Racute Uring -40
+KPX Racute V -80
+KPX Racute W -55
+KPX Racute Y -65
+KPX Racute Yacute -65
+KPX Racute Ydieresis -65
+KPX Rcaron O -40
+KPX Rcaron Oacute -40
+KPX Rcaron Ocircumflex -40
+KPX Rcaron Odieresis -40
+KPX Rcaron Ograve -40
+KPX Rcaron Ohungarumlaut -40
+KPX Rcaron Omacron -40
+KPX Rcaron Oslash -40
+KPX Rcaron Otilde -40
+KPX Rcaron T -60
+KPX Rcaron Tcaron -60
+KPX Rcaron Tcommaaccent -60
+KPX Rcaron U -40
+KPX Rcaron Uacute -40
+KPX Rcaron Ucircumflex -40
+KPX Rcaron Udieresis -40
+KPX Rcaron Ugrave -40
+KPX Rcaron Uhungarumlaut -40
+KPX Rcaron Umacron -40
+KPX Rcaron Uogonek -40
+KPX Rcaron Uring -40
+KPX Rcaron V -80
+KPX Rcaron W -55
+KPX Rcaron Y -65
+KPX Rcaron Yacute -65
+KPX Rcaron Ydieresis -65
+KPX Rcommaaccent O -40
+KPX Rcommaaccent Oacute -40
+KPX Rcommaaccent Ocircumflex -40
+KPX Rcommaaccent Odieresis -40
+KPX Rcommaaccent Ograve -40
+KPX Rcommaaccent Ohungarumlaut -40
+KPX Rcommaaccent Omacron -40
+KPX Rcommaaccent Oslash -40
+KPX Rcommaaccent Otilde -40
+KPX Rcommaaccent T -60
+KPX Rcommaaccent Tcaron -60
+KPX Rcommaaccent Tcommaaccent -60
+KPX Rcommaaccent U -40
+KPX Rcommaaccent Uacute -40
+KPX Rcommaaccent Ucircumflex -40
+KPX Rcommaaccent Udieresis -40
+KPX Rcommaaccent Ugrave -40
+KPX Rcommaaccent Uhungarumlaut -40
+KPX Rcommaaccent Umacron -40
+KPX Rcommaaccent Uogonek -40
+KPX Rcommaaccent Uring -40
+KPX Rcommaaccent V -80
+KPX Rcommaaccent W -55
+KPX Rcommaaccent Y -65
+KPX Rcommaaccent Yacute -65
+KPX Rcommaaccent Ydieresis -65
+KPX T A -93
+KPX T Aacute -93
+KPX T Abreve -93
+KPX T Acircumflex -93
+KPX T Adieresis -93
+KPX T Agrave -93
+KPX T Amacron -93
+KPX T Aogonek -93
+KPX T Aring -93
+KPX T Atilde -93
+KPX T O -18
+KPX T Oacute -18
+KPX T Ocircumflex -18
+KPX T Odieresis -18
+KPX T Ograve -18
+KPX T Ohungarumlaut -18
+KPX T Omacron -18
+KPX T Oslash -18
+KPX T Otilde -18
+KPX T a -80
+KPX T aacute -80
+KPX T abreve -80
+KPX T acircumflex -80
+KPX T adieresis -40
+KPX T agrave -40
+KPX T amacron -40
+KPX T aogonek -80
+KPX T aring -80
+KPX T atilde -40
+KPX T colon -50
+KPX T comma -74
+KPX T e -70
+KPX T eacute -70
+KPX T ecaron -70
+KPX T ecircumflex -70
+KPX T edieresis -30
+KPX T edotaccent -70
+KPX T egrave -70
+KPX T emacron -30
+KPX T eogonek -70
+KPX T hyphen -92
+KPX T i -35
+KPX T iacute -35
+KPX T iogonek -35
+KPX T o -80
+KPX T oacute -80
+KPX T ocircumflex -80
+KPX T odieresis -80
+KPX T ograve -80
+KPX T ohungarumlaut -80
+KPX T omacron -80
+KPX T oslash -80
+KPX T otilde -80
+KPX T period -74
+KPX T r -35
+KPX T racute -35
+KPX T rcaron -35
+KPX T rcommaaccent -35
+KPX T semicolon -55
+KPX T u -45
+KPX T uacute -45
+KPX T ucircumflex -45
+KPX T udieresis -45
+KPX T ugrave -45
+KPX T uhungarumlaut -45
+KPX T umacron -45
+KPX T uogonek -45
+KPX T uring -45
+KPX T w -80
+KPX T y -80
+KPX T yacute -80
+KPX T ydieresis -80
+KPX Tcaron A -93
+KPX Tcaron Aacute -93
+KPX Tcaron Abreve -93
+KPX Tcaron Acircumflex -93
+KPX Tcaron Adieresis -93
+KPX Tcaron Agrave -93
+KPX Tcaron Amacron -93
+KPX Tcaron Aogonek -93
+KPX Tcaron Aring -93
+KPX Tcaron Atilde -93
+KPX Tcaron O -18
+KPX Tcaron Oacute -18
+KPX Tcaron Ocircumflex -18
+KPX Tcaron Odieresis -18
+KPX Tcaron Ograve -18
+KPX Tcaron Ohungarumlaut -18
+KPX Tcaron Omacron -18
+KPX Tcaron Oslash -18
+KPX Tcaron Otilde -18
+KPX Tcaron a -80
+KPX Tcaron aacute -80
+KPX Tcaron abreve -80
+KPX Tcaron acircumflex -80
+KPX Tcaron adieresis -40
+KPX Tcaron agrave -40
+KPX Tcaron amacron -40
+KPX Tcaron aogonek -80
+KPX Tcaron aring -80
+KPX Tcaron atilde -40
+KPX Tcaron colon -50
+KPX Tcaron comma -74
+KPX Tcaron e -70
+KPX Tcaron eacute -70
+KPX Tcaron ecaron -70
+KPX Tcaron ecircumflex -30
+KPX Tcaron edieresis -30
+KPX Tcaron edotaccent -70
+KPX Tcaron egrave -70
+KPX Tcaron emacron -30
+KPX Tcaron eogonek -70
+KPX Tcaron hyphen -92
+KPX Tcaron i -35
+KPX Tcaron iacute -35
+KPX Tcaron iogonek -35
+KPX Tcaron o -80
+KPX Tcaron oacute -80
+KPX Tcaron ocircumflex -80
+KPX Tcaron odieresis -80
+KPX Tcaron ograve -80
+KPX Tcaron ohungarumlaut -80
+KPX Tcaron omacron -80
+KPX Tcaron oslash -80
+KPX Tcaron otilde -80
+KPX Tcaron period -74
+KPX Tcaron r -35
+KPX Tcaron racute -35
+KPX Tcaron rcaron -35
+KPX Tcaron rcommaaccent -35
+KPX Tcaron semicolon -55
+KPX Tcaron u -45
+KPX Tcaron uacute -45
+KPX Tcaron ucircumflex -45
+KPX Tcaron udieresis -45
+KPX Tcaron ugrave -45
+KPX Tcaron uhungarumlaut -45
+KPX Tcaron umacron -45
+KPX Tcaron uogonek -45
+KPX Tcaron uring -45
+KPX Tcaron w -80
+KPX Tcaron y -80
+KPX Tcaron yacute -80
+KPX Tcaron ydieresis -80
+KPX Tcommaaccent A -93
+KPX Tcommaaccent Aacute -93
+KPX Tcommaaccent Abreve -93
+KPX Tcommaaccent Acircumflex -93
+KPX Tcommaaccent Adieresis -93
+KPX Tcommaaccent Agrave -93
+KPX Tcommaaccent Amacron -93
+KPX Tcommaaccent Aogonek -93
+KPX Tcommaaccent Aring -93
+KPX Tcommaaccent Atilde -93
+KPX Tcommaaccent O -18
+KPX Tcommaaccent Oacute -18
+KPX Tcommaaccent Ocircumflex -18
+KPX Tcommaaccent Odieresis -18
+KPX Tcommaaccent Ograve -18
+KPX Tcommaaccent Ohungarumlaut -18
+KPX Tcommaaccent Omacron -18
+KPX Tcommaaccent Oslash -18
+KPX Tcommaaccent Otilde -18
+KPX Tcommaaccent a -80
+KPX Tcommaaccent aacute -80
+KPX Tcommaaccent abreve -80
+KPX Tcommaaccent acircumflex -80
+KPX Tcommaaccent adieresis -40
+KPX Tcommaaccent agrave -40
+KPX Tcommaaccent amacron -40
+KPX Tcommaaccent aogonek -80
+KPX Tcommaaccent aring -80
+KPX Tcommaaccent atilde -40
+KPX Tcommaaccent colon -50
+KPX Tcommaaccent comma -74
+KPX Tcommaaccent e -70
+KPX Tcommaaccent eacute -70
+KPX Tcommaaccent ecaron -70
+KPX Tcommaaccent ecircumflex -30
+KPX Tcommaaccent edieresis -30
+KPX Tcommaaccent edotaccent -70
+KPX Tcommaaccent egrave -30
+KPX Tcommaaccent emacron -70
+KPX Tcommaaccent eogonek -70
+KPX Tcommaaccent hyphen -92
+KPX Tcommaaccent i -35
+KPX Tcommaaccent iacute -35
+KPX Tcommaaccent iogonek -35
+KPX Tcommaaccent o -80
+KPX Tcommaaccent oacute -80
+KPX Tcommaaccent ocircumflex -80
+KPX Tcommaaccent odieresis -80
+KPX Tcommaaccent ograve -80
+KPX Tcommaaccent ohungarumlaut -80
+KPX Tcommaaccent omacron -80
+KPX Tcommaaccent oslash -80
+KPX Tcommaaccent otilde -80
+KPX Tcommaaccent period -74
+KPX Tcommaaccent r -35
+KPX Tcommaaccent racute -35
+KPX Tcommaaccent rcaron -35
+KPX Tcommaaccent rcommaaccent -35
+KPX Tcommaaccent semicolon -55
+KPX Tcommaaccent u -45
+KPX Tcommaaccent uacute -45
+KPX Tcommaaccent ucircumflex -45
+KPX Tcommaaccent udieresis -45
+KPX Tcommaaccent ugrave -45
+KPX Tcommaaccent uhungarumlaut -45
+KPX Tcommaaccent umacron -45
+KPX Tcommaaccent uogonek -45
+KPX Tcommaaccent uring -45
+KPX Tcommaaccent w -80
+KPX Tcommaaccent y -80
+KPX Tcommaaccent yacute -80
+KPX Tcommaaccent ydieresis -80
+KPX U A -40
+KPX U Aacute -40
+KPX U Abreve -40
+KPX U Acircumflex -40
+KPX U Adieresis -40
+KPX U Agrave -40
+KPX U Amacron -40
+KPX U Aogonek -40
+KPX U Aring -40
+KPX U Atilde -40
+KPX Uacute A -40
+KPX Uacute Aacute -40
+KPX Uacute Abreve -40
+KPX Uacute Acircumflex -40
+KPX Uacute Adieresis -40
+KPX Uacute Agrave -40
+KPX Uacute Amacron -40
+KPX Uacute Aogonek -40
+KPX Uacute Aring -40
+KPX Uacute Atilde -40
+KPX Ucircumflex A -40
+KPX Ucircumflex Aacute -40
+KPX Ucircumflex Abreve -40
+KPX Ucircumflex Acircumflex -40
+KPX Ucircumflex Adieresis -40
+KPX Ucircumflex Agrave -40
+KPX Ucircumflex Amacron -40
+KPX Ucircumflex Aogonek -40
+KPX Ucircumflex Aring -40
+KPX Ucircumflex Atilde -40
+KPX Udieresis A -40
+KPX Udieresis Aacute -40
+KPX Udieresis Abreve -40
+KPX Udieresis Acircumflex -40
+KPX Udieresis Adieresis -40
+KPX Udieresis Agrave -40
+KPX Udieresis Amacron -40
+KPX Udieresis Aogonek -40
+KPX Udieresis Aring -40
+KPX Udieresis Atilde -40
+KPX Ugrave A -40
+KPX Ugrave Aacute -40
+KPX Ugrave Abreve -40
+KPX Ugrave Acircumflex -40
+KPX Ugrave Adieresis -40
+KPX Ugrave Agrave -40
+KPX Ugrave Amacron -40
+KPX Ugrave Aogonek -40
+KPX Ugrave Aring -40
+KPX Ugrave Atilde -40
+KPX Uhungarumlaut A -40
+KPX Uhungarumlaut Aacute -40
+KPX Uhungarumlaut Abreve -40
+KPX Uhungarumlaut Acircumflex -40
+KPX Uhungarumlaut Adieresis -40
+KPX Uhungarumlaut Agrave -40
+KPX Uhungarumlaut Amacron -40
+KPX Uhungarumlaut Aogonek -40
+KPX Uhungarumlaut Aring -40
+KPX Uhungarumlaut Atilde -40
+KPX Umacron A -40
+KPX Umacron Aacute -40
+KPX Umacron Abreve -40
+KPX Umacron Acircumflex -40
+KPX Umacron Adieresis -40
+KPX Umacron Agrave -40
+KPX Umacron Amacron -40
+KPX Umacron Aogonek -40
+KPX Umacron Aring -40
+KPX Umacron Atilde -40
+KPX Uogonek A -40
+KPX Uogonek Aacute -40
+KPX Uogonek Abreve -40
+KPX Uogonek Acircumflex -40
+KPX Uogonek Adieresis -40
+KPX Uogonek Agrave -40
+KPX Uogonek Amacron -40
+KPX Uogonek Aogonek -40
+KPX Uogonek Aring -40
+KPX Uogonek Atilde -40
+KPX Uring A -40
+KPX Uring Aacute -40
+KPX Uring Abreve -40
+KPX Uring Acircumflex -40
+KPX Uring Adieresis -40
+KPX Uring Agrave -40
+KPX Uring Amacron -40
+KPX Uring Aogonek -40
+KPX Uring Aring -40
+KPX Uring Atilde -40
+KPX V A -135
+KPX V Aacute -135
+KPX V Abreve -135
+KPX V Acircumflex -135
+KPX V Adieresis -135
+KPX V Agrave -135
+KPX V Amacron -135
+KPX V Aogonek -135
+KPX V Aring -135
+KPX V Atilde -135
+KPX V G -15
+KPX V Gbreve -15
+KPX V Gcommaaccent -15
+KPX V O -40
+KPX V Oacute -40
+KPX V Ocircumflex -40
+KPX V Odieresis -40
+KPX V Ograve -40
+KPX V Ohungarumlaut -40
+KPX V Omacron -40
+KPX V Oslash -40
+KPX V Otilde -40
+KPX V a -111
+KPX V aacute -111
+KPX V abreve -111
+KPX V acircumflex -71
+KPX V adieresis -71
+KPX V agrave -71
+KPX V amacron -71
+KPX V aogonek -111
+KPX V aring -111
+KPX V atilde -71
+KPX V colon -74
+KPX V comma -129
+KPX V e -111
+KPX V eacute -111
+KPX V ecaron -71
+KPX V ecircumflex -71
+KPX V edieresis -71
+KPX V edotaccent -111
+KPX V egrave -71
+KPX V emacron -71
+KPX V eogonek -111
+KPX V hyphen -100
+KPX V i -60
+KPX V iacute -60
+KPX V icircumflex -20
+KPX V idieresis -20
+KPX V igrave -20
+KPX V imacron -20
+KPX V iogonek -60
+KPX V o -129
+KPX V oacute -129
+KPX V ocircumflex -129
+KPX V odieresis -89
+KPX V ograve -89
+KPX V ohungarumlaut -129
+KPX V omacron -89
+KPX V oslash -129
+KPX V otilde -89
+KPX V period -129
+KPX V semicolon -74
+KPX V u -75
+KPX V uacute -75
+KPX V ucircumflex -75
+KPX V udieresis -75
+KPX V ugrave -75
+KPX V uhungarumlaut -75
+KPX V umacron -75
+KPX V uogonek -75
+KPX V uring -75
+KPX W A -120
+KPX W Aacute -120
+KPX W Abreve -120
+KPX W Acircumflex -120
+KPX W Adieresis -120
+KPX W Agrave -120
+KPX W Amacron -120
+KPX W Aogonek -120
+KPX W Aring -120
+KPX W Atilde -120
+KPX W O -10
+KPX W Oacute -10
+KPX W Ocircumflex -10
+KPX W Odieresis -10
+KPX W Ograve -10
+KPX W Ohungarumlaut -10
+KPX W Omacron -10
+KPX W Oslash -10
+KPX W Otilde -10
+KPX W a -80
+KPX W aacute -80
+KPX W abreve -80
+KPX W acircumflex -80
+KPX W adieresis -80
+KPX W agrave -80
+KPX W amacron -80
+KPX W aogonek -80
+KPX W aring -80
+KPX W atilde -80
+KPX W colon -37
+KPX W comma -92
+KPX W e -80
+KPX W eacute -80
+KPX W ecaron -80
+KPX W ecircumflex -80
+KPX W edieresis -40
+KPX W edotaccent -80
+KPX W egrave -40
+KPX W emacron -40
+KPX W eogonek -80
+KPX W hyphen -65
+KPX W i -40
+KPX W iacute -40
+KPX W iogonek -40
+KPX W o -80
+KPX W oacute -80
+KPX W ocircumflex -80
+KPX W odieresis -80
+KPX W ograve -80
+KPX W ohungarumlaut -80
+KPX W omacron -80
+KPX W oslash -80
+KPX W otilde -80
+KPX W period -92
+KPX W semicolon -37
+KPX W u -50
+KPX W uacute -50
+KPX W ucircumflex -50
+KPX W udieresis -50
+KPX W ugrave -50
+KPX W uhungarumlaut -50
+KPX W umacron -50
+KPX W uogonek -50
+KPX W uring -50
+KPX W y -73
+KPX W yacute -73
+KPX W ydieresis -73
+KPX Y A -120
+KPX Y Aacute -120
+KPX Y Abreve -120
+KPX Y Acircumflex -120
+KPX Y Adieresis -120
+KPX Y Agrave -120
+KPX Y Amacron -120
+KPX Y Aogonek -120
+KPX Y Aring -120
+KPX Y Atilde -120
+KPX Y O -30
+KPX Y Oacute -30
+KPX Y Ocircumflex -30
+KPX Y Odieresis -30
+KPX Y Ograve -30
+KPX Y Ohungarumlaut -30
+KPX Y Omacron -30
+KPX Y Oslash -30
+KPX Y Otilde -30
+KPX Y a -100
+KPX Y aacute -100
+KPX Y abreve -100
+KPX Y acircumflex -100
+KPX Y adieresis -60
+KPX Y agrave -60
+KPX Y amacron -60
+KPX Y aogonek -100
+KPX Y aring -100
+KPX Y atilde -60
+KPX Y colon -92
+KPX Y comma -129
+KPX Y e -100
+KPX Y eacute -100
+KPX Y ecaron -100
+KPX Y ecircumflex -100
+KPX Y edieresis -60
+KPX Y edotaccent -100
+KPX Y egrave -60
+KPX Y emacron -60
+KPX Y eogonek -100
+KPX Y hyphen -111
+KPX Y i -55
+KPX Y iacute -55
+KPX Y iogonek -55
+KPX Y o -110
+KPX Y oacute -110
+KPX Y ocircumflex -110
+KPX Y odieresis -70
+KPX Y ograve -70
+KPX Y ohungarumlaut -110
+KPX Y omacron -70
+KPX Y oslash -110
+KPX Y otilde -70
+KPX Y period -129
+KPX Y semicolon -92
+KPX Y u -111
+KPX Y uacute -111
+KPX Y ucircumflex -111
+KPX Y udieresis -71
+KPX Y ugrave -71
+KPX Y uhungarumlaut -111
+KPX Y umacron -71
+KPX Y uogonek -111
+KPX Y uring -111
+KPX Yacute A -120
+KPX Yacute Aacute -120
+KPX Yacute Abreve -120
+KPX Yacute Acircumflex -120
+KPX Yacute Adieresis -120
+KPX Yacute Agrave -120
+KPX Yacute Amacron -120
+KPX Yacute Aogonek -120
+KPX Yacute Aring -120
+KPX Yacute Atilde -120
+KPX Yacute O -30
+KPX Yacute Oacute -30
+KPX Yacute Ocircumflex -30
+KPX Yacute Odieresis -30
+KPX Yacute Ograve -30
+KPX Yacute Ohungarumlaut -30
+KPX Yacute Omacron -30
+KPX Yacute Oslash -30
+KPX Yacute Otilde -30
+KPX Yacute a -100
+KPX Yacute aacute -100
+KPX Yacute abreve -100
+KPX Yacute acircumflex -100
+KPX Yacute adieresis -60
+KPX Yacute agrave -60
+KPX Yacute amacron -60
+KPX Yacute aogonek -100
+KPX Yacute aring -100
+KPX Yacute atilde -60
+KPX Yacute colon -92
+KPX Yacute comma -129
+KPX Yacute e -100
+KPX Yacute eacute -100
+KPX Yacute ecaron -100
+KPX Yacute ecircumflex -100
+KPX Yacute edieresis -60
+KPX Yacute edotaccent -100
+KPX Yacute egrave -60
+KPX Yacute emacron -60
+KPX Yacute eogonek -100
+KPX Yacute hyphen -111
+KPX Yacute i -55
+KPX Yacute iacute -55
+KPX Yacute iogonek -55
+KPX Yacute o -110
+KPX Yacute oacute -110
+KPX Yacute ocircumflex -110
+KPX Yacute odieresis -70
+KPX Yacute ograve -70
+KPX Yacute ohungarumlaut -110
+KPX Yacute omacron -70
+KPX Yacute oslash -110
+KPX Yacute otilde -70
+KPX Yacute period -129
+KPX Yacute semicolon -92
+KPX Yacute u -111
+KPX Yacute uacute -111
+KPX Yacute ucircumflex -111
+KPX Yacute udieresis -71
+KPX Yacute ugrave -71
+KPX Yacute uhungarumlaut -111
+KPX Yacute umacron -71
+KPX Yacute uogonek -111
+KPX Yacute uring -111
+KPX Ydieresis A -120
+KPX Ydieresis Aacute -120
+KPX Ydieresis Abreve -120
+KPX Ydieresis Acircumflex -120
+KPX Ydieresis Adieresis -120
+KPX Ydieresis Agrave -120
+KPX Ydieresis Amacron -120
+KPX Ydieresis Aogonek -120
+KPX Ydieresis Aring -120
+KPX Ydieresis Atilde -120
+KPX Ydieresis O -30
+KPX Ydieresis Oacute -30
+KPX Ydieresis Ocircumflex -30
+KPX Ydieresis Odieresis -30
+KPX Ydieresis Ograve -30
+KPX Ydieresis Ohungarumlaut -30
+KPX Ydieresis Omacron -30
+KPX Ydieresis Oslash -30
+KPX Ydieresis Otilde -30
+KPX Ydieresis a -100
+KPX Ydieresis aacute -100
+KPX Ydieresis abreve -100
+KPX Ydieresis acircumflex -100
+KPX Ydieresis adieresis -60
+KPX Ydieresis agrave -60
+KPX Ydieresis amacron -60
+KPX Ydieresis aogonek -100
+KPX Ydieresis aring -100
+KPX Ydieresis atilde -100
+KPX Ydieresis colon -92
+KPX Ydieresis comma -129
+KPX Ydieresis e -100
+KPX Ydieresis eacute -100
+KPX Ydieresis ecaron -100
+KPX Ydieresis ecircumflex -100
+KPX Ydieresis edieresis -60
+KPX Ydieresis edotaccent -100
+KPX Ydieresis egrave -60
+KPX Ydieresis emacron -60
+KPX Ydieresis eogonek -100
+KPX Ydieresis hyphen -111
+KPX Ydieresis i -55
+KPX Ydieresis iacute -55
+KPX Ydieresis iogonek -55
+KPX Ydieresis o -110
+KPX Ydieresis oacute -110
+KPX Ydieresis ocircumflex -110
+KPX Ydieresis odieresis -70
+KPX Ydieresis ograve -70
+KPX Ydieresis ohungarumlaut -110
+KPX Ydieresis omacron -70
+KPX Ydieresis oslash -110
+KPX Ydieresis otilde -70
+KPX Ydieresis period -129
+KPX Ydieresis semicolon -92
+KPX Ydieresis u -111
+KPX Ydieresis uacute -111
+KPX Ydieresis ucircumflex -111
+KPX Ydieresis udieresis -71
+KPX Ydieresis ugrave -71
+KPX Ydieresis uhungarumlaut -111
+KPX Ydieresis umacron -71
+KPX Ydieresis uogonek -111
+KPX Ydieresis uring -111
+KPX a v -20
+KPX a w -15
+KPX aacute v -20
+KPX aacute w -15
+KPX abreve v -20
+KPX abreve w -15
+KPX acircumflex v -20
+KPX acircumflex w -15
+KPX adieresis v -20
+KPX adieresis w -15
+KPX agrave v -20
+KPX agrave w -15
+KPX amacron v -20
+KPX amacron w -15
+KPX aogonek v -20
+KPX aogonek w -15
+KPX aring v -20
+KPX aring w -15
+KPX atilde v -20
+KPX atilde w -15
+KPX b period -40
+KPX b u -20
+KPX b uacute -20
+KPX b ucircumflex -20
+KPX b udieresis -20
+KPX b ugrave -20
+KPX b uhungarumlaut -20
+KPX b umacron -20
+KPX b uogonek -20
+KPX b uring -20
+KPX b v -15
+KPX c y -15
+KPX c yacute -15
+KPX c ydieresis -15
+KPX cacute y -15
+KPX cacute yacute -15
+KPX cacute ydieresis -15
+KPX ccaron y -15
+KPX ccaron yacute -15
+KPX ccaron ydieresis -15
+KPX ccedilla y -15
+KPX ccedilla yacute -15
+KPX ccedilla ydieresis -15
+KPX comma quotedblright -70
+KPX comma quoteright -70
+KPX e g -15
+KPX e gbreve -15
+KPX e gcommaaccent -15
+KPX e v -25
+KPX e w -25
+KPX e x -15
+KPX e y -15
+KPX e yacute -15
+KPX e ydieresis -15
+KPX eacute g -15
+KPX eacute gbreve -15
+KPX eacute gcommaaccent -15
+KPX eacute v -25
+KPX eacute w -25
+KPX eacute x -15
+KPX eacute y -15
+KPX eacute yacute -15
+KPX eacute ydieresis -15
+KPX ecaron g -15
+KPX ecaron gbreve -15
+KPX ecaron gcommaaccent -15
+KPX ecaron v -25
+KPX ecaron w -25
+KPX ecaron x -15
+KPX ecaron y -15
+KPX ecaron yacute -15
+KPX ecaron ydieresis -15
+KPX ecircumflex g -15
+KPX ecircumflex gbreve -15
+KPX ecircumflex gcommaaccent -15
+KPX ecircumflex v -25
+KPX ecircumflex w -25
+KPX ecircumflex x -15
+KPX ecircumflex y -15
+KPX ecircumflex yacute -15
+KPX ecircumflex ydieresis -15
+KPX edieresis g -15
+KPX edieresis gbreve -15
+KPX edieresis gcommaaccent -15
+KPX edieresis v -25
+KPX edieresis w -25
+KPX edieresis x -15
+KPX edieresis y -15
+KPX edieresis yacute -15
+KPX edieresis ydieresis -15
+KPX edotaccent g -15
+KPX edotaccent gbreve -15
+KPX edotaccent gcommaaccent -15
+KPX edotaccent v -25
+KPX edotaccent w -25
+KPX edotaccent x -15
+KPX edotaccent y -15
+KPX edotaccent yacute -15
+KPX edotaccent ydieresis -15
+KPX egrave g -15
+KPX egrave gbreve -15
+KPX egrave gcommaaccent -15
+KPX egrave v -25
+KPX egrave w -25
+KPX egrave x -15
+KPX egrave y -15
+KPX egrave yacute -15
+KPX egrave ydieresis -15
+KPX emacron g -15
+KPX emacron gbreve -15
+KPX emacron gcommaaccent -15
+KPX emacron v -25
+KPX emacron w -25
+KPX emacron x -15
+KPX emacron y -15
+KPX emacron yacute -15
+KPX emacron ydieresis -15
+KPX eogonek g -15
+KPX eogonek gbreve -15
+KPX eogonek gcommaaccent -15
+KPX eogonek v -25
+KPX eogonek w -25
+KPX eogonek x -15
+KPX eogonek y -15
+KPX eogonek yacute -15
+KPX eogonek ydieresis -15
+KPX f a -10
+KPX f aacute -10
+KPX f abreve -10
+KPX f acircumflex -10
+KPX f adieresis -10
+KPX f agrave -10
+KPX f amacron -10
+KPX f aogonek -10
+KPX f aring -10
+KPX f atilde -10
+KPX f dotlessi -50
+KPX f f -25
+KPX f i -20
+KPX f iacute -20
+KPX f quoteright 55
+KPX g a -5
+KPX g aacute -5
+KPX g abreve -5
+KPX g acircumflex -5
+KPX g adieresis -5
+KPX g agrave -5
+KPX g amacron -5
+KPX g aogonek -5
+KPX g aring -5
+KPX g atilde -5
+KPX gbreve a -5
+KPX gbreve aacute -5
+KPX gbreve abreve -5
+KPX gbreve acircumflex -5
+KPX gbreve adieresis -5
+KPX gbreve agrave -5
+KPX gbreve amacron -5
+KPX gbreve aogonek -5
+KPX gbreve aring -5
+KPX gbreve atilde -5
+KPX gcommaaccent a -5
+KPX gcommaaccent aacute -5
+KPX gcommaaccent abreve -5
+KPX gcommaaccent acircumflex -5
+KPX gcommaaccent adieresis -5
+KPX gcommaaccent agrave -5
+KPX gcommaaccent amacron -5
+KPX gcommaaccent aogonek -5
+KPX gcommaaccent aring -5
+KPX gcommaaccent atilde -5
+KPX h y -5
+KPX h yacute -5
+KPX h ydieresis -5
+KPX i v -25
+KPX iacute v -25
+KPX icircumflex v -25
+KPX idieresis v -25
+KPX igrave v -25
+KPX imacron v -25
+KPX iogonek v -25
+KPX k e -10
+KPX k eacute -10
+KPX k ecaron -10
+KPX k ecircumflex -10
+KPX k edieresis -10
+KPX k edotaccent -10
+KPX k egrave -10
+KPX k emacron -10
+KPX k eogonek -10
+KPX k o -10
+KPX k oacute -10
+KPX k ocircumflex -10
+KPX k odieresis -10
+KPX k ograve -10
+KPX k ohungarumlaut -10
+KPX k omacron -10
+KPX k oslash -10
+KPX k otilde -10
+KPX k y -15
+KPX k yacute -15
+KPX k ydieresis -15
+KPX kcommaaccent e -10
+KPX kcommaaccent eacute -10
+KPX kcommaaccent ecaron -10
+KPX kcommaaccent ecircumflex -10
+KPX kcommaaccent edieresis -10
+KPX kcommaaccent edotaccent -10
+KPX kcommaaccent egrave -10
+KPX kcommaaccent emacron -10
+KPX kcommaaccent eogonek -10
+KPX kcommaaccent o -10
+KPX kcommaaccent oacute -10
+KPX kcommaaccent ocircumflex -10
+KPX kcommaaccent odieresis -10
+KPX kcommaaccent ograve -10
+KPX kcommaaccent ohungarumlaut -10
+KPX kcommaaccent omacron -10
+KPX kcommaaccent oslash -10
+KPX kcommaaccent otilde -10
+KPX kcommaaccent y -15
+KPX kcommaaccent yacute -15
+KPX kcommaaccent ydieresis -15
+KPX l w -10
+KPX lacute w -10
+KPX lcommaaccent w -10
+KPX lslash w -10
+KPX n v -40
+KPX n y -15
+KPX n yacute -15
+KPX n ydieresis -15
+KPX nacute v -40
+KPX nacute y -15
+KPX nacute yacute -15
+KPX nacute ydieresis -15
+KPX ncaron v -40
+KPX ncaron y -15
+KPX ncaron yacute -15
+KPX ncaron ydieresis -15
+KPX ncommaaccent v -40
+KPX ncommaaccent y -15
+KPX ncommaaccent yacute -15
+KPX ncommaaccent ydieresis -15
+KPX ntilde v -40
+KPX ntilde y -15
+KPX ntilde yacute -15
+KPX ntilde ydieresis -15
+KPX o v -15
+KPX o w -25
+KPX o y -10
+KPX o yacute -10
+KPX o ydieresis -10
+KPX oacute v -15
+KPX oacute w -25
+KPX oacute y -10
+KPX oacute yacute -10
+KPX oacute ydieresis -10
+KPX ocircumflex v -15
+KPX ocircumflex w -25
+KPX ocircumflex y -10
+KPX ocircumflex yacute -10
+KPX ocircumflex ydieresis -10
+KPX odieresis v -15
+KPX odieresis w -25
+KPX odieresis y -10
+KPX odieresis yacute -10
+KPX odieresis ydieresis -10
+KPX ograve v -15
+KPX ograve w -25
+KPX ograve y -10
+KPX ograve yacute -10
+KPX ograve ydieresis -10
+KPX ohungarumlaut v -15
+KPX ohungarumlaut w -25
+KPX ohungarumlaut y -10
+KPX ohungarumlaut yacute -10
+KPX ohungarumlaut ydieresis -10
+KPX omacron v -15
+KPX omacron w -25
+KPX omacron y -10
+KPX omacron yacute -10
+KPX omacron ydieresis -10
+KPX oslash v -15
+KPX oslash w -25
+KPX oslash y -10
+KPX oslash yacute -10
+KPX oslash ydieresis -10
+KPX otilde v -15
+KPX otilde w -25
+KPX otilde y -10
+KPX otilde yacute -10
+KPX otilde ydieresis -10
+KPX p y -10
+KPX p yacute -10
+KPX p ydieresis -10
+KPX period quotedblright -70
+KPX period quoteright -70
+KPX quotedblleft A -80
+KPX quotedblleft Aacute -80
+KPX quotedblleft Abreve -80
+KPX quotedblleft Acircumflex -80
+KPX quotedblleft Adieresis -80
+KPX quotedblleft Agrave -80
+KPX quotedblleft Amacron -80
+KPX quotedblleft Aogonek -80
+KPX quotedblleft Aring -80
+KPX quotedblleft Atilde -80
+KPX quoteleft A -80
+KPX quoteleft Aacute -80
+KPX quoteleft Abreve -80
+KPX quoteleft Acircumflex -80
+KPX quoteleft Adieresis -80
+KPX quoteleft Agrave -80
+KPX quoteleft Amacron -80
+KPX quoteleft Aogonek -80
+KPX quoteleft Aring -80
+KPX quoteleft Atilde -80
+KPX quoteleft quoteleft -74
+KPX quoteright d -50
+KPX quoteright dcroat -50
+KPX quoteright l -10
+KPX quoteright lacute -10
+KPX quoteright lcommaaccent -10
+KPX quoteright lslash -10
+KPX quoteright quoteright -74
+KPX quoteright r -50
+KPX quoteright racute -50
+KPX quoteright rcaron -50
+KPX quoteright rcommaaccent -50
+KPX quoteright s -55
+KPX quoteright sacute -55
+KPX quoteright scaron -55
+KPX quoteright scedilla -55
+KPX quoteright scommaaccent -55
+KPX quoteright space -74
+KPX quoteright t -18
+KPX quoteright tcommaaccent -18
+KPX quoteright v -50
+KPX r comma -40
+KPX r g -18
+KPX r gbreve -18
+KPX r gcommaaccent -18
+KPX r hyphen -20
+KPX r period -55
+KPX racute comma -40
+KPX racute g -18
+KPX racute gbreve -18
+KPX racute gcommaaccent -18
+KPX racute hyphen -20
+KPX racute period -55
+KPX rcaron comma -40
+KPX rcaron g -18
+KPX rcaron gbreve -18
+KPX rcaron gcommaaccent -18
+KPX rcaron hyphen -20
+KPX rcaron period -55
+KPX rcommaaccent comma -40
+KPX rcommaaccent g -18
+KPX rcommaaccent gbreve -18
+KPX rcommaaccent gcommaaccent -18
+KPX rcommaaccent hyphen -20
+KPX rcommaaccent period -55
+KPX space A -55
+KPX space Aacute -55
+KPX space Abreve -55
+KPX space Acircumflex -55
+KPX space Adieresis -55
+KPX space Agrave -55
+KPX space Amacron -55
+KPX space Aogonek -55
+KPX space Aring -55
+KPX space Atilde -55
+KPX space T -18
+KPX space Tcaron -18
+KPX space Tcommaaccent -18
+KPX space V -50
+KPX space W -30
+KPX space Y -90
+KPX space Yacute -90
+KPX space Ydieresis -90
+KPX v a -25
+KPX v aacute -25
+KPX v abreve -25
+KPX v acircumflex -25
+KPX v adieresis -25
+KPX v agrave -25
+KPX v amacron -25
+KPX v aogonek -25
+KPX v aring -25
+KPX v atilde -25
+KPX v comma -65
+KPX v e -15
+KPX v eacute -15
+KPX v ecaron -15
+KPX v ecircumflex -15
+KPX v edieresis -15
+KPX v edotaccent -15
+KPX v egrave -15
+KPX v emacron -15
+KPX v eogonek -15
+KPX v o -20
+KPX v oacute -20
+KPX v ocircumflex -20
+KPX v odieresis -20
+KPX v ograve -20
+KPX v ohungarumlaut -20
+KPX v omacron -20
+KPX v oslash -20
+KPX v otilde -20
+KPX v period -65
+KPX w a -10
+KPX w aacute -10
+KPX w abreve -10
+KPX w acircumflex -10
+KPX w adieresis -10
+KPX w agrave -10
+KPX w amacron -10
+KPX w aogonek -10
+KPX w aring -10
+KPX w atilde -10
+KPX w comma -65
+KPX w o -10
+KPX w oacute -10
+KPX w ocircumflex -10
+KPX w odieresis -10
+KPX w ograve -10
+KPX w ohungarumlaut -10
+KPX w omacron -10
+KPX w oslash -10
+KPX w otilde -10
+KPX w period -65
+KPX x e -15
+KPX x eacute -15
+KPX x ecaron -15
+KPX x ecircumflex -15
+KPX x edieresis -15
+KPX x edotaccent -15
+KPX x egrave -15
+KPX x emacron -15
+KPX x eogonek -15
+KPX y comma -65
+KPX y period -65
+KPX yacute comma -65
+KPX yacute period -65
+KPX ydieresis comma -65
+KPX ydieresis period -65
+EndKernPairs
+EndKernData
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/ZapfDingbats.afm b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/ZapfDingbats.afm
new file mode 100644
index 0000000..b274505
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/ZapfDingbats.afm
@@ -0,0 +1,225 @@
+StartFontMetrics 4.1
+Comment Copyright (c) 1985, 1987, 1988, 1989, 1997 Adobe Systems Incorporated. All Rights Reserved.
+Comment Creation Date: Thu May 1 15:14:13 1997
+Comment UniqueID 43082
+Comment VMusage 45775 55535
+FontName ZapfDingbats
+FullName ITC Zapf Dingbats
+FamilyName ZapfDingbats
+Weight Medium
+ItalicAngle 0
+IsFixedPitch false
+CharacterSet Special
+FontBBox -1 -143 981 820
+UnderlinePosition -100
+UnderlineThickness 50
+Version 002.000
+Notice Copyright (c) 1985, 1987, 1988, 1989, 1997 Adobe Systems Incorporated. All Rights Reserved.ITC Zapf Dingbats is a registered trademark of International Typeface Corporation.
+EncodingScheme FontSpecific
+StdHW 28
+StdVW 90
+StartCharMetrics 202
+C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
+C 33 ; WX 974 ; N a1 ; B 35 72 939 621 ;
+C 34 ; WX 961 ; N a2 ; B 35 81 927 611 ;
+C 35 ; WX 974 ; N a202 ; B 35 72 939 621 ;
+C 36 ; WX 980 ; N a3 ; B 35 0 945 692 ;
+C 37 ; WX 719 ; N a4 ; B 34 139 685 566 ;
+C 38 ; WX 789 ; N a5 ; B 35 -14 755 705 ;
+C 39 ; WX 790 ; N a119 ; B 35 -14 755 705 ;
+C 40 ; WX 791 ; N a118 ; B 35 -13 761 705 ;
+C 41 ; WX 690 ; N a117 ; B 34 138 655 553 ;
+C 42 ; WX 960 ; N a11 ; B 35 123 925 568 ;
+C 43 ; WX 939 ; N a12 ; B 35 134 904 559 ;
+C 44 ; WX 549 ; N a13 ; B 29 -11 516 705 ;
+C 45 ; WX 855 ; N a14 ; B 34 59 820 632 ;
+C 46 ; WX 911 ; N a15 ; B 35 50 876 642 ;
+C 47 ; WX 933 ; N a16 ; B 35 139 899 550 ;
+C 48 ; WX 911 ; N a105 ; B 35 50 876 642 ;
+C 49 ; WX 945 ; N a17 ; B 35 139 909 553 ;
+C 50 ; WX 974 ; N a18 ; B 35 104 938 587 ;
+C 51 ; WX 755 ; N a19 ; B 34 -13 721 705 ;
+C 52 ; WX 846 ; N a20 ; B 36 -14 811 705 ;
+C 53 ; WX 762 ; N a21 ; B 35 0 727 692 ;
+C 54 ; WX 761 ; N a22 ; B 35 0 727 692 ;
+C 55 ; WX 571 ; N a23 ; B -1 -68 571 661 ;
+C 56 ; WX 677 ; N a24 ; B 36 -13 642 705 ;
+C 57 ; WX 763 ; N a25 ; B 35 0 728 692 ;
+C 58 ; WX 760 ; N a26 ; B 35 0 726 692 ;
+C 59 ; WX 759 ; N a27 ; B 35 0 725 692 ;
+C 60 ; WX 754 ; N a28 ; B 35 0 720 692 ;
+C 61 ; WX 494 ; N a6 ; B 35 0 460 692 ;
+C 62 ; WX 552 ; N a7 ; B 35 0 517 692 ;
+C 63 ; WX 537 ; N a8 ; B 35 0 503 692 ;
+C 64 ; WX 577 ; N a9 ; B 35 96 542 596 ;
+C 65 ; WX 692 ; N a10 ; B 35 -14 657 705 ;
+C 66 ; WX 786 ; N a29 ; B 35 -14 751 705 ;
+C 67 ; WX 788 ; N a30 ; B 35 -14 752 705 ;
+C 68 ; WX 788 ; N a31 ; B 35 -14 753 705 ;
+C 69 ; WX 790 ; N a32 ; B 35 -14 756 705 ;
+C 70 ; WX 793 ; N a33 ; B 35 -13 759 705 ;
+C 71 ; WX 794 ; N a34 ; B 35 -13 759 705 ;
+C 72 ; WX 816 ; N a35 ; B 35 -14 782 705 ;
+C 73 ; WX 823 ; N a36 ; B 35 -14 787 705 ;
+C 74 ; WX 789 ; N a37 ; B 35 -14 754 705 ;
+C 75 ; WX 841 ; N a38 ; B 35 -14 807 705 ;
+C 76 ; WX 823 ; N a39 ; B 35 -14 789 705 ;
+C 77 ; WX 833 ; N a40 ; B 35 -14 798 705 ;
+C 78 ; WX 816 ; N a41 ; B 35 -13 782 705 ;
+C 79 ; WX 831 ; N a42 ; B 35 -14 796 705 ;
+C 80 ; WX 923 ; N a43 ; B 35 -14 888 705 ;
+C 81 ; WX 744 ; N a44 ; B 35 0 710 692 ;
+C 82 ; WX 723 ; N a45 ; B 35 0 688 692 ;
+C 83 ; WX 749 ; N a46 ; B 35 0 714 692 ;
+C 84 ; WX 790 ; N a47 ; B 34 -14 756 705 ;
+C 85 ; WX 792 ; N a48 ; B 35 -14 758 705 ;
+C 86 ; WX 695 ; N a49 ; B 35 -14 661 706 ;
+C 87 ; WX 776 ; N a50 ; B 35 -6 741 699 ;
+C 88 ; WX 768 ; N a51 ; B 35 -7 734 699 ;
+C 89 ; WX 792 ; N a52 ; B 35 -14 757 705 ;
+C 90 ; WX 759 ; N a53 ; B 35 0 725 692 ;
+C 91 ; WX 707 ; N a54 ; B 35 -13 672 704 ;
+C 92 ; WX 708 ; N a55 ; B 35 -14 672 705 ;
+C 93 ; WX 682 ; N a56 ; B 35 -14 647 705 ;
+C 94 ; WX 701 ; N a57 ; B 35 -14 666 705 ;
+C 95 ; WX 826 ; N a58 ; B 35 -14 791 705 ;
+C 96 ; WX 815 ; N a59 ; B 35 -14 780 705 ;
+C 97 ; WX 789 ; N a60 ; B 35 -14 754 705 ;
+C 98 ; WX 789 ; N a61 ; B 35 -14 754 705 ;
+C 99 ; WX 707 ; N a62 ; B 34 -14 673 705 ;
+C 100 ; WX 687 ; N a63 ; B 36 0 651 692 ;
+C 101 ; WX 696 ; N a64 ; B 35 0 661 691 ;
+C 102 ; WX 689 ; N a65 ; B 35 0 655 692 ;
+C 103 ; WX 786 ; N a66 ; B 34 -14 751 705 ;
+C 104 ; WX 787 ; N a67 ; B 35 -14 752 705 ;
+C 105 ; WX 713 ; N a68 ; B 35 -14 678 705 ;
+C 106 ; WX 791 ; N a69 ; B 35 -14 756 705 ;
+C 107 ; WX 785 ; N a70 ; B 36 -14 751 705 ;
+C 108 ; WX 791 ; N a71 ; B 35 -14 757 705 ;
+C 109 ; WX 873 ; N a72 ; B 35 -14 838 705 ;
+C 110 ; WX 761 ; N a73 ; B 35 0 726 692 ;
+C 111 ; WX 762 ; N a74 ; B 35 0 727 692 ;
+C 112 ; WX 762 ; N a203 ; B 35 0 727 692 ;
+C 113 ; WX 759 ; N a75 ; B 35 0 725 692 ;
+C 114 ; WX 759 ; N a204 ; B 35 0 725 692 ;
+C 115 ; WX 892 ; N a76 ; B 35 0 858 705 ;
+C 116 ; WX 892 ; N a77 ; B 35 -14 858 692 ;
+C 117 ; WX 788 ; N a78 ; B 35 -14 754 705 ;
+C 118 ; WX 784 ; N a79 ; B 35 -14 749 705 ;
+C 119 ; WX 438 ; N a81 ; B 35 -14 403 705 ;
+C 120 ; WX 138 ; N a82 ; B 35 0 104 692 ;
+C 121 ; WX 277 ; N a83 ; B 35 0 242 692 ;
+C 122 ; WX 415 ; N a84 ; B 35 0 380 692 ;
+C 123 ; WX 392 ; N a97 ; B 35 263 357 705 ;
+C 124 ; WX 392 ; N a98 ; B 34 263 357 705 ;
+C 125 ; WX 668 ; N a99 ; B 35 263 633 705 ;
+C 126 ; WX 668 ; N a100 ; B 36 263 634 705 ;
+C 128 ; WX 390 ; N a89 ; B 35 -14 356 705 ;
+C 129 ; WX 390 ; N a90 ; B 35 -14 355 705 ;
+C 130 ; WX 317 ; N a93 ; B 35 0 283 692 ;
+C 131 ; WX 317 ; N a94 ; B 35 0 283 692 ;
+C 132 ; WX 276 ; N a91 ; B 35 0 242 692 ;
+C 133 ; WX 276 ; N a92 ; B 35 0 242 692 ;
+C 134 ; WX 509 ; N a205 ; B 35 0 475 692 ;
+C 135 ; WX 509 ; N a85 ; B 35 0 475 692 ;
+C 136 ; WX 410 ; N a206 ; B 35 0 375 692 ;
+C 137 ; WX 410 ; N a86 ; B 35 0 375 692 ;
+C 138 ; WX 234 ; N a87 ; B 35 -14 199 705 ;
+C 139 ; WX 234 ; N a88 ; B 35 -14 199 705 ;
+C 140 ; WX 334 ; N a95 ; B 35 0 299 692 ;
+C 141 ; WX 334 ; N a96 ; B 35 0 299 692 ;
+C 161 ; WX 732 ; N a101 ; B 35 -143 697 806 ;
+C 162 ; WX 544 ; N a102 ; B 56 -14 488 706 ;
+C 163 ; WX 544 ; N a103 ; B 34 -14 508 705 ;
+C 164 ; WX 910 ; N a104 ; B 35 40 875 651 ;
+C 165 ; WX 667 ; N a106 ; B 35 -14 633 705 ;
+C 166 ; WX 760 ; N a107 ; B 35 -14 726 705 ;
+C 167 ; WX 760 ; N a108 ; B 0 121 758 569 ;
+C 168 ; WX 776 ; N a112 ; B 35 0 741 705 ;
+C 169 ; WX 595 ; N a111 ; B 34 -14 560 705 ;
+C 170 ; WX 694 ; N a110 ; B 35 -14 659 705 ;
+C 171 ; WX 626 ; N a109 ; B 34 0 591 705 ;
+C 172 ; WX 788 ; N a120 ; B 35 -14 754 705 ;
+C 173 ; WX 788 ; N a121 ; B 35 -14 754 705 ;
+C 174 ; WX 788 ; N a122 ; B 35 -14 754 705 ;
+C 175 ; WX 788 ; N a123 ; B 35 -14 754 705 ;
+C 176 ; WX 788 ; N a124 ; B 35 -14 754 705 ;
+C 177 ; WX 788 ; N a125 ; B 35 -14 754 705 ;
+C 178 ; WX 788 ; N a126 ; B 35 -14 754 705 ;
+C 179 ; WX 788 ; N a127 ; B 35 -14 754 705 ;
+C 180 ; WX 788 ; N a128 ; B 35 -14 754 705 ;
+C 181 ; WX 788 ; N a129 ; B 35 -14 754 705 ;
+C 182 ; WX 788 ; N a130 ; B 35 -14 754 705 ;
+C 183 ; WX 788 ; N a131 ; B 35 -14 754 705 ;
+C 184 ; WX 788 ; N a132 ; B 35 -14 754 705 ;
+C 185 ; WX 788 ; N a133 ; B 35 -14 754 705 ;
+C 186 ; WX 788 ; N a134 ; B 35 -14 754 705 ;
+C 187 ; WX 788 ; N a135 ; B 35 -14 754 705 ;
+C 188 ; WX 788 ; N a136 ; B 35 -14 754 705 ;
+C 189 ; WX 788 ; N a137 ; B 35 -14 754 705 ;
+C 190 ; WX 788 ; N a138 ; B 35 -14 754 705 ;
+C 191 ; WX 788 ; N a139 ; B 35 -14 754 705 ;
+C 192 ; WX 788 ; N a140 ; B 35 -14 754 705 ;
+C 193 ; WX 788 ; N a141 ; B 35 -14 754 705 ;
+C 194 ; WX 788 ; N a142 ; B 35 -14 754 705 ;
+C 195 ; WX 788 ; N a143 ; B 35 -14 754 705 ;
+C 196 ; WX 788 ; N a144 ; B 35 -14 754 705 ;
+C 197 ; WX 788 ; N a145 ; B 35 -14 754 705 ;
+C 198 ; WX 788 ; N a146 ; B 35 -14 754 705 ;
+C 199 ; WX 788 ; N a147 ; B 35 -14 754 705 ;
+C 200 ; WX 788 ; N a148 ; B 35 -14 754 705 ;
+C 201 ; WX 788 ; N a149 ; B 35 -14 754 705 ;
+C 202 ; WX 788 ; N a150 ; B 35 -14 754 705 ;
+C 203 ; WX 788 ; N a151 ; B 35 -14 754 705 ;
+C 204 ; WX 788 ; N a152 ; B 35 -14 754 705 ;
+C 205 ; WX 788 ; N a153 ; B 35 -14 754 705 ;
+C 206 ; WX 788 ; N a154 ; B 35 -14 754 705 ;
+C 207 ; WX 788 ; N a155 ; B 35 -14 754 705 ;
+C 208 ; WX 788 ; N a156 ; B 35 -14 754 705 ;
+C 209 ; WX 788 ; N a157 ; B 35 -14 754 705 ;
+C 210 ; WX 788 ; N a158 ; B 35 -14 754 705 ;
+C 211 ; WX 788 ; N a159 ; B 35 -14 754 705 ;
+C 212 ; WX 894 ; N a160 ; B 35 58 860 634 ;
+C 213 ; WX 838 ; N a161 ; B 35 152 803 540 ;
+C 214 ; WX 1016 ; N a163 ; B 34 152 981 540 ;
+C 215 ; WX 458 ; N a164 ; B 35 -127 422 820 ;
+C 216 ; WX 748 ; N a196 ; B 35 94 698 597 ;
+C 217 ; WX 924 ; N a165 ; B 35 140 890 552 ;
+C 218 ; WX 748 ; N a192 ; B 35 94 698 597 ;
+C 219 ; WX 918 ; N a166 ; B 35 166 884 526 ;
+C 220 ; WX 927 ; N a167 ; B 35 32 892 660 ;
+C 221 ; WX 928 ; N a168 ; B 35 129 891 562 ;
+C 222 ; WX 928 ; N a169 ; B 35 128 893 563 ;
+C 223 ; WX 834 ; N a170 ; B 35 155 799 537 ;
+C 224 ; WX 873 ; N a171 ; B 35 93 838 599 ;
+C 225 ; WX 828 ; N a172 ; B 35 104 791 588 ;
+C 226 ; WX 924 ; N a173 ; B 35 98 889 594 ;
+C 227 ; WX 924 ; N a162 ; B 35 98 889 594 ;
+C 228 ; WX 917 ; N a174 ; B 35 0 882 692 ;
+C 229 ; WX 930 ; N a175 ; B 35 84 896 608 ;
+C 230 ; WX 931 ; N a176 ; B 35 84 896 608 ;
+C 231 ; WX 463 ; N a177 ; B 35 -99 429 791 ;
+C 232 ; WX 883 ; N a178 ; B 35 71 848 623 ;
+C 233 ; WX 836 ; N a179 ; B 35 44 802 648 ;
+C 234 ; WX 836 ; N a193 ; B 35 44 802 648 ;
+C 235 ; WX 867 ; N a180 ; B 35 101 832 591 ;
+C 236 ; WX 867 ; N a199 ; B 35 101 832 591 ;
+C 237 ; WX 696 ; N a181 ; B 35 44 661 648 ;
+C 238 ; WX 696 ; N a200 ; B 35 44 661 648 ;
+C 239 ; WX 874 ; N a182 ; B 35 77 840 619 ;
+C 241 ; WX 874 ; N a201 ; B 35 73 840 615 ;
+C 242 ; WX 760 ; N a183 ; B 35 0 725 692 ;
+C 243 ; WX 946 ; N a184 ; B 35 160 911 533 ;
+C 244 ; WX 771 ; N a197 ; B 34 37 736 655 ;
+C 245 ; WX 865 ; N a185 ; B 35 207 830 481 ;
+C 246 ; WX 771 ; N a194 ; B 34 37 736 655 ;
+C 247 ; WX 888 ; N a198 ; B 34 -19 853 712 ;
+C 248 ; WX 967 ; N a186 ; B 35 124 932 568 ;
+C 249 ; WX 888 ; N a195 ; B 34 -19 853 712 ;
+C 250 ; WX 831 ; N a187 ; B 35 113 796 579 ;
+C 251 ; WX 873 ; N a188 ; B 36 118 838 578 ;
+C 252 ; WX 927 ; N a189 ; B 35 150 891 542 ;
+C 253 ; WX 970 ; N a190 ; B 35 76 931 616 ;
+C 254 ; WX 918 ; N a191 ; B 34 99 884 593 ;
+EndCharMetrics
+EndFontMetrics
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/readme.txt b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/readme.txt
new file mode 100644
index 0000000..047ae70
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts/readme.txt
@@ -0,0 +1,15 @@
+Font Metrics for the 14 PDF Core Fonts
+======================================
+
+This directory contains font metrics for the 14 PDF Core Fonts,
+downloaded from Adobe. The title and this paragraph were added by
+Matplotlib developers. The download URL was
+.
+
+This file and the 14 PostScript(R) AFM files it accompanies may be used, copied,
+and distributed for any purpose and without charge, with or without modification,
+provided that all copyright notices are retained; that the AFM files are not
+distributed without this file; that all modifications to this file or any of
+the AFM files are prominently noted in the modified file(s); and that this
+paragraph is not modified. Adobe Systems has no responsibility or obligation
+to support the use of the AFM files.
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf
new file mode 100644
index 0000000..1f22f07
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf
new file mode 100644
index 0000000..b8886cb
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf
new file mode 100644
index 0000000..300ea68
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf
new file mode 100644
index 0000000..5267218
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf
new file mode 100644
index 0000000..36758a2
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf
new file mode 100644
index 0000000..cbcdd31
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf
new file mode 100644
index 0000000..da51344
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf
new file mode 100644
index 0000000..0185ce9
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf
new file mode 100644
index 0000000..278cd78
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf
new file mode 100644
index 0000000..d683eb2
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf
new file mode 100644
index 0000000..b4831f7
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf
new file mode 100644
index 0000000..45b508b
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif.ttf
new file mode 100644
index 0000000..39dd394
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf
new file mode 100644
index 0000000..1623714
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/LICENSE_DEJAVU b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/LICENSE_DEJAVU
new file mode 100644
index 0000000..254e2cc
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/LICENSE_DEJAVU
@@ -0,0 +1,99 @@
+Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
+Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
+
+Bitstream Vera Fonts Copyright
+------------------------------
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
+a trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated
+documentation files (the "Font Software"), to reproduce and distribute the
+Font Software, including without limitation the rights to use, copy, merge,
+publish, distribute, and/or sell copies of the Font Software, and to permit
+persons to whom the Font Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright and trademark notices and this permission notice shall
+be included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may be modified and
+additional glyphs or characters may be added to the Fonts, only if the fonts
+are renamed to names not containing either the words "Bitstream" or the word
+"Vera".
+
+This License becomes null and void to the extent applicable to Fonts or Font
+Software that has been modified and is distributed under the "Bitstream
+Vera" names.
+
+The Font Software may be sold as part of a larger software package but no
+copy of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
+FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
+ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
+FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome
+Foundation, and Bitstream Inc., shall not be used in advertising or
+otherwise to promote the sale, use or other dealings in this Font Software
+without prior written authorization from the Gnome Foundation or Bitstream
+Inc., respectively. For further information, contact: fonts at gnome dot
+org.
+
+Arev Fonts Copyright
+------------------------------
+
+Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the fonts accompanying this license ("Fonts") and
+associated documentation files (the "Font Software"), to reproduce
+and distribute the modifications to the Bitstream Vera Font Software,
+including without limitation the rights to use, copy, merge, publish,
+distribute, and/or sell copies of the Font Software, and to permit
+persons to whom the Font Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright and trademark notices and this permission notice
+shall be included in all copies of one or more of the Font Software
+typefaces.
+
+The Font Software may be modified, altered, or added to, and in
+particular the designs of glyphs or characters in the Fonts may be
+modified and additional glyphs or characters may be added to the
+Fonts, only if the fonts are renamed to names not containing either
+the words "Tavmjong Bah" or the word "Arev".
+
+This License becomes null and void to the extent applicable to Fonts
+or Font Software that has been modified and is distributed under the
+"Tavmjong Bah Arev" names.
+
+The Font Software may be sold as part of a larger software package but
+no copy of one or more of the Font Software typefaces may be sold by
+itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
+TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the name of Tavmjong Bah shall not
+be used in advertising or otherwise to promote the sale, use or other
+dealings in this Font Software without prior written authorization
+from Tavmjong Bah. For further information, contact: tavmjong @ free
+. fr.
+
+$Id: LICENSE 2133 2007-11-28 02:46:28Z lechimp $
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/LICENSE_STIX b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/LICENSE_STIX
new file mode 100644
index 0000000..12c454a
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/LICENSE_STIX
@@ -0,0 +1,124 @@
+The STIX fonts distributed with matplotlib have been modified from
+their canonical form. They have been converted from OTF to TTF format
+using Fontforge and this script:
+
+ #!/usr/bin/env fontforge
+ i=1
+ while ( i<$argc )
+ Open($argv[i])
+ Generate($argv[i]:r + ".ttf")
+ i = i+1
+ endloop
+
+The original STIX Font License begins below.
+
+-----------------------------------------------------------
+
+STIX Font License
+
+24 May 2010
+
+Copyright (c) 2001-2010 by the STI Pub Companies, consisting of the American
+Institute of Physics, the American Chemical Society, the American Mathematical
+Society, the American Physical Society, Elsevier, Inc., and The Institute of
+Electrical and Electronic Engineers, Inc. (www.stixfonts.org), with Reserved
+Font Name STIX Fonts, STIX Fonts (TM) is a trademark of The Institute of
+Electrical and Electronics Engineers, Inc.
+
+Portions copyright (c) 1998-2003 by MicroPress, Inc. (www.micropress-inc.com),
+with Reserved Font Name TM Math. To obtain additional mathematical fonts, please
+contact MicroPress, Inc., 68-30 Harrow Street, Forest Hills, NY 11375, USA,
+Phone: (718) 575-1816.
+
+Portions copyright (c) 1990 by Elsevier, Inc.
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf
new file mode 100644
index 0000000..8699400
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf
new file mode 100644
index 0000000..ba80b53
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf
new file mode 100644
index 0000000..5957dab
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf
new file mode 100644
index 0000000..2830b6b
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf
new file mode 100644
index 0000000..a70c797
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf
new file mode 100644
index 0000000..ccbd9a6
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf
new file mode 100644
index 0000000..e75e09e
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf
new file mode 100644
index 0000000..c27d42f
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf
new file mode 100644
index 0000000..f81717e
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf
new file mode 100644
index 0000000..855dec9
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf
new file mode 100644
index 0000000..f955ca2
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf
new file mode 100644
index 0000000..6ffd357
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf
new file mode 100644
index 0000000..01ed101
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf
new file mode 100644
index 0000000..1ccf365
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf
new file mode 100644
index 0000000..bf2b66a
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf
new file mode 100644
index 0000000..bd5f93f
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf
new file mode 100644
index 0000000..73b9930
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmb10.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmb10.ttf
new file mode 100644
index 0000000..189bdf0
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmb10.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmex10.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmex10.ttf
new file mode 100644
index 0000000..e4b468d
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmex10.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf
new file mode 100644
index 0000000..8d32661
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmr10.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmr10.ttf
new file mode 100644
index 0000000..8bc4496
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmr10.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmss10.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmss10.ttf
new file mode 100644
index 0000000..ef70532
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmss10.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmsy10.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmsy10.ttf
new file mode 100644
index 0000000..45d8421
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmsy10.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf
new file mode 100644
index 0000000..15bdb68
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/back-symbolic.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/back-symbolic.svg
new file mode 100644
index 0000000..a933ef8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/back-symbolic.svg
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/back.pdf b/venv/Lib/site-packages/matplotlib/mpl-data/images/back.pdf
new file mode 100644
index 0000000..79709d8
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/back.pdf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/back.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/back.png
new file mode 100644
index 0000000..e3c4b58
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/back.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/back.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/back.svg
new file mode 100644
index 0000000..a933ef8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/back.svg
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/back_large.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/back_large.png
new file mode 100644
index 0000000..e44a70a
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/back_large.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave-symbolic.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave-symbolic.svg
new file mode 100644
index 0000000..ad8372d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave-symbolic.svg
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave.pdf b/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave.pdf
new file mode 100644
index 0000000..794a115
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave.pdf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave.png
new file mode 100644
index 0000000..919e40b
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave.svg
new file mode 100644
index 0000000..ad8372d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave.svg
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave_large.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave_large.png
new file mode 100644
index 0000000..a39b55a
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/filesave_large.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/forward-symbolic.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/forward-symbolic.svg
new file mode 100644
index 0000000..1f40713
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/forward-symbolic.svg
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/forward.pdf b/venv/Lib/site-packages/matplotlib/mpl-data/images/forward.pdf
new file mode 100644
index 0000000..ce4a1bc
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/forward.pdf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/forward.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/forward.png
new file mode 100644
index 0000000..59400fe
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/forward.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/forward.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/forward.svg
new file mode 100644
index 0000000..1f40713
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/forward.svg
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/forward_large.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/forward_large.png
new file mode 100644
index 0000000..de65815
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/forward_large.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/hand.pdf b/venv/Lib/site-packages/matplotlib/mpl-data/images/hand.pdf
new file mode 100644
index 0000000..1308816
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/hand.pdf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/hand.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/hand.png
new file mode 100644
index 0000000..d956c5f
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/hand.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/hand.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/hand.svg
new file mode 100644
index 0000000..f246f51
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/hand.svg
@@ -0,0 +1,130 @@
+
+
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/help-symbolic.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/help-symbolic.svg
new file mode 100644
index 0000000..484bdbc
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/help-symbolic.svg
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/help.pdf b/venv/Lib/site-packages/matplotlib/mpl-data/images/help.pdf
new file mode 100644
index 0000000..38178d0
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/help.pdf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/help.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/help.png
new file mode 100644
index 0000000..a52fbbe
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/help.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/help.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/help.svg
new file mode 100644
index 0000000..484bdbc
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/help.svg
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/help_large.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/help_large.png
new file mode 100644
index 0000000..3f3d4df
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/help_large.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/home-symbolic.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/home-symbolic.svg
new file mode 100644
index 0000000..3c4ccce
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/home-symbolic.svg
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/home.pdf b/venv/Lib/site-packages/matplotlib/mpl-data/images/home.pdf
new file mode 100644
index 0000000..f9c6439
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/home.pdf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/home.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/home.png
new file mode 100644
index 0000000..6e5fdeb
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/home.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/home.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/home.svg
new file mode 100644
index 0000000..3c4ccce
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/home.svg
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/home_large.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/home_large.png
new file mode 100644
index 0000000..3357bfe
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/home_large.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/matplotlib.pdf b/venv/Lib/site-packages/matplotlib/mpl-data/images/matplotlib.pdf
new file mode 100644
index 0000000..6c44566
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/matplotlib.pdf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/matplotlib.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/matplotlib.png
new file mode 100644
index 0000000..8eedfa7
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/matplotlib.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/matplotlib.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/matplotlib.svg
new file mode 100644
index 0000000..95d1b61
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/matplotlib.svg
@@ -0,0 +1,3171 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/matplotlib_128.ppm b/venv/Lib/site-packages/matplotlib/mpl-data/images/matplotlib_128.ppm
new file mode 100644
index 0000000..d9a647b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/matplotlib_128.ppm
@@ -0,0 +1,4 @@
+P6
+128 128
+255
+ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþþþðôöØãéÀÒÜ©ÁÏ‘±Ã„§»¥¹}¢·}¢·¥¹„§»‘±Ã©ÁÏÁÓÝØãéðôöþþþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõøùÉÙáš·Çj•
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/move.pdf b/venv/Lib/site-packages/matplotlib/mpl-data/images/move.pdf
new file mode 100644
index 0000000..d883d92
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/move.pdf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/move.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/move.png
new file mode 100644
index 0000000..4fbbaef
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/move.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/move.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/move.svg
new file mode 100644
index 0000000..aa7198c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/move.svg
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/move_large.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/move_large.png
new file mode 100644
index 0000000..96351c1
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/move_large.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/qt4_editor_options.pdf b/venv/Lib/site-packages/matplotlib/mpl-data/images/qt4_editor_options.pdf
new file mode 100644
index 0000000..a92f2cc
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/qt4_editor_options.pdf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/qt4_editor_options.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/qt4_editor_options.png
new file mode 100644
index 0000000..792ec81
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/qt4_editor_options.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/qt4_editor_options.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/qt4_editor_options.svg
new file mode 100644
index 0000000..0b46bf8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/qt4_editor_options.svg
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/qt4_editor_options_large.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/qt4_editor_options_large.png
new file mode 100644
index 0000000..46d52c9
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/qt4_editor_options_large.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots-symbolic.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots-symbolic.svg
new file mode 100644
index 0000000..e87d2c9
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots-symbolic.svg
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots.pdf b/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots.pdf
new file mode 100644
index 0000000..f404665
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots.pdf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots.png
new file mode 100644
index 0000000..bb0318c
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots.svg
new file mode 100644
index 0000000..e87d2c9
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots.svg
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots_large.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots_large.png
new file mode 100644
index 0000000..4440af1
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/subplots_large.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect-symbolic.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect-symbolic.svg
new file mode 100644
index 0000000..f4b69b2
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect-symbolic.svg
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect.pdf b/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect.pdf
new file mode 100644
index 0000000..22add33
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect.pdf differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect.png
new file mode 100644
index 0000000..12afa25
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect.svg b/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect.svg
new file mode 100644
index 0000000..f4b69b2
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect.svg
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect_large.png b/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect_large.png
new file mode 100644
index 0000000..5963603
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/images/zoom_to_rect_large.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/matplotlibrc b/venv/Lib/site-packages/matplotlib/mpl-data/matplotlibrc
new file mode 100644
index 0000000..3d601d0
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/matplotlibrc
@@ -0,0 +1,769 @@
+#### MATPLOTLIBRC FORMAT
+
+## NOTE FOR END USERS: DO NOT EDIT THIS FILE!
+##
+## This is a sample Matplotlib configuration file - you can find a copy
+## of it on your system in site-packages/matplotlib/mpl-data/matplotlibrc
+## (relative to your Python installation location).
+##
+## You should find a copy of it on your system at
+## site-packages/matplotlib/mpl-data/matplotlibrc (relative to your Python
+## installation location). DO NOT EDIT IT!
+##
+## If you wish to change your default style, copy this file to one of the
+## following locations:
+## Unix/Linux:
+## $HOME/.config/matplotlib/matplotlibrc OR
+## $XDG_CONFIG_HOME/matplotlib/matplotlibrc (if $XDG_CONFIG_HOME is set)
+## Other platforms:
+## $HOME/.matplotlib/matplotlibrc
+## and edit that copy.
+##
+## See https://matplotlib.org/users/customizing.html#the-matplotlibrc-file
+## for more details on the paths which are checked for the configuration file.
+##
+## Blank lines, or lines starting with a comment symbol, are ignored, as are
+## trailing comments. Other lines must have the format:
+## key: val # optional comment
+##
+## Formatting: Use PEP8-like style (as enforced in the rest of the codebase).
+## All lines start with an additional '#', so that removing all leading '#'s
+## yields a valid style file.
+##
+## Colors: for the color values below, you can either use
+## - a Matplotlib color string, such as r, k, or b
+## - an RGB tuple, such as (1.0, 0.5, 0.0)
+## - a hex string, such as ff00ff
+## - a scalar grayscale intensity such as 0.75
+## - a legal html color name, e.g., red, blue, darkslategray
+##
+## Matplotlib configuration are currently divided into following parts:
+## - BACKENDS
+## - LINES
+## - PATCHES
+## - HATCHES
+## - BOXPLOT
+## - FONT
+## - TEXT
+## - LaTeX
+## - AXES
+## - DATES
+## - TICKS
+## - GRIDS
+## - LEGEND
+## - FIGURE
+## - IMAGES
+## - CONTOUR PLOTS
+## - ERRORBAR PLOTS
+## - HISTOGRAM PLOTS
+## - SCATTER PLOTS
+## - AGG RENDERING
+## - PATHS
+## - SAVING FIGURES
+## - INTERACTIVE KEYMAPS
+## - ANIMATION
+
+##### CONFIGURATION BEGINS HERE
+
+
+## ***************************************************************************
+## * BACKENDS *
+## ***************************************************************************
+## The default backend. If you omit this parameter, the first working
+## backend from the following list is used:
+## MacOSX Qt5Agg Gtk3Agg TkAgg WxAgg Agg
+## Other choices include:
+## Qt5Cairo GTK3Cairo TkCairo WxCairo Cairo
+## Qt4Agg Qt4Cairo Wx # deprecated.
+## PS PDF SVG Template
+## You can also deploy your own backend outside of Matplotlib by referring to
+## the module name (which must be in the PYTHONPATH) as 'module://my_backend'.
+#backend: Agg
+
+## The port to use for the web server in the WebAgg backend.
+#webagg.port: 8988
+
+## The address on which the WebAgg web server should be reachable
+#webagg.address: 127.0.0.1
+
+## If webagg.port is unavailable, a number of other random ports will
+## be tried until one that is available is found.
+#webagg.port_retries: 50
+
+## When True, open the web browser to the plot that is shown
+#webagg.open_in_browser: True
+
+## If you are running pyplot inside a GUI and your backend choice
+## conflicts, we will automatically try to find a compatible one for
+## you if backend_fallback is True
+#backend_fallback: True
+
+#interactive: False
+#toolbar: toolbar2 # {None, toolbar2, toolmanager}
+#timezone: UTC # a pytz timezone string, e.g., US/Central or Europe/Paris
+
+
+## ***************************************************************************
+## * LINES *
+## ***************************************************************************
+## See https://matplotlib.org/api/artist_api.html#module-matplotlib.lines
+## for more information on line properties.
+#lines.linewidth: 1.5 # line width in points
+#lines.linestyle: - # solid line
+#lines.color: C0 # has no affect on plot(); see axes.prop_cycle
+#lines.marker: None # the default marker
+#lines.markerfacecolor: auto # the default marker face color
+#lines.markeredgecolor: auto # the default marker edge color
+#lines.markeredgewidth: 1.0 # the line width around the marker symbol
+#lines.markersize: 6 # marker size, in points
+#lines.dash_joinstyle: round # {miter, round, bevel}
+#lines.dash_capstyle: butt # {butt, round, projecting}
+#lines.solid_joinstyle: round # {miter, round, bevel}
+#lines.solid_capstyle: projecting # {butt, round, projecting}
+#lines.antialiased: True # render lines in antialiased (no jaggies)
+
+## The three standard dash patterns. These are scaled by the linewidth.
+#lines.dashed_pattern: 3.7, 1.6
+#lines.dashdot_pattern: 6.4, 1.6, 1, 1.6
+#lines.dotted_pattern: 1, 1.65
+#lines.scale_dashes: True
+
+#markers.fillstyle: full # {full, left, right, bottom, top, none}
+
+#pcolor.shading : flat
+#pcolormesh.snap : True # Whether to snap the mesh to pixel boundaries. This
+ # is provided solely to allow old test images to remain
+ # unchanged. Set to False to obtain the previous behavior.
+
+## ***************************************************************************
+## * PATCHES *
+## ***************************************************************************
+## Patches are graphical objects that fill 2D space, like polygons or circles.
+## See https://matplotlib.org/api/artist_api.html#module-matplotlib.patches
+## for more information on patch properties.
+#patch.linewidth: 1 # edge width in points.
+#patch.facecolor: C0
+#patch.edgecolor: black # if forced, or patch is not filled
+#patch.force_edgecolor: False # True to always use edgecolor
+#patch.antialiased: True # render patches in antialiased (no jaggies)
+
+
+## ***************************************************************************
+## * HATCHES *
+## ***************************************************************************
+#hatch.color: black
+#hatch.linewidth: 1.0
+
+
+## ***************************************************************************
+## * BOXPLOT *
+## ***************************************************************************
+#boxplot.notch: False
+#boxplot.vertical: True
+#boxplot.whiskers: 1.5
+#boxplot.bootstrap: None
+#boxplot.patchartist: False
+#boxplot.showmeans: False
+#boxplot.showcaps: True
+#boxplot.showbox: True
+#boxplot.showfliers: True
+#boxplot.meanline: False
+
+#boxplot.flierprops.color: black
+#boxplot.flierprops.marker: o
+#boxplot.flierprops.markerfacecolor: none
+#boxplot.flierprops.markeredgecolor: black
+#boxplot.flierprops.markeredgewidth: 1.0
+#boxplot.flierprops.markersize: 6
+#boxplot.flierprops.linestyle: none
+#boxplot.flierprops.linewidth: 1.0
+
+#boxplot.boxprops.color: black
+#boxplot.boxprops.linewidth: 1.0
+#boxplot.boxprops.linestyle: -
+
+#boxplot.whiskerprops.color: black
+#boxplot.whiskerprops.linewidth: 1.0
+#boxplot.whiskerprops.linestyle: -
+
+#boxplot.capprops.color: black
+#boxplot.capprops.linewidth: 1.0
+#boxplot.capprops.linestyle: -
+
+#boxplot.medianprops.color: C1
+#boxplot.medianprops.linewidth: 1.0
+#boxplot.medianprops.linestyle: -
+
+#boxplot.meanprops.color: C2
+#boxplot.meanprops.marker: ^
+#boxplot.meanprops.markerfacecolor: C2
+#boxplot.meanprops.markeredgecolor: C2
+#boxplot.meanprops.markersize: 6
+#boxplot.meanprops.linestyle: --
+#boxplot.meanprops.linewidth: 1.0
+
+
+## ***************************************************************************
+## * FONT *
+## ***************************************************************************
+## The font properties used by `text.Text`.
+## See https://matplotlib.org/api/font_manager_api.html for more information
+## on font properties. The 6 font properties used for font matching are
+## given below with their default values.
+##
+## The font.family property can take either a concrete font name (not supported
+## when rendering text with usetex), or one of the following five generic
+## values:
+## - 'serif' (e.g., Times),
+## - 'sans-serif' (e.g., Helvetica),
+## - 'cursive' (e.g., Zapf-Chancery),
+## - 'fantasy' (e.g., Western), and
+## - 'monospace' (e.g., Courier).
+## Each of these values has a corresponding default list of font names
+## (font.serif, etc.); the first available font in the list is used. Note that
+## for font.serif, font.sans-serif, and font.monospace, the first element of
+## the list (a DejaVu font) will always be used because DejaVu is shipped with
+## Matplotlib and is thus guaranteed to be available; the other entries are
+## left as examples of other possible values.
+##
+## The font.style property has three values: normal (or roman), italic
+## or oblique. The oblique style will be used for italic, if it is not
+## present.
+##
+## The font.variant property has two values: normal or small-caps. For
+## TrueType fonts, which are scalable fonts, small-caps is equivalent
+## to using a font size of 'smaller', or about 83%% of the current font
+## size.
+##
+## The font.weight property has effectively 13 values: normal, bold,
+## bolder, lighter, 100, 200, 300, ..., 900. Normal is the same as
+## 400, and bold is 700. bolder and lighter are relative values with
+## respect to the current weight.
+##
+## The font.stretch property has 11 values: ultra-condensed,
+## extra-condensed, condensed, semi-condensed, normal, semi-expanded,
+## expanded, extra-expanded, ultra-expanded, wider, and narrower. This
+## property is not currently implemented.
+##
+## The font.size property is the default font size for text, given in points.
+## 10 pt is the standard value.
+##
+## Note that font.size controls default text sizes. To configure
+## special text sizes tick labels, axes, labels, title, etc., see the rc
+## settings for axes and ticks. Special text sizes can be defined
+## relative to font.size, using the following values: xx-small, x-small,
+## small, medium, large, x-large, xx-large, larger, or smaller
+
+#font.family: sans-serif
+#font.style: normal
+#font.variant: normal
+#font.weight: normal
+#font.stretch: normal
+#font.size: 10.0
+
+#font.serif: DejaVu Serif, Bitstream Vera Serif, Computer Modern Roman, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
+#font.sans-serif: DejaVu Sans, Bitstream Vera Sans, Computer Modern Sans Serif, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
+#font.cursive: Apple Chancery, Textile, Zapf Chancery, Sand, Script MT, Felipa, Comic Neue, Comic Sans MS, cursive
+#font.fantasy: Chicago, Charcoal, Impact, Western, Humor Sans, xkcd, fantasy
+#font.monospace: DejaVu Sans Mono, Bitstream Vera Sans Mono, Computer Modern Typewriter, Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace
+
+
+## ***************************************************************************
+## * TEXT *
+## ***************************************************************************
+## The text properties used by `text.Text`.
+## See https://matplotlib.org/api/artist_api.html#module-matplotlib.text
+## for more information on text properties
+#text.color: black
+
+
+## ***************************************************************************
+## * LaTeX *
+## ***************************************************************************
+## For more information on LaTeX properties, see
+## https://matplotlib.org/tutorials/text/usetex.html
+#text.usetex: False # use latex for all text handling. The following fonts
+ # are supported through the usual rc parameter settings:
+ # new century schoolbook, bookman, times, palatino,
+ # zapf chancery, charter, serif, sans-serif, helvetica,
+ # avant garde, courier, monospace, computer modern roman,
+ # computer modern sans serif, computer modern typewriter
+ # If another font is desired which can loaded using the
+ # LaTeX \usepackage command, please inquire at the
+ # Matplotlib mailing list
+#text.latex.preamble: # IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX FAILURES
+ # AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT ASK FOR HELP
+ # IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT TO.
+ # text.latex.preamble is a single line of LaTeX code that
+ # will be passed on to the LaTeX system. It may contain
+ # any code that is valid for the LaTeX "preamble", i.e.
+ # between the "\documentclass" and "\begin{document}"
+ # statements.
+ # Note that it has to be put on a single line, which may
+ # become quite long.
+ # The following packages are always loaded with usetex, so
+ # beware of package collisions: color, geometry, graphicx,
+ # type1cm, textcomp.
+ # Adobe Postscript (PSSNFS) font packages may also be
+ # loaded, depending on your font settings.
+
+## FreeType hinting flag ("foo" corresponds to FT_LOAD_FOO); may be one of the
+## following (Proprietary Matplotlib-specific synonyms are given in parentheses,
+## but their use is discouraged):
+## - default: Use the font's native hinter if possible, else FreeType's auto-hinter.
+## ("either" is a synonym).
+## - no_autohint: Use the font's native hinter if possible, else don't hint.
+## ("native" is a synonym.)
+## - force_autohint: Use FreeType's auto-hinter. ("auto" is a synonym.)
+## - no_hinting: Disable hinting. ("none" is a synonym.)
+#text.hinting: force_autohint
+
+#text.hinting_factor: 8 # Specifies the amount of softness for hinting in the
+ # horizontal direction. A value of 1 will hint to full
+ # pixels. A value of 2 will hint to half pixels etc.
+#text.kerning_factor : 0 # Specifies the scaling factor for kerning values. This
+ # is provided solely to allow old test images to remain
+ # unchanged. Set to 6 to obtain previous behavior. Values
+ # other than 0 or 6 have no defined meaning.
+#text.antialiased: True # If True (default), the text will be antialiased.
+ # This only affects raster outputs.
+
+## The following settings allow you to select the fonts in math mode.
+#mathtext.fontset: dejavusans # Should be 'dejavusans' (default),
+ # 'dejavuserif', 'cm' (Computer Modern), 'stix',
+ # 'stixsans' or 'custom' (unsupported, may go
+ # away in the future)
+## "mathtext.fontset: custom" is defined by the mathtext.bf, .cal, .it, ...
+## settings which map a TeX font name to a fontconfig font pattern. (These
+## settings are not used for other font sets.)
+#mathtext.bf: sans:bold
+#mathtext.cal: cursive
+#mathtext.it: sans:italic
+#mathtext.rm: sans
+#mathtext.sf: sans
+#mathtext.tt: monospace
+#mathtext.fallback: cm # Select fallback font from ['cm' (Computer Modern), 'stix'
+ # 'stixsans'] when a symbol can not be found in one of the
+ # custom math fonts. Select 'None' to not perform fallback
+ # and replace the missing character by a dummy symbol.
+#mathtext.default: it # The default font to use for math.
+ # Can be any of the LaTeX font names, including
+ # the special name "regular" for the same font
+ # used in regular text.
+
+
+## ***************************************************************************
+## * AXES *
+## ***************************************************************************
+## Following are default face and edge colors, default tick sizes,
+## default font sizes for tick labels, and so on. See
+## https://matplotlib.org/api/axes_api.html#module-matplotlib.axes
+#axes.facecolor: white # axes background color
+#axes.edgecolor: black # axes edge color
+#axes.linewidth: 0.8 # edge line width
+#axes.grid: False # display grid or not
+#axes.grid.axis: both # which axis the grid should apply to
+#axes.grid.which: major # grid lines at {major, minor, both} ticks
+#axes.titlelocation: center # alignment of the title: {left, right, center}
+#axes.titlesize: large # font size of the axes title
+#axes.titleweight: normal # font weight of title
+#axes.titlecolor: auto # color of the axes title, auto falls back to
+ # text.color as default value
+#axes.titley: None # position title (axes relative units). None implies auto
+#axes.titlepad: 6.0 # pad between axes and title in points
+#axes.labelsize: medium # font size of the x and y labels
+#axes.labelpad: 4.0 # space between label and axis
+#axes.labelweight: normal # weight of the x and y labels
+#axes.labelcolor: black
+#axes.axisbelow: line # draw axis gridlines and ticks:
+ # - below patches (True)
+ # - above patches but below lines ('line')
+ # - above all (False)
+
+#axes.formatter.limits: -5, 6 # use scientific notation if log10
+ # of the axis range is smaller than the
+ # first or larger than the second
+#axes.formatter.use_locale: False # When True, format tick labels
+ # according to the user's locale.
+ # For example, use ',' as a decimal
+ # separator in the fr_FR locale.
+#axes.formatter.use_mathtext: False # When True, use mathtext for scientific
+ # notation.
+#axes.formatter.min_exponent: 0 # minimum exponent to format in scientific notation
+#axes.formatter.useoffset: True # If True, the tick label formatter
+ # will default to labeling ticks relative
+ # to an offset when the data range is
+ # small compared to the minimum absolute
+ # value of the data.
+#axes.formatter.offset_threshold: 4 # When useoffset is True, the offset
+ # will be used when it can remove
+ # at least this number of significant
+ # digits from tick labels.
+
+#axes.spines.left: True # display axis spines
+#axes.spines.bottom: True
+#axes.spines.top: True
+#axes.spines.right: True
+
+#axes.unicode_minus: True # use Unicode for the minus symbol rather than hyphen. See
+ # https://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes
+#axes.prop_cycle: cycler('color', ['1f77b4', 'ff7f0e', '2ca02c', 'd62728', '9467bd', '8c564b', 'e377c2', '7f7f7f', 'bcbd22', '17becf'])
+ # color cycle for plot lines as list of string color specs:
+ # single letter, long name, or web-style hex
+ # As opposed to all other parameters in this file, the color
+ # values must be enclosed in quotes for this parameter,
+ # e.g. '1f77b4', instead of 1f77b4.
+ # See also https://matplotlib.org/tutorials/intermediate/color_cycle.html
+ # for more details on prop_cycle usage.
+#axes.xmargin: .05 # x margin. See `axes.Axes.margins`
+#axes.ymargin: .05 # y margin. See `axes.Axes.margins`
+#axes.zmargin: .05 # z margin. See `axes.Axes.margins`
+#axes.autolimit_mode: data # If "data", use axes.xmargin and axes.ymargin as is.
+ # If "round_numbers", after application of margins, axis
+ # limits are further expanded to the nearest "round" number.
+#polaraxes.grid: True # display grid on polar axes
+#axes3d.grid: True # display grid on 3D axes
+
+
+## ***************************************************************************
+## * AXIS *
+## ***************************************************************************
+#xaxis.labellocation: center # alignment of the xaxis label: {left, right, center}
+#yaxis.labellocation: center # alignment of the yaxis label: {bottom, top, center}
+
+
+## ***************************************************************************
+## * DATES *
+## ***************************************************************************
+## These control the default format strings used in AutoDateFormatter.
+## Any valid format datetime format string can be used (see the python
+## `datetime` for details). For example, by using:
+## - '%%x' will use the locale date representation
+## - '%%X' will use the locale time representation
+## - '%%c' will use the full locale datetime representation
+## These values map to the scales:
+## {'year': 365, 'month': 30, 'day': 1, 'hour': 1/24, 'minute': 1 / (24 * 60)}
+
+#date.autoformatter.year: %Y
+#date.autoformatter.month: %Y-%m
+#date.autoformatter.day: %Y-%m-%d
+#date.autoformatter.hour: %m-%d %H
+#date.autoformatter.minute: %d %H:%M
+#date.autoformatter.second: %H:%M:%S
+#date.autoformatter.microsecond: %M:%S.%f
+## The reference date for Matplotlib's internal date representation
+## See https://matplotlib.org/examples/ticks_and_spines/date_precision_and_epochs.py
+#date.epoch: 1970-01-01T00:00:00
+## 'auto', 'concise':
+#date.converter: auto
+## For auto converter whether to use interval_multiples:
+#date.interval_multiples: True
+
+## ***************************************************************************
+## * TICKS *
+## ***************************************************************************
+## See https://matplotlib.org/api/axis_api.html#matplotlib.axis.Tick
+#xtick.top: False # draw ticks on the top side
+#xtick.bottom: True # draw ticks on the bottom side
+#xtick.labeltop: False # draw label on the top
+#xtick.labelbottom: True # draw label on the bottom
+#xtick.major.size: 3.5 # major tick size in points
+#xtick.minor.size: 2 # minor tick size in points
+#xtick.major.width: 0.8 # major tick width in points
+#xtick.minor.width: 0.6 # minor tick width in points
+#xtick.major.pad: 3.5 # distance to major tick label in points
+#xtick.minor.pad: 3.4 # distance to the minor tick label in points
+#xtick.color: black # color of the ticks
+#xtick.labelcolor: inherit # color of the tick labels or inherit from xtick.color
+#xtick.labelsize: medium # font size of the tick labels
+#xtick.direction: out # direction: {in, out, inout}
+#xtick.minor.visible: False # visibility of minor ticks on x-axis
+#xtick.major.top: True # draw x axis top major ticks
+#xtick.major.bottom: True # draw x axis bottom major ticks
+#xtick.minor.top: True # draw x axis top minor ticks
+#xtick.minor.bottom: True # draw x axis bottom minor ticks
+#xtick.alignment: center # alignment of xticks
+
+#ytick.left: True # draw ticks on the left side
+#ytick.right: False # draw ticks on the right side
+#ytick.labelleft: True # draw tick labels on the left side
+#ytick.labelright: False # draw tick labels on the right side
+#ytick.major.size: 3.5 # major tick size in points
+#ytick.minor.size: 2 # minor tick size in points
+#ytick.major.width: 0.8 # major tick width in points
+#ytick.minor.width: 0.6 # minor tick width in points
+#ytick.major.pad: 3.5 # distance to major tick label in points
+#ytick.minor.pad: 3.4 # distance to the minor tick label in points
+#ytick.color: black # color of the ticks
+#ytick.labelcolor: inherit # color of the tick labels or inherit from ytick.color
+#ytick.labelsize: medium # font size of the tick labels
+#ytick.direction: out # direction: {in, out, inout}
+#ytick.minor.visible: False # visibility of minor ticks on y-axis
+#ytick.major.left: True # draw y axis left major ticks
+#ytick.major.right: True # draw y axis right major ticks
+#ytick.minor.left: True # draw y axis left minor ticks
+#ytick.minor.right: True # draw y axis right minor ticks
+#ytick.alignment: center_baseline # alignment of yticks
+
+
+## ***************************************************************************
+## * GRIDS *
+## ***************************************************************************
+#grid.color: b0b0b0 # grid color
+#grid.linestyle: - # solid
+#grid.linewidth: 0.8 # in points
+#grid.alpha: 1.0 # transparency, between 0.0 and 1.0
+
+
+## ***************************************************************************
+## * LEGEND *
+## ***************************************************************************
+#legend.loc: best
+#legend.frameon: True # if True, draw the legend on a background patch
+#legend.framealpha: 0.8 # legend patch transparency
+#legend.facecolor: inherit # inherit from axes.facecolor; or color spec
+#legend.edgecolor: 0.8 # background patch boundary color
+#legend.fancybox: True # if True, use a rounded box for the
+ # legend background, else a rectangle
+#legend.shadow: False # if True, give background a shadow effect
+#legend.numpoints: 1 # the number of marker points in the legend line
+#legend.scatterpoints: 1 # number of scatter points
+#legend.markerscale: 1.0 # the relative size of legend markers vs. original
+#legend.fontsize: medium
+#legend.title_fontsize: None # None sets to the same as the default axes.
+
+## Dimensions as fraction of font size:
+#legend.borderpad: 0.4 # border whitespace
+#legend.labelspacing: 0.5 # the vertical space between the legend entries
+#legend.handlelength: 2.0 # the length of the legend lines
+#legend.handleheight: 0.7 # the height of the legend handle
+#legend.handletextpad: 0.8 # the space between the legend line and legend text
+#legend.borderaxespad: 0.5 # the border between the axes and legend edge
+#legend.columnspacing: 2.0 # column separation
+
+
+## ***************************************************************************
+## * FIGURE *
+## ***************************************************************************
+## See https://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure
+#figure.titlesize: large # size of the figure title (``Figure.suptitle()``)
+#figure.titleweight: normal # weight of the figure title
+#figure.figsize: 6.4, 4.8 # figure size in inches
+#figure.dpi: 100 # figure dots per inch
+#figure.facecolor: white # figure face color
+#figure.edgecolor: white # figure edge color
+#figure.frameon: True # enable figure frame
+#figure.max_open_warning: 20 # The maximum number of figures to open through
+ # the pyplot interface before emitting a warning.
+ # If less than one this feature is disabled.
+#figure.raise_window : True # Raise the GUI window to front when show() is called.
+
+## The figure subplot parameters. All dimensions are a fraction of the figure width and height.
+#figure.subplot.left: 0.125 # the left side of the subplots of the figure
+#figure.subplot.right: 0.9 # the right side of the subplots of the figure
+#figure.subplot.bottom: 0.11 # the bottom of the subplots of the figure
+#figure.subplot.top: 0.88 # the top of the subplots of the figure
+#figure.subplot.wspace: 0.2 # the amount of width reserved for space between subplots,
+ # expressed as a fraction of the average axis width
+#figure.subplot.hspace: 0.2 # the amount of height reserved for space between subplots,
+ # expressed as a fraction of the average axis height
+
+## Figure layout
+#figure.autolayout: False # When True, automatically adjust subplot
+ # parameters to make the plot fit the figure
+ # using `tight_layout`
+#figure.constrained_layout.use: False # When True, automatically make plot
+ # elements fit on the figure. (Not
+ # compatible with `autolayout`, above).
+#figure.constrained_layout.h_pad: 0.04167 # Padding around axes objects. Float representing
+#figure.constrained_layout.w_pad: 0.04167 # inches. Default is 3/72 inches (3 points)
+#figure.constrained_layout.hspace: 0.02 # Space between subplot groups. Float representing
+#figure.constrained_layout.wspace: 0.02 # a fraction of the subplot widths being separated.
+
+
+## ***************************************************************************
+## * IMAGES *
+## ***************************************************************************
+#image.aspect: equal # {equal, auto} or a number
+#image.interpolation: antialiased # see help(imshow) for options
+#image.cmap: viridis # A colormap name, gray etc...
+#image.lut: 256 # the size of the colormap lookup table
+#image.origin: upper # {lower, upper}
+#image.resample: True
+#image.composite_image: True # When True, all the images on a set of axes are
+ # combined into a single composite image before
+ # saving a figure as a vector graphics file,
+ # such as a PDF.
+
+
+## ***************************************************************************
+## * CONTOUR PLOTS *
+## ***************************************************************************
+#contour.negative_linestyle: dashed # string or on-off ink sequence
+#contour.corner_mask: True # {True, False, legacy}
+#contour.linewidth: None # {float, None} Size of the contour line
+ # widths. If set to None, it falls back to
+ # `line.linewidth`.
+
+
+## ***************************************************************************
+## * ERRORBAR PLOTS *
+## ***************************************************************************
+#errorbar.capsize: 0 # length of end cap on error bars in pixels
+
+
+## ***************************************************************************
+## * HISTOGRAM PLOTS *
+## ***************************************************************************
+#hist.bins: 10 # The default number of histogram bins or 'auto'.
+
+
+## ***************************************************************************
+## * SCATTER PLOTS *
+## ***************************************************************************
+#scatter.marker: o # The default marker type for scatter plots.
+#scatter.edgecolors: face # The default edge colors for scatter plots.
+
+
+## ***************************************************************************
+## * AGG RENDERING *
+## ***************************************************************************
+## Warning: experimental, 2008/10/10
+#agg.path.chunksize: 0 # 0 to disable; values in the range
+ # 10000 to 100000 can improve speed slightly
+ # and prevent an Agg rendering failure
+ # when plotting very large data sets,
+ # especially if they are very gappy.
+ # It may cause minor artifacts, though.
+ # A value of 20000 is probably a good
+ # starting point.
+
+
+## ***************************************************************************
+## * PATHS *
+## ***************************************************************************
+#path.simplify: True # When True, simplify paths by removing "invisible"
+ # points to reduce file size and increase rendering
+ # speed
+#path.simplify_threshold: 0.111111111111 # The threshold of similarity below
+ # which vertices will be removed in
+ # the simplification process.
+#path.snap: True # When True, rectilinear axis-aligned paths will be snapped
+ # to the nearest pixel when certain criteria are met.
+ # When False, paths will never be snapped.
+#path.sketch: None # May be None, or a 3-tuple of the form:
+ # (scale, length, randomness).
+ # - *scale* is the amplitude of the wiggle
+ # perpendicular to the line (in pixels).
+ # - *length* is the length of the wiggle along the
+ # line (in pixels).
+ # - *randomness* is the factor by which the length is
+ # randomly scaled.
+#path.effects:
+
+
+## ***************************************************************************
+## * SAVING FIGURES *
+## ***************************************************************************
+## The default savefig parameters can be different from the display parameters
+## e.g., you may want a higher resolution, or to make the figure
+## background white
+#savefig.dpi: figure # figure dots per inch or 'figure'
+#savefig.facecolor: auto # figure face color when saving
+#savefig.edgecolor: auto # figure edge color when saving
+#savefig.format: png # {png, ps, pdf, svg}
+#savefig.bbox: standard # {tight, standard}
+ # 'tight' is incompatible with pipe-based animation
+ # backends (e.g. 'ffmpeg') but will work with those
+ # based on temporary files (e.g. 'ffmpeg_file')
+#savefig.pad_inches: 0.1 # Padding to be used when bbox is set to 'tight'
+#savefig.directory: ~ # default directory in savefig dialog box,
+ # leave empty to always use current working directory
+#savefig.transparent: False # setting that controls whether figures are saved with a
+ # transparent background by default
+#savefig.orientation: portrait # Orientation of saved figure
+
+### tk backend params
+#tk.window_focus: False # Maintain shell focus for TkAgg
+
+### ps backend params
+#ps.papersize: letter # {auto, letter, legal, ledger, A0-A10, B0-B10}
+#ps.useafm: False # use of AFM fonts, results in small files
+#ps.usedistiller: False # {ghostscript, xpdf, None}
+ # Experimental: may produce smaller files.
+ # xpdf intended for production of publication quality files,
+ # but requires ghostscript, xpdf and ps2eps
+#ps.distiller.res: 6000 # dpi
+#ps.fonttype: 3 # Output Type 3 (Type3) or Type 42 (TrueType)
+
+### PDF backend params
+#pdf.compression: 6 # integer from 0 to 9
+ # 0 disables compression (good for debugging)
+#pdf.fonttype: 3 # Output Type 3 (Type3) or Type 42 (TrueType)
+#pdf.use14corefonts : False
+#pdf.inheritcolor: False
+
+### SVG backend params
+#svg.image_inline: True # Write raster image data directly into the SVG file
+#svg.fonttype: path # How to handle SVG fonts:
+ # path: Embed characters as paths -- supported
+ # by most SVG renderers
+ # None: Assume fonts are installed on the
+ # machine where the SVG will be viewed.
+#svg.hashsalt: None # If not None, use this string as hash salt instead of uuid4
+
+### pgf parameter
+## See https://matplotlib.org/tutorials/text/pgf.html for more information.
+#pgf.rcfonts: True
+#pgf.preamble: # See text.latex.preamble for documentation
+#pgf.texsystem: xelatex
+
+### docstring params
+#docstring.hardcopy: False # set this when you want to generate hardcopy docstring
+
+
+## ***************************************************************************
+## * INTERACTIVE KEYMAPS *
+## ***************************************************************************
+## Event keys to interact with figures/plots via keyboard.
+## See https://matplotlib.org/users/navigation_toolbar.html for more details on
+## interactive navigation. Customize these settings according to your needs.
+## Leave the field(s) empty if you don't need a key-map. (i.e., fullscreen : '')
+#keymap.fullscreen: f, ctrl+f # toggling
+#keymap.home: h, r, home # home or reset mnemonic
+#keymap.back: left, c, backspace, MouseButton.BACK # forward / backward keys
+#keymap.forward: right, v, MouseButton.FORWARD # for quick navigation
+#keymap.pan: p # pan mnemonic
+#keymap.zoom: o # zoom mnemonic
+#keymap.save: s, ctrl+s # saving current figure
+#keymap.help: f1 # display help about active tools
+#keymap.quit: ctrl+w, cmd+w, q # close the current figure
+#keymap.quit_all: # close all figures
+#keymap.grid: g # switching on/off major grids in current axes
+#keymap.grid_minor: G # switching on/off minor grids in current axes
+#keymap.yscale: l # toggle scaling of y-axes ('log'/'linear')
+#keymap.xscale: k, L # toggle scaling of x-axes ('log'/'linear')
+#keymap.copy: ctrl+c, cmd+c # Copy figure to clipboard
+
+
+## ***************************************************************************
+## * ANIMATION *
+## ***************************************************************************
+#animation.html: none # How to display the animation as HTML in
+ # the IPython notebook:
+ # - 'html5' uses HTML5 video tag
+ # - 'jshtml' creates a JavaScript animation
+#animation.writer: ffmpeg # MovieWriter 'backend' to use
+#animation.codec: h264 # Codec to use for writing movie
+#animation.bitrate: -1 # Controls size/quality trade-off for movie.
+ # -1 implies let utility auto-determine
+#animation.frame_format: png # Controls frame format used by temp files
+#animation.ffmpeg_path: ffmpeg # Path to ffmpeg binary. Without full path
+ # $PATH is searched
+#animation.ffmpeg_args: # Additional arguments to pass to ffmpeg
+#animation.convert_path: convert # Path to ImageMagick's convert binary.
+ # On Windows use the full path since convert
+ # is also the name of a system tool.
+#animation.convert_args: # Additional arguments to pass to convert
+#animation.embed_limit: 20.0 # Limit, in MB, of size of base64 encoded
+ # animation in HTML (i.e. IPython notebook)
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/plot_directive/plot_directive.css b/venv/Lib/site-packages/matplotlib/mpl-data/plot_directive/plot_directive.css
new file mode 100644
index 0000000..d45593c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/plot_directive/plot_directive.css
@@ -0,0 +1,16 @@
+/*
+ * plot_directive.css
+ * ~~~~~~~~~~~~
+ *
+ * Stylesheet controlling images created using the `plot` directive within
+ * Sphinx.
+ *
+ * :copyright: Copyright 2020-* by the Matplotlib development team.
+ * :license: Matplotlib, see LICENSE for details.
+ *
+ */
+
+img.plot-directive {
+ border: 0;
+ max-width: 100%;
+}
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/Minduka_Present_Blue_Pack.png b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/Minduka_Present_Blue_Pack.png
new file mode 100644
index 0000000..2b1aff4
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/Minduka_Present_Blue_Pack.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/README.txt b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/README.txt
new file mode 100644
index 0000000..75a5349
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/README.txt
@@ -0,0 +1,2 @@
+This is the sample data needed for some of matplotlib's examples and
+docs. See matplotlib.cbook.get_sample_data for more info.
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/axes_grid/bivariate_normal.npy b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/axes_grid/bivariate_normal.npy
new file mode 100644
index 0000000..b6b8dac
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/axes_grid/bivariate_normal.npy differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/data_x_x2_x3.csv b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/data_x_x2_x3.csv
new file mode 100644
index 0000000..521da14
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/data_x_x2_x3.csv
@@ -0,0 +1,11 @@
+ 0 0 0
+ 1 1 1
+ 2 4 8
+ 3 9 27
+ 4 16 64
+ 5 25 125
+ 6 36 216
+ 7 49 343
+ 8 64 512
+ 9 81 729
+10 100 1000
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/eeg.dat b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/eeg.dat
new file mode 100644
index 0000000..c666c65
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/eeg.dat differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/embedding_in_wx3.xrc b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/embedding_in_wx3.xrc
new file mode 100644
index 0000000..220656d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/embedding_in_wx3.xrc
@@ -0,0 +1,65 @@
+
+
+
+ embedding_in_wx3
+
+
+ wxVERTICAL
+
+
+ Check out this whizz-bang stuff!
+
+
+ 0
+ wxALL|wxEXPAND
+ 5
+
+
+
+ wxHORIZONTAL
+
+
+ whiz
+
+ 0
+ wxALL|wxEXPAND
+ 2
+
+
+
+ bang
+
+ 0
+ wxALL|wxEXPAND
+ 2
+
+
+
+ bang count:
+
+
+ 1
+ wxALL|wxEXPAND
+ 2
+
+
+
+ 0
+
+ 0
+ wxEXPAND
+
+
+ 0
+ wxLEFT|wxRIGHT|wxEXPAND
+ 5
+
+
+
+ 1
+ wxEXPAND
+
+
+
+
+
\ No newline at end of file
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/goog.npz b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/goog.npz
new file mode 100644
index 0000000..6cbfd68
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/goog.npz differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/grace_hopper.jpg b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/grace_hopper.jpg
new file mode 100644
index 0000000..478720d
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/grace_hopper.jpg differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/jacksboro_fault_dem.npz b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/jacksboro_fault_dem.npz
new file mode 100644
index 0000000..d250286
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/jacksboro_fault_dem.npz differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/logo2.png b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/logo2.png
new file mode 100644
index 0000000..a1adda4
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/logo2.png differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/membrane.dat b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/membrane.dat
new file mode 100644
index 0000000..68f5e6b
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/membrane.dat differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/msft.csv b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/msft.csv
new file mode 100644
index 0000000..727b1be
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/msft.csv
@@ -0,0 +1,66 @@
+Date,Open,High,Low,Close,Volume,Adj. Close*
+19-Sep-03,29.76,29.97,29.52,29.96,92433800,29.79
+18-Sep-03,28.49,29.51,28.42,29.50,67268096,29.34
+17-Sep-03,28.76,28.95,28.47,28.50,47221600,28.34
+16-Sep-03,28.41,28.95,28.32,28.90,52060600,28.74
+15-Sep-03,28.37,28.61,28.33,28.36,41432300,28.20
+12-Sep-03,27.48,28.40,27.45,28.34,55777200,28.18
+11-Sep-03,27.66,28.11,27.59,27.84,37813300,27.68
+10-Sep-03,28.03,28.18,27.48,27.55,54763500,27.40
+9-Sep-03,28.65,28.71,28.31,28.37,44315200,28.21
+8-Sep-03,28.39,28.92,28.34,28.84,46105300,28.68
+5-Sep-03,28.23,28.75,28.17,28.38,64024500,28.22
+4-Sep-03,28.10,28.47,27.99,28.43,59840800,28.27
+3-Sep-03,27.42,28.40,27.38,28.30,109437800,28.14
+2-Sep-03,26.70,27.30,26.47,27.26,74168896,27.11
+29-Aug-03,26.46,26.55,26.35,26.52,34503000,26.37
+28-Aug-03,26.50,26.58,26.24,26.51,46211200,26.36
+27-Aug-03,26.51,26.58,26.30,26.42,30633900,26.27
+26-Aug-03,26.31,26.67,25.96,26.57,47546000,26.42
+25-Aug-03,26.31,26.54,26.23,26.50,36132900,26.35
+22-Aug-03,26.78,26.95,26.21,26.22,65846300,26.07
+21-Aug-03,26.65,26.73,26.13,26.24,63802700,26.09
+20-Aug-03,26.30,26.53,26.00,26.45,56739300,26.30
+19-Aug-03,25.85,26.65,25.77,26.62,72952896,26.47
+18-Aug-03,25.56,25.83,25.46,25.70,45817400,25.56
+15-Aug-03,25.61,25.66,25.43,25.54,27607900,25.40
+14-Aug-03,25.66,25.71,25.52,25.63,37338300,25.49
+13-Aug-03,25.79,25.89,25.50,25.60,39636900,25.46
+12-Aug-03,25.71,25.77,25.45,25.73,38208400,25.59
+11-Aug-03,25.61,25.99,25.54,25.61,36433900,25.47
+8-Aug-03,25.88,25.98,25.50,25.58,33241400,25.44
+7-Aug-03,25.72,25.81,25.45,25.71,44258500,25.57
+6-Aug-03,25.54,26.19,25.43,25.65,56294900,25.51
+5-Aug-03,26.31,26.54,25.60,25.66,58825800,25.52
+4-Aug-03,26.15,26.41,25.75,26.18,51825600,26.03
+1-Aug-03,26.33,26.51,26.12,26.17,42649700,26.02
+31-Jul-03,26.60,26.99,26.31,26.41,64504800,26.26
+30-Jul-03,26.46,26.57,26.17,26.23,41240300,26.08
+29-Jul-03,26.88,26.90,26.24,26.47,62391100,26.32
+28-Jul-03,26.94,27.00,26.49,26.61,52658300,26.46
+25-Jul-03,26.28,26.95,26.07,26.89,54173000,26.74
+24-Jul-03,26.78,26.92,25.98,26.00,53556600,25.85
+23-Jul-03,26.42,26.65,26.14,26.45,49828200,26.30
+22-Jul-03,26.28,26.56,26.13,26.38,51791000,26.23
+21-Jul-03,26.87,26.91,26.00,26.04,48480800,25.89
+18-Jul-03,27.11,27.23,26.75,26.89,63388400,26.74
+17-Jul-03,27.14,27.27,26.54,26.69,72805000,26.54
+16-Jul-03,27.56,27.62,27.20,27.52,49838900,27.37
+15-Jul-03,27.47,27.53,27.10,27.27,53567600,27.12
+14-Jul-03,27.63,27.81,27.05,27.40,60464400,27.25
+11-Jul-03,26.95,27.45,26.89,27.31,50377300,27.16
+10-Jul-03,27.25,27.42,26.59,26.91,55350800,26.76
+9-Jul-03,27.56,27.70,27.25,27.47,62300700,27.32
+8-Jul-03,27.26,27.80,27.25,27.70,61896800,27.55
+7-Jul-03,27.02,27.55,26.95,27.42,88960800,27.27
+3-Jul-03,26.69,26.95,26.41,26.50,39440900,26.35
+2-Jul-03,26.50,26.93,26.45,26.88,94069296,26.73
+1-Jul-03,25.59,26.20,25.39,26.15,60926000,26.00
+30-Jun-03,25.94,26.12,25.50,25.64,48073100,25.50
+27-Jun-03,25.95,26.34,25.53,25.63,76040304,25.49
+26-Jun-03,25.39,26.51,25.21,25.75,51758100,25.61
+25-Jun-03,25.64,25.99,25.14,25.26,60483500,25.12
+24-Jun-03,25.65,26.04,25.52,25.70,51820300,25.56
+23-Jun-03,26.14,26.24,25.49,25.78,52584500,25.64
+20-Jun-03,26.34,26.38,26.01,26.33,86048896,26.18
+19-Jun-03,26.09,26.39,26.01,26.07,63626900,25.92
\ No newline at end of file
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/percent_bachelors_degrees_women_usa.csv b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/percent_bachelors_degrees_women_usa.csv
new file mode 100644
index 0000000..1e488d0
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/percent_bachelors_degrees_women_usa.csv
@@ -0,0 +1,43 @@
+Year,Agriculture,Architecture,Art and Performance,Biology,Business,Communications and Journalism,Computer Science,Education,Engineering,English,Foreign Languages,Health Professions,Math and Statistics,Physical Sciences,Psychology,Public Administration,Social Sciences and History
+1970,4.22979798,11.92100539,59.7,29.08836297,9.064438975,35.3,13.6,74.53532758,0.8,65.57092343,73.8,77.1,38,13.8,44.4,68.4,36.8
+1971,5.452796685,12.00310559,59.9,29.39440285,9.503186594,35.5,13.6,74.14920369,1,64.55648516,73.9,75.5,39,14.9,46.2,65.5,36.2
+1972,7.42071022,13.21459351,60.4,29.81022105,10.5589621,36.6,14.9,73.55451996,1.2,63.6642632,74.6,76.9,40.2,14.8,47.6,62.6,36.1
+1973,9.653602412,14.7916134,60.2,31.14791477,12.80460152,38.4,16.4,73.50181443,1.6,62.94150212,74.9,77.4,40.9,16.5,50.4,64.3,36.4
+1974,14.07462346,17.44468758,61.9,32.99618284,16.20485038,40.5,18.9,73.33681143,2.2,62.41341209,75.3,77.9,41.8,18.2,52.6,66.1,37.3
+1975,18.33316153,19.13404767,60.9,34.44990213,19.68624931,41.5,19.8,72.80185448,3.2,61.64720641,75,78.9,40.7,19.1,54.5,63,37.7
+1976,22.25276005,21.39449143,61.3,36.07287146,23.4300375,44.3,23.9,72.16652471,4.5,62.14819377,74.4,79.2,41.5,20,56.9,65.6,39.2
+1977,24.6401766,23.74054054,62,38.33138629,27.16342715,46.9,25.7,72.45639481,6.8,62.72306675,74.3,80.5,41.1,21.3,59,69.3,40.5
+1978,27.14619175,25.84923973,62.5,40.11249564,30.52751868,49.9,28.1,73.19282134,8.4,63.61912216,74.3,81.9,41.6,22.5,61.3,71.5,41.8
+1979,29.63336549,27.77047744,63.2,42.06555109,33.62163381,52.3,30.2,73.82114234,9.4,65.08838972,74.2,82.3,42.3,23.7,63.3,73.3,43.6
+1980,30.75938956,28.08038075,63.4,43.99925716,36.76572529,54.7,32.5,74.98103152,10.3,65.28413007,74.1,83.5,42.8,24.6,65.1,74.6,44.2
+1981,31.31865519,29.84169408,63.3,45.24951206,39.26622984,56.4,34.8,75.84512345,11.6,65.83832154,73.9,84.1,43.2,25.7,66.9,74.7,44.6
+1982,32.63666364,34.81624758,63.1,45.96733794,41.94937335,58,36.3,75.84364914,12.4,65.84735212,72.7,84.4,44,27.3,67.5,76.8,44.6
+1983,31.6353471,35.82625735,62.4,46.71313451,43.54206966,58.6,37.1,75.95060123,13.1,65.91837999,71.8,84.6,44.3,27.6,67.9,76.1,44.1
+1984,31.09294748,35.45308311,62.1,47.66908276,45.12403027,59.1,36.8,75.86911601,13.5,65.74986233,72.1,85.1,46.2,28,68.2,75.9,44.1
+1985,31.3796588,36.13334795,61.8,47.9098841,45.747782,59,35.7,75.92343971,13.5,65.79819852,70.8,85.3,46.5,27.5,69,75,43.8
+1986,31.19871923,37.24022346,62.1,48.30067763,46.53291505,60,34.7,76.14301516,13.9,65.98256091,71.2,85.7,46.7,28.4,69,75.7,44
+1987,31.48642948,38.73067535,61.7,50.20987789,46.69046648,60.2,32.4,76.96309168,14,66.70603055,72,85.5,46.5,30.4,70.1,76.4,43.9
+1988,31.08508746,39.3989071,61.7,50.09981147,46.7648277,60.4,30.8,77.62766177,13.9,67.14449816,72.3,85.2,46.2,29.7,70.9,75.6,44.4
+1989,31.6124031,39.09653994,62,50.77471585,46.7815648,60.5,29.9,78.11191872,14.1,67.01707156,72.4,84.6,46.2,31.3,71.6,76,44.2
+1990,32.70344407,40.82404662,62.6,50.81809432,47.20085084,60.8,29.4,78.86685859,14.1,66.92190193,71.2,83.9,47.3,31.6,72.6,77.6,45.1
+1991,34.71183749,33.67988118,62.1,51.46880537,47.22432481,60.8,28.7,78.99124597,14,66.24147465,71.1,83.5,47,32.6,73.2,78.2,45.5
+1992,33.93165961,35.20235628,61,51.34974154,47.21939541,59.7,28.2,78.43518191,14.5,65.62245655,71,83,47.4,32.6,73.2,77.3,45.8
+1993,34.94683208,35.77715877,60.2,51.12484404,47.63933161,58.7,28.5,77.26731199,14.9,65.73095014,70,82.4,46.4,33.6,73.1,78,46.1
+1994,36.03267447,34.43353129,59.4,52.2462176,47.98392441,58.1,28.5,75.81493264,15.7,65.64197772,69.1,81.8,47,34.8,72.9,78.8,46.8
+1995,36.84480747,36.06321839,59.2,52.59940342,48.57318101,58.8,27.5,75.12525621,16.2,65.93694921,69.6,81.5,46.1,35.9,73,78.8,47.9
+1996,38.96977475,35.9264854,58.6,53.78988011,48.6473926,58.7,27.1,75.03519921,16.7,66.43777883,69.7,81.3,46.4,37.3,73.9,79.8,48.7
+1997,40.68568483,35.10193413,58.7,54.99946903,48.56105033,60,26.8,75.1637013,17,66.78635548,70,81.9,47,38.3,74.4,81,49.2
+1998,41.91240333,37.59854457,59.1,56.35124789,49.2585152,60,27,75.48616027,17.8,67.2554484,70.1,82.1,48.3,39.7,75.1,81.3,50.5
+1999,42.88720191,38.63152919,59.2,58.22882288,49.81020815,61.2,28.1,75.83816206,18.6,67.82022113,70.9,83.5,47.8,40.2,76.5,81.1,51.2
+2000,45.05776637,40.02358491,59.2,59.38985737,49.80361649,61.9,27.7,76.69214284,18.4,68.36599498,70.9,83.5,48.2,41,77.5,81.1,51.8
+2001,45.86601517,40.69028156,59.4,60.71233149,50.27514494,63,27.6,77.37522931,19,68.57852029,71.2,85.1,47,42.2,77.5,80.9,51.7
+2002,47.13465821,41.13295053,60.9,61.8951284,50.5523346,63.7,27,78.64424394,18.7,68.82995959,70.5,85.8,45.7,41.1,77.7,81.3,51.5
+2003,47.93518721,42.75854266,61.1,62.1694558,50.34559774,64.6,25.1,78.54494815,18.8,68.89448726,70.6,86.5,46,41.7,77.8,81.5,50.9
+2004,47.88714025,43.46649345,61.3,61.91458697,49.95089449,64.2,22.2,78.65074774,18.2,68.45473436,70.8,86.5,44.7,42.1,77.8,80.7,50.5
+2005,47.67275409,43.10036784,61.4,61.50098432,49.79185139,63.4,20.6,79.06712173,17.9,68.57122114,69.9,86,45.1,41.6,77.5,81.2,50
+2006,46.79029957,44.49933107,61.6,60.17284465,49.21091439,63,18.6,78.68630551,16.8,68.29759443,69.6,85.9,44.1,40.8,77.4,81.2,49.8
+2007,47.60502633,43.10045895,61.4,59.41199314,49.00045935,62.5,17.6,78.72141311,16.8,67.87492278,70.2,85.4,44.1,40.7,77.1,82.1,49.3
+2008,47.570834,42.71173041,60.7,59.30576517,48.88802678,62.4,17.8,79.19632674,16.5,67.59402834,70.2,85.2,43.3,40.7,77.2,81.7,49.4
+2009,48.66722357,43.34892051,61,58.48958333,48.84047414,62.8,18.1,79.5329087,16.8,67.96979204,69.3,85.1,43.3,40.7,77.1,82,49.4
+2010,48.73004227,42.06672091,61.3,59.01025521,48.75798769,62.5,17.6,79.61862451,17.2,67.92810557,69,85,43.1,40.2,77,81.7,49.3
+2011,50.03718193,42.7734375,61.2,58.7423969,48.18041792,62.2,18.2,79.43281184,17.5,68.42673015,69.5,84.8,43.1,40.1,76.7,81.9,49.2
\ No newline at end of file
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/s1045.ima.gz b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/s1045.ima.gz
new file mode 100644
index 0000000..347db4c
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/s1045.ima.gz differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/topobathy.npz b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/topobathy.npz
new file mode 100644
index 0000000..9f9b085
Binary files /dev/null and b/venv/Lib/site-packages/matplotlib/mpl-data/sample_data/topobathy.npz differ
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/Solarize_Light2.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/Solarize_Light2.mplstyle
new file mode 100644
index 0000000..6c7aa7e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/Solarize_Light2.mplstyle
@@ -0,0 +1,53 @@
+# Solarized color palette taken from http://ethanschoonover.com/solarized
+# Inspired by, and copied from ggthemes https://github.com/jrnold/ggthemes
+
+#TODO:
+# 1. Padding to title from face
+# 2. Remove top & right ticks
+# 3. Give Title a Magenta Color(?)
+
+#base00 ='#657b83'
+#base01 ='#93a1a1'
+#base2 ='#eee8d5'
+#base3 ='#fdf6e3'
+#base01 ='#586e75'
+#Magenta ='#d33682'
+#Blue ='#268bd2'
+#cyan ='#2aa198'
+#violet ='#6c71c4'
+#green ='#859900'
+#orange ='#cb4b16'
+
+figure.facecolor : FDF6E3
+
+patch.antialiased : True
+
+lines.linewidth : 2.0
+lines.solid_capstyle: butt
+
+axes.titlesize : 16
+axes.labelsize : 12
+axes.labelcolor : 657b83
+axes.facecolor : eee8d5
+axes.edgecolor : eee8d5
+axes.axisbelow : True
+axes.prop_cycle : cycler('color', ['268BD2', '2AA198', '859900', 'B58900', 'CB4B16', 'DC322F', 'D33682', '6C71C4'])
+# Blue
+# Cyan
+# Green
+# Yellow
+# Orange
+# Red
+# Magenta
+# Violet
+axes.grid : True
+grid.color : fdf6e3 # grid color
+grid.linestyle : - # line
+grid.linewidth : 1 # in points
+
+### TICKS
+xtick.color : 657b83
+xtick.direction : out
+
+ytick.color : 657b83
+ytick.direction : out
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/_classic_test_patch.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/_classic_test_patch.mplstyle
new file mode 100644
index 0000000..96f62f4
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/_classic_test_patch.mplstyle
@@ -0,0 +1,6 @@
+# This patch should go on top of the "classic" style and exists solely to avoid
+# changing baseline images.
+
+text.kerning_factor : 6
+
+ytick.alignment: center_baseline
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/bmh.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/bmh.mplstyle
new file mode 100644
index 0000000..1b449cc
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/bmh.mplstyle
@@ -0,0 +1,29 @@
+#Author: Cameron Davidson-Pilon, original styles from Bayesian Methods for Hackers
+# https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/
+
+lines.linewidth : 2.0
+
+patch.linewidth: 0.5
+patch.facecolor: blue
+patch.edgecolor: eeeeee
+patch.antialiased: True
+
+text.hinting_factor : 8
+
+mathtext.fontset : cm
+
+axes.facecolor: eeeeee
+axes.edgecolor: bcbcbc
+axes.grid : True
+axes.titlesize: x-large
+axes.labelsize: large
+axes.prop_cycle: cycler('color', ['348ABD', 'A60628', '7A68A6', '467821', 'D55E00', 'CC79A7', '56B4E9', '009E73', 'F0E442', '0072B2'])
+
+grid.color: b2b2b2
+grid.linestyle: --
+grid.linewidth: 0.5
+
+legend.fancybox: True
+
+xtick.direction: in
+ytick.direction: in
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/classic.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/classic.mplstyle
new file mode 100644
index 0000000..2d7565e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/classic.mplstyle
@@ -0,0 +1,490 @@
+### Classic matplotlib plotting style as of v1.5
+
+
+### LINES
+# See http://matplotlib.org/api/artist_api.html#module-matplotlib.lines for more
+# information on line properties.
+lines.linewidth : 1.0 # line width in points
+lines.linestyle : - # solid line
+lines.color : b # has no affect on plot(); see axes.prop_cycle
+lines.marker : None # the default marker
+lines.markerfacecolor : auto # the default markerfacecolor
+lines.markeredgecolor : auto # the default markeredgecolor
+lines.markeredgewidth : 0.5 # the line width around the marker symbol
+lines.markersize : 6 # markersize, in points
+lines.dash_joinstyle : round # miter|round|bevel
+lines.dash_capstyle : butt # butt|round|projecting
+lines.solid_joinstyle : round # miter|round|bevel
+lines.solid_capstyle : projecting # butt|round|projecting
+lines.antialiased : True # render lines in antialiased (no jaggies)
+lines.dashed_pattern : 6, 6
+lines.dashdot_pattern : 3, 5, 1, 5
+lines.dotted_pattern : 1, 3
+lines.scale_dashes: False
+
+### Marker props
+markers.fillstyle: full
+
+### PATCHES
+# Patches are graphical objects that fill 2D space, like polygons or
+# circles. See
+# http://matplotlib.org/api/artist_api.html#module-matplotlib.patches
+# information on patch properties
+patch.linewidth : 1.0 # edge width in points
+patch.facecolor : b
+patch.force_edgecolor : True
+patch.edgecolor : k
+patch.antialiased : True # render patches in antialiased (no jaggies)
+
+hatch.color : k
+hatch.linewidth : 1.0
+
+hist.bins : 10
+
+### FONT
+#
+# font properties used by text.Text. See
+# http://matplotlib.org/api/font_manager_api.html for more
+# information on font properties. The 6 font properties used for font
+# matching are given below with their default values.
+#
+# The font.family property has five values: 'serif' (e.g., Times),
+# 'sans-serif' (e.g., Helvetica), 'cursive' (e.g., Zapf-Chancery),
+# 'fantasy' (e.g., Western), and 'monospace' (e.g., Courier). Each of
+# these font families has a default list of font names in decreasing
+# order of priority associated with them. When text.usetex is False,
+# font.family may also be one or more concrete font names.
+#
+# The font.style property has three values: normal (or roman), italic
+# or oblique. The oblique style will be used for italic, if it is not
+# present.
+#
+# The font.variant property has two values: normal or small-caps. For
+# TrueType fonts, which are scalable fonts, small-caps is equivalent
+# to using a font size of 'smaller', or about 83% of the current font
+# size.
+#
+# The font.weight property has effectively 13 values: normal, bold,
+# bolder, lighter, 100, 200, 300, ..., 900. Normal is the same as
+# 400, and bold is 700. bolder and lighter are relative values with
+# respect to the current weight.
+#
+# The font.stretch property has 11 values: ultra-condensed,
+# extra-condensed, condensed, semi-condensed, normal, semi-expanded,
+# expanded, extra-expanded, ultra-expanded, wider, and narrower. This
+# property is not currently implemented.
+#
+# The font.size property is the default font size for text, given in pts.
+# 12pt is the standard value.
+#
+font.family : sans-serif
+font.style : normal
+font.variant : normal
+font.weight : normal
+font.stretch : normal
+# note that font.size controls default text sizes. To configure
+# special text sizes tick labels, axes, labels, title, etc, see the rc
+# settings for axes and ticks. Special text sizes can be defined
+# relative to font.size, using the following values: xx-small, x-small,
+# small, medium, large, x-large, xx-large, larger, or smaller
+font.size : 12.0
+font.serif : DejaVu Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
+font.sans-serif: DejaVu Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
+font.cursive : Apple Chancery, Textile, Zapf Chancery, Sand, Script MT, Felipa, cursive
+font.fantasy : Comic Sans MS, Chicago, Charcoal, ImpactWestern, Humor Sans, fantasy
+font.monospace : DejaVu Sans Mono, Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace
+
+### TEXT
+# text properties used by text.Text. See
+# http://matplotlib.org/api/artist_api.html#module-matplotlib.text for more
+# information on text properties
+
+text.color : k
+
+### LaTeX customizations. See http://www.scipy.org/Wiki/Cookbook/Matplotlib/UsingTex
+text.usetex : False # use latex for all text handling. The following fonts
+ # are supported through the usual rc parameter settings:
+ # new century schoolbook, bookman, times, palatino,
+ # zapf chancery, charter, serif, sans-serif, helvetica,
+ # avant garde, courier, monospace, computer modern roman,
+ # computer modern sans serif, computer modern typewriter
+ # If another font is desired which can loaded using the
+ # LaTeX \usepackage command, please inquire at the
+ # matplotlib mailing list
+text.latex.preamble : # IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX FAILURES
+ # AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT ASK FOR HELP
+ # IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT TO.
+ # text.latex.preamble is a single line of LaTeX code that
+ # will be passed on to the LaTeX system. It may contain
+ # any code that is valid for the LaTeX "preamble", i.e.
+ # between the "\documentclass" and "\begin{document}"
+ # statements.
+ # Note that it has to be put on a single line, which may
+ # become quite long.
+ # The following packages are always loaded with usetex, so
+ # beware of package collisions: color, geometry, graphicx,
+ # type1cm, textcomp.
+ # Adobe Postscript (PSSNFS) font packages may also be
+ # loaded, depending on your font settings.
+
+text.hinting : auto # May be one of the following:
+ # 'none': Perform no hinting
+ # 'auto': Use freetype's autohinter
+ # 'native': Use the hinting information in the
+ # font file, if available, and if your
+ # freetype library supports it
+ # 'either': Use the native hinting information,
+ # or the autohinter if none is available.
+ # For backward compatibility, this value may also be
+ # True === 'auto' or False === 'none'.
+text.hinting_factor : 8 # Specifies the amount of softness for hinting in the
+ # horizontal direction. A value of 1 will hint to full
+ # pixels. A value of 2 will hint to half pixels etc.
+
+text.antialiased : True # If True (default), the text will be antialiased.
+ # This only affects the Agg backend.
+
+# The following settings allow you to select the fonts in math mode.
+# They map from a TeX font name to a fontconfig font pattern.
+# These settings are only used if mathtext.fontset is 'custom'.
+# Note that this "custom" mode is unsupported and may go away in the
+# future.
+mathtext.cal : cursive
+mathtext.rm : serif
+mathtext.tt : monospace
+mathtext.it : serif:italic
+mathtext.bf : serif:bold
+mathtext.sf : sans\-serif
+mathtext.fontset : cm # Should be 'cm' (Computer Modern), 'stix',
+ # 'stixsans' or 'custom'
+mathtext.fallback: cm # Select fallback font from ['cm' (Computer Modern), 'stix'
+ # 'stixsans'] when a symbol can not be found in one of the
+ # custom math fonts. Select 'None' to not perform fallback
+ # and replace the missing character by a dummy.
+
+mathtext.default : it # The default font to use for math.
+ # Can be any of the LaTeX font names, including
+ # the special name "regular" for the same font
+ # used in regular text.
+
+### AXES
+# default face and edge color, default tick sizes,
+# default fontsizes for ticklabels, and so on. See
+# http://matplotlib.org/api/axes_api.html#module-matplotlib.axes
+axes.facecolor : w # axes background color
+axes.edgecolor : k # axes edge color
+axes.linewidth : 1.0 # edge linewidth
+axes.grid : False # display grid or not
+axes.grid.which : major
+axes.grid.axis : both
+axes.titlesize : large # fontsize of the axes title
+axes.titley : 1.0 # at the top, no autopositioning.
+axes.titlepad : 5.0 # pad between axes and title in points
+axes.titleweight : normal # font weight for axes title
+axes.labelsize : medium # fontsize of the x any y labels
+axes.labelpad : 5.0 # space between label and axis
+axes.labelweight : normal # weight of the x and y labels
+axes.labelcolor : k
+axes.axisbelow : False # whether axis gridlines and ticks are below
+ # the axes elements (lines, text, etc)
+
+axes.formatter.limits : -7, 7 # use scientific notation if log10
+ # of the axis range is smaller than the
+ # first or larger than the second
+axes.formatter.use_locale : False # When True, format tick labels
+ # according to the user's locale.
+ # For example, use ',' as a decimal
+ # separator in the fr_FR locale.
+axes.formatter.use_mathtext : False # When True, use mathtext for scientific
+ # notation.
+axes.formatter.useoffset : True # If True, the tick label formatter
+ # will default to labeling ticks relative
+ # to an offset when the data range is very
+ # small compared to the minimum absolute
+ # value of the data.
+axes.formatter.offset_threshold : 2 # When useoffset is True, the offset
+ # will be used when it can remove
+ # at least this number of significant
+ # digits from tick labels.
+
+axes.unicode_minus : True # use unicode for the minus symbol
+ # rather than hyphen. See
+ # http://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes
+axes.prop_cycle : cycler('color', 'bgrcmyk')
+ # color cycle for plot lines
+ # as list of string colorspecs:
+ # single letter, long name, or
+ # web-style hex
+axes.autolimit_mode : round_numbers
+axes.xmargin : 0 # x margin. See `axes.Axes.margins`
+axes.ymargin : 0 # y margin See `axes.Axes.margins`
+axes.spines.bottom : True
+axes.spines.left : True
+axes.spines.right : True
+axes.spines.top : True
+polaraxes.grid : True # display grid on polar axes
+axes3d.grid : True # display grid on 3d axes
+
+date.autoformatter.year : %Y
+date.autoformatter.month : %b %Y
+date.autoformatter.day : %b %d %Y
+date.autoformatter.hour : %H:%M:%S
+date.autoformatter.minute : %H:%M:%S.%f
+date.autoformatter.second : %H:%M:%S.%f
+date.autoformatter.microsecond : %H:%M:%S.%f
+date.converter: auto # 'auto', 'concise'
+
+### TICKS
+# see http://matplotlib.org/api/axis_api.html#matplotlib.axis.Tick
+
+xtick.top : True # draw ticks on the top side
+xtick.bottom : True # draw ticks on the bottom side
+xtick.major.size : 4 # major tick size in points
+xtick.minor.size : 2 # minor tick size in points
+xtick.minor.visible : False
+xtick.major.width : 0.5 # major tick width in points
+xtick.minor.width : 0.5 # minor tick width in points
+xtick.major.pad : 4 # distance to major tick label in points
+xtick.minor.pad : 4 # distance to the minor tick label in points
+xtick.color : k # color of the tick labels
+xtick.labelsize : medium # fontsize of the tick labels
+xtick.direction : in # direction: in, out, or inout
+xtick.major.top : True # draw x axis top major ticks
+xtick.major.bottom : True # draw x axis bottom major ticks
+xtick.minor.top : True # draw x axis top minor ticks
+xtick.minor.bottom : True # draw x axis bottom minor ticks
+xtick.alignment : center
+
+ytick.left : True # draw ticks on the left side
+ytick.right : True # draw ticks on the right side
+ytick.major.size : 4 # major tick size in points
+ytick.minor.size : 2 # minor tick size in points
+ytick.minor.visible : False
+ytick.major.width : 0.5 # major tick width in points
+ytick.minor.width : 0.5 # minor tick width in points
+ytick.major.pad : 4 # distance to major tick label in points
+ytick.minor.pad : 4 # distance to the minor tick label in points
+ytick.color : k # color of the tick labels
+ytick.labelsize : medium # fontsize of the tick labels
+ytick.direction : in # direction: in, out, or inout
+ytick.major.left : True # draw y axis left major ticks
+ytick.major.right : True # draw y axis right major ticks
+ytick.minor.left : True # draw y axis left minor ticks
+ytick.minor.right : True # draw y axis right minor ticks
+ytick.alignment : center
+
+### GRIDS
+grid.color : k # grid color
+grid.linestyle : : # dotted
+grid.linewidth : 0.5 # in points
+grid.alpha : 1.0 # transparency, between 0.0 and 1.0
+
+### Legend
+legend.fancybox : False # if True, use a rounded box for the
+ # legend, else a rectangle
+legend.loc : upper right
+legend.numpoints : 2 # the number of points in the legend line
+legend.fontsize : large
+legend.borderpad : 0.4 # border whitespace in fontsize units
+legend.markerscale : 1.0 # the relative size of legend markers vs. original
+# the following dimensions are in axes coords
+legend.labelspacing : 0.5 # the vertical space between the legend entries in fraction of fontsize
+legend.handlelength : 2. # the length of the legend lines in fraction of fontsize
+legend.handleheight : 0.7 # the height of the legend handle in fraction of fontsize
+legend.handletextpad : 0.8 # the space between the legend line and legend text in fraction of fontsize
+legend.borderaxespad : 0.5 # the border between the axes and legend edge in fraction of fontsize
+legend.columnspacing : 2. # the border between the axes and legend edge in fraction of fontsize
+legend.shadow : False
+legend.frameon : True # whether or not to draw a frame around legend
+legend.framealpha : None # opacity of legend frame
+legend.scatterpoints : 3 # number of scatter points
+legend.facecolor : inherit # legend background color (when 'inherit' uses axes.facecolor)
+legend.edgecolor : inherit # legend edge color (when 'inherit' uses axes.edgecolor)
+
+
+
+### FIGURE
+# See http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure
+figure.titlesize : medium # size of the figure title
+figure.titleweight : normal # weight of the figure title
+figure.figsize : 8, 6 # figure size in inches
+figure.dpi : 80 # figure dots per inch
+figure.facecolor : 0.75 # figure facecolor; 0.75 is scalar gray
+figure.edgecolor : w # figure edgecolor
+figure.autolayout : False # When True, automatically adjust subplot
+ # parameters to make the plot fit the figure
+figure.frameon : True
+
+# The figure subplot parameters. All dimensions are a fraction of the
+# figure width or height
+figure.subplot.left : 0.125 # the left side of the subplots of the figure
+figure.subplot.right : 0.9 # the right side of the subplots of the figure
+figure.subplot.bottom : 0.1 # the bottom of the subplots of the figure
+figure.subplot.top : 0.9 # the top of the subplots of the figure
+figure.subplot.wspace : 0.2 # the amount of width reserved for space between subplots,
+ # expressed as a fraction of the average axis width
+figure.subplot.hspace : 0.2 # the amount of height reserved for space between subplots,
+ # expressed as a fraction of the average axis height
+
+### IMAGES
+image.aspect : equal # equal | auto | a number
+image.interpolation : bilinear # see help(imshow) for options
+image.cmap : jet # gray | jet etc...
+image.lut : 256 # the size of the colormap lookup table
+image.origin : upper # lower | upper
+image.resample : False
+image.composite_image : True
+
+### CONTOUR PLOTS
+contour.negative_linestyle : dashed # dashed | solid
+contour.corner_mask : True
+
+# errorbar props
+errorbar.capsize: 3
+
+# scatter props
+scatter.marker: o
+
+### Boxplots
+boxplot.bootstrap: None
+boxplot.boxprops.color: b
+boxplot.boxprops.linestyle: -
+boxplot.boxprops.linewidth: 1.0
+boxplot.capprops.color: k
+boxplot.capprops.linestyle: -
+boxplot.capprops.linewidth: 1.0
+boxplot.flierprops.color: b
+boxplot.flierprops.linestyle: none
+boxplot.flierprops.linewidth: 1.0
+boxplot.flierprops.marker: +
+boxplot.flierprops.markeredgecolor: k
+boxplot.flierprops.markerfacecolor: auto
+boxplot.flierprops.markersize: 6.0
+boxplot.meanline: False
+boxplot.meanprops.color: r
+boxplot.meanprops.linestyle: -
+boxplot.meanprops.linewidth: 1.0
+boxplot.medianprops.color: r
+boxplot.meanprops.marker: s
+boxplot.meanprops.markerfacecolor: r
+boxplot.meanprops.markeredgecolor: k
+boxplot.meanprops.markersize: 6.0
+boxplot.medianprops.linestyle: -
+boxplot.medianprops.linewidth: 1.0
+boxplot.notch: False
+boxplot.patchartist: False
+boxplot.showbox: True
+boxplot.showcaps: True
+boxplot.showfliers: True
+boxplot.showmeans: False
+boxplot.vertical: True
+boxplot.whiskerprops.color: b
+boxplot.whiskerprops.linestyle: --
+boxplot.whiskerprops.linewidth: 1.0
+boxplot.whiskers: 1.5
+
+### Agg rendering
+### Warning: experimental, 2008/10/10
+agg.path.chunksize : 0 # 0 to disable; values in the range
+ # 10000 to 100000 can improve speed slightly
+ # and prevent an Agg rendering failure
+ # when plotting very large data sets,
+ # especially if they are very gappy.
+ # It may cause minor artifacts, though.
+ # A value of 20000 is probably a good
+ # starting point.
+### SAVING FIGURES
+path.simplify : True # When True, simplify paths by removing "invisible"
+ # points to reduce file size and increase rendering
+ # speed
+path.simplify_threshold : 0.1111111111111111
+ # The threshold of similarity below which
+ # vertices will be removed in the simplification
+ # process
+path.snap : True # When True, rectilinear axis-aligned paths will be snapped to
+ # the nearest pixel when certain criteria are met. When False,
+ # paths will never be snapped.
+path.sketch : None # May be none, or a 3-tuple of the form (scale, length,
+ # randomness).
+ # *scale* is the amplitude of the wiggle
+ # perpendicular to the line (in pixels). *length*
+ # is the length of the wiggle along the line (in
+ # pixels). *randomness* is the factor by which
+ # the length is randomly scaled.
+
+# the default savefig params can be different from the display params
+# e.g., you may want a higher resolution, or to make the figure
+# background white
+savefig.dpi : 100 # figure dots per inch
+savefig.facecolor : w # figure facecolor when saving
+savefig.edgecolor : w # figure edgecolor when saving
+savefig.format : png # png, ps, pdf, svg
+savefig.bbox : standard # 'tight' or 'standard'.
+ # 'tight' is incompatible with pipe-based animation
+ # backends (e.g. 'ffmpeg') but will work with those
+ # based on temporary files (e.g. 'ffmpeg_file')
+savefig.pad_inches : 0.1 # Padding to be used when bbox is set to 'tight'
+savefig.transparent : False # setting that controls whether figures are saved with a
+ # transparent background by default
+savefig.orientation : portrait
+
+# ps backend params
+ps.papersize : letter # auto, letter, legal, ledger, A0-A10, B0-B10
+ps.useafm : False # use of afm fonts, results in small files
+ps.usedistiller : False # can be: None, ghostscript or xpdf
+ # Experimental: may produce smaller files.
+ # xpdf intended for production of publication quality files,
+ # but requires ghostscript, xpdf and ps2eps
+ps.distiller.res : 6000 # dpi
+ps.fonttype : 3 # Output Type 3 (Type3) or Type 42 (TrueType)
+
+# pdf backend params
+pdf.compression : 6 # integer from 0 to 9
+ # 0 disables compression (good for debugging)
+pdf.fonttype : 3 # Output Type 3 (Type3) or Type 42 (TrueType)
+pdf.inheritcolor : False
+pdf.use14corefonts : False
+
+# pgf backend params
+pgf.texsystem : xelatex
+pgf.rcfonts : True
+pgf.preamble :
+
+# svg backend params
+svg.image_inline : True # write raster image data directly into the svg file
+svg.fonttype : path # How to handle SVG fonts:
+# 'none': Assume fonts are installed on the machine where the SVG will be viewed.
+# 'path': Embed characters as paths -- supported by most SVG renderers
+
+# Event keys to interact with figures/plots via keyboard.
+# Customize these settings according to your needs.
+# Leave the field(s) empty if you don't need a key-map. (i.e., fullscreen : '')
+
+keymap.fullscreen : f, ctrl+f # toggling
+keymap.home : h, r, home # home or reset mnemonic
+keymap.back : left, c, backspace # forward / backward keys to enable
+keymap.forward : right, v # left handed quick navigation
+keymap.pan : p # pan mnemonic
+keymap.zoom : o # zoom mnemonic
+keymap.save : s, ctrl+s # saving current figure
+keymap.quit : ctrl+w, cmd+w # close the current figure
+keymap.grid : g # switching on/off a grid in current axes
+keymap.yscale : l # toggle scaling of y-axes ('log'/'linear')
+keymap.xscale : k, L # toggle scaling of x-axes ('log'/'linear')
+
+###ANIMATION settings
+animation.writer : ffmpeg # MovieWriter 'backend' to use
+animation.codec : mpeg4 # Codec to use for writing movie
+animation.bitrate: -1 # Controls size/quality tradeoff for movie.
+ # -1 implies let utility auto-determine
+animation.frame_format: png # Controls frame format used by temp files
+animation.ffmpeg_path: ffmpeg # Path to ffmpeg binary. Without full path
+ # $PATH is searched
+animation.ffmpeg_args: # Additional arguments to pass to ffmpeg
+animation.convert_path: convert # Path to ImageMagick's convert binary.
+ # On Windows use the full path since convert
+ # is also the name of a system tool.
+animation.convert_args:
+animation.html: none
+
+_internal.classic_mode: True
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/dark_background.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/dark_background.mplstyle
new file mode 100644
index 0000000..c4b7741
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/dark_background.mplstyle
@@ -0,0 +1,29 @@
+# Set black background default line colors to white.
+
+lines.color: white
+patch.edgecolor: white
+
+text.color: white
+
+axes.facecolor: black
+axes.edgecolor: white
+axes.labelcolor: white
+axes.prop_cycle: cycler('color', ['8dd3c7', 'feffb3', 'bfbbd9', 'fa8174', '81b1d2', 'fdb462', 'b3de69', 'bc82bd', 'ccebc4', 'ffed6f'])
+
+xtick.color: white
+ytick.color: white
+
+grid.color: white
+
+figure.facecolor: black
+figure.edgecolor: black
+
+savefig.facecolor: black
+savefig.edgecolor: black
+
+### Boxplots
+boxplot.boxprops.color: white
+boxplot.capprops.color: white
+boxplot.flierprops.color: white
+boxplot.flierprops.markeredgecolor: white
+boxplot.whiskerprops.color: white
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/fast.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/fast.mplstyle
new file mode 100644
index 0000000..1f7be7d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/fast.mplstyle
@@ -0,0 +1,11 @@
+# a small set of changes that will make your plotting FAST (1).
+#
+# (1) in some cases
+
+# Maximally simplify lines.
+path.simplify: True
+path.simplify_threshold: 1.0
+
+# chunk up large lines into smaller lines!
+# simple trick to avoid those pesky O(>n) algorithms!
+agg.path.chunksize: 10000
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/fivethirtyeight.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/fivethirtyeight.mplstyle
new file mode 100644
index 0000000..738db39
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/fivethirtyeight.mplstyle
@@ -0,0 +1,40 @@
+#Author: Cameron Davidson-Pilon, replicated styles from FiveThirtyEight.com
+# See https://www.dataorigami.net/blogs/fivethirtyeight-mpl
+
+lines.linewidth: 4
+lines.solid_capstyle: butt
+
+legend.fancybox: true
+
+axes.prop_cycle: cycler('color', ['008fd5', 'fc4f30', 'e5ae38', '6d904f', '8b8b8b', '810f7c'])
+axes.facecolor: f0f0f0
+axes.labelsize: large
+axes.axisbelow: true
+axes.grid: true
+axes.edgecolor: f0f0f0
+axes.linewidth: 3.0
+axes.titlesize: x-large
+
+patch.edgecolor: f0f0f0
+patch.linewidth: 0.5
+
+svg.fonttype: path
+
+grid.linestyle: -
+grid.linewidth: 1.0
+grid.color: cbcbcb
+
+xtick.major.size: 0
+xtick.minor.size: 0
+ytick.major.size: 0
+ytick.minor.size: 0
+
+font.size:14.0
+
+savefig.edgecolor: f0f0f0
+savefig.facecolor: f0f0f0
+
+figure.subplot.left: 0.08
+figure.subplot.right: 0.95
+figure.subplot.bottom: 0.07
+figure.facecolor: f0f0f0
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/ggplot.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/ggplot.mplstyle
new file mode 100644
index 0000000..67afd83
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/ggplot.mplstyle
@@ -0,0 +1,39 @@
+# from http://www.huyng.com/posts/sane-color-scheme-for-matplotlib/
+
+patch.linewidth: 0.5
+patch.facecolor: 348ABD # blue
+patch.edgecolor: EEEEEE
+patch.antialiased: True
+
+font.size: 10.0
+
+axes.facecolor: E5E5E5
+axes.edgecolor: white
+axes.linewidth: 1
+axes.grid: True
+axes.titlesize: x-large
+axes.labelsize: large
+axes.labelcolor: 555555
+axes.axisbelow: True # grid/ticks are below elements (e.g., lines, text)
+
+axes.prop_cycle: cycler('color', ['E24A33', '348ABD', '988ED5', '777777', 'FBC15E', '8EBA42', 'FFB5B8'])
+ # E24A33 : red
+ # 348ABD : blue
+ # 988ED5 : purple
+ # 777777 : gray
+ # FBC15E : yellow
+ # 8EBA42 : green
+ # FFB5B8 : pink
+
+xtick.color: 555555
+xtick.direction: out
+
+ytick.color: 555555
+ytick.direction: out
+
+grid.color: white
+grid.linestyle: - # solid line
+
+figure.facecolor: white
+figure.edgecolor: 0.50
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/grayscale.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/grayscale.mplstyle
new file mode 100644
index 0000000..6a1114e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/grayscale.mplstyle
@@ -0,0 +1,29 @@
+# Set all colors to grayscale
+# Note: strings of float values are interpreted by matplotlib as gray values.
+
+
+lines.color: black
+patch.facecolor: gray
+patch.edgecolor: black
+
+text.color: black
+
+axes.facecolor: white
+axes.edgecolor: black
+axes.labelcolor: black
+# black to light gray
+axes.prop_cycle: cycler('color', ['0.00', '0.40', '0.60', '0.70'])
+
+xtick.color: black
+ytick.color: black
+
+grid.color: black
+
+figure.facecolor: 0.75
+figure.edgecolor: white
+
+image.cmap: gray
+
+savefig.facecolor: white
+savefig.edgecolor: white
+
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-bright.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-bright.mplstyle
new file mode 100644
index 0000000..5e9e949
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-bright.mplstyle
@@ -0,0 +1,3 @@
+# Seaborn bright palette
+axes.prop_cycle: cycler('color', ['003FFF', '03ED3A', 'E8000B', '8A2BE2', 'FFC400', '00D7FF'])
+patch.facecolor: 003FFF
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-colorblind.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-colorblind.mplstyle
new file mode 100644
index 0000000..e13b7aa
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-colorblind.mplstyle
@@ -0,0 +1,3 @@
+# Seaborn colorblind palette
+axes.prop_cycle: cycler('color', ['0072B2', '009E73', 'D55E00', 'CC79A7', 'F0E442', '56B4E9'])
+patch.facecolor: 0072B2
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-dark-palette.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-dark-palette.mplstyle
new file mode 100644
index 0000000..30160ae
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-dark-palette.mplstyle
@@ -0,0 +1,3 @@
+# Seaborn dark palette
+axes.prop_cycle: cycler('color', ['001C7F', '017517', '8C0900', '7600A1', 'B8860B', '006374'])
+patch.facecolor: 001C7F
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-dark.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-dark.mplstyle
new file mode 100644
index 0000000..55b50b5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-dark.mplstyle
@@ -0,0 +1,30 @@
+# Seaborn common parameters
+# .15 = dark_gray
+# .8 = light_gray
+figure.facecolor: white
+text.color: .15
+axes.labelcolor: .15
+legend.frameon: False
+legend.numpoints: 1
+legend.scatterpoints: 1
+xtick.direction: out
+ytick.direction: out
+xtick.color: .15
+ytick.color: .15
+axes.axisbelow: True
+image.cmap: Greys
+font.family: sans-serif
+font.sans-serif: Arial, Liberation Sans, DejaVu Sans, Bitstream Vera Sans, sans-serif
+grid.linestyle: -
+lines.solid_capstyle: round
+
+# Seaborn dark parameters
+axes.grid: False
+axes.facecolor: EAEAF2
+axes.edgecolor: white
+axes.linewidth: 0
+grid.color: white
+xtick.major.size: 0
+ytick.major.size: 0
+xtick.minor.size: 0
+ytick.minor.size: 0
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-darkgrid.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-darkgrid.mplstyle
new file mode 100644
index 0000000..0f5d955
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-darkgrid.mplstyle
@@ -0,0 +1,30 @@
+# Seaborn common parameters
+# .15 = dark_gray
+# .8 = light_gray
+figure.facecolor: white
+text.color: .15
+axes.labelcolor: .15
+legend.frameon: False
+legend.numpoints: 1
+legend.scatterpoints: 1
+xtick.direction: out
+ytick.direction: out
+xtick.color: .15
+ytick.color: .15
+axes.axisbelow: True
+image.cmap: Greys
+font.family: sans-serif
+font.sans-serif: Arial, Liberation Sans, DejaVu Sans, Bitstream Vera Sans, sans-serif
+grid.linestyle: -
+lines.solid_capstyle: round
+
+# Seaborn darkgrid parameters
+axes.grid: True
+axes.facecolor: EAEAF2
+axes.edgecolor: white
+axes.linewidth: 0
+grid.color: white
+xtick.major.size: 0
+ytick.major.size: 0
+xtick.minor.size: 0
+ytick.minor.size: 0
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-deep.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-deep.mplstyle
new file mode 100644
index 0000000..5d6b7c5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-deep.mplstyle
@@ -0,0 +1,3 @@
+# Seaborn deep palette
+axes.prop_cycle: cycler('color', ['4C72B0', '55A868', 'C44E52', '8172B2', 'CCB974', '64B5CD'])
+patch.facecolor: 4C72B0
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-muted.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-muted.mplstyle
new file mode 100644
index 0000000..4a71646
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-muted.mplstyle
@@ -0,0 +1,3 @@
+# Seaborn muted palette
+axes.prop_cycle: cycler('color', ['4878CF', '6ACC65', 'D65F5F', 'B47CC7', 'C4AD66', '77BEDB'])
+patch.facecolor: 4878CF
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-notebook.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-notebook.mplstyle
new file mode 100644
index 0000000..18bcf3e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-notebook.mplstyle
@@ -0,0 +1,21 @@
+# Seaborn notebook context
+figure.figsize: 8.0, 5.5
+axes.labelsize: 11
+axes.titlesize: 12
+xtick.labelsize: 10
+ytick.labelsize: 10
+legend.fontsize: 10
+
+grid.linewidth: 1
+lines.linewidth: 1.75
+patch.linewidth: .3
+lines.markersize: 7
+lines.markeredgewidth: 0
+
+xtick.major.width: 1
+ytick.major.width: 1
+xtick.minor.width: .5
+ytick.minor.width: .5
+
+xtick.major.pad: 7
+ytick.major.pad: 7
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-paper.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-paper.mplstyle
new file mode 100644
index 0000000..3326be4
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-paper.mplstyle
@@ -0,0 +1,21 @@
+# Seaborn paper context
+figure.figsize: 6.4, 4.4
+axes.labelsize: 8.8
+axes.titlesize: 9.6
+xtick.labelsize: 8
+ytick.labelsize: 8
+legend.fontsize: 8
+
+grid.linewidth: 0.8
+lines.linewidth: 1.4
+patch.linewidth: 0.24
+lines.markersize: 5.6
+lines.markeredgewidth: 0
+
+xtick.major.width: 0.8
+ytick.major.width: 0.8
+xtick.minor.width: 0.4
+ytick.minor.width: 0.4
+
+xtick.major.pad: 5.6
+ytick.major.pad: 5.6
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-pastel.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-pastel.mplstyle
new file mode 100644
index 0000000..dff6748
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-pastel.mplstyle
@@ -0,0 +1,3 @@
+# Seaborn pastel palette
+axes.prop_cycle: cycler('color', ['92C6FF', '97F0AA', 'FF9F9A', 'D0BBFF', 'FFFEA3', 'B0E0E6'])
+patch.facecolor: 92C6FF
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-poster.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-poster.mplstyle
new file mode 100644
index 0000000..47f2370
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-poster.mplstyle
@@ -0,0 +1,21 @@
+# Seaborn poster context
+figure.figsize: 12.8, 8.8
+axes.labelsize: 17.6
+axes.titlesize: 19.2
+xtick.labelsize: 16
+ytick.labelsize: 16
+legend.fontsize: 16
+
+grid.linewidth: 1.6
+lines.linewidth: 2.8
+patch.linewidth: 0.48
+lines.markersize: 11.2
+lines.markeredgewidth: 0
+
+xtick.major.width: 1.6
+ytick.major.width: 1.6
+xtick.minor.width: 0.8
+ytick.minor.width: 0.8
+
+xtick.major.pad: 11.2
+ytick.major.pad: 11.2
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-talk.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-talk.mplstyle
new file mode 100644
index 0000000..29a77c5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-talk.mplstyle
@@ -0,0 +1,21 @@
+# Seaborn talk context
+figure.figsize: 10.4, 7.15
+axes.labelsize: 14.3
+axes.titlesize: 15.6
+xtick.labelsize: 13
+ytick.labelsize: 13
+legend.fontsize: 13
+
+grid.linewidth: 1.3
+lines.linewidth: 2.275
+patch.linewidth: 0.39
+lines.markersize: 9.1
+lines.markeredgewidth: 0
+
+xtick.major.width: 1.3
+ytick.major.width: 1.3
+xtick.minor.width: 0.65
+ytick.minor.width: 0.65
+
+xtick.major.pad: 9.1
+ytick.major.pad: 9.1
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-ticks.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-ticks.mplstyle
new file mode 100644
index 0000000..c2a1cab
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-ticks.mplstyle
@@ -0,0 +1,30 @@
+# Seaborn common parameters
+# .15 = dark_gray
+# .8 = light_gray
+figure.facecolor: white
+text.color: .15
+axes.labelcolor: .15
+legend.frameon: False
+legend.numpoints: 1
+legend.scatterpoints: 1
+xtick.direction: out
+ytick.direction: out
+xtick.color: .15
+ytick.color: .15
+axes.axisbelow: True
+image.cmap: Greys
+font.family: sans-serif
+font.sans-serif: Arial, Liberation Sans, DejaVu Sans, Bitstream Vera Sans, sans-serif
+grid.linestyle: -
+lines.solid_capstyle: round
+
+# Seaborn white parameters
+axes.grid: False
+axes.facecolor: white
+axes.edgecolor: .15
+axes.linewidth: 1.25
+grid.color: .8
+xtick.major.size: 6
+ytick.major.size: 6
+xtick.minor.size: 3
+ytick.minor.size: 3
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-white.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-white.mplstyle
new file mode 100644
index 0000000..dcbe3ac
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-white.mplstyle
@@ -0,0 +1,30 @@
+# Seaborn common parameters
+# .15 = dark_gray
+# .8 = light_gray
+figure.facecolor: white
+text.color: .15
+axes.labelcolor: .15
+legend.frameon: False
+legend.numpoints: 1
+legend.scatterpoints: 1
+xtick.direction: out
+ytick.direction: out
+xtick.color: .15
+ytick.color: .15
+axes.axisbelow: True
+image.cmap: Greys
+font.family: sans-serif
+font.sans-serif: Arial, Liberation Sans, DejaVu Sans, Bitstream Vera Sans, sans-serif
+grid.linestyle: -
+lines.solid_capstyle: round
+
+# Seaborn white parameters
+axes.grid: False
+axes.facecolor: white
+axes.edgecolor: .15
+axes.linewidth: 1.25
+grid.color: .8
+xtick.major.size: 0
+ytick.major.size: 0
+xtick.minor.size: 0
+ytick.minor.size: 0
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-whitegrid.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-whitegrid.mplstyle
new file mode 100644
index 0000000..612e218
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn-whitegrid.mplstyle
@@ -0,0 +1,30 @@
+# Seaborn common parameters
+# .15 = dark_gray
+# .8 = light_gray
+figure.facecolor: white
+text.color: .15
+axes.labelcolor: .15
+legend.frameon: False
+legend.numpoints: 1
+legend.scatterpoints: 1
+xtick.direction: out
+ytick.direction: out
+xtick.color: .15
+ytick.color: .15
+axes.axisbelow: True
+image.cmap: Greys
+font.family: sans-serif
+font.sans-serif: Arial, Liberation Sans, DejaVu Sans, Bitstream Vera Sans, sans-serif
+grid.linestyle: -
+lines.solid_capstyle: round
+
+# Seaborn whitegrid parameters
+axes.grid: True
+axes.facecolor: white
+axes.edgecolor: .8
+axes.linewidth: 1
+grid.color: .8
+xtick.major.size: 0
+ytick.major.size: 0
+xtick.minor.size: 0
+ytick.minor.size: 0
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn.mplstyle
new file mode 100644
index 0000000..94b1bc8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/seaborn.mplstyle
@@ -0,0 +1,57 @@
+# default seaborn aesthetic
+# darkgrid + deep palette + notebook context
+
+axes.axisbelow: True
+axes.edgecolor: white
+axes.facecolor: EAEAF2
+axes.grid: True
+axes.labelcolor: .15
+axes.labelsize: 11
+axes.linewidth: 0
+axes.prop_cycle: cycler('color', ['4C72B0', '55A868', 'C44E52', '8172B2', 'CCB974', '64B5CD'])
+axes.titlesize: 12
+
+figure.facecolor: white
+figure.figsize: 8.0, 5.5
+
+font.family: sans-serif
+font.sans-serif: Arial, Liberation Sans, DejaVu Sans, Bitstream Vera Sans, sans-serif
+
+grid.color: white
+grid.linestyle: -
+grid.linewidth: 1
+
+image.cmap: Greys
+
+legend.fontsize: 10
+legend.frameon: False
+legend.numpoints: 1
+legend.scatterpoints: 1
+
+lines.linewidth: 1.75
+lines.markeredgewidth: 0
+lines.markersize: 7
+lines.solid_capstyle: round
+
+patch.facecolor: 4C72B0
+patch.linewidth: .3
+
+text.color: .15
+
+xtick.color: .15
+xtick.direction: out
+xtick.labelsize: 10
+xtick.major.pad: 7
+xtick.major.size: 0
+xtick.major.width: 1
+xtick.minor.size: 0
+xtick.minor.width: .5
+
+ytick.color: .15
+ytick.direction: out
+ytick.labelsize: 10
+ytick.major.pad: 7
+ytick.major.size: 0
+ytick.major.width: 1
+ytick.minor.size: 0
+ytick.minor.width: .5
diff --git a/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/tableau-colorblind10.mplstyle b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/tableau-colorblind10.mplstyle
new file mode 100644
index 0000000..2d8cb02
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/mpl-data/stylelib/tableau-colorblind10.mplstyle
@@ -0,0 +1,3 @@
+# Tableau colorblind 10 palette
+axes.prop_cycle: cycler('color', ['006BA4', 'FF800E', 'ABABAB', '595959', '5F9ED1', 'C85200', '898989', 'A2C8EC', 'FFBC79', 'CFCFCF'])
+patch.facecolor: 006BA4
\ No newline at end of file
diff --git a/venv/Lib/site-packages/matplotlib/offsetbox.py b/venv/Lib/site-packages/matplotlib/offsetbox.py
new file mode 100644
index 0000000..37d2295
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/offsetbox.py
@@ -0,0 +1,1757 @@
+r"""
+Container classes for `.Artist`\s.
+
+`OffsetBox`
+ The base of all container artists defined in this module.
+
+`AnchoredOffsetbox`, `AnchoredText`
+ Anchor and align an arbitrary `.Artist` or a text relative to the parent
+ axes or a specific anchor point.
+
+`DrawingArea`
+ A container with fixed width and height. Children have a fixed position
+ inside the container and may be clipped.
+
+`HPacker`, `VPacker`
+ Containers for layouting their children vertically or horizontally.
+
+`PaddedBox`
+ A container to add a padding around an `.Artist`.
+
+`TextArea`
+ Contains a single `.Text` instance.
+"""
+
+import numpy as np
+
+from matplotlib import _api, docstring, rcParams
+import matplotlib.artist as martist
+import matplotlib.path as mpath
+import matplotlib.text as mtext
+import matplotlib.transforms as mtransforms
+from matplotlib.font_manager import FontProperties
+from matplotlib.image import BboxImage
+from matplotlib.patches import (
+ FancyBboxPatch, FancyArrowPatch, bbox_artist as mbbox_artist)
+from matplotlib.transforms import Bbox, BboxBase, TransformedBbox
+
+
+DEBUG = False
+
+
+# for debugging use
+def bbox_artist(*args, **kwargs):
+ if DEBUG:
+ mbbox_artist(*args, **kwargs)
+
+
+def _get_packed_offsets(wd_list, total, sep, mode="fixed"):
+ r"""
+ Pack boxes specified by their ``(width, xdescent)`` pair.
+
+ For simplicity of the description, the terminology used here assumes a
+ horizontal layout, but the function works equally for a vertical layout.
+
+ *xdescent* is analogous to the usual descent, but along the x-direction; it
+ is currently ignored.
+
+ There are three packing *mode*\s:
+
+ - 'fixed': The elements are packed tight to the left with a spacing of
+ *sep* in between. If *total* is *None* the returned total will be the
+ right edge of the last box. A non-*None* total will be passed unchecked
+ to the output. In particular this means that right edge of the last
+ box may be further to the right than the returned total.
+
+ - 'expand': Distribute the boxes with equal spacing so that the left edge
+ of the first box is at 0, and the right edge of the last box is at
+ *total*. The parameter *sep* is ignored in this mode. A total of *None*
+ is accepted and considered equal to 1. The total is returned unchanged
+ (except for the conversion *None* to 1). If the total is smaller than
+ the sum of the widths, the laid out boxes will overlap.
+
+ - 'equal': If *total* is given, the total space is divided in N equal
+ ranges and each box is left-aligned within its subspace.
+ Otherwise (*total* is *None*), *sep* must be provided and each box is
+ left-aligned in its subspace of width ``(max(widths) + sep)``. The
+ total width is then calculated to be ``N * (max(widths) + sep)``.
+
+ Parameters
+ ----------
+ wd_list : list of (float, float)
+ (width, xdescent) of boxes to be packed.
+ total : float or None
+ Intended total length. *None* if not used.
+ sep : float
+ Spacing between boxes.
+ mode : {'fixed', 'expand', 'equal'}
+ The packing mode.
+
+ Returns
+ -------
+ total : float
+ The total width needed to accommodate the laid out boxes.
+ offsets : array of float
+ The left offsets of the boxes.
+ """
+ w_list, d_list = zip(*wd_list) # d_list is currently not used.
+ _api.check_in_list(["fixed", "expand", "equal"], mode=mode)
+
+ if mode == "fixed":
+ offsets_ = np.cumsum([0] + [w + sep for w in w_list])
+ offsets = offsets_[:-1]
+ if total is None:
+ total = offsets_[-1] - sep
+ return total, offsets
+
+ elif mode == "expand":
+ # This is a bit of a hack to avoid a TypeError when *total*
+ # is None and used in conjugation with tight layout.
+ if total is None:
+ total = 1
+ if len(w_list) > 1:
+ sep = (total - sum(w_list)) / (len(w_list) - 1)
+ else:
+ sep = 0
+ offsets_ = np.cumsum([0] + [w + sep for w in w_list])
+ offsets = offsets_[:-1]
+ return total, offsets
+
+ elif mode == "equal":
+ maxh = max(w_list)
+ if total is None:
+ if sep is None:
+ raise ValueError("total and sep cannot both be None when "
+ "using layout mode 'equal'")
+ total = (maxh + sep) * len(w_list)
+ else:
+ sep = total / len(w_list) - maxh
+ offsets = (maxh + sep) * np.arange(len(w_list))
+ return total, offsets
+
+
+def _get_aligned_offsets(hd_list, height, align="baseline"):
+ """
+ Align boxes each specified by their ``(height, descent)`` pair.
+
+ For simplicity of the description, the terminology used here assumes a
+ horizontal layout (i.e., vertical alignment), but the function works
+ equally for a vertical layout.
+
+ Parameters
+ ----------
+ hd_list
+ List of (height, xdescent) of boxes to be aligned.
+ height : float or None
+ Intended total height. If None, the maximum of the heights in *hd_list*
+ is used.
+ align : {'baseline', 'left', 'top', 'right', 'bottom', 'center'}
+ The alignment anchor of the boxes.
+
+ Returns
+ -------
+ height
+ The total height of the packing (if a value was originally passed in,
+ it is returned without checking that it is actually large enough).
+ descent
+ The descent of the packing.
+ offsets
+ The bottom offsets of the boxes.
+ """
+
+ if height is None:
+ height = max(h for h, d in hd_list)
+ _api.check_in_list(
+ ["baseline", "left", "top", "right", "bottom", "center"], align=align)
+
+ if align == "baseline":
+ height_descent = max(h - d for h, d in hd_list)
+ descent = max(d for h, d in hd_list)
+ height = height_descent + descent
+ offsets = [0. for h, d in hd_list]
+ elif align in ["left", "top"]:
+ descent = 0.
+ offsets = [d for h, d in hd_list]
+ elif align in ["right", "bottom"]:
+ descent = 0.
+ offsets = [height - h + d for h, d in hd_list]
+ elif align == "center":
+ descent = 0.
+ offsets = [(height - h) * .5 + d for h, d in hd_list]
+
+ return height, descent, offsets
+
+
+class OffsetBox(martist.Artist):
+ """
+ The OffsetBox is a simple container artist.
+
+ The child artists are meant to be drawn at a relative position to its
+ parent.
+
+ Being an artist itself, all parameters are passed on to `.Artist`.
+ """
+ def __init__(self, *args, **kwargs):
+
+ super().__init__(*args, **kwargs)
+
+ # Clipping has not been implemented in the OffesetBox family, so
+ # disable the clip flag for consistency. It can always be turned back
+ # on to zero effect.
+ self.set_clip_on(False)
+
+ self._children = []
+ self._offset = (0, 0)
+
+ def set_figure(self, fig):
+ """
+ Set the `.Figure` for the `.OffsetBox` and all its children.
+
+ Parameters
+ ----------
+ fig : `~matplotlib.figure.Figure`
+ """
+ super().set_figure(fig)
+ for c in self.get_children():
+ c.set_figure(fig)
+
+ @martist.Artist.axes.setter
+ def axes(self, ax):
+ # TODO deal with this better
+ martist.Artist.axes.fset(self, ax)
+ for c in self.get_children():
+ if c is not None:
+ c.axes = ax
+
+ def contains(self, mouseevent):
+ """
+ Delegate the mouse event contains-check to the children.
+
+ As a container, the `.OffsetBox` does not respond itself to
+ mouseevents.
+
+ Parameters
+ ----------
+ mouseevent : `matplotlib.backend_bases.MouseEvent`
+
+ Returns
+ -------
+ contains : bool
+ Whether any values are within the radius.
+ details : dict
+ An artist-specific dictionary of details of the event context,
+ such as which points are contained in the pick radius. See the
+ individual Artist subclasses for details.
+
+ See Also
+ --------
+ .Artist.contains
+ """
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+ for c in self.get_children():
+ a, b = c.contains(mouseevent)
+ if a:
+ return a, b
+ return False, {}
+
+ def set_offset(self, xy):
+ """
+ Set the offset.
+
+ Parameters
+ ----------
+ xy : (float, float) or callable
+ The (x, y) coordinates of the offset in display units. These can
+ either be given explicitly as a tuple (x, y), or by providing a
+ function that converts the extent into the offset. This function
+ must have the signature::
+
+ def offset(width, height, xdescent, ydescent, renderer) \
+-> (float, float)
+ """
+ self._offset = xy
+ self.stale = True
+
+ def get_offset(self, width, height, xdescent, ydescent, renderer):
+ """
+ Return the offset as a tuple (x, y).
+
+ The extent parameters have to be provided to handle the case where the
+ offset is dynamically determined by a callable (see
+ `~.OffsetBox.set_offset`).
+
+ Parameters
+ ----------
+ width, height, xdescent, ydescent
+ Extent parameters.
+ renderer : `.RendererBase` subclass
+
+ """
+ return (self._offset(width, height, xdescent, ydescent, renderer)
+ if callable(self._offset)
+ else self._offset)
+
+ def set_width(self, width):
+ """
+ Set the width of the box.
+
+ Parameters
+ ----------
+ width : float
+ """
+ self.width = width
+ self.stale = True
+
+ def set_height(self, height):
+ """
+ Set the height of the box.
+
+ Parameters
+ ----------
+ height : float
+ """
+ self.height = height
+ self.stale = True
+
+ def get_visible_children(self):
+ r"""Return a list of the visible child `.Artist`\s."""
+ return [c for c in self._children if c.get_visible()]
+
+ def get_children(self):
+ r"""Return a list of the child `.Artist`\s."""
+ return self._children
+
+ def get_extent_offsets(self, renderer):
+ """
+ Update offset of the children and return the extent of the box.
+
+ Parameters
+ ----------
+ renderer : `.RendererBase` subclass
+
+ Returns
+ -------
+ width
+ height
+ xdescent
+ ydescent
+ list of (xoffset, yoffset) pairs
+ """
+ raise NotImplementedError(
+ "get_extent_offsets must be overridden in derived classes.")
+
+ def get_extent(self, renderer):
+ """Return a tuple ``width, height, xdescent, ydescent`` of the box."""
+ w, h, xd, yd, offsets = self.get_extent_offsets(renderer)
+ return w, h, xd, yd
+
+ def get_window_extent(self, renderer):
+ """Return the bounding box (`.Bbox`) in display space."""
+ w, h, xd, yd, offsets = self.get_extent_offsets(renderer)
+ px, py = self.get_offset(w, h, xd, yd, renderer)
+ return mtransforms.Bbox.from_bounds(px - xd, py - yd, w, h)
+
+ def draw(self, renderer):
+ """
+ Update the location of children if necessary and draw them
+ to the given *renderer*.
+ """
+ width, height, xdescent, ydescent, offsets = self.get_extent_offsets(
+ renderer)
+
+ px, py = self.get_offset(width, height, xdescent, ydescent, renderer)
+
+ for c, (ox, oy) in zip(self.get_visible_children(), offsets):
+ c.set_offset((px + ox, py + oy))
+ c.draw(renderer)
+
+ bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
+ self.stale = False
+
+
+class PackerBase(OffsetBox):
+ def __init__(self, pad=None, sep=None, width=None, height=None,
+ align="baseline", mode="fixed", children=None):
+ """
+ Parameters
+ ----------
+ pad : float, optional
+ The boundary padding in points.
+
+ sep : float, optional
+ The spacing between items in points.
+
+ width, height : float, optional
+ Width and height of the container box in pixels, calculated if
+ *None*.
+
+ align : {'top', 'bottom', 'left', 'right', 'center', 'baseline'}, \
+default: 'baseline'
+ Alignment of boxes.
+
+ mode : {'fixed', 'expand', 'equal'}, default: 'fixed'
+ The packing mode.
+
+ - 'fixed' packs the given `.Artist`\\s tight with *sep* spacing.
+ - 'expand' uses the maximal available space to distribute the
+ artists with equal spacing in between.
+ - 'equal': Each artist an equal fraction of the available space
+ and is left-aligned (or top-aligned) therein.
+
+ children : list of `.Artist`
+ The artists to pack.
+
+ Notes
+ -----
+ *pad* and *sep* are in points and will be scaled with the renderer
+ dpi, while *width* and *height* are in in pixels.
+ """
+ super().__init__()
+ self.height = height
+ self.width = width
+ self.sep = sep
+ self.pad = pad
+ self.mode = mode
+ self.align = align
+ self._children = children
+
+
+class VPacker(PackerBase):
+ """
+ VPacker packs its children vertically, automatically adjusting their
+ relative positions at draw time.
+ """
+
+ def get_extent_offsets(self, renderer):
+ # docstring inherited
+ dpicor = renderer.points_to_pixels(1.)
+ pad = self.pad * dpicor
+ sep = self.sep * dpicor
+
+ if self.width is not None:
+ for c in self.get_visible_children():
+ if isinstance(c, PackerBase) and c.mode == "expand":
+ c.set_width(self.width)
+
+ whd_list = [c.get_extent(renderer)
+ for c in self.get_visible_children()]
+ whd_list = [(w, h, xd, (h - yd)) for w, h, xd, yd in whd_list]
+
+ wd_list = [(w, xd) for w, h, xd, yd in whd_list]
+ width, xdescent, xoffsets = _get_aligned_offsets(wd_list,
+ self.width,
+ self.align)
+
+ pack_list = [(h, yd) for w, h, xd, yd in whd_list]
+ height, yoffsets_ = _get_packed_offsets(pack_list, self.height,
+ sep, self.mode)
+
+ yoffsets = yoffsets_ + [yd for w, h, xd, yd in whd_list]
+ ydescent = height - yoffsets[0]
+ yoffsets = height - yoffsets
+
+ yoffsets = yoffsets - ydescent
+
+ return (width + 2 * pad, height + 2 * pad,
+ xdescent + pad, ydescent + pad,
+ list(zip(xoffsets, yoffsets)))
+
+
+class HPacker(PackerBase):
+ """
+ HPacker packs its children horizontally, automatically adjusting their
+ relative positions at draw time.
+ """
+
+ def get_extent_offsets(self, renderer):
+ # docstring inherited
+ dpicor = renderer.points_to_pixels(1.)
+ pad = self.pad * dpicor
+ sep = self.sep * dpicor
+
+ whd_list = [c.get_extent(renderer)
+ for c in self.get_visible_children()]
+
+ if not whd_list:
+ return 2 * pad, 2 * pad, pad, pad, []
+
+ if self.height is None:
+ height_descent = max(h - yd for w, h, xd, yd in whd_list)
+ ydescent = max(yd for w, h, xd, yd in whd_list)
+ height = height_descent + ydescent
+ else:
+ height = self.height - 2 * pad # width w/o pad
+
+ hd_list = [(h, yd) for w, h, xd, yd in whd_list]
+ height, ydescent, yoffsets = _get_aligned_offsets(hd_list,
+ self.height,
+ self.align)
+
+ pack_list = [(w, xd) for w, h, xd, yd in whd_list]
+
+ width, xoffsets_ = _get_packed_offsets(pack_list, self.width,
+ sep, self.mode)
+
+ xoffsets = xoffsets_ + [xd for w, h, xd, yd in whd_list]
+
+ xdescent = whd_list[0][2]
+ xoffsets = xoffsets - xdescent
+
+ return (width + 2 * pad, height + 2 * pad,
+ xdescent + pad, ydescent + pad,
+ list(zip(xoffsets, yoffsets)))
+
+
+class PaddedBox(OffsetBox):
+ """
+ A container to add a padding around an `.Artist`.
+
+ The `.PaddedBox` contains a `.FancyBboxPatch` that is used to visualize
+ it when rendering.
+ """
+ def __init__(self, child, pad=None, draw_frame=False, patch_attrs=None):
+ """
+ Parameters
+ ----------
+ child : `~matplotlib.artist.Artist`
+ The contained `.Artist`.
+ pad : float
+ The padding in points. This will be scaled with the renderer dpi.
+ In contrast *width* and *height* are in *pixels* and thus not
+ scaled.
+ draw_frame : bool
+ Whether to draw the contained `.FancyBboxPatch`.
+ patch_attrs : dict or None
+ Additional parameters passed to the contained `.FancyBboxPatch`.
+ """
+ super().__init__()
+ self.pad = pad
+ self._children = [child]
+ self.patch = FancyBboxPatch(
+ xy=(0.0, 0.0), width=1., height=1.,
+ facecolor='w', edgecolor='k',
+ mutation_scale=1, # self.prop.get_size_in_points(),
+ snap=True,
+ visible=draw_frame,
+ boxstyle="square,pad=0",
+ )
+ if patch_attrs is not None:
+ self.patch.update(patch_attrs)
+
+ def get_extent_offsets(self, renderer):
+ # docstring inherited.
+ dpicor = renderer.points_to_pixels(1.)
+ pad = self.pad * dpicor
+ w, h, xd, yd = self._children[0].get_extent(renderer)
+ return (w + 2 * pad, h + 2 * pad, xd + pad, yd + pad,
+ [(0, 0)])
+
+ def draw(self, renderer):
+ # docstring inherited
+ width, height, xdescent, ydescent, offsets = self.get_extent_offsets(
+ renderer)
+
+ px, py = self.get_offset(width, height, xdescent, ydescent, renderer)
+
+ for c, (ox, oy) in zip(self.get_visible_children(), offsets):
+ c.set_offset((px + ox, py + oy))
+
+ self.draw_frame(renderer)
+
+ for c in self.get_visible_children():
+ c.draw(renderer)
+
+ #bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
+ self.stale = False
+
+ def update_frame(self, bbox, fontsize=None):
+ self.patch.set_bounds(bbox.x0, bbox.y0, bbox.width, bbox.height)
+ if fontsize:
+ self.patch.set_mutation_scale(fontsize)
+ self.stale = True
+
+ def draw_frame(self, renderer):
+ # update the location and size of the legend
+ self.update_frame(self.get_window_extent(renderer))
+ self.patch.draw(renderer)
+
+
+class DrawingArea(OffsetBox):
+ """
+ The DrawingArea can contain any Artist as a child. The DrawingArea
+ has a fixed width and height. The position of children relative to
+ the parent is fixed. The children can be clipped at the
+ boundaries of the parent.
+ """
+
+ def __init__(self, width, height, xdescent=0.,
+ ydescent=0., clip=False):
+ """
+ Parameters
+ ----------
+ width, height : float
+ Width and height of the container box.
+ xdescent, ydescent : float
+ Descent of the box in x- and y-direction.
+ clip : bool
+ Whether to clip the children to the box.
+ """
+ super().__init__()
+ self.width = width
+ self.height = height
+ self.xdescent = xdescent
+ self.ydescent = ydescent
+ self._clip_children = clip
+ self.offset_transform = mtransforms.Affine2D()
+ self.dpi_transform = mtransforms.Affine2D()
+
+ @property
+ def clip_children(self):
+ """
+ If the children of this DrawingArea should be clipped
+ by DrawingArea bounding box.
+ """
+ return self._clip_children
+
+ @clip_children.setter
+ def clip_children(self, val):
+ self._clip_children = bool(val)
+ self.stale = True
+
+ def get_transform(self):
+ """
+ Return the `~matplotlib.transforms.Transform` applied to the children.
+ """
+ return self.dpi_transform + self.offset_transform
+
+ def set_transform(self, t):
+ """
+ set_transform is ignored.
+ """
+
+ def set_offset(self, xy):
+ """
+ Set the offset of the container.
+
+ Parameters
+ ----------
+ xy : (float, float)
+ The (x, y) coordinates of the offset in display units.
+ """
+ self._offset = xy
+ self.offset_transform.clear()
+ self.offset_transform.translate(xy[0], xy[1])
+ self.stale = True
+
+ def get_offset(self):
+ """Return offset of the container."""
+ return self._offset
+
+ def get_window_extent(self, renderer):
+ """Return the bounding box in display space."""
+ w, h, xd, yd = self.get_extent(renderer)
+ ox, oy = self.get_offset() # w, h, xd, yd)
+
+ return mtransforms.Bbox.from_bounds(ox - xd, oy - yd, w, h)
+
+ def get_extent(self, renderer):
+ """Return width, height, xdescent, ydescent of box."""
+ dpi_cor = renderer.points_to_pixels(1.)
+ return (self.width * dpi_cor, self.height * dpi_cor,
+ self.xdescent * dpi_cor, self.ydescent * dpi_cor)
+
+ def add_artist(self, a):
+ """Add an `.Artist` to the container box."""
+ self._children.append(a)
+ if not a.is_transform_set():
+ a.set_transform(self.get_transform())
+ if self.axes is not None:
+ a.axes = self.axes
+ fig = self.figure
+ if fig is not None:
+ a.set_figure(fig)
+
+ def draw(self, renderer):
+ # docstring inherited
+
+ dpi_cor = renderer.points_to_pixels(1.)
+ self.dpi_transform.clear()
+ self.dpi_transform.scale(dpi_cor)
+
+ # At this point the DrawingArea has a transform
+ # to the display space so the path created is
+ # good for clipping children
+ tpath = mtransforms.TransformedPath(
+ mpath.Path([[0, 0], [0, self.height],
+ [self.width, self.height],
+ [self.width, 0]]),
+ self.get_transform())
+ for c in self._children:
+ if self._clip_children and not (c.clipbox or c._clippath):
+ c.set_clip_path(tpath)
+ c.draw(renderer)
+
+ bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
+ self.stale = False
+
+
+class TextArea(OffsetBox):
+ """
+ The TextArea is a container artist for a single Text instance.
+
+ The text is placed at (0, 0) with baseline+left alignment, by default. The
+ width and height of the TextArea instance is the width and height of its
+ child text.
+ """
+
+ @_api.delete_parameter("3.4", "minimumdescent")
+ def __init__(self, s,
+ textprops=None,
+ multilinebaseline=False,
+ minimumdescent=True,
+ ):
+ """
+ Parameters
+ ----------
+ s : str
+ The text to be displayed.
+ textprops : dict, default: {}
+ Dictionary of keyword parameters to be passed to the `.Text`
+ instance in the TextArea.
+ multilinebaseline : bool, default: False
+ Whether the baseline for multiline text is adjusted so that it
+ is (approximately) center-aligned with single-line text.
+ minimumdescent : bool, default: True
+ If `True`, the box has a minimum descent of "p". This is now
+ effectively always True.
+ """
+ if textprops is None:
+ textprops = {}
+ self._text = mtext.Text(0, 0, s, **textprops)
+ super().__init__()
+ self._children = [self._text]
+ self.offset_transform = mtransforms.Affine2D()
+ self._baseline_transform = mtransforms.Affine2D()
+ self._text.set_transform(self.offset_transform +
+ self._baseline_transform)
+ self._multilinebaseline = multilinebaseline
+ self._minimumdescent = minimumdescent
+
+ def set_text(self, s):
+ """Set the text of this area as a string."""
+ self._text.set_text(s)
+ self.stale = True
+
+ def get_text(self):
+ """Return the string representation of this area's text."""
+ return self._text.get_text()
+
+ def set_multilinebaseline(self, t):
+ """
+ Set multilinebaseline.
+
+ If True, the baseline for multiline text is adjusted so that it is
+ (approximately) center-aligned with single-line text. This is used
+ e.g. by the legend implementation so that single-line labels are
+ baseline-aligned, but multiline labels are "center"-aligned with them.
+ """
+ self._multilinebaseline = t
+ self.stale = True
+
+ def get_multilinebaseline(self):
+ """
+ Get multilinebaseline.
+ """
+ return self._multilinebaseline
+
+ @_api.deprecated("3.4")
+ def set_minimumdescent(self, t):
+ """
+ Set minimumdescent.
+
+ If True, extent of the single line text is adjusted so that
+ its descent is at least the one of the glyph "p".
+ """
+ # The current implementation of Text._get_layout always behaves as if
+ # this is True.
+ self._minimumdescent = t
+ self.stale = True
+
+ @_api.deprecated("3.4")
+ def get_minimumdescent(self):
+ """
+ Get minimumdescent.
+ """
+ return self._minimumdescent
+
+ def set_transform(self, t):
+ """
+ set_transform is ignored.
+ """
+
+ def set_offset(self, xy):
+ """
+ Set the offset of the container.
+
+ Parameters
+ ----------
+ xy : (float, float)
+ The (x, y) coordinates of the offset in display units.
+ """
+ self._offset = xy
+ self.offset_transform.clear()
+ self.offset_transform.translate(xy[0], xy[1])
+ self.stale = True
+
+ def get_offset(self):
+ """Return offset of the container."""
+ return self._offset
+
+ def get_window_extent(self, renderer):
+ """Return the bounding box in display space."""
+ w, h, xd, yd = self.get_extent(renderer)
+ ox, oy = self.get_offset()
+ return mtransforms.Bbox.from_bounds(ox - xd, oy - yd, w, h)
+
+ def get_extent(self, renderer):
+ _, h_, d_ = renderer.get_text_width_height_descent(
+ "lp", self._text._fontproperties,
+ ismath="TeX" if self._text.get_usetex() else False)
+
+ bbox, info, yd = self._text._get_layout(renderer)
+ w, h = bbox.width, bbox.height
+
+ self._baseline_transform.clear()
+
+ if len(info) > 1 and self._multilinebaseline:
+ yd_new = 0.5 * h - 0.5 * (h_ - d_)
+ self._baseline_transform.translate(0, yd - yd_new)
+ yd = yd_new
+ else: # single line
+ h_d = max(h_ - d_, h - yd)
+ h = h_d + yd
+
+ ha = self._text.get_horizontalalignment()
+ if ha == 'left':
+ xd = 0
+ elif ha == 'center':
+ xd = w / 2
+ elif ha == 'right':
+ xd = w
+
+ return w, h, xd, yd
+
+ def draw(self, renderer):
+ # docstring inherited
+ self._text.draw(renderer)
+ bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
+ self.stale = False
+
+
+class AuxTransformBox(OffsetBox):
+ """
+ Offset Box with the aux_transform. Its children will be
+ transformed with the aux_transform first then will be
+ offsetted. The absolute coordinate of the aux_transform is meaning
+ as it will be automatically adjust so that the left-lower corner
+ of the bounding box of children will be set to (0, 0) before the
+ offset transform.
+
+ It is similar to drawing area, except that the extent of the box
+ is not predetermined but calculated from the window extent of its
+ children. Furthermore, the extent of the children will be
+ calculated in the transformed coordinate.
+ """
+ def __init__(self, aux_transform):
+ self.aux_transform = aux_transform
+ super().__init__()
+ self.offset_transform = mtransforms.Affine2D()
+ # ref_offset_transform makes offset_transform always relative to the
+ # lower-left corner of the bbox of its children.
+ self.ref_offset_transform = mtransforms.Affine2D()
+
+ def add_artist(self, a):
+ """Add an `.Artist` to the container box."""
+ self._children.append(a)
+ a.set_transform(self.get_transform())
+ self.stale = True
+
+ def get_transform(self):
+ """
+ Return the :class:`~matplotlib.transforms.Transform` applied
+ to the children
+ """
+ return (self.aux_transform
+ + self.ref_offset_transform
+ + self.offset_transform)
+
+ def set_transform(self, t):
+ """
+ set_transform is ignored.
+ """
+
+ def set_offset(self, xy):
+ """
+ Set the offset of the container.
+
+ Parameters
+ ----------
+ xy : (float, float)
+ The (x, y) coordinates of the offset in display units.
+ """
+ self._offset = xy
+ self.offset_transform.clear()
+ self.offset_transform.translate(xy[0], xy[1])
+ self.stale = True
+
+ def get_offset(self):
+ """Return offset of the container."""
+ return self._offset
+
+ def get_window_extent(self, renderer):
+ """Return the bounding box in display space."""
+ w, h, xd, yd = self.get_extent(renderer)
+ ox, oy = self.get_offset() # w, h, xd, yd)
+ return mtransforms.Bbox.from_bounds(ox - xd, oy - yd, w, h)
+
+ def get_extent(self, renderer):
+ # clear the offset transforms
+ _off = self.offset_transform.get_matrix() # to be restored later
+ self.ref_offset_transform.clear()
+ self.offset_transform.clear()
+ # calculate the extent
+ bboxes = [c.get_window_extent(renderer) for c in self._children]
+ ub = mtransforms.Bbox.union(bboxes)
+ # adjust ref_offset_transform
+ self.ref_offset_transform.translate(-ub.x0, -ub.y0)
+ # restore offset transform
+ self.offset_transform.set_matrix(_off)
+
+ return ub.width, ub.height, 0., 0.
+
+ def draw(self, renderer):
+ # docstring inherited
+ for c in self._children:
+ c.draw(renderer)
+ bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
+ self.stale = False
+
+
+class AnchoredOffsetbox(OffsetBox):
+ """
+ An offset box placed according to location *loc*.
+
+ AnchoredOffsetbox has a single child. When multiple children are needed,
+ use an extra OffsetBox to enclose them. By default, the offset box is
+ anchored against its parent axes. You may explicitly specify the
+ *bbox_to_anchor*.
+ """
+ zorder = 5 # zorder of the legend
+
+ # Location codes
+ codes = {'upper right': 1,
+ 'upper left': 2,
+ 'lower left': 3,
+ 'lower right': 4,
+ 'right': 5,
+ 'center left': 6,
+ 'center right': 7,
+ 'lower center': 8,
+ 'upper center': 9,
+ 'center': 10,
+ }
+
+ def __init__(self, loc,
+ pad=0.4, borderpad=0.5,
+ child=None, prop=None, frameon=True,
+ bbox_to_anchor=None,
+ bbox_transform=None,
+ **kwargs):
+ """
+ Parameters
+ ----------
+ loc : str
+ The box location. Supported values:
+
+ - 'upper right'
+ - 'upper left'
+ - 'lower left'
+ - 'lower right'
+ - 'center left'
+ - 'center right'
+ - 'lower center'
+ - 'upper center'
+ - 'center'
+
+ For backward compatibility, numeric values are accepted as well.
+ See the parameter *loc* of `.Legend` for details.
+
+ pad : float, default: 0.4
+ Padding around the child as fraction of the fontsize.
+
+ borderpad : float, default: 0.5
+ Padding between the offsetbox frame and the *bbox_to_anchor*.
+
+ child : `.OffsetBox`
+ The box that will be anchored.
+
+ prop : `.FontProperties`
+ This is only used as a reference for paddings. If not given,
+ :rc:`legend.fontsize` is used.
+
+ frameon : bool
+ Whether to draw a frame around the box.
+
+ bbox_to_anchor : `.BboxBase`, 2-tuple, or 4-tuple of floats
+ Box that is used to position the legend in conjunction with *loc*.
+
+ bbox_transform : None or :class:`matplotlib.transforms.Transform`
+ The transform for the bounding box (*bbox_to_anchor*).
+
+ **kwargs
+ All other parameters are passed on to `.OffsetBox`.
+
+ Notes
+ -----
+ See `.Legend` for a detailed description of the anchoring mechanism.
+ """
+ super().__init__(**kwargs)
+
+ self.set_bbox_to_anchor(bbox_to_anchor, bbox_transform)
+ self.set_child(child)
+
+ if isinstance(loc, str):
+ loc = _api.check_getitem(self.codes, loc=loc)
+
+ self.loc = loc
+ self.borderpad = borderpad
+ self.pad = pad
+
+ if prop is None:
+ self.prop = FontProperties(size=rcParams["legend.fontsize"])
+ else:
+ self.prop = FontProperties._from_any(prop)
+ if isinstance(prop, dict) and "size" not in prop:
+ self.prop.set_size(rcParams["legend.fontsize"])
+
+ self.patch = FancyBboxPatch(
+ xy=(0.0, 0.0), width=1., height=1.,
+ facecolor='w', edgecolor='k',
+ mutation_scale=self.prop.get_size_in_points(),
+ snap=True,
+ visible=frameon,
+ boxstyle="square,pad=0",
+ )
+
+ def set_child(self, child):
+ """Set the child to be anchored."""
+ self._child = child
+ if child is not None:
+ child.axes = self.axes
+ self.stale = True
+
+ def get_child(self):
+ """Return the child."""
+ return self._child
+
+ def get_children(self):
+ """Return the list of children."""
+ return [self._child]
+
+ def get_extent(self, renderer):
+ """
+ Return the extent of the box as (width, height, x, y).
+
+ This is the extent of the child plus the padding.
+ """
+ w, h, xd, yd = self.get_child().get_extent(renderer)
+ fontsize = renderer.points_to_pixels(self.prop.get_size_in_points())
+ pad = self.pad * fontsize
+
+ return w + 2 * pad, h + 2 * pad, xd + pad, yd + pad
+
+ def get_bbox_to_anchor(self):
+ """Return the bbox that the box is anchored to."""
+ if self._bbox_to_anchor is None:
+ return self.axes.bbox
+ else:
+ transform = self._bbox_to_anchor_transform
+ if transform is None:
+ return self._bbox_to_anchor
+ else:
+ return TransformedBbox(self._bbox_to_anchor,
+ transform)
+
+ def set_bbox_to_anchor(self, bbox, transform=None):
+ """
+ Set the bbox that the box is anchored to.
+
+ *bbox* can be a Bbox instance, a list of [left, bottom, width,
+ height], or a list of [left, bottom] where the width and
+ height will be assumed to be zero. The bbox will be
+ transformed to display coordinate by the given transform.
+ """
+ if bbox is None or isinstance(bbox, BboxBase):
+ self._bbox_to_anchor = bbox
+ else:
+ try:
+ l = len(bbox)
+ except TypeError as err:
+ raise ValueError("Invalid argument for bbox : %s" %
+ str(bbox)) from err
+
+ if l == 2:
+ bbox = [bbox[0], bbox[1], 0, 0]
+
+ self._bbox_to_anchor = Bbox.from_bounds(*bbox)
+
+ self._bbox_to_anchor_transform = transform
+ self.stale = True
+
+ def get_window_extent(self, renderer):
+ """Return the bounding box in display space."""
+ self._update_offset_func(renderer)
+ w, h, xd, yd = self.get_extent(renderer)
+ ox, oy = self.get_offset(w, h, xd, yd, renderer)
+ return Bbox.from_bounds(ox - xd, oy - yd, w, h)
+
+ def _update_offset_func(self, renderer, fontsize=None):
+ """
+ Update the offset func which depends on the dpi of the
+ renderer (because of the padding).
+ """
+ if fontsize is None:
+ fontsize = renderer.points_to_pixels(
+ self.prop.get_size_in_points())
+
+ def _offset(w, h, xd, yd, renderer, fontsize=fontsize, self=self):
+ bbox = Bbox.from_bounds(0, 0, w, h)
+ borderpad = self.borderpad * fontsize
+ bbox_to_anchor = self.get_bbox_to_anchor()
+
+ x0, y0 = self._get_anchored_bbox(self.loc,
+ bbox,
+ bbox_to_anchor,
+ borderpad)
+ return x0 + xd, y0 + yd
+
+ self.set_offset(_offset)
+
+ def update_frame(self, bbox, fontsize=None):
+ self.patch.set_bounds(bbox.x0, bbox.y0, bbox.width, bbox.height)
+ if fontsize:
+ self.patch.set_mutation_scale(fontsize)
+
+ def draw(self, renderer):
+ # docstring inherited
+ if not self.get_visible():
+ return
+
+ fontsize = renderer.points_to_pixels(self.prop.get_size_in_points())
+ self._update_offset_func(renderer, fontsize)
+
+ # update the location and size of the legend
+ bbox = self.get_window_extent(renderer)
+ self.update_frame(bbox, fontsize)
+ self.patch.draw(renderer)
+
+ width, height, xdescent, ydescent = self.get_extent(renderer)
+
+ px, py = self.get_offset(width, height, xdescent, ydescent, renderer)
+
+ self.get_child().set_offset((px, py))
+ self.get_child().draw(renderer)
+ self.stale = False
+
+ def _get_anchored_bbox(self, loc, bbox, parentbbox, borderpad):
+ """
+ Return the position of the bbox anchored at the parentbbox
+ with the loc code, with the borderpad.
+ """
+ assert loc in range(1, 11) # called only internally
+
+ BEST, UR, UL, LL, LR, R, CL, CR, LC, UC, C = range(11)
+
+ anchor_coefs = {UR: "NE",
+ UL: "NW",
+ LL: "SW",
+ LR: "SE",
+ R: "E",
+ CL: "W",
+ CR: "E",
+ LC: "S",
+ UC: "N",
+ C: "C"}
+
+ c = anchor_coefs[loc]
+
+ container = parentbbox.padded(-borderpad)
+ anchored_box = bbox.anchored(c, container=container)
+ return anchored_box.x0, anchored_box.y0
+
+
+class AnchoredText(AnchoredOffsetbox):
+ """
+ AnchoredOffsetbox with Text.
+ """
+
+ def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, **kwargs):
+ """
+ Parameters
+ ----------
+ s : str
+ Text.
+
+ loc : str
+ Location code. See `AnchoredOffsetbox`.
+
+ pad : float, default: 0.4
+ Padding around the text as fraction of the fontsize.
+
+ borderpad : float, default: 0.5
+ Spacing between the offsetbox frame and the *bbox_to_anchor*.
+
+ prop : dict, optional
+ Dictionary of keyword parameters to be passed to the
+ `~matplotlib.text.Text` instance contained inside AnchoredText.
+
+ **kwargs
+ All other parameters are passed to `AnchoredOffsetbox`.
+ """
+
+ if prop is None:
+ prop = {}
+ badkwargs = {'va', 'verticalalignment'}
+ if badkwargs & set(prop):
+ raise ValueError(
+ 'Mixing verticalalignment with AnchoredText is not supported.')
+
+ self.txt = TextArea(s, textprops=prop)
+ fp = self.txt._text.get_fontproperties()
+ super().__init__(
+ loc, pad=pad, borderpad=borderpad, child=self.txt, prop=fp,
+ **kwargs)
+
+
+class OffsetImage(OffsetBox):
+ def __init__(self, arr,
+ zoom=1,
+ cmap=None,
+ norm=None,
+ interpolation=None,
+ origin=None,
+ filternorm=True,
+ filterrad=4.0,
+ resample=False,
+ dpi_cor=True,
+ **kwargs
+ ):
+
+ super().__init__()
+ self._dpi_cor = dpi_cor
+
+ self.image = BboxImage(bbox=self.get_window_extent,
+ cmap=cmap,
+ norm=norm,
+ interpolation=interpolation,
+ origin=origin,
+ filternorm=filternorm,
+ filterrad=filterrad,
+ resample=resample,
+ **kwargs
+ )
+
+ self._children = [self.image]
+
+ self.set_zoom(zoom)
+ self.set_data(arr)
+
+ def set_data(self, arr):
+ self._data = np.asarray(arr)
+ self.image.set_data(self._data)
+ self.stale = True
+
+ def get_data(self):
+ return self._data
+
+ def set_zoom(self, zoom):
+ self._zoom = zoom
+ self.stale = True
+
+ def get_zoom(self):
+ return self._zoom
+
+ def get_offset(self):
+ """Return offset of the container."""
+ return self._offset
+
+ def get_children(self):
+ return [self.image]
+
+ def get_window_extent(self, renderer):
+ """Return the bounding box in display space."""
+ w, h, xd, yd = self.get_extent(renderer)
+ ox, oy = self.get_offset()
+ return mtransforms.Bbox.from_bounds(ox - xd, oy - yd, w, h)
+
+ def get_extent(self, renderer):
+ if self._dpi_cor: # True, do correction
+ dpi_cor = renderer.points_to_pixels(1.)
+ else:
+ dpi_cor = 1.
+
+ zoom = self.get_zoom()
+ data = self.get_data()
+ ny, nx = data.shape[:2]
+ w, h = dpi_cor * nx * zoom, dpi_cor * ny * zoom
+
+ return w, h, 0, 0
+
+ def draw(self, renderer):
+ # docstring inherited
+ self.image.draw(renderer)
+ # bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
+ self.stale = False
+
+
+class AnnotationBbox(martist.Artist, mtext._AnnotationBase):
+ """
+ Container for an `OffsetBox` referring to a specific position *xy*.
+
+ Optionally an arrow pointing from the offsetbox to *xy* can be drawn.
+
+ This is like `.Annotation`, but with `OffsetBox` instead of `.Text`.
+ """
+
+ zorder = 3
+
+ def __str__(self):
+ return "AnnotationBbox(%g,%g)" % (self.xy[0], self.xy[1])
+
+ @docstring.dedent_interpd
+ def __init__(self, offsetbox, xy,
+ xybox=None,
+ xycoords='data',
+ boxcoords=None,
+ frameon=True, pad=0.4, # FancyBboxPatch boxstyle.
+ annotation_clip=None,
+ box_alignment=(0.5, 0.5),
+ bboxprops=None,
+ arrowprops=None,
+ fontsize=None,
+ **kwargs):
+ """
+ Parameters
+ ----------
+ offsetbox : `OffsetBox`
+
+ xy : (float, float)
+ The point *(x, y)* to annotate. The coordinate system is determined
+ by *xycoords*.
+
+ xybox : (float, float), default: *xy*
+ The position *(x, y)* to place the text at. The coordinate system
+ is determined by *boxcoords*.
+
+ xycoords : str or `.Artist` or `.Transform` or callable or \
+(float, float), default: 'data'
+ The coordinate system that *xy* is given in. See the parameter
+ *xycoords* in `.Annotation` for a detailed description.
+
+ boxcoords : str or `.Artist` or `.Transform` or callable or \
+(float, float), default: value of *xycoords*
+ The coordinate system that *xybox* is given in. See the parameter
+ *textcoords* in `.Annotation` for a detailed description.
+
+ frameon : bool, default: True
+ Whether to draw a frame around the box.
+
+ pad : float, default: 0.4
+ Padding around the offsetbox.
+
+ box_alignment : (float, float)
+ A tuple of two floats for a vertical and horizontal alignment of
+ the offset box w.r.t. the *boxcoords*.
+ The lower-left corner is (0, 0) and upper-right corner is (1, 1).
+
+ **kwargs
+ Other parameters are identical to `.Annotation`.
+ """
+
+ martist.Artist.__init__(self)
+ mtext._AnnotationBase.__init__(self,
+ xy,
+ xycoords=xycoords,
+ annotation_clip=annotation_clip)
+
+ self.offsetbox = offsetbox
+
+ self.arrowprops = arrowprops
+
+ self.set_fontsize(fontsize)
+
+ if xybox is None:
+ self.xybox = xy
+ else:
+ self.xybox = xybox
+
+ if boxcoords is None:
+ self.boxcoords = xycoords
+ else:
+ self.boxcoords = boxcoords
+
+ if arrowprops is not None:
+ self._arrow_relpos = self.arrowprops.pop("relpos", (0.5, 0.5))
+ self.arrow_patch = FancyArrowPatch((0, 0), (1, 1),
+ **self.arrowprops)
+ else:
+ self._arrow_relpos = None
+ self.arrow_patch = None
+
+ self._box_alignment = box_alignment
+
+ # frame
+ self.patch = FancyBboxPatch(
+ xy=(0.0, 0.0), width=1., height=1.,
+ facecolor='w', edgecolor='k',
+ mutation_scale=self.prop.get_size_in_points(),
+ snap=True,
+ visible=frameon,
+ )
+ self.patch.set_boxstyle("square", pad=pad)
+ if bboxprops:
+ self.patch.set(**bboxprops)
+
+ self.update(kwargs)
+
+ @property
+ def xyann(self):
+ return self.xybox
+
+ @xyann.setter
+ def xyann(self, xyann):
+ self.xybox = xyann
+ self.stale = True
+
+ @property
+ def anncoords(self):
+ return self.boxcoords
+
+ @anncoords.setter
+ def anncoords(self, coords):
+ self.boxcoords = coords
+ self.stale = True
+
+ def contains(self, mouseevent):
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+ if not self._check_xy(None):
+ return False, {}
+ return self.offsetbox.contains(mouseevent)
+ #if self.arrow_patch is not None:
+ # a, ainfo=self.arrow_patch.contains(event)
+ # t = t or a
+ # self.arrow_patch is currently not checked as this can be a line - JJ
+
+ def get_children(self):
+ children = [self.offsetbox, self.patch]
+ if self.arrow_patch:
+ children.append(self.arrow_patch)
+ return children
+
+ def set_figure(self, fig):
+ if self.arrow_patch is not None:
+ self.arrow_patch.set_figure(fig)
+ self.offsetbox.set_figure(fig)
+ martist.Artist.set_figure(self, fig)
+
+ def set_fontsize(self, s=None):
+ """
+ Set the fontsize in points.
+
+ If *s* is not given, reset to :rc:`legend.fontsize`.
+ """
+ if s is None:
+ s = rcParams["legend.fontsize"]
+
+ self.prop = FontProperties(size=s)
+ self.stale = True
+
+ @_api.delete_parameter("3.3", "s")
+ def get_fontsize(self, s=None):
+ """Return the fontsize in points."""
+ return self.prop.get_size_in_points()
+
+ def get_window_extent(self, renderer):
+ """
+ get the bounding box in display space.
+ """
+ bboxes = [child.get_window_extent(renderer)
+ for child in self.get_children()]
+
+ return Bbox.union(bboxes)
+
+ def get_tightbbox(self, renderer):
+ """
+ get tight bounding box in display space.
+ """
+ bboxes = [child.get_tightbbox(renderer)
+ for child in self.get_children()]
+
+ return Bbox.union(bboxes)
+
+ def update_positions(self, renderer):
+ """
+ Update the pixel positions of the annotated point and the text.
+ """
+ xy_pixel = self._get_position_xy(renderer)
+ self._update_position_xybox(renderer, xy_pixel)
+
+ mutation_scale = renderer.points_to_pixels(self.get_fontsize())
+ self.patch.set_mutation_scale(mutation_scale)
+
+ if self.arrow_patch:
+ self.arrow_patch.set_mutation_scale(mutation_scale)
+
+ def _update_position_xybox(self, renderer, xy_pixel):
+ """
+ Update the pixel positions of the annotation text and the arrow patch.
+ """
+
+ x, y = self.xybox
+ if isinstance(self.boxcoords, tuple):
+ xcoord, ycoord = self.boxcoords
+ x1, y1 = self._get_xy(renderer, x, y, xcoord)
+ x2, y2 = self._get_xy(renderer, x, y, ycoord)
+ ox0, oy0 = x1, y2
+ else:
+ ox0, oy0 = self._get_xy(renderer, x, y, self.boxcoords)
+
+ w, h, xd, yd = self.offsetbox.get_extent(renderer)
+
+ _fw, _fh = self._box_alignment
+ self.offsetbox.set_offset((ox0 - _fw * w + xd, oy0 - _fh * h + yd))
+
+ # update patch position
+ bbox = self.offsetbox.get_window_extent(renderer)
+ #self.offsetbox.set_offset((ox0-_fw*w, oy0-_fh*h))
+ self.patch.set_bounds(bbox.x0, bbox.y0,
+ bbox.width, bbox.height)
+
+ x, y = xy_pixel
+
+ ox1, oy1 = x, y
+
+ if self.arrowprops:
+ d = self.arrowprops.copy()
+
+ # Use FancyArrowPatch if self.arrowprops has "arrowstyle" key.
+
+ # adjust the starting point of the arrow relative to
+ # the textbox.
+ # TODO : Rotation needs to be accounted.
+ relpos = self._arrow_relpos
+
+ ox0 = bbox.x0 + bbox.width * relpos[0]
+ oy0 = bbox.y0 + bbox.height * relpos[1]
+
+ # The arrow will be drawn from (ox0, oy0) to (ox1,
+ # oy1). It will be first clipped by patchA and patchB.
+ # Then it will be shrunk by shrinkA and shrinkB
+ # (in points). If patch A is not set, self.bbox_patch
+ # is used.
+
+ self.arrow_patch.set_positions((ox0, oy0), (ox1, oy1))
+ fs = self.prop.get_size_in_points()
+ mutation_scale = d.pop("mutation_scale", fs)
+ mutation_scale = renderer.points_to_pixels(mutation_scale)
+ self.arrow_patch.set_mutation_scale(mutation_scale)
+
+ patchA = d.pop("patchA", self.patch)
+ self.arrow_patch.set_patchA(patchA)
+
+ def draw(self, renderer):
+ # docstring inherited
+ if renderer is not None:
+ self._renderer = renderer
+ if not self.get_visible() or not self._check_xy(renderer):
+ return
+ self.update_positions(renderer)
+ if self.arrow_patch is not None:
+ if self.arrow_patch.figure is None and self.figure is not None:
+ self.arrow_patch.figure = self.figure
+ self.arrow_patch.draw(renderer)
+ self.patch.draw(renderer)
+ self.offsetbox.draw(renderer)
+ self.stale = False
+
+
+class DraggableBase:
+ """
+ Helper base class for a draggable artist (legend, offsetbox).
+
+ Derived classes must override the following methods::
+
+ def save_offset(self):
+ '''
+ Called when the object is picked for dragging; should save the
+ reference position of the artist.
+ '''
+
+ def update_offset(self, dx, dy):
+ '''
+ Called during the dragging; (*dx*, *dy*) is the pixel offset from
+ the point where the mouse drag started.
+ '''
+
+ Optionally, you may override the following method::
+
+ def finalize_offset(self):
+ '''Called when the mouse is released.'''
+
+ In the current implementation of `.DraggableLegend` and
+ `DraggableAnnotation`, `update_offset` places the artists in display
+ coordinates, and `finalize_offset` recalculates their position in axes
+ coordinate and set a relevant attribute.
+ """
+
+ def __init__(self, ref_artist, use_blit=False):
+ self.ref_artist = ref_artist
+ self.got_artist = False
+
+ self.canvas = self.ref_artist.figure.canvas
+ self._use_blit = use_blit and self.canvas.supports_blit
+
+ c2 = self.canvas.mpl_connect('pick_event', self.on_pick)
+ c3 = self.canvas.mpl_connect('button_release_event', self.on_release)
+
+ if not ref_artist.pickable():
+ ref_artist.set_picker(True)
+ overridden_picker = _api.deprecate_method_override(
+ __class__.artist_picker, self, since="3.3",
+ addendum="Directly set the artist's picker if desired.")
+ if overridden_picker is not None:
+ ref_artist.set_picker(overridden_picker)
+ self.cids = [c2, c3]
+
+ def on_motion(self, evt):
+ if self._check_still_parented() and self.got_artist:
+ dx = evt.x - self.mouse_x
+ dy = evt.y - self.mouse_y
+ self.update_offset(dx, dy)
+ if self._use_blit:
+ self.canvas.restore_region(self.background)
+ self.ref_artist.draw(self.ref_artist.figure._cachedRenderer)
+ self.canvas.blit()
+ else:
+ self.canvas.draw()
+
+ @_api.deprecated("3.3", alternative="self.on_motion")
+ def on_motion_blit(self, evt):
+ if self._check_still_parented() and self.got_artist:
+ dx = evt.x - self.mouse_x
+ dy = evt.y - self.mouse_y
+ self.update_offset(dx, dy)
+ self.canvas.restore_region(self.background)
+ self.ref_artist.draw(self.ref_artist.figure._cachedRenderer)
+ self.canvas.blit()
+
+ def on_pick(self, evt):
+ if self._check_still_parented() and evt.artist == self.ref_artist:
+ self.mouse_x = evt.mouseevent.x
+ self.mouse_y = evt.mouseevent.y
+ self.got_artist = True
+ if self._use_blit:
+ self.ref_artist.set_animated(True)
+ self.canvas.draw()
+ self.background = \
+ self.canvas.copy_from_bbox(self.ref_artist.figure.bbox)
+ self.ref_artist.draw(self.ref_artist.figure._cachedRenderer)
+ self.canvas.blit()
+ self._c1 = self.canvas.mpl_connect(
+ "motion_notify_event", self.on_motion)
+ self.save_offset()
+
+ def on_release(self, event):
+ if self._check_still_parented() and self.got_artist:
+ self.finalize_offset()
+ self.got_artist = False
+ self.canvas.mpl_disconnect(self._c1)
+
+ if self._use_blit:
+ self.ref_artist.set_animated(False)
+
+ def _check_still_parented(self):
+ if self.ref_artist.figure is None:
+ self.disconnect()
+ return False
+ else:
+ return True
+
+ def disconnect(self):
+ """Disconnect the callbacks."""
+ for cid in self.cids:
+ self.canvas.mpl_disconnect(cid)
+ try:
+ c1 = self._c1
+ except AttributeError:
+ pass
+ else:
+ self.canvas.mpl_disconnect(c1)
+
+ @_api.deprecated("3.3", alternative="self.ref_artist.contains")
+ def artist_picker(self, artist, evt):
+ return self.ref_artist.contains(evt)
+
+ def save_offset(self):
+ pass
+
+ def update_offset(self, dx, dy):
+ pass
+
+ def finalize_offset(self):
+ pass
+
+
+class DraggableOffsetBox(DraggableBase):
+ def __init__(self, ref_artist, offsetbox, use_blit=False):
+ super().__init__(ref_artist, use_blit=use_blit)
+ self.offsetbox = offsetbox
+
+ def save_offset(self):
+ offsetbox = self.offsetbox
+ renderer = offsetbox.figure._cachedRenderer
+ w, h, xd, yd = offsetbox.get_extent(renderer)
+ offset = offsetbox.get_offset(w, h, xd, yd, renderer)
+ self.offsetbox_x, self.offsetbox_y = offset
+ self.offsetbox.set_offset(offset)
+
+ def update_offset(self, dx, dy):
+ loc_in_canvas = self.offsetbox_x + dx, self.offsetbox_y + dy
+ self.offsetbox.set_offset(loc_in_canvas)
+
+ def get_loc_in_canvas(self):
+ offsetbox = self.offsetbox
+ renderer = offsetbox.figure._cachedRenderer
+ w, h, xd, yd = offsetbox.get_extent(renderer)
+ ox, oy = offsetbox._offset
+ loc_in_canvas = (ox - xd, oy - yd)
+ return loc_in_canvas
+
+
+class DraggableAnnotation(DraggableBase):
+ def __init__(self, annotation, use_blit=False):
+ super().__init__(annotation, use_blit=use_blit)
+ self.annotation = annotation
+
+ def save_offset(self):
+ ann = self.annotation
+ self.ox, self.oy = ann.get_transform().transform(ann.xyann)
+
+ def update_offset(self, dx, dy):
+ ann = self.annotation
+ ann.xyann = ann.get_transform().inverted().transform(
+ (self.ox + dx, self.oy + dy))
diff --git a/venv/Lib/site-packages/matplotlib/patches.py b/venv/Lib/site-packages/matplotlib/patches.py
new file mode 100644
index 0000000..a5bb201
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/patches.py
@@ -0,0 +1,4501 @@
+import contextlib
+import functools
+import inspect
+import math
+from numbers import Number
+import textwrap
+from collections import namedtuple
+
+import numpy as np
+
+import matplotlib as mpl
+from . import (_api, artist, cbook, colors, docstring, hatch as mhatch,
+ lines as mlines, transforms)
+from .bezier import (
+ NonIntersectingPathException, get_cos_sin, get_intersection,
+ get_parallels, inside_circle, make_wedged_bezier2,
+ split_bezier_intersecting_with_closedpath, split_path_inout)
+from .path import Path
+from ._enums import JoinStyle, CapStyle
+
+
+@cbook._define_aliases({
+ "antialiased": ["aa"],
+ "edgecolor": ["ec"],
+ "facecolor": ["fc"],
+ "linestyle": ["ls"],
+ "linewidth": ["lw"],
+})
+class Patch(artist.Artist):
+ """
+ A patch is a 2D artist with a face color and an edge color.
+
+ If any of *edgecolor*, *facecolor*, *linewidth*, or *antialiased*
+ are *None*, they default to their rc params setting.
+ """
+ zorder = 1
+
+ @_api.deprecated("3.4")
+ @_api.classproperty
+ def validCap(cls):
+ with _api.suppress_matplotlib_deprecation_warning():
+ return mlines.Line2D.validCap
+
+ @_api.deprecated("3.4")
+ @_api.classproperty
+ def validJoin(cls):
+ with _api.suppress_matplotlib_deprecation_warning():
+ return mlines.Line2D.validJoin
+
+ # Whether to draw an edge by default. Set on a
+ # subclass-by-subclass basis.
+ _edge_default = False
+
+ def __init__(self,
+ edgecolor=None,
+ facecolor=None,
+ color=None,
+ linewidth=None,
+ linestyle=None,
+ antialiased=None,
+ hatch=None,
+ fill=True,
+ capstyle=None,
+ joinstyle=None,
+ **kwargs):
+ """
+ The following kwarg properties are supported
+
+ %(Patch_kwdoc)s
+ """
+ super().__init__()
+
+ if linewidth is None:
+ linewidth = mpl.rcParams['patch.linewidth']
+ if linestyle is None:
+ linestyle = "solid"
+ if capstyle is None:
+ capstyle = CapStyle.butt
+ if joinstyle is None:
+ joinstyle = JoinStyle.miter
+ if antialiased is None:
+ antialiased = mpl.rcParams['patch.antialiased']
+
+ self._hatch_color = colors.to_rgba(mpl.rcParams['hatch.color'])
+ self._fill = True # needed for set_facecolor call
+ if color is not None:
+ if edgecolor is not None or facecolor is not None:
+ _api.warn_external(
+ "Setting the 'color' property will override "
+ "the edgecolor or facecolor properties.")
+ self.set_color(color)
+ else:
+ self.set_edgecolor(edgecolor)
+ self.set_facecolor(facecolor)
+ # unscaled dashes. Needed to scale dash patterns by lw
+ self._us_dashes = None
+ self._linewidth = 0
+
+ self.set_fill(fill)
+ self.set_linestyle(linestyle)
+ self.set_linewidth(linewidth)
+ self.set_antialiased(antialiased)
+ self.set_hatch(hatch)
+ self.set_capstyle(capstyle)
+ self.set_joinstyle(joinstyle)
+
+ if len(kwargs):
+ self.update(kwargs)
+
+ def get_verts(self):
+ """
+ Return a copy of the vertices used in this patch.
+
+ If the patch contains Bezier curves, the curves will be interpolated by
+ line segments. To access the curves as curves, use `get_path`.
+ """
+ trans = self.get_transform()
+ path = self.get_path()
+ polygons = path.to_polygons(trans)
+ if len(polygons):
+ return polygons[0]
+ return []
+
+ def _process_radius(self, radius):
+ if radius is not None:
+ return radius
+ if isinstance(self._picker, Number):
+ _radius = self._picker
+ else:
+ if self.get_edgecolor()[3] == 0:
+ _radius = 0
+ else:
+ _radius = self.get_linewidth()
+ return _radius
+
+ def contains(self, mouseevent, radius=None):
+ """
+ Test whether the mouse event occurred in the patch.
+
+ Returns
+ -------
+ (bool, empty dict)
+ """
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+ radius = self._process_radius(radius)
+ codes = self.get_path().codes
+ if codes is not None:
+ vertices = self.get_path().vertices
+ # if the current path is concatenated by multiple sub paths.
+ # get the indexes of the starting code(MOVETO) of all sub paths
+ idxs, = np.where(codes == Path.MOVETO)
+ # Don't split before the first MOVETO.
+ idxs = idxs[1:]
+ subpaths = map(
+ Path, np.split(vertices, idxs), np.split(codes, idxs))
+ else:
+ subpaths = [self.get_path()]
+ inside = any(
+ subpath.contains_point(
+ (mouseevent.x, mouseevent.y), self.get_transform(), radius)
+ for subpath in subpaths)
+ return inside, {}
+
+ def contains_point(self, point, radius=None):
+ """
+ Return whether the given point is inside the patch.
+
+ Parameters
+ ----------
+ point : (float, float)
+ The point (x, y) to check, in target coordinates of
+ ``self.get_transform()``. These are display coordinates for patches
+ that are added to a figure or axes.
+ radius : float, optional
+ Add an additional margin on the patch in target coordinates of
+ ``self.get_transform()``. See `.Path.contains_point` for further
+ details.
+
+ Returns
+ -------
+ bool
+
+ Notes
+ -----
+ The proper use of this method depends on the transform of the patch.
+ Isolated patches do not have a transform. In this case, the patch
+ creation coordinates and the point coordinates match. The following
+ example checks that the center of a circle is within the circle
+
+ >>> center = 0, 0
+ >>> c = Circle(center, radius=1)
+ >>> c.contains_point(center)
+ True
+
+ The convention of checking against the transformed patch stems from
+ the fact that this method is predominantly used to check if display
+ coordinates (e.g. from mouse events) are within the patch. If you want
+ to do the above check with data coordinates, you have to properly
+ transform them first:
+
+ >>> center = 0, 0
+ >>> c = Circle(center, radius=1)
+ >>> plt.gca().add_patch(c)
+ >>> transformed_center = c.get_transform().transform(center)
+ >>> c.contains_point(transformed_center)
+ True
+
+ """
+ radius = self._process_radius(radius)
+ return self.get_path().contains_point(point,
+ self.get_transform(),
+ radius)
+
+ def contains_points(self, points, radius=None):
+ """
+ Return whether the given points are inside the patch.
+
+ Parameters
+ ----------
+ points : (N, 2) array
+ The points to check, in target coordinates of
+ ``self.get_transform()``. These are display coordinates for patches
+ that are added to a figure or axes. Columns contain x and y values.
+ radius : float, optional
+ Add an additional margin on the patch in target coordinates of
+ ``self.get_transform()``. See `.Path.contains_point` for further
+ details.
+
+ Returns
+ -------
+ length-N bool array
+
+ Notes
+ -----
+ The proper use of this method depends on the transform of the patch.
+ See the notes on `.Patch.contains_point`.
+ """
+ radius = self._process_radius(radius)
+ return self.get_path().contains_points(points,
+ self.get_transform(),
+ radius)
+
+ def update_from(self, other):
+ # docstring inherited.
+ super().update_from(other)
+ # For some properties we don't need or don't want to go through the
+ # getters/setters, so we just copy them directly.
+ self._edgecolor = other._edgecolor
+ self._facecolor = other._facecolor
+ self._original_edgecolor = other._original_edgecolor
+ self._original_facecolor = other._original_facecolor
+ self._fill = other._fill
+ self._hatch = other._hatch
+ self._hatch_color = other._hatch_color
+ # copy the unscaled dash pattern
+ self._us_dashes = other._us_dashes
+ self.set_linewidth(other._linewidth) # also sets dash properties
+ self.set_transform(other.get_data_transform())
+ # If the transform of other needs further initialization, then it will
+ # be the case for this artist too.
+ self._transformSet = other.is_transform_set()
+
+ def get_extents(self):
+ """
+ Return the `Patch`'s axis-aligned extents as a `~.transforms.Bbox`.
+ """
+ return self.get_path().get_extents(self.get_transform())
+
+ def get_transform(self):
+ """Return the `~.transforms.Transform` applied to the `Patch`."""
+ return self.get_patch_transform() + artist.Artist.get_transform(self)
+
+ def get_data_transform(self):
+ """
+ Return the `~.transforms.Transform` mapping data coordinates to
+ physical coordinates.
+ """
+ return artist.Artist.get_transform(self)
+
+ def get_patch_transform(self):
+ """
+ Return the `~.transforms.Transform` instance mapping patch coordinates
+ to data coordinates.
+
+ For example, one may define a patch of a circle which represents a
+ radius of 5 by providing coordinates for a unit circle, and a
+ transform which scales the coordinates (the patch coordinate) by 5.
+ """
+ return transforms.IdentityTransform()
+
+ def get_antialiased(self):
+ """Return whether antialiasing is used for drawing."""
+ return self._antialiased
+
+ def get_edgecolor(self):
+ """Return the edge color."""
+ return self._edgecolor
+
+ def get_facecolor(self):
+ """Return the face color."""
+ return self._facecolor
+
+ def get_linewidth(self):
+ """Return the line width in points."""
+ return self._linewidth
+
+ def get_linestyle(self):
+ """Return the linestyle."""
+ return self._linestyle
+
+ def set_antialiased(self, aa):
+ """
+ Set whether to use antialiased rendering.
+
+ Parameters
+ ----------
+ b : bool or None
+ """
+ if aa is None:
+ aa = mpl.rcParams['patch.antialiased']
+ self._antialiased = aa
+ self.stale = True
+
+ def _set_edgecolor(self, color):
+ set_hatch_color = True
+ if color is None:
+ if (mpl.rcParams['patch.force_edgecolor'] or
+ not self._fill or self._edge_default):
+ color = mpl.rcParams['patch.edgecolor']
+ else:
+ color = 'none'
+ set_hatch_color = False
+
+ self._edgecolor = colors.to_rgba(color, self._alpha)
+ if set_hatch_color:
+ self._hatch_color = self._edgecolor
+ self.stale = True
+
+ def set_edgecolor(self, color):
+ """
+ Set the patch edge color.
+
+ Parameters
+ ----------
+ color : color or None or 'auto'
+ """
+ self._original_edgecolor = color
+ self._set_edgecolor(color)
+
+ def _set_facecolor(self, color):
+ if color is None:
+ color = mpl.rcParams['patch.facecolor']
+ alpha = self._alpha if self._fill else 0
+ self._facecolor = colors.to_rgba(color, alpha)
+ self.stale = True
+
+ def set_facecolor(self, color):
+ """
+ Set the patch face color.
+
+ Parameters
+ ----------
+ color : color or None
+ """
+ self._original_facecolor = color
+ self._set_facecolor(color)
+
+ def set_color(self, c):
+ """
+ Set both the edgecolor and the facecolor.
+
+ Parameters
+ ----------
+ c : color
+
+ See Also
+ --------
+ Patch.set_facecolor, Patch.set_edgecolor
+ For setting the edge or face color individually.
+ """
+ self.set_facecolor(c)
+ self.set_edgecolor(c)
+
+ def set_alpha(self, alpha):
+ # docstring inherited
+ super().set_alpha(alpha)
+ self._set_facecolor(self._original_facecolor)
+ self._set_edgecolor(self._original_edgecolor)
+ # stale is already True
+
+ def set_linewidth(self, w):
+ """
+ Set the patch linewidth in points.
+
+ Parameters
+ ----------
+ w : float or None
+ """
+ if w is None:
+ w = mpl.rcParams['patch.linewidth']
+ if w is None:
+ w = mpl.rcParams['axes.linewidth']
+
+ self._linewidth = float(w)
+ # scale the dash pattern by the linewidth
+ offset, ls = self._us_dashes
+ self._dashoffset, self._dashes = mlines._scale_dashes(
+ offset, ls, self._linewidth)
+ self.stale = True
+
+ def set_linestyle(self, ls):
+ """
+ Set the patch linestyle.
+
+ =========================== =================
+ linestyle description
+ =========================== =================
+ ``'-'`` or ``'solid'`` solid line
+ ``'--'`` or ``'dashed'`` dashed line
+ ``'-.'`` or ``'dashdot'`` dash-dotted line
+ ``':'`` or ``'dotted'`` dotted line
+ ``'None'`` draw nothing
+ ``'none'`` draw nothing
+ ``' '`` draw nothing
+ ``''`` draw nothing
+ =========================== =================
+
+ Alternatively a dash tuple of the following form can be provided::
+
+ (offset, onoffseq)
+
+ where ``onoffseq`` is an even length tuple of on and off ink in points.
+
+ Parameters
+ ----------
+ ls : {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
+ The line style.
+ """
+ if ls is None:
+ ls = "solid"
+ if ls in [' ', '', 'none']:
+ ls = 'None'
+ self._linestyle = ls
+ # get the unscaled dash pattern
+ offset, ls = self._us_dashes = mlines._get_dash_pattern(ls)
+ # scale the dash pattern by the linewidth
+ self._dashoffset, self._dashes = mlines._scale_dashes(
+ offset, ls, self._linewidth)
+ self.stale = True
+
+ def set_fill(self, b):
+ """
+ Set whether to fill the patch.
+
+ Parameters
+ ----------
+ b : bool
+ """
+ self._fill = bool(b)
+ self._set_facecolor(self._original_facecolor)
+ self._set_edgecolor(self._original_edgecolor)
+ self.stale = True
+
+ def get_fill(self):
+ """Return whether the patch is filled."""
+ return self._fill
+
+ # Make fill a property so as to preserve the long-standing
+ # but somewhat inconsistent behavior in which fill was an
+ # attribute.
+ fill = property(get_fill, set_fill)
+
+ @docstring.interpd
+ def set_capstyle(self, s):
+ """
+ Set the `.CapStyle`.
+
+ Parameters
+ ----------
+ s : `.CapStyle` or %(CapStyle)s
+ """
+ cs = CapStyle(s)
+ self._capstyle = cs
+ self.stale = True
+
+ def get_capstyle(self):
+ """Return the capstyle."""
+ return self._capstyle
+
+ @docstring.interpd
+ def set_joinstyle(self, s):
+ """
+ Set the `.JoinStyle`.
+
+ Parameters
+ ----------
+ s : `.JoinStyle` or %(JoinStyle)s
+ """
+ js = JoinStyle(s)
+ self._joinstyle = js
+ self.stale = True
+
+ def get_joinstyle(self):
+ """Return the joinstyle."""
+ return self._joinstyle
+
+ def set_hatch(self, hatch):
+ r"""
+ Set the hatching pattern.
+
+ *hatch* can be one of::
+
+ / - diagonal hatching
+ \ - back diagonal
+ | - vertical
+ - - horizontal
+ + - crossed
+ x - crossed diagonal
+ o - small circle
+ O - large circle
+ . - dots
+ * - stars
+
+ Letters can be combined, in which case all the specified
+ hatchings are done. If same letter repeats, it increases the
+ density of hatching of that pattern.
+
+ Hatching is supported in the PostScript, PDF, SVG and Agg
+ backends only.
+
+ Parameters
+ ----------
+ hatch : {'/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
+ """
+ # Use validate_hatch(list) after deprecation.
+ mhatch._validate_hatch_pattern(hatch)
+ self._hatch = hatch
+ self.stale = True
+
+ def get_hatch(self):
+ """Return the hatching pattern."""
+ return self._hatch
+
+ @contextlib.contextmanager
+ def _bind_draw_path_function(self, renderer):
+ """
+ ``draw()`` helper factored out for sharing with `FancyArrowPatch`.
+
+ Yields a callable ``dp`` such that calling ``dp(*args, **kwargs)`` is
+ equivalent to calling ``renderer1.draw_path(gc, *args, **kwargs)``
+ where ``renderer1`` and ``gc`` have been suitably set from ``renderer``
+ and the artist's properties.
+ """
+
+ renderer.open_group('patch', self.get_gid())
+ gc = renderer.new_gc()
+
+ gc.set_foreground(self._edgecolor, isRGBA=True)
+
+ lw = self._linewidth
+ if self._edgecolor[3] == 0 or self._linestyle == 'None':
+ lw = 0
+ gc.set_linewidth(lw)
+ gc.set_dashes(self._dashoffset, self._dashes)
+ gc.set_capstyle(self._capstyle)
+ gc.set_joinstyle(self._joinstyle)
+
+ gc.set_antialiased(self._antialiased)
+ self._set_gc_clip(gc)
+ gc.set_url(self._url)
+ gc.set_snap(self.get_snap())
+
+ gc.set_alpha(self._alpha)
+
+ if self._hatch:
+ gc.set_hatch(self._hatch)
+ gc.set_hatch_color(self._hatch_color)
+
+ if self.get_sketch_params() is not None:
+ gc.set_sketch_params(*self.get_sketch_params())
+
+ if self.get_path_effects():
+ from matplotlib.patheffects import PathEffectRenderer
+ renderer = PathEffectRenderer(self.get_path_effects(), renderer)
+
+ # In `with _bind_draw_path_function(renderer) as draw_path: ...`
+ # (in the implementations of `draw()` below), calls to `draw_path(...)`
+ # will occur as if they took place here with `gc` inserted as
+ # additional first argument.
+ yield functools.partial(renderer.draw_path, gc)
+
+ gc.restore()
+ renderer.close_group('patch')
+ self.stale = False
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ # docstring inherited
+ if not self.get_visible():
+ return
+ # Patch has traditionally ignored the dashoffset.
+ with cbook._setattr_cm(self, _dashoffset=0), \
+ self._bind_draw_path_function(renderer) as draw_path:
+ path = self.get_path()
+ transform = self.get_transform()
+ tpath = transform.transform_path_non_affine(path)
+ affine = transform.get_affine()
+ draw_path(tpath, affine,
+ # Work around a bug in the PDF and SVG renderers, which
+ # do not draw the hatches if the facecolor is fully
+ # transparent, but do if it is None.
+ self._facecolor if self._facecolor[3] else None)
+
+ def get_path(self):
+ """Return the path of this patch."""
+ raise NotImplementedError('Derived must override')
+
+ def get_window_extent(self, renderer=None):
+ return self.get_path().get_extents(self.get_transform())
+
+ def _convert_xy_units(self, xy):
+ """Convert x and y units for a tuple (x, y)."""
+ x = self.convert_xunits(xy[0])
+ y = self.convert_yunits(xy[1])
+ return x, y
+
+
+_patch_kwdoc = artist.kwdoc(Patch)
+for k in ['Rectangle', 'Circle', 'RegularPolygon', 'Polygon', 'Wedge', 'Arrow',
+ 'FancyArrow', 'CirclePolygon', 'Ellipse', 'Arc', 'FancyBboxPatch',
+ 'Patch']:
+ docstring.interpd.update({f'{k}_kwdoc': _patch_kwdoc})
+
+# define Patch.__init__ docstring after the class has been added to interpd
+docstring.dedent_interpd(Patch.__init__)
+
+
+class Shadow(Patch):
+ def __str__(self):
+ return "Shadow(%s)" % (str(self.patch))
+
+ @_api.delete_parameter("3.3", "props")
+ @docstring.dedent_interpd
+ def __init__(self, patch, ox, oy, props=None, **kwargs):
+ """
+ Create a shadow of the given *patch*.
+
+ By default, the shadow will have the same face color as the *patch*,
+ but darkened.
+
+ Parameters
+ ----------
+ patch : `.Patch`
+ The patch to create the shadow for.
+ ox, oy : float
+ The shift of the shadow in data coordinates, scaled by a factor
+ of dpi/72.
+ props : dict
+ *deprecated (use kwargs instead)* Properties of the shadow patch.
+ **kwargs
+ Properties of the shadow patch. Supported keys are:
+
+ %(Patch_kwdoc)s
+ """
+ super().__init__()
+ self.patch = patch
+ # Note: when removing props, we can directly pass kwargs to _update()
+ # and remove self._props
+ if props is None:
+ color = .3 * np.asarray(colors.to_rgb(self.patch.get_facecolor()))
+ props = {
+ 'facecolor': color,
+ 'edgecolor': color,
+ 'alpha': 0.5,
+ }
+ self._props = {**props, **kwargs}
+ self._ox, self._oy = ox, oy
+ self._shadow_transform = transforms.Affine2D()
+ self._update()
+
+ props = _api.deprecate_privatize_attribute("3.3")
+
+ def _update(self):
+ self.update_from(self.patch)
+
+ # Place the shadow patch directly behind the inherited patch.
+ self.set_zorder(np.nextafter(self.patch.zorder, -np.inf))
+
+ self.update(self._props)
+
+ def _update_transform(self, renderer):
+ ox = renderer.points_to_pixels(self._ox)
+ oy = renderer.points_to_pixels(self._oy)
+ self._shadow_transform.clear().translate(ox, oy)
+
+ def get_path(self):
+ return self.patch.get_path()
+
+ def get_patch_transform(self):
+ return self.patch.get_patch_transform() + self._shadow_transform
+
+ def draw(self, renderer):
+ self._update_transform(renderer)
+ super().draw(renderer)
+
+
+class Rectangle(Patch):
+ """
+ A rectangle defined via an anchor point *xy* and its *width* and *height*.
+
+ The rectangle extends from ``xy[0]`` to ``xy[0] + width`` in x-direction
+ and from ``xy[1]`` to ``xy[1] + height`` in y-direction. ::
+
+ : +------------------+
+ : | |
+ : height |
+ : | |
+ : (xy)---- width -----+
+
+ One may picture *xy* as the bottom left corner, but which corner *xy* is
+ actually depends on the the direction of the axis and the sign of *width*
+ and *height*; e.g. *xy* would be the bottom right corner if the x-axis
+ was inverted or if *width* was negative.
+ """
+
+ def __str__(self):
+ pars = self._x0, self._y0, self._width, self._height, self.angle
+ fmt = "Rectangle(xy=(%g, %g), width=%g, height=%g, angle=%g)"
+ return fmt % pars
+
+ @docstring.dedent_interpd
+ def __init__(self, xy, width, height, angle=0.0, **kwargs):
+ """
+ Parameters
+ ----------
+ xy : (float, float)
+ The anchor point.
+ width : float
+ Rectangle width.
+ height : float
+ Rectangle height.
+ angle : float, default: 0
+ Rotation in degrees anti-clockwise about *xy*.
+
+ Other Parameters
+ ----------------
+ **kwargs : `.Patch` properties
+ %(Patch_kwdoc)s
+ """
+ super().__init__(**kwargs)
+ self._x0 = xy[0]
+ self._y0 = xy[1]
+ self._width = width
+ self._height = height
+ self.angle = float(angle)
+ self._convert_units() # Validate the inputs.
+
+ def get_path(self):
+ """Return the vertices of the rectangle."""
+ return Path.unit_rectangle()
+
+ def _convert_units(self):
+ """Convert bounds of the rectangle."""
+ x0 = self.convert_xunits(self._x0)
+ y0 = self.convert_yunits(self._y0)
+ x1 = self.convert_xunits(self._x0 + self._width)
+ y1 = self.convert_yunits(self._y0 + self._height)
+ return x0, y0, x1, y1
+
+ def get_patch_transform(self):
+ # Note: This cannot be called until after this has been added to
+ # an Axes, otherwise unit conversion will fail. This makes it very
+ # important to call the accessor method and not directly access the
+ # transformation member variable.
+ bbox = self.get_bbox()
+ return (transforms.BboxTransformTo(bbox)
+ + transforms.Affine2D().rotate_deg_around(
+ bbox.x0, bbox.y0, self.angle))
+
+ def get_x(self):
+ """Return the left coordinate of the rectangle."""
+ return self._x0
+
+ def get_y(self):
+ """Return the bottom coordinate of the rectangle."""
+ return self._y0
+
+ def get_xy(self):
+ """Return the left and bottom coords of the rectangle as a tuple."""
+ return self._x0, self._y0
+
+ def get_width(self):
+ """Return the width of the rectangle."""
+ return self._width
+
+ def get_height(self):
+ """Return the height of the rectangle."""
+ return self._height
+
+ def set_x(self, x):
+ """Set the left coordinate of the rectangle."""
+ self._x0 = x
+ self.stale = True
+
+ def set_y(self, y):
+ """Set the bottom coordinate of the rectangle."""
+ self._y0 = y
+ self.stale = True
+
+ def set_xy(self, xy):
+ """
+ Set the left and bottom coordinates of the rectangle.
+
+ Parameters
+ ----------
+ xy : (float, float)
+ """
+ self._x0, self._y0 = xy
+ self.stale = True
+
+ def set_width(self, w):
+ """Set the width of the rectangle."""
+ self._width = w
+ self.stale = True
+
+ def set_height(self, h):
+ """Set the height of the rectangle."""
+ self._height = h
+ self.stale = True
+
+ def set_bounds(self, *args):
+ """
+ Set the bounds of the rectangle as *left*, *bottom*, *width*, *height*.
+
+ The values may be passed as separate parameters or as a tuple::
+
+ set_bounds(left, bottom, width, height)
+ set_bounds((left, bottom, width, height))
+
+ .. ACCEPTS: (left, bottom, width, height)
+ """
+ if len(args) == 1:
+ l, b, w, h = args[0]
+ else:
+ l, b, w, h = args
+ self._x0 = l
+ self._y0 = b
+ self._width = w
+ self._height = h
+ self.stale = True
+
+ def get_bbox(self):
+ """Return the `.Bbox`."""
+ x0, y0, x1, y1 = self._convert_units()
+ return transforms.Bbox.from_extents(x0, y0, x1, y1)
+
+ xy = property(get_xy, set_xy)
+
+
+class RegularPolygon(Patch):
+ """A regular polygon patch."""
+
+ def __str__(self):
+ s = "RegularPolygon((%g, %g), %d, radius=%g, orientation=%g)"
+ return s % (self.xy[0], self.xy[1], self.numvertices, self.radius,
+ self.orientation)
+
+ @docstring.dedent_interpd
+ def __init__(self, xy, numVertices, radius=5, orientation=0,
+ **kwargs):
+ """
+ Parameters
+ ----------
+ xy : (float, float)
+ The center position.
+
+ numVertices : int
+ The number of vertices.
+
+ radius : float
+ The distance from the center to each of the vertices.
+
+ orientation : float
+ The polygon rotation angle (in radians).
+
+ **kwargs
+ `Patch` properties:
+
+ %(Patch_kwdoc)s
+ """
+ self.xy = xy
+ self.numvertices = numVertices
+ self.orientation = orientation
+ self.radius = radius
+ self._path = Path.unit_regular_polygon(numVertices)
+ self._patch_transform = transforms.Affine2D()
+ super().__init__(**kwargs)
+
+ def get_path(self):
+ return self._path
+
+ def get_patch_transform(self):
+ return self._patch_transform.clear() \
+ .scale(self.radius) \
+ .rotate(self.orientation) \
+ .translate(*self.xy)
+
+
+class PathPatch(Patch):
+ """A general polycurve path patch."""
+
+ _edge_default = True
+
+ def __str__(self):
+ s = "PathPatch%d((%g, %g) ...)"
+ return s % (len(self._path.vertices), *tuple(self._path.vertices[0]))
+
+ @docstring.dedent_interpd
+ def __init__(self, path, **kwargs):
+ """
+ *path* is a `~.path.Path` object.
+
+ Valid keyword arguments are:
+
+ %(Patch_kwdoc)s
+ """
+ super().__init__(**kwargs)
+ self._path = path
+
+ def get_path(self):
+ return self._path
+
+ def set_path(self, path):
+ self._path = path
+
+
+class StepPatch(PathPatch):
+ """
+ A path patch describing a stepwise constant function.
+
+ By default the path is not closed and starts and stops at
+ baseline value.
+ """
+
+ _edge_default = False
+
+ @docstring.dedent_interpd
+ def __init__(self, values, edges, *,
+ orientation='vertical', baseline=0, **kwargs):
+ """
+ Parameters
+ ----------
+ values : array-like
+ The step heights.
+
+ edges : array-like
+ The edge positions, with ``len(edges) == len(vals) + 1``,
+ between which the curve takes on vals values.
+
+ orientation : {'vertical', 'horizontal'}, default: 'vertical'
+ The direction of the steps. Vertical means that *values* are
+ along the y-axis, and edges are along the x-axis.
+
+ baseline : float, array-like or None, default: 0
+ The bottom value of the bounding edges or when
+ ``fill=True``, position of lower edge. If *fill* is
+ True or an array is passed to *baseline*, a closed
+ path is drawn.
+
+ Other valid keyword arguments are:
+
+ %(Patch_kwdoc)s
+ """
+ self.orientation = orientation
+ self._edges = np.asarray(edges)
+ self._values = np.asarray(values)
+ self._baseline = np.asarray(baseline) if baseline is not None else None
+ self._update_path()
+ super().__init__(self._path, **kwargs)
+
+ def _update_path(self):
+ if np.isnan(np.sum(self._edges)):
+ raise ValueError('Nan values in "edges" are disallowed')
+ if self._edges.size - 1 != self._values.size:
+ raise ValueError('Size mismatch between "values" and "edges". '
+ "Expected `len(values) + 1 == len(edges)`, but "
+ f"`len(values) = {self._values.size}` and "
+ f"`len(edges) = {self._edges.size}`.")
+ # Initializing with empty arrays allows supporting empty stairs.
+ verts, codes = [np.empty((0, 2))], [np.empty(0, dtype=Path.code_type)]
+
+ _nan_mask = np.isnan(self._values)
+ if self._baseline is not None:
+ _nan_mask |= np.isnan(self._baseline)
+ for idx0, idx1 in cbook.contiguous_regions(~_nan_mask):
+ x = np.repeat(self._edges[idx0:idx1+1], 2)
+ y = np.repeat(self._values[idx0:idx1], 2)
+ if self._baseline is None:
+ y = np.concatenate([y[:1], y, y[-1:]])
+ elif self._baseline.ndim == 0: # single baseline value
+ y = np.concatenate([[self._baseline], y, [self._baseline]])
+ elif self._baseline.ndim == 1: # baseline array
+ base = np.repeat(self._baseline[idx0:idx1], 2)[::-1]
+ x = np.concatenate([x, x[::-1]])
+ y = np.concatenate([base[-1:], y, base[:1],
+ base[:1], base, base[-1:]])
+ else: # no baseline
+ raise ValueError('Invalid `baseline` specified')
+ if self.orientation == 'vertical':
+ xy = np.column_stack([x, y])
+ else:
+ xy = np.column_stack([y, x])
+ verts.append(xy)
+ codes.append([Path.MOVETO] + [Path.LINETO]*(len(xy)-1))
+ self._path = Path(np.concatenate(verts), np.concatenate(codes))
+
+ def get_data(self):
+ """Get `.StepPatch` values, edges and baseline as namedtuple."""
+ StairData = namedtuple('StairData', 'values edges baseline')
+ return StairData(self._values, self._edges, self._baseline)
+
+ def set_data(self, values=None, edges=None, baseline=None):
+ """
+ Set `.StepPatch` values, edges and baseline.
+
+ Parameters
+ ----------
+ values : 1D array-like or None
+ Will not update values, if passing None
+ edges : 1D array-like, optional
+ baseline : float, 1D array-like or None
+ """
+ if values is None and edges is None and baseline is None:
+ raise ValueError("Must set *values*, *edges* or *baseline*.")
+ if values is not None:
+ self._values = np.asarray(values)
+ if edges is not None:
+ self._edges = np.asarray(edges)
+ if baseline is not None:
+ self._baseline = np.asarray(baseline)
+ self._update_path()
+ self.stale = True
+
+
+class Polygon(Patch):
+ """A general polygon patch."""
+
+ def __str__(self):
+ s = "Polygon%d((%g, %g) ...)"
+ return s % (len(self._path.vertices), *tuple(self._path.vertices[0]))
+
+ @docstring.dedent_interpd
+ def __init__(self, xy, closed=True, **kwargs):
+ """
+ *xy* is a numpy array with shape Nx2.
+
+ If *closed* is *True*, the polygon will be closed so the
+ starting and ending points are the same.
+
+ Valid keyword arguments are:
+
+ %(Patch_kwdoc)s
+ """
+ super().__init__(**kwargs)
+ self._closed = closed
+ self.set_xy(xy)
+
+ def get_path(self):
+ """Get the `.Path` of the polygon."""
+ return self._path
+
+ def get_closed(self):
+ """Return whether the polygon is closed."""
+ return self._closed
+
+ def set_closed(self, closed):
+ """
+ Set whether the polygon is closed.
+
+ Parameters
+ ----------
+ closed : bool
+ True if the polygon is closed
+ """
+ if self._closed == bool(closed):
+ return
+ self._closed = bool(closed)
+ self.set_xy(self.get_xy())
+ self.stale = True
+
+ def get_xy(self):
+ """
+ Get the vertices of the path.
+
+ Returns
+ -------
+ (N, 2) numpy array
+ The coordinates of the vertices.
+ """
+ return self._path.vertices
+
+ def set_xy(self, xy):
+ """
+ Set the vertices of the polygon.
+
+ Parameters
+ ----------
+ xy : (N, 2) array-like
+ The coordinates of the vertices.
+
+ Notes
+ -----
+ Unlike `~.path.Path`, we do not ignore the last input vertex. If the
+ polygon is meant to be closed, and the last point of the polygon is not
+ equal to the first, we assume that the user has not explicitly passed a
+ ``CLOSEPOLY`` vertex, and add it ourselves.
+ """
+ xy = np.asarray(xy)
+ nverts, _ = xy.shape
+ if self._closed:
+ # if the first and last vertex are the "same", then we assume that
+ # the user explicitly passed the CLOSEPOLY vertex. Otherwise, we
+ # have to append one since the last vertex will be "ignored" by
+ # Path
+ if nverts == 1 or nverts > 1 and (xy[0] != xy[-1]).any():
+ xy = np.concatenate([xy, [xy[0]]])
+ else:
+ # if we aren't closed, and the last vertex matches the first, then
+ # we assume we have an unnecessary CLOSEPOLY vertex and remove it
+ if nverts > 2 and (xy[0] == xy[-1]).all():
+ xy = xy[:-1]
+ self._path = Path(xy, closed=self._closed)
+ self.stale = True
+
+ xy = property(get_xy, set_xy,
+ doc='The vertices of the path as (N, 2) numpy array.')
+
+
+class Wedge(Patch):
+ """Wedge shaped patch."""
+
+ def __str__(self):
+ pars = (self.center[0], self.center[1], self.r,
+ self.theta1, self.theta2, self.width)
+ fmt = "Wedge(center=(%g, %g), r=%g, theta1=%g, theta2=%g, width=%s)"
+ return fmt % pars
+
+ @docstring.dedent_interpd
+ def __init__(self, center, r, theta1, theta2, width=None, **kwargs):
+ """
+ A wedge centered at *x*, *y* center with radius *r* that
+ sweeps *theta1* to *theta2* (in degrees). If *width* is given,
+ then a partial wedge is drawn from inner radius *r* - *width*
+ to outer radius *r*.
+
+ Valid keyword arguments are:
+
+ %(Patch_kwdoc)s
+ """
+ super().__init__(**kwargs)
+ self.center = center
+ self.r, self.width = r, width
+ self.theta1, self.theta2 = theta1, theta2
+ self._patch_transform = transforms.IdentityTransform()
+ self._recompute_path()
+
+ def _recompute_path(self):
+ # Inner and outer rings are connected unless the annulus is complete
+ if abs((self.theta2 - self.theta1) - 360) <= 1e-12:
+ theta1, theta2 = 0, 360
+ connector = Path.MOVETO
+ else:
+ theta1, theta2 = self.theta1, self.theta2
+ connector = Path.LINETO
+
+ # Form the outer ring
+ arc = Path.arc(theta1, theta2)
+
+ if self.width is not None:
+ # Partial annulus needs to draw the outer ring
+ # followed by a reversed and scaled inner ring
+ v1 = arc.vertices
+ v2 = arc.vertices[::-1] * (self.r - self.width) / self.r
+ v = np.concatenate([v1, v2, [v1[0, :], (0, 0)]])
+ c = np.concatenate([
+ arc.codes, arc.codes, [connector, Path.CLOSEPOLY]])
+ c[len(arc.codes)] = connector
+ else:
+ # Wedge doesn't need an inner ring
+ v = np.concatenate([
+ arc.vertices, [(0, 0), arc.vertices[0, :], (0, 0)]])
+ c = np.concatenate([
+ arc.codes, [connector, connector, Path.CLOSEPOLY]])
+
+ # Shift and scale the wedge to the final location.
+ v *= self.r
+ v += np.asarray(self.center)
+ self._path = Path(v, c)
+
+ def set_center(self, center):
+ self._path = None
+ self.center = center
+ self.stale = True
+
+ def set_radius(self, radius):
+ self._path = None
+ self.r = radius
+ self.stale = True
+
+ def set_theta1(self, theta1):
+ self._path = None
+ self.theta1 = theta1
+ self.stale = True
+
+ def set_theta2(self, theta2):
+ self._path = None
+ self.theta2 = theta2
+ self.stale = True
+
+ def set_width(self, width):
+ self._path = None
+ self.width = width
+ self.stale = True
+
+ def get_path(self):
+ if self._path is None:
+ self._recompute_path()
+ return self._path
+
+
+# COVERAGE NOTE: Not used internally or from examples
+class Arrow(Patch):
+ """An arrow patch."""
+
+ def __str__(self):
+ return "Arrow()"
+
+ _path = Path([[0.0, 0.1], [0.0, -0.1],
+ [0.8, -0.1], [0.8, -0.3],
+ [1.0, 0.0], [0.8, 0.3],
+ [0.8, 0.1], [0.0, 0.1]],
+ closed=True)
+
+ @docstring.dedent_interpd
+ def __init__(self, x, y, dx, dy, width=1.0, **kwargs):
+ """
+ Draws an arrow from (*x*, *y*) to (*x* + *dx*, *y* + *dy*).
+ The width of the arrow is scaled by *width*.
+
+ Parameters
+ ----------
+ x : float
+ x coordinate of the arrow tail.
+ y : float
+ y coordinate of the arrow tail.
+ dx : float
+ Arrow length in the x direction.
+ dy : float
+ Arrow length in the y direction.
+ width : float, default: 1
+ Scale factor for the width of the arrow. With a default value of 1,
+ the tail width is 0.2 and head width is 0.6.
+ **kwargs
+ Keyword arguments control the `Patch` properties:
+
+ %(Patch_kwdoc)s
+
+ See Also
+ --------
+ FancyArrow
+ Patch that allows independent control of the head and tail
+ properties.
+ """
+ super().__init__(**kwargs)
+ self._patch_transform = (
+ transforms.Affine2D()
+ .scale(np.hypot(dx, dy), width)
+ .rotate(np.arctan2(dy, dx))
+ .translate(x, y)
+ .frozen())
+
+ def get_path(self):
+ return self._path
+
+ def get_patch_transform(self):
+ return self._patch_transform
+
+
+class FancyArrow(Polygon):
+ """
+ Like Arrow, but lets you set head width and head height independently.
+ """
+
+ _edge_default = True
+
+ def __str__(self):
+ return "FancyArrow()"
+
+ @docstring.dedent_interpd
+ def __init__(self, x, y, dx, dy, width=0.001, length_includes_head=False,
+ head_width=None, head_length=None, shape='full', overhang=0,
+ head_starts_at_zero=False, **kwargs):
+ """
+ Parameters
+ ----------
+ width : float, default: 0.001
+ Width of full arrow tail.
+
+ length_includes_head : bool, default: False
+ True if head is to be counted in calculating the length.
+
+ head_width : float or None, default: 3*width
+ Total width of the full arrow head.
+
+ head_length : float or None, default: 1.5*head_width
+ Length of arrow head.
+
+ shape : {'full', 'left', 'right'}, default: 'full'
+ Draw the left-half, right-half, or full arrow.
+
+ overhang : float, default: 0
+ Fraction that the arrow is swept back (0 overhang means
+ triangular shape). Can be negative or greater than one.
+
+ head_starts_at_zero : bool, default: False
+ If True, the head starts being drawn at coordinate 0
+ instead of ending at coordinate 0.
+
+ **kwargs
+ `.Patch` properties:
+
+ %(Patch_kwdoc)s
+ """
+ if head_width is None:
+ head_width = 3 * width
+ if head_length is None:
+ head_length = 1.5 * head_width
+
+ distance = np.hypot(dx, dy)
+
+ if length_includes_head:
+ length = distance
+ else:
+ length = distance + head_length
+ if not length:
+ verts = np.empty([0, 2]) # display nothing if empty
+ else:
+ # start by drawing horizontal arrow, point at (0, 0)
+ hw, hl, hs, lw = head_width, head_length, overhang, width
+ left_half_arrow = np.array([
+ [0.0, 0.0], # tip
+ [-hl, -hw / 2], # leftmost
+ [-hl * (1 - hs), -lw / 2], # meets stem
+ [-length, -lw / 2], # bottom left
+ [-length, 0],
+ ])
+ # if we're not including the head, shift up by head length
+ if not length_includes_head:
+ left_half_arrow += [head_length, 0]
+ # if the head starts at 0, shift up by another head length
+ if head_starts_at_zero:
+ left_half_arrow += [head_length / 2, 0]
+ # figure out the shape, and complete accordingly
+ if shape == 'left':
+ coords = left_half_arrow
+ else:
+ right_half_arrow = left_half_arrow * [1, -1]
+ if shape == 'right':
+ coords = right_half_arrow
+ elif shape == 'full':
+ # The half-arrows contain the midpoint of the stem,
+ # which we can omit from the full arrow. Including it
+ # twice caused a problem with xpdf.
+ coords = np.concatenate([left_half_arrow[:-1],
+ right_half_arrow[-2::-1]])
+ else:
+ raise ValueError("Got unknown shape: %s" % shape)
+ if distance != 0:
+ cx = dx / distance
+ sx = dy / distance
+ else:
+ # Account for division by zero
+ cx, sx = 0, 1
+ M = [[cx, sx], [-sx, cx]]
+ verts = np.dot(coords, M) + (x + dx, y + dy)
+
+ super().__init__(verts, closed=True, **kwargs)
+
+
+docstring.interpd.update(
+ FancyArrow="\n".join(inspect.getdoc(FancyArrow.__init__).splitlines()[2:]))
+
+
+class CirclePolygon(RegularPolygon):
+ """A polygon-approximation of a circle patch."""
+
+ def __str__(self):
+ s = "CirclePolygon((%g, %g), radius=%g, resolution=%d)"
+ return s % (self.xy[0], self.xy[1], self.radius, self.numvertices)
+
+ @docstring.dedent_interpd
+ def __init__(self, xy, radius=5,
+ resolution=20, # the number of vertices
+ ** kwargs):
+ """
+ Create a circle at *xy* = (*x*, *y*) with given *radius*.
+
+ This circle is approximated by a regular polygon with *resolution*
+ sides. For a smoother circle drawn with splines, see `Circle`.
+
+ Valid keyword arguments are:
+
+ %(Patch_kwdoc)s
+ """
+ super().__init__(xy, resolution, radius, orientation=0, **kwargs)
+
+
+class Ellipse(Patch):
+ """A scale-free ellipse."""
+
+ def __str__(self):
+ pars = (self._center[0], self._center[1],
+ self.width, self.height, self.angle)
+ fmt = "Ellipse(xy=(%s, %s), width=%s, height=%s, angle=%s)"
+ return fmt % pars
+
+ @docstring.dedent_interpd
+ def __init__(self, xy, width, height, angle=0, **kwargs):
+ """
+ Parameters
+ ----------
+ xy : (float, float)
+ xy coordinates of ellipse centre.
+ width : float
+ Total length (diameter) of horizontal axis.
+ height : float
+ Total length (diameter) of vertical axis.
+ angle : float, default: 0
+ Rotation in degrees anti-clockwise.
+
+ Notes
+ -----
+ Valid keyword arguments are:
+
+ %(Patch_kwdoc)s
+ """
+ super().__init__(**kwargs)
+
+ self._center = xy
+ self._width, self._height = width, height
+ self._angle = angle
+ self._path = Path.unit_circle()
+ # Note: This cannot be calculated until this is added to an Axes
+ self._patch_transform = transforms.IdentityTransform()
+
+ def _recompute_transform(self):
+ """
+ Notes
+ -----
+ This cannot be called until after this has been added to an Axes,
+ otherwise unit conversion will fail. This makes it very important to
+ call the accessor method and not directly access the transformation
+ member variable.
+ """
+ center = (self.convert_xunits(self._center[0]),
+ self.convert_yunits(self._center[1]))
+ width = self.convert_xunits(self._width)
+ height = self.convert_yunits(self._height)
+ self._patch_transform = transforms.Affine2D() \
+ .scale(width * 0.5, height * 0.5) \
+ .rotate_deg(self.angle) \
+ .translate(*center)
+
+ def get_path(self):
+ """Return the path of the ellipse."""
+ return self._path
+
+ def get_patch_transform(self):
+ self._recompute_transform()
+ return self._patch_transform
+
+ def set_center(self, xy):
+ """
+ Set the center of the ellipse.
+
+ Parameters
+ ----------
+ xy : (float, float)
+ """
+ self._center = xy
+ self.stale = True
+
+ def get_center(self):
+ """Return the center of the ellipse."""
+ return self._center
+
+ center = property(get_center, set_center)
+
+ def set_width(self, width):
+ """
+ Set the width of the ellipse.
+
+ Parameters
+ ----------
+ width : float
+ """
+ self._width = width
+ self.stale = True
+
+ def get_width(self):
+ """
+ Return the width of the ellipse.
+ """
+ return self._width
+
+ width = property(get_width, set_width)
+
+ def set_height(self, height):
+ """
+ Set the height of the ellipse.
+
+ Parameters
+ ----------
+ height : float
+ """
+ self._height = height
+ self.stale = True
+
+ def get_height(self):
+ """Return the height of the ellipse."""
+ return self._height
+
+ height = property(get_height, set_height)
+
+ def set_angle(self, angle):
+ """
+ Set the angle of the ellipse.
+
+ Parameters
+ ----------
+ angle : float
+ """
+ self._angle = angle
+ self.stale = True
+
+ def get_angle(self):
+ """Return the angle of the ellipse."""
+ return self._angle
+
+ angle = property(get_angle, set_angle)
+
+
+class Circle(Ellipse):
+ """A circle patch."""
+
+ def __str__(self):
+ pars = self.center[0], self.center[1], self.radius
+ fmt = "Circle(xy=(%g, %g), radius=%g)"
+ return fmt % pars
+
+ @docstring.dedent_interpd
+ def __init__(self, xy, radius=5, **kwargs):
+ """
+ Create a true circle at center *xy* = (*x*, *y*) with given *radius*.
+
+ Unlike `CirclePolygon` which is a polygonal approximation, this uses
+ Bezier splines and is much closer to a scale-free circle.
+
+ Valid keyword arguments are:
+
+ %(Patch_kwdoc)s
+ """
+ super().__init__(xy, radius * 2, radius * 2, **kwargs)
+ self.radius = radius
+
+ def set_radius(self, radius):
+ """
+ Set the radius of the circle.
+
+ Parameters
+ ----------
+ radius : float
+ """
+ self.width = self.height = 2 * radius
+ self.stale = True
+
+ def get_radius(self):
+ """Return the radius of the circle."""
+ return self.width / 2.
+
+ radius = property(get_radius, set_radius)
+
+
+class Arc(Ellipse):
+ """
+ An elliptical arc, i.e. a segment of an ellipse.
+
+ Due to internal optimizations, there are certain restrictions on using Arc:
+
+ - The arc cannot be filled.
+
+ - The arc must be used in an `~.axes.Axes` instance. It can not be added
+ directly to a `.Figure` because it is optimized to only render the
+ segments that are inside the axes bounding box with high resolution.
+ """
+ def __str__(self):
+ pars = (self.center[0], self.center[1], self.width,
+ self.height, self.angle, self.theta1, self.theta2)
+ fmt = ("Arc(xy=(%g, %g), width=%g, "
+ "height=%g, angle=%g, theta1=%g, theta2=%g)")
+ return fmt % pars
+
+ @docstring.dedent_interpd
+ def __init__(self, xy, width, height, angle=0.0,
+ theta1=0.0, theta2=360.0, **kwargs):
+ """
+ Parameters
+ ----------
+ xy : (float, float)
+ The center of the ellipse.
+
+ width : float
+ The length of the horizontal axis.
+
+ height : float
+ The length of the vertical axis.
+
+ angle : float
+ Rotation of the ellipse in degrees (counterclockwise).
+
+ theta1, theta2 : float, default: 0, 360
+ Starting and ending angles of the arc in degrees. These values
+ are relative to *angle*, e.g. if *angle* = 45 and *theta1* = 90
+ the absolute starting angle is 135.
+ Default *theta1* = 0, *theta2* = 360, i.e. a complete ellipse.
+ The arc is drawn in the counterclockwise direction.
+ Angles greater than or equal to 360, or smaller than 0, are
+ represented by an equivalent angle in the range [0, 360), by
+ taking the input value mod 360.
+
+ Other Parameters
+ ----------------
+ **kwargs : `.Patch` properties
+ Most `.Patch` properties are supported as keyword arguments,
+ with the exception of *fill* and *facecolor* because filling is
+ not supported.
+
+ %(Patch_kwdoc)s
+ """
+ fill = kwargs.setdefault('fill', False)
+ if fill:
+ raise ValueError("Arc objects can not be filled")
+
+ super().__init__(xy, width, height, angle, **kwargs)
+
+ self.theta1 = theta1
+ self.theta2 = theta2
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ """
+ Draw the arc to the given *renderer*.
+
+ Notes
+ -----
+ Ellipses are normally drawn using an approximation that uses
+ eight cubic Bezier splines. The error of this approximation
+ is 1.89818e-6, according to this unverified source:
+
+ Lancaster, Don. *Approximating a Circle or an Ellipse Using
+ Four Bezier Cubic Splines.*
+
+ https://www.tinaja.com/glib/ellipse4.pdf
+
+ There is a use case where very large ellipses must be drawn
+ with very high accuracy, and it is too expensive to render the
+ entire ellipse with enough segments (either splines or line
+ segments). Therefore, in the case where either radius of the
+ ellipse is large enough that the error of the spline
+ approximation will be visible (greater than one pixel offset
+ from the ideal), a different technique is used.
+
+ In that case, only the visible parts of the ellipse are drawn,
+ with each visible arc using a fixed number of spline segments
+ (8). The algorithm proceeds as follows:
+
+ 1. The points where the ellipse intersects the axes bounding
+ box are located. (This is done be performing an inverse
+ transformation on the axes bbox such that it is relative
+ to the unit circle -- this makes the intersection
+ calculation much easier than doing rotated ellipse
+ intersection directly).
+
+ This uses the "line intersecting a circle" algorithm from:
+
+ Vince, John. *Geometry for Computer Graphics: Formulae,
+ Examples & Proofs.* London: Springer-Verlag, 2005.
+
+ 2. The angles of each of the intersection points are calculated.
+
+ 3. Proceeding counterclockwise starting in the positive
+ x-direction, each of the visible arc-segments between the
+ pairs of vertices are drawn using the Bezier arc
+ approximation technique implemented in `.Path.arc`.
+ """
+ if not hasattr(self, 'axes'):
+ raise RuntimeError('Arcs can only be used in Axes instances')
+ if not self.get_visible():
+ return
+
+ self._recompute_transform()
+
+ width = self.convert_xunits(self.width)
+ height = self.convert_yunits(self.height)
+
+ # If the width and height of ellipse are not equal, take into account
+ # stretching when calculating angles to draw between
+ def theta_stretch(theta, scale):
+ theta = np.deg2rad(theta)
+ x = np.cos(theta)
+ y = np.sin(theta)
+ stheta = np.rad2deg(np.arctan2(scale * y, x))
+ # arctan2 has the range [-pi, pi], we expect [0, 2*pi]
+ return (stheta + 360) % 360
+
+ theta1 = self.theta1
+ theta2 = self.theta2
+
+ if (
+ # if we need to stretch the angles because we are distorted
+ width != height
+ # and we are not doing a full circle.
+ #
+ # 0 and 360 do not exactly round-trip through the angle
+ # stretching (due to both float precision limitations and
+ # the difference between the range of arctan2 [-pi, pi] and
+ # this method [0, 360]) so avoid doing it if we don't have to.
+ and not (theta1 != theta2 and theta1 % 360 == theta2 % 360)
+ ):
+ theta1 = theta_stretch(self.theta1, width / height)
+ theta2 = theta_stretch(self.theta2, width / height)
+
+ # Get width and height in pixels we need to use
+ # `self.get_data_transform` rather than `self.get_transform`
+ # because we want the transform from dataspace to the
+ # screen space to estimate how big the arc will be in physical
+ # units when rendered (the transform that we get via
+ # `self.get_transform()` goes from an idealized unit-radius
+ # space to screen space).
+ data_to_screen_trans = self.get_data_transform()
+ pwidth, pheight = (data_to_screen_trans.transform((width, height)) -
+ data_to_screen_trans.transform((0, 0)))
+ inv_error = (1.0 / 1.89818e-6) * 0.5
+
+ if pwidth < inv_error and pheight < inv_error:
+ self._path = Path.arc(theta1, theta2)
+ return Patch.draw(self, renderer)
+
+ def line_circle_intersect(x0, y0, x1, y1):
+ dx = x1 - x0
+ dy = y1 - y0
+ dr2 = dx * dx + dy * dy
+ D = x0 * y1 - x1 * y0
+ D2 = D * D
+ discrim = dr2 - D2
+ if discrim >= 0.0:
+ sign_dy = np.copysign(1, dy) # +/-1, never 0.
+ sqrt_discrim = np.sqrt(discrim)
+ return np.array(
+ [[(D * dy + sign_dy * dx * sqrt_discrim) / dr2,
+ (-D * dx + abs(dy) * sqrt_discrim) / dr2],
+ [(D * dy - sign_dy * dx * sqrt_discrim) / dr2,
+ (-D * dx - abs(dy) * sqrt_discrim) / dr2]])
+ else:
+ return np.empty((0, 2))
+
+ def segment_circle_intersect(x0, y0, x1, y1):
+ epsilon = 1e-9
+ if x1 < x0:
+ x0e, x1e = x1, x0
+ else:
+ x0e, x1e = x0, x1
+ if y1 < y0:
+ y0e, y1e = y1, y0
+ else:
+ y0e, y1e = y0, y1
+ xys = line_circle_intersect(x0, y0, x1, y1)
+ xs, ys = xys.T
+ return xys[
+ (x0e - epsilon < xs) & (xs < x1e + epsilon)
+ & (y0e - epsilon < ys) & (ys < y1e + epsilon)
+ ]
+
+ # Transforms the axes box_path so that it is relative to the unit
+ # circle in the same way that it is relative to the desired ellipse.
+ box_path_transform = (transforms.BboxTransformTo(self.axes.bbox)
+ + self.get_transform().inverted())
+ box_path = Path.unit_rectangle().transformed(box_path_transform)
+
+ thetas = set()
+ # For each of the point pairs, there is a line segment
+ for p0, p1 in zip(box_path.vertices[:-1], box_path.vertices[1:]):
+ xy = segment_circle_intersect(*p0, *p1)
+ x, y = xy.T
+ # arctan2 return [-pi, pi), the rest of our angles are in
+ # [0, 360], adjust as needed.
+ theta = (np.rad2deg(np.arctan2(y, x)) + 360) % 360
+ thetas.update(theta[(theta1 < theta) & (theta < theta2)])
+ thetas = sorted(thetas) + [theta2]
+ last_theta = theta1
+ theta1_rad = np.deg2rad(theta1)
+ inside = box_path.contains_point(
+ (np.cos(theta1_rad), np.sin(theta1_rad))
+ )
+
+ # save original path
+ path_original = self._path
+ for theta in thetas:
+ if inside:
+ self._path = Path.arc(last_theta, theta, 8)
+ Patch.draw(self, renderer)
+ inside = False
+ else:
+ inside = True
+ last_theta = theta
+
+ # restore original path
+ self._path = path_original
+
+
+def bbox_artist(artist, renderer, props=None, fill=True):
+ """
+ A debug function to draw a rectangle around the bounding
+ box returned by an artist's `.Artist.get_window_extent`
+ to test whether the artist is returning the correct bbox.
+
+ *props* is a dict of rectangle props with the additional property
+ 'pad' that sets the padding around the bbox in points.
+ """
+ if props is None:
+ props = {}
+ props = props.copy() # don't want to alter the pad externally
+ pad = props.pop('pad', 4)
+ pad = renderer.points_to_pixels(pad)
+ bbox = artist.get_window_extent(renderer)
+ r = Rectangle(
+ xy=(bbox.x0 - pad / 2, bbox.y0 - pad / 2),
+ width=bbox.width + pad, height=bbox.height + pad,
+ fill=fill, transform=transforms.IdentityTransform(), clip_on=False)
+ r.update(props)
+ r.draw(renderer)
+
+
+def draw_bbox(bbox, renderer, color='k', trans=None):
+ """
+ A debug function to draw a rectangle around the bounding
+ box returned by an artist's `.Artist.get_window_extent`
+ to test whether the artist is returning the correct bbox.
+ """
+ r = Rectangle(xy=(bbox.x0, bbox.y0), width=bbox.width, height=bbox.height,
+ edgecolor=color, fill=False, clip_on=False)
+ if trans is not None:
+ r.set_transform(trans)
+ r.draw(renderer)
+
+
+def _simpleprint_styles(_styles):
+ """
+ A helper function for the _Style class. Given the dictionary of
+ {stylename: styleclass}, return a string rep of the list of keys.
+ Used to update the documentation.
+ """
+ return "[{}]".format("|".join(map(" '{}' ".format, sorted(_styles))))
+
+
+class _Style:
+ """
+ A base class for the Styles. It is meant to be a container class,
+ where actual styles are declared as subclass of it, and it
+ provides some helper functions.
+ """
+ def __new__(cls, stylename, **kw):
+ """Return the instance of the subclass with the given style name."""
+
+ # The "class" should have the _style_list attribute, which is a mapping
+ # of style names to style classes.
+
+ _list = stylename.replace(" ", "").split(",")
+ _name = _list[0].lower()
+ try:
+ _cls = cls._style_list[_name]
+ except KeyError as err:
+ raise ValueError("Unknown style : %s" % stylename) from err
+
+ try:
+ _args_pair = [cs.split("=") for cs in _list[1:]]
+ _args = {k: float(v) for k, v in _args_pair}
+ except ValueError as err:
+ raise ValueError("Incorrect style argument : %s" %
+ stylename) from err
+ _args.update(kw)
+
+ return _cls(**_args)
+
+ @classmethod
+ def get_styles(cls):
+ """Return a dictionary of available styles."""
+ return cls._style_list
+
+ @classmethod
+ def pprint_styles(cls):
+ """Return the available styles as pretty-printed string."""
+ table = [('Class', 'Name', 'Attrs'),
+ *[(cls.__name__,
+ # Add backquotes, as - and | have special meaning in reST.
+ f'``{name}``',
+ # [1:-1] drops the surrounding parentheses.
+ str(inspect.signature(cls))[1:-1] or 'None')
+ for name, cls in sorted(cls._style_list.items())]]
+ # Convert to rst table.
+ col_len = [max(len(cell) for cell in column) for column in zip(*table)]
+ table_formatstr = ' '.join('=' * cl for cl in col_len)
+ rst_table = '\n'.join([
+ '',
+ table_formatstr,
+ ' '.join(cell.ljust(cl) for cell, cl in zip(table[0], col_len)),
+ table_formatstr,
+ *[' '.join(cell.ljust(cl) for cell, cl in zip(row, col_len))
+ for row in table[1:]],
+ table_formatstr,
+ '',
+ ])
+ return textwrap.indent(rst_table, prefix=' ' * 2)
+
+ @classmethod
+ def register(cls, name, style):
+ """Register a new style."""
+ if not issubclass(style, cls._Base):
+ raise ValueError("%s must be a subclass of %s" % (style,
+ cls._Base))
+ cls._style_list[name] = style
+
+
+def _register_style(style_list, cls=None, *, name=None):
+ """Class decorator that stashes a class in a (style) dictionary."""
+ if cls is None:
+ return functools.partial(_register_style, style_list, name=name)
+ style_list[name or cls.__name__.lower()] = cls
+ return cls
+
+
+class BoxStyle(_Style):
+ """
+ `BoxStyle` is a container class which defines several
+ boxstyle classes, which are used for `FancyBboxPatch`.
+
+ A style object can be created as::
+
+ BoxStyle.Round(pad=0.2)
+
+ or::
+
+ BoxStyle("Round", pad=0.2)
+
+ or::
+
+ BoxStyle("Round, pad=0.2")
+
+ The following boxstyle classes are defined.
+
+ %(AvailableBoxstyles)s
+
+ An instance of any boxstyle class is an callable object,
+ whose call signature is::
+
+ __call__(self, x0, y0, width, height, mutation_size)
+
+ and returns a `.Path` instance. *x0*, *y0*, *width* and
+ *height* specify the location and size of the box to be
+ drawn. *mutation_scale* determines the overall size of the
+ mutation (by which I mean the transformation of the rectangle to
+ the fancy box).
+ """
+
+ _style_list = {}
+
+ @_api.deprecated("3.4")
+ class _Base:
+ """
+ Abstract base class for styling of `.FancyBboxPatch`.
+
+ This class is not an artist itself. The `__call__` method returns the
+ `~matplotlib.path.Path` for outlining the fancy box. The actual drawing
+ is handled in `.FancyBboxPatch`.
+
+ Subclasses may only use parameters with default values in their
+ ``__init__`` method because they must be able to be initialized
+ without arguments.
+
+ Subclasses must implement the `__call__` method. It receives the
+ enclosing rectangle *x0, y0, width, height* as well as the
+ *mutation_size*, which scales the outline properties such as padding.
+ It returns the outline of the fancy box as `.path.Path`.
+ """
+
+ @_api.deprecated("3.4")
+ def transmute(self, x0, y0, width, height, mutation_size):
+ """Return the `~.path.Path` outlining the given rectangle."""
+ return self(self, x0, y0, width, height, mutation_size, 1)
+
+ # This can go away once the deprecation period elapses, leaving _Base
+ # as a fully abstract base class just providing docstrings, no logic.
+ def __init_subclass__(cls):
+ transmute = _api.deprecate_method_override(
+ __class__.transmute, cls, since="3.4")
+ if transmute:
+ cls.__call__ = transmute
+ return
+
+ __call__ = cls.__call__
+
+ @_api.delete_parameter("3.4", "mutation_aspect")
+ def call_wrapper(
+ self, x0, y0, width, height, mutation_size,
+ mutation_aspect=_api.deprecation._deprecated_parameter):
+ if mutation_aspect is _api.deprecation._deprecated_parameter:
+ # Don't trigger deprecation warning internally.
+ return __call__(self, x0, y0, width, height, mutation_size)
+ else:
+ # Squeeze the given height by the aspect_ratio.
+ y0, height = y0 / mutation_aspect, height / mutation_aspect
+ path = self(x0, y0, width, height, mutation_size,
+ mutation_aspect)
+ vertices, codes = path.vertices, path.codes
+ # Restore the height.
+ vertices[:, 1] = vertices[:, 1] * mutation_aspect
+ return Path(vertices, codes)
+
+ cls.__call__ = call_wrapper
+
+ def __call__(self, x0, y0, width, height, mutation_size):
+ """
+ Given the location and size of the box, return the path of
+ the box around it.
+
+ Parameters
+ ----------
+ x0, y0, width, height : float
+ Location and size of the box.
+ mutation_size : float
+ A reference scale for the mutation.
+
+ Returns
+ -------
+ `~matplotlib.path.Path`
+ """
+ raise NotImplementedError('Derived must override')
+
+ @_register_style(_style_list)
+ class Square(_Base):
+ """A square box."""
+
+ def __init__(self, pad=0.3):
+ """
+ Parameters
+ ----------
+ pad : float, default: 0.3
+ The amount of padding around the original box.
+ """
+ self.pad = pad
+
+ def __call__(self, x0, y0, width, height, mutation_size):
+ pad = mutation_size * self.pad
+ # width and height with padding added.
+ width, height = width + 2 * pad, height + 2 * pad
+ # boundary of the padded box
+ x0, y0 = x0 - pad, y0 - pad
+ x1, y1 = x0 + width, y0 + height
+ return Path([(x0, y0), (x1, y0), (x1, y1), (x0, y1), (x0, y0)],
+ closed=True)
+
+ @_register_style(_style_list)
+ class Circle(_Base):
+ """A circular box."""
+
+ def __init__(self, pad=0.3):
+ """
+ Parameters
+ ----------
+ pad : float, default: 0.3
+ The amount of padding around the original box.
+ """
+ self.pad = pad
+
+ def __call__(self, x0, y0, width, height, mutation_size):
+ pad = mutation_size * self.pad
+ width, height = width + 2 * pad, height + 2 * pad
+ # boundary of the padded box
+ x0, y0 = x0 - pad, y0 - pad
+ return Path.circle((x0 + width / 2, y0 + height / 2),
+ max(width, height) / 2)
+
+ @_register_style(_style_list)
+ class LArrow(_Base):
+ """A box in the shape of a left-pointing arrow."""
+
+ def __init__(self, pad=0.3):
+ """
+ Parameters
+ ----------
+ pad : float, default: 0.3
+ The amount of padding around the original box.
+ """
+ self.pad = pad
+
+ def __call__(self, x0, y0, width, height, mutation_size):
+ # padding
+ pad = mutation_size * self.pad
+ # width and height with padding added.
+ width, height = width + 2 * pad, height + 2 * pad
+ # boundary of the padded box
+ x0, y0 = x0 - pad, y0 - pad,
+ x1, y1 = x0 + width, y0 + height
+
+ dx = (y1 - y0) / 2
+ dxx = dx / 2
+ x0 = x0 + pad / 1.4 # adjust by ~sqrt(2)
+
+ return Path([(x0 + dxx, y0), (x1, y0), (x1, y1), (x0 + dxx, y1),
+ (x0 + dxx, y1 + dxx), (x0 - dx, y0 + dx),
+ (x0 + dxx, y0 - dxx), # arrow
+ (x0 + dxx, y0), (x0 + dxx, y0)],
+ closed=True)
+
+ @_register_style(_style_list)
+ class RArrow(LArrow):
+ """A box in the shape of a right-pointing arrow."""
+
+ def __call__(self, x0, y0, width, height, mutation_size):
+ p = BoxStyle.LArrow.__call__(
+ self, x0, y0, width, height, mutation_size)
+ p.vertices[:, 0] = 2 * x0 + width - p.vertices[:, 0]
+ return p
+
+ @_register_style(_style_list)
+ class DArrow(_Base):
+ """A box in the shape of a two-way arrow."""
+ # Modified from LArrow to add a right arrow to the bbox.
+
+ def __init__(self, pad=0.3):
+ """
+ Parameters
+ ----------
+ pad : float, default: 0.3
+ The amount of padding around the original box.
+ """
+ self.pad = pad
+
+ def __call__(self, x0, y0, width, height, mutation_size):
+ # padding
+ pad = mutation_size * self.pad
+ # width and height with padding added.
+ # The width is padded by the arrows, so we don't need to pad it.
+ height = height + 2 * pad
+ # boundary of the padded box
+ x0, y0 = x0 - pad, y0 - pad
+ x1, y1 = x0 + width, y0 + height
+
+ dx = (y1 - y0) / 2
+ dxx = dx / 2
+ x0 = x0 + pad / 1.4 # adjust by ~sqrt(2)
+
+ return Path([(x0 + dxx, y0), (x1, y0), # bot-segment
+ (x1, y0 - dxx), (x1 + dx + dxx, y0 + dx),
+ (x1, y1 + dxx), # right-arrow
+ (x1, y1), (x0 + dxx, y1), # top-segment
+ (x0 + dxx, y1 + dxx), (x0 - dx, y0 + dx),
+ (x0 + dxx, y0 - dxx), # left-arrow
+ (x0 + dxx, y0), (x0 + dxx, y0)], # close-poly
+ closed=True)
+
+ @_register_style(_style_list)
+ class Round(_Base):
+ """A box with round corners."""
+
+ def __init__(self, pad=0.3, rounding_size=None):
+ """
+ Parameters
+ ----------
+ pad : float, default: 0.3
+ The amount of padding around the original box.
+ rounding_size : float, default: *pad*
+ Radius of the corners.
+ """
+ self.pad = pad
+ self.rounding_size = rounding_size
+
+ def __call__(self, x0, y0, width, height, mutation_size):
+
+ # padding
+ pad = mutation_size * self.pad
+
+ # size of the rounding corner
+ if self.rounding_size:
+ dr = mutation_size * self.rounding_size
+ else:
+ dr = pad
+
+ width, height = width + 2 * pad, height + 2 * pad
+
+ x0, y0 = x0 - pad, y0 - pad,
+ x1, y1 = x0 + width, y0 + height
+
+ # Round corners are implemented as quadratic Bezier, e.g.,
+ # [(x0, y0-dr), (x0, y0), (x0+dr, y0)] for lower left corner.
+ cp = [(x0 + dr, y0),
+ (x1 - dr, y0),
+ (x1, y0), (x1, y0 + dr),
+ (x1, y1 - dr),
+ (x1, y1), (x1 - dr, y1),
+ (x0 + dr, y1),
+ (x0, y1), (x0, y1 - dr),
+ (x0, y0 + dr),
+ (x0, y0), (x0 + dr, y0),
+ (x0 + dr, y0)]
+
+ com = [Path.MOVETO,
+ Path.LINETO,
+ Path.CURVE3, Path.CURVE3,
+ Path.LINETO,
+ Path.CURVE3, Path.CURVE3,
+ Path.LINETO,
+ Path.CURVE3, Path.CURVE3,
+ Path.LINETO,
+ Path.CURVE3, Path.CURVE3,
+ Path.CLOSEPOLY]
+
+ path = Path(cp, com)
+
+ return path
+
+ @_register_style(_style_list)
+ class Round4(_Base):
+ """A box with rounded edges."""
+
+ def __init__(self, pad=0.3, rounding_size=None):
+ """
+ Parameters
+ ----------
+ pad : float, default: 0.3
+ The amount of padding around the original box.
+ rounding_size : float, default: *pad*/2
+ Rounding of edges.
+ """
+ self.pad = pad
+ self.rounding_size = rounding_size
+
+ def __call__(self, x0, y0, width, height, mutation_size):
+
+ # padding
+ pad = mutation_size * self.pad
+
+ # Rounding size; defaults to half of the padding.
+ if self.rounding_size:
+ dr = mutation_size * self.rounding_size
+ else:
+ dr = pad / 2.
+
+ width = width + 2 * pad - 2 * dr
+ height = height + 2 * pad - 2 * dr
+
+ x0, y0 = x0 - pad + dr, y0 - pad + dr,
+ x1, y1 = x0 + width, y0 + height
+
+ cp = [(x0, y0),
+ (x0 + dr, y0 - dr), (x1 - dr, y0 - dr), (x1, y0),
+ (x1 + dr, y0 + dr), (x1 + dr, y1 - dr), (x1, y1),
+ (x1 - dr, y1 + dr), (x0 + dr, y1 + dr), (x0, y1),
+ (x0 - dr, y1 - dr), (x0 - dr, y0 + dr), (x0, y0),
+ (x0, y0)]
+
+ com = [Path.MOVETO,
+ Path.CURVE4, Path.CURVE4, Path.CURVE4,
+ Path.CURVE4, Path.CURVE4, Path.CURVE4,
+ Path.CURVE4, Path.CURVE4, Path.CURVE4,
+ Path.CURVE4, Path.CURVE4, Path.CURVE4,
+ Path.CLOSEPOLY]
+
+ path = Path(cp, com)
+
+ return path
+
+ @_register_style(_style_list)
+ class Sawtooth(_Base):
+ """A box with a sawtooth outline."""
+
+ def __init__(self, pad=0.3, tooth_size=None):
+ """
+ Parameters
+ ----------
+ pad : float, default: 0.3
+ The amount of padding around the original box.
+ tooth_size : float, default: *pad*/2
+ Size of the sawtooth.
+ """
+ self.pad = pad
+ self.tooth_size = tooth_size
+
+ def _get_sawtooth_vertices(self, x0, y0, width, height, mutation_size):
+
+ # padding
+ pad = mutation_size * self.pad
+
+ # size of sawtooth
+ if self.tooth_size is None:
+ tooth_size = self.pad * .5 * mutation_size
+ else:
+ tooth_size = self.tooth_size * mutation_size
+
+ tooth_size2 = tooth_size / 2
+ width = width + 2 * pad - tooth_size
+ height = height + 2 * pad - tooth_size
+
+ # the sizes of the vertical and horizontal sawtooth are
+ # separately adjusted to fit the given box size.
+ dsx_n = int(round((width - tooth_size) / (tooth_size * 2))) * 2
+ dsx = (width - tooth_size) / dsx_n
+ dsy_n = int(round((height - tooth_size) / (tooth_size * 2))) * 2
+ dsy = (height - tooth_size) / dsy_n
+
+ x0, y0 = x0 - pad + tooth_size2, y0 - pad + tooth_size2
+ x1, y1 = x0 + width, y0 + height
+
+ bottom_saw_x = [
+ x0,
+ *(x0 + tooth_size2 + dsx * .5 * np.arange(dsx_n * 2)),
+ x1 - tooth_size2,
+ ]
+ bottom_saw_y = [
+ y0,
+ *([y0 - tooth_size2, y0, y0 + tooth_size2, y0] * dsx_n),
+ y0 - tooth_size2,
+ ]
+ right_saw_x = [
+ x1,
+ *([x1 + tooth_size2, x1, x1 - tooth_size2, x1] * dsx_n),
+ x1 + tooth_size2,
+ ]
+ right_saw_y = [
+ y0,
+ *(y0 + tooth_size2 + dsy * .5 * np.arange(dsy_n * 2)),
+ y1 - tooth_size2,
+ ]
+ top_saw_x = [
+ x1,
+ *(x1 - tooth_size2 - dsx * .5 * np.arange(dsx_n * 2)),
+ x0 + tooth_size2,
+ ]
+ top_saw_y = [
+ y1,
+ *([y1 + tooth_size2, y1, y1 - tooth_size2, y1] * dsx_n),
+ y1 + tooth_size2,
+ ]
+ left_saw_x = [
+ x0,
+ *([x0 - tooth_size2, x0, x0 + tooth_size2, x0] * dsy_n),
+ x0 - tooth_size2,
+ ]
+ left_saw_y = [
+ y1,
+ *(y1 - tooth_size2 - dsy * .5 * np.arange(dsy_n * 2)),
+ y0 + tooth_size2,
+ ]
+
+ saw_vertices = [*zip(bottom_saw_x, bottom_saw_y),
+ *zip(right_saw_x, right_saw_y),
+ *zip(top_saw_x, top_saw_y),
+ *zip(left_saw_x, left_saw_y),
+ (bottom_saw_x[0], bottom_saw_y[0])]
+
+ return saw_vertices
+
+ def __call__(self, x0, y0, width, height, mutation_size):
+ saw_vertices = self._get_sawtooth_vertices(x0, y0, width,
+ height, mutation_size)
+ path = Path(saw_vertices, closed=True)
+ return path
+
+ @_register_style(_style_list)
+ class Roundtooth(Sawtooth):
+ """A box with a rounded sawtooth outline."""
+
+ def __call__(self, x0, y0, width, height, mutation_size):
+ saw_vertices = self._get_sawtooth_vertices(x0, y0,
+ width, height,
+ mutation_size)
+ # Add a trailing vertex to allow us to close the polygon correctly
+ saw_vertices = np.concatenate([saw_vertices, [saw_vertices[0]]])
+ codes = ([Path.MOVETO] +
+ [Path.CURVE3, Path.CURVE3] * ((len(saw_vertices)-1)//2) +
+ [Path.CLOSEPOLY])
+ return Path(saw_vertices, codes)
+
+
+class ConnectionStyle(_Style):
+ """
+ `ConnectionStyle` is a container class which defines
+ several connectionstyle classes, which is used to create a path
+ between two points. These are mainly used with `FancyArrowPatch`.
+
+ A connectionstyle object can be either created as::
+
+ ConnectionStyle.Arc3(rad=0.2)
+
+ or::
+
+ ConnectionStyle("Arc3", rad=0.2)
+
+ or::
+
+ ConnectionStyle("Arc3, rad=0.2")
+
+ The following classes are defined
+
+ %(AvailableConnectorstyles)s
+
+ An instance of any connection style class is an callable object,
+ whose call signature is::
+
+ __call__(self, posA, posB,
+ patchA=None, patchB=None,
+ shrinkA=2., shrinkB=2.)
+
+ and it returns a `.Path` instance. *posA* and *posB* are
+ tuples of (x, y) coordinates of the two points to be
+ connected. *patchA* (or *patchB*) is given, the returned path is
+ clipped so that it start (or end) from the boundary of the
+ patch. The path is further shrunk by *shrinkA* (or *shrinkB*)
+ which is given in points.
+ """
+
+ _style_list = {}
+
+ class _Base:
+ """
+ A base class for connectionstyle classes. The subclass needs
+ to implement a *connect* method whose call signature is::
+
+ connect(posA, posB)
+
+ where posA and posB are tuples of x, y coordinates to be
+ connected. The method needs to return a path connecting two
+ points. This base class defines a __call__ method, and a few
+ helper methods.
+ """
+
+ class SimpleEvent:
+ def __init__(self, xy):
+ self.x, self.y = xy
+
+ def _clip(self, path, patchA, patchB):
+ """
+ Clip the path to the boundary of the patchA and patchB.
+ The starting point of the path needed to be inside of the
+ patchA and the end point inside the patch B. The *contains*
+ methods of each patch object is utilized to test if the point
+ is inside the path.
+ """
+
+ if patchA:
+ def insideA(xy_display):
+ xy_event = ConnectionStyle._Base.SimpleEvent(xy_display)
+ return patchA.contains(xy_event)[0]
+
+ try:
+ left, right = split_path_inout(path, insideA)
+ except ValueError:
+ right = path
+
+ path = right
+
+ if patchB:
+ def insideB(xy_display):
+ xy_event = ConnectionStyle._Base.SimpleEvent(xy_display)
+ return patchB.contains(xy_event)[0]
+
+ try:
+ left, right = split_path_inout(path, insideB)
+ except ValueError:
+ left = path
+
+ path = left
+
+ return path
+
+ def _shrink(self, path, shrinkA, shrinkB):
+ """
+ Shrink the path by fixed size (in points) with shrinkA and shrinkB.
+ """
+ if shrinkA:
+ insideA = inside_circle(*path.vertices[0], shrinkA)
+ try:
+ left, path = split_path_inout(path, insideA)
+ except ValueError:
+ pass
+ if shrinkB:
+ insideB = inside_circle(*path.vertices[-1], shrinkB)
+ try:
+ path, right = split_path_inout(path, insideB)
+ except ValueError:
+ pass
+ return path
+
+ def __call__(self, posA, posB,
+ shrinkA=2., shrinkB=2., patchA=None, patchB=None):
+ """
+ Call the *connect* method to create a path between *posA* and
+ *posB*; then clip and shrink the path.
+ """
+ path = self.connect(posA, posB)
+ clipped_path = self._clip(path, patchA, patchB)
+ shrunk_path = self._shrink(clipped_path, shrinkA, shrinkB)
+ return shrunk_path
+
+ @_register_style(_style_list)
+ class Arc3(_Base):
+ """
+ Creates a simple quadratic Bezier curve between two
+ points. The curve is created so that the middle control point
+ (C1) is located at the same distance from the start (C0) and
+ end points(C2) and the distance of the C1 to the line
+ connecting C0-C2 is *rad* times the distance of C0-C2.
+ """
+
+ def __init__(self, rad=0.):
+ """
+ *rad*
+ curvature of the curve.
+ """
+ self.rad = rad
+
+ def connect(self, posA, posB):
+ x1, y1 = posA
+ x2, y2 = posB
+ x12, y12 = (x1 + x2) / 2., (y1 + y2) / 2.
+ dx, dy = x2 - x1, y2 - y1
+
+ f = self.rad
+
+ cx, cy = x12 + f * dy, y12 - f * dx
+
+ vertices = [(x1, y1),
+ (cx, cy),
+ (x2, y2)]
+ codes = [Path.MOVETO,
+ Path.CURVE3,
+ Path.CURVE3]
+
+ return Path(vertices, codes)
+
+ @_register_style(_style_list)
+ class Angle3(_Base):
+ """
+ Creates a simple quadratic Bezier curve between two
+ points. The middle control points is placed at the
+ intersecting point of two lines which cross the start and
+ end point, and have a slope of angleA and angleB, respectively.
+ """
+
+ def __init__(self, angleA=90, angleB=0):
+ """
+ *angleA*
+ starting angle of the path
+
+ *angleB*
+ ending angle of the path
+ """
+
+ self.angleA = angleA
+ self.angleB = angleB
+
+ def connect(self, posA, posB):
+ x1, y1 = posA
+ x2, y2 = posB
+
+ cosA = math.cos(math.radians(self.angleA))
+ sinA = math.sin(math.radians(self.angleA))
+ cosB = math.cos(math.radians(self.angleB))
+ sinB = math.sin(math.radians(self.angleB))
+
+ cx, cy = get_intersection(x1, y1, cosA, sinA,
+ x2, y2, cosB, sinB)
+
+ vertices = [(x1, y1), (cx, cy), (x2, y2)]
+ codes = [Path.MOVETO, Path.CURVE3, Path.CURVE3]
+
+ return Path(vertices, codes)
+
+ @_register_style(_style_list)
+ class Angle(_Base):
+ """
+ Creates a piecewise continuous quadratic Bezier path between
+ two points. The path has a one passing-through point placed at
+ the intersecting point of two lines which cross the start
+ and end point, and have a slope of angleA and angleB, respectively.
+ The connecting edges are rounded with *rad*.
+ """
+
+ def __init__(self, angleA=90, angleB=0, rad=0.):
+ """
+ *angleA*
+ starting angle of the path
+
+ *angleB*
+ ending angle of the path
+
+ *rad*
+ rounding radius of the edge
+ """
+
+ self.angleA = angleA
+ self.angleB = angleB
+
+ self.rad = rad
+
+ def connect(self, posA, posB):
+ x1, y1 = posA
+ x2, y2 = posB
+
+ cosA = math.cos(math.radians(self.angleA))
+ sinA = math.sin(math.radians(self.angleA))
+ cosB = math.cos(math.radians(self.angleB))
+ sinB = math.sin(math.radians(self.angleB))
+
+ cx, cy = get_intersection(x1, y1, cosA, sinA,
+ x2, y2, cosB, sinB)
+
+ vertices = [(x1, y1)]
+ codes = [Path.MOVETO]
+
+ if self.rad == 0.:
+ vertices.append((cx, cy))
+ codes.append(Path.LINETO)
+ else:
+ dx1, dy1 = x1 - cx, y1 - cy
+ d1 = np.hypot(dx1, dy1)
+ f1 = self.rad / d1
+ dx2, dy2 = x2 - cx, y2 - cy
+ d2 = np.hypot(dx2, dy2)
+ f2 = self.rad / d2
+ vertices.extend([(cx + dx1 * f1, cy + dy1 * f1),
+ (cx, cy),
+ (cx + dx2 * f2, cy + dy2 * f2)])
+ codes.extend([Path.LINETO, Path.CURVE3, Path.CURVE3])
+
+ vertices.append((x2, y2))
+ codes.append(Path.LINETO)
+
+ return Path(vertices, codes)
+
+ @_register_style(_style_list)
+ class Arc(_Base):
+ """
+ Creates a piecewise continuous quadratic Bezier path between
+ two points. The path can have two passing-through points, a
+ point placed at the distance of armA and angle of angleA from
+ point A, another point with respect to point B. The edges are
+ rounded with *rad*.
+ """
+
+ def __init__(self, angleA=0, angleB=0, armA=None, armB=None, rad=0.):
+ """
+ *angleA* :
+ starting angle of the path
+
+ *angleB* :
+ ending angle of the path
+
+ *armA* :
+ length of the starting arm
+
+ *armB* :
+ length of the ending arm
+
+ *rad* :
+ rounding radius of the edges
+ """
+
+ self.angleA = angleA
+ self.angleB = angleB
+ self.armA = armA
+ self.armB = armB
+
+ self.rad = rad
+
+ def connect(self, posA, posB):
+ x1, y1 = posA
+ x2, y2 = posB
+
+ vertices = [(x1, y1)]
+ rounded = []
+ codes = [Path.MOVETO]
+
+ if self.armA:
+ cosA = math.cos(math.radians(self.angleA))
+ sinA = math.sin(math.radians(self.angleA))
+ # x_armA, y_armB
+ d = self.armA - self.rad
+ rounded.append((x1 + d * cosA, y1 + d * sinA))
+ d = self.armA
+ rounded.append((x1 + d * cosA, y1 + d * sinA))
+
+ if self.armB:
+ cosB = math.cos(math.radians(self.angleB))
+ sinB = math.sin(math.radians(self.angleB))
+ x_armB, y_armB = x2 + self.armB * cosB, y2 + self.armB * sinB
+
+ if rounded:
+ xp, yp = rounded[-1]
+ dx, dy = x_armB - xp, y_armB - yp
+ dd = (dx * dx + dy * dy) ** .5
+
+ rounded.append((xp + self.rad * dx / dd,
+ yp + self.rad * dy / dd))
+ vertices.extend(rounded)
+ codes.extend([Path.LINETO,
+ Path.CURVE3,
+ Path.CURVE3])
+ else:
+ xp, yp = vertices[-1]
+ dx, dy = x_armB - xp, y_armB - yp
+ dd = (dx * dx + dy * dy) ** .5
+
+ d = dd - self.rad
+ rounded = [(xp + d * dx / dd, yp + d * dy / dd),
+ (x_armB, y_armB)]
+
+ if rounded:
+ xp, yp = rounded[-1]
+ dx, dy = x2 - xp, y2 - yp
+ dd = (dx * dx + dy * dy) ** .5
+
+ rounded.append((xp + self.rad * dx / dd,
+ yp + self.rad * dy / dd))
+ vertices.extend(rounded)
+ codes.extend([Path.LINETO,
+ Path.CURVE3,
+ Path.CURVE3])
+
+ vertices.append((x2, y2))
+ codes.append(Path.LINETO)
+
+ return Path(vertices, codes)
+
+ @_register_style(_style_list)
+ class Bar(_Base):
+ """
+ A line with *angle* between A and B with *armA* and
+ *armB*. One of the arms is extended so that they are connected in
+ a right angle. The length of armA is determined by (*armA*
+ + *fraction* x AB distance). Same for armB.
+ """
+
+ def __init__(self, armA=0., armB=0., fraction=0.3, angle=None):
+ """
+ Parameters
+ ----------
+ armA : float
+ minimum length of armA
+
+ armB : float
+ minimum length of armB
+
+ fraction : float
+ a fraction of the distance between two points that
+ will be added to armA and armB.
+
+ angle : float or None
+ angle of the connecting line (if None, parallel
+ to A and B)
+ """
+ self.armA = armA
+ self.armB = armB
+ self.fraction = fraction
+ self.angle = angle
+
+ def connect(self, posA, posB):
+ x1, y1 = posA
+ x20, y20 = x2, y2 = posB
+
+ theta1 = math.atan2(y2 - y1, x2 - x1)
+ dx, dy = x2 - x1, y2 - y1
+ dd = (dx * dx + dy * dy) ** .5
+ ddx, ddy = dx / dd, dy / dd
+
+ armA, armB = self.armA, self.armB
+
+ if self.angle is not None:
+ theta0 = np.deg2rad(self.angle)
+ dtheta = theta1 - theta0
+ dl = dd * math.sin(dtheta)
+ dL = dd * math.cos(dtheta)
+ x2, y2 = x1 + dL * math.cos(theta0), y1 + dL * math.sin(theta0)
+ armB = armB - dl
+
+ # update
+ dx, dy = x2 - x1, y2 - y1
+ dd2 = (dx * dx + dy * dy) ** .5
+ ddx, ddy = dx / dd2, dy / dd2
+
+ arm = max(armA, armB)
+ f = self.fraction * dd + arm
+
+ cx1, cy1 = x1 + f * ddy, y1 - f * ddx
+ cx2, cy2 = x2 + f * ddy, y2 - f * ddx
+
+ vertices = [(x1, y1),
+ (cx1, cy1),
+ (cx2, cy2),
+ (x20, y20)]
+ codes = [Path.MOVETO,
+ Path.LINETO,
+ Path.LINETO,
+ Path.LINETO]
+
+ return Path(vertices, codes)
+
+
+def _point_along_a_line(x0, y0, x1, y1, d):
+ """
+ Return the point on the line connecting (*x0*, *y0*) -- (*x1*, *y1*) whose
+ distance from (*x0*, *y0*) is *d*.
+ """
+ dx, dy = x0 - x1, y0 - y1
+ ff = d / (dx * dx + dy * dy) ** .5
+ x2, y2 = x0 - ff * dx, y0 - ff * dy
+
+ return x2, y2
+
+
+class ArrowStyle(_Style):
+ """
+ `ArrowStyle` is a container class which defines several
+ arrowstyle classes, which is used to create an arrow path along a
+ given path. These are mainly used with `FancyArrowPatch`.
+
+ A arrowstyle object can be either created as::
+
+ ArrowStyle.Fancy(head_length=.4, head_width=.4, tail_width=.4)
+
+ or::
+
+ ArrowStyle("Fancy", head_length=.4, head_width=.4, tail_width=.4)
+
+ or::
+
+ ArrowStyle("Fancy, head_length=.4, head_width=.4, tail_width=.4")
+
+ The following classes are defined
+
+ %(AvailableArrowstyles)s
+
+ An instance of any arrow style class is a callable object,
+ whose call signature is::
+
+ __call__(self, path, mutation_size, linewidth, aspect_ratio=1.)
+
+ and it returns a tuple of a `.Path` instance and a boolean
+ value. *path* is a `.Path` instance along which the arrow
+ will be drawn. *mutation_size* and *aspect_ratio* have the same
+ meaning as in `BoxStyle`. *linewidth* is a line width to be
+ stroked. This is meant to be used to correct the location of the
+ head so that it does not overshoot the destination point, but not all
+ classes support it.
+ """
+
+ _style_list = {}
+
+ class _Base:
+ """
+ Arrow Transmuter Base class
+
+ ArrowTransmuterBase and its derivatives are used to make a fancy
+ arrow around a given path. The __call__ method returns a path
+ (which will be used to create a PathPatch instance) and a boolean
+ value indicating the path is open therefore is not fillable. This
+ class is not an artist and actual drawing of the fancy arrow is
+ done by the FancyArrowPatch class.
+
+ """
+
+ # The derived classes are required to be able to be initialized
+ # w/o arguments, i.e., all its argument (except self) must have
+ # the default values.
+
+ @staticmethod
+ def ensure_quadratic_bezier(path):
+ """
+ Some ArrowStyle class only works with a simple quadratic Bezier
+ curve (created with Arc3Connection or Angle3Connector). This static
+ method is to check if the provided path is a simple quadratic
+ Bezier curve and returns its control points if true.
+ """
+ segments = list(path.iter_segments())
+ if (len(segments) != 2 or segments[0][1] != Path.MOVETO or
+ segments[1][1] != Path.CURVE3):
+ raise ValueError(
+ "'path' is not a valid quadratic Bezier curve")
+ return [*segments[0][0], *segments[1][0]]
+
+ def transmute(self, path, mutation_size, linewidth):
+ """
+ The transmute method is the very core of the ArrowStyle class and
+ must be overridden in the subclasses. It receives the path object
+ along which the arrow will be drawn, and the mutation_size, with
+ which the arrow head etc. will be scaled. The linewidth may be
+ used to adjust the path so that it does not pass beyond the given
+ points. It returns a tuple of a Path instance and a boolean. The
+ boolean value indicate whether the path can be filled or not. The
+ return value can also be a list of paths and list of booleans of a
+ same length.
+ """
+ raise NotImplementedError('Derived must override')
+
+ def __call__(self, path, mutation_size, linewidth,
+ aspect_ratio=1.):
+ """
+ The __call__ method is a thin wrapper around the transmute method
+ and takes care of the aspect ratio.
+ """
+
+ if aspect_ratio is not None:
+ # Squeeze the given height by the aspect_ratio
+ vertices = path.vertices / [1, aspect_ratio]
+ path_shrunk = Path(vertices, path.codes)
+ # call transmute method with squeezed height.
+ path_mutated, fillable = self.transmute(path_shrunk,
+ mutation_size,
+ linewidth)
+ if np.iterable(fillable):
+ path_list = []
+ for p in path_mutated:
+ # Restore the height
+ path_list.append(
+ Path(p.vertices * [1, aspect_ratio], p.codes))
+ return path_list, fillable
+ else:
+ return path_mutated, fillable
+ else:
+ return self.transmute(path, mutation_size, linewidth)
+
+ class _Curve(_Base):
+ """
+ A simple arrow which will work with any path instance. The
+ returned path is simply concatenation of the original path + at
+ most two paths representing the arrow head at the begin point and the
+ at the end point. The arrow heads can be either open or closed.
+ """
+
+ def __init__(self, beginarrow=None, endarrow=None,
+ fillbegin=False, fillend=False,
+ head_length=.2, head_width=.1):
+ """
+ The arrows are drawn if *beginarrow* and/or *endarrow* are
+ true. *head_length* and *head_width* determines the size
+ of the arrow relative to the *mutation scale*. The
+ arrowhead at the begin (or end) is closed if fillbegin (or
+ fillend) is True.
+ """
+ self.beginarrow, self.endarrow = beginarrow, endarrow
+ self.head_length, self.head_width = head_length, head_width
+ self.fillbegin, self.fillend = fillbegin, fillend
+ super().__init__()
+
+ def _get_arrow_wedge(self, x0, y0, x1, y1,
+ head_dist, cos_t, sin_t, linewidth):
+ """
+ Return the paths for arrow heads. Since arrow lines are
+ drawn with capstyle=projected, The arrow goes beyond the
+ desired point. This method also returns the amount of the path
+ to be shrunken so that it does not overshoot.
+ """
+
+ # arrow from x0, y0 to x1, y1
+ dx, dy = x0 - x1, y0 - y1
+
+ cp_distance = np.hypot(dx, dy)
+
+ # pad_projected : amount of pad to account the
+ # overshooting of the projection of the wedge
+ pad_projected = (.5 * linewidth / sin_t)
+
+ # Account for division by zero
+ if cp_distance == 0:
+ cp_distance = 1
+
+ # apply pad for projected edge
+ ddx = pad_projected * dx / cp_distance
+ ddy = pad_projected * dy / cp_distance
+
+ # offset for arrow wedge
+ dx = dx / cp_distance * head_dist
+ dy = dy / cp_distance * head_dist
+
+ dx1, dy1 = cos_t * dx + sin_t * dy, -sin_t * dx + cos_t * dy
+ dx2, dy2 = cos_t * dx - sin_t * dy, sin_t * dx + cos_t * dy
+
+ vertices_arrow = [(x1 + ddx + dx1, y1 + ddy + dy1),
+ (x1 + ddx, y1 + ddy),
+ (x1 + ddx + dx2, y1 + ddy + dy2)]
+ codes_arrow = [Path.MOVETO,
+ Path.LINETO,
+ Path.LINETO]
+
+ return vertices_arrow, codes_arrow, ddx, ddy
+
+ def transmute(self, path, mutation_size, linewidth):
+
+ head_length = self.head_length * mutation_size
+ head_width = self.head_width * mutation_size
+ head_dist = np.hypot(head_length, head_width)
+ cos_t, sin_t = head_length / head_dist, head_width / head_dist
+
+ # begin arrow
+ x0, y0 = path.vertices[0]
+ x1, y1 = path.vertices[1]
+
+ # If there is no room for an arrow and a line, then skip the arrow
+ has_begin_arrow = self.beginarrow and (x0, y0) != (x1, y1)
+ verticesA, codesA, ddxA, ddyA = (
+ self._get_arrow_wedge(x1, y1, x0, y0,
+ head_dist, cos_t, sin_t, linewidth)
+ if has_begin_arrow
+ else ([], [], 0, 0)
+ )
+
+ # end arrow
+ x2, y2 = path.vertices[-2]
+ x3, y3 = path.vertices[-1]
+
+ # If there is no room for an arrow and a line, then skip the arrow
+ has_end_arrow = self.endarrow and (x2, y2) != (x3, y3)
+ verticesB, codesB, ddxB, ddyB = (
+ self._get_arrow_wedge(x2, y2, x3, y3,
+ head_dist, cos_t, sin_t, linewidth)
+ if has_end_arrow
+ else ([], [], 0, 0)
+ )
+
+ # This simple code will not work if ddx, ddy is greater than the
+ # separation between vertices.
+ _path = [Path(np.concatenate([[(x0 + ddxA, y0 + ddyA)],
+ path.vertices[1:-1],
+ [(x3 + ddxB, y3 + ddyB)]]),
+ path.codes)]
+ _fillable = [False]
+
+ if has_begin_arrow:
+ if self.fillbegin:
+ p = np.concatenate([verticesA, [verticesA[0],
+ verticesA[0]], ])
+ c = np.concatenate([codesA, [Path.LINETO, Path.CLOSEPOLY]])
+ _path.append(Path(p, c))
+ _fillable.append(True)
+ else:
+ _path.append(Path(verticesA, codesA))
+ _fillable.append(False)
+
+ if has_end_arrow:
+ if self.fillend:
+ _fillable.append(True)
+ p = np.concatenate([verticesB, [verticesB[0],
+ verticesB[0]], ])
+ c = np.concatenate([codesB, [Path.LINETO, Path.CLOSEPOLY]])
+ _path.append(Path(p, c))
+ else:
+ _fillable.append(False)
+ _path.append(Path(verticesB, codesB))
+
+ return _path, _fillable
+
+ @_register_style(_style_list, name="-")
+ class Curve(_Curve):
+ """A simple curve without any arrow head."""
+
+ def __init__(self):
+ super().__init__(beginarrow=False, endarrow=False)
+
+ @_register_style(_style_list, name="<-")
+ class CurveA(_Curve):
+ """An arrow with a head at its begin point."""
+
+ def __init__(self, head_length=.4, head_width=.2):
+ """
+ Parameters
+ ----------
+ head_length : float, default: 0.4
+ Length of the arrow head.
+
+ head_width : float, default: 0.2
+ Width of the arrow head.
+ """
+ super().__init__(beginarrow=True, endarrow=False,
+ head_length=head_length, head_width=head_width)
+
+ @_register_style(_style_list, name="->")
+ class CurveB(_Curve):
+ """An arrow with a head at its end point."""
+
+ def __init__(self, head_length=.4, head_width=.2):
+ """
+ Parameters
+ ----------
+ head_length : float, default: 0.4
+ Length of the arrow head.
+
+ head_width : float, default: 0.2
+ Width of the arrow head.
+ """
+ super().__init__(beginarrow=False, endarrow=True,
+ head_length=head_length, head_width=head_width)
+
+ @_register_style(_style_list, name="<->")
+ class CurveAB(_Curve):
+ """An arrow with heads both at the begin and the end point."""
+
+ def __init__(self, head_length=.4, head_width=.2):
+ """
+ Parameters
+ ----------
+ head_length : float, default: 0.4
+ Length of the arrow head.
+
+ head_width : float, default: 0.2
+ Width of the arrow head.
+ """
+ super().__init__(beginarrow=True, endarrow=True,
+ head_length=head_length, head_width=head_width)
+
+ @_register_style(_style_list, name="<|-")
+ class CurveFilledA(_Curve):
+ """An arrow with filled triangle head at the begin."""
+
+ def __init__(self, head_length=.4, head_width=.2):
+ """
+ Parameters
+ ----------
+ head_length : float, default: 0.4
+ Length of the arrow head.
+
+ head_width : float, default: 0.2
+ Width of the arrow head.
+ """
+ super().__init__(beginarrow=True, endarrow=False,
+ fillbegin=True, fillend=False,
+ head_length=head_length, head_width=head_width)
+
+ @_register_style(_style_list, name="-|>")
+ class CurveFilledB(_Curve):
+ """An arrow with filled triangle head at the end."""
+
+ def __init__(self, head_length=.4, head_width=.2):
+ """
+ Parameters
+ ----------
+ head_length : float, default: 0.4
+ Length of the arrow head.
+
+ head_width : float, default: 0.2
+ Width of the arrow head.
+ """
+ super().__init__(beginarrow=False, endarrow=True,
+ fillbegin=False, fillend=True,
+ head_length=head_length, head_width=head_width)
+
+ @_register_style(_style_list, name="<|-|>")
+ class CurveFilledAB(_Curve):
+ """An arrow with filled triangle heads at both ends."""
+
+ def __init__(self, head_length=.4, head_width=.2):
+ """
+ Parameters
+ ----------
+ head_length : float, default: 0.4
+ Length of the arrow head.
+
+ head_width : float, default: 0.2
+ Width of the arrow head.
+ """
+ super().__init__(beginarrow=True, endarrow=True,
+ fillbegin=True, fillend=True,
+ head_length=head_length, head_width=head_width)
+
+ class _Bracket(_Base):
+
+ def __init__(self, bracketA=None, bracketB=None,
+ widthA=1., widthB=1.,
+ lengthA=0.2, lengthB=0.2,
+ angleA=None, angleB=None,
+ scaleA=None, scaleB=None):
+ self.bracketA, self.bracketB = bracketA, bracketB
+ self.widthA, self.widthB = widthA, widthB
+ self.lengthA, self.lengthB = lengthA, lengthB
+ self.angleA, self.angleB = angleA, angleB
+ self.scaleA, self.scaleB = scaleA, scaleB
+
+ def _get_bracket(self, x0, y0,
+ cos_t, sin_t, width, length, angle):
+
+ # arrow from x0, y0 to x1, y1
+ from matplotlib.bezier import get_normal_points
+ x1, y1, x2, y2 = get_normal_points(x0, y0, cos_t, sin_t, width)
+
+ dx, dy = length * cos_t, length * sin_t
+
+ vertices_arrow = [(x1 + dx, y1 + dy),
+ (x1, y1),
+ (x2, y2),
+ (x2 + dx, y2 + dy)]
+ codes_arrow = [Path.MOVETO,
+ Path.LINETO,
+ Path.LINETO,
+ Path.LINETO]
+
+ if angle is not None:
+ trans = transforms.Affine2D().rotate_deg_around(x0, y0, angle)
+ vertices_arrow = trans.transform(vertices_arrow)
+
+ return vertices_arrow, codes_arrow
+
+ def transmute(self, path, mutation_size, linewidth):
+
+ if self.scaleA is None:
+ scaleA = mutation_size
+ else:
+ scaleA = self.scaleA
+
+ if self.scaleB is None:
+ scaleB = mutation_size
+ else:
+ scaleB = self.scaleB
+
+ vertices_list, codes_list = [], []
+
+ if self.bracketA:
+ x0, y0 = path.vertices[0]
+ x1, y1 = path.vertices[1]
+ cos_t, sin_t = get_cos_sin(x1, y1, x0, y0)
+ verticesA, codesA = self._get_bracket(x0, y0, cos_t, sin_t,
+ self.widthA * scaleA,
+ self.lengthA * scaleA,
+ self.angleA)
+ vertices_list.append(verticesA)
+ codes_list.append(codesA)
+
+ vertices_list.append(path.vertices)
+ codes_list.append(path.codes)
+
+ if self.bracketB:
+ x0, y0 = path.vertices[-1]
+ x1, y1 = path.vertices[-2]
+ cos_t, sin_t = get_cos_sin(x1, y1, x0, y0)
+ verticesB, codesB = self._get_bracket(x0, y0, cos_t, sin_t,
+ self.widthB * scaleB,
+ self.lengthB * scaleB,
+ self.angleB)
+ vertices_list.append(verticesB)
+ codes_list.append(codesB)
+
+ vertices = np.concatenate(vertices_list)
+ codes = np.concatenate(codes_list)
+
+ p = Path(vertices, codes)
+
+ return p, False
+
+ @_register_style(_style_list, name="]-[")
+ class BracketAB(_Bracket):
+ """An arrow with outward square brackets at both ends."""
+
+ def __init__(self,
+ widthA=1., lengthA=0.2, angleA=None,
+ widthB=1., lengthB=0.2, angleB=None):
+ """
+ Parameters
+ ----------
+ widthA : float, default: 1.0
+ Width of the bracket.
+
+ lengthA : float, default: 0.2
+ Length of the bracket.
+
+ angleA : float, default: None
+ Angle, in degrees, between the bracket and the line. Zero is
+ perpendicular to the line, and positive measures
+ counterclockwise.
+
+ widthB : float, default: 1.0
+ Width of the bracket.
+
+ lengthB : float, default: 0.2
+ Length of the bracket.
+
+ angleB : float, default: None
+ Angle, in degrees, between the bracket and the line. Zero is
+ perpendicular to the line, and positive measures
+ counterclockwise.
+ """
+ super().__init__(True, True,
+ widthA=widthA, lengthA=lengthA, angleA=angleA,
+ widthB=widthB, lengthB=lengthB, angleB=angleB)
+
+ @_register_style(_style_list, name="]-")
+ class BracketA(_Bracket):
+ """An arrow with an outward square bracket at its start."""
+
+ def __init__(self, widthA=1., lengthA=0.2, angleA=None):
+ """
+ Parameters
+ ----------
+ widthA : float, default: 1.0
+ Width of the bracket.
+
+ lengthA : float, default: 0.2
+ Length of the bracket.
+
+ angleA : float, default: None
+ Angle between the bracket and the line.
+ """
+ super().__init__(True, None,
+ widthA=widthA, lengthA=lengthA, angleA=angleA)
+
+ @_register_style(_style_list, name="-[")
+ class BracketB(_Bracket):
+ """An arrow with an outward square bracket at its end."""
+
+ def __init__(self, widthB=1., lengthB=0.2, angleB=None):
+ """
+ Parameters
+ ----------
+ widthB : float, default: 1.0
+ Width of the bracket.
+
+ lengthB : float, default: 0.2
+ Length of the bracket.
+
+ angleB : float, default: None
+ Angle, in degrees, between the bracket and the line. Zero is
+ perpendicular to the line, and positive measures
+ counterclockwise.
+ """
+ super().__init__(None, True,
+ widthB=widthB, lengthB=lengthB, angleB=angleB)
+
+ @_register_style(_style_list, name="|-|")
+ class BarAB(_Bracket):
+ """An arrow with vertical bars ``|`` at both ends."""
+
+ def __init__(self,
+ widthA=1., angleA=None,
+ widthB=1., angleB=None):
+ """
+ Parameters
+ ----------
+ widthA : float, default: 1.0
+ Width of the bracket.
+
+ angleA : float, default: None
+ Angle, in degrees, between the bracket and the line. Zero is
+ perpendicular to the line, and positive measures
+ counterclockwise.
+
+ widthB : float, default: 1.0
+ Width of the bracket.
+
+ angleB : float, default: None
+ Angle, in degrees, between the bracket and the line. Zero is
+ perpendicular to the line, and positive measures
+ counterclockwise.
+ """
+ super().__init__(True, True,
+ widthA=widthA, lengthA=0, angleA=angleA,
+ widthB=widthB, lengthB=0, angleB=angleB)
+
+ @_register_style(_style_list)
+ class Simple(_Base):
+ """A simple arrow. Only works with a quadratic Bezier curve."""
+
+ def __init__(self, head_length=.5, head_width=.5, tail_width=.2):
+ """
+ Parameters
+ ----------
+ head_length : float, default: 0.5
+ Length of the arrow head.
+
+ head_width : float, default: 0.5
+ Width of the arrow head.
+
+ tail_width : float, default: 0.2
+ Width of the arrow tail.
+ """
+ self.head_length, self.head_width, self.tail_width = \
+ head_length, head_width, tail_width
+ super().__init__()
+
+ def transmute(self, path, mutation_size, linewidth):
+
+ x0, y0, x1, y1, x2, y2 = self.ensure_quadratic_bezier(path)
+
+ # divide the path into a head and a tail
+ head_length = self.head_length * mutation_size
+ in_f = inside_circle(x2, y2, head_length)
+ arrow_path = [(x0, y0), (x1, y1), (x2, y2)]
+
+ try:
+ arrow_out, arrow_in = \
+ split_bezier_intersecting_with_closedpath(
+ arrow_path, in_f, tolerance=0.01)
+ except NonIntersectingPathException:
+ # if this happens, make a straight line of the head_length
+ # long.
+ x0, y0 = _point_along_a_line(x2, y2, x1, y1, head_length)
+ x1n, y1n = 0.5 * (x0 + x2), 0.5 * (y0 + y2)
+ arrow_in = [(x0, y0), (x1n, y1n), (x2, y2)]
+ arrow_out = None
+
+ # head
+ head_width = self.head_width * mutation_size
+ head_left, head_right = make_wedged_bezier2(arrow_in,
+ head_width / 2., wm=.5)
+
+ # tail
+ if arrow_out is not None:
+ tail_width = self.tail_width * mutation_size
+ tail_left, tail_right = get_parallels(arrow_out,
+ tail_width / 2.)
+
+ patch_path = [(Path.MOVETO, tail_right[0]),
+ (Path.CURVE3, tail_right[1]),
+ (Path.CURVE3, tail_right[2]),
+ (Path.LINETO, head_right[0]),
+ (Path.CURVE3, head_right[1]),
+ (Path.CURVE3, head_right[2]),
+ (Path.CURVE3, head_left[1]),
+ (Path.CURVE3, head_left[0]),
+ (Path.LINETO, tail_left[2]),
+ (Path.CURVE3, tail_left[1]),
+ (Path.CURVE3, tail_left[0]),
+ (Path.LINETO, tail_right[0]),
+ (Path.CLOSEPOLY, tail_right[0]),
+ ]
+ else:
+ patch_path = [(Path.MOVETO, head_right[0]),
+ (Path.CURVE3, head_right[1]),
+ (Path.CURVE3, head_right[2]),
+ (Path.CURVE3, head_left[1]),
+ (Path.CURVE3, head_left[0]),
+ (Path.CLOSEPOLY, head_left[0]),
+ ]
+
+ path = Path([p for c, p in patch_path], [c for c, p in patch_path])
+
+ return path, True
+
+ @_register_style(_style_list)
+ class Fancy(_Base):
+ """A fancy arrow. Only works with a quadratic Bezier curve."""
+
+ def __init__(self, head_length=.4, head_width=.4, tail_width=.4):
+ """
+ Parameters
+ ----------
+ head_length : float, default: 0.4
+ Length of the arrow head.
+
+ head_width : float, default: 0.4
+ Width of the arrow head.
+
+ tail_width : float, default: 0.4
+ Width of the arrow tail.
+ """
+ self.head_length, self.head_width, self.tail_width = \
+ head_length, head_width, tail_width
+ super().__init__()
+
+ def transmute(self, path, mutation_size, linewidth):
+
+ x0, y0, x1, y1, x2, y2 = self.ensure_quadratic_bezier(path)
+
+ # divide the path into a head and a tail
+ head_length = self.head_length * mutation_size
+ arrow_path = [(x0, y0), (x1, y1), (x2, y2)]
+
+ # path for head
+ in_f = inside_circle(x2, y2, head_length)
+ try:
+ path_out, path_in = split_bezier_intersecting_with_closedpath(
+ arrow_path, in_f, tolerance=0.01)
+ except NonIntersectingPathException:
+ # if this happens, make a straight line of the head_length
+ # long.
+ x0, y0 = _point_along_a_line(x2, y2, x1, y1, head_length)
+ x1n, y1n = 0.5 * (x0 + x2), 0.5 * (y0 + y2)
+ arrow_path = [(x0, y0), (x1n, y1n), (x2, y2)]
+ path_head = arrow_path
+ else:
+ path_head = path_in
+
+ # path for head
+ in_f = inside_circle(x2, y2, head_length * .8)
+ path_out, path_in = split_bezier_intersecting_with_closedpath(
+ arrow_path, in_f, tolerance=0.01)
+ path_tail = path_out
+
+ # head
+ head_width = self.head_width * mutation_size
+ head_l, head_r = make_wedged_bezier2(path_head,
+ head_width / 2.,
+ wm=.6)
+
+ # tail
+ tail_width = self.tail_width * mutation_size
+ tail_left, tail_right = make_wedged_bezier2(path_tail,
+ tail_width * .5,
+ w1=1., wm=0.6, w2=0.3)
+
+ # path for head
+ in_f = inside_circle(x0, y0, tail_width * .3)
+ path_in, path_out = split_bezier_intersecting_with_closedpath(
+ arrow_path, in_f, tolerance=0.01)
+ tail_start = path_in[-1]
+
+ head_right, head_left = head_r, head_l
+ patch_path = [(Path.MOVETO, tail_start),
+ (Path.LINETO, tail_right[0]),
+ (Path.CURVE3, tail_right[1]),
+ (Path.CURVE3, tail_right[2]),
+ (Path.LINETO, head_right[0]),
+ (Path.CURVE3, head_right[1]),
+ (Path.CURVE3, head_right[2]),
+ (Path.CURVE3, head_left[1]),
+ (Path.CURVE3, head_left[0]),
+ (Path.LINETO, tail_left[2]),
+ (Path.CURVE3, tail_left[1]),
+ (Path.CURVE3, tail_left[0]),
+ (Path.LINETO, tail_start),
+ (Path.CLOSEPOLY, tail_start),
+ ]
+ path = Path([p for c, p in patch_path], [c for c, p in patch_path])
+
+ return path, True
+
+ @_register_style(_style_list)
+ class Wedge(_Base):
+ """
+ Wedge(?) shape. Only works with a quadratic Bezier curve. The
+ begin point has a width of the tail_width and the end point has a
+ width of 0. At the middle, the width is shrink_factor*tail_width.
+ """
+
+ def __init__(self, tail_width=.3, shrink_factor=0.5):
+ """
+ Parameters
+ ----------
+ tail_width : float, default: 0.3
+ Width of the tail.
+
+ shrink_factor : float, default: 0.5
+ Fraction of the arrow width at the middle point.
+ """
+ self.tail_width = tail_width
+ self.shrink_factor = shrink_factor
+ super().__init__()
+
+ def transmute(self, path, mutation_size, linewidth):
+
+ x0, y0, x1, y1, x2, y2 = self.ensure_quadratic_bezier(path)
+
+ arrow_path = [(x0, y0), (x1, y1), (x2, y2)]
+ b_plus, b_minus = make_wedged_bezier2(
+ arrow_path,
+ self.tail_width * mutation_size / 2.,
+ wm=self.shrink_factor)
+
+ patch_path = [(Path.MOVETO, b_plus[0]),
+ (Path.CURVE3, b_plus[1]),
+ (Path.CURVE3, b_plus[2]),
+ (Path.LINETO, b_minus[2]),
+ (Path.CURVE3, b_minus[1]),
+ (Path.CURVE3, b_minus[0]),
+ (Path.CLOSEPOLY, b_minus[0]),
+ ]
+ path = Path([p for c, p in patch_path], [c for c, p in patch_path])
+
+ return path, True
+
+
+docstring.interpd.update(
+ AvailableBoxstyles=BoxStyle.pprint_styles(),
+ ListBoxstyles=_simpleprint_styles(BoxStyle._style_list),
+ AvailableArrowstyles=ArrowStyle.pprint_styles(),
+ AvailableConnectorstyles=ConnectionStyle.pprint_styles(),
+)
+docstring.dedent_interpd(BoxStyle)
+docstring.dedent_interpd(ArrowStyle)
+docstring.dedent_interpd(ConnectionStyle)
+
+
+class FancyBboxPatch(Patch):
+ """
+ A fancy box around a rectangle with lower left at *xy* = (*x*, *y*)
+ with specified width and height.
+
+ `.FancyBboxPatch` is similar to `.Rectangle`, but it draws a fancy box
+ around the rectangle. The transformation of the rectangle box to the
+ fancy box is delegated to the style classes defined in `.BoxStyle`.
+ """
+
+ _edge_default = True
+
+ def __str__(self):
+ s = self.__class__.__name__ + "((%g, %g), width=%g, height=%g)"
+ return s % (self._x, self._y, self._width, self._height)
+
+ @docstring.dedent_interpd
+ @_api.delete_parameter("3.4", "bbox_transmuter", alternative="boxstyle")
+ def __init__(self, xy, width, height,
+ boxstyle="round", bbox_transmuter=None,
+ mutation_scale=1, mutation_aspect=1,
+ **kwargs):
+ """
+ Parameters
+ ----------
+ xy : float, float
+ The lower left corner of the box.
+
+ width : float
+ The width of the box.
+
+ height : float
+ The height of the box.
+
+ boxstyle : str or `matplotlib.patches.BoxStyle`
+ The style of the fancy box. This can either be a `.BoxStyle`
+ instance or a string of the style name and optionally comma
+ seprarated attributes (e.g. "Round, pad=0.2"). This string is
+ passed to `.BoxStyle` to construct a `.BoxStyle` object. See
+ there for a full documentation.
+
+ The following box styles are available:
+
+ %(AvailableBoxstyles)s
+
+ mutation_scale : float, default: 1
+ Scaling factor applied to the attributes of the box style
+ (e.g. pad or rounding_size).
+
+ mutation_aspect : float, default: 1
+ The height of the rectangle will be squeezed by this value before
+ the mutation and the mutated box will be stretched by the inverse
+ of it. For example, this allows different horizontal and vertical
+ padding.
+
+ Other Parameters
+ ----------------
+ **kwargs : `.Patch` properties
+
+ %(Patch_kwdoc)s
+ """
+
+ super().__init__(**kwargs)
+
+ self._x = xy[0]
+ self._y = xy[1]
+ self._width = width
+ self._height = height
+
+ if boxstyle == "custom":
+ _api.warn_deprecated(
+ "3.4", message="Support for boxstyle='custom' is deprecated "
+ "since %(since)s and will be removed %(removal)s; directly "
+ "pass a boxstyle instance as the boxstyle parameter instead.")
+ if bbox_transmuter is None:
+ raise ValueError("bbox_transmuter argument is needed with "
+ "custom boxstyle")
+ self._bbox_transmuter = bbox_transmuter
+ else:
+ self.set_boxstyle(boxstyle)
+
+ self._mutation_scale = mutation_scale
+ self._mutation_aspect = mutation_aspect
+
+ self.stale = True
+
+ @docstring.dedent_interpd
+ def set_boxstyle(self, boxstyle=None, **kwargs):
+ """
+ Set the box style.
+
+ Most box styles can be further configured using attributes.
+ Attributes from the previous box style are not reused.
+
+ Without argument (or with ``boxstyle=None``), the available box styles
+ are returned as a human-readable string.
+
+ Parameters
+ ----------
+ boxstyle : str or `matplotlib.patches.BoxStyle`
+ The style of the fancy box. This can either be a `.BoxStyle`
+ instance or a string of the style name and optionally comma
+ seprarated attributes (e.g. "Round, pad=0.2"). This string is
+ passed to `.BoxStyle` to construct a `.BoxStyle` object. See
+ there for a full documentation.
+
+ The following box styles are available:
+
+ %(AvailableBoxstyles)s
+
+ .. ACCEPTS: %(ListBoxstyles)s
+
+ **kwargs
+ Additional attributes for the box style. See the table above for
+ supported parameters.
+
+ Examples
+ --------
+ ::
+
+ set_boxstyle("round,pad=0.2")
+ set_boxstyle("round", pad=0.2)
+
+ """
+ if boxstyle is None:
+ return BoxStyle.pprint_styles()
+
+ if isinstance(boxstyle, BoxStyle._Base) or callable(boxstyle):
+ self._bbox_transmuter = boxstyle
+ else:
+ self._bbox_transmuter = BoxStyle(boxstyle, **kwargs)
+ self.stale = True
+
+ def set_mutation_scale(self, scale):
+ """
+ Set the mutation scale.
+
+ Parameters
+ ----------
+ scale : float
+ """
+ self._mutation_scale = scale
+ self.stale = True
+
+ def get_mutation_scale(self):
+ """Return the mutation scale."""
+ return self._mutation_scale
+
+ def set_mutation_aspect(self, aspect):
+ """
+ Set the aspect ratio of the bbox mutation.
+
+ Parameters
+ ----------
+ aspect : float
+ """
+ self._mutation_aspect = aspect
+ self.stale = True
+
+ def get_mutation_aspect(self):
+ """Return the aspect ratio of the bbox mutation."""
+ return (self._mutation_aspect if self._mutation_aspect is not None
+ else 1) # backcompat.
+
+ def get_boxstyle(self):
+ """Return the boxstyle object."""
+ return self._bbox_transmuter
+
+ def get_path(self):
+ """Return the mutated path of the rectangle."""
+ boxstyle = self.get_boxstyle()
+ x = self._x
+ y = self._y
+ width = self._width
+ height = self._height
+ m_scale = self.get_mutation_scale()
+ m_aspect = self.get_mutation_aspect()
+ # Squeeze the given height by the aspect_ratio.
+ y, height = y / m_aspect, height / m_aspect
+ # Call boxstyle with squeezed height.
+ try:
+ inspect.signature(boxstyle).bind(x, y, width, height, m_scale)
+ except TypeError:
+ # Don't apply aspect twice.
+ path = boxstyle(x, y, width, height, m_scale, 1)
+ _api.warn_deprecated(
+ "3.4", message="boxstyles must be callable without the "
+ "'mutation_aspect' parameter since %(since)s; support for the "
+ "old call signature will be removed %(removal)s.")
+ else:
+ path = boxstyle(x, y, width, height, m_scale)
+ vertices, codes = path.vertices, path.codes
+ # Restore the height.
+ vertices[:, 1] = vertices[:, 1] * m_aspect
+ return Path(vertices, codes)
+
+ # Following methods are borrowed from the Rectangle class.
+
+ def get_x(self):
+ """Return the left coord of the rectangle."""
+ return self._x
+
+ def get_y(self):
+ """Return the bottom coord of the rectangle."""
+ return self._y
+
+ def get_width(self):
+ """Return the width of the rectangle."""
+ return self._width
+
+ def get_height(self):
+ """Return the height of the rectangle."""
+ return self._height
+
+ def set_x(self, x):
+ """
+ Set the left coord of the rectangle.
+
+ Parameters
+ ----------
+ x : float
+ """
+ self._x = x
+ self.stale = True
+
+ def set_y(self, y):
+ """
+ Set the bottom coord of the rectangle.
+
+ Parameters
+ ----------
+ y : float
+ """
+ self._y = y
+ self.stale = True
+
+ def set_width(self, w):
+ """
+ Set the rectangle width.
+
+ Parameters
+ ----------
+ w : float
+ """
+ self._width = w
+ self.stale = True
+
+ def set_height(self, h):
+ """
+ Set the rectangle height.
+
+ Parameters
+ ----------
+ h : float
+ """
+ self._height = h
+ self.stale = True
+
+ def set_bounds(self, *args):
+ """
+ Set the bounds of the rectangle.
+
+ Call signatures::
+
+ set_bounds(left, bottom, width, height)
+ set_bounds((left, bottom, width, height))
+
+ Parameters
+ ----------
+ left, bottom : float
+ The coordinates of the bottom left corner of the rectangle.
+ width, height : float
+ The width/height of the rectangle.
+ """
+ if len(args) == 1:
+ l, b, w, h = args[0]
+ else:
+ l, b, w, h = args
+ self._x = l
+ self._y = b
+ self._width = w
+ self._height = h
+ self.stale = True
+
+ def get_bbox(self):
+ """Return the `.Bbox`."""
+ return transforms.Bbox.from_bounds(self._x, self._y,
+ self._width, self._height)
+
+
+class FancyArrowPatch(Patch):
+ """
+ A fancy arrow patch. It draws an arrow using the `ArrowStyle`.
+
+ The head and tail positions are fixed at the specified start and end points
+ of the arrow, but the size and shape (in display coordinates) of the arrow
+ does not change when the axis is moved or zoomed.
+ """
+ _edge_default = True
+
+ def __str__(self):
+ if self._posA_posB is not None:
+ (x1, y1), (x2, y2) = self._posA_posB
+ return f"{type(self).__name__}(({x1:g}, {y1:g})->({x2:g}, {y2:g}))"
+ else:
+ return f"{type(self).__name__}({self._path_original})"
+
+ @docstring.dedent_interpd
+ @_api.delete_parameter("3.4", "dpi_cor")
+ def __init__(self, posA=None, posB=None, path=None,
+ arrowstyle="simple", connectionstyle="arc3",
+ patchA=None, patchB=None,
+ shrinkA=2, shrinkB=2,
+ mutation_scale=1, mutation_aspect=1,
+ dpi_cor=1,
+ **kwargs):
+ """
+ There are two ways for defining an arrow:
+
+ - If *posA* and *posB* are given, a path connecting two points is
+ created according to *connectionstyle*. The path will be
+ clipped with *patchA* and *patchB* and further shrunken by
+ *shrinkA* and *shrinkB*. An arrow is drawn along this
+ resulting path using the *arrowstyle* parameter.
+
+ - Alternatively if *path* is provided, an arrow is drawn along this
+ path and *patchA*, *patchB*, *shrinkA*, and *shrinkB* are ignored.
+
+ Parameters
+ ----------
+ posA, posB : (float, float), default: None
+ (x, y) coordinates of arrow tail and arrow head respectively.
+
+ path : `~matplotlib.path.Path`, default: None
+ If provided, an arrow is drawn along this path and *patchA*,
+ *patchB*, *shrinkA*, and *shrinkB* are ignored.
+
+ arrowstyle : str or `.ArrowStyle`, default: 'simple'
+ The `.ArrowStyle` with which the fancy arrow is drawn. If a
+ string, it should be one of the available arrowstyle names, with
+ optional comma-separated attributes. The optional attributes are
+ meant to be scaled with the *mutation_scale*. The following arrow
+ styles are available:
+
+ %(AvailableArrowstyles)s
+
+ connectionstyle : str or `.ConnectionStyle` or None, optional, \
+default: 'arc3'
+ The `.ConnectionStyle` with which *posA* and *posB* are connected.
+ If a string, it should be one of the available connectionstyle
+ names, with optional comma-separated attributes. The following
+ connection styles are available:
+
+ %(AvailableConnectorstyles)s
+
+ patchA, patchB : `.Patch`, default: None
+ Head and tail patches, respectively.
+
+ shrinkA, shrinkB : float, default: 2
+ Shrinking factor of the tail and head of the arrow respectively.
+
+ mutation_scale : float, default: 1
+ Value with which attributes of *arrowstyle* (e.g., *head_length*)
+ will be scaled.
+
+ mutation_aspect : None or float, default: None
+ The height of the rectangle will be squeezed by this value before
+ the mutation and the mutated box will be stretched by the inverse
+ of it.
+
+ dpi_cor : float, default: 1
+ dpi_cor is currently used for linewidth-related things and shrink
+ factor. Mutation scale is affected by this. Deprecated.
+
+ Other Parameters
+ ----------------
+ **kwargs : `.Patch` properties, optional
+ Here is a list of available `.Patch` properties:
+
+ %(Patch_kwdoc)s
+
+ In contrast to other patches, the default ``capstyle`` and
+ ``joinstyle`` for `FancyArrowPatch` are set to ``"round"``.
+ """
+ # Traditionally, the cap- and joinstyle for FancyArrowPatch are round
+ kwargs.setdefault("joinstyle", JoinStyle.round)
+ kwargs.setdefault("capstyle", CapStyle.round)
+
+ super().__init__(**kwargs)
+
+ if posA is not None and posB is not None and path is None:
+ self._posA_posB = [posA, posB]
+
+ if connectionstyle is None:
+ connectionstyle = "arc3"
+ self.set_connectionstyle(connectionstyle)
+
+ elif posA is None and posB is None and path is not None:
+ self._posA_posB = None
+ else:
+ raise ValueError("Either posA and posB, or path need to provided")
+
+ self.patchA = patchA
+ self.patchB = patchB
+ self.shrinkA = shrinkA
+ self.shrinkB = shrinkB
+
+ self._path_original = path
+
+ self.set_arrowstyle(arrowstyle)
+
+ self._mutation_scale = mutation_scale
+ self._mutation_aspect = mutation_aspect
+
+ self._dpi_cor = dpi_cor
+
+ @_api.deprecated("3.4")
+ def set_dpi_cor(self, dpi_cor):
+ """
+ dpi_cor is currently used for linewidth-related things and
+ shrink factor. Mutation scale is affected by this.
+
+ Parameters
+ ----------
+ dpi_cor : float
+ """
+ self._dpi_cor = dpi_cor
+ self.stale = True
+
+ @_api.deprecated("3.4")
+ def get_dpi_cor(self):
+ """
+ dpi_cor is currently used for linewidth-related things and
+ shrink factor. Mutation scale is affected by this.
+
+ Returns
+ -------
+ scalar
+ """
+ return self._dpi_cor
+
+ def set_positions(self, posA, posB):
+ """
+ Set the begin and end positions of the connecting path.
+
+ Parameters
+ ----------
+ posA, posB : None, tuple
+ (x, y) coordinates of arrow tail and arrow head respectively. If
+ `None` use current value.
+ """
+ if posA is not None:
+ self._posA_posB[0] = posA
+ if posB is not None:
+ self._posA_posB[1] = posB
+ self.stale = True
+
+ def set_patchA(self, patchA):
+ """
+ Set the tail patch.
+
+ Parameters
+ ----------
+ patchA : `.patches.Patch`
+ """
+ self.patchA = patchA
+ self.stale = True
+
+ def set_patchB(self, patchB):
+ """
+ Set the head patch.
+
+ Parameters
+ ----------
+ patchB : `.patches.Patch`
+ """
+ self.patchB = patchB
+ self.stale = True
+
+ def set_connectionstyle(self, connectionstyle, **kw):
+ """
+ Set the connection style. Old attributes are forgotten.
+
+ Parameters
+ ----------
+ connectionstyle : str or `.ConnectionStyle` or None, optional
+ Can be a string with connectionstyle name with
+ optional comma-separated attributes, e.g.::
+
+ set_connectionstyle("arc,angleA=0,armA=30,rad=10")
+
+ Alternatively, the attributes can be provided as keywords, e.g.::
+
+ set_connectionstyle("arc", angleA=0,armA=30,rad=10)
+
+ Without any arguments (or with ``connectionstyle=None``), return
+ available styles as a list of strings.
+ """
+
+ if connectionstyle is None:
+ return ConnectionStyle.pprint_styles()
+
+ if (isinstance(connectionstyle, ConnectionStyle._Base) or
+ callable(connectionstyle)):
+ self._connector = connectionstyle
+ else:
+ self._connector = ConnectionStyle(connectionstyle, **kw)
+ self.stale = True
+
+ def get_connectionstyle(self):
+ """Return the `ConnectionStyle` used."""
+ return self._connector
+
+ def set_arrowstyle(self, arrowstyle=None, **kw):
+ """
+ Set the arrow style. Old attributes are forgotten. Without arguments
+ (or with ``arrowstyle=None``) returns available box styles as a list of
+ strings.
+
+ Parameters
+ ----------
+ arrowstyle : None or ArrowStyle or str, default: None
+ Can be a string with arrowstyle name with optional comma-separated
+ attributes, e.g.::
+
+ set_arrowstyle("Fancy,head_length=0.2")
+
+ Alternatively attributes can be provided as keywords, e.g.::
+
+ set_arrowstyle("fancy", head_length=0.2)
+
+ """
+
+ if arrowstyle is None:
+ return ArrowStyle.pprint_styles()
+
+ if isinstance(arrowstyle, ArrowStyle._Base):
+ self._arrow_transmuter = arrowstyle
+ else:
+ self._arrow_transmuter = ArrowStyle(arrowstyle, **kw)
+ self.stale = True
+
+ def get_arrowstyle(self):
+ """Return the arrowstyle object."""
+ return self._arrow_transmuter
+
+ def set_mutation_scale(self, scale):
+ """
+ Set the mutation scale.
+
+ Parameters
+ ----------
+ scale : float
+ """
+ self._mutation_scale = scale
+ self.stale = True
+
+ def get_mutation_scale(self):
+ """
+ Return the mutation scale.
+
+ Returns
+ -------
+ scalar
+ """
+ return self._mutation_scale
+
+ def set_mutation_aspect(self, aspect):
+ """
+ Set the aspect ratio of the bbox mutation.
+
+ Parameters
+ ----------
+ aspect : float
+ """
+ self._mutation_aspect = aspect
+ self.stale = True
+
+ def get_mutation_aspect(self):
+ """Return the aspect ratio of the bbox mutation."""
+ return (self._mutation_aspect if self._mutation_aspect is not None
+ else 1) # backcompat.
+
+ def get_path(self):
+ """
+ Return the path of the arrow in the data coordinates. Use
+ get_path_in_displaycoord() method to retrieve the arrow path
+ in display coordinates.
+ """
+ _path, fillable = self.get_path_in_displaycoord()
+ if np.iterable(fillable):
+ _path = Path.make_compound_path(*_path)
+ return self.get_transform().inverted().transform_path(_path)
+
+ def get_path_in_displaycoord(self):
+ """Return the mutated path of the arrow in display coordinates."""
+ dpi_cor = self._dpi_cor
+
+ if self._posA_posB is not None:
+ posA = self._convert_xy_units(self._posA_posB[0])
+ posB = self._convert_xy_units(self._posA_posB[1])
+ (posA, posB) = self.get_transform().transform((posA, posB))
+ _path = self.get_connectionstyle()(posA, posB,
+ patchA=self.patchA,
+ patchB=self.patchB,
+ shrinkA=self.shrinkA * dpi_cor,
+ shrinkB=self.shrinkB * dpi_cor
+ )
+ else:
+ _path = self.get_transform().transform_path(self._path_original)
+
+ _path, fillable = self.get_arrowstyle()(
+ _path,
+ self.get_mutation_scale() * dpi_cor,
+ self.get_linewidth() * dpi_cor,
+ self.get_mutation_aspect())
+
+ return _path, fillable
+
+ def draw(self, renderer):
+ if not self.get_visible():
+ return
+
+ with self._bind_draw_path_function(renderer) as draw_path:
+
+ # FIXME : dpi_cor is for the dpi-dependency of the linewidth. There
+ # could be room for improvement. Maybe get_path_in_displaycoord
+ # could take a renderer argument, but get_path should be adapted
+ # too.
+ self._dpi_cor = renderer.points_to_pixels(1.)
+ path, fillable = self.get_path_in_displaycoord()
+
+ if not np.iterable(fillable):
+ path = [path]
+ fillable = [fillable]
+
+ affine = transforms.IdentityTransform()
+
+ for p, f in zip(path, fillable):
+ draw_path(
+ p, affine,
+ self._facecolor if f and self._facecolor[3] else None)
+
+
+class ConnectionPatch(FancyArrowPatch):
+ """A patch that connects two points (possibly in different axes)."""
+
+ def __str__(self):
+ return "ConnectionPatch((%g, %g), (%g, %g))" % \
+ (self.xy1[0], self.xy1[1], self.xy2[0], self.xy2[1])
+
+ @docstring.dedent_interpd
+ @_api.delete_parameter("3.4", "dpi_cor")
+ def __init__(self, xyA, xyB, coordsA, coordsB=None,
+ axesA=None, axesB=None,
+ arrowstyle="-",
+ connectionstyle="arc3",
+ patchA=None,
+ patchB=None,
+ shrinkA=0.,
+ shrinkB=0.,
+ mutation_scale=10.,
+ mutation_aspect=None,
+ clip_on=False,
+ dpi_cor=1.,
+ **kwargs):
+ """
+ Connect point *xyA* in *coordsA* with point *xyB* in *coordsB*.
+
+ Valid keys are
+
+ =============== ======================================================
+ Key Description
+ =============== ======================================================
+ arrowstyle the arrow style
+ connectionstyle the connection style
+ relpos default is (0.5, 0.5)
+ patchA default is bounding box of the text
+ patchB default is None
+ shrinkA default is 2 points
+ shrinkB default is 2 points
+ mutation_scale default is text size (in points)
+ mutation_aspect default is 1.
+ ? any key for `matplotlib.patches.PathPatch`
+ =============== ======================================================
+
+ *coordsA* and *coordsB* are strings that indicate the
+ coordinates of *xyA* and *xyB*.
+
+ ==================== ==================================================
+ Property Description
+ ==================== ==================================================
+ 'figure points' points from the lower left corner of the figure
+ 'figure pixels' pixels from the lower left corner of the figure
+ 'figure fraction' 0, 0 is lower left of figure and 1, 1 is upper
+ right
+ 'subfigure points' points from the lower left corner of the subfigure
+ 'subfigure pixels' pixels from the lower left corner of the subfigure
+ 'subfigure fraction' fraction of the subfigure, 0, 0 is lower left.
+ 'axes points' points from lower left corner of axes
+ 'axes pixels' pixels from lower left corner of axes
+ 'axes fraction' 0, 0 is lower left of axes and 1, 1 is upper right
+ 'data' use the coordinate system of the object being
+ annotated (default)
+ 'offset points' offset (in points) from the *xy* value
+ 'polar' you can specify *theta*, *r* for the annotation,
+ even in cartesian plots. Note that if you are
+ using a polar axes, you do not need to specify
+ polar for the coordinate system since that is the
+ native "data" coordinate system.
+ ==================== ==================================================
+
+ Alternatively they can be set to any valid
+ `~matplotlib.transforms.Transform`.
+
+ Note that 'subfigure pixels' and 'figure pixels' are the same
+ for the parent figure, so users who want code that is usable in
+ a subfigure can use 'subfigure pixels'.
+
+ .. note::
+
+ Using `ConnectionPatch` across two `~.axes.Axes` instances
+ is not directly compatible with :doc:`constrained layout
+ `. Add the artist
+ directly to the `.Figure` instead of adding it to a specific Axes,
+ or exclude it from the layout using ``con.set_in_layout(False)``.
+
+ .. code-block:: default
+
+ fig, ax = plt.subplots(1, 2, constrained_layout=True)
+ con = ConnectionPatch(..., axesA=ax[0], axesB=ax[1])
+ fig.add_artist(con)
+
+ """
+ if coordsB is None:
+ coordsB = coordsA
+ # we'll draw ourself after the artist we annotate by default
+ self.xy1 = xyA
+ self.xy2 = xyB
+ self.coords1 = coordsA
+ self.coords2 = coordsB
+
+ self.axesA = axesA
+ self.axesB = axesB
+
+ super().__init__(posA=(0, 0), posB=(1, 1),
+ arrowstyle=arrowstyle,
+ connectionstyle=connectionstyle,
+ patchA=patchA, patchB=patchB,
+ shrinkA=shrinkA, shrinkB=shrinkB,
+ mutation_scale=mutation_scale,
+ mutation_aspect=mutation_aspect,
+ clip_on=clip_on,
+ **kwargs)
+ self._dpi_cor = dpi_cor
+
+ # if True, draw annotation only if self.xy is inside the axes
+ self._annotation_clip = None
+
+ def _get_xy(self, xy, s, axes=None):
+ """Calculate the pixel position of given point."""
+ s0 = s # For the error message, if needed.
+ if axes is None:
+ axes = self.axes
+ xy = np.array(xy)
+ if s in ["figure points", "axes points"]:
+ xy *= self.figure.dpi / 72
+ s = s.replace("points", "pixels")
+ elif s == "figure fraction":
+ s = self.figure.transFigure
+ elif s == "subfigure fraction":
+ s = self.figure.transSubfigure
+ elif s == "axes fraction":
+ s = axes.transAxes
+ x, y = xy
+
+ if s == 'data':
+ trans = axes.transData
+ x = float(self.convert_xunits(x))
+ y = float(self.convert_yunits(y))
+ return trans.transform((x, y))
+ elif s == 'offset points':
+ if self.xycoords == 'offset points': # prevent recursion
+ return self._get_xy(self.xy, 'data')
+ return (
+ self._get_xy(self.xy, self.xycoords) # converted data point
+ + xy * self.figure.dpi / 72) # converted offset
+ elif s == 'polar':
+ theta, r = x, y
+ x = r * np.cos(theta)
+ y = r * np.sin(theta)
+ trans = axes.transData
+ return trans.transform((x, y))
+ elif s == 'figure pixels':
+ # pixels from the lower left corner of the figure
+ bb = self.figure.figbbox
+ x = bb.x0 + x if x >= 0 else bb.x1 + x
+ y = bb.y0 + y if y >= 0 else bb.y1 + y
+ return x, y
+ elif s == 'subfigure pixels':
+ # pixels from the lower left corner of the figure
+ bb = self.figure.bbox
+ x = bb.x0 + x if x >= 0 else bb.x1 + x
+ y = bb.y0 + y if y >= 0 else bb.y1 + y
+ return x, y
+ elif s == 'axes pixels':
+ # pixels from the lower left corner of the axes
+ bb = axes.bbox
+ x = bb.x0 + x if x >= 0 else bb.x1 + x
+ y = bb.y0 + y if y >= 0 else bb.y1 + y
+ return x, y
+ elif isinstance(s, transforms.Transform):
+ return s.transform(xy)
+ else:
+ raise ValueError(f"{s0} is not a valid coordinate transformation")
+
+ def set_annotation_clip(self, b):
+ """
+ Set the clipping behavior.
+
+ Parameters
+ ----------
+ b : bool or None
+
+ - *False*: The annotation will always be drawn regardless of its
+ position.
+ - *True*: The annotation will only be drawn if ``self.xy`` is
+ inside the axes.
+ - *None*: The annotation will only be drawn if ``self.xy`` is
+ inside the axes and ``self.xycoords == "data"``.
+ """
+ self._annotation_clip = b
+ self.stale = True
+
+ def get_annotation_clip(self):
+ """
+ Return the clipping behavior.
+
+ See `.set_annotation_clip` for the meaning of the return value.
+ """
+ return self._annotation_clip
+
+ def get_path_in_displaycoord(self):
+ """Return the mutated path of the arrow in display coordinates."""
+ dpi_cor = self._dpi_cor
+ posA = self._get_xy(self.xy1, self.coords1, self.axesA)
+ posB = self._get_xy(self.xy2, self.coords2, self.axesB)
+ path = self.get_connectionstyle()(
+ posA, posB,
+ patchA=self.patchA, patchB=self.patchB,
+ shrinkA=self.shrinkA * dpi_cor, shrinkB=self.shrinkB * dpi_cor,
+ )
+ path, fillable = self.get_arrowstyle()(
+ path,
+ self.get_mutation_scale() * dpi_cor,
+ self.get_linewidth() * dpi_cor,
+ self.get_mutation_aspect()
+ )
+ return path, fillable
+
+ def _check_xy(self, renderer):
+ """Check whether the annotation needs to be drawn."""
+
+ b = self.get_annotation_clip()
+
+ if b or (b is None and self.coords1 == "data"):
+ xy_pixel = self._get_xy(self.xy1, self.coords1, self.axesA)
+ if self.axesA is None:
+ axes = self.axes
+ else:
+ axes = self.axesA
+ if not axes.contains_point(xy_pixel):
+ return False
+
+ if b or (b is None and self.coords2 == "data"):
+ xy_pixel = self._get_xy(self.xy2, self.coords2, self.axesB)
+ if self.axesB is None:
+ axes = self.axes
+ else:
+ axes = self.axesB
+ if not axes.contains_point(xy_pixel):
+ return False
+
+ return True
+
+ def draw(self, renderer):
+ if renderer is not None:
+ self._renderer = renderer
+ if not self.get_visible() or not self._check_xy(renderer):
+ return
+ super().draw(renderer)
diff --git a/venv/Lib/site-packages/matplotlib/path.py b/venv/Lib/site-packages/matplotlib/path.py
new file mode 100644
index 0000000..475db80
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/path.py
@@ -0,0 +1,1077 @@
+r"""
+A module for dealing with the polylines used throughout Matplotlib.
+
+The primary class for polyline handling in Matplotlib is `Path`. Almost all
+vector drawing makes use of `Path`\s somewhere in the drawing pipeline.
+
+Whilst a `Path` instance itself cannot be drawn, some `.Artist` subclasses,
+such as `.PathPatch` and `.PathCollection`, can be used for convenient `Path`
+visualisation.
+"""
+
+from functools import lru_cache
+from weakref import WeakValueDictionary
+
+import numpy as np
+
+import matplotlib as mpl
+from . import _api, _path
+from .cbook import _to_unmasked_float_array, simple_linear_interpolation
+from .bezier import BezierSegment
+
+
+class Path:
+ """
+ A series of possibly disconnected, possibly closed, line and curve
+ segments.
+
+ The underlying storage is made up of two parallel numpy arrays:
+
+ - *vertices*: an Nx2 float array of vertices
+ - *codes*: an N-length uint8 array of vertex types, or None
+
+ These two arrays always have the same length in the first
+ dimension. For example, to represent a cubic curve, you must
+ provide three vertices as well as three codes ``CURVE3``.
+
+ The code types are:
+
+ - ``STOP`` : 1 vertex (ignored)
+ A marker for the end of the entire path (currently not required and
+ ignored)
+
+ - ``MOVETO`` : 1 vertex
+ Pick up the pen and move to the given vertex.
+
+ - ``LINETO`` : 1 vertex
+ Draw a line from the current position to the given vertex.
+
+ - ``CURVE3`` : 1 control point, 1 endpoint
+ Draw a quadratic Bezier curve from the current position, with the given
+ control point, to the given end point.
+
+ - ``CURVE4`` : 2 control points, 1 endpoint
+ Draw a cubic Bezier curve from the current position, with the given
+ control points, to the given end point.
+
+ - ``CLOSEPOLY`` : 1 vertex (ignored)
+ Draw a line segment to the start point of the current polyline.
+
+ If *codes* is None, it is interpreted as a ``MOVETO`` followed by a series
+ of ``LINETO``.
+
+ Users of Path objects should not access the vertices and codes arrays
+ directly. Instead, they should use `iter_segments` or `cleaned` to get the
+ vertex/code pairs. This helps, in particular, to consistently handle the
+ case of *codes* being None.
+
+ Some behavior of Path objects can be controlled by rcParams. See the
+ rcParams whose keys start with 'path.'.
+
+ .. note::
+
+ The vertices and codes arrays should be treated as
+ immutable -- there are a number of optimizations and assumptions
+ made up front in the constructor that will not change when the
+ data changes.
+ """
+
+ code_type = np.uint8
+
+ # Path codes
+ STOP = code_type(0) # 1 vertex
+ MOVETO = code_type(1) # 1 vertex
+ LINETO = code_type(2) # 1 vertex
+ CURVE3 = code_type(3) # 2 vertices
+ CURVE4 = code_type(4) # 3 vertices
+ CLOSEPOLY = code_type(79) # 1 vertex
+
+ #: A dictionary mapping Path codes to the number of vertices that the
+ #: code expects.
+ NUM_VERTICES_FOR_CODE = {STOP: 1,
+ MOVETO: 1,
+ LINETO: 1,
+ CURVE3: 2,
+ CURVE4: 3,
+ CLOSEPOLY: 1}
+
+ def __init__(self, vertices, codes=None, _interpolation_steps=1,
+ closed=False, readonly=False):
+ """
+ Create a new path with the given vertices and codes.
+
+ Parameters
+ ----------
+ vertices : (N, 2) array-like
+ The path vertices, as an array, masked array or sequence of pairs.
+ Masked values, if any, will be converted to NaNs, which are then
+ handled correctly by the Agg PathIterator and other consumers of
+ path data, such as :meth:`iter_segments`.
+ codes : array-like or None, optional
+ n-length array integers representing the codes of the path.
+ If not None, codes must be the same length as vertices.
+ If None, *vertices* will be treated as a series of line segments.
+ _interpolation_steps : int, optional
+ Used as a hint to certain projections, such as Polar, that this
+ path should be linearly interpolated immediately before drawing.
+ This attribute is primarily an implementation detail and is not
+ intended for public use.
+ closed : bool, optional
+ If *codes* is None and closed is True, vertices will be treated as
+ line segments of a closed polygon. Note that the last vertex will
+ then be ignored (as the corresponding code will be set to
+ CLOSEPOLY).
+ readonly : bool, optional
+ Makes the path behave in an immutable way and sets the vertices
+ and codes as read-only arrays.
+ """
+ vertices = _to_unmasked_float_array(vertices)
+ _api.check_shape((None, 2), vertices=vertices)
+
+ if codes is not None:
+ codes = np.asarray(codes, self.code_type)
+ if codes.ndim != 1 or len(codes) != len(vertices):
+ raise ValueError("'codes' must be a 1D list or array with the "
+ "same length of 'vertices'. "
+ f"Your vertices have shape {vertices.shape} "
+ f"but your codes have shape {codes.shape}")
+ if len(codes) and codes[0] != self.MOVETO:
+ raise ValueError("The first element of 'code' must be equal "
+ f"to 'MOVETO' ({self.MOVETO}). "
+ f"Your first code is {codes[0]}")
+ elif closed and len(vertices):
+ codes = np.empty(len(vertices), dtype=self.code_type)
+ codes[0] = self.MOVETO
+ codes[1:-1] = self.LINETO
+ codes[-1] = self.CLOSEPOLY
+
+ self._vertices = vertices
+ self._codes = codes
+ self._interpolation_steps = _interpolation_steps
+ self._update_values()
+
+ if readonly:
+ self._vertices.flags.writeable = False
+ if self._codes is not None:
+ self._codes.flags.writeable = False
+ self._readonly = True
+ else:
+ self._readonly = False
+
+ @classmethod
+ def _fast_from_codes_and_verts(cls, verts, codes, internals_from=None):
+ """
+ Creates a Path instance without the expense of calling the constructor.
+
+ Parameters
+ ----------
+ verts : numpy array
+ codes : numpy array
+ internals_from : Path or None
+ If not None, another `Path` from which the attributes
+ ``should_simplify``, ``simplify_threshold``, and
+ ``interpolation_steps`` will be copied. Note that ``readonly`` is
+ never copied, and always set to ``False`` by this constructor.
+ """
+ pth = cls.__new__(cls)
+ pth._vertices = _to_unmasked_float_array(verts)
+ pth._codes = codes
+ pth._readonly = False
+ if internals_from is not None:
+ pth._should_simplify = internals_from._should_simplify
+ pth._simplify_threshold = internals_from._simplify_threshold
+ pth._interpolation_steps = internals_from._interpolation_steps
+ else:
+ pth._should_simplify = True
+ pth._simplify_threshold = mpl.rcParams['path.simplify_threshold']
+ pth._interpolation_steps = 1
+ return pth
+
+ def _update_values(self):
+ self._simplify_threshold = mpl.rcParams['path.simplify_threshold']
+ self._should_simplify = (
+ self._simplify_threshold > 0 and
+ mpl.rcParams['path.simplify'] and
+ len(self._vertices) >= 128 and
+ (self._codes is None or np.all(self._codes <= Path.LINETO))
+ )
+
+ @property
+ def vertices(self):
+ """
+ The list of vertices in the `Path` as an Nx2 numpy array.
+ """
+ return self._vertices
+
+ @vertices.setter
+ def vertices(self, vertices):
+ if self._readonly:
+ raise AttributeError("Can't set vertices on a readonly Path")
+ self._vertices = vertices
+ self._update_values()
+
+ @property
+ def codes(self):
+ """
+ The list of codes in the `Path` as a 1D numpy array. Each
+ code is one of `STOP`, `MOVETO`, `LINETO`, `CURVE3`, `CURVE4`
+ or `CLOSEPOLY`. For codes that correspond to more than one
+ vertex (`CURVE3` and `CURVE4`), that code will be repeated so
+ that the length of `self.vertices` and `self.codes` is always
+ the same.
+ """
+ return self._codes
+
+ @codes.setter
+ def codes(self, codes):
+ if self._readonly:
+ raise AttributeError("Can't set codes on a readonly Path")
+ self._codes = codes
+ self._update_values()
+
+ @property
+ def simplify_threshold(self):
+ """
+ The fraction of a pixel difference below which vertices will
+ be simplified out.
+ """
+ return self._simplify_threshold
+
+ @simplify_threshold.setter
+ def simplify_threshold(self, threshold):
+ self._simplify_threshold = threshold
+
+ @property
+ def should_simplify(self):
+ """
+ `True` if the vertices array should be simplified.
+ """
+ return self._should_simplify
+
+ @should_simplify.setter
+ def should_simplify(self, should_simplify):
+ self._should_simplify = should_simplify
+
+ @property
+ def readonly(self):
+ """
+ `True` if the `Path` is read-only.
+ """
+ return self._readonly
+
+ def __copy__(self):
+ """
+ Return a shallow copy of the `Path`, which will share the
+ vertices and codes with the source `Path`.
+ """
+ import copy
+ return copy.copy(self)
+
+ copy = __copy__
+
+ def __deepcopy__(self, memo=None):
+ """
+ Return a deepcopy of the `Path`. The `Path` will not be
+ readonly, even if the source `Path` is.
+ """
+ try:
+ codes = self.codes.copy()
+ except AttributeError:
+ codes = None
+ return self.__class__(
+ self.vertices.copy(), codes,
+ _interpolation_steps=self._interpolation_steps)
+
+ deepcopy = __deepcopy__
+
+ @classmethod
+ def make_compound_path_from_polys(cls, XY):
+ """
+ Make a compound path object to draw a number
+ of polygons with equal numbers of sides XY is a (numpolys x
+ numsides x 2) numpy array of vertices. Return object is a
+ :class:`Path`
+
+ .. plot:: gallery/misc/histogram_path.py
+
+ """
+
+ # for each poly: 1 for the MOVETO, (numsides-1) for the LINETO, 1 for
+ # the CLOSEPOLY; the vert for the closepoly is ignored but we still
+ # need it to keep the codes aligned with the vertices
+ numpolys, numsides, two = XY.shape
+ if two != 2:
+ raise ValueError("The third dimension of 'XY' must be 2")
+ stride = numsides + 1
+ nverts = numpolys * stride
+ verts = np.zeros((nverts, 2))
+ codes = np.full(nverts, cls.LINETO, dtype=cls.code_type)
+ codes[0::stride] = cls.MOVETO
+ codes[numsides::stride] = cls.CLOSEPOLY
+ for i in range(numsides):
+ verts[i::stride] = XY[:, i]
+
+ return cls(verts, codes)
+
+ @classmethod
+ def make_compound_path(cls, *args):
+ """
+ Make a compound path from a list of Path objects. Blindly removes all
+ Path.STOP control points.
+ """
+ # Handle an empty list in args (i.e. no args).
+ if not args:
+ return Path(np.empty([0, 2], dtype=np.float32))
+ vertices = np.concatenate([x.vertices for x in args])
+ codes = np.empty(len(vertices), dtype=cls.code_type)
+ i = 0
+ for path in args:
+ if path.codes is None:
+ codes[i] = cls.MOVETO
+ codes[i + 1:i + len(path.vertices)] = cls.LINETO
+ else:
+ codes[i:i + len(path.codes)] = path.codes
+ i += len(path.vertices)
+ # remove STOP's, since internal STOPs are a bug
+ not_stop_mask = codes != cls.STOP
+ vertices = vertices[not_stop_mask, :]
+ codes = codes[not_stop_mask]
+
+ return cls(vertices, codes)
+
+ def __repr__(self):
+ return "Path(%r, %r)" % (self.vertices, self.codes)
+
+ def __len__(self):
+ return len(self.vertices)
+
+ def iter_segments(self, transform=None, remove_nans=True, clip=None,
+ snap=False, stroke_width=1.0, simplify=None,
+ curves=True, sketch=None):
+ """
+ Iterate over all curve segments in the path.
+
+ Each iteration returns a pair ``(vertices, code)``, where ``vertices``
+ is a sequence of 1-3 coordinate pairs, and ``code`` is a `Path` code.
+
+ Additionally, this method can provide a number of standard cleanups and
+ conversions to the path.
+
+ Parameters
+ ----------
+ transform : None or :class:`~matplotlib.transforms.Transform`
+ If not None, the given affine transformation will be applied to the
+ path.
+ remove_nans : bool, optional
+ Whether to remove all NaNs from the path and skip over them using
+ MOVETO commands.
+ clip : None or (float, float, float, float), optional
+ If not None, must be a four-tuple (x1, y1, x2, y2)
+ defining a rectangle in which to clip the path.
+ snap : None or bool, optional
+ If True, snap all nodes to pixels; if False, don't snap them.
+ If None, snap if the path contains only segments
+ parallel to the x or y axes, and no more than 1024 of them.
+ stroke_width : float, optional
+ The width of the stroke being drawn (used for path snapping).
+ simplify : None or bool, optional
+ Whether to simplify the path by removing vertices
+ that do not affect its appearance. If None, use the
+ :attr:`should_simplify` attribute. See also :rc:`path.simplify`
+ and :rc:`path.simplify_threshold`.
+ curves : bool, optional
+ If True, curve segments will be returned as curve segments.
+ If False, all curves will be converted to line segments.
+ sketch : None or sequence, optional
+ If not None, must be a 3-tuple of the form
+ (scale, length, randomness), representing the sketch parameters.
+ """
+ if not len(self):
+ return
+
+ cleaned = self.cleaned(transform=transform,
+ remove_nans=remove_nans, clip=clip,
+ snap=snap, stroke_width=stroke_width,
+ simplify=simplify, curves=curves,
+ sketch=sketch)
+
+ # Cache these object lookups for performance in the loop.
+ NUM_VERTICES_FOR_CODE = self.NUM_VERTICES_FOR_CODE
+ STOP = self.STOP
+
+ vertices = iter(cleaned.vertices)
+ codes = iter(cleaned.codes)
+ for curr_vertices, code in zip(vertices, codes):
+ if code == STOP:
+ break
+ extra_vertices = NUM_VERTICES_FOR_CODE[code] - 1
+ if extra_vertices:
+ for i in range(extra_vertices):
+ next(codes)
+ curr_vertices = np.append(curr_vertices, next(vertices))
+ yield curr_vertices, code
+
+ def iter_bezier(self, **kwargs):
+ """
+ Iterate over each bezier curve (lines included) in a Path.
+
+ Parameters
+ ----------
+ **kwargs
+ Forwarded to `.iter_segments`.
+
+ Yields
+ ------
+ B : matplotlib.bezier.BezierSegment
+ The bezier curves that make up the current path. Note in particular
+ that freestanding points are bezier curves of order 0, and lines
+ are bezier curves of order 1 (with two control points).
+ code : Path.code_type
+ The code describing what kind of curve is being returned.
+ Path.MOVETO, Path.LINETO, Path.CURVE3, Path.CURVE4 correspond to
+ bezier curves with 1, 2, 3, and 4 control points (respectively).
+ Path.CLOSEPOLY is a Path.LINETO with the control points correctly
+ chosen based on the start/end points of the current stroke.
+ """
+ first_vert = None
+ prev_vert = None
+ for verts, code in self.iter_segments(**kwargs):
+ if first_vert is None:
+ if code != Path.MOVETO:
+ raise ValueError("Malformed path, must start with MOVETO.")
+ if code == Path.MOVETO: # a point is like "CURVE1"
+ first_vert = verts
+ yield BezierSegment(np.array([first_vert])), code
+ elif code == Path.LINETO: # "CURVE2"
+ yield BezierSegment(np.array([prev_vert, verts])), code
+ elif code == Path.CURVE3:
+ yield BezierSegment(np.array([prev_vert, verts[:2],
+ verts[2:]])), code
+ elif code == Path.CURVE4:
+ yield BezierSegment(np.array([prev_vert, verts[:2],
+ verts[2:4], verts[4:]])), code
+ elif code == Path.CLOSEPOLY:
+ yield BezierSegment(np.array([prev_vert, first_vert])), code
+ elif code == Path.STOP:
+ return
+ else:
+ raise ValueError("Invalid Path.code_type: " + str(code))
+ prev_vert = verts[-2:]
+
+ @_api.delete_parameter("3.3", "quantize")
+ def cleaned(self, transform=None, remove_nans=False, clip=None,
+ quantize=False, simplify=False, curves=False,
+ stroke_width=1.0, snap=False, sketch=None):
+ """
+ Return a new Path with vertices and codes cleaned according to the
+ parameters.
+
+ See Also
+ --------
+ Path.iter_segments : for details of the keyword arguments.
+ """
+ vertices, codes = _path.cleanup_path(
+ self, transform, remove_nans, clip, snap, stroke_width, simplify,
+ curves, sketch)
+ pth = Path._fast_from_codes_and_verts(vertices, codes, self)
+ if not simplify:
+ pth._should_simplify = False
+ return pth
+
+ def transformed(self, transform):
+ """
+ Return a transformed copy of the path.
+
+ See Also
+ --------
+ matplotlib.transforms.TransformedPath
+ A specialized path class that will cache the transformed result and
+ automatically update when the transform changes.
+ """
+ return Path(transform.transform(self.vertices), self.codes,
+ self._interpolation_steps)
+
+ def contains_point(self, point, transform=None, radius=0.0):
+ """
+ Return whether the area enclosed by the path contains the given point.
+
+ The path is always treated as closed; i.e. if the last code is not
+ CLOSEPOLY an implicit segment connecting the last vertex to the first
+ vertex is assumed.
+
+ Parameters
+ ----------
+ point : (float, float)
+ The point (x, y) to check.
+ transform : `matplotlib.transforms.Transform`, optional
+ If not ``None``, *point* will be compared to ``self`` transformed
+ by *transform*; i.e. for a correct check, *transform* should
+ transform the path into the coordinate system of *point*.
+ radius : float, default: 0
+ Add an additional margin on the path in coordinates of *point*.
+ The path is extended tangentially by *radius/2*; i.e. if you would
+ draw the path with a linewidth of *radius*, all points on the line
+ would still be considered to be contained in the area. Conversely,
+ negative values shrink the area: Points on the imaginary line
+ will be considered outside the area.
+
+ Returns
+ -------
+ bool
+
+ Notes
+ -----
+ The current algorithm has some limitations:
+
+ - The result is undefined for points exactly at the boundary
+ (i.e. at the path shifted by *radius/2*).
+ - The result is undefined if there is no enclosed area, i.e. all
+ vertices are on a straight line.
+ - If bounding lines start to cross each other due to *radius* shift,
+ the result is not guaranteed to be correct.
+ """
+ if transform is not None:
+ transform = transform.frozen()
+ # `point_in_path` does not handle nonlinear transforms, so we
+ # transform the path ourselves. If *transform* is affine, letting
+ # `point_in_path` handle the transform avoids allocating an extra
+ # buffer.
+ if transform and not transform.is_affine:
+ self = transform.transform_path(self)
+ transform = None
+ return _path.point_in_path(point[0], point[1], radius, self, transform)
+
+ def contains_points(self, points, transform=None, radius=0.0):
+ """
+ Return whether the area enclosed by the path contains the given points.
+
+ The path is always treated as closed; i.e. if the last code is not
+ CLOSEPOLY an implicit segment connecting the last vertex to the first
+ vertex is assumed.
+
+ Parameters
+ ----------
+ points : (N, 2) array
+ The points to check. Columns contain x and y values.
+ transform : `matplotlib.transforms.Transform`, optional
+ If not ``None``, *points* will be compared to ``self`` transformed
+ by *transform*; i.e. for a correct check, *transform* should
+ transform the path into the coordinate system of *points*.
+ radius : float, default: 0
+ Add an additional margin on the path in coordinates of *points*.
+ The path is extended tangentially by *radius/2*; i.e. if you would
+ draw the path with a linewidth of *radius*, all points on the line
+ would still be considered to be contained in the area. Conversely,
+ negative values shrink the area: Points on the imaginary line
+ will be considered outside the area.
+
+ Returns
+ -------
+ length-N bool array
+
+ Notes
+ -----
+ The current algorithm has some limitations:
+
+ - The result is undefined for points exactly at the boundary
+ (i.e. at the path shifted by *radius/2*).
+ - The result is undefined if there is no enclosed area, i.e. all
+ vertices are on a straight line.
+ - If bounding lines start to cross each other due to *radius* shift,
+ the result is not guaranteed to be correct.
+ """
+ if transform is not None:
+ transform = transform.frozen()
+ result = _path.points_in_path(points, radius, self, transform)
+ return result.astype('bool')
+
+ def contains_path(self, path, transform=None):
+ """
+ Return whether this (closed) path completely contains the given path.
+
+ If *transform* is not ``None``, the path will be transformed before
+ checking for containment.
+ """
+ if transform is not None:
+ transform = transform.frozen()
+ return _path.path_in_path(self, None, path, transform)
+
+ def get_extents(self, transform=None, **kwargs):
+ """
+ Get Bbox of the path.
+
+ Parameters
+ ----------
+ transform : matplotlib.transforms.Transform, optional
+ Transform to apply to path before computing extents, if any.
+ **kwargs
+ Forwarded to `.iter_bezier`.
+
+ Returns
+ -------
+ matplotlib.transforms.Bbox
+ The extents of the path Bbox([[xmin, ymin], [xmax, ymax]])
+ """
+ from .transforms import Bbox
+ if transform is not None:
+ self = transform.transform_path(self)
+ if self.codes is None:
+ xys = self.vertices
+ elif len(np.intersect1d(self.codes, [Path.CURVE3, Path.CURVE4])) == 0:
+ # Optimization for the straight line case.
+ # Instead of iterating through each curve, consider
+ # each line segment's end-points
+ # (recall that STOP and CLOSEPOLY vertices are ignored)
+ xys = self.vertices[np.isin(self.codes,
+ [Path.MOVETO, Path.LINETO])]
+ else:
+ xys = []
+ for curve, code in self.iter_bezier(**kwargs):
+ # places where the derivative is zero can be extrema
+ _, dzeros = curve.axis_aligned_extrema()
+ # as can the ends of the curve
+ xys.append(curve([0, *dzeros, 1]))
+ xys = np.concatenate(xys)
+ if len(xys):
+ return Bbox([xys.min(axis=0), xys.max(axis=0)])
+ else:
+ return Bbox.null()
+
+ def intersects_path(self, other, filled=True):
+ """
+ Return whether if this path intersects another given path.
+
+ If *filled* is True, then this also returns True if one path completely
+ encloses the other (i.e., the paths are treated as filled).
+ """
+ return _path.path_intersects_path(self, other, filled)
+
+ def intersects_bbox(self, bbox, filled=True):
+ """
+ Return whether this path intersects a given `~.transforms.Bbox`.
+
+ If *filled* is True, then this also returns True if the path completely
+ encloses the `.Bbox` (i.e., the path is treated as filled).
+
+ The bounding box is always considered filled.
+ """
+ return _path.path_intersects_rectangle(
+ self, bbox.x0, bbox.y0, bbox.x1, bbox.y1, filled)
+
+ def interpolated(self, steps):
+ """
+ Return a new path resampled to length N x steps.
+
+ Codes other than LINETO are not handled correctly.
+ """
+ if steps == 1:
+ return self
+
+ vertices = simple_linear_interpolation(self.vertices, steps)
+ codes = self.codes
+ if codes is not None:
+ new_codes = np.full((len(codes) - 1) * steps + 1, Path.LINETO,
+ dtype=self.code_type)
+ new_codes[0::steps] = codes
+ else:
+ new_codes = None
+ return Path(vertices, new_codes)
+
+ def to_polygons(self, transform=None, width=0, height=0, closed_only=True):
+ """
+ Convert this path to a list of polygons or polylines. Each
+ polygon/polyline is an Nx2 array of vertices. In other words,
+ each polygon has no ``MOVETO`` instructions or curves. This
+ is useful for displaying in backends that do not support
+ compound paths or Bezier curves.
+
+ If *width* and *height* are both non-zero then the lines will
+ be simplified so that vertices outside of (0, 0), (width,
+ height) will be clipped.
+
+ If *closed_only* is `True` (default), only closed polygons,
+ with the last point being the same as the first point, will be
+ returned. Any unclosed polylines in the path will be
+ explicitly closed. If *closed_only* is `False`, any unclosed
+ polygons in the path will be returned as unclosed polygons,
+ and the closed polygons will be returned explicitly closed by
+ setting the last point to the same as the first point.
+ """
+ if len(self.vertices) == 0:
+ return []
+
+ if transform is not None:
+ transform = transform.frozen()
+
+ if self.codes is None and (width == 0 or height == 0):
+ vertices = self.vertices
+ if closed_only:
+ if len(vertices) < 3:
+ return []
+ elif np.any(vertices[0] != vertices[-1]):
+ vertices = [*vertices, vertices[0]]
+
+ if transform is None:
+ return [vertices]
+ else:
+ return [transform.transform(vertices)]
+
+ # Deal with the case where there are curves and/or multiple
+ # subpaths (using extension code)
+ return _path.convert_path_to_polygons(
+ self, transform, width, height, closed_only)
+
+ _unit_rectangle = None
+
+ @classmethod
+ def unit_rectangle(cls):
+ """
+ Return a `Path` instance of the unit rectangle from (0, 0) to (1, 1).
+ """
+ if cls._unit_rectangle is None:
+ cls._unit_rectangle = cls([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]],
+ closed=True, readonly=True)
+ return cls._unit_rectangle
+
+ _unit_regular_polygons = WeakValueDictionary()
+
+ @classmethod
+ def unit_regular_polygon(cls, numVertices):
+ """
+ Return a :class:`Path` instance for a unit regular polygon with the
+ given *numVertices* such that the circumscribing circle has radius 1.0,
+ centered at (0, 0).
+ """
+ if numVertices <= 16:
+ path = cls._unit_regular_polygons.get(numVertices)
+ else:
+ path = None
+ if path is None:
+ theta = ((2 * np.pi / numVertices) * np.arange(numVertices + 1)
+ # This initial rotation is to make sure the polygon always
+ # "points-up".
+ + np.pi / 2)
+ verts = np.column_stack((np.cos(theta), np.sin(theta)))
+ path = cls(verts, closed=True, readonly=True)
+ if numVertices <= 16:
+ cls._unit_regular_polygons[numVertices] = path
+ return path
+
+ _unit_regular_stars = WeakValueDictionary()
+
+ @classmethod
+ def unit_regular_star(cls, numVertices, innerCircle=0.5):
+ """
+ Return a :class:`Path` for a unit regular star with the given
+ numVertices and radius of 1.0, centered at (0, 0).
+ """
+ if numVertices <= 16:
+ path = cls._unit_regular_stars.get((numVertices, innerCircle))
+ else:
+ path = None
+ if path is None:
+ ns2 = numVertices * 2
+ theta = (2*np.pi/ns2 * np.arange(ns2 + 1))
+ # This initial rotation is to make sure the polygon always
+ # "points-up"
+ theta += np.pi / 2.0
+ r = np.ones(ns2 + 1)
+ r[1::2] = innerCircle
+ verts = (r * np.vstack((np.cos(theta), np.sin(theta)))).T
+ path = cls(verts, closed=True, readonly=True)
+ if numVertices <= 16:
+ cls._unit_regular_stars[(numVertices, innerCircle)] = path
+ return path
+
+ @classmethod
+ def unit_regular_asterisk(cls, numVertices):
+ """
+ Return a :class:`Path` for a unit regular asterisk with the given
+ numVertices and radius of 1.0, centered at (0, 0).
+ """
+ return cls.unit_regular_star(numVertices, 0.0)
+
+ _unit_circle = None
+
+ @classmethod
+ def unit_circle(cls):
+ """
+ Return the readonly :class:`Path` of the unit circle.
+
+ For most cases, :func:`Path.circle` will be what you want.
+ """
+ if cls._unit_circle is None:
+ cls._unit_circle = cls.circle(center=(0, 0), radius=1,
+ readonly=True)
+ return cls._unit_circle
+
+ @classmethod
+ def circle(cls, center=(0., 0.), radius=1., readonly=False):
+ """
+ Return a `Path` representing a circle of a given radius and center.
+
+ Parameters
+ ----------
+ center : (float, float), default: (0, 0)
+ The center of the circle.
+ radius : float, default: 1
+ The radius of the circle.
+ readonly : bool
+ Whether the created path should have the "readonly" argument
+ set when creating the Path instance.
+
+ Notes
+ -----
+ The circle is approximated using 8 cubic Bezier curves, as described in
+
+ Lancaster, Don. `Approximating a Circle or an Ellipse Using Four
+ Bezier Cubic Splines `_.
+ """
+ MAGIC = 0.2652031
+ SQRTHALF = np.sqrt(0.5)
+ MAGIC45 = SQRTHALF * MAGIC
+
+ vertices = np.array([[0.0, -1.0],
+
+ [MAGIC, -1.0],
+ [SQRTHALF-MAGIC45, -SQRTHALF-MAGIC45],
+ [SQRTHALF, -SQRTHALF],
+
+ [SQRTHALF+MAGIC45, -SQRTHALF+MAGIC45],
+ [1.0, -MAGIC],
+ [1.0, 0.0],
+
+ [1.0, MAGIC],
+ [SQRTHALF+MAGIC45, SQRTHALF-MAGIC45],
+ [SQRTHALF, SQRTHALF],
+
+ [SQRTHALF-MAGIC45, SQRTHALF+MAGIC45],
+ [MAGIC, 1.0],
+ [0.0, 1.0],
+
+ [-MAGIC, 1.0],
+ [-SQRTHALF+MAGIC45, SQRTHALF+MAGIC45],
+ [-SQRTHALF, SQRTHALF],
+
+ [-SQRTHALF-MAGIC45, SQRTHALF-MAGIC45],
+ [-1.0, MAGIC],
+ [-1.0, 0.0],
+
+ [-1.0, -MAGIC],
+ [-SQRTHALF-MAGIC45, -SQRTHALF+MAGIC45],
+ [-SQRTHALF, -SQRTHALF],
+
+ [-SQRTHALF+MAGIC45, -SQRTHALF-MAGIC45],
+ [-MAGIC, -1.0],
+ [0.0, -1.0],
+
+ [0.0, -1.0]],
+ dtype=float)
+
+ codes = [cls.CURVE4] * 26
+ codes[0] = cls.MOVETO
+ codes[-1] = cls.CLOSEPOLY
+ return Path(vertices * radius + center, codes, readonly=readonly)
+
+ _unit_circle_righthalf = None
+
+ @classmethod
+ def unit_circle_righthalf(cls):
+ """
+ Return a `Path` of the right half of a unit circle.
+
+ See `Path.circle` for the reference on the approximation used.
+ """
+ if cls._unit_circle_righthalf is None:
+ MAGIC = 0.2652031
+ SQRTHALF = np.sqrt(0.5)
+ MAGIC45 = SQRTHALF * MAGIC
+
+ vertices = np.array(
+ [[0.0, -1.0],
+
+ [MAGIC, -1.0],
+ [SQRTHALF-MAGIC45, -SQRTHALF-MAGIC45],
+ [SQRTHALF, -SQRTHALF],
+
+ [SQRTHALF+MAGIC45, -SQRTHALF+MAGIC45],
+ [1.0, -MAGIC],
+ [1.0, 0.0],
+
+ [1.0, MAGIC],
+ [SQRTHALF+MAGIC45, SQRTHALF-MAGIC45],
+ [SQRTHALF, SQRTHALF],
+
+ [SQRTHALF-MAGIC45, SQRTHALF+MAGIC45],
+ [MAGIC, 1.0],
+ [0.0, 1.0],
+
+ [0.0, -1.0]],
+
+ float)
+
+ codes = np.full(14, cls.CURVE4, dtype=cls.code_type)
+ codes[0] = cls.MOVETO
+ codes[-1] = cls.CLOSEPOLY
+
+ cls._unit_circle_righthalf = cls(vertices, codes, readonly=True)
+ return cls._unit_circle_righthalf
+
+ @classmethod
+ def arc(cls, theta1, theta2, n=None, is_wedge=False):
+ """
+ Return the unit circle arc from angles *theta1* to *theta2* (in
+ degrees).
+
+ *theta2* is unwrapped to produce the shortest arc within 360 degrees.
+ That is, if *theta2* > *theta1* + 360, the arc will be from *theta1* to
+ *theta2* - 360 and not a full circle plus some extra overlap.
+
+ If *n* is provided, it is the number of spline segments to make.
+ If *n* is not provided, the number of spline segments is
+ determined based on the delta between *theta1* and *theta2*.
+
+ Masionobe, L. 2003. `Drawing an elliptical arc using
+ polylines, quadratic or cubic Bezier curves
+ `_.
+ """
+ halfpi = np.pi * 0.5
+
+ eta1 = theta1
+ eta2 = theta2 - 360 * np.floor((theta2 - theta1) / 360)
+ # Ensure 2pi range is not flattened to 0 due to floating-point errors,
+ # but don't try to expand existing 0 range.
+ if theta2 != theta1 and eta2 <= eta1:
+ eta2 += 360
+ eta1, eta2 = np.deg2rad([eta1, eta2])
+
+ # number of curve segments to make
+ if n is None:
+ n = int(2 ** np.ceil((eta2 - eta1) / halfpi))
+ if n < 1:
+ raise ValueError("n must be >= 1 or None")
+
+ deta = (eta2 - eta1) / n
+ t = np.tan(0.5 * deta)
+ alpha = np.sin(deta) * (np.sqrt(4.0 + 3.0 * t * t) - 1) / 3.0
+
+ steps = np.linspace(eta1, eta2, n + 1, True)
+ cos_eta = np.cos(steps)
+ sin_eta = np.sin(steps)
+
+ xA = cos_eta[:-1]
+ yA = sin_eta[:-1]
+ xA_dot = -yA
+ yA_dot = xA
+
+ xB = cos_eta[1:]
+ yB = sin_eta[1:]
+ xB_dot = -yB
+ yB_dot = xB
+
+ if is_wedge:
+ length = n * 3 + 4
+ vertices = np.zeros((length, 2), float)
+ codes = np.full(length, cls.CURVE4, dtype=cls.code_type)
+ vertices[1] = [xA[0], yA[0]]
+ codes[0:2] = [cls.MOVETO, cls.LINETO]
+ codes[-2:] = [cls.LINETO, cls.CLOSEPOLY]
+ vertex_offset = 2
+ end = length - 2
+ else:
+ length = n * 3 + 1
+ vertices = np.empty((length, 2), float)
+ codes = np.full(length, cls.CURVE4, dtype=cls.code_type)
+ vertices[0] = [xA[0], yA[0]]
+ codes[0] = cls.MOVETO
+ vertex_offset = 1
+ end = length
+
+ vertices[vertex_offset:end:3, 0] = xA + alpha * xA_dot
+ vertices[vertex_offset:end:3, 1] = yA + alpha * yA_dot
+ vertices[vertex_offset+1:end:3, 0] = xB - alpha * xB_dot
+ vertices[vertex_offset+1:end:3, 1] = yB - alpha * yB_dot
+ vertices[vertex_offset+2:end:3, 0] = xB
+ vertices[vertex_offset+2:end:3, 1] = yB
+
+ return cls(vertices, codes, readonly=True)
+
+ @classmethod
+ def wedge(cls, theta1, theta2, n=None):
+ """
+ Return the unit circle wedge from angles *theta1* to *theta2* (in
+ degrees).
+
+ *theta2* is unwrapped to produce the shortest wedge within 360 degrees.
+ That is, if *theta2* > *theta1* + 360, the wedge will be from *theta1*
+ to *theta2* - 360 and not a full circle plus some extra overlap.
+
+ If *n* is provided, it is the number of spline segments to make.
+ If *n* is not provided, the number of spline segments is
+ determined based on the delta between *theta1* and *theta2*.
+
+ See `Path.arc` for the reference on the approximation used.
+ """
+ return cls.arc(theta1, theta2, n, True)
+
+ @staticmethod
+ @lru_cache(8)
+ def hatch(hatchpattern, density=6):
+ """
+ Given a hatch specifier, *hatchpattern*, generates a Path that
+ can be used in a repeated hatching pattern. *density* is the
+ number of lines per unit square.
+ """
+ from matplotlib.hatch import get_path
+ return (get_path(hatchpattern, density)
+ if hatchpattern is not None else None)
+
+ def clip_to_bbox(self, bbox, inside=True):
+ """
+ Clip the path to the given bounding box.
+
+ The path must be made up of one or more closed polygons. This
+ algorithm will not behave correctly for unclosed paths.
+
+ If *inside* is `True`, clip to the inside of the box, otherwise
+ to the outside of the box.
+ """
+ # Use make_compound_path_from_polys
+ verts = _path.clip_path_to_rect(self, bbox, inside)
+ paths = [Path(poly) for poly in verts]
+ return self.make_compound_path(*paths)
+
+
+def get_path_collection_extents(
+ master_transform, paths, transforms, offsets, offset_transform):
+ r"""
+ Given a sequence of `Path`\s, `~.Transform`\s objects, and offsets, as
+ found in a `~.PathCollection`, returns the bounding box that encapsulates
+ all of them.
+
+ Parameters
+ ----------
+ master_transform : `~.Transform`
+ Global transformation applied to all paths.
+ paths : list of `Path`
+ transforms : list of `~.Affine2D`
+ offsets : (N, 2) array-like
+ offset_transform : `~.Affine2D`
+ Transform applied to the offsets before offsetting the path.
+
+ Notes
+ -----
+ The way that *paths*, *transforms* and *offsets* are combined
+ follows the same method as for collections: Each is iterated over
+ independently, so if you have 3 paths, 2 transforms and 1 offset,
+ their combinations are as follows:
+
+ (A, A, A), (B, B, A), (C, A, A)
+ """
+ from .transforms import Bbox
+ if len(paths) == 0:
+ raise ValueError("No paths provided")
+ extents, minpos = _path.get_path_collection_extents(
+ master_transform, paths, np.atleast_3d(transforms),
+ offsets, offset_transform)
+ return Bbox.from_extents(*extents, minpos=minpos)
diff --git a/venv/Lib/site-packages/matplotlib/patheffects.py b/venv/Lib/site-packages/matplotlib/patheffects.py
new file mode 100644
index 0000000..fb66df4
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/patheffects.py
@@ -0,0 +1,517 @@
+"""
+Defines classes for path effects. The path effects are supported in `~.Text`,
+`~.Line2D` and `~.Patch`.
+
+.. seealso::
+ :doc:`/tutorials/advanced/patheffects_guide`
+"""
+
+from matplotlib.backend_bases import RendererBase
+from matplotlib import colors as mcolors
+from matplotlib import patches as mpatches
+from matplotlib import transforms as mtransforms
+from matplotlib.path import Path
+import numpy as np
+
+
+class AbstractPathEffect:
+ """
+ A base class for path effects.
+
+ Subclasses should override the ``draw_path`` method to add effect
+ functionality.
+ """
+
+ def __init__(self, offset=(0., 0.)):
+ """
+ Parameters
+ ----------
+ offset : (float, float), default: (0, 0)
+ The (x, y) offset to apply to the path, measured in points.
+ """
+ self._offset = offset
+
+ def _offset_transform(self, renderer):
+ """Apply the offset to the given transform."""
+ return mtransforms.Affine2D().translate(
+ *map(renderer.points_to_pixels, self._offset))
+
+ def _update_gc(self, gc, new_gc_dict):
+ """
+ Update the given GraphicsContext with the given dict of properties.
+
+ The keys in the dictionary are used to identify the appropriate
+ ``set_`` method on the *gc*.
+ """
+ new_gc_dict = new_gc_dict.copy()
+
+ dashes = new_gc_dict.pop("dashes", None)
+ if dashes:
+ gc.set_dashes(**dashes)
+
+ for k, v in new_gc_dict.items():
+ set_method = getattr(gc, 'set_' + k, None)
+ if not callable(set_method):
+ raise AttributeError('Unknown property {0}'.format(k))
+ set_method(v)
+ return gc
+
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace=None):
+ """
+ Derived should override this method. The arguments are the same
+ as :meth:`matplotlib.backend_bases.RendererBase.draw_path`
+ except the first argument is a renderer.
+ """
+ # Get the real renderer, not a PathEffectRenderer.
+ if isinstance(renderer, PathEffectRenderer):
+ renderer = renderer._renderer
+ return renderer.draw_path(gc, tpath, affine, rgbFace)
+
+
+class PathEffectRenderer(RendererBase):
+ """
+ Implements a Renderer which contains another renderer.
+
+ This proxy then intercepts draw calls, calling the appropriate
+ :class:`AbstractPathEffect` draw method.
+
+ .. note::
+ Not all methods have been overridden on this RendererBase subclass.
+ It may be necessary to add further methods to extend the PathEffects
+ capabilities further.
+ """
+
+ def __init__(self, path_effects, renderer):
+ """
+ Parameters
+ ----------
+ path_effects : iterable of :class:`AbstractPathEffect`
+ The path effects which this renderer represents.
+ renderer : `matplotlib.backend_bases.RendererBase` subclass
+
+ """
+ self._path_effects = path_effects
+ self._renderer = renderer
+
+ def copy_with_path_effect(self, path_effects):
+ return self.__class__(path_effects, self._renderer)
+
+ def draw_path(self, gc, tpath, affine, rgbFace=None):
+ for path_effect in self._path_effects:
+ path_effect.draw_path(self._renderer, gc, tpath, affine,
+ rgbFace)
+
+ def draw_markers(
+ self, gc, marker_path, marker_trans, path, *args, **kwargs):
+ # We do a little shimmy so that all markers are drawn for each path
+ # effect in turn. Essentially, we induce recursion (depth 1) which is
+ # terminated once we have just a single path effect to work with.
+ if len(self._path_effects) == 1:
+ # Call the base path effect function - this uses the unoptimised
+ # approach of calling "draw_path" multiple times.
+ return super().draw_markers(gc, marker_path, marker_trans, path,
+ *args, **kwargs)
+
+ for path_effect in self._path_effects:
+ renderer = self.copy_with_path_effect([path_effect])
+ # Recursively call this method, only next time we will only have
+ # one path effect.
+ renderer.draw_markers(gc, marker_path, marker_trans, path,
+ *args, **kwargs)
+
+ def draw_path_collection(self, gc, master_transform, paths, *args,
+ **kwargs):
+ # We do a little shimmy so that all paths are drawn for each path
+ # effect in turn. Essentially, we induce recursion (depth 1) which is
+ # terminated once we have just a single path effect to work with.
+ if len(self._path_effects) == 1:
+ # Call the base path effect function - this uses the unoptimised
+ # approach of calling "draw_path" multiple times.
+ return super().draw_path_collection(gc, master_transform, paths,
+ *args, **kwargs)
+
+ for path_effect in self._path_effects:
+ renderer = self.copy_with_path_effect([path_effect])
+ # Recursively call this method, only next time we will only have
+ # one path effect.
+ renderer.draw_path_collection(gc, master_transform, paths,
+ *args, **kwargs)
+
+ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath):
+ # Implements the naive text drawing as is found in RendererBase.
+ path, transform = self._get_text_path_transform(x, y, s, prop,
+ angle, ismath)
+ color = gc.get_rgb()
+ gc.set_linewidth(0.0)
+ self.draw_path(gc, path, transform, rgbFace=color)
+
+ def __getattribute__(self, name):
+ if name in ['flipy', 'get_canvas_width_height', 'new_gc',
+ 'points_to_pixels', '_text2path', 'height', 'width']:
+ return getattr(self._renderer, name)
+ else:
+ return object.__getattribute__(self, name)
+
+
+class Normal(AbstractPathEffect):
+ """
+ The "identity" PathEffect.
+
+ The Normal PathEffect's sole purpose is to draw the original artist with
+ no special path effect.
+ """
+
+
+def _subclass_with_normal(effect_class):
+ """
+ Create a PathEffect class combining *effect_class* and a normal draw.
+ """
+
+ class withEffect(effect_class):
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
+ super().draw_path(renderer, gc, tpath, affine, rgbFace)
+ renderer.draw_path(gc, tpath, affine, rgbFace)
+
+ withEffect.__name__ = f"with{effect_class.__name__}"
+ withEffect.__qualname__ = f"with{effect_class.__name__}"
+ withEffect.__doc__ = f"""
+ A shortcut PathEffect for applying `.{effect_class.__name__}` and then
+ drawing the original Artist.
+
+ With this class you can use ::
+
+ artist.set_path_effects([path_effects.with{effect_class.__name__}()])
+
+ as a shortcut for ::
+
+ artist.set_path_effects([path_effects.{effect_class.__name__}(),
+ path_effects.Normal()])
+ """
+ # Docstring inheritance doesn't work for locally-defined subclasses.
+ withEffect.draw_path.__doc__ = effect_class.draw_path.__doc__
+ return withEffect
+
+
+class Stroke(AbstractPathEffect):
+ """A line based PathEffect which re-draws a stroke."""
+
+ def __init__(self, offset=(0, 0), **kwargs):
+ """
+ The path will be stroked with its gc updated with the given
+ keyword arguments, i.e., the keyword arguments should be valid
+ gc parameter values.
+ """
+ super().__init__(offset)
+ self._gc = kwargs
+
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
+ """Draw the path with updated gc."""
+ gc0 = renderer.new_gc() # Don't modify gc, but a copy!
+ gc0.copy_properties(gc)
+ gc0 = self._update_gc(gc0, self._gc)
+ renderer.draw_path(
+ gc0, tpath, affine + self._offset_transform(renderer), rgbFace)
+ gc0.restore()
+
+
+withStroke = _subclass_with_normal(effect_class=Stroke)
+
+
+class SimplePatchShadow(AbstractPathEffect):
+ """A simple shadow via a filled patch."""
+
+ def __init__(self, offset=(2, -2),
+ shadow_rgbFace=None, alpha=None,
+ rho=0.3, **kwargs):
+ """
+ Parameters
+ ----------
+ offset : (float, float), default: (2, -2)
+ The (x, y) offset of the shadow in points.
+ shadow_rgbFace : color
+ The shadow color.
+ alpha : float, default: 0.3
+ The alpha transparency of the created shadow patch.
+ http://matplotlib.1069221.n5.nabble.com/path-effects-question-td27630.html
+ rho : float, default: 0.3
+ A scale factor to apply to the rgbFace color if *shadow_rgbFace*
+ is not specified.
+ **kwargs
+ Extra keywords are stored and passed through to
+ :meth:`AbstractPathEffect._update_gc`.
+
+ """
+ super().__init__(offset)
+
+ if shadow_rgbFace is None:
+ self._shadow_rgbFace = shadow_rgbFace
+ else:
+ self._shadow_rgbFace = mcolors.to_rgba(shadow_rgbFace)
+
+ if alpha is None:
+ alpha = 0.3
+
+ self._alpha = alpha
+ self._rho = rho
+
+ #: The dictionary of keywords to update the graphics collection with.
+ self._gc = kwargs
+
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
+ """
+ Overrides the standard draw_path to add the shadow offset and
+ necessary color changes for the shadow.
+ """
+ gc0 = renderer.new_gc() # Don't modify gc, but a copy!
+ gc0.copy_properties(gc)
+
+ if self._shadow_rgbFace is None:
+ r, g, b = (rgbFace or (1., 1., 1.))[:3]
+ # Scale the colors by a factor to improve the shadow effect.
+ shadow_rgbFace = (r * self._rho, g * self._rho, b * self._rho)
+ else:
+ shadow_rgbFace = self._shadow_rgbFace
+
+ gc0.set_foreground("none")
+ gc0.set_alpha(self._alpha)
+ gc0.set_linewidth(0)
+
+ gc0 = self._update_gc(gc0, self._gc)
+ renderer.draw_path(
+ gc0, tpath, affine + self._offset_transform(renderer),
+ shadow_rgbFace)
+ gc0.restore()
+
+
+withSimplePatchShadow = _subclass_with_normal(effect_class=SimplePatchShadow)
+
+
+class SimpleLineShadow(AbstractPathEffect):
+ """A simple shadow via a line."""
+
+ def __init__(self, offset=(2, -2),
+ shadow_color='k', alpha=0.3, rho=0.3, **kwargs):
+ """
+ Parameters
+ ----------
+ offset : (float, float), default: (2, -2)
+ The (x, y) offset to apply to the path, in points.
+ shadow_color : color, default: 'black'
+ The shadow color.
+ A value of ``None`` takes the original artist's color
+ with a scale factor of *rho*.
+ alpha : float, default: 0.3
+ The alpha transparency of the created shadow patch.
+ rho : float, default: 0.3
+ A scale factor to apply to the rgbFace color if *shadow_color*
+ is ``None``.
+ **kwargs
+ Extra keywords are stored and passed through to
+ :meth:`AbstractPathEffect._update_gc`.
+ """
+ super().__init__(offset)
+ if shadow_color is None:
+ self._shadow_color = shadow_color
+ else:
+ self._shadow_color = mcolors.to_rgba(shadow_color)
+ self._alpha = alpha
+ self._rho = rho
+ #: The dictionary of keywords to update the graphics collection with.
+ self._gc = kwargs
+
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
+ """
+ Overrides the standard draw_path to add the shadow offset and
+ necessary color changes for the shadow.
+ """
+ gc0 = renderer.new_gc() # Don't modify gc, but a copy!
+ gc0.copy_properties(gc)
+
+ if self._shadow_color is None:
+ r, g, b = (gc0.get_foreground() or (1., 1., 1.))[:3]
+ # Scale the colors by a factor to improve the shadow effect.
+ shadow_rgbFace = (r * self._rho, g * self._rho, b * self._rho)
+ else:
+ shadow_rgbFace = self._shadow_color
+
+ gc0.set_foreground(shadow_rgbFace)
+ gc0.set_alpha(self._alpha)
+
+ gc0 = self._update_gc(gc0, self._gc)
+ renderer.draw_path(
+ gc0, tpath, affine + self._offset_transform(renderer))
+ gc0.restore()
+
+
+class PathPatchEffect(AbstractPathEffect):
+ """
+ Draws a `.PathPatch` instance whose Path comes from the original
+ PathEffect artist.
+ """
+
+ def __init__(self, offset=(0, 0), **kwargs):
+ """
+ Parameters
+ ----------
+ offset : (float, float), default: (0, 0)
+ The (x, y) offset to apply to the path, in points.
+ **kwargs
+ All keyword arguments are passed through to the
+ :class:`~matplotlib.patches.PathPatch` constructor. The
+ properties which cannot be overridden are "path", "clip_box"
+ "transform" and "clip_path".
+ """
+ super().__init__(offset=offset)
+ self.patch = mpatches.PathPatch([], **kwargs)
+
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
+ self.patch._path = tpath
+ self.patch.set_transform(affine + self._offset_transform(renderer))
+ self.patch.set_clip_box(gc.get_clip_rectangle())
+ clip_path = gc.get_clip_path()
+ if clip_path:
+ self.patch.set_clip_path(*clip_path)
+ self.patch.draw(renderer)
+
+
+class TickedStroke(AbstractPathEffect):
+ """
+ A line-based PathEffect which draws a path with a ticked style.
+
+ This line style is frequently used to represent constraints in
+ optimization. The ticks may be used to indicate that one side
+ of the line is invalid or to represent a closed boundary of a
+ domain (i.e. a wall or the edge of a pipe).
+
+ The spacing, length, and angle of ticks can be controlled.
+
+ This line style is sometimes referred to as a hatched line.
+
+ See also the :doc:`contour demo example
+ `.
+
+ See also the :doc:`contours in optimization example
+ `.
+ """
+
+ def __init__(self, offset=(0, 0),
+ spacing=10.0, angle=45.0, length=np.sqrt(2),
+ **kwargs):
+ """
+ Parameters
+ ----------
+ offset : (float, float), default: (0, 0)
+ The (x, y) offset to apply to the path, in points.
+ spacing : float, default: 10.0
+ The spacing between ticks in points.
+ angle : float, default: 45.0
+ The angle between the path and the tick in degrees. The angle
+ is measured as if you were an ant walking along the curve, with
+ zero degrees pointing directly ahead, 90 to your left, -90
+ to your right, and 180 behind you.
+ length : float, default: 1.414
+ The length of the tick relative to spacing.
+ Recommended length = 1.414 (sqrt(2)) when angle=45, length=1.0
+ when angle=90 and length=2.0 when angle=60.
+ **kwargs
+ Extra keywords are stored and passed through to
+ :meth:`AbstractPathEffect._update_gc`.
+
+ Examples
+ --------
+ See :doc:`/gallery/misc/tickedstroke_demo`.
+ """
+ super().__init__(offset)
+
+ self._spacing = spacing
+ self._angle = angle
+ self._length = length
+ self._gc = kwargs
+
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
+ """Draw the path with updated gc."""
+ # Do not modify the input! Use copy instead.
+ gc0 = renderer.new_gc()
+ gc0.copy_properties(gc)
+
+ gc0 = self._update_gc(gc0, self._gc)
+ trans = affine + self._offset_transform(renderer)
+
+ theta = -np.radians(self._angle)
+ trans_matrix = np.array([[np.cos(theta), -np.sin(theta)],
+ [np.sin(theta), np.cos(theta)]])
+
+ # Convert spacing parameter to pixels.
+ spacing_px = renderer.points_to_pixels(self._spacing)
+
+ # Transform before evaluation because to_polygons works at resolution
+ # of one -- assuming it is working in pixel space.
+ transpath = affine.transform_path(tpath)
+
+ # Evaluate path to straight line segments that can be used to
+ # construct line ticks.
+ polys = transpath.to_polygons(closed_only=False)
+
+ for p in polys:
+ x = p[:, 0]
+ y = p[:, 1]
+
+ # Can not interpolate points or draw line if only one point in
+ # polyline.
+ if x.size < 2:
+ continue
+
+ # Find distance between points on the line
+ ds = np.hypot(x[1:] - x[:-1], y[1:] - y[:-1])
+
+ # Build parametric coordinate along curve
+ s = np.concatenate(([0.0], np.cumsum(ds)))
+ s_total = s[-1]
+
+ num = int(np.ceil(s_total / spacing_px)) - 1
+ # Pick parameter values for ticks.
+ s_tick = np.linspace(spacing_px/2, s_total - spacing_px/2, num)
+
+ # Find points along the parameterized curve
+ x_tick = np.interp(s_tick, s, x)
+ y_tick = np.interp(s_tick, s, y)
+
+ # Find unit vectors in local direction of curve
+ delta_s = self._spacing * .001
+ u = (np.interp(s_tick + delta_s, s, x) - x_tick) / delta_s
+ v = (np.interp(s_tick + delta_s, s, y) - y_tick) / delta_s
+
+ # Normalize slope into unit slope vector.
+ n = np.hypot(u, v)
+ mask = n == 0
+ n[mask] = 1.0
+
+ uv = np.array([u / n, v / n]).T
+ uv[mask] = np.array([0, 0]).T
+
+ # Rotate and scale unit vector into tick vector
+ dxy = np.dot(uv, trans_matrix) * self._length * spacing_px
+
+ # Build tick endpoints
+ x_end = x_tick + dxy[:, 0]
+ y_end = y_tick + dxy[:, 1]
+
+ # Interleave ticks to form Path vertices
+ xyt = np.empty((2 * num, 2), dtype=x_tick.dtype)
+ xyt[0::2, 0] = x_tick
+ xyt[1::2, 0] = x_end
+ xyt[0::2, 1] = y_tick
+ xyt[1::2, 1] = y_end
+
+ # Build up vector of Path codes
+ codes = np.tile([Path.MOVETO, Path.LINETO], num)
+
+ # Construct and draw resulting path
+ h = Path(xyt, codes)
+ # Transform back to data space during render
+ renderer.draw_path(gc0, h, affine.inverted() + trans, rgbFace)
+
+ gc0.restore()
+
+
+withTickedStroke = _subclass_with_normal(effect_class=TickedStroke)
diff --git a/venv/Lib/site-packages/matplotlib/projections/__init__.py b/venv/Lib/site-packages/matplotlib/projections/__init__.py
new file mode 100644
index 0000000..5562738
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/projections/__init__.py
@@ -0,0 +1,60 @@
+from .. import axes, docstring
+from .geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
+from .polar import PolarAxes
+from mpl_toolkits.mplot3d import Axes3D
+
+
+class ProjectionRegistry:
+ """A mapping of registered projection names to projection classes."""
+
+ def __init__(self):
+ self._all_projection_types = {}
+
+ def register(self, *projections):
+ """Register a new set of projections."""
+ for projection in projections:
+ name = projection.name
+ self._all_projection_types[name] = projection
+
+ def get_projection_class(self, name):
+ """Get a projection class from its *name*."""
+ return self._all_projection_types[name]
+
+ def get_projection_names(self):
+ """Return the names of all projections currently registered."""
+ return sorted(self._all_projection_types)
+
+
+projection_registry = ProjectionRegistry()
+projection_registry.register(
+ axes.Axes,
+ PolarAxes,
+ AitoffAxes,
+ HammerAxes,
+ LambertAxes,
+ MollweideAxes,
+ Axes3D,
+)
+
+
+def register_projection(cls):
+ projection_registry.register(cls)
+
+
+def get_projection_class(projection=None):
+ """
+ Get a projection class from its name.
+
+ If *projection* is None, a standard rectilinear projection is returned.
+ """
+ if projection is None:
+ projection = 'rectilinear'
+
+ try:
+ return projection_registry.get_projection_class(projection)
+ except KeyError as err:
+ raise ValueError("Unknown projection %r" % projection) from err
+
+
+get_projection_names = projection_registry.get_projection_names
+docstring.interpd.update(projection_names=get_projection_names())
diff --git a/venv/Lib/site-packages/matplotlib/projections/geo.py b/venv/Lib/site-packages/matplotlib/projections/geo.py
new file mode 100644
index 0000000..4aa374c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/projections/geo.py
@@ -0,0 +1,507 @@
+import numpy as np
+
+from matplotlib import _api, rcParams
+from matplotlib.axes import Axes
+import matplotlib.axis as maxis
+from matplotlib.patches import Circle
+from matplotlib.path import Path
+import matplotlib.spines as mspines
+from matplotlib.ticker import (
+ Formatter, NullLocator, FixedLocator, NullFormatter)
+from matplotlib.transforms import Affine2D, BboxTransformTo, Transform
+
+
+class GeoAxes(Axes):
+ """An abstract base class for geographic projections."""
+
+ class ThetaFormatter(Formatter):
+ """
+ Used to format the theta tick labels. Converts the native
+ unit of radians into degrees and adds a degree symbol.
+ """
+ def __init__(self, round_to=1.0):
+ self._round_to = round_to
+
+ def __call__(self, x, pos=None):
+ degrees = round(np.rad2deg(x) / self._round_to) * self._round_to
+ return f"{degrees:0.0f}\N{DEGREE SIGN}"
+
+ RESOLUTION = 75
+
+ def _init_axis(self):
+ self.xaxis = maxis.XAxis(self)
+ self.yaxis = maxis.YAxis(self)
+ # Do not register xaxis or yaxis with spines -- as done in
+ # Axes._init_axis() -- until GeoAxes.xaxis.clear() works.
+ # self.spines['geo'].register_axis(self.yaxis)
+ self._update_transScale()
+
+ def cla(self):
+ super().cla()
+
+ self.set_longitude_grid(30)
+ self.set_latitude_grid(15)
+ self.set_longitude_grid_ends(75)
+ self.xaxis.set_minor_locator(NullLocator())
+ self.yaxis.set_minor_locator(NullLocator())
+ self.xaxis.set_ticks_position('none')
+ self.yaxis.set_ticks_position('none')
+ self.yaxis.set_tick_params(label1On=True)
+ # Why do we need to turn on yaxis tick labels, but
+ # xaxis tick labels are already on?
+
+ self.grid(rcParams['axes.grid'])
+
+ Axes.set_xlim(self, -np.pi, np.pi)
+ Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)
+
+ def _set_lim_and_transforms(self):
+ # A (possibly non-linear) projection on the (already scaled) data
+ self.transProjection = self._get_core_transform(self.RESOLUTION)
+
+ self.transAffine = self._get_affine_transform()
+
+ self.transAxes = BboxTransformTo(self.bbox)
+
+ # The complete data transformation stack -- from data all the
+ # way to display coordinates
+ self.transData = \
+ self.transProjection + \
+ self.transAffine + \
+ self.transAxes
+
+ # This is the transform for longitude ticks.
+ self._xaxis_pretransform = \
+ Affine2D() \
+ .scale(1, self._longitude_cap * 2) \
+ .translate(0, -self._longitude_cap)
+ self._xaxis_transform = \
+ self._xaxis_pretransform + \
+ self.transData
+ self._xaxis_text1_transform = \
+ Affine2D().scale(1, 0) + \
+ self.transData + \
+ Affine2D().translate(0, 4)
+ self._xaxis_text2_transform = \
+ Affine2D().scale(1, 0) + \
+ self.transData + \
+ Affine2D().translate(0, -4)
+
+ # This is the transform for latitude ticks.
+ yaxis_stretch = Affine2D().scale(np.pi * 2, 1).translate(-np.pi, 0)
+ yaxis_space = Affine2D().scale(1, 1.1)
+ self._yaxis_transform = \
+ yaxis_stretch + \
+ self.transData
+ yaxis_text_base = \
+ yaxis_stretch + \
+ self.transProjection + \
+ (yaxis_space +
+ self.transAffine +
+ self.transAxes)
+ self._yaxis_text1_transform = \
+ yaxis_text_base + \
+ Affine2D().translate(-8, 0)
+ self._yaxis_text2_transform = \
+ yaxis_text_base + \
+ Affine2D().translate(8, 0)
+
+ def _get_affine_transform(self):
+ transform = self._get_core_transform(1)
+ xscale, _ = transform.transform((np.pi, 0))
+ _, yscale = transform.transform((0, np.pi/2))
+ return Affine2D() \
+ .scale(0.5 / xscale, 0.5 / yscale) \
+ .translate(0.5, 0.5)
+
+ def get_xaxis_transform(self, which='grid'):
+ _api.check_in_list(['tick1', 'tick2', 'grid'], which=which)
+ return self._xaxis_transform
+
+ def get_xaxis_text1_transform(self, pad):
+ return self._xaxis_text1_transform, 'bottom', 'center'
+
+ def get_xaxis_text2_transform(self, pad):
+ return self._xaxis_text2_transform, 'top', 'center'
+
+ def get_yaxis_transform(self, which='grid'):
+ _api.check_in_list(['tick1', 'tick2', 'grid'], which=which)
+ return self._yaxis_transform
+
+ def get_yaxis_text1_transform(self, pad):
+ return self._yaxis_text1_transform, 'center', 'right'
+
+ def get_yaxis_text2_transform(self, pad):
+ return self._yaxis_text2_transform, 'center', 'left'
+
+ def _gen_axes_patch(self):
+ return Circle((0.5, 0.5), 0.5)
+
+ def _gen_axes_spines(self):
+ return {'geo': mspines.Spine.circular_spine(self, (0.5, 0.5), 0.5)}
+
+ def set_yscale(self, *args, **kwargs):
+ if args[0] != 'linear':
+ raise NotImplementedError
+
+ set_xscale = set_yscale
+
+ def set_xlim(self, *args, **kwargs):
+ raise TypeError("Changing axes limits of a geographic projection is "
+ "not supported. Please consider using Cartopy.")
+
+ set_ylim = set_xlim
+
+ def format_coord(self, lon, lat):
+ """Return a format string formatting the coordinate."""
+ lon, lat = np.rad2deg([lon, lat])
+ if lat >= 0.0:
+ ns = 'N'
+ else:
+ ns = 'S'
+ if lon >= 0.0:
+ ew = 'E'
+ else:
+ ew = 'W'
+ return ('%f\N{DEGREE SIGN}%s, %f\N{DEGREE SIGN}%s'
+ % (abs(lat), ns, abs(lon), ew))
+
+ def set_longitude_grid(self, degrees):
+ """
+ Set the number of degrees between each longitude grid.
+ """
+ # Skip -180 and 180, which are the fixed limits.
+ grid = np.arange(-180 + degrees, 180, degrees)
+ self.xaxis.set_major_locator(FixedLocator(np.deg2rad(grid)))
+ self.xaxis.set_major_formatter(self.ThetaFormatter(degrees))
+
+ def set_latitude_grid(self, degrees):
+ """
+ Set the number of degrees between each latitude grid.
+ """
+ # Skip -90 and 90, which are the fixed limits.
+ grid = np.arange(-90 + degrees, 90, degrees)
+ self.yaxis.set_major_locator(FixedLocator(np.deg2rad(grid)))
+ self.yaxis.set_major_formatter(self.ThetaFormatter(degrees))
+
+ def set_longitude_grid_ends(self, degrees):
+ """
+ Set the latitude(s) at which to stop drawing the longitude grids.
+ """
+ self._longitude_cap = np.deg2rad(degrees)
+ self._xaxis_pretransform \
+ .clear() \
+ .scale(1.0, self._longitude_cap * 2.0) \
+ .translate(0.0, -self._longitude_cap)
+
+ def get_data_ratio(self):
+ """Return the aspect ratio of the data itself."""
+ return 1.0
+
+ ### Interactive panning
+
+ def can_zoom(self):
+ """
+ Return whether this axes supports the zoom box button functionality.
+
+ This axes object does not support interactive zoom box.
+ """
+ return False
+
+ def can_pan(self):
+ """
+ Return whether this axes supports the pan/zoom button functionality.
+
+ This axes object does not support interactive pan/zoom.
+ """
+ return False
+
+ def start_pan(self, x, y, button):
+ pass
+
+ def end_pan(self):
+ pass
+
+ def drag_pan(self, button, key, x, y):
+ pass
+
+
+class _GeoTransform(Transform):
+ # Factoring out some common functionality.
+ input_dims = output_dims = 2
+
+ def __init__(self, resolution):
+ """
+ Create a new geographical transform.
+
+ Resolution is the number of steps to interpolate between each input
+ line segment to approximate its path in curved space.
+ """
+ super().__init__()
+ self._resolution = resolution
+
+ def __str__(self):
+ return "{}({})".format(type(self).__name__, self._resolution)
+
+ def transform_path_non_affine(self, path):
+ # docstring inherited
+ ipath = path.interpolated(self._resolution)
+ return Path(self.transform(ipath.vertices), ipath.codes)
+
+
+class AitoffAxes(GeoAxes):
+ name = 'aitoff'
+
+ class AitoffTransform(_GeoTransform):
+ """The base Aitoff transform."""
+
+ def transform_non_affine(self, ll):
+ # docstring inherited
+ longitude, latitude = ll.T
+
+ # Pre-compute some values
+ half_long = longitude / 2.0
+ cos_latitude = np.cos(latitude)
+
+ alpha = np.arccos(cos_latitude * np.cos(half_long))
+ sinc_alpha = np.sinc(alpha / np.pi) # np.sinc is sin(pi*x)/(pi*x).
+
+ x = (cos_latitude * np.sin(half_long)) / sinc_alpha
+ y = np.sin(latitude) / sinc_alpha
+ return np.column_stack([x, y])
+
+ def inverted(self):
+ # docstring inherited
+ return AitoffAxes.InvertedAitoffTransform(self._resolution)
+
+ class InvertedAitoffTransform(_GeoTransform):
+
+ def transform_non_affine(self, xy):
+ # docstring inherited
+ # MGDTODO: Math is hard ;(
+ return np.full_like(xy, np.nan)
+
+ def inverted(self):
+ # docstring inherited
+ return AitoffAxes.AitoffTransform(self._resolution)
+
+ def __init__(self, *args, **kwargs):
+ self._longitude_cap = np.pi / 2.0
+ super().__init__(*args, **kwargs)
+ self.set_aspect(0.5, adjustable='box', anchor='C')
+ self.cla()
+
+ def _get_core_transform(self, resolution):
+ return self.AitoffTransform(resolution)
+
+
+class HammerAxes(GeoAxes):
+ name = 'hammer'
+
+ class HammerTransform(_GeoTransform):
+ """The base Hammer transform."""
+
+ def transform_non_affine(self, ll):
+ # docstring inherited
+ longitude, latitude = ll.T
+ half_long = longitude / 2.0
+ cos_latitude = np.cos(latitude)
+ sqrt2 = np.sqrt(2.0)
+ alpha = np.sqrt(1.0 + cos_latitude * np.cos(half_long))
+ x = (2.0 * sqrt2) * (cos_latitude * np.sin(half_long)) / alpha
+ y = (sqrt2 * np.sin(latitude)) / alpha
+ return np.column_stack([x, y])
+
+ def inverted(self):
+ # docstring inherited
+ return HammerAxes.InvertedHammerTransform(self._resolution)
+
+ class InvertedHammerTransform(_GeoTransform):
+
+ def transform_non_affine(self, xy):
+ # docstring inherited
+ x, y = xy.T
+ z = np.sqrt(1 - (x / 4) ** 2 - (y / 2) ** 2)
+ longitude = 2 * np.arctan((z * x) / (2 * (2 * z ** 2 - 1)))
+ latitude = np.arcsin(y*z)
+ return np.column_stack([longitude, latitude])
+
+ def inverted(self):
+ # docstring inherited
+ return HammerAxes.HammerTransform(self._resolution)
+
+ def __init__(self, *args, **kwargs):
+ self._longitude_cap = np.pi / 2.0
+ super().__init__(*args, **kwargs)
+ self.set_aspect(0.5, adjustable='box', anchor='C')
+ self.cla()
+
+ def _get_core_transform(self, resolution):
+ return self.HammerTransform(resolution)
+
+
+class MollweideAxes(GeoAxes):
+ name = 'mollweide'
+
+ class MollweideTransform(_GeoTransform):
+ """The base Mollweide transform."""
+
+ def transform_non_affine(self, ll):
+ # docstring inherited
+ def d(theta):
+ delta = (-(theta + np.sin(theta) - pi_sin_l)
+ / (1 + np.cos(theta)))
+ return delta, np.abs(delta) > 0.001
+
+ longitude, latitude = ll.T
+
+ clat = np.pi/2 - np.abs(latitude)
+ ihigh = clat < 0.087 # within 5 degrees of the poles
+ ilow = ~ihigh
+ aux = np.empty(latitude.shape, dtype=float)
+
+ if ilow.any(): # Newton-Raphson iteration
+ pi_sin_l = np.pi * np.sin(latitude[ilow])
+ theta = 2.0 * latitude[ilow]
+ delta, large_delta = d(theta)
+ while np.any(large_delta):
+ theta[large_delta] += delta[large_delta]
+ delta, large_delta = d(theta)
+ aux[ilow] = theta / 2
+
+ if ihigh.any(): # Taylor series-based approx. solution
+ e = clat[ihigh]
+ d = 0.5 * (3 * np.pi * e**2) ** (1.0/3)
+ aux[ihigh] = (np.pi/2 - d) * np.sign(latitude[ihigh])
+
+ xy = np.empty(ll.shape, dtype=float)
+ xy[:, 0] = (2.0 * np.sqrt(2.0) / np.pi) * longitude * np.cos(aux)
+ xy[:, 1] = np.sqrt(2.0) * np.sin(aux)
+
+ return xy
+
+ def inverted(self):
+ # docstring inherited
+ return MollweideAxes.InvertedMollweideTransform(self._resolution)
+
+ class InvertedMollweideTransform(_GeoTransform):
+
+ def transform_non_affine(self, xy):
+ # docstring inherited
+ x, y = xy.T
+ # from Equations (7, 8) of
+ # https://mathworld.wolfram.com/MollweideProjection.html
+ theta = np.arcsin(y / np.sqrt(2))
+ longitude = (np.pi / (2 * np.sqrt(2))) * x / np.cos(theta)
+ latitude = np.arcsin((2 * theta + np.sin(2 * theta)) / np.pi)
+ return np.column_stack([longitude, latitude])
+
+ def inverted(self):
+ # docstring inherited
+ return MollweideAxes.MollweideTransform(self._resolution)
+
+ def __init__(self, *args, **kwargs):
+ self._longitude_cap = np.pi / 2.0
+ super().__init__(*args, **kwargs)
+ self.set_aspect(0.5, adjustable='box', anchor='C')
+ self.cla()
+
+ def _get_core_transform(self, resolution):
+ return self.MollweideTransform(resolution)
+
+
+class LambertAxes(GeoAxes):
+ name = 'lambert'
+
+ class LambertTransform(_GeoTransform):
+ """The base Lambert transform."""
+
+ def __init__(self, center_longitude, center_latitude, resolution):
+ """
+ Create a new Lambert transform. Resolution is the number of steps
+ to interpolate between each input line segment to approximate its
+ path in curved Lambert space.
+ """
+ _GeoTransform.__init__(self, resolution)
+ self._center_longitude = center_longitude
+ self._center_latitude = center_latitude
+
+ def transform_non_affine(self, ll):
+ # docstring inherited
+ longitude, latitude = ll.T
+ clong = self._center_longitude
+ clat = self._center_latitude
+ cos_lat = np.cos(latitude)
+ sin_lat = np.sin(latitude)
+ diff_long = longitude - clong
+ cos_diff_long = np.cos(diff_long)
+
+ inner_k = np.maximum( # Prevent divide-by-zero problems
+ 1 + np.sin(clat)*sin_lat + np.cos(clat)*cos_lat*cos_diff_long,
+ 1e-15)
+ k = np.sqrt(2 / inner_k)
+ x = k * cos_lat*np.sin(diff_long)
+ y = k * (np.cos(clat)*sin_lat - np.sin(clat)*cos_lat*cos_diff_long)
+
+ return np.column_stack([x, y])
+
+ def inverted(self):
+ # docstring inherited
+ return LambertAxes.InvertedLambertTransform(
+ self._center_longitude,
+ self._center_latitude,
+ self._resolution)
+
+ class InvertedLambertTransform(_GeoTransform):
+
+ def __init__(self, center_longitude, center_latitude, resolution):
+ _GeoTransform.__init__(self, resolution)
+ self._center_longitude = center_longitude
+ self._center_latitude = center_latitude
+
+ def transform_non_affine(self, xy):
+ # docstring inherited
+ x, y = xy.T
+ clong = self._center_longitude
+ clat = self._center_latitude
+ p = np.maximum(np.hypot(x, y), 1e-9)
+ c = 2 * np.arcsin(0.5 * p)
+ sin_c = np.sin(c)
+ cos_c = np.cos(c)
+
+ latitude = np.arcsin(cos_c*np.sin(clat) +
+ ((y*sin_c*np.cos(clat)) / p))
+ longitude = clong + np.arctan(
+ (x*sin_c) / (p*np.cos(clat)*cos_c - y*np.sin(clat)*sin_c))
+
+ return np.column_stack([longitude, latitude])
+
+ def inverted(self):
+ # docstring inherited
+ return LambertAxes.LambertTransform(
+ self._center_longitude,
+ self._center_latitude,
+ self._resolution)
+
+ def __init__(self, *args, center_longitude=0, center_latitude=0, **kwargs):
+ self._longitude_cap = np.pi / 2
+ self._center_longitude = center_longitude
+ self._center_latitude = center_latitude
+ super().__init__(*args, **kwargs)
+ self.set_aspect('equal', adjustable='box', anchor='C')
+ self.cla()
+
+ def cla(self):
+ super().cla()
+ self.yaxis.set_major_formatter(NullFormatter())
+
+ def _get_core_transform(self, resolution):
+ return self.LambertTransform(
+ self._center_longitude,
+ self._center_latitude,
+ resolution)
+
+ def _get_affine_transform(self):
+ return Affine2D() \
+ .scale(0.25) \
+ .translate(0.5, 0.5)
diff --git a/venv/Lib/site-packages/matplotlib/projections/polar.py b/venv/Lib/site-packages/matplotlib/projections/polar.py
new file mode 100644
index 0000000..867e123
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/projections/polar.py
@@ -0,0 +1,1497 @@
+from collections import OrderedDict
+import types
+
+import numpy as np
+
+from matplotlib import _api, cbook, rcParams
+from matplotlib.axes import Axes
+import matplotlib.axis as maxis
+import matplotlib.markers as mmarkers
+import matplotlib.patches as mpatches
+from matplotlib.path import Path
+import matplotlib.ticker as mticker
+import matplotlib.transforms as mtransforms
+import matplotlib.spines as mspines
+
+
+class PolarTransform(mtransforms.Transform):
+ """
+ The base polar transform. This handles projection *theta* and
+ *r* into Cartesian coordinate space *x* and *y*, but does not
+ perform the ultimate affine transformation into the correct
+ position.
+ """
+ input_dims = output_dims = 2
+
+ def __init__(self, axis=None, use_rmin=True,
+ _apply_theta_transforms=True):
+ super().__init__()
+ self._axis = axis
+ self._use_rmin = use_rmin
+ self._apply_theta_transforms = _apply_theta_transforms
+
+ __str__ = mtransforms._make_str_method(
+ "_axis",
+ use_rmin="_use_rmin",
+ _apply_theta_transforms="_apply_theta_transforms")
+
+ def transform_non_affine(self, tr):
+ # docstring inherited
+ t, r = np.transpose(tr)
+ # PolarAxes does not use the theta transforms here, but apply them for
+ # backwards-compatibility if not being used by it.
+ if self._apply_theta_transforms and self._axis is not None:
+ t *= self._axis.get_theta_direction()
+ t += self._axis.get_theta_offset()
+ if self._use_rmin and self._axis is not None:
+ r = (r - self._axis.get_rorigin()) * self._axis.get_rsign()
+ r = np.where(r >= 0, r, np.nan)
+ return np.column_stack([r * np.cos(t), r * np.sin(t)])
+
+ def transform_path_non_affine(self, path):
+ # docstring inherited
+ if not len(path) or path._interpolation_steps == 1:
+ return Path(self.transform_non_affine(path.vertices), path.codes)
+ xys = []
+ codes = []
+ last_t = last_r = None
+ for trs, c in path.iter_segments():
+ trs = trs.reshape((-1, 2))
+ if c == Path.LINETO:
+ (t, r), = trs
+ if t == last_t: # Same angle: draw a straight line.
+ xys.extend(self.transform_non_affine(trs))
+ codes.append(Path.LINETO)
+ elif r == last_r: # Same radius: draw an arc.
+ # The following is complicated by Path.arc() being
+ # "helpful" and unwrapping the angles, but we don't want
+ # that behavior here.
+ last_td, td = np.rad2deg([last_t, t])
+ if self._use_rmin and self._axis is not None:
+ r = ((r - self._axis.get_rorigin())
+ * self._axis.get_rsign())
+ if last_td <= td:
+ while td - last_td > 360:
+ arc = Path.arc(last_td, last_td + 360)
+ xys.extend(arc.vertices[1:] * r)
+ codes.extend(arc.codes[1:])
+ last_td += 360
+ arc = Path.arc(last_td, td)
+ xys.extend(arc.vertices[1:] * r)
+ codes.extend(arc.codes[1:])
+ else:
+ # The reverse version also relies on the fact that all
+ # codes but the first one are the same.
+ while last_td - td > 360:
+ arc = Path.arc(last_td - 360, last_td)
+ xys.extend(arc.vertices[::-1][1:] * r)
+ codes.extend(arc.codes[1:])
+ last_td -= 360
+ arc = Path.arc(td, last_td)
+ xys.extend(arc.vertices[::-1][1:] * r)
+ codes.extend(arc.codes[1:])
+ else: # Interpolate.
+ trs = cbook.simple_linear_interpolation(
+ np.row_stack([(last_t, last_r), trs]),
+ path._interpolation_steps)[1:]
+ xys.extend(self.transform_non_affine(trs))
+ codes.extend([Path.LINETO] * len(trs))
+ else: # Not a straight line.
+ xys.extend(self.transform_non_affine(trs))
+ codes.extend([c] * len(trs))
+ last_t, last_r = trs[-1]
+ return Path(xys, codes)
+
+ def inverted(self):
+ # docstring inherited
+ return PolarAxes.InvertedPolarTransform(self._axis, self._use_rmin,
+ self._apply_theta_transforms)
+
+
+class PolarAffine(mtransforms.Affine2DBase):
+ """
+ The affine part of the polar projection. Scales the output so
+ that maximum radius rests on the edge of the axes circle.
+ """
+ def __init__(self, scale_transform, limits):
+ """
+ *limits* is the view limit of the data. The only part of
+ its bounds that is used is the y limits (for the radius limits).
+ The theta range is handled by the non-affine transform.
+ """
+ super().__init__()
+ self._scale_transform = scale_transform
+ self._limits = limits
+ self.set_children(scale_transform, limits)
+ self._mtx = None
+
+ __str__ = mtransforms._make_str_method("_scale_transform", "_limits")
+
+ def get_matrix(self):
+ # docstring inherited
+ if self._invalid:
+ limits_scaled = self._limits.transformed(self._scale_transform)
+ yscale = limits_scaled.ymax - limits_scaled.ymin
+ affine = mtransforms.Affine2D() \
+ .scale(0.5 / yscale) \
+ .translate(0.5, 0.5)
+ self._mtx = affine.get_matrix()
+ self._inverted = None
+ self._invalid = 0
+ return self._mtx
+
+
+class InvertedPolarTransform(mtransforms.Transform):
+ """
+ The inverse of the polar transform, mapping Cartesian
+ coordinate space *x* and *y* back to *theta* and *r*.
+ """
+ input_dims = output_dims = 2
+
+ def __init__(self, axis=None, use_rmin=True,
+ _apply_theta_transforms=True):
+ super().__init__()
+ self._axis = axis
+ self._use_rmin = use_rmin
+ self._apply_theta_transforms = _apply_theta_transforms
+
+ __str__ = mtransforms._make_str_method(
+ "_axis",
+ use_rmin="_use_rmin",
+ _apply_theta_transforms="_apply_theta_transforms")
+
+ def transform_non_affine(self, xy):
+ # docstring inherited
+ x, y = xy.T
+ r = np.hypot(x, y)
+ theta = (np.arctan2(y, x) + 2 * np.pi) % (2 * np.pi)
+ # PolarAxes does not use the theta transforms here, but apply them for
+ # backwards-compatibility if not being used by it.
+ if self._apply_theta_transforms and self._axis is not None:
+ theta -= self._axis.get_theta_offset()
+ theta *= self._axis.get_theta_direction()
+ theta %= 2 * np.pi
+ if self._use_rmin and self._axis is not None:
+ r += self._axis.get_rorigin()
+ r *= self._axis.get_rsign()
+ return np.column_stack([theta, r])
+
+ def inverted(self):
+ # docstring inherited
+ return PolarAxes.PolarTransform(self._axis, self._use_rmin,
+ self._apply_theta_transforms)
+
+
+class ThetaFormatter(mticker.Formatter):
+ """
+ Used to format the *theta* tick labels. Converts the native
+ unit of radians into degrees and adds a degree symbol.
+ """
+ def __call__(self, x, pos=None):
+ vmin, vmax = self.axis.get_view_interval()
+ d = np.rad2deg(abs(vmax - vmin))
+ digits = max(-int(np.log10(d) - 1.5), 0)
+ # Use unicode rather than mathtext with \circ, so that it will work
+ # correctly with any arbitrary font (assuming it has a degree sign),
+ # whereas $5\circ$ will only work correctly with one of the supported
+ # math fonts (Computer Modern and STIX).
+ return ("{value:0.{digits:d}f}\N{DEGREE SIGN}"
+ .format(value=np.rad2deg(x), digits=digits))
+
+
+class _AxisWrapper:
+ def __init__(self, axis):
+ self._axis = axis
+
+ def get_view_interval(self):
+ return np.rad2deg(self._axis.get_view_interval())
+
+ def set_view_interval(self, vmin, vmax):
+ self._axis.set_view_interval(*np.deg2rad((vmin, vmax)))
+
+ def get_minpos(self):
+ return np.rad2deg(self._axis.get_minpos())
+
+ def get_data_interval(self):
+ return np.rad2deg(self._axis.get_data_interval())
+
+ def set_data_interval(self, vmin, vmax):
+ self._axis.set_data_interval(*np.deg2rad((vmin, vmax)))
+
+ def get_tick_space(self):
+ return self._axis.get_tick_space()
+
+
+class ThetaLocator(mticker.Locator):
+ """
+ Used to locate theta ticks.
+
+ This will work the same as the base locator except in the case that the
+ view spans the entire circle. In such cases, the previously used default
+ locations of every 45 degrees are returned.
+ """
+
+ def __init__(self, base):
+ self.base = base
+ self.axis = self.base.axis = _AxisWrapper(self.base.axis)
+
+ def set_axis(self, axis):
+ self.axis = _AxisWrapper(axis)
+ self.base.set_axis(self.axis)
+
+ def __call__(self):
+ lim = self.axis.get_view_interval()
+ if _is_full_circle_deg(lim[0], lim[1]):
+ return np.arange(8) * 2 * np.pi / 8
+ else:
+ return np.deg2rad(self.base())
+
+ @_api.deprecated("3.3")
+ def pan(self, numsteps):
+ return self.base.pan(numsteps)
+
+ def refresh(self):
+ # docstring inherited
+ return self.base.refresh()
+
+ def view_limits(self, vmin, vmax):
+ vmin, vmax = np.rad2deg((vmin, vmax))
+ return np.deg2rad(self.base.view_limits(vmin, vmax))
+
+ @_api.deprecated("3.3")
+ def zoom(self, direction):
+ return self.base.zoom(direction)
+
+
+class ThetaTick(maxis.XTick):
+ """
+ A theta-axis tick.
+
+ This subclass of `.XTick` provides angular ticks with some small
+ modification to their re-positioning such that ticks are rotated based on
+ tick location. This results in ticks that are correctly perpendicular to
+ the arc spine.
+
+ When 'auto' rotation is enabled, labels are also rotated to be parallel to
+ the spine. The label padding is also applied here since it's not possible
+ to use a generic axes transform to produce tick-specific padding.
+ """
+
+ def __init__(self, axes, *args, **kwargs):
+ self._text1_translate = mtransforms.ScaledTranslation(
+ 0, 0, axes.figure.dpi_scale_trans)
+ self._text2_translate = mtransforms.ScaledTranslation(
+ 0, 0, axes.figure.dpi_scale_trans)
+ super().__init__(axes, *args, **kwargs)
+ self.label1.set(
+ rotation_mode='anchor',
+ transform=self.label1.get_transform() + self._text1_translate)
+ self.label2.set(
+ rotation_mode='anchor',
+ transform=self.label2.get_transform() + self._text2_translate)
+
+ def _apply_params(self, **kw):
+ super()._apply_params(**kw)
+
+ # Ensure transform is correct; sometimes this gets reset.
+ trans = self.label1.get_transform()
+ if not trans.contains_branch(self._text1_translate):
+ self.label1.set_transform(trans + self._text1_translate)
+ trans = self.label2.get_transform()
+ if not trans.contains_branch(self._text2_translate):
+ self.label2.set_transform(trans + self._text2_translate)
+
+ def _update_padding(self, pad, angle):
+ padx = pad * np.cos(angle) / 72
+ pady = pad * np.sin(angle) / 72
+ self._text1_translate._t = (padx, pady)
+ self._text1_translate.invalidate()
+ self._text2_translate._t = (-padx, -pady)
+ self._text2_translate.invalidate()
+
+ def update_position(self, loc):
+ super().update_position(loc)
+ axes = self.axes
+ angle = loc * axes.get_theta_direction() + axes.get_theta_offset()
+ text_angle = np.rad2deg(angle) % 360 - 90
+ angle -= np.pi / 2
+
+ marker = self.tick1line.get_marker()
+ if marker in (mmarkers.TICKUP, '|'):
+ trans = mtransforms.Affine2D().scale(1, 1).rotate(angle)
+ elif marker == mmarkers.TICKDOWN:
+ trans = mtransforms.Affine2D().scale(1, -1).rotate(angle)
+ else:
+ # Don't modify custom tick line markers.
+ trans = self.tick1line._marker._transform
+ self.tick1line._marker._transform = trans
+
+ marker = self.tick2line.get_marker()
+ if marker in (mmarkers.TICKUP, '|'):
+ trans = mtransforms.Affine2D().scale(1, 1).rotate(angle)
+ elif marker == mmarkers.TICKDOWN:
+ trans = mtransforms.Affine2D().scale(1, -1).rotate(angle)
+ else:
+ # Don't modify custom tick line markers.
+ trans = self.tick2line._marker._transform
+ self.tick2line._marker._transform = trans
+
+ mode, user_angle = self._labelrotation
+ if mode == 'default':
+ text_angle = user_angle
+ else:
+ if text_angle > 90:
+ text_angle -= 180
+ elif text_angle < -90:
+ text_angle += 180
+ text_angle += user_angle
+ self.label1.set_rotation(text_angle)
+ self.label2.set_rotation(text_angle)
+
+ # This extra padding helps preserve the look from previous releases but
+ # is also needed because labels are anchored to their center.
+ pad = self._pad + 7
+ self._update_padding(pad,
+ self._loc * axes.get_theta_direction() +
+ axes.get_theta_offset())
+
+
+class ThetaAxis(maxis.XAxis):
+ """
+ A theta Axis.
+
+ This overrides certain properties of an `.XAxis` to provide special-casing
+ for an angular axis.
+ """
+ __name__ = 'thetaaxis'
+ axis_name = 'theta' #: Read-only name identifying the axis.
+
+ def _get_tick(self, major):
+ if major:
+ tick_kw = self._major_tick_kw
+ else:
+ tick_kw = self._minor_tick_kw
+ return ThetaTick(self.axes, 0, major=major, **tick_kw)
+
+ def _wrap_locator_formatter(self):
+ self.set_major_locator(ThetaLocator(self.get_major_locator()))
+ self.set_major_formatter(ThetaFormatter())
+ self.isDefault_majloc = True
+ self.isDefault_majfmt = True
+
+ def clear(self):
+ super().clear()
+ self.set_ticks_position('none')
+ self._wrap_locator_formatter()
+
+ @_api.deprecated("3.4", alternative="ThetaAxis.clear()")
+ def cla(self):
+ self.clear()
+
+ def _set_scale(self, value, **kwargs):
+ super()._set_scale(value, **kwargs)
+ self._wrap_locator_formatter()
+
+ def _copy_tick_props(self, src, dest):
+ """Copy the props from src tick to dest tick."""
+ if src is None or dest is None:
+ return
+ super()._copy_tick_props(src, dest)
+
+ # Ensure that tick transforms are independent so that padding works.
+ trans = dest._get_text1_transform()[0]
+ dest.label1.set_transform(trans + dest._text1_translate)
+ trans = dest._get_text2_transform()[0]
+ dest.label2.set_transform(trans + dest._text2_translate)
+
+
+class RadialLocator(mticker.Locator):
+ """
+ Used to locate radius ticks.
+
+ Ensures that all ticks are strictly positive. For all other tasks, it
+ delegates to the base `.Locator` (which may be different depending on the
+ scale of the *r*-axis).
+ """
+
+ def __init__(self, base, axes=None):
+ self.base = base
+ self._axes = axes
+
+ def __call__(self):
+ show_all = True
+ # Ensure previous behaviour with full circle non-annular views.
+ if self._axes:
+ if _is_full_circle_rad(*self._axes.viewLim.intervalx):
+ rorigin = self._axes.get_rorigin() * self._axes.get_rsign()
+ if self._axes.get_rmin() <= rorigin:
+ show_all = False
+ if show_all:
+ return self.base()
+ else:
+ return [tick for tick in self.base() if tick > rorigin]
+
+ @_api.deprecated("3.3")
+ def pan(self, numsteps):
+ return self.base.pan(numsteps)
+
+ @_api.deprecated("3.3")
+ def zoom(self, direction):
+ return self.base.zoom(direction)
+
+ @_api.deprecated("3.3")
+ def refresh(self):
+ # docstring inherited
+ return self.base.refresh()
+
+ def nonsingular(self, vmin, vmax):
+ # docstring inherited
+ return ((0, 1) if (vmin, vmax) == (-np.inf, np.inf) # Init. limits.
+ else self.base.nonsingular(vmin, vmax))
+
+ def view_limits(self, vmin, vmax):
+ vmin, vmax = self.base.view_limits(vmin, vmax)
+ if vmax > vmin:
+ # this allows inverted r/y-lims
+ vmin = min(0, vmin)
+ return mtransforms.nonsingular(vmin, vmax)
+
+
+class _ThetaShift(mtransforms.ScaledTranslation):
+ """
+ Apply a padding shift based on axes theta limits.
+
+ This is used to create padding for radial ticks.
+
+ Parameters
+ ----------
+ axes : `~matplotlib.axes.Axes`
+ The owning axes; used to determine limits.
+ pad : float
+ The padding to apply, in points.
+ mode : {'min', 'max', 'rlabel'}
+ Whether to shift away from the start (``'min'``) or the end (``'max'``)
+ of the axes, or using the rlabel position (``'rlabel'``).
+ """
+ def __init__(self, axes, pad, mode):
+ super().__init__(pad, pad, axes.figure.dpi_scale_trans)
+ self.set_children(axes._realViewLim)
+ self.axes = axes
+ self.mode = mode
+ self.pad = pad
+
+ __str__ = mtransforms._make_str_method("axes", "pad", "mode")
+
+ def get_matrix(self):
+ if self._invalid:
+ if self.mode == 'rlabel':
+ angle = (
+ np.deg2rad(self.axes.get_rlabel_position()) *
+ self.axes.get_theta_direction() +
+ self.axes.get_theta_offset()
+ )
+ else:
+ if self.mode == 'min':
+ angle = self.axes._realViewLim.xmin
+ elif self.mode == 'max':
+ angle = self.axes._realViewLim.xmax
+
+ if self.mode in ('rlabel', 'min'):
+ padx = np.cos(angle - np.pi / 2)
+ pady = np.sin(angle - np.pi / 2)
+ else:
+ padx = np.cos(angle + np.pi / 2)
+ pady = np.sin(angle + np.pi / 2)
+
+ self._t = (self.pad * padx / 72, self.pad * pady / 72)
+ return super().get_matrix()
+
+
+class RadialTick(maxis.YTick):
+ """
+ A radial-axis tick.
+
+ This subclass of `.YTick` provides radial ticks with some small
+ modification to their re-positioning such that ticks are rotated based on
+ axes limits. This results in ticks that are correctly perpendicular to
+ the spine. Labels are also rotated to be perpendicular to the spine, when
+ 'auto' rotation is enabled.
+ """
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.label1.set_rotation_mode('anchor')
+ self.label2.set_rotation_mode('anchor')
+
+ def _determine_anchor(self, mode, angle, start):
+ # Note: angle is the (spine angle - 90) because it's used for the tick
+ # & text setup, so all numbers below are -90 from (normed) spine angle.
+ if mode == 'auto':
+ if start:
+ if -90 <= angle <= 90:
+ return 'left', 'center'
+ else:
+ return 'right', 'center'
+ else:
+ if -90 <= angle <= 90:
+ return 'right', 'center'
+ else:
+ return 'left', 'center'
+ else:
+ if start:
+ if angle < -68.5:
+ return 'center', 'top'
+ elif angle < -23.5:
+ return 'left', 'top'
+ elif angle < 22.5:
+ return 'left', 'center'
+ elif angle < 67.5:
+ return 'left', 'bottom'
+ elif angle < 112.5:
+ return 'center', 'bottom'
+ elif angle < 157.5:
+ return 'right', 'bottom'
+ elif angle < 202.5:
+ return 'right', 'center'
+ elif angle < 247.5:
+ return 'right', 'top'
+ else:
+ return 'center', 'top'
+ else:
+ if angle < -68.5:
+ return 'center', 'bottom'
+ elif angle < -23.5:
+ return 'right', 'bottom'
+ elif angle < 22.5:
+ return 'right', 'center'
+ elif angle < 67.5:
+ return 'right', 'top'
+ elif angle < 112.5:
+ return 'center', 'top'
+ elif angle < 157.5:
+ return 'left', 'top'
+ elif angle < 202.5:
+ return 'left', 'center'
+ elif angle < 247.5:
+ return 'left', 'bottom'
+ else:
+ return 'center', 'bottom'
+
+ def update_position(self, loc):
+ super().update_position(loc)
+ axes = self.axes
+ thetamin = axes.get_thetamin()
+ thetamax = axes.get_thetamax()
+ direction = axes.get_theta_direction()
+ offset_rad = axes.get_theta_offset()
+ offset = np.rad2deg(offset_rad)
+ full = _is_full_circle_deg(thetamin, thetamax)
+
+ if full:
+ angle = (axes.get_rlabel_position() * direction +
+ offset) % 360 - 90
+ tick_angle = 0
+ else:
+ angle = (thetamin * direction + offset) % 360 - 90
+ if direction > 0:
+ tick_angle = np.deg2rad(angle)
+ else:
+ tick_angle = np.deg2rad(angle + 180)
+ text_angle = (angle + 90) % 180 - 90 # between -90 and +90.
+ mode, user_angle = self._labelrotation
+ if mode == 'auto':
+ text_angle += user_angle
+ else:
+ text_angle = user_angle
+
+ if full:
+ ha = self.label1.get_horizontalalignment()
+ va = self.label1.get_verticalalignment()
+ else:
+ ha, va = self._determine_anchor(mode, angle, direction > 0)
+ self.label1.set_horizontalalignment(ha)
+ self.label1.set_verticalalignment(va)
+ self.label1.set_rotation(text_angle)
+
+ marker = self.tick1line.get_marker()
+ if marker == mmarkers.TICKLEFT:
+ trans = mtransforms.Affine2D().rotate(tick_angle)
+ elif marker == '_':
+ trans = mtransforms.Affine2D().rotate(tick_angle + np.pi / 2)
+ elif marker == mmarkers.TICKRIGHT:
+ trans = mtransforms.Affine2D().scale(-1, 1).rotate(tick_angle)
+ else:
+ # Don't modify custom tick line markers.
+ trans = self.tick1line._marker._transform
+ self.tick1line._marker._transform = trans
+
+ if full:
+ self.label2.set_visible(False)
+ self.tick2line.set_visible(False)
+ angle = (thetamax * direction + offset) % 360 - 90
+ if direction > 0:
+ tick_angle = np.deg2rad(angle)
+ else:
+ tick_angle = np.deg2rad(angle + 180)
+ text_angle = (angle + 90) % 180 - 90 # between -90 and +90.
+ mode, user_angle = self._labelrotation
+ if mode == 'auto':
+ text_angle += user_angle
+ else:
+ text_angle = user_angle
+
+ ha, va = self._determine_anchor(mode, angle, direction < 0)
+ self.label2.set_ha(ha)
+ self.label2.set_va(va)
+ self.label2.set_rotation(text_angle)
+
+ marker = self.tick2line.get_marker()
+ if marker == mmarkers.TICKLEFT:
+ trans = mtransforms.Affine2D().rotate(tick_angle)
+ elif marker == '_':
+ trans = mtransforms.Affine2D().rotate(tick_angle + np.pi / 2)
+ elif marker == mmarkers.TICKRIGHT:
+ trans = mtransforms.Affine2D().scale(-1, 1).rotate(tick_angle)
+ else:
+ # Don't modify custom tick line markers.
+ trans = self.tick2line._marker._transform
+ self.tick2line._marker._transform = trans
+
+
+class RadialAxis(maxis.YAxis):
+ """
+ A radial Axis.
+
+ This overrides certain properties of a `.YAxis` to provide special-casing
+ for a radial axis.
+ """
+ __name__ = 'radialaxis'
+ axis_name = 'radius' #: Read-only name identifying the axis.
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.sticky_edges.y.append(0)
+
+ def _get_tick(self, major):
+ if major:
+ tick_kw = self._major_tick_kw
+ else:
+ tick_kw = self._minor_tick_kw
+ return RadialTick(self.axes, 0, major=major, **tick_kw)
+
+ def _wrap_locator_formatter(self):
+ self.set_major_locator(RadialLocator(self.get_major_locator(),
+ self.axes))
+ self.isDefault_majloc = True
+
+ def clear(self):
+ super().clear()
+ self.set_ticks_position('none')
+ self._wrap_locator_formatter()
+
+ @_api.deprecated("3.4", alternative="RadialAxis.clear()")
+ def cla(self):
+ self.clear()
+
+ def _set_scale(self, value, **kwargs):
+ super()._set_scale(value, **kwargs)
+ self._wrap_locator_formatter()
+
+
+def _is_full_circle_deg(thetamin, thetamax):
+ """
+ Determine if a wedge (in degrees) spans the full circle.
+
+ The condition is derived from :class:`~matplotlib.patches.Wedge`.
+ """
+ return abs(abs(thetamax - thetamin) - 360.0) < 1e-12
+
+
+def _is_full_circle_rad(thetamin, thetamax):
+ """
+ Determine if a wedge (in radians) spans the full circle.
+
+ The condition is derived from :class:`~matplotlib.patches.Wedge`.
+ """
+ return abs(abs(thetamax - thetamin) - 2 * np.pi) < 1.74e-14
+
+
+class _WedgeBbox(mtransforms.Bbox):
+ """
+ Transform (theta, r) wedge Bbox into axes bounding box.
+
+ Parameters
+ ----------
+ center : (float, float)
+ Center of the wedge
+ viewLim : `~matplotlib.transforms.Bbox`
+ Bbox determining the boundaries of the wedge
+ originLim : `~matplotlib.transforms.Bbox`
+ Bbox determining the origin for the wedge, if different from *viewLim*
+ """
+ def __init__(self, center, viewLim, originLim, **kwargs):
+ super().__init__([[0, 0], [1, 1]], **kwargs)
+ self._center = center
+ self._viewLim = viewLim
+ self._originLim = originLim
+ self.set_children(viewLim, originLim)
+
+ __str__ = mtransforms._make_str_method("_center", "_viewLim", "_originLim")
+
+ def get_points(self):
+ # docstring inherited
+ if self._invalid:
+ points = self._viewLim.get_points().copy()
+ # Scale angular limits to work with Wedge.
+ points[:, 0] *= 180 / np.pi
+ if points[0, 0] > points[1, 0]:
+ points[:, 0] = points[::-1, 0]
+
+ # Scale radial limits based on origin radius.
+ points[:, 1] -= self._originLim.y0
+
+ # Scale radial limits to match axes limits.
+ rscale = 0.5 / points[1, 1]
+ points[:, 1] *= rscale
+ width = min(points[1, 1] - points[0, 1], 0.5)
+
+ # Generate bounding box for wedge.
+ wedge = mpatches.Wedge(self._center, points[1, 1],
+ points[0, 0], points[1, 0],
+ width=width)
+ self.update_from_path(wedge.get_path())
+
+ # Ensure equal aspect ratio.
+ w, h = self._points[1] - self._points[0]
+ deltah = max(w - h, 0) / 2
+ deltaw = max(h - w, 0) / 2
+ self._points += np.array([[-deltaw, -deltah], [deltaw, deltah]])
+
+ self._invalid = 0
+
+ return self._points
+
+
+class PolarAxes(Axes):
+ """
+ A polar graph projection, where the input dimensions are *theta*, *r*.
+
+ Theta starts pointing east and goes anti-clockwise.
+ """
+ name = 'polar'
+
+ def __init__(self, *args,
+ theta_offset=0, theta_direction=1, rlabel_position=22.5,
+ **kwargs):
+ # docstring inherited
+ self._default_theta_offset = theta_offset
+ self._default_theta_direction = theta_direction
+ self._default_rlabel_position = np.deg2rad(rlabel_position)
+ super().__init__(*args, **kwargs)
+ self.use_sticky_edges = True
+ self.set_aspect('equal', adjustable='box', anchor='C')
+ self.cla()
+
+ def cla(self):
+ super().cla()
+
+ self.title.set_y(1.05)
+
+ start = self.spines.get('start', None)
+ if start:
+ start.set_visible(False)
+ end = self.spines.get('end', None)
+ if end:
+ end.set_visible(False)
+ self.set_xlim(0.0, 2 * np.pi)
+
+ self.grid(rcParams['polaraxes.grid'])
+ inner = self.spines.get('inner', None)
+ if inner:
+ inner.set_visible(False)
+
+ self.set_rorigin(None)
+ self.set_theta_offset(self._default_theta_offset)
+ self.set_theta_direction(self._default_theta_direction)
+
+ def _init_axis(self):
+ # This is moved out of __init__ because non-separable axes don't use it
+ self.xaxis = ThetaAxis(self)
+ self.yaxis = RadialAxis(self)
+ # Calling polar_axes.xaxis.clear() or polar_axes.xaxis.clear()
+ # results in weird artifacts. Therefore we disable this for
+ # now.
+ # self.spines['polar'].register_axis(self.yaxis)
+ self._update_transScale()
+
+ def _set_lim_and_transforms(self):
+ # A view limit where the minimum radius can be locked if the user
+ # specifies an alternate origin.
+ self._originViewLim = mtransforms.LockableBbox(self.viewLim)
+
+ # Handle angular offset and direction.
+ self._direction = mtransforms.Affine2D() \
+ .scale(self._default_theta_direction, 1.0)
+ self._theta_offset = mtransforms.Affine2D() \
+ .translate(self._default_theta_offset, 0.0)
+ self.transShift = self._direction + self._theta_offset
+ # A view limit shifted to the correct location after accounting for
+ # orientation and offset.
+ self._realViewLim = mtransforms.TransformedBbox(self.viewLim,
+ self.transShift)
+
+ # Transforms the x and y axis separately by a scale factor
+ # It is assumed that this part will have non-linear components
+ self.transScale = mtransforms.TransformWrapper(
+ mtransforms.IdentityTransform())
+
+ # Scale view limit into a bbox around the selected wedge. This may be
+ # smaller than the usual unit axes rectangle if not plotting the full
+ # circle.
+ self.axesLim = _WedgeBbox((0.5, 0.5),
+ self._realViewLim, self._originViewLim)
+
+ # Scale the wedge to fill the axes.
+ self.transWedge = mtransforms.BboxTransformFrom(self.axesLim)
+
+ # Scale the axes to fill the figure.
+ self.transAxes = mtransforms.BboxTransformTo(self.bbox)
+
+ # A (possibly non-linear) projection on the (already scaled)
+ # data. This one is aware of rmin
+ self.transProjection = self.PolarTransform(
+ self,
+ _apply_theta_transforms=False)
+ # Add dependency on rorigin.
+ self.transProjection.set_children(self._originViewLim)
+
+ # An affine transformation on the data, generally to limit the
+ # range of the axes
+ self.transProjectionAffine = self.PolarAffine(self.transScale,
+ self._originViewLim)
+
+ # The complete data transformation stack -- from data all the
+ # way to display coordinates
+ self.transData = (
+ self.transScale + self.transShift + self.transProjection +
+ (self.transProjectionAffine + self.transWedge + self.transAxes))
+
+ # This is the transform for theta-axis ticks. It is
+ # equivalent to transData, except it always puts r == 0.0 and r == 1.0
+ # at the edge of the axis circles.
+ self._xaxis_transform = (
+ mtransforms.blended_transform_factory(
+ mtransforms.IdentityTransform(),
+ mtransforms.BboxTransformTo(self.viewLim)) +
+ self.transData)
+ # The theta labels are flipped along the radius, so that text 1 is on
+ # the outside by default. This should work the same as before.
+ flipr_transform = mtransforms.Affine2D() \
+ .translate(0.0, -0.5) \
+ .scale(1.0, -1.0) \
+ .translate(0.0, 0.5)
+ self._xaxis_text_transform = flipr_transform + self._xaxis_transform
+
+ # This is the transform for r-axis ticks. It scales the theta
+ # axis so the gridlines from 0.0 to 1.0, now go from thetamin to
+ # thetamax.
+ self._yaxis_transform = (
+ mtransforms.blended_transform_factory(
+ mtransforms.BboxTransformTo(self.viewLim),
+ mtransforms.IdentityTransform()) +
+ self.transData)
+ # The r-axis labels are put at an angle and padded in the r-direction
+ self._r_label_position = mtransforms.Affine2D() \
+ .translate(self._default_rlabel_position, 0.0)
+ self._yaxis_text_transform = mtransforms.TransformWrapper(
+ self._r_label_position + self.transData)
+
+ def get_xaxis_transform(self, which='grid'):
+ _api.check_in_list(['tick1', 'tick2', 'grid'], which=which)
+ return self._xaxis_transform
+
+ def get_xaxis_text1_transform(self, pad):
+ return self._xaxis_text_transform, 'center', 'center'
+
+ def get_xaxis_text2_transform(self, pad):
+ return self._xaxis_text_transform, 'center', 'center'
+
+ def get_yaxis_transform(self, which='grid'):
+ if which in ('tick1', 'tick2'):
+ return self._yaxis_text_transform
+ elif which == 'grid':
+ return self._yaxis_transform
+ else:
+ _api.check_in_list(['tick1', 'tick2', 'grid'], which=which)
+
+ def get_yaxis_text1_transform(self, pad):
+ thetamin, thetamax = self._realViewLim.intervalx
+ if _is_full_circle_rad(thetamin, thetamax):
+ return self._yaxis_text_transform, 'bottom', 'left'
+ elif self.get_theta_direction() > 0:
+ halign = 'left'
+ pad_shift = _ThetaShift(self, pad, 'min')
+ else:
+ halign = 'right'
+ pad_shift = _ThetaShift(self, pad, 'max')
+ return self._yaxis_text_transform + pad_shift, 'center', halign
+
+ def get_yaxis_text2_transform(self, pad):
+ if self.get_theta_direction() > 0:
+ halign = 'right'
+ pad_shift = _ThetaShift(self, pad, 'max')
+ else:
+ halign = 'left'
+ pad_shift = _ThetaShift(self, pad, 'min')
+ return self._yaxis_text_transform + pad_shift, 'center', halign
+
+ @_api.delete_parameter("3.3", "args")
+ @_api.delete_parameter("3.3", "kwargs")
+ def draw(self, renderer, *args, **kwargs):
+ self._unstale_viewLim()
+ thetamin, thetamax = np.rad2deg(self._realViewLim.intervalx)
+ if thetamin > thetamax:
+ thetamin, thetamax = thetamax, thetamin
+ rmin, rmax = ((self._realViewLim.intervaly - self.get_rorigin()) *
+ self.get_rsign())
+ if isinstance(self.patch, mpatches.Wedge):
+ # Backwards-compatibility: Any subclassed Axes might override the
+ # patch to not be the Wedge that PolarAxes uses.
+ center = self.transWedge.transform((0.5, 0.5))
+ self.patch.set_center(center)
+ self.patch.set_theta1(thetamin)
+ self.patch.set_theta2(thetamax)
+
+ edge, _ = self.transWedge.transform((1, 0))
+ radius = edge - center[0]
+ width = min(radius * (rmax - rmin) / rmax, radius)
+ self.patch.set_radius(radius)
+ self.patch.set_width(width)
+
+ inner_width = radius - width
+ inner = self.spines.get('inner', None)
+ if inner:
+ inner.set_visible(inner_width != 0.0)
+
+ visible = not _is_full_circle_deg(thetamin, thetamax)
+ # For backwards compatibility, any subclassed Axes might override the
+ # spines to not include start/end that PolarAxes uses.
+ start = self.spines.get('start', None)
+ end = self.spines.get('end', None)
+ if start:
+ start.set_visible(visible)
+ if end:
+ end.set_visible(visible)
+ if visible:
+ yaxis_text_transform = self._yaxis_transform
+ else:
+ yaxis_text_transform = self._r_label_position + self.transData
+ if self._yaxis_text_transform != yaxis_text_transform:
+ self._yaxis_text_transform.set(yaxis_text_transform)
+ self.yaxis.reset_ticks()
+ self.yaxis.set_clip_path(self.patch)
+
+ super().draw(renderer, *args, **kwargs)
+
+ def _gen_axes_patch(self):
+ return mpatches.Wedge((0.5, 0.5), 0.5, 0.0, 360.0)
+
+ def _gen_axes_spines(self):
+ spines = OrderedDict([
+ ('polar', mspines.Spine.arc_spine(self, 'top',
+ (0.5, 0.5), 0.5, 0.0, 360.0)),
+ ('start', mspines.Spine.linear_spine(self, 'left')),
+ ('end', mspines.Spine.linear_spine(self, 'right')),
+ ('inner', mspines.Spine.arc_spine(self, 'bottom',
+ (0.5, 0.5), 0.0, 0.0, 360.0))
+ ])
+ spines['polar'].set_transform(self.transWedge + self.transAxes)
+ spines['inner'].set_transform(self.transWedge + self.transAxes)
+ spines['start'].set_transform(self._yaxis_transform)
+ spines['end'].set_transform(self._yaxis_transform)
+ return spines
+
+ def set_thetamax(self, thetamax):
+ """Set the maximum theta limit in degrees."""
+ self.viewLim.x1 = np.deg2rad(thetamax)
+
+ def get_thetamax(self):
+ """Return the maximum theta limit in degrees."""
+ return np.rad2deg(self.viewLim.xmax)
+
+ def set_thetamin(self, thetamin):
+ """Set the minimum theta limit in degrees."""
+ self.viewLim.x0 = np.deg2rad(thetamin)
+
+ def get_thetamin(self):
+ """Get the minimum theta limit in degrees."""
+ return np.rad2deg(self.viewLim.xmin)
+
+ def set_thetalim(self, *args, **kwargs):
+ r"""
+ Set the minimum and maximum theta values.
+
+ Can take the following signatures:
+
+ - ``set_thetalim(minval, maxval)``: Set the limits in radians.
+ - ``set_thetalim(thetamin=minval, thetamax=maxval)``: Set the limits
+ in degrees.
+
+ where minval and maxval are the minimum and maximum limits. Values are
+ wrapped in to the range :math:`[0, 2\pi]` (in radians), so for example
+ it is possible to do ``set_thetalim(-np.pi / 2, np.pi / 2)`` to have
+ an axes symmetric around 0. A ValueError is raised if the absolute
+ angle difference is larger than a full circle.
+ """
+ orig_lim = self.get_xlim() # in radians
+ if 'thetamin' in kwargs:
+ kwargs['xmin'] = np.deg2rad(kwargs.pop('thetamin'))
+ if 'thetamax' in kwargs:
+ kwargs['xmax'] = np.deg2rad(kwargs.pop('thetamax'))
+ new_min, new_max = self.set_xlim(*args, **kwargs)
+ # Parsing all permutations of *args, **kwargs is tricky; it is simpler
+ # to let set_xlim() do it and then validate the limits.
+ if abs(new_max - new_min) > 2 * np.pi:
+ self.set_xlim(orig_lim) # un-accept the change
+ raise ValueError("The angle range must be less than a full circle")
+ return tuple(np.rad2deg((new_min, new_max)))
+
+ def set_theta_offset(self, offset):
+ """
+ Set the offset for the location of 0 in radians.
+ """
+ mtx = self._theta_offset.get_matrix()
+ mtx[0, 2] = offset
+ self._theta_offset.invalidate()
+
+ def get_theta_offset(self):
+ """
+ Get the offset for the location of 0 in radians.
+ """
+ return self._theta_offset.get_matrix()[0, 2]
+
+ def set_theta_zero_location(self, loc, offset=0.0):
+ """
+ Set the location of theta's zero.
+
+ This simply calls `set_theta_offset` with the correct value in radians.
+
+ Parameters
+ ----------
+ loc : str
+ May be one of "N", "NW", "W", "SW", "S", "SE", "E", or "NE".
+ offset : float, default: 0
+ An offset in degrees to apply from the specified *loc*. **Note:**
+ this offset is *always* applied counter-clockwise regardless of
+ the direction setting.
+ """
+ mapping = {
+ 'N': np.pi * 0.5,
+ 'NW': np.pi * 0.75,
+ 'W': np.pi,
+ 'SW': np.pi * 1.25,
+ 'S': np.pi * 1.5,
+ 'SE': np.pi * 1.75,
+ 'E': 0,
+ 'NE': np.pi * 0.25}
+ return self.set_theta_offset(mapping[loc] + np.deg2rad(offset))
+
+ def set_theta_direction(self, direction):
+ """
+ Set the direction in which theta increases.
+
+ clockwise, -1:
+ Theta increases in the clockwise direction
+
+ counterclockwise, anticlockwise, 1:
+ Theta increases in the counterclockwise direction
+ """
+ mtx = self._direction.get_matrix()
+ if direction in ('clockwise', -1):
+ mtx[0, 0] = -1
+ elif direction in ('counterclockwise', 'anticlockwise', 1):
+ mtx[0, 0] = 1
+ else:
+ _api.check_in_list(
+ [-1, 1, 'clockwise', 'counterclockwise', 'anticlockwise'],
+ direction=direction)
+ self._direction.invalidate()
+
+ def get_theta_direction(self):
+ """
+ Get the direction in which theta increases.
+
+ -1:
+ Theta increases in the clockwise direction
+
+ 1:
+ Theta increases in the counterclockwise direction
+ """
+ return self._direction.get_matrix()[0, 0]
+
+ def set_rmax(self, rmax):
+ """
+ Set the outer radial limit.
+
+ Parameters
+ ----------
+ rmax : float
+ """
+ self.viewLim.y1 = rmax
+
+ def get_rmax(self):
+ """
+ Returns
+ -------
+ float
+ Outer radial limit.
+ """
+ return self.viewLim.ymax
+
+ def set_rmin(self, rmin):
+ """
+ Set the inner radial limit.
+
+ Parameters
+ ----------
+ rmin : float
+ """
+ self.viewLim.y0 = rmin
+
+ def get_rmin(self):
+ """
+ Returns
+ -------
+ float
+ The inner radial limit.
+ """
+ return self.viewLim.ymin
+
+ def set_rorigin(self, rorigin):
+ """
+ Update the radial origin.
+
+ Parameters
+ ----------
+ rorigin : float
+ """
+ self._originViewLim.locked_y0 = rorigin
+
+ def get_rorigin(self):
+ """
+ Returns
+ -------
+ float
+ """
+ return self._originViewLim.y0
+
+ def get_rsign(self):
+ return np.sign(self._originViewLim.y1 - self._originViewLim.y0)
+
+ def set_rlim(self, bottom=None, top=None, emit=True, auto=False, **kwargs):
+ """
+ See `~.polar.PolarAxes.set_ylim`.
+ """
+ if 'rmin' in kwargs:
+ if bottom is None:
+ bottom = kwargs.pop('rmin')
+ else:
+ raise ValueError('Cannot supply both positional "bottom"'
+ 'argument and kwarg "rmin"')
+ if 'rmax' in kwargs:
+ if top is None:
+ top = kwargs.pop('rmax')
+ else:
+ raise ValueError('Cannot supply both positional "top"'
+ 'argument and kwarg "rmax"')
+ return self.set_ylim(bottom=bottom, top=top, emit=emit, auto=auto,
+ **kwargs)
+
+ def set_ylim(self, bottom=None, top=None, emit=True, auto=False,
+ *, ymin=None, ymax=None):
+ """
+ Set the data limits for the radial axis.
+
+ Parameters
+ ----------
+ bottom : float, optional
+ The bottom limit (default: None, which leaves the bottom
+ limit unchanged).
+ The bottom and top ylims may be passed as the tuple
+ (*bottom*, *top*) as the first positional argument (or as
+ the *bottom* keyword argument).
+
+ top : float, optional
+ The top limit (default: None, which leaves the top limit
+ unchanged).
+
+ emit : bool, default: True
+ Whether to notify observers of limit change.
+
+ auto : bool or None, default: False
+ Whether to turn on autoscaling of the y-axis. True turns on,
+ False turns off, None leaves unchanged.
+
+ ymin, ymax : float, optional
+ These arguments are deprecated and will be removed in a future
+ version. They are equivalent to *bottom* and *top* respectively,
+ and it is an error to pass both *ymin* and *bottom* or
+ *ymax* and *top*.
+
+ Returns
+ -------
+ bottom, top : (float, float)
+ The new y-axis limits in data coordinates.
+ """
+ if ymin is not None:
+ if bottom is not None:
+ raise ValueError('Cannot supply both positional "bottom" '
+ 'argument and kwarg "ymin"')
+ else:
+ bottom = ymin
+ if ymax is not None:
+ if top is not None:
+ raise ValueError('Cannot supply both positional "top" '
+ 'argument and kwarg "ymax"')
+ else:
+ top = ymax
+ if top is None and np.iterable(bottom):
+ bottom, top = bottom[0], bottom[1]
+ return super().set_ylim(bottom=bottom, top=top, emit=emit, auto=auto)
+
+ def get_rlabel_position(self):
+ """
+ Returns
+ -------
+ float
+ The theta position of the radius labels in degrees.
+ """
+ return np.rad2deg(self._r_label_position.get_matrix()[0, 2])
+
+ def set_rlabel_position(self, value):
+ """
+ Update the theta position of the radius labels.
+
+ Parameters
+ ----------
+ value : number
+ The angular position of the radius labels in degrees.
+ """
+ self._r_label_position.clear().translate(np.deg2rad(value), 0.0)
+
+ def set_yscale(self, *args, **kwargs):
+ super().set_yscale(*args, **kwargs)
+ self.yaxis.set_major_locator(
+ self.RadialLocator(self.yaxis.get_major_locator(), self))
+
+ def set_rscale(self, *args, **kwargs):
+ return Axes.set_yscale(self, *args, **kwargs)
+
+ def set_rticks(self, *args, **kwargs):
+ return Axes.set_yticks(self, *args, **kwargs)
+
+ def set_thetagrids(self, angles, labels=None, fmt=None, **kwargs):
+ """
+ Set the theta gridlines in a polar plot.
+
+ Parameters
+ ----------
+ angles : tuple with floats, degrees
+ The angles of the theta gridlines.
+
+ labels : tuple with strings or None
+ The labels to use at each theta gridline. The
+ `.projections.polar.ThetaFormatter` will be used if None.
+
+ fmt : str or None
+ Format string used in `matplotlib.ticker.FormatStrFormatter`.
+ For example '%f'. Note that the angle that is used is in
+ radians.
+
+ Returns
+ -------
+ lines : list of `.lines.Line2D`
+ The theta gridlines.
+
+ labels : list of `.text.Text`
+ The tick labels.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ *kwargs* are optional `~.Text` properties for the labels.
+
+ See Also
+ --------
+ .PolarAxes.set_rgrids
+ .Axis.get_gridlines
+ .Axis.get_ticklabels
+ """
+
+ # Make sure we take into account unitized data
+ angles = self.convert_yunits(angles)
+ angles = np.deg2rad(angles)
+ self.set_xticks(angles)
+ if labels is not None:
+ self.set_xticklabels(labels)
+ elif fmt is not None:
+ self.xaxis.set_major_formatter(mticker.FormatStrFormatter(fmt))
+ for t in self.xaxis.get_ticklabels():
+ t.update(kwargs)
+ return self.xaxis.get_ticklines(), self.xaxis.get_ticklabels()
+
+ def set_rgrids(self, radii, labels=None, angle=None, fmt=None, **kwargs):
+ """
+ Set the radial gridlines on a polar plot.
+
+ Parameters
+ ----------
+ radii : tuple with floats
+ The radii for the radial gridlines
+
+ labels : tuple with strings or None
+ The labels to use at each radial gridline. The
+ `matplotlib.ticker.ScalarFormatter` will be used if None.
+
+ angle : float
+ The angular position of the radius labels in degrees.
+
+ fmt : str or None
+ Format string used in `matplotlib.ticker.FormatStrFormatter`.
+ For example '%f'.
+
+ Returns
+ -------
+ lines : list of `.lines.Line2D`
+ The radial gridlines.
+
+ labels : list of `.text.Text`
+ The tick labels.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ *kwargs* are optional `~.Text` properties for the labels.
+
+ See Also
+ --------
+ .PolarAxes.set_thetagrids
+ .Axis.get_gridlines
+ .Axis.get_ticklabels
+ """
+ # Make sure we take into account unitized data
+ radii = self.convert_xunits(radii)
+ radii = np.asarray(radii)
+
+ self.set_yticks(radii)
+ if labels is not None:
+ self.set_yticklabels(labels)
+ elif fmt is not None:
+ self.yaxis.set_major_formatter(mticker.FormatStrFormatter(fmt))
+ if angle is None:
+ angle = self.get_rlabel_position()
+ self.set_rlabel_position(angle)
+ for t in self.yaxis.get_ticklabels():
+ t.update(kwargs)
+ return self.yaxis.get_gridlines(), self.yaxis.get_ticklabels()
+
+ def set_xscale(self, scale, *args, **kwargs):
+ if scale != 'linear':
+ raise NotImplementedError(
+ "You can not set the xscale on a polar plot.")
+
+ def format_coord(self, theta, r):
+ # docstring inherited
+ if theta < 0:
+ theta += 2 * np.pi
+ theta /= np.pi
+ return ('\N{GREEK SMALL LETTER THETA}=%0.3f\N{GREEK SMALL LETTER PI} '
+ '(%0.3f\N{DEGREE SIGN}), r=%0.3f') % (theta, theta * 180.0, r)
+
+ def get_data_ratio(self):
+ """
+ Return the aspect ratio of the data itself. For a polar plot,
+ this should always be 1.0
+ """
+ return 1.0
+
+ # # # Interactive panning
+
+ def can_zoom(self):
+ """
+ Return whether this axes supports the zoom box button functionality.
+
+ Polar axes do not support zoom boxes.
+ """
+ return False
+
+ def can_pan(self):
+ """
+ Return whether this axes supports the pan/zoom button functionality.
+
+ For polar axes, this is slightly misleading. Both panning and
+ zooming are performed by the same button. Panning is performed
+ in azimuth while zooming is done along the radial.
+ """
+ return True
+
+ def start_pan(self, x, y, button):
+ angle = np.deg2rad(self.get_rlabel_position())
+ mode = ''
+ if button == 1:
+ epsilon = np.pi / 45.0
+ t, r = self.transData.inverted().transform((x, y))
+ if angle - epsilon <= t <= angle + epsilon:
+ mode = 'drag_r_labels'
+ elif button == 3:
+ mode = 'zoom'
+
+ self._pan_start = types.SimpleNamespace(
+ rmax=self.get_rmax(),
+ trans=self.transData.frozen(),
+ trans_inverse=self.transData.inverted().frozen(),
+ r_label_angle=self.get_rlabel_position(),
+ x=x,
+ y=y,
+ mode=mode)
+
+ def end_pan(self):
+ del self._pan_start
+
+ def drag_pan(self, button, key, x, y):
+ p = self._pan_start
+
+ if p.mode == 'drag_r_labels':
+ (startt, startr), (t, r) = p.trans_inverse.transform(
+ [(p.x, p.y), (x, y)])
+
+ # Deal with theta
+ dt = np.rad2deg(startt - t)
+ self.set_rlabel_position(p.r_label_angle - dt)
+
+ trans, vert1, horiz1 = self.get_yaxis_text1_transform(0.0)
+ trans, vert2, horiz2 = self.get_yaxis_text2_transform(0.0)
+ for t in self.yaxis.majorTicks + self.yaxis.minorTicks:
+ t.label1.set_va(vert1)
+ t.label1.set_ha(horiz1)
+ t.label2.set_va(vert2)
+ t.label2.set_ha(horiz2)
+
+ elif p.mode == 'zoom':
+ (startt, startr), (t, r) = p.trans_inverse.transform(
+ [(p.x, p.y), (x, y)])
+
+ # Deal with r
+ scale = r / startr
+ self.set_rmax(p.rmax / scale)
+
+
+# to keep things all self contained, we can put aliases to the Polar classes
+# defined above. This isn't strictly necessary, but it makes some of the
+# code more readable (and provides a backwards compatible Polar API)
+PolarAxes.PolarTransform = PolarTransform
+PolarAxes.PolarAffine = PolarAffine
+PolarAxes.InvertedPolarTransform = InvertedPolarTransform
+PolarAxes.ThetaFormatter = ThetaFormatter
+PolarAxes.RadialLocator = RadialLocator
+PolarAxes.ThetaLocator = ThetaLocator
diff --git a/venv/Lib/site-packages/matplotlib/pylab.py b/venv/Lib/site-packages/matplotlib/pylab.py
new file mode 100644
index 0000000..6b9f89d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/pylab.py
@@ -0,0 +1,51 @@
+"""
+.. warning::
+ Since heavily importing into the global namespace may result in unexpected
+ behavior, the use of pylab is strongly discouraged. Use `matplotlib.pyplot`
+ instead.
+
+`pylab` is a module that includes `matplotlib.pyplot`, `numpy`, `numpy.fft`,
+`numpy.linalg`, `numpy.random`, and some additional functions, all within
+a single namespace. Its original purpose was to mimic a MATLAB-like way
+of working by importing all functions into the global namespace. This is
+considered bad style nowadays.
+"""
+
+from matplotlib.cbook import flatten, silent_list
+
+import matplotlib as mpl
+
+from matplotlib.dates import (
+ date2num, num2date, datestr2num, drange, epoch2num,
+ num2epoch, DateFormatter, IndexDateFormatter, DateLocator,
+ RRuleLocator, YearLocator, MonthLocator, WeekdayLocator, DayLocator,
+ HourLocator, MinuteLocator, SecondLocator, rrule, MO, TU, WE, TH, FR,
+ SA, SU, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY,
+ relativedelta)
+
+# bring all the symbols in so folks can import them from
+# pylab in one fell swoop
+
+## We are still importing too many things from mlab; more cleanup is needed.
+
+from matplotlib.mlab import (
+ detrend, detrend_linear, detrend_mean, detrend_none, window_hanning,
+ window_none)
+
+from matplotlib import cbook, mlab, pyplot as plt
+from matplotlib.pyplot import *
+
+from numpy import *
+from numpy.fft import *
+from numpy.random import *
+from numpy.linalg import *
+
+import numpy as np
+import numpy.ma as ma
+
+# don't let numpy's datetime hide stdlib
+import datetime
+
+# This is needed, or bytes will be numpy.random.bytes from
+# "from numpy.random import *" above
+bytes = __import__("builtins").bytes
diff --git a/venv/Lib/site-packages/matplotlib/pyplot.py b/venv/Lib/site-packages/matplotlib/pyplot.py
new file mode 100644
index 0000000..030ae51
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/pyplot.py
@@ -0,0 +1,3341 @@
+# Note: The first part of this file can be modified in place, but the latter
+# part is autogenerated by the boilerplate.py script.
+
+"""
+`matplotlib.pyplot` is a state-based interface to matplotlib. It provides
+a MATLAB-like way of plotting.
+
+pyplot is mainly intended for interactive plots and simple cases of
+programmatic plot generation::
+
+ import numpy as np
+ import matplotlib.pyplot as plt
+
+ x = np.arange(0, 5, 0.1)
+ y = np.sin(x)
+ plt.plot(x, y)
+
+The object-oriented API is recommended for more complex plots.
+"""
+
+import functools
+import importlib
+import inspect
+import logging
+from numbers import Number
+import re
+import sys
+import time
+try:
+ import threading
+except ImportError:
+ import dummy_threading as threading
+
+from cycler import cycler
+import matplotlib
+import matplotlib.colorbar
+import matplotlib.image
+from matplotlib import _api
+from matplotlib import rcsetup, style
+from matplotlib import _pylab_helpers, interactive
+from matplotlib import cbook
+from matplotlib import docstring
+from matplotlib.backend_bases import FigureCanvasBase, MouseButton
+from matplotlib.figure import Figure, figaspect
+from matplotlib.gridspec import GridSpec, SubplotSpec
+from matplotlib import rcParams, rcParamsDefault, get_backend, rcParamsOrig
+from matplotlib.rcsetup import interactive_bk as _interactive_bk
+from matplotlib.artist import Artist
+from matplotlib.axes import Axes, Subplot
+from matplotlib.projections import PolarAxes
+from matplotlib import mlab # for detrend_none, window_hanning
+from matplotlib.scale import get_scale_names
+
+from matplotlib import cm
+from matplotlib.cm import get_cmap, register_cmap
+
+import numpy as np
+
+# We may not need the following imports here:
+from matplotlib.colors import Normalize
+from matplotlib.lines import Line2D
+from matplotlib.text import Text, Annotation
+from matplotlib.patches import Polygon, Rectangle, Circle, Arrow
+from matplotlib.widgets import SubplotTool, Button, Slider, Widget
+
+from .ticker import (
+ TickHelper, Formatter, FixedFormatter, NullFormatter, FuncFormatter,
+ FormatStrFormatter, ScalarFormatter, LogFormatter, LogFormatterExponent,
+ LogFormatterMathtext, Locator, IndexLocator, FixedLocator, NullLocator,
+ LinearLocator, LogLocator, AutoLocator, MultipleLocator, MaxNLocator)
+
+_log = logging.getLogger(__name__)
+
+
+_code_objs = {
+ _api.rename_parameter:
+ _api.rename_parameter("", "old", "new", lambda new: None).__code__,
+ _api.make_keyword_only:
+ _api.make_keyword_only("", "p", lambda p: None).__code__,
+}
+
+
+def _copy_docstring_and_deprecators(method, func=None):
+ if func is None:
+ return functools.partial(_copy_docstring_and_deprecators, method)
+ decorators = [docstring.copy(method)]
+ # Check whether the definition of *method* includes @_api.rename_parameter
+ # or @_api.make_keyword_only decorators; if so, propagate them to the
+ # pyplot wrapper as well.
+ while getattr(method, "__wrapped__", None) is not None:
+ for decorator_maker, code in _code_objs.items():
+ if method.__code__ is code:
+ kwargs = {
+ k: v.cell_contents
+ for k, v in zip(code.co_freevars, method.__closure__)}
+ assert kwargs["func"] is method.__wrapped__
+ kwargs.pop("func")
+ decorators.append(decorator_maker(**kwargs))
+ method = method.__wrapped__
+ for decorator in decorators[::-1]:
+ func = decorator(func)
+ return func
+
+
+## Global ##
+
+
+_IP_REGISTERED = None
+_INSTALL_FIG_OBSERVER = False
+
+
+def install_repl_displayhook():
+ """
+ Install a repl display hook so that any stale figure are automatically
+ redrawn when control is returned to the repl.
+
+ This works both with IPython and with vanilla python shells.
+ """
+ global _IP_REGISTERED
+ global _INSTALL_FIG_OBSERVER
+
+ class _NotIPython(Exception):
+ pass
+
+ # see if we have IPython hooks around, if use them
+
+ try:
+ if 'IPython' in sys.modules:
+ from IPython import get_ipython
+ ip = get_ipython()
+ if ip is None:
+ raise _NotIPython()
+
+ if _IP_REGISTERED:
+ return
+
+ def post_execute():
+ if matplotlib.is_interactive():
+ draw_all()
+
+ # IPython >= 2
+ try:
+ ip.events.register('post_execute', post_execute)
+ except AttributeError:
+ # IPython 1.x
+ ip.register_post_execute(post_execute)
+
+ _IP_REGISTERED = post_execute
+ _INSTALL_FIG_OBSERVER = False
+
+ # trigger IPython's eventloop integration, if available
+ from IPython.core.pylabtools import backend2gui
+
+ ipython_gui_name = backend2gui.get(get_backend())
+ if ipython_gui_name:
+ ip.enable_gui(ipython_gui_name)
+ else:
+ _INSTALL_FIG_OBSERVER = True
+
+ # import failed or ipython is not running
+ except (ImportError, _NotIPython):
+ _INSTALL_FIG_OBSERVER = True
+
+
+def uninstall_repl_displayhook():
+ """
+ Uninstall the matplotlib display hook.
+
+ .. warning::
+
+ Need IPython >= 2 for this to work. For IPython < 2 will raise a
+ ``NotImplementedError``
+
+ .. warning::
+
+ If you are using vanilla python and have installed another
+ display hook this will reset ``sys.displayhook`` to what ever
+ function was there when matplotlib installed it's displayhook,
+ possibly discarding your changes.
+ """
+ global _IP_REGISTERED
+ global _INSTALL_FIG_OBSERVER
+ if _IP_REGISTERED:
+ from IPython import get_ipython
+ ip = get_ipython()
+ try:
+ ip.events.unregister('post_execute', _IP_REGISTERED)
+ except AttributeError as err:
+ raise NotImplementedError("Can not unregister events "
+ "in IPython < 2.0") from err
+ _IP_REGISTERED = None
+
+ if _INSTALL_FIG_OBSERVER:
+ _INSTALL_FIG_OBSERVER = False
+
+
+draw_all = _pylab_helpers.Gcf.draw_all
+
+
+@functools.wraps(matplotlib.set_loglevel)
+def set_loglevel(*args, **kwargs): # Ensure this appears in the pyplot docs.
+ return matplotlib.set_loglevel(*args, **kwargs)
+
+
+@_copy_docstring_and_deprecators(Artist.findobj)
+def findobj(o=None, match=None, include_self=True):
+ if o is None:
+ o = gcf()
+ return o.findobj(match, include_self=include_self)
+
+
+def _get_required_interactive_framework(backend_mod):
+ return getattr(
+ backend_mod.FigureCanvas, "required_interactive_framework", None)
+
+
+def switch_backend(newbackend):
+ """
+ Close all open figures and set the Matplotlib backend.
+
+ The argument is case-insensitive. Switching to an interactive backend is
+ possible only if no event loop for another interactive backend has started.
+ Switching to and from non-interactive backends is always possible.
+
+ Parameters
+ ----------
+ newbackend : str
+ The name of the backend to use.
+ """
+ global _backend_mod
+ # make sure the init is pulled up so we can assign to it later
+ import matplotlib.backends
+ close("all")
+
+ if newbackend is rcsetup._auto_backend_sentinel:
+ current_framework = cbook._get_running_interactive_framework()
+ mapping = {'qt5': 'qt5agg',
+ 'qt4': 'qt4agg',
+ 'gtk3': 'gtk3agg',
+ 'wx': 'wxagg',
+ 'tk': 'tkagg',
+ 'macosx': 'macosx',
+ 'headless': 'agg'}
+
+ best_guess = mapping.get(current_framework, None)
+ if best_guess is not None:
+ candidates = [best_guess]
+ else:
+ candidates = []
+ candidates += ["macosx", "qt5agg", "gtk3agg", "tkagg", "wxagg"]
+
+ # Don't try to fallback on the cairo-based backends as they each have
+ # an additional dependency (pycairo) over the agg-based backend, and
+ # are of worse quality.
+ for candidate in candidates:
+ try:
+ switch_backend(candidate)
+ except ImportError:
+ continue
+ else:
+ rcParamsOrig['backend'] = candidate
+ return
+ else:
+ # Switching to Agg should always succeed; if it doesn't, let the
+ # exception propagate out.
+ switch_backend("agg")
+ rcParamsOrig["backend"] = "agg"
+ return
+
+ # Backends are implemented as modules, but "inherit" default method
+ # implementations from backend_bases._Backend. This is achieved by
+ # creating a "class" that inherits from backend_bases._Backend and whose
+ # body is filled with the module's globals.
+
+ backend_name = cbook._backend_module_name(newbackend)
+
+ class backend_mod(matplotlib.backend_bases._Backend):
+ locals().update(vars(importlib.import_module(backend_name)))
+
+ required_framework = _get_required_interactive_framework(backend_mod)
+ if required_framework is not None:
+ current_framework = cbook._get_running_interactive_framework()
+ if (current_framework and required_framework
+ and current_framework != required_framework):
+ raise ImportError(
+ "Cannot load backend {!r} which requires the {!r} interactive "
+ "framework, as {!r} is currently running".format(
+ newbackend, required_framework, current_framework))
+
+ _log.debug("Loaded backend %s version %s.",
+ newbackend, backend_mod.backend_version)
+
+ rcParams['backend'] = rcParamsDefault['backend'] = newbackend
+ _backend_mod = backend_mod
+ for func_name in ["new_figure_manager", "draw_if_interactive", "show"]:
+ globals()[func_name].__signature__ = inspect.signature(
+ getattr(backend_mod, func_name))
+
+ # Need to keep a global reference to the backend for compatibility reasons.
+ # See https://github.com/matplotlib/matplotlib/issues/6092
+ matplotlib.backends.backend = newbackend
+
+
+def _warn_if_gui_out_of_main_thread():
+ if (_get_required_interactive_framework(_backend_mod)
+ and threading.current_thread() is not threading.main_thread()):
+ _api.warn_external(
+ "Starting a Matplotlib GUI outside of the main thread will likely "
+ "fail.")
+
+
+# This function's signature is rewritten upon backend-load by switch_backend.
+def new_figure_manager(*args, **kwargs):
+ """Create a new figure manager instance."""
+ _warn_if_gui_out_of_main_thread()
+ return _backend_mod.new_figure_manager(*args, **kwargs)
+
+
+# This function's signature is rewritten upon backend-load by switch_backend.
+def draw_if_interactive(*args, **kwargs):
+ """
+ Redraw the current figure if in interactive mode.
+
+ .. warning::
+
+ End users will typically not have to call this function because the
+ the interactive mode takes care of this.
+ """
+ return _backend_mod.draw_if_interactive(*args, **kwargs)
+
+
+# This function's signature is rewritten upon backend-load by switch_backend.
+def show(*args, **kwargs):
+ """
+ Display all open figures.
+
+ Parameters
+ ----------
+ block : bool, optional
+ Whether to wait for all figures to be closed before returning.
+
+ If `True` block and run the GUI main loop until all figure windows
+ are closed.
+
+ If `False` ensure that all figure windows are displayed and return
+ immediately. In this case, you are responsible for ensuring
+ that the event loop is running to have responsive figures.
+
+ Defaults to True in non-interactive mode and to False in interactive
+ mode (see `.pyplot.isinteractive`).
+
+ See Also
+ --------
+ ion : Enable interactive mode, which shows / updates the figure after
+ every plotting command, so that calling ``show()`` is not necessary.
+ ioff : Disable interactive mode.
+ savefig : Save the figure to an image file instead of showing it on screen.
+
+ Notes
+ -----
+ **Saving figures to file and showing a window at the same time**
+
+ If you want an image file as well as a user interface window, use
+ `.pyplot.savefig` before `.pyplot.show`. At the end of (a blocking)
+ ``show()`` the figure is closed and thus unregistered from pyplot. Calling
+ `.pyplot.savefig` afterwards would save a new and thus empty figure. This
+ limitation of command order does not apply if the show is non-blocking or
+ if you keep a reference to the figure and use `.Figure.savefig`.
+
+ **Auto-show in jupyter notebooks**
+
+ The jupyter backends (activated via ``%matplotlib inline``,
+ ``%matplotlib notebook``, or ``%matplotlib widget``), call ``show()`` at
+ the end of every cell by default. Thus, you usually don't have to call it
+ explicitly there.
+ """
+ _warn_if_gui_out_of_main_thread()
+ return _backend_mod.show(*args, **kwargs)
+
+
+def isinteractive():
+ """
+ Return whether plots are updated after every plotting command.
+
+ The interactive mode is mainly useful if you build plots from the command
+ line and want to see the effect of each command while you are building the
+ figure.
+
+ In interactive mode:
+
+ - newly created figures will be shown immediately;
+ - figures will automatically redraw on change;
+ - `.pyplot.show` will not block by default.
+
+ In non-interactive mode:
+
+ - newly created figures and changes to figures will not be reflected until
+ explicitly asked to be;
+ - `.pyplot.show` will block by default.
+
+ See Also
+ --------
+ ion : Enable interactive mode.
+ ioff : Disable interactive mode.
+ show : Show all figures (and maybe block).
+ pause : Show all figures, and block for a time.
+ """
+ return matplotlib.is_interactive()
+
+
+class _IoffContext:
+ """
+ Context manager for `.ioff`.
+
+ The state is changed in ``__init__()`` instead of ``__enter__()``. The
+ latter is a no-op. This allows using `.ioff` both as a function and
+ as a context.
+ """
+
+ def __init__(self):
+ self.wasinteractive = isinteractive()
+ matplotlib.interactive(False)
+ uninstall_repl_displayhook()
+
+ def __enter__(self):
+ pass
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ if self.wasinteractive:
+ matplotlib.interactive(True)
+ install_repl_displayhook()
+ else:
+ matplotlib.interactive(False)
+ uninstall_repl_displayhook()
+
+
+class _IonContext:
+ """
+ Context manager for `.ion`.
+
+ The state is changed in ``__init__()`` instead of ``__enter__()``. The
+ latter is a no-op. This allows using `.ion` both as a function and
+ as a context.
+ """
+
+ def __init__(self):
+ self.wasinteractive = isinteractive()
+ matplotlib.interactive(True)
+ install_repl_displayhook()
+
+ def __enter__(self):
+ pass
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ if not self.wasinteractive:
+ matplotlib.interactive(False)
+ uninstall_repl_displayhook()
+ else:
+ matplotlib.interactive(True)
+ install_repl_displayhook()
+
+
+def ioff():
+ """
+ Disable interactive mode.
+
+ See `.pyplot.isinteractive` for more details.
+
+ See Also
+ --------
+ ion : Enable interactive mode.
+ isinteractive : Whether interactive mode is enabled.
+ show : Show all figures (and maybe block).
+ pause : Show all figures, and block for a time.
+
+ Notes
+ -----
+ For a temporary change, this can be used as a context manager::
+
+ # if interactive mode is on
+ # then figures will be shown on creation
+ plt.ion()
+ # This figure will be shown immediately
+ fig = plt.figure()
+
+ with plt.ioff():
+ # interactive mode will be off
+ # figures will not automatically be shown
+ fig2 = plt.figure()
+ # ...
+
+ To enable usage as a context manager, this function returns an
+ ``_IoffContext`` object. The return value is not intended to be stored
+ or accessed by the user.
+ """
+ return _IoffContext()
+
+
+def ion():
+ """
+ Enable interactive mode.
+
+ See `.pyplot.isinteractive` for more details.
+
+ See Also
+ --------
+ ioff : Disable interactive mode.
+ isinteractive : Whether interactive mode is enabled.
+ show : Show all figures (and maybe block).
+ pause : Show all figures, and block for a time.
+
+ Notes
+ -----
+ For a temporary change, this can be used as a context manager::
+
+ # if interactive mode is off
+ # then figures will not be shown on creation
+ plt.ioff()
+ # This figure will not be shown immediately
+ fig = plt.figure()
+
+ with plt.ion():
+ # interactive mode will be on
+ # figures will automatically be shown
+ fig2 = plt.figure()
+ # ...
+
+ To enable usage as a context manager, this function returns an
+ ``_IonContext`` object. The return value is not intended to be stored
+ or accessed by the user.
+ """
+ return _IonContext()
+
+
+def pause(interval):
+ """
+ Run the GUI event loop for *interval* seconds.
+
+ If there is an active figure, it will be updated and displayed before the
+ pause, and the GUI event loop (if any) will run during the pause.
+
+ This can be used for crude animation. For more complex animation use
+ :mod:`matplotlib.animation`.
+
+ If there is no active figure, sleep for *interval* seconds instead.
+
+ See Also
+ --------
+ matplotlib.animation : Proper animations
+ show : Show all figures and optional block until all figures are closed.
+ """
+ manager = _pylab_helpers.Gcf.get_active()
+ if manager is not None:
+ canvas = manager.canvas
+ if canvas.figure.stale:
+ canvas.draw_idle()
+ show(block=False)
+ canvas.start_event_loop(interval)
+ else:
+ time.sleep(interval)
+
+
+@_copy_docstring_and_deprecators(matplotlib.rc)
+def rc(group, **kwargs):
+ matplotlib.rc(group, **kwargs)
+
+
+@_copy_docstring_and_deprecators(matplotlib.rc_context)
+def rc_context(rc=None, fname=None):
+ return matplotlib.rc_context(rc, fname)
+
+
+@_copy_docstring_and_deprecators(matplotlib.rcdefaults)
+def rcdefaults():
+ matplotlib.rcdefaults()
+ if matplotlib.is_interactive():
+ draw_all()
+
+
+# getp/get/setp are explicitly reexported so that they show up in pyplot docs.
+
+
+@_copy_docstring_and_deprecators(matplotlib.artist.getp)
+def getp(obj, *args, **kwargs):
+ return matplotlib.artist.getp(obj, *args, **kwargs)
+
+
+@_copy_docstring_and_deprecators(matplotlib.artist.get)
+def get(obj, *args, **kwargs):
+ return matplotlib.artist.get(obj, *args, **kwargs)
+
+
+@_copy_docstring_and_deprecators(matplotlib.artist.setp)
+def setp(obj, *args, **kwargs):
+ return matplotlib.artist.setp(obj, *args, **kwargs)
+
+
+def xkcd(scale=1, length=100, randomness=2):
+ """
+ Turn on `xkcd `_ sketch-style drawing mode. This will
+ only have effect on things drawn after this function is called.
+
+ For best results, the "Humor Sans" font should be installed: it is
+ not included with Matplotlib.
+
+ Parameters
+ ----------
+ scale : float, optional
+ The amplitude of the wiggle perpendicular to the source line.
+ length : float, optional
+ The length of the wiggle along the line.
+ randomness : float, optional
+ The scale factor by which the length is shrunken or expanded.
+
+ Notes
+ -----
+ This function works by a number of rcParams, so it will probably
+ override others you have set before.
+
+ If you want the effects of this function to be temporary, it can
+ be used as a context manager, for example::
+
+ with plt.xkcd():
+ # This figure will be in XKCD-style
+ fig1 = plt.figure()
+ # ...
+
+ # This figure will be in regular style
+ fig2 = plt.figure()
+ """
+ return _xkcd(scale, length, randomness)
+
+
+class _xkcd:
+ # This cannot be implemented in terms of rc_context() because this needs to
+ # work as a non-contextmanager too.
+
+ def __init__(self, scale, length, randomness):
+ self._orig = rcParams.copy()
+
+ if rcParams['text.usetex']:
+ raise RuntimeError(
+ "xkcd mode is not compatible with text.usetex = True")
+
+ from matplotlib import patheffects
+ rcParams.update({
+ 'font.family': ['xkcd', 'xkcd Script', 'Humor Sans', 'Comic Neue',
+ 'Comic Sans MS'],
+ 'font.size': 14.0,
+ 'path.sketch': (scale, length, randomness),
+ 'path.effects': [
+ patheffects.withStroke(linewidth=4, foreground="w")],
+ 'axes.linewidth': 1.5,
+ 'lines.linewidth': 2.0,
+ 'figure.facecolor': 'white',
+ 'grid.linewidth': 0.0,
+ 'axes.grid': False,
+ 'axes.unicode_minus': False,
+ 'axes.edgecolor': 'black',
+ 'xtick.major.size': 8,
+ 'xtick.major.width': 3,
+ 'ytick.major.size': 8,
+ 'ytick.major.width': 3,
+ })
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *args):
+ dict.update(rcParams, self._orig)
+
+
+## Figures ##
+
+def figure(num=None, # autoincrement if None, else integer from 1-N
+ figsize=None, # defaults to rc figure.figsize
+ dpi=None, # defaults to rc figure.dpi
+ facecolor=None, # defaults to rc figure.facecolor
+ edgecolor=None, # defaults to rc figure.edgecolor
+ frameon=True,
+ FigureClass=Figure,
+ clear=False,
+ **kwargs
+ ):
+ """
+ Create a new figure, or activate an existing figure.
+
+ Parameters
+ ----------
+ num : int or str or `.Figure`, optional
+ A unique identifier for the figure.
+
+ If a figure with that identifier already exists, this figure is made
+ active and returned. An integer refers to the ``Figure.number``
+ attribute, a string refers to the figure label.
+
+ If there is no figure with the identifier or *num* is not given, a new
+ figure is created, made active and returned. If *num* is an int, it
+ will be used for the ``Figure.number`` attribute, otherwise, an
+ auto-generated integer value is used (starting at 1 and incremented
+ for each new figure). If *num* is a string, the figure label and the
+ window title is set to this value.
+
+ figsize : (float, float), default: :rc:`figure.figsize`
+ Width, height in inches.
+
+ dpi : float, default: :rc:`figure.dpi`
+ The resolution of the figure in dots-per-inch.
+
+ facecolor : color, default: :rc:`figure.facecolor`
+ The background color.
+
+ edgecolor : color, default: :rc:`figure.edgecolor`
+ The border color.
+
+ frameon : bool, default: True
+ If False, suppress drawing the figure frame.
+
+ FigureClass : subclass of `~matplotlib.figure.Figure`
+ Optionally use a custom `.Figure` instance.
+
+ clear : bool, default: False
+ If True and the figure already exists, then it is cleared.
+
+ tight_layout : bool or dict, default: :rc:`figure.autolayout`
+ If ``False`` use *subplotpars*. If ``True`` adjust subplot
+ parameters using `.tight_layout` with default padding.
+ When providing a dict containing the keys ``pad``, ``w_pad``,
+ ``h_pad``, and ``rect``, the default `.tight_layout` paddings
+ will be overridden.
+
+ constrained_layout : bool, default: :rc:`figure.constrained_layout.use`
+ If ``True`` use constrained layout to adjust positioning of plot
+ elements. Like ``tight_layout``, but designed to be more
+ flexible. See
+ :doc:`/tutorials/intermediate/constrainedlayout_guide`
+ for examples. (Note: does not work with `add_subplot` or
+ `~.pyplot.subplot2grid`.)
+
+
+ **kwargs :Â optional
+ See `~.matplotlib.figure.Figure` for other possible arguments.
+
+ Returns
+ -------
+ `~matplotlib.figure.Figure`
+ The `.Figure` instance returned will also be passed to
+ new_figure_manager in the backends, which allows to hook custom
+ `.Figure` classes into the pyplot interface. Additional kwargs will be
+ passed to the `.Figure` init function.
+
+ Notes
+ -----
+ If you are creating many figures, make sure you explicitly call
+ `.pyplot.close` on the figures you are not using, because this will
+ enable pyplot to properly clean up the memory.
+
+ `~matplotlib.rcParams` defines the default values, which can be modified
+ in the matplotlibrc file.
+ """
+ if isinstance(num, Figure):
+ if num.canvas.manager is None:
+ raise ValueError("The passed figure is not managed by pyplot")
+ _pylab_helpers.Gcf.set_active(num.canvas.manager)
+ return num
+
+ allnums = get_fignums()
+ next_num = max(allnums) + 1 if allnums else 1
+ fig_label = ''
+ if num is None:
+ num = next_num
+ elif isinstance(num, str):
+ fig_label = num
+ all_labels = get_figlabels()
+ if fig_label not in all_labels:
+ if fig_label == 'all':
+ _api.warn_external("close('all') closes all existing figures.")
+ num = next_num
+ else:
+ inum = all_labels.index(fig_label)
+ num = allnums[inum]
+ else:
+ num = int(num) # crude validation of num argument
+
+ manager = _pylab_helpers.Gcf.get_fig_manager(num)
+ if manager is None:
+ max_open_warning = rcParams['figure.max_open_warning']
+ if len(allnums) == max_open_warning >= 1:
+ _api.warn_external(
+ f"More than {max_open_warning} figures have been opened. "
+ f"Figures created through the pyplot interface "
+ f"(`matplotlib.pyplot.figure`) are retained until explicitly "
+ f"closed and may consume too much memory. (To control this "
+ f"warning, see the rcParam `figure.max_open_warning`).",
+ RuntimeWarning)
+
+ manager = new_figure_manager(
+ num, figsize=figsize, dpi=dpi,
+ facecolor=facecolor, edgecolor=edgecolor, frameon=frameon,
+ FigureClass=FigureClass, **kwargs)
+ fig = manager.canvas.figure
+ if fig_label:
+ fig.set_label(fig_label)
+
+ _pylab_helpers.Gcf._set_new_active_manager(manager)
+
+ # make sure backends (inline) that we don't ship that expect this
+ # to be called in plotting commands to make the figure call show
+ # still work. There is probably a better way to do this in the
+ # FigureManager base class.
+ draw_if_interactive()
+
+ if _INSTALL_FIG_OBSERVER:
+ fig.stale_callback = _auto_draw_if_interactive
+
+ if clear:
+ manager.canvas.figure.clear()
+
+ return manager.canvas.figure
+
+
+def _auto_draw_if_interactive(fig, val):
+ """
+ An internal helper function for making sure that auto-redrawing
+ works as intended in the plain python repl.
+
+ Parameters
+ ----------
+ fig : Figure
+ A figure object which is assumed to be associated with a canvas
+ """
+ if (val and matplotlib.is_interactive()
+ and not fig.canvas.is_saving()
+ and not fig.canvas._is_idle_drawing):
+ # Some artists can mark themselves as stale in the middle of drawing
+ # (e.g. axes position & tick labels being computed at draw time), but
+ # this shouldn't trigger a redraw because the current redraw will
+ # already take them into account.
+ with fig.canvas._idle_draw_cntx():
+ fig.canvas.draw_idle()
+
+
+def gcf():
+ """
+ Get the current figure.
+
+ If no current figure exists, a new one is created using
+ `~.pyplot.figure()`.
+ """
+ manager = _pylab_helpers.Gcf.get_active()
+ if manager is not None:
+ return manager.canvas.figure
+ else:
+ return figure()
+
+
+def fignum_exists(num):
+ """Return whether the figure with the given id exists."""
+ return _pylab_helpers.Gcf.has_fignum(num) or num in get_figlabels()
+
+
+def get_fignums():
+ """Return a list of existing figure numbers."""
+ return sorted(_pylab_helpers.Gcf.figs)
+
+
+def get_figlabels():
+ """Return a list of existing figure labels."""
+ managers = _pylab_helpers.Gcf.get_all_fig_managers()
+ managers.sort(key=lambda m: m.num)
+ return [m.canvas.figure.get_label() for m in managers]
+
+
+def get_current_fig_manager():
+ """
+ Return the figure manager of the current figure.
+
+ The figure manager is a container for the actual backend-depended window
+ that displays the figure on screen.
+
+ If no current figure exists, a new one is created, and its figure
+ manager is returned.
+
+ Returns
+ -------
+ `.FigureManagerBase` or backend-dependent subclass thereof
+ """
+ return gcf().canvas.manager
+
+
+@_copy_docstring_and_deprecators(FigureCanvasBase.mpl_connect)
+def connect(s, func):
+ return gcf().canvas.mpl_connect(s, func)
+
+
+@_copy_docstring_and_deprecators(FigureCanvasBase.mpl_disconnect)
+def disconnect(cid):
+ return gcf().canvas.mpl_disconnect(cid)
+
+
+def close(fig=None):
+ """
+ Close a figure window.
+
+ Parameters
+ ----------
+ fig : None or int or str or `.Figure`
+ The figure to close. There are a number of ways to specify this:
+
+ - *None*: the current figure
+ - `.Figure`: the given `.Figure` instance
+ - ``int``: a figure number
+ - ``str``: a figure name
+ - 'all': all figures
+
+ """
+ if fig is None:
+ manager = _pylab_helpers.Gcf.get_active()
+ if manager is None:
+ return
+ else:
+ _pylab_helpers.Gcf.destroy(manager)
+ elif fig == 'all':
+ _pylab_helpers.Gcf.destroy_all()
+ elif isinstance(fig, int):
+ _pylab_helpers.Gcf.destroy(fig)
+ elif hasattr(fig, 'int'):
+ # if we are dealing with a type UUID, we
+ # can use its integer representation
+ _pylab_helpers.Gcf.destroy(fig.int)
+ elif isinstance(fig, str):
+ all_labels = get_figlabels()
+ if fig in all_labels:
+ num = get_fignums()[all_labels.index(fig)]
+ _pylab_helpers.Gcf.destroy(num)
+ elif isinstance(fig, Figure):
+ _pylab_helpers.Gcf.destroy_fig(fig)
+ else:
+ raise TypeError("close() argument must be a Figure, an int, a string, "
+ "or None, not %s" % type(fig))
+
+
+def clf():
+ """Clear the current figure."""
+ gcf().clf()
+
+
+def draw():
+ """
+ Redraw the current figure.
+
+ This is used to update a figure that has been altered, but not
+ automatically re-drawn. If interactive mode is on (via `.ion()`), this
+ should be only rarely needed, but there may be ways to modify the state of
+ a figure without marking it as "stale". Please report these cases as bugs.
+
+ This is equivalent to calling ``fig.canvas.draw_idle()``, where ``fig`` is
+ the current figure.
+ """
+ gcf().canvas.draw_idle()
+
+
+@_copy_docstring_and_deprecators(Figure.savefig)
+def savefig(*args, **kwargs):
+ fig = gcf()
+ res = fig.savefig(*args, **kwargs)
+ fig.canvas.draw_idle() # need this if 'transparent=True' to reset colors
+ return res
+
+
+## Putting things in figures ##
+
+
+def figlegend(*args, **kwargs):
+ return gcf().legend(*args, **kwargs)
+if Figure.legend.__doc__:
+ figlegend.__doc__ = Figure.legend.__doc__.replace("legend(", "figlegend(")
+
+
+## Axes ##
+
+@docstring.dedent_interpd
+def axes(arg=None, **kwargs):
+ """
+ Add an axes to the current figure and make it the current axes.
+
+ Call signatures::
+
+ plt.axes()
+ plt.axes(rect, projection=None, polar=False, **kwargs)
+ plt.axes(ax)
+
+ Parameters
+ ----------
+ arg : None or 4-tuple
+ The exact behavior of this function depends on the type:
+
+ - *None*: A new full window axes is added using
+ ``subplot(**kwargs)``.
+ - 4-tuple of floats *rect* = ``[left, bottom, width, height]``.
+ A new axes is added with dimensions *rect* in normalized
+ (0, 1) units using `~.Figure.add_axes` on the current figure.
+
+ projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', \
+'polar', 'rectilinear', str}, optional
+ The projection type of the `~.axes.Axes`. *str* is the name of
+ a custom projection, see `~matplotlib.projections`. The default
+ None results in a 'rectilinear' projection.
+
+ polar : bool, default: False
+ If True, equivalent to projection='polar'.
+
+ sharex, sharey : `~.axes.Axes`, optional
+ Share the x or y `~matplotlib.axis` with sharex and/or sharey.
+ The axis will have the same limits, ticks, and scale as the axis
+ of the shared axes.
+
+ label : str
+ A label for the returned axes.
+
+ Returns
+ -------
+ `~.axes.Axes`, or a subclass of `~.axes.Axes`
+ The returned axes class depends on the projection used. It is
+ `~.axes.Axes` if rectilinear projection is used and
+ `.projections.polar.PolarAxes` if polar projection is used.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ This method also takes the keyword arguments for
+ the returned axes class. The keyword arguments for the
+ rectilinear axes class `~.axes.Axes` can be found in
+ the following table but there might also be other keyword
+ arguments if another projection is used, see the actual axes
+ class.
+
+ %(Axes_kwdoc)s
+
+ Notes
+ -----
+ If the figure already has a axes with key (*args*,
+ *kwargs*) then it will simply make that axes current and
+ return it. This behavior is deprecated. Meanwhile, if you do
+ not want this behavior (i.e., you want to force the creation of a
+ new axes), you must use a unique set of args and kwargs. The axes
+ *label* attribute has been exposed for this purpose: if you want
+ two axes that are otherwise identical to be added to the figure,
+ make sure you give them unique labels.
+
+ See Also
+ --------
+ .Figure.add_axes
+ .pyplot.subplot
+ .Figure.add_subplot
+ .Figure.subplots
+ .pyplot.subplots
+
+ Examples
+ --------
+ ::
+
+ # Creating a new full window axes
+ plt.axes()
+
+ # Creating a new axes with specified dimensions and some kwargs
+ plt.axes((left, bottom, width, height), facecolor='w')
+ """
+ fig = gcf()
+ if arg is None:
+ return fig.add_subplot(**kwargs)
+ else:
+ return fig.add_axes(arg, **kwargs)
+
+
+def delaxes(ax=None):
+ """
+ Remove an `~.axes.Axes` (defaulting to the current axes) from its figure.
+ """
+ if ax is None:
+ ax = gca()
+ ax.remove()
+
+
+def sca(ax):
+ """
+ Set the current Axes to *ax* and the current Figure to the parent of *ax*.
+ """
+ figure(ax.figure)
+ ax.figure.sca(ax)
+
+
+def cla():
+ """Clear the current axes."""
+ # Not generated via boilerplate.py to allow a different docstring.
+ return gca().cla()
+
+
+## More ways of creating axes ##
+
+@docstring.dedent_interpd
+def subplot(*args, **kwargs):
+ """
+ Add an Axes to the current figure or retrieve an existing Axes.
+
+ This is a wrapper of `.Figure.add_subplot` which provides additional
+ behavior when working with the implicit API (see the notes section).
+
+ Call signatures::
+
+ subplot(nrows, ncols, index, **kwargs)
+ subplot(pos, **kwargs)
+ subplot(**kwargs)
+ subplot(ax)
+
+ Parameters
+ ----------
+ *args : int, (int, int, *index*), or `.SubplotSpec`, default: (1, 1, 1)
+ The position of the subplot described by one of
+
+ - Three integers (*nrows*, *ncols*, *index*). The subplot will take the
+ *index* position on a grid with *nrows* rows and *ncols* columns.
+ *index* starts at 1 in the upper left corner and increases to the
+ right. *index* can also be a two-tuple specifying the (*first*,
+ *last*) indices (1-based, and including *last*) of the subplot, e.g.,
+ ``fig.add_subplot(3, 1, (1, 2))`` makes a subplot that spans the
+ upper 2/3 of the figure.
+ - A 3-digit integer. The digits are interpreted as if given separately
+ as three single-digit integers, i.e. ``fig.add_subplot(235)`` is the
+ same as ``fig.add_subplot(2, 3, 5)``. Note that this can only be used
+ if there are no more than 9 subplots.
+ - A `.SubplotSpec`.
+
+ projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', \
+'polar', 'rectilinear', str}, optional
+ The projection type of the subplot (`~.axes.Axes`). *str* is the name
+ of a custom projection, see `~matplotlib.projections`. The default
+ None results in a 'rectilinear' projection.
+
+ polar : bool, default: False
+ If True, equivalent to projection='polar'.
+
+ sharex, sharey : `~.axes.Axes`, optional
+ Share the x or y `~matplotlib.axis` with sharex and/or sharey. The
+ axis will have the same limits, ticks, and scale as the axis of the
+ shared axes.
+
+ label : str
+ A label for the returned axes.
+
+ Returns
+ -------
+ `.axes.SubplotBase`, or another subclass of `~.axes.Axes`
+
+ The axes of the subplot. The returned axes base class depends on
+ the projection used. It is `~.axes.Axes` if rectilinear projection
+ is used and `.projections.polar.PolarAxes` if polar projection
+ is used. The returned axes is then a subplot subclass of the
+ base class.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ This method also takes the keyword arguments for the returned axes
+ base class; except for the *figure* argument. The keyword arguments
+ for the rectilinear base class `~.axes.Axes` can be found in
+ the following table but there might also be other keyword
+ arguments if another projection is used.
+
+ %(Axes_kwdoc)s
+
+ Notes
+ -----
+ Creating a new Axes will delete any pre-existing Axes that
+ overlaps with it beyond sharing a boundary::
+
+ import matplotlib.pyplot as plt
+ # plot a line, implicitly creating a subplot(111)
+ plt.plot([1, 2, 3])
+ # now create a subplot which represents the top plot of a grid
+ # with 2 rows and 1 column. Since this subplot will overlap the
+ # first, the plot (and its axes) previously created, will be removed
+ plt.subplot(211)
+
+ If you do not want this behavior, use the `.Figure.add_subplot` method
+ or the `.pyplot.axes` function instead.
+
+ If no *kwargs* are passed and there exists an Axes in the location
+ specified by *args* then that Axes will be returned rather than a new
+ Axes being created.
+
+ If *kwargs* are passed and there exists an Axes in the location
+ specified by *args*, the projection type is the same, and the
+ *kwargs* match with the existing Axes, then the existing Axes is
+ returned. Otherwise a new Axes is created with the specified
+ parameters. We save a reference to the *kwargs* which we use
+ for this comparison. If any of the values in *kwargs* are
+ mutable we will not detect the case where they are mutated.
+ In these cases we suggest using `.Figure.add_subplot` and the
+ explicit Axes API rather than the implicit pyplot API.
+
+ See Also
+ --------
+ .Figure.add_subplot
+ .pyplot.subplots
+ .pyplot.axes
+ .Figure.subplots
+
+ Examples
+ --------
+ ::
+
+ plt.subplot(221)
+
+ # equivalent but more general
+ ax1 = plt.subplot(2, 2, 1)
+
+ # add a subplot with no frame
+ ax2 = plt.subplot(222, frameon=False)
+
+ # add a polar subplot
+ plt.subplot(223, projection='polar')
+
+ # add a red subplot that shares the x-axis with ax1
+ plt.subplot(224, sharex=ax1, facecolor='red')
+
+ # delete ax2 from the figure
+ plt.delaxes(ax2)
+
+ # add ax2 to the figure again
+ plt.subplot(ax2)
+
+ # make the first axes "current" again
+ plt.subplot(221)
+
+ """
+ # Here we will only normalize `polar=True` vs `projection='polar'` and let
+ # downstream code deal with the rest.
+ unset = object()
+ projection = kwargs.get('projection', unset)
+ polar = kwargs.pop('polar', unset)
+ if polar is not unset and polar:
+ # if we got mixed messages from the user, raise
+ if projection is not unset and projection != 'polar':
+ raise ValueError(
+ f"polar={polar}, yet projection={projection!r}. "
+ "Only one of these arguments should be supplied."
+ )
+ kwargs['projection'] = projection = 'polar'
+
+ # if subplot called without arguments, create subplot(1, 1, 1)
+ if len(args) == 0:
+ args = (1, 1, 1)
+
+ # This check was added because it is very easy to type subplot(1, 2, False)
+ # when subplots(1, 2, False) was intended (sharex=False, that is). In most
+ # cases, no error will ever occur, but mysterious behavior can result
+ # because what was intended to be the sharex argument is instead treated as
+ # a subplot index for subplot()
+ if len(args) >= 3 and isinstance(args[2], bool):
+ _api.warn_external("The subplot index argument to subplot() appears "
+ "to be a boolean. Did you intend to use "
+ "subplots()?")
+ # Check for nrows and ncols, which are not valid subplot args:
+ if 'nrows' in kwargs or 'ncols' in kwargs:
+ raise TypeError("subplot() got an unexpected keyword argument 'ncols' "
+ "and/or 'nrows'. Did you intend to call subplots()?")
+
+ fig = gcf()
+
+ # First, search for an existing subplot with a matching spec.
+ key = SubplotSpec._from_subplot_args(fig, args)
+
+ for ax in fig.axes:
+ # if we found an axes at the position sort out if we can re-use it
+ if hasattr(ax, 'get_subplotspec') and ax.get_subplotspec() == key:
+ # if the user passed no kwargs, re-use
+ if kwargs == {}:
+ break
+ # if the axes class and kwargs are identical, reuse
+ elif ax._projection_init == fig._process_projection_requirements(
+ *args, **kwargs
+ ):
+ break
+ else:
+ # we have exhausted the known Axes and none match, make a new one!
+ ax = fig.add_subplot(*args, **kwargs)
+
+ fig.sca(ax)
+
+ bbox = ax.bbox
+ axes_to_delete = []
+ for other_ax in fig.axes:
+ if other_ax == ax:
+ continue
+ if bbox.fully_overlaps(other_ax.bbox):
+ axes_to_delete.append(other_ax)
+ for ax_to_del in axes_to_delete:
+ delaxes(ax_to_del)
+
+ return ax
+
+
+@_api.make_keyword_only("3.3", "sharex")
+def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
+ subplot_kw=None, gridspec_kw=None, **fig_kw):
+ """
+ Create a figure and a set of subplots.
+
+ This utility wrapper makes it convenient to create common layouts of
+ subplots, including the enclosing figure object, in a single call.
+
+ Parameters
+ ----------
+ nrows, ncols : int, default: 1
+ Number of rows/columns of the subplot grid.
+
+ sharex, sharey : bool or {'none', 'all', 'row', 'col'}, default: False
+ Controls sharing of properties among x (*sharex*) or y (*sharey*)
+ axes:
+
+ - True or 'all': x- or y-axis will be shared among all subplots.
+ - False or 'none': each subplot x- or y-axis will be independent.
+ - 'row': each subplot row will share an x- or y-axis.
+ - 'col': each subplot column will share an x- or y-axis.
+
+ When subplots have a shared x-axis along a column, only the x tick
+ labels of the bottom subplot are created. Similarly, when subplots
+ have a shared y-axis along a row, only the y tick labels of the first
+ column subplot are created. To later turn other subplots' ticklabels
+ on, use `~matplotlib.axes.Axes.tick_params`.
+
+ When subplots have a shared axis that has units, calling
+ `~matplotlib.axis.Axis.set_units` will update each axis with the
+ new units.
+
+ squeeze : bool, default: True
+ - If True, extra dimensions are squeezed out from the returned
+ array of `~matplotlib.axes.Axes`:
+
+ - if only one subplot is constructed (nrows=ncols=1), the
+ resulting single Axes object is returned as a scalar.
+ - for Nx1 or 1xM subplots, the returned object is a 1D numpy
+ object array of Axes objects.
+ - for NxM, subplots with N>1 and M>1 are returned as a 2D array.
+
+ - If False, no squeezing at all is done: the returned Axes object is
+ always a 2D array containing Axes instances, even if it ends up
+ being 1x1.
+
+ subplot_kw : dict, optional
+ Dict with keywords passed to the
+ `~matplotlib.figure.Figure.add_subplot` call used to create each
+ subplot.
+
+ gridspec_kw : dict, optional
+ Dict with keywords passed to the `~matplotlib.gridspec.GridSpec`
+ constructor used to create the grid the subplots are placed on.
+
+ **fig_kw
+ All additional keyword arguments are passed to the
+ `.pyplot.figure` call.
+
+ Returns
+ -------
+ fig : `~.figure.Figure`
+
+ ax : `.axes.Axes` or array of Axes
+ *ax* can be either a single `~matplotlib.axes.Axes` object or an
+ array of Axes objects if more than one subplot was created. The
+ dimensions of the resulting array can be controlled with the squeeze
+ keyword, see above.
+
+ Typical idioms for handling the return value are::
+
+ # using the variable ax for single a Axes
+ fig, ax = plt.subplots()
+
+ # using the variable axs for multiple Axes
+ fig, axs = plt.subplots(2, 2)
+
+ # using tuple unpacking for multiple Axes
+ fig, (ax1, ax2) = plt.subplots(1, 2)
+ fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2)
+
+ The names ``ax`` and pluralized ``axs`` are preferred over ``axes``
+ because for the latter it's not clear if it refers to a single
+ `~.axes.Axes` instance or a collection of these.
+
+ See Also
+ --------
+ .pyplot.figure
+ .pyplot.subplot
+ .pyplot.axes
+ .Figure.subplots
+ .Figure.add_subplot
+
+ Examples
+ --------
+ ::
+
+ # First create some toy data:
+ x = np.linspace(0, 2*np.pi, 400)
+ y = np.sin(x**2)
+
+ # Create just a figure and only one subplot
+ fig, ax = plt.subplots()
+ ax.plot(x, y)
+ ax.set_title('Simple plot')
+
+ # Create two subplots and unpack the output array immediately
+ f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
+ ax1.plot(x, y)
+ ax1.set_title('Sharing Y axis')
+ ax2.scatter(x, y)
+
+ # Create four polar axes and access them through the returned array
+ fig, axs = plt.subplots(2, 2, subplot_kw=dict(projection="polar"))
+ axs[0, 0].plot(x, y)
+ axs[1, 1].scatter(x, y)
+
+ # Share a X axis with each column of subplots
+ plt.subplots(2, 2, sharex='col')
+
+ # Share a Y axis with each row of subplots
+ plt.subplots(2, 2, sharey='row')
+
+ # Share both X and Y axes with all subplots
+ plt.subplots(2, 2, sharex='all', sharey='all')
+
+ # Note that this is the same as
+ plt.subplots(2, 2, sharex=True, sharey=True)
+
+ # Create figure number 10 with a single subplot
+ # and clears it if it already exists.
+ fig, ax = plt.subplots(num=10, clear=True)
+
+ """
+ fig = figure(**fig_kw)
+ axs = fig.subplots(nrows=nrows, ncols=ncols, sharex=sharex, sharey=sharey,
+ squeeze=squeeze, subplot_kw=subplot_kw,
+ gridspec_kw=gridspec_kw)
+ return fig, axs
+
+
+def subplot_mosaic(mosaic, *, subplot_kw=None, gridspec_kw=None,
+ empty_sentinel='.', **fig_kw):
+ """
+ Build a layout of Axes based on ASCII art or nested lists.
+
+ This is a helper function to build complex GridSpec layouts visually.
+
+ .. note ::
+
+ This API is provisional and may be revised in the future based on
+ early user feedback.
+
+
+ Parameters
+ ----------
+ mosaic : list of list of {hashable or nested} or str
+
+ A visual layout of how you want your Axes to be arranged
+ labeled as strings. For example ::
+
+ x = [['A panel', 'A panel', 'edge'],
+ ['C panel', '.', 'edge']]
+
+ Produces 4 axes:
+
+ - 'A panel' which is 1 row high and spans the first two columns
+ - 'edge' which is 2 rows high and is on the right edge
+ - 'C panel' which in 1 row and 1 column wide in the bottom left
+ - a blank space 1 row and 1 column wide in the bottom center
+
+ Any of the entries in the layout can be a list of lists
+ of the same form to create nested layouts.
+
+ If input is a str, then it must be of the form ::
+
+ '''
+ AAE
+ C.E
+ '''
+
+ where each character is a column and each line is a row.
+ This only allows only single character Axes labels and does
+ not allow nesting but is very terse.
+
+ subplot_kw : dict, optional
+ Dictionary with keywords passed to the `.Figure.add_subplot` call
+ used to create each subplot.
+
+ gridspec_kw : dict, optional
+ Dictionary with keywords passed to the `.GridSpec` constructor used
+ to create the grid the subplots are placed on.
+
+ empty_sentinel : object, optional
+ Entry in the layout to mean "leave this space empty". Defaults
+ to ``'.'``. Note, if *layout* is a string, it is processed via
+ `inspect.cleandoc` to remove leading white space, which may
+ interfere with using white-space as the empty sentinel.
+
+ **fig_kw
+ All additional keyword arguments are passed to the
+ `.pyplot.figure` call.
+
+ Returns
+ -------
+ fig : `~.figure.Figure`
+ The new figure
+
+ dict[label, Axes]
+ A dictionary mapping the labels to the Axes objects. The order of
+ the axes is left-to-right and top-to-bottom of their position in the
+ total layout.
+
+ """
+ fig = figure(**fig_kw)
+ ax_dict = fig.subplot_mosaic(
+ mosaic,
+ subplot_kw=subplot_kw,
+ gridspec_kw=gridspec_kw,
+ empty_sentinel=empty_sentinel
+ )
+ return fig, ax_dict
+
+
+def subplot2grid(shape, loc, rowspan=1, colspan=1, fig=None, **kwargs):
+ """
+ Create a subplot at a specific location inside a regular grid.
+
+ Parameters
+ ----------
+ shape : (int, int)
+ Number of rows and of columns of the grid in which to place axis.
+ loc : (int, int)
+ Row number and column number of the axis location within the grid.
+ rowspan : int, default: 1
+ Number of rows for the axis to span downwards.
+ colspan : int, default: 1
+ Number of columns for the axis to span to the right.
+ fig : `.Figure`, optional
+ Figure to place the subplot in. Defaults to the current figure.
+ **kwargs
+ Additional keyword arguments are handed to `~.Figure.add_subplot`.
+
+ Returns
+ -------
+ `.axes.SubplotBase`, or another subclass of `~.axes.Axes`
+
+ The axes of the subplot. The returned axes base class depends on the
+ projection used. It is `~.axes.Axes` if rectilinear projection is used
+ and `.projections.polar.PolarAxes` if polar projection is used. The
+ returned axes is then a subplot subclass of the base class.
+
+ Notes
+ -----
+ The following call ::
+
+ ax = subplot2grid((nrows, ncols), (row, col), rowspan, colspan)
+
+ is identical to ::
+
+ fig = gcf()
+ gs = fig.add_gridspec(nrows, ncols)
+ ax = fig.add_subplot(gs[row:row+rowspan, col:col+colspan])
+ """
+
+ if fig is None:
+ fig = gcf()
+
+ rows, cols = shape
+ gs = GridSpec._check_gridspec_exists(fig, rows, cols)
+
+ subplotspec = gs.new_subplotspec(loc, rowspan=rowspan, colspan=colspan)
+ ax = fig.add_subplot(subplotspec, **kwargs)
+ bbox = ax.bbox
+ axes_to_delete = []
+ for other_ax in fig.axes:
+ if other_ax == ax:
+ continue
+ if bbox.fully_overlaps(other_ax.bbox):
+ axes_to_delete.append(other_ax)
+ for ax_to_del in axes_to_delete:
+ delaxes(ax_to_del)
+
+ return ax
+
+
+def twinx(ax=None):
+ """
+ Make and return a second axes that shares the *x*-axis. The new axes will
+ overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be
+ on the right.
+
+ Examples
+ --------
+ :doc:`/gallery/subplots_axes_and_figures/two_scales`
+ """
+ if ax is None:
+ ax = gca()
+ ax1 = ax.twinx()
+ return ax1
+
+
+def twiny(ax=None):
+ """
+ Make and return a second axes that shares the *y*-axis. The new axes will
+ overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be
+ on the top.
+
+ Examples
+ --------
+ :doc:`/gallery/subplots_axes_and_figures/two_scales`
+ """
+ if ax is None:
+ ax = gca()
+ ax1 = ax.twiny()
+ return ax1
+
+
+def subplot_tool(targetfig=None):
+ """
+ Launch a subplot tool window for a figure.
+
+ A `matplotlib.widgets.SubplotTool` instance is returned. You must maintain
+ a reference to the instance to keep the associated callbacks alive.
+ """
+ if targetfig is None:
+ targetfig = gcf()
+ with rc_context({"toolbar": "none"}): # No navbar for the toolfig.
+ # Use new_figure_manager() instead of figure() so that the figure
+ # doesn't get registered with pyplot.
+ manager = new_figure_manager(-1, (6, 3))
+ manager.set_window_title("Subplot configuration tool")
+ tool_fig = manager.canvas.figure
+ tool_fig.subplots_adjust(top=0.9)
+ manager.show()
+ return SubplotTool(targetfig, tool_fig)
+
+
+# After deprecation elapses, this can be autogenerated by boilerplate.py.
+@_api.make_keyword_only("3.3", "pad")
+def tight_layout(pad=1.08, h_pad=None, w_pad=None, rect=None):
+ """
+ Adjust the padding between and around subplots.
+
+ Parameters
+ ----------
+ pad : float, default: 1.08
+ Padding between the figure edge and the edges of subplots,
+ as a fraction of the font size.
+ h_pad, w_pad : float, default: *pad*
+ Padding (height/width) between edges of adjacent subplots,
+ as a fraction of the font size.
+ rect : tuple (left, bottom, right, top), default: (0, 0, 1, 1)
+ A rectangle in normalized figure coordinates into which the whole
+ subplots area (including labels) will fit.
+ """
+ gcf().tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
+
+
+def box(on=None):
+ """
+ Turn the axes box on or off on the current axes.
+
+ Parameters
+ ----------
+ on : bool or None
+ The new `~matplotlib.axes.Axes` box state. If ``None``, toggle
+ the state.
+
+ See Also
+ --------
+ :meth:`matplotlib.axes.Axes.set_frame_on`
+ :meth:`matplotlib.axes.Axes.get_frame_on`
+ """
+ ax = gca()
+ if on is None:
+ on = not ax.get_frame_on()
+ ax.set_frame_on(on)
+
+## Axis ##
+
+
+def xlim(*args, **kwargs):
+ """
+ Get or set the x limits of the current axes.
+
+ Call signatures::
+
+ left, right = xlim() # return the current xlim
+ xlim((left, right)) # set the xlim to left, right
+ xlim(left, right) # set the xlim to left, right
+
+ If you do not specify args, you can pass *left* or *right* as kwargs,
+ i.e.::
+
+ xlim(right=3) # adjust the right leaving left unchanged
+ xlim(left=1) # adjust the left leaving right unchanged
+
+ Setting limits turns autoscaling off for the x-axis.
+
+ Returns
+ -------
+ left, right
+ A tuple of the new x-axis limits.
+
+ Notes
+ -----
+ Calling this function with no arguments (e.g. ``xlim()``) is the pyplot
+ equivalent of calling `~.Axes.get_xlim` on the current axes.
+ Calling this function with arguments is the pyplot equivalent of calling
+ `~.Axes.set_xlim` on the current axes. All arguments are passed though.
+ """
+ ax = gca()
+ if not args and not kwargs:
+ return ax.get_xlim()
+ ret = ax.set_xlim(*args, **kwargs)
+ return ret
+
+
+def ylim(*args, **kwargs):
+ """
+ Get or set the y-limits of the current axes.
+
+ Call signatures::
+
+ bottom, top = ylim() # return the current ylim
+ ylim((bottom, top)) # set the ylim to bottom, top
+ ylim(bottom, top) # set the ylim to bottom, top
+
+ If you do not specify args, you can alternatively pass *bottom* or
+ *top* as kwargs, i.e.::
+
+ ylim(top=3) # adjust the top leaving bottom unchanged
+ ylim(bottom=1) # adjust the bottom leaving top unchanged
+
+ Setting limits turns autoscaling off for the y-axis.
+
+ Returns
+ -------
+ bottom, top
+ A tuple of the new y-axis limits.
+
+ Notes
+ -----
+ Calling this function with no arguments (e.g. ``ylim()``) is the pyplot
+ equivalent of calling `~.Axes.get_ylim` on the current axes.
+ Calling this function with arguments is the pyplot equivalent of calling
+ `~.Axes.set_ylim` on the current axes. All arguments are passed though.
+ """
+ ax = gca()
+ if not args and not kwargs:
+ return ax.get_ylim()
+ ret = ax.set_ylim(*args, **kwargs)
+ return ret
+
+
+def xticks(ticks=None, labels=None, **kwargs):
+ """
+ Get or set the current tick locations and labels of the x-axis.
+
+ Pass no arguments to return the current values without modifying them.
+
+ Parameters
+ ----------
+ ticks : array-like, optional
+ The list of xtick locations. Passing an empty list removes all xticks.
+ labels : array-like, optional
+ The labels to place at the given *ticks* locations. This argument can
+ only be passed if *ticks* is passed as well.
+ **kwargs
+ `.Text` properties can be used to control the appearance of the labels.
+
+ Returns
+ -------
+ locs
+ The list of xtick locations.
+ labels
+ The list of xlabel `.Text` objects.
+
+ Notes
+ -----
+ Calling this function with no arguments (e.g. ``xticks()``) is the pyplot
+ equivalent of calling `~.Axes.get_xticks` and `~.Axes.get_xticklabels` on
+ the current axes.
+ Calling this function with arguments is the pyplot equivalent of calling
+ `~.Axes.set_xticks` and `~.Axes.set_xticklabels` on the current axes.
+
+ Examples
+ --------
+ >>> locs, labels = xticks() # Get the current locations and labels.
+ >>> xticks(np.arange(0, 1, step=0.2)) # Set label locations.
+ >>> xticks(np.arange(3), ['Tom', 'Dick', 'Sue']) # Set text labels.
+ >>> xticks([0, 1, 2], ['January', 'February', 'March'],
+ ... rotation=20) # Set text labels and properties.
+ >>> xticks([]) # Disable xticks.
+ """
+ ax = gca()
+
+ if ticks is None:
+ locs = ax.get_xticks()
+ if labels is not None:
+ raise TypeError("xticks(): Parameter 'labels' can't be set "
+ "without setting 'ticks'")
+ else:
+ locs = ax.set_xticks(ticks)
+
+ if labels is None:
+ labels = ax.get_xticklabels()
+ else:
+ labels = ax.set_xticklabels(labels, **kwargs)
+ for l in labels:
+ l.update(kwargs)
+
+ return locs, labels
+
+
+def yticks(ticks=None, labels=None, **kwargs):
+ """
+ Get or set the current tick locations and labels of the y-axis.
+
+ Pass no arguments to return the current values without modifying them.
+
+ Parameters
+ ----------
+ ticks : array-like, optional
+ The list of ytick locations. Passing an empty list removes all yticks.
+ labels : array-like, optional
+ The labels to place at the given *ticks* locations. This argument can
+ only be passed if *ticks* is passed as well.
+ **kwargs
+ `.Text` properties can be used to control the appearance of the labels.
+
+ Returns
+ -------
+ locs
+ The list of ytick locations.
+ labels
+ The list of ylabel `.Text` objects.
+
+ Notes
+ -----
+ Calling this function with no arguments (e.g. ``yticks()``) is the pyplot
+ equivalent of calling `~.Axes.get_yticks` and `~.Axes.get_yticklabels` on
+ the current axes.
+ Calling this function with arguments is the pyplot equivalent of calling
+ `~.Axes.set_yticks` and `~.Axes.set_yticklabels` on the current axes.
+
+ Examples
+ --------
+ >>> locs, labels = yticks() # Get the current locations and labels.
+ >>> yticks(np.arange(0, 1, step=0.2)) # Set label locations.
+ >>> yticks(np.arange(3), ['Tom', 'Dick', 'Sue']) # Set text labels.
+ >>> yticks([0, 1, 2], ['January', 'February', 'March'],
+ ... rotation=45) # Set text labels and properties.
+ >>> yticks([]) # Disable yticks.
+ """
+ ax = gca()
+
+ if ticks is None:
+ locs = ax.get_yticks()
+ if labels is not None:
+ raise TypeError("yticks(): Parameter 'labels' can't be set "
+ "without setting 'ticks'")
+ else:
+ locs = ax.set_yticks(ticks)
+
+ if labels is None:
+ labels = ax.get_yticklabels()
+ else:
+ labels = ax.set_yticklabels(labels, **kwargs)
+ for l in labels:
+ l.update(kwargs)
+
+ return locs, labels
+
+
+def rgrids(radii=None, labels=None, angle=None, fmt=None, **kwargs):
+ """
+ Get or set the radial gridlines on the current polar plot.
+
+ Call signatures::
+
+ lines, labels = rgrids()
+ lines, labels = rgrids(radii, labels=None, angle=22.5, fmt=None, **kwargs)
+
+ When called with no arguments, `.rgrids` simply returns the tuple
+ (*lines*, *labels*). When called with arguments, the labels will
+ appear at the specified radial distances and angle.
+
+ Parameters
+ ----------
+ radii : tuple with floats
+ The radii for the radial gridlines
+
+ labels : tuple with strings or None
+ The labels to use at each radial gridline. The
+ `matplotlib.ticker.ScalarFormatter` will be used if None.
+
+ angle : float
+ The angular position of the radius labels in degrees.
+
+ fmt : str or None
+ Format string used in `matplotlib.ticker.FormatStrFormatter`.
+ For example '%f'.
+
+ Returns
+ -------
+ lines : list of `.lines.Line2D`
+ The radial gridlines.
+
+ labels : list of `.text.Text`
+ The tick labels.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ *kwargs* are optional `~.Text` properties for the labels.
+
+ See Also
+ --------
+ .pyplot.thetagrids
+ .projections.polar.PolarAxes.set_rgrids
+ .Axis.get_gridlines
+ .Axis.get_ticklabels
+
+ Examples
+ --------
+ ::
+
+ # set the locations of the radial gridlines
+ lines, labels = rgrids( (0.25, 0.5, 1.0) )
+
+ # set the locations and labels of the radial gridlines
+ lines, labels = rgrids( (0.25, 0.5, 1.0), ('Tom', 'Dick', 'Harry' ))
+ """
+ ax = gca()
+ if not isinstance(ax, PolarAxes):
+ raise RuntimeError('rgrids only defined for polar axes')
+ if all(p is None for p in [radii, labels, angle, fmt]) and not kwargs:
+ lines = ax.yaxis.get_gridlines()
+ labels = ax.yaxis.get_ticklabels()
+ else:
+ lines, labels = ax.set_rgrids(
+ radii, labels=labels, angle=angle, fmt=fmt, **kwargs)
+ return lines, labels
+
+
+def thetagrids(angles=None, labels=None, fmt=None, **kwargs):
+ """
+ Get or set the theta gridlines on the current polar plot.
+
+ Call signatures::
+
+ lines, labels = thetagrids()
+ lines, labels = thetagrids(angles, labels=None, fmt=None, **kwargs)
+
+ When called with no arguments, `.thetagrids` simply returns the tuple
+ (*lines*, *labels*). When called with arguments, the labels will
+ appear at the specified angles.
+
+ Parameters
+ ----------
+ angles : tuple with floats, degrees
+ The angles of the theta gridlines.
+
+ labels : tuple with strings or None
+ The labels to use at each radial gridline. The
+ `.projections.polar.ThetaFormatter` will be used if None.
+
+ fmt : str or None
+ Format string used in `matplotlib.ticker.FormatStrFormatter`.
+ For example '%f'. Note that the angle in radians will be used.
+
+ Returns
+ -------
+ lines : list of `.lines.Line2D`
+ The theta gridlines.
+
+ labels : list of `.text.Text`
+ The tick labels.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ *kwargs* are optional `~.Text` properties for the labels.
+
+ See Also
+ --------
+ .pyplot.rgrids
+ .projections.polar.PolarAxes.set_thetagrids
+ .Axis.get_gridlines
+ .Axis.get_ticklabels
+
+ Examples
+ --------
+ ::
+
+ # set the locations of the angular gridlines
+ lines, labels = thetagrids(range(45, 360, 90))
+
+ # set the locations and labels of the angular gridlines
+ lines, labels = thetagrids(range(45, 360, 90), ('NE', 'NW', 'SW', 'SE'))
+ """
+ ax = gca()
+ if not isinstance(ax, PolarAxes):
+ raise RuntimeError('thetagrids only defined for polar axes')
+ if all(param is None for param in [angles, labels, fmt]) and not kwargs:
+ lines = ax.xaxis.get_ticklines()
+ labels = ax.xaxis.get_ticklabels()
+ else:
+ lines, labels = ax.set_thetagrids(angles,
+ labels=labels, fmt=fmt, **kwargs)
+ return lines, labels
+
+
+## Plotting Info ##
+
+
+def plotting():
+ pass
+
+
+def get_plot_commands():
+ """
+ Get a sorted list of all of the plotting commands.
+ """
+ # This works by searching for all functions in this module and removing
+ # a few hard-coded exclusions, as well as all of the colormap-setting
+ # functions, and anything marked as private with a preceding underscore.
+ exclude = {'colormaps', 'colors', 'connect', 'disconnect',
+ 'get_plot_commands', 'get_current_fig_manager', 'ginput',
+ 'plotting', 'waitforbuttonpress'}
+ exclude |= set(colormaps())
+ this_module = inspect.getmodule(get_plot_commands)
+ return sorted(
+ name for name, obj in globals().items()
+ if not name.startswith('_') and name not in exclude
+ and inspect.isfunction(obj)
+ and inspect.getmodule(obj) is this_module)
+
+
+def colormaps():
+ """
+ Matplotlib provides a number of colormaps, and others can be added using
+ :func:`~matplotlib.cm.register_cmap`. This function documents the built-in
+ colormaps, and will also return a list of all registered colormaps if
+ called.
+
+ You can set the colormap for an image, pcolor, scatter, etc,
+ using a keyword argument::
+
+ imshow(X, cmap=cm.hot)
+
+ or using the :func:`set_cmap` function::
+
+ imshow(X)
+ pyplot.set_cmap('hot')
+ pyplot.set_cmap('jet')
+
+ In interactive mode, :func:`set_cmap` will update the colormap post-hoc,
+ allowing you to see which one works best for your data.
+
+ All built-in colormaps can be reversed by appending ``_r``: For instance,
+ ``gray_r`` is the reverse of ``gray``.
+
+ There are several common color schemes used in visualization:
+
+ Sequential schemes
+ for unipolar data that progresses from low to high
+ Diverging schemes
+ for bipolar data that emphasizes positive or negative deviations from a
+ central value
+ Cyclic schemes
+ for plotting values that wrap around at the endpoints, such as phase
+ angle, wind direction, or time of day
+ Qualitative schemes
+ for nominal data that has no inherent ordering, where color is used
+ only to distinguish categories
+
+ Matplotlib ships with 4 perceptually uniform colormaps which are
+ the recommended colormaps for sequential data:
+
+ ========= ===================================================
+ Colormap Description
+ ========= ===================================================
+ inferno perceptually uniform shades of black-red-yellow
+ magma perceptually uniform shades of black-red-white
+ plasma perceptually uniform shades of blue-red-yellow
+ viridis perceptually uniform shades of blue-green-yellow
+ ========= ===================================================
+
+ The following colormaps are based on the `ColorBrewer
+ `_ color specifications and designs developed by
+ Cynthia Brewer:
+
+ ColorBrewer Diverging (luminance is highest at the midpoint, and
+ decreases towards differently-colored endpoints):
+
+ ======== ===================================
+ Colormap Description
+ ======== ===================================
+ BrBG brown, white, blue-green
+ PiYG pink, white, yellow-green
+ PRGn purple, white, green
+ PuOr orange, white, purple
+ RdBu red, white, blue
+ RdGy red, white, gray
+ RdYlBu red, yellow, blue
+ RdYlGn red, yellow, green
+ Spectral red, orange, yellow, green, blue
+ ======== ===================================
+
+ ColorBrewer Sequential (luminance decreases monotonically):
+
+ ======== ====================================
+ Colormap Description
+ ======== ====================================
+ Blues white to dark blue
+ BuGn white, light blue, dark green
+ BuPu white, light blue, dark purple
+ GnBu white, light green, dark blue
+ Greens white to dark green
+ Greys white to black (not linear)
+ Oranges white, orange, dark brown
+ OrRd white, orange, dark red
+ PuBu white, light purple, dark blue
+ PuBuGn white, light purple, dark green
+ PuRd white, light purple, dark red
+ Purples white to dark purple
+ RdPu white, pink, dark purple
+ Reds white to dark red
+ YlGn light yellow, dark green
+ YlGnBu light yellow, light green, dark blue
+ YlOrBr light yellow, orange, dark brown
+ YlOrRd light yellow, orange, dark red
+ ======== ====================================
+
+ ColorBrewer Qualitative:
+
+ (For plotting nominal data, `.ListedColormap` is used,
+ not `.LinearSegmentedColormap`. Different sets of colors are
+ recommended for different numbers of categories.)
+
+ * Accent
+ * Dark2
+ * Paired
+ * Pastel1
+ * Pastel2
+ * Set1
+ * Set2
+ * Set3
+
+ A set of colormaps derived from those of the same name provided
+ with Matlab are also included:
+
+ ========= =======================================================
+ Colormap Description
+ ========= =======================================================
+ autumn sequential linearly-increasing shades of red-orange-yellow
+ bone sequential increasing black-white colormap with
+ a tinge of blue, to emulate X-ray film
+ cool linearly-decreasing shades of cyan-magenta
+ copper sequential increasing shades of black-copper
+ flag repetitive red-white-blue-black pattern (not cyclic at
+ endpoints)
+ gray sequential linearly-increasing black-to-white
+ grayscale
+ hot sequential black-red-yellow-white, to emulate blackbody
+ radiation from an object at increasing temperatures
+ jet a spectral map with dark endpoints, blue-cyan-yellow-red;
+ based on a fluid-jet simulation by NCSA [#]_
+ pink sequential increasing pastel black-pink-white, meant
+ for sepia tone colorization of photographs
+ prism repetitive red-yellow-green-blue-purple-...-green pattern
+ (not cyclic at endpoints)
+ spring linearly-increasing shades of magenta-yellow
+ summer sequential linearly-increasing shades of green-yellow
+ winter linearly-increasing shades of blue-green
+ ========= =======================================================
+
+ A set of palettes from the `Yorick scientific visualisation
+ package `_, an evolution of
+ the GIST package, both by David H. Munro are included:
+
+ ============ =======================================================
+ Colormap Description
+ ============ =======================================================
+ gist_earth mapmaker's colors from dark blue deep ocean to green
+ lowlands to brown highlands to white mountains
+ gist_heat sequential increasing black-red-orange-white, to emulate
+ blackbody radiation from an iron bar as it grows hotter
+ gist_ncar pseudo-spectral black-blue-green-yellow-red-purple-white
+ colormap from National Center for Atmospheric
+ Research [#]_
+ gist_rainbow runs through the colors in spectral order from red to
+ violet at full saturation (like *hsv* but not cyclic)
+ gist_stern "Stern special" color table from Interactive Data
+ Language software
+ ============ =======================================================
+
+ A set of cyclic colormaps:
+
+ ================ =================================================
+ Colormap Description
+ ================ =================================================
+ hsv red-yellow-green-cyan-blue-magenta-red, formed by
+ changing the hue component in the HSV color space
+ twilight perceptually uniform shades of
+ white-blue-black-red-white
+ twilight_shifted perceptually uniform shades of
+ black-blue-white-red-black
+ ================ =================================================
+
+ Other miscellaneous schemes:
+
+ ============= =======================================================
+ Colormap Description
+ ============= =======================================================
+ afmhot sequential black-orange-yellow-white blackbody
+ spectrum, commonly used in atomic force microscopy
+ brg blue-red-green
+ bwr diverging blue-white-red
+ coolwarm diverging blue-gray-red, meant to avoid issues with 3D
+ shading, color blindness, and ordering of colors [#]_
+ CMRmap "Default colormaps on color images often reproduce to
+ confusing grayscale images. The proposed colormap
+ maintains an aesthetically pleasing color image that
+ automatically reproduces to a monotonic grayscale with
+ discrete, quantifiable saturation levels." [#]_
+ cubehelix Unlike most other color schemes cubehelix was designed
+ by D.A. Green to be monotonically increasing in terms
+ of perceived brightness. Also, when printed on a black
+ and white postscript printer, the scheme results in a
+ greyscale with monotonically increasing brightness.
+ This color scheme is named cubehelix because the (r, g, b)
+ values produced can be visualised as a squashed helix
+ around the diagonal in the (r, g, b) color cube.
+ gnuplot gnuplot's traditional pm3d scheme
+ (black-blue-red-yellow)
+ gnuplot2 sequential color printable as gray
+ (black-blue-violet-yellow-white)
+ ocean green-blue-white
+ rainbow spectral purple-blue-green-yellow-orange-red colormap
+ with diverging luminance
+ seismic diverging blue-white-red
+ nipy_spectral black-purple-blue-green-yellow-red-white spectrum,
+ originally from the Neuroimaging in Python project
+ terrain mapmaker's colors, blue-green-yellow-brown-white,
+ originally from IGOR Pro
+ turbo Spectral map (purple-blue-green-yellow-orange-red) with
+ a bright center and darker endpoints. A smoother
+ alternative to jet.
+ ============= =======================================================
+
+ The following colormaps are redundant and may be removed in future
+ versions. It's recommended to use the names in the descriptions
+ instead, which produce identical output:
+
+ ========= =======================================================
+ Colormap Description
+ ========= =======================================================
+ gist_gray identical to *gray*
+ gist_yarg identical to *gray_r*
+ binary identical to *gray_r*
+ ========= =======================================================
+
+ .. rubric:: Footnotes
+
+ .. [#] Rainbow colormaps, ``jet`` in particular, are considered a poor
+ choice for scientific visualization by many researchers: `Rainbow Color
+ Map (Still) Considered Harmful
+ `_
+
+ .. [#] Resembles "BkBlAqGrYeOrReViWh200" from NCAR Command
+ Language. See `Color Table Gallery
+ `_
+
+ .. [#] See `Diverging Color Maps for Scientific Visualization
+ `_ by Kenneth Moreland.
+
+ .. [#] See `A Color Map for Effective Black-and-White Rendering of
+ Color-Scale Images
+ `_
+ by Carey Rappaport
+ """
+ return sorted(cm._cmap_registry)
+
+
+def _setup_pyplot_info_docstrings():
+ """
+ Setup the docstring of `plotting` and of the colormap-setting functions.
+
+ These must be done after the entire module is imported, so it is called
+ from the end of this module, which is generated by boilerplate.py.
+ """
+ commands = get_plot_commands()
+
+ first_sentence = re.compile(r"(?:\s*).+?\.(?:\s+|$)", flags=re.DOTALL)
+
+ # Collect the first sentence of the docstring for all of the
+ # plotting commands.
+ rows = []
+ max_name = len("Function")
+ max_summary = len("Description")
+ for name in commands:
+ doc = globals()[name].__doc__
+ summary = ''
+ if doc is not None:
+ match = first_sentence.match(doc)
+ if match is not None:
+ summary = inspect.cleandoc(match.group(0)).replace('\n', ' ')
+ name = '`%s`' % name
+ rows.append([name, summary])
+ max_name = max(max_name, len(name))
+ max_summary = max(max_summary, len(summary))
+
+ separator = '=' * max_name + ' ' + '=' * max_summary
+ lines = [
+ separator,
+ '{:{}} {:{}}'.format('Function', max_name, 'Description', max_summary),
+ separator,
+ ] + [
+ '{:{}} {:{}}'.format(name, max_name, summary, max_summary)
+ for name, summary in rows
+ ] + [
+ separator,
+ ]
+ plotting.__doc__ = '\n'.join(lines)
+
+ for cm_name in colormaps():
+ if cm_name in globals():
+ globals()[cm_name].__doc__ = f"""
+ Set the colormap to {cm_name!r}.
+
+ This changes the default colormap as well as the colormap of the current
+ image if there is one. See ``help(colormaps)`` for more information.
+ """
+
+
+## Plotting part 1: manually generated functions and wrappers ##
+
+
+@_copy_docstring_and_deprecators(Figure.colorbar)
+def colorbar(mappable=None, cax=None, ax=None, **kw):
+ if mappable is None:
+ mappable = gci()
+ if mappable is None:
+ raise RuntimeError('No mappable was found to use for colorbar '
+ 'creation. First define a mappable such as '
+ 'an image (with imshow) or a contour set ('
+ 'with contourf).')
+ ret = gcf().colorbar(mappable, cax=cax, ax=ax, **kw)
+ return ret
+
+
+def clim(vmin=None, vmax=None):
+ """
+ Set the color limits of the current image.
+
+ If either *vmin* or *vmax* is None, the image min/max respectively
+ will be used for color scaling.
+
+ If you want to set the clim of multiple images, use
+ `~.ScalarMappable.set_clim` on every image, for example::
+
+ for im in gca().get_images():
+ im.set_clim(0, 0.5)
+
+ """
+ im = gci()
+ if im is None:
+ raise RuntimeError('You must first define an image, e.g., with imshow')
+
+ im.set_clim(vmin, vmax)
+
+
+def set_cmap(cmap):
+ """
+ Set the default colormap, and applies it to the current image if any.
+
+ Parameters
+ ----------
+ cmap : `~matplotlib.colors.Colormap` or str
+ A colormap instance or the name of a registered colormap.
+
+ See Also
+ --------
+ colormaps
+ matplotlib.cm.register_cmap
+ matplotlib.cm.get_cmap
+ """
+ cmap = cm.get_cmap(cmap)
+
+ rc('image', cmap=cmap.name)
+ im = gci()
+
+ if im is not None:
+ im.set_cmap(cmap)
+
+
+@_copy_docstring_and_deprecators(matplotlib.image.imread)
+def imread(fname, format=None):
+ return matplotlib.image.imread(fname, format)
+
+
+@_copy_docstring_and_deprecators(matplotlib.image.imsave)
+def imsave(fname, arr, **kwargs):
+ return matplotlib.image.imsave(fname, arr, **kwargs)
+
+
+def matshow(A, fignum=None, **kwargs):
+ """
+ Display an array as a matrix in a new figure window.
+
+ The origin is set at the upper left hand corner and rows (first
+ dimension of the array) are displayed horizontally. The aspect
+ ratio of the figure window is that of the array, unless this would
+ make an excessively short or narrow figure.
+
+ Tick labels for the xaxis are placed on top.
+
+ Parameters
+ ----------
+ A : 2D array-like
+ The matrix to be displayed.
+
+ fignum : None or int or False
+ If *None*, create a new figure window with automatic numbering.
+
+ If a nonzero integer, draw into the figure with the given number
+ (create it if it does not exist).
+
+ If 0, use the current axes (or create one if it does not exist).
+
+ .. note::
+
+ Because of how `.Axes.matshow` tries to set the figure aspect
+ ratio to be the one of the array, strange things may happen if you
+ reuse an existing figure.
+
+ Returns
+ -------
+ `~matplotlib.image.AxesImage`
+
+ Other Parameters
+ ----------------
+ **kwargs : `~matplotlib.axes.Axes.imshow` arguments
+
+ """
+ A = np.asanyarray(A)
+ if fignum == 0:
+ ax = gca()
+ else:
+ # Extract actual aspect ratio of array and make appropriately sized
+ # figure.
+ fig = figure(fignum, figsize=figaspect(A))
+ ax = fig.add_axes([0.15, 0.09, 0.775, 0.775])
+ im = ax.matshow(A, **kwargs)
+ sci(im)
+ return im
+
+
+def polar(*args, **kwargs):
+ """
+ Make a polar plot.
+
+ call signature::
+
+ polar(theta, r, **kwargs)
+
+ Multiple *theta*, *r* arguments are supported, with format strings, as in
+ `plot`.
+ """
+ # If an axis already exists, check if it has a polar projection
+ if gcf().get_axes():
+ ax = gca()
+ if isinstance(ax, PolarAxes):
+ return ax
+ else:
+ _api.warn_external('Trying to create polar plot on an Axes '
+ 'that does not have a polar projection.')
+ ax = axes(projection="polar")
+ ret = ax.plot(*args, **kwargs)
+ return ret
+
+
+# If rcParams['backend_fallback'] is true, and an interactive backend is
+# requested, ignore rcParams['backend'] and force selection of a backend that
+# is compatible with the current running interactive framework.
+if (rcParams["backend_fallback"]
+ and dict.__getitem__(rcParams, "backend") in (
+ set(_interactive_bk) - {'WebAgg', 'nbAgg'})
+ and cbook._get_running_interactive_framework()):
+ dict.__setitem__(rcParams, "backend", rcsetup._auto_backend_sentinel)
+# Set up the backend.
+switch_backend(rcParams["backend"])
+
+# Just to be safe. Interactive mode can be turned on without
+# calling `plt.ion()` so register it again here.
+# This is safe because multiple calls to `install_repl_displayhook`
+# are no-ops and the registered function respect `mpl.is_interactive()`
+# to determine if they should trigger a draw.
+install_repl_displayhook()
+
+
+################# REMAINING CONTENT GENERATED BY boilerplate.py ##############
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Figure.figimage)
+def figimage(
+ X, xo=0, yo=0, alpha=None, norm=None, cmap=None, vmin=None,
+ vmax=None, origin=None, resize=False, **kwargs):
+ return gcf().figimage(
+ X, xo=xo, yo=yo, alpha=alpha, norm=norm, cmap=cmap, vmin=vmin,
+ vmax=vmax, origin=origin, resize=resize, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Figure.text)
+def figtext(x, y, s, fontdict=None, **kwargs):
+ return gcf().text(x, y, s, fontdict=fontdict, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Figure.gca)
+def gca(**kwargs):
+ return gcf().gca(**kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Figure._gci)
+def gci():
+ return gcf()._gci()
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Figure.ginput)
+def ginput(
+ n=1, timeout=30, show_clicks=True,
+ mouse_add=MouseButton.LEFT, mouse_pop=MouseButton.RIGHT,
+ mouse_stop=MouseButton.MIDDLE):
+ return gcf().ginput(
+ n=n, timeout=timeout, show_clicks=show_clicks,
+ mouse_add=mouse_add, mouse_pop=mouse_pop,
+ mouse_stop=mouse_stop)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Figure.subplots_adjust)
+def subplots_adjust(
+ left=None, bottom=None, right=None, top=None, wspace=None,
+ hspace=None):
+ return gcf().subplots_adjust(
+ left=left, bottom=bottom, right=right, top=top, wspace=wspace,
+ hspace=hspace)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Figure.suptitle)
+def suptitle(t, **kwargs):
+ return gcf().suptitle(t, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Figure.waitforbuttonpress)
+def waitforbuttonpress(timeout=-1):
+ return gcf().waitforbuttonpress(timeout=timeout)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.acorr)
+def acorr(x, *, data=None, **kwargs):
+ return gca().acorr(
+ x, **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.angle_spectrum)
+def angle_spectrum(
+ x, Fs=None, Fc=None, window=None, pad_to=None, sides=None, *,
+ data=None, **kwargs):
+ return gca().angle_spectrum(
+ x, Fs=Fs, Fc=Fc, window=window, pad_to=pad_to, sides=sides,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.annotate)
+def annotate(text, xy, *args, **kwargs):
+ return gca().annotate(text, xy, *args, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.arrow)
+def arrow(x, y, dx, dy, **kwargs):
+ return gca().arrow(x, y, dx, dy, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.autoscale)
+def autoscale(enable=True, axis='both', tight=None):
+ return gca().autoscale(enable=enable, axis=axis, tight=tight)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.axhline)
+def axhline(y=0, xmin=0, xmax=1, **kwargs):
+ return gca().axhline(y=y, xmin=xmin, xmax=xmax, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.axhspan)
+def axhspan(ymin, ymax, xmin=0, xmax=1, **kwargs):
+ return gca().axhspan(ymin, ymax, xmin=xmin, xmax=xmax, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.axis)
+def axis(*args, emit=True, **kwargs):
+ return gca().axis(*args, emit=emit, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.axline)
+def axline(xy1, xy2=None, *, slope=None, **kwargs):
+ return gca().axline(xy1, xy2=xy2, slope=slope, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.axvline)
+def axvline(x=0, ymin=0, ymax=1, **kwargs):
+ return gca().axvline(x=x, ymin=ymin, ymax=ymax, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.axvspan)
+def axvspan(xmin, xmax, ymin=0, ymax=1, **kwargs):
+ return gca().axvspan(xmin, xmax, ymin=ymin, ymax=ymax, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.bar)
+def bar(
+ x, height, width=0.8, bottom=None, *, align='center',
+ data=None, **kwargs):
+ return gca().bar(
+ x, height, width=width, bottom=bottom, align=align,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.barbs)
+def barbs(*args, data=None, **kw):
+ return gca().barbs(
+ *args, **({"data": data} if data is not None else {}), **kw)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.barh)
+def barh(y, width, height=0.8, left=None, *, align='center', **kwargs):
+ return gca().barh(
+ y, width, height=height, left=left, align=align, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.bar_label)
+def bar_label(
+ container, labels=None, *, fmt='%g', label_type='edge',
+ padding=0, **kwargs):
+ return gca().bar_label(
+ container, labels=labels, fmt=fmt, label_type=label_type,
+ padding=padding, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.boxplot)
+def boxplot(
+ x, notch=None, sym=None, vert=None, whis=None,
+ positions=None, widths=None, patch_artist=None,
+ bootstrap=None, usermedians=None, conf_intervals=None,
+ meanline=None, showmeans=None, showcaps=None, showbox=None,
+ showfliers=None, boxprops=None, labels=None, flierprops=None,
+ medianprops=None, meanprops=None, capprops=None,
+ whiskerprops=None, manage_ticks=True, autorange=False,
+ zorder=None, *, data=None):
+ return gca().boxplot(
+ x, notch=notch, sym=sym, vert=vert, whis=whis,
+ positions=positions, widths=widths, patch_artist=patch_artist,
+ bootstrap=bootstrap, usermedians=usermedians,
+ conf_intervals=conf_intervals, meanline=meanline,
+ showmeans=showmeans, showcaps=showcaps, showbox=showbox,
+ showfliers=showfliers, boxprops=boxprops, labels=labels,
+ flierprops=flierprops, medianprops=medianprops,
+ meanprops=meanprops, capprops=capprops,
+ whiskerprops=whiskerprops, manage_ticks=manage_ticks,
+ autorange=autorange, zorder=zorder,
+ **({"data": data} if data is not None else {}))
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.broken_barh)
+def broken_barh(xranges, yrange, *, data=None, **kwargs):
+ return gca().broken_barh(
+ xranges, yrange,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.clabel)
+def clabel(CS, levels=None, **kwargs):
+ return gca().clabel(CS, levels=levels, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.cohere)
+def cohere(
+ x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
+ window=mlab.window_hanning, noverlap=0, pad_to=None,
+ sides='default', scale_by_freq=None, *, data=None, **kwargs):
+ return gca().cohere(
+ x, y, NFFT=NFFT, Fs=Fs, Fc=Fc, detrend=detrend, window=window,
+ noverlap=noverlap, pad_to=pad_to, sides=sides,
+ scale_by_freq=scale_by_freq,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.contour)
+def contour(*args, data=None, **kwargs):
+ __ret = gca().contour(
+ *args, **({"data": data} if data is not None else {}),
+ **kwargs)
+ if __ret._A is not None: sci(__ret) # noqa
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.contourf)
+def contourf(*args, data=None, **kwargs):
+ __ret = gca().contourf(
+ *args, **({"data": data} if data is not None else {}),
+ **kwargs)
+ if __ret._A is not None: sci(__ret) # noqa
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.csd)
+def csd(
+ x, y, NFFT=None, Fs=None, Fc=None, detrend=None, window=None,
+ noverlap=None, pad_to=None, sides=None, scale_by_freq=None,
+ return_line=None, *, data=None, **kwargs):
+ return gca().csd(
+ x, y, NFFT=NFFT, Fs=Fs, Fc=Fc, detrend=detrend, window=window,
+ noverlap=noverlap, pad_to=pad_to, sides=sides,
+ scale_by_freq=scale_by_freq, return_line=return_line,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.errorbar)
+def errorbar(
+ x, y, yerr=None, xerr=None, fmt='', ecolor=None,
+ elinewidth=None, capsize=None, barsabove=False, lolims=False,
+ uplims=False, xlolims=False, xuplims=False, errorevery=1,
+ capthick=None, *, data=None, **kwargs):
+ return gca().errorbar(
+ x, y, yerr=yerr, xerr=xerr, fmt=fmt, ecolor=ecolor,
+ elinewidth=elinewidth, capsize=capsize, barsabove=barsabove,
+ lolims=lolims, uplims=uplims, xlolims=xlolims,
+ xuplims=xuplims, errorevery=errorevery, capthick=capthick,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.eventplot)
+def eventplot(
+ positions, orientation='horizontal', lineoffsets=1,
+ linelengths=1, linewidths=None, colors=None,
+ linestyles='solid', *, data=None, **kwargs):
+ return gca().eventplot(
+ positions, orientation=orientation, lineoffsets=lineoffsets,
+ linelengths=linelengths, linewidths=linewidths, colors=colors,
+ linestyles=linestyles,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.fill)
+def fill(*args, data=None, **kwargs):
+ return gca().fill(
+ *args, **({"data": data} if data is not None else {}),
+ **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.fill_between)
+def fill_between(
+ x, y1, y2=0, where=None, interpolate=False, step=None, *,
+ data=None, **kwargs):
+ return gca().fill_between(
+ x, y1, y2=y2, where=where, interpolate=interpolate, step=step,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.fill_betweenx)
+def fill_betweenx(
+ y, x1, x2=0, where=None, step=None, interpolate=False, *,
+ data=None, **kwargs):
+ return gca().fill_betweenx(
+ y, x1, x2=x2, where=where, step=step, interpolate=interpolate,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.grid)
+def grid(b=None, which='major', axis='both', **kwargs):
+ return gca().grid(b=b, which=which, axis=axis, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.hexbin)
+def hexbin(
+ x, y, C=None, gridsize=100, bins=None, xscale='linear',
+ yscale='linear', extent=None, cmap=None, norm=None, vmin=None,
+ vmax=None, alpha=None, linewidths=None, edgecolors='face',
+ reduce_C_function=np.mean, mincnt=None, marginals=False, *,
+ data=None, **kwargs):
+ __ret = gca().hexbin(
+ x, y, C=C, gridsize=gridsize, bins=bins, xscale=xscale,
+ yscale=yscale, extent=extent, cmap=cmap, norm=norm, vmin=vmin,
+ vmax=vmax, alpha=alpha, linewidths=linewidths,
+ edgecolors=edgecolors, reduce_C_function=reduce_C_function,
+ mincnt=mincnt, marginals=marginals,
+ **({"data": data} if data is not None else {}), **kwargs)
+ sci(__ret)
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.hist)
+def hist(
+ x, bins=None, range=None, density=False, weights=None,
+ cumulative=False, bottom=None, histtype='bar', align='mid',
+ orientation='vertical', rwidth=None, log=False, color=None,
+ label=None, stacked=False, *, data=None, **kwargs):
+ return gca().hist(
+ x, bins=bins, range=range, density=density, weights=weights,
+ cumulative=cumulative, bottom=bottom, histtype=histtype,
+ align=align, orientation=orientation, rwidth=rwidth, log=log,
+ color=color, label=label, stacked=stacked,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.stairs)
+def stairs(
+ values, edges=None, *, orientation='vertical', baseline=0,
+ fill=False, data=None, **kwargs):
+ return gca().stairs(
+ values, edges=edges, orientation=orientation,
+ baseline=baseline, fill=fill,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.hist2d)
+def hist2d(
+ x, y, bins=10, range=None, density=False, weights=None,
+ cmin=None, cmax=None, *, data=None, **kwargs):
+ __ret = gca().hist2d(
+ x, y, bins=bins, range=range, density=density,
+ weights=weights, cmin=cmin, cmax=cmax,
+ **({"data": data} if data is not None else {}), **kwargs)
+ sci(__ret[-1])
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.hlines)
+def hlines(
+ y, xmin, xmax, colors=None, linestyles='solid', label='', *,
+ data=None, **kwargs):
+ return gca().hlines(
+ y, xmin, xmax, colors=colors, linestyles=linestyles,
+ label=label, **({"data": data} if data is not None else {}),
+ **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.imshow)
+def imshow(
+ X, cmap=None, norm=None, aspect=None, interpolation=None,
+ alpha=None, vmin=None, vmax=None, origin=None, extent=None, *,
+ filternorm=True, filterrad=4.0, resample=None, url=None,
+ data=None, **kwargs):
+ __ret = gca().imshow(
+ X, cmap=cmap, norm=norm, aspect=aspect,
+ interpolation=interpolation, alpha=alpha, vmin=vmin,
+ vmax=vmax, origin=origin, extent=extent,
+ filternorm=filternorm, filterrad=filterrad, resample=resample,
+ url=url, **({"data": data} if data is not None else {}),
+ **kwargs)
+ sci(__ret)
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.legend)
+def legend(*args, **kwargs):
+ return gca().legend(*args, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.locator_params)
+def locator_params(axis='both', tight=None, **kwargs):
+ return gca().locator_params(axis=axis, tight=tight, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.loglog)
+def loglog(*args, **kwargs):
+ return gca().loglog(*args, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.magnitude_spectrum)
+def magnitude_spectrum(
+ x, Fs=None, Fc=None, window=None, pad_to=None, sides=None,
+ scale=None, *, data=None, **kwargs):
+ return gca().magnitude_spectrum(
+ x, Fs=Fs, Fc=Fc, window=window, pad_to=pad_to, sides=sides,
+ scale=scale, **({"data": data} if data is not None else {}),
+ **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.margins)
+def margins(*margins, x=None, y=None, tight=True):
+ return gca().margins(*margins, x=x, y=y, tight=tight)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.minorticks_off)
+def minorticks_off():
+ return gca().minorticks_off()
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.minorticks_on)
+def minorticks_on():
+ return gca().minorticks_on()
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.pcolor)
+def pcolor(
+ *args, shading=None, alpha=None, norm=None, cmap=None,
+ vmin=None, vmax=None, data=None, **kwargs):
+ __ret = gca().pcolor(
+ *args, shading=shading, alpha=alpha, norm=norm, cmap=cmap,
+ vmin=vmin, vmax=vmax,
+ **({"data": data} if data is not None else {}), **kwargs)
+ sci(__ret)
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.pcolormesh)
+def pcolormesh(
+ *args, alpha=None, norm=None, cmap=None, vmin=None,
+ vmax=None, shading=None, antialiased=False, data=None,
+ **kwargs):
+ __ret = gca().pcolormesh(
+ *args, alpha=alpha, norm=norm, cmap=cmap, vmin=vmin,
+ vmax=vmax, shading=shading, antialiased=antialiased,
+ **({"data": data} if data is not None else {}), **kwargs)
+ sci(__ret)
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.phase_spectrum)
+def phase_spectrum(
+ x, Fs=None, Fc=None, window=None, pad_to=None, sides=None, *,
+ data=None, **kwargs):
+ return gca().phase_spectrum(
+ x, Fs=Fs, Fc=Fc, window=window, pad_to=pad_to, sides=sides,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.pie)
+def pie(
+ x, explode=None, labels=None, colors=None, autopct=None,
+ pctdistance=0.6, shadow=False, labeldistance=1.1,
+ startangle=0, radius=1, counterclock=True, wedgeprops=None,
+ textprops=None, center=(0, 0), frame=False,
+ rotatelabels=False, *, normalize=None, data=None):
+ return gca().pie(
+ x, explode=explode, labels=labels, colors=colors,
+ autopct=autopct, pctdistance=pctdistance, shadow=shadow,
+ labeldistance=labeldistance, startangle=startangle,
+ radius=radius, counterclock=counterclock,
+ wedgeprops=wedgeprops, textprops=textprops, center=center,
+ frame=frame, rotatelabels=rotatelabels, normalize=normalize,
+ **({"data": data} if data is not None else {}))
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.plot)
+def plot(*args, scalex=True, scaley=True, data=None, **kwargs):
+ return gca().plot(
+ *args, scalex=scalex, scaley=scaley,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.plot_date)
+def plot_date(
+ x, y, fmt='o', tz=None, xdate=True, ydate=False, *,
+ data=None, **kwargs):
+ return gca().plot_date(
+ x, y, fmt=fmt, tz=tz, xdate=xdate, ydate=ydate,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.psd)
+def psd(
+ x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None,
+ noverlap=None, pad_to=None, sides=None, scale_by_freq=None,
+ return_line=None, *, data=None, **kwargs):
+ return gca().psd(
+ x, NFFT=NFFT, Fs=Fs, Fc=Fc, detrend=detrend, window=window,
+ noverlap=noverlap, pad_to=pad_to, sides=sides,
+ scale_by_freq=scale_by_freq, return_line=return_line,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.quiver)
+def quiver(*args, data=None, **kw):
+ __ret = gca().quiver(
+ *args, **({"data": data} if data is not None else {}), **kw)
+ sci(__ret)
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.quiverkey)
+def quiverkey(Q, X, Y, U, label, **kw):
+ return gca().quiverkey(Q, X, Y, U, label, **kw)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.scatter)
+def scatter(
+ x, y, s=None, c=None, marker=None, cmap=None, norm=None,
+ vmin=None, vmax=None, alpha=None, linewidths=None, *,
+ edgecolors=None, plotnonfinite=False, data=None, **kwargs):
+ __ret = gca().scatter(
+ x, y, s=s, c=c, marker=marker, cmap=cmap, norm=norm,
+ vmin=vmin, vmax=vmax, alpha=alpha, linewidths=linewidths,
+ edgecolors=edgecolors, plotnonfinite=plotnonfinite,
+ **({"data": data} if data is not None else {}), **kwargs)
+ sci(__ret)
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.semilogx)
+def semilogx(*args, **kwargs):
+ return gca().semilogx(*args, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.semilogy)
+def semilogy(*args, **kwargs):
+ return gca().semilogy(*args, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.specgram)
+def specgram(
+ x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None,
+ noverlap=None, cmap=None, xextent=None, pad_to=None,
+ sides=None, scale_by_freq=None, mode=None, scale=None,
+ vmin=None, vmax=None, *, data=None, **kwargs):
+ __ret = gca().specgram(
+ x, NFFT=NFFT, Fs=Fs, Fc=Fc, detrend=detrend, window=window,
+ noverlap=noverlap, cmap=cmap, xextent=xextent, pad_to=pad_to,
+ sides=sides, scale_by_freq=scale_by_freq, mode=mode,
+ scale=scale, vmin=vmin, vmax=vmax,
+ **({"data": data} if data is not None else {}), **kwargs)
+ sci(__ret[-1])
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.spy)
+def spy(
+ Z, precision=0, marker=None, markersize=None, aspect='equal',
+ origin='upper', **kwargs):
+ __ret = gca().spy(
+ Z, precision=precision, marker=marker, markersize=markersize,
+ aspect=aspect, origin=origin, **kwargs)
+ if isinstance(__ret, cm.ScalarMappable): sci(__ret) # noqa
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.stackplot)
+def stackplot(
+ x, *args, labels=(), colors=None, baseline='zero', data=None,
+ **kwargs):
+ return gca().stackplot(
+ x, *args, labels=labels, colors=colors, baseline=baseline,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.stem)
+def stem(
+ *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
+ label=None, use_line_collection=True, orientation='vertical',
+ data=None):
+ return gca().stem(
+ *args, linefmt=linefmt, markerfmt=markerfmt, basefmt=basefmt,
+ bottom=bottom, label=label,
+ use_line_collection=use_line_collection,
+ orientation=orientation,
+ **({"data": data} if data is not None else {}))
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.step)
+def step(x, y, *args, where='pre', data=None, **kwargs):
+ return gca().step(
+ x, y, *args, where=where,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.streamplot)
+def streamplot(
+ x, y, u, v, density=1, linewidth=None, color=None, cmap=None,
+ norm=None, arrowsize=1, arrowstyle='-|>', minlength=0.1,
+ transform=None, zorder=None, start_points=None, maxlength=4.0,
+ integration_direction='both', *, data=None):
+ __ret = gca().streamplot(
+ x, y, u, v, density=density, linewidth=linewidth, color=color,
+ cmap=cmap, norm=norm, arrowsize=arrowsize,
+ arrowstyle=arrowstyle, minlength=minlength,
+ transform=transform, zorder=zorder, start_points=start_points,
+ maxlength=maxlength,
+ integration_direction=integration_direction,
+ **({"data": data} if data is not None else {}))
+ sci(__ret.lines)
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.table)
+def table(
+ cellText=None, cellColours=None, cellLoc='right',
+ colWidths=None, rowLabels=None, rowColours=None,
+ rowLoc='left', colLabels=None, colColours=None,
+ colLoc='center', loc='bottom', bbox=None, edges='closed',
+ **kwargs):
+ return gca().table(
+ cellText=cellText, cellColours=cellColours, cellLoc=cellLoc,
+ colWidths=colWidths, rowLabels=rowLabels,
+ rowColours=rowColours, rowLoc=rowLoc, colLabels=colLabels,
+ colColours=colColours, colLoc=colLoc, loc=loc, bbox=bbox,
+ edges=edges, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.text)
+def text(x, y, s, fontdict=None, **kwargs):
+ return gca().text(x, y, s, fontdict=fontdict, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.tick_params)
+def tick_params(axis='both', **kwargs):
+ return gca().tick_params(axis=axis, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.ticklabel_format)
+def ticklabel_format(
+ *, axis='both', style='', scilimits=None, useOffset=None,
+ useLocale=None, useMathText=None):
+ return gca().ticklabel_format(
+ axis=axis, style=style, scilimits=scilimits,
+ useOffset=useOffset, useLocale=useLocale,
+ useMathText=useMathText)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.tricontour)
+def tricontour(*args, **kwargs):
+ __ret = gca().tricontour(*args, **kwargs)
+ if __ret._A is not None: sci(__ret) # noqa
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.tricontourf)
+def tricontourf(*args, **kwargs):
+ __ret = gca().tricontourf(*args, **kwargs)
+ if __ret._A is not None: sci(__ret) # noqa
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.tripcolor)
+def tripcolor(
+ *args, alpha=1.0, norm=None, cmap=None, vmin=None, vmax=None,
+ shading='flat', facecolors=None, **kwargs):
+ __ret = gca().tripcolor(
+ *args, alpha=alpha, norm=norm, cmap=cmap, vmin=vmin,
+ vmax=vmax, shading=shading, facecolors=facecolors, **kwargs)
+ sci(__ret)
+ return __ret
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.triplot)
+def triplot(*args, **kwargs):
+ return gca().triplot(*args, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.violinplot)
+def violinplot(
+ dataset, positions=None, vert=True, widths=0.5,
+ showmeans=False, showextrema=True, showmedians=False,
+ quantiles=None, points=100, bw_method=None, *, data=None):
+ return gca().violinplot(
+ dataset, positions=positions, vert=vert, widths=widths,
+ showmeans=showmeans, showextrema=showextrema,
+ showmedians=showmedians, quantiles=quantiles, points=points,
+ bw_method=bw_method,
+ **({"data": data} if data is not None else {}))
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.vlines)
+def vlines(
+ x, ymin, ymax, colors=None, linestyles='solid', label='', *,
+ data=None, **kwargs):
+ return gca().vlines(
+ x, ymin, ymax, colors=colors, linestyles=linestyles,
+ label=label, **({"data": data} if data is not None else {}),
+ **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.xcorr)
+def xcorr(
+ x, y, normed=True, detrend=mlab.detrend_none, usevlines=True,
+ maxlags=10, *, data=None, **kwargs):
+ return gca().xcorr(
+ x, y, normed=normed, detrend=detrend, usevlines=usevlines,
+ maxlags=maxlags,
+ **({"data": data} if data is not None else {}), **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes._sci)
+def sci(im):
+ return gca()._sci(im)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.set_title)
+def title(label, fontdict=None, loc=None, pad=None, *, y=None, **kwargs):
+ return gca().set_title(
+ label, fontdict=fontdict, loc=loc, pad=pad, y=y, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.set_xlabel)
+def xlabel(xlabel, fontdict=None, labelpad=None, *, loc=None, **kwargs):
+ return gca().set_xlabel(
+ xlabel, fontdict=fontdict, labelpad=labelpad, loc=loc,
+ **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.set_ylabel)
+def ylabel(ylabel, fontdict=None, labelpad=None, *, loc=None, **kwargs):
+ return gca().set_ylabel(
+ ylabel, fontdict=fontdict, labelpad=labelpad, loc=loc,
+ **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.set_xscale)
+def xscale(value, **kwargs):
+ return gca().set_xscale(value, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+@_copy_docstring_and_deprecators(Axes.set_yscale)
+def yscale(value, **kwargs):
+ return gca().set_yscale(value, **kwargs)
+
+
+# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
+def autumn(): set_cmap('autumn')
+def bone(): set_cmap('bone')
+def cool(): set_cmap('cool')
+def copper(): set_cmap('copper')
+def flag(): set_cmap('flag')
+def gray(): set_cmap('gray')
+def hot(): set_cmap('hot')
+def hsv(): set_cmap('hsv')
+def jet(): set_cmap('jet')
+def pink(): set_cmap('pink')
+def prism(): set_cmap('prism')
+def spring(): set_cmap('spring')
+def summer(): set_cmap('summer')
+def winter(): set_cmap('winter')
+def magma(): set_cmap('magma')
+def inferno(): set_cmap('inferno')
+def plasma(): set_cmap('plasma')
+def viridis(): set_cmap('viridis')
+def nipy_spectral(): set_cmap('nipy_spectral')
+
+
+_setup_pyplot_info_docstrings()
diff --git a/venv/Lib/site-packages/matplotlib/quiver.py b/venv/Lib/site-packages/matplotlib/quiver.py
new file mode 100644
index 0000000..c278661
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/quiver.py
@@ -0,0 +1,1211 @@
+"""
+Support for plotting vector fields.
+
+Presently this contains Quiver and Barb. Quiver plots an arrow in the
+direction of the vector, with the size of the arrow related to the
+magnitude of the vector.
+
+Barbs are like quiver in that they point along a vector, but
+the magnitude of the vector is given schematically by the presence of barbs
+or flags on the barb.
+
+This will also become a home for things such as standard
+deviation ellipses, which can and will be derived very easily from
+the Quiver code.
+"""
+
+import math
+import weakref
+
+import numpy as np
+from numpy import ma
+
+from matplotlib import _api, cbook, docstring, font_manager
+import matplotlib.artist as martist
+import matplotlib.collections as mcollections
+from matplotlib.patches import CirclePolygon
+import matplotlib.text as mtext
+import matplotlib.transforms as transforms
+
+
+_quiver_doc = """
+Plot a 2D field of arrows.
+
+Call signature::
+
+ quiver([X, Y], U, V, [C], **kw)
+
+*X*, *Y* define the arrow locations, *U*, *V* define the arrow directions, and
+*C* optionally sets the color.
+
+**Arrow size**
+
+The default settings auto-scales the length of the arrows to a reasonable size.
+To change this behavior see the *scale* and *scale_units* parameters.
+
+**Arrow shape**
+
+The defaults give a slightly swept-back arrow; to make the head a
+triangle, make *headaxislength* the same as *headlength*. To make the
+arrow more pointed, reduce *headwidth* or increase *headlength* and
+*headaxislength*. To make the head smaller relative to the shaft,
+scale down all the head parameters. You will probably do best to leave
+minshaft alone.
+
+**Arrow outline**
+
+*linewidths* and *edgecolors* can be used to customize the arrow
+outlines.
+
+Parameters
+----------
+X, Y : 1D or 2D array-like, optional
+ The x and y coordinates of the arrow locations.
+
+ If not given, they will be generated as a uniform integer meshgrid based
+ on the dimensions of *U* and *V*.
+
+ If *X* and *Y* are 1D but *U*, *V* are 2D, *X*, *Y* are expanded to 2D
+ using ``X, Y = np.meshgrid(X, Y)``. In this case ``len(X)`` and ``len(Y)``
+ must match the column and row dimensions of *U* and *V*.
+
+U, V : 1D or 2D array-like
+ The x and y direction components of the arrow vectors.
+
+ They must have the same number of elements, matching the number of arrow
+ locations. *U* and *V* may be masked. Only locations unmasked in
+ *U*, *V*, and *C* will be drawn.
+
+C : 1D or 2D array-like, optional
+ Numeric data that defines the arrow colors by colormapping via *norm* and
+ *cmap*.
+
+ This does not support explicit colors. If you want to set colors directly,
+ use *color* instead. The size of *C* must match the number of arrow
+ locations.
+
+units : {'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, default: 'width'
+ The arrow dimensions (except for *length*) are measured in multiples of
+ this unit.
+
+ The following values are supported:
+
+ - 'width', 'height': The width or height of the axis.
+ - 'dots', 'inches': Pixels or inches based on the figure dpi.
+ - 'x', 'y', 'xy': *X*, *Y* or :math:`\\sqrt{X^2 + Y^2}` in data units.
+
+ The arrows scale differently depending on the units. For
+ 'x' or 'y', the arrows get larger as one zooms in; for other
+ units, the arrow size is independent of the zoom state. For
+ 'width or 'height', the arrow size increases with the width and
+ height of the axes, respectively, when the window is resized;
+ for 'dots' or 'inches', resizing does not change the arrows.
+
+angles : {'uv', 'xy'} or array-like, default: 'uv'
+ Method for determining the angle of the arrows.
+
+ - 'uv': The arrow axis aspect ratio is 1 so that
+ if *U* == *V* the orientation of the arrow on the plot is 45 degrees
+ counter-clockwise from the horizontal axis (positive to the right).
+
+ Use this if the arrows symbolize a quantity that is not based on
+ *X*, *Y* data coordinates.
+
+ - 'xy': Arrows point from (x, y) to (x+u, y+v).
+ Use this for plotting a gradient field, for example.
+
+ - Alternatively, arbitrary angles may be specified explicitly as an array
+ of values in degrees, counter-clockwise from the horizontal axis.
+
+ In this case *U*, *V* is only used to determine the length of the
+ arrows.
+
+ Note: inverting a data axis will correspondingly invert the
+ arrows only with ``angles='xy'``.
+
+scale : float, optional
+ Number of data units per arrow length unit, e.g., m/s per plot width; a
+ smaller scale parameter makes the arrow longer. Default is *None*.
+
+ If *None*, a simple autoscaling algorithm is used, based on the average
+ vector length and the number of vectors. The arrow length unit is given by
+ the *scale_units* parameter.
+
+scale_units : {'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, optional
+ If the *scale* kwarg is *None*, the arrow length unit. Default is *None*.
+
+ e.g. *scale_units* is 'inches', *scale* is 2.0, and ``(u, v) = (1, 0)``,
+ then the vector will be 0.5 inches long.
+
+ If *scale_units* is 'width' or 'height', then the vector will be half the
+ width/height of the axes.
+
+ If *scale_units* is 'x' then the vector will be 0.5 x-axis
+ units. To plot vectors in the x-y plane, with u and v having
+ the same units as x and y, use
+ ``angles='xy', scale_units='xy', scale=1``.
+
+width : float, optional
+ Shaft width in arrow units; default depends on choice of units,
+ above, and number of vectors; a typical starting value is about
+ 0.005 times the width of the plot.
+
+headwidth : float, default: 3
+ Head width as multiple of shaft width.
+
+headlength : float, default: 5
+ Head length as multiple of shaft width.
+
+headaxislength : float, default: 4.5
+ Head length at shaft intersection.
+
+minshaft : float, default: 1
+ Length below which arrow scales, in units of head length. Do not
+ set this to less than 1, or small arrows will look terrible!
+
+minlength : float, default: 1
+ Minimum length as a multiple of shaft width; if an arrow length
+ is less than this, plot a dot (hexagon) of this diameter instead.
+
+pivot : {'tail', 'mid', 'middle', 'tip'}, default: 'tail'
+ The part of the arrow that is anchored to the *X*, *Y* grid. The arrow
+ rotates about this point.
+
+ 'mid' is a synonym for 'middle'.
+
+color : color or color sequence, optional
+ Explicit color(s) for the arrows. If *C* has been set, *color* has no
+ effect.
+
+ This is a synonym for the `~.PolyCollection` *facecolor* parameter.
+
+Other Parameters
+----------------
+**kwargs : `~matplotlib.collections.PolyCollection` properties, optional
+ All other keyword arguments are passed on to `.PolyCollection`:
+
+ %(PolyCollection_kwdoc)s
+
+See Also
+--------
+.Axes.quiverkey : Add a key to a quiver plot.
+""" % docstring.interpd.params
+
+
+class QuiverKey(martist.Artist):
+ """Labelled arrow for use as a quiver plot scale key."""
+ halign = {'N': 'center', 'S': 'center', 'E': 'left', 'W': 'right'}
+ valign = {'N': 'bottom', 'S': 'top', 'E': 'center', 'W': 'center'}
+ pivot = {'N': 'middle', 'S': 'middle', 'E': 'tip', 'W': 'tail'}
+
+ def __init__(self, Q, X, Y, U, label,
+ *, angle=0, coordinates='axes', color=None, labelsep=0.1,
+ labelpos='N', labelcolor=None, fontproperties=None,
+ **kw):
+ """
+ Add a key to a quiver plot.
+
+ The positioning of the key depends on *X*, *Y*, *coordinates*, and
+ *labelpos*. If *labelpos* is 'N' or 'S', *X*, *Y* give the position of
+ the middle of the key arrow. If *labelpos* is 'E', *X*, *Y* positions
+ the head, and if *labelpos* is 'W', *X*, *Y* positions the tail; in
+ either of these two cases, *X*, *Y* is somewhere in the middle of the
+ arrow+label key object.
+
+ Parameters
+ ----------
+ Q : `matplotlib.quiver.Quiver`
+ A `.Quiver` object as returned by a call to `~.Axes.quiver()`.
+ X, Y : float
+ The location of the key.
+ U : float
+ The length of the key.
+ label : str
+ The key label (e.g., length and units of the key).
+ angle : float, default: 0
+ The angle of the key arrow, in degrees anti-clockwise from the
+ x-axis.
+ coordinates : {'axes', 'figure', 'data', 'inches'}, default: 'axes'
+ Coordinate system and units for *X*, *Y*: 'axes' and 'figure' are
+ normalized coordinate systems with (0, 0) in the lower left and
+ (1, 1) in the upper right; 'data' are the axes data coordinates
+ (used for the locations of the vectors in the quiver plot itself);
+ 'inches' is position in the figure in inches, with (0, 0) at the
+ lower left corner.
+ color : color
+ Overrides face and edge colors from *Q*.
+ labelpos : {'N', 'S', 'E', 'W'}
+ Position the label above, below, to the right, to the left of the
+ arrow, respectively.
+ labelsep : float, default: 0.1
+ Distance in inches between the arrow and the label.
+ labelcolor : color, default: :rc:`text.color`
+ Label color.
+ fontproperties : dict, optional
+ A dictionary with keyword arguments accepted by the
+ `~matplotlib.font_manager.FontProperties` initializer:
+ *family*, *style*, *variant*, *size*, *weight*.
+ **kwargs
+ Any additional keyword arguments are used to override vector
+ properties taken from *Q*.
+ """
+ super().__init__()
+ self.Q = Q
+ self.X = X
+ self.Y = Y
+ self.U = U
+ self.angle = angle
+ self.coord = coordinates
+ self.color = color
+ self.label = label
+ self._labelsep_inches = labelsep
+ self.labelsep = (self._labelsep_inches * Q.axes.figure.dpi)
+
+ # try to prevent closure over the real self
+ weak_self = weakref.ref(self)
+
+ def on_dpi_change(fig):
+ self_weakref = weak_self()
+ if self_weakref is not None:
+ self_weakref.labelsep = self_weakref._labelsep_inches * fig.dpi
+ # simple brute force update works because _init is called at
+ # the start of draw.
+ self_weakref._initialized = False
+
+ self._cid = Q.axes.figure.callbacks.connect(
+ 'dpi_changed', on_dpi_change)
+
+ self.labelpos = labelpos
+ self.labelcolor = labelcolor
+ self.fontproperties = fontproperties or dict()
+ self.kw = kw
+ _fp = self.fontproperties
+ # boxprops = dict(facecolor='red')
+ self.text = mtext.Text(
+ text=label, # bbox=boxprops,
+ horizontalalignment=self.halign[self.labelpos],
+ verticalalignment=self.valign[self.labelpos],
+ fontproperties=font_manager.FontProperties._from_any(_fp))
+
+ if self.labelcolor is not None:
+ self.text.set_color(self.labelcolor)
+ self._initialized = False
+ self.zorder = Q.zorder + 0.1
+
+ def remove(self):
+ # docstring inherited
+ self.Q.axes.figure.callbacks.disconnect(self._cid)
+ self._cid = None
+ super().remove() # pass the remove call up the stack
+
+ def _init(self):
+ if True: # not self._initialized:
+ if not self.Q._initialized:
+ self.Q._init()
+ self._set_transform()
+ with cbook._setattr_cm(self.Q, pivot=self.pivot[self.labelpos],
+ # Hack: save and restore the Umask
+ Umask=ma.nomask):
+ u = self.U * np.cos(np.radians(self.angle))
+ v = self.U * np.sin(np.radians(self.angle))
+ angle = (self.Q.angles if isinstance(self.Q.angles, str)
+ else 'uv')
+ self.verts = self.Q._make_verts(
+ np.array([u]), np.array([v]), angle)
+ kw = self.Q.polykw
+ kw.update(self.kw)
+ self.vector = mcollections.PolyCollection(
+ self.verts,
+ offsets=[(self.X, self.Y)],
+ transOffset=self.get_transform(),
+ **kw)
+ if self.color is not None:
+ self.vector.set_color(self.color)
+ self.vector.set_transform(self.Q.get_transform())
+ self.vector.set_figure(self.get_figure())
+ self._initialized = True
+
+ def _text_x(self, x):
+ if self.labelpos == 'E':
+ return x + self.labelsep
+ elif self.labelpos == 'W':
+ return x - self.labelsep
+ else:
+ return x
+
+ def _text_y(self, y):
+ if self.labelpos == 'N':
+ return y + self.labelsep
+ elif self.labelpos == 'S':
+ return y - self.labelsep
+ else:
+ return y
+
+ @martist.allow_rasterization
+ def draw(self, renderer):
+ self._init()
+ self.vector.draw(renderer)
+ x, y = self.get_transform().transform((self.X, self.Y))
+ self.text.set_x(self._text_x(x))
+ self.text.set_y(self._text_y(y))
+ self.text.draw(renderer)
+ self.stale = False
+
+ def _set_transform(self):
+ self.set_transform(_api.check_getitem({
+ "data": self.Q.axes.transData,
+ "axes": self.Q.axes.transAxes,
+ "figure": self.Q.axes.figure.transFigure,
+ "inches": self.Q.axes.figure.dpi_scale_trans,
+ }, coordinates=self.coord))
+
+ def set_figure(self, fig):
+ super().set_figure(fig)
+ self.text.set_figure(fig)
+
+ def contains(self, mouseevent):
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+ # Maybe the dictionary should allow one to
+ # distinguish between a text hit and a vector hit.
+ if (self.text.contains(mouseevent)[0] or
+ self.vector.contains(mouseevent)[0]):
+ return True, {}
+ return False, {}
+
+
+def _parse_args(*args, caller_name='function'):
+ """
+ Helper function to parse positional parameters for colored vector plots.
+
+ This is currently used for Quiver and Barbs.
+
+ Parameters
+ ----------
+ *args : list
+ list of 2-5 arguments. Depending on their number they are parsed to::
+
+ U, V
+ U, V, C
+ X, Y, U, V
+ X, Y, U, V, C
+
+ caller_name : str
+ Name of the calling method (used in error messages).
+ """
+ X = Y = C = None
+
+ len_args = len(args)
+ if len_args == 2:
+ # The use of atleast_1d allows for handling scalar arguments while also
+ # keeping masked arrays
+ U, V = np.atleast_1d(*args)
+ elif len_args == 3:
+ U, V, C = np.atleast_1d(*args)
+ elif len_args == 4:
+ X, Y, U, V = np.atleast_1d(*args)
+ elif len_args == 5:
+ X, Y, U, V, C = np.atleast_1d(*args)
+ else:
+ raise TypeError(f'{caller_name} takes 2-5 positional arguments but '
+ f'{len_args} were given')
+
+ nr, nc = (1, U.shape[0]) if U.ndim == 1 else U.shape
+
+ if X is not None:
+ X = X.ravel()
+ Y = Y.ravel()
+ if len(X) == nc and len(Y) == nr:
+ X, Y = [a.ravel() for a in np.meshgrid(X, Y)]
+ elif len(X) != len(Y):
+ raise ValueError('X and Y must be the same size, but '
+ f'X.size is {X.size} and Y.size is {Y.size}.')
+ else:
+ indexgrid = np.meshgrid(np.arange(nc), np.arange(nr))
+ X, Y = [np.ravel(a) for a in indexgrid]
+ # Size validation for U, V, C is left to the set_UVC method.
+ return X, Y, U, V, C
+
+
+def _check_consistent_shapes(*arrays):
+ all_shapes = {a.shape for a in arrays}
+ if len(all_shapes) != 1:
+ raise ValueError('The shapes of the passed in arrays do not match')
+
+
+class Quiver(mcollections.PolyCollection):
+ """
+ Specialized PolyCollection for arrows.
+
+ The only API method is set_UVC(), which can be used
+ to change the size, orientation, and color of the
+ arrows; their locations are fixed when the class is
+ instantiated. Possibly this method will be useful
+ in animations.
+
+ Much of the work in this class is done in the draw()
+ method so that as much information as possible is available
+ about the plot. In subsequent draw() calls, recalculation
+ is limited to things that might have changed, so there
+ should be no performance penalty from putting the calculations
+ in the draw() method.
+ """
+
+ _PIVOT_VALS = ('tail', 'middle', 'tip')
+
+ @docstring.Substitution(_quiver_doc)
+ def __init__(self, ax, *args,
+ scale=None, headwidth=3, headlength=5, headaxislength=4.5,
+ minshaft=1, minlength=1, units='width', scale_units=None,
+ angles='uv', width=None, color='k', pivot='tail', **kw):
+ """
+ The constructor takes one required argument, an Axes
+ instance, followed by the args and kwargs described
+ by the following pyplot interface documentation:
+ %s
+ """
+ self._axes = ax # The attr actually set by the Artist.axes property.
+ X, Y, U, V, C = _parse_args(*args, caller_name='quiver()')
+ self.X = X
+ self.Y = Y
+ self.XY = np.column_stack((X, Y))
+ self.N = len(X)
+ self.scale = scale
+ self.headwidth = headwidth
+ self.headlength = float(headlength)
+ self.headaxislength = headaxislength
+ self.minshaft = minshaft
+ self.minlength = minlength
+ self.units = units
+ self.scale_units = scale_units
+ self.angles = angles
+ self.width = width
+
+ if pivot.lower() == 'mid':
+ pivot = 'middle'
+ self.pivot = pivot.lower()
+ _api.check_in_list(self._PIVOT_VALS, pivot=self.pivot)
+
+ self.transform = kw.pop('transform', ax.transData)
+ kw.setdefault('facecolors', color)
+ kw.setdefault('linewidths', (0,))
+ super().__init__([], offsets=self.XY, transOffset=self.transform,
+ closed=False, **kw)
+ self.polykw = kw
+ self.set_UVC(U, V, C)
+ self._initialized = False
+
+ weak_self = weakref.ref(self) # Prevent closure over the real self.
+
+ def on_dpi_change(fig):
+ self_weakref = weak_self()
+ if self_weakref is not None:
+ # vertices depend on width, span which in turn depend on dpi
+ self_weakref._new_UV = True
+ # simple brute force update works because _init is called at
+ # the start of draw.
+ self_weakref._initialized = False
+
+ self._cid = ax.figure.callbacks.connect('dpi_changed', on_dpi_change)
+
+ @_api.deprecated("3.3", alternative="axes")
+ def ax(self):
+ return self.axes
+
+ def remove(self):
+ # docstring inherited
+ self.axes.figure.callbacks.disconnect(self._cid)
+ self._cid = None
+ super().remove() # pass the remove call up the stack
+
+ def _init(self):
+ """
+ Initialization delayed until first draw;
+ allow time for axes setup.
+ """
+ # It seems that there are not enough event notifications
+ # available to have this work on an as-needed basis at present.
+ if True: # not self._initialized:
+ trans = self._set_transform()
+ self.span = trans.inverted().transform_bbox(self.axes.bbox).width
+ if self.width is None:
+ sn = np.clip(math.sqrt(self.N), 8, 25)
+ self.width = 0.06 * self.span / sn
+
+ # _make_verts sets self.scale if not already specified
+ if not self._initialized and self.scale is None:
+ self._make_verts(self.U, self.V, self.angles)
+
+ self._initialized = True
+
+ def get_datalim(self, transData):
+ trans = self.get_transform()
+ transOffset = self.get_offset_transform()
+ full_transform = (trans - transData) + (transOffset - transData)
+ XY = full_transform.transform(self.XY)
+ bbox = transforms.Bbox.null()
+ bbox.update_from_data_xy(XY, ignore=True)
+ return bbox
+
+ @martist.allow_rasterization
+ def draw(self, renderer):
+ self._init()
+ verts = self._make_verts(self.U, self.V, self.angles)
+ self.set_verts(verts, closed=False)
+ self._new_UV = False
+ super().draw(renderer)
+ self.stale = False
+
+ def set_UVC(self, U, V, C=None):
+ # We need to ensure we have a copy, not a reference
+ # to an array that might change before draw().
+ U = ma.masked_invalid(U, copy=True).ravel()
+ V = ma.masked_invalid(V, copy=True).ravel()
+ if C is not None:
+ C = ma.masked_invalid(C, copy=True).ravel()
+ for name, var in zip(('U', 'V', 'C'), (U, V, C)):
+ if not (var is None or var.size == self.N or var.size == 1):
+ raise ValueError(f'Argument {name} has a size {var.size}'
+ f' which does not match {self.N},'
+ ' the number of arrow positions')
+
+ mask = ma.mask_or(U.mask, V.mask, copy=False, shrink=True)
+ if C is not None:
+ mask = ma.mask_or(mask, C.mask, copy=False, shrink=True)
+ if mask is ma.nomask:
+ C = C.filled()
+ else:
+ C = ma.array(C, mask=mask, copy=False)
+ self.U = U.filled(1)
+ self.V = V.filled(1)
+ self.Umask = mask
+ if C is not None:
+ self.set_array(C)
+ self._new_UV = True
+ self.stale = True
+
+ def _dots_per_unit(self, units):
+ """
+ Return a scale factor for converting from units to pixels
+ """
+ if units in ('x', 'y', 'xy'):
+ if units == 'x':
+ dx0 = self.axes.viewLim.width
+ dx1 = self.axes.bbox.width
+ elif units == 'y':
+ dx0 = self.axes.viewLim.height
+ dx1 = self.axes.bbox.height
+ else: # 'xy' is assumed
+ dxx0 = self.axes.viewLim.width
+ dxx1 = self.axes.bbox.width
+ dyy0 = self.axes.viewLim.height
+ dyy1 = self.axes.bbox.height
+ dx1 = np.hypot(dxx1, dyy1)
+ dx0 = np.hypot(dxx0, dyy0)
+ dx = dx1 / dx0
+ else:
+ if units == 'width':
+ dx = self.axes.bbox.width
+ elif units == 'height':
+ dx = self.axes.bbox.height
+ elif units == 'dots':
+ dx = 1.0
+ elif units == 'inches':
+ dx = self.axes.figure.dpi
+ else:
+ raise ValueError('unrecognized units')
+ return dx
+
+ def _set_transform(self):
+ """
+ Set the PolyCollection transform to go
+ from arrow width units to pixels.
+ """
+ dx = self._dots_per_unit(self.units)
+ self._trans_scale = dx # pixels per arrow width unit
+ trans = transforms.Affine2D().scale(dx)
+ self.set_transform(trans)
+ return trans
+
+ def _angles_lengths(self, U, V, eps=1):
+ xy = self.axes.transData.transform(self.XY)
+ uv = np.column_stack((U, V))
+ xyp = self.axes.transData.transform(self.XY + eps * uv)
+ dxy = xyp - xy
+ angles = np.arctan2(dxy[:, 1], dxy[:, 0])
+ lengths = np.hypot(*dxy.T) / eps
+ return angles, lengths
+
+ def _make_verts(self, U, V, angles):
+ uv = (U + V * 1j)
+ str_angles = angles if isinstance(angles, str) else ''
+ if str_angles == 'xy' and self.scale_units == 'xy':
+ # Here eps is 1 so that if we get U, V by diffing
+ # the X, Y arrays, the vectors will connect the
+ # points, regardless of the axis scaling (including log).
+ angles, lengths = self._angles_lengths(U, V, eps=1)
+ elif str_angles == 'xy' or self.scale_units == 'xy':
+ # Calculate eps based on the extents of the plot
+ # so that we don't end up with roundoff error from
+ # adding a small number to a large.
+ eps = np.abs(self.axes.dataLim.extents).max() * 0.001
+ angles, lengths = self._angles_lengths(U, V, eps=eps)
+ if str_angles and self.scale_units == 'xy':
+ a = lengths
+ else:
+ a = np.abs(uv)
+ if self.scale is None:
+ sn = max(10, math.sqrt(self.N))
+ if self.Umask is not ma.nomask:
+ amean = a[~self.Umask].mean()
+ else:
+ amean = a.mean()
+ # crude auto-scaling
+ # scale is typical arrow length as a multiple of the arrow width
+ scale = 1.8 * amean * sn / self.span
+ if self.scale_units is None:
+ if self.scale is None:
+ self.scale = scale
+ widthu_per_lenu = 1.0
+ else:
+ if self.scale_units == 'xy':
+ dx = 1
+ else:
+ dx = self._dots_per_unit(self.scale_units)
+ widthu_per_lenu = dx / self._trans_scale
+ if self.scale is None:
+ self.scale = scale * widthu_per_lenu
+ length = a * (widthu_per_lenu / (self.scale * self.width))
+ X, Y = self._h_arrows(length)
+ if str_angles == 'xy':
+ theta = angles
+ elif str_angles == 'uv':
+ theta = np.angle(uv)
+ else:
+ theta = ma.masked_invalid(np.deg2rad(angles)).filled(0)
+ theta = theta.reshape((-1, 1)) # for broadcasting
+ xy = (X + Y * 1j) * np.exp(1j * theta) * self.width
+ XY = np.stack((xy.real, xy.imag), axis=2)
+ if self.Umask is not ma.nomask:
+ XY = ma.array(XY)
+ XY[self.Umask] = ma.masked
+ # This might be handled more efficiently with nans, given
+ # that nans will end up in the paths anyway.
+
+ return XY
+
+ def _h_arrows(self, length):
+ """Length is in arrow width units."""
+ # It might be possible to streamline the code
+ # and speed it up a bit by using complex (x, y)
+ # instead of separate arrays; but any gain would be slight.
+ minsh = self.minshaft * self.headlength
+ N = len(length)
+ length = length.reshape(N, 1)
+ # This number is chosen based on when pixel values overflow in Agg
+ # causing rendering errors
+ # length = np.minimum(length, 2 ** 16)
+ np.clip(length, 0, 2 ** 16, out=length)
+ # x, y: normal horizontal arrow
+ x = np.array([0, -self.headaxislength,
+ -self.headlength, 0],
+ np.float64)
+ x = x + np.array([0, 1, 1, 1]) * length
+ y = 0.5 * np.array([1, 1, self.headwidth, 0], np.float64)
+ y = np.repeat(y[np.newaxis, :], N, axis=0)
+ # x0, y0: arrow without shaft, for short vectors
+ x0 = np.array([0, minsh - self.headaxislength,
+ minsh - self.headlength, minsh], np.float64)
+ y0 = 0.5 * np.array([1, 1, self.headwidth, 0], np.float64)
+ ii = [0, 1, 2, 3, 2, 1, 0, 0]
+ X = x[:, ii]
+ Y = y[:, ii]
+ Y[:, 3:-1] *= -1
+ X0 = x0[ii]
+ Y0 = y0[ii]
+ Y0[3:-1] *= -1
+ shrink = length / minsh if minsh != 0. else 0.
+ X0 = shrink * X0[np.newaxis, :]
+ Y0 = shrink * Y0[np.newaxis, :]
+ short = np.repeat(length < minsh, 8, axis=1)
+ # Now select X0, Y0 if short, otherwise X, Y
+ np.copyto(X, X0, where=short)
+ np.copyto(Y, Y0, where=short)
+ if self.pivot == 'middle':
+ X -= 0.5 * X[:, 3, np.newaxis]
+ elif self.pivot == 'tip':
+ # numpy bug? using -= does not work here unless we multiply by a
+ # float first, as with 'mid'.
+ X = X - X[:, 3, np.newaxis]
+ elif self.pivot != 'tail':
+ _api.check_in_list(["middle", "tip", "tail"], pivot=self.pivot)
+
+ tooshort = length < self.minlength
+ if tooshort.any():
+ # Use a heptagonal dot:
+ th = np.arange(0, 8, 1, np.float64) * (np.pi / 3.0)
+ x1 = np.cos(th) * self.minlength * 0.5
+ y1 = np.sin(th) * self.minlength * 0.5
+ X1 = np.repeat(x1[np.newaxis, :], N, axis=0)
+ Y1 = np.repeat(y1[np.newaxis, :], N, axis=0)
+ tooshort = np.repeat(tooshort, 8, 1)
+ np.copyto(X, X1, where=tooshort)
+ np.copyto(Y, Y1, where=tooshort)
+ # Mask handling is deferred to the caller, _make_verts.
+ return X, Y
+
+ quiver_doc = _quiver_doc
+
+
+_barbs_doc = r"""
+Plot a 2D field of barbs.
+
+Call signature::
+
+ barbs([X, Y], U, V, [C], **kw)
+
+Where *X*, *Y* define the barb locations, *U*, *V* define the barb
+directions, and *C* optionally sets the color.
+
+All arguments may be 1D or 2D. *U*, *V*, *C* may be masked arrays, but masked
+*X*, *Y* are not supported at present.
+
+Barbs are traditionally used in meteorology as a way to plot the speed
+and direction of wind observations, but can technically be used to
+plot any two dimensional vector quantity. As opposed to arrows, which
+give vector magnitude by the length of the arrow, the barbs give more
+quantitative information about the vector magnitude by putting slanted
+lines or a triangle for various increments in magnitude, as show
+schematically below::
+
+ : /\ \
+ : / \ \
+ : / \ \ \
+ : / \ \ \
+ : ------------------------------
+
+The largest increment is given by a triangle (or "flag"). After those
+come full lines (barbs). The smallest increment is a half line. There
+is only, of course, ever at most 1 half line. If the magnitude is
+small and only needs a single half-line and no full lines or
+triangles, the half-line is offset from the end of the barb so that it
+can be easily distinguished from barbs with a single full line. The
+magnitude for the barb shown above would nominally be 65, using the
+standard increments of 50, 10, and 5.
+
+See also https://en.wikipedia.org/wiki/Wind_barb.
+
+Parameters
+----------
+X, Y : 1D or 2D array-like, optional
+ The x and y coordinates of the barb locations. See *pivot* for how the
+ barbs are drawn to the x, y positions.
+
+ If not given, they will be generated as a uniform integer meshgrid based
+ on the dimensions of *U* and *V*.
+
+ If *X* and *Y* are 1D but *U*, *V* are 2D, *X*, *Y* are expanded to 2D
+ using ``X, Y = np.meshgrid(X, Y)``. In this case ``len(X)`` and ``len(Y)``
+ must match the column and row dimensions of *U* and *V*.
+
+U, V : 1D or 2D array-like
+ The x and y components of the barb shaft.
+
+C : 1D or 2D array-like, optional
+ Numeric data that defines the barb colors by colormapping via *norm* and
+ *cmap*.
+
+ This does not support explicit colors. If you want to set colors directly,
+ use *barbcolor* instead.
+
+length : float, default: 7
+ Length of the barb in points; the other parts of the barb
+ are scaled against this.
+
+pivot : {'tip', 'middle'} or float, default: 'tip'
+ The part of the arrow that is anchored to the *X*, *Y* grid. The barb
+ rotates about this point. This can also be a number, which shifts the
+ start of the barb that many points away from grid point.
+
+barbcolor : color or color sequence
+ The color of all parts of the barb except for the flags. This parameter
+ is analogous to the *edgecolor* parameter for polygons, which can be used
+ instead. However this parameter will override facecolor.
+
+flagcolor : color or color sequence
+ The color of any flags on the barb. This parameter is analogous to the
+ *facecolor* parameter for polygons, which can be used instead. However,
+ this parameter will override facecolor. If this is not set (and *C* has
+ not either) then *flagcolor* will be set to match *barbcolor* so that the
+ barb has a uniform color. If *C* has been set, *flagcolor* has no effect.
+
+sizes : dict, optional
+ A dictionary of coefficients specifying the ratio of a given
+ feature to the length of the barb. Only those values one wishes to
+ override need to be included. These features include:
+
+ - 'spacing' - space between features (flags, full/half barbs)
+ - 'height' - height (distance from shaft to top) of a flag or full barb
+ - 'width' - width of a flag, twice the width of a full barb
+ - 'emptybarb' - radius of the circle used for low magnitudes
+
+fill_empty : bool, default: False
+ Whether the empty barbs (circles) that are drawn should be filled with
+ the flag color. If they are not filled, the center is transparent.
+
+rounding : bool, default: True
+ Whether the vector magnitude should be rounded when allocating barb
+ components. If True, the magnitude is rounded to the nearest multiple
+ of the half-barb increment. If False, the magnitude is simply truncated
+ to the next lowest multiple.
+
+barb_increments : dict, optional
+ A dictionary of increments specifying values to associate with
+ different parts of the barb. Only those values one wishes to
+ override need to be included.
+
+ - 'half' - half barbs (Default is 5)
+ - 'full' - full barbs (Default is 10)
+ - 'flag' - flags (default is 50)
+
+flip_barb : bool or array-like of bool, default: False
+ Whether the lines and flags should point opposite to normal.
+ Normal behavior is for the barbs and lines to point right (comes from wind
+ barbs having these features point towards low pressure in the Northern
+ Hemisphere).
+
+ A single value is applied to all barbs. Individual barbs can be flipped by
+ passing a bool array of the same size as *U* and *V*.
+
+Returns
+-------
+barbs : `~matplotlib.quiver.Barbs`
+
+Other Parameters
+----------------
+**kwargs
+ The barbs can further be customized using `.PolyCollection` keyword
+ arguments:
+
+ %(PolyCollection_kwdoc)s
+""" % docstring.interpd.params
+
+docstring.interpd.update(barbs_doc=_barbs_doc)
+
+
+class Barbs(mcollections.PolyCollection):
+ """
+ Specialized PolyCollection for barbs.
+
+ The only API method is :meth:`set_UVC`, which can be used to
+ change the size, orientation, and color of the arrows. Locations
+ are changed using the :meth:`set_offsets` collection method.
+ Possibly this method will be useful in animations.
+
+ There is one internal function :meth:`_find_tails` which finds
+ exactly what should be put on the barb given the vector magnitude.
+ From there :meth:`_make_barbs` is used to find the vertices of the
+ polygon to represent the barb based on this information.
+ """
+ # This may be an abuse of polygons here to render what is essentially maybe
+ # 1 triangle and a series of lines. It works fine as far as I can tell
+ # however.
+ @docstring.interpd
+ def __init__(self, ax, *args,
+ pivot='tip', length=7, barbcolor=None, flagcolor=None,
+ sizes=None, fill_empty=False, barb_increments=None,
+ rounding=True, flip_barb=False, **kw):
+ """
+ The constructor takes one required argument, an Axes
+ instance, followed by the args and kwargs described
+ by the following pyplot interface documentation:
+ %(barbs_doc)s
+ """
+ self.sizes = sizes or dict()
+ self.fill_empty = fill_empty
+ self.barb_increments = barb_increments or dict()
+ self.rounding = rounding
+ self.flip = np.atleast_1d(flip_barb)
+ transform = kw.pop('transform', ax.transData)
+ self._pivot = pivot
+ self._length = length
+ barbcolor = barbcolor
+ flagcolor = flagcolor
+
+ # Flagcolor and barbcolor provide convenience parameters for
+ # setting the facecolor and edgecolor, respectively, of the barb
+ # polygon. We also work here to make the flag the same color as the
+ # rest of the barb by default
+
+ if None in (barbcolor, flagcolor):
+ kw['edgecolors'] = 'face'
+ if flagcolor:
+ kw['facecolors'] = flagcolor
+ elif barbcolor:
+ kw['facecolors'] = barbcolor
+ else:
+ # Set to facecolor passed in or default to black
+ kw.setdefault('facecolors', 'k')
+ else:
+ kw['edgecolors'] = barbcolor
+ kw['facecolors'] = flagcolor
+
+ # Explicitly set a line width if we're not given one, otherwise
+ # polygons are not outlined and we get no barbs
+ if 'linewidth' not in kw and 'lw' not in kw:
+ kw['linewidth'] = 1
+
+ # Parse out the data arrays from the various configurations supported
+ x, y, u, v, c = _parse_args(*args, caller_name='barbs()')
+ self.x = x
+ self.y = y
+ xy = np.column_stack((x, y))
+
+ # Make a collection
+ barb_size = self._length ** 2 / 4 # Empirically determined
+ super().__init__([], (barb_size,), offsets=xy, transOffset=transform,
+ **kw)
+ self.set_transform(transforms.IdentityTransform())
+
+ self.set_UVC(u, v, c)
+
+ def _find_tails(self, mag, rounding=True, half=5, full=10, flag=50):
+ """
+ Find how many of each of the tail pieces is necessary. Flag
+ specifies the increment for a flag, barb for a full barb, and half for
+ half a barb. Mag should be the magnitude of a vector (i.e., >= 0).
+
+ This returns a tuple of:
+
+ (*number of flags*, *number of barbs*, *half_flag*, *empty_flag*)
+
+ The bool *half_flag* indicates whether half of a barb is needed,
+ since there should only ever be one half on a given
+ barb. *empty_flag* flag is an array of flags to easily tell if
+ a barb is empty (too low to plot any barbs/flags.
+ """
+
+ # If rounding, round to the nearest multiple of half, the smallest
+ # increment
+ if rounding:
+ mag = half * (mag / half + 0.5).astype(int)
+
+ num_flags = np.floor(mag / flag).astype(int)
+ mag = mag % flag
+
+ num_barb = np.floor(mag / full).astype(int)
+ mag = mag % full
+
+ half_flag = mag >= half
+ empty_flag = ~(half_flag | (num_flags > 0) | (num_barb > 0))
+
+ return num_flags, num_barb, half_flag, empty_flag
+
+ def _make_barbs(self, u, v, nflags, nbarbs, half_barb, empty_flag, length,
+ pivot, sizes, fill_empty, flip):
+ """
+ Create the wind barbs.
+
+ Parameters
+ ----------
+ u, v
+ Components of the vector in the x and y directions, respectively.
+
+ nflags, nbarbs, half_barb, empty_flag
+ Respectively, the number of flags, number of barbs, flag for
+ half a barb, and flag for empty barb, ostensibly obtained from
+ :meth:`_find_tails`.
+
+ length
+ The length of the barb staff in points.
+
+ pivot : {"tip", "middle"} or number
+ The point on the barb around which the entire barb should be
+ rotated. If a number, the start of the barb is shifted by that
+ many points from the origin.
+
+ sizes : dict
+ Coefficients specifying the ratio of a given feature to the length
+ of the barb. These features include:
+
+ - *spacing*: space between features (flags, full/half barbs).
+ - *height*: distance from shaft of top of a flag or full barb.
+ - *width*: width of a flag, twice the width of a full barb.
+ - *emptybarb*: radius of the circle used for low magnitudes.
+
+ fill_empty : bool
+ Whether the circle representing an empty barb should be filled or
+ not (this changes the drawing of the polygon).
+
+ flip : list of bool
+ Whether the features should be flipped to the other side of the
+ barb (useful for winds in the southern hemisphere).
+
+ Returns
+ -------
+ list of arrays of vertices
+ Polygon vertices for each of the wind barbs. These polygons have
+ been rotated to properly align with the vector direction.
+ """
+
+ # These control the spacing and size of barb elements relative to the
+ # length of the shaft
+ spacing = length * sizes.get('spacing', 0.125)
+ full_height = length * sizes.get('height', 0.4)
+ full_width = length * sizes.get('width', 0.25)
+ empty_rad = length * sizes.get('emptybarb', 0.15)
+
+ # Controls y point where to pivot the barb.
+ pivot_points = dict(tip=0.0, middle=-length / 2.)
+
+ endx = 0.0
+ try:
+ endy = float(pivot)
+ except ValueError:
+ endy = pivot_points[pivot.lower()]
+
+ # Get the appropriate angle for the vector components. The offset is
+ # due to the way the barb is initially drawn, going down the y-axis.
+ # This makes sense in a meteorological mode of thinking since there 0
+ # degrees corresponds to north (the y-axis traditionally)
+ angles = -(ma.arctan2(v, u) + np.pi / 2)
+
+ # Used for low magnitude. We just get the vertices, so if we make it
+ # out here, it can be reused. The center set here should put the
+ # center of the circle at the location(offset), rather than at the
+ # same point as the barb pivot; this seems more sensible.
+ circ = CirclePolygon((0, 0), radius=empty_rad).get_verts()
+ if fill_empty:
+ empty_barb = circ
+ else:
+ # If we don't want the empty one filled, we make a degenerate
+ # polygon that wraps back over itself
+ empty_barb = np.concatenate((circ, circ[::-1]))
+
+ barb_list = []
+ for index, angle in np.ndenumerate(angles):
+ # If the vector magnitude is too weak to draw anything, plot an
+ # empty circle instead
+ if empty_flag[index]:
+ # We can skip the transform since the circle has no preferred
+ # orientation
+ barb_list.append(empty_barb)
+ continue
+
+ poly_verts = [(endx, endy)]
+ offset = length
+
+ # Handle if this barb should be flipped
+ barb_height = -full_height if flip[index] else full_height
+
+ # Add vertices for each flag
+ for i in range(nflags[index]):
+ # The spacing that works for the barbs is a little to much for
+ # the flags, but this only occurs when we have more than 1
+ # flag.
+ if offset != length:
+ offset += spacing / 2.
+ poly_verts.extend(
+ [[endx, endy + offset],
+ [endx + barb_height, endy - full_width / 2 + offset],
+ [endx, endy - full_width + offset]])
+
+ offset -= full_width + spacing
+
+ # Add vertices for each barb. These really are lines, but works
+ # great adding 3 vertices that basically pull the polygon out and
+ # back down the line
+ for i in range(nbarbs[index]):
+ poly_verts.extend(
+ [(endx, endy + offset),
+ (endx + barb_height, endy + offset + full_width / 2),
+ (endx, endy + offset)])
+
+ offset -= spacing
+
+ # Add the vertices for half a barb, if needed
+ if half_barb[index]:
+ # If the half barb is the first on the staff, traditionally it
+ # is offset from the end to make it easy to distinguish from a
+ # barb with a full one
+ if offset == length:
+ poly_verts.append((endx, endy + offset))
+ offset -= 1.5 * spacing
+ poly_verts.extend(
+ [(endx, endy + offset),
+ (endx + barb_height / 2, endy + offset + full_width / 4),
+ (endx, endy + offset)])
+
+ # Rotate the barb according the angle. Making the barb first and
+ # then rotating it made the math for drawing the barb really easy.
+ # Also, the transform framework makes doing the rotation simple.
+ poly_verts = transforms.Affine2D().rotate(-angle).transform(
+ poly_verts)
+ barb_list.append(poly_verts)
+
+ return barb_list
+
+ def set_UVC(self, U, V, C=None):
+ self.u = ma.masked_invalid(U, copy=False).ravel()
+ self.v = ma.masked_invalid(V, copy=False).ravel()
+
+ # Flip needs to have the same number of entries as everything else.
+ # Use broadcast_to to avoid a bloated array of identical values.
+ # (can't rely on actual broadcasting)
+ if len(self.flip) == 1:
+ flip = np.broadcast_to(self.flip, self.u.shape)
+ else:
+ flip = self.flip
+
+ if C is not None:
+ c = ma.masked_invalid(C, copy=False).ravel()
+ x, y, u, v, c, flip = cbook.delete_masked_points(
+ self.x.ravel(), self.y.ravel(), self.u, self.v, c,
+ flip.ravel())
+ _check_consistent_shapes(x, y, u, v, c, flip)
+ else:
+ x, y, u, v, flip = cbook.delete_masked_points(
+ self.x.ravel(), self.y.ravel(), self.u, self.v, flip.ravel())
+ _check_consistent_shapes(x, y, u, v, flip)
+
+ magnitude = np.hypot(u, v)
+ flags, barbs, halves, empty = self._find_tails(magnitude,
+ self.rounding,
+ **self.barb_increments)
+
+ # Get the vertices for each of the barbs
+
+ plot_barbs = self._make_barbs(u, v, flags, barbs, halves, empty,
+ self._length, self._pivot, self.sizes,
+ self.fill_empty, flip)
+ self.set_verts(plot_barbs)
+
+ # Set the color array
+ if C is not None:
+ self.set_array(c)
+
+ # Update the offsets in case the masked data changed
+ xy = np.column_stack((x, y))
+ self._offsets = xy
+ self.stale = True
+
+ def set_offsets(self, xy):
+ """
+ Set the offsets for the barb polygons. This saves the offsets passed
+ in and masks them as appropriate for the existing U/V data.
+
+ Parameters
+ ----------
+ xy : sequence of pairs of floats
+ """
+ self.x = xy[:, 0]
+ self.y = xy[:, 1]
+ x, y, u, v = cbook.delete_masked_points(
+ self.x.ravel(), self.y.ravel(), self.u, self.v)
+ _check_consistent_shapes(x, y, u, v)
+ xy = np.column_stack((x, y))
+ super().set_offsets(xy)
+ self.stale = True
+
+ barbs_doc = _barbs_doc
diff --git a/venv/Lib/site-packages/matplotlib/rcsetup.py b/venv/Lib/site-packages/matplotlib/rcsetup.py
new file mode 100644
index 0000000..e53dc2c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/rcsetup.py
@@ -0,0 +1,1449 @@
+"""
+The rcsetup module contains the validation code for customization using
+Matplotlib's rc settings.
+
+Each rc setting is assigned a function used to validate any attempted changes
+to that setting. The validation functions are defined in the rcsetup module,
+and are used to construct the rcParams global object which stores the settings
+and is referenced throughout Matplotlib.
+
+The default values of the rc settings are set in the default matplotlibrc file.
+Any additions or deletions to the parameter set listed here should also be
+propagated to the :file:`matplotlibrc.template` in Matplotlib's root source
+directory.
+"""
+
+import ast
+from functools import lru_cache, reduce
+from numbers import Number
+import operator
+import re
+
+import numpy as np
+
+from matplotlib import _api, animation, cbook
+from matplotlib.cbook import ls_mapper
+from matplotlib.colors import Colormap, is_color_like
+from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
+from matplotlib._enums import JoinStyle, CapStyle
+
+# Don't let the original cycler collide with our validating cycler
+from cycler import Cycler, cycler as ccycler
+
+
+# The capitalized forms are needed for ipython at present; this may
+# change for later versions.
+interactive_bk = ['GTK3Agg', 'GTK3Cairo',
+ 'MacOSX',
+ 'nbAgg',
+ 'Qt4Agg', 'Qt4Cairo', 'Qt5Agg', 'Qt5Cairo',
+ 'TkAgg', 'TkCairo',
+ 'WebAgg',
+ 'WX', 'WXAgg', 'WXCairo']
+non_interactive_bk = ['agg', 'cairo',
+ 'pdf', 'pgf', 'ps', 'svg', 'template']
+all_backends = interactive_bk + non_interactive_bk
+
+
+class ValidateInStrings:
+ def __init__(self, key, valid, ignorecase=False, *,
+ _deprecated_since=None):
+ """*valid* is a list of legal strings."""
+ self.key = key
+ self.ignorecase = ignorecase
+ self._deprecated_since = _deprecated_since
+
+ def func(s):
+ if ignorecase:
+ return s.lower()
+ else:
+ return s
+ self.valid = {func(k): k for k in valid}
+
+ def __call__(self, s):
+ if self._deprecated_since:
+ name, = (k for k, v in globals().items() if v is self)
+ _api.warn_deprecated(
+ self._deprecated_since, name=name, obj_type="function")
+ if self.ignorecase:
+ s = s.lower()
+ if s in self.valid:
+ return self.valid[s]
+ msg = (f"{s!r} is not a valid value for {self.key}; supported values "
+ f"are {[*self.valid.values()]}")
+ if (isinstance(s, str)
+ and (s.startswith('"') and s.endswith('"')
+ or s.startswith("'") and s.endswith("'"))
+ and s[1:-1] in self.valid):
+ msg += "; remove quotes surrounding your string"
+ raise ValueError(msg)
+
+
+@lru_cache()
+def _listify_validator(scalar_validator, allow_stringlist=False, *,
+ n=None, doc=None):
+ def f(s):
+ if isinstance(s, str):
+ try:
+ val = [scalar_validator(v.strip()) for v in s.split(',')
+ if v.strip()]
+ except Exception:
+ if allow_stringlist:
+ # Sometimes, a list of colors might be a single string
+ # of single-letter colornames. So give that a shot.
+ val = [scalar_validator(v.strip()) for v in s if v.strip()]
+ else:
+ raise
+ # Allow any ordered sequence type -- generators, np.ndarray, pd.Series
+ # -- but not sets, whose iteration order is non-deterministic.
+ elif np.iterable(s) and not isinstance(s, (set, frozenset)):
+ # The condition on this list comprehension will preserve the
+ # behavior of filtering out any empty strings (behavior was
+ # from the original validate_stringlist()), while allowing
+ # any non-string/text scalar values such as numbers and arrays.
+ val = [scalar_validator(v) for v in s
+ if not isinstance(v, str) or v]
+ else:
+ raise ValueError(
+ f"Expected str or other non-set iterable, but got {s}")
+ if n is not None and len(val) != n:
+ raise ValueError(
+ f"Expected {n} values, but there are {len(val)} values in {s}")
+ return val
+
+ try:
+ f.__name__ = "{}list".format(scalar_validator.__name__)
+ except AttributeError: # class instance.
+ f.__name__ = "{}List".format(type(scalar_validator).__name__)
+ f.__qualname__ = f.__qualname__.rsplit(".", 1)[0] + "." + f.__name__
+ f.__doc__ = doc if doc is not None else scalar_validator.__doc__
+ return f
+
+
+def validate_any(s):
+ return s
+validate_anylist = _listify_validator(validate_any)
+
+
+def _validate_date(s):
+ try:
+ np.datetime64(s)
+ return s
+ except ValueError:
+ raise ValueError(
+ f'{s!r} should be a string that can be parsed by numpy.datetime64')
+
+
+def validate_bool(b):
+ """Convert b to ``bool`` or raise."""
+ if isinstance(b, str):
+ b = b.lower()
+ if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True):
+ return True
+ elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False):
+ return False
+ else:
+ raise ValueError('Could not convert "%s" to bool' % b)
+
+
+@_api.deprecated("3.3")
+def validate_bool_maybe_none(b):
+ """Convert b to ``bool`` or raise, passing through *None*."""
+ if isinstance(b, str):
+ b = b.lower()
+ if b is None or b == 'none':
+ return None
+ if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True):
+ return True
+ elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False):
+ return False
+ else:
+ raise ValueError('Could not convert "%s" to bool' % b)
+
+
+def _validate_date_converter(s):
+ if s is None:
+ return
+ s = validate_string(s)
+ if s not in ['auto', 'concise']:
+ _api.warn_external(f'date.converter string must be "auto" or '
+ f'"concise", not "{s}". Check your matplotlibrc')
+ return
+ import matplotlib.dates as mdates
+ mdates._rcParam_helper.set_converter(s)
+
+
+def _validate_date_int_mult(s):
+ if s is None:
+ return
+ s = validate_bool(s)
+ import matplotlib.dates as mdates
+ mdates._rcParam_helper.set_int_mult(s)
+
+
+def _validate_tex_preamble(s):
+ if s is None or s == 'None':
+ _api.warn_deprecated(
+ "3.3", message="Support for setting the 'text.latex.preamble' or "
+ "'pgf.preamble' rcParam to None is deprecated since %(since)s and "
+ "will be removed %(removal)s; set it to an empty string instead.")
+ return ""
+ try:
+ if isinstance(s, str):
+ return s
+ elif np.iterable(s):
+ _api.warn_deprecated(
+ "3.3", message="Support for setting the 'text.latex.preamble' "
+ "or 'pgf.preamble' rcParam to a list of strings is deprecated "
+ "since %(since)s and will be removed %(removal)s; set it to a "
+ "single string instead.")
+ return '\n'.join(s)
+ else:
+ raise TypeError
+ except TypeError as e:
+ raise ValueError('Could not convert "%s" to string' % s) from e
+
+
+def validate_axisbelow(s):
+ try:
+ return validate_bool(s)
+ except ValueError:
+ if isinstance(s, str):
+ if s == 'line':
+ return 'line'
+ if s.lower().startswith('line'):
+ _api.warn_deprecated(
+ "3.3", message=f"Support for setting axes.axisbelow to "
+ f"{s!r} to mean 'line' is deprecated since %(since)s and "
+ f"will be removed %(removal)s; set it to 'line' instead.")
+ return 'line'
+ raise ValueError('%s cannot be interpreted as'
+ ' True, False, or "line"' % s)
+
+
+def validate_dpi(s):
+ """Confirm s is string 'figure' or convert s to float or raise."""
+ if s == 'figure':
+ return s
+ try:
+ return float(s)
+ except ValueError as e:
+ raise ValueError(f'{s!r} is not string "figure" and '
+ f'could not convert {s!r} to float') from e
+
+
+def _make_type_validator(cls, *, allow_none=False):
+ """
+ Return a validator that converts inputs to *cls* or raises (and possibly
+ allows ``None`` as well).
+ """
+
+ def validator(s):
+ if (allow_none and
+ (s is None or isinstance(s, str) and s.lower() == "none")):
+ return None
+ try:
+ return cls(s)
+ except (TypeError, ValueError) as e:
+ raise ValueError(
+ f'Could not convert {s!r} to {cls.__name__}') from e
+
+ validator.__name__ = f"validate_{cls.__name__}"
+ if allow_none:
+ validator.__name__ += "_or_None"
+ validator.__qualname__ = (
+ validator.__qualname__.rsplit(".", 1)[0] + "." + validator.__name__)
+ return validator
+
+
+validate_string = _make_type_validator(str)
+validate_string_or_None = _make_type_validator(str, allow_none=True)
+validate_stringlist = _listify_validator(
+ validate_string, doc='return a list of strings')
+validate_int = _make_type_validator(int)
+validate_int_or_None = _make_type_validator(int, allow_none=True)
+validate_float = _make_type_validator(float)
+validate_float_or_None = _make_type_validator(float, allow_none=True)
+validate_floatlist = _listify_validator(
+ validate_float, doc='return a list of floats')
+
+
+def validate_fonttype(s):
+ """
+ Confirm that this is a Postscript or PDF font type that we know how to
+ convert to.
+ """
+ fonttypes = {'type3': 3,
+ 'truetype': 42}
+ try:
+ fonttype = validate_int(s)
+ except ValueError:
+ try:
+ return fonttypes[s.lower()]
+ except KeyError as e:
+ raise ValueError('Supported Postscript/PDF font types are %s'
+ % list(fonttypes)) from e
+ else:
+ if fonttype not in fonttypes.values():
+ raise ValueError(
+ 'Supported Postscript/PDF font types are %s' %
+ list(fonttypes.values()))
+ return fonttype
+
+
+_validate_standard_backends = ValidateInStrings(
+ 'backend', all_backends, ignorecase=True)
+_auto_backend_sentinel = object()
+
+
+def validate_backend(s):
+ backend = (
+ s if s is _auto_backend_sentinel or s.startswith("module://")
+ else _validate_standard_backends(s))
+ return backend
+
+
+validate_toolbar = ValidateInStrings(
+ 'toolbar', ['None', 'toolbar2', 'toolmanager'], ignorecase=True,
+ _deprecated_since="3.3")
+
+
+def _validate_toolbar(s):
+ s = ValidateInStrings(
+ 'toolbar', ['None', 'toolbar2', 'toolmanager'], ignorecase=True)(s)
+ if s == 'toolmanager':
+ _api.warn_external(
+ "Treat the new Tool classes introduced in v1.5 as experimental "
+ "for now; the API and rcParam may change in future versions.")
+ return s
+
+
+@_api.deprecated("3.3")
+def _make_nseq_validator(cls, n=None, allow_none=False):
+
+ def validator(s):
+ """Convert *n* objects using ``cls``, or raise."""
+ if isinstance(s, str):
+ s = [x.strip() for x in s.split(',')]
+ if n is not None and len(s) != n:
+ raise ValueError(
+ f'Expected exactly {n} comma-separated values, '
+ f'but got {len(s)} comma-separated values: {s}')
+ else:
+ if n is not None and len(s) != n:
+ raise ValueError(
+ f'Expected exactly {n} values, '
+ f'but got {len(s)} values: {s}')
+ try:
+ return [cls(val) if not allow_none or val is not None else val
+ for val in s]
+ except ValueError as e:
+ raise ValueError(
+ f'Could not convert all entries to {cls.__name__}s') from e
+
+ return validator
+
+
+@_api.deprecated("3.3")
+def validate_nseq_float(n):
+ return _make_nseq_validator(float, n)
+
+
+@_api.deprecated("3.3")
+def validate_nseq_int(n):
+ return _make_nseq_validator(int, n)
+
+
+def validate_color_or_inherit(s):
+ """Return a valid color arg."""
+ if cbook._str_equal(s, 'inherit'):
+ return s
+ return validate_color(s)
+
+
+def validate_color_or_auto(s):
+ if cbook._str_equal(s, 'auto'):
+ return s
+ return validate_color(s)
+
+
+def validate_color_for_prop_cycle(s):
+ # N-th color cycle syntax can't go into the color cycle.
+ if isinstance(s, str) and re.match("^C[0-9]$", s):
+ raise ValueError(f"Cannot put cycle reference ({s!r}) in prop_cycler")
+ return validate_color(s)
+
+
+def validate_color(s):
+ """Return a valid color arg."""
+ if isinstance(s, str):
+ if s.lower() == 'none':
+ return 'none'
+ if len(s) == 6 or len(s) == 8:
+ stmp = '#' + s
+ if is_color_like(stmp):
+ return stmp
+
+ if is_color_like(s):
+ return s
+
+ # If it is still valid, it must be a tuple (as a string from matplotlibrc).
+ try:
+ color = ast.literal_eval(s)
+ except (SyntaxError, ValueError):
+ pass
+ else:
+ if is_color_like(color):
+ return color
+
+ raise ValueError(f'{s!r} does not look like a color arg')
+
+
+validate_colorlist = _listify_validator(
+ validate_color, allow_stringlist=True, doc='return a list of colorspecs')
+
+
+def _validate_cmap(s):
+ _api.check_isinstance((str, Colormap), cmap=s)
+ return s
+
+
+validate_orientation = ValidateInStrings(
+ 'orientation', ['landscape', 'portrait'], _deprecated_since="3.3")
+
+
+def validate_aspect(s):
+ if s in ('auto', 'equal'):
+ return s
+ try:
+ return float(s)
+ except ValueError as e:
+ raise ValueError('not a valid aspect specification') from e
+
+
+def validate_fontsize_None(s):
+ if s is None or s == 'None':
+ return None
+ else:
+ return validate_fontsize(s)
+
+
+def validate_fontsize(s):
+ fontsizes = ['xx-small', 'x-small', 'small', 'medium', 'large',
+ 'x-large', 'xx-large', 'smaller', 'larger']
+ if isinstance(s, str):
+ s = s.lower()
+ if s in fontsizes:
+ return s
+ try:
+ return float(s)
+ except ValueError as e:
+ raise ValueError("%s is not a valid font size. Valid font sizes "
+ "are %s." % (s, ", ".join(fontsizes))) from e
+
+
+validate_fontsizelist = _listify_validator(validate_fontsize)
+
+
+def validate_fontweight(s):
+ weights = [
+ 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman',
+ 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black']
+ # Note: Historically, weights have been case-sensitive in Matplotlib
+ if s in weights:
+ return s
+ try:
+ return int(s)
+ except (ValueError, TypeError) as e:
+ raise ValueError(f'{s} is not a valid font weight.') from e
+
+
+def validate_font_properties(s):
+ parse_fontconfig_pattern(s)
+ return s
+
+
+def _validate_mathtext_fallback_to_cm(b):
+ """
+ Temporary validate for fallback_to_cm, while deprecated
+
+ """
+ if isinstance(b, str):
+ b = b.lower()
+ if b is None or b == 'none':
+ return None
+ else:
+ _api.warn_deprecated(
+ "3.3", message="Support for setting the 'mathtext.fallback_to_cm' "
+ "rcParam is deprecated since %(since)s and will be removed "
+ "%(removal)s; use 'mathtext.fallback : 'cm' instead.")
+ return validate_bool_maybe_none(b)
+
+
+def _validate_mathtext_fallback(s):
+ _fallback_fonts = ['cm', 'stix', 'stixsans']
+ if isinstance(s, str):
+ s = s.lower()
+ if s is None or s == 'none':
+ return None
+ elif s.lower() in _fallback_fonts:
+ return s
+ else:
+ raise ValueError(
+ f"{s} is not a valid fallback font name. Valid fallback font "
+ f"names are {','.join(_fallback_fonts)}. Passing 'None' will turn "
+ "fallback off.")
+
+
+validate_fontset = ValidateInStrings(
+ 'fontset',
+ ['dejavusans', 'dejavuserif', 'cm', 'stix', 'stixsans', 'custom'],
+ _deprecated_since="3.3")
+validate_mathtext_default = ValidateInStrings(
+ 'default', "rm cal it tt sf bf default bb frak scr regular".split(),
+ _deprecated_since="3.3")
+_validate_alignment = ValidateInStrings(
+ 'alignment',
+ ['center', 'top', 'bottom', 'baseline', 'center_baseline'],
+ _deprecated_since="3.3")
+
+
+def validate_whiskers(s):
+ try:
+ return _listify_validator(validate_float, n=2)(s)
+ except (TypeError, ValueError):
+ try:
+ return float(s)
+ except ValueError as e:
+ raise ValueError("Not a valid whisker value ['range', float, "
+ "(float, float)]") from e
+
+
+validate_ps_papersize = ValidateInStrings(
+ 'ps_papersize',
+ ['auto', 'letter', 'legal', 'ledger',
+ 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10',
+ 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'b10',
+ ], ignorecase=True, _deprecated_since="3.3")
+
+
+def validate_ps_distiller(s):
+ if isinstance(s, str):
+ s = s.lower()
+ if s in ('none', None, 'false', False):
+ return None
+ else:
+ return ValidateInStrings('ps.usedistiller', ['ghostscript', 'xpdf'])(s)
+
+
+# A validator dedicated to the named line styles, based on the items in
+# ls_mapper, and a list of possible strings read from Line2D.set_linestyle
+_validate_named_linestyle = ValidateInStrings(
+ 'linestyle',
+ [*ls_mapper.keys(), *ls_mapper.values(), 'None', 'none', ' ', ''],
+ ignorecase=True)
+
+
+def _validate_linestyle(ls):
+ """
+ A validator for all possible line styles, the named ones *and*
+ the on-off ink sequences.
+ """
+ if isinstance(ls, str):
+ try: # Look first for a valid named line style, like '--' or 'solid'.
+ return _validate_named_linestyle(ls)
+ except ValueError:
+ pass
+ try:
+ ls = ast.literal_eval(ls) # Parsing matplotlibrc.
+ except (SyntaxError, ValueError):
+ pass # Will error with the ValueError at the end.
+
+ def _is_iterable_not_string_like(x):
+ # Explicitly exclude bytes/bytearrays so that they are not
+ # nonsensically interpreted as sequences of numbers (codepoints).
+ return np.iterable(x) and not isinstance(x, (str, bytes, bytearray))
+
+ # (offset, (on, off, on, off, ...))
+ if (_is_iterable_not_string_like(ls)
+ and len(ls) == 2
+ and isinstance(ls[0], (type(None), Number))
+ and _is_iterable_not_string_like(ls[1])
+ and len(ls[1]) % 2 == 0
+ and all(isinstance(elem, Number) for elem in ls[1])):
+ if ls[0] is None:
+ _api.warn_deprecated(
+ "3.3", message="Passing the dash offset as None is deprecated "
+ "since %(since)s and support for it will be removed "
+ "%(removal)s; pass it as zero instead.")
+ ls = (0, ls[1])
+ return ls
+ # For backcompat: (on, off, on, off, ...); the offset is implicitly None.
+ if (_is_iterable_not_string_like(ls)
+ and len(ls) % 2 == 0
+ and all(isinstance(elem, Number) for elem in ls)):
+ return (0, ls)
+ raise ValueError(f"linestyle {ls!r} is not a valid on-off ink sequence.")
+
+
+validate_fillstyle = ValidateInStrings(
+ 'markers.fillstyle', ['full', 'left', 'right', 'bottom', 'top', 'none'])
+
+
+validate_fillstylelist = _listify_validator(validate_fillstyle)
+
+
+def validate_markevery(s):
+ """
+ Validate the markevery property of a Line2D object.
+
+ Parameters
+ ----------
+ s : None, int, float, slice, length-2 tuple of ints,
+ length-2 tuple of floats, list of ints
+
+ Returns
+ -------
+ None, int, float, slice, length-2 tuple of ints,
+ length-2 tuple of floats, list of ints
+
+ """
+ # Validate s against type slice float int and None
+ if isinstance(s, (slice, float, int, type(None))):
+ return s
+ # Validate s against type tuple
+ if isinstance(s, tuple):
+ if (len(s) == 2
+ and (all(isinstance(e, int) for e in s)
+ or all(isinstance(e, float) for e in s))):
+ return s
+ else:
+ raise TypeError(
+ "'markevery' tuple must be pair of ints or of floats")
+ # Validate s against type list
+ if isinstance(s, list):
+ if all(isinstance(e, int) for e in s):
+ return s
+ else:
+ raise TypeError(
+ "'markevery' list must have all elements of type int")
+ raise TypeError("'markevery' is of an invalid type")
+
+
+validate_markeverylist = _listify_validator(validate_markevery)
+
+validate_legend_loc = ValidateInStrings(
+ 'legend_loc',
+ ['best',
+ 'upper right',
+ 'upper left',
+ 'lower left',
+ 'lower right',
+ 'right',
+ 'center left',
+ 'center right',
+ 'lower center',
+ 'upper center',
+ 'center'], ignorecase=True, _deprecated_since="3.3")
+
+validate_svg_fonttype = ValidateInStrings(
+ 'svg.fonttype', ['none', 'path'], _deprecated_since="3.3")
+
+
+@_api.deprecated("3.3")
+def validate_hinting(s):
+ return _validate_hinting(s)
+
+
+# Replace by plain list in _prop_validators after deprecation period.
+_validate_hinting = ValidateInStrings(
+ 'text.hinting',
+ ['default', 'no_autohint', 'force_autohint', 'no_hinting',
+ 'auto', 'native', 'either', 'none'],
+ ignorecase=True)
+
+
+validate_pgf_texsystem = ValidateInStrings(
+ 'pgf.texsystem', ['xelatex', 'lualatex', 'pdflatex'],
+ _deprecated_since="3.3")
+
+
+@_api.deprecated("3.3")
+def validate_movie_writer(s):
+ # writers.list() would only list actually available writers, but
+ # FFMpeg.isAvailable is slow and not worth paying for at every import.
+ if s in animation.writers._registered:
+ return s
+ else:
+ raise ValueError(f"Supported animation writers are "
+ f"{sorted(animation.writers._registered)}")
+
+
+validate_movie_frame_fmt = ValidateInStrings(
+ 'animation.frame_format', ['png', 'jpeg', 'tiff', 'raw', 'rgba', 'ppm',
+ 'sgi', 'bmp', 'pbm', 'svg'],
+ _deprecated_since="3.3")
+validate_axis_locator = ValidateInStrings(
+ 'major', ['minor', 'both', 'major'], _deprecated_since="3.3")
+validate_movie_html_fmt = ValidateInStrings(
+ 'animation.html', ['html5', 'jshtml', 'none'], _deprecated_since="3.3")
+
+
+def validate_bbox(s):
+ if isinstance(s, str):
+ s = s.lower()
+ if s == 'tight':
+ return s
+ if s == 'standard':
+ return None
+ raise ValueError("bbox should be 'tight' or 'standard'")
+ elif s is not None:
+ # Backwards compatibility. None is equivalent to 'standard'.
+ raise ValueError("bbox should be 'tight' or 'standard'")
+ return s
+
+
+def validate_sketch(s):
+ if isinstance(s, str):
+ s = s.lower()
+ if s == 'none' or s is None:
+ return None
+ try:
+ return tuple(_listify_validator(validate_float, n=3)(s))
+ except ValueError:
+ raise ValueError("Expected a (scale, length, randomness) triplet")
+
+
+def _validate_greaterequal0_lessthan1(s):
+ s = validate_float(s)
+ if 0 <= s < 1:
+ return s
+ else:
+ raise RuntimeError(f'Value must be >=0 and <1; got {s}')
+
+
+def _validate_greaterequal0_lessequal1(s):
+ s = validate_float(s)
+ if 0 <= s <= 1:
+ return s
+ else:
+ raise RuntimeError(f'Value must be >=0 and <=1; got {s}')
+
+
+_range_validators = { # Slightly nicer (internal) API.
+ "0 <= x < 1": _validate_greaterequal0_lessthan1,
+ "0 <= x <= 1": _validate_greaterequal0_lessequal1,
+}
+
+
+validate_grid_axis = ValidateInStrings(
+ 'axes.grid.axis', ['x', 'y', 'both'], _deprecated_since="3.3")
+
+
+def validate_hatch(s):
+ r"""
+ Validate a hatch pattern.
+ A hatch pattern string can have any sequence of the following
+ characters: ``\ / | - + * . x o O``.
+ """
+ if not isinstance(s, str):
+ raise ValueError("Hatch pattern must be a string")
+ _api.check_isinstance(str, hatch_pattern=s)
+ unknown = set(s) - {'\\', '/', '|', '-', '+', '*', '.', 'x', 'o', 'O'}
+ if unknown:
+ raise ValueError("Unknown hatch symbol(s): %s" % list(unknown))
+ return s
+
+
+validate_hatchlist = _listify_validator(validate_hatch)
+validate_dashlist = _listify_validator(validate_floatlist)
+
+
+_prop_validators = {
+ 'color': _listify_validator(validate_color_for_prop_cycle,
+ allow_stringlist=True),
+ 'linewidth': validate_floatlist,
+ 'linestyle': _listify_validator(_validate_linestyle),
+ 'facecolor': validate_colorlist,
+ 'edgecolor': validate_colorlist,
+ 'joinstyle': _listify_validator(JoinStyle),
+ 'capstyle': _listify_validator(CapStyle),
+ 'fillstyle': validate_fillstylelist,
+ 'markerfacecolor': validate_colorlist,
+ 'markersize': validate_floatlist,
+ 'markeredgewidth': validate_floatlist,
+ 'markeredgecolor': validate_colorlist,
+ 'markevery': validate_markeverylist,
+ 'alpha': validate_floatlist,
+ 'marker': validate_stringlist,
+ 'hatch': validate_hatchlist,
+ 'dashes': validate_dashlist,
+ }
+_prop_aliases = {
+ 'c': 'color',
+ 'lw': 'linewidth',
+ 'ls': 'linestyle',
+ 'fc': 'facecolor',
+ 'ec': 'edgecolor',
+ 'mfc': 'markerfacecolor',
+ 'mec': 'markeredgecolor',
+ 'mew': 'markeredgewidth',
+ 'ms': 'markersize',
+ }
+
+
+def cycler(*args, **kwargs):
+ """
+ Create a `~cycler.Cycler` object much like :func:`cycler.cycler`,
+ but includes input validation.
+
+ Call signatures::
+
+ cycler(cycler)
+ cycler(label=values[, label2=values2[, ...]])
+ cycler(label, values)
+
+ Form 1 copies a given `~cycler.Cycler` object.
+
+ Form 2 creates a `~cycler.Cycler` which cycles over one or more
+ properties simultaneously. If multiple properties are given, their
+ value lists must have the same length.
+
+ Form 3 creates a `~cycler.Cycler` for a single property. This form
+ exists for compatibility with the original cycler. Its use is
+ discouraged in favor of the kwarg form, i.e. ``cycler(label=values)``.
+
+ Parameters
+ ----------
+ cycler : Cycler
+ Copy constructor for Cycler.
+
+ label : str
+ The property key. Must be a valid `.Artist` property.
+ For example, 'color' or 'linestyle'. Aliases are allowed,
+ such as 'c' for 'color' and 'lw' for 'linewidth'.
+
+ values : iterable
+ Finite-length iterable of the property values. These values
+ are validated and will raise a ValueError if invalid.
+
+ Returns
+ -------
+ Cycler
+ A new :class:`~cycler.Cycler` for the given properties.
+
+ Examples
+ --------
+ Creating a cycler for a single property:
+
+ >>> c = cycler(color=['red', 'green', 'blue'])
+
+ Creating a cycler for simultaneously cycling over multiple properties
+ (e.g. red circle, green plus, blue cross):
+
+ >>> c = cycler(color=['red', 'green', 'blue'],
+ ... marker=['o', '+', 'x'])
+
+ """
+ if args and kwargs:
+ raise TypeError("cycler() can only accept positional OR keyword "
+ "arguments -- not both.")
+ elif not args and not kwargs:
+ raise TypeError("cycler() must have positional OR keyword arguments")
+
+ if len(args) == 1:
+ if not isinstance(args[0], Cycler):
+ raise TypeError("If only one positional argument given, it must "
+ "be a Cycler instance.")
+ return validate_cycler(args[0])
+ elif len(args) == 2:
+ pairs = [(args[0], args[1])]
+ elif len(args) > 2:
+ raise TypeError("No more than 2 positional arguments allowed")
+ else:
+ pairs = kwargs.items()
+
+ validated = []
+ for prop, vals in pairs:
+ norm_prop = _prop_aliases.get(prop, prop)
+ validator = _prop_validators.get(norm_prop, None)
+ if validator is None:
+ raise TypeError("Unknown artist property: %s" % prop)
+ vals = validator(vals)
+ # We will normalize the property names as well to reduce
+ # the amount of alias handling code elsewhere.
+ validated.append((norm_prop, vals))
+
+ return reduce(operator.add, (ccycler(k, v) for k, v in validated))
+
+
+def validate_cycler(s):
+ """Return a Cycler object from a string repr or the object itself."""
+ if isinstance(s, str):
+ # TODO: We might want to rethink this...
+ # While I think I have it quite locked down, it is execution of
+ # arbitrary code without sanitation.
+ # Combine this with the possibility that rcparams might come from the
+ # internet (future plans), this could be downright dangerous.
+ # I locked it down by only having the 'cycler()' function available.
+ # UPDATE: Partly plugging a security hole.
+ # I really should have read this:
+ # http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html
+ # We should replace this eval with a combo of PyParsing and
+ # ast.literal_eval()
+ try:
+ if '.__' in s.replace(' ', ''):
+ raise ValueError("'%s' seems to have dunder methods. Raising"
+ " an exception for your safety")
+ s = eval(s, {'cycler': cycler, '__builtins__': {}})
+ except BaseException as e:
+ raise ValueError("'%s' is not a valid cycler construction: %s" %
+ (s, e)) from e
+ # Should make sure what comes from the above eval()
+ # is a Cycler object.
+ if isinstance(s, Cycler):
+ cycler_inst = s
+ else:
+ raise ValueError("object was not a string or Cycler instance: %s" % s)
+
+ unknowns = cycler_inst.keys - (set(_prop_validators) | set(_prop_aliases))
+ if unknowns:
+ raise ValueError("Unknown artist properties: %s" % unknowns)
+
+ # Not a full validation, but it'll at least normalize property names
+ # A fuller validation would require v0.10 of cycler.
+ checker = set()
+ for prop in cycler_inst.keys:
+ norm_prop = _prop_aliases.get(prop, prop)
+ if norm_prop != prop and norm_prop in cycler_inst.keys:
+ raise ValueError("Cannot specify both '{0}' and alias '{1}'"
+ " in the same prop_cycle".format(norm_prop, prop))
+ if norm_prop in checker:
+ raise ValueError("Another property was already aliased to '{0}'."
+ " Collision normalizing '{1}'.".format(norm_prop,
+ prop))
+ checker.update([norm_prop])
+
+ # This is just an extra-careful check, just in case there is some
+ # edge-case I haven't thought of.
+ assert len(checker) == len(cycler_inst.keys)
+
+ # Now, it should be safe to mutate this cycler
+ for prop in cycler_inst.keys:
+ norm_prop = _prop_aliases.get(prop, prop)
+ cycler_inst.change_key(prop, norm_prop)
+
+ for key, vals in cycler_inst.by_key().items():
+ _prop_validators[key](vals)
+
+ return cycler_inst
+
+
+def validate_hist_bins(s):
+ valid_strs = ["auto", "sturges", "fd", "doane", "scott", "rice", "sqrt"]
+ if isinstance(s, str) and s in valid_strs:
+ return s
+ try:
+ return int(s)
+ except (TypeError, ValueError):
+ pass
+ try:
+ return validate_floatlist(s)
+ except ValueError:
+ pass
+ raise ValueError("'hist.bins' must be one of {}, an int or"
+ " a sequence of floats".format(valid_strs))
+
+
+@_api.deprecated("3.3")
+def validate_webagg_address(s):
+ if s is not None:
+ import socket
+ try:
+ socket.inet_aton(s)
+ except socket.error as e:
+ raise ValueError(
+ "'webagg.address' is not a valid IP address") from e
+ return s
+ raise ValueError("'webagg.address' is not a valid IP address")
+
+
+validate_axes_titlelocation = ValidateInStrings(
+ 'axes.titlelocation', ['left', 'center', 'right'], _deprecated_since="3.3")
+
+
+class _ignorecase(list):
+ """A marker class indicating that a list-of-str is case-insensitive."""
+
+
+def _convert_validator_spec(key, conv):
+ if isinstance(conv, list):
+ ignorecase = isinstance(conv, _ignorecase)
+ return ValidateInStrings(key, conv, ignorecase=ignorecase)
+ else:
+ return conv
+
+
+# Mapping of rcParams to validators.
+# Converters given as lists or _ignorecase are converted to ValidateInStrings
+# immediately below.
+# The rcParams defaults are defined in matplotlibrc.template, which gets copied
+# to matplotlib/mpl-data/matplotlibrc by the setup script.
+_validators = {
+ "backend": validate_backend,
+ "backend_fallback": validate_bool,
+ "toolbar": _validate_toolbar,
+ "interactive": validate_bool,
+ "timezone": validate_string,
+
+ "webagg.port": validate_int,
+ "webagg.address": validate_string,
+ "webagg.open_in_browser": validate_bool,
+ "webagg.port_retries": validate_int,
+
+ # line props
+ "lines.linewidth": validate_float, # line width in points
+ "lines.linestyle": _validate_linestyle, # solid line
+ "lines.color": validate_color, # first color in color cycle
+ "lines.marker": validate_string, # marker name
+ "lines.markerfacecolor": validate_color_or_auto, # default color
+ "lines.markeredgecolor": validate_color_or_auto, # default color
+ "lines.markeredgewidth": validate_float,
+ "lines.markersize": validate_float, # markersize, in points
+ "lines.antialiased": validate_bool, # antialiased (no jaggies)
+ "lines.dash_joinstyle": JoinStyle,
+ "lines.solid_joinstyle": JoinStyle,
+ "lines.dash_capstyle": CapStyle,
+ "lines.solid_capstyle": CapStyle,
+ "lines.dashed_pattern": validate_floatlist,
+ "lines.dashdot_pattern": validate_floatlist,
+ "lines.dotted_pattern": validate_floatlist,
+ "lines.scale_dashes": validate_bool,
+
+ # marker props
+ "markers.fillstyle": validate_fillstyle,
+
+ ## pcolor(mesh) props:
+ "pcolor.shading": ["auto", "flat", "nearest", "gouraud"],
+ "pcolormesh.snap": validate_bool,
+
+ ## patch props
+ "patch.linewidth": validate_float, # line width in points
+ "patch.edgecolor": validate_color,
+ "patch.force_edgecolor": validate_bool,
+ "patch.facecolor": validate_color, # first color in cycle
+ "patch.antialiased": validate_bool, # antialiased (no jaggies)
+
+ ## hatch props
+ "hatch.color": validate_color,
+ "hatch.linewidth": validate_float,
+
+ ## Histogram properties
+ "hist.bins": validate_hist_bins,
+
+ ## Boxplot properties
+ "boxplot.notch": validate_bool,
+ "boxplot.vertical": validate_bool,
+ "boxplot.whiskers": validate_whiskers,
+ "boxplot.bootstrap": validate_int_or_None,
+ "boxplot.patchartist": validate_bool,
+ "boxplot.showmeans": validate_bool,
+ "boxplot.showcaps": validate_bool,
+ "boxplot.showbox": validate_bool,
+ "boxplot.showfliers": validate_bool,
+ "boxplot.meanline": validate_bool,
+
+ "boxplot.flierprops.color": validate_color,
+ "boxplot.flierprops.marker": validate_string,
+ "boxplot.flierprops.markerfacecolor": validate_color_or_auto,
+ "boxplot.flierprops.markeredgecolor": validate_color,
+ "boxplot.flierprops.markeredgewidth": validate_float,
+ "boxplot.flierprops.markersize": validate_float,
+ "boxplot.flierprops.linestyle": _validate_linestyle,
+ "boxplot.flierprops.linewidth": validate_float,
+
+ "boxplot.boxprops.color": validate_color,
+ "boxplot.boxprops.linewidth": validate_float,
+ "boxplot.boxprops.linestyle": _validate_linestyle,
+
+ "boxplot.whiskerprops.color": validate_color,
+ "boxplot.whiskerprops.linewidth": validate_float,
+ "boxplot.whiskerprops.linestyle": _validate_linestyle,
+
+ "boxplot.capprops.color": validate_color,
+ "boxplot.capprops.linewidth": validate_float,
+ "boxplot.capprops.linestyle": _validate_linestyle,
+
+ "boxplot.medianprops.color": validate_color,
+ "boxplot.medianprops.linewidth": validate_float,
+ "boxplot.medianprops.linestyle": _validate_linestyle,
+
+ "boxplot.meanprops.color": validate_color,
+ "boxplot.meanprops.marker": validate_string,
+ "boxplot.meanprops.markerfacecolor": validate_color,
+ "boxplot.meanprops.markeredgecolor": validate_color,
+ "boxplot.meanprops.markersize": validate_float,
+ "boxplot.meanprops.linestyle": _validate_linestyle,
+ "boxplot.meanprops.linewidth": validate_float,
+
+ ## font props
+ "font.family": validate_stringlist, # used by text object
+ "font.style": validate_string,
+ "font.variant": validate_string,
+ "font.stretch": validate_string,
+ "font.weight": validate_fontweight,
+ "font.size": validate_float, # Base font size in points
+ "font.serif": validate_stringlist,
+ "font.sans-serif": validate_stringlist,
+ "font.cursive": validate_stringlist,
+ "font.fantasy": validate_stringlist,
+ "font.monospace": validate_stringlist,
+
+ # text props
+ "text.color": validate_color,
+ "text.usetex": validate_bool,
+ "text.latex.preamble": _validate_tex_preamble,
+ "text.latex.preview": validate_bool,
+ "text.hinting": _validate_hinting,
+ "text.hinting_factor": validate_int,
+ "text.kerning_factor": validate_int,
+ "text.antialiased": validate_bool,
+
+ "mathtext.cal": validate_font_properties,
+ "mathtext.rm": validate_font_properties,
+ "mathtext.tt": validate_font_properties,
+ "mathtext.it": validate_font_properties,
+ "mathtext.bf": validate_font_properties,
+ "mathtext.sf": validate_font_properties,
+ "mathtext.fontset": ["dejavusans", "dejavuserif", "cm", "stix",
+ "stixsans", "custom"],
+ "mathtext.default": ["rm", "cal", "it", "tt", "sf", "bf", "default",
+ "bb", "frak", "scr", "regular"],
+ "mathtext.fallback_to_cm": _validate_mathtext_fallback_to_cm,
+ "mathtext.fallback": _validate_mathtext_fallback,
+
+ "image.aspect": validate_aspect, # equal, auto, a number
+ "image.interpolation": validate_string,
+ "image.cmap": _validate_cmap, # gray, jet, etc.
+ "image.lut": validate_int, # lookup table
+ "image.origin": ["upper", "lower"],
+ "image.resample": validate_bool,
+ # Specify whether vector graphics backends will combine all images on a
+ # set of axes into a single composite image
+ "image.composite_image": validate_bool,
+
+ # contour props
+ "contour.negative_linestyle": _validate_linestyle,
+ "contour.corner_mask": validate_bool,
+ "contour.linewidth": validate_float_or_None,
+
+ # errorbar props
+ "errorbar.capsize": validate_float,
+
+ # axis props
+ # alignment of x/y axis title
+ "xaxis.labellocation": ["left", "center", "right"],
+ "yaxis.labellocation": ["bottom", "center", "top"],
+
+ # axes props
+ "axes.axisbelow": validate_axisbelow,
+ "axes.facecolor": validate_color, # background color
+ "axes.edgecolor": validate_color, # edge color
+ "axes.linewidth": validate_float, # edge linewidth
+
+ "axes.spines.left": validate_bool, # Set visibility of axes spines,
+ "axes.spines.right": validate_bool, # i.e., the lines around the chart
+ "axes.spines.bottom": validate_bool, # denoting data boundary.
+ "axes.spines.top": validate_bool,
+
+ "axes.titlesize": validate_fontsize, # axes title fontsize
+ "axes.titlelocation": ["left", "center", "right"], # axes title alignment
+ "axes.titleweight": validate_fontweight, # axes title font weight
+ "axes.titlecolor": validate_color_or_auto, # axes title font color
+ # title location, axes units, None means auto
+ "axes.titley": validate_float_or_None,
+ # pad from axes top decoration to title in points
+ "axes.titlepad": validate_float,
+ "axes.grid": validate_bool, # display grid or not
+ "axes.grid.which": ["minor", "both", "major"], # which grids are drawn
+ "axes.grid.axis": ["x", "y", "both"], # grid type
+ "axes.labelsize": validate_fontsize, # fontsize of x & y labels
+ "axes.labelpad": validate_float, # space between label and axis
+ "axes.labelweight": validate_fontweight, # fontsize of x & y labels
+ "axes.labelcolor": validate_color, # color of axis label
+ # use scientific notation if log10 of the axis range is smaller than the
+ # first or larger than the second
+ "axes.formatter.limits": _listify_validator(validate_int, n=2),
+ # use current locale to format ticks
+ "axes.formatter.use_locale": validate_bool,
+ "axes.formatter.use_mathtext": validate_bool,
+ # minimum exponent to format in scientific notation
+ "axes.formatter.min_exponent": validate_int,
+ "axes.formatter.useoffset": validate_bool,
+ "axes.formatter.offset_threshold": validate_int,
+ "axes.unicode_minus": validate_bool,
+ # This entry can be either a cycler object or a string repr of a
+ # cycler-object, which gets eval()'ed to create the object.
+ "axes.prop_cycle": validate_cycler,
+ # If "data", axes limits are set close to the data.
+ # If "round_numbers" axes limits are set to the nearest round numbers.
+ "axes.autolimit_mode": ["data", "round_numbers"],
+ "axes.xmargin": _range_validators["0 <= x <= 1"], # margin added to xaxis
+ "axes.ymargin": _range_validators["0 <= x <= 1"], # margin added to yaxis
+ 'axes.zmargin': _range_validators["0 <= x <= 1"], # margin added to zaxis
+
+ "polaraxes.grid": validate_bool, # display polar grid or not
+ "axes3d.grid": validate_bool, # display 3d grid
+
+ # scatter props
+ "scatter.marker": validate_string,
+ "scatter.edgecolors": validate_string,
+
+ "date.epoch": _validate_date,
+ "date.autoformatter.year": validate_string,
+ "date.autoformatter.month": validate_string,
+ "date.autoformatter.day": validate_string,
+ "date.autoformatter.hour": validate_string,
+ "date.autoformatter.minute": validate_string,
+ "date.autoformatter.second": validate_string,
+ "date.autoformatter.microsecond": validate_string,
+
+ # 'auto', 'concise', 'auto-noninterval'
+ 'date.converter': _validate_date_converter,
+ # for auto date locator, choose interval_multiples
+ 'date.interval_multiples': _validate_date_int_mult,
+
+ # legend properties
+ "legend.fancybox": validate_bool,
+ "legend.loc": _ignorecase([
+ "best",
+ "upper right", "upper left", "lower left", "lower right", "right",
+ "center left", "center right", "lower center", "upper center",
+ "center"]),
+
+ # the number of points in the legend line
+ "legend.numpoints": validate_int,
+ # the number of points in the legend line for scatter
+ "legend.scatterpoints": validate_int,
+ "legend.fontsize": validate_fontsize,
+ "legend.title_fontsize": validate_fontsize_None,
+ # the relative size of legend markers vs. original
+ "legend.markerscale": validate_float,
+ "legend.shadow": validate_bool,
+ # whether or not to draw a frame around legend
+ "legend.frameon": validate_bool,
+ # alpha value of the legend frame
+ "legend.framealpha": validate_float_or_None,
+
+ ## the following dimensions are in fraction of the font size
+ "legend.borderpad": validate_float, # units are fontsize
+ # the vertical space between the legend entries
+ "legend.labelspacing": validate_float,
+ # the length of the legend lines
+ "legend.handlelength": validate_float,
+ # the length of the legend lines
+ "legend.handleheight": validate_float,
+ # the space between the legend line and legend text
+ "legend.handletextpad": validate_float,
+ # the border between the axes and legend edge
+ "legend.borderaxespad": validate_float,
+ # the border between the axes and legend edge
+ "legend.columnspacing": validate_float,
+ "legend.facecolor": validate_color_or_inherit,
+ "legend.edgecolor": validate_color_or_inherit,
+
+ # tick properties
+ "xtick.top": validate_bool, # draw ticks on top side
+ "xtick.bottom": validate_bool, # draw ticks on bottom side
+ "xtick.labeltop": validate_bool, # draw label on top
+ "xtick.labelbottom": validate_bool, # draw label on bottom
+ "xtick.major.size": validate_float, # major xtick size in points
+ "xtick.minor.size": validate_float, # minor xtick size in points
+ "xtick.major.width": validate_float, # major xtick width in points
+ "xtick.minor.width": validate_float, # minor xtick width in points
+ "xtick.major.pad": validate_float, # distance to label in points
+ "xtick.minor.pad": validate_float, # distance to label in points
+ "xtick.color": validate_color, # color of xticks
+ "xtick.labelcolor": validate_color_or_inherit, # color of xtick labels
+ "xtick.minor.visible": validate_bool, # visibility of minor xticks
+ "xtick.minor.top": validate_bool, # draw top minor xticks
+ "xtick.minor.bottom": validate_bool, # draw bottom minor xticks
+ "xtick.major.top": validate_bool, # draw top major xticks
+ "xtick.major.bottom": validate_bool, # draw bottom major xticks
+ "xtick.labelsize": validate_fontsize, # fontsize of xtick labels
+ "xtick.direction": ["out", "in", "inout"], # direction of xticks
+ "xtick.alignment": ["center", "right", "left"],
+
+ "ytick.left": validate_bool, # draw ticks on left side
+ "ytick.right": validate_bool, # draw ticks on right side
+ "ytick.labelleft": validate_bool, # draw tick labels on left side
+ "ytick.labelright": validate_bool, # draw tick labels on right side
+ "ytick.major.size": validate_float, # major ytick size in points
+ "ytick.minor.size": validate_float, # minor ytick size in points
+ "ytick.major.width": validate_float, # major ytick width in points
+ "ytick.minor.width": validate_float, # minor ytick width in points
+ "ytick.major.pad": validate_float, # distance to label in points
+ "ytick.minor.pad": validate_float, # distance to label in points
+ "ytick.color": validate_color, # color of yticks
+ "ytick.labelcolor": validate_color_or_inherit, # color of ytick labels
+ "ytick.minor.visible": validate_bool, # visibility of minor yticks
+ "ytick.minor.left": validate_bool, # draw left minor yticks
+ "ytick.minor.right": validate_bool, # draw right minor yticks
+ "ytick.major.left": validate_bool, # draw left major yticks
+ "ytick.major.right": validate_bool, # draw right major yticks
+ "ytick.labelsize": validate_fontsize, # fontsize of ytick labels
+ "ytick.direction": ["out", "in", "inout"], # direction of yticks
+ "ytick.alignment": [
+ "center", "top", "bottom", "baseline", "center_baseline"],
+
+ "grid.color": validate_color, # grid color
+ "grid.linestyle": _validate_linestyle, # solid
+ "grid.linewidth": validate_float, # in points
+ "grid.alpha": validate_float,
+
+ ## figure props
+ # figure title
+ "figure.titlesize": validate_fontsize,
+ "figure.titleweight": validate_fontweight,
+
+ # figure size in inches: width by height
+ "figure.figsize": _listify_validator(validate_float, n=2),
+ "figure.dpi": validate_float,
+ "figure.facecolor": validate_color,
+ "figure.edgecolor": validate_color,
+ "figure.frameon": validate_bool,
+ "figure.autolayout": validate_bool,
+ "figure.max_open_warning": validate_int,
+ "figure.raise_window": validate_bool,
+
+ "figure.subplot.left": _range_validators["0 <= x <= 1"],
+ "figure.subplot.right": _range_validators["0 <= x <= 1"],
+ "figure.subplot.bottom": _range_validators["0 <= x <= 1"],
+ "figure.subplot.top": _range_validators["0 <= x <= 1"],
+ "figure.subplot.wspace": _range_validators["0 <= x < 1"],
+ "figure.subplot.hspace": _range_validators["0 <= x < 1"],
+
+ "figure.constrained_layout.use": validate_bool, # run constrained_layout?
+ # wspace and hspace are fraction of adjacent subplots to use for space.
+ # Much smaller than above because we don't need room for the text.
+ "figure.constrained_layout.hspace": _range_validators["0 <= x < 1"],
+ "figure.constrained_layout.wspace": _range_validators["0 <= x < 1"],
+ # buffer around the axes, in inches.
+ 'figure.constrained_layout.h_pad': validate_float,
+ 'figure.constrained_layout.w_pad': validate_float,
+
+ ## Saving figure's properties
+ 'savefig.dpi': validate_dpi,
+ 'savefig.facecolor': validate_color_or_auto,
+ 'savefig.edgecolor': validate_color_or_auto,
+ 'savefig.orientation': ['landscape', 'portrait'],
+ 'savefig.jpeg_quality': validate_int,
+ "savefig.format": validate_string,
+ "savefig.bbox": validate_bbox, # "tight", or "standard" (= None)
+ "savefig.pad_inches": validate_float,
+ # default directory in savefig dialog box
+ "savefig.directory": validate_string,
+ "savefig.transparent": validate_bool,
+
+ "tk.window_focus": validate_bool, # Maintain shell focus for TkAgg
+
+ # Set the papersize/type
+ "ps.papersize": _ignorecase(["auto", "letter", "legal", "ledger",
+ *[f"{ab}{i}"
+ for ab in "ab" for i in range(11)]]),
+ "ps.useafm": validate_bool,
+ # use ghostscript or xpdf to distill ps output
+ "ps.usedistiller": validate_ps_distiller,
+ "ps.distiller.res": validate_int, # dpi
+ "ps.fonttype": validate_fonttype, # 3 (Type3) or 42 (Truetype)
+ "pdf.compression": validate_int, # 0-9 compression level; 0 to disable
+ "pdf.inheritcolor": validate_bool, # skip color setting commands
+ # use only the 14 PDF core fonts embedded in every PDF viewing application
+ "pdf.use14corefonts": validate_bool,
+ "pdf.fonttype": validate_fonttype, # 3 (Type3) or 42 (Truetype)
+
+ "pgf.texsystem": ["xelatex", "lualatex", "pdflatex"], # latex variant used
+ "pgf.rcfonts": validate_bool, # use mpl's rc settings for font config
+ "pgf.preamble": _validate_tex_preamble, # custom LaTeX preamble
+
+ # write raster image data into the svg file
+ "svg.image_inline": validate_bool,
+ "svg.fonttype": ["none", "path"], # save text as text ("none") or "paths"
+ "svg.hashsalt": validate_string_or_None,
+
+ # set this when you want to generate hardcopy docstring
+ "docstring.hardcopy": validate_bool,
+
+ "path.simplify": validate_bool,
+ "path.simplify_threshold": _range_validators["0 <= x <= 1"],
+ "path.snap": validate_bool,
+ "path.sketch": validate_sketch,
+ "path.effects": validate_anylist,
+ "agg.path.chunksize": validate_int, # 0 to disable chunking
+
+ # key-mappings (multi-character mappings should be a list/tuple)
+ "keymap.fullscreen": validate_stringlist,
+ "keymap.home": validate_stringlist,
+ "keymap.back": validate_stringlist,
+ "keymap.forward": validate_stringlist,
+ "keymap.pan": validate_stringlist,
+ "keymap.zoom": validate_stringlist,
+ "keymap.save": validate_stringlist,
+ "keymap.quit": validate_stringlist,
+ "keymap.quit_all": validate_stringlist, # e.g.: "W", "cmd+W", "Q"
+ "keymap.grid": validate_stringlist,
+ "keymap.grid_minor": validate_stringlist,
+ "keymap.yscale": validate_stringlist,
+ "keymap.xscale": validate_stringlist,
+ "keymap.all_axes": validate_stringlist,
+ "keymap.help": validate_stringlist,
+ "keymap.copy": validate_stringlist,
+
+ # Animation settings
+ "animation.html": ["html5", "jshtml", "none"],
+ # Limit, in MB, of size of base64 encoded animation in HTML
+ # (i.e. IPython notebook)
+ "animation.embed_limit": validate_float,
+ "animation.writer": validate_string,
+ "animation.codec": validate_string,
+ "animation.bitrate": validate_int,
+ # Controls image format when frames are written to disk
+ "animation.frame_format": ["png", "jpeg", "tiff", "raw", "rgba", "ppm",
+ "sgi", "bmp", "pbm", "svg"],
+ # Additional arguments for HTML writer
+ "animation.html_args": validate_stringlist,
+ # Path to ffmpeg binary. If just binary name, subprocess uses $PATH.
+ "animation.ffmpeg_path": validate_string,
+ # Additional arguments for ffmpeg movie writer (using pipes)
+ "animation.ffmpeg_args": validate_stringlist,
+ # Path to AVConv binary. If just binary name, subprocess uses $PATH.
+ "animation.avconv_path": validate_string,
+ # Additional arguments for avconv movie writer (using pipes)
+ "animation.avconv_args": validate_stringlist,
+ # Path to convert binary. If just binary name, subprocess uses $PATH.
+ "animation.convert_path": validate_string,
+ # Additional arguments for convert movie writer (using pipes)
+ "animation.convert_args": validate_stringlist,
+
+ # Classic (pre 2.0) compatibility mode
+ # This is used for things that are hard to make backward compatible
+ # with a sane rcParam alone. This does *not* turn on classic mode
+ # altogether. For that use `matplotlib.style.use("classic")`.
+ "_internal.classic_mode": validate_bool
+}
+_hardcoded_defaults = { # Defaults not inferred from matplotlibrc.template...
+ # ... because it can"t be:
+ "backend": _auto_backend_sentinel,
+ # ... because they are private:
+ "_internal.classic_mode": False,
+ # ... because they are deprecated:
+ "animation.avconv_path": "avconv",
+ "animation.avconv_args": [],
+ "animation.html_args": [],
+ "mathtext.fallback_to_cm": None,
+ "keymap.all_axes": ["a"],
+ "savefig.jpeg_quality": 95,
+ "text.latex.preview": False,
+}
+_validators = {k: _convert_validator_spec(k, conv)
+ for k, conv in _validators.items()}
diff --git a/venv/Lib/site-packages/matplotlib/sankey.py b/venv/Lib/site-packages/matplotlib/sankey.py
new file mode 100644
index 0000000..8032001
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/sankey.py
@@ -0,0 +1,829 @@
+"""
+Module for creating Sankey diagrams using Matplotlib.
+"""
+
+import logging
+from types import SimpleNamespace
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib.path import Path
+from matplotlib.patches import PathPatch
+from matplotlib.transforms import Affine2D
+from matplotlib import docstring
+
+_log = logging.getLogger(__name__)
+
+__author__ = "Kevin L. Davies"
+__credits__ = ["Yannick Copin"]
+__license__ = "BSD"
+__version__ = "2011/09/16"
+
+# Angles [deg/90]
+RIGHT = 0
+UP = 1
+# LEFT = 2
+DOWN = 3
+
+
+class Sankey:
+ """
+ Sankey diagram.
+
+ Sankey diagrams are a specific type of flow diagram, in which
+ the width of the arrows is shown proportionally to the flow
+ quantity. They are typically used to visualize energy or
+ material or cost transfers between processes.
+ `Wikipedia (6/1/2011) `_
+
+ """
+
+ def __init__(self, ax=None, scale=1.0, unit='', format='%G', gap=0.25,
+ radius=0.1, shoulder=0.03, offset=0.15, head_angle=100,
+ margin=0.4, tolerance=1e-6, **kwargs):
+ """
+ Create a new Sankey instance.
+
+ The optional arguments listed below are applied to all subdiagrams so
+ that there is consistent alignment and formatting.
+
+ In order to draw a complex Sankey diagram, create an instance of
+ :class:`Sankey` by calling it without any kwargs::
+
+ sankey = Sankey()
+
+ Then add simple Sankey sub-diagrams::
+
+ sankey.add() # 1
+ sankey.add() # 2
+ #...
+ sankey.add() # n
+
+ Finally, create the full diagram::
+
+ sankey.finish()
+
+ Or, instead, simply daisy-chain those calls::
+
+ Sankey().add().add... .add().finish()
+
+ Other Parameters
+ ----------------
+ ax : `~.axes.Axes`
+ Axes onto which the data should be plotted. If *ax* isn't
+ provided, new Axes will be created.
+ scale : float
+ Scaling factor for the flows. *scale* sizes the width of the paths
+ in order to maintain proper layout. The same scale is applied to
+ all subdiagrams. The value should be chosen such that the product
+ of the scale and the sum of the inputs is approximately 1.0 (and
+ the product of the scale and the sum of the outputs is
+ approximately -1.0).
+ unit : str
+ The physical unit associated with the flow quantities. If *unit*
+ is None, then none of the quantities are labeled.
+ format : str or callable
+ A Python number formatting string or callable used to label the
+ flows with their quantities (i.e., a number times a unit, where the
+ unit is given). If a format string is given, the label will be
+ ``format % quantity``. If a callable is given, it will be called
+ with ``quantity`` as an argument.
+ gap : float
+ Space between paths that break in/break away to/from the top or
+ bottom.
+ radius : float
+ Inner radius of the vertical paths.
+ shoulder : float
+ Size of the shoulders of output arrows.
+ offset : float
+ Text offset (from the dip or tip of the arrow).
+ head_angle : float
+ Angle, in degrees, of the arrow heads (and negative of the angle of
+ the tails).
+ margin : float
+ Minimum space between Sankey outlines and the edge of the plot
+ area.
+ tolerance : float
+ Acceptable maximum of the magnitude of the sum of flows. The
+ magnitude of the sum of connected flows cannot be greater than
+ *tolerance*.
+ **kwargs
+ Any additional keyword arguments will be passed to :meth:`add`,
+ which will create the first subdiagram.
+
+ See Also
+ --------
+ Sankey.add
+ Sankey.finish
+
+ Examples
+ --------
+ .. plot:: gallery/specialty_plots/sankey_basics.py
+ """
+ # Check the arguments.
+ if gap < 0:
+ raise ValueError(
+ "'gap' is negative, which is not allowed because it would "
+ "cause the paths to overlap")
+ if radius > gap:
+ raise ValueError(
+ "'radius' is greater than 'gap', which is not allowed because "
+ "it would cause the paths to overlap")
+ if head_angle < 0:
+ raise ValueError(
+ "'head_angle' is negative, which is not allowed because it "
+ "would cause inputs to look like outputs and vice versa")
+ if tolerance < 0:
+ raise ValueError(
+ "'tolerance' is negative, but it must be a magnitude")
+
+ # Create axes if necessary.
+ if ax is None:
+ import matplotlib.pyplot as plt
+ fig = plt.figure()
+ ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[])
+
+ self.diagrams = []
+
+ # Store the inputs.
+ self.ax = ax
+ self.unit = unit
+ self.format = format
+ self.scale = scale
+ self.gap = gap
+ self.radius = radius
+ self.shoulder = shoulder
+ self.offset = offset
+ self.margin = margin
+ self.pitch = np.tan(np.pi * (1 - head_angle / 180.0) / 2.0)
+ self.tolerance = tolerance
+
+ # Initialize the vertices of tight box around the diagram(s).
+ self.extent = np.array((np.inf, -np.inf, np.inf, -np.inf))
+
+ # If there are any kwargs, create the first subdiagram.
+ if len(kwargs):
+ self.add(**kwargs)
+
+ def _arc(self, quadrant=0, cw=True, radius=1, center=(0, 0)):
+ """
+ Return the codes and vertices for a rotated, scaled, and translated
+ 90 degree arc.
+
+ Other Parameters
+ ----------------
+ quadrant : {0, 1, 2, 3}, default: 0
+ Uses 0-based indexing (0, 1, 2, or 3).
+ cw : bool, default: True
+ If True, the arc vertices are produced clockwise; counter-clockwise
+ otherwise.
+ radius : float, default: 1
+ The radius of the arc.
+ center : (float, float), default: (0, 0)
+ (x, y) tuple of the arc's center.
+ """
+ # Note: It would be possible to use matplotlib's transforms to rotate,
+ # scale, and translate the arc, but since the angles are discrete,
+ # it's just as easy and maybe more efficient to do it here.
+ ARC_CODES = [Path.LINETO,
+ Path.CURVE4,
+ Path.CURVE4,
+ Path.CURVE4,
+ Path.CURVE4,
+ Path.CURVE4,
+ Path.CURVE4]
+ # Vertices of a cubic Bezier curve approximating a 90 deg arc
+ # These can be determined by Path.arc(0, 90).
+ ARC_VERTICES = np.array([[1.00000000e+00, 0.00000000e+00],
+ [1.00000000e+00, 2.65114773e-01],
+ [8.94571235e-01, 5.19642327e-01],
+ [7.07106781e-01, 7.07106781e-01],
+ [5.19642327e-01, 8.94571235e-01],
+ [2.65114773e-01, 1.00000000e+00],
+ # Insignificant
+ # [6.12303177e-17, 1.00000000e+00]])
+ [0.00000000e+00, 1.00000000e+00]])
+ if quadrant == 0 or quadrant == 2:
+ if cw:
+ vertices = ARC_VERTICES
+ else:
+ vertices = ARC_VERTICES[:, ::-1] # Swap x and y.
+ elif quadrant == 1 or quadrant == 3:
+ # Negate x.
+ if cw:
+ # Swap x and y.
+ vertices = np.column_stack((-ARC_VERTICES[:, 1],
+ ARC_VERTICES[:, 0]))
+ else:
+ vertices = np.column_stack((-ARC_VERTICES[:, 0],
+ ARC_VERTICES[:, 1]))
+ if quadrant > 1:
+ radius = -radius # Rotate 180 deg.
+ return list(zip(ARC_CODES, radius * vertices +
+ np.tile(center, (ARC_VERTICES.shape[0], 1))))
+
+ def _add_input(self, path, angle, flow, length):
+ """
+ Add an input to a path and return its tip and label locations.
+ """
+ if angle is None:
+ return [0, 0], [0, 0]
+ else:
+ x, y = path[-1][1] # Use the last point as a reference.
+ dipdepth = (flow / 2) * self.pitch
+ if angle == RIGHT:
+ x -= length
+ dip = [x + dipdepth, y + flow / 2.0]
+ path.extend([(Path.LINETO, [x, y]),
+ (Path.LINETO, dip),
+ (Path.LINETO, [x, y + flow]),
+ (Path.LINETO, [x + self.gap, y + flow])])
+ label_location = [dip[0] - self.offset, dip[1]]
+ else: # Vertical
+ x -= self.gap
+ if angle == UP:
+ sign = 1
+ else:
+ sign = -1
+
+ dip = [x - flow / 2, y - sign * (length - dipdepth)]
+ if angle == DOWN:
+ quadrant = 2
+ else:
+ quadrant = 1
+
+ # Inner arc isn't needed if inner radius is zero
+ if self.radius:
+ path.extend(self._arc(quadrant=quadrant,
+ cw=angle == UP,
+ radius=self.radius,
+ center=(x + self.radius,
+ y - sign * self.radius)))
+ else:
+ path.append((Path.LINETO, [x, y]))
+ path.extend([(Path.LINETO, [x, y - sign * length]),
+ (Path.LINETO, dip),
+ (Path.LINETO, [x - flow, y - sign * length])])
+ path.extend(self._arc(quadrant=quadrant,
+ cw=angle == DOWN,
+ radius=flow + self.radius,
+ center=(x + self.radius,
+ y - sign * self.radius)))
+ path.append((Path.LINETO, [x - flow, y + sign * flow]))
+ label_location = [dip[0], dip[1] - sign * self.offset]
+
+ return dip, label_location
+
+ def _add_output(self, path, angle, flow, length):
+ """
+ Append an output to a path and return its tip and label locations.
+
+ .. note:: *flow* is negative for an output.
+ """
+ if angle is None:
+ return [0, 0], [0, 0]
+ else:
+ x, y = path[-1][1] # Use the last point as a reference.
+ tipheight = (self.shoulder - flow / 2) * self.pitch
+ if angle == RIGHT:
+ x += length
+ tip = [x + tipheight, y + flow / 2.0]
+ path.extend([(Path.LINETO, [x, y]),
+ (Path.LINETO, [x, y + self.shoulder]),
+ (Path.LINETO, tip),
+ (Path.LINETO, [x, y - self.shoulder + flow]),
+ (Path.LINETO, [x, y + flow]),
+ (Path.LINETO, [x - self.gap, y + flow])])
+ label_location = [tip[0] + self.offset, tip[1]]
+ else: # Vertical
+ x += self.gap
+ if angle == UP:
+ sign = 1
+ else:
+ sign = -1
+
+ tip = [x - flow / 2.0, y + sign * (length + tipheight)]
+ if angle == UP:
+ quadrant = 3
+ else:
+ quadrant = 0
+ # Inner arc isn't needed if inner radius is zero
+ if self.radius:
+ path.extend(self._arc(quadrant=quadrant,
+ cw=angle == UP,
+ radius=self.radius,
+ center=(x - self.radius,
+ y + sign * self.radius)))
+ else:
+ path.append((Path.LINETO, [x, y]))
+ path.extend([(Path.LINETO, [x, y + sign * length]),
+ (Path.LINETO, [x - self.shoulder,
+ y + sign * length]),
+ (Path.LINETO, tip),
+ (Path.LINETO, [x + self.shoulder - flow,
+ y + sign * length]),
+ (Path.LINETO, [x - flow, y + sign * length])])
+ path.extend(self._arc(quadrant=quadrant,
+ cw=angle == DOWN,
+ radius=self.radius - flow,
+ center=(x - self.radius,
+ y + sign * self.radius)))
+ path.append((Path.LINETO, [x - flow, y + sign * flow]))
+ label_location = [tip[0], tip[1] + sign * self.offset]
+ return tip, label_location
+
+ def _revert(self, path, first_action=Path.LINETO):
+ """
+ A path is not simply reversible by path[::-1] since the code
+ specifies an action to take from the **previous** point.
+ """
+ reverse_path = []
+ next_code = first_action
+ for code, position in path[::-1]:
+ reverse_path.append((next_code, position))
+ next_code = code
+ return reverse_path
+ # This might be more efficient, but it fails because 'tuple' object
+ # doesn't support item assignment:
+ # path[1] = path[1][-1:0:-1]
+ # path[1][0] = first_action
+ # path[2] = path[2][::-1]
+ # return path
+
+ @docstring.dedent_interpd
+ def add(self, patchlabel='', flows=None, orientations=None, labels='',
+ trunklength=1.0, pathlengths=0.25, prior=None, connect=(0, 0),
+ rotation=0, **kwargs):
+ """
+ Add a simple Sankey diagram with flows at the same hierarchical level.
+
+ Parameters
+ ----------
+ patchlabel : str
+ Label to be placed at the center of the diagram.
+ Note that *label* (not *patchlabel*) can be passed as keyword
+ argument to create an entry in the legend.
+
+ flows : list of float
+ Array of flow values. By convention, inputs are positive and
+ outputs are negative.
+
+ Flows are placed along the top of the diagram from the inside out
+ in order of their index within *flows*. They are placed along the
+ sides of the diagram from the top down and along the bottom from
+ the outside in.
+
+ If the sum of the inputs and outputs is
+ nonzero, the discrepancy will appear as a cubic Bezier curve along
+ the top and bottom edges of the trunk.
+
+ orientations : list of {-1, 0, 1}
+ List of orientations of the flows (or a single orientation to be
+ used for all flows). Valid values are 0 (inputs from
+ the left, outputs to the right), 1 (from and to the top) or -1
+ (from and to the bottom).
+
+ labels : list of (str or None)
+ List of labels for the flows (or a single label to be used for all
+ flows). Each label may be *None* (no label), or a labeling string.
+ If an entry is a (possibly empty) string, then the quantity for the
+ corresponding flow will be shown below the string. However, if
+ the *unit* of the main diagram is None, then quantities are never
+ shown, regardless of the value of this argument.
+
+ trunklength : float
+ Length between the bases of the input and output groups (in
+ data-space units).
+
+ pathlengths : list of float
+ List of lengths of the vertical arrows before break-in or after
+ break-away. If a single value is given, then it will be applied to
+ the first (inside) paths on the top and bottom, and the length of
+ all other arrows will be justified accordingly. The *pathlengths*
+ are not applied to the horizontal inputs and outputs.
+
+ prior : int
+ Index of the prior diagram to which this diagram should be
+ connected.
+
+ connect : (int, int)
+ A (prior, this) tuple indexing the flow of the prior diagram and
+ the flow of this diagram which should be connected. If this is the
+ first diagram or *prior* is *None*, *connect* will be ignored.
+
+ rotation : float
+ Angle of rotation of the diagram in degrees. The interpretation of
+ the *orientations* argument will be rotated accordingly (e.g., if
+ *rotation* == 90, an *orientations* entry of 1 means to/from the
+ left). *rotation* is ignored if this diagram is connected to an
+ existing one (using *prior* and *connect*).
+
+ Returns
+ -------
+ Sankey
+ The current `.Sankey` instance.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Additional keyword arguments set `matplotlib.patches.PathPatch`
+ properties, listed below. For example, one may want to use
+ ``fill=False`` or ``label="A legend entry"``.
+
+ %(Patch_kwdoc)s
+
+ See Also
+ --------
+ Sankey.finish
+ """
+ # Check and preprocess the arguments.
+ if flows is None:
+ flows = np.array([1.0, -1.0])
+ else:
+ flows = np.array(flows)
+ n = flows.shape[0] # Number of flows
+ if rotation is None:
+ rotation = 0
+ else:
+ # In the code below, angles are expressed in deg/90.
+ rotation /= 90.0
+ if orientations is None:
+ orientations = 0
+ try:
+ orientations = np.broadcast_to(orientations, n)
+ except ValueError:
+ raise ValueError(
+ f"The shapes of 'flows' {np.shape(flows)} and 'orientations' "
+ f"{np.shape(orientations)} are incompatible"
+ ) from None
+ try:
+ labels = np.broadcast_to(labels, n)
+ except ValueError:
+ raise ValueError(
+ f"The shapes of 'flows' {np.shape(flows)} and 'labels' "
+ f"{np.shape(labels)} are incompatible"
+ ) from None
+ if trunklength < 0:
+ raise ValueError(
+ "'trunklength' is negative, which is not allowed because it "
+ "would cause poor layout")
+ if abs(np.sum(flows)) > self.tolerance:
+ _log.info("The sum of the flows is nonzero (%f; patchlabel=%r); "
+ "is the system not at steady state?",
+ np.sum(flows), patchlabel)
+ scaled_flows = self.scale * flows
+ gain = sum(max(flow, 0) for flow in scaled_flows)
+ loss = sum(min(flow, 0) for flow in scaled_flows)
+ if prior is not None:
+ if prior < 0:
+ raise ValueError("The index of the prior diagram is negative")
+ if min(connect) < 0:
+ raise ValueError(
+ "At least one of the connection indices is negative")
+ if prior >= len(self.diagrams):
+ raise ValueError(
+ f"The index of the prior diagram is {prior}, but there "
+ f"are only {len(self.diagrams)} other diagrams")
+ if connect[0] >= len(self.diagrams[prior].flows):
+ raise ValueError(
+ "The connection index to the source diagram is {}, but "
+ "that diagram has only {} flows".format(
+ connect[0], len(self.diagrams[prior].flows)))
+ if connect[1] >= n:
+ raise ValueError(
+ f"The connection index to this diagram is {connect[1]}, "
+ f"but this diagram has only {n} flows")
+ if self.diagrams[prior].angles[connect[0]] is None:
+ raise ValueError(
+ f"The connection cannot be made, which may occur if the "
+ f"magnitude of flow {connect[0]} of diagram {prior} is "
+ f"less than the specified tolerance")
+ flow_error = (self.diagrams[prior].flows[connect[0]] +
+ flows[connect[1]])
+ if abs(flow_error) >= self.tolerance:
+ raise ValueError(
+ f"The scaled sum of the connected flows is {flow_error}, "
+ f"which is not within the tolerance ({self.tolerance})")
+
+ # Determine if the flows are inputs.
+ are_inputs = [None] * n
+ for i, flow in enumerate(flows):
+ if flow >= self.tolerance:
+ are_inputs[i] = True
+ elif flow <= -self.tolerance:
+ are_inputs[i] = False
+ else:
+ _log.info(
+ "The magnitude of flow %d (%f) is below the tolerance "
+ "(%f).\nIt will not be shown, and it cannot be used in a "
+ "connection.", i, flow, self.tolerance)
+
+ # Determine the angles of the arrows (before rotation).
+ angles = [None] * n
+ for i, (orient, is_input) in enumerate(zip(orientations, are_inputs)):
+ if orient == 1:
+ if is_input:
+ angles[i] = DOWN
+ elif not is_input:
+ # Be specific since is_input can be None.
+ angles[i] = UP
+ elif orient == 0:
+ if is_input is not None:
+ angles[i] = RIGHT
+ else:
+ if orient != -1:
+ raise ValueError(
+ f"The value of orientations[{i}] is {orient}, "
+ f"but it must be -1, 0, or 1")
+ if is_input:
+ angles[i] = UP
+ elif not is_input:
+ angles[i] = DOWN
+
+ # Justify the lengths of the paths.
+ if np.iterable(pathlengths):
+ if len(pathlengths) != n:
+ raise ValueError(
+ f"The lengths of 'flows' ({n}) and 'pathlengths' "
+ f"({len(pathlengths)}) are incompatible")
+ else: # Make pathlengths into a list.
+ urlength = pathlengths
+ ullength = pathlengths
+ lrlength = pathlengths
+ lllength = pathlengths
+ d = dict(RIGHT=pathlengths)
+ pathlengths = [d.get(angle, 0) for angle in angles]
+ # Determine the lengths of the top-side arrows
+ # from the middle outwards.
+ for i, (angle, is_input, flow) in enumerate(zip(angles, are_inputs,
+ scaled_flows)):
+ if angle == DOWN and is_input:
+ pathlengths[i] = ullength
+ ullength += flow
+ elif angle == UP and not is_input:
+ pathlengths[i] = urlength
+ urlength -= flow # Flow is negative for outputs.
+ # Determine the lengths of the bottom-side arrows
+ # from the middle outwards.
+ for i, (angle, is_input, flow) in enumerate(reversed(list(zip(
+ angles, are_inputs, scaled_flows)))):
+ if angle == UP and is_input:
+ pathlengths[n - i - 1] = lllength
+ lllength += flow
+ elif angle == DOWN and not is_input:
+ pathlengths[n - i - 1] = lrlength
+ lrlength -= flow
+ # Determine the lengths of the left-side arrows
+ # from the bottom upwards.
+ has_left_input = False
+ for i, (angle, is_input, spec) in enumerate(reversed(list(zip(
+ angles, are_inputs, zip(scaled_flows, pathlengths))))):
+ if angle == RIGHT:
+ if is_input:
+ if has_left_input:
+ pathlengths[n - i - 1] = 0
+ else:
+ has_left_input = True
+ # Determine the lengths of the right-side arrows
+ # from the top downwards.
+ has_right_output = False
+ for i, (angle, is_input, spec) in enumerate(zip(
+ angles, are_inputs, list(zip(scaled_flows, pathlengths)))):
+ if angle == RIGHT:
+ if not is_input:
+ if has_right_output:
+ pathlengths[i] = 0
+ else:
+ has_right_output = True
+
+ # Begin the subpaths, and smooth the transition if the sum of the flows
+ # is nonzero.
+ urpath = [(Path.MOVETO, [(self.gap - trunklength / 2.0), # Upper right
+ gain / 2.0]),
+ (Path.LINETO, [(self.gap - trunklength / 2.0) / 2.0,
+ gain / 2.0]),
+ (Path.CURVE4, [(self.gap - trunklength / 2.0) / 8.0,
+ gain / 2.0]),
+ (Path.CURVE4, [(trunklength / 2.0 - self.gap) / 8.0,
+ -loss / 2.0]),
+ (Path.LINETO, [(trunklength / 2.0 - self.gap) / 2.0,
+ -loss / 2.0]),
+ (Path.LINETO, [(trunklength / 2.0 - self.gap),
+ -loss / 2.0])]
+ llpath = [(Path.LINETO, [(trunklength / 2.0 - self.gap), # Lower left
+ loss / 2.0]),
+ (Path.LINETO, [(trunklength / 2.0 - self.gap) / 2.0,
+ loss / 2.0]),
+ (Path.CURVE4, [(trunklength / 2.0 - self.gap) / 8.0,
+ loss / 2.0]),
+ (Path.CURVE4, [(self.gap - trunklength / 2.0) / 8.0,
+ -gain / 2.0]),
+ (Path.LINETO, [(self.gap - trunklength / 2.0) / 2.0,
+ -gain / 2.0]),
+ (Path.LINETO, [(self.gap - trunklength / 2.0),
+ -gain / 2.0])]
+ lrpath = [(Path.LINETO, [(trunklength / 2.0 - self.gap), # Lower right
+ loss / 2.0])]
+ ulpath = [(Path.LINETO, [self.gap - trunklength / 2.0, # Upper left
+ gain / 2.0])]
+
+ # Add the subpaths and assign the locations of the tips and labels.
+ tips = np.zeros((n, 2))
+ label_locations = np.zeros((n, 2))
+ # Add the top-side inputs and outputs from the middle outwards.
+ for i, (angle, is_input, spec) in enumerate(zip(
+ angles, are_inputs, list(zip(scaled_flows, pathlengths)))):
+ if angle == DOWN and is_input:
+ tips[i, :], label_locations[i, :] = self._add_input(
+ ulpath, angle, *spec)
+ elif angle == UP and not is_input:
+ tips[i, :], label_locations[i, :] = self._add_output(
+ urpath, angle, *spec)
+ # Add the bottom-side inputs and outputs from the middle outwards.
+ for i, (angle, is_input, spec) in enumerate(reversed(list(zip(
+ angles, are_inputs, list(zip(scaled_flows, pathlengths)))))):
+ if angle == UP and is_input:
+ tip, label_location = self._add_input(llpath, angle, *spec)
+ tips[n - i - 1, :] = tip
+ label_locations[n - i - 1, :] = label_location
+ elif angle == DOWN and not is_input:
+ tip, label_location = self._add_output(lrpath, angle, *spec)
+ tips[n - i - 1, :] = tip
+ label_locations[n - i - 1, :] = label_location
+ # Add the left-side inputs from the bottom upwards.
+ has_left_input = False
+ for i, (angle, is_input, spec) in enumerate(reversed(list(zip(
+ angles, are_inputs, list(zip(scaled_flows, pathlengths)))))):
+ if angle == RIGHT and is_input:
+ if not has_left_input:
+ # Make sure the lower path extends
+ # at least as far as the upper one.
+ if llpath[-1][1][0] > ulpath[-1][1][0]:
+ llpath.append((Path.LINETO, [ulpath[-1][1][0],
+ llpath[-1][1][1]]))
+ has_left_input = True
+ tip, label_location = self._add_input(llpath, angle, *spec)
+ tips[n - i - 1, :] = tip
+ label_locations[n - i - 1, :] = label_location
+ # Add the right-side outputs from the top downwards.
+ has_right_output = False
+ for i, (angle, is_input, spec) in enumerate(zip(
+ angles, are_inputs, list(zip(scaled_flows, pathlengths)))):
+ if angle == RIGHT and not is_input:
+ if not has_right_output:
+ # Make sure the upper path extends
+ # at least as far as the lower one.
+ if urpath[-1][1][0] < lrpath[-1][1][0]:
+ urpath.append((Path.LINETO, [lrpath[-1][1][0],
+ urpath[-1][1][1]]))
+ has_right_output = True
+ tips[i, :], label_locations[i, :] = self._add_output(
+ urpath, angle, *spec)
+ # Trim any hanging vertices.
+ if not has_left_input:
+ ulpath.pop()
+ llpath.pop()
+ if not has_right_output:
+ lrpath.pop()
+ urpath.pop()
+
+ # Concatenate the subpaths in the correct order (clockwise from top).
+ path = (urpath + self._revert(lrpath) + llpath + self._revert(ulpath) +
+ [(Path.CLOSEPOLY, urpath[0][1])])
+
+ # Create a patch with the Sankey outline.
+ codes, vertices = zip(*path)
+ vertices = np.array(vertices)
+
+ def _get_angle(a, r):
+ if a is None:
+ return None
+ else:
+ return a + r
+
+ if prior is None:
+ if rotation != 0: # By default, none of this is needed.
+ angles = [_get_angle(angle, rotation) for angle in angles]
+ rotate = Affine2D().rotate_deg(rotation * 90).transform_affine
+ tips = rotate(tips)
+ label_locations = rotate(label_locations)
+ vertices = rotate(vertices)
+ text = self.ax.text(0, 0, s=patchlabel, ha='center', va='center')
+ else:
+ rotation = (self.diagrams[prior].angles[connect[0]] -
+ angles[connect[1]])
+ angles = [_get_angle(angle, rotation) for angle in angles]
+ rotate = Affine2D().rotate_deg(rotation * 90).transform_affine
+ tips = rotate(tips)
+ offset = self.diagrams[prior].tips[connect[0]] - tips[connect[1]]
+ translate = Affine2D().translate(*offset).transform_affine
+ tips = translate(tips)
+ label_locations = translate(rotate(label_locations))
+ vertices = translate(rotate(vertices))
+ kwds = dict(s=patchlabel, ha='center', va='center')
+ text = self.ax.text(*offset, **kwds)
+ if mpl.rcParams['_internal.classic_mode']:
+ fc = kwargs.pop('fc', kwargs.pop('facecolor', '#bfd1d4'))
+ lw = kwargs.pop('lw', kwargs.pop('linewidth', 0.5))
+ else:
+ fc = kwargs.pop('fc', kwargs.pop('facecolor', None))
+ lw = kwargs.pop('lw', kwargs.pop('linewidth', None))
+ if fc is None:
+ fc = next(self.ax._get_patches_for_fill.prop_cycler)['color']
+ patch = PathPatch(Path(vertices, codes), fc=fc, lw=lw, **kwargs)
+ self.ax.add_patch(patch)
+
+ # Add the path labels.
+ texts = []
+ for number, angle, label, location in zip(flows, angles, labels,
+ label_locations):
+ if label is None or angle is None:
+ label = ''
+ elif self.unit is not None:
+ if isinstance(self.format, str):
+ quantity = self.format % abs(number) + self.unit
+ elif callable(self.format):
+ quantity = self.format(number)
+ else:
+ raise TypeError(
+ 'format must be callable or a format string')
+ if label != '':
+ label += "\n"
+ label += quantity
+ texts.append(self.ax.text(x=location[0], y=location[1],
+ s=label,
+ ha='center', va='center'))
+ # Text objects are placed even they are empty (as long as the magnitude
+ # of the corresponding flow is larger than the tolerance) in case the
+ # user wants to provide labels later.
+
+ # Expand the size of the diagram if necessary.
+ self.extent = (min(np.min(vertices[:, 0]),
+ np.min(label_locations[:, 0]),
+ self.extent[0]),
+ max(np.max(vertices[:, 0]),
+ np.max(label_locations[:, 0]),
+ self.extent[1]),
+ min(np.min(vertices[:, 1]),
+ np.min(label_locations[:, 1]),
+ self.extent[2]),
+ max(np.max(vertices[:, 1]),
+ np.max(label_locations[:, 1]),
+ self.extent[3]))
+ # Include both vertices _and_ label locations in the extents; there are
+ # where either could determine the margins (e.g., arrow shoulders).
+
+ # Add this diagram as a subdiagram.
+ self.diagrams.append(
+ SimpleNamespace(patch=patch, flows=flows, angles=angles, tips=tips,
+ text=text, texts=texts))
+
+ # Allow a daisy-chained call structure (see docstring for the class).
+ return self
+
+ def finish(self):
+ """
+ Adjust the axes and return a list of information about the Sankey
+ subdiagram(s).
+
+ Return value is a list of subdiagrams represented with the following
+ fields:
+
+ =============== ===================================================
+ Field Description
+ =============== ===================================================
+ *patch* Sankey outline (an instance of
+ :class:`~matplotlib.patches.PathPatch`)
+ *flows* values of the flows (positive for input, negative
+ for output)
+ *angles* list of angles of the arrows [deg/90]
+ For example, if the diagram has not been rotated,
+ an input to the top side will have an angle of 3
+ (DOWN), and an output from the top side will have
+ an angle of 1 (UP). If a flow has been skipped
+ (because its magnitude is less than *tolerance*),
+ then its angle will be *None*.
+ *tips* array in which each row is an [x, y] pair
+ indicating the positions of the tips (or "dips") of
+ the flow paths
+ If the magnitude of a flow is less the *tolerance*
+ for the instance of :class:`Sankey`, the flow is
+ skipped and its tip will be at the center of the
+ diagram.
+ *text* :class:`~matplotlib.text.Text` instance for the
+ label of the diagram
+ *texts* list of :class:`~matplotlib.text.Text` instances
+ for the labels of flows
+ =============== ===================================================
+
+ See Also
+ --------
+ Sankey.add
+ """
+ self.ax.axis([self.extent[0] - self.margin,
+ self.extent[1] + self.margin,
+ self.extent[2] - self.margin,
+ self.extent[3] + self.margin])
+ self.ax.set_aspect('equal', adjustable='datalim')
+ return self.diagrams
diff --git a/venv/Lib/site-packages/matplotlib/scale.py b/venv/Lib/site-packages/matplotlib/scale.py
new file mode 100644
index 0000000..7c90369
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/scale.py
@@ -0,0 +1,670 @@
+"""
+Scales define the distribution of data values on an axis, e.g. a log scaling.
+
+They are attached to an `~.axis.Axis` and hold a `.Transform`, which is
+responsible for the actual data transformation.
+
+See also `.axes.Axes.set_xscale` and the scales examples in the documentation.
+"""
+
+import inspect
+import textwrap
+
+import numpy as np
+from numpy import ma
+
+import matplotlib as mpl
+from matplotlib import _api, docstring
+from matplotlib.ticker import (
+ NullFormatter, ScalarFormatter, LogFormatterSciNotation, LogitFormatter,
+ NullLocator, LogLocator, AutoLocator, AutoMinorLocator,
+ SymmetricalLogLocator, LogitLocator)
+from matplotlib.transforms import Transform, IdentityTransform
+
+
+class ScaleBase:
+ """
+ The base class for all scales.
+
+ Scales are separable transformations, working on a single dimension.
+
+ Any subclasses will want to override:
+
+ - :attr:`name`
+ - :meth:`get_transform`
+ - :meth:`set_default_locators_and_formatters`
+
+ And optionally:
+
+ - :meth:`limit_range_for_scale`
+
+ """
+
+ def __init__(self, axis):
+ r"""
+ Construct a new scale.
+
+ Notes
+ -----
+ The following note is for scale implementors.
+
+ For back-compatibility reasons, scales take an `~matplotlib.axis.Axis`
+ object as first argument. However, this argument should not
+ be used: a single scale object should be usable by multiple
+ `~matplotlib.axis.Axis`\es at the same time.
+ """
+
+ def get_transform(self):
+ """
+ Return the :class:`~matplotlib.transforms.Transform` object
+ associated with this scale.
+ """
+ raise NotImplementedError()
+
+ def set_default_locators_and_formatters(self, axis):
+ """
+ Set the locators and formatters of *axis* to instances suitable for
+ this scale.
+ """
+ raise NotImplementedError()
+
+ def limit_range_for_scale(self, vmin, vmax, minpos):
+ """
+ Return the range *vmin*, *vmax*, restricted to the
+ domain supported by this scale (if any).
+
+ *minpos* should be the minimum positive value in the data.
+ This is used by log scales to determine a minimum value.
+ """
+ return vmin, vmax
+
+
+class LinearScale(ScaleBase):
+ """
+ The default linear scale.
+ """
+
+ name = 'linear'
+
+ def __init__(self, axis):
+ # This method is present only to prevent inheritance of the base class'
+ # constructor docstring, which would otherwise end up interpolated into
+ # the docstring of Axis.set_scale.
+ """
+ """
+
+ def set_default_locators_and_formatters(self, axis):
+ # docstring inherited
+ axis.set_major_locator(AutoLocator())
+ axis.set_major_formatter(ScalarFormatter())
+ axis.set_minor_formatter(NullFormatter())
+ # update the minor locator for x and y axis based on rcParams
+ if (axis.axis_name == 'x' and mpl.rcParams['xtick.minor.visible'] or
+ axis.axis_name == 'y' and mpl.rcParams['ytick.minor.visible']):
+ axis.set_minor_locator(AutoMinorLocator())
+ else:
+ axis.set_minor_locator(NullLocator())
+
+ def get_transform(self):
+ """
+ Return the transform for linear scaling, which is just the
+ `~matplotlib.transforms.IdentityTransform`.
+ """
+ return IdentityTransform()
+
+
+class FuncTransform(Transform):
+ """
+ A simple transform that takes and arbitrary function for the
+ forward and inverse transform.
+ """
+
+ input_dims = output_dims = 1
+
+ def __init__(self, forward, inverse):
+ """
+ Parameters
+ ----------
+ forward : callable
+ The forward function for the transform. This function must have
+ an inverse and, for best behavior, be monotonic.
+ It must have the signature::
+
+ def forward(values: array-like) -> array-like
+
+ inverse : callable
+ The inverse of the forward function. Signature as ``forward``.
+ """
+ super().__init__()
+ if callable(forward) and callable(inverse):
+ self._forward = forward
+ self._inverse = inverse
+ else:
+ raise ValueError('arguments to FuncTransform must be functions')
+
+ def transform_non_affine(self, values):
+ return self._forward(values)
+
+ def inverted(self):
+ return FuncTransform(self._inverse, self._forward)
+
+
+class FuncScale(ScaleBase):
+ """
+ Provide an arbitrary scale with user-supplied function for the axis.
+ """
+
+ name = 'function'
+
+ def __init__(self, axis, functions):
+ """
+ Parameters
+ ----------
+ axis : `~matplotlib.axis.Axis`
+ The axis for the scale.
+ functions : (callable, callable)
+ two-tuple of the forward and inverse functions for the scale.
+ The forward function must be monotonic.
+
+ Both functions must have the signature::
+
+ def forward(values: array-like) -> array-like
+ """
+ forward, inverse = functions
+ transform = FuncTransform(forward, inverse)
+ self._transform = transform
+
+ def get_transform(self):
+ """Return the `.FuncTransform` associated with this scale."""
+ return self._transform
+
+ def set_default_locators_and_formatters(self, axis):
+ # docstring inherited
+ axis.set_major_locator(AutoLocator())
+ axis.set_major_formatter(ScalarFormatter())
+ axis.set_minor_formatter(NullFormatter())
+ # update the minor locator for x and y axis based on rcParams
+ if (axis.axis_name == 'x' and mpl.rcParams['xtick.minor.visible'] or
+ axis.axis_name == 'y' and mpl.rcParams['ytick.minor.visible']):
+ axis.set_minor_locator(AutoMinorLocator())
+ else:
+ axis.set_minor_locator(NullLocator())
+
+
+class LogTransform(Transform):
+ input_dims = output_dims = 1
+
+ @_api.rename_parameter("3.3", "nonpos", "nonpositive")
+ def __init__(self, base, nonpositive='clip'):
+ super().__init__()
+ if base <= 0 or base == 1:
+ raise ValueError('The log base cannot be <= 0 or == 1')
+ self.base = base
+ self._clip = _api.check_getitem(
+ {"clip": True, "mask": False}, nonpositive=nonpositive)
+
+ def __str__(self):
+ return "{}(base={}, nonpositive={!r})".format(
+ type(self).__name__, self.base, "clip" if self._clip else "mask")
+
+ def transform_non_affine(self, a):
+ # Ignore invalid values due to nans being passed to the transform.
+ with np.errstate(divide="ignore", invalid="ignore"):
+ log = {np.e: np.log, 2: np.log2, 10: np.log10}.get(self.base)
+ if log: # If possible, do everything in a single call to NumPy.
+ out = log(a)
+ else:
+ out = np.log(a)
+ out /= np.log(self.base)
+ if self._clip:
+ # SVG spec says that conforming viewers must support values up
+ # to 3.4e38 (C float); however experiments suggest that
+ # Inkscape (which uses cairo for rendering) runs into cairo's
+ # 24-bit limit (which is apparently shared by Agg).
+ # Ghostscript (used for pdf rendering appears to overflow even
+ # earlier, with the max value around 2 ** 15 for the tests to
+ # pass. On the other hand, in practice, we want to clip beyond
+ # np.log10(np.nextafter(0, 1)) ~ -323
+ # so 1000 seems safe.
+ out[a <= 0] = -1000
+ return out
+
+ def inverted(self):
+ return InvertedLogTransform(self.base)
+
+
+class InvertedLogTransform(Transform):
+ input_dims = output_dims = 1
+
+ def __init__(self, base):
+ super().__init__()
+ self.base = base
+
+ def __str__(self):
+ return "{}(base={})".format(type(self).__name__, self.base)
+
+ def transform_non_affine(self, a):
+ return ma.power(self.base, a)
+
+ def inverted(self):
+ return LogTransform(self.base)
+
+
+class LogScale(ScaleBase):
+ """
+ A standard logarithmic scale. Care is taken to only plot positive values.
+ """
+ name = 'log'
+
+ @_api.deprecated("3.3", alternative="scale.LogTransform")
+ @property
+ def LogTransform(self):
+ return LogTransform
+
+ @_api.deprecated("3.3", alternative="scale.InvertedLogTransform")
+ @property
+ def InvertedLogTransform(self):
+ return InvertedLogTransform
+
+ def __init__(self, axis, **kwargs):
+ """
+ Parameters
+ ----------
+ axis : `~matplotlib.axis.Axis`
+ The axis for the scale.
+ base : float, default: 10
+ The base of the logarithm.
+ nonpositive : {'clip', 'mask'}, default: 'clip'
+ Determines the behavior for non-positive values. They can either
+ be masked as invalid, or clipped to a very small positive number.
+ subs : sequence of int, default: None
+ Where to place the subticks between each major tick. For example,
+ in a log10 scale, ``[2, 3, 4, 5, 6, 7, 8, 9]`` will place 8
+ logarithmically spaced minor ticks between each major tick.
+ """
+ # After the deprecation, the whole (outer) __init__ can be replaced by
+ # def __init__(self, axis, *, base=10, subs=None, nonpositive="clip")
+ # The following is to emit the right warnings depending on the axis
+ # used, as the *old* kwarg names depended on the axis.
+ axis_name = getattr(axis, "axis_name", "x")
+ @_api.rename_parameter("3.3", f"base{axis_name}", "base")
+ @_api.rename_parameter("3.3", f"subs{axis_name}", "subs")
+ @_api.rename_parameter("3.3", f"nonpos{axis_name}", "nonpositive")
+ def __init__(*, base=10, subs=None, nonpositive="clip"):
+ return base, subs, nonpositive
+
+ base, subs, nonpositive = __init__(**kwargs)
+ self._transform = LogTransform(base, nonpositive)
+ self.subs = subs
+
+ base = property(lambda self: self._transform.base)
+
+ def set_default_locators_and_formatters(self, axis):
+ # docstring inherited
+ axis.set_major_locator(LogLocator(self.base))
+ axis.set_major_formatter(LogFormatterSciNotation(self.base))
+ axis.set_minor_locator(LogLocator(self.base, self.subs))
+ axis.set_minor_formatter(
+ LogFormatterSciNotation(self.base,
+ labelOnlyBase=(self.subs is not None)))
+
+ def get_transform(self):
+ """Return the `.LogTransform` associated with this scale."""
+ return self._transform
+
+ def limit_range_for_scale(self, vmin, vmax, minpos):
+ """Limit the domain to positive values."""
+ if not np.isfinite(minpos):
+ minpos = 1e-300 # Should rarely (if ever) have a visible effect.
+
+ return (minpos if vmin <= 0 else vmin,
+ minpos if vmax <= 0 else vmax)
+
+
+class FuncScaleLog(LogScale):
+ """
+ Provide an arbitrary scale with user-supplied function for the axis and
+ then put on a logarithmic axes.
+ """
+
+ name = 'functionlog'
+
+ def __init__(self, axis, functions, base=10):
+ """
+ Parameters
+ ----------
+ axis : `matplotlib.axis.Axis`
+ The axis for the scale.
+ functions : (callable, callable)
+ two-tuple of the forward and inverse functions for the scale.
+ The forward function must be monotonic.
+
+ Both functions must have the signature::
+
+ def forward(values: array-like) -> array-like
+
+ base : float, default: 10
+ Logarithmic base of the scale.
+ """
+ forward, inverse = functions
+ self.subs = None
+ self._transform = FuncTransform(forward, inverse) + LogTransform(base)
+
+ @property
+ def base(self):
+ return self._transform._b.base # Base of the LogTransform.
+
+ def get_transform(self):
+ """Return the `.Transform` associated with this scale."""
+ return self._transform
+
+
+class SymmetricalLogTransform(Transform):
+ input_dims = output_dims = 1
+
+ def __init__(self, base, linthresh, linscale):
+ super().__init__()
+ if base <= 1.0:
+ raise ValueError("'base' must be larger than 1")
+ if linthresh <= 0.0:
+ raise ValueError("'linthresh' must be positive")
+ if linscale <= 0.0:
+ raise ValueError("'linscale' must be positive")
+ self.base = base
+ self.linthresh = linthresh
+ self.linscale = linscale
+ self._linscale_adj = (linscale / (1.0 - self.base ** -1))
+ self._log_base = np.log(base)
+
+ def transform_non_affine(self, a):
+ abs_a = np.abs(a)
+ with np.errstate(divide="ignore", invalid="ignore"):
+ out = np.sign(a) * self.linthresh * (
+ self._linscale_adj +
+ np.log(abs_a / self.linthresh) / self._log_base)
+ inside = abs_a <= self.linthresh
+ out[inside] = a[inside] * self._linscale_adj
+ return out
+
+ def inverted(self):
+ return InvertedSymmetricalLogTransform(self.base, self.linthresh,
+ self.linscale)
+
+
+class InvertedSymmetricalLogTransform(Transform):
+ input_dims = output_dims = 1
+
+ def __init__(self, base, linthresh, linscale):
+ super().__init__()
+ symlog = SymmetricalLogTransform(base, linthresh, linscale)
+ self.base = base
+ self.linthresh = linthresh
+ self.invlinthresh = symlog.transform(linthresh)
+ self.linscale = linscale
+ self._linscale_adj = (linscale / (1.0 - self.base ** -1))
+
+ def transform_non_affine(self, a):
+ abs_a = np.abs(a)
+ with np.errstate(divide="ignore", invalid="ignore"):
+ out = np.sign(a) * self.linthresh * (
+ np.power(self.base,
+ abs_a / self.linthresh - self._linscale_adj))
+ inside = abs_a <= self.invlinthresh
+ out[inside] = a[inside] / self._linscale_adj
+ return out
+
+ def inverted(self):
+ return SymmetricalLogTransform(self.base,
+ self.linthresh, self.linscale)
+
+
+class SymmetricalLogScale(ScaleBase):
+ """
+ The symmetrical logarithmic scale is logarithmic in both the
+ positive and negative directions from the origin.
+
+ Since the values close to zero tend toward infinity, there is a
+ need to have a range around zero that is linear. The parameter
+ *linthresh* allows the user to specify the size of this range
+ (-*linthresh*, *linthresh*).
+
+ Parameters
+ ----------
+ base : float, default: 10
+ The base of the logarithm.
+
+ linthresh : float, default: 2
+ Defines the range ``(-x, x)``, within which the plot is linear.
+ This avoids having the plot go to infinity around zero.
+
+ subs : sequence of int
+ Where to place the subticks between each major tick.
+ For example, in a log10 scale: ``[2, 3, 4, 5, 6, 7, 8, 9]`` will place
+ 8 logarithmically spaced minor ticks between each major tick.
+
+ linscale : float, optional
+ This allows the linear range ``(-linthresh, linthresh)`` to be
+ stretched relative to the logarithmic range. Its value is the number of
+ decades to use for each half of the linear range. For example, when
+ *linscale* == 1.0 (the default), the space used for the positive and
+ negative halves of the linear range will be equal to one decade in
+ the logarithmic range.
+ """
+ name = 'symlog'
+
+ @_api.deprecated("3.3", alternative="scale.SymmetricalLogTransform")
+ @property
+ def SymmetricalLogTransform(self):
+ return SymmetricalLogTransform
+
+ @_api.deprecated(
+ "3.3", alternative="scale.InvertedSymmetricalLogTransform")
+ @property
+ def InvertedSymmetricalLogTransform(self):
+ return InvertedSymmetricalLogTransform
+
+ def __init__(self, axis, **kwargs):
+ axis_name = getattr(axis, "axis_name", "x")
+ # See explanation in LogScale.__init__.
+ @_api.rename_parameter("3.3", f"base{axis_name}", "base")
+ @_api.rename_parameter("3.3", f"linthresh{axis_name}", "linthresh")
+ @_api.rename_parameter("3.3", f"subs{axis_name}", "subs")
+ @_api.rename_parameter("3.3", f"linscale{axis_name}", "linscale")
+ def __init__(*, base=10, linthresh=2, subs=None, linscale=1):
+ return base, linthresh, subs, linscale
+
+ base, linthresh, subs, linscale = __init__(**kwargs)
+ self._transform = SymmetricalLogTransform(base, linthresh, linscale)
+ self.subs = subs
+
+ base = property(lambda self: self._transform.base)
+ linthresh = property(lambda self: self._transform.linthresh)
+ linscale = property(lambda self: self._transform.linscale)
+
+ def set_default_locators_and_formatters(self, axis):
+ # docstring inherited
+ axis.set_major_locator(SymmetricalLogLocator(self.get_transform()))
+ axis.set_major_formatter(LogFormatterSciNotation(self.base))
+ axis.set_minor_locator(SymmetricalLogLocator(self.get_transform(),
+ self.subs))
+ axis.set_minor_formatter(NullFormatter())
+
+ def get_transform(self):
+ """Return the `.SymmetricalLogTransform` associated with this scale."""
+ return self._transform
+
+
+class LogitTransform(Transform):
+ input_dims = output_dims = 1
+
+ @_api.rename_parameter("3.3", "nonpos", "nonpositive")
+ def __init__(self, nonpositive='mask'):
+ super().__init__()
+ _api.check_in_list(['mask', 'clip'], nonpositive=nonpositive)
+ self._nonpositive = nonpositive
+ self._clip = {"clip": True, "mask": False}[nonpositive]
+
+ def transform_non_affine(self, a):
+ """logit transform (base 10), masked or clipped"""
+ with np.errstate(divide="ignore", invalid="ignore"):
+ out = np.log10(a / (1 - a))
+ if self._clip: # See LogTransform for choice of clip value.
+ out[a <= 0] = -1000
+ out[1 <= a] = 1000
+ return out
+
+ def inverted(self):
+ return LogisticTransform(self._nonpositive)
+
+ def __str__(self):
+ return "{}({!r})".format(type(self).__name__, self._nonpositive)
+
+
+class LogisticTransform(Transform):
+ input_dims = output_dims = 1
+
+ @_api.rename_parameter("3.3", "nonpos", "nonpositive")
+ def __init__(self, nonpositive='mask'):
+ super().__init__()
+ self._nonpositive = nonpositive
+
+ def transform_non_affine(self, a):
+ """logistic transform (base 10)"""
+ return 1.0 / (1 + 10**(-a))
+
+ def inverted(self):
+ return LogitTransform(self._nonpositive)
+
+ def __str__(self):
+ return "{}({!r})".format(type(self).__name__, self._nonpositive)
+
+
+class LogitScale(ScaleBase):
+ """
+ Logit scale for data between zero and one, both excluded.
+
+ This scale is similar to a log scale close to zero and to one, and almost
+ linear around 0.5. It maps the interval ]0, 1[ onto ]-infty, +infty[.
+ """
+ name = 'logit'
+
+ @_api.rename_parameter("3.3", "nonpos", "nonpositive")
+ def __init__(self, axis, nonpositive='mask', *,
+ one_half=r"\frac{1}{2}", use_overline=False):
+ r"""
+ Parameters
+ ----------
+ axis : `matplotlib.axis.Axis`
+ Currently unused.
+ nonpositive : {'mask', 'clip'}
+ Determines the behavior for values beyond the open interval ]0, 1[.
+ They can either be masked as invalid, or clipped to a number very
+ close to 0 or 1.
+ use_overline : bool, default: False
+ Indicate the usage of survival notation (\overline{x}) in place of
+ standard notation (1-x) for probability close to one.
+ one_half : str, default: r"\frac{1}{2}"
+ The string used for ticks formatter to represent 1/2.
+ """
+ self._transform = LogitTransform(nonpositive)
+ self._use_overline = use_overline
+ self._one_half = one_half
+
+ def get_transform(self):
+ """Return the `.LogitTransform` associated with this scale."""
+ return self._transform
+
+ def set_default_locators_and_formatters(self, axis):
+ # docstring inherited
+ # ..., 0.01, 0.1, 0.5, 0.9, 0.99, ...
+ axis.set_major_locator(LogitLocator())
+ axis.set_major_formatter(
+ LogitFormatter(
+ one_half=self._one_half,
+ use_overline=self._use_overline
+ )
+ )
+ axis.set_minor_locator(LogitLocator(minor=True))
+ axis.set_minor_formatter(
+ LogitFormatter(
+ minor=True,
+ one_half=self._one_half,
+ use_overline=self._use_overline
+ )
+ )
+
+ def limit_range_for_scale(self, vmin, vmax, minpos):
+ """
+ Limit the domain to values between 0 and 1 (excluded).
+ """
+ if not np.isfinite(minpos):
+ minpos = 1e-7 # Should rarely (if ever) have a visible effect.
+ return (minpos if vmin <= 0 else vmin,
+ 1 - minpos if vmax >= 1 else vmax)
+
+
+_scale_mapping = {
+ 'linear': LinearScale,
+ 'log': LogScale,
+ 'symlog': SymmetricalLogScale,
+ 'logit': LogitScale,
+ 'function': FuncScale,
+ 'functionlog': FuncScaleLog,
+ }
+
+
+def get_scale_names():
+ """Return the names of the available scales."""
+ return sorted(_scale_mapping)
+
+
+def scale_factory(scale, axis, **kwargs):
+ """
+ Return a scale class by name.
+
+ Parameters
+ ----------
+ scale : {%(names)s}
+ axis : `matplotlib.axis.Axis`
+ """
+ scale = scale.lower()
+ _api.check_in_list(_scale_mapping, scale=scale)
+ return _scale_mapping[scale](axis, **kwargs)
+
+
+if scale_factory.__doc__:
+ scale_factory.__doc__ = scale_factory.__doc__ % {
+ "names": ", ".join(map(repr, get_scale_names()))}
+
+
+def register_scale(scale_class):
+ """
+ Register a new kind of scale.
+
+ Parameters
+ ----------
+ scale_class : subclass of `ScaleBase`
+ The scale to register.
+ """
+ _scale_mapping[scale_class.name] = scale_class
+
+
+def _get_scale_docs():
+ """
+ Helper function for generating docstrings related to scales.
+ """
+ docs = []
+ for name, scale_class in _scale_mapping.items():
+ docs.extend([
+ f" {name!r}",
+ "",
+ textwrap.indent(inspect.getdoc(scale_class.__init__), " " * 8),
+ ""
+ ])
+ return "\n".join(docs)
+
+
+docstring.interpd.update(
+ scale_type='{%s}' % ', '.join([repr(x) for x in get_scale_names()]),
+ scale_docs=_get_scale_docs().rstrip(),
+ )
diff --git a/venv/Lib/site-packages/matplotlib/sphinxext/__init__.py b/venv/Lib/site-packages/matplotlib/sphinxext/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/venv/Lib/site-packages/matplotlib/sphinxext/mathmpl.py b/venv/Lib/site-packages/matplotlib/sphinxext/mathmpl.py
new file mode 100644
index 0000000..b86d0e8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/sphinxext/mathmpl.py
@@ -0,0 +1,121 @@
+import hashlib
+from pathlib import Path
+
+from docutils import nodes
+from docutils.parsers.rst import Directive, directives
+import sphinx
+
+import matplotlib as mpl
+from matplotlib import _api, mathtext
+
+
+# Define LaTeX math node:
+class latex_math(nodes.General, nodes.Element):
+ pass
+
+
+def fontset_choice(arg):
+ return directives.choice(arg, mathtext.MathTextParser._font_type_mapping)
+
+
+def math_role(role, rawtext, text, lineno, inliner,
+ options={}, content=[]):
+ i = rawtext.find('`')
+ latex = rawtext[i+1:-1]
+ node = latex_math(rawtext)
+ node['latex'] = latex
+ node['fontset'] = options.get('fontset', 'cm')
+ return [node], []
+math_role.options = {'fontset': fontset_choice}
+
+
+class MathDirective(Directive):
+ has_content = True
+ required_arguments = 0
+ optional_arguments = 0
+ final_argument_whitespace = False
+ option_spec = {'fontset': fontset_choice}
+
+ def run(self):
+ latex = ''.join(self.content)
+ node = latex_math(self.block_text)
+ node['latex'] = latex
+ node['fontset'] = self.options.get('fontset', 'cm')
+ return [node]
+
+
+# This uses mathtext to render the expression
+def latex2png(latex, filename, fontset='cm'):
+ latex = "$%s$" % latex
+ with mpl.rc_context({'mathtext.fontset': fontset}):
+ try:
+ depth = mathtext.math_to_image(
+ latex, filename, dpi=100, format="png")
+ except Exception:
+ _api.warn_external(f"Could not render math expression {latex}")
+ depth = 0
+ return depth
+
+
+# LaTeX to HTML translation stuff:
+def latex2html(node, source):
+ inline = isinstance(node.parent, nodes.TextElement)
+ latex = node['latex']
+ fontset = node['fontset']
+ name = 'math-{}'.format(
+ hashlib.md5((latex + fontset).encode()).hexdigest()[-10:])
+
+ destdir = Path(setup.app.builder.outdir, '_images', 'mathmpl')
+ destdir.mkdir(parents=True, exist_ok=True)
+ dest = destdir / f'{name}.png'
+
+ depth = latex2png(latex, dest, fontset)
+
+ if inline:
+ cls = ''
+ else:
+ cls = 'class="center" '
+ if inline and depth != 0:
+ style = 'style="position: relative; bottom: -%dpx"' % (depth + 1)
+ else:
+ style = ''
+
+ return (f' ')
+
+
+def setup(app):
+ setup.app = app
+
+ # Add visit/depart methods to HTML-Translator:
+ def visit_latex_math_html(self, node):
+ source = self.document.attributes['source']
+ self.body.append(latex2html(node, source))
+
+ def depart_latex_math_html(self, node):
+ pass
+
+ # Add visit/depart methods to LaTeX-Translator:
+ def visit_latex_math_latex(self, node):
+ inline = isinstance(node.parent, nodes.TextElement)
+ if inline:
+ self.body.append('$%s$' % node['latex'])
+ else:
+ self.body.extend(['\\begin{equation}',
+ node['latex'],
+ '\\end{equation}'])
+
+ def depart_latex_math_latex(self, node):
+ pass
+
+ app.add_node(latex_math,
+ html=(visit_latex_math_html, depart_latex_math_html),
+ latex=(visit_latex_math_latex, depart_latex_math_latex))
+ app.add_role('mathmpl', math_role)
+ app.add_directive('mathmpl', MathDirective)
+ if sphinx.version_info < (1, 8):
+ app.add_role('math', math_role)
+ app.add_directive('math', MathDirective)
+
+ metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
+ return metadata
diff --git a/venv/Lib/site-packages/matplotlib/sphinxext/plot_directive.py b/venv/Lib/site-packages/matplotlib/sphinxext/plot_directive.py
new file mode 100644
index 0000000..565f0b1
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/sphinxext/plot_directive.py
@@ -0,0 +1,822 @@
+"""
+A directive for including a Matplotlib plot in a Sphinx document
+================================================================
+
+By default, in HTML output, `plot` will include a .png file with a link to a
+high-res .png and .pdf. In LaTeX output, it will include a .pdf.
+
+The source code for the plot may be included in one of three ways:
+
+1. **A path to a source file** as the argument to the directive::
+
+ .. plot:: path/to/plot.py
+
+ When a path to a source file is given, the content of the
+ directive may optionally contain a caption for the plot::
+
+ .. plot:: path/to/plot.py
+
+ The plot's caption.
+
+ Additionally, one may specify the name of a function to call (with
+ no arguments) immediately after importing the module::
+
+ .. plot:: path/to/plot.py plot_function1
+
+2. Included as **inline content** to the directive::
+
+ .. plot::
+
+ import matplotlib.pyplot as plt
+ import matplotlib.image as mpimg
+ import numpy as np
+ img = mpimg.imread('_static/stinkbug.png')
+ imgplot = plt.imshow(img)
+
+3. Using **doctest** syntax::
+
+ .. plot::
+
+ A plotting example:
+ >>> import matplotlib.pyplot as plt
+ >>> plt.plot([1, 2, 3], [4, 5, 6])
+
+Options
+-------
+
+The ``plot`` directive supports the following options:
+
+ format : {'python', 'doctest'}
+ The format of the input.
+
+ include-source : bool
+ Whether to display the source code. The default can be changed
+ using the `plot_include_source` variable in :file:`conf.py`.
+
+ encoding : str
+ If this source file is in a non-UTF8 or non-ASCII encoding, the
+ encoding must be specified using the ``:encoding:`` option. The
+ encoding will not be inferred using the ``-*- coding -*-`` metacomment.
+
+ context : bool or str
+ If provided, the code will be run in the context of all previous plot
+ directives for which the ``:context:`` option was specified. This only
+ applies to inline code plot directives, not those run from files. If
+ the ``:context: reset`` option is specified, the context is reset
+ for this and future plots, and previous figures are closed prior to
+ running the code. ``:context: close-figs`` keeps the context but closes
+ previous figures before running the code.
+
+ nofigs : bool
+ If specified, the code block will be run, but no figures will be
+ inserted. This is usually useful with the ``:context:`` option.
+
+ caption : str
+ If specified, the option's argument will be used as a caption for the
+ figure. This overwrites the caption given in the content, when the plot
+ is generated from a file.
+
+Additionally, this directive supports all of the options of the `image`
+directive, except for *target* (since plot will add its own target). These
+include *alt*, *height*, *width*, *scale*, *align* and *class*.
+
+Configuration options
+---------------------
+
+The plot directive has the following configuration options:
+
+ plot_include_source
+ Default value for the include-source option
+
+ plot_html_show_source_link
+ Whether to show a link to the source in HTML.
+
+ plot_pre_code
+ Code that should be executed before each plot. If not specified or None
+ it will default to a string containing::
+
+ import numpy as np
+ from matplotlib import pyplot as plt
+
+ plot_basedir
+ Base directory, to which ``plot::`` file names are relative
+ to. (If None or empty, file names are relative to the
+ directory where the file containing the directive is.)
+
+ plot_formats
+ File formats to generate. List of tuples or strings::
+
+ [(suffix, dpi), suffix, ...]
+
+ that determine the file format and the DPI. For entries whose
+ DPI was omitted, sensible defaults are chosen. When passing from
+ the command line through sphinx_build the list should be passed as
+ suffix:dpi,suffix:dpi, ...
+
+ plot_html_show_formats
+ Whether to show links to the files in HTML.
+
+ plot_rcparams
+ A dictionary containing any non-standard rcParams that should
+ be applied before each plot.
+
+ plot_apply_rcparams
+ By default, rcParams are applied when ``:context:`` option is not used
+ in a plot directive. This configuration option overrides this behavior
+ and applies rcParams before each plot.
+
+ plot_working_directory
+ By default, the working directory will be changed to the directory of
+ the example, so the code can get at its data files, if any. Also its
+ path will be added to `sys.path` so it can import any helper modules
+ sitting beside it. This configuration option can be used to specify
+ a central directory (also added to `sys.path`) where data files and
+ helper modules for all code are located.
+
+ plot_template
+ Provide a customized template for preparing restructured text.
+"""
+
+import contextlib
+from io import StringIO
+import itertools
+import os
+from os.path import relpath
+from pathlib import Path
+import re
+import shutil
+import sys
+import textwrap
+import traceback
+
+from docutils.parsers.rst import directives, Directive
+from docutils.parsers.rst.directives.images import Image
+import jinja2 # Sphinx dependency.
+
+import matplotlib
+from matplotlib.backend_bases import FigureManagerBase
+import matplotlib.pyplot as plt
+from matplotlib import _api, _pylab_helpers, cbook
+
+matplotlib.use("agg")
+align = _api.deprecated(
+ "3.4", alternative="docutils.parsers.rst.directives.images.Image.align")(
+ Image.align)
+
+__version__ = 2
+
+
+# -----------------------------------------------------------------------------
+# Registration hook
+# -----------------------------------------------------------------------------
+
+
+def _option_boolean(arg):
+ if not arg or not arg.strip():
+ # no argument given, assume used as a flag
+ return True
+ elif arg.strip().lower() in ('no', '0', 'false'):
+ return False
+ elif arg.strip().lower() in ('yes', '1', 'true'):
+ return True
+ else:
+ raise ValueError('"%s" unknown boolean' % arg)
+
+
+def _option_context(arg):
+ if arg in [None, 'reset', 'close-figs']:
+ return arg
+ raise ValueError("Argument should be None or 'reset' or 'close-figs'")
+
+
+def _option_format(arg):
+ return directives.choice(arg, ('python', 'doctest'))
+
+
+def mark_plot_labels(app, document):
+ """
+ To make plots referenceable, we need to move the reference from the
+ "htmlonly" (or "latexonly") node to the actual figure node itself.
+ """
+ for name, explicit in document.nametypes.items():
+ if not explicit:
+ continue
+ labelid = document.nameids[name]
+ if labelid is None:
+ continue
+ node = document.ids[labelid]
+ if node.tagname in ('html_only', 'latex_only'):
+ for n in node:
+ if n.tagname == 'figure':
+ sectname = name
+ for c in n:
+ if c.tagname == 'caption':
+ sectname = c.astext()
+ break
+
+ node['ids'].remove(labelid)
+ node['names'].remove(name)
+ n['ids'].append(labelid)
+ n['names'].append(name)
+ document.settings.env.labels[name] = \
+ document.settings.env.docname, labelid, sectname
+ break
+
+
+class PlotDirective(Directive):
+ """The ``.. plot::`` directive, as documented in the module's docstring."""
+
+ has_content = True
+ required_arguments = 0
+ optional_arguments = 2
+ final_argument_whitespace = False
+ option_spec = {
+ 'alt': directives.unchanged,
+ 'height': directives.length_or_unitless,
+ 'width': directives.length_or_percentage_or_unitless,
+ 'scale': directives.nonnegative_int,
+ 'align': Image.align,
+ 'class': directives.class_option,
+ 'include-source': _option_boolean,
+ 'format': _option_format,
+ 'context': _option_context,
+ 'nofigs': directives.flag,
+ 'encoding': directives.encoding,
+ 'caption': directives.unchanged,
+ }
+
+ def run(self):
+ """Run the plot directive."""
+ try:
+ return run(self.arguments, self.content, self.options,
+ self.state_machine, self.state, self.lineno)
+ except Exception as e:
+ raise self.error(str(e))
+
+
+def _copy_css_file(app, exc):
+ if exc is None and app.builder.format == 'html':
+ src = cbook._get_data_path('plot_directive/plot_directive.css')
+ dst = app.outdir / Path('_static')
+ shutil.copy(src, dst)
+
+
+def setup(app):
+ setup.app = app
+ setup.config = app.config
+ setup.confdir = app.confdir
+ app.add_directive('plot', PlotDirective)
+ app.add_config_value('plot_pre_code', None, True)
+ app.add_config_value('plot_include_source', False, True)
+ app.add_config_value('plot_html_show_source_link', True, True)
+ app.add_config_value('plot_formats', ['png', 'hires.png', 'pdf'], True)
+ app.add_config_value('plot_basedir', None, True)
+ app.add_config_value('plot_html_show_formats', True, True)
+ app.add_config_value('plot_rcparams', {}, True)
+ app.add_config_value('plot_apply_rcparams', False, True)
+ app.add_config_value('plot_working_directory', None, True)
+ app.add_config_value('plot_template', None, True)
+ app.connect('doctree-read', mark_plot_labels)
+ app.add_css_file('plot_directive.css')
+ app.connect('build-finished', _copy_css_file)
+ metadata = {'parallel_read_safe': True, 'parallel_write_safe': True,
+ 'version': matplotlib.__version__}
+ return metadata
+
+
+# -----------------------------------------------------------------------------
+# Doctest handling
+# -----------------------------------------------------------------------------
+
+
+def contains_doctest(text):
+ try:
+ # check if it's valid Python as-is
+ compile(text, '', 'exec')
+ return False
+ except SyntaxError:
+ pass
+ r = re.compile(r'^\s*>>>', re.M)
+ m = r.search(text)
+ return bool(m)
+
+
+def unescape_doctest(text):
+ """
+ Extract code from a piece of text, which contains either Python code
+ or doctests.
+ """
+ if not contains_doctest(text):
+ return text
+
+ code = ""
+ for line in text.split("\n"):
+ m = re.match(r'^\s*(>>>|\.\.\.) (.*)$', line)
+ if m:
+ code += m.group(2) + "\n"
+ elif line.strip():
+ code += "# " + line.strip() + "\n"
+ else:
+ code += "\n"
+ return code
+
+
+def split_code_at_show(text):
+ """Split code at plt.show()."""
+ parts = []
+ is_doctest = contains_doctest(text)
+
+ part = []
+ for line in text.split("\n"):
+ if (not is_doctest and line.strip() == 'plt.show()') or \
+ (is_doctest and line.strip() == '>>> plt.show()'):
+ part.append(line)
+ parts.append("\n".join(part))
+ part = []
+ else:
+ part.append(line)
+ if "\n".join(part).strip():
+ parts.append("\n".join(part))
+ return parts
+
+
+# -----------------------------------------------------------------------------
+# Template
+# -----------------------------------------------------------------------------
+
+TEMPLATE = """
+{{ source_code }}
+
+.. only:: html
+
+ {% if source_link or (html_show_formats and not multi_image) %}
+ (
+ {%- if source_link -%}
+ `Source code <{{ source_link }}>`__
+ {%- endif -%}
+ {%- if html_show_formats and not multi_image -%}
+ {%- for img in images -%}
+ {%- for fmt in img.formats -%}
+ {%- if source_link or not loop.first -%}, {% endif -%}
+ `{{ fmt }} <{{ dest_dir }}/{{ img.basename }}.{{ fmt }}>`__
+ {%- endfor -%}
+ {%- endfor -%}
+ {%- endif -%}
+ )
+ {% endif %}
+
+ {% for img in images %}
+ .. figure:: {{ build_dir }}/{{ img.basename }}.{{ default_fmt }}
+ {% for option in options -%}
+ {{ option }}
+ {% endfor %}
+
+ {% if html_show_formats and multi_image -%}
+ (
+ {%- for fmt in img.formats -%}
+ {%- if not loop.first -%}, {% endif -%}
+ `{{ fmt }} <{{ dest_dir }}/{{ img.basename }}.{{ fmt }}>`__
+ {%- endfor -%}
+ )
+ {%- endif -%}
+
+ {{ caption }} {# appropriate leading whitespace added beforehand #}
+ {% endfor %}
+
+.. only:: not html
+
+ {% for img in images %}
+ .. figure:: {{ build_dir }}/{{ img.basename }}.*
+ {% for option in options -%}
+ {{ option }}
+ {% endfor -%}
+
+ {{ caption }} {# appropriate leading whitespace added beforehand #}
+ {% endfor %}
+
+"""
+
+exception_template = """
+.. only:: html
+
+ [`source code <%(linkdir)s/%(basename)s.py>`__]
+
+Exception occurred rendering plot.
+
+"""
+
+# the context of the plot for all directives specified with the
+# :context: option
+plot_context = dict()
+
+
+class ImageFile:
+ def __init__(self, basename, dirname):
+ self.basename = basename
+ self.dirname = dirname
+ self.formats = []
+
+ def filename(self, format):
+ return os.path.join(self.dirname, "%s.%s" % (self.basename, format))
+
+ def filenames(self):
+ return [self.filename(fmt) for fmt in self.formats]
+
+
+def out_of_date(original, derived):
+ """
+ Return whether *derived* is out-of-date relative to *original*, both of
+ which are full file paths.
+ """
+ return (not os.path.exists(derived) or
+ (os.path.exists(original) and
+ os.stat(derived).st_mtime < os.stat(original).st_mtime))
+
+
+class PlotError(RuntimeError):
+ pass
+
+
+def run_code(code, code_path, ns=None, function_name=None):
+ """
+ Import a Python module from a path, and run the function given by
+ name, if function_name is not None.
+ """
+
+ # Change the working directory to the directory of the example, so
+ # it can get at its data files, if any. Add its path to sys.path
+ # so it can import any helper modules sitting beside it.
+ pwd = os.getcwd()
+ if setup.config.plot_working_directory is not None:
+ try:
+ os.chdir(setup.config.plot_working_directory)
+ except OSError as err:
+ raise OSError(str(err) + '\n`plot_working_directory` option in'
+ 'Sphinx configuration file must be a valid '
+ 'directory path') from err
+ except TypeError as err:
+ raise TypeError(str(err) + '\n`plot_working_directory` option in '
+ 'Sphinx configuration file must be a string or '
+ 'None') from err
+ elif code_path is not None:
+ dirname = os.path.abspath(os.path.dirname(code_path))
+ os.chdir(dirname)
+
+ with cbook._setattr_cm(
+ sys, argv=[code_path], path=[os.getcwd(), *sys.path]), \
+ contextlib.redirect_stdout(StringIO()):
+ try:
+ code = unescape_doctest(code)
+ if ns is None:
+ ns = {}
+ if not ns:
+ if setup.config.plot_pre_code is None:
+ exec('import numpy as np\n'
+ 'from matplotlib import pyplot as plt\n', ns)
+ else:
+ exec(str(setup.config.plot_pre_code), ns)
+ if "__main__" in code:
+ ns['__name__'] = '__main__'
+
+ # Patch out non-interactive show() to avoid triggering a warning.
+ with cbook._setattr_cm(FigureManagerBase, show=lambda self: None):
+ exec(code, ns)
+ if function_name is not None:
+ exec(function_name + "()", ns)
+
+ except (Exception, SystemExit) as err:
+ raise PlotError(traceback.format_exc()) from err
+ finally:
+ os.chdir(pwd)
+ return ns
+
+
+def clear_state(plot_rcparams, close=True):
+ if close:
+ plt.close('all')
+ matplotlib.rc_file_defaults()
+ matplotlib.rcParams.update(plot_rcparams)
+
+
+def get_plot_formats(config):
+ default_dpi = {'png': 80, 'hires.png': 200, 'pdf': 200}
+ formats = []
+ plot_formats = config.plot_formats
+ for fmt in plot_formats:
+ if isinstance(fmt, str):
+ if ':' in fmt:
+ suffix, dpi = fmt.split(':')
+ formats.append((str(suffix), int(dpi)))
+ else:
+ formats.append((fmt, default_dpi.get(fmt, 80)))
+ elif isinstance(fmt, (tuple, list)) and len(fmt) == 2:
+ formats.append((str(fmt[0]), int(fmt[1])))
+ else:
+ raise PlotError('invalid image format "%r" in plot_formats' % fmt)
+ return formats
+
+
+def render_figures(code, code_path, output_dir, output_base, context,
+ function_name, config, context_reset=False,
+ close_figs=False):
+ """
+ Run a pyplot script and save the images in *output_dir*.
+
+ Save the images under *output_dir* with file names derived from
+ *output_base*
+ """
+ formats = get_plot_formats(config)
+
+ # Try to determine if all images already exist
+
+ code_pieces = split_code_at_show(code)
+
+ # Look for single-figure output files first
+ all_exists = True
+ img = ImageFile(output_base, output_dir)
+ for format, dpi in formats:
+ if out_of_date(code_path, img.filename(format)):
+ all_exists = False
+ break
+ img.formats.append(format)
+
+ if all_exists:
+ return [(code, [img])]
+
+ # Then look for multi-figure output files
+ results = []
+ all_exists = True
+ for i, code_piece in enumerate(code_pieces):
+ images = []
+ for j in itertools.count():
+ if len(code_pieces) > 1:
+ img = ImageFile('%s_%02d_%02d' % (output_base, i, j),
+ output_dir)
+ else:
+ img = ImageFile('%s_%02d' % (output_base, j), output_dir)
+ for fmt, dpi in formats:
+ if out_of_date(code_path, img.filename(fmt)):
+ all_exists = False
+ break
+ img.formats.append(fmt)
+
+ # assume that if we have one, we have them all
+ if not all_exists:
+ all_exists = (j > 0)
+ break
+ images.append(img)
+ if not all_exists:
+ break
+ results.append((code_piece, images))
+
+ if all_exists:
+ return results
+
+ # We didn't find the files, so build them
+
+ results = []
+ if context:
+ ns = plot_context
+ else:
+ ns = {}
+
+ if context_reset:
+ clear_state(config.plot_rcparams)
+ plot_context.clear()
+
+ close_figs = not context or close_figs
+
+ for i, code_piece in enumerate(code_pieces):
+
+ if not context or config.plot_apply_rcparams:
+ clear_state(config.plot_rcparams, close_figs)
+ elif close_figs:
+ plt.close('all')
+
+ run_code(code_piece, code_path, ns, function_name)
+
+ images = []
+ fig_managers = _pylab_helpers.Gcf.get_all_fig_managers()
+ for j, figman in enumerate(fig_managers):
+ if len(fig_managers) == 1 and len(code_pieces) == 1:
+ img = ImageFile(output_base, output_dir)
+ elif len(code_pieces) == 1:
+ img = ImageFile("%s_%02d" % (output_base, j), output_dir)
+ else:
+ img = ImageFile("%s_%02d_%02d" % (output_base, i, j),
+ output_dir)
+ images.append(img)
+ for fmt, dpi in formats:
+ try:
+ figman.canvas.figure.savefig(img.filename(fmt), dpi=dpi)
+ except Exception as err:
+ raise PlotError(traceback.format_exc()) from err
+ img.formats.append(fmt)
+
+ results.append((code_piece, images))
+
+ if not context or config.plot_apply_rcparams:
+ clear_state(config.plot_rcparams, close=not context)
+
+ return results
+
+
+def run(arguments, content, options, state_machine, state, lineno):
+ document = state_machine.document
+ config = document.settings.env.config
+ nofigs = 'nofigs' in options
+
+ formats = get_plot_formats(config)
+ default_fmt = formats[0][0]
+
+ options.setdefault('include-source', config.plot_include_source)
+ if 'class' in options:
+ # classes are parsed into a list of string, and output by simply
+ # printing the list, abusing the fact that RST guarantees to strip
+ # non-conforming characters
+ options['class'] = ['plot-directive'] + options['class']
+ else:
+ options.setdefault('class', ['plot-directive'])
+ keep_context = 'context' in options
+ context_opt = None if not keep_context else options['context']
+
+ rst_file = document.attributes['source']
+ rst_dir = os.path.dirname(rst_file)
+
+ if len(arguments):
+ if not config.plot_basedir:
+ source_file_name = os.path.join(setup.app.builder.srcdir,
+ directives.uri(arguments[0]))
+ else:
+ source_file_name = os.path.join(setup.confdir, config.plot_basedir,
+ directives.uri(arguments[0]))
+
+ # If there is content, it will be passed as a caption.
+ caption = '\n'.join(content)
+
+ # Enforce unambiguous use of captions.
+ if "caption" in options:
+ if caption:
+ raise ValueError(
+ 'Caption specified in both content and options.'
+ ' Please remove ambiguity.'
+ )
+ # Use caption option
+ caption = options["caption"]
+
+ # If the optional function name is provided, use it
+ if len(arguments) == 2:
+ function_name = arguments[1]
+ else:
+ function_name = None
+
+ code = Path(source_file_name).read_text(encoding='utf-8')
+ output_base = os.path.basename(source_file_name)
+ else:
+ source_file_name = rst_file
+ code = textwrap.dedent("\n".join(map(str, content)))
+ counter = document.attributes.get('_plot_counter', 0) + 1
+ document.attributes['_plot_counter'] = counter
+ base, ext = os.path.splitext(os.path.basename(source_file_name))
+ output_base = '%s-%d.py' % (base, counter)
+ function_name = None
+ caption = options.get('caption', '')
+
+ base, source_ext = os.path.splitext(output_base)
+ if source_ext in ('.py', '.rst', '.txt'):
+ output_base = base
+ else:
+ source_ext = ''
+
+ # ensure that LaTeX includegraphics doesn't choke in foo.bar.pdf filenames
+ output_base = output_base.replace('.', '-')
+
+ # is it in doctest format?
+ is_doctest = contains_doctest(code)
+ if 'format' in options:
+ if options['format'] == 'python':
+ is_doctest = False
+ else:
+ is_doctest = True
+
+ # determine output directory name fragment
+ source_rel_name = relpath(source_file_name, setup.confdir)
+ source_rel_dir = os.path.dirname(source_rel_name)
+ while source_rel_dir.startswith(os.path.sep):
+ source_rel_dir = source_rel_dir[1:]
+
+ # build_dir: where to place output files (temporarily)
+ build_dir = os.path.join(os.path.dirname(setup.app.doctreedir),
+ 'plot_directive',
+ source_rel_dir)
+ # get rid of .. in paths, also changes pathsep
+ # see note in Python docs for warning about symbolic links on Windows.
+ # need to compare source and dest paths at end
+ build_dir = os.path.normpath(build_dir)
+
+ if not os.path.exists(build_dir):
+ os.makedirs(build_dir)
+
+ # output_dir: final location in the builder's directory
+ dest_dir = os.path.abspath(os.path.join(setup.app.builder.outdir,
+ source_rel_dir))
+ if not os.path.exists(dest_dir):
+ os.makedirs(dest_dir) # no problem here for me, but just use built-ins
+
+ # how to link to files from the RST file
+ dest_dir_link = os.path.join(relpath(setup.confdir, rst_dir),
+ source_rel_dir).replace(os.path.sep, '/')
+ try:
+ build_dir_link = relpath(build_dir, rst_dir).replace(os.path.sep, '/')
+ except ValueError:
+ # on Windows, relpath raises ValueError when path and start are on
+ # different mounts/drives
+ build_dir_link = build_dir
+ source_link = dest_dir_link + '/' + output_base + source_ext
+
+ # make figures
+ try:
+ results = render_figures(code,
+ source_file_name,
+ build_dir,
+ output_base,
+ keep_context,
+ function_name,
+ config,
+ context_reset=context_opt == 'reset',
+ close_figs=context_opt == 'close-figs')
+ errors = []
+ except PlotError as err:
+ reporter = state.memo.reporter
+ sm = reporter.system_message(
+ 2, "Exception occurred in plotting {}\n from {}:\n{}".format(
+ output_base, source_file_name, err),
+ line=lineno)
+ results = [(code, [])]
+ errors = [sm]
+
+ # Properly indent the caption
+ caption = '\n' + '\n'.join(' ' + line.strip()
+ for line in caption.split('\n'))
+
+ # generate output restructuredtext
+ total_lines = []
+ for j, (code_piece, images) in enumerate(results):
+ if options['include-source']:
+ if is_doctest:
+ lines = ['', *code_piece.splitlines()]
+ else:
+ lines = ['.. code-block:: python', '',
+ *textwrap.indent(code_piece, ' ').splitlines()]
+ source_code = "\n".join(lines)
+ else:
+ source_code = ""
+
+ if nofigs:
+ images = []
+
+ opts = [
+ ':%s: %s' % (key, val) for key, val in options.items()
+ if key in ('alt', 'height', 'width', 'scale', 'align', 'class')]
+
+ # Not-None src_link signals the need for a source link in the generated
+ # html
+ if j == 0 and config.plot_html_show_source_link:
+ src_link = source_link
+ else:
+ src_link = None
+
+ result = jinja2.Template(config.plot_template or TEMPLATE).render(
+ default_fmt=default_fmt,
+ dest_dir=dest_dir_link,
+ build_dir=build_dir_link,
+ source_link=src_link,
+ multi_image=len(images) > 1,
+ options=opts,
+ images=images,
+ source_code=source_code,
+ html_show_formats=config.plot_html_show_formats and len(images),
+ caption=caption)
+
+ total_lines.extend(result.split("\n"))
+ total_lines.extend("\n")
+
+ if total_lines:
+ state_machine.insert_input(total_lines, source=source_file_name)
+
+ # copy image files to builder's output directory, if necessary
+ Path(dest_dir).mkdir(parents=True, exist_ok=True)
+
+ for code_piece, images in results:
+ for img in images:
+ for fn in img.filenames():
+ destimg = os.path.join(dest_dir, os.path.basename(fn))
+ if fn != destimg:
+ shutil.copyfile(fn, destimg)
+
+ # copy script (if necessary)
+ Path(dest_dir, output_base + source_ext).write_text(
+ unescape_doctest(code) if source_file_name == rst_file else code,
+ encoding='utf-8')
+
+ return errors
diff --git a/venv/Lib/site-packages/matplotlib/spines.py b/venv/Lib/site-packages/matplotlib/spines.py
new file mode 100644
index 0000000..40ceb15
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/spines.py
@@ -0,0 +1,586 @@
+from collections.abc import MutableMapping
+import functools
+
+import numpy as np
+
+import matplotlib
+from matplotlib import _api, docstring, rcParams
+from matplotlib.artist import allow_rasterization
+import matplotlib.transforms as mtransforms
+import matplotlib.patches as mpatches
+import matplotlib.path as mpath
+
+
+class Spine(mpatches.Patch):
+ """
+ An axis spine -- the line noting the data area boundaries.
+
+ Spines are the lines connecting the axis tick marks and noting the
+ boundaries of the data area. They can be placed at arbitrary
+ positions. See `~.Spine.set_position` for more information.
+
+ The default position is ``('outward', 0)``.
+
+ Spines are subclasses of `.Patch`, and inherit much of their behavior.
+
+ Spines draw a line, a circle, or an arc depending if
+ `~.Spine.set_patch_line`, `~.Spine.set_patch_circle`, or
+ `~.Spine.set_patch_arc` has been called. Line-like is the default.
+
+ """
+ def __str__(self):
+ return "Spine"
+
+ @docstring.dedent_interpd
+ def __init__(self, axes, spine_type, path, **kwargs):
+ """
+ Parameters
+ ----------
+ axes : `~matplotlib.axes.Axes`
+ The `~.axes.Axes` instance containing the spine.
+ spine_type : str
+ The spine type.
+ path : `~matplotlib.path.Path`
+ The `.Path` instance used to draw the spine.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ Valid keyword arguments are:
+
+ %(Patch_kwdoc)s
+ """
+ super().__init__(**kwargs)
+ self.axes = axes
+ self.set_figure(self.axes.figure)
+ self.spine_type = spine_type
+ self.set_facecolor('none')
+ self.set_edgecolor(rcParams['axes.edgecolor'])
+ self.set_linewidth(rcParams['axes.linewidth'])
+ self.set_capstyle('projecting')
+ self.axis = None
+
+ self.set_zorder(2.5)
+ self.set_transform(self.axes.transData) # default transform
+
+ self._bounds = None # default bounds
+
+ # Defer initial position determination. (Not much support for
+ # non-rectangular axes is currently implemented, and this lets
+ # them pass through the spines machinery without errors.)
+ self._position = None
+ _api.check_isinstance(matplotlib.path.Path, path=path)
+ self._path = path
+
+ # To support drawing both linear and circular spines, this
+ # class implements Patch behavior three ways. If
+ # self._patch_type == 'line', behave like a mpatches.PathPatch
+ # instance. If self._patch_type == 'circle', behave like a
+ # mpatches.Ellipse instance. If self._patch_type == 'arc', behave like
+ # a mpatches.Arc instance.
+ self._patch_type = 'line'
+
+ # Behavior copied from mpatches.Ellipse:
+ # Note: This cannot be calculated until this is added to an Axes
+ self._patch_transform = mtransforms.IdentityTransform()
+
+ def set_patch_arc(self, center, radius, theta1, theta2):
+ """Set the spine to be arc-like."""
+ self._patch_type = 'arc'
+ self._center = center
+ self._width = radius * 2
+ self._height = radius * 2
+ self._theta1 = theta1
+ self._theta2 = theta2
+ self._path = mpath.Path.arc(theta1, theta2)
+ # arc drawn on axes transform
+ self.set_transform(self.axes.transAxes)
+ self.stale = True
+
+ def set_patch_circle(self, center, radius):
+ """Set the spine to be circular."""
+ self._patch_type = 'circle'
+ self._center = center
+ self._width = radius * 2
+ self._height = radius * 2
+ # circle drawn on axes transform
+ self.set_transform(self.axes.transAxes)
+ self.stale = True
+
+ def set_patch_line(self):
+ """Set the spine to be linear."""
+ self._patch_type = 'line'
+ self.stale = True
+
+ # Behavior copied from mpatches.Ellipse:
+ def _recompute_transform(self):
+ """
+ Notes
+ -----
+ This cannot be called until after this has been added to an Axes,
+ otherwise unit conversion will fail. This makes it very important to
+ call the accessor method and not directly access the transformation
+ member variable.
+ """
+ assert self._patch_type in ('arc', 'circle')
+ center = (self.convert_xunits(self._center[0]),
+ self.convert_yunits(self._center[1]))
+ width = self.convert_xunits(self._width)
+ height = self.convert_yunits(self._height)
+ self._patch_transform = mtransforms.Affine2D() \
+ .scale(width * 0.5, height * 0.5) \
+ .translate(*center)
+
+ def get_patch_transform(self):
+ if self._patch_type in ('arc', 'circle'):
+ self._recompute_transform()
+ return self._patch_transform
+ else:
+ return super().get_patch_transform()
+
+ def get_window_extent(self, renderer=None):
+ """
+ Return the window extent of the spines in display space, including
+ padding for ticks (but not their labels)
+
+ See Also
+ --------
+ matplotlib.axes.Axes.get_tightbbox
+ matplotlib.axes.Axes.get_window_extent
+ """
+ # make sure the location is updated so that transforms etc are correct:
+ self._adjust_location()
+ bb = super().get_window_extent(renderer=renderer)
+ if self.axis is None:
+ return bb
+ bboxes = [bb]
+ tickstocheck = [self.axis.majorTicks[0]]
+ if len(self.axis.minorTicks) > 1:
+ # only pad for minor ticks if there are more than one
+ # of them. There is always one...
+ tickstocheck.append(self.axis.minorTicks[1])
+ for tick in tickstocheck:
+ bb0 = bb.frozen()
+ tickl = tick._size
+ tickdir = tick._tickdir
+ if tickdir == 'out':
+ padout = 1
+ padin = 0
+ elif tickdir == 'in':
+ padout = 0
+ padin = 1
+ else:
+ padout = 0.5
+ padin = 0.5
+ padout = padout * tickl / 72 * self.figure.dpi
+ padin = padin * tickl / 72 * self.figure.dpi
+
+ if tick.tick1line.get_visible():
+ if self.spine_type == 'left':
+ bb0.x0 = bb0.x0 - padout
+ bb0.x1 = bb0.x1 + padin
+ elif self.spine_type == 'bottom':
+ bb0.y0 = bb0.y0 - padout
+ bb0.y1 = bb0.y1 + padin
+
+ if tick.tick2line.get_visible():
+ if self.spine_type == 'right':
+ bb0.x1 = bb0.x1 + padout
+ bb0.x0 = bb0.x0 - padin
+ elif self.spine_type == 'top':
+ bb0.y1 = bb0.y1 + padout
+ bb0.y0 = bb0.y0 - padout
+ bboxes.append(bb0)
+
+ return mtransforms.Bbox.union(bboxes)
+
+ def get_path(self):
+ return self._path
+
+ def _ensure_position_is_set(self):
+ if self._position is None:
+ # default position
+ self._position = ('outward', 0.0) # in points
+ self.set_position(self._position)
+
+ def register_axis(self, axis):
+ """
+ Register an axis.
+
+ An axis should be registered with its corresponding spine from
+ the Axes instance. This allows the spine to clear any axis
+ properties when needed.
+ """
+ self.axis = axis
+ if self.axis is not None:
+ self.axis.clear()
+ self.stale = True
+
+ def clear(self):
+ """Clear the current spine."""
+ self._position = None # clear position
+ if self.axis is not None:
+ self.axis.clear()
+
+ @_api.deprecated("3.4", alternative="Spine.clear()")
+ def cla(self):
+ self.clear()
+
+ def _adjust_location(self):
+ """Automatically set spine bounds to the view interval."""
+
+ if self.spine_type == 'circle':
+ return
+
+ if self._bounds is not None:
+ low, high = self._bounds
+ elif self.spine_type in ('left', 'right'):
+ low, high = self.axes.viewLim.intervaly
+ elif self.spine_type in ('top', 'bottom'):
+ low, high = self.axes.viewLim.intervalx
+ else:
+ raise ValueError(f'unknown spine spine_type: {self.spine_type}')
+
+ if self._patch_type == 'arc':
+ if self.spine_type in ('bottom', 'top'):
+ try:
+ direction = self.axes.get_theta_direction()
+ except AttributeError:
+ direction = 1
+ try:
+ offset = self.axes.get_theta_offset()
+ except AttributeError:
+ offset = 0
+ low = low * direction + offset
+ high = high * direction + offset
+ if low > high:
+ low, high = high, low
+
+ self._path = mpath.Path.arc(np.rad2deg(low), np.rad2deg(high))
+
+ if self.spine_type == 'bottom':
+ rmin, rmax = self.axes.viewLim.intervaly
+ try:
+ rorigin = self.axes.get_rorigin()
+ except AttributeError:
+ rorigin = rmin
+ scaled_diameter = (rmin - rorigin) / (rmax - rorigin)
+ self._height = scaled_diameter
+ self._width = scaled_diameter
+
+ else:
+ raise ValueError('unable to set bounds for spine "%s"' %
+ self.spine_type)
+ else:
+ v1 = self._path.vertices
+ assert v1.shape == (2, 2), 'unexpected vertices shape'
+ if self.spine_type in ['left', 'right']:
+ v1[0, 1] = low
+ v1[1, 1] = high
+ elif self.spine_type in ['bottom', 'top']:
+ v1[0, 0] = low
+ v1[1, 0] = high
+ else:
+ raise ValueError('unable to set bounds for spine "%s"' %
+ self.spine_type)
+
+ @allow_rasterization
+ def draw(self, renderer):
+ self._adjust_location()
+ ret = super().draw(renderer)
+ self.stale = False
+ return ret
+
+ def set_position(self, position):
+ """
+ Set the position of the spine.
+
+ Spine position is specified by a 2 tuple of (position type,
+ amount). The position types are:
+
+ * 'outward': place the spine out from the data area by the specified
+ number of points. (Negative values place the spine inwards.)
+ * 'axes': place the spine at the specified Axes coordinate (0 to 1).
+ * 'data': place the spine at the specified data coordinate.
+
+ Additionally, shorthand notations define a special positions:
+
+ * 'center' -> ('axes', 0.5)
+ * 'zero' -> ('data', 0.0)
+ """
+ if position in ('center', 'zero'): # special positions
+ pass
+ else:
+ if len(position) != 2:
+ raise ValueError("position should be 'center' or 2-tuple")
+ if position[0] not in ['outward', 'axes', 'data']:
+ raise ValueError("position[0] should be one of 'outward', "
+ "'axes', or 'data' ")
+ self._position = position
+ self.set_transform(self.get_spine_transform())
+ if self.axis is not None:
+ self.axis.reset_ticks()
+ self.stale = True
+
+ def get_position(self):
+ """Return the spine position."""
+ self._ensure_position_is_set()
+ return self._position
+
+ def get_spine_transform(self):
+ """Return the spine transform."""
+ self._ensure_position_is_set()
+
+ position = self._position
+ if isinstance(position, str):
+ if position == 'center':
+ position = ('axes', 0.5)
+ elif position == 'zero':
+ position = ('data', 0)
+ assert len(position) == 2, 'position should be 2-tuple'
+ position_type, amount = position
+ _api.check_in_list(['axes', 'outward', 'data'],
+ position_type=position_type)
+ if self.spine_type in ['left', 'right']:
+ base_transform = self.axes.get_yaxis_transform(which='grid')
+ elif self.spine_type in ['top', 'bottom']:
+ base_transform = self.axes.get_xaxis_transform(which='grid')
+ else:
+ raise ValueError(f'unknown spine spine_type: {self.spine_type!r}')
+
+ if position_type == 'outward':
+ if amount == 0: # short circuit commonest case
+ return base_transform
+ else:
+ offset_vec = {'left': (-1, 0), 'right': (1, 0),
+ 'bottom': (0, -1), 'top': (0, 1),
+ }[self.spine_type]
+ # calculate x and y offset in dots
+ offset_dots = amount * np.array(offset_vec) / 72
+ return (base_transform
+ + mtransforms.ScaledTranslation(
+ *offset_dots, self.figure.dpi_scale_trans))
+ elif position_type == 'axes':
+ if self.spine_type in ['left', 'right']:
+ # keep y unchanged, fix x at amount
+ return (mtransforms.Affine2D.from_values(0, 0, 0, 1, amount, 0)
+ + base_transform)
+ elif self.spine_type in ['bottom', 'top']:
+ # keep x unchanged, fix y at amount
+ return (mtransforms.Affine2D.from_values(1, 0, 0, 0, 0, amount)
+ + base_transform)
+ elif position_type == 'data':
+ if self.spine_type in ('right', 'top'):
+ # The right and top spines have a default position of 1 in
+ # axes coordinates. When specifying the position in data
+ # coordinates, we need to calculate the position relative to 0.
+ amount -= 1
+ if self.spine_type in ('left', 'right'):
+ return mtransforms.blended_transform_factory(
+ mtransforms.Affine2D().translate(amount, 0)
+ + self.axes.transData,
+ self.axes.transData)
+ elif self.spine_type in ('bottom', 'top'):
+ return mtransforms.blended_transform_factory(
+ self.axes.transData,
+ mtransforms.Affine2D().translate(0, amount)
+ + self.axes.transData)
+
+ def set_bounds(self, low=None, high=None):
+ """
+ Set the spine bounds.
+
+ Parameters
+ ----------
+ low : float or None, optional
+ The lower spine bound. Passing *None* leaves the limit unchanged.
+
+ The bounds may also be passed as the tuple (*low*, *high*) as the
+ first positional argument.
+
+ .. ACCEPTS: (low: float, high: float)
+
+ high : float or None, optional
+ The higher spine bound. Passing *None* leaves the limit unchanged.
+ """
+ if self.spine_type == 'circle':
+ raise ValueError(
+ 'set_bounds() method incompatible with circular spines')
+ if high is None and np.iterable(low):
+ low, high = low
+ old_low, old_high = self.get_bounds() or (None, None)
+ if low is None:
+ low = old_low
+ if high is None:
+ high = old_high
+ self._bounds = (low, high)
+ self.stale = True
+
+ def get_bounds(self):
+ """Get the bounds of the spine."""
+ return self._bounds
+
+ @classmethod
+ def linear_spine(cls, axes, spine_type, **kwargs):
+ """Create and return a linear `Spine`."""
+ # all values of 0.999 get replaced upon call to set_bounds()
+ if spine_type == 'left':
+ path = mpath.Path([(0.0, 0.999), (0.0, 0.999)])
+ elif spine_type == 'right':
+ path = mpath.Path([(1.0, 0.999), (1.0, 0.999)])
+ elif spine_type == 'bottom':
+ path = mpath.Path([(0.999, 0.0), (0.999, 0.0)])
+ elif spine_type == 'top':
+ path = mpath.Path([(0.999, 1.0), (0.999, 1.0)])
+ else:
+ raise ValueError('unable to make path for spine "%s"' % spine_type)
+ result = cls(axes, spine_type, path, **kwargs)
+ result.set_visible(rcParams['axes.spines.{0}'.format(spine_type)])
+
+ return result
+
+ @classmethod
+ def arc_spine(cls, axes, spine_type, center, radius, theta1, theta2,
+ **kwargs):
+ """Create and return an arc `Spine`."""
+ path = mpath.Path.arc(theta1, theta2)
+ result = cls(axes, spine_type, path, **kwargs)
+ result.set_patch_arc(center, radius, theta1, theta2)
+ return result
+
+ @classmethod
+ def circular_spine(cls, axes, center, radius, **kwargs):
+ """Create and return a circular `Spine`."""
+ path = mpath.Path.unit_circle()
+ spine_type = 'circle'
+ result = cls(axes, spine_type, path, **kwargs)
+ result.set_patch_circle(center, radius)
+ return result
+
+ def set_color(self, c):
+ """
+ Set the edgecolor.
+
+ Parameters
+ ----------
+ c : color
+
+ Notes
+ -----
+ This method does not modify the facecolor (which defaults to "none"),
+ unlike the `.Patch.set_color` method defined in the parent class. Use
+ `.Patch.set_facecolor` to set the facecolor.
+ """
+ self.set_edgecolor(c)
+ self.stale = True
+
+
+class SpinesProxy:
+ """
+ A proxy to broadcast ``set_*`` method calls to all contained `.Spines`.
+
+ The proxy cannot be used for any other operations on its members.
+
+ The supported methods are determined dynamically based on the contained
+ spines. If not all spines support a given method, it's executed only on
+ the subset of spines that support it.
+ """
+ def __init__(self, spine_dict):
+ self._spine_dict = spine_dict
+
+ def __getattr__(self, name):
+ broadcast_targets = [spine for spine in self._spine_dict.values()
+ if hasattr(spine, name)]
+ if not name.startswith('set_') or not broadcast_targets:
+ raise AttributeError(
+ f"'SpinesProxy' object has no attribute '{name}'")
+
+ def x(_targets, _funcname, *args, **kwargs):
+ for spine in _targets:
+ getattr(spine, _funcname)(*args, **kwargs)
+ x = functools.partial(x, broadcast_targets, name)
+ x.__doc__ = broadcast_targets[0].__doc__
+ return x
+
+ def __dir__(self):
+ names = []
+ for spine in self._spine_dict.values():
+ names.extend(name
+ for name in dir(spine) if name.startswith('set_'))
+ return list(sorted(set(names)))
+
+
+class Spines(MutableMapping):
+ r"""
+ The container of all `.Spine`\s in an Axes.
+
+ The interface is dict-like mapping names (e.g. 'left') to `.Spine` objects.
+ Additionally it implements some pandas.Series-like features like accessing
+ elements by attribute::
+
+ spines['top'].set_visible(False)
+ spines.top.set_visible(False)
+
+ Multiple spines can be addressed simultaneously by passing a list::
+
+ spines[['top', 'right']].set_visible(False)
+
+ Use an open slice to address all spines::
+
+ spines[:].set_visible(False)
+
+ The latter two indexing methods will return a `SpinesProxy` that broadcasts
+ all ``set_*`` calls to its members, but cannot be used for any other
+ operation.
+ """
+ def __init__(self, **kwargs):
+ self._dict = kwargs
+
+ @classmethod
+ def from_dict(cls, d):
+ return cls(**d)
+
+ def __getstate__(self):
+ return self._dict
+
+ def __setstate__(self, state):
+ self.__init__(**state)
+
+ def __getattr__(self, name):
+ try:
+ return self._dict[name]
+ except KeyError:
+ raise ValueError(
+ f"'Spines' object does not contain a '{name}' spine")
+
+ def __getitem__(self, key):
+ if isinstance(key, list):
+ unknown_keys = [k for k in key if k not in self._dict]
+ if unknown_keys:
+ raise KeyError(', '.join(unknown_keys))
+ return SpinesProxy({k: v for k, v in self._dict.items()
+ if k in key})
+ if isinstance(key, tuple):
+ raise ValueError('Multiple spines must be passed as a single list')
+ if isinstance(key, slice):
+ if key.start is None and key.stop is None and key.step is None:
+ return SpinesProxy(self._dict)
+ else:
+ raise ValueError(
+ 'Spines does not support slicing except for the fully '
+ 'open slice [:] to access all spines.')
+ return self._dict[key]
+
+ def __setitem__(self, key, value):
+ # TODO: Do we want to deprecate adding spines?
+ self._dict[key] = value
+
+ def __delitem__(self, key):
+ # TODO: Do we want to deprecate deleting spines?
+ del self._dict[key]
+
+ def __iter__(self):
+ return iter(self._dict)
+
+ def __len__(self):
+ return len(self._dict)
diff --git a/venv/Lib/site-packages/matplotlib/stackplot.py b/venv/Lib/site-packages/matplotlib/stackplot.py
new file mode 100644
index 0000000..a2e2698
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/stackplot.py
@@ -0,0 +1,121 @@
+"""
+Stacked area plot for 1D arrays inspired by Douglas Y'barbo's stackoverflow
+answer:
+http://stackoverflow.com/questions/2225995/how-can-i-create-stacked-line-graph-with-matplotlib
+
+(http://stackoverflow.com/users/66549/doug)
+"""
+
+import numpy as np
+
+from matplotlib import _api
+
+__all__ = ['stackplot']
+
+
+def stackplot(axes, x, *args,
+ labels=(), colors=None, baseline='zero',
+ **kwargs):
+ """
+ Draw a stacked area plot.
+
+ Parameters
+ ----------
+ x : (N,) array-like
+
+ y : (M, N) array-like
+ The data is assumed to be unstacked. Each of the following
+ calls is legal::
+
+ stackplot(x, y) # where y has shape (M, N)
+ stackplot(x, y1, y2, y3) # where y1, y2, y3, y4 have length N
+
+ baseline : {'zero', 'sym', 'wiggle', 'weighted_wiggle'}
+ Method used to calculate the baseline:
+
+ - ``'zero'``: Constant zero baseline, i.e. a simple stacked plot.
+ - ``'sym'``: Symmetric around zero and is sometimes called
+ 'ThemeRiver'.
+ - ``'wiggle'``: Minimizes the sum of the squared slopes.
+ - ``'weighted_wiggle'``: Does the same but weights to account for
+ size of each layer. It is also called 'Streamgraph'-layout. More
+ details can be found at http://leebyron.com/streamgraph/.
+
+ labels : list of str, optional
+ A sequence of labels to assign to each data series. If unspecified,
+ then no labels will be applied to artists.
+
+ colors : list of color, optional
+ A sequence of colors to be cycled through and used to color the stacked
+ areas. The sequence need not be exactly the same length as the number
+ of provided *y*, in which case the colors will repeat from the
+ beginning.
+
+ If not specified, the colors from the Axes property cycle will be used.
+
+ **kwargs
+ All other keyword arguments are passed to `.Axes.fill_between`.
+
+ Returns
+ -------
+ list of `.PolyCollection`
+ A list of `.PolyCollection` instances, one for each element in the
+ stacked area plot.
+ """
+
+ y = np.row_stack(args)
+
+ labels = iter(labels)
+ if colors is not None:
+ axes.set_prop_cycle(color=colors)
+
+ # Assume data passed has not been 'stacked', so stack it here.
+ # We'll need a float buffer for the upcoming calculations.
+ stack = np.cumsum(y, axis=0, dtype=np.promote_types(y.dtype, np.float32))
+
+ _api.check_in_list(['zero', 'sym', 'wiggle', 'weighted_wiggle'],
+ baseline=baseline)
+ if baseline == 'zero':
+ first_line = 0.
+
+ elif baseline == 'sym':
+ first_line = -np.sum(y, 0) * 0.5
+ stack += first_line[None, :]
+
+ elif baseline == 'wiggle':
+ m = y.shape[0]
+ first_line = (y * (m - 0.5 - np.arange(m)[:, None])).sum(0)
+ first_line /= -m
+ stack += first_line
+
+ elif baseline == 'weighted_wiggle':
+ total = np.sum(y, 0)
+ # multiply by 1/total (or zero) to avoid infinities in the division:
+ inv_total = np.zeros_like(total)
+ mask = total > 0
+ inv_total[mask] = 1.0 / total[mask]
+ increase = np.hstack((y[:, 0:1], np.diff(y)))
+ below_size = total - stack
+ below_size += 0.5 * y
+ move_up = below_size * inv_total
+ move_up[:, 0] = 0.5
+ center = (move_up - 0.5) * increase
+ center = np.cumsum(center.sum(0))
+ first_line = center - 0.5 * total
+ stack += first_line
+
+ # Color between x = 0 and the first array.
+ color = axes._get_lines.get_next_color()
+ coll = axes.fill_between(x, first_line, stack[0, :],
+ facecolor=color, label=next(labels, None),
+ **kwargs)
+ coll.sticky_edges.y[:] = [0]
+ r = [coll]
+
+ # Color between array i-1 and array i
+ for i in range(len(y) - 1):
+ color = axes._get_lines.get_next_color()
+ r.append(axes.fill_between(x, stack[i, :], stack[i + 1, :],
+ facecolor=color, label=next(labels, None),
+ **kwargs))
+ return r
diff --git a/venv/Lib/site-packages/matplotlib/streamplot.py b/venv/Lib/site-packages/matplotlib/streamplot.py
new file mode 100644
index 0000000..4e75ee1
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/streamplot.py
@@ -0,0 +1,707 @@
+"""
+Streamline plotting for 2D vector fields.
+
+"""
+
+import numpy as np
+
+import matplotlib
+from matplotlib import _api, cm
+import matplotlib.colors as mcolors
+import matplotlib.collections as mcollections
+import matplotlib.lines as mlines
+import matplotlib.patches as patches
+
+
+__all__ = ['streamplot']
+
+
+def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
+ cmap=None, norm=None, arrowsize=1, arrowstyle='-|>',
+ minlength=0.1, transform=None, zorder=None, start_points=None,
+ maxlength=4.0, integration_direction='both'):
+ """
+ Draw streamlines of a vector flow.
+
+ Parameters
+ ----------
+ x, y : 1D/2D arrays
+ Evenly spaced strictly increasing arrays to make a grid.
+ u, v : 2D arrays
+ *x* and *y*-velocities. The number of rows and columns must match
+ the length of *y* and *x*, respectively.
+ density : float or (float, float)
+ Controls the closeness of streamlines. When ``density = 1``, the domain
+ is divided into a 30x30 grid. *density* linearly scales this grid.
+ Each cell in the grid can have, at most, one traversing streamline.
+ For different densities in each direction, use a tuple
+ (density_x, density_y).
+ linewidth : float or 2D array
+ The width of the stream lines. With a 2D array the line width can be
+ varied across the grid. The array must have the same shape as *u*
+ and *v*.
+ color : color or 2D array
+ The streamline color. If given an array, its values are converted to
+ colors using *cmap* and *norm*. The array must have the same shape
+ as *u* and *v*.
+ cmap : `~matplotlib.colors.Colormap`
+ Colormap used to plot streamlines and arrows. This is only used if
+ *color* is an array.
+ norm : `~matplotlib.colors.Normalize`
+ Normalize object used to scale luminance data to 0, 1. If ``None``,
+ stretch (min, max) to (0, 1). This is only used if *color* is an array.
+ arrowsize : float
+ Scaling factor for the arrow size.
+ arrowstyle : str
+ Arrow style specification.
+ See `~matplotlib.patches.FancyArrowPatch`.
+ minlength : float
+ Minimum length of streamline in axes coordinates.
+ start_points : Nx2 array
+ Coordinates of starting points for the streamlines in data coordinates
+ (the same coordinates as the *x* and *y* arrays).
+ zorder : int
+ The zorder of the stream lines and arrows.
+ Artists with lower zorder values are drawn first.
+ maxlength : float
+ Maximum length of streamline in axes coordinates.
+ integration_direction : {'forward', 'backward', 'both'}, default: 'both'
+ Integrate the streamline in forward, backward or both directions.
+
+ Returns
+ -------
+ StreamplotSet
+ Container object with attributes
+
+ - ``lines``: `.LineCollection` of streamlines
+
+ - ``arrows``: `.PatchCollection` containing `.FancyArrowPatch`
+ objects representing the arrows half-way along stream lines.
+
+ This container will probably change in the future to allow changes
+ to the colormap, alpha, etc. for both lines and arrows, but these
+ changes should be backward compatible.
+ """
+ grid = Grid(x, y)
+ mask = StreamMask(density)
+ dmap = DomainMap(grid, mask)
+
+ if zorder is None:
+ zorder = mlines.Line2D.zorder
+
+ # default to data coordinates
+ if transform is None:
+ transform = axes.transData
+
+ if color is None:
+ color = axes._get_lines.get_next_color()
+
+ if linewidth is None:
+ linewidth = matplotlib.rcParams['lines.linewidth']
+
+ line_kw = {}
+ arrow_kw = dict(arrowstyle=arrowstyle, mutation_scale=10 * arrowsize)
+
+ _api.check_in_list(['both', 'forward', 'backward'],
+ integration_direction=integration_direction)
+
+ if integration_direction == 'both':
+ maxlength /= 2.
+
+ use_multicolor_lines = isinstance(color, np.ndarray)
+ if use_multicolor_lines:
+ if color.shape != grid.shape:
+ raise ValueError("If 'color' is given, it must match the shape of "
+ "'Grid(x, y)'")
+ line_colors = []
+ color = np.ma.masked_invalid(color)
+ else:
+ line_kw['color'] = color
+ arrow_kw['color'] = color
+
+ if isinstance(linewidth, np.ndarray):
+ if linewidth.shape != grid.shape:
+ raise ValueError("If 'linewidth' is given, it must match the "
+ "shape of 'Grid(x, y)'")
+ line_kw['linewidth'] = []
+ else:
+ line_kw['linewidth'] = linewidth
+ arrow_kw['linewidth'] = linewidth
+
+ line_kw['zorder'] = zorder
+ arrow_kw['zorder'] = zorder
+
+ # Sanity checks.
+ if u.shape != grid.shape or v.shape != grid.shape:
+ raise ValueError("'u' and 'v' must match the shape of 'Grid(x, y)'")
+
+ u = np.ma.masked_invalid(u)
+ v = np.ma.masked_invalid(v)
+
+ integrate = get_integrator(u, v, dmap, minlength, maxlength,
+ integration_direction)
+
+ trajectories = []
+ if start_points is None:
+ for xm, ym in _gen_starting_points(mask.shape):
+ if mask[ym, xm] == 0:
+ xg, yg = dmap.mask2grid(xm, ym)
+ t = integrate(xg, yg)
+ if t is not None:
+ trajectories.append(t)
+ else:
+ sp2 = np.asanyarray(start_points, dtype=float).copy()
+
+ # Check if start_points are outside the data boundaries
+ for xs, ys in sp2:
+ if not (grid.x_origin <= xs <= grid.x_origin + grid.width and
+ grid.y_origin <= ys <= grid.y_origin + grid.height):
+ raise ValueError("Starting point ({}, {}) outside of data "
+ "boundaries".format(xs, ys))
+
+ # Convert start_points from data to array coords
+ # Shift the seed points from the bottom left of the data so that
+ # data2grid works properly.
+ sp2[:, 0] -= grid.x_origin
+ sp2[:, 1] -= grid.y_origin
+
+ for xs, ys in sp2:
+ xg, yg = dmap.data2grid(xs, ys)
+ t = integrate(xg, yg)
+ if t is not None:
+ trajectories.append(t)
+
+ if use_multicolor_lines:
+ if norm is None:
+ norm = mcolors.Normalize(color.min(), color.max())
+ if cmap is None:
+ cmap = cm.get_cmap(matplotlib.rcParams['image.cmap'])
+ else:
+ cmap = cm.get_cmap(cmap)
+
+ streamlines = []
+ arrows = []
+ for t in trajectories:
+ tgx = np.array(t[0])
+ tgy = np.array(t[1])
+ # Rescale from grid-coordinates to data-coordinates.
+ tx, ty = dmap.grid2data(*np.array(t))
+ tx += grid.x_origin
+ ty += grid.y_origin
+
+ points = np.transpose([tx, ty]).reshape(-1, 1, 2)
+ streamlines.extend(np.hstack([points[:-1], points[1:]]))
+
+ # Add arrows half way along each trajectory.
+ s = np.cumsum(np.hypot(np.diff(tx), np.diff(ty)))
+ n = np.searchsorted(s, s[-1] / 2.)
+ arrow_tail = (tx[n], ty[n])
+ arrow_head = (np.mean(tx[n:n + 2]), np.mean(ty[n:n + 2]))
+
+ if isinstance(linewidth, np.ndarray):
+ line_widths = interpgrid(linewidth, tgx, tgy)[:-1]
+ line_kw['linewidth'].extend(line_widths)
+ arrow_kw['linewidth'] = line_widths[n]
+
+ if use_multicolor_lines:
+ color_values = interpgrid(color, tgx, tgy)[:-1]
+ line_colors.append(color_values)
+ arrow_kw['color'] = cmap(norm(color_values[n]))
+
+ p = patches.FancyArrowPatch(
+ arrow_tail, arrow_head, transform=transform, **arrow_kw)
+ axes.add_patch(p)
+ arrows.append(p)
+
+ lc = mcollections.LineCollection(
+ streamlines, transform=transform, **line_kw)
+ lc.sticky_edges.x[:] = [grid.x_origin, grid.x_origin + grid.width]
+ lc.sticky_edges.y[:] = [grid.y_origin, grid.y_origin + grid.height]
+ if use_multicolor_lines:
+ lc.set_array(np.ma.hstack(line_colors))
+ lc.set_cmap(cmap)
+ lc.set_norm(norm)
+ axes.add_collection(lc)
+ axes.autoscale_view()
+
+ ac = matplotlib.collections.PatchCollection(arrows)
+ stream_container = StreamplotSet(lc, ac)
+ return stream_container
+
+
+class StreamplotSet:
+
+ def __init__(self, lines, arrows, **kwargs):
+ if kwargs:
+ _api.warn_deprecated(
+ "3.3",
+ message="Passing arbitrary keyword arguments to StreamplotSet "
+ "is deprecated since %(since) and will become an "
+ "error %(removal)s.")
+ self.lines = lines
+ self.arrows = arrows
+
+
+# Coordinate definitions
+# ========================
+
+class DomainMap:
+ """
+ Map representing different coordinate systems.
+
+ Coordinate definitions:
+
+ * axes-coordinates goes from 0 to 1 in the domain.
+ * data-coordinates are specified by the input x-y coordinates.
+ * grid-coordinates goes from 0 to N and 0 to M for an N x M grid,
+ where N and M match the shape of the input data.
+ * mask-coordinates goes from 0 to N and 0 to M for an N x M mask,
+ where N and M are user-specified to control the density of streamlines.
+
+ This class also has methods for adding trajectories to the StreamMask.
+ Before adding a trajectory, run `start_trajectory` to keep track of regions
+ crossed by a given trajectory. Later, if you decide the trajectory is bad
+ (e.g., if the trajectory is very short) just call `undo_trajectory`.
+ """
+
+ def __init__(self, grid, mask):
+ self.grid = grid
+ self.mask = mask
+ # Constants for conversion between grid- and mask-coordinates
+ self.x_grid2mask = (mask.nx - 1) / (grid.nx - 1)
+ self.y_grid2mask = (mask.ny - 1) / (grid.ny - 1)
+
+ self.x_mask2grid = 1. / self.x_grid2mask
+ self.y_mask2grid = 1. / self.y_grid2mask
+
+ self.x_data2grid = 1. / grid.dx
+ self.y_data2grid = 1. / grid.dy
+
+ def grid2mask(self, xi, yi):
+ """Return nearest space in mask-coords from given grid-coords."""
+ return (int(xi * self.x_grid2mask + 0.5),
+ int(yi * self.y_grid2mask + 0.5))
+
+ def mask2grid(self, xm, ym):
+ return xm * self.x_mask2grid, ym * self.y_mask2grid
+
+ def data2grid(self, xd, yd):
+ return xd * self.x_data2grid, yd * self.y_data2grid
+
+ def grid2data(self, xg, yg):
+ return xg / self.x_data2grid, yg / self.y_data2grid
+
+ def start_trajectory(self, xg, yg):
+ xm, ym = self.grid2mask(xg, yg)
+ self.mask._start_trajectory(xm, ym)
+
+ def reset_start_point(self, xg, yg):
+ xm, ym = self.grid2mask(xg, yg)
+ self.mask._current_xy = (xm, ym)
+
+ def update_trajectory(self, xg, yg):
+ if not self.grid.within_grid(xg, yg):
+ raise InvalidIndexError
+ xm, ym = self.grid2mask(xg, yg)
+ self.mask._update_trajectory(xm, ym)
+
+ def undo_trajectory(self):
+ self.mask._undo_trajectory()
+
+
+class Grid:
+ """Grid of data."""
+ def __init__(self, x, y):
+
+ if x.ndim == 1:
+ pass
+ elif x.ndim == 2:
+ x_row = x[0, :]
+ if not np.allclose(x_row, x):
+ raise ValueError("The rows of 'x' must be equal")
+ x = x_row
+ else:
+ raise ValueError("'x' can have at maximum 2 dimensions")
+
+ if y.ndim == 1:
+ pass
+ elif y.ndim == 2:
+ y_col = y[:, 0]
+ if not np.allclose(y_col, y.T):
+ raise ValueError("The columns of 'y' must be equal")
+ y = y_col
+ else:
+ raise ValueError("'y' can have at maximum 2 dimensions")
+
+ if not (np.diff(x) > 0).all():
+ raise ValueError("'x' must be strictly increasing")
+ if not (np.diff(y) > 0).all():
+ raise ValueError("'y' must be strictly increasing")
+
+ self.nx = len(x)
+ self.ny = len(y)
+
+ self.dx = x[1] - x[0]
+ self.dy = y[1] - y[0]
+
+ self.x_origin = x[0]
+ self.y_origin = y[0]
+
+ self.width = x[-1] - x[0]
+ self.height = y[-1] - y[0]
+
+ if not np.allclose(np.diff(x), self.width / (self.nx - 1)):
+ raise ValueError("'x' values must be equally spaced")
+ if not np.allclose(np.diff(y), self.height / (self.ny - 1)):
+ raise ValueError("'y' values must be equally spaced")
+
+ @property
+ def shape(self):
+ return self.ny, self.nx
+
+ def within_grid(self, xi, yi):
+ """Return whether (*xi*, *yi*) is a valid index of the grid."""
+ # Note that xi/yi can be floats; so, for example, we can't simply check
+ # `xi < self.nx` since *xi* can be `self.nx - 1 < xi < self.nx`
+ return 0 <= xi <= self.nx - 1 and 0 <= yi <= self.ny - 1
+
+
+class StreamMask:
+ """
+ Mask to keep track of discrete regions crossed by streamlines.
+
+ The resolution of this grid determines the approximate spacing between
+ trajectories. Streamlines are only allowed to pass through zeroed cells:
+ When a streamline enters a cell, that cell is set to 1, and no new
+ streamlines are allowed to enter.
+ """
+
+ def __init__(self, density):
+ try:
+ self.nx, self.ny = (30 * np.broadcast_to(density, 2)).astype(int)
+ except ValueError as err:
+ raise ValueError("'density' must be a scalar or be of length "
+ "2") from err
+ if self.nx < 0 or self.ny < 0:
+ raise ValueError("'density' must be positive")
+ self._mask = np.zeros((self.ny, self.nx))
+ self.shape = self._mask.shape
+
+ self._current_xy = None
+
+ def __getitem__(self, args):
+ return self._mask[args]
+
+ def _start_trajectory(self, xm, ym):
+ """Start recording streamline trajectory"""
+ self._traj = []
+ self._update_trajectory(xm, ym)
+
+ def _undo_trajectory(self):
+ """Remove current trajectory from mask"""
+ for t in self._traj:
+ self._mask[t] = 0
+
+ def _update_trajectory(self, xm, ym):
+ """
+ Update current trajectory position in mask.
+
+ If the new position has already been filled, raise `InvalidIndexError`.
+ """
+ if self._current_xy != (xm, ym):
+ if self[ym, xm] == 0:
+ self._traj.append((ym, xm))
+ self._mask[ym, xm] = 1
+ self._current_xy = (xm, ym)
+ else:
+ raise InvalidIndexError
+
+
+class InvalidIndexError(Exception):
+ pass
+
+
+class TerminateTrajectory(Exception):
+ pass
+
+
+# Integrator definitions
+# =======================
+
+def get_integrator(u, v, dmap, minlength, maxlength, integration_direction):
+
+ # rescale velocity onto grid-coordinates for integrations.
+ u, v = dmap.data2grid(u, v)
+
+ # speed (path length) will be in axes-coordinates
+ u_ax = u / (dmap.grid.nx - 1)
+ v_ax = v / (dmap.grid.ny - 1)
+ speed = np.ma.sqrt(u_ax ** 2 + v_ax ** 2)
+
+ def forward_time(xi, yi):
+ if not dmap.grid.within_grid(xi, yi):
+ raise OutOfBounds
+ ds_dt = interpgrid(speed, xi, yi)
+ if ds_dt == 0:
+ raise TerminateTrajectory()
+ dt_ds = 1. / ds_dt
+ ui = interpgrid(u, xi, yi)
+ vi = interpgrid(v, xi, yi)
+ return ui * dt_ds, vi * dt_ds
+
+ def backward_time(xi, yi):
+ dxi, dyi = forward_time(xi, yi)
+ return -dxi, -dyi
+
+ def integrate(x0, y0):
+ """
+ Return x, y grid-coordinates of trajectory based on starting point.
+
+ Integrate both forward and backward in time from starting point in
+ grid coordinates.
+
+ Integration is terminated when a trajectory reaches a domain boundary
+ or when it crosses into an already occupied cell in the StreamMask. The
+ resulting trajectory is None if it is shorter than `minlength`.
+ """
+
+ stotal, x_traj, y_traj = 0., [], []
+
+ try:
+ dmap.start_trajectory(x0, y0)
+ except InvalidIndexError:
+ return None
+ if integration_direction in ['both', 'backward']:
+ s, xt, yt = _integrate_rk12(x0, y0, dmap, backward_time, maxlength)
+ stotal += s
+ x_traj += xt[::-1]
+ y_traj += yt[::-1]
+
+ if integration_direction in ['both', 'forward']:
+ dmap.reset_start_point(x0, y0)
+ s, xt, yt = _integrate_rk12(x0, y0, dmap, forward_time, maxlength)
+ if len(x_traj) > 0:
+ xt = xt[1:]
+ yt = yt[1:]
+ stotal += s
+ x_traj += xt
+ y_traj += yt
+
+ if stotal > minlength:
+ return x_traj, y_traj
+ else: # reject short trajectories
+ dmap.undo_trajectory()
+ return None
+
+ return integrate
+
+
+class OutOfBounds(IndexError):
+ pass
+
+
+def _integrate_rk12(x0, y0, dmap, f, maxlength):
+ """
+ 2nd-order Runge-Kutta algorithm with adaptive step size.
+
+ This method is also referred to as the improved Euler's method, or Heun's
+ method. This method is favored over higher-order methods because:
+
+ 1. To get decent looking trajectories and to sample every mask cell
+ on the trajectory we need a small timestep, so a lower order
+ solver doesn't hurt us unless the data is *very* high resolution.
+ In fact, for cases where the user inputs
+ data smaller or of similar grid size to the mask grid, the higher
+ order corrections are negligible because of the very fast linear
+ interpolation used in `interpgrid`.
+
+ 2. For high resolution input data (i.e. beyond the mask
+ resolution), we must reduce the timestep. Therefore, an adaptive
+ timestep is more suited to the problem as this would be very hard
+ to judge automatically otherwise.
+
+ This integrator is about 1.5 - 2x as fast as both the RK4 and RK45
+ solvers in most setups on my machine. I would recommend removing the
+ other two to keep things simple.
+ """
+ # This error is below that needed to match the RK4 integrator. It
+ # is set for visual reasons -- too low and corners start
+ # appearing ugly and jagged. Can be tuned.
+ maxerror = 0.003
+
+ # This limit is important (for all integrators) to avoid the
+ # trajectory skipping some mask cells. We could relax this
+ # condition if we use the code which is commented out below to
+ # increment the location gradually. However, due to the efficient
+ # nature of the interpolation, this doesn't boost speed by much
+ # for quite a bit of complexity.
+ maxds = min(1. / dmap.mask.nx, 1. / dmap.mask.ny, 0.1)
+
+ ds = maxds
+ stotal = 0
+ xi = x0
+ yi = y0
+ xf_traj = []
+ yf_traj = []
+
+ while True:
+ try:
+ if dmap.grid.within_grid(xi, yi):
+ xf_traj.append(xi)
+ yf_traj.append(yi)
+ else:
+ raise OutOfBounds
+
+ # Compute the two intermediate gradients.
+ # f should raise OutOfBounds if the locations given are
+ # outside the grid.
+ k1x, k1y = f(xi, yi)
+ k2x, k2y = f(xi + ds * k1x, yi + ds * k1y)
+
+ except OutOfBounds:
+ # Out of the domain during this step.
+ # Take an Euler step to the boundary to improve neatness
+ # unless the trajectory is currently empty.
+ if xf_traj:
+ ds, xf_traj, yf_traj = _euler_step(xf_traj, yf_traj,
+ dmap, f)
+ stotal += ds
+ break
+ except TerminateTrajectory:
+ break
+
+ dx1 = ds * k1x
+ dy1 = ds * k1y
+ dx2 = ds * 0.5 * (k1x + k2x)
+ dy2 = ds * 0.5 * (k1y + k2y)
+
+ nx, ny = dmap.grid.shape
+ # Error is normalized to the axes coordinates
+ error = np.hypot((dx2 - dx1) / (nx - 1), (dy2 - dy1) / (ny - 1))
+
+ # Only save step if within error tolerance
+ if error < maxerror:
+ xi += dx2
+ yi += dy2
+ try:
+ dmap.update_trajectory(xi, yi)
+ except InvalidIndexError:
+ break
+ if stotal + ds > maxlength:
+ break
+ stotal += ds
+
+ # recalculate stepsize based on step error
+ if error == 0:
+ ds = maxds
+ else:
+ ds = min(maxds, 0.85 * ds * (maxerror / error) ** 0.5)
+
+ return stotal, xf_traj, yf_traj
+
+
+def _euler_step(xf_traj, yf_traj, dmap, f):
+ """Simple Euler integration step that extends streamline to boundary."""
+ ny, nx = dmap.grid.shape
+ xi = xf_traj[-1]
+ yi = yf_traj[-1]
+ cx, cy = f(xi, yi)
+ if cx == 0:
+ dsx = np.inf
+ elif cx < 0:
+ dsx = xi / -cx
+ else:
+ dsx = (nx - 1 - xi) / cx
+ if cy == 0:
+ dsy = np.inf
+ elif cy < 0:
+ dsy = yi / -cy
+ else:
+ dsy = (ny - 1 - yi) / cy
+ ds = min(dsx, dsy)
+ xf_traj.append(xi + cx * ds)
+ yf_traj.append(yi + cy * ds)
+ return ds, xf_traj, yf_traj
+
+
+# Utility functions
+# ========================
+
+def interpgrid(a, xi, yi):
+ """Fast 2D, linear interpolation on an integer grid"""
+
+ Ny, Nx = np.shape(a)
+ if isinstance(xi, np.ndarray):
+ x = xi.astype(int)
+ y = yi.astype(int)
+ # Check that xn, yn don't exceed max index
+ xn = np.clip(x + 1, 0, Nx - 1)
+ yn = np.clip(y + 1, 0, Ny - 1)
+ else:
+ x = int(xi)
+ y = int(yi)
+ # conditional is faster than clipping for integers
+ if x == (Nx - 1):
+ xn = x
+ else:
+ xn = x + 1
+ if y == (Ny - 1):
+ yn = y
+ else:
+ yn = y + 1
+
+ a00 = a[y, x]
+ a01 = a[y, xn]
+ a10 = a[yn, x]
+ a11 = a[yn, xn]
+ xt = xi - x
+ yt = yi - y
+ a0 = a00 * (1 - xt) + a01 * xt
+ a1 = a10 * (1 - xt) + a11 * xt
+ ai = a0 * (1 - yt) + a1 * yt
+
+ if not isinstance(xi, np.ndarray):
+ if np.ma.is_masked(ai):
+ raise TerminateTrajectory
+
+ return ai
+
+
+def _gen_starting_points(shape):
+ """
+ Yield starting points for streamlines.
+
+ Trying points on the boundary first gives higher quality streamlines.
+ This algorithm starts with a point on the mask corner and spirals inward.
+ This algorithm is inefficient, but fast compared to rest of streamplot.
+ """
+ ny, nx = shape
+ xfirst = 0
+ yfirst = 1
+ xlast = nx - 1
+ ylast = ny - 1
+ x, y = 0, 0
+ direction = 'right'
+ for i in range(nx * ny):
+ yield x, y
+
+ if direction == 'right':
+ x += 1
+ if x >= xlast:
+ xlast -= 1
+ direction = 'up'
+ elif direction == 'up':
+ y += 1
+ if y >= ylast:
+ ylast -= 1
+ direction = 'left'
+ elif direction == 'left':
+ x -= 1
+ if x <= xfirst:
+ xfirst += 1
+ direction = 'down'
+ elif direction == 'down':
+ y -= 1
+ if y <= yfirst:
+ yfirst += 1
+ direction = 'right'
diff --git a/venv/Lib/site-packages/matplotlib/style/__init__.py b/venv/Lib/site-packages/matplotlib/style/__init__.py
new file mode 100644
index 0000000..42d050d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/style/__init__.py
@@ -0,0 +1 @@
+from .core import use, context, available, library, reload_library
diff --git a/venv/Lib/site-packages/matplotlib/style/core.py b/venv/Lib/site-packages/matplotlib/style/core.py
new file mode 100644
index 0000000..0c2f632
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/style/core.py
@@ -0,0 +1,221 @@
+"""
+Core functions and attributes for the matplotlib style library:
+
+``use``
+ Select style sheet to override the current matplotlib settings.
+``context``
+ Context manager to use a style sheet temporarily.
+``available``
+ List available style sheets.
+``library``
+ A dictionary of style names and matplotlib settings.
+"""
+
+import contextlib
+import logging
+import os
+from pathlib import Path
+import re
+import warnings
+
+import matplotlib as mpl
+from matplotlib import _api, rc_params_from_file, rcParamsDefault
+
+_log = logging.getLogger(__name__)
+
+__all__ = ['use', 'context', 'available', 'library', 'reload_library']
+
+
+BASE_LIBRARY_PATH = os.path.join(mpl.get_data_path(), 'stylelib')
+# Users may want multiple library paths, so store a list of paths.
+USER_LIBRARY_PATHS = [os.path.join(mpl.get_configdir(), 'stylelib')]
+STYLE_EXTENSION = 'mplstyle'
+STYLE_FILE_PATTERN = re.compile(r'([\S]+).%s$' % STYLE_EXTENSION)
+
+
+# A list of rcParams that should not be applied from styles
+STYLE_BLACKLIST = {
+ 'interactive', 'backend', 'backend.qt4', 'webagg.port', 'webagg.address',
+ 'webagg.port_retries', 'webagg.open_in_browser', 'backend_fallback',
+ 'toolbar', 'timezone', 'datapath', 'figure.max_open_warning',
+ 'figure.raise_window', 'savefig.directory', 'tk.window_focus',
+ 'docstring.hardcopy', 'date.epoch'}
+
+
+def _remove_blacklisted_style_params(d, warn=True):
+ o = {}
+ for key in d: # prevent triggering RcParams.__getitem__('backend')
+ if key in STYLE_BLACKLIST:
+ if warn:
+ _api.warn_external(
+ "Style includes a parameter, '{0}', that is not related "
+ "to style. Ignoring".format(key))
+ else:
+ o[key] = d[key]
+ return o
+
+
+def _apply_style(d, warn=True):
+ mpl.rcParams.update(_remove_blacklisted_style_params(d, warn=warn))
+
+
+def use(style):
+ """
+ Use Matplotlib style settings from a style specification.
+
+ The style name of 'default' is reserved for reverting back to
+ the default style settings.
+
+ .. note::
+
+ This updates the `.rcParams` with the settings from the style.
+ `.rcParams` not defined in the style are kept.
+
+ Parameters
+ ----------
+ style : str, dict, Path or list
+ A style specification. Valid options are:
+
+ +------+-------------------------------------------------------------+
+ | str | The name of a style or a path/URL to a style file. For a |
+ | | list of available style names, see `style.available`. |
+ +------+-------------------------------------------------------------+
+ | dict | Dictionary with valid key/value pairs for |
+ | | `matplotlib.rcParams`. |
+ +------+-------------------------------------------------------------+
+ | Path | A path-like object which is a path to a style file. |
+ +------+-------------------------------------------------------------+
+ | list | A list of style specifiers (str, Path or dict) applied from |
+ | | first to last in the list. |
+ +------+-------------------------------------------------------------+
+
+ """
+ style_alias = {'mpl20': 'default',
+ 'mpl15': 'classic'}
+ if isinstance(style, (str, Path)) or hasattr(style, 'keys'):
+ # If name is a single str, Path or dict, make it a single element list.
+ styles = [style]
+ else:
+ styles = style
+
+ styles = (style_alias.get(s, s) if isinstance(s, str) else s
+ for s in styles)
+ for style in styles:
+ if not isinstance(style, (str, Path)):
+ _apply_style(style)
+ elif style == 'default':
+ # Deprecation warnings were already handled when creating
+ # rcParamsDefault, no need to reemit them here.
+ with _api.suppress_matplotlib_deprecation_warning():
+ _apply_style(rcParamsDefault, warn=False)
+ elif style in library:
+ _apply_style(library[style])
+ else:
+ try:
+ rc = rc_params_from_file(style, use_default_template=False)
+ _apply_style(rc)
+ except IOError as err:
+ raise IOError(
+ "{!r} not found in the style library and input is not a "
+ "valid URL or path; see `style.available` for list of "
+ "available styles".format(style)) from err
+
+
+@contextlib.contextmanager
+def context(style, after_reset=False):
+ """
+ Context manager for using style settings temporarily.
+
+ Parameters
+ ----------
+ style : str, dict, Path or list
+ A style specification. Valid options are:
+
+ +------+-------------------------------------------------------------+
+ | str | The name of a style or a path/URL to a style file. For a |
+ | | list of available style names, see `style.available`. |
+ +------+-------------------------------------------------------------+
+ | dict | Dictionary with valid key/value pairs for |
+ | | `matplotlib.rcParams`. |
+ +------+-------------------------------------------------------------+
+ | Path | A path-like object which is a path to a style file. |
+ +------+-------------------------------------------------------------+
+ | list | A list of style specifiers (str, Path or dict) applied from |
+ | | first to last in the list. |
+ +------+-------------------------------------------------------------+
+
+ after_reset : bool
+ If True, apply style after resetting settings to their defaults;
+ otherwise, apply style on top of the current settings.
+ """
+ with mpl.rc_context():
+ if after_reset:
+ mpl.rcdefaults()
+ use(style)
+ yield
+
+
+def load_base_library():
+ """Load style library defined in this package."""
+ library = read_style_directory(BASE_LIBRARY_PATH)
+ return library
+
+
+def iter_user_libraries():
+ for stylelib_path in USER_LIBRARY_PATHS:
+ stylelib_path = os.path.expanduser(stylelib_path)
+ if os.path.exists(stylelib_path) and os.path.isdir(stylelib_path):
+ yield stylelib_path
+
+
+def update_user_library(library):
+ """Update style library with user-defined rc files."""
+ for stylelib_path in iter_user_libraries():
+ styles = read_style_directory(stylelib_path)
+ update_nested_dict(library, styles)
+ return library
+
+
+def read_style_directory(style_dir):
+ """Return dictionary of styles defined in *style_dir*."""
+ styles = dict()
+ for path in Path(style_dir).glob(f"*.{STYLE_EXTENSION}"):
+ with warnings.catch_warnings(record=True) as warns:
+ styles[path.stem] = rc_params_from_file(
+ path, use_default_template=False)
+ for w in warns:
+ _log.warning('In %s: %s', path, w.message)
+ return styles
+
+
+def update_nested_dict(main_dict, new_dict):
+ """
+ Update nested dict (only level of nesting) with new values.
+
+ Unlike `dict.update`, this assumes that the values of the parent dict are
+ dicts (or dict-like), so you shouldn't replace the nested dict if it
+ already exists. Instead you should update the sub-dict.
+ """
+ # update named styles specified by user
+ for name, rc_dict in new_dict.items():
+ main_dict.setdefault(name, {}).update(rc_dict)
+ return main_dict
+
+
+# Load style library
+# ==================
+_base_library = load_base_library()
+
+library = None
+
+available = []
+
+
+def reload_library():
+ """Reload the style library."""
+ global library
+ library = update_user_library(_base_library)
+ available[:] = sorted(library.keys())
+
+
+reload_library()
diff --git a/venv/Lib/site-packages/matplotlib/table.py b/venv/Lib/site-packages/matplotlib/table.py
new file mode 100644
index 0000000..965cb6e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/table.py
@@ -0,0 +1,822 @@
+# Original code by:
+# John Gill
+# Copyright 2004 John Gill and John Hunter
+#
+# Subsequent changes:
+# The Matplotlib development team
+# Copyright The Matplotlib development team
+
+"""
+Tables drawing.
+
+Use the factory function `~matplotlib.table.table` to create a ready-made
+table from texts. If you need more control, use the `.Table` class and its
+methods.
+
+The table consists of a grid of cells, which are indexed by (row, column).
+The cell (0, 0) is positioned at the top left.
+
+Thanks to John Gill for providing the class and table.
+"""
+
+from . import _api, artist, docstring
+from .artist import Artist, allow_rasterization
+from .patches import Rectangle
+from .text import Text
+from .transforms import Bbox
+from .path import Path
+
+
+class Cell(Rectangle):
+ """
+ A cell is a `.Rectangle` with some associated `.Text`.
+
+ As a user, you'll most likely not creates cells yourself. Instead, you
+ should use either the `~matplotlib.table.table` factory function or
+ `.Table.add_cell`.
+ """
+
+ PAD = 0.1
+ """Padding between text and rectangle."""
+
+ _edges = 'BRTL'
+ _edge_aliases = {'open': '',
+ 'closed': _edges, # default
+ 'horizontal': 'BT',
+ 'vertical': 'RL'
+ }
+
+ def __init__(self, xy, width, height,
+ edgecolor='k', facecolor='w',
+ fill=True,
+ text='',
+ loc=None,
+ fontproperties=None,
+ *,
+ visible_edges='closed',
+ ):
+ """
+ Parameters
+ ----------
+ xy : 2-tuple
+ The position of the bottom left corner of the cell.
+ width : float
+ The cell width.
+ height : float
+ The cell height.
+ edgecolor : color
+ The color of the cell border.
+ facecolor : color
+ The cell facecolor.
+ fill : bool
+ Whether the cell background is filled.
+ text : str
+ The cell text.
+ loc : {'left', 'center', 'right'}, default: 'right'
+ The alignment of the text within the cell.
+ fontproperties : dict
+ A dict defining the font properties of the text. Supported keys and
+ values are the keyword arguments accepted by `.FontProperties`.
+ visible_edges : str, default: 'closed'
+ The cell edges to be drawn with a line: a substring of 'BRTL'
+ (bottom, right, top, left), or one of 'open' (no edges drawn),
+ 'closed' (all edges drawn), 'horizontal' (bottom and top),
+ 'vertical' (right and left).
+ """
+
+ # Call base
+ super().__init__(xy, width=width, height=height, fill=fill,
+ edgecolor=edgecolor, facecolor=facecolor)
+ self.set_clip_on(False)
+ self.visible_edges = visible_edges
+
+ # Create text object
+ if loc is None:
+ loc = 'right'
+ self._loc = loc
+ self._text = Text(x=xy[0], y=xy[1], clip_on=False,
+ text=text, fontproperties=fontproperties,
+ horizontalalignment=loc, verticalalignment='center')
+
+ def set_transform(self, trans):
+ super().set_transform(trans)
+ # the text does not get the transform!
+ self.stale = True
+
+ def set_figure(self, fig):
+ super().set_figure(fig)
+ self._text.set_figure(fig)
+
+ def get_text(self):
+ """Return the cell `.Text` instance."""
+ return self._text
+
+ def set_fontsize(self, size):
+ """Set the text fontsize."""
+ self._text.set_fontsize(size)
+ self.stale = True
+
+ def get_fontsize(self):
+ """Return the cell fontsize."""
+ return self._text.get_fontsize()
+
+ def auto_set_font_size(self, renderer):
+ """Shrink font size until the text fits into the cell width."""
+ fontsize = self.get_fontsize()
+ required = self.get_required_width(renderer)
+ while fontsize > 1 and required > self.get_width():
+ fontsize -= 1
+ self.set_fontsize(fontsize)
+ required = self.get_required_width(renderer)
+
+ return fontsize
+
+ @allow_rasterization
+ def draw(self, renderer):
+ if not self.get_visible():
+ return
+ # draw the rectangle
+ super().draw(renderer)
+ # position the text
+ self._set_text_position(renderer)
+ self._text.draw(renderer)
+ self.stale = False
+
+ def _set_text_position(self, renderer):
+ """Set text up so it is drawn in the right place."""
+ bbox = self.get_window_extent(renderer)
+ # center vertically
+ y = bbox.y0 + bbox.height / 2
+ # position horizontally
+ loc = self._text.get_horizontalalignment()
+ if loc == 'center':
+ x = bbox.x0 + bbox.width / 2
+ elif loc == 'left':
+ x = bbox.x0 + bbox.width * self.PAD
+ else: # right.
+ x = bbox.x0 + bbox.width * (1 - self.PAD)
+ self._text.set_position((x, y))
+
+ def get_text_bounds(self, renderer):
+ """
+ Return the text bounds as *(x, y, width, height)* in table coordinates.
+ """
+ return (self._text.get_window_extent(renderer)
+ .transformed(self.get_data_transform().inverted())
+ .bounds)
+
+ def get_required_width(self, renderer):
+ """Return the minimal required width for the cell."""
+ l, b, w, h = self.get_text_bounds(renderer)
+ return w * (1.0 + (2.0 * self.PAD))
+
+ @docstring.dedent_interpd
+ def set_text_props(self, **kwargs):
+ """
+ Update the text properties.
+
+ Valid keyword arguments are:
+
+ %(Text_kwdoc)s
+ """
+ self._text.update(kwargs)
+ self.stale = True
+
+ @property
+ def visible_edges(self):
+ """
+ The cell edges to be drawn with a line.
+
+ Reading this property returns a substring of 'BRTL' (bottom, right,
+ top, left').
+
+ When setting this property, you can use a substring of 'BRTL' or one
+ of {'open', 'closed', 'horizontal', 'vertical'}.
+ """
+ return self._visible_edges
+
+ @visible_edges.setter
+ def visible_edges(self, value):
+ if value is None:
+ self._visible_edges = self._edges
+ elif value in self._edge_aliases:
+ self._visible_edges = self._edge_aliases[value]
+ else:
+ if any(edge not in self._edges for edge in value):
+ raise ValueError('Invalid edge param {}, must only be one of '
+ '{} or string of {}'.format(
+ value,
+ ", ".join(self._edge_aliases),
+ ", ".join(self._edges)))
+ self._visible_edges = value
+ self.stale = True
+
+ def get_path(self):
+ """Return a `.Path` for the `.visible_edges`."""
+ codes = [Path.MOVETO]
+ codes.extend(
+ Path.LINETO if edge in self._visible_edges else Path.MOVETO
+ for edge in self._edges)
+ if Path.MOVETO not in codes[1:]: # All sides are visible
+ codes[-1] = Path.CLOSEPOLY
+ return Path(
+ [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 0.0]],
+ codes,
+ readonly=True
+ )
+
+
+CustomCell = Cell # Backcompat. alias.
+
+
+class Table(Artist):
+ """
+ A table of cells.
+
+ The table consists of a grid of cells, which are indexed by (row, column).
+
+ For a simple table, you'll have a full grid of cells with indices from
+ (0, 0) to (num_rows-1, num_cols-1), in which the cell (0, 0) is positioned
+ at the top left. However, you can also add cells with negative indices.
+ You don't have to add a cell to every grid position, so you can create
+ tables that have holes.
+
+ *Note*: You'll usually not create an empty table from scratch. Instead use
+ `~matplotlib.table.table` to create a table from data.
+ """
+ codes = {'best': 0,
+ 'upper right': 1, # default
+ 'upper left': 2,
+ 'lower left': 3,
+ 'lower right': 4,
+ 'center left': 5,
+ 'center right': 6,
+ 'lower center': 7,
+ 'upper center': 8,
+ 'center': 9,
+ 'top right': 10,
+ 'top left': 11,
+ 'bottom left': 12,
+ 'bottom right': 13,
+ 'right': 14,
+ 'left': 15,
+ 'top': 16,
+ 'bottom': 17,
+ }
+ """Possible values where to place the table relative to the Axes."""
+
+ FONTSIZE = 10
+
+ AXESPAD = 0.02
+ """The border between the Axes and the table edge in Axes units."""
+
+ def __init__(self, ax, loc=None, bbox=None, **kwargs):
+ """
+ Parameters
+ ----------
+ ax : `matplotlib.axes.Axes`
+ The `~.axes.Axes` to plot the table into.
+ loc : str
+ The position of the cell with respect to *ax*. This must be one of
+ the `~.Table.codes`.
+ bbox : `.Bbox` or None
+ A bounding box to draw the table into. If this is not *None*, this
+ overrides *loc*.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ `.Artist` properties.
+ """
+
+ super().__init__()
+
+ if isinstance(loc, str):
+ if loc not in self.codes:
+ raise ValueError(
+ "Unrecognized location {!r}. Valid locations are\n\t{}"
+ .format(loc, '\n\t'.join(self.codes)))
+ loc = self.codes[loc]
+ self.set_figure(ax.figure)
+ self._axes = ax
+ self._loc = loc
+ self._bbox = bbox
+
+ # use axes coords
+ ax._unstale_viewLim()
+ self.set_transform(ax.transAxes)
+
+ self._cells = {}
+ self._edges = None
+ self._autoColumns = []
+ self._autoFontsize = True
+ self.update(kwargs)
+
+ self.set_clip_on(False)
+
+ def add_cell(self, row, col, *args, **kwargs):
+ """
+ Create a cell and add it to the table.
+
+ Parameters
+ ----------
+ row : int
+ Row index.
+ col : int
+ Column index.
+ *args, **kwargs
+ All other parameters are passed on to `Cell`.
+
+ Returns
+ -------
+ `.Cell`
+ The created cell.
+
+ """
+ xy = (0, 0)
+ cell = Cell(xy, visible_edges=self.edges, *args, **kwargs)
+ self[row, col] = cell
+ return cell
+
+ def __setitem__(self, position, cell):
+ """
+ Set a custom cell in a given position.
+ """
+ _api.check_isinstance(Cell, cell=cell)
+ try:
+ row, col = position[0], position[1]
+ except Exception as err:
+ raise KeyError('Only tuples length 2 are accepted as '
+ 'coordinates') from err
+ cell.set_figure(self.figure)
+ cell.set_transform(self.get_transform())
+ cell.set_clip_on(False)
+ self._cells[row, col] = cell
+ self.stale = True
+
+ def __getitem__(self, position):
+ """Retrieve a custom cell from a given position."""
+ return self._cells[position]
+
+ @property
+ def edges(self):
+ """
+ The default value of `~.Cell.visible_edges` for newly added
+ cells using `.add_cell`.
+
+ Notes
+ -----
+ This setting does currently only affect newly created cells using
+ `.add_cell`.
+
+ To change existing cells, you have to set their edges explicitly::
+
+ for c in tab.get_celld().values():
+ c.visible_edges = 'horizontal'
+
+ """
+ return self._edges
+
+ @edges.setter
+ def edges(self, value):
+ self._edges = value
+ self.stale = True
+
+ def _approx_text_height(self):
+ return (self.FONTSIZE / 72.0 * self.figure.dpi /
+ self._axes.bbox.height * 1.2)
+
+ @allow_rasterization
+ def draw(self, renderer):
+ # docstring inherited
+
+ # Need a renderer to do hit tests on mouseevent; assume the last one
+ # will do
+ if renderer is None:
+ renderer = self.figure._cachedRenderer
+ if renderer is None:
+ raise RuntimeError('No renderer defined')
+
+ if not self.get_visible():
+ return
+ renderer.open_group('table', gid=self.get_gid())
+ self._update_positions(renderer)
+
+ for key in sorted(self._cells):
+ self._cells[key].draw(renderer)
+
+ renderer.close_group('table')
+ self.stale = False
+
+ def _get_grid_bbox(self, renderer):
+ """
+ Get a bbox, in axes coordinates for the cells.
+
+ Only include those in the range (0, 0) to (maxRow, maxCol).
+ """
+ boxes = [cell.get_window_extent(renderer)
+ for (row, col), cell in self._cells.items()
+ if row >= 0 and col >= 0]
+ bbox = Bbox.union(boxes)
+ return bbox.transformed(self.get_transform().inverted())
+
+ def contains(self, mouseevent):
+ # docstring inherited
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+ # TODO: Return index of the cell containing the cursor so that the user
+ # doesn't have to bind to each one individually.
+ renderer = self.figure._cachedRenderer
+ if renderer is not None:
+ boxes = [cell.get_window_extent(renderer)
+ for (row, col), cell in self._cells.items()
+ if row >= 0 and col >= 0]
+ bbox = Bbox.union(boxes)
+ return bbox.contains(mouseevent.x, mouseevent.y), {}
+ else:
+ return False, {}
+
+ def get_children(self):
+ """Return the Artists contained by the table."""
+ return list(self._cells.values())
+
+ def get_window_extent(self, renderer):
+ """Return the bounding box of the table in window coords."""
+ self._update_positions(renderer)
+ boxes = [cell.get_window_extent(renderer)
+ for cell in self._cells.values()]
+ return Bbox.union(boxes)
+
+ def _do_cell_alignment(self):
+ """
+ Calculate row heights and column widths; position cells accordingly.
+ """
+ # Calculate row/column widths
+ widths = {}
+ heights = {}
+ for (row, col), cell in self._cells.items():
+ height = heights.setdefault(row, 0.0)
+ heights[row] = max(height, cell.get_height())
+ width = widths.setdefault(col, 0.0)
+ widths[col] = max(width, cell.get_width())
+
+ # work out left position for each column
+ xpos = 0
+ lefts = {}
+ for col in sorted(widths):
+ lefts[col] = xpos
+ xpos += widths[col]
+
+ ypos = 0
+ bottoms = {}
+ for row in sorted(heights, reverse=True):
+ bottoms[row] = ypos
+ ypos += heights[row]
+
+ # set cell positions
+ for (row, col), cell in self._cells.items():
+ cell.set_x(lefts[col])
+ cell.set_y(bottoms[row])
+
+ def auto_set_column_width(self, col):
+ """
+ Automatically set the widths of given columns to optimal sizes.
+
+ Parameters
+ ----------
+ col : int or sequence of ints
+ The indices of the columns to auto-scale.
+ """
+ # check for col possibility on iteration
+ try:
+ iter(col)
+ except (TypeError, AttributeError):
+ self._autoColumns.append(col)
+ else:
+ for cell in col:
+ self._autoColumns.append(cell)
+
+ self.stale = True
+
+ def _auto_set_column_width(self, col, renderer):
+ """Automatically set width for column."""
+ cells = [cell for key, cell in self._cells.items() if key[1] == col]
+ max_width = max((cell.get_required_width(renderer) for cell in cells),
+ default=0)
+ for cell in cells:
+ cell.set_width(max_width)
+
+ def auto_set_font_size(self, value=True):
+ """Automatically set font size."""
+ self._autoFontsize = value
+ self.stale = True
+
+ def _auto_set_font_size(self, renderer):
+
+ if len(self._cells) == 0:
+ return
+ fontsize = next(iter(self._cells.values())).get_fontsize()
+ cells = []
+ for key, cell in self._cells.items():
+ # ignore auto-sized columns
+ if key[1] in self._autoColumns:
+ continue
+ size = cell.auto_set_font_size(renderer)
+ fontsize = min(fontsize, size)
+ cells.append(cell)
+
+ # now set all fontsizes equal
+ for cell in self._cells.values():
+ cell.set_fontsize(fontsize)
+
+ def scale(self, xscale, yscale):
+ """Scale column widths by *xscale* and row heights by *yscale*."""
+ for c in self._cells.values():
+ c.set_width(c.get_width() * xscale)
+ c.set_height(c.get_height() * yscale)
+
+ def set_fontsize(self, size):
+ """
+ Set the font size, in points, of the cell text.
+
+ Parameters
+ ----------
+ size : float
+
+ Notes
+ -----
+ As long as auto font size has not been disabled, the value will be
+ clipped such that the text fits horizontally into the cell.
+
+ You can disable this behavior using `.auto_set_font_size`.
+
+ >>> the_table.auto_set_font_size(False)
+ >>> the_table.set_fontsize(20)
+
+ However, there is no automatic scaling of the row height so that the
+ text may exceed the cell boundary.
+ """
+ for cell in self._cells.values():
+ cell.set_fontsize(size)
+ self.stale = True
+
+ def _offset(self, ox, oy):
+ """Move all the artists by ox, oy (axes coords)."""
+ for c in self._cells.values():
+ x, y = c.get_x(), c.get_y()
+ c.set_x(x + ox)
+ c.set_y(y + oy)
+
+ def _update_positions(self, renderer):
+ # called from renderer to allow more precise estimates of
+ # widths and heights with get_window_extent
+
+ # Do any auto width setting
+ for col in self._autoColumns:
+ self._auto_set_column_width(col, renderer)
+
+ if self._autoFontsize:
+ self._auto_set_font_size(renderer)
+
+ # Align all the cells
+ self._do_cell_alignment()
+
+ bbox = self._get_grid_bbox(renderer)
+ l, b, w, h = bbox.bounds
+
+ if self._bbox is not None:
+ # Position according to bbox
+ rl, rb, rw, rh = self._bbox
+ self.scale(rw / w, rh / h)
+ ox = rl - l
+ oy = rb - b
+ self._do_cell_alignment()
+ else:
+ # Position using loc
+ (BEST, UR, UL, LL, LR, CL, CR, LC, UC, C,
+ TR, TL, BL, BR, R, L, T, B) = range(len(self.codes))
+ # defaults for center
+ ox = (0.5 - w / 2) - l
+ oy = (0.5 - h / 2) - b
+ if self._loc in (UL, LL, CL): # left
+ ox = self.AXESPAD - l
+ if self._loc in (BEST, UR, LR, R, CR): # right
+ ox = 1 - (l + w + self.AXESPAD)
+ if self._loc in (BEST, UR, UL, UC): # upper
+ oy = 1 - (b + h + self.AXESPAD)
+ if self._loc in (LL, LR, LC): # lower
+ oy = self.AXESPAD - b
+ if self._loc in (LC, UC, C): # center x
+ ox = (0.5 - w / 2) - l
+ if self._loc in (CL, CR, C): # center y
+ oy = (0.5 - h / 2) - b
+
+ if self._loc in (TL, BL, L): # out left
+ ox = - (l + w)
+ if self._loc in (TR, BR, R): # out right
+ ox = 1.0 - l
+ if self._loc in (TR, TL, T): # out top
+ oy = 1.0 - b
+ if self._loc in (BL, BR, B): # out bottom
+ oy = - (b + h)
+
+ self._offset(ox, oy)
+
+ def get_celld(self):
+ r"""
+ Return a dict of cells in the table mapping *(row, column)* to
+ `.Cell`\s.
+
+ Notes
+ -----
+ You can also directly index into the Table object to access individual
+ cells::
+
+ cell = table[row, col]
+
+ """
+ return self._cells
+
+
+docstring.interpd.update(Table_kwdoc=artist.kwdoc(Table))
+
+
+@docstring.dedent_interpd
+def table(ax,
+ cellText=None, cellColours=None,
+ cellLoc='right', colWidths=None,
+ rowLabels=None, rowColours=None, rowLoc='left',
+ colLabels=None, colColours=None, colLoc='center',
+ loc='bottom', bbox=None, edges='closed',
+ **kwargs):
+ """
+ Add a table to an `~.axes.Axes`.
+
+ At least one of *cellText* or *cellColours* must be specified. These
+ parameters must be 2D lists, in which the outer lists define the rows and
+ the inner list define the column values per row. Each row must have the
+ same number of elements.
+
+ The table can optionally have row and column headers, which are configured
+ using *rowLabels*, *rowColours*, *rowLoc* and *colLabels*, *colColours*,
+ *colLoc* respectively.
+
+ For finer grained control over tables, use the `.Table` class and add it to
+ the axes with `.Axes.add_table`.
+
+ Parameters
+ ----------
+ cellText : 2D list of str, optional
+ The texts to place into the table cells.
+
+ *Note*: Line breaks in the strings are currently not accounted for and
+ will result in the text exceeding the cell boundaries.
+
+ cellColours : 2D list of colors, optional
+ The background colors of the cells.
+
+ cellLoc : {'left', 'center', 'right'}, default: 'right'
+ The alignment of the text within the cells.
+
+ colWidths : list of float, optional
+ The column widths in units of the axes. If not given, all columns will
+ have a width of *1 / ncols*.
+
+ rowLabels : list of str, optional
+ The text of the row header cells.
+
+ rowColours : list of colors, optional
+ The colors of the row header cells.
+
+ rowLoc : {'left', 'center', 'right'}, default: 'left'
+ The text alignment of the row header cells.
+
+ colLabels : list of str, optional
+ The text of the column header cells.
+
+ colColours : list of colors, optional
+ The colors of the column header cells.
+
+ colLoc : {'left', 'center', 'right'}, default: 'left'
+ The text alignment of the column header cells.
+
+ loc : str, optional
+ The position of the cell with respect to *ax*. This must be one of
+ the `~.Table.codes`.
+
+ bbox : `.Bbox`, optional
+ A bounding box to draw the table into. If this is not *None*, this
+ overrides *loc*.
+
+ edges : substring of 'BRTL' or {'open', 'closed', 'horizontal', 'vertical'}
+ The cell edges to be drawn with a line. See also
+ `~.Cell.visible_edges`.
+
+ Returns
+ -------
+ `~matplotlib.table.Table`
+ The created table.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ `.Table` properties.
+
+ %(Table_kwdoc)s
+ """
+
+ if cellColours is None and cellText is None:
+ raise ValueError('At least one argument from "cellColours" or '
+ '"cellText" must be provided to create a table.')
+
+ # Check we have some cellText
+ if cellText is None:
+ # assume just colours are needed
+ rows = len(cellColours)
+ cols = len(cellColours[0])
+ cellText = [[''] * cols] * rows
+
+ rows = len(cellText)
+ cols = len(cellText[0])
+ for row in cellText:
+ if len(row) != cols:
+ raise ValueError("Each row in 'cellText' must have {} columns"
+ .format(cols))
+
+ if cellColours is not None:
+ if len(cellColours) != rows:
+ raise ValueError("'cellColours' must have {} rows".format(rows))
+ for row in cellColours:
+ if len(row) != cols:
+ raise ValueError("Each row in 'cellColours' must have {} "
+ "columns".format(cols))
+ else:
+ cellColours = ['w' * cols] * rows
+
+ # Set colwidths if not given
+ if colWidths is None:
+ colWidths = [1.0 / cols] * cols
+
+ # Fill in missing information for column
+ # and row labels
+ rowLabelWidth = 0
+ if rowLabels is None:
+ if rowColours is not None:
+ rowLabels = [''] * rows
+ rowLabelWidth = colWidths[0]
+ elif rowColours is None:
+ rowColours = 'w' * rows
+
+ if rowLabels is not None:
+ if len(rowLabels) != rows:
+ raise ValueError("'rowLabels' must be of length {0}".format(rows))
+
+ # If we have column labels, need to shift
+ # the text and colour arrays down 1 row
+ offset = 1
+ if colLabels is None:
+ if colColours is not None:
+ colLabels = [''] * cols
+ else:
+ offset = 0
+ elif colColours is None:
+ colColours = 'w' * cols
+
+ # Set up cell colours if not given
+ if cellColours is None:
+ cellColours = ['w' * cols] * rows
+
+ # Now create the table
+ table = Table(ax, loc, bbox, **kwargs)
+ table.edges = edges
+ height = table._approx_text_height()
+
+ # Add the cells
+ for row in range(rows):
+ for col in range(cols):
+ table.add_cell(row + offset, col,
+ width=colWidths[col], height=height,
+ text=cellText[row][col],
+ facecolor=cellColours[row][col],
+ loc=cellLoc)
+ # Do column labels
+ if colLabels is not None:
+ for col in range(cols):
+ table.add_cell(0, col,
+ width=colWidths[col], height=height,
+ text=colLabels[col], facecolor=colColours[col],
+ loc=colLoc)
+
+ # Do row labels
+ if rowLabels is not None:
+ for row in range(rows):
+ table.add_cell(row + offset, -1,
+ width=rowLabelWidth or 1e-15, height=height,
+ text=rowLabels[row], facecolor=rowColours[row],
+ loc=rowLoc)
+ if rowLabelWidth == 0:
+ table.auto_set_column_width(-1)
+
+ ax.add_table(table)
+ return table
diff --git a/venv/Lib/site-packages/matplotlib/testing/__init__.py b/venv/Lib/site-packages/matplotlib/testing/__init__.py
new file mode 100644
index 0000000..f9c547c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/__init__.py
@@ -0,0 +1,81 @@
+"""
+Helper functions for testing.
+"""
+
+import locale
+import logging
+import subprocess
+from pathlib import Path
+from tempfile import TemporaryDirectory
+
+import matplotlib as mpl
+from matplotlib import _api
+
+_log = logging.getLogger(__name__)
+
+
+def set_font_settings_for_testing():
+ mpl.rcParams['font.family'] = 'DejaVu Sans'
+ mpl.rcParams['text.hinting'] = 'none'
+ mpl.rcParams['text.hinting_factor'] = 8
+
+
+def set_reproducibility_for_testing():
+ mpl.rcParams['svg.hashsalt'] = 'matplotlib'
+
+
+def setup():
+ # The baseline images are created in this locale, so we should use
+ # it during all of the tests.
+
+ try:
+ locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
+ except locale.Error:
+ try:
+ locale.setlocale(locale.LC_ALL, 'English_United States.1252')
+ except locale.Error:
+ _log.warning(
+ "Could not set locale to English/United States. "
+ "Some date-related tests may fail.")
+
+ mpl.use('Agg')
+
+ with _api.suppress_matplotlib_deprecation_warning():
+ mpl.rcdefaults() # Start with all defaults
+
+ # These settings *must* be hardcoded for running the comparison tests and
+ # are not necessarily the default values as specified in rcsetup.py.
+ set_font_settings_for_testing()
+ set_reproducibility_for_testing()
+
+
+def _check_for_pgf(texsystem):
+ """
+ Check if a given TeX system + pgf is available
+
+ Parameters
+ ----------
+ texsystem : str
+ The executable name to check
+ """
+ with TemporaryDirectory() as tmpdir:
+ tex_path = Path(tmpdir, "test.tex")
+ tex_path.write_text(r"""
+ \documentclass{minimal}
+ \usepackage{pgf}
+ \begin{document}
+ \typeout{pgfversion=\pgfversion}
+ \makeatletter
+ \@@end
+ """)
+ try:
+ subprocess.check_call(
+ [texsystem, "-halt-on-error", str(tex_path)], cwd=tmpdir,
+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ except (OSError, subprocess.CalledProcessError):
+ return False
+ return True
+
+
+def _has_tex_package(package):
+ return bool(mpl.dviread.find_tex_file(f"{package}.sty"))
diff --git a/venv/Lib/site-packages/matplotlib/testing/compare.py b/venv/Lib/site-packages/matplotlib/testing/compare.py
new file mode 100644
index 0000000..afb7edb
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/compare.py
@@ -0,0 +1,517 @@
+"""
+Utilities for comparing image results.
+"""
+
+import atexit
+import functools
+import hashlib
+import logging
+import os
+from pathlib import Path
+import re
+import shutil
+import subprocess
+import sys
+from tempfile import TemporaryDirectory, TemporaryFile
+import weakref
+
+import numpy as np
+from PIL import Image
+
+import matplotlib as mpl
+from matplotlib import _api, cbook
+from matplotlib.testing.exceptions import ImageComparisonFailure
+
+_log = logging.getLogger(__name__)
+
+__all__ = ['calculate_rms', 'comparable_formats', 'compare_images']
+
+
+def make_test_filename(fname, purpose):
+ """
+ Make a new filename by inserting *purpose* before the file's extension.
+ """
+ base, ext = os.path.splitext(fname)
+ return '%s-%s%s' % (base, purpose, ext)
+
+
+def _get_cache_path():
+ cache_dir = Path(mpl.get_cachedir(), 'test_cache')
+ cache_dir.mkdir(parents=True, exist_ok=True)
+ return cache_dir
+
+
+def get_cache_dir():
+ return str(_get_cache_path())
+
+
+def get_file_hash(path, block_size=2 ** 20):
+ md5 = hashlib.md5()
+ with open(path, 'rb') as fd:
+ while True:
+ data = fd.read(block_size)
+ if not data:
+ break
+ md5.update(data)
+
+ if Path(path).suffix == '.pdf':
+ md5.update(str(mpl._get_executable_info("gs").version)
+ .encode('utf-8'))
+ elif Path(path).suffix == '.svg':
+ md5.update(str(mpl._get_executable_info("inkscape").version)
+ .encode('utf-8'))
+
+ return md5.hexdigest()
+
+
+@_api.deprecated("3.3")
+def make_external_conversion_command(cmd):
+ def convert(old, new):
+ cmdline = cmd(old, new)
+ pipe = subprocess.Popen(cmdline, universal_newlines=True,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = pipe.communicate()
+ errcode = pipe.wait()
+ if not os.path.exists(new) or errcode:
+ msg = "Conversion command failed:\n%s\n" % ' '.join(cmdline)
+ if stdout:
+ msg += "Standard output:\n%s\n" % stdout
+ if stderr:
+ msg += "Standard error:\n%s\n" % stderr
+ raise IOError(msg)
+
+ return convert
+
+
+# Modified from https://bugs.python.org/issue25567.
+_find_unsafe_bytes = re.compile(br'[^a-zA-Z0-9_@%+=:,./-]').search
+
+
+def _shlex_quote_bytes(b):
+ return (b if _find_unsafe_bytes(b) is None
+ else b"'" + b.replace(b"'", b"'\"'\"'") + b"'")
+
+
+class _ConverterError(Exception):
+ pass
+
+
+class _Converter:
+ def __init__(self):
+ self._proc = None
+ # Explicitly register deletion from an atexit handler because if we
+ # wait until the object is GC'd (which occurs later), then some module
+ # globals (e.g. signal.SIGKILL) has already been set to None, and
+ # kill() doesn't work anymore...
+ atexit.register(self.__del__)
+
+ def __del__(self):
+ if self._proc:
+ self._proc.kill()
+ self._proc.wait()
+ for stream in filter(None, [self._proc.stdin,
+ self._proc.stdout,
+ self._proc.stderr]):
+ stream.close()
+ self._proc = None
+
+ def _read_until(self, terminator):
+ """Read until the prompt is reached."""
+ buf = bytearray()
+ while True:
+ c = self._proc.stdout.read(1)
+ if not c:
+ raise _ConverterError
+ buf.extend(c)
+ if buf.endswith(terminator):
+ return bytes(buf[:-len(terminator)])
+
+
+class _GSConverter(_Converter):
+ def __call__(self, orig, dest):
+ if not self._proc:
+ self._proc = subprocess.Popen(
+ [mpl._get_executable_info("gs").executable,
+ "-dNOSAFER", "-dNOPAUSE", "-sDEVICE=png16m"],
+ # As far as I can see, ghostscript never outputs to stderr.
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+ try:
+ self._read_until(b"\nGS")
+ except _ConverterError as err:
+ raise OSError("Failed to start Ghostscript") from err
+
+ def encode_and_escape(name):
+ return (os.fsencode(name)
+ .replace(b"\\", b"\\\\")
+ .replace(b"(", br"\(")
+ .replace(b")", br"\)"))
+
+ self._proc.stdin.write(
+ b"<< /OutputFile ("
+ + encode_and_escape(dest)
+ + b") >> setpagedevice ("
+ + encode_and_escape(orig)
+ + b") run flush\n")
+ self._proc.stdin.flush()
+ # GS> if nothing left on the stack; GS if n items left on the stack.
+ err = self._read_until(b"GS")
+ stack = self._read_until(b">")
+ if stack or not os.path.exists(dest):
+ stack_size = int(stack[1:]) if stack else 0
+ self._proc.stdin.write(b"pop\n" * stack_size)
+ # Using the systemencoding should at least get the filenames right.
+ raise ImageComparisonFailure(
+ (err + b"GS" + stack + b">")
+ .decode(sys.getfilesystemencoding(), "replace"))
+
+
+class _SVGConverter(_Converter):
+ def __call__(self, orig, dest):
+ old_inkscape = mpl._get_executable_info("inkscape").version < "1"
+ terminator = b"\n>" if old_inkscape else b"> "
+ if not hasattr(self, "_tmpdir"):
+ self._tmpdir = TemporaryDirectory()
+ # On Windows, we must make sure that self._proc has terminated
+ # (which __del__ does) before clearing _tmpdir.
+ weakref.finalize(self._tmpdir, self.__del__)
+ if (not self._proc # First run.
+ or self._proc.poll() is not None): # Inkscape terminated.
+ env = {
+ **os.environ,
+ # If one passes e.g. a png file to Inkscape, it will try to
+ # query the user for conversion options via a GUI (even with
+ # `--without-gui`). Unsetting `DISPLAY` prevents this (and
+ # causes GTK to crash and Inkscape to terminate, but that'll
+ # just be reported as a regular exception below).
+ "DISPLAY": "",
+ # Do not load any user options.
+ "INKSCAPE_PROFILE_DIR": os.devnull,
+ }
+ # Old versions of Inkscape (e.g. 0.48.3.1) seem to sometimes
+ # deadlock when stderr is redirected to a pipe, so we redirect it
+ # to a temporary file instead. This is not necessary anymore as of
+ # Inkscape 0.92.1.
+ stderr = TemporaryFile()
+ self._proc = subprocess.Popen(
+ ["inkscape", "--without-gui", "--shell"] if old_inkscape else
+ ["inkscape", "--shell"],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=stderr,
+ env=env, cwd=self._tmpdir.name)
+ # Slight abuse, but makes shutdown handling easier.
+ self._proc.stderr = stderr
+ try:
+ self._read_until(terminator)
+ except _ConverterError as err:
+ raise OSError("Failed to start Inkscape in interactive "
+ "mode") from err
+
+ # Inkscape's shell mode does not support escaping metacharacters in the
+ # filename ("\n", and ":;" for inkscape>=1). Avoid any problems by
+ # running from a temporary directory and using fixed filenames.
+ inkscape_orig = Path(self._tmpdir.name, os.fsdecode(b"f.svg"))
+ inkscape_dest = Path(self._tmpdir.name, os.fsdecode(b"f.png"))
+ try:
+ inkscape_orig.symlink_to(Path(orig).resolve())
+ except OSError:
+ shutil.copyfile(orig, inkscape_orig)
+ self._proc.stdin.write(
+ b"f.svg --export-png=f.png\n" if old_inkscape else
+ b"file-open:f.svg;export-filename:f.png;export-do;file-close\n")
+ self._proc.stdin.flush()
+ try:
+ self._read_until(terminator)
+ except _ConverterError as err:
+ # Inkscape's output is not localized but gtk's is, so the output
+ # stream probably has a mixed encoding. Using the filesystem
+ # encoding should at least get the filenames right...
+ self._proc.stderr.seek(0)
+ raise ImageComparisonFailure(
+ self._proc.stderr.read().decode(
+ sys.getfilesystemencoding(), "replace")) from err
+ os.remove(inkscape_orig)
+ shutil.move(inkscape_dest, dest)
+
+ def __del__(self):
+ super().__del__()
+ if hasattr(self, "_tmpdir"):
+ self._tmpdir.cleanup()
+
+
+def _update_converter():
+ try:
+ mpl._get_executable_info("gs")
+ except mpl.ExecutableNotFoundError:
+ pass
+ else:
+ converter['pdf'] = converter['eps'] = _GSConverter()
+ try:
+ mpl._get_executable_info("inkscape")
+ except mpl.ExecutableNotFoundError:
+ pass
+ else:
+ converter['svg'] = _SVGConverter()
+
+
+#: A dictionary that maps filename extensions to functions which
+#: themselves map arguments `old` and `new` (filenames) to a list of strings.
+#: The list can then be passed to Popen to convert files with that
+#: extension to png format.
+converter = {}
+_update_converter()
+
+
+def comparable_formats():
+ """
+ Return the list of file formats that `.compare_images` can compare
+ on this system.
+
+ Returns
+ -------
+ list of str
+ E.g. ``['png', 'pdf', 'svg', 'eps']``.
+
+ """
+ return ['png', *converter]
+
+
+def convert(filename, cache):
+ """
+ Convert the named file to png; return the name of the created file.
+
+ If *cache* is True, the result of the conversion is cached in
+ `matplotlib.get_cachedir() + '/test_cache/'`. The caching is based on a
+ hash of the exact contents of the input file. Old cache entries are
+ automatically deleted as needed to keep the size of the cache capped to
+ twice the size of all baseline images.
+ """
+ path = Path(filename)
+ if not path.exists():
+ raise IOError(f"{path} does not exist")
+ if path.suffix[1:] not in converter:
+ import pytest
+ pytest.skip(f"Don't know how to convert {path.suffix} files to png")
+ newpath = path.parent / f"{path.stem}_{path.suffix[1:]}.png"
+
+ # Only convert the file if the destination doesn't already exist or
+ # is out of date.
+ if not newpath.exists() or newpath.stat().st_mtime < path.stat().st_mtime:
+ cache_dir = _get_cache_path() if cache else None
+
+ if cache_dir is not None:
+ _register_conversion_cache_cleaner_once()
+ hash_value = get_file_hash(path)
+ cached_path = cache_dir / (hash_value + newpath.suffix)
+ if cached_path.exists():
+ _log.debug("For %s: reusing cached conversion.", filename)
+ shutil.copyfile(cached_path, newpath)
+ return str(newpath)
+
+ _log.debug("For %s: converting to png.", filename)
+ converter[path.suffix[1:]](path, newpath)
+
+ if cache_dir is not None:
+ _log.debug("For %s: caching conversion result.", filename)
+ shutil.copyfile(newpath, cached_path)
+
+ return str(newpath)
+
+
+def _clean_conversion_cache():
+ # This will actually ignore mpl_toolkits baseline images, but they're
+ # relatively small.
+ baseline_images_size = sum(
+ path.stat().st_size
+ for path in Path(mpl.__file__).parent.glob("**/baseline_images/**/*"))
+ # 2x: one full copy of baselines, and one full copy of test results
+ # (actually an overestimate: we don't convert png baselines and results).
+ max_cache_size = 2 * baseline_images_size
+ # Reduce cache until it fits.
+ with cbook._lock_path(_get_cache_path()):
+ cache_stat = {
+ path: path.stat() for path in _get_cache_path().glob("*")}
+ cache_size = sum(stat.st_size for stat in cache_stat.values())
+ paths_by_atime = sorted( # Oldest at the end.
+ cache_stat, key=lambda path: cache_stat[path].st_atime,
+ reverse=True)
+ while cache_size > max_cache_size:
+ path = paths_by_atime.pop()
+ cache_size -= cache_stat[path].st_size
+ path.unlink()
+
+
+@functools.lru_cache() # Ensure this is only registered once.
+def _register_conversion_cache_cleaner_once():
+ atexit.register(_clean_conversion_cache)
+
+
+def crop_to_same(actual_path, actual_image, expected_path, expected_image):
+ # clip the images to the same size -- this is useful only when
+ # comparing eps to pdf
+ if actual_path[-7:-4] == 'eps' and expected_path[-7:-4] == 'pdf':
+ aw, ah, ad = actual_image.shape
+ ew, eh, ed = expected_image.shape
+ actual_image = actual_image[int(aw / 2 - ew / 2):int(
+ aw / 2 + ew / 2), int(ah / 2 - eh / 2):int(ah / 2 + eh / 2)]
+ return actual_image, expected_image
+
+
+def calculate_rms(expected_image, actual_image):
+ """
+ Calculate the per-pixel errors, then compute the root mean square error.
+ """
+ if expected_image.shape != actual_image.shape:
+ raise ImageComparisonFailure(
+ "Image sizes do not match expected size: {} "
+ "actual size {}".format(expected_image.shape, actual_image.shape))
+ # Convert to float to avoid overflowing finite integer types.
+ return np.sqrt(((expected_image - actual_image).astype(float) ** 2).mean())
+
+
+# NOTE: compare_image and save_diff_image assume that the image does not have
+# 16-bit depth, as Pillow converts these to RGB incorrectly.
+
+
+def compare_images(expected, actual, tol, in_decorator=False):
+ """
+ Compare two "image" files checking differences within a tolerance.
+
+ The two given filenames may point to files which are convertible to
+ PNG via the `.converter` dictionary. The underlying RMS is calculated
+ with the `.calculate_rms` function.
+
+ Parameters
+ ----------
+ expected : str
+ The filename of the expected image.
+ actual : str
+ The filename of the actual image.
+ tol : float
+ The tolerance (a color value difference, where 255 is the
+ maximal difference). The test fails if the average pixel
+ difference is greater than this value.
+ in_decorator : bool
+ Determines the output format. If called from image_comparison
+ decorator, this should be True. (default=False)
+
+ Returns
+ -------
+ None or dict or str
+ Return *None* if the images are equal within the given tolerance.
+
+ If the images differ, the return value depends on *in_decorator*.
+ If *in_decorator* is true, a dict with the following entries is
+ returned:
+
+ - *rms*: The RMS of the image difference.
+ - *expected*: The filename of the expected image.
+ - *actual*: The filename of the actual image.
+ - *diff_image*: The filename of the difference image.
+ - *tol*: The comparison tolerance.
+
+ Otherwise, a human-readable multi-line string representation of this
+ information is returned.
+
+ Examples
+ --------
+ ::
+
+ img1 = "./baseline/plot.png"
+ img2 = "./output/plot.png"
+ compare_images(img1, img2, 0.001)
+
+ """
+ actual = os.fspath(actual)
+ if not os.path.exists(actual):
+ raise Exception("Output image %s does not exist." % actual)
+ if os.stat(actual).st_size == 0:
+ raise Exception("Output image file %s is empty." % actual)
+
+ # Convert the image to png
+ expected = os.fspath(expected)
+ if not os.path.exists(expected):
+ raise IOError('Baseline image %r does not exist.' % expected)
+ extension = expected.split('.')[-1]
+ if extension != 'png':
+ actual = convert(actual, cache=True)
+ expected = convert(expected, cache=True)
+
+ # open the image files and remove the alpha channel (if it exists)
+ expected_image = np.asarray(Image.open(expected).convert("RGB"))
+ actual_image = np.asarray(Image.open(actual).convert("RGB"))
+
+ actual_image, expected_image = crop_to_same(
+ actual, actual_image, expected, expected_image)
+
+ diff_image = make_test_filename(actual, 'failed-diff')
+
+ if tol <= 0:
+ if np.array_equal(expected_image, actual_image):
+ return None
+
+ # convert to signed integers, so that the images can be subtracted without
+ # overflow
+ expected_image = expected_image.astype(np.int16)
+ actual_image = actual_image.astype(np.int16)
+
+ rms = calculate_rms(expected_image, actual_image)
+
+ if rms <= tol:
+ return None
+
+ save_diff_image(expected, actual, diff_image)
+
+ results = dict(rms=rms, expected=str(expected),
+ actual=str(actual), diff=str(diff_image), tol=tol)
+
+ if not in_decorator:
+ # Then the results should be a string suitable for stdout.
+ template = ['Error: Image files did not match.',
+ 'RMS Value: {rms}',
+ 'Expected: \n {expected}',
+ 'Actual: \n {actual}',
+ 'Difference:\n {diff}',
+ 'Tolerance: \n {tol}', ]
+ results = '\n '.join([line.format(**results) for line in template])
+ return results
+
+
+def save_diff_image(expected, actual, output):
+ """
+ Parameters
+ ----------
+ expected : str
+ File path of expected image.
+ actual : str
+ File path of actual image.
+ output : str
+ File path to save difference image to.
+ """
+ # Drop alpha channels, similarly to compare_images.
+ expected_image = np.asarray(Image.open(expected).convert("RGB"))
+ actual_image = np.asarray(Image.open(actual).convert("RGB"))
+ actual_image, expected_image = crop_to_same(
+ actual, actual_image, expected, expected_image)
+ expected_image = np.array(expected_image).astype(float)
+ actual_image = np.array(actual_image).astype(float)
+ if expected_image.shape != actual_image.shape:
+ raise ImageComparisonFailure(
+ "Image sizes do not match expected size: {} "
+ "actual size {}".format(expected_image.shape, actual_image.shape))
+ abs_diff_image = np.abs(expected_image - actual_image)
+
+ # expand differences in luminance domain
+ abs_diff_image *= 255 * 10
+ save_image_np = np.clip(abs_diff_image, 0, 255).astype(np.uint8)
+ height, width, depth = save_image_np.shape
+
+ # The PDF renderer doesn't produce an alpha channel, but the
+ # matplotlib PNG writer requires one, so expand the array
+ if depth == 3:
+ with_alpha = np.empty((height, width, 4), dtype=np.uint8)
+ with_alpha[:, :, 0:3] = save_image_np
+ save_image_np = with_alpha
+
+ # Hard-code the alpha channel to fully solid
+ save_image_np[:, :, 3] = 255
+
+ Image.fromarray(save_image_np).save(output, format="png")
diff --git a/venv/Lib/site-packages/matplotlib/testing/conftest.py b/venv/Lib/site-packages/matplotlib/testing/conftest.py
new file mode 100644
index 0000000..902d8f4
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/conftest.py
@@ -0,0 +1,137 @@
+import pytest
+import sys
+import matplotlib
+from matplotlib import _api, cbook
+
+
+def pytest_configure(config):
+ # config is initialized here rather than in pytest.ini so that `pytest
+ # --pyargs matplotlib` (which would not find pytest.ini) works. The only
+ # entries in pytest.ini set minversion (which is checked earlier),
+ # testpaths/python_files, as they are required to properly find the tests
+ for key, value in [
+ ("markers", "flaky: (Provided by pytest-rerunfailures.)"),
+ ("markers", "timeout: (Provided by pytest-timeout.)"),
+ ("markers", "backend: Set alternate Matplotlib backend temporarily."),
+ ("markers", "style: Set alternate Matplotlib style temporarily."),
+ ("markers", "baseline_images: Compare output against references."),
+ ("markers", "pytz: Tests that require pytz to be installed."),
+ ("markers", "network: Tests that reach out to the network."),
+ ("filterwarnings", "error"),
+ ]:
+ config.addinivalue_line(key, value)
+
+ matplotlib.use('agg', force=True)
+ matplotlib._called_from_pytest = True
+ matplotlib._init_tests()
+
+
+def pytest_unconfigure(config):
+ matplotlib._called_from_pytest = False
+
+
+@pytest.fixture(autouse=True)
+def mpl_test_settings(request):
+ from matplotlib.testing.decorators import _cleanup_cm
+
+ with _cleanup_cm():
+
+ backend = None
+ backend_marker = request.node.get_closest_marker('backend')
+ if backend_marker is not None:
+ assert len(backend_marker.args) == 1, \
+ "Marker 'backend' must specify 1 backend."
+ backend, = backend_marker.args
+ skip_on_importerror = backend_marker.kwargs.get(
+ 'skip_on_importerror', False)
+ prev_backend = matplotlib.get_backend()
+
+ # special case Qt backend importing to avoid conflicts
+ if backend.lower().startswith('qt4'):
+ if any(k in sys.modules for k in ('PyQt5', 'PySide2')):
+ pytest.skip('Qt5 binding already imported')
+ try:
+ import PyQt4
+ # RuntimeError if PyQt5 already imported.
+ except (ImportError, RuntimeError):
+ try:
+ import PySide
+ except ImportError:
+ pytest.skip("Failed to import a Qt4 binding.")
+ elif backend.lower().startswith('qt5'):
+ if any(k in sys.modules for k in ('PyQt4', 'PySide')):
+ pytest.skip('Qt4 binding already imported')
+ try:
+ import PyQt5
+ # RuntimeError if PyQt4 already imported.
+ except (ImportError, RuntimeError):
+ try:
+ import PySide2
+ except ImportError:
+ pytest.skip("Failed to import a Qt5 binding.")
+
+ # Default of cleanup and image_comparison too.
+ style = ["classic", "_classic_test_patch"]
+ style_marker = request.node.get_closest_marker('style')
+ if style_marker is not None:
+ assert len(style_marker.args) == 1, \
+ "Marker 'style' must specify 1 style."
+ style, = style_marker.args
+
+ matplotlib.testing.setup()
+ with _api.suppress_matplotlib_deprecation_warning():
+ if backend is not None:
+ # This import must come after setup() so it doesn't load the
+ # default backend prematurely.
+ import matplotlib.pyplot as plt
+ try:
+ plt.switch_backend(backend)
+ except ImportError as exc:
+ # Should only occur for the cairo backend tests, if neither
+ # pycairo nor cairocffi are installed.
+ if 'cairo' in backend.lower() or skip_on_importerror:
+ pytest.skip("Failed to switch to backend {} ({})."
+ .format(backend, exc))
+ else:
+ raise
+ matplotlib.style.use(style)
+ try:
+ yield
+ finally:
+ if backend is not None:
+ plt.switch_backend(prev_backend)
+
+
+@pytest.fixture
+def mpl_image_comparison_parameters(request, extension):
+ # This fixture is applied automatically by the image_comparison decorator.
+ #
+ # The sole purpose of this fixture is to provide an indirect method of
+ # obtaining parameters *without* modifying the decorated function
+ # signature. In this way, the function signature can stay the same and
+ # pytest won't get confused.
+ # We annotate the decorated function with any parameters captured by this
+ # fixture so that they can be used by the wrapper in image_comparison.
+ baseline_images, = request.node.get_closest_marker('baseline_images').args
+ if baseline_images is None:
+ # Allow baseline image list to be produced on the fly based on current
+ # parametrization.
+ baseline_images = request.getfixturevalue('baseline_images')
+
+ func = request.function
+ with cbook._setattr_cm(func.__wrapped__,
+ parameters=(baseline_images, extension)):
+ yield
+
+
+@pytest.fixture
+def pd():
+ """Fixture to import and configure pandas."""
+ pd = pytest.importorskip('pandas')
+ try:
+ from pandas.plotting import (
+ deregister_matplotlib_converters as deregister)
+ deregister()
+ except ImportError:
+ pass
+ return pd
diff --git a/venv/Lib/site-packages/matplotlib/testing/decorators.py b/venv/Lib/site-packages/matplotlib/testing/decorators.py
new file mode 100644
index 0000000..6600a4e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/decorators.py
@@ -0,0 +1,510 @@
+import contextlib
+from distutils.version import StrictVersion
+import functools
+import inspect
+import os
+from pathlib import Path
+import shutil
+import string
+import sys
+import unittest
+import warnings
+
+import matplotlib.style
+import matplotlib.units
+import matplotlib.testing
+from matplotlib import cbook
+from matplotlib import ft2font
+from matplotlib import pyplot as plt
+from matplotlib import ticker
+
+from .compare import comparable_formats, compare_images, make_test_filename
+from .exceptions import ImageComparisonFailure
+
+
+@contextlib.contextmanager
+def _cleanup_cm():
+ orig_units_registry = matplotlib.units.registry.copy()
+ try:
+ with warnings.catch_warnings(), matplotlib.rc_context():
+ yield
+ finally:
+ matplotlib.units.registry.clear()
+ matplotlib.units.registry.update(orig_units_registry)
+ plt.close("all")
+
+
+class CleanupTestCase(unittest.TestCase):
+ """A wrapper for unittest.TestCase that includes cleanup operations."""
+ @classmethod
+ def setUpClass(cls):
+ cls._cm = _cleanup_cm().__enter__()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls._cm.__exit__(None, None, None)
+
+
+def cleanup(style=None):
+ """
+ A decorator to ensure that any global state is reset before
+ running a test.
+
+ Parameters
+ ----------
+ style : str, dict, or list, optional
+ The style(s) to apply. Defaults to ``["classic",
+ "_classic_test_patch"]``.
+ """
+
+ # If cleanup is used without arguments, *style* will be a callable, and we
+ # pass it directly to the wrapper generator. If cleanup if called with an
+ # argument, it is a string naming a style, and the function will be passed
+ # as an argument to what we return. This is a confusing, but somewhat
+ # standard, pattern for writing a decorator with optional arguments.
+
+ def make_cleanup(func):
+ if inspect.isgeneratorfunction(func):
+ @functools.wraps(func)
+ def wrapped_callable(*args, **kwargs):
+ with _cleanup_cm(), matplotlib.style.context(style):
+ yield from func(*args, **kwargs)
+ else:
+ @functools.wraps(func)
+ def wrapped_callable(*args, **kwargs):
+ with _cleanup_cm(), matplotlib.style.context(style):
+ func(*args, **kwargs)
+
+ return wrapped_callable
+
+ if callable(style):
+ result = make_cleanup(style)
+ # Default of mpl_test_settings fixture and image_comparison too.
+ style = ["classic", "_classic_test_patch"]
+ return result
+ else:
+ return make_cleanup
+
+
+def check_freetype_version(ver):
+ if ver is None:
+ return True
+
+ if isinstance(ver, str):
+ ver = (ver, ver)
+ ver = [StrictVersion(x) for x in ver]
+ found = StrictVersion(ft2font.__freetype_version__)
+
+ return ver[0] <= found <= ver[1]
+
+
+def _checked_on_freetype_version(required_freetype_version):
+ import pytest
+ reason = ("Mismatched version of freetype. "
+ "Test requires '%s', you have '%s'" %
+ (required_freetype_version, ft2font.__freetype_version__))
+ return pytest.mark.xfail(
+ not check_freetype_version(required_freetype_version),
+ reason=reason, raises=ImageComparisonFailure, strict=False)
+
+
+def remove_ticks_and_titles(figure):
+ figure.suptitle("")
+ null_formatter = ticker.NullFormatter()
+ def remove_ticks(ax):
+ """Remove ticks in *ax* and all its child Axes."""
+ ax.set_title("")
+ ax.xaxis.set_major_formatter(null_formatter)
+ ax.xaxis.set_minor_formatter(null_formatter)
+ ax.yaxis.set_major_formatter(null_formatter)
+ ax.yaxis.set_minor_formatter(null_formatter)
+ try:
+ ax.zaxis.set_major_formatter(null_formatter)
+ ax.zaxis.set_minor_formatter(null_formatter)
+ except AttributeError:
+ pass
+ for child in ax.child_axes:
+ remove_ticks(child)
+ for ax in figure.get_axes():
+ remove_ticks(ax)
+
+
+def _raise_on_image_difference(expected, actual, tol):
+ __tracebackhide__ = True
+
+ err = compare_images(expected, actual, tol, in_decorator=True)
+ if err:
+ for key in ["actual", "expected", "diff"]:
+ err[key] = os.path.relpath(err[key])
+ raise ImageComparisonFailure(
+ ('images not close (RMS %(rms).3f):'
+ '\n\t%(actual)s\n\t%(expected)s\n\t%(diff)s') % err)
+
+
+def _skip_if_format_is_uncomparable(extension):
+ import pytest
+ return pytest.mark.skipif(
+ extension not in comparable_formats(),
+ reason='Cannot compare {} files on this system'.format(extension))
+
+
+def _mark_skip_if_format_is_uncomparable(extension):
+ import pytest
+ if isinstance(extension, str):
+ name = extension
+ marks = []
+ elif isinstance(extension, tuple):
+ # Extension might be a pytest ParameterSet instead of a plain string.
+ # Unfortunately, this type is not exposed, so since it's a namedtuple,
+ # check for a tuple instead.
+ name, = extension.values
+ marks = [*extension.marks]
+ else:
+ # Extension might be a pytest marker instead of a plain string.
+ name, = extension.args
+ marks = [extension.mark]
+ return pytest.param(name,
+ marks=[*marks, _skip_if_format_is_uncomparable(name)])
+
+
+class _ImageComparisonBase:
+ """
+ Image comparison base class
+
+ This class provides *just* the comparison-related functionality and avoids
+ any code that would be specific to any testing framework.
+ """
+
+ def __init__(self, func, tol, remove_text, savefig_kwargs):
+ self.func = func
+ self.baseline_dir, self.result_dir = _image_directories(func)
+ self.tol = tol
+ self.remove_text = remove_text
+ self.savefig_kwargs = savefig_kwargs
+
+ def copy_baseline(self, baseline, extension):
+ baseline_path = self.baseline_dir / baseline
+ orig_expected_path = baseline_path.with_suffix(f'.{extension}')
+ if extension == 'eps' and not orig_expected_path.exists():
+ orig_expected_path = orig_expected_path.with_suffix('.pdf')
+ expected_fname = make_test_filename(
+ self.result_dir / orig_expected_path.name, 'expected')
+ try:
+ # os.symlink errors if the target already exists.
+ with contextlib.suppress(OSError):
+ os.remove(expected_fname)
+ try:
+ os.symlink(orig_expected_path, expected_fname)
+ except OSError: # On Windows, symlink *may* be unavailable.
+ shutil.copyfile(orig_expected_path, expected_fname)
+ except OSError as err:
+ raise ImageComparisonFailure(
+ f"Missing baseline image {expected_fname} because the "
+ f"following file cannot be accessed: "
+ f"{orig_expected_path}") from err
+ return expected_fname
+
+ def compare(self, idx, baseline, extension, *, _lock=False):
+ __tracebackhide__ = True
+ fignum = plt.get_fignums()[idx]
+ fig = plt.figure(fignum)
+
+ if self.remove_text:
+ remove_ticks_and_titles(fig)
+
+ actual_path = (self.result_dir / baseline).with_suffix(f'.{extension}')
+ kwargs = self.savefig_kwargs.copy()
+ if extension == 'pdf':
+ kwargs.setdefault('metadata',
+ {'Creator': None, 'Producer': None,
+ 'CreationDate': None})
+
+ lock = (cbook._lock_path(actual_path)
+ if _lock else contextlib.nullcontext())
+ with lock:
+ fig.savefig(actual_path, **kwargs)
+ expected_path = self.copy_baseline(baseline, extension)
+ _raise_on_image_difference(expected_path, actual_path, self.tol)
+
+
+def _pytest_image_comparison(baseline_images, extensions, tol,
+ freetype_version, remove_text, savefig_kwargs,
+ style):
+ """
+ Decorate function with image comparison for pytest.
+
+ This function creates a decorator that wraps a figure-generating function
+ with image comparison code.
+ """
+ import pytest
+
+ extensions = map(_mark_skip_if_format_is_uncomparable, extensions)
+ KEYWORD_ONLY = inspect.Parameter.KEYWORD_ONLY
+
+ def decorator(func):
+ old_sig = inspect.signature(func)
+
+ @functools.wraps(func)
+ @pytest.mark.parametrize('extension', extensions)
+ @pytest.mark.style(style)
+ @_checked_on_freetype_version(freetype_version)
+ @functools.wraps(func)
+ def wrapper(*args, extension, request, **kwargs):
+ __tracebackhide__ = True
+ if 'extension' in old_sig.parameters:
+ kwargs['extension'] = extension
+ if 'request' in old_sig.parameters:
+ kwargs['request'] = request
+
+ img = _ImageComparisonBase(func, tol=tol, remove_text=remove_text,
+ savefig_kwargs=savefig_kwargs)
+ matplotlib.testing.set_font_settings_for_testing()
+ func(*args, **kwargs)
+
+ # If the test is parametrized in any way other than applied via
+ # this decorator, then we need to use a lock to prevent two
+ # processes from touching the same output file.
+ needs_lock = any(
+ marker.args[0] != 'extension'
+ for marker in request.node.iter_markers('parametrize'))
+
+ if baseline_images is not None:
+ our_baseline_images = baseline_images
+ else:
+ # Allow baseline image list to be produced on the fly based on
+ # current parametrization.
+ our_baseline_images = request.getfixturevalue(
+ 'baseline_images')
+
+ assert len(plt.get_fignums()) == len(our_baseline_images), (
+ "Test generated {} images but there are {} baseline images"
+ .format(len(plt.get_fignums()), len(our_baseline_images)))
+ for idx, baseline in enumerate(our_baseline_images):
+ img.compare(idx, baseline, extension, _lock=needs_lock)
+
+ parameters = list(old_sig.parameters.values())
+ if 'extension' not in old_sig.parameters:
+ parameters += [inspect.Parameter('extension', KEYWORD_ONLY)]
+ if 'request' not in old_sig.parameters:
+ parameters += [inspect.Parameter("request", KEYWORD_ONLY)]
+ new_sig = old_sig.replace(parameters=parameters)
+ wrapper.__signature__ = new_sig
+
+ # Reach a bit into pytest internals to hoist the marks from our wrapped
+ # function.
+ new_marks = getattr(func, 'pytestmark', []) + wrapper.pytestmark
+ wrapper.pytestmark = new_marks
+
+ return wrapper
+
+ return decorator
+
+
+def image_comparison(baseline_images, extensions=None, tol=0,
+ freetype_version=None, remove_text=False,
+ savefig_kwarg=None,
+ # Default of mpl_test_settings fixture and cleanup too.
+ style=("classic", "_classic_test_patch")):
+ """
+ Compare images generated by the test with those specified in
+ *baseline_images*, which must correspond, else an `ImageComparisonFailure`
+ exception will be raised.
+
+ Parameters
+ ----------
+ baseline_images : list or None
+ A list of strings specifying the names of the images generated by
+ calls to `.Figure.savefig`.
+
+ If *None*, the test function must use the ``baseline_images`` fixture,
+ either as a parameter or with `pytest.mark.usefixtures`. This value is
+ only allowed when using pytest.
+
+ extensions : None or list of str
+ The list of extensions to test, e.g. ``['png', 'pdf']``.
+
+ If *None*, defaults to all supported extensions: png, pdf, and svg.
+
+ When testing a single extension, it can be directly included in the
+ names passed to *baseline_images*. In that case, *extensions* must not
+ be set.
+
+ In order to keep the size of the test suite from ballooning, we only
+ include the ``svg`` or ``pdf`` outputs if the test is explicitly
+ exercising a feature dependent on that backend (see also the
+ `check_figures_equal` decorator for that purpose).
+
+ tol : float, default: 0
+ The RMS threshold above which the test is considered failed.
+
+ Due to expected small differences in floating-point calculations, on
+ 32-bit systems an additional 0.06 is added to this threshold.
+
+ freetype_version : str or tuple
+ The expected freetype version or range of versions for this test to
+ pass.
+
+ remove_text : bool
+ Remove the title and tick text from the figure before comparison. This
+ is useful to make the baseline images independent of variations in text
+ rendering between different versions of FreeType.
+
+ This does not remove other, more deliberate, text, such as legends and
+ annotations.
+
+ savefig_kwarg : dict
+ Optional arguments that are passed to the savefig method.
+
+ style : str, dict, or list
+ The optional style(s) to apply to the image test. The test itself
+ can also apply additional styles if desired. Defaults to ``["classic",
+ "_classic_test_patch"]``.
+ """
+
+ if baseline_images is not None:
+ # List of non-empty filename extensions.
+ baseline_exts = [*filter(None, {Path(baseline).suffix[1:]
+ for baseline in baseline_images})]
+ if baseline_exts:
+ if extensions is not None:
+ raise ValueError(
+ "When including extensions directly in 'baseline_images', "
+ "'extensions' cannot be set as well")
+ if len(baseline_exts) > 1:
+ raise ValueError(
+ "When including extensions directly in 'baseline_images', "
+ "all baselines must share the same suffix")
+ extensions = baseline_exts
+ baseline_images = [ # Chop suffix out from baseline_images.
+ Path(baseline).stem for baseline in baseline_images]
+ if extensions is None:
+ # Default extensions to test, if not set via baseline_images.
+ extensions = ['png', 'pdf', 'svg']
+ if savefig_kwarg is None:
+ savefig_kwarg = dict() # default no kwargs to savefig
+ if sys.maxsize <= 2**32:
+ tol += 0.06
+ return _pytest_image_comparison(
+ baseline_images=baseline_images, extensions=extensions, tol=tol,
+ freetype_version=freetype_version, remove_text=remove_text,
+ savefig_kwargs=savefig_kwarg, style=style)
+
+
+def check_figures_equal(*, extensions=("png", "pdf", "svg"), tol=0):
+ """
+ Decorator for test cases that generate and compare two figures.
+
+ The decorated function must take two keyword arguments, *fig_test*
+ and *fig_ref*, and draw the test and reference images on them.
+ After the function returns, the figures are saved and compared.
+
+ This decorator should be preferred over `image_comparison` when possible in
+ order to keep the size of the test suite from ballooning.
+
+ Parameters
+ ----------
+ extensions : list, default: ["png", "pdf", "svg"]
+ The extensions to test.
+ tol : float
+ The RMS threshold above which the test is considered failed.
+
+ Raises
+ ------
+ RuntimeError
+ If any new figures are created (and not subsequently closed) inside
+ the test function.
+
+ Examples
+ --------
+ Check that calling `.Axes.plot` with a single argument plots it against
+ ``[0, 1, 2, ...]``::
+
+ @check_figures_equal()
+ def test_plot(fig_test, fig_ref):
+ fig_test.subplots().plot([1, 3, 5])
+ fig_ref.subplots().plot([0, 1, 2], [1, 3, 5])
+
+ """
+ ALLOWED_CHARS = set(string.digits + string.ascii_letters + '_-[]()')
+ KEYWORD_ONLY = inspect.Parameter.KEYWORD_ONLY
+
+ def decorator(func):
+ import pytest
+
+ _, result_dir = _image_directories(func)
+ old_sig = inspect.signature(func)
+
+ if not {"fig_test", "fig_ref"}.issubset(old_sig.parameters):
+ raise ValueError("The decorated function must have at least the "
+ "parameters 'fig_ref' and 'fig_test', but your "
+ f"function has the signature {old_sig}")
+
+ @pytest.mark.parametrize("ext", extensions)
+ def wrapper(*args, ext, request, **kwargs):
+ if 'ext' in old_sig.parameters:
+ kwargs['ext'] = ext
+ if 'request' in old_sig.parameters:
+ kwargs['request'] = request
+
+ file_name = "".join(c for c in request.node.name
+ if c in ALLOWED_CHARS)
+ try:
+ fig_test = plt.figure("test")
+ fig_ref = plt.figure("reference")
+ # Keep track of number of open figures, to make sure test
+ # doesn't create any new ones
+ n_figs = len(plt.get_fignums())
+ func(*args, fig_test=fig_test, fig_ref=fig_ref, **kwargs)
+ if len(plt.get_fignums()) > n_figs:
+ raise RuntimeError('Number of open figures changed during '
+ 'test. Make sure you are plotting to '
+ 'fig_test or fig_ref, or if this is '
+ 'deliberate explicitly close the '
+ 'new figure(s) inside the test.')
+ test_image_path = result_dir / (file_name + "." + ext)
+ ref_image_path = result_dir / (file_name + "-expected." + ext)
+ fig_test.savefig(test_image_path)
+ fig_ref.savefig(ref_image_path)
+ _raise_on_image_difference(
+ ref_image_path, test_image_path, tol=tol
+ )
+ finally:
+ plt.close(fig_test)
+ plt.close(fig_ref)
+
+ parameters = [
+ param
+ for param in old_sig.parameters.values()
+ if param.name not in {"fig_test", "fig_ref"}
+ ]
+ if 'ext' not in old_sig.parameters:
+ parameters += [inspect.Parameter("ext", KEYWORD_ONLY)]
+ if 'request' not in old_sig.parameters:
+ parameters += [inspect.Parameter("request", KEYWORD_ONLY)]
+ new_sig = old_sig.replace(parameters=parameters)
+ wrapper.__signature__ = new_sig
+
+ # reach a bit into pytest internals to hoist the marks from
+ # our wrapped function
+ new_marks = getattr(func, "pytestmark", []) + wrapper.pytestmark
+ wrapper.pytestmark = new_marks
+
+ return wrapper
+
+ return decorator
+
+
+def _image_directories(func):
+ """
+ Compute the baseline and result image directories for testing *func*.
+
+ For test module ``foo.bar.test_baz``, the baseline directory is at
+ ``foo/bar/baseline_images/test_baz`` and the result directory at
+ ``$(pwd)/result_images/test_baz``. The result directory is created if it
+ doesn't exist.
+ """
+ module_path = Path(sys.modules[func.__module__].__file__)
+ baseline_dir = module_path.parent / "baseline_images" / module_path.stem
+ result_dir = Path().resolve() / "result_images" / module_path.stem
+ result_dir.mkdir(parents=True, exist_ok=True)
+ return baseline_dir, result_dir
diff --git a/venv/Lib/site-packages/matplotlib/testing/exceptions.py b/venv/Lib/site-packages/matplotlib/testing/exceptions.py
new file mode 100644
index 0000000..c39a392
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/exceptions.py
@@ -0,0 +1,4 @@
+class ImageComparisonFailure(AssertionError):
+ """
+ Raise this exception to mark a test as a comparison between two images.
+ """
diff --git a/venv/Lib/site-packages/matplotlib/testing/jpl_units/Duration.py b/venv/Lib/site-packages/matplotlib/testing/jpl_units/Duration.py
new file mode 100644
index 0000000..9bd8d9f
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/jpl_units/Duration.py
@@ -0,0 +1,165 @@
+"""Duration module."""
+
+import operator
+
+from matplotlib import _api
+
+
+class Duration:
+ """Class Duration in development."""
+
+ allowed = ["ET", "UTC"]
+
+ def __init__(self, frame, seconds):
+ """
+ Create a new Duration object.
+
+ = ERROR CONDITIONS
+ - If the input frame is not in the allowed list, an error is thrown.
+
+ = INPUT VARIABLES
+ - frame The frame of the duration. Must be 'ET' or 'UTC'
+ - seconds The number of seconds in the Duration.
+ """
+ _api.check_in_list(self.allowed, frame=frame)
+ self._frame = frame
+ self._seconds = seconds
+
+ def frame(self):
+ """Return the frame the duration is in."""
+ return self._frame
+
+ def __abs__(self):
+ """Return the absolute value of the duration."""
+ return Duration(self._frame, abs(self._seconds))
+
+ def __neg__(self):
+ """Return the negative value of this Duration."""
+ return Duration(self._frame, -self._seconds)
+
+ def seconds(self):
+ """Return the number of seconds in the Duration."""
+ return self._seconds
+
+ def __bool__(self):
+ return self._seconds != 0
+
+ def __eq__(self, rhs):
+ return self._cmp(rhs, operator.eq)
+
+ def __ne__(self, rhs):
+ return self._cmp(rhs, operator.ne)
+
+ def __lt__(self, rhs):
+ return self._cmp(rhs, operator.lt)
+
+ def __le__(self, rhs):
+ return self._cmp(rhs, operator.le)
+
+ def __gt__(self, rhs):
+ return self._cmp(rhs, operator.gt)
+
+ def __ge__(self, rhs):
+ return self._cmp(rhs, operator.ge)
+
+ def _cmp(self, rhs, op):
+ """
+ Compare two Durations.
+
+ = INPUT VARIABLES
+ - rhs The Duration to compare against.
+ - op The function to do the comparison
+
+ = RETURN VALUE
+ - Returns op(self, rhs)
+ """
+ self.checkSameFrame(rhs, "compare")
+ return op(self._seconds, rhs._seconds)
+
+ def __add__(self, rhs):
+ """
+ Add two Durations.
+
+ = ERROR CONDITIONS
+ - If the input rhs is not in the same frame, an error is thrown.
+
+ = INPUT VARIABLES
+ - rhs The Duration to add.
+
+ = RETURN VALUE
+ - Returns the sum of ourselves and the input Duration.
+ """
+ # Delay-load due to circular dependencies.
+ import matplotlib.testing.jpl_units as U
+
+ if isinstance(rhs, U.Epoch):
+ return rhs + self
+
+ self.checkSameFrame(rhs, "add")
+ return Duration(self._frame, self._seconds + rhs._seconds)
+
+ def __sub__(self, rhs):
+ """
+ Subtract two Durations.
+
+ = ERROR CONDITIONS
+ - If the input rhs is not in the same frame, an error is thrown.
+
+ = INPUT VARIABLES
+ - rhs The Duration to subtract.
+
+ = RETURN VALUE
+ - Returns the difference of ourselves and the input Duration.
+ """
+ self.checkSameFrame(rhs, "sub")
+ return Duration(self._frame, self._seconds - rhs._seconds)
+
+ def __mul__(self, rhs):
+ """
+ Scale a UnitDbl by a value.
+
+ = INPUT VARIABLES
+ - rhs The scalar to multiply by.
+
+ = RETURN VALUE
+ - Returns the scaled Duration.
+ """
+ return Duration(self._frame, self._seconds * float(rhs))
+
+ def __rmul__(self, lhs):
+ """
+ Scale a Duration by a value.
+
+ = INPUT VARIABLES
+ - lhs The scalar to multiply by.
+
+ = RETURN VALUE
+ - Returns the scaled Duration.
+ """
+ return Duration(self._frame, self._seconds * float(lhs))
+
+ def __str__(self):
+ """Print the Duration."""
+ return "%g %s" % (self._seconds, self._frame)
+
+ def __repr__(self):
+ """Print the Duration."""
+ return "Duration('%s', %g)" % (self._frame, self._seconds)
+
+ def checkSameFrame(self, rhs, func):
+ """
+ Check to see if frames are the same.
+
+ = ERROR CONDITIONS
+ - If the frame of the rhs Duration is not the same as our frame,
+ an error is thrown.
+
+ = INPUT VARIABLES
+ - rhs The Duration to check for the same frame
+ - func The name of the function doing the check.
+ """
+ if self._frame != rhs._frame:
+ raise ValueError(
+ f"Cannot {func} Durations with different frames.\n"
+ f"LHS: {self._frame}\n"
+ f"RHS: {rhs._frame}")
diff --git a/venv/Lib/site-packages/matplotlib/testing/jpl_units/Epoch.py b/venv/Lib/site-packages/matplotlib/testing/jpl_units/Epoch.py
new file mode 100644
index 0000000..2566652
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/jpl_units/Epoch.py
@@ -0,0 +1,232 @@
+"""Epoch module."""
+
+import operator
+import math
+import datetime as DT
+
+from matplotlib import _api
+from matplotlib.dates import date2num
+
+
+class Epoch:
+ # Frame conversion offsets in seconds
+ # t(TO) = t(FROM) + allowed[ FROM ][ TO ]
+ allowed = {
+ "ET": {
+ "UTC": +64.1839,
+ },
+ "UTC": {
+ "ET": -64.1839,
+ },
+ }
+
+ def __init__(self, frame, sec=None, jd=None, daynum=None, dt=None):
+ """
+ Create a new Epoch object.
+
+ Build an epoch 1 of 2 ways:
+
+ Using seconds past a Julian date:
+ # Epoch('ET', sec=1e8, jd=2451545)
+
+ or using a matplotlib day number
+ # Epoch('ET', daynum=730119.5)
+
+ = ERROR CONDITIONS
+ - If the input units are not in the allowed list, an error is thrown.
+
+ = INPUT VARIABLES
+ - frame The frame of the epoch. Must be 'ET' or 'UTC'
+ - sec The number of seconds past the input JD.
+ - jd The Julian date of the epoch.
+ - daynum The matplotlib day number of the epoch.
+ - dt A python datetime instance.
+ """
+ if ((sec is None and jd is not None) or
+ (sec is not None and jd is None) or
+ (daynum is not None and
+ (sec is not None or jd is not None)) or
+ (daynum is None and dt is None and
+ (sec is None or jd is None)) or
+ (daynum is not None and dt is not None) or
+ (dt is not None and (sec is not None or jd is not None)) or
+ ((dt is not None) and not isinstance(dt, DT.datetime))):
+ raise ValueError(
+ "Invalid inputs. Must enter sec and jd together, "
+ "daynum by itself, or dt (must be a python datetime).\n"
+ "Sec = %s\n"
+ "JD = %s\n"
+ "dnum= %s\n"
+ "dt = %s" % (sec, jd, daynum, dt))
+
+ _api.check_in_list(self.allowed, frame=frame)
+ self._frame = frame
+
+ if dt is not None:
+ daynum = date2num(dt)
+
+ if daynum is not None:
+ # 1-JAN-0001 in JD = 1721425.5
+ jd = float(daynum) + 1721425.5
+ self._jd = math.floor(jd)
+ self._seconds = (jd - self._jd) * 86400.0
+
+ else:
+ self._seconds = float(sec)
+ self._jd = float(jd)
+
+ # Resolve seconds down to [ 0, 86400)
+ deltaDays = math.floor(self._seconds / 86400)
+ self._jd += deltaDays
+ self._seconds -= deltaDays * 86400.0
+
+ def convert(self, frame):
+ if self._frame == frame:
+ return self
+
+ offset = self.allowed[self._frame][frame]
+
+ return Epoch(frame, self._seconds + offset, self._jd)
+
+ def frame(self):
+ return self._frame
+
+ def julianDate(self, frame):
+ t = self
+ if frame != self._frame:
+ t = self.convert(frame)
+
+ return t._jd + t._seconds / 86400.0
+
+ def secondsPast(self, frame, jd):
+ t = self
+ if frame != self._frame:
+ t = self.convert(frame)
+
+ delta = t._jd - jd
+ return t._seconds + delta * 86400
+
+ def __eq__(self, rhs):
+ return self._cmp(rhs, operator.eq)
+
+ def __ne__(self, rhs):
+ return self._cmp(rhs, operator.ne)
+
+ def __lt__(self, rhs):
+ return self._cmp(rhs, operator.lt)
+
+ def __le__(self, rhs):
+ return self._cmp(rhs, operator.le)
+
+ def __gt__(self, rhs):
+ return self._cmp(rhs, operator.gt)
+
+ def __ge__(self, rhs):
+ return self._cmp(rhs, operator.ge)
+
+ def _cmp(self, rhs, op):
+ """
+ Compare two Epoch's.
+
+ = INPUT VARIABLES
+ - rhs The Epoch to compare against.
+ - op The function to do the comparison
+
+ = RETURN VALUE
+ - Returns op(self, rhs)
+ """
+ t = self
+ if self._frame != rhs._frame:
+ t = self.convert(rhs._frame)
+
+ if t._jd != rhs._jd:
+ return op(t._jd, rhs._jd)
+
+ return op(t._seconds, rhs._seconds)
+
+ def __add__(self, rhs):
+ """
+ Add a duration to an Epoch.
+
+ = INPUT VARIABLES
+ - rhs The Epoch to subtract.
+
+ = RETURN VALUE
+ - Returns the difference of ourselves and the input Epoch.
+ """
+ t = self
+ if self._frame != rhs.frame():
+ t = self.convert(rhs._frame)
+
+ sec = t._seconds + rhs.seconds()
+
+ return Epoch(t._frame, sec, t._jd)
+
+ def __sub__(self, rhs):
+ """
+ Subtract two Epoch's or a Duration from an Epoch.
+
+ Valid:
+ Duration = Epoch - Epoch
+ Epoch = Epoch - Duration
+
+ = INPUT VARIABLES
+ - rhs The Epoch to subtract.
+
+ = RETURN VALUE
+ - Returns either the duration between to Epoch's or the a new
+ Epoch that is the result of subtracting a duration from an epoch.
+ """
+ # Delay-load due to circular dependencies.
+ import matplotlib.testing.jpl_units as U
+
+ # Handle Epoch - Duration
+ if isinstance(rhs, U.Duration):
+ return self + -rhs
+
+ t = self
+ if self._frame != rhs._frame:
+ t = self.convert(rhs._frame)
+
+ days = t._jd - rhs._jd
+ sec = t._seconds - rhs._seconds
+
+ return U.Duration(rhs._frame, days*86400 + sec)
+
+ def __str__(self):
+ """Print the Epoch."""
+ return "%22.15e %s" % (self.julianDate(self._frame), self._frame)
+
+ def __repr__(self):
+ """Print the Epoch."""
+ return str(self)
+
+ @staticmethod
+ def range(start, stop, step):
+ """
+ Generate a range of Epoch objects.
+
+ Similar to the Python range() method. Returns the range [
+ start, stop) at the requested step. Each element will be a
+ Epoch object.
+
+ = INPUT VARIABLES
+ - start The starting value of the range.
+ - stop The stop value of the range.
+ - step Step to use.
+
+ = RETURN VALUE
+ - Returns a list containing the requested Epoch values.
+ """
+ elems = []
+
+ i = 0
+ while True:
+ d = start + i * step
+ if d >= stop:
+ break
+
+ elems.append(d)
+ i += 1
+
+ return elems
diff --git a/venv/Lib/site-packages/matplotlib/testing/jpl_units/EpochConverter.py b/venv/Lib/site-packages/matplotlib/testing/jpl_units/EpochConverter.py
new file mode 100644
index 0000000..32926b1
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/jpl_units/EpochConverter.py
@@ -0,0 +1,99 @@
+"""EpochConverter module containing class EpochConverter."""
+
+from matplotlib import cbook
+import matplotlib.units as units
+import matplotlib.dates as date_ticker
+
+__all__ = ['EpochConverter']
+
+
+class EpochConverter(units.ConversionInterface):
+ """
+ Provides Matplotlib conversion functionality for Monte Epoch and Duration
+ classes.
+ """
+
+ # julian date reference for "Jan 1, 0001" minus 1 day because
+ # Matplotlib really wants "Jan 0, 0001"
+ jdRef = 1721425.5 - 1
+
+ @staticmethod
+ def axisinfo(unit, axis):
+ # docstring inherited
+ majloc = date_ticker.AutoDateLocator()
+ majfmt = date_ticker.AutoDateFormatter(majloc)
+ return units.AxisInfo(majloc=majloc, majfmt=majfmt, label=unit)
+
+ @staticmethod
+ def float2epoch(value, unit):
+ """
+ Convert a Matplotlib floating-point date into an Epoch of the specified
+ units.
+
+ = INPUT VARIABLES
+ - value The Matplotlib floating-point date.
+ - unit The unit system to use for the Epoch.
+
+ = RETURN VALUE
+ - Returns the value converted to an Epoch in the specified time system.
+ """
+ # Delay-load due to circular dependencies.
+ import matplotlib.testing.jpl_units as U
+
+ secPastRef = value * 86400.0 * U.UnitDbl(1.0, 'sec')
+ return U.Epoch(unit, secPastRef, EpochConverter.jdRef)
+
+ @staticmethod
+ def epoch2float(value, unit):
+ """
+ Convert an Epoch value to a float suitable for plotting as a python
+ datetime object.
+
+ = INPUT VARIABLES
+ - value An Epoch or list of Epochs that need to be converted.
+ - unit The units to use for an axis with Epoch data.
+
+ = RETURN VALUE
+ - Returns the value parameter converted to floats.
+ """
+ return value.julianDate(unit) - EpochConverter.jdRef
+
+ @staticmethod
+ def duration2float(value):
+ """
+ Convert a Duration value to a float suitable for plotting as a python
+ datetime object.
+
+ = INPUT VARIABLES
+ - value A Duration or list of Durations that need to be converted.
+
+ = RETURN VALUE
+ - Returns the value parameter converted to floats.
+ """
+ return value.seconds() / 86400.0
+
+ @staticmethod
+ def convert(value, unit, axis):
+ # docstring inherited
+
+ # Delay-load due to circular dependencies.
+ import matplotlib.testing.jpl_units as U
+
+ if not cbook.is_scalar_or_string(value):
+ return [EpochConverter.convert(x, unit, axis) for x in value]
+ if units.ConversionInterface.is_numlike(value):
+ return value
+ if unit is None:
+ unit = EpochConverter.default_units(value, axis)
+ if isinstance(value, U.Duration):
+ return EpochConverter.duration2float(value)
+ else:
+ return EpochConverter.epoch2float(value, unit)
+
+ @staticmethod
+ def default_units(value, axis):
+ # docstring inherited
+ if cbook.is_scalar_or_string(value):
+ return value.frame()
+ else:
+ return EpochConverter.default_units(value[0], axis)
diff --git a/venv/Lib/site-packages/matplotlib/testing/jpl_units/StrConverter.py b/venv/Lib/site-packages/matplotlib/testing/jpl_units/StrConverter.py
new file mode 100644
index 0000000..576aff8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/jpl_units/StrConverter.py
@@ -0,0 +1,100 @@
+"""StrConverter module containing class StrConverter."""
+
+import numpy as np
+
+import matplotlib.units as units
+
+__all__ = ['StrConverter']
+
+
+class StrConverter(units.ConversionInterface):
+ """
+ A Matplotlib converter class for string data values.
+
+ Valid units for string are:
+ - 'indexed' : Values are indexed as they are specified for plotting.
+ - 'sorted' : Values are sorted alphanumerically.
+ - 'inverted' : Values are inverted so that the first value is on top.
+ - 'sorted-inverted' : A combination of 'sorted' and 'inverted'
+ """
+
+ @staticmethod
+ def axisinfo(unit, axis):
+ # docstring inherited
+ return None
+
+ @staticmethod
+ def convert(value, unit, axis):
+ # docstring inherited
+
+ if units.ConversionInterface.is_numlike(value):
+ return value
+
+ if value == []:
+ return []
+
+ # we delay loading to make matplotlib happy
+ ax = axis.axes
+ if axis is ax.xaxis:
+ isXAxis = True
+ else:
+ isXAxis = False
+
+ axis.get_major_ticks()
+ ticks = axis.get_ticklocs()
+ labels = axis.get_ticklabels()
+
+ labels = [l.get_text() for l in labels if l.get_text()]
+
+ if not labels:
+ ticks = []
+ labels = []
+
+ if not np.iterable(value):
+ value = [value]
+
+ newValues = []
+ for v in value:
+ if v not in labels and v not in newValues:
+ newValues.append(v)
+
+ labels.extend(newValues)
+
+ # DISABLED: This is disabled because matplotlib bar plots do not
+ # DISABLED: recalculate the unit conversion of the data values
+ # DISABLED: this is due to design and is not really a bug.
+ # DISABLED: If this gets changed, then we can activate the following
+ # DISABLED: block of code. Note that this works for line plots.
+ # DISABLED if unit:
+ # DISABLED if unit.find("sorted") > -1:
+ # DISABLED labels.sort()
+ # DISABLED if unit.find("inverted") > -1:
+ # DISABLED labels = labels[::-1]
+
+ # add padding (so they do not appear on the axes themselves)
+ labels = [''] + labels + ['']
+ ticks = list(range(len(labels)))
+ ticks[0] = 0.5
+ ticks[-1] = ticks[-1] - 0.5
+
+ axis.set_ticks(ticks)
+ axis.set_ticklabels(labels)
+ # we have to do the following lines to make ax.autoscale_view work
+ loc = axis.get_major_locator()
+ loc.set_bounds(ticks[0], ticks[-1])
+
+ if isXAxis:
+ ax.set_xlim(ticks[0], ticks[-1])
+ else:
+ ax.set_ylim(ticks[0], ticks[-1])
+
+ result = [ticks[labels.index(v)] for v in value]
+
+ ax.viewLim.ignore(-1)
+ return result
+
+ @staticmethod
+ def default_units(value, axis):
+ # docstring inherited
+ # The default behavior for string indexing.
+ return "indexed"
diff --git a/venv/Lib/site-packages/matplotlib/testing/jpl_units/UnitDbl.py b/venv/Lib/site-packages/matplotlib/testing/jpl_units/UnitDbl.py
new file mode 100644
index 0000000..68481a8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/jpl_units/UnitDbl.py
@@ -0,0 +1,246 @@
+"""UnitDbl module."""
+
+import operator
+
+from matplotlib import _api
+
+
+class UnitDbl:
+ """Class UnitDbl in development."""
+
+ # Unit conversion table. Small subset of the full one but enough
+ # to test the required functions. First field is a scale factor to
+ # convert the input units to the units of the second field. Only
+ # units in this table are allowed.
+ allowed = {
+ "m": (0.001, "km"),
+ "km": (1, "km"),
+ "mile": (1.609344, "km"),
+
+ "rad": (1, "rad"),
+ "deg": (1.745329251994330e-02, "rad"),
+
+ "sec": (1, "sec"),
+ "min": (60.0, "sec"),
+ "hour": (3600, "sec"),
+ }
+
+ _types = {
+ "km": "distance",
+ "rad": "angle",
+ "sec": "time",
+ }
+
+ def __init__(self, value, units):
+ """
+ Create a new UnitDbl object.
+
+ Units are internally converted to km, rad, and sec. The only
+ valid inputs for units are [m, km, mile, rad, deg, sec, min, hour].
+
+ The field UnitDbl.value will contain the converted value. Use
+ the convert() method to get a specific type of units back.
+
+ = ERROR CONDITIONS
+ - If the input units are not in the allowed list, an error is thrown.
+
+ = INPUT VARIABLES
+ - value The numeric value of the UnitDbl.
+ - units The string name of the units the value is in.
+ """
+ data = _api.check_getitem(self.allowed, units=units)
+ self._value = float(value * data[0])
+ self._units = data[1]
+
+ def convert(self, units):
+ """
+ Convert the UnitDbl to a specific set of units.
+
+ = ERROR CONDITIONS
+ - If the input units are not in the allowed list, an error is thrown.
+
+ = INPUT VARIABLES
+ - units The string name of the units to convert to.
+
+ = RETURN VALUE
+ - Returns the value of the UnitDbl in the requested units as a floating
+ point number.
+ """
+ if self._units == units:
+ return self._value
+ data = _api.check_getitem(self.allowed, units=units)
+ if self._units != data[1]:
+ raise ValueError(f"Error trying to convert to different units.\n"
+ f" Invalid conversion requested.\n"
+ f" UnitDbl: {self}\n"
+ f" Units: {units}\n")
+ return self._value / data[0]
+
+ def __abs__(self):
+ """Return the absolute value of this UnitDbl."""
+ return UnitDbl(abs(self._value), self._units)
+
+ def __neg__(self):
+ """Return the negative value of this UnitDbl."""
+ return UnitDbl(-self._value, self._units)
+
+ def __bool__(self):
+ """Return the truth value of a UnitDbl."""
+ return bool(self._value)
+
+ def __eq__(self, rhs):
+ return self._cmp(rhs, operator.eq)
+
+ def __ne__(self, rhs):
+ return self._cmp(rhs, operator.ne)
+
+ def __lt__(self, rhs):
+ return self._cmp(rhs, operator.lt)
+
+ def __le__(self, rhs):
+ return self._cmp(rhs, operator.le)
+
+ def __gt__(self, rhs):
+ return self._cmp(rhs, operator.gt)
+
+ def __ge__(self, rhs):
+ return self._cmp(rhs, operator.ge)
+
+ def _cmp(self, rhs, op):
+ """
+ Compare two UnitDbl's.
+
+ = ERROR CONDITIONS
+ - If the input rhs units are not the same as our units,
+ an error is thrown.
+
+ = INPUT VARIABLES
+ - rhs The UnitDbl to compare against.
+ - op The function to do the comparison
+
+ = RETURN VALUE
+ - Returns op(self, rhs)
+ """
+ self.checkSameUnits(rhs, "compare")
+ return op(self._value, rhs._value)
+
+ def __add__(self, rhs):
+ """
+ Add two UnitDbl's.
+
+ = ERROR CONDITIONS
+ - If the input rhs units are not the same as our units,
+ an error is thrown.
+
+ = INPUT VARIABLES
+ - rhs The UnitDbl to add.
+
+ = RETURN VALUE
+ - Returns the sum of ourselves and the input UnitDbl.
+ """
+ self.checkSameUnits(rhs, "add")
+ return UnitDbl(self._value + rhs._value, self._units)
+
+ def __sub__(self, rhs):
+ """
+ Subtract two UnitDbl's.
+
+ = ERROR CONDITIONS
+ - If the input rhs units are not the same as our units,
+ an error is thrown.
+
+ = INPUT VARIABLES
+ - rhs The UnitDbl to subtract.
+
+ = RETURN VALUE
+ - Returns the difference of ourselves and the input UnitDbl.
+ """
+ self.checkSameUnits(rhs, "subtract")
+ return UnitDbl(self._value - rhs._value, self._units)
+
+ def __mul__(self, rhs):
+ """
+ Scale a UnitDbl by a value.
+
+ = INPUT VARIABLES
+ - rhs The scalar to multiply by.
+
+ = RETURN VALUE
+ - Returns the scaled UnitDbl.
+ """
+ return UnitDbl(self._value * rhs, self._units)
+
+ def __rmul__(self, lhs):
+ """
+ Scale a UnitDbl by a value.
+
+ = INPUT VARIABLES
+ - lhs The scalar to multiply by.
+
+ = RETURN VALUE
+ - Returns the scaled UnitDbl.
+ """
+ return UnitDbl(self._value * lhs, self._units)
+
+ def __str__(self):
+ """Print the UnitDbl."""
+ return "%g *%s" % (self._value, self._units)
+
+ def __repr__(self):
+ """Print the UnitDbl."""
+ return "UnitDbl(%g, '%s')" % (self._value, self._units)
+
+ def type(self):
+ """Return the type of UnitDbl data."""
+ return self._types[self._units]
+
+ @staticmethod
+ def range(start, stop, step=None):
+ """
+ Generate a range of UnitDbl objects.
+
+ Similar to the Python range() method. Returns the range [
+ start, stop) at the requested step. Each element will be a
+ UnitDbl object.
+
+ = INPUT VARIABLES
+ - start The starting value of the range.
+ - stop The stop value of the range.
+ - step Optional step to use. If set to None, then a UnitDbl of
+ value 1 w/ the units of the start is used.
+
+ = RETURN VALUE
+ - Returns a list containing the requested UnitDbl values.
+ """
+ if step is None:
+ step = UnitDbl(1, start._units)
+
+ elems = []
+
+ i = 0
+ while True:
+ d = start + i * step
+ if d >= stop:
+ break
+
+ elems.append(d)
+ i += 1
+
+ return elems
+
+ def checkSameUnits(self, rhs, func):
+ """
+ Check to see if units are the same.
+
+ = ERROR CONDITIONS
+ - If the units of the rhs UnitDbl are not the same as our units,
+ an error is thrown.
+
+ = INPUT VARIABLES
+ - rhs The UnitDbl to check for the same units
+ - func The name of the function doing the check.
+ """
+ if self._units != rhs._units:
+ raise ValueError(f"Cannot {func} units of different types.\n"
+ f"LHS: {self._units}\n"
+ f"RHS: {rhs._units}")
diff --git a/venv/Lib/site-packages/matplotlib/testing/jpl_units/UnitDblConverter.py b/venv/Lib/site-packages/matplotlib/testing/jpl_units/UnitDblConverter.py
new file mode 100644
index 0000000..37734e5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/jpl_units/UnitDblConverter.py
@@ -0,0 +1,91 @@
+"""UnitDblConverter module containing class UnitDblConverter."""
+
+import numpy as np
+
+from matplotlib import cbook
+import matplotlib.units as units
+import matplotlib.projections.polar as polar
+
+__all__ = ['UnitDblConverter']
+
+
+# A special function for use with the matplotlib FuncFormatter class
+# for formatting axes with radian units.
+# This was copied from matplotlib example code.
+def rad_fn(x, pos=None):
+ """Radian function formatter."""
+ n = int((x / np.pi) * 2.0 + 0.25)
+ if n == 0:
+ return str(x)
+ elif n == 1:
+ return r'$\pi/2$'
+ elif n == 2:
+ return r'$\pi$'
+ elif n % 2 == 0:
+ return fr'${n//2}\pi$'
+ else:
+ return fr'${n}\pi/2$'
+
+
+class UnitDblConverter(units.ConversionInterface):
+ """
+ Provides Matplotlib conversion functionality for the Monte UnitDbl class.
+ """
+ # default for plotting
+ defaults = {
+ "distance": 'km',
+ "angle": 'deg',
+ "time": 'sec',
+ }
+
+ @staticmethod
+ def axisinfo(unit, axis):
+ # docstring inherited
+
+ # Delay-load due to circular dependencies.
+ import matplotlib.testing.jpl_units as U
+
+ # Check to see if the value used for units is a string unit value
+ # or an actual instance of a UnitDbl so that we can use the unit
+ # value for the default axis label value.
+ if unit:
+ label = unit if isinstance(unit, str) else unit.label()
+ else:
+ label = None
+
+ if label == "deg" and isinstance(axis.axes, polar.PolarAxes):
+ # If we want degrees for a polar plot, use the PolarPlotFormatter
+ majfmt = polar.PolarAxes.ThetaFormatter()
+ else:
+ majfmt = U.UnitDblFormatter(useOffset=False)
+
+ return units.AxisInfo(majfmt=majfmt, label=label)
+
+ @staticmethod
+ def convert(value, unit, axis):
+ # docstring inherited
+ if not cbook.is_scalar_or_string(value):
+ return [UnitDblConverter.convert(x, unit, axis) for x in value]
+ # If the incoming value behaves like a number,
+ # then just return it because we don't know how to convert it
+ # (or it is already converted)
+ if units.ConversionInterface.is_numlike(value):
+ return value
+ # If no units were specified, then get the default units to use.
+ if unit is None:
+ unit = UnitDblConverter.default_units(value, axis)
+ # Convert the incoming UnitDbl value/values to float/floats
+ if isinstance(axis.axes, polar.PolarAxes) and value.type() == "angle":
+ # Guarantee that units are radians for polar plots.
+ return value.convert("rad")
+ return value.convert(unit)
+
+ @staticmethod
+ def default_units(value, axis):
+ # docstring inherited
+ # Determine the default units based on the user preferences set for
+ # default units when printing a UnitDbl.
+ if cbook.is_scalar_or_string(value):
+ return UnitDblConverter.defaults[value.type()]
+ else:
+ return UnitDblConverter.default_units(value[0], axis)
diff --git a/venv/Lib/site-packages/matplotlib/testing/jpl_units/UnitDblFormatter.py b/venv/Lib/site-packages/matplotlib/testing/jpl_units/UnitDblFormatter.py
new file mode 100644
index 0000000..da262ea
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/jpl_units/UnitDblFormatter.py
@@ -0,0 +1,28 @@
+"""UnitDblFormatter module containing class UnitDblFormatter."""
+
+import matplotlib.ticker as ticker
+
+__all__ = ['UnitDblFormatter']
+
+
+class UnitDblFormatter(ticker.ScalarFormatter):
+ """
+ The formatter for UnitDbl data types.
+
+ This allows for formatting with the unit string.
+ """
+
+ def __call__(self, x, pos=None):
+ # docstring inherited
+ if len(self.locs) == 0:
+ return ''
+ else:
+ return '{:.12}'.format(x)
+
+ def format_data_short(self, value):
+ # docstring inherited
+ return '{:.12}'.format(value)
+
+ def format_data(self, value):
+ # docstring inherited
+ return '{:.12}'.format(value)
diff --git a/venv/Lib/site-packages/matplotlib/testing/jpl_units/__init__.py b/venv/Lib/site-packages/matplotlib/testing/jpl_units/__init__.py
new file mode 100644
index 0000000..b8caa9a
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/jpl_units/__init__.py
@@ -0,0 +1,76 @@
+"""
+A sample set of units for use with testing unit conversion
+of Matplotlib routines. These are used because they use very strict
+enforcement of unitized data which will test the entire spectrum of how
+unitized data might be used (it is not always meaningful to convert to
+a float without specific units given).
+
+UnitDbl is essentially a unitized floating point number. It has a
+minimal set of supported units (enough for testing purposes). All
+of the mathematical operation are provided to fully test any behaviour
+that might occur with unitized data. Remember that unitized data has
+rules as to how it can be applied to one another (a value of distance
+cannot be added to a value of time). Thus we need to guard against any
+accidental "default" conversion that will strip away the meaning of the
+data and render it neutered.
+
+Epoch is different than a UnitDbl of time. Time is something that can be
+measured where an Epoch is a specific moment in time. Epochs are typically
+referenced as an offset from some predetermined epoch.
+
+A difference of two epochs is a Duration. The distinction between a Duration
+and a UnitDbl of time is made because an Epoch can have different frames (or
+units). In the case of our test Epoch class the two allowed frames are 'UTC'
+and 'ET' (Note that these are rough estimates provided for testing purposes
+and should not be used in production code where accuracy of time frames is
+desired). As such a Duration also has a frame of reference and therefore needs
+to be called out as different that a simple measurement of time since a delta-t
+in one frame may not be the same in another.
+"""
+
+from .Duration import Duration
+from .Epoch import Epoch
+from .UnitDbl import UnitDbl
+
+from .StrConverter import StrConverter
+from .EpochConverter import EpochConverter
+from .UnitDblConverter import UnitDblConverter
+
+from .UnitDblFormatter import UnitDblFormatter
+
+
+__version__ = "1.0"
+
+__all__ = [
+ 'register',
+ 'Duration',
+ 'Epoch',
+ 'UnitDbl',
+ 'UnitDblFormatter',
+ ]
+
+
+def register():
+ """Register the unit conversion classes with matplotlib."""
+ import matplotlib.units as mplU
+
+ mplU.registry[str] = StrConverter()
+ mplU.registry[Epoch] = EpochConverter()
+ mplU.registry[Duration] = EpochConverter()
+ mplU.registry[UnitDbl] = UnitDblConverter()
+
+
+# Some default unit instances
+# Distances
+m = UnitDbl(1.0, "m")
+km = UnitDbl(1.0, "km")
+mile = UnitDbl(1.0, "mile")
+# Angles
+deg = UnitDbl(1.0, "deg")
+rad = UnitDbl(1.0, "rad")
+# Time
+sec = UnitDbl(1.0, "sec")
+min = UnitDbl(1.0, "min")
+hr = UnitDbl(1.0, "hour")
+day = UnitDbl(24.0, "hour")
+sec = UnitDbl(1.0, "sec")
diff --git a/venv/Lib/site-packages/matplotlib/testing/widgets.py b/venv/Lib/site-packages/matplotlib/testing/widgets.py
new file mode 100644
index 0000000..49d5cb7
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/testing/widgets.py
@@ -0,0 +1,84 @@
+"""
+========================
+Widget testing utilities
+========================
+Functions that are useful for testing widgets.
+See also matplotlib.tests.test_widgets
+"""
+import matplotlib.pyplot as plt
+from unittest import mock
+
+
+def get_ax():
+ """Creates plot and returns its axes"""
+ fig, ax = plt.subplots(1, 1)
+ ax.plot([0, 200], [0, 200])
+ ax.set_aspect(1.0)
+ ax.figure.canvas.draw()
+ return ax
+
+
+def mock_event(ax, button=1, xdata=0, ydata=0, key=None, step=1):
+ r"""
+ Create a mock event that can stand in for `.Event` and its subclasses.
+
+ This event is intended to be used in tests where it can be passed into
+ event handling functions.
+
+ Parameters
+ ----------
+ ax : `matplotlib.axes.Axes`
+ The axes the event will be in.
+ xdata : int
+ x coord of mouse in data coords.
+ ydata : int
+ y coord of mouse in data coords.
+ button : None or `MouseButton` or {'up', 'down'}
+ The mouse button pressed in this event (see also `.MouseEvent`).
+ key : None or str
+ The key pressed when the mouse event triggered (see also `.KeyEvent`).
+ step : int
+ Number of scroll steps (positive for 'up', negative for 'down').
+
+ Returns
+ -------
+ event
+ A `.Event`\-like Mock instance.
+ """
+ event = mock.Mock()
+ event.button = button
+ event.x, event.y = ax.transData.transform([(xdata, ydata),
+ (xdata, ydata)])[0]
+ event.xdata, event.ydata = xdata, ydata
+ event.inaxes = ax
+ event.canvas = ax.figure.canvas
+ event.key = key
+ event.step = step
+ event.guiEvent = None
+ event.name = 'Custom'
+ return event
+
+
+def do_event(tool, etype, button=1, xdata=0, ydata=0, key=None, step=1):
+ """
+ Trigger an event on the given tool.
+
+ Parameters
+ ----------
+ tool : matplotlib.widgets.RectangleSelector
+ etype : str
+ The event to trigger.
+ xdata : int
+ x coord of mouse in data coords.
+ ydata : int
+ y coord of mouse in data coords.
+ button : None or `MouseButton` or {'up', 'down'}
+ The mouse button pressed in this event (see also `.MouseEvent`).
+ key : None or str
+ The key pressed when the mouse event triggered (see also `.KeyEvent`).
+ step : int
+ Number of scroll steps (positive for 'up', negative for 'down').
+ """
+ event = mock_event(tool.ax, button, xdata, ydata, key, step)
+ func = getattr(tool, etype)
+ func(event)
diff --git a/venv/Lib/site-packages/matplotlib/tests/__init__.py b/venv/Lib/site-packages/matplotlib/tests/__init__.py
new file mode 100644
index 0000000..7c4c5e9
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/__init__.py
@@ -0,0 +1,10 @@
+from pathlib import Path
+
+
+# Check that the test directories exist.
+if not (Path(__file__).parent / 'baseline_images').exists():
+ raise IOError(
+ 'The baseline image directory does not exist. '
+ 'This is most likely because the test data is not installed. '
+ 'You may need to install matplotlib from source to get the '
+ 'test data.')
diff --git a/venv/Lib/site-packages/matplotlib/tests/conftest.py b/venv/Lib/site-packages/matplotlib/tests/conftest.py
new file mode 100644
index 0000000..722a7ff
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/conftest.py
@@ -0,0 +1,4 @@
+from matplotlib.testing.conftest import (mpl_test_settings,
+ mpl_image_comparison_parameters,
+ pytest_configure, pytest_unconfigure,
+ pd)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_afm.py b/venv/Lib/site-packages/matplotlib/tests/test_afm.py
new file mode 100644
index 0000000..2d54c16
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_afm.py
@@ -0,0 +1,137 @@
+from io import BytesIO
+import pytest
+import logging
+
+from matplotlib import afm
+from matplotlib import font_manager as fm
+
+
+# See note in afm.py re: use of comma as decimal separator in the
+# UnderlineThickness field and re: use of non-ASCII characters in the Notice
+# field.
+AFM_TEST_DATA = b"""StartFontMetrics 2.0
+Comment Comments are ignored.
+Comment Creation Date:Mon Nov 13 12:34:11 GMT 2017
+FontName MyFont-Bold
+EncodingScheme FontSpecific
+FullName My Font Bold
+FamilyName Test Fonts
+Weight Bold
+ItalicAngle 0.0
+IsFixedPitch false
+UnderlinePosition -100
+UnderlineThickness 56,789
+Version 001.000
+Notice Copyright \xa9 2017 No one.
+FontBBox 0 -321 1234 369
+StartCharMetrics 3
+C 0 ; WX 250 ; N space ; B 0 0 0 0 ;
+C 42 ; WX 1141 ; N foo ; B 40 60 800 360 ;
+C 99 ; WX 583 ; N bar ; B 40 -10 543 210 ;
+EndCharMetrics
+EndFontMetrics
+"""
+
+
+def test_nonascii_str():
+ # This tests that we also decode bytes as utf-8 properly.
+ # Else, font files with non ascii characters fail to load.
+ inp_str = "привет"
+ byte_str = inp_str.encode("utf8")
+
+ ret = afm._to_str(byte_str)
+ assert ret == inp_str
+
+
+def test_parse_header():
+ fh = BytesIO(AFM_TEST_DATA)
+ header = afm._parse_header(fh)
+ assert header == {
+ b'StartFontMetrics': 2.0,
+ b'FontName': 'MyFont-Bold',
+ b'EncodingScheme': 'FontSpecific',
+ b'FullName': 'My Font Bold',
+ b'FamilyName': 'Test Fonts',
+ b'Weight': 'Bold',
+ b'ItalicAngle': 0.0,
+ b'IsFixedPitch': False,
+ b'UnderlinePosition': -100,
+ b'UnderlineThickness': 56.789,
+ b'Version': '001.000',
+ b'Notice': b'Copyright \xa9 2017 No one.',
+ b'FontBBox': [0, -321, 1234, 369],
+ b'StartCharMetrics': 3,
+ }
+
+
+def test_parse_char_metrics():
+ fh = BytesIO(AFM_TEST_DATA)
+ afm._parse_header(fh) # position
+ metrics = afm._parse_char_metrics(fh)
+ assert metrics == (
+ {0: (250.0, 'space', [0, 0, 0, 0]),
+ 42: (1141.0, 'foo', [40, 60, 800, 360]),
+ 99: (583.0, 'bar', [40, -10, 543, 210]),
+ },
+ {'space': (250.0, 'space', [0, 0, 0, 0]),
+ 'foo': (1141.0, 'foo', [40, 60, 800, 360]),
+ 'bar': (583.0, 'bar', [40, -10, 543, 210]),
+ })
+
+
+def test_get_familyname_guessed():
+ fh = BytesIO(AFM_TEST_DATA)
+ font = afm.AFM(fh)
+ del font._header[b'FamilyName'] # remove FamilyName, so we have to guess
+ assert font.get_familyname() == 'My Font'
+
+
+def test_font_manager_weight_normalization():
+ font = afm.AFM(BytesIO(
+ AFM_TEST_DATA.replace(b"Weight Bold\n", b"Weight Custom\n")))
+ assert fm.afmFontProperty("", font).weight == "normal"
+
+
+@pytest.mark.parametrize(
+ "afm_data",
+ [
+ b"""nope
+really nope""",
+ b"""StartFontMetrics 2.0
+Comment Comments are ignored.
+Comment Creation Date:Mon Nov 13 12:34:11 GMT 2017
+FontName MyFont-Bold
+EncodingScheme FontSpecific""",
+ ],
+)
+def test_bad_afm(afm_data):
+ fh = BytesIO(afm_data)
+ with pytest.raises(RuntimeError):
+ afm._parse_header(fh)
+
+
+@pytest.mark.parametrize(
+ "afm_data",
+ [
+ b"""StartFontMetrics 2.0
+Comment Comments are ignored.
+Comment Creation Date:Mon Nov 13 12:34:11 GMT 2017
+Aardvark bob
+FontName MyFont-Bold
+EncodingScheme FontSpecific
+StartCharMetrics 3""",
+ b"""StartFontMetrics 2.0
+Comment Comments are ignored.
+Comment Creation Date:Mon Nov 13 12:34:11 GMT 2017
+ItalicAngle zero degrees
+FontName MyFont-Bold
+EncodingScheme FontSpecific
+StartCharMetrics 3""",
+ ],
+)
+def test_malformed_header(afm_data, caplog):
+ fh = BytesIO(afm_data)
+ with caplog.at_level(logging.ERROR):
+ afm._parse_header(fh)
+
+ assert len(caplog.records) == 1
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_agg.py b/venv/Lib/site-packages/matplotlib/tests/test_agg.py
new file mode 100644
index 0000000..4d34ef3
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_agg.py
@@ -0,0 +1,246 @@
+import io
+
+import numpy as np
+from numpy.testing import assert_array_almost_equal
+from PIL import Image, TiffTags
+import pytest
+
+
+from matplotlib import (
+ collections, path, pyplot as plt, transforms as mtransforms, rcParams)
+from matplotlib.image import imread
+from matplotlib.figure import Figure
+from matplotlib.testing.decorators import image_comparison
+
+
+def test_repeated_save_with_alpha():
+ # We want an image which has a background color of bluish green, with an
+ # alpha of 0.25.
+
+ fig = Figure([1, 0.4])
+ fig.set_facecolor((0, 1, 0.4))
+ fig.patch.set_alpha(0.25)
+
+ # The target color is fig.patch.get_facecolor()
+
+ buf = io.BytesIO()
+
+ fig.savefig(buf,
+ facecolor=fig.get_facecolor(),
+ edgecolor='none')
+
+ # Save the figure again to check that the
+ # colors don't bleed from the previous renderer.
+ buf.seek(0)
+ fig.savefig(buf,
+ facecolor=fig.get_facecolor(),
+ edgecolor='none')
+
+ # Check the first pixel has the desired color & alpha
+ # (approx: 0, 1.0, 0.4, 0.25)
+ buf.seek(0)
+ assert_array_almost_equal(tuple(imread(buf)[0, 0]),
+ (0.0, 1.0, 0.4, 0.250),
+ decimal=3)
+
+
+def test_large_single_path_collection():
+ buff = io.BytesIO()
+
+ # Generates a too-large single path in a path collection that
+ # would cause a segfault if the draw_markers optimization is
+ # applied.
+ f, ax = plt.subplots()
+ collection = collections.PathCollection(
+ [path.Path([[-10, 5], [10, 5], [10, -5], [-10, -5], [-10, 5]])])
+ ax.add_artist(collection)
+ ax.set_xlim(10**-3, 1)
+ plt.savefig(buff)
+
+
+def test_marker_with_nan():
+ # This creates a marker with nans in it, which was segfaulting the
+ # Agg backend (see #3722)
+ fig, ax = plt.subplots(1)
+ steps = 1000
+ data = np.arange(steps)
+ ax.semilogx(data)
+ ax.fill_between(data, data*0.8, data*1.2)
+ buf = io.BytesIO()
+ fig.savefig(buf, format='png')
+
+
+def test_long_path():
+ buff = io.BytesIO()
+
+ fig, ax = plt.subplots()
+ np.random.seed(0)
+ points = np.random.rand(70000)
+ ax.plot(points)
+ fig.savefig(buff, format='png')
+
+
+@image_comparison(['agg_filter.png'], remove_text=True)
+def test_agg_filter():
+ def smooth1d(x, window_len):
+ # copied from http://www.scipy.org/Cookbook/SignalSmooth
+ s = np.r_[
+ 2*x[0] - x[window_len:1:-1], x, 2*x[-1] - x[-1:-window_len:-1]]
+ w = np.hanning(window_len)
+ y = np.convolve(w/w.sum(), s, mode='same')
+ return y[window_len-1:-window_len+1]
+
+ def smooth2d(A, sigma=3):
+ window_len = max(int(sigma), 3) * 2 + 1
+ A = np.apply_along_axis(smooth1d, 0, A, window_len)
+ A = np.apply_along_axis(smooth1d, 1, A, window_len)
+ return A
+
+ class BaseFilter:
+
+ def get_pad(self, dpi):
+ return 0
+
+ def process_image(self, padded_src, dpi):
+ raise NotImplementedError("Should be overridden by subclasses")
+
+ def __call__(self, im, dpi):
+ pad = self.get_pad(dpi)
+ padded_src = np.pad(im, [(pad, pad), (pad, pad), (0, 0)],
+ "constant")
+ tgt_image = self.process_image(padded_src, dpi)
+ return tgt_image, -pad, -pad
+
+ class OffsetFilter(BaseFilter):
+
+ def __init__(self, offsets=(0, 0)):
+ self.offsets = offsets
+
+ def get_pad(self, dpi):
+ return int(max(self.offsets) / 72 * dpi)
+
+ def process_image(self, padded_src, dpi):
+ ox, oy = self.offsets
+ a1 = np.roll(padded_src, int(ox / 72 * dpi), axis=1)
+ a2 = np.roll(a1, -int(oy / 72 * dpi), axis=0)
+ return a2
+
+ class GaussianFilter(BaseFilter):
+ """Simple Gaussian filter."""
+
+ def __init__(self, sigma, alpha=0.5, color=(0, 0, 0)):
+ self.sigma = sigma
+ self.alpha = alpha
+ self.color = color
+
+ def get_pad(self, dpi):
+ return int(self.sigma*3 / 72 * dpi)
+
+ def process_image(self, padded_src, dpi):
+ tgt_image = np.empty_like(padded_src)
+ tgt_image[:, :, :3] = self.color
+ tgt_image[:, :, 3] = smooth2d(padded_src[:, :, 3] * self.alpha,
+ self.sigma / 72 * dpi)
+ return tgt_image
+
+ class DropShadowFilter(BaseFilter):
+
+ def __init__(self, sigma, alpha=0.3, color=(0, 0, 0), offsets=(0, 0)):
+ self.gauss_filter = GaussianFilter(sigma, alpha, color)
+ self.offset_filter = OffsetFilter(offsets)
+
+ def get_pad(self, dpi):
+ return max(self.gauss_filter.get_pad(dpi),
+ self.offset_filter.get_pad(dpi))
+
+ def process_image(self, padded_src, dpi):
+ t1 = self.gauss_filter.process_image(padded_src, dpi)
+ t2 = self.offset_filter.process_image(t1, dpi)
+ return t2
+
+ fig, ax = plt.subplots()
+
+ # draw lines
+ line1, = ax.plot([0.1, 0.5, 0.9], [0.1, 0.9, 0.5], "bo-",
+ mec="b", mfc="w", lw=5, mew=3, ms=10, label="Line 1")
+ line2, = ax.plot([0.1, 0.5, 0.9], [0.5, 0.2, 0.7], "ro-",
+ mec="r", mfc="w", lw=5, mew=3, ms=10, label="Line 1")
+
+ gauss = DropShadowFilter(4)
+
+ for line in [line1, line2]:
+
+ # draw shadows with same lines with slight offset.
+ xx = line.get_xdata()
+ yy = line.get_ydata()
+ shadow, = ax.plot(xx, yy)
+ shadow.update_from(line)
+
+ # offset transform
+ ot = mtransforms.offset_copy(line.get_transform(), ax.figure,
+ x=4.0, y=-6.0, units='points')
+
+ shadow.set_transform(ot)
+
+ # adjust zorder of the shadow lines so that it is drawn below the
+ # original lines
+ shadow.set_zorder(line.get_zorder() - 0.5)
+ shadow.set_agg_filter(gauss)
+ shadow.set_rasterized(True) # to support mixed-mode renderers
+
+ ax.set_xlim(0., 1.)
+ ax.set_ylim(0., 1.)
+
+ ax.xaxis.set_visible(False)
+ ax.yaxis.set_visible(False)
+
+
+def test_too_large_image():
+ fig = plt.figure(figsize=(300, 1000))
+ buff = io.BytesIO()
+ with pytest.raises(ValueError):
+ fig.savefig(buff)
+
+
+def test_chunksize():
+ x = range(200)
+
+ # Test without chunksize
+ fig, ax = plt.subplots()
+ ax.plot(x, np.sin(x))
+ fig.canvas.draw()
+
+ # Test with chunksize
+ fig, ax = plt.subplots()
+ rcParams['agg.path.chunksize'] = 105
+ ax.plot(x, np.sin(x))
+ fig.canvas.draw()
+
+
+@pytest.mark.backend('Agg')
+def test_jpeg_dpi():
+ # Check that dpi is set correctly in jpg files.
+ plt.plot([0, 1, 2], [0, 1, 0])
+ buf = io.BytesIO()
+ plt.savefig(buf, format="jpg", dpi=200)
+ im = Image.open(buf)
+ assert im.info['dpi'] == (200, 200)
+
+
+def test_pil_kwargs_png():
+ from PIL.PngImagePlugin import PngInfo
+ buf = io.BytesIO()
+ pnginfo = PngInfo()
+ pnginfo.add_text("Software", "test")
+ plt.figure().savefig(buf, format="png", pil_kwargs={"pnginfo": pnginfo})
+ im = Image.open(buf)
+ assert im.info["Software"] == "test"
+
+
+def test_pil_kwargs_tiff():
+ buf = io.BytesIO()
+ pil_kwargs = {"description": "test image"}
+ plt.figure().savefig(buf, format="tiff", pil_kwargs=pil_kwargs)
+ im = Image.open(buf)
+ tags = {TiffTags.TAGS_V2[k].name: v for k, v in im.tag_v2.items()}
+ assert tags["ImageDescription"] == "test image"
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_agg_filter.py b/venv/Lib/site-packages/matplotlib/tests/test_agg_filter.py
new file mode 100644
index 0000000..fd54a6b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_agg_filter.py
@@ -0,0 +1,33 @@
+import numpy as np
+
+import matplotlib.pyplot as plt
+from matplotlib.testing.decorators import image_comparison
+
+
+@image_comparison(baseline_images=['agg_filter_alpha'],
+ extensions=['png', 'pdf'])
+def test_agg_filter_alpha():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ ax = plt.axes()
+ x, y = np.mgrid[0:7, 0:8]
+ data = x**2 - y**2
+ mesh = ax.pcolormesh(data, cmap='Reds', zorder=5)
+
+ def manual_alpha(im, dpi):
+ im[:, :, 3] *= 0.6
+ print('CALLED')
+ return im, 0, 0
+
+ # Note: Doing alpha like this is not the same as setting alpha on
+ # the mesh itself. Currently meshes are drawn as independent patches,
+ # and we see fine borders around the blocks of color. See the SO
+ # question for an example: https://stackoverflow.com/questions/20678817
+ mesh.set_agg_filter(manual_alpha)
+
+ # Currently we must enable rasterization for this to have an effect in
+ # the PDF backend.
+ mesh.set_rasterized(True)
+
+ ax.plot([0, 4, 7], [1, 3, 8])
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_animation.py b/venv/Lib/site-packages/matplotlib/tests/test_animation.py
new file mode 100644
index 0000000..7ae77cb
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_animation.py
@@ -0,0 +1,361 @@
+import gc
+import os
+from pathlib import Path
+import subprocess
+import sys
+import weakref
+
+import numpy as np
+import pytest
+
+import matplotlib as mpl
+from matplotlib import pyplot as plt
+from matplotlib import animation
+
+
+@pytest.fixture()
+def anim(request):
+ """Create a simple animation (with options)."""
+ fig, ax = plt.subplots()
+ line, = ax.plot([], [])
+
+ ax.set_xlim(0, 10)
+ ax.set_ylim(-1, 1)
+
+ def init():
+ line.set_data([], [])
+ return line,
+
+ def animate(i):
+ x = np.linspace(0, 10, 100)
+ y = np.sin(x + i)
+ line.set_data(x, y)
+ return line,
+
+ # "klass" can be passed to determine the class returned by the fixture
+ kwargs = dict(getattr(request, 'param', {})) # make a copy
+ klass = kwargs.pop('klass', animation.FuncAnimation)
+ if 'frames' not in kwargs:
+ kwargs['frames'] = 5
+ return klass(fig=fig, func=animate, init_func=init, **kwargs)
+
+
+class NullMovieWriter(animation.AbstractMovieWriter):
+ """
+ A minimal MovieWriter. It doesn't actually write anything.
+ It just saves the arguments that were given to the setup() and
+ grab_frame() methods as attributes, and counts how many times
+ grab_frame() is called.
+
+ This class doesn't have an __init__ method with the appropriate
+ signature, and it doesn't define an isAvailable() method, so
+ it cannot be added to the 'writers' registry.
+ """
+
+ def setup(self, fig, outfile, dpi, *args):
+ self.fig = fig
+ self.outfile = outfile
+ self.dpi = dpi
+ self.args = args
+ self._count = 0
+
+ def grab_frame(self, **savefig_kwargs):
+ self.savefig_kwargs = savefig_kwargs
+ self._count += 1
+
+ def finish(self):
+ pass
+
+
+def test_null_movie_writer(anim):
+ # Test running an animation with NullMovieWriter.
+ filename = "unused.null"
+ dpi = 50
+ savefig_kwargs = dict(foo=0)
+ writer = NullMovieWriter()
+
+ anim.save(filename, dpi=dpi, writer=writer,
+ savefig_kwargs=savefig_kwargs)
+
+ assert writer.fig == plt.figure(1) # The figure used by anim fixture
+ assert writer.outfile == filename
+ assert writer.dpi == dpi
+ assert writer.args == ()
+ assert writer.savefig_kwargs == savefig_kwargs
+ assert writer._count == anim.save_count
+
+
+@pytest.mark.parametrize('anim', [dict(klass=dict)], indirect=['anim'])
+def test_animation_delete(anim):
+ anim = animation.FuncAnimation(**anim)
+ with pytest.warns(Warning, match='Animation was deleted'):
+ del anim
+ gc.collect()
+
+
+def test_movie_writer_dpi_default():
+ class DummyMovieWriter(animation.MovieWriter):
+ def _run(self):
+ pass
+
+ # Test setting up movie writer with figure.dpi default.
+ fig = plt.figure()
+
+ filename = "unused.null"
+ fps = 5
+ codec = "unused"
+ bitrate = 1
+ extra_args = ["unused"]
+
+ writer = DummyMovieWriter(fps, codec, bitrate, extra_args)
+ writer.setup(fig, filename)
+ assert writer.dpi == fig.dpi
+
+
+@animation.writers.register('null')
+class RegisteredNullMovieWriter(NullMovieWriter):
+
+ # To be able to add NullMovieWriter to the 'writers' registry,
+ # we must define an __init__ method with a specific signature,
+ # and we must define the class method isAvailable().
+ # (These methods are not actually required to use an instance
+ # of this class as the 'writer' argument of Animation.save().)
+
+ def __init__(self, fps=None, codec=None, bitrate=None,
+ extra_args=None, metadata=None):
+ pass
+
+ @classmethod
+ def isAvailable(cls):
+ return True
+
+
+WRITER_OUTPUT = [
+ ('ffmpeg', 'movie.mp4'),
+ ('ffmpeg_file', 'movie.mp4'),
+ ('avconv', 'movie.mp4'),
+ ('avconv_file', 'movie.mp4'),
+ ('imagemagick', 'movie.gif'),
+ ('imagemagick_file', 'movie.gif'),
+ ('pillow', 'movie.gif'),
+ ('html', 'movie.html'),
+ ('null', 'movie.null')
+]
+
+
+def gen_writers():
+ for writer, output in WRITER_OUTPUT:
+ if not animation.writers.is_available(writer):
+ mark = pytest.mark.skip(
+ f"writer '{writer}' not available on this system")
+ yield pytest.param(writer, None, output, marks=[mark])
+ yield pytest.param(writer, None, Path(output), marks=[mark])
+ continue
+
+ writer_class = animation.writers[writer]
+ for frame_format in getattr(writer_class, 'supported_formats', [None]):
+ yield writer, frame_format, output
+ yield writer, frame_format, Path(output)
+
+
+# Smoke test for saving animations. In the future, we should probably
+# design more sophisticated tests which compare resulting frames a-la
+# matplotlib.testing.image_comparison
+@pytest.mark.parametrize('writer, frame_format, output', gen_writers())
+@pytest.mark.parametrize('anim', [dict(klass=dict)], indirect=['anim'])
+def test_save_animation_smoketest(tmpdir, writer, frame_format, output, anim):
+ if frame_format is not None:
+ plt.rcParams["animation.frame_format"] = frame_format
+ anim = animation.FuncAnimation(**anim)
+ dpi = None
+ codec = None
+ if writer == 'ffmpeg':
+ # Issue #8253
+ anim._fig.set_size_inches((10.85, 9.21))
+ dpi = 100.
+ codec = 'h264'
+
+ # Use temporary directory for the file-based writers, which produce a file
+ # per frame with known names.
+ with tmpdir.as_cwd():
+ anim.save(output, fps=30, writer=writer, bitrate=500, dpi=dpi,
+ codec=codec)
+ with pytest.warns(None):
+ del anim
+
+
+@pytest.mark.parametrize('writer', [
+ pytest.param(
+ 'ffmpeg', marks=pytest.mark.skipif(
+ not animation.FFMpegWriter.isAvailable(),
+ reason='Requires FFMpeg')),
+ pytest.param(
+ 'imagemagick', marks=pytest.mark.skipif(
+ not animation.ImageMagickWriter.isAvailable(),
+ reason='Requires ImageMagick')),
+])
+@pytest.mark.parametrize('html, want', [
+ ('none', None),
+ ('html5', ' 0
+ mpl.rcParams['animation.ffmpeg_path'] = "not_available_ever_xxxx"
+ assert not animation.writers.is_available("ffmpeg")
+ # something guaranteed to be available in path and exits immediately
+ bin = "true" if sys.platform != 'win32' else "where"
+ mpl.rcParams['animation.ffmpeg_path'] = bin
+ assert animation.writers.is_available("ffmpeg")
+
+
+@pytest.mark.parametrize(
+ "method_name",
+ [pytest.param("to_html5_video", marks=pytest.mark.skipif(
+ not animation.writers.is_available(mpl.rcParams["animation.writer"]),
+ reason="animation writer not installed")),
+ "to_jshtml"])
+@pytest.mark.parametrize('anim', [dict(frames=1)], indirect=['anim'])
+def test_embed_limit(method_name, caplog, tmpdir, anim):
+ caplog.set_level("WARNING")
+ with tmpdir.as_cwd():
+ with mpl.rc_context({"animation.embed_limit": 1e-6}): # ~1 byte.
+ getattr(anim, method_name)()
+ assert len(caplog.records) == 1
+ record, = caplog.records
+ assert (record.name == "matplotlib.animation"
+ and record.levelname == "WARNING")
+
+
+@pytest.mark.parametrize(
+ "method_name",
+ [pytest.param("to_html5_video", marks=pytest.mark.skipif(
+ not animation.writers.is_available(mpl.rcParams["animation.writer"]),
+ reason="animation writer not installed")),
+ "to_jshtml"])
+@pytest.mark.parametrize('anim', [dict(frames=1)], indirect=['anim'])
+def test_cleanup_temporaries(method_name, tmpdir, anim):
+ with tmpdir.as_cwd():
+ getattr(anim, method_name)()
+ assert list(Path(str(tmpdir)).iterdir()) == []
+
+
+@pytest.mark.skipif(os.name != "posix", reason="requires a POSIX OS")
+def test_failing_ffmpeg(tmpdir, monkeypatch, anim):
+ """
+ Test that we correctly raise a CalledProcessError when ffmpeg fails.
+
+ To do so, mock ffmpeg using a simple executable shell script that
+ succeeds when called with no arguments (so that it gets registered by
+ `isAvailable`), but fails otherwise, and add it to the $PATH.
+ """
+ with tmpdir.as_cwd():
+ monkeypatch.setenv("PATH", ".:" + os.environ["PATH"])
+ exe_path = Path(str(tmpdir), "ffmpeg")
+ exe_path.write_text("#!/bin/sh\n"
+ "[[ $@ -eq 0 ]]\n")
+ os.chmod(str(exe_path), 0o755)
+ with pytest.raises(subprocess.CalledProcessError):
+ anim.save("test.mpeg")
+
+
+@pytest.mark.parametrize("cache_frame_data", [False, True])
+def test_funcanimation_cache_frame_data(cache_frame_data):
+ fig, ax = plt.subplots()
+ line, = ax.plot([], [])
+
+ class Frame(dict):
+ # this subclassing enables to use weakref.ref()
+ pass
+
+ def init():
+ line.set_data([], [])
+ return line,
+
+ def animate(frame):
+ line.set_data(frame['x'], frame['y'])
+ return line,
+
+ frames_generated = []
+
+ def frames_generator():
+ for _ in range(5):
+ x = np.linspace(0, 10, 100)
+ y = np.random.rand(100)
+
+ frame = Frame(x=x, y=y)
+
+ # collect weak references to frames
+ # to validate their references later
+ frames_generated.append(weakref.ref(frame))
+
+ yield frame
+
+ anim = animation.FuncAnimation(fig, animate, init_func=init,
+ frames=frames_generator,
+ cache_frame_data=cache_frame_data)
+
+ writer = NullMovieWriter()
+ anim.save('unused.null', writer=writer)
+ assert len(frames_generated) == 5
+ for f in frames_generated:
+ # If cache_frame_data is True, then the weakref should be alive;
+ # if cache_frame_data is False, then the weakref should be dead (None).
+ assert (f() is None) != cache_frame_data
+
+
+@pytest.mark.parametrize('return_value', [
+ # User forgot to return (returns None).
+ None,
+ # User returned a string.
+ 'string',
+ # User returned an int.
+ 1,
+ # User returns a sequence of other objects, e.g., string instead of Artist.
+ ('string', ),
+ # User forgot to return a sequence (handled in `animate` below.)
+ 'artist',
+])
+def test_draw_frame(return_value):
+ # test _draw_frame method
+
+ fig, ax = plt.subplots()
+ line, = ax.plot([])
+
+ def animate(i):
+ # general update func
+ line.set_data([0, 1], [0, i])
+ if return_value == 'artist':
+ # *not* a sequence
+ return line
+ else:
+ return return_value
+
+ with pytest.raises(RuntimeError):
+ animation.FuncAnimation(fig, animate, blit=True)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_api.py b/venv/Lib/site-packages/matplotlib/tests/test_api.py
new file mode 100644
index 0000000..29ca4ca
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_api.py
@@ -0,0 +1,69 @@
+import re
+
+import numpy as np
+import pytest
+
+from matplotlib import _api
+
+
+@pytest.mark.parametrize('target,test_shape',
+ [((None, ), (1, 3)),
+ ((None, 3), (1,)),
+ ((None, 3), (1, 2)),
+ ((1, 5), (1, 9)),
+ ((None, 2, None), (1, 3, 1))
+ ])
+def test_check_shape(target, test_shape):
+ error_pattern = (f"^'aardvark' must be {len(target)}D.*" +
+ re.escape(f'has shape {test_shape}'))
+ data = np.zeros(test_shape)
+ with pytest.raises(ValueError, match=error_pattern):
+ _api.check_shape(target, aardvark=data)
+
+
+def test_classproperty_deprecation():
+ class A:
+ @_api.deprecated("0.0.0")
+ @_api.classproperty
+ def f(cls):
+ pass
+ with pytest.warns(_api.MatplotlibDeprecationWarning):
+ A.f
+ with pytest.warns(_api.MatplotlibDeprecationWarning):
+ a = A()
+ a.f
+
+
+def test_delete_parameter():
+ @_api.delete_parameter("3.0", "foo")
+ def func1(foo=None):
+ pass
+
+ @_api.delete_parameter("3.0", "foo")
+ def func2(**kwargs):
+ pass
+
+ for func in [func1, func2]:
+ func() # No warning.
+ with pytest.warns(_api.MatplotlibDeprecationWarning):
+ func(foo="bar")
+
+ def pyplot_wrapper(foo=_api.deprecation._deprecated_parameter):
+ func1(foo)
+
+ pyplot_wrapper() # No warning.
+ with pytest.warns(_api.MatplotlibDeprecationWarning):
+ func(foo="bar")
+
+
+def test_make_keyword_only():
+ @_api.make_keyword_only("3.0", "arg")
+ def func(pre, arg, post=None):
+ pass
+
+ func(1, arg=2) # Check that no warning is emitted.
+
+ with pytest.warns(_api.MatplotlibDeprecationWarning):
+ func(1, 2)
+ with pytest.warns(_api.MatplotlibDeprecationWarning):
+ func(1, 2, 3)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_arrow_patches.py b/venv/Lib/site-packages/matplotlib/tests/test_arrow_patches.py
new file mode 100644
index 0000000..3c95535
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_arrow_patches.py
@@ -0,0 +1,176 @@
+import pytest
+import platform
+import matplotlib.pyplot as plt
+from matplotlib.testing.decorators import image_comparison
+import matplotlib.patches as mpatches
+
+
+def draw_arrow(ax, t, r):
+ ax.annotate('', xy=(0.5, 0.5 + r), xytext=(0.5, 0.5), size=30,
+ arrowprops=dict(arrowstyle=t,
+ fc="b", ec='k'))
+
+
+@image_comparison(['fancyarrow_test_image'])
+def test_fancyarrow():
+ # Added 0 to test division by zero error described in issue 3930
+ r = [0.4, 0.3, 0.2, 0.1, 0]
+ t = ["fancy", "simple", mpatches.ArrowStyle.Fancy()]
+
+ fig, axs = plt.subplots(len(t), len(r), squeeze=False,
+ figsize=(8, 4.5), subplot_kw=dict(aspect=1))
+
+ for i_r, r1 in enumerate(r):
+ for i_t, t1 in enumerate(t):
+ ax = axs[i_t, i_r]
+ draw_arrow(ax, t1, r1)
+ ax.tick_params(labelleft=False, labelbottom=False)
+
+
+@image_comparison(['boxarrow_test_image.png'])
+def test_boxarrow():
+
+ styles = mpatches.BoxStyle.get_styles()
+
+ n = len(styles)
+ spacing = 1.2
+
+ figheight = (n * spacing + .5)
+ fig = plt.figure(figsize=(4 / 1.5, figheight / 1.5))
+
+ fontsize = 0.3 * 72
+
+ for i, stylename in enumerate(sorted(styles)):
+ fig.text(0.5, ((n - i) * spacing - 0.5)/figheight, stylename,
+ ha="center",
+ size=fontsize,
+ transform=fig.transFigure,
+ bbox=dict(boxstyle=stylename, fc="w", ec="k"))
+
+
+def __prepare_fancyarrow_dpi_cor_test():
+ """
+ Convenience function that prepares and returns a FancyArrowPatch. It aims
+ at being used to test that the size of the arrow head does not depend on
+ the DPI value of the exported picture.
+
+ NB: this function *is not* a test in itself!
+ """
+ fig2 = plt.figure("fancyarrow_dpi_cor_test", figsize=(4, 3), dpi=50)
+ ax = fig2.add_subplot()
+ ax.set_xlim([0, 1])
+ ax.set_ylim([0, 1])
+ ax.add_patch(mpatches.FancyArrowPatch(posA=(0.3, 0.4), posB=(0.8, 0.6),
+ lw=3, arrowstyle='->',
+ mutation_scale=100))
+ return fig2
+
+
+@image_comparison(['fancyarrow_dpi_cor_100dpi.png'], remove_text=True,
+ tol=0 if platform.machine() == 'x86_64' else 0.02,
+ savefig_kwarg=dict(dpi=100))
+def test_fancyarrow_dpi_cor_100dpi():
+ """
+ Check the export of a FancyArrowPatch @ 100 DPI. FancyArrowPatch is
+ instantiated through a dedicated function because another similar test
+ checks a similar export but with a different DPI value.
+
+ Remark: test only a rasterized format.
+ """
+
+ __prepare_fancyarrow_dpi_cor_test()
+
+
+@image_comparison(['fancyarrow_dpi_cor_200dpi.png'], remove_text=True,
+ tol=0 if platform.machine() == 'x86_64' else 0.02,
+ savefig_kwarg=dict(dpi=200))
+def test_fancyarrow_dpi_cor_200dpi():
+ """
+ As test_fancyarrow_dpi_cor_100dpi, but exports @ 200 DPI. The relative size
+ of the arrow head should be the same.
+ """
+
+ __prepare_fancyarrow_dpi_cor_test()
+
+
+@image_comparison(['fancyarrow_dash.png'], remove_text=True, style='default')
+def test_fancyarrow_dash():
+ fig, ax = plt.subplots()
+ e = mpatches.FancyArrowPatch((0, 0), (0.5, 0.5),
+ arrowstyle='-|>',
+ connectionstyle='angle3,angleA=0,angleB=90',
+ mutation_scale=10.0,
+ linewidth=2,
+ linestyle='dashed',
+ color='k')
+ e2 = mpatches.FancyArrowPatch((0, 0), (0.5, 0.5),
+ arrowstyle='-|>',
+ connectionstyle='angle3',
+ mutation_scale=10.0,
+ linewidth=2,
+ linestyle='dotted',
+ color='k')
+ ax.add_patch(e)
+ ax.add_patch(e2)
+
+
+@image_comparison(['arrow_styles.png'], style='mpl20', remove_text=True,
+ tol=0 if platform.machine() == 'x86_64' else 0.005)
+def test_arrow_styles():
+ styles = mpatches.ArrowStyle.get_styles()
+
+ n = len(styles)
+ fig, ax = plt.subplots(figsize=(8, 8))
+ ax.set_xlim(0, 1)
+ ax.set_ylim(-1, n)
+ fig.subplots_adjust(left=0, right=1, bottom=0, top=1)
+
+ for i, stylename in enumerate(sorted(styles)):
+ patch = mpatches.FancyArrowPatch((0.1, i), (0.45, i),
+ arrowstyle=stylename,
+ mutation_scale=25)
+ ax.add_patch(patch)
+
+ for i, stylename in enumerate([']-[', ']-', '-[', '|-|']):
+ style = stylename
+ if stylename[0] != '-':
+ style += ',angleA=ANGLE'
+ if stylename[-1] != '-':
+ style += ',angleB=ANGLE'
+
+ for j, angle in enumerate([-30, 60]):
+ arrowstyle = style.replace('ANGLE', str(angle))
+ patch = mpatches.FancyArrowPatch((0.55, 2*i + j), (0.9, 2*i + j),
+ arrowstyle=arrowstyle,
+ mutation_scale=25)
+ ax.add_patch(patch)
+
+
+@image_comparison(['connection_styles.png'], style='mpl20', remove_text=True)
+def test_connection_styles():
+ styles = mpatches.ConnectionStyle.get_styles()
+
+ n = len(styles)
+ fig, ax = plt.subplots(figsize=(6, 10))
+ ax.set_xlim(0, 1)
+ ax.set_ylim(-1, n)
+
+ for i, stylename in enumerate(sorted(styles)):
+ patch = mpatches.FancyArrowPatch((0.1, i), (0.8, i + 0.5),
+ arrowstyle="->",
+ connectionstyle=stylename,
+ mutation_scale=25)
+ ax.add_patch(patch)
+
+
+def test_invalid_intersection():
+ conn_style_1 = mpatches.ConnectionStyle.Angle3(angleA=20, angleB=200)
+ p1 = mpatches.FancyArrowPatch((.2, .2), (.5, .5),
+ connectionstyle=conn_style_1)
+ with pytest.raises(ValueError):
+ plt.gca().add_patch(p1)
+
+ conn_style_2 = mpatches.ConnectionStyle.Angle3(angleA=20, angleB=199.9)
+ p2 = mpatches.FancyArrowPatch((.2, .2), (.5, .5),
+ connectionstyle=conn_style_2)
+ plt.gca().add_patch(p2)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_artist.py b/venv/Lib/site-packages/matplotlib/tests/test_artist.py
new file mode 100644
index 0000000..c7936be
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_artist.py
@@ -0,0 +1,342 @@
+import io
+from itertools import chain
+
+import numpy as np
+
+import pytest
+
+import matplotlib.pyplot as plt
+import matplotlib.patches as mpatches
+import matplotlib.lines as mlines
+import matplotlib.path as mpath
+import matplotlib.transforms as mtransforms
+import matplotlib.collections as mcollections
+import matplotlib.artist as martist
+from matplotlib.testing.decorators import check_figures_equal, image_comparison
+
+
+def test_patch_transform_of_none():
+ # tests the behaviour of patches added to an Axes with various transform
+ # specifications
+
+ ax = plt.axes()
+ ax.set_xlim([1, 3])
+ ax.set_ylim([1, 3])
+
+ # Draw an ellipse over data coord (2, 2) by specifying device coords.
+ xy_data = (2, 2)
+ xy_pix = ax.transData.transform(xy_data)
+
+ # Not providing a transform of None puts the ellipse in data coordinates .
+ e = mpatches.Ellipse(xy_data, width=1, height=1, fc='yellow', alpha=0.5)
+ ax.add_patch(e)
+ assert e._transform == ax.transData
+
+ # Providing a transform of None puts the ellipse in device coordinates.
+ e = mpatches.Ellipse(xy_pix, width=120, height=120, fc='coral',
+ transform=None, alpha=0.5)
+ assert e.is_transform_set()
+ ax.add_patch(e)
+ assert isinstance(e._transform, mtransforms.IdentityTransform)
+
+ # Providing an IdentityTransform puts the ellipse in device coordinates.
+ e = mpatches.Ellipse(xy_pix, width=100, height=100,
+ transform=mtransforms.IdentityTransform(), alpha=0.5)
+ ax.add_patch(e)
+ assert isinstance(e._transform, mtransforms.IdentityTransform)
+
+ # Not providing a transform, and then subsequently "get_transform" should
+ # not mean that "is_transform_set".
+ e = mpatches.Ellipse(xy_pix, width=120, height=120, fc='coral',
+ alpha=0.5)
+ intermediate_transform = e.get_transform()
+ assert not e.is_transform_set()
+ ax.add_patch(e)
+ assert e.get_transform() != intermediate_transform
+ assert e.is_transform_set()
+ assert e._transform == ax.transData
+
+
+def test_collection_transform_of_none():
+ # tests the behaviour of collections added to an Axes with various
+ # transform specifications
+
+ ax = plt.axes()
+ ax.set_xlim([1, 3])
+ ax.set_ylim([1, 3])
+
+ # draw an ellipse over data coord (2, 2) by specifying device coords
+ xy_data = (2, 2)
+ xy_pix = ax.transData.transform(xy_data)
+
+ # not providing a transform of None puts the ellipse in data coordinates
+ e = mpatches.Ellipse(xy_data, width=1, height=1)
+ c = mcollections.PatchCollection([e], facecolor='yellow', alpha=0.5)
+ ax.add_collection(c)
+ # the collection should be in data coordinates
+ assert c.get_offset_transform() + c.get_transform() == ax.transData
+
+ # providing a transform of None puts the ellipse in device coordinates
+ e = mpatches.Ellipse(xy_pix, width=120, height=120)
+ c = mcollections.PatchCollection([e], facecolor='coral',
+ alpha=0.5)
+ c.set_transform(None)
+ ax.add_collection(c)
+ assert isinstance(c.get_transform(), mtransforms.IdentityTransform)
+
+ # providing an IdentityTransform puts the ellipse in device coordinates
+ e = mpatches.Ellipse(xy_pix, width=100, height=100)
+ c = mcollections.PatchCollection([e],
+ transform=mtransforms.IdentityTransform(),
+ alpha=0.5)
+ ax.add_collection(c)
+ assert isinstance(c._transOffset, mtransforms.IdentityTransform)
+
+
+@image_comparison(["clip_path_clipping"], remove_text=True)
+def test_clipping():
+ exterior = mpath.Path.unit_rectangle().deepcopy()
+ exterior.vertices *= 4
+ exterior.vertices -= 2
+ interior = mpath.Path.unit_circle().deepcopy()
+ interior.vertices = interior.vertices[::-1]
+ clip_path = mpath.Path.make_compound_path(exterior, interior)
+
+ star = mpath.Path.unit_regular_star(6).deepcopy()
+ star.vertices *= 2.6
+
+ fig, (ax1, ax2) = plt.subplots(1, 2, sharex=True, sharey=True)
+
+ col = mcollections.PathCollection([star], lw=5, edgecolor='blue',
+ facecolor='red', alpha=0.7, hatch='*')
+ col.set_clip_path(clip_path, ax1.transData)
+ ax1.add_collection(col)
+
+ patch = mpatches.PathPatch(star, lw=5, edgecolor='blue', facecolor='red',
+ alpha=0.7, hatch='*')
+ patch.set_clip_path(clip_path, ax2.transData)
+ ax2.add_patch(patch)
+
+ ax1.set_xlim([-3, 3])
+ ax1.set_ylim([-3, 3])
+
+
+@check_figures_equal(extensions=['png'])
+def test_clipping_zoom(fig_test, fig_ref):
+ # This test places the Axes and sets its limits such that the clip path is
+ # outside the figure entirely. This should not break the clip path.
+ ax_test = fig_test.add_axes([0, 0, 1, 1])
+ l, = ax_test.plot([-3, 3], [-3, 3])
+ # Explicit Path instead of a Rectangle uses clip path processing, instead
+ # of a clip box optimization.
+ p = mpath.Path([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]])
+ p = mpatches.PathPatch(p, transform=ax_test.transData)
+ l.set_clip_path(p)
+
+ ax_ref = fig_ref.add_axes([0, 0, 1, 1])
+ ax_ref.plot([-3, 3], [-3, 3])
+
+ ax_ref.set(xlim=(0.5, 0.75), ylim=(0.5, 0.75))
+ ax_test.set(xlim=(0.5, 0.75), ylim=(0.5, 0.75))
+
+
+def test_cull_markers():
+ x = np.random.random(20000)
+ y = np.random.random(20000)
+
+ fig, ax = plt.subplots()
+ ax.plot(x, y, 'k.')
+ ax.set_xlim(2, 3)
+
+ pdf = io.BytesIO()
+ fig.savefig(pdf, format="pdf")
+ assert len(pdf.getvalue()) < 8000
+
+ svg = io.BytesIO()
+ fig.savefig(svg, format="svg")
+ assert len(svg.getvalue()) < 20000
+
+
+@image_comparison(['hatching'], remove_text=True, style='default')
+def test_hatching():
+ fig, ax = plt.subplots(1, 1)
+
+ # Default hatch color.
+ rect1 = mpatches.Rectangle((0, 0), 3, 4, hatch='/')
+ ax.add_patch(rect1)
+
+ rect2 = mcollections.RegularPolyCollection(4, sizes=[16000],
+ offsets=[(1.5, 6.5)],
+ transOffset=ax.transData,
+ hatch='/')
+ ax.add_collection(rect2)
+
+ # Ensure edge color is not applied to hatching.
+ rect3 = mpatches.Rectangle((4, 0), 3, 4, hatch='/', edgecolor='C1')
+ ax.add_patch(rect3)
+
+ rect4 = mcollections.RegularPolyCollection(4, sizes=[16000],
+ offsets=[(5.5, 6.5)],
+ transOffset=ax.transData,
+ hatch='/', edgecolor='C1')
+ ax.add_collection(rect4)
+
+ ax.set_xlim(0, 7)
+ ax.set_ylim(0, 9)
+
+
+def test_remove():
+ fig, ax = plt.subplots()
+ im = ax.imshow(np.arange(36).reshape(6, 6))
+ ln, = ax.plot(range(5))
+
+ assert fig.stale
+ assert ax.stale
+
+ fig.canvas.draw()
+ assert not fig.stale
+ assert not ax.stale
+ assert not ln.stale
+
+ assert im in ax._mouseover_set
+ assert ln not in ax._mouseover_set
+ assert im.axes is ax
+
+ im.remove()
+ ln.remove()
+
+ for art in [im, ln]:
+ assert art.axes is None
+ assert art.figure is None
+
+ assert im not in ax._mouseover_set
+ assert fig.stale
+ assert ax.stale
+
+
+@image_comparison(["default_edges.png"], remove_text=True, style='default')
+def test_default_edges():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['text.kerning_factor'] = 6
+
+ fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2)
+
+ ax1.plot(np.arange(10), np.arange(10), 'x',
+ np.arange(10) + 1, np.arange(10), 'o')
+ ax2.bar(np.arange(10), np.arange(10), align='edge')
+ ax3.text(0, 0, "BOX", size=24, bbox=dict(boxstyle='sawtooth'))
+ ax3.set_xlim((-1, 1))
+ ax3.set_ylim((-1, 1))
+ pp1 = mpatches.PathPatch(
+ mpath.Path([(0, 0), (1, 0), (1, 1), (0, 0)],
+ [mpath.Path.MOVETO, mpath.Path.CURVE3,
+ mpath.Path.CURVE3, mpath.Path.CLOSEPOLY]),
+ fc="none", transform=ax4.transData)
+ ax4.add_patch(pp1)
+
+
+def test_properties():
+ ln = mlines.Line2D([], [])
+ ln.properties() # Check that no warning is emitted.
+
+
+def test_setp():
+ # Check empty list
+ plt.setp([])
+ plt.setp([[]])
+
+ # Check arbitrary iterables
+ fig, ax = plt.subplots()
+ lines1 = ax.plot(range(3))
+ lines2 = ax.plot(range(3))
+ martist.setp(chain(lines1, lines2), 'lw', 5)
+ plt.setp(ax.spines.values(), color='green')
+
+ # Check *file* argument
+ sio = io.StringIO()
+ plt.setp(lines1, 'zorder', file=sio)
+ assert sio.getvalue() == ' zorder: float\n'
+
+
+def test_None_zorder():
+ fig, ax = plt.subplots()
+ ln, = ax.plot(range(5), zorder=None)
+ assert ln.get_zorder() == mlines.Line2D.zorder
+ ln.set_zorder(123456)
+ assert ln.get_zorder() == 123456
+ ln.set_zorder(None)
+ assert ln.get_zorder() == mlines.Line2D.zorder
+
+
+@pytest.mark.parametrize('accept_clause, expected', [
+ ('', 'unknown'),
+ ("ACCEPTS: [ '-' | '--' | '-.' ]", "[ '-' | '--' | '-.' ]"),
+ ('ACCEPTS: Some description.', 'Some description.'),
+ ('.. ACCEPTS: Some description.', 'Some description.'),
+ ('arg : int', 'int'),
+ ('*arg : int', 'int'),
+ ('arg : int\nACCEPTS: Something else.', 'Something else. '),
+])
+def test_artist_inspector_get_valid_values(accept_clause, expected):
+ class TestArtist(martist.Artist):
+ def set_f(self, arg):
+ pass
+
+ TestArtist.set_f.__doc__ = """
+ Some text.
+
+ %s
+ """ % accept_clause
+ valid_values = martist.ArtistInspector(TestArtist).get_valid_values('f')
+ assert valid_values == expected
+
+
+def test_artist_inspector_get_aliases():
+ # test the correct format and type of get_aliases method
+ ai = martist.ArtistInspector(mlines.Line2D)
+ aliases = ai.get_aliases()
+ assert aliases["linewidth"] == {"lw"}
+
+
+def test_set_alpha():
+ art = martist.Artist()
+ with pytest.raises(TypeError, match='^alpha must be numeric or None'):
+ art.set_alpha('string')
+ with pytest.raises(TypeError, match='^alpha must be numeric or None'):
+ art.set_alpha([1, 2, 3])
+ with pytest.raises(ValueError, match="outside 0-1 range"):
+ art.set_alpha(1.1)
+ with pytest.raises(ValueError, match="outside 0-1 range"):
+ art.set_alpha(np.nan)
+
+
+def test_set_alpha_for_array():
+ art = martist.Artist()
+ with pytest.raises(TypeError, match='^alpha must be numeric or None'):
+ art._set_alpha_for_array('string')
+ with pytest.raises(ValueError, match="outside 0-1 range"):
+ art._set_alpha_for_array(1.1)
+ with pytest.raises(ValueError, match="outside 0-1 range"):
+ art._set_alpha_for_array(np.nan)
+ with pytest.raises(ValueError, match="alpha must be between 0 and 1"):
+ art._set_alpha_for_array([0.5, 1.1])
+ with pytest.raises(ValueError, match="alpha must be between 0 and 1"):
+ art._set_alpha_for_array([0.5, np.nan])
+
+
+def test_callbacks():
+ def func(artist):
+ func.counter += 1
+
+ func.counter = 0
+
+ art = martist.Artist()
+ oid = art.add_callback(func)
+ assert func.counter == 0
+ art.pchanged() # must call the callback
+ assert func.counter == 1
+ art.set_zorder(10) # setting a property must also call the callback
+ assert func.counter == 2
+ art.remove_callback(oid)
+ art.pchanged() # must not call the callback anymore
+ assert func.counter == 2
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_axes.py b/venv/Lib/site-packages/matplotlib/tests/test_axes.py
new file mode 100644
index 0000000..ec4773d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_axes.py
@@ -0,0 +1,7074 @@
+from collections import namedtuple
+import datetime
+from decimal import Decimal
+import io
+from itertools import product
+import platform
+from types import SimpleNamespace
+try:
+ from contextlib import nullcontext
+except ImportError:
+ from contextlib import ExitStack as nullcontext # Py3.6.
+
+import dateutil.tz
+
+import numpy as np
+from numpy import ma
+from cycler import cycler
+import pytest
+
+import matplotlib
+import matplotlib as mpl
+from matplotlib.testing.decorators import (
+ image_comparison, check_figures_equal, remove_ticks_and_titles)
+import matplotlib.colors as mcolors
+import matplotlib.dates as mdates
+from matplotlib.figure import Figure
+import matplotlib.font_manager as mfont_manager
+import matplotlib.markers as mmarkers
+import matplotlib.patches as mpatches
+import matplotlib.pyplot as plt
+import matplotlib.ticker as mticker
+import matplotlib.transforms as mtransforms
+from numpy.testing import (
+ assert_allclose, assert_array_equal, assert_array_almost_equal)
+from matplotlib import rc_context
+from matplotlib.cbook import MatplotlibDeprecationWarning
+
+# Note: Some test cases are run twice: once normally and once with labeled data
+# These two must be defined in the same test function or need to have
+# different baseline images to prevent race conditions when pytest runs
+# the tests with multiple threads.
+
+
+def test_get_labels():
+ fig, ax = plt.subplots()
+ ax.set_xlabel('x label')
+ ax.set_ylabel('y label')
+ assert ax.get_xlabel() == 'x label'
+ assert ax.get_ylabel() == 'y label'
+
+
+@check_figures_equal()
+def test_label_loc_vertical(fig_test, fig_ref):
+ ax = fig_test.subplots()
+ sc = ax.scatter([1, 2], [1, 2], c=[1, 2], label='scatter')
+ ax.legend()
+ ax.set_ylabel('Y Label', loc='top')
+ ax.set_xlabel('X Label', loc='right')
+ cbar = fig_test.colorbar(sc)
+ cbar.set_label("Z Label", loc='top')
+
+ ax = fig_ref.subplots()
+ sc = ax.scatter([1, 2], [1, 2], c=[1, 2], label='scatter')
+ ax.legend()
+ ax.set_ylabel('Y Label', y=1, ha='right')
+ ax.set_xlabel('X Label', x=1, ha='right')
+ cbar = fig_ref.colorbar(sc)
+ cbar.set_label("Z Label", y=1, ha='right')
+
+
+@check_figures_equal()
+def test_label_loc_horizontal(fig_test, fig_ref):
+ ax = fig_test.subplots()
+ sc = ax.scatter([1, 2], [1, 2], c=[1, 2], label='scatter')
+ ax.legend()
+ ax.set_ylabel('Y Label', loc='bottom')
+ ax.set_xlabel('X Label', loc='left')
+ cbar = fig_test.colorbar(sc, orientation='horizontal')
+ cbar.set_label("Z Label", loc='left')
+
+ ax = fig_ref.subplots()
+ sc = ax.scatter([1, 2], [1, 2], c=[1, 2], label='scatter')
+ ax.legend()
+ ax.set_ylabel('Y Label', y=0, ha='left')
+ ax.set_xlabel('X Label', x=0, ha='left')
+ cbar = fig_ref.colorbar(sc, orientation='horizontal')
+ cbar.set_label("Z Label", x=0, ha='left')
+
+
+@check_figures_equal()
+def test_label_loc_rc(fig_test, fig_ref):
+ with matplotlib.rc_context({"xaxis.labellocation": "right",
+ "yaxis.labellocation": "top"}):
+ ax = fig_test.subplots()
+ sc = ax.scatter([1, 2], [1, 2], c=[1, 2], label='scatter')
+ ax.legend()
+ ax.set_ylabel('Y Label')
+ ax.set_xlabel('X Label')
+ cbar = fig_test.colorbar(sc, orientation='horizontal')
+ cbar.set_label("Z Label")
+
+ ax = fig_ref.subplots()
+ sc = ax.scatter([1, 2], [1, 2], c=[1, 2], label='scatter')
+ ax.legend()
+ ax.set_ylabel('Y Label', y=1, ha='right')
+ ax.set_xlabel('X Label', x=1, ha='right')
+ cbar = fig_ref.colorbar(sc, orientation='horizontal')
+ cbar.set_label("Z Label", x=1, ha='right')
+
+
+@check_figures_equal(extensions=["png"])
+def test_acorr(fig_test, fig_ref):
+ np.random.seed(19680801)
+ Nx = 512
+ x = np.random.normal(0, 1, Nx).cumsum()
+ maxlags = Nx-1
+
+ ax_test = fig_test.subplots()
+ ax_test.acorr(x, maxlags=maxlags)
+
+ ax_ref = fig_ref.subplots()
+ # Normalized autocorrelation
+ norm_auto_corr = np.correlate(x, x, mode="full")/np.dot(x, x)
+ lags = np.arange(-maxlags, maxlags+1)
+ norm_auto_corr = norm_auto_corr[Nx-1-maxlags:Nx+maxlags]
+ ax_ref.vlines(lags, [0], norm_auto_corr)
+ ax_ref.axhline(y=0, xmin=0, xmax=1)
+
+
+@check_figures_equal(extensions=["png"])
+def test_spy(fig_test, fig_ref):
+ np.random.seed(19680801)
+ a = np.ones(32 * 32)
+ a[:16 * 32] = 0
+ np.random.shuffle(a)
+ a = a.reshape((32, 32))
+
+ axs_test = fig_test.subplots(2)
+ axs_test[0].spy(a)
+ axs_test[1].spy(a, marker=".", origin="lower")
+
+ axs_ref = fig_ref.subplots(2)
+ axs_ref[0].imshow(a, cmap="gray_r", interpolation="nearest")
+ axs_ref[0].xaxis.tick_top()
+ axs_ref[1].plot(*np.nonzero(a)[::-1], ".", markersize=10)
+ axs_ref[1].set(
+ aspect=1, xlim=axs_ref[0].get_xlim(), ylim=axs_ref[0].get_ylim()[::-1])
+ for ax in axs_ref:
+ ax.xaxis.set_ticks_position("both")
+
+
+def test_spy_invalid_kwargs():
+ fig, ax = plt.subplots()
+ for unsupported_kw in [{'interpolation': 'nearest'},
+ {'marker': 'o', 'linestyle': 'solid'}]:
+ with pytest.raises(TypeError):
+ ax.spy(np.eye(3, 3), **unsupported_kw)
+
+
+@check_figures_equal(extensions=["png"])
+def test_matshow(fig_test, fig_ref):
+ mpl.style.use("mpl20")
+ a = np.random.rand(32, 32)
+ fig_test.add_subplot().matshow(a)
+ ax_ref = fig_ref.add_subplot()
+ ax_ref.imshow(a)
+ ax_ref.xaxis.tick_top()
+ ax_ref.xaxis.set_ticks_position('both')
+
+
+@image_comparison(['formatter_ticker_001',
+ 'formatter_ticker_002',
+ 'formatter_ticker_003',
+ 'formatter_ticker_004',
+ 'formatter_ticker_005',
+ ])
+def test_formatter_ticker():
+ import matplotlib.testing.jpl_units as units
+ units.register()
+
+ # This should affect the tick size. (Tests issue #543)
+ matplotlib.rcParams['lines.markeredgewidth'] = 30
+
+ # This essentially test to see if user specified labels get overwritten
+ # by the auto labeler functionality of the axes.
+ xdata = [x*units.sec for x in range(10)]
+ ydata1 = [(1.5*y - 0.5)*units.km for y in range(10)]
+ ydata2 = [(1.75*y - 1.0)*units.km for y in range(10)]
+
+ ax = plt.figure().subplots()
+ ax.set_xlabel("x-label 001")
+
+ ax = plt.figure().subplots()
+ ax.set_xlabel("x-label 001")
+ ax.plot(xdata, ydata1, color='blue', xunits="sec")
+
+ ax = plt.figure().subplots()
+ ax.set_xlabel("x-label 001")
+ ax.plot(xdata, ydata1, color='blue', xunits="sec")
+ ax.set_xlabel("x-label 003")
+
+ ax = plt.figure().subplots()
+ ax.plot(xdata, ydata1, color='blue', xunits="sec")
+ ax.plot(xdata, ydata2, color='green', xunits="hour")
+ ax.set_xlabel("x-label 004")
+
+ # See SF bug 2846058
+ # https://sourceforge.net/tracker/?func=detail&aid=2846058&group_id=80706&atid=560720
+ ax = plt.figure().subplots()
+ ax.plot(xdata, ydata1, color='blue', xunits="sec")
+ ax.plot(xdata, ydata2, color='green', xunits="hour")
+ ax.set_xlabel("x-label 005")
+ ax.autoscale_view()
+
+
+def test_funcformatter_auto_formatter():
+ def _formfunc(x, pos):
+ return ''
+
+ ax = plt.figure().subplots()
+
+ assert ax.xaxis.isDefault_majfmt
+ assert ax.xaxis.isDefault_minfmt
+ assert ax.yaxis.isDefault_majfmt
+ assert ax.yaxis.isDefault_minfmt
+
+ ax.xaxis.set_major_formatter(_formfunc)
+
+ assert not ax.xaxis.isDefault_majfmt
+ assert ax.xaxis.isDefault_minfmt
+ assert ax.yaxis.isDefault_majfmt
+ assert ax.yaxis.isDefault_minfmt
+
+ targ_funcformatter = mticker.FuncFormatter(_formfunc)
+
+ assert isinstance(ax.xaxis.get_major_formatter(),
+ mticker.FuncFormatter)
+
+ assert ax.xaxis.get_major_formatter().func == targ_funcformatter.func
+
+
+def test_strmethodformatter_auto_formatter():
+ formstr = '{x}_{pos}'
+
+ ax = plt.figure().subplots()
+
+ assert ax.xaxis.isDefault_majfmt
+ assert ax.xaxis.isDefault_minfmt
+ assert ax.yaxis.isDefault_majfmt
+ assert ax.yaxis.isDefault_minfmt
+
+ ax.yaxis.set_minor_formatter(formstr)
+
+ assert ax.xaxis.isDefault_majfmt
+ assert ax.xaxis.isDefault_minfmt
+ assert ax.yaxis.isDefault_majfmt
+ assert not ax.yaxis.isDefault_minfmt
+
+ targ_strformatter = mticker.StrMethodFormatter(formstr)
+
+ assert isinstance(ax.yaxis.get_minor_formatter(),
+ mticker.StrMethodFormatter)
+
+ assert ax.yaxis.get_minor_formatter().fmt == targ_strformatter.fmt
+
+
+@image_comparison(["twin_axis_locators_formatters"])
+def test_twin_axis_locators_formatters():
+ vals = np.linspace(0, 1, num=5, endpoint=True)
+ locs = np.sin(np.pi * vals / 2.0)
+
+ majl = plt.FixedLocator(locs)
+ minl = plt.FixedLocator([0.1, 0.2, 0.3])
+
+ fig = plt.figure()
+ ax1 = fig.add_subplot(1, 1, 1)
+ ax1.plot([0.1, 100], [0, 1])
+ ax1.yaxis.set_major_locator(majl)
+ ax1.yaxis.set_minor_locator(minl)
+ ax1.yaxis.set_major_formatter(plt.FormatStrFormatter('%08.2lf'))
+ ax1.yaxis.set_minor_formatter(plt.FixedFormatter(['tricks', 'mind',
+ 'jedi']))
+
+ ax1.xaxis.set_major_locator(plt.LinearLocator())
+ ax1.xaxis.set_minor_locator(plt.FixedLocator([15, 35, 55, 75]))
+ ax1.xaxis.set_major_formatter(plt.FormatStrFormatter('%05.2lf'))
+ ax1.xaxis.set_minor_formatter(plt.FixedFormatter(['c', '3', 'p', 'o']))
+ ax1.twiny()
+ ax1.twinx()
+
+
+def test_twinx_cla():
+ fig, ax = plt.subplots()
+ ax2 = ax.twinx()
+ ax3 = ax2.twiny()
+ plt.draw()
+ assert not ax2.xaxis.get_visible()
+ assert not ax2.patch.get_visible()
+ ax2.cla()
+ ax3.cla()
+
+ assert not ax2.xaxis.get_visible()
+ assert not ax2.patch.get_visible()
+ assert ax2.yaxis.get_visible()
+
+ assert ax3.xaxis.get_visible()
+ assert not ax3.patch.get_visible()
+ assert not ax3.yaxis.get_visible()
+
+ assert ax.xaxis.get_visible()
+ assert ax.patch.get_visible()
+ assert ax.yaxis.get_visible()
+
+
+@pytest.mark.parametrize('twin', ('x', 'y'))
+@check_figures_equal(extensions=['png'], tol=0.19)
+def test_twin_logscale(fig_test, fig_ref, twin):
+ twin_func = f'twin{twin}' # test twinx or twiny
+ set_scale = f'set_{twin}scale'
+ x = np.arange(1, 100)
+
+ # Change scale after twinning.
+ ax_test = fig_test.add_subplot(2, 1, 1)
+ ax_twin = getattr(ax_test, twin_func)()
+ getattr(ax_test, set_scale)('log')
+ ax_twin.plot(x, x)
+
+ # Twin after changing scale.
+ ax_test = fig_test.add_subplot(2, 1, 2)
+ getattr(ax_test, set_scale)('log')
+ ax_twin = getattr(ax_test, twin_func)()
+ ax_twin.plot(x, x)
+
+ for i in [1, 2]:
+ ax_ref = fig_ref.add_subplot(2, 1, i)
+ getattr(ax_ref, set_scale)('log')
+ ax_ref.plot(x, x)
+
+ # This is a hack because twinned Axes double-draw the frame.
+ # Remove this when that is fixed.
+ Path = matplotlib.path.Path
+ fig_ref.add_artist(
+ matplotlib.patches.PathPatch(
+ Path([[0, 0], [0, 1],
+ [0, 1], [1, 1],
+ [1, 1], [1, 0],
+ [1, 0], [0, 0]],
+ [Path.MOVETO, Path.LINETO] * 4),
+ transform=ax_ref.transAxes,
+ facecolor='none',
+ edgecolor=mpl.rcParams['axes.edgecolor'],
+ linewidth=mpl.rcParams['axes.linewidth'],
+ capstyle='projecting'))
+
+ remove_ticks_and_titles(fig_test)
+ remove_ticks_and_titles(fig_ref)
+
+
+@image_comparison(['twin_autoscale.png'])
+def test_twinx_axis_scales():
+ x = np.array([0, 0.5, 1])
+ y = 0.5 * x
+ x2 = np.array([0, 1, 2])
+ y2 = 2 * x2
+
+ fig = plt.figure()
+ ax = fig.add_axes((0, 0, 1, 1), autoscalex_on=False, autoscaley_on=False)
+ ax.plot(x, y, color='blue', lw=10)
+
+ ax2 = plt.twinx(ax)
+ ax2.plot(x2, y2, 'r--', lw=5)
+
+ ax.margins(0, 0)
+ ax2.margins(0, 0)
+
+
+def test_twin_inherit_autoscale_setting():
+ fig, ax = plt.subplots()
+ ax_x_on = ax.twinx()
+ ax.set_autoscalex_on(False)
+ ax_x_off = ax.twinx()
+
+ assert ax_x_on.get_autoscalex_on()
+ assert not ax_x_off.get_autoscalex_on()
+
+ ax_y_on = ax.twiny()
+ ax.set_autoscaley_on(False)
+ ax_y_off = ax.twiny()
+
+ assert ax_y_on.get_autoscaley_on()
+ assert not ax_y_off.get_autoscaley_on()
+
+
+def test_inverted_cla():
+ # GitHub PR #5450. Setting autoscale should reset
+ # axes to be non-inverted.
+ # plotting an image, then 1d graph, axis is now down
+ fig = plt.figure(0)
+ ax = fig.gca()
+ # 1. test that a new axis is not inverted per default
+ assert not ax.xaxis_inverted()
+ assert not ax.yaxis_inverted()
+ img = np.random.random((100, 100))
+ ax.imshow(img)
+ # 2. test that a image axis is inverted
+ assert not ax.xaxis_inverted()
+ assert ax.yaxis_inverted()
+ # 3. test that clearing and plotting a line, axes are
+ # not inverted
+ ax.cla()
+ x = np.linspace(0, 2*np.pi, 100)
+ ax.plot(x, np.cos(x))
+ assert not ax.xaxis_inverted()
+ assert not ax.yaxis_inverted()
+
+ # 4. autoscaling should not bring back axes to normal
+ ax.cla()
+ ax.imshow(img)
+ plt.autoscale()
+ assert not ax.xaxis_inverted()
+ assert ax.yaxis_inverted()
+
+ # 5. two shared axes. Inverting the master axis should invert the shared
+ # axes; clearing the master axis should bring axes in shared
+ # axes back to normal.
+ ax0 = plt.subplot(211)
+ ax1 = plt.subplot(212, sharey=ax0)
+ ax0.yaxis.set_inverted(True)
+ assert ax1.yaxis_inverted()
+ ax1.plot(x, np.cos(x))
+ ax0.cla()
+ assert not ax1.yaxis_inverted()
+ ax1.cla()
+ # 6. clearing the nonmaster should not touch limits
+ ax0.imshow(img)
+ ax1.plot(x, np.cos(x))
+ ax1.cla()
+ assert ax.yaxis_inverted()
+
+ # clean up
+ plt.close(fig)
+
+
+@check_figures_equal(extensions=["png"])
+def test_minorticks_on_rcParams_both(fig_test, fig_ref):
+ with matplotlib.rc_context({"xtick.minor.visible": True,
+ "ytick.minor.visible": True}):
+ ax_test = fig_test.subplots()
+ ax_test.plot([0, 1], [0, 1])
+ ax_ref = fig_ref.subplots()
+ ax_ref.plot([0, 1], [0, 1])
+ ax_ref.minorticks_on()
+
+
+@image_comparison(["autoscale_tiny_range"], remove_text=True)
+def test_autoscale_tiny_range():
+ # github pull #904
+ fig, axs = plt.subplots(2, 2)
+ for i, ax in enumerate(axs.flat):
+ y1 = 10**(-11 - i)
+ ax.plot([0, 1], [1, 1 + y1])
+
+
+@pytest.mark.style('default')
+def test_autoscale_tight():
+ fig, ax = plt.subplots(1, 1)
+ ax.plot([1, 2, 3, 4])
+ ax.autoscale(enable=True, axis='x', tight=False)
+ ax.autoscale(enable=True, axis='y', tight=True)
+ assert_allclose(ax.get_xlim(), (-0.15, 3.15))
+ assert_allclose(ax.get_ylim(), (1.0, 4.0))
+
+
+@pytest.mark.style('default')
+def test_autoscale_log_shared():
+ # related to github #7587
+ # array starts at zero to trigger _minpos handling
+ x = np.arange(100, dtype=float)
+ fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True)
+ ax1.loglog(x, x)
+ ax2.semilogx(x, x)
+ ax1.autoscale(tight=True)
+ ax2.autoscale(tight=True)
+ plt.draw()
+ lims = (x[1], x[-1])
+ assert_allclose(ax1.get_xlim(), lims)
+ assert_allclose(ax1.get_ylim(), lims)
+ assert_allclose(ax2.get_xlim(), lims)
+ assert_allclose(ax2.get_ylim(), (x[0], x[-1]))
+
+
+@pytest.mark.style('default')
+def test_use_sticky_edges():
+ fig, ax = plt.subplots()
+ ax.imshow([[0, 1], [2, 3]], origin='lower')
+ assert_allclose(ax.get_xlim(), (-0.5, 1.5))
+ assert_allclose(ax.get_ylim(), (-0.5, 1.5))
+ ax.use_sticky_edges = False
+ ax.autoscale()
+ xlim = (-0.5 - 2 * ax._xmargin, 1.5 + 2 * ax._xmargin)
+ ylim = (-0.5 - 2 * ax._ymargin, 1.5 + 2 * ax._ymargin)
+ assert_allclose(ax.get_xlim(), xlim)
+ assert_allclose(ax.get_ylim(), ylim)
+ # Make sure it is reversible:
+ ax.use_sticky_edges = True
+ ax.autoscale()
+ assert_allclose(ax.get_xlim(), (-0.5, 1.5))
+ assert_allclose(ax.get_ylim(), (-0.5, 1.5))
+
+
+@check_figures_equal(extensions=["png"])
+def test_sticky_shared_axes(fig_test, fig_ref):
+ # Check that sticky edges work whether they are set in an axes that is a
+ # "master" in a share, or an axes that is a "follower".
+ Z = np.arange(15).reshape(3, 5)
+
+ ax0 = fig_test.add_subplot(211)
+ ax1 = fig_test.add_subplot(212, sharex=ax0)
+ ax1.pcolormesh(Z)
+
+ ax0 = fig_ref.add_subplot(212)
+ ax1 = fig_ref.add_subplot(211, sharex=ax0)
+ ax0.pcolormesh(Z)
+
+
+@image_comparison(['offset_points'], remove_text=True)
+def test_basic_annotate():
+ # Setup some data
+ t = np.arange(0.0, 5.0, 0.01)
+ s = np.cos(2.0*np.pi * t)
+
+ # Offset Points
+
+ fig = plt.figure()
+ ax = fig.add_subplot(autoscale_on=False, xlim=(-1, 5), ylim=(-3, 5))
+ line, = ax.plot(t, s, lw=3, color='purple')
+
+ ax.annotate('local max', xy=(3, 1), xycoords='data',
+ xytext=(3, 3), textcoords='offset points')
+
+
+def test_annotate_parameter_warn():
+ fig, ax = plt.subplots()
+ with pytest.warns(MatplotlibDeprecationWarning,
+ match=r"The \'s\' parameter of annotate\(\) "
+ "has been renamed \'text\'"):
+ ax.annotate(s='now named text', xy=(0, 1))
+
+
+@image_comparison(['arrow_simple.png'], remove_text=True)
+def test_arrow_simple():
+ # Simple image test for ax.arrow
+ # kwargs that take discrete values
+ length_includes_head = (True, False)
+ shape = ('full', 'left', 'right')
+ head_starts_at_zero = (True, False)
+ # Create outer product of values
+ kwargs = product(length_includes_head, shape, head_starts_at_zero)
+
+ fig, axs = plt.subplots(3, 4)
+ for i, (ax, kwarg) in enumerate(zip(axs.flat, kwargs)):
+ ax.set_xlim(-2, 2)
+ ax.set_ylim(-2, 2)
+ # Unpack kwargs
+ (length_includes_head, shape, head_starts_at_zero) = kwarg
+ theta = 2 * np.pi * i / 12
+ # Draw arrow
+ ax.arrow(0, 0, np.sin(theta), np.cos(theta),
+ width=theta/100,
+ length_includes_head=length_includes_head,
+ shape=shape,
+ head_starts_at_zero=head_starts_at_zero,
+ head_width=theta / 10,
+ head_length=theta / 10)
+
+
+def test_arrow_empty():
+ _, ax = plt.subplots()
+ # Create an empty FancyArrow
+ ax.arrow(0, 0, 0, 0, head_length=0)
+
+
+def test_arrow_in_view():
+ _, ax = plt.subplots()
+ ax.arrow(1, 1, 1, 1)
+ assert ax.get_xlim() == (0.8, 2.2)
+ assert ax.get_ylim() == (0.8, 2.2)
+
+
+def test_annotate_default_arrow():
+ # Check that we can make an annotation arrow with only default properties.
+ fig, ax = plt.subplots()
+ ann = ax.annotate("foo", (0, 1), xytext=(2, 3))
+ assert ann.arrow_patch is None
+ ann = ax.annotate("foo", (0, 1), xytext=(2, 3), arrowprops={})
+ assert ann.arrow_patch is not None
+
+
+@image_comparison(['fill_units.png'], savefig_kwarg={'dpi': 60})
+def test_fill_units():
+ import matplotlib.testing.jpl_units as units
+ units.register()
+
+ # generate some data
+ t = units.Epoch("ET", dt=datetime.datetime(2009, 4, 27))
+ value = 10.0 * units.deg
+ day = units.Duration("ET", 24.0 * 60.0 * 60.0)
+ dt = np.arange('2009-04-27', '2009-04-29', dtype='datetime64[D]')
+ dtn = mdates.date2num(dt)
+
+ fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2)
+
+ ax1.plot([t], [value], yunits='deg', color='red')
+ ind = [0, 0, 1, 1]
+ ax1.fill(dtn[ind], [0.0, 0.0, 90.0, 0.0], 'b')
+
+ ax2.plot([t], [value], yunits='deg', color='red')
+ ax2.fill([t, t, t + day, t + day],
+ [0.0, 0.0, 90.0, 0.0], 'b')
+
+ ax3.plot([t], [value], yunits='deg', color='red')
+ ax3.fill(dtn[ind],
+ [0 * units.deg, 0 * units.deg, 90 * units.deg, 0 * units.deg],
+ 'b')
+
+ ax4.plot([t], [value], yunits='deg', color='red')
+ ax4.fill([t, t, t + day, t + day],
+ [0 * units.deg, 0 * units.deg, 90 * units.deg, 0 * units.deg],
+ facecolor="blue")
+ fig.autofmt_xdate()
+
+
+def test_plot_format_kwarg_redundant():
+ with pytest.warns(UserWarning, match="marker .* redundantly defined"):
+ plt.plot([0], [0], 'o', marker='x')
+ with pytest.warns(UserWarning, match="linestyle .* redundantly defined"):
+ plt.plot([0], [0], '-', linestyle='--')
+ with pytest.warns(UserWarning, match="color .* redundantly defined"):
+ plt.plot([0], [0], 'r', color='blue')
+ # smoke-test: should not warn
+ plt.errorbar([0], [0], fmt='none', color='blue')
+
+
+@image_comparison(['single_point', 'single_point'])
+def test_single_point():
+ # Issue #1796: don't let lines.marker affect the grid
+ matplotlib.rcParams['lines.marker'] = 'o'
+ matplotlib.rcParams['axes.grid'] = True
+
+ fig, (ax1, ax2) = plt.subplots(2)
+ ax1.plot([0], [0], 'o')
+ ax2.plot([1], [1], 'o')
+
+ # Reuse testcase from above for a labeled data test
+ data = {'a': [0], 'b': [1]}
+
+ fig, (ax1, ax2) = plt.subplots(2)
+ ax1.plot('a', 'a', 'o', data=data)
+ ax2.plot('b', 'b', 'o', data=data)
+
+
+@image_comparison(['single_date.png'], style='mpl20')
+def test_single_date():
+
+ # use former defaults to match existing baseline image
+ plt.rcParams['axes.formatter.limits'] = -7, 7
+ dt = mdates.date2num(np.datetime64('0000-12-31'))
+
+ time1 = [721964.0]
+ data1 = [-65.54]
+
+ fig, ax = plt.subplots(2, 1)
+ ax[0].plot_date(time1 + dt, data1, 'o', color='r')
+ ax[1].plot(time1, data1, 'o', color='r')
+
+
+@check_figures_equal(extensions=["png"])
+def test_shaped_data(fig_test, fig_ref):
+ row = np.arange(10).reshape((1, -1))
+ col = np.arange(0, 100, 10).reshape((-1, 1))
+
+ axs = fig_test.subplots(2)
+ axs[0].plot(row) # Actually plots nothing (columns are single points).
+ axs[1].plot(col) # Same as plotting 1d.
+
+ axs = fig_ref.subplots(2)
+ # xlim from the implicit "x=0", ylim from the row datalim.
+ axs[0].set(xlim=(-.06, .06), ylim=(0, 9))
+ axs[1].plot(col.ravel())
+
+
+def test_structured_data():
+ # support for structured data
+ pts = np.array([(1, 1), (2, 2)], dtype=[("ones", float), ("twos", float)])
+
+ # this should not read second name as a format and raise ValueError
+ axs = plt.figure().subplots(2)
+ axs[0].plot("ones", "twos", data=pts)
+ axs[1].plot("ones", "twos", "r", data=pts)
+
+
+@image_comparison(['aitoff_proj'], extensions=["png"],
+ remove_text=True, style='mpl20')
+def test_aitoff_proj():
+ """
+ Test aitoff projection ref.:
+ https://github.com/matplotlib/matplotlib/pull/14451
+ """
+ x = np.linspace(-np.pi, np.pi, 20)
+ y = np.linspace(-np.pi / 2, np.pi / 2, 20)
+ X, Y = np.meshgrid(x, y)
+
+ fig, ax = plt.subplots(figsize=(8, 4.2),
+ subplot_kw=dict(projection="aitoff"))
+ ax.grid()
+ ax.plot(X.flat, Y.flat, 'o', markersize=4)
+
+
+@image_comparison(['axvspan_epoch'])
+def test_axvspan_epoch():
+ import matplotlib.testing.jpl_units as units
+ units.register()
+
+ # generate some data
+ t0 = units.Epoch("ET", dt=datetime.datetime(2009, 1, 20))
+ tf = units.Epoch("ET", dt=datetime.datetime(2009, 1, 21))
+ dt = units.Duration("ET", units.day.convert("sec"))
+
+ ax = plt.gca()
+ ax.axvspan(t0, tf, facecolor="blue", alpha=0.25)
+ ax.set_xlim(t0 - 5.0*dt, tf + 5.0*dt)
+
+
+@image_comparison(['axhspan_epoch'], tol=0.02)
+def test_axhspan_epoch():
+ import matplotlib.testing.jpl_units as units
+ units.register()
+
+ # generate some data
+ t0 = units.Epoch("ET", dt=datetime.datetime(2009, 1, 20))
+ tf = units.Epoch("ET", dt=datetime.datetime(2009, 1, 21))
+ dt = units.Duration("ET", units.day.convert("sec"))
+
+ ax = plt.gca()
+ ax.axhspan(t0, tf, facecolor="blue", alpha=0.25)
+ ax.set_ylim(t0 - 5.0*dt, tf + 5.0*dt)
+
+
+@image_comparison(['hexbin_extent.png', 'hexbin_extent.png'], remove_text=True)
+def test_hexbin_extent():
+ # this test exposes sf bug 2856228
+ fig, ax = plt.subplots()
+ data = (np.arange(2000) / 2000).reshape((2, 1000))
+ x, y = data
+
+ ax.hexbin(x, y, extent=[.1, .3, .6, .7])
+
+ # Reuse testcase from above for a labeled data test
+ data = {"x": x, "y": y}
+
+ fig, ax = plt.subplots()
+ ax.hexbin("x", "y", extent=[.1, .3, .6, .7], data=data)
+
+
+@image_comparison(['hexbin_empty.png'], remove_text=True)
+def test_hexbin_empty():
+ # From #3886: creating hexbin from empty dataset raises ValueError
+ ax = plt.gca()
+ ax.hexbin([], [])
+
+
+def test_hexbin_pickable():
+ # From #1973: Test that picking a hexbin collection works
+ fig, ax = plt.subplots()
+ data = (np.arange(200) / 200).reshape((2, 100))
+ x, y = data
+ hb = ax.hexbin(x, y, extent=[.1, .3, .6, .7], picker=-1)
+ mouse_event = SimpleNamespace(x=400, y=300)
+ assert hb.contains(mouse_event)[0]
+
+
+@image_comparison(['hexbin_log.png'], style='mpl20')
+def test_hexbin_log():
+ # Issue #1636 (and also test log scaled colorbar)
+
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ np.random.seed(19680801)
+ n = 100000
+ x = np.random.standard_normal(n)
+ y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n)
+ y = np.power(2, y * 0.5)
+
+ fig, ax = plt.subplots()
+ h = ax.hexbin(x, y, yscale='log', bins='log')
+ plt.colorbar(h)
+
+
+def test_inverted_limits():
+ # Test gh:1553
+ # Calling invert_xaxis prior to plotting should not disable autoscaling
+ # while still maintaining the inverted direction
+ fig, ax = plt.subplots()
+ ax.invert_xaxis()
+ ax.plot([-5, -3, 2, 4], [1, 2, -3, 5])
+
+ assert ax.get_xlim() == (4, -5)
+ assert ax.get_ylim() == (-3, 5)
+ plt.close()
+
+ fig, ax = plt.subplots()
+ ax.invert_yaxis()
+ ax.plot([-5, -3, 2, 4], [1, 2, -3, 5])
+
+ assert ax.get_xlim() == (-5, 4)
+ assert ax.get_ylim() == (5, -3)
+
+ # Test inverting nonlinear axes.
+ fig, ax = plt.subplots()
+ ax.set_yscale("log")
+ ax.set_ylim(10, 1)
+ assert ax.get_ylim() == (10, 1)
+
+
+@image_comparison(['nonfinite_limits'])
+def test_nonfinite_limits():
+ x = np.arange(0., np.e, 0.01)
+ # silence divide by zero warning from log(0)
+ with np.errstate(divide='ignore'):
+ y = np.log(x)
+ x[len(x)//2] = np.nan
+ fig, ax = plt.subplots()
+ ax.plot(x, y)
+
+
+@pytest.mark.style('default')
+@pytest.mark.parametrize('plot_fun',
+ ['scatter', 'plot', 'fill_between'])
+@check_figures_equal(extensions=["png"])
+def test_limits_empty_data(plot_fun, fig_test, fig_ref):
+ # Check that plotting empty data doesn't change autoscaling of dates
+ x = np.arange("2010-01-01", "2011-01-01", dtype="datetime64[D]")
+
+ ax_test = fig_test.subplots()
+ ax_ref = fig_ref.subplots()
+
+ getattr(ax_test, plot_fun)([], [])
+
+ for ax in [ax_test, ax_ref]:
+ getattr(ax, plot_fun)(x, range(len(x)), color='C0')
+
+
+@image_comparison(['imshow', 'imshow'], remove_text=True, style='mpl20')
+def test_imshow():
+ # use former defaults to match existing baseline image
+ matplotlib.rcParams['image.interpolation'] = 'nearest'
+ # Create a NxN image
+ N = 100
+ (x, y) = np.indices((N, N))
+ x -= N//2
+ y -= N//2
+ r = np.sqrt(x**2+y**2-x*y)
+
+ # Create a contour plot at N/4 and extract both the clip path and transform
+ fig, ax = plt.subplots()
+ ax.imshow(r)
+
+ # Reuse testcase from above for a labeled data test
+ data = {"r": r}
+ fig, ax = plt.subplots()
+ ax.imshow("r", data=data)
+
+
+@image_comparison(['imshow_clip'], style='mpl20')
+def test_imshow_clip():
+ # As originally reported by Gellule Xg
+ # use former defaults to match existing baseline image
+ matplotlib.rcParams['image.interpolation'] = 'nearest'
+
+ # Create a NxN image
+ N = 100
+ (x, y) = np.indices((N, N))
+ x -= N//2
+ y -= N//2
+ r = np.sqrt(x**2+y**2-x*y)
+
+ # Create a contour plot at N/4 and extract both the clip path and transform
+ fig, ax = plt.subplots()
+
+ c = ax.contour(r, [N/4])
+ x = c.collections[0]
+ clip_path = x.get_paths()[0]
+ clip_transform = x.get_transform()
+
+ clip_path = mtransforms.TransformedPath(clip_path, clip_transform)
+
+ # Plot the image clipped by the contour
+ ax.imshow(r, clip_path=clip_path)
+
+
+@check_figures_equal(extensions=["png"])
+def test_imshow_norm_vminvmax(fig_test, fig_ref):
+ """Parameters vmin, vmax should be ignored if norm is given."""
+ a = [[1, 2], [3, 4]]
+ ax = fig_ref.subplots()
+ ax.imshow(a, vmin=0, vmax=5)
+ ax = fig_test.subplots()
+ with pytest.warns(MatplotlibDeprecationWarning,
+ match="Passing parameters norm and vmin/vmax "
+ "simultaneously is deprecated."):
+ ax.imshow(a, norm=mcolors.Normalize(-10, 10), vmin=0, vmax=5)
+
+
+@image_comparison(['polycollection_joinstyle'], remove_text=True)
+def test_polycollection_joinstyle():
+ # Bug #2890979 reported by Matthew West
+ fig, ax = plt.subplots()
+ verts = np.array([[1, 1], [1, 2], [2, 2], [2, 1]])
+ c = mpl.collections.PolyCollection([verts], linewidths=40)
+ ax.add_collection(c)
+ ax.set_xbound(0, 3)
+ ax.set_ybound(0, 3)
+
+
+@pytest.mark.parametrize(
+ 'x, y1, y2', [
+ (np.zeros((2, 2)), 3, 3),
+ (np.arange(0.0, 2, 0.02), np.zeros((2, 2)), 3),
+ (np.arange(0.0, 2, 0.02), 3, np.zeros((2, 2)))
+ ], ids=[
+ '2d_x_input',
+ '2d_y1_input',
+ '2d_y2_input'
+ ]
+)
+def test_fill_between_input(x, y1, y2):
+ fig, ax = plt.subplots()
+ with pytest.raises(ValueError):
+ ax.fill_between(x, y1, y2)
+
+
+@pytest.mark.parametrize(
+ 'y, x1, x2', [
+ (np.zeros((2, 2)), 3, 3),
+ (np.arange(0.0, 2, 0.02), np.zeros((2, 2)), 3),
+ (np.arange(0.0, 2, 0.02), 3, np.zeros((2, 2)))
+ ], ids=[
+ '2d_y_input',
+ '2d_x1_input',
+ '2d_x2_input'
+ ]
+)
+def test_fill_betweenx_input(y, x1, x2):
+ fig, ax = plt.subplots()
+ with pytest.raises(ValueError):
+ ax.fill_betweenx(y, x1, x2)
+
+
+@image_comparison(['fill_between_interpolate'], remove_text=True)
+def test_fill_between_interpolate():
+ x = np.arange(0.0, 2, 0.02)
+ y1 = np.sin(2*np.pi*x)
+ y2 = 1.2*np.sin(4*np.pi*x)
+
+ fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True)
+ ax1.plot(x, y1, x, y2, color='black')
+ ax1.fill_between(x, y1, y2, where=y2 >= y1, facecolor='white', hatch='/',
+ interpolate=True)
+ ax1.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red',
+ interpolate=True)
+
+ # Test support for masked arrays.
+ y2 = np.ma.masked_greater(y2, 1.0)
+ # Test that plotting works for masked arrays with the first element masked
+ y2[0] = np.ma.masked
+ ax2.plot(x, y1, x, y2, color='black')
+ ax2.fill_between(x, y1, y2, where=y2 >= y1, facecolor='green',
+ interpolate=True)
+ ax2.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red',
+ interpolate=True)
+
+
+@image_comparison(['fill_between_interpolate_decreasing'],
+ style='mpl20', remove_text=True)
+def test_fill_between_interpolate_decreasing():
+ p = np.array([724.3, 700, 655])
+ t = np.array([9.4, 7, 2.2])
+ prof = np.array([7.9, 6.6, 3.8])
+
+ fig, ax = plt.subplots(figsize=(9, 9))
+
+ ax.plot(t, p, 'tab:red')
+ ax.plot(prof, p, 'k')
+
+ ax.fill_betweenx(p, t, prof, where=prof < t,
+ facecolor='blue', interpolate=True, alpha=0.4)
+ ax.fill_betweenx(p, t, prof, where=prof > t,
+ facecolor='red', interpolate=True, alpha=0.4)
+
+ ax.set_xlim(0, 30)
+ ax.set_ylim(800, 600)
+
+
+# test_symlog and test_symlog2 used to have baseline images in all three
+# formats, but the png and svg baselines got invalidated by the removal of
+# minor tick overstriking.
+@image_comparison(['symlog.pdf'])
+def test_symlog():
+ x = np.array([0, 1, 2, 4, 6, 9, 12, 24])
+ y = np.array([1000000, 500000, 100000, 100, 5, 0, 0, 0])
+
+ fig, ax = plt.subplots()
+ ax.plot(x, y)
+ ax.set_yscale('symlog')
+ ax.set_xscale('linear')
+ ax.set_ylim(-1, 10000000)
+
+
+@image_comparison(['symlog2.pdf'], remove_text=True)
+def test_symlog2():
+ # Numbers from -50 to 50, with 0.1 as step
+ x = np.arange(-50, 50, 0.001)
+
+ fig, axs = plt.subplots(5, 1)
+ for ax, linthresh in zip(axs, [20., 2., 1., 0.1, 0.01]):
+ ax.plot(x, x)
+ ax.set_xscale('symlog', linthresh=linthresh)
+ ax.grid(True)
+ axs[-1].set_ylim(-0.1, 0.1)
+
+
+def test_pcolorargs_5205():
+ # Smoketest to catch issue found in gh:5205
+ x = [-1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5]
+ y = [-1.5, -1.25, -1.0, -0.75, -0.5, -0.25, 0,
+ 0.25, 0.5, 0.75, 1.0, 1.25, 1.5]
+ X, Y = np.meshgrid(x, y)
+ Z = np.hypot(X, Y)
+
+ plt.pcolor(Z)
+ plt.pcolor(list(Z))
+ plt.pcolor(x, y, Z[:-1, :-1])
+ plt.pcolor(X, Y, list(Z[:-1, :-1]))
+
+
+@image_comparison(['pcolormesh'], remove_text=True)
+def test_pcolormesh():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ n = 12
+ x = np.linspace(-1.5, 1.5, n)
+ y = np.linspace(-1.5, 1.5, n*2)
+ X, Y = np.meshgrid(x, y)
+ Qx = np.cos(Y) - np.cos(X)
+ Qz = np.sin(Y) + np.sin(X)
+ Qx = (Qx + 1.1)
+ Z = np.hypot(X, Y) / 5
+ Z = (Z - Z.min()) / Z.ptp()
+
+ # The color array can include masked values:
+ Zm = ma.masked_where(np.abs(Qz) < 0.5 * np.max(Qz), Z)
+
+ fig, (ax1, ax2, ax3) = plt.subplots(1, 3)
+ ax1.pcolormesh(Qx, Qz, Z[:-1, :-1], lw=0.5, edgecolors='k')
+ ax2.pcolormesh(Qx, Qz, Z[:-1, :-1], lw=2, edgecolors=['b', 'w'])
+ ax3.pcolormesh(Qx, Qz, Z, shading="gouraud")
+
+
+@image_comparison(['pcolormesh_alpha'], extensions=["png", "pdf"],
+ remove_text=True)
+def test_pcolormesh_alpha():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ n = 12
+ X, Y = np.meshgrid(
+ np.linspace(-1.5, 1.5, n),
+ np.linspace(-1.5, 1.5, n*2)
+ )
+ Qx = X
+ Qy = Y + np.sin(X)
+ Z = np.hypot(X, Y) / 5
+ Z = (Z - Z.min()) / Z.ptp()
+ vir = plt.get_cmap("viridis", 16)
+ # make another colormap with varying alpha
+ colors = vir(np.arange(16))
+ colors[:, 3] = 0.5 + 0.5*np.sin(np.arange(16))
+ cmap = mcolors.ListedColormap(colors)
+
+ fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2)
+ for ax in ax1, ax2, ax3, ax4:
+ ax.add_patch(mpatches.Rectangle(
+ (0, -1.5), 1.5, 3, facecolor=[.7, .1, .1, .5], zorder=0
+ ))
+ # ax1, ax2: constant alpha
+ ax1.pcolormesh(Qx, Qy, Z[:-1, :-1], cmap=vir, alpha=0.4,
+ shading='flat', zorder=1)
+ ax2.pcolormesh(Qx, Qy, Z, cmap=vir, alpha=0.4, shading='gouraud', zorder=1)
+ # ax3, ax4: alpha from colormap
+ ax3.pcolormesh(Qx, Qy, Z[:-1, :-1], cmap=cmap, shading='flat', zorder=1)
+ ax4.pcolormesh(Qx, Qy, Z, cmap=cmap, shading='gouraud', zorder=1)
+
+
+@image_comparison(['pcolormesh_datetime_axis.png'],
+ remove_text=False, style='mpl20')
+def test_pcolormesh_datetime_axis():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig = plt.figure()
+ fig.subplots_adjust(hspace=0.4, top=0.98, bottom=.15)
+ base = datetime.datetime(2013, 1, 1)
+ x = np.array([base + datetime.timedelta(days=d) for d in range(21)])
+ y = np.arange(21)
+ z1, z2 = np.meshgrid(np.arange(20), np.arange(20))
+ z = z1 * z2
+ plt.subplot(221)
+ plt.pcolormesh(x[:-1], y[:-1], z[:-1, :-1])
+ plt.subplot(222)
+ plt.pcolormesh(x, y, z)
+ x = np.repeat(x[np.newaxis], 21, axis=0)
+ y = np.repeat(y[:, np.newaxis], 21, axis=1)
+ plt.subplot(223)
+ plt.pcolormesh(x[:-1, :-1], y[:-1, :-1], z[:-1, :-1])
+ plt.subplot(224)
+ plt.pcolormesh(x, y, z)
+ for ax in fig.get_axes():
+ for label in ax.get_xticklabels():
+ label.set_ha('right')
+ label.set_rotation(30)
+
+
+@image_comparison(['pcolor_datetime_axis.png'],
+ remove_text=False, style='mpl20')
+def test_pcolor_datetime_axis():
+ fig = plt.figure()
+ fig.subplots_adjust(hspace=0.4, top=0.98, bottom=.15)
+ base = datetime.datetime(2013, 1, 1)
+ x = np.array([base + datetime.timedelta(days=d) for d in range(21)])
+ y = np.arange(21)
+ z1, z2 = np.meshgrid(np.arange(20), np.arange(20))
+ z = z1 * z2
+ plt.subplot(221)
+ plt.pcolor(x[:-1], y[:-1], z[:-1, :-1])
+ plt.subplot(222)
+ plt.pcolor(x, y, z)
+ x = np.repeat(x[np.newaxis], 21, axis=0)
+ y = np.repeat(y[:, np.newaxis], 21, axis=1)
+ plt.subplot(223)
+ plt.pcolor(x[:-1, :-1], y[:-1, :-1], z[:-1, :-1])
+ plt.subplot(224)
+ plt.pcolor(x, y, z)
+ for ax in fig.get_axes():
+ for label in ax.get_xticklabels():
+ label.set_ha('right')
+ label.set_rotation(30)
+
+
+def test_pcolorargs():
+ n = 12
+ x = np.linspace(-1.5, 1.5, n)
+ y = np.linspace(-1.5, 1.5, n*2)
+ X, Y = np.meshgrid(x, y)
+ Z = np.hypot(X, Y) / 5
+
+ _, ax = plt.subplots()
+ with pytest.raises(TypeError):
+ ax.pcolormesh(y, x, Z)
+ with pytest.raises(TypeError):
+ ax.pcolormesh(X, Y, Z.T)
+ with pytest.raises(TypeError):
+ ax.pcolormesh(x, y, Z[:-1, :-1], shading="gouraud")
+ with pytest.raises(TypeError):
+ ax.pcolormesh(X, Y, Z[:-1, :-1], shading="gouraud")
+ x[0] = np.NaN
+ with pytest.raises(ValueError):
+ ax.pcolormesh(x, y, Z[:-1, :-1])
+ with np.errstate(invalid='ignore'):
+ x = np.ma.array(x, mask=(x < 0))
+ with pytest.raises(ValueError):
+ ax.pcolormesh(x, y, Z[:-1, :-1])
+ # Expect a warning with non-increasing coordinates
+ x = [359, 0, 1]
+ y = [-10, 10]
+ X, Y = np.meshgrid(x, y)
+ Z = np.zeros(X.shape)
+ with pytest.warns(UserWarning,
+ match='are not monotonically increasing or decreasing'):
+ ax.pcolormesh(X, Y, Z, shading='auto')
+
+
+@check_figures_equal(extensions=["png"])
+def test_pcolornearest(fig_test, fig_ref):
+ ax = fig_test.subplots()
+ x = np.arange(0, 10)
+ y = np.arange(0, 3)
+ np.random.seed(19680801)
+ Z = np.random.randn(2, 9)
+ ax.pcolormesh(x, y, Z, shading='flat')
+
+ ax = fig_ref.subplots()
+ # specify the centers
+ x2 = x[:-1] + np.diff(x) / 2
+ y2 = y[:-1] + np.diff(y) / 2
+ ax.pcolormesh(x2, y2, Z, shading='nearest')
+
+
+@check_figures_equal(extensions=["png"])
+def test_pcolornearestunits(fig_test, fig_ref):
+ ax = fig_test.subplots()
+ x = [datetime.datetime.fromtimestamp(x * 3600) for x in range(10)]
+ y = np.arange(0, 3)
+ np.random.seed(19680801)
+ Z = np.random.randn(2, 9)
+ ax.pcolormesh(x, y, Z, shading='flat')
+
+ ax = fig_ref.subplots()
+ # specify the centers
+ x2 = [datetime.datetime.fromtimestamp((x + 0.5) * 3600) for x in range(9)]
+ y2 = y[:-1] + np.diff(y) / 2
+ ax.pcolormesh(x2, y2, Z, shading='nearest')
+
+
+@check_figures_equal(extensions=["png"])
+def test_pcolordropdata(fig_test, fig_ref):
+ ax = fig_test.subplots()
+ x = np.arange(0, 10)
+ y = np.arange(0, 4)
+ np.random.seed(19680801)
+ Z = np.random.randn(3, 9)
+ # fake dropping the data
+ ax.pcolormesh(x[:-1], y[:-1], Z[:-1, :-1], shading='flat')
+
+ ax = fig_ref.subplots()
+ # test dropping the data...
+ x2 = x[:-1]
+ y2 = y[:-1]
+ with pytest.warns(MatplotlibDeprecationWarning):
+ ax.pcolormesh(x2, y2, Z, shading='flat')
+
+
+@check_figures_equal(extensions=["png"])
+def test_pcolorauto(fig_test, fig_ref):
+ ax = fig_test.subplots()
+ x = np.arange(0, 10)
+ y = np.arange(0, 4)
+ np.random.seed(19680801)
+ Z = np.random.randn(3, 9)
+ ax.pcolormesh(x, y, Z, shading='auto')
+
+ ax = fig_ref.subplots()
+ # specify the centers
+ x2 = x[:-1] + np.diff(x) / 2
+ y2 = y[:-1] + np.diff(y) / 2
+ ax.pcolormesh(x2, y2, Z, shading='auto')
+
+
+@image_comparison(['canonical'])
+def test_canonical():
+ fig, ax = plt.subplots()
+ ax.plot([1, 2, 3])
+
+
+@image_comparison(['arc_angles.png'], remove_text=True, style='default')
+def test_arc_angles():
+ # Ellipse parameters
+ w = 2
+ h = 1
+ centre = (0.2, 0.5)
+ scale = 2
+
+ fig, axs = plt.subplots(3, 3)
+ for i, ax in enumerate(axs.flat):
+ theta2 = i * 360 / 9
+ theta1 = theta2 - 45
+
+ ax.add_patch(mpatches.Ellipse(centre, w, h, alpha=0.3))
+ ax.add_patch(mpatches.Arc(centre, w, h, theta1=theta1, theta2=theta2))
+ # Straight lines intersecting start and end of arc
+ ax.plot([scale * np.cos(np.deg2rad(theta1)) + centre[0],
+ centre[0],
+ scale * np.cos(np.deg2rad(theta2)) + centre[0]],
+ [scale * np.sin(np.deg2rad(theta1)) + centre[1],
+ centre[1],
+ scale * np.sin(np.deg2rad(theta2)) + centre[1]])
+
+ ax.set_xlim(-scale, scale)
+ ax.set_ylim(-scale, scale)
+
+ # This looks the same, but it triggers a different code path when it
+ # gets large enough.
+ w *= 10
+ h *= 10
+ centre = (centre[0] * 10, centre[1] * 10)
+ scale *= 10
+
+
+@image_comparison(['arc_ellipse'], remove_text=True)
+def test_arc_ellipse():
+ xcenter, ycenter = 0.38, 0.52
+ width, height = 1e-1, 3e-1
+ angle = -30
+
+ theta = np.deg2rad(np.arange(360))
+ x = width / 2. * np.cos(theta)
+ y = height / 2. * np.sin(theta)
+
+ rtheta = np.deg2rad(angle)
+ R = np.array([
+ [np.cos(rtheta), -np.sin(rtheta)],
+ [np.sin(rtheta), np.cos(rtheta)]])
+
+ x, y = np.dot(R, np.array([x, y]))
+ x += xcenter
+ y += ycenter
+
+ fig = plt.figure()
+ ax = fig.add_subplot(211, aspect='auto')
+ ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow',
+ linewidth=1, zorder=1)
+
+ e1 = mpatches.Arc((xcenter, ycenter), width, height,
+ angle=angle, linewidth=2, fill=False, zorder=2)
+
+ ax.add_patch(e1)
+
+ ax = fig.add_subplot(212, aspect='equal')
+ ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1)
+ e2 = mpatches.Arc((xcenter, ycenter), width, height,
+ angle=angle, linewidth=2, fill=False, zorder=2)
+
+ ax.add_patch(e2)
+
+
+def test_marker_as_markerstyle():
+ fix, ax = plt.subplots()
+ m = mmarkers.MarkerStyle('o')
+ ax.plot([1, 2, 3], [3, 2, 1], marker=m)
+ ax.scatter([1, 2, 3], [4, 3, 2], marker=m)
+ ax.errorbar([1, 2, 3], [5, 4, 3], marker=m)
+
+
+@image_comparison(['markevery'], remove_text=True)
+def test_markevery():
+ x = np.linspace(0, 10, 100)
+ y = np.sin(x) * np.sqrt(x/10 + 0.5)
+
+ # check marker only plot
+ fig, ax = plt.subplots()
+ ax.plot(x, y, 'o', label='default')
+ ax.plot(x, y, 'd', markevery=None, label='mark all')
+ ax.plot(x, y, 's', markevery=10, label='mark every 10')
+ ax.plot(x, y, '+', markevery=(5, 20), label='mark every 5 starting at 10')
+ ax.legend()
+
+
+@image_comparison(['markevery_line'], remove_text=True)
+def test_markevery_line():
+ x = np.linspace(0, 10, 100)
+ y = np.sin(x) * np.sqrt(x/10 + 0.5)
+
+ # check line/marker combos
+ fig, ax = plt.subplots()
+ ax.plot(x, y, '-o', label='default')
+ ax.plot(x, y, '-d', markevery=None, label='mark all')
+ ax.plot(x, y, '-s', markevery=10, label='mark every 10')
+ ax.plot(x, y, '-+', markevery=(5, 20), label='mark every 5 starting at 10')
+ ax.legend()
+
+
+@image_comparison(['markevery_linear_scales'], remove_text=True)
+def test_markevery_linear_scales():
+ cases = [None,
+ 8,
+ (30, 8),
+ [16, 24, 30], [0, -1],
+ slice(100, 200, 3),
+ 0.1, 0.3, 1.5,
+ (0.0, 0.1), (0.45, 0.1)]
+
+ cols = 3
+ gs = matplotlib.gridspec.GridSpec(len(cases) // cols + 1, cols)
+
+ delta = 0.11
+ x = np.linspace(0, 10 - 2 * delta, 200) + delta
+ y = np.sin(x) + 1.0 + delta
+
+ for i, case in enumerate(cases):
+ row = (i // cols)
+ col = i % cols
+ plt.subplot(gs[row, col])
+ plt.title('markevery=%s' % str(case))
+ plt.plot(x, y, 'o', ls='-', ms=4, markevery=case)
+
+
+@image_comparison(['markevery_linear_scales_zoomed'], remove_text=True)
+def test_markevery_linear_scales_zoomed():
+ cases = [None,
+ 8,
+ (30, 8),
+ [16, 24, 30], [0, -1],
+ slice(100, 200, 3),
+ 0.1, 0.3, 1.5,
+ (0.0, 0.1), (0.45, 0.1)]
+
+ cols = 3
+ gs = matplotlib.gridspec.GridSpec(len(cases) // cols + 1, cols)
+
+ delta = 0.11
+ x = np.linspace(0, 10 - 2 * delta, 200) + delta
+ y = np.sin(x) + 1.0 + delta
+
+ for i, case in enumerate(cases):
+ row = (i // cols)
+ col = i % cols
+ plt.subplot(gs[row, col])
+ plt.title('markevery=%s' % str(case))
+ plt.plot(x, y, 'o', ls='-', ms=4, markevery=case)
+ plt.xlim((6, 6.7))
+ plt.ylim((1.1, 1.7))
+
+
+@image_comparison(['markevery_log_scales'], remove_text=True)
+def test_markevery_log_scales():
+ cases = [None,
+ 8,
+ (30, 8),
+ [16, 24, 30], [0, -1],
+ slice(100, 200, 3),
+ 0.1, 0.3, 1.5,
+ (0.0, 0.1), (0.45, 0.1)]
+
+ cols = 3
+ gs = matplotlib.gridspec.GridSpec(len(cases) // cols + 1, cols)
+
+ delta = 0.11
+ x = np.linspace(0, 10 - 2 * delta, 200) + delta
+ y = np.sin(x) + 1.0 + delta
+
+ for i, case in enumerate(cases):
+ row = (i // cols)
+ col = i % cols
+ plt.subplot(gs[row, col])
+ plt.title('markevery=%s' % str(case))
+ plt.xscale('log')
+ plt.yscale('log')
+ plt.plot(x, y, 'o', ls='-', ms=4, markevery=case)
+
+
+@image_comparison(['markevery_polar'], style='default', remove_text=True)
+def test_markevery_polar():
+ cases = [None,
+ 8,
+ (30, 8),
+ [16, 24, 30], [0, -1],
+ slice(100, 200, 3),
+ 0.1, 0.3, 1.5,
+ (0.0, 0.1), (0.45, 0.1)]
+
+ cols = 3
+ gs = matplotlib.gridspec.GridSpec(len(cases) // cols + 1, cols)
+
+ r = np.linspace(0, 3.0, 200)
+ theta = 2 * np.pi * r
+
+ for i, case in enumerate(cases):
+ row = (i // cols)
+ col = i % cols
+ plt.subplot(gs[row, col], polar=True)
+ plt.title('markevery=%s' % str(case))
+ plt.plot(theta, r, 'o', ls='-', ms=4, markevery=case)
+
+
+@image_comparison(['marker_edges'], remove_text=True)
+def test_marker_edges():
+ x = np.linspace(0, 1, 10)
+ fig, ax = plt.subplots()
+ ax.plot(x, np.sin(x), 'y.', ms=30.0, mew=0, mec='r')
+ ax.plot(x+0.1, np.sin(x), 'y.', ms=30.0, mew=1, mec='r')
+ ax.plot(x+0.2, np.sin(x), 'y.', ms=30.0, mew=2, mec='b')
+
+
+@image_comparison(['bar_tick_label_single.png', 'bar_tick_label_single.png'])
+def test_bar_tick_label_single():
+ # From 2516: plot bar with array of string labels for x axis
+ ax = plt.gca()
+ ax.bar(0, 1, align='edge', tick_label='0')
+
+ # Reuse testcase from above for a labeled data test
+ data = {"a": 0, "b": 1}
+ fig, ax = plt.subplots()
+ ax = plt.gca()
+ ax.bar("a", "b", align='edge', tick_label='0', data=data)
+
+
+def test_nan_bar_values():
+ fig, ax = plt.subplots()
+ ax.bar([0, 1], [np.nan, 4])
+
+
+def test_bar_ticklabel_fail():
+ fig, ax = plt.subplots()
+ ax.bar([], [])
+
+
+@image_comparison(['bar_tick_label_multiple.png'])
+def test_bar_tick_label_multiple():
+ # From 2516: plot bar with array of string labels for x axis
+ ax = plt.gca()
+ ax.bar([1, 2.5], [1, 2], width=[0.2, 0.5], tick_label=['a', 'b'],
+ align='center')
+
+
+@image_comparison(['bar_tick_label_multiple_old_label_alignment.png'])
+def test_bar_tick_label_multiple_old_alignment():
+ # Test that the alignment for class is backward compatible
+ matplotlib.rcParams["ytick.alignment"] = "center"
+ ax = plt.gca()
+ ax.bar([1, 2.5], [1, 2], width=[0.2, 0.5], tick_label=['a', 'b'],
+ align='center')
+
+
+@check_figures_equal(extensions=["png"])
+def test_bar_decimal_center(fig_test, fig_ref):
+ ax = fig_test.subplots()
+ x0 = [1.5, 8.4, 5.3, 4.2]
+ y0 = [1.1, 2.2, 3.3, 4.4]
+ x = [Decimal(x) for x in x0]
+ y = [Decimal(y) for y in y0]
+ # Test image - vertical, align-center bar chart with Decimal() input
+ ax.bar(x, y, align='center')
+ # Reference image
+ ax = fig_ref.subplots()
+ ax.bar(x0, y0, align='center')
+
+
+@check_figures_equal(extensions=["png"])
+def test_barh_decimal_center(fig_test, fig_ref):
+ ax = fig_test.subplots()
+ x0 = [1.5, 8.4, 5.3, 4.2]
+ y0 = [1.1, 2.2, 3.3, 4.4]
+ x = [Decimal(x) for x in x0]
+ y = [Decimal(y) for y in y0]
+ # Test image - horizontal, align-center bar chart with Decimal() input
+ ax.barh(x, y, height=[0.5, 0.5, 1, 1], align='center')
+ # Reference image
+ ax = fig_ref.subplots()
+ ax.barh(x0, y0, height=[0.5, 0.5, 1, 1], align='center')
+
+
+@check_figures_equal(extensions=["png"])
+def test_bar_decimal_width(fig_test, fig_ref):
+ x = [1.5, 8.4, 5.3, 4.2]
+ y = [1.1, 2.2, 3.3, 4.4]
+ w0 = [0.7, 1.45, 1, 2]
+ w = [Decimal(i) for i in w0]
+ # Test image - vertical bar chart with Decimal() width
+ ax = fig_test.subplots()
+ ax.bar(x, y, width=w, align='center')
+ # Reference image
+ ax = fig_ref.subplots()
+ ax.bar(x, y, width=w0, align='center')
+
+
+@check_figures_equal(extensions=["png"])
+def test_barh_decimal_height(fig_test, fig_ref):
+ x = [1.5, 8.4, 5.3, 4.2]
+ y = [1.1, 2.2, 3.3, 4.4]
+ h0 = [0.7, 1.45, 1, 2]
+ h = [Decimal(i) for i in h0]
+ # Test image - horizontal bar chart with Decimal() height
+ ax = fig_test.subplots()
+ ax.barh(x, y, height=h, align='center')
+ # Reference image
+ ax = fig_ref.subplots()
+ ax.barh(x, y, height=h0, align='center')
+
+
+def test_bar_color_none_alpha():
+ ax = plt.gca()
+ rects = ax.bar([1, 2], [2, 4], alpha=0.3, color='none', edgecolor='r')
+ for rect in rects:
+ assert rect.get_facecolor() == (0, 0, 0, 0)
+ assert rect.get_edgecolor() == (1, 0, 0, 0.3)
+
+
+def test_bar_edgecolor_none_alpha():
+ ax = plt.gca()
+ rects = ax.bar([1, 2], [2, 4], alpha=0.3, color='r', edgecolor='none')
+ for rect in rects:
+ assert rect.get_facecolor() == (1, 0, 0, 0.3)
+ assert rect.get_edgecolor() == (0, 0, 0, 0)
+
+
+@image_comparison(['barh_tick_label.png'])
+def test_barh_tick_label():
+ # From 2516: plot barh with array of string labels for y axis
+ ax = plt.gca()
+ ax.barh([1, 2.5], [1, 2], height=[0.2, 0.5], tick_label=['a', 'b'],
+ align='center')
+
+
+def test_bar_timedelta():
+ """Smoketest that bar can handle width and height in delta units."""
+ fig, ax = plt.subplots()
+ ax.bar(datetime.datetime(2018, 1, 1), 1.,
+ width=datetime.timedelta(hours=3))
+ ax.bar(datetime.datetime(2018, 1, 1), 1.,
+ xerr=datetime.timedelta(hours=2),
+ width=datetime.timedelta(hours=3))
+ fig, ax = plt.subplots()
+ ax.barh(datetime.datetime(2018, 1, 1), 1,
+ height=datetime.timedelta(hours=3))
+ ax.barh(datetime.datetime(2018, 1, 1), 1,
+ height=datetime.timedelta(hours=3),
+ yerr=datetime.timedelta(hours=2))
+ fig, ax = plt.subplots()
+ ax.barh([datetime.datetime(2018, 1, 1), datetime.datetime(2018, 1, 1)],
+ np.array([1, 1.5]),
+ height=datetime.timedelta(hours=3))
+ ax.barh([datetime.datetime(2018, 1, 1), datetime.datetime(2018, 1, 1)],
+ np.array([1, 1.5]),
+ height=[datetime.timedelta(hours=t) for t in [1, 2]])
+ ax.broken_barh([(datetime.datetime(2018, 1, 1),
+ datetime.timedelta(hours=1))],
+ (10, 20))
+
+
+def test_boxplot_dates_pandas(pd):
+ # smoke test for boxplot and dates in pandas
+ data = np.random.rand(5, 2)
+ years = pd.date_range('1/1/2000',
+ periods=2, freq=pd.DateOffset(years=1)).year
+ plt.figure()
+ plt.boxplot(data, positions=years)
+
+
+def test_pcolor_regression(pd):
+ from pandas.plotting import (
+ register_matplotlib_converters,
+ deregister_matplotlib_converters,
+ )
+
+ fig = plt.figure()
+ ax = fig.add_subplot(111)
+
+ times = [datetime.datetime(2021, 1, 1)]
+ while len(times) < 7:
+ times.append(times[-1] + datetime.timedelta(seconds=120))
+
+ y_vals = np.arange(5)
+
+ time_axis, y_axis = np.meshgrid(times, y_vals)
+ shape = (len(y_vals) - 1, len(times) - 1)
+ z_data = np.arange(shape[0] * shape[1])
+
+ z_data.shape = shape
+ try:
+ register_matplotlib_converters()
+
+ im = ax.pcolormesh(time_axis, y_axis, z_data)
+ # make sure this does not raise!
+ fig.canvas.draw()
+ finally:
+ deregister_matplotlib_converters()
+
+
+def test_bar_pandas(pd):
+ # Smoke test for pandas
+ df = pd.DataFrame(
+ {'year': [2018, 2018, 2018],
+ 'month': [1, 1, 1],
+ 'day': [1, 2, 3],
+ 'value': [1, 2, 3]})
+ df['date'] = pd.to_datetime(df[['year', 'month', 'day']])
+
+ monthly = df[['date', 'value']].groupby(['date']).sum()
+ dates = monthly.index
+ forecast = monthly['value']
+ baseline = monthly['value']
+
+ fig, ax = plt.subplots()
+ ax.bar(dates, forecast, width=10, align='center')
+ ax.plot(dates, baseline, color='orange', lw=4)
+
+
+def test_bar_pandas_indexed(pd):
+ # Smoke test for indexed pandas
+ df = pd.DataFrame({"x": [1., 2., 3.], "width": [.2, .4, .6]},
+ index=[1, 2, 3])
+ fig, ax = plt.subplots()
+ ax.bar(df.x, 1., width=df.width)
+
+
+@check_figures_equal()
+@pytest.mark.style('default')
+def test_bar_hatches(fig_test, fig_ref):
+ ax_test = fig_test.subplots()
+ ax_ref = fig_ref.subplots()
+
+ x = [1, 2]
+ y = [2, 3]
+ hatches = ['x', 'o']
+ for i in range(2):
+ ax_ref.bar(x[i], y[i], color='C0', hatch=hatches[i])
+
+ ax_test.bar(x, y, hatch=hatches)
+
+
+def test_pandas_minimal_plot(pd):
+ # smoke test that series and index objcets do not warn
+ x = pd.Series([1, 2], dtype="float64")
+ plt.plot(x, x)
+ plt.plot(x.index, x)
+ plt.plot(x)
+ plt.plot(x.index)
+
+
+@image_comparison(['hist_log'], remove_text=True)
+def test_hist_log():
+ data0 = np.linspace(0, 1, 200)**3
+ data = np.concatenate([1 - data0, 1 + data0])
+ fig, ax = plt.subplots()
+ ax.hist(data, fill=False, log=True)
+
+
+@check_figures_equal(extensions=["png"])
+def test_hist_log_2(fig_test, fig_ref):
+ axs_test = fig_test.subplots(2, 3)
+ axs_ref = fig_ref.subplots(2, 3)
+ for i, histtype in enumerate(["bar", "step", "stepfilled"]):
+ # Set log scale, then call hist().
+ axs_test[0, i].set_yscale("log")
+ axs_test[0, i].hist(1, 1, histtype=histtype)
+ # Call hist(), then set log scale.
+ axs_test[1, i].hist(1, 1, histtype=histtype)
+ axs_test[1, i].set_yscale("log")
+ # Use hist(..., log=True).
+ for ax in axs_ref[:, i]:
+ ax.hist(1, 1, log=True, histtype=histtype)
+
+
+def test_hist_log_barstacked():
+ fig, axs = plt.subplots(2)
+ axs[0].hist([[0], [0, 1]], 2, histtype="barstacked")
+ axs[0].set_yscale("log")
+ axs[1].hist([0, 0, 1], 2, histtype="barstacked")
+ axs[1].set_yscale("log")
+ fig.canvas.draw()
+ assert axs[0].get_ylim() == axs[1].get_ylim()
+
+
+@image_comparison(['hist_bar_empty.png'], remove_text=True)
+def test_hist_bar_empty():
+ # From #3886: creating hist from empty dataset raises ValueError
+ ax = plt.gca()
+ ax.hist([], histtype='bar')
+
+
+@image_comparison(['hist_step_empty.png'], remove_text=True)
+def test_hist_step_empty():
+ # From #3886: creating hist from empty dataset raises ValueError
+ ax = plt.gca()
+ ax.hist([], histtype='step')
+
+
+@image_comparison(['hist_step_filled.png'], remove_text=True)
+def test_hist_step_filled():
+ np.random.seed(0)
+ x = np.random.randn(1000, 3)
+ n_bins = 10
+
+ kwargs = [{'fill': True}, {'fill': False}, {'fill': None}, {}]*2
+ types = ['step']*4+['stepfilled']*4
+ fig, axs = plt.subplots(nrows=2, ncols=4)
+
+ for kg, _type, ax in zip(kwargs, types, axs.flat):
+ ax.hist(x, n_bins, histtype=_type, stacked=True, **kg)
+ ax.set_title('%s/%s' % (kg, _type))
+ ax.set_ylim(bottom=-50)
+
+ patches = axs[0, 0].patches
+ assert all(p.get_facecolor() == p.get_edgecolor() for p in patches)
+
+
+@image_comparison(['hist_density.png'])
+def test_hist_density():
+ np.random.seed(19680801)
+ data = np.random.standard_normal(2000)
+ fig, ax = plt.subplots()
+ ax.hist(data, density=True)
+
+
+def test_hist_unequal_bins_density():
+ # Test correct behavior of normalized histogram with unequal bins
+ # https://github.com/matplotlib/matplotlib/issues/9557
+ rng = np.random.RandomState(57483)
+ t = rng.randn(100)
+ bins = [-3, -1, -0.5, 0, 1, 5]
+ mpl_heights, _, _ = plt.hist(t, bins=bins, density=True)
+ np_heights, _ = np.histogram(t, bins=bins, density=True)
+ assert_allclose(mpl_heights, np_heights)
+
+
+def test_hist_datetime_datasets():
+ data = [[datetime.datetime(2017, 1, 1), datetime.datetime(2017, 1, 1)],
+ [datetime.datetime(2017, 1, 1), datetime.datetime(2017, 1, 2)]]
+ fig, ax = plt.subplots()
+ ax.hist(data, stacked=True)
+ ax.hist(data, stacked=False)
+
+
+@pytest.mark.parametrize("bins_preprocess",
+ [mpl.dates.date2num,
+ lambda bins: bins,
+ lambda bins: np.asarray(bins).astype('datetime64')],
+ ids=['date2num', 'datetime.datetime',
+ 'np.datetime64'])
+def test_hist_datetime_datasets_bins(bins_preprocess):
+ data = [[datetime.datetime(2019, 1, 5), datetime.datetime(2019, 1, 11),
+ datetime.datetime(2019, 2, 1), datetime.datetime(2019, 3, 1)],
+ [datetime.datetime(2019, 1, 11), datetime.datetime(2019, 2, 5),
+ datetime.datetime(2019, 2, 18), datetime.datetime(2019, 3, 1)]]
+
+ date_edges = [datetime.datetime(2019, 1, 1), datetime.datetime(2019, 2, 1),
+ datetime.datetime(2019, 3, 1)]
+
+ fig, ax = plt.subplots()
+ _, bins, _ = ax.hist(data, bins=bins_preprocess(date_edges), stacked=True)
+ np.testing.assert_allclose(bins, mpl.dates.date2num(date_edges))
+
+ _, bins, _ = ax.hist(data, bins=bins_preprocess(date_edges), stacked=False)
+ np.testing.assert_allclose(bins, mpl.dates.date2num(date_edges))
+
+
+@pytest.mark.parametrize('data, expected_number_of_hists',
+ [([], 1),
+ ([[]], 1),
+ ([[], []], 2)])
+def test_hist_with_empty_input(data, expected_number_of_hists):
+ hists, _, _ = plt.hist(data)
+ hists = np.asarray(hists)
+
+ if hists.ndim == 1:
+ assert 1 == expected_number_of_hists
+ else:
+ assert hists.shape[0] == expected_number_of_hists
+
+
+@pytest.mark.parametrize("histtype, zorder",
+ [("bar", mpl.patches.Patch.zorder),
+ ("step", mpl.lines.Line2D.zorder),
+ ("stepfilled", mpl.patches.Patch.zorder)])
+def test_hist_zorder(histtype, zorder):
+ ax = plt.figure().add_subplot()
+ ax.hist([1, 2], histtype=histtype)
+ assert ax.patches
+ for patch in ax.patches:
+ assert patch.get_zorder() == zorder
+
+
+@check_figures_equal(extensions=['png'])
+def test_stairs(fig_test, fig_ref):
+ import matplotlib.lines as mlines
+ y = np.array([6, 14, 32, 37, 48, 32, 21, 4]) # hist
+ x = np.array([1., 2., 3., 4., 5., 6., 7., 8., 9.]) # bins
+
+ test_axes = fig_test.subplots(3, 2).flatten()
+ test_axes[0].stairs(y, x, baseline=None)
+ test_axes[1].stairs(y, x, baseline=None, orientation='horizontal')
+ test_axes[2].stairs(y, x)
+ test_axes[3].stairs(y, x, orientation='horizontal')
+ test_axes[4].stairs(y, x)
+ test_axes[4].semilogy()
+ test_axes[5].stairs(y, x, orientation='horizontal')
+ test_axes[5].semilogx()
+
+ # defaults of `PathPatch` to be used for all following Line2D
+ style = {'solid_joinstyle': 'miter', 'solid_capstyle': 'butt'}
+
+ ref_axes = fig_ref.subplots(3, 2).flatten()
+ ref_axes[0].plot(x, np.append(y, y[-1]), drawstyle='steps-post', **style)
+ ref_axes[1].plot(np.append(y[0], y), x, drawstyle='steps-post', **style)
+
+ ref_axes[2].plot(x, np.append(y, y[-1]), drawstyle='steps-post', **style)
+ ref_axes[2].add_line(mlines.Line2D([x[0], x[0]], [0, y[0]], **style))
+ ref_axes[2].add_line(mlines.Line2D([x[-1], x[-1]], [0, y[-1]], **style))
+ ref_axes[2].set_ylim(0, None)
+
+ ref_axes[3].plot(np.append(y[0], y), x, drawstyle='steps-post', **style)
+ ref_axes[3].add_line(mlines.Line2D([0, y[0]], [x[0], x[0]], **style))
+ ref_axes[3].add_line(mlines.Line2D([0, y[-1]], [x[-1], x[-1]], **style))
+ ref_axes[3].set_xlim(0, None)
+
+ ref_axes[4].plot(x, np.append(y, y[-1]), drawstyle='steps-post', **style)
+ ref_axes[4].add_line(mlines.Line2D([x[0], x[0]], [0, y[0]], **style))
+ ref_axes[4].add_line(mlines.Line2D([x[-1], x[-1]], [0, y[-1]], **style))
+ ref_axes[4].semilogy()
+
+ ref_axes[5].plot(np.append(y[0], y), x, drawstyle='steps-post', **style)
+ ref_axes[5].add_line(mlines.Line2D([0, y[0]], [x[0], x[0]], **style))
+ ref_axes[5].add_line(mlines.Line2D([0, y[-1]], [x[-1], x[-1]], **style))
+ ref_axes[5].semilogx()
+
+
+@check_figures_equal(extensions=['png'])
+def test_stairs_fill(fig_test, fig_ref):
+ h, bins = [1, 2, 3, 4, 2], [0, 1, 2, 3, 4, 5]
+ bs = -2
+ # Test
+ test_axes = fig_test.subplots(2, 2).flatten()
+ test_axes[0].stairs(h, bins, fill=True)
+ test_axes[1].stairs(h, bins, orientation='horizontal', fill=True)
+ test_axes[2].stairs(h, bins, baseline=bs, fill=True)
+ test_axes[3].stairs(h, bins, baseline=bs, orientation='horizontal',
+ fill=True)
+
+ # # Ref
+ ref_axes = fig_ref.subplots(2, 2).flatten()
+ ref_axes[0].fill_between(bins, np.append(h, h[-1]), step='post', lw=0)
+ ref_axes[0].set_ylim(0, None)
+ ref_axes[1].fill_betweenx(bins, np.append(h, h[-1]), step='post', lw=0)
+ ref_axes[1].set_xlim(0, None)
+ ref_axes[2].fill_between(bins, np.append(h, h[-1]),
+ np.ones(len(h)+1)*bs, step='post', lw=0)
+ ref_axes[2].set_ylim(bs, None)
+ ref_axes[3].fill_betweenx(bins, np.append(h, h[-1]),
+ np.ones(len(h)+1)*bs, step='post', lw=0)
+ ref_axes[3].set_xlim(bs, None)
+
+
+@check_figures_equal(extensions=['png'])
+def test_stairs_update(fig_test, fig_ref):
+ # fixed ylim because stairs() does autoscale, but updating data does not
+ ylim = -3, 4
+ # Test
+ test_ax = fig_test.add_subplot()
+ h = test_ax.stairs([1, 2, 3])
+ test_ax.set_ylim(ylim)
+ h.set_data([3, 2, 1])
+ h.set_data(edges=np.arange(4)+2)
+ h.set_data([1, 2, 1], np.arange(4)/2)
+ h.set_data([1, 2, 3])
+ h.set_data(None, np.arange(4))
+ assert np.allclose(h.get_data()[0], np.arange(1, 4))
+ assert np.allclose(h.get_data()[1], np.arange(4))
+ h.set_data(baseline=-2)
+ assert h.get_data().baseline == -2
+
+ # Ref
+ ref_ax = fig_ref.add_subplot()
+ h = ref_ax.stairs([1, 2, 3], baseline=-2)
+ ref_ax.set_ylim(ylim)
+
+
+@check_figures_equal(extensions=['png'])
+def test_stairs_baseline_0(fig_test, fig_ref):
+ # Test
+ test_ax = fig_test.add_subplot()
+ test_ax.stairs([5, 6, 7], baseline=None)
+
+ # Ref
+ ref_ax = fig_ref.add_subplot()
+ style = {'solid_joinstyle': 'miter', 'solid_capstyle': 'butt'}
+ ref_ax.plot(range(4), [5, 6, 7, 7], drawstyle='steps-post', **style)
+ ref_ax.set_ylim(0, None)
+
+
+def test_stairs_empty():
+ ax = plt.figure().add_subplot()
+ ax.stairs([], [42])
+ assert ax.get_xlim() == (39, 45)
+ assert ax.get_ylim() == (-0.06, 0.06)
+
+
+def test_stairs_invalid_nan():
+ with pytest.raises(ValueError, match='Nan values in "edges"'):
+ plt.stairs([1, 2], [0, np.nan, 1])
+
+
+def test_stairs_invalid_mismatch():
+ with pytest.raises(ValueError, match='Size mismatch'):
+ plt.stairs([1, 2], [0, 1])
+
+
+def test_stairs_invalid_update():
+ h = plt.stairs([1, 2], [0, 1, 2])
+ with pytest.raises(ValueError, match='Nan values in "edges"'):
+ h.set_data(edges=[1, np.nan, 2])
+
+
+def test_stairs_invalid_update2():
+ h = plt.stairs([1, 2], [0, 1, 2])
+ with pytest.raises(ValueError, match='Size mismatch'):
+ h.set_data(edges=np.arange(5))
+
+
+@image_comparison(['test_stairs_options.png'], remove_text=True)
+def test_stairs_options():
+ x, y = np.array([1, 2, 3, 4, 5]), np.array([1, 2, 3, 4]).astype(float)
+ yn = y.copy()
+ yn[1] = np.nan
+
+ fig, ax = plt.subplots()
+ ax.stairs(y*3, x, color='green', fill=True, label="A")
+ ax.stairs(y, x*3-3, color='red', fill=True,
+ orientation='horizontal', label="B")
+ ax.stairs(yn, x, color='orange', ls='--', lw=2, label="C")
+ ax.stairs(yn/3, x*3-2, ls='--', lw=2, baseline=0.5,
+ orientation='horizontal', label="D")
+ ax.stairs(y[::-1]*3+13, x-1, color='red', ls='--', lw=2, baseline=None,
+ label="E")
+ ax.stairs(y[::-1]*3+14, x, baseline=26,
+ color='purple', ls='--', lw=2, label="F")
+ ax.stairs(yn[::-1]*3+15, x+1, baseline=np.linspace(27, 25, len(y)),
+ color='blue', ls='--', lw=2, label="G", fill=True)
+ ax.stairs(y[:-1][::-1]*2+11, x[:-1]+0.5, color='black', ls='--', lw=2,
+ baseline=12, hatch='//', label="H")
+ ax.legend(loc=0)
+
+
+@image_comparison(['test_stairs_datetime.png'])
+def test_stairs_datetime():
+ f, ax = plt.subplots(constrained_layout=True)
+ ax.stairs(np.arange(36),
+ np.arange(np.datetime64('2001-12-27'),
+ np.datetime64('2002-02-02')))
+ plt.xticks(rotation=30)
+
+
+def contour_dat():
+ x = np.linspace(-3, 5, 150)
+ y = np.linspace(-3, 5, 120)
+ z = np.cos(x) + np.sin(y[:, np.newaxis])
+ return x, y, z
+
+
+@image_comparison(['contour_hatching'], remove_text=True, style='mpl20')
+def test_contour_hatching():
+ x, y, z = contour_dat()
+ fig, ax = plt.subplots()
+ ax.contourf(x, y, z, 7, hatches=['/', '\\', '//', '-'],
+ cmap=plt.get_cmap('gray'),
+ extend='both', alpha=0.5)
+
+
+@image_comparison(['contour_colorbar'], style='mpl20')
+def test_contour_colorbar():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ x, y, z = contour_dat()
+
+ fig, ax = plt.subplots()
+ cs = ax.contourf(x, y, z, levels=np.arange(-1.8, 1.801, 0.2),
+ cmap=plt.get_cmap('RdBu'),
+ vmin=-0.6,
+ vmax=0.6,
+ extend='both')
+ cs1 = ax.contour(x, y, z, levels=np.arange(-2.2, -0.599, 0.2),
+ colors=['y'],
+ linestyles='solid',
+ linewidths=2)
+ cs2 = ax.contour(x, y, z, levels=np.arange(0.6, 2.2, 0.2),
+ colors=['c'],
+ linewidths=2)
+ cbar = fig.colorbar(cs, ax=ax)
+ cbar.add_lines(cs1)
+ cbar.add_lines(cs2, erase=False)
+
+
+@image_comparison(['hist2d', 'hist2d'], remove_text=True, style='mpl20')
+def test_hist2d():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ np.random.seed(0)
+ # make it not symmetric in case we switch x and y axis
+ x = np.random.randn(100)*2+5
+ y = np.random.randn(100)-2
+ fig, ax = plt.subplots()
+ ax.hist2d(x, y, bins=10, rasterized=True)
+
+ # Reuse testcase from above for a labeled data test
+ data = {"x": x, "y": y}
+ fig, ax = plt.subplots()
+ ax.hist2d("x", "y", bins=10, data=data, rasterized=True)
+
+
+@image_comparison(['hist2d_transpose'], remove_text=True, style='mpl20')
+def test_hist2d_transpose():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ np.random.seed(0)
+ # make sure the output from np.histogram is transposed before
+ # passing to pcolorfast
+ x = np.array([5]*100)
+ y = np.random.randn(100)-2
+ fig, ax = plt.subplots()
+ ax.hist2d(x, y, bins=10, rasterized=True)
+
+
+def test_hist2d_density():
+ x, y = np.random.random((2, 100))
+ ax = plt.figure().subplots()
+ for obj in [ax, plt]:
+ obj.hist2d(x, y, density=True)
+
+
+class TestScatter:
+ @image_comparison(['scatter'], style='mpl20', remove_text=True)
+ def test_scatter_plot(self):
+ data = {"x": np.array([3, 4, 2, 6]), "y": np.array([2, 5, 2, 3]),
+ "c": ['r', 'y', 'b', 'lime'], "s": [24, 15, 19, 29],
+ "c2": ['0.5', '0.6', '0.7', '0.8']}
+
+ fig, ax = plt.subplots()
+ ax.scatter(data["x"] - 1., data["y"] - 1., c=data["c"], s=data["s"])
+ ax.scatter(data["x"] + 1., data["y"] + 1., c=data["c2"], s=data["s"])
+ ax.scatter("x", "y", c="c", s="s", data=data)
+
+ @image_comparison(['scatter_marker.png'], remove_text=True)
+ def test_scatter_marker(self):
+ fig, (ax0, ax1, ax2) = plt.subplots(ncols=3)
+ ax0.scatter([3, 4, 2, 6], [2, 5, 2, 3],
+ c=[(1, 0, 0), 'y', 'b', 'lime'],
+ s=[60, 50, 40, 30],
+ edgecolors=['k', 'r', 'g', 'b'],
+ marker='s')
+ ax1.scatter([3, 4, 2, 6], [2, 5, 2, 3],
+ c=[(1, 0, 0), 'y', 'b', 'lime'],
+ s=[60, 50, 40, 30],
+ edgecolors=['k', 'r', 'g', 'b'],
+ marker=mmarkers.MarkerStyle('o', fillstyle='top'))
+ # unit area ellipse
+ rx, ry = 3, 1
+ area = rx * ry * np.pi
+ theta = np.linspace(0, 2 * np.pi, 21)
+ verts = np.column_stack([np.cos(theta) * rx / area,
+ np.sin(theta) * ry / area])
+ ax2.scatter([3, 4, 2, 6], [2, 5, 2, 3],
+ c=[(1, 0, 0), 'y', 'b', 'lime'],
+ s=[60, 50, 40, 30],
+ edgecolors=['k', 'r', 'g', 'b'],
+ marker=verts)
+
+ @image_comparison(['scatter_2D'], remove_text=True, extensions=['png'])
+ def test_scatter_2D(self):
+ x = np.arange(3)
+ y = np.arange(2)
+ x, y = np.meshgrid(x, y)
+ z = x + y
+ fig, ax = plt.subplots()
+ ax.scatter(x, y, c=z, s=200, edgecolors='face')
+
+ @check_figures_equal(extensions=["png"])
+ def test_scatter_decimal(self, fig_test, fig_ref):
+ x0 = np.array([1.5, 8.4, 5.3, 4.2])
+ y0 = np.array([1.1, 2.2, 3.3, 4.4])
+ x = np.array([Decimal(i) for i in x0])
+ y = np.array([Decimal(i) for i in y0])
+ c = ['r', 'y', 'b', 'lime']
+ s = [24, 15, 19, 29]
+ # Test image - scatter plot with Decimal() input
+ ax = fig_test.subplots()
+ ax.scatter(x, y, c=c, s=s)
+ # Reference image
+ ax = fig_ref.subplots()
+ ax.scatter(x0, y0, c=c, s=s)
+
+ def test_scatter_color(self):
+ # Try to catch cases where 'c' kwarg should have been used.
+ with pytest.raises(ValueError):
+ plt.scatter([1, 2], [1, 2], color=[0.1, 0.2])
+ with pytest.raises(ValueError):
+ plt.scatter([1, 2, 3], [1, 2, 3], color=[1, 2, 3])
+
+ def test_scatter_unfilled(self):
+ coll = plt.scatter([0, 1, 2], [1, 3, 2], c=['0.1', '0.3', '0.5'],
+ marker=mmarkers.MarkerStyle('o', fillstyle='none'),
+ linewidths=[1.1, 1.2, 1.3])
+ assert coll.get_facecolors().shape == (0, 4) # no facecolors
+ assert_array_equal(coll.get_edgecolors(), [[0.1, 0.1, 0.1, 1],
+ [0.3, 0.3, 0.3, 1],
+ [0.5, 0.5, 0.5, 1]])
+ assert_array_equal(coll.get_linewidths(), [1.1, 1.2, 1.3])
+
+ @pytest.mark.style('default')
+ def test_scatter_unfillable(self):
+ coll = plt.scatter([0, 1, 2], [1, 3, 2], c=['0.1', '0.3', '0.5'],
+ marker='x',
+ linewidths=[1.1, 1.2, 1.3])
+ assert_array_equal(coll.get_facecolors(), coll.get_edgecolors())
+ assert_array_equal(coll.get_edgecolors(), [[0.1, 0.1, 0.1, 1],
+ [0.3, 0.3, 0.3, 1],
+ [0.5, 0.5, 0.5, 1]])
+ assert_array_equal(coll.get_linewidths(), [1.1, 1.2, 1.3])
+
+ def test_scatter_size_arg_size(self):
+ x = np.arange(4)
+ with pytest.raises(ValueError, match='same size as x and y'):
+ plt.scatter(x, x, x[1:])
+ with pytest.raises(ValueError, match='same size as x and y'):
+ plt.scatter(x[1:], x[1:], x)
+ with pytest.raises(ValueError, match='float array-like'):
+ plt.scatter(x, x, 'foo')
+
+ def test_scatter_edgecolor_RGB(self):
+ # Github issue 19066
+ coll = plt.scatter([1, 2, 3], [1, np.nan, np.nan],
+ edgecolor=(1, 0, 0))
+ assert mcolors.same_color(coll.get_edgecolor(), (1, 0, 0))
+ coll = plt.scatter([1, 2, 3, 4], [1, np.nan, np.nan, 1],
+ edgecolor=(1, 0, 0, 1))
+ assert mcolors.same_color(coll.get_edgecolor(), (1, 0, 0, 1))
+
+ @check_figures_equal(extensions=["png"])
+ def test_scatter_invalid_color(self, fig_test, fig_ref):
+ ax = fig_test.subplots()
+ cmap = plt.get_cmap("viridis", 16)
+ cmap.set_bad("k", 1)
+ # Set a nonuniform size to prevent the last call to `scatter` (plotting
+ # the invalid points separately in fig_ref) from using the marker
+ # stamping fast path, which would result in slightly offset markers.
+ ax.scatter(range(4), range(4),
+ c=[1, np.nan, 2, np.nan], s=[1, 2, 3, 4],
+ cmap=cmap, plotnonfinite=True)
+ ax = fig_ref.subplots()
+ cmap = plt.get_cmap("viridis", 16)
+ ax.scatter([0, 2], [0, 2], c=[1, 2], s=[1, 3], cmap=cmap)
+ ax.scatter([1, 3], [1, 3], s=[2, 4], color="k")
+
+ @check_figures_equal(extensions=["png"])
+ def test_scatter_no_invalid_color(self, fig_test, fig_ref):
+ # With plotninfinite=False we plot only 2 points.
+ ax = fig_test.subplots()
+ cmap = plt.get_cmap("viridis", 16)
+ cmap.set_bad("k", 1)
+ ax.scatter(range(4), range(4),
+ c=[1, np.nan, 2, np.nan], s=[1, 2, 3, 4],
+ cmap=cmap, plotnonfinite=False)
+ ax = fig_ref.subplots()
+ ax.scatter([0, 2], [0, 2], c=[1, 2], s=[1, 3], cmap=cmap)
+
+ @check_figures_equal(extensions=["png"])
+ def test_scatter_norm_vminvmax(self, fig_test, fig_ref):
+ """Parameters vmin, vmax should be ignored if norm is given."""
+ x = [1, 2, 3]
+ ax = fig_ref.subplots()
+ ax.scatter(x, x, c=x, vmin=0, vmax=5)
+ ax = fig_test.subplots()
+ with pytest.warns(MatplotlibDeprecationWarning,
+ match="Passing parameters norm and vmin/vmax "
+ "simultaneously is deprecated."):
+ ax.scatter(x, x, c=x, norm=mcolors.Normalize(-10, 10),
+ vmin=0, vmax=5)
+
+ @check_figures_equal(extensions=["png"])
+ def test_scatter_single_point(self, fig_test, fig_ref):
+ ax = fig_test.subplots()
+ ax.scatter(1, 1, c=1)
+ ax = fig_ref.subplots()
+ ax.scatter([1], [1], c=[1])
+
+ @check_figures_equal(extensions=["png"])
+ def test_scatter_different_shapes(self, fig_test, fig_ref):
+ x = np.arange(10)
+ ax = fig_test.subplots()
+ ax.scatter(x, x.reshape(2, 5), c=x.reshape(5, 2))
+ ax = fig_ref.subplots()
+ ax.scatter(x.reshape(5, 2), x, c=x.reshape(2, 5))
+
+ # Parameters for *test_scatter_c*. NB: assuming that the
+ # scatter plot will have 4 elements. The tuple scheme is:
+ # (*c* parameter case, exception regexp key or None if no exception)
+ params_test_scatter_c = [
+ # single string:
+ ('0.5', None),
+ # Single letter-sequences
+ (["rgby"], "conversion"),
+ # Special cases
+ ("red", None),
+ ("none", None),
+ (None, None),
+ (["r", "g", "b", "none"], None),
+ # Non-valid color spec (FWIW, 'jaune' means yellow in French)
+ ("jaune", "conversion"),
+ (["jaune"], "conversion"), # wrong type before wrong size
+ (["jaune"]*4, "conversion"),
+ # Value-mapping like
+ ([0.5]*3, None), # should emit a warning for user's eyes though
+ ([0.5]*4, None), # NB: no warning as matching size allows mapping
+ ([0.5]*5, "shape"),
+ # list of strings:
+ (['0.5', '0.4', '0.6', '0.7'], None),
+ (['0.5', 'red', '0.6', 'C5'], None),
+ (['0.5', 0.5, '0.6', 'C5'], "conversion"),
+ # RGB values
+ ([[1, 0, 0]], None),
+ ([[1, 0, 0]]*3, "shape"),
+ ([[1, 0, 0]]*4, None),
+ ([[1, 0, 0]]*5, "shape"),
+ # RGBA values
+ ([[1, 0, 0, 0.5]], None),
+ ([[1, 0, 0, 0.5]]*3, "shape"),
+ ([[1, 0, 0, 0.5]]*4, None),
+ ([[1, 0, 0, 0.5]]*5, "shape"),
+ # Mix of valid color specs
+ ([[1, 0, 0, 0.5]]*3 + [[1, 0, 0]], None),
+ ([[1, 0, 0, 0.5], "red", "0.0"], "shape"),
+ ([[1, 0, 0, 0.5], "red", "0.0", "C5"], None),
+ ([[1, 0, 0, 0.5], "red", "0.0", "C5", [0, 1, 0]], "shape"),
+ # Mix of valid and non valid color specs
+ ([[1, 0, 0, 0.5], "red", "jaune"], "conversion"),
+ ([[1, 0, 0, 0.5], "red", "0.0", "jaune"], "conversion"),
+ ([[1, 0, 0, 0.5], "red", "0.0", "C5", "jaune"], "conversion"),
+ ]
+
+ @pytest.mark.parametrize('c_case, re_key', params_test_scatter_c)
+ def test_scatter_c(self, c_case, re_key):
+ def get_next_color():
+ return 'blue' # currently unused
+
+ xsize = 4
+ # Additional checking of *c* (introduced in #11383).
+ REGEXP = {
+ "shape": "^'c' argument has [0-9]+ elements", # shape mismatch
+ "conversion": "^'c' argument must be a color", # bad vals
+ }
+
+ if re_key is None:
+ mpl.axes.Axes._parse_scatter_color_args(
+ c=c_case, edgecolors="black", kwargs={}, xsize=xsize,
+ get_next_color_func=get_next_color)
+ else:
+ with pytest.raises(ValueError, match=REGEXP[re_key]):
+ mpl.axes.Axes._parse_scatter_color_args(
+ c=c_case, edgecolors="black", kwargs={}, xsize=xsize,
+ get_next_color_func=get_next_color)
+
+ @pytest.mark.style('default')
+ @check_figures_equal(extensions=["png"])
+ def test_scatter_single_color_c(self, fig_test, fig_ref):
+ rgb = [[1, 0.5, 0.05]]
+ rgba = [[1, 0.5, 0.05, .5]]
+
+ # set via color kwarg
+ ax_ref = fig_ref.subplots()
+ ax_ref.scatter(np.ones(3), range(3), color=rgb)
+ ax_ref.scatter(np.ones(4)*2, range(4), color=rgba)
+
+ # set via broadcasting via c
+ ax_test = fig_test.subplots()
+ ax_test.scatter(np.ones(3), range(3), c=rgb)
+ ax_test.scatter(np.ones(4)*2, range(4), c=rgba)
+
+ def test_scatter_linewidths(self):
+ x = np.arange(5)
+
+ fig, ax = plt.subplots()
+ for i in range(3):
+ pc = ax.scatter(x, np.full(5, i), c=f'C{i}', marker='x', s=100,
+ linewidths=i + 1)
+ assert pc.get_linewidths() == i + 1
+
+ pc = ax.scatter(x, np.full(5, 3), c='C3', marker='x', s=100,
+ linewidths=[*range(1, 5), None])
+ assert_array_equal(pc.get_linewidths(),
+ [*range(1, 5), mpl.rcParams['lines.linewidth']])
+
+
+def _params(c=None, xsize=2, *, edgecolors=None, **kwargs):
+ return (c, edgecolors, kwargs if kwargs is not None else {}, xsize)
+_result = namedtuple('_result', 'c, colors')
+
+
+@pytest.mark.parametrize(
+ 'params, expected_result',
+ [(_params(),
+ _result(c='b', colors=np.array([[0, 0, 1, 1]]))),
+ (_params(c='r'),
+ _result(c='r', colors=np.array([[1, 0, 0, 1]]))),
+ (_params(c='r', colors='b'),
+ _result(c='r', colors=np.array([[1, 0, 0, 1]]))),
+ # color
+ (_params(color='b'),
+ _result(c='b', colors=np.array([[0, 0, 1, 1]]))),
+ (_params(color=['b', 'g']),
+ _result(c=['b', 'g'], colors=np.array([[0, 0, 1, 1], [0, .5, 0, 1]]))),
+ ])
+def test_parse_scatter_color_args(params, expected_result):
+ def get_next_color():
+ return 'blue' # currently unused
+
+ c, colors, _edgecolors = mpl.axes.Axes._parse_scatter_color_args(
+ *params, get_next_color_func=get_next_color)
+ assert c == expected_result.c
+ assert_allclose(colors, expected_result.colors)
+
+del _params
+del _result
+
+
+@pytest.mark.parametrize(
+ 'kwargs, expected_edgecolors',
+ [(dict(), None),
+ (dict(c='b'), None),
+ (dict(edgecolors='r'), 'r'),
+ (dict(edgecolors=['r', 'g']), ['r', 'g']),
+ (dict(edgecolor='r'), 'r'),
+ (dict(edgecolors='face'), 'face'),
+ (dict(edgecolors='none'), 'none'),
+ (dict(edgecolor='r', edgecolors='g'), 'r'),
+ (dict(c='b', edgecolor='r', edgecolors='g'), 'r'),
+ (dict(color='r'), 'r'),
+ (dict(color='r', edgecolor='g'), 'g'),
+ ])
+def test_parse_scatter_color_args_edgecolors(kwargs, expected_edgecolors):
+ def get_next_color():
+ return 'blue' # currently unused
+
+ c = kwargs.pop('c', None)
+ edgecolors = kwargs.pop('edgecolors', None)
+ _, _, result_edgecolors = \
+ mpl.axes.Axes._parse_scatter_color_args(
+ c, edgecolors, kwargs, xsize=2, get_next_color_func=get_next_color)
+ assert result_edgecolors == expected_edgecolors
+
+
+def test_parse_scatter_color_args_error():
+ def get_next_color():
+ return 'blue' # currently unused
+
+ with pytest.raises(ValueError,
+ match="RGBA values should be within 0-1 range"):
+ c = np.array([[0.1, 0.2, 0.7], [0.2, 0.4, 1.4]]) # value > 1
+ mpl.axes.Axes._parse_scatter_color_args(
+ c, None, kwargs={}, xsize=2, get_next_color_func=get_next_color)
+
+
+def test_as_mpl_axes_api():
+ # tests the _as_mpl_axes api
+ from matplotlib.projections.polar import PolarAxes
+
+ class Polar:
+ def __init__(self):
+ self.theta_offset = 0
+
+ def _as_mpl_axes(self):
+ # implement the matplotlib axes interface
+ return PolarAxes, {'theta_offset': self.theta_offset}
+
+ prj = Polar()
+ prj2 = Polar()
+ prj2.theta_offset = np.pi
+ prj3 = Polar()
+
+ # testing axes creation with plt.axes
+ ax = plt.axes([0, 0, 1, 1], projection=prj)
+ assert type(ax) == PolarAxes
+ with pytest.warns(
+ MatplotlibDeprecationWarning,
+ match=r'Calling gca\(\) with keyword arguments was deprecated'):
+ ax_via_gca = plt.gca(projection=prj)
+ assert ax_via_gca is ax
+ plt.close()
+
+ # testing axes creation with gca
+ with pytest.warns(
+ MatplotlibDeprecationWarning,
+ match=r'Calling gca\(\) with keyword arguments was deprecated'):
+ ax = plt.gca(projection=prj)
+ assert type(ax) == mpl.axes._subplots.subplot_class_factory(PolarAxes)
+ with pytest.warns(
+ MatplotlibDeprecationWarning,
+ match=r'Calling gca\(\) with keyword arguments was deprecated'):
+ ax_via_gca = plt.gca(projection=prj)
+ assert ax_via_gca is ax
+ # try getting the axes given a different polar projection
+ with pytest.warns(
+ MatplotlibDeprecationWarning,
+ match=r'Calling gca\(\) with keyword arguments was deprecated'):
+ ax_via_gca = plt.gca(projection=prj2)
+ assert ax_via_gca is ax
+ assert ax.get_theta_offset() == 0
+ # try getting the axes given an == (not is) polar projection
+ with pytest.warns(
+ MatplotlibDeprecationWarning,
+ match=r'Calling gca\(\) with keyword arguments was deprecated'):
+ ax_via_gca = plt.gca(projection=prj3)
+ assert ax_via_gca is ax
+ plt.close()
+
+ # testing axes creation with subplot
+ ax = plt.subplot(121, projection=prj)
+ assert type(ax) == mpl.axes._subplots.subplot_class_factory(PolarAxes)
+ plt.close()
+
+
+def test_pyplot_axes():
+ # test focusing of Axes in other Figure
+ fig1, ax1 = plt.subplots()
+ fig2, ax2 = plt.subplots()
+ plt.sca(ax1)
+ assert ax1 is plt.gca()
+ assert fig1 is plt.gcf()
+ plt.close(fig1)
+ plt.close(fig2)
+
+
+@image_comparison(['log_scales'])
+def test_log_scales():
+ fig, ax = plt.subplots()
+ ax.plot(np.log(np.linspace(0.1, 100)))
+ ax.set_yscale('log', base=5.5)
+ ax.invert_yaxis()
+ ax.set_xscale('log', base=9.0)
+
+
+def test_log_scales_no_data():
+ _, ax = plt.subplots()
+ ax.set(xscale="log", yscale="log")
+ ax.xaxis.set_major_locator(mticker.MultipleLocator(1))
+ assert ax.get_xlim() == ax.get_ylim() == (1, 10)
+
+
+def test_log_scales_invalid():
+ fig, ax = plt.subplots()
+ ax.set_xscale('log')
+ with pytest.warns(UserWarning, match='Attempted to set non-positive'):
+ ax.set_xlim(-1, 10)
+ ax.set_yscale('log')
+ with pytest.warns(UserWarning, match='Attempted to set non-positive'):
+ ax.set_ylim(-1, 10)
+
+
+@image_comparison(['stackplot_test_image', 'stackplot_test_image'])
+def test_stackplot():
+ fig = plt.figure()
+ x = np.linspace(0, 10, 10)
+ y1 = 1.0 * x
+ y2 = 2.0 * x + 1
+ y3 = 3.0 * x + 2
+ ax = fig.add_subplot(1, 1, 1)
+ ax.stackplot(x, y1, y2, y3)
+ ax.set_xlim((0, 10))
+ ax.set_ylim((0, 70))
+
+ # Reuse testcase from above for a labeled data test
+ data = {"x": x, "y1": y1, "y2": y2, "y3": y3}
+ fig, ax = plt.subplots()
+ ax.stackplot("x", "y1", "y2", "y3", data=data)
+ ax.set_xlim((0, 10))
+ ax.set_ylim((0, 70))
+
+
+@image_comparison(['stackplot_test_baseline'], remove_text=True)
+def test_stackplot_baseline():
+ np.random.seed(0)
+
+ def layers(n, m):
+ a = np.zeros((m, n))
+ for i in range(n):
+ for j in range(5):
+ x = 1 / (.1 + np.random.random())
+ y = 2 * np.random.random() - .5
+ z = 10 / (.1 + np.random.random())
+ a[:, i] += x * np.exp(-((np.arange(m) / m - y) * z) ** 2)
+ return a
+
+ d = layers(3, 100)
+ d[50, :] = 0 # test for fixed weighted wiggle (issue #6313)
+
+ fig, axs = plt.subplots(2, 2)
+
+ axs[0, 0].stackplot(range(100), d.T, baseline='zero')
+ axs[0, 1].stackplot(range(100), d.T, baseline='sym')
+ axs[1, 0].stackplot(range(100), d.T, baseline='wiggle')
+ axs[1, 1].stackplot(range(100), d.T, baseline='weighted_wiggle')
+
+
+def _bxp_test_helper(
+ stats_kwargs={}, transform_stats=lambda s: s, bxp_kwargs={}):
+ np.random.seed(937)
+ logstats = mpl.cbook.boxplot_stats(
+ np.random.lognormal(mean=1.25, sigma=1., size=(37, 4)), **stats_kwargs)
+ fig, ax = plt.subplots()
+ if bxp_kwargs.get('vert', True):
+ ax.set_yscale('log')
+ else:
+ ax.set_xscale('log')
+ # Work around baseline images generate back when bxp did not respect the
+ # boxplot.boxprops.linewidth rcParam when patch_artist is False.
+ if not bxp_kwargs.get('patch_artist', False):
+ mpl.rcParams['boxplot.boxprops.linewidth'] = \
+ mpl.rcParams['lines.linewidth']
+ ax.bxp(transform_stats(logstats), **bxp_kwargs)
+
+
+@image_comparison(['bxp_baseline.png'],
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_baseline():
+ _bxp_test_helper()
+
+
+@image_comparison(['bxp_rangewhis.png'],
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_rangewhis():
+ _bxp_test_helper(stats_kwargs=dict(whis=[0, 100]))
+
+
+@image_comparison(['bxp_percentilewhis.png'],
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_percentilewhis():
+ _bxp_test_helper(stats_kwargs=dict(whis=[5, 95]))
+
+
+@image_comparison(['bxp_with_xlabels.png'],
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_with_xlabels():
+ def transform(stats):
+ for s, label in zip(stats, list('ABCD')):
+ s['label'] = label
+ return stats
+
+ _bxp_test_helper(transform_stats=transform)
+
+
+@image_comparison(['bxp_horizontal.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default',
+ tol=0.1)
+def test_bxp_horizontal():
+ _bxp_test_helper(bxp_kwargs=dict(vert=False))
+
+
+@image_comparison(['bxp_with_ylabels.png'],
+ savefig_kwarg={'dpi': 40},
+ style='default',
+ tol=0.1)
+def test_bxp_with_ylabels():
+ def transform(stats):
+ for s, label in zip(stats, list('ABCD')):
+ s['label'] = label
+ return stats
+
+ _bxp_test_helper(transform_stats=transform, bxp_kwargs=dict(vert=False))
+
+
+@image_comparison(['bxp_patchartist.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_patchartist():
+ _bxp_test_helper(bxp_kwargs=dict(patch_artist=True))
+
+
+@image_comparison(['bxp_custompatchartist.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 100},
+ style='default')
+def test_bxp_custompatchartist():
+ _bxp_test_helper(bxp_kwargs=dict(
+ patch_artist=True,
+ boxprops=dict(facecolor='yellow', edgecolor='green', ls=':')))
+
+
+@image_comparison(['bxp_customoutlier.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_customoutlier():
+ _bxp_test_helper(bxp_kwargs=dict(
+ flierprops=dict(linestyle='none', marker='d', mfc='g')))
+
+
+@image_comparison(['bxp_withmean_custompoint.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_showcustommean():
+ _bxp_test_helper(bxp_kwargs=dict(
+ showmeans=True,
+ meanprops=dict(linestyle='none', marker='d', mfc='green'),
+ ))
+
+
+@image_comparison(['bxp_custombox.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_custombox():
+ _bxp_test_helper(bxp_kwargs=dict(
+ boxprops=dict(linestyle='--', color='b', lw=3)))
+
+
+@image_comparison(['bxp_custommedian.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_custommedian():
+ _bxp_test_helper(bxp_kwargs=dict(
+ medianprops=dict(linestyle='--', color='b', lw=3)))
+
+
+@image_comparison(['bxp_customcap.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_customcap():
+ _bxp_test_helper(bxp_kwargs=dict(
+ capprops=dict(linestyle='--', color='g', lw=3)))
+
+
+@image_comparison(['bxp_customwhisker.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_customwhisker():
+ _bxp_test_helper(bxp_kwargs=dict(
+ whiskerprops=dict(linestyle='-', color='m', lw=3)))
+
+
+@image_comparison(['bxp_withnotch.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_shownotches():
+ _bxp_test_helper(bxp_kwargs=dict(shownotches=True))
+
+
+@image_comparison(['bxp_nocaps.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_nocaps():
+ _bxp_test_helper(bxp_kwargs=dict(showcaps=False))
+
+
+@image_comparison(['bxp_nobox.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_nobox():
+ _bxp_test_helper(bxp_kwargs=dict(showbox=False))
+
+
+@image_comparison(['bxp_no_flier_stats.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_no_flier_stats():
+ def transform(stats):
+ for s in stats:
+ s.pop('fliers', None)
+ return stats
+
+ _bxp_test_helper(transform_stats=transform,
+ bxp_kwargs=dict(showfliers=False))
+
+
+@image_comparison(['bxp_withmean_point.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_showmean():
+ _bxp_test_helper(bxp_kwargs=dict(showmeans=True, meanline=False))
+
+
+@image_comparison(['bxp_withmean_line.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_showmeanasline():
+ _bxp_test_helper(bxp_kwargs=dict(showmeans=True, meanline=True))
+
+
+@image_comparison(['bxp_scalarwidth.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_scalarwidth():
+ _bxp_test_helper(bxp_kwargs=dict(widths=.25))
+
+
+@image_comparison(['bxp_customwidths.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_customwidths():
+ _bxp_test_helper(bxp_kwargs=dict(widths=[0.10, 0.25, 0.65, 0.85]))
+
+
+@image_comparison(['bxp_custompositions.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_bxp_custompositions():
+ _bxp_test_helper(bxp_kwargs=dict(positions=[1, 5, 6, 7]))
+
+
+def test_bxp_bad_widths():
+ with pytest.raises(ValueError):
+ _bxp_test_helper(bxp_kwargs=dict(widths=[1]))
+
+
+def test_bxp_bad_positions():
+ with pytest.raises(ValueError):
+ _bxp_test_helper(bxp_kwargs=dict(positions=[2, 3]))
+
+
+@image_comparison(['boxplot', 'boxplot'], tol=1.28, style='default')
+def test_boxplot():
+ # Randomness used for bootstrapping.
+ np.random.seed(937)
+
+ x = np.linspace(-7, 7, 140)
+ x = np.hstack([-25, x, 25])
+ fig, ax = plt.subplots()
+
+ ax.boxplot([x, x], bootstrap=10000, notch=1)
+ ax.set_ylim((-30, 30))
+
+ # Reuse testcase from above for a labeled data test
+ data = {"x": [x, x]}
+ fig, ax = plt.subplots()
+ ax.boxplot("x", bootstrap=10000, notch=1, data=data)
+ ax.set_ylim((-30, 30))
+
+
+@image_comparison(['boxplot_sym2.png'], remove_text=True, style='default')
+def test_boxplot_sym2():
+ # Randomness used for bootstrapping.
+ np.random.seed(937)
+
+ x = np.linspace(-7, 7, 140)
+ x = np.hstack([-25, x, 25])
+ fig, [ax1, ax2] = plt.subplots(1, 2)
+
+ ax1.boxplot([x, x], bootstrap=10000, sym='^')
+ ax1.set_ylim((-30, 30))
+
+ ax2.boxplot([x, x], bootstrap=10000, sym='g')
+ ax2.set_ylim((-30, 30))
+
+
+@image_comparison(['boxplot_sym.png'],
+ remove_text=True,
+ savefig_kwarg={'dpi': 40},
+ style='default')
+def test_boxplot_sym():
+ x = np.linspace(-7, 7, 140)
+ x = np.hstack([-25, x, 25])
+ fig, ax = plt.subplots()
+
+ ax.boxplot([x, x], sym='gs')
+ ax.set_ylim((-30, 30))
+
+
+@image_comparison(['boxplot_autorange_false_whiskers.png',
+ 'boxplot_autorange_true_whiskers.png'],
+ style='default')
+def test_boxplot_autorange_whiskers():
+ # Randomness used for bootstrapping.
+ np.random.seed(937)
+
+ x = np.ones(140)
+ x = np.hstack([0, x, 2])
+
+ fig1, ax1 = plt.subplots()
+ ax1.boxplot([x, x], bootstrap=10000, notch=1)
+ ax1.set_ylim((-5, 5))
+
+ fig2, ax2 = plt.subplots()
+ ax2.boxplot([x, x], bootstrap=10000, notch=1, autorange=True)
+ ax2.set_ylim((-5, 5))
+
+
+def _rc_test_bxp_helper(ax, rc_dict):
+ x = np.linspace(-7, 7, 140)
+ x = np.hstack([-25, x, 25])
+ with matplotlib.rc_context(rc_dict):
+ ax.boxplot([x, x])
+ return ax
+
+
+@image_comparison(['boxplot_rc_parameters'],
+ savefig_kwarg={'dpi': 100}, remove_text=True,
+ tol=1, style='default')
+def test_boxplot_rc_parameters():
+ # Randomness used for bootstrapping.
+ np.random.seed(937)
+
+ fig, ax = plt.subplots(3)
+
+ rc_axis0 = {
+ 'boxplot.notch': True,
+ 'boxplot.whiskers': [5, 95],
+ 'boxplot.bootstrap': 10000,
+
+ 'boxplot.flierprops.color': 'b',
+ 'boxplot.flierprops.marker': 'o',
+ 'boxplot.flierprops.markerfacecolor': 'g',
+ 'boxplot.flierprops.markeredgecolor': 'b',
+ 'boxplot.flierprops.markersize': 5,
+ 'boxplot.flierprops.linestyle': '--',
+ 'boxplot.flierprops.linewidth': 2.0,
+
+ 'boxplot.boxprops.color': 'r',
+ 'boxplot.boxprops.linewidth': 2.0,
+ 'boxplot.boxprops.linestyle': '--',
+
+ 'boxplot.capprops.color': 'c',
+ 'boxplot.capprops.linewidth': 2.0,
+ 'boxplot.capprops.linestyle': '--',
+
+ 'boxplot.medianprops.color': 'k',
+ 'boxplot.medianprops.linewidth': 2.0,
+ 'boxplot.medianprops.linestyle': '--',
+ }
+
+ rc_axis1 = {
+ 'boxplot.vertical': False,
+ 'boxplot.whiskers': [0, 100],
+ 'boxplot.patchartist': True,
+ }
+
+ rc_axis2 = {
+ 'boxplot.whiskers': 2.0,
+ 'boxplot.showcaps': False,
+ 'boxplot.showbox': False,
+ 'boxplot.showfliers': False,
+ 'boxplot.showmeans': True,
+ 'boxplot.meanline': True,
+
+ 'boxplot.meanprops.color': 'c',
+ 'boxplot.meanprops.linewidth': 2.0,
+ 'boxplot.meanprops.linestyle': '--',
+
+ 'boxplot.whiskerprops.color': 'r',
+ 'boxplot.whiskerprops.linewidth': 2.0,
+ 'boxplot.whiskerprops.linestyle': '-.',
+ }
+ dict_list = [rc_axis0, rc_axis1, rc_axis2]
+ for axis, rc_axis in zip(ax, dict_list):
+ _rc_test_bxp_helper(axis, rc_axis)
+
+ assert (matplotlib.patches.PathPatch in
+ [type(t) for t in ax[1].get_children()])
+
+
+@image_comparison(['boxplot_with_CIarray.png'],
+ remove_text=True, savefig_kwarg={'dpi': 40}, style='default')
+def test_boxplot_with_CIarray():
+ # Randomness used for bootstrapping.
+ np.random.seed(937)
+
+ x = np.linspace(-7, 7, 140)
+ x = np.hstack([-25, x, 25])
+ fig, ax = plt.subplots()
+ CIs = np.array([[-1.5, 3.], [-1., 3.5]])
+
+ # show a boxplot with Matplotlib medians and confidence intervals, and
+ # another with manual values
+ ax.boxplot([x, x], bootstrap=10000, usermedians=[None, 1.0],
+ conf_intervals=CIs, notch=1)
+ ax.set_ylim((-30, 30))
+
+
+@image_comparison(['boxplot_no_inverted_whisker.png'],
+ remove_text=True, savefig_kwarg={'dpi': 40}, style='default')
+def test_boxplot_no_weird_whisker():
+ x = np.array([3, 9000, 150, 88, 350, 200000, 1400, 960],
+ dtype=np.float64)
+ ax1 = plt.axes()
+ ax1.boxplot(x)
+ ax1.set_yscale('log')
+ ax1.yaxis.grid(False, which='minor')
+ ax1.xaxis.grid(False)
+
+
+def test_boxplot_bad_medians():
+ x = np.linspace(-7, 7, 140)
+ x = np.hstack([-25, x, 25])
+ fig, ax = plt.subplots()
+ with pytest.raises(ValueError):
+ ax.boxplot(x, usermedians=[1, 2])
+ with pytest.raises(ValueError):
+ ax.boxplot([x, x], usermedians=[[1, 2], [1, 2]])
+
+
+def test_boxplot_bad_ci():
+ x = np.linspace(-7, 7, 140)
+ x = np.hstack([-25, x, 25])
+ fig, ax = plt.subplots()
+ with pytest.raises(ValueError):
+ ax.boxplot([x, x], conf_intervals=[[1, 2]])
+ with pytest.raises(ValueError):
+ ax.boxplot([x, x], conf_intervals=[[1, 2], [1]])
+
+
+def test_boxplot_zorder():
+ x = np.arange(10)
+ fix, ax = plt.subplots()
+ assert ax.boxplot(x)['boxes'][0].get_zorder() == 2
+ assert ax.boxplot(x, zorder=10)['boxes'][0].get_zorder() == 10
+
+
+def test_boxplot_marker_behavior():
+ plt.rcParams['lines.marker'] = 's'
+ plt.rcParams['boxplot.flierprops.marker'] = 'o'
+ plt.rcParams['boxplot.meanprops.marker'] = '^'
+ fig, ax = plt.subplots()
+ test_data = np.arange(100)
+ test_data[-1] = 150 # a flier point
+ bxp_handle = ax.boxplot(test_data, showmeans=True)
+ for bxp_lines in ['whiskers', 'caps', 'boxes', 'medians']:
+ for each_line in bxp_handle[bxp_lines]:
+ # Ensure that the rcParams['lines.marker'] is overridden by ''
+ assert each_line.get_marker() == ''
+
+ # Ensure that markers for fliers and means aren't overridden with ''
+ assert bxp_handle['fliers'][0].get_marker() == 'o'
+ assert bxp_handle['means'][0].get_marker() == '^'
+
+
+@image_comparison(['boxplot_mod_artists_after_plotting.png'],
+ remove_text=True, savefig_kwarg={'dpi': 40}, style='default')
+def test_boxplot_mod_artist_after_plotting():
+ x = [0.15, 0.11, 0.06, 0.06, 0.12, 0.56, -0.56]
+ fig, ax = plt.subplots()
+ bp = ax.boxplot(x, sym="o")
+ for key in bp:
+ for obj in bp[key]:
+ obj.set_color('green')
+
+
+@image_comparison(['violinplot_vert_baseline.png',
+ 'violinplot_vert_baseline.png'])
+def test_vert_violinplot_baseline():
+ # First 9 digits of frac(sqrt(2))
+ np.random.seed(414213562)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax = plt.axes()
+ ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
+ showmedians=0)
+
+ # Reuse testcase from above for a labeled data test
+ data = {"d": data}
+ fig, ax = plt.subplots()
+ ax.violinplot("d", positions=range(4), showmeans=0, showextrema=0,
+ showmedians=0, data=data)
+
+
+@image_comparison(['violinplot_vert_showmeans.png'])
+def test_vert_violinplot_showmeans():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(3))
+ np.random.seed(732050807)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax.violinplot(data, positions=range(4), showmeans=1, showextrema=0,
+ showmedians=0)
+
+
+@image_comparison(['violinplot_vert_showextrema.png'])
+def test_vert_violinplot_showextrema():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(5))
+ np.random.seed(236067977)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax.violinplot(data, positions=range(4), showmeans=0, showextrema=1,
+ showmedians=0)
+
+
+@image_comparison(['violinplot_vert_showmedians.png'])
+def test_vert_violinplot_showmedians():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(7))
+ np.random.seed(645751311)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
+ showmedians=1)
+
+
+@image_comparison(['violinplot_vert_showall.png'])
+def test_vert_violinplot_showall():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(11))
+ np.random.seed(316624790)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax.violinplot(data, positions=range(4), showmeans=1, showextrema=1,
+ showmedians=1,
+ quantiles=[[0.1, 0.9], [0.2, 0.8], [0.3, 0.7], [0.4, 0.6]])
+
+
+@image_comparison(['violinplot_vert_custompoints_10.png'])
+def test_vert_violinplot_custompoints_10():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(13))
+ np.random.seed(605551275)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
+ showmedians=0, points=10)
+
+
+@image_comparison(['violinplot_vert_custompoints_200.png'])
+def test_vert_violinplot_custompoints_200():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(17))
+ np.random.seed(123105625)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
+ showmedians=0, points=200)
+
+
+@image_comparison(['violinplot_horiz_baseline.png'])
+def test_horiz_violinplot_baseline():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(19))
+ np.random.seed(358898943)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
+ showextrema=0, showmedians=0)
+
+
+@image_comparison(['violinplot_horiz_showmedians.png'])
+def test_horiz_violinplot_showmedians():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(23))
+ np.random.seed(795831523)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
+ showextrema=0, showmedians=1)
+
+
+@image_comparison(['violinplot_horiz_showmeans.png'])
+def test_horiz_violinplot_showmeans():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(29))
+ np.random.seed(385164807)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax.violinplot(data, positions=range(4), vert=False, showmeans=1,
+ showextrema=0, showmedians=0)
+
+
+@image_comparison(['violinplot_horiz_showextrema.png'])
+def test_horiz_violinplot_showextrema():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(31))
+ np.random.seed(567764362)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
+ showextrema=1, showmedians=0)
+
+
+@image_comparison(['violinplot_horiz_showall.png'])
+def test_horiz_violinplot_showall():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(37))
+ np.random.seed(82762530)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax.violinplot(data, positions=range(4), vert=False, showmeans=1,
+ showextrema=1, showmedians=1,
+ quantiles=[[0.1, 0.9], [0.2, 0.8], [0.3, 0.7], [0.4, 0.6]])
+
+
+@image_comparison(['violinplot_horiz_custompoints_10.png'])
+def test_horiz_violinplot_custompoints_10():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(41))
+ np.random.seed(403124237)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
+ showextrema=0, showmedians=0, points=10)
+
+
+@image_comparison(['violinplot_horiz_custompoints_200.png'])
+def test_horiz_violinplot_custompoints_200():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(43))
+ np.random.seed(557438524)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
+ showextrema=0, showmedians=0, points=200)
+
+
+def test_violinplot_bad_positions():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(47))
+ np.random.seed(855654600)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ with pytest.raises(ValueError):
+ ax.violinplot(data, positions=range(5))
+
+
+def test_violinplot_bad_widths():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(53))
+ np.random.seed(280109889)
+ data = [np.random.normal(size=100) for _ in range(4)]
+ with pytest.raises(ValueError):
+ ax.violinplot(data, positions=range(4), widths=[1, 2, 3])
+
+
+def test_violinplot_bad_quantiles():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(73))
+ np.random.seed(544003745)
+ data = [np.random.normal(size=100)]
+
+ # Different size quantile list and plots
+ with pytest.raises(ValueError):
+ ax.violinplot(data, quantiles=[[0.1, 0.2], [0.5, 0.7]])
+
+
+def test_violinplot_outofrange_quantiles():
+ ax = plt.axes()
+ # First 9 digits of frac(sqrt(79))
+ np.random.seed(888194417)
+ data = [np.random.normal(size=100)]
+
+ # Quantile value above 100
+ with pytest.raises(ValueError):
+ ax.violinplot(data, quantiles=[[0.1, 0.2, 0.3, 1.05]])
+
+ # Quantile value below 0
+ with pytest.raises(ValueError):
+ ax.violinplot(data, quantiles=[[-0.05, 0.2, 0.3, 0.75]])
+
+
+@check_figures_equal(extensions=["png"])
+def test_violinplot_single_list_quantiles(fig_test, fig_ref):
+ # Ensures quantile list for 1D can be passed in as single list
+ # First 9 digits of frac(sqrt(83))
+ np.random.seed(110433579)
+ data = [np.random.normal(size=100)]
+
+ # Test image
+ ax = fig_test.subplots()
+ ax.violinplot(data, quantiles=[0.1, 0.3, 0.9])
+
+ # Reference image
+ ax = fig_ref.subplots()
+ ax.violinplot(data, quantiles=[[0.1, 0.3, 0.9]])
+
+
+@check_figures_equal(extensions=["png"])
+def test_violinplot_pandas_series(fig_test, fig_ref, pd):
+ np.random.seed(110433579)
+ s1 = pd.Series(np.random.normal(size=7), index=[9, 8, 7, 6, 5, 4, 3])
+ s2 = pd.Series(np.random.normal(size=9), index=list('ABCDEFGHI'))
+ s3 = pd.Series(np.random.normal(size=11))
+ fig_test.subplots().violinplot([s1, s2, s3])
+ fig_ref.subplots().violinplot([s1.values, s2.values, s3.values])
+
+
+def test_manage_xticks():
+ _, ax = plt.subplots()
+ ax.set_xlim(0, 4)
+ old_xlim = ax.get_xlim()
+ np.random.seed(0)
+ y1 = np.random.normal(10, 3, 20)
+ y2 = np.random.normal(3, 1, 20)
+ ax.boxplot([y1, y2], positions=[1, 2], manage_ticks=False)
+ new_xlim = ax.get_xlim()
+ assert_array_equal(old_xlim, new_xlim)
+
+
+def test_boxplot_not_single():
+ fig, ax = plt.subplots()
+ ax.boxplot(np.random.rand(100), positions=[3])
+ ax.boxplot(np.random.rand(100), positions=[5])
+ fig.canvas.draw()
+ assert ax.get_xlim() == (2.5, 5.5)
+ assert list(ax.get_xticks()) == [3, 5]
+ assert [t.get_text() for t in ax.get_xticklabels()] == ["3", "5"]
+
+
+def test_tick_space_size_0():
+ # allow font size to be zero, which affects ticks when there is
+ # no other text in the figure.
+ plt.plot([0, 1], [0, 1])
+ matplotlib.rcParams.update({'font.size': 0})
+ b = io.BytesIO()
+ plt.savefig(b, dpi=80, format='raw')
+
+
+@image_comparison(['errorbar_basic', 'errorbar_mixed', 'errorbar_basic'])
+def test_errorbar():
+ x = np.arange(0.1, 4, 0.5)
+ y = np.exp(-x)
+
+ yerr = 0.1 + 0.2*np.sqrt(x)
+ xerr = 0.1 + yerr
+
+ # First illustrate basic pyplot interface, using defaults where possible.
+ fig = plt.figure()
+ ax = fig.gca()
+ ax.errorbar(x, y, xerr=0.2, yerr=0.4)
+ ax.set_title("Simplest errorbars, 0.2 in x, 0.4 in y")
+
+ # Now switch to a more OO interface to exercise more features.
+ fig, axs = plt.subplots(nrows=2, ncols=2, sharex=True)
+ ax = axs[0, 0]
+ ax.errorbar(x, y, yerr=yerr, fmt='o')
+ ax.set_title('Vert. symmetric')
+
+ # With 4 subplots, reduce the number of axis ticks to avoid crowding.
+ ax.locator_params(nbins=4)
+
+ ax = axs[0, 1]
+ ax.errorbar(x, y, xerr=xerr, fmt='o', alpha=0.4)
+ ax.set_title('Hor. symmetric w/ alpha')
+
+ ax = axs[1, 0]
+ ax.errorbar(x, y, yerr=[yerr, 2*yerr], xerr=[xerr, 2*xerr], fmt='--o')
+ ax.set_title('H, V asymmetric')
+
+ ax = axs[1, 1]
+ ax.set_yscale('log')
+ # Here we have to be careful to keep all y values positive:
+ ylower = np.maximum(1e-2, y - yerr)
+ yerr_lower = y - ylower
+
+ ax.errorbar(x, y, yerr=[yerr_lower, 2*yerr], xerr=xerr,
+ fmt='o', ecolor='g', capthick=2)
+ ax.set_title('Mixed sym., log y')
+
+ fig.suptitle('Variable errorbars')
+
+ # Reuse the first testcase from above for a labeled data test
+ data = {"x": x, "y": y}
+ fig = plt.figure()
+ ax = fig.gca()
+ ax.errorbar("x", "y", xerr=0.2, yerr=0.4, data=data)
+ ax.set_title("Simplest errorbars, 0.2 in x, 0.4 in y")
+
+
+def test_errorbar_colorcycle():
+
+ f, ax = plt.subplots()
+ x = np.arange(10)
+ y = 2*x
+
+ e1, _, _ = ax.errorbar(x, y, c=None)
+ e2, _, _ = ax.errorbar(x, 2*y, c=None)
+ ln1, = ax.plot(x, 4*y)
+
+ assert mcolors.to_rgba(e1.get_color()) == mcolors.to_rgba('C0')
+ assert mcolors.to_rgba(e2.get_color()) == mcolors.to_rgba('C1')
+ assert mcolors.to_rgba(ln1.get_color()) == mcolors.to_rgba('C2')
+
+
+@check_figures_equal()
+def test_errorbar_cycle_ecolor(fig_test, fig_ref):
+ x = np.arange(0.1, 4, 0.5)
+ y = [np.exp(-x+n) for n in range(4)]
+
+ axt = fig_test.subplots()
+ axr = fig_ref.subplots()
+
+ for yi, color in zip(y, ['C0', 'C1', 'C2', 'C3']):
+ axt.errorbar(x, yi, yerr=(yi * 0.25), linestyle='-',
+ marker='o', ecolor='black')
+ axr.errorbar(x, yi, yerr=(yi * 0.25), linestyle='-',
+ marker='o', color=color, ecolor='black')
+
+
+def test_errorbar_shape():
+ fig = plt.figure()
+ ax = fig.gca()
+
+ x = np.arange(0.1, 4, 0.5)
+ y = np.exp(-x)
+ yerr1 = 0.1 + 0.2*np.sqrt(x)
+ yerr = np.vstack((yerr1, 2*yerr1)).T
+ xerr = 0.1 + yerr
+
+ with pytest.raises(ValueError):
+ ax.errorbar(x, y, yerr=yerr, fmt='o')
+ with pytest.raises(ValueError):
+ ax.errorbar(x, y, xerr=xerr, fmt='o')
+ with pytest.raises(ValueError):
+ ax.errorbar(x, y, yerr=yerr, xerr=xerr, fmt='o')
+
+
+@image_comparison(['errorbar_limits'])
+def test_errorbar_limits():
+ x = np.arange(0.5, 5.5, 0.5)
+ y = np.exp(-x)
+ xerr = 0.1
+ yerr = 0.2
+ ls = 'dotted'
+
+ fig, ax = plt.subplots()
+
+ # standard error bars
+ ax.errorbar(x, y, xerr=xerr, yerr=yerr, ls=ls, color='blue')
+
+ # including upper limits
+ uplims = np.zeros_like(x)
+ uplims[[1, 5, 9]] = True
+ ax.errorbar(x, y+0.5, xerr=xerr, yerr=yerr, uplims=uplims, ls=ls,
+ color='green')
+
+ # including lower limits
+ lolims = np.zeros_like(x)
+ lolims[[2, 4, 8]] = True
+ ax.errorbar(x, y+1.0, xerr=xerr, yerr=yerr, lolims=lolims, ls=ls,
+ color='red')
+
+ # including upper and lower limits
+ ax.errorbar(x, y+1.5, marker='o', ms=8, xerr=xerr, yerr=yerr,
+ lolims=lolims, uplims=uplims, ls=ls, color='magenta')
+
+ # including xlower and xupper limits
+ xerr = 0.2
+ yerr = np.full_like(x, 0.2)
+ yerr[[3, 6]] = 0.3
+ xlolims = lolims
+ xuplims = uplims
+ lolims = np.zeros_like(x)
+ uplims = np.zeros_like(x)
+ lolims[[6]] = True
+ uplims[[3]] = True
+ ax.errorbar(x, y+2.1, marker='o', ms=8, xerr=xerr, yerr=yerr,
+ xlolims=xlolims, xuplims=xuplims, uplims=uplims,
+ lolims=lolims, ls='none', mec='blue', capsize=0,
+ color='cyan')
+ ax.set_xlim((0, 5.5))
+ ax.set_title('Errorbar upper and lower limits')
+
+
+def test_errobar_nonefmt():
+ # Check that passing 'none' as a format still plots errorbars
+ x = np.arange(5)
+ y = np.arange(5)
+
+ plotline, _, barlines = plt.errorbar(x, y, xerr=1, yerr=1, fmt='none')
+ assert plotline is None
+ for errbar in barlines:
+ assert np.all(errbar.get_color() == mcolors.to_rgba('C0'))
+
+
+def test_errorbar_line_specific_kwargs():
+ # Check that passing line-specific keyword arguments will not result in
+ # errors.
+ x = np.arange(5)
+ y = np.arange(5)
+
+ plotline, _, _ = plt.errorbar(x, y, xerr=1, yerr=1, ls='None',
+ marker='s', fillstyle='full',
+ drawstyle='steps-mid',
+ dash_capstyle='round',
+ dash_joinstyle='miter',
+ solid_capstyle='butt',
+ solid_joinstyle='bevel')
+ assert plotline.get_fillstyle() == 'full'
+ assert plotline.get_drawstyle() == 'steps-mid'
+
+
+@check_figures_equal(extensions=['png'])
+def test_errorbar_with_prop_cycle(fig_test, fig_ref):
+ ax = fig_ref.subplots()
+ ax.errorbar(x=[2, 4, 10], y=[0, 1, 2], yerr=0.5,
+ ls='--', marker='s', mfc='k')
+ ax.errorbar(x=[2, 4, 10], y=[2, 3, 4], yerr=0.5, color='tab:green',
+ ls=':', marker='s', mfc='y')
+ ax.errorbar(x=[2, 4, 10], y=[4, 5, 6], yerr=0.5, fmt='tab:blue',
+ ls='-.', marker='o', mfc='c')
+ ax.set_xlim(1, 11)
+
+ _cycle = cycler(ls=['--', ':', '-.'], marker=['s', 's', 'o'],
+ mfc=['k', 'y', 'c'], color=['b', 'g', 'r'])
+ plt.rc("axes", prop_cycle=_cycle)
+ ax = fig_test.subplots()
+ ax.errorbar(x=[2, 4, 10], y=[0, 1, 2], yerr=0.5)
+ ax.errorbar(x=[2, 4, 10], y=[2, 3, 4], yerr=0.5, color='tab:green')
+ ax.errorbar(x=[2, 4, 10], y=[4, 5, 6], yerr=0.5, fmt='tab:blue')
+ ax.set_xlim(1, 11)
+
+
+def test_errorbar_every_invalid():
+ x = np.linspace(0, 1, 15)
+ y = x * (1-x)
+ yerr = y/6
+
+ ax = plt.figure().subplots()
+
+ with pytest.raises(ValueError, match='not a tuple of two integers'):
+ ax.errorbar(x, y, yerr, errorevery=(1, 2, 3))
+ with pytest.raises(ValueError, match='not a tuple of two integers'):
+ ax.errorbar(x, y, yerr, errorevery=(1.3, 3))
+ with pytest.raises(ValueError, match='not a valid NumPy fancy index'):
+ ax.errorbar(x, y, yerr, errorevery=[False, True])
+ with pytest.raises(ValueError, match='not a recognized value'):
+ ax.errorbar(x, y, yerr, errorevery='foobar')
+
+
+@check_figures_equal()
+def test_errorbar_every(fig_test, fig_ref):
+ x = np.linspace(0, 1, 15)
+ y = x * (1-x)
+ yerr = y/6
+
+ ax_ref = fig_ref.subplots()
+ ax_test = fig_test.subplots()
+
+ for color, shift in zip('rgbk', [0, 0, 2, 7]):
+ y += .02
+
+ # Check errorevery using an explicit offset and step.
+ ax_test.errorbar(x, y, yerr, errorevery=(shift, 4),
+ capsize=4, c=color)
+
+ # Using manual errorbars
+ # n.b. errorbar draws the main plot at z=2.1 by default
+ ax_ref.plot(x, y, c=color, zorder=2.1)
+ ax_ref.errorbar(x[shift::4], y[shift::4], yerr[shift::4],
+ capsize=4, c=color, fmt='none')
+
+ # Check that markevery is propagated to line, without affecting errorbars.
+ ax_test.errorbar(x, y + 0.1, yerr, markevery=(1, 4), capsize=4, fmt='o')
+ ax_ref.plot(x[1::4], y[1::4] + 0.1, 'o', zorder=2.1)
+ ax_ref.errorbar(x, y + 0.1, yerr, capsize=4, fmt='none')
+
+ # Check that passing a slice to markevery/errorevery works.
+ ax_test.errorbar(x, y + 0.2, yerr, errorevery=slice(2, None, 3),
+ markevery=slice(2, None, 3),
+ capsize=4, c='C0', fmt='o')
+ ax_ref.plot(x[2::3], y[2::3] + 0.2, 'o', c='C0', zorder=2.1)
+ ax_ref.errorbar(x[2::3], y[2::3] + 0.2, yerr[2::3],
+ capsize=4, c='C0', fmt='none')
+
+ # Check that passing an iterable to markevery/errorevery works.
+ ax_test.errorbar(x, y + 0.2, yerr, errorevery=[False, True, False] * 5,
+ markevery=[False, True, False] * 5,
+ capsize=4, c='C1', fmt='o')
+ ax_ref.plot(x[1::3], y[1::3] + 0.2, 'o', c='C1', zorder=2.1)
+ ax_ref.errorbar(x[1::3], y[1::3] + 0.2, yerr[1::3],
+ capsize=4, c='C1', fmt='none')
+
+
+@pytest.mark.parametrize('elinewidth', [[1, 2, 3],
+ np.array([1, 2, 3]),
+ 1])
+def test_errorbar_linewidth_type(elinewidth):
+ plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinewidth=elinewidth)
+
+
+@image_comparison(['hist_stacked_stepfilled', 'hist_stacked_stepfilled'])
+def test_hist_stacked_stepfilled():
+ # make some data
+ d1 = np.linspace(1, 3, 20)
+ d2 = np.linspace(0, 10, 50)
+ fig, ax = plt.subplots()
+ ax.hist((d1, d2), histtype="stepfilled", stacked=True)
+
+ # Reuse testcase from above for a labeled data test
+ data = {"x": (d1, d2)}
+ fig, ax = plt.subplots()
+ ax.hist("x", histtype="stepfilled", stacked=True, data=data)
+
+
+@image_comparison(['hist_offset'])
+def test_hist_offset():
+ # make some data
+ d1 = np.linspace(0, 10, 50)
+ d2 = np.linspace(1, 3, 20)
+ fig, ax = plt.subplots()
+ ax.hist(d1, bottom=5)
+ ax.hist(d2, bottom=15)
+
+
+@image_comparison(['hist_step.png'], remove_text=True)
+def test_hist_step():
+ # make some data
+ d1 = np.linspace(1, 3, 20)
+ fig, ax = plt.subplots()
+ ax.hist(d1, histtype="step")
+ ax.set_ylim(0, 10)
+ ax.set_xlim(-1, 5)
+
+
+@image_comparison(['hist_step_horiz.png'])
+def test_hist_step_horiz():
+ # make some data
+ d1 = np.linspace(0, 10, 50)
+ d2 = np.linspace(1, 3, 20)
+ fig, ax = plt.subplots()
+ ax.hist((d1, d2), histtype="step", orientation="horizontal")
+
+
+@image_comparison(['hist_stacked_weights'])
+def test_hist_stacked_weighted():
+ # make some data
+ d1 = np.linspace(0, 10, 50)
+ d2 = np.linspace(1, 3, 20)
+ w1 = np.linspace(0.01, 3.5, 50)
+ w2 = np.linspace(0.05, 2., 20)
+ fig, ax = plt.subplots()
+ ax.hist((d1, d2), weights=(w1, w2), histtype="stepfilled", stacked=True)
+
+
+@pytest.mark.parametrize("use_line_collection", [True, False],
+ ids=['w/ line collection', 'w/o line collection'])
+@image_comparison(['stem.png'], style='mpl20', remove_text=True)
+def test_stem(use_line_collection):
+ x = np.linspace(0.1, 2 * np.pi, 100)
+
+ fig, ax = plt.subplots()
+ # Label is a single space to force a legend to be drawn, but to avoid any
+ # text being drawn
+ ax.stem(x, np.cos(x),
+ linefmt='C2-.', markerfmt='k+', basefmt='C1-.', label=' ',
+ use_line_collection=use_line_collection)
+ ax.legend()
+
+
+def test_stem_args():
+ fig, ax = plt.subplots()
+
+ x = list(range(10))
+ y = list(range(10))
+
+ # Test the call signatures
+ ax.stem(y)
+ ax.stem(x, y)
+ ax.stem(x, y, 'r--')
+ ax.stem(x, y, 'r--', basefmt='b--')
+
+
+def test_stem_dates():
+ fig, ax = plt.subplots(1, 1)
+ xs = [dateutil.parser.parse("2013-9-28 11:00:00"),
+ dateutil.parser.parse("2013-9-28 12:00:00")]
+ ys = [100, 200]
+ ax.stem(xs, ys, "*-")
+
+
+@pytest.mark.parametrize("use_line_collection", [True, False],
+ ids=['w/ line collection', 'w/o line collection'])
+@image_comparison(['stem_orientation.png'], style='mpl20', remove_text=True)
+def test_stem_orientation(use_line_collection):
+ x = np.linspace(0.1, 2*np.pi, 50)
+
+ fig, ax = plt.subplots()
+ ax.stem(x, np.cos(x),
+ linefmt='C2-.', markerfmt='kx', basefmt='C1-.',
+ use_line_collection=use_line_collection, orientation='horizontal')
+
+
+@image_comparison(['hist_stacked_stepfilled_alpha'])
+def test_hist_stacked_stepfilled_alpha():
+ # make some data
+ d1 = np.linspace(1, 3, 20)
+ d2 = np.linspace(0, 10, 50)
+ fig, ax = plt.subplots()
+ ax.hist((d1, d2), histtype="stepfilled", stacked=True, alpha=0.5)
+
+
+@image_comparison(['hist_stacked_step'])
+def test_hist_stacked_step():
+ # make some data
+ d1 = np.linspace(1, 3, 20)
+ d2 = np.linspace(0, 10, 50)
+ fig, ax = plt.subplots()
+ ax.hist((d1, d2), histtype="step", stacked=True)
+
+
+@image_comparison(['hist_stacked_normed'])
+def test_hist_stacked_density():
+ # make some data
+ d1 = np.linspace(1, 3, 20)
+ d2 = np.linspace(0, 10, 50)
+ fig, ax = plt.subplots()
+ ax.hist((d1, d2), stacked=True, density=True)
+
+
+@image_comparison(['hist_step_bottom.png'], remove_text=True)
+def test_hist_step_bottom():
+ # make some data
+ d1 = np.linspace(1, 3, 20)
+ fig, ax = plt.subplots()
+ ax.hist(d1, bottom=np.arange(10), histtype="stepfilled")
+
+
+def test_hist_stepfilled_geometry():
+ bins = [0, 1, 2, 3]
+ data = [0, 0, 1, 1, 1, 2]
+ _, _, (polygon, ) = plt.hist(data,
+ bins=bins,
+ histtype='stepfilled')
+ xy = [[0, 0], [0, 2], [1, 2], [1, 3], [2, 3], [2, 1], [3, 1],
+ [3, 0], [2, 0], [2, 0], [1, 0], [1, 0], [0, 0]]
+ assert_array_equal(polygon.get_xy(), xy)
+
+
+def test_hist_step_geometry():
+ bins = [0, 1, 2, 3]
+ data = [0, 0, 1, 1, 1, 2]
+ _, _, (polygon, ) = plt.hist(data,
+ bins=bins,
+ histtype='step')
+ xy = [[0, 0], [0, 2], [1, 2], [1, 3], [2, 3], [2, 1], [3, 1], [3, 0]]
+ assert_array_equal(polygon.get_xy(), xy)
+
+
+def test_hist_stepfilled_bottom_geometry():
+ bins = [0, 1, 2, 3]
+ data = [0, 0, 1, 1, 1, 2]
+ _, _, (polygon, ) = plt.hist(data,
+ bins=bins,
+ bottom=[1, 2, 1.5],
+ histtype='stepfilled')
+ xy = [[0, 1], [0, 3], [1, 3], [1, 5], [2, 5], [2, 2.5], [3, 2.5],
+ [3, 1.5], [2, 1.5], [2, 2], [1, 2], [1, 1], [0, 1]]
+ assert_array_equal(polygon.get_xy(), xy)
+
+
+def test_hist_step_bottom_geometry():
+ bins = [0, 1, 2, 3]
+ data = [0, 0, 1, 1, 1, 2]
+ _, _, (polygon, ) = plt.hist(data,
+ bins=bins,
+ bottom=[1, 2, 1.5],
+ histtype='step')
+ xy = [[0, 1], [0, 3], [1, 3], [1, 5], [2, 5], [2, 2.5], [3, 2.5], [3, 1.5]]
+ assert_array_equal(polygon.get_xy(), xy)
+
+
+def test_hist_stacked_stepfilled_geometry():
+ bins = [0, 1, 2, 3]
+ data_1 = [0, 0, 1, 1, 1, 2]
+ data_2 = [0, 1, 2]
+ _, _, patches = plt.hist([data_1, data_2],
+ bins=bins,
+ stacked=True,
+ histtype='stepfilled')
+
+ assert len(patches) == 2
+
+ polygon, = patches[0]
+ xy = [[0, 0], [0, 2], [1, 2], [1, 3], [2, 3], [2, 1], [3, 1],
+ [3, 0], [2, 0], [2, 0], [1, 0], [1, 0], [0, 0]]
+ assert_array_equal(polygon.get_xy(), xy)
+
+ polygon, = patches[1]
+ xy = [[0, 2], [0, 3], [1, 3], [1, 4], [2, 4], [2, 2], [3, 2],
+ [3, 1], [2, 1], [2, 3], [1, 3], [1, 2], [0, 2]]
+ assert_array_equal(polygon.get_xy(), xy)
+
+
+def test_hist_stacked_step_geometry():
+ bins = [0, 1, 2, 3]
+ data_1 = [0, 0, 1, 1, 1, 2]
+ data_2 = [0, 1, 2]
+ _, _, patches = plt.hist([data_1, data_2],
+ bins=bins,
+ stacked=True,
+ histtype='step')
+
+ assert len(patches) == 2
+
+ polygon, = patches[0]
+ xy = [[0, 0], [0, 2], [1, 2], [1, 3], [2, 3], [2, 1], [3, 1], [3, 0]]
+ assert_array_equal(polygon.get_xy(), xy)
+
+ polygon, = patches[1]
+ xy = [[0, 2], [0, 3], [1, 3], [1, 4], [2, 4], [2, 2], [3, 2], [3, 1]]
+ assert_array_equal(polygon.get_xy(), xy)
+
+
+def test_hist_stacked_stepfilled_bottom_geometry():
+ bins = [0, 1, 2, 3]
+ data_1 = [0, 0, 1, 1, 1, 2]
+ data_2 = [0, 1, 2]
+ _, _, patches = plt.hist([data_1, data_2],
+ bins=bins,
+ stacked=True,
+ bottom=[1, 2, 1.5],
+ histtype='stepfilled')
+
+ assert len(patches) == 2
+
+ polygon, = patches[0]
+ xy = [[0, 1], [0, 3], [1, 3], [1, 5], [2, 5], [2, 2.5], [3, 2.5],
+ [3, 1.5], [2, 1.5], [2, 2], [1, 2], [1, 1], [0, 1]]
+ assert_array_equal(polygon.get_xy(), xy)
+
+ polygon, = patches[1]
+ xy = [[0, 3], [0, 4], [1, 4], [1, 6], [2, 6], [2, 3.5], [3, 3.5],
+ [3, 2.5], [2, 2.5], [2, 5], [1, 5], [1, 3], [0, 3]]
+ assert_array_equal(polygon.get_xy(), xy)
+
+
+def test_hist_stacked_step_bottom_geometry():
+ bins = [0, 1, 2, 3]
+ data_1 = [0, 0, 1, 1, 1, 2]
+ data_2 = [0, 1, 2]
+ _, _, patches = plt.hist([data_1, data_2],
+ bins=bins,
+ stacked=True,
+ bottom=[1, 2, 1.5],
+ histtype='step')
+
+ assert len(patches) == 2
+
+ polygon, = patches[0]
+ xy = [[0, 1], [0, 3], [1, 3], [1, 5], [2, 5], [2, 2.5], [3, 2.5], [3, 1.5]]
+ assert_array_equal(polygon.get_xy(), xy)
+
+ polygon, = patches[1]
+ xy = [[0, 3], [0, 4], [1, 4], [1, 6], [2, 6], [2, 3.5], [3, 3.5], [3, 2.5]]
+ assert_array_equal(polygon.get_xy(), xy)
+
+
+@image_comparison(['hist_stacked_bar'])
+def test_hist_stacked_bar():
+ # make some data
+ d = [[100, 100, 100, 100, 200, 320, 450, 80, 20, 600, 310, 800],
+ [20, 23, 50, 11, 100, 420], [120, 120, 120, 140, 140, 150, 180],
+ [60, 60, 60, 60, 300, 300, 5, 5, 5, 5, 10, 300],
+ [555, 555, 555, 30, 30, 30, 30, 30, 100, 100, 100, 100, 30, 30],
+ [30, 30, 30, 30, 400, 400, 400, 400, 400, 400, 400, 400]]
+ colors = [(0.5759849696758961, 1.0, 0.0), (0.0, 1.0, 0.350624650815206),
+ (0.0, 1.0, 0.6549834156005998), (0.0, 0.6569064625276622, 1.0),
+ (0.28302699607823545, 0.0, 1.0), (0.6849123462299822, 0.0, 1.0)]
+ labels = ['green', 'orange', ' yellow', 'magenta', 'black']
+ fig, ax = plt.subplots()
+ ax.hist(d, bins=10, histtype='barstacked', align='mid', color=colors,
+ label=labels)
+ ax.legend(loc='upper right', bbox_to_anchor=(1.0, 1.0), ncol=1)
+
+
+def test_hist_barstacked_bottom_unchanged():
+ b = np.array([10, 20])
+ plt.hist([[0, 1], [0, 1]], 2, histtype="barstacked", bottom=b)
+ assert b.tolist() == [10, 20]
+
+
+def test_hist_emptydata():
+ fig, ax = plt.subplots()
+ ax.hist([[], range(10), range(10)], histtype="step")
+
+
+def test_hist_labels():
+ # test singleton labels OK
+ fig, ax = plt.subplots()
+ _, _, bars = ax.hist([0, 1], label=0)
+ assert bars[0].get_label() == '0'
+ _, _, bars = ax.hist([0, 1], label=[0])
+ assert bars[0].get_label() == '0'
+ _, _, bars = ax.hist([0, 1], label=None)
+ assert bars[0].get_label() == '_nolegend_'
+ _, _, bars = ax.hist([0, 1], label='0')
+ assert bars[0].get_label() == '0'
+ _, _, bars = ax.hist([0, 1], label='00')
+ assert bars[0].get_label() == '00'
+
+
+@image_comparison(['transparent_markers'], remove_text=True)
+def test_transparent_markers():
+ np.random.seed(0)
+ data = np.random.random(50)
+
+ fig, ax = plt.subplots()
+ ax.plot(data, 'D', mfc='none', markersize=100)
+
+
+@image_comparison(['rgba_markers'], remove_text=True)
+def test_rgba_markers():
+ fig, axs = plt.subplots(ncols=2)
+ rcolors = [(1, 0, 0, 1), (1, 0, 0, 0.5)]
+ bcolors = [(0, 0, 1, 1), (0, 0, 1, 0.5)]
+ alphas = [None, 0.2]
+ kw = dict(ms=100, mew=20)
+ for i, alpha in enumerate(alphas):
+ for j, rcolor in enumerate(rcolors):
+ for k, bcolor in enumerate(bcolors):
+ axs[i].plot(j+1, k+1, 'o', mfc=bcolor, mec=rcolor,
+ alpha=alpha, **kw)
+ axs[i].plot(j+1, k+3, 'x', mec=rcolor, alpha=alpha, **kw)
+ for ax in axs:
+ ax.axis([-1, 4, 0, 5])
+
+
+@image_comparison(['mollweide_grid'], remove_text=True)
+def test_mollweide_grid():
+ # test that both horizontal and vertical gridlines appear on the Mollweide
+ # projection
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='mollweide')
+ ax.grid()
+
+
+def test_mollweide_forward_inverse_closure():
+ # test that the round-trip Mollweide forward->inverse transformation is an
+ # approximate identity
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='mollweide')
+
+ # set up 1-degree grid in longitude, latitude
+ lon = np.linspace(-np.pi, np.pi, 360)
+ lat = np.linspace(-np.pi / 2.0, np.pi / 2.0, 180)
+ lon, lat = np.meshgrid(lon, lat)
+ ll = np.vstack((lon.flatten(), lat.flatten())).T
+
+ # perform forward transform
+ xy = ax.transProjection.transform(ll)
+
+ # perform inverse transform
+ ll2 = ax.transProjection.inverted().transform(xy)
+
+ # compare
+ np.testing.assert_array_almost_equal(ll, ll2, 3)
+
+
+def test_mollweide_inverse_forward_closure():
+ # test that the round-trip Mollweide inverse->forward transformation is an
+ # approximate identity
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='mollweide')
+
+ # set up grid in x, y
+ x = np.linspace(0, 1, 500)
+ x, y = np.meshgrid(x, x)
+ xy = np.vstack((x.flatten(), y.flatten())).T
+
+ # perform inverse transform
+ ll = ax.transProjection.inverted().transform(xy)
+
+ # perform forward transform
+ xy2 = ax.transProjection.transform(ll)
+
+ # compare
+ np.testing.assert_array_almost_equal(xy, xy2, 3)
+
+
+@image_comparison(['test_alpha'], remove_text=True)
+def test_alpha():
+ np.random.seed(0)
+ data = np.random.random(50)
+
+ fig, ax = plt.subplots()
+
+ # alpha=.5 markers, solid line
+ ax.plot(data, '-D', color=[1, 0, 0], mfc=[1, 0, 0, .5],
+ markersize=20, lw=10)
+
+ # everything solid by kwarg
+ ax.plot(data + 2, '-D', color=[1, 0, 0, .5], mfc=[1, 0, 0, .5],
+ markersize=20, lw=10,
+ alpha=1)
+
+ # everything alpha=.5 by kwarg
+ ax.plot(data + 4, '-D', color=[1, 0, 0], mfc=[1, 0, 0],
+ markersize=20, lw=10,
+ alpha=.5)
+
+ # everything alpha=.5 by colors
+ ax.plot(data + 6, '-D', color=[1, 0, 0, .5], mfc=[1, 0, 0, .5],
+ markersize=20, lw=10)
+
+ # alpha=.5 line, solid markers
+ ax.plot(data + 8, '-D', color=[1, 0, 0, .5], mfc=[1, 0, 0],
+ markersize=20, lw=10)
+
+
+@image_comparison(['eventplot', 'eventplot'], remove_text=True)
+def test_eventplot():
+ np.random.seed(0)
+
+ data1 = np.random.random([32, 20]).tolist()
+ data2 = np.random.random([6, 20]).tolist()
+ data = data1 + data2
+ num_datasets = len(data)
+
+ colors1 = [[0, 1, .7]] * len(data1)
+ colors2 = [[1, 0, 0],
+ [0, 1, 0],
+ [0, 0, 1],
+ [1, .75, 0],
+ [1, 0, 1],
+ [0, 1, 1]]
+ colors = colors1 + colors2
+
+ lineoffsets1 = 12 + np.arange(0, len(data1)) * .33
+ lineoffsets2 = [-15, -3, 1, 1.5, 6, 10]
+ lineoffsets = lineoffsets1.tolist() + lineoffsets2
+
+ linelengths1 = [.33] * len(data1)
+ linelengths2 = [5, 2, 1, 1, 3, 1.5]
+ linelengths = linelengths1 + linelengths2
+
+ fig = plt.figure()
+ axobj = fig.add_subplot()
+ colls = axobj.eventplot(data, colors=colors, lineoffsets=lineoffsets,
+ linelengths=linelengths)
+
+ num_collections = len(colls)
+ assert num_collections == num_datasets
+
+ # Reuse testcase from above for a labeled data test
+ data = {"pos": data, "c": colors, "lo": lineoffsets, "ll": linelengths}
+ fig = plt.figure()
+ axobj = fig.add_subplot()
+ colls = axobj.eventplot("pos", colors="c", lineoffsets="lo",
+ linelengths="ll", data=data)
+ num_collections = len(colls)
+ assert num_collections == num_datasets
+
+
+@image_comparison(['test_eventplot_defaults.png'], remove_text=True)
+def test_eventplot_defaults():
+ """
+ test that eventplot produces the correct output given the default params
+ (see bug #3728)
+ """
+ np.random.seed(0)
+
+ data1 = np.random.random([32, 20]).tolist()
+ data2 = np.random.random([6, 20]).tolist()
+ data = data1 + data2
+
+ fig = plt.figure()
+ axobj = fig.add_subplot()
+ axobj.eventplot(data)
+
+
+@pytest.mark.parametrize(('colors'), [
+ ('0.5',), # string color with multiple characters: not OK before #8193 fix
+ ('tab:orange', 'tab:pink', 'tab:cyan', 'bLacK'), # case-insensitive
+ ('red', (0, 1, 0), None, (1, 0, 1, 0.5)), # a tricky case mixing types
+])
+def test_eventplot_colors(colors):
+ """Test the *colors* parameter of eventplot. Inspired by issue #8193."""
+ data = [[0], [1], [2], [3]] # 4 successive events of different nature
+
+ # Build the list of the expected colors
+ expected = [c if c is not None else 'C0' for c in colors]
+ # Convert the list into an array of RGBA values
+ # NB: ['rgbk'] is not a valid argument for to_rgba_array, while 'rgbk' is.
+ if len(expected) == 1:
+ expected = expected[0]
+ expected = np.broadcast_to(mcolors.to_rgba_array(expected), (len(data), 4))
+
+ fig, ax = plt.subplots()
+ if len(colors) == 1: # tuple with a single string (like '0.5' or 'rgbk')
+ colors = colors[0]
+ collections = ax.eventplot(data, colors=colors)
+
+ for coll, color in zip(collections, expected):
+ assert_allclose(coll.get_color(), color)
+
+
+@image_comparison(['test_eventplot_problem_kwargs.png'], remove_text=True)
+def test_eventplot_problem_kwargs(recwarn):
+ """
+ test that 'singular' versions of LineCollection props raise an
+ IgnoredKeywordWarning rather than overriding the 'plural' versions (e.g.
+ to prevent 'color' from overriding 'colors', see issue #4297)
+ """
+ np.random.seed(0)
+
+ data1 = np.random.random([20]).tolist()
+ data2 = np.random.random([10]).tolist()
+ data = [data1, data2]
+
+ fig = plt.figure()
+ axobj = fig.add_subplot()
+
+ axobj.eventplot(data,
+ colors=['r', 'b'],
+ color=['c', 'm'],
+ linewidths=[2, 1],
+ linewidth=[1, 2],
+ linestyles=['solid', 'dashed'],
+ linestyle=['dashdot', 'dotted'])
+
+ # check that three IgnoredKeywordWarnings were raised
+ assert len(recwarn) == 3
+ assert all(issubclass(wi.category, MatplotlibDeprecationWarning)
+ for wi in recwarn)
+
+
+def test_empty_eventplot():
+ fig, ax = plt.subplots(1, 1)
+ ax.eventplot([[]], colors=[(0.0, 0.0, 0.0, 0.0)])
+ plt.draw()
+
+
+@pytest.mark.parametrize('data', [[[]], [[], [0, 1]], [[0, 1], []]])
+@pytest.mark.parametrize(
+ 'orientation', ['_empty', 'vertical', 'horizontal', None, 'none'])
+def test_eventplot_orientation(data, orientation):
+ """Introduced when fixing issue #6412."""
+ opts = {} if orientation == "_empty" else {'orientation': orientation}
+ fig, ax = plt.subplots(1, 1)
+ with (pytest.warns(MatplotlibDeprecationWarning)
+ if orientation in [None, 'none'] else nullcontext()):
+ ax.eventplot(data, **opts)
+ plt.draw()
+
+
+@image_comparison(['marker_styles.png'], remove_text=True)
+def test_marker_styles():
+ fig, ax = plt.subplots()
+ for y, marker in enumerate(sorted(matplotlib.markers.MarkerStyle.markers,
+ key=lambda x: str(type(x))+str(x))):
+ ax.plot((y % 2)*5 + np.arange(10)*10, np.ones(10)*10*y, linestyle='',
+ marker=marker, markersize=10+y/5, label=marker)
+
+
+@image_comparison(['rc_markerfill.png'])
+def test_markers_fillstyle_rcparams():
+ fig, ax = plt.subplots()
+ x = np.arange(7)
+ for idx, (style, marker) in enumerate(
+ [('top', 's'), ('bottom', 'o'), ('none', '^')]):
+ matplotlib.rcParams['markers.fillstyle'] = style
+ ax.plot(x+idx, marker=marker)
+
+
+@image_comparison(['vertex_markers.png'], remove_text=True)
+def test_vertex_markers():
+ data = list(range(10))
+ marker_as_tuple = ((-1, -1), (1, -1), (1, 1), (-1, 1))
+ marker_as_list = [(-1, -1), (1, -1), (1, 1), (-1, 1)]
+ fig, ax = plt.subplots()
+ ax.plot(data, linestyle='', marker=marker_as_tuple, mfc='k')
+ ax.plot(data[::-1], linestyle='', marker=marker_as_list, mfc='b')
+ ax.set_xlim([-1, 10])
+ ax.set_ylim([-1, 10])
+
+
+@image_comparison(['vline_hline_zorder', 'errorbar_zorder'],
+ tol=0 if platform.machine() == 'x86_64' else 0.02)
+def test_eb_line_zorder():
+ x = list(range(10))
+
+ # First illustrate basic pyplot interface, using defaults where possible.
+ fig = plt.figure()
+ ax = fig.gca()
+ ax.plot(x, lw=10, zorder=5)
+ ax.axhline(1, color='red', lw=10, zorder=1)
+ ax.axhline(5, color='green', lw=10, zorder=10)
+ ax.axvline(7, color='m', lw=10, zorder=7)
+ ax.axvline(2, color='k', lw=10, zorder=3)
+
+ ax.set_title("axvline and axhline zorder test")
+
+ # Now switch to a more OO interface to exercise more features.
+ fig = plt.figure()
+ ax = fig.gca()
+ x = list(range(10))
+ y = np.zeros(10)
+ yerr = list(range(10))
+ ax.errorbar(x, y, yerr=yerr, zorder=5, lw=5, color='r')
+ for j in range(10):
+ ax.axhline(j, lw=5, color='k', zorder=j)
+ ax.axhline(-j, lw=5, color='k', zorder=j)
+
+ ax.set_title("errorbar zorder test")
+
+
+@check_figures_equal()
+def test_axline_loglog(fig_test, fig_ref):
+ ax = fig_test.subplots()
+ ax.set(xlim=(0.1, 10), ylim=(1e-3, 1))
+ ax.loglog([.3, .6], [.3, .6], ".-")
+ ax.axline((1, 1e-3), (10, 1e-2), c="k")
+
+ ax = fig_ref.subplots()
+ ax.set(xlim=(0.1, 10), ylim=(1e-3, 1))
+ ax.loglog([.3, .6], [.3, .6], ".-")
+ ax.loglog([1, 10], [1e-3, 1e-2], c="k")
+
+
+@check_figures_equal()
+def test_axline(fig_test, fig_ref):
+ ax = fig_test.subplots()
+ ax.set(xlim=(-1, 1), ylim=(-1, 1))
+ ax.axline((0, 0), (1, 1))
+ ax.axline((0, 0), (1, 0), color='C1')
+ ax.axline((0, 0.5), (1, 0.5), color='C2')
+ # slopes
+ ax.axline((-0.7, -0.5), slope=0, color='C3')
+ ax.axline((1, -0.5), slope=-0.5, color='C4')
+ ax.axline((-0.5, 1), slope=float('inf'), color='C5')
+
+ ax = fig_ref.subplots()
+ ax.set(xlim=(-1, 1), ylim=(-1, 1))
+ ax.plot([-1, 1], [-1, 1])
+ ax.axhline(0, color='C1')
+ ax.axhline(0.5, color='C2')
+ # slopes
+ ax.axhline(-0.5, color='C3')
+ ax.plot([-1, 1], [0.5, -0.5], color='C4')
+ ax.axvline(-0.5, color='C5')
+
+
+@check_figures_equal()
+def test_axline_transaxes(fig_test, fig_ref):
+ ax = fig_test.subplots()
+ ax.set(xlim=(-1, 1), ylim=(-1, 1))
+ ax.axline((0, 0), slope=1, transform=ax.transAxes)
+ ax.axline((1, 0.5), slope=1, color='C1', transform=ax.transAxes)
+ ax.axline((0.5, 0.5), slope=0, color='C2', transform=ax.transAxes)
+ ax.axline((0.5, 0), (0.5, 1), color='C3', transform=ax.transAxes)
+
+ ax = fig_ref.subplots()
+ ax.set(xlim=(-1, 1), ylim=(-1, 1))
+ ax.plot([-1, 1], [-1, 1])
+ ax.plot([0, 1], [-1, 0], color='C1')
+ ax.plot([-1, 1], [0, 0], color='C2')
+ ax.plot([0, 0], [-1, 1], color='C3')
+
+
+@check_figures_equal()
+def test_axline_transaxes_panzoom(fig_test, fig_ref):
+ # test that it is robust against pan/zoom and
+ # figure resize after plotting
+ ax = fig_test.subplots()
+ ax.set(xlim=(-1, 1), ylim=(-1, 1))
+ ax.axline((0, 0), slope=1, transform=ax.transAxes)
+ ax.axline((0.5, 0.5), slope=2, color='C1', transform=ax.transAxes)
+ ax.axline((0.5, 0.5), slope=0, color='C2', transform=ax.transAxes)
+ ax.set(xlim=(0, 5), ylim=(0, 10))
+ fig_test.set_size_inches(3, 3)
+
+ ax = fig_ref.subplots()
+ ax.set(xlim=(0, 5), ylim=(0, 10))
+ fig_ref.set_size_inches(3, 3)
+ ax.plot([0, 5], [0, 5])
+ ax.plot([0, 5], [0, 10], color='C1')
+ ax.plot([0, 5], [5, 5], color='C2')
+
+
+def test_axline_args():
+ """Exactly one of *xy2* and *slope* must be specified."""
+ fig, ax = plt.subplots()
+ with pytest.raises(TypeError):
+ ax.axline((0, 0)) # missing second parameter
+ with pytest.raises(TypeError):
+ ax.axline((0, 0), (1, 1), slope=1) # redundant parameters
+ ax.set_xscale('log')
+ with pytest.raises(TypeError):
+ ax.axline((0, 0), slope=1)
+ ax.set_xscale('linear')
+ ax.set_yscale('log')
+ with pytest.raises(TypeError):
+ ax.axline((0, 0), slope=1)
+ ax.set_yscale('linear')
+ with pytest.raises(ValueError):
+ ax.axline((0, 0), (0, 0)) # two identical points are not allowed
+ plt.draw()
+
+
+@image_comparison(['vlines_basic', 'vlines_with_nan', 'vlines_masked'],
+ extensions=['png'])
+def test_vlines():
+ # normal
+ x1 = [2, 3, 4, 5, 7]
+ y1 = [2, -6, 3, 8, 2]
+ fig1, ax1 = plt.subplots()
+ ax1.vlines(x1, 0, y1, colors='g', linewidth=5)
+
+ # GH #7406
+ x2 = [2, 3, 4, 5, 6, 7]
+ y2 = [2, -6, 3, 8, np.nan, 2]
+ fig2, (ax2, ax3, ax4) = plt.subplots(nrows=3, figsize=(4, 8))
+ ax2.vlines(x2, 0, y2, colors='g', linewidth=5)
+
+ x3 = [2, 3, 4, 5, 6, 7]
+ y3 = [np.nan, 2, -6, 3, 8, 2]
+ ax3.vlines(x3, 0, y3, colors='r', linewidth=3, linestyle='--')
+
+ x4 = [2, 3, 4, 5, 6, 7]
+ y4 = [np.nan, 2, -6, 3, 8, np.nan]
+ ax4.vlines(x4, 0, y4, colors='k', linewidth=2)
+
+ # tweak the x-axis so we can see the lines better
+ for ax in [ax1, ax2, ax3, ax4]:
+ ax.set_xlim(0, 10)
+
+ # check that the y-lims are all automatically the same
+ assert ax1.get_ylim() == ax2.get_ylim()
+ assert ax1.get_ylim() == ax3.get_ylim()
+ assert ax1.get_ylim() == ax4.get_ylim()
+
+ fig3, ax5 = plt.subplots()
+ x5 = np.ma.masked_equal([2, 4, 6, 8, 10, 12], 8)
+ ymin5 = np.ma.masked_equal([0, 1, -1, 0, 2, 1], 2)
+ ymax5 = np.ma.masked_equal([13, 14, 15, 16, 17, 18], 18)
+ ax5.vlines(x5, ymin5, ymax5, colors='k', linewidth=2)
+ ax5.set_xlim(0, 15)
+
+
+def test_vlines_default():
+ fig, ax = plt.subplots()
+ with mpl.rc_context({'lines.color': 'red'}):
+ lines = ax.vlines(0.5, 0, 1)
+ assert mpl.colors.same_color(lines.get_color(), 'red')
+
+
+@image_comparison(['hlines_basic', 'hlines_with_nan', 'hlines_masked'],
+ extensions=['png'])
+def test_hlines():
+ # normal
+ y1 = [2, 3, 4, 5, 7]
+ x1 = [2, -6, 3, 8, 2]
+ fig1, ax1 = plt.subplots()
+ ax1.hlines(y1, 0, x1, colors='g', linewidth=5)
+
+ # GH #7406
+ y2 = [2, 3, 4, 5, 6, 7]
+ x2 = [2, -6, 3, 8, np.nan, 2]
+ fig2, (ax2, ax3, ax4) = plt.subplots(nrows=3, figsize=(4, 8))
+ ax2.hlines(y2, 0, x2, colors='g', linewidth=5)
+
+ y3 = [2, 3, 4, 5, 6, 7]
+ x3 = [np.nan, 2, -6, 3, 8, 2]
+ ax3.hlines(y3, 0, x3, colors='r', linewidth=3, linestyle='--')
+
+ y4 = [2, 3, 4, 5, 6, 7]
+ x4 = [np.nan, 2, -6, 3, 8, np.nan]
+ ax4.hlines(y4, 0, x4, colors='k', linewidth=2)
+
+ # tweak the y-axis so we can see the lines better
+ for ax in [ax1, ax2, ax3, ax4]:
+ ax.set_ylim(0, 10)
+
+ # check that the x-lims are all automatically the same
+ assert ax1.get_xlim() == ax2.get_xlim()
+ assert ax1.get_xlim() == ax3.get_xlim()
+ assert ax1.get_xlim() == ax4.get_xlim()
+
+ fig3, ax5 = plt.subplots()
+ y5 = np.ma.masked_equal([2, 4, 6, 8, 10, 12], 8)
+ xmin5 = np.ma.masked_equal([0, 1, -1, 0, 2, 1], 2)
+ xmax5 = np.ma.masked_equal([13, 14, 15, 16, 17, 18], 18)
+ ax5.hlines(y5, xmin5, xmax5, colors='k', linewidth=2)
+ ax5.set_ylim(0, 15)
+
+
+def test_hlines_default():
+ fig, ax = plt.subplots()
+ with mpl.rc_context({'lines.color': 'red'}):
+ lines = ax.hlines(0.5, 0, 1)
+ assert mpl.colors.same_color(lines.get_color(), 'red')
+
+
+@pytest.mark.parametrize('data', [[1, 2, 3, np.nan, 5],
+ np.ma.masked_equal([1, 2, 3, 4, 5], 4)])
+@check_figures_equal(extensions=["png"])
+def test_lines_with_colors(fig_test, fig_ref, data):
+ test_colors = ['red', 'green', 'blue', 'purple', 'orange']
+ fig_test.add_subplot(2, 1, 1).vlines(data, 0, 1,
+ colors=test_colors, linewidth=5)
+ fig_test.add_subplot(2, 1, 2).hlines(data, 0, 1,
+ colors=test_colors, linewidth=5)
+
+ expect_xy = [1, 2, 3, 5]
+ expect_color = ['red', 'green', 'blue', 'orange']
+ fig_ref.add_subplot(2, 1, 1).vlines(expect_xy, 0, 1,
+ colors=expect_color, linewidth=5)
+ fig_ref.add_subplot(2, 1, 2).hlines(expect_xy, 0, 1,
+ colors=expect_color, linewidth=5)
+
+
+@image_comparison(['step_linestyle', 'step_linestyle'], remove_text=True)
+def test_step_linestyle():
+ x = y = np.arange(10)
+
+ # First illustrate basic pyplot interface, using defaults where possible.
+ fig, ax_lst = plt.subplots(2, 2)
+ ax_lst = ax_lst.flatten()
+
+ ln_styles = ['-', '--', '-.', ':']
+
+ for ax, ls in zip(ax_lst, ln_styles):
+ ax.step(x, y, lw=5, linestyle=ls, where='pre')
+ ax.step(x, y + 1, lw=5, linestyle=ls, where='mid')
+ ax.step(x, y + 2, lw=5, linestyle=ls, where='post')
+ ax.set_xlim([-1, 5])
+ ax.set_ylim([-1, 7])
+
+ # Reuse testcase from above for a labeled data test
+ data = {"X": x, "Y0": y, "Y1": y+1, "Y2": y+2}
+ fig, ax_lst = plt.subplots(2, 2)
+ ax_lst = ax_lst.flatten()
+ ln_styles = ['-', '--', '-.', ':']
+ for ax, ls in zip(ax_lst, ln_styles):
+ ax.step("X", "Y0", lw=5, linestyle=ls, where='pre', data=data)
+ ax.step("X", "Y1", lw=5, linestyle=ls, where='mid', data=data)
+ ax.step("X", "Y2", lw=5, linestyle=ls, where='post', data=data)
+ ax.set_xlim([-1, 5])
+ ax.set_ylim([-1, 7])
+
+
+@image_comparison(['mixed_collection'], remove_text=True)
+def test_mixed_collection():
+ # First illustrate basic pyplot interface, using defaults where possible.
+ fig, ax = plt.subplots()
+
+ c = mpatches.Circle((8, 8), radius=4, facecolor='none', edgecolor='green')
+
+ # PDF can optimize this one
+ p1 = mpl.collections.PatchCollection([c], match_original=True)
+ p1.set_offsets([[0, 0], [24, 24]])
+ p1.set_linewidths([1, 5])
+
+ # PDF can't optimize this one, because the alpha of the edge changes
+ p2 = mpl.collections.PatchCollection([c], match_original=True)
+ p2.set_offsets([[48, 0], [-32, -16]])
+ p2.set_linewidths([1, 5])
+ p2.set_edgecolors([[0, 0, 0.1, 1.0], [0, 0, 0.1, 0.5]])
+
+ ax.patch.set_color('0.5')
+ ax.add_collection(p1)
+ ax.add_collection(p2)
+
+ ax.set_xlim(0, 16)
+ ax.set_ylim(0, 16)
+
+
+def test_subplot_key_hash():
+ ax = plt.subplot(np.int32(5), np.int64(1), 1)
+ ax.twinx()
+ assert ax.get_subplotspec().get_geometry() == (5, 1, 0, 0)
+
+
+@image_comparison(
+ ["specgram_freqs.png", "specgram_freqs_linear.png",
+ "specgram_noise.png", "specgram_noise_linear.png"],
+ remove_text=True, tol=0.07, style="default")
+def test_specgram():
+ """Test axes.specgram in default (psd) mode."""
+
+ # use former defaults to match existing baseline image
+ matplotlib.rcParams['image.interpolation'] = 'nearest'
+
+ n = 1000
+ Fs = 10.
+
+ fstims = [[Fs/4, Fs/5, Fs/11], [Fs/4.7, Fs/5.6, Fs/11.9]]
+ NFFT_freqs = int(10 * Fs / np.min(fstims))
+ x = np.arange(0, n, 1/Fs)
+ y_freqs = np.concatenate(
+ np.sin(2 * np.pi * np.multiply.outer(fstims, x)).sum(axis=1))
+
+ NFFT_noise = int(10 * Fs / 11)
+ np.random.seed(0)
+ y_noise = np.concatenate([np.random.standard_normal(n), np.random.rand(n)])
+
+ all_sides = ["default", "onesided", "twosided"]
+ for y, NFFT in [(y_freqs, NFFT_freqs), (y_noise, NFFT_noise)]:
+ noverlap = NFFT // 2
+ pad_to = int(2 ** np.ceil(np.log2(NFFT)))
+ for ax, sides in zip(plt.figure().subplots(3), all_sides):
+ ax.specgram(y, NFFT=NFFT, Fs=Fs, noverlap=noverlap,
+ pad_to=pad_to, sides=sides)
+ for ax, sides in zip(plt.figure().subplots(3), all_sides):
+ ax.specgram(y, NFFT=NFFT, Fs=Fs, noverlap=noverlap,
+ pad_to=pad_to, sides=sides,
+ scale="linear", norm=matplotlib.colors.LogNorm())
+
+
+@image_comparison(
+ ["specgram_magnitude_freqs.png", "specgram_magnitude_freqs_linear.png",
+ "specgram_magnitude_noise.png", "specgram_magnitude_noise_linear.png"],
+ remove_text=True, tol=0.07, style="default")
+def test_specgram_magnitude():
+ """Test axes.specgram in magnitude mode."""
+
+ # use former defaults to match existing baseline image
+ matplotlib.rcParams['image.interpolation'] = 'nearest'
+
+ n = 1000
+ Fs = 10.
+
+ fstims = [[Fs/4, Fs/5, Fs/11], [Fs/4.7, Fs/5.6, Fs/11.9]]
+ NFFT_freqs = int(100 * Fs / np.min(fstims))
+ x = np.arange(0, n, 1/Fs)
+ y = np.sin(2 * np.pi * np.multiply.outer(fstims, x)).sum(axis=1)
+ y[:, -1] = 1
+ y_freqs = np.hstack(y)
+
+ NFFT_noise = int(10 * Fs / 11)
+ np.random.seed(0)
+ y_noise = np.concatenate([np.random.standard_normal(n), np.random.rand(n)])
+
+ all_sides = ["default", "onesided", "twosided"]
+ for y, NFFT in [(y_freqs, NFFT_freqs), (y_noise, NFFT_noise)]:
+ noverlap = NFFT // 2
+ pad_to = int(2 ** np.ceil(np.log2(NFFT)))
+ for ax, sides in zip(plt.figure().subplots(3), all_sides):
+ ax.specgram(y, NFFT=NFFT, Fs=Fs, noverlap=noverlap,
+ pad_to=pad_to, sides=sides, mode="magnitude")
+ for ax, sides in zip(plt.figure().subplots(3), all_sides):
+ ax.specgram(y, NFFT=NFFT, Fs=Fs, noverlap=noverlap,
+ pad_to=pad_to, sides=sides, mode="magnitude",
+ scale="linear", norm=matplotlib.colors.LogNorm())
+
+
+@image_comparison(
+ ["specgram_angle_freqs.png", "specgram_phase_freqs.png",
+ "specgram_angle_noise.png", "specgram_phase_noise.png"],
+ remove_text=True, tol=0.07, style="default")
+def test_specgram_angle():
+ """Test axes.specgram in angle and phase modes."""
+
+ # use former defaults to match existing baseline image
+ matplotlib.rcParams['image.interpolation'] = 'nearest'
+
+ n = 1000
+ Fs = 10.
+
+ fstims = [[Fs/4, Fs/5, Fs/11], [Fs/4.7, Fs/5.6, Fs/11.9]]
+ NFFT_freqs = int(10 * Fs / np.min(fstims))
+ x = np.arange(0, n, 1/Fs)
+ y = np.sin(2 * np.pi * np.multiply.outer(fstims, x)).sum(axis=1)
+ y[:, -1] = 1
+ y_freqs = np.hstack(y)
+
+ NFFT_noise = int(10 * Fs / 11)
+ np.random.seed(0)
+ y_noise = np.concatenate([np.random.standard_normal(n), np.random.rand(n)])
+
+ all_sides = ["default", "onesided", "twosided"]
+ for y, NFFT in [(y_freqs, NFFT_freqs), (y_noise, NFFT_noise)]:
+ noverlap = NFFT // 2
+ pad_to = int(2 ** np.ceil(np.log2(NFFT)))
+ for mode in ["angle", "phase"]:
+ for ax, sides in zip(plt.figure().subplots(3), all_sides):
+ ax.specgram(y, NFFT=NFFT, Fs=Fs, noverlap=noverlap,
+ pad_to=pad_to, sides=sides, mode=mode)
+ with pytest.raises(ValueError):
+ ax.specgram(y, NFFT=NFFT, Fs=Fs, noverlap=noverlap,
+ pad_to=pad_to, sides=sides, mode=mode,
+ scale="dB")
+
+
+def test_specgram_fs_none():
+ """Test axes.specgram when Fs is None, should not throw error."""
+ spec, freqs, t, im = plt.specgram(np.ones(300), Fs=None, scale='linear')
+ xmin, xmax, freq0, freq1 = im.get_extent()
+ assert xmin == 32 and xmax == 96
+
+
+@check_figures_equal(extensions=["png"])
+def test_specgram_origin_rcparam(fig_test, fig_ref):
+ """Test specgram ignores image.origin rcParam and uses origin 'upper'."""
+ t = np.arange(500)
+ signal = np.sin(t)
+
+ plt.rcParams["image.origin"] = 'upper'
+
+ # Reference: First graph using default origin in imshow (upper),
+ fig_ref.subplots().specgram(signal)
+
+ # Try to overwrite the setting trying to flip the specgram
+ plt.rcParams["image.origin"] = 'lower'
+
+ # Test: origin='lower' should be ignored
+ fig_test.subplots().specgram(signal)
+
+
+def test_specgram_origin_kwarg():
+ """Ensure passing origin as a kwarg raises a TypeError."""
+ t = np.arange(500)
+ signal = np.sin(t)
+
+ with pytest.raises(TypeError):
+ plt.specgram(signal, origin='lower')
+
+
+@image_comparison(
+ ["psd_freqs.png", "csd_freqs.png", "psd_noise.png", "csd_noise.png"],
+ remove_text=True, tol=0.002)
+def test_psd_csd():
+ n = 10000
+ Fs = 100.
+
+ fstims = [[Fs/4, Fs/5, Fs/11], [Fs/4.7, Fs/5.6, Fs/11.9]]
+ NFFT_freqs = int(1000 * Fs / np.min(fstims))
+ x = np.arange(0, n, 1/Fs)
+ ys_freqs = np.sin(2 * np.pi * np.multiply.outer(fstims, x)).sum(axis=1)
+
+ NFFT_noise = int(1000 * Fs / 11)
+ np.random.seed(0)
+ ys_noise = [np.random.standard_normal(n), np.random.rand(n)]
+
+ all_kwargs = [{"sides": "default"},
+ {"sides": "onesided", "return_line": False},
+ {"sides": "twosided", "return_line": True}]
+ for ys, NFFT in [(ys_freqs, NFFT_freqs), (ys_noise, NFFT_noise)]:
+ noverlap = NFFT // 2
+ pad_to = int(2 ** np.ceil(np.log2(NFFT)))
+ for ax, kwargs in zip(plt.figure().subplots(3), all_kwargs):
+ ret = ax.psd(np.concatenate(ys), NFFT=NFFT, Fs=Fs,
+ noverlap=noverlap, pad_to=pad_to, **kwargs)
+ assert len(ret) == 2 + kwargs.get("return_line", False)
+ ax.set(xlabel="", ylabel="")
+ for ax, kwargs in zip(plt.figure().subplots(3), all_kwargs):
+ ret = ax.csd(*ys, NFFT=NFFT, Fs=Fs,
+ noverlap=noverlap, pad_to=pad_to, **kwargs)
+ assert len(ret) == 2 + kwargs.get("return_line", False)
+ ax.set(xlabel="", ylabel="")
+
+
+@image_comparison(
+ ["magnitude_spectrum_freqs_linear.png",
+ "magnitude_spectrum_freqs_dB.png",
+ "angle_spectrum_freqs.png",
+ "phase_spectrum_freqs.png",
+ "magnitude_spectrum_noise_linear.png",
+ "magnitude_spectrum_noise_dB.png",
+ "angle_spectrum_noise.png",
+ "phase_spectrum_noise.png"],
+ remove_text=True)
+def test_spectrum():
+ n = 10000
+ Fs = 100.
+
+ fstims1 = [Fs/4, Fs/5, Fs/11]
+ NFFT = int(1000 * Fs / min(fstims1))
+ pad_to = int(2 ** np.ceil(np.log2(NFFT)))
+
+ x = np.arange(0, n, 1/Fs)
+ y_freqs = ((np.sin(2 * np.pi * np.outer(x, fstims1)) * 10**np.arange(3))
+ .sum(axis=1))
+ np.random.seed(0)
+ y_noise = np.hstack([np.random.standard_normal(n), np.random.rand(n)]) - .5
+
+ all_sides = ["default", "onesided", "twosided"]
+ kwargs = {"Fs": Fs, "pad_to": pad_to}
+ for y in [y_freqs, y_noise]:
+ for ax, sides in zip(plt.figure().subplots(3), all_sides):
+ spec, freqs, line = ax.magnitude_spectrum(y, sides=sides, **kwargs)
+ ax.set(xlabel="", ylabel="")
+ for ax, sides in zip(plt.figure().subplots(3), all_sides):
+ spec, freqs, line = ax.magnitude_spectrum(y, sides=sides, **kwargs,
+ scale="dB")
+ ax.set(xlabel="", ylabel="")
+ for ax, sides in zip(plt.figure().subplots(3), all_sides):
+ spec, freqs, line = ax.angle_spectrum(y, sides=sides, **kwargs)
+ ax.set(xlabel="", ylabel="")
+ for ax, sides in zip(plt.figure().subplots(3), all_sides):
+ spec, freqs, line = ax.phase_spectrum(y, sides=sides, **kwargs)
+ ax.set(xlabel="", ylabel="")
+
+
+@image_comparison(['twin_spines.png'], remove_text=True)
+def test_twin_spines():
+
+ def make_patch_spines_invisible(ax):
+ ax.set_frame_on(True)
+ ax.patch.set_visible(False)
+ ax.spines[:].set_visible(False)
+
+ fig = plt.figure(figsize=(4, 3))
+ fig.subplots_adjust(right=0.75)
+
+ host = fig.add_subplot()
+ par1 = host.twinx()
+ par2 = host.twinx()
+
+ # Offset the right spine of par2. The ticks and label have already been
+ # placed on the right by twinx above.
+ par2.spines.right.set_position(("axes", 1.2))
+ # Having been created by twinx, par2 has its frame off, so the line of
+ # its detached spine is invisible. First, activate the frame but make
+ # the patch and spines invisible.
+ make_patch_spines_invisible(par2)
+ # Second, show the right spine.
+ par2.spines.right.set_visible(True)
+
+ p1, = host.plot([0, 1, 2], [0, 1, 2], "b-")
+ p2, = par1.plot([0, 1, 2], [0, 3, 2], "r-")
+ p3, = par2.plot([0, 1, 2], [50, 30, 15], "g-")
+
+ host.set_xlim(0, 2)
+ host.set_ylim(0, 2)
+ par1.set_ylim(0, 4)
+ par2.set_ylim(1, 65)
+
+ host.yaxis.label.set_color(p1.get_color())
+ par1.yaxis.label.set_color(p2.get_color())
+ par2.yaxis.label.set_color(p3.get_color())
+
+ tkw = dict(size=4, width=1.5)
+ host.tick_params(axis='y', colors=p1.get_color(), **tkw)
+ par1.tick_params(axis='y', colors=p2.get_color(), **tkw)
+ par2.tick_params(axis='y', colors=p3.get_color(), **tkw)
+ host.tick_params(axis='x', **tkw)
+
+
+@image_comparison(['twin_spines_on_top.png', 'twin_spines_on_top.png'],
+ remove_text=True)
+def test_twin_spines_on_top():
+ matplotlib.rcParams['axes.linewidth'] = 48.0
+ matplotlib.rcParams['lines.linewidth'] = 48.0
+
+ fig = plt.figure()
+ ax1 = fig.add_subplot(1, 1, 1)
+
+ data = np.array([[1000, 1100, 1200, 1250],
+ [310, 301, 360, 400]])
+
+ ax2 = ax1.twinx()
+
+ ax1.plot(data[0], data[1]/1E3, color='#BEAED4')
+ ax1.fill_between(data[0], data[1]/1E3, color='#BEAED4', alpha=.8)
+
+ ax2.plot(data[0], data[1]/1E3, color='#7FC97F')
+ ax2.fill_between(data[0], data[1]/1E3, color='#7FC97F', alpha=.5)
+
+ # Reuse testcase from above for a labeled data test
+ data = {"i": data[0], "j": data[1]/1E3}
+ fig = plt.figure()
+ ax1 = fig.add_subplot(1, 1, 1)
+ ax2 = ax1.twinx()
+ ax1.plot("i", "j", color='#BEAED4', data=data)
+ ax1.fill_between("i", "j", color='#BEAED4', alpha=.8, data=data)
+ ax2.plot("i", "j", color='#7FC97F', data=data)
+ ax2.fill_between("i", "j", color='#7FC97F', alpha=.5, data=data)
+
+
+@pytest.mark.parametrize("grid_which, major_visible, minor_visible", [
+ ("both", True, True),
+ ("major", True, False),
+ ("minor", False, True),
+])
+def test_rcparam_grid_minor(grid_which, major_visible, minor_visible):
+ mpl.rcParams.update({"axes.grid": True, "axes.grid.which": grid_which})
+ fig, ax = plt.subplots()
+ fig.canvas.draw()
+ assert all(tick.gridline.get_visible() == major_visible
+ for tick in ax.xaxis.majorTicks)
+ assert all(tick.gridline.get_visible() == minor_visible
+ for tick in ax.xaxis.minorTicks)
+
+
+def test_grid():
+ fig, ax = plt.subplots()
+ ax.grid()
+ fig.canvas.draw()
+ assert ax.xaxis.majorTicks[0].gridline.get_visible()
+ ax.grid(visible=False)
+ fig.canvas.draw()
+ assert not ax.xaxis.majorTicks[0].gridline.get_visible()
+ ax.grid(visible=True)
+ fig.canvas.draw()
+ assert ax.xaxis.majorTicks[0].gridline.get_visible()
+ ax.grid()
+ fig.canvas.draw()
+ assert not ax.xaxis.majorTicks[0].gridline.get_visible()
+
+
+def test_reset_grid():
+ fig, ax = plt.subplots()
+ ax.tick_params(reset=True, which='major', labelsize=10)
+ assert not ax.xaxis.majorTicks[0].gridline.get_visible()
+ ax.grid(color='red') # enables grid
+ assert ax.xaxis.majorTicks[0].gridline.get_visible()
+
+ with plt.rc_context({'axes.grid': True}):
+ ax.clear()
+ ax.tick_params(reset=True, which='major', labelsize=10)
+ assert ax.xaxis.majorTicks[0].gridline.get_visible()
+
+
+def test_vline_limit():
+ fig = plt.figure()
+ ax = fig.gca()
+ ax.axvline(0.5)
+ ax.plot([-0.1, 0, 0.2, 0.1])
+ assert_allclose(ax.get_ylim(), (-.1, .2))
+
+
+@pytest.mark.parametrize('fv, fh, args', [[plt.axvline, plt.axhline, (1,)],
+ [plt.axvspan, plt.axhspan, (1, 1)]])
+def test_axline_minmax(fv, fh, args):
+ bad_lim = matplotlib.dates.num2date(1)
+ # Check vertical functions
+ with pytest.raises(ValueError, match='ymin must be a single scalar value'):
+ fv(*args, ymin=bad_lim, ymax=1)
+ with pytest.raises(ValueError, match='ymax must be a single scalar value'):
+ fv(*args, ymin=1, ymax=bad_lim)
+ # Check horizontal functions
+ with pytest.raises(ValueError, match='xmin must be a single scalar value'):
+ fh(*args, xmin=bad_lim, xmax=1)
+ with pytest.raises(ValueError, match='xmax must be a single scalar value'):
+ fh(*args, xmin=1, xmax=bad_lim)
+
+
+def test_empty_shared_subplots():
+ # empty plots with shared axes inherit limits from populated plots
+ fig, axs = plt.subplots(nrows=1, ncols=2, sharex=True, sharey=True)
+ axs[0].plot([1, 2, 3], [2, 4, 6])
+ x0, x1 = axs[1].get_xlim()
+ y0, y1 = axs[1].get_ylim()
+ assert x0 <= 1
+ assert x1 >= 3
+ assert y0 <= 2
+ assert y1 >= 6
+
+
+def test_shared_with_aspect_1():
+ # allow sharing one axis
+ for adjustable in ['box', 'datalim']:
+ fig, axs = plt.subplots(nrows=2, sharex=True)
+ axs[0].set_aspect(2, adjustable=adjustable, share=True)
+ assert axs[1].get_aspect() == 2
+ assert axs[1].get_adjustable() == adjustable
+
+ fig, axs = plt.subplots(nrows=2, sharex=True)
+ axs[0].set_aspect(2, adjustable=adjustable)
+ assert axs[1].get_aspect() == 'auto'
+
+
+def test_shared_with_aspect_2():
+ # Share 2 axes only with 'box':
+ fig, axs = plt.subplots(nrows=2, sharex=True, sharey=True)
+ axs[0].set_aspect(2, share=True)
+ axs[0].plot([1, 2], [3, 4])
+ axs[1].plot([3, 4], [1, 2])
+ plt.draw() # Trigger apply_aspect().
+ assert axs[0].get_xlim() == axs[1].get_xlim()
+ assert axs[0].get_ylim() == axs[1].get_ylim()
+
+
+def test_shared_with_aspect_3():
+ # Different aspect ratios:
+ for adjustable in ['box', 'datalim']:
+ fig, axs = plt.subplots(nrows=2, sharey=True)
+ axs[0].set_aspect(2, adjustable=adjustable)
+ axs[1].set_aspect(0.5, adjustable=adjustable)
+ axs[0].plot([1, 2], [3, 4])
+ axs[1].plot([3, 4], [1, 2])
+ plt.draw() # Trigger apply_aspect().
+ assert axs[0].get_xlim() != axs[1].get_xlim()
+ assert axs[0].get_ylim() == axs[1].get_ylim()
+ fig_aspect = fig.bbox_inches.height / fig.bbox_inches.width
+ for ax in axs:
+ p = ax.get_position()
+ box_aspect = p.height / p.width
+ lim_aspect = ax.viewLim.height / ax.viewLim.width
+ expected = fig_aspect * box_aspect / lim_aspect
+ assert round(expected, 4) == round(ax.get_aspect(), 4)
+
+
+@pytest.mark.parametrize('twin', ('x', 'y'))
+def test_twin_with_aspect(twin):
+ fig, ax = plt.subplots()
+ # test twinx or twiny
+ ax_twin = getattr(ax, 'twin{}'.format(twin))()
+ ax.set_aspect(5)
+ ax_twin.set_aspect(2)
+ assert_array_equal(ax.bbox.extents,
+ ax_twin.bbox.extents)
+
+
+def test_relim_visible_only():
+ x1 = (0., 10.)
+ y1 = (0., 10.)
+ x2 = (-10., 20.)
+ y2 = (-10., 30.)
+
+ fig = matplotlib.figure.Figure()
+ ax = fig.add_subplot()
+ ax.plot(x1, y1)
+ assert ax.get_xlim() == x1
+ assert ax.get_ylim() == y1
+ line, = ax.plot(x2, y2)
+ assert ax.get_xlim() == x2
+ assert ax.get_ylim() == y2
+ line.set_visible(False)
+ assert ax.get_xlim() == x2
+ assert ax.get_ylim() == y2
+
+ ax.relim(visible_only=True)
+ ax.autoscale_view()
+
+ assert ax.get_xlim() == x1
+ assert ax.get_ylim() == y1
+
+
+def test_text_labelsize():
+ """
+ tests for issue #1172
+ """
+ fig = plt.figure()
+ ax = fig.gca()
+ ax.tick_params(labelsize='large')
+ ax.tick_params(direction='out')
+
+
+@image_comparison(['pie_default.png'])
+def test_pie_default():
+ # The slices will be ordered and plotted counter-clockwise.
+ labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
+ sizes = [15, 30, 45, 10]
+ colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
+ explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
+ fig1, ax1 = plt.subplots(figsize=(8, 6))
+ ax1.pie(sizes, explode=explode, labels=labels, colors=colors,
+ autopct='%1.1f%%', shadow=True, startangle=90)
+
+
+@image_comparison(['pie_linewidth_0', 'pie_linewidth_0', 'pie_linewidth_0'],
+ extensions=['png'])
+def test_pie_linewidth_0():
+ # The slices will be ordered and plotted counter-clockwise.
+ labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
+ sizes = [15, 30, 45, 10]
+ colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
+ explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
+
+ plt.pie(sizes, explode=explode, labels=labels, colors=colors,
+ autopct='%1.1f%%', shadow=True, startangle=90,
+ wedgeprops={'linewidth': 0})
+ # Set aspect ratio to be equal so that pie is drawn as a circle.
+ plt.axis('equal')
+
+ # Reuse testcase from above for a labeled data test
+ data = {"l": labels, "s": sizes, "c": colors, "ex": explode}
+ fig = plt.figure()
+ ax = fig.gca()
+ ax.pie("s", explode="ex", labels="l", colors="c",
+ autopct='%1.1f%%', shadow=True, startangle=90,
+ wedgeprops={'linewidth': 0}, data=data)
+ ax.axis('equal')
+
+ # And again to test the pyplot functions which should also be able to be
+ # called with a data kwarg
+ plt.figure()
+ plt.pie("s", explode="ex", labels="l", colors="c",
+ autopct='%1.1f%%', shadow=True, startangle=90,
+ wedgeprops={'linewidth': 0}, data=data)
+ plt.axis('equal')
+
+
+@image_comparison(['pie_center_radius.png'])
+def test_pie_center_radius():
+ # The slices will be ordered and plotted counter-clockwise.
+ labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
+ sizes = [15, 30, 45, 10]
+ colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
+ explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
+
+ plt.pie(sizes, explode=explode, labels=labels, colors=colors,
+ autopct='%1.1f%%', shadow=True, startangle=90,
+ wedgeprops={'linewidth': 0}, center=(1, 2), radius=1.5)
+
+ plt.annotate("Center point", xy=(1, 2), xytext=(1, 1.3),
+ arrowprops=dict(arrowstyle="->",
+ connectionstyle="arc3"),
+ bbox=dict(boxstyle="square", facecolor="lightgrey"))
+ # Set aspect ratio to be equal so that pie is drawn as a circle.
+ plt.axis('equal')
+
+
+@image_comparison(['pie_linewidth_2.png'])
+def test_pie_linewidth_2():
+ # The slices will be ordered and plotted counter-clockwise.
+ labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
+ sizes = [15, 30, 45, 10]
+ colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
+ explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
+
+ plt.pie(sizes, explode=explode, labels=labels, colors=colors,
+ autopct='%1.1f%%', shadow=True, startangle=90,
+ wedgeprops={'linewidth': 2})
+ # Set aspect ratio to be equal so that pie is drawn as a circle.
+ plt.axis('equal')
+
+
+@image_comparison(['pie_ccw_true.png'])
+def test_pie_ccw_true():
+ # The slices will be ordered and plotted counter-clockwise.
+ labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
+ sizes = [15, 30, 45, 10]
+ colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
+ explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
+
+ plt.pie(sizes, explode=explode, labels=labels, colors=colors,
+ autopct='%1.1f%%', shadow=True, startangle=90,
+ counterclock=True)
+ # Set aspect ratio to be equal so that pie is drawn as a circle.
+ plt.axis('equal')
+
+
+@image_comparison(['pie_frame_grid.png'])
+def test_pie_frame_grid():
+ # The slices will be ordered and plotted counter-clockwise.
+ labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
+ sizes = [15, 30, 45, 10]
+ colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
+ # only "explode" the 2nd slice (i.e. 'Hogs')
+ explode = (0, 0.1, 0, 0)
+
+ plt.pie(sizes, explode=explode, labels=labels, colors=colors,
+ autopct='%1.1f%%', shadow=True, startangle=90,
+ wedgeprops={'linewidth': 0},
+ frame=True, center=(2, 2))
+
+ plt.pie(sizes[::-1], explode=explode, labels=labels, colors=colors,
+ autopct='%1.1f%%', shadow=True, startangle=90,
+ wedgeprops={'linewidth': 0},
+ frame=True, center=(5, 2))
+
+ plt.pie(sizes, explode=explode[::-1], labels=labels, colors=colors,
+ autopct='%1.1f%%', shadow=True, startangle=90,
+ wedgeprops={'linewidth': 0},
+ frame=True, center=(3, 5))
+ # Set aspect ratio to be equal so that pie is drawn as a circle.
+ plt.axis('equal')
+
+
+@image_comparison(['pie_rotatelabels_true.png'])
+def test_pie_rotatelabels_true():
+ # The slices will be ordered and plotted counter-clockwise.
+ labels = 'Hogwarts', 'Frogs', 'Dogs', 'Logs'
+ sizes = [15, 30, 45, 10]
+ colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
+ explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
+
+ plt.pie(sizes, explode=explode, labels=labels, colors=colors,
+ autopct='%1.1f%%', shadow=True, startangle=90,
+ rotatelabels=True)
+ # Set aspect ratio to be equal so that pie is drawn as a circle.
+ plt.axis('equal')
+
+
+@image_comparison(['pie_no_label.png'])
+def test_pie_nolabel_but_legend():
+ labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
+ sizes = [15, 30, 45, 10]
+ colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
+ explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
+ plt.pie(sizes, explode=explode, labels=labels, colors=colors,
+ autopct='%1.1f%%', shadow=True, startangle=90, labeldistance=None,
+ rotatelabels=True)
+ plt.axis('equal')
+ plt.ylim(-1.2, 1.2)
+ plt.legend()
+
+
+def test_pie_textprops():
+ data = [23, 34, 45]
+ labels = ["Long name 1", "Long name 2", "Long name 3"]
+
+ textprops = dict(horizontalalignment="center",
+ verticalalignment="top",
+ rotation=90,
+ rotation_mode="anchor",
+ size=12, color="red")
+
+ _, texts, autopct = plt.gca().pie(data, labels=labels, autopct='%.2f',
+ textprops=textprops)
+ for labels in [texts, autopct]:
+ for tx in labels:
+ assert tx.get_ha() == textprops["horizontalalignment"]
+ assert tx.get_va() == textprops["verticalalignment"]
+ assert tx.get_rotation() == textprops["rotation"]
+ assert tx.get_rotation_mode() == textprops["rotation_mode"]
+ assert tx.get_size() == textprops["size"]
+ assert tx.get_color() == textprops["color"]
+
+
+def test_pie_get_negative_values():
+ # Test the ValueError raised when feeding negative values into axes.pie
+ fig, ax = plt.subplots()
+ with pytest.raises(ValueError):
+ ax.pie([5, 5, -3], explode=[0, .1, .2])
+
+
+def test_normalize_kwarg_warn_pie():
+ fig, ax = plt.subplots()
+ with pytest.warns(MatplotlibDeprecationWarning):
+ ax.pie(x=[0], normalize=None)
+
+
+def test_normalize_kwarg_pie():
+ fig, ax = plt.subplots()
+ x = [0.3, 0.3, 0.1]
+ t1 = ax.pie(x=x, normalize=True)
+ assert abs(t1[0][-1].theta2 - 360.) < 1e-3
+ t2 = ax.pie(x=x, normalize=False)
+ assert abs(t2[0][-1].theta2 - 360.) > 1e-3
+
+
+@image_comparison(['set_get_ticklabels.png'])
+def test_set_get_ticklabels():
+ # test issue 2246
+ fig, ax = plt.subplots(2)
+ ha = ['normal', 'set_x/yticklabels']
+
+ ax[0].plot(np.arange(10))
+ ax[0].set_title(ha[0])
+
+ ax[1].plot(np.arange(10))
+ ax[1].set_title(ha[1])
+
+ # set ticklabel to 1 plot in normal way
+ ax[0].set_xticks(range(10))
+ ax[0].set_yticks(range(10))
+ ax[0].set_xticklabels(['a', 'b', 'c', 'd'] + 6 * [''])
+ ax[0].set_yticklabels(['11', '12', '13', '14'] + 6 * [''])
+
+ # set ticklabel to the other plot, expect the 2 plots have same label
+ # setting pass get_ticklabels return value as ticklabels argument
+ ax[1].set_xticks(ax[0].get_xticks())
+ ax[1].set_yticks(ax[0].get_yticks())
+ ax[1].set_xticklabels(ax[0].get_xticklabels())
+ ax[1].set_yticklabels(ax[0].get_yticklabels())
+
+
+def test_subsampled_ticklabels():
+ # test issue 11937
+ fig, ax = plt.subplots()
+ ax.plot(np.arange(10))
+ ax.xaxis.set_ticks(np.arange(10) + 0.1)
+ ax.locator_params(nbins=5)
+ ax.xaxis.set_ticklabels([c for c in "bcdefghijk"])
+ plt.draw()
+ labels = [t.get_text() for t in ax.xaxis.get_ticklabels()]
+ assert labels == ['b', 'd', 'f', 'h', 'j']
+
+
+def test_mismatched_ticklabels():
+ fig, ax = plt.subplots()
+ ax.plot(np.arange(10))
+ ax.xaxis.set_ticks([1.5, 2.5])
+ with pytest.raises(ValueError):
+ ax.xaxis.set_ticklabels(['a', 'b', 'c'])
+
+
+def test_empty_ticks_fixed_loc():
+ # Smoke test that [] can be used to unset all tick labels
+ fig, ax = plt.subplots()
+ ax.bar([1, 2], [1, 2])
+ ax.set_xticks([1, 2])
+ ax.set_xticklabels([])
+
+
+@image_comparison(['retain_tick_visibility.png'])
+def test_retain_tick_visibility():
+ fig, ax = plt.subplots()
+ plt.plot([0, 1, 2], [0, -1, 4])
+ plt.setp(ax.get_yticklabels(), visible=False)
+ ax.tick_params(axis="y", which="both", length=0)
+
+
+def test_tick_label_update():
+ # test issue 9397
+
+ fig, ax = plt.subplots()
+
+ # Set up a dummy formatter
+ def formatter_func(x, pos):
+ return "unit value" if x == 1 else ""
+ ax.xaxis.set_major_formatter(plt.FuncFormatter(formatter_func))
+
+ # Force some of the x-axis ticks to be outside of the drawn range
+ ax.set_xticks([-1, 0, 1, 2, 3])
+ ax.set_xlim(-0.5, 2.5)
+
+ ax.figure.canvas.draw()
+ tick_texts = [tick.get_text() for tick in ax.xaxis.get_ticklabels()]
+ assert tick_texts == ["", "", "unit value", "", ""]
+
+
+@image_comparison(['o_marker_path_snap.png'], savefig_kwarg={'dpi': 72})
+def test_o_marker_path_snap():
+ fig, ax = plt.subplots()
+ ax.margins(.1)
+ for ms in range(1, 15):
+ ax.plot([1, 2, ], np.ones(2) + ms, 'o', ms=ms)
+
+ for ms in np.linspace(1, 10, 25):
+ ax.plot([3, 4, ], np.ones(2) + ms, 'o', ms=ms)
+
+
+def test_margins():
+ # test all ways margins can be called
+ data = [1, 10]
+ xmin = 0.0
+ xmax = len(data) - 1.0
+ ymin = min(data)
+ ymax = max(data)
+
+ fig1, ax1 = plt.subplots(1, 1)
+ ax1.plot(data)
+ ax1.margins(1)
+ assert ax1.margins() == (1, 1)
+ assert ax1.get_xlim() == (xmin - (xmax - xmin) * 1,
+ xmax + (xmax - xmin) * 1)
+ assert ax1.get_ylim() == (ymin - (ymax - ymin) * 1,
+ ymax + (ymax - ymin) * 1)
+
+ fig2, ax2 = plt.subplots(1, 1)
+ ax2.plot(data)
+ ax2.margins(0.5, 2)
+ assert ax2.margins() == (0.5, 2)
+ assert ax2.get_xlim() == (xmin - (xmax - xmin) * 0.5,
+ xmax + (xmax - xmin) * 0.5)
+ assert ax2.get_ylim() == (ymin - (ymax - ymin) * 2,
+ ymax + (ymax - ymin) * 2)
+
+ fig3, ax3 = plt.subplots(1, 1)
+ ax3.plot(data)
+ ax3.margins(x=-0.2, y=0.5)
+ assert ax3.margins() == (-0.2, 0.5)
+ assert ax3.get_xlim() == (xmin - (xmax - xmin) * -0.2,
+ xmax + (xmax - xmin) * -0.2)
+ assert ax3.get_ylim() == (ymin - (ymax - ymin) * 0.5,
+ ymax + (ymax - ymin) * 0.5)
+
+
+def test_set_margin_updates_limits():
+ mpl.style.use("default")
+ fig, ax = plt.subplots()
+ ax.plot([1, 2], [1, 2])
+ ax.set(xscale="log", xmargin=0)
+ assert ax.get_xlim() == (1, 2)
+
+
+def test_length_one_hist():
+ fig, ax = plt.subplots()
+ ax.hist(1)
+ ax.hist([1])
+
+
+def test_pathological_hexbin():
+ # issue #2863
+ mylist = [10] * 100
+ fig, ax = plt.subplots(1, 1)
+ ax.hexbin(mylist, mylist)
+ fig.savefig(io.BytesIO()) # Check that no warning is emitted.
+
+
+def test_color_None():
+ # issue 3855
+ fig, ax = plt.subplots()
+ ax.plot([1, 2], [1, 2], color=None)
+
+
+def test_color_alias():
+ # issues 4157 and 4162
+ fig, ax = plt.subplots()
+ line = ax.plot([0, 1], c='lime')[0]
+ assert 'lime' == line.get_color()
+
+
+def test_numerical_hist_label():
+ fig, ax = plt.subplots()
+ ax.hist([range(15)] * 5, label=range(5))
+ ax.legend()
+
+
+def test_unicode_hist_label():
+ fig, ax = plt.subplots()
+ a = (b'\xe5\xbe\x88\xe6\xbc\x82\xe4\xba\xae, ' +
+ b'r\xc3\xb6m\xc3\xa4n ch\xc3\xa4r\xc3\xa1ct\xc3\xa8rs')
+ b = b'\xd7\xa9\xd7\x9c\xd7\x95\xd7\x9d'
+ labels = [a.decode('utf-8'),
+ 'hi aardvark',
+ b.decode('utf-8'),
+ ]
+
+ ax.hist([range(15)] * 3, label=labels)
+ ax.legend()
+
+
+def test_move_offsetlabel():
+ data = np.random.random(10) * 1e-22
+
+ fig, ax = plt.subplots()
+ ax.plot(data)
+ fig.canvas.draw()
+ before = ax.yaxis.offsetText.get_position()
+ assert ax.yaxis.offsetText.get_horizontalalignment() == 'left'
+ ax.yaxis.tick_right()
+ fig.canvas.draw()
+ after = ax.yaxis.offsetText.get_position()
+ assert after[0] > before[0] and after[1] == before[1]
+ assert ax.yaxis.offsetText.get_horizontalalignment() == 'right'
+
+ fig, ax = plt.subplots()
+ ax.plot(data)
+ fig.canvas.draw()
+ before = ax.xaxis.offsetText.get_position()
+ assert ax.xaxis.offsetText.get_verticalalignment() == 'top'
+ ax.xaxis.tick_top()
+ fig.canvas.draw()
+ after = ax.xaxis.offsetText.get_position()
+ assert after[0] == before[0] and after[1] > before[1]
+ assert ax.xaxis.offsetText.get_verticalalignment() == 'bottom'
+
+
+@image_comparison(['rc_spines.png'], savefig_kwarg={'dpi': 40})
+def test_rc_spines():
+ rc_dict = {
+ 'axes.spines.left': False,
+ 'axes.spines.right': False,
+ 'axes.spines.top': False,
+ 'axes.spines.bottom': False}
+ with matplotlib.rc_context(rc_dict):
+ plt.subplots() # create a figure and axes with the spine properties
+
+
+@image_comparison(['rc_grid.png'], savefig_kwarg={'dpi': 40})
+def test_rc_grid():
+ fig = plt.figure()
+ rc_dict0 = {
+ 'axes.grid': True,
+ 'axes.grid.axis': 'both'
+ }
+ rc_dict1 = {
+ 'axes.grid': True,
+ 'axes.grid.axis': 'x'
+ }
+ rc_dict2 = {
+ 'axes.grid': True,
+ 'axes.grid.axis': 'y'
+ }
+ dict_list = [rc_dict0, rc_dict1, rc_dict2]
+
+ for i, rc_dict in enumerate(dict_list, 1):
+ with matplotlib.rc_context(rc_dict):
+ fig.add_subplot(3, 1, i)
+
+
+def test_rc_tick():
+ d = {'xtick.bottom': False, 'xtick.top': True,
+ 'ytick.left': True, 'ytick.right': False}
+ with plt.rc_context(rc=d):
+ fig = plt.figure()
+ ax1 = fig.add_subplot(1, 1, 1)
+ xax = ax1.xaxis
+ yax = ax1.yaxis
+ # tick1On bottom/left
+ assert not xax._major_tick_kw['tick1On']
+ assert xax._major_tick_kw['tick2On']
+ assert not xax._minor_tick_kw['tick1On']
+ assert xax._minor_tick_kw['tick2On']
+
+ assert yax._major_tick_kw['tick1On']
+ assert not yax._major_tick_kw['tick2On']
+ assert yax._minor_tick_kw['tick1On']
+ assert not yax._minor_tick_kw['tick2On']
+
+
+def test_rc_major_minor_tick():
+ d = {'xtick.top': True, 'ytick.right': True, # Enable all ticks
+ 'xtick.bottom': True, 'ytick.left': True,
+ # Selectively disable
+ 'xtick.minor.bottom': False, 'xtick.major.bottom': False,
+ 'ytick.major.left': False, 'ytick.minor.left': False}
+ with plt.rc_context(rc=d):
+ fig = plt.figure()
+ ax1 = fig.add_subplot(1, 1, 1)
+ xax = ax1.xaxis
+ yax = ax1.yaxis
+ # tick1On bottom/left
+ assert not xax._major_tick_kw['tick1On']
+ assert xax._major_tick_kw['tick2On']
+ assert not xax._minor_tick_kw['tick1On']
+ assert xax._minor_tick_kw['tick2On']
+
+ assert not yax._major_tick_kw['tick1On']
+ assert yax._major_tick_kw['tick2On']
+ assert not yax._minor_tick_kw['tick1On']
+ assert yax._minor_tick_kw['tick2On']
+
+
+def test_square_plot():
+ x = np.arange(4)
+ y = np.array([1., 3., 5., 7.])
+ fig, ax = plt.subplots()
+ ax.plot(x, y, 'mo')
+ ax.axis('square')
+ xlim, ylim = ax.get_xlim(), ax.get_ylim()
+ assert np.diff(xlim) == np.diff(ylim)
+ assert ax.get_aspect() == 1
+ assert_array_almost_equal(
+ ax.get_position(original=True).extents, (0.125, 0.1, 0.9, 0.9))
+ assert_array_almost_equal(
+ ax.get_position(original=False).extents, (0.2125, 0.1, 0.8125, 0.9))
+
+
+def test_bad_plot_args():
+ with pytest.raises(ValueError):
+ plt.plot(None)
+ with pytest.raises(ValueError):
+ plt.plot(None, None)
+ with pytest.raises(ValueError):
+ plt.plot(np.zeros((2, 2)), np.zeros((2, 3)))
+ with pytest.raises(ValueError):
+ plt.plot((np.arange(5).reshape((1, -1)), np.arange(5).reshape(-1, 1)))
+
+
+@pytest.mark.parametrize(
+ "xy, cls", [
+ ((), mpl.image.AxesImage), # (0, N)
+ (((3, 7), (2, 6)), mpl.image.AxesImage), # (xmin, xmax)
+ ((range(5), range(4)), mpl.image.AxesImage), # regular grid
+ (([1, 2, 4, 8, 16], [0, 1, 2, 3]), # irregular grid
+ mpl.image.PcolorImage),
+ ((np.random.random((4, 5)), np.random.random((4, 5))), # 2D coords
+ mpl.collections.QuadMesh),
+ ]
+)
+@pytest.mark.parametrize(
+ "data", [np.arange(12).reshape((3, 4)), np.random.rand(3, 4, 3)]
+)
+def test_pcolorfast(xy, data, cls):
+ fig, ax = plt.subplots()
+ assert type(ax.pcolorfast(*xy, data)) == cls
+
+
+def test_shared_scale():
+ fig, axs = plt.subplots(2, 2, sharex=True, sharey=True)
+
+ axs[0, 0].set_xscale("log")
+ axs[0, 0].set_yscale("log")
+
+ for ax in axs.flat:
+ assert ax.get_yscale() == 'log'
+ assert ax.get_xscale() == 'log'
+
+ axs[1, 1].set_xscale("linear")
+ axs[1, 1].set_yscale("linear")
+
+ for ax in axs.flat:
+ assert ax.get_yscale() == 'linear'
+ assert ax.get_xscale() == 'linear'
+
+
+def test_shared_bool():
+ with pytest.raises(TypeError):
+ plt.subplot(sharex=True)
+ with pytest.raises(TypeError):
+ plt.subplot(sharey=True)
+
+
+def test_violin_point_mass():
+ """Violin plot should handle point mass pdf gracefully."""
+ plt.violinplot(np.array([0, 0]))
+
+
+def generate_errorbar_inputs():
+ base_xy = cycler('x', [np.arange(5)]) + cycler('y', [np.ones(5)])
+ err_cycler = cycler('err', [1,
+ [1, 1, 1, 1, 1],
+ [[1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1]],
+ np.ones(5),
+ np.ones((2, 5)),
+ None
+ ])
+ xerr_cy = cycler('xerr', err_cycler)
+ yerr_cy = cycler('yerr', err_cycler)
+
+ empty = ((cycler('x', [[]]) + cycler('y', [[]])) *
+ cycler('xerr', [[], None]) * cycler('yerr', [[], None]))
+ xerr_only = base_xy * xerr_cy
+ yerr_only = base_xy * yerr_cy
+ both_err = base_xy * yerr_cy * xerr_cy
+
+ return [*xerr_only, *yerr_only, *both_err, *empty]
+
+
+@pytest.mark.parametrize('kwargs', generate_errorbar_inputs())
+def test_errorbar_inputs_shotgun(kwargs):
+ ax = plt.gca()
+ eb = ax.errorbar(**kwargs)
+ eb.remove()
+
+
+@image_comparison(["dash_offset"], remove_text=True)
+def test_dash_offset():
+ fig, ax = plt.subplots()
+ x = np.linspace(0, 10)
+ y = np.ones_like(x)
+ for j in range(0, 100, 2):
+ ax.plot(x, j*y, ls=(j, (10, 10)), lw=5, color='k')
+
+
+def test_title_pad():
+ # check that title padding puts the title in the right
+ # place...
+ fig, ax = plt.subplots()
+ ax.set_title('aardvark', pad=30.)
+ m = ax.titleOffsetTrans.get_matrix()
+ assert m[1, -1] == (30. / 72. * fig.dpi)
+ ax.set_title('aardvark', pad=0.)
+ m = ax.titleOffsetTrans.get_matrix()
+ assert m[1, -1] == 0.
+ # check that it is reverted...
+ ax.set_title('aardvark', pad=None)
+ m = ax.titleOffsetTrans.get_matrix()
+ assert m[1, -1] == (matplotlib.rcParams['axes.titlepad'] / 72. * fig.dpi)
+
+
+def test_title_location_roundtrip():
+ fig, ax = plt.subplots()
+ # set default title location
+ plt.rcParams['axes.titlelocation'] = 'center'
+ ax.set_title('aardvark')
+ ax.set_title('left', loc='left')
+ ax.set_title('right', loc='right')
+
+ assert 'left' == ax.get_title(loc='left')
+ assert 'right' == ax.get_title(loc='right')
+ assert 'aardvark' == ax.get_title(loc='center')
+
+ with pytest.raises(ValueError):
+ ax.get_title(loc='foo')
+ with pytest.raises(ValueError):
+ ax.set_title('fail', loc='foo')
+
+
+@image_comparison(["loglog.png"], remove_text=True, tol=0.02)
+def test_loglog():
+ fig, ax = plt.subplots()
+ x = np.arange(1, 11)
+ ax.loglog(x, x**3, lw=5)
+ ax.tick_params(length=25, width=2)
+ ax.tick_params(length=15, width=2, which='minor')
+
+
+@pytest.mark.parametrize("new_api", [False, True])
+@image_comparison(["test_loglog_nonpos.png"], remove_text=True, style='mpl20')
+def test_loglog_nonpos(new_api):
+ fig, axs = plt.subplots(3, 3)
+ x = np.arange(1, 11)
+ y = x**3
+ y[7] = -3.
+ x[4] = -10
+ for (i, j), ax in np.ndenumerate(axs):
+ mcx = ['mask', 'clip', ''][j]
+ mcy = ['mask', 'clip', ''][i]
+ if new_api:
+ if mcx == mcy:
+ if mcx:
+ ax.loglog(x, y**3, lw=2, nonpositive=mcx)
+ else:
+ ax.loglog(x, y**3, lw=2)
+ else:
+ ax.loglog(x, y**3, lw=2)
+ if mcx:
+ ax.set_xscale("log", nonpositive=mcx)
+ if mcy:
+ ax.set_yscale("log", nonpositive=mcy)
+ else:
+ kws = {}
+ if mcx:
+ kws['nonposx'] = mcx
+ if mcy:
+ kws['nonposy'] = mcy
+ with (pytest.warns(MatplotlibDeprecationWarning) if kws
+ else nullcontext()):
+ ax.loglog(x, y**3, lw=2, **kws)
+
+
+@pytest.mark.style('default')
+def test_axes_margins():
+ fig, ax = plt.subplots()
+ ax.plot([0, 1, 2, 3])
+ assert ax.get_ybound()[0] != 0
+
+ fig, ax = plt.subplots()
+ ax.bar([0, 1, 2, 3], [1, 1, 1, 1])
+ assert ax.get_ybound()[0] == 0
+
+ fig, ax = plt.subplots()
+ ax.barh([0, 1, 2, 3], [1, 1, 1, 1])
+ assert ax.get_xbound()[0] == 0
+
+ fig, ax = plt.subplots()
+ ax.pcolor(np.zeros((10, 10)))
+ assert ax.get_xbound() == (0, 10)
+ assert ax.get_ybound() == (0, 10)
+
+ fig, ax = plt.subplots()
+ ax.pcolorfast(np.zeros((10, 10)))
+ assert ax.get_xbound() == (0, 10)
+ assert ax.get_ybound() == (0, 10)
+
+ fig, ax = plt.subplots()
+ ax.hist(np.arange(10))
+ assert ax.get_ybound()[0] == 0
+
+ fig, ax = plt.subplots()
+ ax.imshow(np.zeros((10, 10)))
+ assert ax.get_xbound() == (-0.5, 9.5)
+ assert ax.get_ybound() == (-0.5, 9.5)
+
+
+@pytest.fixture(params=['x', 'y'])
+def shared_axis_remover(request):
+ def _helper_x(ax):
+ ax2 = ax.twinx()
+ ax2.remove()
+ ax.set_xlim(0, 15)
+ r = ax.xaxis.get_major_locator()()
+ assert r[-1] > 14
+
+ def _helper_y(ax):
+ ax2 = ax.twiny()
+ ax2.remove()
+ ax.set_ylim(0, 15)
+ r = ax.yaxis.get_major_locator()()
+ assert r[-1] > 14
+
+ return {"x": _helper_x, "y": _helper_y}[request.param]
+
+
+@pytest.fixture(params=['gca', 'subplots', 'subplots_shared', 'add_axes'])
+def shared_axes_generator(request):
+ # test all of the ways to get fig/ax sets
+ if request.param == 'gca':
+ fig = plt.figure()
+ ax = fig.gca()
+ elif request.param == 'subplots':
+ fig, ax = plt.subplots()
+ elif request.param == 'subplots_shared':
+ fig, ax_lst = plt.subplots(2, 2, sharex='all', sharey='all')
+ ax = ax_lst[0][0]
+ elif request.param == 'add_axes':
+ fig = plt.figure()
+ ax = fig.add_axes([.1, .1, .8, .8])
+ return fig, ax
+
+
+def test_remove_shared_axes(shared_axes_generator, shared_axis_remover):
+ # test all of the ways to get fig/ax sets
+ fig, ax = shared_axes_generator
+ shared_axis_remover(ax)
+
+
+def test_remove_shared_axes_relim():
+ fig, ax_lst = plt.subplots(2, 2, sharex='all', sharey='all')
+ ax = ax_lst[0][0]
+ orig_xlim = ax_lst[0][1].get_xlim()
+ ax.remove()
+ ax.set_xlim(0, 5)
+ assert_array_equal(ax_lst[0][1].get_xlim(), orig_xlim)
+
+
+def test_shared_axes_autoscale():
+ l = np.arange(-80, 90, 40)
+ t = np.random.random_sample((l.size, l.size))
+
+ fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True, sharey=True)
+
+ ax1.set_xlim(-1000, 1000)
+ ax1.set_ylim(-1000, 1000)
+ ax1.contour(l, l, t)
+
+ ax2.contour(l, l, t)
+ assert not ax1.get_autoscalex_on() and not ax2.get_autoscalex_on()
+ assert not ax1.get_autoscaley_on() and not ax2.get_autoscaley_on()
+ assert ax1.get_xlim() == ax2.get_xlim() == (-1000, 1000)
+ assert ax1.get_ylim() == ax2.get_ylim() == (-1000, 1000)
+
+
+def test_adjust_numtick_aspect():
+ fig, ax = plt.subplots()
+ ax.yaxis.get_major_locator().set_params(nbins='auto')
+ ax.set_xlim(0, 1000)
+ ax.set_aspect('equal')
+ fig.canvas.draw()
+ assert len(ax.yaxis.get_major_locator()()) == 2
+ ax.set_ylim(0, 1000)
+ fig.canvas.draw()
+ assert len(ax.yaxis.get_major_locator()()) > 2
+
+
+@image_comparison(["auto_numticks.png"], style='default')
+def test_auto_numticks():
+ # Make tiny, empty subplots, verify that there are only 3 ticks.
+ plt.subplots(4, 4)
+
+
+@image_comparison(["auto_numticks_log.png"], style='default')
+def test_auto_numticks_log():
+ # Verify that there are not too many ticks with a large log range.
+ fig, ax = plt.subplots()
+ matplotlib.rcParams['axes.autolimit_mode'] = 'round_numbers'
+ ax.loglog([1e-20, 1e5], [1e-16, 10])
+
+
+def test_broken_barh_empty():
+ fig, ax = plt.subplots()
+ ax.broken_barh([], (.1, .5))
+
+
+def test_broken_barh_timedelta():
+ """Check that timedelta works as x, dx pair for this method."""
+ fig, ax = plt.subplots()
+ d0 = datetime.datetime(2018, 11, 9, 0, 0, 0)
+ pp = ax.broken_barh([(d0, datetime.timedelta(hours=1))], [1, 2])
+ assert pp.get_paths()[0].vertices[0, 0] == mdates.date2num(d0)
+ assert pp.get_paths()[0].vertices[2, 0] == mdates.date2num(d0) + 1 / 24
+
+
+def test_pandas_pcolormesh(pd):
+ time = pd.date_range('2000-01-01', periods=10)
+ depth = np.arange(20)
+ data = np.random.rand(19, 9)
+
+ fig, ax = plt.subplots()
+ ax.pcolormesh(time, depth, data)
+
+
+def test_pandas_indexing_dates(pd):
+ dates = np.arange('2005-02', '2005-03', dtype='datetime64[D]')
+ values = np.sin(np.array(range(len(dates))))
+ df = pd.DataFrame({'dates': dates, 'values': values})
+
+ ax = plt.gca()
+
+ without_zero_index = df[np.array(df.index) % 2 == 1].copy()
+ ax.plot('dates', 'values', data=without_zero_index)
+
+
+def test_pandas_errorbar_indexing(pd):
+ df = pd.DataFrame(np.random.uniform(size=(5, 4)),
+ columns=['x', 'y', 'xe', 'ye'],
+ index=[1, 2, 3, 4, 5])
+ fig, ax = plt.subplots()
+ ax.errorbar('x', 'y', xerr='xe', yerr='ye', data=df)
+
+
+def test_pandas_index_shape(pd):
+ df = pd.DataFrame({"XX": [4, 5, 6], "YY": [7, 1, 2]})
+ fig, ax = plt.subplots()
+ ax.plot(df.index, df['YY'])
+
+
+def test_pandas_indexing_hist(pd):
+ ser_1 = pd.Series(data=[1, 2, 2, 3, 3, 4, 4, 4, 4, 5])
+ ser_2 = ser_1.iloc[1:]
+ fig, ax = plt.subplots()
+ ax.hist(ser_2)
+
+
+def test_pandas_bar_align_center(pd):
+ # Tests fix for issue 8767
+ df = pd.DataFrame({'a': range(2), 'b': range(2)})
+
+ fig, ax = plt.subplots(1)
+
+ ax.bar(df.loc[df['a'] == 1, 'b'],
+ df.loc[df['a'] == 1, 'b'],
+ align='center')
+
+ fig.canvas.draw()
+
+
+def test_axis_set_tick_params_labelsize_labelcolor():
+ # Tests fix for issue 4346
+ axis_1 = plt.subplot()
+ axis_1.yaxis.set_tick_params(labelsize=30, labelcolor='red',
+ direction='out')
+
+ # Expected values after setting the ticks
+ assert axis_1.yaxis.majorTicks[0]._size == 4.0
+ assert axis_1.yaxis.majorTicks[0].tick1line.get_color() == 'k'
+ assert axis_1.yaxis.majorTicks[0].label1.get_size() == 30.0
+ assert axis_1.yaxis.majorTicks[0].label1.get_color() == 'red'
+
+
+def test_axes_tick_params_gridlines():
+ # Now treating grid params like other Tick params
+ ax = plt.subplot()
+ ax.tick_params(grid_color='b', grid_linewidth=5, grid_alpha=0.5,
+ grid_linestyle='dashdot')
+ for axis in ax.xaxis, ax.yaxis:
+ assert axis.majorTicks[0].gridline.get_color() == 'b'
+ assert axis.majorTicks[0].gridline.get_linewidth() == 5
+ assert axis.majorTicks[0].gridline.get_alpha() == 0.5
+ assert axis.majorTicks[0].gridline.get_linestyle() == '-.'
+
+
+def test_axes_tick_params_ylabelside():
+ # Tests fix for issue 10267
+ ax = plt.subplot()
+ ax.tick_params(labelleft=False, labelright=True,
+ which='major')
+ ax.tick_params(labelleft=False, labelright=True,
+ which='minor')
+ # expects left false, right true
+ assert ax.yaxis.majorTicks[0].label1.get_visible() is False
+ assert ax.yaxis.majorTicks[0].label2.get_visible() is True
+ assert ax.yaxis.minorTicks[0].label1.get_visible() is False
+ assert ax.yaxis.minorTicks[0].label2.get_visible() is True
+
+
+def test_axes_tick_params_xlabelside():
+ # Tests fix for issue 10267
+ ax = plt.subplot()
+ ax.tick_params(labeltop=True, labelbottom=False,
+ which='major')
+ ax.tick_params(labeltop=True, labelbottom=False,
+ which='minor')
+ # expects top True, bottom False
+ # label1.get_visible() mapped to labelbottom
+ # label2.get_visible() mapped to labeltop
+ assert ax.xaxis.majorTicks[0].label1.get_visible() is False
+ assert ax.xaxis.majorTicks[0].label2.get_visible() is True
+ assert ax.xaxis.minorTicks[0].label1.get_visible() is False
+ assert ax.xaxis.minorTicks[0].label2.get_visible() is True
+
+
+def test_none_kwargs():
+ ax = plt.figure().subplots()
+ ln, = ax.plot(range(32), linestyle=None)
+ assert ln.get_linestyle() == '-'
+
+
+def test_bar_uint8():
+ xs = [0, 1, 2, 3]
+ b = plt.bar(np.array(xs, dtype=np.uint8), [2, 3, 4, 5], align="edge")
+ for (patch, x) in zip(b.patches, xs):
+ assert patch.xy[0] == x
+
+
+@image_comparison(['date_timezone_x.png'], tol=1.0)
+def test_date_timezone_x():
+ # Tests issue 5575
+ time_index = [datetime.datetime(2016, 2, 22, hour=x,
+ tzinfo=dateutil.tz.gettz('Canada/Eastern'))
+ for x in range(3)]
+
+ # Same Timezone
+ plt.figure(figsize=(20, 12))
+ plt.subplot(2, 1, 1)
+ plt.plot_date(time_index, [3] * 3, tz='Canada/Eastern')
+
+ # Different Timezone
+ plt.subplot(2, 1, 2)
+ plt.plot_date(time_index, [3] * 3, tz='UTC')
+
+
+@image_comparison(['date_timezone_y.png'])
+def test_date_timezone_y():
+ # Tests issue 5575
+ time_index = [datetime.datetime(2016, 2, 22, hour=x,
+ tzinfo=dateutil.tz.gettz('Canada/Eastern'))
+ for x in range(3)]
+
+ # Same Timezone
+ plt.figure(figsize=(20, 12))
+ plt.subplot(2, 1, 1)
+ plt.plot_date([3] * 3,
+ time_index, tz='Canada/Eastern', xdate=False, ydate=True)
+
+ # Different Timezone
+ plt.subplot(2, 1, 2)
+ plt.plot_date([3] * 3, time_index, tz='UTC', xdate=False, ydate=True)
+
+
+@image_comparison(['date_timezone_x_and_y.png'], tol=1.0)
+def test_date_timezone_x_and_y():
+ # Tests issue 5575
+ UTC = datetime.timezone.utc
+ time_index = [datetime.datetime(2016, 2, 22, hour=x, tzinfo=UTC)
+ for x in range(3)]
+
+ # Same Timezone
+ plt.figure(figsize=(20, 12))
+ plt.subplot(2, 1, 1)
+ plt.plot_date(time_index, time_index, tz='UTC', ydate=True)
+
+ # Different Timezone
+ plt.subplot(2, 1, 2)
+ plt.plot_date(time_index, time_index, tz='US/Eastern', ydate=True)
+
+
+@image_comparison(['axisbelow.png'], remove_text=True)
+def test_axisbelow():
+ # Test 'line' setting added in 6287.
+ # Show only grids, not frame or ticks, to make this test
+ # independent of future change to drawing order of those elements.
+ axs = plt.figure().subplots(ncols=3, sharex=True, sharey=True)
+ settings = (False, 'line', True)
+
+ for ax, setting in zip(axs, settings):
+ ax.plot((0, 10), (0, 10), lw=10, color='m')
+ circ = mpatches.Circle((3, 3), color='r')
+ ax.add_patch(circ)
+ ax.grid(color='c', linestyle='-', linewidth=3)
+ ax.tick_params(top=False, bottom=False,
+ left=False, right=False)
+ ax.spines[:].set_visible(False)
+ ax.set_axisbelow(setting)
+
+
+def test_titletwiny():
+ plt.style.use('mpl20')
+ fig, ax = plt.subplots(dpi=72)
+ ax2 = ax.twiny()
+ xlabel2 = ax2.set_xlabel('Xlabel2')
+ title = ax.set_title('Title')
+ fig.canvas.draw()
+ renderer = fig.canvas.get_renderer()
+ # ------- Test that title is put above Xlabel2 (Xlabel2 at top) ----------
+ bbox_y0_title = title.get_window_extent(renderer).y0 # bottom of title
+ bbox_y1_xlabel2 = xlabel2.get_window_extent(renderer).y1 # top of xlabel2
+ y_diff = bbox_y0_title - bbox_y1_xlabel2
+ assert np.isclose(y_diff, 3)
+
+
+def test_titlesetpos():
+ # Test that title stays put if we set it manually
+ fig, ax = plt.subplots()
+ fig.subplots_adjust(top=0.8)
+ ax2 = ax.twiny()
+ ax.set_xlabel('Xlabel')
+ ax2.set_xlabel('Xlabel2')
+ ax.set_title('Title')
+ pos = (0.5, 1.11)
+ ax.title.set_position(pos)
+ renderer = fig.canvas.get_renderer()
+ ax._update_title_position(renderer)
+ assert ax.title.get_position() == pos
+
+
+def test_title_xticks_top():
+ # Test that title moves if xticks on top of axes.
+ mpl.rcParams['axes.titley'] = None
+ fig, ax = plt.subplots()
+ ax.xaxis.set_ticks_position('top')
+ ax.set_title('xlabel top')
+ fig.canvas.draw()
+ assert ax.title.get_position()[1] > 1.04
+
+
+def test_title_xticks_top_both():
+ # Test that title moves if xticks on top of axes.
+ mpl.rcParams['axes.titley'] = None
+ fig, ax = plt.subplots()
+ ax.tick_params(axis="x",
+ bottom=True, top=True, labelbottom=True, labeltop=True)
+ ax.set_title('xlabel top')
+ fig.canvas.draw()
+ assert ax.title.get_position()[1] > 1.04
+
+
+def test_title_no_move_off_page():
+ # If an axes is off the figure (ie. if it is cropped during a save)
+ # make sure that the automatic title repositioning does not get done.
+ mpl.rcParams['axes.titley'] = None
+ fig = plt.figure()
+ ax = fig.add_axes([0.1, -0.5, 0.8, 0.2])
+ ax.tick_params(axis="x",
+ bottom=True, top=True, labelbottom=True, labeltop=True)
+ tt = ax.set_title('Boo')
+ fig.canvas.draw()
+ assert tt.get_position()[1] == 1.0
+
+
+def test_offset_label_color():
+ # Tests issue 6440
+ fig, ax = plt.subplots()
+ ax.plot([1.01e9, 1.02e9, 1.03e9])
+ ax.yaxis.set_tick_params(labelcolor='red')
+ assert ax.yaxis.get_offset_text().get_color() == 'red'
+
+
+def test_offset_text_visible():
+ fig, ax = plt.subplots()
+ ax.plot([1.01e9, 1.02e9, 1.03e9])
+ ax.yaxis.set_tick_params(label1On=False, label2On=True)
+ assert ax.yaxis.get_offset_text().get_visible()
+ ax.yaxis.set_tick_params(label2On=False)
+ assert not ax.yaxis.get_offset_text().get_visible()
+
+
+def test_large_offset():
+ fig, ax = plt.subplots()
+ ax.plot((1 + np.array([0, 1.e-12])) * 1.e27)
+ fig.canvas.draw()
+
+
+def test_barb_units():
+ fig, ax = plt.subplots()
+ dates = [datetime.datetime(2017, 7, 15, 18, i) for i in range(0, 60, 10)]
+ y = np.linspace(0, 5, len(dates))
+ u = v = np.linspace(0, 50, len(dates))
+ ax.barbs(dates, y, u, v)
+
+
+def test_quiver_units():
+ fig, ax = plt.subplots()
+ dates = [datetime.datetime(2017, 7, 15, 18, i) for i in range(0, 60, 10)]
+ y = np.linspace(0, 5, len(dates))
+ u = v = np.linspace(0, 50, len(dates))
+ ax.quiver(dates, y, u, v)
+
+
+def test_bar_color_cycle():
+ to_rgb = mcolors.to_rgb
+ fig, ax = plt.subplots()
+ for j in range(5):
+ ln, = ax.plot(range(3))
+ brs = ax.bar(range(3), range(3))
+ for br in brs:
+ assert to_rgb(ln.get_color()) == to_rgb(br.get_facecolor())
+
+
+def test_tick_param_label_rotation():
+ fix, (ax, ax2) = plt.subplots(1, 2)
+ ax.plot([0, 1], [0, 1])
+ ax2.plot([0, 1], [0, 1])
+ ax.xaxis.set_tick_params(which='both', rotation=75)
+ ax.yaxis.set_tick_params(which='both', rotation=90)
+ for text in ax.get_xticklabels(which='both'):
+ assert text.get_rotation() == 75
+ for text in ax.get_yticklabels(which='both'):
+ assert text.get_rotation() == 90
+
+ ax2.tick_params(axis='x', labelrotation=53)
+ ax2.tick_params(axis='y', rotation=35)
+ for text in ax2.get_xticklabels(which='major'):
+ assert text.get_rotation() == 53
+ for text in ax2.get_yticklabels(which='major'):
+ assert text.get_rotation() == 35
+
+
+@pytest.mark.style('default')
+def test_fillbetween_cycle():
+ fig, ax = plt.subplots()
+
+ for j in range(3):
+ cc = ax.fill_between(range(3), range(3))
+ target = mcolors.to_rgba('C{}'.format(j))
+ assert tuple(cc.get_facecolors().squeeze()) == tuple(target)
+
+ for j in range(3, 6):
+ cc = ax.fill_betweenx(range(3), range(3))
+ target = mcolors.to_rgba('C{}'.format(j))
+ assert tuple(cc.get_facecolors().squeeze()) == tuple(target)
+
+ target = mcolors.to_rgba('k')
+
+ for al in ['facecolor', 'facecolors', 'color']:
+ cc = ax.fill_between(range(3), range(3), **{al: 'k'})
+ assert tuple(cc.get_facecolors().squeeze()) == tuple(target)
+
+ edge_target = mcolors.to_rgba('k')
+ for j, el in enumerate(['edgecolor', 'edgecolors'], start=6):
+ cc = ax.fill_between(range(3), range(3), **{el: 'k'})
+ face_target = mcolors.to_rgba('C{}'.format(j))
+ assert tuple(cc.get_facecolors().squeeze()) == tuple(face_target)
+ assert tuple(cc.get_edgecolors().squeeze()) == tuple(edge_target)
+
+
+def test_log_margins():
+ plt.rcParams['axes.autolimit_mode'] = 'data'
+ fig, ax = plt.subplots()
+ margin = 0.05
+ ax.set_xmargin(margin)
+ ax.semilogx([10, 100], [10, 100])
+ xlim0, xlim1 = ax.get_xlim()
+ transform = ax.xaxis.get_transform()
+ xlim0t, xlim1t = transform.transform([xlim0, xlim1])
+ x0t, x1t = transform.transform([10, 100])
+ delta = (x1t - x0t) * margin
+ assert_allclose([xlim0t + delta, xlim1t - delta], [x0t, x1t])
+
+
+def test_color_length_mismatch():
+ N = 5
+ x, y = np.arange(N), np.arange(N)
+ colors = np.arange(N+1)
+ fig, ax = plt.subplots()
+ with pytest.raises(ValueError):
+ ax.scatter(x, y, c=colors)
+ c_rgb = (0.5, 0.5, 0.5)
+ ax.scatter(x, y, c=c_rgb)
+ ax.scatter(x, y, c=[c_rgb] * N)
+
+
+def test_eventplot_legend():
+ plt.eventplot([1.0], label='Label')
+ plt.legend()
+
+
+def test_bar_broadcast_args():
+ fig, ax = plt.subplots()
+ # Check that a bar chart with a single height for all bars works.
+ ax.bar(range(4), 1)
+ # Check that a horizontal chart with one width works.
+ ax.barh(0, 1, left=range(4), height=1)
+ # Check that edgecolor gets broadcast.
+ rect1, rect2 = ax.bar([0, 1], [0, 1], edgecolor=(.1, .2, .3, .4))
+ assert rect1.get_edgecolor() == rect2.get_edgecolor() == (.1, .2, .3, .4)
+
+
+def test_invalid_axis_limits():
+ plt.plot([0, 1], [0, 1])
+ with pytest.raises(ValueError):
+ plt.xlim(np.nan)
+ with pytest.raises(ValueError):
+ plt.xlim(np.inf)
+ with pytest.raises(ValueError):
+ plt.ylim(np.nan)
+ with pytest.raises(ValueError):
+ plt.ylim(np.inf)
+
+
+# Test all 4 combinations of logs/symlogs for minorticks_on()
+@pytest.mark.parametrize('xscale', ['symlog', 'log'])
+@pytest.mark.parametrize('yscale', ['symlog', 'log'])
+def test_minorticks_on(xscale, yscale):
+ ax = plt.subplot()
+ ax.plot([1, 2, 3, 4])
+ ax.set_xscale(xscale)
+ ax.set_yscale(yscale)
+ ax.minorticks_on()
+
+
+def test_twinx_knows_limits():
+ fig, ax = plt.subplots()
+
+ ax.axvspan(1, 2)
+ xtwin = ax.twinx()
+ xtwin.plot([0, 0.5], [1, 2])
+ # control axis
+ fig2, ax2 = plt.subplots()
+
+ ax2.axvspan(1, 2)
+ ax2.plot([0, 0.5], [1, 2])
+
+ assert_array_equal(xtwin.viewLim.intervalx, ax2.viewLim.intervalx)
+
+
+def test_zero_linewidth():
+ # Check that setting a zero linewidth doesn't error
+ plt.plot([0, 1], [0, 1], ls='--', lw=0)
+
+
+def test_empty_errorbar_legend():
+ fig, ax = plt.subplots()
+ ax.errorbar([], [], xerr=[], label='empty y')
+ ax.errorbar([], [], yerr=[], label='empty x')
+ ax.legend()
+
+
+@check_figures_equal(extensions=["png"])
+def test_plot_decimal(fig_test, fig_ref):
+ x0 = np.arange(-10, 10, 0.3)
+ y0 = [5.2 * x ** 3 - 2.1 * x ** 2 + 7.34 * x + 4.5 for x in x0]
+ x = [Decimal(i) for i in x0]
+ y = [Decimal(i) for i in y0]
+ # Test image - line plot with Decimal input
+ fig_test.subplots().plot(x, y)
+ # Reference image
+ fig_ref.subplots().plot(x0, y0)
+
+
+# pdf and svg tests fail using travis' old versions of gs and inkscape.
+@check_figures_equal(extensions=["png"])
+def test_markerfacecolor_none_alpha(fig_test, fig_ref):
+ fig_test.subplots().plot(0, "o", mfc="none", alpha=.5)
+ fig_ref.subplots().plot(0, "o", mfc="w", alpha=.5)
+
+
+def test_tick_padding_tightbbox():
+ """Test that tick padding gets turned off if axis is off"""
+ plt.rcParams["xtick.direction"] = "out"
+ plt.rcParams["ytick.direction"] = "out"
+ fig, ax = plt.subplots()
+ bb = ax.get_tightbbox(fig.canvas.get_renderer())
+ ax.axis('off')
+ bb2 = ax.get_tightbbox(fig.canvas.get_renderer())
+ assert bb.x0 < bb2.x0
+ assert bb.y0 < bb2.y0
+
+
+def test_inset():
+ """
+ Ensure that inset_ax argument is indeed optional
+ """
+ dx, dy = 0.05, 0.05
+ # generate 2 2d grids for the x & y bounds
+ y, x = np.mgrid[slice(1, 5 + dy, dy),
+ slice(1, 5 + dx, dx)]
+ z = np.sin(x) ** 10 + np.cos(10 + y * x) * np.cos(x)
+
+ fig, ax = plt.subplots()
+ ax.pcolormesh(x, y, z[:-1, :-1])
+ ax.set_aspect(1.)
+ ax.apply_aspect()
+ # we need to apply_aspect to make the drawing below work.
+
+ xlim = [1.5, 2.15]
+ ylim = [2, 2.5]
+
+ rect = [xlim[0], ylim[0], xlim[1] - xlim[0], ylim[1] - ylim[0]]
+
+ rec, connectors = ax.indicate_inset(bounds=rect)
+ assert connectors is None
+ fig.canvas.draw()
+ xx = np.array([[1.5, 2.],
+ [2.15, 2.5]])
+ assert np.all(rec.get_bbox().get_points() == xx)
+
+
+def test_zoom_inset():
+ dx, dy = 0.05, 0.05
+ # generate 2 2d grids for the x & y bounds
+ y, x = np.mgrid[slice(1, 5 + dy, dy),
+ slice(1, 5 + dx, dx)]
+ z = np.sin(x)**10 + np.cos(10 + y*x) * np.cos(x)
+
+ fig, ax = plt.subplots()
+ ax.pcolormesh(x, y, z[:-1, :-1])
+ ax.set_aspect(1.)
+ ax.apply_aspect()
+ # we need to apply_aspect to make the drawing below work.
+
+ # Make the inset_axes... Position axes coordinates...
+ axin1 = ax.inset_axes([0.7, 0.7, 0.35, 0.35])
+ # redraw the data in the inset axes...
+ axin1.pcolormesh(x, y, z[:-1, :-1])
+ axin1.set_xlim([1.5, 2.15])
+ axin1.set_ylim([2, 2.5])
+ axin1.set_aspect(ax.get_aspect())
+
+ rec, connectors = ax.indicate_inset_zoom(axin1)
+ assert len(connectors) == 4
+ fig.canvas.draw()
+ xx = np.array([[1.5, 2.],
+ [2.15, 2.5]])
+ assert(np.all(rec.get_bbox().get_points() == xx))
+ xx = np.array([[0.6325, 0.692308],
+ [0.8425, 0.907692]])
+ np.testing.assert_allclose(
+ axin1.get_position().get_points(), xx, rtol=1e-4)
+
+
+@pytest.mark.parametrize('x_inverted', [False, True])
+@pytest.mark.parametrize('y_inverted', [False, True])
+def test_indicate_inset_inverted(x_inverted, y_inverted):
+ """
+ Test that the inset lines are correctly located with inverted data axes.
+ """
+ fig, (ax1, ax2) = plt.subplots(1, 2)
+
+ x = np.arange(10)
+ ax1.plot(x, x, 'o')
+ if x_inverted:
+ ax1.invert_xaxis()
+ if y_inverted:
+ ax1.invert_yaxis()
+
+ rect, bounds = ax1.indicate_inset([2, 2, 5, 4], ax2)
+ lower_left, upper_left, lower_right, upper_right = bounds
+
+ sign_x = -1 if x_inverted else 1
+ sign_y = -1 if y_inverted else 1
+ assert sign_x * (lower_right.xy2[0] - lower_left.xy2[0]) > 0
+ assert sign_x * (upper_right.xy2[0] - upper_left.xy2[0]) > 0
+ assert sign_y * (upper_left.xy2[1] - lower_left.xy2[1]) > 0
+ assert sign_y * (upper_right.xy2[1] - lower_right.xy2[1]) > 0
+
+
+def test_set_position():
+ fig, ax = plt.subplots()
+ ax.set_aspect(3.)
+ ax.set_position([0.1, 0.1, 0.4, 0.4], which='both')
+ assert np.allclose(ax.get_position().width, 0.1)
+ ax.set_aspect(2.)
+ ax.set_position([0.1, 0.1, 0.4, 0.4], which='original')
+ assert np.allclose(ax.get_position().width, 0.15)
+ ax.set_aspect(3.)
+ ax.set_position([0.1, 0.1, 0.4, 0.4], which='active')
+ assert np.allclose(ax.get_position().width, 0.1)
+
+
+def test_spines_properbbox_after_zoom():
+ fig, ax = plt.subplots()
+ bb = ax.spines.bottom.get_window_extent(fig.canvas.get_renderer())
+ # this is what zoom calls:
+ ax._set_view_from_bbox((320, 320, 500, 500), 'in',
+ None, False, False)
+ bb2 = ax.spines.bottom.get_window_extent(fig.canvas.get_renderer())
+ np.testing.assert_allclose(bb.get_points(), bb2.get_points(), rtol=1e-6)
+
+
+def test_cartopy_backcompat():
+
+ class Dummy(matplotlib.axes.Axes):
+ ...
+
+ class DummySubplot(matplotlib.axes.SubplotBase, Dummy):
+ _axes_class = Dummy
+
+ matplotlib.axes._subplots._subplot_classes[Dummy] = DummySubplot
+
+ FactoryDummySubplot = matplotlib.axes.subplot_class_factory(Dummy)
+
+ assert DummySubplot is FactoryDummySubplot
+
+
+def test_gettightbbox_ignore_nan():
+ fig, ax = plt.subplots()
+ remove_ticks_and_titles(fig)
+ ax.text(np.NaN, 1, 'Boo')
+ renderer = fig.canvas.get_renderer()
+ np.testing.assert_allclose(ax.get_tightbbox(renderer).width, 496)
+
+
+def test_scatter_series_non_zero_index(pd):
+ # create non-zero index
+ ids = range(10, 18)
+ x = pd.Series(np.random.uniform(size=8), index=ids)
+ y = pd.Series(np.random.uniform(size=8), index=ids)
+ c = pd.Series([1, 1, 1, 1, 1, 0, 0, 0], index=ids)
+ plt.scatter(x, y, c)
+
+
+def test_scatter_empty_data():
+ # making sure this does not raise an exception
+ plt.scatter([], [])
+ plt.scatter([], [], s=[], c=[])
+
+
+@image_comparison(['annotate_across_transforms.png'],
+ style='mpl20', remove_text=True)
+def test_annotate_across_transforms():
+ x = np.linspace(0, 10, 200)
+ y = np.exp(-x) * np.sin(x)
+
+ fig, ax = plt.subplots(figsize=(3.39, 3))
+ ax.plot(x, y)
+ axins = ax.inset_axes([0.4, 0.5, 0.3, 0.3])
+ axins.set_aspect(0.2)
+ axins.xaxis.set_visible(False)
+ axins.yaxis.set_visible(False)
+ ax.annotate("", xy=(x[150], y[150]), xycoords=ax.transData,
+ xytext=(1, 0), textcoords=axins.transAxes,
+ arrowprops=dict(arrowstyle="->"))
+
+
+@image_comparison(['secondary_xy.png'], style='mpl20')
+def test_secondary_xy():
+ fig, axs = plt.subplots(1, 2, figsize=(10, 5), constrained_layout=True)
+
+ def invert(x):
+ with np.errstate(divide='ignore'):
+ return 1 / x
+
+ for nn, ax in enumerate(axs):
+ ax.plot(np.arange(2, 11), np.arange(2, 11))
+ if nn == 0:
+ secax = ax.secondary_xaxis
+ else:
+ secax = ax.secondary_yaxis
+
+ secax(0.2, functions=(invert, invert))
+ secax(0.4, functions=(lambda x: 2 * x, lambda x: x / 2))
+ secax(0.6, functions=(lambda x: x**2, lambda x: x**(1/2)))
+ secax(0.8)
+
+
+def test_secondary_fail():
+ fig, ax = plt.subplots()
+ ax.plot(np.arange(2, 11), np.arange(2, 11))
+ with pytest.raises(ValueError):
+ ax.secondary_xaxis(0.2, functions=(lambda x: 1 / x))
+ with pytest.raises(ValueError):
+ ax.secondary_xaxis('right')
+ with pytest.raises(ValueError):
+ ax.secondary_yaxis('bottom')
+
+
+def test_secondary_resize():
+ fig, ax = plt.subplots(figsize=(10, 5))
+ ax.plot(np.arange(2, 11), np.arange(2, 11))
+
+ def invert(x):
+ with np.errstate(divide='ignore'):
+ return 1 / x
+
+ ax.secondary_xaxis('top', functions=(invert, invert))
+ fig.canvas.draw()
+ fig.set_size_inches((7, 4))
+ assert_allclose(ax.get_position().extents, [0.125, 0.1, 0.9, 0.9])
+
+
+def test_secondary_minorloc():
+ fig, ax = plt.subplots(figsize=(10, 5))
+ ax.plot(np.arange(2, 11), np.arange(2, 11))
+
+ def invert(x):
+ with np.errstate(divide='ignore'):
+ return 1 / x
+
+ secax = ax.secondary_xaxis('top', functions=(invert, invert))
+ assert isinstance(secax._axis.get_minor_locator(),
+ mticker.NullLocator)
+ secax.minorticks_on()
+ assert isinstance(secax._axis.get_minor_locator(),
+ mticker.AutoMinorLocator)
+ ax.set_xscale('log')
+ plt.draw()
+ assert isinstance(secax._axis.get_minor_locator(),
+ mticker.LogLocator)
+ ax.set_xscale('linear')
+ plt.draw()
+ assert isinstance(secax._axis.get_minor_locator(),
+ mticker.NullLocator)
+
+
+def test_secondary_formatter():
+ fig, ax = plt.subplots()
+ ax.set_xscale("log")
+ secax = ax.secondary_xaxis("top")
+ secax.xaxis.set_major_formatter(mticker.ScalarFormatter())
+ fig.canvas.draw()
+ assert isinstance(
+ secax.xaxis.get_major_formatter(), mticker.ScalarFormatter)
+
+
+def color_boxes(fig, axs):
+ """
+ Helper for the tests below that test the extents of various axes elements
+ """
+ fig.canvas.draw()
+
+ renderer = fig.canvas.get_renderer()
+ bbaxis = []
+ for nn, axx in enumerate([axs.xaxis, axs.yaxis]):
+ bb = axx.get_tightbbox(renderer)
+ if bb:
+ axisr = plt.Rectangle(
+ (bb.x0, bb.y0), width=bb.width, height=bb.height,
+ linewidth=0.7, edgecolor='y', facecolor="none", transform=None,
+ zorder=3)
+ fig.add_artist(axisr)
+ bbaxis += [bb]
+
+ bbspines = []
+ for nn, a in enumerate(['bottom', 'top', 'left', 'right']):
+ bb = axs.spines[a].get_window_extent(renderer)
+ spiner = plt.Rectangle(
+ (bb.x0, bb.y0), width=bb.width, height=bb.height,
+ linewidth=0.7, edgecolor="green", facecolor="none", transform=None,
+ zorder=3)
+ fig.add_artist(spiner)
+ bbspines += [bb]
+
+ bb = axs.get_window_extent()
+ rect2 = plt.Rectangle(
+ (bb.x0, bb.y0), width=bb.width, height=bb.height,
+ linewidth=1.5, edgecolor="magenta", facecolor="none", transform=None,
+ zorder=2)
+ fig.add_artist(rect2)
+ bbax = bb
+
+ bb2 = axs.get_tightbbox(renderer)
+ rect2 = plt.Rectangle(
+ (bb2.x0, bb2.y0), width=bb2.width, height=bb2.height,
+ linewidth=3, edgecolor="red", facecolor="none", transform=None,
+ zorder=1)
+ fig.add_artist(rect2)
+ bbtb = bb2
+ return bbaxis, bbspines, bbax, bbtb
+
+
+def test_normal_axes():
+ with rc_context({'_internal.classic_mode': False}):
+ fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
+ fig.canvas.draw()
+ plt.close(fig)
+ bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
+
+ # test the axis bboxes
+ target = [
+ [123.375, 75.88888888888886, 983.25, 33.0],
+ [85.51388888888889, 99.99999999999997, 53.375, 993.0]
+ ]
+ for nn, b in enumerate(bbaxis):
+ targetbb = mtransforms.Bbox.from_bounds(*target[nn])
+ assert_array_almost_equal(b.bounds, targetbb.bounds, decimal=2)
+
+ target = [
+ [150.0, 119.999, 930.0, 11.111],
+ [150.0, 1080.0, 930.0, 0.0],
+ [150.0, 119.9999, 11.111, 960.0],
+ [1068.8888, 119.9999, 11.111, 960.0]
+ ]
+ for nn, b in enumerate(bbspines):
+ targetbb = mtransforms.Bbox.from_bounds(*target[nn])
+ assert_array_almost_equal(b.bounds, targetbb.bounds, decimal=2)
+
+ target = [150.0, 119.99999999999997, 930.0, 960.0]
+ targetbb = mtransforms.Bbox.from_bounds(*target)
+ assert_array_almost_equal(bbax.bounds, targetbb.bounds, decimal=2)
+
+ target = [85.5138, 75.88888, 1021.11, 1017.11]
+ targetbb = mtransforms.Bbox.from_bounds(*target)
+ assert_array_almost_equal(bbtb.bounds, targetbb.bounds, decimal=2)
+
+ # test that get_position roundtrips to get_window_extent
+ axbb = ax.get_position().transformed(fig.transFigure).bounds
+ assert_array_almost_equal(axbb, ax.get_window_extent().bounds, decimal=2)
+
+
+def test_nodecorator():
+ with rc_context({'_internal.classic_mode': False}):
+ fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
+ fig.canvas.draw()
+ ax.set(xticklabels=[], yticklabels=[])
+ bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
+
+ # test the axis bboxes
+ for nn, b in enumerate(bbaxis):
+ assert b is None
+
+ target = [
+ [150.0, 119.999, 930.0, 11.111],
+ [150.0, 1080.0, 930.0, 0.0],
+ [150.0, 119.9999, 11.111, 960.0],
+ [1068.8888, 119.9999, 11.111, 960.0]
+ ]
+ for nn, b in enumerate(bbspines):
+ targetbb = mtransforms.Bbox.from_bounds(*target[nn])
+ assert_allclose(b.bounds, targetbb.bounds, atol=1e-2)
+
+ target = [150.0, 119.99999999999997, 930.0, 960.0]
+ targetbb = mtransforms.Bbox.from_bounds(*target)
+ assert_allclose(bbax.bounds, targetbb.bounds, atol=1e-2)
+
+ target = [150., 120., 930., 960.]
+ targetbb = mtransforms.Bbox.from_bounds(*target)
+ assert_allclose(bbtb.bounds, targetbb.bounds, atol=1e-2)
+
+
+def test_displaced_spine():
+ with rc_context({'_internal.classic_mode': False}):
+ fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
+ ax.set(xticklabels=[], yticklabels=[])
+ ax.spines.bottom.set_position(('axes', -0.1))
+ fig.canvas.draw()
+ bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
+
+ targets = [
+ [150., 24., 930., 11.111111],
+ [150.0, 1080.0, 930.0, 0.0],
+ [150.0, 119.9999, 11.111, 960.0],
+ [1068.8888, 119.9999, 11.111, 960.0]
+ ]
+ for target, bbspine in zip(targets, bbspines):
+ targetbb = mtransforms.Bbox.from_bounds(*target)
+ assert_allclose(bbspine.bounds, targetbb.bounds, atol=1e-2)
+
+ target = [150.0, 119.99999999999997, 930.0, 960.0]
+ targetbb = mtransforms.Bbox.from_bounds(*target)
+ assert_allclose(bbax.bounds, targetbb.bounds, atol=1e-2)
+
+ target = [150., 24., 930., 1056.]
+ targetbb = mtransforms.Bbox.from_bounds(*target)
+ assert_allclose(bbtb.bounds, targetbb.bounds, atol=1e-2)
+
+
+def test_tickdirs():
+ """
+ Switch the tickdirs and make sure the bboxes switch with them
+ """
+ targets = [[[150.0, 120.0, 930.0, 11.1111],
+ [150.0, 120.0, 11.111, 960.0]],
+ [[150.0, 108.8889, 930.0, 11.111111111111114],
+ [138.889, 120, 11.111, 960.0]],
+ [[150.0, 114.44444444444441, 930.0, 11.111111111111114],
+ [144.44444444444446, 119.999, 11.111, 960.0]]]
+ for dnum, dirs in enumerate(['in', 'out', 'inout']):
+ with rc_context({'_internal.classic_mode': False}):
+ fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
+ ax.tick_params(direction=dirs)
+ fig.canvas.draw()
+ bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
+ for nn, num in enumerate([0, 2]):
+ targetbb = mtransforms.Bbox.from_bounds(*targets[dnum][nn])
+ assert_allclose(
+ bbspines[num].bounds, targetbb.bounds, atol=1e-2)
+
+
+def test_minor_accountedfor():
+ with rc_context({'_internal.classic_mode': False}):
+ fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
+ fig.canvas.draw()
+ ax.tick_params(which='both', direction='out')
+
+ bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
+ bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
+ targets = [[150.0, 108.88888888888886, 930.0, 11.111111111111114],
+ [138.8889, 119.9999, 11.1111, 960.0]]
+ for n in range(2):
+ targetbb = mtransforms.Bbox.from_bounds(*targets[n])
+ assert_allclose(
+ bbspines[n * 2].bounds, targetbb.bounds, atol=1e-2)
+
+ fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
+ fig.canvas.draw()
+ ax.tick_params(which='both', direction='out')
+ ax.minorticks_on()
+ ax.tick_params(axis='both', which='minor', length=30)
+ fig.canvas.draw()
+ bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
+ targets = [[150.0, 36.66666666666663, 930.0, 83.33333333333334],
+ [66.6667, 120.0, 83.3333, 960.0]]
+
+ for n in range(2):
+ targetbb = mtransforms.Bbox.from_bounds(*targets[n])
+ assert_allclose(
+ bbspines[n * 2].bounds, targetbb.bounds, atol=1e-2)
+
+
+@check_figures_equal(extensions=["png"])
+def test_axis_bool_arguments(fig_test, fig_ref):
+ # Test if False and "off" give the same
+ fig_test.add_subplot(211).axis(False)
+ fig_ref.add_subplot(211).axis("off")
+ # Test if True after False gives the same as "on"
+ ax = fig_test.add_subplot(212)
+ ax.axis(False)
+ ax.axis(True)
+ fig_ref.add_subplot(212).axis("on")
+
+
+def test_axis_extent_arg():
+ fig, ax = plt.subplots()
+ xmin = 5
+ xmax = 10
+ ymin = 15
+ ymax = 20
+ extent = ax.axis([xmin, xmax, ymin, ymax])
+
+ # test that the docstring is correct
+ assert tuple(extent) == (xmin, xmax, ymin, ymax)
+
+ # test that limits were set per the docstring
+ assert (xmin, xmax) == ax.get_xlim()
+ assert (ymin, ymax) == ax.get_ylim()
+
+
+def test_datetime_masked():
+ # make sure that all-masked data falls back to the viewlim
+ # set in convert.axisinfo....
+ x = np.array([datetime.datetime(2017, 1, n) for n in range(1, 6)])
+ y = np.array([1, 2, 3, 4, 5])
+ m = np.ma.masked_greater(y, 0)
+
+ fig, ax = plt.subplots()
+ ax.plot(x, m)
+ dt = mdates.date2num(np.datetime64('0000-12-31'))
+ assert ax.get_xlim() == (730120.0 + dt, 733773.0 + dt)
+
+
+def test_hist_auto_bins():
+ _, bins, _ = plt.hist([[1, 2, 3], [3, 4, 5, 6]], bins='auto')
+ assert bins[0] <= 1
+ assert bins[-1] >= 6
+
+
+def test_hist_nan_data():
+ fig, (ax1, ax2) = plt.subplots(2)
+
+ data = [1, 2, 3]
+ nan_data = data + [np.nan]
+
+ bins, edges, _ = ax1.hist(data)
+ with np.errstate(invalid='ignore'):
+ nanbins, nanedges, _ = ax2.hist(nan_data)
+
+ np.testing.assert_allclose(bins, nanbins)
+ np.testing.assert_allclose(edges, nanedges)
+
+
+def test_hist_range_and_density():
+ _, bins, _ = plt.hist(np.random.rand(10), "auto",
+ range=(0, 1), density=True)
+ assert bins[0] == 0
+ assert bins[-1] == 1
+
+
+def test_bar_errbar_zorder():
+ # Check that the zorder of errorbars is always greater than the bar they
+ # are plotted on
+ fig, ax = plt.subplots()
+ x = [1, 2, 3]
+ barcont = ax.bar(x=x, height=x, yerr=x, capsize=5, zorder=3)
+
+ data_line, caplines, barlinecols = barcont.errorbar.lines
+ for bar in barcont.patches:
+ for capline in caplines:
+ assert capline.zorder > bar.zorder
+ for barlinecol in barlinecols:
+ assert barlinecol.zorder > bar.zorder
+
+
+def test_set_ticks_inverted():
+ fig, ax = plt.subplots()
+ ax.invert_xaxis()
+ ax.set_xticks([.3, .7])
+ assert ax.get_xlim() == (1, 0)
+
+
+def test_aspect_nonlinear_adjustable_box():
+ fig = plt.figure(figsize=(10, 10)) # Square.
+
+ ax = fig.add_subplot()
+ ax.plot([.4, .6], [.4, .6]) # Set minpos to keep logit happy.
+ ax.set(xscale="log", xlim=(1, 10),
+ yscale="logit", ylim=(1/11, 1/1001),
+ aspect=1, adjustable="box")
+ ax.margins(0)
+ pos = fig.transFigure.transform_bbox(ax.get_position())
+ assert pos.height / pos.width == pytest.approx(2)
+
+
+def test_aspect_nonlinear_adjustable_datalim():
+ fig = plt.figure(figsize=(10, 10)) # Square.
+
+ ax = fig.add_axes([.1, .1, .8, .8]) # Square.
+ ax.plot([.4, .6], [.4, .6]) # Set minpos to keep logit happy.
+ ax.set(xscale="log", xlim=(1, 100),
+ yscale="logit", ylim=(1 / 101, 1 / 11),
+ aspect=1, adjustable="datalim")
+ ax.margins(0)
+ ax.apply_aspect()
+
+ assert ax.get_xlim() == pytest.approx([1*10**(1/2), 100/10**(1/2)])
+ assert ax.get_ylim() == (1 / 101, 1 / 11)
+
+
+def test_box_aspect():
+ # Test if axes with box_aspect=1 has same dimensions
+ # as axes with aspect equal and adjustable="box"
+
+ fig1, ax1 = plt.subplots()
+ axtwin = ax1.twinx()
+ axtwin.plot([12, 344])
+
+ ax1.set_box_aspect(1)
+
+ fig2, ax2 = plt.subplots()
+ ax2.margins(0)
+ ax2.plot([0, 2], [6, 8])
+ ax2.set_aspect("equal", adjustable="box")
+
+ fig1.canvas.draw()
+ fig2.canvas.draw()
+
+ bb1 = ax1.get_position()
+ bbt = axtwin.get_position()
+ bb2 = ax2.get_position()
+
+ assert_array_equal(bb1.extents, bb2.extents)
+ assert_array_equal(bbt.extents, bb2.extents)
+
+
+def test_box_aspect_custom_position():
+ # Test if axes with custom position and box_aspect
+ # behaves the same independent of the order of setting those.
+
+ fig1, ax1 = plt.subplots()
+ ax1.set_position([0.1, 0.1, 0.9, 0.2])
+ fig1.canvas.draw()
+ ax1.set_box_aspect(1.)
+
+ fig2, ax2 = plt.subplots()
+ ax2.set_box_aspect(1.)
+ fig2.canvas.draw()
+ ax2.set_position([0.1, 0.1, 0.9, 0.2])
+
+ fig1.canvas.draw()
+ fig2.canvas.draw()
+
+ bb1 = ax1.get_position()
+ bb2 = ax2.get_position()
+
+ assert_array_equal(bb1.extents, bb2.extents)
+
+
+def test_bbox_aspect_axes_init():
+ # Test that box_aspect can be given to axes init and produces
+ # all equal square axes.
+ fig, axs = plt.subplots(2, 3, subplot_kw=dict(box_aspect=1),
+ constrained_layout=True)
+ fig.canvas.draw()
+ renderer = fig.canvas.get_renderer()
+ sizes = []
+ for ax in axs.flat:
+ bb = ax.get_window_extent(renderer)
+ sizes.extend([bb.width, bb.height])
+
+ assert_allclose(sizes, sizes[0])
+
+
+def test_redraw_in_frame():
+ fig, ax = plt.subplots(1, 1)
+ ax.plot([1, 2, 3])
+ fig.canvas.draw()
+ ax.redraw_in_frame()
+
+
+def test_invisible_axes():
+ # invisible axes should not respond to events...
+ fig, ax = plt.subplots()
+ assert fig.canvas.inaxes((200, 200)) is not None
+ ax.set_visible(False)
+ assert fig.canvas.inaxes((200, 200)) is None
+
+
+def test_xtickcolor_is_not_markercolor():
+ plt.rcParams['lines.markeredgecolor'] = 'white'
+ ax = plt.axes()
+ ticks = ax.xaxis.get_major_ticks()
+ for tick in ticks:
+ assert tick.tick1line.get_markeredgecolor() != 'white'
+
+
+def test_ytickcolor_is_not_markercolor():
+ plt.rcParams['lines.markeredgecolor'] = 'white'
+ ax = plt.axes()
+ ticks = ax.yaxis.get_major_ticks()
+ for tick in ticks:
+ assert tick.tick1line.get_markeredgecolor() != 'white'
+
+
+@pytest.mark.parametrize('axis', ('x', 'y'))
+@pytest.mark.parametrize('auto', (True, False, None))
+def test_unautoscale(axis, auto):
+ fig, ax = plt.subplots()
+ x = np.arange(100)
+ y = np.linspace(-.1, .1, 100)
+ ax.scatter(y, x)
+
+ get_autoscale_on = getattr(ax, f'get_autoscale{axis}_on')
+ set_lim = getattr(ax, f'set_{axis}lim')
+ get_lim = getattr(ax, f'get_{axis}lim')
+
+ post_auto = get_autoscale_on() if auto is None else auto
+
+ set_lim((-0.5, 0.5), auto=auto)
+ assert post_auto == get_autoscale_on()
+ fig.canvas.draw()
+ assert_array_equal(get_lim(), (-0.5, 0.5))
+
+
+@check_figures_equal(extensions=["png"])
+def test_polar_interpolation_steps_variable_r(fig_test, fig_ref):
+ l, = fig_test.add_subplot(projection="polar").plot([0, np.pi/2], [1, 2])
+ l.get_path()._interpolation_steps = 100
+ fig_ref.add_subplot(projection="polar").plot(
+ np.linspace(0, np.pi/2, 101), np.linspace(1, 2, 101))
+
+
+@pytest.mark.style('default')
+def test_autoscale_tiny_sticky():
+ fig, ax = plt.subplots()
+ ax.bar(0, 1e-9)
+ fig.canvas.draw()
+ assert ax.get_ylim() == (0, 1.05e-9)
+
+
+def test_xtickcolor_is_not_xticklabelcolor():
+ plt.rcParams['xtick.color'] = 'yellow'
+ plt.rcParams['xtick.labelcolor'] = 'blue'
+ ax = plt.axes()
+ ticks = ax.xaxis.get_major_ticks()
+ for tick in ticks:
+ assert tick.tick1line.get_color() == 'yellow'
+ assert tick.label1.get_color() == 'blue'
+
+
+def test_ytickcolor_is_not_yticklabelcolor():
+ plt.rcParams['ytick.color'] = 'yellow'
+ plt.rcParams['ytick.labelcolor'] = 'blue'
+ ax = plt.axes()
+ ticks = ax.yaxis.get_major_ticks()
+ for tick in ticks:
+ assert tick.tick1line.get_color() == 'yellow'
+ assert tick.label1.get_color() == 'blue'
+
+
+@pytest.mark.parametrize('size', [size for size in mfont_manager.font_scalings
+ if size is not None] + [8, 10, 12])
+@pytest.mark.style('default')
+def test_relative_ticklabel_sizes(size):
+ mpl.rcParams['xtick.labelsize'] = size
+ mpl.rcParams['ytick.labelsize'] = size
+ fig, ax = plt.subplots()
+ fig.canvas.draw()
+
+ for name, axis in zip(['x', 'y'], [ax.xaxis, ax.yaxis]):
+ for tick in axis.get_major_ticks():
+ assert tick.label1.get_size() == axis._get_tick_label_size(name)
+
+
+def test_multiplot_autoscale():
+ fig = plt.figure()
+ ax1, ax2 = fig.subplots(2, 1, sharex='all')
+ ax1.scatter([1, 2, 3, 4], [2, 3, 2, 3])
+ ax2.axhspan(-5, 5)
+ xlim = ax1.get_xlim()
+ assert np.allclose(xlim, [0.5, 4.5])
+
+
+def test_sharing_does_not_link_positions():
+ fig = plt.figure()
+ ax0 = fig.add_subplot(221)
+ ax1 = fig.add_axes([.6, .6, .3, .3], sharex=ax0)
+ init_pos = ax1.get_position()
+ fig.subplots_adjust(left=0)
+ assert (ax1.get_position().get_points() == init_pos.get_points()).all()
+
+
+@check_figures_equal(extensions=["pdf"])
+def test_2dcolor_plot(fig_test, fig_ref):
+ color = np.array([0.1, 0.2, 0.3])
+ # plot with 1D-color:
+ axs = fig_test.subplots(5)
+ axs[0].plot([1, 2], [1, 2], c=color.reshape(-1))
+ axs[1].scatter([1, 2], [1, 2], c=color.reshape(-1))
+ axs[2].step([1, 2], [1, 2], c=color.reshape(-1))
+ axs[3].hist(np.arange(10), color=color.reshape(-1))
+ axs[4].bar(np.arange(10), np.arange(10), color=color.reshape(-1))
+ # plot with 2D-color:
+ axs = fig_ref.subplots(5)
+ axs[0].plot([1, 2], [1, 2], c=color.reshape((1, -1)))
+ axs[1].scatter([1, 2], [1, 2], c=color.reshape((1, -1)))
+ axs[2].step([1, 2], [1, 2], c=color.reshape((1, -1)))
+ axs[3].hist(np.arange(10), color=color.reshape((1, -1)))
+ axs[4].bar(np.arange(10), np.arange(10), color=color.reshape((1, -1)))
+
+
+def test_shared_axes_retick():
+ fig, axs = plt.subplots(2, 2, sharex='all', sharey='all')
+
+ for ax in axs.flat:
+ ax.plot([0, 2], 'o-')
+
+ axs[0, 0].set_xticks([-0.5, 0, 1, 1.5]) # should affect all axes xlims
+ for ax in axs.flat:
+ assert ax.get_xlim() == axs[0, 0].get_xlim()
+
+ axs[0, 0].set_yticks([-0.5, 0, 2, 2.5]) # should affect all axes ylims
+ for ax in axs.flat:
+ assert ax.get_ylim() == axs[0, 0].get_ylim()
+
+
+@pytest.mark.parametrize('ha', ['left', 'center', 'right'])
+def test_ylabel_ha_with_position(ha):
+ fig = Figure()
+ ax = fig.subplots()
+ ax.set_ylabel("test", y=1, ha=ha)
+ ax.yaxis.set_label_position("right")
+ assert ax.yaxis.get_label().get_ha() == ha
+
+
+def test_bar_label_location_vertical():
+ ax = plt.gca()
+ xs, heights = [1, 2], [3, -4]
+ rects = ax.bar(xs, heights)
+ labels = ax.bar_label(rects)
+ assert labels[0].xy == (xs[0], heights[0])
+ assert labels[0].get_ha() == 'center'
+ assert labels[0].get_va() == 'bottom'
+ assert labels[1].xy == (xs[1], heights[1])
+ assert labels[1].get_ha() == 'center'
+ assert labels[1].get_va() == 'top'
+
+
+def test_bar_label_location_horizontal():
+ ax = plt.gca()
+ ys, widths = [1, 2], [3, -4]
+ rects = ax.barh(ys, widths)
+ labels = ax.bar_label(rects)
+ assert labels[0].xy == (widths[0], ys[0])
+ assert labels[0].get_ha() == 'left'
+ assert labels[0].get_va() == 'center'
+ assert labels[1].xy == (widths[1], ys[1])
+ assert labels[1].get_ha() == 'right'
+ assert labels[1].get_va() == 'center'
+
+
+def test_bar_label_location_center():
+ ax = plt.gca()
+ ys, widths = [1, 2], [3, -4]
+ rects = ax.barh(ys, widths)
+ labels = ax.bar_label(rects, label_type='center')
+ assert labels[0].xy == (widths[0] / 2, ys[0])
+ assert labels[0].get_ha() == 'center'
+ assert labels[0].get_va() == 'center'
+ assert labels[1].xy == (widths[1] / 2, ys[1])
+ assert labels[1].get_ha() == 'center'
+ assert labels[1].get_va() == 'center'
+
+
+def test_bar_label_location_errorbars():
+ ax = plt.gca()
+ xs, heights = [1, 2], [3, -4]
+ rects = ax.bar(xs, heights, yerr=1)
+ labels = ax.bar_label(rects)
+ assert labels[0].xy == (xs[0], heights[0] + 1)
+ assert labels[0].get_ha() == 'center'
+ assert labels[0].get_va() == 'bottom'
+ assert labels[1].xy == (xs[1], heights[1] - 1)
+ assert labels[1].get_ha() == 'center'
+ assert labels[1].get_va() == 'top'
+
+
+def test_bar_label_fmt():
+ ax = plt.gca()
+ rects = ax.bar([1, 2], [3, -4])
+ labels = ax.bar_label(rects, fmt='%.2f')
+ assert labels[0].get_text() == '3.00'
+ assert labels[1].get_text() == '-4.00'
+
+
+def test_bar_label_labels():
+ ax = plt.gca()
+ rects = ax.bar([1, 2], [3, -4])
+ labels = ax.bar_label(rects, labels=['A', 'B'])
+ assert labels[0].get_text() == 'A'
+ assert labels[1].get_text() == 'B'
+
+
+def test_bar_label_nan_ydata():
+ ax = plt.gca()
+ bars = ax.bar([2, 3], [np.nan, 1])
+ labels = ax.bar_label(bars)
+ assert [l.get_text() for l in labels] == ['', '1']
+ assert labels[0].xy == (2, 0)
+ assert labels[0].get_va() == 'bottom'
+
+
+def test_patch_bounds(): # PR 19078
+ fig, ax = plt.subplots()
+ ax.add_patch(mpatches.Wedge((0, -1), 1.05, 60, 120, 0.1))
+ bot = 1.9*np.sin(15*np.pi/180)**2
+ np.testing.assert_array_almost_equal_nulp(
+ np.array((-0.525, -(bot+0.05), 1.05, bot+0.1)), ax.dataLim.bounds, 16)
+
+
+@pytest.mark.style('default')
+def test_warn_ignored_scatter_kwargs():
+ with pytest.warns(UserWarning,
+ match=r"You passed a edgecolor/edgecolors"):
+
+ c = plt.scatter(
+ [0], [0], marker="+", s=500, facecolor="r", edgecolor="b"
+ )
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_backend_bases.py b/venv/Lib/site-packages/matplotlib/tests/test_backend_bases.py
new file mode 100644
index 0000000..610897d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_backend_bases.py
@@ -0,0 +1,237 @@
+import re
+
+from matplotlib.testing import _check_for_pgf
+from matplotlib.backend_bases import (
+ FigureCanvasBase, LocationEvent, MouseButton, MouseEvent,
+ NavigationToolbar2, RendererBase)
+from matplotlib.backend_tools import (ToolZoom, ToolPan, RubberbandBase,
+ ToolViewsPositions, _views_positions)
+from matplotlib.figure import Figure
+import matplotlib.pyplot as plt
+import matplotlib.transforms as transforms
+import matplotlib.path as path
+
+import numpy as np
+import pytest
+
+needs_xelatex = pytest.mark.skipif(not _check_for_pgf('xelatex'),
+ reason='xelatex + pgf is required')
+
+
+def test_uses_per_path():
+ id = transforms.Affine2D()
+ paths = [path.Path.unit_regular_polygon(i) for i in range(3, 7)]
+ tforms_matrices = [id.rotate(i).get_matrix().copy() for i in range(1, 5)]
+ offsets = np.arange(20).reshape((10, 2))
+ facecolors = ['red', 'green']
+ edgecolors = ['red', 'green']
+
+ def check(master_transform, paths, all_transforms,
+ offsets, facecolors, edgecolors):
+ rb = RendererBase()
+ raw_paths = list(rb._iter_collection_raw_paths(
+ master_transform, paths, all_transforms))
+ gc = rb.new_gc()
+ ids = [path_id for xo, yo, path_id, gc0, rgbFace in
+ rb._iter_collection(
+ gc, master_transform, all_transforms,
+ range(len(raw_paths)), offsets,
+ transforms.AffineDeltaTransform(master_transform),
+ facecolors, edgecolors, [], [], [False],
+ [], 'screen')]
+ uses = rb._iter_collection_uses_per_path(
+ paths, all_transforms, offsets, facecolors, edgecolors)
+ if raw_paths:
+ seen = np.bincount(ids, minlength=len(raw_paths))
+ assert set(seen).issubset([uses - 1, uses])
+
+ check(id, paths, tforms_matrices, offsets, facecolors, edgecolors)
+ check(id, paths[0:1], tforms_matrices, offsets, facecolors, edgecolors)
+ check(id, [], tforms_matrices, offsets, facecolors, edgecolors)
+ check(id, paths, tforms_matrices[0:1], offsets, facecolors, edgecolors)
+ check(id, paths, [], offsets, facecolors, edgecolors)
+ for n in range(0, offsets.shape[0]):
+ check(id, paths, tforms_matrices, offsets[0:n, :],
+ facecolors, edgecolors)
+ check(id, paths, tforms_matrices, offsets, [], edgecolors)
+ check(id, paths, tforms_matrices, offsets, facecolors, [])
+ check(id, paths, tforms_matrices, offsets, [], [])
+ check(id, paths, tforms_matrices, offsets, facecolors[0:1], edgecolors)
+
+
+def test_canvas_ctor():
+ assert isinstance(FigureCanvasBase().figure, Figure)
+
+
+def test_get_default_filename():
+ assert plt.figure().canvas.get_default_filename() == 'image.png'
+
+
+def test_canvas_change():
+ fig = plt.figure()
+ # Replaces fig.canvas
+ canvas = FigureCanvasBase(fig)
+ # Should still work.
+ plt.close(fig)
+ assert not plt.fignum_exists(fig.number)
+
+
+@pytest.mark.backend('pdf')
+def test_non_gui_warning(monkeypatch):
+ plt.subplots()
+
+ monkeypatch.setenv("DISPLAY", ":999")
+
+ with pytest.warns(UserWarning) as rec:
+ plt.show()
+ assert len(rec) == 1
+ assert ('Matplotlib is currently using pdf, which is a non-GUI backend'
+ in str(rec[0].message))
+
+ with pytest.warns(UserWarning) as rec:
+ plt.gcf().show()
+ assert len(rec) == 1
+ assert ('Matplotlib is currently using pdf, which is a non-GUI backend'
+ in str(rec[0].message))
+
+
+@pytest.mark.parametrize(
+ "x, y", [(42, 24), (None, 42), (None, None), (200, 100.01), (205.75, 2.0)])
+def test_location_event_position(x, y):
+ # LocationEvent should cast its x and y arguments to int unless it is None.
+ fig, ax = plt.subplots()
+ canvas = FigureCanvasBase(fig)
+ event = LocationEvent("test_event", canvas, x, y)
+ if x is None:
+ assert event.x is None
+ else:
+ assert event.x == int(x)
+ assert isinstance(event.x, int)
+ if y is None:
+ assert event.y is None
+ else:
+ assert event.y == int(y)
+ assert isinstance(event.y, int)
+ if x is not None and y is not None:
+ assert re.match(
+ "x={} +y={}".format(ax.format_xdata(x), ax.format_ydata(y)),
+ ax.format_coord(x, y))
+ ax.fmt_xdata = ax.fmt_ydata = lambda x: "foo"
+ assert re.match("x=foo +y=foo", ax.format_coord(x, y))
+
+
+def test_pick():
+ fig = plt.figure()
+ fig.text(.5, .5, "hello", ha="center", va="center", picker=True)
+ fig.canvas.draw()
+ picks = []
+ fig.canvas.mpl_connect("pick_event", lambda event: picks.append(event))
+ start_event = MouseEvent(
+ "button_press_event", fig.canvas, *fig.transFigure.transform((.5, .5)),
+ MouseButton.LEFT)
+ fig.canvas.callbacks.process(start_event.name, start_event)
+ assert len(picks) == 1
+
+
+def test_interactive_zoom():
+ fig, ax = plt.subplots()
+ ax.set(xscale="logit")
+ assert ax.get_navigate_mode() is None
+
+ tb = NavigationToolbar2(fig.canvas)
+ tb.zoom()
+ assert ax.get_navigate_mode() == 'ZOOM'
+
+ xlim0 = ax.get_xlim()
+ ylim0 = ax.get_ylim()
+
+ # Zoom from x=1e-6, y=0.1 to x=1-1e-5, 0.8 (data coordinates, "d").
+ d0 = (1e-6, 0.1)
+ d1 = (1-1e-5, 0.8)
+ # Convert to screen coordinates ("s"). Events are defined only with pixel
+ # precision, so round the pixel values, and below, check against the
+ # corresponding xdata/ydata, which are close but not equal to d0/d1.
+ s0 = ax.transData.transform(d0).astype(int)
+ s1 = ax.transData.transform(d1).astype(int)
+
+ # Zoom in.
+ start_event = MouseEvent(
+ "button_press_event", fig.canvas, *s0, MouseButton.LEFT)
+ fig.canvas.callbacks.process(start_event.name, start_event)
+ stop_event = MouseEvent(
+ "button_release_event", fig.canvas, *s1, MouseButton.LEFT)
+ fig.canvas.callbacks.process(stop_event.name, stop_event)
+ assert ax.get_xlim() == (start_event.xdata, stop_event.xdata)
+ assert ax.get_ylim() == (start_event.ydata, stop_event.ydata)
+
+ # Zoom out.
+ start_event = MouseEvent(
+ "button_press_event", fig.canvas, *s1, MouseButton.RIGHT)
+ fig.canvas.callbacks.process(start_event.name, start_event)
+ stop_event = MouseEvent(
+ "button_release_event", fig.canvas, *s0, MouseButton.RIGHT)
+ fig.canvas.callbacks.process(stop_event.name, stop_event)
+ # Absolute tolerance much less than original xmin (1e-7).
+ assert ax.get_xlim() == pytest.approx(xlim0, rel=0, abs=1e-10)
+ assert ax.get_ylim() == pytest.approx(ylim0, rel=0, abs=1e-10)
+
+ tb.zoom()
+ assert ax.get_navigate_mode() is None
+
+
+def test_toolbar_zoompan():
+ expected_warning_regex = (
+ r"Treat the new Tool classes introduced in "
+ r"v[0-9]*.[0-9]* as experimental for now; "
+ "the API and rcParam may change in future versions.")
+ with pytest.warns(UserWarning, match=expected_warning_regex):
+ plt.rcParams['toolbar'] = 'toolmanager'
+ ax = plt.gca()
+ assert ax.get_navigate_mode() is None
+ ax.figure.canvas.manager.toolmanager.add_tool(name="zoom",
+ tool=ToolZoom)
+ ax.figure.canvas.manager.toolmanager.add_tool(name="pan",
+ tool=ToolPan)
+ ax.figure.canvas.manager.toolmanager.add_tool(name=_views_positions,
+ tool=ToolViewsPositions)
+ ax.figure.canvas.manager.toolmanager.add_tool(name='rubberband',
+ tool=RubberbandBase)
+ ax.figure.canvas.manager.toolmanager.trigger_tool('zoom')
+ assert ax.get_navigate_mode() == "ZOOM"
+ ax.figure.canvas.manager.toolmanager.trigger_tool('pan')
+ assert ax.get_navigate_mode() == "PAN"
+
+
+@pytest.mark.parametrize(
+ "backend", ['svg', 'ps', 'pdf', pytest.param('pgf', marks=needs_xelatex)]
+)
+def test_draw(backend):
+ from matplotlib.figure import Figure
+ from matplotlib.backends.backend_agg import FigureCanvas
+ test_backend = pytest.importorskip(
+ f'matplotlib.backends.backend_{backend}'
+ )
+ TestCanvas = test_backend.FigureCanvas
+ fig_test = Figure(constrained_layout=True)
+ TestCanvas(fig_test)
+ axes_test = fig_test.subplots(2, 2)
+
+ # defaults to FigureCanvasBase
+ fig_agg = Figure(constrained_layout=True)
+ # put a backends.backend_agg.FigureCanvas on it
+ FigureCanvas(fig_agg)
+ axes_agg = fig_agg.subplots(2, 2)
+
+ init_pos = [ax.get_position() for ax in axes_test.ravel()]
+
+ fig_test.canvas.draw()
+ fig_agg.canvas.draw()
+
+ layed_out_pos_test = [ax.get_position() for ax in axes_test.ravel()]
+ layed_out_pos_agg = [ax.get_position() for ax in axes_agg.ravel()]
+
+ for init, placed in zip(init_pos, layed_out_pos_test):
+ assert not np.allclose(init, placed, atol=0.005)
+
+ for ref, test in zip(layed_out_pos_agg, layed_out_pos_test):
+ np.testing.assert_allclose(ref, test, atol=0.005)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_backend_cairo.py b/venv/Lib/site-packages/matplotlib/tests/test_backend_cairo.py
new file mode 100644
index 0000000..8cc0b31
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_backend_cairo.py
@@ -0,0 +1,48 @@
+import numpy as np
+
+import pytest
+
+from matplotlib.testing.decorators import check_figures_equal
+from matplotlib import (
+ collections as mcollections, patches as mpatches, path as mpath)
+
+
+@pytest.mark.backend('cairo')
+@check_figures_equal(extensions=["png"])
+def test_patch_alpha_coloring(fig_test, fig_ref):
+ """
+ Test checks that the patch and collection are rendered with the specified
+ alpha values in their facecolor and edgecolor.
+ """
+ star = mpath.Path.unit_regular_star(6)
+ circle = mpath.Path.unit_circle()
+ # concatenate the star with an internal cutout of the circle
+ verts = np.concatenate([circle.vertices, star.vertices[::-1]])
+ codes = np.concatenate([circle.codes, star.codes])
+ cut_star1 = mpath.Path(verts, codes)
+ cut_star2 = mpath.Path(verts + 1, codes)
+
+ # Reference: two separate patches
+ ax = fig_ref.subplots()
+ ax.set_xlim([-1, 2])
+ ax.set_ylim([-1, 2])
+ patch = mpatches.PathPatch(cut_star1,
+ linewidth=5, linestyle='dashdot',
+ facecolor=(1, 0, 0, 0.5),
+ edgecolor=(0, 0, 1, 0.75))
+ ax.add_patch(patch)
+ patch = mpatches.PathPatch(cut_star2,
+ linewidth=5, linestyle='dashdot',
+ facecolor=(1, 0, 0, 0.5),
+ edgecolor=(0, 0, 1, 0.75))
+ ax.add_patch(patch)
+
+ # Test: path collection
+ ax = fig_test.subplots()
+ ax.set_xlim([-1, 2])
+ ax.set_ylim([-1, 2])
+ col = mcollections.PathCollection([cut_star1, cut_star2],
+ linewidth=5, linestyles='dashdot',
+ facecolor=(1, 0, 0, 0.5),
+ edgecolor=(0, 0, 1, 0.75))
+ ax.add_collection(col)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_backend_gtk3.py b/venv/Lib/site-packages/matplotlib/tests/test_backend_gtk3.py
new file mode 100644
index 0000000..5442930
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_backend_gtk3.py
@@ -0,0 +1,51 @@
+from matplotlib import pyplot as plt
+
+import pytest
+
+
+pytest.importorskip("matplotlib.backends.backend_gtk3agg")
+
+
+@pytest.mark.backend("gtk3agg")
+def test_correct_key():
+ pytest.xfail("test_widget_send_event is not triggering key_press_event")
+
+ from gi.repository import Gdk, Gtk
+ fig = plt.figure()
+ buf = []
+
+ def send(event):
+ for key, mod in [
+ (Gdk.KEY_a, Gdk.ModifierType.SHIFT_MASK),
+ (Gdk.KEY_a, 0),
+ (Gdk.KEY_a, Gdk.ModifierType.CONTROL_MASK),
+ (Gdk.KEY_agrave, 0),
+ (Gdk.KEY_Control_L, Gdk.ModifierType.MOD1_MASK),
+ (Gdk.KEY_Alt_L, Gdk.ModifierType.CONTROL_MASK),
+ (Gdk.KEY_agrave,
+ Gdk.ModifierType.CONTROL_MASK
+ | Gdk.ModifierType.MOD1_MASK
+ | Gdk.ModifierType.MOD4_MASK),
+ (0xfd16, 0), # KEY_3270_Play.
+ (Gdk.KEY_BackSpace, 0),
+ (Gdk.KEY_BackSpace, Gdk.ModifierType.CONTROL_MASK),
+ ]:
+ # This is not actually really the right API: it depends on the
+ # actual keymap (e.g. on Azerty, shift+agrave -> 0).
+ Gtk.test_widget_send_key(fig.canvas, key, mod)
+
+ def receive(event):
+ buf.append(event.key)
+ if buf == [
+ "A", "a", "ctrl+a",
+ "\N{LATIN SMALL LETTER A WITH GRAVE}",
+ "alt+control", "ctrl+alt",
+ "ctrl+alt+super+\N{LATIN SMALL LETTER A WITH GRAVE}",
+ # (No entry for KEY_3270_Play.)
+ "backspace", "ctrl+backspace",
+ ]:
+ plt.close(fig)
+
+ fig.canvas.mpl_connect("draw_event", send)
+ fig.canvas.mpl_connect("key_press_event", receive)
+ plt.show()
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_backend_nbagg.py b/venv/Lib/site-packages/matplotlib/tests/test_backend_nbagg.py
new file mode 100644
index 0000000..a7060ed
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_backend_nbagg.py
@@ -0,0 +1,28 @@
+import os
+from pathlib import Path
+import subprocess
+from tempfile import TemporaryDirectory
+
+import pytest
+
+nbformat = pytest.importorskip('nbformat')
+
+# From https://blog.thedataincubator.com/2016/06/testing-jupyter-notebooks/
+
+
+def test_ipynb():
+ nb_path = Path(__file__).parent / 'test_nbagg_01.ipynb'
+
+ with TemporaryDirectory() as tmpdir:
+ out_path = Path(tmpdir, "out.ipynb")
+ subprocess.check_call(
+ ["jupyter", "nbconvert", "--to", "notebook",
+ "--execute", "--ExecutePreprocessor.timeout=500",
+ "--output", str(out_path), str(nb_path)],
+ env={**os.environ, "IPYTHONDIR": tmpdir})
+ with out_path.open() as out:
+ nb = nbformat.read(out, nbformat.current_nbformat)
+
+ errors = [output for cell in nb.cells for output in cell.get("outputs", [])
+ if output.output_type == "error"]
+ assert not errors
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_backend_pdf.py b/venv/Lib/site-packages/matplotlib/tests/test_backend_pdf.py
new file mode 100644
index 0000000..06bfe1c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_backend_pdf.py
@@ -0,0 +1,341 @@
+import datetime
+import decimal
+import io
+import os
+from pathlib import Path
+from tempfile import NamedTemporaryFile
+
+import numpy as np
+import pytest
+
+import matplotlib as mpl
+from matplotlib import dviread, pyplot as plt, checkdep_usetex, rcParams
+from matplotlib.backends.backend_pdf import PdfPages
+from matplotlib.testing.decorators import check_figures_equal, image_comparison
+
+
+needs_usetex = pytest.mark.skipif(
+ not checkdep_usetex(True),
+ reason="This test needs a TeX installation")
+
+
+@image_comparison(['pdf_use14corefonts.pdf'])
+def test_use14corefonts():
+ rcParams['pdf.use14corefonts'] = True
+ rcParams['font.family'] = 'sans-serif'
+ rcParams['font.size'] = 8
+ rcParams['font.sans-serif'] = ['Helvetica']
+ rcParams['pdf.compression'] = 0
+
+ text = '''A three-line text positioned just above a blue line
+and containing some French characters and the euro symbol:
+"Merci pépé pour les 10 €"'''
+
+ fig, ax = plt.subplots()
+ ax.set_title('Test PDF backend with option use14corefonts=True')
+ ax.text(0.5, 0.5, text, horizontalalignment='center',
+ verticalalignment='bottom',
+ fontsize=14)
+ ax.axhline(0.5, linewidth=0.5)
+
+
+def test_type42():
+ rcParams['pdf.fonttype'] = 42
+
+ fig, ax = plt.subplots()
+ ax.plot([1, 2, 3])
+ fig.savefig(io.BytesIO())
+
+
+def test_multipage_pagecount():
+ with PdfPages(io.BytesIO()) as pdf:
+ assert pdf.get_pagecount() == 0
+ fig, ax = plt.subplots()
+ ax.plot([1, 2, 3])
+ fig.savefig(pdf, format="pdf")
+ assert pdf.get_pagecount() == 1
+ pdf.savefig()
+ assert pdf.get_pagecount() == 2
+
+
+def test_multipage_properfinalize():
+ pdfio = io.BytesIO()
+ with PdfPages(pdfio) as pdf:
+ for i in range(10):
+ fig, ax = plt.subplots()
+ ax.set_title('This is a long title')
+ fig.savefig(pdf, format="pdf")
+ s = pdfio.getvalue()
+ assert s.count(b'startxref') == 1
+ assert len(s) < 40000
+
+
+def test_multipage_keep_empty():
+ # test empty pdf files
+ # test that an empty pdf is left behind with keep_empty=True (default)
+ with NamedTemporaryFile(delete=False) as tmp:
+ with PdfPages(tmp) as pdf:
+ filename = pdf._file.fh.name
+ assert os.path.exists(filename)
+ os.remove(filename)
+ # test if an empty pdf is deleting itself afterwards with keep_empty=False
+ with PdfPages(filename, keep_empty=False) as pdf:
+ pass
+ assert not os.path.exists(filename)
+ # test pdf files with content, they should never be deleted
+ fig, ax = plt.subplots()
+ ax.plot([1, 2, 3])
+ # test that a non-empty pdf is left behind with keep_empty=True (default)
+ with NamedTemporaryFile(delete=False) as tmp:
+ with PdfPages(tmp) as pdf:
+ filename = pdf._file.fh.name
+ pdf.savefig()
+ assert os.path.exists(filename)
+ os.remove(filename)
+ # test that a non-empty pdf is left behind with keep_empty=False
+ with NamedTemporaryFile(delete=False) as tmp:
+ with PdfPages(tmp, keep_empty=False) as pdf:
+ filename = pdf._file.fh.name
+ pdf.savefig()
+ assert os.path.exists(filename)
+ os.remove(filename)
+
+
+def test_composite_image():
+ # Test that figures can be saved with and without combining multiple images
+ # (on a single set of axes) into a single composite image.
+ X, Y = np.meshgrid(np.arange(-5, 5, 1), np.arange(-5, 5, 1))
+ Z = np.sin(Y ** 2)
+ fig, ax = plt.subplots()
+ ax.set_xlim(0, 3)
+ ax.imshow(Z, extent=[0, 1, 0, 1])
+ ax.imshow(Z[::-1], extent=[2, 3, 0, 1])
+ plt.rcParams['image.composite_image'] = True
+ with PdfPages(io.BytesIO()) as pdf:
+ fig.savefig(pdf, format="pdf")
+ assert len(pdf._file._images) == 1
+ plt.rcParams['image.composite_image'] = False
+ with PdfPages(io.BytesIO()) as pdf:
+ fig.savefig(pdf, format="pdf")
+ assert len(pdf._file._images) == 2
+
+
+def test_savefig_metadata(monkeypatch):
+ pikepdf = pytest.importorskip('pikepdf')
+ monkeypatch.setenv('SOURCE_DATE_EPOCH', '0')
+
+ fig, ax = plt.subplots()
+ ax.plot(range(5))
+
+ md = {
+ 'Author': 'me',
+ 'Title': 'Multipage PDF',
+ 'Subject': 'Test page',
+ 'Keywords': 'test,pdf,multipage',
+ 'ModDate': datetime.datetime(
+ 1968, 8, 1, tzinfo=datetime.timezone(datetime.timedelta(0))),
+ 'Trapped': 'True'
+ }
+ buf = io.BytesIO()
+ fig.savefig(buf, metadata=md, format='pdf')
+
+ with pikepdf.Pdf.open(buf) as pdf:
+ info = {k: str(v) for k, v in pdf.docinfo.items()}
+
+ assert info == {
+ '/Author': 'me',
+ '/CreationDate': 'D:19700101000000Z',
+ '/Creator': f'Matplotlib v{mpl.__version__}, https://matplotlib.org',
+ '/Keywords': 'test,pdf,multipage',
+ '/ModDate': 'D:19680801000000Z',
+ '/Producer': f'Matplotlib pdf backend v{mpl.__version__}',
+ '/Subject': 'Test page',
+ '/Title': 'Multipage PDF',
+ '/Trapped': '/True',
+ }
+
+
+def test_invalid_metadata():
+ fig, ax = plt.subplots()
+
+ with pytest.warns(UserWarning,
+ match="Unknown infodict keyword: 'foobar'."):
+ fig.savefig(io.BytesIO(), format='pdf', metadata={'foobar': 'invalid'})
+
+ with pytest.warns(UserWarning,
+ match='not an instance of datetime.datetime.'):
+ fig.savefig(io.BytesIO(), format='pdf',
+ metadata={'ModDate': '1968-08-01'})
+
+ with pytest.warns(UserWarning,
+ match='not one of {"True", "False", "Unknown"}'):
+ fig.savefig(io.BytesIO(), format='pdf', metadata={'Trapped': 'foo'})
+
+ with pytest.warns(UserWarning, match='not an instance of str.'):
+ fig.savefig(io.BytesIO(), format='pdf', metadata={'Title': 1234})
+
+
+def test_multipage_metadata(monkeypatch):
+ pikepdf = pytest.importorskip('pikepdf')
+ monkeypatch.setenv('SOURCE_DATE_EPOCH', '0')
+
+ fig, ax = plt.subplots()
+ ax.plot(range(5))
+
+ md = {
+ 'Author': 'me',
+ 'Title': 'Multipage PDF',
+ 'Subject': 'Test page',
+ 'Keywords': 'test,pdf,multipage',
+ 'ModDate': datetime.datetime(
+ 1968, 8, 1, tzinfo=datetime.timezone(datetime.timedelta(0))),
+ 'Trapped': 'True'
+ }
+ buf = io.BytesIO()
+ with PdfPages(buf, metadata=md) as pdf:
+ pdf.savefig(fig)
+ pdf.savefig(fig)
+
+ with pikepdf.Pdf.open(buf) as pdf:
+ info = {k: str(v) for k, v in pdf.docinfo.items()}
+
+ assert info == {
+ '/Author': 'me',
+ '/CreationDate': 'D:19700101000000Z',
+ '/Creator': f'Matplotlib v{mpl.__version__}, https://matplotlib.org',
+ '/Keywords': 'test,pdf,multipage',
+ '/ModDate': 'D:19680801000000Z',
+ '/Producer': f'Matplotlib pdf backend v{mpl.__version__}',
+ '/Subject': 'Test page',
+ '/Title': 'Multipage PDF',
+ '/Trapped': '/True',
+ }
+
+
+def test_text_urls():
+ pikepdf = pytest.importorskip('pikepdf')
+
+ test_url = 'https://test_text_urls.matplotlib.org/'
+
+ fig = plt.figure(figsize=(2, 1))
+ fig.text(0.1, 0.1, 'test plain 123', url=f'{test_url}plain')
+ fig.text(0.1, 0.4, 'test mathtext $123$', url=f'{test_url}mathtext')
+
+ with io.BytesIO() as fd:
+ fig.savefig(fd, format='pdf')
+
+ with pikepdf.Pdf.open(fd) as pdf:
+ annots = pdf.pages[0].Annots
+
+ # Iteration over Annots must occur within the context manager,
+ # otherwise it may fail depending on the pdf structure.
+ for y, fragment in [('0.1', 'plain'), ('0.4', 'mathtext')]:
+ annot = next(
+ (a for a in annots if a.A.URI == f'{test_url}{fragment}'),
+ None)
+ assert annot is not None
+ # Positions in points (72 per inch.)
+ assert annot.Rect[1] == decimal.Decimal(y) * 72
+
+
+@needs_usetex
+def test_text_urls_tex():
+ pikepdf = pytest.importorskip('pikepdf')
+
+ test_url = 'https://test_text_urls.matplotlib.org/'
+
+ fig = plt.figure(figsize=(2, 1))
+ fig.text(0.1, 0.7, 'test tex $123$', usetex=True, url=f'{test_url}tex')
+
+ with io.BytesIO() as fd:
+ fig.savefig(fd, format='pdf')
+
+ with pikepdf.Pdf.open(fd) as pdf:
+ annots = pdf.pages[0].Annots
+
+ # Iteration over Annots must occur within the context manager,
+ # otherwise it may fail depending on the pdf structure.
+ annot = next(
+ (a for a in annots if a.A.URI == f'{test_url}tex'),
+ None)
+ assert annot is not None
+ # Positions in points (72 per inch.)
+ assert annot.Rect[1] == decimal.Decimal('0.7') * 72
+
+
+def test_pdfpages_fspath():
+ with PdfPages(Path(os.devnull)) as pdf:
+ pdf.savefig(plt.figure())
+
+
+@image_comparison(['hatching_legend.pdf'])
+def test_hatching_legend():
+ """Test for correct hatching on patches in legend"""
+ fig = plt.figure(figsize=(1, 2))
+
+ a = plt.Rectangle([0, 0], 0, 0, facecolor="green", hatch="XXXX")
+ b = plt.Rectangle([0, 0], 0, 0, facecolor="blue", hatch="XXXX")
+
+ fig.legend([a, b, a, b], ["", "", "", ""])
+
+
+@image_comparison(['grayscale_alpha.pdf'])
+def test_grayscale_alpha():
+ """Masking images with NaN did not work for grayscale images"""
+ x, y = np.ogrid[-2:2:.1, -2:2:.1]
+ dd = np.exp(-(x**2 + y**2))
+ dd[dd < .1] = np.nan
+ fig, ax = plt.subplots()
+ ax.imshow(dd, interpolation='none', cmap='gray_r')
+ ax.set_xticks([])
+ ax.set_yticks([])
+
+
+# This tests tends to hit a TeX cache lock on AppVeyor.
+@pytest.mark.flaky(reruns=3)
+@needs_usetex
+def test_missing_psfont(monkeypatch):
+ """An error is raised if a TeX font lacks a Type-1 equivalent"""
+ def psfont(*args, **kwargs):
+ return dviread.PsFont(texname='texfont', psname='Some Font',
+ effects=None, encoding=None, filename=None)
+
+ monkeypatch.setattr(dviread.PsfontsMap, '__getitem__', psfont)
+ rcParams['text.usetex'] = True
+ fig, ax = plt.subplots()
+ ax.text(0.5, 0.5, 'hello')
+ with NamedTemporaryFile() as tmpfile, pytest.raises(ValueError):
+ fig.savefig(tmpfile, format='pdf')
+
+
+@pytest.mark.style('default')
+@check_figures_equal(extensions=["pdf", "eps"])
+def test_pdf_eps_savefig_when_color_is_none(fig_test, fig_ref):
+ ax_test = fig_test.add_subplot()
+ ax_test.set_axis_off()
+ ax_test.plot(np.sin(np.linspace(-5, 5, 100)), "v", c="none")
+ ax_ref = fig_ref.add_subplot()
+ ax_ref.set_axis_off()
+
+
+@needs_usetex
+def test_failing_latex():
+ """Test failing latex subprocess call"""
+ plt.xlabel("$22_2_2$", usetex=True) # This fails with "Double subscript"
+ with pytest.raises(RuntimeError):
+ plt.savefig(io.BytesIO(), format="pdf")
+
+
+def test_empty_rasterized():
+ # Check that empty figures that are rasterised save to pdf files fine
+ fig, ax = plt.subplots()
+ ax.plot([], [], rasterized=True)
+ fig.savefig(io.BytesIO(), format="pdf")
+
+
+@image_comparison(['kerning.pdf'])
+def test_kerning():
+ fig = plt.figure()
+ s = "AVAVAVAVAVAVAVAV€AAVV"
+ fig.text(0, .25, s, size=5)
+ fig.text(0, .75, s, size=20)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_backend_pgf.py b/venv/Lib/site-packages/matplotlib/tests/test_backend_pgf.py
new file mode 100644
index 0000000..75f50ec
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_backend_pgf.py
@@ -0,0 +1,318 @@
+import datetime
+from io import BytesIO
+import os
+import shutil
+
+import numpy as np
+import pytest
+
+import matplotlib as mpl
+import matplotlib.pyplot as plt
+from matplotlib.testing import _has_tex_package, _check_for_pgf
+from matplotlib.testing.compare import compare_images, ImageComparisonFailure
+from matplotlib.backends.backend_pgf import PdfPages, common_texification
+from matplotlib.testing.decorators import (_image_directories,
+ check_figures_equal,
+ image_comparison)
+
+baseline_dir, result_dir = _image_directories(lambda: 'dummy func')
+
+needs_xelatex = pytest.mark.skipif(not _check_for_pgf('xelatex'),
+ reason='xelatex + pgf is required')
+needs_pdflatex = pytest.mark.skipif(not _check_for_pgf('pdflatex'),
+ reason='pdflatex + pgf is required')
+needs_lualatex = pytest.mark.skipif(not _check_for_pgf('lualatex'),
+ reason='lualatex + pgf is required')
+needs_ghostscript = pytest.mark.skipif(
+ "eps" not in mpl.testing.compare.converter,
+ reason="This test needs a ghostscript installation")
+
+
+def compare_figure(fname, savefig_kwargs={}, tol=0):
+ actual = os.path.join(result_dir, fname)
+ plt.savefig(actual, **savefig_kwargs)
+
+ expected = os.path.join(result_dir, "expected_%s" % fname)
+ shutil.copyfile(os.path.join(baseline_dir, fname), expected)
+ err = compare_images(expected, actual, tol=tol)
+ if err:
+ raise ImageComparisonFailure(err)
+
+
+def create_figure():
+ plt.figure()
+ x = np.linspace(0, 1, 15)
+
+ # line plot
+ plt.plot(x, x ** 2, "b-")
+
+ # marker
+ plt.plot(x, 1 - x**2, "g>")
+
+ # filled paths and patterns
+ plt.fill_between([0., .4], [.4, 0.], hatch='//', facecolor="lightgray",
+ edgecolor="red")
+ plt.fill([3, 3, .8, .8, 3], [2, -2, -2, 0, 2], "b")
+
+ # text and typesetting
+ plt.plot([0.9], [0.5], "ro", markersize=3)
+ plt.text(0.9, 0.5, 'unicode (ü, °, µ) and math ($\\mu_i = x_i^2$)',
+ ha='right', fontsize=20)
+ plt.ylabel('sans-serif, blue, $\\frac{\\sqrt{x}}{y^2}$..',
+ family='sans-serif', color='blue')
+
+ plt.xlim(0, 1)
+ plt.ylim(0, 1)
+
+
+@pytest.mark.parametrize('plain_text, escaped_text', [
+ (r'quad_sum: $\sum x_i^2$', r'quad\_sum: \(\displaystyle \sum x_i^2\)'),
+ (r'no \$splits \$ here', r'no \$splits \$ here'),
+ ('with_underscores', r'with\_underscores'),
+ ('% not a comment', r'\% not a comment'),
+ ('^not', r'\^not'),
+])
+def test_common_texification(plain_text, escaped_text):
+ assert common_texification(plain_text) == escaped_text
+
+
+# test compiling a figure to pdf with xelatex
+@needs_xelatex
+@pytest.mark.backend('pgf')
+@image_comparison(['pgf_xelatex.pdf'], style='default')
+def test_xelatex():
+ rc_xelatex = {'font.family': 'serif',
+ 'pgf.rcfonts': False}
+ mpl.rcParams.update(rc_xelatex)
+ create_figure()
+
+
+# test compiling a figure to pdf with pdflatex
+@needs_pdflatex
+@pytest.mark.skipif(not _has_tex_package('ucs'), reason='needs ucs.sty')
+@pytest.mark.backend('pgf')
+@image_comparison(['pgf_pdflatex.pdf'], style='default')
+def test_pdflatex():
+ if os.environ.get('APPVEYOR'):
+ pytest.xfail("pdflatex test does not work on appveyor due to missing "
+ "LaTeX fonts")
+
+ rc_pdflatex = {'font.family': 'serif',
+ 'pgf.rcfonts': False,
+ 'pgf.texsystem': 'pdflatex',
+ 'pgf.preamble': ('\\usepackage[utf8x]{inputenc}'
+ '\\usepackage[T1]{fontenc}')}
+ mpl.rcParams.update(rc_pdflatex)
+ create_figure()
+
+
+# test updating the rc parameters for each figure
+@needs_xelatex
+@needs_pdflatex
+@pytest.mark.style('default')
+@pytest.mark.backend('pgf')
+def test_rcupdate():
+ rc_sets = [{'font.family': 'sans-serif',
+ 'font.size': 30,
+ 'figure.subplot.left': .2,
+ 'lines.markersize': 10,
+ 'pgf.rcfonts': False,
+ 'pgf.texsystem': 'xelatex'},
+ {'font.family': 'monospace',
+ 'font.size': 10,
+ 'figure.subplot.left': .1,
+ 'lines.markersize': 20,
+ 'pgf.rcfonts': False,
+ 'pgf.texsystem': 'pdflatex',
+ 'pgf.preamble': ('\\usepackage[utf8x]{inputenc}'
+ '\\usepackage[T1]{fontenc}'
+ '\\usepackage{sfmath}')}]
+ tol = [6, 0]
+ for i, rc_set in enumerate(rc_sets):
+ with mpl.rc_context(rc_set):
+ for substring, pkg in [('sfmath', 'sfmath'), ('utf8x', 'ucs')]:
+ if (substring in mpl.rcParams['pgf.preamble']
+ and not _has_tex_package(pkg)):
+ pytest.skip(f'needs {pkg}.sty')
+ create_figure()
+ compare_figure('pgf_rcupdate%d.pdf' % (i + 1), tol=tol[i])
+
+
+# test backend-side clipping, since large numbers are not supported by TeX
+@needs_xelatex
+@pytest.mark.style('default')
+@pytest.mark.backend('pgf')
+def test_pathclip():
+ mpl.rcParams.update({'font.family': 'serif', 'pgf.rcfonts': False})
+ plt.plot([0., 1e100], [0., 1e100])
+ plt.xlim(0, 1)
+ plt.ylim(0, 1)
+ plt.savefig(BytesIO(), format="pdf") # No image comparison.
+
+
+# test mixed mode rendering
+@needs_xelatex
+@pytest.mark.backend('pgf')
+@image_comparison(['pgf_mixedmode.pdf'], style='default')
+def test_mixedmode():
+ mpl.rcParams.update({'font.family': 'serif', 'pgf.rcfonts': False})
+ Y, X = np.ogrid[-1:1:40j, -1:1:40j]
+ plt.pcolor(X**2 + Y**2).set_rasterized(True)
+
+
+# test bbox_inches clipping
+@needs_xelatex
+@pytest.mark.style('default')
+@pytest.mark.backend('pgf')
+def test_bbox_inches():
+ mpl.rcParams.update({'font.family': 'serif', 'pgf.rcfonts': False})
+ fig, (ax1, ax2) = plt.subplots(1, 2)
+ ax1.plot(range(5))
+ ax2.plot(range(5))
+ plt.tight_layout()
+ bbox = ax1.get_window_extent().transformed(fig.dpi_scale_trans.inverted())
+ compare_figure('pgf_bbox_inches.pdf', savefig_kwargs={'bbox_inches': bbox},
+ tol=0)
+
+
+@pytest.mark.style('default')
+@pytest.mark.backend('pgf')
+@pytest.mark.parametrize('system', [
+ pytest.param('lualatex', marks=[needs_lualatex]),
+ pytest.param('pdflatex', marks=[needs_pdflatex]),
+ pytest.param('xelatex', marks=[needs_xelatex]),
+])
+def test_pdf_pages(system):
+ rc_pdflatex = {
+ 'font.family': 'serif',
+ 'pgf.rcfonts': False,
+ 'pgf.texsystem': system,
+ }
+ mpl.rcParams.update(rc_pdflatex)
+
+ fig1, ax1 = plt.subplots()
+ ax1.plot(range(5))
+ fig1.tight_layout()
+
+ fig2, ax2 = plt.subplots(figsize=(3, 2))
+ ax2.plot(range(5))
+ fig2.tight_layout()
+
+ path = os.path.join(result_dir, f'pdfpages_{system}.pdf')
+ md = {
+ 'Author': 'me',
+ 'Title': 'Multipage PDF with pgf',
+ 'Subject': 'Test page',
+ 'Keywords': 'test,pdf,multipage',
+ 'ModDate': datetime.datetime(
+ 1968, 8, 1, tzinfo=datetime.timezone(datetime.timedelta(0))),
+ 'Trapped': 'Unknown'
+ }
+
+ with PdfPages(path, metadata=md) as pdf:
+ pdf.savefig(fig1)
+ pdf.savefig(fig2)
+ pdf.savefig(fig1)
+
+ assert pdf.get_pagecount() == 3
+
+
+@pytest.mark.style('default')
+@pytest.mark.backend('pgf')
+@pytest.mark.parametrize('system', [
+ pytest.param('lualatex', marks=[needs_lualatex]),
+ pytest.param('pdflatex', marks=[needs_pdflatex]),
+ pytest.param('xelatex', marks=[needs_xelatex]),
+])
+def test_pdf_pages_metadata_check(monkeypatch, system):
+ # Basically the same as test_pdf_pages, but we keep it separate to leave
+ # pikepdf as an optional dependency.
+ pikepdf = pytest.importorskip('pikepdf')
+ monkeypatch.setenv('SOURCE_DATE_EPOCH', '0')
+
+ mpl.rcParams.update({'pgf.texsystem': system})
+
+ fig, ax = plt.subplots()
+ ax.plot(range(5))
+
+ md = {
+ 'Author': 'me',
+ 'Title': 'Multipage PDF with pgf',
+ 'Subject': 'Test page',
+ 'Keywords': 'test,pdf,multipage',
+ 'ModDate': datetime.datetime(
+ 1968, 8, 1, tzinfo=datetime.timezone(datetime.timedelta(0))),
+ 'Trapped': 'True'
+ }
+ path = os.path.join(result_dir, f'pdfpages_meta_check_{system}.pdf')
+ with PdfPages(path, metadata=md) as pdf:
+ pdf.savefig(fig)
+
+ with pikepdf.Pdf.open(path) as pdf:
+ info = {k: str(v) for k, v in pdf.docinfo.items()}
+
+ # Not set by us, so don't bother checking.
+ if '/PTEX.FullBanner' in info:
+ del info['/PTEX.FullBanner']
+ if '/PTEX.Fullbanner' in info:
+ del info['/PTEX.Fullbanner']
+
+ assert info == {
+ '/Author': 'me',
+ '/CreationDate': 'D:19700101000000Z',
+ '/Creator': f'Matplotlib v{mpl.__version__}, https://matplotlib.org',
+ '/Keywords': 'test,pdf,multipage',
+ '/ModDate': 'D:19680801000000Z',
+ '/Producer': f'Matplotlib pgf backend v{mpl.__version__}',
+ '/Subject': 'Test page',
+ '/Title': 'Multipage PDF with pgf',
+ '/Trapped': '/True',
+ }
+
+
+@needs_xelatex
+def test_tex_restart_after_error():
+ fig = plt.figure()
+ fig.suptitle(r"\oops")
+ with pytest.raises(ValueError):
+ fig.savefig(BytesIO(), format="pgf")
+
+ fig = plt.figure() # start from scratch
+ fig.suptitle(r"this is ok")
+ fig.savefig(BytesIO(), format="pgf")
+
+
+@needs_xelatex
+def test_bbox_inches_tight():
+ fig, ax = plt.subplots()
+ ax.imshow([[0, 1], [2, 3]])
+ fig.savefig(BytesIO(), format="pdf", backend="pgf", bbox_inches="tight")
+
+
+@needs_xelatex
+@needs_ghostscript
+def test_png():
+ # Just a smoketest.
+ fig, ax = plt.subplots()
+ fig.savefig(BytesIO(), format="png", backend="pgf")
+
+
+@needs_xelatex
+def test_unknown_font(caplog):
+ with caplog.at_level("WARNING"):
+ mpl.rcParams["font.family"] = "this-font-does-not-exist"
+ plt.figtext(.5, .5, "hello, world")
+ plt.savefig(BytesIO(), format="pgf")
+ assert "Ignoring unknown font: this-font-does-not-exist" in [
+ r.getMessage() for r in caplog.records]
+
+
+@check_figures_equal(extensions=["pdf"])
+@pytest.mark.parametrize("texsystem", ("pdflatex", "xelatex", "lualatex"))
+@pytest.mark.backend("pgf")
+def test_minus_signs_with_tex(fig_test, fig_ref, texsystem):
+ if not _check_for_pgf(texsystem):
+ pytest.skip(texsystem + ' + pgf is required')
+ mpl.rcParams["pgf.texsystem"] = texsystem
+ fig_test.text(.5, .5, "$-1$")
+ fig_ref.text(.5, .5, "$\N{MINUS SIGN}1$")
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_backend_ps.py b/venv/Lib/site-packages/matplotlib/tests/test_backend_ps.py
new file mode 100644
index 0000000..8fdc88e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_backend_ps.py
@@ -0,0 +1,186 @@
+import io
+from pathlib import Path
+import re
+import tempfile
+
+import pytest
+
+import matplotlib as mpl
+import matplotlib.pyplot as plt
+from matplotlib import cbook, patheffects
+from matplotlib.testing.decorators import check_figures_equal, image_comparison
+from matplotlib.cbook import MatplotlibDeprecationWarning
+
+
+needs_ghostscript = pytest.mark.skipif(
+ "eps" not in mpl.testing.compare.converter,
+ reason="This test needs a ghostscript installation")
+needs_usetex = pytest.mark.skipif(
+ not mpl.checkdep_usetex(True),
+ reason="This test needs a TeX installation")
+
+
+# This tests tends to hit a TeX cache lock on AppVeyor.
+@pytest.mark.flaky(reruns=3)
+@pytest.mark.parametrize('orientation', ['portrait', 'landscape'])
+@pytest.mark.parametrize('format, use_log, rcParams', [
+ ('ps', False, {}),
+ ('ps', False, {'ps.usedistiller': 'ghostscript'}),
+ ('ps', False, {'ps.usedistiller': 'xpdf'}),
+ ('ps', False, {'text.usetex': True}),
+ ('eps', False, {}),
+ ('eps', True, {'ps.useafm': True}),
+ ('eps', False, {'text.usetex': True}),
+], ids=[
+ 'ps',
+ 'ps with distiller=ghostscript',
+ 'ps with distiller=xpdf',
+ 'ps with usetex',
+ 'eps',
+ 'eps afm',
+ 'eps with usetex'
+])
+def test_savefig_to_stringio(format, use_log, rcParams, orientation):
+ mpl.rcParams.update(rcParams)
+
+ fig, ax = plt.subplots()
+
+ with io.StringIO() as s_buf, io.BytesIO() as b_buf:
+
+ if use_log:
+ ax.set_yscale('log')
+
+ ax.plot([1, 2], [1, 2])
+ title = "Déjà vu"
+ if not mpl.rcParams["text.usetex"]:
+ title += " \N{MINUS SIGN}\N{EURO SIGN}"
+ ax.set_title(title)
+ allowable_exceptions = []
+ if rcParams.get("ps.usedistiller"):
+ allowable_exceptions.append(mpl.ExecutableNotFoundError)
+ if rcParams.get("text.usetex"):
+ allowable_exceptions.append(RuntimeError)
+ if rcParams.get("ps.useafm"):
+ allowable_exceptions.append(MatplotlibDeprecationWarning)
+ try:
+ fig.savefig(s_buf, format=format, orientation=orientation)
+ fig.savefig(b_buf, format=format, orientation=orientation)
+ except tuple(allowable_exceptions) as exc:
+ pytest.skip(str(exc))
+
+ s_val = s_buf.getvalue().encode('ascii')
+ b_val = b_buf.getvalue()
+
+ # Strip out CreationDate: ghostscript and cairo don't obey
+ # SOURCE_DATE_EPOCH, and that environment variable is already tested in
+ # test_determinism.
+ s_val = re.sub(b"(?<=\n%%CreationDate: ).*", b"", s_val)
+ b_val = re.sub(b"(?<=\n%%CreationDate: ).*", b"", b_val)
+
+ assert s_val == b_val.replace(b'\r\n', b'\n')
+
+
+def test_patheffects():
+ mpl.rcParams['path.effects'] = [
+ patheffects.withStroke(linewidth=4, foreground='w')]
+ fig, ax = plt.subplots()
+ ax.plot([1, 2, 3])
+ with io.BytesIO() as ps:
+ fig.savefig(ps, format='ps')
+
+
+@needs_usetex
+@needs_ghostscript
+def test_tilde_in_tempfilename(tmpdir):
+ # Tilde ~ in the tempdir path (e.g. TMPDIR, TMP or TEMP on windows
+ # when the username is very long and windows uses a short name) breaks
+ # latex before https://github.com/matplotlib/matplotlib/pull/5928
+ base_tempdir = Path(tmpdir, "short-1")
+ base_tempdir.mkdir()
+ # Change the path for new tempdirs, which is used internally by the ps
+ # backend to write a file.
+ with cbook._setattr_cm(tempfile, tempdir=str(base_tempdir)):
+ # usetex results in the latex call, which does not like the ~
+ mpl.rcParams['text.usetex'] = True
+ plt.plot([1, 2, 3, 4])
+ plt.xlabel(r'\textbf{time} (s)')
+ # use the PS backend to write the file...
+ plt.savefig(base_tempdir / 'tex_demo.eps', format="ps")
+
+
+@image_comparison(["empty.eps"])
+def test_transparency():
+ fig, ax = plt.subplots()
+ ax.set_axis_off()
+ ax.plot([0, 1], color="r", alpha=0)
+ ax.text(.5, .5, "foo", color="r", alpha=0)
+
+
+def test_bbox():
+ fig, ax = plt.subplots()
+ with io.BytesIO() as buf:
+ fig.savefig(buf, format='eps')
+ buf = buf.getvalue()
+
+ bb = re.search(b'^%%BoundingBox: (.+) (.+) (.+) (.+)$', buf, re.MULTILINE)
+ assert bb
+ hibb = re.search(b'^%%HiResBoundingBox: (.+) (.+) (.+) (.+)$', buf,
+ re.MULTILINE)
+ assert hibb
+
+ for i in range(1, 5):
+ # BoundingBox must use integers, and be ceil/floor of the hi res.
+ assert b'.' not in bb.group(i)
+ assert int(bb.group(i)) == pytest.approx(float(hibb.group(i)), 1)
+
+
+@needs_usetex
+def test_failing_latex():
+ """Test failing latex subprocess call"""
+ mpl.rcParams['text.usetex'] = True
+ # This fails with "Double subscript"
+ plt.xlabel("$22_2_2$")
+ with pytest.raises(RuntimeError):
+ plt.savefig(io.BytesIO(), format="ps")
+
+
+@needs_usetex
+def test_partial_usetex(caplog):
+ caplog.set_level("WARNING")
+ plt.figtext(.5, .5, "foo", usetex=True)
+ plt.savefig(io.BytesIO(), format="ps")
+ assert caplog.records and all("as if usetex=False" in record.getMessage()
+ for record in caplog.records)
+
+
+@image_comparison(["useafm.eps"])
+def test_useafm():
+ mpl.rcParams["ps.useafm"] = True
+ fig, ax = plt.subplots()
+ ax.set_axis_off()
+ ax.axhline(.5)
+ ax.text(.5, .5, "qk")
+
+
+@image_comparison(["type3.eps"])
+def test_type3_font():
+ plt.figtext(.5, .5, "I/J")
+
+
+@check_figures_equal(extensions=["eps"])
+def test_text_clip(fig_test, fig_ref):
+ ax = fig_test.add_subplot()
+ # Fully clipped-out text should not appear.
+ ax.text(0, 0, "hello", transform=fig_test.transFigure, clip_on=True)
+ fig_ref.add_subplot()
+
+
+@needs_ghostscript
+def test_d_glyph(tmp_path):
+ # Ensure that we don't have a procedure defined as /d, which would be
+ # overwritten by the glyph definition for "d".
+ fig = plt.figure()
+ fig.text(.5, .5, "def")
+ out = tmp_path / "test.eps"
+ fig.savefig(out)
+ mpl.testing.compare.convert(out, cache=False) # Should not raise.
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_backend_qt.py b/venv/Lib/site-packages/matplotlib/tests/test_backend_qt.py
new file mode 100644
index 0000000..d0d997e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_backend_qt.py
@@ -0,0 +1,297 @@
+import copy
+import signal
+from unittest import mock
+
+import matplotlib
+from matplotlib import pyplot as plt
+from matplotlib._pylab_helpers import Gcf
+
+import pytest
+
+
+try:
+ from matplotlib.backends.qt_compat import QtGui
+except ImportError:
+ pytestmark = pytest.mark.skip('No usable Qt5 bindings')
+
+
+@pytest.fixture
+def qt_core(request):
+ backend, = request.node.get_closest_marker('backend').args
+ qt_compat = pytest.importorskip('matplotlib.backends.qt_compat')
+ QtCore = qt_compat.QtCore
+
+ if backend == 'Qt4Agg':
+ try:
+ py_qt_ver = int(QtCore.PYQT_VERSION_STR.split('.')[0])
+ except AttributeError:
+ py_qt_ver = QtCore.__version_info__[0]
+ if py_qt_ver != 4:
+ pytest.skip('Qt4 is not available')
+
+ return QtCore
+
+
+@pytest.mark.parametrize('backend', [
+ # Note: the value is irrelevant; the important part is the marker.
+ pytest.param(
+ 'Qt4Agg',
+ marks=pytest.mark.backend('Qt4Agg', skip_on_importerror=True)),
+ pytest.param(
+ 'Qt5Agg',
+ marks=pytest.mark.backend('Qt5Agg', skip_on_importerror=True)),
+])
+def test_fig_close(backend):
+ # save the state of Gcf.figs
+ init_figs = copy.copy(Gcf.figs)
+
+ # make a figure using pyplot interface
+ fig = plt.figure()
+
+ # simulate user clicking the close button by reaching in
+ # and calling close on the underlying Qt object
+ fig.canvas.manager.window.close()
+
+ # assert that we have removed the reference to the FigureManager
+ # that got added by plt.figure()
+ assert init_figs == Gcf.figs
+
+
+@pytest.mark.backend('Qt5Agg', skip_on_importerror=True)
+def test_fig_signals(qt_core):
+ # Create a figure
+ plt.figure()
+
+ # Access signals
+ event_loop_signal = None
+
+ # Callback to fire during event loop: save SIGINT handler, then exit
+ def fire_signal_and_quit():
+ # Save event loop signal
+ nonlocal event_loop_signal
+ event_loop_signal = signal.getsignal(signal.SIGINT)
+
+ # Request event loop exit
+ qt_core.QCoreApplication.exit()
+
+ # Timer to exit event loop
+ qt_core.QTimer.singleShot(0, fire_signal_and_quit)
+
+ # Save original SIGINT handler
+ original_signal = signal.getsignal(signal.SIGINT)
+
+ # Use our own SIGINT handler to be 100% sure this is working
+ def CustomHandler(signum, frame):
+ pass
+
+ signal.signal(signal.SIGINT, CustomHandler)
+
+ # mainloop() sets SIGINT, starts Qt event loop (which triggers timer and
+ # exits) and then mainloop() resets SIGINT
+ matplotlib.backends.backend_qt5._BackendQT5.mainloop()
+
+ # Assert: signal handler during loop execution is signal.SIG_DFL
+ assert event_loop_signal == signal.SIG_DFL
+
+ # Assert: current signal handler is the same as the one we set before
+ assert CustomHandler == signal.getsignal(signal.SIGINT)
+
+ # Reset SIGINT handler to what it was before the test
+ signal.signal(signal.SIGINT, original_signal)
+
+
+@pytest.mark.parametrize(
+ 'qt_key, qt_mods, answer',
+ [
+ ('Key_A', ['ShiftModifier'], 'A'),
+ ('Key_A', [], 'a'),
+ ('Key_A', ['ControlModifier'], 'ctrl+a'),
+ ('Key_Aacute', ['ShiftModifier'],
+ '\N{LATIN CAPITAL LETTER A WITH ACUTE}'),
+ ('Key_Aacute', [],
+ '\N{LATIN SMALL LETTER A WITH ACUTE}'),
+ ('Key_Control', ['AltModifier'], 'alt+control'),
+ ('Key_Alt', ['ControlModifier'], 'ctrl+alt'),
+ ('Key_Aacute', ['ControlModifier', 'AltModifier', 'MetaModifier'],
+ 'ctrl+alt+super+\N{LATIN SMALL LETTER A WITH ACUTE}'),
+ ('Key_Play', [], None),
+ ('Key_Backspace', [], 'backspace'),
+ ('Key_Backspace', ['ControlModifier'], 'ctrl+backspace'),
+ ],
+ ids=[
+ 'shift',
+ 'lower',
+ 'control',
+ 'unicode_upper',
+ 'unicode_lower',
+ 'alt_control',
+ 'control_alt',
+ 'modifier_order',
+ 'non_unicode_key',
+ 'backspace',
+ 'backspace_mod',
+ ]
+)
+@pytest.mark.parametrize('backend', [
+ # Note: the value is irrelevant; the important part is the marker.
+ pytest.param(
+ 'Qt4Agg',
+ marks=pytest.mark.backend('Qt4Agg', skip_on_importerror=True)),
+ pytest.param(
+ 'Qt5Agg',
+ marks=pytest.mark.backend('Qt5Agg', skip_on_importerror=True)),
+])
+def test_correct_key(backend, qt_core, qt_key, qt_mods, answer):
+ """
+ Make a figure.
+ Send a key_press_event event (using non-public, qtX backend specific api).
+ Catch the event.
+ Assert sent and caught keys are the same.
+ """
+ qt_mod = qt_core.Qt.NoModifier
+ for mod in qt_mods:
+ qt_mod |= getattr(qt_core.Qt, mod)
+
+ class _Event:
+ def isAutoRepeat(self): return False
+ def key(self): return getattr(qt_core.Qt, qt_key)
+ def modifiers(self): return qt_mod
+
+ def on_key_press(event):
+ assert event.key == answer
+
+ qt_canvas = plt.figure().canvas
+ qt_canvas.mpl_connect('key_press_event', on_key_press)
+ qt_canvas.keyPressEvent(_Event())
+
+
+@pytest.mark.backend('Qt5Agg', skip_on_importerror=True)
+def test_pixel_ratio_change():
+ """
+ Make sure that if the pixel ratio changes, the figure dpi changes but the
+ widget remains the same physical size.
+ """
+
+ prop = 'matplotlib.backends.backend_qt5.FigureCanvasQT.devicePixelRatioF'
+ with mock.patch(prop) as p:
+ p.return_value = 3
+
+ fig = plt.figure(figsize=(5, 2), dpi=120)
+ qt_canvas = fig.canvas
+ qt_canvas.show()
+
+ def set_pixel_ratio(ratio):
+ p.return_value = ratio
+ # Make sure the mocking worked
+ assert qt_canvas._dpi_ratio == ratio
+
+ # The value here doesn't matter, as we can't mock the C++ QScreen
+ # object, but can override the functional wrapper around it.
+ # Emitting this event is simply to trigger the DPI change handler
+ # in Matplotlib in the same manner that it would occur normally.
+ screen.logicalDotsPerInchChanged.emit(96)
+
+ qt_canvas.draw()
+ qt_canvas.flush_events()
+
+ qt_canvas.manager.show()
+ size = qt_canvas.size()
+ screen = qt_canvas.window().windowHandle().screen()
+ set_pixel_ratio(3)
+
+ # The DPI and the renderer width/height change
+ assert fig.dpi == 360
+ assert qt_canvas.renderer.width == 1800
+ assert qt_canvas.renderer.height == 720
+
+ # The actual widget size and figure physical size don't change
+ assert size.width() == 600
+ assert size.height() == 240
+ assert qt_canvas.get_width_height() == (600, 240)
+ assert (fig.get_size_inches() == (5, 2)).all()
+
+ set_pixel_ratio(2)
+
+ # The DPI and the renderer width/height change
+ assert fig.dpi == 240
+ assert qt_canvas.renderer.width == 1200
+ assert qt_canvas.renderer.height == 480
+
+ # The actual widget size and figure physical size don't change
+ assert size.width() == 600
+ assert size.height() == 240
+ assert qt_canvas.get_width_height() == (600, 240)
+ assert (fig.get_size_inches() == (5, 2)).all()
+
+ set_pixel_ratio(1.5)
+
+ # The DPI and the renderer width/height change
+ assert fig.dpi == 180
+ assert qt_canvas.renderer.width == 900
+ assert qt_canvas.renderer.height == 360
+
+ # The actual widget size and figure physical size don't change
+ assert size.width() == 600
+ assert size.height() == 240
+ assert qt_canvas.get_width_height() == (600, 240)
+ assert (fig.get_size_inches() == (5, 2)).all()
+
+
+@pytest.mark.backend('Qt5Agg', skip_on_importerror=True)
+def test_subplottool():
+ fig, ax = plt.subplots()
+ with mock.patch(
+ "matplotlib.backends.backend_qt5.SubplotToolQt.exec_",
+ lambda self: None):
+ fig.canvas.manager.toolbar.configure_subplots()
+
+
+@pytest.mark.backend('Qt5Agg', skip_on_importerror=True)
+def test_figureoptions():
+ fig, ax = plt.subplots()
+ ax.plot([1, 2])
+ ax.imshow([[1]])
+ ax.scatter(range(3), range(3), c=range(3))
+ with mock.patch(
+ "matplotlib.backends.qt_editor._formlayout.FormDialog.exec_",
+ lambda self: None):
+ fig.canvas.manager.toolbar.edit_parameters()
+
+
+@pytest.mark.backend('Qt5Agg', skip_on_importerror=True)
+def test_double_resize():
+ # Check that resizing a figure twice keeps the same window size
+ fig, ax = plt.subplots()
+ fig.canvas.draw()
+ window = fig.canvas.manager.window
+
+ w, h = 3, 2
+ fig.set_size_inches(w, h)
+ assert fig.canvas.width() == w * matplotlib.rcParams['figure.dpi']
+ assert fig.canvas.height() == h * matplotlib.rcParams['figure.dpi']
+
+ old_width = window.width()
+ old_height = window.height()
+
+ fig.set_size_inches(w, h)
+ assert window.width() == old_width
+ assert window.height() == old_height
+
+
+@pytest.mark.backend('Qt5Agg', skip_on_importerror=True)
+def test_canvas_reinit():
+ from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
+
+ called = False
+
+ def crashing_callback(fig, stale):
+ nonlocal called
+ fig.canvas.draw_idle()
+ called = True
+
+ fig, ax = plt.subplots()
+ fig.stale_callback = crashing_callback
+ # this should not raise
+ canvas = FigureCanvasQTAgg(fig)
+ fig.stale = True
+ assert called
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_backend_svg.py b/venv/Lib/site-packages/matplotlib/tests/test_backend_svg.py
new file mode 100644
index 0000000..66ec48a
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_backend_svg.py
@@ -0,0 +1,490 @@
+import datetime
+from io import BytesIO
+import tempfile
+import xml.etree.ElementTree
+import xml.parsers.expat
+
+import numpy as np
+import pytest
+
+import matplotlib as mpl
+from matplotlib import dviread
+from matplotlib.figure import Figure
+import matplotlib.pyplot as plt
+from matplotlib.testing.decorators import image_comparison, check_figures_equal
+
+
+needs_usetex = pytest.mark.skipif(
+ not mpl.checkdep_usetex(True),
+ reason="This test needs a TeX installation")
+
+
+def test_visibility():
+ fig, ax = plt.subplots()
+
+ x = np.linspace(0, 4 * np.pi, 50)
+ y = np.sin(x)
+ yerr = np.ones_like(y)
+
+ a, b, c = ax.errorbar(x, y, yerr=yerr, fmt='ko')
+ for artist in b:
+ artist.set_visible(False)
+
+ with BytesIO() as fd:
+ fig.savefig(fd, format='svg')
+ buf = fd.getvalue()
+
+ parser = xml.parsers.expat.ParserCreate()
+ parser.Parse(buf) # this will raise ExpatError if the svg is invalid
+
+
+@image_comparison(['fill_black_with_alpha.svg'], remove_text=True)
+def test_fill_black_with_alpha():
+ fig, ax = plt.subplots()
+ ax.scatter(x=[0, 0.1, 1], y=[0, 0, 0], c='k', alpha=0.1, s=10000)
+
+
+@image_comparison(['noscale'], remove_text=True)
+def test_noscale():
+ X, Y = np.meshgrid(np.arange(-5, 5, 1), np.arange(-5, 5, 1))
+ Z = np.sin(Y ** 2)
+
+ fig, ax = plt.subplots()
+ ax.imshow(Z, cmap='gray', interpolation='none')
+
+
+def test_text_urls():
+ fig = plt.figure()
+
+ test_url = "http://test_text_urls.matplotlib.org"
+ fig.suptitle("test_text_urls", url=test_url)
+
+ with BytesIO() as fd:
+ fig.savefig(fd, format='svg')
+ buf = fd.getvalue().decode()
+
+ expected = ''.format(test_url)
+ assert expected in buf
+
+
+@image_comparison(['bold_font_output.svg'])
+def test_bold_font_output():
+ fig, ax = plt.subplots()
+ ax.plot(np.arange(10), np.arange(10))
+ ax.set_xlabel('nonbold-xlabel')
+ ax.set_ylabel('bold-ylabel', fontweight='bold')
+ ax.set_title('bold-title', fontweight='bold')
+
+
+@image_comparison(['bold_font_output_with_none_fonttype.svg'])
+def test_bold_font_output_with_none_fonttype():
+ plt.rcParams['svg.fonttype'] = 'none'
+ fig, ax = plt.subplots()
+ ax.plot(np.arange(10), np.arange(10))
+ ax.set_xlabel('nonbold-xlabel')
+ ax.set_ylabel('bold-ylabel', fontweight='bold')
+ ax.set_title('bold-title', fontweight='bold')
+
+
+@check_figures_equal(tol=20)
+def test_rasterized(fig_test, fig_ref):
+ t = np.arange(0, 100) * (2.3)
+ x = np.cos(t)
+ y = np.sin(t)
+
+ ax_ref = fig_ref.subplots()
+ ax_ref.plot(x, y, "-", c="r", lw=10)
+ ax_ref.plot(x+1, y, "-", c="b", lw=10)
+
+ ax_test = fig_test.subplots()
+ ax_test.plot(x, y, "-", c="r", lw=10, rasterized=True)
+ ax_test.plot(x+1, y, "-", c="b", lw=10, rasterized=True)
+
+
+@check_figures_equal()
+def test_rasterized_ordering(fig_test, fig_ref):
+ t = np.arange(0, 100) * (2.3)
+ x = np.cos(t)
+ y = np.sin(t)
+
+ ax_ref = fig_ref.subplots()
+ ax_ref.set_xlim(0, 3)
+ ax_ref.set_ylim(-1.1, 1.1)
+ ax_ref.plot(x, y, "-", c="r", lw=10, rasterized=True)
+ ax_ref.plot(x+1, y, "-", c="b", lw=10, rasterized=False)
+ ax_ref.plot(x+2, y, "-", c="g", lw=10, rasterized=True)
+ ax_ref.plot(x+3, y, "-", c="m", lw=10, rasterized=True)
+
+ ax_test = fig_test.subplots()
+ ax_test.set_xlim(0, 3)
+ ax_test.set_ylim(-1.1, 1.1)
+ ax_test.plot(x, y, "-", c="r", lw=10, rasterized=True, zorder=1.1)
+ ax_test.plot(x+2, y, "-", c="g", lw=10, rasterized=True, zorder=1.3)
+ ax_test.plot(x+3, y, "-", c="m", lw=10, rasterized=True, zorder=1.4)
+ ax_test.plot(x+1, y, "-", c="b", lw=10, rasterized=False, zorder=1.2)
+
+
+def test_count_bitmaps():
+ def count_tag(fig, tag):
+ with BytesIO() as fd:
+ fig.savefig(fd, format='svg')
+ buf = fd.getvalue().decode()
+ return buf.count(f"<{tag}")
+
+ # No rasterized elements
+ fig1 = plt.figure()
+ ax1 = fig1.add_subplot(1, 1, 1)
+ ax1.set_axis_off()
+ for n in range(5):
+ ax1.plot([0, 20], [0, n], "b-", rasterized=False)
+ assert count_tag(fig1, "image") == 0
+ assert count_tag(fig1, "path") == 6 # axis patch plus lines
+
+ # rasterized can be merged
+ fig2 = plt.figure()
+ ax2 = fig2.add_subplot(1, 1, 1)
+ ax2.set_axis_off()
+ for n in range(5):
+ ax2.plot([0, 20], [0, n], "b-", rasterized=True)
+ assert count_tag(fig2, "image") == 1
+ assert count_tag(fig2, "path") == 1 # axis patch
+
+ # rasterized can't be merged without affecting draw order
+ fig3 = plt.figure()
+ ax3 = fig3.add_subplot(1, 1, 1)
+ ax3.set_axis_off()
+ for n in range(5):
+ ax3.plot([0, 20], [n, 0], "b-", rasterized=False)
+ ax3.plot([0, 20], [0, n], "b-", rasterized=True)
+ assert count_tag(fig3, "image") == 5
+ assert count_tag(fig3, "path") == 6
+
+ # rasterized whole axes
+ fig4 = plt.figure()
+ ax4 = fig4.add_subplot(1, 1, 1)
+ ax4.set_axis_off()
+ ax4.set_rasterized(True)
+ for n in range(5):
+ ax4.plot([0, 20], [n, 0], "b-", rasterized=False)
+ ax4.plot([0, 20], [0, n], "b-", rasterized=True)
+ assert count_tag(fig4, "image") == 1
+ assert count_tag(fig4, "path") == 1
+
+ # rasterized can be merged, but inhibited by suppressComposite
+ fig5 = plt.figure()
+ fig5.suppressComposite = True
+ ax5 = fig5.add_subplot(1, 1, 1)
+ ax5.set_axis_off()
+ for n in range(5):
+ ax5.plot([0, 20], [0, n], "b-", rasterized=True)
+ assert count_tag(fig5, "image") == 5
+ assert count_tag(fig5, "path") == 1 # axis patch
+
+
+@needs_usetex
+def test_missing_psfont(monkeypatch):
+ """An error is raised if a TeX font lacks a Type-1 equivalent"""
+
+ def psfont(*args, **kwargs):
+ return dviread.PsFont(texname='texfont', psname='Some Font',
+ effects=None, encoding=None, filename=None)
+
+ monkeypatch.setattr(dviread.PsfontsMap, '__getitem__', psfont)
+ mpl.rc('text', usetex=True)
+ fig, ax = plt.subplots()
+ ax.text(0.5, 0.5, 'hello')
+ with tempfile.TemporaryFile() as tmpfile, pytest.raises(ValueError):
+ fig.savefig(tmpfile, format='svg')
+
+
+# Use Computer Modern Sans Serif, not Helvetica (which has no \textwon).
+@pytest.mark.style('default')
+@needs_usetex
+def test_unicode_won():
+ fig = Figure()
+ fig.text(.5, .5, r'\textwon', usetex=True)
+
+ with BytesIO() as fd:
+ fig.savefig(fd, format='svg')
+ buf = fd.getvalue()
+
+ tree = xml.etree.ElementTree.fromstring(buf)
+ ns = 'http://www.w3.org/2000/svg'
+ won_id = 'SFSS3583-8e'
+ assert len(tree.findall(f'.//{{{ns}}}path[@d][@id="{won_id}"]')) == 1
+ assert f'#{won_id}' in tree.find(f'.//{{{ns}}}use').attrib.values()
+
+
+def test_svgnone_with_data_coordinates():
+ plt.rcParams['svg.fonttype'] = 'none'
+ expected = 'Unlikely to appear by chance'
+
+ fig, ax = plt.subplots()
+ ax.text(np.datetime64('2019-06-30'), 1, expected)
+ ax.set_xlim(np.datetime64('2019-01-01'), np.datetime64('2019-12-31'))
+ ax.set_ylim(0, 2)
+
+ with BytesIO() as fd:
+ fig.savefig(fd, format='svg')
+ fd.seek(0)
+ buf = fd.read().decode()
+
+ assert expected in buf
+ for prop in ["family", "weight", "stretch", "style", "size"]:
+ assert f"font-{prop}:" in buf
+
+
+def test_gid():
+ """Test that object gid appears in output svg."""
+ from matplotlib.offsetbox import OffsetBox
+ from matplotlib.axis import Tick
+
+ fig = plt.figure()
+
+ ax1 = fig.add_subplot(131)
+ ax1.imshow([[1., 2.], [2., 3.]], aspect="auto")
+ ax1.scatter([1, 2, 3], [1, 2, 3], label="myscatter")
+ ax1.plot([2, 3, 1], label="myplot")
+ ax1.legend()
+ ax1a = ax1.twinx()
+ ax1a.bar([1, 2, 3], [1, 2, 3])
+
+ ax2 = fig.add_subplot(132, projection="polar")
+ ax2.plot([0, 1.5, 3], [1, 2, 3])
+
+ ax3 = fig.add_subplot(133, projection="3d")
+ ax3.plot([1, 2], [1, 2], [1, 2])
+
+ fig.canvas.draw()
+
+ gdic = {}
+ for idx, obj in enumerate(fig.findobj(include_self=True)):
+ if obj.get_visible():
+ gid = f"test123{obj.__class__.__name__}_{idx}"
+ gdic[gid] = obj
+ obj.set_gid(gid)
+
+ with BytesIO() as fd:
+ fig.savefig(fd, format='svg')
+ buf = fd.getvalue().decode()
+
+ def include(gid, obj):
+ # we need to exclude certain objects which will not appear in the svg
+ if isinstance(obj, OffsetBox):
+ return False
+ if isinstance(obj, plt.Text):
+ if obj.get_text() == "":
+ return False
+ elif obj.axes is None:
+ return False
+ if isinstance(obj, plt.Line2D):
+ xdata, ydata = obj.get_data()
+ if len(xdata) == len(ydata) == 1:
+ return False
+ elif not hasattr(obj, "axes") or obj.axes is None:
+ return False
+ if isinstance(obj, Tick):
+ loc = obj.get_loc()
+ if loc == 0:
+ return False
+ vi = obj.get_view_interval()
+ if loc < min(vi) or loc > max(vi):
+ return False
+ return True
+
+ for gid, obj in gdic.items():
+ if include(gid, obj):
+ assert gid in buf
+
+
+def test_savefig_tight():
+ # Check that the draw-disabled renderer correctly disables open/close_group
+ # as well.
+ plt.savefig(BytesIO(), format="svgz", bbox_inches="tight")
+
+
+def test_url():
+ # Test that object url appears in output svg.
+
+ fig, ax = plt.subplots()
+
+ # collections
+ s = ax.scatter([1, 2, 3], [4, 5, 6])
+ s.set_urls(['http://example.com/foo', 'http://example.com/bar', None])
+
+ # Line2D
+ p, = plt.plot([1, 3], [6, 5])
+ p.set_url('http://example.com/baz')
+
+ b = BytesIO()
+ fig.savefig(b, format='svg')
+ b = b.getvalue()
+ for v in [b'foo', b'bar', b'baz']:
+ assert b'http://example.com/' + v in b
+
+
+def test_url_tick(monkeypatch):
+ monkeypatch.setenv('SOURCE_DATE_EPOCH', '19680801')
+
+ fig1, ax = plt.subplots()
+ ax.scatter([1, 2, 3], [4, 5, 6])
+ for i, tick in enumerate(ax.yaxis.get_major_ticks()):
+ tick.set_url(f'http://example.com/{i}')
+
+ fig2, ax = plt.subplots()
+ ax.scatter([1, 2, 3], [4, 5, 6])
+ for i, tick in enumerate(ax.yaxis.get_major_ticks()):
+ tick.label1.set_url(f'http://example.com/{i}')
+ tick.label2.set_url(f'http://example.com/{i}')
+
+ b1 = BytesIO()
+ fig1.savefig(b1, format='svg')
+ b1 = b1.getvalue()
+
+ b2 = BytesIO()
+ fig2.savefig(b2, format='svg')
+ b2 = b2.getvalue()
+
+ for i in range(len(ax.yaxis.get_major_ticks())):
+ assert f'http://example.com/{i}'.encode('ascii') in b1
+ assert b1 == b2
+
+
+def test_svg_default_metadata(monkeypatch):
+ # Values have been predefined for 'Creator', 'Date', 'Format', and 'Type'.
+ monkeypatch.setenv('SOURCE_DATE_EPOCH', '19680801')
+
+ fig, ax = plt.subplots()
+ with BytesIO() as fd:
+ fig.savefig(fd, format='svg')
+ buf = fd.getvalue().decode()
+
+ # Creator
+ assert mpl.__version__ in buf
+ # Date
+ assert '1970-08-16' in buf
+ # Format
+ assert 'image/svg+xml' in buf
+ # Type
+ assert 'StillImage' in buf
+
+ # Now make sure all the default metadata can be cleared.
+ with BytesIO() as fd:
+ fig.savefig(fd, format='svg', metadata={'Date': None, 'Creator': None,
+ 'Format': None, 'Type': None})
+ buf = fd.getvalue().decode()
+
+ # Creator
+ assert mpl.__version__ not in buf
+ # Date
+ assert '1970-08-16' not in buf
+ # Format
+ assert 'image/svg+xml' not in buf
+ # Type
+ assert 'StillImage' not in buf
+
+
+def test_svg_clear_default_metadata(monkeypatch):
+ # Makes sure that setting a default metadata to `None`
+ # removes the corresponding tag from the metadata.
+ monkeypatch.setenv('SOURCE_DATE_EPOCH', '19680801')
+
+ metadata_contains = {'creator': mpl.__version__, 'date': '1970-08-16',
+ 'format': 'image/svg+xml', 'type': 'StillImage'}
+
+ SVGNS = '{http://www.w3.org/2000/svg}'
+ RDFNS = '{http://www.w3.org/1999/02/22-rdf-syntax-ns#}'
+ CCNS = '{http://creativecommons.org/ns#}'
+ DCNS = '{http://purl.org/dc/elements/1.1/}'
+
+ fig, ax = plt.subplots()
+ for name in metadata_contains:
+ with BytesIO() as fd:
+ fig.savefig(fd, format='svg', metadata={name.title(): None})
+ buf = fd.getvalue().decode()
+
+ root = xml.etree.ElementTree.fromstring(buf)
+ work, = root.findall(f'./{SVGNS}metadata/{RDFNS}RDF/{CCNS}Work')
+ for key in metadata_contains:
+ data = work.findall(f'./{DCNS}{key}')
+ if key == name:
+ # The one we cleared is not there
+ assert not data
+ continue
+ # Everything else should be there
+ data, = data
+ xmlstr = xml.etree.ElementTree.tostring(data, encoding="unicode")
+ assert metadata_contains[key] in xmlstr
+
+
+def test_svg_clear_all_metadata():
+ # Makes sure that setting all default metadata to `None`
+ # removes the metadata tag from the output.
+
+ fig, ax = plt.subplots()
+ with BytesIO() as fd:
+ fig.savefig(fd, format='svg', metadata={'Date': None, 'Creator': None,
+ 'Format': None, 'Type': None})
+ buf = fd.getvalue().decode()
+
+ SVGNS = '{http://www.w3.org/2000/svg}'
+
+ root = xml.etree.ElementTree.fromstring(buf)
+ assert not root.findall(f'./{SVGNS}metadata')
+
+
+def test_svg_metadata():
+ single_value = ['Coverage', 'Identifier', 'Language', 'Relation', 'Source',
+ 'Title', 'Type']
+ multi_value = ['Contributor', 'Creator', 'Keywords', 'Publisher', 'Rights']
+ metadata = {
+ 'Date': [datetime.date(1968, 8, 1),
+ datetime.datetime(1968, 8, 2, 1, 2, 3)],
+ 'Description': 'description\ntext',
+ **{k: f'{k} foo' for k in single_value},
+ **{k: [f'{k} bar', f'{k} baz'] for k in multi_value},
+ }
+
+ fig, ax = plt.subplots()
+ with BytesIO() as fd:
+ fig.savefig(fd, format='svg', metadata=metadata)
+ buf = fd.getvalue().decode()
+
+ SVGNS = '{http://www.w3.org/2000/svg}'
+ RDFNS = '{http://www.w3.org/1999/02/22-rdf-syntax-ns#}'
+ CCNS = '{http://creativecommons.org/ns#}'
+ DCNS = '{http://purl.org/dc/elements/1.1/}'
+
+ root = xml.etree.ElementTree.fromstring(buf)
+ rdf, = root.findall(f'./{SVGNS}metadata/{RDFNS}RDF')
+
+ # Check things that are single entries.
+ titles = [node.text for node in root.findall(f'./{SVGNS}title')]
+ assert titles == [metadata['Title']]
+ types = [node.attrib[f'{RDFNS}resource']
+ for node in rdf.findall(f'./{CCNS}Work/{DCNS}type')]
+ assert types == [metadata['Type']]
+ for k in ['Description', *single_value]:
+ if k == 'Type':
+ continue
+ values = [node.text
+ for node in rdf.findall(f'./{CCNS}Work/{DCNS}{k.lower()}')]
+ assert values == [metadata[k]]
+
+ # Check things that are multi-value entries.
+ for k in multi_value:
+ if k == 'Keywords':
+ continue
+ values = [
+ node.text
+ for node in rdf.findall(
+ f'./{CCNS}Work/{DCNS}{k.lower()}/{CCNS}Agent/{DCNS}title')]
+ assert values == metadata[k]
+
+ # Check special things.
+ dates = [node.text for node in rdf.findall(f'./{CCNS}Work/{DCNS}date')]
+ assert dates == ['1968-08-01/1968-08-02T01:02:03']
+
+ values = [node.text for node in
+ rdf.findall(f'./{CCNS}Work/{DCNS}subject/{RDFNS}Bag/{RDFNS}li')]
+ assert values == metadata['Keywords']
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_backend_tk.py b/venv/Lib/site-packages/matplotlib/tests/test_backend_tk.py
new file mode 100644
index 0000000..a129aff
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_backend_tk.py
@@ -0,0 +1,236 @@
+import os
+import subprocess
+import sys
+
+import pytest
+
+_test_timeout = 10 # Empirically, 1s is not enough on CI.
+
+# NOTE: TkAgg tests seem to have interactions between tests,
+# So isolate each test in a subprocess. See GH#18261
+
+
+@pytest.mark.backend('TkAgg', skip_on_importerror=True)
+def test_blit():
+ script = """
+import matplotlib.pyplot as plt
+import numpy as np
+from matplotlib.backends import _tkagg
+def evil_blit(photoimage, aggimage, offsets, bboxptr):
+ data = np.asarray(aggimage)
+ height, width = data.shape[:2]
+ dataptr = (height, width, data.ctypes.data)
+ _tkagg.blit(
+ photoimage.tk.interpaddr(), str(photoimage), dataptr, offsets,
+ bboxptr)
+
+fig, ax = plt.subplots()
+bad_boxes = ((-1, 2, 0, 2),
+ (2, 0, 0, 2),
+ (1, 6, 0, 2),
+ (0, 2, -1, 2),
+ (0, 2, 2, 0),
+ (0, 2, 1, 6))
+for bad_box in bad_boxes:
+ try:
+ evil_blit(fig.canvas._tkphoto,
+ np.ones((4, 4, 4)),
+ (0, 1, 2, 3),
+ bad_box)
+ except ValueError:
+ print("success")
+"""
+ try:
+ proc = subprocess.run(
+ [sys.executable, "-c", script],
+ env={**os.environ,
+ "MPLBACKEND": "TkAgg",
+ "SOURCE_DATE_EPOCH": "0"},
+ timeout=_test_timeout,
+ stdout=subprocess.PIPE,
+ check=True,
+ universal_newlines=True,
+ )
+ except subprocess.TimeoutExpired:
+ pytest.fail("Subprocess timed out")
+ except subprocess.CalledProcessError:
+ pytest.fail("Likely regression on out-of-bounds data access"
+ " in _tkagg.cpp")
+ else:
+ print(proc.stdout)
+ assert proc.stdout.count("success") == 6 # len(bad_boxes)
+
+
+@pytest.mark.backend('TkAgg', skip_on_importerror=True)
+def test_figuremanager_preserves_host_mainloop():
+ script = """
+import tkinter
+import matplotlib.pyplot as plt
+success = False
+
+def do_plot():
+ plt.figure()
+ plt.plot([1, 2], [3, 5])
+ plt.close()
+ root.after(0, legitimate_quit)
+
+def legitimate_quit():
+ root.quit()
+ global success
+ success = True
+
+root = tkinter.Tk()
+root.after(0, do_plot)
+root.mainloop()
+
+if success:
+ print("success")
+"""
+ try:
+ proc = subprocess.run(
+ [sys.executable, "-c", script],
+ env={**os.environ,
+ "MPLBACKEND": "TkAgg",
+ "SOURCE_DATE_EPOCH": "0"},
+ timeout=_test_timeout,
+ stdout=subprocess.PIPE,
+ check=True,
+ universal_newlines=True,
+ )
+ except subprocess.TimeoutExpired:
+ pytest.fail("Subprocess timed out")
+ except subprocess.CalledProcessError:
+ pytest.fail("Subprocess failed to test intended behavior")
+ else:
+ assert proc.stdout.count("success") == 1
+
+
+@pytest.mark.backend('TkAgg', skip_on_importerror=True)
+@pytest.mark.flaky(reruns=3)
+def test_figuremanager_cleans_own_mainloop():
+ script = '''
+import tkinter
+import time
+import matplotlib.pyplot as plt
+import threading
+from matplotlib.cbook import _get_running_interactive_framework
+
+root = tkinter.Tk()
+plt.plot([1, 2, 3], [1, 2, 5])
+
+def target():
+ while not 'tk' == _get_running_interactive_framework():
+ time.sleep(.01)
+ plt.close()
+ if show_finished_event.wait():
+ print('success')
+
+show_finished_event = threading.Event()
+thread = threading.Thread(target=target, daemon=True)
+thread.start()
+plt.show(block=True) # testing if this function hangs
+show_finished_event.set()
+thread.join()
+
+'''
+ try:
+ proc = subprocess.run(
+ [sys.executable, "-c", script],
+ env={**os.environ,
+ "MPLBACKEND": "TkAgg",
+ "SOURCE_DATE_EPOCH": "0"},
+ timeout=_test_timeout,
+ stdout=subprocess.PIPE,
+ universal_newlines=True,
+ check=True
+ )
+ except subprocess.TimeoutExpired:
+ pytest.fail("Most likely plot.show(block=True) hung")
+ except subprocess.CalledProcessError:
+ pytest.fail("Subprocess failed to test intended behavior")
+ assert proc.stdout.count("success") == 1
+
+
+@pytest.mark.backend('TkAgg', skip_on_importerror=True)
+@pytest.mark.flaky(reruns=3)
+def test_never_update():
+ script = """
+import tkinter
+del tkinter.Misc.update
+del tkinter.Misc.update_idletasks
+
+import matplotlib.pyplot as plt
+fig = plt.figure()
+plt.show(block=False)
+
+# regression test on FigureCanvasTkAgg
+plt.draw()
+# regression test on NavigationToolbar2Tk
+fig.canvas.toolbar.configure_subplots()
+
+# check for update() or update_idletasks() in the event queue
+# functionally equivalent to tkinter.Misc.update
+# must pause >= 1 ms to process tcl idle events plus
+# extra time to avoid flaky tests on slow systems
+plt.pause(0.1)
+
+# regression test on FigureCanvasTk filter_destroy callback
+plt.close(fig)
+"""
+ try:
+ proc = subprocess.run(
+ [sys.executable, "-c", script],
+ env={**os.environ,
+ "MPLBACKEND": "TkAgg",
+ "SOURCE_DATE_EPOCH": "0"},
+ timeout=_test_timeout,
+ capture_output=True,
+ universal_newlines=True,
+ )
+ except subprocess.TimeoutExpired:
+ pytest.fail("Subprocess timed out")
+ else:
+ # test framework doesn't see tkinter callback exceptions normally
+ # see tkinter.Misc.report_callback_exception
+ assert "Exception in Tkinter callback" not in proc.stderr
+ # make sure we can see other issues
+ print(proc.stderr, file=sys.stderr)
+ # Checking return code late so the Tkinter assertion happens first
+ if proc.returncode:
+ pytest.fail("Subprocess failed to test intended behavior")
+
+
+@pytest.mark.backend('TkAgg', skip_on_importerror=True)
+def test_missing_back_button():
+ script = """
+import matplotlib.pyplot as plt
+from matplotlib.backends.backend_tkagg import NavigationToolbar2Tk
+class Toolbar(NavigationToolbar2Tk):
+ # only display the buttons we need
+ toolitems = [t for t in NavigationToolbar2Tk.toolitems if
+ t[0] in ('Home', 'Pan', 'Zoom')]
+
+fig = plt.figure()
+print("setup complete")
+# this should not raise
+Toolbar(fig.canvas, fig.canvas.manager.window)
+print("success")
+"""
+ try:
+ proc = subprocess.run(
+ [sys.executable, "-c", script],
+ env={**os.environ,
+ "MPLBACKEND": "TkAgg",
+ "SOURCE_DATE_EPOCH": "0"},
+ timeout=_test_timeout,
+ stdout=subprocess.PIPE,
+ universal_newlines=True,
+ )
+ except subprocess.TimeoutExpired:
+ pytest.fail("Subprocess timed out")
+ else:
+ assert proc.stdout.count("setup complete") == 1
+ assert proc.stdout.count("success") == 1
+ # Checking return code late so the stdout assertions happen first
+ if proc.returncode:
+ pytest.fail("Subprocess failed to test intended behavior")
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_backend_tools.py b/venv/Lib/site-packages/matplotlib/tests/test_backend_tools.py
new file mode 100644
index 0000000..cc05a1a
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_backend_tools.py
@@ -0,0 +1,20 @@
+import pytest
+
+from matplotlib.backend_tools import ToolHelpBase
+
+
+@pytest.mark.parametrize('rc_shortcut,expected', [
+ ('home', 'Home'),
+ ('backspace', 'Backspace'),
+ ('f1', 'F1'),
+ ('ctrl+a', 'Ctrl+A'),
+ ('ctrl+A', 'Ctrl+Shift+A'),
+ ('a', 'a'),
+ ('A', 'A'),
+ ('ctrl+shift+f1', 'Ctrl+Shift+F1'),
+ ('1', '1'),
+ ('cmd+p', 'Cmd+P'),
+ ('cmd+1', 'Cmd+1'),
+])
+def test_format_shortcut(rc_shortcut, expected):
+ assert ToolHelpBase.format_shortcut(rc_shortcut) == expected
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_backend_webagg.py b/venv/Lib/site-packages/matplotlib/tests/test_backend_webagg.py
new file mode 100644
index 0000000..5c6ddfa
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_backend_webagg.py
@@ -0,0 +1,27 @@
+import subprocess
+import os
+import sys
+import pytest
+
+
+@pytest.mark.parametrize("backend", ["webagg", "nbagg"])
+def test_webagg_fallback(backend):
+ pytest.importorskip("tornado")
+ if backend == "nbagg":
+ pytest.importorskip("IPython")
+ env = dict(os.environ)
+ if os.name != "nt":
+ env["DISPLAY"] = ""
+
+ env["MPLBACKEND"] = backend
+
+ test_code = (
+ "import os;"
+ + f"assert os.environ['MPLBACKEND'] == '{backend}';"
+ + "import matplotlib.pyplot as plt; "
+ + "print(plt.get_backend());"
+ f"assert '{backend}' == plt.get_backend().lower();"
+ )
+ ret = subprocess.call([sys.executable, "-c", test_code], env=env)
+
+ assert ret == 0
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_backends_interactive.py b/venv/Lib/site-packages/matplotlib/tests/test_backends_interactive.py
new file mode 100644
index 0000000..dc72b68
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_backends_interactive.py
@@ -0,0 +1,303 @@
+import importlib
+import importlib.util
+import inspect
+import json
+import os
+import signal
+import subprocess
+import sys
+import time
+import urllib.request
+
+import pytest
+
+import matplotlib as mpl
+from matplotlib import _c_internal_utils
+
+
+# Minimal smoke-testing of the backends for which the dependencies are
+# PyPI-installable on CI. They are not available for all tested Python
+# versions so we don't fail on missing backends.
+
+def _get_testable_interactive_backends():
+ try:
+ from matplotlib.backends.qt_compat import QtGui # noqa
+ have_qt5 = True
+ except ImportError:
+ have_qt5 = False
+
+ backends = []
+ for deps, backend in [
+ (["cairo", "gi"], "gtk3agg"),
+ (["cairo", "gi"], "gtk3cairo"),
+ (["PyQt5"], "qt5agg"),
+ (["PyQt5", "cairocffi"], "qt5cairo"),
+ (["PySide2"], "qt5agg"),
+ (["PySide2", "cairocffi"], "qt5cairo"),
+ (["tkinter"], "tkagg"),
+ (["wx"], "wx"),
+ (["wx"], "wxagg"),
+ (["matplotlib.backends._macosx"], "macosx"),
+ ]:
+ reason = None
+ missing = [dep for dep in deps if not importlib.util.find_spec(dep)]
+ if (sys.platform == "linux" and
+ not _c_internal_utils.display_is_valid()):
+ reason = "$DISPLAY and $WAYLAND_DISPLAY are unset"
+ elif missing:
+ reason = "{} cannot be imported".format(", ".join(missing))
+ elif backend == 'macosx' and os.environ.get('TF_BUILD'):
+ reason = "macosx backend fails on Azure"
+ elif 'qt5' in backend and not have_qt5:
+ reason = "no usable Qt5 bindings"
+ marks = []
+ if reason:
+ marks.append(pytest.mark.skip(
+ reason=f"Skipping {backend} because {reason}"))
+ elif backend.startswith('wx') and sys.platform == 'darwin':
+ # ignore on OSX because that's currently broken (github #16849)
+ marks.append(pytest.mark.xfail(reason='github #16849'))
+ backend = pytest.param(backend, marks=marks)
+ backends.append(backend)
+ return backends
+
+
+_test_timeout = 10 # Empirically, 1s is not enough on CI.
+
+
+# The source of this function gets extracted and run in another process, so it
+# must be fully self-contained.
+# Using a timer not only allows testing of timers (on other backends), but is
+# also necessary on gtk3 and wx, where a direct call to key_press_event("q")
+# from draw_event causes breakage due to the canvas widget being deleted too
+# early. Also, gtk3 redefines key_press_event with a different signature, so
+# we directly invoke it from the superclass instead.
+def _test_interactive_impl():
+ import importlib.util
+ import io
+ import json
+ import sys
+ from unittest import TestCase
+
+ import matplotlib as mpl
+ from matplotlib import pyplot as plt, rcParams
+ from matplotlib.backend_bases import FigureCanvasBase
+
+ rcParams.update({
+ "webagg.open_in_browser": False,
+ "webagg.port_retries": 1,
+ })
+ if len(sys.argv) >= 2: # Second argument is json-encoded rcParams.
+ rcParams.update(json.loads(sys.argv[1]))
+ backend = plt.rcParams["backend"].lower()
+ assert_equal = TestCase().assertEqual
+ assert_raises = TestCase().assertRaises
+
+ if backend.endswith("agg") and not backend.startswith(("gtk3", "web")):
+ # Force interactive framework setup.
+ plt.figure()
+
+ # Check that we cannot switch to a backend using another interactive
+ # framework, but can switch to a backend using cairo instead of agg,
+ # or a non-interactive backend. In the first case, we use tkagg as
+ # the "other" interactive backend as it is (essentially) guaranteed
+ # to be present. Moreover, don't test switching away from gtk3 (as
+ # Gtk.main_level() is not set up at this point yet) and webagg (which
+ # uses no interactive framework).
+
+ if backend != "tkagg":
+ with assert_raises(ImportError):
+ mpl.use("tkagg", force=True)
+
+ def check_alt_backend(alt_backend):
+ mpl.use(alt_backend, force=True)
+ fig = plt.figure()
+ assert_equal(
+ type(fig.canvas).__module__,
+ "matplotlib.backends.backend_{}".format(alt_backend))
+
+ if importlib.util.find_spec("cairocffi"):
+ check_alt_backend(backend[:-3] + "cairo")
+ check_alt_backend("svg")
+
+ mpl.use(backend, force=True)
+
+ fig, ax = plt.subplots()
+ assert_equal(
+ type(fig.canvas).__module__,
+ "matplotlib.backends.backend_{}".format(backend))
+
+ ax.plot([0, 1], [2, 3])
+
+ timer = fig.canvas.new_timer(1.) # Test floats casting to int as needed.
+ timer.add_callback(FigureCanvasBase.key_press_event, fig.canvas, "q")
+ # Trigger quitting upon draw.
+ fig.canvas.mpl_connect("draw_event", lambda event: timer.start())
+ fig.canvas.mpl_connect("close_event", print)
+
+ result = io.BytesIO()
+ fig.savefig(result, format='png')
+
+ plt.show()
+
+ # Ensure that the window is really closed.
+ plt.pause(0.5)
+
+ # Test that saving works after interactive window is closed, but the figure
+ # is not deleted.
+ result_after = io.BytesIO()
+ fig.savefig(result_after, format='png')
+
+ if not backend.startswith('qt5') and sys.platform == 'darwin':
+ # FIXME: This should be enabled everywhere once Qt5 is fixed on macOS
+ # to not resize incorrectly.
+ assert_equal(result.getvalue(), result_after.getvalue())
+
+
+@pytest.mark.parametrize("backend", _get_testable_interactive_backends())
+@pytest.mark.parametrize("toolbar", ["toolbar2", "toolmanager"])
+@pytest.mark.flaky(reruns=3)
+def test_interactive_backend(backend, toolbar):
+ if backend == "macosx":
+ if toolbar == "toolmanager":
+ pytest.skip("toolmanager is not implemented for macosx.")
+
+ proc = subprocess.run(
+ [sys.executable, "-c",
+ inspect.getsource(_test_interactive_impl)
+ + "\n_test_interactive_impl()",
+ json.dumps({"toolbar": toolbar})],
+ env={**os.environ, "MPLBACKEND": backend, "SOURCE_DATE_EPOCH": "0"},
+ timeout=_test_timeout,
+ stdout=subprocess.PIPE, universal_newlines=True)
+ if proc.returncode:
+ pytest.fail("The subprocess returned with non-zero exit status "
+ f"{proc.returncode}.")
+ assert proc.stdout.count("CloseEvent") == 1
+
+
+# The source of this function gets extracted and run in another process, so it
+# must be fully self-contained.
+def _test_thread_impl():
+ from concurrent.futures import ThreadPoolExecutor
+ import json
+ import sys
+
+ from matplotlib import pyplot as plt, rcParams
+
+ rcParams.update({
+ "webagg.open_in_browser": False,
+ "webagg.port_retries": 1,
+ })
+ if len(sys.argv) >= 2: # Second argument is json-encoded rcParams.
+ rcParams.update(json.loads(sys.argv[1]))
+
+ # Test artist creation and drawing does not crash from thread
+ # No other guarantees!
+ fig, ax = plt.subplots()
+ # plt.pause needed vs plt.show(block=False) at least on toolbar2-tkagg
+ plt.pause(0.5)
+
+ future = ThreadPoolExecutor().submit(ax.plot, [1, 3, 6])
+ future.result() # Joins the thread; rethrows any exception.
+
+ fig.canvas.mpl_connect("close_event", print)
+ future = ThreadPoolExecutor().submit(fig.canvas.draw)
+ plt.pause(0.5) # flush_events fails here on at least Tkagg (bpo-41176)
+ future.result() # Joins the thread; rethrows any exception.
+ plt.close()
+ fig.canvas.flush_events() # pause doesn't process events after close
+
+
+_thread_safe_backends = _get_testable_interactive_backends()
+# Known unsafe backends. Remove the xfails if they start to pass!
+for param in _thread_safe_backends:
+ backend = param.values[0]
+ if "cairo" in backend:
+ # Cairo backends save a cairo_t on the graphics context, and sharing
+ # these is not threadsafe.
+ param.marks.append(
+ pytest.mark.xfail(raises=subprocess.CalledProcessError))
+ elif backend == "wx":
+ param.marks.append(
+ pytest.mark.xfail(raises=subprocess.CalledProcessError))
+ elif backend == "macosx":
+ param.marks.append(
+ pytest.mark.xfail(raises=subprocess.TimeoutExpired, strict=True))
+
+
+@pytest.mark.parametrize("backend", _thread_safe_backends)
+@pytest.mark.flaky(reruns=3)
+def test_interactive_thread_safety(backend):
+ proc = subprocess.run(
+ [sys.executable, "-c",
+ inspect.getsource(_test_thread_impl) + "\n_test_thread_impl()"],
+ env={**os.environ, "MPLBACKEND": backend, "SOURCE_DATE_EPOCH": "0"},
+ timeout=_test_timeout, check=True,
+ stdout=subprocess.PIPE, universal_newlines=True)
+ assert proc.stdout.count("CloseEvent") == 1
+
+
+@pytest.mark.skipif('TF_BUILD' in os.environ,
+ reason="this test fails an azure for unknown reasons")
+@pytest.mark.skipif(os.name == "nt", reason="Cannot send SIGINT on Windows.")
+def test_webagg():
+ pytest.importorskip("tornado")
+ proc = subprocess.Popen(
+ [sys.executable, "-c",
+ inspect.getsource(_test_interactive_impl)
+ + "\n_test_interactive_impl()"],
+ env={**os.environ, "MPLBACKEND": "webagg", "SOURCE_DATE_EPOCH": "0"})
+ url = "http://{}:{}".format(
+ mpl.rcParams["webagg.address"], mpl.rcParams["webagg.port"])
+ timeout = time.perf_counter() + _test_timeout
+ while True:
+ try:
+ retcode = proc.poll()
+ # check that the subprocess for the server is not dead
+ assert retcode is None
+ conn = urllib.request.urlopen(url)
+ break
+ except urllib.error.URLError:
+ if time.perf_counter() > timeout:
+ pytest.fail("Failed to connect to the webagg server.")
+ else:
+ continue
+ conn.close()
+ proc.send_signal(signal.SIGINT)
+ assert proc.wait(timeout=_test_timeout) == 0
+
+
+@pytest.mark.skipif(sys.platform != "linux", reason="this a linux-only test")
+@pytest.mark.backend('Qt5Agg', skip_on_importerror=True)
+def test_lazy_linux_headless():
+ test_script = """
+import os
+import sys
+
+# make it look headless
+os.environ.pop('DISPLAY', None)
+os.environ.pop('WAYLAND_DISPLAY', None)
+
+# we should fast-track to Agg
+import matplotlib.pyplot as plt
+plt.get_backend() == 'agg'
+assert 'PyQt5' not in sys.modules
+
+# make sure we really have pyqt installed
+import PyQt5
+assert 'PyQt5' in sys.modules
+
+# try to switch and make sure we fail with ImportError
+try:
+ plt.switch_backend('qt5agg')
+except ImportError:
+ ...
+else:
+ sys.exit(1)
+
+"""
+ proc = subprocess.run([sys.executable, "-c", test_script])
+ if proc.returncode:
+ pytest.fail("The subprocess returned with non-zero exit status "
+ f"{proc.returncode}.")
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_basic.py b/venv/Lib/site-packages/matplotlib/tests/test_basic.py
new file mode 100644
index 0000000..f9f1709
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_basic.py
@@ -0,0 +1,46 @@
+import builtins
+import os
+import subprocess
+import sys
+import textwrap
+
+
+def test_simple():
+ assert 1 + 1 == 2
+
+
+def test_override_builtins():
+ import pylab
+ ok_to_override = {
+ '__name__',
+ '__doc__',
+ '__package__',
+ '__loader__',
+ '__spec__',
+ 'any',
+ 'all',
+ 'sum',
+ 'divmod'
+ }
+ overridden = {key for key in {*dir(pylab)} & {*dir(builtins)}
+ if getattr(pylab, key) != getattr(builtins, key)}
+ assert overridden <= ok_to_override
+
+
+def test_lazy_imports():
+ source = textwrap.dedent("""
+ import sys
+
+ import matplotlib.figure
+ import matplotlib.backend_bases
+ import matplotlib.pyplot
+
+ assert 'matplotlib._tri' not in sys.modules
+ assert 'matplotlib._qhull' not in sys.modules
+ assert 'matplotlib._contour' not in sys.modules
+ assert 'urllib.request' not in sys.modules
+ """)
+
+ subprocess.check_call(
+ [sys.executable, '-c', source],
+ env={**os.environ, "MPLBACKEND": "", "MATPLOTLIBRC": os.devnull})
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_bbox_tight.py b/venv/Lib/site-packages/matplotlib/tests/test_bbox_tight.py
new file mode 100644
index 0000000..c018db5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_bbox_tight.py
@@ -0,0 +1,148 @@
+from io import BytesIO
+
+import numpy as np
+
+from matplotlib.testing.decorators import image_comparison
+import matplotlib.pyplot as plt
+import matplotlib.path as mpath
+import matplotlib.patches as mpatches
+from matplotlib.ticker import FuncFormatter
+
+
+@image_comparison(['bbox_inches_tight'], remove_text=True,
+ savefig_kwarg={'bbox_inches': 'tight'})
+def test_bbox_inches_tight():
+ #: Test that a figure saved using bbox_inches='tight' is clipped correctly
+ data = [[66386, 174296, 75131, 577908, 32015],
+ [58230, 381139, 78045, 99308, 160454],
+ [89135, 80552, 152558, 497981, 603535],
+ [78415, 81858, 150656, 193263, 69638],
+ [139361, 331509, 343164, 781380, 52269]]
+
+ col_labels = row_labels = [''] * 5
+
+ rows = len(data)
+ ind = np.arange(len(col_labels)) + 0.3 # the x locations for the groups
+ cell_text = []
+ width = 0.4 # the width of the bars
+ yoff = np.zeros(len(col_labels))
+ # the bottom values for stacked bar chart
+ fig, ax = plt.subplots(1, 1)
+ for row in range(rows):
+ ax.bar(ind, data[row], width, bottom=yoff, align='edge', color='b')
+ yoff = yoff + data[row]
+ cell_text.append([''])
+ plt.xticks([])
+ plt.xlim(0, 5)
+ plt.legend([''] * 5, loc=(1.2, 0.2))
+ fig.legend([''] * 5, bbox_to_anchor=(0, 0.2), loc='lower left')
+ # Add a table at the bottom of the axes
+ cell_text.reverse()
+ plt.table(cellText=cell_text, rowLabels=row_labels, colLabels=col_labels,
+ loc='bottom')
+
+
+@image_comparison(['bbox_inches_tight_suptile_legend'],
+ remove_text=False, savefig_kwarg={'bbox_inches': 'tight'})
+def test_bbox_inches_tight_suptile_legend():
+ plt.plot(np.arange(10), label='a straight line')
+ plt.legend(bbox_to_anchor=(0.9, 1), loc='upper left')
+ plt.title('Axis title')
+ plt.suptitle('Figure title')
+
+ # put an extra long y tick on to see that the bbox is accounted for
+ def y_formatter(y, pos):
+ if int(y) == 4:
+ return 'The number 4'
+ else:
+ return str(y)
+ plt.gca().yaxis.set_major_formatter(FuncFormatter(y_formatter))
+
+ plt.xlabel('X axis')
+
+
+@image_comparison(['bbox_inches_tight_suptile_non_default.png'],
+ remove_text=False, savefig_kwarg={'bbox_inches': 'tight'},
+ tol=0.1) # large tolerance because only testing clipping.
+def test_bbox_inches_tight_suptitle_non_default():
+ fig, ax = plt.subplots()
+ fig.suptitle('Booo', x=0.5, y=1.1)
+
+
+@image_comparison(['bbox_inches_tight_clipping'],
+ remove_text=True, savefig_kwarg={'bbox_inches': 'tight'})
+def test_bbox_inches_tight_clipping():
+ # tests bbox clipping on scatter points, and path clipping on a patch
+ # to generate an appropriately tight bbox
+ plt.scatter(np.arange(10), np.arange(10))
+ ax = plt.gca()
+ ax.set_xlim([0, 5])
+ ax.set_ylim([0, 5])
+
+ # make a massive rectangle and clip it with a path
+ patch = mpatches.Rectangle([-50, -50], 100, 100,
+ transform=ax.transData,
+ facecolor='blue', alpha=0.5)
+
+ path = mpath.Path.unit_regular_star(5).deepcopy()
+ path.vertices *= 0.25
+ patch.set_clip_path(path, transform=ax.transAxes)
+ plt.gcf().artists.append(patch)
+
+
+@image_comparison(['bbox_inches_tight_raster'],
+ remove_text=True, savefig_kwarg={'bbox_inches': 'tight'})
+def test_bbox_inches_tight_raster():
+ """Test rasterization with tight_layout"""
+ fig, ax = plt.subplots()
+ ax.plot([1.0, 2.0], rasterized=True)
+
+
+def test_only_on_non_finite_bbox():
+ fig, ax = plt.subplots()
+ ax.annotate("", xy=(0, float('nan')))
+ ax.set_axis_off()
+ # we only need to test that it does not error out on save
+ fig.savefig(BytesIO(), bbox_inches='tight', format='png')
+
+
+def test_tight_pcolorfast():
+ fig, ax = plt.subplots()
+ ax.pcolorfast(np.arange(4).reshape((2, 2)))
+ ax.set(ylim=(0, .1))
+ buf = BytesIO()
+ fig.savefig(buf, bbox_inches="tight")
+ buf.seek(0)
+ height, width, _ = plt.imread(buf).shape
+ # Previously, the bbox would include the area of the image clipped out by
+ # the axes, resulting in a very tall image given the y limits of (0, 0.1).
+ assert width > height
+
+
+def test_noop_tight_bbox():
+ from PIL import Image
+ x_size, y_size = (10, 7)
+ dpi = 100
+ # make the figure just the right size up front
+ fig = plt.figure(frameon=False, dpi=dpi, figsize=(x_size/dpi, y_size/dpi))
+ ax = plt.Axes(fig, [0., 0., 1., 1.])
+ fig.add_axes(ax)
+ ax.set_axis_off()
+ ax.xaxis.set_visible(False)
+ ax.yaxis.set_visible(False)
+
+ data = np.arange(x_size * y_size).reshape(y_size, x_size)
+ ax.imshow(data, rasterized=True)
+
+ # When a rasterized Artist is included, a mixed-mode renderer does
+ # additional bbox adjustment. It should also be a no-op, and not affect the
+ # next save.
+ fig.savefig(BytesIO(), bbox_inches='tight', pad_inches=0, format='pdf')
+
+ out = BytesIO()
+ fig.savefig(out, bbox_inches='tight', pad_inches=0)
+ out.seek(0)
+ im = np.asarray(Image.open(out))
+ assert (im[:, :, 3] == 255).all()
+ assert not (im[:, :, :3] == 255).all()
+ assert im.shape == (7, 10, 4)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_category.py b/venv/Lib/site-packages/matplotlib/tests/test_category.py
new file mode 100644
index 0000000..2d2f6e5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_category.py
@@ -0,0 +1,304 @@
+"""Catch all for categorical functions"""
+import pytest
+import numpy as np
+
+from matplotlib.axes import Axes
+import matplotlib.pyplot as plt
+import matplotlib.category as cat
+from matplotlib.testing.decorators import check_figures_equal
+
+
+class TestUnitData:
+ test_cases = [('single', (["hello world"], [0])),
+ ('unicode', (["ЗдравÑтвуйте мир"], [0])),
+ ('mixed', (['A', "np.nan", 'B', "3.14", "мир"],
+ [0, 1, 2, 3, 4]))]
+ ids, data = zip(*test_cases)
+
+ @pytest.mark.parametrize("data, locs", data, ids=ids)
+ def test_unit(self, data, locs):
+ unit = cat.UnitData(data)
+ assert list(unit._mapping.keys()) == data
+ assert list(unit._mapping.values()) == locs
+
+ def test_update(self):
+ data = ['a', 'd']
+ locs = [0, 1]
+
+ data_update = ['b', 'd', 'e']
+ unique_data = ['a', 'd', 'b', 'e']
+ updated_locs = [0, 1, 2, 3]
+
+ unit = cat.UnitData(data)
+ assert list(unit._mapping.keys()) == data
+ assert list(unit._mapping.values()) == locs
+
+ unit.update(data_update)
+ assert list(unit._mapping.keys()) == unique_data
+ assert list(unit._mapping.values()) == updated_locs
+
+ failing_test_cases = [("number", 3.14), ("nan", np.nan),
+ ("list", [3.14, 12]), ("mixed type", ["A", 2])]
+
+ fids, fdata = zip(*test_cases)
+
+ @pytest.mark.parametrize("fdata", fdata, ids=fids)
+ def test_non_string_fails(self, fdata):
+ with pytest.raises(TypeError):
+ cat.UnitData(fdata)
+
+ @pytest.mark.parametrize("fdata", fdata, ids=fids)
+ def test_non_string_update_fails(self, fdata):
+ unitdata = cat.UnitData()
+ with pytest.raises(TypeError):
+ unitdata.update(fdata)
+
+
+class FakeAxis:
+ def __init__(self, units):
+ self.units = units
+
+
+class TestStrCategoryConverter:
+ """
+ Based on the pandas conversion and factorization tests:
+
+ ref: /pandas/tseries/tests/test_converter.py
+ /pandas/tests/test_algos.py:TestFactorize
+ """
+ test_cases = [("unicode", ["ЗдравÑтвуйте мир"]),
+ ("ascii", ["hello world"]),
+ ("single", ['a', 'b', 'c']),
+ ("integer string", ["1", "2"]),
+ ("single + values>10", ["A", "B", "C", "D", "E", "F", "G",
+ "H", "I", "J", "K", "L", "M", "N",
+ "O", "P", "Q", "R", "S", "T", "U",
+ "V", "W", "X", "Y", "Z"])]
+
+ ids, values = zip(*test_cases)
+
+ failing_test_cases = [("mixed", [3.14, 'A', np.inf]),
+ ("string integer", ['42', 42])]
+
+ fids, fvalues = zip(*failing_test_cases)
+
+ @pytest.fixture(autouse=True)
+ def mock_axis(self, request):
+ self.cc = cat.StrCategoryConverter()
+ # self.unit should be probably be replaced with real mock unit
+ self.unit = cat.UnitData()
+ self.ax = FakeAxis(self.unit)
+
+ @pytest.mark.parametrize("vals", values, ids=ids)
+ def test_convert(self, vals):
+ np.testing.assert_allclose(self.cc.convert(vals, self.ax.units,
+ self.ax),
+ range(len(vals)))
+
+ @pytest.mark.parametrize("value", ["hi", "мир"], ids=["ascii", "unicode"])
+ def test_convert_one_string(self, value):
+ assert self.cc.convert(value, self.unit, self.ax) == 0
+
+ def test_convert_one_number(self):
+ actual = self.cc.convert(0.0, self.unit, self.ax)
+ np.testing.assert_allclose(actual, np.array([0.]))
+
+ def test_convert_float_array(self):
+ data = np.array([1, 2, 3], dtype=float)
+ actual = self.cc.convert(data, self.unit, self.ax)
+ np.testing.assert_allclose(actual, np.array([1., 2., 3.]))
+
+ @pytest.mark.parametrize("fvals", fvalues, ids=fids)
+ def test_convert_fail(self, fvals):
+ with pytest.raises(TypeError):
+ self.cc.convert(fvals, self.unit, self.ax)
+
+ def test_axisinfo(self):
+ axis = self.cc.axisinfo(self.unit, self.ax)
+ assert isinstance(axis.majloc, cat.StrCategoryLocator)
+ assert isinstance(axis.majfmt, cat.StrCategoryFormatter)
+
+ def test_default_units(self):
+ assert isinstance(self.cc.default_units(["a"], self.ax), cat.UnitData)
+
+
+@pytest.fixture
+def ax():
+ return plt.figure().subplots()
+
+
+PLOT_LIST = [Axes.scatter, Axes.plot, Axes.bar]
+PLOT_IDS = ["scatter", "plot", "bar"]
+
+
+class TestStrCategoryLocator:
+ def test_StrCategoryLocator(self):
+ locs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+ unit = cat.UnitData([str(j) for j in locs])
+ ticks = cat.StrCategoryLocator(unit._mapping)
+ np.testing.assert_array_equal(ticks.tick_values(None, None), locs)
+
+ @pytest.mark.parametrize("plotter", PLOT_LIST, ids=PLOT_IDS)
+ def test_StrCategoryLocatorPlot(self, ax, plotter):
+ plotter(ax, [1, 2, 3], ["a", "b", "c"])
+ np.testing.assert_array_equal(ax.yaxis.major.locator(), range(3))
+
+
+class TestStrCategoryFormatter:
+ test_cases = [("ascii", ["hello", "world", "hi"]),
+ ("unicode", ["ЗдравÑтвуйте", "привет"])]
+
+ ids, cases = zip(*test_cases)
+
+ @pytest.mark.parametrize("ydata", cases, ids=ids)
+ def test_StrCategoryFormatter(self, ax, ydata):
+ unit = cat.UnitData(ydata)
+ labels = cat.StrCategoryFormatter(unit._mapping)
+ for i, d in enumerate(ydata):
+ assert labels(i, i) == d
+ assert labels(i, None) == d
+
+ @pytest.mark.parametrize("ydata", cases, ids=ids)
+ @pytest.mark.parametrize("plotter", PLOT_LIST, ids=PLOT_IDS)
+ def test_StrCategoryFormatterPlot(self, ax, ydata, plotter):
+ plotter(ax, range(len(ydata)), ydata)
+ for i, d in enumerate(ydata):
+ assert ax.yaxis.major.formatter(i) == d
+ assert ax.yaxis.major.formatter(i+1) == ""
+
+
+def axis_test(axis, labels):
+ ticks = list(range(len(labels)))
+ np.testing.assert_array_equal(axis.get_majorticklocs(), ticks)
+ graph_labels = [axis.major.formatter(i, i) for i in ticks]
+ # _text also decodes bytes as utf-8.
+ assert graph_labels == [cat.StrCategoryFormatter._text(l) for l in labels]
+ assert list(axis.units._mapping.keys()) == [l for l in labels]
+ assert list(axis.units._mapping.values()) == ticks
+
+
+class TestPlotBytes:
+ bytes_cases = [('string list', ['a', 'b', 'c']),
+ ('bytes list', [b'a', b'b', b'c']),
+ ('bytes ndarray', np.array([b'a', b'b', b'c']))]
+
+ bytes_ids, bytes_data = zip(*bytes_cases)
+
+ @pytest.mark.parametrize("plotter", PLOT_LIST, ids=PLOT_IDS)
+ @pytest.mark.parametrize("bdata", bytes_data, ids=bytes_ids)
+ def test_plot_bytes(self, ax, plotter, bdata):
+ counts = np.array([4, 6, 5])
+ plotter(ax, bdata, counts)
+ axis_test(ax.xaxis, bdata)
+
+
+class TestPlotNumlike:
+ numlike_cases = [('string list', ['1', '11', '3']),
+ ('string ndarray', np.array(['1', '11', '3'])),
+ ('bytes list', [b'1', b'11', b'3']),
+ ('bytes ndarray', np.array([b'1', b'11', b'3']))]
+ numlike_ids, numlike_data = zip(*numlike_cases)
+
+ @pytest.mark.parametrize("plotter", PLOT_LIST, ids=PLOT_IDS)
+ @pytest.mark.parametrize("ndata", numlike_data, ids=numlike_ids)
+ def test_plot_numlike(self, ax, plotter, ndata):
+ counts = np.array([4, 6, 5])
+ plotter(ax, ndata, counts)
+ axis_test(ax.xaxis, ndata)
+
+
+class TestPlotTypes:
+ @pytest.mark.parametrize("plotter", PLOT_LIST, ids=PLOT_IDS)
+ def test_plot_unicode(self, ax, plotter):
+ words = ['ЗдравÑтвуйте', 'привет']
+ plotter(ax, words, [0, 1])
+ axis_test(ax.xaxis, words)
+
+ @pytest.fixture
+ def test_data(self):
+ self.x = ["hello", "happy", "world"]
+ self.xy = [2, 6, 3]
+ self.y = ["Python", "is", "fun"]
+ self.yx = [3, 4, 5]
+
+ @pytest.mark.usefixtures("test_data")
+ @pytest.mark.parametrize("plotter", PLOT_LIST, ids=PLOT_IDS)
+ def test_plot_xaxis(self, ax, test_data, plotter):
+ plotter(ax, self.x, self.xy)
+ axis_test(ax.xaxis, self.x)
+
+ @pytest.mark.usefixtures("test_data")
+ @pytest.mark.parametrize("plotter", PLOT_LIST, ids=PLOT_IDS)
+ def test_plot_yaxis(self, ax, test_data, plotter):
+ plotter(ax, self.yx, self.y)
+ axis_test(ax.yaxis, self.y)
+
+ @pytest.mark.usefixtures("test_data")
+ @pytest.mark.parametrize("plotter", PLOT_LIST, ids=PLOT_IDS)
+ def test_plot_xyaxis(self, ax, test_data, plotter):
+ plotter(ax, self.x, self.y)
+ axis_test(ax.xaxis, self.x)
+ axis_test(ax.yaxis, self.y)
+
+ @pytest.mark.parametrize("plotter", PLOT_LIST, ids=PLOT_IDS)
+ def test_update_plot(self, ax, plotter):
+ plotter(ax, ['a', 'b'], ['e', 'g'])
+ plotter(ax, ['a', 'b', 'd'], ['f', 'a', 'b'])
+ plotter(ax, ['b', 'c', 'd'], ['g', 'e', 'd'])
+ axis_test(ax.xaxis, ['a', 'b', 'd', 'c'])
+ axis_test(ax.yaxis, ['e', 'g', 'f', 'a', 'b', 'd'])
+
+ failing_test_cases = [("mixed", ['A', 3.14]),
+ ("number integer", ['1', 1]),
+ ("string integer", ['42', 42]),
+ ("missing", ['12', np.nan])]
+
+ fids, fvalues = zip(*failing_test_cases)
+
+ plotters = [Axes.scatter, Axes.bar,
+ pytest.param(Axes.plot, marks=pytest.mark.xfail)]
+
+ @pytest.mark.parametrize("plotter", plotters)
+ @pytest.mark.parametrize("xdata", fvalues, ids=fids)
+ def test_mixed_type_exception(self, ax, plotter, xdata):
+ with pytest.raises(TypeError):
+ plotter(ax, xdata, [1, 2])
+
+ @pytest.mark.parametrize("plotter", plotters)
+ @pytest.mark.parametrize("xdata", fvalues, ids=fids)
+ def test_mixed_type_update_exception(self, ax, plotter, xdata):
+ with pytest.raises(TypeError):
+ plotter(ax, [0, 3], [1, 3])
+ plotter(ax, xdata, [1, 2])
+
+
+@pytest.mark.style('default')
+@check_figures_equal(extensions=["png"])
+def test_overriding_units_in_plot(fig_test, fig_ref):
+ from datetime import datetime
+
+ t0 = datetime(2018, 3, 1)
+ t1 = datetime(2018, 3, 2)
+ t2 = datetime(2018, 3, 3)
+ t3 = datetime(2018, 3, 4)
+
+ ax_test = fig_test.subplots()
+ ax_ref = fig_ref.subplots()
+ for ax, kwargs in zip([ax_test, ax_ref],
+ ({}, dict(xunits=None, yunits=None))):
+ # First call works
+ ax.plot([t0, t1], ["V1", "V2"], **kwargs)
+ x_units = ax.xaxis.units
+ y_units = ax.yaxis.units
+ # this should not raise
+ ax.plot([t2, t3], ["V1", "V2"], **kwargs)
+ # assert that we have not re-set the units attribute at all
+ assert x_units is ax.xaxis.units
+ assert y_units is ax.yaxis.units
+
+
+def test_hist():
+ fig, ax = plt.subplots()
+ n, bins, patches = ax.hist(['a', 'b', 'a', 'c', 'ff'])
+ assert n.shape == (10,)
+ np.testing.assert_allclose(n, [2., 0., 0., 1., 0., 0., 1., 0., 0., 1.])
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_cbook.py b/venv/Lib/site-packages/matplotlib/tests/test_cbook.py
new file mode 100644
index 0000000..f5651f3
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_cbook.py
@@ -0,0 +1,810 @@
+import itertools
+import pickle
+
+from weakref import ref
+from unittest.mock import patch, Mock
+
+from datetime import datetime
+
+import numpy as np
+from numpy.testing import (assert_array_equal, assert_approx_equal,
+ assert_array_almost_equal)
+import pytest
+
+from matplotlib import _api
+import matplotlib.cbook as cbook
+import matplotlib.colors as mcolors
+from matplotlib.cbook import delete_masked_points
+
+
+class Test_delete_masked_points:
+ def test_bad_first_arg(self):
+ with pytest.raises(ValueError):
+ delete_masked_points('a string', np.arange(1.0, 7.0))
+
+ def test_string_seq(self):
+ a1 = ['a', 'b', 'c', 'd', 'e', 'f']
+ a2 = [1, 2, 3, np.nan, np.nan, 6]
+ result1, result2 = delete_masked_points(a1, a2)
+ ind = [0, 1, 2, 5]
+ assert_array_equal(result1, np.array(a1)[ind])
+ assert_array_equal(result2, np.array(a2)[ind])
+
+ def test_datetime(self):
+ dates = [datetime(2008, 1, 1), datetime(2008, 1, 2),
+ datetime(2008, 1, 3), datetime(2008, 1, 4),
+ datetime(2008, 1, 5), datetime(2008, 1, 6)]
+ a_masked = np.ma.array([1, 2, 3, np.nan, np.nan, 6],
+ mask=[False, False, True, True, False, False])
+ actual = delete_masked_points(dates, a_masked)
+ ind = [0, 1, 5]
+ assert_array_equal(actual[0], np.array(dates)[ind])
+ assert_array_equal(actual[1], a_masked[ind].compressed())
+
+ def test_rgba(self):
+ a_masked = np.ma.array([1, 2, 3, np.nan, np.nan, 6],
+ mask=[False, False, True, True, False, False])
+ a_rgba = mcolors.to_rgba_array(['r', 'g', 'b', 'c', 'm', 'y'])
+ actual = delete_masked_points(a_masked, a_rgba)
+ ind = [0, 1, 5]
+ assert_array_equal(actual[0], a_masked[ind].compressed())
+ assert_array_equal(actual[1], a_rgba[ind])
+
+
+class Test_boxplot_stats:
+ def setup(self):
+ np.random.seed(937)
+ self.nrows = 37
+ self.ncols = 4
+ self.data = np.random.lognormal(size=(self.nrows, self.ncols),
+ mean=1.5, sigma=1.75)
+ self.known_keys = sorted([
+ 'mean', 'med', 'q1', 'q3', 'iqr',
+ 'cilo', 'cihi', 'whislo', 'whishi',
+ 'fliers', 'label'
+ ])
+ self.std_results = cbook.boxplot_stats(self.data)
+
+ self.known_nonbootstrapped_res = {
+ 'cihi': 6.8161283264444847,
+ 'cilo': -0.1489815330368689,
+ 'iqr': 13.492709959447094,
+ 'mean': 13.00447442387868,
+ 'med': 3.3335733967038079,
+ 'fliers': np.array([
+ 92.55467075, 87.03819018, 42.23204914, 39.29390996
+ ]),
+ 'q1': 1.3597529879465153,
+ 'q3': 14.85246294739361,
+ 'whishi': 27.899688243699629,
+ 'whislo': 0.042143774965502923
+ }
+
+ self.known_bootstrapped_ci = {
+ 'cihi': 8.939577523357828,
+ 'cilo': 1.8692703958676578,
+ }
+
+ self.known_whis3_res = {
+ 'whishi': 42.232049135969874,
+ 'whislo': 0.042143774965502923,
+ 'fliers': np.array([92.55467075, 87.03819018]),
+ }
+
+ self.known_res_percentiles = {
+ 'whislo': 0.1933685896907924,
+ 'whishi': 42.232049135969874
+ }
+
+ self.known_res_range = {
+ 'whislo': 0.042143774965502923,
+ 'whishi': 92.554670752188699
+
+ }
+
+ def test_form_main_list(self):
+ assert isinstance(self.std_results, list)
+
+ def test_form_each_dict(self):
+ for res in self.std_results:
+ assert isinstance(res, dict)
+
+ def test_form_dict_keys(self):
+ for res in self.std_results:
+ assert set(res) <= set(self.known_keys)
+
+ def test_results_baseline(self):
+ res = self.std_results[0]
+ for key, value in self.known_nonbootstrapped_res.items():
+ assert_array_almost_equal(res[key], value)
+
+ def test_results_bootstrapped(self):
+ results = cbook.boxplot_stats(self.data, bootstrap=10000)
+ res = results[0]
+ for key, value in self.known_bootstrapped_ci.items():
+ assert_approx_equal(res[key], value)
+
+ def test_results_whiskers_float(self):
+ results = cbook.boxplot_stats(self.data, whis=3)
+ res = results[0]
+ for key, value in self.known_whis3_res.items():
+ assert_array_almost_equal(res[key], value)
+
+ def test_results_whiskers_range(self):
+ results = cbook.boxplot_stats(self.data, whis=[0, 100])
+ res = results[0]
+ for key, value in self.known_res_range.items():
+ assert_array_almost_equal(res[key], value)
+
+ def test_results_whiskers_percentiles(self):
+ results = cbook.boxplot_stats(self.data, whis=[5, 95])
+ res = results[0]
+ for key, value in self.known_res_percentiles.items():
+ assert_array_almost_equal(res[key], value)
+
+ def test_results_withlabels(self):
+ labels = ['Test1', 2, 'ardvark', 4]
+ results = cbook.boxplot_stats(self.data, labels=labels)
+ for lab, res in zip(labels, results):
+ assert res['label'] == lab
+
+ results = cbook.boxplot_stats(self.data)
+ for res in results:
+ assert 'label' not in res
+
+ def test_label_error(self):
+ labels = [1, 2]
+ with pytest.raises(ValueError):
+ cbook.boxplot_stats(self.data, labels=labels)
+
+ def test_bad_dims(self):
+ data = np.random.normal(size=(34, 34, 34))
+ with pytest.raises(ValueError):
+ cbook.boxplot_stats(data)
+
+ def test_boxplot_stats_autorange_false(self):
+ x = np.zeros(shape=140)
+ x = np.hstack([-25, x, 25])
+ bstats_false = cbook.boxplot_stats(x, autorange=False)
+ bstats_true = cbook.boxplot_stats(x, autorange=True)
+
+ assert bstats_false[0]['whislo'] == 0
+ assert bstats_false[0]['whishi'] == 0
+ assert_array_almost_equal(bstats_false[0]['fliers'], [-25, 25])
+
+ assert bstats_true[0]['whislo'] == -25
+ assert bstats_true[0]['whishi'] == 25
+ assert_array_almost_equal(bstats_true[0]['fliers'], [])
+
+
+class Test_callback_registry:
+ def setup(self):
+ self.signal = 'test'
+ self.callbacks = cbook.CallbackRegistry()
+
+ def connect(self, s, func, pickle):
+ cid = self.callbacks.connect(s, func)
+ if pickle:
+ self.callbacks._pickled_cids.add(cid)
+ return cid
+
+ def disconnect(self, cid):
+ return self.callbacks.disconnect(cid)
+
+ def count(self):
+ count1 = len(self.callbacks._func_cid_map.get(self.signal, []))
+ count2 = len(self.callbacks.callbacks.get(self.signal))
+ assert count1 == count2
+ return count1
+
+ def is_empty(self):
+ assert self.callbacks._func_cid_map == {}
+ assert self.callbacks.callbacks == {}
+ assert self.callbacks._pickled_cids == set()
+
+ def is_not_empty(self):
+ assert self.callbacks._func_cid_map != {}
+ assert self.callbacks.callbacks != {}
+
+ @pytest.mark.parametrize('pickle', [True, False])
+ def test_callback_complete(self, pickle):
+ # ensure we start with an empty registry
+ self.is_empty()
+
+ # create a class for testing
+ mini_me = Test_callback_registry()
+
+ # test that we can add a callback
+ cid1 = self.connect(self.signal, mini_me.dummy, pickle)
+ assert type(cid1) == int
+ self.is_not_empty()
+
+ # test that we don't add a second callback
+ cid2 = self.connect(self.signal, mini_me.dummy, pickle)
+ assert cid1 == cid2
+ self.is_not_empty()
+ assert len(self.callbacks._func_cid_map) == 1
+ assert len(self.callbacks.callbacks) == 1
+
+ del mini_me
+
+ # check we now have no callbacks registered
+ self.is_empty()
+
+ @pytest.mark.parametrize('pickle', [True, False])
+ def test_callback_disconnect(self, pickle):
+ # ensure we start with an empty registry
+ self.is_empty()
+
+ # create a class for testing
+ mini_me = Test_callback_registry()
+
+ # test that we can add a callback
+ cid1 = self.connect(self.signal, mini_me.dummy, pickle)
+ assert type(cid1) == int
+ self.is_not_empty()
+
+ self.disconnect(cid1)
+
+ # check we now have no callbacks registered
+ self.is_empty()
+
+ @pytest.mark.parametrize('pickle', [True, False])
+ def test_callback_wrong_disconnect(self, pickle):
+ # ensure we start with an empty registry
+ self.is_empty()
+
+ # create a class for testing
+ mini_me = Test_callback_registry()
+
+ # test that we can add a callback
+ cid1 = self.connect(self.signal, mini_me.dummy, pickle)
+ assert type(cid1) == int
+ self.is_not_empty()
+
+ self.disconnect("foo")
+
+ # check we still have callbacks registered
+ self.is_not_empty()
+
+ @pytest.mark.parametrize('pickle', [True, False])
+ def test_registration_on_non_empty_registry(self, pickle):
+ # ensure we start with an empty registry
+ self.is_empty()
+
+ # setup the registry with a callback
+ mini_me = Test_callback_registry()
+ self.connect(self.signal, mini_me.dummy, pickle)
+
+ # Add another callback
+ mini_me2 = Test_callback_registry()
+ self.connect(self.signal, mini_me2.dummy, pickle)
+
+ # Remove and add the second callback
+ mini_me2 = Test_callback_registry()
+ self.connect(self.signal, mini_me2.dummy, pickle)
+
+ # We still have 2 references
+ self.is_not_empty()
+ assert self.count() == 2
+
+ # Removing the last 2 references
+ mini_me = None
+ mini_me2 = None
+ self.is_empty()
+
+ def dummy(self):
+ pass
+
+ def test_pickling(self):
+ assert hasattr(pickle.loads(pickle.dumps(cbook.CallbackRegistry())),
+ "callbacks")
+
+
+def test_callbackregistry_default_exception_handler(capsys, monkeypatch):
+ cb = cbook.CallbackRegistry()
+ cb.connect("foo", lambda: None)
+
+ monkeypatch.setattr(
+ cbook, "_get_running_interactive_framework", lambda: None)
+ with pytest.raises(TypeError):
+ cb.process("foo", "argument mismatch")
+ outerr = capsys.readouterr()
+ assert outerr.out == outerr.err == ""
+
+ monkeypatch.setattr(
+ cbook, "_get_running_interactive_framework", lambda: "not-none")
+ cb.process("foo", "argument mismatch") # No error in that case.
+ outerr = capsys.readouterr()
+ assert outerr.out == ""
+ assert "takes 0 positional arguments but 1 was given" in outerr.err
+
+
+def raising_cb_reg(func):
+ class TestException(Exception):
+ pass
+
+ def raise_runtime_error():
+ raise RuntimeError
+
+ def raise_value_error():
+ raise ValueError
+
+ def transformer(excp):
+ if isinstance(excp, RuntimeError):
+ raise TestException
+ raise excp
+
+ # old default
+ cb_old = cbook.CallbackRegistry(exception_handler=None)
+ cb_old.connect('foo', raise_runtime_error)
+
+ # filter
+ cb_filt = cbook.CallbackRegistry(exception_handler=transformer)
+ cb_filt.connect('foo', raise_runtime_error)
+
+ # filter
+ cb_filt_pass = cbook.CallbackRegistry(exception_handler=transformer)
+ cb_filt_pass.connect('foo', raise_value_error)
+
+ return pytest.mark.parametrize('cb, excp',
+ [[cb_old, RuntimeError],
+ [cb_filt, TestException],
+ [cb_filt_pass, ValueError]])(func)
+
+
+@raising_cb_reg
+def test_callbackregistry_custom_exception_handler(monkeypatch, cb, excp):
+ monkeypatch.setattr(
+ cbook, "_get_running_interactive_framework", lambda: None)
+ with pytest.raises(excp):
+ cb.process('foo')
+
+
+def test_sanitize_sequence():
+ d = {'a': 1, 'b': 2, 'c': 3}
+ k = ['a', 'b', 'c']
+ v = [1, 2, 3]
+ i = [('a', 1), ('b', 2), ('c', 3)]
+ assert k == sorted(cbook.sanitize_sequence(d.keys()))
+ assert v == sorted(cbook.sanitize_sequence(d.values()))
+ assert i == sorted(cbook.sanitize_sequence(d.items()))
+ assert i == cbook.sanitize_sequence(i)
+ assert k == cbook.sanitize_sequence(k)
+
+
+fail_mapping = (
+ ({'a': 1}, {'forbidden': ('a')}),
+ ({'a': 1}, {'required': ('b')}),
+ ({'a': 1, 'b': 2}, {'required': ('a'), 'allowed': ()}),
+ ({'a': 1, 'b': 2}, {'alias_mapping': {'a': ['b']}}),
+ ({'a': 1, 'b': 2}, {'alias_mapping': {'a': ['b']}, 'allowed': ('a',)}),
+ ({'a': 1, 'b': 2}, {'alias_mapping': {'a': ['a', 'b']}}),
+ ({'a': 1, 'b': 2, 'c': 3},
+ {'alias_mapping': {'a': ['b']}, 'required': ('a', )}),
+)
+
+pass_mapping = (
+ (None, {}, {}),
+ ({'a': 1, 'b': 2}, {'a': 1, 'b': 2}, {}),
+ ({'b': 2}, {'a': 2}, {'alias_mapping': {'a': ['a', 'b']}}),
+ ({'b': 2}, {'a': 2},
+ {'alias_mapping': {'a': ['b']}, 'forbidden': ('b', )}),
+ ({'a': 1, 'c': 3}, {'a': 1, 'c': 3},
+ {'required': ('a', ), 'allowed': ('c', )}),
+ ({'a': 1, 'c': 3}, {'a': 1, 'c': 3},
+ {'required': ('a', 'c'), 'allowed': ('c', )}),
+ ({'a': 1, 'c': 3}, {'a': 1, 'c': 3},
+ {'required': ('a', 'c'), 'allowed': ('a', 'c')}),
+ ({'a': 1, 'c': 3}, {'a': 1, 'c': 3},
+ {'required': ('a', 'c'), 'allowed': ()}),
+ ({'a': 1, 'c': 3}, {'a': 1, 'c': 3}, {'required': ('a', 'c')}),
+ ({'a': 1, 'c': 3}, {'a': 1, 'c': 3}, {'allowed': ('a', 'c')}),
+)
+
+
+@pytest.mark.parametrize('inp, kwargs_to_norm', fail_mapping)
+def test_normalize_kwargs_fail(inp, kwargs_to_norm):
+ with pytest.raises(TypeError), \
+ _api.suppress_matplotlib_deprecation_warning():
+ cbook.normalize_kwargs(inp, **kwargs_to_norm)
+
+
+@pytest.mark.parametrize('inp, expected, kwargs_to_norm',
+ pass_mapping)
+def test_normalize_kwargs_pass(inp, expected, kwargs_to_norm):
+ with _api.suppress_matplotlib_deprecation_warning():
+ # No other warning should be emitted.
+ assert expected == cbook.normalize_kwargs(inp, **kwargs_to_norm)
+
+
+def test_warn_external_frame_embedded_python():
+ with patch.object(cbook, "sys") as mock_sys:
+ mock_sys._getframe = Mock(return_value=None)
+ with pytest.warns(UserWarning, match=r"\Adummy\Z"):
+ _api.warn_external("dummy")
+
+
+def test_to_prestep():
+ x = np.arange(4)
+ y1 = np.arange(4)
+ y2 = np.arange(4)[::-1]
+
+ xs, y1s, y2s = cbook.pts_to_prestep(x, y1, y2)
+
+ x_target = np.asarray([0, 0, 1, 1, 2, 2, 3], dtype=float)
+ y1_target = np.asarray([0, 1, 1, 2, 2, 3, 3], dtype=float)
+ y2_target = np.asarray([3, 2, 2, 1, 1, 0, 0], dtype=float)
+
+ assert_array_equal(x_target, xs)
+ assert_array_equal(y1_target, y1s)
+ assert_array_equal(y2_target, y2s)
+
+ xs, y1s = cbook.pts_to_prestep(x, y1)
+ assert_array_equal(x_target, xs)
+ assert_array_equal(y1_target, y1s)
+
+
+def test_to_prestep_empty():
+ steps = cbook.pts_to_prestep([], [])
+ assert steps.shape == (2, 0)
+
+
+def test_to_poststep():
+ x = np.arange(4)
+ y1 = np.arange(4)
+ y2 = np.arange(4)[::-1]
+
+ xs, y1s, y2s = cbook.pts_to_poststep(x, y1, y2)
+
+ x_target = np.asarray([0, 1, 1, 2, 2, 3, 3], dtype=float)
+ y1_target = np.asarray([0, 0, 1, 1, 2, 2, 3], dtype=float)
+ y2_target = np.asarray([3, 3, 2, 2, 1, 1, 0], dtype=float)
+
+ assert_array_equal(x_target, xs)
+ assert_array_equal(y1_target, y1s)
+ assert_array_equal(y2_target, y2s)
+
+ xs, y1s = cbook.pts_to_poststep(x, y1)
+ assert_array_equal(x_target, xs)
+ assert_array_equal(y1_target, y1s)
+
+
+def test_to_poststep_empty():
+ steps = cbook.pts_to_poststep([], [])
+ assert steps.shape == (2, 0)
+
+
+def test_to_midstep():
+ x = np.arange(4)
+ y1 = np.arange(4)
+ y2 = np.arange(4)[::-1]
+
+ xs, y1s, y2s = cbook.pts_to_midstep(x, y1, y2)
+
+ x_target = np.asarray([0, .5, .5, 1.5, 1.5, 2.5, 2.5, 3], dtype=float)
+ y1_target = np.asarray([0, 0, 1, 1, 2, 2, 3, 3], dtype=float)
+ y2_target = np.asarray([3, 3, 2, 2, 1, 1, 0, 0], dtype=float)
+
+ assert_array_equal(x_target, xs)
+ assert_array_equal(y1_target, y1s)
+ assert_array_equal(y2_target, y2s)
+
+ xs, y1s = cbook.pts_to_midstep(x, y1)
+ assert_array_equal(x_target, xs)
+ assert_array_equal(y1_target, y1s)
+
+
+def test_to_midstep_empty():
+ steps = cbook.pts_to_midstep([], [])
+ assert steps.shape == (2, 0)
+
+
+@pytest.mark.parametrize(
+ "args",
+ [(np.arange(12).reshape(3, 4), 'a'),
+ (np.arange(12), 'a'),
+ (np.arange(12), np.arange(3))])
+def test_step_fails(args):
+ with pytest.raises(ValueError):
+ cbook.pts_to_prestep(*args)
+
+
+def test_grouper():
+ class Dummy:
+ pass
+ a, b, c, d, e = objs = [Dummy() for _ in range(5)]
+ g = cbook.Grouper()
+ g.join(*objs)
+ assert set(list(g)[0]) == set(objs)
+ assert set(g.get_siblings(a)) == set(objs)
+
+ for other in objs[1:]:
+ assert g.joined(a, other)
+
+ g.remove(a)
+ for other in objs[1:]:
+ assert not g.joined(a, other)
+
+ for A, B in itertools.product(objs[1:], objs[1:]):
+ assert g.joined(A, B)
+
+
+def test_grouper_private():
+ class Dummy:
+ pass
+ objs = [Dummy() for _ in range(5)]
+ g = cbook.Grouper()
+ g.join(*objs)
+ # reach in and touch the internals !
+ mapping = g._mapping
+
+ for o in objs:
+ assert ref(o) in mapping
+
+ base_set = mapping[ref(objs[0])]
+ for o in objs[1:]:
+ assert mapping[ref(o)] is base_set
+
+
+def test_flatiter():
+ x = np.arange(5)
+ it = x.flat
+ assert 0 == next(it)
+ assert 1 == next(it)
+ ret = cbook.safe_first_element(it)
+ assert ret == 0
+
+ assert 0 == next(it)
+ assert 1 == next(it)
+
+
+def test_reshape2d():
+
+ class Dummy:
+ pass
+
+ xnew = cbook._reshape_2D([], 'x')
+ assert np.shape(xnew) == (1, 0)
+
+ x = [Dummy() for _ in range(5)]
+
+ xnew = cbook._reshape_2D(x, 'x')
+ assert np.shape(xnew) == (1, 5)
+
+ x = np.arange(5)
+ xnew = cbook._reshape_2D(x, 'x')
+ assert np.shape(xnew) == (1, 5)
+
+ x = [[Dummy() for _ in range(5)] for _ in range(3)]
+ xnew = cbook._reshape_2D(x, 'x')
+ assert np.shape(xnew) == (3, 5)
+
+ # this is strange behaviour, but...
+ x = np.random.rand(3, 5)
+ xnew = cbook._reshape_2D(x, 'x')
+ assert np.shape(xnew) == (5, 3)
+
+ # Test a list of lists which are all of length 1
+ x = [[1], [2], [3]]
+ xnew = cbook._reshape_2D(x, 'x')
+ assert isinstance(xnew, list)
+ assert isinstance(xnew[0], np.ndarray) and xnew[0].shape == (1,)
+ assert isinstance(xnew[1], np.ndarray) and xnew[1].shape == (1,)
+ assert isinstance(xnew[2], np.ndarray) and xnew[2].shape == (1,)
+
+ # Now test with a list of lists with different lengths, which means the
+ # array will internally be converted to a 1D object array of lists
+ x = [[1, 2, 3], [3, 4], [2]]
+ xnew = cbook._reshape_2D(x, 'x')
+ assert isinstance(xnew, list)
+ assert isinstance(xnew[0], np.ndarray) and xnew[0].shape == (3,)
+ assert isinstance(xnew[1], np.ndarray) and xnew[1].shape == (2,)
+ assert isinstance(xnew[2], np.ndarray) and xnew[2].shape == (1,)
+
+ # We now need to make sure that this works correctly for Numpy subclasses
+ # where iterating over items can return subclasses too, which may be
+ # iterable even if they are scalars. To emulate this, we make a Numpy
+ # array subclass that returns Numpy 'scalars' when iterating or accessing
+ # values, and these are technically iterable if checking for example
+ # isinstance(x, collections.abc.Iterable).
+
+ class ArraySubclass(np.ndarray):
+
+ def __iter__(self):
+ for value in super().__iter__():
+ yield np.array(value)
+
+ def __getitem__(self, item):
+ return np.array(super().__getitem__(item))
+
+ v = np.arange(10, dtype=float)
+ x = ArraySubclass((10,), dtype=float, buffer=v.data)
+
+ xnew = cbook._reshape_2D(x, 'x')
+
+ # We check here that the array wasn't split up into many individual
+ # ArraySubclass, which is what used to happen due to a bug in _reshape_2D
+ assert len(xnew) == 1
+ assert isinstance(xnew[0], ArraySubclass)
+
+ # check list of strings:
+ x = ['a', 'b', 'c', 'c', 'dd', 'e', 'f', 'ff', 'f']
+ xnew = cbook._reshape_2D(x, 'x')
+ assert len(xnew[0]) == len(x)
+ assert isinstance(xnew[0], np.ndarray)
+
+
+def test_reshape2d_pandas(pd):
+ # separate to allow the rest of the tests to run if no pandas...
+ X = np.arange(30).reshape(10, 3)
+ x = pd.DataFrame(X, columns=["a", "b", "c"])
+ Xnew = cbook._reshape_2D(x, 'x')
+ # Need to check each row because _reshape_2D returns a list of arrays:
+ for x, xnew in zip(X.T, Xnew):
+ np.testing.assert_array_equal(x, xnew)
+
+ X = np.arange(30).reshape(10, 3)
+ x = pd.DataFrame(X, columns=["a", "b", "c"])
+ Xnew = cbook._reshape_2D(x, 'x')
+ # Need to check each row because _reshape_2D returns a list of arrays:
+ for x, xnew in zip(X.T, Xnew):
+ np.testing.assert_array_equal(x, xnew)
+
+
+def test_contiguous_regions():
+ a, b, c = 3, 4, 5
+ # Starts and ends with True
+ mask = [True]*a + [False]*b + [True]*c
+ expected = [(0, a), (a+b, a+b+c)]
+ assert cbook.contiguous_regions(mask) == expected
+ d, e = 6, 7
+ # Starts with True ends with False
+ mask = mask + [False]*e
+ assert cbook.contiguous_regions(mask) == expected
+ # Starts with False ends with True
+ mask = [False]*d + mask[:-e]
+ expected = [(d, d+a), (d+a+b, d+a+b+c)]
+ assert cbook.contiguous_regions(mask) == expected
+ # Starts and ends with False
+ mask = mask + [False]*e
+ assert cbook.contiguous_regions(mask) == expected
+ # No True in mask
+ assert cbook.contiguous_regions([False]*5) == []
+ # Empty mask
+ assert cbook.contiguous_regions([]) == []
+
+
+def test_safe_first_element_pandas_series(pd):
+ # deliberately create a pandas series with index not starting from 0
+ s = pd.Series(range(5), index=range(10, 15))
+ actual = cbook.safe_first_element(s)
+ assert actual == 0
+
+
+def test_warn_external(recwarn):
+ _api.warn_external("oops")
+ assert len(recwarn) == 1
+ assert recwarn[0].filename == __file__
+
+
+def test_array_patch_perimeters():
+ # This compares the old implementation as a reference for the
+ # vectorized one.
+ def check(x, rstride, cstride):
+ rows, cols = x.shape
+ row_inds = [*range(0, rows-1, rstride), rows-1]
+ col_inds = [*range(0, cols-1, cstride), cols-1]
+ polys = []
+ for rs, rs_next in zip(row_inds[:-1], row_inds[1:]):
+ for cs, cs_next in zip(col_inds[:-1], col_inds[1:]):
+ # +1 ensures we share edges between polygons
+ ps = cbook._array_perimeter(x[rs:rs_next+1, cs:cs_next+1]).T
+ polys.append(ps)
+ polys = np.asarray(polys)
+ assert np.array_equal(polys,
+ cbook._array_patch_perimeters(
+ x, rstride=rstride, cstride=cstride))
+
+ def divisors(n):
+ return [i for i in range(1, n + 1) if n % i == 0]
+
+ for rows, cols in [(5, 5), (7, 14), (13, 9)]:
+ x = np.arange(rows * cols).reshape(rows, cols)
+ for rstride, cstride in itertools.product(divisors(rows - 1),
+ divisors(cols - 1)):
+ check(x, rstride=rstride, cstride=cstride)
+
+
+def test_setattr_cm():
+ class A:
+ cls_level = object()
+ override = object()
+
+ def __init__(self):
+ self.aardvark = 'aardvark'
+ self.override = 'override'
+ self._p = 'p'
+
+ def meth(self):
+ ...
+
+ @classmethod
+ def classy(cls):
+ ...
+
+ @staticmethod
+ def static():
+ ...
+
+ @property
+ def prop(self):
+ return self._p
+
+ @prop.setter
+ def prop(self, val):
+ self._p = val
+
+ class B(A):
+ ...
+
+ other = A()
+
+ def verify_pre_post_state(obj):
+ # When you access a Python method the function is bound
+ # to the object at access time so you get a new instance
+ # of MethodType every time.
+ #
+ # https://docs.python.org/3/howto/descriptor.html#functions-and-methods
+ assert obj.meth is not obj.meth
+ # normal attribute should give you back the same instance every time
+ assert obj.aardvark is obj.aardvark
+ assert a.aardvark == 'aardvark'
+ # and our property happens to give the same instance every time
+ assert obj.prop is obj.prop
+ assert obj.cls_level is A.cls_level
+ assert obj.override == 'override'
+ assert not hasattr(obj, 'extra')
+ assert obj.prop == 'p'
+ assert obj.monkey == other.meth
+ assert obj.cls_level is A.cls_level
+ assert 'cls_level' not in obj.__dict__
+ assert 'classy' not in obj.__dict__
+ assert 'static' not in obj.__dict__
+
+ a = B()
+
+ a.monkey = other.meth
+ verify_pre_post_state(a)
+ with cbook._setattr_cm(
+ a, prop='squirrel',
+ aardvark='moose', meth=lambda: None,
+ override='boo', extra='extra',
+ monkey=lambda: None, cls_level='bob',
+ classy='classy', static='static'):
+ # because we have set a lambda, it is normal attribute access
+ # and the same every time
+ assert a.meth is a.meth
+ assert a.aardvark is a.aardvark
+ assert a.aardvark == 'moose'
+ assert a.override == 'boo'
+ assert a.extra == 'extra'
+ assert a.prop == 'squirrel'
+ assert a.monkey != other.meth
+ assert a.cls_level == 'bob'
+ assert a.classy == 'classy'
+ assert a.static == 'static'
+
+ verify_pre_post_state(a)
+
+
+def test_format_approx():
+ f = cbook._format_approx
+ assert f(0, 1) == '0'
+ assert f(0, 2) == '0'
+ assert f(0, 3) == '0'
+ assert f(-0.0123, 1) == '-0'
+ assert f(1e-7, 5) == '0'
+ assert f(0.0012345600001, 5) == '0.00123'
+ assert f(-0.0012345600001, 5) == '-0.00123'
+ assert f(0.0012345600001, 8) == f(0.0012345600001, 10) == '0.00123456'
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_collections.py b/venv/Lib/site-packages/matplotlib/tests/test_collections.py
new file mode 100644
index 0000000..d11bab7
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_collections.py
@@ -0,0 +1,870 @@
+import io
+from types import SimpleNamespace
+
+import numpy as np
+from numpy.testing import assert_array_equal, assert_array_almost_equal
+import pytest
+
+import matplotlib as mpl
+import matplotlib.pyplot as plt
+import matplotlib.collections as mcollections
+import matplotlib.colors as mcolors
+import matplotlib.transforms as mtransforms
+from matplotlib.collections import (Collection, LineCollection,
+ EventCollection, PolyCollection)
+from matplotlib.testing.decorators import check_figures_equal, image_comparison
+from matplotlib._api.deprecation import MatplotlibDeprecationWarning
+
+
+def generate_EventCollection_plot():
+ """Generate the initial collection and plot it."""
+ positions = np.array([0., 1., 2., 3., 5., 8., 13., 21.])
+ extra_positions = np.array([34., 55., 89.])
+ orientation = 'horizontal'
+ lineoffset = 1
+ linelength = .5
+ linewidth = 2
+ color = [1, 0, 0, 1]
+ linestyle = 'solid'
+ antialiased = True
+
+ coll = EventCollection(positions,
+ orientation=orientation,
+ lineoffset=lineoffset,
+ linelength=linelength,
+ linewidth=linewidth,
+ color=color,
+ linestyle=linestyle,
+ antialiased=antialiased
+ )
+
+ fig, ax = plt.subplots()
+ ax.add_collection(coll)
+ ax.set_title('EventCollection: default')
+ props = {'positions': positions,
+ 'extra_positions': extra_positions,
+ 'orientation': orientation,
+ 'lineoffset': lineoffset,
+ 'linelength': linelength,
+ 'linewidth': linewidth,
+ 'color': color,
+ 'linestyle': linestyle,
+ 'antialiased': antialiased
+ }
+ ax.set_xlim(-1, 22)
+ ax.set_ylim(0, 2)
+ return ax, coll, props
+
+
+@image_comparison(['EventCollection_plot__default'])
+def test__EventCollection__get_props():
+ _, coll, props = generate_EventCollection_plot()
+ # check that the default segments have the correct coordinates
+ check_segments(coll,
+ props['positions'],
+ props['linelength'],
+ props['lineoffset'],
+ props['orientation'])
+ # check that the default positions match the input positions
+ np.testing.assert_array_equal(props['positions'], coll.get_positions())
+ # check that the default orientation matches the input orientation
+ assert props['orientation'] == coll.get_orientation()
+ # check that the default orientation matches the input orientation
+ assert coll.is_horizontal()
+ # check that the default linelength matches the input linelength
+ assert props['linelength'] == coll.get_linelength()
+ # check that the default lineoffset matches the input lineoffset
+ assert props['lineoffset'] == coll.get_lineoffset()
+ # check that the default linestyle matches the input linestyle
+ assert coll.get_linestyle() == [(0, None)]
+ # check that the default color matches the input color
+ for color in [coll.get_color(), *coll.get_colors()]:
+ np.testing.assert_array_equal(color, props['color'])
+
+
+@image_comparison(['EventCollection_plot__set_positions'])
+def test__EventCollection__set_positions():
+ splt, coll, props = generate_EventCollection_plot()
+ new_positions = np.hstack([props['positions'], props['extra_positions']])
+ coll.set_positions(new_positions)
+ np.testing.assert_array_equal(new_positions, coll.get_positions())
+ check_segments(coll, new_positions,
+ props['linelength'],
+ props['lineoffset'],
+ props['orientation'])
+ splt.set_title('EventCollection: set_positions')
+ splt.set_xlim(-1, 90)
+
+
+@image_comparison(['EventCollection_plot__add_positions'])
+def test__EventCollection__add_positions():
+ splt, coll, props = generate_EventCollection_plot()
+ new_positions = np.hstack([props['positions'],
+ props['extra_positions'][0]])
+ coll.switch_orientation() # Test adding in the vertical orientation, too.
+ coll.add_positions(props['extra_positions'][0])
+ coll.switch_orientation()
+ np.testing.assert_array_equal(new_positions, coll.get_positions())
+ check_segments(coll,
+ new_positions,
+ props['linelength'],
+ props['lineoffset'],
+ props['orientation'])
+ splt.set_title('EventCollection: add_positions')
+ splt.set_xlim(-1, 35)
+
+
+@image_comparison(['EventCollection_plot__append_positions'])
+def test__EventCollection__append_positions():
+ splt, coll, props = generate_EventCollection_plot()
+ new_positions = np.hstack([props['positions'],
+ props['extra_positions'][2]])
+ coll.append_positions(props['extra_positions'][2])
+ np.testing.assert_array_equal(new_positions, coll.get_positions())
+ check_segments(coll,
+ new_positions,
+ props['linelength'],
+ props['lineoffset'],
+ props['orientation'])
+ splt.set_title('EventCollection: append_positions')
+ splt.set_xlim(-1, 90)
+
+
+@image_comparison(['EventCollection_plot__extend_positions'])
+def test__EventCollection__extend_positions():
+ splt, coll, props = generate_EventCollection_plot()
+ new_positions = np.hstack([props['positions'],
+ props['extra_positions'][1:]])
+ coll.extend_positions(props['extra_positions'][1:])
+ np.testing.assert_array_equal(new_positions, coll.get_positions())
+ check_segments(coll,
+ new_positions,
+ props['linelength'],
+ props['lineoffset'],
+ props['orientation'])
+ splt.set_title('EventCollection: extend_positions')
+ splt.set_xlim(-1, 90)
+
+
+@image_comparison(['EventCollection_plot__switch_orientation'])
+def test__EventCollection__switch_orientation():
+ splt, coll, props = generate_EventCollection_plot()
+ new_orientation = 'vertical'
+ coll.switch_orientation()
+ assert new_orientation == coll.get_orientation()
+ assert not coll.is_horizontal()
+ new_positions = coll.get_positions()
+ check_segments(coll,
+ new_positions,
+ props['linelength'],
+ props['lineoffset'], new_orientation)
+ splt.set_title('EventCollection: switch_orientation')
+ splt.set_ylim(-1, 22)
+ splt.set_xlim(0, 2)
+
+
+@image_comparison(['EventCollection_plot__switch_orientation__2x'])
+def test__EventCollection__switch_orientation_2x():
+ """
+ Check that calling switch_orientation twice sets the orientation back to
+ the default.
+ """
+ splt, coll, props = generate_EventCollection_plot()
+ coll.switch_orientation()
+ coll.switch_orientation()
+ new_positions = coll.get_positions()
+ assert props['orientation'] == coll.get_orientation()
+ assert coll.is_horizontal()
+ np.testing.assert_array_equal(props['positions'], new_positions)
+ check_segments(coll,
+ new_positions,
+ props['linelength'],
+ props['lineoffset'],
+ props['orientation'])
+ splt.set_title('EventCollection: switch_orientation 2x')
+
+
+@image_comparison(['EventCollection_plot__set_orientation'])
+def test__EventCollection__set_orientation():
+ splt, coll, props = generate_EventCollection_plot()
+ new_orientation = 'vertical'
+ coll.set_orientation(new_orientation)
+ assert new_orientation == coll.get_orientation()
+ assert not coll.is_horizontal()
+ check_segments(coll,
+ props['positions'],
+ props['linelength'],
+ props['lineoffset'],
+ new_orientation)
+ splt.set_title('EventCollection: set_orientation')
+ splt.set_ylim(-1, 22)
+ splt.set_xlim(0, 2)
+
+
+@image_comparison(['EventCollection_plot__set_linelength'])
+def test__EventCollection__set_linelength():
+ splt, coll, props = generate_EventCollection_plot()
+ new_linelength = 15
+ coll.set_linelength(new_linelength)
+ assert new_linelength == coll.get_linelength()
+ check_segments(coll,
+ props['positions'],
+ new_linelength,
+ props['lineoffset'],
+ props['orientation'])
+ splt.set_title('EventCollection: set_linelength')
+ splt.set_ylim(-20, 20)
+
+
+@image_comparison(['EventCollection_plot__set_lineoffset'])
+def test__EventCollection__set_lineoffset():
+ splt, coll, props = generate_EventCollection_plot()
+ new_lineoffset = -5.
+ coll.set_lineoffset(new_lineoffset)
+ assert new_lineoffset == coll.get_lineoffset()
+ check_segments(coll,
+ props['positions'],
+ props['linelength'],
+ new_lineoffset,
+ props['orientation'])
+ splt.set_title('EventCollection: set_lineoffset')
+ splt.set_ylim(-6, -4)
+
+
+@image_comparison([
+ 'EventCollection_plot__set_linestyle',
+ 'EventCollection_plot__set_linestyle',
+ 'EventCollection_plot__set_linewidth',
+])
+def test__EventCollection__set_prop():
+ for prop, value, expected in [
+ ('linestyle', 'dashed', [(0, (6.0, 6.0))]),
+ ('linestyle', (0, (6., 6.)), [(0, (6.0, 6.0))]),
+ ('linewidth', 5, 5),
+ ]:
+ splt, coll, _ = generate_EventCollection_plot()
+ coll.set(**{prop: value})
+ assert plt.getp(coll, prop) == expected
+ splt.set_title(f'EventCollection: set_{prop}')
+
+
+@image_comparison(['EventCollection_plot__set_color'])
+def test__EventCollection__set_color():
+ splt, coll, _ = generate_EventCollection_plot()
+ new_color = np.array([0, 1, 1, 1])
+ coll.set_color(new_color)
+ for color in [coll.get_color(), *coll.get_colors()]:
+ np.testing.assert_array_equal(color, new_color)
+ splt.set_title('EventCollection: set_color')
+
+
+def check_segments(coll, positions, linelength, lineoffset, orientation):
+ """
+ Test helper checking that all values in the segment are correct, given a
+ particular set of inputs.
+ """
+ segments = coll.get_segments()
+ if (orientation.lower() == 'horizontal'
+ or orientation.lower() == 'none' or orientation is None):
+ # if horizontal, the position in is in the y-axis
+ pos1 = 1
+ pos2 = 0
+ elif orientation.lower() == 'vertical':
+ # if vertical, the position in is in the x-axis
+ pos1 = 0
+ pos2 = 1
+ else:
+ raise ValueError("orientation must be 'horizontal' or 'vertical'")
+
+ # test to make sure each segment is correct
+ for i, segment in enumerate(segments):
+ assert segment[0, pos1] == lineoffset + linelength / 2
+ assert segment[1, pos1] == lineoffset - linelength / 2
+ assert segment[0, pos2] == positions[i]
+ assert segment[1, pos2] == positions[i]
+
+
+def test_null_collection_datalim():
+ col = mcollections.PathCollection([])
+ col_data_lim = col.get_datalim(mtransforms.IdentityTransform())
+ assert_array_equal(col_data_lim.get_points(),
+ mtransforms.Bbox.null().get_points())
+
+
+def test_add_collection():
+ # Test if data limits are unchanged by adding an empty collection.
+ # GitHub issue #1490, pull #1497.
+ plt.figure()
+ ax = plt.axes()
+ coll = ax.scatter([0, 1], [0, 1])
+ ax.add_collection(coll)
+ bounds = ax.dataLim.bounds
+ coll = ax.scatter([], [])
+ assert ax.dataLim.bounds == bounds
+
+
+@pytest.mark.style('mpl20')
+@check_figures_equal(extensions=['png'])
+def test_collection_log_datalim(fig_test, fig_ref):
+ # Data limits should respect the minimum x/y when using log scale.
+ x_vals = [4.38462e-6, 5.54929e-6, 7.02332e-6, 8.88889e-6, 1.12500e-5,
+ 1.42383e-5, 1.80203e-5, 2.28070e-5, 2.88651e-5, 3.65324e-5,
+ 4.62363e-5, 5.85178e-5, 7.40616e-5, 9.37342e-5, 1.18632e-4]
+ y_vals = [0.0, 0.1, 0.182, 0.332, 0.604, 1.1, 2.0, 3.64, 6.64, 12.1, 22.0,
+ 39.6, 71.3]
+
+ x, y = np.meshgrid(x_vals, y_vals)
+ x = x.flatten()
+ y = y.flatten()
+
+ ax_test = fig_test.subplots()
+ ax_test.set_xscale('log')
+ ax_test.set_yscale('log')
+ ax_test.margins = 0
+ ax_test.scatter(x, y)
+
+ ax_ref = fig_ref.subplots()
+ ax_ref.set_xscale('log')
+ ax_ref.set_yscale('log')
+ ax_ref.plot(x, y, marker="o", ls="")
+
+
+def test_quiver_limits():
+ ax = plt.axes()
+ x, y = np.arange(8), np.arange(10)
+ u = v = np.linspace(0, 10, 80).reshape(10, 8)
+ q = plt.quiver(x, y, u, v)
+ assert q.get_datalim(ax.transData).bounds == (0., 0., 7., 9.)
+
+ plt.figure()
+ ax = plt.axes()
+ x = np.linspace(-5, 10, 20)
+ y = np.linspace(-2, 4, 10)
+ y, x = np.meshgrid(y, x)
+ trans = mtransforms.Affine2D().translate(25, 32) + ax.transData
+ plt.quiver(x, y, np.sin(x), np.cos(y), transform=trans)
+ assert ax.dataLim.bounds == (20.0, 30.0, 15.0, 6.0)
+
+
+def test_barb_limits():
+ ax = plt.axes()
+ x = np.linspace(-5, 10, 20)
+ y = np.linspace(-2, 4, 10)
+ y, x = np.meshgrid(y, x)
+ trans = mtransforms.Affine2D().translate(25, 32) + ax.transData
+ plt.barbs(x, y, np.sin(x), np.cos(y), transform=trans)
+ # The calculated bounds are approximately the bounds of the original data,
+ # this is because the entire path is taken into account when updating the
+ # datalim.
+ assert_array_almost_equal(ax.dataLim.bounds, (20, 30, 15, 6),
+ decimal=1)
+
+
+@image_comparison(['EllipseCollection_test_image.png'], remove_text=True)
+def test_EllipseCollection():
+ # Test basic functionality
+ fig, ax = plt.subplots()
+ x = np.arange(4)
+ y = np.arange(3)
+ X, Y = np.meshgrid(x, y)
+ XY = np.vstack((X.ravel(), Y.ravel())).T
+
+ ww = X / x[-1]
+ hh = Y / y[-1]
+ aa = np.ones_like(ww) * 20 # first axis is 20 degrees CCW from x axis
+
+ ec = mcollections.EllipseCollection(ww, hh, aa,
+ units='x',
+ offsets=XY,
+ transOffset=ax.transData,
+ facecolors='none')
+ ax.add_collection(ec)
+ ax.autoscale_view()
+
+
+@image_comparison(['polycollection_close.png'], remove_text=True)
+def test_polycollection_close():
+ from mpl_toolkits.mplot3d import Axes3D
+
+ vertsQuad = [
+ [[0., 0.], [0., 1.], [1., 1.], [1., 0.]],
+ [[0., 1.], [2., 3.], [2., 2.], [1., 1.]],
+ [[2., 2.], [2., 3.], [4., 1.], [3., 1.]],
+ [[3., 0.], [3., 1.], [4., 1.], [4., 0.]]]
+
+ fig = plt.figure()
+ ax = fig.add_axes(Axes3D(fig, auto_add_to_figure=False))
+
+ colors = ['r', 'g', 'b', 'y', 'k']
+ zpos = list(range(5))
+
+ poly = mcollections.PolyCollection(
+ vertsQuad * len(zpos), linewidth=0.25)
+ poly.set_alpha(0.7)
+
+ # need to have a z-value for *each* polygon = element!
+ zs = []
+ cs = []
+ for z, c in zip(zpos, colors):
+ zs.extend([z] * len(vertsQuad))
+ cs.extend([c] * len(vertsQuad))
+
+ poly.set_color(cs)
+
+ ax.add_collection3d(poly, zs=zs, zdir='y')
+
+ # axis limit settings:
+ ax.set_xlim3d(0, 4)
+ ax.set_zlim3d(0, 3)
+ ax.set_ylim3d(0, 4)
+
+
+@image_comparison(['regularpolycollection_rotate.png'], remove_text=True)
+def test_regularpolycollection_rotate():
+ xx, yy = np.mgrid[:10, :10]
+ xy_points = np.transpose([xx.flatten(), yy.flatten()])
+ rotations = np.linspace(0, 2*np.pi, len(xy_points))
+
+ fig, ax = plt.subplots()
+ for xy, alpha in zip(xy_points, rotations):
+ col = mcollections.RegularPolyCollection(
+ 4, sizes=(100,), rotation=alpha,
+ offsets=[xy], transOffset=ax.transData)
+ ax.add_collection(col, autolim=True)
+ ax.autoscale_view()
+
+
+@image_comparison(['regularpolycollection_scale.png'], remove_text=True)
+def test_regularpolycollection_scale():
+ # See issue #3860
+
+ class SquareCollection(mcollections.RegularPolyCollection):
+ def __init__(self, **kwargs):
+ super().__init__(4, rotation=np.pi/4., **kwargs)
+
+ def get_transform(self):
+ """Return transform scaling circle areas to data space."""
+ ax = self.axes
+
+ pts2pixels = 72.0 / ax.figure.dpi
+
+ scale_x = pts2pixels * ax.bbox.width / ax.viewLim.width
+ scale_y = pts2pixels * ax.bbox.height / ax.viewLim.height
+ return mtransforms.Affine2D().scale(scale_x, scale_y)
+
+ fig, ax = plt.subplots()
+
+ xy = [(0, 0)]
+ # Unit square has a half-diagonal of `1/sqrt(2)`, so `pi * r**2` equals...
+ circle_areas = [np.pi / 2]
+ squares = SquareCollection(sizes=circle_areas, offsets=xy,
+ transOffset=ax.transData)
+ ax.add_collection(squares, autolim=True)
+ ax.axis([-1, 1, -1, 1])
+
+
+def test_picking():
+ fig, ax = plt.subplots()
+ col = ax.scatter([0], [0], [1000], picker=True)
+ fig.savefig(io.BytesIO(), dpi=fig.dpi)
+ mouse_event = SimpleNamespace(x=325, y=240)
+ found, indices = col.contains(mouse_event)
+ assert found
+ assert_array_equal(indices['ind'], [0])
+
+
+def test_linestyle_single_dashes():
+ plt.scatter([0, 1, 2], [0, 1, 2], linestyle=(0., [2., 2.]))
+ plt.draw()
+
+
+@image_comparison(['size_in_xy.png'], remove_text=True)
+def test_size_in_xy():
+ fig, ax = plt.subplots()
+
+ widths, heights, angles = (10, 10), 10, 0
+ widths = 10, 10
+ coords = [(10, 10), (15, 15)]
+ e = mcollections.EllipseCollection(
+ widths, heights, angles,
+ units='xy',
+ offsets=coords,
+ transOffset=ax.transData)
+
+ ax.add_collection(e)
+
+ ax.set_xlim(0, 30)
+ ax.set_ylim(0, 30)
+
+
+def test_pandas_indexing(pd):
+
+ # Should not fail break when faced with a
+ # non-zero indexed series
+ index = [11, 12, 13]
+ ec = fc = pd.Series(['red', 'blue', 'green'], index=index)
+ lw = pd.Series([1, 2, 3], index=index)
+ ls = pd.Series(['solid', 'dashed', 'dashdot'], index=index)
+ aa = pd.Series([True, False, True], index=index)
+
+ Collection(edgecolors=ec)
+ Collection(facecolors=fc)
+ Collection(linewidths=lw)
+ Collection(linestyles=ls)
+ Collection(antialiaseds=aa)
+
+
+@pytest.mark.style('default')
+def test_lslw_bcast():
+ col = mcollections.PathCollection([])
+ col.set_linestyles(['-', '-'])
+ col.set_linewidths([1, 2, 3])
+
+ assert col.get_linestyles() == [(0, None)] * 6
+ assert col.get_linewidths() == [1, 2, 3] * 2
+
+ col.set_linestyles(['-', '-', '-'])
+ assert col.get_linestyles() == [(0, None)] * 3
+ assert (col.get_linewidths() == [1, 2, 3]).all()
+
+
+@pytest.mark.style('default')
+def test_capstyle():
+ col = mcollections.PathCollection([], capstyle='round')
+ assert col.get_capstyle() == 'round'
+ col.set_capstyle('butt')
+ assert col.get_capstyle() == 'butt'
+
+
+@pytest.mark.style('default')
+def test_joinstyle():
+ col = mcollections.PathCollection([], joinstyle='round')
+ assert col.get_joinstyle() == 'round'
+ col.set_joinstyle('miter')
+ assert col.get_joinstyle() == 'miter'
+
+
+@image_comparison(['cap_and_joinstyle.png'])
+def test_cap_and_joinstyle_image():
+ fig, ax = plt.subplots()
+ ax.set_xlim([-0.5, 1.5])
+ ax.set_ylim([-0.5, 2.5])
+
+ x = np.array([0.0, 1.0, 0.5])
+ ys = np.array([[0.0], [0.5], [1.0]]) + np.array([[0.0, 0.0, 1.0]])
+
+ segs = np.zeros((3, 3, 2))
+ segs[:, :, 0] = x
+ segs[:, :, 1] = ys
+ line_segments = LineCollection(segs, linewidth=[10, 15, 20])
+ line_segments.set_capstyle("round")
+ line_segments.set_joinstyle("miter")
+
+ ax.add_collection(line_segments)
+ ax.set_title('Line collection with customized caps and joinstyle')
+
+
+@image_comparison(['scatter_post_alpha.png'],
+ remove_text=True, style='default')
+def test_scatter_post_alpha():
+ fig, ax = plt.subplots()
+ sc = ax.scatter(range(5), range(5), c=range(5))
+ sc.set_alpha(.1)
+
+
+def test_scatter_alpha_array():
+ x = np.arange(5)
+ alpha = x / 5
+ # With colormapping.
+ fig, (ax0, ax1) = plt.subplots(2)
+ sc0 = ax0.scatter(x, x, c=x, alpha=alpha)
+ sc1 = ax1.scatter(x, x, c=x)
+ sc1.set_alpha(alpha)
+ plt.draw()
+ assert_array_equal(sc0.get_facecolors()[:, -1], alpha)
+ assert_array_equal(sc1.get_facecolors()[:, -1], alpha)
+ # Without colormapping.
+ fig, (ax0, ax1) = plt.subplots(2)
+ sc0 = ax0.scatter(x, x, color=['r', 'g', 'b', 'c', 'm'], alpha=alpha)
+ sc1 = ax1.scatter(x, x, color='r', alpha=alpha)
+ plt.draw()
+ assert_array_equal(sc0.get_facecolors()[:, -1], alpha)
+ assert_array_equal(sc1.get_facecolors()[:, -1], alpha)
+ # Without colormapping, and set alpha afterward.
+ fig, (ax0, ax1) = plt.subplots(2)
+ sc0 = ax0.scatter(x, x, color=['r', 'g', 'b', 'c', 'm'])
+ sc0.set_alpha(alpha)
+ sc1 = ax1.scatter(x, x, color='r')
+ sc1.set_alpha(alpha)
+ plt.draw()
+ assert_array_equal(sc0.get_facecolors()[:, -1], alpha)
+ assert_array_equal(sc1.get_facecolors()[:, -1], alpha)
+
+
+def test_pathcollection_legend_elements():
+ np.random.seed(19680801)
+ x, y = np.random.rand(2, 10)
+ y = np.random.rand(10)
+ c = np.random.randint(0, 5, size=10)
+ s = np.random.randint(10, 300, size=10)
+
+ fig, ax = plt.subplots()
+ sc = ax.scatter(x, y, c=c, s=s, cmap="jet", marker="o", linewidths=0)
+
+ h, l = sc.legend_elements(fmt="{x:g}")
+ assert len(h) == 5
+ assert_array_equal(np.array(l).astype(float), np.arange(5))
+ colors = np.array([line.get_color() for line in h])
+ colors2 = sc.cmap(np.arange(5)/4)
+ assert_array_equal(colors, colors2)
+ l1 = ax.legend(h, l, loc=1)
+
+ h2, lab2 = sc.legend_elements(num=9)
+ assert len(h2) == 9
+ l2 = ax.legend(h2, lab2, loc=2)
+
+ h, l = sc.legend_elements(prop="sizes", alpha=0.5, color="red")
+ alpha = np.array([line.get_alpha() for line in h])
+ assert_array_equal(alpha, 0.5)
+ color = np.array([line.get_markerfacecolor() for line in h])
+ assert_array_equal(color, "red")
+ l3 = ax.legend(h, l, loc=4)
+
+ h, l = sc.legend_elements(prop="sizes", num=4, fmt="{x:.2f}",
+ func=lambda x: 2*x)
+ actsizes = [line.get_markersize() for line in h]
+ labeledsizes = np.sqrt(np.array(l).astype(float)/2)
+ assert_array_almost_equal(actsizes, labeledsizes)
+ l4 = ax.legend(h, l, loc=3)
+
+ loc = mpl.ticker.MaxNLocator(nbins=9, min_n_ticks=9-1,
+ steps=[1, 2, 2.5, 3, 5, 6, 8, 10])
+ h5, lab5 = sc.legend_elements(num=loc)
+ assert len(h2) == len(h5)
+
+ levels = [-1, 0, 55.4, 260]
+ h6, lab6 = sc.legend_elements(num=levels, prop="sizes", fmt="{x:g}")
+ assert_array_equal(np.array(lab6).astype(float), levels[2:])
+
+ for l in [l1, l2, l3, l4]:
+ ax.add_artist(l)
+
+ fig.canvas.draw()
+
+
+def test_EventCollection_nosort():
+ # Check that EventCollection doesn't modify input in place
+ arr = np.array([3, 2, 1, 10])
+ coll = EventCollection(arr)
+ np.testing.assert_array_equal(arr, np.array([3, 2, 1, 10]))
+
+
+def test_collection_set_verts_array():
+ verts = np.arange(80, dtype=np.double).reshape(10, 4, 2)
+ col_arr = PolyCollection(verts)
+ col_list = PolyCollection(list(verts))
+ assert len(col_arr._paths) == len(col_list._paths)
+ for ap, lp in zip(col_arr._paths, col_list._paths):
+ assert np.array_equal(ap._vertices, lp._vertices)
+ assert np.array_equal(ap._codes, lp._codes)
+
+ verts_tuple = np.empty(10, dtype=object)
+ verts_tuple[:] = [tuple(tuple(y) for y in x) for x in verts]
+ col_arr_tuple = PolyCollection(verts_tuple)
+ assert len(col_arr._paths) == len(col_arr_tuple._paths)
+ for ap, atp in zip(col_arr._paths, col_arr_tuple._paths):
+ assert np.array_equal(ap._vertices, atp._vertices)
+ assert np.array_equal(ap._codes, atp._codes)
+
+
+def test_blended_collection_autolim():
+ a = [1, 2, 4]
+ height = .2
+
+ xy_pairs = np.column_stack([np.repeat(a, 2), np.tile([0, height], len(a))])
+ line_segs = xy_pairs.reshape([len(a), 2, 2])
+
+ f, ax = plt.subplots()
+ trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes)
+ ax.add_collection(LineCollection(line_segs, transform=trans))
+ ax.autoscale_view(scalex=True, scaley=False)
+ np.testing.assert_allclose(ax.get_xlim(), [1., 4.])
+
+
+def test_singleton_autolim():
+ fig, ax = plt.subplots()
+ ax.scatter(0, 0)
+ np.testing.assert_allclose(ax.get_ylim(), [-0.06, 0.06])
+ np.testing.assert_allclose(ax.get_xlim(), [-0.06, 0.06])
+
+
+def test_quadmesh_set_array():
+ x = np.arange(4)
+ y = np.arange(4)
+ z = np.arange(9).reshape((3, 3))
+ fig, ax = plt.subplots()
+ coll = ax.pcolormesh(x, y, np.ones(z.shape))
+ # Test that the collection is able to update with a 2d array
+ coll.set_array(z)
+ fig.canvas.draw()
+ assert np.array_equal(coll.get_array(), z)
+
+ # Check that pre-flattened arrays work too
+ coll.set_array(np.ones(9))
+ fig.canvas.draw()
+ assert np.array_equal(coll.get_array(), np.ones(9))
+
+
+def test_quadmesh_alpha_array():
+ x = np.arange(4)
+ y = np.arange(4)
+ z = np.arange(9).reshape((3, 3))
+ alpha = z / z.max()
+ alpha_flat = alpha.ravel()
+ # Provide 2-D alpha:
+ fig, (ax0, ax1) = plt.subplots(2)
+ coll1 = ax0.pcolormesh(x, y, z, alpha=alpha)
+ coll2 = ax1.pcolormesh(x, y, z)
+ coll2.set_alpha(alpha)
+ plt.draw()
+ assert_array_equal(coll1.get_facecolors()[:, -1], alpha_flat)
+ assert_array_equal(coll2.get_facecolors()[:, -1], alpha_flat)
+ # Or provide 1-D alpha:
+ fig, (ax0, ax1) = plt.subplots(2)
+ coll1 = ax0.pcolormesh(x, y, z, alpha=alpha_flat)
+ coll2 = ax1.pcolormesh(x, y, z)
+ coll2.set_alpha(alpha_flat)
+ plt.draw()
+ assert_array_equal(coll1.get_facecolors()[:, -1], alpha_flat)
+ assert_array_equal(coll2.get_facecolors()[:, -1], alpha_flat)
+
+
+def test_alpha_validation():
+ # Most of the relevant testing is in test_artist and test_colors.
+ fig, ax = plt.subplots()
+ pc = ax.pcolormesh(np.arange(12).reshape((3, 4)))
+ with pytest.raises(ValueError, match="^Data array shape"):
+ pc.set_alpha([0.5, 0.6])
+ pc.update_scalarmappable()
+
+
+def test_legend_inverse_size_label_relationship():
+ """
+ Ensure legend markers scale appropriately when label and size are
+ inversely related.
+ Here label = 5 / size
+ """
+
+ np.random.seed(19680801)
+ X = np.random.random(50)
+ Y = np.random.random(50)
+ C = 1 - np.random.random(50)
+ S = 5 / C
+
+ legend_sizes = [0.2, 0.4, 0.6, 0.8]
+ fig, ax = plt.subplots()
+ sc = ax.scatter(X, Y, s=S)
+ handles, labels = sc.legend_elements(
+ prop='sizes', num=legend_sizes, func=lambda s: 5 / s
+ )
+
+ # Convert markersize scale to 's' scale
+ handle_sizes = [x.get_markersize() for x in handles]
+ handle_sizes = [5 / x**2 for x in handle_sizes]
+
+ assert_array_almost_equal(handle_sizes, legend_sizes, decimal=1)
+
+
+@pytest.mark.style('default')
+@pytest.mark.parametrize('pcfunc', [plt.pcolor, plt.pcolormesh])
+def test_color_logic(pcfunc):
+ z = np.arange(12).reshape(3, 4)
+ # Explicitly set an edgecolor.
+ pc = pcfunc(z, edgecolors='red', facecolors='none')
+ pc.update_scalarmappable() # This is called in draw().
+ # Define 2 reference "colors" here for multiple use.
+ face_default = mcolors.to_rgba_array(pc._get_default_facecolor())
+ mapped = pc.get_cmap()(pc.norm((z.ravel())))
+ # Github issue #1302:
+ assert mcolors.same_color(pc.get_edgecolor(), 'red')
+ # Check setting attributes after initialization:
+ pc = pcfunc(z)
+ pc.set_facecolor('none')
+ pc.set_edgecolor('red')
+ pc.update_scalarmappable()
+ assert mcolors.same_color(pc.get_facecolor(), 'none')
+ assert mcolors.same_color(pc.get_edgecolor(), [[1, 0, 0, 1]])
+ pc.set_alpha(0.5)
+ pc.update_scalarmappable()
+ assert mcolors.same_color(pc.get_edgecolor(), [[1, 0, 0, 0.5]])
+ pc.set_alpha(None) # restore default alpha
+ pc.update_scalarmappable()
+ assert mcolors.same_color(pc.get_edgecolor(), [[1, 0, 0, 1]])
+ # Reset edgecolor to default.
+ pc.set_edgecolor(None)
+ pc.update_scalarmappable()
+ assert mcolors.same_color(pc.get_edgecolor(), mapped)
+ pc.set_facecolor(None) # restore default for facecolor
+ pc.update_scalarmappable()
+ assert mcolors.same_color(pc.get_facecolor(), mapped)
+ assert mcolors.same_color(pc.get_edgecolor(), 'none')
+ # Turn off colormapping entirely:
+ pc.set_array(None)
+ pc.update_scalarmappable()
+ assert mcolors.same_color(pc.get_edgecolor(), 'none')
+ assert mcolors.same_color(pc.get_facecolor(), face_default) # not mapped
+ # Turn it back on by restoring the array (must be 1D!):
+ pc.set_array(z.ravel())
+ pc.update_scalarmappable()
+ assert mcolors.same_color(pc.get_facecolor(), mapped)
+ assert mcolors.same_color(pc.get_edgecolor(), 'none')
+ # Give color via tuple rather than string.
+ pc = pcfunc(z, edgecolors=(1, 0, 0), facecolors=(0, 1, 0))
+ pc.update_scalarmappable()
+ assert mcolors.same_color(pc.get_facecolor(), mapped)
+ assert mcolors.same_color(pc.get_edgecolor(), [[1, 0, 0, 1]])
+ # Provide an RGB array; mapping overrides it.
+ pc = pcfunc(z, edgecolors=(1, 0, 0), facecolors=np.ones((12, 3)))
+ pc.update_scalarmappable()
+ assert mcolors.same_color(pc.get_facecolor(), mapped)
+ assert mcolors.same_color(pc.get_edgecolor(), [[1, 0, 0, 1]])
+ # Turn off the mapping.
+ pc.set_array(None)
+ pc.update_scalarmappable()
+ assert mcolors.same_color(pc.get_facecolor(), np.ones((12, 3)))
+ assert mcolors.same_color(pc.get_edgecolor(), [[1, 0, 0, 1]])
+ # And an RGBA array.
+ pc = pcfunc(z, edgecolors=(1, 0, 0), facecolors=np.ones((12, 4)))
+ pc.update_scalarmappable()
+ assert mcolors.same_color(pc.get_facecolor(), mapped)
+ assert mcolors.same_color(pc.get_edgecolor(), [[1, 0, 0, 1]])
+ # Turn off the mapping.
+ pc.set_array(None)
+ pc.update_scalarmappable()
+ assert mcolors.same_color(pc.get_facecolor(), np.ones((12, 4)))
+ assert mcolors.same_color(pc.get_edgecolor(), [[1, 0, 0, 1]])
+
+
+def test_LineCollection_args():
+ with pytest.warns(MatplotlibDeprecationWarning):
+ lc = LineCollection(None, 2.2, 'r', zorder=3, facecolors=[0, 1, 0, 1])
+ assert lc.get_linewidth()[0] == 2.2
+ assert mcolors.same_color(lc.get_edgecolor(), 'r')
+ assert lc.get_zorder() == 3
+ assert mcolors.same_color(lc.get_facecolor(), [[0, 1, 0, 1]])
+ # To avoid breaking mplot3d, LineCollection internally sets the facecolor
+ # kwarg if it has not been specified. Hence we need the following test
+ # for LineCollection._set_default().
+ lc = LineCollection(None, facecolor=None)
+ assert mcolors.same_color(lc.get_facecolor(), 'none')
+
+
+def test_array_wrong_dimensions():
+ z = np.arange(12).reshape(3, 4)
+ pc = plt.pcolor(z)
+ with pytest.raises(ValueError, match="^Collections can only map"):
+ pc.set_array(z)
+ pc.update_scalarmappable()
+ pc = plt.pcolormesh(z)
+ pc.set_array(z) # 2D is OK for Quadmesh
+ pc.update_scalarmappable()
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_colorbar.py b/venv/Lib/site-packages/matplotlib/tests/test_colorbar.py
new file mode 100644
index 0000000..bbd1e9c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_colorbar.py
@@ -0,0 +1,707 @@
+import numpy as np
+import pytest
+
+from matplotlib import cm
+import matplotlib.colors as mcolors
+
+from matplotlib import rc_context
+from matplotlib.testing.decorators import image_comparison
+import matplotlib.pyplot as plt
+from matplotlib.colors import (BoundaryNorm, LogNorm, PowerNorm, Normalize,
+ TwoSlopeNorm)
+from matplotlib.colorbar import ColorbarBase, _ColorbarLogLocator
+from matplotlib.ticker import FixedLocator
+
+
+def _get_cmap_norms():
+ """
+ Define a colormap and appropriate norms for each of the four
+ possible settings of the extend keyword.
+
+ Helper function for _colorbar_extension_shape and
+ colorbar_extension_length.
+ """
+ # Create a colormap and specify the levels it represents.
+ cmap = cm.get_cmap("RdBu", lut=5)
+ clevs = [-5., -2.5, -.5, .5, 1.5, 3.5]
+ # Define norms for the colormaps.
+ norms = dict()
+ norms['neither'] = BoundaryNorm(clevs, len(clevs) - 1)
+ norms['min'] = BoundaryNorm([-10] + clevs[1:], len(clevs) - 1)
+ norms['max'] = BoundaryNorm(clevs[:-1] + [10], len(clevs) - 1)
+ norms['both'] = BoundaryNorm([-10] + clevs[1:-1] + [10], len(clevs) - 1)
+ return cmap, norms
+
+
+def _colorbar_extension_shape(spacing):
+ """
+ Produce 4 colorbars with rectangular extensions for either uniform
+ or proportional spacing.
+
+ Helper function for test_colorbar_extension_shape.
+ """
+ # Get a colormap and appropriate norms for each extension type.
+ cmap, norms = _get_cmap_norms()
+ # Create a figure and adjust whitespace for subplots.
+ fig = plt.figure()
+ fig.subplots_adjust(hspace=4)
+ for i, extension_type in enumerate(('neither', 'min', 'max', 'both')):
+ # Get the appropriate norm and use it to get colorbar boundaries.
+ norm = norms[extension_type]
+ boundaries = values = norm.boundaries
+ # note that the last value was silently dropped pre 3.3:
+ values = values[:-1]
+ # Create a subplot.
+ cax = fig.add_subplot(4, 1, i + 1)
+ # Generate the colorbar.
+ ColorbarBase(cax, cmap=cmap, norm=norm,
+ boundaries=boundaries, values=values,
+ extend=extension_type, extendrect=True,
+ orientation='horizontal', spacing=spacing)
+ # Turn off text and ticks.
+ cax.tick_params(left=False, labelleft=False,
+ bottom=False, labelbottom=False)
+ # Return the figure to the caller.
+ return fig
+
+
+def _colorbar_extension_length(spacing):
+ """
+ Produce 12 colorbars with variable length extensions for either
+ uniform or proportional spacing.
+
+ Helper function for test_colorbar_extension_length.
+ """
+ # Get a colormap and appropriate norms for each extension type.
+ cmap, norms = _get_cmap_norms()
+ # Create a figure and adjust whitespace for subplots.
+ fig = plt.figure()
+ fig.subplots_adjust(hspace=.6)
+ for i, extension_type in enumerate(('neither', 'min', 'max', 'both')):
+ # Get the appropriate norm and use it to get colorbar boundaries.
+ norm = norms[extension_type]
+ boundaries = values = norm.boundaries
+ values = values[:-1]
+ for j, extendfrac in enumerate((None, 'auto', 0.1)):
+ # Create a subplot.
+ cax = fig.add_subplot(12, 1, i*3 + j + 1)
+ # Generate the colorbar.
+ ColorbarBase(cax, cmap=cmap, norm=norm,
+ boundaries=boundaries, values=values,
+ extend=extension_type, extendfrac=extendfrac,
+ orientation='horizontal', spacing=spacing)
+ # Turn off text and ticks.
+ cax.tick_params(left=False, labelleft=False,
+ bottom=False, labelbottom=False)
+ # Return the figure to the caller.
+ return fig
+
+
+@image_comparison(['colorbar_extensions_shape_uniform.png',
+ 'colorbar_extensions_shape_proportional.png'])
+def test_colorbar_extension_shape():
+ """Test rectangular colorbar extensions."""
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ # Create figures for uniform and proportionally spaced colorbars.
+ _colorbar_extension_shape('uniform')
+ _colorbar_extension_shape('proportional')
+
+
+@image_comparison(['colorbar_extensions_uniform.png',
+ 'colorbar_extensions_proportional.png'],
+ tol=1.0)
+def test_colorbar_extension_length():
+ """Test variable length colorbar extensions."""
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ # Create figures for uniform and proportionally spaced colorbars.
+ _colorbar_extension_length('uniform')
+ _colorbar_extension_length('proportional')
+
+
+@pytest.mark.parametrize('use_gridspec', [True, False])
+@image_comparison(['cbar_with_orientation',
+ 'cbar_locationing',
+ 'double_cbar',
+ 'cbar_sharing',
+ ],
+ extensions=['png'], remove_text=True,
+ savefig_kwarg={'dpi': 40})
+def test_colorbar_positioning(use_gridspec):
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ data = np.arange(1200).reshape(30, 40)
+ levels = [0, 200, 400, 600, 800, 1000, 1200]
+
+ # -------------------
+ plt.figure()
+ plt.contourf(data, levels=levels)
+ plt.colorbar(orientation='horizontal', use_gridspec=use_gridspec)
+
+ locations = ['left', 'right', 'top', 'bottom']
+ plt.figure()
+ for i, location in enumerate(locations):
+ plt.subplot(2, 2, i + 1)
+ plt.contourf(data, levels=levels)
+ plt.colorbar(location=location, use_gridspec=use_gridspec)
+
+ # -------------------
+ plt.figure()
+ # make some other data (random integers)
+ data_2nd = np.array([[2, 3, 2, 3], [1.5, 2, 2, 3], [2, 3, 3, 4]])
+ # make the random data expand to the shape of the main data
+ data_2nd = np.repeat(np.repeat(data_2nd, 10, axis=1), 10, axis=0)
+
+ color_mappable = plt.contourf(data, levels=levels, extend='both')
+ # test extend frac here
+ hatch_mappable = plt.contourf(data_2nd, levels=[1, 2, 3], colors='none',
+ hatches=['/', 'o', '+'], extend='max')
+ plt.contour(hatch_mappable, colors='black')
+
+ plt.colorbar(color_mappable, location='left', label='variable 1',
+ use_gridspec=use_gridspec)
+ plt.colorbar(hatch_mappable, location='right', label='variable 2',
+ use_gridspec=use_gridspec)
+
+ # -------------------
+ plt.figure()
+ ax1 = plt.subplot(211, anchor='NE', aspect='equal')
+ plt.contourf(data, levels=levels)
+ ax2 = plt.subplot(223)
+ plt.contourf(data, levels=levels)
+ ax3 = plt.subplot(224)
+ plt.contourf(data, levels=levels)
+
+ plt.colorbar(ax=[ax2, ax3, ax1], location='right', pad=0.0, shrink=0.5,
+ panchor=False, use_gridspec=use_gridspec)
+ plt.colorbar(ax=[ax2, ax3, ax1], location='left', shrink=0.5,
+ panchor=False, use_gridspec=use_gridspec)
+ plt.colorbar(ax=[ax1], location='bottom', panchor=False,
+ anchor=(0.8, 0.5), shrink=0.6, use_gridspec=use_gridspec)
+
+
+@image_comparison(['cbar_with_subplots_adjust.png'], remove_text=True,
+ savefig_kwarg={'dpi': 40})
+def test_gridspec_make_colorbar():
+ plt.figure()
+ data = np.arange(1200).reshape(30, 40)
+ levels = [0, 200, 400, 600, 800, 1000, 1200]
+
+ plt.subplot(121)
+ plt.contourf(data, levels=levels)
+ plt.colorbar(use_gridspec=True, orientation='vertical')
+
+ plt.subplot(122)
+ plt.contourf(data, levels=levels)
+ plt.colorbar(use_gridspec=True, orientation='horizontal')
+
+ plt.subplots_adjust(top=0.95, right=0.95, bottom=0.2, hspace=0.25)
+
+
+@image_comparison(['colorbar_single_scatter.png'], remove_text=True,
+ savefig_kwarg={'dpi': 40})
+def test_colorbar_single_scatter():
+ # Issue #2642: if a path collection has only one entry,
+ # the norm scaling within the colorbar must ensure a
+ # finite range, otherwise a zero denominator will occur in _locate.
+ plt.figure()
+ x = y = [0]
+ z = [50]
+ cmap = plt.get_cmap('jet', 16)
+ cs = plt.scatter(x, y, z, c=z, cmap=cmap)
+ plt.colorbar(cs)
+
+
+@pytest.mark.parametrize('use_gridspec', [False, True],
+ ids=['no gridspec', 'with gridspec'])
+def test_remove_from_figure(use_gridspec):
+ """
+ Test `remove_from_figure` with the specified ``use_gridspec`` setting
+ """
+ fig, ax = plt.subplots()
+ sc = ax.scatter([1, 2], [3, 4], cmap="spring")
+ sc.set_array(np.array([5, 6]))
+ pre_position = ax.get_position()
+ cb = fig.colorbar(sc, use_gridspec=use_gridspec)
+ fig.subplots_adjust()
+ cb.remove()
+ fig.subplots_adjust()
+ post_position = ax.get_position()
+ assert (pre_position.get_points() == post_position.get_points()).all()
+
+
+def test_colorbarbase():
+ # smoke test from #3805
+ ax = plt.gca()
+ ColorbarBase(ax, cmap=plt.cm.bone)
+
+
+@image_comparison(['colorbar_closed_patch'], remove_text=True)
+def test_colorbar_closed_patch():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig = plt.figure(figsize=(8, 6))
+ ax1 = fig.add_axes([0.05, 0.85, 0.9, 0.1])
+ ax2 = fig.add_axes([0.1, 0.65, 0.75, 0.1])
+ ax3 = fig.add_axes([0.05, 0.45, 0.9, 0.1])
+ ax4 = fig.add_axes([0.05, 0.25, 0.9, 0.1])
+ ax5 = fig.add_axes([0.05, 0.05, 0.9, 0.1])
+
+ cmap = cm.get_cmap("RdBu", lut=5)
+
+ im = ax1.pcolormesh(np.linspace(0, 10, 16).reshape((4, 4)), cmap=cmap)
+
+ # The use of a "values" kwarg here is unusual. It works only
+ # because it is matched to the data range in the image and to
+ # the number of colors in the LUT.
+ values = np.linspace(0, 10, 5)
+ cbar_kw = dict(orientation='horizontal', values=values, ticks=[])
+
+ # The wide line is to show that the closed path is being handled
+ # correctly. See PR #4186.
+ with rc_context({'axes.linewidth': 16}):
+ plt.colorbar(im, cax=ax2, extend='both', extendfrac=0.5, **cbar_kw)
+ plt.colorbar(im, cax=ax3, extend='both', **cbar_kw)
+ plt.colorbar(im, cax=ax4, extend='both', extendrect=True, **cbar_kw)
+ plt.colorbar(im, cax=ax5, extend='neither', **cbar_kw)
+
+
+def test_colorbar_ticks():
+ # test fix for #5673
+ fig, ax = plt.subplots()
+ x = np.arange(-3.0, 4.001)
+ y = np.arange(-4.0, 3.001)
+ X, Y = np.meshgrid(x, y)
+ Z = X * Y
+ clevs = np.array([-12, -5, 0, 5, 12], dtype=float)
+ colors = ['r', 'g', 'b', 'c']
+ cs = ax.contourf(X, Y, Z, clevs, colors=colors, extend='neither')
+ cbar = fig.colorbar(cs, ax=ax, orientation='horizontal', ticks=clevs)
+ assert len(cbar.ax.xaxis.get_ticklocs()) == len(clevs)
+
+
+def test_colorbar_minorticks_on_off():
+ # test for github issue #11510 and PR #11584
+ np.random.seed(seed=12345)
+ data = np.random.randn(20, 20)
+ with rc_context({'_internal.classic_mode': False}):
+ fig, ax = plt.subplots()
+ # purposefully setting vmin and vmax to odd fractions
+ # so as to check for the correct locations of the minor ticks
+ im = ax.pcolormesh(data, vmin=-2.3, vmax=3.3)
+
+ cbar = fig.colorbar(im, extend='both')
+ # testing after minorticks_on()
+ cbar.minorticks_on()
+ np.testing.assert_almost_equal(
+ cbar.ax.yaxis.get_minorticklocs(),
+ [-2.2, -1.8, -1.6, -1.4, -1.2, -0.8, -0.6, -0.4, -0.2,
+ 0.2, 0.4, 0.6, 0.8, 1.2, 1.4, 1.6, 1.8, 2.2, 2.4, 2.6, 2.8, 3.2])
+ # testing after minorticks_off()
+ cbar.minorticks_off()
+ np.testing.assert_almost_equal(cbar.ax.yaxis.get_minorticklocs(), [])
+
+ im.set_clim(vmin=-1.2, vmax=1.2)
+ cbar.minorticks_on()
+ np.testing.assert_almost_equal(
+ cbar.ax.yaxis.get_minorticklocs(),
+ [-1.2, -1.1, -0.9, -0.8, -0.7, -0.6, -0.4, -0.3, -0.2, -0.1,
+ 0.1, 0.2, 0.3, 0.4, 0.6, 0.7, 0.8, 0.9, 1.1, 1.2])
+
+ # tests for github issue #13257 and PR #13265
+ data = np.random.uniform(low=1, high=10, size=(20, 20))
+
+ fig, ax = plt.subplots()
+ im = ax.pcolormesh(data, norm=LogNorm())
+ cbar = fig.colorbar(im)
+ default_minorticklocks = cbar.ax.yaxis.get_minorticklocs()
+
+ # test that minorticks turn off for LogNorm
+ cbar.minorticks_off()
+ np.testing.assert_equal(cbar.ax.yaxis.get_minorticklocs(), [])
+
+ # test that minorticks turn back on for LogNorm
+ cbar.minorticks_on()
+ np.testing.assert_equal(cbar.ax.yaxis.get_minorticklocs(),
+ default_minorticklocks)
+
+ # test issue #13339: minorticks for LogNorm should stay off
+ cbar.minorticks_off()
+ cbar.set_ticks([3, 5, 7, 9])
+ np.testing.assert_equal(cbar.ax.yaxis.get_minorticklocs(), [])
+
+
+def test_cbar_minorticks_for_rc_xyminortickvisible():
+ """
+ issue gh-16468.
+
+ Making sure that minor ticks on the colorbar are turned on
+ (internally) using the cbar.minorticks_on() method when
+ rcParams['xtick.minor.visible'] = True (for horizontal cbar)
+ rcParams['ytick.minor.visible'] = True (for vertical cbar).
+ Using cbar.minorticks_on() ensures that the minor ticks
+ don't overflow into the extend regions of the colorbar.
+ """
+
+ plt.rcParams['ytick.minor.visible'] = True
+ plt.rcParams['xtick.minor.visible'] = True
+
+ vmin, vmax = 0.4, 2.6
+ fig, ax = plt.subplots()
+ im = ax.pcolormesh([[1, 2]], vmin=vmin, vmax=vmax)
+
+ cbar = fig.colorbar(im, extend='both', orientation='vertical')
+ assert cbar.ax.yaxis.get_minorticklocs()[0] >= vmin
+ assert cbar.ax.yaxis.get_minorticklocs()[-1] <= vmax
+
+ cbar = fig.colorbar(im, extend='both', orientation='horizontal')
+ assert cbar.ax.xaxis.get_minorticklocs()[0] >= vmin
+ assert cbar.ax.xaxis.get_minorticklocs()[-1] <= vmax
+
+
+def test_colorbar_autoticks():
+ # Test new autotick modes. Needs to be classic because
+ # non-classic doesn't go this route.
+ with rc_context({'_internal.classic_mode': False}):
+ fig, ax = plt.subplots(2, 1)
+ x = np.arange(-3.0, 4.001)
+ y = np.arange(-4.0, 3.001)
+ X, Y = np.meshgrid(x, y)
+ Z = X * Y
+ Z = Z[:-1, :-1]
+ pcm = ax[0].pcolormesh(X, Y, Z)
+ cbar = fig.colorbar(pcm, ax=ax[0], extend='both',
+ orientation='vertical')
+
+ pcm = ax[1].pcolormesh(X, Y, Z)
+ cbar2 = fig.colorbar(pcm, ax=ax[1], extend='both',
+ orientation='vertical', shrink=0.4)
+ np.testing.assert_almost_equal(cbar.ax.yaxis.get_ticklocs(),
+ np.arange(-10, 11, 5))
+ np.testing.assert_almost_equal(cbar2.ax.yaxis.get_ticklocs(),
+ np.arange(-10, 11, 10))
+
+
+def test_colorbar_autotickslog():
+ # Test new autotick modes...
+ with rc_context({'_internal.classic_mode': False}):
+ fig, ax = plt.subplots(2, 1)
+ x = np.arange(-3.0, 4.001)
+ y = np.arange(-4.0, 3.001)
+ X, Y = np.meshgrid(x, y)
+ Z = X * Y
+ Z = Z[:-1, :-1]
+ pcm = ax[0].pcolormesh(X, Y, 10**Z, norm=LogNorm())
+ cbar = fig.colorbar(pcm, ax=ax[0], extend='both',
+ orientation='vertical')
+
+ pcm = ax[1].pcolormesh(X, Y, 10**Z, norm=LogNorm())
+ cbar2 = fig.colorbar(pcm, ax=ax[1], extend='both',
+ orientation='vertical', shrink=0.4)
+ np.testing.assert_almost_equal(cbar.ax.yaxis.get_ticklocs(),
+ 10**np.arange(-12., 12.2, 4.))
+ np.testing.assert_almost_equal(cbar2.ax.yaxis.get_ticklocs(),
+ 10**np.arange(-12., 13., 12.))
+
+
+def test_colorbar_get_ticks():
+ # test feature for #5792
+ plt.figure()
+ data = np.arange(1200).reshape(30, 40)
+ levels = [0, 200, 400, 600, 800, 1000, 1200]
+
+ plt.contourf(data, levels=levels)
+
+ # testing getter for user set ticks
+ userTicks = plt.colorbar(ticks=[0, 600, 1200])
+ assert userTicks.get_ticks().tolist() == [0, 600, 1200]
+
+ # testing for getter after calling set_ticks
+ userTicks.set_ticks([600, 700, 800])
+ assert userTicks.get_ticks().tolist() == [600, 700, 800]
+
+ # testing for getter after calling set_ticks with some ticks out of bounds
+ userTicks.set_ticks([600, 1300, 1400, 1500])
+ assert userTicks.get_ticks().tolist() == [600]
+
+ # testing getter when no ticks are assigned
+ defTicks = plt.colorbar(orientation='horizontal')
+ assert defTicks.get_ticks().tolist() == levels
+
+
+def test_colorbar_lognorm_extension():
+ # Test that colorbar with lognorm is extended correctly
+ f, ax = plt.subplots()
+ cb = ColorbarBase(ax, norm=LogNorm(vmin=0.1, vmax=1000.0),
+ orientation='vertical', extend='both')
+ assert cb._values[0] >= 0.0
+
+
+def test_colorbar_powernorm_extension():
+ # Test that colorbar with powernorm is extended correctly
+ f, ax = plt.subplots()
+ cb = ColorbarBase(ax, norm=PowerNorm(gamma=0.5, vmin=0.0, vmax=1.0),
+ orientation='vertical', extend='both')
+ assert cb._values[0] >= 0.0
+
+
+def test_colorbar_axes_kw():
+ # test fix for #8493: This does only test, that axes-related keywords pass
+ # and do not raise an exception.
+ plt.figure()
+ plt.imshow([[1, 2], [3, 4]])
+ plt.colorbar(orientation='horizontal', fraction=0.2, pad=0.2, shrink=0.5,
+ aspect=10, anchor=(0., 0.), panchor=(0., 1.))
+
+
+def test_colorbar_log_minortick_labels():
+ with rc_context({'_internal.classic_mode': False}):
+ fig, ax = plt.subplots()
+ pcm = ax.imshow([[10000, 50000]], norm=LogNorm())
+ cb = fig.colorbar(pcm)
+ fig.canvas.draw()
+ lb = cb.ax.yaxis.get_ticklabels(which='both')
+ expected = [r'$\mathdefault{10^{4}}$',
+ r'$\mathdefault{2\times10^{4}}$',
+ r'$\mathdefault{3\times10^{4}}$',
+ r'$\mathdefault{4\times10^{4}}$']
+ for l, exp in zip(lb, expected):
+ assert l.get_text() == exp
+
+
+def test_colorbar_renorm():
+ x, y = np.ogrid[-4:4:31j, -4:4:31j]
+ z = 120000*np.exp(-x**2 - y**2)
+
+ fig, ax = plt.subplots()
+ im = ax.imshow(z)
+ cbar = fig.colorbar(im)
+ np.testing.assert_allclose(cbar.ax.yaxis.get_majorticklocs(),
+ np.arange(0, 120000.1, 15000))
+
+ cbar.set_ticks([1, 2, 3])
+ assert isinstance(cbar.locator, FixedLocator)
+
+ norm = LogNorm(z.min(), z.max())
+ im.set_norm(norm)
+ assert isinstance(cbar.locator, _ColorbarLogLocator)
+ np.testing.assert_allclose(cbar.ax.yaxis.get_majorticklocs(),
+ np.logspace(-8, 5, 14))
+ # note that set_norm removes the FixedLocator...
+ assert np.isclose(cbar.vmin, z.min())
+ cbar.set_ticks([1, 2, 3])
+ assert isinstance(cbar.locator, FixedLocator)
+ np.testing.assert_allclose(cbar.ax.yaxis.get_majorticklocs(),
+ [1.0, 2.0, 3.0])
+
+ norm = LogNorm(z.min() * 1000, z.max() * 1000)
+ im.set_norm(norm)
+ assert np.isclose(cbar.vmin, z.min() * 1000)
+ assert np.isclose(cbar.vmax, z.max() * 1000)
+
+
+def test_colorbar_format():
+ # make sure that format is passed properly
+ x, y = np.ogrid[-4:4:31j, -4:4:31j]
+ z = 120000*np.exp(-x**2 - y**2)
+
+ fig, ax = plt.subplots()
+ im = ax.imshow(z)
+ cbar = fig.colorbar(im, format='%4.2e')
+ fig.canvas.draw()
+ assert cbar.ax.yaxis.get_ticklabels()[4].get_text() == '6.00e+04'
+
+ # make sure that if we change the clim of the mappable that the
+ # formatting is *not* lost:
+ im.set_clim([4, 200])
+ fig.canvas.draw()
+ assert cbar.ax.yaxis.get_ticklabels()[4].get_text() == '8.00e+01'
+
+ # but if we change the norm:
+ im.set_norm(LogNorm(vmin=0.1, vmax=10))
+ fig.canvas.draw()
+ assert (cbar.ax.yaxis.get_ticklabels()[0].get_text() ==
+ r'$\mathdefault{10^{-1}}$')
+
+
+def test_colorbar_scale_reset():
+ x, y = np.ogrid[-4:4:31j, -4:4:31j]
+ z = 120000*np.exp(-x**2 - y**2)
+
+ fig, ax = plt.subplots()
+ pcm = ax.pcolormesh(z, cmap='RdBu_r', rasterized=True)
+ cbar = fig.colorbar(pcm, ax=ax)
+ cbar.outline.set_edgecolor('red')
+ assert cbar.ax.yaxis.get_scale() == 'linear'
+
+ pcm.set_norm(LogNorm(vmin=1, vmax=100))
+ assert cbar.ax.yaxis.get_scale() == 'log'
+ pcm.set_norm(Normalize(vmin=-20, vmax=20))
+ assert cbar.ax.yaxis.get_scale() == 'linear'
+
+ assert cbar.outline.get_edgecolor() == mcolors.to_rgba('red')
+
+
+def test_colorbar_get_ticks_2():
+ plt.rcParams['_internal.classic_mode'] = False
+ fig, ax = plt.subplots()
+ pc = ax.pcolormesh([[.05, .95]])
+ cb = fig.colorbar(pc)
+ np.testing.assert_allclose(cb.get_ticks(), [0.2, 0.4, 0.6, 0.8])
+
+
+def test_colorbar_inverted_ticks():
+ fig, axs = plt.subplots(2)
+ ax = axs[0]
+ pc = ax.pcolormesh(10**np.arange(1, 5).reshape(2, 2), norm=LogNorm())
+ cbar = fig.colorbar(pc, ax=ax, extend='both')
+ ticks = cbar.get_ticks()
+ cbar.ax.invert_yaxis()
+ np.testing.assert_allclose(ticks, cbar.get_ticks())
+
+ ax = axs[1]
+ pc = ax.pcolormesh(np.arange(1, 5).reshape(2, 2))
+ cbar = fig.colorbar(pc, ax=ax, extend='both')
+ cbar.minorticks_on()
+ ticks = cbar.get_ticks()
+ minorticks = cbar.get_ticks(minor=True)
+ cbar.ax.invert_yaxis()
+ np.testing.assert_allclose(ticks, cbar.get_ticks())
+ np.testing.assert_allclose(minorticks, cbar.get_ticks(minor=True))
+
+
+def test_extend_colorbar_customnorm():
+ # This was a funny error with TwoSlopeNorm, maybe with other norms,
+ # when extend='both'
+ fig, (ax0, ax1) = plt.subplots(2, 1)
+ pcm = ax0.pcolormesh([[0]], norm=TwoSlopeNorm(vcenter=0., vmin=-2, vmax=1))
+ cb = fig.colorbar(pcm, ax=ax0, extend='both')
+ np.testing.assert_allclose(cb.ax.get_position().extents,
+ [0.78375, 0.536364, 0.796147, 0.9], rtol=1e-3)
+
+
+def test_mappable_no_alpha():
+ fig, ax = plt.subplots()
+ sm = cm.ScalarMappable(norm=mcolors.Normalize(), cmap='viridis')
+ fig.colorbar(sm)
+ sm.set_cmap('plasma')
+ plt.draw()
+
+
+def test_colorbar_label():
+ """
+ Test the label parameter. It should just be mapped to the xlabel/ylabel of
+ the axes, depending on the orientation.
+ """
+ fig, ax = plt.subplots()
+ im = ax.imshow([[1, 2], [3, 4]])
+ cbar = fig.colorbar(im, label='cbar')
+ assert cbar.ax.get_ylabel() == 'cbar'
+ cbar.set_label(None)
+ assert cbar.ax.get_ylabel() == ''
+ cbar.set_label('cbar 2')
+ assert cbar.ax.get_ylabel() == 'cbar 2'
+
+ cbar2 = fig.colorbar(im, label=None)
+ assert cbar2.ax.get_ylabel() == ''
+
+ cbar3 = fig.colorbar(im, orientation='horizontal', label='horizontal cbar')
+ assert cbar3.ax.get_xlabel() == 'horizontal cbar'
+
+
+@pytest.mark.parametrize("clim", [(-20000, 20000), (-32768, 0)])
+def test_colorbar_int(clim):
+ # Check that we cast to float early enough to not
+ # overflow ``int16(20000) - int16(-20000)`` or
+ # run into ``abs(int16(-32768)) == -32768``.
+ fig, ax = plt.subplots()
+ im = ax.imshow([[*map(np.int16, clim)]])
+ fig.colorbar(im)
+ assert (im.norm.vmin, im.norm.vmax) == clim
+
+
+def test_anchored_cbar_position_using_specgrid():
+ data = np.arange(1200).reshape(30, 40)
+ levels = [0, 200, 400, 600, 800, 1000, 1200]
+ shrink = 0.5
+ anchor_y = 0.3
+ # right
+ fig, ax = plt.subplots()
+ cs = ax.contourf(data, levels=levels)
+ cbar = plt.colorbar(
+ cs, ax=ax, use_gridspec=True,
+ location='right', anchor=(1, anchor_y), shrink=shrink)
+
+ # the bottom left corner of one ax is (x0, y0)
+ # the top right corner of one ax is (x1, y1)
+ # p0: the vertical / horizontal position of anchor
+ x0, y0, x1, y1 = ax.get_position().extents
+ cx0, cy0, cx1, cy1 = cbar.ax.get_position().extents
+ p0 = (y1 - y0) * anchor_y + y0
+
+ np.testing.assert_allclose(
+ [cy1, cy0],
+ [y1 * shrink + (1 - shrink) * p0, p0 * (1 - shrink) + y0 * shrink])
+
+ # left
+ fig, ax = plt.subplots()
+ cs = ax.contourf(data, levels=levels)
+ cbar = plt.colorbar(
+ cs, ax=ax, use_gridspec=True,
+ location='left', anchor=(1, anchor_y), shrink=shrink)
+
+ # the bottom left corner of one ax is (x0, y0)
+ # the top right corner of one ax is (x1, y1)
+ # p0: the vertical / horizontal position of anchor
+ x0, y0, x1, y1 = ax.get_position().extents
+ cx0, cy0, cx1, cy1 = cbar.ax.get_position().extents
+ p0 = (y1 - y0) * anchor_y + y0
+
+ np.testing.assert_allclose(
+ [cy1, cy0],
+ [y1 * shrink + (1 - shrink) * p0, p0 * (1 - shrink) + y0 * shrink])
+
+ # top
+ shrink = 0.5
+ anchor_x = 0.3
+ fig, ax = plt.subplots()
+ cs = ax.contourf(data, levels=levels)
+ cbar = plt.colorbar(
+ cs, ax=ax, use_gridspec=True,
+ location='top', anchor=(anchor_x, 1), shrink=shrink)
+
+ # the bottom left corner of one ax is (x0, y0)
+ # the top right corner of one ax is (x1, y1)
+ # p0: the vertical / horizontal position of anchor
+ x0, y0, x1, y1 = ax.get_position().extents
+ cx0, cy0, cx1, cy1 = cbar.ax.get_position().extents
+ p0 = (x1 - x0) * anchor_x + x0
+
+ np.testing.assert_allclose(
+ [cx1, cx0],
+ [x1 * shrink + (1 - shrink) * p0, p0 * (1 - shrink) + x0 * shrink])
+
+ # bottom
+ shrink = 0.5
+ anchor_x = 0.3
+ fig, ax = plt.subplots()
+ cs = ax.contourf(data, levels=levels)
+ cbar = plt.colorbar(
+ cs, ax=ax, use_gridspec=True,
+ location='bottom', anchor=(anchor_x, 1), shrink=shrink)
+
+ # the bottom left corner of one ax is (x0, y0)
+ # the top right corner of one ax is (x1, y1)
+ # p0: the vertical / horizontal position of anchor
+ x0, y0, x1, y1 = ax.get_position().extents
+ cx0, cy0, cx1, cy1 = cbar.ax.get_position().extents
+ p0 = (x1 - x0) * anchor_x + x0
+
+ np.testing.assert_allclose(
+ [cx1, cx0],
+ [x1 * shrink + (1 - shrink) * p0, p0 * (1 - shrink) + x0 * shrink])
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_colors.py b/venv/Lib/site-packages/matplotlib/tests/test_colors.py
new file mode 100644
index 0000000..04ad73b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_colors.py
@@ -0,0 +1,1388 @@
+import copy
+import itertools
+
+from io import BytesIO
+import numpy as np
+from PIL import Image
+import pytest
+import base64
+
+from numpy.testing import assert_array_equal, assert_array_almost_equal
+
+from matplotlib import cycler
+import matplotlib
+import matplotlib.colors as mcolors
+import matplotlib.cm as cm
+import matplotlib.colorbar as mcolorbar
+import matplotlib.cbook as cbook
+import matplotlib.pyplot as plt
+import matplotlib.scale as mscale
+from matplotlib.testing.decorators import image_comparison
+
+
+@pytest.mark.parametrize('N, result', [
+ (5, [1, .6, .2, .1, 0]),
+ (2, [1, 0]),
+ (1, [0]),
+])
+def test_create_lookup_table(N, result):
+ data = [(0.0, 1.0, 1.0), (0.5, 0.2, 0.2), (1.0, 0.0, 0.0)]
+ assert_array_almost_equal(mcolors._create_lookup_table(N, data), result)
+
+
+def test_resample():
+ """
+ GitHub issue #6025 pointed to incorrect ListedColormap._resample;
+ here we test the method for LinearSegmentedColormap as well.
+ """
+ n = 101
+ colorlist = np.empty((n, 4), float)
+ colorlist[:, 0] = np.linspace(0, 1, n)
+ colorlist[:, 1] = 0.2
+ colorlist[:, 2] = np.linspace(1, 0, n)
+ colorlist[:, 3] = 0.7
+ lsc = mcolors.LinearSegmentedColormap.from_list('lsc', colorlist)
+ lc = mcolors.ListedColormap(colorlist)
+ # Set some bad values for testing too
+ for cmap in [lsc, lc]:
+ cmap.set_under('r')
+ cmap.set_over('g')
+ cmap.set_bad('b')
+ lsc3 = lsc._resample(3)
+ lc3 = lc._resample(3)
+ expected = np.array([[0.0, 0.2, 1.0, 0.7],
+ [0.5, 0.2, 0.5, 0.7],
+ [1.0, 0.2, 0.0, 0.7]], float)
+ assert_array_almost_equal(lsc3([0, 0.5, 1]), expected)
+ assert_array_almost_equal(lc3([0, 0.5, 1]), expected)
+ # Test over/under was copied properly
+ assert_array_almost_equal(lsc(np.inf), lsc3(np.inf))
+ assert_array_almost_equal(lsc(-np.inf), lsc3(-np.inf))
+ assert_array_almost_equal(lsc(np.nan), lsc3(np.nan))
+ assert_array_almost_equal(lc(np.inf), lc3(np.inf))
+ assert_array_almost_equal(lc(-np.inf), lc3(-np.inf))
+ assert_array_almost_equal(lc(np.nan), lc3(np.nan))
+
+
+def test_register_cmap():
+ new_cm = copy.copy(cm.get_cmap("viridis"))
+ target = "viridis2"
+ cm.register_cmap(target, new_cm)
+ assert plt.get_cmap(target) == new_cm
+
+ with pytest.raises(ValueError,
+ match="Arguments must include a name or a Colormap"):
+ cm.register_cmap()
+
+ with pytest.warns(UserWarning):
+ cm.register_cmap(target, new_cm)
+
+ cm.unregister_cmap(target)
+ with pytest.raises(ValueError,
+ match=f'{target!r} is not a valid value for name;'):
+ cm.get_cmap(target)
+ # test that second time is error free
+ cm.unregister_cmap(target)
+
+ with pytest.raises(ValueError, match="You must pass a Colormap instance."):
+ cm.register_cmap('nome', cmap='not a cmap')
+
+
+def test_double_register_builtin_cmap():
+ name = "viridis"
+ match = f"Trying to re-register the builtin cmap {name!r}."
+ with pytest.raises(ValueError, match=match):
+ cm.register_cmap(name, cm.get_cmap(name))
+ with pytest.warns(UserWarning):
+ cm.register_cmap(name, cm.get_cmap(name), override_builtin=True)
+
+
+def test_unregister_builtin_cmap():
+ name = "viridis"
+ match = f'cannot unregister {name!r} which is a builtin colormap.'
+ with pytest.raises(ValueError, match=match):
+ cm.unregister_cmap(name)
+
+
+def test_colormap_global_set_warn():
+ new_cm = plt.get_cmap('viridis')
+ # Store the old value so we don't override the state later on.
+ orig_cmap = copy.copy(new_cm)
+ with pytest.warns(cbook.MatplotlibDeprecationWarning,
+ match="You are modifying the state of a globally"):
+ # This should warn now because we've modified the global state
+ new_cm.set_under('k')
+
+ # This shouldn't warn because it is a copy
+ copy.copy(new_cm).set_under('b')
+
+ # Test that registering and then modifying warns
+ plt.register_cmap(name='test_cm', cmap=copy.copy(orig_cmap))
+ new_cm = plt.get_cmap('test_cm')
+ with pytest.warns(cbook.MatplotlibDeprecationWarning,
+ match="You are modifying the state of a globally"):
+ # This should warn now because we've modified the global state
+ new_cm.set_under('k')
+
+ # Re-register the original
+ with pytest.warns(UserWarning):
+ plt.register_cmap(cmap=orig_cmap, override_builtin=True)
+
+
+def test_colormap_dict_deprecate():
+ # Make sure we warn on get and set access into cmap_d
+ with pytest.warns(cbook.MatplotlibDeprecationWarning,
+ match="The global colormaps dictionary is no longer"):
+ cmap = plt.cm.cmap_d['viridis']
+
+ with pytest.warns(cbook.MatplotlibDeprecationWarning,
+ match="The global colormaps dictionary is no longer"):
+ plt.cm.cmap_d['test'] = cmap
+
+
+def test_colormap_copy():
+ cmap = plt.cm.Reds
+ copied_cmap = copy.copy(cmap)
+ with np.errstate(invalid='ignore'):
+ ret1 = copied_cmap([-1, 0, .5, 1, np.nan, np.inf])
+ cmap2 = copy.copy(copied_cmap)
+ cmap2.set_bad('g')
+ with np.errstate(invalid='ignore'):
+ ret2 = copied_cmap([-1, 0, .5, 1, np.nan, np.inf])
+ assert_array_equal(ret1, ret2)
+ # again with the .copy method:
+ cmap = plt.cm.Reds
+ copied_cmap = cmap.copy()
+ with np.errstate(invalid='ignore'):
+ ret1 = copied_cmap([-1, 0, .5, 1, np.nan, np.inf])
+ cmap2 = copy.copy(copied_cmap)
+ cmap2.set_bad('g')
+ with np.errstate(invalid='ignore'):
+ ret2 = copied_cmap([-1, 0, .5, 1, np.nan, np.inf])
+ assert_array_equal(ret1, ret2)
+
+
+def test_colormap_endian():
+ """
+ GitHub issue #1005: a bug in putmask caused erroneous
+ mapping of 1.0 when input from a non-native-byteorder
+ array.
+ """
+ cmap = cm.get_cmap("jet")
+ # Test under, over, and invalid along with values 0 and 1.
+ a = [-0.5, 0, 0.5, 1, 1.5, np.nan]
+ for dt in ["f2", "f4", "f8"]:
+ anative = np.ma.masked_invalid(np.array(a, dtype=dt))
+ aforeign = anative.byteswap().newbyteorder()
+ assert_array_equal(cmap(anative), cmap(aforeign))
+
+
+def test_colormap_invalid():
+ """
+ GitHub issue #9892: Handling of nan's were getting mapped to under
+ rather than bad. This tests to make sure all invalid values
+ (-inf, nan, inf) are mapped respectively to (under, bad, over).
+ """
+ cmap = cm.get_cmap("plasma")
+ x = np.array([-np.inf, -1, 0, np.nan, .7, 2, np.inf])
+
+ expected = np.array([[0.050383, 0.029803, 0.527975, 1.],
+ [0.050383, 0.029803, 0.527975, 1.],
+ [0.050383, 0.029803, 0.527975, 1.],
+ [0., 0., 0., 0.],
+ [0.949217, 0.517763, 0.295662, 1.],
+ [0.940015, 0.975158, 0.131326, 1.],
+ [0.940015, 0.975158, 0.131326, 1.]])
+ assert_array_equal(cmap(x), expected)
+
+ # Test masked representation (-inf, inf) are now masked
+ expected = np.array([[0., 0., 0., 0.],
+ [0.050383, 0.029803, 0.527975, 1.],
+ [0.050383, 0.029803, 0.527975, 1.],
+ [0., 0., 0., 0.],
+ [0.949217, 0.517763, 0.295662, 1.],
+ [0.940015, 0.975158, 0.131326, 1.],
+ [0., 0., 0., 0.]])
+ assert_array_equal(cmap(np.ma.masked_invalid(x)), expected)
+
+ # Test scalar representations
+ assert_array_equal(cmap(-np.inf), cmap(0))
+ assert_array_equal(cmap(np.inf), cmap(1.0))
+ assert_array_equal(cmap(np.nan), np.array([0., 0., 0., 0.]))
+
+
+def test_colormap_return_types():
+ """
+ Make sure that tuples are returned for scalar input and
+ that the proper shapes are returned for ndarrays.
+ """
+ cmap = cm.get_cmap("plasma")
+ # Test return types and shapes
+ # scalar input needs to return a tuple of length 4
+ assert isinstance(cmap(0.5), tuple)
+ assert len(cmap(0.5)) == 4
+
+ # input array returns an ndarray of shape x.shape + (4,)
+ x = np.ones(4)
+ assert cmap(x).shape == x.shape + (4,)
+
+ # multi-dimensional array input
+ x2d = np.zeros((2, 2))
+ assert cmap(x2d).shape == x2d.shape + (4,)
+
+
+def test_BoundaryNorm():
+ """
+ GitHub issue #1258: interpolation was failing with numpy
+ 1.7 pre-release.
+ """
+
+ boundaries = [0, 1.1, 2.2]
+ vals = [-1, 0, 1, 2, 2.2, 4]
+
+ # Without interpolation
+ expected = [-1, 0, 0, 1, 2, 2]
+ ncolors = len(boundaries) - 1
+ bn = mcolors.BoundaryNorm(boundaries, ncolors)
+ assert_array_equal(bn(vals), expected)
+
+ # ncolors != len(boundaries) - 1 triggers interpolation
+ expected = [-1, 0, 0, 2, 3, 3]
+ ncolors = len(boundaries)
+ bn = mcolors.BoundaryNorm(boundaries, ncolors)
+ assert_array_equal(bn(vals), expected)
+
+ # with a single region and interpolation
+ expected = [-1, 1, 1, 1, 3, 3]
+ bn = mcolors.BoundaryNorm([0, 2.2], ncolors)
+ assert_array_equal(bn(vals), expected)
+
+ # more boundaries for a third color
+ boundaries = [0, 1, 2, 3]
+ vals = [-1, 0.1, 1.1, 2.2, 4]
+ ncolors = 5
+ expected = [-1, 0, 2, 4, 5]
+ bn = mcolors.BoundaryNorm(boundaries, ncolors)
+ assert_array_equal(bn(vals), expected)
+
+ # a scalar as input should not trigger an error and should return a scalar
+ boundaries = [0, 1, 2]
+ vals = [-1, 0.1, 1.1, 2.2]
+ bn = mcolors.BoundaryNorm(boundaries, 2)
+ expected = [-1, 0, 1, 2]
+ for v, ex in zip(vals, expected):
+ ret = bn(v)
+ assert isinstance(ret, int)
+ assert_array_equal(ret, ex)
+ assert_array_equal(bn([v]), ex)
+
+ # same with interp
+ bn = mcolors.BoundaryNorm(boundaries, 3)
+ expected = [-1, 0, 2, 3]
+ for v, ex in zip(vals, expected):
+ ret = bn(v)
+ assert isinstance(ret, int)
+ assert_array_equal(ret, ex)
+ assert_array_equal(bn([v]), ex)
+
+ # Clipping
+ bn = mcolors.BoundaryNorm(boundaries, 3, clip=True)
+ expected = [0, 0, 2, 2]
+ for v, ex in zip(vals, expected):
+ ret = bn(v)
+ assert isinstance(ret, int)
+ assert_array_equal(ret, ex)
+ assert_array_equal(bn([v]), ex)
+
+ # Masked arrays
+ boundaries = [0, 1.1, 2.2]
+ vals = np.ma.masked_invalid([-1., np.NaN, 0, 1.4, 9])
+
+ # Without interpolation
+ ncolors = len(boundaries) - 1
+ bn = mcolors.BoundaryNorm(boundaries, ncolors)
+ expected = np.ma.masked_array([-1, -99, 0, 1, 2], mask=[0, 1, 0, 0, 0])
+ assert_array_equal(bn(vals), expected)
+
+ # With interpolation
+ bn = mcolors.BoundaryNorm(boundaries, len(boundaries))
+ expected = np.ma.masked_array([-1, -99, 0, 2, 3], mask=[0, 1, 0, 0, 0])
+ assert_array_equal(bn(vals), expected)
+
+ # Non-trivial masked arrays
+ vals = np.ma.masked_invalid([np.Inf, np.NaN])
+ assert np.all(bn(vals).mask)
+ vals = np.ma.masked_invalid([np.Inf])
+ assert np.all(bn(vals).mask)
+
+ # Incompatible extend and clip
+ with pytest.raises(ValueError, match="not compatible"):
+ mcolors.BoundaryNorm(np.arange(4), 5, extend='both', clip=True)
+
+ # Too small ncolors argument
+ with pytest.raises(ValueError, match="ncolors must equal or exceed"):
+ mcolors.BoundaryNorm(np.arange(4), 2)
+
+ with pytest.raises(ValueError, match="ncolors must equal or exceed"):
+ mcolors.BoundaryNorm(np.arange(4), 3, extend='min')
+
+ with pytest.raises(ValueError, match="ncolors must equal or exceed"):
+ mcolors.BoundaryNorm(np.arange(4), 4, extend='both')
+
+ # Testing extend keyword, with interpolation (large cmap)
+ bounds = [1, 2, 3]
+ cmap = cm.get_cmap('viridis')
+ mynorm = mcolors.BoundaryNorm(bounds, cmap.N, extend='both')
+ refnorm = mcolors.BoundaryNorm([0] + bounds + [4], cmap.N)
+ x = np.random.randn(100) * 10 + 2
+ ref = refnorm(x)
+ ref[ref == 0] = -1
+ ref[ref == cmap.N - 1] = cmap.N
+ assert_array_equal(mynorm(x), ref)
+
+ # Without interpolation
+ cmref = mcolors.ListedColormap(['blue', 'red'])
+ cmref.set_over('black')
+ cmref.set_under('white')
+ cmshould = mcolors.ListedColormap(['white', 'blue', 'red', 'black'])
+
+ assert mcolors.same_color(cmref.get_over(), 'black')
+ assert mcolors.same_color(cmref.get_under(), 'white')
+
+ refnorm = mcolors.BoundaryNorm(bounds, cmref.N)
+ mynorm = mcolors.BoundaryNorm(bounds, cmshould.N, extend='both')
+ assert mynorm.vmin == refnorm.vmin
+ assert mynorm.vmax == refnorm.vmax
+
+ assert mynorm(bounds[0] - 0.1) == -1 # under
+ assert mynorm(bounds[0] + 0.1) == 1 # first bin -> second color
+ assert mynorm(bounds[-1] - 0.1) == cmshould.N - 2 # next-to-last color
+ assert mynorm(bounds[-1] + 0.1) == cmshould.N # over
+
+ x = [-1, 1.2, 2.3, 9.6]
+ assert_array_equal(cmshould(mynorm(x)), cmshould([0, 1, 2, 3]))
+ x = np.random.randn(100) * 10 + 2
+ assert_array_equal(cmshould(mynorm(x)), cmref(refnorm(x)))
+
+ # Just min
+ cmref = mcolors.ListedColormap(['blue', 'red'])
+ cmref.set_under('white')
+ cmshould = mcolors.ListedColormap(['white', 'blue', 'red'])
+
+ assert mcolors.same_color(cmref.get_under(), 'white')
+
+ assert cmref.N == 2
+ assert cmshould.N == 3
+ refnorm = mcolors.BoundaryNorm(bounds, cmref.N)
+ mynorm = mcolors.BoundaryNorm(bounds, cmshould.N, extend='min')
+ assert mynorm.vmin == refnorm.vmin
+ assert mynorm.vmax == refnorm.vmax
+ x = [-1, 1.2, 2.3]
+ assert_array_equal(cmshould(mynorm(x)), cmshould([0, 1, 2]))
+ x = np.random.randn(100) * 10 + 2
+ assert_array_equal(cmshould(mynorm(x)), cmref(refnorm(x)))
+
+ # Just max
+ cmref = mcolors.ListedColormap(['blue', 'red'])
+ cmref.set_over('black')
+ cmshould = mcolors.ListedColormap(['blue', 'red', 'black'])
+
+ assert mcolors.same_color(cmref.get_over(), 'black')
+
+ assert cmref.N == 2
+ assert cmshould.N == 3
+ refnorm = mcolors.BoundaryNorm(bounds, cmref.N)
+ mynorm = mcolors.BoundaryNorm(bounds, cmshould.N, extend='max')
+ assert mynorm.vmin == refnorm.vmin
+ assert mynorm.vmax == refnorm.vmax
+ x = [1.2, 2.3, 4]
+ assert_array_equal(cmshould(mynorm(x)), cmshould([0, 1, 2]))
+ x = np.random.randn(100) * 10 + 2
+ assert_array_equal(cmshould(mynorm(x)), cmref(refnorm(x)))
+
+
+def test_CenteredNorm():
+ np.random.seed(0)
+
+ # Assert equivalence to symmetrical Normalize.
+ x = np.random.normal(size=100)
+ x_maxabs = np.max(np.abs(x))
+ norm_ref = mcolors.Normalize(vmin=-x_maxabs, vmax=x_maxabs)
+ norm = mcolors.CenteredNorm()
+ assert_array_almost_equal(norm_ref(x), norm(x))
+
+ # Check that vcenter is in the center of vmin and vmax
+ # when vcenter is set.
+ vcenter = int(np.random.normal(scale=50))
+ norm = mcolors.CenteredNorm(vcenter=vcenter)
+ norm.autoscale_None([1, 2])
+ assert norm.vmax + norm.vmin == 2 * vcenter
+
+ # Check that halfrange can be set without setting vcenter and that it is
+ # not reset through autoscale_None.
+ norm = mcolors.CenteredNorm(halfrange=1.0)
+ norm.autoscale_None([1, 3000])
+ assert norm.halfrange == 1.0
+
+ # Check that halfrange input works correctly.
+ x = np.random.normal(size=10)
+ norm = mcolors.CenteredNorm(vcenter=0.5, halfrange=0.5)
+ assert_array_almost_equal(x, norm(x))
+ norm = mcolors.CenteredNorm(vcenter=1, halfrange=1)
+ assert_array_almost_equal(x, 2 * norm(x))
+
+ # Check that halfrange input works correctly and use setters.
+ norm = mcolors.CenteredNorm()
+ norm.vcenter = 2
+ norm.halfrange = 2
+ assert_array_almost_equal(x, 4 * norm(x))
+
+ # Check that prior to adding data, setting halfrange first has same effect.
+ norm = mcolors.CenteredNorm()
+ norm.halfrange = 2
+ norm.vcenter = 2
+ assert_array_almost_equal(x, 4 * norm(x))
+
+ # Check that manual change of vcenter adjusts halfrange accordingly.
+ norm = mcolors.CenteredNorm()
+ assert norm.vcenter == 0
+ # add data
+ norm(np.linspace(-1.0, 0.0, 10))
+ assert norm.vmax == 1.0
+ assert norm.halfrange == 1.0
+ # set vcenter to 1, which should double halfrange
+ norm.vcenter = 1
+ assert norm.vmin == -1.0
+ assert norm.vmax == 3.0
+ assert norm.halfrange == 2.0
+
+
+@pytest.mark.parametrize("vmin,vmax", [[-1, 2], [3, 1]])
+def test_lognorm_invalid(vmin, vmax):
+ # Check that invalid limits in LogNorm error
+ norm = mcolors.LogNorm(vmin=vmin, vmax=vmax)
+ with pytest.raises(ValueError):
+ norm(1)
+ with pytest.raises(ValueError):
+ norm.inverse(1)
+
+
+def test_LogNorm():
+ """
+ LogNorm ignored clip, now it has the same
+ behavior as Normalize, e.g., values > vmax are bigger than 1
+ without clip, with clip they are 1.
+ """
+ ln = mcolors.LogNorm(clip=True, vmax=5)
+ assert_array_equal(ln([1, 6]), [0, 1.0])
+
+
+def test_LogNorm_inverse():
+ """
+ Test that lists work, and that the inverse works
+ """
+ norm = mcolors.LogNorm(vmin=0.1, vmax=10)
+ assert_array_almost_equal(norm([0.5, 0.4]), [0.349485, 0.30103])
+ assert_array_almost_equal([0.5, 0.4], norm.inverse([0.349485, 0.30103]))
+ assert_array_almost_equal(norm(0.4), [0.30103])
+ assert_array_almost_equal([0.4], norm.inverse([0.30103]))
+
+
+def test_PowerNorm():
+ a = np.array([0, 0.5, 1, 1.5], dtype=float)
+ pnorm = mcolors.PowerNorm(1)
+ norm = mcolors.Normalize()
+ assert_array_almost_equal(norm(a), pnorm(a))
+
+ a = np.array([-0.5, 0, 2, 4, 8], dtype=float)
+ expected = [0, 0, 1/16, 1/4, 1]
+ pnorm = mcolors.PowerNorm(2, vmin=0, vmax=8)
+ assert_array_almost_equal(pnorm(a), expected)
+ assert pnorm(a[0]) == expected[0]
+ assert pnorm(a[2]) == expected[2]
+ assert_array_almost_equal(a[1:], pnorm.inverse(pnorm(a))[1:])
+
+ # Clip = True
+ a = np.array([-0.5, 0, 1, 8, 16], dtype=float)
+ expected = [0, 0, 0, 1, 1]
+ pnorm = mcolors.PowerNorm(2, vmin=2, vmax=8, clip=True)
+ assert_array_almost_equal(pnorm(a), expected)
+ assert pnorm(a[0]) == expected[0]
+ assert pnorm(a[-1]) == expected[-1]
+
+ # Clip = True at call time
+ a = np.array([-0.5, 0, 1, 8, 16], dtype=float)
+ expected = [0, 0, 0, 1, 1]
+ pnorm = mcolors.PowerNorm(2, vmin=2, vmax=8, clip=False)
+ assert_array_almost_equal(pnorm(a, clip=True), expected)
+ assert pnorm(a[0], clip=True) == expected[0]
+ assert pnorm(a[-1], clip=True) == expected[-1]
+
+
+def test_PowerNorm_translation_invariance():
+ a = np.array([0, 1/2, 1], dtype=float)
+ expected = [0, 1/8, 1]
+ pnorm = mcolors.PowerNorm(vmin=0, vmax=1, gamma=3)
+ assert_array_almost_equal(pnorm(a), expected)
+ pnorm = mcolors.PowerNorm(vmin=-2, vmax=-1, gamma=3)
+ assert_array_almost_equal(pnorm(a - 2), expected)
+
+
+def test_Normalize():
+ norm = mcolors.Normalize()
+ vals = np.arange(-10, 10, 1, dtype=float)
+ _inverse_tester(norm, vals)
+ _scalar_tester(norm, vals)
+ _mask_tester(norm, vals)
+
+ # Handle integer input correctly (don't overflow when computing max-min,
+ # i.e. 127-(-128) here).
+ vals = np.array([-128, 127], dtype=np.int8)
+ norm = mcolors.Normalize(vals.min(), vals.max())
+ assert_array_equal(np.asarray(norm(vals)), [0, 1])
+
+ # Don't lose precision on longdoubles (float128 on Linux):
+ # for array inputs...
+ vals = np.array([1.2345678901, 9.8765432109], dtype=np.longdouble)
+ norm = mcolors.Normalize(vals.min(), vals.max())
+ assert_array_equal(np.asarray(norm(vals)), [0, 1])
+ # and for scalar ones.
+ eps = np.finfo(np.longdouble).resolution
+ norm = plt.Normalize(1, 1 + 100 * eps)
+ # This returns exactly 0.5 when longdouble is extended precision (80-bit),
+ # but only a value close to it when it is quadruple precision (128-bit).
+ assert 0 < norm(1 + 50 * eps) < 1
+
+
+def test_FuncNorm():
+ def forward(x):
+ return (x**2)
+ def inverse(x):
+ return np.sqrt(x)
+
+ norm = mcolors.FuncNorm((forward, inverse), vmin=0, vmax=10)
+ expected = np.array([0, 0.25, 1])
+ input = np.array([0, 5, 10])
+ assert_array_almost_equal(norm(input), expected)
+ assert_array_almost_equal(norm.inverse(expected), input)
+
+ def forward(x):
+ return np.log10(x)
+ def inverse(x):
+ return 10**x
+ norm = mcolors.FuncNorm((forward, inverse), vmin=0.1, vmax=10)
+ lognorm = mcolors.LogNorm(vmin=0.1, vmax=10)
+ assert_array_almost_equal(norm([0.2, 5, 10]), lognorm([0.2, 5, 10]))
+ assert_array_almost_equal(norm.inverse([0.2, 5, 10]),
+ lognorm.inverse([0.2, 5, 10]))
+
+
+def test_TwoSlopeNorm_autoscale():
+ norm = mcolors.TwoSlopeNorm(vcenter=20)
+ norm.autoscale([10, 20, 30, 40])
+ assert norm.vmin == 10.
+ assert norm.vmax == 40.
+
+
+def test_TwoSlopeNorm_autoscale_None_vmin():
+ norm = mcolors.TwoSlopeNorm(2, vmin=0, vmax=None)
+ norm.autoscale_None([1, 2, 3, 4, 5])
+ assert norm(5) == 1
+ assert norm.vmax == 5
+
+
+def test_TwoSlopeNorm_autoscale_None_vmax():
+ norm = mcolors.TwoSlopeNorm(2, vmin=None, vmax=10)
+ norm.autoscale_None([1, 2, 3, 4, 5])
+ assert norm(1) == 0
+ assert norm.vmin == 1
+
+
+def test_TwoSlopeNorm_scale():
+ norm = mcolors.TwoSlopeNorm(2)
+ assert norm.scaled() is False
+ norm([1, 2, 3, 4])
+ assert norm.scaled() is True
+
+
+def test_TwoSlopeNorm_scaleout_center():
+ # test the vmin never goes above vcenter
+ norm = mcolors.TwoSlopeNorm(vcenter=0)
+ norm([1, 2, 3, 5])
+ assert norm.vmin == 0
+ assert norm.vmax == 5
+
+
+def test_TwoSlopeNorm_scaleout_center_max():
+ # test the vmax never goes below vcenter
+ norm = mcolors.TwoSlopeNorm(vcenter=0)
+ norm([-1, -2, -3, -5])
+ assert norm.vmax == 0
+ assert norm.vmin == -5
+
+
+def test_TwoSlopeNorm_Even():
+ norm = mcolors.TwoSlopeNorm(vmin=-1, vcenter=0, vmax=4)
+ vals = np.array([-1.0, -0.5, 0.0, 1.0, 2.0, 3.0, 4.0])
+ expected = np.array([0.0, 0.25, 0.5, 0.625, 0.75, 0.875, 1.0])
+ assert_array_equal(norm(vals), expected)
+
+
+def test_TwoSlopeNorm_Odd():
+ norm = mcolors.TwoSlopeNorm(vmin=-2, vcenter=0, vmax=5)
+ vals = np.array([-2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0])
+ expected = np.array([0.0, 0.25, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0])
+ assert_array_equal(norm(vals), expected)
+
+
+def test_TwoSlopeNorm_VminEqualsVcenter():
+ with pytest.raises(ValueError):
+ mcolors.TwoSlopeNorm(vmin=-2, vcenter=-2, vmax=2)
+
+
+def test_TwoSlopeNorm_VmaxEqualsVcenter():
+ with pytest.raises(ValueError):
+ mcolors.TwoSlopeNorm(vmin=-2, vcenter=2, vmax=2)
+
+
+def test_TwoSlopeNorm_VminGTVcenter():
+ with pytest.raises(ValueError):
+ mcolors.TwoSlopeNorm(vmin=10, vcenter=0, vmax=20)
+
+
+def test_TwoSlopeNorm_TwoSlopeNorm_VminGTVmax():
+ with pytest.raises(ValueError):
+ mcolors.TwoSlopeNorm(vmin=10, vcenter=0, vmax=5)
+
+
+def test_TwoSlopeNorm_VcenterGTVmax():
+ with pytest.raises(ValueError):
+ mcolors.TwoSlopeNorm(vmin=10, vcenter=25, vmax=20)
+
+
+def test_TwoSlopeNorm_premature_scaling():
+ norm = mcolors.TwoSlopeNorm(vcenter=2)
+ with pytest.raises(ValueError):
+ norm.inverse(np.array([0.1, 0.5, 0.9]))
+
+
+def test_SymLogNorm():
+ """
+ Test SymLogNorm behavior
+ """
+ norm = mcolors.SymLogNorm(3, vmax=5, linscale=1.2, base=np.e)
+ vals = np.array([-30, -1, 2, 6], dtype=float)
+ normed_vals = norm(vals)
+ expected = [0., 0.53980074, 0.826991, 1.02758204]
+ assert_array_almost_equal(normed_vals, expected)
+ _inverse_tester(norm, vals)
+ _scalar_tester(norm, vals)
+ _mask_tester(norm, vals)
+
+ # Ensure that specifying vmin returns the same result as above
+ norm = mcolors.SymLogNorm(3, vmin=-30, vmax=5, linscale=1.2, base=np.e)
+ normed_vals = norm(vals)
+ assert_array_almost_equal(normed_vals, expected)
+
+ # test something more easily checked.
+ norm = mcolors.SymLogNorm(1, vmin=-np.e**3, vmax=np.e**3, base=np.e)
+ nn = norm([-np.e**3, -np.e**2, -np.e**1, -1,
+ 0, 1, np.e**1, np.e**2, np.e**3])
+ xx = np.array([0., 0.109123, 0.218246, 0.32737, 0.5, 0.67263,
+ 0.781754, 0.890877, 1.])
+ assert_array_almost_equal(nn, xx)
+ norm = mcolors.SymLogNorm(1, vmin=-10**3, vmax=10**3, base=10)
+ nn = norm([-10**3, -10**2, -10**1, -1,
+ 0, 1, 10**1, 10**2, 10**3])
+ xx = np.array([0., 0.121622, 0.243243, 0.364865, 0.5, 0.635135,
+ 0.756757, 0.878378, 1.])
+ assert_array_almost_equal(nn, xx)
+
+
+def test_SymLogNorm_colorbar():
+ """
+ Test un-called SymLogNorm in a colorbar.
+ """
+ norm = mcolors.SymLogNorm(0.1, vmin=-1, vmax=1, linscale=1, base=np.e)
+ fig = plt.figure()
+ mcolorbar.ColorbarBase(fig.add_subplot(), norm=norm)
+ plt.close(fig)
+
+
+def test_SymLogNorm_single_zero():
+ """
+ Test SymLogNorm to ensure it is not adding sub-ticks to zero label
+ """
+ fig = plt.figure()
+ norm = mcolors.SymLogNorm(1e-5, vmin=-1, vmax=1, base=np.e)
+ cbar = mcolorbar.ColorbarBase(fig.add_subplot(), norm=norm)
+ ticks = cbar.get_ticks()
+ assert sum(ticks == 0) == 1
+ plt.close(fig)
+
+
+def _inverse_tester(norm_instance, vals):
+ """
+ Checks if the inverse of the given normalization is working.
+ """
+ assert_array_almost_equal(norm_instance.inverse(norm_instance(vals)), vals)
+
+
+def _scalar_tester(norm_instance, vals):
+ """
+ Checks if scalars and arrays are handled the same way.
+ Tests only for float.
+ """
+ scalar_result = [norm_instance(float(v)) for v in vals]
+ assert_array_almost_equal(scalar_result, norm_instance(vals))
+
+
+def _mask_tester(norm_instance, vals):
+ """
+ Checks mask handling
+ """
+ masked_array = np.ma.array(vals)
+ masked_array[0] = np.ma.masked
+ assert_array_equal(masked_array.mask, norm_instance(masked_array).mask)
+
+
+@image_comparison(['levels_and_colors.png'])
+def test_cmap_and_norm_from_levels_and_colors():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ data = np.linspace(-2, 4, 49).reshape(7, 7)
+ levels = [-1, 2, 2.5, 3]
+ colors = ['red', 'green', 'blue', 'yellow', 'black']
+ extend = 'both'
+ cmap, norm = mcolors.from_levels_and_colors(levels, colors, extend=extend)
+
+ ax = plt.axes()
+ m = plt.pcolormesh(data, cmap=cmap, norm=norm)
+ plt.colorbar(m)
+
+ # Hide the axes labels (but not the colorbar ones, as they are useful)
+ ax.tick_params(labelleft=False, labelbottom=False)
+
+
+@image_comparison(baseline_images=['boundarynorm_and_colorbar'],
+ extensions=['png'], tol=1.0)
+def test_boundarynorm_and_colorbarbase():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ # Make a figure and axes with dimensions as desired.
+ fig = plt.figure()
+ ax1 = fig.add_axes([0.05, 0.80, 0.9, 0.15])
+ ax2 = fig.add_axes([0.05, 0.475, 0.9, 0.15])
+ ax3 = fig.add_axes([0.05, 0.15, 0.9, 0.15])
+
+ # Set the colormap and bounds
+ bounds = [-1, 2, 5, 7, 12, 15]
+ cmap = cm.get_cmap('viridis')
+
+ # Default behavior
+ norm = mcolors.BoundaryNorm(bounds, cmap.N)
+ cb1 = mcolorbar.ColorbarBase(ax1, cmap=cmap, norm=norm, extend='both',
+ orientation='horizontal')
+ # New behavior
+ norm = mcolors.BoundaryNorm(bounds, cmap.N, extend='both')
+ cb2 = mcolorbar.ColorbarBase(ax2, cmap=cmap, norm=norm,
+ orientation='horizontal')
+
+ # User can still force to any extend='' if really needed
+ norm = mcolors.BoundaryNorm(bounds, cmap.N, extend='both')
+ cb3 = mcolorbar.ColorbarBase(ax3, cmap=cmap, norm=norm,
+ extend='neither', orientation='horizontal')
+
+
+def test_cmap_and_norm_from_levels_and_colors2():
+ levels = [-1, 2, 2.5, 3]
+ colors = ['red', (0, 1, 0), 'blue', (0.5, 0.5, 0.5), (0.0, 0.0, 0.0, 1.0)]
+ clr = mcolors.to_rgba_array(colors)
+ bad = (0.1, 0.1, 0.1, 0.1)
+ no_color = (0.0, 0.0, 0.0, 0.0)
+ masked_value = 'masked_value'
+
+ # Define the test values which are of interest.
+ # Note: levels are lev[i] <= v < lev[i+1]
+ tests = [('both', None, {-2: clr[0],
+ -1: clr[1],
+ 2: clr[2],
+ 2.25: clr[2],
+ 3: clr[4],
+ 3.5: clr[4],
+ masked_value: bad}),
+
+ ('min', -1, {-2: clr[0],
+ -1: clr[1],
+ 2: clr[2],
+ 2.25: clr[2],
+ 3: no_color,
+ 3.5: no_color,
+ masked_value: bad}),
+
+ ('max', -1, {-2: no_color,
+ -1: clr[0],
+ 2: clr[1],
+ 2.25: clr[1],
+ 3: clr[3],
+ 3.5: clr[3],
+ masked_value: bad}),
+
+ ('neither', -2, {-2: no_color,
+ -1: clr[0],
+ 2: clr[1],
+ 2.25: clr[1],
+ 3: no_color,
+ 3.5: no_color,
+ masked_value: bad}),
+ ]
+
+ for extend, i1, cases in tests:
+ cmap, norm = mcolors.from_levels_and_colors(levels, colors[0:i1],
+ extend=extend)
+ cmap.set_bad(bad)
+ for d_val, expected_color in cases.items():
+ if d_val == masked_value:
+ d_val = np.ma.array([1], mask=True)
+ else:
+ d_val = [d_val]
+ assert_array_equal(expected_color, cmap(norm(d_val))[0],
+ 'Wih extend={0!r} and data '
+ 'value={1!r}'.format(extend, d_val))
+
+ with pytest.raises(ValueError):
+ mcolors.from_levels_and_colors(levels, colors)
+
+
+def test_rgb_hsv_round_trip():
+ for a_shape in [(500, 500, 3), (500, 3), (1, 3), (3,)]:
+ np.random.seed(0)
+ tt = np.random.random(a_shape)
+ assert_array_almost_equal(
+ tt, mcolors.hsv_to_rgb(mcolors.rgb_to_hsv(tt)))
+ assert_array_almost_equal(
+ tt, mcolors.rgb_to_hsv(mcolors.hsv_to_rgb(tt)))
+
+
+def test_autoscale_masked():
+ # Test for #2336. Previously fully masked data would trigger a ValueError.
+ data = np.ma.masked_all((12, 20))
+ plt.pcolor(data)
+ plt.draw()
+
+
+@image_comparison(['light_source_shading_topo.png'])
+def test_light_source_topo_surface():
+ """Shades a DEM using different v.e.'s and blend modes."""
+ dem = cbook.get_sample_data('jacksboro_fault_dem.npz', np_load=True)
+ elev = dem['elevation']
+ dx, dy = dem['dx'], dem['dy']
+ # Get the true cellsize in meters for accurate vertical exaggeration
+ # Convert from decimal degrees to meters
+ dx = 111320.0 * dx * np.cos(dem['ymin'])
+ dy = 111320.0 * dy
+
+ ls = mcolors.LightSource(315, 45)
+ cmap = cm.gist_earth
+
+ fig, axs = plt.subplots(nrows=3, ncols=3)
+ for row, mode in zip(axs, ['hsv', 'overlay', 'soft']):
+ for ax, ve in zip(row, [0.1, 1, 10]):
+ rgb = ls.shade(elev, cmap, vert_exag=ve, dx=dx, dy=dy,
+ blend_mode=mode)
+ ax.imshow(rgb)
+ ax.set(xticks=[], yticks=[])
+
+
+def test_light_source_shading_default():
+ """
+ Array comparison test for the default "hsv" blend mode. Ensure the
+ default result doesn't change without warning.
+ """
+ y, x = np.mgrid[-1.2:1.2:8j, -1.2:1.2:8j]
+ z = 10 * np.cos(x**2 + y**2)
+
+ cmap = plt.cm.copper
+ ls = mcolors.LightSource(315, 45)
+ rgb = ls.shade(z, cmap)
+
+ # Result stored transposed and rounded for more compact display...
+ expect = np.array(
+ [[[0.00, 0.45, 0.90, 0.90, 0.82, 0.62, 0.28, 0.00],
+ [0.45, 0.94, 0.99, 1.00, 1.00, 0.96, 0.65, 0.17],
+ [0.90, 0.99, 1.00, 1.00, 1.00, 1.00, 0.94, 0.35],
+ [0.90, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 0.49],
+ [0.82, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 0.41],
+ [0.62, 0.96, 1.00, 1.00, 1.00, 1.00, 0.90, 0.07],
+ [0.28, 0.65, 0.94, 1.00, 1.00, 0.90, 0.35, 0.01],
+ [0.00, 0.17, 0.35, 0.49, 0.41, 0.07, 0.01, 0.00]],
+
+ [[0.00, 0.28, 0.59, 0.72, 0.62, 0.40, 0.18, 0.00],
+ [0.28, 0.78, 0.93, 0.92, 0.83, 0.66, 0.39, 0.11],
+ [0.59, 0.93, 0.99, 1.00, 0.92, 0.75, 0.50, 0.21],
+ [0.72, 0.92, 1.00, 0.99, 0.93, 0.76, 0.51, 0.18],
+ [0.62, 0.83, 0.92, 0.93, 0.87, 0.68, 0.42, 0.08],
+ [0.40, 0.66, 0.75, 0.76, 0.68, 0.52, 0.23, 0.02],
+ [0.18, 0.39, 0.50, 0.51, 0.42, 0.23, 0.00, 0.00],
+ [0.00, 0.11, 0.21, 0.18, 0.08, 0.02, 0.00, 0.00]],
+
+ [[0.00, 0.18, 0.38, 0.46, 0.39, 0.26, 0.11, 0.00],
+ [0.18, 0.50, 0.70, 0.75, 0.64, 0.44, 0.25, 0.07],
+ [0.38, 0.70, 0.91, 0.98, 0.81, 0.51, 0.29, 0.13],
+ [0.46, 0.75, 0.98, 0.96, 0.84, 0.48, 0.22, 0.12],
+ [0.39, 0.64, 0.81, 0.84, 0.71, 0.31, 0.11, 0.05],
+ [0.26, 0.44, 0.51, 0.48, 0.31, 0.10, 0.03, 0.01],
+ [0.11, 0.25, 0.29, 0.22, 0.11, 0.03, 0.00, 0.00],
+ [0.00, 0.07, 0.13, 0.12, 0.05, 0.01, 0.00, 0.00]],
+
+ [[1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00]]
+ ]).T
+
+ assert_array_almost_equal(rgb, expect, decimal=2)
+
+
+def test_light_source_shading_empty_mask():
+ y, x = np.mgrid[-1.2:1.2:8j, -1.2:1.2:8j]
+ z0 = 10 * np.cos(x**2 + y**2)
+ z1 = np.ma.array(z0)
+
+ cmap = plt.cm.copper
+ ls = mcolors.LightSource(315, 45)
+ rgb0 = ls.shade(z0, cmap)
+ rgb1 = ls.shade(z1, cmap)
+
+ assert_array_almost_equal(rgb0, rgb1)
+
+
+# Numpy 1.9.1 fixed a bug in masked arrays which resulted in
+# additional elements being masked when calculating the gradient thus
+# the output is different with earlier numpy versions.
+def test_light_source_masked_shading():
+ """
+ Array comparison test for a surface with a masked portion. Ensures that
+ we don't wind up with "fringes" of odd colors around masked regions.
+ """
+ y, x = np.mgrid[-1.2:1.2:8j, -1.2:1.2:8j]
+ z = 10 * np.cos(x**2 + y**2)
+
+ z = np.ma.masked_greater(z, 9.9)
+
+ cmap = plt.cm.copper
+ ls = mcolors.LightSource(315, 45)
+ rgb = ls.shade(z, cmap)
+
+ # Result stored transposed and rounded for more compact display...
+ expect = np.array(
+ [[[0.00, 0.46, 0.91, 0.91, 0.84, 0.64, 0.29, 0.00],
+ [0.46, 0.96, 1.00, 1.00, 1.00, 0.97, 0.67, 0.18],
+ [0.91, 1.00, 1.00, 1.00, 1.00, 1.00, 0.96, 0.36],
+ [0.91, 1.00, 1.00, 0.00, 0.00, 1.00, 1.00, 0.51],
+ [0.84, 1.00, 1.00, 0.00, 0.00, 1.00, 1.00, 0.44],
+ [0.64, 0.97, 1.00, 1.00, 1.00, 1.00, 0.94, 0.09],
+ [0.29, 0.67, 0.96, 1.00, 1.00, 0.94, 0.38, 0.01],
+ [0.00, 0.18, 0.36, 0.51, 0.44, 0.09, 0.01, 0.00]],
+
+ [[0.00, 0.29, 0.61, 0.75, 0.64, 0.41, 0.18, 0.00],
+ [0.29, 0.81, 0.95, 0.93, 0.85, 0.68, 0.40, 0.11],
+ [0.61, 0.95, 1.00, 0.78, 0.78, 0.77, 0.52, 0.22],
+ [0.75, 0.93, 0.78, 0.00, 0.00, 0.78, 0.54, 0.19],
+ [0.64, 0.85, 0.78, 0.00, 0.00, 0.78, 0.45, 0.08],
+ [0.41, 0.68, 0.77, 0.78, 0.78, 0.55, 0.25, 0.02],
+ [0.18, 0.40, 0.52, 0.54, 0.45, 0.25, 0.00, 0.00],
+ [0.00, 0.11, 0.22, 0.19, 0.08, 0.02, 0.00, 0.00]],
+
+ [[0.00, 0.19, 0.39, 0.48, 0.41, 0.26, 0.12, 0.00],
+ [0.19, 0.52, 0.73, 0.78, 0.66, 0.46, 0.26, 0.07],
+ [0.39, 0.73, 0.95, 0.50, 0.50, 0.53, 0.30, 0.14],
+ [0.48, 0.78, 0.50, 0.00, 0.00, 0.50, 0.23, 0.12],
+ [0.41, 0.66, 0.50, 0.00, 0.00, 0.50, 0.11, 0.05],
+ [0.26, 0.46, 0.53, 0.50, 0.50, 0.11, 0.03, 0.01],
+ [0.12, 0.26, 0.30, 0.23, 0.11, 0.03, 0.00, 0.00],
+ [0.00, 0.07, 0.14, 0.12, 0.05, 0.01, 0.00, 0.00]],
+
+ [[1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 0.00, 0.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 0.00, 0.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00],
+ [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00]],
+ ]).T
+
+ assert_array_almost_equal(rgb, expect, decimal=2)
+
+
+def test_light_source_hillshading():
+ """
+ Compare the current hillshading method against one that should be
+ mathematically equivalent. Illuminates a cone from a range of angles.
+ """
+
+ def alternative_hillshade(azimuth, elev, z):
+ illum = _sph2cart(*_azimuth2math(azimuth, elev))
+ illum = np.array(illum)
+
+ dy, dx = np.gradient(-z)
+ dy = -dy
+ dz = np.ones_like(dy)
+ normals = np.dstack([dx, dy, dz])
+ normals /= np.linalg.norm(normals, axis=2)[..., None]
+
+ intensity = np.tensordot(normals, illum, axes=(2, 0))
+ intensity -= intensity.min()
+ intensity /= intensity.ptp()
+ return intensity
+
+ y, x = np.mgrid[5:0:-1, :5]
+ z = -np.hypot(x - x.mean(), y - y.mean())
+
+ for az, elev in itertools.product(range(0, 390, 30), range(0, 105, 15)):
+ ls = mcolors.LightSource(az, elev)
+ h1 = ls.hillshade(z)
+ h2 = alternative_hillshade(az, elev, z)
+ assert_array_almost_equal(h1, h2)
+
+
+def test_light_source_planar_hillshading():
+ """
+ Ensure that the illumination intensity is correct for planar surfaces.
+ """
+
+ def plane(azimuth, elevation, x, y):
+ """
+ Create a plane whose normal vector is at the given azimuth and
+ elevation.
+ """
+ theta, phi = _azimuth2math(azimuth, elevation)
+ a, b, c = _sph2cart(theta, phi)
+ z = -(a*x + b*y) / c
+ return z
+
+ def angled_plane(azimuth, elevation, angle, x, y):
+ """
+ Create a plane whose normal vector is at an angle from the given
+ azimuth and elevation.
+ """
+ elevation = elevation + angle
+ if elevation > 90:
+ azimuth = (azimuth + 180) % 360
+ elevation = (90 - elevation) % 90
+ return plane(azimuth, elevation, x, y)
+
+ y, x = np.mgrid[5:0:-1, :5]
+ for az, elev in itertools.product(range(0, 390, 30), range(0, 105, 15)):
+ ls = mcolors.LightSource(az, elev)
+
+ # Make a plane at a range of angles to the illumination
+ for angle in range(0, 105, 15):
+ z = angled_plane(az, elev, angle, x, y)
+ h = ls.hillshade(z)
+ assert_array_almost_equal(h, np.cos(np.radians(angle)))
+
+
+def test_color_names():
+ assert mcolors.to_hex("blue") == "#0000ff"
+ assert mcolors.to_hex("xkcd:blue") == "#0343df"
+ assert mcolors.to_hex("tab:blue") == "#1f77b4"
+
+
+def _sph2cart(theta, phi):
+ x = np.cos(theta) * np.sin(phi)
+ y = np.sin(theta) * np.sin(phi)
+ z = np.cos(phi)
+ return x, y, z
+
+
+def _azimuth2math(azimuth, elevation):
+ """
+ Convert from clockwise-from-north and up-from-horizontal to mathematical
+ conventions.
+ """
+ theta = np.radians((90 - azimuth) % 360)
+ phi = np.radians(90 - elevation)
+ return theta, phi
+
+
+def test_pandas_iterable(pd):
+ # Using a list or series yields equivalent
+ # colormaps, i.e the series isn't seen as
+ # a single color
+ lst = ['red', 'blue', 'green']
+ s = pd.Series(lst)
+ cm1 = mcolors.ListedColormap(lst, N=5)
+ cm2 = mcolors.ListedColormap(s, N=5)
+ assert_array_equal(cm1.colors, cm2.colors)
+
+
+@pytest.mark.parametrize('name', sorted(plt.colormaps()))
+def test_colormap_reversing(name):
+ """
+ Check the generated _lut data of a colormap and corresponding reversed
+ colormap if they are almost the same.
+ """
+ cmap = plt.get_cmap(name)
+ cmap_r = cmap.reversed()
+ if not cmap_r._isinit:
+ cmap._init()
+ cmap_r._init()
+ assert_array_almost_equal(cmap._lut[:-3], cmap_r._lut[-4::-1])
+ # Test the bad, over, under values too
+ assert_array_almost_equal(cmap(-np.inf), cmap_r(np.inf))
+ assert_array_almost_equal(cmap(np.inf), cmap_r(-np.inf))
+ assert_array_almost_equal(cmap(np.nan), cmap_r(np.nan))
+
+
+def test_cn():
+ matplotlib.rcParams['axes.prop_cycle'] = cycler('color',
+ ['blue', 'r'])
+ assert mcolors.to_hex("C0") == '#0000ff'
+ assert mcolors.to_hex("C1") == '#ff0000'
+
+ matplotlib.rcParams['axes.prop_cycle'] = cycler('color',
+ ['xkcd:blue', 'r'])
+ assert mcolors.to_hex("C0") == '#0343df'
+ assert mcolors.to_hex("C1") == '#ff0000'
+ assert mcolors.to_hex("C10") == '#0343df'
+ assert mcolors.to_hex("C11") == '#ff0000'
+
+ matplotlib.rcParams['axes.prop_cycle'] = cycler('color', ['8e4585', 'r'])
+
+ assert mcolors.to_hex("C0") == '#8e4585'
+ # if '8e4585' gets parsed as a float before it gets detected as a hex
+ # colour it will be interpreted as a very large number.
+ # this mustn't happen.
+ assert mcolors.to_rgb("C0")[0] != np.inf
+
+
+def test_conversions():
+ # to_rgba_array("none") returns a (0, 4) array.
+ assert_array_equal(mcolors.to_rgba_array("none"), np.zeros((0, 4)))
+ assert_array_equal(mcolors.to_rgba_array([]), np.zeros((0, 4)))
+ # a list of grayscale levels, not a single color.
+ assert_array_equal(
+ mcolors.to_rgba_array([".2", ".5", ".8"]),
+ np.vstack([mcolors.to_rgba(c) for c in [".2", ".5", ".8"]]))
+ # alpha is properly set.
+ assert mcolors.to_rgba((1, 1, 1), .5) == (1, 1, 1, .5)
+ assert mcolors.to_rgba(".1", .5) == (.1, .1, .1, .5)
+ # builtin round differs between py2 and py3.
+ assert mcolors.to_hex((.7, .7, .7)) == "#b2b2b2"
+ # hex roundtrip.
+ hex_color = "#1234abcd"
+ assert mcolors.to_hex(mcolors.to_rgba(hex_color), keep_alpha=True) == \
+ hex_color
+
+
+def test_conversions_masked():
+ x1 = np.ma.array(['k', 'b'], mask=[True, False])
+ x2 = np.ma.array([[0, 0, 0, 1], [0, 0, 1, 1]])
+ x2[0] = np.ma.masked
+ assert mcolors.to_rgba(x1[0]) == (0, 0, 0, 0)
+ assert_array_equal(mcolors.to_rgba_array(x1),
+ [[0, 0, 0, 0], [0, 0, 1, 1]])
+ assert_array_equal(mcolors.to_rgba_array(x2), mcolors.to_rgba_array(x1))
+
+
+def test_to_rgba_array_single_str():
+ # single color name is valid
+ assert_array_equal(mcolors.to_rgba_array("red"), [(1, 0, 0, 1)])
+
+ # single char color sequence is invalid
+ with pytest.raises(ValueError,
+ match="Using a string of single character colors as "
+ "a color sequence is not supported."):
+ array = mcolors.to_rgba_array("rgb")
+
+
+def test_to_rgba_array_alpha_array():
+ with pytest.raises(ValueError, match="The number of colors must match"):
+ mcolors.to_rgba_array(np.ones((5, 3), float), alpha=np.ones((2,)))
+ alpha = [0.5, 0.6]
+ c = mcolors.to_rgba_array(np.ones((2, 3), float), alpha=alpha)
+ assert_array_equal(c[:, 3], alpha)
+ c = mcolors.to_rgba_array(['r', 'g'], alpha=alpha)
+ assert_array_equal(c[:, 3], alpha)
+
+
+def test_failed_conversions():
+ with pytest.raises(ValueError):
+ mcolors.to_rgba('5')
+ with pytest.raises(ValueError):
+ mcolors.to_rgba('-1')
+ with pytest.raises(ValueError):
+ mcolors.to_rgba('nan')
+ with pytest.raises(ValueError):
+ mcolors.to_rgba('unknown_color')
+ with pytest.raises(ValueError):
+ # Gray must be a string to distinguish 3-4 grays from RGB or RGBA.
+ mcolors.to_rgba(0.4)
+
+
+def test_grey_gray():
+ color_mapping = mcolors._colors_full_map
+ for k in color_mapping.keys():
+ if 'grey' in k:
+ assert color_mapping[k] == color_mapping[k.replace('grey', 'gray')]
+ if 'gray' in k:
+ assert color_mapping[k] == color_mapping[k.replace('gray', 'grey')]
+
+
+def test_tableau_order():
+ dflt_cycle = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728',
+ '#9467bd', '#8c564b', '#e377c2', '#7f7f7f',
+ '#bcbd22', '#17becf']
+
+ assert list(mcolors.TABLEAU_COLORS.values()) == dflt_cycle
+
+
+def test_ndarray_subclass_norm():
+ # Emulate an ndarray subclass that handles units
+ # which objects when adding or subtracting with other
+ # arrays. See #6622 and #8696
+ class MyArray(np.ndarray):
+ def __isub__(self, other):
+ raise RuntimeError
+
+ def __add__(self, other):
+ raise RuntimeError
+
+ data = np.arange(-10, 10, 1, dtype=float).reshape((10, 2))
+ mydata = data.view(MyArray)
+
+ for norm in [mcolors.Normalize(), mcolors.LogNorm(),
+ mcolors.SymLogNorm(3, vmax=5, linscale=1, base=np.e),
+ mcolors.Normalize(vmin=mydata.min(), vmax=mydata.max()),
+ mcolors.SymLogNorm(3, vmin=mydata.min(), vmax=mydata.max(),
+ base=np.e),
+ mcolors.PowerNorm(1)]:
+ assert_array_equal(norm(mydata), norm(data))
+ fig, ax = plt.subplots()
+ ax.imshow(mydata, norm=norm)
+ fig.canvas.draw() # Check that no warning is emitted.
+
+
+def test_same_color():
+ assert mcolors.same_color('k', (0, 0, 0))
+ assert not mcolors.same_color('w', (1, 1, 0))
+ assert mcolors.same_color(['red', 'blue'], ['r', 'b'])
+ assert mcolors.same_color('none', 'none')
+ assert not mcolors.same_color('none', 'red')
+ with pytest.raises(ValueError):
+ mcolors.same_color(['r', 'g', 'b'], ['r'])
+ with pytest.raises(ValueError):
+ mcolors.same_color(['red', 'green'], 'none')
+
+
+def test_hex_shorthand_notation():
+ assert mcolors.same_color("#123", "#112233")
+ assert mcolors.same_color("#123a", "#112233aa")
+
+
+def test_repr_png():
+ cmap = plt.get_cmap('viridis')
+ png = cmap._repr_png_()
+ assert len(png) > 0
+ img = Image.open(BytesIO(png))
+ assert img.width > 0
+ assert img.height > 0
+ assert 'Title' in img.text
+ assert 'Description' in img.text
+ assert 'Author' in img.text
+ assert 'Software' in img.text
+
+
+def test_repr_html():
+ cmap = plt.get_cmap('viridis')
+ html = cmap._repr_html_()
+ assert len(html) > 0
+ png = cmap._repr_png_()
+ assert base64.b64encode(png).decode('ascii') in html
+ assert cmap.name in html
+ assert html.startswith('')
+
+
+def test_get_under_over_bad():
+ cmap = plt.get_cmap('viridis')
+ assert_array_equal(cmap.get_under(), cmap(-np.inf))
+ assert_array_equal(cmap.get_over(), cmap(np.inf))
+ assert_array_equal(cmap.get_bad(), cmap(np.nan))
+
+
+@pytest.mark.parametrize('kind', ('over', 'under', 'bad'))
+def test_non_mutable_get_values(kind):
+ cmap = copy.copy(plt.get_cmap('viridis'))
+ init_value = getattr(cmap, f'get_{kind}')()
+ getattr(cmap, f'set_{kind}')('k')
+ black_value = getattr(cmap, f'get_{kind}')()
+ assert np.all(black_value == [0, 0, 0, 1])
+ assert not np.all(init_value == black_value)
+
+
+def test_colormap_alpha_array():
+ cmap = plt.get_cmap('viridis')
+ vals = [-1, 0.5, 2] # under, valid, over
+ with pytest.raises(ValueError, match="alpha is array-like but"):
+ cmap(vals, alpha=[1, 1, 1, 1])
+ alpha = np.array([0.1, 0.2, 0.3])
+ c = cmap(vals, alpha=alpha)
+ assert_array_equal(c[:, -1], alpha)
+ c = cmap(vals, alpha=alpha, bytes=True)
+ assert_array_equal(c[:, -1], (alpha * 255).astype(np.uint8))
+
+
+def test_colormap_bad_data_with_alpha():
+ cmap = plt.get_cmap('viridis')
+ c = cmap(np.nan, alpha=0.5)
+ assert c == (0, 0, 0, 0)
+ c = cmap([0.5, np.nan], alpha=0.5)
+ assert_array_equal(c[1], (0, 0, 0, 0))
+ c = cmap([0.5, np.nan], alpha=[0.1, 0.2])
+ assert_array_equal(c[1], (0, 0, 0, 0))
+ c = cmap([[np.nan, 0.5], [0, 0]], alpha=0.5)
+ assert_array_equal(c[0, 0], (0, 0, 0, 0))
+ c = cmap([[np.nan, 0.5], [0, 0]], alpha=np.full((2, 2), 0.5))
+ assert_array_equal(c[0, 0], (0, 0, 0, 0))
+
+
+def test_2d_to_rgba():
+ color = np.array([0.1, 0.2, 0.3])
+ rgba_1d = mcolors.to_rgba(color.reshape(-1))
+ rgba_2d = mcolors.to_rgba(color.reshape((1, -1)))
+ assert rgba_1d == rgba_2d
+
+
+def test_set_dict_to_rgba():
+ # downstream libraries do this...
+ # note we can't test this because it is not well-ordered
+ # so just smoketest:
+ colors = set([(0, .5, 1), (1, .2, .5), (.4, 1, .2)])
+ res = mcolors.to_rgba_array(colors)
+ palette = {"red": (1, 0, 0), "green": (0, 1, 0), "blue": (0, 0, 1)}
+ res = mcolors.to_rgba_array(palette.values())
+ exp = np.eye(3)
+ np.testing.assert_array_almost_equal(res[:, :-1], exp)
+
+
+def test_norm_deepcopy():
+ norm = mcolors.LogNorm()
+ norm.vmin = 0.0002
+ norm2 = copy.deepcopy(norm)
+ assert norm2.vmin == norm.vmin
+ assert isinstance(norm2._scale, mscale.LogScale)
+ norm = mcolors.Normalize()
+ norm.vmin = 0.0002
+ norm2 = copy.deepcopy(norm)
+ assert isinstance(norm2._scale, mscale.LinearScale)
+ assert norm2.vmin == norm.vmin
+ assert norm2._scale is not norm._scale
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_compare_images.py b/venv/Lib/site-packages/matplotlib/tests/test_compare_images.py
new file mode 100644
index 0000000..95173a8
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_compare_images.py
@@ -0,0 +1,72 @@
+from pathlib import Path
+import shutil
+
+import pytest
+from pytest import approx
+
+from matplotlib.testing.compare import compare_images, make_test_filename
+from matplotlib.testing.decorators import _image_directories
+
+
+# Tests of the image comparison algorithm.
+@pytest.mark.parametrize(
+ 'im1, im2, tol, expect_rms',
+ [
+ # Comparison of an image and the same image with minor differences.
+ # This expects the images to compare equal under normal tolerance, and
+ # have a small RMS.
+ ('basn3p02.png', 'basn3p02-minorchange.png', 10, None),
+ # Now test with no tolerance.
+ ('basn3p02.png', 'basn3p02-minorchange.png', 0, 6.50646),
+ # Comparison with an image that is shifted by 1px in the X axis.
+ ('basn3p02.png', 'basn3p02-1px-offset.png', 0, 90.15611),
+ # Comparison with an image with half the pixels shifted by 1px in the X
+ # axis.
+ ('basn3p02.png', 'basn3p02-half-1px-offset.png', 0, 63.75),
+ # Comparison of an image and the same image scrambled.
+ # This expects the images to compare completely different, with a very
+ # large RMS.
+ # Note: The image has been scrambled in a specific way, by having
+ # each color component of each pixel randomly placed somewhere in the
+ # image. It contains exactly the same number of pixels of each color
+ # value of R, G and B, but in a totally different position.
+ # Test with no tolerance to make sure that we pick up even a very small
+ # RMS error.
+ ('basn3p02.png', 'basn3p02-scrambled.png', 0, 172.63582),
+ # Comparison of an image and a slightly brighter image.
+ # The two images are solid color, with the second image being exactly 1
+ # color value brighter.
+ # This expects the images to compare equal under normal tolerance, and
+ # have an RMS of exactly 1.
+ ('all127.png', 'all128.png', 0, 1),
+ # Now test the reverse comparison.
+ ('all128.png', 'all127.png', 0, 1),
+ ])
+def test_image_comparison_expect_rms(im1, im2, tol, expect_rms):
+ """
+ Compare two images, expecting a particular RMS error.
+
+ im1 and im2 are filenames relative to the baseline_dir directory.
+
+ tol is the tolerance to pass to compare_images.
+
+ expect_rms is the expected RMS value, or None. If None, the test will
+ succeed if compare_images succeeds. Otherwise, the test will succeed if
+ compare_images fails and returns an RMS error almost equal to this value.
+ """
+ baseline_dir, result_dir = map(Path, _image_directories(lambda: "dummy"))
+ # Copy both "baseline" and "test" image to result_dir, so that 1)
+ # compare_images writes the diff to result_dir, rather than to the source
+ # tree and 2) the baseline image doesn't appear missing to triage_tests.py.
+ result_im1 = make_test_filename(result_dir / im1, "expected")
+ shutil.copyfile(baseline_dir / im1, result_im1)
+ result_im2 = result_dir / im1
+ shutil.copyfile(baseline_dir / im2, result_im2)
+ results = compare_images(
+ result_im1, result_im2, tol=tol, in_decorator=True)
+
+ if expect_rms is None:
+ assert results is None
+ else:
+ assert results is not None
+ assert results['rms'] == approx(expect_rms, abs=1e-4)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_constrainedlayout.py b/venv/Lib/site-packages/matplotlib/tests/test_constrainedlayout.py
new file mode 100644
index 0000000..6747462
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_constrainedlayout.py
@@ -0,0 +1,557 @@
+import numpy as np
+import pytest
+
+from matplotlib.testing.decorators import image_comparison
+import matplotlib.pyplot as plt
+import matplotlib.gridspec as gridspec
+import matplotlib.transforms as mtransforms
+from matplotlib import ticker, rcParams
+
+
+def example_plot(ax, fontsize=12, nodec=False):
+ ax.plot([1, 2])
+ ax.locator_params(nbins=3)
+ if not nodec:
+ ax.set_xlabel('x-label', fontsize=fontsize)
+ ax.set_ylabel('y-label', fontsize=fontsize)
+ ax.set_title('Title', fontsize=fontsize)
+ else:
+ ax.set_xticklabels('')
+ ax.set_yticklabels('')
+
+
+def example_pcolor(ax, fontsize=12):
+ dx, dy = 0.6, 0.6
+ y, x = np.mgrid[slice(-3, 3 + dy, dy),
+ slice(-3, 3 + dx, dx)]
+ z = (1 - x / 2. + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2)
+ pcm = ax.pcolormesh(x, y, z[:-1, :-1], cmap='RdBu_r', vmin=-1., vmax=1.,
+ rasterized=True)
+ ax.set_xlabel('x-label', fontsize=fontsize)
+ ax.set_ylabel('y-label', fontsize=fontsize)
+ ax.set_title('Title', fontsize=fontsize)
+ return pcm
+
+
+@image_comparison(['constrained_layout1.png'])
+def test_constrained_layout1():
+ """Test constrained_layout for a single subplot"""
+ fig = plt.figure(constrained_layout=True)
+ ax = fig.add_subplot()
+ example_plot(ax, fontsize=24)
+
+
+@image_comparison(['constrained_layout2.png'])
+def test_constrained_layout2():
+ """Test constrained_layout for 2x2 subplots"""
+ fig, axs = plt.subplots(2, 2, constrained_layout=True)
+ for ax in axs.flat:
+ example_plot(ax, fontsize=24)
+
+
+@image_comparison(['constrained_layout3.png'])
+def test_constrained_layout3():
+ """Test constrained_layout for colorbars with subplots"""
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig, axs = plt.subplots(2, 2, constrained_layout=True)
+ for nn, ax in enumerate(axs.flat):
+ pcm = example_pcolor(ax, fontsize=24)
+ if nn == 3:
+ pad = 0.08
+ else:
+ pad = 0.02 # default
+ fig.colorbar(pcm, ax=ax, pad=pad)
+
+
+@image_comparison(['constrained_layout4.png'])
+def test_constrained_layout4():
+ """Test constrained_layout for a single colorbar with subplots"""
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig, axs = plt.subplots(2, 2, constrained_layout=True)
+ for ax in axs.flat:
+ pcm = example_pcolor(ax, fontsize=24)
+ fig.colorbar(pcm, ax=axs, pad=0.01, shrink=0.6)
+
+
+@image_comparison(['constrained_layout5.png'], tol=0.002)
+def test_constrained_layout5():
+ """
+ Test constrained_layout for a single colorbar with subplots,
+ colorbar bottom
+ """
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig, axs = plt.subplots(2, 2, constrained_layout=True)
+ for ax in axs.flat:
+ pcm = example_pcolor(ax, fontsize=24)
+ fig.colorbar(pcm, ax=axs,
+ use_gridspec=False, pad=0.01, shrink=0.6,
+ location='bottom')
+
+
+@image_comparison(['constrained_layout6.png'], tol=0.002)
+def test_constrained_layout6():
+ """Test constrained_layout for nested gridspecs"""
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig = plt.figure(constrained_layout=True)
+ gs = fig.add_gridspec(1, 2, figure=fig)
+ gsl = gs[0].subgridspec(2, 2)
+ gsr = gs[1].subgridspec(1, 2)
+ axsl = []
+ for gs in gsl:
+ ax = fig.add_subplot(gs)
+ axsl += [ax]
+ example_plot(ax, fontsize=12)
+ ax.set_xlabel('x-label\nMultiLine')
+ axsr = []
+ for gs in gsr:
+ ax = fig.add_subplot(gs)
+ axsr += [ax]
+ pcm = example_pcolor(ax, fontsize=12)
+
+ fig.colorbar(pcm, ax=axsr,
+ pad=0.01, shrink=0.99, location='bottom',
+ ticks=ticker.MaxNLocator(nbins=5))
+
+
+def test_constrained_layout7():
+ """Test for proper warning if fig not set in GridSpec"""
+ with pytest.warns(
+ UserWarning, match=('There are no gridspecs with layoutgrids. '
+ 'Possibly did not call parent GridSpec with '
+ 'the "figure" keyword')):
+ fig = plt.figure(constrained_layout=True)
+ gs = gridspec.GridSpec(1, 2)
+ gsl = gridspec.GridSpecFromSubplotSpec(2, 2, gs[0])
+ gsr = gridspec.GridSpecFromSubplotSpec(1, 2, gs[1])
+ for gs in gsl:
+ fig.add_subplot(gs)
+ # need to trigger a draw to get warning
+ fig.draw(fig.canvas.get_renderer())
+
+
+@image_comparison(['constrained_layout8.png'])
+def test_constrained_layout8():
+ """Test for gridspecs that are not completely full"""
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig = plt.figure(figsize=(10, 5), constrained_layout=True)
+ gs = gridspec.GridSpec(3, 5, figure=fig)
+ axs = []
+ for j in [0, 1]:
+ if j == 0:
+ ilist = [1]
+ else:
+ ilist = [0, 4]
+ for i in ilist:
+ ax = fig.add_subplot(gs[j, i])
+ axs += [ax]
+ pcm = example_pcolor(ax, fontsize=9)
+ if i > 0:
+ ax.set_ylabel('')
+ if j < 1:
+ ax.set_xlabel('')
+ ax.set_title('')
+ ax = fig.add_subplot(gs[2, :])
+ axs += [ax]
+ pcm = example_pcolor(ax, fontsize=9)
+
+ fig.colorbar(pcm, ax=axs, pad=0.01, shrink=0.6)
+
+
+@image_comparison(['constrained_layout9.png'])
+def test_constrained_layout9():
+ """Test for handling suptitle and for sharex and sharey"""
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig, axs = plt.subplots(2, 2, constrained_layout=True,
+ sharex=False, sharey=False)
+ for ax in axs.flat:
+ pcm = example_pcolor(ax, fontsize=24)
+ ax.set_xlabel('')
+ ax.set_ylabel('')
+ ax.set_aspect(2.)
+ fig.colorbar(pcm, ax=axs, pad=0.01, shrink=0.6)
+ fig.suptitle('Test Suptitle', fontsize=28)
+
+
+@image_comparison(['constrained_layout10.png'])
+def test_constrained_layout10():
+ """Test for handling legend outside axis"""
+ fig, axs = plt.subplots(2, 2, constrained_layout=True)
+ for ax in axs.flat:
+ ax.plot(np.arange(12), label='This is a label')
+ ax.legend(loc='center left', bbox_to_anchor=(0.8, 0.5))
+
+
+@image_comparison(['constrained_layout11.png'])
+def test_constrained_layout11():
+ """Test for multiple nested gridspecs"""
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig = plt.figure(constrained_layout=True, figsize=(13, 3))
+ gs0 = gridspec.GridSpec(1, 2, figure=fig)
+ gsl = gridspec.GridSpecFromSubplotSpec(1, 2, gs0[0])
+ gsl0 = gridspec.GridSpecFromSubplotSpec(2, 2, gsl[1])
+ ax = fig.add_subplot(gs0[1])
+ example_plot(ax, fontsize=9)
+ axs = []
+ for gs in gsl0:
+ ax = fig.add_subplot(gs)
+ axs += [ax]
+ pcm = example_pcolor(ax, fontsize=9)
+ fig.colorbar(pcm, ax=axs, shrink=0.6, aspect=70.)
+ ax = fig.add_subplot(gsl[0])
+ example_plot(ax, fontsize=9)
+
+
+@image_comparison(['constrained_layout11rat.png'])
+def test_constrained_layout11rat():
+ """Test for multiple nested gridspecs with width_ratios"""
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig = plt.figure(constrained_layout=True, figsize=(10, 3))
+ gs0 = gridspec.GridSpec(1, 2, figure=fig, width_ratios=[6, 1])
+ gsl = gridspec.GridSpecFromSubplotSpec(1, 2, gs0[0])
+ gsl0 = gridspec.GridSpecFromSubplotSpec(2, 2, gsl[1], height_ratios=[2, 1])
+ ax = fig.add_subplot(gs0[1])
+ example_plot(ax, fontsize=9)
+ axs = []
+ for gs in gsl0:
+ ax = fig.add_subplot(gs)
+ axs += [ax]
+ pcm = example_pcolor(ax, fontsize=9)
+ fig.colorbar(pcm, ax=axs, shrink=0.6, aspect=70.)
+ ax = fig.add_subplot(gsl[0])
+ example_plot(ax, fontsize=9)
+
+
+@image_comparison(['constrained_layout12.png'])
+def test_constrained_layout12():
+ """Test that very unbalanced labeling still works."""
+ fig = plt.figure(constrained_layout=True, figsize=(6, 8))
+
+ gs0 = gridspec.GridSpec(6, 2, figure=fig)
+
+ ax1 = fig.add_subplot(gs0[:3, 1])
+ ax2 = fig.add_subplot(gs0[3:, 1])
+
+ example_plot(ax1, fontsize=18)
+ example_plot(ax2, fontsize=18)
+
+ ax = fig.add_subplot(gs0[0:2, 0])
+ example_plot(ax, nodec=True)
+ ax = fig.add_subplot(gs0[2:4, 0])
+ example_plot(ax, nodec=True)
+ ax = fig.add_subplot(gs0[4:, 0])
+ example_plot(ax, nodec=True)
+ ax.set_xlabel('x-label')
+
+
+@image_comparison(['constrained_layout13.png'], tol=2.e-2)
+def test_constrained_layout13():
+ """Test that padding works."""
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig, axs = plt.subplots(2, 2, constrained_layout=True)
+ for ax in axs.flat:
+ pcm = example_pcolor(ax, fontsize=12)
+ fig.colorbar(pcm, ax=ax, shrink=0.6, aspect=20., pad=0.02)
+ fig.set_constrained_layout_pads(w_pad=24./72., h_pad=24./72.)
+
+
+@image_comparison(['constrained_layout14.png'])
+def test_constrained_layout14():
+ """Test that padding works."""
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig, axs = plt.subplots(2, 2, constrained_layout=True)
+ for ax in axs.flat:
+ pcm = example_pcolor(ax, fontsize=12)
+ fig.colorbar(pcm, ax=ax, shrink=0.6, aspect=20., pad=0.02)
+ fig.set_constrained_layout_pads(
+ w_pad=3./72., h_pad=3./72.,
+ hspace=0.2, wspace=0.2)
+
+
+@image_comparison(['constrained_layout15.png'])
+def test_constrained_layout15():
+ """Test that rcparams work."""
+ rcParams['figure.constrained_layout.use'] = True
+ fig, axs = plt.subplots(2, 2)
+ for ax in axs.flat:
+ example_plot(ax, fontsize=12)
+
+
+@image_comparison(['constrained_layout16.png'])
+def test_constrained_layout16():
+ """Test ax.set_position."""
+ fig, ax = plt.subplots(constrained_layout=True)
+ example_plot(ax, fontsize=12)
+ ax2 = fig.add_axes([0.2, 0.2, 0.4, 0.4])
+
+
+@image_comparison(['constrained_layout17.png'])
+def test_constrained_layout17():
+ """Test uneven gridspecs"""
+ fig = plt.figure(constrained_layout=True)
+ gs = gridspec.GridSpec(3, 3, figure=fig)
+
+ ax1 = fig.add_subplot(gs[0, 0])
+ ax2 = fig.add_subplot(gs[0, 1:])
+ ax3 = fig.add_subplot(gs[1:, 0:2])
+ ax4 = fig.add_subplot(gs[1:, -1])
+
+ example_plot(ax1)
+ example_plot(ax2)
+ example_plot(ax3)
+ example_plot(ax4)
+
+
+def test_constrained_layout18():
+ """Test twinx"""
+ fig, ax = plt.subplots(constrained_layout=True)
+ ax2 = ax.twinx()
+ example_plot(ax)
+ example_plot(ax2, fontsize=24)
+ fig.canvas.draw()
+ assert all(ax.get_position().extents == ax2.get_position().extents)
+
+
+def test_constrained_layout19():
+ """Test twiny"""
+ fig, ax = plt.subplots(constrained_layout=True)
+ ax2 = ax.twiny()
+ example_plot(ax)
+ example_plot(ax2, fontsize=24)
+ ax2.set_title('')
+ ax.set_title('')
+ fig.canvas.draw()
+ assert all(ax.get_position().extents == ax2.get_position().extents)
+
+
+def test_constrained_layout20():
+ """Smoke test cl does not mess up added axes"""
+ gx = np.linspace(-5, 5, 4)
+ img = np.hypot(gx, gx[:, None])
+
+ fig = plt.figure()
+ ax = fig.add_axes([0, 0, 1, 1])
+ mesh = ax.pcolormesh(gx, gx, img[:-1, :-1])
+ fig.colorbar(mesh)
+
+
+def test_constrained_layout21():
+ """#11035: repeated calls to suptitle should not alter the layout"""
+ fig, ax = plt.subplots(constrained_layout=True)
+
+ fig.suptitle("Suptitle0")
+ fig.canvas.draw()
+ extents0 = np.copy(ax.get_position().extents)
+
+ fig.suptitle("Suptitle1")
+ fig.canvas.draw()
+ extents1 = np.copy(ax.get_position().extents)
+
+ np.testing.assert_allclose(extents0, extents1)
+
+
+def test_constrained_layout22():
+ """#11035: suptitle should not be include in CL if manually positioned"""
+ fig, ax = plt.subplots(constrained_layout=True)
+
+ fig.canvas.draw()
+ extents0 = np.copy(ax.get_position().extents)
+
+ fig.suptitle("Suptitle", y=0.5)
+ fig.canvas.draw()
+ extents1 = np.copy(ax.get_position().extents)
+
+ np.testing.assert_allclose(extents0, extents1)
+
+
+def test_constrained_layout23():
+ """
+ Comment in #11035: suptitle used to cause an exception when
+ reusing a figure w/ CL with ``clear=True``.
+ """
+
+ for i in range(2):
+ fig = plt.figure(constrained_layout=True, clear=True, num="123")
+ gs = fig.add_gridspec(1, 2)
+ sub = gs[0].subgridspec(2, 2)
+ fig.suptitle("Suptitle{}".format(i))
+
+
+@image_comparison(['test_colorbar_location.png'],
+ remove_text=True, style='mpl20')
+def test_colorbar_location():
+ """
+ Test that colorbar handling is as expected for various complicated
+ cases...
+ """
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig, axs = plt.subplots(4, 5, constrained_layout=True)
+ for ax in axs.flat:
+ pcm = example_pcolor(ax)
+ ax.set_xlabel('')
+ ax.set_ylabel('')
+ fig.colorbar(pcm, ax=axs[:, 1], shrink=0.4)
+ fig.colorbar(pcm, ax=axs[-1, :2], shrink=0.5, location='bottom')
+ fig.colorbar(pcm, ax=axs[0, 2:], shrink=0.5, location='bottom', pad=0.05)
+ fig.colorbar(pcm, ax=axs[-2, 3:], shrink=0.5, location='top')
+ fig.colorbar(pcm, ax=axs[0, 0], shrink=0.5, location='left')
+ fig.colorbar(pcm, ax=axs[1:3, 2], shrink=0.5, location='right')
+
+
+def test_hidden_axes():
+ # test that if we make an axes not visible that constrained_layout
+ # still works. Note the axes still takes space in the layout
+ # (as does a gridspec slot that is empty)
+ fig, axs = plt.subplots(2, 2, constrained_layout=True)
+ axs[0, 1].set_visible(False)
+ fig.canvas.draw()
+ extents1 = np.copy(axs[0, 0].get_position().extents)
+
+ np.testing.assert_allclose(
+ extents1, [0.045552, 0.543288, 0.47819, 0.982638], rtol=1e-5)
+
+
+def test_colorbar_align():
+ for location in ['right', 'left', 'top', 'bottom']:
+ fig, axs = plt.subplots(2, 2, constrained_layout=True)
+ cbs = []
+ for nn, ax in enumerate(axs.flat):
+ ax.tick_params(direction='in')
+ pc = example_pcolor(ax)
+ cb = fig.colorbar(pc, ax=ax, location=location, shrink=0.6,
+ pad=0.04)
+ cbs += [cb]
+ cb.ax.tick_params(direction='in')
+ if nn != 1:
+ cb.ax.xaxis.set_ticks([])
+ cb.ax.yaxis.set_ticks([])
+ ax.set_xticklabels('')
+ ax.set_yticklabels('')
+ fig.set_constrained_layout_pads(w_pad=4 / 72, h_pad=4 / 72, hspace=0.1,
+ wspace=0.1)
+
+ fig.canvas.draw()
+ if location in ['left', 'right']:
+ np.testing.assert_allclose(cbs[0].ax.get_position().x0,
+ cbs[2].ax.get_position().x0)
+ np.testing.assert_allclose(cbs[1].ax.get_position().x0,
+ cbs[3].ax.get_position().x0)
+ else:
+ np.testing.assert_allclose(cbs[0].ax.get_position().y0,
+ cbs[1].ax.get_position().y0)
+ np.testing.assert_allclose(cbs[2].ax.get_position().y0,
+ cbs[3].ax.get_position().y0)
+
+
+@image_comparison(['test_colorbars_no_overlapV.png'],
+ remove_text=False, style='mpl20')
+def test_colorbars_no_overlapV():
+ fig = plt.figure(figsize=(2, 4), constrained_layout=True)
+ axs = fig.subplots(2, 1, sharex=True, sharey=True)
+ for ax in axs:
+ ax.yaxis.set_major_formatter(ticker.NullFormatter())
+ ax.tick_params(axis='both', direction='in')
+ im = ax.imshow([[1, 2], [3, 4]])
+ fig.colorbar(im, ax=ax, orientation="vertical")
+ fig.suptitle("foo")
+
+
+@image_comparison(['test_colorbars_no_overlapH.png'],
+ remove_text=False, style='mpl20')
+def test_colorbars_no_overlapH():
+ fig = plt.figure(figsize=(4, 2), constrained_layout=True)
+ fig.suptitle("foo")
+ axs = fig.subplots(1, 2, sharex=True, sharey=True)
+ for ax in axs:
+ ax.yaxis.set_major_formatter(ticker.NullFormatter())
+ ax.tick_params(axis='both', direction='in')
+ im = ax.imshow([[1, 2], [3, 4]])
+ fig.colorbar(im, ax=ax, orientation="horizontal")
+
+
+def test_manually_set_position():
+ fig, axs = plt.subplots(1, 2, constrained_layout=True)
+ axs[0].set_position([0.2, 0.2, 0.3, 0.3])
+ fig.canvas.draw()
+ pp = axs[0].get_position()
+ np.testing.assert_allclose(pp, [[0.2, 0.2], [0.5, 0.5]])
+
+ fig, axs = plt.subplots(1, 2, constrained_layout=True)
+ axs[0].set_position([0.2, 0.2, 0.3, 0.3])
+ pc = axs[0].pcolormesh(np.random.rand(20, 20))
+ fig.colorbar(pc, ax=axs[0])
+ fig.canvas.draw()
+ pp = axs[0].get_position()
+ np.testing.assert_allclose(pp, [[0.2, 0.2], [0.44, 0.5]])
+
+
+@image_comparison(['test_bboxtight.png'],
+ remove_text=True, style='mpl20',
+ savefig_kwarg={'bbox_inches': 'tight'})
+def test_bboxtight():
+ fig, ax = plt.subplots(constrained_layout=True)
+ ax.set_aspect(1.)
+
+
+@image_comparison(['test_bbox.png'],
+ remove_text=True, style='mpl20',
+ savefig_kwarg={'bbox_inches':
+ mtransforms.Bbox([[0.5, 0], [2.5, 2]])})
+def test_bbox():
+ fig, ax = plt.subplots(constrained_layout=True)
+ ax.set_aspect(1.)
+
+
+def test_align_labels():
+ """
+ Tests for a bug in which constrained layout and align_ylabels on
+ three unevenly sized subplots, one of whose y tick labels include
+ negative numbers, drives the non-negative subplots' y labels off
+ the edge of the plot
+ """
+ fig, (ax3, ax1, ax2) = plt.subplots(3, 1, constrained_layout=True,
+ figsize=(6.4, 8),
+ gridspec_kw={"height_ratios": (1, 1,
+ 0.7)})
+
+ ax1.set_ylim(0, 1)
+ ax1.set_ylabel("Label")
+
+ ax2.set_ylim(-1.5, 1.5)
+ ax2.set_ylabel("Label")
+
+ ax3.set_ylim(0, 1)
+ ax3.set_ylabel("Label")
+
+ fig.align_ylabels(axs=(ax3, ax1, ax2))
+
+ fig.canvas.draw()
+ after_align = [ax1.yaxis.label.get_window_extent(),
+ ax2.yaxis.label.get_window_extent(),
+ ax3.yaxis.label.get_window_extent()]
+ # ensure labels are approximately aligned
+ np.testing.assert_allclose([after_align[0].x0, after_align[2].x0],
+ after_align[1].x0, rtol=0, atol=1e-05)
+ # ensure labels do not go off the edge
+ assert after_align[0].x0 >= 1
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_container.py b/venv/Lib/site-packages/matplotlib/tests/test_container.py
new file mode 100644
index 0000000..8e894d9
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_container.py
@@ -0,0 +1,30 @@
+import matplotlib.pyplot as plt
+
+
+def test_stem_remove():
+ ax = plt.gca()
+ st = ax.stem([1, 2], [1, 2])
+ st.remove()
+
+
+def test_errorbar_remove():
+
+ # Regression test for a bug that caused remove to fail when using
+ # fmt='none'
+
+ ax = plt.gca()
+
+ eb = ax.errorbar([1], [1])
+ eb.remove()
+
+ eb = ax.errorbar([1], [1], xerr=1)
+ eb.remove()
+
+ eb = ax.errorbar([1], [1], yerr=2)
+ eb.remove()
+
+ eb = ax.errorbar([1], [1], xerr=[2], yerr=2)
+ eb.remove()
+
+ eb = ax.errorbar([1], [1], fmt='none')
+ eb.remove()
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_contour.py b/venv/Lib/site-packages/matplotlib/tests/test_contour.py
new file mode 100644
index 0000000..58c15c9
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_contour.py
@@ -0,0 +1,400 @@
+import datetime
+import platform
+import re
+
+import numpy as np
+from numpy.testing import assert_array_almost_equal
+import matplotlib as mpl
+from matplotlib.testing.decorators import image_comparison
+from matplotlib import pyplot as plt, rc_context
+from matplotlib.colors import LogNorm
+import pytest
+
+
+def test_contour_shape_1d_valid():
+
+ x = np.arange(10)
+ y = np.arange(9)
+ z = np.random.random((9, 10))
+
+ fig, ax = plt.subplots()
+ ax.contour(x, y, z)
+
+
+def test_contour_shape_2d_valid():
+
+ x = np.arange(10)
+ y = np.arange(9)
+ xg, yg = np.meshgrid(x, y)
+ z = np.random.random((9, 10))
+
+ fig, ax = plt.subplots()
+ ax.contour(xg, yg, z)
+
+
+@pytest.mark.parametrize("args, message", [
+ ((np.arange(9), np.arange(9), np.empty((9, 10))),
+ 'Length of x (9) must match number of columns in z (10)'),
+ ((np.arange(10), np.arange(10), np.empty((9, 10))),
+ 'Length of y (10) must match number of rows in z (9)'),
+ ((np.empty((10, 10)), np.arange(10), np.empty((9, 10))),
+ 'Number of dimensions of x (2) and y (1) do not match'),
+ ((np.arange(10), np.empty((10, 10)), np.empty((9, 10))),
+ 'Number of dimensions of x (1) and y (2) do not match'),
+ ((np.empty((9, 9)), np.empty((9, 10)), np.empty((9, 10))),
+ 'Shapes of x (9, 9) and z (9, 10) do not match'),
+ ((np.empty((9, 10)), np.empty((9, 9)), np.empty((9, 10))),
+ 'Shapes of y (9, 9) and z (9, 10) do not match'),
+ ((np.empty((3, 3, 3)), np.empty((3, 3, 3)), np.empty((9, 10))),
+ 'Inputs x and y must be 1D or 2D, not 3D'),
+ ((np.empty((3, 3, 3)), np.empty((3, 3, 3)), np.empty((3, 3, 3))),
+ 'Input z must be 2D, not 3D'),
+ (([[0]],), # github issue 8197
+ 'Input z must be at least a (2, 2) shaped array, but has shape (1, 1)'),
+ (([0], [0], [[0]]),
+ 'Input z must be at least a (2, 2) shaped array, but has shape (1, 1)'),
+])
+def test_contour_shape_error(args, message):
+ fig, ax = plt.subplots()
+ with pytest.raises(TypeError, match=re.escape(message)):
+ ax.contour(*args)
+
+
+def test_contour_empty_levels():
+
+ x = np.arange(9)
+ z = np.random.random((9, 9))
+
+ fig, ax = plt.subplots()
+ with pytest.warns(UserWarning) as record:
+ ax.contour(x, x, z, levels=[])
+ assert len(record) == 1
+
+
+def test_contour_Nlevels():
+ # A scalar levels arg or kwarg should trigger auto level generation.
+ # https://github.com/matplotlib/matplotlib/issues/11913
+ z = np.arange(12).reshape((3, 4))
+ fig, ax = plt.subplots()
+ cs1 = ax.contour(z, 5)
+ assert len(cs1.levels) > 1
+ cs2 = ax.contour(z, levels=5)
+ assert (cs1.levels == cs2.levels).all()
+
+
+def test_contour_badlevel_fmt():
+ # Test edge case from https://github.com/matplotlib/matplotlib/issues/9742
+ # User supplied fmt for each level as a dictionary, but Matplotlib changed
+ # the level to the minimum data value because no contours possible.
+ # This was fixed in https://github.com/matplotlib/matplotlib/pull/9743
+ x = np.arange(9)
+ z = np.zeros((9, 9))
+
+ fig, ax = plt.subplots()
+ fmt = {1.: '%1.2f'}
+ with pytest.warns(UserWarning) as record:
+ cs = ax.contour(x, x, z, levels=[1.])
+ ax.clabel(cs, fmt=fmt)
+ assert len(record) == 1
+
+
+def test_contour_uniform_z():
+
+ x = np.arange(9)
+ z = np.ones((9, 9))
+
+ fig, ax = plt.subplots()
+ with pytest.warns(UserWarning) as record:
+ ax.contour(x, x, z)
+ assert len(record) == 1
+
+
+@image_comparison(['contour_manual_labels'], remove_text=True, style='mpl20')
+def test_contour_manual_labels():
+ x, y = np.meshgrid(np.arange(0, 10), np.arange(0, 10))
+ z = np.max(np.dstack([abs(x), abs(y)]), 2)
+
+ plt.figure(figsize=(6, 2), dpi=200)
+ cs = plt.contour(x, y, z)
+ pts = np.array([(1.0, 3.0), (1.0, 4.4), (1.0, 6.0)])
+ plt.clabel(cs, manual=pts)
+ pts = np.array([(2.0, 3.0), (2.0, 4.4), (2.0, 6.0)])
+ plt.clabel(cs, manual=pts, fontsize='small', colors=('r', 'g'))
+
+
+@image_comparison(['contour_manual_colors_and_levels.png'], remove_text=True)
+def test_given_colors_levels_and_extends():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ _, axs = plt.subplots(2, 4)
+
+ data = np.arange(12).reshape(3, 4)
+
+ colors = ['red', 'yellow', 'pink', 'blue', 'black']
+ levels = [2, 4, 8, 10]
+
+ for i, ax in enumerate(axs.flat):
+ filled = i % 2 == 0.
+ extend = ['neither', 'min', 'max', 'both'][i // 2]
+
+ if filled:
+ # If filled, we have 3 colors with no extension,
+ # 4 colors with one extension, and 5 colors with both extensions
+ first_color = 1 if extend in ['max', 'neither'] else None
+ last_color = -1 if extend in ['min', 'neither'] else None
+ c = ax.contourf(data, colors=colors[first_color:last_color],
+ levels=levels, extend=extend)
+ else:
+ # If not filled, we have 4 levels and 4 colors
+ c = ax.contour(data, colors=colors[:-1],
+ levels=levels, extend=extend)
+
+ plt.colorbar(c, ax=ax)
+
+
+@image_comparison(['contour_datetime_axis.png'],
+ remove_text=False, style='mpl20')
+def test_contour_datetime_axis():
+ fig = plt.figure()
+ fig.subplots_adjust(hspace=0.4, top=0.98, bottom=.15)
+ base = datetime.datetime(2013, 1, 1)
+ x = np.array([base + datetime.timedelta(days=d) for d in range(20)])
+ y = np.arange(20)
+ z1, z2 = np.meshgrid(np.arange(20), np.arange(20))
+ z = z1 * z2
+ plt.subplot(221)
+ plt.contour(x, y, z)
+ plt.subplot(222)
+ plt.contourf(x, y, z)
+ x = np.repeat(x[np.newaxis], 20, axis=0)
+ y = np.repeat(y[:, np.newaxis], 20, axis=1)
+ plt.subplot(223)
+ plt.contour(x, y, z)
+ plt.subplot(224)
+ plt.contourf(x, y, z)
+ for ax in fig.get_axes():
+ for label in ax.get_xticklabels():
+ label.set_ha('right')
+ label.set_rotation(30)
+
+
+@image_comparison(['contour_test_label_transforms.png'],
+ remove_text=True, style='mpl20',
+ tol=0 if platform.machine() == 'x86_64' else 0.08)
+def test_labels():
+ # Adapted from pylab_examples example code: contour_demo.py
+ # see issues #2475, #2843, and #2818 for explanation
+ delta = 0.025
+ x = np.arange(-3.0, 3.0, delta)
+ y = np.arange(-2.0, 2.0, delta)
+ X, Y = np.meshgrid(x, y)
+ Z1 = np.exp(-(X**2 + Y**2) / 2) / (2 * np.pi)
+ Z2 = (np.exp(-(((X - 1) / 1.5)**2 + ((Y - 1) / 0.5)**2) / 2) /
+ (2 * np.pi * 0.5 * 1.5))
+
+ # difference of Gaussians
+ Z = 10.0 * (Z2 - Z1)
+
+ fig, ax = plt.subplots(1, 1)
+ CS = ax.contour(X, Y, Z)
+ disp_units = [(216, 177), (359, 290), (521, 406)]
+ data_units = [(-2, .5), (0, -1.5), (2.8, 1)]
+
+ CS.clabel()
+
+ for x, y in data_units:
+ CS.add_label_near(x, y, inline=True, transform=None)
+
+ for x, y in disp_units:
+ CS.add_label_near(x, y, inline=True, transform=False)
+
+
+@image_comparison(['contour_corner_mask_False.png',
+ 'contour_corner_mask_True.png'],
+ remove_text=True)
+def test_corner_mask():
+ n = 60
+ mask_level = 0.95
+ noise_amp = 1.0
+ np.random.seed([1])
+ x, y = np.meshgrid(np.linspace(0, 2.0, n), np.linspace(0, 2.0, n))
+ z = np.cos(7*x)*np.sin(8*y) + noise_amp*np.random.rand(n, n)
+ mask = np.random.rand(n, n) >= mask_level
+ z = np.ma.array(z, mask=mask)
+
+ for corner_mask in [False, True]:
+ plt.figure()
+ plt.contourf(z, corner_mask=corner_mask)
+
+
+def test_contourf_decreasing_levels():
+ # github issue 5477.
+ z = [[0.1, 0.3], [0.5, 0.7]]
+ plt.figure()
+ with pytest.raises(ValueError):
+ plt.contourf(z, [1.0, 0.0])
+
+
+def test_contourf_symmetric_locator():
+ # github issue 7271
+ z = np.arange(12).reshape((3, 4))
+ locator = plt.MaxNLocator(nbins=4, symmetric=True)
+ cs = plt.contourf(z, locator=locator)
+ assert_array_almost_equal(cs.levels, np.linspace(-12, 12, 5))
+
+
+@pytest.mark.parametrize("args, cls, message", [
+ ((), TypeError,
+ 'function takes exactly 6 arguments (0 given)'),
+ ((1, 2, 3, 4, 5, 6), ValueError,
+ 'Expected 2-dimensional array, got 0'),
+ (([[0]], [[0]], [[]], None, True, 0), ValueError,
+ 'x, y and z must all be 2D arrays with the same dimensions'),
+ (([[0]], [[0]], [[0]], None, True, 0), ValueError,
+ 'x, y and z must all be at least 2x2 arrays'),
+ ((*[np.arange(4).reshape((2, 2))] * 3, [[0]], True, 0), ValueError,
+ 'If mask is set it must be a 2D array with the same dimensions as x.'),
+])
+def test_internal_cpp_api(args, cls, message): # Github issue 8197.
+ from matplotlib import _contour # noqa: ensure lazy-loaded module *is* loaded.
+ with pytest.raises(cls, match=re.escape(message)):
+ mpl._contour.QuadContourGenerator(*args)
+
+
+def test_internal_cpp_api_2():
+ from matplotlib import _contour # noqa: ensure lazy-loaded module *is* loaded.
+ arr = [[0, 1], [2, 3]]
+ qcg = mpl._contour.QuadContourGenerator(arr, arr, arr, None, True, 0)
+ with pytest.raises(
+ ValueError, match=r'filled contour levels must be increasing'):
+ qcg.create_filled_contour(1, 0)
+
+
+def test_circular_contour_warning():
+ # Check that almost circular contours don't throw a warning
+ x, y = np.meshgrid(np.linspace(-2, 2, 4), np.linspace(-2, 2, 4))
+ r = np.hypot(x, y)
+ plt.figure()
+ cs = plt.contour(x, y, r)
+ plt.clabel(cs)
+
+
+@pytest.mark.parametrize("use_clabeltext, contour_zorder, clabel_zorder",
+ [(True, 123, 1234), (False, 123, 1234),
+ (True, 123, None), (False, 123, None)])
+def test_clabel_zorder(use_clabeltext, contour_zorder, clabel_zorder):
+ x, y = np.meshgrid(np.arange(0, 10), np.arange(0, 10))
+ z = np.max(np.dstack([abs(x), abs(y)]), 2)
+
+ fig, (ax1, ax2) = plt.subplots(ncols=2)
+ cs = ax1.contour(x, y, z, zorder=contour_zorder)
+ cs_filled = ax2.contourf(x, y, z, zorder=contour_zorder)
+ clabels1 = cs.clabel(zorder=clabel_zorder, use_clabeltext=use_clabeltext)
+ clabels2 = cs_filled.clabel(zorder=clabel_zorder,
+ use_clabeltext=use_clabeltext)
+
+ if clabel_zorder is None:
+ expected_clabel_zorder = 2+contour_zorder
+ else:
+ expected_clabel_zorder = clabel_zorder
+
+ for clabel in clabels1:
+ assert clabel.get_zorder() == expected_clabel_zorder
+ for clabel in clabels2:
+ assert clabel.get_zorder() == expected_clabel_zorder
+
+
+@image_comparison(['contour_log_extension.png'],
+ remove_text=True, style='mpl20')
+def test_contourf_log_extension():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ # Test that contourf with lognorm is extended correctly
+ fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(10, 5))
+ fig.subplots_adjust(left=0.05, right=0.95)
+
+ # make data set with large range e.g. between 1e-8 and 1e10
+ data_exp = np.linspace(-7.5, 9.5, 1200)
+ data = np.power(10, data_exp).reshape(30, 40)
+ # make manual levels e.g. between 1e-4 and 1e-6
+ levels_exp = np.arange(-4., 7.)
+ levels = np.power(10., levels_exp)
+
+ # original data
+ c1 = ax1.contourf(data,
+ norm=LogNorm(vmin=data.min(), vmax=data.max()))
+ # just show data in levels
+ c2 = ax2.contourf(data, levels=levels,
+ norm=LogNorm(vmin=levels.min(), vmax=levels.max()),
+ extend='neither')
+ # extend data from levels
+ c3 = ax3.contourf(data, levels=levels,
+ norm=LogNorm(vmin=levels.min(), vmax=levels.max()),
+ extend='both')
+ cb = plt.colorbar(c1, ax=ax1)
+ assert cb.ax.get_ylim() == (1e-8, 1e10)
+ cb = plt.colorbar(c2, ax=ax2)
+ assert cb.ax.get_ylim() == (1e-4, 1e6)
+ cb = plt.colorbar(c3, ax=ax3)
+ assert_array_almost_equal(
+ cb.ax.get_ylim(), [3.162277660168379e-05, 3162277.660168383], 2)
+
+
+@image_comparison(['contour_addlines.png'],
+ remove_text=True, style='mpl20', tol=0.03)
+# tolerance is because image changed minutely when tick finding on
+# colorbars was cleaned up...
+def test_contour_addlines():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig, ax = plt.subplots()
+ np.random.seed(19680812)
+ X = np.random.rand(10, 10)*10000
+ pcm = ax.pcolormesh(X)
+ # add 1000 to make colors visible...
+ cont = ax.contour(X+1000)
+ cb = fig.colorbar(pcm)
+ cb.add_lines(cont)
+ assert_array_almost_equal(cb.ax.get_ylim(), [114.3091, 9972.30735], 3)
+
+
+@image_comparison(baseline_images=['contour_uneven'],
+ extensions=['png'], remove_text=True, style='mpl20')
+def test_contour_uneven():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ z = np.arange(24).reshape(4, 6)
+ fig, axs = plt.subplots(1, 2)
+ ax = axs[0]
+ cs = ax.contourf(z, levels=[2, 4, 6, 10, 20])
+ fig.colorbar(cs, ax=ax, spacing='proportional')
+ ax = axs[1]
+ cs = ax.contourf(z, levels=[2, 4, 6, 10, 20])
+ fig.colorbar(cs, ax=ax, spacing='uniform')
+
+
+@pytest.mark.parametrize(
+ "rc_lines_linewidth, rc_contour_linewidth, call_linewidths, expected", [
+ (1.23, None, None, 1.23),
+ (1.23, 4.24, None, 4.24),
+ (1.23, 4.24, 5.02, 5.02)
+ ])
+def test_contour_linewidth(
+ rc_lines_linewidth, rc_contour_linewidth, call_linewidths, expected):
+
+ with rc_context(rc={"lines.linewidth": rc_lines_linewidth,
+ "contour.linewidth": rc_contour_linewidth}):
+ fig, ax = plt.subplots()
+ X = np.arange(4*3).reshape(4, 3)
+ cs = ax.contour(X, linewidths=call_linewidths)
+ assert cs.tlinewidths[0][0] == expected
+
+
+@pytest.mark.backend("pdf")
+def test_label_nonagg():
+ # This should not crash even if the canvas doesn't have a get_renderer().
+ plt.clabel(plt.contour([[1, 2], [3, 4]]))
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_cycles.py b/venv/Lib/site-packages/matplotlib/tests/test_cycles.py
new file mode 100644
index 0000000..2cf086b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_cycles.py
@@ -0,0 +1,160 @@
+import matplotlib as mpl
+import matplotlib.pyplot as plt
+import numpy as np
+import pytest
+
+from cycler import cycler
+
+
+def test_colorcycle_basic():
+ fig, ax = plt.subplots()
+ ax.set_prop_cycle(cycler('color', ['r', 'g', 'y']))
+ for _ in range(4):
+ ax.plot(range(10), range(10))
+ assert [l.get_color() for l in ax.lines] == ['r', 'g', 'y', 'r']
+
+
+def test_marker_cycle():
+ fig, ax = plt.subplots()
+ ax.set_prop_cycle(cycler('c', ['r', 'g', 'y']) +
+ cycler('marker', ['.', '*', 'x']))
+ for _ in range(4):
+ ax.plot(range(10), range(10))
+ assert [l.get_color() for l in ax.lines] == ['r', 'g', 'y', 'r']
+ assert [l.get_marker() for l in ax.lines] == ['.', '*', 'x', '.']
+
+
+def test_marker_cycle_kwargs_arrays_iterators():
+ fig, ax = plt.subplots()
+ ax.set_prop_cycle(c=np.array(['r', 'g', 'y']),
+ marker=iter(['.', '*', 'x']))
+ for _ in range(4):
+ ax.plot(range(10), range(10))
+ assert [l.get_color() for l in ax.lines] == ['r', 'g', 'y', 'r']
+ assert [l.get_marker() for l in ax.lines] == ['.', '*', 'x', '.']
+
+
+def test_linestylecycle_basic():
+ fig, ax = plt.subplots()
+ ax.set_prop_cycle(cycler('ls', ['-', '--', ':']))
+ for _ in range(4):
+ ax.plot(range(10), range(10))
+ assert [l.get_linestyle() for l in ax.lines] == ['-', '--', ':', '-']
+
+
+def test_fillcycle_basic():
+ fig, ax = plt.subplots()
+ ax.set_prop_cycle(cycler('c', ['r', 'g', 'y']) +
+ cycler('hatch', ['xx', 'O', '|-']) +
+ cycler('linestyle', ['-', '--', ':']))
+ for _ in range(4):
+ ax.fill(range(10), range(10))
+ assert ([p.get_facecolor() for p in ax.patches]
+ == [mpl.colors.to_rgba(c) for c in ['r', 'g', 'y', 'r']])
+ assert [p.get_hatch() for p in ax.patches] == ['xx', 'O', '|-', 'xx']
+ assert [p.get_linestyle() for p in ax.patches] == ['-', '--', ':', '-']
+
+
+def test_fillcycle_ignore():
+ fig, ax = plt.subplots()
+ ax.set_prop_cycle(cycler('color', ['r', 'g', 'y']) +
+ cycler('hatch', ['xx', 'O', '|-']) +
+ cycler('marker', ['.', '*', 'D']))
+ t = range(10)
+ # Should not advance the cycler, even though there is an
+ # unspecified property in the cycler "marker".
+ # "marker" is not a Polygon property, and should be ignored.
+ ax.fill(t, t, 'r', hatch='xx')
+ # Allow the cycler to advance, but specify some properties
+ ax.fill(t, t, hatch='O')
+ ax.fill(t, t)
+ ax.fill(t, t)
+ assert ([p.get_facecolor() for p in ax.patches]
+ == [mpl.colors.to_rgba(c) for c in ['r', 'r', 'g', 'y']])
+ assert [p.get_hatch() for p in ax.patches] == ['xx', 'O', 'O', '|-']
+
+
+def test_property_collision_plot():
+ fig, ax = plt.subplots()
+ ax.set_prop_cycle('linewidth', [2, 4])
+ t = range(10)
+ for c in range(1, 4):
+ ax.plot(t, t, lw=0.1)
+ ax.plot(t, t)
+ ax.plot(t, t)
+ assert [l.get_linewidth() for l in ax.lines] == [0.1, 0.1, 0.1, 2, 4]
+
+
+def test_property_collision_fill():
+ fig, ax = plt.subplots()
+ ax.set_prop_cycle(linewidth=[2, 3, 4, 5, 6], facecolor='bgcmy')
+ t = range(10)
+ for c in range(1, 4):
+ ax.fill(t, t, lw=0.1)
+ ax.fill(t, t)
+ ax.fill(t, t)
+ assert ([p.get_facecolor() for p in ax.patches]
+ == [mpl.colors.to_rgba(c) for c in 'bgcmy'])
+ assert [p.get_linewidth() for p in ax.patches] == [0.1, 0.1, 0.1, 5, 6]
+
+
+def test_valid_input_forms():
+ fig, ax = plt.subplots()
+ # These should not raise an error.
+ ax.set_prop_cycle(None)
+ ax.set_prop_cycle(cycler('linewidth', [1, 2]))
+ ax.set_prop_cycle('color', 'rgywkbcm')
+ ax.set_prop_cycle('lw', (1, 2))
+ ax.set_prop_cycle('linewidth', [1, 2])
+ ax.set_prop_cycle('linewidth', iter([1, 2]))
+ ax.set_prop_cycle('linewidth', np.array([1, 2]))
+ ax.set_prop_cycle('color', np.array([[1, 0, 0],
+ [0, 1, 0],
+ [0, 0, 1]]))
+ ax.set_prop_cycle('dashes', [[], [13, 2], [8, 3, 1, 3]])
+ ax.set_prop_cycle(lw=[1, 2], color=['k', 'w'], ls=['-', '--'])
+ ax.set_prop_cycle(lw=np.array([1, 2]),
+ color=np.array(['k', 'w']),
+ ls=np.array(['-', '--']))
+
+
+def test_cycle_reset():
+ fig, ax = plt.subplots()
+
+ # Can't really test a reset because only a cycle object is stored
+ # but we can test the first item of the cycle.
+ prop = next(ax._get_lines.prop_cycler)
+ ax.set_prop_cycle(linewidth=[10, 9, 4])
+ assert prop != next(ax._get_lines.prop_cycler)
+ ax.set_prop_cycle(None)
+ got = next(ax._get_lines.prop_cycler)
+ assert prop == got
+
+
+def test_invalid_input_forms():
+ fig, ax = plt.subplots()
+
+ with pytest.raises((TypeError, ValueError)):
+ ax.set_prop_cycle(1)
+ with pytest.raises((TypeError, ValueError)):
+ ax.set_prop_cycle([1, 2])
+
+ with pytest.raises((TypeError, ValueError)):
+ ax.set_prop_cycle('color', 'fish')
+
+ with pytest.raises((TypeError, ValueError)):
+ ax.set_prop_cycle('linewidth', 1)
+ with pytest.raises((TypeError, ValueError)):
+ ax.set_prop_cycle('linewidth', {1, 2})
+ with pytest.raises((TypeError, ValueError)):
+ ax.set_prop_cycle(linewidth=1, color='r')
+
+ with pytest.raises((TypeError, ValueError)):
+ ax.set_prop_cycle('foobar', [1, 2])
+ with pytest.raises((TypeError, ValueError)):
+ ax.set_prop_cycle(foobar=[1, 2])
+
+ with pytest.raises((TypeError, ValueError)):
+ ax.set_prop_cycle(cycler(foobar=[1, 2]))
+ with pytest.raises(ValueError):
+ ax.set_prop_cycle(cycler(color='rgb', c='cmy'))
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_dates.py b/venv/Lib/site-packages/matplotlib/tests/test_dates.py
new file mode 100644
index 0000000..8c821c0
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_dates.py
@@ -0,0 +1,1107 @@
+import datetime
+
+import dateutil.tz
+import dateutil.rrule
+import functools
+import numpy as np
+import pytest
+
+from matplotlib import rc_context
+import matplotlib.dates as mdates
+import matplotlib.pyplot as plt
+from matplotlib.testing.decorators import image_comparison
+import matplotlib.ticker as mticker
+
+
+def test_date_numpyx():
+ # test that numpy dates work properly...
+ base = datetime.datetime(2017, 1, 1)
+ time = [base + datetime.timedelta(days=x) for x in range(0, 3)]
+ timenp = np.array(time, dtype='datetime64[ns]')
+ data = np.array([0., 2., 1.])
+ fig = plt.figure(figsize=(10, 2))
+ ax = fig.add_subplot(1, 1, 1)
+ h, = ax.plot(time, data)
+ hnp, = ax.plot(timenp, data)
+ np.testing.assert_equal(h.get_xdata(orig=False), hnp.get_xdata(orig=False))
+ fig = plt.figure(figsize=(10, 2))
+ ax = fig.add_subplot(1, 1, 1)
+ h, = ax.plot(data, time)
+ hnp, = ax.plot(data, timenp)
+ np.testing.assert_equal(h.get_ydata(orig=False), hnp.get_ydata(orig=False))
+
+
+@pytest.mark.parametrize('t0', [datetime.datetime(2017, 1, 1, 0, 1, 1),
+
+ [datetime.datetime(2017, 1, 1, 0, 1, 1),
+ datetime.datetime(2017, 1, 1, 1, 1, 1)],
+
+ [[datetime.datetime(2017, 1, 1, 0, 1, 1),
+ datetime.datetime(2017, 1, 1, 1, 1, 1)],
+ [datetime.datetime(2017, 1, 1, 2, 1, 1),
+ datetime.datetime(2017, 1, 1, 3, 1, 1)]]])
+@pytest.mark.parametrize('dtype', ['datetime64[s]',
+ 'datetime64[us]',
+ 'datetime64[ms]',
+ 'datetime64[ns]'])
+def test_date_date2num_numpy(t0, dtype):
+ time = mdates.date2num(t0)
+ tnp = np.array(t0, dtype=dtype)
+ nptime = mdates.date2num(tnp)
+ np.testing.assert_equal(time, nptime)
+
+
+@pytest.mark.parametrize('dtype', ['datetime64[s]',
+ 'datetime64[us]',
+ 'datetime64[ms]',
+ 'datetime64[ns]'])
+def test_date2num_NaT(dtype):
+ t0 = datetime.datetime(2017, 1, 1, 0, 1, 1)
+ tmpl = [mdates.date2num(t0), np.nan]
+ tnp = np.array([t0, 'NaT'], dtype=dtype)
+ nptime = mdates.date2num(tnp)
+ np.testing.assert_array_equal(tmpl, nptime)
+
+
+@pytest.mark.parametrize('units', ['s', 'ms', 'us', 'ns'])
+def test_date2num_NaT_scalar(units):
+ tmpl = mdates.date2num(np.datetime64('NaT', units))
+ assert np.isnan(tmpl)
+
+
+@image_comparison(['date_empty.png'])
+def test_date_empty():
+ # make sure we do the right thing when told to plot dates even
+ # if no date data has been presented, cf
+ # http://sourceforge.net/tracker/?func=detail&aid=2850075&group_id=80706&atid=560720
+ fig, ax = plt.subplots()
+ ax.xaxis_date()
+
+
+@image_comparison(['date_axhspan.png'])
+def test_date_axhspan():
+ # test axhspan with date inputs
+ t0 = datetime.datetime(2009, 1, 20)
+ tf = datetime.datetime(2009, 1, 21)
+ fig, ax = plt.subplots()
+ ax.axhspan(t0, tf, facecolor="blue", alpha=0.25)
+ ax.set_ylim(t0 - datetime.timedelta(days=5),
+ tf + datetime.timedelta(days=5))
+ fig.subplots_adjust(left=0.25)
+
+
+@image_comparison(['date_axvspan.png'])
+def test_date_axvspan():
+ # test axvspan with date inputs
+ t0 = datetime.datetime(2000, 1, 20)
+ tf = datetime.datetime(2010, 1, 21)
+ fig, ax = plt.subplots()
+ ax.axvspan(t0, tf, facecolor="blue", alpha=0.25)
+ ax.set_xlim(t0 - datetime.timedelta(days=720),
+ tf + datetime.timedelta(days=720))
+ fig.autofmt_xdate()
+
+
+@image_comparison(['date_axhline.png'])
+def test_date_axhline():
+ # test axhline with date inputs
+ t0 = datetime.datetime(2009, 1, 20)
+ tf = datetime.datetime(2009, 1, 31)
+ fig, ax = plt.subplots()
+ ax.axhline(t0, color="blue", lw=3)
+ ax.set_ylim(t0 - datetime.timedelta(days=5),
+ tf + datetime.timedelta(days=5))
+ fig.subplots_adjust(left=0.25)
+
+
+@image_comparison(['date_axvline.png'])
+def test_date_axvline():
+ # test axvline with date inputs
+ t0 = datetime.datetime(2000, 1, 20)
+ tf = datetime.datetime(2000, 1, 21)
+ fig, ax = plt.subplots()
+ ax.axvline(t0, color="red", lw=3)
+ ax.set_xlim(t0 - datetime.timedelta(days=5),
+ tf + datetime.timedelta(days=5))
+ fig.autofmt_xdate()
+
+
+def test_too_many_date_ticks(caplog):
+ # Attempt to test SF 2715172, see
+ # https://sourceforge.net/tracker/?func=detail&aid=2715172&group_id=80706&atid=560720
+ # setting equal datetimes triggers and expander call in
+ # transforms.nonsingular which results in too many ticks in the
+ # DayLocator. This should emit a log at WARNING level.
+ caplog.set_level("WARNING")
+ t0 = datetime.datetime(2000, 1, 20)
+ tf = datetime.datetime(2000, 1, 20)
+ fig, ax = plt.subplots()
+ with pytest.warns(UserWarning) as rec:
+ ax.set_xlim((t0, tf), auto=True)
+ assert len(rec) == 1
+ assert \
+ 'Attempting to set identical left == right' in str(rec[0].message)
+ ax.plot([], [])
+ ax.xaxis.set_major_locator(mdates.DayLocator())
+ v = ax.xaxis.get_major_locator()()
+ assert len(v) > 1000
+ # The warning is emitted multiple times because the major locator is also
+ # called both when placing the minor ticks (for overstriking detection) and
+ # during tick label positioning.
+ assert caplog.records and all(
+ record.name == "matplotlib.ticker" and record.levelname == "WARNING"
+ for record in caplog.records)
+ assert len(caplog.records) > 0
+
+
+def _new_epoch_decorator(thefunc):
+ @functools.wraps(thefunc)
+ def wrapper():
+ mdates._reset_epoch_test_example()
+ mdates.set_epoch('2000-01-01')
+ thefunc()
+ mdates._reset_epoch_test_example()
+ return wrapper
+
+
+@image_comparison(['RRuleLocator_bounds.png'])
+def test_RRuleLocator():
+ import matplotlib.testing.jpl_units as units
+ units.register()
+ # This will cause the RRuleLocator to go out of bounds when it tries
+ # to add padding to the limits, so we make sure it caps at the correct
+ # boundary values.
+ t0 = datetime.datetime(1000, 1, 1)
+ tf = datetime.datetime(6000, 1, 1)
+
+ fig = plt.figure()
+ ax = plt.subplot()
+ ax.set_autoscale_on(True)
+ ax.plot([t0, tf], [0.0, 1.0], marker='o')
+
+ rrule = mdates.rrulewrapper(dateutil.rrule.YEARLY, interval=500)
+ locator = mdates.RRuleLocator(rrule)
+ ax.xaxis.set_major_locator(locator)
+ ax.xaxis.set_major_formatter(mdates.AutoDateFormatter(locator))
+
+ ax.autoscale_view()
+ fig.autofmt_xdate()
+
+
+def test_RRuleLocator_dayrange():
+ loc = mdates.DayLocator()
+ x1 = datetime.datetime(year=1, month=1, day=1, tzinfo=mdates.UTC)
+ y1 = datetime.datetime(year=1, month=1, day=16, tzinfo=mdates.UTC)
+ loc.tick_values(x1, y1)
+ # On success, no overflow error shall be thrown
+
+
+@image_comparison(['DateFormatter_fractionalSeconds.png'])
+def test_DateFormatter():
+ import matplotlib.testing.jpl_units as units
+ units.register()
+
+ # Lets make sure that DateFormatter will allow us to have tick marks
+ # at intervals of fractional seconds.
+
+ t0 = datetime.datetime(2001, 1, 1, 0, 0, 0)
+ tf = datetime.datetime(2001, 1, 1, 0, 0, 1)
+
+ fig = plt.figure()
+ ax = plt.subplot()
+ ax.set_autoscale_on(True)
+ ax.plot([t0, tf], [0.0, 1.0], marker='o')
+
+ # rrule = mpldates.rrulewrapper( dateutil.rrule.YEARLY, interval=500 )
+ # locator = mpldates.RRuleLocator( rrule )
+ # ax.xaxis.set_major_locator( locator )
+ # ax.xaxis.set_major_formatter( mpldates.AutoDateFormatter(locator) )
+
+ ax.autoscale_view()
+ fig.autofmt_xdate()
+
+
+def test_locator_set_formatter():
+ """
+ Test if setting the locator only will update the AutoDateFormatter to use
+ the new locator.
+ """
+ plt.rcParams["date.autoformatter.minute"] = "%d %H:%M"
+ t = [datetime.datetime(2018, 9, 30, 8, 0),
+ datetime.datetime(2018, 9, 30, 8, 59),
+ datetime.datetime(2018, 9, 30, 10, 30)]
+ x = [2, 3, 1]
+
+ fig, ax = plt.subplots()
+ ax.plot(t, x)
+ ax.xaxis.set_major_locator(mdates.MinuteLocator((0, 30)))
+ fig.canvas.draw()
+ ticklabels = [tl.get_text() for tl in ax.get_xticklabels()]
+ expected = ['30 08:00', '30 08:30', '30 09:00',
+ '30 09:30', '30 10:00', '30 10:30']
+ assert ticklabels == expected
+
+ ax.xaxis.set_major_locator(mticker.NullLocator())
+ ax.xaxis.set_minor_locator(mdates.MinuteLocator((5, 55)))
+ decoy_loc = mdates.MinuteLocator((12, 27))
+ ax.xaxis.set_minor_formatter(mdates.AutoDateFormatter(decoy_loc))
+
+ ax.xaxis.set_minor_locator(mdates.MinuteLocator((15, 45)))
+ fig.canvas.draw()
+ ticklabels = [tl.get_text() for tl in ax.get_xticklabels(which="minor")]
+ expected = ['30 08:15', '30 08:45', '30 09:15', '30 09:45', '30 10:15']
+ assert ticklabels == expected
+
+
+def test_date_formatter_callable():
+
+ class _Locator:
+ def _get_unit(self): return -11
+
+ def callable_formatting_function(dates, _):
+ return [dt.strftime('%d-%m//%Y') for dt in dates]
+
+ formatter = mdates.AutoDateFormatter(_Locator())
+ formatter.scaled[-10] = callable_formatting_function
+ assert formatter([datetime.datetime(2014, 12, 25)]) == ['25-12//2014']
+
+
+@pytest.mark.parametrize('delta, expected', [
+ (datetime.timedelta(weeks=52 * 200),
+ [r'$\mathdefault{%d}$' % (year,) for year in range(1990, 2171, 20)]),
+ (datetime.timedelta(days=30),
+ [r'$\mathdefault{Jan %02d 1990}$' % (day,) for day in range(1, 32, 3)]),
+ (datetime.timedelta(hours=20),
+ [r'$\mathdefault{%02d:00:00}$' % (hour,) for hour in range(0, 21, 2)]),
+])
+def test_date_formatter_usetex(delta, expected):
+ d1 = datetime.datetime(1990, 1, 1)
+ d2 = d1 + delta
+
+ locator = mdates.AutoDateLocator(interval_multiples=False)
+ locator.create_dummy_axis()
+ locator.set_view_interval(mdates.date2num(d1), mdates.date2num(d2))
+
+ formatter = mdates.AutoDateFormatter(locator, usetex=True)
+ assert [formatter(loc) for loc in locator()] == expected
+
+
+def test_drange():
+ """
+ This test should check if drange works as expected, and if all the
+ rounding errors are fixed
+ """
+ start = datetime.datetime(2011, 1, 1, tzinfo=mdates.UTC)
+ end = datetime.datetime(2011, 1, 2, tzinfo=mdates.UTC)
+ delta = datetime.timedelta(hours=1)
+ # We expect 24 values in drange(start, end, delta), because drange returns
+ # dates from an half open interval [start, end)
+ assert len(mdates.drange(start, end, delta)) == 24
+
+ # if end is a little bit later, we expect the range to contain one element
+ # more
+ end = end + datetime.timedelta(microseconds=1)
+ assert len(mdates.drange(start, end, delta)) == 25
+
+ # reset end
+ end = datetime.datetime(2011, 1, 2, tzinfo=mdates.UTC)
+
+ # and tst drange with "complicated" floats:
+ # 4 hours = 1/6 day, this is an "dangerous" float
+ delta = datetime.timedelta(hours=4)
+ daterange = mdates.drange(start, end, delta)
+ assert len(daterange) == 6
+ assert mdates.num2date(daterange[-1]) == (end - delta)
+
+
+@_new_epoch_decorator
+def test_auto_date_locator():
+ def _create_auto_date_locator(date1, date2):
+ locator = mdates.AutoDateLocator(interval_multiples=False)
+ locator.create_dummy_axis()
+ locator.set_view_interval(mdates.date2num(date1),
+ mdates.date2num(date2))
+ return locator
+
+ d1 = datetime.datetime(1990, 1, 1)
+ results = ([datetime.timedelta(weeks=52 * 200),
+ ['1990-01-01 00:00:00+00:00', '2010-01-01 00:00:00+00:00',
+ '2030-01-01 00:00:00+00:00', '2050-01-01 00:00:00+00:00',
+ '2070-01-01 00:00:00+00:00', '2090-01-01 00:00:00+00:00',
+ '2110-01-01 00:00:00+00:00', '2130-01-01 00:00:00+00:00',
+ '2150-01-01 00:00:00+00:00', '2170-01-01 00:00:00+00:00']
+ ],
+ [datetime.timedelta(weeks=52),
+ ['1990-01-01 00:00:00+00:00', '1990-02-01 00:00:00+00:00',
+ '1990-03-01 00:00:00+00:00', '1990-04-01 00:00:00+00:00',
+ '1990-05-01 00:00:00+00:00', '1990-06-01 00:00:00+00:00',
+ '1990-07-01 00:00:00+00:00', '1990-08-01 00:00:00+00:00',
+ '1990-09-01 00:00:00+00:00', '1990-10-01 00:00:00+00:00',
+ '1990-11-01 00:00:00+00:00', '1990-12-01 00:00:00+00:00']
+ ],
+ [datetime.timedelta(days=141),
+ ['1990-01-05 00:00:00+00:00', '1990-01-26 00:00:00+00:00',
+ '1990-02-16 00:00:00+00:00', '1990-03-09 00:00:00+00:00',
+ '1990-03-30 00:00:00+00:00', '1990-04-20 00:00:00+00:00',
+ '1990-05-11 00:00:00+00:00']
+ ],
+ [datetime.timedelta(days=40),
+ ['1990-01-03 00:00:00+00:00', '1990-01-10 00:00:00+00:00',
+ '1990-01-17 00:00:00+00:00', '1990-01-24 00:00:00+00:00',
+ '1990-01-31 00:00:00+00:00', '1990-02-07 00:00:00+00:00']
+ ],
+ [datetime.timedelta(hours=40),
+ ['1990-01-01 00:00:00+00:00', '1990-01-01 04:00:00+00:00',
+ '1990-01-01 08:00:00+00:00', '1990-01-01 12:00:00+00:00',
+ '1990-01-01 16:00:00+00:00', '1990-01-01 20:00:00+00:00',
+ '1990-01-02 00:00:00+00:00', '1990-01-02 04:00:00+00:00',
+ '1990-01-02 08:00:00+00:00', '1990-01-02 12:00:00+00:00',
+ '1990-01-02 16:00:00+00:00']
+ ],
+ [datetime.timedelta(minutes=20),
+ ['1990-01-01 00:00:00+00:00', '1990-01-01 00:05:00+00:00',
+ '1990-01-01 00:10:00+00:00', '1990-01-01 00:15:00+00:00',
+ '1990-01-01 00:20:00+00:00']
+ ],
+ [datetime.timedelta(seconds=40),
+ ['1990-01-01 00:00:00+00:00', '1990-01-01 00:00:05+00:00',
+ '1990-01-01 00:00:10+00:00', '1990-01-01 00:00:15+00:00',
+ '1990-01-01 00:00:20+00:00', '1990-01-01 00:00:25+00:00',
+ '1990-01-01 00:00:30+00:00', '1990-01-01 00:00:35+00:00',
+ '1990-01-01 00:00:40+00:00']
+ ],
+ [datetime.timedelta(microseconds=1500),
+ ['1989-12-31 23:59:59.999500+00:00',
+ '1990-01-01 00:00:00+00:00',
+ '1990-01-01 00:00:00.000500+00:00',
+ '1990-01-01 00:00:00.001000+00:00',
+ '1990-01-01 00:00:00.001500+00:00',
+ '1990-01-01 00:00:00.002000+00:00']
+ ],
+ )
+
+ for t_delta, expected in results:
+ d2 = d1 + t_delta
+ locator = _create_auto_date_locator(d1, d2)
+ assert list(map(str, mdates.num2date(locator()))) == expected
+
+
+@_new_epoch_decorator
+def test_auto_date_locator_intmult():
+ def _create_auto_date_locator(date1, date2):
+ locator = mdates.AutoDateLocator(interval_multiples=True)
+ locator.create_dummy_axis()
+ locator.set_view_interval(mdates.date2num(date1),
+ mdates.date2num(date2))
+ return locator
+
+ results = ([datetime.timedelta(weeks=52 * 200),
+ ['1980-01-01 00:00:00+00:00', '2000-01-01 00:00:00+00:00',
+ '2020-01-01 00:00:00+00:00', '2040-01-01 00:00:00+00:00',
+ '2060-01-01 00:00:00+00:00', '2080-01-01 00:00:00+00:00',
+ '2100-01-01 00:00:00+00:00', '2120-01-01 00:00:00+00:00',
+ '2140-01-01 00:00:00+00:00', '2160-01-01 00:00:00+00:00',
+ '2180-01-01 00:00:00+00:00', '2200-01-01 00:00:00+00:00']
+ ],
+ [datetime.timedelta(weeks=52),
+ ['1997-01-01 00:00:00+00:00', '1997-02-01 00:00:00+00:00',
+ '1997-03-01 00:00:00+00:00', '1997-04-01 00:00:00+00:00',
+ '1997-05-01 00:00:00+00:00', '1997-06-01 00:00:00+00:00',
+ '1997-07-01 00:00:00+00:00', '1997-08-01 00:00:00+00:00',
+ '1997-09-01 00:00:00+00:00', '1997-10-01 00:00:00+00:00',
+ '1997-11-01 00:00:00+00:00', '1997-12-01 00:00:00+00:00']
+ ],
+ [datetime.timedelta(days=141),
+ ['1997-01-01 00:00:00+00:00', '1997-01-15 00:00:00+00:00',
+ '1997-02-01 00:00:00+00:00', '1997-02-15 00:00:00+00:00',
+ '1997-03-01 00:00:00+00:00', '1997-03-15 00:00:00+00:00',
+ '1997-04-01 00:00:00+00:00', '1997-04-15 00:00:00+00:00',
+ '1997-05-01 00:00:00+00:00', '1997-05-15 00:00:00+00:00']
+ ],
+ [datetime.timedelta(days=40),
+ ['1997-01-01 00:00:00+00:00', '1997-01-05 00:00:00+00:00',
+ '1997-01-09 00:00:00+00:00', '1997-01-13 00:00:00+00:00',
+ '1997-01-17 00:00:00+00:00', '1997-01-21 00:00:00+00:00',
+ '1997-01-25 00:00:00+00:00', '1997-01-29 00:00:00+00:00',
+ '1997-02-01 00:00:00+00:00', '1997-02-05 00:00:00+00:00',
+ '1997-02-09 00:00:00+00:00']
+ ],
+ [datetime.timedelta(hours=40),
+ ['1997-01-01 00:00:00+00:00', '1997-01-01 04:00:00+00:00',
+ '1997-01-01 08:00:00+00:00', '1997-01-01 12:00:00+00:00',
+ '1997-01-01 16:00:00+00:00', '1997-01-01 20:00:00+00:00',
+ '1997-01-02 00:00:00+00:00', '1997-01-02 04:00:00+00:00',
+ '1997-01-02 08:00:00+00:00', '1997-01-02 12:00:00+00:00',
+ '1997-01-02 16:00:00+00:00']
+ ],
+ [datetime.timedelta(minutes=20),
+ ['1997-01-01 00:00:00+00:00', '1997-01-01 00:05:00+00:00',
+ '1997-01-01 00:10:00+00:00', '1997-01-01 00:15:00+00:00',
+ '1997-01-01 00:20:00+00:00']
+ ],
+ [datetime.timedelta(seconds=40),
+ ['1997-01-01 00:00:00+00:00', '1997-01-01 00:00:05+00:00',
+ '1997-01-01 00:00:10+00:00', '1997-01-01 00:00:15+00:00',
+ '1997-01-01 00:00:20+00:00', '1997-01-01 00:00:25+00:00',
+ '1997-01-01 00:00:30+00:00', '1997-01-01 00:00:35+00:00',
+ '1997-01-01 00:00:40+00:00']
+ ],
+ [datetime.timedelta(microseconds=1500),
+ ['1996-12-31 23:59:59.999500+00:00',
+ '1997-01-01 00:00:00+00:00',
+ '1997-01-01 00:00:00.000500+00:00',
+ '1997-01-01 00:00:00.001000+00:00',
+ '1997-01-01 00:00:00.001500+00:00',
+ '1997-01-01 00:00:00.002000+00:00']
+ ],
+ )
+
+ d1 = datetime.datetime(1997, 1, 1)
+ for t_delta, expected in results:
+ d2 = d1 + t_delta
+ locator = _create_auto_date_locator(d1, d2)
+ assert list(map(str, mdates.num2date(locator()))) == expected
+
+
+def test_concise_formatter_subsecond():
+ locator = mdates.AutoDateLocator(interval_multiples=True)
+ formatter = mdates.ConciseDateFormatter(locator)
+ year_1996 = 9861.0
+ strings = formatter.format_ticks([
+ year_1996,
+ year_1996 + 500 / mdates.MUSECONDS_PER_DAY,
+ year_1996 + 900 / mdates.MUSECONDS_PER_DAY])
+ assert strings == ['00:00', '00.0005', '00.0009']
+
+
+def test_concise_formatter():
+ def _create_auto_date_locator(date1, date2):
+ fig, ax = plt.subplots()
+
+ locator = mdates.AutoDateLocator(interval_multiples=True)
+ formatter = mdates.ConciseDateFormatter(locator)
+ ax.yaxis.set_major_locator(locator)
+ ax.yaxis.set_major_formatter(formatter)
+ ax.set_ylim(date1, date2)
+ fig.canvas.draw()
+ sts = [st.get_text() for st in ax.get_yticklabels()]
+ return sts
+
+ d1 = datetime.datetime(1997, 1, 1)
+ results = ([datetime.timedelta(weeks=52 * 200),
+ [str(t) for t in range(1980, 2201, 20)]
+ ],
+ [datetime.timedelta(weeks=52),
+ ['1997', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',
+ 'Sep', 'Oct', 'Nov', 'Dec']
+ ],
+ [datetime.timedelta(days=141),
+ ['Jan', '15', 'Feb', '15', 'Mar', '15', 'Apr', '15',
+ 'May', '15']
+ ],
+ [datetime.timedelta(days=40),
+ ['Jan', '05', '09', '13', '17', '21', '25', '29', 'Feb',
+ '05', '09']
+ ],
+ [datetime.timedelta(hours=40),
+ ['Jan-01', '04:00', '08:00', '12:00', '16:00', '20:00',
+ 'Jan-02', '04:00', '08:00', '12:00', '16:00']
+ ],
+ [datetime.timedelta(minutes=20),
+ ['00:00', '00:05', '00:10', '00:15', '00:20']
+ ],
+ [datetime.timedelta(seconds=40),
+ ['00:00', '05', '10', '15', '20', '25', '30', '35', '40']
+ ],
+ [datetime.timedelta(seconds=2),
+ ['59.5', '00:00', '00.5', '01.0', '01.5', '02.0', '02.5']
+ ],
+ )
+ for t_delta, expected in results:
+ d2 = d1 + t_delta
+ strings = _create_auto_date_locator(d1, d2)
+ assert strings == expected
+
+
+@pytest.mark.parametrize('t_delta, expected', [
+ (datetime.timedelta(seconds=0.01), '1997-Jan-01 00:00'),
+ (datetime.timedelta(minutes=1), '1997-Jan-01 00:01'),
+ (datetime.timedelta(hours=1), '1997-Jan-01'),
+ (datetime.timedelta(days=1), '1997-Jan-02'),
+ (datetime.timedelta(weeks=1), '1997-Jan'),
+ (datetime.timedelta(weeks=26), ''),
+ (datetime.timedelta(weeks=520), '')
+])
+def test_concise_formatter_show_offset(t_delta, expected):
+ d1 = datetime.datetime(1997, 1, 1)
+ d2 = d1 + t_delta
+
+ fig, ax = plt.subplots()
+ locator = mdates.AutoDateLocator()
+ formatter = mdates.ConciseDateFormatter(locator)
+ ax.xaxis.set_major_locator(locator)
+ ax.xaxis.set_major_formatter(formatter)
+
+ ax.plot([d1, d2], [0, 0])
+ fig.canvas.draw()
+ assert formatter.get_offset() == expected
+
+
+@pytest.mark.parametrize('t_delta, expected', [
+ (datetime.timedelta(weeks=52 * 200),
+ ['$\\mathdefault{%d}$' % (t, ) for t in range(1980, 2201, 20)]),
+ (datetime.timedelta(days=40),
+ ['$\\mathdefault{Jan}$', '$\\mathdefault{05}$', '$\\mathdefault{09}$',
+ '$\\mathdefault{13}$', '$\\mathdefault{17}$', '$\\mathdefault{21}$',
+ '$\\mathdefault{25}$', '$\\mathdefault{29}$', '$\\mathdefault{Feb}$',
+ '$\\mathdefault{05}$', '$\\mathdefault{09}$']),
+ (datetime.timedelta(hours=40),
+ ['$\\mathdefault{Jan{-}01}$', '$\\mathdefault{04:00}$',
+ '$\\mathdefault{08:00}$', '$\\mathdefault{12:00}$',
+ '$\\mathdefault{16:00}$', '$\\mathdefault{20:00}$',
+ '$\\mathdefault{Jan{-}02}$', '$\\mathdefault{04:00}$',
+ '$\\mathdefault{08:00}$', '$\\mathdefault{12:00}$',
+ '$\\mathdefault{16:00}$']),
+ (datetime.timedelta(seconds=2),
+ ['$\\mathdefault{59.5}$', '$\\mathdefault{00:00}$',
+ '$\\mathdefault{00.5}$', '$\\mathdefault{01.0}$',
+ '$\\mathdefault{01.5}$', '$\\mathdefault{02.0}$',
+ '$\\mathdefault{02.5}$']),
+])
+def test_concise_formatter_usetex(t_delta, expected):
+ d1 = datetime.datetime(1997, 1, 1)
+ d2 = d1 + t_delta
+
+ locator = mdates.AutoDateLocator(interval_multiples=True)
+ locator.create_dummy_axis()
+ locator.set_view_interval(mdates.date2num(d1), mdates.date2num(d2))
+
+ formatter = mdates.ConciseDateFormatter(locator, usetex=True)
+ assert formatter.format_ticks(locator()) == expected
+
+
+def test_concise_formatter_formats():
+ formats = ['%Y', '%m/%Y', 'day: %d',
+ '%H hr %M min', '%H hr %M min', '%S.%f sec']
+
+ def _create_auto_date_locator(date1, date2):
+ fig, ax = plt.subplots()
+
+ locator = mdates.AutoDateLocator(interval_multiples=True)
+ formatter = mdates.ConciseDateFormatter(locator, formats=formats)
+ ax.yaxis.set_major_locator(locator)
+ ax.yaxis.set_major_formatter(formatter)
+ ax.set_ylim(date1, date2)
+ fig.canvas.draw()
+ sts = [st.get_text() for st in ax.get_yticklabels()]
+ return sts
+
+ d1 = datetime.datetime(1997, 1, 1)
+ results = (
+ [datetime.timedelta(weeks=52 * 200), [str(t) for t in range(1980,
+ 2201, 20)]],
+ [datetime.timedelta(weeks=52), [
+ '1997', '02/1997', '03/1997', '04/1997', '05/1997', '06/1997',
+ '07/1997', '08/1997', '09/1997', '10/1997', '11/1997', '12/1997',
+ ]],
+ [datetime.timedelta(days=141), [
+ '01/1997', 'day: 15', '02/1997', 'day: 15', '03/1997', 'day: 15',
+ '04/1997', 'day: 15', '05/1997', 'day: 15',
+ ]],
+ [datetime.timedelta(days=40), [
+ '01/1997', 'day: 05', 'day: 09', 'day: 13', 'day: 17', 'day: 21',
+ 'day: 25', 'day: 29', '02/1997', 'day: 05', 'day: 09',
+ ]],
+ [datetime.timedelta(hours=40), [
+ 'day: 01', '04 hr 00 min', '08 hr 00 min', '12 hr 00 min',
+ '16 hr 00 min', '20 hr 00 min', 'day: 02', '04 hr 00 min',
+ '08 hr 00 min', '12 hr 00 min', '16 hr 00 min',
+ ]],
+ [datetime.timedelta(minutes=20), ['00 hr 00 min', '00 hr 05 min',
+ '00 hr 10 min', '00 hr 15 min', '00 hr 20 min']],
+ [datetime.timedelta(seconds=40), [
+ '00 hr 00 min', '05.000000 sec', '10.000000 sec',
+ '15.000000 sec', '20.000000 sec', '25.000000 sec',
+ '30.000000 sec', '35.000000 sec', '40.000000 sec',
+ ]],
+ [datetime.timedelta(seconds=2), [
+ '59.500000 sec', '00 hr 00 min', '00.500000 sec', '01.000000 sec',
+ '01.500000 sec', '02.000000 sec', '02.500000 sec',
+ ]],
+ )
+ for t_delta, expected in results:
+ d2 = d1 + t_delta
+ strings = _create_auto_date_locator(d1, d2)
+ assert strings == expected
+
+
+def test_concise_formatter_zformats():
+ zero_formats = ['', "'%y", '%B', '%m-%d', '%S', '%S.%f']
+
+ def _create_auto_date_locator(date1, date2):
+ fig, ax = plt.subplots()
+
+ locator = mdates.AutoDateLocator(interval_multiples=True)
+ formatter = mdates.ConciseDateFormatter(
+ locator, zero_formats=zero_formats)
+ ax.yaxis.set_major_locator(locator)
+ ax.yaxis.set_major_formatter(formatter)
+ ax.set_ylim(date1, date2)
+ fig.canvas.draw()
+ sts = [st.get_text() for st in ax.get_yticklabels()]
+ return sts
+
+ d1 = datetime.datetime(1997, 1, 1)
+ results = ([datetime.timedelta(weeks=52 * 200),
+ [str(t) for t in range(1980, 2201, 20)]
+ ],
+ [datetime.timedelta(weeks=52),
+ ["'97", 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+ ],
+ [datetime.timedelta(days=141),
+ ['January', '15', 'February', '15', 'March',
+ '15', 'April', '15', 'May', '15']
+ ],
+ [datetime.timedelta(days=40),
+ ['January', '05', '09', '13', '17', '21',
+ '25', '29', 'February', '05', '09']
+ ],
+ [datetime.timedelta(hours=40),
+ ['01-01', '04:00', '08:00', '12:00', '16:00', '20:00',
+ '01-02', '04:00', '08:00', '12:00', '16:00']
+ ],
+ [datetime.timedelta(minutes=20),
+ ['00', '00:05', '00:10', '00:15', '00:20']
+ ],
+ [datetime.timedelta(seconds=40),
+ ['00', '05', '10', '15', '20', '25', '30', '35', '40']
+ ],
+ [datetime.timedelta(seconds=2),
+ ['59.5', '00.0', '00.5', '01.0', '01.5', '02.0', '02.5']
+ ],
+ )
+ for t_delta, expected in results:
+ d2 = d1 + t_delta
+ strings = _create_auto_date_locator(d1, d2)
+ assert strings == expected
+
+
+def test_concise_formatter_tz():
+ def _create_auto_date_locator(date1, date2, tz):
+ fig, ax = plt.subplots()
+
+ locator = mdates.AutoDateLocator(interval_multiples=True)
+ formatter = mdates.ConciseDateFormatter(locator, tz=tz)
+ ax.yaxis.set_major_locator(locator)
+ ax.yaxis.set_major_formatter(formatter)
+ ax.set_ylim(date1, date2)
+ fig.canvas.draw()
+ sts = [st.get_text() for st in ax.get_yticklabels()]
+ return sts, ax.yaxis.get_offset_text().get_text()
+
+ d1 = datetime.datetime(1997, 1, 1).replace(tzinfo=datetime.timezone.utc)
+ results = ([datetime.timedelta(hours=40),
+ ['03:00', '07:00', '11:00', '15:00', '19:00', '23:00',
+ '03:00', '07:00', '11:00', '15:00', '19:00'],
+ "1997-Jan-02"
+ ],
+ [datetime.timedelta(minutes=20),
+ ['03:00', '03:05', '03:10', '03:15', '03:20'],
+ "1997-Jan-01"
+ ],
+ [datetime.timedelta(seconds=40),
+ ['03:00', '05', '10', '15', '20', '25', '30', '35', '40'],
+ "1997-Jan-01 03:00"
+ ],
+ [datetime.timedelta(seconds=2),
+ ['59.5', '03:00', '00.5', '01.0', '01.5', '02.0', '02.5'],
+ "1997-Jan-01 03:00"
+ ],
+ )
+
+ new_tz = datetime.timezone(datetime.timedelta(hours=3))
+ for t_delta, expected_strings, expected_offset in results:
+ d2 = d1 + t_delta
+ strings, offset = _create_auto_date_locator(d1, d2, new_tz)
+ assert strings == expected_strings
+ assert offset == expected_offset
+
+
+def test_auto_date_locator_intmult_tz():
+ def _create_auto_date_locator(date1, date2, tz):
+ locator = mdates.AutoDateLocator(interval_multiples=True, tz=tz)
+ locator.create_dummy_axis()
+ locator.set_view_interval(mdates.date2num(date1),
+ mdates.date2num(date2))
+ return locator
+
+ results = ([datetime.timedelta(weeks=52*200),
+ ['1980-01-01 00:00:00-08:00', '2000-01-01 00:00:00-08:00',
+ '2020-01-01 00:00:00-08:00', '2040-01-01 00:00:00-08:00',
+ '2060-01-01 00:00:00-08:00', '2080-01-01 00:00:00-08:00',
+ '2100-01-01 00:00:00-08:00', '2120-01-01 00:00:00-08:00',
+ '2140-01-01 00:00:00-08:00', '2160-01-01 00:00:00-08:00',
+ '2180-01-01 00:00:00-08:00', '2200-01-01 00:00:00-08:00']
+ ],
+ [datetime.timedelta(weeks=52),
+ ['1997-01-01 00:00:00-08:00', '1997-02-01 00:00:00-08:00',
+ '1997-03-01 00:00:00-08:00', '1997-04-01 00:00:00-08:00',
+ '1997-05-01 00:00:00-07:00', '1997-06-01 00:00:00-07:00',
+ '1997-07-01 00:00:00-07:00', '1997-08-01 00:00:00-07:00',
+ '1997-09-01 00:00:00-07:00', '1997-10-01 00:00:00-07:00',
+ '1997-11-01 00:00:00-08:00', '1997-12-01 00:00:00-08:00']
+ ],
+ [datetime.timedelta(days=141),
+ ['1997-01-01 00:00:00-08:00', '1997-01-15 00:00:00-08:00',
+ '1997-02-01 00:00:00-08:00', '1997-02-15 00:00:00-08:00',
+ '1997-03-01 00:00:00-08:00', '1997-03-15 00:00:00-08:00',
+ '1997-04-01 00:00:00-08:00', '1997-04-15 00:00:00-07:00',
+ '1997-05-01 00:00:00-07:00', '1997-05-15 00:00:00-07:00']
+ ],
+ [datetime.timedelta(days=40),
+ ['1997-01-01 00:00:00-08:00', '1997-01-05 00:00:00-08:00',
+ '1997-01-09 00:00:00-08:00', '1997-01-13 00:00:00-08:00',
+ '1997-01-17 00:00:00-08:00', '1997-01-21 00:00:00-08:00',
+ '1997-01-25 00:00:00-08:00', '1997-01-29 00:00:00-08:00',
+ '1997-02-01 00:00:00-08:00', '1997-02-05 00:00:00-08:00',
+ '1997-02-09 00:00:00-08:00']
+ ],
+ [datetime.timedelta(hours=40),
+ ['1997-01-01 00:00:00-08:00', '1997-01-01 04:00:00-08:00',
+ '1997-01-01 08:00:00-08:00', '1997-01-01 12:00:00-08:00',
+ '1997-01-01 16:00:00-08:00', '1997-01-01 20:00:00-08:00',
+ '1997-01-02 00:00:00-08:00', '1997-01-02 04:00:00-08:00',
+ '1997-01-02 08:00:00-08:00', '1997-01-02 12:00:00-08:00',
+ '1997-01-02 16:00:00-08:00']
+ ],
+ [datetime.timedelta(minutes=20),
+ ['1997-01-01 00:00:00-08:00', '1997-01-01 00:05:00-08:00',
+ '1997-01-01 00:10:00-08:00', '1997-01-01 00:15:00-08:00',
+ '1997-01-01 00:20:00-08:00']
+ ],
+ [datetime.timedelta(seconds=40),
+ ['1997-01-01 00:00:00-08:00', '1997-01-01 00:00:05-08:00',
+ '1997-01-01 00:00:10-08:00', '1997-01-01 00:00:15-08:00',
+ '1997-01-01 00:00:20-08:00', '1997-01-01 00:00:25-08:00',
+ '1997-01-01 00:00:30-08:00', '1997-01-01 00:00:35-08:00',
+ '1997-01-01 00:00:40-08:00']
+ ]
+ )
+
+ tz = dateutil.tz.gettz('Canada/Pacific')
+ d1 = datetime.datetime(1997, 1, 1, tzinfo=tz)
+ for t_delta, expected in results:
+ with rc_context({'_internal.classic_mode': False}):
+ d2 = d1 + t_delta
+ locator = _create_auto_date_locator(d1, d2, tz)
+ st = list(map(str, mdates.num2date(locator(), tz=tz)))
+ assert st == expected
+
+
+@image_comparison(['date_inverted_limit.png'])
+def test_date_inverted_limit():
+ # test ax hline with date inputs
+ t0 = datetime.datetime(2009, 1, 20)
+ tf = datetime.datetime(2009, 1, 31)
+ fig, ax = plt.subplots()
+ ax.axhline(t0, color="blue", lw=3)
+ ax.set_ylim(t0 - datetime.timedelta(days=5),
+ tf + datetime.timedelta(days=5))
+ ax.invert_yaxis()
+ fig.subplots_adjust(left=0.25)
+
+
+def _test_date2num_dst(date_range, tz_convert):
+ # Timezones
+
+ BRUSSELS = dateutil.tz.gettz('Europe/Brussels')
+ UTC = mdates.UTC
+
+ # Create a list of timezone-aware datetime objects in UTC
+ # Interval is 0b0.0000011 days, to prevent float rounding issues
+ dtstart = datetime.datetime(2014, 3, 30, 0, 0, tzinfo=UTC)
+ interval = datetime.timedelta(minutes=33, seconds=45)
+ interval_days = 0.0234375 # 2025 / 86400 seconds
+ N = 8
+
+ dt_utc = date_range(start=dtstart, freq=interval, periods=N)
+ dt_bxl = tz_convert(dt_utc, BRUSSELS)
+ t0 = 735322.0 + mdates.date2num(np.datetime64('0000-12-31'))
+ expected_ordinalf = [t0 + (i * interval_days) for i in range(N)]
+ actual_ordinalf = list(mdates.date2num(dt_bxl))
+
+ assert actual_ordinalf == expected_ordinalf
+
+
+def test_date2num_dst():
+ # Test for github issue #3896, but in date2num around DST transitions
+ # with a timezone-aware pandas date_range object.
+
+ class dt_tzaware(datetime.datetime):
+ """
+ This bug specifically occurs because of the normalization behavior of
+ pandas Timestamp objects, so in order to replicate it, we need a
+ datetime-like object that applies timezone normalization after
+ subtraction.
+ """
+
+ def __sub__(self, other):
+ r = super().__sub__(other)
+ tzinfo = getattr(r, 'tzinfo', None)
+
+ if tzinfo is not None:
+ localizer = getattr(tzinfo, 'normalize', None)
+ if localizer is not None:
+ r = tzinfo.normalize(r)
+
+ if isinstance(r, datetime.datetime):
+ r = self.mk_tzaware(r)
+
+ return r
+
+ def __add__(self, other):
+ return self.mk_tzaware(super().__add__(other))
+
+ def astimezone(self, tzinfo):
+ dt = super().astimezone(tzinfo)
+ return self.mk_tzaware(dt)
+
+ @classmethod
+ def mk_tzaware(cls, datetime_obj):
+ kwargs = {}
+ attrs = ('year',
+ 'month',
+ 'day',
+ 'hour',
+ 'minute',
+ 'second',
+ 'microsecond',
+ 'tzinfo')
+
+ for attr in attrs:
+ val = getattr(datetime_obj, attr, None)
+ if val is not None:
+ kwargs[attr] = val
+
+ return cls(**kwargs)
+
+ # Define a date_range function similar to pandas.date_range
+ def date_range(start, freq, periods):
+ dtstart = dt_tzaware.mk_tzaware(start)
+
+ return [dtstart + (i * freq) for i in range(periods)]
+
+ # Define a tz_convert function that converts a list to a new time zone.
+ def tz_convert(dt_list, tzinfo):
+ return [d.astimezone(tzinfo) for d in dt_list]
+
+ _test_date2num_dst(date_range, tz_convert)
+
+
+def test_date2num_dst_pandas(pd):
+ # Test for github issue #3896, but in date2num around DST transitions
+ # with a timezone-aware pandas date_range object.
+
+ def tz_convert(*args):
+ return pd.DatetimeIndex.tz_convert(*args).astype(object)
+
+ _test_date2num_dst(pd.date_range, tz_convert)
+
+
+def _test_rrulewrapper(attach_tz, get_tz):
+ SYD = get_tz('Australia/Sydney')
+
+ dtstart = attach_tz(datetime.datetime(2017, 4, 1, 0), SYD)
+ dtend = attach_tz(datetime.datetime(2017, 4, 4, 0), SYD)
+
+ rule = mdates.rrulewrapper(freq=dateutil.rrule.DAILY, dtstart=dtstart)
+
+ act = rule.between(dtstart, dtend)
+ exp = [datetime.datetime(2017, 4, 1, 13, tzinfo=dateutil.tz.tzutc()),
+ datetime.datetime(2017, 4, 2, 14, tzinfo=dateutil.tz.tzutc())]
+
+ assert act == exp
+
+
+def test_rrulewrapper():
+ def attach_tz(dt, zi):
+ return dt.replace(tzinfo=zi)
+
+ _test_rrulewrapper(attach_tz, dateutil.tz.gettz)
+
+
+@pytest.mark.pytz
+def test_rrulewrapper_pytz():
+ # Test to make sure pytz zones are supported in rrules
+ pytz = pytest.importorskip("pytz")
+
+ def attach_tz(dt, zi):
+ return zi.localize(dt)
+
+ _test_rrulewrapper(attach_tz, pytz.timezone)
+
+
+@pytest.mark.pytz
+def test_yearlocator_pytz():
+ pytz = pytest.importorskip("pytz")
+
+ tz = pytz.timezone('America/New_York')
+ x = [tz.localize(datetime.datetime(2010, 1, 1))
+ + datetime.timedelta(i) for i in range(2000)]
+ locator = mdates.AutoDateLocator(interval_multiples=True, tz=tz)
+ locator.create_dummy_axis()
+ locator.set_view_interval(mdates.date2num(x[0])-1.0,
+ mdates.date2num(x[-1])+1.0)
+ t = np.array([733408.208333, 733773.208333, 734138.208333,
+ 734503.208333, 734869.208333, 735234.208333, 735599.208333])
+ # convert to new epoch from old...
+ t = t + mdates.date2num(np.datetime64('0000-12-31'))
+ np.testing.assert_allclose(t, locator())
+ expected = ['2009-01-01 00:00:00-05:00',
+ '2010-01-01 00:00:00-05:00', '2011-01-01 00:00:00-05:00',
+ '2012-01-01 00:00:00-05:00', '2013-01-01 00:00:00-05:00',
+ '2014-01-01 00:00:00-05:00', '2015-01-01 00:00:00-05:00']
+ st = list(map(str, mdates.num2date(locator(), tz=tz)))
+ assert st == expected
+
+
+def test_DayLocator():
+ with pytest.raises(ValueError):
+ mdates.DayLocator(interval=-1)
+ with pytest.raises(ValueError):
+ mdates.DayLocator(interval=-1.5)
+ with pytest.raises(ValueError):
+ mdates.DayLocator(interval=0)
+ with pytest.raises(ValueError):
+ mdates.DayLocator(interval=1.3)
+ mdates.DayLocator(interval=1.0)
+
+
+def test_tz_utc():
+ dt = datetime.datetime(1970, 1, 1, tzinfo=mdates.UTC)
+ dt.tzname()
+
+
+@pytest.mark.parametrize("x, tdelta",
+ [(1, datetime.timedelta(days=1)),
+ ([1, 1.5], [datetime.timedelta(days=1),
+ datetime.timedelta(days=1.5)])])
+def test_num2timedelta(x, tdelta):
+ dt = mdates.num2timedelta(x)
+ assert dt == tdelta
+
+
+def test_datetime64_in_list():
+ dt = [np.datetime64('2000-01-01'), np.datetime64('2001-01-01')]
+ dn = mdates.date2num(dt)
+ # convert fixed values from old to new epoch
+ t = (np.array([730120., 730486.]) +
+ mdates.date2num(np.datetime64('0000-12-31')))
+ np.testing.assert_equal(dn, t)
+
+
+def test_change_epoch():
+ date = np.datetime64('2000-01-01')
+
+ with pytest.raises(RuntimeError):
+ # this should fail here because there is a sentinel on the epoch
+ # if the epoch has been used then it cannot be set.
+ mdates.set_epoch('0000-01-01')
+
+ # use private method to clear the epoch and allow it to be set...
+ mdates._reset_epoch_test_example()
+ mdates.set_epoch('1970-01-01')
+ dt = (date - np.datetime64('1970-01-01')).astype('datetime64[D]')
+ dt = dt.astype('int')
+ np.testing.assert_equal(mdates.date2num(date), float(dt))
+
+ mdates._reset_epoch_test_example()
+ mdates.set_epoch('0000-12-31')
+ np.testing.assert_equal(mdates.date2num(date), 730120.0)
+
+ mdates._reset_epoch_test_example()
+ mdates.set_epoch('1970-01-01T01:00:00')
+ np.testing.assert_allclose(mdates.date2num(date), dt - 1./24.)
+ mdates._reset_epoch_test_example()
+ mdates.set_epoch('1970-01-01T00:00:00')
+ np.testing.assert_allclose(
+ mdates.date2num(np.datetime64('1970-01-01T12:00:00')),
+ 0.5)
+
+
+def test_warn_notintervals():
+ dates = np.arange('2001-01-10', '2001-03-04', dtype='datetime64[D]')
+ locator = mdates.AutoDateLocator(interval_multiples=False)
+ locator.intervald[3] = [2]
+ locator.create_dummy_axis()
+ locator.set_view_interval(mdates.date2num(dates[0]),
+ mdates.date2num(dates[-1]))
+ with pytest.warns(UserWarning, match="AutoDateLocator was unable") as rec:
+ locs = locator()
+
+
+def test_change_converter():
+ plt.rcParams['date.converter'] = 'concise'
+ dates = np.arange('2020-01-01', '2020-05-01', dtype='datetime64[D]')
+ fig, ax = plt.subplots()
+
+ ax.plot(dates, np.arange(len(dates)))
+ fig.canvas.draw()
+ assert ax.get_xticklabels()[0].get_text() == 'Jan'
+ assert ax.get_xticklabels()[1].get_text() == '15'
+
+ plt.rcParams['date.converter'] = 'auto'
+ fig, ax = plt.subplots()
+
+ ax.plot(dates, np.arange(len(dates)))
+ fig.canvas.draw()
+ assert ax.get_xticklabels()[0].get_text() == 'Jan 01 2020'
+ assert ax.get_xticklabels()[1].get_text() == 'Jan 15 2020'
+ with pytest.warns(UserWarning) as rec:
+ plt.rcParams['date.converter'] = 'boo'
+
+
+def test_change_interval_multiples():
+ plt.rcParams['date.interval_multiples'] = False
+ dates = np.arange('2020-01-10', '2020-05-01', dtype='datetime64[D]')
+ fig, ax = plt.subplots()
+
+ ax.plot(dates, np.arange(len(dates)))
+ fig.canvas.draw()
+ assert ax.get_xticklabels()[0].get_text() == 'Jan 10 2020'
+ assert ax.get_xticklabels()[1].get_text() == 'Jan 24 2020'
+
+ plt.rcParams['date.interval_multiples'] = 'True'
+ fig, ax = plt.subplots()
+
+ ax.plot(dates, np.arange(len(dates)))
+ fig.canvas.draw()
+ assert ax.get_xticklabels()[0].get_text() == 'Jan 15 2020'
+ assert ax.get_xticklabels()[1].get_text() == 'Feb 01 2020'
+
+
+def test_epoch2num():
+ mdates._reset_epoch_test_example()
+ mdates.set_epoch('0000-12-31')
+ assert mdates.epoch2num(86400) == 719164.0
+ assert mdates.num2epoch(719165.0) == 86400 * 2
+ # set back to the default
+ mdates._reset_epoch_test_example()
+ mdates.set_epoch('1970-01-01T00:00:00')
+ assert mdates.epoch2num(86400) == 1.0
+ assert mdates.num2epoch(2.0) == 86400 * 2
+
+
+def test_julian2num():
+ mdates._reset_epoch_test_example()
+ mdates.set_epoch('0000-12-31')
+ # 2440587.5 is julian date for 1970-01-01T00:00:00
+ # https://en.wikipedia.org/wiki/Julian_day
+ assert mdates.julian2num(2440588.5) == 719164.0
+ assert mdates.num2julian(719165.0) == 2440589.5
+ # set back to the default
+ mdates._reset_epoch_test_example()
+ mdates.set_epoch('1970-01-01T00:00:00')
+ assert mdates.julian2num(2440588.5) == 1.0
+ assert mdates.num2julian(2.0) == 2440589.5
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_determinism.py b/venv/Lib/site-packages/matplotlib/tests/test_determinism.py
new file mode 100644
index 0000000..cce05f1
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_determinism.py
@@ -0,0 +1,145 @@
+"""
+Test output reproducibility.
+"""
+
+import os
+import subprocess
+import sys
+
+import pytest
+
+import matplotlib as mpl
+import matplotlib.testing.compare
+from matplotlib import pyplot as plt
+
+
+needs_ghostscript = pytest.mark.skipif(
+ "eps" not in mpl.testing.compare.converter,
+ reason="This test needs a ghostscript installation")
+needs_usetex = pytest.mark.skipif(
+ not mpl.checkdep_usetex(True),
+ reason="This test needs a TeX installation")
+
+
+def _save_figure(objects='mhi', fmt="pdf", usetex=False):
+ mpl.use(fmt)
+ mpl.rcParams.update({'svg.hashsalt': 'asdf', 'text.usetex': usetex})
+
+ fig = plt.figure()
+
+ if 'm' in objects:
+ # use different markers...
+ ax1 = fig.add_subplot(1, 6, 1)
+ x = range(10)
+ ax1.plot(x, [1] * 10, marker='D')
+ ax1.plot(x, [2] * 10, marker='x')
+ ax1.plot(x, [3] * 10, marker='^')
+ ax1.plot(x, [4] * 10, marker='H')
+ ax1.plot(x, [5] * 10, marker='v')
+
+ if 'h' in objects:
+ # also use different hatch patterns
+ ax2 = fig.add_subplot(1, 6, 2)
+ bars = (ax2.bar(range(1, 5), range(1, 5)) +
+ ax2.bar(range(1, 5), [6] * 4, bottom=range(1, 5)))
+ ax2.set_xticks([1.5, 2.5, 3.5, 4.5])
+
+ patterns = ('-', '+', 'x', '\\', '*', 'o', 'O', '.')
+ for bar, pattern in zip(bars, patterns):
+ bar.set_hatch(pattern)
+
+ if 'i' in objects:
+ # also use different images
+ A = [[1, 2, 3], [2, 3, 1], [3, 1, 2]]
+ fig.add_subplot(1, 6, 3).imshow(A, interpolation='nearest')
+ A = [[1, 3, 2], [1, 2, 3], [3, 1, 2]]
+ fig.add_subplot(1, 6, 4).imshow(A, interpolation='bilinear')
+ A = [[2, 3, 1], [1, 2, 3], [2, 1, 3]]
+ fig.add_subplot(1, 6, 5).imshow(A, interpolation='bicubic')
+
+ x = range(5)
+ ax = fig.add_subplot(1, 6, 6)
+ ax.plot(x, x)
+ ax.set_title('A string $1+2+\\sigma$')
+ ax.set_xlabel('A string $1+2+\\sigma$')
+ ax.set_ylabel('A string $1+2+\\sigma$')
+
+ stdout = getattr(sys.stdout, 'buffer', sys.stdout)
+ fig.savefig(stdout, format=fmt)
+
+
+@pytest.mark.parametrize(
+ "objects, fmt, usetex", [
+ ("", "pdf", False),
+ ("m", "pdf", False),
+ ("h", "pdf", False),
+ ("i", "pdf", False),
+ ("mhi", "pdf", False),
+ ("mhi", "ps", False),
+ pytest.param(
+ "mhi", "ps", True, marks=[needs_usetex, needs_ghostscript]),
+ ("mhi", "svg", False),
+ pytest.param("mhi", "svg", True, marks=needs_usetex),
+ ]
+)
+def test_determinism_check(objects, fmt, usetex):
+ """
+ Output three times the same graphs and checks that the outputs are exactly
+ the same.
+
+ Parameters
+ ----------
+ objects : str
+ Objects to be included in the test document: 'm' for markers, 'h' for
+ hatch patterns, 'i' for images.
+ fmt : {"pdf", "ps", "svg"}
+ Output format.
+ """
+ plots = [
+ subprocess.check_output(
+ [sys.executable, "-R", "-c",
+ f"from matplotlib.tests.test_determinism import _save_figure;"
+ f"_save_figure({objects!r}, {fmt!r}, {usetex})"],
+ env={**os.environ, "SOURCE_DATE_EPOCH": "946684800",
+ "MPLBACKEND": "Agg"})
+ for _ in range(3)
+ ]
+ for p in plots[1:]:
+ if fmt == "ps" and usetex:
+ if p != plots[0]:
+ pytest.skip("failed, maybe due to ghostscript timestamps")
+ else:
+ assert p == plots[0]
+
+
+@pytest.mark.parametrize(
+ "fmt, string", [
+ ("pdf", b"/CreationDate (D:20000101000000Z)"),
+ # SOURCE_DATE_EPOCH support is not tested with text.usetex,
+ # because the produced timestamp comes from ghostscript:
+ # %%CreationDate: D:20000101000000Z00\'00\', and this could change
+ # with another ghostscript version.
+ ("ps", b"%%CreationDate: Sat Jan 01 00:00:00 2000"),
+ ]
+)
+def test_determinism_source_date_epoch(fmt, string):
+ """
+ Test SOURCE_DATE_EPOCH support. Output a document with the environment
+ variable SOURCE_DATE_EPOCH set to 2000-01-01 00:00 UTC and check that the
+ document contains the timestamp that corresponds to this date (given as an
+ argument).
+
+ Parameters
+ ----------
+ fmt : {"pdf", "ps", "svg"}
+ Output format.
+ string : bytes
+ Timestamp string for 2000-01-01 00:00 UTC.
+ """
+ buf = subprocess.check_output(
+ [sys.executable, "-R", "-c",
+ f"from matplotlib.tests.test_determinism import _save_figure; "
+ f"_save_figure('', {fmt!r})"],
+ env={**os.environ, "SOURCE_DATE_EPOCH": "946684800",
+ "MPLBACKEND": "Agg"})
+ assert string in buf
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_dviread.py b/venv/Lib/site-packages/matplotlib/tests/test_dviread.py
new file mode 100644
index 0000000..d26beb0
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_dviread.py
@@ -0,0 +1,65 @@
+import json
+from pathlib import Path
+import shutil
+
+import matplotlib.dviread as dr
+import pytest
+
+
+def test_PsfontsMap(monkeypatch):
+ monkeypatch.setattr(dr, 'find_tex_file', lambda x: x)
+
+ filename = str(Path(__file__).parent / 'baseline_images/dviread/test.map')
+ fontmap = dr.PsfontsMap(filename)
+ # Check all properties of a few fonts
+ for n in [1, 2, 3, 4, 5]:
+ key = b'TeXfont%d' % n
+ entry = fontmap[key]
+ assert entry.texname == key
+ assert entry.psname == b'PSfont%d' % n
+ if n not in [3, 5]:
+ assert entry.encoding == b'font%d.enc' % n
+ elif n == 3:
+ assert entry.encoding == b'enc3.foo'
+ # We don't care about the encoding of TeXfont5, which specifies
+ # multiple encodings.
+ if n not in [1, 5]:
+ assert entry.filename == b'font%d.pfa' % n
+ else:
+ assert entry.filename == b'font%d.pfb' % n
+ if n == 4:
+ assert entry.effects == {'slant': -0.1, 'extend': 2.2}
+ else:
+ assert entry.effects == {}
+ # Some special cases
+ entry = fontmap[b'TeXfont6']
+ assert entry.filename is None
+ assert entry.encoding is None
+ entry = fontmap[b'TeXfont7']
+ assert entry.filename is None
+ assert entry.encoding == b'font7.enc'
+ entry = fontmap[b'TeXfont8']
+ assert entry.filename == b'font8.pfb'
+ assert entry.encoding is None
+ entry = fontmap[b'TeXfont9']
+ assert entry.filename == b'/absolute/font9.pfb'
+ # Missing font
+ with pytest.raises(KeyError, match='no-such-font'):
+ fontmap[b'no-such-font']
+
+
+@pytest.mark.skipif(shutil.which("kpsewhich") is None,
+ reason="kpsewhich is not available")
+def test_dviread():
+ dirpath = Path(__file__).parent / 'baseline_images/dviread'
+ with (dirpath / 'test.json').open() as f:
+ correct = json.load(f)
+ with dr.Dvi(str(dirpath / 'test.dvi'), None) as dvi:
+ data = [{'text': [[t.x, t.y,
+ chr(t.glyph),
+ t.font.texname.decode('ascii'),
+ round(t.font.size, 2)]
+ for t in page.text],
+ 'boxes': [[b.x, b.y, b.height, b.width] for b in page.boxes]}
+ for page in dvi]
+ assert data == correct
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_figure.py b/venv/Lib/site-packages/matplotlib/tests/test_figure.py
new file mode 100644
index 0000000..7032735
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_figure.py
@@ -0,0 +1,1070 @@
+from contextlib import nullcontext
+from datetime import datetime
+import io
+from pathlib import Path
+import platform
+from types import SimpleNamespace
+import warnings
+
+import matplotlib as mpl
+from matplotlib import cbook, rcParams
+from matplotlib.testing.decorators import image_comparison, check_figures_equal
+from matplotlib.axes import Axes
+from matplotlib.figure import Figure
+from matplotlib.ticker import AutoMinorLocator, FixedFormatter, ScalarFormatter
+import matplotlib.pyplot as plt
+import matplotlib.dates as mdates
+import matplotlib.gridspec as gridspec
+from matplotlib.cbook import MatplotlibDeprecationWarning
+import numpy as np
+import pytest
+
+
+@image_comparison(['figure_align_labels'], extensions=['png', 'svg'],
+ tol=0 if platform.machine() == 'x86_64' else 0.01)
+def test_align_labels():
+ fig = plt.figure(tight_layout=True)
+ gs = gridspec.GridSpec(3, 3)
+
+ ax = fig.add_subplot(gs[0, :2])
+ ax.plot(np.arange(0, 1e6, 1000))
+ ax.set_ylabel('Ylabel0 0')
+ ax = fig.add_subplot(gs[0, -1])
+ ax.plot(np.arange(0, 1e4, 100))
+
+ for i in range(3):
+ ax = fig.add_subplot(gs[1, i])
+ ax.set_ylabel('YLabel1 %d' % i)
+ ax.set_xlabel('XLabel1 %d' % i)
+ if i in [0, 2]:
+ ax.xaxis.set_label_position("top")
+ ax.xaxis.tick_top()
+ if i == 0:
+ for tick in ax.get_xticklabels():
+ tick.set_rotation(90)
+ if i == 2:
+ ax.yaxis.set_label_position("right")
+ ax.yaxis.tick_right()
+
+ for i in range(3):
+ ax = fig.add_subplot(gs[2, i])
+ ax.set_xlabel(f'XLabel2 {i}')
+ ax.set_ylabel(f'YLabel2 {i}')
+
+ if i == 2:
+ ax.plot(np.arange(0, 1e4, 10))
+ ax.yaxis.set_label_position("right")
+ ax.yaxis.tick_right()
+ for tick in ax.get_xticklabels():
+ tick.set_rotation(90)
+
+ fig.align_labels()
+
+
+def test_figure_label():
+ # pyplot figure creation, selection, and closing with label/number/instance
+ plt.close('all')
+ fig_today = plt.figure('today')
+ plt.figure(3)
+ plt.figure('tomorrow')
+ plt.figure()
+ plt.figure(0)
+ plt.figure(1)
+ plt.figure(3)
+ assert plt.get_fignums() == [0, 1, 3, 4, 5]
+ assert plt.get_figlabels() == ['', 'today', '', 'tomorrow', '']
+ plt.close(10)
+ plt.close()
+ plt.close(5)
+ plt.close('tomorrow')
+ assert plt.get_fignums() == [0, 1]
+ assert plt.get_figlabels() == ['', 'today']
+ plt.figure(fig_today)
+ assert plt.gcf() == fig_today
+ with pytest.raises(ValueError):
+ plt.figure(Figure())
+
+
+def test_fignum_exists():
+ # pyplot figure creation, selection and closing with fignum_exists
+ plt.figure('one')
+ plt.figure(2)
+ plt.figure('three')
+ plt.figure()
+ assert plt.fignum_exists('one')
+ assert plt.fignum_exists(2)
+ assert plt.fignum_exists('three')
+ assert plt.fignum_exists(4)
+ plt.close('one')
+ plt.close(4)
+ assert not plt.fignum_exists('one')
+ assert not plt.fignum_exists(4)
+
+
+def test_clf_keyword():
+ # test if existing figure is cleared with figure() and subplots()
+ text1 = 'A fancy plot'
+ text2 = 'Really fancy!'
+
+ fig0 = plt.figure(num=1)
+ fig0.suptitle(text1)
+ assert [t.get_text() for t in fig0.texts] == [text1]
+
+ fig1 = plt.figure(num=1, clear=False)
+ fig1.text(0.5, 0.5, text2)
+ assert fig0 is fig1
+ assert [t.get_text() for t in fig1.texts] == [text1, text2]
+
+ fig2, ax2 = plt.subplots(2, 1, num=1, clear=True)
+ assert fig0 is fig2
+ assert [t.get_text() for t in fig2.texts] == []
+
+
+@image_comparison(['figure_today'])
+def test_figure():
+ # named figure support
+ fig = plt.figure('today')
+ ax = fig.add_subplot()
+ ax.set_title(fig.get_label())
+ ax.plot(np.arange(5))
+ # plot red line in a different figure.
+ plt.figure('tomorrow')
+ plt.plot([0, 1], [1, 0], 'r')
+ # Return to the original; make sure the red line is not there.
+ plt.figure('today')
+ plt.close('tomorrow')
+
+
+@image_comparison(['figure_legend'])
+def test_figure_legend():
+ fig, axs = plt.subplots(2)
+ axs[0].plot([0, 1], [1, 0], label='x', color='g')
+ axs[0].plot([0, 1], [0, 1], label='y', color='r')
+ axs[0].plot([0, 1], [0.5, 0.5], label='y', color='k')
+
+ axs[1].plot([0, 1], [1, 0], label='_y', color='r')
+ axs[1].plot([0, 1], [0, 1], label='z', color='b')
+ fig.legend()
+
+
+def test_gca():
+ fig = plt.figure()
+
+ with pytest.warns(UserWarning):
+ # empty call to add_axes() will throw deprecation warning
+ assert fig.add_axes() is None
+
+ ax0 = fig.add_axes([0, 0, 1, 1])
+ with pytest.warns(
+ MatplotlibDeprecationWarning,
+ match=r'Calling gca\(\) with keyword arguments was deprecated'):
+ assert fig.gca(projection='rectilinear') is ax0
+ assert fig.gca() is ax0
+
+ ax1 = fig.add_axes(rect=[0.1, 0.1, 0.8, 0.8])
+ with pytest.warns(
+ MatplotlibDeprecationWarning,
+ match=r'Calling gca\(\) with keyword arguments was deprecated'):
+ assert fig.gca(projection='rectilinear') is ax1
+ assert fig.gca() is ax1
+
+ ax2 = fig.add_subplot(121, projection='polar')
+ assert fig.gca() is ax2
+ with pytest.warns(
+ MatplotlibDeprecationWarning,
+ match=r'Calling gca\(\) with keyword arguments was deprecated'):
+ assert fig.gca(polar=True) is ax2
+
+ ax3 = fig.add_subplot(122)
+ assert fig.gca() is ax3
+
+ with pytest.warns(
+ MatplotlibDeprecationWarning,
+ match=r'Calling gca\(\) with keyword arguments was deprecated'):
+ assert fig.gca(polar=True) is ax3
+ with pytest.warns(
+ MatplotlibDeprecationWarning,
+ match=r'Calling gca\(\) with keyword arguments was deprecated'):
+ assert fig.gca(polar=True) is not ax2
+ assert fig.gca().get_subplotspec().get_geometry() == (1, 2, 1, 1)
+
+ # add_axes on an existing Axes should not change stored order, but will
+ # make it current.
+ fig.add_axes(ax0)
+ assert fig.axes == [ax0, ax1, ax2, ax3]
+ assert fig.gca() is ax0
+
+ # add_subplot on an existing Axes should not change stored order, but will
+ # make it current.
+ fig.add_subplot(ax2)
+ assert fig.axes == [ax0, ax1, ax2, ax3]
+ assert fig.gca() is ax2
+
+ fig.sca(ax1)
+ with pytest.warns(
+ MatplotlibDeprecationWarning,
+ match=r'Calling gca\(\) with keyword arguments was deprecated'):
+ assert fig.gca(projection='rectilinear') is ax1
+ assert fig.gca() is ax1
+
+ # sca() should not change stored order of Axes, which is order added.
+ assert fig.axes == [ax0, ax1, ax2, ax3]
+
+
+def test_add_subplot_subclass():
+ fig = plt.figure()
+ fig.add_subplot(axes_class=Axes)
+ with pytest.raises(ValueError):
+ fig.add_subplot(axes_class=Axes, projection="3d")
+ with pytest.raises(ValueError):
+ fig.add_subplot(axes_class=Axes, polar=True)
+ with pytest.raises(ValueError):
+ fig.add_subplot(projection="3d", polar=True)
+ with pytest.raises(TypeError):
+ fig.add_subplot(projection=42)
+
+
+def test_add_subplot_invalid():
+ fig = plt.figure()
+ with pytest.raises(ValueError,
+ match='Number of columns must be a positive integer'):
+ fig.add_subplot(2, 0, 1)
+ with pytest.raises(ValueError,
+ match='Number of rows must be a positive integer'):
+ fig.add_subplot(0, 2, 1)
+ with pytest.raises(ValueError, match='num must be 1 <= num <= 4'):
+ fig.add_subplot(2, 2, 0)
+ with pytest.raises(ValueError, match='num must be 1 <= num <= 4'):
+ fig.add_subplot(2, 2, 5)
+
+ with pytest.raises(ValueError, match='must be a three-digit integer'):
+ fig.add_subplot(42)
+ with pytest.raises(ValueError, match='must be a three-digit integer'):
+ fig.add_subplot(1000)
+
+ with pytest.raises(TypeError, match='takes 1 or 3 positional arguments '
+ 'but 2 were given'):
+ fig.add_subplot(2, 2)
+ with pytest.raises(TypeError, match='takes 1 or 3 positional arguments '
+ 'but 4 were given'):
+ fig.add_subplot(1, 2, 3, 4)
+ with pytest.warns(cbook.MatplotlibDeprecationWarning,
+ match='Passing non-integers as three-element position '
+ 'specification is deprecated'):
+ fig.add_subplot('2', 2, 1)
+ with pytest.warns(cbook.MatplotlibDeprecationWarning,
+ match='Passing non-integers as three-element position '
+ 'specification is deprecated'):
+ fig.add_subplot(2.0, 2, 1)
+ _, ax = plt.subplots()
+ with pytest.raises(ValueError,
+ match='The Subplot must have been created in the '
+ 'present figure'):
+ fig.add_subplot(ax)
+
+
+@image_comparison(['figure_suptitle'])
+def test_suptitle():
+ fig, _ = plt.subplots()
+ fig.suptitle('hello', color='r')
+ fig.suptitle('title', color='g', rotation='30')
+
+
+def test_suptitle_fontproperties():
+ fig, ax = plt.subplots()
+ fps = mpl.font_manager.FontProperties(size='large', weight='bold')
+ txt = fig.suptitle('fontprops title', fontproperties=fps)
+ assert txt.get_fontsize() == fps.get_size_in_points()
+ assert txt.get_weight() == fps.get_weight()
+
+
+@image_comparison(['alpha_background'],
+ # only test png and svg. The PDF output appears correct,
+ # but Ghostscript does not preserve the background color.
+ extensions=['png', 'svg'],
+ savefig_kwarg={'facecolor': (0, 1, 0.4),
+ 'edgecolor': 'none'})
+def test_alpha():
+ # We want an image which has a background color and an alpha of 0.4.
+ fig = plt.figure(figsize=[2, 1])
+ fig.set_facecolor((0, 1, 0.4))
+ fig.patch.set_alpha(0.4)
+ fig.patches.append(mpl.patches.CirclePolygon(
+ [20, 20], radius=15, alpha=0.6, facecolor='red'))
+
+
+def test_too_many_figures():
+ with pytest.warns(RuntimeWarning):
+ for i in range(rcParams['figure.max_open_warning'] + 1):
+ plt.figure()
+
+
+def test_iterability_axes_argument():
+
+ # This is a regression test for matplotlib/matplotlib#3196. If one of the
+ # arguments returned by _as_mpl_axes defines __getitem__ but is not
+ # iterable, this would raise an exception. This is because we check
+ # whether the arguments are iterable, and if so we try and convert them
+ # to a tuple. However, the ``iterable`` function returns True if
+ # __getitem__ is present, but some classes can define __getitem__ without
+ # being iterable. The tuple conversion is now done in a try...except in
+ # case it fails.
+
+ class MyAxes(Axes):
+ def __init__(self, *args, myclass=None, **kwargs):
+ return Axes.__init__(self, *args, **kwargs)
+
+ class MyClass:
+
+ def __getitem__(self, item):
+ if item != 'a':
+ raise ValueError("item should be a")
+
+ def _as_mpl_axes(self):
+ return MyAxes, {'myclass': self}
+
+ fig = plt.figure()
+ fig.add_subplot(1, 1, 1, projection=MyClass())
+ plt.close(fig)
+
+
+def test_set_fig_size():
+ fig = plt.figure()
+
+ # check figwidth
+ fig.set_figwidth(5)
+ assert fig.get_figwidth() == 5
+
+ # check figheight
+ fig.set_figheight(1)
+ assert fig.get_figheight() == 1
+
+ # check using set_size_inches
+ fig.set_size_inches(2, 4)
+ assert fig.get_figwidth() == 2
+ assert fig.get_figheight() == 4
+
+ # check using tuple to first argument
+ fig.set_size_inches((1, 3))
+ assert fig.get_figwidth() == 1
+ assert fig.get_figheight() == 3
+
+
+def test_axes_remove():
+ fig, axs = plt.subplots(2, 2)
+ axs[-1, -1].remove()
+ for ax in axs.ravel()[:-1]:
+ assert ax in fig.axes
+ assert axs[-1, -1] not in fig.axes
+ assert len(fig.axes) == 3
+
+
+def test_figaspect():
+ w, h = plt.figaspect(np.float64(2) / np.float64(1))
+ assert h / w == 2
+ w, h = plt.figaspect(2)
+ assert h / w == 2
+ w, h = plt.figaspect(np.zeros((1, 2)))
+ assert h / w == 0.5
+ w, h = plt.figaspect(np.zeros((2, 2)))
+ assert h / w == 1
+
+
+@pytest.mark.parametrize('which', [None, 'both', 'major', 'minor'])
+def test_autofmt_xdate(which):
+ date = ['3 Jan 2013', '4 Jan 2013', '5 Jan 2013', '6 Jan 2013',
+ '7 Jan 2013', '8 Jan 2013', '9 Jan 2013', '10 Jan 2013',
+ '11 Jan 2013', '12 Jan 2013', '13 Jan 2013', '14 Jan 2013']
+
+ time = ['16:44:00', '16:45:00', '16:46:00', '16:47:00', '16:48:00',
+ '16:49:00', '16:51:00', '16:52:00', '16:53:00', '16:55:00',
+ '16:56:00', '16:57:00']
+
+ angle = 60
+ minors = [1, 2, 3, 4, 5, 6, 7]
+
+ x = mdates.datestr2num(date)
+ y = mdates.datestr2num(time)
+
+ fig, ax = plt.subplots()
+
+ ax.plot(x, y)
+ ax.yaxis_date()
+ ax.xaxis_date()
+
+ ax.xaxis.set_minor_locator(AutoMinorLocator(2))
+ with warnings.catch_warnings():
+ warnings.filterwarnings(
+ 'ignore',
+ 'FixedFormatter should only be used together with FixedLocator')
+ ax.xaxis.set_minor_formatter(FixedFormatter(minors))
+
+ with (pytest.warns(mpl.MatplotlibDeprecationWarning) if which is None else
+ nullcontext()):
+ fig.autofmt_xdate(0.2, angle, 'right', which)
+
+ if which in ('both', 'major', None):
+ for label in fig.axes[0].get_xticklabels(False, 'major'):
+ assert int(label.get_rotation()) == angle
+
+ if which in ('both', 'minor'):
+ for label in fig.axes[0].get_xticklabels(True, 'minor'):
+ assert int(label.get_rotation()) == angle
+
+
+@pytest.mark.style('default')
+def test_change_dpi():
+ fig = plt.figure(figsize=(4, 4))
+ fig.canvas.draw()
+ assert fig.canvas.renderer.height == 400
+ assert fig.canvas.renderer.width == 400
+ fig.dpi = 50
+ fig.canvas.draw()
+ assert fig.canvas.renderer.height == 200
+ assert fig.canvas.renderer.width == 200
+
+
+@pytest.mark.parametrize('width, height', [
+ (1, np.nan),
+ (-1, 1),
+ (np.inf, 1)
+])
+def test_invalid_figure_size(width, height):
+ with pytest.raises(ValueError):
+ plt.figure(figsize=(width, height))
+
+ fig = plt.figure()
+ with pytest.raises(ValueError):
+ fig.set_size_inches(width, height)
+
+
+def test_invalid_figure_add_axes():
+ fig = plt.figure()
+ with pytest.raises(ValueError):
+ fig.add_axes((.1, .1, .5, np.nan))
+
+ with pytest.raises(TypeError, match="multiple values for argument 'rect'"):
+ fig.add_axes([0, 0, 1, 1], rect=[0, 0, 1, 1])
+
+ _, ax = plt.subplots()
+ with pytest.raises(ValueError,
+ match="The Axes must have been created in the present "
+ "figure"):
+ fig.add_axes(ax)
+
+
+def test_subplots_shareax_loglabels():
+ fig, axs = plt.subplots(2, 2, sharex=True, sharey=True, squeeze=False)
+ for ax in axs.flat:
+ ax.plot([10, 20, 30], [10, 20, 30])
+
+ ax.set_yscale("log")
+ ax.set_xscale("log")
+
+ for ax in axs[0, :]:
+ assert 0 == len(ax.xaxis.get_ticklabels(which='both'))
+
+ for ax in axs[1, :]:
+ assert 0 < len(ax.xaxis.get_ticklabels(which='both'))
+
+ for ax in axs[:, 1]:
+ assert 0 == len(ax.yaxis.get_ticklabels(which='both'))
+
+ for ax in axs[:, 0]:
+ assert 0 < len(ax.yaxis.get_ticklabels(which='both'))
+
+
+def test_savefig():
+ fig = plt.figure()
+ msg = r"savefig\(\) takes 2 positional arguments but 3 were given"
+ with pytest.raises(TypeError, match=msg):
+ fig.savefig("fname1.png", "fname2.png")
+
+
+def test_savefig_warns():
+ fig = plt.figure()
+ msg = r'savefig\(\) got unexpected keyword argument "non_existent_kwarg"'
+ for format in ['png', 'pdf', 'svg', 'tif', 'jpg']:
+ with pytest.warns(cbook.MatplotlibDeprecationWarning, match=msg):
+ fig.savefig(io.BytesIO(), format=format, non_existent_kwarg=True)
+
+
+def test_savefig_backend():
+ fig = plt.figure()
+ # Intentionally use an invalid module name.
+ with pytest.raises(ModuleNotFoundError, match="No module named '@absent'"):
+ fig.savefig("test", backend="module://@absent")
+ with pytest.raises(ValueError,
+ match="The 'pdf' backend does not support png output"):
+ fig.savefig("test.png", backend="pdf")
+
+
+def test_figure_repr():
+ fig = plt.figure(figsize=(10, 20), dpi=10)
+ assert repr(fig) == "
"
+
+
+def test_warn_cl_plus_tl():
+ fig, ax = plt.subplots(constrained_layout=True)
+ with pytest.warns(UserWarning):
+ # this should warn,
+ fig.subplots_adjust(top=0.8)
+ assert not(fig.get_constrained_layout())
+
+
+@check_figures_equal(extensions=["png", "pdf"])
+def test_add_artist(fig_test, fig_ref):
+ fig_test.set_dpi(100)
+ fig_ref.set_dpi(100)
+
+ fig_test.subplots()
+ l1 = plt.Line2D([.2, .7], [.7, .7], gid='l1')
+ l2 = plt.Line2D([.2, .7], [.8, .8], gid='l2')
+ r1 = plt.Circle((20, 20), 100, transform=None, gid='C1')
+ r2 = plt.Circle((.7, .5), .05, gid='C2')
+ r3 = plt.Circle((4.5, .8), .55, transform=fig_test.dpi_scale_trans,
+ facecolor='crimson', gid='C3')
+ for a in [l1, l2, r1, r2, r3]:
+ fig_test.add_artist(a)
+ l2.remove()
+
+ ax2 = fig_ref.subplots()
+ l1 = plt.Line2D([.2, .7], [.7, .7], transform=fig_ref.transFigure,
+ gid='l1', zorder=21)
+ r1 = plt.Circle((20, 20), 100, transform=None, clip_on=False, zorder=20,
+ gid='C1')
+ r2 = plt.Circle((.7, .5), .05, transform=fig_ref.transFigure, gid='C2',
+ zorder=20)
+ r3 = plt.Circle((4.5, .8), .55, transform=fig_ref.dpi_scale_trans,
+ facecolor='crimson', clip_on=False, zorder=20, gid='C3')
+ for a in [l1, r1, r2, r3]:
+ ax2.add_artist(a)
+
+
+@pytest.mark.parametrize("fmt", ["png", "pdf", "ps", "eps", "svg"])
+def test_fspath(fmt, tmpdir):
+ out = Path(tmpdir, "test.{}".format(fmt))
+ plt.savefig(out)
+ with out.open("rb") as file:
+ # All the supported formats include the format name (case-insensitive)
+ # in the first 100 bytes.
+ assert fmt.encode("ascii") in file.read(100).lower()
+
+
+def test_tightbbox():
+ fig, ax = plt.subplots()
+ ax.set_xlim(0, 1)
+ t = ax.text(1., 0.5, 'This dangles over end')
+ renderer = fig.canvas.get_renderer()
+ x1Nom0 = 9.035 # inches
+ assert abs(t.get_tightbbox(renderer).x1 - x1Nom0 * fig.dpi) < 2
+ assert abs(ax.get_tightbbox(renderer).x1 - x1Nom0 * fig.dpi) < 2
+ assert abs(fig.get_tightbbox(renderer).x1 - x1Nom0) < 0.05
+ assert abs(fig.get_tightbbox(renderer).x0 - 0.679) < 0.05
+ # now exclude t from the tight bbox so now the bbox is quite a bit
+ # smaller
+ t.set_in_layout(False)
+ x1Nom = 7.333
+ assert abs(ax.get_tightbbox(renderer).x1 - x1Nom * fig.dpi) < 2
+ assert abs(fig.get_tightbbox(renderer).x1 - x1Nom) < 0.05
+
+ t.set_in_layout(True)
+ x1Nom = 7.333
+ assert abs(ax.get_tightbbox(renderer).x1 - x1Nom0 * fig.dpi) < 2
+ # test bbox_extra_artists method...
+ assert abs(ax.get_tightbbox(renderer, bbox_extra_artists=[]).x1
+ - x1Nom * fig.dpi) < 2
+
+
+def test_axes_removal():
+ # Check that units can set the formatter after an Axes removal
+ fig, axs = plt.subplots(1, 2, sharex=True)
+ axs[1].remove()
+ axs[0].plot([datetime(2000, 1, 1), datetime(2000, 2, 1)], [0, 1])
+ assert isinstance(axs[0].xaxis.get_major_formatter(),
+ mdates.AutoDateFormatter)
+
+ # Check that manually setting the formatter, then removing Axes keeps
+ # the set formatter.
+ fig, axs = plt.subplots(1, 2, sharex=True)
+ axs[1].xaxis.set_major_formatter(ScalarFormatter())
+ axs[1].remove()
+ axs[0].plot([datetime(2000, 1, 1), datetime(2000, 2, 1)], [0, 1])
+ assert isinstance(axs[0].xaxis.get_major_formatter(),
+ ScalarFormatter)
+
+
+def test_removed_axis():
+ # Simple smoke test to make sure removing a shared axis works
+ fig, axs = plt.subplots(2, sharex=True)
+ axs[0].remove()
+ fig.canvas.draw()
+
+
+@pytest.mark.style('mpl20')
+def test_picking_does_not_stale():
+ fig, ax = plt.subplots()
+ col = ax.scatter([0], [0], [1000], picker=True)
+ fig.canvas.draw()
+ assert not fig.stale
+
+ mouse_event = SimpleNamespace(x=ax.bbox.x0 + ax.bbox.width / 2,
+ y=ax.bbox.y0 + ax.bbox.height / 2,
+ inaxes=ax, guiEvent=None)
+ fig.pick(mouse_event)
+ assert not fig.stale
+
+
+def test_add_subplot_twotuple():
+ fig = plt.figure()
+ ax1 = fig.add_subplot(3, 2, (3, 5))
+ assert ax1.get_subplotspec().rowspan == range(1, 3)
+ assert ax1.get_subplotspec().colspan == range(0, 1)
+ ax2 = fig.add_subplot(3, 2, (4, 6))
+ assert ax2.get_subplotspec().rowspan == range(1, 3)
+ assert ax2.get_subplotspec().colspan == range(1, 2)
+ ax3 = fig.add_subplot(3, 2, (3, 6))
+ assert ax3.get_subplotspec().rowspan == range(1, 3)
+ assert ax3.get_subplotspec().colspan == range(0, 2)
+ ax4 = fig.add_subplot(3, 2, (4, 5))
+ assert ax4.get_subplotspec().rowspan == range(1, 3)
+ assert ax4.get_subplotspec().colspan == range(0, 2)
+ with pytest.raises(IndexError):
+ fig.add_subplot(3, 2, (6, 3))
+
+
+@image_comparison(['tightbbox_box_aspect.svg'], style='mpl20',
+ savefig_kwarg={'bbox_inches': 'tight',
+ 'facecolor': 'teal'},
+ remove_text=True)
+def test_tightbbox_box_aspect():
+ fig = plt.figure()
+ gs = fig.add_gridspec(1, 2)
+ ax1 = fig.add_subplot(gs[0, 0])
+ ax2 = fig.add_subplot(gs[0, 1], projection='3d')
+ ax1.set_box_aspect(.5)
+ ax2.set_box_aspect((2, 1, 1))
+
+
+@check_figures_equal(extensions=["svg", "pdf", "eps", "png"])
+def test_animated_with_canvas_change(fig_test, fig_ref):
+ ax_ref = fig_ref.subplots()
+ ax_ref.plot(range(5))
+
+ ax_test = fig_test.subplots()
+ ax_test.plot(range(5), animated=True)
+
+
+class TestSubplotMosaic:
+ @check_figures_equal(extensions=["png"])
+ @pytest.mark.parametrize(
+ "x", [[["A", "A", "B"], ["C", "D", "B"]], [[1, 1, 2], [3, 4, 2]]]
+ )
+ def test_basic(self, fig_test, fig_ref, x):
+ grid_axes = fig_test.subplot_mosaic(x)
+
+ for k, ax in grid_axes.items():
+ ax.set_title(k)
+
+ labels = sorted(np.unique(x))
+
+ assert len(labels) == len(grid_axes)
+
+ gs = fig_ref.add_gridspec(2, 3)
+ axA = fig_ref.add_subplot(gs[:1, :2])
+ axA.set_title(labels[0])
+
+ axB = fig_ref.add_subplot(gs[:, 2])
+ axB.set_title(labels[1])
+
+ axC = fig_ref.add_subplot(gs[1, 0])
+ axC.set_title(labels[2])
+
+ axD = fig_ref.add_subplot(gs[1, 1])
+ axD.set_title(labels[3])
+
+ @check_figures_equal(extensions=["png"])
+ def test_all_nested(self, fig_test, fig_ref):
+ x = [["A", "B"], ["C", "D"]]
+ y = [["E", "F"], ["G", "H"]]
+
+ fig_ref.set_constrained_layout(True)
+ fig_test.set_constrained_layout(True)
+
+ grid_axes = fig_test.subplot_mosaic([[x, y]])
+ for ax in grid_axes.values():
+ ax.set_title(ax.get_label())
+
+ gs = fig_ref.add_gridspec(1, 2)
+ gs_left = gs[0, 0].subgridspec(2, 2)
+ for j, r in enumerate(x):
+ for k, label in enumerate(r):
+ fig_ref.add_subplot(gs_left[j, k]).set_title(label)
+
+ gs_right = gs[0, 1].subgridspec(2, 2)
+ for j, r in enumerate(y):
+ for k, label in enumerate(r):
+ fig_ref.add_subplot(gs_right[j, k]).set_title(label)
+
+ @check_figures_equal(extensions=["png"])
+ def test_nested(self, fig_test, fig_ref):
+
+ fig_ref.set_constrained_layout(True)
+ fig_test.set_constrained_layout(True)
+
+ x = [["A", "B"], ["C", "D"]]
+
+ y = [["F"], [x]]
+
+ grid_axes = fig_test.subplot_mosaic(y)
+
+ for k, ax in grid_axes.items():
+ ax.set_title(k)
+
+ gs = fig_ref.add_gridspec(2, 1)
+
+ gs_n = gs[1, 0].subgridspec(2, 2)
+
+ axA = fig_ref.add_subplot(gs_n[0, 0])
+ axA.set_title("A")
+
+ axB = fig_ref.add_subplot(gs_n[0, 1])
+ axB.set_title("B")
+
+ axC = fig_ref.add_subplot(gs_n[1, 0])
+ axC.set_title("C")
+
+ axD = fig_ref.add_subplot(gs_n[1, 1])
+ axD.set_title("D")
+
+ axF = fig_ref.add_subplot(gs[0, 0])
+ axF.set_title("F")
+
+ @check_figures_equal(extensions=["png"])
+ def test_nested_tuple(self, fig_test, fig_ref):
+ x = [["A", "B", "B"], ["C", "C", "D"]]
+ xt = (("A", "B", "B"), ("C", "C", "D"))
+
+ fig_ref.subplot_mosaic([["F"], [x]])
+ fig_test.subplot_mosaic([["F"], [xt]])
+
+ @check_figures_equal(extensions=["png"])
+ @pytest.mark.parametrize(
+ "x, empty_sentinel",
+ [
+ ([["A", None], [None, "B"]], None),
+ ([["A", "."], [".", "B"]], "SKIP"),
+ ([["A", 0], [0, "B"]], 0),
+ ([[1, None], [None, 2]], None),
+ ([[1, "."], [".", 2]], "SKIP"),
+ ([[1, 0], [0, 2]], 0),
+ ],
+ )
+ def test_empty(self, fig_test, fig_ref, x, empty_sentinel):
+ if empty_sentinel != "SKIP":
+ kwargs = {"empty_sentinel": empty_sentinel}
+ else:
+ kwargs = {}
+ grid_axes = fig_test.subplot_mosaic(x, **kwargs)
+
+ for k, ax in grid_axes.items():
+ ax.set_title(k)
+
+ labels = sorted(
+ {name for row in x for name in row} - {empty_sentinel, "."}
+ )
+
+ assert len(labels) == len(grid_axes)
+
+ gs = fig_ref.add_gridspec(2, 2)
+ axA = fig_ref.add_subplot(gs[0, 0])
+ axA.set_title(labels[0])
+
+ axB = fig_ref.add_subplot(gs[1, 1])
+ axB.set_title(labels[1])
+
+ def test_fail_list_of_str(self):
+ with pytest.raises(ValueError, match='must be 2D'):
+ plt.subplot_mosaic(['foo', 'bar'])
+ with pytest.raises(ValueError, match='must be 2D'):
+ plt.subplot_mosaic(['foo'])
+
+ @check_figures_equal(extensions=["png"])
+ @pytest.mark.parametrize("subplot_kw", [{}, {"projection": "polar"}, None])
+ def test_subplot_kw(self, fig_test, fig_ref, subplot_kw):
+ x = [[1, 2]]
+ grid_axes = fig_test.subplot_mosaic(x, subplot_kw=subplot_kw)
+ subplot_kw = subplot_kw or {}
+
+ gs = fig_ref.add_gridspec(1, 2)
+ axA = fig_ref.add_subplot(gs[0, 0], **subplot_kw)
+
+ axB = fig_ref.add_subplot(gs[0, 1], **subplot_kw)
+
+ def test_string_parser(self):
+ normalize = Figure._normalize_grid_string
+ assert normalize('ABC') == [['A', 'B', 'C']]
+ assert normalize('AB;CC') == [['A', 'B'], ['C', 'C']]
+ assert normalize('AB;CC;DE') == [['A', 'B'], ['C', 'C'], ['D', 'E']]
+ assert normalize("""
+ ABC
+ """) == [['A', 'B', 'C']]
+ assert normalize("""
+ AB
+ CC
+ """) == [['A', 'B'], ['C', 'C']]
+ assert normalize("""
+ AB
+ CC
+ DE
+ """) == [['A', 'B'], ['C', 'C'], ['D', 'E']]
+
+ @check_figures_equal(extensions=["png"])
+ @pytest.mark.parametrize("str_pattern",
+ ["AAA\nBBB", "\nAAA\nBBB\n", "ABC\nDEF"]
+ )
+ def test_single_str_input(self, fig_test, fig_ref, str_pattern):
+ grid_axes = fig_test.subplot_mosaic(str_pattern)
+
+ grid_axes = fig_ref.subplot_mosaic(
+ [list(ln) for ln in str_pattern.strip().split("\n")]
+ )
+
+ @pytest.mark.parametrize(
+ "x,match",
+ [
+ (
+ [["A", "."], [".", "A"]],
+ (
+ "(?m)we found that the label .A. specifies a "
+ + "non-rectangular or non-contiguous area."
+ ),
+ ),
+ (
+ [["A", "B"], [None, [["A", "B"], ["C", "D"]]]],
+ "There are duplicate keys .* between the outer layout",
+ ),
+ ("AAA\nc\nBBB", "All of the rows must be the same length"),
+ (
+ [["A", [["B", "C"], ["D"]]], ["E", "E"]],
+ "All of the rows must be the same length",
+ ),
+ ],
+ )
+ def test_fail(self, x, match):
+ fig = plt.figure()
+ with pytest.raises(ValueError, match=match):
+ fig.subplot_mosaic(x)
+
+ @check_figures_equal(extensions=["png"])
+ def test_hashable_keys(self, fig_test, fig_ref):
+ fig_test.subplot_mosaic([[object(), object()]])
+ fig_ref.subplot_mosaic([["A", "B"]])
+
+ @pytest.mark.parametrize('str_pattern',
+ ['abc', 'cab', 'bca', 'cba', 'acb', 'bac'])
+ def test_user_order(self, str_pattern):
+ fig = plt.figure()
+ ax_dict = fig.subplot_mosaic(str_pattern)
+ assert list(str_pattern) == list(ax_dict)
+ assert list(fig.axes) == list(ax_dict.values())
+
+ def test_nested_user_order(self):
+ layout = [
+ ["A", [["B", "C"],
+ ["D", "E"]]],
+ ["F", "G"],
+ [".", [["H", [["I"],
+ ["."]]]]]
+ ]
+
+ fig = plt.figure()
+ ax_dict = fig.subplot_mosaic(layout)
+ assert list(ax_dict) == list("ABCDEFGHI")
+ assert list(fig.axes) == list(ax_dict.values())
+
+
+def test_reused_gridspec():
+ """Test that these all use the same gridspec"""
+ fig = plt.figure()
+ ax1 = fig.add_subplot(3, 2, (3, 5))
+ ax2 = fig.add_subplot(3, 2, 4)
+ ax3 = plt.subplot2grid((3, 2), (2, 1), colspan=2, fig=fig)
+
+ gs1 = ax1.get_subplotspec().get_gridspec()
+ gs2 = ax2.get_subplotspec().get_gridspec()
+ gs3 = ax3.get_subplotspec().get_gridspec()
+
+ assert gs1 == gs2
+ assert gs1 == gs3
+
+
+@image_comparison(['test_subfigure.png'], style='mpl20',
+ savefig_kwarg={'facecolor': 'teal'},
+ remove_text=False)
+def test_subfigure():
+ np.random.seed(19680801)
+ fig = plt.figure(constrained_layout=True)
+ sub = fig.subfigures(1, 2)
+
+ axs = sub[0].subplots(2, 2)
+ for ax in axs.flat:
+ pc = ax.pcolormesh(np.random.randn(30, 30), vmin=-2, vmax=2)
+ sub[0].colorbar(pc, ax=axs)
+ sub[0].suptitle('Left Side')
+
+ axs = sub[1].subplots(1, 3)
+ for ax in axs.flat:
+ pc = ax.pcolormesh(np.random.randn(30, 30), vmin=-2, vmax=2)
+ sub[1].colorbar(pc, ax=axs, location='bottom')
+ sub[1].suptitle('Right Side')
+
+ fig.suptitle('Figure suptitle', fontsize='xx-large')
+
+
+def test_subfigure_tightbbox():
+ # test that we can get the tightbbox with a subfigure...
+ fig = plt.figure(constrained_layout=True)
+ sub = fig.subfigures(1, 2)
+
+ np.testing.assert_allclose(
+ fig.get_tightbbox(fig.canvas.get_renderer()).width, 0.1)
+
+
+@image_comparison(['test_subfigure_ss.png'], style='mpl20',
+ savefig_kwarg={'facecolor': 'teal'},
+ remove_text=False)
+def test_subfigure_ss():
+ # test assigning the subfigure via subplotspec
+ np.random.seed(19680801)
+ fig = plt.figure(constrained_layout=True)
+ gs = fig.add_gridspec(1, 2)
+
+ sub = fig.add_subfigure(gs[0], facecolor='pink')
+
+ axs = sub.subplots(2, 2)
+ for ax in axs.flat:
+ pc = ax.pcolormesh(np.random.randn(30, 30), vmin=-2, vmax=2)
+ sub.colorbar(pc, ax=axs)
+ sub.suptitle('Left Side')
+
+ ax = fig.add_subplot(gs[1])
+ ax.plot(np.arange(20))
+ ax.set_title('Axes')
+
+ fig.suptitle('Figure suptitle', fontsize='xx-large')
+
+
+@image_comparison(['test_subfigure_double.png'], style='mpl20',
+ savefig_kwarg={'facecolor': 'teal'},
+ remove_text=False)
+def test_subfigure_double():
+ # test assigning the subfigure via subplotspec
+ np.random.seed(19680801)
+
+ fig = plt.figure(constrained_layout=True, figsize=(10, 8))
+
+ fig.suptitle('fig')
+
+ subfigs = fig.subfigures(1, 2, wspace=0.07)
+
+ subfigs[0].set_facecolor('coral')
+ subfigs[0].suptitle('subfigs[0]')
+
+ subfigs[1].set_facecolor('coral')
+ subfigs[1].suptitle('subfigs[1]')
+
+ subfigsnest = subfigs[0].subfigures(2, 1, height_ratios=[1, 1.4])
+ subfigsnest[0].suptitle('subfigsnest[0]')
+ subfigsnest[0].set_facecolor('r')
+ axsnest0 = subfigsnest[0].subplots(1, 2, sharey=True)
+ for ax in axsnest0:
+ fontsize = 12
+ pc = ax.pcolormesh(np.random.randn(30, 30), vmin=-2.5, vmax=2.5)
+ ax.set_xlabel('x-label', fontsize=fontsize)
+ ax.set_ylabel('y-label', fontsize=fontsize)
+ ax.set_title('Title', fontsize=fontsize)
+
+ subfigsnest[0].colorbar(pc, ax=axsnest0)
+
+ subfigsnest[1].suptitle('subfigsnest[1]')
+ subfigsnest[1].set_facecolor('g')
+ axsnest1 = subfigsnest[1].subplots(3, 1, sharex=True)
+ for nn, ax in enumerate(axsnest1):
+ ax.set_ylabel(f'ylabel{nn}')
+ subfigsnest[1].supxlabel('supxlabel')
+ subfigsnest[1].supylabel('supylabel')
+
+ axsRight = subfigs[1].subplots(2, 2)
+
+
+def test_subfigure_spanning():
+ # test that subfigures get laid out properly...
+ fig = plt.figure(constrained_layout=True)
+ gs = fig.add_gridspec(3, 3)
+ sub_figs = [
+ fig.add_subfigure(gs[0, 0]),
+ fig.add_subfigure(gs[0:2, 1]),
+ fig.add_subfigure(gs[2, 1:3]),
+ ]
+
+ w = 640
+ h = 480
+ np.testing.assert_allclose(sub_figs[0].bbox.min, [0., h * 2/3])
+ np.testing.assert_allclose(sub_figs[0].bbox.max, [w / 3, h])
+
+ np.testing.assert_allclose(sub_figs[1].bbox.min, [w / 3, h / 3])
+ np.testing.assert_allclose(sub_figs[1].bbox.max, [w * 2/3, h])
+
+ np.testing.assert_allclose(sub_figs[2].bbox.min, [w / 3, 0])
+ np.testing.assert_allclose(sub_figs[2].bbox.max, [w, h / 3])
+
+
+def test_add_subplot_kwargs():
+ # fig.add_subplot() always creates new axes, even if axes kwargs differ.
+ fig = plt.figure()
+ ax = fig.add_subplot(1, 1, 1)
+ ax1 = fig.add_subplot(1, 1, 1)
+ assert ax is not None
+ assert ax1 is not ax
+ plt.close()
+
+ fig = plt.figure()
+ ax = fig.add_subplot(1, 1, 1, projection='polar')
+ ax1 = fig.add_subplot(1, 1, 1, projection='polar')
+ assert ax is not None
+ assert ax1 is not ax
+ plt.close()
+
+ fig = plt.figure()
+ ax = fig.add_subplot(1, 1, 1, projection='polar')
+ ax1 = fig.add_subplot(1, 1, 1)
+ assert ax is not None
+ assert ax1.name == 'rectilinear'
+ assert ax1 is not ax
+ plt.close()
+
+
+def test_add_axes_kwargs():
+ # fig.add_axes() always creates new axes, even if axes kwargs differ.
+ fig = plt.figure()
+ ax = fig.add_axes([0, 0, 1, 1])
+ ax1 = fig.add_axes([0, 0, 1, 1])
+ assert ax is not None
+ assert ax1 is not ax
+ plt.close()
+
+ fig = plt.figure()
+ ax = fig.add_axes([0, 0, 1, 1], projection='polar')
+ ax1 = fig.add_axes([0, 0, 1, 1], projection='polar')
+ assert ax is not None
+ assert ax1 is not ax
+ plt.close()
+
+ fig = plt.figure()
+ ax = fig.add_axes([0, 0, 1, 1], projection='polar')
+ ax1 = fig.add_axes([0, 0, 1, 1])
+ assert ax is not None
+ assert ax1.name == 'rectilinear'
+ assert ax1 is not ax
+ plt.close()
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_font_manager.py b/venv/Lib/site-packages/matplotlib/tests/test_font_manager.py
new file mode 100644
index 0000000..1e8252a
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_font_manager.py
@@ -0,0 +1,257 @@
+from io import BytesIO, StringIO
+import multiprocessing
+import os
+from pathlib import Path
+import shutil
+import subprocess
+import sys
+import warnings
+
+import numpy as np
+import pytest
+
+from matplotlib.font_manager import (
+ findfont, findSystemFonts, FontProperties, fontManager, json_dump,
+ json_load, get_font, get_fontconfig_fonts, is_opentype_cff_font,
+ MSUserFontDirectories, _call_fc_list)
+from matplotlib import pyplot as plt, rc_context
+
+has_fclist = shutil.which('fc-list') is not None
+
+
+def test_font_priority():
+ with rc_context(rc={
+ 'font.sans-serif':
+ ['cmmi10', 'Bitstream Vera Sans']}):
+ font = findfont(FontProperties(family=["sans-serif"]))
+ assert Path(font).name == 'cmmi10.ttf'
+
+ # Smoketest get_charmap, which isn't used internally anymore
+ font = get_font(font)
+ cmap = font.get_charmap()
+ assert len(cmap) == 131
+ assert cmap[8729] == 30
+
+
+def test_score_weight():
+ assert 0 == fontManager.score_weight("regular", "regular")
+ assert 0 == fontManager.score_weight("bold", "bold")
+ assert (0 < fontManager.score_weight(400, 400) <
+ fontManager.score_weight("normal", "bold"))
+ assert (0 < fontManager.score_weight("normal", "regular") <
+ fontManager.score_weight("normal", "bold"))
+ assert (fontManager.score_weight("normal", "regular") ==
+ fontManager.score_weight(400, 400))
+
+
+def test_json_serialization(tmpdir):
+ # Can't open a NamedTemporaryFile twice on Windows, so use a temporary
+ # directory instead.
+ path = Path(tmpdir, "fontlist.json")
+ json_dump(fontManager, path)
+ copy = json_load(path)
+ with warnings.catch_warnings():
+ warnings.filterwarnings('ignore', 'findfont: Font family.*not found')
+ for prop in ({'family': 'STIXGeneral'},
+ {'family': 'Bitstream Vera Sans', 'weight': 700},
+ {'family': 'no such font family'}):
+ fp = FontProperties(**prop)
+ assert (fontManager.findfont(fp, rebuild_if_missing=False) ==
+ copy.findfont(fp, rebuild_if_missing=False))
+
+
+def test_otf():
+ fname = '/usr/share/fonts/opentype/freefont/FreeMono.otf'
+ if Path(fname).exists():
+ assert is_opentype_cff_font(fname)
+ for f in fontManager.ttflist:
+ if 'otf' in f.fname:
+ with open(f.fname, 'rb') as fd:
+ res = fd.read(4) == b'OTTO'
+ assert res == is_opentype_cff_font(f.fname)
+
+
+@pytest.mark.skipif(not has_fclist, reason='no fontconfig installed')
+def test_get_fontconfig_fonts():
+ assert len(get_fontconfig_fonts()) > 1
+
+
+@pytest.mark.parametrize('factor', [2, 4, 6, 8])
+def test_hinting_factor(factor):
+ font = findfont(FontProperties(family=["sans-serif"]))
+
+ font1 = get_font(font, hinting_factor=1)
+ font1.clear()
+ font1.set_size(12, 100)
+ font1.set_text('abc')
+ expected = font1.get_width_height()
+
+ hinted_font = get_font(font, hinting_factor=factor)
+ hinted_font.clear()
+ hinted_font.set_size(12, 100)
+ hinted_font.set_text('abc')
+ # Check that hinting only changes text layout by a small (10%) amount.
+ np.testing.assert_allclose(hinted_font.get_width_height(), expected,
+ rtol=0.1)
+
+
+def test_utf16m_sfnt():
+ try:
+ # seguisbi = Microsoft Segoe UI Semibold
+ entry = next(entry for entry in fontManager.ttflist
+ if Path(entry.fname).name == "seguisbi.ttf")
+ except StopIteration:
+ pytest.skip("Couldn't find font to test against.")
+ else:
+ # Check that we successfully read "semibold" from the font's sfnt table
+ # and set its weight accordingly.
+ assert entry.weight == 600
+
+
+def test_find_ttc():
+ fp = FontProperties(family=["WenQuanYi Zen Hei"])
+ if Path(findfont(fp)).name != "wqy-zenhei.ttc":
+ pytest.skip("Font may be missing")
+
+ fig, ax = plt.subplots()
+ ax.text(.5, .5, "\N{KANGXI RADICAL DRAGON}", fontproperties=fp)
+ for fmt in ["raw", "svg", "pdf", "ps"]:
+ fig.savefig(BytesIO(), format=fmt)
+
+
+def test_find_invalid(tmpdir):
+ tmp_path = Path(tmpdir)
+
+ with pytest.raises(FileNotFoundError):
+ get_font(tmp_path / 'non-existent-font-name.ttf')
+
+ with pytest.raises(FileNotFoundError):
+ get_font(str(tmp_path / 'non-existent-font-name.ttf'))
+
+ with pytest.raises(FileNotFoundError):
+ get_font(bytes(tmp_path / 'non-existent-font-name.ttf'))
+
+ # Not really public, but get_font doesn't expose non-filename constructor.
+ from matplotlib.ft2font import FT2Font
+ with pytest.raises(TypeError, match='path or binary-mode file'):
+ FT2Font(StringIO())
+
+
+@pytest.mark.skipif(sys.platform != 'linux', reason='Linux only')
+def test_user_fonts_linux(tmpdir, monkeypatch):
+ font_test_file = 'mpltest.ttf'
+
+ # Precondition: the test font should not be available
+ fonts = findSystemFonts()
+ if any(font_test_file in font for font in fonts):
+ pytest.skip(f'{font_test_file} already exists in system fonts')
+
+ # Prepare a temporary user font directory
+ user_fonts_dir = tmpdir.join('fonts')
+ user_fonts_dir.ensure(dir=True)
+ shutil.copyfile(Path(__file__).parent / font_test_file,
+ user_fonts_dir.join(font_test_file))
+
+ with monkeypatch.context() as m:
+ m.setenv('XDG_DATA_HOME', str(tmpdir))
+ _call_fc_list.cache_clear()
+ # Now, the font should be available
+ fonts = findSystemFonts()
+ assert any(font_test_file in font for font in fonts)
+
+ # Make sure the temporary directory is no longer cached.
+ _call_fc_list.cache_clear()
+
+
+@pytest.mark.skipif(sys.platform != 'win32', reason='Windows only')
+def test_user_fonts_win32():
+ if not (os.environ.get('APPVEYOR') or os.environ.get('TF_BUILD')):
+ pytest.xfail("This test should only run on CI (appveyor or azure) "
+ "as the developer's font directory should remain "
+ "unchanged.")
+
+ font_test_file = 'mpltest.ttf'
+
+ # Precondition: the test font should not be available
+ fonts = findSystemFonts()
+ if any(font_test_file in font for font in fonts):
+ pytest.skip(f'{font_test_file} already exists in system fonts')
+
+ user_fonts_dir = MSUserFontDirectories[0]
+
+ # Make sure that the user font directory exists (this is probably not the
+ # case on Windows versions < 1809)
+ os.makedirs(user_fonts_dir)
+
+ # Copy the test font to the user font directory
+ shutil.copy(Path(__file__).parent / font_test_file, user_fonts_dir)
+
+ # Now, the font should be available
+ fonts = findSystemFonts()
+ assert any(font_test_file in font for font in fonts)
+
+
+def _model_handler(_):
+ fig, ax = plt.subplots()
+ fig.savefig(BytesIO(), format="pdf")
+ plt.close()
+
+
+@pytest.mark.skipif(not hasattr(os, "register_at_fork"),
+ reason="Cannot register at_fork handlers")
+def test_fork():
+ _model_handler(0) # Make sure the font cache is filled.
+ ctx = multiprocessing.get_context("fork")
+ with ctx.Pool(processes=2) as pool:
+ pool.map(_model_handler, range(2))
+
+
+def test_missing_family(caplog):
+ plt.rcParams["font.sans-serif"] = ["this-font-does-not-exist"]
+ with caplog.at_level("WARNING"):
+ findfont("sans")
+ assert [rec.getMessage() for rec in caplog.records] == [
+ "findfont: Font family ['sans'] not found. "
+ "Falling back to DejaVu Sans.",
+ "findfont: Generic family 'sans' not found because none of the "
+ "following families were found: this-font-does-not-exist",
+ ]
+
+
+def _test_threading():
+ import threading
+ from matplotlib.ft2font import LOAD_NO_HINTING
+ import matplotlib.font_manager as fm
+
+ N = 10
+ b = threading.Barrier(N)
+
+ def bad_idea(n):
+ b.wait()
+ for j in range(100):
+ font = fm.get_font(fm.findfont("DejaVu Sans"))
+ font.set_text(str(n), 0.0, flags=LOAD_NO_HINTING)
+
+ threads = [
+ threading.Thread(target=bad_idea, name=f"bad_thread_{j}", args=(j,))
+ for j in range(N)
+ ]
+
+ for t in threads:
+ t.start()
+
+ for t in threads:
+ t.join()
+
+
+def test_fontcache_thread_safe():
+ pytest.importorskip('threading')
+ import inspect
+
+ proc = subprocess.run(
+ [sys.executable, "-c",
+ inspect.getsource(_test_threading) + '\n_test_threading()']
+ )
+ if proc.returncode:
+ pytest.fail("The subprocess returned with non-zero exit status "
+ f"{proc.returncode}.")
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_fontconfig_pattern.py b/venv/Lib/site-packages/matplotlib/tests/test_fontconfig_pattern.py
new file mode 100644
index 0000000..65eba80
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_fontconfig_pattern.py
@@ -0,0 +1,70 @@
+from matplotlib.font_manager import FontProperties
+
+
+# Attributes on FontProperties object to check for consistency
+keys = [
+ "get_family",
+ "get_style",
+ "get_variant",
+ "get_weight",
+ "get_size",
+ ]
+
+
+def test_fontconfig_pattern():
+ """Test converting a FontProperties to string then back."""
+
+ # Defaults
+ test = "defaults "
+ f1 = FontProperties()
+ s = str(f1)
+
+ f2 = FontProperties(s)
+ for k in keys:
+ assert getattr(f1, k)() == getattr(f2, k)(), test + k
+
+ # Basic inputs
+ test = "basic "
+ f1 = FontProperties(family="serif", size=20, style="italic")
+ s = str(f1)
+
+ f2 = FontProperties(s)
+ for k in keys:
+ assert getattr(f1, k)() == getattr(f2, k)(), test + k
+
+ # Full set of inputs.
+ test = "full "
+ f1 = FontProperties(family="sans-serif", size=24, weight="bold",
+ style="oblique", variant="small-caps",
+ stretch="expanded")
+ s = str(f1)
+
+ f2 = FontProperties(s)
+ for k in keys:
+ assert getattr(f1, k)() == getattr(f2, k)(), test + k
+
+
+def test_fontconfig_str():
+ """Test FontProperties string conversions for correctness."""
+
+ # Known good strings taken from actual font config specs on a linux box
+ # and modified for MPL defaults.
+
+ # Default values found by inspection.
+ test = "defaults "
+ s = ("sans\\-serif:style=normal:variant=normal:weight=normal"
+ ":stretch=normal:size=12.0")
+ font = FontProperties(s)
+ right = FontProperties()
+ for k in keys:
+ assert getattr(font, k)() == getattr(right, k)(), test + k
+
+ test = "full "
+ s = ("serif:size=24:style=oblique:variant=small-caps:weight=bold"
+ ":stretch=expanded")
+ font = FontProperties(s)
+ right = FontProperties(family="serif", size=24, weight="bold",
+ style="oblique", variant="small-caps",
+ stretch="expanded")
+ for k in keys:
+ assert getattr(font, k)() == getattr(right, k)(), test + k
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_gridspec.py b/venv/Lib/site-packages/matplotlib/tests/test_gridspec.py
new file mode 100644
index 0000000..5d5d752
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_gridspec.py
@@ -0,0 +1,37 @@
+import matplotlib.gridspec as gridspec
+import pytest
+
+
+def test_equal():
+ gs = gridspec.GridSpec(2, 1)
+ assert gs[0, 0] == gs[0, 0]
+ assert gs[:, 0] == gs[:, 0]
+
+
+def test_width_ratios():
+ """
+ Addresses issue #5835.
+ See at https://github.com/matplotlib/matplotlib/issues/5835.
+ """
+ with pytest.raises(ValueError):
+ gridspec.GridSpec(1, 1, width_ratios=[2, 1, 3])
+
+
+def test_height_ratios():
+ """
+ Addresses issue #5835.
+ See at https://github.com/matplotlib/matplotlib/issues/5835.
+ """
+ with pytest.raises(ValueError):
+ gridspec.GridSpec(1, 1, height_ratios=[2, 1, 3])
+
+
+def test_repr():
+ ss = gridspec.GridSpec(3, 3)[2, 1:3]
+ assert repr(ss) == "GridSpec(3, 3)[2:3, 1:3]"
+
+ ss = gridspec.GridSpec(2, 2,
+ height_ratios=(3, 1),
+ width_ratios=(1, 3))
+ assert repr(ss) == \
+ "GridSpec(2, 2, height_ratios=(3, 1), width_ratios=(1, 3))"
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_image.py b/venv/Lib/site-packages/matplotlib/tests/test_image.py
new file mode 100644
index 0000000..9657968
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_image.py
@@ -0,0 +1,1265 @@
+from contextlib import ExitStack
+from copy import copy
+import io
+import os
+from pathlib import Path
+import platform
+import sys
+import urllib.request
+
+import numpy as np
+from numpy.testing import assert_array_equal
+from PIL import Image
+
+from matplotlib import (
+ _api, colors, image as mimage, patches, pyplot as plt, style, rcParams)
+from matplotlib.image import (AxesImage, BboxImage, FigureImage,
+ NonUniformImage, PcolorImage)
+from matplotlib.testing.decorators import check_figures_equal, image_comparison
+from matplotlib.transforms import Bbox, Affine2D, TransformedBbox
+import matplotlib.ticker as mticker
+
+import pytest
+
+
+@image_comparison(['image_interps'], style='mpl20')
+def test_image_interps():
+ """Make the basic nearest, bilinear and bicubic interps."""
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['text.kerning_factor'] = 6
+
+ X = np.arange(100).reshape(5, 20)
+
+ fig, (ax1, ax2, ax3) = plt.subplots(3)
+ ax1.imshow(X, interpolation='nearest')
+ ax1.set_title('three interpolations')
+ ax1.set_ylabel('nearest')
+
+ ax2.imshow(X, interpolation='bilinear')
+ ax2.set_ylabel('bilinear')
+
+ ax3.imshow(X, interpolation='bicubic')
+ ax3.set_ylabel('bicubic')
+
+
+@image_comparison(['interp_alpha.png'], remove_text=True)
+def test_alpha_interp():
+ """Test the interpolation of the alpha channel on RGBA images"""
+ fig, (axl, axr) = plt.subplots(1, 2)
+ # full green image
+ img = np.zeros((5, 5, 4))
+ img[..., 1] = np.ones((5, 5))
+ # transparent under main diagonal
+ img[..., 3] = np.tril(np.ones((5, 5), dtype=np.uint8))
+ axl.imshow(img, interpolation="none")
+ axr.imshow(img, interpolation="bilinear")
+
+
+@image_comparison(['interp_nearest_vs_none'],
+ extensions=['pdf', 'svg'], remove_text=True)
+def test_interp_nearest_vs_none():
+ """Test the effect of "nearest" and "none" interpolation"""
+ # Setting dpi to something really small makes the difference very
+ # visible. This works fine with pdf, since the dpi setting doesn't
+ # affect anything but images, but the agg output becomes unusably
+ # small.
+ rcParams['savefig.dpi'] = 3
+ X = np.array([[[218, 165, 32], [122, 103, 238]],
+ [[127, 255, 0], [255, 99, 71]]], dtype=np.uint8)
+ fig, (ax1, ax2) = plt.subplots(1, 2)
+ ax1.imshow(X, interpolation='none')
+ ax1.set_title('interpolation none')
+ ax2.imshow(X, interpolation='nearest')
+ ax2.set_title('interpolation nearest')
+
+
+@pytest.mark.parametrize('suppressComposite', [False, True])
+@image_comparison(['figimage'], extensions=['png', 'pdf'])
+def test_figimage(suppressComposite):
+ fig = plt.figure(figsize=(2, 2), dpi=100)
+ fig.suppressComposite = suppressComposite
+ x, y = np.ix_(np.arange(100) / 100.0, np.arange(100) / 100)
+ z = np.sin(x**2 + y**2 - x*y)
+ c = np.sin(20*x**2 + 50*y**2)
+ img = z + c/5
+
+ fig.figimage(img, xo=0, yo=0, origin='lower')
+ fig.figimage(img[::-1, :], xo=0, yo=100, origin='lower')
+ fig.figimage(img[:, ::-1], xo=100, yo=0, origin='lower')
+ fig.figimage(img[::-1, ::-1], xo=100, yo=100, origin='lower')
+
+
+def test_image_python_io():
+ fig, ax = plt.subplots()
+ ax.plot([1, 2, 3])
+ buffer = io.BytesIO()
+ fig.savefig(buffer)
+ buffer.seek(0)
+ plt.imread(buffer)
+
+
+@pytest.mark.parametrize(
+ "img_size, fig_size, interpolation",
+ [(5, 2, "hanning"), # data larger than figure.
+ (5, 5, "nearest"), # exact resample.
+ (5, 10, "nearest"), # double sample.
+ (3, 2.9, "hanning"), # <3 upsample.
+ (3, 9.1, "nearest"), # >3 upsample.
+ ])
+@check_figures_equal(extensions=['png'])
+def test_imshow_antialiased(fig_test, fig_ref,
+ img_size, fig_size, interpolation):
+ np.random.seed(19680801)
+ dpi = plt.rcParams["savefig.dpi"]
+ A = np.random.rand(int(dpi * img_size), int(dpi * img_size))
+ for fig in [fig_test, fig_ref]:
+ fig.set_size_inches(fig_size, fig_size)
+ axs = fig_test.subplots()
+ axs.set_position([0, 0, 1, 1])
+ axs.imshow(A, interpolation='antialiased')
+ axs = fig_ref.subplots()
+ axs.set_position([0, 0, 1, 1])
+ axs.imshow(A, interpolation=interpolation)
+
+
+@check_figures_equal(extensions=['png'])
+def test_imshow_zoom(fig_test, fig_ref):
+ # should be less than 3 upsample, so should be nearest...
+ np.random.seed(19680801)
+ dpi = plt.rcParams["savefig.dpi"]
+ A = np.random.rand(int(dpi * 3), int(dpi * 3))
+ for fig in [fig_test, fig_ref]:
+ fig.set_size_inches(2.9, 2.9)
+ axs = fig_test.subplots()
+ axs.imshow(A, interpolation='antialiased')
+ axs.set_xlim([10, 20])
+ axs.set_ylim([10, 20])
+ axs = fig_ref.subplots()
+ axs.imshow(A, interpolation='nearest')
+ axs.set_xlim([10, 20])
+ axs.set_ylim([10, 20])
+
+
+@check_figures_equal()
+def test_imshow_pil(fig_test, fig_ref):
+ style.use("default")
+ png_path = Path(__file__).parent / "baseline_images/pngsuite/basn3p04.png"
+ tiff_path = Path(__file__).parent / "baseline_images/test_image/uint16.tif"
+ axs = fig_test.subplots(2)
+ axs[0].imshow(Image.open(png_path))
+ axs[1].imshow(Image.open(tiff_path))
+ axs = fig_ref.subplots(2)
+ axs[0].imshow(plt.imread(png_path))
+ axs[1].imshow(plt.imread(tiff_path))
+
+
+def test_imread_pil_uint16():
+ img = plt.imread(os.path.join(os.path.dirname(__file__),
+ 'baseline_images', 'test_image', 'uint16.tif'))
+ assert img.dtype == np.uint16
+ assert np.sum(img) == 134184960
+
+
+def test_imread_fspath():
+ img = plt.imread(
+ Path(__file__).parent / 'baseline_images/test_image/uint16.tif')
+ assert img.dtype == np.uint16
+ assert np.sum(img) == 134184960
+
+
+@pytest.mark.parametrize("fmt", ["png", "jpg", "jpeg", "tiff"])
+def test_imsave(fmt):
+ has_alpha = fmt not in ["jpg", "jpeg"]
+
+ # The goal here is that the user can specify an output logical DPI
+ # for the image, but this will not actually add any extra pixels
+ # to the image, it will merely be used for metadata purposes.
+
+ # So we do the traditional case (dpi == 1), and the new case (dpi
+ # == 100) and read the resulting PNG files back in and make sure
+ # the data is 100% identical.
+ np.random.seed(1)
+ # The height of 1856 pixels was selected because going through creating an
+ # actual dpi=100 figure to save the image to a Pillow-provided format would
+ # cause a rounding error resulting in a final image of shape 1855.
+ data = np.random.rand(1856, 2)
+
+ buff_dpi1 = io.BytesIO()
+ plt.imsave(buff_dpi1, data, format=fmt, dpi=1)
+
+ buff_dpi100 = io.BytesIO()
+ plt.imsave(buff_dpi100, data, format=fmt, dpi=100)
+
+ buff_dpi1.seek(0)
+ arr_dpi1 = plt.imread(buff_dpi1, format=fmt)
+
+ buff_dpi100.seek(0)
+ arr_dpi100 = plt.imread(buff_dpi100, format=fmt)
+
+ assert arr_dpi1.shape == (1856, 2, 3 + has_alpha)
+ assert arr_dpi100.shape == (1856, 2, 3 + has_alpha)
+
+ assert_array_equal(arr_dpi1, arr_dpi100)
+
+
+@pytest.mark.parametrize("fmt", ["png", "pdf", "ps", "eps", "svg"])
+def test_imsave_fspath(fmt):
+ plt.imsave(Path(os.devnull), np.array([[0, 1]]), format=fmt)
+
+
+def test_imsave_color_alpha():
+ # Test that imsave accept arrays with ndim=3 where the third dimension is
+ # color and alpha without raising any exceptions, and that the data is
+ # acceptably preserved through a save/read roundtrip.
+ np.random.seed(1)
+
+ for origin in ['lower', 'upper']:
+ data = np.random.rand(16, 16, 4)
+ buff = io.BytesIO()
+ plt.imsave(buff, data, origin=origin, format="png")
+
+ buff.seek(0)
+ arr_buf = plt.imread(buff)
+
+ # Recreate the float -> uint8 conversion of the data
+ # We can only expect to be the same with 8 bits of precision,
+ # since that's what the PNG file used.
+ data = (255*data).astype('uint8')
+ if origin == 'lower':
+ data = data[::-1]
+ arr_buf = (255*arr_buf).astype('uint8')
+
+ assert_array_equal(data, arr_buf)
+
+
+def test_imsave_pil_kwargs_png():
+ from PIL.PngImagePlugin import PngInfo
+ buf = io.BytesIO()
+ pnginfo = PngInfo()
+ pnginfo.add_text("Software", "test")
+ plt.imsave(buf, [[0, 1], [2, 3]],
+ format="png", pil_kwargs={"pnginfo": pnginfo})
+ im = Image.open(buf)
+ assert im.info["Software"] == "test"
+
+
+def test_imsave_pil_kwargs_tiff():
+ from PIL.TiffTags import TAGS_V2 as TAGS
+ buf = io.BytesIO()
+ pil_kwargs = {"description": "test image"}
+ plt.imsave(buf, [[0, 1], [2, 3]], format="tiff", pil_kwargs=pil_kwargs)
+ im = Image.open(buf)
+ tags = {TAGS[k].name: v for k, v in im.tag_v2.items()}
+ assert tags["ImageDescription"] == "test image"
+
+
+@image_comparison(['image_alpha'], remove_text=True)
+def test_image_alpha():
+ np.random.seed(0)
+ Z = np.random.rand(6, 6)
+
+ fig, (ax1, ax2, ax3) = plt.subplots(1, 3)
+ ax1.imshow(Z, alpha=1.0, interpolation='none')
+ ax2.imshow(Z, alpha=0.5, interpolation='none')
+ ax3.imshow(Z, alpha=0.5, interpolation='nearest')
+
+
+def test_cursor_data():
+ from matplotlib.backend_bases import MouseEvent
+
+ fig, ax = plt.subplots()
+ im = ax.imshow(np.arange(100).reshape(10, 10), origin='upper')
+
+ x, y = 4, 4
+ xdisp, ydisp = ax.transData.transform([x, y])
+
+ event = MouseEvent('motion_notify_event', fig.canvas, xdisp, ydisp)
+ assert im.get_cursor_data(event) == 44
+
+ # Now try for a point outside the image
+ # Tests issue #4957
+ x, y = 10.1, 4
+ xdisp, ydisp = ax.transData.transform([x, y])
+
+ event = MouseEvent('motion_notify_event', fig.canvas, xdisp, ydisp)
+ assert im.get_cursor_data(event) is None
+
+ # Hmm, something is wrong here... I get 0, not None...
+ # But, this works further down in the tests with extents flipped
+ #x, y = 0.1, -0.1
+ #xdisp, ydisp = ax.transData.transform([x, y])
+ #event = MouseEvent('motion_notify_event', fig.canvas, xdisp, ydisp)
+ #z = im.get_cursor_data(event)
+ #assert z is None, "Did not get None, got %d" % z
+
+ ax.clear()
+ # Now try with the extents flipped.
+ im = ax.imshow(np.arange(100).reshape(10, 10), origin='lower')
+
+ x, y = 4, 4
+ xdisp, ydisp = ax.transData.transform([x, y])
+
+ event = MouseEvent('motion_notify_event', fig.canvas, xdisp, ydisp)
+ assert im.get_cursor_data(event) == 44
+
+ fig, ax = plt.subplots()
+ im = ax.imshow(np.arange(100).reshape(10, 10), extent=[0, 0.5, 0, 0.5])
+
+ x, y = 0.25, 0.25
+ xdisp, ydisp = ax.transData.transform([x, y])
+
+ event = MouseEvent('motion_notify_event', fig.canvas, xdisp, ydisp)
+ assert im.get_cursor_data(event) == 55
+
+ # Now try for a point outside the image
+ # Tests issue #4957
+ x, y = 0.75, 0.25
+ xdisp, ydisp = ax.transData.transform([x, y])
+
+ event = MouseEvent('motion_notify_event', fig.canvas, xdisp, ydisp)
+ assert im.get_cursor_data(event) is None
+
+ x, y = 0.01, -0.01
+ xdisp, ydisp = ax.transData.transform([x, y])
+
+ event = MouseEvent('motion_notify_event', fig.canvas, xdisp, ydisp)
+ assert im.get_cursor_data(event) is None
+
+ # Now try with additional transform applied to the image artist
+ trans = Affine2D().scale(2).rotate(0.5)
+ im = ax.imshow(np.arange(100).reshape(10, 10),
+ transform=trans + ax.transData)
+ x, y = 3, 10
+ xdisp, ydisp = ax.transData.transform([x, y])
+ event = MouseEvent('motion_notify_event', fig.canvas, xdisp, ydisp)
+ assert im.get_cursor_data(event) == 44
+
+
+@pytest.mark.parametrize(
+ "data, text_without_colorbar, text_with_colorbar", [
+ ([[10001, 10000]], "[1e+04]", "[10001]"),
+ ([[.123, .987]], "[0.123]", "[0.123]"),
+])
+def test_format_cursor_data(data, text_without_colorbar, text_with_colorbar):
+ from matplotlib.backend_bases import MouseEvent
+
+ fig, ax = plt.subplots()
+ im = ax.imshow(data)
+
+ xdisp, ydisp = ax.transData.transform([0, 0])
+ event = MouseEvent('motion_notify_event', fig.canvas, xdisp, ydisp)
+ assert im.get_cursor_data(event) == data[0][0]
+ assert im.format_cursor_data(im.get_cursor_data(event)) \
+ == text_without_colorbar
+
+ fig.colorbar(im)
+ fig.canvas.draw() # This is necessary to set up the colorbar formatter.
+
+ assert im.get_cursor_data(event) == data[0][0]
+ assert im.format_cursor_data(im.get_cursor_data(event)) \
+ == text_with_colorbar
+
+
+@image_comparison(['image_clip'], style='mpl20')
+def test_image_clip():
+ d = [[1, 2], [3, 4]]
+
+ fig, ax = plt.subplots()
+ im = ax.imshow(d)
+ patch = patches.Circle((0, 0), radius=1, transform=ax.transData)
+ im.set_clip_path(patch)
+
+
+@image_comparison(['image_cliprect'], style='mpl20')
+def test_image_cliprect():
+ fig, ax = plt.subplots()
+ d = [[1, 2], [3, 4]]
+
+ im = ax.imshow(d, extent=(0, 5, 0, 5))
+
+ rect = patches.Rectangle(
+ xy=(1, 1), width=2, height=2, transform=im.axes.transData)
+ im.set_clip_path(rect)
+
+
+@image_comparison(['imshow'], remove_text=True, style='mpl20')
+def test_imshow():
+ fig, ax = plt.subplots()
+ arr = np.arange(100).reshape((10, 10))
+ ax.imshow(arr, interpolation="bilinear", extent=(1, 2, 1, 2))
+ ax.set_xlim(0, 3)
+ ax.set_ylim(0, 3)
+
+
+@check_figures_equal(extensions=['png'])
+def test_imshow_10_10_1(fig_test, fig_ref):
+ # 10x10x1 should be the same as 10x10
+ arr = np.arange(100).reshape((10, 10, 1))
+ ax = fig_ref.subplots()
+ ax.imshow(arr[:, :, 0], interpolation="bilinear", extent=(1, 2, 1, 2))
+ ax.set_xlim(0, 3)
+ ax.set_ylim(0, 3)
+
+ ax = fig_test.subplots()
+ ax.imshow(arr, interpolation="bilinear", extent=(1, 2, 1, 2))
+ ax.set_xlim(0, 3)
+ ax.set_ylim(0, 3)
+
+
+def test_imshow_10_10_2():
+ fig, ax = plt.subplots()
+ arr = np.arange(200).reshape((10, 10, 2))
+ with pytest.raises(TypeError):
+ ax.imshow(arr)
+
+
+def test_imshow_10_10_5():
+ fig, ax = plt.subplots()
+ arr = np.arange(500).reshape((10, 10, 5))
+ with pytest.raises(TypeError):
+ ax.imshow(arr)
+
+
+@image_comparison(['no_interpolation_origin'], remove_text=True)
+def test_no_interpolation_origin():
+ fig, axs = plt.subplots(2)
+ axs[0].imshow(np.arange(100).reshape((2, 50)), origin="lower",
+ interpolation='none')
+ axs[1].imshow(np.arange(100).reshape((2, 50)), interpolation='none')
+
+
+@image_comparison(['image_shift'], remove_text=True, extensions=['pdf', 'svg'])
+def test_image_shift():
+ imgData = [[1 / x + 1 / y for x in range(1, 100)] for y in range(1, 100)]
+ tMin = 734717.945208
+ tMax = 734717.946366
+
+ fig, ax = plt.subplots()
+ ax.imshow(imgData, norm=colors.LogNorm(), interpolation='none',
+ extent=(tMin, tMax, 1, 100))
+ ax.set_aspect('auto')
+
+
+def test_image_edges():
+ fig = plt.figure(figsize=[1, 1])
+ ax = fig.add_axes([0, 0, 1, 1], frameon=False)
+
+ data = np.tile(np.arange(12), 15).reshape(20, 9)
+
+ im = ax.imshow(data, origin='upper', extent=[-10, 10, -10, 10],
+ interpolation='none', cmap='gray')
+
+ x = y = 2
+ ax.set_xlim([-x, x])
+ ax.set_ylim([-y, y])
+
+ ax.set_xticks([])
+ ax.set_yticks([])
+
+ buf = io.BytesIO()
+ fig.savefig(buf, facecolor=(0, 1, 0))
+
+ buf.seek(0)
+
+ im = plt.imread(buf)
+ r, g, b, a = sum(im[:, 0])
+ r, g, b, a = sum(im[:, -1])
+
+ assert g != 100, 'Expected a non-green edge - but sadly, it was.'
+
+
+@image_comparison(['image_composite_background'],
+ remove_text=True, style='mpl20')
+def test_image_composite_background():
+ fig, ax = plt.subplots()
+ arr = np.arange(12).reshape(4, 3)
+ ax.imshow(arr, extent=[0, 2, 15, 0])
+ ax.imshow(arr, extent=[4, 6, 15, 0])
+ ax.set_facecolor((1, 0, 0, 0.5))
+ ax.set_xlim([0, 12])
+
+
+@image_comparison(['image_composite_alpha'], remove_text=True)
+def test_image_composite_alpha():
+ """
+ Tests that the alpha value is recognized and correctly applied in the
+ process of compositing images together.
+ """
+ fig, ax = plt.subplots()
+ arr = np.zeros((11, 21, 4))
+ arr[:, :, 0] = 1
+ arr[:, :, 3] = np.concatenate(
+ (np.arange(0, 1.1, 0.1), np.arange(0, 1, 0.1)[::-1]))
+ arr2 = np.zeros((21, 11, 4))
+ arr2[:, :, 0] = 1
+ arr2[:, :, 1] = 1
+ arr2[:, :, 3] = np.concatenate(
+ (np.arange(0, 1.1, 0.1), np.arange(0, 1, 0.1)[::-1]))[:, np.newaxis]
+ ax.imshow(arr, extent=[1, 2, 5, 0], alpha=0.3)
+ ax.imshow(arr, extent=[2, 3, 5, 0], alpha=0.6)
+ ax.imshow(arr, extent=[3, 4, 5, 0])
+ ax.imshow(arr2, extent=[0, 5, 1, 2])
+ ax.imshow(arr2, extent=[0, 5, 2, 3], alpha=0.6)
+ ax.imshow(arr2, extent=[0, 5, 3, 4], alpha=0.3)
+ ax.set_facecolor((0, 0.5, 0, 1))
+ ax.set_xlim([0, 5])
+ ax.set_ylim([5, 0])
+
+
+@image_comparison(['rasterize_10dpi'],
+ extensions=['pdf', 'svg'], remove_text=True, style='mpl20')
+def test_rasterize_dpi():
+ # This test should check rasterized rendering with high output resolution.
+ # It plots a rasterized line and a normal image with imshow. So it will
+ # catch when images end up in the wrong place in case of non-standard dpi
+ # setting. Instead of high-res rasterization I use low-res. Therefore
+ # the fact that the resolution is non-standard is easily checked by
+ # image_comparison.
+ img = np.asarray([[1, 2], [3, 4]])
+
+ fig, axs = plt.subplots(1, 3, figsize=(3, 1))
+
+ axs[0].imshow(img)
+
+ axs[1].plot([0, 1], [0, 1], linewidth=20., rasterized=True)
+ axs[1].set(xlim=(0, 1), ylim=(-1, 2))
+
+ axs[2].plot([0, 1], [0, 1], linewidth=20.)
+ axs[2].set(xlim=(0, 1), ylim=(-1, 2))
+
+ # Low-dpi PDF rasterization errors prevent proper image comparison tests.
+ # Hide detailed structures like the axes spines.
+ for ax in axs:
+ ax.set_xticks([])
+ ax.set_yticks([])
+ ax.spines[:].set_visible(False)
+
+ rcParams['savefig.dpi'] = 10
+
+
+@image_comparison(['bbox_image_inverted'], remove_text=True, style='mpl20')
+def test_bbox_image_inverted():
+ # This is just used to produce an image to feed to BboxImage
+ image = np.arange(100).reshape((10, 10))
+
+ fig, ax = plt.subplots()
+ bbox_im = BboxImage(
+ TransformedBbox(Bbox([[100, 100], [0, 0]]), ax.transData),
+ interpolation='nearest')
+ bbox_im.set_data(image)
+ bbox_im.set_clip_on(False)
+ ax.set_xlim(0, 100)
+ ax.set_ylim(0, 100)
+ ax.add_artist(bbox_im)
+
+ image = np.identity(10)
+
+ bbox_im = BboxImage(TransformedBbox(Bbox([[0.1, 0.2], [0.3, 0.25]]),
+ ax.figure.transFigure),
+ interpolation='nearest')
+ bbox_im.set_data(image)
+ bbox_im.set_clip_on(False)
+ ax.add_artist(bbox_im)
+
+
+def test_get_window_extent_for_AxisImage():
+ # Create a figure of known size (1000x1000 pixels), place an image
+ # object at a given location and check that get_window_extent()
+ # returns the correct bounding box values (in pixels).
+
+ im = np.array([[0.25, 0.75, 1.0, 0.75], [0.1, 0.65, 0.5, 0.4],
+ [0.6, 0.3, 0.0, 0.2], [0.7, 0.9, 0.4, 0.6]])
+ fig, ax = plt.subplots(figsize=(10, 10), dpi=100)
+ ax.set_position([0, 0, 1, 1])
+ ax.set_xlim(0, 1)
+ ax.set_ylim(0, 1)
+ im_obj = ax.imshow(
+ im, extent=[0.4, 0.7, 0.2, 0.9], interpolation='nearest')
+
+ fig.canvas.draw()
+ renderer = fig.canvas.renderer
+ im_bbox = im_obj.get_window_extent(renderer)
+
+ assert_array_equal(im_bbox.get_points(), [[400, 200], [700, 900]])
+
+
+@image_comparison(['zoom_and_clip_upper_origin.png'],
+ remove_text=True, style='mpl20')
+def test_zoom_and_clip_upper_origin():
+ image = np.arange(100)
+ image = image.reshape((10, 10))
+
+ fig, ax = plt.subplots()
+ ax.imshow(image)
+ ax.set_ylim(2.0, -0.5)
+ ax.set_xlim(-0.5, 2.0)
+
+
+def test_nonuniformimage_setcmap():
+ ax = plt.gca()
+ im = NonUniformImage(ax)
+ im.set_cmap('Blues')
+
+
+def test_nonuniformimage_setnorm():
+ ax = plt.gca()
+ im = NonUniformImage(ax)
+ im.set_norm(plt.Normalize())
+
+
+def test_jpeg_2d():
+ # smoke test that mode-L pillow images work.
+ imd = np.ones((10, 10), dtype='uint8')
+ for i in range(10):
+ imd[i, :] = np.linspace(0.0, 1.0, 10) * 255
+ im = Image.new('L', (10, 10))
+ im.putdata(imd.flatten())
+ fig, ax = plt.subplots()
+ ax.imshow(im)
+
+
+def test_jpeg_alpha():
+ plt.figure(figsize=(1, 1), dpi=300)
+ # Create an image that is all black, with a gradient from 0-1 in
+ # the alpha channel from left to right.
+ im = np.zeros((300, 300, 4), dtype=float)
+ im[..., 3] = np.linspace(0.0, 1.0, 300)
+
+ plt.figimage(im)
+
+ buff = io.BytesIO()
+ plt.savefig(buff, facecolor="red", format='jpg', dpi=300)
+
+ buff.seek(0)
+ image = Image.open(buff)
+
+ # If this fails, there will be only one color (all black). If this
+ # is working, we should have all 256 shades of grey represented.
+ num_colors = len(image.getcolors(256))
+ assert 175 <= num_colors <= 185
+ # The fully transparent part should be red.
+ corner_pixel = image.getpixel((0, 0))
+ assert corner_pixel == (254, 0, 0)
+
+
+def test_axesimage_setdata():
+ ax = plt.gca()
+ im = AxesImage(ax)
+ z = np.arange(12, dtype=float).reshape((4, 3))
+ im.set_data(z)
+ z[0, 0] = 9.9
+ assert im._A[0, 0] == 0, 'value changed'
+
+
+def test_figureimage_setdata():
+ fig = plt.gcf()
+ im = FigureImage(fig)
+ z = np.arange(12, dtype=float).reshape((4, 3))
+ im.set_data(z)
+ z[0, 0] = 9.9
+ assert im._A[0, 0] == 0, 'value changed'
+
+
+@pytest.mark.parametrize(
+ "image_cls,x,y,a", [
+ (NonUniformImage,
+ np.arange(3.), np.arange(4.), np.arange(12.).reshape((4, 3))),
+ (PcolorImage,
+ np.arange(3.), np.arange(4.), np.arange(6.).reshape((3, 2))),
+ ])
+def test_setdata_xya(image_cls, x, y, a):
+ ax = plt.gca()
+ im = image_cls(ax)
+ im.set_data(x, y, a)
+ x[0] = y[0] = a[0, 0] = 9.9
+ assert im._A[0, 0] == im._Ax[0] == im._Ay[0] == 0, 'value changed'
+ im.set_data(x, y, a.reshape((*a.shape, -1))) # Just a smoketest.
+
+
+def test_minimized_rasterized():
+ # This ensures that the rasterized content in the colorbars is
+ # only as thick as the colorbar, and doesn't extend to other parts
+ # of the image. See #5814. While the original bug exists only
+ # in Postscript, the best way to detect it is to generate SVG
+ # and then parse the output to make sure the two colorbar images
+ # are the same size.
+ from xml.etree import ElementTree
+
+ np.random.seed(0)
+ data = np.random.rand(10, 10)
+
+ fig, ax = plt.subplots(1, 2)
+ p1 = ax[0].pcolormesh(data)
+ p2 = ax[1].pcolormesh(data)
+
+ plt.colorbar(p1, ax=ax[0])
+ plt.colorbar(p2, ax=ax[1])
+
+ buff = io.BytesIO()
+ plt.savefig(buff, format='svg')
+
+ buff = io.BytesIO(buff.getvalue())
+ tree = ElementTree.parse(buff)
+ width = None
+ for image in tree.iter('image'):
+ if width is None:
+ width = image['width']
+ else:
+ if image['width'] != width:
+ assert False
+
+
+def test_load_from_url():
+ path = Path(__file__).parent / "baseline_images/pngsuite/basn3p04.png"
+ url = ('file:'
+ + ('///' if sys.platform == 'win32' else '')
+ + path.resolve().as_posix())
+ with _api.suppress_matplotlib_deprecation_warning():
+ plt.imread(url)
+ with urllib.request.urlopen(url) as file:
+ plt.imread(file)
+
+
+@image_comparison(['log_scale_image'], remove_text=True)
+def test_log_scale_image():
+ Z = np.zeros((10, 10))
+ Z[::2] = 1
+
+ fig, ax = plt.subplots()
+ ax.imshow(Z, extent=[1, 100, 1, 100], cmap='viridis', vmax=1, vmin=-1,
+ aspect='auto')
+ ax.set(yscale='log')
+
+
+# Increased tolerance is needed for PDF test to avoid failure. After the PDF
+# backend was modified to use indexed color, there are ten pixels that differ
+# due to how the subpixel calculation is done when converting the PDF files to
+# PNG images.
+@image_comparison(['rotate_image'], remove_text=True, tol=0.35)
+def test_rotate_image():
+ delta = 0.25
+ x = y = np.arange(-3.0, 3.0, delta)
+ X, Y = np.meshgrid(x, y)
+ Z1 = np.exp(-(X**2 + Y**2) / 2) / (2 * np.pi)
+ Z2 = (np.exp(-(((X - 1) / 1.5)**2 + ((Y - 1) / 0.5)**2) / 2) /
+ (2 * np.pi * 0.5 * 1.5))
+ Z = Z2 - Z1 # difference of Gaussians
+
+ fig, ax1 = plt.subplots(1, 1)
+ im1 = ax1.imshow(Z, interpolation='none', cmap='viridis',
+ origin='lower',
+ extent=[-2, 4, -3, 2], clip_on=True)
+
+ trans_data2 = Affine2D().rotate_deg(30) + ax1.transData
+ im1.set_transform(trans_data2)
+
+ # display intended extent of the image
+ x1, x2, y1, y2 = im1.get_extent()
+
+ ax1.plot([x1, x2, x2, x1, x1], [y1, y1, y2, y2, y1], "r--", lw=3,
+ transform=trans_data2)
+
+ ax1.set_xlim(2, 5)
+ ax1.set_ylim(0, 4)
+
+
+def test_image_preserve_size():
+ buff = io.BytesIO()
+
+ im = np.zeros((481, 321))
+ plt.imsave(buff, im, format="png")
+
+ buff.seek(0)
+ img = plt.imread(buff)
+
+ assert img.shape[:2] == im.shape
+
+
+def test_image_preserve_size2():
+ n = 7
+ data = np.identity(n, float)
+
+ fig = plt.figure(figsize=(n, n), frameon=False)
+
+ ax = plt.Axes(fig, [0.0, 0.0, 1.0, 1.0])
+ ax.set_axis_off()
+ fig.add_axes(ax)
+ ax.imshow(data, interpolation='nearest', origin='lower', aspect='auto')
+ buff = io.BytesIO()
+ fig.savefig(buff, dpi=1)
+
+ buff.seek(0)
+ img = plt.imread(buff)
+
+ assert img.shape == (7, 7, 4)
+
+ assert_array_equal(np.asarray(img[:, :, 0], bool),
+ np.identity(n, bool)[::-1])
+
+
+@image_comparison(['mask_image_over_under.png'], remove_text=True, tol=1.0)
+def test_mask_image_over_under():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ delta = 0.025
+ x = y = np.arange(-3.0, 3.0, delta)
+ X, Y = np.meshgrid(x, y)
+ Z1 = np.exp(-(X**2 + Y**2) / 2) / (2 * np.pi)
+ Z2 = (np.exp(-(((X - 1) / 1.5)**2 + ((Y - 1) / 0.5)**2) / 2) /
+ (2 * np.pi * 0.5 * 1.5))
+ Z = 10*(Z2 - Z1) # difference of Gaussians
+
+ palette = plt.cm.gray.with_extremes(over='r', under='g', bad='b')
+ Zm = np.ma.masked_where(Z > 1.2, Z)
+ fig, (ax1, ax2) = plt.subplots(1, 2)
+ im = ax1.imshow(Zm, interpolation='bilinear',
+ cmap=palette,
+ norm=colors.Normalize(vmin=-1.0, vmax=1.0, clip=False),
+ origin='lower', extent=[-3, 3, -3, 3])
+ ax1.set_title('Green=low, Red=high, Blue=bad')
+ fig.colorbar(im, extend='both', orientation='horizontal',
+ ax=ax1, aspect=10)
+
+ im = ax2.imshow(Zm, interpolation='nearest',
+ cmap=palette,
+ norm=colors.BoundaryNorm([-1, -0.5, -0.2, 0, 0.2, 0.5, 1],
+ ncolors=256, clip=False),
+ origin='lower', extent=[-3, 3, -3, 3])
+ ax2.set_title('With BoundaryNorm')
+ fig.colorbar(im, extend='both', spacing='proportional',
+ orientation='horizontal', ax=ax2, aspect=10)
+
+
+@image_comparison(['mask_image'], remove_text=True)
+def test_mask_image():
+ # Test mask image two ways: Using nans and using a masked array.
+
+ fig, (ax1, ax2) = plt.subplots(1, 2)
+
+ A = np.ones((5, 5))
+ A[1:2, 1:2] = np.nan
+
+ ax1.imshow(A, interpolation='nearest')
+
+ A = np.zeros((5, 5), dtype=bool)
+ A[1:2, 1:2] = True
+ A = np.ma.masked_array(np.ones((5, 5), dtype=np.uint16), A)
+
+ ax2.imshow(A, interpolation='nearest')
+
+
+def test_mask_image_all():
+ # Test behavior with an image that is entirely masked does not warn
+ data = np.full((2, 2), np.nan)
+ fig, ax = plt.subplots()
+ ax.imshow(data)
+ fig.canvas.draw_idle() # would emit a warning
+
+
+@image_comparison(['imshow_endianess.png'], remove_text=True)
+def test_imshow_endianess():
+ x = np.arange(10)
+ X, Y = np.meshgrid(x, x)
+ Z = np.hypot(X - 5, Y - 5)
+
+ fig, (ax1, ax2) = plt.subplots(1, 2)
+
+ kwargs = dict(origin="lower", interpolation='nearest', cmap='viridis')
+
+ ax1.imshow(Z.astype('f8'), **kwargs)
+
+
+@image_comparison(['imshow_masked_interpolation'],
+ tol=0 if platform.machine() == 'x86_64' else 0.01,
+ remove_text=True, style='mpl20')
+def test_imshow_masked_interpolation():
+
+ cmap = plt.get_cmap('viridis').with_extremes(over='r', under='b', bad='k')
+
+ N = 20
+ n = colors.Normalize(vmin=0, vmax=N*N-1)
+
+ data = np.arange(N*N, dtype=float).reshape(N, N)
+
+ data[5, 5] = -1
+ # This will cause crazy ringing for the higher-order
+ # interpolations
+ data[15, 5] = 1e5
+
+ # data[3, 3] = np.nan
+
+ data[15, 15] = np.inf
+
+ mask = np.zeros_like(data).astype('bool')
+ mask[5, 15] = True
+
+ data = np.ma.masked_array(data, mask)
+
+ fig, ax_grid = plt.subplots(3, 6)
+ interps = sorted(mimage._interpd_)
+ interps.remove('antialiased')
+
+ for interp, ax in zip(interps, ax_grid.ravel()):
+ ax.set_title(interp)
+ ax.imshow(data, norm=n, cmap=cmap, interpolation=interp)
+ ax.axis('off')
+
+
+def test_imshow_no_warn_invalid():
+ plt.imshow([[1, 2], [3, np.nan]]) # Check that no warning is emitted.
+
+
+@pytest.mark.parametrize(
+ 'dtype', [np.dtype(s) for s in 'u2 u4 i2 i4 i8 f4 f8'.split()])
+def test_imshow_clips_rgb_to_valid_range(dtype):
+ arr = np.arange(300, dtype=dtype).reshape((10, 10, 3))
+ if dtype.kind != 'u':
+ arr -= 10
+ too_low = arr < 0
+ too_high = arr > 255
+ if dtype.kind == 'f':
+ arr = arr / 255
+ _, ax = plt.subplots()
+ out = ax.imshow(arr).get_array()
+ assert (out[too_low] == 0).all()
+ if dtype.kind == 'f':
+ assert (out[too_high] == 1).all()
+ assert out.dtype.kind == 'f'
+ else:
+ assert (out[too_high] == 255).all()
+ assert out.dtype == np.uint8
+
+
+@image_comparison(['imshow_flatfield.png'], remove_text=True, style='mpl20')
+def test_imshow_flatfield():
+ fig, ax = plt.subplots()
+ im = ax.imshow(np.ones((5, 5)), interpolation='nearest')
+ im.set_clim(.5, 1.5)
+
+
+@image_comparison(['imshow_bignumbers.png'], remove_text=True, style='mpl20')
+def test_imshow_bignumbers():
+ rcParams['image.interpolation'] = 'nearest'
+ # putting a big number in an array of integers shouldn't
+ # ruin the dynamic range of the resolved bits.
+ fig, ax = plt.subplots()
+ img = np.array([[1, 2, 1e12], [3, 1, 4]], dtype=np.uint64)
+ pc = ax.imshow(img)
+ pc.set_clim(0, 5)
+
+
+@image_comparison(['imshow_bignumbers_real.png'],
+ remove_text=True, style='mpl20')
+def test_imshow_bignumbers_real():
+ rcParams['image.interpolation'] = 'nearest'
+ # putting a big number in an array of integers shouldn't
+ # ruin the dynamic range of the resolved bits.
+ fig, ax = plt.subplots()
+ img = np.array([[2., 1., 1.e22], [4., 1., 3.]])
+ pc = ax.imshow(img)
+ pc.set_clim(0, 5)
+
+
+@pytest.mark.parametrize(
+ "make_norm",
+ [colors.Normalize,
+ colors.LogNorm,
+ lambda: colors.SymLogNorm(1),
+ lambda: colors.PowerNorm(1)])
+def test_empty_imshow(make_norm):
+ fig, ax = plt.subplots()
+ with pytest.warns(UserWarning,
+ match="Attempting to set identical left == right"):
+ im = ax.imshow([[]], norm=make_norm())
+ im.set_extent([-5, 5, -5, 5])
+ fig.canvas.draw()
+
+ with pytest.raises(RuntimeError):
+ im.make_image(fig._cachedRenderer)
+
+
+def test_imshow_float128():
+ fig, ax = plt.subplots()
+ ax.imshow(np.zeros((3, 3), dtype=np.longdouble))
+ with (ExitStack() if np.can_cast(np.longdouble, np.float64, "equiv")
+ else pytest.warns(UserWarning)):
+ # Ensure that drawing doesn't cause crash.
+ fig.canvas.draw()
+
+
+def test_imshow_bool():
+ fig, ax = plt.subplots()
+ ax.imshow(np.array([[True, False], [False, True]], dtype=bool))
+
+
+def test_full_invalid():
+ fig, ax = plt.subplots()
+ ax.imshow(np.full((10, 10), np.nan))
+ with pytest.warns(UserWarning):
+ fig.canvas.draw()
+
+
+@pytest.mark.parametrize("fmt,counted",
+ [("ps", b" colorimage"), ("svg", b" 10**6)
+ """
+ # Creates big x and y data:
+ N = 10**7
+ x = np.linspace(0, 1, N)
+ y = np.random.normal(size=N)
+
+ # Create a plot figure:
+ fig = plt.figure()
+ ax = plt.subplot()
+
+ # Create a "big" Line instance:
+ l = mlines.Line2D(x, y)
+ l.set_visible(False)
+ # but don't add it to the Axis instance `ax`
+
+ # [here Interactive panning and zooming is pretty responsive]
+ # Time the canvas drawing:
+ t_no_line = min(timeit.repeat(fig.canvas.draw, number=1, repeat=3))
+ # (gives about 25 ms)
+
+ # Add the big invisible Line:
+ ax.add_line(l)
+
+ # [Now interactive panning and zooming is very slow]
+ # Time the canvas drawing:
+ t_invisible_line = min(timeit.repeat(fig.canvas.draw, number=1, repeat=3))
+ # gives about 290 ms for N = 10**7 pts
+
+ slowdown_factor = t_invisible_line / t_no_line
+ slowdown_threshold = 2 # trying to avoid false positive failures
+ assert slowdown_factor < slowdown_threshold
+
+
+def test_set_line_coll_dash():
+ fig, ax = plt.subplots()
+ np.random.seed(0)
+ # Testing setting linestyles for line collections.
+ # This should not produce an error.
+ ax.contour(np.random.randn(20, 30), linestyles=[(0, (3, 3))])
+
+
+@image_comparison(['line_dashes'], remove_text=True)
+def test_line_dashes():
+ fig, ax = plt.subplots()
+
+ ax.plot(range(10), linestyle=(0, (3, 3)), lw=5)
+
+
+def test_line_colors():
+ fig, ax = plt.subplots()
+ ax.plot(range(10), color='none')
+ ax.plot(range(10), color='r')
+ ax.plot(range(10), color='.3')
+ ax.plot(range(10), color=(1, 0, 0, 1))
+ ax.plot(range(10), color=(1, 0, 0))
+ fig.canvas.draw()
+
+
+def test_valid_colors():
+ line = mlines.Line2D([], [])
+ with pytest.raises(ValueError):
+ line.set_color("foobar")
+
+
+def test_linestyle_variants():
+ fig, ax = plt.subplots()
+ for ls in ["-", "solid", "--", "dashed",
+ "-.", "dashdot", ":", "dotted"]:
+ ax.plot(range(10), linestyle=ls)
+ fig.canvas.draw()
+
+
+def test_valid_linestyles():
+ line = mlines.Line2D([], [])
+ with pytest.raises(ValueError):
+ line.set_linestyle('aardvark')
+
+
+@image_comparison(['drawstyle_variants.png'], remove_text=True)
+def test_drawstyle_variants():
+ fig, axs = plt.subplots(6)
+ dss = ["default", "steps-mid", "steps-pre", "steps-post", "steps", None]
+ # We want to check that drawstyles are properly handled even for very long
+ # lines (for which the subslice optimization is on); however, we need
+ # to zoom in so that the difference between the drawstyles is actually
+ # visible.
+ for ax, ds in zip(axs.flat, dss):
+ ax.plot(range(2000), drawstyle=ds)
+ ax.set(xlim=(0, 2), ylim=(0, 2))
+
+
+def test_valid_drawstyles():
+ line = mlines.Line2D([], [])
+ with pytest.raises(ValueError):
+ line.set_drawstyle('foobar')
+
+
+def test_set_drawstyle():
+ x = np.linspace(0, 2*np.pi, 10)
+ y = np.sin(x)
+
+ fig, ax = plt.subplots()
+ line, = ax.plot(x, y)
+ line.set_drawstyle("steps-pre")
+ assert len(line.get_path().vertices) == 2*len(x)-1
+
+ line.set_drawstyle("default")
+ assert len(line.get_path().vertices) == len(x)
+
+
+@image_comparison(['line_collection_dashes'], remove_text=True, style='mpl20')
+def test_set_line_coll_dash_image():
+ fig, ax = plt.subplots()
+ np.random.seed(0)
+ ax.contour(np.random.randn(20, 30), linestyles=[(0, (3, 3))])
+
+
+@image_comparison(['marker_fill_styles.png'], remove_text=True)
+def test_marker_fill_styles():
+ colors = itertools.cycle([[0, 0, 1], 'g', '#ff0000', 'c', 'm', 'y',
+ np.array([0, 0, 0])])
+ altcolor = 'lightgreen'
+
+ y = np.array([1, 1])
+ x = np.array([0, 9])
+ fig, ax = plt.subplots()
+
+ for j, marker in enumerate(mlines.Line2D.filled_markers):
+ for i, fs in enumerate(mlines.Line2D.fillStyles):
+ color = next(colors)
+ ax.plot(j * 10 + x, y + i + .5 * (j % 2),
+ marker=marker,
+ markersize=20,
+ markerfacecoloralt=altcolor,
+ fillstyle=fs,
+ label=fs,
+ linewidth=5,
+ color=color,
+ markeredgecolor=color,
+ markeredgewidth=2)
+
+ ax.set_ylim([0, 7.5])
+ ax.set_xlim([-5, 155])
+
+
+def test_markerfacecolor_fillstyle():
+ """Test that markerfacecolor does not override fillstyle='none'."""
+ l, = plt.plot([1, 3, 2], marker=MarkerStyle('o', fillstyle='none'),
+ markerfacecolor='red')
+ assert l.get_fillstyle() == 'none'
+ assert l.get_markerfacecolor() == 'none'
+
+
+@image_comparison(['scaled_lines'], style='default')
+def test_lw_scaling():
+ th = np.linspace(0, 32)
+ fig, ax = plt.subplots()
+ lins_styles = ['dashed', 'dotted', 'dashdot']
+ cy = cycler(matplotlib.rcParams['axes.prop_cycle'])
+ for j, (ls, sty) in enumerate(zip(lins_styles, cy)):
+ for lw in np.linspace(.5, 10, 10):
+ ax.plot(th, j*np.ones(50) + .1 * lw, linestyle=ls, lw=lw, **sty)
+
+
+def test_nan_is_sorted():
+ line = mlines.Line2D([], [])
+ assert line._is_sorted(np.array([1, 2, 3]))
+ assert line._is_sorted(np.array([1, np.nan, 3]))
+ assert not line._is_sorted([3, 5] + [np.nan] * 100 + [0, 2])
+
+
+@check_figures_equal()
+def test_step_markers(fig_test, fig_ref):
+ fig_test.subplots().step([0, 1], "-o")
+ fig_ref.subplots().plot([0, 0, 1], [0, 1, 1], "-o", markevery=[0, 2])
+
+
+@check_figures_equal(extensions=('png',))
+def test_markevery(fig_test, fig_ref):
+ np.random.seed(42)
+ t = np.linspace(0, 3, 14)
+ y = np.random.rand(len(t))
+
+ casesA = [None, 4, (2, 5), [1, 5, 11],
+ [0, -1], slice(5, 10, 2), 0.3, (0.3, 0.4),
+ np.arange(len(t))[y > 0.5]]
+ casesB = ["11111111111111", "10001000100010", "00100001000010",
+ "01000100000100", "10000000000001", "00000101010000",
+ "11011011011110", "01010011011101", "01110001110110"]
+
+ axsA = fig_ref.subplots(3, 3)
+ axsB = fig_test.subplots(3, 3)
+
+ for ax, case in zip(axsA.flat, casesA):
+ ax.plot(t, y, "-gD", markevery=case)
+
+ for ax, case in zip(axsB.flat, casesB):
+ me = np.array(list(case)).astype(int).astype(bool)
+ ax.plot(t, y, "-gD", markevery=me)
+
+
+def test_marker_as_markerstyle():
+ fig, ax = plt.subplots()
+ line, = ax.plot([2, 4, 3], marker=MarkerStyle("D"))
+ fig.canvas.draw()
+ assert line.get_marker() == "D"
+
+ # continue with smoke tests:
+ line.set_marker("s")
+ fig.canvas.draw()
+ line.set_marker(MarkerStyle("o"))
+ fig.canvas.draw()
+ # test Path roundtrip
+ triangle1 = Path([[-1., -1.], [1., -1.], [0., 2.], [0., 0.]], closed=True)
+ line2, = ax.plot([1, 3, 2], marker=MarkerStyle(triangle1), ms=22)
+ line3, = ax.plot([0, 2, 1], marker=triangle1, ms=22)
+
+ assert_array_equal(line2.get_marker().vertices, triangle1.vertices)
+ assert_array_equal(line3.get_marker().vertices, triangle1.vertices)
+
+
+@check_figures_equal()
+def test_odd_dashes(fig_test, fig_ref):
+ fig_test.add_subplot().plot([1, 2], dashes=[1, 2, 3])
+ fig_ref.add_subplot().plot([1, 2], dashes=[1, 2, 3, 1, 2, 3])
+
+
+def test_picking():
+ fig, ax = plt.subplots()
+ mouse_event = SimpleNamespace(x=fig.bbox.width // 2,
+ y=fig.bbox.height // 2 + 15)
+
+ # Default pickradius is 5, so event should not pick this line.
+ l0, = ax.plot([0, 1], [0, 1], picker=True)
+ found, indices = l0.contains(mouse_event)
+ assert not found
+
+ # But with a larger pickradius, this should be picked.
+ l1, = ax.plot([0, 1], [0, 1], picker=True, pickradius=20)
+ found, indices = l1.contains(mouse_event)
+ assert found
+ assert_array_equal(indices['ind'], [0])
+
+ # And if we modify the pickradius after creation, it should work as well.
+ l2, = ax.plot([0, 1], [0, 1], picker=True)
+ found, indices = l2.contains(mouse_event)
+ assert not found
+ l2.set_pickradius(20)
+ found, indices = l2.contains(mouse_event)
+ assert found
+ assert_array_equal(indices['ind'], [0])
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_marker.py b/venv/Lib/site-packages/matplotlib/tests/test_marker.py
new file mode 100644
index 0000000..f85d4ff
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_marker.py
@@ -0,0 +1,198 @@
+import numpy as np
+import matplotlib.pyplot as plt
+from matplotlib import markers
+from matplotlib.path import Path
+from matplotlib.testing.decorators import check_figures_equal
+
+import pytest
+
+
+def test_marker_fillstyle():
+ marker_style = markers.MarkerStyle(marker='o', fillstyle='none')
+ assert marker_style.get_fillstyle() == 'none'
+ assert not marker_style.is_filled()
+
+
+@pytest.mark.parametrize('marker', [
+ 'o',
+ 'x',
+ '',
+ 'None',
+ None,
+ r'$\frac{1}{2}$',
+ "$\u266B$",
+ 1,
+ markers.TICKLEFT,
+ [[-1, 0], [1, 0]],
+ np.array([[-1, 0], [1, 0]]),
+ Path([[0, 0], [1, 0]], [Path.MOVETO, Path.LINETO]),
+ (5, 0), # a pentagon
+ (7, 1), # a 7-pointed star
+ (5, 2), # asterisk
+ (5, 0, 10), # a pentagon, rotated by 10 degrees
+ (7, 1, 10), # a 7-pointed star, rotated by 10 degrees
+ (5, 2, 10), # asterisk, rotated by 10 degrees
+ markers.MarkerStyle(),
+ markers.MarkerStyle('o'),
+])
+def test_markers_valid(marker):
+ # Checking this doesn't fail.
+ markers.MarkerStyle(marker)
+
+
+@pytest.mark.parametrize('marker', [
+ 'square', # arbitrary string
+ np.array([[-0.5, 0, 1, 2, 3]]), # 1D array
+ (1,),
+ (5, 3), # second parameter of tuple must be 0, 1, or 2
+ (1, 2, 3, 4),
+])
+def test_markers_invalid(marker):
+ with pytest.raises(ValueError):
+ markers.MarkerStyle(marker)
+
+
+class UnsnappedMarkerStyle(markers.MarkerStyle):
+ """
+ A MarkerStyle where the snap threshold is force-disabled.
+
+ This is used to compare to polygon/star/asterisk markers which do not have
+ any snap threshold set.
+ """
+ def _recache(self):
+ super()._recache()
+ self._snap_threshold = None
+
+
+@check_figures_equal()
+def test_poly_marker(fig_test, fig_ref):
+ ax_test = fig_test.add_subplot()
+ ax_ref = fig_ref.add_subplot()
+
+ # Note, some reference sizes must be different because they have unit
+ # *length*, while polygon markers are inscribed in a circle of unit
+ # *radius*. This introduces a factor of np.sqrt(2), but since size is
+ # squared, that becomes 2.
+ size = 20**2
+
+ # Squares
+ ax_test.scatter([0], [0], marker=(4, 0, 45), s=size)
+ ax_ref.scatter([0], [0], marker='s', s=size/2)
+
+ # Diamonds, with and without rotation argument
+ ax_test.scatter([1], [1], marker=(4, 0), s=size)
+ ax_ref.scatter([1], [1], marker=UnsnappedMarkerStyle('D'), s=size/2)
+ ax_test.scatter([1], [1.5], marker=(4, 0, 0), s=size)
+ ax_ref.scatter([1], [1.5], marker=UnsnappedMarkerStyle('D'), s=size/2)
+
+ # Pentagon, with and without rotation argument
+ ax_test.scatter([2], [2], marker=(5, 0), s=size)
+ ax_ref.scatter([2], [2], marker=UnsnappedMarkerStyle('p'), s=size)
+ ax_test.scatter([2], [2.5], marker=(5, 0, 0), s=size)
+ ax_ref.scatter([2], [2.5], marker=UnsnappedMarkerStyle('p'), s=size)
+
+ # Hexagon, with and without rotation argument
+ ax_test.scatter([3], [3], marker=(6, 0), s=size)
+ ax_ref.scatter([3], [3], marker='h', s=size)
+ ax_test.scatter([3], [3.5], marker=(6, 0, 0), s=size)
+ ax_ref.scatter([3], [3.5], marker='h', s=size)
+
+ # Rotated hexagon
+ ax_test.scatter([4], [4], marker=(6, 0, 30), s=size)
+ ax_ref.scatter([4], [4], marker='H', s=size)
+
+ # Octagons
+ ax_test.scatter([5], [5], marker=(8, 0, 22.5), s=size)
+ ax_ref.scatter([5], [5], marker=UnsnappedMarkerStyle('8'), s=size)
+
+ ax_test.set(xlim=(-0.5, 5.5), ylim=(-0.5, 5.5))
+ ax_ref.set(xlim=(-0.5, 5.5), ylim=(-0.5, 5.5))
+
+
+def test_star_marker():
+ # We don't really have a strict equivalent to this marker, so we'll just do
+ # a smoke test.
+ size = 20**2
+
+ fig, ax = plt.subplots()
+ ax.scatter([0], [0], marker=(5, 1), s=size)
+ ax.scatter([1], [1], marker=(5, 1, 0), s=size)
+ ax.set(xlim=(-0.5, 0.5), ylim=(-0.5, 1.5))
+
+
+# The asterisk marker is really a star with 0-size inner circle, so the ends
+# are corners and get a slight bevel. The reference markers are just singular
+# lines without corners, so they have no bevel, and we need to add a slight
+# tolerance.
+@check_figures_equal(tol=1.45)
+def test_asterisk_marker(fig_test, fig_ref, request):
+ ax_test = fig_test.add_subplot()
+ ax_ref = fig_ref.add_subplot()
+
+ # Note, some reference sizes must be different because they have unit
+ # *length*, while asterisk markers are inscribed in a circle of unit
+ # *radius*. This introduces a factor of np.sqrt(2), but since size is
+ # squared, that becomes 2.
+ size = 20**2
+
+ def draw_ref_marker(y, style, size):
+ # As noted above, every line is doubled. Due to antialiasing, these
+ # doubled lines make a slight difference in the .png results.
+ ax_ref.scatter([y], [y], marker=UnsnappedMarkerStyle(style), s=size)
+ if request.getfixturevalue('ext') == 'png':
+ ax_ref.scatter([y], [y], marker=UnsnappedMarkerStyle(style),
+ s=size)
+
+ # Plus
+ ax_test.scatter([0], [0], marker=(4, 2), s=size)
+ draw_ref_marker(0, '+', size)
+ ax_test.scatter([0.5], [0.5], marker=(4, 2, 0), s=size)
+ draw_ref_marker(0.5, '+', size)
+
+ # Cross
+ ax_test.scatter([1], [1], marker=(4, 2, 45), s=size)
+ draw_ref_marker(1, 'x', size/2)
+
+ ax_test.set(xlim=(-0.5, 1.5), ylim=(-0.5, 1.5))
+ ax_ref.set(xlim=(-0.5, 1.5), ylim=(-0.5, 1.5))
+
+
+@check_figures_equal()
+def test_marker_clipping(fig_ref, fig_test):
+ # Plotting multiple markers can trigger different optimized paths in
+ # backends, so compare single markers vs multiple to ensure they are
+ # clipped correctly.
+ marker_count = len(markers.MarkerStyle.markers)
+ marker_size = 50
+ ncol = 7
+ nrow = marker_count // ncol + 1
+
+ width = 2 * marker_size * ncol
+ height = 2 * marker_size * nrow * 2
+ fig_ref.set_size_inches((width / fig_ref.dpi, height / fig_ref.dpi))
+ ax_ref = fig_ref.add_axes([0, 0, 1, 1])
+ fig_test.set_size_inches((width / fig_test.dpi, height / fig_ref.dpi))
+ ax_test = fig_test.add_axes([0, 0, 1, 1])
+
+ for i, marker in enumerate(markers.MarkerStyle.markers):
+ x = i % ncol
+ y = i // ncol * 2
+
+ # Singular markers per call.
+ ax_ref.plot([x, x], [y, y + 1], c='k', linestyle='-', lw=3)
+ ax_ref.plot(x, y, c='k',
+ marker=marker, markersize=marker_size, markeredgewidth=10,
+ fillstyle='full', markerfacecolor='white')
+ ax_ref.plot(x, y + 1, c='k',
+ marker=marker, markersize=marker_size, markeredgewidth=10,
+ fillstyle='full', markerfacecolor='white')
+
+ # Multiple markers in a single call.
+ ax_test.plot([x, x], [y, y + 1], c='k', linestyle='-', lw=3,
+ marker=marker, markersize=marker_size, markeredgewidth=10,
+ fillstyle='full', markerfacecolor='white')
+
+ ax_ref.set(xlim=(-0.5, ncol), ylim=(-0.5, 2 * nrow))
+ ax_test.set(xlim=(-0.5, ncol), ylim=(-0.5, 2 * nrow))
+ ax_ref.axis('off')
+ ax_test.axis('off')
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_mathtext.py b/venv/Lib/site-packages/matplotlib/tests/test_mathtext.py
new file mode 100644
index 0000000..b5fd906
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_mathtext.py
@@ -0,0 +1,393 @@
+import io
+import os
+import re
+
+import numpy as np
+import pytest
+
+import matplotlib as mpl
+from matplotlib.testing.decorators import check_figures_equal, image_comparison
+import matplotlib.pyplot as plt
+from matplotlib import _api, mathtext
+
+
+# If test is removed, use None as placeholder
+math_tests = [
+ r'$a+b+\dot s+\dot{s}+\ldots$',
+ r'$x \doteq y$',
+ r'\$100.00 $\alpha \_$',
+ r'$\frac{\$100.00}{y}$',
+ r'$x y$',
+ r'$x+y\ x=y\ x1}f\left(t\right) d\pi \left(t\right)$',
+ # mathtex doesn't support array
+ # 'mmltt23' : r'$\left(\begin{array}{cc}\hfill \left(\begin{array}{cc}\hfill a\hfill & \hfill b\hfill \\ \hfill c\hfill & \hfill d\hfill \end{array}\right)\hfill & \hfill \left(\begin{array}{cc}\hfill e\hfill & \hfill f\hfill \\ \hfill g\hfill & \hfill h\hfill \end{array}\right)\hfill \\ \hfill 0\hfill & \hfill \left(\begin{array}{cc}\hfill i\hfill & \hfill j\hfill \\ \hfill k\hfill & \hfill l\hfill \end{array}\right)\hfill \end{array}\right)$',
+ # mathtex doesn't support array
+ # 'mmltt24' : r'$det|\begin{array}{ccccc}\hfill {c}_{0}\hfill & \hfill {c}_{1}\hfill & \hfill {c}_{2}\hfill & \hfill \dots \hfill & \hfill {c}_{n}\hfill \\ \hfill {c}_{1}\hfill & \hfill {c}_{2}\hfill & \hfill {c}_{3}\hfill & \hfill \dots \hfill & \hfill {c}_{n+1}\hfill \\ \hfill {c}_{2}\hfill & \hfill {c}_{3}\hfill & \hfill {c}_{4}\hfill & \hfill \dots \hfill & \hfill {c}_{n+2}\hfill \\ \hfill \u22ee\hfill & \hfill \u22ee\hfill & \hfill \u22ee\hfill & \hfill \hfill & \hfill \u22ee\hfill \\ \hfill {c}_{n}\hfill & \hfill {c}_{n+1}\hfill & \hfill {c}_{n+2}\hfill & \hfill \dots \hfill & \hfill {c}_{2n}\hfill \end{array}|>0$',
+ r'${y}_{{x}_{2}}$',
+ r'${x}_{92}^{31415}+\pi $',
+ r'${x}_{{y}_{b}^{a}}^{{z}_{c}^{d}}$',
+ r'${y}_{3}^{\prime \prime \prime }$',
+ # End of the MathML torture tests.
+
+ r"$\left( \xi \left( 1 - \xi \right) \right)$", # Bug 2969451
+ r"$\left(2 \, a=b\right)$", # Sage bug #8125
+ r"$? ! &$", # github issue #466
+ None,
+ None,
+ r"$\left\Vert a \right\Vert \left\vert b \right\vert \left| a \right| \left\| b\right\| \Vert a \Vert \vert b \vert$",
+ r'$\mathring{A} \AA$',
+ r'$M \, M \thinspace M \/ M \> M \: M \; M \ M \enspace M \quad M \qquad M \! M$',
+ r'$\Cup$ $\Cap$ $\leftharpoonup$ $\barwedge$ $\rightharpoonup$',
+ r'$\dotplus$ $\doteq$ $\doteqdot$ $\ddots$',
+ r'$xyz^kx_kx^py^{p-2} d_i^jb_jc_kd x^j_i E^0 E^0_u$', # github issue #4873
+ r'${xyz}^k{x}_{k}{x}^{p}{y}^{p-2} {d}_{i}^{j}{b}_{j}{c}_{k}{d} {x}^{j}_{i}{E}^{0}{E}^0_u$',
+ r'${\int}_x^x x\oint_x^x x\int_{X}^{X}x\int_x x \int^x x \int_{x} x\int^{x}{\int}_{x} x{\int}^{x}_{x}x$',
+ r'testing$^{123}$',
+ ' '.join('$\\' + p + '$' for p in sorted(mathtext.Parser._accentprefixed)),
+ r'$6-2$; $-2$; $ -2$; ${-2}$; ${ -2}$; $20^{+3}_{-2}$',
+ r'$\overline{\omega}^x \frac{1}{2}_0^x$', # github issue #5444
+ r'$,$ $.$ $1{,}234{, }567{ , }890$ and $1,234,567,890$', # github issue 5799
+ r'$\left(X\right)_{a}^{b}$', # github issue 7615
+ r'$\dfrac{\$100.00}{y}$', # github issue #1888
+]
+# 'Lightweight' tests test only a single fontset (dejavusans, which is the
+# default) and only png outputs, in order to minimize the size of baseline
+# images.
+lightweight_math_tests = [
+ r'$\sqrt[ab]{123}$', # github issue #8665
+ r'$x \overset{f}{\rightarrow} \overset{f}{x} \underset{xx}{ff} \overset{xx}{ff} \underset{f}{x} \underset{f}{\leftarrow} x$', # github issue #18241
+]
+
+digits = "0123456789"
+uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+lowercase = "abcdefghijklmnopqrstuvwxyz"
+uppergreek = ("\\Gamma \\Delta \\Theta \\Lambda \\Xi \\Pi \\Sigma \\Upsilon \\Phi \\Psi "
+ "\\Omega")
+lowergreek = ("\\alpha \\beta \\gamma \\delta \\epsilon \\zeta \\eta \\theta \\iota "
+ "\\lambda \\mu \\nu \\xi \\pi \\kappa \\rho \\sigma \\tau \\upsilon "
+ "\\phi \\chi \\psi")
+all = [digits, uppercase, lowercase, uppergreek, lowergreek]
+
+# Use stubs to reserve space if tests are removed
+# stub should be of the form (None, N) where N is the number of strings that
+# used to be tested
+# Add new tests at the end.
+font_test_specs = [
+ ([], all),
+ (['mathrm'], all),
+ (['mathbf'], all),
+ (['mathit'], all),
+ (['mathtt'], [digits, uppercase, lowercase]),
+ (None, 3),
+ (None, 3),
+ (None, 3),
+ (['mathbb'], [digits, uppercase, lowercase,
+ r'\Gamma \Pi \Sigma \gamma \pi']),
+ (['mathrm', 'mathbb'], [digits, uppercase, lowercase,
+ r'\Gamma \Pi \Sigma \gamma \pi']),
+ (['mathbf', 'mathbb'], [digits, uppercase, lowercase,
+ r'\Gamma \Pi \Sigma \gamma \pi']),
+ (['mathcal'], [uppercase]),
+ (['mathfrak'], [uppercase, lowercase]),
+ (['mathbf', 'mathfrak'], [uppercase, lowercase]),
+ (['mathscr'], [uppercase, lowercase]),
+ (['mathsf'], [digits, uppercase, lowercase]),
+ (['mathrm', 'mathsf'], [digits, uppercase, lowercase]),
+ (['mathbf', 'mathsf'], [digits, uppercase, lowercase])
+ ]
+
+font_tests = []
+for fonts, chars in font_test_specs:
+ if fonts is None:
+ font_tests.extend([None] * chars)
+ else:
+ wrapper = ''.join([
+ ' '.join(fonts),
+ ' $',
+ *(r'\%s{' % font for font in fonts),
+ '%s',
+ *('}' for font in fonts),
+ '$',
+ ])
+ for set in chars:
+ font_tests.append(wrapper % set)
+
+
+@pytest.fixture
+def baseline_images(request, fontset, index, text):
+ if text is None:
+ pytest.skip("test has been removed")
+ return ['%s_%s_%02d' % (request.param, fontset, index)]
+
+
+@pytest.mark.parametrize(
+ 'index, text', enumerate(math_tests), ids=range(len(math_tests)))
+@pytest.mark.parametrize(
+ 'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif'])
+@pytest.mark.parametrize('baseline_images', ['mathtext'], indirect=True)
+@image_comparison(baseline_images=None)
+def test_mathtext_rendering(baseline_images, fontset, index, text):
+ mpl.rcParams['mathtext.fontset'] = fontset
+ fig = plt.figure(figsize=(5.25, 0.75))
+ fig.text(0.5, 0.5, text,
+ horizontalalignment='center', verticalalignment='center')
+
+
+@pytest.mark.parametrize('index, text', enumerate(lightweight_math_tests),
+ ids=range(len(lightweight_math_tests)))
+@pytest.mark.parametrize('fontset', ['dejavusans'])
+@pytest.mark.parametrize('baseline_images', ['mathtext1'], indirect=True)
+@image_comparison(baseline_images=None, extensions=['png'])
+def test_mathtext_rendering_lightweight(baseline_images, fontset, index, text):
+ fig = plt.figure(figsize=(5.25, 0.75))
+ fig.text(0.5, 0.5, text, math_fontfamily=fontset,
+ horizontalalignment='center', verticalalignment='center')
+
+
+@pytest.mark.parametrize(
+ 'index, text', enumerate(font_tests), ids=range(len(font_tests)))
+@pytest.mark.parametrize(
+ 'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif'])
+@pytest.mark.parametrize('baseline_images', ['mathfont'], indirect=True)
+@image_comparison(baseline_images=None, extensions=['png'])
+def test_mathfont_rendering(baseline_images, fontset, index, text):
+ mpl.rcParams['mathtext.fontset'] = fontset
+ fig = plt.figure(figsize=(5.25, 0.75))
+ fig.text(0.5, 0.5, text,
+ horizontalalignment='center', verticalalignment='center')
+
+
+def test_fontinfo():
+ fontpath = mpl.font_manager.findfont("DejaVu Sans")
+ font = mpl.ft2font.FT2Font(fontpath)
+ table = font.get_sfnt_table("head")
+ assert table['version'] == (1, 0)
+
+
+@pytest.mark.parametrize(
+ 'math, msg',
+ [
+ (r'$\hspace{}$', r'Expected \hspace{n}'),
+ (r'$\hspace{foo}$', r'Expected \hspace{n}'),
+ (r'$\frac$', r'Expected \frac{num}{den}'),
+ (r'$\frac{}{}$', r'Expected \frac{num}{den}'),
+ (r'$\binom$', r'Expected \binom{num}{den}'),
+ (r'$\binom{}{}$', r'Expected \binom{num}{den}'),
+ (r'$\genfrac$',
+ r'Expected \genfrac{ldelim}{rdelim}{rulesize}{style}{num}{den}'),
+ (r'$\genfrac{}{}{}{}{}{}$',
+ r'Expected \genfrac{ldelim}{rdelim}{rulesize}{style}{num}{den}'),
+ (r'$\sqrt$', r'Expected \sqrt{value}'),
+ (r'$\sqrt f$', r'Expected \sqrt{value}'),
+ (r'$\overline$', r'Expected \overline{value}'),
+ (r'$\overline{}$', r'Expected \overline{value}'),
+ (r'$\leftF$', r'Expected a delimiter'),
+ (r'$\rightF$', r'Unknown symbol: \rightF'),
+ (r'$\left(\right$', r'Expected a delimiter'),
+ (r'$\left($', r'Expected "\right"'),
+ (r'$\dfrac$', r'Expected \dfrac{num}{den}'),
+ (r'$\dfrac{}{}$', r'Expected \dfrac{num}{den}'),
+ (r'$\overset$', r'Expected \overset{body}{annotation}'),
+ (r'$\underset$', r'Expected \underset{body}{annotation}'),
+ ],
+ ids=[
+ 'hspace without value',
+ 'hspace with invalid value',
+ 'frac without parameters',
+ 'frac with empty parameters',
+ 'binom without parameters',
+ 'binom with empty parameters',
+ 'genfrac without parameters',
+ 'genfrac with empty parameters',
+ 'sqrt without parameters',
+ 'sqrt with invalid value',
+ 'overline without parameters',
+ 'overline with empty parameter',
+ 'left with invalid delimiter',
+ 'right with invalid delimiter',
+ 'unclosed parentheses with sizing',
+ 'unclosed parentheses without sizing',
+ 'dfrac without parameters',
+ 'dfrac with empty parameters',
+ 'overset without parameters',
+ 'underset without parameters',
+ ]
+)
+def test_mathtext_exceptions(math, msg):
+ parser = mathtext.MathTextParser('agg')
+
+ with pytest.raises(ValueError, match=re.escape(msg)):
+ parser.parse(math)
+
+
+def test_single_minus_sign():
+ plt.figure(figsize=(0.3, 0.3))
+ plt.text(0.5, 0.5, '$-$')
+ plt.gca().spines[:].set_visible(False)
+ plt.gca().set_xticks([])
+ plt.gca().set_yticks([])
+
+ buff = io.BytesIO()
+ plt.savefig(buff, format="rgba", dpi=1000)
+ array = np.frombuffer(buff.getvalue(), dtype=np.uint8)
+
+ # If this fails, it would be all white
+ assert not np.all(array == 0xff)
+
+
+@check_figures_equal(extensions=["png"])
+def test_spaces(fig_test, fig_ref):
+ fig_test.subplots().set_title(r"$1\,2\>3\ 4$")
+ fig_ref.subplots().set_title(r"$1\/2\:3~4$")
+
+
+@check_figures_equal(extensions=["png"])
+def test_operator_space(fig_test, fig_ref):
+ fig_test.text(0.1, 0.1, r"$\log 6$")
+ fig_test.text(0.1, 0.2, r"$\log(6)$")
+ fig_test.text(0.1, 0.3, r"$\arcsin 6$")
+ fig_test.text(0.1, 0.4, r"$\arcsin|6|$")
+ fig_test.text(0.1, 0.5, r"$\operatorname{op} 6$") # GitHub issue #553
+ fig_test.text(0.1, 0.6, r"$\operatorname{op}[6]$")
+ fig_test.text(0.1, 0.7, r"$\cos^2$")
+ fig_test.text(0.1, 0.8, r"$\log_2$")
+
+ fig_ref.text(0.1, 0.1, r"$\mathrm{log\,}6$")
+ fig_ref.text(0.1, 0.2, r"$\mathrm{log}(6)$")
+ fig_ref.text(0.1, 0.3, r"$\mathrm{arcsin\,}6$")
+ fig_ref.text(0.1, 0.4, r"$\mathrm{arcsin}|6|$")
+ fig_ref.text(0.1, 0.5, r"$\mathrm{op\,}6$")
+ fig_ref.text(0.1, 0.6, r"$\mathrm{op}[6]$")
+ fig_ref.text(0.1, 0.7, r"$\mathrm{cos}^2$")
+ fig_ref.text(0.1, 0.8, r"$\mathrm{log}_2$")
+
+
+def test_mathtext_fallback_valid():
+ for fallback in ['cm', 'stix', 'stixsans', 'None']:
+ mpl.rcParams['mathtext.fallback'] = fallback
+
+
+def test_mathtext_fallback_invalid():
+ for fallback in ['abc', '']:
+ with pytest.raises(ValueError, match="not a valid fallback font name"):
+ mpl.rcParams['mathtext.fallback'] = fallback
+
+
+def test_mathtext_fallback_to_cm_invalid():
+ for fallback in [True, False]:
+ with pytest.warns(_api.MatplotlibDeprecationWarning):
+ mpl.rcParams['mathtext.fallback_to_cm'] = fallback
+
+
+@pytest.mark.parametrize(
+ "fallback,fontlist",
+ [("cm", ['DejaVu Sans', 'mpltest', 'STIXGeneral', 'cmr10', 'STIXGeneral']),
+ ("stix", ['DejaVu Sans', 'mpltest', 'STIXGeneral'])])
+def test_mathtext_fallback(fallback, fontlist):
+ mpl.font_manager.fontManager.addfont(
+ os.path.join((os.path.dirname(os.path.realpath(__file__))), 'mpltest.ttf'))
+ mpl.rcParams["svg.fonttype"] = 'none'
+ mpl.rcParams['mathtext.fontset'] = 'custom'
+ mpl.rcParams['mathtext.rm'] = 'mpltest'
+ mpl.rcParams['mathtext.it'] = 'mpltest:italic'
+ mpl.rcParams['mathtext.bf'] = 'mpltest:bold'
+ mpl.rcParams['mathtext.fallback'] = fallback
+
+ test_str = r'a$A\AA\breve\gimel$'
+
+ buff = io.BytesIO()
+ fig, ax = plt.subplots()
+ fig.text(.5, .5, test_str, fontsize=40, ha='center')
+ fig.savefig(buff, format="svg")
+ char_fonts = [
+ line.split("font-family:")[-1].split(";")[0]
+ for line in str(buff.getvalue()).split(r"\n") if "tspan" in line
+ ]
+ assert char_fonts == fontlist
+ mpl.font_manager.fontManager.ttflist = mpl.font_manager.fontManager.ttflist[:-1]
+
+
+def test_math_to_image(tmpdir):
+ mathtext.math_to_image('$x^2$', str(tmpdir.join('example.png')))
+ mathtext.math_to_image('$x^2$', io.BytesIO())
+
+
+def test_mathtext_to_png(tmpdir):
+ with _api.suppress_matplotlib_deprecation_warning():
+ mt = mathtext.MathTextParser('bitmap')
+ mt.to_png(str(tmpdir.join('example.png')), '$x^2$')
+ mt.to_png(io.BytesIO(), '$x^2$')
+
+
+@image_comparison(baseline_images=['math_fontfamily_image.png'],
+ savefig_kwarg={'dpi': 40})
+def test_math_fontfamily():
+ fig = plt.figure(figsize=(10, 3))
+ fig.text(0.2, 0.7, r"$This\ text\ should\ have\ one\ font$",
+ size=24, math_fontfamily='dejavusans')
+ fig.text(0.2, 0.3, r"$This\ text\ should\ have\ another$",
+ size=24, math_fontfamily='stix')
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_matplotlib.py b/venv/Lib/site-packages/matplotlib/tests/test_matplotlib.py
new file mode 100644
index 0000000..cad9433
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_matplotlib.py
@@ -0,0 +1,67 @@
+import os
+import subprocess
+import sys
+
+import pytest
+
+import matplotlib
+
+
+@pytest.mark.skipif(
+ os.name == "nt", reason="chmod() doesn't work as is on Windows")
+@pytest.mark.skipif(os.name != "nt" and os.geteuid() == 0,
+ reason="chmod() doesn't work as root")
+def test_tmpconfigdir_warning(tmpdir):
+ """Test that a warning is emitted if a temporary configdir must be used."""
+ mode = os.stat(tmpdir).st_mode
+ try:
+ os.chmod(tmpdir, 0)
+ proc = subprocess.run(
+ [sys.executable, "-c", "import matplotlib"],
+ env={**os.environ, "MPLCONFIGDIR": str(tmpdir)},
+ stderr=subprocess.PIPE, universal_newlines=True, check=True)
+ assert "set the MPLCONFIGDIR" in proc.stderr
+ finally:
+ os.chmod(tmpdir, mode)
+
+
+def test_importable_with_no_home(tmpdir):
+ subprocess.run(
+ [sys.executable, "-c",
+ "import pathlib; pathlib.Path.home = lambda *args: 1/0; "
+ "import matplotlib.pyplot"],
+ env={**os.environ, "MPLCONFIGDIR": str(tmpdir)}, check=True)
+
+
+def test_use_doc_standard_backends():
+ """
+ Test that the standard backends mentioned in the docstring of
+ matplotlib.use() are the same as in matplotlib.rcsetup.
+ """
+ def parse(key):
+ backends = []
+ for line in matplotlib.use.__doc__.split(key)[1].split('\n'):
+ if not line.strip():
+ break
+ backends += [e.strip() for e in line.split(',') if e]
+ return backends
+
+ assert (set(parse('- interactive backends:\n')) ==
+ set(matplotlib.rcsetup.interactive_bk))
+ assert (set(parse('- non-interactive backends:\n')) ==
+ set(matplotlib.rcsetup.non_interactive_bk))
+
+
+def test_importable_with__OO():
+ """
+ When using -OO or export PYTHONOPTIMIZE=2, docstrings are discarded,
+ this simple test may prevent something like issue #17970.
+ """
+ program = (
+ "import matplotlib as mpl; "
+ "import matplotlib.pyplot as plt; "
+ "import matplotlib.cbook as cbook; "
+ "import matplotlib.patches as mpatches"
+ )
+ cmd = [sys.executable, "-OO", "-c", program]
+ assert subprocess.call(cmd, env={**os.environ, "MPLBACKEND": ""}) == 0
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_mlab.py b/venv/Lib/site-packages/matplotlib/tests/test_mlab.py
new file mode 100644
index 0000000..5976fb3
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_mlab.py
@@ -0,0 +1,1069 @@
+from numpy.testing import (assert_allclose, assert_almost_equal,
+ assert_array_equal, assert_array_almost_equal_nulp)
+import numpy as np
+import pytest
+
+import matplotlib.mlab as mlab
+
+
+class TestStride:
+ def get_base(self, x):
+ y = x
+ while y.base is not None:
+ y = y.base
+ return y
+
+ def calc_window_target(self, x, NFFT, noverlap=0, axis=0):
+ """
+ This is an adaptation of the original window extraction algorithm.
+ This is here to test to make sure the new implementation has the same
+ result.
+ """
+ step = NFFT - noverlap
+ ind = np.arange(0, len(x) - NFFT + 1, step)
+ n = len(ind)
+ result = np.zeros((NFFT, n))
+
+ # do the ffts of the slices
+ for i in range(n):
+ result[:, i] = x[ind[i]:ind[i]+NFFT]
+ if axis == 1:
+ result = result.T
+ return result
+
+ @pytest.mark.parametrize('shape', [(), (10, 1)], ids=['0D', '2D'])
+ def test_stride_windows_invalid_input_shape(self, shape):
+ x = np.arange(np.prod(shape)).reshape(shape)
+ with pytest.raises(ValueError):
+ mlab.stride_windows(x, 5)
+
+ @pytest.mark.parametrize('n, noverlap',
+ [(0, None), (11, None), (2, 2), (2, 3)],
+ ids=['n less than 1', 'n greater than input',
+ 'noverlap greater than n',
+ 'noverlap equal to n'])
+ def test_stride_windows_invalid_params(self, n, noverlap):
+ x = np.arange(10)
+ with pytest.raises(ValueError):
+ mlab.stride_windows(x, n, noverlap)
+
+ @pytest.mark.parametrize('axis', [0, 1], ids=['axis0', 'axis1'])
+ @pytest.mark.parametrize('n, noverlap',
+ [(1, 0), (5, 0), (15, 2), (13, -3)],
+ ids=['n1-noverlap0', 'n5-noverlap0',
+ 'n15-noverlap2', 'n13-noverlapn3'])
+ def test_stride_windows(self, n, noverlap, axis):
+ x = np.arange(100)
+ y = mlab.stride_windows(x, n, noverlap=noverlap, axis=axis)
+
+ expected_shape = [0, 0]
+ expected_shape[axis] = n
+ expected_shape[1 - axis] = 100 // (n - noverlap)
+ yt = self.calc_window_target(x, n, noverlap=noverlap, axis=axis)
+
+ assert yt.shape == y.shape
+ assert_array_equal(yt, y)
+ assert tuple(expected_shape) == y.shape
+ assert self.get_base(y) is x
+
+ @pytest.mark.parametrize('axis', [0, 1], ids=['axis0', 'axis1'])
+ def test_stride_windows_n32_noverlap0_unflatten(self, axis):
+ n = 32
+ x = np.arange(n)[np.newaxis]
+ x1 = np.tile(x, (21, 1))
+ x2 = x1.flatten()
+ y = mlab.stride_windows(x2, n, axis=axis)
+
+ if axis == 0:
+ x1 = x1.T
+ assert y.shape == x1.shape
+ assert_array_equal(y, x1)
+
+
+def test_window():
+ np.random.seed(0)
+ n = 1000
+ rand = np.random.standard_normal(n) + 100
+ ones = np.ones(n)
+ assert_array_equal(mlab.window_none(ones), ones)
+ assert_array_equal(mlab.window_none(rand), rand)
+ assert_array_equal(np.hanning(len(rand)) * rand, mlab.window_hanning(rand))
+ assert_array_equal(np.hanning(len(ones)), mlab.window_hanning(ones))
+
+
+class TestDetrend:
+ def setup(self):
+ np.random.seed(0)
+ n = 1000
+ x = np.linspace(0., 100, n)
+
+ self.sig_zeros = np.zeros(n)
+
+ self.sig_off = self.sig_zeros + 100.
+ self.sig_slope = np.linspace(-10., 90., n)
+ self.sig_slope_mean = x - x.mean()
+
+ self.sig_base = (
+ np.random.standard_normal(n) + np.sin(x*2*np.pi/(n/100)))
+ self.sig_base -= self.sig_base.mean()
+
+ def allclose(self, *args):
+ assert_allclose(*args, atol=1e-8)
+
+ def test_detrend_none(self):
+ assert mlab.detrend_none(0.) == 0.
+ assert mlab.detrend_none(0., axis=1) == 0.
+ assert mlab.detrend(0., key="none") == 0.
+ assert mlab.detrend(0., key=mlab.detrend_none) == 0.
+ for sig in [
+ 5.5, self.sig_off, self.sig_slope, self.sig_base,
+ (self.sig_base + self.sig_slope + self.sig_off).tolist(),
+ np.vstack([self.sig_base, # 2D case.
+ self.sig_base + self.sig_off,
+ self.sig_base + self.sig_slope,
+ self.sig_base + self.sig_off + self.sig_slope]),
+ np.vstack([self.sig_base, # 2D transposed case.
+ self.sig_base + self.sig_off,
+ self.sig_base + self.sig_slope,
+ self.sig_base + self.sig_off + self.sig_slope]).T,
+ ]:
+ if isinstance(sig, np.ndarray):
+ assert_array_equal(mlab.detrend_none(sig), sig)
+ else:
+ assert mlab.detrend_none(sig) == sig
+
+ def test_detrend_mean(self):
+ for sig in [0., 5.5]: # 0D.
+ assert mlab.detrend_mean(sig) == 0.
+ assert mlab.detrend(sig, key="mean") == 0.
+ assert mlab.detrend(sig, key=mlab.detrend_mean) == 0.
+ # 1D.
+ self.allclose(mlab.detrend_mean(self.sig_zeros), self.sig_zeros)
+ self.allclose(mlab.detrend_mean(self.sig_base), self.sig_base)
+ self.allclose(mlab.detrend_mean(self.sig_base + self.sig_off),
+ self.sig_base)
+ self.allclose(mlab.detrend_mean(self.sig_base + self.sig_slope),
+ self.sig_base + self.sig_slope_mean)
+ self.allclose(
+ mlab.detrend_mean(self.sig_base + self.sig_slope + self.sig_off),
+ self.sig_base + self.sig_slope_mean)
+
+ def test_detrend_mean_1d_base_slope_off_list_andor_axis0(self):
+ input = self.sig_base + self.sig_slope + self.sig_off
+ target = self.sig_base + self.sig_slope_mean
+ self.allclose(mlab.detrend_mean(input, axis=0), target)
+ self.allclose(mlab.detrend_mean(input.tolist()), target)
+ self.allclose(mlab.detrend_mean(input.tolist(), axis=0), target)
+
+ def test_detrend_mean_2d(self):
+ input = np.vstack([self.sig_off,
+ self.sig_base + self.sig_off])
+ target = np.vstack([self.sig_zeros,
+ self.sig_base])
+ self.allclose(mlab.detrend_mean(input), target)
+ self.allclose(mlab.detrend_mean(input, axis=None), target)
+ self.allclose(mlab.detrend_mean(input.T, axis=None).T, target)
+ self.allclose(mlab.detrend(input), target)
+ self.allclose(mlab.detrend(input, axis=None), target)
+ self.allclose(
+ mlab.detrend(input.T, key="constant", axis=None), target.T)
+
+ input = np.vstack([self.sig_base,
+ self.sig_base + self.sig_off,
+ self.sig_base + self.sig_slope,
+ self.sig_base + self.sig_off + self.sig_slope])
+ target = np.vstack([self.sig_base,
+ self.sig_base,
+ self.sig_base + self.sig_slope_mean,
+ self.sig_base + self.sig_slope_mean])
+ self.allclose(mlab.detrend_mean(input.T, axis=0), target.T)
+ self.allclose(mlab.detrend_mean(input, axis=1), target)
+ self.allclose(mlab.detrend_mean(input, axis=-1), target)
+ self.allclose(mlab.detrend(input, key="default", axis=1), target)
+ self.allclose(mlab.detrend(input.T, key="mean", axis=0), target.T)
+ self.allclose(
+ mlab.detrend(input.T, key=mlab.detrend_mean, axis=0), target.T)
+
+ def test_detrend_ValueError(self):
+ for signal, kwargs in [
+ (self.sig_slope[np.newaxis], {"key": "spam"}),
+ (self.sig_slope[np.newaxis], {"key": 5}),
+ (5.5, {"axis": 0}),
+ (self.sig_slope, {"axis": 1}),
+ (self.sig_slope[np.newaxis], {"axis": 2}),
+ ]:
+ with pytest.raises(ValueError):
+ mlab.detrend(signal, **kwargs)
+
+ def test_detrend_mean_ValueError(self):
+ for signal, kwargs in [
+ (5.5, {"axis": 0}),
+ (self.sig_slope, {"axis": 1}),
+ (self.sig_slope[np.newaxis], {"axis": 2}),
+ ]:
+ with pytest.raises(ValueError):
+ mlab.detrend_mean(signal, **kwargs)
+
+ def test_detrend_linear(self):
+ # 0D.
+ assert mlab.detrend_linear(0.) == 0.
+ assert mlab.detrend_linear(5.5) == 0.
+ assert mlab.detrend(5.5, key="linear") == 0.
+ assert mlab.detrend(5.5, key=mlab.detrend_linear) == 0.
+ for sig in [ # 1D.
+ self.sig_off,
+ self.sig_slope,
+ self.sig_slope + self.sig_off,
+ ]:
+ self.allclose(mlab.detrend_linear(sig), self.sig_zeros)
+
+ def test_detrend_str_linear_1d(self):
+ input = self.sig_slope + self.sig_off
+ target = self.sig_zeros
+ self.allclose(mlab.detrend(input, key="linear"), target)
+ self.allclose(mlab.detrend(input, key=mlab.detrend_linear), target)
+ self.allclose(mlab.detrend_linear(input.tolist()), target)
+
+ def test_detrend_linear_2d(self):
+ input = np.vstack([self.sig_off,
+ self.sig_slope,
+ self.sig_slope + self.sig_off])
+ target = np.vstack([self.sig_zeros,
+ self.sig_zeros,
+ self.sig_zeros])
+ self.allclose(
+ mlab.detrend(input.T, key="linear", axis=0), target.T)
+ self.allclose(
+ mlab.detrend(input.T, key=mlab.detrend_linear, axis=0), target.T)
+ self.allclose(
+ mlab.detrend(input, key="linear", axis=1), target)
+ self.allclose(
+ mlab.detrend(input, key=mlab.detrend_linear, axis=1), target)
+
+ with pytest.raises(ValueError):
+ mlab.detrend_linear(self.sig_slope[np.newaxis])
+
+
+@pytest.mark.parametrize('iscomplex', [False, True],
+ ids=['real', 'complex'], scope='class')
+@pytest.mark.parametrize('sides', ['onesided', 'twosided', 'default'],
+ scope='class')
+@pytest.mark.parametrize(
+ 'fstims,len_x,NFFT_density,nover_density,pad_to_density,pad_to_spectrum',
+ [
+ ([], None, -1, -1, -1, -1),
+ ([4], None, -1, -1, -1, -1),
+ ([4, 5, 10], None, -1, -1, -1, -1),
+ ([], None, None, -1, -1, None),
+ ([], None, -1, -1, None, None),
+ ([], None, None, -1, None, None),
+ ([], 1024, 512, -1, -1, 128),
+ ([], 256, -1, -1, 33, 257),
+ ([], 255, 33, -1, -1, None),
+ ([], 256, 128, -1, 256, 256),
+ ([], None, -1, 32, -1, -1),
+ ],
+ ids=[
+ 'nosig',
+ 'Fs4',
+ 'FsAll',
+ 'nosig_noNFFT',
+ 'nosig_nopad_to',
+ 'nosig_noNFFT_no_pad_to',
+ 'nosig_trim',
+ 'nosig_odd',
+ 'nosig_oddlen',
+ 'nosig_stretch',
+ 'nosig_overlap',
+ ],
+ scope='class')
+class TestSpectral:
+ @pytest.fixture(scope='class', autouse=True)
+ def stim(self, request, fstims, iscomplex, sides, len_x, NFFT_density,
+ nover_density, pad_to_density, pad_to_spectrum):
+ Fs = 100.
+
+ x = np.arange(0, 10, 1 / Fs)
+ if len_x is not None:
+ x = x[:len_x]
+
+ # get the stimulus frequencies, defaulting to None
+ fstims = [Fs / fstim for fstim in fstims]
+
+ # get the constants, default to calculated values
+ if NFFT_density is None:
+ NFFT_density_real = 256
+ elif NFFT_density < 0:
+ NFFT_density_real = NFFT_density = 100
+ else:
+ NFFT_density_real = NFFT_density
+
+ if nover_density is None:
+ nover_density_real = 0
+ elif nover_density < 0:
+ nover_density_real = nover_density = NFFT_density_real // 2
+ else:
+ nover_density_real = nover_density
+
+ if pad_to_density is None:
+ pad_to_density_real = NFFT_density_real
+ elif pad_to_density < 0:
+ pad_to_density = int(2**np.ceil(np.log2(NFFT_density_real)))
+ pad_to_density_real = pad_to_density
+ else:
+ pad_to_density_real = pad_to_density
+
+ if pad_to_spectrum is None:
+ pad_to_spectrum_real = len(x)
+ elif pad_to_spectrum < 0:
+ pad_to_spectrum_real = pad_to_spectrum = len(x)
+ else:
+ pad_to_spectrum_real = pad_to_spectrum
+
+ if pad_to_spectrum is None:
+ NFFT_spectrum_real = NFFT_spectrum = pad_to_spectrum_real
+ else:
+ NFFT_spectrum_real = NFFT_spectrum = len(x)
+ nover_spectrum = 0
+
+ NFFT_specgram = NFFT_density
+ nover_specgram = nover_density
+ pad_to_specgram = pad_to_density
+ NFFT_specgram_real = NFFT_density_real
+ nover_specgram_real = nover_density_real
+
+ if sides == 'onesided' or (sides == 'default' and not iscomplex):
+ # frequencies for specgram, psd, and csd
+ # need to handle even and odd differently
+ if pad_to_density_real % 2:
+ freqs_density = np.linspace(0, Fs / 2,
+ num=pad_to_density_real,
+ endpoint=False)[::2]
+ else:
+ freqs_density = np.linspace(0, Fs / 2,
+ num=pad_to_density_real // 2 + 1)
+
+ # frequencies for complex, magnitude, angle, and phase spectrums
+ # need to handle even and odd differently
+ if pad_to_spectrum_real % 2:
+ freqs_spectrum = np.linspace(0, Fs / 2,
+ num=pad_to_spectrum_real,
+ endpoint=False)[::2]
+ else:
+ freqs_spectrum = np.linspace(0, Fs / 2,
+ num=pad_to_spectrum_real // 2 + 1)
+ else:
+ # frequencies for specgram, psd, and csd
+ # need to handle even and odd differentl
+ if pad_to_density_real % 2:
+ freqs_density = np.linspace(-Fs / 2, Fs / 2,
+ num=2 * pad_to_density_real,
+ endpoint=False)[1::2]
+ else:
+ freqs_density = np.linspace(-Fs / 2, Fs / 2,
+ num=pad_to_density_real,
+ endpoint=False)
+
+ # frequencies for complex, magnitude, angle, and phase spectrums
+ # need to handle even and odd differently
+ if pad_to_spectrum_real % 2:
+ freqs_spectrum = np.linspace(-Fs / 2, Fs / 2,
+ num=2 * pad_to_spectrum_real,
+ endpoint=False)[1::2]
+ else:
+ freqs_spectrum = np.linspace(-Fs / 2, Fs / 2,
+ num=pad_to_spectrum_real,
+ endpoint=False)
+
+ freqs_specgram = freqs_density
+ # time points for specgram
+ t_start = NFFT_specgram_real // 2
+ t_stop = len(x) - NFFT_specgram_real // 2 + 1
+ t_step = NFFT_specgram_real - nover_specgram_real
+ t_specgram = x[t_start:t_stop:t_step]
+ if NFFT_specgram_real % 2:
+ t_specgram += 1 / Fs / 2
+ if len(t_specgram) == 0:
+ t_specgram = np.array([NFFT_specgram_real / (2 * Fs)])
+ t_spectrum = np.array([NFFT_spectrum_real / (2 * Fs)])
+ t_density = t_specgram
+
+ y = np.zeros_like(x)
+ for i, fstim in enumerate(fstims):
+ y += np.sin(fstim * x * np.pi * 2) * 10**i
+
+ if iscomplex:
+ y = y.astype('complex')
+
+ # Interestingly, the instance on which this fixture is called is not
+ # the same as the one on which a test is run. So we need to modify the
+ # class itself when using a class-scoped fixture.
+ cls = request.cls
+
+ cls.Fs = Fs
+ cls.sides = sides
+ cls.fstims = fstims
+
+ cls.NFFT_density = NFFT_density
+ cls.nover_density = nover_density
+ cls.pad_to_density = pad_to_density
+
+ cls.NFFT_spectrum = NFFT_spectrum
+ cls.nover_spectrum = nover_spectrum
+ cls.pad_to_spectrum = pad_to_spectrum
+
+ cls.NFFT_specgram = NFFT_specgram
+ cls.nover_specgram = nover_specgram
+ cls.pad_to_specgram = pad_to_specgram
+
+ cls.t_specgram = t_specgram
+ cls.t_density = t_density
+ cls.t_spectrum = t_spectrum
+ cls.y = y
+
+ cls.freqs_density = freqs_density
+ cls.freqs_spectrum = freqs_spectrum
+ cls.freqs_specgram = freqs_specgram
+
+ cls.NFFT_density_real = NFFT_density_real
+
+ def check_freqs(self, vals, targfreqs, resfreqs, fstims):
+ assert resfreqs.argmin() == 0
+ assert resfreqs.argmax() == len(resfreqs)-1
+ assert_allclose(resfreqs, targfreqs, atol=1e-06)
+ for fstim in fstims:
+ i = np.abs(resfreqs - fstim).argmin()
+ assert vals[i] > vals[i+2]
+ assert vals[i] > vals[i-2]
+
+ def check_maxfreq(self, spec, fsp, fstims):
+ # skip the test if there are no frequencies
+ if len(fstims) == 0:
+ return
+
+ # if twosided, do the test for each side
+ if fsp.min() < 0:
+ fspa = np.abs(fsp)
+ zeroind = fspa.argmin()
+ self.check_maxfreq(spec[:zeroind], fspa[:zeroind], fstims)
+ self.check_maxfreq(spec[zeroind:], fspa[zeroind:], fstims)
+ return
+
+ fstimst = fstims[:]
+ spect = spec.copy()
+
+ # go through each peak and make sure it is correctly the maximum peak
+ while fstimst:
+ maxind = spect.argmax()
+ maxfreq = fsp[maxind]
+ assert_almost_equal(maxfreq, fstimst[-1])
+ del fstimst[-1]
+ spect[maxind-5:maxind+5] = 0
+
+ def test_spectral_helper_raises(self):
+ # We don't use parametrize here to handle ``y = self.y``.
+ for kwargs in [ # Various error conditions:
+ {"y": self.y+1, "mode": "complex"}, # Modes requiring ``x is y``.
+ {"y": self.y+1, "mode": "magnitude"},
+ {"y": self.y+1, "mode": "angle"},
+ {"y": self.y+1, "mode": "phase"},
+ {"mode": "spam"}, # Bad mode.
+ {"y": self.y, "sides": "eggs"}, # Bad sides.
+ {"y": self.y, "NFFT": 10, "noverlap": 20}, # noverlap > NFFT.
+ {"NFFT": 10, "noverlap": 10}, # noverlap == NFFT.
+ {"y": self.y, "NFFT": 10,
+ "window": np.ones(9)}, # len(win) != NFFT.
+ ]:
+ with pytest.raises(ValueError):
+ mlab._spectral_helper(x=self.y, **kwargs)
+
+ @pytest.mark.parametrize('mode', ['default', 'psd'])
+ def test_single_spectrum_helper_unsupported_modes(self, mode):
+ with pytest.raises(ValueError):
+ mlab._single_spectrum_helper(x=self.y, mode=mode)
+
+ @pytest.mark.parametrize("mode, case", [
+ ("psd", "density"),
+ ("magnitude", "specgram"),
+ ("magnitude", "spectrum"),
+ ])
+ def test_spectral_helper_psd(self, mode, case):
+ freqs = getattr(self, f"freqs_{case}")
+ spec, fsp, t = mlab._spectral_helper(
+ x=self.y, y=self.y,
+ NFFT=getattr(self, f"NFFT_{case}"),
+ Fs=self.Fs,
+ noverlap=getattr(self, f"nover_{case}"),
+ pad_to=getattr(self, f"pad_to_{case}"),
+ sides=self.sides,
+ mode=mode)
+
+ assert_allclose(fsp, freqs, atol=1e-06)
+ assert_allclose(t, getattr(self, f"t_{case}"), atol=1e-06)
+ assert spec.shape[0] == freqs.shape[0]
+ assert spec.shape[1] == getattr(self, f"t_{case}").shape[0]
+
+ def test_csd(self):
+ freqs = self.freqs_density
+ spec, fsp = mlab.csd(x=self.y, y=self.y+1,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=self.nover_density,
+ pad_to=self.pad_to_density,
+ sides=self.sides)
+ assert_allclose(fsp, freqs, atol=1e-06)
+ assert spec.shape == freqs.shape
+
+ def test_csd_padding(self):
+ """Test zero padding of csd()."""
+ if self.NFFT_density is None: # for derived classes
+ return
+ sargs = dict(x=self.y, y=self.y+1, Fs=self.Fs, window=mlab.window_none,
+ sides=self.sides)
+
+ spec0, _ = mlab.csd(NFFT=self.NFFT_density, **sargs)
+ spec1, _ = mlab.csd(NFFT=self.NFFT_density*2, **sargs)
+ assert_almost_equal(np.sum(np.conjugate(spec0)*spec0).real,
+ np.sum(np.conjugate(spec1/2)*spec1/2).real)
+
+ def test_psd(self):
+ freqs = self.freqs_density
+ spec, fsp = mlab.psd(x=self.y,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=self.nover_density,
+ pad_to=self.pad_to_density,
+ sides=self.sides)
+ assert spec.shape == freqs.shape
+ self.check_freqs(spec, freqs, fsp, self.fstims)
+
+ @pytest.mark.parametrize(
+ 'make_data, detrend',
+ [(np.zeros, mlab.detrend_mean), (np.zeros, 'mean'),
+ (np.arange, mlab.detrend_linear), (np.arange, 'linear')])
+ def test_psd_detrend(self, make_data, detrend):
+ if self.NFFT_density is None:
+ return
+ ydata = make_data(self.NFFT_density)
+ ydata1 = ydata+5
+ ydata2 = ydata+3.3
+ ydata = np.vstack([ydata1, ydata2])
+ ydata = np.tile(ydata, (20, 1))
+ ydatab = ydata.T.flatten()
+ ydata = ydata.flatten()
+ ycontrol = np.zeros_like(ydata)
+ spec_g, fsp_g = mlab.psd(x=ydata,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=0,
+ sides=self.sides,
+ detrend=detrend)
+ spec_b, fsp_b = mlab.psd(x=ydatab,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=0,
+ sides=self.sides,
+ detrend=detrend)
+ spec_c, fsp_c = mlab.psd(x=ycontrol,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=0,
+ sides=self.sides)
+ assert_array_equal(fsp_g, fsp_c)
+ assert_array_equal(fsp_b, fsp_c)
+ assert_allclose(spec_g, spec_c, atol=1e-08)
+ # these should not be almost equal
+ with pytest.raises(AssertionError):
+ assert_allclose(spec_b, spec_c, atol=1e-08)
+
+ def test_psd_window_hanning(self):
+ if self.NFFT_density is None:
+ return
+ ydata = np.arange(self.NFFT_density)
+ ydata1 = ydata+5
+ ydata2 = ydata+3.3
+ windowVals = mlab.window_hanning(np.ones_like(ydata1))
+ ycontrol1 = ydata1 * windowVals
+ ycontrol2 = mlab.window_hanning(ydata2)
+ ydata = np.vstack([ydata1, ydata2])
+ ycontrol = np.vstack([ycontrol1, ycontrol2])
+ ydata = np.tile(ydata, (20, 1))
+ ycontrol = np.tile(ycontrol, (20, 1))
+ ydatab = ydata.T.flatten()
+ ydataf = ydata.flatten()
+ ycontrol = ycontrol.flatten()
+ spec_g, fsp_g = mlab.psd(x=ydataf,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=0,
+ sides=self.sides,
+ window=mlab.window_hanning)
+ spec_b, fsp_b = mlab.psd(x=ydatab,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=0,
+ sides=self.sides,
+ window=mlab.window_hanning)
+ spec_c, fsp_c = mlab.psd(x=ycontrol,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=0,
+ sides=self.sides,
+ window=mlab.window_none)
+ spec_c *= len(ycontrol1)/(np.abs(windowVals)**2).sum()
+ assert_array_equal(fsp_g, fsp_c)
+ assert_array_equal(fsp_b, fsp_c)
+ assert_allclose(spec_g, spec_c, atol=1e-08)
+ # these should not be almost equal
+ with pytest.raises(AssertionError):
+ assert_allclose(spec_b, spec_c, atol=1e-08)
+
+ def test_psd_window_hanning_detrend_linear(self):
+ if self.NFFT_density is None:
+ return
+ ydata = np.arange(self.NFFT_density)
+ ycontrol = np.zeros(self.NFFT_density)
+ ydata1 = ydata+5
+ ydata2 = ydata+3.3
+ ycontrol1 = ycontrol
+ ycontrol2 = ycontrol
+ windowVals = mlab.window_hanning(np.ones_like(ycontrol1))
+ ycontrol1 = ycontrol1 * windowVals
+ ycontrol2 = mlab.window_hanning(ycontrol2)
+ ydata = np.vstack([ydata1, ydata2])
+ ycontrol = np.vstack([ycontrol1, ycontrol2])
+ ydata = np.tile(ydata, (20, 1))
+ ycontrol = np.tile(ycontrol, (20, 1))
+ ydatab = ydata.T.flatten()
+ ydataf = ydata.flatten()
+ ycontrol = ycontrol.flatten()
+ spec_g, fsp_g = mlab.psd(x=ydataf,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=0,
+ sides=self.sides,
+ detrend=mlab.detrend_linear,
+ window=mlab.window_hanning)
+ spec_b, fsp_b = mlab.psd(x=ydatab,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=0,
+ sides=self.sides,
+ detrend=mlab.detrend_linear,
+ window=mlab.window_hanning)
+ spec_c, fsp_c = mlab.psd(x=ycontrol,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=0,
+ sides=self.sides,
+ window=mlab.window_none)
+ spec_c *= len(ycontrol1)/(np.abs(windowVals)**2).sum()
+ assert_array_equal(fsp_g, fsp_c)
+ assert_array_equal(fsp_b, fsp_c)
+ assert_allclose(spec_g, spec_c, atol=1e-08)
+ # these should not be almost equal
+ with pytest.raises(AssertionError):
+ assert_allclose(spec_b, spec_c, atol=1e-08)
+
+ def test_psd_windowarray(self):
+ freqs = self.freqs_density
+ spec, fsp = mlab.psd(x=self.y,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=self.nover_density,
+ pad_to=self.pad_to_density,
+ sides=self.sides,
+ window=np.ones(self.NFFT_density_real))
+ assert_allclose(fsp, freqs, atol=1e-06)
+ assert spec.shape == freqs.shape
+
+ def test_psd_windowarray_scale_by_freq(self):
+ win = mlab.window_hanning(np.ones(self.NFFT_density_real))
+
+ spec, fsp = mlab.psd(x=self.y,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=self.nover_density,
+ pad_to=self.pad_to_density,
+ sides=self.sides,
+ window=mlab.window_hanning)
+ spec_s, fsp_s = mlab.psd(x=self.y,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=self.nover_density,
+ pad_to=self.pad_to_density,
+ sides=self.sides,
+ window=mlab.window_hanning,
+ scale_by_freq=True)
+ spec_n, fsp_n = mlab.psd(x=self.y,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=self.nover_density,
+ pad_to=self.pad_to_density,
+ sides=self.sides,
+ window=mlab.window_hanning,
+ scale_by_freq=False)
+ assert_array_equal(fsp, fsp_s)
+ assert_array_equal(fsp, fsp_n)
+ assert_array_equal(spec, spec_s)
+ assert_allclose(spec_s*(win**2).sum(),
+ spec_n/self.Fs*win.sum()**2,
+ atol=1e-08)
+
+ @pytest.mark.parametrize(
+ "kind", ["complex", "magnitude", "angle", "phase"])
+ def test_spectrum(self, kind):
+ freqs = self.freqs_spectrum
+ spec, fsp = getattr(mlab, f"{kind}_spectrum")(
+ x=self.y,
+ Fs=self.Fs, sides=self.sides, pad_to=self.pad_to_spectrum)
+ assert_allclose(fsp, freqs, atol=1e-06)
+ assert spec.shape == freqs.shape
+ if kind == "magnitude":
+ self.check_maxfreq(spec, fsp, self.fstims)
+ self.check_freqs(spec, freqs, fsp, self.fstims)
+
+ @pytest.mark.parametrize(
+ 'kwargs',
+ [{}, {'mode': 'default'}, {'mode': 'psd'}, {'mode': 'magnitude'},
+ {'mode': 'complex'}, {'mode': 'angle'}, {'mode': 'phase'}])
+ def test_specgram(self, kwargs):
+ freqs = self.freqs_specgram
+ spec, fsp, t = mlab.specgram(x=self.y,
+ NFFT=self.NFFT_specgram,
+ Fs=self.Fs,
+ noverlap=self.nover_specgram,
+ pad_to=self.pad_to_specgram,
+ sides=self.sides,
+ **kwargs)
+ if kwargs.get('mode') == 'complex':
+ spec = np.abs(spec)
+ specm = np.mean(spec, axis=1)
+
+ assert_allclose(fsp, freqs, atol=1e-06)
+ assert_allclose(t, self.t_specgram, atol=1e-06)
+
+ assert spec.shape[0] == freqs.shape[0]
+ assert spec.shape[1] == self.t_specgram.shape[0]
+
+ if kwargs.get('mode') not in ['complex', 'angle', 'phase']:
+ # using a single freq, so all time slices should be about the same
+ if np.abs(spec.max()) != 0:
+ assert_allclose(
+ np.diff(spec, axis=1).max() / np.abs(spec.max()), 0,
+ atol=1e-02)
+ if kwargs.get('mode') not in ['angle', 'phase']:
+ self.check_freqs(specm, freqs, fsp, self.fstims)
+
+ def test_specgram_warn_only1seg(self):
+ """Warning should be raised if len(x) <= NFFT."""
+ with pytest.warns(UserWarning, match="Only one segment is calculated"):
+ mlab.specgram(x=self.y, NFFT=len(self.y), Fs=self.Fs)
+
+ def test_psd_csd_equal(self):
+ Pxx, freqsxx = mlab.psd(x=self.y,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=self.nover_density,
+ pad_to=self.pad_to_density,
+ sides=self.sides)
+ Pxy, freqsxy = mlab.csd(x=self.y, y=self.y,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=self.nover_density,
+ pad_to=self.pad_to_density,
+ sides=self.sides)
+ assert_array_almost_equal_nulp(Pxx, Pxy)
+ assert_array_equal(freqsxx, freqsxy)
+
+ @pytest.mark.parametrize("mode", ["default", "psd"])
+ def test_specgram_auto_default_psd_equal(self, mode):
+ """
+ Test that mlab.specgram without mode and with mode 'default' and 'psd'
+ are all the same.
+ """
+ speca, freqspeca, ta = mlab.specgram(x=self.y,
+ NFFT=self.NFFT_specgram,
+ Fs=self.Fs,
+ noverlap=self.nover_specgram,
+ pad_to=self.pad_to_specgram,
+ sides=self.sides)
+ specb, freqspecb, tb = mlab.specgram(x=self.y,
+ NFFT=self.NFFT_specgram,
+ Fs=self.Fs,
+ noverlap=self.nover_specgram,
+ pad_to=self.pad_to_specgram,
+ sides=self.sides,
+ mode=mode)
+ assert_array_equal(speca, specb)
+ assert_array_equal(freqspeca, freqspecb)
+ assert_array_equal(ta, tb)
+
+ @pytest.mark.parametrize(
+ "mode, conv", [
+ ("magnitude", np.abs),
+ ("angle", np.angle),
+ ("phase", lambda x: np.unwrap(np.angle(x), axis=0))
+ ])
+ def test_specgram_complex_equivalent(self, mode, conv):
+ specc, freqspecc, tc = mlab.specgram(x=self.y,
+ NFFT=self.NFFT_specgram,
+ Fs=self.Fs,
+ noverlap=self.nover_specgram,
+ pad_to=self.pad_to_specgram,
+ sides=self.sides,
+ mode='complex')
+ specm, freqspecm, tm = mlab.specgram(x=self.y,
+ NFFT=self.NFFT_specgram,
+ Fs=self.Fs,
+ noverlap=self.nover_specgram,
+ pad_to=self.pad_to_specgram,
+ sides=self.sides,
+ mode=mode)
+
+ assert_array_equal(freqspecc, freqspecm)
+ assert_array_equal(tc, tm)
+ assert_allclose(conv(specc), specm, atol=1e-06)
+
+ def test_psd_windowarray_equal(self):
+ win = mlab.window_hanning(np.ones(self.NFFT_density_real))
+ speca, fspa = mlab.psd(x=self.y,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=self.nover_density,
+ pad_to=self.pad_to_density,
+ sides=self.sides,
+ window=win)
+ specb, fspb = mlab.psd(x=self.y,
+ NFFT=self.NFFT_density,
+ Fs=self.Fs,
+ noverlap=self.nover_density,
+ pad_to=self.pad_to_density,
+ sides=self.sides)
+ assert_array_equal(fspa, fspb)
+ assert_allclose(speca, specb, atol=1e-08)
+
+
+# extra test for cohere...
+def test_cohere():
+ N = 1024
+ np.random.seed(19680801)
+ x = np.random.randn(N)
+ # phase offset
+ y = np.roll(x, 20)
+ # high-freq roll-off
+ y = np.convolve(y, np.ones(20) / 20., mode='same')
+ cohsq, f = mlab.cohere(x, y, NFFT=256, Fs=2, noverlap=128)
+ assert_allclose(np.mean(cohsq), 0.837, atol=1.e-3)
+ assert np.isreal(np.mean(cohsq))
+
+
+#*****************************************************************
+# These Tests where taken from SCIPY with some minor modifications
+# this can be retrieved from:
+# https://github.com/scipy/scipy/blob/master/scipy/stats/tests/test_kdeoth.py
+#*****************************************************************
+
+class TestGaussianKDE:
+
+ def test_kde_integer_input(self):
+ """Regression test for #1181."""
+ x1 = np.arange(5)
+ kde = mlab.GaussianKDE(x1)
+ y_expected = [0.13480721, 0.18222869, 0.19514935, 0.18222869,
+ 0.13480721]
+ np.testing.assert_array_almost_equal(kde(x1), y_expected, decimal=6)
+
+ def test_gaussian_kde_covariance_caching(self):
+ x1 = np.array([-7, -5, 1, 4, 5], dtype=float)
+ xs = np.linspace(-10, 10, num=5)
+ # These expected values are from scipy 0.10, before some changes to
+ # gaussian_kde. They were not compared with any external reference.
+ y_expected = [0.02463386, 0.04689208, 0.05395444, 0.05337754,
+ 0.01664475]
+
+ # set it to the default bandwidth.
+ kde2 = mlab.GaussianKDE(x1, 'scott')
+ y2 = kde2(xs)
+
+ np.testing.assert_array_almost_equal(y_expected, y2, decimal=7)
+
+ def test_kde_bandwidth_method(self):
+
+ np.random.seed(8765678)
+ n_basesample = 50
+ xn = np.random.randn(n_basesample)
+
+ # Default
+ gkde = mlab.GaussianKDE(xn)
+ # Supply a callable
+ gkde2 = mlab.GaussianKDE(xn, 'scott')
+ # Supply a scalar
+ gkde3 = mlab.GaussianKDE(xn, bw_method=gkde.factor)
+
+ xs = np.linspace(-7, 7, 51)
+ kdepdf = gkde.evaluate(xs)
+ kdepdf2 = gkde2.evaluate(xs)
+ assert kdepdf.all() == kdepdf2.all()
+ kdepdf3 = gkde3.evaluate(xs)
+ assert kdepdf.all() == kdepdf3.all()
+
+
+class TestGaussianKDECustom:
+ def test_no_data(self):
+ """Pass no data into the GaussianKDE class."""
+ with pytest.raises(ValueError):
+ mlab.GaussianKDE([])
+
+ def test_single_dataset_element(self):
+ """Pass a single dataset element into the GaussianKDE class."""
+ with pytest.raises(ValueError):
+ mlab.GaussianKDE([42])
+
+ def test_silverman_multidim_dataset(self):
+ """Test silverman's for a multi-dimensional array."""
+ x1 = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
+ with pytest.raises(np.linalg.LinAlgError):
+ mlab.GaussianKDE(x1, "silverman")
+
+ def test_silverman_singledim_dataset(self):
+ """Test silverman's output for a single dimension list."""
+ x1 = np.array([-7, -5, 1, 4, 5])
+ mygauss = mlab.GaussianKDE(x1, "silverman")
+ y_expected = 0.76770389927475502
+ assert_almost_equal(mygauss.covariance_factor(), y_expected, 7)
+
+ def test_scott_multidim_dataset(self):
+ """Test scott's output for a multi-dimensional array."""
+ x1 = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
+ with pytest.raises(np.linalg.LinAlgError):
+ mlab.GaussianKDE(x1, "scott")
+
+ def test_scott_singledim_dataset(self):
+ """Test scott's output a single-dimensional array."""
+ x1 = np.array([-7, -5, 1, 4, 5])
+ mygauss = mlab.GaussianKDE(x1, "scott")
+ y_expected = 0.72477966367769553
+ assert_almost_equal(mygauss.covariance_factor(), y_expected, 7)
+
+ def test_scalar_empty_dataset(self):
+ """Test the scalar's cov factor for an empty array."""
+ with pytest.raises(ValueError):
+ mlab.GaussianKDE([], bw_method=5)
+
+ def test_scalar_covariance_dataset(self):
+ """Test a scalar's cov factor."""
+ np.random.seed(8765678)
+ n_basesample = 50
+ multidim_data = [np.random.randn(n_basesample) for i in range(5)]
+
+ kde = mlab.GaussianKDE(multidim_data, bw_method=0.5)
+ assert kde.covariance_factor() == 0.5
+
+ def test_callable_covariance_dataset(self):
+ """Test the callable's cov factor for a multi-dimensional array."""
+ np.random.seed(8765678)
+ n_basesample = 50
+ multidim_data = [np.random.randn(n_basesample) for i in range(5)]
+
+ def callable_fun(x):
+ return 0.55
+ kde = mlab.GaussianKDE(multidim_data, bw_method=callable_fun)
+ assert kde.covariance_factor() == 0.55
+
+ def test_callable_singledim_dataset(self):
+ """Test the callable's cov factor for a single-dimensional array."""
+ np.random.seed(8765678)
+ n_basesample = 50
+ multidim_data = np.random.randn(n_basesample)
+
+ kde = mlab.GaussianKDE(multidim_data, bw_method='silverman')
+ y_expected = 0.48438841363348911
+ assert_almost_equal(kde.covariance_factor(), y_expected, 7)
+
+ def test_wrong_bw_method(self):
+ """Test the error message that should be called when bw is invalid."""
+ np.random.seed(8765678)
+ n_basesample = 50
+ data = np.random.randn(n_basesample)
+ with pytest.raises(ValueError):
+ mlab.GaussianKDE(data, bw_method="invalid")
+
+
+class TestGaussianKDEEvaluate:
+
+ def test_evaluate_diff_dim(self):
+ """
+ Test the evaluate method when the dim's of dataset and points have
+ different dimensions.
+ """
+ x1 = np.arange(3, 10, 2)
+ kde = mlab.GaussianKDE(x1)
+ x2 = np.arange(3, 12, 2)
+ y_expected = [
+ 0.08797252, 0.11774109, 0.11774109, 0.08797252, 0.0370153
+ ]
+ y = kde.evaluate(x2)
+ np.testing.assert_array_almost_equal(y, y_expected, 7)
+
+ def test_evaluate_inv_dim(self):
+ """
+ Invert the dimensions; i.e., for a dataset of dimension 1 [3, 2, 4],
+ the points should have a dimension of 3 [[3], [2], [4]].
+ """
+ np.random.seed(8765678)
+ n_basesample = 50
+ multidim_data = np.random.randn(n_basesample)
+ kde = mlab.GaussianKDE(multidim_data)
+ x2 = [[1], [2], [3]]
+ with pytest.raises(ValueError):
+ kde.evaluate(x2)
+
+ def test_evaluate_dim_and_num(self):
+ """Tests if evaluated against a one by one array"""
+ x1 = np.arange(3, 10, 2)
+ x2 = np.array([3])
+ kde = mlab.GaussianKDE(x1)
+ y_expected = [0.08797252]
+ y = kde.evaluate(x2)
+ np.testing.assert_array_almost_equal(y, y_expected, 7)
+
+ def test_evaluate_point_dim_not_one(self):
+ x1 = np.arange(3, 10, 2)
+ x2 = [np.arange(3, 10, 2), np.arange(3, 10, 2)]
+ kde = mlab.GaussianKDE(x1)
+ with pytest.raises(ValueError):
+ kde.evaluate(x2)
+
+ def test_evaluate_equal_dim_and_num_lt(self):
+ x1 = np.arange(3, 10, 2)
+ x2 = np.arange(3, 8, 2)
+ kde = mlab.GaussianKDE(x1)
+ y_expected = [0.08797252, 0.11774109, 0.11774109]
+ y = kde.evaluate(x2)
+ np.testing.assert_array_almost_equal(y, y_expected, 7)
+
+
+def test_psd_onesided_norm():
+ u = np.array([0, 1, 2, 3, 1, 2, 1])
+ dt = 1.0
+ Su = np.abs(np.fft.fft(u) * dt)**2 / (dt * u.size)
+ P, f = mlab.psd(u, NFFT=u.size, Fs=1/dt, window=mlab.window_none,
+ detrend=mlab.detrend_none, noverlap=0, pad_to=None,
+ scale_by_freq=None,
+ sides='onesided')
+ Su_1side = np.append([Su[0]], Su[1:4] + Su[4:][::-1])
+ assert_allclose(P, Su_1side, atol=1e-06)
+
+
+def test_psd_oversampling():
+ """Test the case len(x) < NFFT for psd()."""
+ u = np.array([0, 1, 2, 3, 1, 2, 1])
+ dt = 1.0
+ Su = np.abs(np.fft.fft(u) * dt)**2 / (dt * u.size)
+ P, f = mlab.psd(u, NFFT=u.size*2, Fs=1/dt, window=mlab.window_none,
+ detrend=mlab.detrend_none, noverlap=0, pad_to=None,
+ scale_by_freq=None,
+ sides='onesided')
+ Su_1side = np.append([Su[0]], Su[1:4] + Su[4:][::-1])
+ assert_almost_equal(np.sum(P), np.sum(Su_1side)) # same energy
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_offsetbox.py b/venv/Lib/site-packages/matplotlib/tests/test_offsetbox.py
new file mode 100644
index 0000000..72fdbdb
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_offsetbox.py
@@ -0,0 +1,323 @@
+from collections import namedtuple
+import io
+
+import numpy as np
+from numpy.testing import assert_allclose
+import pytest
+
+from matplotlib.testing.decorators import image_comparison
+import matplotlib.pyplot as plt
+import matplotlib.patches as mpatches
+import matplotlib.lines as mlines
+from matplotlib.backend_bases import MouseButton
+
+from matplotlib.offsetbox import (
+ AnchoredOffsetbox, AnnotationBbox, AnchoredText, DrawingArea,
+ OffsetImage, TextArea, _get_packed_offsets)
+
+
+@image_comparison(['offsetbox_clipping'], remove_text=True)
+def test_offsetbox_clipping():
+ # - create a plot
+ # - put an AnchoredOffsetbox with a child DrawingArea
+ # at the center of the axes
+ # - give the DrawingArea a gray background
+ # - put a black line across the bounds of the DrawingArea
+ # - see that the black line is clipped to the edges of
+ # the DrawingArea.
+ fig, ax = plt.subplots()
+ size = 100
+ da = DrawingArea(size, size, clip=True)
+ bg = mpatches.Rectangle((0, 0), size, size,
+ facecolor='#CCCCCC',
+ edgecolor='None',
+ linewidth=0)
+ line = mlines.Line2D([-size*.5, size*1.5], [size/2, size/2],
+ color='black',
+ linewidth=10)
+ anchored_box = AnchoredOffsetbox(
+ loc='center',
+ child=da,
+ pad=0.,
+ frameon=False,
+ bbox_to_anchor=(.5, .5),
+ bbox_transform=ax.transAxes,
+ borderpad=0.)
+
+ da.add_artist(bg)
+ da.add_artist(line)
+ ax.add_artist(anchored_box)
+ ax.set_xlim((0, 1))
+ ax.set_ylim((0, 1))
+
+
+def test_offsetbox_clip_children():
+ # - create a plot
+ # - put an AnchoredOffsetbox with a child DrawingArea
+ # at the center of the axes
+ # - give the DrawingArea a gray background
+ # - put a black line across the bounds of the DrawingArea
+ # - see that the black line is clipped to the edges of
+ # the DrawingArea.
+ fig, ax = plt.subplots()
+ size = 100
+ da = DrawingArea(size, size, clip=True)
+ bg = mpatches.Rectangle((0, 0), size, size,
+ facecolor='#CCCCCC',
+ edgecolor='None',
+ linewidth=0)
+ line = mlines.Line2D([-size*.5, size*1.5], [size/2, size/2],
+ color='black',
+ linewidth=10)
+ anchored_box = AnchoredOffsetbox(
+ loc='center',
+ child=da,
+ pad=0.,
+ frameon=False,
+ bbox_to_anchor=(.5, .5),
+ bbox_transform=ax.transAxes,
+ borderpad=0.)
+
+ da.add_artist(bg)
+ da.add_artist(line)
+ ax.add_artist(anchored_box)
+
+ fig.canvas.draw()
+ assert not fig.stale
+ da.clip_children = True
+ assert fig.stale
+
+
+def test_offsetbox_loc_codes():
+ # Check that valid string location codes all work with an AnchoredOffsetbox
+ codes = {'upper right': 1,
+ 'upper left': 2,
+ 'lower left': 3,
+ 'lower right': 4,
+ 'right': 5,
+ 'center left': 6,
+ 'center right': 7,
+ 'lower center': 8,
+ 'upper center': 9,
+ 'center': 10,
+ }
+ fig, ax = plt.subplots()
+ da = DrawingArea(100, 100)
+ for code in codes:
+ anchored_box = AnchoredOffsetbox(loc=code, child=da)
+ ax.add_artist(anchored_box)
+ fig.canvas.draw()
+
+
+def test_expand_with_tight_layout():
+ # Check issue reported in #10476, and updated due to #10784
+ fig, ax = plt.subplots()
+
+ d1 = [1, 2]
+ d2 = [2, 1]
+ ax.plot(d1, label='series 1')
+ ax.plot(d2, label='series 2')
+ ax.legend(ncol=2, mode='expand')
+
+ fig.tight_layout() # where the crash used to happen
+
+
+@pytest.mark.parametrize('wd_list',
+ ([(150, 1)], [(150, 1)]*3, [(0.1, 1)], [(0.1, 1)]*2))
+@pytest.mark.parametrize('total', (250, 100, 0, -1, None))
+@pytest.mark.parametrize('sep', (250, 1, 0, -1))
+@pytest.mark.parametrize('mode', ("expand", "fixed", "equal"))
+def test_get_packed_offsets(wd_list, total, sep, mode):
+ # Check a (rather arbitrary) set of parameters due to successive similar
+ # issue tickets (at least #10476 and #10784) related to corner cases
+ # triggered inside this function when calling higher-level functions
+ # (e.g. `Axes.legend`).
+ # These are just some additional smoke tests. The output is untested.
+ _get_packed_offsets(wd_list, total, sep, mode=mode)
+
+
+_Params = namedtuple('_params', 'wd_list, total, sep, expected')
+
+
+@pytest.mark.parametrize('wd_list, total, sep, expected', [
+ _Params( # total=None
+ [(3, 0), (1, 0), (2, 0)], total=None, sep=1, expected=(8, [0, 4, 6])),
+ _Params( # total larger than required
+ [(3, 0), (1, 0), (2, 0)], total=10, sep=1, expected=(10, [0, 4, 6])),
+ _Params( # total smaller than required
+ [(3, 0), (1, 0), (2, 0)], total=5, sep=1, expected=(5, [0, 4, 6])),
+])
+def test_get_packed_offsets_fixed(wd_list, total, sep, expected):
+ result = _get_packed_offsets(wd_list, total, sep, mode='fixed')
+ assert result[0] == expected[0]
+ assert_allclose(result[1], expected[1])
+
+
+@pytest.mark.parametrize('wd_list, total, sep, expected', [
+ _Params( # total=None (implicit 1)
+ [(.1, 0)] * 3, total=None, sep=None, expected=(1, [0, .45, .9])),
+ _Params( # total larger than sum of widths
+ [(3, 0), (1, 0), (2, 0)], total=10, sep=1, expected=(10, [0, 5, 8])),
+ _Params( # total smaller sum of widths: overlapping boxes
+ [(3, 0), (1, 0), (2, 0)], total=5, sep=1, expected=(5, [0, 2.5, 3])),
+])
+def test_get_packed_offsets_expand(wd_list, total, sep, expected):
+ result = _get_packed_offsets(wd_list, total, sep, mode='expand')
+ assert result[0] == expected[0]
+ assert_allclose(result[1], expected[1])
+
+
+@pytest.mark.parametrize('wd_list, total, sep, expected', [
+ _Params( # total larger than required
+ [(3, 0), (2, 0), (1, 0)], total=6, sep=None, expected=(6, [0, 2, 4])),
+ _Params( # total smaller sum of widths: overlapping boxes
+ [(3, 0), (2, 0), (1, 0), (.5, 0)], total=2, sep=None,
+ expected=(2, [0, 0.5, 1, 1.5])),
+ _Params( # total larger than required
+ [(.5, 0), (1, 0), (.2, 0)], total=None, sep=1,
+ expected=(6, [0, 2, 4])),
+ # the case total=None, sep=None is tested separately below
+])
+def test_get_packed_offsets_equal(wd_list, total, sep, expected):
+ result = _get_packed_offsets(wd_list, total, sep, mode='equal')
+ assert result[0] == expected[0]
+ assert_allclose(result[1], expected[1])
+
+
+def test_get_packed_offsets_equal_total_none_sep_none():
+ with pytest.raises(ValueError):
+ _get_packed_offsets([(1, 0)] * 3, total=None, sep=None, mode='equal')
+
+
+@pytest.mark.parametrize('child_type', ['draw', 'image', 'text'])
+@pytest.mark.parametrize('boxcoords',
+ ['axes fraction', 'axes pixels', 'axes points',
+ 'data'])
+def test_picking(child_type, boxcoords):
+ # These all take up approximately the same area.
+ if child_type == 'draw':
+ picking_child = DrawingArea(5, 5)
+ picking_child.add_artist(mpatches.Rectangle((0, 0), 5, 5, linewidth=0))
+ elif child_type == 'image':
+ im = np.ones((5, 5))
+ im[2, 2] = 0
+ picking_child = OffsetImage(im)
+ elif child_type == 'text':
+ picking_child = TextArea('\N{Black Square}', textprops={'fontsize': 5})
+ else:
+ assert False, f'Unknown picking child type {child_type}'
+
+ fig, ax = plt.subplots()
+ ab = AnnotationBbox(picking_child, (0.5, 0.5), boxcoords=boxcoords)
+ ab.set_picker(True)
+ ax.add_artist(ab)
+
+ calls = []
+ fig.canvas.mpl_connect('pick_event', lambda event: calls.append(event))
+
+ # Annotation should be picked by an event occurring at its center.
+ if boxcoords == 'axes points':
+ x, y = ax.transAxes.transform_point((0, 0))
+ x += 0.5 * fig.dpi / 72
+ y += 0.5 * fig.dpi / 72
+ elif boxcoords == 'axes pixels':
+ x, y = ax.transAxes.transform_point((0, 0))
+ x += 0.5
+ y += 0.5
+ else:
+ x, y = ax.transAxes.transform_point((0.5, 0.5))
+ fig.canvas.draw()
+ calls.clear()
+ fig.canvas.button_press_event(x, y, MouseButton.LEFT)
+ assert len(calls) == 1 and calls[0].artist == ab
+
+ # Annotation should *not* be picked by an event at its original center
+ # point when the limits have changed enough to hide the *xy* point.
+ ax.set_xlim(-1, 0)
+ ax.set_ylim(-1, 0)
+ fig.canvas.draw()
+ calls.clear()
+ fig.canvas.button_press_event(x, y, MouseButton.LEFT)
+ assert len(calls) == 0
+
+
+@image_comparison(['anchoredtext_align.png'], remove_text=True, style='mpl20')
+def test_anchoredtext_horizontal_alignment():
+ fig, ax = plt.subplots()
+
+ text0 = AnchoredText("test\ntest long text", loc="center left",
+ pad=0.2, prop={"ha": "left"})
+ ax.add_artist(text0)
+ text1 = AnchoredText("test\ntest long text", loc="center",
+ pad=0.2, prop={"ha": "center"})
+ ax.add_artist(text1)
+ text2 = AnchoredText("test\ntest long text", loc="center right",
+ pad=0.2, prop={"ha": "right"})
+ ax.add_artist(text2)
+
+
+def test_annotationbbox_extents():
+ plt.rcParams.update(plt.rcParamsDefault)
+ fig, ax = plt.subplots(figsize=(4, 3), dpi=100)
+
+ ax.axis([0, 1, 0, 1])
+
+ an1 = ax.annotate("Annotation", xy=(.9, .9), xytext=(1.1, 1.1),
+ arrowprops=dict(arrowstyle="->"), clip_on=False,
+ va="baseline", ha="left")
+
+ da = DrawingArea(20, 20, 0, 0, clip=True)
+ p = mpatches.Circle((-10, 30), 32)
+ da.add_artist(p)
+
+ ab3 = AnnotationBbox(da, [.5, .5], xybox=(-0.2, 0.5), xycoords='data',
+ boxcoords="axes fraction", box_alignment=(0., .5),
+ arrowprops=dict(arrowstyle="->"))
+ ax.add_artist(ab3)
+
+ im = OffsetImage(np.random.rand(10, 10), zoom=3)
+ im.image.axes = ax
+ ab6 = AnnotationBbox(im, (0.5, -.3), xybox=(0, 75),
+ xycoords='axes fraction',
+ boxcoords="offset points", pad=0.3,
+ arrowprops=dict(arrowstyle="->"))
+ ax.add_artist(ab6)
+
+ fig.canvas.draw()
+ renderer = fig.canvas.get_renderer()
+
+ # Test Annotation
+ bb1w = an1.get_window_extent(renderer)
+ bb1e = an1.get_tightbbox(renderer)
+
+ target1 = [332.9, 242.8, 467.0, 298.9]
+ assert_allclose(bb1w.extents, target1, atol=2)
+ assert_allclose(bb1e.extents, target1, atol=2)
+
+ # Test AnnotationBbox
+ bb3w = ab3.get_window_extent(renderer)
+ bb3e = ab3.get_tightbbox(renderer)
+
+ target3 = [-17.6, 129.0, 200.7, 167.9]
+ assert_allclose(bb3w.extents, target3, atol=2)
+ assert_allclose(bb3e.extents, target3, atol=2)
+
+ bb6w = ab6.get_window_extent(renderer)
+ bb6e = ab6.get_tightbbox(renderer)
+
+ target6 = [180.0, -32.0, 230.0, 92.9]
+ assert_allclose(bb6w.extents, target6, atol=2)
+ assert_allclose(bb6e.extents, target6, atol=2)
+
+ # Test bbox_inches='tight'
+ buf = io.BytesIO()
+ fig.savefig(buf, bbox_inches='tight')
+ buf.seek(0)
+ shape = plt.imread(buf).shape
+ targetshape = (350, 504, 4)
+ assert_allclose(shape, targetshape, atol=2)
+
+ # Simple smoke test for tight_layout, to make sure it does not error out.
+ fig.canvas.draw()
+ fig.tight_layout()
+ fig.canvas.draw()
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_patches.py b/venv/Lib/site-packages/matplotlib/tests/test_patches.py
new file mode 100644
index 0000000..2a90809
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_patches.py
@@ -0,0 +1,628 @@
+"""
+Tests specific to the patches module.
+"""
+import numpy as np
+from numpy.testing import assert_almost_equal, assert_array_equal
+import pytest
+
+from matplotlib.patches import Patch, Polygon, Rectangle, FancyArrowPatch
+from matplotlib.testing.decorators import image_comparison, check_figures_equal
+from matplotlib.transforms import Bbox
+import matplotlib.pyplot as plt
+from matplotlib import (
+ collections as mcollections, colors as mcolors, patches as mpatches,
+ path as mpath, style as mstyle, transforms as mtransforms, rcParams)
+
+import sys
+on_win = (sys.platform == 'win32')
+
+
+def test_Polygon_close():
+ #: GitHub issue #1018 identified a bug in the Polygon handling
+ #: of the closed attribute; the path was not getting closed
+ #: when set_xy was used to set the vertices.
+
+ # open set of vertices:
+ xy = [[0, 0], [0, 1], [1, 1]]
+ # closed set:
+ xyclosed = xy + [[0, 0]]
+
+ # start with open path and close it:
+ p = Polygon(xy, closed=True)
+ assert_array_equal(p.get_xy(), xyclosed)
+ p.set_xy(xy)
+ assert_array_equal(p.get_xy(), xyclosed)
+
+ # start with closed path and open it:
+ p = Polygon(xyclosed, closed=False)
+ assert_array_equal(p.get_xy(), xy)
+ p.set_xy(xyclosed)
+ assert_array_equal(p.get_xy(), xy)
+
+ # start with open path and leave it open:
+ p = Polygon(xy, closed=False)
+ assert_array_equal(p.get_xy(), xy)
+ p.set_xy(xy)
+ assert_array_equal(p.get_xy(), xy)
+
+ # start with closed path and leave it closed:
+ p = Polygon(xyclosed, closed=True)
+ assert_array_equal(p.get_xy(), xyclosed)
+ p.set_xy(xyclosed)
+ assert_array_equal(p.get_xy(), xyclosed)
+
+
+def test_rotate_rect():
+ loc = np.asarray([1.0, 2.0])
+ width = 2
+ height = 3
+ angle = 30.0
+
+ # A rotated rectangle
+ rect1 = Rectangle(loc, width, height, angle=angle)
+
+ # A non-rotated rectangle
+ rect2 = Rectangle(loc, width, height)
+
+ # Set up an explicit rotation matrix (in radians)
+ angle_rad = np.pi * angle / 180.0
+ rotation_matrix = np.array([[np.cos(angle_rad), -np.sin(angle_rad)],
+ [np.sin(angle_rad), np.cos(angle_rad)]])
+
+ # Translate to origin, rotate each vertex, and then translate back
+ new_verts = np.inner(rotation_matrix, rect2.get_verts() - loc).T + loc
+
+ # They should be the same
+ assert_almost_equal(rect1.get_verts(), new_verts)
+
+
+def test_negative_rect():
+ # These two rectangles have the same vertices, but starting from a
+ # different point. (We also drop the last vertex, which is a duplicate.)
+ pos_vertices = Rectangle((-3, -2), 3, 2).get_verts()[:-1]
+ neg_vertices = Rectangle((0, 0), -3, -2).get_verts()[:-1]
+ assert_array_equal(np.roll(neg_vertices, 2, 0), pos_vertices)
+
+
+@image_comparison(['clip_to_bbox'])
+def test_clip_to_bbox():
+ fig, ax = plt.subplots()
+ ax.set_xlim([-18, 20])
+ ax.set_ylim([-150, 100])
+
+ path = mpath.Path.unit_regular_star(8).deepcopy()
+ path.vertices *= [10, 100]
+ path.vertices -= [5, 25]
+
+ path2 = mpath.Path.unit_circle().deepcopy()
+ path2.vertices *= [10, 100]
+ path2.vertices += [10, -25]
+
+ combined = mpath.Path.make_compound_path(path, path2)
+
+ patch = mpatches.PathPatch(
+ combined, alpha=0.5, facecolor='coral', edgecolor='none')
+ ax.add_patch(patch)
+
+ bbox = mtransforms.Bbox([[-12, -77.5], [50, -110]])
+ result_path = combined.clip_to_bbox(bbox)
+ result_patch = mpatches.PathPatch(
+ result_path, alpha=0.5, facecolor='green', lw=4, edgecolor='black')
+
+ ax.add_patch(result_patch)
+
+
+@image_comparison(['patch_alpha_coloring'], remove_text=True)
+def test_patch_alpha_coloring():
+ """
+ Test checks that the patch and collection are rendered with the specified
+ alpha values in their facecolor and edgecolor.
+ """
+ star = mpath.Path.unit_regular_star(6)
+ circle = mpath.Path.unit_circle()
+ # concatenate the star with an internal cutout of the circle
+ verts = np.concatenate([circle.vertices, star.vertices[::-1]])
+ codes = np.concatenate([circle.codes, star.codes])
+ cut_star1 = mpath.Path(verts, codes)
+ cut_star2 = mpath.Path(verts + 1, codes)
+
+ ax = plt.axes()
+ patch = mpatches.PathPatch(cut_star1,
+ linewidth=5, linestyle='dashdot',
+ facecolor=(1, 0, 0, 0.5),
+ edgecolor=(0, 0, 1, 0.75))
+ ax.add_patch(patch)
+
+ col = mcollections.PathCollection([cut_star2],
+ linewidth=5, linestyles='dashdot',
+ facecolor=(1, 0, 0, 0.5),
+ edgecolor=(0, 0, 1, 0.75))
+ ax.add_collection(col)
+
+ ax.set_xlim([-1, 2])
+ ax.set_ylim([-1, 2])
+
+
+@image_comparison(['patch_alpha_override'], remove_text=True)
+def test_patch_alpha_override():
+ #: Test checks that specifying an alpha attribute for a patch or
+ #: collection will override any alpha component of the facecolor
+ #: or edgecolor.
+ star = mpath.Path.unit_regular_star(6)
+ circle = mpath.Path.unit_circle()
+ # concatenate the star with an internal cutout of the circle
+ verts = np.concatenate([circle.vertices, star.vertices[::-1]])
+ codes = np.concatenate([circle.codes, star.codes])
+ cut_star1 = mpath.Path(verts, codes)
+ cut_star2 = mpath.Path(verts + 1, codes)
+
+ ax = plt.axes()
+ patch = mpatches.PathPatch(cut_star1,
+ linewidth=5, linestyle='dashdot',
+ alpha=0.25,
+ facecolor=(1, 0, 0, 0.5),
+ edgecolor=(0, 0, 1, 0.75))
+ ax.add_patch(patch)
+
+ col = mcollections.PathCollection([cut_star2],
+ linewidth=5, linestyles='dashdot',
+ alpha=0.25,
+ facecolor=(1, 0, 0, 0.5),
+ edgecolor=(0, 0, 1, 0.75))
+ ax.add_collection(col)
+
+ ax.set_xlim([-1, 2])
+ ax.set_ylim([-1, 2])
+
+
+@pytest.mark.style('default')
+def test_patch_color_none():
+ # Make sure the alpha kwarg does not override 'none' facecolor.
+ # Addresses issue #7478.
+ c = plt.Circle((0, 0), 1, facecolor='none', alpha=1)
+ assert c.get_facecolor()[0] == 0
+
+
+@image_comparison(['patch_custom_linestyle'], remove_text=True)
+def test_patch_custom_linestyle():
+ #: A test to check that patches and collections accept custom dash
+ #: patterns as linestyle and that they display correctly.
+ star = mpath.Path.unit_regular_star(6)
+ circle = mpath.Path.unit_circle()
+ # concatenate the star with an internal cutout of the circle
+ verts = np.concatenate([circle.vertices, star.vertices[::-1]])
+ codes = np.concatenate([circle.codes, star.codes])
+ cut_star1 = mpath.Path(verts, codes)
+ cut_star2 = mpath.Path(verts + 1, codes)
+
+ ax = plt.axes()
+ patch = mpatches.PathPatch(
+ cut_star1,
+ linewidth=5, linestyle=(0, (5, 7, 10, 7)),
+ facecolor=(1, 0, 0), edgecolor=(0, 0, 1))
+ ax.add_patch(patch)
+
+ col = mcollections.PathCollection(
+ [cut_star2],
+ linewidth=5, linestyles=[(0, (5, 7, 10, 7))],
+ facecolor=(1, 0, 0), edgecolor=(0, 0, 1))
+ ax.add_collection(col)
+
+ ax.set_xlim([-1, 2])
+ ax.set_ylim([-1, 2])
+
+
+def test_patch_linestyle_accents():
+ #: Test if linestyle can also be specified with short mnemonics like "--"
+ #: c.f. GitHub issue #2136
+ star = mpath.Path.unit_regular_star(6)
+ circle = mpath.Path.unit_circle()
+ # concatenate the star with an internal cutout of the circle
+ verts = np.concatenate([circle.vertices, star.vertices[::-1]])
+ codes = np.concatenate([circle.codes, star.codes])
+
+ linestyles = ["-", "--", "-.", ":",
+ "solid", "dashed", "dashdot", "dotted"]
+
+ fig, ax = plt.subplots()
+ for i, ls in enumerate(linestyles):
+ star = mpath.Path(verts + i, codes)
+ patch = mpatches.PathPatch(star,
+ linewidth=3, linestyle=ls,
+ facecolor=(1, 0, 0),
+ edgecolor=(0, 0, 1))
+ ax.add_patch(patch)
+
+ ax.set_xlim([-1, i + 1])
+ ax.set_ylim([-1, i + 1])
+ fig.canvas.draw()
+
+
+@check_figures_equal(extensions=['png'])
+def test_patch_linestyle_none(fig_test, fig_ref):
+ circle = mpath.Path.unit_circle()
+
+ ax_test = fig_test.add_subplot()
+ ax_ref = fig_ref.add_subplot()
+ for i, ls in enumerate(['none', 'None', ' ', '']):
+ path = mpath.Path(circle.vertices + i, circle.codes)
+ patch = mpatches.PathPatch(path,
+ linewidth=3, linestyle=ls,
+ facecolor=(1, 0, 0),
+ edgecolor=(0, 0, 1))
+ ax_test.add_patch(patch)
+
+ patch = mpatches.PathPatch(path,
+ linewidth=3, linestyle='-',
+ facecolor=(1, 0, 0),
+ edgecolor='none')
+ ax_ref.add_patch(patch)
+
+ ax_test.set_xlim([-1, i + 1])
+ ax_test.set_ylim([-1, i + 1])
+ ax_ref.set_xlim([-1, i + 1])
+ ax_ref.set_ylim([-1, i + 1])
+
+
+def test_wedge_movement():
+ param_dict = {'center': ((0, 0), (1, 1), 'set_center'),
+ 'r': (5, 8, 'set_radius'),
+ 'width': (2, 3, 'set_width'),
+ 'theta1': (0, 30, 'set_theta1'),
+ 'theta2': (45, 50, 'set_theta2')}
+
+ init_args = {k: v[0] for k, v in param_dict.items()}
+
+ w = mpatches.Wedge(**init_args)
+ for attr, (old_v, new_v, func) in param_dict.items():
+ assert getattr(w, attr) == old_v
+ getattr(w, func)(new_v)
+ assert getattr(w, attr) == new_v
+
+
+# png needs tol>=0.06, pdf tol>=1.617
+@image_comparison(['wedge_range'], remove_text=True, tol=1.65 if on_win else 0)
+def test_wedge_range():
+ ax = plt.axes()
+
+ t1 = 2.313869244286224
+
+ args = [[52.31386924, 232.31386924],
+ [52.313869244286224, 232.31386924428622],
+ [t1, t1 + 180.0],
+ [0, 360],
+ [90, 90 + 360],
+ [-180, 180],
+ [0, 380],
+ [45, 46],
+ [46, 45]]
+
+ for i, (theta1, theta2) in enumerate(args):
+ x = i % 3
+ y = i // 3
+
+ wedge = mpatches.Wedge((x * 3, y * 3), 1, theta1, theta2,
+ facecolor='none', edgecolor='k', lw=3)
+
+ ax.add_artist(wedge)
+
+ ax.set_xlim([-2, 8])
+ ax.set_ylim([-2, 9])
+
+
+def test_patch_str():
+ """
+ Check that patches have nice and working `str` representation.
+
+ Note that the logic is that `__str__` is defined such that:
+ str(eval(str(p))) == str(p)
+ """
+ p = mpatches.Circle(xy=(1, 2), radius=3)
+ assert str(p) == 'Circle(xy=(1, 2), radius=3)'
+
+ p = mpatches.Ellipse(xy=(1, 2), width=3, height=4, angle=5)
+ assert str(p) == 'Ellipse(xy=(1, 2), width=3, height=4, angle=5)'
+
+ p = mpatches.Rectangle(xy=(1, 2), width=3, height=4, angle=5)
+ assert str(p) == 'Rectangle(xy=(1, 2), width=3, height=4, angle=5)'
+
+ p = mpatches.Wedge(center=(1, 2), r=3, theta1=4, theta2=5, width=6)
+ assert str(p) == 'Wedge(center=(1, 2), r=3, theta1=4, theta2=5, width=6)'
+
+ p = mpatches.Arc(xy=(1, 2), width=3, height=4, angle=5, theta1=6, theta2=7)
+ expected = 'Arc(xy=(1, 2), width=3, height=4, angle=5, theta1=6, theta2=7)'
+ assert str(p) == expected
+
+ p = mpatches.RegularPolygon((1, 2), 20, radius=5)
+ assert str(p) == "RegularPolygon((1, 2), 20, radius=5, orientation=0)"
+
+ p = mpatches.CirclePolygon(xy=(1, 2), radius=5, resolution=20)
+ assert str(p) == "CirclePolygon((1, 2), radius=5, resolution=20)"
+
+ p = mpatches.FancyBboxPatch((1, 2), width=3, height=4)
+ assert str(p) == "FancyBboxPatch((1, 2), width=3, height=4)"
+
+ # Further nice __str__ which cannot be `eval`uated:
+ path = mpath.Path([(1, 2), (2, 2), (1, 2)], closed=True)
+ p = mpatches.PathPatch(path)
+ assert str(p) == "PathPatch3((1, 2) ...)"
+
+ data = [[1, 2], [2, 2], [1, 2]]
+ p = mpatches.Polygon(data)
+ assert str(p) == "Polygon3((1, 2) ...)"
+
+ p = mpatches.FancyArrowPatch(path=path)
+ assert str(p)[:27] == "FancyArrowPatch(Path(array("
+
+ p = mpatches.FancyArrowPatch((1, 2), (3, 4))
+ assert str(p) == "FancyArrowPatch((1, 2)->(3, 4))"
+
+ p = mpatches.ConnectionPatch((1, 2), (3, 4), 'data')
+ assert str(p) == "ConnectionPatch((1, 2), (3, 4))"
+
+ s = mpatches.Shadow(p, 1, 1)
+ assert str(s) == "Shadow(ConnectionPatch((1, 2), (3, 4)))"
+
+ # Not testing Arrow, FancyArrow here
+ # because they seem to exist only for historical reasons.
+
+
+@image_comparison(['multi_color_hatch'], remove_text=True, style='default')
+def test_multi_color_hatch():
+ fig, ax = plt.subplots()
+
+ rects = ax.bar(range(5), range(1, 6))
+ for i, rect in enumerate(rects):
+ rect.set_facecolor('none')
+ rect.set_edgecolor('C{}'.format(i))
+ rect.set_hatch('/')
+
+ ax.autoscale_view()
+ ax.autoscale(False)
+
+ for i in range(5):
+ with mstyle.context({'hatch.color': 'C{}'.format(i)}):
+ r = Rectangle((i - .8 / 2, 5), .8, 1, hatch='//', fc='none')
+ ax.add_patch(r)
+
+
+@image_comparison(['units_rectangle.png'])
+def test_units_rectangle():
+ import matplotlib.testing.jpl_units as U
+ U.register()
+
+ p = mpatches.Rectangle((5*U.km, 6*U.km), 1*U.km, 2*U.km)
+
+ fig, ax = plt.subplots()
+ ax.add_patch(p)
+ ax.set_xlim([4*U.km, 7*U.km])
+ ax.set_ylim([5*U.km, 9*U.km])
+
+
+@image_comparison(['connection_patch.png'], style='mpl20', remove_text=True)
+def test_connection_patch():
+ fig, (ax1, ax2) = plt.subplots(1, 2)
+
+ con = mpatches.ConnectionPatch(xyA=(0.1, 0.1), xyB=(0.9, 0.9),
+ coordsA='data', coordsB='data',
+ axesA=ax2, axesB=ax1,
+ arrowstyle="->")
+ ax2.add_artist(con)
+
+ xyA = (0.6, 1.0) # in axes coordinates
+ xyB = (0.0, 0.2) # x in axes coordinates, y in data coordinates
+ coordsA = "axes fraction"
+ coordsB = ax2.get_yaxis_transform()
+ con = mpatches.ConnectionPatch(xyA=xyA, xyB=xyB, coordsA=coordsA,
+ coordsB=coordsB, arrowstyle="-")
+ ax2.add_artist(con)
+
+
+@check_figures_equal(extensions=["png"])
+def test_connection_patch_fig(fig_test, fig_ref):
+ # Test that connection patch can be added as figure artist, and that figure
+ # pixels count negative values from the top right corner (this API may be
+ # changed in the future).
+ ax1, ax2 = fig_test.subplots(1, 2)
+ con = mpatches.ConnectionPatch(
+ xyA=(.3, .2), coordsA="data", axesA=ax1,
+ xyB=(-30, -20), coordsB="figure pixels",
+ arrowstyle="->", shrinkB=5)
+ fig_test.add_artist(con)
+
+ ax1, ax2 = fig_ref.subplots(1, 2)
+ bb = fig_ref.bbox
+ # Necessary so that pixel counts match on both sides.
+ plt.rcParams["savefig.dpi"] = plt.rcParams["figure.dpi"]
+ con = mpatches.ConnectionPatch(
+ xyA=(.3, .2), coordsA="data", axesA=ax1,
+ xyB=(bb.width - 30, bb.height - 20), coordsB="figure pixels",
+ arrowstyle="->", shrinkB=5)
+ fig_ref.add_artist(con)
+
+
+def test_datetime_rectangle():
+ # Check that creating a rectangle with timedeltas doesn't fail
+ from datetime import datetime, timedelta
+
+ start = datetime(2017, 1, 1, 0, 0, 0)
+ delta = timedelta(seconds=16)
+ patch = mpatches.Rectangle((start, 0), delta, 1)
+
+ fig, ax = plt.subplots()
+ ax.add_patch(patch)
+
+
+def test_datetime_datetime_fails():
+ from datetime import datetime
+
+ start = datetime(2017, 1, 1, 0, 0, 0)
+ dt_delta = datetime(1970, 1, 5) # Will be 5 days if units are done wrong
+
+ with pytest.raises(TypeError):
+ mpatches.Rectangle((start, 0), dt_delta, 1)
+
+ with pytest.raises(TypeError):
+ mpatches.Rectangle((0, start), 1, dt_delta)
+
+
+def test_contains_point():
+ ell = mpatches.Ellipse((0.5, 0.5), 0.5, 1.0, 0)
+ points = [(0.0, 0.5), (0.2, 0.5), (0.25, 0.5), (0.5, 0.5)]
+ path = ell.get_path()
+ transform = ell.get_transform()
+ radius = ell._process_radius(None)
+ expected = np.array([path.contains_point(point,
+ transform,
+ radius) for point in points])
+ result = np.array([ell.contains_point(point) for point in points])
+ assert np.all(result == expected)
+
+
+def test_contains_points():
+ ell = mpatches.Ellipse((0.5, 0.5), 0.5, 1.0, 0)
+ points = [(0.0, 0.5), (0.2, 0.5), (0.25, 0.5), (0.5, 0.5)]
+ path = ell.get_path()
+ transform = ell.get_transform()
+ radius = ell._process_radius(None)
+ expected = path.contains_points(points, transform, radius)
+ result = ell.contains_points(points)
+ assert np.all(result == expected)
+
+
+# Currently fails with pdf/svg, probably because some parts assume a dpi of 72.
+@check_figures_equal(extensions=["png"])
+def test_shadow(fig_test, fig_ref):
+ xy = np.array([.2, .3])
+ dxy = np.array([.1, .2])
+ # We need to work around the nonsensical (dpi-dependent) interpretation of
+ # offsets by the Shadow class...
+ plt.rcParams["savefig.dpi"] = "figure"
+ # Test image.
+ a1 = fig_test.subplots()
+ rect = mpatches.Rectangle(xy=xy, width=.5, height=.5)
+ shadow = mpatches.Shadow(rect, ox=dxy[0], oy=dxy[1])
+ a1.add_patch(rect)
+ a1.add_patch(shadow)
+ # Reference image.
+ a2 = fig_ref.subplots()
+ rect = mpatches.Rectangle(xy=xy, width=.5, height=.5)
+ shadow = mpatches.Rectangle(
+ xy=xy + fig_ref.dpi / 72 * dxy, width=.5, height=.5,
+ fc=np.asarray(mcolors.to_rgb(rect.get_facecolor())) * .3,
+ ec=np.asarray(mcolors.to_rgb(rect.get_facecolor())) * .3,
+ alpha=.5)
+ a2.add_patch(shadow)
+ a2.add_patch(rect)
+
+
+def test_fancyarrow_units():
+ from datetime import datetime
+ # Smoke test to check that FancyArrowPatch works with units
+ dtime = datetime(2000, 1, 1)
+ fig, ax = plt.subplots()
+ arrow = FancyArrowPatch((0, dtime), (0.01, dtime))
+ ax.add_patch(arrow)
+
+
+@image_comparison(["large_arc.svg"], style="mpl20")
+def test_large_arc():
+ fig, (ax1, ax2) = plt.subplots(1, 2)
+ x = 210
+ y = -2115
+ diameter = 4261
+ for ax in [ax1, ax2]:
+ a = mpatches.Arc((x, y), diameter, diameter, lw=2, color='k')
+ ax.add_patch(a)
+ ax.set_axis_off()
+ ax.set_aspect('equal')
+ # force the high accuracy case
+ ax1.set_xlim(7, 8)
+ ax1.set_ylim(5, 6)
+
+ # force the low accuracy case
+ ax2.set_xlim(-25000, 18000)
+ ax2.set_ylim(-20000, 6600)
+
+
+@image_comparison(["all_quadrants_arcs.svg"], style="mpl20")
+def test_rotated_arcs():
+ fig, ax_arr = plt.subplots(2, 2, squeeze=False, figsize=(10, 10))
+
+ scale = 10_000_000
+ diag_centers = ((-1, -1), (-1, 1), (1, 1), (1, -1))
+ on_axis_centers = ((0, 1), (1, 0), (0, -1), (-1, 0))
+ skews = ((2, 2), (2, 1/10), (2, 1/100), (2, 1/1000))
+
+ for ax, (sx, sy) in zip(ax_arr.ravel(), skews):
+ k = 0
+ for prescale, centers in zip((1 - .0001, (1 - .0001) / np.sqrt(2)),
+ (on_axis_centers, diag_centers)):
+ for j, (x_sign, y_sign) in enumerate(centers, start=k):
+ a = mpatches.Arc(
+ (x_sign * scale * prescale,
+ y_sign * scale * prescale),
+ scale * sx,
+ scale * sy,
+ lw=4,
+ color=f"C{j}",
+ zorder=1 + j,
+ angle=np.rad2deg(np.arctan2(y_sign, x_sign)) % 360,
+ label=f'big {j}',
+ gid=f'big {j}'
+ )
+ ax.add_patch(a)
+
+ k = j+1
+ ax.set_xlim(-scale / 4000, scale / 4000)
+ ax.set_ylim(-scale / 4000, scale / 4000)
+ ax.axhline(0, color="k")
+ ax.axvline(0, color="k")
+ ax.set_axis_off()
+ ax.set_aspect("equal")
+
+
+def test_degenerate_polygon():
+ point = [0, 0]
+ correct_extents = Bbox([point, point]).extents
+ assert np.all(Polygon([point]).get_extents().extents == correct_extents)
+
+
+@pytest.mark.parametrize('kwarg', ('edgecolor', 'facecolor'))
+def test_color_override_warning(kwarg):
+ with pytest.warns(UserWarning,
+ match="Setting the 'color' property will override "
+ "the edgecolor or facecolor properties."):
+ Patch(color='black', **{kwarg: 'black'})
+
+
+def test_empty_verts():
+ poly = Polygon(np.zeros((0, 2)))
+ assert poly.get_verts() == []
+
+
+def test_default_antialiased():
+ patch = Patch()
+
+ patch.set_antialiased(not rcParams['patch.antialiased'])
+ assert patch.get_antialiased() == (not rcParams['patch.antialiased'])
+ # Check that None resets the state
+ patch.set_antialiased(None)
+ assert patch.get_antialiased() == rcParams['patch.antialiased']
+
+
+def test_default_linestyle():
+ patch = Patch()
+ patch.set_linestyle('--')
+ patch.set_linestyle(None)
+ assert patch.get_linestyle() == 'solid'
+
+
+def test_default_capstyle():
+ patch = Patch()
+ assert patch.get_capstyle() == 'butt'
+
+
+def test_default_joinstyle():
+ patch = Patch()
+ assert patch.get_joinstyle() == 'miter'
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_path.py b/venv/Lib/site-packages/matplotlib/tests/test_path.py
new file mode 100644
index 0000000..8bd7777
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_path.py
@@ -0,0 +1,489 @@
+import copy
+import re
+
+import numpy as np
+
+from numpy.testing import assert_array_equal
+import pytest
+
+from matplotlib import patches
+from matplotlib.path import Path
+from matplotlib.patches import Polygon
+from matplotlib.testing.decorators import image_comparison
+import matplotlib.pyplot as plt
+from matplotlib import transforms
+from matplotlib.backend_bases import MouseEvent
+
+
+def test_empty_closed_path():
+ path = Path(np.zeros((0, 2)), closed=True)
+ assert path.vertices.shape == (0, 2)
+ assert path.codes is None
+ assert_array_equal(path.get_extents().extents,
+ transforms.Bbox.null().extents)
+
+
+def test_readonly_path():
+ path = Path.unit_circle()
+
+ def modify_vertices():
+ path.vertices = path.vertices * 2.0
+
+ with pytest.raises(AttributeError):
+ modify_vertices()
+
+
+def test_path_exceptions():
+ bad_verts1 = np.arange(12).reshape(4, 3)
+ with pytest.raises(ValueError,
+ match=re.escape(f'has shape {bad_verts1.shape}')):
+ Path(bad_verts1)
+
+ bad_verts2 = np.arange(12).reshape(2, 3, 2)
+ with pytest.raises(ValueError,
+ match=re.escape(f'has shape {bad_verts2.shape}')):
+ Path(bad_verts2)
+
+ good_verts = np.arange(12).reshape(6, 2)
+ bad_codes = np.arange(2)
+ msg = re.escape(f"Your vertices have shape {good_verts.shape} "
+ f"but your codes have shape {bad_codes.shape}")
+ with pytest.raises(ValueError, match=msg):
+ Path(good_verts, bad_codes)
+
+
+def test_point_in_path():
+ # Test #1787
+ verts2 = [(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]
+
+ path = Path(verts2, closed=True)
+ points = [(0.5, 0.5), (1.5, 0.5)]
+ ret = path.contains_points(points)
+ assert ret.dtype == 'bool'
+ np.testing.assert_equal(ret, [True, False])
+
+
+def test_contains_points_negative_radius():
+ path = Path.unit_circle()
+
+ points = [(0.0, 0.0), (1.25, 0.0), (0.9, 0.9)]
+ result = path.contains_points(points, radius=-0.5)
+ np.testing.assert_equal(result, [True, False, False])
+
+
+_test_paths = [
+ # interior extrema determine extents and degenerate derivative
+ Path([[0, 0], [1, 0], [1, 1], [0, 1]],
+ [Path.MOVETO, Path.CURVE4, Path.CURVE4, Path.CURVE4]),
+ # a quadratic curve
+ Path([[0, 0], [0, 1], [1, 0]], [Path.MOVETO, Path.CURVE3, Path.CURVE3]),
+ # a linear curve, degenerate vertically
+ Path([[0, 1], [1, 1]], [Path.MOVETO, Path.LINETO]),
+ # a point
+ Path([[1, 2]], [Path.MOVETO]),
+]
+
+
+_test_path_extents = [(0., 0., 0.75, 1.), (0., 0., 1., 0.5), (0., 1., 1., 1.),
+ (1., 2., 1., 2.)]
+
+
+@pytest.mark.parametrize('path, extents', zip(_test_paths, _test_path_extents))
+def test_exact_extents(path, extents):
+ # notice that if we just looked at the control points to get the bounding
+ # box of each curve, we would get the wrong answers. For example, for
+ # hard_curve = Path([[0, 0], [1, 0], [1, 1], [0, 1]],
+ # [Path.MOVETO, Path.CURVE4, Path.CURVE4, Path.CURVE4])
+ # we would get that the extents area (0, 0, 1, 1). This code takes into
+ # account the curved part of the path, which does not typically extend all
+ # the way out to the control points.
+ # Note that counterintuitively, path.get_extents() returns a Bbox, so we
+ # have to get that Bbox's `.extents`.
+ assert np.all(path.get_extents().extents == extents)
+
+
+@pytest.mark.parametrize('ignored_code', [Path.CLOSEPOLY, Path.STOP])
+def test_extents_with_ignored_codes(ignored_code):
+ # Check that STOP and CLOSEPOLY points are ignored when calculating extents
+ # of a path with only straight lines
+ path = Path([[0, 0],
+ [1, 1],
+ [2, 2]], [Path.MOVETO, Path.MOVETO, ignored_code])
+ assert np.all(path.get_extents().extents == (0., 0., 1., 1.))
+
+
+def test_point_in_path_nan():
+ box = np.array([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]])
+ p = Path(box)
+ test = np.array([[np.nan, 0.5]])
+ contains = p.contains_points(test)
+ assert len(contains) == 1
+ assert not contains[0]
+
+
+def test_nonlinear_containment():
+ fig, ax = plt.subplots()
+ ax.set(xscale="log", ylim=(0, 1))
+ polygon = ax.axvspan(1, 10)
+ assert polygon.get_path().contains_point(
+ ax.transData.transform((5, .5)), ax.transData)
+ assert not polygon.get_path().contains_point(
+ ax.transData.transform((.5, .5)), ax.transData)
+ assert not polygon.get_path().contains_point(
+ ax.transData.transform((50, .5)), ax.transData)
+
+
+@image_comparison(['arrow_contains_point.png'],
+ remove_text=True, style='mpl20')
+def test_arrow_contains_point():
+ # fix bug (#8384)
+ fig, ax = plt.subplots()
+ ax.set_xlim((0, 2))
+ ax.set_ylim((0, 2))
+
+ # create an arrow with Curve style
+ arrow = patches.FancyArrowPatch((0.5, 0.25), (1.5, 0.75),
+ arrowstyle='->',
+ mutation_scale=40)
+ ax.add_patch(arrow)
+ # create an arrow with Bracket style
+ arrow1 = patches.FancyArrowPatch((0.5, 1), (1.5, 1.25),
+ arrowstyle=']-[',
+ mutation_scale=40)
+ ax.add_patch(arrow1)
+ # create an arrow with other arrow style
+ arrow2 = patches.FancyArrowPatch((0.5, 1.5), (1.5, 1.75),
+ arrowstyle='fancy',
+ fill=False,
+ mutation_scale=40)
+ ax.add_patch(arrow2)
+ patches_list = [arrow, arrow1, arrow2]
+
+ # generate some points
+ X, Y = np.meshgrid(np.arange(0, 2, 0.1),
+ np.arange(0, 2, 0.1))
+ for k, (x, y) in enumerate(zip(X.ravel(), Y.ravel())):
+ xdisp, ydisp = ax.transData.transform([x, y])
+ event = MouseEvent('button_press_event', fig.canvas, xdisp, ydisp)
+ for m, patch in enumerate(patches_list):
+ # set the points to red only if the arrow contains the point
+ inside, res = patch.contains(event)
+ if inside:
+ ax.scatter(x, y, s=5, c="r")
+
+
+@image_comparison(['path_clipping.svg'], remove_text=True)
+def test_path_clipping():
+ fig = plt.figure(figsize=(6.0, 6.2))
+
+ for i, xy in enumerate([
+ [(200, 200), (200, 350), (400, 350), (400, 200)],
+ [(200, 200), (200, 350), (400, 350), (400, 100)],
+ [(200, 100), (200, 350), (400, 350), (400, 100)],
+ [(200, 100), (200, 415), (400, 350), (400, 100)],
+ [(200, 100), (200, 415), (400, 415), (400, 100)],
+ [(200, 415), (400, 415), (400, 100), (200, 100)],
+ [(400, 415), (400, 100), (200, 100), (200, 415)]]):
+ ax = fig.add_subplot(4, 2, i+1)
+ bbox = [0, 140, 640, 260]
+ ax.set_xlim(bbox[0], bbox[0] + bbox[2])
+ ax.set_ylim(bbox[1], bbox[1] + bbox[3])
+ ax.add_patch(Polygon(
+ xy, facecolor='none', edgecolor='red', closed=True))
+
+
+@image_comparison(['semi_log_with_zero.png'], style='mpl20')
+def test_log_transform_with_zero():
+ x = np.arange(-10, 10)
+ y = (1.0 - 1.0/(x**2+1))**20
+
+ fig, ax = plt.subplots()
+ ax.semilogy(x, y, "-o", lw=15, markeredgecolor='k')
+ ax.set_ylim(1e-7, 1)
+ ax.grid(True)
+
+
+def test_make_compound_path_empty():
+ # We should be able to make a compound path with no arguments.
+ # This makes it easier to write generic path based code.
+ r = Path.make_compound_path()
+ assert r.vertices.shape == (0, 2)
+
+
+def test_make_compound_path_stops():
+ zero = [0, 0]
+ paths = 3*[Path([zero, zero], [Path.MOVETO, Path.STOP])]
+ compound_path = Path.make_compound_path(*paths)
+ # the choice to not preserve the terminal STOP is arbitrary, but
+ # documented, so we test that it is in fact respected here
+ assert np.sum(compound_path.codes == Path.STOP) == 0
+
+
+@image_comparison(['xkcd.png'], remove_text=True)
+def test_xkcd():
+ np.random.seed(0)
+
+ x = np.linspace(0, 2 * np.pi, 100)
+ y = np.sin(x)
+
+ with plt.xkcd():
+ fig, ax = plt.subplots()
+ ax.plot(x, y)
+
+
+@image_comparison(['xkcd_marker.png'], remove_text=True)
+def test_xkcd_marker():
+ np.random.seed(0)
+
+ x = np.linspace(0, 5, 8)
+ y1 = x
+ y2 = 5 - x
+ y3 = 2.5 * np.ones(8)
+
+ with plt.xkcd():
+ fig, ax = plt.subplots()
+ ax.plot(x, y1, '+', ms=10)
+ ax.plot(x, y2, 'o', ms=10)
+ ax.plot(x, y3, '^', ms=10)
+
+
+@image_comparison(['marker_paths.pdf'], remove_text=True)
+def test_marker_paths_pdf():
+ N = 7
+
+ plt.errorbar(np.arange(N),
+ np.ones(N) + 4,
+ np.ones(N))
+ plt.xlim(-1, N)
+ plt.ylim(-1, 7)
+
+
+@image_comparison(['nan_path'], style='default', remove_text=True,
+ extensions=['pdf', 'svg', 'eps', 'png'])
+def test_nan_isolated_points():
+
+ y0 = [0, np.nan, 2, np.nan, 4, 5, 6]
+ y1 = [np.nan, 7, np.nan, 9, 10, np.nan, 12]
+
+ fig, ax = plt.subplots()
+
+ ax.plot(y0, '-o')
+ ax.plot(y1, '-o')
+
+
+def test_path_no_doubled_point_in_to_polygon():
+ hand = np.array(
+ [[1.64516129, 1.16145833],
+ [1.64516129, 1.59375],
+ [1.35080645, 1.921875],
+ [1.375, 2.18229167],
+ [1.68548387, 1.9375],
+ [1.60887097, 2.55208333],
+ [1.68548387, 2.69791667],
+ [1.76209677, 2.56770833],
+ [1.83064516, 1.97395833],
+ [1.89516129, 2.75],
+ [1.9516129, 2.84895833],
+ [2.01209677, 2.76041667],
+ [1.99193548, 1.99479167],
+ [2.11290323, 2.63020833],
+ [2.2016129, 2.734375],
+ [2.25403226, 2.60416667],
+ [2.14919355, 1.953125],
+ [2.30645161, 2.36979167],
+ [2.39112903, 2.36979167],
+ [2.41532258, 2.1875],
+ [2.1733871, 1.703125],
+ [2.07782258, 1.16666667]])
+
+ (r0, c0, r1, c1) = (1.0, 1.5, 2.1, 2.5)
+
+ poly = Path(np.vstack((hand[:, 1], hand[:, 0])).T, closed=True)
+ clip_rect = transforms.Bbox([[r0, c0], [r1, c1]])
+ poly_clipped = poly.clip_to_bbox(clip_rect).to_polygons()[0]
+
+ assert np.all(poly_clipped[-2] != poly_clipped[-1])
+ assert np.all(poly_clipped[-1] == poly_clipped[0])
+
+
+def test_path_to_polygons():
+ data = [[10, 10], [20, 20]]
+ p = Path(data)
+
+ assert_array_equal(p.to_polygons(width=40, height=40), [])
+ assert_array_equal(p.to_polygons(width=40, height=40, closed_only=False),
+ [data])
+ assert_array_equal(p.to_polygons(), [])
+ assert_array_equal(p.to_polygons(closed_only=False), [data])
+
+ data = [[10, 10], [20, 20], [30, 30]]
+ closed_data = [[10, 10], [20, 20], [30, 30], [10, 10]]
+ p = Path(data)
+
+ assert_array_equal(p.to_polygons(width=40, height=40), [closed_data])
+ assert_array_equal(p.to_polygons(width=40, height=40, closed_only=False),
+ [data])
+ assert_array_equal(p.to_polygons(), [closed_data])
+ assert_array_equal(p.to_polygons(closed_only=False), [data])
+
+
+def test_path_deepcopy():
+ # Should not raise any error
+ verts = [[0, 0], [1, 1]]
+ codes = [Path.MOVETO, Path.LINETO]
+ path1 = Path(verts)
+ path2 = Path(verts, codes)
+ copy.deepcopy(path1)
+ copy.deepcopy(path2)
+
+
+@pytest.mark.parametrize('phi', np.concatenate([
+ np.array([0, 15, 30, 45, 60, 75, 90, 105, 120, 135]) + delta
+ for delta in [-1, 0, 1]]))
+def test_path_intersect_path(phi):
+ # test for the range of intersection angles
+ eps_array = [1e-5, 1e-8, 1e-10, 1e-12]
+
+ transform = transforms.Affine2D().rotate(np.deg2rad(phi))
+
+ # a and b intersect at angle phi
+ a = Path([(-2, 0), (2, 0)])
+ b = transform.transform_path(a)
+ assert a.intersects_path(b) and b.intersects_path(a)
+
+ # a and b touch at angle phi at (0, 0)
+ a = Path([(0, 0), (2, 0)])
+ b = transform.transform_path(a)
+ assert a.intersects_path(b) and b.intersects_path(a)
+
+ # a and b are orthogonal and intersect at (0, 3)
+ a = transform.transform_path(Path([(0, 1), (0, 3)]))
+ b = transform.transform_path(Path([(1, 3), (0, 3)]))
+ assert a.intersects_path(b) and b.intersects_path(a)
+
+ # a and b are collinear and intersect at (0, 3)
+ a = transform.transform_path(Path([(0, 1), (0, 3)]))
+ b = transform.transform_path(Path([(0, 5), (0, 3)]))
+ assert a.intersects_path(b) and b.intersects_path(a)
+
+ # self-intersect
+ assert a.intersects_path(a)
+
+ # a contains b
+ a = transform.transform_path(Path([(0, 0), (5, 5)]))
+ b = transform.transform_path(Path([(1, 1), (3, 3)]))
+ assert a.intersects_path(b) and b.intersects_path(a)
+
+ # a and b are collinear but do not intersect
+ a = transform.transform_path(Path([(0, 1), (0, 5)]))
+ b = transform.transform_path(Path([(3, 0), (3, 3)]))
+ assert not a.intersects_path(b) and not b.intersects_path(a)
+
+ # a and b are on the same line but do not intersect
+ a = transform.transform_path(Path([(0, 1), (0, 5)]))
+ b = transform.transform_path(Path([(0, 6), (0, 7)]))
+ assert not a.intersects_path(b) and not b.intersects_path(a)
+
+ # Note: 1e-13 is the absolute tolerance error used for
+ # `isclose` function from src/_path.h
+
+ # a and b are parallel but do not touch
+ for eps in eps_array:
+ a = transform.transform_path(Path([(0, 1), (0, 5)]))
+ b = transform.transform_path(Path([(0 + eps, 1), (0 + eps, 5)]))
+ assert not a.intersects_path(b) and not b.intersects_path(a)
+
+ # a and b are on the same line but do not intersect (really close)
+ for eps in eps_array:
+ a = transform.transform_path(Path([(0, 1), (0, 5)]))
+ b = transform.transform_path(Path([(0, 5 + eps), (0, 7)]))
+ assert not a.intersects_path(b) and not b.intersects_path(a)
+
+ # a and b are on the same line and intersect (really close)
+ for eps in eps_array:
+ a = transform.transform_path(Path([(0, 1), (0, 5)]))
+ b = transform.transform_path(Path([(0, 5 - eps), (0, 7)]))
+ assert a.intersects_path(b) and b.intersects_path(a)
+
+ # b is the same as a but with an extra point
+ a = transform.transform_path(Path([(0, 1), (0, 5)]))
+ b = transform.transform_path(Path([(0, 1), (0, 2), (0, 5)]))
+ assert a.intersects_path(b) and b.intersects_path(a)
+
+
+@pytest.mark.parametrize('offset', range(-720, 361, 45))
+def test_full_arc(offset):
+ low = offset
+ high = 360 + offset
+
+ path = Path.arc(low, high)
+ mins = np.min(path.vertices, axis=0)
+ maxs = np.max(path.vertices, axis=0)
+ np.testing.assert_allclose(mins, -1)
+ np.testing.assert_allclose(maxs, 1)
+
+
+def test_disjoint_zero_length_segment():
+ this_path = Path(
+ np.array([
+ [824.85064295, 2056.26489203],
+ [861.69033931, 2041.00539016],
+ [868.57864109, 2057.63522175],
+ [831.73894473, 2072.89472361],
+ [824.85064295, 2056.26489203]]),
+ np.array([1, 2, 2, 2, 79], dtype=Path.code_type))
+
+ outline_path = Path(
+ np.array([
+ [859.91051028, 2165.38461538],
+ [859.06772495, 2149.30331334],
+ [859.06772495, 2181.46591743],
+ [859.91051028, 2165.38461538],
+ [859.91051028, 2165.38461538]]),
+ np.array([1, 2, 2, 2, 2],
+ dtype=Path.code_type))
+
+ assert not outline_path.intersects_path(this_path)
+ assert not this_path.intersects_path(outline_path)
+
+
+def test_intersect_zero_length_segment():
+ this_path = Path(
+ np.array([
+ [0, 0],
+ [1, 1],
+ ]))
+
+ outline_path = Path(
+ np.array([
+ [1, 0],
+ [.5, .5],
+ [.5, .5],
+ [0, 1],
+ ]))
+
+ assert outline_path.intersects_path(this_path)
+ assert this_path.intersects_path(outline_path)
+
+
+def test_cleanup_closepoly():
+ # if the first connected component of a Path ends in a CLOSEPOLY, but that
+ # component contains a NaN, then Path.cleaned should ignore not just the
+ # control points but also the CLOSEPOLY, since it has nowhere valid to
+ # point.
+ paths = [
+ Path([[np.nan, np.nan], [np.nan, np.nan]],
+ [Path.MOVETO, Path.CLOSEPOLY]),
+ # we trigger a different path in the C++ code if we don't pass any
+ # codes explicitly, so we must also make sure that this works
+ Path([[np.nan, np.nan], [np.nan, np.nan]]),
+ # we should also make sure that this cleanup works if there's some
+ # multi-vertex curves
+ Path([[np.nan, np.nan], [np.nan, np.nan], [np.nan, np.nan],
+ [np.nan, np.nan]],
+ [Path.MOVETO, Path.CURVE3, Path.CURVE3, Path.CLOSEPOLY])
+ ]
+ for p in paths:
+ cleaned = p.cleaned(remove_nans=True)
+ assert len(cleaned) == 1
+ assert cleaned.codes[0] == Path.STOP
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_patheffects.py b/venv/Lib/site-packages/matplotlib/tests/test_patheffects.py
new file mode 100644
index 0000000..34462fa
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_patheffects.py
@@ -0,0 +1,190 @@
+import numpy as np
+
+from matplotlib.testing.decorators import image_comparison
+import matplotlib.pyplot as plt
+import matplotlib.patheffects as path_effects
+from matplotlib.path import Path
+import matplotlib.patches as patches
+
+
+@image_comparison(['patheffect1'], remove_text=True)
+def test_patheffect1():
+ ax1 = plt.subplot()
+ ax1.imshow([[1, 2], [2, 3]])
+ txt = ax1.annotate("test", (1., 1.), (0., 0),
+ arrowprops=dict(arrowstyle="->",
+ connectionstyle="angle3", lw=2),
+ size=20, ha="center",
+ path_effects=[path_effects.withStroke(linewidth=3,
+ foreground="w")])
+ txt.arrow_patch.set_path_effects([path_effects.Stroke(linewidth=5,
+ foreground="w"),
+ path_effects.Normal()])
+
+ pe = [path_effects.withStroke(linewidth=3, foreground="w")]
+ ax1.grid(True, linestyle="-", path_effects=pe)
+
+
+@image_comparison(['patheffect2'], remove_text=True, style='mpl20')
+def test_patheffect2():
+
+ ax2 = plt.subplot()
+ arr = np.arange(25).reshape((5, 5))
+ ax2.imshow(arr, interpolation='nearest')
+ cntr = ax2.contour(arr, colors="k")
+
+ plt.setp(cntr.collections,
+ path_effects=[path_effects.withStroke(linewidth=3,
+ foreground="w")])
+
+ clbls = ax2.clabel(cntr, fmt="%2.0f", use_clabeltext=True)
+ plt.setp(clbls,
+ path_effects=[path_effects.withStroke(linewidth=3,
+ foreground="w")])
+
+
+@image_comparison(['patheffect3'])
+def test_patheffect3():
+ p1, = plt.plot([1, 3, 5, 4, 3], 'o-b', lw=4)
+ p1.set_path_effects([path_effects.SimpleLineShadow(),
+ path_effects.Normal()])
+ plt.title(
+ r'testing$^{123}$',
+ path_effects=[path_effects.withStroke(linewidth=1, foreground="r")])
+ leg = plt.legend([p1], [r'Line 1$^2$'], fancybox=True, loc='upper left')
+ leg.legendPatch.set_path_effects([path_effects.withSimplePatchShadow()])
+
+ text = plt.text(2, 3, 'Drop test', color='white',
+ bbox={'boxstyle': 'circle,pad=0.1', 'color': 'red'})
+ pe = [path_effects.Stroke(linewidth=3.75, foreground='k'),
+ path_effects.withSimplePatchShadow((6, -3), shadow_rgbFace='blue')]
+ text.set_path_effects(pe)
+ text.get_bbox_patch().set_path_effects(pe)
+
+ pe = [path_effects.PathPatchEffect(offset=(4, -4), hatch='xxxx',
+ facecolor='gray'),
+ path_effects.PathPatchEffect(edgecolor='white', facecolor='black',
+ lw=1.1)]
+
+ t = plt.gcf().text(0.02, 0.1, 'Hatch shadow', fontsize=75, weight=1000,
+ va='center')
+ t.set_path_effects(pe)
+
+
+@image_comparison(['stroked_text.png'])
+def test_patheffects_stroked_text():
+ text_chunks = [
+ 'A B C D E F G H I J K L',
+ 'M N O P Q R S T U V W',
+ 'X Y Z a b c d e f g h i j',
+ 'k l m n o p q r s t u v',
+ 'w x y z 0123456789',
+ r"!@#$%^&*()-=_+[]\;'",
+ ',./{}|:"<>?'
+ ]
+ font_size = 50
+
+ ax = plt.axes([0, 0, 1, 1])
+ for i, chunk in enumerate(text_chunks):
+ text = ax.text(x=0.01, y=(0.9 - i * 0.13), s=chunk,
+ fontdict={'ha': 'left', 'va': 'center',
+ 'size': font_size, 'color': 'white'})
+
+ text.set_path_effects([path_effects.Stroke(linewidth=font_size / 10,
+ foreground='black'),
+ path_effects.Normal()])
+
+ ax.set_xlim(0, 1)
+ ax.set_ylim(0, 1)
+ ax.axis('off')
+
+
+def test_PathEffect_points_to_pixels():
+ fig = plt.figure(dpi=150)
+ p1, = plt.plot(range(10))
+ p1.set_path_effects([path_effects.SimpleLineShadow(),
+ path_effects.Normal()])
+ renderer = fig.canvas.get_renderer()
+ pe_renderer = path_effects.PathEffectRenderer(
+ p1.get_path_effects(), renderer)
+ # Confirm that using a path effects renderer maintains point sizes
+ # appropriately. Otherwise rendered font would be the wrong size.
+ assert renderer.points_to_pixels(15) == pe_renderer.points_to_pixels(15)
+
+
+def test_SimplePatchShadow_offset():
+ pe = path_effects.SimplePatchShadow(offset=(4, 5))
+ assert pe._offset == (4, 5)
+
+
+@image_comparison(['collection'], tol=0.03, style='mpl20')
+def test_collection():
+ x, y = np.meshgrid(np.linspace(0, 10, 150), np.linspace(-5, 5, 100))
+ data = np.sin(x) + np.cos(y)
+ cs = plt.contour(data)
+ pe = [path_effects.PathPatchEffect(edgecolor='black', facecolor='none',
+ linewidth=12),
+ path_effects.Stroke(linewidth=5)]
+
+ for collection in cs.collections:
+ collection.set_path_effects(pe)
+
+ for text in plt.clabel(cs, colors='white'):
+ text.set_path_effects([path_effects.withStroke(foreground='k',
+ linewidth=3)])
+ text.set_bbox({'boxstyle': 'sawtooth', 'facecolor': 'none',
+ 'edgecolor': 'blue'})
+
+
+@image_comparison(['tickedstroke'], remove_text=True, extensions=['png'])
+def test_tickedstroke():
+ fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(12, 4))
+ path = Path.unit_circle()
+ patch = patches.PathPatch(path, facecolor='none', lw=2, path_effects=[
+ path_effects.withTickedStroke(angle=-90, spacing=10,
+ length=1)])
+
+ ax1.add_patch(patch)
+ ax1.axis('equal')
+ ax1.set_xlim(-2, 2)
+ ax1.set_ylim(-2, 2)
+
+ ax2.plot([0, 1], [0, 1], label=' ',
+ path_effects=[path_effects.withTickedStroke(spacing=7,
+ angle=135)])
+ nx = 101
+ x = np.linspace(0.0, 1.0, nx)
+ y = 0.3 * np.sin(x * 8) + 0.4
+ ax2.plot(x, y, label=' ', path_effects=[path_effects.withTickedStroke()])
+
+ ax2.legend()
+
+ nx = 101
+ ny = 105
+
+ # Set up survey vectors
+ xvec = np.linspace(0.001, 4.0, nx)
+ yvec = np.linspace(0.001, 4.0, ny)
+
+ # Set up survey matrices. Design disk loading and gear ratio.
+ x1, x2 = np.meshgrid(xvec, yvec)
+
+ # Evaluate some stuff to plot
+ g1 = -(3 * x1 + x2 - 5.5)
+ g2 = -(x1 + 2 * x2 - 4)
+ g3 = .8 + x1 ** -3 - x2
+
+ cg1 = ax3.contour(x1, x2, g1, [0], colors=('k',))
+ plt.setp(cg1.collections,
+ path_effects=[path_effects.withTickedStroke(angle=135)])
+
+ cg2 = ax3.contour(x1, x2, g2, [0], colors=('r',))
+ plt.setp(cg2.collections,
+ path_effects=[path_effects.withTickedStroke(angle=60, length=2)])
+
+ cg3 = ax3.contour(x1, x2, g3, [0], colors=('b',))
+ plt.setp(cg3.collections,
+ path_effects=[path_effects.withTickedStroke(spacing=7)])
+
+ ax3.set_xlim(0, 4)
+ ax3.set_ylim(0, 4)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_pickle.py b/venv/Lib/site-packages/matplotlib/tests/test_pickle.py
new file mode 100644
index 0000000..5c169cb
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_pickle.py
@@ -0,0 +1,214 @@
+from io import BytesIO
+import pickle
+
+import numpy as np
+import pytest
+
+from matplotlib import cm
+from matplotlib.testing.decorators import image_comparison
+from matplotlib.dates import rrulewrapper
+import matplotlib.pyplot as plt
+import matplotlib.transforms as mtransforms
+import matplotlib.figure as mfigure
+
+
+def test_simple():
+ fig = plt.figure()
+ pickle.dump(fig, BytesIO(), pickle.HIGHEST_PROTOCOL)
+
+ ax = plt.subplot(121)
+ pickle.dump(ax, BytesIO(), pickle.HIGHEST_PROTOCOL)
+
+ ax = plt.axes(projection='polar')
+ plt.plot(np.arange(10), label='foobar')
+ plt.legend()
+
+ pickle.dump(ax, BytesIO(), pickle.HIGHEST_PROTOCOL)
+
+# ax = plt.subplot(121, projection='hammer')
+# pickle.dump(ax, BytesIO(), pickle.HIGHEST_PROTOCOL)
+
+ plt.figure()
+ plt.bar(x=np.arange(10), height=np.arange(10))
+ pickle.dump(plt.gca(), BytesIO(), pickle.HIGHEST_PROTOCOL)
+
+ fig = plt.figure()
+ ax = plt.axes()
+ plt.plot(np.arange(10))
+ ax.set_yscale('log')
+ pickle.dump(fig, BytesIO(), pickle.HIGHEST_PROTOCOL)
+
+
+@image_comparison(
+ ['multi_pickle.png'], remove_text=True, style='mpl20', tol=0.082)
+def test_complete():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig = plt.figure('Figure with a label?', figsize=(10, 6))
+
+ plt.suptitle('Can you fit any more in a figure?')
+
+ # make some arbitrary data
+ x, y = np.arange(8), np.arange(10)
+ data = u = v = np.linspace(0, 10, 80).reshape(10, 8)
+ v = np.sin(v * -0.6)
+
+ # Ensure lists also pickle correctly.
+ plt.subplot(3, 3, 1)
+ plt.plot(list(range(10)))
+
+ plt.subplot(3, 3, 2)
+ plt.contourf(data, hatches=['//', 'ooo'])
+ plt.colorbar()
+
+ plt.subplot(3, 3, 3)
+ plt.pcolormesh(data)
+
+ plt.subplot(3, 3, 4)
+ plt.imshow(data)
+
+ plt.subplot(3, 3, 5)
+ plt.pcolor(data)
+
+ ax = plt.subplot(3, 3, 6)
+ ax.set_xlim(0, 7)
+ ax.set_ylim(0, 9)
+ plt.streamplot(x, y, u, v)
+
+ ax = plt.subplot(3, 3, 7)
+ ax.set_xlim(0, 7)
+ ax.set_ylim(0, 9)
+ plt.quiver(x, y, u, v)
+
+ plt.subplot(3, 3, 8)
+ plt.scatter(x, x**2, label='$x^2$')
+ plt.legend(loc='upper left')
+
+ plt.subplot(3, 3, 9)
+ plt.errorbar(x, x * -0.5, xerr=0.2, yerr=0.4)
+
+ #
+ # plotting is done, now test its pickle-ability
+ #
+ result_fh = BytesIO()
+ pickle.dump(fig, result_fh, pickle.HIGHEST_PROTOCOL)
+
+ plt.close('all')
+
+ # make doubly sure that there are no figures left
+ assert plt._pylab_helpers.Gcf.figs == {}
+
+ # wind back the fh and load in the figure
+ result_fh.seek(0)
+ fig = pickle.load(result_fh)
+
+ # make sure there is now a figure manager
+ assert plt._pylab_helpers.Gcf.figs != {}
+
+ assert fig.get_label() == 'Figure with a label?'
+
+
+def test_no_pyplot():
+ # tests pickle-ability of a figure not created with pyplot
+ from matplotlib.backends.backend_pdf import FigureCanvasPdf
+ fig = mfigure.Figure()
+ _ = FigureCanvasPdf(fig)
+ ax = fig.add_subplot(1, 1, 1)
+ ax.plot([1, 2, 3], [1, 2, 3])
+ pickle.dump(fig, BytesIO(), pickle.HIGHEST_PROTOCOL)
+
+
+def test_renderer():
+ from matplotlib.backends.backend_agg import RendererAgg
+ renderer = RendererAgg(10, 20, 30)
+ pickle.dump(renderer, BytesIO())
+
+
+def test_image():
+ # Prior to v1.4.0 the Image would cache data which was not picklable
+ # once it had been drawn.
+ from matplotlib.backends.backend_agg import new_figure_manager
+ manager = new_figure_manager(1000)
+ fig = manager.canvas.figure
+ ax = fig.add_subplot(1, 1, 1)
+ ax.imshow(np.arange(12).reshape(3, 4))
+ manager.canvas.draw()
+ pickle.dump(fig, BytesIO())
+
+
+def test_polar():
+ plt.subplot(polar=True)
+ fig = plt.gcf()
+ pf = pickle.dumps(fig)
+ pickle.loads(pf)
+ plt.draw()
+
+
+class TransformBlob:
+ def __init__(self):
+ self.identity = mtransforms.IdentityTransform()
+ self.identity2 = mtransforms.IdentityTransform()
+ # Force use of the more complex composition.
+ self.composite = mtransforms.CompositeGenericTransform(
+ self.identity,
+ self.identity2)
+ # Check parent -> child links of TransformWrapper.
+ self.wrapper = mtransforms.TransformWrapper(self.composite)
+ # Check child -> parent links of TransformWrapper.
+ self.composite2 = mtransforms.CompositeGenericTransform(
+ self.wrapper,
+ self.identity)
+
+
+def test_transform():
+ obj = TransformBlob()
+ pf = pickle.dumps(obj)
+ del obj
+
+ obj = pickle.loads(pf)
+ # Check parent -> child links of TransformWrapper.
+ assert obj.wrapper._child == obj.composite
+ # Check child -> parent links of TransformWrapper.
+ assert [v() for v in obj.wrapper._parents.values()] == [obj.composite2]
+ # Check input and output dimensions are set as expected.
+ assert obj.wrapper.input_dims == obj.composite.input_dims
+ assert obj.wrapper.output_dims == obj.composite.output_dims
+
+
+def test_rrulewrapper():
+ r = rrulewrapper(2)
+ try:
+ pickle.loads(pickle.dumps(r))
+ except RecursionError:
+ print('rrulewrapper pickling test failed')
+ raise
+
+
+def test_shared():
+ fig, axs = plt.subplots(2, sharex=True)
+ fig = pickle.loads(pickle.dumps(fig))
+ fig.axes[0].set_xlim(10, 20)
+ assert fig.axes[1].get_xlim() == (10, 20)
+
+
+def test_inset_and_secondary():
+ fig, ax = plt.subplots()
+ ax.inset_axes([.1, .1, .3, .3])
+ ax.secondary_xaxis("top", functions=(np.square, np.sqrt))
+ pickle.loads(pickle.dumps(fig))
+
+
+@pytest.mark.parametrize("cmap", cm._cmap_registry.values())
+def test_cmap(cmap):
+ pickle.dumps(cmap)
+
+
+def test_unpickle_canvas():
+ fig = mfigure.Figure()
+ assert fig.canvas is not None
+ out = BytesIO()
+ pickle.dump(fig, out)
+ out.seek(0)
+ fig2 = pickle.load(out)
+ assert fig2.canvas is not None
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_png.py b/venv/Lib/site-packages/matplotlib/tests/test_png.py
new file mode 100644
index 0000000..133d395
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_png.py
@@ -0,0 +1,52 @@
+from io import BytesIO
+from pathlib import Path
+
+import pytest
+
+from matplotlib.testing.decorators import image_comparison
+from matplotlib import pyplot as plt
+import matplotlib.cm as cm
+
+
+@image_comparison(['pngsuite.png'], tol=0.03)
+def test_pngsuite():
+ files = sorted(
+ (Path(__file__).parent / "baseline_images/pngsuite").glob("basn*.png"))
+
+ plt.figure(figsize=(len(files), 2))
+
+ for i, fname in enumerate(files):
+ data = plt.imread(fname)
+ cmap = None # use default colormap
+ if data.ndim == 2:
+ # keep grayscale images gray
+ cmap = cm.gray
+ plt.imshow(data, extent=[i, i + 1, 0, 1], cmap=cmap)
+
+ plt.gca().patch.set_facecolor("#ddffff")
+ plt.gca().set_xlim(0, len(files))
+
+
+def test_truncated_file(tmpdir):
+ d = tmpdir.mkdir('test')
+ fname = str(d.join('test.png'))
+ fname_t = str(d.join('test_truncated.png'))
+ plt.savefig(fname)
+ with open(fname, 'rb') as fin:
+ buf = fin.read()
+ with open(fname_t, 'wb') as fout:
+ fout.write(buf[:20])
+
+ with pytest.raises(Exception):
+ plt.imread(fname_t)
+
+
+def test_truncated_buffer():
+ b = BytesIO()
+ plt.savefig(b)
+ b.seek(0)
+ b2 = BytesIO(b.read(20))
+ b2.seek(0)
+
+ with pytest.raises(Exception):
+ plt.imread(b2)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_polar.py b/venv/Lib/site-packages/matplotlib/tests/test_polar.py
new file mode 100644
index 0000000..c614eff
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_polar.py
@@ -0,0 +1,359 @@
+import numpy as np
+from numpy.testing import assert_allclose
+import pytest
+
+import matplotlib as mpl
+from matplotlib import pyplot as plt
+from matplotlib.testing.decorators import image_comparison, check_figures_equal
+
+
+@image_comparison(['polar_axes'], style='default', tol=0.012)
+def test_polar_annotations():
+ # You can specify the xypoint and the xytext in different positions and
+ # coordinate systems, and optionally turn on a connecting line and mark the
+ # point with a marker. Annotations work on polar axes too. In the example
+ # below, the xy point is in native coordinates (xycoords defaults to
+ # 'data'). For a polar axes, this is in (theta, radius) space. The text
+ # in this example is placed in the fractional figure coordinate system.
+ # Text keyword args like horizontal and vertical alignment are respected.
+
+ # Setup some data
+ r = np.arange(0.0, 1.0, 0.001)
+ theta = 2.0 * 2.0 * np.pi * r
+
+ fig = plt.figure()
+ ax = fig.add_subplot(polar=True)
+ line, = ax.plot(theta, r, color='#ee8d18', lw=3)
+ line, = ax.plot((0, 0), (0, 1), color="#0000ff", lw=1)
+
+ ind = 800
+ thisr, thistheta = r[ind], theta[ind]
+ ax.plot([thistheta], [thisr], 'o')
+ ax.annotate('a polar annotation',
+ xy=(thistheta, thisr), # theta, radius
+ xytext=(0.05, 0.05), # fraction, fraction
+ textcoords='figure fraction',
+ arrowprops=dict(facecolor='black', shrink=0.05),
+ horizontalalignment='left',
+ verticalalignment='baseline',
+ )
+
+ ax.tick_params(axis='x', tick1On=True, tick2On=True, direction='out')
+
+
+@image_comparison(['polar_coords'], style='default', remove_text=True,
+ tol=0.012)
+def test_polar_coord_annotations():
+ # You can also use polar notation on a cartesian axes. Here the native
+ # coordinate system ('data') is cartesian, so you need to specify the
+ # xycoords and textcoords as 'polar' if you want to use (theta, radius).
+ el = mpl.patches.Ellipse((0, 0), 10, 20, facecolor='r', alpha=0.5)
+
+ fig = plt.figure()
+ ax = fig.add_subplot(aspect='equal')
+
+ ax.add_artist(el)
+ el.set_clip_box(ax.bbox)
+
+ ax.annotate('the top',
+ xy=(np.pi/2., 10.), # theta, radius
+ xytext=(np.pi/3, 20.), # theta, radius
+ xycoords='polar',
+ textcoords='polar',
+ arrowprops=dict(facecolor='black', shrink=0.05),
+ horizontalalignment='left',
+ verticalalignment='baseline',
+ clip_on=True, # clip to the axes bounding box
+ )
+
+ ax.set_xlim(-20, 20)
+ ax.set_ylim(-20, 20)
+
+
+@image_comparison(['polar_alignment.png'])
+def test_polar_alignment():
+ # Test changing the vertical/horizontal alignment of a polar graph.
+ angles = np.arange(0, 360, 90)
+ grid_values = [0, 0.2, 0.4, 0.6, 0.8, 1]
+
+ fig = plt.figure()
+ rect = [0.1, 0.1, 0.8, 0.8]
+
+ horizontal = fig.add_axes(rect, polar=True, label='horizontal')
+ horizontal.set_thetagrids(angles)
+
+ vertical = fig.add_axes(rect, polar=True, label='vertical')
+ vertical.patch.set_visible(False)
+
+ for i in range(2):
+ fig.axes[i].set_rgrids(
+ grid_values, angle=angles[i],
+ horizontalalignment='left', verticalalignment='top')
+
+
+def test_polar_twice():
+ fig = plt.figure()
+ plt.polar([1, 2], [.1, .2])
+ plt.polar([3, 4], [.3, .4])
+ assert len(fig.axes) == 1, 'More than one polar axes created.'
+
+
+@check_figures_equal()
+def test_polar_wrap(fig_test, fig_ref):
+ ax = fig_test.add_subplot(projection="polar")
+ ax.plot(np.deg2rad([179, -179]), [0.2, 0.1])
+ ax.plot(np.deg2rad([2, -2]), [0.2, 0.1])
+ ax = fig_ref.add_subplot(projection="polar")
+ ax.plot(np.deg2rad([179, 181]), [0.2, 0.1])
+ ax.plot(np.deg2rad([2, 358]), [0.2, 0.1])
+
+
+@check_figures_equal()
+def test_polar_units_1(fig_test, fig_ref):
+ import matplotlib.testing.jpl_units as units
+ units.register()
+ xs = [30.0, 45.0, 60.0, 90.0]
+ ys = [1.0, 2.0, 3.0, 4.0]
+
+ plt.figure(fig_test.number)
+ plt.polar([x * units.deg for x in xs], ys)
+
+ ax = fig_ref.add_subplot(projection="polar")
+ ax.plot(np.deg2rad(xs), ys)
+ ax.set(xlabel="deg")
+
+
+@check_figures_equal()
+def test_polar_units_2(fig_test, fig_ref):
+ import matplotlib.testing.jpl_units as units
+ units.register()
+ xs = [30.0, 45.0, 60.0, 90.0]
+ xs_deg = [x * units.deg for x in xs]
+ ys = [1.0, 2.0, 3.0, 4.0]
+ ys_km = [y * units.km for y in ys]
+
+ plt.figure(fig_test.number)
+ # test {theta,r}units.
+ plt.polar(xs_deg, ys_km, thetaunits="rad", runits="km")
+ assert isinstance(plt.gca().xaxis.get_major_formatter(),
+ units.UnitDblFormatter)
+
+ ax = fig_ref.add_subplot(projection="polar")
+ ax.plot(np.deg2rad(xs), ys)
+ ax.xaxis.set_major_formatter(mpl.ticker.FuncFormatter("{:.12}".format))
+ ax.set(xlabel="rad", ylabel="km")
+
+
+@image_comparison(['polar_rmin'], style='default')
+def test_polar_rmin():
+ r = np.arange(0, 3.0, 0.01)
+ theta = 2*np.pi*r
+
+ fig = plt.figure()
+ ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
+ ax.plot(theta, r)
+ ax.set_rmax(2.0)
+ ax.set_rmin(0.5)
+
+
+@image_comparison(['polar_negative_rmin'], style='default')
+def test_polar_negative_rmin():
+ r = np.arange(-3.0, 0.0, 0.01)
+ theta = 2*np.pi*r
+
+ fig = plt.figure()
+ ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
+ ax.plot(theta, r)
+ ax.set_rmax(0.0)
+ ax.set_rmin(-3.0)
+
+
+@image_comparison(['polar_rorigin'], style='default')
+def test_polar_rorigin():
+ r = np.arange(0, 3.0, 0.01)
+ theta = 2*np.pi*r
+
+ fig = plt.figure()
+ ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
+ ax.plot(theta, r)
+ ax.set_rmax(2.0)
+ ax.set_rmin(0.5)
+ ax.set_rorigin(0.0)
+
+
+@image_comparison(['polar_invertedylim.png'], style='default')
+def test_polar_invertedylim():
+ fig = plt.figure()
+ ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
+ ax.set_ylim(2, 0)
+
+
+@image_comparison(['polar_invertedylim_rorigin.png'], style='default')
+def test_polar_invertedylim_rorigin():
+ fig = plt.figure()
+ ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
+ ax.yaxis.set_inverted(True)
+ # Set the rlims to inverted (2, 0) without calling set_rlim, to check that
+ # viewlims are correctly unstaled before draw()ing.
+ ax.plot([0, 0], [0, 2], c="none")
+ ax.margins(0)
+ ax.set_rorigin(3)
+
+
+@image_comparison(['polar_theta_position'], style='default')
+def test_polar_theta_position():
+ r = np.arange(0, 3.0, 0.01)
+ theta = 2*np.pi*r
+
+ fig = plt.figure()
+ ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
+ ax.plot(theta, r)
+ ax.set_theta_zero_location("NW", 30)
+ ax.set_theta_direction('clockwise')
+
+
+@image_comparison(['polar_rlabel_position'], style='default')
+def test_polar_rlabel_position():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='polar')
+ ax.set_rlabel_position(315)
+ ax.tick_params(rotation='auto')
+
+
+@image_comparison(['polar_theta_wedge'], style='default')
+def test_polar_theta_limits():
+ r = np.arange(0, 3.0, 0.01)
+ theta = 2*np.pi*r
+
+ theta_mins = np.arange(15.0, 361.0, 90.0)
+ theta_maxs = np.arange(50.0, 361.0, 90.0)
+ DIRECTIONS = ('out', 'in', 'inout')
+
+ fig, axs = plt.subplots(len(theta_mins), len(theta_maxs),
+ subplot_kw={'polar': True},
+ figsize=(8, 6))
+
+ for i, start in enumerate(theta_mins):
+ for j, end in enumerate(theta_maxs):
+ ax = axs[i, j]
+ ax.plot(theta, r)
+ if start < end:
+ ax.set_thetamin(start)
+ ax.set_thetamax(end)
+ else:
+ # Plot with clockwise orientation instead.
+ ax.set_thetamin(end)
+ ax.set_thetamax(start)
+ ax.set_theta_direction('clockwise')
+ ax.tick_params(tick1On=True, tick2On=True,
+ direction=DIRECTIONS[i % len(DIRECTIONS)],
+ rotation='auto')
+ ax.yaxis.set_tick_params(label2On=True, rotation='auto')
+
+
+@check_figures_equal(extensions=["png"])
+def test_polar_rlim(fig_test, fig_ref):
+ ax = fig_test.subplots(subplot_kw={'polar': True})
+ ax.set_rlim(top=10)
+ ax.set_rlim(bottom=.5)
+
+ ax = fig_ref.subplots(subplot_kw={'polar': True})
+ ax.set_rmax(10.)
+ ax.set_rmin(.5)
+
+
+@check_figures_equal(extensions=["png"])
+def test_polar_rlim_bottom(fig_test, fig_ref):
+ ax = fig_test.subplots(subplot_kw={'polar': True})
+ ax.set_rlim(bottom=[.5, 10])
+
+ ax = fig_ref.subplots(subplot_kw={'polar': True})
+ ax.set_rmax(10.)
+ ax.set_rmin(.5)
+
+
+def test_polar_rlim_zero():
+ ax = plt.figure().add_subplot(projection='polar')
+ ax.plot(np.arange(10), np.arange(10) + .01)
+ assert ax.get_ylim()[0] == 0
+
+
+def test_polar_no_data():
+ plt.subplot(projection="polar")
+ ax = plt.gca()
+ assert ax.get_rmin() == 0 and ax.get_rmax() == 1
+ plt.close("all")
+ # Used to behave differently (by triggering an autoscale with no data).
+ plt.polar()
+ ax = plt.gca()
+ assert ax.get_rmin() == 0 and ax.get_rmax() == 1
+
+
+def test_polar_not_datalim_adjustable():
+ ax = plt.figure().add_subplot(projection="polar")
+ with pytest.raises(ValueError):
+ ax.set_adjustable("datalim")
+
+
+def test_polar_gridlines():
+ fig = plt.figure()
+ ax = fig.add_subplot(polar=True)
+ # make all major grid lines lighter, only x grid lines set in 2.1.0
+ ax.grid(alpha=0.2)
+ # hide y tick labels, no effect in 2.1.0
+ plt.setp(ax.yaxis.get_ticklabels(), visible=False)
+ fig.canvas.draw()
+ assert ax.xaxis.majorTicks[0].gridline.get_alpha() == .2
+ assert ax.yaxis.majorTicks[0].gridline.get_alpha() == .2
+
+
+def test_get_tightbbox_polar():
+ fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
+ fig.canvas.draw()
+ bb = ax.get_tightbbox(fig.canvas.get_renderer())
+ assert_allclose(
+ bb.extents, [107.7778, 29.2778, 539.7847, 450.7222], rtol=1e-03)
+
+
+@check_figures_equal(extensions=["png"])
+def test_polar_interpolation_steps_constant_r(fig_test, fig_ref):
+ # Check that an extra half-turn doesn't make any difference -- modulo
+ # antialiasing, which we disable here.
+ p1 = (fig_test.add_subplot(121, projection="polar")
+ .bar([0], [1], 3*np.pi, edgecolor="none"))
+ p2 = (fig_test.add_subplot(122, projection="polar")
+ .bar([0], [1], -3*np.pi, edgecolor="none"))
+ p3 = (fig_ref.add_subplot(121, projection="polar")
+ .bar([0], [1], 2*np.pi, edgecolor="none"))
+ p4 = (fig_ref.add_subplot(122, projection="polar")
+ .bar([0], [1], -2*np.pi, edgecolor="none"))
+ for p in [p1, p2, p3, p4]:
+ plt.setp(p, antialiased=False)
+
+
+@check_figures_equal(extensions=["png"])
+def test_polar_interpolation_steps_variable_r(fig_test, fig_ref):
+ l, = fig_test.add_subplot(projection="polar").plot([0, np.pi/2], [1, 2])
+ l.get_path()._interpolation_steps = 100
+ fig_ref.add_subplot(projection="polar").plot(
+ np.linspace(0, np.pi/2, 101), np.linspace(1, 2, 101))
+
+
+def test_thetalim_valid_invalid():
+ ax = plt.subplot(projection='polar')
+ ax.set_thetalim(0, 2 * np.pi) # doesn't raise.
+ ax.set_thetalim(thetamin=800, thetamax=440) # doesn't raise.
+ with pytest.raises(ValueError,
+ match='angle range must be less than a full circle'):
+ ax.set_thetalim(0, 3 * np.pi)
+ with pytest.raises(ValueError,
+ match='angle range must be less than a full circle'):
+ ax.set_thetalim(thetamin=800, thetamax=400)
+
+
+def test_thetalim_args():
+ ax = plt.subplot(projection='polar')
+ ax.set_thetalim(0, 1)
+ assert tuple(np.radians((ax.get_thetamin(), ax.get_thetamax()))) == (0, 1)
+ ax.set_thetalim((2, 3))
+ assert tuple(np.radians((ax.get_thetamin(), ax.get_thetamax()))) == (2, 3)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_preprocess_data.py b/venv/Lib/site-packages/matplotlib/tests/test_preprocess_data.py
new file mode 100644
index 0000000..1f47076
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_preprocess_data.py
@@ -0,0 +1,252 @@
+import re
+
+import numpy as np
+import pytest
+
+from matplotlib import _preprocess_data
+from matplotlib.axes import Axes
+from matplotlib.testing.decorators import check_figures_equal
+
+# Notes on testing the plotting functions itself
+# * the individual decorated plotting functions are tested in 'test_axes.py'
+# * that pyplot functions accept a data kwarg is only tested in
+# test_axes.test_pie_linewidth_0
+
+
+# this gets used in multiple tests, so define it here
+@_preprocess_data(replace_names=["x", "y"], label_namer="y")
+def plot_func(ax, x, y, ls="x", label=None, w="xyz"):
+ return ("x: %s, y: %s, ls: %s, w: %s, label: %s" % (
+ list(x), list(y), ls, w, label))
+
+
+all_funcs = [plot_func]
+all_func_ids = ['plot_func']
+
+
+def test_compiletime_checks():
+ """Test decorator invocations -> no replacements."""
+
+ def func(ax, x, y): pass
+ def func_args(ax, x, y, *args): pass
+ def func_kwargs(ax, x, y, **kwargs): pass
+ def func_no_ax_args(*args, **kwargs): pass
+
+ # this is ok
+ _preprocess_data(replace_names=["x", "y"])(func)
+ _preprocess_data(replace_names=["x", "y"])(func_kwargs)
+ # this has "enough" information to do all the replaces
+ _preprocess_data(replace_names=["x", "y"])(func_args)
+
+ # no positional_parameter_names but needed due to replaces
+ with pytest.raises(AssertionError):
+ # z is unknown
+ _preprocess_data(replace_names=["x", "y", "z"])(func_args)
+
+ # no replacements at all -> all ok...
+ _preprocess_data(replace_names=[], label_namer=None)(func)
+ _preprocess_data(replace_names=[], label_namer=None)(func_args)
+ _preprocess_data(replace_names=[], label_namer=None)(func_kwargs)
+ _preprocess_data(replace_names=[], label_namer=None)(func_no_ax_args)
+
+ # label namer is unknown
+ with pytest.raises(AssertionError):
+ _preprocess_data(label_namer="z")(func)
+
+ with pytest.raises(AssertionError):
+ _preprocess_data(label_namer="z")(func_args)
+
+
+@pytest.mark.parametrize('func', all_funcs, ids=all_func_ids)
+def test_function_call_without_data(func):
+ """Test without data -> no replacements."""
+ assert (func(None, "x", "y") ==
+ "x: ['x'], y: ['y'], ls: x, w: xyz, label: None")
+ assert (func(None, x="x", y="y") ==
+ "x: ['x'], y: ['y'], ls: x, w: xyz, label: None")
+ assert (func(None, "x", "y", label="") ==
+ "x: ['x'], y: ['y'], ls: x, w: xyz, label: ")
+ assert (func(None, "x", "y", label="text") ==
+ "x: ['x'], y: ['y'], ls: x, w: xyz, label: text")
+ assert (func(None, x="x", y="y", label="") ==
+ "x: ['x'], y: ['y'], ls: x, w: xyz, label: ")
+ assert (func(None, x="x", y="y", label="text") ==
+ "x: ['x'], y: ['y'], ls: x, w: xyz, label: text")
+
+
+@pytest.mark.parametrize('func', all_funcs, ids=all_func_ids)
+def test_function_call_with_dict_input(func):
+ """Tests with dict input, unpacking via preprocess_pipeline"""
+ data = {'a': 1, 'b': 2}
+ assert(func(None, data.keys(), data.values()) ==
+ "x: ['a', 'b'], y: [1, 2], ls: x, w: xyz, label: None")
+
+
+@pytest.mark.parametrize('func', all_funcs, ids=all_func_ids)
+def test_function_call_with_dict_data(func):
+ """Test with dict data -> label comes from the value of 'x' parameter."""
+ data = {"a": [1, 2], "b": [8, 9], "w": "NOT"}
+ assert (func(None, "a", "b", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: b")
+ assert (func(None, x="a", y="b", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: b")
+ assert (func(None, "a", "b", label="", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: ")
+ assert (func(None, "a", "b", label="text", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: text")
+ assert (func(None, x="a", y="b", label="", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: ")
+ assert (func(None, x="a", y="b", label="text", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: text")
+
+
+@pytest.mark.parametrize('func', all_funcs, ids=all_func_ids)
+def test_function_call_with_dict_data_not_in_data(func):
+ """Test the case that one var is not in data -> half replaces, half kept"""
+ data = {"a": [1, 2], "w": "NOT"}
+ assert (func(None, "a", "b", data=data) ==
+ "x: [1, 2], y: ['b'], ls: x, w: xyz, label: b")
+ assert (func(None, x="a", y="b", data=data) ==
+ "x: [1, 2], y: ['b'], ls: x, w: xyz, label: b")
+ assert (func(None, "a", "b", label="", data=data) ==
+ "x: [1, 2], y: ['b'], ls: x, w: xyz, label: ")
+ assert (func(None, "a", "b", label="text", data=data) ==
+ "x: [1, 2], y: ['b'], ls: x, w: xyz, label: text")
+ assert (func(None, x="a", y="b", label="", data=data) ==
+ "x: [1, 2], y: ['b'], ls: x, w: xyz, label: ")
+ assert (func(None, x="a", y="b", label="text", data=data) ==
+ "x: [1, 2], y: ['b'], ls: x, w: xyz, label: text")
+
+
+@pytest.mark.parametrize('func', all_funcs, ids=all_func_ids)
+def test_function_call_with_pandas_data(func, pd):
+ """Test with pandas dataframe -> label comes from ``data["col"].name``."""
+ data = pd.DataFrame({"a": np.array([1, 2], dtype=np.int32),
+ "b": np.array([8, 9], dtype=np.int32),
+ "w": ["NOT", "NOT"]})
+
+ assert (func(None, "a", "b", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: b")
+ assert (func(None, x="a", y="b", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: b")
+ assert (func(None, "a", "b", label="", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: ")
+ assert (func(None, "a", "b", label="text", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: text")
+ assert (func(None, x="a", y="b", label="", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: ")
+ assert (func(None, x="a", y="b", label="text", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: text")
+
+
+def test_function_call_replace_all():
+ """Test without a "replace_names" argument, all vars should be replaced."""
+ data = {"a": [1, 2], "b": [8, 9], "x": "xyz"}
+
+ @_preprocess_data(label_namer="y")
+ def func_replace_all(ax, x, y, ls="x", label=None, w="NOT"):
+ return "x: %s, y: %s, ls: %s, w: %s, label: %s" % (
+ list(x), list(y), ls, w, label)
+
+ assert (func_replace_all(None, "a", "b", w="x", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: b")
+ assert (func_replace_all(None, x="a", y="b", w="x", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: b")
+ assert (func_replace_all(None, "a", "b", w="x", label="", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: ")
+ assert (
+ func_replace_all(None, "a", "b", w="x", label="text", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: text")
+ assert (
+ func_replace_all(None, x="a", y="b", w="x", label="", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: ")
+ assert (
+ func_replace_all(None, x="a", y="b", w="x", label="text", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: text")
+
+
+def test_no_label_replacements():
+ """Test with "label_namer=None" -> no label replacement at all."""
+
+ @_preprocess_data(replace_names=["x", "y"], label_namer=None)
+ def func_no_label(ax, x, y, ls="x", label=None, w="xyz"):
+ return "x: %s, y: %s, ls: %s, w: %s, label: %s" % (
+ list(x), list(y), ls, w, label)
+
+ data = {"a": [1, 2], "b": [8, 9], "w": "NOT"}
+ assert (func_no_label(None, "a", "b", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: None")
+ assert (func_no_label(None, x="a", y="b", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: None")
+ assert (func_no_label(None, "a", "b", label="", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: ")
+ assert (func_no_label(None, "a", "b", label="text", data=data) ==
+ "x: [1, 2], y: [8, 9], ls: x, w: xyz, label: text")
+
+
+def test_more_args_than_pos_parameter():
+ @_preprocess_data(replace_names=["x", "y"], label_namer="y")
+ def func(ax, x, y, z=1):
+ pass
+
+ data = {"a": [1, 2], "b": [8, 9], "w": "NOT"}
+ with pytest.raises(TypeError):
+ func(None, "a", "b", "z", "z", data=data)
+
+
+def test_docstring_addition():
+ @_preprocess_data()
+ def funcy(ax, *args, **kwargs):
+ """Funcy does nothing"""
+
+ assert re.search(r"every other argument", funcy.__doc__)
+ assert not re.search(r"the following arguments", funcy.__doc__)
+
+ @_preprocess_data(replace_names=[])
+ def funcy(ax, x, y, z, bar=None):
+ """Funcy does nothing"""
+
+ assert not re.search(r"every other argument", funcy.__doc__)
+ assert not re.search(r"the following arguments", funcy.__doc__)
+
+ @_preprocess_data(replace_names=["bar"])
+ def funcy(ax, x, y, z, bar=None):
+ """Funcy does nothing"""
+
+ assert not re.search(r"every other argument", funcy.__doc__)
+ assert not re.search(r"the following arguments .*: \*bar\*\.",
+ funcy.__doc__)
+
+ @_preprocess_data(replace_names=["x", "t"])
+ def funcy(ax, x, y, z, t=None):
+ """Funcy does nothing"""
+
+ assert not re.search(r"every other argument", funcy.__doc__)
+ assert not re.search(r"the following arguments .*: \*x\*, \*t\*\.",
+ funcy.__doc__)
+
+
+class TestPlotTypes:
+
+ plotters = [Axes.scatter, Axes.bar, Axes.plot]
+
+ @pytest.mark.parametrize('plotter', plotters)
+ @check_figures_equal(extensions=['png'])
+ def test_dict_unpack(self, plotter, fig_test, fig_ref):
+ x = [1, 2, 3]
+ y = [4, 5, 6]
+ ddict = dict(zip(x, y))
+
+ plotter(fig_test.subplots(),
+ ddict.keys(), ddict.values())
+ plotter(fig_ref.subplots(), x, y)
+
+ @pytest.mark.parametrize('plotter', plotters)
+ @check_figures_equal(extensions=['png'])
+ def test_data_kwarg(self, plotter, fig_test, fig_ref):
+ x = [1, 2, 3]
+ y = [4, 5, 6]
+
+ plotter(fig_test.subplots(), 'xval', 'yval',
+ data={'xval': x, 'yval': y})
+ plotter(fig_ref.subplots(), x, y)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_pyplot.py b/venv/Lib/site-packages/matplotlib/tests/test_pyplot.py
new file mode 100644
index 0000000..c2c71d5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_pyplot.py
@@ -0,0 +1,312 @@
+import difflib
+import subprocess
+import sys
+from pathlib import Path
+
+import pytest
+
+import matplotlib as mpl
+from matplotlib import pyplot as plt
+from matplotlib.cbook import MatplotlibDeprecationWarning
+
+
+def test_pyplot_up_to_date(tmpdir):
+ gen_script = Path(mpl.__file__).parents[2] / "tools/boilerplate.py"
+ if not gen_script.exists():
+ pytest.skip("boilerplate.py not found")
+ orig_contents = Path(plt.__file__).read_text()
+ plt_file = tmpdir.join('pyplot.py')
+ plt_file.write_text(orig_contents, 'utf-8')
+
+ subprocess.run([sys.executable, str(gen_script), str(plt_file)],
+ check=True)
+ new_contents = plt_file.read_text('utf-8')
+
+ if orig_contents != new_contents:
+ diff_msg = '\n'.join(
+ difflib.unified_diff(
+ orig_contents.split('\n'), new_contents.split('\n'),
+ fromfile='found pyplot.py',
+ tofile='expected pyplot.py',
+ n=0, lineterm=''))
+ pytest.fail(
+ "pyplot.py is not up-to-date. Please run "
+ "'python tools/boilerplate.py' to update pyplot.py. "
+ "This needs to be done from an environment where your "
+ "current working copy is installed (e.g. 'pip install -e'd). "
+ "Here is a diff of unexpected differences:\n%s" % diff_msg
+ )
+
+
+def test_copy_docstring_and_deprecators(recwarn):
+ @mpl._api.rename_parameter("(version)", "old", "new")
+ @mpl._api.make_keyword_only("(version)", "kwo")
+ def func(new, kwo=None):
+ pass
+
+ @plt._copy_docstring_and_deprecators(func)
+ def wrapper_func(new, kwo=None):
+ pass
+
+ wrapper_func(None)
+ wrapper_func(new=None)
+ wrapper_func(None, kwo=None)
+ wrapper_func(new=None, kwo=None)
+ assert not recwarn
+ with pytest.warns(MatplotlibDeprecationWarning):
+ wrapper_func(old=None)
+ with pytest.warns(MatplotlibDeprecationWarning):
+ wrapper_func(None, None)
+
+
+def test_pyplot_box():
+ fig, ax = plt.subplots()
+ plt.box(False)
+ assert not ax.get_frame_on()
+ plt.box(True)
+ assert ax.get_frame_on()
+ plt.box()
+ assert not ax.get_frame_on()
+ plt.box()
+ assert ax.get_frame_on()
+
+
+def test_stackplot_smoke():
+ # Small smoke test for stackplot (see #12405)
+ plt.stackplot([1, 2, 3], [1, 2, 3])
+
+
+def test_nrows_error():
+ with pytest.raises(TypeError):
+ plt.subplot(nrows=1)
+ with pytest.raises(TypeError):
+ plt.subplot(ncols=1)
+
+
+def test_ioff():
+ plt.ion()
+ assert mpl.is_interactive()
+ with plt.ioff():
+ assert not mpl.is_interactive()
+ assert mpl.is_interactive()
+
+ plt.ioff()
+ assert not mpl.is_interactive()
+ with plt.ioff():
+ assert not mpl.is_interactive()
+ assert not mpl.is_interactive()
+
+
+def test_ion():
+ plt.ioff()
+ assert not mpl.is_interactive()
+ with plt.ion():
+ assert mpl.is_interactive()
+ assert not mpl.is_interactive()
+
+ plt.ion()
+ assert mpl.is_interactive()
+ with plt.ion():
+ assert mpl.is_interactive()
+ assert mpl.is_interactive()
+
+
+def test_nested_ion_ioff():
+ # initial state is interactive
+ plt.ion()
+
+ # mixed ioff/ion
+ with plt.ioff():
+ assert not mpl.is_interactive()
+ with plt.ion():
+ assert mpl.is_interactive()
+ assert not mpl.is_interactive()
+ assert mpl.is_interactive()
+
+ # redundant contexts
+ with plt.ioff():
+ with plt.ioff():
+ assert not mpl.is_interactive()
+ assert mpl.is_interactive()
+
+ with plt.ion():
+ plt.ioff()
+ assert mpl.is_interactive()
+
+ # initial state is not interactive
+ plt.ioff()
+
+ # mixed ioff/ion
+ with plt.ion():
+ assert mpl.is_interactive()
+ with plt.ioff():
+ assert not mpl.is_interactive()
+ assert mpl.is_interactive()
+ assert not mpl.is_interactive()
+
+ # redundant contexts
+ with plt.ion():
+ with plt.ion():
+ assert mpl.is_interactive()
+ assert not mpl.is_interactive()
+
+ with plt.ioff():
+ plt.ion()
+ assert not mpl.is_interactive()
+
+
+def test_close():
+ try:
+ plt.close(1.1)
+ except TypeError as e:
+ assert str(e) == "close() argument must be a Figure, an int, " \
+ "a string, or None, not "
+
+
+def test_subplot_reuse():
+ ax1 = plt.subplot(121)
+ assert ax1 is plt.gca()
+ ax2 = plt.subplot(122)
+ assert ax2 is plt.gca()
+ ax3 = plt.subplot(121)
+ assert ax1 is plt.gca()
+ assert ax1 is ax3
+
+
+def test_axes_kwargs():
+ # plt.axes() always creates new axes, even if axes kwargs differ.
+ plt.figure()
+ ax = plt.axes()
+ ax1 = plt.axes()
+ assert ax is not None
+ assert ax1 is not ax
+ plt.close()
+
+ plt.figure()
+ ax = plt.axes(projection='polar')
+ ax1 = plt.axes(projection='polar')
+ assert ax is not None
+ assert ax1 is not ax
+ plt.close()
+
+ plt.figure()
+ ax = plt.axes(projection='polar')
+ ax1 = plt.axes()
+ assert ax is not None
+ assert ax1.name == 'rectilinear'
+ assert ax1 is not ax
+ plt.close()
+
+
+def test_subplot_replace_projection():
+ # plt.subplot() searches for axes with the same subplot spec, and if one
+ # exists, and the kwargs match returns it, create a new one if they do not
+ fig = plt.figure()
+ ax = plt.subplot(1, 2, 1)
+ ax1 = plt.subplot(1, 2, 1)
+ ax2 = plt.subplot(1, 2, 2)
+ # This will delete ax / ax1 as they fully overlap
+ ax3 = plt.subplot(1, 2, 1, projection='polar')
+ ax4 = plt.subplot(1, 2, 1, projection='polar')
+ assert ax is not None
+ assert ax1 is ax
+ assert ax2 is not ax
+ assert ax3 is not ax
+ assert ax3 is ax4
+
+ assert ax not in fig.axes
+ assert ax2 in fig.axes
+ assert ax3 in fig.axes
+
+ assert ax.name == 'rectilinear'
+ assert ax2.name == 'rectilinear'
+ assert ax3.name == 'polar'
+
+
+def test_subplot_kwarg_collision():
+ ax1 = plt.subplot(projection='polar', theta_offset=0)
+ ax2 = plt.subplot(projection='polar', theta_offset=0)
+ assert ax1 is ax2
+ ax3 = plt.subplot(projection='polar', theta_offset=1)
+ assert ax1 is not ax3
+ assert ax1 not in plt.gcf().axes
+
+
+def test_gca_kwargs():
+ # plt.gca() returns an existing axes, unless there were no axes.
+ plt.figure()
+ ax = plt.gca()
+ ax1 = plt.gca()
+ assert ax is not None
+ assert ax1 is ax
+ plt.close()
+
+ # plt.gca() raises a DeprecationWarning if called with kwargs.
+ plt.figure()
+ with pytest.warns(
+ MatplotlibDeprecationWarning,
+ match=r'Calling gca\(\) with keyword arguments was deprecated'):
+ ax = plt.gca(projection='polar')
+ ax1 = plt.gca()
+ assert ax is not None
+ assert ax1 is ax
+ assert ax1.name == 'polar'
+ plt.close()
+
+ # plt.gca() ignores keyword arguments if an axes already exists.
+ plt.figure()
+ ax = plt.gca()
+ with pytest.warns(
+ MatplotlibDeprecationWarning,
+ match=r'Calling gca\(\) with keyword arguments was deprecated'):
+ ax1 = plt.gca(projection='polar')
+ assert ax is not None
+ assert ax1 is ax
+ assert ax1.name == 'rectilinear'
+ plt.close()
+
+
+def test_subplot_projection_reuse():
+ # create an axes
+ ax1 = plt.subplot(111)
+ # check that it is current
+ assert ax1 is plt.gca()
+ # make sure we get it back if we ask again
+ assert ax1 is plt.subplot(111)
+ # create a polar plot
+ ax2 = plt.subplot(111, projection='polar')
+ assert ax2 is plt.gca()
+ # this should have deleted the first axes
+ assert ax1 not in plt.gcf().axes
+ # assert we get it back if no extra parameters passed
+ assert ax2 is plt.subplot(111)
+ # now check explicitly setting the projection to rectilinear
+ # makes a new axes
+ ax3 = plt.subplot(111, projection='rectilinear')
+ assert ax3 is plt.gca()
+ assert ax3 is not ax2
+ assert ax2 not in plt.gcf().axes
+
+
+def test_subplot_polar_normalization():
+ ax1 = plt.subplot(111, projection='polar')
+ ax2 = plt.subplot(111, polar=True)
+ ax3 = plt.subplot(111, polar=True, projection='polar')
+ assert ax1 is ax2
+ assert ax1 is ax3
+
+ with pytest.raises(ValueError,
+ match="polar=True, yet projection='3d'"):
+ ax2 = plt.subplot(111, polar=True, projection='3d')
+
+
+def test_subplot_change_projection():
+ ax = plt.subplot()
+ projections = ('aitoff', 'hammer', 'lambert', 'mollweide',
+ 'polar', 'rectilinear', '3d')
+ for proj in projections:
+ ax_next = plt.subplot(projection=proj)
+ assert ax_next is plt.subplot()
+ assert ax_next.name == proj
+ assert ax is not ax_next
+ ax = ax_next
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_quiver.py b/venv/Lib/site-packages/matplotlib/tests/test_quiver.py
new file mode 100644
index 0000000..740ad36
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_quiver.py
@@ -0,0 +1,261 @@
+import numpy as np
+import pytest
+import sys
+from matplotlib import pyplot as plt
+from matplotlib.testing.decorators import image_comparison
+
+
+def draw_quiver(ax, **kw):
+ X, Y = np.meshgrid(np.arange(0, 2 * np.pi, 1),
+ np.arange(0, 2 * np.pi, 1))
+ U = np.cos(X)
+ V = np.sin(Y)
+
+ Q = ax.quiver(U, V, **kw)
+ return Q
+
+
+def test_quiver_memory_leak():
+ fig, ax = plt.subplots()
+
+ Q = draw_quiver(ax)
+ ttX = Q.X
+ Q.remove()
+
+ del Q
+
+ assert sys.getrefcount(ttX) == 2
+
+
+def test_quiver_key_memory_leak():
+ fig, ax = plt.subplots()
+
+ Q = draw_quiver(ax)
+
+ qk = ax.quiverkey(Q, 0.5, 0.92, 2, r'$2 \frac{m}{s}$',
+ labelpos='W',
+ fontproperties={'weight': 'bold'})
+ assert sys.getrefcount(qk) == 3
+ qk.remove()
+ assert sys.getrefcount(qk) == 2
+
+
+def test_quiver_number_of_args():
+ X = [1, 2]
+ with pytest.raises(
+ TypeError,
+ match='takes 2-5 positional arguments but 1 were given'):
+ plt.quiver(X)
+ with pytest.raises(
+ TypeError,
+ match='takes 2-5 positional arguments but 6 were given'):
+ plt.quiver(X, X, X, X, X, X)
+
+
+def test_quiver_arg_sizes():
+ X2 = [1, 2]
+ X3 = [1, 2, 3]
+ with pytest.raises(
+ ValueError, match=('X and Y must be the same size, but '
+ 'X.size is 2 and Y.size is 3.')):
+ plt.quiver(X2, X3, X2, X2)
+ with pytest.raises(
+ ValueError, match=('Argument U has a size 3 which does not match '
+ '2, the number of arrow positions')):
+ plt.quiver(X2, X2, X3, X2)
+ with pytest.raises(
+ ValueError, match=('Argument V has a size 3 which does not match '
+ '2, the number of arrow positions')):
+ plt.quiver(X2, X2, X2, X3)
+ with pytest.raises(
+ ValueError, match=('Argument C has a size 3 which does not match '
+ '2, the number of arrow positions')):
+ plt.quiver(X2, X2, X2, X2, X3)
+
+
+def test_no_warnings():
+ fig, ax = plt.subplots()
+ X, Y = np.meshgrid(np.arange(15), np.arange(10))
+ U = V = np.ones_like(X)
+ phi = (np.random.rand(15, 10) - .5) * 150
+ ax.quiver(X, Y, U, V, angles=phi)
+ fig.canvas.draw() # Check that no warning is emitted.
+
+
+def test_zero_headlength():
+ # Based on report by Doug McNeil:
+ # http://matplotlib.1069221.n5.nabble.com/quiver-warnings-td28107.html
+ fig, ax = plt.subplots()
+ X, Y = np.meshgrid(np.arange(10), np.arange(10))
+ U, V = np.cos(X), np.sin(Y)
+ ax.quiver(U, V, headlength=0, headaxislength=0)
+ fig.canvas.draw() # Check that no warning is emitted.
+
+
+@image_comparison(['quiver_animated_test_image.png'])
+def test_quiver_animate():
+ # Tests fix for #2616
+ fig, ax = plt.subplots()
+ Q = draw_quiver(ax, animated=True)
+ ax.quiverkey(Q, 0.5, 0.92, 2, r'$2 \frac{m}{s}$',
+ labelpos='W', fontproperties={'weight': 'bold'})
+
+
+@image_comparison(['quiver_with_key_test_image.png'])
+def test_quiver_with_key():
+ fig, ax = plt.subplots()
+ ax.margins(0.1)
+ Q = draw_quiver(ax)
+ ax.quiverkey(Q, 0.5, 0.95, 2,
+ r'$2\, \mathrm{m}\, \mathrm{s}^{-1}$',
+ angle=-10,
+ coordinates='figure',
+ labelpos='W',
+ fontproperties={'weight': 'bold', 'size': 'large'})
+
+
+@image_comparison(['quiver_single_test_image.png'], remove_text=True)
+def test_quiver_single():
+ fig, ax = plt.subplots()
+ ax.margins(0.1)
+ ax.quiver([1], [1], [2], [2])
+
+
+def test_quiver_copy():
+ fig, ax = plt.subplots()
+ uv = dict(u=np.array([1.1]), v=np.array([2.0]))
+ q0 = ax.quiver([1], [1], uv['u'], uv['v'])
+ uv['v'][0] = 0
+ assert q0.V[0] == 2.0
+
+
+@image_comparison(['quiver_key_pivot.png'], remove_text=True)
+def test_quiver_key_pivot():
+ fig, ax = plt.subplots()
+
+ u, v = np.mgrid[0:2*np.pi:10j, 0:2*np.pi:10j]
+
+ q = ax.quiver(np.sin(u), np.cos(v))
+ ax.set_xlim(-2, 11)
+ ax.set_ylim(-2, 11)
+ ax.quiverkey(q, 0.5, 1, 1, 'N', labelpos='N')
+ ax.quiverkey(q, 1, 0.5, 1, 'E', labelpos='E')
+ ax.quiverkey(q, 0.5, 0, 1, 'S', labelpos='S')
+ ax.quiverkey(q, 0, 0.5, 1, 'W', labelpos='W')
+
+
+@image_comparison(['quiver_key_xy.png'], remove_text=True)
+def test_quiver_key_xy():
+ # With scale_units='xy', ensure quiverkey still matches its quiver.
+ # Note that the quiver and quiverkey lengths depend on the axes aspect
+ # ratio, and that with angles='xy' their angles also depend on the axes
+ # aspect ratio.
+ X = np.arange(8)
+ Y = np.zeros(8)
+ angles = X * (np.pi / 4)
+ uv = np.exp(1j * angles)
+ U = uv.real
+ V = uv.imag
+ fig, axs = plt.subplots(2)
+ for ax, angle_str in zip(axs, ('uv', 'xy')):
+ ax.set_xlim(-1, 8)
+ ax.set_ylim(-0.2, 0.2)
+ q = ax.quiver(X, Y, U, V, pivot='middle',
+ units='xy', width=0.05,
+ scale=2, scale_units='xy',
+ angles=angle_str)
+ for x, angle in zip((0.2, 0.5, 0.8), (0, 45, 90)):
+ ax.quiverkey(q, X=x, Y=0.8, U=1, angle=angle, label='', color='b')
+
+
+@image_comparison(['barbs_test_image.png'], remove_text=True)
+def test_barbs():
+ x = np.linspace(-5, 5, 5)
+ X, Y = np.meshgrid(x, x)
+ U, V = 12*X, 12*Y
+ fig, ax = plt.subplots()
+ ax.barbs(X, Y, U, V, np.hypot(U, V), fill_empty=True, rounding=False,
+ sizes=dict(emptybarb=0.25, spacing=0.2, height=0.3),
+ cmap='viridis')
+
+
+@image_comparison(['barbs_pivot_test_image.png'], remove_text=True)
+def test_barbs_pivot():
+ x = np.linspace(-5, 5, 5)
+ X, Y = np.meshgrid(x, x)
+ U, V = 12*X, 12*Y
+ fig, ax = plt.subplots()
+ ax.barbs(X, Y, U, V, fill_empty=True, rounding=False, pivot=1.7,
+ sizes=dict(emptybarb=0.25, spacing=0.2, height=0.3))
+ ax.scatter(X, Y, s=49, c='black')
+
+
+@image_comparison(['barbs_test_flip.png'], remove_text=True)
+def test_barbs_flip():
+ """Test barbs with an array for flip_barb."""
+ x = np.linspace(-5, 5, 5)
+ X, Y = np.meshgrid(x, x)
+ U, V = 12*X, 12*Y
+ fig, ax = plt.subplots()
+ ax.barbs(X, Y, U, V, fill_empty=True, rounding=False, pivot=1.7,
+ sizes=dict(emptybarb=0.25, spacing=0.2, height=0.3),
+ flip_barb=Y < 0)
+
+
+def test_bad_masked_sizes():
+ """Test error handling when given differing sized masked arrays."""
+ x = np.arange(3)
+ y = np.arange(3)
+ u = np.ma.array(15. * np.ones((4,)))
+ v = np.ma.array(15. * np.ones_like(u))
+ u[1] = np.ma.masked
+ v[1] = np.ma.masked
+ fig, ax = plt.subplots()
+ with pytest.raises(ValueError):
+ ax.barbs(x, y, u, v)
+
+
+def test_angles_and_scale():
+ # angles array + scale_units kwarg
+ fig, ax = plt.subplots()
+ X, Y = np.meshgrid(np.arange(15), np.arange(10))
+ U = V = np.ones_like(X)
+ phi = (np.random.rand(15, 10) - .5) * 150
+ ax.quiver(X, Y, U, V, angles=phi, scale_units='xy')
+
+
+@image_comparison(['quiver_xy.png'], remove_text=True)
+def test_quiver_xy():
+ # simple arrow pointing from SW to NE
+ fig, ax = plt.subplots(subplot_kw=dict(aspect='equal'))
+ ax.quiver(0, 0, 1, 1, angles='xy', scale_units='xy', scale=1)
+ ax.set_xlim(0, 1.1)
+ ax.set_ylim(0, 1.1)
+ ax.grid()
+
+
+def test_quiverkey_angles():
+ # Check that only a single arrow is plotted for a quiverkey when an array
+ # of angles is given to the original quiver plot
+ fig, ax = plt.subplots()
+
+ X, Y = np.meshgrid(np.arange(2), np.arange(2))
+ U = V = angles = np.ones_like(X)
+
+ q = ax.quiver(X, Y, U, V, angles=angles)
+ qk = ax.quiverkey(q, 1, 1, 2, 'Label')
+ # The arrows are only created when the key is drawn
+ fig.canvas.draw()
+ assert len(qk.verts) == 1
+
+
+def test_quiver_setuvc_numbers():
+ """Check that it is possible to set all arrow UVC to the same numbers"""
+
+ fig, ax = plt.subplots()
+
+ X, Y = np.meshgrid(np.arange(2), np.arange(2))
+ U = V = np.ones_like(X)
+
+ q = ax.quiver(X, Y, U, V)
+ q.set_UVC(0, 1)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_rcparams.py b/venv/Lib/site-packages/matplotlib/tests/test_rcparams.py
new file mode 100644
index 0000000..4705b97
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_rcparams.py
@@ -0,0 +1,503 @@
+from collections import OrderedDict
+import copy
+import os
+from pathlib import Path
+import subprocess
+import sys
+from unittest import mock
+
+from cycler import cycler, Cycler
+import pytest
+
+import matplotlib as mpl
+from matplotlib import _api, _c_internal_utils
+import matplotlib.pyplot as plt
+import matplotlib.colors as mcolors
+import numpy as np
+from matplotlib.rcsetup import (
+ validate_bool,
+ validate_bool_maybe_none,
+ validate_color,
+ validate_colorlist,
+ validate_cycler,
+ validate_float,
+ validate_fontweight,
+ validate_hatch,
+ validate_hist_bins,
+ validate_int,
+ validate_markevery,
+ validate_stringlist,
+ _validate_linestyle,
+ _listify_validator)
+
+
+def test_rcparams(tmpdir):
+ mpl.rc('text', usetex=False)
+ mpl.rc('lines', linewidth=22)
+
+ usetex = mpl.rcParams['text.usetex']
+ linewidth = mpl.rcParams['lines.linewidth']
+
+ rcpath = Path(tmpdir) / 'test_rcparams.rc'
+ rcpath.write_text('lines.linewidth: 33')
+
+ # test context given dictionary
+ with mpl.rc_context(rc={'text.usetex': not usetex}):
+ assert mpl.rcParams['text.usetex'] == (not usetex)
+ assert mpl.rcParams['text.usetex'] == usetex
+
+ # test context given filename (mpl.rc sets linewidth to 33)
+ with mpl.rc_context(fname=rcpath):
+ assert mpl.rcParams['lines.linewidth'] == 33
+ assert mpl.rcParams['lines.linewidth'] == linewidth
+
+ # test context given filename and dictionary
+ with mpl.rc_context(fname=rcpath, rc={'lines.linewidth': 44}):
+ assert mpl.rcParams['lines.linewidth'] == 44
+ assert mpl.rcParams['lines.linewidth'] == linewidth
+
+ # test context as decorator (and test reusability, by calling func twice)
+ @mpl.rc_context({'lines.linewidth': 44})
+ def func():
+ assert mpl.rcParams['lines.linewidth'] == 44
+
+ func()
+ func()
+
+ # test rc_file
+ mpl.rc_file(rcpath)
+ assert mpl.rcParams['lines.linewidth'] == 33
+
+
+def test_RcParams_class():
+ rc = mpl.RcParams({'font.cursive': ['Apple Chancery',
+ 'Textile',
+ 'Zapf Chancery',
+ 'cursive'],
+ 'font.family': 'sans-serif',
+ 'font.weight': 'normal',
+ 'font.size': 12})
+
+ expected_repr = """
+RcParams({'font.cursive': ['Apple Chancery',
+ 'Textile',
+ 'Zapf Chancery',
+ 'cursive'],
+ 'font.family': ['sans-serif'],
+ 'font.size': 12.0,
+ 'font.weight': 'normal'})""".lstrip()
+
+ assert expected_repr == repr(rc)
+
+ expected_str = """
+font.cursive: ['Apple Chancery', 'Textile', 'Zapf Chancery', 'cursive']
+font.family: ['sans-serif']
+font.size: 12.0
+font.weight: normal""".lstrip()
+
+ assert expected_str == str(rc)
+
+ # test the find_all functionality
+ assert ['font.cursive', 'font.size'] == sorted(rc.find_all('i[vz]'))
+ assert ['font.family'] == list(rc.find_all('family'))
+
+
+def test_rcparams_update():
+ rc = mpl.RcParams({'figure.figsize': (3.5, 42)})
+ bad_dict = {'figure.figsize': (3.5, 42, 1)}
+ # make sure validation happens on input
+ with pytest.raises(ValueError), \
+ pytest.warns(UserWarning, match="validate"):
+ rc.update(bad_dict)
+
+
+def test_rcparams_init():
+ with pytest.raises(ValueError), \
+ pytest.warns(UserWarning, match="validate"):
+ mpl.RcParams({'figure.figsize': (3.5, 42, 1)})
+
+
+def test_Bug_2543():
+ # Test that it possible to add all values to itself / deepcopy
+ # This was not possible because validate_bool_maybe_none did not
+ # accept None as an argument.
+ # https://github.com/matplotlib/matplotlib/issues/2543
+ # We filter warnings at this stage since a number of them are raised
+ # for deprecated rcparams as they should. We don't want these in the
+ # printed in the test suite.
+ with _api.suppress_matplotlib_deprecation_warning():
+ with mpl.rc_context():
+ _copy = mpl.rcParams.copy()
+ for key in _copy:
+ mpl.rcParams[key] = _copy[key]
+ with mpl.rc_context():
+ copy.deepcopy(mpl.rcParams)
+ # real test is that this does not raise
+ assert validate_bool_maybe_none(None) is None
+ assert validate_bool_maybe_none("none") is None
+ with pytest.raises(ValueError):
+ validate_bool_maybe_none("blah")
+ with pytest.raises(ValueError):
+ validate_bool(None)
+ with pytest.raises(ValueError):
+ with mpl.rc_context():
+ mpl.rcParams['svg.fonttype'] = True
+
+
+legend_color_tests = [
+ ('face', {'color': 'r'}, mcolors.to_rgba('r')),
+ ('face', {'color': 'inherit', 'axes.facecolor': 'r'},
+ mcolors.to_rgba('r')),
+ ('face', {'color': 'g', 'axes.facecolor': 'r'}, mcolors.to_rgba('g')),
+ ('edge', {'color': 'r'}, mcolors.to_rgba('r')),
+ ('edge', {'color': 'inherit', 'axes.edgecolor': 'r'},
+ mcolors.to_rgba('r')),
+ ('edge', {'color': 'g', 'axes.facecolor': 'r'}, mcolors.to_rgba('g'))
+]
+legend_color_test_ids = [
+ 'same facecolor',
+ 'inherited facecolor',
+ 'different facecolor',
+ 'same edgecolor',
+ 'inherited edgecolor',
+ 'different facecolor',
+]
+
+
+@pytest.mark.parametrize('color_type, param_dict, target', legend_color_tests,
+ ids=legend_color_test_ids)
+def test_legend_colors(color_type, param_dict, target):
+ param_dict[f'legend.{color_type}color'] = param_dict.pop('color')
+ get_func = f'get_{color_type}color'
+
+ with mpl.rc_context(param_dict):
+ _, ax = plt.subplots()
+ ax.plot(range(3), label='test')
+ leg = ax.legend()
+ assert getattr(leg.legendPatch, get_func)() == target
+
+
+def test_mfc_rcparams():
+ mpl.rcParams['lines.markerfacecolor'] = 'r'
+ ln = mpl.lines.Line2D([1, 2], [1, 2])
+ assert ln.get_markerfacecolor() == 'r'
+
+
+def test_mec_rcparams():
+ mpl.rcParams['lines.markeredgecolor'] = 'r'
+ ln = mpl.lines.Line2D([1, 2], [1, 2])
+ assert ln.get_markeredgecolor() == 'r'
+
+
+def test_axes_titlecolor_rcparams():
+ mpl.rcParams['axes.titlecolor'] = 'r'
+ _, ax = plt.subplots()
+ title = ax.set_title("Title")
+ assert title.get_color() == 'r'
+
+
+def test_Issue_1713(tmpdir):
+ rcpath = Path(tmpdir) / 'test_rcparams.rc'
+ rcpath.write_text('timezone: UTC', encoding='UTF-32-BE')
+ with mock.patch('locale.getpreferredencoding', return_value='UTF-32-BE'):
+ rc = mpl.rc_params_from_file(rcpath, True, False)
+ assert rc.get('timezone') == 'UTC'
+
+
+def test_animation_frame_formats():
+ # Animation frame_format should allow any of the following
+ # if any of these are not allowed, an exception will be raised
+ # test for gh issue #17908
+ for fmt in ['png', 'jpeg', 'tiff', 'raw', 'rgba', 'ppm',
+ 'sgi', 'bmp', 'pbm', 'svg']:
+ mpl.rcParams['animation.frame_format'] = fmt
+
+
+def generate_validator_testcases(valid):
+ validation_tests = (
+ {'validator': validate_bool,
+ 'success': (*((_, True) for _ in
+ ('t', 'y', 'yes', 'on', 'true', '1', 1, True)),
+ *((_, False) for _ in
+ ('f', 'n', 'no', 'off', 'false', '0', 0, False))),
+ 'fail': ((_, ValueError)
+ for _ in ('aardvark', 2, -1, [], ))
+ },
+ {'validator': validate_stringlist,
+ 'success': (('', []),
+ ('a,b', ['a', 'b']),
+ ('aardvark', ['aardvark']),
+ ('aardvark, ', ['aardvark']),
+ ('aardvark, ,', ['aardvark']),
+ (['a', 'b'], ['a', 'b']),
+ (('a', 'b'), ['a', 'b']),
+ (iter(['a', 'b']), ['a', 'b']),
+ (np.array(['a', 'b']), ['a', 'b']),
+ ((1, 2), ['1', '2']),
+ (np.array([1, 2]), ['1', '2']),
+ ),
+ 'fail': ((set(), ValueError),
+ (1, ValueError),
+ )
+ },
+ {'validator': _listify_validator(validate_int, n=2),
+ 'success': ((_, [1, 2])
+ for _ in ('1, 2', [1.5, 2.5], [1, 2],
+ (1, 2), np.array((1, 2)))),
+ 'fail': ((_, ValueError)
+ for _ in ('aardvark', ('a', 1),
+ (1, 2, 3)
+ ))
+ },
+ {'validator': _listify_validator(validate_float, n=2),
+ 'success': ((_, [1.5, 2.5])
+ for _ in ('1.5, 2.5', [1.5, 2.5], [1.5, 2.5],
+ (1.5, 2.5), np.array((1.5, 2.5)))),
+ 'fail': ((_, ValueError)
+ for _ in ('aardvark', ('a', 1), (1, 2, 3), (None, ), None))
+ },
+ {'validator': validate_cycler,
+ 'success': (('cycler("color", "rgb")',
+ cycler("color", 'rgb')),
+ (cycler('linestyle', ['-', '--']),
+ cycler('linestyle', ['-', '--'])),
+ ("""(cycler("color", ["r", "g", "b"]) +
+ cycler("mew", [2, 3, 5]))""",
+ (cycler("color", 'rgb') +
+ cycler("markeredgewidth", [2, 3, 5]))),
+ ("cycler(c='rgb', lw=[1, 2, 3])",
+ cycler('color', 'rgb') + cycler('linewidth', [1, 2, 3])),
+ ("cycler('c', 'rgb') * cycler('linestyle', ['-', '--'])",
+ (cycler('color', 'rgb') *
+ cycler('linestyle', ['-', '--']))),
+ (cycler('ls', ['-', '--']),
+ cycler('linestyle', ['-', '--'])),
+ (cycler(mew=[2, 5]),
+ cycler('markeredgewidth', [2, 5])),
+ ),
+ # This is *so* incredibly important: validate_cycler() eval's
+ # an arbitrary string! I think I have it locked down enough,
+ # and that is what this is testing.
+ # TODO: Note that these tests are actually insufficient, as it may
+ # be that they raised errors, but still did an action prior to
+ # raising the exception. We should devise some additional tests
+ # for that...
+ 'fail': ((4, ValueError), # Gotta be a string or Cycler object
+ ('cycler("bleh, [])', ValueError), # syntax error
+ ('Cycler("linewidth", [1, 2, 3])',
+ ValueError), # only 'cycler()' function is allowed
+ ('1 + 2', ValueError), # doesn't produce a Cycler object
+ ('os.system("echo Gotcha")', ValueError), # os not available
+ ('import os', ValueError), # should not be able to import
+ ('def badjuju(a): return a; badjuju(cycler("color", "rgb"))',
+ ValueError), # Should not be able to define anything
+ # even if it does return a cycler
+ ('cycler("waka", [1, 2, 3])', ValueError), # not a property
+ ('cycler(c=[1, 2, 3])', ValueError), # invalid values
+ ("cycler(lw=['a', 'b', 'c'])", ValueError), # invalid values
+ (cycler('waka', [1, 3, 5]), ValueError), # not a property
+ (cycler('color', ['C1', 'r', 'g']), ValueError) # no CN
+ )
+ },
+ {'validator': validate_hatch,
+ 'success': (('--|', '--|'), ('\\oO', '\\oO'),
+ ('/+*/.x', '/+*/.x'), ('', '')),
+ 'fail': (('--_', ValueError),
+ (8, ValueError),
+ ('X', ValueError)),
+ },
+ {'validator': validate_colorlist,
+ 'success': (('r,g,b', ['r', 'g', 'b']),
+ (['r', 'g', 'b'], ['r', 'g', 'b']),
+ ('r, ,', ['r']),
+ (['', 'g', 'blue'], ['g', 'blue']),
+ ([np.array([1, 0, 0]), np.array([0, 1, 0])],
+ np.array([[1, 0, 0], [0, 1, 0]])),
+ (np.array([[1, 0, 0], [0, 1, 0]]),
+ np.array([[1, 0, 0], [0, 1, 0]])),
+ ),
+ 'fail': (('fish', ValueError),
+ ),
+ },
+ {'validator': validate_color,
+ 'success': (('None', 'none'),
+ ('none', 'none'),
+ ('AABBCC', '#AABBCC'), # RGB hex code
+ ('AABBCC00', '#AABBCC00'), # RGBA hex code
+ ('tab:blue', 'tab:blue'), # named color
+ ('C12', 'C12'), # color from cycle
+ ('(0, 1, 0)', (0.0, 1.0, 0.0)), # RGB tuple
+ ((0, 1, 0), (0, 1, 0)), # non-string version
+ ('(0, 1, 0, 1)', (0.0, 1.0, 0.0, 1.0)), # RGBA tuple
+ ((0, 1, 0, 1), (0, 1, 0, 1)), # non-string version
+ ),
+ 'fail': (('tab:veryblue', ValueError), # invalid name
+ ('(0, 1)', ValueError), # tuple with length < 3
+ ('(0, 1, 0, 1, 0)', ValueError), # tuple with length > 4
+ ('(0, 1, none)', ValueError), # cannot cast none to float
+ ('(0, 1, "0.5")', ValueError), # last one not a float
+ ),
+ },
+ {'validator': validate_hist_bins,
+ 'success': (('auto', 'auto'),
+ ('fd', 'fd'),
+ ('10', 10),
+ ('1, 2, 3', [1, 2, 3]),
+ ([1, 2, 3], [1, 2, 3]),
+ (np.arange(15), np.arange(15))
+ ),
+ 'fail': (('aardvark', ValueError),
+ )
+ },
+ {'validator': validate_markevery,
+ 'success': ((None, None),
+ (1, 1),
+ (0.1, 0.1),
+ ((1, 1), (1, 1)),
+ ((0.1, 0.1), (0.1, 0.1)),
+ ([1, 2, 3], [1, 2, 3]),
+ (slice(2), slice(None, 2, None)),
+ (slice(1, 2, 3), slice(1, 2, 3))
+ ),
+ 'fail': (((1, 2, 3), TypeError),
+ ([1, 2, 0.3], TypeError),
+ (['a', 2, 3], TypeError),
+ ([1, 2, 'a'], TypeError),
+ ((0.1, 0.2, 0.3), TypeError),
+ ((0.1, 2, 3), TypeError),
+ ((1, 0.2, 0.3), TypeError),
+ ((1, 0.1), TypeError),
+ ((0.1, 1), TypeError),
+ (('abc'), TypeError),
+ ((1, 'a'), TypeError),
+ ((0.1, 'b'), TypeError),
+ (('a', 1), TypeError),
+ (('a', 0.1), TypeError),
+ ('abc', TypeError),
+ ('a', TypeError),
+ (object(), TypeError)
+ )
+ },
+ {'validator': _validate_linestyle,
+ 'success': (('-', '-'), ('solid', 'solid'),
+ ('--', '--'), ('dashed', 'dashed'),
+ ('-.', '-.'), ('dashdot', 'dashdot'),
+ (':', ':'), ('dotted', 'dotted'),
+ ('', ''), (' ', ' '),
+ ('None', 'none'), ('none', 'none'),
+ ('DoTtEd', 'dotted'), # case-insensitive
+ ('1, 3', (0, (1, 3))),
+ ([1.23, 456], (0, [1.23, 456.0])),
+ ([1, 2, 3, 4], (0, [1.0, 2.0, 3.0, 4.0])),
+ ((0, [1, 2]), (0, [1, 2])),
+ ((-1, [1, 2]), (-1, [1, 2])),
+ ),
+ 'fail': (('aardvark', ValueError), # not a valid string
+ (b'dotted', ValueError),
+ ('dotted'.encode('utf-16'), ValueError),
+ ([1, 2, 3], ValueError), # sequence with odd length
+ (1.23, ValueError), # not a sequence
+ (("a", [1, 2]), ValueError), # wrong explicit offset
+ ((1, [1, 2, 3]), ValueError), # odd length sequence
+ (([1, 2], 1), ValueError), # inverted offset/onoff
+ )
+ },
+ )
+
+ for validator_dict in validation_tests:
+ validator = validator_dict['validator']
+ if valid:
+ for arg, target in validator_dict['success']:
+ yield validator, arg, target
+ else:
+ for arg, error_type in validator_dict['fail']:
+ yield validator, arg, error_type
+
+
+@pytest.mark.parametrize('validator, arg, target',
+ generate_validator_testcases(True))
+def test_validator_valid(validator, arg, target):
+ res = validator(arg)
+ if isinstance(target, np.ndarray):
+ np.testing.assert_equal(res, target)
+ elif not isinstance(target, Cycler):
+ assert res == target
+ else:
+ # Cyclers can't simply be asserted equal. They don't implement __eq__
+ assert list(res) == list(target)
+
+
+@pytest.mark.parametrize('validator, arg, exception_type',
+ generate_validator_testcases(False))
+def test_validator_invalid(validator, arg, exception_type):
+ with pytest.raises(exception_type):
+ validator(arg)
+
+
+@pytest.mark.parametrize('weight, parsed_weight', [
+ ('bold', 'bold'),
+ ('BOLD', ValueError), # weight is case-sensitive
+ (100, 100),
+ ('100', 100),
+ (np.array(100), 100),
+ # fractional fontweights are not defined. This should actually raise a
+ # ValueError, but historically did not.
+ (20.6, 20),
+ ('20.6', ValueError),
+ ([100], ValueError),
+])
+def test_validate_fontweight(weight, parsed_weight):
+ if parsed_weight is ValueError:
+ with pytest.raises(ValueError):
+ validate_fontweight(weight)
+ else:
+ assert validate_fontweight(weight) == parsed_weight
+
+
+def test_keymaps():
+ key_list = [k for k in mpl.rcParams if 'keymap' in k]
+ for k in key_list:
+ assert isinstance(mpl.rcParams[k], list)
+
+
+def test_rcparams_reset_after_fail():
+ # There was previously a bug that meant that if rc_context failed and
+ # raised an exception due to issues in the supplied rc parameters, the
+ # global rc parameters were left in a modified state.
+ with mpl.rc_context(rc={'text.usetex': False}):
+ assert mpl.rcParams['text.usetex'] is False
+ with pytest.raises(KeyError):
+ with mpl.rc_context(rc=OrderedDict([('text.usetex', True),
+ ('test.blah', True)])):
+ pass
+ assert mpl.rcParams['text.usetex'] is False
+
+
+@pytest.mark.skipif(sys.platform != "linux", reason="Linux only")
+def test_backend_fallback_headless(tmpdir):
+ env = {**os.environ,
+ "DISPLAY": "", "WAYLAND_DISPLAY": "",
+ "MPLBACKEND": "", "MPLCONFIGDIR": str(tmpdir)}
+ with pytest.raises(subprocess.CalledProcessError):
+ subprocess.run(
+ [sys.executable, "-c",
+ ("import matplotlib;" +
+ "matplotlib.use('tkagg');" +
+ "import matplotlib.pyplot")
+ ],
+ env=env, check=True)
+
+
+@pytest.mark.skipif(
+ sys.platform == "linux" and not _c_internal_utils.display_is_valid(),
+ reason="headless")
+def test_backend_fallback_headful(tmpdir):
+ pytest.importorskip("tkinter")
+ env = {**os.environ, "MPLBACKEND": "", "MPLCONFIGDIR": str(tmpdir)}
+ backend = subprocess.check_output(
+ [sys.executable, "-c",
+ "import matplotlib.pyplot; print(matplotlib.get_backend())"],
+ env=env, universal_newlines=True)
+ # The actual backend will depend on what's installed, but at least tkagg is
+ # present.
+ assert backend.strip().lower() != "agg"
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_sankey.py b/venv/Lib/site-packages/matplotlib/tests/test_sankey.py
new file mode 100644
index 0000000..1851525
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_sankey.py
@@ -0,0 +1,24 @@
+from matplotlib.sankey import Sankey
+
+
+def test_sankey():
+ # lets just create a sankey instance and check the code runs
+ sankey = Sankey()
+ sankey.add()
+
+
+def test_label():
+ s = Sankey(flows=[0.25], labels=['First'], orientations=[-1])
+ assert s.diagrams[0].texts[0].get_text() == 'First\n0.25'
+
+
+def test_format_using_callable():
+ # test using callable by slightly incrementing above label example
+
+ def show_three_decimal_places(value):
+ return f'{value:.3f}'
+
+ s = Sankey(flows=[0.25], labels=['First'], orientations=[-1],
+ format=show_three_decimal_places)
+
+ assert s.diagrams[0].texts[0].get_text() == 'First\n0.250'
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_scale.py b/venv/Lib/site-packages/matplotlib/tests/test_scale.py
new file mode 100644
index 0000000..8fba86d
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_scale.py
@@ -0,0 +1,221 @@
+import copy
+
+import matplotlib.pyplot as plt
+from matplotlib.scale import (
+ LogTransform, InvertedLogTransform,
+ SymmetricalLogTransform)
+import matplotlib.scale as mscale
+from matplotlib.testing.decorators import check_figures_equal, image_comparison
+
+import numpy as np
+from numpy.testing import assert_allclose
+import io
+import pytest
+
+
+@check_figures_equal()
+def test_log_scales(fig_test, fig_ref):
+ ax_test = fig_test.add_subplot(122, yscale='log', xscale='symlog')
+ ax_test.axvline(24.1)
+ ax_test.axhline(24.1)
+ xlim = ax_test.get_xlim()
+ ylim = ax_test.get_ylim()
+ ax_ref = fig_ref.add_subplot(122, yscale='log', xscale='symlog')
+ ax_ref.set(xlim=xlim, ylim=ylim)
+ ax_ref.plot([24.1, 24.1], ylim, 'b')
+ ax_ref.plot(xlim, [24.1, 24.1], 'b')
+
+
+def test_symlog_mask_nan():
+ # Use a transform round-trip to verify that the forward and inverse
+ # transforms work, and that they respect nans and/or masking.
+ slt = SymmetricalLogTransform(10, 2, 1)
+ slti = slt.inverted()
+
+ x = np.arange(-1.5, 5, 0.5)
+ out = slti.transform_non_affine(slt.transform_non_affine(x))
+ assert_allclose(out, x)
+ assert type(out) == type(x)
+
+ x[4] = np.nan
+ out = slti.transform_non_affine(slt.transform_non_affine(x))
+ assert_allclose(out, x)
+ assert type(out) == type(x)
+
+ x = np.ma.array(x)
+ out = slti.transform_non_affine(slt.transform_non_affine(x))
+ assert_allclose(out, x)
+ assert type(out) == type(x)
+
+ x[3] = np.ma.masked
+ out = slti.transform_non_affine(slt.transform_non_affine(x))
+ assert_allclose(out, x)
+ assert type(out) == type(x)
+
+
+@image_comparison(['logit_scales.png'], remove_text=True)
+def test_logit_scales():
+ fig, ax = plt.subplots()
+
+ # Typical extinction curve for logit
+ x = np.array([0.001, 0.003, 0.01, 0.03, 0.1, 0.2, 0.3, 0.4, 0.5,
+ 0.6, 0.7, 0.8, 0.9, 0.97, 0.99, 0.997, 0.999])
+ y = 1.0 / x
+
+ ax.plot(x, y)
+ ax.set_xscale('logit')
+ ax.grid(True)
+ bbox = ax.get_tightbbox(fig.canvas.get_renderer())
+ assert np.isfinite(bbox.x0)
+ assert np.isfinite(bbox.y0)
+
+
+def test_log_scatter():
+ """Issue #1799"""
+ fig, ax = plt.subplots(1)
+
+ x = np.arange(10)
+ y = np.arange(10) - 1
+
+ ax.scatter(x, y)
+
+ buf = io.BytesIO()
+ fig.savefig(buf, format='pdf')
+
+ buf = io.BytesIO()
+ fig.savefig(buf, format='eps')
+
+ buf = io.BytesIO()
+ fig.savefig(buf, format='svg')
+
+
+def test_logscale_subs():
+ fig, ax = plt.subplots()
+ ax.set_yscale('log', subs=np.array([2, 3, 4]))
+ # force draw
+ fig.canvas.draw()
+
+
+@image_comparison(['logscale_mask.png'], remove_text=True)
+def test_logscale_mask():
+ # Check that zero values are masked correctly on log scales.
+ # See github issue 8045
+ xs = np.linspace(0, 50, 1001)
+
+ fig, ax = plt.subplots()
+ ax.plot(np.exp(-xs**2))
+ fig.canvas.draw()
+ ax.set(yscale="log")
+
+
+def test_extra_kwargs_raise():
+ fig, ax = plt.subplots()
+
+ for scale in ['linear', 'log', 'symlog']:
+ with pytest.raises(TypeError):
+ ax.set_yscale(scale, foo='mask')
+
+
+def test_logscale_invert_transform():
+ fig, ax = plt.subplots()
+ ax.set_yscale('log')
+ # get transformation from data to axes
+ tform = (ax.transAxes + ax.transData.inverted()).inverted()
+
+ # direct test of log transform inversion
+ inverted_transform = LogTransform(base=2).inverted()
+ assert isinstance(inverted_transform, InvertedLogTransform)
+ assert inverted_transform.base == 2
+
+
+def test_logscale_transform_repr():
+ fig, ax = plt.subplots()
+ ax.set_yscale('log')
+ repr(ax.transData)
+ repr(LogTransform(10, nonpositive='clip'))
+
+
+@image_comparison(['logscale_nonpos_values.png'],
+ remove_text=True, tol=0.02, style='mpl20')
+def test_logscale_nonpos_values():
+ np.random.seed(19680801)
+ xs = np.random.normal(size=int(1e3))
+ fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2)
+ ax1.hist(xs, range=(-5, 5), bins=10)
+ ax1.set_yscale('log')
+ ax2.hist(xs, range=(-5, 5), bins=10)
+ ax2.set_yscale('log', nonpositive='mask')
+
+ xdata = np.arange(0, 10, 0.01)
+ ydata = np.exp(-xdata)
+ edata = 0.2*(10-xdata)*np.cos(5*xdata)*np.exp(-xdata)
+
+ ax3.fill_between(xdata, ydata - edata, ydata + edata)
+ ax3.set_yscale('log')
+
+ x = np.logspace(-1, 1)
+ y = x ** 3
+ yerr = x**2
+ ax4.errorbar(x, y, yerr=yerr)
+
+ ax4.set_yscale('log')
+ ax4.set_xscale('log')
+
+
+def test_invalid_log_lims():
+ # Check that invalid log scale limits are ignored
+ fig, ax = plt.subplots()
+ ax.scatter(range(0, 4), range(0, 4))
+
+ ax.set_xscale('log')
+ original_xlim = ax.get_xlim()
+ with pytest.warns(UserWarning):
+ ax.set_xlim(left=0)
+ assert ax.get_xlim() == original_xlim
+ with pytest.warns(UserWarning):
+ ax.set_xlim(right=-1)
+ assert ax.get_xlim() == original_xlim
+
+ ax.set_yscale('log')
+ original_ylim = ax.get_ylim()
+ with pytest.warns(UserWarning):
+ ax.set_ylim(bottom=0)
+ assert ax.get_ylim() == original_ylim
+ with pytest.warns(UserWarning):
+ ax.set_ylim(top=-1)
+ assert ax.get_ylim() == original_ylim
+
+
+@image_comparison(['function_scales.png'], remove_text=True, style='mpl20')
+def test_function_scale():
+ def inverse(x):
+ return x**2
+
+ def forward(x):
+ return x**(1/2)
+
+ fig, ax = plt.subplots()
+
+ x = np.arange(1, 1000)
+
+ ax.plot(x, x)
+ ax.set_xscale('function', functions=(forward, inverse))
+ ax.set_xlim(1, 1000)
+
+
+def test_pass_scale():
+ # test passing a scale object works...
+ fig, ax = plt.subplots()
+ scale = mscale.LogScale(axis=None)
+ ax.set_xscale(scale)
+ scale = mscale.LogScale(axis=None)
+ ax.set_yscale(scale)
+ assert ax.xaxis.get_scale() == 'log'
+ assert ax.yaxis.get_scale() == 'log'
+
+
+def test_scale_deepcopy():
+ sc = mscale.LogScale(axis='x', base=10)
+ sc2 = copy.deepcopy(sc)
+ assert str(sc.get_transform()) == str(sc2.get_transform())
+ assert sc._transform is not sc2._transform
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_simplification.py b/venv/Lib/site-packages/matplotlib/tests/test_simplification.py
new file mode 100644
index 0000000..0728761
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_simplification.py
@@ -0,0 +1,345 @@
+import base64
+import io
+
+import numpy as np
+from numpy.testing import assert_array_almost_equal, assert_array_equal
+
+import pytest
+
+from matplotlib.testing.decorators import image_comparison
+import matplotlib.pyplot as plt
+
+from matplotlib import patches, transforms
+from matplotlib.path import Path
+
+
+# NOTE: All of these tests assume that path.simplify is set to True
+# (the default)
+
+@image_comparison(['clipping'], remove_text=True)
+def test_clipping():
+ t = np.arange(0.0, 2.0, 0.01)
+ s = np.sin(2*np.pi*t)
+
+ fig, ax = plt.subplots()
+ ax.plot(t, s, linewidth=1.0)
+ ax.set_ylim((-0.20, -0.28))
+
+
+@image_comparison(['overflow'], remove_text=True)
+def test_overflow():
+ x = np.array([1.0, 2.0, 3.0, 2.0e5])
+ y = np.arange(len(x))
+
+ fig, ax = plt.subplots()
+ ax.plot(x, y)
+ ax.set_xlim(2, 6)
+
+
+@image_comparison(['clipping_diamond'], remove_text=True)
+def test_diamond():
+ x = np.array([0.0, 1.0, 0.0, -1.0, 0.0])
+ y = np.array([1.0, 0.0, -1.0, 0.0, 1.0])
+
+ fig, ax = plt.subplots()
+ ax.plot(x, y)
+ ax.set_xlim(-0.6, 0.6)
+ ax.set_ylim(-0.6, 0.6)
+
+
+def test_noise():
+ np.random.seed(0)
+ x = np.random.uniform(size=50000) * 50
+
+ fig, ax = plt.subplots()
+ p1 = ax.plot(x, solid_joinstyle='round', linewidth=2.0)
+
+ # Ensure that the path's transform takes the new axes limits into account.
+ fig.canvas.draw()
+ path = p1[0].get_path()
+ transform = p1[0].get_transform()
+ path = transform.transform_path(path)
+ simplified = path.cleaned(simplify=True)
+
+ assert simplified.vertices.size == 25512
+
+
+def test_antiparallel_simplification():
+ def _get_simplified(x, y):
+ fig, ax = plt.subplots()
+ p1 = ax.plot(x, y)
+
+ path = p1[0].get_path()
+ transform = p1[0].get_transform()
+ path = transform.transform_path(path)
+ simplified = path.cleaned(simplify=True)
+ simplified = transform.inverted().transform_path(simplified)
+
+ return simplified
+
+ # test ending on a maximum
+ x = [0, 0, 0, 0, 0, 1]
+ y = [.5, 1, -1, 1, 2, .5]
+
+ simplified = _get_simplified(x, y)
+
+ assert_array_almost_equal([[0., 0.5],
+ [0., -1.],
+ [0., 2.],
+ [1., 0.5]],
+ simplified.vertices[:-2, :])
+
+ # test ending on a minimum
+ x = [0, 0, 0, 0, 0, 1]
+ y = [.5, 1, -1, 1, -2, .5]
+
+ simplified = _get_simplified(x, y)
+
+ assert_array_almost_equal([[0., 0.5],
+ [0., 1.],
+ [0., -2.],
+ [1., 0.5]],
+ simplified.vertices[:-2, :])
+
+ # test ending in between
+ x = [0, 0, 0, 0, 0, 1]
+ y = [.5, 1, -1, 1, 0, .5]
+
+ simplified = _get_simplified(x, y)
+
+ assert_array_almost_equal([[0., 0.5],
+ [0., 1.],
+ [0., -1.],
+ [0., 0.],
+ [1., 0.5]],
+ simplified.vertices[:-2, :])
+
+ # test no anti-parallel ending at max
+ x = [0, 0, 0, 0, 0, 1]
+ y = [.5, 1, 2, 1, 3, .5]
+
+ simplified = _get_simplified(x, y)
+
+ assert_array_almost_equal([[0., 0.5],
+ [0., 3.],
+ [1., 0.5]],
+ simplified.vertices[:-2, :])
+
+ # test no anti-parallel ending in middle
+ x = [0, 0, 0, 0, 0, 1]
+ y = [.5, 1, 2, 1, 1, .5]
+
+ simplified = _get_simplified(x, y)
+
+ assert_array_almost_equal([[0., 0.5],
+ [0., 2.],
+ [0., 1.],
+ [1., 0.5]],
+ simplified.vertices[:-2, :])
+
+
+# Only consider angles in 0 <= angle <= pi/2, otherwise
+# using min/max will get the expected results out of order:
+# min/max for simplification code depends on original vector,
+# and if angle is outside above range then simplification
+# min/max will be opposite from actual min/max.
+@pytest.mark.parametrize('angle', [0, np.pi/4, np.pi/3, np.pi/2])
+@pytest.mark.parametrize('offset', [0, .5])
+def test_angled_antiparallel(angle, offset):
+ scale = 5
+ np.random.seed(19680801)
+ # get 15 random offsets
+ # TODO: guarantee offset > 0 results in some offsets < 0
+ vert_offsets = (np.random.rand(15) - offset) * scale
+ # always start at 0 so rotation makes sense
+ vert_offsets[0] = 0
+ # always take the first step the same direction
+ vert_offsets[1] = 1
+ # compute points along a diagonal line
+ x = np.sin(angle) * vert_offsets
+ y = np.cos(angle) * vert_offsets
+
+ # will check these later
+ x_max = x[1:].max()
+ x_min = x[1:].min()
+
+ y_max = y[1:].max()
+ y_min = y[1:].min()
+
+ if offset > 0:
+ p_expected = Path([[0, 0],
+ [x_max, y_max],
+ [x_min, y_min],
+ [x[-1], y[-1]],
+ [0, 0]],
+ codes=[1, 2, 2, 2, 0])
+
+ else:
+ p_expected = Path([[0, 0],
+ [x_max, y_max],
+ [x[-1], y[-1]],
+ [0, 0]],
+ codes=[1, 2, 2, 0])
+
+ p = Path(np.vstack([x, y]).T)
+ p2 = p.cleaned(simplify=True)
+
+ assert_array_almost_equal(p_expected.vertices,
+ p2.vertices)
+ assert_array_equal(p_expected.codes, p2.codes)
+
+
+def test_sine_plus_noise():
+ np.random.seed(0)
+ x = (np.sin(np.linspace(0, np.pi * 2.0, 50000)) +
+ np.random.uniform(size=50000) * 0.01)
+
+ fig, ax = plt.subplots()
+ p1 = ax.plot(x, solid_joinstyle='round', linewidth=2.0)
+
+ # Ensure that the path's transform takes the new axes limits into account.
+ fig.canvas.draw()
+ path = p1[0].get_path()
+ transform = p1[0].get_transform()
+ path = transform.transform_path(path)
+ simplified = path.cleaned(simplify=True)
+
+ assert simplified.vertices.size == 25240
+
+
+@image_comparison(['simplify_curve'], remove_text=True)
+def test_simplify_curve():
+ pp1 = patches.PathPatch(
+ Path([(0, 0), (1, 0), (1, 1), (np.nan, 1), (0, 0), (2, 0), (2, 2),
+ (0, 0)],
+ [Path.MOVETO, Path.CURVE3, Path.CURVE3, Path.CURVE3, Path.CURVE3,
+ Path.CURVE3, Path.CURVE3, Path.CLOSEPOLY]),
+ fc="none")
+
+ fig, ax = plt.subplots()
+ ax.add_patch(pp1)
+ ax.set_xlim((0, 2))
+ ax.set_ylim((0, 2))
+
+
+@image_comparison(['hatch_simplify'], remove_text=True)
+def test_hatch():
+ fig, ax = plt.subplots()
+ ax.add_patch(plt.Rectangle((0, 0), 1, 1, fill=False, hatch="/"))
+ ax.set_xlim((0.45, 0.55))
+ ax.set_ylim((0.45, 0.55))
+
+
+@image_comparison(['fft_peaks'], remove_text=True)
+def test_fft_peaks():
+ fig, ax = plt.subplots()
+ t = np.arange(65536)
+ p1 = ax.plot(abs(np.fft.fft(np.sin(2*np.pi*.01*t)*np.blackman(len(t)))))
+
+ # Ensure that the path's transform takes the new axes limits into account.
+ fig.canvas.draw()
+ path = p1[0].get_path()
+ transform = p1[0].get_transform()
+ path = transform.transform_path(path)
+ simplified = path.cleaned(simplify=True)
+
+ assert simplified.vertices.size == 36
+
+
+def test_start_with_moveto():
+ # Should be entirely clipped away to a single MOVETO
+ data = b"""
+ZwAAAAku+v9UAQAA+Tj6/z8CAADpQ/r/KAMAANlO+v8QBAAAyVn6//UEAAC6ZPr/2gUAAKpv+v+8
+BgAAm3r6/50HAACLhfr/ewgAAHyQ+v9ZCQAAbZv6/zQKAABepvr/DgsAAE+x+v/lCwAAQLz6/7wM
+AAAxx/r/kA0AACPS+v9jDgAAFN36/zQPAAAF6Pr/AxAAAPfy+v/QEAAA6f36/5wRAADbCPv/ZhIA
+AMwT+/8uEwAAvh77//UTAACwKfv/uRQAAKM0+/98FQAAlT/7/z0WAACHSvv//RYAAHlV+/+7FwAA
+bGD7/3cYAABea/v/MRkAAFF2+//pGQAARIH7/6AaAAA3jPv/VRsAACmX+/8JHAAAHKL7/7ocAAAP
+rfv/ah0AAAO4+/8YHgAA9sL7/8QeAADpzfv/bx8AANzY+/8YIAAA0OP7/78gAADD7vv/ZCEAALf5
++/8IIgAAqwT8/6kiAACeD/z/SiMAAJIa/P/oIwAAhiX8/4QkAAB6MPz/HyUAAG47/P+4JQAAYkb8
+/1AmAABWUfz/5SYAAEpc/P95JwAAPmf8/wsoAAAzcvz/nCgAACd9/P8qKQAAHIj8/7cpAAAQk/z/
+QyoAAAWe/P/MKgAA+aj8/1QrAADus/z/2isAAOO+/P9eLAAA2Mn8/+AsAADM1Pz/YS0AAMHf/P/g
+LQAAtur8/10uAACr9fz/2C4AAKEA/f9SLwAAlgv9/8ovAACLFv3/QDAAAIAh/f+1MAAAdSz9/ycx
+AABrN/3/mDEAAGBC/f8IMgAAVk39/3UyAABLWP3/4TIAAEFj/f9LMwAANm79/7MzAAAsef3/GjQA
+ACKE/f9+NAAAF4/9/+E0AAANmv3/QzUAAAOl/f+iNQAA+a/9/wA2AADvuv3/XDYAAOXF/f+2NgAA
+29D9/w83AADR2/3/ZjcAAMfm/f+7NwAAvfH9/w44AACz/P3/XzgAAKkH/v+vOAAAnxL+//04AACW
+Hf7/SjkAAIwo/v+UOQAAgjP+/905AAB5Pv7/JDoAAG9J/v9pOgAAZVT+/606AABcX/7/7zoAAFJq
+/v8vOwAASXX+/207AAA/gP7/qjsAADaL/v/lOwAALZb+/x48AAAjof7/VTwAABqs/v+LPAAAELf+
+/788AAAHwv7/8TwAAP7M/v8hPQAA9df+/1A9AADr4v7/fT0AAOLt/v+oPQAA2fj+/9E9AADQA///
++T0AAMYO//8fPgAAvRn//0M+AAC0JP//ZT4AAKsv//+GPgAAojr//6U+AACZRf//wj4AAJBQ///d
+PgAAh1v///c+AAB+Zv//Dz8AAHRx//8lPwAAa3z//zk/AABih///TD8AAFmS//9dPwAAUJ3//2w/
+AABHqP//ej8AAD6z//+FPwAANb7//48/AAAsyf//lz8AACPU//+ePwAAGt///6M/AAAR6v//pj8A
+AAj1//+nPwAA/////w=="""
+
+ verts = np.frombuffer(base64.decodebytes(data), dtype='"})
+ fig.canvas.draw() # Needed for the same reason as in test_contains.
+ event = MouseEvent(
+ "button_press_event", fig.canvas, *ax.transData.transform((.5, .6)))
+ assert ann.contains(event) == (False, {})
+
+
+@image_comparison(['titles'])
+def test_titles():
+ # left and right side titles
+ plt.figure()
+ ax = plt.subplot(1, 1, 1)
+ ax.set_title("left title", loc="left")
+ ax.set_title("right title", loc="right")
+ ax.set_xticks([])
+ ax.set_yticks([])
+
+
+@image_comparison(['text_alignment'], style='mpl20')
+def test_alignment():
+ plt.figure()
+ ax = plt.subplot(1, 1, 1)
+
+ x = 0.1
+ for rotation in (0, 30):
+ for alignment in ('top', 'bottom', 'baseline', 'center'):
+ ax.text(
+ x, 0.5, alignment + " Tj", va=alignment, rotation=rotation,
+ bbox=dict(boxstyle='round', facecolor='wheat', alpha=0.5))
+ ax.text(
+ x, 1.0, r'$\sum_{i=0}^{j}$', va=alignment, rotation=rotation)
+ x += 0.1
+
+ ax.plot([0, 1], [0.5, 0.5])
+ ax.plot([0, 1], [1.0, 1.0])
+
+ ax.set_xlim([0, 1])
+ ax.set_ylim([0, 1.5])
+ ax.set_xticks([])
+ ax.set_yticks([])
+
+
+@image_comparison(['axes_titles.png'])
+def test_axes_titles():
+ # Related to issue #3327
+ plt.figure()
+ ax = plt.subplot(1, 1, 1)
+ ax.set_title('center', loc='center', fontsize=20, fontweight=700)
+ ax.set_title('left', loc='left', fontsize=12, fontweight=400)
+ ax.set_title('right', loc='right', fontsize=12, fontweight=400)
+
+
+def test_set_position():
+ fig, ax = plt.subplots()
+
+ # test set_position
+ ann = ax.annotate(
+ 'test', (0, 0), xytext=(0, 0), textcoords='figure pixels')
+ fig.canvas.draw()
+
+ init_pos = ann.get_window_extent(fig.canvas.renderer)
+ shift_val = 15
+ ann.set_position((shift_val, shift_val))
+ fig.canvas.draw()
+ post_pos = ann.get_window_extent(fig.canvas.renderer)
+
+ for a, b in zip(init_pos.min, post_pos.min):
+ assert a + shift_val == b
+
+ # test xyann
+ ann = ax.annotate(
+ 'test', (0, 0), xytext=(0, 0), textcoords='figure pixels')
+ fig.canvas.draw()
+
+ init_pos = ann.get_window_extent(fig.canvas.renderer)
+ shift_val = 15
+ ann.xyann = (shift_val, shift_val)
+ fig.canvas.draw()
+ post_pos = ann.get_window_extent(fig.canvas.renderer)
+
+ for a, b in zip(init_pos.min, post_pos.min):
+ assert a + shift_val == b
+
+
+@pytest.mark.parametrize('text', ['', 'O'], ids=['empty', 'non-empty'])
+def test_non_default_dpi(text):
+ fig, ax = plt.subplots()
+
+ t1 = ax.text(0.5, 0.5, text, ha='left', va='bottom')
+ fig.canvas.draw()
+ dpi = fig.dpi
+
+ bbox1 = t1.get_window_extent()
+ bbox2 = t1.get_window_extent(dpi=dpi * 10)
+ np.testing.assert_allclose(bbox2.get_points(), bbox1.get_points() * 10,
+ rtol=5e-2)
+ # Text.get_window_extent should not permanently change dpi.
+ assert fig.dpi == dpi
+
+
+def test_get_rotation_string():
+ assert mpl.text.get_rotation('horizontal') == 0.
+ assert mpl.text.get_rotation('vertical') == 90.
+ assert mpl.text.get_rotation('15.') == 15.
+
+
+def test_get_rotation_float():
+ for i in [15., 16.70, 77.4]:
+ assert mpl.text.get_rotation(i) == i
+
+
+def test_get_rotation_int():
+ for i in [67, 16, 41]:
+ assert mpl.text.get_rotation(i) == float(i)
+
+
+def test_get_rotation_raises():
+ with pytest.raises(ValueError):
+ mpl.text.get_rotation('hozirontal')
+
+
+def test_get_rotation_none():
+ assert mpl.text.get_rotation(None) == 0.0
+
+
+def test_get_rotation_mod360():
+ for i, j in zip([360., 377., 720+177.2], [0., 17., 177.2]):
+ assert_almost_equal(mpl.text.get_rotation(i), j)
+
+
+@pytest.mark.parametrize("ha", ["center", "right", "left"])
+@pytest.mark.parametrize("va", ["center", "top", "bottom",
+ "baseline", "center_baseline"])
+def test_null_rotation_with_rotation_mode(ha, va):
+ fig, ax = plt.subplots()
+ kw = dict(rotation=0, va=va, ha=ha)
+ t0 = ax.text(.5, .5, 'test', rotation_mode='anchor', **kw)
+ t1 = ax.text(.5, .5, 'test', rotation_mode='default', **kw)
+ fig.canvas.draw()
+ assert_almost_equal(t0.get_window_extent(fig.canvas.renderer).get_points(),
+ t1.get_window_extent(fig.canvas.renderer).get_points())
+
+
+@image_comparison(['text_bboxclip'])
+def test_bbox_clipping():
+ plt.text(0.9, 0.2, 'Is bbox clipped?', backgroundcolor='r', clip_on=True)
+ t = plt.text(0.9, 0.5, 'Is fancy bbox clipped?', clip_on=True)
+ t.set_bbox({"boxstyle": "round, pad=0.1"})
+
+
+@image_comparison(['annotation_negative_ax_coords.png'])
+def test_annotation_negative_ax_coords():
+ fig, ax = plt.subplots()
+
+ ax.annotate('+ pts',
+ xytext=[30, 20], textcoords='axes points',
+ xy=[30, 20], xycoords='axes points', fontsize=32)
+ ax.annotate('- pts',
+ xytext=[30, -20], textcoords='axes points',
+ xy=[30, -20], xycoords='axes points', fontsize=32,
+ va='top')
+ ax.annotate('+ frac',
+ xytext=[0.75, 0.05], textcoords='axes fraction',
+ xy=[0.75, 0.05], xycoords='axes fraction', fontsize=32)
+ ax.annotate('- frac',
+ xytext=[0.75, -0.05], textcoords='axes fraction',
+ xy=[0.75, -0.05], xycoords='axes fraction', fontsize=32,
+ va='top')
+
+ ax.annotate('+ pixels',
+ xytext=[160, 25], textcoords='axes pixels',
+ xy=[160, 25], xycoords='axes pixels', fontsize=32)
+ ax.annotate('- pixels',
+ xytext=[160, -25], textcoords='axes pixels',
+ xy=[160, -25], xycoords='axes pixels', fontsize=32,
+ va='top')
+
+
+@image_comparison(['annotation_negative_fig_coords.png'])
+def test_annotation_negative_fig_coords():
+ fig, ax = plt.subplots()
+
+ ax.annotate('+ pts',
+ xytext=[10, 120], textcoords='figure points',
+ xy=[10, 120], xycoords='figure points', fontsize=32)
+ ax.annotate('- pts',
+ xytext=[-10, 180], textcoords='figure points',
+ xy=[-10, 180], xycoords='figure points', fontsize=32,
+ va='top')
+ ax.annotate('+ frac',
+ xytext=[0.05, 0.55], textcoords='figure fraction',
+ xy=[0.05, 0.55], xycoords='figure fraction', fontsize=32)
+ ax.annotate('- frac',
+ xytext=[-0.05, 0.5], textcoords='figure fraction',
+ xy=[-0.05, 0.5], xycoords='figure fraction', fontsize=32,
+ va='top')
+
+ ax.annotate('+ pixels',
+ xytext=[50, 50], textcoords='figure pixels',
+ xy=[50, 50], xycoords='figure pixels', fontsize=32)
+ ax.annotate('- pixels',
+ xytext=[-50, 100], textcoords='figure pixels',
+ xy=[-50, 100], xycoords='figure pixels', fontsize=32,
+ va='top')
+
+
+def test_text_stale():
+ fig, (ax1, ax2) = plt.subplots(1, 2)
+ plt.draw_all()
+ assert not ax1.stale
+ assert not ax2.stale
+ assert not fig.stale
+
+ txt1 = ax1.text(.5, .5, 'aardvark')
+ assert ax1.stale
+ assert txt1.stale
+ assert fig.stale
+
+ ann1 = ax2.annotate('aardvark', xy=[.5, .5])
+ assert ax2.stale
+ assert ann1.stale
+ assert fig.stale
+
+ plt.draw_all()
+ assert not ax1.stale
+ assert not ax2.stale
+ assert not fig.stale
+
+
+@image_comparison(['agg_text_clip.png'])
+def test_agg_text_clip():
+ np.random.seed(1)
+ fig, (ax1, ax2) = plt.subplots(2)
+ for x, y in np.random.rand(10, 2):
+ ax1.text(x, y, "foo", clip_on=True)
+ ax2.text(x, y, "foo")
+
+
+def test_text_size_binding():
+ mpl.rcParams['font.size'] = 10
+ fp = mpl.font_manager.FontProperties(size='large')
+ sz1 = fp.get_size_in_points()
+ mpl.rcParams['font.size'] = 100
+
+ assert sz1 == fp.get_size_in_points()
+
+
+@image_comparison(['font_scaling.pdf'])
+def test_font_scaling():
+ mpl.rcParams['pdf.fonttype'] = 42
+ fig, ax = plt.subplots(figsize=(6.4, 12.4))
+ ax.xaxis.set_major_locator(plt.NullLocator())
+ ax.yaxis.set_major_locator(plt.NullLocator())
+ ax.set_ylim(-10, 600)
+
+ for i, fs in enumerate(range(4, 43, 2)):
+ ax.text(0.1, i*30, "{fs} pt font size".format(fs=fs), fontsize=fs)
+
+
+@pytest.mark.parametrize('spacing1, spacing2', [(0.4, 2), (2, 0.4), (2, 2)])
+def test_two_2line_texts(spacing1, spacing2):
+ text_string = 'line1\nline2'
+ fig = plt.figure()
+ renderer = fig.canvas.get_renderer()
+
+ text1 = plt.text(0.25, 0.5, text_string, linespacing=spacing1)
+ text2 = plt.text(0.25, 0.5, text_string, linespacing=spacing2)
+ fig.canvas.draw()
+
+ box1 = text1.get_window_extent(renderer=renderer)
+ box2 = text2.get_window_extent(renderer=renderer)
+
+ # line spacing only affects height
+ assert box1.width == box2.width
+ if spacing1 == spacing2:
+ assert box1.height == box2.height
+ else:
+ assert box1.height != box2.height
+
+
+def test_nonfinite_pos():
+ fig, ax = plt.subplots()
+ ax.text(0, np.nan, 'nan')
+ ax.text(np.inf, 0, 'inf')
+ fig.canvas.draw()
+
+
+def test_hinting_factor_backends():
+ plt.rcParams['text.hinting_factor'] = 1
+ fig = plt.figure()
+ t = fig.text(0.5, 0.5, 'some text')
+
+ fig.savefig(io.BytesIO(), format='svg')
+ expected = t.get_window_extent().intervalx
+
+ fig.savefig(io.BytesIO(), format='png')
+ # Backends should apply hinting_factor consistently (within 10%).
+ np.testing.assert_allclose(t.get_window_extent().intervalx, expected,
+ rtol=0.1)
+
+
+@needs_usetex
+def test_usetex_is_copied():
+ # Indirectly tests that update_from (which is used to copy tick label
+ # properties) copies usetex state.
+ fig = plt.figure()
+ plt.rcParams["text.usetex"] = False
+ ax1 = fig.add_subplot(121)
+ plt.rcParams["text.usetex"] = True
+ ax2 = fig.add_subplot(122)
+ fig.canvas.draw()
+ for ax, usetex in [(ax1, False), (ax2, True)]:
+ for t in ax.xaxis.majorTicks:
+ assert t.label1.get_usetex() == usetex
+
+
+@needs_usetex
+def test_single_artist_usetex():
+ # Check that a single artist marked with usetex does not get passed through
+ # the mathtext parser at all (for the Agg backend) (the mathtext parser
+ # currently fails to parse \frac12, requiring \frac{1}{2} instead).
+ fig = plt.figure()
+ fig.text(.5, .5, r"$\frac12$", usetex=True)
+ fig.canvas.draw()
+
+
+@pytest.mark.parametrize("fmt", ["png", "pdf", "svg"])
+def test_single_artist_usenotex(fmt):
+ # Check that a single artist can be marked as not-usetex even though the
+ # rcParam is on ("2_2_2" fails if passed to TeX). This currently skips
+ # postscript output as the ps renderer doesn't support mixing usetex and
+ # non-usetex.
+ plt.rcParams["text.usetex"] = True
+ fig = plt.figure()
+ fig.text(.5, .5, "2_2_2", usetex=False)
+ fig.savefig(io.BytesIO(), format=fmt)
+
+
+@image_comparison(['text_as_path_opacity.svg'])
+def test_text_as_path_opacity():
+ plt.figure()
+ plt.gca().set_axis_off()
+ plt.text(0.25, 0.25, 'c', color=(0, 0, 0, 0.5))
+ plt.text(0.25, 0.5, 'a', alpha=0.5)
+ plt.text(0.25, 0.75, 'x', alpha=0.5, color=(0, 0, 0, 1))
+
+
+@image_comparison(['text_as_text_opacity.svg'])
+def test_text_as_text_opacity():
+ mpl.rcParams['svg.fonttype'] = 'none'
+ plt.figure()
+ plt.gca().set_axis_off()
+ plt.text(0.25, 0.25, '50% using `color`', color=(0, 0, 0, 0.5))
+ plt.text(0.25, 0.5, '50% using `alpha`', alpha=0.5)
+ plt.text(0.25, 0.75, '50% using `alpha` and 100% `color`', alpha=0.5,
+ color=(0, 0, 0, 1))
+
+
+def test_text_repr():
+ # smoketest to make sure text repr doesn't error for category
+ plt.plot(['A', 'B'], [1, 2])
+ repr(plt.text(['A'], 0.5, 'Boo'))
+
+
+def test_annotation_update():
+ fig, ax = plt.subplots(1, 1)
+ an = ax.annotate('annotation', xy=(0.5, 0.5))
+ extent1 = an.get_window_extent(fig.canvas.get_renderer())
+ fig.tight_layout()
+ extent2 = an.get_window_extent(fig.canvas.get_renderer())
+
+ assert not np.allclose(extent1.get_points(), extent2.get_points(),
+ rtol=1e-6)
+
+
+@check_figures_equal(extensions=["png"])
+def test_annotation_units(fig_test, fig_ref):
+ ax = fig_test.add_subplot()
+ ax.plot(datetime.now(), 1, "o") # Implicitly set axes extents.
+ ax.annotate("x", (datetime.now(), 0.5), xycoords=("data", "axes fraction"),
+ # This used to crash before.
+ xytext=(0, 0), textcoords="offset points")
+ ax = fig_ref.add_subplot()
+ ax.plot(datetime.now(), 1, "o")
+ ax.annotate("x", (datetime.now(), 0.5), xycoords=("data", "axes fraction"))
+
+
+@image_comparison(['large_subscript_title.png'], style='mpl20')
+def test_large_subscript_title():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['text.kerning_factor'] = 6
+ plt.rcParams['axes.titley'] = None
+
+ fig, axs = plt.subplots(1, 2, figsize=(9, 2.5), constrained_layout=True)
+ ax = axs[0]
+ ax.set_title(r'$\sum_{i} x_i$')
+ ax.set_title('New way', loc='left')
+ ax.set_xticklabels('')
+
+ ax = axs[1]
+ ax.set_title(r'$\sum_{i} x_i$', y=1.01)
+ ax.set_title('Old Way', loc='left')
+ ax.set_xticklabels('')
+
+
+def test_wrap():
+ fig = plt.figure(figsize=(6, 4))
+ s = 'This is a very long text that should be wrapped multiple times.'
+ text = fig.text(0.7, 0.5, s, wrap=True)
+ fig.canvas.draw()
+ assert text._get_wrapped_text() == ('This is a very long\n'
+ 'text that should be\n'
+ 'wrapped multiple\n'
+ 'times.')
+
+
+def test_long_word_wrap():
+ fig = plt.figure(figsize=(6, 4))
+ text = fig.text(9.5, 8, 'Alonglineoftexttowrap', wrap=True)
+ fig.canvas.draw()
+ assert text._get_wrapped_text() == 'Alonglineoftexttowrap'
+
+
+def test_wrap_no_wrap():
+ fig = plt.figure(figsize=(6, 4))
+ text = fig.text(0, 0, 'non wrapped text', wrap=True)
+ fig.canvas.draw()
+ assert text._get_wrapped_text() == 'non wrapped text'
+
+
+@check_figures_equal(extensions=["png"])
+def test_buffer_size(fig_test, fig_ref):
+ # On old versions of the Agg renderer, large non-ascii single-character
+ # strings (here, "€") would be rendered clipped because the rendering
+ # buffer would be set by the physical size of the smaller "a" character.
+ ax = fig_test.add_subplot()
+ ax.set_yticks([0, 1])
+ ax.set_yticklabels(["€", "a"])
+ ax.yaxis.majorTicks[1].label1.set_color("w")
+ ax = fig_ref.add_subplot()
+ ax.set_yticks([0, 1])
+ ax.set_yticklabels(["€", ""])
+
+
+def test_fontproperties_kwarg_precedence():
+ """Test that kwargs take precedence over fontproperties defaults."""
+ plt.figure()
+ text1 = plt.xlabel("value", fontproperties='Times New Roman', size=40.0)
+ text2 = plt.ylabel("counts", size=40.0, fontproperties='Times New Roman')
+ assert text1.get_size() == 40.0
+ assert text2.get_size() == 40.0
+
+
+def test_transform_rotates_text():
+ ax = plt.gca()
+ transform = mtransforms.Affine2D().rotate_deg(30)
+ text = ax.text(0, 0, 'test', transform=transform,
+ transform_rotates_text=True)
+ result = text.get_rotation()
+ assert_almost_equal(result, 30)
+
+
+def test_update_mutate_input():
+ inp = dict(fontproperties=FontProperties(weight="bold"),
+ bbox=None)
+ cache = dict(inp)
+ t = Text()
+ t.update(inp)
+ assert inp['fontproperties'] == cache['fontproperties']
+ assert inp['bbox'] == cache['bbox']
+
+
+def test_invalid_color():
+ with pytest.raises(ValueError):
+ plt.figtext(.5, .5, "foo", c="foobar")
+
+
+@image_comparison(['text_pdf_kerning.pdf'], style='mpl20')
+def test_pdf_kerning():
+ plt.figure()
+ plt.figtext(0.1, 0.5, "ATATATATATATATATATA", size=30)
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_ticker.py b/venv/Lib/site-packages/matplotlib/tests/test_ticker.py
new file mode 100644
index 0000000..6138757
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_ticker.py
@@ -0,0 +1,1381 @@
+from contextlib import nullcontext
+import itertools
+import locale
+import re
+
+import numpy as np
+from numpy.testing import assert_almost_equal, assert_array_equal
+import pytest
+
+import matplotlib as mpl
+from matplotlib import _api
+import matplotlib.pyplot as plt
+import matplotlib.ticker as mticker
+
+
+class TestMaxNLocator:
+ basic_data = [
+ (20, 100, np.array([20., 40., 60., 80., 100.])),
+ (0.001, 0.0001, np.array([0., 0.0002, 0.0004, 0.0006, 0.0008, 0.001])),
+ (-1e15, 1e15, np.array([-1.0e+15, -5.0e+14, 0e+00, 5e+14, 1.0e+15])),
+ (0, 0.85e-50, np.arange(6) * 2e-51),
+ (-0.85e-50, 0, np.arange(-5, 1) * 2e-51),
+ ]
+
+ integer_data = [
+ (-0.1, 1.1, None, np.array([-1, 0, 1, 2])),
+ (-0.1, 0.95, None, np.array([-0.25, 0, 0.25, 0.5, 0.75, 1.0])),
+ (1, 55, [1, 1.5, 5, 6, 10], np.array([0, 15, 30, 45, 60])),
+ ]
+
+ @pytest.mark.parametrize('vmin, vmax, expected', basic_data)
+ def test_basic(self, vmin, vmax, expected):
+ loc = mticker.MaxNLocator(nbins=5)
+ assert_almost_equal(loc.tick_values(vmin, vmax), expected)
+
+ @pytest.mark.parametrize('vmin, vmax, steps, expected', integer_data)
+ def test_integer(self, vmin, vmax, steps, expected):
+ loc = mticker.MaxNLocator(nbins=5, integer=True, steps=steps)
+ assert_almost_equal(loc.tick_values(vmin, vmax), expected)
+
+
+class TestLinearLocator:
+ def test_basic(self):
+ loc = mticker.LinearLocator(numticks=3)
+ test_value = np.array([-0.8, -0.3, 0.2])
+ assert_almost_equal(loc.tick_values(-0.8, 0.2), test_value)
+
+ def test_set_params(self):
+ """
+ Create linear locator with presets={}, numticks=2 and change it to
+ something else. See if change was successful. Should not exception.
+ """
+ loc = mticker.LinearLocator(numticks=2)
+ loc.set_params(numticks=8, presets={(0, 1): []})
+ assert loc.numticks == 8
+ assert loc.presets == {(0, 1): []}
+
+
+class TestMultipleLocator:
+ def test_basic(self):
+ loc = mticker.MultipleLocator(base=3.147)
+ test_value = np.array([-9.441, -6.294, -3.147, 0., 3.147, 6.294,
+ 9.441, 12.588])
+ assert_almost_equal(loc.tick_values(-7, 10), test_value)
+
+ def test_view_limits(self):
+ """
+ Test basic behavior of view limits.
+ """
+ with mpl.rc_context({'axes.autolimit_mode': 'data'}):
+ loc = mticker.MultipleLocator(base=3.147)
+ assert_almost_equal(loc.view_limits(-5, 5), (-5, 5))
+
+ def test_view_limits_round_numbers(self):
+ """
+ Test that everything works properly with 'round_numbers' for auto
+ limit.
+ """
+ with mpl.rc_context({'axes.autolimit_mode': 'round_numbers'}):
+ loc = mticker.MultipleLocator(base=3.147)
+ assert_almost_equal(loc.view_limits(-4, 4), (-6.294, 6.294))
+
+ def test_set_params(self):
+ """
+ Create multiple locator with 0.7 base, and change it to something else.
+ See if change was successful.
+ """
+ mult = mticker.MultipleLocator(base=0.7)
+ mult.set_params(base=1.7)
+ assert mult._edge.step == 1.7
+
+
+class TestAutoMinorLocator:
+ def test_basic(self):
+ fig, ax = plt.subplots()
+ ax.set_xlim(0, 1.39)
+ ax.minorticks_on()
+ test_value = np.array([0.05, 0.1, 0.15, 0.25, 0.3, 0.35, 0.45,
+ 0.5, 0.55, 0.65, 0.7, 0.75, 0.85, 0.9,
+ 0.95, 1.05, 1.1, 1.15, 1.25, 1.3, 1.35])
+ assert_almost_equal(ax.xaxis.get_ticklocs(minor=True), test_value)
+
+ # NB: the following values are assuming that *xlim* is [0, 5]
+ params = [
+ (0, 0), # no major tick => no minor tick either
+ (1, 0) # a single major tick => no minor tick
+ ]
+
+ @pytest.mark.parametrize('nb_majorticks, expected_nb_minorticks', params)
+ def test_low_number_of_majorticks(
+ self, nb_majorticks, expected_nb_minorticks):
+ # This test is related to issue #8804
+ fig, ax = plt.subplots()
+ xlims = (0, 5) # easier to test the different code paths
+ ax.set_xlim(*xlims)
+ ax.set_xticks(np.linspace(xlims[0], xlims[1], nb_majorticks))
+ ax.minorticks_on()
+ ax.xaxis.set_minor_locator(mticker.AutoMinorLocator())
+ assert len(ax.xaxis.get_minorticklocs()) == expected_nb_minorticks
+
+ majorstep_minordivisions = [(1, 5),
+ (2, 4),
+ (2.5, 5),
+ (5, 5),
+ (10, 5)]
+
+ # This test is meant to verify the parameterization for
+ # test_number_of_minor_ticks
+ def test_using_all_default_major_steps(self):
+ with mpl.rc_context({'_internal.classic_mode': False}):
+ majorsteps = [x[0] for x in self.majorstep_minordivisions]
+ np.testing.assert_allclose(majorsteps,
+ mticker.AutoLocator()._steps)
+
+ @pytest.mark.parametrize('major_step, expected_nb_minordivisions',
+ majorstep_minordivisions)
+ def test_number_of_minor_ticks(
+ self, major_step, expected_nb_minordivisions):
+ fig, ax = plt.subplots()
+ xlims = (0, major_step)
+ ax.set_xlim(*xlims)
+ ax.set_xticks(xlims)
+ ax.minorticks_on()
+ ax.xaxis.set_minor_locator(mticker.AutoMinorLocator())
+ nb_minor_divisions = len(ax.xaxis.get_minorticklocs()) + 1
+ assert nb_minor_divisions == expected_nb_minordivisions
+
+ limits = [(0, 1.39), (0, 0.139),
+ (0, 0.11e-19), (0, 0.112e-12),
+ (-2.0e-07, -3.3e-08), (1.20e-06, 1.42e-06),
+ (-1.34e-06, -1.44e-06), (-8.76e-07, -1.51e-06)]
+
+ reference = [
+ [0.05, 0.1, 0.15, 0.25, 0.3, 0.35, 0.45, 0.5, 0.55, 0.65, 0.7,
+ 0.75, 0.85, 0.9, 0.95, 1.05, 1.1, 1.15, 1.25, 1.3, 1.35],
+ [0.005, 0.01, 0.015, 0.025, 0.03, 0.035, 0.045, 0.05, 0.055, 0.065,
+ 0.07, 0.075, 0.085, 0.09, 0.095, 0.105, 0.11, 0.115, 0.125, 0.13,
+ 0.135],
+ [5.00e-22, 1.00e-21, 1.50e-21, 2.50e-21, 3.00e-21, 3.50e-21, 4.50e-21,
+ 5.00e-21, 5.50e-21, 6.50e-21, 7.00e-21, 7.50e-21, 8.50e-21, 9.00e-21,
+ 9.50e-21, 1.05e-20, 1.10e-20],
+ [5.00e-15, 1.00e-14, 1.50e-14, 2.50e-14, 3.00e-14, 3.50e-14, 4.50e-14,
+ 5.00e-14, 5.50e-14, 6.50e-14, 7.00e-14, 7.50e-14, 8.50e-14, 9.00e-14,
+ 9.50e-14, 1.05e-13, 1.10e-13],
+ [-1.95e-07, -1.90e-07, -1.85e-07, -1.75e-07, -1.70e-07, -1.65e-07,
+ -1.55e-07, -1.50e-07, -1.45e-07, -1.35e-07, -1.30e-07, -1.25e-07,
+ -1.15e-07, -1.10e-07, -1.05e-07, -9.50e-08, -9.00e-08, -8.50e-08,
+ -7.50e-08, -7.00e-08, -6.50e-08, -5.50e-08, -5.00e-08, -4.50e-08,
+ -3.50e-08],
+ [1.21e-06, 1.22e-06, 1.23e-06, 1.24e-06, 1.26e-06, 1.27e-06, 1.28e-06,
+ 1.29e-06, 1.31e-06, 1.32e-06, 1.33e-06, 1.34e-06, 1.36e-06, 1.37e-06,
+ 1.38e-06, 1.39e-06, 1.41e-06, 1.42e-06],
+ [-1.435e-06, -1.430e-06, -1.425e-06, -1.415e-06, -1.410e-06,
+ -1.405e-06, -1.395e-06, -1.390e-06, -1.385e-06, -1.375e-06,
+ -1.370e-06, -1.365e-06, -1.355e-06, -1.350e-06, -1.345e-06],
+ [-1.48e-06, -1.46e-06, -1.44e-06, -1.42e-06, -1.38e-06, -1.36e-06,
+ -1.34e-06, -1.32e-06, -1.28e-06, -1.26e-06, -1.24e-06, -1.22e-06,
+ -1.18e-06, -1.16e-06, -1.14e-06, -1.12e-06, -1.08e-06, -1.06e-06,
+ -1.04e-06, -1.02e-06, -9.80e-07, -9.60e-07, -9.40e-07, -9.20e-07,
+ -8.80e-07]]
+
+ additional_data = list(zip(limits, reference))
+
+ @pytest.mark.parametrize('lim, ref', additional_data)
+ def test_additional(self, lim, ref):
+ fig, ax = plt.subplots()
+
+ ax.minorticks_on()
+ ax.grid(True, 'minor', 'y', linewidth=1)
+ ax.grid(True, 'major', color='k', linewidth=1)
+ ax.set_ylim(lim)
+
+ assert_almost_equal(ax.yaxis.get_ticklocs(minor=True), ref)
+
+
+class TestLogLocator:
+ def test_basic(self):
+ loc = mticker.LogLocator(numticks=5)
+ with pytest.raises(ValueError):
+ loc.tick_values(0, 1000)
+
+ test_value = np.array([1.00000000e-05, 1.00000000e-03, 1.00000000e-01,
+ 1.00000000e+01, 1.00000000e+03, 1.00000000e+05,
+ 1.00000000e+07, 1.000000000e+09])
+ assert_almost_equal(loc.tick_values(0.001, 1.1e5), test_value)
+
+ loc = mticker.LogLocator(base=2)
+ test_value = np.array([0.5, 1., 2., 4., 8., 16., 32., 64., 128., 256.])
+ assert_almost_equal(loc.tick_values(1, 100), test_value)
+
+ def test_switch_to_autolocator(self):
+ loc = mticker.LogLocator(subs="all")
+ assert_array_equal(loc.tick_values(0.45, 0.55),
+ [0.44, 0.46, 0.48, 0.5, 0.52, 0.54, 0.56])
+ # check that we *skip* 1.0, and 10, because this is a minor locator
+ loc = mticker.LogLocator(subs=np.arange(2, 10))
+ assert 1.0 not in loc.tick_values(0.9, 20.)
+ assert 10.0 not in loc.tick_values(0.9, 20.)
+
+ def test_set_params(self):
+ """
+ Create log locator with default value, base=10.0, subs=[1.0],
+ numdecs=4, numticks=15 and change it to something else.
+ See if change was successful. Should not raise exception.
+ """
+ loc = mticker.LogLocator()
+ loc.set_params(numticks=7, numdecs=8, subs=[2.0], base=4)
+ assert loc.numticks == 7
+ assert loc.numdecs == 8
+ assert loc._base == 4
+ assert list(loc._subs) == [2.0]
+
+
+class TestNullLocator:
+ def test_set_params(self):
+ """
+ Create null locator, and attempt to call set_params() on it.
+ Should not exception, and should raise a warning.
+ """
+ loc = mticker.NullLocator()
+ with pytest.warns(UserWarning):
+ loc.set_params()
+
+
+class _LogitHelper:
+ @staticmethod
+ def isclose(x, y):
+ return (np.isclose(-np.log(1/x-1), -np.log(1/y-1))
+ if 0 < x < 1 and 0 < y < 1 else False)
+
+ @staticmethod
+ def assert_almost_equal(x, y):
+ ax = np.array(x)
+ ay = np.array(y)
+ assert np.all(ax > 0) and np.all(ax < 1)
+ assert np.all(ay > 0) and np.all(ay < 1)
+ lx = -np.log(1/ax-1)
+ ly = -np.log(1/ay-1)
+ assert_almost_equal(lx, ly)
+
+
+class TestLogitLocator:
+ ref_basic_limits = [
+ (5e-2, 1 - 5e-2),
+ (5e-3, 1 - 5e-3),
+ (5e-4, 1 - 5e-4),
+ (5e-5, 1 - 5e-5),
+ (5e-6, 1 - 5e-6),
+ (5e-7, 1 - 5e-7),
+ (5e-8, 1 - 5e-8),
+ (5e-9, 1 - 5e-9),
+ ]
+
+ ref_basic_major_ticks = [
+ 1 / (10 ** np.arange(1, 3)),
+ 1 / (10 ** np.arange(1, 4)),
+ 1 / (10 ** np.arange(1, 5)),
+ 1 / (10 ** np.arange(1, 6)),
+ 1 / (10 ** np.arange(1, 7)),
+ 1 / (10 ** np.arange(1, 8)),
+ 1 / (10 ** np.arange(1, 9)),
+ 1 / (10 ** np.arange(1, 10)),
+ ]
+
+ ref_maxn_limits = [(0.4, 0.6), (5e-2, 2e-1), (1 - 2e-1, 1 - 5e-2)]
+
+ @pytest.mark.parametrize(
+ "lims, expected_low_ticks",
+ zip(ref_basic_limits, ref_basic_major_ticks),
+ )
+ def test_basic_major(self, lims, expected_low_ticks):
+ """
+ Create logit locator with huge number of major, and tests ticks.
+ """
+ expected_ticks = sorted(
+ [*expected_low_ticks, 0.5, *(1 - expected_low_ticks)]
+ )
+ loc = mticker.LogitLocator(nbins=100)
+ _LogitHelper.assert_almost_equal(
+ loc.tick_values(*lims),
+ expected_ticks
+ )
+
+ @pytest.mark.parametrize("lims", ref_maxn_limits)
+ def test_maxn_major(self, lims):
+ """
+ When the axis is zoomed, the locator must have the same behavior as
+ MaxNLocator.
+ """
+ loc = mticker.LogitLocator(nbins=100)
+ maxn_loc = mticker.MaxNLocator(nbins=100, steps=[1, 2, 5, 10])
+ for nbins in (4, 8, 16):
+ loc.set_params(nbins=nbins)
+ maxn_loc.set_params(nbins=nbins)
+ ticks = loc.tick_values(*lims)
+ maxn_ticks = maxn_loc.tick_values(*lims)
+ assert ticks.shape == maxn_ticks.shape
+ assert (ticks == maxn_ticks).all()
+
+ @pytest.mark.parametrize("lims", ref_basic_limits + ref_maxn_limits)
+ def test_nbins_major(self, lims):
+ """
+ Assert logit locator for respecting nbins param.
+ """
+
+ basic_needed = int(-np.floor(np.log10(lims[0]))) * 2 + 1
+ loc = mticker.LogitLocator(nbins=100)
+ for nbins in range(basic_needed, 2, -1):
+ loc.set_params(nbins=nbins)
+ assert len(loc.tick_values(*lims)) <= nbins + 2
+
+ @pytest.mark.parametrize(
+ "lims, expected_low_ticks",
+ zip(ref_basic_limits, ref_basic_major_ticks),
+ )
+ def test_minor(self, lims, expected_low_ticks):
+ """
+ In large scale, test the presence of minor,
+ and assert no minor when major are subsampled.
+ """
+
+ expected_ticks = sorted(
+ [*expected_low_ticks, 0.5, *(1 - expected_low_ticks)]
+ )
+ basic_needed = len(expected_ticks)
+ loc = mticker.LogitLocator(nbins=100)
+ minor_loc = mticker.LogitLocator(nbins=100, minor=True)
+ for nbins in range(basic_needed, 2, -1):
+ loc.set_params(nbins=nbins)
+ minor_loc.set_params(nbins=nbins)
+ major_ticks = loc.tick_values(*lims)
+ minor_ticks = minor_loc.tick_values(*lims)
+ if len(major_ticks) >= len(expected_ticks):
+ # no subsample, we must have a lot of minors ticks
+ assert (len(major_ticks) - 1) * 5 < len(minor_ticks)
+ else:
+ # subsample
+ _LogitHelper.assert_almost_equal(
+ sorted([*major_ticks, *minor_ticks]), expected_ticks)
+
+ def test_minor_attr(self):
+ loc = mticker.LogitLocator(nbins=100)
+ assert not loc.minor
+ loc.minor = True
+ assert loc.minor
+ loc.set_params(minor=False)
+ assert not loc.minor
+
+ acceptable_vmin_vmax = [
+ *(2.5 ** np.arange(-3, 0)),
+ *(1 - 2.5 ** np.arange(-3, 0)),
+ ]
+
+ @pytest.mark.parametrize(
+ "lims",
+ [
+ (a, b)
+ for (a, b) in itertools.product(acceptable_vmin_vmax, repeat=2)
+ if a != b
+ ],
+ )
+ def test_nonsingular_ok(self, lims):
+ """
+ Create logit locator, and test the nonsingular method for acceptable
+ value
+ """
+ loc = mticker.LogitLocator()
+ lims2 = loc.nonsingular(*lims)
+ assert sorted(lims) == sorted(lims2)
+
+ @pytest.mark.parametrize("okval", acceptable_vmin_vmax)
+ def test_nonsingular_nok(self, okval):
+ """
+ Create logit locator, and test the nonsingular method for non
+ acceptable value
+ """
+ loc = mticker.LogitLocator()
+ vmin, vmax = (-1, okval)
+ vmin2, vmax2 = loc.nonsingular(vmin, vmax)
+ assert vmax2 == vmax
+ assert 0 < vmin2 < vmax2
+ vmin, vmax = (okval, 2)
+ vmin2, vmax2 = loc.nonsingular(vmin, vmax)
+ assert vmin2 == vmin
+ assert vmin2 < vmax2 < 1
+
+
+class TestFixedLocator:
+ def test_set_params(self):
+ """
+ Create fixed locator with 5 nbins, and change it to something else.
+ See if change was successful.
+ Should not exception.
+ """
+ fixed = mticker.FixedLocator(range(0, 24), nbins=5)
+ fixed.set_params(nbins=7)
+ assert fixed.nbins == 7
+
+
+class TestIndexLocator:
+ def test_set_params(self):
+ """
+ Create index locator with 3 base, 4 offset. and change it to something
+ else. See if change was successful.
+ Should not exception.
+ """
+ index = mticker.IndexLocator(base=3, offset=4)
+ index.set_params(base=7, offset=7)
+ assert index._base == 7
+ assert index.offset == 7
+
+
+class TestSymmetricalLogLocator:
+ def test_set_params(self):
+ """
+ Create symmetrical log locator with default subs =[1.0] numticks = 15,
+ and change it to something else.
+ See if change was successful.
+ Should not exception.
+ """
+ sym = mticker.SymmetricalLogLocator(base=10, linthresh=1)
+ sym.set_params(subs=[2.0], numticks=8)
+ assert sym._subs == [2.0]
+ assert sym.numticks == 8
+
+
+class TestIndexFormatter:
+ @pytest.mark.parametrize('x, label', [(-2, ''),
+ (-1, 'label0'),
+ (0, 'label0'),
+ (0.5, 'label1'),
+ (1, 'label1'),
+ (1.5, 'label2'),
+ (2, 'label2'),
+ (2.5, '')])
+ def test_formatting(self, x, label):
+ with _api.suppress_matplotlib_deprecation_warning():
+ formatter = mticker.IndexFormatter(['label0', 'label1', 'label2'])
+ assert formatter(x) == label
+
+
+class TestScalarFormatter:
+ offset_data = [
+ (123, 189, 0),
+ (-189, -123, 0),
+ (12341, 12349, 12340),
+ (-12349, -12341, -12340),
+ (99999.5, 100010.5, 100000),
+ (-100010.5, -99999.5, -100000),
+ (99990.5, 100000.5, 100000),
+ (-100000.5, -99990.5, -100000),
+ (1233999, 1234001, 1234000),
+ (-1234001, -1233999, -1234000),
+ (1, 1, 1),
+ (123, 123, 0),
+ # Test cases courtesy of @WeatherGod
+ (.4538, .4578, .45),
+ (3789.12, 3783.1, 3780),
+ (45124.3, 45831.75, 45000),
+ (0.000721, 0.0007243, 0.00072),
+ (12592.82, 12591.43, 12590),
+ (9., 12., 0),
+ (900., 1200., 0),
+ (1900., 1200., 0),
+ (0.99, 1.01, 1),
+ (9.99, 10.01, 10),
+ (99.99, 100.01, 100),
+ (5.99, 6.01, 6),
+ (15.99, 16.01, 16),
+ (-0.452, 0.492, 0),
+ (-0.492, 0.492, 0),
+ (12331.4, 12350.5, 12300),
+ (-12335.3, 12335.3, 0),
+ ]
+
+ use_offset_data = [True, False]
+
+ # (sci_type, scilimits, lim, orderOfMag, fewticks)
+ scilimits_data = [
+ (False, (0, 0), (10.0, 20.0), 0, False),
+ (True, (-2, 2), (-10, 20), 0, False),
+ (True, (-2, 2), (-20, 10), 0, False),
+ (True, (-2, 2), (-110, 120), 2, False),
+ (True, (-2, 2), (-120, 110), 2, False),
+ (True, (-2, 2), (-.001, 0.002), -3, False),
+ (True, (-7, 7), (0.18e10, 0.83e10), 9, True),
+ (True, (0, 0), (-1e5, 1e5), 5, False),
+ (True, (6, 6), (-1e5, 1e5), 6, False),
+ ]
+
+ cursor_data = [
+ [0., "0.000"],
+ [0.0123, "0.012"],
+ [0.123, "0.123"],
+ [1.23, "1.230"],
+ [12.3, "12.300"],
+ ]
+
+ @pytest.mark.parametrize('unicode_minus, result',
+ [(True, "\N{MINUS SIGN}1"), (False, "-1")])
+ def test_unicode_minus(self, unicode_minus, result):
+ mpl.rcParams['axes.unicode_minus'] = unicode_minus
+ assert (
+ plt.gca().xaxis.get_major_formatter().format_data_short(-1).strip()
+ == result)
+
+ @pytest.mark.parametrize('left, right, offset', offset_data)
+ def test_offset_value(self, left, right, offset):
+ fig, ax = plt.subplots()
+ formatter = ax.xaxis.get_major_formatter()
+
+ with (pytest.warns(UserWarning, match='Attempting to set identical')
+ if left == right else nullcontext()):
+ ax.set_xlim(left, right)
+ ax.xaxis._update_ticks()
+ assert formatter.offset == offset
+
+ with (pytest.warns(UserWarning, match='Attempting to set identical')
+ if left == right else nullcontext()):
+ ax.set_xlim(right, left)
+ ax.xaxis._update_ticks()
+ assert formatter.offset == offset
+
+ @pytest.mark.parametrize('use_offset', use_offset_data)
+ def test_use_offset(self, use_offset):
+ with mpl.rc_context({'axes.formatter.useoffset': use_offset}):
+ tmp_form = mticker.ScalarFormatter()
+ assert use_offset == tmp_form.get_useOffset()
+
+ def test_use_locale(self):
+ conv = locale.localeconv()
+ sep = conv['thousands_sep']
+ if not sep or conv['grouping'][-1:] in ([], [locale.CHAR_MAX]):
+ pytest.skip('Locale does not apply grouping') # pragma: no cover
+
+ with mpl.rc_context({'axes.formatter.use_locale': True}):
+ tmp_form = mticker.ScalarFormatter()
+ assert tmp_form.get_useLocale()
+
+ tmp_form.create_dummy_axis()
+ tmp_form.set_bounds(0, 10)
+ tmp_form.set_locs([1, 2, 3])
+ assert sep in tmp_form(1e9)
+
+ @pytest.mark.parametrize(
+ 'sci_type, scilimits, lim, orderOfMag, fewticks', scilimits_data)
+ def test_scilimits(self, sci_type, scilimits, lim, orderOfMag, fewticks):
+ tmp_form = mticker.ScalarFormatter()
+ tmp_form.set_scientific(sci_type)
+ tmp_form.set_powerlimits(scilimits)
+ fig, ax = plt.subplots()
+ ax.yaxis.set_major_formatter(tmp_form)
+ ax.set_ylim(*lim)
+ if fewticks:
+ ax.yaxis.set_major_locator(mticker.MaxNLocator(4))
+
+ tmp_form.set_locs(ax.yaxis.get_majorticklocs())
+ assert orderOfMag == tmp_form.orderOfMagnitude
+
+ @pytest.mark.parametrize('data, expected', cursor_data)
+ def test_cursor_precision(self, data, expected):
+ fig, ax = plt.subplots()
+ ax.set_xlim(-1, 1) # Pointing precision of 0.001.
+ fmt = ax.xaxis.get_major_formatter().format_data_short
+ assert fmt(data) == expected
+
+ @pytest.mark.parametrize('data, expected', cursor_data)
+ def test_cursor_dummy_axis(self, data, expected):
+ # Issue #17624
+ sf = mticker.ScalarFormatter()
+ sf.create_dummy_axis()
+ sf.set_bounds(0, 10)
+ fmt = sf.format_data_short
+ assert fmt(data) == expected
+
+
+class FakeAxis:
+ """Allow Formatter to be called without having a "full" plot set up."""
+ def __init__(self, vmin=1, vmax=10):
+ self.vmin = vmin
+ self.vmax = vmax
+
+ def get_view_interval(self):
+ return self.vmin, self.vmax
+
+
+class TestLogFormatterExponent:
+ param_data = [
+ (True, 4, np.arange(-3, 4.0), np.arange(-3, 4.0),
+ ['-3', '-2', '-1', '0', '1', '2', '3']),
+ # With labelOnlyBase=False, non-integer powers should be nicely
+ # formatted.
+ (False, 10, np.array([0.1, 0.00001, np.pi, 0.2, -0.2, -0.00001]),
+ range(6), ['0.1', '1e-05', '3.14', '0.2', '-0.2', '-1e-05']),
+ (False, 50, np.array([3, 5, 12, 42], dtype=float), range(6),
+ ['3', '5', '12', '42']),
+ ]
+
+ base_data = [2.0, 5.0, 10.0, np.pi, np.e]
+
+ @pytest.mark.parametrize(
+ 'labelOnlyBase, exponent, locs, positions, expected', param_data)
+ @pytest.mark.parametrize('base', base_data)
+ def test_basic(self, labelOnlyBase, base, exponent, locs, positions,
+ expected):
+ formatter = mticker.LogFormatterExponent(base=base,
+ labelOnlyBase=labelOnlyBase)
+ formatter.axis = FakeAxis(1, base**exponent)
+ vals = base**locs
+ labels = [formatter(x, pos) for (x, pos) in zip(vals, positions)]
+ assert labels == expected
+
+ def test_blank(self):
+ # Should be a blank string for non-integer powers if labelOnlyBase=True
+ formatter = mticker.LogFormatterExponent(base=10, labelOnlyBase=True)
+ formatter.axis = FakeAxis()
+ assert formatter(10**0.1) == ''
+
+
+class TestLogFormatterMathtext:
+ fmt = mticker.LogFormatterMathtext()
+ test_data = [
+ (0, 1, '$\\mathdefault{10^{0}}$'),
+ (0, 1e-2, '$\\mathdefault{10^{-2}}$'),
+ (0, 1e2, '$\\mathdefault{10^{2}}$'),
+ (3, 1, '$\\mathdefault{1}$'),
+ (3, 1e-2, '$\\mathdefault{0.01}$'),
+ (3, 1e2, '$\\mathdefault{100}$'),
+ (3, 1e-3, '$\\mathdefault{10^{-3}}$'),
+ (3, 1e3, '$\\mathdefault{10^{3}}$'),
+ ]
+
+ @pytest.mark.parametrize('min_exponent, value, expected', test_data)
+ def test_min_exponent(self, min_exponent, value, expected):
+ with mpl.rc_context({'axes.formatter.min_exponent': min_exponent}):
+ assert self.fmt(value) == expected
+
+
+class TestLogFormatterSciNotation:
+ test_data = [
+ (2, 0.03125, '$\\mathdefault{2^{-5}}$'),
+ (2, 1, '$\\mathdefault{2^{0}}$'),
+ (2, 32, '$\\mathdefault{2^{5}}$'),
+ (2, 0.0375, '$\\mathdefault{1.2\\times2^{-5}}$'),
+ (2, 1.2, '$\\mathdefault{1.2\\times2^{0}}$'),
+ (2, 38.4, '$\\mathdefault{1.2\\times2^{5}}$'),
+ (10, -1, '$\\mathdefault{-10^{0}}$'),
+ (10, 1e-05, '$\\mathdefault{10^{-5}}$'),
+ (10, 1, '$\\mathdefault{10^{0}}$'),
+ (10, 100000, '$\\mathdefault{10^{5}}$'),
+ (10, 2e-05, '$\\mathdefault{2\\times10^{-5}}$'),
+ (10, 2, '$\\mathdefault{2\\times10^{0}}$'),
+ (10, 200000, '$\\mathdefault{2\\times10^{5}}$'),
+ (10, 5e-05, '$\\mathdefault{5\\times10^{-5}}$'),
+ (10, 5, '$\\mathdefault{5\\times10^{0}}$'),
+ (10, 500000, '$\\mathdefault{5\\times10^{5}}$'),
+ ]
+
+ @pytest.mark.style('default')
+ @pytest.mark.parametrize('base, value, expected', test_data)
+ def test_basic(self, base, value, expected):
+ formatter = mticker.LogFormatterSciNotation(base=base)
+ formatter.sublabel = {1, 2, 5, 1.2}
+ with mpl.rc_context({'text.usetex': False}):
+ assert formatter(value) == expected
+
+
+class TestLogFormatter:
+ pprint_data = [
+ (3.141592654e-05, 0.001, '3.142e-5'),
+ (0.0003141592654, 0.001, '3.142e-4'),
+ (0.003141592654, 0.001, '3.142e-3'),
+ (0.03141592654, 0.001, '3.142e-2'),
+ (0.3141592654, 0.001, '3.142e-1'),
+ (3.141592654, 0.001, '3.142'),
+ (31.41592654, 0.001, '3.142e1'),
+ (314.1592654, 0.001, '3.142e2'),
+ (3141.592654, 0.001, '3.142e3'),
+ (31415.92654, 0.001, '3.142e4'),
+ (314159.2654, 0.001, '3.142e5'),
+ (1e-05, 0.001, '1e-5'),
+ (0.0001, 0.001, '1e-4'),
+ (0.001, 0.001, '1e-3'),
+ (0.01, 0.001, '1e-2'),
+ (0.1, 0.001, '1e-1'),
+ (1, 0.001, '1'),
+ (10, 0.001, '10'),
+ (100, 0.001, '100'),
+ (1000, 0.001, '1000'),
+ (10000, 0.001, '1e4'),
+ (100000, 0.001, '1e5'),
+ (3.141592654e-05, 0.015, '0'),
+ (0.0003141592654, 0.015, '0'),
+ (0.003141592654, 0.015, '0.003'),
+ (0.03141592654, 0.015, '0.031'),
+ (0.3141592654, 0.015, '0.314'),
+ (3.141592654, 0.015, '3.142'),
+ (31.41592654, 0.015, '31.416'),
+ (314.1592654, 0.015, '314.159'),
+ (3141.592654, 0.015, '3141.593'),
+ (31415.92654, 0.015, '31415.927'),
+ (314159.2654, 0.015, '314159.265'),
+ (1e-05, 0.015, '0'),
+ (0.0001, 0.015, '0'),
+ (0.001, 0.015, '0.001'),
+ (0.01, 0.015, '0.01'),
+ (0.1, 0.015, '0.1'),
+ (1, 0.015, '1'),
+ (10, 0.015, '10'),
+ (100, 0.015, '100'),
+ (1000, 0.015, '1000'),
+ (10000, 0.015, '10000'),
+ (100000, 0.015, '100000'),
+ (3.141592654e-05, 0.5, '0'),
+ (0.0003141592654, 0.5, '0'),
+ (0.003141592654, 0.5, '0.003'),
+ (0.03141592654, 0.5, '0.031'),
+ (0.3141592654, 0.5, '0.314'),
+ (3.141592654, 0.5, '3.142'),
+ (31.41592654, 0.5, '31.416'),
+ (314.1592654, 0.5, '314.159'),
+ (3141.592654, 0.5, '3141.593'),
+ (31415.92654, 0.5, '31415.927'),
+ (314159.2654, 0.5, '314159.265'),
+ (1e-05, 0.5, '0'),
+ (0.0001, 0.5, '0'),
+ (0.001, 0.5, '0.001'),
+ (0.01, 0.5, '0.01'),
+ (0.1, 0.5, '0.1'),
+ (1, 0.5, '1'),
+ (10, 0.5, '10'),
+ (100, 0.5, '100'),
+ (1000, 0.5, '1000'),
+ (10000, 0.5, '10000'),
+ (100000, 0.5, '100000'),
+ (3.141592654e-05, 5, '0'),
+ (0.0003141592654, 5, '0'),
+ (0.003141592654, 5, '0'),
+ (0.03141592654, 5, '0.03'),
+ (0.3141592654, 5, '0.31'),
+ (3.141592654, 5, '3.14'),
+ (31.41592654, 5, '31.42'),
+ (314.1592654, 5, '314.16'),
+ (3141.592654, 5, '3141.59'),
+ (31415.92654, 5, '31415.93'),
+ (314159.2654, 5, '314159.27'),
+ (1e-05, 5, '0'),
+ (0.0001, 5, '0'),
+ (0.001, 5, '0'),
+ (0.01, 5, '0.01'),
+ (0.1, 5, '0.1'),
+ (1, 5, '1'),
+ (10, 5, '10'),
+ (100, 5, '100'),
+ (1000, 5, '1000'),
+ (10000, 5, '10000'),
+ (100000, 5, '100000'),
+ (3.141592654e-05, 100, '0'),
+ (0.0003141592654, 100, '0'),
+ (0.003141592654, 100, '0'),
+ (0.03141592654, 100, '0'),
+ (0.3141592654, 100, '0.3'),
+ (3.141592654, 100, '3.1'),
+ (31.41592654, 100, '31.4'),
+ (314.1592654, 100, '314.2'),
+ (3141.592654, 100, '3141.6'),
+ (31415.92654, 100, '31415.9'),
+ (314159.2654, 100, '314159.3'),
+ (1e-05, 100, '0'),
+ (0.0001, 100, '0'),
+ (0.001, 100, '0'),
+ (0.01, 100, '0'),
+ (0.1, 100, '0.1'),
+ (1, 100, '1'),
+ (10, 100, '10'),
+ (100, 100, '100'),
+ (1000, 100, '1000'),
+ (10000, 100, '10000'),
+ (100000, 100, '100000'),
+ (3.141592654e-05, 1000000.0, '3.1e-5'),
+ (0.0003141592654, 1000000.0, '3.1e-4'),
+ (0.003141592654, 1000000.0, '3.1e-3'),
+ (0.03141592654, 1000000.0, '3.1e-2'),
+ (0.3141592654, 1000000.0, '3.1e-1'),
+ (3.141592654, 1000000.0, '3.1'),
+ (31.41592654, 1000000.0, '3.1e1'),
+ (314.1592654, 1000000.0, '3.1e2'),
+ (3141.592654, 1000000.0, '3.1e3'),
+ (31415.92654, 1000000.0, '3.1e4'),
+ (314159.2654, 1000000.0, '3.1e5'),
+ (1e-05, 1000000.0, '1e-5'),
+ (0.0001, 1000000.0, '1e-4'),
+ (0.001, 1000000.0, '1e-3'),
+ (0.01, 1000000.0, '1e-2'),
+ (0.1, 1000000.0, '1e-1'),
+ (1, 1000000.0, '1'),
+ (10, 1000000.0, '10'),
+ (100, 1000000.0, '100'),
+ (1000, 1000000.0, '1000'),
+ (10000, 1000000.0, '1e4'),
+ (100000, 1000000.0, '1e5'),
+ ]
+
+ @pytest.mark.parametrize('value, domain, expected', pprint_data)
+ def test_pprint(self, value, domain, expected):
+ fmt = mticker.LogFormatter()
+ label = fmt._pprint_val(value, domain)
+ assert label == expected
+
+ def _sub_labels(self, axis, subs=()):
+ """Test whether locator marks subs to be labeled."""
+ fmt = axis.get_minor_formatter()
+ minor_tlocs = axis.get_minorticklocs()
+ fmt.set_locs(minor_tlocs)
+ coefs = minor_tlocs / 10**(np.floor(np.log10(minor_tlocs)))
+ label_expected = [round(c) in subs for c in coefs]
+ label_test = [fmt(x) != '' for x in minor_tlocs]
+ assert label_test == label_expected
+
+ @pytest.mark.style('default')
+ def test_sublabel(self):
+ # test label locator
+ fig, ax = plt.subplots()
+ ax.set_xscale('log')
+ ax.xaxis.set_major_locator(mticker.LogLocator(base=10, subs=[]))
+ ax.xaxis.set_minor_locator(mticker.LogLocator(base=10,
+ subs=np.arange(2, 10)))
+ ax.xaxis.set_major_formatter(mticker.LogFormatter(labelOnlyBase=True))
+ ax.xaxis.set_minor_formatter(mticker.LogFormatter(labelOnlyBase=False))
+ # axis range above 3 decades, only bases are labeled
+ ax.set_xlim(1, 1e4)
+ fmt = ax.xaxis.get_major_formatter()
+ fmt.set_locs(ax.xaxis.get_majorticklocs())
+ show_major_labels = [fmt(x) != ''
+ for x in ax.xaxis.get_majorticklocs()]
+ assert np.all(show_major_labels)
+ self._sub_labels(ax.xaxis, subs=[])
+
+ # For the next two, if the numdec threshold in LogFormatter.set_locs
+ # were 3, then the label sub would be 3 for 2-3 decades and (2, 5)
+ # for 1-2 decades. With a threshold of 1, subs are not labeled.
+ # axis range at 2 to 3 decades
+ ax.set_xlim(1, 800)
+ self._sub_labels(ax.xaxis, subs=[])
+
+ # axis range at 1 to 2 decades
+ ax.set_xlim(1, 80)
+ self._sub_labels(ax.xaxis, subs=[])
+
+ # axis range at 0.4 to 1 decades, label subs 2, 3, 4, 6
+ ax.set_xlim(1, 8)
+ self._sub_labels(ax.xaxis, subs=[2, 3, 4, 6])
+
+ # axis range at 0 to 0.4 decades, label all
+ ax.set_xlim(0.5, 0.9)
+ self._sub_labels(ax.xaxis, subs=np.arange(2, 10, dtype=int))
+
+ @pytest.mark.parametrize('val', [1, 10, 100, 1000])
+ def test_LogFormatter_call(self, val):
+ # test _num_to_string method used in __call__
+ temp_lf = mticker.LogFormatter()
+ temp_lf.axis = FakeAxis()
+ assert temp_lf(val) == str(val)
+
+ @pytest.mark.parametrize('val', [1e-323, 2e-323, 10e-323, 11e-323])
+ def test_LogFormatter_call_tiny(self, val):
+ # test coeff computation in __call__
+ temp_lf = mticker.LogFormatter()
+ temp_lf.axis = FakeAxis()
+ temp_lf(val)
+
+
+class TestLogitFormatter:
+ @staticmethod
+ def logit_deformatter(string):
+ r"""
+ Parser to convert string as r'$\mathdefault{1.41\cdot10^{-4}}$' in
+ float 1.41e-4, as '0.5' or as r'$\mathdefault{\frac{1}{2}}$' in float
+ 0.5,
+ """
+ match = re.match(
+ r"[^\d]*"
+ r"(?P1-)?"
+ r"(?P\d*\.?\d*)?"
+ r"(?:\\cdot)?"
+ r"(?:10\^\{(?P-?\d*)})?"
+ r"[^\d]*$",
+ string,
+ )
+ if match:
+ comp = match["comp"] is not None
+ mantissa = float(match["mant"]) if match["mant"] else 1
+ expo = int(match["expo"]) if match["expo"] is not None else 0
+ value = mantissa * 10 ** expo
+ if match["mant"] or match["expo"] is not None:
+ if comp:
+ return 1 - value
+ return value
+ match = re.match(
+ r"[^\d]*\\frac\{(?P\d+)\}\{(?P\d+)\}[^\d]*$", string
+ )
+ if match:
+ num, deno = float(match["num"]), float(match["deno"])
+ return num / deno
+ raise ValueError("Not formatted by LogitFormatter")
+
+ @pytest.mark.parametrize(
+ "fx, x",
+ [
+ (r"STUFF0.41OTHERSTUFF", 0.41),
+ (r"STUFF1.41\cdot10^{-2}OTHERSTUFF", 1.41e-2),
+ (r"STUFF1-0.41OTHERSTUFF", 1 - 0.41),
+ (r"STUFF1-1.41\cdot10^{-2}OTHERSTUFF", 1 - 1.41e-2),
+ (r"STUFF", None),
+ (r"STUFF12.4e-3OTHERSTUFF", None),
+ ],
+ )
+ def test_logit_deformater(self, fx, x):
+ if x is None:
+ with pytest.raises(ValueError):
+ TestLogitFormatter.logit_deformatter(fx)
+ else:
+ y = TestLogitFormatter.logit_deformatter(fx)
+ assert _LogitHelper.isclose(x, y)
+
+ decade_test = sorted(
+ [10 ** (-i) for i in range(1, 10)]
+ + [1 - 10 ** (-i) for i in range(1, 10)]
+ + [1 / 2]
+ )
+
+ @pytest.mark.parametrize("x", decade_test)
+ def test_basic(self, x):
+ """
+ Test the formatted value correspond to the value for ideal ticks in
+ logit space.
+ """
+ formatter = mticker.LogitFormatter(use_overline=False)
+ formatter.set_locs(self.decade_test)
+ s = formatter(x)
+ x2 = TestLogitFormatter.logit_deformatter(s)
+ assert _LogitHelper.isclose(x, x2)
+
+ @pytest.mark.parametrize("x", (-1, -0.5, -0.1, 1.1, 1.5, 2))
+ def test_invalid(self, x):
+ """
+ Test that invalid value are formatted with empty string without
+ raising exception.
+ """
+ formatter = mticker.LogitFormatter(use_overline=False)
+ formatter.set_locs(self.decade_test)
+ s = formatter(x)
+ assert s == ""
+
+ @pytest.mark.parametrize("x", 1 / (1 + np.exp(-np.linspace(-7, 7, 10))))
+ def test_variablelength(self, x):
+ """
+ The format length should change depending on the neighbor labels.
+ """
+ formatter = mticker.LogitFormatter(use_overline=False)
+ for N in (10, 20, 50, 100, 200, 1000, 2000, 5000, 10000):
+ if x + 1 / N < 1:
+ formatter.set_locs([x - 1 / N, x, x + 1 / N])
+ sx = formatter(x)
+ sx1 = formatter(x + 1 / N)
+ d = (
+ TestLogitFormatter.logit_deformatter(sx1)
+ - TestLogitFormatter.logit_deformatter(sx)
+ )
+ assert 0 < d < 2 / N
+
+ lims_minor_major = [
+ (True, (5e-8, 1 - 5e-8), ((25, False), (75, False))),
+ (True, (5e-5, 1 - 5e-5), ((25, False), (75, True))),
+ (True, (5e-2, 1 - 5e-2), ((25, True), (75, True))),
+ (False, (0.75, 0.76, 0.77), ((7, True), (25, True), (75, True))),
+ ]
+
+ @pytest.mark.parametrize("method, lims, cases", lims_minor_major)
+ def test_minor_vs_major(self, method, lims, cases):
+ """
+ Test minor/major displays.
+ """
+
+ if method:
+ min_loc = mticker.LogitLocator(minor=True)
+ ticks = min_loc.tick_values(*lims)
+ else:
+ ticks = np.array(lims)
+ min_form = mticker.LogitFormatter(minor=True)
+ for threshold, has_minor in cases:
+ min_form.set_minor_threshold(threshold)
+ formatted = min_form.format_ticks(ticks)
+ labelled = [f for f in formatted if len(f) > 0]
+ if has_minor:
+ assert len(labelled) > 0, (threshold, has_minor)
+ else:
+ assert len(labelled) == 0, (threshold, has_minor)
+
+ def test_minor_number(self):
+ """
+ Test the parameter minor_number
+ """
+ min_loc = mticker.LogitLocator(minor=True)
+ min_form = mticker.LogitFormatter(minor=True)
+ ticks = min_loc.tick_values(5e-2, 1 - 5e-2)
+ for minor_number in (2, 4, 8, 16):
+ min_form.set_minor_number(minor_number)
+ formatted = min_form.format_ticks(ticks)
+ labelled = [f for f in formatted if len(f) > 0]
+ assert len(labelled) == minor_number
+
+ def test_use_overline(self):
+ """
+ Test the parameter use_overline
+ """
+ x = 1 - 1e-2
+ fx1 = r"$\mathdefault{1-10^{-2}}$"
+ fx2 = r"$\mathdefault{\overline{10^{-2}}}$"
+ form = mticker.LogitFormatter(use_overline=False)
+ assert form(x) == fx1
+ form.use_overline(True)
+ assert form(x) == fx2
+ form.use_overline(False)
+ assert form(x) == fx1
+
+ def test_one_half(self):
+ """
+ Test the parameter one_half
+ """
+ form = mticker.LogitFormatter()
+ assert r"\frac{1}{2}" in form(1/2)
+ form.set_one_half("1/2")
+ assert "1/2" in form(1/2)
+ form.set_one_half("one half")
+ assert "one half" in form(1/2)
+
+ @pytest.mark.parametrize("N", (100, 253, 754))
+ def test_format_data_short(self, N):
+ locs = np.linspace(0, 1, N)[1:-1]
+ form = mticker.LogitFormatter()
+ for x in locs:
+ fx = form.format_data_short(x)
+ if fx.startswith("1-"):
+ x2 = 1 - float(fx[2:])
+ else:
+ x2 = float(fx)
+ assert abs(x - x2) < 1 / N
+
+
+class TestFormatStrFormatter:
+ def test_basic(self):
+ # test % style formatter
+ tmp_form = mticker.FormatStrFormatter('%05d')
+ assert '00002' == tmp_form(2)
+
+
+class TestStrMethodFormatter:
+ test_data = [
+ ('{x:05d}', (2,), '00002'),
+ ('{x:03d}-{pos:02d}', (2, 1), '002-01'),
+ ]
+
+ @pytest.mark.parametrize('format, input, expected', test_data)
+ def test_basic(self, format, input, expected):
+ fmt = mticker.StrMethodFormatter(format)
+ assert fmt(*input) == expected
+
+
+class TestEngFormatter:
+ # (unicode_minus, input, expected) where ''expected'' corresponds to the
+ # outputs respectively returned when (places=None, places=0, places=2)
+ # unicode_minus is a boolean value for the rcParam['axes.unicode_minus']
+ raw_format_data = [
+ (False, -1234.56789, ('-1.23457 k', '-1 k', '-1.23 k')),
+ (True, -1234.56789, ('\N{MINUS SIGN}1.23457 k', '\N{MINUS SIGN}1 k',
+ '\N{MINUS SIGN}1.23 k')),
+ (False, -1.23456789, ('-1.23457', '-1', '-1.23')),
+ (True, -1.23456789, ('\N{MINUS SIGN}1.23457', '\N{MINUS SIGN}1',
+ '\N{MINUS SIGN}1.23')),
+ (False, -0.123456789, ('-123.457 m', '-123 m', '-123.46 m')),
+ (True, -0.123456789, ('\N{MINUS SIGN}123.457 m', '\N{MINUS SIGN}123 m',
+ '\N{MINUS SIGN}123.46 m')),
+ (False, -0.00123456789, ('-1.23457 m', '-1 m', '-1.23 m')),
+ (True, -0.00123456789, ('\N{MINUS SIGN}1.23457 m', '\N{MINUS SIGN}1 m',
+ '\N{MINUS SIGN}1.23 m')),
+ (True, -0.0, ('0', '0', '0.00')),
+ (True, -0, ('0', '0', '0.00')),
+ (True, 0, ('0', '0', '0.00')),
+ (True, 1.23456789e-6, ('1.23457 µ', '1 µ', '1.23 µ')),
+ (True, 0.123456789, ('123.457 m', '123 m', '123.46 m')),
+ (True, 0.1, ('100 m', '100 m', '100.00 m')),
+ (True, 1, ('1', '1', '1.00')),
+ (True, 1.23456789, ('1.23457', '1', '1.23')),
+ # places=0: corner-case rounding
+ (True, 999.9, ('999.9', '1 k', '999.90')),
+ # corner-case rounding for all
+ (True, 999.9999, ('1 k', '1 k', '1.00 k')),
+ # negative corner-case
+ (False, -999.9999, ('-1 k', '-1 k', '-1.00 k')),
+ (True, -999.9999, ('\N{MINUS SIGN}1 k', '\N{MINUS SIGN}1 k',
+ '\N{MINUS SIGN}1.00 k')),
+ (True, 1000, ('1 k', '1 k', '1.00 k')),
+ (True, 1001, ('1.001 k', '1 k', '1.00 k')),
+ (True, 100001, ('100.001 k', '100 k', '100.00 k')),
+ (True, 987654.321, ('987.654 k', '988 k', '987.65 k')),
+ # OoR value (> 1000 Y)
+ (True, 1.23e27, ('1230 Y', '1230 Y', '1230.00 Y'))
+ ]
+
+ @pytest.mark.parametrize('unicode_minus, input, expected', raw_format_data)
+ def test_params(self, unicode_minus, input, expected):
+ """
+ Test the formatting of EngFormatter for various values of the 'places'
+ argument, in several cases:
+
+ 0. without a unit symbol but with a (default) space separator;
+ 1. with both a unit symbol and a (default) space separator;
+ 2. with both a unit symbol and some non default separators;
+ 3. without a unit symbol but with some non default separators.
+
+ Note that cases 2. and 3. are looped over several separator strings.
+ """
+
+ plt.rcParams['axes.unicode_minus'] = unicode_minus
+ UNIT = 's' # seconds
+ DIGITS = '0123456789' # %timeit showed 10-20% faster search than set
+
+ # Case 0: unit='' (default) and sep=' ' (default).
+ # 'expected' already corresponds to this reference case.
+ exp_outputs = expected
+ formatters = (
+ mticker.EngFormatter(), # places=None (default)
+ mticker.EngFormatter(places=0),
+ mticker.EngFormatter(places=2)
+ )
+ for _formatter, _exp_output in zip(formatters, exp_outputs):
+ assert _formatter(input) == _exp_output
+
+ # Case 1: unit=UNIT and sep=' ' (default).
+ # Append a unit symbol to the reference case.
+ # Beware of the values in [1, 1000), where there is no prefix!
+ exp_outputs = (_s + " " + UNIT if _s[-1] in DIGITS # case w/o prefix
+ else _s + UNIT for _s in expected)
+ formatters = (
+ mticker.EngFormatter(unit=UNIT), # places=None (default)
+ mticker.EngFormatter(unit=UNIT, places=0),
+ mticker.EngFormatter(unit=UNIT, places=2)
+ )
+ for _formatter, _exp_output in zip(formatters, exp_outputs):
+ assert _formatter(input) == _exp_output
+
+ # Test several non default separators: no separator, a narrow
+ # no-break space (unicode character) and an extravagant string.
+ for _sep in ("", "\N{NARROW NO-BREAK SPACE}", "@_@"):
+ # Case 2: unit=UNIT and sep=_sep.
+ # Replace the default space separator from the reference case
+ # with the tested one `_sep` and append a unit symbol to it.
+ exp_outputs = (_s + _sep + UNIT if _s[-1] in DIGITS # no prefix
+ else _s.replace(" ", _sep) + UNIT
+ for _s in expected)
+ formatters = (
+ mticker.EngFormatter(unit=UNIT, sep=_sep), # places=None
+ mticker.EngFormatter(unit=UNIT, places=0, sep=_sep),
+ mticker.EngFormatter(unit=UNIT, places=2, sep=_sep)
+ )
+ for _formatter, _exp_output in zip(formatters, exp_outputs):
+ assert _formatter(input) == _exp_output
+
+ # Case 3: unit='' (default) and sep=_sep.
+ # Replace the default space separator from the reference case
+ # with the tested one `_sep`. Reference case is already unitless.
+ exp_outputs = (_s.replace(" ", _sep) for _s in expected)
+ formatters = (
+ mticker.EngFormatter(sep=_sep), # places=None (default)
+ mticker.EngFormatter(places=0, sep=_sep),
+ mticker.EngFormatter(places=2, sep=_sep)
+ )
+ for _formatter, _exp_output in zip(formatters, exp_outputs):
+ assert _formatter(input) == _exp_output
+
+
+def test_engformatter_usetex_useMathText():
+ fig, ax = plt.subplots()
+ ax.plot([0, 500, 1000], [0, 500, 1000])
+ ax.set_xticks([0, 500, 1000])
+ for formatter in (mticker.EngFormatter(usetex=True),
+ mticker.EngFormatter(useMathText=True)):
+ ax.xaxis.set_major_formatter(formatter)
+ fig.canvas.draw()
+ x_tick_label_text = [labl.get_text() for labl in ax.get_xticklabels()]
+ # Checking if the dollar `$` signs have been inserted around numbers
+ # in tick labels.
+ assert x_tick_label_text == ['$0$', '$500$', '$1$ k']
+
+
+class TestPercentFormatter:
+ percent_data = [
+ # Check explicitly set decimals over different intervals and values
+ (100, 0, '%', 120, 100, '120%'),
+ (100, 0, '%', 100, 90, '100%'),
+ (100, 0, '%', 90, 50, '90%'),
+ (100, 0, '%', -1.7, 40, '-2%'),
+ (100, 1, '%', 90.0, 100, '90.0%'),
+ (100, 1, '%', 80.1, 90, '80.1%'),
+ (100, 1, '%', 70.23, 50, '70.2%'),
+ # 60.554 instead of 60.55: see https://bugs.python.org/issue5118
+ (100, 1, '%', -60.554, 40, '-60.6%'),
+ # Check auto decimals over different intervals and values
+ (100, None, '%', 95, 1, '95.00%'),
+ (1.0, None, '%', 3, 6, '300%'),
+ (17.0, None, '%', 1, 8.5, '6%'),
+ (17.0, None, '%', 1, 8.4, '5.9%'),
+ (5, None, '%', -100, 0.000001, '-2000.00000%'),
+ # Check percent symbol
+ (1.0, 2, None, 1.2, 100, '120.00'),
+ (75, 3, '', 50, 100, '66.667'),
+ (42, None, '^^Foobar$$', 21, 12, '50.0^^Foobar$$'),
+ ]
+
+ percent_ids = [
+ # Check explicitly set decimals over different intervals and values
+ 'decimals=0, x>100%',
+ 'decimals=0, x=100%',
+ 'decimals=0, x<100%',
+ 'decimals=0, x<0%',
+ 'decimals=1, x>100%',
+ 'decimals=1, x=100%',
+ 'decimals=1, x<100%',
+ 'decimals=1, x<0%',
+ # Check auto decimals over different intervals and values
+ 'autodecimal, x<100%, display_range=1',
+ 'autodecimal, x>100%, display_range=6 (custom xmax test)',
+ 'autodecimal, x<100%, display_range=8.5 (autodecimal test 1)',
+ 'autodecimal, x<100%, display_range=8.4 (autodecimal test 2)',
+ 'autodecimal, x<-100%, display_range=1e-6 (tiny display range)',
+ # Check percent symbol
+ 'None as percent symbol',
+ 'Empty percent symbol',
+ 'Custom percent symbol',
+ ]
+
+ latex_data = [
+ (False, False, r'50\{t}%'),
+ (False, True, r'50\\\{t\}\%'),
+ (True, False, r'50\{t}%'),
+ (True, True, r'50\{t}%'),
+ ]
+
+ @pytest.mark.parametrize(
+ 'xmax, decimals, symbol, x, display_range, expected',
+ percent_data, ids=percent_ids)
+ def test_basic(self, xmax, decimals, symbol,
+ x, display_range, expected):
+ formatter = mticker.PercentFormatter(xmax, decimals, symbol)
+ with mpl.rc_context(rc={'text.usetex': False}):
+ assert formatter.format_pct(x, display_range) == expected
+
+ @pytest.mark.parametrize('is_latex, usetex, expected', latex_data)
+ def test_latex(self, is_latex, usetex, expected):
+ fmt = mticker.PercentFormatter(symbol='\\{t}%', is_latex=is_latex)
+ with mpl.rc_context(rc={'text.usetex': usetex}):
+ assert fmt.format_pct(50, 100) == expected
+
+
+def test_majformatter_type():
+ fig, ax = plt.subplots()
+ with pytest.raises(TypeError):
+ ax.xaxis.set_major_formatter(mticker.LogLocator())
+
+
+def test_minformatter_type():
+ fig, ax = plt.subplots()
+ with pytest.raises(TypeError):
+ ax.xaxis.set_minor_formatter(mticker.LogLocator())
+
+
+def test_majlocator_type():
+ fig, ax = plt.subplots()
+ with pytest.raises(TypeError):
+ ax.xaxis.set_major_locator(mticker.LogFormatter())
+
+
+def test_minlocator_type():
+ fig, ax = plt.subplots()
+ with pytest.raises(TypeError):
+ ax.xaxis.set_minor_locator(mticker.LogFormatter())
+
+
+def test_minorticks_rc():
+ fig = plt.figure()
+
+ def minorticksubplot(xminor, yminor, i):
+ rc = {'xtick.minor.visible': xminor,
+ 'ytick.minor.visible': yminor}
+ with plt.rc_context(rc=rc):
+ ax = fig.add_subplot(2, 2, i)
+
+ assert (len(ax.xaxis.get_minor_ticks()) > 0) == xminor
+ assert (len(ax.yaxis.get_minor_ticks()) > 0) == yminor
+
+ minorticksubplot(False, False, 1)
+ minorticksubplot(True, False, 2)
+ minorticksubplot(False, True, 3)
+ minorticksubplot(True, True, 4)
+
+
+@pytest.mark.parametrize('remove_overlapping_locs, expected_num',
+ ((True, 6),
+ (None, 6), # this tests the default
+ (False, 9)))
+def test_remove_overlap(remove_overlapping_locs, expected_num):
+ t = np.arange("2018-11-03", "2018-11-06", dtype="datetime64")
+ x = np.ones(len(t))
+
+ fig, ax = plt.subplots()
+ ax.plot(t, x)
+
+ ax.xaxis.set_major_locator(mpl.dates.DayLocator())
+ ax.xaxis.set_major_formatter(mpl.dates.DateFormatter('\n%a'))
+
+ ax.xaxis.set_minor_locator(mpl.dates.HourLocator((0, 6, 12, 18)))
+ ax.xaxis.set_minor_formatter(mpl.dates.DateFormatter('%H:%M'))
+ # force there to be extra ticks
+ ax.xaxis.get_minor_ticks(15)
+ if remove_overlapping_locs is not None:
+ ax.xaxis.remove_overlapping_locs = remove_overlapping_locs
+
+ # check that getter/setter exists
+ current = ax.xaxis.remove_overlapping_locs
+ assert (current == ax.xaxis.get_remove_overlapping_locs())
+ plt.setp(ax.xaxis, remove_overlapping_locs=current)
+ new = ax.xaxis.remove_overlapping_locs
+ assert (new == ax.xaxis.remove_overlapping_locs)
+
+ # check that the accessors filter correctly
+ # this is the method that does the actual filtering
+ assert len(ax.xaxis.get_minorticklocs()) == expected_num
+ # these three are derivative
+ assert len(ax.xaxis.get_minor_ticks()) == expected_num
+ assert len(ax.xaxis.get_minorticklabels()) == expected_num
+ assert len(ax.xaxis.get_minorticklines()) == expected_num*2
+
+
+@pytest.mark.parametrize('sub', [
+ ['hi', 'aardvark'],
+ np.zeros((2, 2))])
+def test_bad_locator_subs(sub):
+ ll = mticker.LogLocator()
+ with pytest.raises(ValueError):
+ ll.subs(sub)
+
+
+@pytest.mark.parametrize('numticks', [1, 2, 3, 9])
+@pytest.mark.style('default')
+def test_small_range_loglocator(numticks):
+ ll = mticker.LogLocator()
+ ll.set_params(numticks=numticks)
+ for top in [5, 7, 9, 11, 15, 50, 100, 1000]:
+ ticks = ll.tick_values(.5, top)
+ assert (np.diff(np.log10(ll.tick_values(6, 150))) == 1).all()
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_tightlayout.py b/venv/Lib/site-packages/matplotlib/tests/test_tightlayout.py
new file mode 100644
index 0000000..23d363b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_tightlayout.py
@@ -0,0 +1,331 @@
+import warnings
+
+import numpy as np
+from numpy.testing import assert_array_equal
+import pytest
+
+import matplotlib as mpl
+from matplotlib.testing.decorators import image_comparison
+import matplotlib.pyplot as plt
+from matplotlib.offsetbox import AnchoredOffsetbox, DrawingArea
+from matplotlib.patches import Rectangle
+
+
+def example_plot(ax, fontsize=12):
+ ax.plot([1, 2])
+ ax.locator_params(nbins=3)
+ ax.set_xlabel('x-label', fontsize=fontsize)
+ ax.set_ylabel('y-label', fontsize=fontsize)
+ ax.set_title('Title', fontsize=fontsize)
+
+
+@image_comparison(['tight_layout1'], tol=1.9)
+def test_tight_layout1():
+ """Test tight_layout for a single subplot."""
+ fig, ax = plt.subplots()
+ example_plot(ax, fontsize=24)
+ plt.tight_layout()
+
+
+@image_comparison(['tight_layout2'])
+def test_tight_layout2():
+ """Test tight_layout for multiple subplots."""
+ fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2)
+ example_plot(ax1)
+ example_plot(ax2)
+ example_plot(ax3)
+ example_plot(ax4)
+ plt.tight_layout()
+
+
+@image_comparison(['tight_layout3'])
+def test_tight_layout3():
+ """Test tight_layout for multiple subplots."""
+ ax1 = plt.subplot(221)
+ ax2 = plt.subplot(223)
+ ax3 = plt.subplot(122)
+ example_plot(ax1)
+ example_plot(ax2)
+ example_plot(ax3)
+ plt.tight_layout()
+
+
+@image_comparison(['tight_layout4'], freetype_version=('2.5.5', '2.6.1'),
+ tol=0.015)
+def test_tight_layout4():
+ """Test tight_layout for subplot2grid."""
+ ax1 = plt.subplot2grid((3, 3), (0, 0))
+ ax2 = plt.subplot2grid((3, 3), (0, 1), colspan=2)
+ ax3 = plt.subplot2grid((3, 3), (1, 0), colspan=2, rowspan=2)
+ ax4 = plt.subplot2grid((3, 3), (1, 2), rowspan=2)
+ example_plot(ax1)
+ example_plot(ax2)
+ example_plot(ax3)
+ example_plot(ax4)
+ plt.tight_layout()
+
+
+@image_comparison(['tight_layout5'])
+def test_tight_layout5():
+ """Test tight_layout for image."""
+ ax = plt.subplot()
+ arr = np.arange(100).reshape((10, 10))
+ ax.imshow(arr, interpolation="none")
+ plt.tight_layout()
+
+
+@image_comparison(['tight_layout6'])
+def test_tight_layout6():
+ """Test tight_layout for gridspec."""
+
+ # This raises warnings since tight layout cannot
+ # do this fully automatically. But the test is
+ # correct since the layout is manually edited
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore", UserWarning)
+ fig = plt.figure()
+
+ gs1 = mpl.gridspec.GridSpec(2, 1)
+ ax1 = fig.add_subplot(gs1[0])
+ ax2 = fig.add_subplot(gs1[1])
+
+ example_plot(ax1)
+ example_plot(ax2)
+
+ gs1.tight_layout(fig, rect=[0, 0, 0.5, 1])
+
+ gs2 = mpl.gridspec.GridSpec(3, 1)
+
+ for ss in gs2:
+ ax = fig.add_subplot(ss)
+ example_plot(ax)
+ ax.set_title("")
+ ax.set_xlabel("")
+
+ ax.set_xlabel("x-label", fontsize=12)
+
+ gs2.tight_layout(fig, rect=[0.5, 0, 1, 1], h_pad=0.45)
+
+ top = min(gs1.top, gs2.top)
+ bottom = max(gs1.bottom, gs2.bottom)
+
+ gs1.tight_layout(fig, rect=[None, 0 + (bottom-gs1.bottom),
+ 0.5, 1 - (gs1.top-top)])
+ gs2.tight_layout(fig, rect=[0.5, 0 + (bottom-gs2.bottom),
+ None, 1 - (gs2.top-top)],
+ h_pad=0.45)
+
+
+@image_comparison(['tight_layout7'], tol=1.9)
+def test_tight_layout7():
+ # tight layout with left and right titles
+ fontsize = 24
+ fig, ax = plt.subplots()
+ ax.plot([1, 2])
+ ax.locator_params(nbins=3)
+ ax.set_xlabel('x-label', fontsize=fontsize)
+ ax.set_ylabel('y-label', fontsize=fontsize)
+ ax.set_title('Left Title', loc='left', fontsize=fontsize)
+ ax.set_title('Right Title', loc='right', fontsize=fontsize)
+ plt.tight_layout()
+
+
+@image_comparison(['tight_layout8'])
+def test_tight_layout8():
+ """Test automatic use of tight_layout."""
+ fig = plt.figure()
+ fig.set_tight_layout({'pad': .1})
+ ax = fig.add_subplot()
+ example_plot(ax, fontsize=24)
+
+
+@image_comparison(['tight_layout9'])
+def test_tight_layout9():
+ # Test tight_layout for non-visible subplots
+ # GH 8244
+ f, axarr = plt.subplots(2, 2)
+ axarr[1][1].set_visible(False)
+ plt.tight_layout()
+
+
+def test_outward_ticks():
+ """Test automatic use of tight_layout."""
+ fig = plt.figure()
+ ax = fig.add_subplot(221)
+ ax.xaxis.set_tick_params(tickdir='out', length=16, width=3)
+ ax.yaxis.set_tick_params(tickdir='out', length=16, width=3)
+ ax.xaxis.set_tick_params(
+ tickdir='out', length=32, width=3, tick1On=True, which='minor')
+ ax.yaxis.set_tick_params(
+ tickdir='out', length=32, width=3, tick1On=True, which='minor')
+ ax.xaxis.set_ticks([0], minor=True)
+ ax.yaxis.set_ticks([0], minor=True)
+ ax = fig.add_subplot(222)
+ ax.xaxis.set_tick_params(tickdir='in', length=32, width=3)
+ ax.yaxis.set_tick_params(tickdir='in', length=32, width=3)
+ ax = fig.add_subplot(223)
+ ax.xaxis.set_tick_params(tickdir='inout', length=32, width=3)
+ ax.yaxis.set_tick_params(tickdir='inout', length=32, width=3)
+ ax = fig.add_subplot(224)
+ ax.xaxis.set_tick_params(tickdir='out', length=32, width=3)
+ ax.yaxis.set_tick_params(tickdir='out', length=32, width=3)
+ plt.tight_layout()
+ # These values were obtained after visual checking that they correspond
+ # to a tight layouting that did take the ticks into account.
+ ans = [[[0.091, 0.607], [0.433, 0.933]],
+ [[0.579, 0.607], [0.922, 0.933]],
+ [[0.091, 0.140], [0.433, 0.466]],
+ [[0.579, 0.140], [0.922, 0.466]]]
+ for nn, ax in enumerate(fig.axes):
+ assert_array_equal(np.round(ax.get_position().get_points(), 3),
+ ans[nn])
+
+
+def add_offsetboxes(ax, size=10, margin=.1, color='black'):
+ """
+ Surround ax with OffsetBoxes
+ """
+ m, mp = margin, 1+margin
+ anchor_points = [(-m, -m), (-m, .5), (-m, mp),
+ (mp, .5), (.5, mp), (mp, mp),
+ (.5, -m), (mp, -m), (.5, -m)]
+ for point in anchor_points:
+ da = DrawingArea(size, size)
+ background = Rectangle((0, 0), width=size,
+ height=size,
+ facecolor=color,
+ edgecolor='None',
+ linewidth=0,
+ antialiased=False)
+ da.add_artist(background)
+
+ anchored_box = AnchoredOffsetbox(
+ loc='center',
+ child=da,
+ pad=0.,
+ frameon=False,
+ bbox_to_anchor=point,
+ bbox_transform=ax.transAxes,
+ borderpad=0.)
+ ax.add_artist(anchored_box)
+ return anchored_box
+
+
+@image_comparison(['tight_layout_offsetboxes1', 'tight_layout_offsetboxes2'])
+def test_tight_layout_offsetboxes():
+ # 1.
+ # - Create 4 subplots
+ # - Plot a diagonal line on them
+ # - Surround each plot with 7 boxes
+ # - Use tight_layout
+ # - See that the squares are included in the tight_layout
+ # and that the squares in the middle do not overlap
+ #
+ # 2.
+ # - Make the squares around the right side axes invisible
+ # - See that the invisible squares do not affect the
+ # tight_layout
+ rows = cols = 2
+ colors = ['red', 'blue', 'green', 'yellow']
+ x = y = [0, 1]
+
+ def _subplots():
+ _, axs = plt.subplots(rows, cols)
+ axs = axs.flat
+ for ax, color in zip(axs, colors):
+ ax.plot(x, y, color=color)
+ add_offsetboxes(ax, 20, color=color)
+ return axs
+
+ # 1.
+ axs = _subplots()
+ plt.tight_layout()
+
+ # 2.
+ axs = _subplots()
+ for ax in (axs[cols-1::rows]):
+ for child in ax.get_children():
+ if isinstance(child, AnchoredOffsetbox):
+ child.set_visible(False)
+
+ plt.tight_layout()
+
+
+def test_empty_layout():
+ """Test that tight layout doesn't cause an error when there are no axes."""
+ fig = plt.gcf()
+ fig.tight_layout()
+
+
+@pytest.mark.parametrize("label", ["xlabel", "ylabel"])
+def test_verybig_decorators(label):
+ """Test that no warning emitted when xlabel/ylabel too big."""
+ fig, ax = plt.subplots(figsize=(3, 2))
+ ax.set(**{label: 'a' * 100})
+
+
+def test_big_decorators_horizontal():
+ """Test that doesn't warn when xlabel too big."""
+ fig, axs = plt.subplots(1, 2, figsize=(3, 2))
+ axs[0].set_xlabel('a' * 30)
+ axs[1].set_xlabel('b' * 30)
+
+
+def test_big_decorators_vertical():
+ """Test that doesn't warn when ylabel too big."""
+ fig, axs = plt.subplots(2, 1, figsize=(3, 2))
+ axs[0].set_ylabel('a' * 20)
+ axs[1].set_ylabel('b' * 20)
+
+
+def test_badsubplotgrid():
+ # test that we get warning for mismatched subplot grids, not than an error
+ plt.subplot2grid((4, 5), (0, 0))
+ # this is the bad entry:
+ plt.subplot2grid((5, 5), (0, 3), colspan=3, rowspan=5)
+ with pytest.warns(UserWarning):
+ plt.tight_layout()
+
+
+def test_collapsed():
+ # test that if the amount of space required to make all the axes
+ # decorations fit would mean that the actual Axes would end up with size
+ # zero (i.e. margins add up to more than the available width) that a call
+ # to tight_layout will not get applied:
+ fig, ax = plt.subplots(tight_layout=True)
+ ax.set_xlim([0, 1])
+ ax.set_ylim([0, 1])
+
+ ax.annotate('BIG LONG STRING', xy=(1.25, 2), xytext=(10.5, 1.75),
+ annotation_clip=False)
+ p1 = ax.get_position()
+ with pytest.warns(UserWarning):
+ plt.tight_layout()
+ p2 = ax.get_position()
+ assert p1.width == p2.width
+ # test that passing a rect doesn't crash...
+ with pytest.warns(UserWarning):
+ plt.tight_layout(rect=[0, 0, 0.8, 0.8])
+
+
+def test_suptitle():
+ fig, ax = plt.subplots(tight_layout=True)
+ st = fig.suptitle("foo")
+ t = ax.set_title("bar")
+ fig.canvas.draw()
+ assert st.get_window_extent().y0 > t.get_window_extent().y1
+
+
+@pytest.mark.backend("pdf")
+def test_non_agg_renderer(monkeypatch, recwarn):
+ unpatched_init = mpl.backend_bases.RendererBase.__init__
+
+ def __init__(self, *args, **kwargs):
+ # Check that we don't instantiate any other renderer than a pdf
+ # renderer to perform pdf tight layout.
+ assert isinstance(self, mpl.backends.backend_pdf.RendererPdf)
+ unpatched_init(self, *args, **kwargs)
+
+ monkeypatch.setattr(mpl.backend_bases.RendererBase, "__init__", __init__)
+ fig, ax = plt.subplots()
+ fig.tight_layout()
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_transforms.py b/venv/Lib/site-packages/matplotlib/tests/test_transforms.py
new file mode 100644
index 0000000..ad572fe
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_transforms.py
@@ -0,0 +1,738 @@
+import copy
+
+import numpy as np
+from numpy.testing import (assert_allclose, assert_almost_equal,
+ assert_array_equal, assert_array_almost_equal)
+import pytest
+
+from matplotlib import scale
+import matplotlib.pyplot as plt
+import matplotlib.patches as mpatches
+import matplotlib.transforms as mtransforms
+from matplotlib.path import Path
+from matplotlib.testing.decorators import image_comparison
+
+
+def test_non_affine_caching():
+ class AssertingNonAffineTransform(mtransforms.Transform):
+ """
+ This transform raises an assertion error when called when it
+ shouldn't be and ``self.raise_on_transform`` is True.
+
+ """
+ input_dims = output_dims = 2
+ is_affine = False
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.raise_on_transform = False
+ self.underlying_transform = mtransforms.Affine2D().scale(10, 10)
+
+ def transform_path_non_affine(self, path):
+ assert not self.raise_on_transform, \
+ 'Invalidated affine part of transform unnecessarily.'
+ return self.underlying_transform.transform_path(path)
+ transform_path = transform_path_non_affine
+
+ def transform_non_affine(self, path):
+ assert not self.raise_on_transform, \
+ 'Invalidated affine part of transform unnecessarily.'
+ return self.underlying_transform.transform(path)
+ transform = transform_non_affine
+
+ my_trans = AssertingNonAffineTransform()
+ ax = plt.axes()
+ plt.plot(np.arange(10), transform=my_trans + ax.transData)
+ plt.draw()
+ # enable the transform to raise an exception if it's non-affine transform
+ # method is triggered again.
+ my_trans.raise_on_transform = True
+ ax.transAxes.invalidate()
+ plt.draw()
+
+
+def test_external_transform_api():
+ class ScaledBy:
+ def __init__(self, scale_factor):
+ self._scale_factor = scale_factor
+
+ def _as_mpl_transform(self, axes):
+ return (mtransforms.Affine2D().scale(self._scale_factor)
+ + axes.transData)
+
+ ax = plt.axes()
+ line, = plt.plot(np.arange(10), transform=ScaledBy(10))
+ ax.set_xlim(0, 100)
+ ax.set_ylim(0, 100)
+ # assert that the top transform of the line is the scale transform.
+ assert_allclose(line.get_transform()._a.get_matrix(),
+ mtransforms.Affine2D().scale(10).get_matrix())
+
+
+@image_comparison(['pre_transform_data'],
+ tol=0.08, remove_text=True, style='mpl20')
+def test_pre_transform_plotting():
+ # a catch-all for as many as possible plot layouts which handle
+ # pre-transforming the data NOTE: The axis range is important in this
+ # plot. It should be x10 what the data suggests it should be
+
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ ax = plt.axes()
+ times10 = mtransforms.Affine2D().scale(10)
+
+ ax.contourf(np.arange(48).reshape(6, 8), transform=times10 + ax.transData)
+
+ ax.pcolormesh(np.linspace(0, 4, 7),
+ np.linspace(5.5, 8, 9),
+ np.arange(48).reshape(8, 6),
+ transform=times10 + ax.transData)
+
+ ax.scatter(np.linspace(0, 10), np.linspace(10, 0),
+ transform=times10 + ax.transData)
+
+ x = np.linspace(8, 10, 20)
+ y = np.linspace(1, 5, 20)
+ u = 2*np.sin(x) + np.cos(y[:, np.newaxis])
+ v = np.sin(x) - np.cos(y[:, np.newaxis])
+
+ df = 25. / 30. # Compatibility factor for old test image
+ ax.streamplot(x, y, u, v, transform=times10 + ax.transData,
+ density=(df, df), linewidth=u**2 + v**2)
+
+ # reduce the vector data down a bit for barb and quiver plotting
+ x, y = x[::3], y[::3]
+ u, v = u[::3, ::3], v[::3, ::3]
+
+ ax.quiver(x, y + 5, u, v, transform=times10 + ax.transData)
+
+ ax.barbs(x - 3, y + 5, u**2, v**2, transform=times10 + ax.transData)
+
+
+def test_contour_pre_transform_limits():
+ ax = plt.axes()
+ xs, ys = np.meshgrid(np.linspace(15, 20, 15), np.linspace(12.4, 12.5, 20))
+ ax.contourf(xs, ys, np.log(xs * ys),
+ transform=mtransforms.Affine2D().scale(0.1) + ax.transData)
+
+ expected = np.array([[1.5, 1.24],
+ [2., 1.25]])
+ assert_almost_equal(expected, ax.dataLim.get_points())
+
+
+def test_pcolor_pre_transform_limits():
+ # Based on test_contour_pre_transform_limits()
+ ax = plt.axes()
+ xs, ys = np.meshgrid(np.linspace(15, 20, 15), np.linspace(12.4, 12.5, 20))
+ ax.pcolor(xs, ys, np.log(xs * ys)[:-1, :-1],
+ transform=mtransforms.Affine2D().scale(0.1) + ax.transData)
+
+ expected = np.array([[1.5, 1.24],
+ [2., 1.25]])
+ assert_almost_equal(expected, ax.dataLim.get_points())
+
+
+def test_pcolormesh_pre_transform_limits():
+ # Based on test_contour_pre_transform_limits()
+ ax = plt.axes()
+ xs, ys = np.meshgrid(np.linspace(15, 20, 15), np.linspace(12.4, 12.5, 20))
+ ax.pcolormesh(xs, ys, np.log(xs * ys)[:-1, :-1],
+ transform=mtransforms.Affine2D().scale(0.1) + ax.transData)
+
+ expected = np.array([[1.5, 1.24],
+ [2., 1.25]])
+ assert_almost_equal(expected, ax.dataLim.get_points())
+
+
+def test_Affine2D_from_values():
+ points = np.array([[0, 0],
+ [10, 20],
+ [-1, 0],
+ ])
+
+ t = mtransforms.Affine2D.from_values(1, 0, 0, 0, 0, 0)
+ actual = t.transform(points)
+ expected = np.array([[0, 0], [10, 0], [-1, 0]])
+ assert_almost_equal(actual, expected)
+
+ t = mtransforms.Affine2D.from_values(0, 2, 0, 0, 0, 0)
+ actual = t.transform(points)
+ expected = np.array([[0, 0], [0, 20], [0, -2]])
+ assert_almost_equal(actual, expected)
+
+ t = mtransforms.Affine2D.from_values(0, 0, 3, 0, 0, 0)
+ actual = t.transform(points)
+ expected = np.array([[0, 0], [60, 0], [0, 0]])
+ assert_almost_equal(actual, expected)
+
+ t = mtransforms.Affine2D.from_values(0, 0, 0, 4, 0, 0)
+ actual = t.transform(points)
+ expected = np.array([[0, 0], [0, 80], [0, 0]])
+ assert_almost_equal(actual, expected)
+
+ t = mtransforms.Affine2D.from_values(0, 0, 0, 0, 5, 0)
+ actual = t.transform(points)
+ expected = np.array([[5, 0], [5, 0], [5, 0]])
+ assert_almost_equal(actual, expected)
+
+ t = mtransforms.Affine2D.from_values(0, 0, 0, 0, 0, 6)
+ actual = t.transform(points)
+ expected = np.array([[0, 6], [0, 6], [0, 6]])
+ assert_almost_equal(actual, expected)
+
+
+def test_affine_inverted_invalidated():
+ # Ensure that the an affine transform is not declared valid on access
+ point = [1.0, 1.0]
+ t = mtransforms.Affine2D()
+
+ assert_almost_equal(point, t.transform(t.inverted().transform(point)))
+ # Change and access the transform
+ t.translate(1.0, 1.0).get_matrix()
+ assert_almost_equal(point, t.transform(t.inverted().transform(point)))
+
+
+def test_clipping_of_log():
+ # issue 804
+ path = Path([(0.2, -99), (0.4, -99), (0.4, 20), (0.2, 20), (0.2, -99)],
+ closed=True)
+ # something like this happens in plotting logarithmic histograms
+ trans = mtransforms.BlendedGenericTransform(
+ mtransforms.Affine2D(), scale.LogTransform(10, 'clip'))
+ tpath = trans.transform_path_non_affine(path)
+ result = tpath.iter_segments(trans.get_affine(),
+ clip=(0, 0, 100, 100),
+ simplify=False)
+ tpoints, tcodes = zip(*result)
+ assert_allclose(tcodes, path.codes)
+
+
+class NonAffineForTest(mtransforms.Transform):
+ """
+ A class which looks like a non affine transform, but does whatever
+ the given transform does (even if it is affine). This is very useful
+ for testing NonAffine behaviour with a simple Affine transform.
+
+ """
+ is_affine = False
+ output_dims = 2
+ input_dims = 2
+
+ def __init__(self, real_trans, *args, **kwargs):
+ self.real_trans = real_trans
+ super().__init__(*args, **kwargs)
+
+ def transform_non_affine(self, values):
+ return self.real_trans.transform(values)
+
+ def transform_path_non_affine(self, path):
+ return self.real_trans.transform_path(path)
+
+
+class TestBasicTransform:
+ def setup_method(self):
+
+ self.ta1 = mtransforms.Affine2D(shorthand_name='ta1').rotate(np.pi / 2)
+ self.ta2 = mtransforms.Affine2D(shorthand_name='ta2').translate(10, 0)
+ self.ta3 = mtransforms.Affine2D(shorthand_name='ta3').scale(1, 2)
+
+ self.tn1 = NonAffineForTest(mtransforms.Affine2D().translate(1, 2),
+ shorthand_name='tn1')
+ self.tn2 = NonAffineForTest(mtransforms.Affine2D().translate(1, 2),
+ shorthand_name='tn2')
+ self.tn3 = NonAffineForTest(mtransforms.Affine2D().translate(1, 2),
+ shorthand_name='tn3')
+
+ # creates a transform stack which looks like ((A, (N, A)), A)
+ self.stack1 = (self.ta1 + (self.tn1 + self.ta2)) + self.ta3
+ # creates a transform stack which looks like (((A, N), A), A)
+ self.stack2 = self.ta1 + self.tn1 + self.ta2 + self.ta3
+ # creates a transform stack which is a subset of stack2
+ self.stack2_subset = self.tn1 + self.ta2 + self.ta3
+
+ # when in debug, the transform stacks can produce dot images:
+# self.stack1.write_graphviz(file('stack1.dot', 'w'))
+# self.stack2.write_graphviz(file('stack2.dot', 'w'))
+# self.stack2_subset.write_graphviz(file('stack2_subset.dot', 'w'))
+
+ def test_transform_depth(self):
+ assert self.stack1.depth == 4
+ assert self.stack2.depth == 4
+ assert self.stack2_subset.depth == 3
+
+ def test_left_to_right_iteration(self):
+ stack3 = (self.ta1 + (self.tn1 + (self.ta2 + self.tn2))) + self.ta3
+# stack3.write_graphviz(file('stack3.dot', 'w'))
+
+ target_transforms = [stack3,
+ (self.tn1 + (self.ta2 + self.tn2)) + self.ta3,
+ (self.ta2 + self.tn2) + self.ta3,
+ self.tn2 + self.ta3,
+ self.ta3,
+ ]
+ r = [rh for _, rh in stack3._iter_break_from_left_to_right()]
+ assert len(r) == len(target_transforms)
+
+ for target_stack, stack in zip(target_transforms, r):
+ assert target_stack == stack
+
+ def test_transform_shortcuts(self):
+ assert self.stack1 - self.stack2_subset == self.ta1
+ assert self.stack2 - self.stack2_subset == self.ta1
+
+ assert self.stack2_subset - self.stack2 == self.ta1.inverted()
+ assert (self.stack2_subset - self.stack2).depth == 1
+
+ with pytest.raises(ValueError):
+ self.stack1 - self.stack2
+
+ aff1 = self.ta1 + (self.ta2 + self.ta3)
+ aff2 = self.ta2 + self.ta3
+
+ assert aff1 - aff2 == self.ta1
+ assert aff1 - self.ta2 == aff1 + self.ta2.inverted()
+
+ assert self.stack1 - self.ta3 == self.ta1 + (self.tn1 + self.ta2)
+ assert self.stack2 - self.ta3 == self.ta1 + self.tn1 + self.ta2
+
+ assert ((self.ta2 + self.ta3) - self.ta3 + self.ta3 ==
+ self.ta2 + self.ta3)
+
+ def test_contains_branch(self):
+ r1 = (self.ta2 + self.ta1)
+ r2 = (self.ta2 + self.ta1)
+ assert r1 == r2
+ assert r1 != self.ta1
+ assert r1.contains_branch(r2)
+ assert r1.contains_branch(self.ta1)
+ assert not r1.contains_branch(self.ta2)
+ assert not r1.contains_branch(self.ta2 + self.ta2)
+
+ assert r1 == r2
+
+ assert self.stack1.contains_branch(self.ta3)
+ assert self.stack2.contains_branch(self.ta3)
+
+ assert self.stack1.contains_branch(self.stack2_subset)
+ assert self.stack2.contains_branch(self.stack2_subset)
+
+ assert not self.stack2_subset.contains_branch(self.stack1)
+ assert not self.stack2_subset.contains_branch(self.stack2)
+
+ assert self.stack1.contains_branch(self.ta2 + self.ta3)
+ assert self.stack2.contains_branch(self.ta2 + self.ta3)
+
+ assert not self.stack1.contains_branch(self.tn1 + self.ta2)
+
+ def test_affine_simplification(self):
+ # tests that a transform stack only calls as much is absolutely
+ # necessary "non-affine" allowing the best possible optimization with
+ # complex transformation stacks.
+ points = np.array([[0, 0], [10, 20], [np.nan, 1], [-1, 0]],
+ dtype=np.float64)
+ na_pts = self.stack1.transform_non_affine(points)
+ all_pts = self.stack1.transform(points)
+
+ na_expected = np.array([[1., 2.], [-19., 12.],
+ [np.nan, np.nan], [1., 1.]], dtype=np.float64)
+ all_expected = np.array([[11., 4.], [-9., 24.],
+ [np.nan, np.nan], [11., 2.]],
+ dtype=np.float64)
+
+ # check we have the expected results from doing the affine part only
+ assert_array_almost_equal(na_pts, na_expected)
+ # check we have the expected results from a full transformation
+ assert_array_almost_equal(all_pts, all_expected)
+ # check we have the expected results from doing the transformation in
+ # two steps
+ assert_array_almost_equal(self.stack1.transform_affine(na_pts),
+ all_expected)
+ # check that getting the affine transformation first, then fully
+ # transforming using that yields the same result as before.
+ assert_array_almost_equal(self.stack1.get_affine().transform(na_pts),
+ all_expected)
+
+ # check that the affine part of stack1 & stack2 are equivalent
+ # (i.e. the optimization is working)
+ expected_result = (self.ta2 + self.ta3).get_matrix()
+ result = self.stack1.get_affine().get_matrix()
+ assert_array_equal(expected_result, result)
+
+ result = self.stack2.get_affine().get_matrix()
+ assert_array_equal(expected_result, result)
+
+
+class TestTransformPlotInterface:
+ def test_line_extent_axes_coords(self):
+ # a simple line in axes coordinates
+ ax = plt.axes()
+ ax.plot([0.1, 1.2, 0.8], [0.9, 0.5, 0.8], transform=ax.transAxes)
+ assert_array_equal(ax.dataLim.get_points(),
+ np.array([[np.inf, np.inf],
+ [-np.inf, -np.inf]]))
+
+ def test_line_extent_data_coords(self):
+ # a simple line in data coordinates
+ ax = plt.axes()
+ ax.plot([0.1, 1.2, 0.8], [0.9, 0.5, 0.8], transform=ax.transData)
+ assert_array_equal(ax.dataLim.get_points(),
+ np.array([[0.1, 0.5], [1.2, 0.9]]))
+
+ def test_line_extent_compound_coords1(self):
+ # a simple line in data coordinates in the y component, and in axes
+ # coordinates in the x
+ ax = plt.axes()
+ trans = mtransforms.blended_transform_factory(ax.transAxes,
+ ax.transData)
+ ax.plot([0.1, 1.2, 0.8], [35, -5, 18], transform=trans)
+ assert_array_equal(ax.dataLim.get_points(),
+ np.array([[np.inf, -5.],
+ [-np.inf, 35.]]))
+
+ def test_line_extent_predata_transform_coords(self):
+ # a simple line in (offset + data) coordinates
+ ax = plt.axes()
+ trans = mtransforms.Affine2D().scale(10) + ax.transData
+ ax.plot([0.1, 1.2, 0.8], [35, -5, 18], transform=trans)
+ assert_array_equal(ax.dataLim.get_points(),
+ np.array([[1., -50.], [12., 350.]]))
+
+ def test_line_extent_compound_coords2(self):
+ # a simple line in (offset + data) coordinates in the y component, and
+ # in axes coordinates in the x
+ ax = plt.axes()
+ trans = mtransforms.blended_transform_factory(
+ ax.transAxes, mtransforms.Affine2D().scale(10) + ax.transData)
+ ax.plot([0.1, 1.2, 0.8], [35, -5, 18], transform=trans)
+ assert_array_equal(ax.dataLim.get_points(),
+ np.array([[np.inf, -50.], [-np.inf, 350.]]))
+
+ def test_line_extents_affine(self):
+ ax = plt.axes()
+ offset = mtransforms.Affine2D().translate(10, 10)
+ plt.plot(np.arange(10), transform=offset + ax.transData)
+ expected_data_lim = np.array([[0., 0.], [9., 9.]]) + 10
+ assert_array_almost_equal(ax.dataLim.get_points(), expected_data_lim)
+
+ def test_line_extents_non_affine(self):
+ ax = plt.axes()
+ offset = mtransforms.Affine2D().translate(10, 10)
+ na_offset = NonAffineForTest(mtransforms.Affine2D().translate(10, 10))
+ plt.plot(np.arange(10), transform=offset + na_offset + ax.transData)
+ expected_data_lim = np.array([[0., 0.], [9., 9.]]) + 20
+ assert_array_almost_equal(ax.dataLim.get_points(), expected_data_lim)
+
+ def test_pathc_extents_non_affine(self):
+ ax = plt.axes()
+ offset = mtransforms.Affine2D().translate(10, 10)
+ na_offset = NonAffineForTest(mtransforms.Affine2D().translate(10, 10))
+ pth = Path(np.array([[0, 0], [0, 10], [10, 10], [10, 0]]))
+ patch = mpatches.PathPatch(pth,
+ transform=offset + na_offset + ax.transData)
+ ax.add_patch(patch)
+ expected_data_lim = np.array([[0., 0.], [10., 10.]]) + 20
+ assert_array_almost_equal(ax.dataLim.get_points(), expected_data_lim)
+
+ def test_pathc_extents_affine(self):
+ ax = plt.axes()
+ offset = mtransforms.Affine2D().translate(10, 10)
+ pth = Path(np.array([[0, 0], [0, 10], [10, 10], [10, 0]]))
+ patch = mpatches.PathPatch(pth, transform=offset + ax.transData)
+ ax.add_patch(patch)
+ expected_data_lim = np.array([[0., 0.], [10., 10.]]) + 10
+ assert_array_almost_equal(ax.dataLim.get_points(), expected_data_lim)
+
+ def test_line_extents_for_non_affine_transData(self):
+ ax = plt.axes(projection='polar')
+ # add 10 to the radius of the data
+ offset = mtransforms.Affine2D().translate(0, 10)
+
+ plt.plot(np.arange(10), transform=offset + ax.transData)
+ # the data lim of a polar plot is stored in coordinates
+ # before a transData transformation, hence the data limits
+ # are not what is being shown on the actual plot.
+ expected_data_lim = np.array([[0., 0.], [9., 9.]]) + [0, 10]
+ assert_array_almost_equal(ax.dataLim.get_points(), expected_data_lim)
+
+
+def assert_bbox_eq(bbox1, bbox2):
+ assert_array_equal(bbox1.bounds, bbox2.bounds)
+
+
+def test_bbox_intersection():
+ bbox_from_ext = mtransforms.Bbox.from_extents
+ inter = mtransforms.Bbox.intersection
+
+ r1 = bbox_from_ext(0, 0, 1, 1)
+ r2 = bbox_from_ext(0.5, 0.5, 1.5, 1.5)
+ r3 = bbox_from_ext(0.5, 0, 0.75, 0.75)
+ r4 = bbox_from_ext(0.5, 1.5, 1, 2.5)
+ r5 = bbox_from_ext(1, 1, 2, 2)
+
+ # self intersection -> no change
+ assert_bbox_eq(inter(r1, r1), r1)
+ # simple intersection
+ assert_bbox_eq(inter(r1, r2), bbox_from_ext(0.5, 0.5, 1, 1))
+ # r3 contains r2
+ assert_bbox_eq(inter(r1, r3), r3)
+ # no intersection
+ assert inter(r1, r4) is None
+ # single point
+ assert_bbox_eq(inter(r1, r5), bbox_from_ext(1, 1, 1, 1))
+
+
+def test_bbox_as_strings():
+ b = mtransforms.Bbox([[.5, 0], [.75, .75]])
+ assert_bbox_eq(b, eval(repr(b), {'Bbox': mtransforms.Bbox}))
+ asdict = eval(str(b), {'Bbox': dict})
+ for k, v in asdict.items():
+ assert getattr(b, k) == v
+ fmt = '.1f'
+ asdict = eval(format(b, fmt), {'Bbox': dict})
+ for k, v in asdict.items():
+ assert eval(format(getattr(b, k), fmt)) == v
+
+
+def test_str_transform():
+ # The str here should not be considered as "absolutely stable", and may be
+ # reformatted later; this is just a smoketest for __str__.
+ assert str(plt.subplot(projection="polar").transData) == """\
+CompositeGenericTransform(
+ CompositeGenericTransform(
+ CompositeGenericTransform(
+ TransformWrapper(
+ BlendedAffine2D(
+ IdentityTransform(),
+ IdentityTransform())),
+ CompositeAffine2D(
+ Affine2D(
+ [[1. 0. 0.]
+ [0. 1. 0.]
+ [0. 0. 1.]]),
+ Affine2D(
+ [[1. 0. 0.]
+ [0. 1. 0.]
+ [0. 0. 1.]]))),
+ PolarTransform(
+ PolarAxesSubplot(0.125,0.1;0.775x0.8),
+ use_rmin=True,
+ _apply_theta_transforms=False)),
+ CompositeGenericTransform(
+ CompositeGenericTransform(
+ PolarAffine(
+ TransformWrapper(
+ BlendedAffine2D(
+ IdentityTransform(),
+ IdentityTransform())),
+ LockableBbox(
+ Bbox(x0=0.0, y0=0.0, x1=6.283185307179586, y1=1.0),
+ [[-- --]
+ [-- --]])),
+ BboxTransformFrom(
+ _WedgeBbox(
+ (0.5, 0.5),
+ TransformedBbox(
+ Bbox(x0=0.0, y0=0.0, x1=6.283185307179586, y1=1.0),
+ CompositeAffine2D(
+ Affine2D(
+ [[1. 0. 0.]
+ [0. 1. 0.]
+ [0. 0. 1.]]),
+ Affine2D(
+ [[1. 0. 0.]
+ [0. 1. 0.]
+ [0. 0. 1.]]))),
+ LockableBbox(
+ Bbox(x0=0.0, y0=0.0, x1=6.283185307179586, y1=1.0),
+ [[-- --]
+ [-- --]])))),
+ BboxTransformTo(
+ TransformedBbox(
+ Bbox(x0=0.125, y0=0.09999999999999998, x1=0.9, y1=0.9),
+ BboxTransformTo(
+ TransformedBbox(
+ Bbox(x0=0.0, y0=0.0, x1=8.0, y1=6.0),
+ Affine2D(
+ [[80. 0. 0.]
+ [ 0. 80. 0.]
+ [ 0. 0. 1.]])))))))"""
+
+
+def test_transform_single_point():
+ t = mtransforms.Affine2D()
+ r = t.transform_affine((1, 1))
+ assert r.shape == (2,)
+
+
+def test_log_transform():
+ # Tests that the last line runs without exception (previously the
+ # transform would fail if one of the axes was logarithmic).
+ fig, ax = plt.subplots()
+ ax.set_yscale('log')
+ ax.transData.transform((1, 1))
+
+
+def test_nan_overlap():
+ a = mtransforms.Bbox([[0, 0], [1, 1]])
+ b = mtransforms.Bbox([[0, 0], [1, np.nan]])
+ assert not a.overlaps(b)
+
+
+def test_transform_angles():
+ t = mtransforms.Affine2D() # Identity transform
+ angles = np.array([20, 45, 60])
+ points = np.array([[0, 0], [1, 1], [2, 2]])
+
+ # Identity transform does not change angles
+ new_angles = t.transform_angles(angles, points)
+ assert_array_almost_equal(angles, new_angles)
+
+ # points missing a 2nd dimension
+ with pytest.raises(ValueError):
+ t.transform_angles(angles, points[0:2, 0:1])
+
+ # Number of angles != Number of points
+ with pytest.raises(ValueError):
+ t.transform_angles(angles, points[0:2, :])
+
+
+def test_nonsingular():
+ # test for zero-expansion type cases; other cases may be added later
+ zero_expansion = np.array([-0.001, 0.001])
+ cases = [(0, np.nan), (0, 0), (0, 7.9e-317)]
+ for args in cases:
+ out = np.array(mtransforms.nonsingular(*args))
+ assert_array_equal(out, zero_expansion)
+
+
+def test_invalid_arguments():
+ t = mtransforms.Affine2D()
+ # There are two different exceptions, since the wrong number of
+ # dimensions is caught when constructing an array_view, and that
+ # raises a ValueError, and a wrong shape with a possible number
+ # of dimensions is caught by our CALL_CPP macro, which always
+ # raises the less precise RuntimeError.
+ with pytest.raises(ValueError):
+ t.transform(1)
+ with pytest.raises(ValueError):
+ t.transform([[[1]]])
+ with pytest.raises(RuntimeError):
+ t.transform([])
+ with pytest.raises(RuntimeError):
+ t.transform([1])
+ with pytest.raises(RuntimeError):
+ t.transform([[1]])
+ with pytest.raises(RuntimeError):
+ t.transform([[1, 2, 3]])
+
+
+def test_transformed_path():
+ points = [(0, 0), (1, 0), (1, 1), (0, 1)]
+ path = Path(points, closed=True)
+
+ trans = mtransforms.Affine2D()
+ trans_path = mtransforms.TransformedPath(path, trans)
+ assert_allclose(trans_path.get_fully_transformed_path().vertices, points)
+
+ # Changing the transform should change the result.
+ r2 = 1 / np.sqrt(2)
+ trans.rotate(np.pi / 4)
+ assert_allclose(trans_path.get_fully_transformed_path().vertices,
+ [(0, 0), (r2, r2), (0, 2 * r2), (-r2, r2)],
+ atol=1e-15)
+
+ # Changing the path does not change the result (it's cached).
+ path.points = [(0, 0)] * 4
+ assert_allclose(trans_path.get_fully_transformed_path().vertices,
+ [(0, 0), (r2, r2), (0, 2 * r2), (-r2, r2)],
+ atol=1e-15)
+
+
+def test_transformed_patch_path():
+ trans = mtransforms.Affine2D()
+ patch = mpatches.Wedge((0, 0), 1, 45, 135, transform=trans)
+
+ tpatch = mtransforms.TransformedPatchPath(patch)
+ points = tpatch.get_fully_transformed_path().vertices
+
+ # Changing the transform should change the result.
+ trans.scale(2)
+ assert_allclose(tpatch.get_fully_transformed_path().vertices, points * 2)
+
+ # Changing the path should change the result (and cancel out the scaling
+ # from the transform).
+ patch.set_radius(0.5)
+ assert_allclose(tpatch.get_fully_transformed_path().vertices, points)
+
+
+@pytest.mark.parametrize('locked_element', ['x0', 'y0', 'x1', 'y1'])
+def test_lockable_bbox(locked_element):
+ other_elements = ['x0', 'y0', 'x1', 'y1']
+ other_elements.remove(locked_element)
+
+ orig = mtransforms.Bbox.unit()
+ locked = mtransforms.LockableBbox(orig, **{locked_element: 2})
+
+ # LockableBbox should keep its locked element as specified in __init__.
+ assert getattr(locked, locked_element) == 2
+ assert getattr(locked, 'locked_' + locked_element) == 2
+ for elem in other_elements:
+ assert getattr(locked, elem) == getattr(orig, elem)
+
+ # Changing underlying Bbox should update everything but locked element.
+ orig.set_points(orig.get_points() + 10)
+ assert getattr(locked, locked_element) == 2
+ assert getattr(locked, 'locked_' + locked_element) == 2
+ for elem in other_elements:
+ assert getattr(locked, elem) == getattr(orig, elem)
+
+ # Unlocking element should revert values back to the underlying Bbox.
+ setattr(locked, 'locked_' + locked_element, None)
+ assert getattr(locked, 'locked_' + locked_element) is None
+ assert np.all(orig.get_points() == locked.get_points())
+
+ # Relocking an element should change its value, but not others.
+ setattr(locked, 'locked_' + locked_element, 3)
+ assert getattr(locked, locked_element) == 3
+ assert getattr(locked, 'locked_' + locked_element) == 3
+ for elem in other_elements:
+ assert getattr(locked, elem) == getattr(orig, elem)
+
+
+def test_copy():
+ a = mtransforms.Affine2D()
+ b = mtransforms.Affine2D()
+ s = a + b
+ # Updating a dependee should invalidate a copy of the dependent.
+ s.get_matrix() # resolve it.
+ s1 = copy.copy(s)
+ assert not s._invalid and not s1._invalid
+ a.translate(1, 2)
+ assert s._invalid and s1._invalid
+ assert (s1.get_matrix() == a.get_matrix()).all()
+ # Updating a copy of a dependee shouldn't invalidate a dependent.
+ s.get_matrix() # resolve it.
+ b1 = copy.copy(b)
+ b1.translate(3, 4)
+ assert not s._invalid
+ assert (s.get_matrix() == a.get_matrix()).all()
+
+
+def test_deepcopy():
+ a = mtransforms.Affine2D()
+ b = mtransforms.Affine2D()
+ s = a + b
+ # Updating a dependee shouldn't invalidate a deepcopy of the dependent.
+ s.get_matrix() # resolve it.
+ s1 = copy.deepcopy(s)
+ assert not s._invalid and not s1._invalid
+ a.translate(1, 2)
+ assert s._invalid and not s1._invalid
+ assert (s1.get_matrix() == mtransforms.Affine2D().get_matrix()).all()
+ # Updating a deepcopy of a dependee shouldn't invalidate a dependent.
+ s.get_matrix() # resolve it.
+ b1 = copy.deepcopy(b)
+ b1.translate(3, 4)
+ assert not s._invalid
+ assert (s.get_matrix() == a.get_matrix()).all()
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_triangulation.py b/venv/Lib/site-packages/matplotlib/tests/test_triangulation.py
new file mode 100644
index 0000000..dacbfd3
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_triangulation.py
@@ -0,0 +1,1165 @@
+import numpy as np
+from numpy.testing import (
+ assert_array_equal, assert_array_almost_equal, assert_array_less)
+import numpy.ma.testutils as matest
+import pytest
+
+import matplotlib as mpl
+import matplotlib.cm as cm
+import matplotlib.pyplot as plt
+import matplotlib.tri as mtri
+from matplotlib.path import Path
+from matplotlib.testing.decorators import image_comparison
+
+
+def test_delaunay():
+ # No duplicate points, regular grid.
+ nx = 5
+ ny = 4
+ x, y = np.meshgrid(np.linspace(0.0, 1.0, nx), np.linspace(0.0, 1.0, ny))
+ x = x.ravel()
+ y = y.ravel()
+ npoints = nx*ny
+ ntriangles = 2 * (nx-1) * (ny-1)
+ nedges = 3*nx*ny - 2*nx - 2*ny + 1
+
+ # Create delaunay triangulation.
+ triang = mtri.Triangulation(x, y)
+
+ # The tests in the remainder of this function should be passed by any
+ # triangulation that does not contain duplicate points.
+
+ # Points - floating point.
+ assert_array_almost_equal(triang.x, x)
+ assert_array_almost_equal(triang.y, y)
+
+ # Triangles - integers.
+ assert len(triang.triangles) == ntriangles
+ assert np.min(triang.triangles) == 0
+ assert np.max(triang.triangles) == npoints-1
+
+ # Edges - integers.
+ assert len(triang.edges) == nedges
+ assert np.min(triang.edges) == 0
+ assert np.max(triang.edges) == npoints-1
+
+ # Neighbors - integers.
+ # Check that neighbors calculated by C++ triangulation class are the same
+ # as those returned from delaunay routine.
+ neighbors = triang.neighbors
+ triang._neighbors = None
+ assert_array_equal(triang.neighbors, neighbors)
+
+ # Is each point used in at least one triangle?
+ assert_array_equal(np.unique(triang.triangles), np.arange(npoints))
+
+
+def test_delaunay_duplicate_points():
+ npoints = 10
+ duplicate = 7
+ duplicate_of = 3
+
+ np.random.seed(23)
+ x = np.random.random(npoints)
+ y = np.random.random(npoints)
+ x[duplicate] = x[duplicate_of]
+ y[duplicate] = y[duplicate_of]
+
+ # Create delaunay triangulation.
+ triang = mtri.Triangulation(x, y)
+
+ # Duplicate points should be ignored, so the index of the duplicate points
+ # should not appear in any triangle.
+ assert_array_equal(np.unique(triang.triangles),
+ np.delete(np.arange(npoints), duplicate))
+
+
+def test_delaunay_points_in_line():
+ # Cannot triangulate points that are all in a straight line, but check
+ # that delaunay code fails gracefully.
+ x = np.linspace(0.0, 10.0, 11)
+ y = np.linspace(0.0, 10.0, 11)
+ with pytest.raises(RuntimeError):
+ mtri.Triangulation(x, y)
+
+ # Add an extra point not on the line and the triangulation is OK.
+ x = np.append(x, 2.0)
+ y = np.append(y, 8.0)
+ mtri.Triangulation(x, y)
+
+
+@pytest.mark.parametrize('x, y', [
+ # Triangulation should raise a ValueError if passed less than 3 points.
+ ([], []),
+ ([1], [5]),
+ ([1, 2], [5, 6]),
+ # Triangulation should also raise a ValueError if passed duplicate points
+ # such that there are less than 3 unique points.
+ ([1, 2, 1], [5, 6, 5]),
+ ([1, 2, 2], [5, 6, 6]),
+ ([1, 1, 1, 2, 1, 2], [5, 5, 5, 6, 5, 6]),
+])
+def test_delaunay_insufficient_points(x, y):
+ with pytest.raises(ValueError):
+ mtri.Triangulation(x, y)
+
+
+def test_delaunay_robust():
+ # Fails when mtri.Triangulation uses matplotlib.delaunay, works when using
+ # qhull.
+ tri_points = np.array([
+ [0.8660254037844384, -0.5000000000000004],
+ [0.7577722283113836, -0.5000000000000004],
+ [0.6495190528383288, -0.5000000000000003],
+ [0.5412658773652739, -0.5000000000000003],
+ [0.811898816047911, -0.40625000000000044],
+ [0.7036456405748561, -0.4062500000000004],
+ [0.5953924651018013, -0.40625000000000033]])
+ test_points = np.asarray([
+ [0.58, -0.46],
+ [0.65, -0.46],
+ [0.65, -0.42],
+ [0.7, -0.48],
+ [0.7, -0.44],
+ [0.75, -0.44],
+ [0.8, -0.48]])
+
+ # Utility function that indicates if a triangle defined by 3 points
+ # (xtri, ytri) contains the test point xy. Avoid calling with a point that
+ # lies on or very near to an edge of the triangle.
+ def tri_contains_point(xtri, ytri, xy):
+ tri_points = np.vstack((xtri, ytri)).T
+ return Path(tri_points).contains_point(xy)
+
+ # Utility function that returns how many triangles of the specified
+ # triangulation contain the test point xy. Avoid calling with a point that
+ # lies on or very near to an edge of any triangle in the triangulation.
+ def tris_contain_point(triang, xy):
+ return sum(tri_contains_point(triang.x[tri], triang.y[tri], xy)
+ for tri in triang.triangles)
+
+ # Using matplotlib.delaunay, an invalid triangulation is created with
+ # overlapping triangles; qhull is OK.
+ triang = mtri.Triangulation(tri_points[:, 0], tri_points[:, 1])
+ for test_point in test_points:
+ assert tris_contain_point(triang, test_point) == 1
+
+ # If ignore the first point of tri_points, matplotlib.delaunay throws a
+ # KeyError when calculating the convex hull; qhull is OK.
+ triang = mtri.Triangulation(tri_points[1:, 0], tri_points[1:, 1])
+
+
+@image_comparison(['tripcolor1.png'])
+def test_tripcolor():
+ x = np.asarray([0, 0.5, 1, 0, 0.5, 1, 0, 0.5, 1, 0.75])
+ y = np.asarray([0, 0, 0, 0.5, 0.5, 0.5, 1, 1, 1, 0.75])
+ triangles = np.asarray([
+ [0, 1, 3], [1, 4, 3],
+ [1, 2, 4], [2, 5, 4],
+ [3, 4, 6], [4, 7, 6],
+ [4, 5, 9], [7, 4, 9], [8, 7, 9], [5, 8, 9]])
+
+ # Triangulation with same number of points and triangles.
+ triang = mtri.Triangulation(x, y, triangles)
+
+ Cpoints = x + 0.5*y
+
+ xmid = x[triang.triangles].mean(axis=1)
+ ymid = y[triang.triangles].mean(axis=1)
+ Cfaces = 0.5*xmid + ymid
+
+ plt.subplot(121)
+ plt.tripcolor(triang, Cpoints, edgecolors='k')
+ plt.title('point colors')
+
+ plt.subplot(122)
+ plt.tripcolor(triang, facecolors=Cfaces, edgecolors='k')
+ plt.title('facecolors')
+
+
+def test_no_modify():
+ # Test that Triangulation does not modify triangles array passed to it.
+ triangles = np.array([[3, 2, 0], [3, 1, 0]], dtype=np.int32)
+ points = np.array([(0, 0), (0, 1.1), (1, 0), (1, 1)])
+
+ old_triangles = triangles.copy()
+ mtri.Triangulation(points[:, 0], points[:, 1], triangles).edges
+ assert_array_equal(old_triangles, triangles)
+
+
+def test_trifinder():
+ # Test points within triangles of masked triangulation.
+ x, y = np.meshgrid(np.arange(4), np.arange(4))
+ x = x.ravel()
+ y = y.ravel()
+ triangles = [[0, 1, 4], [1, 5, 4], [1, 2, 5], [2, 6, 5], [2, 3, 6],
+ [3, 7, 6], [4, 5, 8], [5, 9, 8], [5, 6, 9], [6, 10, 9],
+ [6, 7, 10], [7, 11, 10], [8, 9, 12], [9, 13, 12], [9, 10, 13],
+ [10, 14, 13], [10, 11, 14], [11, 15, 14]]
+ mask = np.zeros(len(triangles))
+ mask[8:10] = 1
+ triang = mtri.Triangulation(x, y, triangles, mask)
+ trifinder = triang.get_trifinder()
+
+ xs = [0.25, 1.25, 2.25, 3.25]
+ ys = [0.25, 1.25, 2.25, 3.25]
+ xs, ys = np.meshgrid(xs, ys)
+ xs = xs.ravel()
+ ys = ys.ravel()
+ tris = trifinder(xs, ys)
+ assert_array_equal(tris, [0, 2, 4, -1, 6, -1, 10, -1,
+ 12, 14, 16, -1, -1, -1, -1, -1])
+ tris = trifinder(xs-0.5, ys-0.5)
+ assert_array_equal(tris, [-1, -1, -1, -1, -1, 1, 3, 5,
+ -1, 7, -1, 11, -1, 13, 15, 17])
+
+ # Test points exactly on boundary edges of masked triangulation.
+ xs = [0.5, 1.5, 2.5, 0.5, 1.5, 2.5, 1.5, 1.5, 0.0, 1.0, 2.0, 3.0]
+ ys = [0.0, 0.0, 0.0, 3.0, 3.0, 3.0, 1.0, 2.0, 1.5, 1.5, 1.5, 1.5]
+ tris = trifinder(xs, ys)
+ assert_array_equal(tris, [0, 2, 4, 13, 15, 17, 3, 14, 6, 7, 10, 11])
+
+ # Test points exactly on boundary corners of masked triangulation.
+ xs = [0.0, 3.0]
+ ys = [0.0, 3.0]
+ tris = trifinder(xs, ys)
+ assert_array_equal(tris, [0, 17])
+
+ #
+ # Test triangles with horizontal colinear points. These are not valid
+ # triangulations, but we try to deal with the simplest violations.
+ #
+
+ # If +ve, triangulation is OK, if -ve triangulation invalid,
+ # if zero have colinear points but should pass tests anyway.
+ delta = 0.0
+
+ x = [1.5, 0, 1, 2, 3, 1.5, 1.5]
+ y = [-1, 0, 0, 0, 0, delta, 1]
+ triangles = [[0, 2, 1], [0, 3, 2], [0, 4, 3], [1, 2, 5], [2, 3, 5],
+ [3, 4, 5], [1, 5, 6], [4, 6, 5]]
+ triang = mtri.Triangulation(x, y, triangles)
+ trifinder = triang.get_trifinder()
+
+ xs = [-0.1, 0.4, 0.9, 1.4, 1.9, 2.4, 2.9]
+ ys = [-0.1, 0.1]
+ xs, ys = np.meshgrid(xs, ys)
+ tris = trifinder(xs, ys)
+ assert_array_equal(tris, [[-1, 0, 0, 1, 1, 2, -1],
+ [-1, 6, 6, 6, 7, 7, -1]])
+
+ #
+ # Test triangles with vertical colinear points. These are not valid
+ # triangulations, but we try to deal with the simplest violations.
+ #
+
+ # If +ve, triangulation is OK, if -ve triangulation invalid,
+ # if zero have colinear points but should pass tests anyway.
+ delta = 0.0
+
+ x = [-1, -delta, 0, 0, 0, 0, 1]
+ y = [1.5, 1.5, 0, 1, 2, 3, 1.5]
+ triangles = [[0, 1, 2], [0, 1, 5], [1, 2, 3], [1, 3, 4], [1, 4, 5],
+ [2, 6, 3], [3, 6, 4], [4, 6, 5]]
+ triang = mtri.Triangulation(x, y, triangles)
+ trifinder = triang.get_trifinder()
+
+ xs = [-0.1, 0.1]
+ ys = [-0.1, 0.4, 0.9, 1.4, 1.9, 2.4, 2.9]
+ xs, ys = np.meshgrid(xs, ys)
+ tris = trifinder(xs, ys)
+ assert_array_equal(tris, [[-1, -1], [0, 5], [0, 5], [0, 6], [1, 6], [1, 7],
+ [-1, -1]])
+
+ # Test that changing triangulation by setting a mask causes the trifinder
+ # to be reinitialised.
+ x = [0, 1, 0, 1]
+ y = [0, 0, 1, 1]
+ triangles = [[0, 1, 2], [1, 3, 2]]
+ triang = mtri.Triangulation(x, y, triangles)
+ trifinder = triang.get_trifinder()
+
+ xs = [-0.2, 0.2, 0.8, 1.2]
+ ys = [0.5, 0.5, 0.5, 0.5]
+ tris = trifinder(xs, ys)
+ assert_array_equal(tris, [-1, 0, 1, -1])
+
+ triang.set_mask([1, 0])
+ assert trifinder == triang.get_trifinder()
+ tris = trifinder(xs, ys)
+ assert_array_equal(tris, [-1, -1, 1, -1])
+
+
+def test_triinterp():
+ # Test points within triangles of masked triangulation.
+ x, y = np.meshgrid(np.arange(4), np.arange(4))
+ x = x.ravel()
+ y = y.ravel()
+ z = 1.23*x - 4.79*y
+ triangles = [[0, 1, 4], [1, 5, 4], [1, 2, 5], [2, 6, 5], [2, 3, 6],
+ [3, 7, 6], [4, 5, 8], [5, 9, 8], [5, 6, 9], [6, 10, 9],
+ [6, 7, 10], [7, 11, 10], [8, 9, 12], [9, 13, 12], [9, 10, 13],
+ [10, 14, 13], [10, 11, 14], [11, 15, 14]]
+ mask = np.zeros(len(triangles))
+ mask[8:10] = 1
+ triang = mtri.Triangulation(x, y, triangles, mask)
+ linear_interp = mtri.LinearTriInterpolator(triang, z)
+ cubic_min_E = mtri.CubicTriInterpolator(triang, z)
+ cubic_geom = mtri.CubicTriInterpolator(triang, z, kind='geom')
+
+ xs = np.linspace(0.25, 2.75, 6)
+ ys = [0.25, 0.75, 2.25, 2.75]
+ xs, ys = np.meshgrid(xs, ys) # Testing arrays with array.ndim = 2
+ for interp in (linear_interp, cubic_min_E, cubic_geom):
+ zs = interp(xs, ys)
+ assert_array_almost_equal(zs, (1.23*xs - 4.79*ys))
+
+ # Test points outside triangulation.
+ xs = [-0.25, 1.25, 1.75, 3.25]
+ ys = xs
+ xs, ys = np.meshgrid(xs, ys)
+ for interp in (linear_interp, cubic_min_E, cubic_geom):
+ zs = linear_interp(xs, ys)
+ assert_array_equal(zs.mask, [[True]*4]*4)
+
+ # Test mixed configuration (outside / inside).
+ xs = np.linspace(0.25, 1.75, 6)
+ ys = [0.25, 0.75, 1.25, 1.75]
+ xs, ys = np.meshgrid(xs, ys)
+ for interp in (linear_interp, cubic_min_E, cubic_geom):
+ zs = interp(xs, ys)
+ matest.assert_array_almost_equal(zs, (1.23*xs - 4.79*ys))
+ mask = (xs >= 1) * (xs <= 2) * (ys >= 1) * (ys <= 2)
+ assert_array_equal(zs.mask, mask)
+
+ # 2nd order patch test: on a grid with an 'arbitrary shaped' triangle,
+ # patch test shall be exact for quadratic functions and cubic
+ # interpolator if *kind* = user
+ (a, b, c) = (1.23, -4.79, 0.6)
+
+ def quad(x, y):
+ return a*(x-0.5)**2 + b*(y-0.5)**2 + c*x*y
+
+ def gradient_quad(x, y):
+ return (2*a*(x-0.5) + c*y, 2*b*(y-0.5) + c*x)
+
+ x = np.array([0.2, 0.33367, 0.669, 0., 1., 1., 0.])
+ y = np.array([0.3, 0.80755, 0.4335, 0., 0., 1., 1.])
+ triangles = np.array([[0, 1, 2], [3, 0, 4], [4, 0, 2], [4, 2, 5],
+ [1, 5, 2], [6, 5, 1], [6, 1, 0], [6, 0, 3]])
+ triang = mtri.Triangulation(x, y, triangles)
+ z = quad(x, y)
+ dz = gradient_quad(x, y)
+ # test points for 2nd order patch test
+ xs = np.linspace(0., 1., 5)
+ ys = np.linspace(0., 1., 5)
+ xs, ys = np.meshgrid(xs, ys)
+ cubic_user = mtri.CubicTriInterpolator(triang, z, kind='user', dz=dz)
+ interp_zs = cubic_user(xs, ys)
+ assert_array_almost_equal(interp_zs, quad(xs, ys))
+ (interp_dzsdx, interp_dzsdy) = cubic_user.gradient(x, y)
+ (dzsdx, dzsdy) = gradient_quad(x, y)
+ assert_array_almost_equal(interp_dzsdx, dzsdx)
+ assert_array_almost_equal(interp_dzsdy, dzsdy)
+
+ # Cubic improvement: cubic interpolation shall perform better than linear
+ # on a sufficiently dense mesh for a quadratic function.
+ n = 11
+ x, y = np.meshgrid(np.linspace(0., 1., n+1), np.linspace(0., 1., n+1))
+ x = x.ravel()
+ y = y.ravel()
+ z = quad(x, y)
+ triang = mtri.Triangulation(x, y, triangles=meshgrid_triangles(n+1))
+ xs, ys = np.meshgrid(np.linspace(0.1, 0.9, 5), np.linspace(0.1, 0.9, 5))
+ xs = xs.ravel()
+ ys = ys.ravel()
+ linear_interp = mtri.LinearTriInterpolator(triang, z)
+ cubic_min_E = mtri.CubicTriInterpolator(triang, z)
+ cubic_geom = mtri.CubicTriInterpolator(triang, z, kind='geom')
+ zs = quad(xs, ys)
+ diff_lin = np.abs(linear_interp(xs, ys) - zs)
+ for interp in (cubic_min_E, cubic_geom):
+ diff_cubic = np.abs(interp(xs, ys) - zs)
+ assert np.max(diff_lin) >= 10 * np.max(diff_cubic)
+ assert (np.dot(diff_lin, diff_lin) >=
+ 100 * np.dot(diff_cubic, diff_cubic))
+
+
+def test_triinterpcubic_C1_continuity():
+ # Below the 4 tests which demonstrate C1 continuity of the
+ # TriCubicInterpolator (testing the cubic shape functions on arbitrary
+ # triangle):
+ #
+ # 1) Testing continuity of function & derivatives at corner for all 9
+ # shape functions. Testing also function values at same location.
+ # 2) Testing C1 continuity along each edge (as gradient is polynomial of
+ # 2nd order, it is sufficient to test at the middle).
+ # 3) Testing C1 continuity at triangle barycenter (where the 3 subtriangles
+ # meet)
+ # 4) Testing C1 continuity at median 1/3 points (midside between 2
+ # subtriangles)
+
+ # Utility test function check_continuity
+ def check_continuity(interpolator, loc, values=None):
+ """
+ Checks the continuity of interpolator (and its derivatives) near
+ location loc. Can check the value at loc itself if *values* is
+ provided.
+
+ *interpolator* TriInterpolator
+ *loc* location to test (x0, y0)
+ *values* (optional) array [z0, dzx0, dzy0] to check the value at *loc*
+ """
+ n_star = 24 # Number of continuity points in a boundary of loc
+ epsilon = 1.e-10 # Distance for loc boundary
+ k = 100. # Continuity coefficient
+ (loc_x, loc_y) = loc
+ star_x = loc_x + epsilon*np.cos(np.linspace(0., 2*np.pi, n_star))
+ star_y = loc_y + epsilon*np.sin(np.linspace(0., 2*np.pi, n_star))
+ z = interpolator([loc_x], [loc_y])[0]
+ (dzx, dzy) = interpolator.gradient([loc_x], [loc_y])
+ if values is not None:
+ assert_array_almost_equal(z, values[0])
+ assert_array_almost_equal(dzx[0], values[1])
+ assert_array_almost_equal(dzy[0], values[2])
+ diff_z = interpolator(star_x, star_y) - z
+ (tab_dzx, tab_dzy) = interpolator.gradient(star_x, star_y)
+ diff_dzx = tab_dzx - dzx
+ diff_dzy = tab_dzy - dzy
+ assert_array_less(diff_z, epsilon*k)
+ assert_array_less(diff_dzx, epsilon*k)
+ assert_array_less(diff_dzy, epsilon*k)
+
+ # Drawing arbitrary triangle (a, b, c) inside a unit square.
+ (ax, ay) = (0.2, 0.3)
+ (bx, by) = (0.33367, 0.80755)
+ (cx, cy) = (0.669, 0.4335)
+ x = np.array([ax, bx, cx, 0., 1., 1., 0.])
+ y = np.array([ay, by, cy, 0., 0., 1., 1.])
+ triangles = np.array([[0, 1, 2], [3, 0, 4], [4, 0, 2], [4, 2, 5],
+ [1, 5, 2], [6, 5, 1], [6, 1, 0], [6, 0, 3]])
+ triang = mtri.Triangulation(x, y, triangles)
+
+ for idof in range(9):
+ z = np.zeros(7, dtype=np.float64)
+ dzx = np.zeros(7, dtype=np.float64)
+ dzy = np.zeros(7, dtype=np.float64)
+ values = np.zeros([3, 3], dtype=np.float64)
+ case = idof//3
+ values[case, idof % 3] = 1.0
+ if case == 0:
+ z[idof] = 1.0
+ elif case == 1:
+ dzx[idof % 3] = 1.0
+ elif case == 2:
+ dzy[idof % 3] = 1.0
+ interp = mtri.CubicTriInterpolator(triang, z, kind='user',
+ dz=(dzx, dzy))
+ # Test 1) Checking values and continuity at nodes
+ check_continuity(interp, (ax, ay), values[:, 0])
+ check_continuity(interp, (bx, by), values[:, 1])
+ check_continuity(interp, (cx, cy), values[:, 2])
+ # Test 2) Checking continuity at midside nodes
+ check_continuity(interp, ((ax+bx)*0.5, (ay+by)*0.5))
+ check_continuity(interp, ((ax+cx)*0.5, (ay+cy)*0.5))
+ check_continuity(interp, ((cx+bx)*0.5, (cy+by)*0.5))
+ # Test 3) Checking continuity at barycenter
+ check_continuity(interp, ((ax+bx+cx)/3., (ay+by+cy)/3.))
+ # Test 4) Checking continuity at median 1/3-point
+ check_continuity(interp, ((4.*ax+bx+cx)/6., (4.*ay+by+cy)/6.))
+ check_continuity(interp, ((ax+4.*bx+cx)/6., (ay+4.*by+cy)/6.))
+ check_continuity(interp, ((ax+bx+4.*cx)/6., (ay+by+4.*cy)/6.))
+
+
+def test_triinterpcubic_cg_solver():
+ # Now 3 basic tests of the Sparse CG solver, used for
+ # TriCubicInterpolator with *kind* = 'min_E'
+ # 1) A commonly used test involves a 2d Poisson matrix.
+ def poisson_sparse_matrix(n, m):
+ """
+ Return the sparse, (n*m, n*m) matrix in coo format resulting from the
+ discretisation of the 2-dimensional Poisson equation according to a
+ finite difference numerical scheme on a uniform (n, m) grid.
+ """
+ l = m*n
+ rows = np.concatenate([
+ np.arange(l, dtype=np.int32),
+ np.arange(l-1, dtype=np.int32), np.arange(1, l, dtype=np.int32),
+ np.arange(l-n, dtype=np.int32), np.arange(n, l, dtype=np.int32)])
+ cols = np.concatenate([
+ np.arange(l, dtype=np.int32),
+ np.arange(1, l, dtype=np.int32), np.arange(l-1, dtype=np.int32),
+ np.arange(n, l, dtype=np.int32), np.arange(l-n, dtype=np.int32)])
+ vals = np.concatenate([
+ 4*np.ones(l, dtype=np.float64),
+ -np.ones(l-1, dtype=np.float64), -np.ones(l-1, dtype=np.float64),
+ -np.ones(l-n, dtype=np.float64), -np.ones(l-n, dtype=np.float64)])
+ # In fact +1 and -1 diags have some zeros
+ vals[l:2*l-1][m-1::m] = 0.
+ vals[2*l-1:3*l-2][m-1::m] = 0.
+ return vals, rows, cols, (n*m, n*m)
+
+ # Instantiating a sparse Poisson matrix of size 48 x 48:
+ (n, m) = (12, 4)
+ mat = mtri.triinterpolate._Sparse_Matrix_coo(*poisson_sparse_matrix(n, m))
+ mat.compress_csc()
+ mat_dense = mat.to_dense()
+ # Testing a sparse solve for all 48 basis vector
+ for itest in range(n*m):
+ b = np.zeros(n*m, dtype=np.float64)
+ b[itest] = 1.
+ x, _ = mtri.triinterpolate._cg(A=mat, b=b, x0=np.zeros(n*m),
+ tol=1.e-10)
+ assert_array_almost_equal(np.dot(mat_dense, x), b)
+
+ # 2) Same matrix with inserting 2 rows - cols with null diag terms
+ # (but still linked with the rest of the matrix by extra-diag terms)
+ (i_zero, j_zero) = (12, 49)
+ vals, rows, cols, _ = poisson_sparse_matrix(n, m)
+ rows = rows + 1*(rows >= i_zero) + 1*(rows >= j_zero)
+ cols = cols + 1*(cols >= i_zero) + 1*(cols >= j_zero)
+ # adding extra-diag terms
+ rows = np.concatenate([rows, [i_zero, i_zero-1, j_zero, j_zero-1]])
+ cols = np.concatenate([cols, [i_zero-1, i_zero, j_zero-1, j_zero]])
+ vals = np.concatenate([vals, [1., 1., 1., 1.]])
+ mat = mtri.triinterpolate._Sparse_Matrix_coo(vals, rows, cols,
+ (n*m + 2, n*m + 2))
+ mat.compress_csc()
+ mat_dense = mat.to_dense()
+ # Testing a sparse solve for all 50 basis vec
+ for itest in range(n*m + 2):
+ b = np.zeros(n*m + 2, dtype=np.float64)
+ b[itest] = 1.
+ x, _ = mtri.triinterpolate._cg(A=mat, b=b, x0=np.ones(n*m + 2),
+ tol=1.e-10)
+ assert_array_almost_equal(np.dot(mat_dense, x), b)
+
+ # 3) Now a simple test that summation of duplicate (i.e. with same rows,
+ # same cols) entries occurs when compressed.
+ vals = np.ones(17, dtype=np.float64)
+ rows = np.array([0, 1, 2, 0, 0, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1],
+ dtype=np.int32)
+ cols = np.array([0, 1, 2, 1, 1, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2],
+ dtype=np.int32)
+ dim = (3, 3)
+ mat = mtri.triinterpolate._Sparse_Matrix_coo(vals, rows, cols, dim)
+ mat.compress_csc()
+ mat_dense = mat.to_dense()
+ assert_array_almost_equal(mat_dense, np.array([
+ [1., 2., 0.], [2., 1., 5.], [0., 5., 1.]], dtype=np.float64))
+
+
+def test_triinterpcubic_geom_weights():
+ # Tests to check computation of weights for _DOF_estimator_geom:
+ # The weight sum per triangle can be 1. (in case all angles < 90 degrees)
+ # or (2*w_i) where w_i = 1-alpha_i/np.pi is the weight of apex i; alpha_i
+ # is the apex angle > 90 degrees.
+ (ax, ay) = (0., 1.687)
+ x = np.array([ax, 0.5*ax, 0., 1.])
+ y = np.array([ay, -ay, 0., 0.])
+ z = np.zeros(4, dtype=np.float64)
+ triangles = [[0, 2, 3], [1, 3, 2]]
+ sum_w = np.zeros([4, 2]) # 4 possibilities; 2 triangles
+ for theta in np.linspace(0., 2*np.pi, 14): # rotating the figure...
+ x_rot = np.cos(theta)*x + np.sin(theta)*y
+ y_rot = -np.sin(theta)*x + np.cos(theta)*y
+ triang = mtri.Triangulation(x_rot, y_rot, triangles)
+ cubic_geom = mtri.CubicTriInterpolator(triang, z, kind='geom')
+ dof_estimator = mtri.triinterpolate._DOF_estimator_geom(cubic_geom)
+ weights = dof_estimator.compute_geom_weights()
+ # Testing for the 4 possibilities...
+ sum_w[0, :] = np.sum(weights, 1) - 1
+ for itri in range(3):
+ sum_w[itri+1, :] = np.sum(weights, 1) - 2*weights[:, itri]
+ assert_array_almost_equal(np.min(np.abs(sum_w), axis=0),
+ np.array([0., 0.], dtype=np.float64))
+
+
+def test_triinterp_colinear():
+ # Tests interpolating inside a triangulation with horizontal colinear
+ # points (refer also to the tests :func:`test_trifinder` ).
+ #
+ # These are not valid triangulations, but we try to deal with the
+ # simplest violations (i. e. those handled by default TriFinder).
+ #
+ # Note that the LinearTriInterpolator and the CubicTriInterpolator with
+ # kind='min_E' or 'geom' still pass a linear patch test.
+ # We also test interpolation inside a flat triangle, by forcing
+ # *tri_index* in a call to :meth:`_interpolate_multikeys`.
+
+ # If +ve, triangulation is OK, if -ve triangulation invalid,
+ # if zero have colinear points but should pass tests anyway.
+ delta = 0.
+
+ x0 = np.array([1.5, 0, 1, 2, 3, 1.5, 1.5])
+ y0 = np.array([-1, 0, 0, 0, 0, delta, 1])
+
+ # We test different affine transformations of the initial figure; to
+ # avoid issues related to round-off errors we only use integer
+ # coefficients (otherwise the Triangulation might become invalid even with
+ # delta == 0).
+ transformations = [[1, 0], [0, 1], [1, 1], [1, 2], [-2, -1], [-2, 1]]
+ for transformation in transformations:
+ x_rot = transformation[0]*x0 + transformation[1]*y0
+ y_rot = -transformation[1]*x0 + transformation[0]*y0
+ (x, y) = (x_rot, y_rot)
+ z = 1.23*x - 4.79*y
+ triangles = [[0, 2, 1], [0, 3, 2], [0, 4, 3], [1, 2, 5], [2, 3, 5],
+ [3, 4, 5], [1, 5, 6], [4, 6, 5]]
+ triang = mtri.Triangulation(x, y, triangles)
+ xs = np.linspace(np.min(triang.x), np.max(triang.x), 20)
+ ys = np.linspace(np.min(triang.y), np.max(triang.y), 20)
+ xs, ys = np.meshgrid(xs, ys)
+ xs = xs.ravel()
+ ys = ys.ravel()
+ mask_out = (triang.get_trifinder()(xs, ys) == -1)
+ zs_target = np.ma.array(1.23*xs - 4.79*ys, mask=mask_out)
+
+ linear_interp = mtri.LinearTriInterpolator(triang, z)
+ cubic_min_E = mtri.CubicTriInterpolator(triang, z)
+ cubic_geom = mtri.CubicTriInterpolator(triang, z, kind='geom')
+
+ for interp in (linear_interp, cubic_min_E, cubic_geom):
+ zs = interp(xs, ys)
+ assert_array_almost_equal(zs_target, zs)
+
+ # Testing interpolation inside the flat triangle number 4: [2, 3, 5]
+ # by imposing *tri_index* in a call to :meth:`_interpolate_multikeys`
+ itri = 4
+ pt1 = triang.triangles[itri, 0]
+ pt2 = triang.triangles[itri, 1]
+ xs = np.linspace(triang.x[pt1], triang.x[pt2], 10)
+ ys = np.linspace(triang.y[pt1], triang.y[pt2], 10)
+ zs_target = 1.23*xs - 4.79*ys
+ for interp in (linear_interp, cubic_min_E, cubic_geom):
+ zs, = interp._interpolate_multikeys(
+ xs, ys, tri_index=itri*np.ones(10, dtype=np.int32))
+ assert_array_almost_equal(zs_target, zs)
+
+
+def test_triinterp_transformations():
+ # 1) Testing that the interpolation scheme is invariant by rotation of the
+ # whole figure.
+ # Note: This test is non-trivial for a CubicTriInterpolator with
+ # kind='min_E'. It does fail for a non-isotropic stiffness matrix E of
+ # :class:`_ReducedHCT_Element` (tested with E=np.diag([1., 1., 1.])), and
+ # provides a good test for :meth:`get_Kff_and_Ff`of the same class.
+ #
+ # 2) Also testing that the interpolation scheme is invariant by expansion
+ # of the whole figure along one axis.
+ n_angles = 20
+ n_radii = 10
+ min_radius = 0.15
+
+ def z(x, y):
+ r1 = np.hypot(0.5 - x, 0.5 - y)
+ theta1 = np.arctan2(0.5 - x, 0.5 - y)
+ r2 = np.hypot(-x - 0.2, -y - 0.2)
+ theta2 = np.arctan2(-x - 0.2, -y - 0.2)
+ z = -(2*(np.exp((r1/10)**2)-1)*30. * np.cos(7.*theta1) +
+ (np.exp((r2/10)**2)-1)*30. * np.cos(11.*theta2) +
+ 0.7*(x**2 + y**2))
+ return (np.max(z)-z)/(np.max(z)-np.min(z))
+
+ # First create the x and y coordinates of the points.
+ radii = np.linspace(min_radius, 0.95, n_radii)
+ angles = np.linspace(0 + n_angles, 2*np.pi + n_angles,
+ n_angles, endpoint=False)
+ angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
+ angles[:, 1::2] += np.pi/n_angles
+ x0 = (radii*np.cos(angles)).flatten()
+ y0 = (radii*np.sin(angles)).flatten()
+ triang0 = mtri.Triangulation(x0, y0) # Delaunay triangulation
+ z0 = z(x0, y0)
+
+ # Then create the test points
+ xs0 = np.linspace(-1., 1., 23)
+ ys0 = np.linspace(-1., 1., 23)
+ xs0, ys0 = np.meshgrid(xs0, ys0)
+ xs0 = xs0.ravel()
+ ys0 = ys0.ravel()
+
+ interp_z0 = {}
+ for i_angle in range(2):
+ # Rotating everything
+ theta = 2*np.pi / n_angles * i_angle
+ x = np.cos(theta)*x0 + np.sin(theta)*y0
+ y = -np.sin(theta)*x0 + np.cos(theta)*y0
+ xs = np.cos(theta)*xs0 + np.sin(theta)*ys0
+ ys = -np.sin(theta)*xs0 + np.cos(theta)*ys0
+ triang = mtri.Triangulation(x, y, triang0.triangles)
+ linear_interp = mtri.LinearTriInterpolator(triang, z0)
+ cubic_min_E = mtri.CubicTriInterpolator(triang, z0)
+ cubic_geom = mtri.CubicTriInterpolator(triang, z0, kind='geom')
+ dic_interp = {'lin': linear_interp,
+ 'min_E': cubic_min_E,
+ 'geom': cubic_geom}
+ # Testing that the interpolation is invariant by rotation...
+ for interp_key in ['lin', 'min_E', 'geom']:
+ interp = dic_interp[interp_key]
+ if i_angle == 0:
+ interp_z0[interp_key] = interp(xs0, ys0) # storage
+ else:
+ interpz = interp(xs, ys)
+ matest.assert_array_almost_equal(interpz,
+ interp_z0[interp_key])
+
+ scale_factor = 987654.3210
+ for scaled_axis in ('x', 'y'):
+ # Scaling everything (expansion along scaled_axis)
+ if scaled_axis == 'x':
+ x = scale_factor * x0
+ y = y0
+ xs = scale_factor * xs0
+ ys = ys0
+ else:
+ x = x0
+ y = scale_factor * y0
+ xs = xs0
+ ys = scale_factor * ys0
+ triang = mtri.Triangulation(x, y, triang0.triangles)
+ linear_interp = mtri.LinearTriInterpolator(triang, z0)
+ cubic_min_E = mtri.CubicTriInterpolator(triang, z0)
+ cubic_geom = mtri.CubicTriInterpolator(triang, z0, kind='geom')
+ dic_interp = {'lin': linear_interp,
+ 'min_E': cubic_min_E,
+ 'geom': cubic_geom}
+ # Test that the interpolation is invariant by expansion along 1 axis...
+ for interp_key in ['lin', 'min_E', 'geom']:
+ interpz = dic_interp[interp_key](xs, ys)
+ matest.assert_array_almost_equal(interpz, interp_z0[interp_key])
+
+
+@image_comparison(['tri_smooth_contouring.png'], remove_text=True, tol=0.072)
+def test_tri_smooth_contouring():
+ # Image comparison based on example tricontour_smooth_user.
+ n_angles = 20
+ n_radii = 10
+ min_radius = 0.15
+
+ def z(x, y):
+ r1 = np.hypot(0.5 - x, 0.5 - y)
+ theta1 = np.arctan2(0.5 - x, 0.5 - y)
+ r2 = np.hypot(-x - 0.2, -y - 0.2)
+ theta2 = np.arctan2(-x - 0.2, -y - 0.2)
+ z = -(2*(np.exp((r1/10)**2)-1)*30. * np.cos(7.*theta1) +
+ (np.exp((r2/10)**2)-1)*30. * np.cos(11.*theta2) +
+ 0.7*(x**2 + y**2))
+ return (np.max(z)-z)/(np.max(z)-np.min(z))
+
+ # First create the x and y coordinates of the points.
+ radii = np.linspace(min_radius, 0.95, n_radii)
+ angles = np.linspace(0 + n_angles, 2*np.pi + n_angles,
+ n_angles, endpoint=False)
+ angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
+ angles[:, 1::2] += np.pi/n_angles
+ x0 = (radii*np.cos(angles)).flatten()
+ y0 = (radii*np.sin(angles)).flatten()
+ triang0 = mtri.Triangulation(x0, y0) # Delaunay triangulation
+ z0 = z(x0, y0)
+ triang0.set_mask(np.hypot(x0[triang0.triangles].mean(axis=1),
+ y0[triang0.triangles].mean(axis=1))
+ < min_radius)
+
+ # Then the plot
+ refiner = mtri.UniformTriRefiner(triang0)
+ tri_refi, z_test_refi = refiner.refine_field(z0, subdiv=4)
+ levels = np.arange(0., 1., 0.025)
+ plt.triplot(triang0, lw=0.5, color='0.5')
+ plt.tricontour(tri_refi, z_test_refi, levels=levels, colors="black")
+
+
+@image_comparison(['tri_smooth_gradient.png'], remove_text=True, tol=0.092)
+def test_tri_smooth_gradient():
+ # Image comparison based on example trigradient_demo.
+
+ def dipole_potential(x, y):
+ """An electric dipole potential V."""
+ r_sq = x**2 + y**2
+ theta = np.arctan2(y, x)
+ z = np.cos(theta)/r_sq
+ return (np.max(z)-z) / (np.max(z)-np.min(z))
+
+ # Creating a Triangulation
+ n_angles = 30
+ n_radii = 10
+ min_radius = 0.2
+ radii = np.linspace(min_radius, 0.95, n_radii)
+ angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)
+ angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
+ angles[:, 1::2] += np.pi/n_angles
+ x = (radii*np.cos(angles)).flatten()
+ y = (radii*np.sin(angles)).flatten()
+ V = dipole_potential(x, y)
+ triang = mtri.Triangulation(x, y)
+ triang.set_mask(np.hypot(x[triang.triangles].mean(axis=1),
+ y[triang.triangles].mean(axis=1))
+ < min_radius)
+
+ # Refine data - interpolates the electrical potential V
+ refiner = mtri.UniformTriRefiner(triang)
+ tri_refi, z_test_refi = refiner.refine_field(V, subdiv=3)
+
+ # Computes the electrical field (Ex, Ey) as gradient of -V
+ tci = mtri.CubicTriInterpolator(triang, -V)
+ Ex, Ey = tci.gradient(triang.x, triang.y)
+ E_norm = np.hypot(Ex, Ey)
+
+ # Plot the triangulation, the potential iso-contours and the vector field
+ plt.figure()
+ plt.gca().set_aspect('equal')
+ plt.triplot(triang, color='0.8')
+
+ levels = np.arange(0., 1., 0.01)
+ cmap = cm.get_cmap(name='hot', lut=None)
+ plt.tricontour(tri_refi, z_test_refi, levels=levels, cmap=cmap,
+ linewidths=[2.0, 1.0, 1.0, 1.0])
+ # Plots direction of the electrical vector field
+ plt.quiver(triang.x, triang.y, Ex/E_norm, Ey/E_norm,
+ units='xy', scale=10., zorder=3, color='blue',
+ width=0.007, headwidth=3., headlength=4.)
+ # We are leaving ax.use_sticky_margins as True, so the
+ # view limits are the contour data limits.
+
+
+def test_tritools():
+ # Tests TriAnalyzer.scale_factors on masked triangulation
+ # Tests circle_ratios on equilateral and right-angled triangle.
+ x = np.array([0., 1., 0.5, 0., 2.])
+ y = np.array([0., 0., 0.5*np.sqrt(3.), -1., 1.])
+ triangles = np.array([[0, 1, 2], [0, 1, 3], [1, 2, 4]], dtype=np.int32)
+ mask = np.array([False, False, True], dtype=bool)
+ triang = mtri.Triangulation(x, y, triangles, mask=mask)
+ analyser = mtri.TriAnalyzer(triang)
+ assert_array_almost_equal(analyser.scale_factors,
+ np.array([1., 1./(1.+0.5*np.sqrt(3.))]))
+ assert_array_almost_equal(
+ analyser.circle_ratios(rescale=False),
+ np.ma.masked_array([0.5, 1./(1.+np.sqrt(2.)), np.nan], mask))
+
+ # Tests circle ratio of a flat triangle
+ x = np.array([0., 1., 2.])
+ y = np.array([1., 1.+3., 1.+6.])
+ triangles = np.array([[0, 1, 2]], dtype=np.int32)
+ triang = mtri.Triangulation(x, y, triangles)
+ analyser = mtri.TriAnalyzer(triang)
+ assert_array_almost_equal(analyser.circle_ratios(), np.array([0.]))
+
+ # Tests TriAnalyzer.get_flat_tri_mask
+ # Creates a triangulation of [-1, 1] x [-1, 1] with contiguous groups of
+ # 'flat' triangles at the 4 corners and at the center. Checks that only
+ # those at the borders are eliminated by TriAnalyzer.get_flat_tri_mask
+ n = 9
+
+ def power(x, a):
+ return np.abs(x)**a*np.sign(x)
+
+ x = np.linspace(-1., 1., n+1)
+ x, y = np.meshgrid(power(x, 2.), power(x, 0.25))
+ x = x.ravel()
+ y = y.ravel()
+
+ triang = mtri.Triangulation(x, y, triangles=meshgrid_triangles(n+1))
+ analyser = mtri.TriAnalyzer(triang)
+ mask_flat = analyser.get_flat_tri_mask(0.2)
+ verif_mask = np.zeros(162, dtype=bool)
+ corners_index = [0, 1, 2, 3, 14, 15, 16, 17, 18, 19, 34, 35, 126, 127,
+ 142, 143, 144, 145, 146, 147, 158, 159, 160, 161]
+ verif_mask[corners_index] = True
+ assert_array_equal(mask_flat, verif_mask)
+
+ # Now including a hole (masked triangle) at the center. The center also
+ # shall be eliminated by get_flat_tri_mask.
+ mask = np.zeros(162, dtype=bool)
+ mask[80] = True
+ triang.set_mask(mask)
+ mask_flat = analyser.get_flat_tri_mask(0.2)
+ center_index = [44, 45, 62, 63, 78, 79, 80, 81, 82, 83, 98, 99, 116, 117]
+ verif_mask[center_index] = True
+ assert_array_equal(mask_flat, verif_mask)
+
+
+def test_trirefine():
+ # Testing subdiv=2 refinement
+ n = 3
+ subdiv = 2
+ x = np.linspace(-1., 1., n+1)
+ x, y = np.meshgrid(x, x)
+ x = x.ravel()
+ y = y.ravel()
+ mask = np.zeros(2*n**2, dtype=bool)
+ mask[n**2:] = True
+ triang = mtri.Triangulation(x, y, triangles=meshgrid_triangles(n+1),
+ mask=mask)
+ refiner = mtri.UniformTriRefiner(triang)
+ refi_triang = refiner.refine_triangulation(subdiv=subdiv)
+ x_refi = refi_triang.x
+ y_refi = refi_triang.y
+
+ n_refi = n * subdiv**2
+ x_verif = np.linspace(-1., 1., n_refi+1)
+ x_verif, y_verif = np.meshgrid(x_verif, x_verif)
+ x_verif = x_verif.ravel()
+ y_verif = y_verif.ravel()
+ ind1d = np.in1d(np.around(x_verif*(2.5+y_verif), 8),
+ np.around(x_refi*(2.5+y_refi), 8))
+ assert_array_equal(ind1d, True)
+
+ # Testing the mask of the refined triangulation
+ refi_mask = refi_triang.mask
+ refi_tri_barycenter_x = np.sum(refi_triang.x[refi_triang.triangles],
+ axis=1) / 3.
+ refi_tri_barycenter_y = np.sum(refi_triang.y[refi_triang.triangles],
+ axis=1) / 3.
+ tri_finder = triang.get_trifinder()
+ refi_tri_indices = tri_finder(refi_tri_barycenter_x,
+ refi_tri_barycenter_y)
+ refi_tri_mask = triang.mask[refi_tri_indices]
+ assert_array_equal(refi_mask, refi_tri_mask)
+
+ # Testing that the numbering of triangles does not change the
+ # interpolation result.
+ x = np.asarray([0.0, 1.0, 0.0, 1.0])
+ y = np.asarray([0.0, 0.0, 1.0, 1.0])
+ triang = [mtri.Triangulation(x, y, [[0, 1, 3], [3, 2, 0]]),
+ mtri.Triangulation(x, y, [[0, 1, 3], [2, 0, 3]])]
+ z = np.hypot(x - 0.3, y - 0.4)
+ # Refining the 2 triangulations and reordering the points
+ xyz_data = []
+ for i in range(2):
+ refiner = mtri.UniformTriRefiner(triang[i])
+ refined_triang, refined_z = refiner.refine_field(z, subdiv=1)
+ xyz = np.dstack((refined_triang.x, refined_triang.y, refined_z))[0]
+ xyz = xyz[np.lexsort((xyz[:, 1], xyz[:, 0]))]
+ xyz_data += [xyz]
+ assert_array_almost_equal(xyz_data[0], xyz_data[1])
+
+
+@pytest.mark.parametrize('interpolator',
+ [mtri.LinearTriInterpolator,
+ mtri.CubicTriInterpolator],
+ ids=['linear', 'cubic'])
+def test_trirefine_masked(interpolator):
+ # Repeated points means we will have fewer triangles than points, and thus
+ # get masking.
+ x, y = np.mgrid[:2, :2]
+ x = np.repeat(x.flatten(), 2)
+ y = np.repeat(y.flatten(), 2)
+
+ z = np.zeros_like(x)
+ tri = mtri.Triangulation(x, y)
+ refiner = mtri.UniformTriRefiner(tri)
+ interp = interpolator(tri, z)
+ refiner.refine_field(z, triinterpolator=interp, subdiv=2)
+
+
+def meshgrid_triangles(n):
+ """
+ Return (2*(N-1)**2, 3) array of triangles to mesh (N, N)-point np.meshgrid.
+ """
+ tri = []
+ for i in range(n-1):
+ for j in range(n-1):
+ a = i + j*n
+ b = (i+1) + j*n
+ c = i + (j+1)*n
+ d = (i+1) + (j+1)*n
+ tri += [[a, b, d], [a, d, c]]
+ return np.array(tri, dtype=np.int32)
+
+
+def test_triplot_return():
+ # Check that triplot returns the artists it adds
+ ax = plt.figure().add_subplot()
+ triang = mtri.Triangulation(
+ [0.0, 1.0, 0.0, 1.0], [0.0, 0.0, 1.0, 1.0],
+ triangles=[[0, 1, 3], [3, 2, 0]])
+ assert ax.triplot(triang, "b-") is not None, \
+ 'triplot should return the artist it adds'
+
+
+def test_trirefiner_fortran_contiguous_triangles():
+ # github issue 4180. Test requires two arrays of triangles that are
+ # identical except that one is C-contiguous and one is fortran-contiguous.
+ triangles1 = np.array([[2, 0, 3], [2, 1, 0]])
+ assert not np.isfortran(triangles1)
+
+ triangles2 = np.array(triangles1, copy=True, order='F')
+ assert np.isfortran(triangles2)
+
+ x = np.array([0.39, 0.59, 0.43, 0.32])
+ y = np.array([33.99, 34.01, 34.19, 34.18])
+ triang1 = mtri.Triangulation(x, y, triangles1)
+ triang2 = mtri.Triangulation(x, y, triangles2)
+
+ refiner1 = mtri.UniformTriRefiner(triang1)
+ refiner2 = mtri.UniformTriRefiner(triang2)
+
+ fine_triang1 = refiner1.refine_triangulation(subdiv=1)
+ fine_triang2 = refiner2.refine_triangulation(subdiv=1)
+
+ assert_array_equal(fine_triang1.triangles, fine_triang2.triangles)
+
+
+def test_qhull_triangle_orientation():
+ # github issue 4437.
+ xi = np.linspace(-2, 2, 100)
+ x, y = map(np.ravel, np.meshgrid(xi, xi))
+ w = (x > y - 1) & (x < -1.95) & (y > -1.2)
+ x, y = x[w], y[w]
+ theta = np.radians(25)
+ x1 = x*np.cos(theta) - y*np.sin(theta)
+ y1 = x*np.sin(theta) + y*np.cos(theta)
+
+ # Calculate Delaunay triangulation using Qhull.
+ triang = mtri.Triangulation(x1, y1)
+
+ # Neighbors returned by Qhull.
+ qhull_neighbors = triang.neighbors
+
+ # Obtain neighbors using own C++ calculation.
+ triang._neighbors = None
+ own_neighbors = triang.neighbors
+
+ assert_array_equal(qhull_neighbors, own_neighbors)
+
+
+def test_trianalyzer_mismatched_indices():
+ # github issue 4999.
+ x = np.array([0., 1., 0.5, 0., 2.])
+ y = np.array([0., 0., 0.5*np.sqrt(3.), -1., 1.])
+ triangles = np.array([[0, 1, 2], [0, 1, 3], [1, 2, 4]], dtype=np.int32)
+ mask = np.array([False, False, True], dtype=bool)
+ triang = mtri.Triangulation(x, y, triangles, mask=mask)
+ analyser = mtri.TriAnalyzer(triang)
+ # numpy >= 1.10 raises a VisibleDeprecationWarning in the following line
+ # prior to the fix.
+ analyser._get_compressed_triangulation()
+
+
+def test_tricontourf_decreasing_levels():
+ # github issue 5477.
+ x = [0.0, 1.0, 1.0]
+ y = [0.0, 0.0, 1.0]
+ z = [0.2, 0.4, 0.6]
+ plt.figure()
+ with pytest.raises(ValueError):
+ plt.tricontourf(x, y, z, [1.0, 0.0])
+
+
+def test_internal_cpp_api():
+ # Following github issue 8197.
+ from matplotlib import _tri # noqa: ensure lazy-loaded module *is* loaded.
+
+ # C++ Triangulation.
+ with pytest.raises(
+ TypeError,
+ match=r'function takes exactly 7 arguments \(0 given\)'):
+ mpl._tri.Triangulation()
+
+ with pytest.raises(
+ ValueError, match=r'x and y must be 1D arrays of the same length'):
+ mpl._tri.Triangulation([], [1], [[]], None, None, None, False)
+
+ x = [0, 1, 1]
+ y = [0, 0, 1]
+ with pytest.raises(
+ ValueError,
+ match=r'triangles must be a 2D array of shape \(\?,3\)'):
+ mpl._tri.Triangulation(x, y, [[0, 1]], None, None, None, False)
+
+ tris = [[0, 1, 2]]
+ with pytest.raises(
+ ValueError,
+ match=r'mask must be a 1D array with the same length as the '
+ r'triangles array'):
+ mpl._tri.Triangulation(x, y, tris, [0, 1], None, None, False)
+
+ with pytest.raises(
+ ValueError, match=r'edges must be a 2D array with shape \(\?,2\)'):
+ mpl._tri.Triangulation(x, y, tris, None, [[1]], None, False)
+
+ with pytest.raises(
+ ValueError,
+ match=r'neighbors must be a 2D array with the same shape as the '
+ r'triangles array'):
+ mpl._tri.Triangulation(x, y, tris, None, None, [[-1]], False)
+
+ triang = mpl._tri.Triangulation(x, y, tris, None, None, None, False)
+
+ with pytest.raises(
+ ValueError,
+ match=r'z array must have same length as triangulation x and y '
+ r'array'):
+ triang.calculate_plane_coefficients([])
+
+ with pytest.raises(
+ ValueError,
+ match=r'mask must be a 1D array with the same length as the '
+ r'triangles array'):
+ triang.set_mask([0, 1])
+
+ # C++ TriContourGenerator.
+ with pytest.raises(
+ TypeError,
+ match=r'function takes exactly 2 arguments \(0 given\)'):
+ mpl._tri.TriContourGenerator()
+
+ with pytest.raises(
+ ValueError,
+ match=r'z must be a 1D array with the same length as the x and y '
+ r'arrays'):
+ mpl._tri.TriContourGenerator(triang, [1])
+
+ z = [0, 1, 2]
+ tcg = mpl._tri.TriContourGenerator(triang, z)
+
+ with pytest.raises(
+ ValueError, match=r'filled contour levels must be increasing'):
+ tcg.create_filled_contour(1, 0)
+
+ # C++ TrapezoidMapTriFinder.
+ with pytest.raises(
+ TypeError, match=r'function takes exactly 1 argument \(0 given\)'):
+ mpl._tri.TrapezoidMapTriFinder()
+
+ trifinder = mpl._tri.TrapezoidMapTriFinder(triang)
+
+ with pytest.raises(
+ ValueError, match=r'x and y must be array-like with same shape'):
+ trifinder.find_many([0], [0, 1])
+
+
+def test_qhull_large_offset():
+ # github issue 8682.
+ x = np.asarray([0, 1, 0, 1, 0.5])
+ y = np.asarray([0, 0, 1, 1, 0.5])
+
+ offset = 1e10
+ triang = mtri.Triangulation(x, y)
+ triang_offset = mtri.Triangulation(x + offset, y + offset)
+ assert len(triang.triangles) == len(triang_offset.triangles)
+
+
+def test_tricontour_non_finite_z():
+ # github issue 10167.
+ x = [0, 1, 0, 1]
+ y = [0, 0, 1, 1]
+ triang = mtri.Triangulation(x, y)
+ plt.figure()
+
+ with pytest.raises(ValueError, match='z array must not contain non-finite '
+ 'values within the triangulation'):
+ plt.tricontourf(triang, [0, 1, 2, np.inf])
+
+ with pytest.raises(ValueError, match='z array must not contain non-finite '
+ 'values within the triangulation'):
+ plt.tricontourf(triang, [0, 1, 2, -np.inf])
+
+ with pytest.raises(ValueError, match='z array must not contain non-finite '
+ 'values within the triangulation'):
+ plt.tricontourf(triang, [0, 1, 2, np.nan])
+
+ with pytest.raises(ValueError, match='z must not contain masked points '
+ 'within the triangulation'):
+ plt.tricontourf(triang, np.ma.array([0, 1, 2, 3], mask=[1, 0, 0, 0]))
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_ttconv.py b/venv/Lib/site-packages/matplotlib/tests/test_ttconv.py
new file mode 100644
index 0000000..1d839e7
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_ttconv.py
@@ -0,0 +1,17 @@
+from pathlib import Path
+
+import matplotlib
+from matplotlib.testing.decorators import image_comparison
+import matplotlib.pyplot as plt
+
+
+@image_comparison(["truetype-conversion.pdf"])
+# mpltest.ttf does not have "l"/"p" glyphs so we get a warning when trying to
+# get the font extents.
+def test_truetype_conversion(recwarn):
+ matplotlib.rcParams['pdf.fonttype'] = 3
+ fig, ax = plt.subplots()
+ ax.text(0, 0, "ABCDE",
+ font=Path(__file__).with_name("mpltest.ttf"), fontsize=80)
+ ax.set_xticks([])
+ ax.set_yticks([])
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_type1font.py b/venv/Lib/site-packages/matplotlib/tests/test_type1font.py
new file mode 100644
index 0000000..8800e18
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_type1font.py
@@ -0,0 +1,69 @@
+import matplotlib.type1font as t1f
+import os.path
+import difflib
+
+
+def test_Type1Font():
+ filename = os.path.join(os.path.dirname(__file__), 'cmr10.pfb')
+ font = t1f.Type1Font(filename)
+ slanted = font.transform({'slant': 1})
+ condensed = font.transform({'extend': 0.5})
+ with open(filename, 'rb') as fd:
+ rawdata = fd.read()
+ assert font.parts[0] == rawdata[0x0006:0x10c5]
+ assert font.parts[1] == rawdata[0x10cb:0x897f]
+ assert font.parts[2] == rawdata[0x8985:0x8ba6]
+ assert font.parts[1:] == slanted.parts[1:]
+ assert font.parts[1:] == condensed.parts[1:]
+
+ differ = difflib.Differ()
+ diff = list(differ.compare(
+ font.parts[0].decode('latin-1').splitlines(),
+ slanted.parts[0].decode('latin-1').splitlines()))
+ for line in (
+ # Removes UniqueID
+ '- FontDirectory/CMR10 known{/CMR10 findfont dup/UniqueID known{dup',
+ '+ FontDirectory/CMR10 known{/CMR10 findfont dup',
+ # Changes the font name
+ '- /FontName /CMR10 def',
+ '+ /FontName /CMR10_Slant_1000 def',
+ # Alters FontMatrix
+ '- /FontMatrix [0.001 0 0 0.001 0 0 ]readonly def',
+ '+ /FontMatrix [0.001 0 0.001 0.001 0 0]readonly def',
+ # Alters ItalicAngle
+ '- /ItalicAngle 0 def',
+ '+ /ItalicAngle -45.0 def'):
+ assert line in diff, 'diff to slanted font must contain %s' % line
+
+ diff = list(differ.compare(
+ font.parts[0].decode('latin-1').splitlines(),
+ condensed.parts[0].decode('latin-1').splitlines()))
+ for line in (
+ # Removes UniqueID
+ '- FontDirectory/CMR10 known{/CMR10 findfont dup/UniqueID known{dup',
+ '+ FontDirectory/CMR10 known{/CMR10 findfont dup',
+ # Changes the font name
+ '- /FontName /CMR10 def',
+ '+ /FontName /CMR10_Extend_500 def',
+ # Alters FontMatrix
+ '- /FontMatrix [0.001 0 0 0.001 0 0 ]readonly def',
+ '+ /FontMatrix [0.0005 0 0 0.001 0 0]readonly def'):
+ assert line in diff, 'diff to condensed font must contain %s' % line
+
+
+def test_overprecision():
+ # We used to output too many digits in FontMatrix entries and
+ # ItalicAngle, which could make Type-1 parsers unhappy.
+ filename = os.path.join(os.path.dirname(__file__), 'cmr10.pfb')
+ font = t1f.Type1Font(filename)
+ slanted = font.transform({'slant': .167})
+ lines = slanted.parts[0].decode('ascii').splitlines()
+ matrix, = [line[line.index('[')+1:line.index(']')]
+ for line in lines if '/FontMatrix' in line]
+ angle, = [word
+ for line in lines if '/ItalicAngle' in line
+ for word in line.split() if word[0] in '-0123456789']
+ # the following used to include 0.00016700000000000002
+ assert matrix == '0.001 0 0.000167 0.001 0 0'
+ # and here we had -9.48090361795083
+ assert angle == '-9.4809'
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_units.py b/venv/Lib/site-packages/matplotlib/tests/test_units.py
new file mode 100644
index 0000000..3f40a99
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_units.py
@@ -0,0 +1,213 @@
+from datetime import datetime, timezone, timedelta
+import platform
+from unittest.mock import MagicMock
+
+import matplotlib.pyplot as plt
+from matplotlib.testing.decorators import check_figures_equal, image_comparison
+import matplotlib.units as munits
+from matplotlib.category import UnitData
+import numpy as np
+import pytest
+
+
+# Basic class that wraps numpy array and has units
+class Quantity:
+ def __init__(self, data, units):
+ self.magnitude = data
+ self.units = units
+
+ def to(self, new_units):
+ factors = {('hours', 'seconds'): 3600, ('minutes', 'hours'): 1 / 60,
+ ('minutes', 'seconds'): 60, ('feet', 'miles'): 1 / 5280.,
+ ('feet', 'inches'): 12, ('miles', 'inches'): 12 * 5280}
+ if self.units != new_units:
+ mult = factors[self.units, new_units]
+ return Quantity(mult * self.magnitude, new_units)
+ else:
+ return Quantity(self.magnitude, self.units)
+
+ def __getattr__(self, attr):
+ return getattr(self.magnitude, attr)
+
+ def __getitem__(self, item):
+ if np.iterable(self.magnitude):
+ return Quantity(self.magnitude[item], self.units)
+ else:
+ return Quantity(self.magnitude, self.units)
+
+ def __array__(self):
+ return np.asarray(self.magnitude)
+
+
+@pytest.fixture
+def quantity_converter():
+ # Create an instance of the conversion interface and
+ # mock so we can check methods called
+ qc = munits.ConversionInterface()
+
+ def convert(value, unit, axis):
+ if hasattr(value, 'units'):
+ return value.to(unit).magnitude
+ elif np.iterable(value):
+ try:
+ return [v.to(unit).magnitude for v in value]
+ except AttributeError:
+ return [Quantity(v, axis.get_units()).to(unit).magnitude
+ for v in value]
+ else:
+ return Quantity(value, axis.get_units()).to(unit).magnitude
+
+ def default_units(value, axis):
+ if hasattr(value, 'units'):
+ return value.units
+ elif np.iterable(value):
+ for v in value:
+ if hasattr(v, 'units'):
+ return v.units
+ return None
+
+ qc.convert = MagicMock(side_effect=convert)
+ qc.axisinfo = MagicMock(side_effect=lambda u, a: munits.AxisInfo(label=u))
+ qc.default_units = MagicMock(side_effect=default_units)
+ return qc
+
+
+# Tests that the conversion machinery works properly for classes that
+# work as a facade over numpy arrays (like pint)
+@image_comparison(['plot_pint.png'], remove_text=False, style='mpl20',
+ tol=0 if platform.machine() == 'x86_64' else 0.01)
+def test_numpy_facade(quantity_converter):
+ # use former defaults to match existing baseline image
+ plt.rcParams['axes.formatter.limits'] = -7, 7
+
+ # Register the class
+ munits.registry[Quantity] = quantity_converter
+
+ # Simple test
+ y = Quantity(np.linspace(0, 30), 'miles')
+ x = Quantity(np.linspace(0, 5), 'hours')
+
+ fig, ax = plt.subplots()
+ fig.subplots_adjust(left=0.15) # Make space for label
+ ax.plot(x, y, 'tab:blue')
+ ax.axhline(Quantity(26400, 'feet'), color='tab:red')
+ ax.axvline(Quantity(120, 'minutes'), color='tab:green')
+ ax.yaxis.set_units('inches')
+ ax.xaxis.set_units('seconds')
+
+ assert quantity_converter.convert.called
+ assert quantity_converter.axisinfo.called
+ assert quantity_converter.default_units.called
+
+
+# Tests gh-8908
+@image_comparison(['plot_masked_units.png'], remove_text=True, style='mpl20',
+ tol=0 if platform.machine() == 'x86_64' else 0.01)
+def test_plot_masked_units():
+ data = np.linspace(-5, 5)
+ data_masked = np.ma.array(data, mask=(data > -2) & (data < 2))
+ data_masked_units = Quantity(data_masked, 'meters')
+
+ fig, ax = plt.subplots()
+ ax.plot(data_masked_units)
+
+
+def test_empty_set_limits_with_units(quantity_converter):
+ # Register the class
+ munits.registry[Quantity] = quantity_converter
+
+ fig, ax = plt.subplots()
+ ax.set_xlim(Quantity(-1, 'meters'), Quantity(6, 'meters'))
+ ax.set_ylim(Quantity(-1, 'hours'), Quantity(16, 'hours'))
+
+
+@image_comparison(['jpl_bar_units.png'],
+ savefig_kwarg={'dpi': 120}, style='mpl20')
+def test_jpl_bar_units():
+ import matplotlib.testing.jpl_units as units
+ units.register()
+
+ day = units.Duration("ET", 24.0 * 60.0 * 60.0)
+ x = [0 * units.km, 1 * units.km, 2 * units.km]
+ w = [1 * day, 2 * day, 3 * day]
+ b = units.Epoch("ET", dt=datetime(2009, 4, 25))
+ fig, ax = plt.subplots()
+ ax.bar(x, w, bottom=b)
+ ax.set_ylim([b - 1 * day, b + w[-1] + (1.001) * day])
+
+
+@image_comparison(['jpl_barh_units.png'],
+ savefig_kwarg={'dpi': 120}, style='mpl20')
+def test_jpl_barh_units():
+ import matplotlib.testing.jpl_units as units
+ units.register()
+
+ day = units.Duration("ET", 24.0 * 60.0 * 60.0)
+ x = [0 * units.km, 1 * units.km, 2 * units.km]
+ w = [1 * day, 2 * day, 3 * day]
+ b = units.Epoch("ET", dt=datetime(2009, 4, 25))
+
+ fig, ax = plt.subplots()
+ ax.barh(x, w, left=b)
+ ax.set_xlim([b - 1 * day, b + w[-1] + (1.001) * day])
+
+
+def test_empty_arrays():
+ # Check that plotting an empty array with a dtype works
+ plt.scatter(np.array([], dtype='datetime64[ns]'), np.array([]))
+
+
+def test_scatter_element0_masked():
+ times = np.arange('2005-02', '2005-03', dtype='datetime64[D]')
+ y = np.arange(len(times), dtype=float)
+ y[0] = np.nan
+ fig, ax = plt.subplots()
+ ax.scatter(times, y)
+ fig.canvas.draw()
+
+
+@check_figures_equal(extensions=["png"])
+def test_subclass(fig_test, fig_ref):
+ class subdate(datetime):
+ pass
+
+ fig_test.subplots().plot(subdate(2000, 1, 1), 0, "o")
+ fig_ref.subplots().plot(datetime(2000, 1, 1), 0, "o")
+
+
+def test_shared_axis_quantity(quantity_converter):
+ munits.registry[Quantity] = quantity_converter
+ x = Quantity(np.linspace(0, 1, 10), "hours")
+ y1 = Quantity(np.linspace(1, 2, 10), "feet")
+ y2 = Quantity(np.linspace(3, 4, 10), "feet")
+ fig, (ax1, ax2) = plt.subplots(2, 1, sharex='all', sharey='all')
+ ax1.plot(x, y1)
+ ax2.plot(x, y2)
+ assert ax1.xaxis.get_units() == ax2.xaxis.get_units() == "hours"
+ assert ax2.yaxis.get_units() == ax2.yaxis.get_units() == "feet"
+ ax1.xaxis.set_units("seconds")
+ ax2.yaxis.set_units("inches")
+ assert ax1.xaxis.get_units() == ax2.xaxis.get_units() == "seconds"
+ assert ax1.yaxis.get_units() == ax2.yaxis.get_units() == "inches"
+
+
+def test_shared_axis_datetime():
+ # datetime uses dates.DateConverter
+ y1 = [datetime(2020, i, 1, tzinfo=timezone.utc) for i in range(1, 13)]
+ y2 = [datetime(2021, i, 1, tzinfo=timezone.utc) for i in range(1, 13)]
+ fig, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
+ ax1.plot(y1)
+ ax2.plot(y2)
+ ax1.yaxis.set_units(timezone(timedelta(hours=5)))
+ assert ax2.yaxis.units == timezone(timedelta(hours=5))
+
+
+def test_shared_axis_categorical():
+ # str uses category.StrCategoryConverter
+ d1 = {"a": 1, "b": 2}
+ d2 = {"a": 3, "b": 4}
+ fig, (ax1, ax2) = plt.subplots(1, 2, sharex=True, sharey=True)
+ ax1.plot(d1.keys(), d1.values())
+ ax2.plot(d2.keys(), d2.values())
+ ax1.xaxis.set_units(UnitData(["c", "d"]))
+ assert "c" in ax2.xaxis.get_units()._mapping.keys()
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_usetex.py b/venv/Lib/site-packages/matplotlib/tests/test_usetex.py
new file mode 100644
index 0000000..2d79e15
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_usetex.py
@@ -0,0 +1,105 @@
+import numpy as np
+import pytest
+
+import matplotlib as mpl
+from matplotlib.testing import _has_tex_package
+from matplotlib.testing.decorators import check_figures_equal, image_comparison
+import matplotlib.pyplot as plt
+
+
+if not mpl.checkdep_usetex(True):
+ pytestmark = pytest.mark.skip('Missing TeX of Ghostscript or dvipng')
+
+
+@image_comparison(
+ baseline_images=['test_usetex'],
+ extensions=['pdf', 'png'],
+ style="mpl20")
+def test_usetex():
+ mpl.rcParams['text.usetex'] = True
+ fig, ax = plt.subplots()
+ kwargs = {"verticalalignment": "baseline", "size": 24,
+ "bbox": dict(pad=0, edgecolor="k", facecolor="none")}
+ ax.text(0.2, 0.7,
+ # the \LaTeX macro exercises character sizing and placement,
+ # \left[ ... \right\} draw some variable-height characters,
+ # \sqrt and \frac draw horizontal rules, \mathrm changes the font
+ r'\LaTeX\ $\left[\int\limits_e^{2e}'
+ r'\sqrt\frac{\log^3 x}{x}\,\mathrm{d}x \right\}$',
+ **kwargs)
+ ax.text(0.2, 0.3, "lg", **kwargs)
+ ax.text(0.4, 0.3, r"$\frac{1}{2}\pi$", **kwargs)
+ ax.text(0.6, 0.3, "$p^{3^A}$", **kwargs)
+ ax.text(0.8, 0.3, "$p_{3_2}$", **kwargs)
+ for x in {t.get_position()[0] for t in ax.texts}:
+ ax.axvline(x)
+ for y in {t.get_position()[1] for t in ax.texts}:
+ ax.axhline(y)
+ ax.set_axis_off()
+
+
+@check_figures_equal()
+def test_empty(fig_test, fig_ref):
+ mpl.rcParams['text.usetex'] = True
+ fig_test.text(.5, .5, "% a comment")
+
+
+@check_figures_equal()
+def test_unicode_minus(fig_test, fig_ref):
+ mpl.rcParams['text.usetex'] = True
+ fig_test.text(.5, .5, "$-$")
+ fig_ref.text(.5, .5, "\N{MINUS SIGN}")
+
+
+def test_mathdefault():
+ plt.rcParams["axes.formatter.use_mathtext"] = True
+ fig = plt.figure()
+ fig.add_subplot().set_xlim(-1, 1)
+ # Check that \mathdefault commands generated by tickers don't cause
+ # problems when later switching usetex on.
+ mpl.rcParams['text.usetex'] = True
+ fig.canvas.draw()
+
+
+@pytest.mark.parametrize("fontsize", [8, 10, 12])
+def test_minus_no_descent(fontsize):
+ # Test special-casing of minus descent in DviFont._height_depth_of, by
+ # checking that overdrawing a 1 and a -1 results in an overall height
+ # equivalent to drawing either of them separately.
+ mpl.style.use("mpl20")
+ mpl.rcParams['font.size'] = fontsize
+ heights = {}
+ fig = plt.figure()
+ for vals in [(1,), (-1,), (-1, 1)]:
+ fig.clf()
+ for x in vals:
+ fig.text(.5, .5, f"${x}$", usetex=True)
+ fig.canvas.draw()
+ # The following counts the number of non-fully-blank pixel rows.
+ heights[vals] = ((np.array(fig.canvas.buffer_rgba())[..., 0] != 255)
+ .any(axis=1).sum())
+ assert len({*heights.values()}) == 1
+
+
+@pytest.mark.skipif(not _has_tex_package('xcolor'),
+ reason='xcolor is not available')
+def test_usetex_xcolor():
+ mpl.rcParams['text.usetex'] = True
+
+ fig = plt.figure()
+ text = fig.text(0.5, 0.5, "Some text 0123456789")
+ fig.canvas.draw()
+
+ mpl.rcParams['text.latex.preamble'] = r'\usepackage[dvipsnames]{xcolor}'
+ fig = plt.figure()
+ text2 = fig.text(0.5, 0.5, "Some text 0123456789")
+ fig.canvas.draw()
+ np.testing.assert_array_equal(text2.get_window_extent(),
+ text.get_window_extent())
+
+
+def test_textcomp_full():
+ plt.rcParams["text.latex.preamble"] = r"\usepackage[full]{textcomp}"
+ fig = plt.figure()
+ fig.text(.5, .5, "hello, world", usetex=True)
+ fig.canvas.draw()
diff --git a/venv/Lib/site-packages/matplotlib/tests/test_widgets.py b/venv/Lib/site-packages/matplotlib/tests/test_widgets.py
new file mode 100644
index 0000000..9587601
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tests/test_widgets.py
@@ -0,0 +1,466 @@
+import matplotlib.colors as mcolors
+import matplotlib.widgets as widgets
+import matplotlib.pyplot as plt
+from matplotlib.testing.decorators import image_comparison
+from matplotlib.testing.widgets import do_event, get_ax
+
+from numpy.testing import assert_allclose
+
+import pytest
+
+
+def check_rectangle(**kwargs):
+ ax = get_ax()
+
+ def onselect(epress, erelease):
+ ax._got_onselect = True
+ assert epress.xdata == 100
+ assert epress.ydata == 100
+ assert erelease.xdata == 199
+ assert erelease.ydata == 199
+
+ tool = widgets.RectangleSelector(ax, onselect, **kwargs)
+ do_event(tool, 'press', xdata=100, ydata=100, button=1)
+ do_event(tool, 'onmove', xdata=199, ydata=199, button=1)
+
+ # purposely drag outside of axis for release
+ do_event(tool, 'release', xdata=250, ydata=250, button=1)
+
+ if kwargs.get('drawtype', None) not in ['line', 'none']:
+ assert_allclose(tool.geometry,
+ [[100., 100, 199, 199, 100],
+ [100, 199, 199, 100, 100]],
+ err_msg=tool.geometry)
+
+ assert ax._got_onselect
+
+
+def test_rectangle_selector():
+ check_rectangle()
+ check_rectangle(drawtype='line', useblit=False)
+ check_rectangle(useblit=True, button=1)
+ check_rectangle(drawtype='none', minspanx=10, minspany=10)
+ check_rectangle(minspanx=10, minspany=10, spancoords='pixels')
+ check_rectangle(rectprops=dict(fill=True))
+
+
+def test_ellipse():
+ """For ellipse, test out the key modifiers"""
+ ax = get_ax()
+
+ def onselect(epress, erelease):
+ pass
+
+ tool = widgets.EllipseSelector(ax, onselect=onselect,
+ maxdist=10, interactive=True)
+ tool.extents = (100, 150, 100, 150)
+
+ # drag the rectangle
+ do_event(tool, 'press', xdata=10, ydata=10, button=1,
+ key=' ')
+
+ do_event(tool, 'onmove', xdata=30, ydata=30, button=1)
+ do_event(tool, 'release', xdata=30, ydata=30, button=1)
+ assert tool.extents == (120, 170, 120, 170)
+
+ # create from center
+ do_event(tool, 'on_key_press', xdata=100, ydata=100, button=1,
+ key='control')
+ do_event(tool, 'press', xdata=100, ydata=100, button=1)
+ do_event(tool, 'onmove', xdata=125, ydata=125, button=1)
+ do_event(tool, 'release', xdata=125, ydata=125, button=1)
+ do_event(tool, 'on_key_release', xdata=100, ydata=100, button=1,
+ key='control')
+ assert tool.extents == (75, 125, 75, 125)
+
+ # create a square
+ do_event(tool, 'on_key_press', xdata=10, ydata=10, button=1,
+ key='shift')
+ do_event(tool, 'press', xdata=10, ydata=10, button=1)
+ do_event(tool, 'onmove', xdata=35, ydata=30, button=1)
+ do_event(tool, 'release', xdata=35, ydata=30, button=1)
+ do_event(tool, 'on_key_release', xdata=10, ydata=10, button=1,
+ key='shift')
+ extents = [int(e) for e in tool.extents]
+ assert extents == [10, 35, 10, 34]
+
+ # create a square from center
+ do_event(tool, 'on_key_press', xdata=100, ydata=100, button=1,
+ key='ctrl+shift')
+ do_event(tool, 'press', xdata=100, ydata=100, button=1)
+ do_event(tool, 'onmove', xdata=125, ydata=130, button=1)
+ do_event(tool, 'release', xdata=125, ydata=130, button=1)
+ do_event(tool, 'on_key_release', xdata=100, ydata=100, button=1,
+ key='ctrl+shift')
+ extents = [int(e) for e in tool.extents]
+ assert extents == [70, 129, 70, 130]
+
+ assert tool.geometry.shape == (2, 73)
+ assert_allclose(tool.geometry[:, 0], [70., 100])
+
+
+def test_rectangle_handles():
+ ax = get_ax()
+
+ def onselect(epress, erelease):
+ pass
+
+ tool = widgets.RectangleSelector(ax, onselect=onselect,
+ maxdist=10, interactive=True,
+ marker_props={'markerfacecolor': 'r',
+ 'markeredgecolor': 'b'})
+ tool.extents = (100, 150, 100, 150)
+
+ assert tool.corners == (
+ (100, 150, 150, 100), (100, 100, 150, 150))
+ assert tool.extents == (100, 150, 100, 150)
+ assert tool.edge_centers == (
+ (100, 125.0, 150, 125.0), (125.0, 100, 125.0, 150))
+ assert tool.extents == (100, 150, 100, 150)
+
+ # grab a corner and move it
+ do_event(tool, 'press', xdata=100, ydata=100)
+ do_event(tool, 'onmove', xdata=120, ydata=120)
+ do_event(tool, 'release', xdata=120, ydata=120)
+ assert tool.extents == (120, 150, 120, 150)
+
+ # grab the center and move it
+ do_event(tool, 'press', xdata=132, ydata=132)
+ do_event(tool, 'onmove', xdata=120, ydata=120)
+ do_event(tool, 'release', xdata=120, ydata=120)
+ assert tool.extents == (108, 138, 108, 138)
+
+ # create a new rectangle
+ do_event(tool, 'press', xdata=10, ydata=10)
+ do_event(tool, 'onmove', xdata=100, ydata=100)
+ do_event(tool, 'release', xdata=100, ydata=100)
+ assert tool.extents == (10, 100, 10, 100)
+
+ # Check that marker_props worked.
+ assert mcolors.same_color(
+ tool._corner_handles.artist.get_markerfacecolor(), 'r')
+ assert mcolors.same_color(
+ tool._corner_handles.artist.get_markeredgecolor(), 'b')
+
+
+def check_span(*args, **kwargs):
+ ax = get_ax()
+
+ def onselect(vmin, vmax):
+ ax._got_onselect = True
+ assert vmin == 100
+ assert vmax == 150
+
+ def onmove(vmin, vmax):
+ assert vmin == 100
+ assert vmax == 125
+ ax._got_on_move = True
+
+ if 'onmove_callback' in kwargs:
+ kwargs['onmove_callback'] = onmove
+
+ tool = widgets.SpanSelector(ax, onselect, *args, **kwargs)
+ do_event(tool, 'press', xdata=100, ydata=100, button=1)
+ do_event(tool, 'onmove', xdata=125, ydata=125, button=1)
+ do_event(tool, 'release', xdata=150, ydata=150, button=1)
+
+ assert ax._got_onselect
+
+ if 'onmove_callback' in kwargs:
+ assert ax._got_on_move
+
+
+def test_span_selector():
+ check_span('horizontal', minspan=10, useblit=True)
+ check_span('vertical', onmove_callback=True, button=1)
+ check_span('horizontal', rectprops=dict(fill=True))
+
+
+def check_lasso_selector(**kwargs):
+ ax = get_ax()
+
+ def onselect(verts):
+ ax._got_onselect = True
+ assert verts == [(100, 100), (125, 125), (150, 150)]
+
+ tool = widgets.LassoSelector(ax, onselect, **kwargs)
+ do_event(tool, 'press', xdata=100, ydata=100, button=1)
+ do_event(tool, 'onmove', xdata=125, ydata=125, button=1)
+ do_event(tool, 'release', xdata=150, ydata=150, button=1)
+
+ assert ax._got_onselect
+
+
+def test_lasso_selector():
+ check_lasso_selector()
+ check_lasso_selector(useblit=False, lineprops=dict(color='red'))
+ check_lasso_selector(useblit=True, button=1)
+
+
+def test_CheckButtons():
+ ax = get_ax()
+ check = widgets.CheckButtons(ax, ('a', 'b', 'c'), (True, False, True))
+ assert check.get_status() == [True, False, True]
+ check.set_active(0)
+ assert check.get_status() == [False, False, True]
+
+ cid = check.on_clicked(lambda: None)
+ check.disconnect(cid)
+
+
+@image_comparison(['check_radio_buttons.png'], style='mpl20', remove_text=True)
+def test_check_radio_buttons_image():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['text.kerning_factor'] = 6
+
+ get_ax()
+ plt.subplots_adjust(left=0.3)
+ rax1 = plt.axes([0.05, 0.7, 0.15, 0.15])
+ rax2 = plt.axes([0.05, 0.2, 0.15, 0.15])
+ widgets.RadioButtons(rax1, ('Radio 1', 'Radio 2', 'Radio 3'))
+ widgets.CheckButtons(rax2, ('Check 1', 'Check 2', 'Check 3'),
+ (False, True, True))
+
+
+@image_comparison(['check_bunch_of_radio_buttons.png'],
+ style='mpl20', remove_text=True)
+def test_check_bunch_of_radio_buttons():
+ rax = plt.axes([0.05, 0.1, 0.15, 0.7])
+ widgets.RadioButtons(rax, ('B1', 'B2', 'B3', 'B4', 'B5', 'B6',
+ 'B7', 'B8', 'B9', 'B10', 'B11', 'B12',
+ 'B13', 'B14', 'B15'))
+
+
+def test_slider_slidermin_slidermax_invalid():
+ fig, ax = plt.subplots()
+ # test min/max with floats
+ with pytest.raises(ValueError):
+ widgets.Slider(ax=ax, label='', valmin=0.0, valmax=24.0,
+ slidermin=10.0)
+ with pytest.raises(ValueError):
+ widgets.Slider(ax=ax, label='', valmin=0.0, valmax=24.0,
+ slidermax=10.0)
+
+
+def test_slider_slidermin_slidermax():
+ fig, ax = plt.subplots()
+ slider_ = widgets.Slider(ax=ax, label='', valmin=0.0, valmax=24.0,
+ valinit=5.0)
+
+ slider = widgets.Slider(ax=ax, label='', valmin=0.0, valmax=24.0,
+ valinit=1.0, slidermin=slider_)
+ assert slider.val == slider_.val
+
+ slider = widgets.Slider(ax=ax, label='', valmin=0.0, valmax=24.0,
+ valinit=10.0, slidermax=slider_)
+ assert slider.val == slider_.val
+
+
+def test_slider_valmin_valmax():
+ fig, ax = plt.subplots()
+ slider = widgets.Slider(ax=ax, label='', valmin=0.0, valmax=24.0,
+ valinit=-10.0)
+ assert slider.val == slider.valmin
+
+ slider = widgets.Slider(ax=ax, label='', valmin=0.0, valmax=24.0,
+ valinit=25.0)
+ assert slider.val == slider.valmax
+
+
+def test_slider_valstep_snapping():
+ fig, ax = plt.subplots()
+ slider = widgets.Slider(ax=ax, label='', valmin=0.0, valmax=24.0,
+ valinit=11.4, valstep=1)
+ assert slider.val == 11
+
+ slider = widgets.Slider(ax=ax, label='', valmin=0.0, valmax=24.0,
+ valinit=11.4, valstep=[0, 1, 5.5, 19.7])
+ assert slider.val == 5.5
+
+
+def test_slider_horizontal_vertical():
+ fig, ax = plt.subplots()
+ slider = widgets.Slider(ax=ax, label='', valmin=0, valmax=24,
+ valinit=12, orientation='horizontal')
+ slider.set_val(10)
+ assert slider.val == 10
+ # check the dimension of the slider patch in axes units
+ box = slider.poly.get_extents().transformed(ax.transAxes.inverted())
+ assert_allclose(box.bounds, [0, 0, 10/24, 1])
+
+ fig, ax = plt.subplots()
+ slider = widgets.Slider(ax=ax, label='', valmin=0, valmax=24,
+ valinit=12, orientation='vertical')
+ slider.set_val(10)
+ assert slider.val == 10
+ # check the dimension of the slider patch in axes units
+ box = slider.poly.get_extents().transformed(ax.transAxes.inverted())
+ assert_allclose(box.bounds, [0, 0, 1, 10/24])
+
+
+@pytest.mark.parametrize("orientation", ["horizontal", "vertical"])
+def test_range_slider(orientation):
+ if orientation == "vertical":
+ idx = [1, 0, 3, 2]
+ else:
+ idx = [0, 1, 2, 3]
+
+ fig, ax = plt.subplots()
+
+ slider = widgets.RangeSlider(
+ ax=ax, label="", valmin=0.0, valmax=1.0, orientation=orientation,
+ valinit=[0.1, 0.34]
+ )
+ box = slider.poly.get_extents().transformed(ax.transAxes.inverted())
+ assert_allclose(box.get_points().flatten()[idx], [0.1, 0, 0.34, 1])
+
+ # Check initial value is set correctly
+ assert_allclose(slider.val, (0.1, 0.34))
+
+ slider.set_val((0.2, 0.6))
+ assert_allclose(slider.val, (0.2, 0.6))
+ box = slider.poly.get_extents().transformed(ax.transAxes.inverted())
+ assert_allclose(box.get_points().flatten()[idx], [0.2, 0, 0.6, 1])
+
+ slider.set_val((0.2, 0.1))
+ assert_allclose(slider.val, (0.1, 0.2))
+
+ slider.set_val((-1, 10))
+ assert_allclose(slider.val, (0, 1))
+
+
+def check_polygon_selector(event_sequence, expected_result, selections_count):
+ """
+ Helper function to test Polygon Selector.
+
+ Parameters
+ ----------
+ event_sequence : list of tuples (etype, dict())
+ A sequence of events to perform. The sequence is a list of tuples
+ where the first element of the tuple is an etype (e.g., 'onmove',
+ 'press', etc.), and the second element of the tuple is a dictionary of
+ the arguments for the event (e.g., xdata=5, key='shift', etc.).
+ expected_result : list of vertices (xdata, ydata)
+ The list of vertices that are expected to result from the event
+ sequence.
+ selections_count : int
+ Wait for the tool to call its `onselect` function `selections_count`
+ times, before comparing the result to the `expected_result`
+ """
+ ax = get_ax()
+
+ ax._selections_count = 0
+
+ def onselect(vertices):
+ ax._selections_count += 1
+ ax._current_result = vertices
+
+ tool = widgets.PolygonSelector(ax, onselect)
+
+ for (etype, event_args) in event_sequence:
+ do_event(tool, etype, **event_args)
+
+ assert ax._selections_count == selections_count
+ assert ax._current_result == expected_result
+
+
+def polygon_place_vertex(xdata, ydata):
+ return [('onmove', dict(xdata=xdata, ydata=ydata)),
+ ('press', dict(xdata=xdata, ydata=ydata)),
+ ('release', dict(xdata=xdata, ydata=ydata))]
+
+
+def test_polygon_selector():
+ # Simple polygon
+ expected_result = [(50, 50), (150, 50), (50, 150)]
+ event_sequence = (polygon_place_vertex(50, 50)
+ + polygon_place_vertex(150, 50)
+ + polygon_place_vertex(50, 150)
+ + polygon_place_vertex(50, 50))
+ check_polygon_selector(event_sequence, expected_result, 1)
+
+ # Move first vertex before completing the polygon.
+ expected_result = [(75, 50), (150, 50), (50, 150)]
+ event_sequence = (polygon_place_vertex(50, 50)
+ + polygon_place_vertex(150, 50)
+ + [('on_key_press', dict(key='control')),
+ ('onmove', dict(xdata=50, ydata=50)),
+ ('press', dict(xdata=50, ydata=50)),
+ ('onmove', dict(xdata=75, ydata=50)),
+ ('release', dict(xdata=75, ydata=50)),
+ ('on_key_release', dict(key='control'))]
+ + polygon_place_vertex(50, 150)
+ + polygon_place_vertex(75, 50))
+ check_polygon_selector(event_sequence, expected_result, 1)
+
+ # Move first two vertices at once before completing the polygon.
+ expected_result = [(50, 75), (150, 75), (50, 150)]
+ event_sequence = (polygon_place_vertex(50, 50)
+ + polygon_place_vertex(150, 50)
+ + [('on_key_press', dict(key='shift')),
+ ('onmove', dict(xdata=100, ydata=100)),
+ ('press', dict(xdata=100, ydata=100)),
+ ('onmove', dict(xdata=100, ydata=125)),
+ ('release', dict(xdata=100, ydata=125)),
+ ('on_key_release', dict(key='shift'))]
+ + polygon_place_vertex(50, 150)
+ + polygon_place_vertex(50, 75))
+ check_polygon_selector(event_sequence, expected_result, 1)
+
+ # Move first vertex after completing the polygon.
+ expected_result = [(75, 50), (150, 50), (50, 150)]
+ event_sequence = (polygon_place_vertex(50, 50)
+ + polygon_place_vertex(150, 50)
+ + polygon_place_vertex(50, 150)
+ + polygon_place_vertex(50, 50)
+ + [('onmove', dict(xdata=50, ydata=50)),
+ ('press', dict(xdata=50, ydata=50)),
+ ('onmove', dict(xdata=75, ydata=50)),
+ ('release', dict(xdata=75, ydata=50))])
+ check_polygon_selector(event_sequence, expected_result, 2)
+
+ # Move all vertices after completing the polygon.
+ expected_result = [(75, 75), (175, 75), (75, 175)]
+ event_sequence = (polygon_place_vertex(50, 50)
+ + polygon_place_vertex(150, 50)
+ + polygon_place_vertex(50, 150)
+ + polygon_place_vertex(50, 50)
+ + [('on_key_press', dict(key='shift')),
+ ('onmove', dict(xdata=100, ydata=100)),
+ ('press', dict(xdata=100, ydata=100)),
+ ('onmove', dict(xdata=125, ydata=125)),
+ ('release', dict(xdata=125, ydata=125)),
+ ('on_key_release', dict(key='shift'))])
+ check_polygon_selector(event_sequence, expected_result, 2)
+
+ # Try to move a vertex and move all before placing any vertices.
+ expected_result = [(50, 50), (150, 50), (50, 150)]
+ event_sequence = ([('on_key_press', dict(key='control')),
+ ('onmove', dict(xdata=100, ydata=100)),
+ ('press', dict(xdata=100, ydata=100)),
+ ('onmove', dict(xdata=125, ydata=125)),
+ ('release', dict(xdata=125, ydata=125)),
+ ('on_key_release', dict(key='control')),
+ ('on_key_press', dict(key='shift')),
+ ('onmove', dict(xdata=100, ydata=100)),
+ ('press', dict(xdata=100, ydata=100)),
+ ('onmove', dict(xdata=125, ydata=125)),
+ ('release', dict(xdata=125, ydata=125)),
+ ('on_key_release', dict(key='shift'))]
+ + polygon_place_vertex(50, 50)
+ + polygon_place_vertex(150, 50)
+ + polygon_place_vertex(50, 150)
+ + polygon_place_vertex(50, 50))
+ check_polygon_selector(event_sequence, expected_result, 1)
+
+ # Try to place vertex out-of-bounds, then reset, and start a new polygon.
+ expected_result = [(50, 50), (150, 50), (50, 150)]
+ event_sequence = (polygon_place_vertex(50, 50)
+ + polygon_place_vertex(250, 50)
+ + [('on_key_press', dict(key='escape')),
+ ('on_key_release', dict(key='escape'))]
+ + polygon_place_vertex(50, 50)
+ + polygon_place_vertex(150, 50)
+ + polygon_place_vertex(50, 150)
+ + polygon_place_vertex(50, 50))
+ check_polygon_selector(event_sequence, expected_result, 1)
diff --git a/venv/Lib/site-packages/matplotlib/texmanager.py b/venv/Lib/site-packages/matplotlib/texmanager.py
new file mode 100644
index 0000000..495635e
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/texmanager.py
@@ -0,0 +1,403 @@
+r"""
+Support for embedded TeX expressions in Matplotlib via dvipng and dvips for the
+raster and PostScript backends. The tex and dvipng/dvips information is cached
+in ~/.matplotlib/tex.cache for reuse between sessions.
+
+Requirements:
+
+* LaTeX
+* \*Agg backends: dvipng>=1.6
+* PS backend: psfrag, dvips, and Ghostscript>=9.0
+
+For raster output, you can get RGBA numpy arrays from TeX expressions
+as follows::
+
+ texmanager = TexManager()
+ s = "\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!"
+ Z = texmanager.get_rgba(s, fontsize=12, dpi=80, rgb=(1, 0, 0))
+
+To enable TeX rendering of all text in your Matplotlib figure, set
+:rc:`text.usetex` to True.
+"""
+
+import functools
+import glob
+import hashlib
+import logging
+import os
+from pathlib import Path
+import re
+import subprocess
+from tempfile import TemporaryDirectory
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib import _api, cbook, dviread, rcParams
+
+_log = logging.getLogger(__name__)
+
+
+class TexManager:
+ """
+ Convert strings to dvi files using TeX, caching the results to a directory.
+
+ Repeated calls to this constructor always return the same instance.
+ """
+
+ # Caches.
+ texcache = os.path.join(mpl.get_cachedir(), 'tex.cache')
+ grey_arrayd = {}
+
+ font_family = 'serif'
+ font_families = ('serif', 'sans-serif', 'cursive', 'monospace')
+
+ font_info = {
+ 'new century schoolbook': ('pnc', r'\renewcommand{\rmdefault}{pnc}'),
+ 'bookman': ('pbk', r'\renewcommand{\rmdefault}{pbk}'),
+ 'times': ('ptm', r'\usepackage{mathptmx}'),
+ 'palatino': ('ppl', r'\usepackage{mathpazo}'),
+ 'zapf chancery': ('pzc', r'\usepackage{chancery}'),
+ 'cursive': ('pzc', r'\usepackage{chancery}'),
+ 'charter': ('pch', r'\usepackage{charter}'),
+ 'serif': ('cmr', ''),
+ 'sans-serif': ('cmss', ''),
+ 'helvetica': ('phv', r'\usepackage{helvet}'),
+ 'avant garde': ('pag', r'\usepackage{avant}'),
+ 'courier': ('pcr', r'\usepackage{courier}'),
+ # Loading the type1ec package ensures that cm-super is installed, which
+ # is necessary for unicode computer modern. (It also allows the use of
+ # computer modern at arbitrary sizes, but that's just a side effect.)
+ 'monospace': ('cmtt', r'\usepackage{type1ec}'),
+ 'computer modern roman': ('cmr', r'\usepackage{type1ec}'),
+ 'computer modern sans serif': ('cmss', r'\usepackage{type1ec}'),
+ 'computer modern typewriter': ('cmtt', r'\usepackage{type1ec}')}
+
+ cachedir = _api.deprecated(
+ "3.3", alternative="matplotlib.get_cachedir()")(
+ property(lambda self: mpl.get_cachedir()))
+ rgba_arrayd = _api.deprecated("3.3")(property(lambda self: {}))
+ _fonts = {} # Only for deprecation period.
+ serif = _api.deprecated("3.3")(property(
+ lambda self: self._fonts.get("serif", ('cmr', ''))))
+ sans_serif = _api.deprecated("3.3")(property(
+ lambda self: self._fonts.get("sans-serif", ('cmss', ''))))
+ cursive = _api.deprecated("3.3")(property(
+ lambda self:
+ self._fonts.get("cursive", ('pzc', r'\usepackage{chancery}'))))
+ monospace = _api.deprecated("3.3")(property(
+ lambda self: self._fonts.get("monospace", ('cmtt', ''))))
+
+ @functools.lru_cache() # Always return the same instance.
+ def __new__(cls):
+ Path(cls.texcache).mkdir(parents=True, exist_ok=True)
+ return object.__new__(cls)
+
+ def get_font_config(self):
+ ff = rcParams['font.family']
+ if len(ff) == 1 and ff[0].lower() in self.font_families:
+ self.font_family = ff[0].lower()
+ else:
+ _log.info('font.family must be one of (%s) when text.usetex is '
+ 'True. serif will be used by default.',
+ ', '.join(self.font_families))
+ self.font_family = 'serif'
+
+ fontconfig = [self.font_family]
+ for font_family in self.font_families:
+ for font in rcParams['font.' + font_family]:
+ if font.lower() in self.font_info:
+ self._fonts[font_family] = self.font_info[font.lower()]
+ _log.debug('family: %s, font: %s, info: %s',
+ font_family, font, self.font_info[font.lower()])
+ break
+ else:
+ _log.debug('%s font is not compatible with usetex.', font)
+ else:
+ _log.info('No LaTeX-compatible font found for the %s font '
+ 'family in rcParams. Using default.', font_family)
+ self._fonts[font_family] = self.font_info[font_family]
+ fontconfig.append(self._fonts[font_family][0])
+ # Add a hash of the latex preamble to fontconfig so that the
+ # correct png is selected for strings rendered with same font and dpi
+ # even if the latex preamble changes within the session
+ preamble_bytes = self.get_custom_preamble().encode('utf-8')
+ fontconfig.append(hashlib.md5(preamble_bytes).hexdigest())
+
+ # The following packages and commands need to be included in the latex
+ # file's preamble:
+ cmd = [self._fonts['serif'][1],
+ self._fonts['sans-serif'][1],
+ self._fonts['monospace'][1]]
+ if self.font_family == 'cursive':
+ cmd.append(self._fonts['cursive'][1])
+ self._font_preamble = '\n'.join([r'\usepackage{type1cm}', *cmd])
+
+ return ''.join(fontconfig)
+
+ def get_basefile(self, tex, fontsize, dpi=None):
+ """
+ Return a filename based on a hash of the string, fontsize, and dpi.
+ """
+ s = ''.join([tex, self.get_font_config(), '%f' % fontsize,
+ self.get_custom_preamble(), str(dpi or '')])
+ return os.path.join(
+ self.texcache, hashlib.md5(s.encode('utf-8')).hexdigest())
+
+ def get_font_preamble(self):
+ """
+ Return a string containing font configuration for the tex preamble.
+ """
+ return self._font_preamble
+
+ def get_custom_preamble(self):
+ """Return a string containing user additions to the tex preamble."""
+ return rcParams['text.latex.preamble']
+
+ def _get_preamble(self):
+ return "\n".join([
+ r"\documentclass{article}",
+ # Pass-through \mathdefault, which is used in non-usetex mode to
+ # use the default text font but was historically suppressed in
+ # usetex mode.
+ r"\newcommand{\mathdefault}[1]{#1}",
+ self._font_preamble,
+ r"\usepackage[utf8]{inputenc}",
+ r"\DeclareUnicodeCharacter{2212}{\ensuremath{-}}",
+ # geometry is loaded before the custom preamble as convert_psfrags
+ # relies on a custom preamble to change the geometry.
+ r"\usepackage[papersize=72in, margin=1in]{geometry}",
+ self.get_custom_preamble(),
+ # textcomp is loaded last (if not already loaded by the custom
+ # preamble) in order not to clash with custom packages (e.g.
+ # newtxtext) which load it with different options.
+ r"\makeatletter"
+ r"\@ifpackageloaded{textcomp}{}{\usepackage{textcomp}}"
+ r"\makeatother",
+ ])
+
+ def make_tex(self, tex, fontsize):
+ """
+ Generate a tex file to render the tex string at a specific font size.
+
+ Return the file name.
+ """
+ basefile = self.get_basefile(tex, fontsize)
+ texfile = '%s.tex' % basefile
+ fontcmd = {'sans-serif': r'{\sffamily %s}',
+ 'monospace': r'{\ttfamily %s}'}.get(self.font_family,
+ r'{\rmfamily %s}')
+
+ Path(texfile).write_text(
+ r"""
+%s
+\pagestyle{empty}
+\begin{document}
+%% The empty hbox ensures that a page is printed even for empty inputs, except
+%% when using psfrag which gets confused by it.
+\fontsize{%f}{%f}%%
+\ifdefined\psfrag\else\hbox{}\fi%%
+%s
+\end{document}
+""" % (self._get_preamble(), fontsize, fontsize * 1.25, fontcmd % tex),
+ encoding='utf-8')
+
+ return texfile
+
+ _re_vbox = re.compile(
+ r"MatplotlibBox:\(([\d.]+)pt\+([\d.]+)pt\)x([\d.]+)pt")
+
+ @_api.deprecated("3.3")
+ def make_tex_preview(self, tex, fontsize):
+ """
+ Generate a tex file to render the tex string at a specific font size.
+
+ It uses the preview.sty to determine the dimension (width, height,
+ descent) of the output.
+
+ Return the file name.
+ """
+ basefile = self.get_basefile(tex, fontsize)
+ texfile = '%s.tex' % basefile
+ fontcmd = {'sans-serif': r'{\sffamily %s}',
+ 'monospace': r'{\ttfamily %s}'}.get(self.font_family,
+ r'{\rmfamily %s}')
+
+ # newbox, setbox, immediate, etc. are used to find the box
+ # extent of the rendered text.
+
+ Path(texfile).write_text(
+ r"""
+%s
+\usepackage[active,showbox,tightpage]{preview}
+
+%% we override the default showbox as it is treated as an error and makes
+%% the exit status not zero
+\def\showbox#1%%
+{\immediate\write16{MatplotlibBox:(\the\ht#1+\the\dp#1)x\the\wd#1}}
+
+\begin{document}
+\begin{preview}
+{\fontsize{%f}{%f}%s}
+\end{preview}
+\end{document}
+""" % (self._get_preamble(), fontsize, fontsize * 1.25, fontcmd % tex),
+ encoding='utf-8')
+
+ return texfile
+
+ def _run_checked_subprocess(self, command, tex, *, cwd=None):
+ _log.debug(cbook._pformat_subprocess(command))
+ try:
+ report = subprocess.check_output(
+ command, cwd=cwd if cwd is not None else self.texcache,
+ stderr=subprocess.STDOUT)
+ except FileNotFoundError as exc:
+ raise RuntimeError(
+ 'Failed to process string with tex because {} could not be '
+ 'found'.format(command[0])) from exc
+ except subprocess.CalledProcessError as exc:
+ raise RuntimeError(
+ '{prog} was not able to process the following string:\n'
+ '{tex!r}\n\n'
+ 'Here is the full report generated by {prog}:\n'
+ '{exc}\n\n'.format(
+ prog=command[0],
+ tex=tex.encode('unicode_escape'),
+ exc=exc.output.decode('utf-8'))) from exc
+ _log.debug(report)
+ return report
+
+ def make_dvi(self, tex, fontsize):
+ """
+ Generate a dvi file containing latex's layout of tex string.
+
+ Return the file name.
+ """
+
+ if dict.__getitem__(rcParams, 'text.latex.preview'):
+ return self.make_dvi_preview(tex, fontsize)
+
+ basefile = self.get_basefile(tex, fontsize)
+ dvifile = '%s.dvi' % basefile
+ if not os.path.exists(dvifile):
+ texfile = self.make_tex(tex, fontsize)
+ # Generate the dvi in a temporary directory to avoid race
+ # conditions e.g. if multiple processes try to process the same tex
+ # string at the same time. Having tmpdir be a subdirectory of the
+ # final output dir ensures that they are on the same filesystem,
+ # and thus replace() works atomically.
+ with TemporaryDirectory(dir=Path(dvifile).parent) as tmpdir:
+ self._run_checked_subprocess(
+ ["latex", "-interaction=nonstopmode", "--halt-on-error",
+ texfile], tex, cwd=tmpdir)
+ (Path(tmpdir) / Path(dvifile).name).replace(dvifile)
+ return dvifile
+
+ @_api.deprecated("3.3")
+ def make_dvi_preview(self, tex, fontsize):
+ """
+ Generate a dvi file containing latex's layout of tex string.
+
+ It calls make_tex_preview() method and store the size information
+ (width, height, descent) in a separate file.
+
+ Return the file name.
+ """
+ basefile = self.get_basefile(tex, fontsize)
+ dvifile = '%s.dvi' % basefile
+ baselinefile = '%s.baseline' % basefile
+
+ if not os.path.exists(dvifile) or not os.path.exists(baselinefile):
+ texfile = self.make_tex_preview(tex, fontsize)
+ report = self._run_checked_subprocess(
+ ["latex", "-interaction=nonstopmode", "--halt-on-error",
+ texfile], tex)
+
+ # find the box extent information in the latex output
+ # file and store them in ".baseline" file
+ m = TexManager._re_vbox.search(report.decode("utf-8"))
+ with open(basefile + '.baseline', "w") as fh:
+ fh.write(" ".join(m.groups()))
+
+ for fname in glob.glob(basefile + '*'):
+ if not fname.endswith(('dvi', 'tex', 'baseline')):
+ try:
+ os.remove(fname)
+ except OSError:
+ pass
+
+ return dvifile
+
+ def make_png(self, tex, fontsize, dpi):
+ """
+ Generate a png file containing latex's rendering of tex string.
+
+ Return the file name.
+ """
+ basefile = self.get_basefile(tex, fontsize, dpi)
+ pngfile = '%s.png' % basefile
+ # see get_rgba for a discussion of the background
+ if not os.path.exists(pngfile):
+ dvifile = self.make_dvi(tex, fontsize)
+ cmd = ["dvipng", "-bg", "Transparent", "-D", str(dpi),
+ "-T", "tight", "-o", pngfile, dvifile]
+ # When testing, disable FreeType rendering for reproducibility; but
+ # dvipng 1.16 has a bug (fixed in f3ff241) that breaks --freetype0
+ # mode, so for it we keep FreeType enabled; the image will be
+ # slightly off.
+ if (getattr(mpl, "_called_from_pytest", False)
+ and mpl._get_executable_info("dvipng").version != "1.16"):
+ cmd.insert(1, "--freetype0")
+ self._run_checked_subprocess(cmd, tex)
+ return pngfile
+
+ def get_grey(self, tex, fontsize=None, dpi=None):
+ """Return the alpha channel."""
+ if not fontsize:
+ fontsize = rcParams['font.size']
+ if not dpi:
+ dpi = rcParams['savefig.dpi']
+ key = tex, self.get_font_config(), fontsize, dpi
+ alpha = self.grey_arrayd.get(key)
+ if alpha is None:
+ pngfile = self.make_png(tex, fontsize, dpi)
+ rgba = mpl.image.imread(os.path.join(self.texcache, pngfile))
+ self.grey_arrayd[key] = alpha = rgba[:, :, -1]
+ return alpha
+
+ def get_rgba(self, tex, fontsize=None, dpi=None, rgb=(0, 0, 0)):
+ """Return latex's rendering of the tex string as an rgba array."""
+ alpha = self.get_grey(tex, fontsize, dpi)
+ rgba = np.empty((*alpha.shape, 4))
+ rgba[..., :3] = mpl.colors.to_rgb(rgb)
+ rgba[..., -1] = alpha
+ return rgba
+
+ def get_text_width_height_descent(self, tex, fontsize, renderer=None):
+ """Return width, height and descent of the text."""
+ if tex.strip() == '':
+ return 0, 0, 0
+
+ dpi_fraction = renderer.points_to_pixels(1.) if renderer else 1
+
+ if dict.__getitem__(rcParams, 'text.latex.preview'):
+ # use preview.sty
+ basefile = self.get_basefile(tex, fontsize)
+ baselinefile = '%s.baseline' % basefile
+
+ if not os.path.exists(baselinefile):
+ dvifile = self.make_dvi_preview(tex, fontsize)
+
+ with open(baselinefile) as fh:
+ l = fh.read().split()
+ height, depth, width = [float(l1) * dpi_fraction for l1 in l]
+ return width, height + depth, depth
+
+ else:
+ # use dviread.
+ dvifile = self.make_dvi(tex, fontsize)
+ with dviread.Dvi(dvifile, 72 * dpi_fraction) as dvi:
+ page, = dvi
+ # A total height (including the descent) needs to be returned.
+ return page.width, page.height + page.descent, page.descent
diff --git a/venv/Lib/site-packages/matplotlib/text.py b/venv/Lib/site-packages/matplotlib/text.py
new file mode 100644
index 0000000..bc865aa
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/text.py
@@ -0,0 +1,2005 @@
+"""
+Classes for including text in a figure.
+"""
+
+import contextlib
+import logging
+import math
+import weakref
+
+import numpy as np
+
+import matplotlib as mpl
+from . import _api, artist, cbook, docstring
+from .artist import Artist
+from .font_manager import FontProperties
+from .patches import FancyArrowPatch, FancyBboxPatch, Rectangle
+from .textpath import TextPath # Unused, but imported by others.
+from .transforms import (
+ Affine2D, Bbox, BboxBase, BboxTransformTo, IdentityTransform, Transform)
+
+
+_log = logging.getLogger(__name__)
+
+
+@contextlib.contextmanager
+def _wrap_text(textobj):
+ """Temporarily inserts newlines if the wrap option is enabled."""
+ if textobj.get_wrap():
+ old_text = textobj.get_text()
+ try:
+ textobj.set_text(textobj._get_wrapped_text())
+ yield textobj
+ finally:
+ textobj.set_text(old_text)
+ else:
+ yield textobj
+
+
+# Extracted from Text's method to serve as a function
+def get_rotation(rotation):
+ """
+ Return *rotation* normalized to an angle between 0 and 360 degrees.
+
+ Parameters
+ ----------
+ rotation : float or {None, 'horizontal', 'vertical'}
+ Rotation angle in degrees. *None* and 'horizontal' equal 0,
+ 'vertical' equals 90.
+
+ Returns
+ -------
+ float
+ """
+ try:
+ return float(rotation) % 360
+ except (ValueError, TypeError) as err:
+ if cbook._str_equal(rotation, 'horizontal') or rotation is None:
+ return 0.
+ elif cbook._str_equal(rotation, 'vertical'):
+ return 90.
+ else:
+ raise ValueError("rotation is {!r}; expected either 'horizontal', "
+ "'vertical', numeric value, or None"
+ .format(rotation)) from err
+
+
+def _get_textbox(text, renderer):
+ """
+ Calculate the bounding box of the text.
+
+ The bbox position takes text rotation into account, but the width and
+ height are those of the unrotated box (unlike `.Text.get_window_extent`).
+ """
+ # TODO : This function may move into the Text class as a method. As a
+ # matter of fact, the information from the _get_textbox function
+ # should be available during the Text._get_layout() call, which is
+ # called within the _get_textbox. So, it would better to move this
+ # function as a method with some refactoring of _get_layout method.
+
+ projected_xs = []
+ projected_ys = []
+
+ theta = np.deg2rad(text.get_rotation())
+ tr = Affine2D().rotate(-theta)
+
+ _, parts, d = text._get_layout(renderer)
+
+ for t, wh, x, y in parts:
+ w, h = wh
+
+ xt1, yt1 = tr.transform((x, y))
+ yt1 -= d
+ xt2, yt2 = xt1 + w, yt1 + h
+
+ projected_xs.extend([xt1, xt2])
+ projected_ys.extend([yt1, yt2])
+
+ xt_box, yt_box = min(projected_xs), min(projected_ys)
+ w_box, h_box = max(projected_xs) - xt_box, max(projected_ys) - yt_box
+
+ x_box, y_box = Affine2D().rotate(theta).transform((xt_box, yt_box))
+
+ return x_box, y_box, w_box, h_box
+
+
+@cbook._define_aliases({
+ "color": ["c"],
+ "fontfamily": ["family"],
+ "fontproperties": ["font", "font_properties"],
+ "horizontalalignment": ["ha"],
+ "multialignment": ["ma"],
+ "fontname": ["name"],
+ "fontsize": ["size"],
+ "fontstretch": ["stretch"],
+ "fontstyle": ["style"],
+ "fontvariant": ["variant"],
+ "verticalalignment": ["va"],
+ "fontweight": ["weight"],
+})
+class Text(Artist):
+ """Handle storing and drawing of text in window or data coordinates."""
+
+ zorder = 3
+ _cached = cbook.maxdict(50)
+
+ def __repr__(self):
+ return "Text(%s, %s, %s)" % (self._x, self._y, repr(self._text))
+
+ def __init__(self,
+ x=0, y=0, text='',
+ color=None, # defaults to rc params
+ verticalalignment='baseline',
+ horizontalalignment='left',
+ multialignment=None,
+ fontproperties=None, # defaults to FontProperties()
+ rotation=None,
+ linespacing=None,
+ rotation_mode=None,
+ usetex=None, # defaults to rcParams['text.usetex']
+ wrap=False,
+ transform_rotates_text=False,
+ **kwargs
+ ):
+ """
+ Create a `.Text` instance at *x*, *y* with string *text*.
+
+ Valid keyword arguments are:
+
+ %(Text_kwdoc)s
+ """
+ super().__init__()
+ self._x, self._y = x, y
+ self._text = ''
+ self.set_text(text)
+ self.set_color(
+ color if color is not None else mpl.rcParams["text.color"])
+ self.set_fontproperties(fontproperties)
+ self.set_usetex(usetex)
+ self.set_wrap(wrap)
+ self.set_verticalalignment(verticalalignment)
+ self.set_horizontalalignment(horizontalalignment)
+ self._multialignment = multialignment
+ self._rotation = rotation
+ self._transform_rotates_text = transform_rotates_text
+ self._bbox_patch = None # a FancyBboxPatch instance
+ self._renderer = None
+ if linespacing is None:
+ linespacing = 1.2 # Maybe use rcParam later.
+ self._linespacing = linespacing
+ self.set_rotation_mode(rotation_mode)
+ self.update(kwargs)
+
+ def update(self, kwargs):
+ # docstring inherited
+ # make a copy so we do not mutate user input!
+ kwargs = dict(kwargs)
+ sentinel = object() # bbox can be None, so use another sentinel.
+ # Update fontproperties first, as it has lowest priority.
+ fontproperties = kwargs.pop("fontproperties", sentinel)
+ if fontproperties is not sentinel:
+ self.set_fontproperties(fontproperties)
+ # Update bbox last, as it depends on font properties.
+ bbox = kwargs.pop("bbox", sentinel)
+ super().update(kwargs)
+ if bbox is not sentinel:
+ self.set_bbox(bbox)
+
+ def __getstate__(self):
+ d = super().__getstate__()
+ # remove the cached _renderer (if it exists)
+ d['_renderer'] = None
+ return d
+
+ def contains(self, mouseevent):
+ """
+ Return whether the mouse event occurred inside the axis-aligned
+ bounding-box of the text.
+ """
+ inside, info = self._default_contains(mouseevent)
+ if inside is not None:
+ return inside, info
+
+ if not self.get_visible() or self._renderer is None:
+ return False, {}
+
+ # Explicitly use Text.get_window_extent(self) and not
+ # self.get_window_extent() so that Annotation.contains does not
+ # accidentally cover the entire annotation bounding box.
+ bbox = Text.get_window_extent(self)
+ inside = (bbox.x0 <= mouseevent.x <= bbox.x1
+ and bbox.y0 <= mouseevent.y <= bbox.y1)
+
+ cattr = {}
+ # if the text has a surrounding patch, also check containment for it,
+ # and merge the results with the results for the text.
+ if self._bbox_patch:
+ patch_inside, patch_cattr = self._bbox_patch.contains(mouseevent)
+ inside = inside or patch_inside
+ cattr["bbox_patch"] = patch_cattr
+
+ return inside, cattr
+
+ def _get_xy_display(self):
+ """
+ Get the (possibly unit converted) transformed x, y in display coords.
+ """
+ x, y = self.get_unitless_position()
+ return self.get_transform().transform((x, y))
+
+ def _get_multialignment(self):
+ if self._multialignment is not None:
+ return self._multialignment
+ else:
+ return self._horizontalalignment
+
+ def get_rotation(self):
+ """Return the text angle in degrees between 0 and 360."""
+ if self.get_transform_rotates_text():
+ angle = get_rotation(self._rotation)
+ x, y = self.get_unitless_position()
+ angles = [angle, ]
+ pts = [[x, y]]
+ return self.get_transform().transform_angles(angles, pts).item(0)
+ else:
+ return get_rotation(self._rotation) # string_or_number -> number
+
+ def get_transform_rotates_text(self):
+ """
+ Return whether rotations of the transform affect the text direction.
+ """
+ return self._transform_rotates_text
+
+ def set_rotation_mode(self, m):
+ """
+ Set text rotation mode.
+
+ Parameters
+ ----------
+ m : {None, 'default', 'anchor'}
+ If ``None`` or ``"default"``, the text will be first rotated, then
+ aligned according to their horizontal and vertical alignments. If
+ ``"anchor"``, then alignment occurs before rotation.
+ """
+ _api.check_in_list(["anchor", "default", None], rotation_mode=m)
+ self._rotation_mode = m
+ self.stale = True
+
+ def get_rotation_mode(self):
+ """Return the text rotation mode."""
+ return self._rotation_mode
+
+ def update_from(self, other):
+ # docstring inherited
+ super().update_from(other)
+ self._color = other._color
+ self._multialignment = other._multialignment
+ self._verticalalignment = other._verticalalignment
+ self._horizontalalignment = other._horizontalalignment
+ self._fontproperties = other._fontproperties.copy()
+ self._usetex = other._usetex
+ self._rotation = other._rotation
+ self._transform_rotates_text = other._transform_rotates_text
+ self._picker = other._picker
+ self._linespacing = other._linespacing
+ self.stale = True
+
+ def _get_layout(self, renderer):
+ """
+ Return the extent (bbox) of the text together with
+ multiple-alignment information. Note that it returns an extent
+ of a rotated text when necessary.
+ """
+ key = self.get_prop_tup(renderer=renderer)
+ if key in self._cached:
+ return self._cached[key]
+
+ thisx, thisy = 0.0, 0.0
+ lines = self.get_text().split("\n") # Ensures lines is not empty.
+
+ ws = []
+ hs = []
+ xs = []
+ ys = []
+
+ # Full vertical extent of font, including ascenders and descenders:
+ _, lp_h, lp_d = renderer.get_text_width_height_descent(
+ "lp", self._fontproperties,
+ ismath="TeX" if self.get_usetex() else False)
+ min_dy = (lp_h - lp_d) * self._linespacing
+
+ for i, line in enumerate(lines):
+ clean_line, ismath = self._preprocess_math(line)
+ if clean_line:
+ w, h, d = renderer.get_text_width_height_descent(
+ clean_line, self._fontproperties, ismath=ismath)
+ else:
+ w = h = d = 0
+
+ # For multiline text, increase the line spacing when the text
+ # net-height (excluding baseline) is larger than that of a "l"
+ # (e.g., use of superscripts), which seems what TeX does.
+ h = max(h, lp_h)
+ d = max(d, lp_d)
+
+ ws.append(w)
+ hs.append(h)
+
+ # Metrics of the last line that are needed later:
+ baseline = (h - d) - thisy
+
+ if i == 0:
+ # position at baseline
+ thisy = -(h - d)
+ else:
+ # put baseline a good distance from bottom of previous line
+ thisy -= max(min_dy, (h - d) * self._linespacing)
+
+ xs.append(thisx) # == 0.
+ ys.append(thisy)
+
+ thisy -= d
+
+ # Metrics of the last line that are needed later:
+ descent = d
+
+ # Bounding box definition:
+ width = max(ws)
+ xmin = 0
+ xmax = width
+ ymax = 0
+ ymin = ys[-1] - descent # baseline of last line minus its descent
+ height = ymax - ymin
+
+ # get the rotation matrix
+ M = Affine2D().rotate_deg(self.get_rotation())
+
+ # now offset the individual text lines within the box
+ malign = self._get_multialignment()
+ if malign == 'left':
+ offset_layout = [(x, y) for x, y in zip(xs, ys)]
+ elif malign == 'center':
+ offset_layout = [(x + width / 2 - w / 2, y)
+ for x, y, w in zip(xs, ys, ws)]
+ elif malign == 'right':
+ offset_layout = [(x + width - w, y)
+ for x, y, w in zip(xs, ys, ws)]
+
+ # the corners of the unrotated bounding box
+ corners_horiz = np.array(
+ [(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)])
+
+ # now rotate the bbox
+ corners_rotated = M.transform(corners_horiz)
+ # compute the bounds of the rotated box
+ xmin = corners_rotated[:, 0].min()
+ xmax = corners_rotated[:, 0].max()
+ ymin = corners_rotated[:, 1].min()
+ ymax = corners_rotated[:, 1].max()
+ width = xmax - xmin
+ height = ymax - ymin
+
+ # Now move the box to the target position offset the display
+ # bbox by alignment
+ halign = self._horizontalalignment
+ valign = self._verticalalignment
+
+ rotation_mode = self.get_rotation_mode()
+ if rotation_mode != "anchor":
+ # compute the text location in display coords and the offsets
+ # necessary to align the bbox with that location
+ if halign == 'center':
+ offsetx = (xmin + xmax) / 2
+ elif halign == 'right':
+ offsetx = xmax
+ else:
+ offsetx = xmin
+
+ if valign == 'center':
+ offsety = (ymin + ymax) / 2
+ elif valign == 'top':
+ offsety = ymax
+ elif valign == 'baseline':
+ offsety = ymin + descent
+ elif valign == 'center_baseline':
+ offsety = ymin + height - baseline / 2.0
+ else:
+ offsety = ymin
+ else:
+ xmin1, ymin1 = corners_horiz[0]
+ xmax1, ymax1 = corners_horiz[2]
+
+ if halign == 'center':
+ offsetx = (xmin1 + xmax1) / 2.0
+ elif halign == 'right':
+ offsetx = xmax1
+ else:
+ offsetx = xmin1
+
+ if valign == 'center':
+ offsety = (ymin1 + ymax1) / 2.0
+ elif valign == 'top':
+ offsety = ymax1
+ elif valign == 'baseline':
+ offsety = ymax1 - baseline
+ elif valign == 'center_baseline':
+ offsety = ymax1 - baseline / 2.0
+ else:
+ offsety = ymin1
+
+ offsetx, offsety = M.transform((offsetx, offsety))
+
+ xmin -= offsetx
+ ymin -= offsety
+
+ bbox = Bbox.from_bounds(xmin, ymin, width, height)
+
+ # now rotate the positions around the first (x, y) position
+ xys = M.transform(offset_layout) - (offsetx, offsety)
+
+ ret = bbox, list(zip(lines, zip(ws, hs), *xys.T)), descent
+ self._cached[key] = ret
+ return ret
+
+ def set_bbox(self, rectprops):
+ """
+ Draw a bounding box around self.
+
+ Parameters
+ ----------
+ rectprops : dict with properties for `.patches.FancyBboxPatch`
+ The default boxstyle is 'square'. The mutation
+ scale of the `.patches.FancyBboxPatch` is set to the fontsize.
+
+ Examples
+ --------
+ ::
+
+ t.set_bbox(dict(facecolor='red', alpha=0.5))
+ """
+
+ if rectprops is not None:
+ props = rectprops.copy()
+ boxstyle = props.pop("boxstyle", None)
+ pad = props.pop("pad", None)
+ if boxstyle is None:
+ boxstyle = "square"
+ if pad is None:
+ pad = 4 # points
+ pad /= self.get_size() # to fraction of font size
+ else:
+ if pad is None:
+ pad = 0.3
+ # boxstyle could be a callable or a string
+ if isinstance(boxstyle, str) and "pad" not in boxstyle:
+ boxstyle += ",pad=%0.2f" % pad
+ self._bbox_patch = FancyBboxPatch(
+ (0, 0), 1, 1,
+ boxstyle=boxstyle, transform=IdentityTransform(), **props)
+ else:
+ self._bbox_patch = None
+
+ self._update_clip_properties()
+
+ def get_bbox_patch(self):
+ """
+ Return the bbox Patch, or None if the `.patches.FancyBboxPatch`
+ is not made.
+ """
+ return self._bbox_patch
+
+ def update_bbox_position_size(self, renderer):
+ """
+ Update the location and the size of the bbox.
+
+ This method should be used when the position and size of the bbox needs
+ to be updated before actually drawing the bbox.
+ """
+ if self._bbox_patch:
+ # don't use self.get_unitless_position here, which refers to text
+ # position in Text:
+ posx = float(self.convert_xunits(self._x))
+ posy = float(self.convert_yunits(self._y))
+ posx, posy = self.get_transform().transform((posx, posy))
+
+ x_box, y_box, w_box, h_box = _get_textbox(self, renderer)
+ self._bbox_patch.set_bounds(0., 0., w_box, h_box)
+ self._bbox_patch.set_transform(
+ Affine2D()
+ .rotate_deg(self.get_rotation())
+ .translate(posx + x_box, posy + y_box))
+ fontsize_in_pixel = renderer.points_to_pixels(self.get_size())
+ self._bbox_patch.set_mutation_scale(fontsize_in_pixel)
+
+ def _update_clip_properties(self):
+ clipprops = dict(clip_box=self.clipbox,
+ clip_path=self._clippath,
+ clip_on=self._clipon)
+ if self._bbox_patch:
+ self._bbox_patch.update(clipprops)
+
+ def set_clip_box(self, clipbox):
+ # docstring inherited.
+ super().set_clip_box(clipbox)
+ self._update_clip_properties()
+
+ def set_clip_path(self, path, transform=None):
+ # docstring inherited.
+ super().set_clip_path(path, transform)
+ self._update_clip_properties()
+
+ def set_clip_on(self, b):
+ # docstring inherited.
+ super().set_clip_on(b)
+ self._update_clip_properties()
+
+ def get_wrap(self):
+ """Return whether the text can be wrapped."""
+ return self._wrap
+
+ def set_wrap(self, wrap):
+ """
+ Set whether the text can be wrapped.
+
+ Parameters
+ ----------
+ wrap : bool
+
+ Notes
+ -----
+ Wrapping does not work together with
+ ``savefig(..., bbox_inches='tight')`` (which is also used internally
+ by ``%matplotlib inline`` in IPython/Jupyter). The 'tight' setting
+ rescales the canvas to accommodate all content and happens before
+ wrapping.
+ """
+ self._wrap = wrap
+
+ def _get_wrap_line_width(self):
+ """
+ Return the maximum line width for wrapping text based on the current
+ orientation.
+ """
+ x0, y0 = self.get_transform().transform(self.get_position())
+ figure_box = self.get_figure().get_window_extent()
+
+ # Calculate available width based on text alignment
+ alignment = self.get_horizontalalignment()
+ self.set_rotation_mode('anchor')
+ rotation = self.get_rotation()
+
+ left = self._get_dist_to_box(rotation, x0, y0, figure_box)
+ right = self._get_dist_to_box(
+ (180 + rotation) % 360, x0, y0, figure_box)
+
+ if alignment == 'left':
+ line_width = left
+ elif alignment == 'right':
+ line_width = right
+ else:
+ line_width = 2 * min(left, right)
+
+ return line_width
+
+ def _get_dist_to_box(self, rotation, x0, y0, figure_box):
+ """
+ Return the distance from the given points to the boundaries of a
+ rotated box, in pixels.
+ """
+ if rotation > 270:
+ quad = rotation - 270
+ h1 = y0 / math.cos(math.radians(quad))
+ h2 = (figure_box.x1 - x0) / math.cos(math.radians(90 - quad))
+ elif rotation > 180:
+ quad = rotation - 180
+ h1 = x0 / math.cos(math.radians(quad))
+ h2 = y0 / math.cos(math.radians(90 - quad))
+ elif rotation > 90:
+ quad = rotation - 90
+ h1 = (figure_box.y1 - y0) / math.cos(math.radians(quad))
+ h2 = x0 / math.cos(math.radians(90 - quad))
+ else:
+ h1 = (figure_box.x1 - x0) / math.cos(math.radians(rotation))
+ h2 = (figure_box.y1 - y0) / math.cos(math.radians(90 - rotation))
+
+ return min(h1, h2)
+
+ def _get_rendered_text_width(self, text):
+ """
+ Return the width of a given text string, in pixels.
+ """
+ w, h, d = self._renderer.get_text_width_height_descent(
+ text,
+ self.get_fontproperties(),
+ False)
+ return math.ceil(w)
+
+ def _get_wrapped_text(self):
+ """
+ Return a copy of the text with new lines added, so that
+ the text is wrapped relative to the parent figure.
+ """
+ # Not fit to handle breaking up latex syntax correctly, so
+ # ignore latex for now.
+ if self.get_usetex():
+ return self.get_text()
+
+ # Build the line incrementally, for a more accurate measure of length
+ line_width = self._get_wrap_line_width()
+ wrapped_lines = []
+
+ # New lines in the user's text force a split
+ unwrapped_lines = self.get_text().split('\n')
+
+ # Now wrap each individual unwrapped line
+ for unwrapped_line in unwrapped_lines:
+
+ sub_words = unwrapped_line.split(' ')
+ # Remove items from sub_words as we go, so stop when empty
+ while len(sub_words) > 0:
+ if len(sub_words) == 1:
+ # Only one word, so just add it to the end
+ wrapped_lines.append(sub_words.pop(0))
+ continue
+
+ for i in range(2, len(sub_words) + 1):
+ # Get width of all words up to and including here
+ line = ' '.join(sub_words[:i])
+ current_width = self._get_rendered_text_width(line)
+
+ # If all these words are too wide, append all not including
+ # last word
+ if current_width > line_width:
+ wrapped_lines.append(' '.join(sub_words[:i - 1]))
+ sub_words = sub_words[i - 1:]
+ break
+
+ # Otherwise if all words fit in the width, append them all
+ elif i == len(sub_words):
+ wrapped_lines.append(' '.join(sub_words[:i]))
+ sub_words = []
+ break
+
+ return '\n'.join(wrapped_lines)
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ # docstring inherited
+
+ if renderer is not None:
+ self._renderer = renderer
+ if not self.get_visible():
+ return
+ if self.get_text() == '':
+ return
+
+ renderer.open_group('text', self.get_gid())
+
+ with _wrap_text(self) as textobj:
+ bbox, info, descent = textobj._get_layout(renderer)
+ trans = textobj.get_transform()
+
+ # don't use textobj.get_position here, which refers to text
+ # position in Text:
+ posx = float(textobj.convert_xunits(textobj._x))
+ posy = float(textobj.convert_yunits(textobj._y))
+ posx, posy = trans.transform((posx, posy))
+ if not np.isfinite(posx) or not np.isfinite(posy):
+ _log.warning("posx and posy should be finite values")
+ return
+ canvasw, canvash = renderer.get_canvas_width_height()
+
+ # Update the location and size of the bbox
+ # (`.patches.FancyBboxPatch`), and draw it.
+ if textobj._bbox_patch:
+ self.update_bbox_position_size(renderer)
+ self._bbox_patch.draw(renderer)
+
+ gc = renderer.new_gc()
+ gc.set_foreground(textobj.get_color())
+ gc.set_alpha(textobj.get_alpha())
+ gc.set_url(textobj._url)
+ textobj._set_gc_clip(gc)
+
+ angle = textobj.get_rotation()
+
+ for line, wh, x, y in info:
+
+ mtext = textobj if len(info) == 1 else None
+ x = x + posx
+ y = y + posy
+ if renderer.flipy():
+ y = canvash - y
+ clean_line, ismath = textobj._preprocess_math(line)
+
+ if textobj.get_path_effects():
+ from matplotlib.patheffects import PathEffectRenderer
+ textrenderer = PathEffectRenderer(
+ textobj.get_path_effects(), renderer)
+ else:
+ textrenderer = renderer
+
+ if textobj.get_usetex():
+ textrenderer.draw_tex(gc, x, y, clean_line,
+ textobj._fontproperties, angle,
+ mtext=mtext)
+ else:
+ textrenderer.draw_text(gc, x, y, clean_line,
+ textobj._fontproperties, angle,
+ ismath=ismath, mtext=mtext)
+
+ gc.restore()
+ renderer.close_group('text')
+ self.stale = False
+
+ def get_color(self):
+ """Return the color of the text."""
+ return self._color
+
+ def get_fontproperties(self):
+ """Return the `.font_manager.FontProperties`."""
+ return self._fontproperties
+
+ def get_fontfamily(self):
+ """
+ Return the list of font families used for font lookup.
+
+ See Also
+ --------
+ .font_manager.FontProperties.get_family
+ """
+ return self._fontproperties.get_family()
+
+ def get_fontname(self):
+ """
+ Return the font name as a string.
+
+ See Also
+ --------
+ .font_manager.FontProperties.get_name
+ """
+ return self._fontproperties.get_name()
+
+ def get_fontstyle(self):
+ """
+ Return the font style as a string.
+
+ See Also
+ --------
+ .font_manager.FontProperties.get_style
+ """
+ return self._fontproperties.get_style()
+
+ def get_fontsize(self):
+ """
+ Return the font size as an integer.
+
+ See Also
+ --------
+ .font_manager.FontProperties.get_size_in_points
+ """
+ return self._fontproperties.get_size_in_points()
+
+ def get_fontvariant(self):
+ """
+ Return the font variant as a string.
+
+ See Also
+ --------
+ .font_manager.FontProperties.get_variant
+ """
+ return self._fontproperties.get_variant()
+
+ def get_fontweight(self):
+ """
+ Return the font weight as a string or a number.
+
+ See Also
+ --------
+ .font_manager.FontProperties.get_weight
+ """
+ return self._fontproperties.get_weight()
+
+ def get_stretch(self):
+ """
+ Return the font stretch as a string or a number.
+
+ See Also
+ --------
+ .font_manager.FontProperties.get_stretch
+ """
+ return self._fontproperties.get_stretch()
+
+ def get_horizontalalignment(self):
+ """
+ Return the horizontal alignment as a string. Will be one of
+ 'left', 'center' or 'right'.
+ """
+ return self._horizontalalignment
+
+ def get_unitless_position(self):
+ """Return the (x, y) unitless position of the text."""
+ # This will get the position with all unit information stripped away.
+ # This is here for convenience since it is done in several locations.
+ x = float(self.convert_xunits(self._x))
+ y = float(self.convert_yunits(self._y))
+ return x, y
+
+ def get_position(self):
+ """Return the (x, y) position of the text."""
+ # This should return the same data (possible unitized) as was
+ # specified with 'set_x' and 'set_y'.
+ return self._x, self._y
+
+ def get_prop_tup(self, renderer=None):
+ """
+ Return a hashable tuple of properties.
+
+ Not intended to be human readable, but useful for backends who
+ want to cache derived information about text (e.g., layouts) and
+ need to know if the text has changed.
+ """
+ x, y = self.get_unitless_position()
+ renderer = renderer or self._renderer
+ return (x, y, self.get_text(), self._color,
+ self._verticalalignment, self._horizontalalignment,
+ hash(self._fontproperties),
+ self._rotation, self._rotation_mode,
+ self._transform_rotates_text,
+ self.figure.dpi, weakref.ref(renderer),
+ self._linespacing
+ )
+
+ def get_text(self):
+ """Return the text string."""
+ return self._text
+
+ def get_verticalalignment(self):
+ """
+ Return the vertical alignment as a string. Will be one of
+ 'top', 'center', 'bottom', 'baseline' or 'center_baseline'.
+ """
+ return self._verticalalignment
+
+ def get_window_extent(self, renderer=None, dpi=None):
+ """
+ Return the `.Bbox` bounding the text, in display units.
+
+ In addition to being used internally, this is useful for specifying
+ clickable regions in a png file on a web page.
+
+ Parameters
+ ----------
+ renderer : Renderer, optional
+ A renderer is needed to compute the bounding box. If the artist
+ has already been drawn, the renderer is cached; thus, it is only
+ necessary to pass this argument when calling `get_window_extent`
+ before the first `draw`. In practice, it is usually easier to
+ trigger a draw first (e.g. by saving the figure).
+
+ dpi : float, optional
+ The dpi value for computing the bbox, defaults to
+ ``self.figure.dpi`` (*not* the renderer dpi); should be set e.g. if
+ to match regions with a figure saved with a custom dpi value.
+ """
+ #return _unit_box
+ if not self.get_visible():
+ return Bbox.unit()
+ if dpi is None:
+ dpi = self.figure.dpi
+ if self.get_text() == '':
+ with cbook._setattr_cm(self.figure, dpi=dpi):
+ tx, ty = self._get_xy_display()
+ return Bbox.from_bounds(tx, ty, 0, 0)
+
+ if renderer is not None:
+ self._renderer = renderer
+ if self._renderer is None:
+ self._renderer = self.figure._cachedRenderer
+ if self._renderer is None:
+ raise RuntimeError('Cannot get window extent w/o renderer')
+
+ with cbook._setattr_cm(self.figure, dpi=dpi):
+ bbox, info, descent = self._get_layout(self._renderer)
+ x, y = self.get_unitless_position()
+ x, y = self.get_transform().transform((x, y))
+ bbox = bbox.translated(x, y)
+ return bbox
+
+ def set_backgroundcolor(self, color):
+ """
+ Set the background color of the text by updating the bbox.
+
+ Parameters
+ ----------
+ color : color
+
+ See Also
+ --------
+ .set_bbox : To change the position of the bounding box
+ """
+ if self._bbox_patch is None:
+ self.set_bbox(dict(facecolor=color, edgecolor=color))
+ else:
+ self._bbox_patch.update(dict(facecolor=color))
+
+ self._update_clip_properties()
+ self.stale = True
+
+ def set_color(self, color):
+ """
+ Set the foreground color of the text
+
+ Parameters
+ ----------
+ color : color
+ """
+ # "auto" is only supported by axisartist, but we can just let it error
+ # out at draw time for simplicity.
+ if not cbook._str_equal(color, "auto"):
+ mpl.colors._check_color_like(color=color)
+ # Make sure it is hashable, or get_prop_tup will fail.
+ try:
+ hash(color)
+ except TypeError:
+ color = tuple(color)
+ self._color = color
+ self.stale = True
+
+ def set_horizontalalignment(self, align):
+ """
+ Set the horizontal alignment to one of
+
+ Parameters
+ ----------
+ align : {'center', 'right', 'left'}
+ """
+ _api.check_in_list(['center', 'right', 'left'], align=align)
+ self._horizontalalignment = align
+ self.stale = True
+
+ def set_multialignment(self, align):
+ """
+ Set the text alignment for multiline texts.
+
+ The layout of the bounding box of all the lines is determined by the
+ horizontalalignment and verticalalignment properties. This property
+ controls the alignment of the text lines within that box.
+
+ Parameters
+ ----------
+ align : {'left', 'right', 'center'}
+ """
+ _api.check_in_list(['center', 'right', 'left'], align=align)
+ self._multialignment = align
+ self.stale = True
+
+ def set_linespacing(self, spacing):
+ """
+ Set the line spacing as a multiple of the font size.
+
+ The default line spacing is 1.2.
+
+ Parameters
+ ----------
+ spacing : float (multiple of font size)
+ """
+ self._linespacing = spacing
+ self.stale = True
+
+ def set_fontfamily(self, fontname):
+ """
+ Set the font family. May be either a single string, or a list of
+ strings in decreasing priority. Each string may be either a real font
+ name or a generic font class name. If the latter, the specific font
+ names will be looked up in the corresponding rcParams.
+
+ If a `Text` instance is constructed with ``fontfamily=None``, then the
+ font is set to :rc:`font.family`, and the
+ same is done when `set_fontfamily()` is called on an existing
+ `Text` instance.
+
+ Parameters
+ ----------
+ fontname : {FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', \
+'monospace'}
+
+ See Also
+ --------
+ .font_manager.FontProperties.set_family
+ """
+ self._fontproperties.set_family(fontname)
+ self.stale = True
+
+ def set_fontvariant(self, variant):
+ """
+ Set the font variant.
+
+ Parameters
+ ----------
+ variant : {'normal', 'small-caps'}
+
+ See Also
+ --------
+ .font_manager.FontProperties.set_variant
+ """
+ self._fontproperties.set_variant(variant)
+ self.stale = True
+
+ def set_fontstyle(self, fontstyle):
+ """
+ Set the font style.
+
+ Parameters
+ ----------
+ fontstyle : {'normal', 'italic', 'oblique'}
+
+ See Also
+ --------
+ .font_manager.FontProperties.set_style
+ """
+ self._fontproperties.set_style(fontstyle)
+ self.stale = True
+
+ def set_fontsize(self, fontsize):
+ """
+ Set the font size.
+
+ Parameters
+ ----------
+ fontsize : float or {'xx-small', 'x-small', 'small', 'medium', \
+'large', 'x-large', 'xx-large'}
+ If float, the fontsize in points. The string values denote sizes
+ relative to the default font size.
+
+ See Also
+ --------
+ .font_manager.FontProperties.set_size
+ """
+ self._fontproperties.set_size(fontsize)
+ self.stale = True
+
+ def get_math_fontfamily(self):
+ """
+ Return the font family name for math text rendered by Matplotlib.
+
+ The default value is :rc:`mathtext.fontset`.
+
+ See Also
+ --------
+ set_math_fontfamily
+ """
+ return self._fontproperties.get_math_fontfamily()
+
+ def set_math_fontfamily(self, fontfamily):
+ """
+ Set the font family for math text rendered by Matplotlib.
+
+ This does only affect Matplotlib's own math renderer. It has no effect
+ when rendering with TeX (``usetex=True``).
+
+ Parameters
+ ----------
+ fontfamily : str
+ The name of the font family.
+
+ Available font families are defined in the
+ :ref:`matplotlibrc.template file
+ `.
+
+ See Also
+ --------
+ get_math_fontfamily
+ """
+ self._fontproperties.set_math_fontfamily(fontfamily)
+
+ def set_fontweight(self, weight):
+ """
+ Set the font weight.
+
+ Parameters
+ ----------
+ weight : {a numeric value in range 0-1000, 'ultralight', 'light', \
+'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', \
+'demi', 'bold', 'heavy', 'extra bold', 'black'}
+
+ See Also
+ --------
+ .font_manager.FontProperties.set_weight
+ """
+ self._fontproperties.set_weight(weight)
+ self.stale = True
+
+ def set_fontstretch(self, stretch):
+ """
+ Set the font stretch (horizontal condensation or expansion).
+
+ Parameters
+ ----------
+ stretch : {a numeric value in range 0-1000, 'ultra-condensed', \
+'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', \
+'expanded', 'extra-expanded', 'ultra-expanded'}
+
+ See Also
+ --------
+ .font_manager.FontProperties.set_stretch
+ """
+ self._fontproperties.set_stretch(stretch)
+ self.stale = True
+
+ def set_position(self, xy):
+ """
+ Set the (*x*, *y*) position of the text.
+
+ Parameters
+ ----------
+ xy : (float, float)
+ """
+ self.set_x(xy[0])
+ self.set_y(xy[1])
+
+ def set_x(self, x):
+ """
+ Set the *x* position of the text.
+
+ Parameters
+ ----------
+ x : float
+ """
+ self._x = x
+ self.stale = True
+
+ def set_y(self, y):
+ """
+ Set the *y* position of the text.
+
+ Parameters
+ ----------
+ y : float
+ """
+ self._y = y
+ self.stale = True
+
+ def set_rotation(self, s):
+ """
+ Set the rotation of the text.
+
+ Parameters
+ ----------
+ s : float or {'vertical', 'horizontal'}
+ The rotation angle in degrees in mathematically positive direction
+ (counterclockwise). 'horizontal' equals 0, 'vertical' equals 90.
+ """
+ self._rotation = s
+ self.stale = True
+
+ def set_transform_rotates_text(self, t):
+ """
+ Whether rotations of the transform affect the text direction.
+
+ Parameters
+ ----------
+ t : bool
+ """
+ self._transform_rotates_text = t
+ self.stale = True
+
+ def set_verticalalignment(self, align):
+ """
+ Set the vertical alignment.
+
+ Parameters
+ ----------
+ align : {'center', 'top', 'bottom', 'baseline', 'center_baseline'}
+ """
+ _api.check_in_list(
+ ['top', 'bottom', 'center', 'baseline', 'center_baseline'],
+ align=align)
+ self._verticalalignment = align
+ self.stale = True
+
+ def set_text(self, s):
+ r"""
+ Set the text string *s*.
+
+ It may contain newlines (``\n``) or math in LaTeX syntax.
+
+ Parameters
+ ----------
+ s : object
+ Any object gets converted to its `str` representation, except for
+ ``None`` which is converted to an empty string.
+ """
+ if s is None:
+ s = ''
+ if s != self._text:
+ self._text = str(s)
+ self.stale = True
+
+ def _preprocess_math(self, s):
+ """
+ Return the string *s* after mathtext preprocessing, and the kind of
+ mathtext support needed.
+
+ - If *self* is configured to use TeX, return *s* unchanged except that
+ a single space gets escaped, and the flag "TeX".
+ - Otherwise, if *s* is mathtext (has an even number of unescaped dollar
+ signs), return *s* and the flag True.
+ - Otherwise, return *s* with dollar signs unescaped, and the flag
+ False.
+ """
+ if self.get_usetex():
+ if s == " ":
+ s = r"\ "
+ return s, "TeX"
+ elif cbook.is_math_text(s):
+ return s, True
+ else:
+ return s.replace(r"\$", "$"), False
+
+ def set_fontproperties(self, fp):
+ """
+ Set the font properties that control the text.
+
+ Parameters
+ ----------
+ fp : `.font_manager.FontProperties` or `str` or `pathlib.Path`
+ If a `str`, it is interpreted as a fontconfig pattern parsed by
+ `.FontProperties`. If a `pathlib.Path`, it is interpreted as the
+ absolute path to a font file.
+ """
+ self._fontproperties = FontProperties._from_any(fp).copy()
+ self.stale = True
+
+ def set_usetex(self, usetex):
+ """
+ Parameters
+ ----------
+ usetex : bool or None
+ Whether to render using TeX, ``None`` means to use
+ :rc:`text.usetex`.
+ """
+ if usetex is None:
+ self._usetex = mpl.rcParams['text.usetex']
+ else:
+ self._usetex = bool(usetex)
+ self.stale = True
+
+ def get_usetex(self):
+ """Return whether this `Text` object uses TeX for rendering."""
+ return self._usetex
+
+ def set_fontname(self, fontname):
+ """
+ Alias for `set_family`.
+
+ One-way alias only: the getter differs.
+
+ Parameters
+ ----------
+ fontname : {FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', \
+'monospace'}
+
+ See Also
+ --------
+ .font_manager.FontProperties.set_family
+
+ """
+ return self.set_family(fontname)
+
+
+docstring.interpd.update(Text_kwdoc=artist.kwdoc(Text))
+docstring.dedent_interpd(Text.__init__)
+
+
+class OffsetFrom:
+ """Callable helper class for working with `Annotation`."""
+
+ def __init__(self, artist, ref_coord, unit="points"):
+ """
+ Parameters
+ ----------
+ artist : `.Artist` or `.BboxBase` or `.Transform`
+ The object to compute the offset from.
+
+ ref_coord : (float, float)
+ If *artist* is an `.Artist` or `.BboxBase`, this values is
+ the location to of the offset origin in fractions of the
+ *artist* bounding box.
+
+ If *artist* is a transform, the offset origin is the
+ transform applied to this value.
+
+ unit : {'points, 'pixels'}, default: 'points'
+ The screen units to use (pixels or points) for the offset input.
+ """
+ self._artist = artist
+ self._ref_coord = ref_coord
+ self.set_unit(unit)
+
+ def set_unit(self, unit):
+ """
+ Set the unit for input to the transform used by ``__call__``.
+
+ Parameters
+ ----------
+ unit : {'points', 'pixels'}
+ """
+ _api.check_in_list(["points", "pixels"], unit=unit)
+ self._unit = unit
+
+ def get_unit(self):
+ """Return the unit for input to the transform used by ``__call__``."""
+ return self._unit
+
+ def _get_scale(self, renderer):
+ unit = self.get_unit()
+ if unit == "pixels":
+ return 1.
+ else:
+ return renderer.points_to_pixels(1.)
+
+ def __call__(self, renderer):
+ """
+ Return the offset transform.
+
+ Parameters
+ ----------
+ renderer : `RendererBase`
+ The renderer to use to compute the offset
+
+ Returns
+ -------
+ `Transform`
+ Maps (x, y) in pixel or point units to screen units
+ relative to the given artist.
+ """
+ if isinstance(self._artist, Artist):
+ bbox = self._artist.get_window_extent(renderer)
+ xf, yf = self._ref_coord
+ x = bbox.x0 + bbox.width * xf
+ y = bbox.y0 + bbox.height * yf
+ elif isinstance(self._artist, BboxBase):
+ bbox = self._artist
+ xf, yf = self._ref_coord
+ x = bbox.x0 + bbox.width * xf
+ y = bbox.y0 + bbox.height * yf
+ elif isinstance(self._artist, Transform):
+ x, y = self._artist.transform(self._ref_coord)
+ else:
+ raise RuntimeError("unknown type")
+
+ sc = self._get_scale(renderer)
+ tr = Affine2D().scale(sc).translate(x, y)
+
+ return tr
+
+
+class _AnnotationBase:
+ def __init__(self,
+ xy,
+ xycoords='data',
+ annotation_clip=None):
+
+ self.xy = xy
+ self.xycoords = xycoords
+ self.set_annotation_clip(annotation_clip)
+
+ self._draggable = None
+
+ def _get_xy(self, renderer, x, y, s):
+ if isinstance(s, tuple):
+ s1, s2 = s
+ else:
+ s1, s2 = s, s
+ if s1 == 'data':
+ x = float(self.convert_xunits(x))
+ if s2 == 'data':
+ y = float(self.convert_yunits(y))
+ return self._get_xy_transform(renderer, s).transform((x, y))
+
+ def _get_xy_transform(self, renderer, s):
+
+ if isinstance(s, tuple):
+ s1, s2 = s
+ from matplotlib.transforms import blended_transform_factory
+ tr1 = self._get_xy_transform(renderer, s1)
+ tr2 = self._get_xy_transform(renderer, s2)
+ tr = blended_transform_factory(tr1, tr2)
+ return tr
+ elif callable(s):
+ tr = s(renderer)
+ if isinstance(tr, BboxBase):
+ return BboxTransformTo(tr)
+ elif isinstance(tr, Transform):
+ return tr
+ else:
+ raise RuntimeError("unknown return type ...")
+ elif isinstance(s, Artist):
+ bbox = s.get_window_extent(renderer)
+ return BboxTransformTo(bbox)
+ elif isinstance(s, BboxBase):
+ return BboxTransformTo(s)
+ elif isinstance(s, Transform):
+ return s
+ elif not isinstance(s, str):
+ raise RuntimeError("unknown coordinate type : %s" % s)
+
+ if s == 'data':
+ return self.axes.transData
+ elif s == 'polar':
+ from matplotlib.projections import PolarAxes
+ tr = PolarAxes.PolarTransform()
+ trans = tr + self.axes.transData
+ return trans
+
+ s_ = s.split()
+ if len(s_) != 2:
+ raise ValueError("%s is not a recognized coordinate" % s)
+
+ bbox0, xy0 = None, None
+
+ bbox_name, unit = s_
+ # if unit is offset-like
+ if bbox_name == "figure":
+ bbox0 = self.figure.figbbox
+ elif bbox_name == "subfigure":
+ bbox0 = self.figure.bbox
+ elif bbox_name == "axes":
+ bbox0 = self.axes.bbox
+ # elif bbox_name == "bbox":
+ # if bbox is None:
+ # raise RuntimeError("bbox is specified as a coordinate but "
+ # "never set")
+ # bbox0 = self._get_bbox(renderer, bbox)
+
+ if bbox0 is not None:
+ xy0 = bbox0.p0
+ elif bbox_name == "offset":
+ xy0 = self._get_ref_xy(renderer)
+
+ if xy0 is not None:
+ # reference x, y in display coordinate
+ ref_x, ref_y = xy0
+ if unit == "points":
+ # dots per points
+ dpp = self.figure.get_dpi() / 72.
+ tr = Affine2D().scale(dpp)
+ elif unit == "pixels":
+ tr = Affine2D()
+ elif unit == "fontsize":
+ fontsize = self.get_size()
+ dpp = fontsize * self.figure.get_dpi() / 72.
+ tr = Affine2D().scale(dpp)
+ elif unit == "fraction":
+ w, h = bbox0.size
+ tr = Affine2D().scale(w, h)
+ else:
+ raise ValueError("%s is not a recognized coordinate" % s)
+
+ return tr.translate(ref_x, ref_y)
+
+ else:
+ raise ValueError("%s is not a recognized coordinate" % s)
+
+ def _get_ref_xy(self, renderer):
+ """
+ Return x, y (in display coordinates) that is to be used for a reference
+ of any offset coordinate.
+ """
+ return self._get_xy(renderer, *self.xy, self.xycoords)
+
+ # def _get_bbox(self, renderer):
+ # if hasattr(bbox, "bounds"):
+ # return bbox
+ # elif hasattr(bbox, "get_window_extent"):
+ # bbox = bbox.get_window_extent()
+ # return bbox
+ # else:
+ # raise ValueError("A bbox instance is expected but got %s" %
+ # str(bbox))
+
+ def set_annotation_clip(self, b):
+ """
+ Set the annotation's clipping behavior.
+
+ Parameters
+ ----------
+ b : bool or None
+ - True: the annotation will only be drawn when ``self.xy`` is
+ inside the axes.
+ - False: the annotation will always be drawn regardless of its
+ position.
+ - None: the ``self.xy`` will be checked only if *xycoords* is
+ "data".
+ """
+ self._annotation_clip = b
+
+ def get_annotation_clip(self):
+ """
+ Return the annotation's clipping behavior.
+
+ See `set_annotation_clip` for the meaning of return values.
+ """
+ return self._annotation_clip
+
+ def _get_position_xy(self, renderer):
+ """Return the pixel position of the annotated point."""
+ x, y = self.xy
+ return self._get_xy(renderer, x, y, self.xycoords)
+
+ def _check_xy(self, renderer):
+ """Check whether the annotation at *xy_pixel* should be drawn."""
+ b = self.get_annotation_clip()
+ if b or (b is None and self.xycoords == "data"):
+ # check if self.xy is inside the axes.
+ xy_pixel = self._get_position_xy(renderer)
+ return self.axes.contains_point(xy_pixel)
+ return True
+
+ def draggable(self, state=None, use_blit=False):
+ """
+ Set whether the annotation is draggable with the mouse.
+
+ Parameters
+ ----------
+ state : bool or None
+ - True or False: set the draggability.
+ - None: toggle the draggability.
+
+ Returns
+ -------
+ DraggableAnnotation or None
+ If the annotation is draggable, the corresponding
+ `.DraggableAnnotation` helper is returned.
+ """
+ from matplotlib.offsetbox import DraggableAnnotation
+ is_draggable = self._draggable is not None
+
+ # if state is None we'll toggle
+ if state is None:
+ state = not is_draggable
+
+ if state:
+ if self._draggable is None:
+ self._draggable = DraggableAnnotation(self, use_blit)
+ else:
+ if self._draggable is not None:
+ self._draggable.disconnect()
+ self._draggable = None
+
+ return self._draggable
+
+
+class Annotation(Text, _AnnotationBase):
+ """
+ An `.Annotation` is a `.Text` that can refer to a specific position *xy*.
+ Optionally an arrow pointing from the text to *xy* can be drawn.
+
+ Attributes
+ ----------
+ xy
+ The annotated position.
+ xycoords
+ The coordinate system for *xy*.
+ arrow_patch
+ A `.FancyArrowPatch` to point from *xytext* to *xy*.
+ """
+
+ def __str__(self):
+ return "Annotation(%g, %g, %r)" % (self.xy[0], self.xy[1], self._text)
+
+ def __init__(self, text, xy,
+ xytext=None,
+ xycoords='data',
+ textcoords=None,
+ arrowprops=None,
+ annotation_clip=None,
+ **kwargs):
+ """
+ Annotate the point *xy* with text *text*.
+
+ In the simplest form, the text is placed at *xy*.
+
+ Optionally, the text can be displayed in another position *xytext*.
+ An arrow pointing from the text to the annotated point *xy* can then
+ be added by defining *arrowprops*.
+
+ Parameters
+ ----------
+ text : str
+ The text of the annotation.
+
+ xy : (float, float)
+ The point *(x, y)* to annotate. The coordinate system is determined
+ by *xycoords*.
+
+ xytext : (float, float), default: *xy*
+ The position *(x, y)* to place the text at. The coordinate system
+ is determined by *textcoords*.
+
+ xycoords : str or `.Artist` or `.Transform` or callable or \
+(float, float), default: 'data'
+
+ The coordinate system that *xy* is given in. The following types
+ of values are supported:
+
+ - One of the following strings:
+
+ ==================== ============================================
+ Value Description
+ ==================== ============================================
+ 'figure points' Points from the lower left of the figure
+ 'figure pixels' Pixels from the lower left of the figure
+ 'figure fraction' Fraction of figure from lower left
+ 'subfigure points' Points from the lower left of the subfigure
+ 'subfigure pixels' Pixels from the lower left of the subfigure
+ 'subfigure fraction' Fraction of subfigure from lower left
+ 'axes points' Points from lower left corner of axes
+ 'axes pixels' Pixels from lower left corner of axes
+ 'axes fraction' Fraction of axes from lower left
+ 'data' Use the coordinate system of the object
+ being annotated (default)
+ 'polar' *(theta, r)* if not native 'data'
+ coordinates
+ ==================== ============================================
+
+ Note that 'subfigure pixels' and 'figure pixels' are the same
+ for the parent figure, so users who want code that is usable in
+ a subfigure can use 'subfigure pixels'.
+
+ - An `.Artist`: *xy* is interpreted as a fraction of the artist's
+ `~matplotlib.transforms.Bbox`. E.g. *(0, 0)* would be the lower
+ left corner of the bounding box and *(0.5, 1)* would be the
+ center top of the bounding box.
+
+ - A `.Transform` to transform *xy* to screen coordinates.
+
+ - A function with one of the following signatures::
+
+ def transform(renderer) -> Bbox
+ def transform(renderer) -> Transform
+
+ where *renderer* is a `.RendererBase` subclass.
+
+ The result of the function is interpreted like the `.Artist` and
+ `.Transform` cases above.
+
+ - A tuple *(xcoords, ycoords)* specifying separate coordinate
+ systems for *x* and *y*. *xcoords* and *ycoords* must each be
+ of one of the above described types.
+
+ See :ref:`plotting-guide-annotation` for more details.
+
+ textcoords : str or `.Artist` or `.Transform` or callable or \
+(float, float), default: value of *xycoords*
+ The coordinate system that *xytext* is given in.
+
+ All *xycoords* values are valid as well as the following
+ strings:
+
+ ================= =========================================
+ Value Description
+ ================= =========================================
+ 'offset points' Offset (in points) from the *xy* value
+ 'offset pixels' Offset (in pixels) from the *xy* value
+ ================= =========================================
+
+ arrowprops : dict, optional
+ The properties used to draw a `.FancyArrowPatch` arrow between the
+ positions *xy* and *xytext*. Note that the edge of the arrow
+ pointing to *xytext* will be centered on the text itself and may
+ not point directly to the coordinates given in *xytext*.
+
+ If *arrowprops* does not contain the key 'arrowstyle' the
+ allowed keys are:
+
+ ========== ======================================================
+ Key Description
+ ========== ======================================================
+ width The width of the arrow in points
+ headwidth The width of the base of the arrow head in points
+ headlength The length of the arrow head in points
+ shrink Fraction of total length to shrink from both ends
+ ? Any key to :class:`matplotlib.patches.FancyArrowPatch`
+ ========== ======================================================
+
+ If *arrowprops* contains the key 'arrowstyle' the
+ above keys are forbidden. The allowed values of
+ ``'arrowstyle'`` are:
+
+ ============ =============================================
+ Name Attrs
+ ============ =============================================
+ ``'-'`` None
+ ``'->'`` head_length=0.4,head_width=0.2
+ ``'-['`` widthB=1.0,lengthB=0.2,angleB=None
+ ``'|-|'`` widthA=1.0,widthB=1.0
+ ``'-|>'`` head_length=0.4,head_width=0.2
+ ``'<-'`` head_length=0.4,head_width=0.2
+ ``'<->'`` head_length=0.4,head_width=0.2
+ ``'<|-'`` head_length=0.4,head_width=0.2
+ ``'<|-|>'`` head_length=0.4,head_width=0.2
+ ``'fancy'`` head_length=0.4,head_width=0.4,tail_width=0.4
+ ``'simple'`` head_length=0.5,head_width=0.5,tail_width=0.2
+ ``'wedge'`` tail_width=0.3,shrink_factor=0.5
+ ============ =============================================
+
+ Valid keys for `~matplotlib.patches.FancyArrowPatch` are:
+
+ =============== ==================================================
+ Key Description
+ =============== ==================================================
+ arrowstyle the arrow style
+ connectionstyle the connection style
+ relpos default is (0.5, 0.5)
+ patchA default is bounding box of the text
+ patchB default is None
+ shrinkA default is 2 points
+ shrinkB default is 2 points
+ mutation_scale default is text size (in points)
+ mutation_aspect default is 1.
+ ? any key for :class:`matplotlib.patches.PathPatch`
+ =============== ==================================================
+
+ Defaults to None, i.e. no arrow is drawn.
+
+ annotation_clip : bool or None, default: None
+ Whether to draw the annotation when the annotation point *xy* is
+ outside the axes area.
+
+ - If *True*, the annotation will only be drawn when *xy* is
+ within the axes.
+ - If *False*, the annotation will always be drawn.
+ - If *None*, the annotation will only be drawn when *xy* is
+ within the axes and *xycoords* is 'data'.
+
+ **kwargs
+ Additional kwargs are passed to `~matplotlib.text.Text`.
+
+ Returns
+ -------
+ `.Annotation`
+
+ See Also
+ --------
+ :ref:`plotting-guide-annotation`
+
+ """
+ _AnnotationBase.__init__(self,
+ xy,
+ xycoords=xycoords,
+ annotation_clip=annotation_clip)
+ # warn about wonky input data
+ if (xytext is None and
+ textcoords is not None and
+ textcoords != xycoords):
+ _api.warn_external("You have used the `textcoords` kwarg, but "
+ "not the `xytext` kwarg. This can lead to "
+ "surprising results.")
+
+ # clean up textcoords and assign default
+ if textcoords is None:
+ textcoords = self.xycoords
+ self._textcoords = textcoords
+
+ # cleanup xytext defaults
+ if xytext is None:
+ xytext = self.xy
+ x, y = xytext
+
+ self.arrowprops = arrowprops
+ if arrowprops is not None:
+ arrowprops = arrowprops.copy()
+ if "arrowstyle" in arrowprops:
+ self._arrow_relpos = arrowprops.pop("relpos", (0.5, 0.5))
+ else:
+ # modified YAArrow API to be used with FancyArrowPatch
+ for key in [
+ 'width', 'headwidth', 'headlength', 'shrink', 'frac']:
+ arrowprops.pop(key, None)
+ self.arrow_patch = FancyArrowPatch((0, 0), (1, 1), **arrowprops)
+ else:
+ self.arrow_patch = None
+
+ # Must come last, as some kwargs may be propagated to arrow_patch.
+ Text.__init__(self, x, y, text, **kwargs)
+
+ def contains(self, event):
+ inside, info = self._default_contains(event)
+ if inside is not None:
+ return inside, info
+ contains, tinfo = Text.contains(self, event)
+ if self.arrow_patch is not None:
+ in_patch, _ = self.arrow_patch.contains(event)
+ contains = contains or in_patch
+ return contains, tinfo
+
+ @property
+ def xycoords(self):
+ return self._xycoords
+
+ @xycoords.setter
+ def xycoords(self, xycoords):
+ def is_offset(s):
+ return isinstance(s, str) and s.startswith("offset")
+
+ if (isinstance(xycoords, tuple) and any(map(is_offset, xycoords))
+ or is_offset(xycoords)):
+ raise ValueError("xycoords cannot be an offset coordinate")
+ self._xycoords = xycoords
+
+ @property
+ def xyann(self):
+ """
+ The text position.
+
+ See also *xytext* in `.Annotation`.
+ """
+ return self.get_position()
+
+ @xyann.setter
+ def xyann(self, xytext):
+ self.set_position(xytext)
+
+ def get_anncoords(self):
+ """
+ Return the coordinate system to use for `.Annotation.xyann`.
+
+ See also *xycoords* in `.Annotation`.
+ """
+ return self._textcoords
+
+ def set_anncoords(self, coords):
+ """
+ Set the coordinate system to use for `.Annotation.xyann`.
+
+ See also *xycoords* in `.Annotation`.
+ """
+ self._textcoords = coords
+
+ anncoords = property(get_anncoords, set_anncoords, doc="""
+ The coordinate system to use for `.Annotation.xyann`.""")
+
+ def set_figure(self, fig):
+ # docstring inherited
+ if self.arrow_patch is not None:
+ self.arrow_patch.set_figure(fig)
+ Artist.set_figure(self, fig)
+
+ def update_positions(self, renderer):
+ """
+ Update the pixel positions of the annotation text and the arrow patch.
+ """
+ x1, y1 = self._get_position_xy(renderer) # Annotated position.
+ # generate transformation,
+ self.set_transform(self._get_xy_transform(renderer, self.anncoords))
+
+ if self.arrowprops is None:
+ return
+
+ bbox = Text.get_window_extent(self, renderer)
+
+ d = self.arrowprops.copy()
+ ms = d.pop("mutation_scale", self.get_size())
+ self.arrow_patch.set_mutation_scale(ms)
+
+ if "arrowstyle" not in d:
+ # Approximately simulate the YAArrow.
+ # Pop its kwargs:
+ shrink = d.pop('shrink', 0.0)
+ width = d.pop('width', 4)
+ headwidth = d.pop('headwidth', 12)
+ # Ignore frac--it is useless.
+ frac = d.pop('frac', None)
+ if frac is not None:
+ _api.warn_external(
+ "'frac' option in 'arrowprops' is no longer supported;"
+ " use 'headlength' to set the head length in points.")
+ headlength = d.pop('headlength', 12)
+
+ # NB: ms is in pts
+ stylekw = dict(head_length=headlength / ms,
+ head_width=headwidth / ms,
+ tail_width=width / ms)
+
+ self.arrow_patch.set_arrowstyle('simple', **stylekw)
+
+ # using YAArrow style:
+ # pick the corner of the text bbox closest to annotated point.
+ xpos = [(bbox.x0, 0), ((bbox.x0 + bbox.x1) / 2, 0.5), (bbox.x1, 1)]
+ ypos = [(bbox.y0, 0), ((bbox.y0 + bbox.y1) / 2, 0.5), (bbox.y1, 1)]
+ x, relposx = min(xpos, key=lambda v: abs(v[0] - x1))
+ y, relposy = min(ypos, key=lambda v: abs(v[0] - y1))
+ self._arrow_relpos = (relposx, relposy)
+ r = np.hypot(y - y1, x - x1)
+ shrink_pts = shrink * r / renderer.points_to_pixels(1)
+ self.arrow_patch.shrinkA = self.arrow_patch.shrinkB = shrink_pts
+
+ # adjust the starting point of the arrow relative to the textbox.
+ # TODO : Rotation needs to be accounted.
+ relposx, relposy = self._arrow_relpos
+ x0 = bbox.x0 + bbox.width * relposx
+ y0 = bbox.y0 + bbox.height * relposy
+
+ # The arrow will be drawn from (x0, y0) to (x1, y1). It will be first
+ # clipped by patchA and patchB. Then it will be shrunk by shrinkA and
+ # shrinkB (in points). If patch A is not set, self.bbox_patch is used.
+ self.arrow_patch.set_positions((x0, y0), (x1, y1))
+
+ if "patchA" in d:
+ self.arrow_patch.set_patchA(d.pop("patchA"))
+ else:
+ if self._bbox_patch:
+ self.arrow_patch.set_patchA(self._bbox_patch)
+ else:
+ if self.get_text() == "":
+ self.arrow_patch.set_patchA(None)
+ return
+ pad = renderer.points_to_pixels(4)
+ r = Rectangle(xy=(bbox.x0 - pad / 2, bbox.y0 - pad / 2),
+ width=bbox.width + pad, height=bbox.height + pad,
+ transform=IdentityTransform(), clip_on=False)
+ self.arrow_patch.set_patchA(r)
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ # docstring inherited
+ if renderer is not None:
+ self._renderer = renderer
+ if not self.get_visible() or not self._check_xy(renderer):
+ return
+ # Update text positions before `Text.draw` would, so that the
+ # FancyArrowPatch is correctly positioned.
+ self.update_positions(renderer)
+ self.update_bbox_position_size(renderer)
+ if self.arrow_patch is not None: # FancyArrowPatch
+ if self.arrow_patch.figure is None and self.figure is not None:
+ self.arrow_patch.figure = self.figure
+ self.arrow_patch.draw(renderer)
+ # Draw text, including FancyBboxPatch, after FancyArrowPatch.
+ # Otherwise, a wedge arrowstyle can land partly on top of the Bbox.
+ Text.draw(self, renderer)
+
+ def get_window_extent(self, renderer=None):
+ """
+ Return the `.Bbox` bounding the text and arrow, in display units.
+
+ Parameters
+ ----------
+ renderer : Renderer, optional
+ A renderer is needed to compute the bounding box. If the artist
+ has already been drawn, the renderer is cached; thus, it is only
+ necessary to pass this argument when calling `get_window_extent`
+ before the first `draw`. In practice, it is usually easier to
+ trigger a draw first (e.g. by saving the figure).
+ """
+ # This block is the same as in Text.get_window_extent, but we need to
+ # set the renderer before calling update_positions().
+ if not self.get_visible() or not self._check_xy(renderer):
+ return Bbox.unit()
+ if renderer is not None:
+ self._renderer = renderer
+ if self._renderer is None:
+ self._renderer = self.figure._cachedRenderer
+ if self._renderer is None:
+ raise RuntimeError('Cannot get window extent w/o renderer')
+
+ self.update_positions(self._renderer)
+
+ text_bbox = Text.get_window_extent(self)
+ bboxes = [text_bbox]
+
+ if self.arrow_patch is not None:
+ bboxes.append(self.arrow_patch.get_window_extent())
+
+ return Bbox.union(bboxes)
+
+ def get_tightbbox(self, renderer):
+ # docstring inherited
+ if not self._check_xy(renderer):
+ return Bbox.null()
+ return super().get_tightbbox(renderer)
+
+
+docstring.interpd.update(Annotation=Annotation.__init__.__doc__)
diff --git a/venv/Lib/site-packages/matplotlib/textpath.py b/venv/Lib/site-packages/matplotlib/textpath.py
new file mode 100644
index 0000000..424d4df
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/textpath.py
@@ -0,0 +1,430 @@
+from collections import OrderedDict
+import functools
+import logging
+import urllib.parse
+
+import numpy as np
+
+from matplotlib import _text_layout, dviread, font_manager, rcParams
+from matplotlib.font_manager import FontProperties, get_font
+from matplotlib.ft2font import LOAD_NO_HINTING, LOAD_TARGET_LIGHT
+from matplotlib.mathtext import MathTextParser
+from matplotlib.path import Path
+from matplotlib.transforms import Affine2D
+
+_log = logging.getLogger(__name__)
+
+
+class TextToPath:
+ """A class that converts strings to paths."""
+
+ FONT_SCALE = 100.
+ DPI = 72
+
+ def __init__(self):
+ self.mathtext_parser = MathTextParser('path')
+ self._texmanager = None
+
+ def _get_font(self, prop):
+ """
+ Find the `FT2Font` matching font properties *prop*, with its size set.
+ """
+ fname = font_manager.findfont(prop)
+ font = get_font(fname)
+ font.set_size(self.FONT_SCALE, self.DPI)
+ return font
+
+ def _get_hinting_flag(self):
+ return LOAD_NO_HINTING
+
+ def _get_char_id(self, font, ccode):
+ """
+ Return a unique id for the given font and character-code set.
+ """
+ return urllib.parse.quote(f"{font.postscript_name}-{ccode:x}")
+
+ def get_text_width_height_descent(self, s, prop, ismath):
+ if ismath == "TeX":
+ texmanager = self.get_texmanager()
+ fontsize = prop.get_size_in_points()
+ w, h, d = texmanager.get_text_width_height_descent(s, fontsize,
+ renderer=None)
+ return w, h, d
+
+ fontsize = prop.get_size_in_points()
+ scale = fontsize / self.FONT_SCALE
+
+ if ismath:
+ prop = prop.copy()
+ prop.set_size(self.FONT_SCALE)
+ width, height, descent, *_ = \
+ self.mathtext_parser.parse(s, 72, prop)
+ return width * scale, height * scale, descent * scale
+
+ font = self._get_font(prop)
+ font.set_text(s, 0.0, flags=LOAD_NO_HINTING)
+ w, h = font.get_width_height()
+ w /= 64.0 # convert from subpixels
+ h /= 64.0
+ d = font.get_descent()
+ d /= 64.0
+ return w * scale, h * scale, d * scale
+
+ def get_text_path(self, prop, s, ismath=False):
+ """
+ Convert text *s* to path (a tuple of vertices and codes for
+ matplotlib.path.Path).
+
+ Parameters
+ ----------
+ prop : `~matplotlib.font_manager.FontProperties`
+ The font properties for the text.
+
+ s : str
+ The text to be converted.
+
+ ismath : {False, True, "TeX"}
+ If True, use mathtext parser. If "TeX", use tex for rendering.
+
+ Returns
+ -------
+ verts : list
+ A list of numpy arrays containing the x and y coordinates of the
+ vertices.
+
+ codes : list
+ A list of path codes.
+
+ Examples
+ --------
+ Create a list of vertices and codes from a text, and create a `.Path`
+ from those::
+
+ from matplotlib.path import Path
+ from matplotlib.textpath import TextToPath
+ from matplotlib.font_manager import FontProperties
+
+ fp = FontProperties(family="Humor Sans", style="italic")
+ verts, codes = TextToPath().get_text_path(fp, "ABC")
+ path = Path(verts, codes, closed=False)
+
+ Also see `TextPath` for a more direct way to create a path from a text.
+ """
+ if ismath == "TeX":
+ glyph_info, glyph_map, rects = self.get_glyphs_tex(prop, s)
+ elif not ismath:
+ font = self._get_font(prop)
+ glyph_info, glyph_map, rects = self.get_glyphs_with_font(font, s)
+ else:
+ glyph_info, glyph_map, rects = self.get_glyphs_mathtext(prop, s)
+
+ verts, codes = [], []
+
+ for glyph_id, xposition, yposition, scale in glyph_info:
+ verts1, codes1 = glyph_map[glyph_id]
+ if len(verts1):
+ verts1 = np.array(verts1) * scale + [xposition, yposition]
+ verts.extend(verts1)
+ codes.extend(codes1)
+
+ for verts1, codes1 in rects:
+ verts.extend(verts1)
+ codes.extend(codes1)
+
+ return verts, codes
+
+ def get_glyphs_with_font(self, font, s, glyph_map=None,
+ return_new_glyphs_only=False):
+ """
+ Convert string *s* to vertices and codes using the provided ttf font.
+ """
+
+ if glyph_map is None:
+ glyph_map = OrderedDict()
+
+ if return_new_glyphs_only:
+ glyph_map_new = OrderedDict()
+ else:
+ glyph_map_new = glyph_map
+
+ xpositions = []
+ glyph_ids = []
+ for item in _text_layout.layout(s, font):
+ char_id = self._get_char_id(font, ord(item.char))
+ glyph_ids.append(char_id)
+ xpositions.append(item.x)
+ if char_id not in glyph_map:
+ glyph_map_new[char_id] = font.get_path()
+
+ ypositions = [0] * len(xpositions)
+ sizes = [1.] * len(xpositions)
+
+ rects = []
+
+ return (list(zip(glyph_ids, xpositions, ypositions, sizes)),
+ glyph_map_new, rects)
+
+ def get_glyphs_mathtext(self, prop, s, glyph_map=None,
+ return_new_glyphs_only=False):
+ """
+ Parse mathtext string *s* and convert it to a (vertices, codes) pair.
+ """
+
+ prop = prop.copy()
+ prop.set_size(self.FONT_SCALE)
+
+ width, height, descent, glyphs, rects = self.mathtext_parser.parse(
+ s, self.DPI, prop)
+
+ if not glyph_map:
+ glyph_map = OrderedDict()
+
+ if return_new_glyphs_only:
+ glyph_map_new = OrderedDict()
+ else:
+ glyph_map_new = glyph_map
+
+ xpositions = []
+ ypositions = []
+ glyph_ids = []
+ sizes = []
+
+ for font, fontsize, ccode, ox, oy in glyphs:
+ char_id = self._get_char_id(font, ccode)
+ if char_id not in glyph_map:
+ font.clear()
+ font.set_size(self.FONT_SCALE, self.DPI)
+ font.load_char(ccode, flags=LOAD_NO_HINTING)
+ glyph_map_new[char_id] = font.get_path()
+
+ xpositions.append(ox)
+ ypositions.append(oy)
+ glyph_ids.append(char_id)
+ size = fontsize / self.FONT_SCALE
+ sizes.append(size)
+
+ myrects = []
+ for ox, oy, w, h in rects:
+ vert1 = [(ox, oy), (ox, oy + h), (ox + w, oy + h),
+ (ox + w, oy), (ox, oy), (0, 0)]
+ code1 = [Path.MOVETO,
+ Path.LINETO, Path.LINETO, Path.LINETO, Path.LINETO,
+ Path.CLOSEPOLY]
+ myrects.append((vert1, code1))
+
+ return (list(zip(glyph_ids, xpositions, ypositions, sizes)),
+ glyph_map_new, myrects)
+
+ def get_texmanager(self):
+ """Return the cached `~.texmanager.TexManager` instance."""
+ if self._texmanager is None:
+ from matplotlib.texmanager import TexManager
+ self._texmanager = TexManager()
+ return self._texmanager
+
+ def get_glyphs_tex(self, prop, s, glyph_map=None,
+ return_new_glyphs_only=False):
+ """Convert the string *s* to vertices and codes using usetex mode."""
+ # Mostly borrowed from pdf backend.
+
+ dvifile = self.get_texmanager().make_dvi(s, self.FONT_SCALE)
+ with dviread.Dvi(dvifile, self.DPI) as dvi:
+ page, = dvi
+
+ if glyph_map is None:
+ glyph_map = OrderedDict()
+
+ if return_new_glyphs_only:
+ glyph_map_new = OrderedDict()
+ else:
+ glyph_map_new = glyph_map
+
+ glyph_ids, xpositions, ypositions, sizes = [], [], [], []
+
+ # Gather font information and do some setup for combining
+ # characters into strings.
+ for x1, y1, dvifont, glyph, width in page.text:
+ font, enc = self._get_ps_font_and_encoding(dvifont.texname)
+ char_id = self._get_char_id(font, glyph)
+
+ if char_id not in glyph_map:
+ font.clear()
+ font.set_size(self.FONT_SCALE, self.DPI)
+ # See comments in _get_ps_font_and_encoding.
+ if enc is not None:
+ index = font.get_name_index(enc[glyph])
+ font.load_glyph(index, flags=LOAD_TARGET_LIGHT)
+ else:
+ font.load_char(glyph, flags=LOAD_TARGET_LIGHT)
+ glyph_map_new[char_id] = font.get_path()
+
+ glyph_ids.append(char_id)
+ xpositions.append(x1)
+ ypositions.append(y1)
+ sizes.append(dvifont.size / self.FONT_SCALE)
+
+ myrects = []
+
+ for ox, oy, h, w in page.boxes:
+ vert1 = [(ox, oy), (ox + w, oy), (ox + w, oy + h),
+ (ox, oy + h), (ox, oy), (0, 0)]
+ code1 = [Path.MOVETO,
+ Path.LINETO, Path.LINETO, Path.LINETO, Path.LINETO,
+ Path.CLOSEPOLY]
+ myrects.append((vert1, code1))
+
+ return (list(zip(glyph_ids, xpositions, ypositions, sizes)),
+ glyph_map_new, myrects)
+
+ @staticmethod
+ @functools.lru_cache(50)
+ def _get_ps_font_and_encoding(texname):
+ tex_font_map = dviread.PsfontsMap(dviread.find_tex_file('pdftex.map'))
+ psfont = tex_font_map[texname]
+ if psfont.filename is None:
+ raise ValueError(
+ f"No usable font file found for {psfont.psname} ({texname}). "
+ f"The font may lack a Type-1 version.")
+
+ font = get_font(psfont.filename)
+
+ if psfont.encoding:
+ # If psfonts.map specifies an encoding, use it: it gives us a
+ # mapping of glyph indices to Adobe glyph names; use it to convert
+ # dvi indices to glyph names and use the FreeType-synthesized
+ # unicode charmap to convert glyph names to glyph indices (with
+ # FT_Get_Name_Index/get_name_index), and load the glyph using
+ # FT_Load_Glyph/load_glyph. (That charmap has a coverage at least
+ # as good as, and possibly better than, the native charmaps.)
+ enc = dviread._parse_enc(psfont.encoding)
+ else:
+ # If psfonts.map specifies no encoding, the indices directly
+ # map to the font's "native" charmap; so don't use the
+ # FreeType-synthesized charmap but the native ones (we can't
+ # directly identify it but it's typically an Adobe charmap), and
+ # directly load the dvi glyph indices using FT_Load_Char/load_char.
+ for charmap_code in [
+ 1094992451, # ADOBE_CUSTOM.
+ 1094995778, # ADOBE_STANDARD.
+ ]:
+ try:
+ font.select_charmap(charmap_code)
+ except (ValueError, RuntimeError):
+ pass
+ else:
+ break
+ else:
+ _log.warning("No supported encoding in font (%s).",
+ psfont.filename)
+ enc = None
+
+ return font, enc
+
+
+text_to_path = TextToPath()
+
+
+class TextPath(Path):
+ """
+ Create a path from the text.
+ """
+
+ def __init__(self, xy, s, size=None, prop=None,
+ _interpolation_steps=1, usetex=False):
+ r"""
+ Create a path from the text. Note that it simply is a path,
+ not an artist. You need to use the `~.PathPatch` (or other artists)
+ to draw this path onto the canvas.
+
+ Parameters
+ ----------
+ xy : tuple or array of two float values
+ Position of the text. For no offset, use ``xy=(0, 0)``.
+
+ s : str
+ The text to convert to a path.
+
+ size : float, optional
+ Font size in points. Defaults to the size specified via the font
+ properties *prop*.
+
+ prop : `matplotlib.font_manager.FontProperties`, optional
+ Font property. If not provided, will use a default
+ ``FontProperties`` with parameters from the
+ :ref:`rcParams `.
+
+ _interpolation_steps : int, optional
+ (Currently ignored)
+
+ usetex : bool, default: False
+ Whether to use tex rendering.
+
+ Examples
+ --------
+ The following creates a path from the string "ABC" with Helvetica
+ font face; and another path from the latex fraction 1/2::
+
+ from matplotlib.textpath import TextPath
+ from matplotlib.font_manager import FontProperties
+
+ fp = FontProperties(family="Helvetica", style="italic")
+ path1 = TextPath((12, 12), "ABC", size=12, prop=fp)
+ path2 = TextPath((0, 0), r"$\frac{1}{2}$", size=12, usetex=True)
+
+ Also see :doc:`/gallery/text_labels_and_annotations/demo_text_path`.
+ """
+ # Circular import.
+ from matplotlib.text import Text
+
+ prop = FontProperties._from_any(prop)
+ if size is None:
+ size = prop.get_size_in_points()
+
+ self._xy = xy
+ self.set_size(size)
+
+ self._cached_vertices = None
+ s, ismath = Text(usetex=usetex)._preprocess_math(s)
+ self._vertices, self._codes = text_to_path.get_text_path(
+ prop, s, ismath=ismath)
+ self._should_simplify = False
+ self._simplify_threshold = rcParams['path.simplify_threshold']
+ self._interpolation_steps = _interpolation_steps
+
+ def set_size(self, size):
+ """Set the text size."""
+ self._size = size
+ self._invalid = True
+
+ def get_size(self):
+ """Get the text size."""
+ return self._size
+
+ @property
+ def vertices(self):
+ """
+ Return the cached path after updating it if necessary.
+ """
+ self._revalidate_path()
+ return self._cached_vertices
+
+ @property
+ def codes(self):
+ """
+ Return the codes
+ """
+ return self._codes
+
+ def _revalidate_path(self):
+ """
+ Update the path if necessary.
+
+ The path for the text is initially create with the font size of
+ `~.FONT_SCALE`, and this path is rescaled to other size when necessary.
+ """
+ if self._invalid or self._cached_vertices is None:
+ tr = (Affine2D()
+ .scale(self._size / text_to_path.FONT_SCALE)
+ .translate(*self._xy))
+ self._cached_vertices = tr.transform(self._vertices)
+ self._invalid = False
diff --git a/venv/Lib/site-packages/matplotlib/ticker.py b/venv/Lib/site-packages/matplotlib/ticker.py
new file mode 100644
index 0000000..430d611
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/ticker.py
@@ -0,0 +1,3017 @@
+"""
+Tick locating and formatting
+============================
+
+This module contains classes for configuring tick locating and formatting.
+Generic tick locators and formatters are provided, as well as domain specific
+custom ones.
+
+Although the locators know nothing about major or minor ticks, they are used
+by the Axis class to support major and minor tick locating and formatting.
+
+Tick locating
+-------------
+
+The Locator class is the base class for all tick locators. The locators
+handle autoscaling of the view limits based on the data limits, and the
+choosing of tick locations. A useful semi-automatic tick locator is
+`MultipleLocator`. It is initialized with a base, e.g., 10, and it picks
+axis limits and ticks that are multiples of that base.
+
+The Locator subclasses defined here are
+
+:class:`AutoLocator`
+ `MaxNLocator` with simple defaults. This is the default tick locator for
+ most plotting.
+
+:class:`MaxNLocator`
+ Finds up to a max number of intervals with ticks at nice locations.
+
+:class:`LinearLocator`
+ Space ticks evenly from min to max.
+
+:class:`LogLocator`
+ Space ticks logarithmically from min to max.
+
+:class:`MultipleLocator`
+ Ticks and range are a multiple of base; either integer or float.
+
+:class:`FixedLocator`
+ Tick locations are fixed.
+
+:class:`IndexLocator`
+ Locator for index plots (e.g., where ``x = range(len(y))``).
+
+:class:`NullLocator`
+ No ticks.
+
+:class:`SymmetricalLogLocator`
+ Locator for use with with the symlog norm; works like `LogLocator` for the
+ part outside of the threshold and adds 0 if inside the limits.
+
+:class:`LogitLocator`
+ Locator for logit scaling.
+
+:class:`OldAutoLocator`
+ Choose a `MultipleLocator` and dynamically reassign it for intelligent
+ ticking during navigation.
+
+:class:`AutoMinorLocator`
+ Locator for minor ticks when the axis is linear and the
+ major ticks are uniformly spaced. Subdivides the major
+ tick interval into a specified number of minor intervals,
+ defaulting to 4 or 5 depending on the major interval.
+
+
+There are a number of locators specialized for date locations - see
+the :mod:`.dates` module.
+
+You can define your own locator by deriving from Locator. You must
+override the ``__call__`` method, which returns a sequence of locations,
+and you will probably want to override the autoscale method to set the
+view limits from the data limits.
+
+If you want to override the default locator, use one of the above or a custom
+locator and pass it to the x or y axis instance. The relevant methods are::
+
+ ax.xaxis.set_major_locator(xmajor_locator)
+ ax.xaxis.set_minor_locator(xminor_locator)
+ ax.yaxis.set_major_locator(ymajor_locator)
+ ax.yaxis.set_minor_locator(yminor_locator)
+
+The default minor locator is `NullLocator`, i.e., no minor ticks on by default.
+
+.. note::
+ `Locator` instances should not be used with more than one
+ `~matplotlib.axis.Axis` or `~matplotlib.axes.Axes`. So instead of::
+
+ locator = MultipleLocator(5)
+ ax.xaxis.set_major_locator(locator)
+ ax2.xaxis.set_major_locator(locator)
+
+ do the following instead::
+
+ ax.xaxis.set_major_locator(MultipleLocator(5))
+ ax2.xaxis.set_major_locator(MultipleLocator(5))
+
+Tick formatting
+---------------
+
+Tick formatting is controlled by classes derived from Formatter. The formatter
+operates on a single tick value and returns a string to the axis.
+
+:class:`NullFormatter`
+ No labels on the ticks.
+
+:class:`IndexFormatter`
+ Set the strings from a list of labels.
+
+:class:`FixedFormatter`
+ Set the strings manually for the labels.
+
+:class:`FuncFormatter`
+ User defined function sets the labels.
+
+:class:`StrMethodFormatter`
+ Use string `format` method.
+
+:class:`FormatStrFormatter`
+ Use an old-style sprintf format string.
+
+:class:`ScalarFormatter`
+ Default formatter for scalars: autopick the format string.
+
+:class:`LogFormatter`
+ Formatter for log axes.
+
+:class:`LogFormatterExponent`
+ Format values for log axis using ``exponent = log_base(value)``.
+
+:class:`LogFormatterMathtext`
+ Format values for log axis using ``exponent = log_base(value)``
+ using Math text.
+
+:class:`LogFormatterSciNotation`
+ Format values for log axis using scientific notation.
+
+:class:`LogitFormatter`
+ Probability formatter.
+
+:class:`EngFormatter`
+ Format labels in engineering notation.
+
+:class:`PercentFormatter`
+ Format labels as a percentage.
+
+You can derive your own formatter from the Formatter base class by
+simply overriding the ``__call__`` method. The formatter class has
+access to the axis view and data limits.
+
+To control the major and minor tick label formats, use one of the
+following methods::
+
+ ax.xaxis.set_major_formatter(xmajor_formatter)
+ ax.xaxis.set_minor_formatter(xminor_formatter)
+ ax.yaxis.set_major_formatter(ymajor_formatter)
+ ax.yaxis.set_minor_formatter(yminor_formatter)
+
+In addition to a `.Formatter` instance, `~.Axis.set_major_formatter` and
+`~.Axis.set_minor_formatter` also accept a ``str`` or function. ``str`` input
+will be internally replaced with an autogenerated `.StrMethodFormatter` with
+the input ``str``. For function input, a `.FuncFormatter` with the input
+function will be generated and used.
+
+See :doc:`/gallery/ticks_and_spines/major_minor_demo` for an
+example of setting major and minor ticks. See the :mod:`matplotlib.dates`
+module for more information and examples of using date locators and formatters.
+"""
+
+import itertools
+import logging
+import locale
+import math
+from numbers import Integral
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib import _api, cbook
+from matplotlib import transforms as mtransforms
+
+_log = logging.getLogger(__name__)
+
+__all__ = ('TickHelper', 'Formatter', 'FixedFormatter',
+ 'NullFormatter', 'FuncFormatter', 'FormatStrFormatter',
+ 'StrMethodFormatter', 'ScalarFormatter', 'LogFormatter',
+ 'LogFormatterExponent', 'LogFormatterMathtext',
+ 'IndexFormatter', 'LogFormatterSciNotation',
+ 'LogitFormatter', 'EngFormatter', 'PercentFormatter',
+ 'OldScalarFormatter',
+ 'Locator', 'IndexLocator', 'FixedLocator', 'NullLocator',
+ 'LinearLocator', 'LogLocator', 'AutoLocator',
+ 'MultipleLocator', 'MaxNLocator', 'AutoMinorLocator',
+ 'SymmetricalLogLocator', 'LogitLocator', 'OldAutoLocator')
+
+
+class _DummyAxis:
+ __name__ = "dummy"
+
+ def __init__(self, minpos=0):
+ self.dataLim = mtransforms.Bbox.unit()
+ self.viewLim = mtransforms.Bbox.unit()
+ self._minpos = minpos
+
+ def get_view_interval(self):
+ return self.viewLim.intervalx
+
+ def set_view_interval(self, vmin, vmax):
+ self.viewLim.intervalx = vmin, vmax
+
+ def get_minpos(self):
+ return self._minpos
+
+ def get_data_interval(self):
+ return self.dataLim.intervalx
+
+ def set_data_interval(self, vmin, vmax):
+ self.dataLim.intervalx = vmin, vmax
+
+ def get_tick_space(self):
+ # Just use the long-standing default of nbins==9
+ return 9
+
+
+class TickHelper:
+ axis = None
+
+ def set_axis(self, axis):
+ self.axis = axis
+
+ def create_dummy_axis(self, **kwargs):
+ if self.axis is None:
+ self.axis = _DummyAxis(**kwargs)
+
+ def set_view_interval(self, vmin, vmax):
+ self.axis.set_view_interval(vmin, vmax)
+
+ def set_data_interval(self, vmin, vmax):
+ self.axis.set_data_interval(vmin, vmax)
+
+ def set_bounds(self, vmin, vmax):
+ self.set_view_interval(vmin, vmax)
+ self.set_data_interval(vmin, vmax)
+
+
+class Formatter(TickHelper):
+ """
+ Create a string based on a tick value and location.
+ """
+ # some classes want to see all the locs to help format
+ # individual ones
+ locs = []
+
+ def __call__(self, x, pos=None):
+ """
+ Return the format for tick value *x* at position pos.
+ ``pos=None`` indicates an unspecified location.
+ """
+ raise NotImplementedError('Derived must override')
+
+ def format_ticks(self, values):
+ """Return the tick labels for all the ticks at once."""
+ self.set_locs(values)
+ return [self(value, i) for i, value in enumerate(values)]
+
+ def format_data(self, value):
+ """
+ Return the full string representation of the value with the
+ position unspecified.
+ """
+ return self.__call__(value)
+
+ def format_data_short(self, value):
+ """
+ Return a short string version of the tick value.
+
+ Defaults to the position-independent long value.
+ """
+ return self.format_data(value)
+
+ def get_offset(self):
+ return ''
+
+ def set_locs(self, locs):
+ """
+ Set the locations of the ticks.
+
+ This method is called before computing the tick labels because some
+ formatters need to know all tick locations to do so.
+ """
+ self.locs = locs
+
+ @staticmethod
+ def fix_minus(s):
+ """
+ Some classes may want to replace a hyphen for minus with the proper
+ unicode symbol (U+2212) for typographical correctness. This is a
+ helper method to perform such a replacement when it is enabled via
+ :rc:`axes.unicode_minus`.
+ """
+ return (s.replace('-', '\N{MINUS SIGN}')
+ if mpl.rcParams['axes.unicode_minus']
+ else s)
+
+ def _set_locator(self, locator):
+ """Subclasses may want to override this to set a locator."""
+ pass
+
+
+@_api.deprecated("3.3")
+class IndexFormatter(Formatter):
+ """
+ Format the position x to the nearest i-th label where ``i = int(x + 0.5)``.
+ Positions where ``i < 0`` or ``i > len(list)`` have no tick labels.
+
+ Parameters
+ ----------
+ labels : list
+ List of labels.
+ """
+ def __init__(self, labels):
+ self.labels = labels
+ self.n = len(labels)
+
+ def __call__(self, x, pos=None):
+ """
+ Return the format for tick value *x* at position pos.
+
+ The position is ignored and the value is rounded to the nearest
+ integer, which is used to look up the label.
+ """
+ i = int(x + 0.5)
+ if i < 0 or i >= self.n:
+ return ''
+ else:
+ return self.labels[i]
+
+
+class NullFormatter(Formatter):
+ """Always return the empty string."""
+
+ def __call__(self, x, pos=None):
+ # docstring inherited
+ return ''
+
+
+class FixedFormatter(Formatter):
+ """
+ Return fixed strings for tick labels based only on position, not value.
+
+ .. note::
+ `.FixedFormatter` should only be used together with `.FixedLocator`.
+ Otherwise, the labels may end up in unexpected positions.
+ """
+
+ def __init__(self, seq):
+ """Set the sequence *seq* of strings that will be used for labels."""
+ self.seq = seq
+ self.offset_string = ''
+
+ def __call__(self, x, pos=None):
+ """
+ Return the label that matches the position, regardless of the value.
+
+ For positions ``pos < len(seq)``, return ``seq[i]`` regardless of
+ *x*. Otherwise return empty string. ``seq`` is the sequence of
+ strings that this object was initialized with.
+ """
+ if pos is None or pos >= len(self.seq):
+ return ''
+ else:
+ return self.seq[pos]
+
+ def get_offset(self):
+ return self.offset_string
+
+ def set_offset_string(self, ofs):
+ self.offset_string = ofs
+
+
+class FuncFormatter(Formatter):
+ """
+ Use a user-defined function for formatting.
+
+ The function should take in two inputs (a tick value ``x`` and a
+ position ``pos``), and return a string containing the corresponding
+ tick label.
+ """
+
+ def __init__(self, func):
+ self.func = func
+ self.offset_string = ""
+
+ def __call__(self, x, pos=None):
+ """
+ Return the value of the user defined function.
+
+ *x* and *pos* are passed through as-is.
+ """
+ return self.func(x, pos)
+
+ def get_offset(self):
+ return self.offset_string
+
+ def set_offset_string(self, ofs):
+ self.offset_string = ofs
+
+
+class FormatStrFormatter(Formatter):
+ """
+ Use an old-style ('%' operator) format string to format the tick.
+
+ The format string should have a single variable format (%) in it.
+ It will be applied to the value (not the position) of the tick.
+
+ Negative numeric values will use a dash not a unicode minus,
+ use mathtext to get a unicode minus by wrappping the format specifier
+ with $ (e.g. "$%g$").
+ """
+ def __init__(self, fmt):
+ self.fmt = fmt
+
+ def __call__(self, x, pos=None):
+ """
+ Return the formatted label string.
+
+ Only the value *x* is formatted. The position is ignored.
+ """
+ return self.fmt % x
+
+
+class StrMethodFormatter(Formatter):
+ """
+ Use a new-style format string (as used by `str.format`) to format the tick.
+
+ The field used for the tick value must be labeled *x* and the field used
+ for the tick position must be labeled *pos*.
+ """
+ def __init__(self, fmt):
+ self.fmt = fmt
+
+ def __call__(self, x, pos=None):
+ """
+ Return the formatted label string.
+
+ *x* and *pos* are passed to `str.format` as keyword arguments
+ with those exact names.
+ """
+ return self.fmt.format(x=x, pos=pos)
+
+
+@_api.deprecated("3.3")
+class OldScalarFormatter(Formatter):
+ """
+ Tick location is a plain old number.
+ """
+
+ def __call__(self, x, pos=None):
+ """
+ Return the format for tick val *x* based on the width of the axis.
+
+ The position *pos* is ignored.
+ """
+ xmin, xmax = self.axis.get_view_interval()
+ # If the number is not too big and it's an int, format it as an int.
+ if abs(x) < 1e4 and x == int(x):
+ return '%d' % x
+ d = abs(xmax - xmin)
+ fmt = ('%1.3e' if d < 1e-2 else
+ '%1.3f' if d <= 1 else
+ '%1.2f' if d <= 10 else
+ '%1.1f' if d <= 1e5 else
+ '%1.1e')
+ s = fmt % x
+ tup = s.split('e')
+ if len(tup) == 2:
+ mantissa = tup[0].rstrip('0').rstrip('.')
+ sign = tup[1][0].replace('+', '')
+ exponent = tup[1][1:].lstrip('0')
+ s = '%se%s%s' % (mantissa, sign, exponent)
+ else:
+ s = s.rstrip('0').rstrip('.')
+ return s
+
+
+class ScalarFormatter(Formatter):
+ """
+ Format tick values as a number.
+
+ Parameters
+ ----------
+ useOffset : bool or float, default: :rc:`axes.formatter.useoffset`
+ Whether to use offset notation. See `.set_useOffset`.
+ useMathText : bool, default: :rc:`axes.formatter.use_mathtext`
+ Whether to use fancy math formatting. See `.set_useMathText`.
+ useLocale : bool, default: :rc:`axes.formatter.use_locale`.
+ Whether to use locale settings for decimal sign and positive sign.
+ See `.set_useLocale`.
+
+ Notes
+ -----
+ In addition to the parameters above, the formatting of scientific vs.
+ floating point representation can be configured via `.set_scientific`
+ and `.set_powerlimits`).
+
+ **Offset notation and scientific notation**
+
+ Offset notation and scientific notation look quite similar at first sight.
+ Both split some information from the formatted tick values and display it
+ at the end of the axis.
+
+ - The scientific notation splits up the order of magnitude, i.e. a
+ multiplicative scaling factor, e.g. ``1e6``.
+
+ - The offset notation separates an additive constant, e.g. ``+1e6``. The
+ offset notation label is always prefixed with a ``+`` or ``-`` sign
+ and is thus distinguishable from the order of magnitude label.
+
+ The following plot with x limits ``1_000_000`` to ``1_000_010`` illustrates
+ the different formatting. Note the labels at the right edge of the x axis.
+
+ .. plot::
+
+ lim = (1_000_000, 1_000_010)
+
+ fig, (ax1, ax2, ax3) = plt.subplots(3, 1, gridspec_kw={'hspace': 2})
+ ax1.set(title='offset_notation', xlim=lim)
+ ax2.set(title='scientific notation', xlim=lim)
+ ax2.xaxis.get_major_formatter().set_useOffset(False)
+ ax3.set(title='floating point notation', xlim=lim)
+ ax3.xaxis.get_major_formatter().set_useOffset(False)
+ ax3.xaxis.get_major_formatter().set_scientific(False)
+
+ """
+
+ def __init__(self, useOffset=None, useMathText=None, useLocale=None):
+ if useOffset is None:
+ useOffset = mpl.rcParams['axes.formatter.useoffset']
+ self._offset_threshold = \
+ mpl.rcParams['axes.formatter.offset_threshold']
+ self.set_useOffset(useOffset)
+ self._usetex = mpl.rcParams['text.usetex']
+ if useMathText is None:
+ useMathText = mpl.rcParams['axes.formatter.use_mathtext']
+ self.set_useMathText(useMathText)
+ self.orderOfMagnitude = 0
+ self.format = ''
+ self._scientific = True
+ self._powerlimits = mpl.rcParams['axes.formatter.limits']
+ if useLocale is None:
+ useLocale = mpl.rcParams['axes.formatter.use_locale']
+ self._useLocale = useLocale
+
+ def get_useOffset(self):
+ """
+ Return whether automatic mode for offset notation is active.
+
+ This returns True if ``set_useOffset(True)``; it returns False if an
+ explicit offset was set, e.g. ``set_useOffset(1000)``.
+
+ See Also
+ --------
+ ScalarFormatter.set_useOffset
+ """
+ return self._useOffset
+
+ def set_useOffset(self, val):
+ """
+ Set whether to use offset notation.
+
+ When formatting a set numbers whose value is large compared to their
+ range, the formatter can separate an additive constant. This can
+ shorten the formatted numbers so that they are less likely to overlap
+ when drawn on an axis.
+
+ Parameters
+ ----------
+ val : bool or float
+ - If False, do not use offset notation.
+ - If True (=automatic mode), use offset notation if it can make
+ the residual numbers significantly shorter. The exact behavior
+ is controlled by :rc:`axes.formatter.offset_threshold`.
+ - If a number, force an offset of the given value.
+
+ Examples
+ --------
+ With active offset notation, the values
+
+ ``100_000, 100_002, 100_004, 100_006, 100_008``
+
+ will be formatted as ``0, 2, 4, 6, 8`` plus an offset ``+1e5``, which
+ is written to the edge of the axis.
+ """
+ if val in [True, False]:
+ self.offset = 0
+ self._useOffset = val
+ else:
+ self._useOffset = False
+ self.offset = val
+
+ useOffset = property(fget=get_useOffset, fset=set_useOffset)
+
+ def get_useLocale(self):
+ """
+ Return whether locale settings are used for formatting.
+
+ See Also
+ --------
+ ScalarFormatter.set_useLocale
+ """
+ return self._useLocale
+
+ def set_useLocale(self, val):
+ """
+ Set whether to use locale settings for decimal sign and positive sign.
+
+ Parameters
+ ----------
+ val : bool or None
+ *None* resets to :rc:`axes.formatter.use_locale`.
+ """
+ if val is None:
+ self._useLocale = mpl.rcParams['axes.formatter.use_locale']
+ else:
+ self._useLocale = val
+
+ useLocale = property(fget=get_useLocale, fset=set_useLocale)
+
+ def _format_maybe_minus_and_locale(self, fmt, arg):
+ """
+ Format *arg* with *fmt*, applying unicode minus and locale if desired.
+ """
+ return self.fix_minus(locale.format_string(fmt, (arg,), True)
+ if self._useLocale else fmt % arg)
+
+ def get_useMathText(self):
+ """
+ Return whether to use fancy math formatting.
+
+ See Also
+ --------
+ ScalarFormatter.set_useMathText
+ """
+ return self._useMathText
+
+ def set_useMathText(self, val):
+ r"""
+ Set whether to use fancy math formatting.
+
+ If active, scientific notation is formatted as :math:`1.2 \times 10^3`.
+
+ Parameters
+ ----------
+ val : bool or None
+ *None* resets to :rc:`axes.formatter.use_mathtext`.
+ """
+ if val is None:
+ self._useMathText = mpl.rcParams['axes.formatter.use_mathtext']
+ else:
+ self._useMathText = val
+
+ useMathText = property(fget=get_useMathText, fset=set_useMathText)
+
+ def __call__(self, x, pos=None):
+ """
+ Return the format for tick value *x* at position *pos*.
+ """
+ if len(self.locs) == 0:
+ return ''
+ else:
+ xp = (x - self.offset) / (10. ** self.orderOfMagnitude)
+ if abs(xp) < 1e-8:
+ xp = 0
+ return self._format_maybe_minus_and_locale(self.format, xp)
+
+ def set_scientific(self, b):
+ """
+ Turn scientific notation on or off.
+
+ See Also
+ --------
+ ScalarFormatter.set_powerlimits
+ """
+ self._scientific = bool(b)
+
+ def set_powerlimits(self, lims):
+ r"""
+ Set size thresholds for scientific notation.
+
+ Parameters
+ ----------
+ lims : (int, int)
+ A tuple *(min_exp, max_exp)* containing the powers of 10 that
+ determine the switchover threshold. For a number representable as
+ :math:`a \times 10^\mathrm{exp}`` with :math:`1 <= |a| < 10`,
+ scientific notation will be used if ``exp <= min_exp`` or
+ ``exp >= max_exp``.
+
+ The default limits are controlled by :rc:`axes.formatter.limits`.
+
+ In particular numbers with *exp* equal to the thresholds are
+ written in scientific notation.
+
+ Typically, *min_exp* will be negative and *max_exp* will be
+ positive.
+
+ For example, ``formatter.set_powerlimits((-3, 4))`` will provide
+ the following formatting:
+ :math:`1 \times 10^{-3}, 9.9 \times 10^{-3}, 0.01,`
+ :math:`9999, 1 \times 10^4`.
+
+ See Also
+ --------
+ ScalarFormatter.set_scientific
+ """
+ if len(lims) != 2:
+ raise ValueError("'lims' must be a sequence of length 2")
+ self._powerlimits = lims
+
+ def format_data_short(self, value):
+ # docstring inherited
+ if isinstance(value, np.ma.MaskedArray) and value.mask:
+ return ""
+ if isinstance(value, Integral):
+ fmt = "%d"
+ else:
+ if getattr(self.axis, "__name__", "") in ["xaxis", "yaxis"]:
+ if self.axis.__name__ == "xaxis":
+ axis_trf = self.axis.axes.get_xaxis_transform()
+ axis_inv_trf = axis_trf.inverted()
+ screen_xy = axis_trf.transform((value, 0))
+ neighbor_values = axis_inv_trf.transform(
+ screen_xy + [[-1, 0], [+1, 0]])[:, 0]
+ else: # yaxis:
+ axis_trf = self.axis.axes.get_yaxis_transform()
+ axis_inv_trf = axis_trf.inverted()
+ screen_xy = axis_trf.transform((0, value))
+ neighbor_values = axis_inv_trf.transform(
+ screen_xy + [[0, -1], [0, +1]])[:, 1]
+ delta = abs(neighbor_values - value).max()
+ else:
+ # Rough approximation: no more than 1e4 divisions.
+ delta = np.diff(self.axis.get_view_interval()) / 1e4
+ # If e.g. value = 45.67 and delta = 0.02, then we want to round to
+ # 2 digits after the decimal point (floor(log10(0.02)) = -2);
+ # 45.67 contributes 2 digits before the decimal point
+ # (floor(log10(45.67)) + 1 = 2): the total is 4 significant digits.
+ # A value of 0 contributes 1 "digit" before the decimal point.
+ sig_digits = max(
+ 0,
+ (math.floor(math.log10(abs(value))) + 1 if value else 1)
+ - math.floor(math.log10(delta)))
+ fmt = f"%-#.{sig_digits}g"
+ return self._format_maybe_minus_and_locale(fmt, value)
+
+ def format_data(self, value):
+ # docstring inherited
+ e = math.floor(math.log10(abs(value)))
+ s = round(value / 10**e, 10)
+ exponent = self._format_maybe_minus_and_locale("%d", e)
+ significand = self._format_maybe_minus_and_locale(
+ "%d" if s % 1 == 0 else "%1.10f", s)
+ if e == 0:
+ return significand
+ elif self._useMathText or self._usetex:
+ exponent = "10^{%s}" % exponent
+ return (exponent if s == 1 # reformat 1x10^y as 10^y
+ else rf"{significand} \times {exponent}")
+ else:
+ return f"{significand}e{exponent}"
+
+ def get_offset(self):
+ """
+ Return scientific notation, plus offset.
+ """
+ if len(self.locs) == 0:
+ return ''
+ s = ''
+ if self.orderOfMagnitude or self.offset:
+ offsetStr = ''
+ sciNotStr = ''
+ if self.offset:
+ offsetStr = self.format_data(self.offset)
+ if self.offset > 0:
+ offsetStr = '+' + offsetStr
+ if self.orderOfMagnitude:
+ if self._usetex or self._useMathText:
+ sciNotStr = self.format_data(10 ** self.orderOfMagnitude)
+ else:
+ sciNotStr = '1e%d' % self.orderOfMagnitude
+ if self._useMathText or self._usetex:
+ if sciNotStr != '':
+ sciNotStr = r'\times\mathdefault{%s}' % sciNotStr
+ s = r'$%s\mathdefault{%s}$' % (sciNotStr, offsetStr)
+ else:
+ s = ''.join((sciNotStr, offsetStr))
+
+ return self.fix_minus(s)
+
+ def set_locs(self, locs):
+ # docstring inherited
+ self.locs = locs
+ if len(self.locs) > 0:
+ if self._useOffset:
+ self._compute_offset()
+ self._set_order_of_magnitude()
+ self._set_format()
+
+ def _compute_offset(self):
+ locs = self.locs
+ # Restrict to visible ticks.
+ vmin, vmax = sorted(self.axis.get_view_interval())
+ locs = np.asarray(locs)
+ locs = locs[(vmin <= locs) & (locs <= vmax)]
+ if not len(locs):
+ self.offset = 0
+ return
+ lmin, lmax = locs.min(), locs.max()
+ # Only use offset if there are at least two ticks and every tick has
+ # the same sign.
+ if lmin == lmax or lmin <= 0 <= lmax:
+ self.offset = 0
+ return
+ # min, max comparing absolute values (we want division to round towards
+ # zero so we work on absolute values).
+ abs_min, abs_max = sorted([abs(float(lmin)), abs(float(lmax))])
+ sign = math.copysign(1, lmin)
+ # What is the smallest power of ten such that abs_min and abs_max are
+ # equal up to that precision?
+ # Note: Internally using oom instead of 10 ** oom avoids some numerical
+ # accuracy issues.
+ oom_max = np.ceil(math.log10(abs_max))
+ oom = 1 + next(oom for oom in itertools.count(oom_max, -1)
+ if abs_min // 10 ** oom != abs_max // 10 ** oom)
+ if (abs_max - abs_min) / 10 ** oom <= 1e-2:
+ # Handle the case of straddling a multiple of a large power of ten
+ # (relative to the span).
+ # What is the smallest power of ten such that abs_min and abs_max
+ # are no more than 1 apart at that precision?
+ oom = 1 + next(oom for oom in itertools.count(oom_max, -1)
+ if abs_max // 10 ** oom - abs_min // 10 ** oom > 1)
+ # Only use offset if it saves at least _offset_threshold digits.
+ n = self._offset_threshold - 1
+ self.offset = (sign * (abs_max // 10 ** oom) * 10 ** oom
+ if abs_max // 10 ** oom >= 10**n
+ else 0)
+
+ def _set_order_of_magnitude(self):
+ # if scientific notation is to be used, find the appropriate exponent
+ # if using an numerical offset, find the exponent after applying the
+ # offset. When lower power limit = upper <> 0, use provided exponent.
+ if not self._scientific:
+ self.orderOfMagnitude = 0
+ return
+ if self._powerlimits[0] == self._powerlimits[1] != 0:
+ # fixed scaling when lower power limit = upper <> 0.
+ self.orderOfMagnitude = self._powerlimits[0]
+ return
+ # restrict to visible ticks
+ vmin, vmax = sorted(self.axis.get_view_interval())
+ locs = np.asarray(self.locs)
+ locs = locs[(vmin <= locs) & (locs <= vmax)]
+ locs = np.abs(locs)
+ if not len(locs):
+ self.orderOfMagnitude = 0
+ return
+ if self.offset:
+ oom = math.floor(math.log10(vmax - vmin))
+ else:
+ if locs[0] > locs[-1]:
+ val = locs[0]
+ else:
+ val = locs[-1]
+ if val == 0:
+ oom = 0
+ else:
+ oom = math.floor(math.log10(val))
+ if oom <= self._powerlimits[0]:
+ self.orderOfMagnitude = oom
+ elif oom >= self._powerlimits[1]:
+ self.orderOfMagnitude = oom
+ else:
+ self.orderOfMagnitude = 0
+
+ def _set_format(self):
+ # set the format string to format all the ticklabels
+ if len(self.locs) < 2:
+ # Temporarily augment the locations with the axis end points.
+ _locs = [*self.locs, *self.axis.get_view_interval()]
+ else:
+ _locs = self.locs
+ locs = (np.asarray(_locs) - self.offset) / 10. ** self.orderOfMagnitude
+ loc_range = np.ptp(locs)
+ # Curvilinear coordinates can yield two identical points.
+ if loc_range == 0:
+ loc_range = np.max(np.abs(locs))
+ # Both points might be zero.
+ if loc_range == 0:
+ loc_range = 1
+ if len(self.locs) < 2:
+ # We needed the end points only for the loc_range calculation.
+ locs = locs[:-2]
+ loc_range_oom = int(math.floor(math.log10(loc_range)))
+ # first estimate:
+ sigfigs = max(0, 3 - loc_range_oom)
+ # refined estimate:
+ thresh = 1e-3 * 10 ** loc_range_oom
+ while sigfigs >= 0:
+ if np.abs(locs - np.round(locs, decimals=sigfigs)).max() < thresh:
+ sigfigs -= 1
+ else:
+ break
+ sigfigs += 1
+ self.format = '%1.' + str(sigfigs) + 'f'
+ if self._usetex or self._useMathText:
+ self.format = r'$\mathdefault{%s}$' % self.format
+
+
+class LogFormatter(Formatter):
+ """
+ Base class for formatting ticks on a log or symlog scale.
+
+ It may be instantiated directly, or subclassed.
+
+ Parameters
+ ----------
+ base : float, default: 10.
+ Base of the logarithm used in all calculations.
+
+ labelOnlyBase : bool, default: False
+ If True, label ticks only at integer powers of base.
+ This is normally True for major ticks and False for
+ minor ticks.
+
+ minor_thresholds : (subset, all), default: (1, 0.4)
+ If labelOnlyBase is False, these two numbers control
+ the labeling of ticks that are not at integer powers of
+ base; normally these are the minor ticks. The controlling
+ parameter is the log of the axis data range. In the typical
+ case where base is 10 it is the number of decades spanned
+ by the axis, so we can call it 'numdec'. If ``numdec <= all``,
+ all minor ticks will be labeled. If ``all < numdec <= subset``,
+ then only a subset of minor ticks will be labeled, so as to
+ avoid crowding. If ``numdec > subset`` then no minor ticks will
+ be labeled.
+
+ linthresh : None or float, default: None
+ If a symmetric log scale is in use, its ``linthresh``
+ parameter must be supplied here.
+
+ Notes
+ -----
+ The `set_locs` method must be called to enable the subsetting
+ logic controlled by the ``minor_thresholds`` parameter.
+
+ In some cases such as the colorbar, there is no distinction between
+ major and minor ticks; the tick locations might be set manually,
+ or by a locator that puts ticks at integer powers of base and
+ at intermediate locations. For this situation, disable the
+ minor_thresholds logic by using ``minor_thresholds=(np.inf, np.inf)``,
+ so that all ticks will be labeled.
+
+ To disable labeling of minor ticks when 'labelOnlyBase' is False,
+ use ``minor_thresholds=(0, 0)``. This is the default for the
+ "classic" style.
+
+ Examples
+ --------
+ To label a subset of minor ticks when the view limits span up
+ to 2 decades, and all of the ticks when zoomed in to 0.5 decades
+ or less, use ``minor_thresholds=(2, 0.5)``.
+
+ To label all minor ticks when the view limits span up to 1.5
+ decades, use ``minor_thresholds=(1.5, 1.5)``.
+ """
+
+ def __init__(self, base=10.0, labelOnlyBase=False,
+ minor_thresholds=None,
+ linthresh=None):
+
+ self._base = float(base)
+ self.labelOnlyBase = labelOnlyBase
+ if minor_thresholds is None:
+ if mpl.rcParams['_internal.classic_mode']:
+ minor_thresholds = (0, 0)
+ else:
+ minor_thresholds = (1, 0.4)
+ self.minor_thresholds = minor_thresholds
+ self._sublabels = None
+ self._linthresh = linthresh
+
+ def base(self, base):
+ """
+ Change the *base* for labeling.
+
+ .. warning::
+ Should always match the base used for :class:`LogLocator`
+ """
+ self._base = base
+
+ def label_minor(self, labelOnlyBase):
+ """
+ Switch minor tick labeling on or off.
+
+ Parameters
+ ----------
+ labelOnlyBase : bool
+ If True, label ticks only at integer powers of base.
+ """
+ self.labelOnlyBase = labelOnlyBase
+
+ def set_locs(self, locs=None):
+ """
+ Use axis view limits to control which ticks are labeled.
+
+ The *locs* parameter is ignored in the present algorithm.
+ """
+ if np.isinf(self.minor_thresholds[0]):
+ self._sublabels = None
+ return
+
+ # Handle symlog case:
+ linthresh = self._linthresh
+ if linthresh is None:
+ try:
+ linthresh = self.axis.get_transform().linthresh
+ except AttributeError:
+ pass
+
+ vmin, vmax = self.axis.get_view_interval()
+ if vmin > vmax:
+ vmin, vmax = vmax, vmin
+
+ if linthresh is None and vmin <= 0:
+ # It's probably a colorbar with
+ # a format kwarg setting a LogFormatter in the manner
+ # that worked with 1.5.x, but that doesn't work now.
+ self._sublabels = {1} # label powers of base
+ return
+
+ b = self._base
+ if linthresh is not None: # symlog
+ # Only compute the number of decades in the logarithmic part of the
+ # axis
+ numdec = 0
+ if vmin < -linthresh:
+ rhs = min(vmax, -linthresh)
+ numdec += math.log(vmin / rhs) / math.log(b)
+ if vmax > linthresh:
+ lhs = max(vmin, linthresh)
+ numdec += math.log(vmax / lhs) / math.log(b)
+ else:
+ vmin = math.log(vmin) / math.log(b)
+ vmax = math.log(vmax) / math.log(b)
+ numdec = abs(vmax - vmin)
+
+ if numdec > self.minor_thresholds[0]:
+ # Label only bases
+ self._sublabels = {1}
+ elif numdec > self.minor_thresholds[1]:
+ # Add labels between bases at log-spaced coefficients;
+ # include base powers in case the locations include
+ # "major" and "minor" points, as in colorbar.
+ c = np.geomspace(1, b, int(b)//2 + 1)
+ self._sublabels = set(np.round(c))
+ # For base 10, this yields (1, 2, 3, 4, 6, 10).
+ else:
+ # Label all integer multiples of base**n.
+ self._sublabels = set(np.arange(1, b + 1))
+
+ def _num_to_string(self, x, vmin, vmax):
+ if x > 10000:
+ s = '%1.0e' % x
+ elif x < 1:
+ s = '%1.0e' % x
+ else:
+ s = self._pprint_val(x, vmax - vmin)
+ return s
+
+ def __call__(self, x, pos=None):
+ # docstring inherited
+ if x == 0.0: # Symlog
+ return '0'
+
+ x = abs(x)
+ b = self._base
+ # only label the decades
+ fx = math.log(x) / math.log(b)
+ is_x_decade = is_close_to_int(fx)
+ exponent = round(fx) if is_x_decade else np.floor(fx)
+ coeff = round(b ** (fx - exponent))
+
+ if self.labelOnlyBase and not is_x_decade:
+ return ''
+ if self._sublabels is not None and coeff not in self._sublabels:
+ return ''
+
+ vmin, vmax = self.axis.get_view_interval()
+ vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander=0.05)
+ s = self._num_to_string(x, vmin, vmax)
+ return s
+
+ def format_data(self, value):
+ with cbook._setattr_cm(self, labelOnlyBase=False):
+ return cbook.strip_math(self.__call__(value))
+
+ def format_data_short(self, value):
+ # docstring inherited
+ return '%-12g' % value
+
+ def _pprint_val(self, x, d):
+ # If the number is not too big and it's an int, format it as an int.
+ if abs(x) < 1e4 and x == int(x):
+ return '%d' % x
+ fmt = ('%1.3e' if d < 1e-2 else
+ '%1.3f' if d <= 1 else
+ '%1.2f' if d <= 10 else
+ '%1.1f' if d <= 1e5 else
+ '%1.1e')
+ s = fmt % x
+ tup = s.split('e')
+ if len(tup) == 2:
+ mantissa = tup[0].rstrip('0').rstrip('.')
+ exponent = int(tup[1])
+ if exponent:
+ s = '%se%d' % (mantissa, exponent)
+ else:
+ s = mantissa
+ else:
+ s = s.rstrip('0').rstrip('.')
+ return s
+
+
+class LogFormatterExponent(LogFormatter):
+ """
+ Format values for log axis using ``exponent = log_base(value)``.
+ """
+ def _num_to_string(self, x, vmin, vmax):
+ fx = math.log(x) / math.log(self._base)
+ if abs(fx) > 10000:
+ s = '%1.0g' % fx
+ elif abs(fx) < 1:
+ s = '%1.0g' % fx
+ else:
+ fd = math.log(vmax - vmin) / math.log(self._base)
+ s = self._pprint_val(fx, fd)
+ return s
+
+
+class LogFormatterMathtext(LogFormatter):
+ """
+ Format values for log axis using ``exponent = log_base(value)``.
+ """
+
+ def _non_decade_format(self, sign_string, base, fx, usetex):
+ """Return string for non-decade locations."""
+ return r'$\mathdefault{%s%s^{%.2f}}$' % (sign_string, base, fx)
+
+ def __call__(self, x, pos=None):
+ # docstring inherited
+ usetex = mpl.rcParams['text.usetex']
+ min_exp = mpl.rcParams['axes.formatter.min_exponent']
+
+ if x == 0: # Symlog
+ return r'$\mathdefault{0}$'
+
+ sign_string = '-' if x < 0 else ''
+ x = abs(x)
+ b = self._base
+
+ # only label the decades
+ fx = math.log(x) / math.log(b)
+ is_x_decade = is_close_to_int(fx)
+ exponent = round(fx) if is_x_decade else np.floor(fx)
+ coeff = round(b ** (fx - exponent))
+ if is_x_decade:
+ fx = round(fx)
+
+ if self.labelOnlyBase and not is_x_decade:
+ return ''
+ if self._sublabels is not None and coeff not in self._sublabels:
+ return ''
+
+ # use string formatting of the base if it is not an integer
+ if b % 1 == 0.0:
+ base = '%d' % b
+ else:
+ base = '%s' % b
+
+ if abs(fx) < min_exp:
+ return r'$\mathdefault{%s%g}$' % (sign_string, x)
+ elif not is_x_decade:
+ return self._non_decade_format(sign_string, base, fx, usetex)
+ else:
+ return r'$\mathdefault{%s%s^{%d}}$' % (sign_string, base, fx)
+
+
+class LogFormatterSciNotation(LogFormatterMathtext):
+ """
+ Format values following scientific notation in a logarithmic axis.
+ """
+
+ def _non_decade_format(self, sign_string, base, fx, usetex):
+ """Return string for non-decade locations."""
+ b = float(base)
+ exponent = math.floor(fx)
+ coeff = b ** (fx - exponent)
+ if is_close_to_int(coeff):
+ coeff = round(coeff)
+ return r'$\mathdefault{%s%g\times%s^{%d}}$' \
+ % (sign_string, coeff, base, exponent)
+
+
+class LogitFormatter(Formatter):
+ """
+ Probability formatter (using Math text).
+ """
+
+ def __init__(
+ self,
+ *,
+ use_overline=False,
+ one_half=r"\frac{1}{2}",
+ minor=False,
+ minor_threshold=25,
+ minor_number=6,
+ ):
+ r"""
+ Parameters
+ ----------
+ use_overline : bool, default: False
+ If x > 1/2, with x = 1-v, indicate if x should be displayed as
+ $\overline{v}$. The default is to display $1-v$.
+
+ one_half : str, default: r"\frac{1}{2}"
+ The string used to represent 1/2.
+
+ minor : bool, default: False
+ Indicate if the formatter is formatting minor ticks or not.
+ Basically minor ticks are not labelled, except when only few ticks
+ are provided, ticks with most space with neighbor ticks are
+ labelled. See other parameters to change the default behavior.
+
+ minor_threshold : int, default: 25
+ Maximum number of locs for labelling some minor ticks. This
+ parameter have no effect if minor is False.
+
+ minor_number : int, default: 6
+ Number of ticks which are labelled when the number of ticks is
+ below the threshold.
+ """
+ self._use_overline = use_overline
+ self._one_half = one_half
+ self._minor = minor
+ self._labelled = set()
+ self._minor_threshold = minor_threshold
+ self._minor_number = minor_number
+
+ def use_overline(self, use_overline):
+ r"""
+ Switch display mode with overline for labelling p>1/2.
+
+ Parameters
+ ----------
+ use_overline : bool, default: False
+ If x > 1/2, with x = 1-v, indicate if x should be displayed as
+ $\overline{v}$. The default is to display $1-v$.
+ """
+ self._use_overline = use_overline
+
+ def set_one_half(self, one_half):
+ r"""
+ Set the way one half is displayed.
+
+ one_half : str, default: r"\frac{1}{2}"
+ The string used to represent 1/2.
+ """
+ self._one_half = one_half
+
+ def set_minor_threshold(self, minor_threshold):
+ """
+ Set the threshold for labelling minors ticks.
+
+ Parameters
+ ----------
+ minor_threshold : int
+ Maximum number of locations for labelling some minor ticks. This
+ parameter have no effect if minor is False.
+ """
+ self._minor_threshold = minor_threshold
+
+ def set_minor_number(self, minor_number):
+ """
+ Set the number of minor ticks to label when some minor ticks are
+ labelled.
+
+ Parameters
+ ----------
+ minor_number : int
+ Number of ticks which are labelled when the number of ticks is
+ below the threshold.
+ """
+ self._minor_number = minor_number
+
+ def set_locs(self, locs):
+ self.locs = np.array(locs)
+ self._labelled.clear()
+
+ if not self._minor:
+ return None
+ if all(
+ is_decade(x, rtol=1e-7)
+ or is_decade(1 - x, rtol=1e-7)
+ or (is_close_to_int(2 * x) and int(np.round(2 * x)) == 1)
+ for x in locs
+ ):
+ # minor ticks are subsample from ideal, so no label
+ return None
+ if len(locs) < self._minor_threshold:
+ if len(locs) < self._minor_number:
+ self._labelled.update(locs)
+ else:
+ # we do not have a lot of minor ticks, so only few decades are
+ # displayed, then we choose some (spaced) minor ticks to label.
+ # Only minor ticks are known, we assume it is sufficient to
+ # choice which ticks are displayed.
+ # For each ticks we compute the distance between the ticks and
+ # the previous, and between the ticks and the next one. Ticks
+ # with smallest minimum are chosen. As tiebreak, the ticks
+ # with smallest sum is chosen.
+ diff = np.diff(-np.log(1 / self.locs - 1))
+ space_pessimistic = np.minimum(
+ np.concatenate(((np.inf,), diff)),
+ np.concatenate((diff, (np.inf,))),
+ )
+ space_sum = (
+ np.concatenate(((0,), diff))
+ + np.concatenate((diff, (0,)))
+ )
+ good_minor = sorted(
+ range(len(self.locs)),
+ key=lambda i: (space_pessimistic[i], space_sum[i]),
+ )[-self._minor_number:]
+ self._labelled.update(locs[i] for i in good_minor)
+
+ def _format_value(self, x, locs, sci_notation=True):
+ if sci_notation:
+ exponent = math.floor(np.log10(x))
+ min_precision = 0
+ else:
+ exponent = 0
+ min_precision = 1
+ value = x * 10 ** (-exponent)
+ if len(locs) < 2:
+ precision = min_precision
+ else:
+ diff = np.sort(np.abs(locs - x))[1]
+ precision = -np.log10(diff) + exponent
+ precision = (
+ int(np.round(precision))
+ if is_close_to_int(precision)
+ else math.ceil(precision)
+ )
+ if precision < min_precision:
+ precision = min_precision
+ mantissa = r"%.*f" % (precision, value)
+ if not sci_notation:
+ return mantissa
+ s = r"%s\cdot10^{%d}" % (mantissa, exponent)
+ return s
+
+ def _one_minus(self, s):
+ if self._use_overline:
+ return r"\overline{%s}" % s
+ else:
+ return "1-{}".format(s)
+
+ def __call__(self, x, pos=None):
+ if self._minor and x not in self._labelled:
+ return ""
+ if x <= 0 or x >= 1:
+ return ""
+ if is_close_to_int(2 * x) and round(2 * x) == 1:
+ s = self._one_half
+ elif x < 0.5 and is_decade(x, rtol=1e-7):
+ exponent = round(np.log10(x))
+ s = "10^{%d}" % exponent
+ elif x > 0.5 and is_decade(1 - x, rtol=1e-7):
+ exponent = round(np.log10(1 - x))
+ s = self._one_minus("10^{%d}" % exponent)
+ elif x < 0.1:
+ s = self._format_value(x, self.locs)
+ elif x > 0.9:
+ s = self._one_minus(self._format_value(1-x, 1-self.locs))
+ else:
+ s = self._format_value(x, self.locs, sci_notation=False)
+ return r"$\mathdefault{%s}$" % s
+
+ def format_data_short(self, value):
+ # docstring inherited
+ # Thresholds chosen to use scientific notation iff exponent <= -2.
+ if value < 0.1:
+ return "{:e}".format(value)
+ if value < 0.9:
+ return "{:f}".format(value)
+ return "1-{:e}".format(1 - value)
+
+
+class EngFormatter(Formatter):
+ """
+ Format axis values using engineering prefixes to represent powers
+ of 1000, plus a specified unit, e.g., 10 MHz instead of 1e7.
+ """
+
+ # The SI engineering prefixes
+ ENG_PREFIXES = {
+ -24: "y",
+ -21: "z",
+ -18: "a",
+ -15: "f",
+ -12: "p",
+ -9: "n",
+ -6: "\N{MICRO SIGN}",
+ -3: "m",
+ 0: "",
+ 3: "k",
+ 6: "M",
+ 9: "G",
+ 12: "T",
+ 15: "P",
+ 18: "E",
+ 21: "Z",
+ 24: "Y"
+ }
+
+ def __init__(self, unit="", places=None, sep=" ", *, usetex=None,
+ useMathText=None):
+ r"""
+ Parameters
+ ----------
+ unit : str, default: ""
+ Unit symbol to use, suitable for use with single-letter
+ representations of powers of 1000. For example, 'Hz' or 'm'.
+
+ places : int, default: None
+ Precision with which to display the number, specified in
+ digits after the decimal point (there will be between one
+ and three digits before the decimal point). If it is None,
+ the formatting falls back to the floating point format '%g',
+ which displays up to 6 *significant* digits, i.e. the equivalent
+ value for *places* varies between 0 and 5 (inclusive).
+
+ sep : str, default: " "
+ Separator used between the value and the prefix/unit. For
+ example, one get '3.14 mV' if ``sep`` is " " (default) and
+ '3.14mV' if ``sep`` is "". Besides the default behavior, some
+ other useful options may be:
+
+ * ``sep=""`` to append directly the prefix/unit to the value;
+ * ``sep="\N{THIN SPACE}"`` (``U+2009``);
+ * ``sep="\N{NARROW NO-BREAK SPACE}"`` (``U+202F``);
+ * ``sep="\N{NO-BREAK SPACE}"`` (``U+00A0``).
+
+ usetex : bool, default: :rc:`text.usetex`
+ To enable/disable the use of TeX's math mode for rendering the
+ numbers in the formatter.
+
+ useMathText : bool, default: :rc:`axes.formatter.use_mathtext`
+ To enable/disable the use mathtext for rendering the numbers in
+ the formatter.
+ """
+ self.unit = unit
+ self.places = places
+ self.sep = sep
+ self.set_usetex(usetex)
+ self.set_useMathText(useMathText)
+
+ def get_usetex(self):
+ return self._usetex
+
+ def set_usetex(self, val):
+ if val is None:
+ self._usetex = mpl.rcParams['text.usetex']
+ else:
+ self._usetex = val
+
+ usetex = property(fget=get_usetex, fset=set_usetex)
+
+ def get_useMathText(self):
+ return self._useMathText
+
+ def set_useMathText(self, val):
+ if val is None:
+ self._useMathText = mpl.rcParams['axes.formatter.use_mathtext']
+ else:
+ self._useMathText = val
+
+ useMathText = property(fget=get_useMathText, fset=set_useMathText)
+
+ def __call__(self, x, pos=None):
+ s = "%s%s" % (self.format_eng(x), self.unit)
+ # Remove the trailing separator when there is neither prefix nor unit
+ if self.sep and s.endswith(self.sep):
+ s = s[:-len(self.sep)]
+ return self.fix_minus(s)
+
+ def format_eng(self, num):
+ """
+ Format a number in engineering notation, appending a letter
+ representing the power of 1000 of the original number.
+ Some examples:
+
+ >>> format_eng(0) # for self.places = 0
+ '0'
+
+ >>> format_eng(1000000) # for self.places = 1
+ '1.0 M'
+
+ >>> format_eng("-1e-6") # for self.places = 2
+ '-1.00 \N{MICRO SIGN}'
+ """
+ sign = 1
+ fmt = "g" if self.places is None else ".{:d}f".format(self.places)
+
+ if num < 0:
+ sign = -1
+ num = -num
+
+ if num != 0:
+ pow10 = int(math.floor(math.log10(num) / 3) * 3)
+ else:
+ pow10 = 0
+ # Force num to zero, to avoid inconsistencies like
+ # format_eng(-0) = "0" and format_eng(0.0) = "0"
+ # but format_eng(-0.0) = "-0.0"
+ num = 0.0
+
+ pow10 = np.clip(pow10, min(self.ENG_PREFIXES), max(self.ENG_PREFIXES))
+
+ mant = sign * num / (10.0 ** pow10)
+ # Taking care of the cases like 999.9..., which may be rounded to 1000
+ # instead of 1 k. Beware of the corner case of values that are beyond
+ # the range of SI prefixes (i.e. > 'Y').
+ if (abs(float(format(mant, fmt))) >= 1000
+ and pow10 < max(self.ENG_PREFIXES)):
+ mant /= 1000
+ pow10 += 3
+
+ prefix = self.ENG_PREFIXES[int(pow10)]
+ if self._usetex or self._useMathText:
+ formatted = "${mant:{fmt}}${sep}{prefix}".format(
+ mant=mant, sep=self.sep, prefix=prefix, fmt=fmt)
+ else:
+ formatted = "{mant:{fmt}}{sep}{prefix}".format(
+ mant=mant, sep=self.sep, prefix=prefix, fmt=fmt)
+
+ return formatted
+
+
+class PercentFormatter(Formatter):
+ """
+ Format numbers as a percentage.
+
+ Parameters
+ ----------
+ xmax : float
+ Determines how the number is converted into a percentage.
+ *xmax* is the data value that corresponds to 100%.
+ Percentages are computed as ``x / xmax * 100``. So if the data is
+ already scaled to be percentages, *xmax* will be 100. Another common
+ situation is where *xmax* is 1.0.
+
+ decimals : None or int
+ The number of decimal places to place after the point.
+ If *None* (the default), the number will be computed automatically.
+
+ symbol : str or None
+ A string that will be appended to the label. It may be
+ *None* or empty to indicate that no symbol should be used. LaTeX
+ special characters are escaped in *symbol* whenever latex mode is
+ enabled, unless *is_latex* is *True*.
+
+ is_latex : bool
+ If *False*, reserved LaTeX characters in *symbol* will be escaped.
+ """
+ def __init__(self, xmax=100, decimals=None, symbol='%', is_latex=False):
+ self.xmax = xmax + 0.0
+ self.decimals = decimals
+ self._symbol = symbol
+ self._is_latex = is_latex
+
+ def __call__(self, x, pos=None):
+ """Format the tick as a percentage with the appropriate scaling."""
+ ax_min, ax_max = self.axis.get_view_interval()
+ display_range = abs(ax_max - ax_min)
+ return self.fix_minus(self.format_pct(x, display_range))
+
+ def format_pct(self, x, display_range):
+ """
+ Format the number as a percentage number with the correct
+ number of decimals and adds the percent symbol, if any.
+
+ If ``self.decimals`` is `None`, the number of digits after the
+ decimal point is set based on the *display_range* of the axis
+ as follows:
+
+ +---------------+----------+------------------------+
+ | display_range | decimals | sample |
+ +---------------+----------+------------------------+
+ | >50 | 0 | ``x = 34.5`` => 35% |
+ +---------------+----------+------------------------+
+ | >5 | 1 | ``x = 34.5`` => 34.5% |
+ +---------------+----------+------------------------+
+ | >0.5 | 2 | ``x = 34.5`` => 34.50% |
+ +---------------+----------+------------------------+
+ | ... | ... | ... |
+ +---------------+----------+------------------------+
+
+ This method will not be very good for tiny axis ranges or
+ extremely large ones. It assumes that the values on the chart
+ are percentages displayed on a reasonable scale.
+ """
+ x = self.convert_to_pct(x)
+ if self.decimals is None:
+ # conversion works because display_range is a difference
+ scaled_range = self.convert_to_pct(display_range)
+ if scaled_range <= 0:
+ decimals = 0
+ else:
+ # Luckily Python's built-in ceil rounds to +inf, not away from
+ # zero. This is very important since the equation for decimals
+ # starts out as `scaled_range > 0.5 * 10**(2 - decimals)`
+ # and ends up with `decimals > 2 - log10(2 * scaled_range)`.
+ decimals = math.ceil(2.0 - math.log10(2.0 * scaled_range))
+ if decimals > 5:
+ decimals = 5
+ elif decimals < 0:
+ decimals = 0
+ else:
+ decimals = self.decimals
+ s = '{x:0.{decimals}f}'.format(x=x, decimals=int(decimals))
+
+ return s + self.symbol
+
+ def convert_to_pct(self, x):
+ return 100.0 * (x / self.xmax)
+
+ @property
+ def symbol(self):
+ r"""
+ The configured percent symbol as a string.
+
+ If LaTeX is enabled via :rc:`text.usetex`, the special characters
+ ``{'#', '$', '%', '&', '~', '_', '^', '\', '{', '}'}`` are
+ automatically escaped in the string.
+ """
+ symbol = self._symbol
+ if not symbol:
+ symbol = ''
+ elif mpl.rcParams['text.usetex'] and not self._is_latex:
+ # Source: http://www.personal.ceu.hu/tex/specchar.htm
+ # Backslash must be first for this to work correctly since
+ # it keeps getting added in
+ for spec in r'\#$%&~_^{}':
+ symbol = symbol.replace(spec, '\\' + spec)
+ return symbol
+
+ @symbol.setter
+ def symbol(self, symbol):
+ self._symbol = symbol
+
+
+def _if_refresh_overridden_call_and_emit_deprec(locator):
+ if not locator.refresh.__func__.__module__.startswith("matplotlib."):
+ cbook.warn_external(
+ "3.3", message="Automatic calls to Locator.refresh by the draw "
+ "machinery are deprecated since %(since)s and will be removed in "
+ "%(removal)s. You are using a third-party locator that overrides "
+ "the refresh() method; this locator should instead perform any "
+ "required processing in __call__().")
+ with _api.suppress_matplotlib_deprecation_warning():
+ locator.refresh()
+
+
+class Locator(TickHelper):
+ """
+ Determine the tick locations;
+
+ Note that the same locator should not be used across multiple
+ `~matplotlib.axis.Axis` because the locator stores references to the Axis
+ data and view limits.
+ """
+
+ # Some automatic tick locators can generate so many ticks they
+ # kill the machine when you try and render them.
+ # This parameter is set to cause locators to raise an error if too
+ # many ticks are generated.
+ MAXTICKS = 1000
+
+ def tick_values(self, vmin, vmax):
+ """
+ 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 :attr:`axis` simply call
+ the Locator instance::
+
+ >>> print(type(loc))
+
+ >>> print(loc())
+ [1, 2, 3, 4]
+
+ """
+ raise NotImplementedError('Derived must override')
+
+ def set_params(self, **kwargs):
+ """
+ Do nothing, and raise a warning. Any locator class not supporting the
+ set_params() function will call this.
+ """
+ _api.warn_external(
+ "'set_params()' not defined for locator of type " +
+ str(type(self)))
+
+ def __call__(self):
+ """Return the locations of the ticks."""
+ # note: some locators return data limits, other return view limits,
+ # hence there is no *one* interface to call self.tick_values.
+ raise NotImplementedError('Derived must override')
+
+ def raise_if_exceeds(self, locs):
+ """
+ Log at WARNING level if *locs* is longer than `Locator.MAXTICKS`.
+
+ This is intended to be called immediately before returning *locs* from
+ ``__call__`` to inform users in case their Locator returns a huge
+ number of ticks, causing Matplotlib to run out of memory.
+
+ The "strange" name of this method dates back to when it would raise an
+ exception instead of emitting a log.
+ """
+ if len(locs) >= self.MAXTICKS:
+ _log.warning(
+ "Locator attempting to generate %s ticks ([%s, ..., %s]), "
+ "which exceeds Locator.MAXTICKS (%s).",
+ len(locs), locs[0], locs[-1], self.MAXTICKS)
+ return locs
+
+ def nonsingular(self, v0, v1):
+ """
+ Adjust a range as needed to avoid singularities.
+
+ This method gets called during autoscaling, with ``(v0, v1)`` set to
+ the data limits on the axes if the axes contains any data, or
+ ``(-inf, +inf)`` if not.
+
+ - If ``v0 == v1`` (possibly up to some floating point slop), this
+ method returns an expanded interval around this value.
+ - If ``(v0, v1) == (-inf, +inf)``, this method returns appropriate
+ default view limits.
+ - Otherwise, ``(v0, v1)`` is returned without modification.
+ """
+ return mtransforms.nonsingular(v0, v1, expander=.05)
+
+ def view_limits(self, vmin, vmax):
+ """
+ Select a scale for the range from vmin to vmax.
+
+ Subclasses should override this method to change locator behaviour.
+ """
+ return mtransforms.nonsingular(vmin, vmax)
+
+ @_api.deprecated("3.3")
+ def pan(self, numsteps):
+ """Pan numticks (can be positive or negative)"""
+ ticks = self()
+ numticks = len(ticks)
+
+ vmin, vmax = self.axis.get_view_interval()
+ vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander=0.05)
+ if numticks > 2:
+ step = numsteps * abs(ticks[0] - ticks[1])
+ else:
+ d = abs(vmax - vmin)
+ step = numsteps * d / 6.
+
+ vmin += step
+ vmax += step
+ self.axis.set_view_interval(vmin, vmax, ignore=True)
+
+ @_api.deprecated("3.3")
+ def zoom(self, direction):
+ """Zoom in/out on axis; if direction is >0 zoom in, else zoom out."""
+
+ vmin, vmax = self.axis.get_view_interval()
+ vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander=0.05)
+ interval = abs(vmax - vmin)
+ step = 0.1 * interval * direction
+ self.axis.set_view_interval(vmin + step, vmax - step, ignore=True)
+
+ @_api.deprecated("3.3")
+ def refresh(self):
+ """Refresh internal information based on current limits."""
+
+
+class IndexLocator(Locator):
+ """
+ Place a tick on every multiple of some base number of points
+ plotted, e.g., on every 5th point. It is assumed that you are doing
+ index plotting; i.e., the axis is 0, len(data). This is mainly
+ useful for x ticks.
+ """
+ def __init__(self, base, offset):
+ """Place ticks every *base* data point, starting at *offset*."""
+ self._base = base
+ self.offset = offset
+
+ def set_params(self, base=None, offset=None):
+ """Set parameters within this locator"""
+ if base is not None:
+ self._base = base
+ if offset is not None:
+ self.offset = offset
+
+ def __call__(self):
+ """Return the locations of the ticks"""
+ dmin, dmax = self.axis.get_data_interval()
+ return self.tick_values(dmin, dmax)
+
+ def tick_values(self, vmin, vmax):
+ return self.raise_if_exceeds(
+ np.arange(vmin + self.offset, vmax + 1, self._base))
+
+
+class FixedLocator(Locator):
+ """
+ Tick locations are fixed. If nbins is not None,
+ the array of possible positions will be subsampled to
+ keep the number of ticks <= nbins +1.
+ The subsampling will be done so as to include the smallest
+ absolute value; for example, if zero is included in the
+ array of possibilities, then it is guaranteed to be one of
+ the chosen ticks.
+ """
+
+ def __init__(self, locs, nbins=None):
+ self.locs = np.asarray(locs)
+ self.nbins = max(nbins, 2) if nbins is not None else None
+
+ def set_params(self, nbins=None):
+ """Set parameters within this locator."""
+ if nbins is not None:
+ self.nbins = nbins
+
+ def __call__(self):
+ return self.tick_values(None, None)
+
+ def tick_values(self, vmin, vmax):
+ """
+ Return the locations of the ticks.
+
+ .. note::
+
+ Because the values are fixed, vmin and vmax are not used in this
+ method.
+
+ """
+ if self.nbins is None:
+ return self.locs
+ step = max(int(np.ceil(len(self.locs) / self.nbins)), 1)
+ ticks = self.locs[::step]
+ for i in range(1, step):
+ ticks1 = self.locs[i::step]
+ if np.abs(ticks1).min() < np.abs(ticks).min():
+ ticks = ticks1
+ return self.raise_if_exceeds(ticks)
+
+
+class NullLocator(Locator):
+ """
+ No ticks
+ """
+
+ def __call__(self):
+ return self.tick_values(None, None)
+
+ def tick_values(self, vmin, vmax):
+ """
+ Return the locations of the ticks.
+
+ .. note::
+
+ Because the values are Null, vmin and vmax are not used in this
+ method.
+ """
+ return []
+
+
+class LinearLocator(Locator):
+ """
+ Determine the tick locations
+
+ The first time this function is called it will try to set the
+ number of ticks to make a nice tick partitioning. Thereafter the
+ number of ticks will be fixed so that interactive navigation will
+ be nice
+
+ """
+ def __init__(self, numticks=None, presets=None):
+ """
+ Use presets to set locs based on lom. A dict mapping vmin, vmax->locs
+ """
+ self.numticks = numticks
+ if presets is None:
+ self.presets = {}
+ else:
+ self.presets = presets
+
+ @property
+ def numticks(self):
+ # Old hard-coded default.
+ return self._numticks if self._numticks is not None else 11
+
+ @numticks.setter
+ def numticks(self, numticks):
+ self._numticks = numticks
+
+ def set_params(self, numticks=None, presets=None):
+ """Set parameters within this locator."""
+ if presets is not None:
+ self.presets = presets
+ if numticks is not None:
+ self.numticks = numticks
+
+ def __call__(self):
+ """Return the locations of the ticks."""
+ vmin, vmax = self.axis.get_view_interval()
+ return self.tick_values(vmin, vmax)
+
+ def tick_values(self, vmin, vmax):
+ vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander=0.05)
+ if vmax < vmin:
+ vmin, vmax = vmax, vmin
+
+ if (vmin, vmax) in self.presets:
+ return self.presets[(vmin, vmax)]
+
+ if self.numticks == 0:
+ return []
+ ticklocs = np.linspace(vmin, vmax, self.numticks)
+
+ return self.raise_if_exceeds(ticklocs)
+
+ def view_limits(self, vmin, vmax):
+ """Try to choose the view limits intelligently."""
+
+ if vmax < vmin:
+ vmin, vmax = vmax, vmin
+
+ if vmin == vmax:
+ vmin -= 1
+ vmax += 1
+
+ if mpl.rcParams['axes.autolimit_mode'] == 'round_numbers':
+ exponent, remainder = divmod(
+ math.log10(vmax - vmin), math.log10(max(self.numticks - 1, 1)))
+ exponent -= (remainder < .5)
+ scale = max(self.numticks - 1, 1) ** (-exponent)
+ vmin = math.floor(scale * vmin) / scale
+ vmax = math.ceil(scale * vmax) / scale
+
+ return mtransforms.nonsingular(vmin, vmax)
+
+
+class MultipleLocator(Locator):
+ """
+ Set a tick on each integer multiple of a base within the view interval.
+ """
+
+ def __init__(self, base=1.0):
+ self._edge = _Edge_integer(base, 0)
+
+ def set_params(self, base):
+ """Set parameters within this locator."""
+ if base is not None:
+ self._edge = _Edge_integer(base, 0)
+
+ def __call__(self):
+ """Return the locations of the ticks."""
+ vmin, vmax = self.axis.get_view_interval()
+ return self.tick_values(vmin, vmax)
+
+ def tick_values(self, vmin, vmax):
+ if vmax < vmin:
+ vmin, vmax = vmax, vmin
+ step = self._edge.step
+ vmin = self._edge.ge(vmin) * step
+ n = (vmax - vmin + 0.001 * step) // step
+ locs = vmin - step + np.arange(n + 3) * step
+ return self.raise_if_exceeds(locs)
+
+ def view_limits(self, dmin, dmax):
+ """
+ Set the view limits to the nearest multiples of base that
+ contain the data.
+ """
+ if mpl.rcParams['axes.autolimit_mode'] == 'round_numbers':
+ vmin = self._edge.le(dmin) * self._edge.step
+ vmax = self._edge.ge(dmax) * self._edge.step
+ if vmin == vmax:
+ vmin -= 1
+ vmax += 1
+ else:
+ vmin = dmin
+ vmax = dmax
+
+ return mtransforms.nonsingular(vmin, vmax)
+
+
+def scale_range(vmin, vmax, n=1, threshold=100):
+ dv = abs(vmax - vmin) # > 0 as nonsingular is called before.
+ meanv = (vmax + vmin) / 2
+ if abs(meanv) / dv < threshold:
+ offset = 0
+ else:
+ offset = math.copysign(10 ** (math.log10(abs(meanv)) // 1), meanv)
+ scale = 10 ** (math.log10(dv / n) // 1)
+ return scale, offset
+
+
+class _Edge_integer:
+ """
+ Helper for MaxNLocator, MultipleLocator, etc.
+
+ Take floating point precision limitations into account when calculating
+ tick locations as integer multiples of a step.
+ """
+ def __init__(self, step, offset):
+ """
+ *step* is a positive floating-point interval between ticks.
+ *offset* is the offset subtracted from the data limits
+ prior to calculating tick locations.
+ """
+ if step <= 0:
+ raise ValueError("'step' must be positive")
+ self.step = step
+ self._offset = abs(offset)
+
+ def closeto(self, ms, edge):
+ # Allow more slop when the offset is large compared to the step.
+ if self._offset > 0:
+ digits = np.log10(self._offset / self.step)
+ tol = max(1e-10, 10 ** (digits - 12))
+ tol = min(0.4999, tol)
+ else:
+ tol = 1e-10
+ return abs(ms - edge) < tol
+
+ def le(self, x):
+ """Return the largest n: n*step <= x."""
+ d, m = divmod(x, self.step)
+ if self.closeto(m / self.step, 1):
+ return d + 1
+ return d
+
+ def ge(self, x):
+ """Return the smallest n: n*step >= x."""
+ d, m = divmod(x, self.step)
+ if self.closeto(m / self.step, 0):
+ return d
+ return d + 1
+
+
+class MaxNLocator(Locator):
+ """
+ Find nice tick locations with no more than N being within the view limits.
+ Locations beyond the limits are added to support autoscaling.
+ """
+ default_params = dict(nbins=10,
+ steps=None,
+ integer=False,
+ symmetric=False,
+ prune=None,
+ min_n_ticks=2)
+
+ def __init__(self, *args, **kwargs):
+ """
+ Parameters
+ ----------
+ nbins : int or 'auto', default: 10
+ Maximum number of intervals; one less than max number of
+ ticks. If the string 'auto', the number of bins will be
+ automatically determined based on the length of the axis.
+
+ steps : array-like, optional
+ Sequence of nice numbers starting with 1 and ending with 10;
+ e.g., [1, 2, 4, 5, 10], where the values are acceptable
+ tick multiples. i.e. for the example, 20, 40, 60 would be
+ an acceptable set of ticks, as would 0.4, 0.6, 0.8, because
+ they are multiples of 2. However, 30, 60, 90 would not
+ be allowed because 3 does not appear in the list of steps.
+
+ integer : bool, default: False
+ If True, ticks will take only integer values, provided at least
+ *min_n_ticks* integers are found within the view limits.
+
+ symmetric : bool, default: False
+ If True, autoscaling will result in a range symmetric about zero.
+
+ prune : {'lower', 'upper', 'both', None}, default: None
+ Remove edge ticks -- useful for stacked or ganged plots where
+ the upper tick of one axes overlaps with the lower tick of the
+ axes above it, primarily when :rc:`axes.autolimit_mode` is
+ ``'round_numbers'``. If ``prune=='lower'``, the smallest tick will
+ be removed. If ``prune == 'upper'``, the largest tick will be
+ removed. If ``prune == 'both'``, the largest and smallest ticks
+ will be removed. If *prune* is *None*, no ticks will be removed.
+
+ min_n_ticks : int, default: 2
+ Relax *nbins* and *integer* constraints if necessary to obtain
+ this minimum number of ticks.
+ """
+ if args:
+ if 'nbins' in kwargs:
+ _api.deprecated("3.1",
+ message='Calling MaxNLocator with positional '
+ 'and keyword parameter *nbins* is '
+ 'considered an error and will fail '
+ 'in future versions of matplotlib.')
+ kwargs['nbins'] = args[0]
+ if len(args) > 1:
+ raise ValueError(
+ "Keywords are required for all arguments except 'nbins'")
+ self.set_params(**{**self.default_params, **kwargs})
+
+ @staticmethod
+ def _validate_steps(steps):
+ if not np.iterable(steps):
+ raise ValueError('steps argument must be an increasing sequence '
+ 'of numbers between 1 and 10 inclusive')
+ steps = np.asarray(steps)
+ if np.any(np.diff(steps) <= 0) or steps[-1] > 10 or steps[0] < 1:
+ raise ValueError('steps argument must be an increasing sequence '
+ 'of numbers between 1 and 10 inclusive')
+ if steps[0] != 1:
+ steps = np.concatenate([[1], steps])
+ if steps[-1] != 10:
+ steps = np.concatenate([steps, [10]])
+ return steps
+
+ @staticmethod
+ def _staircase(steps):
+ # Make an extended staircase within which the needed step will be
+ # found. This is probably much larger than necessary.
+ return np.concatenate([0.1 * steps[:-1], steps, [10 * steps[1]]])
+
+ def set_params(self, **kwargs):
+ """
+ Set parameters for this locator.
+
+ Parameters
+ ----------
+ nbins : int or 'auto', optional
+ see `.MaxNLocator`
+ steps : array-like, optional
+ see `.MaxNLocator`
+ integer : bool, optional
+ see `.MaxNLocator`
+ symmetric : bool, optional
+ see `.MaxNLocator`
+ prune : {'lower', 'upper', 'both', None}, optional
+ see `.MaxNLocator`
+ min_n_ticks : int, optional
+ see `.MaxNLocator`
+ """
+ if 'nbins' in kwargs:
+ self._nbins = kwargs.pop('nbins')
+ if self._nbins != 'auto':
+ self._nbins = int(self._nbins)
+ if 'symmetric' in kwargs:
+ self._symmetric = kwargs.pop('symmetric')
+ if 'prune' in kwargs:
+ prune = kwargs.pop('prune')
+ _api.check_in_list(['upper', 'lower', 'both', None], prune=prune)
+ self._prune = prune
+ if 'min_n_ticks' in kwargs:
+ self._min_n_ticks = max(1, kwargs.pop('min_n_ticks'))
+ if 'steps' in kwargs:
+ steps = kwargs.pop('steps')
+ if steps is None:
+ self._steps = np.array([1, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10])
+ else:
+ self._steps = self._validate_steps(steps)
+ self._extended_steps = self._staircase(self._steps)
+ if 'integer' in kwargs:
+ self._integer = kwargs.pop('integer')
+ if kwargs:
+ key, _ = kwargs.popitem()
+ raise TypeError(
+ f"set_params() got an unexpected keyword argument '{key}'")
+
+ def _raw_ticks(self, vmin, vmax):
+ """
+ Generate a list of tick locations including the range *vmin* to
+ *vmax*. In some applications, one or both of the end locations
+ will not be needed, in which case they are trimmed off
+ elsewhere.
+ """
+ if self._nbins == 'auto':
+ if self.axis is not None:
+ nbins = np.clip(self.axis.get_tick_space(),
+ max(1, self._min_n_ticks - 1), 9)
+ else:
+ nbins = 9
+ else:
+ nbins = self._nbins
+
+ scale, offset = scale_range(vmin, vmax, nbins)
+ _vmin = vmin - offset
+ _vmax = vmax - offset
+ raw_step = (_vmax - _vmin) / nbins
+ steps = self._extended_steps * scale
+ if self._integer:
+ # For steps > 1, keep only integer values.
+ igood = (steps < 1) | (np.abs(steps - np.round(steps)) < 0.001)
+ steps = steps[igood]
+
+ istep = np.nonzero(steps >= raw_step)[0][0]
+
+ # Classic round_numbers mode may require a larger step.
+ if mpl.rcParams['axes.autolimit_mode'] == 'round_numbers':
+ for istep in range(istep, len(steps)):
+ step = steps[istep]
+ best_vmin = (_vmin // step) * step
+ best_vmax = best_vmin + step * nbins
+ if best_vmax >= _vmax:
+ break
+
+ # This is an upper limit; move to smaller steps if necessary.
+ for istep in reversed(range(istep + 1)):
+ step = steps[istep]
+
+ if (self._integer and
+ np.floor(_vmax) - np.ceil(_vmin) >= self._min_n_ticks - 1):
+ step = max(1, step)
+ best_vmin = (_vmin // step) * step
+
+ # Find tick locations spanning the vmin-vmax range, taking into
+ # account degradation of precision when there is a large offset.
+ # The edge ticks beyond vmin and/or vmax are needed for the
+ # "round_numbers" autolimit mode.
+ edge = _Edge_integer(step, offset)
+ low = edge.le(_vmin - best_vmin)
+ high = edge.ge(_vmax - best_vmin)
+ ticks = np.arange(low, high + 1) * step + best_vmin
+ # Count only the ticks that will be displayed.
+ nticks = ((ticks <= _vmax) & (ticks >= _vmin)).sum()
+ if nticks >= self._min_n_ticks:
+ break
+ return ticks + offset
+
+ def __call__(self):
+ vmin, vmax = self.axis.get_view_interval()
+ return self.tick_values(vmin, vmax)
+
+ def tick_values(self, vmin, vmax):
+ if self._symmetric:
+ vmax = max(abs(vmin), abs(vmax))
+ vmin = -vmax
+ vmin, vmax = mtransforms.nonsingular(
+ vmin, vmax, expander=1e-13, tiny=1e-14)
+ locs = self._raw_ticks(vmin, vmax)
+
+ prune = self._prune
+ if prune == 'lower':
+ locs = locs[1:]
+ elif prune == 'upper':
+ locs = locs[:-1]
+ elif prune == 'both':
+ locs = locs[1:-1]
+ return self.raise_if_exceeds(locs)
+
+ def view_limits(self, dmin, dmax):
+ if self._symmetric:
+ dmax = max(abs(dmin), abs(dmax))
+ dmin = -dmax
+
+ dmin, dmax = mtransforms.nonsingular(
+ dmin, dmax, expander=1e-12, tiny=1e-13)
+
+ if mpl.rcParams['axes.autolimit_mode'] == 'round_numbers':
+ return self._raw_ticks(dmin, dmax)[[0, -1]]
+ else:
+ return dmin, dmax
+
+
+def is_decade(x, base=10, *, rtol=1e-10):
+ if not np.isfinite(x):
+ return False
+ if x == 0.0:
+ return True
+ lx = np.log(abs(x)) / np.log(base)
+ return is_close_to_int(lx, atol=rtol)
+
+
+def _decade_less_equal(x, base):
+ """
+ Return the largest integer power of *base* that's less or equal to *x*.
+
+ If *x* is negative, the exponent will be *greater*.
+ """
+ return (x if x == 0 else
+ -_decade_greater_equal(-x, base) if x < 0 else
+ base ** np.floor(np.log(x) / np.log(base)))
+
+
+def _decade_greater_equal(x, base):
+ """
+ Return the smallest integer power of *base* that's greater or equal to *x*.
+
+ If *x* is negative, the exponent will be *smaller*.
+ """
+ return (x if x == 0 else
+ -_decade_less_equal(-x, base) if x < 0 else
+ base ** np.ceil(np.log(x) / np.log(base)))
+
+
+def _decade_less(x, base):
+ """
+ Return the largest integer power of *base* that's less than *x*.
+
+ If *x* is negative, the exponent will be *greater*.
+ """
+ if x < 0:
+ return -_decade_greater(-x, base)
+ less = _decade_less_equal(x, base)
+ if less == x:
+ less /= base
+ return less
+
+
+def _decade_greater(x, base):
+ """
+ Return the smallest integer power of *base* that's greater than *x*.
+
+ If *x* is negative, the exponent will be *smaller*.
+ """
+ if x < 0:
+ return -_decade_less(-x, base)
+ greater = _decade_greater_equal(x, base)
+ if greater == x:
+ greater *= base
+ return greater
+
+
+def is_close_to_int(x, *, atol=1e-10):
+ return abs(x - np.round(x)) < atol
+
+
+class LogLocator(Locator):
+ """
+ Determine the tick locations for log axes
+ """
+
+ def __init__(self, base=10.0, subs=(1.0,), numdecs=4, numticks=None):
+ """
+ Place ticks on the locations : subs[j] * base**i
+
+ Parameters
+ ----------
+ base : float, default: 10.0
+ The base of the log used, so ticks are placed at ``base**n``.
+ subs : None or str or sequence of float, default: (1.0,)
+ Gives the multiples of integer powers of the base at which
+ to place ticks. The default places ticks only at
+ integer powers of the base.
+ The permitted string values are ``'auto'`` and ``'all'``,
+ both of which use an algorithm based on the axis view
+ limits to determine whether and how to put ticks between
+ integer powers of the base. With ``'auto'``, ticks are
+ placed only between integer powers; with ``'all'``, the
+ integer powers are included. A value of None is
+ equivalent to ``'auto'``.
+ numticks : None or int, default: None
+ The maximum number of ticks to allow on a given axis. The default
+ of ``None`` will try to choose intelligently as long as this
+ Locator has already been assigned to an axis using
+ `~.axis.Axis.get_tick_space`, but otherwise falls back to 9.
+ """
+ if numticks is None:
+ if mpl.rcParams['_internal.classic_mode']:
+ numticks = 15
+ else:
+ numticks = 'auto'
+ self.base(base)
+ self.subs(subs)
+ self.numdecs = numdecs
+ self.numticks = numticks
+
+ def set_params(self, base=None, subs=None, numdecs=None, numticks=None):
+ """Set parameters within this locator."""
+ if base is not None:
+ self.base(base)
+ if subs is not None:
+ self.subs(subs)
+ if numdecs is not None:
+ self.numdecs = numdecs
+ if numticks is not None:
+ self.numticks = numticks
+
+ # FIXME: these base and subs functions are contrary to our
+ # usual and desired API.
+
+ def base(self, base):
+ """Set the log base (major tick every ``base**i``, i integer)."""
+ self._base = float(base)
+
+ def subs(self, subs):
+ """
+ Set the minor ticks for the log scaling every ``base**i*subs[j]``.
+ """
+ if subs is None: # consistency with previous bad API
+ self._subs = 'auto'
+ elif isinstance(subs, str):
+ _api.check_in_list(('all', 'auto'), subs=subs)
+ self._subs = subs
+ else:
+ try:
+ self._subs = np.asarray(subs, dtype=float)
+ except ValueError as e:
+ raise ValueError("subs must be None, 'all', 'auto' or "
+ "a sequence of floats, not "
+ "{}.".format(subs)) from e
+ if self._subs.ndim != 1:
+ raise ValueError("A sequence passed to subs must be "
+ "1-dimensional, not "
+ "{}-dimensional.".format(self._subs.ndim))
+
+ def __call__(self):
+ """Return the locations of the ticks."""
+ vmin, vmax = self.axis.get_view_interval()
+ return self.tick_values(vmin, vmax)
+
+ def tick_values(self, vmin, vmax):
+ if self.numticks == 'auto':
+ if self.axis is not None:
+ numticks = np.clip(self.axis.get_tick_space(), 2, 9)
+ else:
+ numticks = 9
+ else:
+ numticks = self.numticks
+
+ b = self._base
+ # dummy axis has no axes attribute
+ if hasattr(self.axis, 'axes') and self.axis.axes.name == 'polar':
+ vmax = math.ceil(math.log(vmax) / math.log(b))
+ decades = np.arange(vmax - self.numdecs, vmax)
+ ticklocs = b ** decades
+
+ return ticklocs
+
+ if vmin <= 0.0:
+ if self.axis is not None:
+ vmin = self.axis.get_minpos()
+
+ if vmin <= 0.0 or not np.isfinite(vmin):
+ raise ValueError(
+ "Data has no positive values, and therefore can not be "
+ "log-scaled.")
+
+ _log.debug('vmin %s vmax %s', vmin, vmax)
+
+ if vmax < vmin:
+ vmin, vmax = vmax, vmin
+ log_vmin = math.log(vmin) / math.log(b)
+ log_vmax = math.log(vmax) / math.log(b)
+
+ numdec = math.floor(log_vmax) - math.ceil(log_vmin)
+
+ if isinstance(self._subs, str):
+ _first = 2.0 if self._subs == 'auto' else 1.0
+ if numdec > 10 or b < 3:
+ if self._subs == 'auto':
+ return np.array([]) # no minor or major ticks
+ else:
+ subs = np.array([1.0]) # major ticks
+ else:
+ subs = np.arange(_first, b)
+ else:
+ subs = self._subs
+
+ # Get decades between major ticks.
+ stride = (max(math.ceil(numdec / (numticks - 1)), 1)
+ if mpl.rcParams['_internal.classic_mode'] else
+ (numdec + 1) // numticks + 1)
+
+ # if we have decided that the stride is as big or bigger than
+ # the range, clip the stride back to the available range - 1
+ # with a floor of 1. This prevents getting axis with only 1 tick
+ # visible.
+ if stride >= numdec:
+ stride = max(1, numdec - 1)
+
+ # Does subs include anything other than 1? Essentially a hack to know
+ # whether we're a major or a minor locator.
+ have_subs = len(subs) > 1 or (len(subs) == 1 and subs[0] != 1.0)
+
+ decades = np.arange(math.floor(log_vmin) - stride,
+ math.ceil(log_vmax) + 2 * stride, stride)
+
+ if hasattr(self, '_transform'):
+ ticklocs = self._transform.inverted().transform(decades)
+ if have_subs:
+ if stride == 1:
+ ticklocs = np.ravel(np.outer(subs, ticklocs))
+ else:
+ # No ticklocs if we have >1 decade between major ticks.
+ ticklocs = np.array([])
+ else:
+ if have_subs:
+ if stride == 1:
+ ticklocs = np.concatenate(
+ [subs * decade_start for decade_start in b ** decades])
+ else:
+ ticklocs = np.array([])
+ else:
+ ticklocs = b ** decades
+
+ _log.debug('ticklocs %r', ticklocs)
+ if (len(subs) > 1
+ and stride == 1
+ and ((vmin <= ticklocs) & (ticklocs <= vmax)).sum() <= 1):
+ # If we're a minor locator *that expects at least two ticks per
+ # decade* and the major locator stride is 1 and there's no more
+ # than one minor tick, switch to AutoLocator.
+ return AutoLocator().tick_values(vmin, vmax)
+ else:
+ return self.raise_if_exceeds(ticklocs)
+
+ def view_limits(self, vmin, vmax):
+ """Try to choose the view limits intelligently."""
+ b = self._base
+
+ vmin, vmax = self.nonsingular(vmin, vmax)
+
+ if self.axis.axes.name == 'polar':
+ vmax = math.ceil(math.log(vmax) / math.log(b))
+ vmin = b ** (vmax - self.numdecs)
+
+ if mpl.rcParams['axes.autolimit_mode'] == 'round_numbers':
+ vmin = _decade_less_equal(vmin, self._base)
+ vmax = _decade_greater_equal(vmax, self._base)
+
+ return vmin, vmax
+
+ def nonsingular(self, vmin, vmax):
+ if vmin > vmax:
+ vmin, vmax = vmax, vmin
+ if not np.isfinite(vmin) or not np.isfinite(vmax):
+ vmin, vmax = 1, 10 # Initial range, no data plotted yet.
+ elif vmax <= 0:
+ _api.warn_external(
+ "Data has no positive values, and therefore cannot be "
+ "log-scaled.")
+ vmin, vmax = 1, 10
+ else:
+ minpos = self.axis.get_minpos()
+ if not np.isfinite(minpos):
+ minpos = 1e-300 # This should never take effect.
+ if vmin <= 0:
+ vmin = minpos
+ if vmin == vmax:
+ vmin = _decade_less(vmin, self._base)
+ vmax = _decade_greater(vmax, self._base)
+ return vmin, vmax
+
+
+class SymmetricalLogLocator(Locator):
+ """
+ Determine the tick locations for symmetric log axes.
+ """
+
+ def __init__(self, transform=None, subs=None, linthresh=None, base=None):
+ """
+ Parameters
+ ----------
+ transform : `~.scale.SymmetricalLogTransform`, optional
+ If set, defines the *base* and *linthresh* of the symlog transform.
+ base, linthresh : float, optional
+ The *base* and *linthresh* of the symlog transform, as documented
+ for `.SymmetricalLogScale`. These parameters are only used if
+ *transform* is not set.
+ subs : sequence of float, default: [1]
+ The multiples of integer powers of the base where ticks are placed,
+ i.e., ticks are placed at
+ ``[sub * base**i for i in ... for sub in subs]``.
+
+ Notes
+ -----
+ Either *transform*, or both *base* and *linthresh*, must be given.
+ """
+ if transform is not None:
+ self._base = transform.base
+ self._linthresh = transform.linthresh
+ elif linthresh is not None and base is not None:
+ self._base = base
+ self._linthresh = linthresh
+ else:
+ raise ValueError("Either transform, or both linthresh "
+ "and base, must be provided.")
+ if subs is None:
+ self._subs = [1.0]
+ else:
+ self._subs = subs
+ self.numticks = 15
+
+ def set_params(self, subs=None, numticks=None):
+ """Set parameters within this locator."""
+ if numticks is not None:
+ self.numticks = numticks
+ if subs is not None:
+ self._subs = subs
+
+ def __call__(self):
+ """Return the locations of the ticks."""
+ # Note, these are untransformed coordinates
+ vmin, vmax = self.axis.get_view_interval()
+ return self.tick_values(vmin, vmax)
+
+ def tick_values(self, vmin, vmax):
+ base = self._base
+ linthresh = self._linthresh
+
+ if vmax < vmin:
+ vmin, vmax = vmax, vmin
+
+ # The domain is divided into three sections, only some of
+ # which may actually be present.
+ #
+ # <======== -t ==0== t ========>
+ # aaaaaaaaa bbbbb ccccccccc
+ #
+ # a) and c) will have ticks at integral log positions. The
+ # number of ticks needs to be reduced if there are more
+ # than self.numticks of them.
+ #
+ # b) has a tick at 0 and only 0 (we assume t is a small
+ # number, and the linear segment is just an implementation
+ # detail and not interesting.)
+ #
+ # We could also add ticks at t, but that seems to usually be
+ # uninteresting.
+ #
+ # "simple" mode is when the range falls entirely within (-t,
+ # t) -- it should just display (vmin, 0, vmax)
+ if -linthresh < vmin < vmax < linthresh:
+ # only the linear range is present
+ return [vmin, vmax]
+
+ # Lower log range is present
+ has_a = (vmin < -linthresh)
+ # Upper log range is present
+ has_c = (vmax > linthresh)
+
+ # Check if linear range is present
+ has_b = (has_a and vmax > -linthresh) or (has_c and vmin < linthresh)
+
+ def get_log_range(lo, hi):
+ lo = np.floor(np.log(lo) / np.log(base))
+ hi = np.ceil(np.log(hi) / np.log(base))
+ return lo, hi
+
+ # Calculate all the ranges, so we can determine striding
+ a_lo, a_hi = (0, 0)
+ if has_a:
+ a_upper_lim = min(-linthresh, vmax)
+ a_lo, a_hi = get_log_range(abs(a_upper_lim), abs(vmin) + 1)
+
+ c_lo, c_hi = (0, 0)
+ if has_c:
+ c_lower_lim = max(linthresh, vmin)
+ c_lo, c_hi = get_log_range(c_lower_lim, vmax + 1)
+
+ # Calculate the total number of integer exponents in a and c ranges
+ total_ticks = (a_hi - a_lo) + (c_hi - c_lo)
+ if has_b:
+ total_ticks += 1
+ stride = max(total_ticks // (self.numticks - 1), 1)
+
+ decades = []
+ if has_a:
+ decades.extend(-1 * (base ** (np.arange(a_lo, a_hi,
+ stride)[::-1])))
+
+ if has_b:
+ decades.append(0.0)
+
+ if has_c:
+ decades.extend(base ** (np.arange(c_lo, c_hi, stride)))
+
+ # Add the subticks if requested
+ if self._subs is None:
+ subs = np.arange(2.0, base)
+ else:
+ subs = np.asarray(self._subs)
+
+ if len(subs) > 1 or subs[0] != 1.0:
+ ticklocs = []
+ for decade in decades:
+ if decade == 0:
+ ticklocs.append(decade)
+ else:
+ ticklocs.extend(subs * decade)
+ else:
+ ticklocs = decades
+
+ return self.raise_if_exceeds(np.array(ticklocs))
+
+ def view_limits(self, vmin, vmax):
+ """Try to choose the view limits intelligently."""
+ b = self._base
+ if vmax < vmin:
+ vmin, vmax = vmax, vmin
+
+ if mpl.rcParams['axes.autolimit_mode'] == 'round_numbers':
+ vmin = _decade_less_equal(vmin, b)
+ vmax = _decade_greater_equal(vmax, b)
+ if vmin == vmax:
+ vmin = _decade_less(vmin, b)
+ vmax = _decade_greater(vmax, b)
+
+ result = mtransforms.nonsingular(vmin, vmax)
+ return result
+
+
+class LogitLocator(MaxNLocator):
+ """
+ Determine the tick locations for logit axes
+ """
+
+ def __init__(self, minor=False, *, nbins="auto"):
+ """
+ Place ticks on the logit locations
+
+ Parameters
+ ----------
+ nbins : int or 'auto', optional
+ Number of ticks. Only used if minor is False.
+ minor : bool, default: False
+ Indicate if this locator is for minor ticks or not.
+ """
+
+ self._minor = minor
+ super().__init__(nbins=nbins, steps=[1, 2, 5, 10])
+
+ def set_params(self, minor=None, **kwargs):
+ """Set parameters within this locator."""
+ if minor is not None:
+ self._minor = minor
+ super().set_params(**kwargs)
+
+ @property
+ def minor(self):
+ return self._minor
+
+ @minor.setter
+ def minor(self, value):
+ self.set_params(minor=value)
+
+ def tick_values(self, vmin, vmax):
+ # dummy axis has no axes attribute
+ if hasattr(self.axis, "axes") and self.axis.axes.name == "polar":
+ raise NotImplementedError("Polar axis cannot be logit scaled yet")
+
+ if self._nbins == "auto":
+ if self.axis is not None:
+ nbins = self.axis.get_tick_space()
+ if nbins < 2:
+ nbins = 2
+ else:
+ nbins = 9
+ else:
+ nbins = self._nbins
+
+ # We define ideal ticks with their index:
+ # linscale: ... 1e-3 1e-2 1e-1 1/2 1-1e-1 1-1e-2 1-1e-3 ...
+ # b-scale : ... -3 -2 -1 0 1 2 3 ...
+ def ideal_ticks(x):
+ return 10 ** x if x < 0 else 1 - (10 ** (-x)) if x > 0 else 1 / 2
+
+ vmin, vmax = self.nonsingular(vmin, vmax)
+ binf = int(
+ np.floor(np.log10(vmin))
+ if vmin < 0.5
+ else 0
+ if vmin < 0.9
+ else -np.ceil(np.log10(1 - vmin))
+ )
+ bsup = int(
+ np.ceil(np.log10(vmax))
+ if vmax <= 0.5
+ else 1
+ if vmax <= 0.9
+ else -np.floor(np.log10(1 - vmax))
+ )
+ numideal = bsup - binf - 1
+ if numideal >= 2:
+ # have 2 or more wanted ideal ticks, so use them as major ticks
+ if numideal > nbins:
+ # to many ideal ticks, subsampling ideals for major ticks, and
+ # take others for minor ticks
+ subsampling_factor = math.ceil(numideal / nbins)
+ if self._minor:
+ ticklocs = [
+ ideal_ticks(b)
+ for b in range(binf, bsup + 1)
+ if (b % subsampling_factor) != 0
+ ]
+ else:
+ ticklocs = [
+ ideal_ticks(b)
+ for b in range(binf, bsup + 1)
+ if (b % subsampling_factor) == 0
+ ]
+ return self.raise_if_exceeds(np.array(ticklocs))
+ if self._minor:
+ ticklocs = []
+ for b in range(binf, bsup):
+ if b < -1:
+ ticklocs.extend(np.arange(2, 10) * 10 ** b)
+ elif b == -1:
+ ticklocs.extend(np.arange(2, 5) / 10)
+ elif b == 0:
+ ticklocs.extend(np.arange(6, 9) / 10)
+ else:
+ ticklocs.extend(
+ 1 - np.arange(2, 10)[::-1] * 10 ** (-b - 1)
+ )
+ return self.raise_if_exceeds(np.array(ticklocs))
+ ticklocs = [ideal_ticks(b) for b in range(binf, bsup + 1)]
+ return self.raise_if_exceeds(np.array(ticklocs))
+ # the scale is zoomed so same ticks as linear scale can be used
+ if self._minor:
+ return []
+ return super().tick_values(vmin, vmax)
+
+ def nonsingular(self, vmin, vmax):
+ standard_minpos = 1e-7
+ initial_range = (standard_minpos, 1 - standard_minpos)
+ if vmin > vmax:
+ vmin, vmax = vmax, vmin
+ if not np.isfinite(vmin) or not np.isfinite(vmax):
+ vmin, vmax = initial_range # Initial range, no data plotted yet.
+ elif vmax <= 0 or vmin >= 1:
+ # vmax <= 0 occurs when all values are negative
+ # vmin >= 1 occurs when all values are greater than one
+ _api.warn_external(
+ "Data has no values between 0 and 1, and therefore cannot be "
+ "logit-scaled."
+ )
+ vmin, vmax = initial_range
+ else:
+ minpos = (
+ self.axis.get_minpos()
+ if self.axis is not None
+ else standard_minpos
+ )
+ if not np.isfinite(minpos):
+ minpos = standard_minpos # This should never take effect.
+ if vmin <= 0:
+ vmin = minpos
+ # NOTE: for vmax, we should query a property similar to get_minpos,
+ # but related to the maximal, less-than-one data point.
+ # Unfortunately, Bbox._minpos is defined very deep in the BBox and
+ # updated with data, so for now we use 1 - minpos as a substitute.
+ if vmax >= 1:
+ vmax = 1 - minpos
+ if vmin == vmax:
+ vmin, vmax = 0.1 * vmin, 1 - 0.1 * vmin
+
+ return vmin, vmax
+
+
+class AutoLocator(MaxNLocator):
+ """
+ Dynamically find major tick positions. This is actually a subclass
+ of `~matplotlib.ticker.MaxNLocator`, with parameters *nbins = 'auto'*
+ and *steps = [1, 2, 2.5, 5, 10]*.
+ """
+ def __init__(self):
+ """
+ To know the values of the non-public parameters, please have a
+ look to the defaults of `~matplotlib.ticker.MaxNLocator`.
+ """
+ if mpl.rcParams['_internal.classic_mode']:
+ nbins = 9
+ steps = [1, 2, 5, 10]
+ else:
+ nbins = 'auto'
+ steps = [1, 2, 2.5, 5, 10]
+ super().__init__(nbins=nbins, steps=steps)
+
+
+class AutoMinorLocator(Locator):
+ """
+ Dynamically find minor tick positions based on the positions of
+ major ticks. The scale must be linear with major ticks evenly spaced.
+ """
+ def __init__(self, n=None):
+ """
+ *n* is the number of subdivisions of the interval between
+ major ticks; e.g., n=2 will place a single minor tick midway
+ between major ticks.
+
+ If *n* is omitted or None, it will be set to 5 or 4.
+ """
+ self.ndivs = n
+
+ def __call__(self):
+ """Return the locations of the ticks."""
+ if self.axis.get_scale() == 'log':
+ _api.warn_external('AutoMinorLocator does not work with '
+ 'logarithmic scale')
+ return []
+
+ majorlocs = self.axis.get_majorticklocs()
+ try:
+ majorstep = majorlocs[1] - majorlocs[0]
+ except IndexError:
+ # Need at least two major ticks to find minor tick locations
+ # TODO: Figure out a way to still be able to display minor
+ # ticks without two major ticks visible. For now, just display
+ # no ticks at all.
+ return []
+
+ if self.ndivs is None:
+
+ majorstep_no_exponent = 10 ** (np.log10(majorstep) % 1)
+
+ if np.isclose(majorstep_no_exponent, [1.0, 2.5, 5.0, 10.0]).any():
+ ndivs = 5
+ else:
+ ndivs = 4
+ else:
+ ndivs = self.ndivs
+
+ minorstep = majorstep / ndivs
+
+ vmin, vmax = self.axis.get_view_interval()
+ if vmin > vmax:
+ vmin, vmax = vmax, vmin
+
+ t0 = majorlocs[0]
+ tmin = ((vmin - t0) // minorstep + 1) * minorstep
+ tmax = ((vmax - t0) // minorstep + 1) * minorstep
+ locs = np.arange(tmin, tmax, minorstep) + t0
+
+ return self.raise_if_exceeds(locs)
+
+ def tick_values(self, vmin, vmax):
+ raise NotImplementedError('Cannot get tick locations for a '
+ '%s type.' % type(self))
+
+
+@_api.deprecated("3.3")
+class OldAutoLocator(Locator):
+ """
+ On autoscale this class picks the best MultipleLocator to set the
+ view limits and the tick locs.
+ """
+
+ def __call__(self):
+ # docstring inherited
+ vmin, vmax = self.axis.get_view_interval()
+ vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander=0.05)
+ d = abs(vmax - vmin)
+ locator = self.get_locator(d)
+ return self.raise_if_exceeds(locator())
+
+ def tick_values(self, vmin, vmax):
+ raise NotImplementedError('Cannot get tick locations for a '
+ '%s type.' % type(self))
+
+ def view_limits(self, vmin, vmax):
+ # docstring inherited
+ d = abs(vmax - vmin)
+ locator = self.get_locator(d)
+ return locator.view_limits(vmin, vmax)
+
+ def get_locator(self, d):
+ """Pick the best locator based on a distance *d*."""
+ d = abs(d)
+ if d <= 0:
+ locator = MultipleLocator(0.2)
+ else:
+
+ try:
+ ld = math.log10(d)
+ except OverflowError as err:
+ raise RuntimeError('AutoLocator illegal data interval '
+ 'range') from err
+
+ fld = math.floor(ld)
+ base = 10 ** fld
+
+ #if ld==fld: base = 10**(fld-1)
+ #else: base = 10**fld
+
+ if d >= 5 * base:
+ ticksize = base
+ elif d >= 2 * base:
+ ticksize = base / 2.0
+ else:
+ ticksize = base / 5.0
+ locator = MultipleLocator(ticksize)
+
+ return locator
diff --git a/venv/Lib/site-packages/matplotlib/tight_bbox.py b/venv/Lib/site-packages/matplotlib/tight_bbox.py
new file mode 100644
index 0000000..5904ebc
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tight_bbox.py
@@ -0,0 +1,88 @@
+"""
+Helper module for the *bbox_inches* parameter in `.Figure.savefig`.
+"""
+
+from matplotlib.transforms import Bbox, TransformedBbox, Affine2D
+
+
+def adjust_bbox(fig, bbox_inches, fixed_dpi=None):
+ """
+ Temporarily adjust the figure so that only the specified area
+ (bbox_inches) is saved.
+
+ It modifies fig.bbox, fig.bbox_inches,
+ fig.transFigure._boxout, and fig.patch. While the figure size
+ changes, the scale of the original figure is conserved. A
+ function which restores the original values are returned.
+ """
+ origBbox = fig.bbox
+ origBboxInches = fig.bbox_inches
+ orig_tight_layout = fig.get_tight_layout()
+ _boxout = fig.transFigure._boxout
+
+ fig.set_tight_layout(False)
+
+ old_aspect = []
+ locator_list = []
+ sentinel = object()
+ for ax in fig.axes:
+ locator_list.append(ax.get_axes_locator())
+ current_pos = ax.get_position(original=False).frozen()
+ ax.set_axes_locator(lambda a, r, _pos=current_pos: _pos)
+ # override the method that enforces the aspect ratio on the Axes
+ if 'apply_aspect' in ax.__dict__:
+ old_aspect.append(ax.apply_aspect)
+ else:
+ old_aspect.append(sentinel)
+ ax.apply_aspect = lambda pos=None: None
+
+ def restore_bbox():
+ for ax, loc, aspect in zip(fig.axes, locator_list, old_aspect):
+ ax.set_axes_locator(loc)
+ if aspect is sentinel:
+ # delete our no-op function which un-hides the original method
+ del ax.apply_aspect
+ else:
+ ax.apply_aspect = aspect
+
+ fig.bbox = origBbox
+ fig.bbox_inches = origBboxInches
+ fig.set_tight_layout(orig_tight_layout)
+ fig.transFigure._boxout = _boxout
+ fig.transFigure.invalidate()
+ fig.patch.set_bounds(0, 0, 1, 1)
+
+ if fixed_dpi is None:
+ fixed_dpi = fig.dpi
+ tr = Affine2D().scale(fixed_dpi)
+ dpi_scale = fixed_dpi / fig.dpi
+
+ _bbox = TransformedBbox(bbox_inches, tr)
+
+ fig.bbox_inches = Bbox.from_bounds(0, 0,
+ bbox_inches.width, bbox_inches.height)
+ x0, y0 = _bbox.x0, _bbox.y0
+ w1, h1 = fig.bbox.width * dpi_scale, fig.bbox.height * dpi_scale
+ fig.transFigure._boxout = Bbox.from_bounds(-x0, -y0, w1, h1)
+ fig.transFigure.invalidate()
+
+ fig.bbox = TransformedBbox(fig.bbox_inches, tr)
+
+ fig.patch.set_bounds(x0 / w1, y0 / h1,
+ fig.bbox.width / w1, fig.bbox.height / h1)
+
+ return restore_bbox
+
+
+def process_figure_for_rasterizing(fig, bbox_inches_restore, fixed_dpi=None):
+ """
+ A function that needs to be called when figure dpi changes during the
+ drawing (e.g., rasterizing). It recovers the bbox and re-adjust it with
+ the new dpi.
+ """
+
+ bbox_inches, restore_bbox = bbox_inches_restore
+ restore_bbox()
+ r = adjust_bbox(fig, bbox_inches, fixed_dpi)
+
+ return bbox_inches, r
diff --git a/venv/Lib/site-packages/matplotlib/tight_layout.py b/venv/Lib/site-packages/matplotlib/tight_layout.py
new file mode 100644
index 0000000..81eb1e6
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tight_layout.py
@@ -0,0 +1,347 @@
+"""
+Routines to adjust subplot params so that subplots are
+nicely fit in the figure. In doing so, only axis labels, tick labels, axes
+titles and offsetboxes that are anchored to axes are currently considered.
+
+Internally, this module assumes that the margins (left_margin, etc.) which are
+differences between ax.get_tightbbox and ax.bbox are independent of axes
+position. This may fail if Axes.adjustable is datalim. Also, This will fail
+for some cases (for example, left or right margin is affected by xlabel).
+"""
+
+import numpy as np
+
+from matplotlib import _api, rcParams
+from matplotlib.font_manager import FontProperties
+from matplotlib.transforms import TransformedBbox, Bbox
+
+
+def auto_adjust_subplotpars(
+ fig, renderer, nrows_ncols, num1num2_list, subplot_list,
+ ax_bbox_list=None, pad=1.08, h_pad=None, w_pad=None, rect=None):
+ """
+ Return a dict of subplot parameters to adjust spacing between subplots
+ or ``None`` if resulting axes would have zero height or width.
+
+ Note that this function ignores geometry information of subplot
+ itself, but uses what is given by the *nrows_ncols* and *num1num2_list*
+ parameters. Also, the results could be incorrect if some subplots have
+ ``adjustable=datalim``.
+
+ Parameters
+ ----------
+ nrows_ncols : tuple[int, int]
+ Number of rows and number of columns of the grid.
+ num1num2_list : list[int]
+ List of numbers specifying the area occupied by the subplot
+ subplot_list : list of subplots
+ List of subplots that will be used to calculate optimal subplot_params.
+ pad : float
+ Padding between the figure edge and the edges of subplots, as a
+ fraction of the font size.
+ h_pad, w_pad : float
+ Padding (height/width) between edges of adjacent subplots, as a
+ fraction of the font size. Defaults to *pad*.
+ rect : tuple[float, float, float, float]
+ [left, bottom, right, top] in normalized (0, 1) figure coordinates.
+ """
+ rows, cols = nrows_ncols
+
+ font_size_inches = (
+ FontProperties(size=rcParams["font.size"]).get_size_in_points() / 72)
+ pad_inches = pad * font_size_inches
+ vpad_inches = h_pad * font_size_inches if h_pad is not None else pad_inches
+ hpad_inches = w_pad * font_size_inches if w_pad is not None else pad_inches
+
+ if len(num1num2_list) != len(subplot_list) or len(subplot_list) == 0:
+ raise ValueError
+
+ if rect is None:
+ margin_left = margin_bottom = margin_right = margin_top = None
+ else:
+ margin_left, margin_bottom, _right, _top = rect
+ margin_right = 1 - _right if _right else None
+ margin_top = 1 - _top if _top else None
+
+ vspaces = np.zeros((rows + 1, cols))
+ hspaces = np.zeros((rows, cols + 1))
+
+ if ax_bbox_list is None:
+ ax_bbox_list = [
+ Bbox.union([ax.get_position(original=True) for ax in subplots])
+ for subplots in subplot_list]
+
+ for subplots, ax_bbox, (num1, num2) in zip(subplot_list,
+ ax_bbox_list,
+ num1num2_list):
+ if all(not ax.get_visible() for ax in subplots):
+ continue
+
+ bb = []
+ for ax in subplots:
+ if ax.get_visible():
+ try:
+ bb += [ax.get_tightbbox(renderer, for_layout_only=True)]
+ except TypeError:
+ bb += [ax.get_tightbbox(renderer)]
+
+ tight_bbox_raw = Bbox.union(bb)
+ tight_bbox = TransformedBbox(tight_bbox_raw,
+ fig.transFigure.inverted())
+
+ row1, col1 = divmod(num1, cols)
+ if num2 is None:
+ num2 = num1
+ row2, col2 = divmod(num2, cols)
+
+ for row_i in range(row1, row2 + 1):
+ hspaces[row_i, col1] += ax_bbox.xmin - tight_bbox.xmin # left
+ hspaces[row_i, col2 + 1] += tight_bbox.xmax - ax_bbox.xmax # right
+ for col_i in range(col1, col2 + 1):
+ vspaces[row1, col_i] += tight_bbox.ymax - ax_bbox.ymax # top
+ vspaces[row2 + 1, col_i] += ax_bbox.ymin - tight_bbox.ymin # bot.
+
+ fig_width_inch, fig_height_inch = fig.get_size_inches()
+
+ # margins can be negative for axes with aspect applied, so use max(, 0) to
+ # make them nonnegative.
+ if not margin_left:
+ margin_left = (max(hspaces[:, 0].max(), 0)
+ + pad_inches / fig_width_inch)
+ suplabel = fig._supylabel
+ if suplabel and suplabel.get_in_layout():
+ rel_width = fig.transFigure.inverted().transform_bbox(
+ suplabel.get_window_extent(renderer)).width
+ margin_left += rel_width + pad_inches / fig_width_inch
+
+ if not margin_right:
+ margin_right = (max(hspaces[:, -1].max(), 0)
+ + pad_inches / fig_width_inch)
+ if not margin_top:
+ margin_top = (max(vspaces[0, :].max(), 0)
+ + pad_inches / fig_height_inch)
+ if fig._suptitle and fig._suptitle.get_in_layout():
+ rel_height = fig.transFigure.inverted().transform_bbox(
+ fig._suptitle.get_window_extent(renderer)).height
+ margin_top += rel_height + pad_inches / fig_height_inch
+ if not margin_bottom:
+ margin_bottom = (max(vspaces[-1, :].max(), 0)
+ + pad_inches / fig_height_inch)
+ suplabel = fig._supxlabel
+ if suplabel and suplabel.get_in_layout():
+ rel_height = fig.transFigure.inverted().transform_bbox(
+ suplabel.get_window_extent(renderer)).height
+ margin_bottom += rel_height + pad_inches / fig_height_inch
+
+ if margin_left + margin_right >= 1:
+ _api.warn_external('Tight layout not applied. The left and right '
+ 'margins cannot be made large enough to '
+ 'accommodate all axes decorations. ')
+ return None
+ if margin_bottom + margin_top >= 1:
+ _api.warn_external('Tight layout not applied. The bottom and top '
+ 'margins cannot be made large enough to '
+ 'accommodate all axes decorations. ')
+ return None
+
+ kwargs = dict(left=margin_left,
+ right=1 - margin_right,
+ bottom=margin_bottom,
+ top=1 - margin_top)
+
+ if cols > 1:
+ hspace = hspaces[:, 1:-1].max() + hpad_inches / fig_width_inch
+ # axes widths:
+ h_axes = (1 - margin_right - margin_left - hspace * (cols - 1)) / cols
+ if h_axes < 0:
+ _api.warn_external('Tight layout not applied. tight_layout '
+ 'cannot make axes width small enough to '
+ 'accommodate all axes decorations')
+ return None
+ else:
+ kwargs["wspace"] = hspace / h_axes
+ if rows > 1:
+ vspace = vspaces[1:-1, :].max() + vpad_inches / fig_height_inch
+ v_axes = (1 - margin_top - margin_bottom - vspace * (rows - 1)) / rows
+ if v_axes < 0:
+ _api.warn_external('Tight layout not applied. tight_layout '
+ 'cannot make axes height small enough to '
+ 'accommodate all axes decorations')
+ return None
+ else:
+ kwargs["hspace"] = vspace / v_axes
+
+ return kwargs
+
+
+def get_renderer(fig):
+ if fig._cachedRenderer:
+ return fig._cachedRenderer
+ else:
+ canvas = fig.canvas
+ if canvas and hasattr(canvas, "get_renderer"):
+ return canvas.get_renderer()
+ else:
+ from . import backend_bases
+ return backend_bases._get_renderer(fig)
+
+
+def get_subplotspec_list(axes_list, grid_spec=None):
+ """
+ Return a list of subplotspec from the given list of axes.
+
+ For an instance of axes that does not support subplotspec, None is inserted
+ in the list.
+
+ If grid_spec is given, None is inserted for those not from the given
+ grid_spec.
+ """
+ subplotspec_list = []
+ for ax in axes_list:
+ axes_or_locator = ax.get_axes_locator()
+ if axes_or_locator is None:
+ axes_or_locator = ax
+
+ if hasattr(axes_or_locator, "get_subplotspec"):
+ subplotspec = axes_or_locator.get_subplotspec()
+ subplotspec = subplotspec.get_topmost_subplotspec()
+ gs = subplotspec.get_gridspec()
+ if grid_spec is not None:
+ if gs != grid_spec:
+ subplotspec = None
+ elif gs.locally_modified_subplot_params():
+ subplotspec = None
+ else:
+ subplotspec = None
+
+ subplotspec_list.append(subplotspec)
+
+ return subplotspec_list
+
+
+def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer,
+ pad=1.08, h_pad=None, w_pad=None, rect=None):
+ """
+ Return subplot parameters for tight-layouted-figure with specified padding.
+
+ Parameters
+ ----------
+ fig : Figure
+ axes_list : list of Axes
+ subplotspec_list : list of `.SubplotSpec`
+ The subplotspecs of each axes.
+ renderer : renderer
+ pad : float
+ Padding between the figure edge and the edges of subplots, as a
+ fraction of the font size.
+ h_pad, w_pad : float
+ Padding (height/width) between edges of adjacent subplots. Defaults to
+ *pad*.
+ rect : tuple[float, float, float, float], optional
+ (left, bottom, right, top) rectangle in normalized figure coordinates
+ that the whole subplots area (including labels) will fit into.
+ Defaults to using the entire figure.
+
+ Returns
+ -------
+ subplotspec or None
+ subplotspec kwargs to be passed to `.Figure.subplots_adjust` or
+ None if tight_layout could not be accomplished.
+ """
+
+ subplot_list = []
+ nrows_list = []
+ ncols_list = []
+ ax_bbox_list = []
+
+ # Multiple axes can share same subplot_interface (e.g., axes_grid1); thus
+ # we need to join them together.
+ subplot_dict = {}
+
+ subplotspec_list2 = []
+
+ for ax, subplotspec in zip(axes_list, subplotspec_list):
+ if subplotspec is None:
+ continue
+
+ subplots = subplot_dict.setdefault(subplotspec, [])
+
+ if not subplots:
+ myrows, mycols, _, _ = subplotspec.get_geometry()
+ nrows_list.append(myrows)
+ ncols_list.append(mycols)
+ subplotspec_list2.append(subplotspec)
+ subplot_list.append(subplots)
+ ax_bbox_list.append(subplotspec.get_position(fig))
+
+ subplots.append(ax)
+
+ if len(nrows_list) == 0 or len(ncols_list) == 0:
+ return {}
+
+ max_nrows = max(nrows_list)
+ max_ncols = max(ncols_list)
+
+ num1num2_list = []
+ for subplotspec in subplotspec_list2:
+ rows, cols, num1, num2 = subplotspec.get_geometry()
+ div_row, mod_row = divmod(max_nrows, rows)
+ div_col, mod_col = divmod(max_ncols, cols)
+ if mod_row != 0:
+ _api.warn_external('tight_layout not applied: number of rows '
+ 'in subplot specifications must be '
+ 'multiples of one another.')
+ return {}
+ if mod_col != 0:
+ _api.warn_external('tight_layout not applied: number of '
+ 'columns in subplot specifications must be '
+ 'multiples of one another.')
+ return {}
+
+ rowNum1, colNum1 = divmod(num1, cols)
+ if num2 is None:
+ rowNum2, colNum2 = rowNum1, colNum1
+ else:
+ rowNum2, colNum2 = divmod(num2, cols)
+
+ num1num2_list.append((rowNum1 * div_row * max_ncols +
+ colNum1 * div_col,
+ ((rowNum2 + 1) * div_row - 1) * max_ncols +
+ (colNum2 + 1) * div_col - 1))
+
+ kwargs = auto_adjust_subplotpars(fig, renderer,
+ nrows_ncols=(max_nrows, max_ncols),
+ num1num2_list=num1num2_list,
+ subplot_list=subplot_list,
+ ax_bbox_list=ax_bbox_list,
+ pad=pad, h_pad=h_pad, w_pad=w_pad)
+
+ # kwargs can be none if tight_layout fails...
+ if rect is not None and kwargs is not None:
+ # if rect is given, the whole subplots area (including
+ # labels) will fit into the rect instead of the
+ # figure. Note that the rect argument of
+ # *auto_adjust_subplotpars* specify the area that will be
+ # covered by the total area of axes.bbox. Thus we call
+ # auto_adjust_subplotpars twice, where the second run
+ # with adjusted rect parameters.
+
+ left, bottom, right, top = rect
+ if left is not None:
+ left += kwargs["left"]
+ if bottom is not None:
+ bottom += kwargs["bottom"]
+ if right is not None:
+ right -= (1 - kwargs["right"])
+ if top is not None:
+ top -= (1 - kwargs["top"])
+
+ kwargs = auto_adjust_subplotpars(fig, renderer,
+ nrows_ncols=(max_nrows, max_ncols),
+ num1num2_list=num1num2_list,
+ subplot_list=subplot_list,
+ ax_bbox_list=ax_bbox_list,
+ pad=pad, h_pad=h_pad, w_pad=w_pad,
+ rect=(left, bottom, right, top))
+
+ return kwargs
diff --git a/venv/Lib/site-packages/matplotlib/transforms.py b/venv/Lib/site-packages/matplotlib/transforms.py
new file mode 100644
index 0000000..9a50e4b
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/transforms.py
@@ -0,0 +1,2959 @@
+"""
+Matplotlib includes a framework for arbitrary geometric
+transformations that is used determine the final position of all
+elements drawn on the canvas.
+
+Transforms are composed into trees of `TransformNode` objects
+whose actual value depends on their children. When the contents of
+children change, their parents are automatically invalidated. The
+next time an invalidated transform is accessed, it is recomputed to
+reflect those changes. This invalidation/caching approach prevents
+unnecessary recomputations of transforms, and contributes to better
+interactive performance.
+
+For example, here is a graph of the transform tree used to plot data
+to the graph:
+
+.. image:: ../_static/transforms.png
+
+The framework can be used for both affine and non-affine
+transformations. However, for speed, we want use the backend
+renderers to perform affine transformations whenever possible.
+Therefore, it is possible to perform just the affine or non-affine
+part of a transformation on a set of data. The affine is always
+assumed to occur after the non-affine. For any transform::
+
+ full transform == non-affine part + affine part
+
+The backends are not expected to handle non-affine transformations
+themselves.
+"""
+
+# Note: There are a number of places in the code where we use `np.min` or
+# `np.minimum` instead of the builtin `min`, and likewise for `max`. This is
+# done so that `nan`s are propagated, instead of being silently dropped.
+
+import copy
+import functools
+import textwrap
+import weakref
+import math
+
+import numpy as np
+from numpy.linalg import inv
+
+from matplotlib import _api
+from matplotlib._path import (
+ affine_transform, count_bboxes_overlapping_bbox, update_path_extents)
+from .path import Path
+
+DEBUG = False
+
+
+def _make_str_method(*args, **kwargs):
+ """
+ Generate a ``__str__`` method for a `.Transform` subclass.
+
+ After ::
+
+ class T:
+ __str__ = _make_str_method("attr", key="other")
+
+ ``str(T(...))`` will be
+
+ .. code-block:: text
+
+ {type(T).__name__}(
+ {self.attr},
+ key={self.other})
+ """
+ indent = functools.partial(textwrap.indent, prefix=" " * 4)
+ def strrepr(x): return repr(x) if isinstance(x, str) else str(x)
+ return lambda self: (
+ type(self).__name__ + "("
+ + ",".join([*(indent("\n" + strrepr(getattr(self, arg)))
+ for arg in args),
+ *(indent("\n" + k + "=" + strrepr(getattr(self, arg)))
+ for k, arg in kwargs.items())])
+ + ")")
+
+
+class TransformNode:
+ """
+ The base class for anything that participates in the transform tree
+ and needs to invalidate its parents or be invalidated. This includes
+ classes that are not really transforms, such as bounding boxes, since some
+ transforms depend on bounding boxes to compute their values.
+ """
+
+ # Invalidation may affect only the affine part. If the
+ # invalidation was "affine-only", the _invalid member is set to
+ # INVALID_AFFINE_ONLY
+ INVALID_NON_AFFINE = 1
+ INVALID_AFFINE = 2
+ INVALID = INVALID_NON_AFFINE | INVALID_AFFINE
+
+ # Some metadata about the transform, used to determine whether an
+ # invalidation is affine-only
+ is_affine = False
+ is_bbox = False
+
+ pass_through = False
+ """
+ If pass_through is True, all ancestors will always be
+ invalidated, even if 'self' is already invalid.
+ """
+
+ def __init__(self, shorthand_name=None):
+ """
+ Parameters
+ ----------
+ shorthand_name : str
+ A string representing the "name" of the transform. The name carries
+ no significance other than to improve the readability of
+ ``str(transform)`` when DEBUG=True.
+ """
+ self._parents = {}
+
+ # TransformNodes start out as invalid until their values are
+ # computed for the first time.
+ self._invalid = 1
+ self._shorthand_name = shorthand_name or ''
+
+ if DEBUG:
+ def __str__(self):
+ # either just return the name of this TransformNode, or its repr
+ return self._shorthand_name or repr(self)
+
+ def __getstate__(self):
+ # turn the dictionary with weak values into a normal dictionary
+ return {**self.__dict__,
+ '_parents': {k: v() for k, v in self._parents.items()}}
+
+ def __setstate__(self, data_dict):
+ self.__dict__ = data_dict
+ # turn the normal dictionary back into a dictionary with weak values
+ # The extra lambda is to provide a callback to remove dead
+ # weakrefs from the dictionary when garbage collection is done.
+ self._parents = {
+ k: weakref.ref(v, lambda _, pop=self._parents.pop, k=k: pop(k))
+ for k, v in self._parents.items() if v is not None}
+
+ def __copy__(self):
+ other = copy.copy(super())
+ # If `c = a + b; a1 = copy(a)`, then modifications to `a1` do not
+ # propagate back to `c`, i.e. we need to clear the parents of `a1`.
+ other._parents = {}
+ # If `c = a + b; c1 = copy(c)`, then modifications to `a` also need to
+ # be propagated to `c1`.
+ for key, val in vars(self).items():
+ if isinstance(val, TransformNode) and id(self) in val._parents:
+ other.set_children(val) # val == getattr(other, key)
+ return other
+
+ def __deepcopy__(self, memo):
+ # We could deepcopy the entire transform tree, but nothing except
+ # `self` is accessible publicly, so we may as well just freeze `self`.
+ other = self.frozen()
+ if other is not self:
+ return other
+ # Some classes implement frozen() as returning self, which is not
+ # acceptable for deepcopying, so we need to handle them separately.
+ other = copy.deepcopy(super(), memo)
+ # If `c = a + b; a1 = copy(a)`, then modifications to `a1` do not
+ # propagate back to `c`, i.e. we need to clear the parents of `a1`.
+ other._parents = {}
+ # If `c = a + b; c1 = copy(c)`, this creates a separate tree
+ # (`c1 = a1 + b1`) so nothing needs to be done.
+ return other
+
+ def invalidate(self):
+ """
+ Invalidate this `TransformNode` and triggers an invalidation of its
+ ancestors. Should be called any time the transform changes.
+ """
+ value = self.INVALID
+ if self.is_affine:
+ value = self.INVALID_AFFINE
+ return self._invalidate_internal(value, invalidating_node=self)
+
+ def _invalidate_internal(self, value, invalidating_node):
+ """
+ Called by :meth:`invalidate` and subsequently ascends the transform
+ stack calling each TransformNode's _invalidate_internal method.
+ """
+ # determine if this call will be an extension to the invalidation
+ # status. If not, then a shortcut means that we needn't invoke an
+ # invalidation up the transform stack as it will already have been
+ # invalidated.
+
+ # N.B This makes the invalidation sticky, once a transform has been
+ # invalidated as NON_AFFINE, then it will always be invalidated as
+ # NON_AFFINE even when triggered with a AFFINE_ONLY invalidation.
+ # In most cases this is not a problem (i.e. for interactive panning and
+ # zooming) and the only side effect will be on performance.
+ status_changed = self._invalid < value
+
+ if self.pass_through or status_changed:
+ self._invalid = value
+
+ for parent in list(self._parents.values()):
+ # Dereference the weak reference
+ parent = parent()
+ if parent is not None:
+ parent._invalidate_internal(
+ value=value, invalidating_node=self)
+
+ def set_children(self, *children):
+ """
+ Set the children of the transform, to let the invalidation
+ system know which transforms can invalidate this transform.
+ Should be called from the constructor of any transforms that
+ depend on other transforms.
+ """
+ # Parents are stored as weak references, so that if the
+ # parents are destroyed, references from the children won't
+ # keep them alive.
+ for child in children:
+ # Use weak references so this dictionary won't keep obsolete nodes
+ # alive; the callback deletes the dictionary entry. This is a
+ # performance improvement over using WeakValueDictionary.
+ ref = weakref.ref(
+ self, lambda _, pop=child._parents.pop, k=id(self): pop(k))
+ child._parents[id(self)] = ref
+
+ def frozen(self):
+ """
+ Return a frozen copy of this transform node. The frozen copy will not
+ be updated when its children change. Useful for storing a previously
+ known state of a transform where ``copy.deepcopy()`` might normally be
+ used.
+ """
+ return self
+
+
+class BboxBase(TransformNode):
+ """
+ The base class of all bounding boxes.
+
+ This class is immutable; `Bbox` is a mutable subclass.
+
+ The canonical representation is as two points, with no
+ restrictions on their ordering. Convenience properties are
+ provided to get the left, bottom, right and top edges and width
+ and height, but these are not stored explicitly.
+ """
+
+ is_bbox = True
+ is_affine = True
+
+ if DEBUG:
+ @staticmethod
+ def _check(points):
+ if isinstance(points, np.ma.MaskedArray):
+ _api.warn_external("Bbox bounds are a masked array.")
+ points = np.asarray(points)
+ if any((points[1, :] - points[0, :]) == 0):
+ _api.warn_external("Singular Bbox.")
+
+ def frozen(self):
+ return Bbox(self.get_points().copy())
+ frozen.__doc__ = TransformNode.__doc__
+
+ def __array__(self, *args, **kwargs):
+ return self.get_points()
+
+ @property
+ def x0(self):
+ """
+ The first of the pair of *x* coordinates that define the bounding box.
+
+ This is not guaranteed to be less than :attr:`x1` (for that, use
+ :attr:`xmin`).
+ """
+ return self.get_points()[0, 0]
+
+ @property
+ def y0(self):
+ """
+ The first of the pair of *y* coordinates that define the bounding box.
+
+ This is not guaranteed to be less than :attr:`y1` (for that, use
+ :attr:`ymin`).
+ """
+ return self.get_points()[0, 1]
+
+ @property
+ def x1(self):
+ """
+ The second of the pair of *x* coordinates that define the bounding box.
+
+ This is not guaranteed to be greater than :attr:`x0` (for that, use
+ :attr:`xmax`).
+ """
+ return self.get_points()[1, 0]
+
+ @property
+ def y1(self):
+ """
+ The second of the pair of *y* coordinates that define the bounding box.
+
+ This is not guaranteed to be greater than :attr:`y0` (for that, use
+ :attr:`ymax`).
+ """
+ return self.get_points()[1, 1]
+
+ @property
+ def p0(self):
+ """
+ The first pair of (*x*, *y*) coordinates that define the bounding box.
+
+ This is not guaranteed to be the bottom-left corner (for that, use
+ :attr:`min`).
+ """
+ return self.get_points()[0]
+
+ @property
+ def p1(self):
+ """
+ The second pair of (*x*, *y*) coordinates that define the bounding box.
+
+ This is not guaranteed to be the top-right corner (for that, use
+ :attr:`max`).
+ """
+ return self.get_points()[1]
+
+ @property
+ def xmin(self):
+ """The left edge of the bounding box."""
+ return np.min(self.get_points()[:, 0])
+
+ @property
+ def ymin(self):
+ """The bottom edge of the bounding box."""
+ return np.min(self.get_points()[:, 1])
+
+ @property
+ def xmax(self):
+ """The right edge of the bounding box."""
+ return np.max(self.get_points()[:, 0])
+
+ @property
+ def ymax(self):
+ """The top edge of the bounding box."""
+ return np.max(self.get_points()[:, 1])
+
+ @property
+ def min(self):
+ """The bottom-left corner of the bounding box."""
+ return np.min(self.get_points(), axis=0)
+
+ @property
+ def max(self):
+ """The top-right corner of the bounding box."""
+ return np.max(self.get_points(), axis=0)
+
+ @property
+ def intervalx(self):
+ """
+ The pair of *x* coordinates that define the bounding box.
+
+ This is not guaranteed to be sorted from left to right.
+ """
+ return self.get_points()[:, 0]
+
+ @property
+ def intervaly(self):
+ """
+ The pair of *y* coordinates that define the bounding box.
+
+ This is not guaranteed to be sorted from bottom to top.
+ """
+ return self.get_points()[:, 1]
+
+ @property
+ def width(self):
+ """The (signed) width of the bounding box."""
+ points = self.get_points()
+ return points[1, 0] - points[0, 0]
+
+ @property
+ def height(self):
+ """The (signed) height of the bounding box."""
+ points = self.get_points()
+ return points[1, 1] - points[0, 1]
+
+ @property
+ def size(self):
+ """The (signed) width and height of the bounding box."""
+ points = self.get_points()
+ return points[1] - points[0]
+
+ @property
+ def bounds(self):
+ """Return (:attr:`x0`, :attr:`y0`, :attr:`width`, :attr:`height`)."""
+ (x0, y0), (x1, y1) = self.get_points()
+ return (x0, y0, x1 - x0, y1 - y0)
+
+ @property
+ def extents(self):
+ """Return (:attr:`x0`, :attr:`y0`, :attr:`x1`, :attr:`y1`)."""
+ return self.get_points().flatten() # flatten returns a copy.
+
+ def get_points(self):
+ raise NotImplementedError
+
+ def containsx(self, x):
+ """
+ Return whether *x* is in the closed (:attr:`x0`, :attr:`x1`) interval.
+ """
+ x0, x1 = self.intervalx
+ return x0 <= x <= x1 or x0 >= x >= x1
+
+ def containsy(self, y):
+ """
+ Return whether *y* is in the closed (:attr:`y0`, :attr:`y1`) interval.
+ """
+ y0, y1 = self.intervaly
+ return y0 <= y <= y1 or y0 >= y >= y1
+
+ def contains(self, x, y):
+ """
+ Return whether ``(x, y)`` is in the bounding box or on its edge.
+ """
+ return self.containsx(x) and self.containsy(y)
+
+ def overlaps(self, other):
+ """
+ Return whether this bounding box overlaps with the other bounding box.
+
+ Parameters
+ ----------
+ other : `.BboxBase`
+ """
+ ax1, ay1, ax2, ay2 = self.extents
+ bx1, by1, bx2, by2 = other.extents
+ if ax2 < ax1:
+ ax2, ax1 = ax1, ax2
+ if ay2 < ay1:
+ ay2, ay1 = ay1, ay2
+ if bx2 < bx1:
+ bx2, bx1 = bx1, bx2
+ if by2 < by1:
+ by2, by1 = by1, by2
+ return ax1 <= bx2 and bx1 <= ax2 and ay1 <= by2 and by1 <= ay2
+
+ def fully_containsx(self, x):
+ """
+ Return whether *x* is in the open (:attr:`x0`, :attr:`x1`) interval.
+ """
+ x0, x1 = self.intervalx
+ return x0 < x < x1 or x0 > x > x1
+
+ def fully_containsy(self, y):
+ """
+ Return whether *y* is in the open (:attr:`y0`, :attr:`y1`) interval.
+ """
+ y0, y1 = self.intervaly
+ return y0 < y < y1 or y0 > y > y1
+
+ def fully_contains(self, x, y):
+ """
+ Return whether ``x, y`` is in the bounding box, but not on its edge.
+ """
+ return self.fully_containsx(x) and self.fully_containsy(y)
+
+ def fully_overlaps(self, other):
+ """
+ Return whether this bounding box overlaps with the other bounding box,
+ not including the edges.
+
+ Parameters
+ ----------
+ other : `.BboxBase`
+ """
+ ax1, ay1, ax2, ay2 = self.extents
+ bx1, by1, bx2, by2 = other.extents
+ if ax2 < ax1:
+ ax2, ax1 = ax1, ax2
+ if ay2 < ay1:
+ ay2, ay1 = ay1, ay2
+ if bx2 < bx1:
+ bx2, bx1 = bx1, bx2
+ if by2 < by1:
+ by2, by1 = by1, by2
+ return ax1 < bx2 and bx1 < ax2 and ay1 < by2 and by1 < ay2
+
+ def transformed(self, transform):
+ """
+ Construct a `Bbox` by statically transforming this one by *transform*.
+ """
+ pts = self.get_points()
+ ll, ul, lr = transform.transform(np.array(
+ [pts[0], [pts[0, 0], pts[1, 1]], [pts[1, 0], pts[0, 1]]]))
+ return Bbox([ll, [lr[0], ul[1]]])
+
+ @_api.deprecated("3.3", alternative="transformed(transform.inverted())")
+ def inverse_transformed(self, transform):
+ """
+ Construct a `Bbox` by statically transforming this one by the inverse
+ of *transform*.
+ """
+ return self.transformed(transform.inverted())
+
+ coefs = {'C': (0.5, 0.5),
+ 'SW': (0, 0),
+ 'S': (0.5, 0),
+ 'SE': (1.0, 0),
+ 'E': (1.0, 0.5),
+ 'NE': (1.0, 1.0),
+ 'N': (0.5, 1.0),
+ 'NW': (0, 1.0),
+ 'W': (0, 0.5)}
+
+ def anchored(self, c, container=None):
+ """
+ Return a copy of the `Bbox` shifted to position *c* within *container*.
+
+ Parameters
+ ----------
+ c : (float, float) or str
+ May be either:
+
+ * A sequence (*cx*, *cy*) where *cx* and *cy* range from 0
+ to 1, where 0 is left or bottom and 1 is right or top
+
+ * a string:
+ - 'C' for centered
+ - 'S' for bottom-center
+ - 'SE' for bottom-left
+ - 'E' for left
+ - etc.
+
+ container : `Bbox`, optional
+ The box within which the `Bbox` is positioned; it defaults
+ to the initial `Bbox`.
+ """
+ if container is None:
+ container = self
+ l, b, w, h = container.bounds
+ if isinstance(c, str):
+ cx, cy = self.coefs[c]
+ else:
+ cx, cy = c
+ L, B, W, H = self.bounds
+ return Bbox(self._points +
+ [(l + cx * (w - W)) - L,
+ (b + cy * (h - H)) - B])
+
+ def shrunk(self, mx, my):
+ """
+ Return a copy of the `Bbox`, shrunk by the factor *mx*
+ in the *x* direction and the factor *my* in the *y* direction.
+ The lower left corner of the box remains unchanged. Normally
+ *mx* and *my* will be less than 1, but this is not enforced.
+ """
+ w, h = self.size
+ return Bbox([self._points[0],
+ self._points[0] + [mx * w, my * h]])
+
+ def shrunk_to_aspect(self, box_aspect, container=None, fig_aspect=1.0):
+ """
+ Return a copy of the `Bbox`, shrunk so that it is as
+ large as it can be while having the desired aspect ratio,
+ *box_aspect*. If the box coordinates are relative (i.e.
+ fractions of a larger box such as a figure) then the
+ physical aspect ratio of that figure is specified with
+ *fig_aspect*, so that *box_aspect* can also be given as a
+ ratio of the absolute dimensions, not the relative dimensions.
+ """
+ if box_aspect <= 0 or fig_aspect <= 0:
+ raise ValueError("'box_aspect' and 'fig_aspect' must be positive")
+ if container is None:
+ container = self
+ w, h = container.size
+ H = w * box_aspect / fig_aspect
+ if H <= h:
+ W = w
+ else:
+ W = h * fig_aspect / box_aspect
+ H = h
+ return Bbox([self._points[0],
+ self._points[0] + (W, H)])
+
+ def splitx(self, *args):
+ """
+ Return a list of new `Bbox` objects formed by splitting the original
+ one with vertical lines at fractional positions given by *args*.
+ """
+ xf = [0, *args, 1]
+ x0, y0, x1, y1 = self.extents
+ w = x1 - x0
+ return [Bbox([[x0 + xf0 * w, y0], [x0 + xf1 * w, y1]])
+ for xf0, xf1 in zip(xf[:-1], xf[1:])]
+
+ def splity(self, *args):
+ """
+ Return a list of new `Bbox` objects formed by splitting the original
+ one with horizontal lines at fractional positions given by *args*.
+ """
+ yf = [0, *args, 1]
+ x0, y0, x1, y1 = self.extents
+ h = y1 - y0
+ return [Bbox([[x0, y0 + yf0 * h], [x1, y0 + yf1 * h]])
+ for yf0, yf1 in zip(yf[:-1], yf[1:])]
+
+ def count_contains(self, vertices):
+ """
+ Count the number of vertices contained in the `Bbox`.
+ Any vertices with a non-finite x or y value are ignored.
+
+ Parameters
+ ----------
+ vertices : Nx2 Numpy array.
+ """
+ if len(vertices) == 0:
+ return 0
+ vertices = np.asarray(vertices)
+ with np.errstate(invalid='ignore'):
+ return (((self.min < vertices) &
+ (vertices < self.max)).all(axis=1).sum())
+
+ def count_overlaps(self, bboxes):
+ """
+ Count the number of bounding boxes that overlap this one.
+
+ Parameters
+ ----------
+ bboxes : sequence of `.BboxBase`
+ """
+ return count_bboxes_overlapping_bbox(
+ self, np.atleast_3d([np.array(x) for x in bboxes]))
+
+ def expanded(self, sw, sh):
+ """
+ Construct a `Bbox` by expanding this one around its center by the
+ factors *sw* and *sh*.
+ """
+ width = self.width
+ height = self.height
+ deltaw = (sw * width - width) / 2.0
+ deltah = (sh * height - height) / 2.0
+ a = np.array([[-deltaw, -deltah], [deltaw, deltah]])
+ return Bbox(self._points + a)
+
+ def padded(self, p):
+ """Construct a `Bbox` by padding this one on all four sides by *p*."""
+ points = self.get_points()
+ return Bbox(points + [[-p, -p], [p, p]])
+
+ def translated(self, tx, ty):
+ """Construct a `Bbox` by translating this one by *tx* and *ty*."""
+ return Bbox(self._points + (tx, ty))
+
+ def corners(self):
+ """
+ Return the corners of this rectangle as an array of points.
+
+ Specifically, this returns the array
+ ``[[x0, y0], [x0, y1], [x1, y0], [x1, y1]]``.
+ """
+ (x0, y0), (x1, y1) = self.get_points()
+ return np.array([[x0, y0], [x0, y1], [x1, y0], [x1, y1]])
+
+ def rotated(self, radians):
+ """
+ Return the axes-aligned bounding box that bounds the result of rotating
+ this `Bbox` by an angle of *radians*.
+ """
+ corners = self.corners()
+ corners_rotated = Affine2D().rotate(radians).transform(corners)
+ bbox = Bbox.unit()
+ bbox.update_from_data_xy(corners_rotated, ignore=True)
+ return bbox
+
+ @staticmethod
+ def union(bboxes):
+ """Return a `Bbox` that contains all of the given *bboxes*."""
+ if not len(bboxes):
+ raise ValueError("'bboxes' cannot be empty")
+ x0 = np.min([bbox.xmin for bbox in bboxes])
+ x1 = np.max([bbox.xmax for bbox in bboxes])
+ y0 = np.min([bbox.ymin for bbox in bboxes])
+ y1 = np.max([bbox.ymax for bbox in bboxes])
+ return Bbox([[x0, y0], [x1, y1]])
+
+ @staticmethod
+ def intersection(bbox1, bbox2):
+ """
+ Return the intersection of *bbox1* and *bbox2* if they intersect, or
+ None if they don't.
+ """
+ x0 = np.maximum(bbox1.xmin, bbox2.xmin)
+ x1 = np.minimum(bbox1.xmax, bbox2.xmax)
+ y0 = np.maximum(bbox1.ymin, bbox2.ymin)
+ y1 = np.minimum(bbox1.ymax, bbox2.ymax)
+ return Bbox([[x0, y0], [x1, y1]]) if x0 <= x1 and y0 <= y1 else None
+
+
+class Bbox(BboxBase):
+ """
+ A mutable bounding box.
+
+ Examples
+ --------
+ **Create from known bounds**
+
+ The default constructor takes the boundary "points" ``[[xmin, ymin],
+ [xmax, ymax]]``.
+
+ >>> Bbox([[1, 1], [3, 7]])
+ Bbox([[1.0, 1.0], [3.0, 7.0]])
+
+ Alternatively, a Bbox can be created from the flattened points array, the
+ so-called "extents" ``(xmin, ymin, xmax, ymax)``
+
+ >>> Bbox.from_extents(1, 1, 3, 7)
+ Bbox([[1.0, 1.0], [3.0, 7.0]])
+
+ or from the "bounds" ``(xmin, ymin, width, height)``.
+
+ >>> Bbox.from_bounds(1, 1, 2, 6)
+ Bbox([[1.0, 1.0], [3.0, 7.0]])
+
+ **Create from collections of points**
+
+ The "empty" object for accumulating Bboxs is the null bbox, which is a
+ stand-in for the empty set.
+
+ >>> Bbox.null()
+ Bbox([[inf, inf], [-inf, -inf]])
+
+ Adding points to the null bbox will give you the bbox of those points.
+
+ >>> box = Bbox.null()
+ >>> box.update_from_data_xy([[1, 1]])
+ >>> box
+ Bbox([[1.0, 1.0], [1.0, 1.0]])
+ >>> box.update_from_data_xy([[2, 3], [3, 2]], ignore=False)
+ >>> box
+ Bbox([[1.0, 1.0], [3.0, 3.0]])
+
+ Setting ``ignore=True`` is equivalent to starting over from a null bbox.
+
+ >>> box.update_from_data_xy([[1, 1]], ignore=True)
+ >>> box
+ Bbox([[1.0, 1.0], [1.0, 1.0]])
+
+ .. warning::
+
+ It is recommended to always specify ``ignore`` explicitly. If not, the
+ default value of ``ignore`` can be changed at any time by code with
+ access to your Bbox, for example using the method `~.Bbox.ignore`.
+
+ **Properties of the ``null`` bbox**
+
+ .. note::
+
+ The current behavior of `Bbox.null()` may be surprising as it does
+ not have all of the properties of the "empty set", and as such does
+ not behave like a "zero" object in the mathematical sense. We may
+ change that in the future (with a deprecation period).
+
+ The null bbox is the identity for intersections
+
+ >>> Bbox.intersection(Bbox([[1, 1], [3, 7]]), Bbox.null())
+ Bbox([[1.0, 1.0], [3.0, 7.0]])
+
+ except with itself, where it returns the full space.
+
+ >>> Bbox.intersection(Bbox.null(), Bbox.null())
+ Bbox([[-inf, -inf], [inf, inf]])
+
+ A union containing null will always return the full space (not the other
+ set!)
+
+ >>> Bbox.union([Bbox([[0, 0], [0, 0]]), Bbox.null()])
+ Bbox([[-inf, -inf], [inf, inf]])
+ """
+
+ def __init__(self, points, **kwargs):
+ """
+ Parameters
+ ----------
+ points : ndarray
+ A 2x2 numpy array of the form ``[[x0, y0], [x1, y1]]``.
+ """
+ super().__init__(**kwargs)
+ points = np.asarray(points, float)
+ if points.shape != (2, 2):
+ raise ValueError('Bbox points must be of the form '
+ '"[[x0, y0], [x1, y1]]".')
+ self._points = points
+ self._minpos = np.array([np.inf, np.inf])
+ self._ignore = True
+ # it is helpful in some contexts to know if the bbox is a
+ # default or has been mutated; we store the orig points to
+ # support the mutated methods
+ self._points_orig = self._points.copy()
+ if DEBUG:
+ ___init__ = __init__
+
+ def __init__(self, points, **kwargs):
+ self._check(points)
+ self.___init__(points, **kwargs)
+
+ def invalidate(self):
+ self._check(self._points)
+ super().invalidate()
+
+ @staticmethod
+ def unit():
+ """Create a new unit `Bbox` from (0, 0) to (1, 1)."""
+ return Bbox([[0, 0], [1, 1]])
+
+ @staticmethod
+ def null():
+ """Create a new null `Bbox` from (inf, inf) to (-inf, -inf)."""
+ return Bbox([[np.inf, np.inf], [-np.inf, -np.inf]])
+
+ @staticmethod
+ def from_bounds(x0, y0, width, height):
+ """
+ Create a new `Bbox` from *x0*, *y0*, *width* and *height*.
+
+ *width* and *height* may be negative.
+ """
+ return Bbox.from_extents(x0, y0, x0 + width, y0 + height)
+
+ @staticmethod
+ def from_extents(*args, minpos=None):
+ """
+ Create a new Bbox from *left*, *bottom*, *right* and *top*.
+
+ The *y*-axis increases upwards.
+
+ Parameters
+ ----------
+ left, bottom, right, top : float
+ The four extents of the bounding box.
+
+ minpos : float or None
+ If this is supplied, the Bbox will have a minimum positive value
+ set. This is useful when dealing with logarithmic scales and other
+ scales where negative bounds result in floating point errors.
+ """
+ bbox = Bbox(np.reshape(args, (2, 2)))
+ if minpos is not None:
+ bbox._minpos[:] = minpos
+ return bbox
+
+ def __format__(self, fmt):
+ return (
+ 'Bbox(x0={0.x0:{1}}, y0={0.y0:{1}}, x1={0.x1:{1}}, y1={0.y1:{1}})'.
+ format(self, fmt))
+
+ def __str__(self):
+ return format(self, '')
+
+ def __repr__(self):
+ return 'Bbox([[{0.x0}, {0.y0}], [{0.x1}, {0.y1}]])'.format(self)
+
+ def ignore(self, value):
+ """
+ Set whether the existing bounds of the box should be ignored
+ by subsequent calls to :meth:`update_from_data_xy`.
+
+ value : bool
+ - When ``True``, subsequent calls to :meth:`update_from_data_xy`
+ will ignore the existing bounds of the `Bbox`.
+
+ - When ``False``, subsequent calls to :meth:`update_from_data_xy`
+ will include the existing bounds of the `Bbox`.
+ """
+ self._ignore = value
+
+ def update_from_path(self, path, ignore=None, updatex=True, updatey=True):
+ """
+ Update the bounds of the `Bbox` to contain the vertices of the
+ provided path. After updating, the bounds will have positive *width*
+ and *height*; *x0* and *y0* will be the minimal values.
+
+ Parameters
+ ----------
+ path : `~matplotlib.path.Path`
+
+ ignore : bool, optional
+ - when ``True``, ignore the existing bounds of the `Bbox`.
+ - when ``False``, include the existing bounds of the `Bbox`.
+ - when ``None``, use the last value passed to :meth:`ignore`.
+
+ updatex, updatey : bool, default: True
+ When ``True``, update the x/y values.
+ """
+ if ignore is None:
+ ignore = self._ignore
+
+ if path.vertices.size == 0:
+ return
+
+ points, minpos, changed = update_path_extents(
+ path, None, self._points, self._minpos, ignore)
+
+ if changed:
+ self.invalidate()
+ if updatex:
+ self._points[:, 0] = points[:, 0]
+ self._minpos[0] = minpos[0]
+ if updatey:
+ self._points[:, 1] = points[:, 1]
+ self._minpos[1] = minpos[1]
+
+ def update_from_data_xy(self, xy, ignore=None, updatex=True, updatey=True):
+ """
+ Update the bounds of the `Bbox` based on the passed in
+ data. After updating, the bounds will have positive *width*
+ and *height*; *x0* and *y0* will be the minimal values.
+
+ Parameters
+ ----------
+ xy : ndarray
+ A numpy array of 2D points.
+
+ ignore : bool, optional
+ - When ``True``, ignore the existing bounds of the `Bbox`.
+ - When ``False``, include the existing bounds of the `Bbox`.
+ - When ``None``, use the last value passed to :meth:`ignore`.
+
+ updatex, updatey : bool, default: True
+ When ``True``, update the x/y values.
+ """
+ if len(xy) == 0:
+ return
+
+ path = Path(xy)
+ self.update_from_path(path, ignore=ignore,
+ updatex=updatex, updatey=updatey)
+
+ @BboxBase.x0.setter
+ def x0(self, val):
+ self._points[0, 0] = val
+ self.invalidate()
+
+ @BboxBase.y0.setter
+ def y0(self, val):
+ self._points[0, 1] = val
+ self.invalidate()
+
+ @BboxBase.x1.setter
+ def x1(self, val):
+ self._points[1, 0] = val
+ self.invalidate()
+
+ @BboxBase.y1.setter
+ def y1(self, val):
+ self._points[1, 1] = val
+ self.invalidate()
+
+ @BboxBase.p0.setter
+ def p0(self, val):
+ self._points[0] = val
+ self.invalidate()
+
+ @BboxBase.p1.setter
+ def p1(self, val):
+ self._points[1] = val
+ self.invalidate()
+
+ @BboxBase.intervalx.setter
+ def intervalx(self, interval):
+ self._points[:, 0] = interval
+ self.invalidate()
+
+ @BboxBase.intervaly.setter
+ def intervaly(self, interval):
+ self._points[:, 1] = interval
+ self.invalidate()
+
+ @BboxBase.bounds.setter
+ def bounds(self, bounds):
+ l, b, w, h = bounds
+ points = np.array([[l, b], [l + w, b + h]], float)
+ if np.any(self._points != points):
+ self._points = points
+ self.invalidate()
+
+ @property
+ def minpos(self):
+ """
+ The minimum positive value in both directions within the Bbox.
+
+ This is useful when dealing with logarithmic scales and other scales
+ where negative bounds result in floating point errors, and will be used
+ as the minimum extent instead of *p0*.
+ """
+ return self._minpos
+
+ @property
+ def minposx(self):
+ """
+ The minimum positive value in the *x*-direction within the Bbox.
+
+ This is useful when dealing with logarithmic scales and other scales
+ where negative bounds result in floating point errors, and will be used
+ as the minimum *x*-extent instead of *x0*.
+ """
+ return self._minpos[0]
+
+ @property
+ def minposy(self):
+ """
+ The minimum positive value in the *y*-direction within the Bbox.
+
+ This is useful when dealing with logarithmic scales and other scales
+ where negative bounds result in floating point errors, and will be used
+ as the minimum *y*-extent instead of *y0*.
+ """
+ return self._minpos[1]
+
+ def get_points(self):
+ """
+ Get the points of the bounding box directly as a numpy array
+ of the form: ``[[x0, y0], [x1, y1]]``.
+ """
+ self._invalid = 0
+ return self._points
+
+ def set_points(self, points):
+ """
+ Set the points of the bounding box directly from a numpy array
+ of the form: ``[[x0, y0], [x1, y1]]``. No error checking is
+ performed, as this method is mainly for internal use.
+ """
+ if np.any(self._points != points):
+ self._points = points
+ self.invalidate()
+
+ def set(self, other):
+ """
+ Set this bounding box from the "frozen" bounds of another `Bbox`.
+ """
+ if np.any(self._points != other.get_points()):
+ self._points = other.get_points()
+ self.invalidate()
+
+ def mutated(self):
+ """Return whether the bbox has changed since init."""
+ return self.mutatedx() or self.mutatedy()
+
+ def mutatedx(self):
+ """Return whether the x-limits have changed since init."""
+ return (self._points[0, 0] != self._points_orig[0, 0] or
+ self._points[1, 0] != self._points_orig[1, 0])
+
+ def mutatedy(self):
+ """Return whether the y-limits have changed since init."""
+ return (self._points[0, 1] != self._points_orig[0, 1] or
+ self._points[1, 1] != self._points_orig[1, 1])
+
+
+class TransformedBbox(BboxBase):
+ """
+ A `Bbox` that is automatically transformed by a given
+ transform. When either the child bounding box or transform
+ changes, the bounds of this bbox will update accordingly.
+ """
+
+ def __init__(self, bbox, transform, **kwargs):
+ """
+ Parameters
+ ----------
+ bbox : `Bbox`
+ transform : `Transform`
+ """
+ if not bbox.is_bbox:
+ raise ValueError("'bbox' is not a bbox")
+ _api.check_isinstance(Transform, transform=transform)
+ if transform.input_dims != 2 or transform.output_dims != 2:
+ raise ValueError(
+ "The input and output dimensions of 'transform' must be 2")
+
+ super().__init__(**kwargs)
+ self._bbox = bbox
+ self._transform = transform
+ self.set_children(bbox, transform)
+ self._points = None
+
+ __str__ = _make_str_method("_bbox", "_transform")
+
+ def get_points(self):
+ # docstring inherited
+ if self._invalid:
+ p = self._bbox.get_points()
+ # Transform all four points, then make a new bounding box
+ # from the result, taking care to make the orientation the
+ # same.
+ points = self._transform.transform(
+ [[p[0, 0], p[0, 1]],
+ [p[1, 0], p[0, 1]],
+ [p[0, 0], p[1, 1]],
+ [p[1, 0], p[1, 1]]])
+ points = np.ma.filled(points, 0.0)
+
+ xs = min(points[:, 0]), max(points[:, 0])
+ if p[0, 0] > p[1, 0]:
+ xs = xs[::-1]
+
+ ys = min(points[:, 1]), max(points[:, 1])
+ if p[0, 1] > p[1, 1]:
+ ys = ys[::-1]
+
+ self._points = np.array([
+ [xs[0], ys[0]],
+ [xs[1], ys[1]]
+ ])
+
+ self._invalid = 0
+ return self._points
+
+ if DEBUG:
+ _get_points = get_points
+
+ def get_points(self):
+ points = self._get_points()
+ self._check(points)
+ return points
+
+
+class LockableBbox(BboxBase):
+ """
+ A `Bbox` where some elements may be locked at certain values.
+
+ When the child bounding box changes, the bounds of this bbox will update
+ accordingly with the exception of the locked elements.
+ """
+ def __init__(self, bbox, x0=None, y0=None, x1=None, y1=None, **kwargs):
+ """
+ Parameters
+ ----------
+ bbox : `Bbox`
+ The child bounding box to wrap.
+
+ x0 : float or None
+ The locked value for x0, or None to leave unlocked.
+
+ y0 : float or None
+ The locked value for y0, or None to leave unlocked.
+
+ x1 : float or None
+ The locked value for x1, or None to leave unlocked.
+
+ y1 : float or None
+ The locked value for y1, or None to leave unlocked.
+
+ """
+ if not bbox.is_bbox:
+ raise ValueError("'bbox' is not a bbox")
+
+ super().__init__(**kwargs)
+ self._bbox = bbox
+ self.set_children(bbox)
+ self._points = None
+ fp = [x0, y0, x1, y1]
+ mask = [val is None for val in fp]
+ self._locked_points = np.ma.array(fp, float, mask=mask).reshape((2, 2))
+
+ __str__ = _make_str_method("_bbox", "_locked_points")
+
+ def get_points(self):
+ # docstring inherited
+ if self._invalid:
+ points = self._bbox.get_points()
+ self._points = np.where(self._locked_points.mask,
+ points,
+ self._locked_points)
+ self._invalid = 0
+ return self._points
+
+ if DEBUG:
+ _get_points = get_points
+
+ def get_points(self):
+ points = self._get_points()
+ self._check(points)
+ return points
+
+ @property
+ def locked_x0(self):
+ """
+ float or None: The value used for the locked x0.
+ """
+ if self._locked_points.mask[0, 0]:
+ return None
+ else:
+ return self._locked_points[0, 0]
+
+ @locked_x0.setter
+ def locked_x0(self, x0):
+ self._locked_points.mask[0, 0] = x0 is None
+ self._locked_points.data[0, 0] = x0
+ self.invalidate()
+
+ @property
+ def locked_y0(self):
+ """
+ float or None: The value used for the locked y0.
+ """
+ if self._locked_points.mask[0, 1]:
+ return None
+ else:
+ return self._locked_points[0, 1]
+
+ @locked_y0.setter
+ def locked_y0(self, y0):
+ self._locked_points.mask[0, 1] = y0 is None
+ self._locked_points.data[0, 1] = y0
+ self.invalidate()
+
+ @property
+ def locked_x1(self):
+ """
+ float or None: The value used for the locked x1.
+ """
+ if self._locked_points.mask[1, 0]:
+ return None
+ else:
+ return self._locked_points[1, 0]
+
+ @locked_x1.setter
+ def locked_x1(self, x1):
+ self._locked_points.mask[1, 0] = x1 is None
+ self._locked_points.data[1, 0] = x1
+ self.invalidate()
+
+ @property
+ def locked_y1(self):
+ """
+ float or None: The value used for the locked y1.
+ """
+ if self._locked_points.mask[1, 1]:
+ return None
+ else:
+ return self._locked_points[1, 1]
+
+ @locked_y1.setter
+ def locked_y1(self, y1):
+ self._locked_points.mask[1, 1] = y1 is None
+ self._locked_points.data[1, 1] = y1
+ self.invalidate()
+
+
+class Transform(TransformNode):
+ """
+ The base class of all `TransformNode` instances that
+ actually perform a transformation.
+
+ All non-affine transformations should be subclasses of this class.
+ New affine transformations should be subclasses of `Affine2D`.
+
+ Subclasses of this class should override the following members (at
+ minimum):
+
+ - :attr:`input_dims`
+ - :attr:`output_dims`
+ - :meth:`transform`
+ - :meth:`inverted` (if an inverse exists)
+
+ The following attributes may be overridden if the default is unsuitable:
+
+ - :attr:`is_separable` (defaults to True for 1D -> 1D transforms, False
+ otherwise)
+ - :attr:`has_inverse` (defaults to True if :meth:`inverted` is overridden,
+ False otherwise)
+
+ If the transform needs to do something non-standard with
+ `matplotlib.path.Path` objects, such as adding curves
+ where there were once line segments, it should override:
+
+ - :meth:`transform_path`
+ """
+
+ input_dims = None
+ """
+ The number of input dimensions of this transform.
+ Must be overridden (with integers) in the subclass.
+ """
+
+ output_dims = None
+ """
+ The number of output dimensions of this transform.
+ Must be overridden (with integers) in the subclass.
+ """
+
+ is_separable = False
+ """True if this transform is separable in the x- and y- dimensions."""
+
+ has_inverse = False
+ """True if this transform has a corresponding inverse transform."""
+
+ def __init_subclass__(cls):
+ # 1d transforms are always separable; we assume higher-dimensional ones
+ # are not but subclasses can also directly set is_separable -- this is
+ # verified by checking whether "is_separable" appears more than once in
+ # the class's MRO (it appears once in Transform).
+ if (sum("is_separable" in vars(parent) for parent in cls.__mro__) == 1
+ and cls.input_dims == cls.output_dims == 1):
+ cls.is_separable = True
+ # Transform.inverted raises NotImplementedError; we assume that if this
+ # is overridden then the transform is invertible but subclass can also
+ # directly set has_inverse.
+ if (sum("has_inverse" in vars(parent) for parent in cls.__mro__) == 1
+ and hasattr(cls, "inverted")
+ and cls.inverted is not Transform.inverted):
+ cls.has_inverse = True
+
+ def __add__(self, other):
+ """
+ Compose two transforms together so that *self* is followed by *other*.
+
+ ``A + B`` returns a transform ``C`` so that
+ ``C.transform(x) == B.transform(A.transform(x))``.
+ """
+ return (composite_transform_factory(self, other)
+ if isinstance(other, Transform) else
+ NotImplemented)
+
+ # Equality is based on object identity for `Transform`s (so we don't
+ # override `__eq__`), but some subclasses, such as TransformWrapper &
+ # AffineBase, override this behavior.
+
+ def _iter_break_from_left_to_right(self):
+ """
+ Return an iterator breaking down this transform stack from left to
+ right recursively. If self == ((A, N), A) then the result will be an
+ iterator which yields I : ((A, N), A), followed by A : (N, A),
+ followed by (A, N) : (A), but not ((A, N), A) : I.
+
+ This is equivalent to flattening the stack then yielding
+ ``flat_stack[:i], flat_stack[i:]`` where i=0..(n-1).
+ """
+ yield IdentityTransform(), self
+
+ @property
+ def depth(self):
+ """
+ Return the number of transforms which have been chained
+ together to form this Transform instance.
+
+ .. note::
+
+ For the special case of a Composite transform, the maximum depth
+ of the two is returned.
+
+ """
+ return 1
+
+ def contains_branch(self, other):
+ """
+ Return whether the given transform is a sub-tree of this transform.
+
+ This routine uses transform equality to identify sub-trees, therefore
+ in many situations it is object id which will be used.
+
+ For the case where the given transform represents the whole
+ of this transform, returns True.
+ """
+ if self.depth < other.depth:
+ return False
+
+ # check that a subtree is equal to other (starting from self)
+ for _, sub_tree in self._iter_break_from_left_to_right():
+ if sub_tree == other:
+ return True
+ return False
+
+ def contains_branch_seperately(self, other_transform):
+ """
+ Return whether the given branch is a sub-tree of this transform on
+ each separate dimension.
+
+ A common use for this method is to identify if a transform is a blended
+ transform containing an axes' data transform. e.g.::
+
+ x_isdata, y_isdata = trans.contains_branch_seperately(ax.transData)
+
+ """
+ if self.output_dims != 2:
+ raise ValueError('contains_branch_seperately only supports '
+ 'transforms with 2 output dimensions')
+ # for a non-blended transform each separate dimension is the same, so
+ # just return the appropriate shape.
+ return [self.contains_branch(other_transform)] * 2
+
+ def __sub__(self, other):
+ """
+ Compose *self* with the inverse of *other*, cancelling identical terms
+ if any::
+
+ # In general:
+ A - B == A + B.inverted()
+ # (but see note regarding frozen transforms below).
+
+ # If A "ends with" B (i.e. A == A' + B for some A') we can cancel
+ # out B:
+ (A' + B) - B == A'
+
+ # Likewise, if B "starts with" A (B = A + B'), we can cancel out A:
+ A - (A + B') == B'.inverted() == B'^-1
+
+ Cancellation (rather than naively returning ``A + B.inverted()``) is
+ important for multiple reasons:
+
+ - It avoids floating-point inaccuracies when computing the inverse of
+ B: ``B - B`` is guaranteed to cancel out exactly (resulting in the
+ identity transform), whereas ``B + B.inverted()`` may differ by a
+ small epsilon.
+ - ``B.inverted()`` always returns a frozen transform: if one computes
+ ``A + B + B.inverted()`` and later mutates ``B``, then
+ ``B.inverted()`` won't be updated and the last two terms won't cancel
+ out anymore; on the other hand, ``A + B - B`` will always be equal to
+ ``A`` even if ``B`` is mutated.
+ """
+ # we only know how to do this operation if other is a Transform.
+ if not isinstance(other, Transform):
+ return NotImplemented
+ for remainder, sub_tree in self._iter_break_from_left_to_right():
+ if sub_tree == other:
+ return remainder
+ for remainder, sub_tree in other._iter_break_from_left_to_right():
+ if sub_tree == self:
+ if not remainder.has_inverse:
+ raise ValueError(
+ "The shortcut cannot be computed since 'other' "
+ "includes a non-invertible component")
+ return remainder.inverted()
+ # if we have got this far, then there was no shortcut possible
+ if other.has_inverse:
+ return self + other.inverted()
+ else:
+ raise ValueError('It is not possible to compute transA - transB '
+ 'since transB cannot be inverted and there is no '
+ 'shortcut possible.')
+
+ def __array__(self, *args, **kwargs):
+ """Array interface to get at this Transform's affine matrix."""
+ return self.get_affine().get_matrix()
+
+ def transform(self, values):
+ """
+ Apply this transformation on the given array of *values*.
+
+ Parameters
+ ----------
+ values : array
+ The input values as NumPy array of length :attr:`input_dims` or
+ shape (N x :attr:`input_dims`).
+
+ Returns
+ -------
+ array
+ The output values as NumPy array of length :attr:`input_dims` or
+ shape (N x :attr:`output_dims`), depending on the input.
+ """
+ # Ensure that values is a 2d array (but remember whether
+ # we started with a 1d or 2d array).
+ values = np.asanyarray(values)
+ ndim = values.ndim
+ values = values.reshape((-1, self.input_dims))
+
+ # Transform the values
+ res = self.transform_affine(self.transform_non_affine(values))
+
+ # Convert the result back to the shape of the input values.
+ if ndim == 0:
+ assert not np.ma.is_masked(res) # just to be on the safe side
+ return res[0, 0]
+ if ndim == 1:
+ return res.reshape(-1)
+ elif ndim == 2:
+ return res
+ raise ValueError(
+ "Input values must have shape (N x {dims}) "
+ "or ({dims}).".format(dims=self.input_dims))
+
+ def transform_affine(self, values):
+ """
+ Apply only the affine part of this transformation on the
+ given array of values.
+
+ ``transform(values)`` is always equivalent to
+ ``transform_affine(transform_non_affine(values))``.
+
+ In non-affine transformations, this is generally a no-op. In
+ affine transformations, this is equivalent to
+ ``transform(values)``.
+
+ Parameters
+ ----------
+ values : array
+ The input values as NumPy array of length :attr:`input_dims` or
+ shape (N x :attr:`input_dims`).
+
+ Returns
+ -------
+ array
+ The output values as NumPy array of length :attr:`input_dims` or
+ shape (N x :attr:`output_dims`), depending on the input.
+ """
+ return self.get_affine().transform(values)
+
+ def transform_non_affine(self, values):
+ """
+ Apply only the non-affine part of this transformation.
+
+ ``transform(values)`` is always equivalent to
+ ``transform_affine(transform_non_affine(values))``.
+
+ In non-affine transformations, this is generally equivalent to
+ ``transform(values)``. In affine transformations, this is
+ always a no-op.
+
+ Parameters
+ ----------
+ values : array
+ The input values as NumPy array of length :attr:`input_dims` or
+ shape (N x :attr:`input_dims`).
+
+ Returns
+ -------
+ array
+ The output values as NumPy array of length :attr:`input_dims` or
+ shape (N x :attr:`output_dims`), depending on the input.
+ """
+ return values
+
+ def transform_bbox(self, bbox):
+ """
+ Transform the given bounding box.
+
+ For smarter transforms including caching (a common requirement in
+ Matplotlib), see `TransformedBbox`.
+ """
+ return Bbox(self.transform(bbox.get_points()))
+
+ def get_affine(self):
+ """Get the affine part of this transform."""
+ return IdentityTransform()
+
+ def get_matrix(self):
+ """Get the matrix for the affine part of this transform."""
+ return self.get_affine().get_matrix()
+
+ def transform_point(self, point):
+ """
+ Return a transformed point.
+
+ This function is only kept for backcompatibility; the more general
+ `.transform` method is capable of transforming both a list of points
+ and a single point.
+
+ The point is given as a sequence of length :attr:`input_dims`.
+ The transformed point is returned as a sequence of length
+ :attr:`output_dims`.
+ """
+ if len(point) != self.input_dims:
+ raise ValueError("The length of 'point' must be 'self.input_dims'")
+ return self.transform(point)
+
+ def transform_path(self, path):
+ """
+ Apply the transform to `.Path` *path*, returning a new `.Path`.
+
+ In some cases, this transform may insert curves into the path
+ that began as line segments.
+ """
+ return self.transform_path_affine(self.transform_path_non_affine(path))
+
+ def transform_path_affine(self, path):
+ """
+ Apply the affine part of this transform to `.Path` *path*, returning a
+ new `.Path`.
+
+ ``transform_path(path)`` is equivalent to
+ ``transform_path_affine(transform_path_non_affine(values))``.
+ """
+ return self.get_affine().transform_path_affine(path)
+
+ def transform_path_non_affine(self, path):
+ """
+ Apply the non-affine part of this transform to `.Path` *path*,
+ returning a new `.Path`.
+
+ ``transform_path(path)`` is equivalent to
+ ``transform_path_affine(transform_path_non_affine(values))``.
+ """
+ x = self.transform_non_affine(path.vertices)
+ return Path._fast_from_codes_and_verts(x, path.codes, path)
+
+ def transform_angles(self, angles, pts, radians=False, pushoff=1e-5):
+ """
+ Transform a set of angles anchored at specific locations.
+
+ Parameters
+ ----------
+ angles : (N,) array-like
+ The angles to transform.
+ pts : (N, 2) array-like
+ The points where the angles are anchored.
+ radians : bool, default: False
+ Whether *angles* are radians or degrees.
+ pushoff : float
+ For each point in *pts* and angle in *angles*, the transformed
+ angle is computed by transforming a segment of length *pushoff*
+ starting at that point and making that angle relative to the
+ horizontal axis, and measuring the angle between the horizontal
+ axis and the transformed segment.
+
+ Returns
+ -------
+ (N,) array
+ """
+ # Must be 2D
+ if self.input_dims != 2 or self.output_dims != 2:
+ raise NotImplementedError('Only defined in 2D')
+ angles = np.asarray(angles)
+ pts = np.asarray(pts)
+ if angles.ndim != 1 or angles.shape[0] != pts.shape[0]:
+ raise ValueError("'angles' must be a column vector and have same "
+ "number of rows as 'pts'")
+ if pts.shape[1] != 2:
+ raise ValueError("'pts' must be array with 2 columns for x, y")
+ # Convert to radians if desired
+ if not radians:
+ angles = np.deg2rad(angles)
+ # Move a short distance away
+ pts2 = pts + pushoff * np.column_stack([np.cos(angles),
+ np.sin(angles)])
+ # Transform both sets of points
+ tpts = self.transform(pts)
+ tpts2 = self.transform(pts2)
+ # Calculate transformed angles
+ d = tpts2 - tpts
+ a = np.arctan2(d[:, 1], d[:, 0])
+ # Convert back to degrees if desired
+ if not radians:
+ a = np.rad2deg(a)
+ return a
+
+ def inverted(self):
+ """
+ Return the corresponding inverse transformation.
+
+ It holds ``x == self.inverted().transform(self.transform(x))``.
+
+ The return value of this method should be treated as
+ temporary. An update to *self* does not cause a corresponding
+ update to its inverted copy.
+ """
+ raise NotImplementedError()
+
+
+class TransformWrapper(Transform):
+ """
+ A helper class that holds a single child transform and acts
+ equivalently to it.
+
+ This is useful if a node of the transform tree must be replaced at
+ run time with a transform of a different type. This class allows
+ that replacement to correctly trigger invalidation.
+
+ `TransformWrapper` instances must have the same input and output dimensions
+ during their entire lifetime, so the child transform may only be replaced
+ with another child transform of the same dimensions.
+ """
+
+ pass_through = True
+
+ def __init__(self, child):
+ """
+ *child*: A `Transform` instance. This child may later
+ be replaced with :meth:`set`.
+ """
+ _api.check_isinstance(Transform, child=child)
+ self._init(child)
+ self.set_children(child)
+
+ def _init(self, child):
+ Transform.__init__(self)
+ self.input_dims = child.input_dims
+ self.output_dims = child.output_dims
+ self._set(child)
+ self._invalid = 0
+
+ def __eq__(self, other):
+ return self._child.__eq__(other)
+
+ __str__ = _make_str_method("_child")
+
+ def frozen(self):
+ # docstring inherited
+ return self._child.frozen()
+
+ def _set(self, child):
+ self._child = child
+
+ self.transform = child.transform
+ self.transform_affine = child.transform_affine
+ self.transform_non_affine = child.transform_non_affine
+ self.transform_path = child.transform_path
+ self.transform_path_affine = child.transform_path_affine
+ self.transform_path_non_affine = child.transform_path_non_affine
+ self.get_affine = child.get_affine
+ self.inverted = child.inverted
+ self.get_matrix = child.get_matrix
+
+ # note we do not wrap other properties here since the transform's
+ # child can be changed with WrappedTransform.set and so checking
+ # is_affine and other such properties may be dangerous.
+
+ def set(self, child):
+ """
+ Replace the current child of this transform with another one.
+
+ The new child must have the same number of input and output
+ dimensions as the current child.
+ """
+ if (child.input_dims != self.input_dims or
+ child.output_dims != self.output_dims):
+ raise ValueError(
+ "The new child must have the same number of input and output "
+ "dimensions as the current child")
+
+ self.set_children(child)
+ self._set(child)
+
+ self._invalid = 0
+ self.invalidate()
+ self._invalid = 0
+
+ is_affine = property(lambda self: self._child.is_affine)
+ is_separable = property(lambda self: self._child.is_separable)
+ has_inverse = property(lambda self: self._child.has_inverse)
+
+
+class AffineBase(Transform):
+ """
+ The base class of all affine transformations of any number of dimensions.
+ """
+ is_affine = True
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self._inverted = None
+
+ def __array__(self, *args, **kwargs):
+ # optimises the access of the transform matrix vs. the superclass
+ return self.get_matrix()
+
+ def __eq__(self, other):
+ if getattr(other, "is_affine", False) and hasattr(other, "get_matrix"):
+ return np.all(self.get_matrix() == other.get_matrix())
+ return NotImplemented
+
+ def transform(self, values):
+ # docstring inherited
+ return self.transform_affine(values)
+
+ def transform_affine(self, values):
+ # docstring inherited
+ raise NotImplementedError('Affine subclasses should override this '
+ 'method.')
+
+ def transform_non_affine(self, points):
+ # docstring inherited
+ return points
+
+ def transform_path(self, path):
+ # docstring inherited
+ return self.transform_path_affine(path)
+
+ def transform_path_affine(self, path):
+ # docstring inherited
+ return Path(self.transform_affine(path.vertices),
+ path.codes, path._interpolation_steps)
+
+ def transform_path_non_affine(self, path):
+ # docstring inherited
+ return path
+
+ def get_affine(self):
+ # docstring inherited
+ return self
+
+
+class Affine2DBase(AffineBase):
+ """
+ The base class of all 2D affine transformations.
+
+ 2D affine transformations are performed using a 3x3 numpy array::
+
+ a c e
+ b d f
+ 0 0 1
+
+ This class provides the read-only interface. For a mutable 2D
+ affine transformation, use `Affine2D`.
+
+ Subclasses of this class will generally only need to override a
+ constructor and :meth:`get_matrix` that generates a custom 3x3 matrix.
+ """
+ input_dims = 2
+ output_dims = 2
+
+ def frozen(self):
+ # docstring inherited
+ return Affine2D(self.get_matrix().copy())
+
+ @property
+ def is_separable(self):
+ mtx = self.get_matrix()
+ return mtx[0, 1] == mtx[1, 0] == 0.0
+
+ def to_values(self):
+ """
+ Return the values of the matrix as an ``(a, b, c, d, e, f)`` tuple.
+ """
+ mtx = self.get_matrix()
+ return tuple(mtx[:2].swapaxes(0, 1).flat)
+
+ def transform_affine(self, points):
+ mtx = self.get_matrix()
+ if isinstance(points, np.ma.MaskedArray):
+ tpoints = affine_transform(points.data, mtx)
+ return np.ma.MaskedArray(tpoints, mask=np.ma.getmask(points))
+ return affine_transform(points, mtx)
+
+ if DEBUG:
+ _transform_affine = transform_affine
+
+ def transform_affine(self, points):
+ # docstring inherited
+ # The major speed trap here is just converting to the
+ # points to an array in the first place. If we can use
+ # more arrays upstream, that should help here.
+ if not isinstance(points, (np.ma.MaskedArray, np.ndarray)):
+ _api.warn_external(
+ f'A non-numpy array of type {type(points)} was passed in '
+ f'for transformation, which results in poor performance.')
+ return self._transform_affine(points)
+
+ def inverted(self):
+ # docstring inherited
+ if self._inverted is None or self._invalid:
+ mtx = self.get_matrix()
+ shorthand_name = None
+ if self._shorthand_name:
+ shorthand_name = '(%s)-1' % self._shorthand_name
+ self._inverted = Affine2D(inv(mtx), shorthand_name=shorthand_name)
+ self._invalid = 0
+ return self._inverted
+
+
+class Affine2D(Affine2DBase):
+ """
+ A mutable 2D affine transformation.
+ """
+
+ def __init__(self, matrix=None, **kwargs):
+ """
+ Initialize an Affine transform from a 3x3 numpy float array::
+
+ a c e
+ b d f
+ 0 0 1
+
+ If *matrix* is None, initialize with the identity transform.
+ """
+ super().__init__(**kwargs)
+ if matrix is None:
+ # A bit faster than np.identity(3).
+ matrix = IdentityTransform._mtx.copy()
+ self._mtx = matrix.copy()
+ self._invalid = 0
+
+ __str__ = _make_str_method("_mtx")
+
+ @staticmethod
+ def from_values(a, b, c, d, e, f):
+ """
+ Create a new Affine2D instance from the given values::
+
+ a c e
+ b d f
+ 0 0 1
+
+ .
+ """
+ return Affine2D(
+ np.array([a, c, e, b, d, f, 0.0, 0.0, 1.0], float).reshape((3, 3)))
+
+ def get_matrix(self):
+ """
+ Get the underlying transformation matrix as a 3x3 numpy array::
+
+ a c e
+ b d f
+ 0 0 1
+
+ .
+ """
+ if self._invalid:
+ self._inverted = None
+ self._invalid = 0
+ return self._mtx
+
+ def set_matrix(self, mtx):
+ """
+ Set the underlying transformation matrix from a 3x3 numpy array::
+
+ a c e
+ b d f
+ 0 0 1
+
+ .
+ """
+ self._mtx = mtx
+ self.invalidate()
+
+ def set(self, other):
+ """
+ Set this transformation from the frozen copy of another
+ `Affine2DBase` object.
+ """
+ _api.check_isinstance(Affine2DBase, other=other)
+ self._mtx = other.get_matrix()
+ self.invalidate()
+
+ @staticmethod
+ def identity():
+ """
+ Return a new `Affine2D` object that is the identity transform.
+
+ Unless this transform will be mutated later on, consider using
+ the faster `IdentityTransform` class instead.
+ """
+ return Affine2D()
+
+ def clear(self):
+ """
+ Reset the underlying matrix to the identity transform.
+ """
+ # A bit faster than np.identity(3).
+ self._mtx = IdentityTransform._mtx.copy()
+ self.invalidate()
+ return self
+
+ def rotate(self, theta):
+ """
+ Add a rotation (in radians) to this transform in place.
+
+ Returns *self*, so this method can easily be chained with more
+ calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
+ and :meth:`scale`.
+ """
+ a = math.cos(theta)
+ b = math.sin(theta)
+ rotate_mtx = np.array([[a, -b, 0.0], [b, a, 0.0], [0.0, 0.0, 1.0]],
+ float)
+ self._mtx = np.dot(rotate_mtx, self._mtx)
+ self.invalidate()
+ return self
+
+ def rotate_deg(self, degrees):
+ """
+ Add a rotation (in degrees) to this transform in place.
+
+ Returns *self*, so this method can easily be chained with more
+ calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
+ and :meth:`scale`.
+ """
+ return self.rotate(math.radians(degrees))
+
+ def rotate_around(self, x, y, theta):
+ """
+ Add a rotation (in radians) around the point (x, y) in place.
+
+ Returns *self*, so this method can easily be chained with more
+ calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
+ and :meth:`scale`.
+ """
+ return self.translate(-x, -y).rotate(theta).translate(x, y)
+
+ def rotate_deg_around(self, x, y, degrees):
+ """
+ Add a rotation (in degrees) around the point (x, y) in place.
+
+ Returns *self*, so this method can easily be chained with more
+ calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
+ and :meth:`scale`.
+ """
+ # Cast to float to avoid wraparound issues with uint8's
+ x, y = float(x), float(y)
+ return self.translate(-x, -y).rotate_deg(degrees).translate(x, y)
+
+ def translate(self, tx, ty):
+ """
+ Add a translation in place.
+
+ Returns *self*, so this method can easily be chained with more
+ calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
+ and :meth:`scale`.
+ """
+ self._mtx[0, 2] += tx
+ self._mtx[1, 2] += ty
+ self.invalidate()
+ return self
+
+ def scale(self, sx, sy=None):
+ """
+ Add a scale in place.
+
+ If *sy* is None, the same scale is applied in both the *x*- and
+ *y*-directions.
+
+ Returns *self*, so this method can easily be chained with more
+ calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
+ and :meth:`scale`.
+ """
+ if sy is None:
+ sy = sx
+ # explicit element-wise scaling is fastest
+ self._mtx[0, 0] *= sx
+ self._mtx[0, 1] *= sx
+ self._mtx[0, 2] *= sx
+ self._mtx[1, 0] *= sy
+ self._mtx[1, 1] *= sy
+ self._mtx[1, 2] *= sy
+ self.invalidate()
+ return self
+
+ def skew(self, xShear, yShear):
+ """
+ Add a skew in place.
+
+ *xShear* and *yShear* are the shear angles along the *x*- and
+ *y*-axes, respectively, in radians.
+
+ Returns *self*, so this method can easily be chained with more
+ calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
+ and :meth:`scale`.
+ """
+ rotX = math.tan(xShear)
+ rotY = math.tan(yShear)
+ skew_mtx = np.array(
+ [[1.0, rotX, 0.0], [rotY, 1.0, 0.0], [0.0, 0.0, 1.0]], float)
+ self._mtx = np.dot(skew_mtx, self._mtx)
+ self.invalidate()
+ return self
+
+ def skew_deg(self, xShear, yShear):
+ """
+ Add a skew in place.
+
+ *xShear* and *yShear* are the shear angles along the *x*- and
+ *y*-axes, respectively, in degrees.
+
+ Returns *self*, so this method can easily be chained with more
+ calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
+ and :meth:`scale`.
+ """
+ return self.skew(math.radians(xShear), math.radians(yShear))
+
+
+class IdentityTransform(Affine2DBase):
+ """
+ A special class that does one thing, the identity transform, in a
+ fast way.
+ """
+ _mtx = np.identity(3)
+
+ def frozen(self):
+ # docstring inherited
+ return self
+
+ __str__ = _make_str_method()
+
+ def get_matrix(self):
+ # docstring inherited
+ return self._mtx
+
+ def transform(self, points):
+ # docstring inherited
+ return np.asanyarray(points)
+
+ def transform_affine(self, points):
+ # docstring inherited
+ return np.asanyarray(points)
+
+ def transform_non_affine(self, points):
+ # docstring inherited
+ return np.asanyarray(points)
+
+ def transform_path(self, path):
+ # docstring inherited
+ return path
+
+ def transform_path_affine(self, path):
+ # docstring inherited
+ return path
+
+ def transform_path_non_affine(self, path):
+ # docstring inherited
+ return path
+
+ def get_affine(self):
+ # docstring inherited
+ return self
+
+ def inverted(self):
+ # docstring inherited
+ return self
+
+
+class _BlendedMixin:
+ """Common methods for `BlendedGenericTransform` and `BlendedAffine2D`."""
+
+ def __eq__(self, other):
+ if isinstance(other, (BlendedAffine2D, BlendedGenericTransform)):
+ return (self._x == other._x) and (self._y == other._y)
+ elif self._x == self._y:
+ return self._x == other
+ else:
+ return NotImplemented
+
+ def contains_branch_seperately(self, transform):
+ return (self._x.contains_branch(transform),
+ self._y.contains_branch(transform))
+
+ __str__ = _make_str_method("_x", "_y")
+
+
+class BlendedGenericTransform(_BlendedMixin, Transform):
+ """
+ A "blended" transform uses one transform for the *x*-direction, and
+ another transform for the *y*-direction.
+
+ This "generic" version can handle any given child transform in the
+ *x*- and *y*-directions.
+ """
+ input_dims = 2
+ output_dims = 2
+ is_separable = True
+ pass_through = True
+
+ def __init__(self, x_transform, y_transform, **kwargs):
+ """
+ Create a new "blended" transform using *x_transform* to transform the
+ *x*-axis and *y_transform* to transform the *y*-axis.
+
+ You will generally not call this constructor directly but use the
+ `blended_transform_factory` function instead, which can determine
+ automatically which kind of blended transform to create.
+ """
+ Transform.__init__(self, **kwargs)
+ self._x = x_transform
+ self._y = y_transform
+ self.set_children(x_transform, y_transform)
+ self._affine = None
+
+ @property
+ def depth(self):
+ return max(self._x.depth, self._y.depth)
+
+ def contains_branch(self, other):
+ # A blended transform cannot possibly contain a branch from two
+ # different transforms.
+ return False
+
+ is_affine = property(lambda self: self._x.is_affine and self._y.is_affine)
+ has_inverse = property(
+ lambda self: self._x.has_inverse and self._y.has_inverse)
+
+ def frozen(self):
+ # docstring inherited
+ return blended_transform_factory(self._x.frozen(), self._y.frozen())
+
+ def transform_non_affine(self, points):
+ # docstring inherited
+ if self._x.is_affine and self._y.is_affine:
+ return points
+ x = self._x
+ y = self._y
+
+ if x == y and x.input_dims == 2:
+ return x.transform_non_affine(points)
+
+ if x.input_dims == 2:
+ x_points = x.transform_non_affine(points)[:, 0:1]
+ else:
+ x_points = x.transform_non_affine(points[:, 0])
+ x_points = x_points.reshape((len(x_points), 1))
+
+ if y.input_dims == 2:
+ y_points = y.transform_non_affine(points)[:, 1:]
+ else:
+ y_points = y.transform_non_affine(points[:, 1])
+ y_points = y_points.reshape((len(y_points), 1))
+
+ if (isinstance(x_points, np.ma.MaskedArray) or
+ isinstance(y_points, np.ma.MaskedArray)):
+ return np.ma.concatenate((x_points, y_points), 1)
+ else:
+ return np.concatenate((x_points, y_points), 1)
+
+ def inverted(self):
+ # docstring inherited
+ return BlendedGenericTransform(self._x.inverted(), self._y.inverted())
+
+ def get_affine(self):
+ # docstring inherited
+ if self._invalid or self._affine is None:
+ if self._x == self._y:
+ self._affine = self._x.get_affine()
+ else:
+ x_mtx = self._x.get_affine().get_matrix()
+ y_mtx = self._y.get_affine().get_matrix()
+ # We already know the transforms are separable, so we can skip
+ # setting b and c to zero.
+ mtx = np.array([x_mtx[0], y_mtx[1], [0.0, 0.0, 1.0]])
+ self._affine = Affine2D(mtx)
+ self._invalid = 0
+ return self._affine
+
+
+class BlendedAffine2D(_BlendedMixin, Affine2DBase):
+ """
+ A "blended" transform uses one transform for the *x*-direction, and
+ another transform for the *y*-direction.
+
+ This version is an optimization for the case where both child
+ transforms are of type `Affine2DBase`.
+ """
+
+ is_separable = True
+
+ def __init__(self, x_transform, y_transform, **kwargs):
+ """
+ Create a new "blended" transform using *x_transform* to transform the
+ *x*-axis and *y_transform* to transform the *y*-axis.
+
+ Both *x_transform* and *y_transform* must be 2D affine transforms.
+
+ You will generally not call this constructor directly but use the
+ `blended_transform_factory` function instead, which can determine
+ automatically which kind of blended transform to create.
+ """
+ is_affine = x_transform.is_affine and y_transform.is_affine
+ is_separable = x_transform.is_separable and y_transform.is_separable
+ is_correct = is_affine and is_separable
+ if not is_correct:
+ raise ValueError("Both *x_transform* and *y_transform* must be 2D "
+ "affine transforms")
+
+ Transform.__init__(self, **kwargs)
+ self._x = x_transform
+ self._y = y_transform
+ self.set_children(x_transform, y_transform)
+
+ Affine2DBase.__init__(self)
+ self._mtx = None
+
+ def get_matrix(self):
+ # docstring inherited
+ if self._invalid:
+ if self._x == self._y:
+ self._mtx = self._x.get_matrix()
+ else:
+ x_mtx = self._x.get_matrix()
+ y_mtx = self._y.get_matrix()
+ # We already know the transforms are separable, so we can skip
+ # setting b and c to zero.
+ self._mtx = np.array([x_mtx[0], y_mtx[1], [0.0, 0.0, 1.0]])
+ self._inverted = None
+ self._invalid = 0
+ return self._mtx
+
+
+def blended_transform_factory(x_transform, y_transform):
+ """
+ Create a new "blended" transform using *x_transform* to transform
+ the *x*-axis and *y_transform* to transform the *y*-axis.
+
+ A faster version of the blended transform is returned for the case
+ where both child transforms are affine.
+ """
+ if (isinstance(x_transform, Affine2DBase) and
+ isinstance(y_transform, Affine2DBase)):
+ return BlendedAffine2D(x_transform, y_transform)
+ return BlendedGenericTransform(x_transform, y_transform)
+
+
+class CompositeGenericTransform(Transform):
+ """
+ A composite transform formed by applying transform *a* then
+ transform *b*.
+
+ This "generic" version can handle any two arbitrary
+ transformations.
+ """
+ pass_through = True
+
+ def __init__(self, a, b, **kwargs):
+ """
+ Create a new composite transform that is the result of
+ applying transform *a* then transform *b*.
+
+ You will generally not call this constructor directly but write ``a +
+ b`` instead, which will automatically choose the best kind of composite
+ transform instance to create.
+ """
+ if a.output_dims != b.input_dims:
+ raise ValueError("The output dimension of 'a' must be equal to "
+ "the input dimensions of 'b'")
+ self.input_dims = a.input_dims
+ self.output_dims = b.output_dims
+
+ super().__init__(**kwargs)
+ self._a = a
+ self._b = b
+ self.set_children(a, b)
+
+ def frozen(self):
+ # docstring inherited
+ self._invalid = 0
+ frozen = composite_transform_factory(
+ self._a.frozen(), self._b.frozen())
+ if not isinstance(frozen, CompositeGenericTransform):
+ return frozen.frozen()
+ return frozen
+
+ def _invalidate_internal(self, value, invalidating_node):
+ # In some cases for a composite transform, an invalidating call to
+ # AFFINE_ONLY needs to be extended to invalidate the NON_AFFINE part
+ # too. These cases are when the right hand transform is non-affine and
+ # either:
+ # (a) the left hand transform is non affine
+ # (b) it is the left hand node which has triggered the invalidation
+ if (value == Transform.INVALID_AFFINE and
+ not self._b.is_affine and
+ (not self._a.is_affine or invalidating_node is self._a)):
+ value = Transform.INVALID
+
+ super()._invalidate_internal(value=value,
+ invalidating_node=invalidating_node)
+
+ def __eq__(self, other):
+ if isinstance(other, (CompositeGenericTransform, CompositeAffine2D)):
+ return self is other or (self._a == other._a
+ and self._b == other._b)
+ else:
+ return False
+
+ def _iter_break_from_left_to_right(self):
+ for left, right in self._a._iter_break_from_left_to_right():
+ yield left, right + self._b
+ for left, right in self._b._iter_break_from_left_to_right():
+ yield self._a + left, right
+
+ depth = property(lambda self: self._a.depth + self._b.depth)
+ is_affine = property(lambda self: self._a.is_affine and self._b.is_affine)
+ is_separable = property(
+ lambda self: self._a.is_separable and self._b.is_separable)
+ has_inverse = property(
+ lambda self: self._a.has_inverse and self._b.has_inverse)
+
+ __str__ = _make_str_method("_a", "_b")
+
+ def transform_affine(self, points):
+ # docstring inherited
+ return self.get_affine().transform(points)
+
+ def transform_non_affine(self, points):
+ # docstring inherited
+ if self._a.is_affine and self._b.is_affine:
+ return points
+ elif not self._a.is_affine and self._b.is_affine:
+ return self._a.transform_non_affine(points)
+ else:
+ return self._b.transform_non_affine(
+ self._a.transform(points))
+
+ def transform_path_non_affine(self, path):
+ # docstring inherited
+ if self._a.is_affine and self._b.is_affine:
+ return path
+ elif not self._a.is_affine and self._b.is_affine:
+ return self._a.transform_path_non_affine(path)
+ else:
+ return self._b.transform_path_non_affine(
+ self._a.transform_path(path))
+
+ def get_affine(self):
+ # docstring inherited
+ if not self._b.is_affine:
+ return self._b.get_affine()
+ else:
+ return Affine2D(np.dot(self._b.get_affine().get_matrix(),
+ self._a.get_affine().get_matrix()))
+
+ def inverted(self):
+ # docstring inherited
+ return CompositeGenericTransform(
+ self._b.inverted(), self._a.inverted())
+
+
+class CompositeAffine2D(Affine2DBase):
+ """
+ A composite transform formed by applying transform *a* then transform *b*.
+
+ This version is an optimization that handles the case where both *a*
+ and *b* are 2D affines.
+ """
+ def __init__(self, a, b, **kwargs):
+ """
+ Create a new composite transform that is the result of
+ applying `Affine2DBase` *a* then `Affine2DBase` *b*.
+
+ You will generally not call this constructor directly but write ``a +
+ b`` instead, which will automatically choose the best kind of composite
+ transform instance to create.
+ """
+ if not a.is_affine or not b.is_affine:
+ raise ValueError("'a' and 'b' must be affine transforms")
+ if a.output_dims != b.input_dims:
+ raise ValueError("The output dimension of 'a' must be equal to "
+ "the input dimensions of 'b'")
+ self.input_dims = a.input_dims
+ self.output_dims = b.output_dims
+
+ super().__init__(**kwargs)
+ self._a = a
+ self._b = b
+ self.set_children(a, b)
+ self._mtx = None
+
+ @property
+ def depth(self):
+ return self._a.depth + self._b.depth
+
+ def _iter_break_from_left_to_right(self):
+ for left, right in self._a._iter_break_from_left_to_right():
+ yield left, right + self._b
+ for left, right in self._b._iter_break_from_left_to_right():
+ yield self._a + left, right
+
+ __str__ = _make_str_method("_a", "_b")
+
+ def get_matrix(self):
+ # docstring inherited
+ if self._invalid:
+ self._mtx = np.dot(
+ self._b.get_matrix(),
+ self._a.get_matrix())
+ self._inverted = None
+ self._invalid = 0
+ return self._mtx
+
+
+def composite_transform_factory(a, b):
+ """
+ Create a new composite transform that is the result of applying
+ transform a then transform b.
+
+ Shortcut versions of the blended transform are provided for the
+ case where both child transforms are affine, or one or the other
+ is the identity transform.
+
+ Composite transforms may also be created using the '+' operator,
+ e.g.::
+
+ c = a + b
+ """
+ # check to see if any of a or b are IdentityTransforms. We use
+ # isinstance here to guarantee that the transforms will *always*
+ # be IdentityTransforms. Since TransformWrappers are mutable,
+ # use of equality here would be wrong.
+ if isinstance(a, IdentityTransform):
+ return b
+ elif isinstance(b, IdentityTransform):
+ return a
+ elif isinstance(a, Affine2D) and isinstance(b, Affine2D):
+ return CompositeAffine2D(a, b)
+ return CompositeGenericTransform(a, b)
+
+
+class BboxTransform(Affine2DBase):
+ """
+ `BboxTransform` linearly transforms points from one `Bbox` to another.
+ """
+
+ is_separable = True
+
+ def __init__(self, boxin, boxout, **kwargs):
+ """
+ Create a new `BboxTransform` that linearly transforms
+ points from *boxin* to *boxout*.
+ """
+ if not boxin.is_bbox or not boxout.is_bbox:
+ raise ValueError("'boxin' and 'boxout' must be bbox")
+
+ super().__init__(**kwargs)
+ self._boxin = boxin
+ self._boxout = boxout
+ self.set_children(boxin, boxout)
+ self._mtx = None
+ self._inverted = None
+
+ __str__ = _make_str_method("_boxin", "_boxout")
+
+ def get_matrix(self):
+ # docstring inherited
+ if self._invalid:
+ inl, inb, inw, inh = self._boxin.bounds
+ outl, outb, outw, outh = self._boxout.bounds
+ x_scale = outw / inw
+ y_scale = outh / inh
+ if DEBUG and (x_scale == 0 or y_scale == 0):
+ raise ValueError(
+ "Transforming from or to a singular bounding box")
+ self._mtx = np.array([[x_scale, 0.0 , (-inl*x_scale+outl)],
+ [0.0 , y_scale, (-inb*y_scale+outb)],
+ [0.0 , 0.0 , 1.0 ]],
+ float)
+ self._inverted = None
+ self._invalid = 0
+ return self._mtx
+
+
+class BboxTransformTo(Affine2DBase):
+ """
+ `BboxTransformTo` is a transformation that linearly transforms points from
+ the unit bounding box to a given `Bbox`.
+ """
+
+ is_separable = True
+
+ def __init__(self, boxout, **kwargs):
+ """
+ Create a new `BboxTransformTo` that linearly transforms
+ points from the unit bounding box to *boxout*.
+ """
+ if not boxout.is_bbox:
+ raise ValueError("'boxout' must be bbox")
+
+ super().__init__(**kwargs)
+ self._boxout = boxout
+ self.set_children(boxout)
+ self._mtx = None
+ self._inverted = None
+
+ __str__ = _make_str_method("_boxout")
+
+ def get_matrix(self):
+ # docstring inherited
+ if self._invalid:
+ outl, outb, outw, outh = self._boxout.bounds
+ if DEBUG and (outw == 0 or outh == 0):
+ raise ValueError("Transforming to a singular bounding box.")
+ self._mtx = np.array([[outw, 0.0, outl],
+ [ 0.0, outh, outb],
+ [ 0.0, 0.0, 1.0]],
+ float)
+ self._inverted = None
+ self._invalid = 0
+ return self._mtx
+
+
+class BboxTransformToMaxOnly(BboxTransformTo):
+ """
+ `BboxTransformTo` is a transformation that linearly transforms points from
+ the unit bounding box to a given `Bbox` with a fixed upper left of (0, 0).
+ """
+ def get_matrix(self):
+ # docstring inherited
+ if self._invalid:
+ xmax, ymax = self._boxout.max
+ if DEBUG and (xmax == 0 or ymax == 0):
+ raise ValueError("Transforming to a singular bounding box.")
+ self._mtx = np.array([[xmax, 0.0, 0.0],
+ [ 0.0, ymax, 0.0],
+ [ 0.0, 0.0, 1.0]],
+ float)
+ self._inverted = None
+ self._invalid = 0
+ return self._mtx
+
+
+class BboxTransformFrom(Affine2DBase):
+ """
+ `BboxTransformFrom` linearly transforms points from a given `Bbox` to the
+ unit bounding box.
+ """
+ is_separable = True
+
+ def __init__(self, boxin, **kwargs):
+ if not boxin.is_bbox:
+ raise ValueError("'boxin' must be bbox")
+
+ super().__init__(**kwargs)
+ self._boxin = boxin
+ self.set_children(boxin)
+ self._mtx = None
+ self._inverted = None
+
+ __str__ = _make_str_method("_boxin")
+
+ def get_matrix(self):
+ # docstring inherited
+ if self._invalid:
+ inl, inb, inw, inh = self._boxin.bounds
+ if DEBUG and (inw == 0 or inh == 0):
+ raise ValueError("Transforming from a singular bounding box.")
+ x_scale = 1.0 / inw
+ y_scale = 1.0 / inh
+ self._mtx = np.array([[x_scale, 0.0 , (-inl*x_scale)],
+ [0.0 , y_scale, (-inb*y_scale)],
+ [0.0 , 0.0 , 1.0 ]],
+ float)
+ self._inverted = None
+ self._invalid = 0
+ return self._mtx
+
+
+class ScaledTranslation(Affine2DBase):
+ """
+ A transformation that translates by *xt* and *yt*, after *xt* and *yt*
+ have been transformed by *scale_trans*.
+ """
+ def __init__(self, xt, yt, scale_trans, **kwargs):
+ super().__init__(**kwargs)
+ self._t = (xt, yt)
+ self._scale_trans = scale_trans
+ self.set_children(scale_trans)
+ self._mtx = None
+ self._inverted = None
+
+ __str__ = _make_str_method("_t")
+
+ def get_matrix(self):
+ # docstring inherited
+ if self._invalid:
+ # A bit faster than np.identity(3).
+ self._mtx = IdentityTransform._mtx.copy()
+ self._mtx[:2, 2] = self._scale_trans.transform(self._t)
+ self._invalid = 0
+ self._inverted = None
+ return self._mtx
+
+
+class AffineDeltaTransform(Affine2DBase):
+ r"""
+ A transform wrapper for transforming displacements between pairs of points.
+
+ This class is intended to be used to transform displacements ("position
+ deltas") between pairs of points (e.g., as the ``offset_transform``
+ of `.Collection`\s): given a transform ``t`` such that ``t =
+ AffineDeltaTransform(t) + offset``, ``AffineDeltaTransform``
+ satisfies ``AffineDeltaTransform(a - b) == AffineDeltaTransform(a) -
+ AffineDeltaTransform(b)``.
+
+ This is implemented by forcing the offset components of the transform
+ matrix to zero.
+
+ This class is experimental as of 3.3, and the API may change.
+ """
+
+ def __init__(self, transform, **kwargs):
+ super().__init__(**kwargs)
+ self._base_transform = transform
+
+ __str__ = _make_str_method("_base_transform")
+
+ def get_matrix(self):
+ if self._invalid:
+ self._mtx = self._base_transform.get_matrix().copy()
+ self._mtx[:2, -1] = 0
+ return self._mtx
+
+
+class TransformedPath(TransformNode):
+ """
+ A `TransformedPath` caches a non-affine transformed copy of the
+ `~.path.Path`. This cached copy is automatically updated when the
+ non-affine part of the transform changes.
+
+ .. note::
+
+ Paths are considered immutable by this class. Any update to the
+ path's vertices/codes will not trigger a transform recomputation.
+
+ """
+ def __init__(self, path, transform):
+ """
+ Parameters
+ ----------
+ path : `~.path.Path`
+ transform : `Transform`
+ """
+ _api.check_isinstance(Transform, transform=transform)
+ super().__init__()
+ self._path = path
+ self._transform = transform
+ self.set_children(transform)
+ self._transformed_path = None
+ self._transformed_points = None
+
+ def _revalidate(self):
+ # only recompute if the invalidation includes the non_affine part of
+ # the transform
+ if (self._invalid & self.INVALID_NON_AFFINE == self.INVALID_NON_AFFINE
+ or self._transformed_path is None):
+ self._transformed_path = \
+ self._transform.transform_path_non_affine(self._path)
+ self._transformed_points = \
+ Path._fast_from_codes_and_verts(
+ self._transform.transform_non_affine(self._path.vertices),
+ None, self._path)
+ self._invalid = 0
+
+ def get_transformed_points_and_affine(self):
+ """
+ Return a copy of the child path, with the non-affine part of
+ the transform already applied, along with the affine part of
+ the path necessary to complete the transformation. Unlike
+ :meth:`get_transformed_path_and_affine`, no interpolation will
+ be performed.
+ """
+ self._revalidate()
+ return self._transformed_points, self.get_affine()
+
+ def get_transformed_path_and_affine(self):
+ """
+ Return a copy of the child path, with the non-affine part of
+ the transform already applied, along with the affine part of
+ the path necessary to complete the transformation.
+ """
+ self._revalidate()
+ return self._transformed_path, self.get_affine()
+
+ def get_fully_transformed_path(self):
+ """
+ Return a fully-transformed copy of the child path.
+ """
+ self._revalidate()
+ return self._transform.transform_path_affine(self._transformed_path)
+
+ def get_affine(self):
+ return self._transform.get_affine()
+
+
+class TransformedPatchPath(TransformedPath):
+ """
+ A `TransformedPatchPath` caches a non-affine transformed copy of the
+ `~.patches.Patch`. This cached copy is automatically updated when the
+ non-affine part of the transform or the patch changes.
+ """
+ def __init__(self, patch):
+ """
+ Parameters
+ ----------
+ patch : `~.patches.Patch`
+ """
+ TransformNode.__init__(self)
+
+ transform = patch.get_transform()
+ self._patch = patch
+ self._transform = transform
+ self.set_children(transform)
+ self._path = patch.get_path()
+ self._transformed_path = None
+ self._transformed_points = None
+
+ def _revalidate(self):
+ patch_path = self._patch.get_path()
+ # Only recompute if the invalidation includes the non_affine part of
+ # the transform, or the Patch's Path has changed.
+ if (self._transformed_path is None or self._path != patch_path or
+ (self._invalid & self.INVALID_NON_AFFINE ==
+ self.INVALID_NON_AFFINE)):
+ self._path = patch_path
+ self._transformed_path = \
+ self._transform.transform_path_non_affine(patch_path)
+ self._transformed_points = \
+ Path._fast_from_codes_and_verts(
+ self._transform.transform_non_affine(patch_path.vertices),
+ None, patch_path)
+ self._invalid = 0
+
+
+def nonsingular(vmin, vmax, expander=0.001, tiny=1e-15, increasing=True):
+ """
+ Modify the endpoints of a range as needed to avoid singularities.
+
+ Parameters
+ ----------
+ vmin, vmax : float
+ The initial endpoints.
+ expander : float, default: 0.001
+ Fractional amount by which *vmin* and *vmax* are expanded if
+ the original interval is too small, based on *tiny*.
+ tiny : float, default: 1e-15
+ Threshold for the ratio of the interval to the maximum absolute
+ value of its endpoints. If the interval is smaller than
+ this, it will be expanded. This value should be around
+ 1e-15 or larger; otherwise the interval will be approaching
+ the double precision resolution limit.
+ increasing : bool, default: True
+ If True, swap *vmin*, *vmax* if *vmin* > *vmax*.
+
+ Returns
+ -------
+ vmin, vmax : float
+ Endpoints, expanded and/or swapped if necessary.
+ If either input is inf or NaN, or if both inputs are 0 or very
+ close to zero, it returns -*expander*, *expander*.
+ """
+
+ if (not np.isfinite(vmin)) or (not np.isfinite(vmax)):
+ return -expander, expander
+
+ swapped = False
+ if vmax < vmin:
+ vmin, vmax = vmax, vmin
+ swapped = True
+
+ # Expand vmin, vmax to float: if they were integer types, they can wrap
+ # around in abs (abs(np.int8(-128)) == -128) and vmax - vmin can overflow.
+ vmin, vmax = map(float, [vmin, vmax])
+
+ maxabsvalue = max(abs(vmin), abs(vmax))
+ if maxabsvalue < (1e6 / tiny) * np.finfo(float).tiny:
+ vmin = -expander
+ vmax = expander
+
+ elif vmax - vmin <= maxabsvalue * tiny:
+ if vmax == 0 and vmin == 0:
+ vmin = -expander
+ vmax = expander
+ else:
+ vmin -= expander*abs(vmin)
+ vmax += expander*abs(vmax)
+
+ if swapped and not increasing:
+ vmin, vmax = vmax, vmin
+ return vmin, vmax
+
+
+def interval_contains(interval, val):
+ """
+ Check, inclusively, whether an interval includes a given value.
+
+ Parameters
+ ----------
+ interval : (float, float)
+ The endpoints of the interval.
+ val : float
+ Value to check is within interval.
+
+ Returns
+ -------
+ bool
+ Whether *val* is within the *interval*.
+ """
+ a, b = interval
+ if a > b:
+ a, b = b, a
+ return a <= val <= b
+
+
+def _interval_contains_close(interval, val, rtol=1e-10):
+ """
+ Check, inclusively, whether an interval includes a given value, with the
+ interval expanded by a small tolerance to admit floating point errors.
+
+ Parameters
+ ----------
+ interval : (float, float)
+ The endpoints of the interval.
+ val : float
+ Value to check is within interval.
+ rtol : float, default: 1e-10
+ Relative tolerance slippage allowed outside of the interval.
+ For an interval ``[a, b]``, values
+ ``a - rtol * (b - a) <= val <= b + rtol * (b - a)`` are considered
+ inside the interval.
+
+ Returns
+ -------
+ bool
+ Whether *val* is within the *interval* (with tolerance).
+ """
+ a, b = interval
+ if a > b:
+ a, b = b, a
+ rtol = (b - a) * rtol
+ return a - rtol <= val <= b + rtol
+
+
+def interval_contains_open(interval, val):
+ """
+ Check, excluding endpoints, whether an interval includes a given value.
+
+ Parameters
+ ----------
+ interval : (float, float)
+ The endpoints of the interval.
+ val : float
+ Value to check is within interval.
+
+ Returns
+ -------
+ bool
+ Whether *val* is within the *interval*.
+ """
+ a, b = interval
+ return a < val < b or a > val > b
+
+
+def offset_copy(trans, fig=None, x=0.0, y=0.0, units='inches'):
+ """
+ Return a new transform with an added offset.
+
+ Parameters
+ ----------
+ trans : `Transform` subclass
+ Any transform, to which offset will be applied.
+ fig : `~matplotlib.figure.Figure`, default: None
+ Current figure. It can be None if *units* are 'dots'.
+ x, y : float, default: 0.0
+ The offset to apply.
+ units : {'inches', 'points', 'dots'}, default: 'inches'
+ Units of the offset.
+
+ Returns
+ -------
+ `Transform` subclass
+ Transform with applied offset.
+ """
+ if units == 'dots':
+ return trans + Affine2D().translate(x, y)
+ if fig is None:
+ raise ValueError('For units of inches or points a fig kwarg is needed')
+ if units == 'points':
+ x /= 72.0
+ y /= 72.0
+ elif units == 'inches':
+ pass
+ else:
+ _api.check_in_list(['dots', 'points', 'inches'], units=units)
+ return trans + ScaledTranslation(x, y, fig.dpi_scale_trans)
diff --git a/venv/Lib/site-packages/matplotlib/tri/__init__.py b/venv/Lib/site-packages/matplotlib/tri/__init__.py
new file mode 100644
index 0000000..7ff2b32
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tri/__init__.py
@@ -0,0 +1,12 @@
+"""
+Unstructured triangular grid functions.
+"""
+
+from .triangulation import *
+from .tricontour import *
+from .tritools import *
+from .trifinder import *
+from .triinterpolate import *
+from .trirefine import *
+from .tripcolor import *
+from .triplot import *
diff --git a/venv/Lib/site-packages/matplotlib/tri/triangulation.py b/venv/Lib/site-packages/matplotlib/tri/triangulation.py
new file mode 100644
index 0000000..24e9963
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tri/triangulation.py
@@ -0,0 +1,220 @@
+import numpy as np
+
+
+class Triangulation:
+ """
+ An unstructured triangular grid consisting of npoints points and
+ ntri triangles. The triangles can either be specified by the user
+ or automatically generated using a Delaunay triangulation.
+
+ Parameters
+ ----------
+ x, y : (npoints,) array-like
+ Coordinates of grid points.
+ triangles : (ntri, 3) array-like of int, optional
+ For each triangle, the indices of the three points that make
+ up the triangle, ordered in an anticlockwise manner. If not
+ specified, the Delaunay triangulation is calculated.
+ mask : (ntri,) array-like of bool, optional
+ Which triangles are masked out.
+
+ Attributes
+ ----------
+ triangles : (ntri, 3) array of int
+ For each triangle, the indices of the three points that make
+ up the triangle, ordered in an anticlockwise manner. If you want to
+ take the *mask* into account, use `get_masked_triangles` instead.
+ mask : (ntri, 3) array of bool
+ Masked out triangles.
+ is_delaunay : bool
+ Whether the Triangulation is a calculated Delaunay
+ triangulation (where *triangles* was not specified) or not.
+
+ Notes
+ -----
+ For a Triangulation to be valid it must not have duplicate points,
+ triangles formed from colinear points, or overlapping triangles.
+ """
+ def __init__(self, x, y, triangles=None, mask=None):
+ from matplotlib import _qhull
+
+ self.x = np.asarray(x, dtype=np.float64)
+ self.y = np.asarray(y, dtype=np.float64)
+ if self.x.shape != self.y.shape or self.x.ndim != 1:
+ raise ValueError("x and y must be equal-length 1D arrays")
+
+ self.mask = None
+ self._edges = None
+ self._neighbors = None
+ self.is_delaunay = False
+
+ if triangles is None:
+ # No triangulation specified, so use matplotlib._qhull to obtain
+ # Delaunay triangulation.
+ self.triangles, self._neighbors = _qhull.delaunay(x, y)
+ self.is_delaunay = True
+ else:
+ # Triangulation specified. Copy, since we may correct triangle
+ # orientation.
+ self.triangles = np.array(triangles, dtype=np.int32, order='C')
+ if self.triangles.ndim != 2 or self.triangles.shape[1] != 3:
+ raise ValueError('triangles must be a (?, 3) array')
+ if self.triangles.max() >= len(self.x):
+ raise ValueError('triangles max element is out of bounds')
+ if self.triangles.min() < 0:
+ raise ValueError('triangles min element is out of bounds')
+
+ if mask is not None:
+ self.mask = np.asarray(mask, dtype=bool)
+ if self.mask.shape != (self.triangles.shape[0],):
+ raise ValueError('mask array must have same length as '
+ 'triangles array')
+
+ # Underlying C++ object is not created until first needed.
+ self._cpp_triangulation = None
+
+ # Default TriFinder not created until needed.
+ self._trifinder = None
+
+ def calculate_plane_coefficients(self, z):
+ """
+ Calculate plane equation coefficients for all unmasked triangles from
+ the point (x, y) coordinates and specified z-array of shape (npoints).
+ The returned array has shape (npoints, 3) and allows z-value at (x, y)
+ position in triangle tri to be calculated using
+ ``z = array[tri, 0] * x + array[tri, 1] * y + array[tri, 2]``.
+ """
+ return self.get_cpp_triangulation().calculate_plane_coefficients(z)
+
+ @property
+ def edges(self):
+ """
+ Return integer array of shape (nedges, 2) containing all edges of
+ non-masked triangles.
+
+ Each row defines an edge by it's start point index and end point
+ index. Each edge appears only once, i.e. for an edge between points
+ *i* and *j*, there will only be either *(i, j)* or *(j, i)*.
+ """
+ if self._edges is None:
+ self._edges = self.get_cpp_triangulation().get_edges()
+ return self._edges
+
+ def get_cpp_triangulation(self):
+ """
+ Return the underlying C++ Triangulation object, creating it
+ if necessary.
+ """
+ from matplotlib import _tri
+ if self._cpp_triangulation is None:
+ self._cpp_triangulation = _tri.Triangulation(
+ self.x, self.y, self.triangles, self.mask, self._edges,
+ self._neighbors, not self.is_delaunay)
+ return self._cpp_triangulation
+
+ def get_masked_triangles(self):
+ """
+ Return an array of triangles that are not masked.
+ """
+ if self.mask is not None:
+ return self.triangles[~self.mask]
+ else:
+ return self.triangles
+
+ @staticmethod
+ def get_from_args_and_kwargs(*args, **kwargs):
+ """
+ Return a Triangulation object from the args and kwargs, and
+ the remaining args and kwargs with the consumed values removed.
+
+ There are two alternatives: either the first argument is a
+ Triangulation object, in which case it is returned, or the args
+ and kwargs are sufficient to create a new Triangulation to
+ return. In the latter case, see Triangulation.__init__ for
+ the possible args and kwargs.
+ """
+ if isinstance(args[0], Triangulation):
+ triangulation, *args = args
+ else:
+ x, y, *args = args
+
+ # Check triangles in kwargs then args.
+ triangles = kwargs.pop('triangles', None)
+ from_args = False
+ if triangles is None and args:
+ triangles = args[0]
+ from_args = True
+
+ if triangles is not None:
+ try:
+ triangles = np.asarray(triangles, dtype=np.int32)
+ except ValueError:
+ triangles = None
+
+ if triangles is not None and (triangles.ndim != 2 or
+ triangles.shape[1] != 3):
+ triangles = None
+
+ if triangles is not None and from_args:
+ args = args[1:] # Consumed first item in args.
+
+ # Check for mask in kwargs.
+ mask = kwargs.pop('mask', None)
+
+ triangulation = Triangulation(x, y, triangles, mask)
+ return triangulation, args, kwargs
+
+ def get_trifinder(self):
+ """
+ Return the default `matplotlib.tri.TriFinder` of this
+ triangulation, creating it if necessary. This allows the same
+ TriFinder object to be easily shared.
+ """
+ if self._trifinder is None:
+ # Default TriFinder class.
+ from matplotlib.tri.trifinder import TrapezoidMapTriFinder
+ self._trifinder = TrapezoidMapTriFinder(self)
+ return self._trifinder
+
+ @property
+ def neighbors(self):
+ """
+ Return integer array of shape (ntri, 3) containing neighbor triangles.
+
+ For each triangle, the indices of the three triangles that
+ share the same edges, or -1 if there is no such neighboring
+ triangle. ``neighbors[i, j]`` is the triangle that is the neighbor
+ to the edge from point index ``triangles[i, j]`` to point index
+ ``triangles[i, (j+1)%3]``.
+ """
+ if self._neighbors is None:
+ self._neighbors = self.get_cpp_triangulation().get_neighbors()
+ return self._neighbors
+
+ def set_mask(self, mask):
+ """
+ Set or clear the mask array.
+
+ Parameters
+ ----------
+ mask : None or bool array of length ntri
+ """
+ if mask is None:
+ self.mask = None
+ else:
+ self.mask = np.asarray(mask, dtype=bool)
+ if self.mask.shape != (self.triangles.shape[0],):
+ raise ValueError('mask array must have same length as '
+ 'triangles array')
+
+ # Set mask in C++ Triangulation.
+ if self._cpp_triangulation is not None:
+ self._cpp_triangulation.set_mask(self.mask)
+
+ # Clear derived fields so they are recalculated when needed.
+ self._edges = None
+ self._neighbors = None
+
+ # Recalculate TriFinder if it exists.
+ if self._trifinder is not None:
+ self._trifinder._initialize()
diff --git a/venv/Lib/site-packages/matplotlib/tri/tricontour.py b/venv/Lib/site-packages/matplotlib/tri/tricontour.py
new file mode 100644
index 0000000..a9f1339
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tri/tricontour.py
@@ -0,0 +1,323 @@
+import numpy as np
+
+from matplotlib import docstring
+from matplotlib.contour import ContourSet
+from matplotlib.tri.triangulation import Triangulation
+
+
+@docstring.dedent_interpd
+class TriContourSet(ContourSet):
+ """
+ Create and store a set of contour lines or filled regions for
+ a triangular grid.
+
+ This class is typically not instantiated directly by the user but by
+ `~.Axes.tricontour` and `~.Axes.tricontourf`.
+
+ %(contour_set_attributes)s
+ """
+ def __init__(self, ax, *args, **kwargs):
+ """
+ Draw triangular grid contour lines or filled regions,
+ depending on whether keyword arg 'filled' is False
+ (default) or True.
+
+ The first argument of the initializer must be an axes
+ object. The remaining arguments and keyword arguments
+ are described in the docstring of `~.Axes.tricontour`.
+ """
+ super().__init__(ax, *args, **kwargs)
+
+ def _process_args(self, *args, **kwargs):
+ """
+ Process args and kwargs.
+ """
+ if isinstance(args[0], TriContourSet):
+ C = args[0].cppContourGenerator
+ if self.levels is None:
+ self.levels = args[0].levels
+ else:
+ from matplotlib import _tri
+ tri, z = self._contour_args(args, kwargs)
+ C = _tri.TriContourGenerator(tri.get_cpp_triangulation(), z)
+ self._mins = [tri.x.min(), tri.y.min()]
+ self._maxs = [tri.x.max(), tri.y.max()]
+
+ self.cppContourGenerator = C
+ return kwargs
+
+ def _get_allsegs_and_allkinds(self):
+ """
+ Create and return allsegs and allkinds by calling underlying C code.
+ """
+ allsegs = []
+ if self.filled:
+ lowers, uppers = self._get_lowers_and_uppers()
+ allkinds = []
+ for lower, upper in zip(lowers, uppers):
+ segs, kinds = self.cppContourGenerator.create_filled_contour(
+ lower, upper)
+ allsegs.append([segs])
+ allkinds.append([kinds])
+ else:
+ allkinds = None
+ for level in self.levels:
+ segs = self.cppContourGenerator.create_contour(level)
+ allsegs.append(segs)
+ return allsegs, allkinds
+
+ def _contour_args(self, args, kwargs):
+ if self.filled:
+ fn = 'contourf'
+ else:
+ fn = 'contour'
+ tri, args, kwargs = Triangulation.get_from_args_and_kwargs(*args,
+ **kwargs)
+ z = np.ma.asarray(args[0])
+ if z.shape != tri.x.shape:
+ raise ValueError('z array must have same length as triangulation x'
+ ' and y arrays')
+
+ # z values must be finite, only need to check points that are included
+ # in the triangulation.
+ z_check = z[np.unique(tri.get_masked_triangles())]
+ if np.ma.is_masked(z_check):
+ raise ValueError('z must not contain masked points within the '
+ 'triangulation')
+ if not np.isfinite(z_check).all():
+ raise ValueError('z array must not contain non-finite values '
+ 'within the triangulation')
+
+ z = np.ma.masked_invalid(z, copy=False)
+ self.zmax = float(z_check.max())
+ self.zmin = float(z_check.min())
+ if self.logscale and self.zmin <= 0:
+ raise ValueError('Cannot %s log of negative values.' % fn)
+ self._process_contour_level_args(args[1:])
+ return (tri, z)
+
+
+docstring.interpd.update(_tricontour_doc="""
+Draw contour %(type)s on an unstructured triangular grid.
+
+The triangulation can be specified in one of two ways; either ::
+
+ %(func)s(triangulation, ...)
+
+where *triangulation* is a `.Triangulation` object, or ::
+
+ %(func)s(x, y, ...)
+ %(func)s(x, y, triangles, ...)
+ %(func)s(x, y, triangles=triangles, ...)
+ %(func)s(x, y, mask=mask, ...)
+ %(func)s(x, y, triangles, mask=mask, ...)
+
+in which case a `.Triangulation` object will be created. See that class'
+docstring for an explanation of these cases.
+
+The remaining arguments may be::
+
+ %(func)s(..., Z)
+
+where *Z* is the array of values to contour, one per point in the
+triangulation. The level values are chosen automatically.
+
+::
+
+ %(func)s(..., Z, levels)
+
+contour up to *levels+1* automatically chosen contour levels (*levels*
+intervals).
+
+::
+
+ %(func)s(..., Z, levels)
+
+draw contour %(type)s at the values specified in sequence *levels*, which must
+be in increasing order.
+
+::
+
+ %(func)s(Z, **kwargs)
+
+Use keyword arguments to control colors, linewidth, origin, cmap ... see below
+for more details.
+
+Parameters
+----------
+triangulation : `.Triangulation`, optional
+ The unstructured triangular grid.
+
+ If specified, then *x*, *y*, *triangles*, and *mask* are not accepted.
+
+x, y : array-like, optional
+ The coordinates of the values in *Z*.
+
+triangles : (ntri, 3) array-like of int, optional
+ For each triangle, the indices of the three points that make up the
+ triangle, ordered in an anticlockwise manner. If not specified, the
+ Delaunay triangulation is calculated.
+
+mask : (ntri,) array-like of bool, optional
+ Which triangles are masked out.
+
+Z : 2D array-like
+ The height values over which the contour is drawn.
+
+levels : int or array-like, optional
+ Determines the number and positions of the contour lines / regions.
+
+ If an int *n*, use `~matplotlib.ticker.MaxNLocator`, which tries to
+ automatically choose no more than *n+1* "nice" contour levels between
+ *vmin* and *vmax*.
+
+ If array-like, draw contour lines at the specified levels. The values must
+ be in increasing order.
+
+Returns
+-------
+`~matplotlib.tri.TriContourSet`
+
+Other Parameters
+----------------
+colors : color string or sequence of colors, optional
+ The colors of the levels, i.e., the contour %(type)s.
+
+ The sequence is cycled for the levels in ascending order. If the sequence
+ is shorter than the number of levels, it's repeated.
+
+ As a shortcut, single color strings may be used in place of one-element
+ lists, i.e. ``'red'`` instead of ``['red']`` to color all levels with the
+ same color. This shortcut does only work for color strings, not for other
+ ways of specifying colors.
+
+ By default (value *None*), the colormap specified by *cmap* will be used.
+
+alpha : float, default: 1
+ The alpha blending value, between 0 (transparent) and 1 (opaque).
+
+cmap : str or `.Colormap`, default: :rc:`image.cmap`
+ A `.Colormap` instance or registered colormap name. The colormap maps the
+ level values to colors.
+
+ If both *colors* and *cmap* are given, an error is raised.
+
+norm : `~matplotlib.colors.Normalize`, optional
+ If a colormap is used, the `.Normalize` instance scales the level values to
+ the canonical colormap range [0, 1] for mapping to colors. If not given,
+ the default linear scaling is used.
+
+vmin, vmax : float, optional
+ If not *None*, either or both of these values will be supplied to
+ the `.Normalize` instance, overriding the default color scaling
+ based on *levels*.
+
+origin : {*None*, 'upper', 'lower', 'image'}, default: None
+ Determines the orientation and exact position of *Z* by specifying the
+ position of ``Z[0, 0]``. This is only relevant, if *X*, *Y* are not given.
+
+ - *None*: ``Z[0, 0]`` is at X=0, Y=0 in the lower left corner.
+ - 'lower': ``Z[0, 0]`` is at X=0.5, Y=0.5 in the lower left corner.
+ - 'upper': ``Z[0, 0]`` is at X=N+0.5, Y=0.5 in the upper left corner.
+ - 'image': Use the value from :rc:`image.origin`.
+
+extent : (x0, x1, y0, y1), optional
+ If *origin* is not *None*, then *extent* is interpreted as in `.imshow`: it
+ gives the outer pixel boundaries. In this case, the position of Z[0, 0] is
+ the center of the pixel, not a corner. If *origin* is *None*, then
+ (*x0*, *y0*) is the position of Z[0, 0], and (*x1*, *y1*) is the position
+ of Z[-1, -1].
+
+ This argument is ignored if *X* and *Y* are specified in the call to
+ contour.
+
+locator : ticker.Locator subclass, optional
+ The locator is used to determine the contour levels if they are not given
+ explicitly via *levels*.
+ Defaults to `~.ticker.MaxNLocator`.
+
+extend : {'neither', 'both', 'min', 'max'}, default: 'neither'
+ Determines the ``%(func)s``-coloring of values that are outside the
+ *levels* range.
+
+ If 'neither', values outside the *levels* range are not colored. If 'min',
+ 'max' or 'both', color the values below, above or below and above the
+ *levels* range.
+
+ Values below ``min(levels)`` and above ``max(levels)`` are mapped to the
+ under/over values of the `.Colormap`. Note that most colormaps do not have
+ dedicated colors for these by default, so that the over and under values
+ are the edge values of the colormap. You may want to set these values
+ explicitly using `.Colormap.set_under` and `.Colormap.set_over`.
+
+ .. note::
+
+ An existing `.TriContourSet` does not get notified if properties of its
+ colormap are changed. Therefore, an explicit call to
+ `.ContourSet.changed()` is needed after modifying the colormap. The
+ explicit call can be left out, if a colorbar is assigned to the
+ `.TriContourSet` because it internally calls `.ContourSet.changed()`.
+
+xunits, yunits : registered units, optional
+ Override axis units by specifying an instance of a
+ :class:`matplotlib.units.ConversionInterface`.
+
+antialiased : bool, optional
+ Enable antialiasing, overriding the defaults. For
+ filled contours, the default is *True*. For line contours,
+ it is taken from :rc:`lines.antialiased`.""")
+
+
+@docstring.Substitution(func='tricontour', type='lines')
+@docstring.dedent_interpd
+def tricontour(ax, *args, **kwargs):
+ """
+ %(_tricontour_doc)s
+
+ linewidths : float or array-like, default: :rc:`contour.linewidth`
+ The line width of the contour lines.
+
+ If a number, all levels will be plotted with this linewidth.
+
+ If a sequence, the levels in ascending order will be plotted with
+ the linewidths in the order specified.
+
+ If None, this falls back to :rc:`lines.linewidth`.
+
+ linestyles : {*None*, 'solid', 'dashed', 'dashdot', 'dotted'}, optional
+ If *linestyles* is *None*, the default is 'solid' unless the lines are
+ monochrome. In that case, negative contours will take their linestyle
+ from :rc:`contour.negative_linestyle` setting.
+
+ *linestyles* can also be an iterable of the above strings specifying a
+ set of linestyles to be used. If this iterable is shorter than the
+ number of contour levels it will be repeated as necessary.
+ """
+ kwargs['filled'] = False
+ return TriContourSet(ax, *args, **kwargs)
+
+
+@docstring.Substitution(func='tricontourf', type='regions')
+@docstring.dedent_interpd
+def tricontourf(ax, *args, **kwargs):
+ """
+ %(_tricontour_doc)s
+
+ hatches : list[str], optional
+ A list of cross hatch patterns to use on the filled areas.
+ If None, no hatching will be added to the contour.
+ Hatching is supported in the PostScript, PDF, SVG and Agg
+ backends only.
+
+ Notes
+ -----
+ `.tricontourf` fills intervals that are closed at the top; that is, for
+ boundaries *z1* and *z2*, the filled region is::
+
+ z1 < Z <= z2
+
+ except for the lowest interval, which is closed on both sides (i.e. it
+ includes the lowest value).
+ """
+ kwargs['filled'] = True
+ return TriContourSet(ax, *args, **kwargs)
diff --git a/venv/Lib/site-packages/matplotlib/tri/trifinder.py b/venv/Lib/site-packages/matplotlib/tri/trifinder.py
new file mode 100644
index 0000000..e06b84c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tri/trifinder.py
@@ -0,0 +1,93 @@
+import numpy as np
+
+from matplotlib import _api
+from matplotlib.tri import Triangulation
+
+
+class TriFinder:
+ """
+ Abstract base class for classes used to find the triangles of a
+ Triangulation in which (x, y) points lie.
+
+ Rather than instantiate an object of a class derived from TriFinder, it is
+ usually better to use the function `.Triangulation.get_trifinder`.
+
+ Derived classes implement __call__(x, y) where x and y are array-like point
+ coordinates of the same shape.
+ """
+
+ def __init__(self, triangulation):
+ _api.check_isinstance(Triangulation, triangulation=triangulation)
+ self._triangulation = triangulation
+
+
+class TrapezoidMapTriFinder(TriFinder):
+ """
+ `~matplotlib.tri.TriFinder` class implemented using the trapezoid
+ map algorithm from the book "Computational Geometry, Algorithms and
+ Applications", second edition, by M. de Berg, M. van Kreveld, M. Overmars
+ and O. Schwarzkopf.
+
+ The triangulation must be valid, i.e. it must not have duplicate points,
+ triangles formed from colinear points, or overlapping triangles. The
+ algorithm has some tolerance to triangles formed from colinear points, but
+ this should not be relied upon.
+ """
+
+ def __init__(self, triangulation):
+ from matplotlib import _tri
+ super().__init__(triangulation)
+ self._cpp_trifinder = _tri.TrapezoidMapTriFinder(
+ triangulation.get_cpp_triangulation())
+ self._initialize()
+
+ def __call__(self, x, y):
+ """
+ Return an array containing the indices of the triangles in which the
+ specified *x*, *y* points lie, or -1 for points that do not lie within
+ a triangle.
+
+ *x*, *y* are array-like x and y coordinates of the same shape and any
+ number of dimensions.
+
+ Returns integer array with the same shape and *x* and *y*.
+ """
+ x = np.asarray(x, dtype=np.float64)
+ y = np.asarray(y, dtype=np.float64)
+ if x.shape != y.shape:
+ raise ValueError("x and y must be array-like with the same shape")
+
+ # C++ does the heavy lifting, and expects 1D arrays.
+ indices = (self._cpp_trifinder.find_many(x.ravel(), y.ravel())
+ .reshape(x.shape))
+ return indices
+
+ def _get_tree_stats(self):
+ """
+ Return a python list containing the statistics about the node tree:
+ 0: number of nodes (tree size)
+ 1: number of unique nodes
+ 2: number of trapezoids (tree leaf nodes)
+ 3: number of unique trapezoids
+ 4: maximum parent count (max number of times a node is repeated in
+ tree)
+ 5: maximum depth of tree (one more than the maximum number of
+ comparisons needed to search through the tree)
+ 6: mean of all trapezoid depths (one more than the average number
+ of comparisons needed to search through the tree)
+ """
+ return self._cpp_trifinder.get_tree_stats()
+
+ def _initialize(self):
+ """
+ Initialize the underlying C++ object. Can be called multiple times if,
+ for example, the triangulation is modified.
+ """
+ self._cpp_trifinder.initialize()
+
+ def _print_tree(self):
+ """
+ Print a text representation of the node tree, which is useful for
+ debugging purposes.
+ """
+ self._cpp_trifinder.print_tree()
diff --git a/venv/Lib/site-packages/matplotlib/tri/triinterpolate.py b/venv/Lib/site-packages/matplotlib/tri/triinterpolate.py
new file mode 100644
index 0000000..9c83118
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tri/triinterpolate.py
@@ -0,0 +1,1579 @@
+"""
+Interpolation inside triangular grids.
+"""
+
+import numpy as np
+
+from matplotlib import _api
+from matplotlib.tri import Triangulation
+from matplotlib.tri.trifinder import TriFinder
+from matplotlib.tri.tritools import TriAnalyzer
+
+__all__ = ('TriInterpolator', 'LinearTriInterpolator', 'CubicTriInterpolator')
+
+
+class TriInterpolator:
+ """
+ Abstract base class for classes used to interpolate on a triangular grid.
+
+ Derived classes implement the following methods:
+
+ - ``__call__(x, y)``,
+ where x, y are array-like point coordinates of the same shape, and
+ that returns a masked array of the same shape containing the
+ interpolated z-values.
+
+ - ``gradient(x, y)``,
+ where x, y are array-like point coordinates of the same
+ shape, and that returns a list of 2 masked arrays of the same shape
+ containing the 2 derivatives of the interpolator (derivatives of
+ interpolated z values with respect to x and y).
+ """
+
+ def __init__(self, triangulation, z, trifinder=None):
+ _api.check_isinstance(Triangulation, triangulation=triangulation)
+ self._triangulation = triangulation
+
+ self._z = np.asarray(z)
+ if self._z.shape != self._triangulation.x.shape:
+ raise ValueError("z array must have same length as triangulation x"
+ " and y arrays")
+
+ _api.check_isinstance((TriFinder, None), trifinder=trifinder)
+ self._trifinder = trifinder or self._triangulation.get_trifinder()
+
+ # Default scaling factors : 1.0 (= no scaling)
+ # Scaling may be used for interpolations for which the order of
+ # magnitude of x, y has an impact on the interpolant definition.
+ # Please refer to :meth:`_interpolate_multikeys` for details.
+ self._unit_x = 1.0
+ self._unit_y = 1.0
+
+ # Default triangle renumbering: None (= no renumbering)
+ # Renumbering may be used to avoid unnecessary computations
+ # if complex calculations are done inside the Interpolator.
+ # Please refer to :meth:`_interpolate_multikeys` for details.
+ self._tri_renum = None
+
+ # __call__ and gradient docstrings are shared by all subclasses
+ # (except, if needed, relevant additions).
+ # However these methods are only implemented in subclasses to avoid
+ # confusion in the documentation.
+ _docstring__call__ = """
+ Returns a masked array containing interpolated values at the specified
+ (x, y) points.
+
+ Parameters
+ ----------
+ x, y : array-like
+ x and y coordinates of the same shape and any number of
+ dimensions.
+
+ Returns
+ -------
+ np.ma.array
+ Masked array of the same shape as *x* and *y*; values corresponding
+ to (*x*, *y*) points outside of the triangulation are masked out.
+
+ """
+
+ _docstringgradient = r"""
+ Returns a list of 2 masked arrays containing interpolated derivatives
+ at the specified (x, y) points.
+
+ Parameters
+ ----------
+ x, y : array-like
+ x and y coordinates of the same shape and any number of
+ dimensions.
+
+ Returns
+ -------
+ dzdx, dzdy : np.ma.array
+ 2 masked arrays of the same shape as *x* and *y*; values
+ corresponding to (x, y) points outside of the triangulation
+ are masked out.
+ The first returned array contains the values of
+ :math:`\frac{\partial z}{\partial x}` and the second those of
+ :math:`\frac{\partial z}{\partial y}`.
+
+ """
+
+ def _interpolate_multikeys(self, x, y, tri_index=None,
+ return_keys=('z',)):
+ """
+ Versatile (private) method defined for all TriInterpolators.
+
+ :meth:`_interpolate_multikeys` is a wrapper around method
+ :meth:`_interpolate_single_key` (to be defined in the child
+ subclasses).
+ :meth:`_interpolate_single_key actually performs the interpolation,
+ but only for 1-dimensional inputs and at valid locations (inside
+ unmasked triangles of the triangulation).
+
+ The purpose of :meth:`_interpolate_multikeys` is to implement the
+ following common tasks needed in all subclasses implementations:
+
+ - calculation of containing triangles
+ - dealing with more than one interpolation request at the same
+ location (e.g., if the 2 derivatives are requested, it is
+ unnecessary to compute the containing triangles twice)
+ - scaling according to self._unit_x, self._unit_y
+ - dealing with points outside of the grid (with fill value np.nan)
+ - dealing with multi-dimensional *x*, *y* arrays: flattening for
+ :meth:`_interpolate_params` call and final reshaping.
+
+ (Note that np.vectorize could do most of those things very well for
+ you, but it does it by function evaluations over successive tuples of
+ the input arrays. Therefore, this tends to be more time consuming than
+ using optimized numpy functions - e.g., np.dot - which can be used
+ easily on the flattened inputs, in the child-subclass methods
+ :meth:`_interpolate_single_key`.)
+
+ It is guaranteed that the calls to :meth:`_interpolate_single_key`
+ will be done with flattened (1-d) array-like input parameters *x*, *y*
+ and with flattened, valid `tri_index` arrays (no -1 index allowed).
+
+ Parameters
+ ----------
+ x, y : array-like
+ x and y coordinates where interpolated values are requested.
+ tri_index : array-like of int, optional
+ Array of the containing triangle indices, same shape as
+ *x* and *y*. Defaults to None. If None, these indices
+ will be computed by a TriFinder instance.
+ (Note: For point outside the grid, tri_index[ipt] shall be -1).
+ return_keys : tuple of keys from {'z', 'dzdx', 'dzdy'}
+ Defines the interpolation arrays to return, and in which order.
+
+ Returns
+ -------
+ list of arrays
+ Each array-like contains the expected interpolated values in the
+ order defined by *return_keys* parameter.
+ """
+ # Flattening and rescaling inputs arrays x, y
+ # (initial shape is stored for output)
+ x = np.asarray(x, dtype=np.float64)
+ y = np.asarray(y, dtype=np.float64)
+ sh_ret = x.shape
+ if x.shape != y.shape:
+ raise ValueError("x and y shall have same shapes."
+ " Given: {0} and {1}".format(x.shape, y.shape))
+ x = np.ravel(x)
+ y = np.ravel(y)
+ x_scaled = x/self._unit_x
+ y_scaled = y/self._unit_y
+ size_ret = np.size(x_scaled)
+
+ # Computes & ravels the element indexes, extract the valid ones.
+ if tri_index is None:
+ tri_index = self._trifinder(x, y)
+ else:
+ if tri_index.shape != sh_ret:
+ raise ValueError(
+ "tri_index array is provided and shall"
+ " have same shape as x and y. Given: "
+ "{0} and {1}".format(tri_index.shape, sh_ret))
+ tri_index = np.ravel(tri_index)
+
+ mask_in = (tri_index != -1)
+ if self._tri_renum is None:
+ valid_tri_index = tri_index[mask_in]
+ else:
+ valid_tri_index = self._tri_renum[tri_index[mask_in]]
+ valid_x = x_scaled[mask_in]
+ valid_y = y_scaled[mask_in]
+
+ ret = []
+ for return_key in return_keys:
+ # Find the return index associated with the key.
+ try:
+ return_index = {'z': 0, 'dzdx': 1, 'dzdy': 2}[return_key]
+ except KeyError as err:
+ raise ValueError("return_keys items shall take values in"
+ " {'z', 'dzdx', 'dzdy'}") from err
+
+ # Sets the scale factor for f & df components
+ scale = [1., 1./self._unit_x, 1./self._unit_y][return_index]
+
+ # Computes the interpolation
+ ret_loc = np.empty(size_ret, dtype=np.float64)
+ ret_loc[~mask_in] = np.nan
+ ret_loc[mask_in] = self._interpolate_single_key(
+ return_key, valid_tri_index, valid_x, valid_y) * scale
+ ret += [np.ma.masked_invalid(ret_loc.reshape(sh_ret), copy=False)]
+
+ return ret
+
+ def _interpolate_single_key(self, return_key, tri_index, x, y):
+ """
+ Interpolate at points belonging to the triangulation
+ (inside an unmasked triangles).
+
+ Parameters
+ ----------
+ return_key : {'z', 'dzdx', 'dzdy'}
+ The requested values (z or its derivatives).
+ tri_index : 1D int array
+ Valid triangle index (cannot be -1).
+ x, y : 1D arrays, same shape as `tri_index`
+ Valid locations where interpolation is requested.
+
+ Returns
+ -------
+ 1-d array
+ Returned array of the same size as *tri_index*
+ """
+ raise NotImplementedError("TriInterpolator subclasses" +
+ "should implement _interpolate_single_key!")
+
+
+class LinearTriInterpolator(TriInterpolator):
+ """
+ Linear interpolator on a triangular grid.
+
+ Each triangle is represented by a plane so that an interpolated value at
+ point (x, y) lies on the plane of the triangle containing (x, y).
+ Interpolated values are therefore continuous across the triangulation, but
+ their first derivatives are discontinuous at edges between triangles.
+
+ Parameters
+ ----------
+ triangulation : `~matplotlib.tri.Triangulation`
+ The triangulation to interpolate over.
+ z : (npoints,) array-like
+ Array of values, defined at grid points, to interpolate between.
+ trifinder : `~matplotlib.tri.TriFinder`, optional
+ If this is not specified, the Triangulation's default TriFinder will
+ be used by calling `.Triangulation.get_trifinder`.
+
+ Methods
+ -------
+ `__call__` (x, y) : Returns interpolated values at (x, y) points.
+ `gradient` (x, y) : Returns interpolated derivatives at (x, y) points.
+
+ """
+ def __init__(self, triangulation, z, trifinder=None):
+ super().__init__(triangulation, z, trifinder)
+
+ # Store plane coefficients for fast interpolation calculations.
+ self._plane_coefficients = \
+ self._triangulation.calculate_plane_coefficients(self._z)
+
+ def __call__(self, x, y):
+ return self._interpolate_multikeys(x, y, tri_index=None,
+ return_keys=('z',))[0]
+ __call__.__doc__ = TriInterpolator._docstring__call__
+
+ def gradient(self, x, y):
+ return self._interpolate_multikeys(x, y, tri_index=None,
+ return_keys=('dzdx', 'dzdy'))
+ gradient.__doc__ = TriInterpolator._docstringgradient
+
+ def _interpolate_single_key(self, return_key, tri_index, x, y):
+ if return_key == 'z':
+ return (self._plane_coefficients[tri_index, 0]*x +
+ self._plane_coefficients[tri_index, 1]*y +
+ self._plane_coefficients[tri_index, 2])
+ elif return_key == 'dzdx':
+ return self._plane_coefficients[tri_index, 0]
+ elif return_key == 'dzdy':
+ return self._plane_coefficients[tri_index, 1]
+ else:
+ raise ValueError("Invalid return_key: " + return_key)
+
+
+class CubicTriInterpolator(TriInterpolator):
+ r"""
+ Cubic interpolator on a triangular grid.
+
+ In one-dimension - on a segment - a cubic interpolating function is
+ defined by the values of the function and its derivative at both ends.
+ This is almost the same in 2D inside a triangle, except that the values
+ of the function and its 2 derivatives have to be defined at each triangle
+ node.
+
+ The CubicTriInterpolator takes the value of the function at each node -
+ provided by the user - and internally computes the value of the
+ derivatives, resulting in a smooth interpolation.
+ (As a special feature, the user can also impose the value of the
+ derivatives at each node, but this is not supposed to be the common
+ usage.)
+
+ Parameters
+ ----------
+ triangulation : `~matplotlib.tri.Triangulation`
+ The triangulation to interpolate over.
+ z : (npoints,) array-like
+ Array of values, defined at grid points, to interpolate between.
+ kind : {'min_E', 'geom', 'user'}, optional
+ Choice of the smoothing algorithm, in order to compute
+ the interpolant derivatives (defaults to 'min_E'):
+
+ - if 'min_E': (default) The derivatives at each node is computed
+ to minimize a bending energy.
+ - if 'geom': The derivatives at each node is computed as a
+ weighted average of relevant triangle normals. To be used for
+ speed optimization (large grids).
+ - if 'user': The user provides the argument *dz*, no computation
+ is hence needed.
+
+ trifinder : `~matplotlib.tri.TriFinder`, optional
+ If not specified, the Triangulation's default TriFinder will
+ be used by calling `.Triangulation.get_trifinder`.
+ dz : tuple of array-likes (dzdx, dzdy), optional
+ Used only if *kind* ='user'. In this case *dz* must be provided as
+ (dzdx, dzdy) where dzdx, dzdy are arrays of the same shape as *z* and
+ are the interpolant first derivatives at the *triangulation* points.
+
+ Methods
+ -------
+ `__call__` (x, y) : Returns interpolated values at (x, y) points.
+ `gradient` (x, y) : Returns interpolated derivatives at (x, y) points.
+
+ Notes
+ -----
+ This note is a bit technical and details how the cubic interpolation is
+ computed.
+
+ The interpolation is based on a Clough-Tocher subdivision scheme of
+ the *triangulation* mesh (to make it clearer, each triangle of the
+ grid will be divided in 3 child-triangles, and on each child triangle
+ the interpolated function is a cubic polynomial of the 2 coordinates).
+ This technique originates from FEM (Finite Element Method) analysis;
+ the element used is a reduced Hsieh-Clough-Tocher (HCT)
+ element. Its shape functions are described in [1]_.
+ The assembled function is guaranteed to be C1-smooth, i.e. it is
+ continuous and its first derivatives are also continuous (this
+ is easy to show inside the triangles but is also true when crossing the
+ edges).
+
+ In the default case (*kind* ='min_E'), the interpolant minimizes a
+ curvature energy on the functional space generated by the HCT element
+ shape functions - with imposed values but arbitrary derivatives at each
+ node. The minimized functional is the integral of the so-called total
+ curvature (implementation based on an algorithm from [2]_ - PCG sparse
+ solver):
+
+ .. math::
+
+ E(z) = \frac{1}{2} \int_{\Omega} \left(
+ \left( \frac{\partial^2{z}}{\partial{x}^2} \right)^2 +
+ \left( \frac{\partial^2{z}}{\partial{y}^2} \right)^2 +
+ 2\left( \frac{\partial^2{z}}{\partial{y}\partial{x}} \right)^2
+ \right) dx\,dy
+
+ If the case *kind* ='geom' is chosen by the user, a simple geometric
+ approximation is used (weighted average of the triangle normal
+ vectors), which could improve speed on very large grids.
+
+ References
+ ----------
+ .. [1] Michel Bernadou, Kamal Hassan, "Basis functions for general
+ Hsieh-Clough-Tocher triangles, complete or reduced.",
+ International Journal for Numerical Methods in Engineering,
+ 17(5):784 - 789. 2.01.
+ .. [2] C.T. Kelley, "Iterative Methods for Optimization".
+
+ """
+ def __init__(self, triangulation, z, kind='min_E', trifinder=None,
+ dz=None):
+ super().__init__(triangulation, z, trifinder)
+
+ # Loads the underlying c++ _triangulation.
+ # (During loading, reordering of triangulation._triangles may occur so
+ # that all final triangles are now anti-clockwise)
+ self._triangulation.get_cpp_triangulation()
+
+ # To build the stiffness matrix and avoid zero-energy spurious modes
+ # we will only store internally the valid (unmasked) triangles and
+ # the necessary (used) points coordinates.
+ # 2 renumbering tables need to be computed and stored:
+ # - a triangle renum table in order to translate the result from a
+ # TriFinder instance into the internal stored triangle number.
+ # - a node renum table to overwrite the self._z values into the new
+ # (used) node numbering.
+ tri_analyzer = TriAnalyzer(self._triangulation)
+ (compressed_triangles, compressed_x, compressed_y, tri_renum,
+ node_renum) = tri_analyzer._get_compressed_triangulation()
+ self._triangles = compressed_triangles
+ self._tri_renum = tri_renum
+ # Taking into account the node renumbering in self._z:
+ valid_node = (node_renum != -1)
+ self._z[node_renum[valid_node]] = self._z[valid_node]
+
+ # Computing scale factors
+ self._unit_x = np.ptp(compressed_x)
+ self._unit_y = np.ptp(compressed_y)
+ self._pts = np.column_stack([compressed_x / self._unit_x,
+ compressed_y / self._unit_y])
+ # Computing triangle points
+ self._tris_pts = self._pts[self._triangles]
+ # Computing eccentricities
+ self._eccs = self._compute_tri_eccentricities(self._tris_pts)
+ # Computing dof estimations for HCT triangle shape function
+ self._dof = self._compute_dof(kind, dz=dz)
+ # Loading HCT element
+ self._ReferenceElement = _ReducedHCT_Element()
+
+ def __call__(self, x, y):
+ return self._interpolate_multikeys(x, y, tri_index=None,
+ return_keys=('z',))[0]
+ __call__.__doc__ = TriInterpolator._docstring__call__
+
+ def gradient(self, x, y):
+ return self._interpolate_multikeys(x, y, tri_index=None,
+ return_keys=('dzdx', 'dzdy'))
+ gradient.__doc__ = TriInterpolator._docstringgradient
+
+ def _interpolate_single_key(self, return_key, tri_index, x, y):
+ tris_pts = self._tris_pts[tri_index]
+ alpha = self._get_alpha_vec(x, y, tris_pts)
+ ecc = self._eccs[tri_index]
+ dof = np.expand_dims(self._dof[tri_index], axis=1)
+ if return_key == 'z':
+ return self._ReferenceElement.get_function_values(
+ alpha, ecc, dof)
+ elif return_key in ['dzdx', 'dzdy']:
+ J = self._get_jacobian(tris_pts)
+ dzdx = self._ReferenceElement.get_function_derivatives(
+ alpha, J, ecc, dof)
+ if return_key == 'dzdx':
+ return dzdx[:, 0, 0]
+ else:
+ return dzdx[:, 1, 0]
+ else:
+ raise ValueError("Invalid return_key: " + return_key)
+
+ def _compute_dof(self, kind, dz=None):
+ """
+ Compute and return nodal dofs according to kind.
+
+ Parameters
+ ----------
+ kind : {'min_E', 'geom', 'user'}
+ Choice of the _DOF_estimator subclass to estimate the gradient.
+ dz : tuple of array-likes (dzdx, dzdy), optional
+ Used only if *kind*=user; in this case passed to the
+ :class:`_DOF_estimator_user`.
+
+ Returns
+ -------
+ array-like, shape (npts, 2)
+ Estimation of the gradient at triangulation nodes (stored as
+ degree of freedoms of reduced-HCT triangle elements).
+ """
+ if kind == 'user':
+ if dz is None:
+ raise ValueError("For a CubicTriInterpolator with "
+ "*kind*='user', a valid *dz* "
+ "argument is expected.")
+ TE = _DOF_estimator_user(self, dz=dz)
+ elif kind == 'geom':
+ TE = _DOF_estimator_geom(self)
+ elif kind == 'min_E':
+ TE = _DOF_estimator_min_E(self)
+ else:
+ _api.check_in_list(['user', 'geom', 'min_E'], kind=kind)
+ return TE.compute_dof_from_df()
+
+ @staticmethod
+ def _get_alpha_vec(x, y, tris_pts):
+ """
+ Fast (vectorized) function to compute barycentric coordinates alpha.
+
+ Parameters
+ ----------
+ x, y : array-like of dim 1 (shape (nx,))
+ Coordinates of the points whose points barycentric coordinates are
+ requested.
+ tris_pts : array like of dim 3 (shape: (nx, 3, 2))
+ Coordinates of the containing triangles apexes.
+
+ Returns
+ -------
+ array of dim 2 (shape (nx, 3))
+ Barycentric coordinates of the points inside the containing
+ triangles.
+ """
+ ndim = tris_pts.ndim-2
+
+ a = tris_pts[:, 1, :] - tris_pts[:, 0, :]
+ b = tris_pts[:, 2, :] - tris_pts[:, 0, :]
+ abT = np.stack([a, b], axis=-1)
+ ab = _transpose_vectorized(abT)
+ OM = np.stack([x, y], axis=1) - tris_pts[:, 0, :]
+
+ metric = ab @ abT
+ # Here we try to deal with the colinear cases.
+ # metric_inv is in this case set to the Moore-Penrose pseudo-inverse
+ # meaning that we will still return a set of valid barycentric
+ # coordinates.
+ metric_inv = _pseudo_inv22sym_vectorized(metric)
+ Covar = ab @ _transpose_vectorized(np.expand_dims(OM, ndim))
+ ksi = metric_inv @ Covar
+ alpha = _to_matrix_vectorized([
+ [1-ksi[:, 0, 0]-ksi[:, 1, 0]], [ksi[:, 0, 0]], [ksi[:, 1, 0]]])
+ return alpha
+
+ @staticmethod
+ def _get_jacobian(tris_pts):
+ """
+ Fast (vectorized) function to compute triangle jacobian matrix.
+
+ Parameters
+ ----------
+ tris_pts : array like of dim 3 (shape: (nx, 3, 2))
+ Coordinates of the containing triangles apexes.
+
+ Returns
+ -------
+ array of dim 3 (shape (nx, 2, 2))
+ Barycentric coordinates of the points inside the containing
+ triangles.
+ J[itri, :, :] is the jacobian matrix at apex 0 of the triangle
+ itri, so that the following (matrix) relationship holds:
+ [dz/dksi] = [J] x [dz/dx]
+ with x: global coordinates
+ ksi: element parametric coordinates in triangle first apex
+ local basis.
+ """
+ a = np.array(tris_pts[:, 1, :] - tris_pts[:, 0, :])
+ b = np.array(tris_pts[:, 2, :] - tris_pts[:, 0, :])
+ J = _to_matrix_vectorized([[a[:, 0], a[:, 1]],
+ [b[:, 0], b[:, 1]]])
+ return J
+
+ @staticmethod
+ def _compute_tri_eccentricities(tris_pts):
+ """
+ Compute triangle eccentricities.
+
+ Parameters
+ ----------
+ tris_pts : array like of dim 3 (shape: (nx, 3, 2))
+ Coordinates of the triangles apexes.
+
+ Returns
+ -------
+ array like of dim 2 (shape: (nx, 3))
+ The so-called eccentricity parameters [1] needed for HCT triangular
+ element.
+ """
+ a = np.expand_dims(tris_pts[:, 2, :] - tris_pts[:, 1, :], axis=2)
+ b = np.expand_dims(tris_pts[:, 0, :] - tris_pts[:, 2, :], axis=2)
+ c = np.expand_dims(tris_pts[:, 1, :] - tris_pts[:, 0, :], axis=2)
+ # Do not use np.squeeze, this is dangerous if only one triangle
+ # in the triangulation...
+ dot_a = (_transpose_vectorized(a) @ a)[:, 0, 0]
+ dot_b = (_transpose_vectorized(b) @ b)[:, 0, 0]
+ dot_c = (_transpose_vectorized(c) @ c)[:, 0, 0]
+ # Note that this line will raise a warning for dot_a, dot_b or dot_c
+ # zeros, but we choose not to support triangles with duplicate points.
+ return _to_matrix_vectorized([[(dot_c-dot_b) / dot_a],
+ [(dot_a-dot_c) / dot_b],
+ [(dot_b-dot_a) / dot_c]])
+
+
+# FEM element used for interpolation and for solving minimisation
+# problem (Reduced HCT element)
+class _ReducedHCT_Element:
+ """
+ Implementation of reduced HCT triangular element with explicit shape
+ functions.
+
+ Computes z, dz, d2z and the element stiffness matrix for bending energy:
+ E(f) = integral( (d2z/dx2 + d2z/dy2)**2 dA)
+
+ *** Reference for the shape functions: ***
+ [1] Basis functions for general Hsieh-Clough-Tocher _triangles, complete or
+ reduced.
+ Michel Bernadou, Kamal Hassan
+ International Journal for Numerical Methods in Engineering.
+ 17(5):784 - 789. 2.01
+
+ *** Element description: ***
+ 9 dofs: z and dz given at 3 apex
+ C1 (conform)
+
+ """
+ # 1) Loads matrices to generate shape functions as a function of
+ # triangle eccentricities - based on [1] p.11 '''
+ M = np.array([
+ [ 0.00, 0.00, 0.00, 4.50, 4.50, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [-0.25, 0.00, 0.00, 0.50, 1.25, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [-0.25, 0.00, 0.00, 1.25, 0.50, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.50, 1.00, 0.00, -1.50, 0.00, 3.00, 3.00, 0.00, 0.00, 3.00],
+ [ 0.00, 0.00, 0.00, -0.25, 0.25, 0.00, 1.00, 0.00, 0.00, 0.50],
+ [ 0.25, 0.00, 0.00, -0.50, -0.25, 1.00, 0.00, 0.00, 0.00, 1.00],
+ [ 0.50, 0.00, 1.00, 0.00, -1.50, 0.00, 0.00, 3.00, 3.00, 3.00],
+ [ 0.25, 0.00, 0.00, -0.25, -0.50, 0.00, 0.00, 0.00, 1.00, 1.00],
+ [ 0.00, 0.00, 0.00, 0.25, -0.25, 0.00, 0.00, 1.00, 0.00, 0.50]])
+ M0 = np.array([
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [-1.00, 0.00, 0.00, 1.50, 1.50, 0.00, 0.00, 0.00, 0.00, -3.00],
+ [-0.50, 0.00, 0.00, 0.75, 0.75, 0.00, 0.00, 0.00, 0.00, -1.50],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 1.00, 0.00, 0.00, -1.50, -1.50, 0.00, 0.00, 0.00, 0.00, 3.00],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.50, 0.00, 0.00, -0.75, -0.75, 0.00, 0.00, 0.00, 0.00, 1.50]])
+ M1 = np.array([
+ [-0.50, 0.00, 0.00, 1.50, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [-0.25, 0.00, 0.00, 0.75, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.50, 0.00, 0.00, -1.50, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.25, 0.00, 0.00, -0.75, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00]])
+ M2 = np.array([
+ [ 0.50, 0.00, 0.00, 0.00, -1.50, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.25, 0.00, 0.00, 0.00, -0.75, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [-0.50, 0.00, 0.00, 0.00, 1.50, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [-0.25, 0.00, 0.00, 0.00, 0.75, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00],
+ [ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00]])
+
+ # 2) Loads matrices to rotate components of gradient & Hessian
+ # vectors in the reference basis of triangle first apex (a0)
+ rotate_dV = np.array([[ 1., 0.], [ 0., 1.],
+ [ 0., 1.], [-1., -1.],
+ [-1., -1.], [ 1., 0.]])
+
+ rotate_d2V = np.array([[1., 0., 0.], [0., 1., 0.], [ 0., 0., 1.],
+ [0., 1., 0.], [1., 1., 1.], [ 0., -2., -1.],
+ [1., 1., 1.], [1., 0., 0.], [-2., 0., -1.]])
+
+ # 3) Loads Gauss points & weights on the 3 sub-_triangles for P2
+ # exact integral - 3 points on each subtriangles.
+ # NOTE: as the 2nd derivative is discontinuous , we really need those 9
+ # points!
+ n_gauss = 9
+ gauss_pts = np.array([[13./18., 4./18., 1./18.],
+ [ 4./18., 13./18., 1./18.],
+ [ 7./18., 7./18., 4./18.],
+ [ 1./18., 13./18., 4./18.],
+ [ 1./18., 4./18., 13./18.],
+ [ 4./18., 7./18., 7./18.],
+ [ 4./18., 1./18., 13./18.],
+ [13./18., 1./18., 4./18.],
+ [ 7./18., 4./18., 7./18.]], dtype=np.float64)
+ gauss_w = np.ones([9], dtype=np.float64) / 9.
+
+ # 4) Stiffness matrix for curvature energy
+ E = np.array([[1., 0., 0.], [0., 1., 0.], [0., 0., 2.]])
+
+ # 5) Loads the matrix to compute DOF_rot from tri_J at apex 0
+ J0_to_J1 = np.array([[-1., 1.], [-1., 0.]])
+ J0_to_J2 = np.array([[ 0., -1.], [ 1., -1.]])
+
+ def get_function_values(self, alpha, ecc, dofs):
+ """
+ Parameters
+ ----------
+ alpha : is a (N x 3 x 1) array (array of column-matrices) of
+ barycentric coordinates,
+ ecc : is a (N x 3 x 1) array (array of column-matrices) of triangle
+ eccentricities,
+ dofs : is a (N x 1 x 9) arrays (arrays of row-matrices) of computed
+ degrees of freedom.
+
+ Returns
+ -------
+ Returns the N-array of interpolated function values.
+ """
+ subtri = np.argmin(alpha, axis=1)[:, 0]
+ ksi = _roll_vectorized(alpha, -subtri, axis=0)
+ E = _roll_vectorized(ecc, -subtri, axis=0)
+ x = ksi[:, 0, 0]
+ y = ksi[:, 1, 0]
+ z = ksi[:, 2, 0]
+ x_sq = x*x
+ y_sq = y*y
+ z_sq = z*z
+ V = _to_matrix_vectorized([
+ [x_sq*x], [y_sq*y], [z_sq*z], [x_sq*z], [x_sq*y], [y_sq*x],
+ [y_sq*z], [z_sq*y], [z_sq*x], [x*y*z]])
+ prod = self.M @ V
+ prod += _scalar_vectorized(E[:, 0, 0], self.M0 @ V)
+ prod += _scalar_vectorized(E[:, 1, 0], self.M1 @ V)
+ prod += _scalar_vectorized(E[:, 2, 0], self.M2 @ V)
+ s = _roll_vectorized(prod, 3*subtri, axis=0)
+ return (dofs @ s)[:, 0, 0]
+
+ def get_function_derivatives(self, alpha, J, ecc, dofs):
+ """
+ Parameters
+ ----------
+ *alpha* is a (N x 3 x 1) array (array of column-matrices of
+ barycentric coordinates)
+ *J* is a (N x 2 x 2) array of jacobian matrices (jacobian matrix at
+ triangle first apex)
+ *ecc* is a (N x 3 x 1) array (array of column-matrices of triangle
+ eccentricities)
+ *dofs* is a (N x 1 x 9) arrays (arrays of row-matrices) of computed
+ degrees of freedom.
+
+ Returns
+ -------
+ Returns the values of interpolated function derivatives [dz/dx, dz/dy]
+ in global coordinates at locations alpha, as a column-matrices of
+ shape (N x 2 x 1).
+ """
+ subtri = np.argmin(alpha, axis=1)[:, 0]
+ ksi = _roll_vectorized(alpha, -subtri, axis=0)
+ E = _roll_vectorized(ecc, -subtri, axis=0)
+ x = ksi[:, 0, 0]
+ y = ksi[:, 1, 0]
+ z = ksi[:, 2, 0]
+ x_sq = x*x
+ y_sq = y*y
+ z_sq = z*z
+ dV = _to_matrix_vectorized([
+ [ -3.*x_sq, -3.*x_sq],
+ [ 3.*y_sq, 0.],
+ [ 0., 3.*z_sq],
+ [ -2.*x*z, -2.*x*z+x_sq],
+ [-2.*x*y+x_sq, -2.*x*y],
+ [ 2.*x*y-y_sq, -y_sq],
+ [ 2.*y*z, y_sq],
+ [ z_sq, 2.*y*z],
+ [ -z_sq, 2.*x*z-z_sq],
+ [ x*z-y*z, x*y-y*z]])
+ # Puts back dV in first apex basis
+ dV = dV @ _extract_submatrices(
+ self.rotate_dV, subtri, block_size=2, axis=0)
+
+ prod = self.M @ dV
+ prod += _scalar_vectorized(E[:, 0, 0], self.M0 @ dV)
+ prod += _scalar_vectorized(E[:, 1, 0], self.M1 @ dV)
+ prod += _scalar_vectorized(E[:, 2, 0], self.M2 @ dV)
+ dsdksi = _roll_vectorized(prod, 3*subtri, axis=0)
+ dfdksi = dofs @ dsdksi
+ # In global coordinates:
+ # Here we try to deal with the simplest colinear cases, returning a
+ # null matrix.
+ J_inv = _safe_inv22_vectorized(J)
+ dfdx = J_inv @ _transpose_vectorized(dfdksi)
+ return dfdx
+
+ def get_function_hessians(self, alpha, J, ecc, dofs):
+ """
+ Parameters
+ ----------
+ *alpha* is a (N x 3 x 1) array (array of column-matrices) of
+ barycentric coordinates
+ *J* is a (N x 2 x 2) array of jacobian matrices (jacobian matrix at
+ triangle first apex)
+ *ecc* is a (N x 3 x 1) array (array of column-matrices) of triangle
+ eccentricities
+ *dofs* is a (N x 1 x 9) arrays (arrays of row-matrices) of computed
+ degrees of freedom.
+
+ Returns
+ -------
+ Returns the values of interpolated function 2nd-derivatives
+ [d2z/dx2, d2z/dy2, d2z/dxdy] in global coordinates at locations alpha,
+ as a column-matrices of shape (N x 3 x 1).
+ """
+ d2sdksi2 = self.get_d2Sidksij2(alpha, ecc)
+ d2fdksi2 = dofs @ d2sdksi2
+ H_rot = self.get_Hrot_from_J(J)
+ d2fdx2 = d2fdksi2 @ H_rot
+ return _transpose_vectorized(d2fdx2)
+
+ def get_d2Sidksij2(self, alpha, ecc):
+ """
+ Parameters
+ ----------
+ *alpha* is a (N x 3 x 1) array (array of column-matrices) of
+ barycentric coordinates
+ *ecc* is a (N x 3 x 1) array (array of column-matrices) of triangle
+ eccentricities
+
+ Returns
+ -------
+ Returns the arrays d2sdksi2 (N x 3 x 1) Hessian of shape functions
+ expressed in covariant coordinates in first apex basis.
+ """
+ subtri = np.argmin(alpha, axis=1)[:, 0]
+ ksi = _roll_vectorized(alpha, -subtri, axis=0)
+ E = _roll_vectorized(ecc, -subtri, axis=0)
+ x = ksi[:, 0, 0]
+ y = ksi[:, 1, 0]
+ z = ksi[:, 2, 0]
+ d2V = _to_matrix_vectorized([
+ [ 6.*x, 6.*x, 6.*x],
+ [ 6.*y, 0., 0.],
+ [ 0., 6.*z, 0.],
+ [ 2.*z, 2.*z-4.*x, 2.*z-2.*x],
+ [2.*y-4.*x, 2.*y, 2.*y-2.*x],
+ [2.*x-4.*y, 0., -2.*y],
+ [ 2.*z, 0., 2.*y],
+ [ 0., 2.*y, 2.*z],
+ [ 0., 2.*x-4.*z, -2.*z],
+ [ -2.*z, -2.*y, x-y-z]])
+ # Puts back d2V in first apex basis
+ d2V = d2V @ _extract_submatrices(
+ self.rotate_d2V, subtri, block_size=3, axis=0)
+ prod = self.M @ d2V
+ prod += _scalar_vectorized(E[:, 0, 0], self.M0 @ d2V)
+ prod += _scalar_vectorized(E[:, 1, 0], self.M1 @ d2V)
+ prod += _scalar_vectorized(E[:, 2, 0], self.M2 @ d2V)
+ d2sdksi2 = _roll_vectorized(prod, 3*subtri, axis=0)
+ return d2sdksi2
+
+ def get_bending_matrices(self, J, ecc):
+ """
+ Parameters
+ ----------
+ *J* is a (N x 2 x 2) array of jacobian matrices (jacobian matrix at
+ triangle first apex)
+ *ecc* is a (N x 3 x 1) array (array of column-matrices) of triangle
+ eccentricities
+
+ Returns
+ -------
+ Returns the element K matrices for bending energy expressed in
+ GLOBAL nodal coordinates.
+ K_ij = integral [ (d2zi/dx2 + d2zi/dy2) * (d2zj/dx2 + d2zj/dy2) dA]
+ tri_J is needed to rotate dofs from local basis to global basis
+ """
+ n = np.size(ecc, 0)
+
+ # 1) matrix to rotate dofs in global coordinates
+ J1 = self.J0_to_J1 @ J
+ J2 = self.J0_to_J2 @ J
+ DOF_rot = np.zeros([n, 9, 9], dtype=np.float64)
+ DOF_rot[:, 0, 0] = 1
+ DOF_rot[:, 3, 3] = 1
+ DOF_rot[:, 6, 6] = 1
+ DOF_rot[:, 1:3, 1:3] = J
+ DOF_rot[:, 4:6, 4:6] = J1
+ DOF_rot[:, 7:9, 7:9] = J2
+
+ # 2) matrix to rotate Hessian in global coordinates.
+ H_rot, area = self.get_Hrot_from_J(J, return_area=True)
+
+ # 3) Computes stiffness matrix
+ # Gauss quadrature.
+ K = np.zeros([n, 9, 9], dtype=np.float64)
+ weights = self.gauss_w
+ pts = self.gauss_pts
+ for igauss in range(self.n_gauss):
+ alpha = np.tile(pts[igauss, :], n).reshape(n, 3)
+ alpha = np.expand_dims(alpha, 2)
+ weight = weights[igauss]
+ d2Skdksi2 = self.get_d2Sidksij2(alpha, ecc)
+ d2Skdx2 = d2Skdksi2 @ H_rot
+ K += weight * (d2Skdx2 @ self.E @ _transpose_vectorized(d2Skdx2))
+
+ # 4) With nodal (not elem) dofs
+ K = _transpose_vectorized(DOF_rot) @ K @ DOF_rot
+
+ # 5) Need the area to compute total element energy
+ return _scalar_vectorized(area, K)
+
+ def get_Hrot_from_J(self, J, return_area=False):
+ """
+ Parameters
+ ----------
+ *J* is a (N x 2 x 2) array of jacobian matrices (jacobian matrix at
+ triangle first apex)
+
+ Returns
+ -------
+ Returns H_rot used to rotate Hessian from local basis of first apex,
+ to global coordinates.
+ if *return_area* is True, returns also the triangle area (0.5*det(J))
+ """
+ # Here we try to deal with the simplest colinear cases; a null
+ # energy and area is imposed.
+ J_inv = _safe_inv22_vectorized(J)
+ Ji00 = J_inv[:, 0, 0]
+ Ji11 = J_inv[:, 1, 1]
+ Ji10 = J_inv[:, 1, 0]
+ Ji01 = J_inv[:, 0, 1]
+ H_rot = _to_matrix_vectorized([
+ [Ji00*Ji00, Ji10*Ji10, Ji00*Ji10],
+ [Ji01*Ji01, Ji11*Ji11, Ji01*Ji11],
+ [2*Ji00*Ji01, 2*Ji11*Ji10, Ji00*Ji11+Ji10*Ji01]])
+ if not return_area:
+ return H_rot
+ else:
+ area = 0.5 * (J[:, 0, 0]*J[:, 1, 1] - J[:, 0, 1]*J[:, 1, 0])
+ return H_rot, area
+
+ def get_Kff_and_Ff(self, J, ecc, triangles, Uc):
+ """
+ Build K and F for the following elliptic formulation:
+ minimization of curvature energy with value of function at node
+ imposed and derivatives 'free'.
+
+ Build the global Kff matrix in cco format.
+ Build the full Ff vec Ff = - Kfc x Uc.
+
+ Parameters
+ ----------
+ *J* is a (N x 2 x 2) array of jacobian matrices (jacobian matrix at
+ triangle first apex)
+ *ecc* is a (N x 3 x 1) array (array of column-matrices) of triangle
+ eccentricities
+ *triangles* is a (N x 3) array of nodes indexes.
+ *Uc* is (N x 3) array of imposed displacements at nodes
+
+ Returns
+ -------
+ (Kff_rows, Kff_cols, Kff_vals) Kff matrix in coo format - Duplicate
+ (row, col) entries must be summed.
+ Ff: force vector - dim npts * 3
+ """
+ ntri = np.size(ecc, 0)
+ vec_range = np.arange(ntri, dtype=np.int32)
+ c_indices = np.full(ntri, -1, dtype=np.int32) # for unused dofs, -1
+ f_dof = [1, 2, 4, 5, 7, 8]
+ c_dof = [0, 3, 6]
+
+ # vals, rows and cols indices in global dof numbering
+ f_dof_indices = _to_matrix_vectorized([[
+ c_indices, triangles[:, 0]*2, triangles[:, 0]*2+1,
+ c_indices, triangles[:, 1]*2, triangles[:, 1]*2+1,
+ c_indices, triangles[:, 2]*2, triangles[:, 2]*2+1]])
+
+ expand_indices = np.ones([ntri, 9, 1], dtype=np.int32)
+ f_row_indices = _transpose_vectorized(expand_indices @ f_dof_indices)
+ f_col_indices = expand_indices @ f_dof_indices
+ K_elem = self.get_bending_matrices(J, ecc)
+
+ # Extracting sub-matrices
+ # Explanation & notations:
+ # * Subscript f denotes 'free' degrees of freedom (i.e. dz/dx, dz/dx)
+ # * Subscript c denotes 'condensated' (imposed) degrees of freedom
+ # (i.e. z at all nodes)
+ # * F = [Ff, Fc] is the force vector
+ # * U = [Uf, Uc] is the imposed dof vector
+ # [ Kff Kfc ]
+ # * K = [ ] is the laplacian stiffness matrix
+ # [ Kcf Kff ]
+ # * As F = K x U one gets straightforwardly: Ff = - Kfc x Uc
+
+ # Computing Kff stiffness matrix in sparse coo format
+ Kff_vals = np.ravel(K_elem[np.ix_(vec_range, f_dof, f_dof)])
+ Kff_rows = np.ravel(f_row_indices[np.ix_(vec_range, f_dof, f_dof)])
+ Kff_cols = np.ravel(f_col_indices[np.ix_(vec_range, f_dof, f_dof)])
+
+ # Computing Ff force vector in sparse coo format
+ Kfc_elem = K_elem[np.ix_(vec_range, f_dof, c_dof)]
+ Uc_elem = np.expand_dims(Uc, axis=2)
+ Ff_elem = -(Kfc_elem @ Uc_elem)[:, :, 0]
+ Ff_indices = f_dof_indices[np.ix_(vec_range, [0], f_dof)][:, 0, :]
+
+ # Extracting Ff force vector in dense format
+ # We have to sum duplicate indices - using bincount
+ Ff = np.bincount(np.ravel(Ff_indices), weights=np.ravel(Ff_elem))
+ return Kff_rows, Kff_cols, Kff_vals, Ff
+
+
+# :class:_DOF_estimator, _DOF_estimator_user, _DOF_estimator_geom,
+# _DOF_estimator_min_E
+# Private classes used to compute the degree of freedom of each triangular
+# element for the TriCubicInterpolator.
+class _DOF_estimator:
+ """
+ Abstract base class for classes used to estimate a function's first
+ derivatives, and deduce the dofs for a CubicTriInterpolator using a
+ reduced HCT element formulation.
+
+ Derived classes implement ``compute_df(self, **kwargs)``, returning
+ ``np.vstack([dfx, dfy]).T`` where ``dfx, dfy`` are the estimation of the 2
+ gradient coordinates.
+ """
+ def __init__(self, interpolator, **kwargs):
+ _api.check_isinstance(CubicTriInterpolator, interpolator=interpolator)
+ self._pts = interpolator._pts
+ self._tris_pts = interpolator._tris_pts
+ self.z = interpolator._z
+ self._triangles = interpolator._triangles
+ (self._unit_x, self._unit_y) = (interpolator._unit_x,
+ interpolator._unit_y)
+ self.dz = self.compute_dz(**kwargs)
+ self.compute_dof_from_df()
+
+ def compute_dz(self, **kwargs):
+ raise NotImplementedError
+
+ def compute_dof_from_df(self):
+ """
+ Compute reduced-HCT elements degrees of freedom, from the gradient.
+ """
+ J = CubicTriInterpolator._get_jacobian(self._tris_pts)
+ tri_z = self.z[self._triangles]
+ tri_dz = self.dz[self._triangles]
+ tri_dof = self.get_dof_vec(tri_z, tri_dz, J)
+ return tri_dof
+
+ @staticmethod
+ def get_dof_vec(tri_z, tri_dz, J):
+ """
+ Compute the dof vector of a triangle, from the value of f, df and
+ of the local Jacobian at each node.
+
+ Parameters
+ ----------
+ tri_z : shape (3,) array
+ f nodal values.
+ tri_dz : shape (3, 2) array
+ df/dx, df/dy nodal values.
+ J
+ Jacobian matrix in local basis of apex 0.
+
+ Returns
+ -------
+ dof : shape (9,) array
+ For each apex ``iapex``::
+
+ dof[iapex*3+0] = f(Ai)
+ dof[iapex*3+1] = df(Ai).(AiAi+)
+ dof[iapex*3+2] = df(Ai).(AiAi-)
+ """
+ npt = tri_z.shape[0]
+ dof = np.zeros([npt, 9], dtype=np.float64)
+ J1 = _ReducedHCT_Element.J0_to_J1 @ J
+ J2 = _ReducedHCT_Element.J0_to_J2 @ J
+
+ col0 = J @ np.expand_dims(tri_dz[:, 0, :], axis=2)
+ col1 = J1 @ np.expand_dims(tri_dz[:, 1, :], axis=2)
+ col2 = J2 @ np.expand_dims(tri_dz[:, 2, :], axis=2)
+
+ dfdksi = _to_matrix_vectorized([
+ [col0[:, 0, 0], col1[:, 0, 0], col2[:, 0, 0]],
+ [col0[:, 1, 0], col1[:, 1, 0], col2[:, 1, 0]]])
+ dof[:, 0:7:3] = tri_z
+ dof[:, 1:8:3] = dfdksi[:, 0]
+ dof[:, 2:9:3] = dfdksi[:, 1]
+ return dof
+
+
+class _DOF_estimator_user(_DOF_estimator):
+ """dz is imposed by user; accounts for scaling if any."""
+
+ def compute_dz(self, dz):
+ (dzdx, dzdy) = dz
+ dzdx = dzdx * self._unit_x
+ dzdy = dzdy * self._unit_y
+ return np.vstack([dzdx, dzdy]).T
+
+
+class _DOF_estimator_geom(_DOF_estimator):
+ """Fast 'geometric' approximation, recommended for large arrays."""
+
+ def compute_dz(self):
+ """
+ self.df is computed as weighted average of _triangles sharing a common
+ node. On each triangle itri f is first assumed linear (= ~f), which
+ allows to compute d~f[itri]
+ Then the following approximation of df nodal values is then proposed:
+ f[ipt] = SUM ( w[itri] x d~f[itri] , for itri sharing apex ipt)
+ The weighted coeff. w[itri] are proportional to the angle of the
+ triangle itri at apex ipt
+ """
+ el_geom_w = self.compute_geom_weights()
+ el_geom_grad = self.compute_geom_grads()
+
+ # Sum of weights coeffs
+ w_node_sum = np.bincount(np.ravel(self._triangles),
+ weights=np.ravel(el_geom_w))
+
+ # Sum of weighted df = (dfx, dfy)
+ dfx_el_w = np.empty_like(el_geom_w)
+ dfy_el_w = np.empty_like(el_geom_w)
+ for iapex in range(3):
+ dfx_el_w[:, iapex] = el_geom_w[:, iapex]*el_geom_grad[:, 0]
+ dfy_el_w[:, iapex] = el_geom_w[:, iapex]*el_geom_grad[:, 1]
+ dfx_node_sum = np.bincount(np.ravel(self._triangles),
+ weights=np.ravel(dfx_el_w))
+ dfy_node_sum = np.bincount(np.ravel(self._triangles),
+ weights=np.ravel(dfy_el_w))
+
+ # Estimation of df
+ dfx_estim = dfx_node_sum/w_node_sum
+ dfy_estim = dfy_node_sum/w_node_sum
+ return np.vstack([dfx_estim, dfy_estim]).T
+
+ def compute_geom_weights(self):
+ """
+ Build the (nelems, 3) weights coeffs of _triangles angles,
+ renormalized so that np.sum(weights, axis=1) == np.ones(nelems)
+ """
+ weights = np.zeros([np.size(self._triangles, 0), 3])
+ tris_pts = self._tris_pts
+ for ipt in range(3):
+ p0 = tris_pts[:, ipt % 3, :]
+ p1 = tris_pts[:, (ipt+1) % 3, :]
+ p2 = tris_pts[:, (ipt-1) % 3, :]
+ alpha1 = np.arctan2(p1[:, 1]-p0[:, 1], p1[:, 0]-p0[:, 0])
+ alpha2 = np.arctan2(p2[:, 1]-p0[:, 1], p2[:, 0]-p0[:, 0])
+ # In the below formula we could take modulo 2. but
+ # modulo 1. is safer regarding round-off errors (flat triangles).
+ angle = np.abs(((alpha2-alpha1) / np.pi) % 1)
+ # Weight proportional to angle up np.pi/2; null weight for
+ # degenerated cases 0 and np.pi (note that *angle* is normalized
+ # by np.pi).
+ weights[:, ipt] = 0.5 - np.abs(angle-0.5)
+ return weights
+
+ def compute_geom_grads(self):
+ """
+ Compute the (global) gradient component of f assumed linear (~f).
+ returns array df of shape (nelems, 2)
+ df[ielem].dM[ielem] = dz[ielem] i.e. df = dz x dM = dM.T^-1 x dz
+ """
+ tris_pts = self._tris_pts
+ tris_f = self.z[self._triangles]
+
+ dM1 = tris_pts[:, 1, :] - tris_pts[:, 0, :]
+ dM2 = tris_pts[:, 2, :] - tris_pts[:, 0, :]
+ dM = np.dstack([dM1, dM2])
+ # Here we try to deal with the simplest colinear cases: a null
+ # gradient is assumed in this case.
+ dM_inv = _safe_inv22_vectorized(dM)
+
+ dZ1 = tris_f[:, 1] - tris_f[:, 0]
+ dZ2 = tris_f[:, 2] - tris_f[:, 0]
+ dZ = np.vstack([dZ1, dZ2]).T
+ df = np.empty_like(dZ)
+
+ # With np.einsum: could be ej,eji -> ej
+ df[:, 0] = dZ[:, 0]*dM_inv[:, 0, 0] + dZ[:, 1]*dM_inv[:, 1, 0]
+ df[:, 1] = dZ[:, 0]*dM_inv[:, 0, 1] + dZ[:, 1]*dM_inv[:, 1, 1]
+ return df
+
+
+class _DOF_estimator_min_E(_DOF_estimator_geom):
+ """
+ The 'smoothest' approximation, df is computed through global minimization
+ of the bending energy:
+ E(f) = integral[(d2z/dx2 + d2z/dy2 + 2 d2z/dxdy)**2 dA]
+ """
+ def __init__(self, Interpolator):
+ self._eccs = Interpolator._eccs
+ super().__init__(Interpolator)
+
+ def compute_dz(self):
+ """
+ Elliptic solver for bending energy minimization.
+ Uses a dedicated 'toy' sparse Jacobi PCG solver.
+ """
+ # Initial guess for iterative PCG solver.
+ dz_init = super().compute_dz()
+ Uf0 = np.ravel(dz_init)
+
+ reference_element = _ReducedHCT_Element()
+ J = CubicTriInterpolator._get_jacobian(self._tris_pts)
+ eccs = self._eccs
+ triangles = self._triangles
+ Uc = self.z[self._triangles]
+
+ # Building stiffness matrix and force vector in coo format
+ Kff_rows, Kff_cols, Kff_vals, Ff = reference_element.get_Kff_and_Ff(
+ J, eccs, triangles, Uc)
+
+ # Building sparse matrix and solving minimization problem
+ # We could use scipy.sparse direct solver; however to avoid this
+ # external dependency an implementation of a simple PCG solver with
+ # a simple diagonal Jacobi preconditioner is implemented.
+ tol = 1.e-10
+ n_dof = Ff.shape[0]
+ Kff_coo = _Sparse_Matrix_coo(Kff_vals, Kff_rows, Kff_cols,
+ shape=(n_dof, n_dof))
+ Kff_coo.compress_csc()
+ Uf, err = _cg(A=Kff_coo, b=Ff, x0=Uf0, tol=tol)
+ # If the PCG did not converge, we return the best guess between Uf0
+ # and Uf.
+ err0 = np.linalg.norm(Kff_coo.dot(Uf0) - Ff)
+ if err0 < err:
+ # Maybe a good occasion to raise a warning here ?
+ _api.warn_external("In TriCubicInterpolator initialization, "
+ "PCG sparse solver did not converge after "
+ "1000 iterations. `geom` approximation is "
+ "used instead of `min_E`")
+ Uf = Uf0
+
+ # Building dz from Uf
+ dz = np.empty([self._pts.shape[0], 2], dtype=np.float64)
+ dz[:, 0] = Uf[::2]
+ dz[:, 1] = Uf[1::2]
+ return dz
+
+
+# The following private :class:_Sparse_Matrix_coo and :func:_cg provide
+# a PCG sparse solver for (symmetric) elliptic problems.
+class _Sparse_Matrix_coo:
+ def __init__(self, vals, rows, cols, shape):
+ """
+ Create a sparse matrix in coo format.
+ *vals*: arrays of values of non-null entries of the matrix
+ *rows*: int arrays of rows of non-null entries of the matrix
+ *cols*: int arrays of cols of non-null entries of the matrix
+ *shape*: 2-tuple (n, m) of matrix shape
+ """
+ self.n, self.m = shape
+ self.vals = np.asarray(vals, dtype=np.float64)
+ self.rows = np.asarray(rows, dtype=np.int32)
+ self.cols = np.asarray(cols, dtype=np.int32)
+
+ def dot(self, V):
+ """
+ Dot product of self by a vector *V* in sparse-dense to dense format
+ *V* dense vector of shape (self.m,).
+ """
+ assert V.shape == (self.m,)
+ return np.bincount(self.rows,
+ weights=self.vals*V[self.cols],
+ minlength=self.m)
+
+ def compress_csc(self):
+ """
+ Compress rows, cols, vals / summing duplicates. Sort for csc format.
+ """
+ _, unique, indices = np.unique(
+ self.rows + self.n*self.cols,
+ return_index=True, return_inverse=True)
+ self.rows = self.rows[unique]
+ self.cols = self.cols[unique]
+ self.vals = np.bincount(indices, weights=self.vals)
+
+ def compress_csr(self):
+ """
+ Compress rows, cols, vals / summing duplicates. Sort for csr format.
+ """
+ _, unique, indices = np.unique(
+ self.m*self.rows + self.cols,
+ return_index=True, return_inverse=True)
+ self.rows = self.rows[unique]
+ self.cols = self.cols[unique]
+ self.vals = np.bincount(indices, weights=self.vals)
+
+ def to_dense(self):
+ """
+ Return a dense matrix representing self, mainly for debugging purposes.
+ """
+ ret = np.zeros([self.n, self.m], dtype=np.float64)
+ nvals = self.vals.size
+ for i in range(nvals):
+ ret[self.rows[i], self.cols[i]] += self.vals[i]
+ return ret
+
+ def __str__(self):
+ return self.to_dense().__str__()
+
+ @property
+ def diag(self):
+ """Return the (dense) vector of the diagonal elements."""
+ in_diag = (self.rows == self.cols)
+ diag = np.zeros(min(self.n, self.n), dtype=np.float64) # default 0.
+ diag[self.rows[in_diag]] = self.vals[in_diag]
+ return diag
+
+
+def _cg(A, b, x0=None, tol=1.e-10, maxiter=1000):
+ """
+ Use Preconditioned Conjugate Gradient iteration to solve A x = b
+ A simple Jacobi (diagonal) preconditionner is used.
+
+ Parameters
+ ----------
+ A : _Sparse_Matrix_coo
+ *A* must have been compressed before by compress_csc or
+ compress_csr method.
+ b : array
+ Right hand side of the linear system.
+ x0 : array, optional
+ Starting guess for the solution. Defaults to the zero vector.
+ tol : float, optional
+ Tolerance to achieve. The algorithm terminates when the relative
+ residual is below tol. Default is 1e-10.
+ maxiter : int, optional
+ Maximum number of iterations. Iteration will stop after *maxiter*
+ steps even if the specified tolerance has not been achieved. Defaults
+ to 1000.
+
+ Returns
+ -------
+ x : array
+ The converged solution.
+ err : float
+ The absolute error np.linalg.norm(A.dot(x) - b)
+ """
+ n = b.size
+ assert A.n == n
+ assert A.m == n
+ b_norm = np.linalg.norm(b)
+
+ # Jacobi pre-conditioner
+ kvec = A.diag
+ # For diag elem < 1e-6 we keep 1e-6.
+ kvec = np.maximum(kvec, 1e-6)
+
+ # Initial guess
+ if x0 is None:
+ x = np.zeros(n)
+ else:
+ x = x0
+
+ r = b - A.dot(x)
+ w = r/kvec
+
+ p = np.zeros(n)
+ beta = 0.0
+ rho = np.dot(r, w)
+ k = 0
+
+ # Following C. T. Kelley
+ while (np.sqrt(abs(rho)) > tol*b_norm) and (k < maxiter):
+ p = w + beta*p
+ z = A.dot(p)
+ alpha = rho/np.dot(p, z)
+ r = r - alpha*z
+ w = r/kvec
+ rhoold = rho
+ rho = np.dot(r, w)
+ x = x + alpha*p
+ beta = rho/rhoold
+ #err = np.linalg.norm(A.dot(x) - b) # absolute accuracy - not used
+ k += 1
+ err = np.linalg.norm(A.dot(x) - b)
+ return x, err
+
+
+# The following private functions:
+# :func:`_safe_inv22_vectorized`
+# :func:`_pseudo_inv22sym_vectorized`
+# :func:`_scalar_vectorized`
+# :func:`_transpose_vectorized`
+# :func:`_roll_vectorized`
+# :func:`_to_matrix_vectorized`
+# :func:`_extract_submatrices`
+# provide fast numpy implementation of some standard operations on arrays of
+# matrices - stored as (:, n_rows, n_cols)-shaped np.arrays.
+
+# Development note: Dealing with pathologic 'flat' triangles in the
+# CubicTriInterpolator code and impact on (2, 2)-matrix inversion functions
+# :func:`_safe_inv22_vectorized` and :func:`_pseudo_inv22sym_vectorized`.
+#
+# Goals:
+# 1) The CubicTriInterpolator should be able to handle flat or almost flat
+# triangles without raising an error,
+# 2) These degenerated triangles should have no impact on the automatic dof
+# calculation (associated with null weight for the _DOF_estimator_geom and
+# with null energy for the _DOF_estimator_min_E),
+# 3) Linear patch test should be passed exactly on degenerated meshes,
+# 4) Interpolation (with :meth:`_interpolate_single_key` or
+# :meth:`_interpolate_multi_key`) shall be correctly handled even *inside*
+# the pathologic triangles, to interact correctly with a TriRefiner class.
+#
+# Difficulties:
+# Flat triangles have rank-deficient *J* (so-called jacobian matrix) and
+# *metric* (the metric tensor = J x J.T). Computation of the local
+# tangent plane is also problematic.
+#
+# Implementation:
+# Most of the time, when computing the inverse of a rank-deficient matrix it
+# is safe to simply return the null matrix (which is the implementation in
+# :func:`_safe_inv22_vectorized`). This is because of point 2), itself
+# enforced by:
+# - null area hence null energy in :class:`_DOF_estimator_min_E`
+# - angles close or equal to 0 or np.pi hence null weight in
+# :class:`_DOF_estimator_geom`.
+# Note that the function angle -> weight is continuous and maximum for an
+# angle np.pi/2 (refer to :meth:`compute_geom_weights`)
+# The exception is the computation of barycentric coordinates, which is done
+# by inversion of the *metric* matrix. In this case, we need to compute a set
+# of valid coordinates (1 among numerous possibilities), to ensure point 4).
+# We benefit here from the symmetry of metric = J x J.T, which makes it easier
+# to compute a pseudo-inverse in :func:`_pseudo_inv22sym_vectorized`
+def _safe_inv22_vectorized(M):
+ """
+ Inversion of arrays of (2, 2) matrices, returns 0 for rank-deficient
+ matrices.
+
+ *M* : array of (2, 2) matrices to inverse, shape (n, 2, 2)
+ """
+ assert M.ndim == 3
+ assert M.shape[-2:] == (2, 2)
+ M_inv = np.empty_like(M)
+ prod1 = M[:, 0, 0]*M[:, 1, 1]
+ delta = prod1 - M[:, 0, 1]*M[:, 1, 0]
+
+ # We set delta_inv to 0. in case of a rank deficient matrix; a
+ # rank-deficient input matrix *M* will lead to a null matrix in output
+ rank2 = (np.abs(delta) > 1e-8*np.abs(prod1))
+ if np.all(rank2):
+ # Normal 'optimized' flow.
+ delta_inv = 1./delta
+ else:
+ # 'Pathologic' flow.
+ delta_inv = np.zeros(M.shape[0])
+ delta_inv[rank2] = 1./delta[rank2]
+
+ M_inv[:, 0, 0] = M[:, 1, 1]*delta_inv
+ M_inv[:, 0, 1] = -M[:, 0, 1]*delta_inv
+ M_inv[:, 1, 0] = -M[:, 1, 0]*delta_inv
+ M_inv[:, 1, 1] = M[:, 0, 0]*delta_inv
+ return M_inv
+
+
+def _pseudo_inv22sym_vectorized(M):
+ """
+ Inversion of arrays of (2, 2) SYMMETRIC matrices; returns the
+ (Moore-Penrose) pseudo-inverse for rank-deficient matrices.
+
+ In case M is of rank 1, we have M = trace(M) x P where P is the orthogonal
+ projection on Im(M), and we return trace(M)^-1 x P == M / trace(M)**2
+ In case M is of rank 0, we return the null matrix.
+
+ *M* : array of (2, 2) matrices to inverse, shape (n, 2, 2)
+ """
+ assert M.ndim == 3
+ assert M.shape[-2:] == (2, 2)
+ M_inv = np.empty_like(M)
+ prod1 = M[:, 0, 0]*M[:, 1, 1]
+ delta = prod1 - M[:, 0, 1]*M[:, 1, 0]
+ rank2 = (np.abs(delta) > 1e-8*np.abs(prod1))
+
+ if np.all(rank2):
+ # Normal 'optimized' flow.
+ M_inv[:, 0, 0] = M[:, 1, 1] / delta
+ M_inv[:, 0, 1] = -M[:, 0, 1] / delta
+ M_inv[:, 1, 0] = -M[:, 1, 0] / delta
+ M_inv[:, 1, 1] = M[:, 0, 0] / delta
+ else:
+ # 'Pathologic' flow.
+ # Here we have to deal with 2 sub-cases
+ # 1) First sub-case: matrices of rank 2:
+ delta = delta[rank2]
+ M_inv[rank2, 0, 0] = M[rank2, 1, 1] / delta
+ M_inv[rank2, 0, 1] = -M[rank2, 0, 1] / delta
+ M_inv[rank2, 1, 0] = -M[rank2, 1, 0] / delta
+ M_inv[rank2, 1, 1] = M[rank2, 0, 0] / delta
+ # 2) Second sub-case: rank-deficient matrices of rank 0 and 1:
+ rank01 = ~rank2
+ tr = M[rank01, 0, 0] + M[rank01, 1, 1]
+ tr_zeros = (np.abs(tr) < 1.e-8)
+ sq_tr_inv = (1.-tr_zeros) / (tr**2+tr_zeros)
+ #sq_tr_inv = 1. / tr**2
+ M_inv[rank01, 0, 0] = M[rank01, 0, 0] * sq_tr_inv
+ M_inv[rank01, 0, 1] = M[rank01, 0, 1] * sq_tr_inv
+ M_inv[rank01, 1, 0] = M[rank01, 1, 0] * sq_tr_inv
+ M_inv[rank01, 1, 1] = M[rank01, 1, 1] * sq_tr_inv
+
+ return M_inv
+
+
+def _scalar_vectorized(scalar, M):
+ """
+ Scalar product between scalars and matrices.
+ """
+ return scalar[:, np.newaxis, np.newaxis]*M
+
+
+def _transpose_vectorized(M):
+ """
+ Transposition of an array of matrices *M*.
+ """
+ return np.transpose(M, [0, 2, 1])
+
+
+def _roll_vectorized(M, roll_indices, axis):
+ """
+ Roll an array of matrices along *axis* (0: rows, 1: columns) according to
+ an array of indices *roll_indices*.
+ """
+ assert axis in [0, 1]
+ ndim = M.ndim
+ assert ndim == 3
+ ndim_roll = roll_indices.ndim
+ assert ndim_roll == 1
+ sh = M.shape
+ r, c = sh[-2:]
+ assert sh[0] == roll_indices.shape[0]
+ vec_indices = np.arange(sh[0], dtype=np.int32)
+
+ # Builds the rolled matrix
+ M_roll = np.empty_like(M)
+ if axis == 0:
+ for ir in range(r):
+ for ic in range(c):
+ M_roll[:, ir, ic] = M[vec_indices, (-roll_indices+ir) % r, ic]
+ elif axis == 1:
+ for ir in range(r):
+ for ic in range(c):
+ M_roll[:, ir, ic] = M[vec_indices, ir, (-roll_indices+ic) % c]
+ return M_roll
+
+
+def _to_matrix_vectorized(M):
+ """
+ Build an array of matrices from individuals np.arrays of identical shapes.
+
+ Parameters
+ ----------
+ M
+ ncols-list of nrows-lists of shape sh.
+
+ Returns
+ -------
+ M_res : np.array of shape (sh, nrow, ncols)
+ *M_res* satisfies ``M_res[..., i, j] = M[i][j]``.
+ """
+ assert isinstance(M, (tuple, list))
+ assert all(isinstance(item, (tuple, list)) for item in M)
+ c_vec = np.asarray([len(item) for item in M])
+ assert np.all(c_vec-c_vec[0] == 0)
+ r = len(M)
+ c = c_vec[0]
+ M00 = np.asarray(M[0][0])
+ dt = M00.dtype
+ sh = [M00.shape[0], r, c]
+ M_ret = np.empty(sh, dtype=dt)
+ for irow in range(r):
+ for icol in range(c):
+ M_ret[:, irow, icol] = np.asarray(M[irow][icol])
+ return M_ret
+
+
+def _extract_submatrices(M, block_indices, block_size, axis):
+ """
+ Extract selected blocks of a matrices *M* depending on parameters
+ *block_indices* and *block_size*.
+
+ Returns the array of extracted matrices *Mres* so that ::
+
+ M_res[..., ir, :] = M[(block_indices*block_size+ir), :]
+ """
+ assert block_indices.ndim == 1
+ assert axis in [0, 1]
+
+ r, c = M.shape
+ if axis == 0:
+ sh = [block_indices.shape[0], block_size, c]
+ elif axis == 1:
+ sh = [block_indices.shape[0], r, block_size]
+
+ dt = M.dtype
+ M_res = np.empty(sh, dtype=dt)
+ if axis == 0:
+ for ir in range(block_size):
+ M_res[:, ir, :] = M[(block_indices*block_size+ir), :]
+ elif axis == 1:
+ for ic in range(block_size):
+ M_res[:, :, ic] = M[:, (block_indices*block_size+ic)]
+
+ return M_res
diff --git a/venv/Lib/site-packages/matplotlib/tri/tripcolor.py b/venv/Lib/site-packages/matplotlib/tri/tripcolor.py
new file mode 100644
index 0000000..f1f7de2
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tri/tripcolor.py
@@ -0,0 +1,131 @@
+import numpy as np
+
+from matplotlib import _api
+from matplotlib.collections import PolyCollection, TriMesh
+from matplotlib.colors import Normalize
+from matplotlib.tri.triangulation import Triangulation
+
+
+def tripcolor(ax, *args, alpha=1.0, norm=None, cmap=None, vmin=None,
+ vmax=None, shading='flat', facecolors=None, **kwargs):
+ """
+ Create a pseudocolor plot of an unstructured triangular grid.
+
+ The triangulation can be specified in one of two ways; either::
+
+ tripcolor(triangulation, ...)
+
+ where triangulation is a `.Triangulation` object, or
+
+ ::
+
+ tripcolor(x, y, ...)
+ tripcolor(x, y, triangles, ...)
+ tripcolor(x, y, triangles=triangles, ...)
+ tripcolor(x, y, mask=mask, ...)
+ tripcolor(x, y, triangles, mask=mask, ...)
+
+ in which case a Triangulation object will be created. See `.Triangulation`
+ for a explanation of these possibilities.
+
+ The next argument must be *C*, the array of color values, either
+ one per point in the triangulation if color values are defined at
+ points, or one per triangle in the triangulation if color values
+ are defined at triangles. If there are the same number of points
+ and triangles in the triangulation it is assumed that color
+ values are defined at points; to force the use of color values at
+ triangles use the kwarg ``facecolors=C`` instead of just ``C``.
+
+ *shading* may be 'flat' (the default) or 'gouraud'. If *shading*
+ is 'flat' and C values are defined at points, the color values
+ used for each triangle are from the mean C of the triangle's
+ three points. If *shading* is 'gouraud' then color values must be
+ defined at points.
+
+ The remaining kwargs are the same as for `~.Axes.pcolor`.
+ """
+ _api.check_in_list(['flat', 'gouraud'], shading=shading)
+
+ tri, args, kwargs = Triangulation.get_from_args_and_kwargs(*args, **kwargs)
+
+ # C is the colors array defined at either points or faces (i.e. triangles).
+ # If facecolors is None, C are defined at points.
+ # If facecolors is not None, C are defined at faces.
+ if facecolors is not None:
+ C = facecolors
+ else:
+ C = np.asarray(args[0])
+
+ # If there are a different number of points and triangles in the
+ # triangulation, can omit facecolors kwarg as it is obvious from
+ # length of C whether it refers to points or faces.
+ # Do not do this for gouraud shading.
+ if (facecolors is None and len(C) == len(tri.triangles) and
+ len(C) != len(tri.x) and shading != 'gouraud'):
+ facecolors = C
+
+ # Check length of C is OK.
+ if ((facecolors is None and len(C) != len(tri.x)) or
+ (facecolors is not None and len(C) != len(tri.triangles))):
+ raise ValueError('Length of color values array must be the same '
+ 'as either the number of triangulation points '
+ 'or triangles')
+
+ # Handling of linewidths, shading, edgecolors and antialiased as
+ # in Axes.pcolor
+ linewidths = (0.25,)
+ if 'linewidth' in kwargs:
+ kwargs['linewidths'] = kwargs.pop('linewidth')
+ kwargs.setdefault('linewidths', linewidths)
+
+ edgecolors = 'none'
+ if 'edgecolor' in kwargs:
+ kwargs['edgecolors'] = kwargs.pop('edgecolor')
+ ec = kwargs.setdefault('edgecolors', edgecolors)
+
+ if 'antialiased' in kwargs:
+ kwargs['antialiaseds'] = kwargs.pop('antialiased')
+ if 'antialiaseds' not in kwargs and ec.lower() == "none":
+ kwargs['antialiaseds'] = False
+
+ if shading == 'gouraud':
+ if facecolors is not None:
+ raise ValueError('Gouraud shading does not support the use '
+ 'of facecolors kwarg')
+ if len(C) != len(tri.x):
+ raise ValueError('For gouraud shading, the length of color '
+ 'values array must be the same as the '
+ 'number of triangulation points')
+ collection = TriMesh(tri, **kwargs)
+ else:
+ # Vertices of triangles.
+ maskedTris = tri.get_masked_triangles()
+ verts = np.stack((tri.x[maskedTris], tri.y[maskedTris]), axis=-1)
+
+ # Color values.
+ if facecolors is None:
+ # One color per triangle, the mean of the 3 vertex color values.
+ C = C[maskedTris].mean(axis=1)
+ elif tri.mask is not None:
+ # Remove color values of masked triangles.
+ C = C[~tri.mask]
+
+ collection = PolyCollection(verts, **kwargs)
+
+ collection.set_alpha(alpha)
+ collection.set_array(C)
+ _api.check_isinstance((Normalize, None), norm=norm)
+ collection.set_cmap(cmap)
+ collection.set_norm(norm)
+ collection._scale_norm(norm, vmin, vmax)
+ ax.grid(False)
+
+ minx = tri.x.min()
+ maxx = tri.x.max()
+ miny = tri.y.min()
+ maxy = tri.y.max()
+ corners = (minx, miny), (maxx, maxy)
+ ax.update_datalim(corners)
+ ax.autoscale_view()
+ ax.add_collection(collection)
+ return collection
diff --git a/venv/Lib/site-packages/matplotlib/tri/triplot.py b/venv/Lib/site-packages/matplotlib/tri/triplot.py
new file mode 100644
index 0000000..97e3725
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tri/triplot.py
@@ -0,0 +1,82 @@
+import numpy as np
+from matplotlib.tri.triangulation import Triangulation
+
+
+def triplot(ax, *args, **kwargs):
+ """
+ Draw a unstructured triangular grid as lines and/or markers.
+
+ The triangulation to plot can be specified in one of two ways; either::
+
+ triplot(triangulation, ...)
+
+ where triangulation is a `.Triangulation` object, or
+
+ ::
+
+ triplot(x, y, ...)
+ triplot(x, y, triangles, ...)
+ triplot(x, y, triangles=triangles, ...)
+ triplot(x, y, mask=mask, ...)
+ triplot(x, y, triangles, mask=mask, ...)
+
+ in which case a Triangulation object will be created. See `.Triangulation`
+ for a explanation of these possibilities.
+
+ The remaining args and kwargs are the same as for `~.Axes.plot`.
+
+ Returns
+ -------
+ lines : `~matplotlib.lines.Line2D`
+ The drawn triangles edges.
+ markers : `~matplotlib.lines.Line2D`
+ The drawn marker nodes.
+ """
+ import matplotlib.axes
+
+ tri, args, kwargs = Triangulation.get_from_args_and_kwargs(*args, **kwargs)
+ x, y, edges = (tri.x, tri.y, tri.edges)
+
+ # Decode plot format string, e.g., 'ro-'
+ fmt = args[0] if args else ""
+ linestyle, marker, color = matplotlib.axes._base._process_plot_format(fmt)
+
+ # Insert plot format string into a copy of kwargs (kwargs values prevail).
+ kw = kwargs.copy()
+ for key, val in zip(('linestyle', 'marker', 'color'),
+ (linestyle, marker, color)):
+ if val is not None:
+ kw[key] = kwargs.get(key, val)
+
+ # Draw lines without markers.
+ # Note 1: If we drew markers here, most markers would be drawn more than
+ # once as they belong to several edges.
+ # Note 2: We insert nan values in the flattened edges arrays rather than
+ # plotting directly (triang.x[edges].T, triang.y[edges].T)
+ # as it considerably speeds-up code execution.
+ linestyle = kw['linestyle']
+ kw_lines = {
+ **kw,
+ 'marker': 'None', # No marker to draw.
+ 'zorder': kw.get('zorder', 1), # Path default zorder is used.
+ }
+ if linestyle not in [None, 'None', '', ' ']:
+ tri_lines_x = np.insert(x[edges], 2, np.nan, axis=1)
+ tri_lines_y = np.insert(y[edges], 2, np.nan, axis=1)
+ tri_lines = ax.plot(tri_lines_x.ravel(), tri_lines_y.ravel(),
+ **kw_lines)
+ else:
+ tri_lines = ax.plot([], [], **kw_lines)
+
+ # Draw markers separately.
+ marker = kw['marker']
+ kw_markers = {
+ **kw,
+ 'linestyle': 'None', # No line to draw.
+ }
+ if marker not in [None, 'None', '', ' ']:
+ tri_markers = ax.plot(x, y, **kw_markers)
+ else:
+ tri_markers = ax.plot([], [], **kw_markers)
+
+ return tri_lines + tri_markers
diff --git a/venv/Lib/site-packages/matplotlib/tri/trirefine.py b/venv/Lib/site-packages/matplotlib/tri/trirefine.py
new file mode 100644
index 0000000..674ee21
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tri/trirefine.py
@@ -0,0 +1,307 @@
+"""
+Mesh refinement for triangular grids.
+"""
+
+import numpy as np
+
+from matplotlib import _api
+from matplotlib.tri.triangulation import Triangulation
+import matplotlib.tri.triinterpolate
+
+
+class TriRefiner:
+ """
+ Abstract base class for classes implementing mesh refinement.
+
+ A TriRefiner encapsulates a Triangulation object and provides tools for
+ mesh refinement and interpolation.
+
+ Derived classes must implement:
+
+ - ``refine_triangulation(return_tri_index=False, **kwargs)`` , where
+ the optional keyword arguments *kwargs* are defined in each
+ TriRefiner concrete implementation, and which returns:
+
+ - a refined triangulation,
+ - optionally (depending on *return_tri_index*), for each
+ point of the refined triangulation: the index of
+ the initial triangulation triangle to which it belongs.
+
+ - ``refine_field(z, triinterpolator=None, **kwargs)``, where:
+
+ - *z* array of field values (to refine) defined at the base
+ triangulation nodes,
+ - *triinterpolator* is an optional `~matplotlib.tri.TriInterpolator`,
+ - the other optional keyword arguments *kwargs* are defined in
+ each TriRefiner concrete implementation;
+
+ and which returns (as a tuple) a refined triangular mesh and the
+ interpolated values of the field at the refined triangulation nodes.
+ """
+
+ def __init__(self, triangulation):
+ _api.check_isinstance(Triangulation, triangulation=triangulation)
+ self._triangulation = triangulation
+
+
+class UniformTriRefiner(TriRefiner):
+ """
+ Uniform mesh refinement by recursive subdivisions.
+
+ Parameters
+ ----------
+ triangulation : `~matplotlib.tri.Triangulation`
+ The encapsulated triangulation (to be refined)
+ """
+# See Also
+# --------
+# :class:`~matplotlib.tri.CubicTriInterpolator` and
+# :class:`~matplotlib.tri.TriAnalyzer`.
+# """
+ def __init__(self, triangulation):
+ super().__init__(triangulation)
+
+ def refine_triangulation(self, return_tri_index=False, subdiv=3):
+ """
+ Compute an uniformly refined triangulation *refi_triangulation* of
+ the encapsulated :attr:`triangulation`.
+
+ This function refines the encapsulated triangulation by splitting each
+ father triangle into 4 child sub-triangles built on the edges midside
+ nodes, recursing *subdiv* times. In the end, each triangle is hence
+ divided into ``4**subdiv`` child triangles.
+
+ Parameters
+ ----------
+ return_tri_index : bool, default: False
+ Whether an index table indicating the father triangle index of each
+ point is returned.
+ subdiv : int, default: 3
+ Recursion level for the subdivision.
+ Each triangle is divided into ``4**subdiv`` child triangles;
+ hence, the default results in 64 refined subtriangles for each
+ triangle of the initial triangulation.
+
+ Returns
+ -------
+ refi_triangulation : `~matplotlib.tri.Triangulation`
+ The refined triangulation.
+ found_index : int array
+ Index of the initial triangulation containing triangle, for each
+ point of *refi_triangulation*.
+ Returned only if *return_tri_index* is set to True.
+ """
+ refi_triangulation = self._triangulation
+ ntri = refi_triangulation.triangles.shape[0]
+
+ # Computes the triangulation ancestors numbers in the reference
+ # triangulation.
+ ancestors = np.arange(ntri, dtype=np.int32)
+ for _ in range(subdiv):
+ refi_triangulation, ancestors = self._refine_triangulation_once(
+ refi_triangulation, ancestors)
+ refi_npts = refi_triangulation.x.shape[0]
+ refi_triangles = refi_triangulation.triangles
+
+ # Now we compute found_index table if needed
+ if return_tri_index:
+ # We have to initialize found_index with -1 because some nodes
+ # may very well belong to no triangle at all, e.g., in case of
+ # Delaunay Triangulation with DuplicatePointWarning.
+ found_index = np.full(refi_npts, -1, dtype=np.int32)
+ tri_mask = self._triangulation.mask
+ if tri_mask is None:
+ found_index[refi_triangles] = np.repeat(ancestors,
+ 3).reshape(-1, 3)
+ else:
+ # There is a subtlety here: we want to avoid whenever possible
+ # that refined points container is a masked triangle (which
+ # would result in artifacts in plots).
+ # So we impose the numbering from masked ancestors first,
+ # then overwrite it with unmasked ancestor numbers.
+ ancestor_mask = tri_mask[ancestors]
+ found_index[refi_triangles[ancestor_mask, :]
+ ] = np.repeat(ancestors[ancestor_mask],
+ 3).reshape(-1, 3)
+ found_index[refi_triangles[~ancestor_mask, :]
+ ] = np.repeat(ancestors[~ancestor_mask],
+ 3).reshape(-1, 3)
+ return refi_triangulation, found_index
+ else:
+ return refi_triangulation
+
+ def refine_field(self, z, triinterpolator=None, subdiv=3):
+ """
+ Refine a field defined on the encapsulated triangulation.
+
+ Parameters
+ ----------
+ z : (npoints,) array-like
+ Values of the field to refine, defined at the nodes of the
+ encapsulated triangulation. (``n_points`` is the number of points
+ in the initial triangulation)
+ triinterpolator : `~matplotlib.tri.TriInterpolator`, optional
+ Interpolator used for field interpolation. If not specified,
+ a `~matplotlib.tri.CubicTriInterpolator` will be used.
+ subdiv : int, default: 3
+ Recursion level for the subdivision.
+ Each triangle is divided into ``4**subdiv`` child triangles.
+
+ Returns
+ -------
+ refi_tri : `~matplotlib.tri.Triangulation`
+ The returned refined triangulation.
+ refi_z : 1D array of length: *refi_tri* node count.
+ The returned interpolated field (at *refi_tri* nodes).
+ """
+ if triinterpolator is None:
+ interp = matplotlib.tri.CubicTriInterpolator(
+ self._triangulation, z)
+ else:
+ _api.check_isinstance(matplotlib.tri.TriInterpolator,
+ triinterpolator=triinterpolator)
+ interp = triinterpolator
+
+ refi_tri, found_index = self.refine_triangulation(
+ subdiv=subdiv, return_tri_index=True)
+ refi_z = interp._interpolate_multikeys(
+ refi_tri.x, refi_tri.y, tri_index=found_index)[0]
+ return refi_tri, refi_z
+
+ @staticmethod
+ def _refine_triangulation_once(triangulation, ancestors=None):
+ """
+ Refine a `.Triangulation` by splitting each triangle into 4
+ child-masked_triangles built on the edges midside nodes.
+
+ Masked triangles, if present, are also split, but their children
+ returned masked.
+
+ If *ancestors* is not provided, returns only a new triangulation:
+ child_triangulation.
+
+ If the array-like key table *ancestor* is given, it shall be of shape
+ (ntri,) where ntri is the number of *triangulation* masked_triangles.
+ In this case, the function returns
+ (child_triangulation, child_ancestors)
+ child_ancestors is defined so that the 4 child masked_triangles share
+ the same index as their father: child_ancestors.shape = (4 * ntri,).
+ """
+
+ x = triangulation.x
+ y = triangulation.y
+
+ # According to tri.triangulation doc:
+ # neighbors[i, j] is the triangle that is the neighbor
+ # to the edge from point index masked_triangles[i, j] to point
+ # index masked_triangles[i, (j+1)%3].
+ neighbors = triangulation.neighbors
+ triangles = triangulation.triangles
+ npts = np.shape(x)[0]
+ ntri = np.shape(triangles)[0]
+ if ancestors is not None:
+ ancestors = np.asarray(ancestors)
+ if np.shape(ancestors) != (ntri,):
+ raise ValueError(
+ "Incompatible shapes provide for triangulation"
+ ".masked_triangles and ancestors: {0} and {1}".format(
+ np.shape(triangles), np.shape(ancestors)))
+
+ # Initiating tables refi_x and refi_y of the refined triangulation
+ # points
+ # hint: each apex is shared by 2 masked_triangles except the borders.
+ borders = np.sum(neighbors == -1)
+ added_pts = (3*ntri + borders) // 2
+ refi_npts = npts + added_pts
+ refi_x = np.zeros(refi_npts)
+ refi_y = np.zeros(refi_npts)
+
+ # First part of refi_x, refi_y is just the initial points
+ refi_x[:npts] = x
+ refi_y[:npts] = y
+
+ # Second part contains the edge midside nodes.
+ # Each edge belongs to 1 triangle (if border edge) or is shared by 2
+ # masked_triangles (interior edge).
+ # We first build 2 * ntri arrays of edge starting nodes (edge_elems,
+ # edge_apexes); we then extract only the masters to avoid overlaps.
+ # The so-called 'master' is the triangle with biggest index
+ # The 'slave' is the triangle with lower index
+ # (can be -1 if border edge)
+ # For slave and master we will identify the apex pointing to the edge
+ # start
+ edge_elems = np.tile(np.arange(ntri, dtype=np.int32), 3)
+ edge_apexes = np.repeat(np.arange(3, dtype=np.int32), ntri)
+ edge_neighbors = neighbors[edge_elems, edge_apexes]
+ mask_masters = (edge_elems > edge_neighbors)
+
+ # Identifying the "masters" and adding to refi_x, refi_y vec
+ masters = edge_elems[mask_masters]
+ apex_masters = edge_apexes[mask_masters]
+ x_add = (x[triangles[masters, apex_masters]] +
+ x[triangles[masters, (apex_masters+1) % 3]]) * 0.5
+ y_add = (y[triangles[masters, apex_masters]] +
+ y[triangles[masters, (apex_masters+1) % 3]]) * 0.5
+ refi_x[npts:] = x_add
+ refi_y[npts:] = y_add
+
+ # Building the new masked_triangles; each old masked_triangles hosts
+ # 4 new masked_triangles
+ # there are 6 pts to identify per 'old' triangle, 3 new_pt_corner and
+ # 3 new_pt_midside
+ new_pt_corner = triangles
+
+ # What is the index in refi_x, refi_y of point at middle of apex iapex
+ # of elem ielem ?
+ # If ielem is the apex master: simple count, given the way refi_x was
+ # built.
+ # If ielem is the apex slave: yet we do not know; but we will soon
+ # using the neighbors table.
+ new_pt_midside = np.empty([ntri, 3], dtype=np.int32)
+ cum_sum = npts
+ for imid in range(3):
+ mask_st_loc = (imid == apex_masters)
+ n_masters_loc = np.sum(mask_st_loc)
+ elem_masters_loc = masters[mask_st_loc]
+ new_pt_midside[:, imid][elem_masters_loc] = np.arange(
+ n_masters_loc, dtype=np.int32) + cum_sum
+ cum_sum += n_masters_loc
+
+ # Now dealing with slave elems.
+ # for each slave element we identify the master and then the inode
+ # once slave_masters is identified, slave_masters_apex is such that:
+ # neighbors[slaves_masters, slave_masters_apex] == slaves
+ mask_slaves = np.logical_not(mask_masters)
+ slaves = edge_elems[mask_slaves]
+ slaves_masters = edge_neighbors[mask_slaves]
+ diff_table = np.abs(neighbors[slaves_masters, :] -
+ np.outer(slaves, np.ones(3, dtype=np.int32)))
+ slave_masters_apex = np.argmin(diff_table, axis=1)
+ slaves_apex = edge_apexes[mask_slaves]
+ new_pt_midside[slaves, slaves_apex] = new_pt_midside[
+ slaves_masters, slave_masters_apex]
+
+ # Builds the 4 child masked_triangles
+ child_triangles = np.empty([ntri*4, 3], dtype=np.int32)
+ child_triangles[0::4, :] = np.vstack([
+ new_pt_corner[:, 0], new_pt_midside[:, 0],
+ new_pt_midside[:, 2]]).T
+ child_triangles[1::4, :] = np.vstack([
+ new_pt_corner[:, 1], new_pt_midside[:, 1],
+ new_pt_midside[:, 0]]).T
+ child_triangles[2::4, :] = np.vstack([
+ new_pt_corner[:, 2], new_pt_midside[:, 2],
+ new_pt_midside[:, 1]]).T
+ child_triangles[3::4, :] = np.vstack([
+ new_pt_midside[:, 0], new_pt_midside[:, 1],
+ new_pt_midside[:, 2]]).T
+ child_triangulation = Triangulation(refi_x, refi_y, child_triangles)
+
+ # Builds the child mask
+ if triangulation.mask is not None:
+ child_triangulation.set_mask(np.repeat(triangulation.mask, 4))
+
+ if ancestors is None:
+ return child_triangulation
+ else:
+ return child_triangulation, np.repeat(ancestors, 4)
diff --git a/venv/Lib/site-packages/matplotlib/tri/tritools.py b/venv/Lib/site-packages/matplotlib/tri/tritools.py
new file mode 100644
index 0000000..11b500f
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/tri/tritools.py
@@ -0,0 +1,263 @@
+"""
+Tools for triangular grids.
+"""
+
+import numpy as np
+
+from matplotlib import _api
+from matplotlib.tri import Triangulation
+
+
+class TriAnalyzer:
+ """
+ Define basic tools for triangular mesh analysis and improvement.
+
+ A TriAnalyzer encapsulates a `.Triangulation` object and provides basic
+ tools for mesh analysis and mesh improvement.
+
+ Attributes
+ ----------
+ scale_factors
+
+ Parameters
+ ----------
+ triangulation : `~matplotlib.tri.Triangulation`
+ The encapsulated triangulation to analyze.
+ """
+
+ def __init__(self, triangulation):
+ _api.check_isinstance(Triangulation, triangulation=triangulation)
+ self._triangulation = triangulation
+
+ @property
+ def scale_factors(self):
+ """
+ Factors to rescale the triangulation into a unit square.
+
+ Returns
+ -------
+ (float, float)
+ Scaling factors (kx, ky) so that the triangulation
+ ``[triangulation.x * kx, triangulation.y * ky]``
+ fits exactly inside a unit square.
+ """
+ compressed_triangles = self._triangulation.get_masked_triangles()
+ node_used = (np.bincount(np.ravel(compressed_triangles),
+ minlength=self._triangulation.x.size) != 0)
+ return (1 / np.ptp(self._triangulation.x[node_used]),
+ 1 / np.ptp(self._triangulation.y[node_used]))
+
+ def circle_ratios(self, rescale=True):
+ """
+ Return a measure of the triangulation triangles flatness.
+
+ The ratio of the incircle radius over the circumcircle radius is a
+ widely used indicator of a triangle flatness.
+ It is always ``<= 0.5`` and ``== 0.5`` only for equilateral
+ triangles. Circle ratios below 0.01 denote very flat triangles.
+
+ To avoid unduly low values due to a difference of scale between the 2
+ axis, the triangular mesh can first be rescaled to fit inside a unit
+ square with `scale_factors` (Only if *rescale* is True, which is
+ its default value).
+
+ Parameters
+ ----------
+ rescale : bool, default: True
+ If True, internally rescale (based on `scale_factors`), so that the
+ (unmasked) triangles fit exactly inside a unit square mesh.
+
+ Returns
+ -------
+ masked array
+ Ratio of the incircle radius over the circumcircle radius, for
+ each 'rescaled' triangle of the encapsulated triangulation.
+ Values corresponding to masked triangles are masked out.
+
+ """
+ # Coords rescaling
+ if rescale:
+ (kx, ky) = self.scale_factors
+ else:
+ (kx, ky) = (1.0, 1.0)
+ pts = np.vstack([self._triangulation.x*kx,
+ self._triangulation.y*ky]).T
+ tri_pts = pts[self._triangulation.triangles]
+ # Computes the 3 side lengths
+ a = tri_pts[:, 1, :] - tri_pts[:, 0, :]
+ b = tri_pts[:, 2, :] - tri_pts[:, 1, :]
+ c = tri_pts[:, 0, :] - tri_pts[:, 2, :]
+ a = np.hypot(a[:, 0], a[:, 1])
+ b = np.hypot(b[:, 0], b[:, 1])
+ c = np.hypot(c[:, 0], c[:, 1])
+ # circumcircle and incircle radii
+ s = (a+b+c)*0.5
+ prod = s*(a+b-s)*(a+c-s)*(b+c-s)
+ # We have to deal with flat triangles with infinite circum_radius
+ bool_flat = (prod == 0.)
+ if np.any(bool_flat):
+ # Pathologic flow
+ ntri = tri_pts.shape[0]
+ circum_radius = np.empty(ntri, dtype=np.float64)
+ circum_radius[bool_flat] = np.inf
+ abc = a*b*c
+ circum_radius[~bool_flat] = abc[~bool_flat] / (
+ 4.0*np.sqrt(prod[~bool_flat]))
+ else:
+ # Normal optimized flow
+ circum_radius = (a*b*c) / (4.0*np.sqrt(prod))
+ in_radius = (a*b*c) / (4.0*circum_radius*s)
+ circle_ratio = in_radius/circum_radius
+ mask = self._triangulation.mask
+ if mask is None:
+ return circle_ratio
+ else:
+ return np.ma.array(circle_ratio, mask=mask)
+
+ def get_flat_tri_mask(self, min_circle_ratio=0.01, rescale=True):
+ """
+ Eliminate excessively flat border triangles from the triangulation.
+
+ Returns a mask *new_mask* which allows to clean the encapsulated
+ triangulation from its border-located flat triangles
+ (according to their :meth:`circle_ratios`).
+ This mask is meant to be subsequently applied to the triangulation
+ using `.Triangulation.set_mask`.
+ *new_mask* is an extension of the initial triangulation mask
+ in the sense that an initially masked triangle will remain masked.
+
+ The *new_mask* array is computed recursively; at each step flat
+ triangles are removed only if they share a side with the current mesh
+ border. Thus no new holes in the triangulated domain will be created.
+
+ Parameters
+ ----------
+ min_circle_ratio : float, default: 0.01
+ Border triangles with incircle/circumcircle radii ratio r/R will
+ be removed if r/R < *min_circle_ratio*.
+ rescale : bool, default: True
+ If True, first, internally rescale (based on `scale_factors`) so
+ that the (unmasked) triangles fit exactly inside a unit square
+ mesh. This rescaling accounts for the difference of scale which
+ might exist between the 2 axis.
+
+ Returns
+ -------
+ array of bool
+ Mask to apply to encapsulated triangulation.
+ All the initially masked triangles remain masked in the
+ *new_mask*.
+
+ Notes
+ -----
+ The rationale behind this function is that a Delaunay
+ triangulation - of an unstructured set of points - sometimes contains
+ almost flat triangles at its border, leading to artifacts in plots
+ (especially for high-resolution contouring).
+ Masked with computed *new_mask*, the encapsulated
+ triangulation would contain no more unmasked border triangles
+ with a circle ratio below *min_circle_ratio*, thus improving the
+ mesh quality for subsequent plots or interpolation.
+ """
+ # Recursively computes the mask_current_borders, true if a triangle is
+ # at the border of the mesh OR touching the border through a chain of
+ # invalid aspect ratio masked_triangles.
+ ntri = self._triangulation.triangles.shape[0]
+ mask_bad_ratio = self.circle_ratios(rescale) < min_circle_ratio
+
+ current_mask = self._triangulation.mask
+ if current_mask is None:
+ current_mask = np.zeros(ntri, dtype=bool)
+ valid_neighbors = np.copy(self._triangulation.neighbors)
+ renum_neighbors = np.arange(ntri, dtype=np.int32)
+ nadd = -1
+ while nadd != 0:
+ # The active wavefront is the triangles from the border (unmasked
+ # but with a least 1 neighbor equal to -1
+ wavefront = (np.min(valid_neighbors, axis=1) == -1) & ~current_mask
+ # The element from the active wavefront will be masked if their
+ # circle ratio is bad.
+ added_mask = wavefront & mask_bad_ratio
+ current_mask = added_mask | current_mask
+ nadd = np.sum(added_mask)
+
+ # now we have to update the tables valid_neighbors
+ valid_neighbors[added_mask, :] = -1
+ renum_neighbors[added_mask] = -1
+ valid_neighbors = np.where(valid_neighbors == -1, -1,
+ renum_neighbors[valid_neighbors])
+
+ return np.ma.filled(current_mask, True)
+
+ def _get_compressed_triangulation(self):
+ """
+ Compress (if masked) the encapsulated triangulation.
+
+ Returns minimal-length triangles array (*compressed_triangles*) and
+ coordinates arrays (*compressed_x*, *compressed_y*) that can still
+ describe the unmasked triangles of the encapsulated triangulation.
+
+ Returns
+ -------
+ compressed_triangles : array-like
+ the returned compressed triangulation triangles
+ compressed_x : array-like
+ the returned compressed triangulation 1st coordinate
+ compressed_y : array-like
+ the returned compressed triangulation 2nd coordinate
+ tri_renum : int array
+ renumbering table to translate the triangle numbers from the
+ encapsulated triangulation into the new (compressed) renumbering.
+ -1 for masked triangles (deleted from *compressed_triangles*).
+ node_renum : int array
+ renumbering table to translate the point numbers from the
+ encapsulated triangulation into the new (compressed) renumbering.
+ -1 for unused points (i.e. those deleted from *compressed_x* and
+ *compressed_y*).
+
+ """
+ # Valid triangles and renumbering
+ tri_mask = self._triangulation.mask
+ compressed_triangles = self._triangulation.get_masked_triangles()
+ ntri = self._triangulation.triangles.shape[0]
+ if tri_mask is not None:
+ tri_renum = self._total_to_compress_renum(~tri_mask)
+ else:
+ tri_renum = np.arange(ntri, dtype=np.int32)
+
+ # Valid nodes and renumbering
+ valid_node = (np.bincount(np.ravel(compressed_triangles),
+ minlength=self._triangulation.x.size) != 0)
+ compressed_x = self._triangulation.x[valid_node]
+ compressed_y = self._triangulation.y[valid_node]
+ node_renum = self._total_to_compress_renum(valid_node)
+
+ # Now renumbering the valid triangles nodes
+ compressed_triangles = node_renum[compressed_triangles]
+
+ return (compressed_triangles, compressed_x, compressed_y, tri_renum,
+ node_renum)
+
+ @staticmethod
+ def _total_to_compress_renum(valid):
+ """
+ Parameters
+ ----------
+ valid : 1D bool array
+ Validity mask.
+
+ Returns
+ -------
+ int array
+ Array so that (`valid_array` being a compressed array
+ based on a `masked_array` with mask ~*valid*):
+
+ - For all i with valid[i] = True:
+ valid_array[renum[i]] = masked_array[i]
+ - For all i with valid[i] = False:
+ renum[i] = -1 (invalid value)
+ """
+ renum = np.full(np.size(valid), -1, dtype=np.int32)
+ n_valid = np.sum(valid)
+ renum[valid] = np.arange(n_valid, dtype=np.int32)
+ return renum
diff --git a/venv/Lib/site-packages/matplotlib/ttconv.py b/venv/Lib/site-packages/matplotlib/ttconv.py
new file mode 100644
index 0000000..bfb30d5
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/ttconv.py
@@ -0,0 +1,9 @@
+"""
+Converting and subsetting TrueType fonts to PS types 3 and 42, and PDF type 3.
+"""
+
+from . import _api
+from ._ttconv import convert_ttf_to_ps, get_pdf_charprocs # noqa
+
+
+_api.warn_deprecated('3.3', name=__name__, obj_type='module')
diff --git a/venv/Lib/site-packages/matplotlib/type1font.py b/venv/Lib/site-packages/matplotlib/type1font.py
new file mode 100644
index 0000000..3fcee64
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/type1font.py
@@ -0,0 +1,335 @@
+"""
+A class representing a Type 1 font.
+
+This version reads pfa and pfb files and splits them for embedding in
+pdf files. It also supports SlantFont and ExtendFont transformations,
+similarly to pdfTeX and friends. There is no support yet for subsetting.
+
+Usage::
+
+ >>> font = Type1Font(filename)
+ >>> clear_part, encrypted_part, finale = font.parts
+ >>> slanted_font = font.transform({'slant': 0.167})
+ >>> extended_font = font.transform({'extend': 1.2})
+
+Sources:
+
+* Adobe Technical Note #5040, Supporting Downloadable PostScript
+ Language Fonts.
+
+* Adobe Type 1 Font Format, Adobe Systems Incorporated, third printing,
+ v1.1, 1993. ISBN 0-201-57044-0.
+"""
+
+import binascii
+import enum
+import itertools
+import re
+import struct
+
+import numpy as np
+
+from matplotlib.cbook import _format_approx
+
+
+# token types
+_TokenType = enum.Enum('_TokenType',
+ 'whitespace name string delimiter number')
+
+
+class Type1Font:
+ """
+ A class representing a Type-1 font, for use by backends.
+
+ Attributes
+ ----------
+ parts : tuple
+ A 3-tuple of the cleartext part, the encrypted part, and the finale of
+ zeros.
+ prop : dict[str, Any]
+ A dictionary of font properties.
+ """
+ __slots__ = ('parts', 'prop')
+
+ def __init__(self, input):
+ """
+ Initialize a Type-1 font.
+
+ Parameters
+ ----------
+ input : str or 3-tuple
+ Either a pfb file name, or a 3-tuple of already-decoded Type-1
+ font `~.Type1Font.parts`.
+ """
+ if isinstance(input, tuple) and len(input) == 3:
+ self.parts = input
+ else:
+ with open(input, 'rb') as file:
+ data = self._read(file)
+ self.parts = self._split(data)
+
+ self._parse()
+
+ def _read(self, file):
+ """Read the font from a file, decoding into usable parts."""
+ rawdata = file.read()
+ if not rawdata.startswith(b'\x80'):
+ return rawdata
+
+ data = b''
+ while rawdata:
+ if not rawdata.startswith(b'\x80'):
+ raise RuntimeError('Broken pfb file (expected byte 128, '
+ 'got %d)' % rawdata[0])
+ type = rawdata[1]
+ if type in (1, 2):
+ length, = struct.unpack('{}/%[]+')
+ _comment_re = re.compile(br'%[^\r\n\v]*')
+ _instring_re = re.compile(br'[()\\]')
+
+ @classmethod
+ def _tokens(cls, text):
+ """
+ A PostScript tokenizer. Yield (token, value) pairs such as
+ (_TokenType.whitespace, ' ') or (_TokenType.name, '/Foobar').
+ """
+ pos = 0
+ while pos < len(text):
+ match = (cls._comment_re.match(text[pos:]) or
+ cls._whitespace_re.match(text[pos:]))
+ if match:
+ yield (_TokenType.whitespace, match.group())
+ pos += match.end()
+ elif text[pos] == b'(':
+ start = pos
+ pos += 1
+ depth = 1
+ while depth:
+ match = cls._instring_re.search(text[pos:])
+ if match is None:
+ return
+ pos += match.end()
+ if match.group() == b'(':
+ depth += 1
+ elif match.group() == b')':
+ depth -= 1
+ else: # a backslash - skip the next character
+ pos += 1
+ yield (_TokenType.string, text[start:pos])
+ elif text[pos:pos + 2] in (b'<<', b'>>'):
+ yield (_TokenType.delimiter, text[pos:pos + 2])
+ pos += 2
+ elif text[pos] == b'<':
+ start = pos
+ pos += text[pos:].index(b'>')
+ yield (_TokenType.string, text[start:pos])
+ else:
+ match = cls._token_re.match(text[pos:])
+ if match:
+ try:
+ float(match.group())
+ yield (_TokenType.number, match.group())
+ except ValueError:
+ yield (_TokenType.name, match.group())
+ pos += match.end()
+ else:
+ yield (_TokenType.delimiter, text[pos:pos + 1])
+ pos += 1
+
+ def _parse(self):
+ """
+ Find the values of various font properties. This limited kind
+ of parsing is described in Chapter 10 "Adobe Type Manager
+ Compatibility" of the Type-1 spec.
+ """
+ # Start with reasonable defaults
+ prop = {'weight': 'Regular', 'ItalicAngle': 0.0, 'isFixedPitch': False,
+ 'UnderlinePosition': -100, 'UnderlineThickness': 50}
+ filtered = ((token, value)
+ for token, value in self._tokens(self.parts[0])
+ if token is not _TokenType.whitespace)
+ # The spec calls this an ASCII format; in Python 2.x we could
+ # just treat the strings and names as opaque bytes but let's
+ # turn them into proper Unicode, and be lenient in case of high bytes.
+ def convert(x): return x.decode('ascii', 'replace')
+ for token, value in filtered:
+ if token is _TokenType.name and value.startswith(b'/'):
+ key = convert(value[1:])
+ token, value = next(filtered)
+ if token is _TokenType.name:
+ if value in (b'true', b'false'):
+ value = value == b'true'
+ else:
+ value = convert(value.lstrip(b'/'))
+ elif token is _TokenType.string:
+ value = convert(value.lstrip(b'(').rstrip(b')'))
+ elif token is _TokenType.number:
+ if b'.' in value:
+ value = float(value)
+ else:
+ value = int(value)
+ else: # more complicated value such as an array
+ value = None
+ if key != 'FontInfo' and value is not None:
+ prop[key] = value
+
+ # Fill in the various *Name properties
+ if 'FontName' not in prop:
+ prop['FontName'] = (prop.get('FullName') or
+ prop.get('FamilyName') or
+ 'Unknown')
+ if 'FullName' not in prop:
+ prop['FullName'] = prop['FontName']
+ if 'FamilyName' not in prop:
+ extras = ('(?i)([ -](regular|plain|italic|oblique|(semi)?bold|'
+ '(ultra)?light|extra|condensed))+$')
+ prop['FamilyName'] = re.sub(extras, '', prop['FullName'])
+
+ self.prop = prop
+
+ @classmethod
+ def _transformer(cls, tokens, slant, extend):
+ def fontname(name):
+ result = name
+ if slant:
+ result += b'_Slant_%d' % int(1000 * slant)
+ if extend != 1.0:
+ result += b'_Extend_%d' % int(1000 * extend)
+ return result
+
+ def italicangle(angle):
+ return b'%a' % round(
+ float(angle) - np.arctan(slant) / np.pi * 180,
+ 5
+ )
+
+ def fontmatrix(array):
+ array = array.lstrip(b'[').rstrip(b']').split()
+ array = [float(x) for x in array]
+ oldmatrix = np.eye(3, 3)
+ oldmatrix[0:3, 0] = array[::2]
+ oldmatrix[0:3, 1] = array[1::2]
+ modifier = np.array([[extend, 0, 0],
+ [slant, 1, 0],
+ [0, 0, 1]])
+ newmatrix = np.dot(modifier, oldmatrix)
+ array[::2] = newmatrix[0:3, 0]
+ array[1::2] = newmatrix[0:3, 1]
+ return (
+ '[%s]' % ' '.join(_format_approx(x, 6) for x in array)
+ ).encode('ascii')
+
+ def replace(fun):
+ def replacer(tokens):
+ token, value = next(tokens) # name, e.g., /FontMatrix
+ yield value
+ token, value = next(tokens) # possible whitespace
+ while token is _TokenType.whitespace:
+ yield value
+ token, value = next(tokens)
+ if value != b'[': # name/number/etc.
+ yield fun(value)
+ else: # array, e.g., [1 2 3]
+ result = b''
+ while value != b']':
+ result += value
+ token, value = next(tokens)
+ result += value
+ yield fun(result)
+ return replacer
+
+ def suppress(tokens):
+ for _ in itertools.takewhile(lambda x: x[1] != b'def', tokens):
+ pass
+ yield b''
+
+ table = {b'/FontName': replace(fontname),
+ b'/ItalicAngle': replace(italicangle),
+ b'/FontMatrix': replace(fontmatrix),
+ b'/UniqueID': suppress}
+
+ for token, value in tokens:
+ if token is _TokenType.name and value in table:
+ yield from table[value](
+ itertools.chain([(token, value)], tokens))
+ else:
+ yield value
+
+ def transform(self, effects):
+ """
+ Return a new font that is slanted and/or extended.
+
+ Parameters
+ ----------
+ effects : dict
+ A dict with optional entries:
+
+ - 'slant' : float, default: 0
+ Tangent of the angle that the font is to be slanted to the
+ right. Negative values slant to the left.
+ - 'extend' : float, default: 1
+ Scaling factor for the font width. Values less than 1 condense
+ the glyphs.
+
+ Returns
+ -------
+ `Type1Font`
+ """
+ tokenizer = self._tokens(self.parts[0])
+ transformed = self._transformer(tokenizer,
+ slant=effects.get('slant', 0.0),
+ extend=effects.get('extend', 1.0))
+ return Type1Font((b"".join(transformed), self.parts[1], self.parts[2]))
diff --git a/venv/Lib/site-packages/matplotlib/units.py b/venv/Lib/site-packages/matplotlib/units.py
new file mode 100644
index 0000000..311764c
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/units.py
@@ -0,0 +1,222 @@
+"""
+The classes here provide support for using custom classes with
+Matplotlib, e.g., those that do not expose the array interface but know
+how to convert themselves to arrays. It also supports classes with
+units and units conversion. Use cases include converters for custom
+objects, e.g., a list of datetime objects, as well as for objects that
+are unit aware. We don't assume any particular units implementation;
+rather a units implementation must provide the register with the Registry
+converter dictionary and a `ConversionInterface`. For example,
+here is a complete implementation which supports plotting with native
+datetime objects::
+
+ import matplotlib.units as units
+ import matplotlib.dates as dates
+ import matplotlib.ticker as ticker
+ import datetime
+
+ class DateConverter(units.ConversionInterface):
+
+ @staticmethod
+ def convert(value, unit, axis):
+ 'Convert a datetime value to a scalar or array'
+ return dates.date2num(value)
+
+ @staticmethod
+ def axisinfo(unit, axis):
+ 'Return major and minor tick locators and formatters'
+ if unit!='date': return None
+ majloc = dates.AutoDateLocator()
+ majfmt = dates.AutoDateFormatter(majloc)
+ return AxisInfo(majloc=majloc,
+ majfmt=majfmt,
+ label='date')
+
+ @staticmethod
+ def default_units(x, axis):
+ 'Return the default unit for x or None'
+ return 'date'
+
+ # Finally we register our object type with the Matplotlib units registry.
+ units.registry[datetime.date] = DateConverter()
+
+"""
+
+from decimal import Decimal
+from numbers import Number
+
+import numpy as np
+from numpy import ma
+
+from matplotlib import cbook
+
+
+class ConversionError(TypeError):
+ pass
+
+
+def _is_natively_supported(x):
+ """
+ Return whether *x* is of a type that Matplotlib natively supports or an
+ array of objects of such types.
+ """
+ # Matplotlib natively supports all number types except Decimal.
+ if np.iterable(x):
+ # Assume lists are homogeneous as other functions in unit system.
+ for thisx in x:
+ if thisx is ma.masked:
+ continue
+ return isinstance(thisx, Number) and not isinstance(thisx, Decimal)
+ else:
+ return isinstance(x, Number) and not isinstance(x, Decimal)
+
+
+class AxisInfo:
+ """
+ Information to support default axis labeling, tick labeling, and limits.
+
+ An instance of this class must be returned by
+ `ConversionInterface.axisinfo`.
+ """
+ def __init__(self, majloc=None, minloc=None,
+ majfmt=None, minfmt=None, label=None,
+ default_limits=None):
+ """
+ Parameters
+ ----------
+ majloc, minloc : Locator, optional
+ Tick locators for the major and minor ticks.
+ majfmt, minfmt : Formatter, optional
+ Tick formatters for the major and minor ticks.
+ label : str, optional
+ The default axis label.
+ default_limits : optional
+ The default min and max limits of the axis if no data has
+ been plotted.
+
+ Notes
+ -----
+ If any of the above are ``None``, the axis will simply use the
+ default value.
+ """
+ self.majloc = majloc
+ self.minloc = minloc
+ self.majfmt = majfmt
+ self.minfmt = minfmt
+ self.label = label
+ self.default_limits = default_limits
+
+
+class ConversionInterface:
+ """
+ The minimal interface for a converter to take custom data types (or
+ sequences) and convert them to values Matplotlib can use.
+ """
+
+ @staticmethod
+ def axisinfo(unit, axis):
+ """Return an `.AxisInfo` for the axis with the specified units."""
+ return None
+
+ @staticmethod
+ def default_units(x, axis):
+ """Return the default unit for *x* or ``None`` for the given axis."""
+ return None
+
+ @staticmethod
+ def convert(obj, unit, axis):
+ """
+ Convert *obj* using *unit* for the specified *axis*.
+
+ If *obj* is a sequence, return the converted sequence. The output must
+ be a sequence of scalars that can be used by the numpy array layer.
+ """
+ return obj
+
+ @staticmethod
+ def is_numlike(x):
+ """
+ The Matplotlib datalim, autoscaling, locators etc work with scalars
+ which are the units converted to floats given the current unit. The
+ converter may be passed these floats, or arrays of them, even when
+ units are set.
+ """
+ if np.iterable(x):
+ for thisx in x:
+ if thisx is ma.masked:
+ continue
+ return isinstance(thisx, Number)
+ else:
+ return isinstance(x, Number)
+
+
+class DecimalConverter(ConversionInterface):
+ """Converter for decimal.Decimal data to float."""
+
+ @staticmethod
+ def convert(value, unit, axis):
+ """
+ Convert Decimals to floats.
+
+ The *unit* and *axis* arguments are not used.
+
+ Parameters
+ ----------
+ value : decimal.Decimal or iterable
+ Decimal or list of Decimal need to be converted
+ """
+ # If value is a Decimal
+ if isinstance(value, Decimal):
+ return float(value)
+ else:
+ # assume x is a list of Decimal
+ converter = np.asarray
+ if isinstance(value, ma.MaskedArray):
+ converter = ma.asarray
+ return converter(value, dtype=float)
+
+ @staticmethod
+ def axisinfo(unit, axis):
+ # Since Decimal is a kind of Number, don't need specific axisinfo.
+ return AxisInfo()
+
+ @staticmethod
+ def default_units(x, axis):
+ # Return None since Decimal is a kind of Number.
+ return None
+
+
+class Registry(dict):
+ """Register types with conversion interface."""
+
+ def get_converter(self, x):
+ """Get the converter interface instance for *x*, or None."""
+ if hasattr(x, "values"):
+ x = x.values # Unpack pandas Series and DataFrames.
+ if isinstance(x, np.ndarray):
+ # In case x in a masked array, access the underlying data (only its
+ # type matters). If x is a regular ndarray, getdata() just returns
+ # the array itself.
+ x = np.ma.getdata(x).ravel()
+ # If there are no elements in x, infer the units from its dtype
+ if not x.size:
+ return self.get_converter(np.array([0], dtype=x.dtype))
+ for cls in type(x).__mro__: # Look up in the cache.
+ try:
+ return self[cls]
+ except KeyError:
+ pass
+ try: # If cache lookup fails, look up based on first element...
+ first = cbook.safe_first_element(x)
+ except (TypeError, StopIteration):
+ pass
+ else:
+ # ... and avoid infinite recursion for pathological iterables for
+ # which indexing returns instances of the same iterable class.
+ if type(first) is not type(x):
+ return self.get_converter(first)
+ return None
+
+
+registry = Registry()
+registry[Decimal] = DecimalConverter()
diff --git a/venv/Lib/site-packages/matplotlib/widgets.py b/venv/Lib/site-packages/matplotlib/widgets.py
new file mode 100644
index 0000000..bd739ac
--- /dev/null
+++ b/venv/Lib/site-packages/matplotlib/widgets.py
@@ -0,0 +1,2996 @@
+"""
+GUI neutral widgets
+===================
+
+Widgets that are designed to work for any of the GUI backends.
+All of these widgets require you to predefine a `matplotlib.axes.Axes`
+instance and pass that as the first parameter. Matplotlib doesn't try to
+be too smart with respect to layout -- you will have to figure out how
+wide and tall you want your Axes to be to accommodate your widget.
+"""
+
+from contextlib import ExitStack
+import copy
+from numbers import Integral, Number
+
+import numpy as np
+
+import matplotlib as mpl
+from . import _api, cbook, colors, ticker
+from .lines import Line2D
+from .patches import Circle, Rectangle, Ellipse
+
+
+class LockDraw:
+ """
+ Some widgets, like the cursor, draw onto the canvas, and this is not
+ desirable under all circumstances, like when the toolbar is in zoom-to-rect
+ mode and drawing a rectangle. To avoid this, a widget can acquire a
+ canvas' lock with ``canvas.widgetlock(widget)`` before drawing on the
+ canvas; this will prevent other widgets from doing so at the same time (if
+ they also try to acquire the lock first).
+ """
+
+ def __init__(self):
+ self._owner = None
+
+ def __call__(self, o):
+ """Reserve the lock for *o*."""
+ if not self.available(o):
+ raise ValueError('already locked')
+ self._owner = o
+
+ def release(self, o):
+ """Release the lock from *o*."""
+ if not self.available(o):
+ raise ValueError('you do not own this lock')
+ self._owner = None
+
+ def available(self, o):
+ """Return whether drawing is available to *o*."""
+ return not self.locked() or self.isowner(o)
+
+ def isowner(self, o):
+ """Return whether *o* owns this lock."""
+ return self._owner is o
+
+ def locked(self):
+ """Return whether the lock is currently held by an owner."""
+ return self._owner is not None
+
+
+class Widget:
+ """
+ Abstract base class for GUI neutral widgets.
+ """
+ drawon = True
+ eventson = True
+ _active = True
+
+ def set_active(self, active):
+ """Set whether the widget is active."""
+ self._active = active
+
+ def get_active(self):
+ """Get whether the widget is active."""
+ return self._active
+
+ # set_active is overridden by SelectorWidgets.
+ active = property(get_active, set_active, doc="Is the widget active?")
+
+ def ignore(self, event):
+ """
+ Return whether *event* should be ignored.
+
+ This method should be called at the beginning of any event callback.
+ """
+ return not self.active
+
+
+class AxesWidget(Widget):
+ """
+ Widget connected to a single `~matplotlib.axes.Axes`.
+
+ To guarantee that the widget remains responsive and not garbage-collected,
+ a reference to the object should be maintained by the user.
+
+ This is necessary because the callback registry
+ maintains only weak-refs to the functions, which are member
+ functions of the widget. If there are no references to the widget
+ object it may be garbage collected which will disconnect the callbacks.
+
+ Attributes
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The parent axes for the widget.
+ canvas : `~matplotlib.backend_bases.FigureCanvasBase`
+ The parent figure canvas for the widget.
+ active : bool
+ If False, the widget does not respond to events.
+ """
+
+ cids = _api.deprecated("3.4")(property(lambda self: self._cids))
+
+ def __init__(self, ax):
+ self.ax = ax
+ self.canvas = ax.figure.canvas
+ self._cids = []
+
+ def connect_event(self, event, callback):
+ """
+ Connect a callback function with an event.
+
+ This should be used in lieu of ``figure.canvas.mpl_connect`` since this
+ function stores callback ids for later clean up.
+ """
+ cid = self.canvas.mpl_connect(event, callback)
+ self._cids.append(cid)
+
+ def disconnect_events(self):
+ """Disconnect all events created by this widget."""
+ for c in self._cids:
+ self.canvas.mpl_disconnect(c)
+
+
+class Button(AxesWidget):
+ """
+ A GUI neutral button.
+
+ For the button to remain responsive you must keep a reference to it.
+ Call `.on_clicked` to connect to the button.
+
+ Attributes
+ ----------
+ ax
+ The `matplotlib.axes.Axes` the button renders into.
+ label
+ A `matplotlib.text.Text` instance.
+ color
+ The color of the button when not hovering.
+ hovercolor
+ The color of the button when hovering.
+ """
+
+ cnt = _api.deprecated("3.4")(property( # Not real, but close enough.
+ lambda self: len(self._observers.callbacks['clicked'])))
+ observers = _api.deprecated("3.4")(property(
+ lambda self: self._observers.callbacks['clicked']))
+
+ def __init__(self, ax, label, image=None,
+ color='0.85', hovercolor='0.95'):
+ """
+ Parameters
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The `~.axes.Axes` instance the button will be placed into.
+ label : str
+ The button text.
+ image : array-like or PIL Image
+ The image to place in the button, if not *None*. The parameter is
+ directly forwarded to `~matplotlib.axes.Axes.imshow`.
+ color : color
+ The color of the button when not activated.
+ hovercolor : color
+ The color of the button when the mouse is over it.
+ """
+ super().__init__(ax)
+
+ if image is not None:
+ ax.imshow(image)
+ self.label = ax.text(0.5, 0.5, label,
+ verticalalignment='center',
+ horizontalalignment='center',
+ transform=ax.transAxes)
+
+ self._observers = cbook.CallbackRegistry()
+
+ self.connect_event('button_press_event', self._click)
+ self.connect_event('button_release_event', self._release)
+ self.connect_event('motion_notify_event', self._motion)
+ ax.set_navigate(False)
+ ax.set_facecolor(color)
+ ax.set_xticks([])
+ ax.set_yticks([])
+ self.color = color
+ self.hovercolor = hovercolor
+
+ def _click(self, event):
+ if self.ignore(event) or event.inaxes != self.ax or not self.eventson:
+ return
+ if event.canvas.mouse_grabber != self.ax:
+ event.canvas.grab_mouse(self.ax)
+
+ def _release(self, event):
+ if self.ignore(event) or event.canvas.mouse_grabber != self.ax:
+ return
+ event.canvas.release_mouse(self.ax)
+ if self.eventson and event.inaxes == self.ax:
+ self._observers.process('clicked', event)
+
+ def _motion(self, event):
+ if self.ignore(event):
+ return
+ c = self.hovercolor if event.inaxes == self.ax else self.color
+ if not colors.same_color(c, self.ax.get_facecolor()):
+ self.ax.set_facecolor(c)
+ if self.drawon:
+ self.ax.figure.canvas.draw()
+
+ def on_clicked(self, func):
+ """
+ Connect the callback function *func* to button click events.
+
+ Returns a connection id, which can be used to disconnect the callback.
+ """
+ return self._observers.connect('clicked', lambda event: func(event))
+
+ def disconnect(self, cid):
+ """Remove the callback function with connection id *cid*."""
+ self._observers.disconnect(cid)
+
+
+class SliderBase(AxesWidget):
+ """
+ The base class for constructing Slider widgets. Not intended for direct
+ usage.
+
+ For the slider to remain responsive you must maintain a reference to it.
+ """
+ def __init__(self, ax, orientation, closedmin, closedmax,
+ valmin, valmax, valfmt, dragging, valstep):
+ if ax.name == '3d':
+ raise ValueError('Sliders cannot be added to 3D Axes')
+
+ super().__init__(ax)
+ _api.check_in_list(['horizontal', 'vertical'], orientation=orientation)
+
+ self.orientation = orientation
+ self.closedmin = closedmin
+ self.closedmax = closedmax
+ self.valmin = valmin
+ self.valmax = valmax
+ self.valstep = valstep
+ self.drag_active = False
+ self.valfmt = valfmt
+
+ if orientation == "vertical":
+ ax.set_ylim((valmin, valmax))
+ axis = ax.yaxis
+ else:
+ ax.set_xlim((valmin, valmax))
+ axis = ax.xaxis
+
+ self._fmt = axis.get_major_formatter()
+ if not isinstance(self._fmt, ticker.ScalarFormatter):
+ self._fmt = ticker.ScalarFormatter()
+ self._fmt.set_axis(axis)
+ self._fmt.set_useOffset(False) # No additive offset.
+ self._fmt.set_useMathText(True) # x sign before multiplicative offset.
+
+ ax.set_xticks([])
+ ax.set_yticks([])
+ ax.set_navigate(False)
+ self.connect_event("button_press_event", self._update)
+ self.connect_event("button_release_event", self._update)
+ if dragging:
+ self.connect_event("motion_notify_event", self._update)
+ self._observers = cbook.CallbackRegistry()
+
+ def _stepped_value(self, val):
+ """Return *val* coerced to closest number in the ``valstep`` grid."""
+ if isinstance(self.valstep, Number):
+ val = (self.valmin
+ + round((val - self.valmin) / self.valstep) * self.valstep)
+ elif self.valstep is not None:
+ valstep = np.asanyarray(self.valstep)
+ if valstep.ndim != 1:
+ raise ValueError(
+ f"valstep must have 1 dimension but has {valstep.ndim}"
+ )
+ val = valstep[np.argmin(np.abs(valstep - val))]
+ return val
+
+ def disconnect(self, cid):
+ """
+ Remove the observer with connection id *cid*.
+
+ Parameters
+ ----------
+ cid : int
+ Connection id of the observer to be removed.
+ """
+ self._observers.disconnect(cid)
+
+ def reset(self):
+ """Reset the slider to the initial value."""
+ if self.val != self.valinit:
+ self.set_val(self.valinit)
+
+
+class Slider(SliderBase):
+ """
+ A slider representing a floating point range.
+
+ Create a slider from *valmin* to *valmax* in axes *ax*. For the slider to
+ remain responsive you must maintain a reference to it. Call
+ :meth:`on_changed` to connect to the slider event.
+
+ Attributes
+ ----------
+ val : float
+ Slider value.
+ """
+
+ cnt = _api.deprecated("3.4")(property( # Not real, but close enough.
+ lambda self: len(self._observers.callbacks['changed'])))
+ observers = _api.deprecated("3.4")(property(
+ lambda self: self._observers.callbacks['changed']))
+
+ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt=None,
+ closedmin=True, closedmax=True, slidermin=None,
+ slidermax=None, dragging=True, valstep=None,
+ orientation='horizontal', *, initcolor='r', **kwargs):
+ """
+ Parameters
+ ----------
+ ax : Axes
+ The Axes to put the slider in.
+
+ label : str
+ Slider label.
+
+ valmin : float
+ The minimum value of the slider.
+
+ valmax : float
+ The maximum value of the slider.
+
+ valinit : float, default: 0.5
+ The slider initial position.
+
+ valfmt : str, default: None
+ %-format string used to format the slider value. If None, a
+ `.ScalarFormatter` is used instead.
+
+ closedmin : bool, default: True
+ Whether the slider interval is closed on the bottom.
+
+ closedmax : bool, default: True
+ Whether the slider interval is closed on the top.
+
+ slidermin : Slider, default: None
+ Do not allow the current slider to have a value less than
+ the value of the Slider *slidermin*.
+
+ slidermax : Slider, default: None
+ Do not allow the current slider to have a value greater than
+ the value of the Slider *slidermax*.
+
+ dragging : bool, default: True
+ If True the slider can be dragged by the mouse.
+
+ valstep : float or array-like, default: None
+ If a float, the slider will snap to multiples of *valstep*.
+ If an array the slider will snap to the values in the array.
+
+ orientation : {'horizontal', 'vertical'}, default: 'horizontal'
+ The orientation of the slider.
+
+ initcolor : color, default: 'r'
+ The color of the line at the *valinit* position. Set to ``'none'``
+ for no line.
+
+ Notes
+ -----
+ Additional kwargs are passed on to ``self.poly`` which is the
+ `~matplotlib.patches.Rectangle` that draws the slider knob. See the
+ `.Rectangle` documentation for valid property names (``facecolor``,
+ ``edgecolor``, ``alpha``, etc.).
+ """
+ super().__init__(ax, orientation, closedmin, closedmax,
+ valmin, valmax, valfmt, dragging, valstep)
+
+ if slidermin is not None and not hasattr(slidermin, 'val'):
+ raise ValueError(
+ f"Argument slidermin ({type(slidermin)}) has no 'val'")
+ if slidermax is not None and not hasattr(slidermax, 'val'):
+ raise ValueError(
+ f"Argument slidermax ({type(slidermax)}) has no 'val'")
+ self.slidermin = slidermin
+ self.slidermax = slidermax
+ valinit = self._value_in_bounds(valinit)
+ if valinit is None:
+ valinit = valmin
+ self.val = valinit
+ self.valinit = valinit
+ if orientation == 'vertical':
+ self.poly = ax.axhspan(valmin, valinit, 0, 1, **kwargs)
+ self.hline = ax.axhline(valinit, 0, 1, color=initcolor, lw=1)
+ else:
+ self.poly = ax.axvspan(valmin, valinit, 0, 1, **kwargs)
+ self.vline = ax.axvline(valinit, 0, 1, color=initcolor, lw=1)
+
+ if orientation == 'vertical':
+ self.label = ax.text(0.5, 1.02, label, transform=ax.transAxes,
+ verticalalignment='bottom',
+ horizontalalignment='center')
+
+ self.valtext = ax.text(0.5, -0.02, self._format(valinit),
+ transform=ax.transAxes,
+ verticalalignment='top',
+ horizontalalignment='center')
+ else:
+ self.label = ax.text(-0.02, 0.5, label, transform=ax.transAxes,
+ verticalalignment='center',
+ horizontalalignment='right')
+
+ self.valtext = ax.text(1.02, 0.5, self._format(valinit),
+ transform=ax.transAxes,
+ verticalalignment='center',
+ horizontalalignment='left')
+
+ self.set_val(valinit)
+
+ def _value_in_bounds(self, val):
+ """Makes sure *val* is with given bounds."""
+ val = self._stepped_value(val)
+
+ if val <= self.valmin:
+ if not self.closedmin:
+ return
+ val = self.valmin
+ elif val >= self.valmax:
+ if not self.closedmax:
+ return
+ val = self.valmax
+
+ if self.slidermin is not None and val <= self.slidermin.val:
+ if not self.closedmin:
+ return
+ val = self.slidermin.val
+
+ if self.slidermax is not None and val >= self.slidermax.val:
+ if not self.closedmax:
+ return
+ val = self.slidermax.val
+ return val
+
+ def _update(self, event):
+ """Update the slider position."""
+ if self.ignore(event) or event.button != 1:
+ return
+
+ if event.name == 'button_press_event' and event.inaxes == self.ax:
+ self.drag_active = True
+ event.canvas.grab_mouse(self.ax)
+
+ if not self.drag_active:
+ return
+
+ elif ((event.name == 'button_release_event') or
+ (event.name == 'button_press_event' and
+ event.inaxes != self.ax)):
+ self.drag_active = False
+ event.canvas.release_mouse(self.ax)
+ return
+ if self.orientation == 'vertical':
+ val = self._value_in_bounds(event.ydata)
+ else:
+ val = self._value_in_bounds(event.xdata)
+ if val not in [None, self.val]:
+ self.set_val(val)
+
+ def _format(self, val):
+ """Pretty-print *val*."""
+ if self.valfmt is not None:
+ return self.valfmt % val
+ else:
+ _, s, _ = self._fmt.format_ticks([self.valmin, val, self.valmax])
+ # fmt.get_offset is actually the multiplicative factor, if any.
+ return s + self._fmt.get_offset()
+
+ def set_val(self, val):
+ """
+ Set slider value to *val*.
+
+ Parameters
+ ----------
+ val : float
+ """
+ xy = self.poly.xy
+ if self.orientation == 'vertical':
+ xy[1] = 0, val
+ xy[2] = 1, val
+ else:
+ xy[2] = val, 1
+ xy[3] = val, 0
+ self.poly.xy = xy
+ self.valtext.set_text(self._format(val))
+ if self.drawon:
+ self.ax.figure.canvas.draw_idle()
+ self.val = val
+ if self.eventson:
+ self._observers.process('changed', val)
+
+ def on_changed(self, func):
+ """
+ Connect *func* as callback function to changes of the slider value.
+
+ Parameters
+ ----------
+ func : callable
+ Function to call when slider is changed.
+ The function must accept a single float as its arguments.
+
+ Returns
+ -------
+ int
+ Connection id (which can be used to disconnect *func*).
+ """
+ return self._observers.connect('changed', lambda val: func(val))
+
+
+class RangeSlider(SliderBase):
+ """
+ A slider representing a range of floating point values. Defines the min and
+ max of the range via the *val* attribute as a tuple of (min, max).
+
+ Create a slider that defines a range contained within [*valmin*, *valmax*]
+ in axes *ax*. For the slider to remain responsive you must maintain a
+ reference to it. Call :meth:`on_changed` to connect to the slider event.
+
+ Attributes
+ ----------
+ val : tuple of float
+ Slider value.
+ """
+
+ def __init__(
+ self,
+ ax,
+ label,
+ valmin,
+ valmax,
+ valinit=None,
+ valfmt=None,
+ closedmin=True,
+ closedmax=True,
+ dragging=True,
+ valstep=None,
+ orientation="horizontal",
+ **kwargs,
+ ):
+ """
+ Parameters
+ ----------
+ ax : Axes
+ The Axes to put the slider in.
+
+ label : str
+ Slider label.
+
+ valmin : float
+ The minimum value of the slider.
+
+ valmax : float
+ The maximum value of the slider.
+
+ valinit : tuple of float or None, default: None
+ The initial positions of the slider. If None the initial positions
+ will be at the 25th and 75th percentiles of the range.
+
+ valfmt : str, default: None
+ %-format string used to format the slider values. If None, a
+ `.ScalarFormatter` is used instead.
+
+ closedmin : bool, default: True
+ Whether the slider interval is closed on the bottom.
+
+ closedmax : bool, default: True
+ Whether the slider interval is closed on the top.
+
+ dragging : bool, default: True
+ If True the slider can be dragged by the mouse.
+
+ valstep : float, default: None
+ If given, the slider will snap to multiples of *valstep*.
+
+ orientation : {'horizontal', 'vertical'}, default: 'horizontal'
+ The orientation of the slider.
+
+ Notes
+ -----
+ Additional kwargs are passed on to ``self.poly`` which is the
+ `~matplotlib.patches.Rectangle` that draws the slider knob. See the
+ `.Rectangle` documentation for valid property names (``facecolor``,
+ ``edgecolor``, ``alpha``, etc.).
+ """
+ super().__init__(ax, orientation, closedmin, closedmax,
+ valmin, valmax, valfmt, dragging, valstep)
+
+ # Set a value to allow _value_in_bounds() to work.
+ self.val = [valmin, valmax]
+ if valinit is None:
+ # Place at the 25th and 75th percentiles
+ extent = valmax - valmin
+ valinit = np.array([valmin + extent * 0.25,
+ valmin + extent * 0.75])
+ else:
+ valinit = self._value_in_bounds(valinit)
+ self.val = valinit
+ self.valinit = valinit
+ if orientation == "vertical":
+ self.poly = ax.axhspan(valinit[0], valinit[1], 0, 1, **kwargs)
+ else:
+ self.poly = ax.axvspan(valinit[0], valinit[1], 0, 1, **kwargs)
+
+ if orientation == "vertical":
+ self.label = ax.text(
+ 0.5,
+ 1.02,
+ label,
+ transform=ax.transAxes,
+ verticalalignment="bottom",
+ horizontalalignment="center",
+ )
+
+ self.valtext = ax.text(
+ 0.5,
+ -0.02,
+ self._format(valinit),
+ transform=ax.transAxes,
+ verticalalignment="top",
+ horizontalalignment="center",
+ )
+ else:
+ self.label = ax.text(
+ -0.02,
+ 0.5,
+ label,
+ transform=ax.transAxes,
+ verticalalignment="center",
+ horizontalalignment="right",
+ )
+
+ self.valtext = ax.text(
+ 1.02,
+ 0.5,
+ self._format(valinit),
+ transform=ax.transAxes,
+ verticalalignment="center",
+ horizontalalignment="left",
+ )
+
+ self.set_val(valinit)
+
+ def _min_in_bounds(self, min):
+ """Ensure the new min value is between valmin and self.val[1]."""
+ if min <= self.valmin:
+ if not self.closedmin:
+ return self.val[0]
+ min = self.valmin
+
+ if min > self.val[1]:
+ min = self.val[1]
+ return self._stepped_value(min)
+
+ def _max_in_bounds(self, max):
+ """Ensure the new max value is between valmax and self.val[0]."""
+ if max >= self.valmax:
+ if not self.closedmax:
+ return self.val[1]
+ max = self.valmax
+
+ if max <= self.val[0]:
+ max = self.val[0]
+ return self._stepped_value(max)
+
+ def _value_in_bounds(self, vals):
+ """Clip min, max values to the bounds."""
+ return (self._min_in_bounds(vals[0]), self._max_in_bounds(vals[1]))
+
+ def _update_val_from_pos(self, pos):
+ """Update the slider value based on a given position."""
+ idx = np.argmin(np.abs(self.val - pos))
+ if idx == 0:
+ val = self._min_in_bounds(pos)
+ self.set_min(val)
+ else:
+ val = self._max_in_bounds(pos)
+ self.set_max(val)
+
+ def _update(self, event):
+ """Update the slider position."""
+ if self.ignore(event) or event.button != 1:
+ return
+
+ if event.name == "button_press_event" and event.inaxes == self.ax:
+ self.drag_active = True
+ event.canvas.grab_mouse(self.ax)
+
+ if not self.drag_active:
+ return
+
+ elif (event.name == "button_release_event") or (
+ event.name == "button_press_event" and event.inaxes != self.ax
+ ):
+ self.drag_active = False
+ event.canvas.release_mouse(self.ax)
+ return
+ if self.orientation == "vertical":
+ self._update_val_from_pos(event.ydata)
+ else:
+ self._update_val_from_pos(event.xdata)
+
+ def _format(self, val):
+ """Pretty-print *val*."""
+ if self.valfmt is not None:
+ return f"({self.valfmt % val[0]}, {self.valfmt % val[1]})"
+ else:
+ _, s1, s2, _ = self._fmt.format_ticks(
+ [self.valmin, *val, self.valmax]
+ )
+ # fmt.get_offset is actually the multiplicative factor, if any.
+ s1 += self._fmt.get_offset()
+ s2 += self._fmt.get_offset()
+ # Use f string to avoid issues with backslashes when cast to a str
+ return f"({s1}, {s2})"
+
+ def set_min(self, min):
+ """
+ Set the lower value of the slider to *min*.
+
+ Parameters
+ ----------
+ min : float
+ """
+ self.set_val((min, self.val[1]))
+
+ def set_max(self, max):
+ """
+ Set the lower value of the slider to *max*.
+
+ Parameters
+ ----------
+ max : float
+ """
+ self.set_val((self.val[0], max))
+
+ def set_val(self, val):
+ """
+ Set slider value to *val*.
+
+ Parameters
+ ----------
+ val : tuple or array-like of float
+ """
+ val = np.sort(np.asanyarray(val))
+ if val.shape != (2,):
+ raise ValueError(
+ f"val must have shape (2,) but has shape {val.shape}"
+ )
+ val[0] = self._min_in_bounds(val[0])
+ val[1] = self._max_in_bounds(val[1])
+ xy = self.poly.xy
+ if self.orientation == "vertical":
+ xy[0] = 0, val[0]
+ xy[1] = 0, val[1]
+ xy[2] = 1, val[1]
+ xy[3] = 1, val[0]
+ xy[4] = 0, val[0]
+ else:
+ xy[0] = val[0], 0
+ xy[1] = val[0], 1
+ xy[2] = val[1], 1
+ xy[3] = val[1], 0
+ xy[4] = val[0], 0
+ self.poly.xy = xy
+ self.valtext.set_text(self._format(val))
+ if self.drawon:
+ self.ax.figure.canvas.draw_idle()
+ self.val = val
+ if self.eventson:
+ self._observers.process("changed", val)
+
+ def on_changed(self, func):
+ """
+ Connect *func* as callback function to changes of the slider value.
+
+ Parameters
+ ----------
+ func : callable
+ Function to call when slider is changed. The function
+ must accept a numpy array with shape (2,) as its argument.
+
+ Returns
+ -------
+ int
+ Connection id (which can be used to disconnect *func*).
+ """
+ return self._observers.connect('changed', lambda val: func(val))
+
+
+class CheckButtons(AxesWidget):
+ r"""
+ A GUI neutral set of check buttons.
+
+ For the check buttons to remain responsive you must keep a
+ reference to this object.
+
+ Connect to the CheckButtons with the `.on_clicked` method.
+
+ Attributes
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The parent axes for the widget.
+ labels : list of `.Text`
+
+ rectangles : list of `.Rectangle`
+
+ lines : list of (`.Line2D`, `.Line2D`) pairs
+ List of lines for the x's in the check boxes. These lines exist for
+ each box, but have ``set_visible(False)`` when its box is not checked.
+ """
+
+ cnt = _api.deprecated("3.4")(property( # Not real, but close enough.
+ lambda self: len(self._observers.callbacks['clicked'])))
+ observers = _api.deprecated("3.4")(property(
+ lambda self: self._observers.callbacks['clicked']))
+
+ def __init__(self, ax, labels, actives=None):
+ """
+ Add check buttons to `matplotlib.axes.Axes` instance *ax*.
+
+ Parameters
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The parent axes for the widget.
+
+ labels : list of str
+ The labels of the check buttons.
+
+ actives : list of bool, optional
+ The initial check states of the buttons. The list must have the
+ same length as *labels*. If not given, all buttons are unchecked.
+ """
+ super().__init__(ax)
+
+ ax.set_xticks([])
+ ax.set_yticks([])
+ ax.set_navigate(False)
+
+ if actives is None:
+ actives = [False] * len(labels)
+
+ if len(labels) > 1:
+ dy = 1. / (len(labels) + 1)
+ ys = np.linspace(1 - dy, dy, len(labels))
+ else:
+ dy = 0.25
+ ys = [0.5]
+
+ axcolor = ax.get_facecolor()
+
+ self.labels = []
+ self.lines = []
+ self.rectangles = []
+
+ lineparams = {'color': 'k', 'linewidth': 1.25,
+ 'transform': ax.transAxes, 'solid_capstyle': 'butt'}
+ for y, label, active in zip(ys, labels, actives):
+ t = ax.text(0.25, y, label, transform=ax.transAxes,
+ horizontalalignment='left',
+ verticalalignment='center')
+
+ w, h = dy / 2, dy / 2
+ x, y = 0.05, y - h / 2
+
+ p = Rectangle(xy=(x, y), width=w, height=h, edgecolor='black',
+ facecolor=axcolor, transform=ax.transAxes)
+
+ l1 = Line2D([x, x + w], [y + h, y], **lineparams)
+ l2 = Line2D([x, x + w], [y, y + h], **lineparams)
+
+ l1.set_visible(active)
+ l2.set_visible(active)
+ self.labels.append(t)
+ self.rectangles.append(p)
+ self.lines.append((l1, l2))
+ ax.add_patch(p)
+ ax.add_line(l1)
+ ax.add_line(l2)
+
+ self.connect_event('button_press_event', self._clicked)
+
+ self._observers = cbook.CallbackRegistry()
+
+ def _clicked(self, event):
+ if self.ignore(event) or event.button != 1 or event.inaxes != self.ax:
+ return
+ for i, (p, t) in enumerate(zip(self.rectangles, self.labels)):
+ if (t.get_window_extent().contains(event.x, event.y) or
+ p.get_window_extent().contains(event.x, event.y)):
+ self.set_active(i)
+ break
+
+ def set_active(self, index):
+ """
+ Toggle (activate or deactivate) a check button by index.
+
+ Callbacks will be triggered if :attr:`eventson` is True.
+
+ Parameters
+ ----------
+ index : int
+ Index of the check button to toggle.
+
+ Raises
+ ------
+ ValueError
+ If *index* is invalid.
+ """
+ if index not in range(len(self.labels)):
+ raise ValueError(f'Invalid CheckButton index: {index}')
+
+ l1, l2 = self.lines[index]
+ l1.set_visible(not l1.get_visible())
+ l2.set_visible(not l2.get_visible())
+
+ if self.drawon:
+ self.ax.figure.canvas.draw()
+
+ if self.eventson:
+ self._observers.process('clicked', self.labels[index].get_text())
+
+ def get_status(self):
+ """
+ Return a tuple of the status (True/False) of all of the check buttons.
+ """
+ return [l1.get_visible() for (l1, l2) in self.lines]
+
+ def on_clicked(self, func):
+ """
+ Connect the callback function *func* to button click events.
+
+ Returns a connection id, which can be used to disconnect the callback.
+ """
+ return self._observers.connect('clicked', lambda text: func(text))
+
+ def disconnect(self, cid):
+ """Remove the observer with connection id *cid*."""
+ self._observers.disconnect(cid)
+
+
+class TextBox(AxesWidget):
+ """
+ A GUI neutral text input box.
+
+ For the text box to remain responsive you must keep a reference to it.
+
+ Call `.on_text_change` to be updated whenever the text changes.
+
+ Call `.on_submit` to be updated whenever the user hits enter or
+ leaves the text entry field.
+
+ Attributes
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The parent axes for the widget.
+ label : `.Text`
+
+ color : color
+ The color of the text box when not hovering.
+ hovercolor : color
+ The color of the text box when hovering.
+ """
+
+ params_to_disable = _api.deprecated("3.3")(property(
+ lambda self: [key for key in mpl.rcParams if 'keymap' in key]))
+ cnt = _api.deprecated("3.4")(property( # Not real, but close enough.
+ lambda self: sum(len(d) for d in self._observers.callbacks.values())))
+ change_observers = _api.deprecated("3.4")(property(
+ lambda self: self._observers.callbacks['change']))
+ submit_observers = _api.deprecated("3.4")(property(
+ lambda self: self._observers.callbacks['submit']))
+
+ def __init__(self, ax, label, initial='',
+ color='.95', hovercolor='1', label_pad=.01):
+ """
+ Parameters
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The `~.axes.Axes` instance the button will be placed into.
+ label : str
+ Label for this text box.
+ initial : str
+ Initial value in the text box.
+ color : color
+ The color of the box.
+ hovercolor : color
+ The color of the box when the mouse is over it.
+ label_pad : float
+ The distance between the label and the right side of the textbox.
+ """
+ super().__init__(ax)
+
+ self.DIST_FROM_LEFT = .05
+
+ self.label = ax.text(
+ -label_pad, 0.5, label, transform=ax.transAxes,
+ verticalalignment='center', horizontalalignment='right')
+ self.text_disp = self.ax.text(
+ self.DIST_FROM_LEFT, 0.5, initial, transform=self.ax.transAxes,
+ verticalalignment='center', horizontalalignment='left')
+
+ self._observers = cbook.CallbackRegistry()
+
+ ax.set(
+ xlim=(0, 1), ylim=(0, 1), # s.t. cursor appears from first click.
+ navigate=False, facecolor=color,
+ xticks=[], yticks=[])
+
+ self.cursor_index = 0
+
+ self.cursor = ax.vlines(0, 0, 0, visible=False, color="k", lw=1,
+ transform=mpl.transforms.IdentityTransform())
+
+ self.connect_event('button_press_event', self._click)
+ self.connect_event('button_release_event', self._release)
+ self.connect_event('motion_notify_event', self._motion)
+ self.connect_event('key_press_event', self._keypress)
+ self.connect_event('resize_event', self._resize)
+
+ self.color = color
+ self.hovercolor = hovercolor
+
+ self.capturekeystrokes = False
+
+ @property
+ def text(self):
+ return self.text_disp.get_text()
+
+ def _rendercursor(self):
+ # this is a hack to figure out where the cursor should go.
+ # we draw the text up to where the cursor should go, measure
+ # and save its dimensions, draw the real text, then put the cursor
+ # at the saved dimensions
+
+ # This causes a single extra draw if the figure has never been rendered
+ # yet, which should be fine as we're going to repeatedly re-render the
+ # figure later anyways.
+ if self.ax.figure._cachedRenderer is None:
+ self.ax.figure.canvas.draw()
+
+ text = self.text_disp.get_text() # Save value before overwriting it.
+ widthtext = text[:self.cursor_index]
+ self.text_disp.set_text(widthtext or ",")
+ bb = self.text_disp.get_window_extent()
+ if not widthtext: # Use the comma for the height, but keep width to 0.
+ bb.x1 = bb.x0
+ self.cursor.set(
+ segments=[[(bb.x1, bb.y0), (bb.x1, bb.y1)]], visible=True)
+ self.text_disp.set_text(text)
+
+ self.ax.figure.canvas.draw()
+
+ def _release(self, event):
+ if self.ignore(event):
+ return
+ if event.canvas.mouse_grabber != self.ax:
+ return
+ event.canvas.release_mouse(self.ax)
+
+ def _keypress(self, event):
+ if self.ignore(event):
+ return
+ if self.capturekeystrokes:
+ key = event.key
+ text = self.text
+ if len(key) == 1:
+ text = (text[:self.cursor_index] + key +
+ text[self.cursor_index:])
+ self.cursor_index += 1
+ elif key == "right":
+ if self.cursor_index != len(text):
+ self.cursor_index += 1
+ elif key == "left":
+ if self.cursor_index != 0:
+ self.cursor_index -= 1
+ elif key == "home":
+ self.cursor_index = 0
+ elif key == "end":
+ self.cursor_index = len(text)
+ elif key == "backspace":
+ if self.cursor_index != 0:
+ text = (text[:self.cursor_index - 1] +
+ text[self.cursor_index:])
+ self.cursor_index -= 1
+ elif key == "delete":
+ if self.cursor_index != len(self.text):
+ text = (text[:self.cursor_index] +
+ text[self.cursor_index + 1:])
+ self.text_disp.set_text(text)
+ self._rendercursor()
+ if self.eventson:
+ self._observers.process('change', self.text)
+ if key in ["enter", "return"]:
+ self._observers.process('submit', self.text)
+
+ def set_val(self, val):
+ newval = str(val)
+ if self.text == newval:
+ return
+ self.text_disp.set_text(newval)
+ self._rendercursor()
+ if self.eventson:
+ self._observers.process('change', self.text)
+ self._observers.process('submit', self.text)
+
+ def begin_typing(self, x):
+ self.capturekeystrokes = True
+ # Disable keypress shortcuts, which may otherwise cause the figure to
+ # be saved, closed, etc., until the user stops typing. The way to
+ # achieve this depends on whether toolmanager is in use.
+ stack = ExitStack() # Register cleanup actions when user stops typing.
+ self._on_stop_typing = stack.close
+ toolmanager = getattr(
+ self.ax.figure.canvas.manager, "toolmanager", None)
+ if toolmanager is not None:
+ # If using toolmanager, lock keypresses, and plan to release the
+ # lock when typing stops.
+ toolmanager.keypresslock(self)
+ stack.push(toolmanager.keypresslock.release, self)
+ else:
+ # If not using toolmanager, disable all keypress-related rcParams.
+ # Avoid spurious warnings if keymaps are getting deprecated.
+ with _api.suppress_matplotlib_deprecation_warning():
+ stack.enter_context(mpl.rc_context(
+ {k: [] for k in mpl.rcParams if k.startswith("keymap.")}))
+
+ def stop_typing(self):
+ if self.capturekeystrokes:
+ self._on_stop_typing()
+ self._on_stop_typing = None
+ notifysubmit = True
+ else:
+ notifysubmit = False
+ self.capturekeystrokes = False
+ self.cursor.set_visible(False)
+ self.ax.figure.canvas.draw()
+ if notifysubmit and self.eventson:
+ # Because process() might throw an error in the user's code, only
+ # call it once we've already done our cleanup.
+ self._observers.process('submit', self.text)
+
+ def position_cursor(self, x):
+ # now, we have to figure out where the cursor goes.
+ # approximate it based on assuming all characters the same length
+ if len(self.text) == 0:
+ self.cursor_index = 0
+ else:
+ bb = self.text_disp.get_window_extent()
+ ratio = np.clip((x - bb.x0) / bb.width, 0, 1)
+ self.cursor_index = int(len(self.text) * ratio)
+ self._rendercursor()
+
+ def _click(self, event):
+ if self.ignore(event):
+ return
+ if event.inaxes != self.ax:
+ self.stop_typing()
+ return
+ if not self.eventson:
+ return
+ if event.canvas.mouse_grabber != self.ax:
+ event.canvas.grab_mouse(self.ax)
+ if not self.capturekeystrokes:
+ self.begin_typing(event.x)
+ self.position_cursor(event.x)
+
+ def _resize(self, event):
+ self.stop_typing()
+
+ def _motion(self, event):
+ if self.ignore(event):
+ return
+ c = self.hovercolor if event.inaxes == self.ax else self.color
+ if not colors.same_color(c, self.ax.get_facecolor()):
+ self.ax.set_facecolor(c)
+ if self.drawon:
+ self.ax.figure.canvas.draw()
+
+ def on_text_change(self, func):
+ """
+ When the text changes, call this *func* with event.
+
+ A connection id is returned which can be used to disconnect.
+ """
+ return self._observers.connect('change', lambda text: func(text))
+
+ def on_submit(self, func):
+ """
+ When the user hits enter or leaves the submission box, call this
+ *func* with event.
+
+ A connection id is returned which can be used to disconnect.
+ """
+ return self._observers.connect('submit', lambda text: func(text))
+
+ def disconnect(self, cid):
+ """Remove the observer with connection id *cid*."""
+ self._observers.disconnect(cid)
+
+
+class RadioButtons(AxesWidget):
+ """
+ A GUI neutral radio button.
+
+ For the buttons to remain responsive you must keep a reference to this
+ object.
+
+ Connect to the RadioButtons with the `.on_clicked` method.
+
+ Attributes
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The parent axes for the widget.
+ activecolor : color
+ The color of the selected button.
+ labels : list of `.Text`
+ The button labels.
+ circles : list of `~.patches.Circle`
+ The buttons.
+ value_selected : str
+ The label text of the currently selected button.
+ """
+
+ def __init__(self, ax, labels, active=0, activecolor='blue'):
+ """
+ Add radio buttons to an `~.axes.Axes`.
+
+ Parameters
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The axes to add the buttons to.
+ labels : list of str
+ The button labels.
+ active : int
+ The index of the initially selected button.
+ activecolor : color
+ The color of the selected button.
+ """
+ super().__init__(ax)
+ self.activecolor = activecolor
+ self.value_selected = None
+
+ ax.set_xticks([])
+ ax.set_yticks([])
+ ax.set_navigate(False)
+ dy = 1. / (len(labels) + 1)
+ ys = np.linspace(1 - dy, dy, len(labels))
+ cnt = 0
+ axcolor = ax.get_facecolor()
+
+ # scale the radius of the circle with the spacing between each one
+ circle_radius = dy / 2 - 0.01
+ # default to hard-coded value if the radius becomes too large
+ circle_radius = min(circle_radius, 0.05)
+
+ self.labels = []
+ self.circles = []
+ for y, label in zip(ys, labels):
+ t = ax.text(0.25, y, label, transform=ax.transAxes,
+ horizontalalignment='left',
+ verticalalignment='center')
+
+ if cnt == active:
+ self.value_selected = label
+ facecolor = activecolor
+ else:
+ facecolor = axcolor
+
+ p = Circle(xy=(0.15, y), radius=circle_radius, edgecolor='black',
+ facecolor=facecolor, transform=ax.transAxes)
+
+ self.labels.append(t)
+ self.circles.append(p)
+ ax.add_patch(p)
+ cnt += 1
+
+ self.connect_event('button_press_event', self._clicked)
+
+ self._observers = cbook.CallbackRegistry()
+
+ cnt = _api.deprecated("3.4")(property( # Not real, but close enough.
+ lambda self: len(self._observers.callbacks['clicked'])))
+ observers = _api.deprecated("3.4")(property(
+ lambda self: self._observers.callbacks['clicked']))
+
+ def _clicked(self, event):
+ if self.ignore(event) or event.button != 1 or event.inaxes != self.ax:
+ return
+ pclicked = self.ax.transAxes.inverted().transform((event.x, event.y))
+ distances = {}
+ for i, (p, t) in enumerate(zip(self.circles, self.labels)):
+ if (t.get_window_extent().contains(event.x, event.y)
+ or np.linalg.norm(pclicked - p.center) < p.radius):
+ distances[i] = np.linalg.norm(pclicked - p.center)
+ if len(distances) > 0:
+ closest = min(distances, key=distances.get)
+ self.set_active(closest)
+
+ def set_active(self, index):
+ """
+ Select button with number *index*.
+
+ Callbacks will be triggered if :attr:`eventson` is True.
+ """
+ if index not in range(len(self.labels)):
+ raise ValueError(f'Invalid RadioButton index: {index}')
+
+ self.value_selected = self.labels[index].get_text()
+
+ for i, p in enumerate(self.circles):
+ if i == index:
+ color = self.activecolor
+ else:
+ color = self.ax.get_facecolor()
+ p.set_facecolor(color)
+
+ if self.drawon:
+ self.ax.figure.canvas.draw()
+
+ if self.eventson:
+ self._observers.process('clicked', self.labels[index].get_text())
+
+ def on_clicked(self, func):
+ """
+ Connect the callback function *func* to button click events.
+
+ Returns a connection id, which can be used to disconnect the callback.
+ """
+ return self._observers.connect('clicked', func)
+
+ def disconnect(self, cid):
+ """Remove the observer with connection id *cid*."""
+ self._observers.disconnect(cid)
+
+
+class SubplotTool(Widget):
+ """
+ A tool to adjust the subplot params of a `matplotlib.figure.Figure`.
+ """
+
+ def __init__(self, targetfig, toolfig):
+ """
+ Parameters
+ ----------
+ targetfig : `.Figure`
+ The figure instance to adjust.
+ toolfig : `.Figure`
+ The figure instance to embed the subplot tool into.
+ """
+
+ self.figure = toolfig
+ self.targetfig = targetfig
+ toolfig.subplots_adjust(left=0.2, right=0.9)
+ toolfig.suptitle("Click on slider to adjust subplot param")
+
+ self._sliders = []
+ names = ["left", "bottom", "right", "top", "wspace", "hspace"]
+ # The last subplot, removed below, keeps space for the "Reset" button.
+ for name, ax in zip(names, toolfig.subplots(len(names) + 1)):
+ ax.set_navigate(False)
+ slider = Slider(ax, name,
+ 0, 1, getattr(targetfig.subplotpars, name))
+ slider.on_changed(self._on_slider_changed)
+ self._sliders.append(slider)
+ toolfig.axes[-1].remove()
+ (self.sliderleft, self.sliderbottom, self.sliderright, self.slidertop,
+ self.sliderwspace, self.sliderhspace) = self._sliders
+ for slider in [self.sliderleft, self.sliderbottom,
+ self.sliderwspace, self.sliderhspace]:
+ slider.closedmax = False
+ for slider in [self.sliderright, self.slidertop]:
+ slider.closedmin = False
+
+ # constraints
+ self.sliderleft.slidermax = self.sliderright
+ self.sliderright.slidermin = self.sliderleft
+ self.sliderbottom.slidermax = self.slidertop
+ self.slidertop.slidermin = self.sliderbottom
+
+ bax = toolfig.add_axes([0.8, 0.05, 0.15, 0.075])
+ self.buttonreset = Button(bax, 'Reset')
+
+ # During reset there can be a temporary invalid state depending on the
+ # order of the reset so we turn off validation for the resetting
+ with cbook._setattr_cm(toolfig.subplotpars, validate=False):
+ self.buttonreset.on_clicked(self._on_reset)
+
+ def _on_slider_changed(self, _):
+ self.targetfig.subplots_adjust(
+ **{slider.label.get_text(): slider.val
+ for slider in self._sliders})
+ if self.drawon:
+ self.targetfig.canvas.draw()
+
+ def _on_reset(self, event):
+ with ExitStack() as stack:
+ # Temporarily disable drawing on self and self's sliders.
+ stack.enter_context(cbook._setattr_cm(self, drawon=False))
+ for slider in self._sliders:
+ stack.enter_context(cbook._setattr_cm(slider, drawon=False))
+ # Reset the slider to the initial position.
+ for slider in self._sliders:
+ slider.reset()
+ # Draw the canvas.
+ if self.drawon:
+ event.canvas.draw()
+ self.targetfig.canvas.draw()
+
+ axleft = _api.deprecated("3.3")(
+ property(lambda self: self.sliderleft.ax))
+ axright = _api.deprecated("3.3")(
+ property(lambda self: self.sliderright.ax))
+ axbottom = _api.deprecated("3.3")(
+ property(lambda self: self.sliderbottom.ax))
+ axtop = _api.deprecated("3.3")(
+ property(lambda self: self.slidertop.ax))
+ axwspace = _api.deprecated("3.3")(
+ property(lambda self: self.sliderwspace.ax))
+ axhspace = _api.deprecated("3.3")(
+ property(lambda self: self.sliderhspace.ax))
+
+ @_api.deprecated("3.3")
+ def funcleft(self, val):
+ self.targetfig.subplots_adjust(left=val)
+ if self.drawon:
+ self.targetfig.canvas.draw()
+
+ @_api.deprecated("3.3")
+ def funcright(self, val):
+ self.targetfig.subplots_adjust(right=val)
+ if self.drawon:
+ self.targetfig.canvas.draw()
+
+ @_api.deprecated("3.3")
+ def funcbottom(self, val):
+ self.targetfig.subplots_adjust(bottom=val)
+ if self.drawon:
+ self.targetfig.canvas.draw()
+
+ @_api.deprecated("3.3")
+ def functop(self, val):
+ self.targetfig.subplots_adjust(top=val)
+ if self.drawon:
+ self.targetfig.canvas.draw()
+
+ @_api.deprecated("3.3")
+ def funcwspace(self, val):
+ self.targetfig.subplots_adjust(wspace=val)
+ if self.drawon:
+ self.targetfig.canvas.draw()
+
+ @_api.deprecated("3.3")
+ def funchspace(self, val):
+ self.targetfig.subplots_adjust(hspace=val)
+ if self.drawon:
+ self.targetfig.canvas.draw()
+
+
+class Cursor(AxesWidget):
+ """
+ A crosshair cursor that spans the axes and moves with mouse cursor.
+
+ For the cursor to remain responsive you must keep a reference to it.
+
+ Parameters
+ ----------
+ ax : `matplotlib.axes.Axes`
+ The `~.axes.Axes` to attach the cursor to.
+ horizOn : bool, default: True
+ Whether to draw the horizontal line.
+ vertOn : bool, default: True
+ Whether to draw the vertical line.
+ useblit : bool, default: False
+ Use blitting for faster drawing if supported by the backend.
+
+ Other Parameters
+ ----------------
+ **lineprops
+ `.Line2D` properties that control the appearance of the lines.
+ See also `~.Axes.axhline`.
+
+ Examples
+ --------
+ See :doc:`/gallery/widgets/cursor`.
+ """
+
+ def __init__(self, ax, horizOn=True, vertOn=True, useblit=False,
+ **lineprops):
+ super().__init__(ax)
+
+ self.connect_event('motion_notify_event', self.onmove)
+ self.connect_event('draw_event', self.clear)
+
+ self.visible = True
+ self.horizOn = horizOn
+ self.vertOn = vertOn
+ self.useblit = useblit and self.canvas.supports_blit
+
+ if self.useblit:
+ lineprops['animated'] = True
+ self.lineh = ax.axhline(ax.get_ybound()[0], visible=False, **lineprops)
+ self.linev = ax.axvline(ax.get_xbound()[0], visible=False, **lineprops)
+
+ self.background = None
+ self.needclear = False
+
+ def clear(self, event):
+ """Internal event handler to clear the cursor."""
+ if self.ignore(event):
+ return
+ if self.useblit:
+ self.background = self.canvas.copy_from_bbox(self.ax.bbox)
+ self.linev.set_visible(False)
+ self.lineh.set_visible(False)
+
+ def onmove(self, event):
+ """Internal event handler to draw the cursor when the mouse moves."""
+ if self.ignore(event):
+ return
+ if not self.canvas.widgetlock.available(self):
+ return
+ if event.inaxes != self.ax:
+ self.linev.set_visible(False)
+ self.lineh.set_visible(False)
+
+ if self.needclear:
+ self.canvas.draw()
+ self.needclear = False
+ return
+ self.needclear = True
+ if not self.visible:
+ return
+ self.linev.set_xdata((event.xdata, event.xdata))
+
+ self.lineh.set_ydata((event.ydata, event.ydata))
+ self.linev.set_visible(self.visible and self.vertOn)
+ self.lineh.set_visible(self.visible and self.horizOn)
+
+ self._update()
+
+ def _update(self):
+ if self.useblit:
+ if self.background is not None:
+ self.canvas.restore_region(self.background)
+ self.ax.draw_artist(self.linev)
+ self.ax.draw_artist(self.lineh)
+ self.canvas.blit(self.ax.bbox)
+ else:
+ self.canvas.draw_idle()
+ return False
+
+
+class MultiCursor(Widget):
+ """
+ Provide a vertical (default) and/or horizontal line cursor shared between
+ multiple axes.
+
+ For the cursor to remain responsive you must keep a reference to it.
+
+ Example usage::
+
+ from matplotlib.widgets import MultiCursor
+ import matplotlib.pyplot as plt
+ import numpy as np
+
+ fig, (ax1, ax2) = plt.subplots(nrows=2, sharex=True)
+ t = np.arange(0.0, 2.0, 0.01)
+ ax1.plot(t, np.sin(2*np.pi*t))
+ ax2.plot(t, np.sin(4*np.pi*t))
+
+ multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1,
+ horizOn=False, vertOn=True)
+ plt.show()
+
+ """
+ def __init__(self, canvas, axes, useblit=True, horizOn=False, vertOn=True,
+ **lineprops):
+
+ self.canvas = canvas
+ self.axes = axes
+ self.horizOn = horizOn
+ self.vertOn = vertOn
+
+ xmin, xmax = axes[-1].get_xlim()
+ ymin, ymax = axes[-1].get_ylim()
+ xmid = 0.5 * (xmin + xmax)
+ ymid = 0.5 * (ymin + ymax)
+
+ self.visible = True
+ self.useblit = useblit and self.canvas.supports_blit
+ self.background = None
+ self.needclear = False
+
+ if self.useblit:
+ lineprops['animated'] = True
+
+ if vertOn:
+ self.vlines = [ax.axvline(xmid, visible=False, **lineprops)
+ for ax in axes]
+ else:
+ self.vlines = []
+
+ if horizOn:
+ self.hlines = [ax.axhline(ymid, visible=False, **lineprops)
+ for ax in axes]
+ else:
+ self.hlines = []
+
+ self.connect()
+
+ def connect(self):
+ """Connect events."""
+ self._cidmotion = self.canvas.mpl_connect('motion_notify_event',
+ self.onmove)
+ self._ciddraw = self.canvas.mpl_connect('draw_event', self.clear)
+
+ def disconnect(self):
+ """Disconnect events."""
+ self.canvas.mpl_disconnect(self._cidmotion)
+ self.canvas.mpl_disconnect(self._ciddraw)
+
+ def clear(self, event):
+ """Clear the cursor."""
+ if self.ignore(event):
+ return
+ if self.useblit:
+ self.background = (
+ self.canvas.copy_from_bbox(self.canvas.figure.bbox))
+ for line in self.vlines + self.hlines:
+ line.set_visible(False)
+
+ def onmove(self, event):
+ if self.ignore(event):
+ return
+ if event.inaxes is None:
+ return
+ if not self.canvas.widgetlock.available(self):
+ return
+ self.needclear = True
+ if not self.visible:
+ return
+ if self.vertOn:
+ for line in self.vlines:
+ line.set_xdata((event.xdata, event.xdata))
+ line.set_visible(self.visible)
+ if self.horizOn:
+ for line in self.hlines:
+ line.set_ydata((event.ydata, event.ydata))
+ line.set_visible(self.visible)
+ self._update()
+
+ def _update(self):
+ if self.useblit:
+ if self.background is not None:
+ self.canvas.restore_region(self.background)
+ if self.vertOn:
+ for ax, line in zip(self.axes, self.vlines):
+ ax.draw_artist(line)
+ if self.horizOn:
+ for ax, line in zip(self.axes, self.hlines):
+ ax.draw_artist(line)
+ self.canvas.blit()
+ else:
+ self.canvas.draw_idle()
+
+
+class _SelectorWidget(AxesWidget):
+
+ def __init__(self, ax, onselect, useblit=False, button=None,
+ state_modifier_keys=None):
+ super().__init__(ax)
+
+ self.visible = True
+ self.onselect = onselect
+ self.useblit = useblit and self.canvas.supports_blit
+ self.connect_default_events()
+
+ self.state_modifier_keys = dict(move=' ', clear='escape',
+ square='shift', center='control')
+ self.state_modifier_keys.update(state_modifier_keys or {})
+
+ self.background = None
+ self.artists = []
+
+ if isinstance(button, Integral):
+ self.validButtons = [button]
+ else:
+ self.validButtons = button
+
+ # will save the data (position at mouseclick)
+ self.eventpress = None
+ # will save the data (pos. at mouserelease)
+ self.eventrelease = None
+ self._prev_event = None
+ self.state = set()
+
+ def set_active(self, active):
+ super().set_active(active)
+ if active:
+ self.update_background(None)
+
+ def update_background(self, event):
+ """Force an update of the background."""
+ # If you add a call to `ignore` here, you'll want to check edge case:
+ # `release` can call a draw event even when `ignore` is True.
+ if not self.useblit:
+ return
+ # Make sure that widget artists don't get accidentally included in the
+ # background, by re-rendering the background if needed (and then
+ # re-re-rendering the canvas with the visible widget artists).
+ needs_redraw = any(artist.get_visible() for artist in self.artists)
+ with ExitStack() as stack:
+ if needs_redraw:
+ for artist in self.artists:
+ stack.callback(artist.set_visible, artist.get_visible())
+ artist.set_visible(False)
+ self.canvas.draw()
+ self.background = self.canvas.copy_from_bbox(self.ax.bbox)
+ if needs_redraw:
+ self.update()
+
+ def connect_default_events(self):
+ """Connect the major canvas events to methods."""
+ self.connect_event('motion_notify_event', self.onmove)
+ self.connect_event('button_press_event', self.press)
+ self.connect_event('button_release_event', self.release)
+ self.connect_event('draw_event', self.update_background)
+ self.connect_event('key_press_event', self.on_key_press)
+ self.connect_event('key_release_event', self.on_key_release)
+ self.connect_event('scroll_event', self.on_scroll)
+
+ def ignore(self, event):
+ # docstring inherited
+ if not self.active or not self.ax.get_visible():
+ return True
+ # If canvas was locked
+ if not self.canvas.widgetlock.available(self):
+ return True
+ if not hasattr(event, 'button'):
+ event.button = None
+ # Only do rectangle selection if event was triggered
+ # with a desired button
+ if (self.validButtons is not None
+ and event.button not in self.validButtons):
+ return True
+ # If no button was pressed yet ignore the event if it was out
+ # of the axes
+ if self.eventpress is None:
+ return event.inaxes != self.ax
+ # If a button was pressed, check if the release-button is the same.
+ if event.button == self.eventpress.button:
+ return False
+ # If a button was pressed, check if the release-button is the same.
+ return (event.inaxes != self.ax or
+ event.button != self.eventpress.button)
+
+ def update(self):
+ """Draw using blit() or draw_idle(), depending on ``self.useblit``."""
+ if not self.ax.get_visible():
+ return False
+ if self.useblit:
+ if self.background is not None:
+ self.canvas.restore_region(self.background)
+ for artist in self.artists:
+ self.ax.draw_artist(artist)
+ self.canvas.blit(self.ax.bbox)
+ else:
+ self.canvas.draw_idle()
+ return False
+
+ def _get_data(self, event):
+ """Get the xdata and ydata for event, with limits."""
+ if event.xdata is None:
+ return None, None
+ xdata = np.clip(event.xdata, *self.ax.get_xbound())
+ ydata = np.clip(event.ydata, *self.ax.get_ybound())
+ return xdata, ydata
+
+ def _clean_event(self, event):
+ """
+ Preprocess an event:
+
+ - Replace *event* by the previous event if *event* has no ``xdata``.
+ - Clip ``xdata`` and ``ydata`` to the axes limits.
+ - Update the previous event.
+ """
+ if event.xdata is None:
+ event = self._prev_event
+ else:
+ event = copy.copy(event)
+ event.xdata, event.ydata = self._get_data(event)
+ self._prev_event = event
+ return event
+
+ def press(self, event):
+ """Button press handler and validator."""
+ if not self.ignore(event):
+ event = self._clean_event(event)
+ self.eventpress = event
+ self._prev_event = event
+ key = event.key or ''
+ key = key.replace('ctrl', 'control')
+ # move state is locked in on a button press
+ if key == self.state_modifier_keys['move']:
+ self.state.add('move')
+ self._press(event)
+ return True
+ return False
+
+ def _press(self, event):
+ """Button press event handler."""
+
+ def release(self, event):
+ """Button release event handler and validator."""
+ if not self.ignore(event) and self.eventpress:
+ event = self._clean_event(event)
+ self.eventrelease = event
+ self._release(event)
+ self.eventpress = None
+ self.eventrelease = None
+ self.state.discard('move')
+ return True
+ return False
+
+ def _release(self, event):
+ """Button release event handler."""
+
+ def onmove(self, event):
+ """Cursor move event handler and validator."""
+ if not self.ignore(event) and self.eventpress:
+ event = self._clean_event(event)
+ self._onmove(event)
+ return True
+ return False
+
+ def _onmove(self, event):
+ """Cursor move event handler."""
+
+ def on_scroll(self, event):
+ """Mouse scroll event handler and validator."""
+ if not self.ignore(event):
+ self._on_scroll(event)
+
+ def _on_scroll(self, event):
+ """Mouse scroll event handler."""
+
+ def on_key_press(self, event):
+ """Key press event handler and validator for all selection widgets."""
+ if self.active:
+ key = event.key or ''
+ key = key.replace('ctrl', 'control')
+ if key == self.state_modifier_keys['clear']:
+ for artist in self.artists:
+ artist.set_visible(False)
+ self.update()
+ return
+ for (state, modifier) in self.state_modifier_keys.items():
+ if modifier in key:
+ self.state.add(state)
+ self._on_key_press(event)
+
+ def _on_key_press(self, event):
+ """Key press event handler - for widget-specific key press actions."""
+
+ def on_key_release(self, event):
+ """Key release event handler and validator."""
+ if self.active:
+ key = event.key or ''
+ for (state, modifier) in self.state_modifier_keys.items():
+ if modifier in key:
+ self.state.discard(state)
+ self._on_key_release(event)
+
+ def _on_key_release(self, event):
+ """Key release event handler."""
+
+ def set_visible(self, visible):
+ """Set the visibility of our artists."""
+ self.visible = visible
+ for artist in self.artists:
+ artist.set_visible(visible)
+
+
+class SpanSelector(_SelectorWidget):
+ """
+ Visually select a min/max range on a single axis and call a function with
+ those values.
+
+ To guarantee that the selector remains responsive, keep a reference to it.
+
+ In order to turn off the SpanSelector, set ``span_selector.active`` to
+ False. To turn it back on, set it to True.
+
+ Parameters
+ ----------
+ ax : `matplotlib.axes.Axes`
+
+ onselect : func(min, max), min/max are floats
+
+ direction : {"horizontal", "vertical"}
+ The direction along which to draw the span selector.
+
+ minspan : float, default: None
+ If selection is less than *minspan*, do not call *onselect*.
+
+ useblit : bool, default: False
+ If True, use the backend-dependent blitting features for faster
+ canvas updates.
+
+ rectprops : dict, default: None
+ Dictionary of `matplotlib.patches.Patch` properties.
+
+ onmove_callback : func(min, max), min/max are floats, default: None
+ Called on mouse move while the span is being selected.
+
+ span_stays : bool, default: False
+ If True, the span stays visible after the mouse is released.
+
+ button : `.MouseButton` or list of `.MouseButton`
+ The mouse buttons which activate the span selector.
+
+ Examples
+ --------
+ >>> import matplotlib.pyplot as plt
+ >>> import matplotlib.widgets as mwidgets
+ >>> fig, ax = plt.subplots()
+ >>> ax.plot([1, 2, 3], [10, 50, 100])
+ >>> def onselect(vmin, vmax):
+ ... print(vmin, vmax)
+ >>> rectprops = dict(facecolor='blue', alpha=0.5)
+ >>> span = mwidgets.SpanSelector(ax, onselect, 'horizontal',
+ ... rectprops=rectprops)
+ >>> fig.show()
+
+ See also: :doc:`/gallery/widgets/span_selector`
+ """
+
+ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
+ rectprops=None, onmove_callback=None, span_stays=False,
+ button=None):
+
+ super().__init__(ax, onselect, useblit=useblit, button=button)
+
+ if rectprops is None:
+ rectprops = dict(facecolor='red', alpha=0.5)
+
+ rectprops['animated'] = self.useblit
+
+ _api.check_in_list(['horizontal', 'vertical'], direction=direction)
+ self.direction = direction
+
+ self.rect = None
+ self.pressv = None
+
+ self.rectprops = rectprops
+ self.onmove_callback = onmove_callback
+ self.minspan = minspan
+ self.span_stays = span_stays
+
+ # Needed when dragging out of axes
+ self.prev = (0, 0)
+
+ # Reset canvas so that `new_axes` connects events.
+ self.canvas = None
+ self.new_axes(ax)
+
+ def new_axes(self, ax):
+ """Set SpanSelector to operate on a new Axes."""
+ self.ax = ax
+ if self.canvas is not ax.figure.canvas:
+ if self.canvas is not None:
+ self.disconnect_events()
+
+ self.canvas = ax.figure.canvas
+ self.connect_default_events()
+
+ if self.direction == 'horizontal':
+ trans = ax.get_xaxis_transform()
+ w, h = 0, 1
+ else:
+ trans = ax.get_yaxis_transform()
+ w, h = 1, 0
+ self.rect = Rectangle((0, 0), w, h,
+ transform=trans,
+ visible=False,
+ **self.rectprops)
+ if self.span_stays:
+ self.stay_rect = Rectangle((0, 0), w, h,
+ transform=trans,
+ visible=False,
+ **self.rectprops)
+ self.stay_rect.set_animated(False)
+ self.ax.add_patch(self.stay_rect)
+
+ self.ax.add_patch(self.rect)
+ self.artists = [self.rect]
+
+ def ignore(self, event):
+ # docstring inherited
+ return super().ignore(event) or not self.visible
+
+ def _press(self, event):
+ """Button press event handler."""
+ self.rect.set_visible(self.visible)
+ if self.span_stays:
+ self.stay_rect.set_visible(False)
+ # really force a draw so that the stay rect is not in
+ # the blit background
+ if self.useblit:
+ self.canvas.draw()
+ xdata, ydata = self._get_data(event)
+ if self.direction == 'horizontal':
+ self.pressv = xdata
+ else:
+ self.pressv = ydata
+
+ self._set_span_xy(event)
+ return False
+
+ def _release(self, event):
+ """Button release event handler."""
+ if self.pressv is None:
+ return
+
+ self.rect.set_visible(False)
+
+ if self.span_stays:
+ self.stay_rect.set_x(self.rect.get_x())
+ self.stay_rect.set_y(self.rect.get_y())
+ self.stay_rect.set_width(self.rect.get_width())
+ self.stay_rect.set_height(self.rect.get_height())
+ self.stay_rect.set_visible(True)
+
+ self.canvas.draw_idle()
+ vmin = self.pressv
+ xdata, ydata = self._get_data(event)
+ if self.direction == 'horizontal':
+ vmax = xdata or self.prev[0]
+ else:
+ vmax = ydata or self.prev[1]
+
+ if vmin > vmax:
+ vmin, vmax = vmax, vmin
+ span = vmax - vmin
+ if self.minspan is not None and span < self.minspan:
+ return
+ self.onselect(vmin, vmax)
+ self.pressv = None
+ return False
+
+ def _onmove(self, event):
+ """Motion notify event handler."""
+ if self.pressv is None:
+ return
+
+ self._set_span_xy(event)
+
+ if self.onmove_callback is not None:
+ vmin = self.pressv
+ xdata, ydata = self._get_data(event)
+ if self.direction == 'horizontal':
+ vmax = xdata or self.prev[0]
+ else:
+ vmax = ydata or self.prev[1]
+
+ if vmin > vmax:
+ vmin, vmax = vmax, vmin
+ self.onmove_callback(vmin, vmax)
+
+ self.update()
+ return False
+
+ def _set_span_xy(self, event):
+ """Set the span coordinates."""
+ x, y = self._get_data(event)
+ if x is None:
+ return
+
+ self.prev = x, y
+ if self.direction == 'horizontal':
+ v = x
+ else:
+ v = y
+
+ minv, maxv = v, self.pressv
+ if minv > maxv:
+ minv, maxv = maxv, minv
+ if self.direction == 'horizontal':
+ self.rect.set_x(minv)
+ self.rect.set_width(maxv - minv)
+ else:
+ self.rect.set_y(minv)
+ self.rect.set_height(maxv - minv)
+
+
+class ToolHandles:
+ """
+ Control handles for canvas tools.
+
+ Parameters
+ ----------
+ ax : `matplotlib.axes.Axes`
+ Matplotlib axes where tool handles are displayed.
+ x, y : 1D arrays
+ Coordinates of control handles.
+ marker : str
+ Shape of marker used to display handle. See `matplotlib.pyplot.plot`.
+ marker_props : dict
+ Additional marker properties. See `matplotlib.lines.Line2D`.
+ """
+
+ def __init__(self, ax, x, y, marker='o', marker_props=None, useblit=True):
+ self.ax = ax
+ props = {'marker': marker, 'markersize': 7, 'markerfacecolor': 'w',
+ 'linestyle': 'none', 'alpha': 0.5, 'visible': False,
+ 'label': '_nolegend_',
+ **cbook.normalize_kwargs(marker_props, Line2D._alias_map)}
+ self._markers = Line2D(x, y, animated=useblit, **props)
+ self.ax.add_line(self._markers)
+ self.artist = self._markers
+
+ @property
+ def x(self):
+ return self._markers.get_xdata()
+
+ @property
+ def y(self):
+ return self._markers.get_ydata()
+
+ def set_data(self, pts, y=None):
+ """Set x and y positions of handles."""
+ if y is not None:
+ x = pts
+ pts = np.array([x, y])
+ self._markers.set_data(pts)
+
+ def set_visible(self, val):
+ self._markers.set_visible(val)
+
+ def set_animated(self, val):
+ self._markers.set_animated(val)
+
+ def closest(self, x, y):
+ """Return index and pixel distance to closest index."""
+ pts = np.column_stack([self.x, self.y])
+ # Transform data coordinates to pixel coordinates.
+ pts = self.ax.transData.transform(pts)
+ diff = pts - [x, y]
+ dist = np.hypot(*diff.T)
+ min_index = np.argmin(dist)
+ return min_index, dist[min_index]
+
+
+class RectangleSelector(_SelectorWidget):
+ """
+ Select a rectangular region of an axes.
+
+ For the cursor to remain responsive you must keep a reference to it.
+
+ Examples
+ --------
+ :doc:`/gallery/widgets/rectangle_selector`
+ """
+
+ _shape_klass = Rectangle
+
+ def __init__(self, ax, onselect, drawtype='box',
+ minspanx=0, minspany=0, useblit=False,
+ lineprops=None, rectprops=None, spancoords='data',
+ button=None, maxdist=10, marker_props=None,
+ interactive=False, state_modifier_keys=None):
+ r"""
+ Parameters
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The parent axes for the widget.
+
+ onselect : function
+ A callback function that is called after a selection is completed.
+ It must have the signature::
+
+ def onselect(eclick: MouseEvent, erelease: MouseEvent)
+
+ where *eclick* and *erelease* are the mouse click and release
+ `.MouseEvent`\s that start and complete the selection.
+
+ drawtype : {"box", "line", "none"}, default: "box"
+ Whether to draw the full rectangle box, the diagonal line of the
+ rectangle, or nothing at all.
+
+ minspanx : float, default: 0
+ Selections with an x-span less than *minspanx* are ignored.
+
+ minspany : float, default: 0
+ Selections with an y-span less than *minspany* are ignored.
+
+ useblit : bool, default: False
+ Whether to use blitting for faster drawing (if supported by the
+ backend).
+
+ lineprops : dict, optional
+ Properties with which the line is drawn, if ``drawtype == "line"``.
+ Default::
+
+ dict(color="black", linestyle="-", linewidth=2, alpha=0.5)
+
+ rectprops : dict, optional
+ Properties with which the rectangle is drawn, if ``drawtype ==
+ "box"``. Default::
+
+ dict(facecolor="red", edgecolor="black", alpha=0.2, fill=True)
+
+ spancoords : {"data", "pixels"}, default: "data"
+ Whether to interpret *minspanx* and *minspany* in data or in pixel
+ coordinates.
+
+ button : `.MouseButton`, list of `.MouseButton`, default: all buttons
+ Button(s) that trigger rectangle selection.
+
+ maxdist : float, default: 10
+ Distance in pixels within which the interactive tool handles can be
+ activated.
+
+ marker_props : dict
+ Properties with which the interactive handles are drawn. Currently
+ not implemented and ignored.
+
+ interactive : bool, default: False
+ Whether to draw a set of handles that allow interaction with the
+ widget after it is drawn.
+
+ state_modifier_keys : dict, optional
+ Keyboard modifiers which affect the widget's behavior. Values
+ amend the defaults.
+
+ - "move": Move the existing shape, default: no modifier.
+ - "clear": Clear the current shape, default: "escape".
+ - "square": Makes the shape square, default: "shift".
+ - "center": Make the initial point the center of the shape,
+ default: "ctrl".
+
+ "square" and "center" can be combined.
+ """
+ super().__init__(ax, onselect, useblit=useblit, button=button,
+ state_modifier_keys=state_modifier_keys)
+
+ self.to_draw = None
+ self.visible = True
+ self.interactive = interactive
+
+ if drawtype == 'none': # draw a line but make it invisible
+ drawtype = 'line'
+ self.visible = False
+
+ if drawtype == 'box':
+ if rectprops is None:
+ rectprops = dict(facecolor='red', edgecolor='black',
+ alpha=0.2, fill=True)
+ rectprops['animated'] = self.useblit
+ self.rectprops = rectprops
+ self.to_draw = self._shape_klass((0, 0), 0, 1, visible=False,
+ **self.rectprops)
+ self.ax.add_patch(self.to_draw)
+ if drawtype == 'line':
+ if lineprops is None:
+ lineprops = dict(color='black', linestyle='-',
+ linewidth=2, alpha=0.5)
+ lineprops['animated'] = self.useblit
+ self.lineprops = lineprops
+ self.to_draw = Line2D([0, 0], [0, 0], visible=False,
+ **self.lineprops)
+ self.ax.add_line(self.to_draw)
+
+ self.minspanx = minspanx
+ self.minspany = minspany
+
+ _api.check_in_list(['data', 'pixels'], spancoords=spancoords)
+ self.spancoords = spancoords
+ self.drawtype = drawtype
+
+ self.maxdist = maxdist
+
+ if rectprops is None:
+ props = dict(markeredgecolor='r')
+ else:
+ props = dict(markeredgecolor=rectprops.get('edgecolor', 'r'))
+ props.update(cbook.normalize_kwargs(marker_props, Line2D._alias_map))
+ self._corner_order = ['NW', 'NE', 'SE', 'SW']
+ xc, yc = self.corners
+ self._corner_handles = ToolHandles(self.ax, xc, yc, marker_props=props,
+ useblit=self.useblit)
+
+ self._edge_order = ['W', 'N', 'E', 'S']
+ xe, ye = self.edge_centers
+ self._edge_handles = ToolHandles(self.ax, xe, ye, marker='s',
+ marker_props=props,
+ useblit=self.useblit)
+
+ xc, yc = self.center
+ self._center_handle = ToolHandles(self.ax, [xc], [yc], marker='s',
+ marker_props=props,
+ useblit=self.useblit)
+
+ self.active_handle = None
+
+ self.artists = [self.to_draw, self._center_handle.artist,
+ self._corner_handles.artist,
+ self._edge_handles.artist]
+
+ if not self.interactive:
+ self.artists = [self.to_draw]
+
+ self._extents_on_press = None
+
+ def _press(self, event):
+ """Button press event handler."""
+ # make the drawn box/line visible get the click-coordinates,
+ # button, ...
+ if self.interactive and self.to_draw.get_visible():
+ self._set_active_handle(event)
+ else:
+ self.active_handle = None
+
+ if self.active_handle is None or not self.interactive:
+ # Clear previous rectangle before drawing new rectangle.
+ self.update()
+
+ if not self.interactive:
+ x = event.xdata
+ y = event.ydata
+ self.extents = x, x, y, y
+
+ self.set_visible(self.visible)
+
+ def _release(self, event):
+ """Button release event handler."""
+ if not self.interactive:
+ self.to_draw.set_visible(False)
+
+ # update the eventpress and eventrelease with the resulting extents
+ x1, x2, y1, y2 = self.extents
+ self.eventpress.xdata = x1
+ self.eventpress.ydata = y1
+ xy1 = self.ax.transData.transform([x1, y1])
+ self.eventpress.x, self.eventpress.y = xy1
+
+ self.eventrelease.xdata = x2
+ self.eventrelease.ydata = y2
+ xy2 = self.ax.transData.transform([x2, y2])
+ self.eventrelease.x, self.eventrelease.y = xy2
+
+ # calculate dimensions of box or line
+ if self.spancoords == 'data':
+ spanx = abs(self.eventpress.xdata - self.eventrelease.xdata)
+ spany = abs(self.eventpress.ydata - self.eventrelease.ydata)
+ elif self.spancoords == 'pixels':
+ spanx = abs(self.eventpress.x - self.eventrelease.x)
+ spany = abs(self.eventpress.y - self.eventrelease.y)
+ else:
+ _api.check_in_list(['data', 'pixels'],
+ spancoords=self.spancoords)
+ # check if drawn distance (if it exists) is not too small in
+ # either x or y-direction
+ if (self.drawtype != 'none'
+ and (self.minspanx is not None and spanx < self.minspanx
+ or self.minspany is not None and spany < self.minspany)):
+ for artist in self.artists:
+ artist.set_visible(False)
+ self.update()
+ return
+
+ # call desired function
+ self.onselect(self.eventpress, self.eventrelease)
+ self.update()
+
+ return False
+
+ def _onmove(self, event):
+ """Motion notify event handler."""
+ # resize an existing shape
+ if self.active_handle and self.active_handle != 'C':
+ x1, x2, y1, y2 = self._extents_on_press
+ if self.active_handle in ['E', 'W'] + self._corner_order:
+ x2 = event.xdata
+ if self.active_handle in ['N', 'S'] + self._corner_order:
+ y2 = event.ydata
+
+ # move existing shape
+ elif (('move' in self.state or self.active_handle == 'C')
+ and self._extents_on_press is not None):
+ x1, x2, y1, y2 = self._extents_on_press
+ dx = event.xdata - self.eventpress.xdata
+ dy = event.ydata - self.eventpress.ydata
+ x1 += dx
+ x2 += dx
+ y1 += dy
+ y2 += dy
+
+ # new shape
+ else:
+ center = [self.eventpress.xdata, self.eventpress.ydata]
+ center_pix = [self.eventpress.x, self.eventpress.y]
+ dx = (event.xdata - center[0]) / 2.
+ dy = (event.ydata - center[1]) / 2.
+
+ # square shape
+ if 'square' in self.state:
+ dx_pix = abs(event.x - center_pix[0])
+ dy_pix = abs(event.y - center_pix[1])
+ if not dx_pix:
+ return
+ maxd = max(abs(dx_pix), abs(dy_pix))
+ if abs(dx_pix) < maxd:
+ dx *= maxd / (abs(dx_pix) + 1e-6)
+ if abs(dy_pix) < maxd:
+ dy *= maxd / (abs(dy_pix) + 1e-6)
+
+ # from center
+ if 'center' in self.state:
+ dx *= 2
+ dy *= 2
+
+ # from corner
+ else:
+ center[0] += dx
+ center[1] += dy
+
+ x1, x2, y1, y2 = (center[0] - dx, center[0] + dx,
+ center[1] - dy, center[1] + dy)
+
+ self.extents = x1, x2, y1, y2
+
+ @property
+ def _rect_bbox(self):
+ if self.drawtype == 'box':
+ x0 = self.to_draw.get_x()
+ y0 = self.to_draw.get_y()
+ width = self.to_draw.get_width()
+ height = self.to_draw.get_height()
+ return x0, y0, width, height
+ else:
+ x, y = self.to_draw.get_data()
+ x0, x1 = min(x), max(x)
+ y0, y1 = min(y), max(y)
+ return x0, y0, x1 - x0, y1 - y0
+
+ @property
+ def corners(self):
+ """Corners of rectangle from lower left, moving clockwise."""
+ x0, y0, width, height = self._rect_bbox
+ xc = x0, x0 + width, x0 + width, x0
+ yc = y0, y0, y0 + height, y0 + height
+ return xc, yc
+
+ @property
+ def edge_centers(self):
+ """Midpoint of rectangle edges from left, moving anti-clockwise."""
+ x0, y0, width, height = self._rect_bbox
+ w = width / 2.
+ h = height / 2.
+ xe = x0, x0 + w, x0 + width, x0 + w
+ ye = y0 + h, y0, y0 + h, y0 + height
+ return xe, ye
+
+ @property
+ def center(self):
+ """Center of rectangle."""
+ x0, y0, width, height = self._rect_bbox
+ return x0 + width / 2., y0 + height / 2.
+
+ @property
+ def extents(self):
+ """Return (xmin, xmax, ymin, ymax)."""
+ x0, y0, width, height = self._rect_bbox
+ xmin, xmax = sorted([x0, x0 + width])
+ ymin, ymax = sorted([y0, y0 + height])
+ return xmin, xmax, ymin, ymax
+
+ @extents.setter
+ def extents(self, extents):
+ # Update displayed shape
+ self.draw_shape(extents)
+ # Update displayed handles
+ self._corner_handles.set_data(*self.corners)
+ self._edge_handles.set_data(*self.edge_centers)
+ self._center_handle.set_data(*self.center)
+ self.set_visible(self.visible)
+ self.update()
+
+ def draw_shape(self, extents):
+ x0, x1, y0, y1 = extents
+ xmin, xmax = sorted([x0, x1])
+ ymin, ymax = sorted([y0, y1])
+ xlim = sorted(self.ax.get_xlim())
+ ylim = sorted(self.ax.get_ylim())
+
+ xmin = max(xlim[0], xmin)
+ ymin = max(ylim[0], ymin)
+ xmax = min(xmax, xlim[1])
+ ymax = min(ymax, ylim[1])
+
+ if self.drawtype == 'box':
+ self.to_draw.set_x(xmin)
+ self.to_draw.set_y(ymin)
+ self.to_draw.set_width(xmax - xmin)
+ self.to_draw.set_height(ymax - ymin)
+
+ elif self.drawtype == 'line':
+ self.to_draw.set_data([xmin, xmax], [ymin, ymax])
+
+ def _set_active_handle(self, event):
+ """Set active handle based on the location of the mouse event."""
+ # Note: event.xdata/ydata in data coordinates, event.x/y in pixels
+ c_idx, c_dist = self._corner_handles.closest(event.x, event.y)
+ e_idx, e_dist = self._edge_handles.closest(event.x, event.y)
+ m_idx, m_dist = self._center_handle.closest(event.x, event.y)
+
+ if 'move' in self.state:
+ self.active_handle = 'C'
+ self._extents_on_press = self.extents
+
+ # Set active handle as closest handle, if mouse click is close enough.
+ elif m_dist < self.maxdist * 2:
+ self.active_handle = 'C'
+ elif c_dist > self.maxdist and e_dist > self.maxdist:
+ self.active_handle = None
+ return
+ elif c_dist < e_dist:
+ self.active_handle = self._corner_order[c_idx]
+ else:
+ self.active_handle = self._edge_order[e_idx]
+
+ # Save coordinates of rectangle at the start of handle movement.
+ x1, x2, y1, y2 = self.extents
+ # Switch variables so that only x2 and/or y2 are updated on move.
+ if self.active_handle in ['W', 'SW', 'NW']:
+ x1, x2 = x2, event.xdata
+ if self.active_handle in ['N', 'NW', 'NE']:
+ y1, y2 = y2, event.ydata
+ self._extents_on_press = x1, x2, y1, y2
+
+ @property
+ def geometry(self):
+ """
+ Return an array of shape (2, 5) containing the
+ x (``RectangleSelector.geometry[1, :]``) and
+ y (``RectangleSelector.geometry[0, :]``) coordinates
+ of the four corners of the rectangle starting and ending
+ in the top left corner.
+ """
+ if hasattr(self.to_draw, 'get_verts'):
+ xfm = self.ax.transData.inverted()
+ y, x = xfm.transform(self.to_draw.get_verts()).T
+ return np.array([x, y])
+ else:
+ return np.array(self.to_draw.get_data())
+
+
+class EllipseSelector(RectangleSelector):
+ """
+ Select an elliptical region of an axes.
+
+ For the cursor to remain responsive you must keep a reference to it.
+
+ Example usage::
+
+ import numpy as np
+ import matplotlib.pyplot as plt
+ from matplotlib.widgets import EllipseSelector
+
+ def onselect(eclick, erelease):
+ "eclick and erelease are matplotlib events at press and release."
+ print('startposition: (%f, %f)' % (eclick.xdata, eclick.ydata))
+ print('endposition : (%f, %f)' % (erelease.xdata, erelease.ydata))
+ print('used button : ', eclick.button)
+
+ def toggle_selector(event):
+ print(' Key pressed.')
+ if event.key in ['Q', 'q'] and toggle_selector.ES.active:
+ print('EllipseSelector deactivated.')
+ toggle_selector.RS.set_active(False)
+ if event.key in ['A', 'a'] and not toggle_selector.ES.active:
+ print('EllipseSelector activated.')
+ toggle_selector.ES.set_active(True)
+
+ x = np.arange(100.) / 99
+ y = np.sin(x)
+ fig, ax = plt.subplots()
+ ax.plot(x, y)
+
+ toggle_selector.ES = EllipseSelector(ax, onselect, drawtype='line')
+ fig.canvas.mpl_connect('key_press_event', toggle_selector)
+ plt.show()
+ """
+ _shape_klass = Ellipse
+
+ def draw_shape(self, extents):
+ x1, x2, y1, y2 = extents
+ xmin, xmax = sorted([x1, x2])
+ ymin, ymax = sorted([y1, y2])
+ center = [x1 + (x2 - x1) / 2., y1 + (y2 - y1) / 2.]
+ a = (xmax - xmin) / 2.
+ b = (ymax - ymin) / 2.
+
+ if self.drawtype == 'box':
+ self.to_draw.center = center
+ self.to_draw.width = 2 * a
+ self.to_draw.height = 2 * b
+ else:
+ rad = np.deg2rad(np.arange(31) * 12)
+ x = a * np.cos(rad) + center[0]
+ y = b * np.sin(rad) + center[1]
+ self.to_draw.set_data(x, y)
+
+ @property
+ def _rect_bbox(self):
+ if self.drawtype == 'box':
+ x, y = self.to_draw.center
+ width = self.to_draw.width
+ height = self.to_draw.height
+ return x - width / 2., y - height / 2., width, height
+ else:
+ x, y = self.to_draw.get_data()
+ x0, x1 = min(x), max(x)
+ y0, y1 = min(y), max(y)
+ return x0, y0, x1 - x0, y1 - y0
+
+
+class LassoSelector(_SelectorWidget):
+ """
+ Selection curve of an arbitrary shape.
+
+ For the selector to remain responsive you must keep a reference to it.
+
+ The selected path can be used in conjunction with `~.Path.contains_point`
+ to select data points from an image.
+
+ In contrast to `Lasso`, `LassoSelector` is written with an interface
+ similar to `RectangleSelector` and `SpanSelector`, and will continue to
+ interact with the axes until disconnected.
+
+ Example usage::
+
+ ax = plt.subplot()
+ ax.plot(x, y)
+
+ def onselect(verts):
+ print(verts)
+ lasso = LassoSelector(ax, onselect)
+
+ Parameters
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The parent axes for the widget.
+ onselect : function
+ Whenever the lasso is released, the *onselect* function is called and
+ passed the vertices of the selected path.
+ button : `.MouseButton` or list of `.MouseButton`, optional
+ The mouse buttons used for rectangle selection. Default is ``None``,
+ which corresponds to all buttons.
+ """
+
+ def __init__(self, ax, onselect=None, useblit=True, lineprops=None,
+ button=None):
+ super().__init__(ax, onselect, useblit=useblit, button=button)
+ self.verts = None
+ if lineprops is None:
+ lineprops = dict()
+ # self.useblit may be != useblit, if the canvas doesn't support blit.
+ lineprops.update(animated=self.useblit, visible=False)
+ self.line = Line2D([], [], **lineprops)
+ self.ax.add_line(self.line)
+ self.artists = [self.line]
+
+ def onpress(self, event):
+ self.press(event)
+
+ def _press(self, event):
+ self.verts = [self._get_data(event)]
+ self.line.set_visible(True)
+
+ def onrelease(self, event):
+ self.release(event)
+
+ def _release(self, event):
+ if self.verts is not None:
+ self.verts.append(self._get_data(event))
+ self.onselect(self.verts)
+ self.line.set_data([[], []])
+ self.line.set_visible(False)
+ self.verts = None
+
+ def _onmove(self, event):
+ if self.verts is None:
+ return
+ self.verts.append(self._get_data(event))
+
+ self.line.set_data(list(zip(*self.verts)))
+
+ self.update()
+
+
+class PolygonSelector(_SelectorWidget):
+ """
+ Select a polygon region of an axes.
+
+ Place vertices with each mouse click, and make the selection by completing
+ the polygon (clicking on the first vertex). Hold the *ctrl* key and click
+ and drag a vertex to reposition it (the *ctrl* key is not necessary if the
+ polygon has already been completed). Hold the *shift* key and click and
+ drag anywhere in the axes to move all vertices. Press the *esc* key to
+ start a new polygon.
+
+ For the selector to remain responsive you must keep a reference to it.
+
+ Parameters
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The parent axes for the widget.
+ onselect : function
+ When a polygon is completed or modified after completion,
+ the *onselect* function is called and passed a list of the vertices as
+ ``(xdata, ydata)`` tuples.
+ useblit : bool, default: False
+ lineprops : dict, default: \
+``dict(color='k', linestyle='-', linewidth=2, alpha=0.5)``.
+ Artist properties for the line representing the edges of the polygon.
+ markerprops : dict, default: \
+``dict(marker='o', markersize=7, mec='k', mfc='k', alpha=0.5)``.
+ Artist properties for the markers drawn at the vertices of the polygon.
+ vertex_select_radius : float, default: 15px
+ A vertex is selected (to complete the polygon or to move a vertex) if
+ the mouse click is within *vertex_select_radius* pixels of the vertex.
+
+ Examples
+ --------
+ :doc:`/gallery/widgets/polygon_selector_demo`
+ """
+
+ def __init__(self, ax, onselect, useblit=False,
+ lineprops=None, markerprops=None, vertex_select_radius=15):
+ # The state modifiers 'move', 'square', and 'center' are expected by
+ # _SelectorWidget but are not supported by PolygonSelector
+ # Note: could not use the existing 'move' state modifier in-place of
+ # 'move_all' because _SelectorWidget automatically discards 'move'
+ # from the state on button release.
+ state_modifier_keys = dict(clear='escape', move_vertex='control',
+ move_all='shift', move='not-applicable',
+ square='not-applicable',
+ center='not-applicable')
+ super().__init__(ax, onselect, useblit=useblit,
+ state_modifier_keys=state_modifier_keys)
+
+ self._xs, self._ys = [0], [0]
+ self._polygon_completed = False
+
+ if lineprops is None:
+ lineprops = dict(color='k', linestyle='-', linewidth=2, alpha=0.5)
+ lineprops['animated'] = self.useblit
+ self.line = Line2D(self._xs, self._ys, **lineprops)
+ self.ax.add_line(self.line)
+
+ if markerprops is None:
+ markerprops = dict(markeredgecolor='k',
+ markerfacecolor=lineprops.get('color', 'k'))
+ self._polygon_handles = ToolHandles(self.ax, self._xs, self._ys,
+ useblit=self.useblit,
+ marker_props=markerprops)
+
+ self._active_handle_idx = -1
+ self.vertex_select_radius = vertex_select_radius
+
+ self.artists = [self.line, self._polygon_handles.artist]
+ self.set_visible(True)
+
+ def _press(self, event):
+ """Button press event handler."""
+ # Check for selection of a tool handle.
+ if ((self._polygon_completed or 'move_vertex' in self.state)
+ and len(self._xs) > 0):
+ h_idx, h_dist = self._polygon_handles.closest(event.x, event.y)
+ if h_dist < self.vertex_select_radius:
+ self._active_handle_idx = h_idx
+ # Save the vertex positions at the time of the press event (needed to
+ # support the 'move_all' state modifier).
+ self._xs_at_press, self._ys_at_press = self._xs.copy(), self._ys.copy()
+
+ def _release(self, event):
+ """Button release event handler."""
+ # Release active tool handle.
+ if self._active_handle_idx >= 0:
+ self._active_handle_idx = -1
+
+ # Complete the polygon.
+ elif (len(self._xs) > 3
+ and self._xs[-1] == self._xs[0]
+ and self._ys[-1] == self._ys[0]):
+ self._polygon_completed = True
+
+ # Place new vertex.
+ elif (not self._polygon_completed
+ and 'move_all' not in self.state
+ and 'move_vertex' not in self.state):
+ self._xs.insert(-1, event.xdata)
+ self._ys.insert(-1, event.ydata)
+
+ if self._polygon_completed:
+ self.onselect(self.verts)
+
+ def onmove(self, event):
+ """Cursor move event handler and validator."""
+ # Method overrides _SelectorWidget.onmove because the polygon selector
+ # needs to process the move callback even if there is no button press.
+ # _SelectorWidget.onmove include logic to ignore move event if
+ # eventpress is None.
+ if not self.ignore(event):
+ event = self._clean_event(event)
+ self._onmove(event)
+ return True
+ return False
+
+ def _onmove(self, event):
+ """Cursor move event handler."""
+ # Move the active vertex (ToolHandle).
+ if self._active_handle_idx >= 0:
+ idx = self._active_handle_idx
+ self._xs[idx], self._ys[idx] = event.xdata, event.ydata
+ # Also update the end of the polygon line if the first vertex is
+ # the active handle and the polygon is completed.
+ if idx == 0 and self._polygon_completed:
+ self._xs[-1], self._ys[-1] = event.xdata, event.ydata
+
+ # Move all vertices.
+ elif 'move_all' in self.state and self.eventpress:
+ dx = event.xdata - self.eventpress.xdata
+ dy = event.ydata - self.eventpress.ydata
+ for k in range(len(self._xs)):
+ self._xs[k] = self._xs_at_press[k] + dx
+ self._ys[k] = self._ys_at_press[k] + dy
+
+ # Do nothing if completed or waiting for a move.
+ elif (self._polygon_completed
+ or 'move_vertex' in self.state or 'move_all' in self.state):
+ return
+
+ # Position pending vertex.
+ else:
+ # Calculate distance to the start vertex.
+ x0, y0 = self.line.get_transform().transform((self._xs[0],
+ self._ys[0]))
+ v0_dist = np.hypot(x0 - event.x, y0 - event.y)
+ # Lock on to the start vertex if near it and ready to complete.
+ if len(self._xs) > 3 and v0_dist < self.vertex_select_radius:
+ self._xs[-1], self._ys[-1] = self._xs[0], self._ys[0]
+ else:
+ self._xs[-1], self._ys[-1] = event.xdata, event.ydata
+
+ self._draw_polygon()
+
+ def _on_key_press(self, event):
+ """Key press event handler."""
+ # Remove the pending vertex if entering the 'move_vertex' or
+ # 'move_all' mode
+ if (not self._polygon_completed
+ and ('move_vertex' in self.state or 'move_all' in self.state)):
+ self._xs, self._ys = self._xs[:-1], self._ys[:-1]
+ self._draw_polygon()
+
+ def _on_key_release(self, event):
+ """Key release event handler."""
+ # Add back the pending vertex if leaving the 'move_vertex' or
+ # 'move_all' mode (by checking the released key)
+ if (not self._polygon_completed
+ and
+ (event.key == self.state_modifier_keys.get('move_vertex')
+ or event.key == self.state_modifier_keys.get('move_all'))):
+ self._xs.append(event.xdata)
+ self._ys.append(event.ydata)
+ self._draw_polygon()
+ # Reset the polygon if the released key is the 'clear' key.
+ elif event.key == self.state_modifier_keys.get('clear'):
+ event = self._clean_event(event)
+ self._xs, self._ys = [event.xdata], [event.ydata]
+ self._polygon_completed = False
+ self.set_visible(True)
+
+ def _draw_polygon(self):
+ """Redraw the polygon based on the new vertex positions."""
+ self.line.set_data(self._xs, self._ys)
+ # Only show one tool handle at the start and end vertex of the polygon
+ # if the polygon is completed or the user is locked on to the start
+ # vertex.
+ if (self._polygon_completed
+ or (len(self._xs) > 3
+ and self._xs[-1] == self._xs[0]
+ and self._ys[-1] == self._ys[0])):
+ self._polygon_handles.set_data(self._xs[:-1], self._ys[:-1])
+ else:
+ self._polygon_handles.set_data(self._xs, self._ys)
+ self.update()
+
+ @property
+ def verts(self):
+ """The polygon vertices, as a list of ``(x, y)`` pairs."""
+ return list(zip(self._xs[:-1], self._ys[:-1]))
+
+
+class Lasso(AxesWidget):
+ """
+ Selection curve of an arbitrary shape.
+
+ The selected path can be used in conjunction with
+ `~matplotlib.path.Path.contains_point` to select data points from an image.
+
+ Unlike `LassoSelector`, this must be initialized with a starting
+ point *xy*, and the `Lasso` events are destroyed upon release.
+
+ Parameters
+ ----------
+ ax : `~matplotlib.axes.Axes`
+ The parent axes for the widget.
+ xy : (float, float)
+ Coordinates of the start of the lasso.
+ callback : callable
+ Whenever the lasso is released, the *callback* function is called and
+ passed the vertices of the selected path.
+ """
+
+ def __init__(self, ax, xy, callback=None, useblit=True):
+ super().__init__(ax)
+
+ self.useblit = useblit and self.canvas.supports_blit
+ if self.useblit:
+ self.background = self.canvas.copy_from_bbox(self.ax.bbox)
+
+ x, y = xy
+ self.verts = [(x, y)]
+ self.line = Line2D([x], [y], linestyle='-', color='black', lw=2)
+ self.ax.add_line(self.line)
+ self.callback = callback
+ self.connect_event('button_release_event', self.onrelease)
+ self.connect_event('motion_notify_event', self.onmove)
+
+ def onrelease(self, event):
+ if self.ignore(event):
+ return
+ if self.verts is not None:
+ self.verts.append((event.xdata, event.ydata))
+ if len(self.verts) > 2:
+ self.callback(self.verts)
+ self.ax.lines.remove(self.line)
+ self.verts = None
+ self.disconnect_events()
+
+ def onmove(self, event):
+ if self.ignore(event):
+ return
+ if self.verts is None:
+ return
+ if event.inaxes != self.ax:
+ return
+ if event.button != 1:
+ return
+ self.verts.append((event.xdata, event.ydata))
+
+ self.line.set_data(list(zip(*self.verts)))
+
+ if self.useblit:
+ self.canvas.restore_region(self.background)
+ self.ax.draw_artist(self.line)
+ self.canvas.blit(self.ax.bbox)
+ else:
+ self.canvas.draw_idle()
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/__init__.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/__init__.py
new file mode 100644
index 0000000..9e76d10
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/__init__.py
@@ -0,0 +1,11 @@
+from . import axes_size as Size
+from .axes_divider import Divider, SubplotDivider, make_axes_locatable
+from .axes_grid import Grid, ImageGrid, AxesGrid
+#from axes_divider import make_axes_locatable
+from matplotlib import _api
+_api.warn_deprecated(since='2.1',
+ name='mpl_toolkits.axes_grid',
+ alternative='mpl_toolkits.axes_grid1 and'
+ ' mpl_toolkits.axisartist, which provide'
+ ' the same functionality',
+ obj_type='module')
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/anchored_artists.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/anchored_artists.py
new file mode 100644
index 0000000..f486805
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/anchored_artists.py
@@ -0,0 +1,6 @@
+from matplotlib.offsetbox import AnchoredOffsetbox, AuxTransformBox, VPacker,\
+ TextArea, AnchoredText, DrawingArea, AnnotationBbox
+
+from mpl_toolkits.axes_grid1.anchored_artists import \
+ AnchoredDrawingArea, AnchoredAuxTransformBox, \
+ AnchoredEllipse, AnchoredSizeBar
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/angle_helper.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/angle_helper.py
new file mode 100644
index 0000000..fa14e7f
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/angle_helper.py
@@ -0,0 +1 @@
+from mpl_toolkits.axisartist.angle_helper import *
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/axes_divider.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axes_divider.py
new file mode 100644
index 0000000..33b4e51
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axes_divider.py
@@ -0,0 +1,3 @@
+from mpl_toolkits.axes_grid1.axes_divider import (
+ AxesDivider, AxesLocator, Divider, SubplotDivider, make_axes_locatable)
+from mpl_toolkits.axisartist.axislines import Axes
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/axes_grid.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axes_grid.py
new file mode 100644
index 0000000..893b780
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axes_grid.py
@@ -0,0 +1,2 @@
+from mpl_toolkits.axisartist.axes_grid import (
+ AxesGrid, CbarAxes, Grid, ImageGrid)
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/axes_rgb.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axes_rgb.py
new file mode 100644
index 0000000..30f7e42
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axes_rgb.py
@@ -0,0 +1 @@
+from mpl_toolkits.axisartist.axes_rgb import *
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/axes_size.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axes_size.py
new file mode 100644
index 0000000..742f7fe
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axes_size.py
@@ -0,0 +1 @@
+from mpl_toolkits.axes_grid1.axes_size import *
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/axis_artist.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axis_artist.py
new file mode 100644
index 0000000..11180b1
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axis_artist.py
@@ -0,0 +1 @@
+from mpl_toolkits.axisartist.axis_artist import *
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/axisline_style.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axisline_style.py
new file mode 100644
index 0000000..0c846e2
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axisline_style.py
@@ -0,0 +1 @@
+from mpl_toolkits.axisartist.axisline_style import *
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/axislines.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axislines.py
new file mode 100644
index 0000000..a8ceb9c
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/axislines.py
@@ -0,0 +1 @@
+from mpl_toolkits.axisartist.axislines import *
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/clip_path.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/clip_path.py
new file mode 100644
index 0000000..5b92d9a
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/clip_path.py
@@ -0,0 +1 @@
+from mpl_toolkits.axisartist.clip_path import *
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/floating_axes.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/floating_axes.py
new file mode 100644
index 0000000..de8ebb7
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/floating_axes.py
@@ -0,0 +1 @@
+from mpl_toolkits.axisartist.floating_axes import *
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/grid_finder.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/grid_finder.py
new file mode 100644
index 0000000..6cdec87
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/grid_finder.py
@@ -0,0 +1 @@
+from mpl_toolkits.axisartist.grid_finder import *
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/grid_helper_curvelinear.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/grid_helper_curvelinear.py
new file mode 100644
index 0000000..ebb3edf
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/grid_helper_curvelinear.py
@@ -0,0 +1 @@
+from mpl_toolkits.axisartist.grid_helper_curvelinear import *
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/inset_locator.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/inset_locator.py
new file mode 100644
index 0000000..9d656e6
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/inset_locator.py
@@ -0,0 +1,4 @@
+from mpl_toolkits.axes_grid1.inset_locator import InsetPosition, \
+ AnchoredSizeLocator, \
+ AnchoredZoomLocator, BboxPatch, BboxConnector, BboxConnectorPatch, \
+ inset_axes, zoomed_inset_axes, mark_inset
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid/parasite_axes.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid/parasite_axes.py
new file mode 100644
index 0000000..d988d70
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid/parasite_axes.py
@@ -0,0 +1,12 @@
+from matplotlib import _api
+from mpl_toolkits.axes_grid1.parasite_axes import (
+ host_axes_class_factory, parasite_axes_class_factory,
+ parasite_axes_auxtrans_class_factory, subplot_class_factory)
+from mpl_toolkits.axisartist.axislines import Axes
+
+
+ParasiteAxes = parasite_axes_class_factory(Axes)
+HostAxes = host_axes_class_factory(Axes)
+SubplotHost = subplot_class_factory(HostAxes)
+with _api.suppress_matplotlib_deprecation_warning():
+ ParasiteAxesAuxTrans = parasite_axes_auxtrans_class_factory(ParasiteAxes)
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid1/__init__.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/__init__.py
new file mode 100644
index 0000000..0f359c9
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/__init__.py
@@ -0,0 +1,5 @@
+from . import axes_size as Size
+from .axes_divider import Divider, SubplotDivider, make_axes_locatable
+from .axes_grid import Grid, ImageGrid, AxesGrid
+
+from .parasite_axes import host_subplot, host_axes
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid1/anchored_artists.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/anchored_artists.py
new file mode 100644
index 0000000..b3e88c9
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/anchored_artists.py
@@ -0,0 +1,554 @@
+from matplotlib import transforms
+from matplotlib.offsetbox import (AnchoredOffsetbox, AuxTransformBox,
+ DrawingArea, TextArea, VPacker)
+from matplotlib.patches import (Rectangle, Ellipse, ArrowStyle,
+ FancyArrowPatch, PathPatch)
+from matplotlib.text import TextPath
+
+__all__ = ['AnchoredDrawingArea', 'AnchoredAuxTransformBox',
+ 'AnchoredEllipse', 'AnchoredSizeBar', 'AnchoredDirectionArrows']
+
+
+class AnchoredDrawingArea(AnchoredOffsetbox):
+ def __init__(self, width, height, xdescent, ydescent,
+ loc, pad=0.4, borderpad=0.5, prop=None, frameon=True,
+ **kwargs):
+ """
+ An anchored container with a fixed size and fillable DrawingArea.
+
+ Artists added to the *drawing_area* will have their coordinates
+ interpreted as pixels. Any transformations set on the artists will be
+ overridden.
+
+ Parameters
+ ----------
+ width, height : float
+ width and height of the container, in pixels.
+
+ xdescent, ydescent : float
+ descent of the container in the x- and y- direction, in pixels.
+
+ loc : int
+ Location of this artist. Valid location codes are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4,
+ 'right' : 5,
+ 'center left' : 6,
+ 'center right' : 7,
+ 'lower center' : 8,
+ 'upper center' : 9,
+ 'center' : 10
+
+ pad : float, default: 0.4
+ Padding around the child objects, in fraction of the font size.
+
+ borderpad : float, default: 0.5
+ Border padding, in fraction of the font size.
+
+ prop : `matplotlib.font_manager.FontProperties`, optional
+ Font property used as a reference for paddings.
+
+ frameon : bool, default: True
+ If True, draw a box around this artists.
+
+ **kwargs
+ Keyworded arguments to pass to
+ :class:`matplotlib.offsetbox.AnchoredOffsetbox`.
+
+ Attributes
+ ----------
+ drawing_area : `matplotlib.offsetbox.DrawingArea`
+ A container for artists to display.
+
+ Examples
+ --------
+ To display blue and red circles of different sizes in the upper right
+ of an axes *ax*:
+
+ >>> ada = AnchoredDrawingArea(20, 20, 0, 0,
+ ... loc='upper right', frameon=False)
+ >>> ada.drawing_area.add_artist(Circle((10, 10), 10, fc="b"))
+ >>> ada.drawing_area.add_artist(Circle((30, 10), 5, fc="r"))
+ >>> ax.add_artist(ada)
+ """
+ self.da = DrawingArea(width, height, xdescent, ydescent)
+ self.drawing_area = self.da
+
+ super().__init__(
+ loc, pad=pad, borderpad=borderpad, child=self.da, prop=None,
+ frameon=frameon, **kwargs
+ )
+
+
+class AnchoredAuxTransformBox(AnchoredOffsetbox):
+ def __init__(self, transform, loc,
+ pad=0.4, borderpad=0.5, prop=None, frameon=True, **kwargs):
+ """
+ An anchored container with transformed coordinates.
+
+ Artists added to the *drawing_area* are scaled according to the
+ coordinates of the transformation used. The dimensions of this artist
+ will scale to contain the artists added.
+
+ Parameters
+ ----------
+ transform : `matplotlib.transforms.Transform`
+ The transformation object for the coordinate system in use, i.e.,
+ :attr:`matplotlib.axes.Axes.transData`.
+
+ loc : int
+ Location of this artist. Valid location codes are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4,
+ 'right' : 5,
+ 'center left' : 6,
+ 'center right' : 7,
+ 'lower center' : 8,
+ 'upper center' : 9,
+ 'center' : 10
+
+ pad : float, default: 0.4
+ Padding around the child objects, in fraction of the font size.
+
+ borderpad : float, default: 0.5
+ Border padding, in fraction of the font size.
+
+ prop : `matplotlib.font_manager.FontProperties`, optional
+ Font property used as a reference for paddings.
+
+ frameon : bool, default: True
+ If True, draw a box around this artists.
+
+ **kwargs
+ Keyworded arguments to pass to
+ :class:`matplotlib.offsetbox.AnchoredOffsetbox`.
+
+ Attributes
+ ----------
+ drawing_area : `matplotlib.offsetbox.AuxTransformBox`
+ A container for artists to display.
+
+ Examples
+ --------
+ To display an ellipse in the upper left, with a width of 0.1 and
+ height of 0.4 in data coordinates:
+
+ >>> box = AnchoredAuxTransformBox(ax.transData, loc='upper left')
+ >>> el = Ellipse((0, 0), width=0.1, height=0.4, angle=30)
+ >>> box.drawing_area.add_artist(el)
+ >>> ax.add_artist(box)
+ """
+ self.drawing_area = AuxTransformBox(transform)
+
+ super().__init__(loc, pad=pad, borderpad=borderpad,
+ child=self.drawing_area, prop=prop, frameon=frameon,
+ **kwargs)
+
+
+class AnchoredEllipse(AnchoredOffsetbox):
+ def __init__(self, transform, width, height, angle, loc,
+ pad=0.1, borderpad=0.1, prop=None, frameon=True, **kwargs):
+ """
+ Draw an anchored ellipse of a given size.
+
+ Parameters
+ ----------
+ transform : `matplotlib.transforms.Transform`
+ The transformation object for the coordinate system in use, i.e.,
+ :attr:`matplotlib.axes.Axes.transData`.
+
+ width, height : float
+ Width and height of the ellipse, given in coordinates of
+ *transform*.
+
+ angle : float
+ Rotation of the ellipse, in degrees, anti-clockwise.
+
+ loc : int
+ Location of this size bar. Valid location codes are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4,
+ 'right' : 5,
+ 'center left' : 6,
+ 'center right' : 7,
+ 'lower center' : 8,
+ 'upper center' : 9,
+ 'center' : 10
+
+ pad : float, optional
+ Padding around the ellipse, in fraction of the font size. Defaults
+ to 0.1.
+
+ borderpad : float, default: 0.1
+ Border padding, in fraction of the font size.
+
+ frameon : bool, default: True
+ If True, draw a box around the ellipse.
+
+ prop : `matplotlib.font_manager.FontProperties`, optional
+ Font property used as a reference for paddings.
+
+ **kwargs
+ Keyworded arguments to pass to
+ :class:`matplotlib.offsetbox.AnchoredOffsetbox`.
+
+ Attributes
+ ----------
+ ellipse : `matplotlib.patches.Ellipse`
+ Ellipse patch drawn.
+ """
+ self._box = AuxTransformBox(transform)
+ self.ellipse = Ellipse((0, 0), width, height, angle)
+ self._box.add_artist(self.ellipse)
+
+ super().__init__(loc, pad=pad, borderpad=borderpad, child=self._box,
+ prop=prop, frameon=frameon, **kwargs)
+
+
+class AnchoredSizeBar(AnchoredOffsetbox):
+ def __init__(self, transform, size, label, loc,
+ pad=0.1, borderpad=0.1, sep=2,
+ frameon=True, size_vertical=0, color='black',
+ label_top=False, fontproperties=None, fill_bar=None,
+ **kwargs):
+ """
+ Draw a horizontal scale bar with a center-aligned label underneath.
+
+ Parameters
+ ----------
+ transform : `matplotlib.transforms.Transform`
+ The transformation object for the coordinate system in use, i.e.,
+ :attr:`matplotlib.axes.Axes.transData`.
+
+ size : float
+ Horizontal length of the size bar, given in coordinates of
+ *transform*.
+
+ label : str
+ Label to display.
+
+ loc : int
+ Location of this size bar. Valid location codes are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4,
+ 'right' : 5,
+ 'center left' : 6,
+ 'center right' : 7,
+ 'lower center' : 8,
+ 'upper center' : 9,
+ 'center' : 10
+
+ pad : float, default: 0.1
+ Padding around the label and size bar, in fraction of the font
+ size.
+
+ borderpad : float, default: 0.1
+ Border padding, in fraction of the font size.
+
+ sep : float, default: 2
+ Separation between the label and the size bar, in points.
+
+ frameon : bool, default: True
+ If True, draw a box around the horizontal bar and label.
+
+ size_vertical : float, default: 0
+ Vertical length of the size bar, given in coordinates of
+ *transform*.
+
+ color : str, default: 'black'
+ Color for the size bar and label.
+
+ label_top : bool, default: False
+ If True, the label will be over the size bar.
+
+ fontproperties : `matplotlib.font_manager.FontProperties`, optional
+ Font properties for the label text.
+
+ fill_bar : bool, optional
+ If True and if size_vertical is nonzero, the size bar will
+ be filled in with the color specified by the size bar.
+ Defaults to True if *size_vertical* is greater than
+ zero and False otherwise.
+
+ **kwargs
+ Keyworded arguments to pass to
+ :class:`matplotlib.offsetbox.AnchoredOffsetbox`.
+
+ Attributes
+ ----------
+ size_bar : `matplotlib.offsetbox.AuxTransformBox`
+ Container for the size bar.
+
+ txt_label : `matplotlib.offsetbox.TextArea`
+ Container for the label of the size bar.
+
+ Notes
+ -----
+ If *prop* is passed as a keyworded argument, but *fontproperties* is
+ not, then *prop* is be assumed to be the intended *fontproperties*.
+ Using both *prop* and *fontproperties* is not supported.
+
+ Examples
+ --------
+ >>> import matplotlib.pyplot as plt
+ >>> import numpy as np
+ >>> from mpl_toolkits.axes_grid1.anchored_artists import (
+ ... AnchoredSizeBar)
+ >>> fig, ax = plt.subplots()
+ >>> ax.imshow(np.random.random((10, 10)))
+ >>> bar = AnchoredSizeBar(ax.transData, 3, '3 data units', 4)
+ >>> ax.add_artist(bar)
+ >>> fig.show()
+
+ Using all the optional parameters
+
+ >>> import matplotlib.font_manager as fm
+ >>> fontprops = fm.FontProperties(size=14, family='monospace')
+ >>> bar = AnchoredSizeBar(ax.transData, 3, '3 units', 4, pad=0.5,
+ ... sep=5, borderpad=0.5, frameon=False,
+ ... size_vertical=0.5, color='white',
+ ... fontproperties=fontprops)
+ """
+ if fill_bar is None:
+ fill_bar = size_vertical > 0
+
+ self.size_bar = AuxTransformBox(transform)
+ self.size_bar.add_artist(Rectangle((0, 0), size, size_vertical,
+ fill=fill_bar, facecolor=color,
+ edgecolor=color))
+
+ if fontproperties is None and 'prop' in kwargs:
+ fontproperties = kwargs.pop('prop')
+
+ if fontproperties is None:
+ textprops = {'color': color}
+ else:
+ textprops = {'color': color, 'fontproperties': fontproperties}
+
+ self.txt_label = TextArea(label, textprops=textprops)
+
+ if label_top:
+ _box_children = [self.txt_label, self.size_bar]
+ else:
+ _box_children = [self.size_bar, self.txt_label]
+
+ self._box = VPacker(children=_box_children,
+ align="center",
+ pad=0, sep=sep)
+
+ super().__init__(loc, pad=pad, borderpad=borderpad, child=self._box,
+ prop=fontproperties, frameon=frameon, **kwargs)
+
+
+class AnchoredDirectionArrows(AnchoredOffsetbox):
+ def __init__(self, transform, label_x, label_y, length=0.15,
+ fontsize=0.08, loc=2, angle=0, aspect_ratio=1, pad=0.4,
+ borderpad=0.4, frameon=False, color='w', alpha=1,
+ sep_x=0.01, sep_y=0, fontproperties=None, back_length=0.15,
+ head_width=10, head_length=15, tail_width=2,
+ text_props=None, arrow_props=None,
+ **kwargs):
+ """
+ Draw two perpendicular arrows to indicate directions.
+
+ Parameters
+ ----------
+ transform : `matplotlib.transforms.Transform`
+ The transformation object for the coordinate system in use, i.e.,
+ :attr:`matplotlib.axes.Axes.transAxes`.
+
+ label_x, label_y : str
+ Label text for the x and y arrows
+
+ length : float, default: 0.15
+ Length of the arrow, given in coordinates of *transform*.
+
+ fontsize : float, default: 0.08
+ Size of label strings, given in coordinates of *transform*.
+
+ loc : int, default: 2
+ Location of the direction arrows. Valid location codes are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4,
+ 'right' : 5,
+ 'center left' : 6,
+ 'center right' : 7,
+ 'lower center' : 8,
+ 'upper center' : 9,
+ 'center' : 10
+
+ angle : float, default: 0
+ The angle of the arrows in degrees.
+
+ aspect_ratio : float, default: 1
+ The ratio of the length of arrow_x and arrow_y.
+ Negative numbers can be used to change the direction.
+
+ pad : float, default: 0.4
+ Padding around the labels and arrows, in fraction of the font size.
+
+ borderpad : float, default: 0.4
+ Border padding, in fraction of the font size.
+
+ frameon : bool, default: False
+ If True, draw a box around the arrows and labels.
+
+ color : str, default: 'white'
+ Color for the arrows and labels.
+
+ alpha : float, default: 1
+ Alpha values of the arrows and labels
+
+ sep_x, sep_y : float, default: 0.01 and 0 respectively
+ Separation between the arrows and labels in coordinates of
+ *transform*.
+
+ fontproperties : `matplotlib.font_manager.FontProperties`, optional
+ Font properties for the label text.
+
+ back_length : float, default: 0.15
+ Fraction of the arrow behind the arrow crossing.
+
+ head_width : float, default: 10
+ Width of arrow head, sent to ArrowStyle.
+
+ head_length : float, default: 15
+ Length of arrow head, sent to ArrowStyle.
+
+ tail_width : float, default: 2
+ Width of arrow tail, sent to ArrowStyle.
+
+ text_props, arrow_props : dict
+ Properties of the text and arrows, passed to
+ `.textpath.TextPath` and `.patches.FancyArrowPatch`.
+
+ **kwargs
+ Keyworded arguments to pass to
+ :class:`matplotlib.offsetbox.AnchoredOffsetbox`.
+
+ Attributes
+ ----------
+ arrow_x, arrow_y : `matplotlib.patches.FancyArrowPatch`
+ Arrow x and y
+
+ text_path_x, text_path_y : `matplotlib.textpath.TextPath`
+ Path for arrow labels
+
+ p_x, p_y : `matplotlib.patches.PathPatch`
+ Patch for arrow labels
+
+ box : `matplotlib.offsetbox.AuxTransformBox`
+ Container for the arrows and labels.
+
+ Notes
+ -----
+ If *prop* is passed as a keyword argument, but *fontproperties* is
+ not, then *prop* is be assumed to be the intended *fontproperties*.
+ Using both *prop* and *fontproperties* is not supported.
+
+ Examples
+ --------
+ >>> import matplotlib.pyplot as plt
+ >>> import numpy as np
+ >>> from mpl_toolkits.axes_grid1.anchored_artists import (
+ ... AnchoredDirectionArrows)
+ >>> fig, ax = plt.subplots()
+ >>> ax.imshow(np.random.random((10, 10)))
+ >>> arrows = AnchoredDirectionArrows(ax.transAxes, '111', '110')
+ >>> ax.add_artist(arrows)
+ >>> fig.show()
+
+ Using several of the optional parameters, creating downward pointing
+ arrow and high contrast text labels.
+
+ >>> import matplotlib.font_manager as fm
+ >>> fontprops = fm.FontProperties(family='monospace')
+ >>> arrows = AnchoredDirectionArrows(ax.transAxes, 'East', 'South',
+ ... loc='lower left', color='k',
+ ... aspect_ratio=-1, sep_x=0.02,
+ ... sep_y=-0.01,
+ ... text_props={'ec':'w', 'fc':'k'},
+ ... fontproperties=fontprops)
+ """
+ if arrow_props is None:
+ arrow_props = {}
+
+ if text_props is None:
+ text_props = {}
+
+ arrowstyle = ArrowStyle("Simple",
+ head_width=head_width,
+ head_length=head_length,
+ tail_width=tail_width)
+
+ if fontproperties is None and 'prop' in kwargs:
+ fontproperties = kwargs.pop('prop')
+
+ if 'color' not in arrow_props:
+ arrow_props['color'] = color
+
+ if 'alpha' not in arrow_props:
+ arrow_props['alpha'] = alpha
+
+ if 'color' not in text_props:
+ text_props['color'] = color
+
+ if 'alpha' not in text_props:
+ text_props['alpha'] = alpha
+
+ t_start = transform
+ t_end = t_start + transforms.Affine2D().rotate_deg(angle)
+
+ self.box = AuxTransformBox(t_end)
+
+ length_x = length
+ length_y = length*aspect_ratio
+
+ self.arrow_x = FancyArrowPatch(
+ (0, back_length*length_y),
+ (length_x, back_length*length_y),
+ arrowstyle=arrowstyle,
+ shrinkA=0.0,
+ shrinkB=0.0,
+ **arrow_props)
+
+ self.arrow_y = FancyArrowPatch(
+ (back_length*length_x, 0),
+ (back_length*length_x, length_y),
+ arrowstyle=arrowstyle,
+ shrinkA=0.0,
+ shrinkB=0.0,
+ **arrow_props)
+
+ self.box.add_artist(self.arrow_x)
+ self.box.add_artist(self.arrow_y)
+
+ text_path_x = TextPath((
+ length_x+sep_x, back_length*length_y+sep_y), label_x,
+ size=fontsize, prop=fontproperties)
+ self.p_x = PathPatch(text_path_x, transform=t_start, **text_props)
+ self.box.add_artist(self.p_x)
+
+ text_path_y = TextPath((
+ length_x*back_length+sep_x, length_y*(1-back_length)+sep_y),
+ label_y, size=fontsize, prop=fontproperties)
+ self.p_y = PathPatch(text_path_y, **text_props)
+ self.box.add_artist(self.p_y)
+
+ super().__init__(loc, pad=pad, borderpad=borderpad, child=self.box,
+ frameon=frameon, **kwargs)
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_divider.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_divider.py
new file mode 100644
index 0000000..b50bb5c
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_divider.py
@@ -0,0 +1,762 @@
+"""
+Helper classes to adjust the positions of multiple axes at drawing time.
+"""
+
+import numpy as np
+
+from matplotlib import _api
+from matplotlib.axes import SubplotBase
+from matplotlib.gridspec import SubplotSpec, GridSpec
+import matplotlib.transforms as mtransforms
+from . import axes_size as Size
+
+
+class Divider:
+ """
+ An Axes positioning class.
+
+ The divider is initialized with lists of horizontal and vertical sizes
+ (:mod:`mpl_toolkits.axes_grid1.axes_size`) based on which a given
+ rectangular area will be divided.
+
+ The `new_locator` method then creates a callable object
+ that can be used as the *axes_locator* of the axes.
+ """
+
+ def __init__(self, fig, pos, horizontal, vertical,
+ aspect=None, anchor="C"):
+ """
+ Parameters
+ ----------
+ fig : Figure
+ pos : tuple of 4 floats
+ Position of the rectangle that will be divided.
+ horizontal : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
+ Sizes for horizontal division.
+ vertical : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
+ Sizes for vertical division.
+ aspect : bool
+ Whether overall rectangular area is reduced so that the relative
+ part of the horizontal and vertical scales have the same scale.
+ anchor : {'C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W'}
+ Placement of the reduced rectangle, when *aspect* is True.
+ """
+
+ self._fig = fig
+ self._pos = pos
+ self._horizontal = horizontal
+ self._vertical = vertical
+ self._anchor = anchor
+ self._aspect = aspect
+ self._xrefindex = 0
+ self._yrefindex = 0
+ self._locator = None
+
+ def get_horizontal_sizes(self, renderer):
+ return [s.get_size(renderer) for s in self.get_horizontal()]
+
+ def get_vertical_sizes(self, renderer):
+ return [s.get_size(renderer) for s in self.get_vertical()]
+
+ def get_vsize_hsize(self):
+ vsize = Size.AddList(self.get_vertical())
+ hsize = Size.AddList(self.get_horizontal())
+ return vsize, hsize
+
+ @staticmethod
+ def _calc_k(l, total_size):
+
+ rs_sum, as_sum = 0., 0.
+
+ for _rs, _as in l:
+ rs_sum += _rs
+ as_sum += _as
+
+ if rs_sum != 0.:
+ k = (total_size - as_sum) / rs_sum
+ return k
+ else:
+ return 0.
+
+ @staticmethod
+ def _calc_offsets(l, k):
+ offsets = [0.]
+ for _rs, _as in l:
+ offsets.append(offsets[-1] + _rs*k + _as)
+ return offsets
+
+ def set_position(self, pos):
+ """
+ Set the position of the rectangle.
+
+ Parameters
+ ----------
+ pos : tuple of 4 floats
+ position of the rectangle that will be divided
+ """
+ self._pos = pos
+
+ def get_position(self):
+ """Return the position of the rectangle."""
+ return self._pos
+
+ def set_anchor(self, anchor):
+ """
+ Parameters
+ ----------
+ anchor : {'C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W'}
+ anchor position
+
+ ===== ============
+ value description
+ ===== ============
+ 'C' Center
+ 'SW' bottom left
+ 'S' bottom
+ 'SE' bottom right
+ 'E' right
+ 'NE' top right
+ 'N' top
+ 'NW' top left
+ 'W' left
+ ===== ============
+
+ """
+ if len(anchor) != 2:
+ _api.check_in_list(mtransforms.Bbox.coefs, anchor=anchor)
+ self._anchor = anchor
+
+ def get_anchor(self):
+ """Return the anchor."""
+ return self._anchor
+
+ def set_horizontal(self, h):
+ """
+ Parameters
+ ----------
+ h : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
+ sizes for horizontal division
+ """
+ self._horizontal = h
+
+ def get_horizontal(self):
+ """Return horizontal sizes."""
+ return self._horizontal
+
+ def set_vertical(self, v):
+ """
+ Parameters
+ ----------
+ v : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
+ sizes for vertical division
+ """
+ self._vertical = v
+
+ def get_vertical(self):
+ """Return vertical sizes."""
+ return self._vertical
+
+ def set_aspect(self, aspect=False):
+ """
+ Parameters
+ ----------
+ aspect : bool
+ """
+ self._aspect = aspect
+
+ def get_aspect(self):
+ """Return aspect."""
+ return self._aspect
+
+ def set_locator(self, _locator):
+ self._locator = _locator
+
+ def get_locator(self):
+ return self._locator
+
+ def get_position_runtime(self, ax, renderer):
+ if self._locator is None:
+ return self.get_position()
+ else:
+ return self._locator(ax, renderer).bounds
+
+ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
+ """
+ Parameters
+ ----------
+ nx, nx1 : int
+ Integers specifying the column-position of the
+ cell. When *nx1* is None, a single *nx*-th column is
+ specified. Otherwise location of columns spanning between *nx*
+ to *nx1* (but excluding *nx1*-th column) is specified.
+ ny, ny1 : int
+ Same as *nx* and *nx1*, but for row positions.
+ axes
+ renderer
+ """
+
+ figW, figH = self._fig.get_size_inches()
+ x, y, w, h = self.get_position_runtime(axes, renderer)
+
+ hsizes = self.get_horizontal_sizes(renderer)
+ vsizes = self.get_vertical_sizes(renderer)
+ k_h = self._calc_k(hsizes, figW*w)
+ k_v = self._calc_k(vsizes, figH*h)
+
+ if self.get_aspect():
+ k = min(k_h, k_v)
+ ox = self._calc_offsets(hsizes, k)
+ oy = self._calc_offsets(vsizes, k)
+
+ ww = (ox[-1] - ox[0]) / figW
+ hh = (oy[-1] - oy[0]) / figH
+ pb = mtransforms.Bbox.from_bounds(x, y, w, h)
+ pb1 = mtransforms.Bbox.from_bounds(x, y, ww, hh)
+ pb1_anchored = pb1.anchored(self.get_anchor(), pb)
+ x0, y0 = pb1_anchored.x0, pb1_anchored.y0
+
+ else:
+ ox = self._calc_offsets(hsizes, k_h)
+ oy = self._calc_offsets(vsizes, k_v)
+ x0, y0 = x, y
+
+ if nx1 is None:
+ nx1 = nx + 1
+ if ny1 is None:
+ ny1 = ny + 1
+
+ x1, w1 = x0 + ox[nx] / figW, (ox[nx1] - ox[nx]) / figW
+ y1, h1 = y0 + oy[ny] / figH, (oy[ny1] - oy[ny]) / figH
+
+ return mtransforms.Bbox.from_bounds(x1, y1, w1, h1)
+
+ def new_locator(self, nx, ny, nx1=None, ny1=None):
+ """
+ Return a new `AxesLocator` for the specified cell.
+
+ Parameters
+ ----------
+ nx, nx1 : int
+ Integers specifying the column-position of the
+ cell. When *nx1* is None, a single *nx*-th column is
+ specified. Otherwise location of columns spanning between *nx*
+ to *nx1* (but excluding *nx1*-th column) is specified.
+ ny, ny1 : int
+ Same as *nx* and *nx1*, but for row positions.
+ """
+ return AxesLocator(self, nx, ny, nx1, ny1)
+
+ def append_size(self, position, size):
+ if position == "left":
+ self._horizontal.insert(0, size)
+ self._xrefindex += 1
+ elif position == "right":
+ self._horizontal.append(size)
+ elif position == "bottom":
+ self._vertical.insert(0, size)
+ self._yrefindex += 1
+ elif position == "top":
+ self._vertical.append(size)
+ else:
+ _api.check_in_list(["left", "right", "bottom", "top"],
+ position=position)
+
+ def add_auto_adjustable_area(self, use_axes, pad=0.1, adjust_dirs=None):
+ if adjust_dirs is None:
+ adjust_dirs = ["left", "right", "bottom", "top"]
+ from .axes_size import Padded, SizeFromFunc, GetExtentHelper
+ for d in adjust_dirs:
+ helper = GetExtentHelper(use_axes, d)
+ size = SizeFromFunc(helper)
+ padded_size = Padded(size, pad) # pad in inch
+ self.append_size(d, padded_size)
+
+
+class AxesLocator:
+ """
+ A simple callable object, initialized with AxesDivider class,
+ returns the position and size of the given cell.
+ """
+ def __init__(self, axes_divider, nx, ny, nx1=None, ny1=None):
+ """
+ Parameters
+ ----------
+ axes_divider : AxesDivider
+ nx, nx1 : int
+ Integers specifying the column-position of the
+ cell. When *nx1* is None, a single *nx*-th column is
+ specified. Otherwise location of columns spanning between *nx*
+ to *nx1* (but excluding *nx1*-th column) is specified.
+ ny, ny1 : int
+ Same as *nx* and *nx1*, but for row positions.
+ """
+ self._axes_divider = axes_divider
+
+ _xrefindex = axes_divider._xrefindex
+ _yrefindex = axes_divider._yrefindex
+
+ self._nx, self._ny = nx - _xrefindex, ny - _yrefindex
+
+ if nx1 is None:
+ nx1 = nx + 1
+ if ny1 is None:
+ ny1 = ny + 1
+
+ self._nx1 = nx1 - _xrefindex
+ self._ny1 = ny1 - _yrefindex
+
+ def __call__(self, axes, renderer):
+
+ _xrefindex = self._axes_divider._xrefindex
+ _yrefindex = self._axes_divider._yrefindex
+
+ return self._axes_divider.locate(self._nx + _xrefindex,
+ self._ny + _yrefindex,
+ self._nx1 + _xrefindex,
+ self._ny1 + _yrefindex,
+ axes,
+ renderer)
+
+ def get_subplotspec(self):
+ if hasattr(self._axes_divider, "get_subplotspec"):
+ return self._axes_divider.get_subplotspec()
+ else:
+ return None
+
+
+class SubplotDivider(Divider):
+ """
+ The Divider class whose rectangle area is specified as a subplot geometry.
+ """
+
+ def __init__(self, fig, *args, horizontal=None, vertical=None,
+ aspect=None, anchor='C'):
+ """
+ Parameters
+ ----------
+ fig : `matplotlib.figure.Figure`
+
+ *args : tuple (*nrows*, *ncols*, *index*) or int
+ The array of subplots in the figure has dimensions ``(nrows,
+ ncols)``, and *index* is the index of the subplot being created.
+ *index* starts at 1 in the upper left corner and increases to the
+ right.
+
+ If *nrows*, *ncols*, and *index* are all single digit numbers, then
+ *args* can be passed as a single 3-digit number (e.g. 234 for
+ (2, 3, 4)).
+ """
+ self.figure = fig
+ super().__init__(fig, [0, 0, 1, 1],
+ horizontal=horizontal or [], vertical=vertical or [],
+ aspect=aspect, anchor=anchor)
+ self.set_subplotspec(SubplotSpec._from_subplot_args(fig, args))
+
+ def get_position(self):
+ """Return the bounds of the subplot box."""
+ return self.get_subplotspec().get_position(self.figure).bounds
+
+ @_api.deprecated("3.4")
+ @property
+ def figbox(self):
+ return self.get_subplotspec().get_position(self.figure)
+
+ @_api.deprecated("3.4")
+ def update_params(self):
+ pass
+
+ @_api.deprecated(
+ "3.4", alternative="get_subplotspec",
+ addendum="(get_subplotspec returns a SubplotSpec instance.)")
+ def get_geometry(self):
+ """Get the subplot geometry, e.g., (2, 2, 3)."""
+ rows, cols, num1, num2 = self.get_subplotspec().get_geometry()
+ return rows, cols, num1 + 1 # for compatibility
+
+ @_api.deprecated("3.4", alternative="set_subplotspec")
+ def change_geometry(self, numrows, numcols, num):
+ """Change subplot geometry, e.g., from (1, 1, 1) to (2, 2, 3)."""
+ self._subplotspec = GridSpec(numrows, numcols)[num-1]
+ self.update_params()
+ self.set_position(self.figbox)
+
+ def get_subplotspec(self):
+ """Get the SubplotSpec instance."""
+ return self._subplotspec
+
+ def set_subplotspec(self, subplotspec):
+ """Set the SubplotSpec instance."""
+ self._subplotspec = subplotspec
+ self.set_position(subplotspec.get_position(self.figure))
+
+
+class AxesDivider(Divider):
+ """
+ Divider based on the pre-existing axes.
+ """
+
+ def __init__(self, axes, xref=None, yref=None):
+ """
+ Parameters
+ ----------
+ axes : :class:`~matplotlib.axes.Axes`
+ xref
+ yref
+ """
+ self._axes = axes
+ if xref is None:
+ self._xref = Size.AxesX(axes)
+ else:
+ self._xref = xref
+ if yref is None:
+ self._yref = Size.AxesY(axes)
+ else:
+ self._yref = yref
+
+ super().__init__(fig=axes.get_figure(), pos=None,
+ horizontal=[self._xref], vertical=[self._yref],
+ aspect=None, anchor="C")
+
+ def _get_new_axes(self, *, axes_class=None, **kwargs):
+ axes = self._axes
+ if axes_class is None:
+ if isinstance(axes, SubplotBase):
+ axes_class = axes._axes_class
+ else:
+ axes_class = type(axes)
+ return axes_class(axes.get_figure(), axes.get_position(original=True),
+ **kwargs)
+
+ def new_horizontal(self, size, pad=None, pack_start=False, **kwargs):
+ """
+ Add a new axes on the right (or left) side of the main axes.
+
+ Parameters
+ ----------
+ size : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
+ A width of the axes. If float or string is given, *from_any*
+ function is used to create the size, with *ref_size* set to AxesX
+ instance of the current axes.
+ pad : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
+ Pad between the axes. It takes same argument as *size*.
+ pack_start : bool
+ If False, the new axes is appended at the end
+ of the list, i.e., it became the right-most axes. If True, it is
+ inserted at the start of the list, and becomes the left-most axes.
+ **kwargs
+ All extra keywords arguments are passed to the created axes.
+ If *axes_class* is given, the new axes will be created as an
+ instance of the given class. Otherwise, the same class of the
+ main axes will be used.
+ """
+ if pad is None:
+ _api.warn_deprecated(
+ "3.2", message="In a future version, 'pad' will default to "
+ "rcParams['figure.subplot.wspace']. Set pad=0 to keep the "
+ "old behavior.")
+ if pad:
+ if not isinstance(pad, Size._Base):
+ pad = Size.from_any(pad, fraction_ref=self._xref)
+ if pack_start:
+ self._horizontal.insert(0, pad)
+ self._xrefindex += 1
+ else:
+ self._horizontal.append(pad)
+ if not isinstance(size, Size._Base):
+ size = Size.from_any(size, fraction_ref=self._xref)
+ if pack_start:
+ self._horizontal.insert(0, size)
+ self._xrefindex += 1
+ locator = self.new_locator(nx=0, ny=self._yrefindex)
+ else:
+ self._horizontal.append(size)
+ locator = self.new_locator(
+ nx=len(self._horizontal) - 1, ny=self._yrefindex)
+ ax = self._get_new_axes(**kwargs)
+ ax.set_axes_locator(locator)
+ return ax
+
+ def new_vertical(self, size, pad=None, pack_start=False, **kwargs):
+ """
+ Add a new axes on the top (or bottom) side of the main axes.
+
+ Parameters
+ ----------
+ size : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
+ A height of the axes. If float or string is given, *from_any*
+ function is used to create the size, with *ref_size* set to AxesX
+ instance of the current axes.
+ pad : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
+ Pad between the axes. It takes same argument as *size*.
+ pack_start : bool
+ If False, the new axes is appended at the end
+ of the list, i.e., it became the right-most axes. If True, it is
+ inserted at the start of the list, and becomes the left-most axes.
+ **kwargs
+ All extra keywords arguments are passed to the created axes.
+ If *axes_class* is given, the new axes will be created as an
+ instance of the given class. Otherwise, the same class of the
+ main axes will be used.
+ """
+ if pad is None:
+ _api.warn_deprecated(
+ "3.2", message="In a future version, 'pad' will default to "
+ "rcParams['figure.subplot.hspace']. Set pad=0 to keep the "
+ "old behavior.")
+ if pad:
+ if not isinstance(pad, Size._Base):
+ pad = Size.from_any(pad, fraction_ref=self._yref)
+ if pack_start:
+ self._vertical.insert(0, pad)
+ self._yrefindex += 1
+ else:
+ self._vertical.append(pad)
+ if not isinstance(size, Size._Base):
+ size = Size.from_any(size, fraction_ref=self._yref)
+ if pack_start:
+ self._vertical.insert(0, size)
+ self._yrefindex += 1
+ locator = self.new_locator(nx=self._xrefindex, ny=0)
+ else:
+ self._vertical.append(size)
+ locator = self.new_locator(
+ nx=self._xrefindex, ny=len(self._vertical)-1)
+ ax = self._get_new_axes(**kwargs)
+ ax.set_axes_locator(locator)
+ return ax
+
+ def append_axes(self, position, size, pad=None, add_to_figure=True,
+ **kwargs):
+ """
+ Create an axes at the given *position* with the same height
+ (or width) of the main axes.
+
+ *position*
+ ["left"|"right"|"bottom"|"top"]
+
+ *size* and *pad* should be axes_grid.axes_size compatible.
+ """
+ if position == "left":
+ ax = self.new_horizontal(size, pad, pack_start=True, **kwargs)
+ elif position == "right":
+ ax = self.new_horizontal(size, pad, pack_start=False, **kwargs)
+ elif position == "bottom":
+ ax = self.new_vertical(size, pad, pack_start=True, **kwargs)
+ elif position == "top":
+ ax = self.new_vertical(size, pad, pack_start=False, **kwargs)
+ else:
+ _api.check_in_list(["left", "right", "bottom", "top"],
+ position=position)
+ if add_to_figure:
+ self._fig.add_axes(ax)
+ return ax
+
+ def get_aspect(self):
+ if self._aspect is None:
+ aspect = self._axes.get_aspect()
+ if aspect == "auto":
+ return False
+ else:
+ return True
+ else:
+ return self._aspect
+
+ def get_position(self):
+ if self._pos is None:
+ bbox = self._axes.get_position(original=True)
+ return bbox.bounds
+ else:
+ return self._pos
+
+ def get_anchor(self):
+ if self._anchor is None:
+ return self._axes.get_anchor()
+ else:
+ return self._anchor
+
+ def get_subplotspec(self):
+ if hasattr(self._axes, "get_subplotspec"):
+ return self._axes.get_subplotspec()
+ else:
+ return None
+
+
+class HBoxDivider(SubplotDivider):
+
+ @staticmethod
+ def _determine_karray(equivalent_sizes, appended_sizes,
+ max_equivalent_size,
+ total_appended_size):
+
+ n = len(equivalent_sizes)
+ eq_rs, eq_as = np.asarray(equivalent_sizes).T
+ ap_rs, ap_as = np.asarray(appended_sizes).T
+ A = np.zeros((n + 1, n + 1))
+ B = np.zeros(n + 1)
+ np.fill_diagonal(A[:n, :n], eq_rs)
+ A[:n, -1] = -1
+ A[-1, :-1] = ap_rs
+ B[:n] = -eq_as
+ B[-1] = total_appended_size - sum(ap_as)
+
+ karray_H = np.linalg.solve(A, B) # A @ K = B
+ karray = karray_H[:-1]
+ H = karray_H[-1]
+
+ if H > max_equivalent_size:
+ karray = (max_equivalent_size - eq_as) / eq_rs
+ return karray
+
+ @staticmethod
+ def _calc_offsets(appended_sizes, karray):
+ offsets = [0.]
+ for (r, a), k in zip(appended_sizes, karray):
+ offsets.append(offsets[-1] + r*k + a)
+ return offsets
+
+ def new_locator(self, nx, nx1=None):
+ """
+ Create a new `AxesLocator` for the specified cell.
+
+ Parameters
+ ----------
+ nx, nx1 : int
+ Integers specifying the column-position of the
+ cell. When *nx1* is None, a single *nx*-th column is
+ specified. Otherwise location of columns spanning between *nx*
+ to *nx1* (but excluding *nx1*-th column) is specified.
+ ny, ny1 : int
+ Same as *nx* and *nx1*, but for row positions.
+ """
+ return AxesLocator(self, nx, 0, nx1, None)
+
+ def _locate(self, x, y, w, h,
+ y_equivalent_sizes, x_appended_sizes,
+ figW, figH):
+ equivalent_sizes = y_equivalent_sizes
+ appended_sizes = x_appended_sizes
+
+ max_equivalent_size = figH * h
+ total_appended_size = figW * w
+ karray = self._determine_karray(equivalent_sizes, appended_sizes,
+ max_equivalent_size,
+ total_appended_size)
+
+ ox = self._calc_offsets(appended_sizes, karray)
+
+ ww = (ox[-1] - ox[0]) / figW
+ ref_h = equivalent_sizes[0]
+ hh = (karray[0]*ref_h[0] + ref_h[1]) / figH
+ pb = mtransforms.Bbox.from_bounds(x, y, w, h)
+ pb1 = mtransforms.Bbox.from_bounds(x, y, ww, hh)
+ pb1_anchored = pb1.anchored(self.get_anchor(), pb)
+ x0, y0 = pb1_anchored.x0, pb1_anchored.y0
+
+ return x0, y0, ox, hh
+
+ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
+ """
+ Parameters
+ ----------
+ axes_divider : AxesDivider
+ nx, nx1 : int
+ Integers specifying the column-position of the
+ cell. When *nx1* is None, a single *nx*-th column is
+ specified. Otherwise location of columns spanning between *nx*
+ to *nx1* (but excluding *nx1*-th column) is specified.
+ ny, ny1 : int
+ Same as *nx* and *nx1*, but for row positions.
+ axes
+ renderer
+ """
+
+ figW, figH = self._fig.get_size_inches()
+ x, y, w, h = self.get_position_runtime(axes, renderer)
+
+ y_equivalent_sizes = self.get_vertical_sizes(renderer)
+ x_appended_sizes = self.get_horizontal_sizes(renderer)
+ x0, y0, ox, hh = self._locate(x, y, w, h,
+ y_equivalent_sizes, x_appended_sizes,
+ figW, figH)
+ if nx1 is None:
+ nx1 = nx + 1
+
+ x1, w1 = x0 + ox[nx] / figW, (ox[nx1] - ox[nx]) / figW
+ y1, h1 = y0, hh
+
+ return mtransforms.Bbox.from_bounds(x1, y1, w1, h1)
+
+
+class VBoxDivider(HBoxDivider):
+ """
+ The Divider class whose rectangle area is specified as a subplot geometry.
+ """
+
+ def new_locator(self, ny, ny1=None):
+ """
+ Create a new `AxesLocator` for the specified cell.
+
+ Parameters
+ ----------
+ ny, ny1 : int
+ Integers specifying the row-position of the
+ cell. When *ny1* is None, a single *ny*-th row is
+ specified. Otherwise location of rows spanning between *ny*
+ to *ny1* (but excluding *ny1*-th row) is specified.
+ """
+ return AxesLocator(self, 0, ny, None, ny1)
+
+ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
+ """
+ Parameters
+ ----------
+ axes_divider : AxesDivider
+ nx, nx1 : int
+ Integers specifying the column-position of the
+ cell. When *nx1* is None, a single *nx*-th column is
+ specified. Otherwise location of columns spanning between *nx*
+ to *nx1* (but excluding *nx1*-th column) is specified.
+ ny, ny1 : int
+ Same as *nx* and *nx1*, but for row positions.
+ axes
+ renderer
+ """
+
+ figW, figH = self._fig.get_size_inches()
+ x, y, w, h = self.get_position_runtime(axes, renderer)
+
+ x_equivalent_sizes = self.get_horizontal_sizes(renderer)
+ y_appended_sizes = self.get_vertical_sizes(renderer)
+
+ y0, x0, oy, ww = self._locate(y, x, h, w,
+ x_equivalent_sizes, y_appended_sizes,
+ figH, figW)
+ if ny1 is None:
+ ny1 = ny + 1
+
+ x1, w1 = x0, ww
+ y1, h1 = y0 + oy[ny] / figH, (oy[ny1] - oy[ny]) / figH
+
+ return mtransforms.Bbox.from_bounds(x1, y1, w1, h1)
+
+
+def make_axes_locatable(axes):
+ divider = AxesDivider(axes)
+ locator = divider.new_locator(nx=0, ny=0)
+ axes.set_axes_locator(locator)
+
+ return divider
+
+
+def make_axes_area_auto_adjustable(ax,
+ use_axes=None, pad=0.1,
+ adjust_dirs=None):
+ if adjust_dirs is None:
+ adjust_dirs = ["left", "right", "bottom", "top"]
+ divider = make_axes_locatable(ax)
+
+ if use_axes is None:
+ use_axes = ax
+
+ divider.add_auto_adjustable_area(use_axes=use_axes, pad=pad,
+ adjust_dirs=adjust_dirs)
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_grid.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_grid.py
new file mode 100644
index 0000000..295a03e
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_grid.py
@@ -0,0 +1,605 @@
+from numbers import Number
+import functools
+
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib import _api
+from matplotlib.gridspec import SubplotSpec
+
+from .axes_divider import Size, SubplotDivider, Divider
+from .mpl_axes import Axes
+
+
+def _tick_only(ax, bottom_on, left_on):
+ bottom_off = not bottom_on
+ left_off = not left_on
+ ax.axis["bottom"].toggle(ticklabels=bottom_off, label=bottom_off)
+ ax.axis["left"].toggle(ticklabels=left_off, label=left_off)
+
+
+class CbarAxesBase:
+ def __init__(self, *args, orientation, **kwargs):
+ self.orientation = orientation
+ self._default_label_on = True
+ self._locator = None # deprecated.
+ super().__init__(*args, **kwargs)
+
+ def colorbar(self, mappable, *, ticks=None, **kwargs):
+
+ if self.orientation in ["top", "bottom"]:
+ orientation = "horizontal"
+ else:
+ orientation = "vertical"
+
+ cb = mpl.colorbar.Colorbar(
+ self, mappable, orientation=orientation, ticks=ticks, **kwargs)
+ self._cbid = mappable.colorbar_cid # deprecated in 3.3.
+ self._locator = cb.locator # deprecated in 3.3.
+
+ self._config_axes()
+ return cb
+
+ cbid = _api.deprecate_privatize_attribute(
+ "3.3", alternative="mappable.colorbar_cid")
+ locator = _api.deprecate_privatize_attribute(
+ "3.3", alternative=".colorbar().locator")
+
+ def _config_axes(self):
+ """Make an axes patch and outline."""
+ ax = self
+ ax.set_navigate(False)
+ ax.axis[:].toggle(all=False)
+ b = self._default_label_on
+ ax.axis[self.orientation].toggle(all=b)
+
+ def toggle_label(self, b):
+ self._default_label_on = b
+ axis = self.axis[self.orientation]
+ axis.toggle(ticklabels=b, label=b)
+
+ def cla(self):
+ super().cla()
+ self._config_axes()
+
+
+class CbarAxes(CbarAxesBase, Axes):
+ pass
+
+
+class Grid:
+ """
+ A grid of Axes.
+
+ In Matplotlib, the axes location (and size) is specified in normalized
+ figure coordinates. This may not be ideal for images that needs to be
+ displayed with a given aspect ratio; for example, it is difficult to
+ display multiple images of a same size with some fixed padding between
+ them. AxesGrid can be used in such case.
+ """
+
+ _defaultAxesClass = Axes
+
+ @_api.delete_parameter("3.3", "add_all")
+ def __init__(self, fig,
+ rect,
+ nrows_ncols,
+ ngrids=None,
+ direction="row",
+ axes_pad=0.02,
+ add_all=True,
+ share_all=False,
+ share_x=True,
+ share_y=True,
+ label_mode="L",
+ axes_class=None,
+ *,
+ aspect=False,
+ ):
+ """
+ Parameters
+ ----------
+ fig : `.Figure`
+ The parent figure.
+ rect : (float, float, float, float) or int
+ The axes position, as a ``(left, bottom, width, height)`` tuple or
+ as a three-digit subplot position code (e.g., "121").
+ nrows_ncols : (int, int)
+ Number of rows and columns in the grid.
+ ngrids : int or None, default: None
+ If not None, only the first *ngrids* axes in the grid are created.
+ direction : {"row", "column"}, default: "row"
+ Whether axes are created in row-major ("row by row") or
+ column-major order ("column by column").
+ axes_pad : float or (float, float), default: 0.02
+ Padding or (horizontal padding, vertical padding) between axes, in
+ inches.
+ add_all : bool, default: True
+ Whether to add the axes to the figure using `.Figure.add_axes`.
+ This parameter is deprecated.
+ share_all : bool, default: False
+ Whether all axes share their x- and y-axis. Overrides *share_x*
+ and *share_y*.
+ share_x : bool, default: True
+ Whether all axes of a column share their x-axis.
+ share_y : bool, default: True
+ Whether all axes of a row share their y-axis.
+ label_mode : {"L", "1", "all"}, default: "L"
+ Determines which axes will get tick labels:
+
+ - "L": All axes on the left column get vertical tick labels;
+ all axes on the bottom row get horizontal tick labels.
+ - "1": Only the bottom left axes is labelled.
+ - "all": all axes are labelled.
+
+ axes_class : subclass of `matplotlib.axes.Axes`, default: None
+ aspect : bool, default: False
+ Whether the axes aspect ratio follows the aspect ratio of the data
+ limits.
+ """
+ self._nrows, self._ncols = nrows_ncols
+
+ if ngrids is None:
+ ngrids = self._nrows * self._ncols
+ else:
+ if not 0 < ngrids <= self._nrows * self._ncols:
+ raise Exception("")
+
+ self.ngrids = ngrids
+
+ self._horiz_pad_size, self._vert_pad_size = map(
+ Size.Fixed, np.broadcast_to(axes_pad, 2))
+
+ _api.check_in_list(["column", "row"], direction=direction)
+ self._direction = direction
+
+ if axes_class is None:
+ axes_class = self._defaultAxesClass
+ elif isinstance(axes_class, (list, tuple)):
+ cls, kwargs = axes_class
+ axes_class = functools.partial(cls, **kwargs)
+
+ kw = dict(horizontal=[], vertical=[], aspect=aspect)
+ if isinstance(rect, (str, Number, SubplotSpec)):
+ self._divider = SubplotDivider(fig, rect, **kw)
+ elif len(rect) == 3:
+ self._divider = SubplotDivider(fig, *rect, **kw)
+ elif len(rect) == 4:
+ self._divider = Divider(fig, rect, **kw)
+ else:
+ raise Exception("")
+
+ rect = self._divider.get_position()
+
+ axes_array = np.full((self._nrows, self._ncols), None, dtype=object)
+ for i in range(self.ngrids):
+ col, row = self._get_col_row(i)
+ if share_all:
+ sharex = sharey = axes_array[0, 0]
+ else:
+ sharex = axes_array[0, col] if share_x else None
+ sharey = axes_array[row, 0] if share_y else None
+ axes_array[row, col] = axes_class(
+ fig, rect, sharex=sharex, sharey=sharey)
+ self.axes_all = axes_array.ravel().tolist()
+ self.axes_column = axes_array.T.tolist()
+ self.axes_row = axes_array.tolist()
+ self.axes_llc = self.axes_column[0][-1]
+
+ self._init_locators()
+
+ if add_all:
+ for ax in self.axes_all:
+ fig.add_axes(ax)
+
+ self.set_label_mode(label_mode)
+
+ def _init_locators(self):
+
+ h = []
+ h_ax_pos = []
+ for _ in range(self._ncols):
+ if h:
+ h.append(self._horiz_pad_size)
+ h_ax_pos.append(len(h))
+ sz = Size.Scaled(1)
+ h.append(sz)
+
+ v = []
+ v_ax_pos = []
+ for _ in range(self._nrows):
+ if v:
+ v.append(self._vert_pad_size)
+ v_ax_pos.append(len(v))
+ sz = Size.Scaled(1)
+ v.append(sz)
+
+ for i in range(self.ngrids):
+ col, row = self._get_col_row(i)
+ locator = self._divider.new_locator(
+ nx=h_ax_pos[col], ny=v_ax_pos[self._nrows - 1 - row])
+ self.axes_all[i].set_axes_locator(locator)
+
+ self._divider.set_horizontal(h)
+ self._divider.set_vertical(v)
+
+ def _get_col_row(self, n):
+ if self._direction == "column":
+ col, row = divmod(n, self._nrows)
+ else:
+ row, col = divmod(n, self._ncols)
+
+ return col, row
+
+ # Good to propagate __len__ if we have __getitem__
+ def __len__(self):
+ return len(self.axes_all)
+
+ def __getitem__(self, i):
+ return self.axes_all[i]
+
+ def get_geometry(self):
+ """
+ Return the number of rows and columns of the grid as (nrows, ncols).
+ """
+ return self._nrows, self._ncols
+
+ def set_axes_pad(self, axes_pad):
+ """
+ Set the padding between the axes.
+
+ Parameters
+ ----------
+ axes_pad : (float, float)
+ The padding (horizontal pad, vertical pad) in inches.
+ """
+ self._horiz_pad_size.fixed_size = axes_pad[0]
+ self._vert_pad_size.fixed_size = axes_pad[1]
+
+ def get_axes_pad(self):
+ """
+ Return the axes padding.
+
+ Returns
+ -------
+ hpad, vpad
+ Padding (horizontal pad, vertical pad) in inches.
+ """
+ return (self._horiz_pad_size.fixed_size,
+ self._vert_pad_size.fixed_size)
+
+ def set_aspect(self, aspect):
+ """Set the aspect of the SubplotDivider."""
+ self._divider.set_aspect(aspect)
+
+ def get_aspect(self):
+ """Return the aspect of the SubplotDivider."""
+ return self._divider.get_aspect()
+
+ def set_label_mode(self, mode):
+ """
+ Define which axes have tick labels.
+
+ Parameters
+ ----------
+ mode : {"L", "1", "all"}
+ The label mode:
+
+ - "L": All axes on the left column get vertical tick labels;
+ all axes on the bottom row get horizontal tick labels.
+ - "1": Only the bottom left axes is labelled.
+ - "all": all axes are labelled.
+ """
+ if mode == "all":
+ for ax in self.axes_all:
+ _tick_only(ax, False, False)
+ elif mode == "L":
+ # left-most axes
+ for ax in self.axes_column[0][:-1]:
+ _tick_only(ax, bottom_on=True, left_on=False)
+ # lower-left axes
+ ax = self.axes_column[0][-1]
+ _tick_only(ax, bottom_on=False, left_on=False)
+
+ for col in self.axes_column[1:]:
+ # axes with no labels
+ for ax in col[:-1]:
+ _tick_only(ax, bottom_on=True, left_on=True)
+
+ # bottom
+ ax = col[-1]
+ _tick_only(ax, bottom_on=False, left_on=True)
+
+ elif mode == "1":
+ for ax in self.axes_all:
+ _tick_only(ax, bottom_on=True, left_on=True)
+
+ ax = self.axes_llc
+ _tick_only(ax, bottom_on=False, left_on=False)
+
+ def get_divider(self):
+ return self._divider
+
+ def set_axes_locator(self, locator):
+ self._divider.set_locator(locator)
+
+ def get_axes_locator(self):
+ return self._divider.get_locator()
+
+ def get_vsize_hsize(self):
+ return self._divider.get_vsize_hsize()
+
+
+class ImageGrid(Grid):
+ # docstring inherited
+
+ _defaultCbarAxesClass = CbarAxes
+
+ @_api.delete_parameter("3.3", "add_all")
+ def __init__(self, fig,
+ rect,
+ nrows_ncols,
+ ngrids=None,
+ direction="row",
+ axes_pad=0.02,
+ add_all=True,
+ share_all=False,
+ aspect=True,
+ label_mode="L",
+ cbar_mode=None,
+ cbar_location="right",
+ cbar_pad=None,
+ cbar_size="5%",
+ cbar_set_cax=True,
+ axes_class=None,
+ ):
+ """
+ Parameters
+ ----------
+ fig : `.Figure`
+ The parent figure.
+ rect : (float, float, float, float) or int
+ The axes position, as a ``(left, bottom, width, height)`` tuple or
+ as a three-digit subplot position code (e.g., "121").
+ nrows_ncols : (int, int)
+ Number of rows and columns in the grid.
+ ngrids : int or None, default: None
+ If not None, only the first *ngrids* axes in the grid are created.
+ direction : {"row", "column"}, default: "row"
+ Whether axes are created in row-major ("row by row") or
+ column-major order ("column by column"). This also affects the
+ order in which axes are accessed using indexing (``grid[index]``).
+ axes_pad : float or (float, float), default: 0.02in
+ Padding or (horizontal padding, vertical padding) between axes, in
+ inches.
+ add_all : bool, default: True
+ Whether to add the axes to the figure using `.Figure.add_axes`.
+ This parameter is deprecated.
+ share_all : bool, default: False
+ Whether all axes share their x- and y-axis.
+ aspect : bool, default: True
+ Whether the axes aspect ratio follows the aspect ratio of the data
+ limits.
+ label_mode : {"L", "1", "all"}, default: "L"
+ Determines which axes will get tick labels:
+
+ - "L": All axes on the left column get vertical tick labels;
+ all axes on the bottom row get horizontal tick labels.
+ - "1": Only the bottom left axes is labelled.
+ - "all": all axes are labelled.
+
+ cbar_mode : {"each", "single", "edge", None}, default: None
+ Whether to create a colorbar for "each" axes, a "single" colorbar
+ for the entire grid, colorbars only for axes on the "edge"
+ determined by *cbar_location*, or no colorbars. The colorbars are
+ stored in the :attr:`cbar_axes` attribute.
+ cbar_location : {"left", "right", "bottom", "top"}, default: "right"
+ cbar_pad : float, default: None
+ Padding between the image axes and the colorbar axes.
+ cbar_size : size specification (see `.Size.from_any`), default: "5%"
+ Colorbar size.
+ cbar_set_cax : bool, default: True
+ If True, each axes in the grid has a *cax* attribute that is bound
+ to associated *cbar_axes*.
+ axes_class : subclass of `matplotlib.axes.Axes`, default: None
+ """
+ self._colorbar_mode = cbar_mode
+ self._colorbar_location = cbar_location
+ self._colorbar_pad = cbar_pad
+ self._colorbar_size = cbar_size
+ # The colorbar axes are created in _init_locators().
+
+ if add_all:
+ super().__init__(
+ fig, rect, nrows_ncols, ngrids,
+ direction=direction, axes_pad=axes_pad,
+ share_all=share_all, share_x=True, share_y=True, aspect=aspect,
+ label_mode=label_mode, axes_class=axes_class)
+ else: # Only show deprecation in that case.
+ super().__init__(
+ fig, rect, nrows_ncols, ngrids,
+ direction=direction, axes_pad=axes_pad, add_all=add_all,
+ share_all=share_all, share_x=True, share_y=True, aspect=aspect,
+ label_mode=label_mode, axes_class=axes_class)
+
+ if add_all:
+ for ax in self.cbar_axes:
+ fig.add_axes(ax)
+
+ if cbar_set_cax:
+ if self._colorbar_mode == "single":
+ for ax in self.axes_all:
+ ax.cax = self.cbar_axes[0]
+ elif self._colorbar_mode == "edge":
+ for index, ax in enumerate(self.axes_all):
+ col, row = self._get_col_row(index)
+ if self._colorbar_location in ("left", "right"):
+ ax.cax = self.cbar_axes[row]
+ else:
+ ax.cax = self.cbar_axes[col]
+ else:
+ for ax, cax in zip(self.axes_all, self.cbar_axes):
+ ax.cax = cax
+
+ def _init_locators(self):
+ # Slightly abusing this method to inject colorbar creation into init.
+
+ if self._colorbar_pad is None:
+ # horizontal or vertical arrangement?
+ if self._colorbar_location in ("left", "right"):
+ self._colorbar_pad = self._horiz_pad_size.fixed_size
+ else:
+ self._colorbar_pad = self._vert_pad_size.fixed_size
+ self.cbar_axes = [
+ self._defaultCbarAxesClass(
+ self.axes_all[0].figure, self._divider.get_position(),
+ orientation=self._colorbar_location)
+ for _ in range(self.ngrids)]
+
+ cb_mode = self._colorbar_mode
+ cb_location = self._colorbar_location
+
+ h = []
+ v = []
+
+ h_ax_pos = []
+ h_cb_pos = []
+ if cb_mode == "single" and cb_location in ("left", "bottom"):
+ if cb_location == "left":
+ sz = self._nrows * Size.AxesX(self.axes_llc)
+ h.append(Size.from_any(self._colorbar_size, sz))
+ h.append(Size.from_any(self._colorbar_pad, sz))
+ locator = self._divider.new_locator(nx=0, ny=0, ny1=-1)
+ elif cb_location == "bottom":
+ sz = self._ncols * Size.AxesY(self.axes_llc)
+ v.append(Size.from_any(self._colorbar_size, sz))
+ v.append(Size.from_any(self._colorbar_pad, sz))
+ locator = self._divider.new_locator(nx=0, nx1=-1, ny=0)
+ for i in range(self.ngrids):
+ self.cbar_axes[i].set_visible(False)
+ self.cbar_axes[0].set_axes_locator(locator)
+ self.cbar_axes[0].set_visible(True)
+
+ for col, ax in enumerate(self.axes_row[0]):
+ if h:
+ h.append(self._horiz_pad_size)
+
+ if ax:
+ sz = Size.AxesX(ax, aspect="axes", ref_ax=self.axes_all[0])
+ else:
+ sz = Size.AxesX(self.axes_all[0],
+ aspect="axes", ref_ax=self.axes_all[0])
+
+ if (cb_location == "left"
+ and (cb_mode == "each"
+ or (cb_mode == "edge" and col == 0))):
+ h_cb_pos.append(len(h))
+ h.append(Size.from_any(self._colorbar_size, sz))
+ h.append(Size.from_any(self._colorbar_pad, sz))
+
+ h_ax_pos.append(len(h))
+ h.append(sz)
+
+ if (cb_location == "right"
+ and (cb_mode == "each"
+ or (cb_mode == "edge" and col == self._ncols - 1))):
+ h.append(Size.from_any(self._colorbar_pad, sz))
+ h_cb_pos.append(len(h))
+ h.append(Size.from_any(self._colorbar_size, sz))
+
+ v_ax_pos = []
+ v_cb_pos = []
+ for row, ax in enumerate(self.axes_column[0][::-1]):
+ if v:
+ v.append(self._vert_pad_size)
+
+ if ax:
+ sz = Size.AxesY(ax, aspect="axes", ref_ax=self.axes_all[0])
+ else:
+ sz = Size.AxesY(self.axes_all[0],
+ aspect="axes", ref_ax=self.axes_all[0])
+
+ if (cb_location == "bottom"
+ and (cb_mode == "each"
+ or (cb_mode == "edge" and row == 0))):
+ v_cb_pos.append(len(v))
+ v.append(Size.from_any(self._colorbar_size, sz))
+ v.append(Size.from_any(self._colorbar_pad, sz))
+
+ v_ax_pos.append(len(v))
+ v.append(sz)
+
+ if (cb_location == "top"
+ and (cb_mode == "each"
+ or (cb_mode == "edge" and row == self._nrows - 1))):
+ v.append(Size.from_any(self._colorbar_pad, sz))
+ v_cb_pos.append(len(v))
+ v.append(Size.from_any(self._colorbar_size, sz))
+
+ for i in range(self.ngrids):
+ col, row = self._get_col_row(i)
+ locator = self._divider.new_locator(nx=h_ax_pos[col],
+ ny=v_ax_pos[self._nrows-1-row])
+ self.axes_all[i].set_axes_locator(locator)
+
+ if cb_mode == "each":
+ if cb_location in ("right", "left"):
+ locator = self._divider.new_locator(
+ nx=h_cb_pos[col], ny=v_ax_pos[self._nrows - 1 - row])
+
+ elif cb_location in ("top", "bottom"):
+ locator = self._divider.new_locator(
+ nx=h_ax_pos[col], ny=v_cb_pos[self._nrows - 1 - row])
+
+ self.cbar_axes[i].set_axes_locator(locator)
+ elif cb_mode == "edge":
+ if (cb_location == "left" and col == 0
+ or cb_location == "right" and col == self._ncols - 1):
+ locator = self._divider.new_locator(
+ nx=h_cb_pos[0], ny=v_ax_pos[self._nrows - 1 - row])
+ self.cbar_axes[row].set_axes_locator(locator)
+ elif (cb_location == "bottom" and row == self._nrows - 1
+ or cb_location == "top" and row == 0):
+ locator = self._divider.new_locator(nx=h_ax_pos[col],
+ ny=v_cb_pos[0])
+ self.cbar_axes[col].set_axes_locator(locator)
+
+ if cb_mode == "single":
+ if cb_location == "right":
+ sz = self._nrows * Size.AxesX(self.axes_llc)
+ h.append(Size.from_any(self._colorbar_pad, sz))
+ h.append(Size.from_any(self._colorbar_size, sz))
+ locator = self._divider.new_locator(nx=-2, ny=0, ny1=-1)
+ elif cb_location == "top":
+ sz = self._ncols * Size.AxesY(self.axes_llc)
+ v.append(Size.from_any(self._colorbar_pad, sz))
+ v.append(Size.from_any(self._colorbar_size, sz))
+ locator = self._divider.new_locator(nx=0, nx1=-1, ny=-2)
+ if cb_location in ("right", "top"):
+ for i in range(self.ngrids):
+ self.cbar_axes[i].set_visible(False)
+ self.cbar_axes[0].set_axes_locator(locator)
+ self.cbar_axes[0].set_visible(True)
+ elif cb_mode == "each":
+ for i in range(self.ngrids):
+ self.cbar_axes[i].set_visible(True)
+ elif cb_mode == "edge":
+ if cb_location in ("right", "left"):
+ count = self._nrows
+ else:
+ count = self._ncols
+ for i in range(count):
+ self.cbar_axes[i].set_visible(True)
+ for j in range(i + 1, self.ngrids):
+ self.cbar_axes[j].set_visible(False)
+ else:
+ for i in range(self.ngrids):
+ self.cbar_axes[i].set_visible(False)
+ self.cbar_axes[i].set_position([1., 1., 0.001, 0.001],
+ which="active")
+
+ self._divider.set_horizontal(h)
+ self._divider.set_vertical(v)
+
+
+AxesGrid = ImageGrid
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_rgb.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_rgb.py
new file mode 100644
index 0000000..b8cdf4d
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_rgb.py
@@ -0,0 +1,168 @@
+import numpy as np
+
+from matplotlib import _api
+from .axes_divider import make_axes_locatable, Size
+from .mpl_axes import Axes
+
+
+@_api.delete_parameter("3.3", "add_all")
+def make_rgb_axes(ax, pad=0.01, axes_class=None, add_all=True, **kwargs):
+ """
+ Parameters
+ ----------
+ pad : float
+ Fraction of the axes height.
+ """
+
+ divider = make_axes_locatable(ax)
+
+ pad_size = pad * Size.AxesY(ax)
+
+ xsize = ((1-2*pad)/3) * Size.AxesX(ax)
+ ysize = ((1-2*pad)/3) * Size.AxesY(ax)
+
+ divider.set_horizontal([Size.AxesX(ax), pad_size, xsize])
+ divider.set_vertical([ysize, pad_size, ysize, pad_size, ysize])
+
+ ax.set_axes_locator(divider.new_locator(0, 0, ny1=-1))
+
+ ax_rgb = []
+ if axes_class is None:
+ try:
+ axes_class = ax._axes_class
+ except AttributeError:
+ axes_class = type(ax)
+
+ for ny in [4, 2, 0]:
+ ax1 = axes_class(ax.get_figure(), ax.get_position(original=True),
+ sharex=ax, sharey=ax, **kwargs)
+ locator = divider.new_locator(nx=2, ny=ny)
+ ax1.set_axes_locator(locator)
+ for t in ax1.yaxis.get_ticklabels() + ax1.xaxis.get_ticklabels():
+ t.set_visible(False)
+ try:
+ for axis in ax1.axis.values():
+ axis.major_ticklabels.set_visible(False)
+ except AttributeError:
+ pass
+
+ ax_rgb.append(ax1)
+
+ if add_all:
+ fig = ax.get_figure()
+ for ax1 in ax_rgb:
+ fig.add_axes(ax1)
+
+ return ax_rgb
+
+
+@_api.deprecated("3.3", alternative="ax.imshow(np.dstack([r, g, b]))")
+def imshow_rgb(ax, r, g, b, **kwargs):
+ return ax.imshow(np.dstack([r, g, b]), **kwargs)
+
+
+class RGBAxes:
+ """
+ 4-panel imshow (RGB, R, G, B).
+
+ Layout:
+
+ +---------------+-----+
+ | | R |
+ + +-----+
+ | RGB | G |
+ + +-----+
+ | | B |
+ +---------------+-----+
+
+ Subclasses can override the ``_defaultAxesClass`` attribute.
+
+ Attributes
+ ----------
+ RGB : ``_defaultAxesClass``
+ The axes object for the three-channel imshow.
+ R : ``_defaultAxesClass``
+ The axes object for the red channel imshow.
+ G : ``_defaultAxesClass``
+ The axes object for the green channel imshow.
+ B : ``_defaultAxesClass``
+ The axes object for the blue channel imshow.
+ """
+
+ _defaultAxesClass = Axes
+
+ @_api.delete_parameter("3.3", "add_all")
+ def __init__(self, *args, pad=0, add_all=True, **kwargs):
+ """
+ Parameters
+ ----------
+ pad : float, default: 0
+ fraction of the axes height to put as padding.
+ add_all : bool, default: True
+ Whether to add the {rgb, r, g, b} axes to the figure.
+ This parameter is deprecated.
+ axes_class : matplotlib.axes.Axes
+
+ *args
+ Unpacked into axes_class() init for RGB
+ **kwargs
+ Unpacked into axes_class() init for RGB, R, G, B axes
+ """
+ axes_class = kwargs.pop("axes_class", self._defaultAxesClass)
+ self.RGB = ax = axes_class(*args, **kwargs)
+ if add_all:
+ ax.get_figure().add_axes(ax)
+ else:
+ kwargs["add_all"] = add_all # only show deprecation in that case
+ self.R, self.G, self.B = make_rgb_axes(
+ ax, pad=pad, axes_class=axes_class, **kwargs)
+ # Set the line color and ticks for the axes.
+ for ax1 in [self.RGB, self.R, self.G, self.B]:
+ ax1.axis[:].line.set_color("w")
+ ax1.axis[:].major_ticks.set_markeredgecolor("w")
+
+ @_api.deprecated("3.3")
+ def add_RGB_to_figure(self):
+ """Add red, green and blue axes to the RGB composite's axes figure."""
+ self.RGB.get_figure().add_axes(self.R)
+ self.RGB.get_figure().add_axes(self.G)
+ self.RGB.get_figure().add_axes(self.B)
+
+ def imshow_rgb(self, r, g, b, **kwargs):
+ """
+ Create the four images {rgb, r, g, b}.
+
+ Parameters
+ ----------
+ r, g, b : array-like
+ The red, green, and blue arrays.
+ kwargs : imshow kwargs
+ kwargs get unpacked into the imshow calls for the four images.
+
+ Returns
+ -------
+ rgb : matplotlib.image.AxesImage
+ r : matplotlib.image.AxesImage
+ g : matplotlib.image.AxesImage
+ b : matplotlib.image.AxesImage
+ """
+ if not (r.shape == g.shape == b.shape):
+ raise ValueError(
+ f'Input shapes ({r.shape}, {g.shape}, {b.shape}) do not match')
+ RGB = np.dstack([r, g, b])
+ R = np.zeros_like(RGB)
+ R[:, :, 0] = r
+ G = np.zeros_like(RGB)
+ G[:, :, 1] = g
+ B = np.zeros_like(RGB)
+ B[:, :, 2] = b
+ im_rgb = self.RGB.imshow(RGB, **kwargs)
+ im_r = self.R.imshow(R, **kwargs)
+ im_g = self.G.imshow(G, **kwargs)
+ im_b = self.B.imshow(B, **kwargs)
+ return im_rgb, im_r, im_g, im_b
+
+
+@_api.deprecated("3.3", alternative="RGBAxes")
+class RGBAxesBase(RGBAxes):
+ pass
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_size.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_size.py
new file mode 100644
index 0000000..87bc241
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_size.py
@@ -0,0 +1,272 @@
+"""
+Provides classes of simple units that will be used with AxesDivider
+class (or others) to determine the size of each axes. The unit
+classes define `get_size` method that returns a tuple of two floats,
+meaning relative and absolute sizes, respectively.
+
+Note that this class is nothing more than a simple tuple of two
+floats. Take a look at the Divider class to see how these two
+values are used.
+"""
+
+from numbers import Number
+
+from matplotlib import _api
+from matplotlib.axes import Axes
+
+
+class _Base:
+
+ def __rmul__(self, other):
+ return Fraction(other, self)
+
+ def __add__(self, other):
+ if isinstance(other, _Base):
+ return Add(self, other)
+ else:
+ return Add(self, Fixed(other))
+
+
+class Add(_Base):
+ def __init__(self, a, b):
+ self._a = a
+ self._b = b
+
+ def get_size(self, renderer):
+ a_rel_size, a_abs_size = self._a.get_size(renderer)
+ b_rel_size, b_abs_size = self._b.get_size(renderer)
+ return a_rel_size + b_rel_size, a_abs_size + b_abs_size
+
+
+class AddList(_Base):
+ def __init__(self, add_list):
+ self._list = add_list
+
+ def get_size(self, renderer):
+ sum_rel_size = sum([a.get_size(renderer)[0] for a in self._list])
+ sum_abs_size = sum([a.get_size(renderer)[1] for a in self._list])
+ return sum_rel_size, sum_abs_size
+
+
+class Fixed(_Base):
+ """
+ Simple fixed size with absolute part = *fixed_size* and relative part = 0.
+ """
+
+ def __init__(self, fixed_size):
+ _api.check_isinstance(Number, fixed_size=fixed_size)
+ self.fixed_size = fixed_size
+
+ def get_size(self, renderer):
+ rel_size = 0.
+ abs_size = self.fixed_size
+ return rel_size, abs_size
+
+
+class Scaled(_Base):
+ """
+ Simple scaled(?) size with absolute part = 0 and
+ relative part = *scalable_size*.
+ """
+
+ def __init__(self, scalable_size):
+ self._scalable_size = scalable_size
+
+ def get_size(self, renderer):
+ rel_size = self._scalable_size
+ abs_size = 0.
+ return rel_size, abs_size
+
+Scalable = Scaled
+
+
+def _get_axes_aspect(ax):
+ aspect = ax.get_aspect()
+ if aspect == "auto":
+ aspect = 1.
+ return aspect
+
+
+class AxesX(_Base):
+ """
+ Scaled size whose relative part corresponds to the data width
+ of the *axes* multiplied by the *aspect*.
+ """
+
+ def __init__(self, axes, aspect=1., ref_ax=None):
+ self._axes = axes
+ self._aspect = aspect
+ if aspect == "axes" and ref_ax is None:
+ raise ValueError("ref_ax must be set when aspect='axes'")
+ self._ref_ax = ref_ax
+
+ def get_size(self, renderer):
+ l1, l2 = self._axes.get_xlim()
+ if self._aspect == "axes":
+ ref_aspect = _get_axes_aspect(self._ref_ax)
+ aspect = ref_aspect / _get_axes_aspect(self._axes)
+ else:
+ aspect = self._aspect
+
+ rel_size = abs(l2-l1)*aspect
+ abs_size = 0.
+ return rel_size, abs_size
+
+
+class AxesY(_Base):
+ """
+ Scaled size whose relative part corresponds to the data height
+ of the *axes* multiplied by the *aspect*.
+ """
+
+ def __init__(self, axes, aspect=1., ref_ax=None):
+ self._axes = axes
+ self._aspect = aspect
+ if aspect == "axes" and ref_ax is None:
+ raise ValueError("ref_ax must be set when aspect='axes'")
+ self._ref_ax = ref_ax
+
+ def get_size(self, renderer):
+ l1, l2 = self._axes.get_ylim()
+
+ if self._aspect == "axes":
+ ref_aspect = _get_axes_aspect(self._ref_ax)
+ aspect = _get_axes_aspect(self._axes)
+ else:
+ aspect = self._aspect
+
+ rel_size = abs(l2-l1)*aspect
+ abs_size = 0.
+ return rel_size, abs_size
+
+
+class MaxExtent(_Base):
+ """
+ Size whose absolute part is either the largest width or the largest height
+ of the given *artist_list*.
+ """
+
+ def __init__(self, artist_list, w_or_h):
+ self._artist_list = artist_list
+ _api.check_in_list(["width", "height"], w_or_h=w_or_h)
+ self._w_or_h = w_or_h
+
+ def add_artist(self, a):
+ self._artist_list.append(a)
+
+ def get_size(self, renderer):
+ rel_size = 0.
+ extent_list = [
+ getattr(a.get_window_extent(renderer), self._w_or_h) / a.figure.dpi
+ for a in self._artist_list]
+ abs_size = max(extent_list, default=0)
+ return rel_size, abs_size
+
+
+class MaxWidth(MaxExtent):
+ """
+ Size whose absolute part is the largest width of the given *artist_list*.
+ """
+
+ def __init__(self, artist_list):
+ super().__init__(artist_list, "width")
+
+
+class MaxHeight(MaxExtent):
+ """
+ Size whose absolute part is the largest height of the given *artist_list*.
+ """
+
+ def __init__(self, artist_list):
+ super().__init__(artist_list, "height")
+
+
+class Fraction(_Base):
+ """
+ An instance whose size is a *fraction* of the *ref_size*.
+
+ >>> s = Fraction(0.3, AxesX(ax))
+ """
+
+ def __init__(self, fraction, ref_size):
+ _api.check_isinstance(Number, fraction=fraction)
+ self._fraction_ref = ref_size
+ self._fraction = fraction
+
+ def get_size(self, renderer):
+ if self._fraction_ref is None:
+ return self._fraction, 0.
+ else:
+ r, a = self._fraction_ref.get_size(renderer)
+ rel_size = r*self._fraction
+ abs_size = a*self._fraction
+ return rel_size, abs_size
+
+
+class Padded(_Base):
+ """
+ Return a instance where the absolute part of *size* is
+ increase by the amount of *pad*.
+ """
+
+ def __init__(self, size, pad):
+ self._size = size
+ self._pad = pad
+
+ def get_size(self, renderer):
+ r, a = self._size.get_size(renderer)
+ rel_size = r
+ abs_size = a + self._pad
+ return rel_size, abs_size
+
+
+def from_any(size, fraction_ref=None):
+ """
+ Create a Fixed unit when the first argument is a float, or a
+ Fraction unit if that is a string that ends with %. The second
+ argument is only meaningful when Fraction unit is created.
+
+ >>> a = Size.from_any(1.2) # => Size.Fixed(1.2)
+ >>> Size.from_any("50%", a) # => Size.Fraction(0.5, a)
+ """
+ if isinstance(size, Number):
+ return Fixed(size)
+ elif isinstance(size, str):
+ if size[-1] == "%":
+ return Fraction(float(size[:-1]) / 100, fraction_ref)
+ raise ValueError("Unknown format")
+
+
+class SizeFromFunc(_Base):
+ def __init__(self, func):
+ self._func = func
+
+ def get_size(self, renderer):
+ rel_size = 0.
+
+ bb = self._func(renderer)
+ dpi = renderer.points_to_pixels(72.)
+ abs_size = bb/dpi
+
+ return rel_size, abs_size
+
+
+class GetExtentHelper:
+ _get_func_map = {
+ "left": lambda self, axes_bbox: axes_bbox.xmin - self.xmin,
+ "right": lambda self, axes_bbox: self.xmax - axes_bbox.xmax,
+ "bottom": lambda self, axes_bbox: axes_bbox.ymin - self.ymin,
+ "top": lambda self, axes_bbox: self.ymax - axes_bbox.ymax,
+ }
+
+ def __init__(self, ax, direction):
+ _api.check_in_list(self._get_func_map, direction=direction)
+ self._ax_list = [ax] if isinstance(ax, Axes) else ax
+ self._direction = direction
+
+ def __call__(self, renderer):
+ get_func = self._get_func_map[self._direction]
+ vl = [get_func(ax.get_tightbbox(renderer, call_axes_locator=False),
+ ax.bbox)
+ for ax in self._ax_list]
+ return max(vl)
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid1/inset_locator.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/inset_locator.py
new file mode 100644
index 0000000..4af827e
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/inset_locator.py
@@ -0,0 +1,652 @@
+"""
+A collection of functions and objects for creating or placing inset axes.
+"""
+
+from matplotlib import _api, docstring
+from matplotlib.offsetbox import AnchoredOffsetbox
+from matplotlib.patches import Patch, Rectangle
+from matplotlib.path import Path
+from matplotlib.transforms import Bbox, BboxTransformTo
+from matplotlib.transforms import IdentityTransform, TransformedBbox
+
+from . import axes_size as Size
+from .parasite_axes import HostAxes
+
+
+class InsetPosition:
+ @docstring.dedent_interpd
+ def __init__(self, parent, lbwh):
+ """
+ An object for positioning an inset axes.
+
+ This is created by specifying the normalized coordinates in the axes,
+ instead of the figure.
+
+ Parameters
+ ----------
+ parent : `matplotlib.axes.Axes`
+ Axes to use for normalizing coordinates.
+
+ lbwh : iterable of four floats
+ The left edge, bottom edge, width, and height of the inset axes, in
+ units of the normalized coordinate of the *parent* axes.
+
+ See Also
+ --------
+ :meth:`matplotlib.axes.Axes.set_axes_locator`
+
+ Examples
+ --------
+ The following bounds the inset axes to a box with 20%% of the parent
+ axes's height and 40%% of the width. The size of the axes specified
+ ([0, 0, 1, 1]) ensures that the axes completely fills the bounding box:
+
+ >>> parent_axes = plt.gca()
+ >>> ax_ins = plt.axes([0, 0, 1, 1])
+ >>> ip = InsetPosition(ax, [0.5, 0.1, 0.4, 0.2])
+ >>> ax_ins.set_axes_locator(ip)
+ """
+ self.parent = parent
+ self.lbwh = lbwh
+
+ def __call__(self, ax, renderer):
+ bbox_parent = self.parent.get_position(original=False)
+ trans = BboxTransformTo(bbox_parent)
+ bbox_inset = Bbox.from_bounds(*self.lbwh)
+ bb = TransformedBbox(bbox_inset, trans)
+ return bb
+
+
+class AnchoredLocatorBase(AnchoredOffsetbox):
+ def __init__(self, bbox_to_anchor, offsetbox, loc,
+ borderpad=0.5, bbox_transform=None):
+ super().__init__(
+ loc, pad=0., child=None, borderpad=borderpad,
+ bbox_to_anchor=bbox_to_anchor, bbox_transform=bbox_transform
+ )
+
+ def draw(self, renderer):
+ raise RuntimeError("No draw method should be called")
+
+ def __call__(self, ax, renderer):
+ self.axes = ax
+
+ fontsize = renderer.points_to_pixels(self.prop.get_size_in_points())
+ self._update_offset_func(renderer, fontsize)
+
+ width, height, xdescent, ydescent = self.get_extent(renderer)
+
+ px, py = self.get_offset(width, height, 0, 0, renderer)
+ bbox_canvas = Bbox.from_bounds(px, py, width, height)
+ tr = ax.figure.transFigure.inverted()
+ bb = TransformedBbox(bbox_canvas, tr)
+
+ return bb
+
+
+class AnchoredSizeLocator(AnchoredLocatorBase):
+ def __init__(self, bbox_to_anchor, x_size, y_size, loc,
+ borderpad=0.5, bbox_transform=None):
+ super().__init__(
+ bbox_to_anchor, None, loc,
+ borderpad=borderpad, bbox_transform=bbox_transform
+ )
+
+ self.x_size = Size.from_any(x_size)
+ self.y_size = Size.from_any(y_size)
+
+ def get_extent(self, renderer):
+ bbox = self.get_bbox_to_anchor()
+ dpi = renderer.points_to_pixels(72.)
+
+ r, a = self.x_size.get_size(renderer)
+ width = bbox.width * r + a * dpi
+ r, a = self.y_size.get_size(renderer)
+ height = bbox.height * r + a * dpi
+
+ xd, yd = 0, 0
+
+ fontsize = renderer.points_to_pixels(self.prop.get_size_in_points())
+ pad = self.pad * fontsize
+
+ return width + 2 * pad, height + 2 * pad, xd + pad, yd + pad
+
+
+class AnchoredZoomLocator(AnchoredLocatorBase):
+ def __init__(self, parent_axes, zoom, loc,
+ borderpad=0.5,
+ bbox_to_anchor=None,
+ bbox_transform=None):
+ self.parent_axes = parent_axes
+ self.zoom = zoom
+ if bbox_to_anchor is None:
+ bbox_to_anchor = parent_axes.bbox
+ super().__init__(
+ bbox_to_anchor, None, loc, borderpad=borderpad,
+ bbox_transform=bbox_transform)
+
+ def get_extent(self, renderer):
+ bb = TransformedBbox(self.axes.viewLim, self.parent_axes.transData)
+ fontsize = renderer.points_to_pixels(self.prop.get_size_in_points())
+ pad = self.pad * fontsize
+ return (abs(bb.width * self.zoom) + 2 * pad,
+ abs(bb.height * self.zoom) + 2 * pad,
+ pad, pad)
+
+
+class BboxPatch(Patch):
+ @docstring.dedent_interpd
+ def __init__(self, bbox, **kwargs):
+ """
+ Patch showing the shape bounded by a Bbox.
+
+ Parameters
+ ----------
+ bbox : `matplotlib.transforms.Bbox`
+ Bbox to use for the extents of this patch.
+
+ **kwargs
+ Patch properties. Valid arguments include:
+
+ %(Patch_kwdoc)s
+ """
+ if "transform" in kwargs:
+ raise ValueError("transform should not be set")
+
+ kwargs["transform"] = IdentityTransform()
+ super().__init__(**kwargs)
+ self.bbox = bbox
+
+ def get_path(self):
+ # docstring inherited
+ x0, y0, x1, y1 = self.bbox.extents
+ return Path([(x0, y0), (x1, y0), (x1, y1), (x0, y1), (x0, y0)],
+ closed=True)
+
+
+class BboxConnector(Patch):
+ @staticmethod
+ def get_bbox_edge_pos(bbox, loc):
+ """
+ Helper function to obtain the location of a corner of a bbox
+
+ Parameters
+ ----------
+ bbox : `matplotlib.transforms.Bbox`
+
+ loc : {1, 2, 3, 4}
+ Corner of *bbox*. Valid values are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4
+
+ Returns
+ -------
+ x, y : float
+ Coordinates of the corner specified by *loc*.
+ """
+ x0, y0, x1, y1 = bbox.extents
+ if loc == 1:
+ return x1, y1
+ elif loc == 2:
+ return x0, y1
+ elif loc == 3:
+ return x0, y0
+ elif loc == 4:
+ return x1, y0
+
+ @staticmethod
+ def connect_bbox(bbox1, bbox2, loc1, loc2=None):
+ """
+ Helper function to obtain a Path from one bbox to another.
+
+ Parameters
+ ----------
+ bbox1, bbox2 : `matplotlib.transforms.Bbox`
+ Bounding boxes to connect.
+
+ loc1 : {1, 2, 3, 4}
+ Corner of *bbox1* to use. Valid values are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4
+
+ loc2 : {1, 2, 3, 4}, optional
+ Corner of *bbox2* to use. If None, defaults to *loc1*.
+ Valid values are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4
+
+ Returns
+ -------
+ path : `matplotlib.path.Path`
+ A line segment from the *loc1* corner of *bbox1* to the *loc2*
+ corner of *bbox2*.
+ """
+ if isinstance(bbox1, Rectangle):
+ bbox1 = TransformedBbox(Bbox.unit(), bbox1.get_transform())
+ if isinstance(bbox2, Rectangle):
+ bbox2 = TransformedBbox(Bbox.unit(), bbox2.get_transform())
+ if loc2 is None:
+ loc2 = loc1
+ x1, y1 = BboxConnector.get_bbox_edge_pos(bbox1, loc1)
+ x2, y2 = BboxConnector.get_bbox_edge_pos(bbox2, loc2)
+ return Path([[x1, y1], [x2, y2]])
+
+ @docstring.dedent_interpd
+ def __init__(self, bbox1, bbox2, loc1, loc2=None, **kwargs):
+ """
+ Connect two bboxes with a straight line.
+
+ Parameters
+ ----------
+ bbox1, bbox2 : `matplotlib.transforms.Bbox`
+ Bounding boxes to connect.
+
+ loc1 : {1, 2, 3, 4}
+ Corner of *bbox1* to draw the line. Valid values are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4
+
+ loc2 : {1, 2, 3, 4}, optional
+ Corner of *bbox2* to draw the line. If None, defaults to *loc1*.
+ Valid values are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4
+
+ **kwargs
+ Patch properties for the line drawn. Valid arguments include:
+
+ %(Patch_kwdoc)s
+ """
+ if "transform" in kwargs:
+ raise ValueError("transform should not be set")
+
+ kwargs["transform"] = IdentityTransform()
+ if 'fill' in kwargs:
+ super().__init__(**kwargs)
+ else:
+ fill = bool({'fc', 'facecolor', 'color'}.intersection(kwargs))
+ super().__init__(fill=fill, **kwargs)
+ self.bbox1 = bbox1
+ self.bbox2 = bbox2
+ self.loc1 = loc1
+ self.loc2 = loc2
+
+ def get_path(self):
+ # docstring inherited
+ return self.connect_bbox(self.bbox1, self.bbox2,
+ self.loc1, self.loc2)
+
+
+class BboxConnectorPatch(BboxConnector):
+ @docstring.dedent_interpd
+ def __init__(self, bbox1, bbox2, loc1a, loc2a, loc1b, loc2b, **kwargs):
+ """
+ Connect two bboxes with a quadrilateral.
+
+ The quadrilateral is specified by two lines that start and end at
+ corners of the bboxes. The four sides of the quadrilateral are defined
+ by the two lines given, the line between the two corners specified in
+ *bbox1* and the line between the two corners specified in *bbox2*.
+
+ Parameters
+ ----------
+ bbox1, bbox2 : `matplotlib.transforms.Bbox`
+ Bounding boxes to connect.
+
+ loc1a, loc2a : {1, 2, 3, 4}
+ Corners of *bbox1* and *bbox2* to draw the first line.
+ Valid values are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4
+
+ loc1b, loc2b : {1, 2, 3, 4}
+ Corners of *bbox1* and *bbox2* to draw the second line.
+ Valid values are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4
+
+ **kwargs
+ Patch properties for the line drawn:
+
+ %(Patch_kwdoc)s
+ """
+ if "transform" in kwargs:
+ raise ValueError("transform should not be set")
+ super().__init__(bbox1, bbox2, loc1a, loc2a, **kwargs)
+ self.loc1b = loc1b
+ self.loc2b = loc2b
+
+ def get_path(self):
+ # docstring inherited
+ path1 = self.connect_bbox(self.bbox1, self.bbox2, self.loc1, self.loc2)
+ path2 = self.connect_bbox(self.bbox2, self.bbox1,
+ self.loc2b, self.loc1b)
+ path_merged = [*path1.vertices, *path2.vertices, path1.vertices[0]]
+ return Path(path_merged)
+
+
+def _add_inset_axes(parent_axes, inset_axes):
+ """Helper function to add an inset axes and disable navigation in it"""
+ parent_axes.figure.add_axes(inset_axes)
+ inset_axes.set_navigate(False)
+
+
+@docstring.dedent_interpd
+def inset_axes(parent_axes, width, height, loc='upper right',
+ bbox_to_anchor=None, bbox_transform=None,
+ axes_class=None,
+ axes_kwargs=None,
+ borderpad=0.5):
+ """
+ Create an inset axes with a given width and height.
+
+ Both sizes used can be specified either in inches or percentage.
+ For example,::
+
+ inset_axes(parent_axes, width='40%%', height='30%%', loc=3)
+
+ creates in inset axes in the lower left corner of *parent_axes* which spans
+ over 30%% in height and 40%% in width of the *parent_axes*. Since the usage
+ of `.inset_axes` may become slightly tricky when exceeding such standard
+ cases, it is recommended to read :doc:`the examples
+ `.
+
+ Notes
+ -----
+ The meaning of *bbox_to_anchor* and *bbox_to_transform* is interpreted
+ differently from that of legend. The value of bbox_to_anchor
+ (or the return value of its get_points method; the default is
+ *parent_axes.bbox*) is transformed by the bbox_transform (the default
+ is Identity transform) and then interpreted as points in the pixel
+ coordinate (which is dpi dependent).
+
+ Thus, following three calls are identical and creates an inset axes
+ with respect to the *parent_axes*::
+
+ axins = inset_axes(parent_axes, "30%%", "40%%")
+ axins = inset_axes(parent_axes, "30%%", "40%%",
+ bbox_to_anchor=parent_axes.bbox)
+ axins = inset_axes(parent_axes, "30%%", "40%%",
+ bbox_to_anchor=(0, 0, 1, 1),
+ bbox_transform=parent_axes.transAxes)
+
+ Parameters
+ ----------
+ parent_axes : `matplotlib.axes.Axes`
+ Axes to place the inset axes.
+
+ width, height : float or str
+ Size of the inset axes to create. If a float is provided, it is
+ the size in inches, e.g. *width=1.3*. If a string is provided, it is
+ the size in relative units, e.g. *width='40%%'*. By default, i.e. if
+ neither *bbox_to_anchor* nor *bbox_transform* are specified, those
+ are relative to the parent_axes. Otherwise they are to be understood
+ relative to the bounding box provided via *bbox_to_anchor*.
+
+ loc : int or str, default: 1
+ Location to place the inset axes. The valid locations are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4,
+ 'right' : 5,
+ 'center left' : 6,
+ 'center right' : 7,
+ 'lower center' : 8,
+ 'upper center' : 9,
+ 'center' : 10
+
+ bbox_to_anchor : tuple or `matplotlib.transforms.BboxBase`, optional
+ Bbox that the inset axes will be anchored to. If None,
+ a tuple of (0, 0, 1, 1) is used if *bbox_transform* is set
+ to *parent_axes.transAxes* or *parent_axes.figure.transFigure*.
+ Otherwise, *parent_axes.bbox* is used. If a tuple, can be either
+ [left, bottom, width, height], or [left, bottom].
+ If the kwargs *width* and/or *height* are specified in relative units,
+ the 2-tuple [left, bottom] cannot be used. Note that,
+ unless *bbox_transform* is set, the units of the bounding box
+ are interpreted in the pixel coordinate. When using *bbox_to_anchor*
+ with tuple, it almost always makes sense to also specify
+ a *bbox_transform*. This might often be the axes transform
+ *parent_axes.transAxes*.
+
+ bbox_transform : `matplotlib.transforms.Transform`, optional
+ Transformation for the bbox that contains the inset axes.
+ If None, a `.transforms.IdentityTransform` is used. The value
+ of *bbox_to_anchor* (or the return value of its get_points method)
+ is transformed by the *bbox_transform* and then interpreted
+ as points in the pixel coordinate (which is dpi dependent).
+ You may provide *bbox_to_anchor* in some normalized coordinate,
+ and give an appropriate transform (e.g., *parent_axes.transAxes*).
+
+ axes_class : `matplotlib.axes.Axes` type, optional
+ If specified, the inset axes created will be created with this class's
+ constructor.
+
+ axes_kwargs : dict, optional
+ Keyworded arguments to pass to the constructor of the inset axes.
+ Valid arguments include:
+
+ %(Axes_kwdoc)s
+
+ borderpad : float, default: 0.5
+ Padding between inset axes and the bbox_to_anchor.
+ The units are axes font size, i.e. for a default font size of 10 points
+ *borderpad = 0.5* is equivalent to a padding of 5 points.
+
+ Returns
+ -------
+ inset_axes : *axes_class*
+ Inset axes object created.
+ """
+
+ if axes_class is None:
+ axes_class = HostAxes
+
+ if axes_kwargs is None:
+ inset_axes = axes_class(parent_axes.figure, parent_axes.get_position())
+ else:
+ inset_axes = axes_class(parent_axes.figure, parent_axes.get_position(),
+ **axes_kwargs)
+
+ if bbox_transform in [parent_axes.transAxes,
+ parent_axes.figure.transFigure]:
+ if bbox_to_anchor is None:
+ _api.warn_external("Using the axes or figure transform requires a "
+ "bounding box in the respective coordinates. "
+ "Using bbox_to_anchor=(0, 0, 1, 1) now.")
+ bbox_to_anchor = (0, 0, 1, 1)
+
+ if bbox_to_anchor is None:
+ bbox_to_anchor = parent_axes.bbox
+
+ if (isinstance(bbox_to_anchor, tuple) and
+ (isinstance(width, str) or isinstance(height, str))):
+ if len(bbox_to_anchor) != 4:
+ raise ValueError("Using relative units for width or height "
+ "requires to provide a 4-tuple or a "
+ "`Bbox` instance to `bbox_to_anchor.")
+
+ axes_locator = AnchoredSizeLocator(bbox_to_anchor,
+ width, height,
+ loc=loc,
+ bbox_transform=bbox_transform,
+ borderpad=borderpad)
+
+ inset_axes.set_axes_locator(axes_locator)
+
+ _add_inset_axes(parent_axes, inset_axes)
+
+ return inset_axes
+
+
+@docstring.dedent_interpd
+def zoomed_inset_axes(parent_axes, zoom, loc='upper right',
+ bbox_to_anchor=None, bbox_transform=None,
+ axes_class=None,
+ axes_kwargs=None,
+ borderpad=0.5):
+ """
+ Create an anchored inset axes by scaling a parent axes. For usage, also see
+ :doc:`the examples `.
+
+ Parameters
+ ----------
+ parent_axes : `matplotlib.axes.Axes`
+ Axes to place the inset axes.
+
+ zoom : float
+ Scaling factor of the data axes. *zoom* > 1 will enlargen the
+ coordinates (i.e., "zoomed in"), while *zoom* < 1 will shrink the
+ coordinates (i.e., "zoomed out").
+
+ loc : int or str, default: 'upper right'
+ Location to place the inset axes. The valid locations are::
+
+ 'upper right' : 1,
+ 'upper left' : 2,
+ 'lower left' : 3,
+ 'lower right' : 4,
+ 'right' : 5,
+ 'center left' : 6,
+ 'center right' : 7,
+ 'lower center' : 8,
+ 'upper center' : 9,
+ 'center' : 10
+
+ bbox_to_anchor : tuple or `matplotlib.transforms.BboxBase`, optional
+ Bbox that the inset axes will be anchored to. If None,
+ *parent_axes.bbox* is used. If a tuple, can be either
+ [left, bottom, width, height], or [left, bottom].
+ If the kwargs *width* and/or *height* are specified in relative units,
+ the 2-tuple [left, bottom] cannot be used. Note that
+ the units of the bounding box are determined through the transform
+ in use. When using *bbox_to_anchor* it almost always makes sense to
+ also specify a *bbox_transform*. This might often be the axes transform
+ *parent_axes.transAxes*.
+
+ bbox_transform : `matplotlib.transforms.Transform`, optional
+ Transformation for the bbox that contains the inset axes.
+ If None, a `.transforms.IdentityTransform` is used (i.e. pixel
+ coordinates). This is useful when not providing any argument to
+ *bbox_to_anchor*. When using *bbox_to_anchor* it almost always makes
+ sense to also specify a *bbox_transform*. This might often be the
+ axes transform *parent_axes.transAxes*. Inversely, when specifying
+ the axes- or figure-transform here, be aware that not specifying
+ *bbox_to_anchor* will use *parent_axes.bbox*, the units of which are
+ in display (pixel) coordinates.
+
+ axes_class : `matplotlib.axes.Axes` type, optional
+ If specified, the inset axes created will be created with this class's
+ constructor.
+
+ axes_kwargs : dict, optional
+ Keyworded arguments to pass to the constructor of the inset axes.
+ Valid arguments include:
+
+ %(Axes_kwdoc)s
+
+ borderpad : float, default: 0.5
+ Padding between inset axes and the bbox_to_anchor.
+ The units are axes font size, i.e. for a default font size of 10 points
+ *borderpad = 0.5* is equivalent to a padding of 5 points.
+
+ Returns
+ -------
+ inset_axes : *axes_class*
+ Inset axes object created.
+ """
+
+ if axes_class is None:
+ axes_class = HostAxes
+
+ if axes_kwargs is None:
+ inset_axes = axes_class(parent_axes.figure, parent_axes.get_position())
+ else:
+ inset_axes = axes_class(parent_axes.figure, parent_axes.get_position(),
+ **axes_kwargs)
+
+ axes_locator = AnchoredZoomLocator(parent_axes, zoom=zoom, loc=loc,
+ bbox_to_anchor=bbox_to_anchor,
+ bbox_transform=bbox_transform,
+ borderpad=borderpad)
+ inset_axes.set_axes_locator(axes_locator)
+
+ _add_inset_axes(parent_axes, inset_axes)
+
+ return inset_axes
+
+
+@docstring.dedent_interpd
+def mark_inset(parent_axes, inset_axes, loc1, loc2, **kwargs):
+ """
+ Draw a box to mark the location of an area represented by an inset axes.
+
+ This function draws a box in *parent_axes* at the bounding box of
+ *inset_axes*, and shows a connection with the inset axes by drawing lines
+ at the corners, giving a "zoomed in" effect.
+
+ Parameters
+ ----------
+ parent_axes : `matplotlib.axes.Axes`
+ Axes which contains the area of the inset axes.
+
+ inset_axes : `matplotlib.axes.Axes`
+ The inset axes.
+
+ loc1, loc2 : {1, 2, 3, 4}
+ Corners to use for connecting the inset axes and the area in the
+ parent axes.
+
+ **kwargs
+ Patch properties for the lines and box drawn:
+
+ %(Patch_kwdoc)s
+
+ Returns
+ -------
+ pp : `matplotlib.patches.Patch`
+ The patch drawn to represent the area of the inset axes.
+
+ p1, p2 : `matplotlib.patches.Patch`
+ The patches connecting two corners of the inset axes and its area.
+ """
+ rect = TransformedBbox(inset_axes.viewLim, parent_axes.transData)
+
+ if 'fill' in kwargs:
+ pp = BboxPatch(rect, **kwargs)
+ else:
+ fill = bool({'fc', 'facecolor', 'color'}.intersection(kwargs))
+ pp = BboxPatch(rect, fill=fill, **kwargs)
+ parent_axes.add_patch(pp)
+
+ p1 = BboxConnector(inset_axes.bbox, rect, loc1=loc1, **kwargs)
+ inset_axes.add_patch(p1)
+ p1.set_clip_on(False)
+ p2 = BboxConnector(inset_axes.bbox, rect, loc1=loc2, **kwargs)
+ inset_axes.add_patch(p2)
+ p2.set_clip_on(False)
+
+ return pp, p1, p2
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid1/mpl_axes.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/mpl_axes.py
new file mode 100644
index 0000000..3bb7377
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/mpl_axes.py
@@ -0,0 +1,134 @@
+import matplotlib.axes as maxes
+from matplotlib.artist import Artist
+from matplotlib.axis import XAxis, YAxis
+
+
+class SimpleChainedObjects:
+ def __init__(self, objects):
+ self._objects = objects
+
+ def __getattr__(self, k):
+ _a = SimpleChainedObjects([getattr(a, k) for a in self._objects])
+ return _a
+
+ def __call__(self, *args, **kwargs):
+ for m in self._objects:
+ m(*args, **kwargs)
+
+
+class Axes(maxes.Axes):
+
+ class AxisDict(dict):
+ def __init__(self, axes):
+ self.axes = axes
+ super().__init__()
+
+ def __getitem__(self, k):
+ if isinstance(k, tuple):
+ r = SimpleChainedObjects(
+ # super() within a list comprehension needs explicit args.
+ [super(Axes.AxisDict, self).__getitem__(k1) for k1 in k])
+ return r
+ elif isinstance(k, slice):
+ if k.start is None and k.stop is None and k.step is None:
+ return SimpleChainedObjects(list(self.values()))
+ else:
+ raise ValueError("Unsupported slice")
+ else:
+ return dict.__getitem__(self, k)
+
+ def __call__(self, *v, **kwargs):
+ return maxes.Axes.axis(self.axes, *v, **kwargs)
+
+ def _init_axis_artists(self, axes=None):
+ if axes is None:
+ axes = self
+ self._axislines = self.AxisDict(self)
+ self._axislines.update(
+ bottom=SimpleAxisArtist(self.xaxis, 1, self.spines["bottom"]),
+ top=SimpleAxisArtist(self.xaxis, 2, self.spines["top"]),
+ left=SimpleAxisArtist(self.yaxis, 1, self.spines["left"]),
+ right=SimpleAxisArtist(self.yaxis, 2, self.spines["right"]))
+
+ @property
+ def axis(self):
+ return self._axislines
+
+ def cla(self):
+ super().cla()
+ self._init_axis_artists()
+
+
+class SimpleAxisArtist(Artist):
+ def __init__(self, axis, axisnum, spine):
+ self._axis = axis
+ self._axisnum = axisnum
+ self.line = spine
+
+ if isinstance(axis, XAxis):
+ self._axis_direction = ["bottom", "top"][axisnum-1]
+ elif isinstance(axis, YAxis):
+ self._axis_direction = ["left", "right"][axisnum-1]
+ else:
+ raise ValueError(
+ f"axis must be instance of XAxis or YAxis, but got {axis}")
+ super().__init__()
+
+ @property
+ def major_ticks(self):
+ tickline = "tick%dline" % self._axisnum
+ return SimpleChainedObjects([getattr(tick, tickline)
+ for tick in self._axis.get_major_ticks()])
+
+ @property
+ def major_ticklabels(self):
+ label = "label%d" % self._axisnum
+ return SimpleChainedObjects([getattr(tick, label)
+ for tick in self._axis.get_major_ticks()])
+
+ @property
+ def label(self):
+ return self._axis.label
+
+ def set_visible(self, b):
+ self.toggle(all=b)
+ self.line.set_visible(b)
+ self._axis.set_visible(True)
+ super().set_visible(b)
+
+ def set_label(self, txt):
+ self._axis.set_label_text(txt)
+
+ def toggle(self, all=None, ticks=None, ticklabels=None, label=None):
+
+ if all:
+ _ticks, _ticklabels, _label = True, True, True
+ elif all is not None:
+ _ticks, _ticklabels, _label = False, False, False
+ else:
+ _ticks, _ticklabels, _label = None, None, None
+
+ if ticks is not None:
+ _ticks = ticks
+ if ticklabels is not None:
+ _ticklabels = ticklabels
+ if label is not None:
+ _label = label
+
+ tickOn = "tick%dOn" % self._axisnum
+ labelOn = "label%dOn" % self._axisnum
+
+ if _ticks is not None:
+ tickparam = {tickOn: _ticks}
+ self._axis.set_tick_params(**tickparam)
+ if _ticklabels is not None:
+ tickparam = {labelOn: _ticklabels}
+ self._axis.set_tick_params(**tickparam)
+
+ if _label is not None:
+ pos = self._axis.get_label_position()
+ if (pos == self._axis_direction) and not _label:
+ self._axis.label.set_visible(False)
+ elif _label:
+ self._axis.label.set_visible(True)
+ self._axis.set_label_position(self._axis_direction)
diff --git a/venv/Lib/site-packages/mpl_toolkits/axes_grid1/parasite_axes.py b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/parasite_axes.py
new file mode 100644
index 0000000..b7ee444
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axes_grid1/parasite_axes.py
@@ -0,0 +1,390 @@
+import functools
+
+from matplotlib import _api
+import matplotlib.artist as martist
+import matplotlib.transforms as mtransforms
+from matplotlib.axes import subplot_class_factory
+from matplotlib.transforms import Bbox
+from .mpl_axes import Axes
+
+
+class ParasiteAxesBase:
+
+ def __init__(self, parent_axes, aux_transform=None,
+ *, viewlim_mode=None, **kwargs):
+ self._parent_axes = parent_axes
+ self.transAux = aux_transform
+ self.set_viewlim_mode(viewlim_mode)
+ kwargs["frameon"] = False
+ super().__init__(parent_axes.figure, parent_axes._position, **kwargs)
+
+ def cla(self):
+ super().cla()
+ martist.setp(self.get_children(), visible=False)
+ self._get_lines = self._parent_axes._get_lines
+
+ def get_images_artists(self):
+ artists = {a for a in self.get_children() if a.get_visible()}
+ images = {a for a in self.images if a.get_visible()}
+ return list(images), list(artists - images)
+
+ def pick(self, mouseevent):
+ # This most likely goes to Artist.pick (depending on axes_class given
+ # to the factory), which only handles pick events registered on the
+ # axes associated with each child:
+ super().pick(mouseevent)
+ # But parasite axes are additionally given pick events from their host
+ # axes (cf. HostAxesBase.pick), which we handle here:
+ for a in self.get_children():
+ if (hasattr(mouseevent.inaxes, "parasites")
+ and self in mouseevent.inaxes.parasites):
+ a.pick(mouseevent)
+
+ # aux_transform support
+
+ def _set_lim_and_transforms(self):
+ if self.transAux is not None:
+ self.transAxes = self._parent_axes.transAxes
+ self.transData = self.transAux + self._parent_axes.transData
+ self._xaxis_transform = mtransforms.blended_transform_factory(
+ self.transData, self.transAxes)
+ self._yaxis_transform = mtransforms.blended_transform_factory(
+ self.transAxes, self.transData)
+ else:
+ super()._set_lim_and_transforms()
+
+ def set_viewlim_mode(self, mode):
+ _api.check_in_list([None, "equal", "transform"], mode=mode)
+ self._viewlim_mode = mode
+
+ def get_viewlim_mode(self):
+ return self._viewlim_mode
+
+ @_api.deprecated("3.4", alternative="apply_aspect")
+ def update_viewlim(self):
+ return self._update_viewlim
+
+ def _update_viewlim(self): # Inline after deprecation elapses.
+ viewlim = self._parent_axes.viewLim.frozen()
+ mode = self.get_viewlim_mode()
+ if mode is None:
+ pass
+ elif mode == "equal":
+ self.axes.viewLim.set(viewlim)
+ elif mode == "transform":
+ self.axes.viewLim.set(
+ viewlim.transformed(self.transAux.inverted()))
+ else:
+ _api.check_in_list([None, "equal", "transform"], mode=mode)
+
+ def apply_aspect(self, position=None):
+ self._update_viewlim()
+ super().apply_aspect()
+
+ # end of aux_transform support
+
+
+@functools.lru_cache(None)
+def parasite_axes_class_factory(axes_class=None):
+ if axes_class is None:
+ _api.warn_deprecated(
+ "3.3", message="Support for passing None to "
+ "parasite_axes_class_factory is deprecated since %(since)s and "
+ "will be removed %(removal)s; explicitly pass the default Axes "
+ "class instead.")
+ axes_class = Axes
+
+ return type("%sParasite" % axes_class.__name__,
+ (ParasiteAxesBase, axes_class), {})
+
+
+ParasiteAxes = parasite_axes_class_factory(Axes)
+
+
+@_api.deprecated("3.4", alternative="ParasiteAxesBase")
+class ParasiteAxesAuxTransBase:
+ def __init__(self, parent_axes, aux_transform, viewlim_mode=None,
+ **kwargs):
+ # Explicit wrapper for deprecation to work.
+ super().__init__(parent_axes, aux_transform,
+ viewlim_mode=viewlim_mode, **kwargs)
+
+ def _set_lim_and_transforms(self):
+ self.transAxes = self._parent_axes.transAxes
+ self.transData = self.transAux + self._parent_axes.transData
+ self._xaxis_transform = mtransforms.blended_transform_factory(
+ self.transData, self.transAxes)
+ self._yaxis_transform = mtransforms.blended_transform_factory(
+ self.transAxes, self.transData)
+
+ def set_viewlim_mode(self, mode):
+ _api.check_in_list([None, "equal", "transform"], mode=mode)
+ self._viewlim_mode = mode
+
+ def get_viewlim_mode(self):
+ return self._viewlim_mode
+
+ @_api.deprecated("3.4", alternative="apply_aspect")
+ def update_viewlim(self):
+ return self._update_viewlim()
+
+ def _update_viewlim(self): # Inline after deprecation elapses.
+ viewlim = self._parent_axes.viewLim.frozen()
+ mode = self.get_viewlim_mode()
+ if mode is None:
+ pass
+ elif mode == "equal":
+ self.axes.viewLim.set(viewlim)
+ elif mode == "transform":
+ self.axes.viewLim.set(
+ viewlim.transformed(self.transAux.inverted()))
+ else:
+ _api.check_in_list([None, "equal", "transform"], mode=mode)
+
+ def apply_aspect(self, position=None):
+ self._update_viewlim()
+ super().apply_aspect()
+
+
+@_api.deprecated("3.4", alternative="parasite_axes_class_factory")
+@functools.lru_cache(None)
+def parasite_axes_auxtrans_class_factory(axes_class=None):
+ if axes_class is None:
+ _api.warn_deprecated(
+ "3.3", message="Support for passing None to "
+ "parasite_axes_auxtrans_class_factory is deprecated since "
+ "%(since)s and will be removed %(removal)s; explicitly pass the "
+ "default ParasiteAxes class instead.")
+ parasite_axes_class = ParasiteAxes
+ elif not issubclass(axes_class, ParasiteAxesBase):
+ parasite_axes_class = parasite_axes_class_factory(axes_class)
+ else:
+ parasite_axes_class = axes_class
+ return type("%sParasiteAuxTrans" % parasite_axes_class.__name__,
+ (ParasiteAxesAuxTransBase, parasite_axes_class),
+ {'name': 'parasite_axes'})
+
+
+# Also deprecated.
+with _api.suppress_matplotlib_deprecation_warning():
+ ParasiteAxesAuxTrans = parasite_axes_auxtrans_class_factory(ParasiteAxes)
+
+
+class HostAxesBase:
+ def __init__(self, *args, **kwargs):
+ self.parasites = []
+ super().__init__(*args, **kwargs)
+
+ def get_aux_axes(self, tr=None, viewlim_mode="equal", axes_class=Axes):
+ """
+ Add a parasite axes to this host.
+
+ Despite this method's name, this should actually be thought of as an
+ ``add_parasite_axes`` method.
+
+ *tr* may be `.Transform`, in which case the following relation will
+ hold: ``parasite.transData = tr + host.transData``. Alternatively, it
+ may be None (the default), no special relationship will hold between
+ the parasite's and the host's ``transData``.
+ """
+ parasite_axes_class = parasite_axes_class_factory(axes_class)
+ ax2 = parasite_axes_class(self, tr, viewlim_mode=viewlim_mode)
+ # note that ax2.transData == tr + ax1.transData
+ # Anything you draw in ax2 will match the ticks and grids of ax1.
+ self.parasites.append(ax2)
+ ax2._remove_method = self.parasites.remove
+ return ax2
+
+ def _get_legend_handles(self, legend_handler_map=None):
+ all_handles = super()._get_legend_handles()
+ for ax in self.parasites:
+ all_handles.extend(ax._get_legend_handles(legend_handler_map))
+ return all_handles
+
+ def draw(self, renderer):
+
+ orig_artists = list(self.artists)
+ orig_images = list(self.images)
+
+ if hasattr(self, "get_axes_locator"):
+ locator = self.get_axes_locator()
+ if locator:
+ pos = locator(self, renderer)
+ self.set_position(pos, which="active")
+ self.apply_aspect(pos)
+ else:
+ self.apply_aspect()
+ else:
+ self.apply_aspect()
+
+ rect = self.get_position()
+
+ for ax in self.parasites:
+ ax.apply_aspect(rect)
+ images, artists = ax.get_images_artists()
+ self.images.extend(images)
+ self.artists.extend(artists)
+
+ super().draw(renderer)
+ self.artists = orig_artists
+ self.images = orig_images
+
+ def cla(self):
+ for ax in self.parasites:
+ ax.cla()
+ super().cla()
+
+ def pick(self, mouseevent):
+ super().pick(mouseevent)
+ # Also pass pick events on to parasite axes and, in turn, their
+ # children (cf. ParasiteAxesBase.pick)
+ for a in self.parasites:
+ a.pick(mouseevent)
+
+ def twinx(self, axes_class=None):
+ """
+ Create a twin of Axes with a shared x-axis but independent y-axis.
+
+ The y-axis of self will have ticks on the left and the returned axes
+ will have ticks on the right.
+ """
+ ax = self._add_twin_axes(axes_class, sharex=self)
+ self.axis["right"].set_visible(False)
+ ax.axis["right"].set_visible(True)
+ ax.axis["left", "top", "bottom"].set_visible(False)
+ return ax
+
+ def twiny(self, axes_class=None):
+ """
+ Create a twin of Axes with a shared y-axis but independent x-axis.
+
+ The x-axis of self will have ticks on the bottom and the returned axes
+ will have ticks on the top.
+ """
+ ax = self._add_twin_axes(axes_class, sharey=self)
+ self.axis["top"].set_visible(False)
+ ax.axis["top"].set_visible(True)
+ ax.axis["left", "right", "bottom"].set_visible(False)
+ return ax
+
+ def twin(self, aux_trans=None, axes_class=None):
+ """
+ Create a twin of Axes with no shared axis.
+
+ While self will have ticks on the left and bottom axis, the returned
+ axes will have ticks on the top and right axis.
+ """
+ if aux_trans is None:
+ aux_trans = mtransforms.IdentityTransform()
+ ax = self._add_twin_axes(
+ axes_class, aux_transform=aux_trans, viewlim_mode="transform")
+ self.axis["top", "right"].set_visible(False)
+ ax.axis["top", "right"].set_visible(True)
+ ax.axis["left", "bottom"].set_visible(False)
+ return ax
+
+ def _add_twin_axes(self, axes_class, **kwargs):
+ """
+ Helper for `.twinx`/`.twiny`/`.twin`.
+
+ *kwargs* are forwarded to the parasite axes constructor.
+ """
+ if axes_class is None:
+ axes_class = self._get_base_axes()
+ ax = parasite_axes_class_factory(axes_class)(self, **kwargs)
+ self.parasites.append(ax)
+ ax._remove_method = self._remove_any_twin
+ return ax
+
+ def _remove_any_twin(self, ax):
+ self.parasites.remove(ax)
+ restore = ["top", "right"]
+ if ax._sharex:
+ restore.remove("top")
+ if ax._sharey:
+ restore.remove("right")
+ self.axis[tuple(restore)].set_visible(True)
+ self.axis[tuple(restore)].toggle(ticklabels=False, label=False)
+
+ def get_tightbbox(self, renderer, call_axes_locator=True,
+ bbox_extra_artists=None):
+ bbs = [
+ *[ax.get_tightbbox(renderer, call_axes_locator=call_axes_locator)
+ for ax in self.parasites],
+ super().get_tightbbox(renderer,
+ call_axes_locator=call_axes_locator,
+ bbox_extra_artists=bbox_extra_artists)]
+ return Bbox.union([b for b in bbs if b.width != 0 or b.height != 0])
+
+
+@functools.lru_cache(None)
+def host_axes_class_factory(axes_class=None):
+ if axes_class is None:
+ _api.warn_deprecated(
+ "3.3", message="Support for passing None to host_axes_class is "
+ "deprecated since %(since)s and will be removed %(removed)s; "
+ "explicitly pass the default Axes class instead.")
+ axes_class = Axes
+
+ def _get_base_axes(self):
+ return axes_class
+
+ return type("%sHostAxes" % axes_class.__name__,
+ (HostAxesBase, axes_class),
+ {'_get_base_axes': _get_base_axes})
+
+
+def host_subplot_class_factory(axes_class):
+ host_axes_class = host_axes_class_factory(axes_class)
+ subplot_host_class = subplot_class_factory(host_axes_class)
+ return subplot_host_class
+
+
+HostAxes = host_axes_class_factory(Axes)
+SubplotHost = subplot_class_factory(HostAxes)
+
+
+def host_axes(*args, axes_class=Axes, figure=None, **kwargs):
+ """
+ Create axes that can act as a hosts to parasitic axes.
+
+ Parameters
+ ----------
+ figure : `matplotlib.figure.Figure`
+ Figure to which the axes will be added. Defaults to the current figure
+ `.pyplot.gcf()`.
+
+ *args, **kwargs
+ Will be passed on to the underlying ``Axes`` object creation.
+ """
+ import matplotlib.pyplot as plt
+ host_axes_class = host_axes_class_factory(axes_class)
+ if figure is None:
+ figure = plt.gcf()
+ ax = host_axes_class(figure, *args, **kwargs)
+ figure.add_axes(ax)
+ plt.draw_if_interactive()
+ return ax
+
+
+def host_subplot(*args, axes_class=Axes, figure=None, **kwargs):
+ """
+ Create a subplot that can act as a host to parasitic axes.
+
+ Parameters
+ ----------
+ figure : `matplotlib.figure.Figure`
+ Figure to which the subplot will be added. Defaults to the current
+ figure `.pyplot.gcf()`.
+
+ *args, **kwargs
+ Will be passed on to the underlying ``Axes`` object creation.
+ """
+ import matplotlib.pyplot as plt
+ host_subplot_class = host_subplot_class_factory(axes_class)
+ if figure is None:
+ figure = plt.gcf()
+ ax = host_subplot_class(figure, *args, **kwargs)
+ figure.add_subplot(ax)
+ plt.draw_if_interactive()
+ return ax
diff --git a/venv/Lib/site-packages/mpl_toolkits/axisartist/__init__.py b/venv/Lib/site-packages/mpl_toolkits/axisartist/__init__.py
new file mode 100644
index 0000000..0699b01
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axisartist/__init__.py
@@ -0,0 +1,17 @@
+from matplotlib import _api
+from .axislines import (
+ Axes, AxesZero, AxisArtistHelper, AxisArtistHelperRectlinear,
+ GridHelperBase, GridHelperRectlinear, Subplot, SubplotZero)
+from .axis_artist import AxisArtist, GridlinesCollection
+from .grid_helper_curvelinear import GridHelperCurveLinear
+from .floating_axes import FloatingAxes, FloatingSubplot
+from mpl_toolkits.axes_grid1.parasite_axes import (
+ host_axes_class_factory, parasite_axes_class_factory,
+ parasite_axes_auxtrans_class_factory, subplot_class_factory)
+
+
+ParasiteAxes = parasite_axes_class_factory(Axes)
+HostAxes = host_axes_class_factory(Axes)
+SubplotHost = subplot_class_factory(HostAxes)
+with _api.suppress_matplotlib_deprecation_warning():
+ ParasiteAxesAuxTrans = parasite_axes_auxtrans_class_factory(ParasiteAxes)
diff --git a/venv/Lib/site-packages/mpl_toolkits/axisartist/angle_helper.py b/venv/Lib/site-packages/mpl_toolkits/axisartist/angle_helper.py
new file mode 100644
index 0000000..041bf44
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axisartist/angle_helper.py
@@ -0,0 +1,405 @@
+import numpy as np
+import math
+
+from matplotlib import _api
+from mpl_toolkits.axisartist.grid_finder import ExtremeFinderSimple
+
+
+def select_step_degree(dv):
+
+ degree_limits_ = [1.5, 3, 7, 13, 20, 40, 70, 120, 270, 520]
+ degree_steps_ = [1, 2, 5, 10, 15, 30, 45, 90, 180, 360]
+ degree_factors = [1.] * len(degree_steps_)
+
+ minsec_limits_ = [1.5, 2.5, 3.5, 8, 11, 18, 25, 45]
+ minsec_steps_ = [1, 2, 3, 5, 10, 15, 20, 30]
+
+ minute_limits_ = np.array(minsec_limits_) / 60
+ minute_factors = [60.] * len(minute_limits_)
+
+ second_limits_ = np.array(minsec_limits_) / 3600
+ second_factors = [3600.] * len(second_limits_)
+
+ degree_limits = [*second_limits_, *minute_limits_, *degree_limits_]
+ degree_steps = [*minsec_steps_, *minsec_steps_, *degree_steps_]
+ degree_factors = [*second_factors, *minute_factors, *degree_factors]
+
+ n = np.searchsorted(degree_limits, dv)
+ step = degree_steps[n]
+ factor = degree_factors[n]
+
+ return step, factor
+
+
+def select_step_hour(dv):
+
+ hour_limits_ = [1.5, 2.5, 3.5, 5, 7, 10, 15, 21, 36]
+ hour_steps_ = [1, 2, 3, 4, 6, 8, 12, 18, 24]
+ hour_factors = [1.] * len(hour_steps_)
+
+ minsec_limits_ = [1.5, 2.5, 3.5, 4.5, 5.5, 8, 11, 14, 18, 25, 45]
+ minsec_steps_ = [1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30]
+
+ minute_limits_ = np.array(minsec_limits_) / 60
+ minute_factors = [60.] * len(minute_limits_)
+
+ second_limits_ = np.array(minsec_limits_) / 3600
+ second_factors = [3600.] * len(second_limits_)
+
+ hour_limits = [*second_limits_, *minute_limits_, *hour_limits_]
+ hour_steps = [*minsec_steps_, *minsec_steps_, *hour_steps_]
+ hour_factors = [*second_factors, *minute_factors, *hour_factors]
+
+ n = np.searchsorted(hour_limits, dv)
+ step = hour_steps[n]
+ factor = hour_factors[n]
+
+ return step, factor
+
+
+def select_step_sub(dv):
+
+ # subarcsec or degree
+ tmp = 10.**(int(math.log10(dv))-1.)
+
+ factor = 1./tmp
+
+ if 1.5*tmp >= dv:
+ step = 1
+ elif 3.*tmp >= dv:
+ step = 2
+ elif 7.*tmp >= dv:
+ step = 5
+ else:
+ step = 1
+ factor = 0.1*factor
+
+ return step, factor
+
+
+def select_step(v1, v2, nv, hour=False, include_last=True,
+ threshold_factor=3600.):
+
+ if v1 > v2:
+ v1, v2 = v2, v1
+
+ dv = (v2 - v1) / nv
+
+ if hour:
+ _select_step = select_step_hour
+ cycle = 24.
+ else:
+ _select_step = select_step_degree
+ cycle = 360.
+
+ # for degree
+ if dv > 1 / threshold_factor:
+ step, factor = _select_step(dv)
+ else:
+ step, factor = select_step_sub(dv*threshold_factor)
+
+ factor = factor * threshold_factor
+
+ levs = np.arange(np.floor(v1 * factor / step),
+ np.ceil(v2 * factor / step) + 0.5,
+ dtype=int) * step
+
+ # n : number of valid levels. If there is a cycle, e.g., [0, 90, 180,
+ # 270, 360], the grid line needs to be extended from 0 to 360, so
+ # we need to return the whole array. However, the last level (360)
+ # needs to be ignored often. In this case, so we return n=4.
+
+ n = len(levs)
+
+ # we need to check the range of values
+ # for example, -90 to 90, 0 to 360,
+
+ if factor == 1. and levs[-1] >= levs[0] + cycle: # check for cycle
+ nv = int(cycle / step)
+ if include_last:
+ levs = levs[0] + np.arange(0, nv+1, 1) * step
+ else:
+ levs = levs[0] + np.arange(0, nv, 1) * step
+
+ n = len(levs)
+
+ return np.array(levs), n, factor
+
+
+def select_step24(v1, v2, nv, include_last=True, threshold_factor=3600):
+ v1, v2 = v1 / 15, v2 / 15
+ levs, n, factor = select_step(v1, v2, nv, hour=True,
+ include_last=include_last,
+ threshold_factor=threshold_factor)
+ return levs * 15, n, factor
+
+
+def select_step360(v1, v2, nv, include_last=True, threshold_factor=3600):
+ return select_step(v1, v2, nv, hour=False,
+ include_last=include_last,
+ threshold_factor=threshold_factor)
+
+
+class LocatorBase:
+ @_api.rename_parameter("3.3", "den", "nbins")
+ def __init__(self, nbins, include_last=True):
+ self.nbins = nbins
+ self._include_last = include_last
+
+ @_api.deprecated("3.3", alternative="nbins")
+ @property
+ def den(self):
+ return self.nbins
+
+ @den.setter
+ def den(self, v):
+ self.nbins = v
+
+ def set_params(self, nbins=None):
+ if nbins is not None:
+ self.nbins = int(nbins)
+
+
+class LocatorHMS(LocatorBase):
+ def __call__(self, v1, v2):
+ return select_step24(v1, v2, self.nbins, self._include_last)
+
+
+class LocatorHM(LocatorBase):
+ def __call__(self, v1, v2):
+ return select_step24(v1, v2, self.nbins, self._include_last,
+ threshold_factor=60)
+
+
+class LocatorH(LocatorBase):
+ def __call__(self, v1, v2):
+ return select_step24(v1, v2, self.nbins, self._include_last,
+ threshold_factor=1)
+
+
+class LocatorDMS(LocatorBase):
+ def __call__(self, v1, v2):
+ return select_step360(v1, v2, self.nbins, self._include_last)
+
+
+class LocatorDM(LocatorBase):
+ def __call__(self, v1, v2):
+ return select_step360(v1, v2, self.nbins, self._include_last,
+ threshold_factor=60)
+
+
+class LocatorD(LocatorBase):
+ def __call__(self, v1, v2):
+ return select_step360(v1, v2, self.nbins, self._include_last,
+ threshold_factor=1)
+
+
+class FormatterDMS:
+ deg_mark = r"^{\circ}"
+ min_mark = r"^{\prime}"
+ sec_mark = r"^{\prime\prime}"
+
+ fmt_d = "$%d" + deg_mark + "$"
+ fmt_ds = r"$%d.%s" + deg_mark + "$"
+
+ # %s for sign
+ fmt_d_m = r"$%s%d" + deg_mark + r"\,%02d" + min_mark + "$"
+ fmt_d_ms = r"$%s%d" + deg_mark + r"\,%02d.%s" + min_mark + "$"
+
+ fmt_d_m_partial = "$%s%d" + deg_mark + r"\,%02d" + min_mark + r"\,"
+ fmt_s_partial = "%02d" + sec_mark + "$"
+ fmt_ss_partial = "%02d.%s" + sec_mark + "$"
+
+ def _get_number_fraction(self, factor):
+ ## check for fractional numbers
+ number_fraction = None
+ # check for 60
+
+ for threshold in [1, 60, 3600]:
+ if factor <= threshold:
+ break
+
+ d = factor // threshold
+ int_log_d = int(np.floor(np.log10(d)))
+ if 10**int_log_d == d and d != 1:
+ number_fraction = int_log_d
+ factor = factor // 10**int_log_d
+ return factor, number_fraction
+
+ return factor, number_fraction
+
+ def __call__(self, direction, factor, values):
+ if len(values) == 0:
+ return []
+
+ ss = np.sign(values)
+ signs = ["-" if v < 0 else "" for v in values]
+
+ factor, number_fraction = self._get_number_fraction(factor)
+
+ values = np.abs(values)
+
+ if number_fraction is not None:
+ values, frac_part = divmod(values, 10 ** number_fraction)
+ frac_fmt = "%%0%dd" % (number_fraction,)
+ frac_str = [frac_fmt % (f1,) for f1 in frac_part]
+
+ if factor == 1:
+ if number_fraction is None:
+ return [self.fmt_d % (s * int(v),) for s, v in zip(ss, values)]
+ else:
+ return [self.fmt_ds % (s * int(v), f1)
+ for s, v, f1 in zip(ss, values, frac_str)]
+ elif factor == 60:
+ deg_part, min_part = divmod(values, 60)
+ if number_fraction is None:
+ return [self.fmt_d_m % (s1, d1, m1)
+ for s1, d1, m1 in zip(signs, deg_part, min_part)]
+ else:
+ return [self.fmt_d_ms % (s, d1, m1, f1)
+ for s, d1, m1, f1
+ in zip(signs, deg_part, min_part, frac_str)]
+
+ elif factor == 3600:
+ if ss[-1] == -1:
+ inverse_order = True
+ values = values[::-1]
+ signs = signs[::-1]
+ else:
+ inverse_order = False
+
+ l_hm_old = ""
+ r = []
+
+ deg_part, min_part_ = divmod(values, 3600)
+ min_part, sec_part = divmod(min_part_, 60)
+
+ if number_fraction is None:
+ sec_str = [self.fmt_s_partial % (s1,) for s1 in sec_part]
+ else:
+ sec_str = [self.fmt_ss_partial % (s1, f1)
+ for s1, f1 in zip(sec_part, frac_str)]
+
+ for s, d1, m1, s1 in zip(signs, deg_part, min_part, sec_str):
+ l_hm = self.fmt_d_m_partial % (s, d1, m1)
+ if l_hm != l_hm_old:
+ l_hm_old = l_hm
+ l = l_hm + s1
+ else:
+ l = "$" + s + s1
+ r.append(l)
+
+ if inverse_order:
+ return r[::-1]
+ else:
+ return r
+
+ else: # factor > 3600.
+ return [r"$%s^{\circ}$" % (str(v),) for v in ss*values]
+
+
+class FormatterHMS(FormatterDMS):
+ deg_mark = r"^\mathrm{h}"
+ min_mark = r"^\mathrm{m}"
+ sec_mark = r"^\mathrm{s}"
+
+ fmt_d = "$%d" + deg_mark + "$"
+ fmt_ds = r"$%d.%s" + deg_mark + "$"
+
+ # %s for sign
+ fmt_d_m = r"$%s%d" + deg_mark + r"\,%02d" + min_mark+"$"
+ fmt_d_ms = r"$%s%d" + deg_mark + r"\,%02d.%s" + min_mark+"$"
+
+ fmt_d_m_partial = "$%s%d" + deg_mark + r"\,%02d" + min_mark + r"\,"
+ fmt_s_partial = "%02d" + sec_mark + "$"
+ fmt_ss_partial = "%02d.%s" + sec_mark + "$"
+
+ def __call__(self, direction, factor, values): # hour
+ return super().__call__(direction, factor, np.asarray(values) / 15)
+
+
+class ExtremeFinderCycle(ExtremeFinderSimple):
+ # docstring inherited
+
+ def __init__(self, nx, ny,
+ lon_cycle=360., lat_cycle=None,
+ lon_minmax=None, lat_minmax=(-90, 90)):
+ """
+ This subclass handles the case where one or both coordinates should be
+ taken modulo 360, or be restricted to not exceed a specific range.
+
+ Parameters
+ ----------
+ nx, ny : int
+ The number of samples in each direction.
+
+ lon_cycle, lat_cycle : 360 or None
+ If not None, values in the corresponding direction are taken modulo
+ *lon_cycle* or *lat_cycle*; in theory this can be any number but
+ the implementation actually assumes that it is 360 (if not None);
+ other values give nonsensical results.
+
+ This is done by "unwrapping" the transformed grid coordinates so
+ that jumps are less than a half-cycle; then normalizing the span to
+ no more than a full cycle.
+
+ For example, if values are in the union of the [0, 2] and
+ [358, 360] intervals (typically, angles measured modulo 360), the
+ values in the second interval are normalized to [-2, 0] instead so
+ that the values now cover [-2, 2]. If values are in a range of
+ [5, 1000], this gets normalized to [5, 365].
+
+ lon_minmax, lat_minmax : (float, float) or None
+ If not None, the computed bounding box is clipped to the given
+ range in the corresponding direction.
+ """
+ self.nx, self.ny = nx, ny
+ self.lon_cycle, self.lat_cycle = lon_cycle, lat_cycle
+ self.lon_minmax = lon_minmax
+ self.lat_minmax = lat_minmax
+
+ def __call__(self, transform_xy, x1, y1, x2, y2):
+ # docstring inherited
+ x, y = np.meshgrid(
+ np.linspace(x1, x2, self.nx), np.linspace(y1, y2, self.ny))
+ lon, lat = transform_xy(np.ravel(x), np.ravel(y))
+
+ # iron out jumps, but algorithm should be improved.
+ # This is just naive way of doing and my fail for some cases.
+ # Consider replacing this with numpy.unwrap
+ # We are ignoring invalid warnings. They are triggered when
+ # comparing arrays with NaNs using > We are already handling
+ # that correctly using np.nanmin and np.nanmax
+ with np.errstate(invalid='ignore'):
+ if self.lon_cycle is not None:
+ lon0 = np.nanmin(lon)
+ lon -= 360. * ((lon - lon0) > 180.)
+ if self.lat_cycle is not None:
+ lat0 = np.nanmin(lat)
+ lat -= 360. * ((lat - lat0) > 180.)
+
+ lon_min, lon_max = np.nanmin(lon), np.nanmax(lon)
+ lat_min, lat_max = np.nanmin(lat), np.nanmax(lat)
+
+ lon_min, lon_max, lat_min, lat_max = \
+ self._add_pad(lon_min, lon_max, lat_min, lat_max)
+
+ # check cycle
+ if self.lon_cycle:
+ lon_max = min(lon_max, lon_min + self.lon_cycle)
+ if self.lat_cycle:
+ lat_max = min(lat_max, lat_min + self.lat_cycle)
+
+ if self.lon_minmax is not None:
+ min0 = self.lon_minmax[0]
+ lon_min = max(min0, lon_min)
+ max0 = self.lon_minmax[1]
+ lon_max = min(max0, lon_max)
+
+ if self.lat_minmax is not None:
+ min0 = self.lat_minmax[0]
+ lat_min = max(min0, lat_min)
+ max0 = self.lat_minmax[1]
+ lat_max = min(max0, lat_max)
+
+ return lon_min, lon_max, lat_min, lat_max
diff --git a/venv/Lib/site-packages/mpl_toolkits/axisartist/axes_divider.py b/venv/Lib/site-packages/mpl_toolkits/axisartist/axes_divider.py
new file mode 100644
index 0000000..3b17783
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axisartist/axes_divider.py
@@ -0,0 +1,2 @@
+from mpl_toolkits.axes_grid1.axes_divider import (
+ Divider, AxesLocator, SubplotDivider, AxesDivider, make_axes_locatable)
diff --git a/venv/Lib/site-packages/mpl_toolkits/axisartist/axes_grid.py b/venv/Lib/site-packages/mpl_toolkits/axisartist/axes_grid.py
new file mode 100644
index 0000000..15c715b
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axisartist/axes_grid.py
@@ -0,0 +1,18 @@
+import mpl_toolkits.axes_grid1.axes_grid as axes_grid_orig
+from .axislines import Axes
+
+
+class CbarAxes(axes_grid_orig.CbarAxesBase, Axes):
+ pass
+
+
+class Grid(axes_grid_orig.Grid):
+ _defaultAxesClass = Axes
+
+
+class ImageGrid(axes_grid_orig.ImageGrid):
+ _defaultAxesClass = Axes
+ _defaultCbarAxesClass = CbarAxes
+
+
+AxesGrid = ImageGrid
diff --git a/venv/Lib/site-packages/mpl_toolkits/axisartist/axes_rgb.py b/venv/Lib/site-packages/mpl_toolkits/axisartist/axes_rgb.py
new file mode 100644
index 0000000..429843f
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axisartist/axes_rgb.py
@@ -0,0 +1,7 @@
+from mpl_toolkits.axes_grid1.axes_rgb import (
+ make_rgb_axes, imshow_rgb, RGBAxes as _RGBAxes)
+from .axislines import Axes
+
+
+class RGBAxes(_RGBAxes):
+ _defaultAxesClass = Axes
diff --git a/venv/Lib/site-packages/mpl_toolkits/axisartist/axis_artist.py b/venv/Lib/site-packages/mpl_toolkits/axisartist/axis_artist.py
new file mode 100644
index 0000000..21d9eff
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axisartist/axis_artist.py
@@ -0,0 +1,1066 @@
+"""
+The :mod:`.axis_artist` module implements custom artists to draw axis elements
+(axis lines and labels, tick lines and labels, grid lines).
+
+Axis lines and labels and tick lines and labels are managed by the `AxisArtist`
+class; grid lines are managed by the `GridlinesCollection` class.
+
+There is one `AxisArtist` per Axis; it can be accessed through
+the ``axis`` dictionary of the parent Axes (which should be a
+`mpl_toolkits.axislines.Axes`), e.g. ``ax.axis["bottom"]``.
+
+Children of the AxisArtist are accessed as attributes: ``.line`` and ``.label``
+for the axis line and label, ``.major_ticks``, ``.major_ticklabels``,
+``.minor_ticks``, ``.minor_ticklabels`` for the tick lines and labels (e.g.
+``ax.axis["bottom"].line``).
+
+Children properties (colors, fonts, line widths, etc.) can be set using
+setters, e.g. ::
+
+ # Make the major ticks of the bottom axis red.
+ ax.axis["bottom"].major_ticks.set_color("red")
+
+However, things like the locations of ticks, and their ticklabels need to be
+changed from the side of the grid_helper.
+
+axis_direction
+--------------
+
+`AxisArtist`, `AxisLabel`, `TickLabels` have an *axis_direction* attribute,
+which adjusts the location, angle, etc. The *axis_direction* must be one of
+"left", "right", "bottom", "top", and follows the Matplotlib convention for
+rectangular axis.
+
+For example, for the *bottom* axis (the left and right is relative to the
+direction of the increasing coordinate),
+
+* ticklabels and axislabel are on the right
+* ticklabels and axislabel have text angle of 0
+* ticklabels are baseline, center-aligned
+* axislabel is top, center-aligned
+
+The text angles are actually relative to (90 + angle of the direction to the
+ticklabel), which gives 0 for bottom axis.
+
+=================== ====== ======== ====== ========
+Parameter left bottom right top
+=================== ====== ======== ====== ========
+ticklabels location left right right left
+axislabel location left right right left
+ticklabels angle 90 0 -90 180
+axislabel angle 180 0 0 180
+ticklabel va center baseline center baseline
+axislabel va center top center bottom
+ticklabel ha right center right center
+axislabel ha right center right center
+=================== ====== ======== ====== ========
+
+Ticks are by default direct opposite side of the ticklabels. To make ticks to
+the same side of the ticklabels, ::
+
+ ax.axis["bottom"].major_ticks.set_tick_out(True)
+
+The following attributes can be customized (use the ``set_xxx`` methods):
+
+* `Ticks`: ticksize, tick_out
+* `TickLabels`: pad
+* `AxisLabel`: pad
+"""
+
+# FIXME :
+# angles are given in data coordinate - need to convert it to canvas coordinate
+
+
+from operator import methodcaller
+
+import numpy as np
+
+from matplotlib import _api, rcParams
+import matplotlib.artist as martist
+import matplotlib.text as mtext
+
+from matplotlib.collections import LineCollection
+from matplotlib.lines import Line2D
+from matplotlib.patches import PathPatch
+from matplotlib.path import Path
+from matplotlib.transforms import (
+ Affine2D, Bbox, IdentityTransform, ScaledTranslation)
+
+from .axisline_style import AxislineStyle
+
+
+class AttributeCopier:
+ def get_ref_artist(self):
+ """
+ Return the underlying artist that actually defines some properties
+ (e.g., color) of this artist.
+ """
+ raise RuntimeError("get_ref_artist must overridden")
+
+ def get_attribute_from_ref_artist(self, attr_name):
+ getter = methodcaller("get_" + attr_name)
+ prop = getter(super())
+ return getter(self.get_ref_artist()) if prop == "auto" else prop
+
+
+class Ticks(AttributeCopier, Line2D):
+ """
+ Ticks are derived from Line2D, and note that ticks themselves
+ are markers. Thus, you should use set_mec, set_mew, etc.
+
+ To change the tick size (length), you need to use
+ set_ticksize. To change the direction of the ticks (ticks are
+ in opposite direction of ticklabels by default), use
+ set_tick_out(False).
+ """
+
+ def __init__(self, ticksize, tick_out=False, *, axis=None, **kwargs):
+ self._ticksize = ticksize
+ self.locs_angles_labels = []
+
+ self.set_tick_out(tick_out)
+
+ self._axis = axis
+ if self._axis is not None:
+ if "color" not in kwargs:
+ kwargs["color"] = "auto"
+ if "mew" not in kwargs and "markeredgewidth" not in kwargs:
+ kwargs["markeredgewidth"] = "auto"
+
+ Line2D.__init__(self, [0.], [0.], **kwargs)
+ self.set_snap(True)
+
+ def get_ref_artist(self):
+ # docstring inherited
+ return self._axis.majorTicks[0].tick1line
+
+ def get_color(self):
+ return self.get_attribute_from_ref_artist("color")
+
+ def get_markeredgecolor(self):
+ return self.get_attribute_from_ref_artist("markeredgecolor")
+
+ def get_markeredgewidth(self):
+ return self.get_attribute_from_ref_artist("markeredgewidth")
+
+ def set_tick_out(self, b):
+ """Set whether ticks are drawn inside or outside the axes."""
+ self._tick_out = b
+
+ def get_tick_out(self):
+ """Return whether ticks are drawn inside or outside the axes."""
+ return self._tick_out
+
+ def set_ticksize(self, ticksize):
+ """Set length of the ticks in points."""
+ self._ticksize = ticksize
+
+ def get_ticksize(self):
+ """Return length of the ticks in points."""
+ return self._ticksize
+
+ def set_locs_angles(self, locs_angles):
+ self.locs_angles = locs_angles
+
+ _tickvert_path = Path([[0., 0.], [1., 0.]])
+
+ def draw(self, renderer):
+ if not self.get_visible():
+ return
+
+ gc = renderer.new_gc()
+ gc.set_foreground(self.get_markeredgecolor())
+ gc.set_linewidth(self.get_markeredgewidth())
+ gc.set_alpha(self._alpha)
+
+ path_trans = self.get_transform()
+ marker_transform = (Affine2D()
+ .scale(renderer.points_to_pixels(self._ticksize)))
+ if self.get_tick_out():
+ marker_transform.rotate_deg(180)
+
+ for loc, angle in self.locs_angles:
+ locs = path_trans.transform_non_affine(np.array([loc]))
+ if self.axes and not self.axes.viewLim.contains(*locs[0]):
+ continue
+ renderer.draw_markers(
+ gc, self._tickvert_path,
+ marker_transform + Affine2D().rotate_deg(angle),
+ Path(locs), path_trans.get_affine())
+
+ gc.restore()
+
+
+class LabelBase(mtext.Text):
+ """
+ A base class for AxisLabel and TickLabels. The position and angle
+ of the text are calculated by to offset_ref_angle,
+ text_ref_angle, and offset_radius attributes.
+ """
+
+ def __init__(self, *args, **kwargs):
+ self.locs_angles_labels = []
+ self._ref_angle = 0
+ self._offset_radius = 0.
+
+ super().__init__(*args, **kwargs)
+
+ self.set_rotation_mode("anchor")
+ self._text_follow_ref_angle = True
+
+ def _set_ref_angle(self, a):
+ self._ref_angle = a
+
+ def _get_ref_angle(self):
+ return self._ref_angle
+
+ def _get_text_ref_angle(self):
+ if self._text_follow_ref_angle:
+ return self._get_ref_angle()+90
+ else:
+ return 0 # self.get_ref_angle()
+
+ def _get_offset_ref_angle(self):
+ return self._get_ref_angle()
+
+ def _set_offset_radius(self, offset_radius):
+ self._offset_radius = offset_radius
+
+ def _get_offset_radius(self):
+ return self._offset_radius
+
+ _get_opposite_direction = {"left": "right",
+ "right": "left",
+ "top": "bottom",
+ "bottom": "top"}.__getitem__
+
+ def draw(self, renderer):
+ if not self.get_visible():
+ return
+
+ # save original and adjust some properties
+ tr = self.get_transform()
+ angle_orig = self.get_rotation()
+ text_ref_angle = self._get_text_ref_angle()
+ offset_ref_angle = self._get_offset_ref_angle()
+ theta = np.deg2rad(offset_ref_angle)
+ dd = self._get_offset_radius()
+ dx, dy = dd * np.cos(theta), dd * np.sin(theta)
+
+ self.set_transform(tr + Affine2D().translate(dx, dy))
+ self.set_rotation(text_ref_angle+angle_orig)
+ super().draw(renderer)
+ # restore original properties
+ self.set_transform(tr)
+ self.set_rotation(angle_orig)
+
+ def get_window_extent(self, renderer):
+ # save original and adjust some properties
+ tr = self.get_transform()
+ angle_orig = self.get_rotation()
+ text_ref_angle = self._get_text_ref_angle()
+ offset_ref_angle = self._get_offset_ref_angle()
+ theta = np.deg2rad(offset_ref_angle)
+ dd = self._get_offset_radius()
+ dx, dy = dd * np.cos(theta), dd * np.sin(theta)
+
+ self.set_transform(tr + Affine2D().translate(dx, dy))
+ self.set_rotation(text_ref_angle+angle_orig)
+ bbox = super().get_window_extent(renderer).frozen()
+ # restore original properties
+ self.set_transform(tr)
+ self.set_rotation(angle_orig)
+
+ return bbox
+
+
+class AxisLabel(AttributeCopier, LabelBase):
+ """
+ Axis Label. Derived from Text. The position of the text is updated
+ in the fly, so changing text position has no effect. Otherwise, the
+ properties can be changed as a normal Text.
+
+ To change the pad between ticklabels and axis label, use set_pad.
+ """
+
+ def __init__(self, *args, axis_direction="bottom", axis=None, **kwargs):
+ self._axis = axis
+ self._pad = 5
+ self._extra_pad = 0
+ LabelBase.__init__(self, *args, **kwargs)
+ self.set_axis_direction(axis_direction)
+
+ def set_pad(self, pad):
+ """
+ Set the internal pad in points.
+
+ The actual pad will be the sum of the internal pad and the
+ external pad (the latter is set automatically by the AxisArtist).
+ """
+ self._pad = pad
+
+ def get_pad(self):
+ """
+ Return the internal pad in points.
+
+ See `.set_pad` for more details.
+ """
+ return self._pad
+
+ def _set_external_pad(self, p):
+ """Set external pad in pixels."""
+ self._extra_pad = p
+
+ def _get_external_pad(self):
+ """Return external pad in pixels."""
+ return self._extra_pad
+
+ def get_ref_artist(self):
+ # docstring inherited
+ return self._axis.get_label()
+
+ def get_text(self):
+ t = super().get_text()
+ if t == "__from_axes__":
+ return self._axis.get_label().get_text()
+ return self._text
+
+ _default_alignments = dict(left=("bottom", "center"),
+ right=("top", "center"),
+ bottom=("top", "center"),
+ top=("bottom", "center"))
+
+ def set_default_alignment(self, d):
+ va, ha = _api.check_getitem(self._default_alignments, d=d)
+ self.set_va(va)
+ self.set_ha(ha)
+
+ _default_angles = dict(left=180,
+ right=0,
+ bottom=0,
+ top=180)
+
+ def set_default_angle(self, d):
+ self.set_rotation(_api.check_getitem(self._default_angles, d=d))
+
+ def set_axis_direction(self, d):
+ """
+ Adjust the text angle and text alignment of axis label
+ according to the matplotlib convention.
+
+ ===================== ========== ========= ========== ==========
+ property left bottom right top
+ ===================== ========== ========= ========== ==========
+ axislabel angle 180 0 0 180
+ axislabel va center top center bottom
+ axislabel ha right center right center
+ ===================== ========== ========= ========== ==========
+
+ Note that the text angles are actually relative to (90 + angle
+ of the direction to the ticklabel), which gives 0 for bottom
+ axis.
+ """
+ self.set_default_alignment(d)
+ self.set_default_angle(d)
+
+ def get_color(self):
+ return self.get_attribute_from_ref_artist("color")
+
+ def draw(self, renderer):
+ if not self.get_visible():
+ return
+
+ pad = renderer.points_to_pixels(self.get_pad())
+ r = self._get_external_pad() + pad
+ self._set_offset_radius(r)
+
+ super().draw(renderer)
+
+ def get_window_extent(self, renderer):
+ if not self.get_visible():
+ return
+
+ pad = renderer.points_to_pixels(self.get_pad())
+ r = self._get_external_pad() + pad
+ self._set_offset_radius(r)
+
+ bb = super().get_window_extent(renderer)
+
+ return bb
+
+
+class TickLabels(AxisLabel): # mtext.Text
+ """
+ Tick Labels. While derived from Text, this single artist draws all
+ ticklabels. As in AxisLabel, the position of the text is updated
+ in the fly, so changing text position has no effect. Otherwise,
+ the properties can be changed as a normal Text. Unlike the
+ ticklabels of the mainline matplotlib, properties of single
+ ticklabel alone cannot modified.
+
+ To change the pad between ticks and ticklabels, use set_pad.
+ """
+
+ def __init__(self, *, axis_direction="bottom", **kwargs):
+ super().__init__(**kwargs)
+ self.set_axis_direction(axis_direction)
+ self._axislabel_pad = 0
+
+ def get_ref_artist(self):
+ # docstring inherited
+ return self._axis.get_ticklabels()[0]
+
+ def set_axis_direction(self, label_direction):
+ """
+ Adjust the text angle and text alignment of ticklabels
+ according to the matplotlib convention.
+
+ The *label_direction* must be one of [left, right, bottom, top].
+
+ ===================== ========== ========= ========== ==========
+ property left bottom right top
+ ===================== ========== ========= ========== ==========
+ ticklabels angle 90 0 -90 180
+ ticklabel va center baseline center baseline
+ ticklabel ha right center right center
+ ===================== ========== ========= ========== ==========
+
+ Note that the text angles are actually relative to (90 + angle
+ of the direction to the ticklabel), which gives 0 for bottom
+ axis.
+ """
+ self.set_default_alignment(label_direction)
+ self.set_default_angle(label_direction)
+ self._axis_direction = label_direction
+
+ def invert_axis_direction(self):
+ label_direction = self._get_opposite_direction(self._axis_direction)
+ self.set_axis_direction(label_direction)
+
+ def _get_ticklabels_offsets(self, renderer, label_direction):
+ """
+ Calculate the ticklabel offsets from the tick and their total heights.
+
+ The offset only takes account the offset due to the vertical alignment
+ of the ticklabels: if axis direction is bottom and va is 'top', it will
+ return 0; if va is 'baseline', it will return (height-descent).
+ """
+ whd_list = self.get_texts_widths_heights_descents(renderer)
+
+ if not whd_list:
+ return 0, 0
+
+ r = 0
+ va, ha = self.get_va(), self.get_ha()
+
+ if label_direction == "left":
+ pad = max(w for w, h, d in whd_list)
+ if ha == "left":
+ r = pad
+ elif ha == "center":
+ r = .5 * pad
+ elif label_direction == "right":
+ pad = max(w for w, h, d in whd_list)
+ if ha == "right":
+ r = pad
+ elif ha == "center":
+ r = .5 * pad
+ elif label_direction == "bottom":
+ pad = max(h for w, h, d in whd_list)
+ if va == "bottom":
+ r = pad
+ elif va == "center":
+ r = .5 * pad
+ elif va == "baseline":
+ max_ascent = max(h - d for w, h, d in whd_list)
+ max_descent = max(d for w, h, d in whd_list)
+ r = max_ascent
+ pad = max_ascent + max_descent
+ elif label_direction == "top":
+ pad = max(h for w, h, d in whd_list)
+ if va == "top":
+ r = pad
+ elif va == "center":
+ r = .5 * pad
+ elif va == "baseline":
+ max_ascent = max(h - d for w, h, d in whd_list)
+ max_descent = max(d for w, h, d in whd_list)
+ r = max_descent
+ pad = max_ascent + max_descent
+
+ # r : offset
+ # pad : total height of the ticklabels. This will be used to
+ # calculate the pad for the axislabel.
+ return r, pad
+
+ _default_alignments = dict(left=("center", "right"),
+ right=("center", "left"),
+ bottom=("baseline", "center"),
+ top=("baseline", "center"))
+
+ _default_angles = dict(left=90,
+ right=-90,
+ bottom=0,
+ top=180)
+
+ def draw(self, renderer):
+ if not self.get_visible():
+ self._axislabel_pad = self._get_external_pad()
+ return
+
+ r, total_width = self._get_ticklabels_offsets(renderer,
+ self._axis_direction)
+
+ pad = (self._get_external_pad()
+ + renderer.points_to_pixels(self.get_pad()))
+ self._set_offset_radius(r+pad)
+
+ for (x, y), a, l in self._locs_angles_labels:
+ if not l.strip():
+ continue
+ self._set_ref_angle(a) # + add_angle
+ self.set_x(x)
+ self.set_y(y)
+ self.set_text(l)
+ LabelBase.draw(self, renderer)
+
+ # the value saved will be used to draw axislabel.
+ self._axislabel_pad = total_width + pad
+
+ def set_locs_angles_labels(self, locs_angles_labels):
+ self._locs_angles_labels = locs_angles_labels
+
+ def get_window_extents(self, renderer):
+
+ if not self.get_visible():
+ self._axislabel_pad = self._get_external_pad()
+ return []
+
+ bboxes = []
+
+ r, total_width = self._get_ticklabels_offsets(renderer,
+ self._axis_direction)
+
+ pad = self._get_external_pad() + \
+ renderer.points_to_pixels(self.get_pad())
+ self._set_offset_radius(r+pad)
+
+ for (x, y), a, l in self._locs_angles_labels:
+ self._set_ref_angle(a) # + add_angle
+ self.set_x(x)
+ self.set_y(y)
+ self.set_text(l)
+ bb = LabelBase.get_window_extent(self, renderer)
+ bboxes.append(bb)
+
+ # the value saved will be used to draw axislabel.
+ self._axislabel_pad = total_width + pad
+
+ return bboxes
+
+ def get_texts_widths_heights_descents(self, renderer):
+ """
+ Return a list of ``(width, height, descent)`` tuples for ticklabels.
+
+ Empty labels are left out.
+ """
+ whd_list = []
+ for _loc, _angle, label in self._locs_angles_labels:
+ if not label.strip():
+ continue
+ clean_line, ismath = self._preprocess_math(label)
+ whd = renderer.get_text_width_height_descent(
+ clean_line, self._fontproperties, ismath=ismath)
+ whd_list.append(whd)
+ return whd_list
+
+
+class GridlinesCollection(LineCollection):
+ def __init__(self, *args, which="major", axis="both", **kwargs):
+ """
+ Parameters
+ ----------
+ which : {"major", "minor"}
+ axis : {"both", "x", "y"}
+ """
+ self._which = which
+ self._axis = axis
+ super().__init__(*args, **kwargs)
+ self.set_grid_helper(None)
+
+ def set_which(self, which):
+ self._which = which
+
+ def set_axis(self, axis):
+ self._axis = axis
+
+ def set_grid_helper(self, grid_helper):
+ self._grid_helper = grid_helper
+
+ def draw(self, renderer):
+ if self._grid_helper is not None:
+ self._grid_helper.update_lim(self.axes)
+ gl = self._grid_helper.get_gridlines(self._which, self._axis)
+ if gl:
+ self.set_segments([np.transpose(l) for l in gl])
+ else:
+ self.set_segments([])
+ super().draw(renderer)
+
+
+class AxisArtist(martist.Artist):
+ """
+ An artist which draws axis (a line along which the n-th axes coord
+ is constant) line, ticks, ticklabels, and axis label.
+ """
+
+ zorder = 2.5
+
+ @_api.deprecated("3.4")
+ @_api.classproperty
+ def ZORDER(cls):
+ return cls.zorder
+
+ @property
+ def LABELPAD(self):
+ return self.label.get_pad()
+
+ @LABELPAD.setter
+ def LABELPAD(self, v):
+ self.label.set_pad(v)
+
+ def __init__(self, axes,
+ helper,
+ offset=None,
+ axis_direction="bottom",
+ **kwargs):
+ """
+ Parameters
+ ----------
+ axes : `mpl_toolkits.axisartist.axislines.Axes`
+ helper : `~mpl_toolkits.axisartist.axislines.AxisArtistHelper`
+ """
+ #axes is also used to follow the axis attribute (tick color, etc).
+
+ super().__init__(**kwargs)
+
+ self.axes = axes
+
+ self._axis_artist_helper = helper
+
+ if offset is None:
+ offset = (0, 0)
+ self.offset_transform = ScaledTranslation(
+ *offset,
+ Affine2D().scale(1 / 72) # points to inches.
+ + self.axes.figure.dpi_scale_trans)
+
+ if axis_direction in ["left", "right"]:
+ self.axis = axes.yaxis
+ else:
+ self.axis = axes.xaxis
+
+ self._axisline_style = None
+ self._axis_direction = axis_direction
+
+ self._init_line()
+ self._init_ticks(**kwargs)
+ self._init_offsetText(axis_direction)
+ self._init_label()
+
+ # axis direction
+ self._ticklabel_add_angle = 0.
+ self._axislabel_add_angle = 0.
+ self.set_axis_direction(axis_direction)
+
+ @_api.deprecated("3.3")
+ @property
+ def dpi_transform(self):
+ return Affine2D().scale(1 / 72) + self.axes.figure.dpi_scale_trans
+
+ # axis direction
+
+ def set_axis_direction(self, axis_direction):
+ """
+ Adjust the direction, text angle, text alignment of
+ ticklabels, labels following the matplotlib convention for
+ the rectangle axes.
+
+ The *axis_direction* must be one of [left, right, bottom, top].
+
+ ===================== ========== ========= ========== ==========
+ property left bottom right top
+ ===================== ========== ========= ========== ==========
+ ticklabels location "-" "+" "+" "-"
+ axislabel location "-" "+" "+" "-"
+ ticklabels angle 90 0 -90 180
+ ticklabel va center baseline center baseline
+ ticklabel ha right center right center
+ axislabel angle 180 0 0 180
+ axislabel va center top center bottom
+ axislabel ha right center right center
+ ===================== ========== ========= ========== ==========
+
+ Note that the direction "+" and "-" are relative to the direction of
+ the increasing coordinate. Also, the text angles are actually
+ relative to (90 + angle of the direction to the ticklabel),
+ which gives 0 for bottom axis.
+ """
+ self.major_ticklabels.set_axis_direction(axis_direction)
+ self.label.set_axis_direction(axis_direction)
+ self._axis_direction = axis_direction
+ if axis_direction in ["left", "top"]:
+ self.set_ticklabel_direction("-")
+ self.set_axislabel_direction("-")
+ else:
+ self.set_ticklabel_direction("+")
+ self.set_axislabel_direction("+")
+
+ def set_ticklabel_direction(self, tick_direction):
+ r"""
+ Adjust the direction of the ticklabel.
+
+ Note that the *label_direction*\s '+' and '-' are relative to the
+ direction of the increasing coordinate.
+
+ Parameters
+ ----------
+ tick_direction : {"+", "-"}
+ """
+ self._ticklabel_add_angle = _api.check_getitem(
+ {"+": 0, "-": 180}, tick_direction=tick_direction)
+
+ def invert_ticklabel_direction(self):
+ self._ticklabel_add_angle = (self._ticklabel_add_angle + 180) % 360
+ self.major_ticklabels.invert_axis_direction()
+ self.minor_ticklabels.invert_axis_direction()
+
+ def set_axislabel_direction(self, label_direction):
+ r"""
+ Adjust the direction of the axislabel.
+
+ Note that the *label_direction*\s '+' and '-' are relative to the
+ direction of the increasing coordinate.
+
+ Parameters
+ ----------
+ label_direction : {"+", "-"}
+ """
+ self._axislabel_add_angle = _api.check_getitem(
+ {"+": 0, "-": 180}, label_direction=label_direction)
+
+ def get_transform(self):
+ return self.axes.transAxes + self.offset_transform
+
+ def get_helper(self):
+ """
+ Return axis artist helper instance.
+ """
+ return self._axis_artist_helper
+
+ def set_axisline_style(self, axisline_style=None, **kwargs):
+ """
+ Set the axisline style.
+
+ The new style is completely defined by the passed attributes. Existing
+ style attributes are forgotten.
+
+ Parameters
+ ----------
+ axisline_style : str or None
+ The line style, e.g. '->', optionally followed by a comma-separated
+ list of attributes. Alternatively, the attributes can be provided
+ as keywords.
+
+ If *None* this returns a string containing the available styles.
+
+ Examples
+ --------
+ The following two commands are equal:
+ >>> set_axisline_style("->,size=1.5")
+ >>> set_axisline_style("->", size=1.5)
+ """
+ if axisline_style is None:
+ return AxislineStyle.pprint_styles()
+
+ if isinstance(axisline_style, AxislineStyle._Base):
+ self._axisline_style = axisline_style
+ else:
+ self._axisline_style = AxislineStyle(axisline_style, **kwargs)
+
+ self._init_line()
+
+ def get_axisline_style(self):
+ """Return the current axisline style."""
+ return self._axisline_style
+
+ def _init_line(self):
+ """
+ Initialize the *line* artist that is responsible to draw the axis line.
+ """
+ tran = (self._axis_artist_helper.get_line_transform(self.axes)
+ + self.offset_transform)
+
+ axisline_style = self.get_axisline_style()
+ if axisline_style is None:
+ self.line = PathPatch(
+ self._axis_artist_helper.get_line(self.axes),
+ color=rcParams['axes.edgecolor'],
+ fill=False,
+ linewidth=rcParams['axes.linewidth'],
+ capstyle=rcParams['lines.solid_capstyle'],
+ joinstyle=rcParams['lines.solid_joinstyle'],
+ transform=tran)
+ else:
+ self.line = axisline_style(self, transform=tran)
+
+ def _draw_line(self, renderer):
+ self.line.set_path(self._axis_artist_helper.get_line(self.axes))
+ if self.get_axisline_style() is not None:
+ self.line.set_line_mutation_scale(self.major_ticklabels.get_size())
+ self.line.draw(renderer)
+
+ def _init_ticks(self, **kwargs):
+ axis_name = self.axis.axis_name
+
+ trans = (self._axis_artist_helper.get_tick_transform(self.axes)
+ + self.offset_transform)
+
+ self.major_ticks = Ticks(
+ kwargs.get(
+ "major_tick_size", rcParams[f"{axis_name}tick.major.size"]),
+ axis=self.axis, transform=trans)
+ self.minor_ticks = Ticks(
+ kwargs.get(
+ "minor_tick_size", rcParams[f"{axis_name}tick.minor.size"]),
+ axis=self.axis, transform=trans)
+
+ size = rcParams[f"{axis_name}tick.labelsize"]
+ self.major_ticklabels = TickLabels(
+ axis=self.axis,
+ axis_direction=self._axis_direction,
+ figure=self.axes.figure,
+ transform=trans,
+ fontsize=size,
+ pad=kwargs.get(
+ "major_tick_pad", rcParams[f"{axis_name}tick.major.pad"]),
+ )
+ self.minor_ticklabels = TickLabels(
+ axis=self.axis,
+ axis_direction=self._axis_direction,
+ figure=self.axes.figure,
+ transform=trans,
+ fontsize=size,
+ pad=kwargs.get(
+ "minor_tick_pad", rcParams[f"{axis_name}tick.minor.pad"]),
+ )
+
+ def _get_tick_info(self, tick_iter):
+ """
+ Return a pair of:
+
+ - list of locs and angles for ticks
+ - list of locs, angles and labels for ticklabels.
+ """
+ ticks_loc_angle = []
+ ticklabels_loc_angle_label = []
+
+ ticklabel_add_angle = self._ticklabel_add_angle
+
+ for loc, angle_normal, angle_tangent, label in tick_iter:
+ angle_label = angle_tangent - 90 + ticklabel_add_angle
+ angle_tick = (angle_normal
+ if 90 <= (angle_label - angle_normal) % 360 <= 270
+ else angle_normal + 180)
+ ticks_loc_angle.append([loc, angle_tick])
+ ticklabels_loc_angle_label.append([loc, angle_label, label])
+
+ return ticks_loc_angle, ticklabels_loc_angle_label
+
+ def _update_ticks(self, renderer):
+ # set extra pad for major and minor ticklabels: use ticksize of
+ # majorticks even for minor ticks. not clear what is best.
+
+ dpi_cor = renderer.points_to_pixels(1.)
+ if self.major_ticks.get_visible() and self.major_ticks.get_tick_out():
+ self.major_ticklabels._set_external_pad(
+ self.major_ticks._ticksize * dpi_cor)
+ self.minor_ticklabels._set_external_pad(
+ self.major_ticks._ticksize * dpi_cor)
+ else:
+ self.major_ticklabels._set_external_pad(0)
+ self.minor_ticklabels._set_external_pad(0)
+
+ majortick_iter, minortick_iter = \
+ self._axis_artist_helper.get_tick_iterators(self.axes)
+
+ tick_loc_angle, ticklabel_loc_angle_label = \
+ self._get_tick_info(majortick_iter)
+ self.major_ticks.set_locs_angles(tick_loc_angle)
+ self.major_ticklabels.set_locs_angles_labels(ticklabel_loc_angle_label)
+
+ tick_loc_angle, ticklabel_loc_angle_label = \
+ self._get_tick_info(minortick_iter)
+ self.minor_ticks.set_locs_angles(tick_loc_angle)
+ self.minor_ticklabels.set_locs_angles_labels(ticklabel_loc_angle_label)
+
+ def _draw_ticks(self, renderer):
+ self._update_ticks(renderer)
+ self.major_ticks.draw(renderer)
+ self.major_ticklabels.draw(renderer)
+ self.minor_ticks.draw(renderer)
+ self.minor_ticklabels.draw(renderer)
+ if (self.major_ticklabels.get_visible()
+ or self.minor_ticklabels.get_visible()):
+ self._draw_offsetText(renderer)
+
+ _offsetText_pos = dict(left=(0, 1, "bottom", "right"),
+ right=(1, 1, "bottom", "left"),
+ bottom=(1, 0, "top", "right"),
+ top=(1, 1, "bottom", "right"))
+
+ def _init_offsetText(self, direction):
+ x, y, va, ha = self._offsetText_pos[direction]
+ self.offsetText = mtext.Annotation(
+ "",
+ xy=(x, y), xycoords="axes fraction",
+ xytext=(0, 0), textcoords="offset points",
+ color=rcParams['xtick.color'],
+ horizontalalignment=ha, verticalalignment=va,
+ )
+ self.offsetText.set_transform(IdentityTransform())
+ self.axes._set_artist_props(self.offsetText)
+
+ def _update_offsetText(self):
+ self.offsetText.set_text(self.axis.major.formatter.get_offset())
+ self.offsetText.set_size(self.major_ticklabels.get_size())
+ offset = (self.major_ticklabels.get_pad()
+ + self.major_ticklabels.get_size()
+ + 2)
+ self.offsetText.xyann = (0, offset)
+
+ def _draw_offsetText(self, renderer):
+ self._update_offsetText()
+ self.offsetText.draw(renderer)
+
+ def _init_label(self, **kwargs):
+ tr = (self._axis_artist_helper.get_axislabel_transform(self.axes)
+ + self.offset_transform)
+ self.label = AxisLabel(
+ 0, 0, "__from_axes__",
+ color="auto",
+ fontsize=kwargs.get("labelsize", rcParams['axes.labelsize']),
+ fontweight=rcParams['axes.labelweight'],
+ axis=self.axis,
+ transform=tr,
+ axis_direction=self._axis_direction,
+ )
+ self.label.set_figure(self.axes.figure)
+ labelpad = kwargs.get("labelpad", 5)
+ self.label.set_pad(labelpad)
+
+ def _update_label(self, renderer):
+ if not self.label.get_visible():
+ return
+
+ if self._ticklabel_add_angle != self._axislabel_add_angle:
+ if ((self.major_ticks.get_visible()
+ and not self.major_ticks.get_tick_out())
+ or (self.minor_ticks.get_visible()
+ and not self.major_ticks.get_tick_out())):
+ axislabel_pad = self.major_ticks._ticksize
+ else:
+ axislabel_pad = 0
+ else:
+ axislabel_pad = max(self.major_ticklabels._axislabel_pad,
+ self.minor_ticklabels._axislabel_pad)
+
+ self.label._set_external_pad(axislabel_pad)
+
+ xy, angle_tangent = \
+ self._axis_artist_helper.get_axislabel_pos_angle(self.axes)
+ if xy is None:
+ return
+
+ angle_label = angle_tangent - 90
+
+ x, y = xy
+ self.label._set_ref_angle(angle_label+self._axislabel_add_angle)
+ self.label.set(x=x, y=y)
+
+ def _draw_label(self, renderer):
+ self._update_label(renderer)
+ self.label.draw(renderer)
+
+ def set_label(self, s):
+ self.label.set_text(s)
+
+ def get_tightbbox(self, renderer):
+ if not self.get_visible():
+ return
+ self._axis_artist_helper.update_lim(self.axes)
+ self._update_ticks(renderer)
+ self._update_label(renderer)
+ bb = [
+ *self.major_ticklabels.get_window_extents(renderer),
+ *self.minor_ticklabels.get_window_extents(renderer),
+ self.label.get_window_extent(renderer),
+ self.offsetText.get_window_extent(renderer),
+ ]
+ bb = [b for b in bb if b and (b.width != 0 or b.height != 0)]
+ if bb:
+ _bbox = Bbox.union(bb)
+ return _bbox
+ else:
+ return None
+
+ @martist.allow_rasterization
+ def draw(self, renderer):
+ # docstring inherited
+ if not self.get_visible():
+ return
+ renderer.open_group(__name__, gid=self.get_gid())
+ self._axis_artist_helper.update_lim(self.axes)
+ self._draw_ticks(renderer)
+ self._draw_line(renderer)
+ self._draw_label(renderer)
+ renderer.close_group(__name__)
+
+ def toggle(self, all=None, ticks=None, ticklabels=None, label=None):
+ """
+ Toggle visibility of ticks, ticklabels, and (axis) label.
+ To turn all off, ::
+
+ axis.toggle(all=False)
+
+ To turn all off but ticks on ::
+
+ axis.toggle(all=False, ticks=True)
+
+ To turn all on but (axis) label off ::
+
+ axis.toggle(all=True, label=False))
+
+ """
+ if all:
+ _ticks, _ticklabels, _label = True, True, True
+ elif all is not None:
+ _ticks, _ticklabels, _label = False, False, False
+ else:
+ _ticks, _ticklabels, _label = None, None, None
+
+ if ticks is not None:
+ _ticks = ticks
+ if ticklabels is not None:
+ _ticklabels = ticklabels
+ if label is not None:
+ _label = label
+
+ if _ticks is not None:
+ self.major_ticks.set_visible(_ticks)
+ self.minor_ticks.set_visible(_ticks)
+ if _ticklabels is not None:
+ self.major_ticklabels.set_visible(_ticklabels)
+ self.minor_ticklabels.set_visible(_ticklabels)
+ if _label is not None:
+ self.label.set_visible(_label)
diff --git a/venv/Lib/site-packages/mpl_toolkits/axisartist/axisline_style.py b/venv/Lib/site-packages/mpl_toolkits/axisartist/axisline_style.py
new file mode 100644
index 0000000..80f3ce5
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axisartist/axisline_style.py
@@ -0,0 +1,149 @@
+import math
+
+import numpy as np
+
+from matplotlib.patches import _Style, FancyArrowPatch
+from matplotlib.transforms import IdentityTransform
+from matplotlib.path import Path
+
+
+class _FancyAxislineStyle:
+ class SimpleArrow(FancyArrowPatch):
+ """
+ The artist class that will be returned for SimpleArrow style.
+ """
+ _ARROW_STYLE = "->"
+
+ def __init__(self, axis_artist, line_path, transform,
+ line_mutation_scale):
+ self._axis_artist = axis_artist
+ self._line_transform = transform
+ self._line_path = line_path
+ self._line_mutation_scale = line_mutation_scale
+
+ FancyArrowPatch.__init__(self,
+ path=self._line_path,
+ arrowstyle=self._ARROW_STYLE,
+ patchA=None,
+ patchB=None,
+ shrinkA=0.,
+ shrinkB=0.,
+ mutation_scale=line_mutation_scale,
+ mutation_aspect=None,
+ transform=IdentityTransform(),
+ )
+
+ def set_line_mutation_scale(self, scale):
+ self.set_mutation_scale(scale*self._line_mutation_scale)
+
+ def _extend_path(self, path, mutation_size=10):
+ """
+ Extend the path to make a room for drawing arrow.
+ """
+ (x0, y0), (x1, y1) = path.vertices[-2:]
+ theta = math.atan2(y1 - y0, x1 - x0)
+ x2 = x1 + math.cos(theta) * mutation_size
+ y2 = y1 + math.sin(theta) * mutation_size
+ if path.codes is None:
+ return Path(np.concatenate([path.vertices, [[x2, y2]]]))
+ else:
+ return Path(np.concatenate([path.vertices, [[x2, y2]]]),
+ np.concatenate([path.codes, [Path.LINETO]]))
+
+ def set_path(self, path):
+ self._line_path = path
+
+ def draw(self, renderer):
+ """
+ Draw the axis line.
+ 1) transform the path to the display coordinate.
+ 2) extend the path to make a room for arrow
+ 3) update the path of the FancyArrowPatch.
+ 4) draw
+ """
+ path_in_disp = self._line_transform.transform_path(self._line_path)
+ mutation_size = self.get_mutation_scale() # line_mutation_scale()
+ extended_path = self._extend_path(path_in_disp,
+ mutation_size=mutation_size)
+ self._path_original = extended_path
+ FancyArrowPatch.draw(self, renderer)
+
+ class FilledArrow(SimpleArrow):
+ """
+ The artist class that will be returned for SimpleArrow style.
+ """
+ _ARROW_STYLE = "-|>"
+
+
+class AxislineStyle(_Style):
+ """
+ A container class which defines style classes for AxisArtists.
+
+ An instance of any axisline style class is an callable object,
+ whose call signature is ::
+
+ __call__(self, axis_artist, path, transform)
+
+ When called, this should return an `.Artist` with the following methods::
+
+ def set_path(self, path):
+ # set the path for axisline.
+
+ def set_line_mutation_scale(self, scale):
+ # set the scale
+
+ def draw(self, renderer):
+ # draw
+ """
+
+ _style_list = {}
+
+ class _Base:
+ # The derived classes are required to be able to be initialized
+ # w/o arguments, i.e., all its argument (except self) must have
+ # the default values.
+
+ def __init__(self):
+ """
+ initialization.
+ """
+ super().__init__()
+
+ def __call__(self, axis_artist, transform):
+ """
+ Given the AxisArtist instance, and transform for the path (set_path
+ method), return the Matplotlib artist for drawing the axis line.
+ """
+ return self.new_line(axis_artist, transform)
+
+ class SimpleArrow(_Base):
+ """
+ A simple arrow.
+ """
+
+ ArrowAxisClass = _FancyAxislineStyle.SimpleArrow
+
+ def __init__(self, size=1):
+ """
+ Parameters
+ ----------
+ size : float
+ Size of the arrow as a fraction of the ticklabel size.
+ """
+
+ self.size = size
+ super().__init__()
+
+ def new_line(self, axis_artist, transform):
+
+ linepath = Path([(0, 0), (0, 1)])
+ axisline = self.ArrowAxisClass(axis_artist, linepath, transform,
+ line_mutation_scale=self.size)
+ return axisline
+
+ _style_list["->"] = SimpleArrow
+
+ class FilledArrow(SimpleArrow):
+ ArrowAxisClass = _FancyAxislineStyle.FilledArrow
+
+ _style_list["-|>"] = FilledArrow
diff --git a/venv/Lib/site-packages/mpl_toolkits/axisartist/axislines.py b/venv/Lib/site-packages/mpl_toolkits/axisartist/axislines.py
new file mode 100644
index 0000000..c49610b
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axisartist/axislines.py
@@ -0,0 +1,607 @@
+"""
+Axislines includes modified implementation of the Axes class. The
+biggest difference is that the artists responsible for drawing the axis spine,
+ticks, ticklabels and axis labels are separated out from Matplotlib's Axis
+class. Originally, this change was motivated to support curvilinear
+grid. Here are a few reasons that I came up with a new axes class:
+
+* "top" and "bottom" x-axis (or "left" and "right" y-axis) can have
+ different ticks (tick locations and labels). This is not possible
+ with the current Matplotlib, although some twin axes trick can help.
+
+* Curvilinear grid.
+
+* angled ticks.
+
+In the new axes class, xaxis and yaxis is set to not visible by
+default, and new set of artist (AxisArtist) are defined to draw axis
+line, ticks, ticklabels and axis label. Axes.axis attribute serves as
+a dictionary of these artists, i.e., ax.axis["left"] is a AxisArtist
+instance responsible to draw left y-axis. The default Axes.axis contains
+"bottom", "left", "top" and "right".
+
+AxisArtist can be considered as a container artist and
+has following children artists which will draw ticks, labels, etc.
+
+* line
+* major_ticks, major_ticklabels
+* minor_ticks, minor_ticklabels
+* offsetText
+* label
+
+Note that these are separate artists from `matplotlib.axis.Axis`, thus most
+tick-related functions in Matplotlib won't work. For example, color and
+markerwidth of the ``ax.axis["bottom"].major_ticks`` will follow those of
+Axes.xaxis unless explicitly specified.
+
+In addition to AxisArtist, the Axes will have *gridlines* attribute,
+which obviously draws grid lines. The gridlines needs to be separated
+from the axis as some gridlines can never pass any axis.
+"""
+
+import numpy as np
+
+from matplotlib import _api, rcParams
+import matplotlib.axes as maxes
+from matplotlib.path import Path
+from mpl_toolkits.axes_grid1 import mpl_axes
+from .axisline_style import AxislineStyle
+from .axis_artist import AxisArtist, GridlinesCollection
+
+
+class AxisArtistHelper:
+ """
+ AxisArtistHelper should define
+ following method with given APIs. Note that the first axes argument
+ will be axes attribute of the caller artist.::
+
+
+ # LINE (spinal line?)
+
+ def get_line(self, axes):
+ # path : Path
+ return path
+
+ def get_line_transform(self, axes):
+ # ...
+ # trans : transform
+ return trans
+
+ # LABEL
+
+ def get_label_pos(self, axes):
+ # x, y : position
+ return (x, y), trans
+
+
+ def get_label_offset_transform(self,
+ axes,
+ pad_points, fontprops, renderer,
+ bboxes,
+ ):
+ # va : vertical alignment
+ # ha : horizontal alignment
+ # a : angle
+ return trans, va, ha, a
+
+ # TICK
+
+ def get_tick_transform(self, axes):
+ return trans
+
+ def get_tick_iterators(self, axes):
+ # iter : iterable object that yields (c, angle, l) where
+ # c, angle, l is position, tick angle, and label
+
+ return iter_major, iter_minor
+ """
+
+ class _Base:
+ """Base class for axis helper."""
+ def __init__(self):
+ self.delta1, self.delta2 = 0.00001, 0.00001
+
+ def update_lim(self, axes):
+ pass
+
+ class Fixed(_Base):
+ """Helper class for a fixed (in the axes coordinate) axis."""
+
+ _default_passthru_pt = dict(left=(0, 0),
+ right=(1, 0),
+ bottom=(0, 0),
+ top=(0, 1))
+
+ def __init__(self, loc, nth_coord=None):
+ """
+ nth_coord = along which coordinate value varies
+ in 2D, nth_coord = 0 -> x axis, nth_coord = 1 -> y axis
+ """
+ _api.check_in_list(["left", "right", "bottom", "top"], loc=loc)
+ self._loc = loc
+
+ if nth_coord is None:
+ if loc in ["left", "right"]:
+ nth_coord = 1
+ elif loc in ["bottom", "top"]:
+ nth_coord = 0
+
+ self.nth_coord = nth_coord
+
+ super().__init__()
+
+ self.passthru_pt = self._default_passthru_pt[loc]
+
+ _verts = np.array([[0., 0.],
+ [1., 1.]])
+ fixed_coord = 1 - nth_coord
+ _verts[:, fixed_coord] = self.passthru_pt[fixed_coord]
+
+ # axis line in transAxes
+ self._path = Path(_verts)
+
+ def get_nth_coord(self):
+ return self.nth_coord
+
+ # LINE
+
+ def get_line(self, axes):
+ return self._path
+
+ def get_line_transform(self, axes):
+ return axes.transAxes
+
+ # LABEL
+
+ def get_axislabel_transform(self, axes):
+ return axes.transAxes
+
+ def get_axislabel_pos_angle(self, axes):
+ """
+ Return the label reference position in transAxes.
+
+ get_label_transform() returns a transform of (transAxes+offset)
+ """
+ return dict(left=((0., 0.5), 90), # (position, angle_tangent)
+ right=((1., 0.5), 90),
+ bottom=((0.5, 0.), 0),
+ top=((0.5, 1.), 0))[self._loc]
+
+ # TICK
+
+ def get_tick_transform(self, axes):
+ return [axes.get_xaxis_transform(),
+ axes.get_yaxis_transform()][self.nth_coord]
+
+ class Floating(_Base):
+
+ def __init__(self, nth_coord, value):
+ self.nth_coord = nth_coord
+ self._value = value
+ super().__init__()
+
+ def get_nth_coord(self):
+ return self.nth_coord
+
+ def get_line(self, axes):
+ raise RuntimeError(
+ "get_line method should be defined by the derived class")
+
+
+class AxisArtistHelperRectlinear:
+
+ class Fixed(AxisArtistHelper.Fixed):
+
+ def __init__(self, axes, loc, nth_coord=None):
+ """
+ nth_coord = along which coordinate value varies
+ in 2D, nth_coord = 0 -> x axis, nth_coord = 1 -> y axis
+ """
+ super().__init__(loc, nth_coord)
+ self.axis = [axes.xaxis, axes.yaxis][self.nth_coord]
+
+ # TICK
+
+ def get_tick_iterators(self, axes):
+ """tick_loc, tick_angle, tick_label"""
+
+ loc = self._loc
+
+ if loc in ["bottom", "top"]:
+ angle_normal, angle_tangent = 90, 0
+ else:
+ angle_normal, angle_tangent = 0, 90
+
+ major = self.axis.major
+ majorLocs = major.locator()
+ majorLabels = major.formatter.format_ticks(majorLocs)
+
+ minor = self.axis.minor
+ minorLocs = minor.locator()
+ minorLabels = minor.formatter.format_ticks(minorLocs)
+
+ tick_to_axes = self.get_tick_transform(axes) - axes.transAxes
+
+ def _f(locs, labels):
+ for x, l in zip(locs, labels):
+
+ c = list(self.passthru_pt) # copy
+ c[self.nth_coord] = x
+
+ # check if the tick point is inside axes
+ c2 = tick_to_axes.transform(c)
+ if (0 - self.delta1
+ <= c2[self.nth_coord]
+ <= 1 + self.delta2):
+ yield c, angle_normal, angle_tangent, l
+
+ return _f(majorLocs, majorLabels), _f(minorLocs, minorLabels)
+
+ class Floating(AxisArtistHelper.Floating):
+ def __init__(self, axes, nth_coord,
+ passingthrough_point, axis_direction="bottom"):
+ super().__init__(nth_coord, passingthrough_point)
+ self._axis_direction = axis_direction
+ self.axis = [axes.xaxis, axes.yaxis][self.nth_coord]
+
+ def get_line(self, axes):
+ _verts = np.array([[0., 0.],
+ [1., 1.]])
+
+ fixed_coord = 1 - self.nth_coord
+ data_to_axes = axes.transData - axes.transAxes
+ p = data_to_axes.transform([self._value, self._value])
+ _verts[:, fixed_coord] = p[fixed_coord]
+
+ return Path(_verts)
+
+ def get_line_transform(self, axes):
+ return axes.transAxes
+
+ def get_axislabel_transform(self, axes):
+ return axes.transAxes
+
+ def get_axislabel_pos_angle(self, axes):
+ """
+ Return the label reference position in transAxes.
+
+ get_label_transform() returns a transform of (transAxes+offset)
+ """
+ angle = [0, 90][self.nth_coord]
+ _verts = [0.5, 0.5]
+ fixed_coord = 1 - self.nth_coord
+ data_to_axes = axes.transData - axes.transAxes
+ p = data_to_axes.transform([self._value, self._value])
+ _verts[fixed_coord] = p[fixed_coord]
+ if 0 <= _verts[fixed_coord] <= 1:
+ return _verts, angle
+ else:
+ return None, None
+
+ def get_tick_transform(self, axes):
+ return axes.transData
+
+ def get_tick_iterators(self, axes):
+ """tick_loc, tick_angle, tick_label"""
+ if self.nth_coord == 0:
+ angle_normal, angle_tangent = 90, 0
+ else:
+ angle_normal, angle_tangent = 0, 90
+
+ major = self.axis.major
+ majorLocs = major.locator()
+ majorLabels = major.formatter.format_ticks(majorLocs)
+
+ minor = self.axis.minor
+ minorLocs = minor.locator()
+ minorLabels = minor.formatter.format_ticks(minorLocs)
+
+ data_to_axes = axes.transData - axes.transAxes
+
+ def _f(locs, labels):
+ for x, l in zip(locs, labels):
+ c = [self._value, self._value]
+ c[self.nth_coord] = x
+ c1, c2 = data_to_axes.transform(c)
+ if (0 <= c1 <= 1 and 0 <= c2 <= 1
+ and 0 - self.delta1
+ <= [c1, c2][self.nth_coord]
+ <= 1 + self.delta2):
+ yield c, angle_normal, angle_tangent, l
+
+ return _f(majorLocs, majorLabels), _f(minorLocs, minorLabels)
+
+
+class GridHelperBase:
+
+ def __init__(self):
+ self._force_update = True # Remove together with invalidate()/valid().
+ self._old_limits = None
+ super().__init__()
+
+ def update_lim(self, axes):
+ x1, x2 = axes.get_xlim()
+ y1, y2 = axes.get_ylim()
+ if self._force_update or self._old_limits != (x1, x2, y1, y2):
+ self._update_grid(x1, y1, x2, y2)
+ self._force_update = False
+ self._old_limits = (x1, x2, y1, y2)
+
+ def _update_grid(self, x1, y1, x2, y2):
+ """Cache relevant computations when the axes limits have changed."""
+
+ @_api.deprecated("3.4")
+ def invalidate(self):
+ self._force_update = True
+
+ @_api.deprecated("3.4")
+ def valid(self):
+ return not self._force_update
+
+ def get_gridlines(self, which, axis):
+ """
+ Return list of grid lines as a list of paths (list of points).
+
+ *which* : "major" or "minor"
+ *axis* : "both", "x" or "y"
+ """
+ return []
+
+ def new_gridlines(self, ax):
+ """
+ Create and return a new GridlineCollection instance.
+
+ *which* : "major" or "minor"
+ *axis* : "both", "x" or "y"
+
+ """
+ gridlines = GridlinesCollection(None, transform=ax.transData,
+ colors=rcParams['grid.color'],
+ linestyles=rcParams['grid.linestyle'],
+ linewidths=rcParams['grid.linewidth'])
+ ax._set_artist_props(gridlines)
+ gridlines.set_grid_helper(self)
+
+ ax.axes._set_artist_props(gridlines)
+ # gridlines.set_clip_path(self.axes.patch)
+ # set_clip_path need to be deferred after Axes.cla is completed.
+ # It is done inside the cla.
+
+ return gridlines
+
+
+class GridHelperRectlinear(GridHelperBase):
+
+ def __init__(self, axes):
+ super().__init__()
+ self.axes = axes
+
+ def new_fixed_axis(self, loc,
+ nth_coord=None,
+ axis_direction=None,
+ offset=None,
+ axes=None,
+ ):
+
+ if axes is None:
+ _api.warn_external(
+ "'new_fixed_axis' explicitly requires the axes keyword.")
+ axes = self.axes
+
+ _helper = AxisArtistHelperRectlinear.Fixed(axes, loc, nth_coord)
+
+ if axis_direction is None:
+ axis_direction = loc
+ axisline = AxisArtist(axes, _helper, offset=offset,
+ axis_direction=axis_direction,
+ )
+
+ return axisline
+
+ def new_floating_axis(self, nth_coord, value,
+ axis_direction="bottom",
+ axes=None,
+ ):
+
+ if axes is None:
+ _api.warn_external(
+ "'new_floating_axis' explicitly requires the axes keyword.")
+ axes = self.axes
+
+ _helper = AxisArtistHelperRectlinear.Floating(
+ axes, nth_coord, value, axis_direction)
+
+ axisline = AxisArtist(axes, _helper, axis_direction=axis_direction)
+
+ axisline.line.set_clip_on(True)
+ axisline.line.set_clip_box(axisline.axes.bbox)
+ return axisline
+
+ def get_gridlines(self, which="major", axis="both"):
+ """
+ Return list of gridline coordinates in data coordinates.
+
+ *which* : "major" or "minor"
+ *axis* : "both", "x" or "y"
+ """
+ gridlines = []
+
+ if axis in ["both", "x"]:
+ locs = []
+ y1, y2 = self.axes.get_ylim()
+ if which in ["both", "major"]:
+ locs.extend(self.axes.xaxis.major.locator())
+ if which in ["both", "minor"]:
+ locs.extend(self.axes.xaxis.minor.locator())
+
+ for x in locs:
+ gridlines.append([[x, x], [y1, y2]])
+
+ if axis in ["both", "y"]:
+ x1, x2 = self.axes.get_xlim()
+ locs = []
+ if self.axes.yaxis._major_tick_kw["gridOn"]:
+ locs.extend(self.axes.yaxis.major.locator())
+ if self.axes.yaxis._minor_tick_kw["gridOn"]:
+ locs.extend(self.axes.yaxis.minor.locator())
+
+ for y in locs:
+ gridlines.append([[x1, x2], [y, y]])
+
+ return gridlines
+
+
+class Axes(maxes.Axes):
+
+ def __call__(self, *args, **kwargs):
+ return maxes.Axes.axis(self.axes, *args, **kwargs)
+
+ def __init__(self, *args, grid_helper=None, **kwargs):
+ self._axisline_on = True
+ self._grid_helper = (grid_helper if grid_helper
+ else GridHelperRectlinear(self))
+ super().__init__(*args, **kwargs)
+ self.toggle_axisline(True)
+
+ def toggle_axisline(self, b=None):
+ if b is None:
+ b = not self._axisline_on
+ if b:
+ self._axisline_on = True
+ self.spines[:].set_visible(False)
+ self.xaxis.set_visible(False)
+ self.yaxis.set_visible(False)
+ else:
+ self._axisline_on = False
+ self.spines[:].set_visible(True)
+ self.xaxis.set_visible(True)
+ self.yaxis.set_visible(True)
+
+ def _init_axis_artists(self, axes=None):
+ if axes is None:
+ axes = self
+
+ self._axislines = mpl_axes.Axes.AxisDict(self)
+ new_fixed_axis = self.get_grid_helper().new_fixed_axis
+ for loc in ["bottom", "top", "left", "right"]:
+ self._axislines[loc] = new_fixed_axis(loc=loc, axes=axes,
+ axis_direction=loc)
+
+ for axisline in [self._axislines["top"], self._axislines["right"]]:
+ axisline.label.set_visible(False)
+ axisline.major_ticklabels.set_visible(False)
+ axisline.minor_ticklabels.set_visible(False)
+
+ @property
+ def axis(self):
+ return self._axislines
+
+ def new_gridlines(self, grid_helper=None):
+ """
+ Create and return a new GridlineCollection instance.
+
+ *which* : "major" or "minor"
+ *axis* : "both", "x" or "y"
+
+ """
+ if grid_helper is None:
+ grid_helper = self.get_grid_helper()
+
+ gridlines = grid_helper.new_gridlines(self)
+ return gridlines
+
+ def _init_gridlines(self, grid_helper=None):
+ # It is done inside the cla.
+ self.gridlines = self.new_gridlines(grid_helper)
+
+ def cla(self):
+ # gridlines need to b created before cla() since cla calls grid()
+ self._init_gridlines()
+ super().cla()
+
+ # the clip_path should be set after Axes.cla() since that's
+ # when a patch is created.
+ self.gridlines.set_clip_path(self.axes.patch)
+
+ self._init_axis_artists()
+
+ def get_grid_helper(self):
+ return self._grid_helper
+
+ def grid(self, b=None, which='major', axis="both", **kwargs):
+ """
+ Toggle the gridlines, and optionally set the properties of the lines.
+ """
+ # There are some discrepancies in the behavior of grid() between
+ # axes_grid and Matplotlib, because axes_grid explicitly sets the
+ # visibility of the gridlines.
+ super().grid(b, which=which, axis=axis, **kwargs)
+ if not self._axisline_on:
+ return
+ if b is None:
+ b = (self.axes.xaxis._minor_tick_kw["gridOn"]
+ or self.axes.xaxis._major_tick_kw["gridOn"]
+ or self.axes.yaxis._minor_tick_kw["gridOn"]
+ or self.axes.yaxis._major_tick_kw["gridOn"])
+ self.gridlines.set(which=which, axis=axis, visible=b)
+ self.gridlines.set(**kwargs)
+
+ def get_children(self):
+ if self._axisline_on:
+ children = [*self._axislines.values(), self.gridlines]
+ else:
+ children = []
+ children.extend(super().get_children())
+ return children
+
+ @_api.deprecated("3.4")
+ def invalidate_grid_helper(self):
+ self._grid_helper.invalidate()
+
+ def new_fixed_axis(self, loc, offset=None):
+ gh = self.get_grid_helper()
+ axis = gh.new_fixed_axis(loc,
+ nth_coord=None,
+ axis_direction=None,
+ offset=offset,
+ axes=self,
+ )
+ return axis
+
+ def new_floating_axis(self, nth_coord, value, axis_direction="bottom"):
+ gh = self.get_grid_helper()
+ axis = gh.new_floating_axis(nth_coord, value,
+ axis_direction=axis_direction,
+ axes=self)
+ return axis
+
+
+Subplot = maxes.subplot_class_factory(Axes)
+
+
+class AxesZero(Axes):
+
+ def _init_axis_artists(self):
+ super()._init_axis_artists()
+
+ new_floating_axis = self._grid_helper.new_floating_axis
+ xaxis_zero = new_floating_axis(nth_coord=0,
+ value=0.,
+ axis_direction="bottom",
+ axes=self)
+
+ xaxis_zero.line.set_clip_path(self.patch)
+ xaxis_zero.set_visible(False)
+ self._axislines["xzero"] = xaxis_zero
+
+ yaxis_zero = new_floating_axis(nth_coord=1,
+ value=0.,
+ axis_direction="left",
+ axes=self)
+
+ yaxis_zero.line.set_clip_path(self.patch)
+ yaxis_zero.set_visible(False)
+ self._axislines["yzero"] = yaxis_zero
+
+
+SubplotZero = maxes.subplot_class_factory(AxesZero)
diff --git a/venv/Lib/site-packages/mpl_toolkits/axisartist/clip_path.py b/venv/Lib/site-packages/mpl_toolkits/axisartist/clip_path.py
new file mode 100644
index 0000000..830dc7f
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axisartist/clip_path.py
@@ -0,0 +1,118 @@
+import numpy as np
+from math import degrees
+from matplotlib import _api
+import math
+
+
+def atan2(dy, dx):
+ if dx == 0 and dy == 0:
+ _api.warn_external("dx and dy are 0")
+ return 0
+ else:
+ return math.atan2(dy, dx)
+
+
+# FIXME : The current algorithm seems to return incorrect angle when the line
+# ends at the boundary.
+def clip(xlines, ylines, x0, clip="right", xdir=True, ydir=True):
+
+ clipped_xlines = []
+ clipped_ylines = []
+
+ _pos_angles = []
+
+ xsign = 1 if xdir else -1
+ ysign = 1 if ydir else -1
+
+ for x, y in zip(xlines, ylines):
+
+ if clip in ["up", "right"]:
+ b = (x < x0).astype("i")
+ db = b[1:] - b[:-1]
+ else:
+ b = (x > x0).astype("i")
+ db = b[1:] - b[:-1]
+
+ if b[0]:
+ ns = 0
+ else:
+ ns = -1
+ segx, segy = [], []
+ for (i,) in np.argwhere(db):
+ c = db[i]
+ if c == -1:
+ dx = (x0 - x[i])
+ dy = (y[i+1] - y[i]) * (dx / (x[i+1] - x[i]))
+ y0 = y[i] + dy
+ clipped_xlines.append(np.concatenate([segx, x[ns:i+1], [x0]]))
+ clipped_ylines.append(np.concatenate([segy, y[ns:i+1], [y0]]))
+ ns = -1
+ segx, segy = [], []
+
+ if dx == 0. and dy == 0:
+ dx = x[i+1] - x[i]
+ dy = y[i+1] - y[i]
+
+ a = degrees(atan2(ysign*dy, xsign*dx))
+ _pos_angles.append((x0, y0, a))
+
+ elif c == 1:
+ dx = (x0 - x[i])
+ dy = (y[i+1] - y[i]) * (dx / (x[i+1] - x[i]))
+ y0 = y[i] + dy
+ segx, segy = [x0], [y0]
+ ns = i+1
+
+ if dx == 0. and dy == 0:
+ dx = x[i+1] - x[i]
+ dy = y[i+1] - y[i]
+
+ a = degrees(atan2(ysign*dy, xsign*dx))
+ _pos_angles.append((x0, y0, a))
+
+ if ns != -1:
+ clipped_xlines.append(np.concatenate([segx, x[ns:]]))
+ clipped_ylines.append(np.concatenate([segy, y[ns:]]))
+
+ return clipped_xlines, clipped_ylines, _pos_angles
+
+
+def clip_line_to_rect(xline, yline, bbox):
+
+ x0, y0, x1, y1 = bbox.extents
+
+ xdir = x1 > x0
+ ydir = y1 > y0
+
+ if x1 > x0:
+ lx1, ly1, c_right_ = clip([xline], [yline], x1,
+ clip="right", xdir=xdir, ydir=ydir)
+ lx2, ly2, c_left_ = clip(lx1, ly1, x0,
+ clip="left", xdir=xdir, ydir=ydir)
+ else:
+ lx1, ly1, c_right_ = clip([xline], [yline], x0,
+ clip="right", xdir=xdir, ydir=ydir)
+ lx2, ly2, c_left_ = clip(lx1, ly1, x1,
+ clip="left", xdir=xdir, ydir=ydir)
+
+ if y1 > y0:
+ ly3, lx3, c_top_ = clip(ly2, lx2, y1,
+ clip="right", xdir=ydir, ydir=xdir)
+ ly4, lx4, c_bottom_ = clip(ly3, lx3, y0,
+ clip="left", xdir=ydir, ydir=xdir)
+ else:
+ ly3, lx3, c_top_ = clip(ly2, lx2, y0,
+ clip="right", xdir=ydir, ydir=xdir)
+ ly4, lx4, c_bottom_ = clip(ly3, lx3, y1,
+ clip="left", xdir=ydir, ydir=xdir)
+
+ c_left = [((x, y), (a + 90) % 180 - 90) for x, y, a in c_left_
+ if bbox.containsy(y)]
+ c_bottom = [((x, y), (90 - a) % 180) for y, x, a in c_bottom_
+ if bbox.containsx(x)]
+ c_right = [((x, y), (a + 90) % 180 + 90) for x, y, a in c_right_
+ if bbox.containsy(y)]
+ c_top = [((x, y), (90 - a) % 180 + 180) for y, x, a in c_top_
+ if bbox.containsx(x)]
+
+ return list(zip(lx4, ly4)), [c_left, c_bottom, c_right, c_top]
diff --git a/venv/Lib/site-packages/mpl_toolkits/axisartist/floating_axes.py b/venv/Lib/site-packages/mpl_toolkits/axisartist/floating_axes.py
new file mode 100644
index 0000000..e195893
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axisartist/floating_axes.py
@@ -0,0 +1,372 @@
+"""
+An experimental support for curvilinear grid.
+"""
+
+# TODO :
+# see if tick_iterator method can be simplified by reusing the parent method.
+
+import functools
+
+import numpy as np
+
+import matplotlib.patches as mpatches
+from matplotlib.path import Path
+import matplotlib.axes as maxes
+
+from mpl_toolkits.axes_grid1.parasite_axes import host_axes_class_factory
+
+from . import axislines, grid_helper_curvelinear
+from .axis_artist import AxisArtist
+from .grid_finder import ExtremeFinderSimple
+
+
+class FloatingAxisArtistHelper(
+ grid_helper_curvelinear.FloatingAxisArtistHelper):
+ pass
+
+
+class FixedAxisArtistHelper(grid_helper_curvelinear.FloatingAxisArtistHelper):
+
+ def __init__(self, grid_helper, side, nth_coord_ticks=None):
+ """
+ nth_coord = along which coordinate value varies.
+ nth_coord = 0 -> x axis, nth_coord = 1 -> y axis
+ """
+ value, nth_coord = grid_helper.get_data_boundary(side)
+ super().__init__(grid_helper, nth_coord, value, axis_direction=side)
+ if nth_coord_ticks is None:
+ nth_coord_ticks = nth_coord
+ self.nth_coord_ticks = nth_coord_ticks
+
+ self.value = value
+ self.grid_helper = grid_helper
+ self._side = side
+
+ def update_lim(self, axes):
+ self.grid_helper.update_lim(axes)
+ self.grid_info = self.grid_helper.grid_info
+
+ def get_tick_iterators(self, axes):
+ """tick_loc, tick_angle, tick_label, (optionally) tick_label"""
+
+ grid_finder = self.grid_helper.grid_finder
+
+ lat_levs, lat_n, lat_factor = self.grid_info["lat_info"]
+ lon_levs, lon_n, lon_factor = self.grid_info["lon_info"]
+
+ lon_levs, lat_levs = np.asarray(lon_levs), np.asarray(lat_levs)
+ if lat_factor is not None:
+ yy0 = lat_levs / lat_factor
+ dy = 0.001 / lat_factor
+ else:
+ yy0 = lat_levs
+ dy = 0.001
+
+ if lon_factor is not None:
+ xx0 = lon_levs / lon_factor
+ dx = 0.001 / lon_factor
+ else:
+ xx0 = lon_levs
+ dx = 0.001
+
+ extremes = self.grid_helper._extremes
+ xmin, xmax = sorted(extremes[:2])
+ ymin, ymax = sorted(extremes[2:])
+
+ def transform_xy(x, y):
+ x1, y1 = grid_finder.transform_xy(x, y)
+ x2, y2 = axes.transData.transform(np.array([x1, y1]).T).T
+ return x2, y2
+
+ if self.nth_coord == 0:
+ mask = (ymin <= yy0) & (yy0 <= ymax)
+ yy0 = yy0[mask]
+ xx0 = np.full_like(yy0, self.value)
+ xx1, yy1 = transform_xy(xx0, yy0)
+
+ xx00 = xx0.astype(float, copy=True)
+ xx00[xx0 + dx > xmax] -= dx
+ xx1a, yy1a = transform_xy(xx00, yy0)
+ xx1b, yy1b = transform_xy(xx00 + dx, yy0)
+
+ yy00 = yy0.astype(float, copy=True)
+ yy00[yy0 + dy > ymax] -= dy
+ xx2a, yy2a = transform_xy(xx0, yy00)
+ xx2b, yy2b = transform_xy(xx0, yy00 + dy)
+
+ labels = self.grid_info["lat_labels"]
+ labels = [l for l, m in zip(labels, mask) if m]
+
+ elif self.nth_coord == 1:
+ mask = (xmin <= xx0) & (xx0 <= xmax)
+ xx0 = xx0[mask]
+ yy0 = np.full_like(xx0, self.value)
+ xx1, yy1 = transform_xy(xx0, yy0)
+
+ yy00 = yy0.astype(float, copy=True)
+ yy00[yy0 + dy > ymax] -= dy
+ xx1a, yy1a = transform_xy(xx0, yy00)
+ xx1b, yy1b = transform_xy(xx0, yy00 + dy)
+
+ xx00 = xx0.astype(float, copy=True)
+ xx00[xx0 + dx > xmax] -= dx
+ xx2a, yy2a = transform_xy(xx00, yy0)
+ xx2b, yy2b = transform_xy(xx00 + dx, yy0)
+
+ labels = self.grid_info["lon_labels"]
+ labels = [l for l, m in zip(labels, mask) if m]
+
+ def f1():
+ dd = np.arctan2(yy1b - yy1a, xx1b - xx1a) # angle normal
+ dd2 = np.arctan2(yy2b - yy2a, xx2b - xx2a) # angle tangent
+ mm = (yy1b - yy1a == 0) & (xx1b - xx1a == 0) # mask not defined dd
+ dd[mm] = dd2[mm] + np.pi / 2
+
+ tick_to_axes = self.get_tick_transform(axes) - axes.transAxes
+ for x, y, d, d2, lab in zip(xx1, yy1, dd, dd2, labels):
+ c2 = tick_to_axes.transform((x, y))
+ delta = 0.00001
+ if 0-delta <= c2[0] <= 1+delta and 0-delta <= c2[1] <= 1+delta:
+ d1, d2 = np.rad2deg([d, d2])
+ yield [x, y], d1, d2, lab
+
+ return f1(), iter([])
+
+ def get_line(self, axes):
+ self.update_lim(axes)
+ k, v = dict(left=("lon_lines0", 0),
+ right=("lon_lines0", 1),
+ bottom=("lat_lines0", 0),
+ top=("lat_lines0", 1))[self._side]
+ xx, yy = self.grid_info[k][v]
+ return Path(np.column_stack([xx, yy]))
+
+
+class ExtremeFinderFixed(ExtremeFinderSimple):
+ # docstring inherited
+
+ def __init__(self, extremes):
+ """
+ This subclass always returns the same bounding box.
+
+ Parameters
+ ----------
+ extremes : (float, float, float, float)
+ The bounding box that this helper always returns.
+ """
+ self._extremes = extremes
+
+ def __call__(self, transform_xy, x1, y1, x2, y2):
+ # docstring inherited
+ return self._extremes
+
+
+class GridHelperCurveLinear(grid_helper_curvelinear.GridHelperCurveLinear):
+
+ def __init__(self, aux_trans, extremes,
+ grid_locator1=None,
+ grid_locator2=None,
+ tick_formatter1=None,
+ tick_formatter2=None):
+ # docstring inherited
+ self._extremes = extremes
+ extreme_finder = ExtremeFinderFixed(extremes)
+ super().__init__(aux_trans,
+ extreme_finder,
+ grid_locator1=grid_locator1,
+ grid_locator2=grid_locator2,
+ tick_formatter1=tick_formatter1,
+ tick_formatter2=tick_formatter2)
+
+ def get_data_boundary(self, side):
+ """
+ Return v=0, nth=1.
+ """
+ lon1, lon2, lat1, lat2 = self._extremes
+ return dict(left=(lon1, 0),
+ right=(lon2, 0),
+ bottom=(lat1, 1),
+ top=(lat2, 1))[side]
+
+ def new_fixed_axis(self, loc,
+ nth_coord=None,
+ axis_direction=None,
+ offset=None,
+ axes=None):
+ if axes is None:
+ axes = self.axes
+ if axis_direction is None:
+ axis_direction = loc
+ # This is not the same as the FixedAxisArtistHelper class used by
+ # grid_helper_curvelinear.GridHelperCurveLinear.new_fixed_axis!
+ _helper = FixedAxisArtistHelper(
+ self, loc, nth_coord_ticks=nth_coord)
+ axisline = AxisArtist(axes, _helper, axis_direction=axis_direction)
+ # Perhaps should be moved to the base class?
+ axisline.line.set_clip_on(True)
+ axisline.line.set_clip_box(axisline.axes.bbox)
+ return axisline
+
+ # new_floating_axis will inherit the grid_helper's extremes.
+
+ # def new_floating_axis(self, nth_coord,
+ # value,
+ # axes=None,
+ # axis_direction="bottom"
+ # ):
+
+ # axis = super(GridHelperCurveLinear,
+ # self).new_floating_axis(nth_coord,
+ # value, axes=axes,
+ # axis_direction=axis_direction)
+
+ # # set extreme values of the axis helper
+ # if nth_coord == 1:
+ # axis.get_helper().set_extremes(*self._extremes[:2])
+ # elif nth_coord == 0:
+ # axis.get_helper().set_extremes(*self._extremes[2:])
+
+ # return axis
+
+ def _update_grid(self, x1, y1, x2, y2):
+ if self.grid_info is None:
+ self.grid_info = dict()
+
+ grid_info = self.grid_info
+
+ grid_finder = self.grid_finder
+ extremes = grid_finder.extreme_finder(grid_finder.inv_transform_xy,
+ x1, y1, x2, y2)
+
+ lon_min, lon_max = sorted(extremes[:2])
+ lat_min, lat_max = sorted(extremes[2:])
+ lon_levs, lon_n, lon_factor = \
+ grid_finder.grid_locator1(lon_min, lon_max)
+ lat_levs, lat_n, lat_factor = \
+ grid_finder.grid_locator2(lat_min, lat_max)
+ grid_info["extremes"] = lon_min, lon_max, lat_min, lat_max # extremes
+
+ grid_info["lon_info"] = lon_levs, lon_n, lon_factor
+ grid_info["lat_info"] = lat_levs, lat_n, lat_factor
+
+ grid_info["lon_labels"] = grid_finder.tick_formatter1("bottom",
+ lon_factor,
+ lon_levs)
+
+ grid_info["lat_labels"] = grid_finder.tick_formatter2("bottom",
+ lat_factor,
+ lat_levs)
+
+ if lon_factor is None:
+ lon_values = np.asarray(lon_levs[:lon_n])
+ else:
+ lon_values = np.asarray(lon_levs[:lon_n]/lon_factor)
+ if lat_factor is None:
+ lat_values = np.asarray(lat_levs[:lat_n])
+ else:
+ lat_values = np.asarray(lat_levs[:lat_n]/lat_factor)
+
+ lon_lines, lat_lines = grid_finder._get_raw_grid_lines(
+ lon_values[(lon_min < lon_values) & (lon_values < lon_max)],
+ lat_values[(lat_min < lat_values) & (lat_values < lat_max)],
+ lon_min, lon_max, lat_min, lat_max)
+
+ grid_info["lon_lines"] = lon_lines
+ grid_info["lat_lines"] = lat_lines
+
+ lon_lines, lat_lines = grid_finder._get_raw_grid_lines(
+ # lon_min, lon_max, lat_min, lat_max)
+ extremes[:2], extremes[2:], *extremes)
+
+ grid_info["lon_lines0"] = lon_lines
+ grid_info["lat_lines0"] = lat_lines
+
+ def get_gridlines(self, which="major", axis="both"):
+ grid_lines = []
+ if axis in ["both", "x"]:
+ grid_lines.extend(self.grid_info["lon_lines"])
+ if axis in ["both", "y"]:
+ grid_lines.extend(self.grid_info["lat_lines"])
+ return grid_lines
+
+ def get_boundary(self):
+ """
+ Return (N, 2) array of (x, y) coordinate of the boundary.
+ """
+ x0, x1, y0, y1 = self._extremes
+ tr = self._aux_trans
+
+ xx = np.linspace(x0, x1, 100)
+ yy0 = np.full_like(xx, y0)
+ yy1 = np.full_like(xx, y1)
+ yy = np.linspace(y0, y1, 100)
+ xx0 = np.full_like(yy, x0)
+ xx1 = np.full_like(yy, x1)
+
+ xxx = np.concatenate([xx[:-1], xx1[:-1], xx[-1:0:-1], xx0])
+ yyy = np.concatenate([yy0[:-1], yy[:-1], yy1[:-1], yy[::-1]])
+ t = tr.transform(np.array([xxx, yyy]).transpose())
+
+ return t
+
+
+class FloatingAxesBase:
+
+ def __init__(self, *args, **kwargs):
+ grid_helper = kwargs.get("grid_helper", None)
+ if grid_helper is None:
+ raise ValueError("FloatingAxes requires grid_helper argument")
+ if not hasattr(grid_helper, "get_boundary"):
+ raise ValueError("grid_helper must implement get_boundary method")
+
+ self._axes_class_floating.__init__(self, *args, **kwargs)
+
+ self.set_aspect(1.)
+ self.adjust_axes_lim()
+
+ def _gen_axes_patch(self):
+ # docstring inherited
+ grid_helper = self.get_grid_helper()
+ t = grid_helper.get_boundary()
+ return mpatches.Polygon(t)
+
+ def cla(self):
+ self._axes_class_floating.cla(self)
+ # HostAxes.cla(self)
+ self.patch.set_transform(self.transData)
+
+ patch = self._axes_class_floating._gen_axes_patch(self)
+ patch.set_figure(self.figure)
+ patch.set_visible(False)
+ patch.set_transform(self.transAxes)
+
+ self.patch.set_clip_path(patch)
+ self.gridlines.set_clip_path(patch)
+
+ self._original_patch = patch
+
+ def adjust_axes_lim(self):
+ grid_helper = self.get_grid_helper()
+ t = grid_helper.get_boundary()
+ x, y = t[:, 0], t[:, 1]
+
+ xmin, xmax = min(x), max(x)
+ ymin, ymax = min(y), max(y)
+
+ dx = (xmax-xmin) / 100
+ dy = (ymax-ymin) / 100
+
+ self.set_xlim(xmin-dx, xmax+dx)
+ self.set_ylim(ymin-dy, ymax+dy)
+
+
+@functools.lru_cache(None)
+def floatingaxes_class_factory(axes_class):
+ return type("Floating %s" % axes_class.__name__,
+ (FloatingAxesBase, axes_class),
+ {'_axes_class_floating': axes_class})
+
+
+FloatingAxes = floatingaxes_class_factory(
+ host_axes_class_factory(axislines.Axes))
+FloatingSubplot = maxes.subplot_class_factory(FloatingAxes)
diff --git a/venv/Lib/site-packages/mpl_toolkits/axisartist/grid_finder.py b/venv/Lib/site-packages/mpl_toolkits/axisartist/grid_finder.py
new file mode 100644
index 0000000..76d7b70
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axisartist/grid_finder.py
@@ -0,0 +1,281 @@
+import numpy as np
+
+from matplotlib import _api, ticker as mticker
+from matplotlib.transforms import Bbox, Transform
+from .clip_path import clip_line_to_rect
+
+
+class ExtremeFinderSimple:
+ """
+ A helper class to figure out the range of grid lines that need to be drawn.
+ """
+
+ def __init__(self, nx, ny):
+ """
+ Parameters
+ ----------
+ nx, ny : int
+ The number of samples in each direction.
+ """
+ self.nx = nx
+ self.ny = ny
+
+ def __call__(self, transform_xy, x1, y1, x2, y2):
+ """
+ Compute an approximation of the bounding box obtained by applying
+ *transform_xy* to the box delimited by ``(x1, y1, x2, y2)``.
+
+ The intended use is to have ``(x1, y1, x2, y2)`` in axes coordinates,
+ and have *transform_xy* be the transform from axes coordinates to data
+ coordinates; this method then returns the range of data coordinates
+ that span the actual axes.
+
+ The computation is done by sampling ``nx * ny`` equispaced points in
+ the ``(x1, y1, x2, y2)`` box and finding the resulting points with
+ extremal coordinates; then adding some padding to take into account the
+ finite sampling.
+
+ As each sampling step covers a relative range of *1/nx* or *1/ny*,
+ the padding is computed by expanding the span covered by the extremal
+ coordinates by these fractions.
+ """
+ x, y = np.meshgrid(
+ np.linspace(x1, x2, self.nx), np.linspace(y1, y2, self.ny))
+ xt, yt = transform_xy(np.ravel(x), np.ravel(y))
+ return self._add_pad(xt.min(), xt.max(), yt.min(), yt.max())
+
+ def _add_pad(self, x_min, x_max, y_min, y_max):
+ """Perform the padding mentioned in `__call__`."""
+ dx = (x_max - x_min) / self.nx
+ dy = (y_max - y_min) / self.ny
+ return x_min - dx, x_max + dx, y_min - dy, y_max + dy
+
+
+class GridFinder:
+ def __init__(self,
+ transform,
+ extreme_finder=None,
+ grid_locator1=None,
+ grid_locator2=None,
+ tick_formatter1=None,
+ tick_formatter2=None):
+ """
+ transform : transform from the image coordinate (which will be
+ the transData of the axes to the world coordinate.
+
+ or transform = (transform_xy, inv_transform_xy)
+
+ locator1, locator2 : grid locator for 1st and 2nd axis.
+ """
+ if extreme_finder is None:
+ extreme_finder = ExtremeFinderSimple(20, 20)
+ if grid_locator1 is None:
+ grid_locator1 = MaxNLocator()
+ if grid_locator2 is None:
+ grid_locator2 = MaxNLocator()
+ if tick_formatter1 is None:
+ tick_formatter1 = FormatterPrettyPrint()
+ if tick_formatter2 is None:
+ tick_formatter2 = FormatterPrettyPrint()
+ self.extreme_finder = extreme_finder
+ self.grid_locator1 = grid_locator1
+ self.grid_locator2 = grid_locator2
+ self.tick_formatter1 = tick_formatter1
+ self.tick_formatter2 = tick_formatter2
+ self.update_transform(transform)
+
+ def get_grid_info(self, x1, y1, x2, y2):
+ """
+ lon_values, lat_values : list of grid values. if integer is given,
+ rough number of grids in each direction.
+ """
+
+ extremes = self.extreme_finder(self.inv_transform_xy, x1, y1, x2, y2)
+
+ # min & max rage of lat (or lon) for each grid line will be drawn.
+ # i.e., gridline of lon=0 will be drawn from lat_min to lat_max.
+
+ lon_min, lon_max, lat_min, lat_max = extremes
+ lon_levs, lon_n, lon_factor = self.grid_locator1(lon_min, lon_max)
+ lat_levs, lat_n, lat_factor = self.grid_locator2(lat_min, lat_max)
+
+ lon_values = lon_levs[:lon_n] / lon_factor
+ lat_values = lat_levs[:lat_n] / lat_factor
+
+ lon_lines, lat_lines = self._get_raw_grid_lines(lon_values,
+ lat_values,
+ lon_min, lon_max,
+ lat_min, lat_max)
+
+ ddx = (x2-x1)*1.e-10
+ ddy = (y2-y1)*1.e-10
+ bb = Bbox.from_extents(x1-ddx, y1-ddy, x2+ddx, y2+ddy)
+
+ grid_info = {
+ "extremes": extremes,
+ "lon_lines": lon_lines,
+ "lat_lines": lat_lines,
+ "lon": self._clip_grid_lines_and_find_ticks(
+ lon_lines, lon_values, lon_levs, bb),
+ "lat": self._clip_grid_lines_and_find_ticks(
+ lat_lines, lat_values, lat_levs, bb),
+ }
+
+ tck_labels = grid_info["lon"]["tick_labels"] = {}
+ for direction in ["left", "bottom", "right", "top"]:
+ levs = grid_info["lon"]["tick_levels"][direction]
+ tck_labels[direction] = self.tick_formatter1(
+ direction, lon_factor, levs)
+
+ tck_labels = grid_info["lat"]["tick_labels"] = {}
+ for direction in ["left", "bottom", "right", "top"]:
+ levs = grid_info["lat"]["tick_levels"][direction]
+ tck_labels[direction] = self.tick_formatter2(
+ direction, lat_factor, levs)
+
+ return grid_info
+
+ def _get_raw_grid_lines(self,
+ lon_values, lat_values,
+ lon_min, lon_max, lat_min, lat_max):
+
+ lons_i = np.linspace(lon_min, lon_max, 100) # for interpolation
+ lats_i = np.linspace(lat_min, lat_max, 100)
+
+ lon_lines = [self.transform_xy(np.full_like(lats_i, lon), lats_i)
+ for lon in lon_values]
+ lat_lines = [self.transform_xy(lons_i, np.full_like(lons_i, lat))
+ for lat in lat_values]
+
+ return lon_lines, lat_lines
+
+ def _clip_grid_lines_and_find_ticks(self, lines, values, levs, bb):
+ gi = {
+ "values": [],
+ "levels": [],
+ "tick_levels": dict(left=[], bottom=[], right=[], top=[]),
+ "tick_locs": dict(left=[], bottom=[], right=[], top=[]),
+ "lines": [],
+ }
+
+ tck_levels = gi["tick_levels"]
+ tck_locs = gi["tick_locs"]
+ for (lx, ly), v, lev in zip(lines, values, levs):
+ xy, tcks = clip_line_to_rect(lx, ly, bb)
+ if not xy:
+ continue
+ gi["levels"].append(v)
+ gi["lines"].append(xy)
+
+ for tck, direction in zip(tcks,
+ ["left", "bottom", "right", "top"]):
+ for t in tck:
+ tck_levels[direction].append(lev)
+ tck_locs[direction].append(t)
+
+ return gi
+
+ def update_transform(self, aux_trans):
+ if not isinstance(aux_trans, Transform) and len(aux_trans) != 2:
+ raise TypeError("'aux_trans' must be either a Transform instance "
+ "or a pair of callables")
+ self._aux_transform = aux_trans
+
+ def transform_xy(self, x, y):
+ aux_trf = self._aux_transform
+ if isinstance(aux_trf, Transform):
+ return aux_trf.transform(np.column_stack([x, y])).T
+ else:
+ transform_xy, inv_transform_xy = aux_trf
+ return transform_xy(x, y)
+
+ def inv_transform_xy(self, x, y):
+ aux_trf = self._aux_transform
+ if isinstance(aux_trf, Transform):
+ return aux_trf.inverted().transform(np.column_stack([x, y])).T
+ else:
+ transform_xy, inv_transform_xy = aux_trf
+ return inv_transform_xy(x, y)
+
+ def update(self, **kw):
+ for k in kw:
+ if k in ["extreme_finder",
+ "grid_locator1",
+ "grid_locator2",
+ "tick_formatter1",
+ "tick_formatter2"]:
+ setattr(self, k, kw[k])
+ else:
+ raise ValueError("Unknown update property '%s'" % k)
+
+
+class MaxNLocator(mticker.MaxNLocator):
+ def __init__(self, nbins=10, steps=None,
+ trim=True,
+ integer=False,
+ symmetric=False,
+ prune=None):
+ # trim argument has no effect. It has been left for API compatibility
+ super().__init__(nbins, steps=steps, integer=integer,
+ symmetric=symmetric, prune=prune)
+ self.create_dummy_axis()
+ self._factor = 1
+
+ def __call__(self, v1, v2):
+ self.set_bounds(v1 * self._factor, v2 * self._factor)
+ locs = super().__call__()
+ return np.array(locs), len(locs), self._factor
+
+ @_api.deprecated("3.3")
+ def set_factor(self, f):
+ self._factor = f
+
+
+class FixedLocator:
+ def __init__(self, locs):
+ self._locs = locs
+ self._factor = 1
+
+ def __call__(self, v1, v2):
+ v1, v2 = sorted([v1 * self._factor, v2 * self._factor])
+ locs = np.array([l for l in self._locs if v1 <= l <= v2])
+ return locs, len(locs), self._factor
+
+ @_api.deprecated("3.3")
+ def set_factor(self, f):
+ self._factor = f
+
+
+# Tick Formatter
+
+class FormatterPrettyPrint:
+ def __init__(self, useMathText=True):
+ self._fmt = mticker.ScalarFormatter(
+ useMathText=useMathText, useOffset=False)
+ self._fmt.create_dummy_axis()
+
+ def __call__(self, direction, factor, values):
+ return self._fmt.format_ticks(values)
+
+
+class DictFormatter:
+ def __init__(self, format_dict, formatter=None):
+ """
+ format_dict : dictionary for format strings to be used.
+ formatter : fall-back formatter
+ """
+ super().__init__()
+ self._format_dict = format_dict
+ self._fallback_formatter = formatter
+
+ def __call__(self, direction, factor, values):
+ """
+ factor is ignored if value is found in the dictionary
+ """
+ if self._fallback_formatter:
+ fallback_strings = self._fallback_formatter(
+ direction, factor, values)
+ else:
+ fallback_strings = [""] * len(values)
+ return [self._format_dict.get(k, v)
+ for k, v in zip(values, fallback_strings)]
diff --git a/venv/Lib/site-packages/mpl_toolkits/axisartist/grid_helper_curvelinear.py b/venv/Lib/site-packages/mpl_toolkits/axisartist/grid_helper_curvelinear.py
new file mode 100644
index 0000000..bb67dd0
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axisartist/grid_helper_curvelinear.py
@@ -0,0 +1,381 @@
+"""
+An experimental support for curvilinear grid.
+"""
+from itertools import chain
+
+import numpy as np
+
+from matplotlib.path import Path
+from matplotlib.transforms import Affine2D, IdentityTransform
+from .axislines import AxisArtistHelper, GridHelperBase
+from .axis_artist import AxisArtist
+from .grid_finder import GridFinder
+
+
+class FixedAxisArtistHelper(AxisArtistHelper.Fixed):
+ """
+ Helper class for a fixed axis.
+ """
+
+ def __init__(self, grid_helper, side, nth_coord_ticks=None):
+ """
+ nth_coord = along which coordinate value varies.
+ nth_coord = 0 -> x axis, nth_coord = 1 -> y axis
+ """
+
+ super().__init__(loc=side)
+
+ self.grid_helper = grid_helper
+ if nth_coord_ticks is None:
+ nth_coord_ticks = self.nth_coord
+ self.nth_coord_ticks = nth_coord_ticks
+
+ self.side = side
+ self._limits_inverted = False
+
+ def update_lim(self, axes):
+ self.grid_helper.update_lim(axes)
+
+ if self.nth_coord == 0:
+ xy1, xy2 = axes.get_ylim()
+ else:
+ xy1, xy2 = axes.get_xlim()
+
+ if xy1 > xy2:
+ self._limits_inverted = True
+ else:
+ self._limits_inverted = False
+
+ def change_tick_coord(self, coord_number=None):
+ if coord_number is None:
+ self.nth_coord_ticks = 1 - self.nth_coord_ticks
+ elif coord_number in [0, 1]:
+ self.nth_coord_ticks = coord_number
+ else:
+ raise Exception("wrong coord number")
+
+ def get_tick_transform(self, axes):
+ return axes.transData
+
+ def get_tick_iterators(self, axes):
+ """tick_loc, tick_angle, tick_label"""
+
+ g = self.grid_helper
+
+ if self._limits_inverted:
+ side = {"left": "right", "right": "left",
+ "top": "bottom", "bottom": "top"}[self.side]
+ else:
+ side = self.side
+
+ ti1 = g.get_tick_iterator(self.nth_coord_ticks, side)
+ ti2 = g.get_tick_iterator(1-self.nth_coord_ticks, side, minor=True)
+
+ return chain(ti1, ti2), iter([])
+
+
+class FloatingAxisArtistHelper(AxisArtistHelper.Floating):
+
+ def __init__(self, grid_helper, nth_coord, value, axis_direction=None):
+ """
+ nth_coord = along which coordinate value varies.
+ nth_coord = 0 -> x axis, nth_coord = 1 -> y axis
+ """
+
+ super().__init__(nth_coord, value)
+ self.value = value
+ self.grid_helper = grid_helper
+ self._extremes = -np.inf, np.inf
+
+ self._get_line_path = None # a method that returns a Path.
+ self._line_num_points = 100 # number of points to create a line
+
+ def set_extremes(self, e1, e2):
+ if e1 is None:
+ e1 = -np.inf
+ if e2 is None:
+ e2 = np.inf
+ self._extremes = e1, e2
+
+ def update_lim(self, axes):
+ self.grid_helper.update_lim(axes)
+
+ x1, x2 = axes.get_xlim()
+ y1, y2 = axes.get_ylim()
+ grid_finder = self.grid_helper.grid_finder
+ extremes = grid_finder.extreme_finder(grid_finder.inv_transform_xy,
+ x1, y1, x2, y2)
+
+ lon_min, lon_max, lat_min, lat_max = extremes
+ e_min, e_max = self._extremes # ranges of other coordinates
+ if self.nth_coord == 0:
+ lat_min = max(e_min, lat_min)
+ lat_max = min(e_max, lat_max)
+ elif self.nth_coord == 1:
+ lon_min = max(e_min, lon_min)
+ lon_max = min(e_max, lon_max)
+
+ lon_levs, lon_n, lon_factor = \
+ grid_finder.grid_locator1(lon_min, lon_max)
+ lat_levs, lat_n, lat_factor = \
+ grid_finder.grid_locator2(lat_min, lat_max)
+
+ if self.nth_coord == 0:
+ xx0 = np.full(self._line_num_points, self.value)
+ yy0 = np.linspace(lat_min, lat_max, self._line_num_points)
+ xx, yy = grid_finder.transform_xy(xx0, yy0)
+ elif self.nth_coord == 1:
+ xx0 = np.linspace(lon_min, lon_max, self._line_num_points)
+ yy0 = np.full(self._line_num_points, self.value)
+ xx, yy = grid_finder.transform_xy(xx0, yy0)
+
+ self.grid_info = {
+ "extremes": (lon_min, lon_max, lat_min, lat_max),
+ "lon_info": (lon_levs, lon_n, lon_factor),
+ "lat_info": (lat_levs, lat_n, lat_factor),
+ "lon_labels": grid_finder.tick_formatter1(
+ "bottom", lon_factor, lon_levs),
+ "lat_labels": grid_finder.tick_formatter2(
+ "bottom", lat_factor, lat_levs),
+ "line_xy": (xx, yy),
+ }
+
+ def get_axislabel_transform(self, axes):
+ return Affine2D() # axes.transData
+
+ def get_axislabel_pos_angle(self, axes):
+
+ extremes = self.grid_info["extremes"]
+
+ if self.nth_coord == 0:
+ xx0 = self.value
+ yy0 = (extremes[2] + extremes[3]) / 2
+ dxx = 0
+ dyy = abs(extremes[2] - extremes[3]) / 1000
+ elif self.nth_coord == 1:
+ xx0 = (extremes[0] + extremes[1]) / 2
+ yy0 = self.value
+ dxx = abs(extremes[0] - extremes[1]) / 1000
+ dyy = 0
+
+ grid_finder = self.grid_helper.grid_finder
+ (xx1,), (yy1,) = grid_finder.transform_xy([xx0], [yy0])
+
+ data_to_axes = axes.transData - axes.transAxes
+ p = data_to_axes.transform([xx1, yy1])
+
+ if 0 <= p[0] <= 1 and 0 <= p[1] <= 1:
+ xx1c, yy1c = axes.transData.transform([xx1, yy1])
+ (xx2,), (yy2,) = grid_finder.transform_xy([xx0 + dxx], [yy0 + dyy])
+ xx2c, yy2c = axes.transData.transform([xx2, yy2])
+ return (xx1c, yy1c), np.rad2deg(np.arctan2(yy2c-yy1c, xx2c-xx1c))
+ else:
+ return None, None
+
+ def get_tick_transform(self, axes):
+ return IdentityTransform() # axes.transData
+
+ def get_tick_iterators(self, axes):
+ """tick_loc, tick_angle, tick_label, (optionally) tick_label"""
+
+ grid_finder = self.grid_helper.grid_finder
+
+ lat_levs, lat_n, lat_factor = self.grid_info["lat_info"]
+ lat_levs = np.asarray(lat_levs)
+ yy0 = lat_levs / lat_factor
+ dy = 0.01 / lat_factor
+
+ lon_levs, lon_n, lon_factor = self.grid_info["lon_info"]
+ lon_levs = np.asarray(lon_levs)
+ xx0 = lon_levs / lon_factor
+ dx = 0.01 / lon_factor
+
+ e0, e1 = self._extremes
+
+ if self.nth_coord == 0:
+ mask = (e0 <= yy0) & (yy0 <= e1)
+ #xx0, yy0 = xx0[mask], yy0[mask]
+ yy0 = yy0[mask]
+ elif self.nth_coord == 1:
+ mask = (e0 <= xx0) & (xx0 <= e1)
+ #xx0, yy0 = xx0[mask], yy0[mask]
+ xx0 = xx0[mask]
+
+ def transform_xy(x, y):
+ x1, y1 = grid_finder.transform_xy(x, y)
+ x2y2 = axes.transData.transform(np.array([x1, y1]).transpose())
+ x2, y2 = x2y2.transpose()
+ return x2, y2
+
+ # find angles
+ if self.nth_coord == 0:
+ xx0 = np.full_like(yy0, self.value)
+
+ xx1, yy1 = transform_xy(xx0, yy0)
+
+ xx00 = xx0.copy()
+ xx00[xx0 + dx > e1] -= dx
+ xx1a, yy1a = transform_xy(xx00, yy0)
+ xx1b, yy1b = transform_xy(xx00+dx, yy0)
+
+ xx2a, yy2a = transform_xy(xx0, yy0)
+ xx2b, yy2b = transform_xy(xx0, yy0+dy)
+
+ labels = self.grid_info["lat_labels"]
+ labels = [l for l, m in zip(labels, mask) if m]
+
+ elif self.nth_coord == 1:
+ yy0 = np.full_like(xx0, self.value)
+
+ xx1, yy1 = transform_xy(xx0, yy0)
+
+ xx1a, yy1a = transform_xy(xx0, yy0)
+ xx1b, yy1b = transform_xy(xx0, yy0+dy)
+
+ xx00 = xx0.copy()
+ xx00[xx0 + dx > e1] -= dx
+ xx2a, yy2a = transform_xy(xx00, yy0)
+ xx2b, yy2b = transform_xy(xx00+dx, yy0)
+
+ labels = self.grid_info["lon_labels"]
+ labels = [l for l, m in zip(labels, mask) if m]
+
+ def f1():
+ dd = np.arctan2(yy1b-yy1a, xx1b-xx1a) # angle normal
+ dd2 = np.arctan2(yy2b-yy2a, xx2b-xx2a) # angle tangent
+ mm = (yy1b == yy1a) & (xx1b == xx1a) # mask where dd not defined
+ dd[mm] = dd2[mm] + np.pi / 2
+
+ tick_to_axes = self.get_tick_transform(axes) - axes.transAxes
+ for x, y, d, d2, lab in zip(xx1, yy1, dd, dd2, labels):
+ c2 = tick_to_axes.transform((x, y))
+ delta = 0.00001
+ if 0-delta <= c2[0] <= 1+delta and 0-delta <= c2[1] <= 1+delta:
+ d1, d2 = np.rad2deg([d, d2])
+ yield [x, y], d1, d2, lab
+
+ return f1(), iter([])
+
+ def get_line_transform(self, axes):
+ return axes.transData
+
+ def get_line(self, axes):
+ self.update_lim(axes)
+ x, y = self.grid_info["line_xy"]
+
+ if self._get_line_path is None:
+ return Path(np.column_stack([x, y]))
+ else:
+ return self._get_line_path(axes, x, y)
+
+
+class GridHelperCurveLinear(GridHelperBase):
+
+ def __init__(self, aux_trans,
+ extreme_finder=None,
+ grid_locator1=None,
+ grid_locator2=None,
+ tick_formatter1=None,
+ tick_formatter2=None):
+ """
+ aux_trans : a transform from the source (curved) coordinate to
+ target (rectilinear) coordinate. An instance of MPL's Transform
+ (inverse transform should be defined) or a tuple of two callable
+ objects which defines the transform and its inverse. The callables
+ need take two arguments of array of source coordinates and
+ should return two target coordinates.
+
+ e.g., ``x2, y2 = trans(x1, y1)``
+ """
+ super().__init__()
+ self.grid_info = None
+ self._aux_trans = aux_trans
+ self.grid_finder = GridFinder(aux_trans,
+ extreme_finder,
+ grid_locator1,
+ grid_locator2,
+ tick_formatter1,
+ tick_formatter2)
+
+ def update_grid_finder(self, aux_trans=None, **kw):
+ if aux_trans is not None:
+ self.grid_finder.update_transform(aux_trans)
+ self.grid_finder.update(**kw)
+ self._old_limits = None # Force revalidation.
+
+ def new_fixed_axis(self, loc,
+ nth_coord=None,
+ axis_direction=None,
+ offset=None,
+ axes=None):
+ if axes is None:
+ axes = self.axes
+ if axis_direction is None:
+ axis_direction = loc
+ _helper = FixedAxisArtistHelper(self, loc, nth_coord_ticks=nth_coord)
+ axisline = AxisArtist(axes, _helper, axis_direction=axis_direction)
+ # Why is clip not set on axisline, unlike in new_floating_axis or in
+ # the floating_axig.GridHelperCurveLinear subclass?
+ return axisline
+
+ def new_floating_axis(self, nth_coord,
+ value,
+ axes=None,
+ axis_direction="bottom"
+ ):
+
+ if axes is None:
+ axes = self.axes
+
+ _helper = FloatingAxisArtistHelper(
+ self, nth_coord, value, axis_direction)
+
+ axisline = AxisArtist(axes, _helper)
+
+ # _helper = FloatingAxisArtistHelper(self, nth_coord,
+ # value,
+ # label_direction=label_direction,
+ # )
+
+ # axisline = AxisArtistFloating(axes, _helper,
+ # axis_direction=axis_direction)
+ axisline.line.set_clip_on(True)
+ axisline.line.set_clip_box(axisline.axes.bbox)
+ # axisline.major_ticklabels.set_visible(True)
+ # axisline.minor_ticklabels.set_visible(False)
+
+ return axisline
+
+ def _update_grid(self, x1, y1, x2, y2):
+ self.grid_info = self.grid_finder.get_grid_info(x1, y1, x2, y2)
+
+ def get_gridlines(self, which="major", axis="both"):
+ grid_lines = []
+ if axis in ["both", "x"]:
+ for gl in self.grid_info["lon"]["lines"]:
+ grid_lines.extend(gl)
+ if axis in ["both", "y"]:
+ for gl in self.grid_info["lat"]["lines"]:
+ grid_lines.extend(gl)
+ return grid_lines
+
+ def get_tick_iterator(self, nth_coord, axis_side, minor=False):
+
+ # axisnr = dict(left=0, bottom=1, right=2, top=3)[axis_side]
+ angle_tangent = dict(left=90, right=90, bottom=0, top=0)[axis_side]
+ # angle = [0, 90, 180, 270][axisnr]
+ lon_or_lat = ["lon", "lat"][nth_coord]
+ if not minor: # major ticks
+ for (xy, a), l in zip(
+ self.grid_info[lon_or_lat]["tick_locs"][axis_side],
+ self.grid_info[lon_or_lat]["tick_labels"][axis_side]):
+ angle_normal = a
+ yield xy, angle_normal, angle_tangent, l
+ else:
+ for (xy, a), l in zip(
+ self.grid_info[lon_or_lat]["tick_locs"][axis_side],
+ self.grid_info[lon_or_lat]["tick_labels"][axis_side]):
+ angle_normal = a
+ yield xy, angle_normal, angle_tangent, ""
+ # for xy, a, l in self.grid_info[lon_or_lat]["ticks"][axis_side]:
+ # yield xy, a, ""
diff --git a/venv/Lib/site-packages/mpl_toolkits/axisartist/parasite_axes.py b/venv/Lib/site-packages/mpl_toolkits/axisartist/parasite_axes.py
new file mode 100644
index 0000000..b4d1955
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/axisartist/parasite_axes.py
@@ -0,0 +1,12 @@
+from matplotlib import _api
+from mpl_toolkits.axes_grid1.parasite_axes import (
+ host_axes_class_factory, parasite_axes_class_factory,
+ parasite_axes_auxtrans_class_factory, subplot_class_factory)
+from .axislines import Axes
+
+
+ParasiteAxes = parasite_axes_class_factory(Axes)
+HostAxes = host_axes_class_factory(Axes)
+SubplotHost = subplot_class_factory(HostAxes)
+with _api.suppress_matplotlib_deprecation_warning():
+ ParasiteAxesAuxTrans = parasite_axes_auxtrans_class_factory(ParasiteAxes)
diff --git a/venv/Lib/site-packages/mpl_toolkits/mplot3d/__init__.py b/venv/Lib/site-packages/mpl_toolkits/mplot3d/__init__.py
new file mode 100644
index 0000000..30e682a
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/mplot3d/__init__.py
@@ -0,0 +1 @@
+from .axes3d import Axes3D
diff --git a/venv/Lib/site-packages/mpl_toolkits/mplot3d/art3d.py b/venv/Lib/site-packages/mpl_toolkits/mplot3d/art3d.py
new file mode 100644
index 0000000..a521263
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/mplot3d/art3d.py
@@ -0,0 +1,942 @@
+# art3d.py, original mplot3d version by John Porter
+# Parts rewritten by Reinier Heeres
+# Minor additions by Ben Axelrod
+
+"""
+Module containing 3D artist code and functions to convert 2D
+artists into 3D versions which can be added to an Axes3D.
+"""
+
+import math
+
+import numpy as np
+
+from matplotlib import (
+ _api, artist, cbook, colors as mcolors, lines, text as mtext,
+ path as mpath)
+from matplotlib.collections import (
+ LineCollection, PolyCollection, PatchCollection, PathCollection)
+from matplotlib.colors import Normalize
+from matplotlib.patches import Patch
+from . import proj3d
+
+
+def _norm_angle(a):
+ """Return the given angle normalized to -180 < *a* <= 180 degrees."""
+ a = (a + 360) % 360
+ if a > 180:
+ a = a - 360
+ return a
+
+
+def _norm_text_angle(a):
+ """Return the given angle normalized to -90 < *a* <= 90 degrees."""
+ a = (a + 180) % 180
+ if a > 90:
+ a = a - 180
+ return a
+
+
+def get_dir_vector(zdir):
+ """
+ Return a direction vector.
+
+ Parameters
+ ----------
+ zdir : {'x', 'y', 'z', None, 3-tuple}
+ The direction. Possible values are:
+
+ - 'x': equivalent to (1, 0, 0)
+ - 'y': equivalent to (0, 1, 0)
+ - 'z': equivalent to (0, 0, 1)
+ - *None*: equivalent to (0, 0, 0)
+ - an iterable (x, y, z) is converted to a NumPy array, if not already
+
+ Returns
+ -------
+ x, y, z : array-like
+ The direction vector.
+ """
+ if zdir == 'x':
+ return np.array((1, 0, 0))
+ elif zdir == 'y':
+ return np.array((0, 1, 0))
+ elif zdir == 'z':
+ return np.array((0, 0, 1))
+ elif zdir is None:
+ return np.array((0, 0, 0))
+ elif np.iterable(zdir) and len(zdir) == 3:
+ return np.array(zdir)
+ else:
+ raise ValueError("'x', 'y', 'z', None or vector of length 3 expected")
+
+
+class Text3D(mtext.Text):
+ """
+ Text object with 3D position and direction.
+
+ Parameters
+ ----------
+ x, y, z
+ The position of the text.
+ text : str
+ The text string to display.
+ zdir : {'x', 'y', 'z', None, 3-tuple}
+ The direction of the text. See `.get_dir_vector` for a description of
+ the values.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ All other parameters are passed on to `~matplotlib.text.Text`.
+ """
+
+ def __init__(self, x=0, y=0, z=0, text='', zdir='z', **kwargs):
+ mtext.Text.__init__(self, x, y, text, **kwargs)
+ self.set_3d_properties(z, zdir)
+
+ def get_position_3d(self):
+ """Return the (x, y, z) position of the text."""
+ return self._x, self._y, self._z
+
+ def set_position_3d(self, xyz, zdir=None):
+ """
+ Set the (*x*, *y*, *z*) position of the text.
+
+ Parameters
+ ----------
+ xyz : (float, float, float)
+ The position in 3D space.
+ zdir : {'x', 'y', 'z', None, 3-tuple}
+ The direction of the text. If unspecified, the zdir will not be
+ changed.
+ """
+ super().set_position(xyz[:2])
+ self.set_z(xyz[2])
+ if zdir is not None:
+ self._dir_vec = get_dir_vector(zdir)
+
+ def set_z(self, z):
+ """
+ Set the *z* position of the text.
+
+ Parameters
+ ----------
+ z : float
+ """
+ self._z = z
+ self.stale = True
+
+ def set_3d_properties(self, z=0, zdir='z'):
+ self._z = z
+ self._dir_vec = get_dir_vector(zdir)
+ self.stale = True
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ position3d = np.array((self._x, self._y, self._z))
+ proj = proj3d.proj_trans_points(
+ [position3d, position3d + self._dir_vec], self.axes.M)
+ dx = proj[0][1] - proj[0][0]
+ dy = proj[1][1] - proj[1][0]
+ angle = math.degrees(math.atan2(dy, dx))
+ with cbook._setattr_cm(self, _x=proj[0][0], _y=proj[1][0],
+ _rotation=_norm_text_angle(angle)):
+ mtext.Text.draw(self, renderer)
+ self.stale = False
+
+ def get_tightbbox(self, renderer):
+ # Overwriting the 2d Text behavior which is not valid for 3d.
+ # For now, just return None to exclude from layout calculation.
+ return None
+
+
+def text_2d_to_3d(obj, z=0, zdir='z'):
+ """Convert a Text to a Text3D object."""
+ obj.__class__ = Text3D
+ obj.set_3d_properties(z, zdir)
+
+
+class Line3D(lines.Line2D):
+ """
+ 3D line object.
+ """
+
+ def __init__(self, xs, ys, zs, *args, **kwargs):
+ """
+ Keyword arguments are passed onto :func:`~matplotlib.lines.Line2D`.
+ """
+ super().__init__([], [], *args, **kwargs)
+ self._verts3d = xs, ys, zs
+
+ def set_3d_properties(self, zs=0, zdir='z'):
+ xs = self.get_xdata()
+ ys = self.get_ydata()
+ zs = np.broadcast_to(zs, xs.shape)
+ self._verts3d = juggle_axes(xs, ys, zs, zdir)
+ self.stale = True
+
+ def set_data_3d(self, *args):
+ """
+ Set the x, y and z data
+
+ Parameters
+ ----------
+ x : array-like
+ The x-data to be plotted.
+ y : array-like
+ The y-data to be plotted.
+ z : array-like
+ The z-data to be plotted.
+
+ Notes
+ -----
+ Accepts x, y, z arguments or a single array-like (x, y, z)
+ """
+ if len(args) == 1:
+ self._verts3d = args[0]
+ else:
+ self._verts3d = args
+ self.stale = True
+
+ def get_data_3d(self):
+ """
+ Get the current data
+
+ Returns
+ -------
+ verts3d : length-3 tuple or array-like
+ The current data as a tuple or array-like.
+ """
+ return self._verts3d
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ xs3d, ys3d, zs3d = self._verts3d
+ xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, self.axes.M)
+ self.set_data(xs, ys)
+ super().draw(renderer)
+ self.stale = False
+
+
+def line_2d_to_3d(line, zs=0, zdir='z'):
+ """Convert a 2D line to 3D."""
+
+ line.__class__ = Line3D
+ line.set_3d_properties(zs, zdir)
+
+
+def _path_to_3d_segment(path, zs=0, zdir='z'):
+ """Convert a path to a 3D segment."""
+
+ zs = np.broadcast_to(zs, len(path))
+ pathsegs = path.iter_segments(simplify=False, curves=False)
+ seg = [(x, y, z) for (((x, y), code), z) in zip(pathsegs, zs)]
+ seg3d = [juggle_axes(x, y, z, zdir) for (x, y, z) in seg]
+ return seg3d
+
+
+def _paths_to_3d_segments(paths, zs=0, zdir='z'):
+ """Convert paths from a collection object to 3D segments."""
+
+ if not np.iterable(zs):
+ zs = np.broadcast_to(zs, len(paths))
+ else:
+ if len(zs) != len(paths):
+ raise ValueError('Number of z-coordinates does not match paths.')
+
+ segs = [_path_to_3d_segment(path, pathz, zdir)
+ for path, pathz in zip(paths, zs)]
+ return segs
+
+
+def _path_to_3d_segment_with_codes(path, zs=0, zdir='z'):
+ """Convert a path to a 3D segment with path codes."""
+
+ zs = np.broadcast_to(zs, len(path))
+ pathsegs = path.iter_segments(simplify=False, curves=False)
+ seg_codes = [((x, y, z), code) for ((x, y), code), z in zip(pathsegs, zs)]
+ if seg_codes:
+ seg, codes = zip(*seg_codes)
+ seg3d = [juggle_axes(x, y, z, zdir) for (x, y, z) in seg]
+ else:
+ seg3d = []
+ codes = []
+ return seg3d, list(codes)
+
+
+def _paths_to_3d_segments_with_codes(paths, zs=0, zdir='z'):
+ """
+ Convert paths from a collection object to 3D segments with path codes.
+ """
+
+ zs = np.broadcast_to(zs, len(paths))
+ segments_codes = [_path_to_3d_segment_with_codes(path, pathz, zdir)
+ for path, pathz in zip(paths, zs)]
+ if segments_codes:
+ segments, codes = zip(*segments_codes)
+ else:
+ segments, codes = [], []
+ return list(segments), list(codes)
+
+
+class Line3DCollection(LineCollection):
+ """
+ A collection of 3D lines.
+ """
+
+ def set_sort_zpos(self, val):
+ """Set the position to use for z-sorting."""
+ self._sort_zpos = val
+ self.stale = True
+
+ def set_segments(self, segments):
+ """
+ Set 3D segments.
+ """
+ self._segments3d = segments
+ super().set_segments([])
+
+ @_api.delete_parameter('3.4', 'renderer')
+ def do_3d_projection(self, renderer=None):
+ """
+ Project the points according to renderer matrix.
+ """
+ xyslist = [proj3d.proj_trans_points(points, self.axes.M)
+ for points in self._segments3d]
+ segments_2d = [np.column_stack([xs, ys]) for xs, ys, zs in xyslist]
+ LineCollection.set_segments(self, segments_2d)
+
+ # FIXME
+ minz = 1e9
+ for xs, ys, zs in xyslist:
+ minz = min(minz, min(zs))
+ return minz
+
+ @artist.allow_rasterization
+ @_api.delete_parameter('3.4', 'project',
+ alternative='Line3DCollection.do_3d_projection')
+ def draw(self, renderer, project=False):
+ if project:
+ self.do_3d_projection()
+ super().draw(renderer)
+
+
+def line_collection_2d_to_3d(col, zs=0, zdir='z'):
+ """Convert a LineCollection to a Line3DCollection object."""
+ segments3d = _paths_to_3d_segments(col.get_paths(), zs, zdir)
+ col.__class__ = Line3DCollection
+ col.set_segments(segments3d)
+
+
+class Patch3D(Patch):
+ """
+ 3D patch object.
+ """
+
+ def __init__(self, *args, zs=(), zdir='z', **kwargs):
+ super().__init__(*args, **kwargs)
+ self.set_3d_properties(zs, zdir)
+
+ def set_3d_properties(self, verts, zs=0, zdir='z'):
+ zs = np.broadcast_to(zs, len(verts))
+ self._segment3d = [juggle_axes(x, y, z, zdir)
+ for ((x, y), z) in zip(verts, zs)]
+
+ def get_path(self):
+ return self._path2d
+
+ @_api.delete_parameter('3.4', 'renderer')
+ def do_3d_projection(self, renderer=None):
+ s = self._segment3d
+ xs, ys, zs = zip(*s)
+ vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs,
+ self.axes.M)
+ self._path2d = mpath.Path(np.column_stack([vxs, vys]))
+ return min(vzs)
+
+
+class PathPatch3D(Patch3D):
+ """
+ 3D PathPatch object.
+ """
+
+ def __init__(self, path, *, zs=(), zdir='z', **kwargs):
+ # Not super().__init__!
+ Patch.__init__(self, **kwargs)
+ self.set_3d_properties(path, zs, zdir)
+
+ def set_3d_properties(self, path, zs=0, zdir='z'):
+ Patch3D.set_3d_properties(self, path.vertices, zs=zs, zdir=zdir)
+ self._code3d = path.codes
+
+ @_api.delete_parameter('3.4', 'renderer')
+ def do_3d_projection(self, renderer=None):
+ s = self._segment3d
+ xs, ys, zs = zip(*s)
+ vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs,
+ self.axes.M)
+ self._path2d = mpath.Path(np.column_stack([vxs, vys]), self._code3d)
+ return min(vzs)
+
+
+def _get_patch_verts(patch):
+ """Return a list of vertices for the path of a patch."""
+ trans = patch.get_patch_transform()
+ path = patch.get_path()
+ polygons = path.to_polygons(trans)
+ return polygons[0] if len(polygons) else np.array([])
+
+
+def patch_2d_to_3d(patch, z=0, zdir='z'):
+ """Convert a Patch to a Patch3D object."""
+ verts = _get_patch_verts(patch)
+ patch.__class__ = Patch3D
+ patch.set_3d_properties(verts, z, zdir)
+
+
+def pathpatch_2d_to_3d(pathpatch, z=0, zdir='z'):
+ """Convert a PathPatch to a PathPatch3D object."""
+ path = pathpatch.get_path()
+ trans = pathpatch.get_patch_transform()
+
+ mpath = trans.transform_path(path)
+ pathpatch.__class__ = PathPatch3D
+ pathpatch.set_3d_properties(mpath, z, zdir)
+
+
+class Patch3DCollection(PatchCollection):
+ """
+ A collection of 3D patches.
+ """
+
+ def __init__(self, *args, zs=0, zdir='z', depthshade=True, **kwargs):
+ """
+ Create a collection of flat 3D patches with its normal vector
+ pointed in *zdir* direction, and located at *zs* on the *zdir*
+ axis. 'zs' can be a scalar or an array-like of the same length as
+ the number of patches in the collection.
+
+ Constructor arguments are the same as for
+ :class:`~matplotlib.collections.PatchCollection`. In addition,
+ keywords *zs=0* and *zdir='z'* are available.
+
+ Also, the keyword argument *depthshade* is available to
+ indicate whether or not to shade the patches in order to
+ give the appearance of depth (default is *True*).
+ This is typically desired in scatter plots.
+ """
+ self._depthshade = depthshade
+ super().__init__(*args, **kwargs)
+ self.set_3d_properties(zs, zdir)
+
+ def get_depthshade(self):
+ return self._depthshade
+
+ def set_depthshade(self, depthshade):
+ """
+ Set whether depth shading is performed on collection members.
+
+ Parameters
+ ----------
+ depthshade : bool
+ Whether to shade the patches in order to give the appearance of
+ depth.
+ """
+ self._depthshade = depthshade
+ self.stale = True
+
+ def set_sort_zpos(self, val):
+ """Set the position to use for z-sorting."""
+ self._sort_zpos = val
+ self.stale = True
+
+ def set_3d_properties(self, zs, zdir):
+ # Force the collection to initialize the face and edgecolors
+ # just in case it is a scalarmappable with a colormap.
+ self.update_scalarmappable()
+ offsets = self.get_offsets()
+ if len(offsets) > 0:
+ xs, ys = offsets.T
+ else:
+ xs = []
+ ys = []
+ self._offsets3d = juggle_axes(xs, ys, np.atleast_1d(zs), zdir)
+ self._vzs = None
+ self.stale = True
+
+ @_api.delete_parameter('3.4', 'renderer')
+ def do_3d_projection(self, renderer=None):
+ xs, ys, zs = self._offsets3d
+ vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs,
+ self.axes.M)
+ self._vzs = vzs
+ super().set_offsets(np.column_stack([vxs, vys]))
+
+ if vzs.size > 0:
+ return min(vzs)
+ else:
+ return np.nan
+
+ def _maybe_depth_shade_and_sort_colors(self, color_array):
+ color_array = (
+ _zalpha(color_array, self._vzs)
+ if self._vzs is not None and self._depthshade
+ else color_array
+ )
+ if len(color_array) > 1:
+ color_array = color_array[self._z_markers_idx]
+ return mcolors.to_rgba_array(color_array, self._alpha)
+
+ def get_facecolor(self):
+ return self._maybe_depth_shade_and_sort_colors(super().get_facecolor())
+
+ def get_edgecolor(self):
+ # We need this check here to make sure we do not double-apply the depth
+ # based alpha shading when the edge color is "face" which means the
+ # edge colour should be identical to the face colour.
+ if cbook._str_equal(self._edgecolors, 'face'):
+ return self.get_facecolor()
+ return self._maybe_depth_shade_and_sort_colors(super().get_edgecolor())
+
+
+class Path3DCollection(PathCollection):
+ """
+ A collection of 3D paths.
+ """
+
+ def __init__(self, *args, zs=0, zdir='z', depthshade=True, **kwargs):
+ """
+ Create a collection of flat 3D paths with its normal vector
+ pointed in *zdir* direction, and located at *zs* on the *zdir*
+ axis. 'zs' can be a scalar or an array-like of the same length as
+ the number of paths in the collection.
+
+ Constructor arguments are the same as for
+ :class:`~matplotlib.collections.PathCollection`. In addition,
+ keywords *zs=0* and *zdir='z'* are available.
+
+ Also, the keyword argument *depthshade* is available to
+ indicate whether or not to shade the patches in order to
+ give the appearance of depth (default is *True*).
+ This is typically desired in scatter plots.
+ """
+ self._depthshade = depthshade
+ self._in_draw = False
+ super().__init__(*args, **kwargs)
+ self.set_3d_properties(zs, zdir)
+
+ def draw(self, renderer):
+ with cbook._setattr_cm(self, _in_draw=True):
+ super().draw(renderer)
+
+ def set_sort_zpos(self, val):
+ """Set the position to use for z-sorting."""
+ self._sort_zpos = val
+ self.stale = True
+
+ def set_3d_properties(self, zs, zdir):
+ # Force the collection to initialize the face and edgecolors
+ # just in case it is a scalarmappable with a colormap.
+ self.update_scalarmappable()
+ offsets = self.get_offsets()
+ if len(offsets) > 0:
+ xs, ys = offsets.T
+ else:
+ xs = []
+ ys = []
+ self._offsets3d = juggle_axes(xs, ys, np.atleast_1d(zs), zdir)
+ # In the base draw methods we access the attributes directly which
+ # means we can not resolve the shuffling in the getter methods like
+ # we do for the edge and face colors.
+ #
+ # This means we need to carry around a cache of the unsorted sizes and
+ # widths (postfixed with 3d) and in `do_3d_projection` set the
+ # depth-sorted version of that data into the private state used by the
+ # base collection class in its draw method.
+ #
+ # Grab the current sizes and linewidths to preserve them.
+ self._sizes3d = self._sizes
+ self._linewidths3d = self._linewidths
+ xs, ys, zs = self._offsets3d
+
+ # Sort the points based on z coordinates
+ # Performance optimization: Create a sorted index array and reorder
+ # points and point properties according to the index array
+ self._z_markers_idx = slice(-1)
+ self._vzs = None
+ self.stale = True
+
+ def set_sizes(self, sizes, dpi=72.0):
+ super().set_sizes(sizes, dpi)
+ if not self._in_draw:
+ self._sizes3d = sizes
+
+ def set_linewidth(self, lw):
+ super().set_linewidth(lw)
+ if not self._in_draw:
+ self._linewidth3d = lw
+
+ def get_depthshade(self):
+ return self._depthshade
+
+ def set_depthshade(self, depthshade):
+ """
+ Set whether depth shading is performed on collection members.
+
+ Parameters
+ ----------
+ depthshade : bool
+ Whether to shade the patches in order to give the appearance of
+ depth.
+ """
+ self._depthshade = depthshade
+ self.stale = True
+
+ @_api.delete_parameter('3.4', 'renderer')
+ def do_3d_projection(self, renderer=None):
+ xs, ys, zs = self._offsets3d
+ vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs,
+ self.axes.M)
+ # Sort the points based on z coordinates
+ # Performance optimization: Create a sorted index array and reorder
+ # points and point properties according to the index array
+ z_markers_idx = self._z_markers_idx = np.argsort(vzs)[::-1]
+ self._vzs = vzs
+
+ # we have to special case the sizes because of code in collections.py
+ # as the draw method does
+ # self.set_sizes(self._sizes, self.figure.dpi)
+ # so we can not rely on doing the sorting on the way out via get_*
+
+ if len(self._sizes3d) > 1:
+ self._sizes = self._sizes3d[z_markers_idx]
+
+ if len(self._linewidths3d) > 1:
+ self._linewidths = self._linewidths3d[z_markers_idx]
+
+ # Re-order items
+ vzs = vzs[z_markers_idx]
+ vxs = vxs[z_markers_idx]
+ vys = vys[z_markers_idx]
+
+ PathCollection.set_offsets(self, np.column_stack((vxs, vys)))
+
+ return np.min(vzs) if vzs.size else np.nan
+
+ def _maybe_depth_shade_and_sort_colors(self, color_array):
+ color_array = (
+ _zalpha(color_array, self._vzs)
+ if self._vzs is not None and self._depthshade
+ else color_array
+ )
+ if len(color_array) > 1:
+ color_array = color_array[self._z_markers_idx]
+ return mcolors.to_rgba_array(color_array, self._alpha)
+
+ def get_facecolor(self):
+ return self._maybe_depth_shade_and_sort_colors(super().get_facecolor())
+
+ def get_edgecolor(self):
+ # We need this check here to make sure we do not double-apply the depth
+ # based alpha shading when the edge color is "face" which means the
+ # edge colour should be identical to the face colour.
+ if cbook._str_equal(self._edgecolors, 'face'):
+ return self.get_facecolor()
+ return self._maybe_depth_shade_and_sort_colors(super().get_edgecolor())
+
+
+def patch_collection_2d_to_3d(col, zs=0, zdir='z', depthshade=True):
+ """
+ Convert a :class:`~matplotlib.collections.PatchCollection` into a
+ :class:`Patch3DCollection` object
+ (or a :class:`~matplotlib.collections.PathCollection` into a
+ :class:`Path3DCollection` object).
+
+ Parameters
+ ----------
+ za
+ The location or locations to place the patches in the collection along
+ the *zdir* axis. Default: 0.
+ zdir
+ The axis in which to place the patches. Default: "z".
+ depthshade
+ Whether to shade the patches to give a sense of depth. Default: *True*.
+
+ """
+ if isinstance(col, PathCollection):
+ col.__class__ = Path3DCollection
+ elif isinstance(col, PatchCollection):
+ col.__class__ = Patch3DCollection
+ col._depthshade = depthshade
+ col._in_draw = False
+ col.set_3d_properties(zs, zdir)
+
+
+class Poly3DCollection(PolyCollection):
+ """
+ A collection of 3D polygons.
+
+ .. note::
+ **Filling of 3D polygons**
+
+ There is no simple definition of the enclosed surface of a 3D polygon
+ unless the polygon is planar.
+
+ In practice, Matplotlib fills the 2D projection of the polygon. This
+ gives a correct filling appearance only for planar polygons. For all
+ other polygons, you'll find orientations in which the edges of the
+ polygon intersect in the projection. This will lead to an incorrect
+ visualization of the 3D area.
+
+ If you need filled areas, it is recommended to create them via
+ `~mpl_toolkits.mplot3d.axes3d.Axes3D.plot_trisurf`, which creates a
+ triangulation and thus generates consistent surfaces.
+ """
+
+ def __init__(self, verts, *args, zsort='average', **kwargs):
+ """
+ Parameters
+ ----------
+ verts : list of (N, 3) array-like
+ Each element describes a polygon as a sequence of ``N_i`` points
+ ``(x, y, z)``.
+ zsort : {'average', 'min', 'max'}, default: 'average'
+ The calculation method for the z-order.
+ See `~.Poly3DCollection.set_zsort` for details.
+ *args, **kwargs
+ All other parameters are forwarded to `.PolyCollection`.
+
+ Notes
+ -----
+ Note that this class does a bit of magic with the _facecolors
+ and _edgecolors properties.
+ """
+ super().__init__(verts, *args, **kwargs)
+ self.set_zsort(zsort)
+ self._codes3d = None
+
+ _zsort_functions = {
+ 'average': np.average,
+ 'min': np.min,
+ 'max': np.max,
+ }
+
+ def set_zsort(self, zsort):
+ """
+ Set the calculation method for the z-order.
+
+ Parameters
+ ----------
+ zsort : {'average', 'min', 'max'}
+ The function applied on the z-coordinates of the vertices in the
+ viewer's coordinate system, to determine the z-order.
+ """
+ self._zsortfunc = self._zsort_functions[zsort]
+ self._sort_zpos = None
+ self.stale = True
+
+ def get_vector(self, segments3d):
+ """Optimize points for projection."""
+ if len(segments3d):
+ xs, ys, zs = np.row_stack(segments3d).T
+ else: # row_stack can't stack zero arrays.
+ xs, ys, zs = [], [], []
+ ones = np.ones(len(xs))
+ self._vec = np.array([xs, ys, zs, ones])
+
+ indices = [0, *np.cumsum([len(segment) for segment in segments3d])]
+ self._segslices = [*map(slice, indices[:-1], indices[1:])]
+
+ def set_verts(self, verts, closed=True):
+ """Set 3D vertices."""
+ self.get_vector(verts)
+ # 2D verts will be updated at draw time
+ super().set_verts([], False)
+ self._closed = closed
+
+ def set_verts_and_codes(self, verts, codes):
+ """Set 3D vertices with path codes."""
+ # set vertices with closed=False to prevent PolyCollection from
+ # setting path codes
+ self.set_verts(verts, closed=False)
+ # and set our own codes instead.
+ self._codes3d = codes
+
+ def set_3d_properties(self):
+ # Force the collection to initialize the face and edgecolors
+ # just in case it is a scalarmappable with a colormap.
+ self.update_scalarmappable()
+ self._sort_zpos = None
+ self.set_zsort('average')
+ self._facecolor3d = PolyCollection.get_facecolor(self)
+ self._edgecolor3d = PolyCollection.get_edgecolor(self)
+ self._alpha3d = PolyCollection.get_alpha(self)
+ self.stale = True
+
+ def set_sort_zpos(self, val):
+ """Set the position to use for z-sorting."""
+ self._sort_zpos = val
+ self.stale = True
+
+ @_api.delete_parameter('3.4', 'renderer')
+ def do_3d_projection(self, renderer=None):
+ """
+ Perform the 3D projection for this object.
+ """
+ if self._A is not None:
+ # force update of color mapping because we re-order them
+ # below. If we do not do this here, the 2D draw will call
+ # this, but we will never port the color mapped values back
+ # to the 3D versions.
+ #
+ # We hold the 3D versions in a fixed order (the order the user
+ # passed in) and sort the 2D version by view depth.
+ copy_state = self._update_dict['array']
+ self.update_scalarmappable()
+ if copy_state:
+ if self._face_is_mapped:
+ self._facecolor3d = self._facecolors
+ if self._edge_is_mapped:
+ self._edgecolor3d = self._edgecolors
+ txs, tys, tzs = proj3d._proj_transform_vec(self._vec, self.axes.M)
+ xyzlist = [(txs[sl], tys[sl], tzs[sl]) for sl in self._segslices]
+
+ # This extra fuss is to re-order face / edge colors
+ cface = self._facecolor3d
+ cedge = self._edgecolor3d
+ if len(cface) != len(xyzlist):
+ cface = cface.repeat(len(xyzlist), axis=0)
+ if len(cedge) != len(xyzlist):
+ if len(cedge) == 0:
+ cedge = cface
+ else:
+ cedge = cedge.repeat(len(xyzlist), axis=0)
+
+ if xyzlist:
+ # sort by depth (furthest drawn first)
+ z_segments_2d = sorted(
+ ((self._zsortfunc(zs), np.column_stack([xs, ys]), fc, ec, idx)
+ for idx, ((xs, ys, zs), fc, ec)
+ in enumerate(zip(xyzlist, cface, cedge))),
+ key=lambda x: x[0], reverse=True)
+
+ _, segments_2d, self._facecolors2d, self._edgecolors2d, idxs = \
+ zip(*z_segments_2d)
+ else:
+ segments_2d = []
+ self._facecolors2d = np.empty((0, 4))
+ self._edgecolors2d = np.empty((0, 4))
+ idxs = []
+
+ if self._codes3d is not None:
+ codes = [self._codes3d[idx] for idx in idxs]
+ PolyCollection.set_verts_and_codes(self, segments_2d, codes)
+ else:
+ PolyCollection.set_verts(self, segments_2d, self._closed)
+
+ if len(self._edgecolor3d) != len(cface):
+ self._edgecolors2d = self._edgecolor3d
+
+ # Return zorder value
+ if self._sort_zpos is not None:
+ zvec = np.array([[0], [0], [self._sort_zpos], [1]])
+ ztrans = proj3d._proj_transform_vec(zvec, self.axes.M)
+ return ztrans[2][0]
+ elif tzs.size > 0:
+ # FIXME: Some results still don't look quite right.
+ # In particular, examine contourf3d_demo2.py
+ # with az = -54 and elev = -45.
+ return np.min(tzs)
+ else:
+ return np.nan
+
+ def set_facecolor(self, colors):
+ # docstring inherited
+ super().set_facecolor(colors)
+ self._facecolor3d = PolyCollection.get_facecolor(self)
+
+ def set_edgecolor(self, colors):
+ # docstring inherited
+ super().set_edgecolor(colors)
+ self._edgecolor3d = PolyCollection.get_edgecolor(self)
+
+ def set_alpha(self, alpha):
+ # docstring inherited
+ artist.Artist.set_alpha(self, alpha)
+ try:
+ self._facecolor3d = mcolors.to_rgba_array(
+ self._facecolor3d, self._alpha)
+ except (AttributeError, TypeError, IndexError):
+ pass
+ try:
+ self._edgecolors = mcolors.to_rgba_array(
+ self._edgecolor3d, self._alpha)
+ except (AttributeError, TypeError, IndexError):
+ pass
+ self.stale = True
+
+ def get_facecolor(self):
+ return self._facecolors2d
+
+ def get_edgecolor(self):
+ return self._edgecolors2d
+
+
+def poly_collection_2d_to_3d(col, zs=0, zdir='z'):
+ """Convert a PolyCollection to a Poly3DCollection object."""
+ segments_3d, codes = _paths_to_3d_segments_with_codes(
+ col.get_paths(), zs, zdir)
+ col.__class__ = Poly3DCollection
+ col.set_verts_and_codes(segments_3d, codes)
+ col.set_3d_properties()
+
+
+def juggle_axes(xs, ys, zs, zdir):
+ """
+ Reorder coordinates so that 2D xs, ys can be plotted in the plane
+ orthogonal to zdir. zdir is normally x, y or z. However, if zdir
+ starts with a '-' it is interpreted as a compensation for rotate_axes.
+ """
+ if zdir == 'x':
+ return zs, xs, ys
+ elif zdir == 'y':
+ return xs, zs, ys
+ elif zdir[0] == '-':
+ return rotate_axes(xs, ys, zs, zdir)
+ else:
+ return xs, ys, zs
+
+
+def rotate_axes(xs, ys, zs, zdir):
+ """
+ Reorder coordinates so that the axes are rotated with zdir along
+ the original z axis. Prepending the axis with a '-' does the
+ inverse transform, so zdir can be x, -x, y, -y, z or -z
+ """
+ if zdir == 'x':
+ return ys, zs, xs
+ elif zdir == '-x':
+ return zs, xs, ys
+
+ elif zdir == 'y':
+ return zs, xs, ys
+ elif zdir == '-y':
+ return ys, zs, xs
+
+ else:
+ return xs, ys, zs
+
+
+def _zalpha(colors, zs):
+ """Modify the alphas of the color list according to depth."""
+ # FIXME: This only works well if the points for *zs* are well-spaced
+ # in all three dimensions. Otherwise, at certain orientations,
+ # the min and max zs are very close together.
+ # Should really normalize against the viewing depth.
+ if len(colors) == 0 or len(zs) == 0:
+ return np.zeros((0, 4))
+ norm = Normalize(min(zs), max(zs))
+ sats = 1 - norm(zs) * 0.7
+ rgba = np.broadcast_to(mcolors.to_rgba_array(colors), (len(zs), 4))
+ return np.column_stack([rgba[:, :3], rgba[:, 3] * sats])
diff --git a/venv/Lib/site-packages/mpl_toolkits/mplot3d/axes3d.py b/venv/Lib/site-packages/mpl_toolkits/mplot3d/axes3d.py
new file mode 100644
index 0000000..3e4bb90
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/mplot3d/axes3d.py
@@ -0,0 +1,3524 @@
+"""
+axes3d.py, original mplot3d version by John Porter
+Created: 23 Sep 2005
+
+Parts fixed by Reinier Heeres
+Minor additions by Ben Axelrod
+Significant updates and revisions by Ben Root
+
+Module containing Axes3D, an object which can plot 3D objects on a
+2D matplotlib figure.
+"""
+
+from collections import defaultdict
+import functools
+import itertools
+import math
+from numbers import Integral
+import textwrap
+
+import numpy as np
+
+from matplotlib import _api, artist, cbook, docstring
+import matplotlib.axes as maxes
+import matplotlib.collections as mcoll
+import matplotlib.colors as mcolors
+import matplotlib.lines as mlines
+import matplotlib.scale as mscale
+import matplotlib.container as mcontainer
+import matplotlib.transforms as mtransforms
+from matplotlib.axes import Axes, rcParams
+from matplotlib.axes._base import _axis_method_wrapper, _process_plot_format
+from matplotlib.transforms import Bbox
+from matplotlib.tri.triangulation import Triangulation
+
+from . import art3d
+from . import proj3d
+from . import axis3d
+
+
+@cbook._define_aliases({
+ "xlim3d": ["xlim"], "ylim3d": ["ylim"], "zlim3d": ["zlim"]})
+class Axes3D(Axes):
+ """
+ 3D axes object.
+ """
+ name = '3d'
+ _shared_z_axes = cbook.Grouper()
+
+ def __init__(
+ self, fig, rect=None, *args,
+ azim=-60, elev=30, sharez=None, proj_type='persp',
+ box_aspect=None,
+ **kwargs):
+ """
+ Parameters
+ ----------
+ fig : Figure
+ The parent figure.
+ rect : (float, float, float, float)
+ The ``(left, bottom, width, height)`` axes position.
+ azim : float, default: -60
+ Azimuthal viewing angle.
+ elev : float, default: 30
+ Elevation viewing angle.
+ sharez : Axes3D, optional
+ Other axes to share z-limits with.
+ proj_type : {'persp', 'ortho'}
+ The projection type, default 'persp'.
+ auto_add_to_figure : bool, default: True
+ Prior to Matplotlib 3.4 Axes3D would add themselves
+ to their host Figure on init. Other Axes class do not
+ do this.
+
+ This behavior is deprecated in 3.4, the default will
+ change to False in 3.5. The keyword will be undocumented
+ and a non-False value will be an error in 3.6.
+
+ **kwargs
+ Other optional keyword arguments:
+
+ %(Axes3D_kwdoc)s
+
+ Notes
+ -----
+ .. versionadded:: 1.2.1
+ The *sharez* parameter.
+ """
+
+ if rect is None:
+ rect = [0.0, 0.0, 1.0, 1.0]
+
+ self.initial_azim = azim
+ self.initial_elev = elev
+ self.set_proj_type(proj_type)
+
+ self.xy_viewLim = Bbox.unit()
+ self.zz_viewLim = Bbox.unit()
+ self.xy_dataLim = Bbox.unit()
+ self.zz_dataLim = Bbox.unit()
+ self._stale_viewlim_z = False
+
+ # inhibit autoscale_view until the axes are defined
+ # they can't be defined until Axes.__init__ has been called
+ self.view_init(self.initial_elev, self.initial_azim)
+
+ self._sharez = sharez
+ if sharez is not None:
+ self._shared_z_axes.join(self, sharez)
+ self._adjustable = 'datalim'
+
+ auto_add_to_figure = kwargs.pop('auto_add_to_figure', True)
+
+ super().__init__(
+ fig, rect, frameon=True, box_aspect=box_aspect, *args, **kwargs
+ )
+ # Disable drawing of axes by base class
+ super().set_axis_off()
+ # Enable drawing of axes by Axes3D class
+ self.set_axis_on()
+ self.M = None
+
+ # func used to format z -- fall back on major formatters
+ self.fmt_zdata = None
+
+ self.mouse_init()
+ self.figure.canvas.callbacks._pickled_cids.update({
+ self.figure.canvas.mpl_connect(
+ 'motion_notify_event', self._on_move),
+ self.figure.canvas.mpl_connect(
+ 'button_press_event', self._button_press),
+ self.figure.canvas.mpl_connect(
+ 'button_release_event', self._button_release),
+ })
+ self.set_top_view()
+
+ self.patch.set_linewidth(0)
+ # Calculate the pseudo-data width and height
+ pseudo_bbox = self.transLimits.inverted().transform([(0, 0), (1, 1)])
+ self._pseudo_w, self._pseudo_h = pseudo_bbox[1] - pseudo_bbox[0]
+
+ # mplot3d currently manages its own spines and needs these turned off
+ # for bounding box calculations
+ self.spines[:].set_visible(False)
+
+ if auto_add_to_figure:
+ _api.warn_deprecated(
+ "3.4", removal="3.6", message="Axes3D(fig) adding itself "
+ "to the figure is deprecated since %(since)s. "
+ "Pass the keyword argument auto_add_to_figure=False "
+ "and use fig.add_axes(ax) to suppress this warning. "
+ "The default value of auto_add_to_figure will change to "
+ "False in mpl3.5 and True values will "
+ "no longer work %(removal)s. This is consistent with "
+ "other Axes classes.")
+ fig.add_axes(self)
+
+ def set_axis_off(self):
+ self._axis3don = False
+ self.stale = True
+
+ def set_axis_on(self):
+ self._axis3don = True
+ self.stale = True
+
+ def convert_zunits(self, z):
+ """
+ For artists in an axes, if the zaxis has units support,
+ convert *z* using zaxis unit type
+
+ .. versionadded:: 1.2.1
+
+ """
+ return self.zaxis.convert_units(z)
+
+ def set_top_view(self):
+ # this happens to be the right view for the viewing coordinates
+ # moved up and to the left slightly to fit labels and axes
+ xdwl = 0.95 / self.dist
+ xdw = 0.9 / self.dist
+ ydwl = 0.95 / self.dist
+ ydw = 0.9 / self.dist
+ # This is purposely using the 2D Axes's set_xlim and set_ylim,
+ # because we are trying to place our viewing pane.
+ super().set_xlim(-xdwl, xdw, auto=None)
+ super().set_ylim(-ydwl, ydw, auto=None)
+
+ def _init_axis(self):
+ """Init 3D axes; overrides creation of regular X/Y axes."""
+ self.xaxis = axis3d.XAxis('x', self.xy_viewLim.intervalx,
+ self.xy_dataLim.intervalx, self)
+ self.yaxis = axis3d.YAxis('y', self.xy_viewLim.intervaly,
+ self.xy_dataLim.intervaly, self)
+ self.zaxis = axis3d.ZAxis('z', self.zz_viewLim.intervalx,
+ self.zz_dataLim.intervalx, self)
+ for ax in self.xaxis, self.yaxis, self.zaxis:
+ ax.init3d()
+
+ def get_zaxis(self):
+ """Return the ``ZAxis`` (`~.axis3d.Axis`) instance."""
+ return self.zaxis
+
+ get_zgridlines = _axis_method_wrapper("zaxis", "get_gridlines")
+ get_zticklines = _axis_method_wrapper("zaxis", "get_ticklines")
+
+ w_xaxis = _api.deprecated("3.1", alternative="xaxis", pending=True)(
+ property(lambda self: self.xaxis))
+ w_yaxis = _api.deprecated("3.1", alternative="yaxis", pending=True)(
+ property(lambda self: self.yaxis))
+ w_zaxis = _api.deprecated("3.1", alternative="zaxis", pending=True)(
+ property(lambda self: self.zaxis))
+
+ def _get_axis_list(self):
+ return super()._get_axis_list() + (self.zaxis, )
+
+ def _unstale_viewLim(self):
+ # We should arrange to store this information once per share-group
+ # instead of on every axis.
+ scalex = any(ax._stale_viewlim_x
+ for ax in self._shared_x_axes.get_siblings(self))
+ scaley = any(ax._stale_viewlim_y
+ for ax in self._shared_y_axes.get_siblings(self))
+ scalez = any(ax._stale_viewlim_z
+ for ax in self._shared_z_axes.get_siblings(self))
+ if scalex or scaley or scalez:
+ for ax in self._shared_x_axes.get_siblings(self):
+ ax._stale_viewlim_x = False
+ for ax in self._shared_y_axes.get_siblings(self):
+ ax._stale_viewlim_y = False
+ for ax in self._shared_z_axes.get_siblings(self):
+ ax._stale_viewlim_z = False
+ self.autoscale_view(scalex=scalex, scaley=scaley, scalez=scalez)
+
+ def unit_cube(self, vals=None):
+ minx, maxx, miny, maxy, minz, maxz = vals or self.get_w_lims()
+ return [(minx, miny, minz),
+ (maxx, miny, minz),
+ (maxx, maxy, minz),
+ (minx, maxy, minz),
+ (minx, miny, maxz),
+ (maxx, miny, maxz),
+ (maxx, maxy, maxz),
+ (minx, maxy, maxz)]
+
+ def tunit_cube(self, vals=None, M=None):
+ if M is None:
+ M = self.M
+ xyzs = self.unit_cube(vals)
+ tcube = proj3d.proj_points(xyzs, M)
+ return tcube
+
+ def tunit_edges(self, vals=None, M=None):
+ tc = self.tunit_cube(vals, M)
+ edges = [(tc[0], tc[1]),
+ (tc[1], tc[2]),
+ (tc[2], tc[3]),
+ (tc[3], tc[0]),
+
+ (tc[0], tc[4]),
+ (tc[1], tc[5]),
+ (tc[2], tc[6]),
+ (tc[3], tc[7]),
+
+ (tc[4], tc[5]),
+ (tc[5], tc[6]),
+ (tc[6], tc[7]),
+ (tc[7], tc[4])]
+ return edges
+
+ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
+ """
+ Set the aspect ratios.
+
+ Axes 3D does not current support any aspect but 'auto' which fills
+ the axes with the data limits.
+
+ To simulate having equal aspect in data space, set the ratio
+ of your data limits to match the value of `~.get_box_aspect`.
+ To control box aspect ratios use `~.Axes3D.set_box_aspect`.
+
+ Parameters
+ ----------
+ aspect : {'auto'}
+ Possible values:
+
+ ========= ==================================================
+ value description
+ ========= ==================================================
+ 'auto' automatic; fill the position rectangle with data.
+ ========= ==================================================
+
+ adjustable : None
+ Currently ignored by Axes3D
+
+ If not *None*, this defines which parameter will be adjusted to
+ meet the required aspect. See `.set_adjustable` for further
+ details.
+
+ anchor : None or str or 2-tuple of float, optional
+ If not *None*, this defines where the Axes will be drawn if there
+ is extra space due to aspect constraints. The most common way to
+ to specify the anchor are abbreviations of cardinal directions:
+
+ ===== =====================
+ value description
+ ===== =====================
+ 'C' centered
+ 'SW' lower left corner
+ 'S' middle of bottom edge
+ 'SE' lower right corner
+ etc.
+ ===== =====================
+
+ See `.set_anchor` for further details.
+
+ share : bool, default: False
+ If ``True``, apply the settings to all shared Axes.
+
+ See Also
+ --------
+ mpl_toolkits.mplot3d.axes3d.Axes3D.set_box_aspect
+ """
+ if aspect != 'auto':
+ raise NotImplementedError(
+ "Axes3D currently only supports the aspect argument "
+ f"'auto'. You passed in {aspect!r}."
+ )
+
+ if share:
+ axes = {*self._shared_x_axes.get_siblings(self),
+ *self._shared_y_axes.get_siblings(self),
+ *self._shared_z_axes.get_siblings(self),
+ }
+ else:
+ axes = {self}
+
+ for ax in axes:
+ ax._aspect = aspect
+ ax.stale = True
+
+ if anchor is not None:
+ self.set_anchor(anchor, share=share)
+
+ def set_anchor(self, anchor, share=False):
+ # docstring inherited
+ if not (anchor in mtransforms.Bbox.coefs or len(anchor) == 2):
+ raise ValueError('anchor must be among %s' %
+ ', '.join(mtransforms.Bbox.coefs))
+ if share:
+ axes = {*self._shared_x_axes.get_siblings(self),
+ *self._shared_y_axes.get_siblings(self),
+ *self._shared_z_axes.get_siblings(self),
+ }
+ else:
+ axes = {self}
+ for ax in axes:
+ ax._anchor = anchor
+ ax.stale = True
+
+ def set_box_aspect(self, aspect, *, zoom=1):
+ """
+ Set the axes box aspect.
+
+ The box aspect is the ratio of height to width in display
+ units for each face of the box when viewed perpendicular to
+ that face. This is not to be confused with the data aspect
+ (which for Axes3D is always 'auto'). The default ratios are
+ 4:4:3 (x:y:z).
+
+ To simulate having equal aspect in data space, set the box
+ aspect to match your data range in each dimension.
+
+ *zoom* controls the overall size of the Axes3D in the figure.
+
+ Parameters
+ ----------
+ aspect : 3-tuple of floats or None
+ Changes the physical dimensions of the Axes3D, such that the ratio
+ of the axis lengths in display units is x:y:z.
+
+ If None, defaults to 4:4:3
+
+ zoom : float
+ Control overall size of the Axes3D in the figure.
+ """
+ if aspect is None:
+ aspect = np.asarray((4, 4, 3), dtype=float)
+ else:
+ orig_aspect = aspect
+ aspect = np.asarray(aspect, dtype=float)
+ if aspect.shape != (3,):
+ raise ValueError(
+ "You must pass a 3-tuple that can be cast to floats. "
+ f"You passed {orig_aspect!r}"
+ )
+ # default scale tuned to match the mpl32 appearance.
+ aspect *= 1.8294640721620434 * zoom / np.linalg.norm(aspect)
+
+ self._box_aspect = aspect
+ self.stale = True
+
+ def apply_aspect(self, position=None):
+ if position is None:
+ position = self.get_position(original=True)
+
+ # in the superclass, we would go through and actually deal with axis
+ # scales and box/datalim. Those are all irrelevant - all we need to do
+ # is make sure our coordinate system is square.
+ trans = self.get_figure().transSubfigure
+ bb = mtransforms.Bbox.from_bounds(0, 0, 1, 1).transformed(trans)
+ # this is the physical aspect of the panel (or figure):
+ fig_aspect = bb.height / bb.width
+
+ box_aspect = 1
+ pb = position.frozen()
+ pb1 = pb.shrunk_to_aspect(box_aspect, pb, fig_aspect)
+ self._set_position(pb1.anchored(self.get_anchor(), pb), 'active')
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ self._unstale_viewLim()
+
+ # draw the background patch
+ self.patch.draw(renderer)
+ self._frameon = False
+
+ # first, set the aspect
+ # this is duplicated from `axes._base._AxesBase.draw`
+ # but must be called before any of the artist are drawn as
+ # it adjusts the view limits and the size of the bounding box
+ # of the axes
+ locator = self.get_axes_locator()
+ if locator:
+ pos = locator(self, renderer)
+ self.apply_aspect(pos)
+ else:
+ self.apply_aspect()
+
+ # add the projection matrix to the renderer
+ self.M = self.get_proj()
+ props3d = {
+ # To raise a deprecation, we need to wrap the attribute in a
+ # function, but binding that to an instance does not work, as you
+ # would end up with an instance-specific method. Properties are
+ # class-level attributes which *are* functions, so we do that
+ # instead.
+ # This dictionary comprehension creates deprecated properties for
+ # the attributes listed below, and they are temporarily attached to
+ # the _class_ in the `_setattr_cm` call. These can both be removed
+ # once the deprecation expires
+ name: _api.deprecated('3.4', name=name,
+ alternative=f'self.axes.{name}')(
+ property(lambda self, _value=getattr(self, name): _value))
+ for name in ['M', 'vvec', 'eye', 'get_axis_position']
+ }
+
+ with cbook._setattr_cm(type(renderer), **props3d):
+ def do_3d_projection(artist):
+ """
+ Call `do_3d_projection` on an *artist*, and warn if passing
+ *renderer*.
+
+ For our Artists, never pass *renderer*. For external Artists,
+ in lieu of more complicated signature parsing, always pass
+ *renderer* and raise a warning.
+ """
+
+ if artist.__module__ == 'mpl_toolkits.mplot3d.art3d':
+ # Our 3D Artists have deprecated the renderer parameter, so
+ # avoid passing it to them; call this directly once the
+ # deprecation has expired.
+ return artist.do_3d_projection()
+
+ _api.warn_deprecated(
+ "3.4",
+ message="The 'renderer' parameter of "
+ "do_3d_projection() was deprecated in Matplotlib "
+ "%(since)s and will be removed %(removal)s.")
+ return artist.do_3d_projection(renderer)
+
+ # Calculate projection of collections and patches and zorder them.
+ # Make sure they are drawn above the grids.
+ zorder_offset = max(axis.get_zorder()
+ for axis in self._get_axis_list()) + 1
+ for i, col in enumerate(
+ sorted(self.collections,
+ key=do_3d_projection,
+ reverse=True)):
+ col.zorder = zorder_offset + i
+ for i, patch in enumerate(
+ sorted(self.patches,
+ key=do_3d_projection,
+ reverse=True)):
+ patch.zorder = zorder_offset + i
+
+ if self._axis3don:
+ # Draw panes first
+ for axis in self._get_axis_list():
+ axis.draw_pane(renderer)
+ # Then axes
+ for axis in self._get_axis_list():
+ axis.draw(renderer)
+
+ # Then rest
+ super().draw(renderer)
+
+ def get_axis_position(self):
+ vals = self.get_w_lims()
+ tc = self.tunit_cube(vals, self.M)
+ xhigh = tc[1][2] > tc[2][2]
+ yhigh = tc[3][2] > tc[2][2]
+ zhigh = tc[0][2] > tc[2][2]
+ return xhigh, yhigh, zhigh
+
+ def _unit_change_handler(self, axis_name, event=None):
+ # docstring inherited
+ if event is None: # Allow connecting `self._unit_change_handler(name)`
+ return functools.partial(
+ self._unit_change_handler, axis_name, event=object())
+ _api.check_in_list(self._get_axis_map(), axis_name=axis_name)
+ self.relim()
+ self._request_autoscale_view(scalex=(axis_name == "x"),
+ scaley=(axis_name == "y"),
+ scalez=(axis_name == "z"))
+
+ def update_datalim(self, xys, **kwargs):
+ pass
+
+ def get_autoscale_on(self):
+ """
+ Get whether autoscaling is applied for all axes on plot commands
+
+ .. versionadded:: 1.1.0
+ This function was added, but not tested. Please report any bugs.
+ """
+ return super().get_autoscale_on() and self.get_autoscalez_on()
+
+ def get_autoscalez_on(self):
+ """
+ Get whether autoscaling for the z-axis is applied on plot commands
+
+ .. versionadded:: 1.1.0
+ This function was added, but not tested. Please report any bugs.
+ """
+ return self._autoscaleZon
+
+ def set_autoscale_on(self, b):
+ """
+ Set whether autoscaling is applied on plot commands
+
+ .. versionadded:: 1.1.0
+ This function was added, but not tested. Please report any bugs.
+
+ Parameters
+ ----------
+ b : bool
+ """
+ super().set_autoscale_on(b)
+ self.set_autoscalez_on(b)
+
+ def set_autoscalez_on(self, b):
+ """
+ Set whether autoscaling for the z-axis is applied on plot commands
+
+ .. versionadded:: 1.1.0
+
+ Parameters
+ ----------
+ b : bool
+ """
+ self._autoscaleZon = b
+
+ def set_xmargin(self, m):
+ # docstring inherited
+ scalez = self._stale_viewlim_z
+ super().set_xmargin(m)
+ # Superclass is 2D and will call _request_autoscale_view with defaults
+ # for unknown Axis, which would be scalez=True, but it shouldn't be for
+ # this call, so restore it.
+ self._stale_viewlim_z = scalez
+
+ def set_ymargin(self, m):
+ # docstring inherited
+ scalez = self._stale_viewlim_z
+ super().set_ymargin(m)
+ # Superclass is 2D and will call _request_autoscale_view with defaults
+ # for unknown Axis, which would be scalez=True, but it shouldn't be for
+ # this call, so restore it.
+ self._stale_viewlim_z = scalez
+
+ def set_zmargin(self, m):
+ """
+ Set padding of Z data limits prior to autoscaling.
+
+ *m* times the data interval will be added to each
+ end of that interval before it is used in autoscaling.
+
+ accepts: float in range 0 to 1
+
+ .. versionadded:: 1.1.0
+ """
+ if m < 0 or m > 1:
+ raise ValueError("margin must be in range 0 to 1")
+ self._zmargin = m
+ self._request_autoscale_view(scalex=False, scaley=False, scalez=True)
+ self.stale = True
+
+ def margins(self, *margins, x=None, y=None, z=None, tight=True):
+ """
+ Convenience method to set or retrieve autoscaling margins.
+
+ Call signatures::
+
+ margins()
+
+ returns xmargin, ymargin, zmargin
+
+ ::
+
+ margins(margin)
+
+ margins(xmargin, ymargin, zmargin)
+
+ margins(x=xmargin, y=ymargin, z=zmargin)
+
+ margins(..., tight=False)
+
+ All forms above set the xmargin, ymargin and zmargin
+ parameters. All keyword parameters are optional. A single
+ positional argument specifies xmargin, ymargin and zmargin.
+ Passing both positional and keyword arguments for xmargin,
+ ymargin, and/or zmargin is invalid.
+
+ The *tight* parameter
+ is passed to :meth:`autoscale_view`, which is executed after
+ a margin is changed; the default here is *True*, on the
+ assumption that when margins are specified, no additional
+ padding to match tick marks is usually desired. Setting
+ *tight* to *None* will preserve the previous setting.
+
+ Specifying any margin changes only the autoscaling; for example,
+ if *xmargin* is not None, then *xmargin* times the X data
+ interval will be added to each end of that interval before
+ it is used in autoscaling.
+
+ .. versionadded:: 1.1.0
+ """
+ if margins and x is not None and y is not None and z is not None:
+ raise TypeError('Cannot pass both positional and keyword '
+ 'arguments for x, y, and/or z.')
+ elif len(margins) == 1:
+ x = y = z = margins[0]
+ elif len(margins) == 3:
+ x, y, z = margins
+ elif margins:
+ raise TypeError('Must pass a single positional argument for all '
+ 'margins, or one for each margin (x, y, z).')
+
+ if x is None and y is None and z is None:
+ if tight is not True:
+ _api.warn_external(f'ignoring tight={tight!r} in get mode')
+ return self._xmargin, self._ymargin, self._zmargin
+
+ if x is not None:
+ self.set_xmargin(x)
+ if y is not None:
+ self.set_ymargin(y)
+ if z is not None:
+ self.set_zmargin(z)
+
+ self.autoscale_view(
+ tight=tight, scalex=(x is not None), scaley=(y is not None),
+ scalez=(z is not None)
+ )
+
+ def autoscale(self, enable=True, axis='both', tight=None):
+ """
+ Convenience method for simple axis view autoscaling.
+ See :meth:`matplotlib.axes.Axes.autoscale` for full explanation.
+ Note that this function behaves the same, but for all
+ three axes. Therefore, 'z' can be passed for *axis*,
+ and 'both' applies to all three axes.
+
+ .. versionadded:: 1.1.0
+ """
+ if enable is None:
+ scalex = True
+ scaley = True
+ scalez = True
+ else:
+ if axis in ['x', 'both']:
+ self._autoscaleXon = scalex = bool(enable)
+ else:
+ scalex = False
+ if axis in ['y', 'both']:
+ self._autoscaleYon = scaley = bool(enable)
+ else:
+ scaley = False
+ if axis in ['z', 'both']:
+ self._autoscaleZon = scalez = bool(enable)
+ else:
+ scalez = False
+ self._request_autoscale_view(tight=tight, scalex=scalex, scaley=scaley,
+ scalez=scalez)
+
+ def auto_scale_xyz(self, X, Y, Z=None, had_data=None):
+ # This updates the bounding boxes as to keep a record as to what the
+ # minimum sized rectangular volume holds the data.
+ X = np.reshape(X, -1)
+ Y = np.reshape(Y, -1)
+ self.xy_dataLim.update_from_data_xy(
+ np.column_stack([X, Y]), not had_data)
+ if Z is not None:
+ Z = np.reshape(Z, -1)
+ self.zz_dataLim.update_from_data_xy(
+ np.column_stack([Z, Z]), not had_data)
+ # Let autoscale_view figure out how to use this data.
+ self.autoscale_view()
+
+ # API could be better, right now this is just to match the old calls to
+ # autoscale_view() after each plotting method.
+ def _request_autoscale_view(self, tight=None, scalex=True, scaley=True,
+ scalez=True):
+ if tight is not None:
+ self._tight = tight
+ if scalex:
+ self._stale_viewlim_x = True # Else keep old state.
+ if scaley:
+ self._stale_viewlim_y = True
+ if scalez:
+ self._stale_viewlim_z = True
+
+ def autoscale_view(self, tight=None, scalex=True, scaley=True,
+ scalez=True):
+ """
+ Autoscale the view limits using the data limits.
+ See :meth:`matplotlib.axes.Axes.autoscale_view` for documentation.
+ Note that this function applies to the 3D axes, and as such
+ adds the *scalez* to the function arguments.
+
+ .. versionchanged:: 1.1.0
+ Function signature was changed to better match the 2D version.
+ *tight* is now explicitly a kwarg and placed first.
+
+ .. versionchanged:: 1.2.1
+ This is now fully functional.
+ """
+ # This method looks at the rectangular volume (see above)
+ # of data and decides how to scale the view portal to fit it.
+ if tight is None:
+ # if image data only just use the datalim
+ _tight = self._tight or (
+ len(self.images) > 0
+ and len(self.lines) == len(self.patches) == 0)
+ else:
+ _tight = self._tight = bool(tight)
+
+ if scalex and self._autoscaleXon:
+ self._shared_x_axes.clean()
+ x0, x1 = self.xy_dataLim.intervalx
+ xlocator = self.xaxis.get_major_locator()
+ x0, x1 = xlocator.nonsingular(x0, x1)
+ if self._xmargin > 0:
+ delta = (x1 - x0) * self._xmargin
+ x0 -= delta
+ x1 += delta
+ if not _tight:
+ x0, x1 = xlocator.view_limits(x0, x1)
+ self.set_xbound(x0, x1)
+
+ if scaley and self._autoscaleYon:
+ self._shared_y_axes.clean()
+ y0, y1 = self.xy_dataLim.intervaly
+ ylocator = self.yaxis.get_major_locator()
+ y0, y1 = ylocator.nonsingular(y0, y1)
+ if self._ymargin > 0:
+ delta = (y1 - y0) * self._ymargin
+ y0 -= delta
+ y1 += delta
+ if not _tight:
+ y0, y1 = ylocator.view_limits(y0, y1)
+ self.set_ybound(y0, y1)
+
+ if scalez and self._autoscaleZon:
+ self._shared_z_axes.clean()
+ z0, z1 = self.zz_dataLim.intervalx
+ zlocator = self.zaxis.get_major_locator()
+ z0, z1 = zlocator.nonsingular(z0, z1)
+ if self._zmargin > 0:
+ delta = (z1 - z0) * self._zmargin
+ z0 -= delta
+ z1 += delta
+ if not _tight:
+ z0, z1 = zlocator.view_limits(z0, z1)
+ self.set_zbound(z0, z1)
+
+ def get_w_lims(self):
+ """Get 3D world limits."""
+ minx, maxx = self.get_xlim3d()
+ miny, maxy = self.get_ylim3d()
+ minz, maxz = self.get_zlim3d()
+ return minx, maxx, miny, maxy, minz, maxz
+
+ def set_xlim3d(self, left=None, right=None, emit=True, auto=False,
+ *, xmin=None, xmax=None):
+ """
+ Set 3D x limits.
+
+ See :meth:`matplotlib.axes.Axes.set_xlim` for full documentation.
+ """
+ if right is None and np.iterable(left):
+ left, right = left
+ if xmin is not None:
+ if left is not None:
+ raise TypeError('Cannot pass both `xmin` and `left`')
+ left = xmin
+ if xmax is not None:
+ if right is not None:
+ raise TypeError('Cannot pass both `xmax` and `right`')
+ right = xmax
+
+ self._process_unit_info([("x", (left, right))], convert=False)
+ left = self._validate_converted_limits(left, self.convert_xunits)
+ right = self._validate_converted_limits(right, self.convert_xunits)
+
+ old_left, old_right = self.get_xlim()
+ if left is None:
+ left = old_left
+ if right is None:
+ right = old_right
+
+ if left == right:
+ _api.warn_external(
+ f"Attempting to set identical left == right == {left} results "
+ f"in singular transformations; automatically expanding.")
+ reverse = left > right
+ left, right = self.xaxis.get_major_locator().nonsingular(left, right)
+ left, right = self.xaxis.limit_range_for_scale(left, right)
+ # cast to bool to avoid bad interaction between python 3.8 and np.bool_
+ left, right = sorted([left, right], reverse=bool(reverse))
+ self.xy_viewLim.intervalx = (left, right)
+
+ # Mark viewlims as no longer stale without triggering an autoscale.
+ for ax in self._shared_x_axes.get_siblings(self):
+ ax._stale_viewlim_x = False
+ if auto is not None:
+ self._autoscaleXon = bool(auto)
+
+ if emit:
+ self.callbacks.process('xlim_changed', self)
+ # Call all of the other x-axes that are shared with this one
+ for other in self._shared_x_axes.get_siblings(self):
+ if other is not self:
+ other.set_xlim(self.xy_viewLim.intervalx,
+ emit=False, auto=auto)
+ if other.figure != self.figure:
+ other.figure.canvas.draw_idle()
+ self.stale = True
+ return left, right
+
+ def set_ylim3d(self, bottom=None, top=None, emit=True, auto=False,
+ *, ymin=None, ymax=None):
+ """
+ Set 3D y limits.
+
+ See :meth:`matplotlib.axes.Axes.set_ylim` for full documentation.
+ """
+ if top is None and np.iterable(bottom):
+ bottom, top = bottom
+ if ymin is not None:
+ if bottom is not None:
+ raise TypeError('Cannot pass both `ymin` and `bottom`')
+ bottom = ymin
+ if ymax is not None:
+ if top is not None:
+ raise TypeError('Cannot pass both `ymax` and `top`')
+ top = ymax
+
+ self._process_unit_info([("y", (bottom, top))], convert=False)
+ bottom = self._validate_converted_limits(bottom, self.convert_yunits)
+ top = self._validate_converted_limits(top, self.convert_yunits)
+
+ old_bottom, old_top = self.get_ylim()
+ if bottom is None:
+ bottom = old_bottom
+ if top is None:
+ top = old_top
+
+ if bottom == top:
+ _api.warn_external(
+ f"Attempting to set identical bottom == top == {bottom} "
+ f"results in singular transformations; automatically "
+ f"expanding.")
+ swapped = bottom > top
+ bottom, top = self.yaxis.get_major_locator().nonsingular(bottom, top)
+ bottom, top = self.yaxis.limit_range_for_scale(bottom, top)
+ if swapped:
+ bottom, top = top, bottom
+ self.xy_viewLim.intervaly = (bottom, top)
+
+ # Mark viewlims as no longer stale without triggering an autoscale.
+ for ax in self._shared_y_axes.get_siblings(self):
+ ax._stale_viewlim_y = False
+ if auto is not None:
+ self._autoscaleYon = bool(auto)
+
+ if emit:
+ self.callbacks.process('ylim_changed', self)
+ # Call all of the other y-axes that are shared with this one
+ for other in self._shared_y_axes.get_siblings(self):
+ if other is not self:
+ other.set_ylim(self.xy_viewLim.intervaly,
+ emit=False, auto=auto)
+ if other.figure != self.figure:
+ other.figure.canvas.draw_idle()
+ self.stale = True
+ return bottom, top
+
+ def set_zlim3d(self, bottom=None, top=None, emit=True, auto=False,
+ *, zmin=None, zmax=None):
+ """
+ Set 3D z limits.
+
+ See :meth:`matplotlib.axes.Axes.set_ylim` for full documentation
+ """
+ if top is None and np.iterable(bottom):
+ bottom, top = bottom
+ if zmin is not None:
+ if bottom is not None:
+ raise TypeError('Cannot pass both `zmin` and `bottom`')
+ bottom = zmin
+ if zmax is not None:
+ if top is not None:
+ raise TypeError('Cannot pass both `zmax` and `top`')
+ top = zmax
+
+ self._process_unit_info([("z", (bottom, top))], convert=False)
+ bottom = self._validate_converted_limits(bottom, self.convert_zunits)
+ top = self._validate_converted_limits(top, self.convert_zunits)
+
+ old_bottom, old_top = self.get_zlim()
+ if bottom is None:
+ bottom = old_bottom
+ if top is None:
+ top = old_top
+
+ if bottom == top:
+ _api.warn_external(
+ f"Attempting to set identical bottom == top == {bottom} "
+ f"results in singular transformations; automatically "
+ f"expanding.")
+ swapped = bottom > top
+ bottom, top = self.zaxis.get_major_locator().nonsingular(bottom, top)
+ bottom, top = self.zaxis.limit_range_for_scale(bottom, top)
+ if swapped:
+ bottom, top = top, bottom
+ self.zz_viewLim.intervalx = (bottom, top)
+
+ # Mark viewlims as no longer stale without triggering an autoscale.
+ for ax in self._shared_z_axes.get_siblings(self):
+ ax._stale_viewlim_z = False
+ if auto is not None:
+ self._autoscaleZon = bool(auto)
+
+ if emit:
+ self.callbacks.process('zlim_changed', self)
+ # Call all of the other y-axes that are shared with this one
+ for other in self._shared_z_axes.get_siblings(self):
+ if other is not self:
+ other.set_zlim(self.zz_viewLim.intervalx,
+ emit=False, auto=auto)
+ if other.figure != self.figure:
+ other.figure.canvas.draw_idle()
+ self.stale = True
+ return bottom, top
+
+ def get_xlim3d(self):
+ return tuple(self.xy_viewLim.intervalx)
+ get_xlim3d.__doc__ = maxes.Axes.get_xlim.__doc__
+ if get_xlim3d.__doc__ is not None:
+ get_xlim3d.__doc__ += """
+ .. versionchanged:: 1.1.0
+ This function now correctly refers to the 3D x-limits
+ """
+
+ def get_ylim3d(self):
+ return tuple(self.xy_viewLim.intervaly)
+ get_ylim3d.__doc__ = maxes.Axes.get_ylim.__doc__
+ if get_ylim3d.__doc__ is not None:
+ get_ylim3d.__doc__ += """
+ .. versionchanged:: 1.1.0
+ This function now correctly refers to the 3D y-limits.
+ """
+
+ def get_zlim3d(self):
+ """Get 3D z limits."""
+ return tuple(self.zz_viewLim.intervalx)
+
+ def get_zscale(self):
+ """
+ Return the zaxis scale string %s
+
+ """ % (", ".join(mscale.get_scale_names()))
+ return self.zaxis.get_scale()
+
+ # We need to slightly redefine these to pass scalez=False
+ # to their calls of autoscale_view.
+
+ def set_xscale(self, value, **kwargs):
+ self.xaxis._set_scale(value, **kwargs)
+ self.autoscale_view(scaley=False, scalez=False)
+ self._update_transScale()
+ self.stale = True
+
+ def set_yscale(self, value, **kwargs):
+ self.yaxis._set_scale(value, **kwargs)
+ self.autoscale_view(scalex=False, scalez=False)
+ self._update_transScale()
+ self.stale = True
+
+ def set_zscale(self, value, **kwargs):
+ self.zaxis._set_scale(value, **kwargs)
+ self.autoscale_view(scalex=False, scaley=False)
+ self._update_transScale()
+ self.stale = True
+
+ set_xscale.__doc__, set_yscale.__doc__, set_zscale.__doc__ = map(
+ """
+ Set the {}-axis scale.
+
+ Parameters
+ ----------
+ value : {{"linear"}}
+ The axis scale type to apply. 3D axes currently only support
+ linear scales; other scales yield nonsensical results.
+
+ **kwargs
+ Keyword arguments are nominally forwarded to the scale class, but
+ none of them is applicable for linear scales.
+ """.format,
+ ["x", "y", "z"])
+
+ get_zticks = _axis_method_wrapper("zaxis", "get_ticklocs")
+ set_zticks = _axis_method_wrapper("zaxis", "set_ticks")
+ get_zmajorticklabels = _axis_method_wrapper("zaxis", "get_majorticklabels")
+ get_zminorticklabels = _axis_method_wrapper("zaxis", "get_minorticklabels")
+ get_zticklabels = _axis_method_wrapper("zaxis", "get_ticklabels")
+ set_zticklabels = _axis_method_wrapper(
+ "zaxis", "_set_ticklabels",
+ doc_sub={"Axis.set_ticks": "Axes3D.set_zticks"})
+
+ zaxis_date = _axis_method_wrapper("zaxis", "axis_date")
+ if zaxis_date.__doc__:
+ zaxis_date.__doc__ += textwrap.dedent("""
+
+ Notes
+ -----
+ This function is merely provided for completeness, but 3D axes do not
+ support dates for ticks, and so this may not work as expected.
+ """)
+
+ def clabel(self, *args, **kwargs):
+ """Currently not implemented for 3D axes, and returns *None*."""
+ return None
+
+ def view_init(self, elev=None, azim=None):
+ """
+ Set the elevation and azimuth of the axes in degrees (not radians).
+
+ This can be used to rotate the axes programmatically.
+
+ 'elev' stores the elevation angle in the z plane (in degrees).
+ 'azim' stores the azimuth angle in the (x, y) plane (in degrees).
+
+ if 'elev' or 'azim' are None (default), then the initial value
+ is used which was specified in the :class:`Axes3D` constructor.
+ """
+
+ self.dist = 10
+
+ if elev is None:
+ self.elev = self.initial_elev
+ else:
+ self.elev = elev
+
+ if azim is None:
+ self.azim = self.initial_azim
+ else:
+ self.azim = azim
+
+ def set_proj_type(self, proj_type):
+ """
+ Set the projection type.
+
+ Parameters
+ ----------
+ proj_type : {'persp', 'ortho'}
+ """
+ self._projection = _api.check_getitem({
+ 'persp': proj3d.persp_transformation,
+ 'ortho': proj3d.ortho_transformation,
+ }, proj_type=proj_type)
+
+ def get_proj(self):
+ """Create the projection matrix from the current viewing position."""
+ # elev stores the elevation angle in the z plane
+ # azim stores the azimuth angle in the x,y plane
+ #
+ # dist is the distance of the eye viewing point from the object
+ # point.
+
+ relev, razim = np.pi * self.elev/180, np.pi * self.azim/180
+
+ xmin, xmax = self.get_xlim3d()
+ ymin, ymax = self.get_ylim3d()
+ zmin, zmax = self.get_zlim3d()
+
+ # transform to uniform world coordinates 0-1, 0-1, 0-1
+ worldM = proj3d.world_transformation(xmin, xmax,
+ ymin, ymax,
+ zmin, zmax,
+ pb_aspect=self._box_aspect)
+
+ # look into the middle of the new coordinates
+ R = self._box_aspect / 2
+
+ xp = R[0] + np.cos(razim) * np.cos(relev) * self.dist
+ yp = R[1] + np.sin(razim) * np.cos(relev) * self.dist
+ zp = R[2] + np.sin(relev) * self.dist
+ E = np.array((xp, yp, zp))
+
+ self.eye = E
+ self.vvec = R - E
+ self.vvec = self.vvec / np.linalg.norm(self.vvec)
+
+ if abs(relev) > np.pi/2:
+ # upside down
+ V = np.array((0, 0, -1))
+ else:
+ V = np.array((0, 0, 1))
+ zfront, zback = -self.dist, self.dist
+
+ viewM = proj3d.view_transformation(E, R, V)
+ projM = self._projection(zfront, zback)
+ M0 = np.dot(viewM, worldM)
+ M = np.dot(projM, M0)
+ return M
+
+ def mouse_init(self, rotate_btn=1, zoom_btn=3):
+ """
+ Set the mouse buttons for 3D rotation and zooming.
+
+ Parameters
+ ----------
+ rotate_btn : int or list of int, default: 1
+ The mouse button or buttons to use for 3D rotation of the axes.
+ zoom_btn : int or list of int, default: 3
+ The mouse button or buttons to use to zoom the 3D axes.
+ """
+ self.button_pressed = None
+ # coerce scalars into array-like, then convert into
+ # a regular list to avoid comparisons against None
+ # which breaks in recent versions of numpy.
+ self._rotate_btn = np.atleast_1d(rotate_btn).tolist()
+ self._zoom_btn = np.atleast_1d(zoom_btn).tolist()
+
+ def disable_mouse_rotation(self):
+ """Disable mouse buttons for 3D rotation and zooming."""
+ self.mouse_init(rotate_btn=[], zoom_btn=[])
+
+ def can_zoom(self):
+ """
+ Return whether this axes supports the zoom box button functionality.
+
+ 3D axes objects do not use the zoom box button.
+ """
+ return False
+
+ def can_pan(self):
+ """
+ Return whether this axes supports the pan/zoom button functionality.
+
+ 3D axes objects do not use the pan/zoom button.
+ """
+ return False
+
+ def cla(self):
+ # docstring inherited.
+
+ super().cla()
+ self.zaxis.clear()
+
+ if self._sharez is not None:
+ self.zaxis.major = self._sharez.zaxis.major
+ self.zaxis.minor = self._sharez.zaxis.minor
+ z0, z1 = self._sharez.get_zlim()
+ self.set_zlim(z0, z1, emit=False, auto=None)
+ self.zaxis._set_scale(self._sharez.zaxis.get_scale())
+ else:
+ self.zaxis._set_scale('linear')
+ try:
+ self.set_zlim(0, 1)
+ except TypeError:
+ pass
+
+ self._autoscaleZon = True
+ if self._projection is proj3d.ortho_transformation:
+ self._zmargin = rcParams['axes.zmargin']
+ else:
+ self._zmargin = 0.
+
+ self.grid(rcParams['axes3d.grid'])
+
+ def _button_press(self, event):
+ if event.inaxes == self:
+ self.button_pressed = event.button
+ self.sx, self.sy = event.xdata, event.ydata
+ toolbar = getattr(self.figure.canvas, "toolbar")
+ if toolbar and toolbar._nav_stack() is None:
+ self.figure.canvas.toolbar.push_current()
+
+ def _button_release(self, event):
+ self.button_pressed = None
+ toolbar = getattr(self.figure.canvas, "toolbar")
+ if toolbar:
+ self.figure.canvas.toolbar.push_current()
+
+ def _get_view(self):
+ # docstring inherited
+ return (self.get_xlim(), self.get_ylim(), self.get_zlim(),
+ self.elev, self.azim)
+
+ def _set_view(self, view):
+ # docstring inherited
+ xlim, ylim, zlim, elev, azim = view
+ self.set(xlim=xlim, ylim=ylim, zlim=zlim)
+ self.elev = elev
+ self.azim = azim
+
+ def format_zdata(self, z):
+ """
+ Return *z* string formatted. This function will use the
+ :attr:`fmt_zdata` attribute if it is callable, else will fall
+ back on the zaxis major formatter
+ """
+ try:
+ return self.fmt_zdata(z)
+ except (AttributeError, TypeError):
+ func = self.zaxis.get_major_formatter().format_data_short
+ val = func(z)
+ return val
+
+ def format_coord(self, xd, yd):
+ """
+ Given the 2D view coordinates attempt to guess a 3D coordinate.
+ Looks for the nearest edge to the point and then assumes that
+ the point is at the same z location as the nearest point on the edge.
+ """
+
+ if self.M is None:
+ return ''
+
+ if self.button_pressed in self._rotate_btn:
+ return 'azimuth={:.0f} deg, elevation={:.0f} deg '.format(
+ self.azim, self.elev)
+ # ignore xd and yd and display angles instead
+
+ # nearest edge
+ p0, p1 = min(self.tunit_edges(),
+ key=lambda edge: proj3d._line2d_seg_dist(
+ edge[0], edge[1], (xd, yd)))
+
+ # scale the z value to match
+ x0, y0, z0 = p0
+ x1, y1, z1 = p1
+ d0 = np.hypot(x0-xd, y0-yd)
+ d1 = np.hypot(x1-xd, y1-yd)
+ dt = d0+d1
+ z = d1/dt * z0 + d0/dt * z1
+
+ x, y, z = proj3d.inv_transform(xd, yd, z, self.M)
+
+ xs = self.format_xdata(x)
+ ys = self.format_ydata(y)
+ zs = self.format_zdata(z)
+ return 'x=%s, y=%s, z=%s' % (xs, ys, zs)
+
+ def _on_move(self, event):
+ """
+ Mouse moving.
+
+ By default, button-1 rotates and button-3 zooms; these buttons can be
+ modified via `mouse_init`.
+ """
+
+ if not self.button_pressed:
+ return
+
+ if self.M is None:
+ return
+
+ x, y = event.xdata, event.ydata
+ # In case the mouse is out of bounds.
+ if x is None:
+ return
+
+ dx, dy = x - self.sx, y - self.sy
+ w = self._pseudo_w
+ h = self._pseudo_h
+ self.sx, self.sy = x, y
+
+ # Rotation
+ if self.button_pressed in self._rotate_btn:
+ # rotate viewing point
+ # get the x and y pixel coords
+ if dx == 0 and dy == 0:
+ return
+ self.elev = art3d._norm_angle(self.elev - (dy/h)*180)
+ self.azim = art3d._norm_angle(self.azim - (dx/w)*180)
+ self.get_proj()
+ self.stale = True
+ self.figure.canvas.draw_idle()
+
+ elif self.button_pressed == 2:
+ # pan view
+ # get the x and y pixel coords
+ if dx == 0 and dy == 0:
+ return
+ minx, maxx, miny, maxy, minz, maxz = self.get_w_lims()
+ dx = 1-((w - dx)/w)
+ dy = 1-((h - dy)/h)
+ elev, azim = np.deg2rad(self.elev), np.deg2rad(self.azim)
+ # project xv, yv, zv -> xw, yw, zw
+ dxx = (maxx-minx)*(dy*np.sin(elev)*np.cos(azim) + dx*np.sin(azim))
+ dyy = (maxy-miny)*(-dx*np.cos(azim) + dy*np.sin(elev)*np.sin(azim))
+ dzz = (maxz-minz)*(-dy*np.cos(elev))
+ # pan
+ self.set_xlim3d(minx + dxx, maxx + dxx)
+ self.set_ylim3d(miny + dyy, maxy + dyy)
+ self.set_zlim3d(minz + dzz, maxz + dzz)
+ self.get_proj()
+ self.figure.canvas.draw_idle()
+
+ # Zoom
+ elif self.button_pressed in self._zoom_btn:
+ # zoom view
+ # hmmm..this needs some help from clipping....
+ minx, maxx, miny, maxy, minz, maxz = self.get_w_lims()
+ df = 1-((h - dy)/h)
+ dx = (maxx-minx)*df
+ dy = (maxy-miny)*df
+ dz = (maxz-minz)*df
+ self.set_xlim3d(minx - dx, maxx + dx)
+ self.set_ylim3d(miny - dy, maxy + dy)
+ self.set_zlim3d(minz - dz, maxz + dz)
+ self.get_proj()
+ self.figure.canvas.draw_idle()
+
+ def set_zlabel(self, zlabel, fontdict=None, labelpad=None, **kwargs):
+ """
+ Set zlabel. See doc for `.set_ylabel` for description.
+ """
+ if labelpad is not None:
+ self.zaxis.labelpad = labelpad
+ return self.zaxis.set_label_text(zlabel, fontdict, **kwargs)
+
+ def get_zlabel(self):
+ """
+ Get the z-label text string.
+
+ .. versionadded:: 1.1.0
+ This function was added, but not tested. Please report any bugs.
+ """
+ label = self.zaxis.get_label()
+ return label.get_text()
+
+ # Axes rectangle characteristics
+
+ def get_frame_on(self):
+ """Get whether the 3D axes panels are drawn."""
+ return self._frameon
+
+ def set_frame_on(self, b):
+ """
+ Set whether the 3D axes panels are drawn.
+
+ Parameters
+ ----------
+ b : bool
+ """
+ self._frameon = bool(b)
+ self.stale = True
+
+ def grid(self, b=True, **kwargs):
+ """
+ Set / unset 3D grid.
+
+ .. note::
+
+ Currently, this function does not behave the same as
+ :meth:`matplotlib.axes.Axes.grid`, but it is intended to
+ eventually support that behavior.
+
+ .. versionadded:: 1.1.0
+ """
+ # TODO: Operate on each axes separately
+ if len(kwargs):
+ b = True
+ self._draw_grid = b
+ self.stale = True
+
+ def locator_params(self, axis='both', tight=None, **kwargs):
+ """
+ Convenience method for controlling tick locators.
+
+ See :meth:`matplotlib.axes.Axes.locator_params` for full
+ documentation. Note that this is for Axes3D objects,
+ therefore, setting *axis* to 'both' will result in the
+ parameters being set for all three axes. Also, *axis*
+ can also take a value of 'z' to apply parameters to the
+ z axis.
+
+ .. versionadded:: 1.1.0
+ This function was added, but not tested. Please report any bugs.
+ """
+ _x = axis in ['x', 'both']
+ _y = axis in ['y', 'both']
+ _z = axis in ['z', 'both']
+ if _x:
+ self.xaxis.get_major_locator().set_params(**kwargs)
+ if _y:
+ self.yaxis.get_major_locator().set_params(**kwargs)
+ if _z:
+ self.zaxis.get_major_locator().set_params(**kwargs)
+ self._request_autoscale_view(tight=tight, scalex=_x, scaley=_y,
+ scalez=_z)
+
+ def tick_params(self, axis='both', **kwargs):
+ """
+ Convenience method for changing the appearance of ticks and
+ tick labels.
+
+ See :meth:`matplotlib.axes.Axes.tick_params` for more complete
+ documentation.
+
+ The only difference is that setting *axis* to 'both' will
+ mean that the settings are applied to all three axes. Also,
+ the *axis* parameter also accepts a value of 'z', which
+ would mean to apply to only the z-axis.
+
+ Also, because of how Axes3D objects are drawn very differently
+ from regular 2D axes, some of these settings may have
+ ambiguous meaning. For simplicity, the 'z' axis will
+ accept settings as if it was like the 'y' axis.
+
+ .. note::
+ Axes3D currently ignores some of these settings.
+
+ .. versionadded:: 1.1.0
+ """
+ _api.check_in_list(['x', 'y', 'z', 'both'], axis=axis)
+ if axis in ['x', 'y', 'both']:
+ super().tick_params(axis, **kwargs)
+ if axis in ['z', 'both']:
+ zkw = dict(kwargs)
+ zkw.pop('top', None)
+ zkw.pop('bottom', None)
+ zkw.pop('labeltop', None)
+ zkw.pop('labelbottom', None)
+ self.zaxis.set_tick_params(**zkw)
+
+ # data limits, ticks, tick labels, and formatting
+
+ def invert_zaxis(self):
+ """
+ Invert the z-axis.
+
+ .. versionadded:: 1.1.0
+ This function was added, but not tested. Please report any bugs.
+ """
+ bottom, top = self.get_zlim()
+ self.set_zlim(top, bottom, auto=None)
+
+ def zaxis_inverted(self):
+ """
+ Returns True if the z-axis is inverted.
+
+ .. versionadded:: 1.1.0
+ """
+ bottom, top = self.get_zlim()
+ return top < bottom
+
+ def get_zbound(self):
+ """
+ Return the lower and upper z-axis bounds, in increasing order.
+
+ .. versionadded:: 1.1.0
+ """
+ bottom, top = self.get_zlim()
+ if bottom < top:
+ return bottom, top
+ else:
+ return top, bottom
+
+ def set_zbound(self, lower=None, upper=None):
+ """
+ Set the lower and upper numerical bounds of the z-axis.
+
+ This method will honor axes inversion regardless of parameter order.
+ It will not change the autoscaling setting (`.get_autoscalez_on()`).
+
+ .. versionadded:: 1.1.0
+ """
+ if upper is None and np.iterable(lower):
+ lower, upper = lower
+
+ old_lower, old_upper = self.get_zbound()
+ if lower is None:
+ lower = old_lower
+ if upper is None:
+ upper = old_upper
+
+ self.set_zlim(sorted((lower, upper),
+ reverse=bool(self.zaxis_inverted())),
+ auto=None)
+
+ def text(self, x, y, z, s, zdir=None, **kwargs):
+ """
+ Add text to the plot. kwargs will be passed on to Axes.text,
+ except for the *zdir* keyword, which sets the direction to be
+ used as the z direction.
+ """
+ text = super().text(x, y, s, **kwargs)
+ art3d.text_2d_to_3d(text, z, zdir)
+ return text
+
+ text3D = text
+ text2D = Axes.text
+
+ def plot(self, xs, ys, *args, zdir='z', **kwargs):
+ """
+ Plot 2D or 3D data.
+
+ Parameters
+ ----------
+ xs : 1D array-like
+ x coordinates of vertices.
+ ys : 1D array-like
+ y coordinates of vertices.
+ zs : float or 1D array-like
+ z coordinates of vertices; either one for all points or one for
+ each point.
+ zdir : {'x', 'y', 'z'}, default: 'z'
+ When plotting 2D data, the direction to use as z ('x', 'y' or 'z').
+ **kwargs
+ Other arguments are forwarded to `matplotlib.axes.Axes.plot`.
+ """
+ had_data = self.has_data()
+
+ # `zs` can be passed positionally or as keyword; checking whether
+ # args[0] is a string matches the behavior of 2D `plot` (via
+ # `_process_plot_var_args`).
+ if args and not isinstance(args[0], str):
+ zs, *args = args
+ if 'zs' in kwargs:
+ raise TypeError("plot() for multiple values for argument 'z'")
+ else:
+ zs = kwargs.pop('zs', 0)
+
+ # Match length
+ zs = np.broadcast_to(zs, np.shape(xs))
+
+ lines = super().plot(xs, ys, *args, **kwargs)
+ for line in lines:
+ art3d.line_2d_to_3d(line, zs=zs, zdir=zdir)
+
+ xs, ys, zs = art3d.juggle_axes(xs, ys, zs, zdir)
+ self.auto_scale_xyz(xs, ys, zs, had_data)
+ return lines
+
+ plot3D = plot
+
+ @_api.delete_parameter("3.4", "args", alternative="kwargs")
+ def plot_surface(self, X, Y, Z, *args, norm=None, vmin=None,
+ vmax=None, lightsource=None, **kwargs):
+ """
+ Create a surface plot.
+
+ By default it will be colored in shades of a solid color, but it also
+ supports colormapping by supplying the *cmap* argument.
+
+ .. note::
+
+ The *rcount* and *ccount* kwargs, which both default to 50,
+ determine the maximum number of samples used in each direction. If
+ the input data is larger, it will be downsampled (by slicing) to
+ these numbers of points.
+
+ .. note::
+
+ To maximize rendering speed consider setting *rstride* and *cstride*
+ to divisors of the number of rows minus 1 and columns minus 1
+ respectively. For example, given 51 rows rstride can be any of the
+ divisors of 50.
+
+ Similarly, a setting of *rstride* and *cstride* equal to 1 (or
+ *rcount* and *ccount* equal the number of rows and columns) can use
+ the optimized path.
+
+ Parameters
+ ----------
+ X, Y, Z : 2D arrays
+ Data values.
+
+ rcount, ccount : int
+ Maximum number of samples used in each direction. If the input
+ data is larger, it will be downsampled (by slicing) to these
+ numbers of points. Defaults to 50.
+
+ .. versionadded:: 2.0
+
+ rstride, cstride : int
+ Downsampling stride in each direction. These arguments are
+ mutually exclusive with *rcount* and *ccount*. If only one of
+ *rstride* or *cstride* is set, the other defaults to 10.
+
+ 'classic' mode uses a default of ``rstride = cstride = 10`` instead
+ of the new default of ``rcount = ccount = 50``.
+
+ color : color-like
+ Color of the surface patches.
+
+ cmap : Colormap
+ Colormap of the surface patches.
+
+ facecolors : array-like of colors.
+ Colors of each individual patch.
+
+ norm : Normalize
+ Normalization for the colormap.
+
+ vmin, vmax : float
+ Bounds for the normalization.
+
+ shade : bool, default: True
+ Whether to shade the facecolors. Shading is always disabled when
+ *cmap* is specified.
+
+ lightsource : `~matplotlib.colors.LightSource`
+ The lightsource to use when *shade* is True.
+
+ **kwargs
+ Other arguments are forwarded to `.Poly3DCollection`.
+ """
+
+ had_data = self.has_data()
+
+ if Z.ndim != 2:
+ raise ValueError("Argument Z must be 2-dimensional.")
+ if np.any(np.isnan(Z)):
+ _api.warn_external(
+ "Z contains NaN values. This may result in rendering "
+ "artifacts.")
+
+ # TODO: Support masked arrays
+ X, Y, Z = np.broadcast_arrays(X, Y, Z)
+ rows, cols = Z.shape
+
+ has_stride = 'rstride' in kwargs or 'cstride' in kwargs
+ has_count = 'rcount' in kwargs or 'ccount' in kwargs
+
+ if has_stride and has_count:
+ raise ValueError("Cannot specify both stride and count arguments")
+
+ rstride = kwargs.pop('rstride', 10)
+ cstride = kwargs.pop('cstride', 10)
+ rcount = kwargs.pop('rcount', 50)
+ ccount = kwargs.pop('ccount', 50)
+
+ if rcParams['_internal.classic_mode']:
+ # Strides have priority over counts in classic mode.
+ # So, only compute strides from counts
+ # if counts were explicitly given
+ compute_strides = has_count
+ else:
+ # If the strides are provided then it has priority.
+ # Otherwise, compute the strides from the counts.
+ compute_strides = not has_stride
+
+ if compute_strides:
+ rstride = int(max(np.ceil(rows / rcount), 1))
+ cstride = int(max(np.ceil(cols / ccount), 1))
+
+ if 'facecolors' in kwargs:
+ fcolors = kwargs.pop('facecolors')
+ else:
+ color = kwargs.pop('color', None)
+ if color is None:
+ color = self._get_lines.get_next_color()
+ color = np.array(mcolors.to_rgba(color))
+ fcolors = None
+
+ cmap = kwargs.get('cmap', None)
+ shade = kwargs.pop('shade', cmap is None)
+ if shade is None:
+ _api.warn_deprecated(
+ "3.1",
+ message="Passing shade=None to Axes3D.plot_surface() is "
+ "deprecated since matplotlib 3.1 and will change its "
+ "semantic or raise an error in matplotlib 3.3. "
+ "Please use shade=False instead.")
+
+ colset = [] # the sampled facecolor
+ if (rows - 1) % rstride == 0 and \
+ (cols - 1) % cstride == 0 and \
+ fcolors is None:
+ polys = np.stack(
+ [cbook._array_patch_perimeters(a, rstride, cstride)
+ for a in (X, Y, Z)],
+ axis=-1)
+ else:
+ # evenly spaced, and including both endpoints
+ row_inds = list(range(0, rows-1, rstride)) + [rows-1]
+ col_inds = list(range(0, cols-1, cstride)) + [cols-1]
+
+ polys = []
+ for rs, rs_next in zip(row_inds[:-1], row_inds[1:]):
+ for cs, cs_next in zip(col_inds[:-1], col_inds[1:]):
+ ps = [
+ # +1 ensures we share edges between polygons
+ cbook._array_perimeter(a[rs:rs_next+1, cs:cs_next+1])
+ for a in (X, Y, Z)
+ ]
+ # ps = np.stack(ps, axis=-1)
+ ps = np.array(ps).T
+ polys.append(ps)
+
+ if fcolors is not None:
+ colset.append(fcolors[rs][cs])
+
+ # note that the striding causes some polygons to have more coordinates
+ # than others
+ polyc = art3d.Poly3DCollection(polys, *args, **kwargs)
+
+ if fcolors is not None:
+ if shade:
+ colset = self._shade_colors(
+ colset, self._generate_normals(polys), lightsource)
+ polyc.set_facecolors(colset)
+ polyc.set_edgecolors(colset)
+ elif cmap:
+ # can't always vectorize, because polys might be jagged
+ if isinstance(polys, np.ndarray):
+ avg_z = polys[..., 2].mean(axis=-1)
+ else:
+ avg_z = np.array([ps[:, 2].mean() for ps in polys])
+ polyc.set_array(avg_z)
+ if vmin is not None or vmax is not None:
+ polyc.set_clim(vmin, vmax)
+ if norm is not None:
+ polyc.set_norm(norm)
+ else:
+ if shade:
+ colset = self._shade_colors(
+ color, self._generate_normals(polys), lightsource)
+ else:
+ colset = color
+ polyc.set_facecolors(colset)
+
+ self.add_collection(polyc)
+ self.auto_scale_xyz(X, Y, Z, had_data)
+
+ return polyc
+
+ def _generate_normals(self, polygons):
+ """
+ Compute the normals of a list of polygons.
+
+ Normals point towards the viewer for a face with its vertices in
+ counterclockwise order, following the right hand rule.
+
+ Uses three points equally spaced around the polygon.
+ This normal of course might not make sense for polygons with more than
+ three points not lying in a plane, but it's a plausible and fast
+ approximation.
+
+ Parameters
+ ----------
+ polygons : list of (M_i, 3) array-like, or (..., M, 3) array-like
+ A sequence of polygons to compute normals for, which can have
+ varying numbers of vertices. If the polygons all have the same
+ number of vertices and array is passed, then the operation will
+ be vectorized.
+
+ Returns
+ -------
+ normals : (..., 3) array
+ A normal vector estimated for the polygon.
+ """
+ if isinstance(polygons, np.ndarray):
+ # optimization: polygons all have the same number of points, so can
+ # vectorize
+ n = polygons.shape[-2]
+ i1, i2, i3 = 0, n//3, 2*n//3
+ v1 = polygons[..., i1, :] - polygons[..., i2, :]
+ v2 = polygons[..., i2, :] - polygons[..., i3, :]
+ else:
+ # The subtraction doesn't vectorize because polygons is jagged.
+ v1 = np.empty((len(polygons), 3))
+ v2 = np.empty((len(polygons), 3))
+ for poly_i, ps in enumerate(polygons):
+ n = len(ps)
+ i1, i2, i3 = 0, n//3, 2*n//3
+ v1[poly_i, :] = ps[i1, :] - ps[i2, :]
+ v2[poly_i, :] = ps[i2, :] - ps[i3, :]
+ return np.cross(v1, v2)
+
+ def _shade_colors(self, color, normals, lightsource=None):
+ """
+ Shade *color* using normal vectors given by *normals*.
+ *color* can also be an array of the same length as *normals*.
+ """
+ if lightsource is None:
+ # chosen for backwards-compatibility
+ lightsource = mcolors.LightSource(azdeg=225, altdeg=19.4712)
+
+ with np.errstate(invalid="ignore"):
+ shade = ((normals / np.linalg.norm(normals, axis=1, keepdims=True))
+ @ lightsource.direction)
+ mask = ~np.isnan(shade)
+
+ if mask.any():
+ # convert dot product to allowed shading fractions
+ in_norm = mcolors.Normalize(-1, 1)
+ out_norm = mcolors.Normalize(0.3, 1).inverse
+
+ def norm(x):
+ return out_norm(in_norm(x))
+
+ shade[~mask] = 0
+
+ color = mcolors.to_rgba_array(color)
+ # shape of color should be (M, 4) (where M is number of faces)
+ # shape of shade should be (M,)
+ # colors should have final shape of (M, 4)
+ alpha = color[:, 3]
+ colors = norm(shade)[:, np.newaxis] * color
+ colors[:, 3] = alpha
+ else:
+ colors = np.asanyarray(color).copy()
+
+ return colors
+
+ @_api.delete_parameter("3.4", "args", alternative="kwargs")
+ def plot_wireframe(self, X, Y, Z, *args, **kwargs):
+ """
+ Plot a 3D wireframe.
+
+ .. note::
+
+ The *rcount* and *ccount* kwargs, which both default to 50,
+ determine the maximum number of samples used in each direction. If
+ the input data is larger, it will be downsampled (by slicing) to
+ these numbers of points.
+
+ Parameters
+ ----------
+ X, Y, Z : 2D arrays
+ Data values.
+
+ rcount, ccount : int
+ Maximum number of samples used in each direction. If the input
+ data is larger, it will be downsampled (by slicing) to these
+ numbers of points. Setting a count to zero causes the data to be
+ not sampled in the corresponding direction, producing a 3D line
+ plot rather than a wireframe plot. Defaults to 50.
+
+ .. versionadded:: 2.0
+
+ rstride, cstride : int
+ Downsampling stride in each direction. These arguments are
+ mutually exclusive with *rcount* and *ccount*. If only one of
+ *rstride* or *cstride* is set, the other defaults to 1. Setting a
+ stride to zero causes the data to be not sampled in the
+ corresponding direction, producing a 3D line plot rather than a
+ wireframe plot.
+
+ 'classic' mode uses a default of ``rstride = cstride = 1`` instead
+ of the new default of ``rcount = ccount = 50``.
+
+ **kwargs
+ Other arguments are forwarded to `.Line3DCollection`.
+ """
+
+ had_data = self.has_data()
+ if Z.ndim != 2:
+ raise ValueError("Argument Z must be 2-dimensional.")
+ # FIXME: Support masked arrays
+ X, Y, Z = np.broadcast_arrays(X, Y, Z)
+ rows, cols = Z.shape
+
+ has_stride = 'rstride' in kwargs or 'cstride' in kwargs
+ has_count = 'rcount' in kwargs or 'ccount' in kwargs
+
+ if has_stride and has_count:
+ raise ValueError("Cannot specify both stride and count arguments")
+
+ rstride = kwargs.pop('rstride', 1)
+ cstride = kwargs.pop('cstride', 1)
+ rcount = kwargs.pop('rcount', 50)
+ ccount = kwargs.pop('ccount', 50)
+
+ if rcParams['_internal.classic_mode']:
+ # Strides have priority over counts in classic mode.
+ # So, only compute strides from counts
+ # if counts were explicitly given
+ if has_count:
+ rstride = int(max(np.ceil(rows / rcount), 1)) if rcount else 0
+ cstride = int(max(np.ceil(cols / ccount), 1)) if ccount else 0
+ else:
+ # If the strides are provided then it has priority.
+ # Otherwise, compute the strides from the counts.
+ if not has_stride:
+ rstride = int(max(np.ceil(rows / rcount), 1)) if rcount else 0
+ cstride = int(max(np.ceil(cols / ccount), 1)) if ccount else 0
+
+ # We want two sets of lines, one running along the "rows" of
+ # Z and another set of lines running along the "columns" of Z.
+ # This transpose will make it easy to obtain the columns.
+ tX, tY, tZ = np.transpose(X), np.transpose(Y), np.transpose(Z)
+
+ if rstride:
+ rii = list(range(0, rows, rstride))
+ # Add the last index only if needed
+ if rows > 0 and rii[-1] != (rows - 1):
+ rii += [rows-1]
+ else:
+ rii = []
+ if cstride:
+ cii = list(range(0, cols, cstride))
+ # Add the last index only if needed
+ if cols > 0 and cii[-1] != (cols - 1):
+ cii += [cols-1]
+ else:
+ cii = []
+
+ if rstride == 0 and cstride == 0:
+ raise ValueError("Either rstride or cstride must be non zero")
+
+ # If the inputs were empty, then just
+ # reset everything.
+ if Z.size == 0:
+ rii = []
+ cii = []
+
+ xlines = [X[i] for i in rii]
+ ylines = [Y[i] for i in rii]
+ zlines = [Z[i] for i in rii]
+
+ txlines = [tX[i] for i in cii]
+ tylines = [tY[i] for i in cii]
+ tzlines = [tZ[i] for i in cii]
+
+ lines = ([list(zip(xl, yl, zl))
+ for xl, yl, zl in zip(xlines, ylines, zlines)]
+ + [list(zip(xl, yl, zl))
+ for xl, yl, zl in zip(txlines, tylines, tzlines)])
+
+ linec = art3d.Line3DCollection(lines, *args, **kwargs)
+ self.add_collection(linec)
+ self.auto_scale_xyz(X, Y, Z, had_data)
+
+ return linec
+
+ def plot_trisurf(self, *args, color=None, norm=None, vmin=None, vmax=None,
+ lightsource=None, **kwargs):
+ """
+ Plot a triangulated surface.
+
+ The (optional) triangulation can be specified in one of two ways;
+ either::
+
+ plot_trisurf(triangulation, ...)
+
+ where triangulation is a `~matplotlib.tri.Triangulation` object, or::
+
+ plot_trisurf(X, Y, ...)
+ plot_trisurf(X, Y, triangles, ...)
+ plot_trisurf(X, Y, triangles=triangles, ...)
+
+ in which case a Triangulation object will be created. See
+ `.Triangulation` for a explanation of these possibilities.
+
+ The remaining arguments are::
+
+ plot_trisurf(..., Z)
+
+ where *Z* is the array of values to contour, one per point
+ in the triangulation.
+
+ Parameters
+ ----------
+ X, Y, Z : array-like
+ Data values as 1D arrays.
+ color
+ Color of the surface patches.
+ cmap
+ A colormap for the surface patches.
+ norm : Normalize
+ An instance of Normalize to map values to colors.
+ vmin, vmax : float, default: None
+ Minimum and maximum value to map.
+ shade : bool, default: True
+ Whether to shade the facecolors. Shading is always disabled when
+ *cmap* is specified.
+ lightsource : `~matplotlib.colors.LightSource`
+ The lightsource to use when *shade* is True.
+ **kwargs
+ All other arguments are passed on to
+ :class:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`
+
+ Examples
+ --------
+ .. plot:: gallery/mplot3d/trisurf3d.py
+ .. plot:: gallery/mplot3d/trisurf3d_2.py
+
+ .. versionadded:: 1.2.0
+ """
+
+ had_data = self.has_data()
+
+ # TODO: Support custom face colours
+ if color is None:
+ color = self._get_lines.get_next_color()
+ color = np.array(mcolors.to_rgba(color))
+
+ cmap = kwargs.get('cmap', None)
+ shade = kwargs.pop('shade', cmap is None)
+
+ tri, args, kwargs = \
+ Triangulation.get_from_args_and_kwargs(*args, **kwargs)
+ try:
+ z = kwargs.pop('Z')
+ except KeyError:
+ # We do this so Z doesn't get passed as an arg to PolyCollection
+ z, *args = args
+ z = np.asarray(z)
+
+ triangles = tri.get_masked_triangles()
+ xt = tri.x[triangles]
+ yt = tri.y[triangles]
+ zt = z[triangles]
+ verts = np.stack((xt, yt, zt), axis=-1)
+
+ polyc = art3d.Poly3DCollection(verts, *args, **kwargs)
+
+ if cmap:
+ # average over the three points of each triangle
+ avg_z = verts[:, :, 2].mean(axis=1)
+ polyc.set_array(avg_z)
+ if vmin is not None or vmax is not None:
+ polyc.set_clim(vmin, vmax)
+ if norm is not None:
+ polyc.set_norm(norm)
+ else:
+ if shade:
+ normals = self._generate_normals(verts)
+ colset = self._shade_colors(color, normals, lightsource)
+ else:
+ colset = color
+ polyc.set_facecolors(colset)
+
+ self.add_collection(polyc)
+ self.auto_scale_xyz(tri.x, tri.y, z, had_data)
+
+ return polyc
+
+ def _3d_extend_contour(self, cset, stride=5):
+ """
+ Extend a contour in 3D by creating
+ """
+
+ levels = cset.levels
+ colls = cset.collections
+ dz = (levels[1] - levels[0]) / 2
+
+ for z, linec in zip(levels, colls):
+ paths = linec.get_paths()
+ if not paths:
+ continue
+ topverts = art3d._paths_to_3d_segments(paths, z - dz)
+ botverts = art3d._paths_to_3d_segments(paths, z + dz)
+
+ color = linec.get_color()[0]
+
+ polyverts = []
+ normals = []
+ nsteps = round(len(topverts[0]) / stride)
+ if nsteps <= 1:
+ if len(topverts[0]) > 1:
+ nsteps = 2
+ else:
+ continue
+
+ stepsize = (len(topverts[0]) - 1) / (nsteps - 1)
+ for i in range(int(round(nsteps)) - 1):
+ i1 = int(round(i * stepsize))
+ i2 = int(round((i + 1) * stepsize))
+ polyverts.append([topverts[0][i1],
+ topverts[0][i2],
+ botverts[0][i2],
+ botverts[0][i1]])
+
+ # all polygons have 4 vertices, so vectorize
+ polyverts = np.array(polyverts)
+ normals = self._generate_normals(polyverts)
+
+ colors = self._shade_colors(color, normals)
+ colors2 = self._shade_colors(color, normals)
+ polycol = art3d.Poly3DCollection(polyverts,
+ facecolors=colors,
+ edgecolors=colors2)
+ polycol.set_sort_zpos(z)
+ self.add_collection3d(polycol)
+
+ for col in colls:
+ self.collections.remove(col)
+
+ def add_contour_set(
+ self, cset, extend3d=False, stride=5, zdir='z', offset=None):
+ zdir = '-' + zdir
+ if extend3d:
+ self._3d_extend_contour(cset, stride)
+ else:
+ for z, linec in zip(cset.levels, cset.collections):
+ if offset is not None:
+ z = offset
+ art3d.line_collection_2d_to_3d(linec, z, zdir=zdir)
+
+ def add_contourf_set(self, cset, zdir='z', offset=None):
+ zdir = '-' + zdir
+ for z, linec in zip(cset.levels, cset.collections):
+ if offset is not None:
+ z = offset
+ art3d.poly_collection_2d_to_3d(linec, z, zdir=zdir)
+ linec.set_sort_zpos(z)
+
+ def contour(self, X, Y, Z, *args,
+ extend3d=False, stride=5, zdir='z', offset=None, **kwargs):
+ """
+ Create a 3D contour plot.
+
+ Parameters
+ ----------
+ X, Y, Z : array-like
+ Input data.
+ extend3d : bool, default: False
+ Whether to extend contour in 3D.
+ stride : int
+ Step size for extending contour.
+ zdir : {'x', 'y', 'z'}, default: 'z'
+ The direction to use.
+ offset : float, optional
+ If specified, plot a projection of the contour lines at this
+ position in a plane normal to zdir.
+ *args, **kwargs
+ Other arguments are forwarded to `matplotlib.axes.Axes.contour`.
+
+ Returns
+ -------
+ matplotlib.contour.QuadContourSet
+ """
+ had_data = self.has_data()
+
+ jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
+ cset = super().contour(jX, jY, jZ, *args, **kwargs)
+ self.add_contour_set(cset, extend3d, stride, zdir, offset)
+
+ self.auto_scale_xyz(X, Y, Z, had_data)
+ return cset
+
+ contour3D = contour
+
+ def tricontour(self, *args,
+ extend3d=False, stride=5, zdir='z', offset=None, **kwargs):
+ """
+ Create a 3D contour plot.
+
+ .. versionchanged:: 1.3.0
+ Added support for custom triangulations
+
+ .. note::
+ This method currently produces incorrect output due to a
+ longstanding bug in 3D PolyCollection rendering.
+
+ Parameters
+ ----------
+ X, Y, Z : array-like
+ Input data.
+ extend3d : bool, default: False
+ Whether to extend contour in 3D.
+ stride : int
+ Step size for extending contour.
+ zdir : {'x', 'y', 'z'}, default: 'z'
+ The direction to use.
+ offset : float, optional
+ If specified, plot a projection of the contour lines at this
+ position in a plane normal to zdir.
+ *args, **kwargs
+ Other arguments are forwarded to `matplotlib.axes.Axes.tricontour`.
+
+ Returns
+ -------
+ matplotlib.tri.tricontour.TriContourSet
+ """
+ had_data = self.has_data()
+
+ tri, args, kwargs = Triangulation.get_from_args_and_kwargs(
+ *args, **kwargs)
+ X = tri.x
+ Y = tri.y
+ if 'Z' in kwargs:
+ Z = kwargs.pop('Z')
+ else:
+ # We do this so Z doesn't get passed as an arg to Axes.tricontour
+ Z, *args = args
+
+ jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
+ tri = Triangulation(jX, jY, tri.triangles, tri.mask)
+
+ cset = super().tricontour(tri, jZ, *args, **kwargs)
+ self.add_contour_set(cset, extend3d, stride, zdir, offset)
+
+ self.auto_scale_xyz(X, Y, Z, had_data)
+ return cset
+
+ def contourf(self, X, Y, Z, *args, zdir='z', offset=None, **kwargs):
+ """
+ Create a 3D filled contour plot.
+
+ Parameters
+ ----------
+ X, Y, Z : array-like
+ Input data.
+ zdir : {'x', 'y', 'z'}, default: 'z'
+ The direction to use.
+ offset : float, optional
+ If specified, plot a projection of the contour lines at this
+ position in a plane normal to zdir.
+ *args, **kwargs
+ Other arguments are forwarded to `matplotlib.axes.Axes.contourf`.
+
+ Returns
+ -------
+ matplotlib.contour.QuadContourSet
+
+ Notes
+ -----
+ .. versionadded:: 1.1.0
+ The *zdir* and *offset* parameters.
+ """
+ had_data = self.has_data()
+
+ jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
+ cset = super().contourf(jX, jY, jZ, *args, **kwargs)
+ self.add_contourf_set(cset, zdir, offset)
+
+ self.auto_scale_xyz(X, Y, Z, had_data)
+ return cset
+
+ contourf3D = contourf
+
+ def tricontourf(self, *args, zdir='z', offset=None, **kwargs):
+ """
+ Create a 3D filled contour plot.
+
+ .. note::
+ This method currently produces incorrect output due to a
+ longstanding bug in 3D PolyCollection rendering.
+
+ Parameters
+ ----------
+ X, Y, Z : array-like
+ Input data.
+ zdir : {'x', 'y', 'z'}, default: 'z'
+ The direction to use.
+ offset : float, optional
+ If specified, plot a projection of the contour lines at this
+ position in a plane normal to zdir.
+ *args, **kwargs
+ Other arguments are forwarded to
+ `matplotlib.axes.Axes.tricontourf`.
+
+ Returns
+ -------
+ matplotlib.tri.tricontour.TriContourSet
+
+ Notes
+ -----
+ .. versionadded:: 1.1.0
+ The *zdir* and *offset* parameters.
+ .. versionchanged:: 1.3.0
+ Added support for custom triangulations
+ """
+ had_data = self.has_data()
+
+ tri, args, kwargs = Triangulation.get_from_args_and_kwargs(
+ *args, **kwargs)
+ X = tri.x
+ Y = tri.y
+ if 'Z' in kwargs:
+ Z = kwargs.pop('Z')
+ else:
+ # We do this so Z doesn't get passed as an arg to Axes.tricontourf
+ Z, *args = args
+
+ jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
+ tri = Triangulation(jX, jY, tri.triangles, tri.mask)
+
+ cset = super().tricontourf(tri, jZ, *args, **kwargs)
+ self.add_contourf_set(cset, zdir, offset)
+
+ self.auto_scale_xyz(X, Y, Z, had_data)
+ return cset
+
+ def add_collection3d(self, col, zs=0, zdir='z'):
+ """
+ Add a 3D collection object to the plot.
+
+ 2D collection types are converted to a 3D version by
+ modifying the object and adding z coordinate information.
+
+ Supported are:
+
+ - PolyCollection
+ - LineCollection
+ - PatchCollection
+ """
+ zvals = np.atleast_1d(zs)
+ zsortval = (np.min(zvals) if zvals.size
+ else 0) # FIXME: arbitrary default
+
+ # FIXME: use issubclass() (although, then a 3D collection
+ # object would also pass.) Maybe have a collection3d
+ # abstract class to test for and exclude?
+ if type(col) is mcoll.PolyCollection:
+ art3d.poly_collection_2d_to_3d(col, zs=zs, zdir=zdir)
+ col.set_sort_zpos(zsortval)
+ elif type(col) is mcoll.LineCollection:
+ art3d.line_collection_2d_to_3d(col, zs=zs, zdir=zdir)
+ col.set_sort_zpos(zsortval)
+ elif type(col) is mcoll.PatchCollection:
+ art3d.patch_collection_2d_to_3d(col, zs=zs, zdir=zdir)
+ col.set_sort_zpos(zsortval)
+
+ collection = super().add_collection(col)
+ return collection
+
+ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True,
+ *args, **kwargs):
+ """
+ Create a scatter plot.
+
+ Parameters
+ ----------
+ xs, ys : array-like
+ The data positions.
+ zs : float or array-like, default: 0
+ The z-positions. Either an array of the same length as *xs* and
+ *ys* or a single value to place all points in the same plane.
+ zdir : {'x', 'y', 'z', '-x', '-y', '-z'}, default: 'z'
+ The axis direction for the *zs*. This is useful when plotting 2D
+ data on a 3D Axes. The data must be passed as *xs*, *ys*. Setting
+ *zdir* to 'y' then plots the data to the x-z-plane.
+
+ See also :doc:`/gallery/mplot3d/2dcollections3d`.
+
+ s : float or array-like, default: 20
+ The marker size in points**2. Either an array of the same length
+ as *xs* and *ys* or a single value to make all markers the same
+ size.
+ c : color, sequence, or sequence of colors, optional
+ The marker color. Possible values:
+
+ - A single color format string.
+ - A sequence of colors of length n.
+ - A sequence of n numbers to be mapped to colors using *cmap* and
+ *norm*.
+ - A 2D array in which the rows are RGB or RGBA.
+
+ For more details see the *c* argument of `~.axes.Axes.scatter`.
+ depthshade : bool, default: True
+ Whether to shade the scatter markers to give the appearance of
+ depth. Each call to ``scatter()`` will perform its depthshading
+ independently.
+ **kwargs
+ All other arguments are passed on to `~.axes.Axes.scatter`.
+
+ Returns
+ -------
+ paths : `~matplotlib.collections.PathCollection`
+ """
+
+ had_data = self.has_data()
+ zs_orig = zs
+
+ xs, ys, zs = np.broadcast_arrays(
+ *[np.ravel(np.ma.filled(t, np.nan)) for t in [xs, ys, zs]])
+ s = np.ma.ravel(s) # This doesn't have to match x, y in size.
+
+ xs, ys, zs, s, c = cbook.delete_masked_points(xs, ys, zs, s, c)
+
+ # For xs and ys, 2D scatter() will do the copying.
+ if np.may_share_memory(zs_orig, zs): # Avoid unnecessary copies.
+ zs = zs.copy()
+
+ patches = super().scatter(xs, ys, s=s, c=c, *args, **kwargs)
+ art3d.patch_collection_2d_to_3d(patches, zs=zs, zdir=zdir,
+ depthshade=depthshade)
+
+ if self._zmargin < 0.05 and xs.size > 0:
+ self.set_zmargin(0.05)
+
+ self.auto_scale_xyz(xs, ys, zs, had_data)
+
+ return patches
+
+ scatter3D = scatter
+
+ def bar(self, left, height, zs=0, zdir='z', *args, **kwargs):
+ """
+ Add 2D bar(s).
+
+ Parameters
+ ----------
+ left : 1D array-like
+ The x coordinates of the left sides of the bars.
+ height : 1D array-like
+ The height of the bars.
+ zs : float or 1D array-like
+ Z coordinate of bars; if a single value is specified, it will be
+ used for all bars.
+ zdir : {'x', 'y', 'z'}, default: 'z'
+ When plotting 2D data, the direction to use as z ('x', 'y' or 'z').
+ **kwargs
+ Other arguments are forwarded to `matplotlib.axes.Axes.bar`.
+
+ Returns
+ -------
+ mpl_toolkits.mplot3d.art3d.Patch3DCollection
+ """
+ had_data = self.has_data()
+
+ patches = super().bar(left, height, *args, **kwargs)
+
+ zs = np.broadcast_to(zs, len(left))
+
+ verts = []
+ verts_zs = []
+ for p, z in zip(patches, zs):
+ vs = art3d._get_patch_verts(p)
+ verts += vs.tolist()
+ verts_zs += [z] * len(vs)
+ art3d.patch_2d_to_3d(p, z, zdir)
+ if 'alpha' in kwargs:
+ p.set_alpha(kwargs['alpha'])
+
+ if len(verts) > 0:
+ # the following has to be skipped if verts is empty
+ # NOTE: Bugs could still occur if len(verts) > 0,
+ # but the "2nd dimension" is empty.
+ xs, ys = zip(*verts)
+ else:
+ xs, ys = [], []
+
+ xs, ys, verts_zs = art3d.juggle_axes(xs, ys, verts_zs, zdir)
+ self.auto_scale_xyz(xs, ys, verts_zs, had_data)
+
+ return patches
+
+ def bar3d(self, x, y, z, dx, dy, dz, color=None,
+ zsort='average', shade=True, lightsource=None, *args, **kwargs):
+ """
+ Generate a 3D barplot.
+
+ This method creates three dimensional barplot where the width,
+ depth, height, and color of the bars can all be uniquely set.
+
+ Parameters
+ ----------
+ x, y, z : array-like
+ The coordinates of the anchor point of the bars.
+
+ dx, dy, dz : float or array-like
+ The width, depth, and height of the bars, respectively.
+
+ color : sequence of colors, optional
+ The color of the bars can be specified globally or
+ individually. This parameter can be:
+
+ - A single color, to color all bars the same color.
+ - An array of colors of length N bars, to color each bar
+ independently.
+ - An array of colors of length 6, to color the faces of the
+ bars similarly.
+ - An array of colors of length 6 * N bars, to color each face
+ independently.
+
+ When coloring the faces of the boxes specifically, this is
+ the order of the coloring:
+
+ 1. -Z (bottom of box)
+ 2. +Z (top of box)
+ 3. -Y
+ 4. +Y
+ 5. -X
+ 6. +X
+
+ zsort : str, optional
+ The z-axis sorting scheme passed onto `~.art3d.Poly3DCollection`
+
+ shade : bool, default: True
+ When true, this shades the dark sides of the bars (relative
+ to the plot's source of light).
+
+ lightsource : `~matplotlib.colors.LightSource`
+ The lightsource to use when *shade* is True.
+
+ **kwargs
+ Any additional keyword arguments are passed onto
+ `~.art3d.Poly3DCollection`.
+
+ Returns
+ -------
+ collection : `~.art3d.Poly3DCollection`
+ A collection of three dimensional polygons representing
+ the bars.
+ """
+
+ had_data = self.has_data()
+
+ x, y, z, dx, dy, dz = np.broadcast_arrays(
+ np.atleast_1d(x), y, z, dx, dy, dz)
+ minx = np.min(x)
+ maxx = np.max(x + dx)
+ miny = np.min(y)
+ maxy = np.max(y + dy)
+ minz = np.min(z)
+ maxz = np.max(z + dz)
+
+ # shape (6, 4, 3)
+ # All faces are oriented facing outwards - when viewed from the
+ # outside, their vertices are in a counterclockwise ordering.
+ cuboid = np.array([
+ # -z
+ (
+ (0, 0, 0),
+ (0, 1, 0),
+ (1, 1, 0),
+ (1, 0, 0),
+ ),
+ # +z
+ (
+ (0, 0, 1),
+ (1, 0, 1),
+ (1, 1, 1),
+ (0, 1, 1),
+ ),
+ # -y
+ (
+ (0, 0, 0),
+ (1, 0, 0),
+ (1, 0, 1),
+ (0, 0, 1),
+ ),
+ # +y
+ (
+ (0, 1, 0),
+ (0, 1, 1),
+ (1, 1, 1),
+ (1, 1, 0),
+ ),
+ # -x
+ (
+ (0, 0, 0),
+ (0, 0, 1),
+ (0, 1, 1),
+ (0, 1, 0),
+ ),
+ # +x
+ (
+ (1, 0, 0),
+ (1, 1, 0),
+ (1, 1, 1),
+ (1, 0, 1),
+ ),
+ ])
+
+ # indexed by [bar, face, vertex, coord]
+ polys = np.empty(x.shape + cuboid.shape)
+
+ # handle each coordinate separately
+ for i, p, dp in [(0, x, dx), (1, y, dy), (2, z, dz)]:
+ p = p[..., np.newaxis, np.newaxis]
+ dp = dp[..., np.newaxis, np.newaxis]
+ polys[..., i] = p + dp * cuboid[..., i]
+
+ # collapse the first two axes
+ polys = polys.reshape((-1,) + polys.shape[2:])
+
+ facecolors = []
+ if color is None:
+ color = [self._get_patches_for_fill.get_next_color()]
+
+ color = list(mcolors.to_rgba_array(color))
+
+ if len(color) == len(x):
+ # bar colors specified, need to expand to number of faces
+ for c in color:
+ facecolors.extend([c] * 6)
+ else:
+ # a single color specified, or face colors specified explicitly
+ facecolors = color
+ if len(facecolors) < len(x):
+ facecolors *= (6 * len(x))
+
+ if shade:
+ normals = self._generate_normals(polys)
+ sfacecolors = self._shade_colors(facecolors, normals, lightsource)
+ else:
+ sfacecolors = facecolors
+
+ col = art3d.Poly3DCollection(polys,
+ zsort=zsort,
+ facecolor=sfacecolors,
+ *args, **kwargs)
+ self.add_collection(col)
+
+ self.auto_scale_xyz((minx, maxx), (miny, maxy), (minz, maxz), had_data)
+
+ return col
+
+ def set_title(self, label, fontdict=None, loc='center', **kwargs):
+ # docstring inherited
+ ret = super().set_title(label, fontdict=fontdict, loc=loc, **kwargs)
+ (x, y) = self.title.get_position()
+ self.title.set_y(0.92 * y)
+ return ret
+
+ def quiver(self, *args,
+ length=1, arrow_length_ratio=.3, pivot='tail', normalize=False,
+ **kwargs):
+ """
+ ax.quiver(X, Y, Z, U, V, W, /, length=1, arrow_length_ratio=.3, \
+pivot='tail', normalize=False, **kwargs)
+
+ Plot a 3D field of arrows.
+
+ The arguments could be array-like or scalars, so long as they
+ they can be broadcast together. The arguments can also be
+ masked arrays. If an element in any of argument is masked, then
+ that corresponding quiver element will not be plotted.
+
+ Parameters
+ ----------
+ X, Y, Z : array-like
+ The x, y and z coordinates of the arrow locations (default is
+ tail of arrow; see *pivot* kwarg).
+
+ U, V, W : array-like
+ The x, y and z components of the arrow vectors.
+
+ length : float, default: 1
+ The length of each quiver.
+
+ arrow_length_ratio : float, default: 0.3
+ The ratio of the arrow head with respect to the quiver.
+
+ pivot : {'tail', 'middle', 'tip'}, default: 'tail'
+ The part of the arrow that is at the grid point; the arrow
+ rotates about this point, hence the name *pivot*.
+
+ normalize : bool, default: False
+ Whether all arrows are normalized to have the same length, or keep
+ the lengths defined by *u*, *v*, and *w*.
+
+ **kwargs
+ Any additional keyword arguments are delegated to
+ :class:`~matplotlib.collections.LineCollection`
+ """
+
+ def calc_arrows(UVW, angle=15):
+ # get unit direction vector perpendicular to (u, v, w)
+ x = UVW[:, 0]
+ y = UVW[:, 1]
+ norm = np.linalg.norm(UVW[:, :2], axis=1)
+ x_p = np.divide(y, norm, where=norm != 0, out=np.zeros_like(x))
+ y_p = np.divide(-x, norm, where=norm != 0, out=np.ones_like(x))
+ # compute the two arrowhead direction unit vectors
+ ra = math.radians(angle)
+ c = math.cos(ra)
+ s = math.sin(ra)
+ # construct the rotation matrices of shape (3, 3, n)
+ Rpos = np.array(
+ [[c + (x_p ** 2) * (1 - c), x_p * y_p * (1 - c), y_p * s],
+ [y_p * x_p * (1 - c), c + (y_p ** 2) * (1 - c), -x_p * s],
+ [-y_p * s, x_p * s, np.full_like(x_p, c)]])
+ # opposite rotation negates all the sin terms
+ Rneg = Rpos.copy()
+ Rneg[[0, 1, 2, 2], [2, 2, 0, 1]] *= -1
+ # Batch n (3, 3) x (3) matrix multiplications ((3, 3, n) x (n, 3)).
+ Rpos_vecs = np.einsum("ij...,...j->...i", Rpos, UVW)
+ Rneg_vecs = np.einsum("ij...,...j->...i", Rneg, UVW)
+ # Stack into (n, 2, 3) result.
+ head_dirs = np.stack([Rpos_vecs, Rneg_vecs], axis=1)
+ return head_dirs
+
+ had_data = self.has_data()
+
+ # handle args
+ argi = 6
+ if len(args) < argi:
+ raise ValueError('Wrong number of arguments. Expected %d got %d' %
+ (argi, len(args)))
+
+ # first 6 arguments are X, Y, Z, U, V, W
+ input_args = args[:argi]
+
+ # extract the masks, if any
+ masks = [k.mask for k in input_args
+ if isinstance(k, np.ma.MaskedArray)]
+ # broadcast to match the shape
+ bcast = np.broadcast_arrays(*input_args, *masks)
+ input_args = bcast[:argi]
+ masks = bcast[argi:]
+ if masks:
+ # combine the masks into one
+ mask = functools.reduce(np.logical_or, masks)
+ # put mask on and compress
+ input_args = [np.ma.array(k, mask=mask).compressed()
+ for k in input_args]
+ else:
+ input_args = [np.ravel(k) for k in input_args]
+
+ if any(len(v) == 0 for v in input_args):
+ # No quivers, so just make an empty collection and return early
+ linec = art3d.Line3DCollection([], *args[argi:], **kwargs)
+ self.add_collection(linec)
+ return linec
+
+ shaft_dt = np.array([0., length], dtype=float)
+ arrow_dt = shaft_dt * arrow_length_ratio
+
+ _api.check_in_list(['tail', 'middle', 'tip'], pivot=pivot)
+ if pivot == 'tail':
+ shaft_dt -= length
+ elif pivot == 'middle':
+ shaft_dt -= length / 2
+
+ XYZ = np.column_stack(input_args[:3])
+ UVW = np.column_stack(input_args[3:argi]).astype(float)
+
+ # Normalize rows of UVW
+ norm = np.linalg.norm(UVW, axis=1)
+
+ # If any row of UVW is all zeros, don't make a quiver for it
+ mask = norm > 0
+ XYZ = XYZ[mask]
+ if normalize:
+ UVW = UVW[mask] / norm[mask].reshape((-1, 1))
+ else:
+ UVW = UVW[mask]
+
+ if len(XYZ) > 0:
+ # compute the shaft lines all at once with an outer product
+ shafts = (XYZ - np.multiply.outer(shaft_dt, UVW)).swapaxes(0, 1)
+ # compute head direction vectors, n heads x 2 sides x 3 dimensions
+ head_dirs = calc_arrows(UVW)
+ # compute all head lines at once, starting from the shaft ends
+ heads = shafts[:, :1] - np.multiply.outer(arrow_dt, head_dirs)
+ # stack left and right head lines together
+ heads = heads.reshape((len(arrow_dt), -1, 3))
+ # transpose to get a list of lines
+ heads = heads.swapaxes(0, 1)
+
+ lines = [*shafts, *heads]
+ else:
+ lines = []
+
+ linec = art3d.Line3DCollection(lines, *args[argi:], **kwargs)
+ self.add_collection(linec)
+
+ self.auto_scale_xyz(XYZ[:, 0], XYZ[:, 1], XYZ[:, 2], had_data)
+
+ return linec
+
+ quiver3D = quiver
+
+ def voxels(self, *args, facecolors=None, edgecolors=None, shade=True,
+ lightsource=None, **kwargs):
+ """
+ ax.voxels([x, y, z,] /, filled, facecolors=None, edgecolors=None, \
+**kwargs)
+
+ Plot a set of filled voxels
+
+ All voxels are plotted as 1x1x1 cubes on the axis, with
+ ``filled[0, 0, 0]`` placed with its lower corner at the origin.
+ Occluded faces are not plotted.
+
+ .. versionadded:: 2.1
+
+ Parameters
+ ----------
+ filled : 3D np.array of bool
+ A 3D array of values, with truthy values indicating which voxels
+ to fill
+
+ x, y, z : 3D np.array, optional
+ The coordinates of the corners of the voxels. This should broadcast
+ to a shape one larger in every dimension than the shape of
+ *filled*. These can be used to plot non-cubic voxels.
+
+ If not specified, defaults to increasing integers along each axis,
+ like those returned by :func:`~numpy.indices`.
+ As indicated by the ``/`` in the function signature, these
+ arguments can only be passed positionally.
+
+ facecolors, edgecolors : array-like, optional
+ The color to draw the faces and edges of the voxels. Can only be
+ passed as keyword arguments.
+ These parameters can be:
+
+ - A single color value, to color all voxels the same color. This
+ can be either a string, or a 1D rgb/rgba array
+ - ``None``, the default, to use a single color for the faces, and
+ the style default for the edges.
+ - A 3D ndarray of color names, with each item the color for the
+ corresponding voxel. The size must match the voxels.
+ - A 4D ndarray of rgb/rgba data, with the components along the
+ last axis.
+
+ shade : bool, default: True
+ Whether to shade the facecolors. Shading is always disabled when
+ *cmap* is specified.
+
+ .. versionadded:: 3.1
+
+ lightsource : `~matplotlib.colors.LightSource`
+ The lightsource to use when *shade* is True.
+
+ .. versionadded:: 3.1
+
+ **kwargs
+ Additional keyword arguments to pass onto
+ `~mpl_toolkits.mplot3d.art3d.Poly3DCollection`.
+
+ Returns
+ -------
+ faces : dict
+ A dictionary indexed by coordinate, where ``faces[i, j, k]`` is a
+ `.Poly3DCollection` of the faces drawn for the voxel
+ ``filled[i, j, k]``. If no faces were drawn for a given voxel,
+ either because it was not asked to be drawn, or it is fully
+ occluded, then ``(i, j, k) not in faces``.
+
+ Examples
+ --------
+ .. plot:: gallery/mplot3d/voxels.py
+ .. plot:: gallery/mplot3d/voxels_rgb.py
+ .. plot:: gallery/mplot3d/voxels_torus.py
+ .. plot:: gallery/mplot3d/voxels_numpy_logo.py
+ """
+
+ # work out which signature we should be using, and use it to parse
+ # the arguments. Name must be voxels for the correct error message
+ if len(args) >= 3:
+ # underscores indicate position only
+ def voxels(__x, __y, __z, filled, **kwargs):
+ return (__x, __y, __z), filled, kwargs
+ else:
+ def voxels(filled, **kwargs):
+ return None, filled, kwargs
+
+ xyz, filled, kwargs = voxels(*args, **kwargs)
+
+ # check dimensions
+ if filled.ndim != 3:
+ raise ValueError("Argument filled must be 3-dimensional")
+ size = np.array(filled.shape, dtype=np.intp)
+
+ # check xyz coordinates, which are one larger than the filled shape
+ coord_shape = tuple(size + 1)
+ if xyz is None:
+ x, y, z = np.indices(coord_shape)
+ else:
+ x, y, z = (np.broadcast_to(c, coord_shape) for c in xyz)
+
+ def _broadcast_color_arg(color, name):
+ if np.ndim(color) in (0, 1):
+ # single color, like "red" or [1, 0, 0]
+ return np.broadcast_to(color, filled.shape + np.shape(color))
+ elif np.ndim(color) in (3, 4):
+ # 3D array of strings, or 4D array with last axis rgb
+ if np.shape(color)[:3] != filled.shape:
+ raise ValueError(
+ "When multidimensional, {} must match the shape of "
+ "filled".format(name))
+ return color
+ else:
+ raise ValueError("Invalid {} argument".format(name))
+
+ # broadcast and default on facecolors
+ if facecolors is None:
+ facecolors = self._get_patches_for_fill.get_next_color()
+ facecolors = _broadcast_color_arg(facecolors, 'facecolors')
+
+ # broadcast but no default on edgecolors
+ edgecolors = _broadcast_color_arg(edgecolors, 'edgecolors')
+
+ # scale to the full array, even if the data is only in the center
+ self.auto_scale_xyz(x, y, z)
+
+ # points lying on corners of a square
+ square = np.array([
+ [0, 0, 0],
+ [1, 0, 0],
+ [1, 1, 0],
+ [0, 1, 0],
+ ], dtype=np.intp)
+
+ voxel_faces = defaultdict(list)
+
+ def permutation_matrices(n):
+ """Generate cyclic permutation matrices."""
+ mat = np.eye(n, dtype=np.intp)
+ for i in range(n):
+ yield mat
+ mat = np.roll(mat, 1, axis=0)
+
+ # iterate over each of the YZ, ZX, and XY orientations, finding faces
+ # to render
+ for permute in permutation_matrices(3):
+ # find the set of ranges to iterate over
+ pc, qc, rc = permute.T.dot(size)
+ pinds = np.arange(pc)
+ qinds = np.arange(qc)
+ rinds = np.arange(rc)
+
+ square_rot_pos = square.dot(permute.T)
+ square_rot_neg = square_rot_pos[::-1]
+
+ # iterate within the current plane
+ for p in pinds:
+ for q in qinds:
+ # iterate perpendicularly to the current plane, handling
+ # boundaries. We only draw faces between a voxel and an
+ # empty space, to avoid drawing internal faces.
+
+ # draw lower faces
+ p0 = permute.dot([p, q, 0])
+ i0 = tuple(p0)
+ if filled[i0]:
+ voxel_faces[i0].append(p0 + square_rot_neg)
+
+ # draw middle faces
+ for r1, r2 in zip(rinds[:-1], rinds[1:]):
+ p1 = permute.dot([p, q, r1])
+ p2 = permute.dot([p, q, r2])
+
+ i1 = tuple(p1)
+ i2 = tuple(p2)
+
+ if filled[i1] and not filled[i2]:
+ voxel_faces[i1].append(p2 + square_rot_pos)
+ elif not filled[i1] and filled[i2]:
+ voxel_faces[i2].append(p2 + square_rot_neg)
+
+ # draw upper faces
+ pk = permute.dot([p, q, rc-1])
+ pk2 = permute.dot([p, q, rc])
+ ik = tuple(pk)
+ if filled[ik]:
+ voxel_faces[ik].append(pk2 + square_rot_pos)
+
+ # iterate over the faces, and generate a Poly3DCollection for each
+ # voxel
+ polygons = {}
+ for coord, faces_inds in voxel_faces.items():
+ # convert indices into 3D positions
+ if xyz is None:
+ faces = faces_inds
+ else:
+ faces = []
+ for face_inds in faces_inds:
+ ind = face_inds[:, 0], face_inds[:, 1], face_inds[:, 2]
+ face = np.empty(face_inds.shape)
+ face[:, 0] = x[ind]
+ face[:, 1] = y[ind]
+ face[:, 2] = z[ind]
+ faces.append(face)
+
+ # shade the faces
+ facecolor = facecolors[coord]
+ edgecolor = edgecolors[coord]
+ if shade:
+ normals = self._generate_normals(faces)
+ facecolor = self._shade_colors(facecolor, normals, lightsource)
+ if edgecolor is not None:
+ edgecolor = self._shade_colors(
+ edgecolor, normals, lightsource
+ )
+
+ poly = art3d.Poly3DCollection(
+ faces, facecolors=facecolor, edgecolors=edgecolor, **kwargs)
+ self.add_collection3d(poly)
+ polygons[coord] = poly
+
+ return polygons
+
+ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
+ barsabove=False, errorevery=1, ecolor=None, elinewidth=None,
+ capsize=None, capthick=None, xlolims=False, xuplims=False,
+ ylolims=False, yuplims=False, zlolims=False, zuplims=False,
+ **kwargs):
+ """
+ Plot lines and/or markers with errorbars around them.
+
+ *x*/*y*/*z* define the data locations, and *xerr*/*yerr*/*zerr* define
+ the errorbar sizes. By default, this draws the data markers/lines as
+ well the errorbars. Use fmt='none' to draw errorbars only.
+
+ Parameters
+ ----------
+ x, y, z : float or array-like
+ The data positions.
+
+ xerr, yerr, zerr : float or array-like, shape (N,) or (2, N), optional
+ The errorbar sizes:
+
+ - scalar: Symmetric +/- values for all data points.
+ - shape(N,): Symmetric +/-values for each data point.
+ - shape(2, N): Separate - and + values for each bar. First row
+ contains the lower errors, the second row contains the upper
+ errors.
+ - *None*: No errorbar.
+
+ Note that all error arrays should have *positive* values.
+
+ fmt : str, default: ''
+ The format for the data points / data lines. See `.plot` for
+ details.
+
+ Use 'none' (case insensitive) to plot errorbars without any data
+ markers.
+
+ ecolor : color, default: None
+ The color of the errorbar lines. If None, use the color of the
+ line connecting the markers.
+
+ elinewidth : float, default: None
+ The linewidth of the errorbar lines. If None, the linewidth of
+ the current style is used.
+
+ capsize : float, default: :rc:`errorbar.capsize`
+ The length of the error bar caps in points.
+
+ capthick : float, default: None
+ An alias to the keyword argument *markeredgewidth* (a.k.a. *mew*).
+ This setting is a more sensible name for the property that
+ controls the thickness of the error bar cap in points. For
+ backwards compatibility, if *mew* or *markeredgewidth* are given,
+ then they will over-ride *capthick*. This may change in future
+ releases.
+
+ barsabove : bool, default: False
+ If True, will plot the errorbars above the plot
+ symbols. Default is below.
+
+ xlolims, ylolims, zlolims : bool, default: False
+ These arguments can be used to indicate that a value gives only
+ lower limits. In that case a caret symbol is used to indicate
+ this. *lims*-arguments may be scalars, or array-likes of the same
+ length as the errors. To use limits with inverted axes,
+ `~.Axes.set_xlim` or `~.Axes.set_ylim` must be called before
+ :meth:`errorbar`. Note the tricky parameter names: setting e.g.
+ *ylolims* to True means that the y-value is a *lower* limit of the
+ True value, so, only an *upward*-pointing arrow will be drawn!
+
+ xuplims, yuplims, zuplims : bool, default: False
+ Same as above, but for controlling the upper limits.
+
+ errorevery : int or (int, int), default: 1
+ draws error bars on a subset of the data. *errorevery* =N draws
+ error bars on the points (x[::N], y[::N], z[::N]).
+ *errorevery* =(start, N) draws error bars on the points
+ (x[start::N], y[start::N], z[start::N]). e.g. errorevery=(6, 3)
+ adds error bars to the data at (x[6], x[9], x[12], x[15], ...).
+ Used to avoid overlapping error bars when two series share x-axis
+ values.
+
+ Returns
+ -------
+ errlines : list
+ List of `~mpl_toolkits.mplot3d.art3d.Line3DCollection` instances
+ each containing an errorbar line.
+ caplines : list
+ List of `~mpl_toolkits.mplot3d.art3d.Line3D` instances each
+ containing a capline object.
+ limmarks : list
+ List of `~mpl_toolkits.mplot3d.art3d.Line3D` instances each
+ containing a marker with an upper or lower limit.
+
+ Other Parameters
+ ----------------
+ **kwargs
+ All other keyword arguments for styling errorbar lines are passed
+ `~mpl_toolkits.mplot3d.art3d.Line3DCollection`.
+
+ Examples
+ --------
+ .. plot:: gallery/mplot3d/errorbar3d.py
+ """
+ had_data = self.has_data()
+
+ kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
+ # anything that comes in as 'None', drop so the default thing
+ # happens down stream
+ kwargs = {k: v for k, v in kwargs.items() if v is not None}
+ kwargs.setdefault('zorder', 2)
+
+ self._process_unit_info([("x", x), ("y", y), ("z", z)], kwargs,
+ convert=False)
+
+ # make sure all the args are iterable; use lists not arrays to
+ # preserve units
+ x = x if np.iterable(x) else [x]
+ y = y if np.iterable(y) else [y]
+ z = z if np.iterable(z) else [z]
+
+ if not len(x) == len(y) == len(z):
+ raise ValueError("'x', 'y', and 'z' must have the same size")
+
+ if isinstance(errorevery, Integral):
+ errorevery = (0, errorevery)
+ if isinstance(errorevery, tuple):
+ if (len(errorevery) == 2 and
+ isinstance(errorevery[0], Integral) and
+ isinstance(errorevery[1], Integral)):
+ errorevery = slice(errorevery[0], None, errorevery[1])
+ else:
+ raise ValueError(
+ f'errorevery={errorevery!r} is a not a tuple of two '
+ f'integers')
+
+ elif isinstance(errorevery, slice):
+ pass
+
+ elif not isinstance(errorevery, str) and np.iterable(errorevery):
+ # fancy indexing
+ try:
+ x[errorevery]
+ except (ValueError, IndexError) as err:
+ raise ValueError(
+ f"errorevery={errorevery!r} is iterable but not a valid "
+ f"NumPy fancy index to match "
+ f"'xerr'/'yerr'/'zerr'") from err
+ else:
+ raise ValueError(
+ f"errorevery={errorevery!r} is not a recognized value")
+
+ label = kwargs.pop("label", None)
+ kwargs['label'] = '_nolegend_'
+
+ # Create the main line and determine overall kwargs for child artists.
+ # We avoid calling self.plot() directly, or self._get_lines(), because
+ # that would call self._process_unit_info again, and do other indirect
+ # data processing.
+ (data_line, base_style), = self._get_lines._plot_args(
+ (x, y) if fmt == '' else (x, y, fmt), kwargs, return_kwargs=True)
+ art3d.line_2d_to_3d(data_line, zs=z)
+
+ # Do this after creating `data_line` to avoid modifying `base_style`.
+ if barsabove:
+ data_line.set_zorder(kwargs['zorder'] - .1)
+ else:
+ data_line.set_zorder(kwargs['zorder'] + .1)
+
+ # Add line to plot, or throw it away and use it to determine kwargs.
+ if fmt.lower() != 'none':
+ self.add_line(data_line)
+ else:
+ data_line = None
+ # Remove alpha=0 color that _process_plot_format returns.
+ base_style.pop('color')
+
+ if 'color' not in base_style:
+ base_style['color'] = 'C0'
+ if ecolor is None:
+ ecolor = base_style['color']
+
+ # Eject any line-specific information from format string, as it's not
+ # needed for bars or caps.
+ for key in ['marker', 'markersize', 'markerfacecolor',
+ 'markeredgewidth', 'markeredgecolor', 'markevery',
+ 'linestyle', 'fillstyle', 'drawstyle', 'dash_capstyle',
+ 'dash_joinstyle', 'solid_capstyle', 'solid_joinstyle']:
+ base_style.pop(key, None)
+
+ # Make the style dict for the line collections (the bars).
+ eb_lines_style = {**base_style, 'color': ecolor}
+
+ if elinewidth:
+ eb_lines_style['linewidth'] = elinewidth
+ elif 'linewidth' in kwargs:
+ eb_lines_style['linewidth'] = kwargs['linewidth']
+
+ for key in ('transform', 'alpha', 'zorder', 'rasterized'):
+ if key in kwargs:
+ eb_lines_style[key] = kwargs[key]
+
+ # Make the style dict for caps (the "hats").
+ eb_cap_style = {**base_style, 'linestyle': 'None'}
+ if capsize is None:
+ capsize = rcParams["errorbar.capsize"]
+ if capsize > 0:
+ eb_cap_style['markersize'] = 2. * capsize
+ if capthick is not None:
+ eb_cap_style['markeredgewidth'] = capthick
+ eb_cap_style['color'] = ecolor
+
+ everymask = np.zeros(len(x), bool)
+ everymask[errorevery] = True
+
+ def _apply_mask(arrays, mask):
+ # Return, for each array in *arrays*, the elements for which *mask*
+ # is True, without using fancy indexing.
+ return [[*itertools.compress(array, mask)] for array in arrays]
+
+ def _extract_errs(err, data, lomask, himask):
+ # For separate +/- error values we need to unpack err
+ if len(err.shape) == 2:
+ low_err, high_err = err
+ else:
+ low_err, high_err = err, err
+
+ lows = np.where(lomask | ~everymask, data, data - low_err)
+ highs = np.where(himask | ~everymask, data, data + high_err)
+
+ return lows, highs
+
+ # collect drawn items while looping over the three coordinates
+ errlines, caplines, limmarks = [], [], []
+
+ # list of endpoint coordinates, used for auto-scaling
+ coorderrs = []
+
+ # define the markers used for errorbar caps and limits below
+ # the dictionary key is mapped by the `i_xyz` helper dictionary
+ capmarker = {0: '|', 1: '|', 2: '_'}
+ i_xyz = {'x': 0, 'y': 1, 'z': 2}
+
+ # Calculate marker size from points to quiver length. Because these are
+ # not markers, and 3D Axes do not use the normal transform stack, this
+ # is a bit involved. Since the quiver arrows will change size as the
+ # scene is rotated, they are given a standard size based on viewing
+ # them directly in planar form.
+ quiversize = eb_cap_style.get('markersize',
+ rcParams['lines.markersize']) ** 2
+ quiversize *= self.figure.dpi / 72
+ quiversize = self.transAxes.inverted().transform([
+ (0, 0), (quiversize, quiversize)])
+ quiversize = np.mean(np.diff(quiversize, axis=0))
+ # quiversize is now in Axes coordinates, and to convert back to data
+ # coordinates, we need to run it through the inverse 3D transform. For
+ # consistency, this uses a fixed azimuth and elevation.
+ with cbook._setattr_cm(self, azim=0, elev=0):
+ invM = np.linalg.inv(self.get_proj())
+ # azim=elev=0 produces the Y-Z plane, so quiversize in 2D 'x' is 'y' in
+ # 3D, hence the 1 index.
+ quiversize = np.dot(invM, np.array([quiversize, 0, 0, 0]))[1]
+ # Quivers use a fixed 15-degree arrow head, so scale up the length so
+ # that the size corresponds to the base. In other words, this constant
+ # corresponds to the equation tan(15) = (base / 2) / (arrow length).
+ quiversize *= 1.8660254037844388
+ eb_quiver_style = {**eb_cap_style,
+ 'length': quiversize, 'arrow_length_ratio': 1}
+ eb_quiver_style.pop('markersize', None)
+
+ # loop over x-, y-, and z-direction and draw relevant elements
+ for zdir, data, err, lolims, uplims in zip(
+ ['x', 'y', 'z'], [x, y, z], [xerr, yerr, zerr],
+ [xlolims, ylolims, zlolims], [xuplims, yuplims, zuplims]):
+
+ dir_vector = art3d.get_dir_vector(zdir)
+ i_zdir = i_xyz[zdir]
+
+ if err is None:
+ continue
+
+ if not np.iterable(err):
+ err = [err] * len(data)
+
+ err = np.atleast_1d(err)
+
+ # arrays fine here, they are booleans and hence not units
+ lolims = np.broadcast_to(lolims, len(data)).astype(bool)
+ uplims = np.broadcast_to(uplims, len(data)).astype(bool)
+
+ # a nested list structure that expands to (xl,xh),(yl,yh),(zl,zh),
+ # where x/y/z and l/h correspond to dimensions and low/high
+ # positions of errorbars in a dimension we're looping over
+ coorderr = [
+ _extract_errs(err * dir_vector[i], coord, lolims, uplims)
+ for i, coord in enumerate([x, y, z])]
+ (xl, xh), (yl, yh), (zl, zh) = coorderr
+
+ # draws capmarkers - flat caps orthogonal to the error bars
+ nolims = ~(lolims | uplims)
+ if nolims.any() and capsize > 0:
+ lo_caps_xyz = _apply_mask([xl, yl, zl], nolims & everymask)
+ hi_caps_xyz = _apply_mask([xh, yh, zh], nolims & everymask)
+
+ # setting '_' for z-caps and '|' for x- and y-caps;
+ # these markers will rotate as the viewing angle changes
+ cap_lo = art3d.Line3D(*lo_caps_xyz, ls='',
+ marker=capmarker[i_zdir],
+ **eb_cap_style)
+ cap_hi = art3d.Line3D(*hi_caps_xyz, ls='',
+ marker=capmarker[i_zdir],
+ **eb_cap_style)
+ self.add_line(cap_lo)
+ self.add_line(cap_hi)
+ caplines.append(cap_lo)
+ caplines.append(cap_hi)
+
+ if lolims.any():
+ xh0, yh0, zh0 = _apply_mask([xh, yh, zh], lolims & everymask)
+ self.quiver(xh0, yh0, zh0, *dir_vector, **eb_quiver_style)
+ if uplims.any():
+ xl0, yl0, zl0 = _apply_mask([xl, yl, zl], uplims & everymask)
+ self.quiver(xl0, yl0, zl0, *-dir_vector, **eb_quiver_style)
+
+ errline = art3d.Line3DCollection(np.array(coorderr).T,
+ **eb_lines_style)
+ self.add_collection(errline)
+ errlines.append(errline)
+ coorderrs.append(coorderr)
+
+ coorderrs = np.array(coorderrs)
+
+ def _digout_minmax(err_arr, coord_label):
+ return (np.nanmin(err_arr[:, i_xyz[coord_label], :, :]),
+ np.nanmax(err_arr[:, i_xyz[coord_label], :, :]))
+
+ minx, maxx = _digout_minmax(coorderrs, 'x')
+ miny, maxy = _digout_minmax(coorderrs, 'y')
+ minz, maxz = _digout_minmax(coorderrs, 'z')
+ self.auto_scale_xyz((minx, maxx), (miny, maxy), (minz, maxz), had_data)
+
+ # Adapting errorbar containers for 3d case, assuming z-axis points "up"
+ errorbar_container = mcontainer.ErrorbarContainer(
+ (data_line, tuple(caplines), tuple(errlines)),
+ has_xerr=(xerr is not None or yerr is not None),
+ has_yerr=(zerr is not None),
+ label=label)
+ self.containers.append(errorbar_container)
+
+ return errlines, caplines, limmarks
+
+ def get_tightbbox(self, renderer, call_axes_locator=True,
+ bbox_extra_artists=None, *, for_layout_only=False):
+ ret = super().get_tightbbox(renderer,
+ call_axes_locator=call_axes_locator,
+ bbox_extra_artists=bbox_extra_artists,
+ for_layout_only=for_layout_only)
+ batch = [ret]
+ if self._axis3don:
+ for axis in self._get_axis_list():
+ if axis.get_visible():
+ try:
+ axis_bb = axis.get_tightbbox(
+ renderer,
+ for_layout_only=for_layout_only
+ )
+ except TypeError:
+ # in case downstream library has redefined axis:
+ axis_bb = axis.get_tightbbox(renderer)
+ if axis_bb:
+ batch.append(axis_bb)
+ return mtransforms.Bbox.union(batch)
+
+ def stem(self, x, y, z, *, linefmt='C0-', markerfmt='C0o', basefmt='C3-',
+ bottom=0, label=None, orientation='z'):
+ """
+ Create a 3D stem plot.
+
+ A stem plot draws lines perpendicular to a baseline, and places markers
+ at the heads. By default, the baseline is defined by *x* and *y*, and
+ stems are drawn vertically from *bottom* to *z*.
+
+ Parameters
+ ----------
+ x, y, z : array-like
+ The positions of the heads of the stems. The stems are drawn along
+ the *orientation*-direction from the baseline at *bottom* (in the
+ *orientation*-coordinate) to the heads. By default, the *x* and *y*
+ positions are used for the baseline and *z* for the head position,
+ but this can be changed by *orientation*.
+
+ linefmt : str, default: 'C0-'
+ A string defining the properties of the vertical lines. Usually,
+ this will be a color or a color and a linestyle:
+
+ ========= =============
+ Character Line Style
+ ========= =============
+ ``'-'`` solid line
+ ``'--'`` dashed line
+ ``'-.'`` dash-dot line
+ ``':'`` dotted line
+ ========= =============
+
+ Note: While it is technically possible to specify valid formats
+ other than color or color and linestyle (e.g. 'rx' or '-.'), this
+ is beyond the intention of the method and will most likely not
+ result in a reasonable plot.
+
+ markerfmt : str, default: 'C0o'
+ A string defining the properties of the markers at the stem heads.
+
+ basefmt : str, default: 'C3-'
+ A format string defining the properties of the baseline.
+
+ bottom : float, default: 0
+ The position of the baseline, in *orientation*-coordinates.
+
+ label : str, default: None
+ The label to use for the stems in legends.
+
+ orientation : {'x', 'y', 'z'}, default: 'z'
+ The direction along which stems are drawn.
+
+ Returns
+ -------
+ `.StemContainer`
+ The container may be treated like a tuple
+ (*markerline*, *stemlines*, *baseline*)
+
+ Examples
+ --------
+ .. plot:: gallery/mplot3d/stem3d_demo.py
+ """
+
+ from matplotlib.container import StemContainer
+
+ had_data = self.has_data()
+
+ _api.check_in_list(['x', 'y', 'z'], orientation=orientation)
+
+ xlim = (np.min(x), np.max(x))
+ ylim = (np.min(y), np.max(y))
+ zlim = (np.min(z), np.max(z))
+
+ # Determine the appropriate plane for the baseline and the direction of
+ # stemlines based on the value of orientation.
+ if orientation == 'x':
+ basex, basexlim = y, ylim
+ basey, baseylim = z, zlim
+ lines = [[(bottom, thisy, thisz), (thisx, thisy, thisz)]
+ for thisx, thisy, thisz in zip(x, y, z)]
+ elif orientation == 'y':
+ basex, basexlim = x, xlim
+ basey, baseylim = z, zlim
+ lines = [[(thisx, bottom, thisz), (thisx, thisy, thisz)]
+ for thisx, thisy, thisz in zip(x, y, z)]
+ else:
+ basex, basexlim = x, xlim
+ basey, baseylim = y, ylim
+ lines = [[(thisx, thisy, bottom), (thisx, thisy, thisz)]
+ for thisx, thisy, thisz in zip(x, y, z)]
+
+ # Determine style for stem lines.
+ linestyle, linemarker, linecolor = _process_plot_format(linefmt)
+ if linestyle is None:
+ linestyle = rcParams['lines.linestyle']
+
+ # Plot everything in required order.
+ baseline, = self.plot(basex, basey, basefmt, zs=bottom,
+ zdir=orientation, label='_nolegend_')
+ stemlines = art3d.Line3DCollection(
+ lines, linestyles=linestyle, colors=linecolor, label='_nolegend_')
+ self.add_collection(stemlines)
+ markerline, = self.plot(x, y, z, markerfmt, label='_nolegend_')
+
+ stem_container = StemContainer((markerline, stemlines, baseline),
+ label=label)
+ self.add_container(stem_container)
+
+ jx, jy, jz = art3d.juggle_axes(basexlim, baseylim, [bottom, bottom],
+ orientation)
+ self.auto_scale_xyz([*jx, *xlim], [*jy, *ylim], [*jz, *zlim], had_data)
+
+ return stem_container
+
+ stem3D = stem
+
+docstring.interpd.update(Axes3D_kwdoc=artist.kwdoc(Axes3D))
+docstring.dedent_interpd(Axes3D.__init__)
+
+
+def get_test_data(delta=0.05):
+ """Return a tuple X, Y, Z with a test data set."""
+ x = y = np.arange(-3.0, 3.0, delta)
+ X, Y = np.meshgrid(x, y)
+
+ Z1 = np.exp(-(X**2 + Y**2) / 2) / (2 * np.pi)
+ Z2 = (np.exp(-(((X - 1) / 1.5)**2 + ((Y - 1) / 0.5)**2) / 2) /
+ (2 * np.pi * 0.5 * 1.5))
+ Z = Z2 - Z1
+
+ X = X * 10
+ Y = Y * 10
+ Z = Z * 500
+ return X, Y, Z
diff --git a/venv/Lib/site-packages/mpl_toolkits/mplot3d/axis3d.py b/venv/Lib/site-packages/mpl_toolkits/mplot3d/axis3d.py
new file mode 100644
index 0000000..e024104
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/mplot3d/axis3d.py
@@ -0,0 +1,489 @@
+# axis3d.py, original mplot3d version by John Porter
+# Created: 23 Sep 2005
+# Parts rewritten by Reinier Heeres
+
+import numpy as np
+
+import matplotlib.transforms as mtransforms
+from matplotlib import (
+ artist, lines as mlines, axis as maxis, patches as mpatches, rcParams)
+from . import art3d, proj3d
+
+
+def move_from_center(coord, centers, deltas, axmask=(True, True, True)):
+ """
+ For each coordinate where *axmask* is True, move *coord* away from
+ *centers* by *deltas*.
+ """
+ coord = np.asarray(coord)
+ return coord + axmask * np.copysign(1, coord - centers) * deltas
+
+
+def tick_update_position(tick, tickxs, tickys, labelpos):
+ """Update tick line and label position and style."""
+
+ tick.label1.set_position(labelpos)
+ tick.label2.set_position(labelpos)
+ tick.tick1line.set_visible(True)
+ tick.tick2line.set_visible(False)
+ tick.tick1line.set_linestyle('-')
+ tick.tick1line.set_marker('')
+ tick.tick1line.set_data(tickxs, tickys)
+ tick.gridline.set_data(0, 0)
+
+
+class Axis(maxis.XAxis):
+ """An Axis class for the 3D plots."""
+ # These points from the unit cube make up the x, y and z-planes
+ _PLANES = (
+ (0, 3, 7, 4), (1, 2, 6, 5), # yz planes
+ (0, 1, 5, 4), (3, 2, 6, 7), # xz planes
+ (0, 1, 2, 3), (4, 5, 6, 7), # xy planes
+ )
+
+ # Some properties for the axes
+ _AXINFO = {
+ 'x': {'i': 0, 'tickdir': 1, 'juggled': (1, 0, 2),
+ 'color': (0.95, 0.95, 0.95, 0.5)},
+ 'y': {'i': 1, 'tickdir': 0, 'juggled': (0, 1, 2),
+ 'color': (0.90, 0.90, 0.90, 0.5)},
+ 'z': {'i': 2, 'tickdir': 0, 'juggled': (0, 2, 1),
+ 'color': (0.925, 0.925, 0.925, 0.5)},
+ }
+
+ def __init__(self, adir, v_intervalx, d_intervalx, axes, *args,
+ rotate_label=None, **kwargs):
+ # adir identifies which axes this is
+ self.adir = adir
+
+ # This is a temporary member variable.
+ # Do not depend on this existing in future releases!
+ self._axinfo = self._AXINFO[adir].copy()
+ if rcParams['_internal.classic_mode']:
+ self._axinfo.update({
+ 'label': {'va': 'center', 'ha': 'center'},
+ 'tick': {
+ 'inward_factor': 0.2,
+ 'outward_factor': 0.1,
+ 'linewidth': {
+ True: rcParams['lines.linewidth'], # major
+ False: rcParams['lines.linewidth'], # minor
+ }
+ },
+ 'axisline': {'linewidth': 0.75, 'color': (0, 0, 0, 1)},
+ 'grid': {
+ 'color': (0.9, 0.9, 0.9, 1),
+ 'linewidth': 1.0,
+ 'linestyle': '-',
+ },
+ })
+ else:
+ self._axinfo.update({
+ 'label': {'va': 'center', 'ha': 'center'},
+ 'tick': {
+ 'inward_factor': 0.2,
+ 'outward_factor': 0.1,
+ 'linewidth': {
+ True: ( # major
+ rcParams['xtick.major.width'] if adir in 'xz' else
+ rcParams['ytick.major.width']),
+ False: ( # minor
+ rcParams['xtick.minor.width'] if adir in 'xz' else
+ rcParams['ytick.minor.width']),
+ }
+ },
+ 'axisline': {
+ 'linewidth': rcParams['axes.linewidth'],
+ 'color': rcParams['axes.edgecolor'],
+ },
+ 'grid': {
+ 'color': rcParams['grid.color'],
+ 'linewidth': rcParams['grid.linewidth'],
+ 'linestyle': rcParams['grid.linestyle'],
+ },
+ })
+
+ super().__init__(axes, *args, **kwargs)
+
+ # data and viewing intervals for this direction
+ self.d_interval = d_intervalx
+ self.v_interval = v_intervalx
+ self.set_rotate_label(rotate_label)
+
+ def init3d(self):
+ self.line = mlines.Line2D(
+ xdata=(0, 0), ydata=(0, 0),
+ linewidth=self._axinfo['axisline']['linewidth'],
+ color=self._axinfo['axisline']['color'],
+ antialiased=True)
+
+ # Store dummy data in Polygon object
+ self.pane = mpatches.Polygon(
+ np.array([[0, 0], [0, 1], [1, 0], [0, 0]]),
+ closed=False, alpha=0.8, facecolor='k', edgecolor='k')
+ self.set_pane_color(self._axinfo['color'])
+
+ self.axes._set_artist_props(self.line)
+ self.axes._set_artist_props(self.pane)
+ self.gridlines = art3d.Line3DCollection([])
+ self.axes._set_artist_props(self.gridlines)
+ self.axes._set_artist_props(self.label)
+ self.axes._set_artist_props(self.offsetText)
+ # Need to be able to place the label at the correct location
+ self.label._transform = self.axes.transData
+ self.offsetText._transform = self.axes.transData
+
+ def get_major_ticks(self, numticks=None):
+ ticks = super().get_major_ticks(numticks)
+ for t in ticks:
+ for obj in [
+ t.tick1line, t.tick2line, t.gridline, t.label1, t.label2]:
+ obj.set_transform(self.axes.transData)
+ return ticks
+
+ def get_minor_ticks(self, numticks=None):
+ ticks = super().get_minor_ticks(numticks)
+ for t in ticks:
+ for obj in [
+ t.tick1line, t.tick2line, t.gridline, t.label1, t.label2]:
+ obj.set_transform(self.axes.transData)
+ return ticks
+
+ def set_pane_pos(self, xys):
+ xys = np.asarray(xys)
+ xys = xys[:, :2]
+ self.pane.xy = xys
+ self.stale = True
+
+ def set_pane_color(self, color):
+ """Set pane color to a RGBA tuple."""
+ self._axinfo['color'] = color
+ self.pane.set_edgecolor(color)
+ self.pane.set_facecolor(color)
+ self.pane.set_alpha(color[-1])
+ self.stale = True
+
+ def set_rotate_label(self, val):
+ """
+ Whether to rotate the axis label: True, False or None.
+ If set to None the label will be rotated if longer than 4 chars.
+ """
+ self._rotate_label = val
+ self.stale = True
+
+ def get_rotate_label(self, text):
+ if self._rotate_label is not None:
+ return self._rotate_label
+ else:
+ return len(text) > 4
+
+ def _get_coord_info(self, renderer):
+ mins, maxs = np.array([
+ self.axes.get_xbound(),
+ self.axes.get_ybound(),
+ self.axes.get_zbound(),
+ ]).T
+ centers = (maxs + mins) / 2.
+ deltas = (maxs - mins) / 12.
+ mins = mins - deltas / 4.
+ maxs = maxs + deltas / 4.
+
+ vals = mins[0], maxs[0], mins[1], maxs[1], mins[2], maxs[2]
+ tc = self.axes.tunit_cube(vals, self.axes.M)
+ avgz = [tc[p1][2] + tc[p2][2] + tc[p3][2] + tc[p4][2]
+ for p1, p2, p3, p4 in self._PLANES]
+ highs = np.array([avgz[2*i] < avgz[2*i+1] for i in range(3)])
+
+ return mins, maxs, centers, deltas, tc, highs
+
+ def draw_pane(self, renderer):
+ renderer.open_group('pane3d', gid=self.get_gid())
+
+ mins, maxs, centers, deltas, tc, highs = self._get_coord_info(renderer)
+
+ info = self._axinfo
+ index = info['i']
+ if not highs[index]:
+ plane = self._PLANES[2 * index]
+ else:
+ plane = self._PLANES[2 * index + 1]
+ xys = [tc[p] for p in plane]
+ self.set_pane_pos(xys)
+ self.pane.draw(renderer)
+
+ renderer.close_group('pane3d')
+
+ @artist.allow_rasterization
+ def draw(self, renderer):
+ self.label._transform = self.axes.transData
+ renderer.open_group('axis3d', gid=self.get_gid())
+
+ ticks = self._update_ticks()
+
+ info = self._axinfo
+ index = info['i']
+
+ mins, maxs, centers, deltas, tc, highs = self._get_coord_info(renderer)
+
+ # Determine grid lines
+ minmax = np.where(highs, maxs, mins)
+ maxmin = np.where(highs, mins, maxs)
+
+ # Draw main axis line
+ juggled = info['juggled']
+ edgep1 = minmax.copy()
+ edgep1[juggled[0]] = maxmin[juggled[0]]
+
+ edgep2 = edgep1.copy()
+ edgep2[juggled[1]] = maxmin[juggled[1]]
+ pep = np.asarray(
+ proj3d.proj_trans_points([edgep1, edgep2], self.axes.M))
+ centpt = proj3d.proj_transform(*centers, self.axes.M)
+ self.line.set_data(pep[0], pep[1])
+ self.line.draw(renderer)
+
+ # Grid points where the planes meet
+ xyz0 = np.tile(minmax, (len(ticks), 1))
+ xyz0[:, index] = [tick.get_loc() for tick in ticks]
+
+ # Draw labels
+ # The transAxes transform is used because the Text object
+ # rotates the text relative to the display coordinate system.
+ # Therefore, if we want the labels to remain parallel to the
+ # axis regardless of the aspect ratio, we need to convert the
+ # edge points of the plane to display coordinates and calculate
+ # an angle from that.
+ # TODO: Maybe Text objects should handle this themselves?
+ dx, dy = (self.axes.transAxes.transform([pep[0:2, 1]]) -
+ self.axes.transAxes.transform([pep[0:2, 0]]))[0]
+
+ lxyz = 0.5 * (edgep1 + edgep2)
+
+ # A rough estimate; points are ambiguous since 3D plots rotate
+ reltoinches = self.figure.dpi_scale_trans.inverted()
+ ax_inches = reltoinches.transform(self.axes.bbox.size)
+ ax_points_estimate = sum(72. * ax_inches)
+ deltas_per_point = 48 / ax_points_estimate
+ default_offset = 21.
+ labeldeltas = (
+ (self.labelpad + default_offset) * deltas_per_point * deltas)
+ axmask = [True, True, True]
+ axmask[index] = False
+ lxyz = move_from_center(lxyz, centers, labeldeltas, axmask)
+ tlx, tly, tlz = proj3d.proj_transform(*lxyz, self.axes.M)
+ self.label.set_position((tlx, tly))
+ if self.get_rotate_label(self.label.get_text()):
+ angle = art3d._norm_text_angle(np.rad2deg(np.arctan2(dy, dx)))
+ self.label.set_rotation(angle)
+ self.label.set_va(info['label']['va'])
+ self.label.set_ha(info['label']['ha'])
+ self.label.draw(renderer)
+
+ # Draw Offset text
+
+ # Which of the two edge points do we want to
+ # use for locating the offset text?
+ if juggled[2] == 2:
+ outeredgep = edgep1
+ outerindex = 0
+ else:
+ outeredgep = edgep2
+ outerindex = 1
+
+ pos = move_from_center(outeredgep, centers, labeldeltas, axmask)
+ olx, oly, olz = proj3d.proj_transform(*pos, self.axes.M)
+ self.offsetText.set_text(self.major.formatter.get_offset())
+ self.offsetText.set_position((olx, oly))
+ angle = art3d._norm_text_angle(np.rad2deg(np.arctan2(dy, dx)))
+ self.offsetText.set_rotation(angle)
+ # Must set rotation mode to "anchor" so that
+ # the alignment point is used as the "fulcrum" for rotation.
+ self.offsetText.set_rotation_mode('anchor')
+
+ #----------------------------------------------------------------------
+ # Note: the following statement for determining the proper alignment of
+ # the offset text. This was determined entirely by trial-and-error
+ # and should not be in any way considered as "the way". There are
+ # still some edge cases where alignment is not quite right, but this
+ # seems to be more of a geometry issue (in other words, I might be
+ # using the wrong reference points).
+ #
+ # (TT, FF, TF, FT) are the shorthand for the tuple of
+ # (centpt[info['tickdir']] <= pep[info['tickdir'], outerindex],
+ # centpt[index] <= pep[index, outerindex])
+ #
+ # Three-letters (e.g., TFT, FTT) are short-hand for the array of bools
+ # from the variable 'highs'.
+ # ---------------------------------------------------------------------
+ if centpt[info['tickdir']] > pep[info['tickdir'], outerindex]:
+ # if FT and if highs has an even number of Trues
+ if (centpt[index] <= pep[index, outerindex]
+ and np.count_nonzero(highs) % 2 == 0):
+ # Usually, this means align right, except for the FTT case,
+ # in which offset for axis 1 and 2 are aligned left.
+ if highs.tolist() == [False, True, True] and index in (1, 2):
+ align = 'left'
+ else:
+ align = 'right'
+ else:
+ # The FF case
+ align = 'left'
+ else:
+ # if TF and if highs has an even number of Trues
+ if (centpt[index] > pep[index, outerindex]
+ and np.count_nonzero(highs) % 2 == 0):
+ # Usually mean align left, except if it is axis 2
+ if index == 2:
+ align = 'right'
+ else:
+ align = 'left'
+ else:
+ # The TT case
+ align = 'right'
+
+ self.offsetText.set_va('center')
+ self.offsetText.set_ha(align)
+ self.offsetText.draw(renderer)
+
+ if self.axes._draw_grid and len(ticks):
+ # Grid lines go from the end of one plane through the plane
+ # intersection (at xyz0) to the end of the other plane. The first
+ # point (0) differs along dimension index-2 and the last (2) along
+ # dimension index-1.
+ lines = np.stack([xyz0, xyz0, xyz0], axis=1)
+ lines[:, 0, index - 2] = maxmin[index - 2]
+ lines[:, 2, index - 1] = maxmin[index - 1]
+ self.gridlines.set_segments(lines)
+ self.gridlines.set_color(info['grid']['color'])
+ self.gridlines.set_linewidth(info['grid']['linewidth'])
+ self.gridlines.set_linestyle(info['grid']['linestyle'])
+ self.gridlines.do_3d_projection()
+ self.gridlines.draw(renderer)
+
+ # Draw ticks
+ tickdir = info['tickdir']
+ tickdelta = deltas[tickdir]
+ if highs[tickdir]:
+ ticksign = 1
+ else:
+ ticksign = -1
+
+ for tick in ticks:
+ # Get tick line positions
+ pos = edgep1.copy()
+ pos[index] = tick.get_loc()
+ pos[tickdir] = (
+ edgep1[tickdir]
+ + info['tick']['outward_factor'] * ticksign * tickdelta)
+ x1, y1, z1 = proj3d.proj_transform(*pos, self.axes.M)
+ pos[tickdir] = (
+ edgep1[tickdir]
+ - info['tick']['inward_factor'] * ticksign * tickdelta)
+ x2, y2, z2 = proj3d.proj_transform(*pos, self.axes.M)
+
+ # Get position of label
+ default_offset = 8. # A rough estimate
+ labeldeltas = (
+ (tick.get_pad() + default_offset) * deltas_per_point * deltas)
+
+ axmask = [True, True, True]
+ axmask[index] = False
+ pos[tickdir] = edgep1[tickdir]
+ pos = move_from_center(pos, centers, labeldeltas, axmask)
+ lx, ly, lz = proj3d.proj_transform(*pos, self.axes.M)
+
+ tick_update_position(tick, (x1, x2), (y1, y2), (lx, ly))
+ tick.tick1line.set_linewidth(
+ info['tick']['linewidth'][tick._major])
+ tick.draw(renderer)
+
+ renderer.close_group('axis3d')
+ self.stale = False
+
+ # TODO: Get this to work (more) properly when mplot3d supports the
+ # transforms framework.
+ def get_tightbbox(self, renderer, *, for_layout_only=False):
+ # inherited docstring
+ if not self.get_visible():
+ return
+ # We have to directly access the internal data structures
+ # (and hope they are up to date) because at draw time we
+ # shift the ticks and their labels around in (x, y) space
+ # based on the projection, the current view port, and their
+ # position in 3D space. If we extend the transforms framework
+ # into 3D we would not need to do this different book keeping
+ # than we do in the normal axis
+ major_locs = self.get_majorticklocs()
+ minor_locs = self.get_minorticklocs()
+
+ ticks = [*self.get_minor_ticks(len(minor_locs)),
+ *self.get_major_ticks(len(major_locs))]
+ view_low, view_high = self.get_view_interval()
+ if view_low > view_high:
+ view_low, view_high = view_high, view_low
+ interval_t = self.get_transform().transform([view_low, view_high])
+
+ ticks_to_draw = []
+ for tick in ticks:
+ try:
+ loc_t = self.get_transform().transform(tick.get_loc())
+ except AssertionError:
+ # Transform.transform doesn't allow masked values but
+ # some scales might make them, so we need this try/except.
+ pass
+ else:
+ if mtransforms._interval_contains_close(interval_t, loc_t):
+ ticks_to_draw.append(tick)
+
+ ticks = ticks_to_draw
+
+ bb_1, bb_2 = self._get_tick_bboxes(ticks, renderer)
+ other = []
+
+ if self.line.get_visible():
+ other.append(self.line.get_window_extent(renderer))
+ if (self.label.get_visible() and not for_layout_only and
+ self.label.get_text()):
+ other.append(self.label.get_window_extent(renderer))
+
+ return mtransforms.Bbox.union([*bb_1, *bb_2, *other])
+
+ @property
+ def d_interval(self):
+ return self.get_data_interval()
+
+ @d_interval.setter
+ def d_interval(self, minmax):
+ self.set_data_interval(*minmax)
+
+ @property
+ def v_interval(self):
+ return self.get_view_interval()
+
+ @v_interval.setter
+ def v_interval(self, minmax):
+ self.set_view_interval(*minmax)
+
+
+# Use classes to look at different data limits
+
+
+class XAxis(Axis):
+ get_view_interval, set_view_interval = maxis._make_getset_interval(
+ "view", "xy_viewLim", "intervalx")
+ get_data_interval, set_data_interval = maxis._make_getset_interval(
+ "data", "xy_dataLim", "intervalx")
+
+
+class YAxis(Axis):
+ get_view_interval, set_view_interval = maxis._make_getset_interval(
+ "view", "xy_viewLim", "intervaly")
+ get_data_interval, set_data_interval = maxis._make_getset_interval(
+ "data", "xy_dataLim", "intervaly")
+
+
+class ZAxis(Axis):
+ get_view_interval, set_view_interval = maxis._make_getset_interval(
+ "view", "zz_viewLim", "intervalx")
+ get_data_interval, set_data_interval = maxis._make_getset_interval(
+ "data", "zz_dataLim", "intervalx")
diff --git a/venv/Lib/site-packages/mpl_toolkits/mplot3d/proj3d.py b/venv/Lib/site-packages/mpl_toolkits/mplot3d/proj3d.py
new file mode 100644
index 0000000..cce89c5
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/mplot3d/proj3d.py
@@ -0,0 +1,175 @@
+"""
+Various transforms used for by the 3D code
+"""
+
+import numpy as np
+import numpy.linalg as linalg
+
+
+def _line2d_seg_dist(p1, p2, p0):
+ """
+ Return the distance(s) from line defined by p1 - p2 to point(s) p0.
+
+ p0[0] = x(s)
+ p0[1] = y(s)
+
+ intersection point p = p1 + u*(p2-p1)
+ and intersection point lies within segment if u is between 0 and 1
+ """
+
+ x21 = p2[0] - p1[0]
+ y21 = p2[1] - p1[1]
+ x01 = np.asarray(p0[0]) - p1[0]
+ y01 = np.asarray(p0[1]) - p1[1]
+
+ u = (x01*x21 + y01*y21) / (x21**2 + y21**2)
+ u = np.clip(u, 0, 1)
+ d = np.hypot(x01 - u*x21, y01 - u*y21)
+
+ return d
+
+
+def world_transformation(xmin, xmax,
+ ymin, ymax,
+ zmin, zmax, pb_aspect=None):
+ """
+ Produce a matrix that scales homogeneous coords in the specified ranges
+ to [0, 1], or [0, pb_aspect[i]] if the plotbox aspect ratio is specified.
+ """
+ dx = xmax - xmin
+ dy = ymax - ymin
+ dz = zmax - zmin
+ if pb_aspect is not None:
+ ax, ay, az = pb_aspect
+ dx /= ax
+ dy /= ay
+ dz /= az
+
+ return np.array([[1/dx, 0, 0, -xmin/dx],
+ [0, 1/dy, 0, -ymin/dy],
+ [0, 0, 1/dz, -zmin/dz],
+ [0, 0, 0, 1]])
+
+
+def view_transformation(E, R, V):
+ n = (E - R)
+ ## new
+# n /= np.linalg.norm(n)
+# u = np.cross(V, n)
+# u /= np.linalg.norm(u)
+# v = np.cross(n, u)
+# Mr = np.diag([1.] * 4)
+# Mt = np.diag([1.] * 4)
+# Mr[:3,:3] = u, v, n
+# Mt[:3,-1] = -E
+ ## end new
+
+ ## old
+ n = n / np.linalg.norm(n)
+ u = np.cross(V, n)
+ u = u / np.linalg.norm(u)
+ v = np.cross(n, u)
+ Mr = [[u[0], u[1], u[2], 0],
+ [v[0], v[1], v[2], 0],
+ [n[0], n[1], n[2], 0],
+ [0, 0, 0, 1]]
+ #
+ Mt = [[1, 0, 0, -E[0]],
+ [0, 1, 0, -E[1]],
+ [0, 0, 1, -E[2]],
+ [0, 0, 0, 1]]
+ ## end old
+
+ return np.dot(Mr, Mt)
+
+
+def persp_transformation(zfront, zback):
+ a = (zfront+zback)/(zfront-zback)
+ b = -2*(zfront*zback)/(zfront-zback)
+ return np.array([[1, 0, 0, 0],
+ [0, 1, 0, 0],
+ [0, 0, a, b],
+ [0, 0, -1, 0]])
+
+
+def ortho_transformation(zfront, zback):
+ # note: w component in the resulting vector will be (zback-zfront), not 1
+ a = -(zfront + zback)
+ b = -(zfront - zback)
+ return np.array([[2, 0, 0, 0],
+ [0, 2, 0, 0],
+ [0, 0, -2, 0],
+ [0, 0, a, b]])
+
+
+def _proj_transform_vec(vec, M):
+ vecw = np.dot(M, vec)
+ w = vecw[3]
+ # clip here..
+ txs, tys, tzs = vecw[0]/w, vecw[1]/w, vecw[2]/w
+ return txs, tys, tzs
+
+
+def _proj_transform_vec_clip(vec, M):
+ vecw = np.dot(M, vec)
+ w = vecw[3]
+ # clip here.
+ txs, tys, tzs = vecw[0] / w, vecw[1] / w, vecw[2] / w
+ tis = (0 <= vecw[0]) & (vecw[0] <= 1) & (0 <= vecw[1]) & (vecw[1] <= 1)
+ if np.any(tis):
+ tis = vecw[1] < 1
+ return txs, tys, tzs, tis
+
+
+def inv_transform(xs, ys, zs, M):
+ iM = linalg.inv(M)
+ vec = _vec_pad_ones(xs, ys, zs)
+ vecr = np.dot(iM, vec)
+ try:
+ vecr = vecr / vecr[3]
+ except OverflowError:
+ pass
+ return vecr[0], vecr[1], vecr[2]
+
+
+def _vec_pad_ones(xs, ys, zs):
+ return np.array([xs, ys, zs, np.ones_like(xs)])
+
+
+def proj_transform(xs, ys, zs, M):
+ """
+ Transform the points by the projection matrix
+ """
+ vec = _vec_pad_ones(xs, ys, zs)
+ return _proj_transform_vec(vec, M)
+
+
+transform = proj_transform
+
+
+def proj_transform_clip(xs, ys, zs, M):
+ """
+ Transform the points by the projection matrix
+ and return the clipping result
+ returns txs, tys, tzs, tis
+ """
+ vec = _vec_pad_ones(xs, ys, zs)
+ return _proj_transform_vec_clip(vec, M)
+
+
+def proj_points(points, M):
+ return np.column_stack(proj_trans_points(points, M))
+
+
+def proj_trans_points(points, M):
+ xs, ys, zs = zip(*points)
+ return proj_transform(xs, ys, zs, M)
+
+
+def rot_x(V, alpha):
+ cosa, sina = np.cos(alpha), np.sin(alpha)
+ M1 = np.array([[1, 0, 0, 0],
+ [0, cosa, -sina, 0],
+ [0, sina, cosa, 0],
+ [0, 0, 0, 1]])
+ return np.dot(M1, V)
diff --git a/venv/Lib/site-packages/mpl_toolkits/tests/__init__.py b/venv/Lib/site-packages/mpl_toolkits/tests/__init__.py
new file mode 100644
index 0000000..5b6390f
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/tests/__init__.py
@@ -0,0 +1,10 @@
+from pathlib import Path
+
+
+# Check that the test directories exist
+if not (Path(__file__).parent / "baseline_images").exists():
+ raise IOError(
+ 'The baseline image directory does not exist. '
+ 'This is most likely because the test data is not installed. '
+ 'You may need to install matplotlib from source to get the '
+ 'test data.')
diff --git a/venv/Lib/site-packages/mpl_toolkits/tests/conftest.py b/venv/Lib/site-packages/mpl_toolkits/tests/conftest.py
new file mode 100644
index 0000000..81829c9
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/tests/conftest.py
@@ -0,0 +1,3 @@
+from matplotlib.testing.conftest import (mpl_test_settings,
+ mpl_image_comparison_parameters,
+ pytest_configure, pytest_unconfigure)
diff --git a/venv/Lib/site-packages/mpl_toolkits/tests/test_axes_grid.py b/venv/Lib/site-packages/mpl_toolkits/tests/test_axes_grid.py
new file mode 100644
index 0000000..f789c31
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/tests/test_axes_grid.py
@@ -0,0 +1,57 @@
+import numpy as np
+
+import matplotlib as mpl
+from matplotlib.testing.decorators import image_comparison
+import matplotlib.pyplot as plt
+from mpl_toolkits.axes_grid1 import ImageGrid
+
+
+# The original version of this test relied on mpl_toolkits's slightly different
+# colorbar implementation; moving to matplotlib's own colorbar implementation
+# caused the small image comparison error.
+@image_comparison(['imagegrid_cbar_mode.png'],
+ remove_text=True, style='mpl20', tol=0.3)
+def test_imagegrid_cbar_mode_edge():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ X, Y = np.meshgrid(np.linspace(0, 6, 30), np.linspace(0, 6, 30))
+ arr = np.sin(X) * np.cos(Y) + 1j*(np.sin(3*Y) * np.cos(Y/2.))
+
+ fig = plt.figure(figsize=(18, 9))
+
+ positions = (241, 242, 243, 244, 245, 246, 247, 248)
+ directions = ['row']*4 + ['column']*4
+ cbar_locations = ['left', 'right', 'top', 'bottom']*2
+
+ for position, direction, location in zip(
+ positions, directions, cbar_locations):
+ grid = ImageGrid(fig, position,
+ nrows_ncols=(2, 2),
+ direction=direction,
+ cbar_location=location,
+ cbar_size='20%',
+ cbar_mode='edge')
+ ax1, ax2, ax3, ax4, = grid
+
+ ax1.imshow(arr.real, cmap='nipy_spectral')
+ ax2.imshow(arr.imag, cmap='hot')
+ ax3.imshow(np.abs(arr), cmap='jet')
+ ax4.imshow(np.arctan2(arr.imag, arr.real), cmap='hsv')
+
+ # In each row/column, the "first" colorbars must be overwritten by the
+ # "second" ones. To achieve this, clear out the axes first.
+ for ax in grid:
+ ax.cax.cla()
+ cb = ax.cax.colorbar(
+ ax.images[0],
+ ticks=mpl.ticker.MaxNLocator(5)) # old default locator.
+
+
+def test_imagegrid():
+ fig = plt.figure()
+ grid = ImageGrid(fig, 111, nrows_ncols=(1, 1))
+ ax = grid[0]
+ im = ax.imshow([[1, 2]], norm=mpl.colors.LogNorm())
+ cb = ax.cax.colorbar(im)
+ assert isinstance(cb.locator, mpl.colorbar._ColorbarLogLocator)
diff --git a/venv/Lib/site-packages/mpl_toolkits/tests/test_axes_grid1.py b/venv/Lib/site-packages/mpl_toolkits/tests/test_axes_grid1.py
new file mode 100644
index 0000000..0e1602e
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/tests/test_axes_grid1.py
@@ -0,0 +1,472 @@
+from itertools import product
+import platform
+
+import matplotlib
+import matplotlib.pyplot as plt
+from matplotlib import cbook
+from matplotlib.backend_bases import MouseEvent
+from matplotlib.colors import LogNorm
+from matplotlib.transforms import Bbox, TransformedBbox
+from matplotlib.testing.decorators import (
+ image_comparison, remove_ticks_and_titles)
+
+from mpl_toolkits.axes_grid1 import (
+ axes_size as Size, host_subplot, make_axes_locatable, AxesGrid, ImageGrid)
+from mpl_toolkits.axes_grid1.anchored_artists import (
+ AnchoredSizeBar, AnchoredDirectionArrows)
+from mpl_toolkits.axes_grid1.axes_divider import HBoxDivider
+from mpl_toolkits.axes_grid1.inset_locator import (
+ zoomed_inset_axes, mark_inset, inset_axes, BboxConnectorPatch)
+import mpl_toolkits.axes_grid1.mpl_axes
+
+import pytest
+
+import numpy as np
+from numpy.testing import assert_array_equal, assert_array_almost_equal
+
+
+def test_divider_append_axes():
+ fig, ax = plt.subplots()
+ divider = make_axes_locatable(ax)
+ axs = {
+ "main": ax,
+ "top": divider.append_axes("top", 1.2, pad=0.1, sharex=ax),
+ "bottom": divider.append_axes("bottom", 1.2, pad=0.1, sharex=ax),
+ "left": divider.append_axes("left", 1.2, pad=0.1, sharey=ax),
+ "right": divider.append_axes("right", 1.2, pad=0.1, sharey=ax),
+ }
+ fig.canvas.draw()
+ renderer = fig.canvas.get_renderer()
+ bboxes = {k: axs[k].get_window_extent() for k in axs}
+ dpi = fig.dpi
+ assert bboxes["top"].height == pytest.approx(1.2 * dpi)
+ assert bboxes["bottom"].height == pytest.approx(1.2 * dpi)
+ assert bboxes["left"].width == pytest.approx(1.2 * dpi)
+ assert bboxes["right"].width == pytest.approx(1.2 * dpi)
+ assert bboxes["top"].y0 - bboxes["main"].y1 == pytest.approx(0.1 * dpi)
+ assert bboxes["main"].y0 - bboxes["bottom"].y1 == pytest.approx(0.1 * dpi)
+ assert bboxes["main"].x0 - bboxes["left"].x1 == pytest.approx(0.1 * dpi)
+ assert bboxes["right"].x0 - bboxes["main"].x1 == pytest.approx(0.1 * dpi)
+ assert bboxes["left"].y0 == bboxes["main"].y0 == bboxes["right"].y0
+ assert bboxes["left"].y1 == bboxes["main"].y1 == bboxes["right"].y1
+ assert bboxes["top"].x0 == bboxes["main"].x0 == bboxes["bottom"].x0
+ assert bboxes["top"].x1 == bboxes["main"].x1 == bboxes["bottom"].x1
+
+
+@image_comparison(['twin_axes_empty_and_removed'], extensions=["png"], tol=1)
+def test_twin_axes_empty_and_removed():
+ # Purely cosmetic font changes (avoid overlap)
+ matplotlib.rcParams.update({"font.size": 8})
+ matplotlib.rcParams.update({"xtick.labelsize": 8})
+ matplotlib.rcParams.update({"ytick.labelsize": 8})
+ generators = ["twinx", "twiny", "twin"]
+ modifiers = ["", "host invisible", "twin removed", "twin invisible",
+ "twin removed\nhost invisible"]
+ # Unmodified host subplot at the beginning for reference
+ h = host_subplot(len(modifiers)+1, len(generators), 2)
+ h.text(0.5, 0.5, "host_subplot",
+ horizontalalignment="center", verticalalignment="center")
+ # Host subplots with various modifications (twin*, visibility) applied
+ for i, (mod, gen) in enumerate(product(modifiers, generators),
+ len(generators) + 1):
+ h = host_subplot(len(modifiers)+1, len(generators), i)
+ t = getattr(h, gen)()
+ if "twin invisible" in mod:
+ t.axis[:].set_visible(False)
+ if "twin removed" in mod:
+ t.remove()
+ if "host invisible" in mod:
+ h.axis[:].set_visible(False)
+ h.text(0.5, 0.5, gen + ("\n" + mod if mod else ""),
+ horizontalalignment="center", verticalalignment="center")
+ plt.subplots_adjust(wspace=0.5, hspace=1)
+
+
+def test_axesgrid_colorbar_log_smoketest():
+ fig = plt.figure()
+ grid = AxesGrid(fig, 111, # modified to be only subplot
+ nrows_ncols=(1, 1),
+ ngrids=1,
+ label_mode="L",
+ cbar_location="top",
+ cbar_mode="single",
+ )
+
+ Z = 10000 * np.random.rand(10, 10)
+ im = grid[0].imshow(Z, interpolation="nearest", norm=LogNorm())
+
+ grid.cbar_axes[0].colorbar(im)
+
+
+@image_comparison(['inset_locator.png'], style='default', remove_text=True)
+def test_inset_locator():
+ fig, ax = plt.subplots(figsize=[5, 4])
+
+ # prepare the demo image
+ # Z is a 15x15 array
+ Z = cbook.get_sample_data("axes_grid/bivariate_normal.npy", np_load=True)
+ extent = (-3, 4, -4, 3)
+ Z2 = np.zeros((150, 150))
+ ny, nx = Z.shape
+ Z2[30:30+ny, 30:30+nx] = Z
+
+ # extent = [-3, 4, -4, 3]
+ ax.imshow(Z2, extent=extent, interpolation="nearest",
+ origin="lower")
+
+ axins = zoomed_inset_axes(ax, zoom=6, loc='upper right')
+ axins.imshow(Z2, extent=extent, interpolation="nearest",
+ origin="lower")
+ axins.yaxis.get_major_locator().set_params(nbins=7)
+ axins.xaxis.get_major_locator().set_params(nbins=7)
+ # sub region of the original image
+ x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9
+ axins.set_xlim(x1, x2)
+ axins.set_ylim(y1, y2)
+
+ plt.xticks(visible=False)
+ plt.yticks(visible=False)
+
+ # draw a bbox of the region of the inset axes in the parent axes and
+ # connecting lines between the bbox and the inset axes area
+ mark_inset(ax, axins, loc1=2, loc2=4, fc="none", ec="0.5")
+
+ asb = AnchoredSizeBar(ax.transData,
+ 0.5,
+ '0.5',
+ loc='lower center',
+ pad=0.1, borderpad=0.5, sep=5,
+ frameon=False)
+ ax.add_artist(asb)
+
+
+@image_comparison(['inset_axes.png'], style='default', remove_text=True)
+def test_inset_axes():
+ fig, ax = plt.subplots(figsize=[5, 4])
+
+ # prepare the demo image
+ # Z is a 15x15 array
+ Z = cbook.get_sample_data("axes_grid/bivariate_normal.npy", np_load=True)
+ extent = (-3, 4, -4, 3)
+ Z2 = np.zeros((150, 150))
+ ny, nx = Z.shape
+ Z2[30:30+ny, 30:30+nx] = Z
+
+ # extent = [-3, 4, -4, 3]
+ ax.imshow(Z2, extent=extent, interpolation="nearest",
+ origin="lower")
+
+ # creating our inset axes with a bbox_transform parameter
+ axins = inset_axes(ax, width=1., height=1., bbox_to_anchor=(1, 1),
+ bbox_transform=ax.transAxes)
+
+ axins.imshow(Z2, extent=extent, interpolation="nearest",
+ origin="lower")
+ axins.yaxis.get_major_locator().set_params(nbins=7)
+ axins.xaxis.get_major_locator().set_params(nbins=7)
+ # sub region of the original image
+ x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9
+ axins.set_xlim(x1, x2)
+ axins.set_ylim(y1, y2)
+
+ plt.xticks(visible=False)
+ plt.yticks(visible=False)
+
+ # draw a bbox of the region of the inset axes in the parent axes and
+ # connecting lines between the bbox and the inset axes area
+ mark_inset(ax, axins, loc1=2, loc2=4, fc="none", ec="0.5")
+
+ asb = AnchoredSizeBar(ax.transData,
+ 0.5,
+ '0.5',
+ loc='lower center',
+ pad=0.1, borderpad=0.5, sep=5,
+ frameon=False)
+ ax.add_artist(asb)
+
+
+def test_inset_axes_complete():
+ dpi = 100
+ figsize = (6, 5)
+ fig, ax = plt.subplots(figsize=figsize, dpi=dpi)
+ fig.subplots_adjust(.1, .1, .9, .9)
+
+ ins = inset_axes(ax, width=2., height=2., borderpad=0)
+ fig.canvas.draw()
+ assert_array_almost_equal(
+ ins.get_position().extents,
+ np.array(((0.9*figsize[0]-2.)/figsize[0],
+ (0.9*figsize[1]-2.)/figsize[1], 0.9, 0.9)))
+
+ ins = inset_axes(ax, width="40%", height="30%", borderpad=0)
+ fig.canvas.draw()
+ assert_array_almost_equal(
+ ins.get_position().extents,
+ np.array((.9-.8*.4, .9-.8*.3, 0.9, 0.9)))
+
+ ins = inset_axes(ax, width=1., height=1.2, bbox_to_anchor=(200, 100),
+ loc=3, borderpad=0)
+ fig.canvas.draw()
+ assert_array_almost_equal(
+ ins.get_position().extents,
+ np.array((200./dpi/figsize[0], 100./dpi/figsize[1],
+ (200./dpi+1)/figsize[0], (100./dpi+1.2)/figsize[1])))
+
+ ins1 = inset_axes(ax, width="35%", height="60%", loc=3, borderpad=1)
+ ins2 = inset_axes(ax, width="100%", height="100%",
+ bbox_to_anchor=(0, 0, .35, .60),
+ bbox_transform=ax.transAxes, loc=3, borderpad=1)
+ fig.canvas.draw()
+ assert_array_equal(ins1.get_position().extents,
+ ins2.get_position().extents)
+
+ with pytest.raises(ValueError):
+ ins = inset_axes(ax, width="40%", height="30%",
+ bbox_to_anchor=(0.4, 0.5))
+
+ with pytest.warns(UserWarning):
+ ins = inset_axes(ax, width="40%", height="30%",
+ bbox_transform=ax.transAxes)
+
+
+@image_comparison(['fill_facecolor.png'], remove_text=True, style='mpl20')
+def test_fill_facecolor():
+ fig, ax = plt.subplots(1, 5)
+ fig.set_size_inches(5, 5)
+ for i in range(1, 4):
+ ax[i].yaxis.set_visible(False)
+ ax[4].yaxis.tick_right()
+ bbox = Bbox.from_extents(0, 0.4, 1, 0.6)
+
+ # fill with blue by setting 'fc' field
+ bbox1 = TransformedBbox(bbox, ax[0].transData)
+ bbox2 = TransformedBbox(bbox, ax[1].transData)
+ # set color to BboxConnectorPatch
+ p = BboxConnectorPatch(
+ bbox1, bbox2, loc1a=1, loc2a=2, loc1b=4, loc2b=3,
+ ec="r", fc="b")
+ p.set_clip_on(False)
+ ax[0].add_patch(p)
+ # set color to marked area
+ axins = zoomed_inset_axes(ax[0], 1, loc='upper right')
+ axins.set_xlim(0, 0.2)
+ axins.set_ylim(0, 0.2)
+ plt.gca().axes.xaxis.set_ticks([])
+ plt.gca().axes.yaxis.set_ticks([])
+ mark_inset(ax[0], axins, loc1=2, loc2=4, fc="b", ec="0.5")
+
+ # fill with yellow by setting 'facecolor' field
+ bbox3 = TransformedBbox(bbox, ax[1].transData)
+ bbox4 = TransformedBbox(bbox, ax[2].transData)
+ # set color to BboxConnectorPatch
+ p = BboxConnectorPatch(
+ bbox3, bbox4, loc1a=1, loc2a=2, loc1b=4, loc2b=3,
+ ec="r", facecolor="y")
+ p.set_clip_on(False)
+ ax[1].add_patch(p)
+ # set color to marked area
+ axins = zoomed_inset_axes(ax[1], 1, loc='upper right')
+ axins.set_xlim(0, 0.2)
+ axins.set_ylim(0, 0.2)
+ plt.gca().axes.xaxis.set_ticks([])
+ plt.gca().axes.yaxis.set_ticks([])
+ mark_inset(ax[1], axins, loc1=2, loc2=4, facecolor="y", ec="0.5")
+
+ # fill with green by setting 'color' field
+ bbox5 = TransformedBbox(bbox, ax[2].transData)
+ bbox6 = TransformedBbox(bbox, ax[3].transData)
+ # set color to BboxConnectorPatch
+ p = BboxConnectorPatch(
+ bbox5, bbox6, loc1a=1, loc2a=2, loc1b=4, loc2b=3,
+ ec="r", color="g")
+ p.set_clip_on(False)
+ ax[2].add_patch(p)
+ # set color to marked area
+ axins = zoomed_inset_axes(ax[2], 1, loc='upper right')
+ axins.set_xlim(0, 0.2)
+ axins.set_ylim(0, 0.2)
+ plt.gca().axes.xaxis.set_ticks([])
+ plt.gca().axes.yaxis.set_ticks([])
+ mark_inset(ax[2], axins, loc1=2, loc2=4, color="g", ec="0.5")
+
+ # fill with green but color won't show if set fill to False
+ bbox7 = TransformedBbox(bbox, ax[3].transData)
+ bbox8 = TransformedBbox(bbox, ax[4].transData)
+ # BboxConnectorPatch won't show green
+ p = BboxConnectorPatch(
+ bbox7, bbox8, loc1a=1, loc2a=2, loc1b=4, loc2b=3,
+ ec="r", fc="g", fill=False)
+ p.set_clip_on(False)
+ ax[3].add_patch(p)
+ # marked area won't show green
+ axins = zoomed_inset_axes(ax[3], 1, loc='upper right')
+ axins.set_xlim(0, 0.2)
+ axins.set_ylim(0, 0.2)
+ axins.xaxis.set_ticks([])
+ axins.yaxis.set_ticks([])
+ mark_inset(ax[3], axins, loc1=2, loc2=4, fc="g", ec="0.5", fill=False)
+
+
+@image_comparison(['zoomed_axes.png', 'inverted_zoomed_axes.png'])
+def test_zooming_with_inverted_axes():
+ fig, ax = plt.subplots()
+ ax.plot([1, 2, 3], [1, 2, 3])
+ ax.axis([1, 3, 1, 3])
+ inset_ax = zoomed_inset_axes(ax, zoom=2.5, loc='lower right')
+ inset_ax.axis([1.1, 1.4, 1.1, 1.4])
+
+ fig, ax = plt.subplots()
+ ax.plot([1, 2, 3], [1, 2, 3])
+ ax.axis([3, 1, 3, 1])
+ inset_ax = zoomed_inset_axes(ax, zoom=2.5, loc='lower right')
+ inset_ax.axis([1.4, 1.1, 1.4, 1.1])
+
+
+@image_comparison(['anchored_direction_arrows.png'],
+ tol=0 if platform.machine() == 'x86_64' else 0.01)
+def test_anchored_direction_arrows():
+ fig, ax = plt.subplots()
+ ax.imshow(np.zeros((10, 10)), interpolation='nearest')
+
+ simple_arrow = AnchoredDirectionArrows(ax.transAxes, 'X', 'Y')
+ ax.add_artist(simple_arrow)
+
+
+@image_comparison(['anchored_direction_arrows_many_args.png'])
+def test_anchored_direction_arrows_many_args():
+ fig, ax = plt.subplots()
+ ax.imshow(np.ones((10, 10)))
+
+ direction_arrows = AnchoredDirectionArrows(
+ ax.transAxes, 'A', 'B', loc='upper right', color='red',
+ aspect_ratio=-0.5, pad=0.6, borderpad=2, frameon=True, alpha=0.7,
+ sep_x=-0.06, sep_y=-0.08, back_length=0.1, head_width=9,
+ head_length=10, tail_width=5)
+ ax.add_artist(direction_arrows)
+
+
+def test_axes_locatable_position():
+ fig, ax = plt.subplots()
+ divider = make_axes_locatable(ax)
+ cax = divider.append_axes('right', size='5%', pad='2%')
+ fig.canvas.draw()
+ assert np.isclose(cax.get_position(original=False).width,
+ 0.03621495327102808)
+
+
+@image_comparison(['image_grid.png'],
+ remove_text=True, style='mpl20',
+ savefig_kwarg={'bbox_inches': 'tight'})
+def test_image_grid():
+ # test that image grid works with bbox_inches=tight.
+ im = np.arange(100).reshape((10, 10))
+
+ fig = plt.figure(1, (4, 4))
+ grid = ImageGrid(fig, 111, nrows_ncols=(2, 2), axes_pad=0.1)
+
+ for i in range(4):
+ grid[i].imshow(im, interpolation='nearest')
+ grid[i].set_title('test {0}{0}'.format(i))
+
+
+def test_gettightbbox():
+ fig, ax = plt.subplots(figsize=(8, 6))
+
+ l, = ax.plot([1, 2, 3], [0, 1, 0])
+
+ ax_zoom = zoomed_inset_axes(ax, 4)
+ ax_zoom.plot([1, 2, 3], [0, 1, 0])
+
+ mark_inset(ax, ax_zoom, loc1=1, loc2=3, fc="none", ec='0.3')
+
+ remove_ticks_and_titles(fig)
+ bbox = fig.get_tightbbox(fig.canvas.get_renderer())
+ np.testing.assert_array_almost_equal(bbox.extents,
+ [-17.7, -13.9, 7.2, 5.4])
+
+
+@pytest.mark.parametrize("click_on", ["big", "small"])
+@pytest.mark.parametrize("big_on_axes,small_on_axes", [
+ ("gca", "gca"),
+ ("host", "host"),
+ ("host", "parasite"),
+ ("parasite", "host"),
+ ("parasite", "parasite")
+])
+def test_picking_callbacks_overlap(big_on_axes, small_on_axes, click_on):
+ """Test pick events on normal, host or parasite axes."""
+ # Two rectangles are drawn and "clicked on", a small one and a big one
+ # enclosing the small one. The axis on which they are drawn as well as the
+ # rectangle that is clicked on are varied.
+ # In each case we expect that both rectangles are picked if we click on the
+ # small one and only the big one is picked if we click on the big one.
+ # Also tests picking on normal axes ("gca") as a control.
+ big = plt.Rectangle((0.25, 0.25), 0.5, 0.5, picker=5)
+ small = plt.Rectangle((0.4, 0.4), 0.2, 0.2, facecolor="r", picker=5)
+ # Machinery for "receiving" events
+ received_events = []
+ def on_pick(event):
+ received_events.append(event)
+ plt.gcf().canvas.mpl_connect('pick_event', on_pick)
+ # Shortcut
+ rectangles_on_axes = (big_on_axes, small_on_axes)
+ # Axes setup
+ axes = {"gca": None, "host": None, "parasite": None}
+ if "gca" in rectangles_on_axes:
+ axes["gca"] = plt.gca()
+ if "host" in rectangles_on_axes or "parasite" in rectangles_on_axes:
+ axes["host"] = host_subplot(111)
+ axes["parasite"] = axes["host"].twin()
+ # Add rectangles to axes
+ axes[big_on_axes].add_patch(big)
+ axes[small_on_axes].add_patch(small)
+ # Simulate picking with click mouse event
+ if click_on == "big":
+ click_axes = axes[big_on_axes]
+ axes_coords = (0.3, 0.3)
+ else:
+ click_axes = axes[small_on_axes]
+ axes_coords = (0.5, 0.5)
+ # In reality mouse events never happen on parasite axes, only host axes
+ if click_axes is axes["parasite"]:
+ click_axes = axes["host"]
+ (x, y) = click_axes.transAxes.transform(axes_coords)
+ m = MouseEvent("button_press_event", click_axes.figure.canvas, x, y,
+ button=1)
+ click_axes.pick(m)
+ # Checks
+ expected_n_events = 2 if click_on == "small" else 1
+ assert len(received_events) == expected_n_events
+ event_rects = [event.artist for event in received_events]
+ assert big in event_rects
+ if click_on == "small":
+ assert small in event_rects
+
+
+def test_hbox_divider():
+ arr1 = np.arange(20).reshape((4, 5))
+ arr2 = np.arange(20).reshape((5, 4))
+
+ fig, (ax1, ax2) = plt.subplots(1, 2)
+ ax1.imshow(arr1)
+ ax2.imshow(arr2)
+
+ pad = 0.5 # inches.
+ divider = HBoxDivider(
+ fig, 111, # Position of combined axes.
+ horizontal=[Size.AxesX(ax1), Size.Fixed(pad), Size.AxesX(ax2)],
+ vertical=[Size.AxesY(ax1), Size.Scaled(1), Size.AxesY(ax2)])
+ ax1.set_axes_locator(divider.new_locator(0))
+ ax2.set_axes_locator(divider.new_locator(2))
+
+ fig.canvas.draw()
+ p1 = ax1.get_position()
+ p2 = ax2.get_position()
+ assert p1.height == p2.height
+ assert p2.width / p1.width == pytest.approx((4 / 5) ** 2)
+
+
+def test_axes_class_tuple():
+ fig = plt.figure()
+ axes_class = (mpl_toolkits.axes_grid1.mpl_axes.Axes, {})
+ gr = AxesGrid(fig, 111, nrows_ncols=(1, 1), axes_class=axes_class)
diff --git a/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_angle_helper.py b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_angle_helper.py
new file mode 100644
index 0000000..3156b33
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_angle_helper.py
@@ -0,0 +1,141 @@
+import re
+
+import numpy as np
+import pytest
+
+from mpl_toolkits.axisartist.angle_helper import (
+ FormatterDMS, FormatterHMS, select_step, select_step24, select_step360)
+
+
+_MS_RE = (
+ r'''\$ # Mathtext
+ (
+ # The sign sometimes appears on a 0 when a fraction is shown.
+ # Check later that there's only one.
+ (?P-)?
+ (?P[0-9.]+) # Degrees value
+ {degree} # Degree symbol (to be replaced by format.)
+ )?
+ (
+ (?(degree)\\,) # Separator if degrees are also visible.
+ (?P-)?
+ (?P[0-9.]+) # Minutes value
+ {minute} # Minute symbol (to be replaced by format.)
+ )?
+ (
+ (?(minute)\\,) # Separator if minutes are also visible.
+ (?P-)?
+ (?P[0-9.]+) # Seconds value
+ {second} # Second symbol (to be replaced by format.)
+ )?
+ \$ # Mathtext
+ '''
+)
+DMS_RE = re.compile(_MS_RE.format(degree=re.escape(FormatterDMS.deg_mark),
+ minute=re.escape(FormatterDMS.min_mark),
+ second=re.escape(FormatterDMS.sec_mark)),
+ re.VERBOSE)
+HMS_RE = re.compile(_MS_RE.format(degree=re.escape(FormatterHMS.deg_mark),
+ minute=re.escape(FormatterHMS.min_mark),
+ second=re.escape(FormatterHMS.sec_mark)),
+ re.VERBOSE)
+
+
+def dms2float(degrees, minutes=0, seconds=0):
+ return degrees + minutes / 60.0 + seconds / 3600.0
+
+
+@pytest.mark.parametrize('args, kwargs, expected_levels, expected_factor', [
+ ((-180, 180, 10), {'hour': False}, np.arange(-180, 181, 30), 1.0),
+ ((-12, 12, 10), {'hour': True}, np.arange(-12, 13, 2), 1.0)
+])
+def test_select_step(args, kwargs, expected_levels, expected_factor):
+ levels, n, factor = select_step(*args, **kwargs)
+
+ assert n == len(levels)
+ np.testing.assert_array_equal(levels, expected_levels)
+ assert factor == expected_factor
+
+
+@pytest.mark.parametrize('args, kwargs, expected_levels, expected_factor', [
+ ((-180, 180, 10), {}, np.arange(-180, 181, 30), 1.0),
+ ((-12, 12, 10), {}, np.arange(-750, 751, 150), 60.0)
+])
+def test_select_step24(args, kwargs, expected_levels, expected_factor):
+ levels, n, factor = select_step24(*args, **kwargs)
+
+ assert n == len(levels)
+ np.testing.assert_array_equal(levels, expected_levels)
+ assert factor == expected_factor
+
+
+@pytest.mark.parametrize('args, kwargs, expected_levels, expected_factor', [
+ ((dms2float(20, 21.2), dms2float(21, 33.3), 5), {},
+ np.arange(1215, 1306, 15), 60.0),
+ ((dms2float(20.5, seconds=21.2), dms2float(20.5, seconds=33.3), 5), {},
+ np.arange(73820, 73835, 2), 3600.0),
+ ((dms2float(20, 21.2), dms2float(20, 53.3), 5), {},
+ np.arange(1220, 1256, 5), 60.0),
+ ((21.2, 33.3, 5), {},
+ np.arange(20, 35, 2), 1.0),
+ ((dms2float(20, 21.2), dms2float(21, 33.3), 5), {},
+ np.arange(1215, 1306, 15), 60.0),
+ ((dms2float(20.5, seconds=21.2), dms2float(20.5, seconds=33.3), 5), {},
+ np.arange(73820, 73835, 2), 3600.0),
+ ((dms2float(20.5, seconds=21.2), dms2float(20.5, seconds=21.4), 5), {},
+ np.arange(7382120, 7382141, 5), 360000.0),
+ # test threshold factor
+ ((dms2float(20.5, seconds=11.2), dms2float(20.5, seconds=53.3), 5),
+ {'threshold_factor': 60}, np.arange(12301, 12310), 600.0),
+ ((dms2float(20.5, seconds=11.2), dms2float(20.5, seconds=53.3), 5),
+ {'threshold_factor': 1}, np.arange(20502, 20517, 2), 1000.0),
+])
+def test_select_step360(args, kwargs, expected_levels, expected_factor):
+ levels, n, factor = select_step360(*args, **kwargs)
+
+ assert n == len(levels)
+ np.testing.assert_array_equal(levels, expected_levels)
+ assert factor == expected_factor
+
+
+@pytest.mark.parametrize('Formatter, regex',
+ [(FormatterDMS, DMS_RE),
+ (FormatterHMS, HMS_RE)],
+ ids=['Degree/Minute/Second', 'Hour/Minute/Second'])
+@pytest.mark.parametrize('direction, factor, values', [
+ ("left", 60, [0, -30, -60]),
+ ("left", 600, [12301, 12302, 12303]),
+ ("left", 3600, [0, -30, -60]),
+ ("left", 36000, [738210, 738215, 738220]),
+ ("left", 360000, [7382120, 7382125, 7382130]),
+ ("left", 1., [45, 46, 47]),
+ ("left", 10., [452, 453, 454]),
+])
+def test_formatters(Formatter, regex, direction, factor, values):
+ fmt = Formatter()
+ result = fmt(direction, factor, values)
+
+ prev_degree = prev_minute = prev_second = None
+ for tick, value in zip(result, values):
+ m = regex.match(tick)
+ assert m is not None, f'{tick!r} is not an expected tick format.'
+
+ sign = sum(m.group(sign + '_sign') is not None
+ for sign in ('degree', 'minute', 'second'))
+ assert sign <= 1, f'Only one element of tick {tick!r} may have a sign.'
+ sign = 1 if sign == 0 else -1
+
+ degree = float(m.group('degree') or prev_degree or 0)
+ minute = float(m.group('minute') or prev_minute or 0)
+ second = float(m.group('second') or prev_second or 0)
+ if Formatter == FormatterHMS:
+ # 360 degrees as plot range -> 24 hours as labelled range
+ expected_value = pytest.approx((value // 15) / factor)
+ else:
+ expected_value = pytest.approx(value / factor)
+ assert sign * dms2float(degree, minute, second) == expected_value, \
+ f'{tick!r} does not match expected tick value.'
+
+ prev_degree = degree
+ prev_minute = minute
+ prev_second = second
diff --git a/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_axis_artist.py b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_axis_artist.py
new file mode 100644
index 0000000..1bebbfd
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_axis_artist.py
@@ -0,0 +1,99 @@
+import matplotlib.pyplot as plt
+from matplotlib.testing.decorators import image_comparison
+
+from mpl_toolkits.axisartist import AxisArtistHelperRectlinear
+from mpl_toolkits.axisartist.axis_artist import (AxisArtist, AxisLabel,
+ LabelBase, Ticks, TickLabels)
+
+
+@image_comparison(['axis_artist_ticks.png'], style='default')
+def test_ticks():
+ fig, ax = plt.subplots()
+
+ ax.xaxis.set_visible(False)
+ ax.yaxis.set_visible(False)
+
+ locs_angles = [((i / 10, 0.0), i * 30) for i in range(-1, 12)]
+
+ ticks_in = Ticks(ticksize=10, axis=ax.xaxis)
+ ticks_in.set_locs_angles(locs_angles)
+ ax.add_artist(ticks_in)
+
+ ticks_out = Ticks(ticksize=10, tick_out=True, color='C3', axis=ax.xaxis)
+ ticks_out.set_locs_angles(locs_angles)
+ ax.add_artist(ticks_out)
+
+
+@image_comparison(['axis_artist_labelbase.png'], style='default')
+def test_labelbase():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['text.kerning_factor'] = 6
+
+ fig, ax = plt.subplots()
+
+ ax.plot([0.5], [0.5], "o")
+
+ label = LabelBase(0.5, 0.5, "Test")
+ label._set_ref_angle(-90)
+ label._set_offset_radius(offset_radius=50)
+ label.set_rotation(-90)
+ label.set(ha="center", va="top")
+ ax.add_artist(label)
+
+
+@image_comparison(['axis_artist_ticklabels.png'], style='default')
+def test_ticklabels():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['text.kerning_factor'] = 6
+
+ fig, ax = plt.subplots()
+
+ ax.xaxis.set_visible(False)
+ ax.yaxis.set_visible(False)
+
+ ax.plot([0.2, 0.4], [0.5, 0.5], "o")
+
+ ticks = Ticks(ticksize=10, axis=ax.xaxis)
+ ax.add_artist(ticks)
+ locs_angles_labels = [((0.2, 0.5), -90, "0.2"),
+ ((0.4, 0.5), -120, "0.4")]
+ tick_locs_angles = [(xy, a + 180) for xy, a, l in locs_angles_labels]
+ ticks.set_locs_angles(tick_locs_angles)
+
+ ticklabels = TickLabels(axis_direction="left")
+ ticklabels._locs_angles_labels = locs_angles_labels
+ ticklabels.set_pad(10)
+ ax.add_artist(ticklabels)
+
+ ax.plot([0.5], [0.5], "s")
+ axislabel = AxisLabel(0.5, 0.5, "Test")
+ axislabel._set_offset_radius(20)
+ axislabel._set_ref_angle(0)
+ axislabel.set_axis_direction("bottom")
+ ax.add_artist(axislabel)
+
+ ax.set_xlim(0, 1)
+ ax.set_ylim(0, 1)
+
+
+@image_comparison(['axis_artist.png'], style='default')
+def test_axis_artist():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['text.kerning_factor'] = 6
+
+ fig, ax = plt.subplots()
+
+ ax.xaxis.set_visible(False)
+ ax.yaxis.set_visible(False)
+
+ for loc in ('left', 'right', 'bottom'):
+ _helper = AxisArtistHelperRectlinear.Fixed(ax, loc=loc)
+ axisline = AxisArtist(ax, _helper, offset=None, axis_direction=loc)
+ ax.add_artist(axisline)
+
+ # Settings for bottom AxisArtist.
+ axisline.set_label("TTT")
+ axisline.major_ticks.set_tick_out(False)
+ axisline.label.set_pad(5)
+
+ ax.set_ylabel("Test")
diff --git a/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_axislines.py b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_axislines.py
new file mode 100644
index 0000000..0502a0f
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_axislines.py
@@ -0,0 +1,99 @@
+import numpy as np
+from matplotlib import _api
+import matplotlib.pyplot as plt
+from matplotlib.testing.decorators import image_comparison
+from matplotlib.transforms import IdentityTransform
+
+from mpl_toolkits.axisartist.axislines import SubplotZero, Subplot
+from mpl_toolkits.axisartist import (
+ Axes, SubplotHost, ParasiteAxes, ParasiteAxesAuxTrans)
+
+import pytest
+
+
+@image_comparison(['SubplotZero.png'], style='default')
+def test_SubplotZero():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['text.kerning_factor'] = 6
+
+ fig = plt.figure()
+
+ ax = SubplotZero(fig, 1, 1, 1)
+ fig.add_subplot(ax)
+
+ ax.axis["xzero"].set_visible(True)
+ ax.axis["xzero"].label.set_text("Axis Zero")
+
+ for n in ["top", "right"]:
+ ax.axis[n].set_visible(False)
+
+ xx = np.arange(0, 2 * np.pi, 0.01)
+ ax.plot(xx, np.sin(xx))
+ ax.set_ylabel("Test")
+
+
+@image_comparison(['Subplot.png'], style='default')
+def test_Subplot():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['text.kerning_factor'] = 6
+
+ fig = plt.figure()
+
+ ax = Subplot(fig, 1, 1, 1)
+ fig.add_subplot(ax)
+
+ xx = np.arange(0, 2 * np.pi, 0.01)
+ ax.plot(xx, np.sin(xx))
+ ax.set_ylabel("Test")
+
+ ax.axis["top"].major_ticks.set_tick_out(True)
+ ax.axis["bottom"].major_ticks.set_tick_out(True)
+
+ ax.axis["bottom"].set_label("Tk0")
+
+
+def test_Axes():
+ fig = plt.figure()
+ ax = Axes(fig, [0.15, 0.1, 0.65, 0.8])
+ fig.add_axes(ax)
+ ax.plot([1, 2, 3], [0, 1, 2])
+ ax.set_xscale('log')
+ fig.canvas.draw()
+
+
+@pytest.mark.parametrize('parasite_cls', [ParasiteAxes, ParasiteAxesAuxTrans])
+@image_comparison(['ParasiteAxesAuxTrans_meshplot.png'],
+ remove_text=True, style='default', tol=0.075)
+def test_ParasiteAxesAuxTrans(parasite_cls):
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ data = np.ones((6, 6))
+ data[2, 2] = 2
+ data[0, :] = 0
+ data[-2, :] = 0
+ data[:, 0] = 0
+ data[:, -2] = 0
+ x = np.arange(6)
+ y = np.arange(6)
+ xx, yy = np.meshgrid(x, y)
+
+ funcnames = ['pcolor', 'pcolormesh', 'contourf']
+
+ fig = plt.figure()
+ for i, name in enumerate(funcnames):
+
+ ax1 = SubplotHost(fig, 1, 3, i+1)
+ fig.add_subplot(ax1)
+
+ with _api.suppress_matplotlib_deprecation_warning():
+ ax2 = parasite_cls(ax1, IdentityTransform())
+ ax1.parasites.append(ax2)
+ if name.startswith('pcolor'):
+ getattr(ax2, name)(xx, yy, data[:-1, :-1])
+ else:
+ getattr(ax2, name)(xx, yy, data)
+ ax1.set_xlim((0, 5))
+ ax1.set_ylim((0, 5))
+
+ ax2.contour(xx, yy, data, colors='k')
diff --git a/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_clip_path.py b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_clip_path.py
new file mode 100644
index 0000000..a81c12d
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_clip_path.py
@@ -0,0 +1,32 @@
+import numpy as np
+import matplotlib.pyplot as plt
+from matplotlib.testing.decorators import image_comparison
+from matplotlib.transforms import Bbox
+
+from mpl_toolkits.axisartist.clip_path import clip_line_to_rect
+
+
+@image_comparison(['clip_path.png'], style='default')
+def test_clip_path():
+ x = np.array([-3, -2, -1, 0., 1, 2, 3, 2, 1, 0, -1, -2, -3, 5])
+ y = np.arange(len(x))
+
+ fig, ax = plt.subplots()
+ ax.plot(x, y, lw=1)
+
+ bbox = Bbox.from_extents(-2, 3, 2, 12.5)
+ rect = plt.Rectangle(bbox.p0, bbox.width, bbox.height,
+ facecolor='none', edgecolor='k', ls='--')
+ ax.add_patch(rect)
+
+ clipped_lines, ticks = clip_line_to_rect(x, y, bbox)
+ for lx, ly in clipped_lines:
+ ax.plot(lx, ly, lw=1, color='C1')
+ for px, py in zip(lx, ly):
+ assert bbox.contains(px, py)
+
+ ccc = iter(['C3o', 'C2x', 'C3o', 'C2x'])
+ for ttt in ticks:
+ cc = next(ccc)
+ for (xx, yy), aa in ttt:
+ ax.plot([xx], [yy], cc)
diff --git a/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_floating_axes.py b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_floating_axes.py
new file mode 100644
index 0000000..ea319e0
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_floating_axes.py
@@ -0,0 +1,130 @@
+import numpy as np
+
+import matplotlib.pyplot as plt
+import matplotlib.projections as mprojections
+import matplotlib.transforms as mtransforms
+from matplotlib.testing.decorators import image_comparison
+from mpl_toolkits.axisartist.axislines import Subplot
+from mpl_toolkits.axisartist.floating_axes import (
+ FloatingSubplot,
+ GridHelperCurveLinear)
+from mpl_toolkits.axisartist.grid_finder import FixedLocator
+from mpl_toolkits.axisartist import angle_helper
+
+
+def test_subplot():
+ fig = plt.figure(figsize=(5, 5))
+ ax = Subplot(fig, 111)
+ fig.add_subplot(ax)
+
+
+@image_comparison(['curvelinear3.png'], style='default', tol=0.01)
+def test_curvelinear3():
+ fig = plt.figure(figsize=(5, 5))
+
+ tr = (mtransforms.Affine2D().scale(np.pi / 180, 1) +
+ mprojections.PolarAxes.PolarTransform())
+
+ grid_locator1 = angle_helper.LocatorDMS(15)
+ tick_formatter1 = angle_helper.FormatterDMS()
+
+ grid_locator2 = FixedLocator([2, 4, 6, 8, 10])
+
+ grid_helper = GridHelperCurveLinear(tr,
+ extremes=(0, 360, 10, 3),
+ grid_locator1=grid_locator1,
+ grid_locator2=grid_locator2,
+ tick_formatter1=tick_formatter1,
+ tick_formatter2=None)
+
+ ax1 = FloatingSubplot(fig, 111, grid_helper=grid_helper)
+ fig.add_subplot(ax1)
+
+ r_scale = 10
+ tr2 = mtransforms.Affine2D().scale(1, 1 / r_scale) + tr
+ grid_locator2 = FixedLocator([30, 60, 90])
+ grid_helper2 = GridHelperCurveLinear(tr2,
+ extremes=(0, 360,
+ 10 * r_scale, 3 * r_scale),
+ grid_locator2=grid_locator2)
+
+ ax1.axis["right"] = axis = grid_helper2.new_fixed_axis("right", axes=ax1)
+
+ ax1.axis["left"].label.set_text("Test 1")
+ ax1.axis["right"].label.set_text("Test 2")
+
+ for an in ["left", "right"]:
+ ax1.axis[an].set_visible(False)
+
+ axis = grid_helper.new_floating_axis(1, 7, axes=ax1,
+ axis_direction="bottom")
+ ax1.axis["z"] = axis
+ axis.toggle(all=True, label=True)
+ axis.label.set_text("z = ?")
+ axis.label.set_visible(True)
+ axis.line.set_color("0.5")
+
+ ax2 = ax1.get_aux_axes(tr)
+
+ xx, yy = [67, 90, 75, 30], [2, 5, 8, 4]
+ ax2.scatter(xx, yy)
+ l, = ax2.plot(xx, yy, "k-")
+ l.set_clip_path(ax1.patch)
+
+
+@image_comparison(['curvelinear4.png'], style='default', tol=0.015)
+def test_curvelinear4():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['text.kerning_factor'] = 6
+
+ fig = plt.figure(figsize=(5, 5))
+
+ tr = (mtransforms.Affine2D().scale(np.pi / 180, 1) +
+ mprojections.PolarAxes.PolarTransform())
+
+ grid_locator1 = angle_helper.LocatorDMS(5)
+ tick_formatter1 = angle_helper.FormatterDMS()
+
+ grid_locator2 = FixedLocator([2, 4, 6, 8, 10])
+
+ grid_helper = GridHelperCurveLinear(tr,
+ extremes=(120, 30, 10, 0),
+ grid_locator1=grid_locator1,
+ grid_locator2=grid_locator2,
+ tick_formatter1=tick_formatter1,
+ tick_formatter2=None)
+
+ ax1 = FloatingSubplot(fig, 111, grid_helper=grid_helper)
+ fig.add_subplot(ax1)
+
+ ax1.axis["left"].label.set_text("Test 1")
+ ax1.axis["right"].label.set_text("Test 2")
+
+ for an in ["top"]:
+ ax1.axis[an].set_visible(False)
+
+ axis = grid_helper.new_floating_axis(1, 70, axes=ax1,
+ axis_direction="bottom")
+ ax1.axis["z"] = axis
+ axis.toggle(all=True, label=True)
+ axis.label.set_axis_direction("top")
+ axis.label.set_text("z = ?")
+ axis.label.set_visible(True)
+ axis.line.set_color("0.5")
+
+ ax2 = ax1.get_aux_axes(tr)
+
+ xx, yy = [67, 90, 75, 30], [2, 5, 8, 4]
+ ax2.scatter(xx, yy)
+ l, = ax2.plot(xx, yy, "k-")
+ l.set_clip_path(ax1.patch)
+
+
+def test_axis_direction():
+ # Check that axis direction is propagated on a floating axis
+ fig = plt.figure()
+ ax = Subplot(fig, 111)
+ fig.add_subplot(ax)
+ ax.axis['y'] = ax.new_floating_axis(nth_coord=1, value=0,
+ axis_direction='left')
+ assert ax.axis['y']._axis_direction == 'left'
diff --git a/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_grid_finder.py b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_grid_finder.py
new file mode 100644
index 0000000..3a0913c
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_grid_finder.py
@@ -0,0 +1,13 @@
+from mpl_toolkits.axisartist.grid_finder import (
+ FormatterPrettyPrint,
+ MaxNLocator)
+
+
+def test_pretty_print_format():
+ locator = MaxNLocator()
+ locs, nloc, factor = locator(0, 100)
+
+ fmt = FormatterPrettyPrint()
+
+ assert fmt("left", None, locs) == \
+ [r'$\mathdefault{%d}$' % (l, ) for l in locs]
diff --git a/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py
new file mode 100644
index 0000000..9a78a26
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py
@@ -0,0 +1,213 @@
+import numpy as np
+import platform
+
+import matplotlib.pyplot as plt
+from matplotlib.path import Path
+from matplotlib.projections import PolarAxes
+from matplotlib.transforms import Affine2D, Transform
+from matplotlib.testing.decorators import image_comparison
+
+from mpl_toolkits.axes_grid1.parasite_axes import ParasiteAxes
+from mpl_toolkits.axisartist import SubplotHost
+from mpl_toolkits.axes_grid1.parasite_axes import host_subplot_class_factory
+from mpl_toolkits.axisartist import angle_helper
+from mpl_toolkits.axisartist.axislines import Axes
+from mpl_toolkits.axisartist.grid_helper_curvelinear import \
+ GridHelperCurveLinear
+
+
+@image_comparison(['custom_transform.png'], style='default',
+ tol=0.03 if platform.machine() == 'x86_64' else 0.04)
+def test_custom_transform():
+ class MyTransform(Transform):
+ input_dims = output_dims = 2
+
+ def __init__(self, resolution):
+ """
+ Resolution is the number of steps to interpolate between each input
+ line segment to approximate its path in transformed space.
+ """
+ Transform.__init__(self)
+ self._resolution = resolution
+
+ def transform(self, ll):
+ x, y = ll.T
+ return np.column_stack([x, y - x])
+
+ transform_non_affine = transform
+
+ def transform_path(self, path):
+ ipath = path.interpolated(self._resolution)
+ return Path(self.transform(ipath.vertices), ipath.codes)
+
+ transform_path_non_affine = transform_path
+
+ def inverted(self):
+ return MyTransformInv(self._resolution)
+
+ class MyTransformInv(Transform):
+ input_dims = output_dims = 2
+
+ def __init__(self, resolution):
+ Transform.__init__(self)
+ self._resolution = resolution
+
+ def transform(self, ll):
+ x, y = ll.T
+ return np.column_stack([x, y + x])
+
+ def inverted(self):
+ return MyTransform(self._resolution)
+
+ fig = plt.figure()
+
+ SubplotHost = host_subplot_class_factory(Axes)
+
+ tr = MyTransform(1)
+ grid_helper = GridHelperCurveLinear(tr)
+ ax1 = SubplotHost(fig, 1, 1, 1, grid_helper=grid_helper)
+ fig.add_subplot(ax1)
+
+ ax2 = ParasiteAxes(ax1, tr, viewlim_mode="equal")
+ ax1.parasites.append(ax2)
+ ax2.plot([3, 6], [5.0, 10.])
+
+ ax1.set_aspect(1.)
+ ax1.set_xlim(0, 10)
+ ax1.set_ylim(0, 10)
+
+ ax1.grid(True)
+
+
+@image_comparison(['polar_box.png'], style='default',
+ tol={'aarch64': 0.04}.get(platform.machine(), 0.03))
+def test_polar_box():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['text.kerning_factor'] = 6
+
+ fig = plt.figure(figsize=(5, 5))
+
+ # PolarAxes.PolarTransform takes radian. However, we want our coordinate
+ # system in degree
+ tr = Affine2D().scale(np.pi / 180., 1.) + PolarAxes.PolarTransform()
+
+ # polar projection, which involves cycle, and also has limits in
+ # its coordinates, needs a special method to find the extremes
+ # (min, max of the coordinate within the view).
+ extreme_finder = angle_helper.ExtremeFinderCycle(20, 20,
+ lon_cycle=360,
+ lat_cycle=None,
+ lon_minmax=None,
+ lat_minmax=(0, np.inf))
+
+ grid_locator1 = angle_helper.LocatorDMS(12)
+ tick_formatter1 = angle_helper.FormatterDMS()
+
+ grid_helper = GridHelperCurveLinear(tr,
+ extreme_finder=extreme_finder,
+ grid_locator1=grid_locator1,
+ tick_formatter1=tick_formatter1)
+
+ ax1 = SubplotHost(fig, 1, 1, 1, grid_helper=grid_helper)
+
+ ax1.axis["right"].major_ticklabels.set_visible(True)
+ ax1.axis["top"].major_ticklabels.set_visible(True)
+
+ # let right axis shows ticklabels for 1st coordinate (angle)
+ ax1.axis["right"].get_helper().nth_coord_ticks = 0
+ # let bottom axis shows ticklabels for 2nd coordinate (radius)
+ ax1.axis["bottom"].get_helper().nth_coord_ticks = 1
+
+ fig.add_subplot(ax1)
+
+ ax1.axis["lat"] = axis = grid_helper.new_floating_axis(0, 45, axes=ax1)
+ axis.label.set_text("Test")
+ axis.label.set_visible(True)
+ axis.get_helper().set_extremes(2, 12)
+
+ ax1.axis["lon"] = axis = grid_helper.new_floating_axis(1, 6, axes=ax1)
+ axis.label.set_text("Test 2")
+ axis.get_helper().set_extremes(-180, 90)
+
+ # A parasite axes with given transform
+ ax2 = ParasiteAxes(ax1, tr, viewlim_mode="equal")
+ assert ax2.transData == tr + ax1.transData
+ # Anything you draw in ax2 will match the ticks and grids of ax1.
+ ax1.parasites.append(ax2)
+ ax2.plot(np.linspace(0, 30, 50), np.linspace(10, 10, 50))
+
+ ax1.set_aspect(1.)
+ ax1.set_xlim(-5, 12)
+ ax1.set_ylim(-5, 10)
+
+ ax1.grid(True)
+
+
+@image_comparison(['axis_direction.png'], style='default', tol=0.03)
+def test_axis_direction():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['text.kerning_factor'] = 6
+
+ fig = plt.figure(figsize=(5, 5))
+
+ # PolarAxes.PolarTransform takes radian. However, we want our coordinate
+ # system in degree
+ tr = Affine2D().scale(np.pi / 180., 1.) + PolarAxes.PolarTransform()
+
+ # polar projection, which involves cycle, and also has limits in
+ # its coordinates, needs a special method to find the extremes
+ # (min, max of the coordinate within the view).
+
+ # 20, 20 : number of sampling points along x, y direction
+ extreme_finder = angle_helper.ExtremeFinderCycle(20, 20,
+ lon_cycle=360,
+ lat_cycle=None,
+ lon_minmax=None,
+ lat_minmax=(0, np.inf),
+ )
+
+ grid_locator1 = angle_helper.LocatorDMS(12)
+ tick_formatter1 = angle_helper.FormatterDMS()
+
+ grid_helper = GridHelperCurveLinear(tr,
+ extreme_finder=extreme_finder,
+ grid_locator1=grid_locator1,
+ tick_formatter1=tick_formatter1)
+
+ ax1 = SubplotHost(fig, 1, 1, 1, grid_helper=grid_helper)
+
+ for axis in ax1.axis.values():
+ axis.set_visible(False)
+
+ fig.add_subplot(ax1)
+
+ ax1.axis["lat1"] = axis = grid_helper.new_floating_axis(
+ 0, 130,
+ axes=ax1, axis_direction="left")
+ axis.label.set_text("Test")
+ axis.label.set_visible(True)
+ axis.get_helper().set_extremes(0.001, 10)
+
+ ax1.axis["lat2"] = axis = grid_helper.new_floating_axis(
+ 0, 50,
+ axes=ax1, axis_direction="right")
+ axis.label.set_text("Test")
+ axis.label.set_visible(True)
+ axis.get_helper().set_extremes(0.001, 10)
+
+ ax1.axis["lon"] = axis = grid_helper.new_floating_axis(
+ 1, 10,
+ axes=ax1, axis_direction="bottom")
+ axis.label.set_text("Test 2")
+ axis.get_helper().set_extremes(50, 130)
+ axis.major_ticklabels.set_axis_direction("top")
+ axis.label.set_axis_direction("top")
+
+ grid_helper.grid_finder.grid_locator1.set_params(nbins=5)
+ grid_helper.grid_finder.grid_locator2.set_params(nbins=5)
+
+ ax1.set_aspect(1.)
+ ax1.set_xlim(-8, 8)
+ ax1.set_ylim(-4, 12)
+
+ ax1.grid(True)
diff --git a/venv/Lib/site-packages/mpl_toolkits/tests/test_mplot3d.py b/venv/Lib/site-packages/mpl_toolkits/tests/test_mplot3d.py
new file mode 100644
index 0000000..65049f5
--- /dev/null
+++ b/venv/Lib/site-packages/mpl_toolkits/tests/test_mplot3d.py
@@ -0,0 +1,1442 @@
+import functools
+import itertools
+import platform
+
+import pytest
+
+from mpl_toolkits.mplot3d import Axes3D, axes3d, proj3d, art3d
+import matplotlib as mpl
+from matplotlib.backend_bases import MouseButton
+from matplotlib.cbook import MatplotlibDeprecationWarning
+from matplotlib import cm
+from matplotlib import colors as mcolors
+from matplotlib.testing.decorators import image_comparison, check_figures_equal
+from matplotlib.testing.widgets import mock_event
+from matplotlib.collections import LineCollection, PolyCollection
+from matplotlib.patches import Circle
+
+import matplotlib.pyplot as plt
+import numpy as np
+
+
+mpl3d_image_comparison = functools.partial(
+ image_comparison, remove_text=True, style='default')
+
+
+def test_aspect_equal_error():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ with pytest.raises(NotImplementedError):
+ ax.set_aspect('equal')
+
+
+@mpl3d_image_comparison(['bar3d.png'])
+def test_bar3d():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ for c, z in zip(['r', 'g', 'b', 'y'], [30, 20, 10, 0]):
+ xs = np.arange(20)
+ ys = np.arange(20)
+ cs = [c] * len(xs)
+ cs[0] = 'c'
+ ax.bar(xs, ys, zs=z, zdir='y', align='edge', color=cs, alpha=0.8)
+
+
+def test_bar3d_colors():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ for c in ['red', 'green', 'blue', 'yellow']:
+ xs = np.arange(len(c))
+ ys = np.zeros_like(xs)
+ zs = np.zeros_like(ys)
+ # Color names with same length as xs/ys/zs should not be split into
+ # individual letters.
+ ax.bar3d(xs, ys, zs, 1, 1, 1, color=c)
+
+
+@mpl3d_image_comparison(['bar3d_shaded.png'])
+def test_bar3d_shaded():
+ x = np.arange(4)
+ y = np.arange(5)
+ x2d, y2d = np.meshgrid(x, y)
+ x2d, y2d = x2d.ravel(), y2d.ravel()
+ z = x2d + y2d + 1 # Avoid triggering bug with zero-depth boxes.
+
+ views = [(-60, 30), (30, 30), (30, -30), (120, -30)]
+ fig = plt.figure(figsize=plt.figaspect(1 / len(views)))
+ axs = fig.subplots(
+ 1, len(views),
+ subplot_kw=dict(projection='3d')
+ )
+ for ax, (azim, elev) in zip(axs, views):
+ ax.bar3d(x2d, y2d, x2d * 0, 1, 1, z, shade=True)
+ ax.view_init(azim=azim, elev=elev)
+ fig.canvas.draw()
+
+
+@mpl3d_image_comparison(['bar3d_notshaded.png'])
+def test_bar3d_notshaded():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ x = np.arange(4)
+ y = np.arange(5)
+ x2d, y2d = np.meshgrid(x, y)
+ x2d, y2d = x2d.ravel(), y2d.ravel()
+ z = x2d + y2d
+ ax.bar3d(x2d, y2d, x2d * 0, 1, 1, z, shade=False)
+ fig.canvas.draw()
+
+
+def test_bar3d_lightsource():
+ fig = plt.figure()
+ ax = fig.add_subplot(1, 1, 1, projection="3d")
+
+ ls = mcolors.LightSource(azdeg=0, altdeg=90)
+
+ length, width = 3, 4
+ area = length * width
+
+ x, y = np.meshgrid(np.arange(length), np.arange(width))
+ x = x.ravel()
+ y = y.ravel()
+ dz = x + y
+
+ color = [cm.coolwarm(i/area) for i in range(area)]
+
+ collection = ax.bar3d(x=x, y=y, z=0,
+ dx=1, dy=1, dz=dz,
+ color=color, shade=True, lightsource=ls)
+
+ # Testing that the custom 90° lightsource produces different shading on
+ # the top facecolors compared to the default, and that those colors are
+ # precisely the colors from the colormap, due to the illumination parallel
+ # to the z-axis.
+ np.testing.assert_array_equal(color, collection._facecolor3d[1::6])
+
+
+@mpl3d_image_comparison(['contour3d.png'])
+def test_contour3d():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ X, Y, Z = axes3d.get_test_data(0.05)
+ ax.contour(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm)
+ ax.contour(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm)
+ ax.contour(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)
+ ax.set_xlim(-40, 40)
+ ax.set_ylim(-40, 40)
+ ax.set_zlim(-100, 100)
+
+
+@mpl3d_image_comparison(['contourf3d.png'])
+def test_contourf3d():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ X, Y, Z = axes3d.get_test_data(0.05)
+ ax.contourf(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm)
+ ax.contourf(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm)
+ ax.contourf(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)
+ ax.set_xlim(-40, 40)
+ ax.set_ylim(-40, 40)
+ ax.set_zlim(-100, 100)
+
+
+@mpl3d_image_comparison(['contourf3d_fill.png'])
+def test_contourf3d_fill():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ X, Y = np.meshgrid(np.arange(-2, 2, 0.25), np.arange(-2, 2, 0.25))
+ Z = X.clip(0, 0)
+ # This produces holes in the z=0 surface that causes rendering errors if
+ # the Poly3DCollection is not aware of path code information (issue #4784)
+ Z[::5, ::5] = 0.1
+ ax.contourf(X, Y, Z, offset=0, levels=[-0.1, 0], cmap=cm.coolwarm)
+ ax.set_xlim(-2, 2)
+ ax.set_ylim(-2, 2)
+ ax.set_zlim(-1, 1)
+
+
+@mpl3d_image_comparison(['tricontour.png'], tol=0.02)
+def test_tricontour():
+ fig = plt.figure()
+
+ np.random.seed(19680801)
+ x = np.random.rand(1000) - 0.5
+ y = np.random.rand(1000) - 0.5
+ z = -(x**2 + y**2)
+
+ ax = fig.add_subplot(1, 2, 1, projection='3d')
+ ax.tricontour(x, y, z)
+ ax = fig.add_subplot(1, 2, 2, projection='3d')
+ ax.tricontourf(x, y, z)
+
+
+@mpl3d_image_comparison(['lines3d.png'])
+def test_lines3d():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
+ z = np.linspace(-2, 2, 100)
+ r = z ** 2 + 1
+ x = r * np.sin(theta)
+ y = r * np.cos(theta)
+ ax.plot(x, y, z)
+
+
+@check_figures_equal(extensions=["png"])
+def test_plot_scalar(fig_test, fig_ref):
+ ax1 = fig_test.add_subplot(projection='3d')
+ ax1.plot([1], [1], "o")
+ ax2 = fig_ref.add_subplot(projection='3d')
+ ax2.plot(1, 1, "o")
+
+
+@mpl3d_image_comparison(['mixedsubplot.png'])
+def test_mixedsubplots():
+ def f(t):
+ return np.cos(2*np.pi*t) * np.exp(-t)
+
+ t1 = np.arange(0.0, 5.0, 0.1)
+ t2 = np.arange(0.0, 5.0, 0.02)
+
+ fig = plt.figure(figsize=plt.figaspect(2.))
+ ax = fig.add_subplot(2, 1, 1)
+ ax.plot(t1, f(t1), 'bo', t2, f(t2), 'k--', markerfacecolor='green')
+ ax.grid(True)
+
+ ax = fig.add_subplot(2, 1, 2, projection='3d')
+ X, Y = np.meshgrid(np.arange(-5, 5, 0.25), np.arange(-5, 5, 0.25))
+ R = np.hypot(X, Y)
+ Z = np.sin(R)
+
+ ax.plot_surface(X, Y, Z, rcount=40, ccount=40,
+ linewidth=0, antialiased=False)
+
+ ax.set_zlim3d(-1, 1)
+
+
+@check_figures_equal(extensions=['png'])
+def test_tight_layout_text(fig_test, fig_ref):
+ # text is currently ignored in tight layout. So the order of text() and
+ # tight_layout() calls should not influence the result.
+ ax1 = fig_test.add_subplot(projection='3d')
+ ax1.text(.5, .5, .5, s='some string')
+ fig_test.tight_layout()
+
+ ax2 = fig_ref.add_subplot(projection='3d')
+ fig_ref.tight_layout()
+ ax2.text(.5, .5, .5, s='some string')
+
+
+@mpl3d_image_comparison(['scatter3d.png'])
+def test_scatter3d():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ ax.scatter(np.arange(10), np.arange(10), np.arange(10),
+ c='r', marker='o')
+ x = y = z = np.arange(10, 20)
+ ax.scatter(x, y, z, c='b', marker='^')
+ z[-1] = 0 # Check that scatter() copies the data.
+ # Ensure empty scatters do not break.
+ ax.scatter([], [], [], c='r', marker='X')
+
+
+@mpl3d_image_comparison(['scatter3d_color.png'])
+def test_scatter3d_color():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+
+ # Check that 'none' color works; these two should overlay to produce the
+ # same as setting just `color`.
+ ax.scatter(np.arange(10), np.arange(10), np.arange(10),
+ facecolor='r', edgecolor='none', marker='o')
+ ax.scatter(np.arange(10), np.arange(10), np.arange(10),
+ facecolor='none', edgecolor='r', marker='o')
+
+ ax.scatter(np.arange(10, 20), np.arange(10, 20), np.arange(10, 20),
+ color='b', marker='s')
+
+
+@check_figures_equal(extensions=['png'])
+def test_scatter3d_modification(fig_ref, fig_test):
+ # Changing Path3DCollection properties post-creation should work correctly.
+ ax_test = fig_test.add_subplot(projection='3d')
+ c = ax_test.scatter(np.arange(10), np.arange(10), np.arange(10),
+ marker='o')
+ c.set_facecolor('C1')
+ c.set_edgecolor('C2')
+ c.set_alpha([0.3, 0.7] * 5)
+ assert c.get_depthshade()
+ c.set_depthshade(False)
+ assert not c.get_depthshade()
+ c.set_sizes(np.full(10, 75))
+ c.set_linewidths(3)
+
+ ax_ref = fig_ref.add_subplot(projection='3d')
+ ax_ref.scatter(np.arange(10), np.arange(10), np.arange(10), marker='o',
+ facecolor='C1', edgecolor='C2', alpha=[0.3, 0.7] * 5,
+ depthshade=False, s=75, linewidths=3)
+
+
+@pytest.mark.parametrize('depthshade', [True, False])
+@check_figures_equal(extensions=['png'])
+def test_scatter3d_sorting(fig_ref, fig_test, depthshade):
+ """Test that marker properties are correctly sorted."""
+
+ y, x = np.mgrid[:10, :10]
+ z = np.arange(x.size).reshape(x.shape)
+
+ sizes = np.full(z.shape, 25)
+ sizes[0::2, 0::2] = 100
+ sizes[1::2, 1::2] = 100
+
+ facecolors = np.full(z.shape, 'C0')
+ facecolors[:5, :5] = 'C1'
+ facecolors[6:, :4] = 'C2'
+ facecolors[6:, 6:] = 'C3'
+
+ edgecolors = np.full(z.shape, 'C4')
+ edgecolors[1:5, 1:5] = 'C5'
+ edgecolors[5:9, 1:5] = 'C6'
+ edgecolors[5:9, 5:9] = 'C7'
+
+ linewidths = np.full(z.shape, 2)
+ linewidths[0::2, 0::2] = 5
+ linewidths[1::2, 1::2] = 5
+
+ x, y, z, sizes, facecolors, edgecolors, linewidths = [
+ a.flatten()
+ for a in [x, y, z, sizes, facecolors, edgecolors, linewidths]
+ ]
+
+ ax_ref = fig_ref.add_subplot(projection='3d')
+ sets = (np.unique(a) for a in [sizes, facecolors, edgecolors, linewidths])
+ for s, fc, ec, lw in itertools.product(*sets):
+ subset = (
+ (sizes != s) |
+ (facecolors != fc) |
+ (edgecolors != ec) |
+ (linewidths != lw)
+ )
+ subset = np.ma.masked_array(z, subset, dtype=float)
+
+ # When depth shading is disabled, the colors are passed through as
+ # single-item lists; this triggers single path optimization. The
+ # following reshaping is a hack to disable that, since the optimization
+ # would not occur for the full scatter which has multiple colors.
+ fc = np.repeat(fc, sum(~subset.mask))
+
+ ax_ref.scatter(x, y, subset, s=s, fc=fc, ec=ec, lw=lw, alpha=1,
+ depthshade=depthshade)
+
+ ax_test = fig_test.add_subplot(projection='3d')
+ ax_test.scatter(x, y, z, s=sizes, fc=facecolors, ec=edgecolors,
+ lw=linewidths, alpha=1, depthshade=depthshade)
+
+
+@pytest.mark.parametrize('azim', [-50, 130]) # yellow first, blue first
+@check_figures_equal(extensions=['png'])
+def test_marker_draw_order_data_reversed(fig_test, fig_ref, azim):
+ """
+ Test that the draw order does not depend on the data point order.
+
+ For the given viewing angle at azim=-50, the yellow marker should be in
+ front. For azim=130, the blue marker should be in front.
+ """
+ x = [-1, 1]
+ y = [1, -1]
+ z = [0, 0]
+ color = ['b', 'y']
+ ax = fig_test.add_subplot(projection='3d')
+ ax.scatter(x, y, z, s=3500, c=color)
+ ax.view_init(elev=0, azim=azim)
+ ax = fig_ref.add_subplot(projection='3d')
+ ax.scatter(x[::-1], y[::-1], z[::-1], s=3500, c=color[::-1])
+ ax.view_init(elev=0, azim=azim)
+
+
+@check_figures_equal(extensions=['png'])
+def test_marker_draw_order_view_rotated(fig_test, fig_ref):
+ """
+ Test that the draw order changes with the direction.
+
+ If we rotate *azim* by 180 degrees and exchange the colors, the plot
+ plot should look the same again.
+ """
+ azim = 130
+ x = [-1, 1]
+ y = [1, -1]
+ z = [0, 0]
+ color = ['b', 'y']
+ ax = fig_test.add_subplot(projection='3d')
+ # axis are not exactly invariant under 180 degree rotation -> deactivate
+ ax.set_axis_off()
+ ax.scatter(x, y, z, s=3500, c=color)
+ ax.view_init(elev=0, azim=azim)
+ ax = fig_ref.add_subplot(projection='3d')
+ ax.set_axis_off()
+ ax.scatter(x, y, z, s=3500, c=color[::-1]) # color reversed
+ ax.view_init(elev=0, azim=azim - 180) # view rotated by 180 degrees
+
+
+@mpl3d_image_comparison(['plot_3d_from_2d.png'], tol=0.015)
+def test_plot_3d_from_2d():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ xs = np.arange(0, 5)
+ ys = np.arange(5, 10)
+ ax.plot(xs, ys, zs=0, zdir='x')
+ ax.plot(xs, ys, zs=0, zdir='y')
+
+
+@mpl3d_image_comparison(['surface3d.png'])
+def test_surface3d():
+ # Remove this line when this test image is regenerated.
+ plt.rcParams['pcolormesh.snap'] = False
+
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ X = np.arange(-5, 5, 0.25)
+ Y = np.arange(-5, 5, 0.25)
+ X, Y = np.meshgrid(X, Y)
+ R = np.hypot(X, Y)
+ Z = np.sin(R)
+ surf = ax.plot_surface(X, Y, Z, rcount=40, ccount=40, cmap=cm.coolwarm,
+ lw=0, antialiased=False)
+ ax.set_zlim(-1.01, 1.01)
+ fig.colorbar(surf, shrink=0.5, aspect=5)
+
+
+@mpl3d_image_comparison(['surface3d_shaded.png'])
+def test_surface3d_shaded():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ X = np.arange(-5, 5, 0.25)
+ Y = np.arange(-5, 5, 0.25)
+ X, Y = np.meshgrid(X, Y)
+ R = np.sqrt(X ** 2 + Y ** 2)
+ Z = np.sin(R)
+ ax.plot_surface(X, Y, Z, rstride=5, cstride=5,
+ color=[0.25, 1, 0.25], lw=1, antialiased=False)
+ ax.set_zlim(-1.01, 1.01)
+
+
+@mpl3d_image_comparison(['text3d.png'], remove_text=False)
+def test_text3d():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+
+ zdirs = (None, 'x', 'y', 'z', (1, 1, 0), (1, 1, 1))
+ xs = (2, 6, 4, 9, 7, 2)
+ ys = (6, 4, 8, 7, 2, 2)
+ zs = (4, 2, 5, 6, 1, 7)
+
+ for zdir, x, y, z in zip(zdirs, xs, ys, zs):
+ label = '(%d, %d, %d), dir=%s' % (x, y, z, zdir)
+ ax.text(x, y, z, label, zdir)
+
+ ax.text(1, 1, 1, "red", color='red')
+ ax.text2D(0.05, 0.95, "2D Text", transform=ax.transAxes)
+ ax.set_xlim3d(0, 10)
+ ax.set_ylim3d(0, 10)
+ ax.set_zlim3d(0, 10)
+ ax.set_xlabel('X axis')
+ ax.set_ylabel('Y axis')
+ ax.set_zlabel('Z axis')
+
+
+@check_figures_equal(extensions=['png'])
+def test_text3d_modification(fig_ref, fig_test):
+ # Modifying the Text position after the fact should work the same as
+ # setting it directly.
+ zdirs = (None, 'x', 'y', 'z', (1, 1, 0), (1, 1, 1))
+ xs = (2, 6, 4, 9, 7, 2)
+ ys = (6, 4, 8, 7, 2, 2)
+ zs = (4, 2, 5, 6, 1, 7)
+
+ ax_test = fig_test.add_subplot(projection='3d')
+ ax_test.set_xlim3d(0, 10)
+ ax_test.set_ylim3d(0, 10)
+ ax_test.set_zlim3d(0, 10)
+ for zdir, x, y, z in zip(zdirs, xs, ys, zs):
+ t = ax_test.text(0, 0, 0, f'({x}, {y}, {z}), dir={zdir}')
+ t.set_position_3d((x, y, z), zdir=zdir)
+
+ ax_ref = fig_ref.add_subplot(projection='3d')
+ ax_ref.set_xlim3d(0, 10)
+ ax_ref.set_ylim3d(0, 10)
+ ax_ref.set_zlim3d(0, 10)
+ for zdir, x, y, z in zip(zdirs, xs, ys, zs):
+ ax_ref.text(x, y, z, f'({x}, {y}, {z}), dir={zdir}', zdir=zdir)
+
+
+@mpl3d_image_comparison(['trisurf3d.png'], tol=0.03)
+def test_trisurf3d():
+ n_angles = 36
+ n_radii = 8
+ radii = np.linspace(0.125, 1.0, n_radii)
+ angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)
+ angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
+ angles[:, 1::2] += np.pi/n_angles
+
+ x = np.append(0, (radii*np.cos(angles)).flatten())
+ y = np.append(0, (radii*np.sin(angles)).flatten())
+ z = np.sin(-x*y)
+
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ ax.plot_trisurf(x, y, z, cmap=cm.jet, linewidth=0.2)
+
+
+@mpl3d_image_comparison(['trisurf3d_shaded.png'], tol=0.03)
+def test_trisurf3d_shaded():
+ n_angles = 36
+ n_radii = 8
+ radii = np.linspace(0.125, 1.0, n_radii)
+ angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)
+ angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
+ angles[:, 1::2] += np.pi/n_angles
+
+ x = np.append(0, (radii*np.cos(angles)).flatten())
+ y = np.append(0, (radii*np.sin(angles)).flatten())
+ z = np.sin(-x*y)
+
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ ax.plot_trisurf(x, y, z, color=[1, 0.5, 0], linewidth=0.2)
+
+
+@mpl3d_image_comparison(['wireframe3d.png'])
+def test_wireframe3d():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ X, Y, Z = axes3d.get_test_data(0.05)
+ ax.plot_wireframe(X, Y, Z, rcount=13, ccount=13)
+
+
+@mpl3d_image_comparison(['wireframe3dzerocstride.png'])
+def test_wireframe3dzerocstride():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ X, Y, Z = axes3d.get_test_data(0.05)
+ ax.plot_wireframe(X, Y, Z, rcount=13, ccount=0)
+
+
+@mpl3d_image_comparison(['wireframe3dzerorstride.png'])
+def test_wireframe3dzerorstride():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ X, Y, Z = axes3d.get_test_data(0.05)
+ ax.plot_wireframe(X, Y, Z, rstride=0, cstride=10)
+
+
+def test_wireframe3dzerostrideraises():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ X, Y, Z = axes3d.get_test_data(0.05)
+ with pytest.raises(ValueError):
+ ax.plot_wireframe(X, Y, Z, rstride=0, cstride=0)
+
+
+def test_mixedsamplesraises():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ X, Y, Z = axes3d.get_test_data(0.05)
+ with pytest.raises(ValueError):
+ ax.plot_wireframe(X, Y, Z, rstride=10, ccount=50)
+ with pytest.raises(ValueError):
+ ax.plot_surface(X, Y, Z, cstride=50, rcount=10)
+
+
+@mpl3d_image_comparison(
+ ['quiver3d.png', 'quiver3d_pivot_middle.png', 'quiver3d_pivot_tail.png'])
+def test_quiver3d():
+ x, y, z = np.ogrid[-1:0.8:10j, -1:0.8:10j, -1:0.6:3j]
+ u = np.sin(np.pi * x) * np.cos(np.pi * y) * np.cos(np.pi * z)
+ v = -np.cos(np.pi * x) * np.sin(np.pi * y) * np.cos(np.pi * z)
+ w = (2/3)**0.5 * np.cos(np.pi * x) * np.cos(np.pi * y) * np.sin(np.pi * z)
+ for pivot in ['tip', 'middle', 'tail']:
+ ax = plt.figure().add_subplot(projection='3d')
+ ax.quiver(x, y, z, u, v, w, length=0.1, pivot=pivot, normalize=True)
+
+
+@check_figures_equal(extensions=["png"])
+def test_quiver3d_empty(fig_test, fig_ref):
+ fig_ref.add_subplot(projection='3d')
+ x = y = z = u = v = w = []
+ ax = fig_test.add_subplot(projection='3d')
+ ax.quiver(x, y, z, u, v, w, length=0.1, pivot='tip', normalize=True)
+
+
+@mpl3d_image_comparison(['quiver3d_masked.png'])
+def test_quiver3d_masked():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+
+ # Using mgrid here instead of ogrid because masked_where doesn't
+ # seem to like broadcasting very much...
+ x, y, z = np.mgrid[-1:0.8:10j, -1:0.8:10j, -1:0.6:3j]
+
+ u = np.sin(np.pi * x) * np.cos(np.pi * y) * np.cos(np.pi * z)
+ v = -np.cos(np.pi * x) * np.sin(np.pi * y) * np.cos(np.pi * z)
+ w = (2/3)**0.5 * np.cos(np.pi * x) * np.cos(np.pi * y) * np.sin(np.pi * z)
+ u = np.ma.masked_where((-0.4 < x) & (x < 0.1), u, copy=False)
+ v = np.ma.masked_where((0.1 < y) & (y < 0.7), v, copy=False)
+
+ ax.quiver(x, y, z, u, v, w, length=0.1, pivot='tip', normalize=True)
+
+
+def test_patch_modification():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection="3d")
+ circle = Circle((0, 0))
+ ax.add_patch(circle)
+ art3d.patch_2d_to_3d(circle)
+ circle.set_facecolor((1.0, 0.0, 0.0, 1))
+
+ assert mcolors.same_color(circle.get_facecolor(), (1, 0, 0, 1))
+ fig.canvas.draw()
+ assert mcolors.same_color(circle.get_facecolor(), (1, 0, 0, 1))
+
+
+@check_figures_equal(extensions=['png'])
+def test_patch_collection_modification(fig_test, fig_ref):
+ # Test that modifying Patch3DCollection properties after creation works.
+ patch = Circle((0, 0), 0.05)
+ c = art3d.Patch3DCollection([patch], linewidths=3)
+
+ ax_test = fig_test.add_subplot(projection='3d')
+ ax_test.add_collection3d(c)
+ c.set_edgecolor('C2')
+ c.set_facecolor('C3')
+ c.set_alpha(0.7)
+ assert c.get_depthshade()
+ c.set_depthshade(False)
+ assert not c.get_depthshade()
+
+ patch = Circle((0, 0), 0.05)
+ c = art3d.Patch3DCollection([patch], linewidths=3,
+ edgecolor='C2', facecolor='C3', alpha=0.7,
+ depthshade=False)
+
+ ax_ref = fig_ref.add_subplot(projection='3d')
+ ax_ref.add_collection3d(c)
+
+
+@mpl3d_image_comparison(['poly3dcollection_closed.png'])
+def test_poly3dcollection_closed():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+
+ poly1 = np.array([[0, 0, 1], [0, 1, 1], [0, 0, 0]], float)
+ poly2 = np.array([[0, 1, 1], [1, 1, 1], [1, 1, 0]], float)
+ c1 = art3d.Poly3DCollection([poly1], linewidths=3, edgecolor='k',
+ facecolor=(0.5, 0.5, 1, 0.5), closed=True)
+ c2 = art3d.Poly3DCollection([poly2], linewidths=3, edgecolor='k',
+ facecolor=(1, 0.5, 0.5, 0.5), closed=False)
+ ax.add_collection3d(c1)
+ ax.add_collection3d(c2)
+
+
+def test_poly_collection_2d_to_3d_empty():
+ poly = PolyCollection([])
+ art3d.poly_collection_2d_to_3d(poly)
+ assert isinstance(poly, art3d.Poly3DCollection)
+ assert poly.get_paths() == []
+
+ fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
+ ax.add_artist(poly)
+ minz = poly.do_3d_projection()
+ assert np.isnan(minz)
+
+ # Ensure drawing actually works.
+ fig.canvas.draw()
+
+
+@mpl3d_image_comparison(['poly3dcollection_alpha.png'])
+def test_poly3dcollection_alpha():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+
+ poly1 = np.array([[0, 0, 1], [0, 1, 1], [0, 0, 0]], float)
+ poly2 = np.array([[0, 1, 1], [1, 1, 1], [1, 1, 0]], float)
+ c1 = art3d.Poly3DCollection([poly1], linewidths=3, edgecolor='k',
+ facecolor=(0.5, 0.5, 1), closed=True)
+ c1.set_alpha(0.5)
+ c2 = art3d.Poly3DCollection([poly2], linewidths=3, closed=False)
+ # Post-creation modification should work.
+ c2.set_facecolor((1, 0.5, 0.5))
+ c2.set_edgecolor('k')
+ c2.set_alpha(0.5)
+ ax.add_collection3d(c1)
+ ax.add_collection3d(c2)
+
+
+@mpl3d_image_comparison(['add_collection3d_zs_array.png'])
+def test_add_collection3d_zs_array():
+ theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
+ z = np.linspace(-2, 2, 100)
+ r = z**2 + 1
+ x = r * np.sin(theta)
+ y = r * np.cos(theta)
+
+ points = np.column_stack([x, y, z]).reshape(-1, 1, 3)
+ segments = np.concatenate([points[:-1], points[1:]], axis=1)
+
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+
+ norm = plt.Normalize(0, 2*np.pi)
+ # 2D LineCollection from x & y values
+ lc = LineCollection(segments[:, :, :2], cmap='twilight', norm=norm)
+ lc.set_array(np.mod(theta, 2*np.pi))
+ # Add 2D collection at z values to ax
+ line = ax.add_collection3d(lc, zs=segments[:, :, 2])
+
+ assert line is not None
+
+ ax.set_xlim(-5, 5)
+ ax.set_ylim(-4, 6)
+ ax.set_zlim(-2, 2)
+
+
+@mpl3d_image_comparison(['add_collection3d_zs_scalar.png'])
+def test_add_collection3d_zs_scalar():
+ theta = np.linspace(0, 2 * np.pi, 100)
+ z = 1
+ r = z**2 + 1
+ x = r * np.sin(theta)
+ y = r * np.cos(theta)
+
+ points = np.column_stack([x, y]).reshape(-1, 1, 2)
+ segments = np.concatenate([points[:-1], points[1:]], axis=1)
+
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+
+ norm = plt.Normalize(0, 2*np.pi)
+ lc = LineCollection(segments, cmap='twilight', norm=norm)
+ lc.set_array(theta)
+ line = ax.add_collection3d(lc, zs=z)
+
+ assert line is not None
+
+ ax.set_xlim(-5, 5)
+ ax.set_ylim(-4, 6)
+ ax.set_zlim(0, 2)
+
+
+@mpl3d_image_comparison(['axes3d_labelpad.png'], remove_text=False)
+def test_axes3d_labelpad():
+ fig = plt.figure()
+ ax = fig.add_axes(Axes3D(fig, auto_add_to_figure=False))
+ # labelpad respects rcParams
+ assert ax.xaxis.labelpad == mpl.rcParams['axes.labelpad']
+ # labelpad can be set in set_label
+ ax.set_xlabel('X LABEL', labelpad=10)
+ assert ax.xaxis.labelpad == 10
+ ax.set_ylabel('Y LABEL')
+ ax.set_zlabel('Z LABEL')
+ # or manually
+ ax.yaxis.labelpad = 20
+ ax.zaxis.labelpad = -40
+
+ # Tick labels also respect tick.pad (also from rcParams)
+ for i, tick in enumerate(ax.yaxis.get_major_ticks()):
+ tick.set_pad(tick.get_pad() - i * 5)
+
+
+@mpl3d_image_comparison(['axes3d_cla.png'], remove_text=False)
+def test_axes3d_cla():
+ # fixed in pull request 4553
+ fig = plt.figure()
+ ax = fig.add_subplot(1, 1, 1, projection='3d')
+ ax.set_axis_off()
+ ax.cla() # make sure the axis displayed is 3D (not 2D)
+
+
+@mpl3d_image_comparison(['axes3d_rotated.png'], remove_text=False)
+def test_axes3d_rotated():
+ fig = plt.figure()
+ ax = fig.add_subplot(1, 1, 1, projection='3d')
+ ax.view_init(90, 45) # look down, rotated. Should be square
+
+
+def test_plotsurface_1d_raises():
+ x = np.linspace(0.5, 10, num=100)
+ y = np.linspace(0.5, 10, num=100)
+ X, Y = np.meshgrid(x, y)
+ z = np.random.randn(100)
+
+ fig = plt.figure(figsize=(14, 6))
+ ax = fig.add_subplot(1, 2, 1, projection='3d')
+ with pytest.raises(ValueError):
+ ax.plot_surface(X, Y, z)
+
+
+def _test_proj_make_M():
+ # eye point
+ E = np.array([1000, -1000, 2000])
+ R = np.array([100, 100, 100])
+ V = np.array([0, 0, 1])
+ viewM = proj3d.view_transformation(E, R, V)
+ perspM = proj3d.persp_transformation(100, -100)
+ M = np.dot(perspM, viewM)
+ return M
+
+
+def test_proj_transform():
+ M = _test_proj_make_M()
+
+ xs = np.array([0, 1, 1, 0, 0, 0, 1, 1, 0, 0]) * 300.0
+ ys = np.array([0, 0, 1, 1, 0, 0, 0, 1, 1, 0]) * 300.0
+ zs = np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1]) * 300.0
+
+ txs, tys, tzs = proj3d.proj_transform(xs, ys, zs, M)
+ ixs, iys, izs = proj3d.inv_transform(txs, tys, tzs, M)
+
+ np.testing.assert_almost_equal(ixs, xs)
+ np.testing.assert_almost_equal(iys, ys)
+ np.testing.assert_almost_equal(izs, zs)
+
+
+def _test_proj_draw_axes(M, s=1, *args, **kwargs):
+ xs = [0, s, 0, 0]
+ ys = [0, 0, s, 0]
+ zs = [0, 0, 0, s]
+ txs, tys, tzs = proj3d.proj_transform(xs, ys, zs, M)
+ o, ax, ay, az = zip(txs, tys)
+ lines = [(o, ax), (o, ay), (o, az)]
+
+ fig, ax = plt.subplots(*args, **kwargs)
+ linec = LineCollection(lines)
+ ax.add_collection(linec)
+ for x, y, t in zip(txs, tys, ['o', 'x', 'y', 'z']):
+ ax.text(x, y, t)
+
+ return fig, ax
+
+
+@mpl3d_image_comparison(['proj3d_axes_cube.png'])
+def test_proj_axes_cube():
+ M = _test_proj_make_M()
+
+ ts = '0 1 2 3 0 4 5 6 7 4'.split()
+ xs = np.array([0, 1, 1, 0, 0, 0, 1, 1, 0, 0]) * 300.0
+ ys = np.array([0, 0, 1, 1, 0, 0, 0, 1, 1, 0]) * 300.0
+ zs = np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1]) * 300.0
+
+ txs, tys, tzs = proj3d.proj_transform(xs, ys, zs, M)
+
+ fig, ax = _test_proj_draw_axes(M, s=400)
+
+ ax.scatter(txs, tys, c=tzs)
+ ax.plot(txs, tys, c='r')
+ for x, y, t in zip(txs, tys, ts):
+ ax.text(x, y, t)
+
+ ax.set_xlim(-0.2, 0.2)
+ ax.set_ylim(-0.2, 0.2)
+
+
+@mpl3d_image_comparison(['proj3d_axes_cube_ortho.png'])
+def test_proj_axes_cube_ortho():
+ E = np.array([200, 100, 100])
+ R = np.array([0, 0, 0])
+ V = np.array([0, 0, 1])
+ viewM = proj3d.view_transformation(E, R, V)
+ orthoM = proj3d.ortho_transformation(-1, 1)
+ M = np.dot(orthoM, viewM)
+
+ ts = '0 1 2 3 0 4 5 6 7 4'.split()
+ xs = np.array([0, 1, 1, 0, 0, 0, 1, 1, 0, 0]) * 100
+ ys = np.array([0, 0, 1, 1, 0, 0, 0, 1, 1, 0]) * 100
+ zs = np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1]) * 100
+
+ txs, tys, tzs = proj3d.proj_transform(xs, ys, zs, M)
+
+ fig, ax = _test_proj_draw_axes(M, s=150)
+
+ ax.scatter(txs, tys, s=300-tzs)
+ ax.plot(txs, tys, c='r')
+ for x, y, t in zip(txs, tys, ts):
+ ax.text(x, y, t)
+
+ ax.set_xlim(-200, 200)
+ ax.set_ylim(-200, 200)
+
+
+def test_rot():
+ V = [1, 0, 0, 1]
+ rotated_V = proj3d.rot_x(V, np.pi / 6)
+ np.testing.assert_allclose(rotated_V, [1, 0, 0, 1])
+
+ V = [0, 1, 0, 1]
+ rotated_V = proj3d.rot_x(V, np.pi / 6)
+ np.testing.assert_allclose(rotated_V, [0, np.sqrt(3) / 2, 0.5, 1])
+
+
+def test_world():
+ xmin, xmax = 100, 120
+ ymin, ymax = -100, 100
+ zmin, zmax = 0.1, 0.2
+ M = proj3d.world_transformation(xmin, xmax, ymin, ymax, zmin, zmax)
+ np.testing.assert_allclose(M,
+ [[5e-2, 0, 0, -5],
+ [0, 5e-3, 0, 5e-1],
+ [0, 0, 1e1, -1],
+ [0, 0, 0, 1]])
+
+
+@mpl3d_image_comparison(['proj3d_lines_dists.png'])
+def test_lines_dists():
+ fig, ax = plt.subplots(figsize=(4, 6), subplot_kw=dict(aspect='equal'))
+
+ xs = (0, 30)
+ ys = (20, 150)
+ ax.plot(xs, ys)
+ p0, p1 = zip(xs, ys)
+
+ xs = (0, 0, 20, 30)
+ ys = (100, 150, 30, 200)
+ ax.scatter(xs, ys)
+
+ dist = proj3d._line2d_seg_dist(p0, p1, (xs[0], ys[0]))
+ dist = proj3d._line2d_seg_dist(p0, p1, np.array((xs, ys)))
+ for x, y, d in zip(xs, ys, dist):
+ c = Circle((x, y), d, fill=0)
+ ax.add_patch(c)
+
+ ax.set_xlim(-50, 150)
+ ax.set_ylim(0, 300)
+
+
+def test_autoscale():
+ fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
+ ax.margins(x=0, y=.1, z=.2)
+ ax.plot([0, 1], [0, 1], [0, 1])
+ assert ax.get_w_lims() == (0, 1, -.1, 1.1, -.2, 1.2)
+ ax.autoscale(False)
+ ax.set_autoscalez_on(True)
+ ax.plot([0, 2], [0, 2], [0, 2])
+ assert ax.get_w_lims() == (0, 1, -.1, 1.1, -.4, 2.4)
+
+
+@pytest.mark.parametrize('axis', ('x', 'y', 'z'))
+@pytest.mark.parametrize('auto', (True, False, None))
+def test_unautoscale(axis, auto):
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+
+ x = np.arange(100)
+ y = np.linspace(-0.1, 0.1, 100)
+ ax.scatter(x, y)
+
+ get_autoscale_on = getattr(ax, f'get_autoscale{axis}_on')
+ set_lim = getattr(ax, f'set_{axis}lim')
+ get_lim = getattr(ax, f'get_{axis}lim')
+
+ post_auto = get_autoscale_on() if auto is None else auto
+
+ set_lim((-0.5, 0.5), auto=auto)
+ assert post_auto == get_autoscale_on()
+ fig.canvas.draw()
+ np.testing.assert_array_equal(get_lim(), (-0.5, 0.5))
+
+
+@mpl3d_image_comparison(['axes3d_ortho.png'], remove_text=False)
+def test_axes3d_ortho():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ ax.set_proj_type('ortho')
+
+
+@mpl3d_image_comparison(['axes3d_isometric.png'])
+def test_axes3d_isometric():
+ from itertools import combinations, product
+ fig, ax = plt.subplots(subplot_kw=dict(
+ projection='3d',
+ proj_type='ortho',
+ box_aspect=(4, 4, 4)
+ ))
+ r = (-1, 1) # stackoverflow.com/a/11156353
+ for s, e in combinations(np.array(list(product(r, r, r))), 2):
+ if abs(s - e).sum() == r[1] - r[0]:
+ ax.plot3D(*zip(s, e), c='k')
+ ax.view_init(elev=np.degrees(np.arctan(1. / np.sqrt(2))), azim=-45)
+ ax.grid(True)
+
+
+@pytest.mark.parametrize('value', [np.inf, np.nan])
+@pytest.mark.parametrize(('setter', 'side'), [
+ ('set_xlim3d', 'left'),
+ ('set_xlim3d', 'right'),
+ ('set_ylim3d', 'bottom'),
+ ('set_ylim3d', 'top'),
+ ('set_zlim3d', 'bottom'),
+ ('set_zlim3d', 'top'),
+])
+def test_invalid_axes_limits(setter, side, value):
+ limit = {side: value}
+ fig = plt.figure()
+ obj = fig.add_subplot(projection='3d')
+ with pytest.raises(ValueError):
+ getattr(obj, setter)(**limit)
+
+
+class TestVoxels:
+ @mpl3d_image_comparison(['voxels-simple.png'])
+ def test_simple(self):
+ fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
+
+ x, y, z = np.indices((5, 4, 3))
+ voxels = (x == y) | (y == z)
+ ax.voxels(voxels)
+
+ @mpl3d_image_comparison(['voxels-edge-style.png'])
+ def test_edge_style(self):
+ fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
+
+ x, y, z = np.indices((5, 5, 4))
+ voxels = ((x - 2)**2 + (y - 2)**2 + (z-1.5)**2) < 2.2**2
+ v = ax.voxels(voxels, linewidths=3, edgecolor='C1')
+
+ # change the edge color of one voxel
+ v[max(v.keys())].set_edgecolor('C2')
+
+ @mpl3d_image_comparison(['voxels-named-colors.png'])
+ def test_named_colors(self):
+ """Test with colors set to a 3D object array of strings."""
+ fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
+
+ x, y, z = np.indices((10, 10, 10))
+ voxels = (x == y) | (y == z)
+ voxels = voxels & ~(x * y * z < 1)
+ colors = np.full((10, 10, 10), 'C0', dtype=np.object_)
+ colors[(x < 5) & (y < 5)] = '0.25'
+ colors[(x + z) < 10] = 'cyan'
+ ax.voxels(voxels, facecolors=colors)
+
+ @mpl3d_image_comparison(['voxels-rgb-data.png'])
+ def test_rgb_data(self):
+ """Test with colors set to a 4d float array of rgb data."""
+ fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
+
+ x, y, z = np.indices((10, 10, 10))
+ voxels = (x == y) | (y == z)
+ colors = np.zeros((10, 10, 10, 3))
+ colors[..., 0] = x / 9
+ colors[..., 1] = y / 9
+ colors[..., 2] = z / 9
+ ax.voxels(voxels, facecolors=colors)
+
+ @mpl3d_image_comparison(['voxels-alpha.png'])
+ def test_alpha(self):
+ fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
+
+ x, y, z = np.indices((10, 10, 10))
+ v1 = x == y
+ v2 = np.abs(x - y) < 2
+ voxels = v1 | v2
+ colors = np.zeros((10, 10, 10, 4))
+ colors[v2] = [1, 0, 0, 0.5]
+ colors[v1] = [0, 1, 0, 0.5]
+ v = ax.voxels(voxels, facecolors=colors)
+
+ assert type(v) is dict
+ for coord, poly in v.items():
+ assert voxels[coord], "faces returned for absent voxel"
+ assert isinstance(poly, art3d.Poly3DCollection)
+
+ @mpl3d_image_comparison(['voxels-xyz.png'], tol=0.01, remove_text=False)
+ def test_xyz(self):
+ fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
+
+ def midpoints(x):
+ sl = ()
+ for i in range(x.ndim):
+ x = (x[sl + np.index_exp[:-1]] +
+ x[sl + np.index_exp[1:]]) / 2.0
+ sl += np.index_exp[:]
+ return x
+
+ # prepare some coordinates, and attach rgb values to each
+ r, g, b = np.indices((17, 17, 17)) / 16.0
+ rc = midpoints(r)
+ gc = midpoints(g)
+ bc = midpoints(b)
+
+ # define a sphere about [0.5, 0.5, 0.5]
+ sphere = (rc - 0.5)**2 + (gc - 0.5)**2 + (bc - 0.5)**2 < 0.5**2
+
+ # combine the color components
+ colors = np.zeros(sphere.shape + (3,))
+ colors[..., 0] = rc
+ colors[..., 1] = gc
+ colors[..., 2] = bc
+
+ # and plot everything
+ ax.voxels(r, g, b, sphere,
+ facecolors=colors,
+ edgecolors=np.clip(2*colors - 0.5, 0, 1), # brighter
+ linewidth=0.5)
+
+ def test_calling_conventions(self):
+ x, y, z = np.indices((3, 4, 5))
+ filled = np.ones((2, 3, 4))
+
+ fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
+
+ # all the valid calling conventions
+ for kw in (dict(), dict(edgecolor='k')):
+ ax.voxels(filled, **kw)
+ ax.voxels(filled=filled, **kw)
+ ax.voxels(x, y, z, filled, **kw)
+ ax.voxels(x, y, z, filled=filled, **kw)
+
+ # duplicate argument
+ with pytest.raises(TypeError, match='voxels'):
+ ax.voxels(x, y, z, filled, filled=filled)
+ # missing arguments
+ with pytest.raises(TypeError, match='voxels'):
+ ax.voxels(x, y)
+ # x, y, z are positional only - this passes them on as attributes of
+ # Poly3DCollection
+ with pytest.raises(AttributeError):
+ ax.voxels(filled=filled, x=x, y=y, z=z)
+
+
+def test_line3d_set_get_data_3d():
+ x, y, z = [0, 1], [2, 3], [4, 5]
+ x2, y2, z2 = [6, 7], [8, 9], [10, 11]
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ lines = ax.plot(x, y, z)
+ line = lines[0]
+ np.testing.assert_array_equal((x, y, z), line.get_data_3d())
+ line.set_data_3d(x2, y2, z2)
+ np.testing.assert_array_equal((x2, y2, z2), line.get_data_3d())
+
+
+@check_figures_equal(extensions=["png"])
+def test_inverted(fig_test, fig_ref):
+ # Plot then invert.
+ ax = fig_test.add_subplot(projection="3d")
+ ax.plot([1, 1, 10, 10], [1, 10, 10, 10], [1, 1, 1, 10])
+ ax.invert_yaxis()
+ # Invert then plot.
+ ax = fig_ref.add_subplot(projection="3d")
+ ax.invert_yaxis()
+ ax.plot([1, 1, 10, 10], [1, 10, 10, 10], [1, 1, 1, 10])
+
+
+def test_inverted_cla():
+ # GitHub PR #5450. Setting autoscale should reset
+ # axes to be non-inverted.
+ fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
+ # 1. test that a new axis is not inverted per default
+ assert not ax.xaxis_inverted()
+ assert not ax.yaxis_inverted()
+ assert not ax.zaxis_inverted()
+ ax.set_xlim(1, 0)
+ ax.set_ylim(1, 0)
+ ax.set_zlim(1, 0)
+ assert ax.xaxis_inverted()
+ assert ax.yaxis_inverted()
+ assert ax.zaxis_inverted()
+ ax.cla()
+ assert not ax.xaxis_inverted()
+ assert not ax.yaxis_inverted()
+ assert not ax.zaxis_inverted()
+
+
+def test_ax3d_tickcolour():
+ fig = plt.figure()
+ with pytest.warns(MatplotlibDeprecationWarning):
+ ax = Axes3D(fig)
+
+ ax.tick_params(axis='x', colors='red')
+ ax.tick_params(axis='y', colors='red')
+ ax.tick_params(axis='z', colors='red')
+ fig.canvas.draw()
+
+ for tick in ax.xaxis.get_major_ticks():
+ assert tick.tick1line._color == 'red'
+ for tick in ax.yaxis.get_major_ticks():
+ assert tick.tick1line._color == 'red'
+ for tick in ax.zaxis.get_major_ticks():
+ assert tick.tick1line._color == 'red'
+
+
+@check_figures_equal(extensions=["png"])
+def test_ticklabel_format(fig_test, fig_ref):
+ axs = fig_test.subplots(4, 5, subplot_kw={"projection": "3d"})
+ for ax in axs.flat:
+ ax.set_xlim(1e7, 1e7 + 10)
+ for row, name in zip(axs, ["x", "y", "z", "both"]):
+ row[0].ticklabel_format(
+ axis=name, style="plain")
+ row[1].ticklabel_format(
+ axis=name, scilimits=(-2, 2))
+ row[2].ticklabel_format(
+ axis=name, useOffset=not mpl.rcParams["axes.formatter.useoffset"])
+ row[3].ticklabel_format(
+ axis=name, useLocale=not mpl.rcParams["axes.formatter.use_locale"])
+ row[4].ticklabel_format(
+ axis=name,
+ useMathText=not mpl.rcParams["axes.formatter.use_mathtext"])
+
+ def get_formatters(ax, names):
+ return [getattr(ax, name).get_major_formatter() for name in names]
+
+ axs = fig_ref.subplots(4, 5, subplot_kw={"projection": "3d"})
+ for ax in axs.flat:
+ ax.set_xlim(1e7, 1e7 + 10)
+ for row, names in zip(
+ axs, [["xaxis"], ["yaxis"], ["zaxis"], ["xaxis", "yaxis", "zaxis"]]
+ ):
+ for fmt in get_formatters(row[0], names):
+ fmt.set_scientific(False)
+ for fmt in get_formatters(row[1], names):
+ fmt.set_powerlimits((-2, 2))
+ for fmt in get_formatters(row[2], names):
+ fmt.set_useOffset(not mpl.rcParams["axes.formatter.useoffset"])
+ for fmt in get_formatters(row[3], names):
+ fmt.set_useLocale(not mpl.rcParams["axes.formatter.use_locale"])
+ for fmt in get_formatters(row[4], names):
+ fmt.set_useMathText(
+ not mpl.rcParams["axes.formatter.use_mathtext"])
+
+
+@check_figures_equal(extensions=["png"])
+def test_quiver3D_smoke(fig_test, fig_ref):
+ pivot = "middle"
+ # Make the grid
+ x, y, z = np.meshgrid(
+ np.arange(-0.8, 1, 0.2),
+ np.arange(-0.8, 1, 0.2),
+ np.arange(-0.8, 1, 0.8)
+ )
+ u = v = w = np.ones_like(x)
+
+ for fig, length in zip((fig_ref, fig_test), (1, 1.0)):
+ ax = fig.add_subplot(projection="3d")
+ ax.quiver(x, y, z, u, v, w, length=length, pivot=pivot)
+
+
+@image_comparison(["minor_ticks.png"], style="mpl20")
+def test_minor_ticks():
+ ax = plt.figure().add_subplot(projection="3d")
+ ax.set_xticks([0.25], minor=True)
+ ax.set_xticklabels(["quarter"], minor=True)
+ ax.set_yticks([0.33], minor=True)
+ ax.set_yticklabels(["third"], minor=True)
+ ax.set_zticks([0.50], minor=True)
+ ax.set_zticklabels(["half"], minor=True)
+
+
+@mpl3d_image_comparison(['errorbar3d_errorevery.png'])
+def test_errorbar3d_errorevery():
+ """Tests errorevery functionality for 3D errorbars."""
+ t = np.arange(0, 2*np.pi+.1, 0.01)
+ x, y, z = np.sin(t), np.cos(3*t), np.sin(5*t)
+
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+
+ estep = 15
+ i = np.arange(t.size)
+ zuplims = (i % estep == 0) & (i // estep % 3 == 0)
+ zlolims = (i % estep == 0) & (i // estep % 3 == 2)
+
+ ax.errorbar(x, y, z, 0.2, zuplims=zuplims, zlolims=zlolims,
+ errorevery=estep)
+
+
+@mpl3d_image_comparison(['errorbar3d.png'])
+def test_errorbar3d():
+ """Tests limits, color styling, and legend for 3D errorbars."""
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+
+ d = [1, 2, 3, 4, 5]
+ e = [.5, .5, .5, .5, .5]
+ ax.errorbar(x=d, y=d, z=d, xerr=e, yerr=e, zerr=e, capsize=3,
+ zuplims=[False, True, False, True, True],
+ zlolims=[True, False, False, True, False],
+ yuplims=True,
+ ecolor='purple', label='Error lines')
+ ax.legend()
+
+
+@image_comparison(['stem3d.png'], style='mpl20',
+ tol=0.0 if platform.machine() == 'x86_64' else 0.003)
+def test_stem3d():
+ fig, axs = plt.subplots(2, 3, figsize=(8, 6),
+ constrained_layout=True,
+ subplot_kw={'projection': '3d'})
+
+ theta = np.linspace(0, 2*np.pi)
+ x = np.cos(theta - np.pi/2)
+ y = np.sin(theta - np.pi/2)
+ z = theta
+
+ for ax, zdir in zip(axs[0], ['x', 'y', 'z']):
+ ax.stem(x, y, z, orientation=zdir)
+ ax.set_title(f'orientation={zdir}')
+
+ x = np.linspace(-np.pi/2, np.pi/2, 20)
+ y = np.ones_like(x)
+ z = np.cos(x)
+
+ for ax, zdir in zip(axs[1], ['x', 'y', 'z']):
+ markerline, stemlines, baseline = ax.stem(
+ x, y, z,
+ linefmt='C4-.', markerfmt='C1D', basefmt='C2',
+ orientation=zdir)
+ ax.set_title(f'orientation={zdir}')
+ markerline.set(markerfacecolor='none', markeredgewidth=2)
+ baseline.set_linewidth(3)
+
+
+@image_comparison(["equal_box_aspect.png"], style="mpl20")
+def test_equal_box_aspect():
+ from itertools import product, combinations
+
+ fig = plt.figure()
+ ax = fig.add_subplot(projection="3d")
+
+ # Make data
+ u = np.linspace(0, 2 * np.pi, 100)
+ v = np.linspace(0, np.pi, 100)
+ x = np.outer(np.cos(u), np.sin(v))
+ y = np.outer(np.sin(u), np.sin(v))
+ z = np.outer(np.ones_like(u), np.cos(v))
+
+ # Plot the surface
+ ax.plot_surface(x, y, z)
+
+ # draw cube
+ r = [-1, 1]
+ for s, e in combinations(np.array(list(product(r, r, r))), 2):
+ if np.sum(np.abs(s - e)) == r[1] - r[0]:
+ ax.plot3D(*zip(s, e), color="b")
+
+ # Make axes limits
+ xyzlim = np.column_stack(
+ [ax.get_xlim3d(), ax.get_ylim3d(), ax.get_zlim3d()]
+ )
+ XYZlim = [min(xyzlim[0]), max(xyzlim[1])]
+ ax.set_xlim3d(XYZlim)
+ ax.set_ylim3d(XYZlim)
+ ax.set_zlim3d(XYZlim)
+ ax.axis('off')
+ ax.set_box_aspect((1, 1, 1))
+
+
+def test_colorbar_pos():
+ num_plots = 2
+ fig, axs = plt.subplots(1, num_plots, figsize=(4, 5),
+ constrained_layout=True,
+ subplot_kw={'projection': '3d'})
+ for ax in axs:
+ p_tri = ax.plot_trisurf(np.random.randn(5), np.random.randn(5),
+ np.random.randn(5))
+
+ cbar = plt.colorbar(p_tri, ax=axs, orientation='horizontal')
+
+ fig.canvas.draw()
+ # check that actually on the bottom
+ assert cbar.ax.get_position().extents[1] < 0.2
+
+
+def test_shared_axes_retick():
+ fig = plt.figure()
+ ax1 = fig.add_subplot(211, projection="3d")
+ ax2 = fig.add_subplot(212, projection="3d", sharez=ax1)
+ ax1.plot([0, 1], [0, 1], [0, 2])
+ ax2.plot([0, 1], [0, 1], [0, 2])
+ ax1.set_zticks([-0.5, 0, 2, 2.5])
+ # check that setting ticks on a shared axis is synchronized
+ assert ax1.get_zlim() == (-0.5, 2.5)
+ assert ax2.get_zlim() == (-0.5, 2.5)
+
+
+def test_pan():
+ """Test mouse panning using the middle mouse button."""
+
+ def convert_lim(dmin, dmax):
+ """Convert min/max limits to center and range."""
+ center = (dmin + dmax) / 2
+ range_ = dmax - dmin
+ return center, range_
+
+ ax = plt.figure().add_subplot(projection='3d')
+ ax.scatter(0, 0, 0)
+ ax.figure.canvas.draw()
+
+ x_center0, x_range0 = convert_lim(*ax.get_xlim3d())
+ y_center0, y_range0 = convert_lim(*ax.get_ylim3d())
+ z_center0, z_range0 = convert_lim(*ax.get_zlim3d())
+
+ # move mouse diagonally to pan along all axis.
+ ax._button_press(
+ mock_event(ax, button=MouseButton.MIDDLE, xdata=0, ydata=0))
+ ax._on_move(
+ mock_event(ax, button=MouseButton.MIDDLE, xdata=1, ydata=1))
+
+ x_center, x_range = convert_lim(*ax.get_xlim3d())
+ y_center, y_range = convert_lim(*ax.get_ylim3d())
+ z_center, z_range = convert_lim(*ax.get_zlim3d())
+
+ # Ranges have not changed
+ assert x_range == pytest.approx(x_range0)
+ assert y_range == pytest.approx(y_range0)
+ assert z_range == pytest.approx(z_range0)
+
+ # But center positions have
+ assert x_center != pytest.approx(x_center0)
+ assert y_center != pytest.approx(y_center0)
+ assert z_center != pytest.approx(z_center0)
+
+
+@pytest.mark.style('default')
+@check_figures_equal(extensions=["png"])
+def test_scalarmap_update(fig_test, fig_ref):
+
+ x, y, z = np.array((list(itertools.product(*[np.arange(0, 5, 1),
+ np.arange(0, 5, 1),
+ np.arange(0, 5, 1)])))).T
+ c = x + y
+
+ # test
+ ax_test = fig_test.add_subplot(111, projection='3d')
+ sc_test = ax_test.scatter(x, y, z, c=c, s=40, cmap='viridis')
+ # force a draw
+ fig_test.canvas.draw()
+ # mark it as "stale"
+ sc_test.changed()
+
+ # ref
+ ax_ref = fig_ref.add_subplot(111, projection='3d')
+ sc_ref = ax_ref.scatter(x, y, z, c=c, s=40, cmap='viridis')
+
+
+def test_subfigure_simple():
+ # smoketest that subfigures can work...
+ fig = plt.figure()
+ sf = fig.subfigures(1, 2)
+ ax = sf[0].add_subplot(1, 1, 1, projection='3d')
+ ax = sf[1].add_subplot(1, 1, 1, projection='3d', label='other')
+
+
+@image_comparison(baseline_images=['scatter_spiral.png'],
+ remove_text=True,
+ style='default')
+def test_scatter_spiral():
+ fig = plt.figure()
+ ax = fig.add_subplot(projection='3d')
+ th = np.linspace(0, 2 * np.pi * 6, 256)
+ sc = ax.scatter(np.sin(th), np.cos(th), th, s=(1 + th * 5), c=th ** 2)
+
+ # force at least 1 draw!
+ fig.canvas.draw()
diff --git a/venv/Lib/site-packages/numpy-1.20.3.dist-info/INSTALLER b/venv/Lib/site-packages/numpy-1.20.3.dist-info/INSTALLER
new file mode 100644
index 0000000..a1b589e
--- /dev/null
+++ b/venv/Lib/site-packages/numpy-1.20.3.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/venv/Lib/site-packages/numpy-1.20.3.dist-info/LICENSE.txt b/venv/Lib/site-packages/numpy-1.20.3.dist-info/LICENSE.txt
new file mode 100644
index 0000000..04619f5
--- /dev/null
+++ b/venv/Lib/site-packages/numpy-1.20.3.dist-info/LICENSE.txt
@@ -0,0 +1,938 @@
+
+----
+
+This binary distribution of NumPy also bundles the following software:
+
+
+Name: OpenBLAS
+Files: extra-dll\libopenb*.dll
+Description: bundled as a dynamically linked library
+Availability: https://github.com/xianyi/OpenBLAS/
+License: 3-clause BSD
+ Copyright (c) 2011-2014, The OpenBLAS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. Neither the name of the OpenBLAS project nor the names of
+ its contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Name: LAPACK
+Files: extra-dll\libopenb*.dll
+Description: bundled in OpenBLAS
+Availability: https://github.com/xianyi/OpenBLAS/
+License 3-clause BSD
+ Copyright (c) 1992-2013 The University of Tennessee and The University
+ of Tennessee Research Foundation. All rights
+ reserved.
+ Copyright (c) 2000-2013 The University of California Berkeley. All
+ rights reserved.
+ Copyright (c) 2006-2013 The University of Colorado Denver. All rights
+ reserved.
+
+ $COPYRIGHT$
+
+ Additional copyrights may follow
+
+ $HEADER$
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer listed
+ in this license in the documentation and/or other materials
+ provided with the distribution.
+
+ - Neither the name of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ The copyright holders provide no reassurances that the source code
+ provided does not infringe any patent, copyright, or any other
+ intellectual property rights of third parties. The copyright holders
+ disclaim any liability to any recipient for claims brought against
+ recipient by any third party for infringement of that parties
+ intellectual property rights.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Name: GCC runtime library
+Files: extra-dll\*.dll
+Description: statically linked, in DLL files compiled with gfortran only
+Availability: https://gcc.gnu.org/viewcvs/gcc/
+License: GPLv3 + runtime exception
+ Copyright (C) 2002-2017 Free Software Foundation, Inc.
+
+ Libgfortran is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Libgfortran is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ .
+
+
+Name: Microsoft Visual C++ Runtime Files
+Files: extra-dll\msvcp140.dll
+License: MSVC
+ https://www.visualstudio.com/license-terms/distributable-code-microsoft-visual-studio-2015-rc-microsoft-visual-studio-2015-sdk-rc-includes-utilities-buildserver-files/#visual-c-runtime
+
+ Subject to the License Terms for the software, you may copy and
+ distribute with your program any of the files within the followng
+ folder and its subfolders except as noted below. You may not modify
+ these files.
+
+ C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist
+
+ You may not distribute the contents of the following folders:
+
+ C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\debug_nonredist
+ C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\onecore\debug_nonredist
+
+ Subject to the License Terms for the software, you may copy and
+ distribute the following files with your program in your program’s
+ application local folder or by deploying them into the Global
+ Assembly Cache (GAC):
+
+ VC\atlmfc\lib\mfcmifc80.dll
+ VC\atlmfc\lib\amd64\mfcmifc80.dll
+
+
+Name: Microsoft Visual C++ Runtime Files
+Files: extra-dll\msvc*90.dll, extra-dll\Microsoft.VC90.CRT.manifest
+License: MSVC
+ For your convenience, we have provided the following folders for
+ use when redistributing VC++ runtime files. Subject to the license
+ terms for the software, you may redistribute the folder
+ (unmodified) in the application local folder as a sub-folder with
+ no change to the folder name. You may also redistribute all the
+ files (*.dll and *.manifest) within a folder, listed below the
+ folder for your convenience, as an entire set.
+
+ \VC\redist\x86\Microsoft.VC90.ATL\
+ atl90.dll
+ Microsoft.VC90.ATL.manifest
+ \VC\redist\ia64\Microsoft.VC90.ATL\
+ atl90.dll
+ Microsoft.VC90.ATL.manifest
+ \VC\redist\amd64\Microsoft.VC90.ATL\
+ atl90.dll
+ Microsoft.VC90.ATL.manifest
+ \VC\redist\x86\Microsoft.VC90.CRT\
+ msvcm90.dll
+ msvcp90.dll
+ msvcr90.dll
+ Microsoft.VC90.CRT.manifest
+ \VC\redist\ia64\Microsoft.VC90.CRT\
+ msvcm90.dll
+ msvcp90.dll
+ msvcr90.dll
+ Microsoft.VC90.CRT.manifest
+
+----
+
+Full text of license texts referred to above follows (that they are
+listed below does not necessarily imply the conditions apply to the
+present binary release):
+
+----
+
+GCC RUNTIME LIBRARY EXCEPTION
+
+Version 3.1, 31 March 2009
+
+Copyright (C) 2009 Free Software Foundation, Inc.
+
+Everyone is permitted to copy and distribute verbatim copies of this
+license document, but changing it is not allowed.
+
+This GCC Runtime Library Exception ("Exception") is an additional
+permission under section 7 of the GNU General Public License, version
+3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
+bears a notice placed by the copyright holder of the file stating that
+the file is governed by GPLv3 along with this Exception.
+
+When you use GCC to compile a program, GCC may combine portions of
+certain GCC header files and runtime libraries with the compiled
+program. The purpose of this Exception is to allow compilation of
+non-GPL (including proprietary) programs to use, in this way, the
+header files and runtime libraries covered by this Exception.
+
+0. Definitions.
+
+A file is an "Independent Module" if it either requires the Runtime
+Library for execution after a Compilation Process, or makes use of an
+interface provided by the Runtime Library, but is not otherwise based
+on the Runtime Library.
+
+"GCC" means a version of the GNU Compiler Collection, with or without
+modifications, governed by version 3 (or a specified later version) of
+the GNU General Public License (GPL) with the option of using any
+subsequent versions published by the FSF.
+
+"GPL-compatible Software" is software whose conditions of propagation,
+modification and use would permit combination with GCC in accord with
+the license of GCC.
+
+"Target Code" refers to output from any compiler for a real or virtual
+target processor architecture, in executable form or suitable for
+input to an assembler, loader, linker and/or execution
+phase. Notwithstanding that, Target Code does not include data in any
+format that is used as a compiler intermediate representation, or used
+for producing a compiler intermediate representation.
+
+The "Compilation Process" transforms code entirely represented in
+non-intermediate languages designed for human-written code, and/or in
+Java Virtual Machine byte code, into Target Code. Thus, for example,
+use of source code generators and preprocessors need not be considered
+part of the Compilation Process, since the Compilation Process can be
+understood as starting with the output of the generators or
+preprocessors.
+
+A Compilation Process is "Eligible" if it is done using GCC, alone or
+with other GPL-compatible software, or if it is done without using any
+work based on GCC. For example, using non-GPL-compatible Software to
+optimize any GCC intermediate representations would not qualify as an
+Eligible Compilation Process.
+
+1. Grant of Additional Permission.
+
+You have permission to propagate a work of Target Code formed by
+combining the Runtime Library with Independent Modules, even if such
+propagation would otherwise violate the terms of GPLv3, provided that
+all Target Code was generated by Eligible Compilation Processes. You
+may then convey such a combination under terms of your choice,
+consistent with the licensing of the Independent Modules.
+
+2. No Weakening of GCC Copyleft.
+
+The availability of this Exception does not imply any general
+presumption that third-party software is unaffected by the copyleft
+requirements of the license of GCC.
+
+----
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+ .
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/venv/Lib/site-packages/numpy-1.20.3.dist-info/LICENSES_bundled.txt b/venv/Lib/site-packages/numpy-1.20.3.dist-info/LICENSES_bundled.txt
new file mode 100644
index 0000000..00b7473
--- /dev/null
+++ b/venv/Lib/site-packages/numpy-1.20.3.dist-info/LICENSES_bundled.txt
@@ -0,0 +1,17 @@
+The NumPy repository and source distributions bundle several libraries that are
+compatibly licensed. We list these here.
+
+Name: lapack-lite
+Files: numpy/linalg/lapack_lite/*
+License: BSD-3-Clause
+ For details, see numpy/linalg/lapack_lite/LICENSE.txt
+
+Name: tempita
+Files: tools/npy_tempita/*
+License: MIT
+ For details, see tools/npy_tempita/license.txt
+
+Name: dragon4
+Files: numpy/core/src/multiarray/dragon4.c
+License: MIT
+ For license text, see numpy/core/src/multiarray/dragon4.c
diff --git a/venv/Lib/site-packages/numpy-1.20.3.dist-info/METADATA b/venv/Lib/site-packages/numpy-1.20.3.dist-info/METADATA
new file mode 100644
index 0000000..a9dce0f
--- /dev/null
+++ b/venv/Lib/site-packages/numpy-1.20.3.dist-info/METADATA
@@ -0,0 +1,56 @@
+Metadata-Version: 2.1
+Name: numpy
+Version: 1.20.3
+Summary: NumPy is the fundamental package for array computing with Python.
+Home-page: https://www.numpy.org
+Author: Travis E. Oliphant et al.
+Maintainer: NumPy Developers
+Maintainer-email: numpy-discussion@python.org
+License: BSD
+Download-URL: https://pypi.python.org/pypi/numpy
+Project-URL: Bug Tracker, https://github.com/numpy/numpy/issues
+Project-URL: Documentation, https://numpy.org/doc/1.20
+Project-URL: Source Code, https://github.com/numpy/numpy
+Platform: Windows
+Platform: Linux
+Platform: Solaris
+Platform: Mac OS-X
+Platform: Unix
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Science/Research
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Programming Language :: C
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Topic :: Software Development
+Classifier: Topic :: Scientific/Engineering
+Classifier: Typing :: Typed
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Operating System :: POSIX
+Classifier: Operating System :: Unix
+Classifier: Operating System :: MacOS
+Requires-Python: >=3.7
+
+It provides:
+
+- a powerful N-dimensional array object
+- sophisticated (broadcasting) functions
+- tools for integrating C/C++ and Fortran code
+- useful linear algebra, Fourier transform, and random number capabilities
+- and much more
+
+Besides its obvious scientific uses, NumPy can also be used as an efficient
+multi-dimensional container of generic data. Arbitrary data-types can be
+defined. This allows NumPy to seamlessly and speedily integrate with a wide
+variety of databases.
+
+All NumPy wheels distributed on PyPI are BSD licensed.
+
+
+
diff --git a/venv/Lib/site-packages/numpy-1.20.3.dist-info/RECORD b/venv/Lib/site-packages/numpy-1.20.3.dist-info/RECORD
new file mode 100644
index 0000000..b2397ec
--- /dev/null
+++ b/venv/Lib/site-packages/numpy-1.20.3.dist-info/RECORD
@@ -0,0 +1,1063 @@
+../../Scripts/f2py.exe,sha256=KL9WVbwS4Q_EB6GyHgU4XRj6in-EwjjJ51jEbPcudws,106374
+numpy-1.20.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+numpy-1.20.3.dist-info/LICENSE.txt,sha256=VDW_78UWZhzN_Z729vbkkr7MzLGzi7lj3OKbwZkxrP0,47238
+numpy-1.20.3.dist-info/LICENSES_bundled.txt,sha256=LIMgxkCENPlSsRND8mqjqWqU-7nkH-bRMqz8H8d0M24,505
+numpy-1.20.3.dist-info/METADATA,sha256=RVThz8lnj8XzcXcAyXI2YB9uuZ5CX6l9Uw-gj_JUJUA,2043
+numpy-1.20.3.dist-info/RECORD,,
+numpy-1.20.3.dist-info/WHEEL,sha256=HLtxc_HoM-kGM7FPJVPSnTt0Nv2G3fZEAjT3ICdG8uY,100
+numpy-1.20.3.dist-info/entry_points.txt,sha256=cOAXaHCx7qU-bvE9TStTTZW46RN-s-i6Mz9smnWkL3g,49
+numpy-1.20.3.dist-info/top_level.txt,sha256=4J9lbBMLnAiyxatxh8iRKV5Entd_6-oqbO7pzJjMsPw,6
+numpy/.libs/libopenblas.GK7GX5KEQ4F6UYO3P26ULGBQYHGQO7J4.gfortran-win_amd64.dll,sha256=xm2WtXTTj1eXNc5R_IS0OjMFgKcm2u_KJwbxY-Q_6dM,34413408
+numpy/LICENSE.txt,sha256=VDW_78UWZhzN_Z729vbkkr7MzLGzi7lj3OKbwZkxrP0,47238
+numpy/__config__.py,sha256=IHRa3rupkgR7i9orKgDOiGPeOriQOaDHFF5q7kCETEc,3016
+numpy/__init__.cython-30.pxd,sha256=kg17mANuYQtmc1DmNYwOYCyWcPidN_TCcP0KU6oe4No,37385
+numpy/__init__.pxd,sha256=u2NusfQDgMzoxakO9ePcl81ioWdFfMPa0i6p1xXxU3I,35718
+numpy/__init__.py,sha256=5c-ypjhSjsBLzPlh6eL4BWvuY3b8R6dqMt9JkIaghw4,15676
+numpy/__init__.pyi,sha256=wjIrJEEoBrVRTj6jFD-6JV-iw6Ss5ST2jZj1w5rBHzE,62327
+numpy/__pycache__/__config__.cpython-38.pyc,,
+numpy/__pycache__/__init__.cpython-38.pyc,,
+numpy/__pycache__/_distributor_init.cpython-38.pyc,,
+numpy/__pycache__/_globals.cpython-38.pyc,,
+numpy/__pycache__/_pytesttester.cpython-38.pyc,,
+numpy/__pycache__/conftest.cpython-38.pyc,,
+numpy/__pycache__/ctypeslib.cpython-38.pyc,,
+numpy/__pycache__/dual.cpython-38.pyc,,
+numpy/__pycache__/matlib.cpython-38.pyc,,
+numpy/__pycache__/setup.cpython-38.pyc,,
+numpy/__pycache__/version.cpython-38.pyc,,
+numpy/_distributor_init.py,sha256=JOqSUAVCNcvuXYwzfs41kJFHvhLdrqRfp3ZYk5U71Pc,1247
+numpy/_globals.py,sha256=Hn6HQltNo4q5i1uia9p4o0l4H8RCAa9y9DG9rEF5J_M,2384
+numpy/_pytesttester.py,sha256=l1KszmXKpS0O-_nGwVPbM71bt3LiZj6J_OUzH464uhU,6954
+numpy/char.pyi,sha256=1q4RiJ6LG9U8E0wic6eMz-X41aeZ0uqBgQf6Atx6Bxg,771
+numpy/compat/__init__.py,sha256=kryOGy6TD3f9oEXy1sZZOxEMc50A7GtON1yf0nMPzr8,450
+numpy/compat/__pycache__/__init__.cpython-38.pyc,,
+numpy/compat/__pycache__/_inspect.cpython-38.pyc,,
+numpy/compat/__pycache__/py3k.cpython-38.pyc,,
+numpy/compat/__pycache__/setup.cpython-38.pyc,,
+numpy/compat/_inspect.py,sha256=4PWDVD-iE3lZGrBCWdiLMn2oSytssuFszubUkC0oruA,7638
+numpy/compat/py3k.py,sha256=rNPRSpbICl4N5Er9N8Du7IgNY2mKgw8jrH__5-pxfRM,3527
+numpy/compat/setup.py,sha256=PmRas58NGR72H-7OsQj6kElSUeQHjN75qVh5jlQIJmc,345
+numpy/compat/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/compat/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/compat/tests/__pycache__/test_compat.cpython-38.pyc,,
+numpy/compat/tests/test_compat.py,sha256=6i0bPM1Nqw0n3wtMphMU7ul7fkQNwcuH2Xxc9vpnQy8,495
+numpy/conftest.py,sha256=yzmbZ_hizvOf-RT3PLYIYrvhNpj7L2CLBMoPiHMCNQ4,4150
+numpy/core/__init__.py,sha256=D3i0c-7P6m6hvSRyJRXM_u2fp4U35HEKo6YlMkgGceI,5470
+numpy/core/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/core/__pycache__/__init__.cpython-38.pyc,,
+numpy/core/__pycache__/_add_newdocs.cpython-38.pyc,,
+numpy/core/__pycache__/_add_newdocs_scalars.cpython-38.pyc,,
+numpy/core/__pycache__/_asarray.cpython-38.pyc,,
+numpy/core/__pycache__/_dtype.cpython-38.pyc,,
+numpy/core/__pycache__/_dtype_ctypes.cpython-38.pyc,,
+numpy/core/__pycache__/_exceptions.cpython-38.pyc,,
+numpy/core/__pycache__/_internal.cpython-38.pyc,,
+numpy/core/__pycache__/_methods.cpython-38.pyc,,
+numpy/core/__pycache__/_string_helpers.cpython-38.pyc,,
+numpy/core/__pycache__/_type_aliases.cpython-38.pyc,,
+numpy/core/__pycache__/_ufunc_config.cpython-38.pyc,,
+numpy/core/__pycache__/arrayprint.cpython-38.pyc,,
+numpy/core/__pycache__/cversions.cpython-38.pyc,,
+numpy/core/__pycache__/defchararray.cpython-38.pyc,,
+numpy/core/__pycache__/einsumfunc.cpython-38.pyc,,
+numpy/core/__pycache__/fromnumeric.cpython-38.pyc,,
+numpy/core/__pycache__/function_base.cpython-38.pyc,,
+numpy/core/__pycache__/generate_numpy_api.cpython-38.pyc,,
+numpy/core/__pycache__/getlimits.cpython-38.pyc,,
+numpy/core/__pycache__/machar.cpython-38.pyc,,
+numpy/core/__pycache__/memmap.cpython-38.pyc,,
+numpy/core/__pycache__/multiarray.cpython-38.pyc,,
+numpy/core/__pycache__/numeric.cpython-38.pyc,,
+numpy/core/__pycache__/numerictypes.cpython-38.pyc,,
+numpy/core/__pycache__/overrides.cpython-38.pyc,,
+numpy/core/__pycache__/records.cpython-38.pyc,,
+numpy/core/__pycache__/setup.cpython-38.pyc,,
+numpy/core/__pycache__/setup_common.cpython-38.pyc,,
+numpy/core/__pycache__/shape_base.cpython-38.pyc,,
+numpy/core/__pycache__/umath.cpython-38.pyc,,
+numpy/core/__pycache__/umath_tests.cpython-38.pyc,,
+numpy/core/_add_newdocs.py,sha256=khECrR7Rf1cvVcocZXeuIBf-1nylFJKpX8OpQUij2WQ,190584
+numpy/core/_add_newdocs_scalars.py,sha256=Z_1yGo28WECk5w0rN7e7n0GSrh7gsgSRrp02bRUwH_g,8818
+numpy/core/_asarray.py,sha256=APygHZC-8_LtPS4e1DH8uy_AoXW3D4drHKIN5OIBa-U,12595
+numpy/core/_asarray.pyi,sha256=dyUZzE1AIyyuEWY6KYYXlVbzyX-bdFDNUlZiEh4gxeE,1849
+numpy/core/_dtype.py,sha256=rrmrfzsthRMpG42judFTK7s6FJLfuYhMp5NY3F4lAaU,10185
+numpy/core/_dtype_ctypes.py,sha256=O8tYBqU1QzCG1CXviBe6jrgHYnyIPqpci9GEy9lXO08,3790
+numpy/core/_exceptions.py,sha256=AKdiXex1lQsv-tdKzhBbW-m5anJJFXpsWisjz8S3tAY,6342
+numpy/core/_internal.py,sha256=pmRIldMwdXHB4Pe23_utM0mEw0G9TrEUYX4ngBt16xg,27048
+numpy/core/_internal.pyi,sha256=fi4i96SaeVYEbpT5H2EY_A4n7TssO3NRU3qI4oa6PDo,543
+numpy/core/_methods.py,sha256=38u8LpNQ0PlsHXE5BJIuF0rguEFct_hUmQyRizzcIaY,11081
+numpy/core/_multiarray_tests.cp38-win_amd64.pyd,sha256=JLiAX_b9KZ_bbxyJ_EUtw1CdVdXjE3fYQGRaEdq9e3I,110592
+numpy/core/_multiarray_umath.cp38-win_amd64.pyd,sha256=gNkCLr_hJjPhLMpZ3K1RtmQ9HmqbVhZKa1c4aaew_f0,2819072
+numpy/core/_operand_flag_tests.cp38-win_amd64.pyd,sha256=OMm2Z2-AAWbcwDtG_EOck20ZlN1UlhpxSHQaoR5pLx4,13824
+numpy/core/_rational_tests.cp38-win_amd64.pyd,sha256=tThiqjyoZRwZbakumk6i7x8SfYRISJMlNfeF7gyR6ms,47616
+numpy/core/_simd.cp38-win_amd64.pyd,sha256=RJJWh5O1wpvhcjANA33duAimElP5upuDSkSZUQG-M2o,1216512
+numpy/core/_string_helpers.py,sha256=xFVFp6go9I8O7PKRR2zwkOk2VJxlnXTFSYt4s7MwXGM,2955
+numpy/core/_struct_ufunc_tests.cp38-win_amd64.pyd,sha256=CMVR5ILwYD_f7a5HRc3cqRvd84sl9aukIdK3xcGd6Yo,14336
+numpy/core/_type_aliases.py,sha256=r_1GCfxyoTUGZ7eqB9rFyk4wDNcckZmTbn67Diuonlc,8050
+numpy/core/_type_aliases.pyi,sha256=lhTyivGJcuyja-I-1rGx0Op_d_UdFt9kavPeCn_o49w,539
+numpy/core/_ufunc_config.py,sha256=K_L35alWVK-CBKiQDp2Bp2-7LgXPBNmGHVAg5gNJbCg,14271
+numpy/core/_ufunc_config.pyi,sha256=3AvHaqwY0JdSIk-vkagBwag-jh-5ZPdSnPiXAv-Fhf0,1293
+numpy/core/_umath_tests.cp38-win_amd64.pyd,sha256=uy7ZW_5bcVE3zMvmJf3I6zVuvyHytRD9u0V-pJSgeoU,32256
+numpy/core/arrayprint.py,sha256=pNPRgU7-6sxGfFjgIwGwq63e1qBwC1DOYI9_FdNEE-U,61525
+numpy/core/cversions.py,sha256=FISv1d4R917Bi5xJjKKy8Lo6AlFkV00WvSoB7l3acA4,360
+numpy/core/defchararray.py,sha256=A1P1Nn3MwVaIOgeFsrHXVQMLJINdth9gHnE4CU-j4gY,72530
+numpy/core/einsumfunc.py,sha256=iHjDbD_IKRWVFzph2DFfPCEQnSrJhkIQLzv5wv6hVgY,52884
+numpy/core/fromnumeric.py,sha256=YM6L4CbxCAehD4ffYDPhcj0gGp2BlUCTKwQmTGqmK-U,125761
+numpy/core/fromnumeric.pyi,sha256=tsfr98AM-aOQSZtoyyr86RMg78gIHh4h5XgnH1QtSd4,8358
+numpy/core/function_base.py,sha256=kER123X44kuAaFvsJs9-dOMGHcexPCEWwFhF0UQg77Y,19550
+numpy/core/function_base.pyi,sha256=ljHq4Xa6O2HMWNAw1SHtMXfSf81wSy0Bsz0Tk9FjmtI,1593
+numpy/core/generate_numpy_api.py,sha256=5auy8-Wg0VUIwCepuDwAL11gL1P-oiZl7exPIi5BfbU,7348
+numpy/core/getlimits.py,sha256=ifS2q5tI2upbxC3ayqitKERnFT0LjA0rY9hRWPpzdj8,20338
+numpy/core/include/numpy/__multiarray_api.h,sha256=MUlrBTUSGh-t_l7iNOXx9ibJHUYddbKudHdFp6Oxd-4,63548
+numpy/core/include/numpy/__ufunc_api.h,sha256=Jmeal3EUlXxBZFX1zAUFvO7jWFVhvIOyf2DG_TW0X2k,12739
+numpy/core/include/numpy/_neighborhood_iterator_imp.h,sha256=9QiCyQf-O1MEjBJQ7T4JUu_JyUyQhCBZHbwOr7sAlyk,1951
+numpy/core/include/numpy/_numpyconfig.h,sha256=2T66Co5gkAN9DD_kuhsoU9GsKfg5lIFuTi4GxtE71tw,891
+numpy/core/include/numpy/arrayobject.h,sha256=Xt8fnhPhTkbhB313Xj315N3fLi3uYBEPbqNrsF-MUXE,175
+numpy/core/include/numpy/arrayscalars.h,sha256=y624UltRg9QkKVAsdbxZ_nI2td9myIMr44TZk01P-3M,3912
+numpy/core/include/numpy/halffloat.h,sha256=AaeF7vnfAjeoIg5krxbhDn7j_T6CAQIx-HfMBYYmGiQ,1948
+numpy/core/include/numpy/multiarray_api.txt,sha256=XwNLmbQ19nX5b2rOH6cDsFLl6_JrUt1UfQDSBIy9lS8,58809
+numpy/core/include/numpy/ndarrayobject.h,sha256=3GqcdPD2qgESrcH1O5oFlY04HC3aZ_VdN2tuLl65BrQ,10956
+numpy/core/include/numpy/ndarraytypes.h,sha256=nZcsXab2tkm1OAgkKy4FmIqZ_lqQthtsAy7nIjf-WMM,71451
+numpy/core/include/numpy/noprefix.h,sha256=fg28OipEj4EaPsrNGWu4YNZoGK7Bxdm5o45pAO5HaSk,6998
+numpy/core/include/numpy/npy_1_7_deprecated_api.h,sha256=rVhu81d2cL3I3u7eMpWs5qKlYpxaq84VPK4gP0Yk1QM,4394
+numpy/core/include/numpy/npy_3kcompat.h,sha256=LT1FbrrMzRyz4IE_Kxl3SbQ58p5Bp3x1QUHW-PCiPag,16101
+numpy/core/include/numpy/npy_common.h,sha256=vKyvBMPV3BiJGqSYsvUhJoS8qok_VNBMaOkzhLIaOjU,39413
+numpy/core/include/numpy/npy_cpu.h,sha256=LqrGxmouzu91yaBRzpaGAC_WGi7x04EKB1yRYjsXP-0,4042
+numpy/core/include/numpy/npy_endian.h,sha256=_vfSgtUccP2UrI6ag77Gj2mWbBnMKQfsPS2ggNwmJ2A,2714
+numpy/core/include/numpy/npy_interrupt.h,sha256=CjwMAXyJjxLbpbPFpyHrTgT1QDa2mrzQ-5EhGA-feqk,1923
+numpy/core/include/numpy/npy_math.h,sha256=6Ayeks6UG8_61SA4Q1k9x2nCcm9tSmKgBG7hJZQ-AqI,21569
+numpy/core/include/numpy/npy_no_deprecated_api.h,sha256=4-ALjOYp43ACG7z4zdabmQtFsxxKDaqYuQFTbElty1o,586
+numpy/core/include/numpy/npy_os.h,sha256=g6I_-QEotWP0p9g1v-GA_Qibg5HRAhQj46WsZ19fIuw,847
+numpy/core/include/numpy/numpyconfig.h,sha256=k1lxNkL1fQLbGr8rqgUX-D8OzykzWrTiZPF1Qcg4FMU,1453
+numpy/core/include/numpy/old_defines.h,sha256=gxn96tn2uCpdL0yBFEO6H_JDkhikf8Bj-w3x8sOz5Go,6493
+numpy/core/include/numpy/oldnumeric.h,sha256=b2lR7L8Lajka8FQ3HrrkSnekPKYK0v4vsUduS8gWZqc,733
+numpy/core/include/numpy/random/bitgen.h,sha256=V0PTeCTsLhKTq_z0hM8VgDa7jTQUTPASD0MkMaGXrgk,409
+numpy/core/include/numpy/random/distributions.h,sha256=9JVj1WgcIBxzXhez8EO3JUlyMmCKGfCoQbS9PUCNE_Y,9910
+numpy/core/include/numpy/ufunc_api.txt,sha256=8gADu8fBcUgFZV0yMbJwa1CtJKJsPVrx8MjuXsu18aw,7397
+numpy/core/include/numpy/ufuncobject.h,sha256=P5b7oDLvsE4sYGLxQ8gNDSN-f__LR064FV4duDq97Uw,13127
+numpy/core/include/numpy/utils.h,sha256=LX_d9Fbe_BleyoYLy4wQgwrsF924qKLs7mAjejkdUCw,1161
+numpy/core/lib/npy-pkg-config/mlib.ini,sha256=mQBSOI6opCVmMZK4vwIhLe5J7YevO3PbaHsI0MlJGHs,151
+numpy/core/lib/npy-pkg-config/npymath.ini,sha256=5dwvhvbX3a_9toniEDvGPDGChbXIfFiLa36H4YOR-vw,380
+numpy/core/lib/npymath.lib,sha256=uky8FFF9udOUG710JreizvCxtqc4jj3yzBbyOAcfuxU,106590
+numpy/core/machar.py,sha256=AhzxGy1gnrp-M-ikLzi9nm-Rb1vuUZsmqmnud8qen_g,11157
+numpy/core/memmap.py,sha256=WB-4tIRvywLS3rP2ueuroj4pbySSGWJe-Ww88D5mm4g,12061
+numpy/core/multiarray.py,sha256=1AcQPxGOSLkFEXSAn_PFX7l-W1ZyxIBHaRcXYHtoIu0,56546
+numpy/core/numeric.py,sha256=tJHnnSa6GLuDl6p7dJiRaAoqqMuTKEwEV-s_tu0loNk,79200
+numpy/core/numeric.pyi,sha256=tLWxkvlObJrYg8LTkKnOfLSUdGw8Vc93nc7ESYLKsf8,5090
+numpy/core/numerictypes.py,sha256=K9TPRmuwMuOJkpgPnKOhtyFTLe0YgQzg-0pM4XbZhnc,18039
+numpy/core/numerictypes.pyi,sha256=9Z1EQNv6G_Nd3rbQpidEUQzdlunUe6a_wrHiFiUZ19M,1077
+numpy/core/overrides.py,sha256=kF571-2fsMrWD1JgHIc_phB4nNPXTdRxoyLktEm2z18,8504
+numpy/core/records.py,sha256=LcIJr6jw3LmRq4aeKwHmQA4gMYn_7h_yMhKleGzW1eQ,38985
+numpy/core/setup.py,sha256=aDmpYk-1NFj8TE-83cJVTx60yLcQYOwNmhVdyletDFQ,45605
+numpy/core/setup_common.py,sha256=VyODljaWE-HUO8LJc90eac9gwNhsZUnfiooWHfUq8IU,20096
+numpy/core/shape_base.py,sha256=gHxRwsy1nLum7iEK_JyXfkswQByPUmFwASL1w4Jxz8c,29922
+numpy/core/shape_base.pyi,sha256=IZbT7mAiA3unDXKgd_tz3pp-Dg2p41sWInS5MWbbsuA,1180
+numpy/core/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/core/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/core/tests/__pycache__/_locales.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test__exceptions.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_abc.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_api.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_array_coercion.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_arrayprint.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_casting_unittests.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_conversion_utils.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_cpu_dispatcher.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_cpu_features.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_cython.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_datetime.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_defchararray.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_deprecations.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_dtype.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_einsum.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_errstate.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_extint128.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_function_base.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_getlimits.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_half.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_indexerrors.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_indexing.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_item_selection.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_longdouble.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_machar.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_mem_overlap.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_memmap.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_multiarray.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_nditer.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_numeric.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_numerictypes.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_overrides.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_print.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_protocols.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_records.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_regression.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_scalar_ctors.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_scalar_methods.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_scalarbuffer.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_scalarinherit.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_scalarmath.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_scalarprint.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_shape_base.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_simd.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_simd_module.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_ufunc.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_umath.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_umath_accuracy.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_umath_complex.cpython-38.pyc,,
+numpy/core/tests/__pycache__/test_unicode.cpython-38.pyc,,
+numpy/core/tests/_locales.py,sha256=PAV24baH5MIl_gH_VBi5glF-7kgifkK00WnAP0Hhc60,2266
+numpy/core/tests/data/astype_copy.pkl,sha256=lWSzCcvzRB_wpuRGj92spGIw-rNPFcd9hwJaRVvfWdk,716
+numpy/core/tests/data/recarray_from_file.fits,sha256=NA0kliz31FlLnYxv3ppzeruONqNYkuEvts5wzXEeIc4,8640
+numpy/core/tests/data/umath-validation-set-README,sha256=hhKRS9byn4eKEJ_LHoHDYQnVArbEXPIKQtPdPBUtGbk,974
+numpy/core/tests/data/umath-validation-set-cos,sha256=WO94BFik3VcliW2QBStw3Srpfd5Ykcxd-7phRf0be4Y,23898
+numpy/core/tests/data/umath-validation-set-exp,sha256=mPhjF4KLe0bdwx38SJiNipD24ntLI_5aWc8h-V0UMgM,17903
+numpy/core/tests/data/umath-validation-set-log,sha256=CDPky64PjaURWhqkHxkLElmMiI21v5ugGGyzhdfUbnI,11963
+numpy/core/tests/data/umath-validation-set-sin,sha256=0nDRTZc1YG_zbDgpGYtMrf63nUTc8bzcCwEVWqkBqio,23705
+numpy/core/tests/examples/__pycache__/setup.cpython-38.pyc,,
+numpy/core/tests/examples/checks.pyx,sha256=nZXyjisKEKm2vVXM42k-P4h0BGLoa42ABHIGENJegC4,618
+numpy/core/tests/examples/setup.py,sha256=JvbvFHHdkZx_eajlwMTtqHijLD-TZwXCZlRySAe-y94,521
+numpy/core/tests/test__exceptions.py,sha256=_jJh6Xunn9GVkkRab3PJ5xzRn5mCdb5RHxE77F5ds5I,2063
+numpy/core/tests/test_abc.py,sha256=KbyIH9nsGOnXQ8VtnwU6QyUgaFDC0XfEs476CnJ_-Wg,2382
+numpy/core/tests/test_api.py,sha256=LOzoU-9GSjU6D0Tz2SXQEIaMG8GKmQJu98hM7lrbeuk,22227
+numpy/core/tests/test_array_coercion.py,sha256=x7g0Y9POUoVQJJRJ7iGjsVZsY0KHHgmZ760V1pjwpk4,28578
+numpy/core/tests/test_arrayprint.py,sha256=9YfFGZL22BAFQW-Zh3wzZlugzJuU_dN64hJWVDU1eSU,37869
+numpy/core/tests/test_casting_unittests.py,sha256=AvWa8TevaT9OY1vic6-7v2zmKCagKgbHHLUNe9Y1ois,12192
+numpy/core/tests/test_conversion_utils.py,sha256=HB-6IpP4XD5tL_FM5Oat--gQ02MI_WG8BX0P5eyvUZg,6616
+numpy/core/tests/test_cpu_dispatcher.py,sha256=gEEzMPLo057xBh7GmwXwV4ikBC2X1P0XtHUlAkbppU0,1561
+numpy/core/tests/test_cpu_features.py,sha256=wcKrzblzXmZxGg8gdtw1Vn3XAG3d0Kl7TW6Lz0oyprQ,6956
+numpy/core/tests/test_cython.py,sha256=SkCZWMLnSnDUKJjWLfbUHYx5EEgcZ8mghpAJbYs5fX0,3663
+numpy/core/tests/test_datetime.py,sha256=B5ufTlNeIAETvkIYaspc_RZ2lnn2DeJtmdCsSEfSWaY,112219
+numpy/core/tests/test_defchararray.py,sha256=VhAlRKEJSrcWcrZbZruagw1170409taptPGauwxp-HM,25256
+numpy/core/tests/test_deprecations.py,sha256=Ni2OF0djqEcSu0NbC6xmIEZoBHBkQAM-OkMmyOayhEQ,35158
+numpy/core/tests/test_dtype.py,sha256=07ZiqOtBnoj8E2Ss7eNDWB6dLpKNzulmnm1Xk9qsuq8,56019
+numpy/core/tests/test_einsum.py,sha256=GsmB2gxsAu9NQ3gg3ASWoYaUhFui91uHig-B5CXRqT4,47891
+numpy/core/tests/test_errstate.py,sha256=kNCMfKs1xgXUrIRQM4qB8fEkVbREVE-p-yG2hsuHjd4,2125
+numpy/core/tests/test_extint128.py,sha256=b8vP_hDPltdHoxWBn2vAmOgjJe2NVW_vjnatdCOtxu8,5862
+numpy/core/tests/test_function_base.py,sha256=FjbJ8JMRcbBxllRXRZhxbE6nlfP1HL8I4kfyW8RKr0s,14820
+numpy/core/tests/test_getlimits.py,sha256=m2xfs_MhozzD88pqRoD00GlMbA-biaK0tEMmBW0vt9g,4418
+numpy/core/tests/test_half.py,sha256=7vZngTRJJ45h4XUFws9fpHI_gYKPq9pz_DKUhZf8lEk,24370
+numpy/core/tests/test_indexerrors.py,sha256=iJu4EorQks1MmiwTV-fda-vd4HfCEwv9_Ba_rVea7xw,5263
+numpy/core/tests/test_indexing.py,sha256=uAOckiHJcPqVbEOTXDaJspUfYqWgshWxllWd5WtxQDA,54782
+numpy/core/tests/test_item_selection.py,sha256=8AukBkttHRVkRBujEDDSW0AN1i6FvRDeJO5Cot9teFc,3665
+numpy/core/tests/test_longdouble.py,sha256=0xWqtJdc-MUfxxZutfuI9W9d-hv_LouFb3355QU0UHE,13410
+numpy/core/tests/test_machar.py,sha256=o4LNEPRU2p0fzok8AiO2Y9vIoZUfWQvqMN2_rJqLoKE,1096
+numpy/core/tests/test_mem_overlap.py,sha256=Sc29ERD4HWExeUA43J96-4QBTkZS4dS_RUrb_DJLbwM,29781
+numpy/core/tests/test_memmap.py,sha256=kJauOy8Wr7iakTXmS-RTaOWZAlglrn7aFGEcP-ThHuw,7808
+numpy/core/tests/test_multiarray.py,sha256=_5Kz-Tbq3nB6MZ-L2PLfwctaALXaMwHzCdi9Hu7JBTs,337726
+numpy/core/tests/test_nditer.py,sha256=IMUp8mXI5llHk5EIbNg58BJEbmttFwCk12Or1HzJB-Q,120404
+numpy/core/tests/test_numeric.py,sha256=K3v2uCXEQDrP95gXMqCYBUlmOmbuoK6lrGE6DWP02d0,135870
+numpy/core/tests/test_numerictypes.py,sha256=c-xwoz-oawJff09G0tri2Q9FJQ0NLkH3vf_zmwGnheg,21400
+numpy/core/tests/test_overrides.py,sha256=_NnwFNETDokYrVxt2eFJfzPxx2qWtvbC0mJDVS2YFuE,20648
+numpy/core/tests/test_print.py,sha256=I3-R4iNbFjmVdl5xHPb9ezYb4zDfdXNfzVZt3Lz3bqU,6937
+numpy/core/tests/test_protocols.py,sha256=Etu0M6T-xFJjAyXy2EcCH48Tbe5VRnZCySjMy0RhbPY,1212
+numpy/core/tests/test_records.py,sha256=910AOqDvIhCDsrmCQk737UhxDnQU3GSB5a2-w0h9hWM,20782
+numpy/core/tests/test_regression.py,sha256=qO4gCWkcfFbBam5BWVuumjGntBT-Hevih2BH1CU2bo4,92275
+numpy/core/tests/test_scalar_ctors.py,sha256=ilVfUULT72ALjt1WH0B54winaYbWrRy62AewkvugJao,3803
+numpy/core/tests/test_scalar_methods.py,sha256=3uNPtYl73DJBLGQxJJ1df4cyr90A5Sp0pcRtXMVTjac,4166
+numpy/core/tests/test_scalarbuffer.py,sha256=E7nYL8Hnbr3d_9-oxvGtkWte2q6ZeteJhmi0kOQ_u8k,5790
+numpy/core/tests/test_scalarinherit.py,sha256=xea-dgKGvMr-HjM9my-KpMN797sOegNhXni-62kw7m0,2504
+numpy/core/tests/test_scalarmath.py,sha256=tbEPFWzFotTc31m1GjI4dfvcCKXpOOwloPwIGM0Go6I,31895
+numpy/core/tests/test_scalarprint.py,sha256=VmPnnhMyFScjwUjEknjt5oF1YXR43oESZSYDuqbo614,15480
+numpy/core/tests/test_shape_base.py,sha256=fxb8d5kMhn9YazVg1h-prGUAO62FFImam250AP8DS4I,28251
+numpy/core/tests/test_simd.py,sha256=6YdEn72Nx_l0rw_z7ZEUUjOJf3ofsCqtF9aWOsJ4wjI,24568
+numpy/core/tests/test_simd_module.py,sha256=Bpbg_3YKO4Nu4Jm8p_QIlhrz_3tLIO6ketPhJmA_hZU,3855
+numpy/core/tests/test_ufunc.py,sha256=SPPnaYt2H7kG2zXknZu2sTSMmRrHN-UEcyuKlXO_qHg,91879
+numpy/core/tests/test_umath.py,sha256=VmybQuYViPMP7w8yEIUpZsEL1YgtRw7KaWOlcm45NEU,137309
+numpy/core/tests/test_umath_accuracy.py,sha256=_3N9e6662AmFLqIkyvTYFxeGL0HzM4lF4z2R00LnSoM,3103
+numpy/core/tests/test_umath_complex.py,sha256=7DMz_aYMufNED9OkyVHHbZP7akoZO6nR_ySWxPJ9JXs,23701
+numpy/core/tests/test_unicode.py,sha256=c6SB-PZaiNH7HvEZ2xIrfAMPmvuJmcTo79aBBkdCFvY,12915
+numpy/core/umath.py,sha256=IE9whDRUf3FOx3hdo6bGB0X_4OOJn_Wk6ajnbrc542A,2076
+numpy/core/umath_tests.py,sha256=IuFDModusxI6j5Qk-VWYHRZDIE806dzvju0qYlvwmfY,402
+numpy/ctypeslib.py,sha256=VdpIB-ytRoeVZfnt5TaJYn6y_rTc8GTvb9alp9d7B7w,17739
+numpy/ctypeslib.pyi,sha256=twksdb42mpN3Nc4WRJpcnwMqjNnvp_v02cZ9QiLQcI0,154
+numpy/distutils/__config__.py,sha256=IHRa3rupkgR7i9orKgDOiGPeOriQOaDHFF5q7kCETEc,3016
+numpy/distutils/__init__.py,sha256=kuNMyZmAP8MtuKKOGG5pMz5wWcLVzHkU7wW7CTwzNxY,1610
+numpy/distutils/__init__.pyi,sha256=6KiQIH85pUXaIlow3KW06e1_ZJBocVY6lIGghNaW33A,123
+numpy/distutils/__pycache__/__config__.cpython-38.pyc,,
+numpy/distutils/__pycache__/__init__.cpython-38.pyc,,
+numpy/distutils/__pycache__/_shell_utils.cpython-38.pyc,,
+numpy/distutils/__pycache__/ccompiler.cpython-38.pyc,,
+numpy/distutils/__pycache__/ccompiler_opt.cpython-38.pyc,,
+numpy/distutils/__pycache__/conv_template.cpython-38.pyc,,
+numpy/distutils/__pycache__/core.cpython-38.pyc,,
+numpy/distutils/__pycache__/cpuinfo.cpython-38.pyc,,
+numpy/distutils/__pycache__/exec_command.cpython-38.pyc,,
+numpy/distutils/__pycache__/extension.cpython-38.pyc,,
+numpy/distutils/__pycache__/from_template.cpython-38.pyc,,
+numpy/distutils/__pycache__/intelccompiler.cpython-38.pyc,,
+numpy/distutils/__pycache__/lib2def.cpython-38.pyc,,
+numpy/distutils/__pycache__/line_endings.cpython-38.pyc,,
+numpy/distutils/__pycache__/log.cpython-38.pyc,,
+numpy/distutils/__pycache__/mingw32ccompiler.cpython-38.pyc,,
+numpy/distutils/__pycache__/misc_util.cpython-38.pyc,,
+numpy/distutils/__pycache__/msvc9compiler.cpython-38.pyc,,
+numpy/distutils/__pycache__/msvccompiler.cpython-38.pyc,,
+numpy/distutils/__pycache__/npy_pkg_config.cpython-38.pyc,,
+numpy/distutils/__pycache__/numpy_distribution.cpython-38.pyc,,
+numpy/distutils/__pycache__/pathccompiler.cpython-38.pyc,,
+numpy/distutils/__pycache__/setup.cpython-38.pyc,,
+numpy/distutils/__pycache__/system_info.cpython-38.pyc,,
+numpy/distutils/__pycache__/unixccompiler.cpython-38.pyc,,
+numpy/distutils/_shell_utils.py,sha256=9pI0lXlRJxB22TPVBNUhWe7EnE-V6xIhMNQSR8LOw40,2704
+numpy/distutils/ccompiler.py,sha256=_sx0zV6AlYpxqN7Pr_7Wwc4k98a3GM6MFBdDPironCE,27805
+numpy/distutils/ccompiler_opt.py,sha256=aMyFbrZDK-ykCsT8mEN2XgkHYHtmveeGwVTBsbhOlTc,97804
+numpy/distutils/checks/cpu_asimd.c,sha256=sUn-v9fLpUUEtsrAfbGor76uYGhCINzXgkz0v3alZhQ,729
+numpy/distutils/checks/cpu_asimddp.c,sha256=7_HRp5jMJBSz02PcmAaH6m07zAbtcjMgkw7-4vhTZI4,395
+numpy/distutils/checks/cpu_asimdfhm.c,sha256=I7dTWSITAGwxHaLULZkh0nqnf-v9NF2kfQu7Tu90aB4,448
+numpy/distutils/checks/cpu_asimdhp.c,sha256=BD9NPwN4mcUZE_KydEQ0b7GtTkfEljl4u0KbrohLYcU,343
+numpy/distutils/checks/cpu_avx.c,sha256=AchhlKaX-7TJBTdLPxizv0kBQgpDlJfHsgu0vAVpxiw,180
+numpy/distutils/checks/cpu_avx2.c,sha256=ceEOVmmjXG3RvOJ5CFm_Ci3migjjxyXMkGootol5f5I,165
+numpy/distutils/checks/cpu_avx512_clx.c,sha256=6YL7X8fPLx4tdmVf87yEJcE0scrWmN8GKMWbU2H_eI4,232
+numpy/distutils/checks/cpu_avx512_cnl.c,sha256=FQgnUfGPJIxwb_QgggyN_eqDbVIO0Fg5S8yTSOVavBs,336
+numpy/distutils/checks/cpu_avx512_icl.c,sha256=NiAeMDgsiY3xjJ2orMHxrFJSbE-ZCxuq38dtjnQ_Zf0,336
+numpy/distutils/checks/cpu_avx512_knl.c,sha256=9bdrxCQfeL8sNAX8cQ_9lr_JxDU1TSl2J4XUQu9xjP4,292
+numpy/distutils/checks/cpu_avx512_knm.c,sha256=AWsXafv1lP1BI_APmXFYOXk5SyHGYBvjodVcxduOfHA,432
+numpy/distutils/checks/cpu_avx512_skx.c,sha256=drVMoRW8SWhwgcTMiVjMuN34v6ZSZmWe3cf0JGa7shM,281
+numpy/distutils/checks/cpu_avx512cd.c,sha256=ToPmk0tu_6gPdWNcKJYILjtRx4vIc6ShECfNM2-l7bY,167
+numpy/distutils/checks/cpu_avx512f.c,sha256=KewXn3NHK7SGboqTSBqO-64rYDY161pMeGY833MCoaw,165
+numpy/distutils/checks/cpu_f16c.c,sha256=pSq0FnDJYTbx2K9Cs7bJX2vGfEc8q7cvw5lC8rdevP0,260
+numpy/distutils/checks/cpu_fma3.c,sha256=mh3efYJ-hmv6z7b1j9I_WChae1RFMGtXWHgLqQp7_pY,227
+numpy/distutils/checks/cpu_fma4.c,sha256=tbalvI_RCIWy4X-BzRbZ9AVV1eCgm7UMJYbN7NM9vfs,290
+numpy/distutils/checks/cpu_neon.c,sha256=3lc70da2_XbT1hA36YY7vGbapW3dDZlG8xoNXp2rMzY,387
+numpy/distutils/checks/cpu_neon_fp16.c,sha256=XeOsWVVTmFecSl_luw2lNBGKxHaB2TtL7YnyIv8W0OU,262
+numpy/distutils/checks/cpu_neon_vfpv4.c,sha256=oJ1NvRYfF7Yf6S_bZuaUntE0iOnkbmTNNVR_sbE4NV8,512
+numpy/distutils/checks/cpu_popcnt.c,sha256=PuEpVkvM-tAyA8TzERvODpvEqWU0qhxLJLyW-Lj-Zc4,393
+numpy/distutils/checks/cpu_sse.c,sha256=WG79fJMG4JcbZnxVNUGSuGF8tHJ6IUyAVNFZM3eDSDg,147
+numpy/distutils/checks/cpu_sse2.c,sha256=Urd4Xcq_2oXqMxftLWnr7fXfnaPyCHxMb1dLOBxgCU4,156
+numpy/distutils/checks/cpu_sse3.c,sha256=FQCCU27JvQvNPmhlEr6kA_omlT6R6PFSk9Fz4xptyXg,148
+numpy/distutils/checks/cpu_sse41.c,sha256=S3IVKzcRmYp0Gjtc_LTfdAjjg9HjQgP_DDJTLVz6Ii8,131
+numpy/distutils/checks/cpu_sse42.c,sha256=NsXFPtSuGygm-KdkPcJRAncKQz58S5qXpa8SG_urgwU,148
+numpy/distutils/checks/cpu_ssse3.c,sha256=wWm9_w0v8Y4230p83AGXJgiDlAjg3UZ2dVX-T9ebBDs,162
+numpy/distutils/checks/cpu_vsx.c,sha256=gxWpdnkMeoaBCzlU_j56brB38KFo4ItFsjyiyo3YrKk,499
+numpy/distutils/checks/cpu_vsx2.c,sha256=ycKoKXszrZkECYmonzKd7TgflpZyVc1Xq-gtJqyPKxs,276
+numpy/distutils/checks/cpu_vsx3.c,sha256=pNA4w2odwo-mUfSnKnXl5SVY1z2nOxPZZcNC-L2YX1w,263
+numpy/distutils/checks/cpu_xop.c,sha256=sPhOvyT-mdlbf6RlbZvMrslRwHnTFgP-HXLjueS7nwU,246
+numpy/distutils/checks/extra_avx512bw_mask.c,sha256=7IRO24mpcuXRhm3refGWP91sy0e6RmSkmUQCWyxy__0,654
+numpy/distutils/checks/extra_avx512dq_mask.c,sha256=jFtOKEtZl3iTpfbmFNB-u4DQNXXBST2toKCpxFIjEa0,520
+numpy/distutils/checks/extra_avx512f_reduce.c,sha256=loHAibDU3STIihz3VNshKx0_cA2_yxq2aWc5nS6ILnc,1638
+numpy/distutils/checks/test_flags.c,sha256=7rgVefVOKOBaefG_6riau_tT2IqI4MFrbSMGNFnqUBQ,17
+numpy/distutils/command/__init__.py,sha256=DCxnKqTLrauOD3Fc8b7qg9U3gV2k9SADevE_Q3H78ng,1073
+numpy/distutils/command/__pycache__/__init__.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/autodist.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/bdist_rpm.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/build.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/build_clib.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/build_ext.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/build_py.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/build_scripts.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/build_src.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/config.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/config_compiler.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/develop.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/egg_info.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/install.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/install_clib.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/install_data.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/install_headers.cpython-38.pyc,,
+numpy/distutils/command/__pycache__/sdist.cpython-38.pyc,,
+numpy/distutils/command/autodist.py,sha256=i2ip0Zru8_AFx3lNQhlZfj6o_vg-RQ8yu1WNstcIYhE,3866
+numpy/distutils/command/bdist_rpm.py,sha256=9uZfOzdHV0_PRUD8exNNwafc0qUqUjHuTDxQcZXLIbg,731
+numpy/distutils/command/build.py,sha256=48vCxFz9tA0EWAtP9BiFTzpz6l91qXa0z3O3pC_QMis,2627
+numpy/distutils/command/build_clib.py,sha256=tKyaJypY97T4KJ2IAyUKhCU09diq8JaPeEh_JKX_5h8,17587
+numpy/distutils/command/build_ext.py,sha256=Vm6ZMSBPeljNp5AMJxiFEVpqUHbIuvu7djcxGjY9Bpk,30893
+numpy/distutils/command/build_py.py,sha256=xBHZCtx91GqucanjIBETPeXmR-gyUKPDyr1iMx1ARWE,1175
+numpy/distutils/command/build_scripts.py,sha256=AEQLNmO2v5N-GXl4lwd8v_nHlrauBx9Y-UudDcdCs_A,1714
+numpy/distutils/command/build_src.py,sha256=TbN3yNLm_FafCLv2Dx0RHkvYzaPsF1UwPINe1TUepgI,31953
+numpy/distutils/command/config.py,sha256=zczmFmKmYMnv1DMlJzUGtFTOascA1ZLh6Sr-EEcXSVk,21144
+numpy/distutils/command/config_compiler.py,sha256=I-xAL3JxaGFfpR4lg7g0tDdA_t7zCt-D4JtOACCP_Ak,4495
+numpy/distutils/command/develop.py,sha256=5ro-Sudt8l58JpKvH9FauH6vIfYRv2ohHLz-9eHytbc,590
+numpy/distutils/command/egg_info.py,sha256=n6trbjRfD1qWc_hRtMFkOJsg82BCiLvdl-NeXyuceGc,946
+numpy/distutils/command/install.py,sha256=s_0Uf39tFoRLUBlkrRK4YlROZsLdkI-IsuiFFaiS3ls,3157
+numpy/distutils/command/install_clib.py,sha256=q3yrfJY9EBaxOIYUQoiu2-juNKLKAKKfXC0nrd4t6z0,1439
+numpy/distutils/command/install_data.py,sha256=r8EVbIaXyN3aOmRugT3kp_F4Z03PsVX2l_x4RjTOWU4,872
+numpy/distutils/command/install_headers.py,sha256=g5Ag2H3j3dz-qSwWegxiZSAnvAf0thYYFwfPVHf9rxc,944
+numpy/distutils/command/sdist.py,sha256=XQM39b-MMO08bfE3SJrrtDWwX0XVnzCZqfAoVuuaFuE,760
+numpy/distutils/conv_template.py,sha256=q60i2Jf0PlQGHmjr7pu5zwBUnoYiLhtfcdgV94uLSaw,9888
+numpy/distutils/core.py,sha256=baf9SXdCVV8fA0lhLpOV4yEEWQP4ZwMTeeWoXHMg9LE,8374
+numpy/distutils/cpuinfo.py,sha256=frzEtCIEsSbQzGmNUXdWctiFqRcNFeLurzbvyCh8thY,23340
+numpy/distutils/exec_command.py,sha256=xMR7Dou5VZp2cP23xNd2TlXqexppXzBUd1wLMEAD2is,10668
+numpy/distutils/extension.py,sha256=E6m-GBUisj8kWbZlKlQhe6UUQvZOQ6JBGS5eqaSU7lY,3463
+numpy/distutils/fcompiler/__init__.py,sha256=vxt_-VqmNldCccva6d5WNVU_ztPIHipvny0NaYT8CGc,41110
+numpy/distutils/fcompiler/__pycache__/__init__.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/absoft.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/compaq.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/environment.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/fujitsu.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/g95.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/gnu.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/hpux.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/ibm.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/intel.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/lahey.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/mips.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/nag.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/none.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/nv.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/pathf95.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/pg.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/sun.cpython-38.pyc,,
+numpy/distutils/fcompiler/__pycache__/vast.cpython-38.pyc,,
+numpy/distutils/fcompiler/absoft.py,sha256=4UKxvpWQIphSdi6vJb3qILML_zyM3K_m7ddhAMS5dBI,5655
+numpy/distutils/fcompiler/compaq.py,sha256=i3kdLom13ho1QmwmjkPUane66lPqp_X4p_UbTH7z5gM,4027
+numpy/distutils/fcompiler/environment.py,sha256=PVS1al3wahDNnneNVSl1sQhMPfz2dUXaIDVJfy0wZBU,3168
+numpy/distutils/fcompiler/fujitsu.py,sha256=g4dTLDFfLRAzhYayIwyHGBw1Y36DKtPOCYfA823ldNA,1379
+numpy/distutils/fcompiler/g95.py,sha256=1TJe4IynWYqqYBy8gJ-nz8WQ_TaSbv8k2UzUIY5Erqc,1372
+numpy/distutils/fcompiler/gnu.py,sha256=8PiIoJb9iLDvEv48cBYp61LYAeAT9B6Iu55S6sHE2iU,20801
+numpy/distutils/fcompiler/hpux.py,sha256=SLbDOPYgiixqE32GgUrAJjpDLFy9g7E01vGNZCGv6Pc,1394
+numpy/distutils/fcompiler/ibm.py,sha256=jL9fOpUU9g1Qx3wFqv34ow6LMq8TOSZ3EAwUb1bXs_c,3638
+numpy/distutils/fcompiler/intel.py,sha256=3nBmdhH8pRMyNZfkMU0MaJGkRxVQg3wh8AOduXCjRRs,7029
+numpy/distutils/fcompiler/lahey.py,sha256=EV3Zhwq-iowWAu4BFBPv_UGJ-IB-qxlxmi6WU1qHDOs,1372
+numpy/distutils/fcompiler/mips.py,sha256=mlUNgGrRSLnNhtxQXWVfC9l4_OP2GMvOkgbZQwBon0A,1768
+numpy/distutils/fcompiler/nag.py,sha256=3ViQnBrZBhgm-t-jvjZ_Hl_fq9s2O5FBMNwW6wOmU2Q,2624
+numpy/distutils/fcompiler/none.py,sha256=auMK2ou1WtJ20LeMbwCZJ3XofpT9A0YYbMVd-62Mi_E,786
+numpy/distutils/fcompiler/nv.py,sha256=ml2xco_01pGH9x23Qv-3yalFzTk-GK45BVJoDMlGod4,1627
+numpy/distutils/fcompiler/pathf95.py,sha256=ipbaZIO8sqPJ1lUppOurnboiTwRzIasWNAJvKmktvv4,1094
+numpy/distutils/fcompiler/pg.py,sha256=cVcSFM9oR0KmO5AIb4Odw9OGslW6zvDGP88n-uEwxvQ,3696
+numpy/distutils/fcompiler/sun.py,sha256=JMdFfKldTYlfW1DxV7nR09k5PZypKLWpP7wmQzmlnH0,1628
+numpy/distutils/fcompiler/vast.py,sha256=JUGP68JGOUOBS9WbXftE-qCVUD13fpLyPnhpHfTL5y0,1719
+numpy/distutils/from_template.py,sha256=lL0BhwJHz7OrMwocJnnUElgzv8vVkZdr6NupI1ZnsLw,8224
+numpy/distutils/intelccompiler.py,sha256=kVXrdCVY7YA6HdYI89De3Fy5lCjAwDpy2mrbpK7Lc10,4336
+numpy/distutils/lib2def.py,sha256=HQ7i5FUtBcFGNlSlN20lgVtiBAHQbGXxmYdvkaJTjLI,3760
+numpy/distutils/line_endings.py,sha256=hlI71r840mhfu8lmzdHPVZ4NFm-kJDDUMV3lETblVTY,2109
+numpy/distutils/log.py,sha256=9tqE2Tq55mugFj_pn-RwV1xFoejmk0yWvVQHBL1e-Gc,2652
+numpy/distutils/mingw/gfortran_vs2003_hack.c,sha256=FDTA53KYTIhil9ytvZlocOqghQVp9LacLHn1IurV0wI,83
+numpy/distutils/mingw32ccompiler.py,sha256=Pt2fhKRw6axhlV2ahCS3Ep0vj-LfCdnCOEfvLRsCMFM,26073
+numpy/distutils/misc_util.py,sha256=RYrU7Fhutl-ClKdWkgllGzXPL1Ky7hsjbrgkDD5elJ0,87912
+numpy/distutils/msvc9compiler.py,sha256=bCtCVJmGrBHPm9sOoxa3oSrdrEVCNQFEM5O5hdqX8Hc,2255
+numpy/distutils/msvccompiler.py,sha256=sGGkjB-iSQFEfsMfQY8ZJfPKs6vm2DY9Y_OKi0Fk__0,1986
+numpy/distutils/npy_pkg_config.py,sha256=4CMG6sN7HAFSmw2ljPAAN5f04wdnZECkFXZcKoX06f0,13409
+numpy/distutils/numpy_distribution.py,sha256=nrdp8rlyjEBBV1tzzi5cE-aYeXB5U3X8T5-G0akXSoY,651
+numpy/distutils/pathccompiler.py,sha256=a5CYDXilCaIC85v0fVh-wrb0fClv0A7mPS87aF1inUc,734
+numpy/distutils/setup.py,sha256=zd5_kD7uTEOTgC8Fe93g9A_5AOBEySWwr-2OxHsBBEc,651
+numpy/distutils/system_info.py,sha256=Z0ImrrPwkXbONWxT9x3LYgN4HBXHGuNxh_hKXpNpjWI,110955
+numpy/distutils/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/distutils/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_build_ext.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_ccompiler_opt.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_ccompiler_opt_conf.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_exec_command.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_fcompiler.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_fcompiler_gnu.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_fcompiler_intel.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_fcompiler_nagfor.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_from_template.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_mingw32ccompiler.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_misc_util.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_npy_pkg_config.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_shell_utils.cpython-38.pyc,,
+numpy/distutils/tests/__pycache__/test_system_info.cpython-38.pyc,,
+numpy/distutils/tests/test_build_ext.py,sha256=te4h-jzABgSF_efL2LC-Hwc3hlq8lfqg5JEeHGQgV3A,2736
+numpy/distutils/tests/test_ccompiler_opt.py,sha256=XSKyD1o3GsQOO0MiVBHSrIOBwTk1Z1f9_3BfdpZWlSA,28676
+numpy/distutils/tests/test_ccompiler_opt_conf.py,sha256=LmFqpGwqGFgUwLQdV5xJQhs_xB9gnL7_P-7oOOUqa78,6521
+numpy/distutils/tests/test_exec_command.py,sha256=Ltd4T3A_t3Oo_QSYjOkWKqPj-LttXEumEVKhLxVfZEU,7515
+numpy/distutils/tests/test_fcompiler.py,sha256=SS5HOLIg0eqkmZTRKeWq9_ahW2tmV9c9piwYfzcBPmc,1320
+numpy/distutils/tests/test_fcompiler_gnu.py,sha256=RlRHZbyazgKGY17NmdYSF3ehO0M0xXN4UkbsJzJz4i8,2191
+numpy/distutils/tests/test_fcompiler_intel.py,sha256=4cppjLugoa8P4bjzYdiPxmyCywmP9plXOkfsklhnYsQ,1088
+numpy/distutils/tests/test_fcompiler_nagfor.py,sha256=ntyr8f-67dNI0OF_l6-aeTwu9wW-vnxpheqrc4cXAUI,1124
+numpy/distutils/tests/test_from_template.py,sha256=ZzUSEPyZIG4Zak3-TFqmRGXHMp58aKTuLKb0t-5XpDg,1147
+numpy/distutils/tests/test_mingw32ccompiler.py,sha256=7X8V4hLMtsNj1pYoLkSSla04gJu66e87E_k-6ce3PrA,1651
+numpy/distutils/tests/test_misc_util.py,sha256=YKK2WrJqVJ5o71mWL5oP0l-EVQmqKlf3XU8y7co0KYc,3300
+numpy/distutils/tests/test_npy_pkg_config.py,sha256=1pQh-mApHjj0y9Ba2tqns79U8dsfDpJ9zcPdsa2qbps,2641
+numpy/distutils/tests/test_shell_utils.py,sha256=okNSfjFSAvY3XyBsyZrKXAtV9RBmb7vX9o4ZLJc28Ds,2030
+numpy/distutils/tests/test_system_info.py,sha256=ALNf8Vqw6d9Gv6ELtWmQT9Byy5LWv4ZIPMOVXQfIqsk,11065
+numpy/distutils/unixccompiler.py,sha256=9ug-F8LGBrrwuC8U00JhjokgH7L0BPvLhFJLg6REQ1I,5517
+numpy/doc/__init__.py,sha256=llSbqjSXybPuXqt6WJFZhgYnscgYl4m1tUBy_LhfCE0,534
+numpy/doc/__pycache__/__init__.cpython-38.pyc,,
+numpy/doc/__pycache__/constants.cpython-38.pyc,,
+numpy/doc/__pycache__/ufuncs.cpython-38.pyc,,
+numpy/doc/constants.py,sha256=OtjYHSs9p_DxLDqhlbauLMt-WWVrnewaHlUJCi3Qw_Y,9592
+numpy/doc/ufuncs.py,sha256=jL-idm49Qd8xNns12ZPp533jorDuDnUN2I96hbmFZoo,5497
+numpy/dual.py,sha256=RgoFIabqn8Hu9lSRakjO1plfDdYBJQq_8Gn__rE8TqQ,2297
+numpy/emath.pyi,sha256=-9BhMfuGE3vYfdpqbHDXyQsFeUzydkfHbRWxSFJhLA8,161
+numpy/f2py/__init__.py,sha256=eBq1wR_5aSMEhbF4COOM2uBW70GBP_WLBlgyFZBVj1M,4377
+numpy/f2py/__init__.pyi,sha256=c7BkZSruptvVxdLmt_6FgxgMSVS4A8FgaQnx9V4dYdw,102
+numpy/f2py/__main__.py,sha256=XSvcMI54qWQiicJ51nRxK8L8PGzuUy3c2NGTVg1tzyk,89
+numpy/f2py/__pycache__/__init__.cpython-38.pyc,,
+numpy/f2py/__pycache__/__main__.cpython-38.pyc,,
+numpy/f2py/__pycache__/__version__.cpython-38.pyc,,
+numpy/f2py/__pycache__/auxfuncs.cpython-38.pyc,,
+numpy/f2py/__pycache__/capi_maps.cpython-38.pyc,,
+numpy/f2py/__pycache__/cb_rules.cpython-38.pyc,,
+numpy/f2py/__pycache__/cfuncs.cpython-38.pyc,,
+numpy/f2py/__pycache__/common_rules.cpython-38.pyc,,
+numpy/f2py/__pycache__/crackfortran.cpython-38.pyc,,
+numpy/f2py/__pycache__/diagnose.cpython-38.pyc,,
+numpy/f2py/__pycache__/f2py2e.cpython-38.pyc,,
+numpy/f2py/__pycache__/f2py_testing.cpython-38.pyc,,
+numpy/f2py/__pycache__/f90mod_rules.cpython-38.pyc,,
+numpy/f2py/__pycache__/func2subr.cpython-38.pyc,,
+numpy/f2py/__pycache__/rules.cpython-38.pyc,,
+numpy/f2py/__pycache__/setup.cpython-38.pyc,,
+numpy/f2py/__pycache__/use_rules.cpython-38.pyc,,
+numpy/f2py/__version__.py,sha256=TisKvgcg4vh5Fptw2GS1JB_3bAQsWZIKhclEX6ZcAho,35
+numpy/f2py/auxfuncs.py,sha256=d8xZkZ2Jom_FX4ALxQO4v2Uqsfi62rZEiqSH30AGpyA,22701
+numpy/f2py/capi_maps.py,sha256=pGERvcXuv3wpq2ab3inTTTdv20G1XZz2tMVn0_yVYDM,32247
+numpy/f2py/cb_rules.py,sha256=BYaZ0xIcL2tsKbHL3aak61vXY3EChSQbgmJSZKf4Lw4,24862
+numpy/f2py/cfuncs.py,sha256=YwYubDuH_FGwm_uRSexDZEeXyLmuKXWb7voaSmeve9o,48115
+numpy/f2py/common_rules.py,sha256=pRpoVr457G3JcTD_W4V0AmgQBzAIKcqPw4j_Hv3elF0,5070
+numpy/f2py/crackfortran.py,sha256=EGernuGKvWb5wkyMoIcbliQEJrkIDIpEHfUQHrmahY8,134370
+numpy/f2py/diagnose.py,sha256=LmGu6iZKr9WHfMZFIIEobZvRJd9Ktdqx0nYekWk4N7g,5384
+numpy/f2py/f2py2e.py,sha256=an58iVb6nFOhUwT4xYN6GJcmabo-fNTxXtj7CkUICVI,25033
+numpy/f2py/f2py_testing.py,sha256=vybOK-G_b0KYFNNZdhOCUf5pZExEdWfcIueIKODu024,1503
+numpy/f2py/f90mod_rules.py,sha256=umkXYf5Y6TrJ77DIZX0L0xemyFQ2sfe7M63f71A94hs,10017
+numpy/f2py/func2subr.py,sha256=-e2VG2t0YDEOO_jIhLZRFLg5uoIoPGtcjir-4BzdNCs,9655
+numpy/f2py/rules.py,sha256=El8aYnKkj1gAgjQ15lzRW6E_uyMdLI1FEGS13Nvw1kI,60201
+numpy/f2py/setup.py,sha256=Qoa3e1-WsSeayGHlVqZ9x5eIEOBeMAOtqTP331STQAk,2533
+numpy/f2py/src/fortranobject.c,sha256=IeezP69rVbNBR7umIUirrEZyGThU5Yhx3fV2olh9TMs,37559
+numpy/f2py/src/fortranobject.h,sha256=kwkaaaO0nsg7I-I0HpVAlOy-eiuvhKbhSZrEUWJvBaU,4656
+numpy/f2py/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/f2py/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_array_from_pyobj.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_assumed_shape.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_block_docstring.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_callback.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_common.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_compile_function.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_crackfortran.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_kind.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_mixed.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_module_doc.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_parameter.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_quoted_character.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_regression.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_return_character.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_return_complex.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_return_integer.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_return_logical.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_return_real.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_semicolon_split.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_size.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/test_string.cpython-38.pyc,,
+numpy/f2py/tests/__pycache__/util.cpython-38.pyc,,
+numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c,sha256=56WWwGvAipTqHyshtz8jLLZ7gNHpzC5h_jCyIciFGLc,7511
+numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap,sha256=zfuOShmuotzcLIQDnVFaARwvM66iLrOYzpquIGDbiKU,30
+numpy/f2py/tests/src/assumed_shape/foo_free.f90,sha256=fqbSr7VlKfVrBulFgQtQA9fQf0mQvVbLi94e4FTST3k,494
+numpy/f2py/tests/src/assumed_shape/foo_mod.f90,sha256=9pbi88-uSNP5IwS49Kim982jDAuopo3tpEhg2SOU7no,540
+numpy/f2py/tests/src/assumed_shape/foo_use.f90,sha256=9Cl1sdrihB8cCSsjoQGmOO8VRv9ni8Fjr0Aku1UdEWM,288
+numpy/f2py/tests/src/assumed_shape/precision.f90,sha256=3L_F7n5ju9F0nxw95uBUaPeuiDOw6uHvB580eIj7bqI,134
+numpy/f2py/tests/src/common/block.f,sha256=tcGKa42S-6bfA6fybpM0Su_xjysEVustkEJoF51o_pE,235
+numpy/f2py/tests/src/kind/foo.f90,sha256=6_zq3OAWsuNJ5ftGTQAEynkHy-MnuLgBXmMIgbvL7yU,367
+numpy/f2py/tests/src/mixed/foo.f,sha256=Zgn0xDhhzfas3HrzgVSxIL1lGEF2mFRVohrvXN1thU0,90
+numpy/f2py/tests/src/mixed/foo_fixed.f90,sha256=6eEEYCH71gPp6lZ6e2afLrfS6F_fdP7GZDbgGJJ_6ns,187
+numpy/f2py/tests/src/mixed/foo_free.f90,sha256=UC6iVRcm0-aVXAILE5jZhivoGQbKU-prqv59HTbxUJA,147
+numpy/f2py/tests/src/module_data/mod.mod,sha256=EkjrU7NTZrOH68yKrz6C_eyJMSFSxGgC2yMQT9Zscek,412
+numpy/f2py/tests/src/module_data/module_data_docstring.f90,sha256=-asnMH7vZMwVIeMU2YiLWgYCUUUxZgPTpbAomgWByHs,236
+numpy/f2py/tests/src/parameter/constant_both.f90,sha256=L0rG6-ClvHx7Qsch46BUXRi_oIEL0uw5dpRHdOUQuv0,1996
+numpy/f2py/tests/src/parameter/constant_compound.f90,sha256=lAT76HcXGMgr1NfKof-RIX3W2P_ik1PPqkRdJ6EyBmM,484
+numpy/f2py/tests/src/parameter/constant_integer.f90,sha256=42jROArrG7vIag9wFa_Rr5DBnnNvGsrEUgpPU14vfIo,634
+numpy/f2py/tests/src/parameter/constant_non_compound.f90,sha256=u9MRf894Cw0MVlSOUbMSnFSHP4Icz7RBO21QfMkIl-Q,632
+numpy/f2py/tests/src/parameter/constant_real.f90,sha256=QoPgKiHWrwI7w5ctYZugXWzaQsqSfGMO7Jskbg4CLTc,633
+numpy/f2py/tests/src/regression/inout.f90,sha256=TlMxJjhjjiuLI--Tg2LshLnbfZpiKz37EpR_tPKKSx8,286
+numpy/f2py/tests/src/size/foo.f90,sha256=nK_767f1TtqVr-dMalNkXmcKbSbLCiabhRkxSDCzLz0,859
+numpy/f2py/tests/src/string/char.f90,sha256=X_soOEV8cKsVZefi3iLT7ilHljjvJJ_i9VEHWOt0T9Y,647
+numpy/f2py/tests/test_array_from_pyobj.py,sha256=kxy7M9V0YHzRl9Cpn0J3WEnDZ7NRA4wL_6yrKVegLu0,23243
+numpy/f2py/tests/test_assumed_shape.py,sha256=TDLfEzJc7tlfiqFzmonD8LO85PXySgJ4JE_5IZTzinA,1637
+numpy/f2py/tests/test_block_docstring.py,sha256=AFgfCimjB0gcmqfyHhTmfRVCrMZunkIueoZGrV9SbaA,650
+numpy/f2py/tests/test_callback.py,sha256=QFvuUSetf9OA5yD9ti5MhNitIJE7n9wZXM_wkVacz1U,8513
+numpy/f2py/tests/test_common.py,sha256=tRwTdz6aQ0RYREFC-T-SfEyq25wWYo5pknVAqvvvBjM,827
+numpy/f2py/tests/test_compile_function.py,sha256=d2zOi1oPKwqSMBILFSUuJeIX3BY6uAOBZnvYw5h3K54,4434
+numpy/f2py/tests/test_crackfortran.py,sha256=QwNp0PHGmN00A3RTwDekXzTfTDQ2uDjK_-Hupxc-YpU,3700
+numpy/f2py/tests/test_kind.py,sha256=eH_sM5X5wIwe3T9yVMH6DH8I4spsgRaeIork_FJG-8Q,1044
+numpy/f2py/tests/test_mixed.py,sha256=faYM1laPKwStbz-RY-6b9LCuj2kFojTPIR0wxsosXoI,946
+numpy/f2py/tests/test_module_doc.py,sha256=Qz_TonbInzgdY8KsnC2Y8mxmiqLWMruZKDPa0FPMbrE,980
+numpy/f2py/tests/test_parameter.py,sha256=S1K9K9Uj5dWjmWF8euBUMJdGilIqn1nNH2FftcS1INU,4026
+numpy/f2py/tests/test_quoted_character.py,sha256=81CR1ZIyKygz7noFJMcgaLdg18nY8zcFfrSN2L_U9xg,959
+numpy/f2py/tests/test_regression.py,sha256=AbSCx5JfsiM2VeRRmVk1G3AbHPOS7FIqhCYBlSVquSY,1690
+numpy/f2py/tests/test_return_character.py,sha256=bpuHEjBj53YpvsI_aLQOcSVdoGAEtgtmAK8kbHKdcgc,4064
+numpy/f2py/tests/test_return_complex.py,sha256=jYcoM3pZj0opGXXF69EsGQ6HD5SPaRhBeGx3RhnJx8c,4778
+numpy/f2py/tests/test_return_integer.py,sha256=MpdNZLxeQwER4M4w5utHYe08gDzrjAWOq_z5wRO8hP8,4751
+numpy/f2py/tests/test_return_logical.py,sha256=uP9rWNyA3UARKwaQ6Fsc8grh72G5xnp9XXFSWLdPZQ8,5028
+numpy/f2py/tests/test_return_real.py,sha256=05OwUsgmI_G_pr197xUXgIgTNVOHygtY2kPqRiexeSY,5605
+numpy/f2py/tests/test_semicolon_split.py,sha256=Ap6S5tGL6R8I2i9iUlVxElW4IMNoz0LxIHK1hLIYZhQ,1577
+numpy/f2py/tests/test_size.py,sha256=ukbP0NlzqpfD6M_K58WK6IERSXc_6nHpyUqbYfEbk8M,1335
+numpy/f2py/tests/test_string.py,sha256=w2GiZmdwNAaWOBhak9IuUnnVktMhUq_Y0ajI0SX9YNY,632
+numpy/f2py/tests/util.py,sha256=QkIepB1CsYTTHl-F9Quvwg2uV5gBmpuGMn-VOVrJLvw,9947
+numpy/f2py/use_rules.py,sha256=ROzvjl0-GUOkT3kJS5KkYq8PsFxGjebA6uPq9-CyZEQ,3700
+numpy/fft/__init__.py,sha256=bxBM1d7FfUlcIr0dF-zJ_UjXDNzc0FFnopv6WdwcQvg,8287
+numpy/fft/__init__.pyi,sha256=ETk_OFyBtOJDyQ7ImyZOnm_dXUdE89wSkyxxbLU0Sq0,249
+numpy/fft/__pycache__/__init__.cpython-38.pyc,,
+numpy/fft/__pycache__/_pocketfft.cpython-38.pyc,,
+numpy/fft/__pycache__/helper.cpython-38.pyc,,
+numpy/fft/__pycache__/setup.cpython-38.pyc,,
+numpy/fft/_pocketfft.py,sha256=2AvZn4Oga8NNVxxu5Kjq692QElycysShG3jqhbJvHWY,53572
+numpy/fft/_pocketfft_internal.cp38-win_amd64.pyd,sha256=tc6gkvaprwpgSF1JTsEkXqwd56eexrRlIaVylNH9o7U,112640
+numpy/fft/helper.py,sha256=divqfKoOb0p-Zojqokhj3fQ5HzgWTigxDxZIQnN_TUQ,6375
+numpy/fft/setup.py,sha256=-aF3b5s_eL6Jl0rS_jMFtFPzbYyT55FQE2SgblAawf0,750
+numpy/fft/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/fft/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/fft/tests/__pycache__/test_helper.cpython-38.pyc,,
+numpy/fft/tests/__pycache__/test_pocketfft.cpython-38.pyc,,
+numpy/fft/tests/test_helper.py,sha256=iopdl7-SHA5E1Ex13rYdceskgoDI5T8_Kg12LfqK1HA,6315
+numpy/fft/tests/test_pocketfft.py,sha256=GraHId7HW81sK62wFoF2y4nt2bL6MqkPjkG12OPmgNo,13135
+numpy/lib/__init__.py,sha256=D_APB98cfipadeVf9KXXCg4MRYwNl_JrjbrJ_Fityhc,1840
+numpy/lib/__init__.pyi,sha256=jj6Fi0pQKDKMc5CZnKTB6_gwUebBguoKL79CLK1hGFM,2874
+numpy/lib/__pycache__/__init__.cpython-38.pyc,,
+numpy/lib/__pycache__/_datasource.cpython-38.pyc,,
+numpy/lib/__pycache__/_iotools.cpython-38.pyc,,
+numpy/lib/__pycache__/_version.cpython-38.pyc,,
+numpy/lib/__pycache__/arraypad.cpython-38.pyc,,
+numpy/lib/__pycache__/arraysetops.cpython-38.pyc,,
+numpy/lib/__pycache__/arrayterator.cpython-38.pyc,,
+numpy/lib/__pycache__/format.cpython-38.pyc,,
+numpy/lib/__pycache__/function_base.cpython-38.pyc,,
+numpy/lib/__pycache__/histograms.cpython-38.pyc,,
+numpy/lib/__pycache__/index_tricks.cpython-38.pyc,,
+numpy/lib/__pycache__/mixins.cpython-38.pyc,,
+numpy/lib/__pycache__/nanfunctions.cpython-38.pyc,,
+numpy/lib/__pycache__/npyio.cpython-38.pyc,,
+numpy/lib/__pycache__/polynomial.cpython-38.pyc,,
+numpy/lib/__pycache__/recfunctions.cpython-38.pyc,,
+numpy/lib/__pycache__/scimath.cpython-38.pyc,,
+numpy/lib/__pycache__/setup.cpython-38.pyc,,
+numpy/lib/__pycache__/shape_base.cpython-38.pyc,,
+numpy/lib/__pycache__/stride_tricks.cpython-38.pyc,,
+numpy/lib/__pycache__/twodim_base.cpython-38.pyc,,
+numpy/lib/__pycache__/type_check.cpython-38.pyc,,
+numpy/lib/__pycache__/ufunclike.cpython-38.pyc,,
+numpy/lib/__pycache__/user_array.cpython-38.pyc,,
+numpy/lib/__pycache__/utils.cpython-38.pyc,,
+numpy/lib/_datasource.py,sha256=cfOLMUd6-hFI7HYrm8DJHJSGOBZZ49kEWWXB9aagPr4,23337
+numpy/lib/_iotools.py,sha256=PYVfEUIITyUmIvWS8-0CSLegJjKgDysKwYmro1yVrZ8,31834
+numpy/lib/_version.py,sha256=syCq5PJX3QCmhjIR4nO1HG2YWPTarArAR-7m8dv93gk,5010
+numpy/lib/arraypad.py,sha256=V4iW49CT3KyPHdVK-4Q2kjJqgEb-N35LusA6G-Q2LKU,32102
+numpy/lib/arraysetops.py,sha256=_mkMzedSHws9E5Dnw0s6fUyaQAvFeRqbuQuw4XsNdII,26111
+numpy/lib/arrayterator.py,sha256=29pO5S0ciEZwt1402Q0-5cRbyKspV4tlPX1-m_D_Hgc,7282
+numpy/lib/format.py,sha256=sSf6H4mcz-SI7cMw31VYJwIwapFCLWacCObkccP3pYw,32192
+numpy/lib/function_base.py,sha256=oa092RcFcRJp7JN1jP9eLOzTLbzOYEsW908IAUW9FPc,163639
+numpy/lib/histograms.py,sha256=sJNjLvJLQCmPTIlwMsrtOmFK2SxxyQn6-9gmBBsQa14,41261
+numpy/lib/index_tricks.py,sha256=kPia5ya0_USggzPtyvPNFwGmz1-WNk4Gtjrf3XmDXbQ,31655
+numpy/lib/mixins.py,sha256=j_Hfrfp6d6lJAVFlM9y2lu6HHsK_yDInyU74SJWsZDQ,7228
+numpy/lib/nanfunctions.py,sha256=j4ziL7zNzjW4YMOadZxaa6kRcauErJCOBGZhZLbbwq8,60599
+numpy/lib/npyio.py,sha256=AeeyiEWUX1QdkMi1HuwMzS2NB221hLQXeCiK_zjIg2M,91899
+numpy/lib/polynomial.py,sha256=uDsiJVN8lrKVyZcVfqAMTudO7otOMCoLd9G3tHKq6NE,45253
+numpy/lib/recfunctions.py,sha256=G_GYahtsPjRK7uknYmXMpm1p96eHPzguzWBVtldi_uw,58119
+numpy/lib/scimath.py,sha256=JSMIr5maF4dBwvCHM6MOHa7kgOSXtwxb1QxEV09qs6A,15484
+numpy/lib/setup.py,sha256=1s3corE4egZnDZ6I8au_mx7muRPgb3ZxL4Ko2SHt_2Q,417
+numpy/lib/shape_base.py,sha256=7p8SSRXNk5BdcwuEwINFtq60mYQY6vFfMvTO8Cubvro,39627
+numpy/lib/stride_tricks.py,sha256=-hzSjUTw_0VXfzdHZ3afGQlP6UP3oHBdX0VcGE0PMgg,18389
+numpy/lib/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/lib/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test__datasource.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test__iotools.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test__version.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_arraypad.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_arraysetops.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_arrayterator.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_financial_expired.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_format.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_function_base.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_histograms.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_index_tricks.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_io.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_mixins.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_nanfunctions.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_packbits.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_polynomial.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_recfunctions.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_regression.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_shape_base.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_stride_tricks.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_twodim_base.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_type_check.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_ufunclike.cpython-38.pyc,,
+numpy/lib/tests/__pycache__/test_utils.cpython-38.pyc,,
+numpy/lib/tests/data/py2-objarr.npy,sha256=F4cyUC-_TB9QSFLAo2c7c44rC6NUYIgrfGx9PqWPSKk,258
+numpy/lib/tests/data/py2-objarr.npz,sha256=xo13HBT0FbFZ2qvZz0LWGDb3SuQASSaXh7rKfVcJjx4,366
+numpy/lib/tests/data/py3-objarr.npy,sha256=pTTVh8ezp-lwAK3fkgvdKU8Arp5NMKznVD-M6Ex_uA0,341
+numpy/lib/tests/data/py3-objarr.npz,sha256=qQR0gS57e9ta16d_vCQjaaKM74gPdlwCPkp55P-qrdw,449
+numpy/lib/tests/data/python3.npy,sha256=X0ad3hAaLGXig9LtSHAo-BgOvLlFfPYMnZuVIxRmj-0,96
+numpy/lib/tests/data/win64python2.npy,sha256=agOcgHVYFJrV-nrRJDbGnUnF4ZTPYXuSeF-Mtg7GMpc,96
+numpy/lib/tests/test__datasource.py,sha256=OYm6qsPy7Q8yXV_5GfSMMNQKon4izf_T9ULaqjHLJA4,10837
+numpy/lib/tests/test__iotools.py,sha256=q44VFSi9VzWaf_dJ-MGBtYA7z7TFR0j0AF-rbzhLXoo,14096
+numpy/lib/tests/test__version.py,sha256=WwCOmobk2UN6Hlp93bXsd7RR1UmjJlE4r9ol8d87ctg,2053
+numpy/lib/tests/test_arraypad.py,sha256=ZoqM25xb5iI_K6ampX5cov2zFUwQZ8i0Xu3gY_ncdk0,55647
+numpy/lib/tests/test_arraysetops.py,sha256=ovgWXCWzaKvC-OXtWJx8MrSsdQsLTj3NjqLbxhhHEv0,25173
+numpy/lib/tests/test_arrayterator.py,sha256=IRVmzxbr9idboJjOHKuX_8NQhMAKs7pD1xWqmU3ZERw,1337
+numpy/lib/tests/test_financial_expired.py,sha256=JfDHAoEDLPcKzcpzRsj8pijDSaFmQRWM6BiOjL4QFTs,371
+numpy/lib/tests/test_format.py,sha256=E5ISt5uKyqXCwLD7UZK1TM4SagXAdxxHav7yKz6TIls,39223
+numpy/lib/tests/test_function_base.py,sha256=N78mv4u7xUGsRgR6hBQ0zoZNFxSWOj3cwUoFwIkqJqc,136484
+numpy/lib/tests/test_histograms.py,sha256=_uKM8dtMWCwGtIgIwog3s3jyPb8w804TWqy9iOkYeSI,34510
+numpy/lib/tests/test_index_tricks.py,sha256=eqVGE3ML61U9zOepbPF2X24qVDCaOr2eWnR5p5CzFcw,19832
+numpy/lib/tests/test_io.py,sha256=ZEYwCEDx8SEa_EPhHjCRLlNsa-ONI1Cis_opkGs7V3Y,105599
+numpy/lib/tests/test_mixins.py,sha256=nIec_DZIDx7ONnlpq_Y2TLkIULAPvQ7LPqtMwEHuV4U,7246
+numpy/lib/tests/test_nanfunctions.py,sha256=d26Ynihtb2BIZ1N-qfBagm8lkba0hR-m3g2GtngbTRE,39066
+numpy/lib/tests/test_packbits.py,sha256=XpFIaL8mOWfzD3WQaxd6WrDFWh4Mc51EPXIOqxt3wS0,17922
+numpy/lib/tests/test_polynomial.py,sha256=fxIQBimaH0ZYXcWJYPBBtpWDpYzstABF_BBROu-vCfc,10995
+numpy/lib/tests/test_recfunctions.py,sha256=f9J49n_8ot0zG0Bw4XXFx3l1XN2VeAu9ROgn0dV4GLY,42134
+numpy/lib/tests/test_regression.py,sha256=NXKpFka0DPE7z0-DID-FGh0ITFXi8nEj6Pg_-uBcDIg,8504
+numpy/lib/tests/test_shape_base.py,sha256=kC4k86CdiwUoqBs_KjAc_JekFJLVtlbanlPrXXXpWRU,25020
+numpy/lib/tests/test_stride_tricks.py,sha256=1zeBcvhltePbeE6SBoF4gomAYaZzwaHjvbWqcgI2JiY,23494
+numpy/lib/tests/test_twodim_base.py,sha256=USISKs6mDYgEl20k4_k899_pWSkFjZkPkafA_BUQxng,18890
+numpy/lib/tests/test_type_check.py,sha256=ffuA-ndaMsUb0IvPalBMwGkoukIP9OZVJXCuq299qB8,15597
+numpy/lib/tests/test_ufunclike.py,sha256=rpZTDbKPBVg5-byY1SKhkukyxB2Lvonw15ZARPE3mc0,3382
+numpy/lib/tests/test_utils.py,sha256=3uWGoBytyV-jtAt6Fnp812iVWKZw5KI9TV_7ApS3u98,4407
+numpy/lib/twodim_base.py,sha256=TCNDw28Hs8bze0v4dosVW0vqtDtSfac69EA51Wb8a9Y,29405
+numpy/lib/type_check.py,sha256=WK5a3RgaIVoKqskfvG-U6VHiZyMNrfswV-9SBb5RxbU,20500
+numpy/lib/ufunclike.py,sha256=D6NgciDjA0ETqfzX9lDzuArgPOWccl3-nws48_IMwYo,8211
+numpy/lib/user_array.py,sha256=5yqkyjCmUIASGNx2bt7_ZMWJQJszkbD1Kn06qqv7POA,8007
+numpy/lib/utils.py,sha256=DYd-12yhdzf1l8CLSZ8gOBNBItYLvsX0mHgXMaehuY0,32675
+numpy/linalg/__init__.py,sha256=nziJvIBC-t0x_9SjOrlgcorUR03gdviaCWhbvvPIT7s,1836
+numpy/linalg/__init__.pyi,sha256=WL2hPYvsgtbNG0rKAhZl9h6eLL1nw1ZCp8dNiarGHYk,306
+numpy/linalg/__pycache__/__init__.cpython-38.pyc,,
+numpy/linalg/__pycache__/linalg.cpython-38.pyc,,
+numpy/linalg/__pycache__/setup.cpython-38.pyc,,
+numpy/linalg/_umath_linalg.cp38-win_amd64.pyd,sha256=2PGExdTKLYAGH3H1Oe4ZyLTuHshuR_qQ-MokPOpl8Nc,155648
+numpy/linalg/lapack_lite.cp38-win_amd64.pyd,sha256=_BNvhFQcl7_eU7st4tgi-p7cfil69lnLjESjkAvhnK4,22016
+numpy/linalg/linalg.py,sha256=o3Z3tshOr_bUalTPpD-oAy4ESZDIg-ZlqBGCjqfcLto,92311
+numpy/linalg/setup.py,sha256=fxvs0sWTe4atefglbXBWPei5KSWhHsqSXXJ_3DphVYk,3186
+numpy/linalg/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/linalg/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/linalg/tests/__pycache__/test_build.cpython-38.pyc,,
+numpy/linalg/tests/__pycache__/test_deprecations.cpython-38.pyc,,
+numpy/linalg/tests/__pycache__/test_linalg.cpython-38.pyc,,
+numpy/linalg/tests/__pycache__/test_regression.cpython-38.pyc,,
+numpy/linalg/tests/test_build.py,sha256=8cUlHATPUuy3Y2zYWuWhYQnNjdAAegcPRsUUC_tgujE,1671
+numpy/linalg/tests/test_deprecations.py,sha256=GaeE3JnQlJLoAfbY93LmgCFUlV5M8IFmQ7EhF4WbqwU,660
+numpy/linalg/tests/test_linalg.py,sha256=lczSdwO0vQWSfIUxQyScg8wRbYtC2yfKUJ973G3CBM8,76437
+numpy/linalg/tests/test_regression.py,sha256=T0iQkRUhOoxIHHro5kyxU7GFRhN3pZov6UaJGXxtvu0,5745
+numpy/ma/__init__.py,sha256=9i-au2uOZ_K9q2t9Ezc9nEAS74Y4TXQZMoP9601UitU,1458
+numpy/ma/__init__.pyi,sha256=yEFwLhZ5m-kJ6gBqlqCMZ_3vDlxV3QW5iOYzPD2ohck,3484
+numpy/ma/__pycache__/__init__.cpython-38.pyc,,
+numpy/ma/__pycache__/bench.cpython-38.pyc,,
+numpy/ma/__pycache__/core.cpython-38.pyc,,
+numpy/ma/__pycache__/extras.cpython-38.pyc,,
+numpy/ma/__pycache__/mrecords.cpython-38.pyc,,
+numpy/ma/__pycache__/setup.cpython-38.pyc,,
+numpy/ma/__pycache__/testutils.cpython-38.pyc,,
+numpy/ma/__pycache__/timer_comparison.cpython-38.pyc,,
+numpy/ma/bench.py,sha256=wOg52Iu6JHqHWzKS2N0LpdPPUJciEZAePgmZd_mMgpM,5014
+numpy/ma/core.py,sha256=BsqLJF6ljQXHA6wDm7xUgJ-ajgCR1CnPOPLHjqs9wkY,272664
+numpy/ma/extras.py,sha256=NSaXcpGtjv5PoXQ2j3kbKiE6018TDY0pGQ88WZol2oo,60269
+numpy/ma/mrecords.py,sha256=B3HcVpKf0kRu4DG3YreZ6NY5zrBD9kTMBkU7tRJCKKY,27449
+numpy/ma/setup.py,sha256=DCi5FtZTlkhR3ByJH5Sp5B962bfcWpaOjA-y7ueyoog,430
+numpy/ma/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/ma/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/ma/tests/__pycache__/test_core.cpython-38.pyc,,
+numpy/ma/tests/__pycache__/test_deprecations.cpython-38.pyc,,
+numpy/ma/tests/__pycache__/test_extras.cpython-38.pyc,,
+numpy/ma/tests/__pycache__/test_mrecords.cpython-38.pyc,,
+numpy/ma/tests/__pycache__/test_old_ma.cpython-38.pyc,,
+numpy/ma/tests/__pycache__/test_regression.cpython-38.pyc,,
+numpy/ma/tests/__pycache__/test_subclassing.cpython-38.pyc,,
+numpy/ma/tests/test_core.py,sha256=aQX5giSjLTRwHzyUbTUdoDpXeJzP3ZAajDVEB8CIeXM,206935
+numpy/ma/tests/test_deprecations.py,sha256=Dv-fqcxKJ_tfxyk-DyK2rA5onOl-7YC06Pu9nkvECt0,2326
+numpy/ma/tests/test_extras.py,sha256=_uTlvEtwEcLyYw3dS657rlP3nUz2p697aspFW9kze48,68630
+numpy/ma/tests/test_mrecords.py,sha256=KeUfhLLwjwhX-Wh1UvViiFdOO3JFj44BQDtiC4ZZUrE,20363
+numpy/ma/tests/test_old_ma.py,sha256=v99zHnxhbwdxqnzmUCZFy5hbzAPkZG6UcA3ijmnuvlE,33123
+numpy/ma/tests/test_regression.py,sha256=Hi-p5QdcivsxUDSpTl3MGtAnmJCJPhhIj3c5nYI9rw8,3170
+numpy/ma/tests/test_subclassing.py,sha256=_7LEDWP0uruXofBfuKotk_xPz7JSPd8FZ-WfF27IrOs,13181
+numpy/ma/testutils.py,sha256=94gtPCIs6pBrtt1w51rG-aH3Z_XCdYzete8uu1oeQdc,10565
+numpy/ma/timer_comparison.py,sha256=xhRDTkkqvVLvB5HeFKIQqGuicRerabKKX3VmBUGc4Zs,16101
+numpy/matlib.py,sha256=l-292Lvk_yUCK5Y_U9u1Xa8grW8Ss0uh23o8kj-Hhd8,10741
+numpy/matrixlib/__init__.py,sha256=OYwN1yrpX0doHcXpzdRm2moAUO8BCmgufnmd6DS43pI,228
+numpy/matrixlib/__init__.pyi,sha256=gkHjB8o5QIAq39IumANapcGnYj2FCihAUrqvIADp0t0,103
+numpy/matrixlib/__pycache__/__init__.cpython-38.pyc,,
+numpy/matrixlib/__pycache__/defmatrix.cpython-38.pyc,,
+numpy/matrixlib/__pycache__/setup.cpython-38.pyc,,
+numpy/matrixlib/defmatrix.py,sha256=zDXeDEu5DcW3R5ijl_MjGzp9bXM36uhWm3s0hbMTzJc,31780
+numpy/matrixlib/setup.py,sha256=DEY5vWe-ReFP31junY0nZ7HwDpRIVuHLUtiTXL_Kr3A,438
+numpy/matrixlib/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/matrixlib/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/matrixlib/tests/__pycache__/test_defmatrix.cpython-38.pyc,,
+numpy/matrixlib/tests/__pycache__/test_interaction.cpython-38.pyc,,
+numpy/matrixlib/tests/__pycache__/test_masked_matrix.cpython-38.pyc,,
+numpy/matrixlib/tests/__pycache__/test_matrix_linalg.cpython-38.pyc,,
+numpy/matrixlib/tests/__pycache__/test_multiarray.cpython-38.pyc,,
+numpy/matrixlib/tests/__pycache__/test_numeric.cpython-38.pyc,,
+numpy/matrixlib/tests/__pycache__/test_regression.cpython-38.pyc,,
+numpy/matrixlib/tests/test_defmatrix.py,sha256=nbY_HkwzoJbhYhACiEN-cZmR644sVJvMKWUcsANPayQ,15435
+numpy/matrixlib/tests/test_interaction.py,sha256=C1YtIubO6Qh8RR-XONzo8Mle4bu4SvwsvBnB0x0Gy4g,12229
+numpy/matrixlib/tests/test_masked_matrix.py,sha256=aKC-imVpBSyjnokr0Ntn-e47P1MXhKzOSnGz1ji9J_c,9156
+numpy/matrixlib/tests/test_matrix_linalg.py,sha256=9S9Zrk8PMLfEEo9wBx5LyrV_TbXhI6r-Hc5t594lQFY,2152
+numpy/matrixlib/tests/test_multiarray.py,sha256=E5jvWX9ypWYNHH7iqAW3xz3tMrEV-oNgjN3_oPzZzws,570
+numpy/matrixlib/tests/test_numeric.py,sha256=l-LFBKPoP3_O1iea23MmaACBLx_tSSdPcUBBRTiTbzk,458
+numpy/matrixlib/tests/test_regression.py,sha256=FgYV3hwkpO0qyshDzG7n1JfQ-kKwnSZnA68jJHS7TeM,958
+numpy/polynomial/__init__.py,sha256=SG2szESWgc9tqBY4dO_2EcidOI4EWX25cM1E-7cqCS4,6603
+numpy/polynomial/__init__.pyi,sha256=40ANjRQzcm84vUs3wqe0BJ7e2XuWFpcvVB7o9ZPf96E,352
+numpy/polynomial/__pycache__/__init__.cpython-38.pyc,,
+numpy/polynomial/__pycache__/_polybase.cpython-38.pyc,,
+numpy/polynomial/__pycache__/chebyshev.cpython-38.pyc,,
+numpy/polynomial/__pycache__/hermite.cpython-38.pyc,,
+numpy/polynomial/__pycache__/hermite_e.cpython-38.pyc,,
+numpy/polynomial/__pycache__/laguerre.cpython-38.pyc,,
+numpy/polynomial/__pycache__/legendre.cpython-38.pyc,,
+numpy/polynomial/__pycache__/polynomial.cpython-38.pyc,,
+numpy/polynomial/__pycache__/polyutils.cpython-38.pyc,,
+numpy/polynomial/__pycache__/setup.cpython-38.pyc,,
+numpy/polynomial/_polybase.py,sha256=0wJm5LbxcKNDEGa0xlho2LGkdOavwCBebsDaWmr8Vjw,37563
+numpy/polynomial/chebyshev.py,sha256=ylrydE6-AZb_jA-l8O3verfgVb6Ixgab32kXczyS5Bo,64492
+numpy/polynomial/hermite.py,sha256=72K9DSzx_Vcc5vKWIeW_zqV882_MQGcbGzBK_BhdBao,53820
+numpy/polynomial/hermite_e.py,sha256=LKEsRUkJvWizLngby0-qX_rnIgHHX5xZBYelDTkCsrM,53936
+numpy/polynomial/laguerre.py,sha256=wDRL-qxMLaIogQvT_ANjOaRDfJqE3cdbAfx-K9F6DT4,52096
+numpy/polynomial/legendre.py,sha256=nGumaDhnaAyargOW-G9g_AaJvnDR5oRmNlDePhVo1v0,52880
+numpy/polynomial/polynomial.py,sha256=ZWG5Z_11BwDFPLll6ksYbYiIfx4HYSCHjxKKBjpYWko,50100
+numpy/polynomial/polyutils.py,sha256=psxFjmYv1nrpFewtEPNIQfCE-umH6PumsQ1_CB0Vu9k,23932
+numpy/polynomial/setup.py,sha256=3MP1VT1AVy8_MdlhErP-lS0Rq5fActYCkxYeHJU88Vg,383
+numpy/polynomial/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/polynomial/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/polynomial/tests/__pycache__/test_chebyshev.cpython-38.pyc,,
+numpy/polynomial/tests/__pycache__/test_classes.cpython-38.pyc,,
+numpy/polynomial/tests/__pycache__/test_hermite.cpython-38.pyc,,
+numpy/polynomial/tests/__pycache__/test_hermite_e.cpython-38.pyc,,
+numpy/polynomial/tests/__pycache__/test_laguerre.cpython-38.pyc,,
+numpy/polynomial/tests/__pycache__/test_legendre.cpython-38.pyc,,
+numpy/polynomial/tests/__pycache__/test_polynomial.cpython-38.pyc,,
+numpy/polynomial/tests/__pycache__/test_polyutils.cpython-38.pyc,,
+numpy/polynomial/tests/__pycache__/test_printing.cpython-38.pyc,,
+numpy/polynomial/tests/test_chebyshev.py,sha256=PI2XwvGGqQKEB1RxbsYRgeTG0cunB_8Otd9SBJozq-8,21141
+numpy/polynomial/tests/test_classes.py,sha256=J6abNzhFKwaagzv_x53xN0whCfr5nMwqZ---Jrd9oxY,18931
+numpy/polynomial/tests/test_hermite.py,sha256=zGYN24ia2xx4IH16D6sfAxIipnZrGrIe7D8QMJZPw4Y,19132
+numpy/polynomial/tests/test_hermite_e.py,sha256=5ZBtGi2gkeldYVSh8xlQOLUDW6fcT4YdZiTrB6AaGJU,19467
+numpy/polynomial/tests/test_laguerre.py,sha256=hBgo8w_3iEQosX2CqjTkUstTiuTPLZmfQNQtyKudZLo,18048
+numpy/polynomial/tests/test_legendre.py,sha256=mJcXkot3E2uhcIZY-Bvb3EfWbOo601NG_gq0OwObuNk,18831
+numpy/polynomial/tests/test_polynomial.py,sha256=BHR8Cy7nhcxdsgrhEwyPRdswgQhDRZmnaoT9gb5O1VU,20628
+numpy/polynomial/tests/test_polyutils.py,sha256=F9Tghiw2LM1wqEHFHxCuFAR9rueLe-i-dakoEvsLgJE,3105
+numpy/polynomial/tests/test_printing.py,sha256=o0D4bNFYlFo0YpPYMB6RZwH5zEFpE6qjdeZ-j-D0YsI,16176
+numpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/random/__init__.pxd,sha256=g3EaMi3yfmnqT-KEWj0cp6SWIxVN9ChFjEYXGOfOifE,445
+numpy/random/__init__.py,sha256=rYnpCdx2jY6FC1tn4ev_5SekdgjT_xgl5X0dinpzLj4,7673
+numpy/random/__init__.pyi,sha256=uszjens-em1PfQ4dxIl0Tm7taoKi2dxI7C6_g40cWNI,990
+numpy/random/__pycache__/__init__.cpython-38.pyc,,
+numpy/random/__pycache__/_pickle.cpython-38.pyc,,
+numpy/random/__pycache__/setup.cpython-38.pyc,,
+numpy/random/_bounded_integers.cp38-win_amd64.pyd,sha256=3Vt-Dydza_2pc5lhKC2ceM7WausNKvgek4dvafjrmfA,239104
+numpy/random/_bounded_integers.pxd,sha256=ugYlh8FvGggHCjEaqgO4S_MeRcZg3mw40sDYEqx07QQ,1698
+numpy/random/_common.cp38-win_amd64.pyd,sha256=H7lAwXI6zh7qqfcILk3m9In-lMIm9R6u_9jIlUWiSeA,183808
+numpy/random/_common.pxd,sha256=N2NZYlMYNh7FzFbJ6Mr2DH3MkrG67HUwqOu-XX_ouAA,4855
+numpy/random/_examples/cffi/__pycache__/extending.cpython-38.pyc,,
+numpy/random/_examples/cffi/__pycache__/parse.cpython-38.pyc,,
+numpy/random/_examples/cffi/extending.py,sha256=BgydYEYBb6hDghMF-KQFVc8ssUU1F5Dg-3GyeilT3Vg,920
+numpy/random/_examples/cffi/parse.py,sha256=Jb5SRj8As2P07PtoeuiZHZctaY0oAb065PXbG4-T8fI,1884
+numpy/random/_examples/cython/__pycache__/setup.cpython-38.pyc,,
+numpy/random/_examples/cython/extending.pyx,sha256=_pKBslBsb8rGeFZkuQeAIhBdeIjDcX3roGqV_Jev7NE,2371
+numpy/random/_examples/cython/extending_distributions.pyx,sha256=1zrMvPbKi0RinyZ93Syyy4OXGEOzAAKHSzTmDtN09ZY,3987
+numpy/random/_examples/cython/setup.py,sha256=dvXjPDXSiWZwgq_Myapi2VggTzV0AGdSrEhrMmJmT0s,1366
+numpy/random/_examples/numba/__pycache__/extending.cpython-38.pyc,,
+numpy/random/_examples/numba/__pycache__/extending_distributions.cpython-38.pyc,,
+numpy/random/_examples/numba/extending.py,sha256=vnqUqQRvlAI-3VYDzIxSQDlb-smBAyj8fA1-M2IrOQw,2041
+numpy/random/_examples/numba/extending_distributions.py,sha256=tU62JEW13VyNuBPhSpDWqd9W9ammHJCLv61apg90lMc,2101
+numpy/random/_generator.cp38-win_amd64.pyd,sha256=37_BpHDxM4tsksj13M54756X0F8CrhEMouFg8Vhp0d8,672256
+numpy/random/_mt19937.cp38-win_amd64.pyd,sha256=aU67oXqPUXs3rbpXoZT0O60FN1ZuAG6B_LsSHkC89ek,79360
+numpy/random/_pcg64.cp38-win_amd64.pyd,sha256=dAGkINi2RBNVDwW0j2-9lgEqdAxtGGQ2EoHxCdRGL6s,65536
+numpy/random/_philox.cp38-win_amd64.pyd,sha256=TXbaZdoBUEn9umkfQ4C1-5eNLtEgn7PaOJQJgq1WKeI,72192
+numpy/random/_pickle.py,sha256=X1IKY4xyLBsWLG1vubCWyRRn-QsV-jm5McUH-Zc-uiU,2329
+numpy/random/_sfc64.cp38-win_amd64.pyd,sha256=6t1OiOW2ujxxDgakHEV6NUDx4vJHEYwxPrIFZi4nUuw,53248
+numpy/random/bit_generator.cp38-win_amd64.pyd,sha256=KgEJgkOkC6zuAPOlFCyqPxsrB_izg2YQLox3mS3ZYDw,153088
+numpy/random/bit_generator.pxd,sha256=LJpeB-EKeVV8_JO69sS33XJLZQ3DAhrUCNzs_ei7AoI,1042
+numpy/random/c_distributions.pxd,sha256=N8O_29MDGDOyMqmSKoaoooo4OJRRerBwsBXLw7_4j54,6147
+numpy/random/lib/npyrandom.lib,sha256=YmTApoJfa87GcxQutHJNzHPJi5sFGIxg7igbxDH0qBo,110126
+numpy/random/mtrand.cp38-win_amd64.pyd,sha256=P3q6lzwQCdt_BViZ4UBntkuQkc5u_2Hf-i64o8gg4Vg,566272
+numpy/random/setup.py,sha256=5JHmw9X-POJdt07i8sFUMpZLB2p0vh4dRU05xtEdtS0,6258
+numpy/random/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/random/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/random/tests/__pycache__/test_direct.cpython-38.pyc,,
+numpy/random/tests/__pycache__/test_extending.cpython-38.pyc,,
+numpy/random/tests/__pycache__/test_generator_mt19937.cpython-38.pyc,,
+numpy/random/tests/__pycache__/test_generator_mt19937_regressions.cpython-38.pyc,,
+numpy/random/tests/__pycache__/test_random.cpython-38.pyc,,
+numpy/random/tests/__pycache__/test_randomstate.cpython-38.pyc,,
+numpy/random/tests/__pycache__/test_randomstate_regression.cpython-38.pyc,,
+numpy/random/tests/__pycache__/test_regression.cpython-38.pyc,,
+numpy/random/tests/__pycache__/test_seed_sequence.cpython-38.pyc,,
+numpy/random/tests/__pycache__/test_smoke.cpython-38.pyc,,
+numpy/random/tests/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/random/tests/data/__pycache__/__init__.cpython-38.pyc,,
+numpy/random/tests/data/mt19937-testset-1.csv,sha256=bA5uuOXgLpkAwJjfV8oUePg3-eyaH4-gKe8AMcl2Xn0,16845
+numpy/random/tests/data/mt19937-testset-2.csv,sha256=SnOL1nyRbblYlC254PBUSc37NguV5xN-0W_B32IxDGE,16826
+numpy/random/tests/data/pcg64-testset-1.csv,sha256=wHoS7fIR3hMEdta7MtJ8EpIWX-Bw1yfSaVxiC15vxVs,24840
+numpy/random/tests/data/pcg64-testset-2.csv,sha256=6vlnVuW_4i6LEsVn6b40HjcBWWjoX5lboSCBDpDrzFs,24846
+numpy/random/tests/data/philox-testset-1.csv,sha256=QvpTynWHQjqTz3P2MPvtMLdg2VnM6TGTpXgp-_LeJ5g,24853
+numpy/random/tests/data/philox-testset-2.csv,sha256=-BNO1OCYtDIjnN5Q-AsQezBCGmVJUIs3qAMyj8SNtsA,24839
+numpy/random/tests/data/sfc64-testset-1.csv,sha256=sgkemW0lbKJ2wh1sBj6CfmXwFYTqfAk152P0r8emO38,24841
+numpy/random/tests/data/sfc64-testset-2.csv,sha256=mkp21SG8eCqsfNyQZdmiV41-xKcsV8eutT7rVnVEG50,24834
+numpy/random/tests/test_direct.py,sha256=7pjpeUADs8HTtEtbNbBTKi1EMsmO21lvYoMqHyoucdQ,14827
+numpy/random/tests/test_extending.py,sha256=FSv8xJt8fd1-clX6rOwrMhn66PfMn4JJRbJH46ptwVo,3598
+numpy/random/tests/test_generator_mt19937.py,sha256=NZp5ePTiw0N2R8j1wNTshrv8Gq3qdPxRFlmxYwzpEiM,108419
+numpy/random/tests/test_generator_mt19937_regressions.py,sha256=NErTZy-83MM4jMdguaE_5msKf1dhD2UyyXZsvTjtKS0,5803
+numpy/random/tests/test_random.py,sha256=wwyX-oMKUOp17kuObzZFrWYC_ImhVc79NPdqm1ufJlU,69907
+numpy/random/tests/test_randomstate.py,sha256=XLhtIFIhM3vWtXy6hQUTh-ek44kibgnbcdwm8jYne9U,82720
+numpy/random/tests/test_randomstate_regression.py,sha256=t-4vAs8vZbrmIHzMcSpzsgelRVu5gjYq8ZqDUY0PfHc,7758
+numpy/random/tests/test_regression.py,sha256=yRzgK9Nz0kc5gZgzoNKJExc8voyXIU0GworGVFQ2-QA,5602
+numpy/random/tests/test_seed_sequence.py,sha256=zWUvhWDxBmTN2WteSFQeJ29W0-2k3ZUze_3YtL4Kgms,3391
+numpy/random/tests/test_smoke.py,sha256=C9khpy2DZnpE5g0s5bSliun4GOTq-576faz0jmxpsWQ,28621
+numpy/rec.pyi,sha256=pEAReiHy1PylZO3YYKqJY-8nHM0Rq6Jgdcxyw1orbKs,181
+numpy/setup.py,sha256=fBEg6S2o6H9mmLBfVJOonPwEIN70qlxH5TQVdSb3yao,1012
+numpy/testing/__init__.py,sha256=s9TGtO8tH0kG8emfVLC1pBRUrgsb4ueWAwtIb6XQXLg,586
+numpy/testing/__init__.pyi,sha256=Ixqmb0Ve3ZxTLgJjN2l6Izh2uoJYiDjELFooTPCLXmU,956
+numpy/testing/__pycache__/__init__.cpython-38.pyc,,
+numpy/testing/__pycache__/print_coercion_tables.cpython-38.pyc,,
+numpy/testing/__pycache__/setup.cpython-38.pyc,,
+numpy/testing/__pycache__/utils.cpython-38.pyc,,
+numpy/testing/_private/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/testing/_private/__pycache__/__init__.cpython-38.pyc,,
+numpy/testing/_private/__pycache__/decorators.cpython-38.pyc,,
+numpy/testing/_private/__pycache__/noseclasses.cpython-38.pyc,,
+numpy/testing/_private/__pycache__/nosetester.cpython-38.pyc,,
+numpy/testing/_private/__pycache__/parameterized.cpython-38.pyc,,
+numpy/testing/_private/__pycache__/utils.cpython-38.pyc,,
+numpy/testing/_private/decorators.py,sha256=e_ylVQtyN_MjuOsd0AFaFmQ9wB7mtdHy8f0LBKj8u6s,9005
+numpy/testing/_private/noseclasses.py,sha256=OqMSWVZEg5GGgz8bsoDWKa3oxvXYoqPst6U423s8yBM,14880
+numpy/testing/_private/nosetester.py,sha256=35S7suLWVzYBZ-zOt3ugthNZcMBCP7AjA-Z-4jqmtus,19980
+numpy/testing/_private/parameterized.py,sha256=c5BMUIU86FLdsvouqOBT4t8BLk1q8F32KaXEcPgfi-c,16958
+numpy/testing/_private/utils.py,sha256=dH7BXvx3q55ktBlhM6f7pjc9H2phBr3SzfQP_D2xCdw,87843
+numpy/testing/print_coercion_tables.py,sha256=GnC-nt2Sw2D7TJOoIgK3b2Nj63r9VFqGzPStMfdOBgs,6367
+numpy/testing/setup.py,sha256=LRtPNvo1V4Eh_gCq0ScQXSxv3P428c4rAKOVj1JK3MI,685
+numpy/testing/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/testing/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/testing/tests/__pycache__/test_decorators.cpython-38.pyc,,
+numpy/testing/tests/__pycache__/test_doctesting.cpython-38.pyc,,
+numpy/testing/tests/__pycache__/test_utils.cpython-38.pyc,,
+numpy/testing/tests/test_decorators.py,sha256=zR2-CPT4vK_KE1st9LuaAAkP1PFthUkBCefjng088uI,6045
+numpy/testing/tests/test_doctesting.py,sha256=wUauOPx75yuJgIHNWlPCpF0EUIGKDI-nzlImCwGeYo0,1404
+numpy/testing/tests/test_utils.py,sha256=GwIHxAcqT570qsnTIo4lNZq8NJP5_scLS7-YmcreToU,57311
+numpy/testing/utils.py,sha256=LhIaw_3hG1jUW98rUrBhOxRi1SjOUgVIr5--kwp0XZc,1260
+numpy/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/tests/__pycache__/test_ctypeslib.cpython-38.pyc,,
+numpy/tests/__pycache__/test_matlib.cpython-38.pyc,,
+numpy/tests/__pycache__/test_numpy_version.cpython-38.pyc,,
+numpy/tests/__pycache__/test_public_api.cpython-38.pyc,,
+numpy/tests/__pycache__/test_reloading.cpython-38.pyc,,
+numpy/tests/__pycache__/test_scripts.cpython-38.pyc,,
+numpy/tests/__pycache__/test_warnings.cpython-38.pyc,,
+numpy/tests/test_ctypeslib.py,sha256=4hdwdxDArcTLHpinigBSLLGb_ppGtksPWRsvkRD0Z84,12535
+numpy/tests/test_matlib.py,sha256=TUaQmGoz9fvQQ8FrooTq-g9BFiViGWjoTIGQSUUF6-Y,1910
+numpy/tests/test_numpy_version.py,sha256=EzH8x1xpoowIlHlXQ-TEQaIJlmnx_rgrJtOCwdBXYyY,598
+numpy/tests/test_public_api.py,sha256=kmxV9zHfd3YZRuuaXXux-iGuQCsQGq5UIJPk8bBnnfQ,15456
+numpy/tests/test_reloading.py,sha256=WuaGiMPNSmoS2_cKKcsLFNI2iSIvxxR0O0f1Id7qW40,2007
+numpy/tests/test_scripts.py,sha256=KNmMlcO0sube9TLF3McxJZwzM87lLBzXZpjA6qJQkq0,1619
+numpy/tests/test_warnings.py,sha256=IMFVROBQqYZPibnHmwepGqEUQoBlDtdC8DlRulbMAd8,2354
+numpy/typing/__init__.py,sha256=SlrqSQGbOqvd6fkem4mHf7nyU1y75zd0AIwNNVJEzbc,7379
+numpy/typing/__pycache__/__init__.cpython-38.pyc,,
+numpy/typing/__pycache__/_add_docstring.cpython-38.pyc,,
+numpy/typing/__pycache__/_array_like.cpython-38.pyc,,
+numpy/typing/__pycache__/_callable.cpython-38.pyc,,
+numpy/typing/__pycache__/_dtype_like.cpython-38.pyc,,
+numpy/typing/__pycache__/_scalars.cpython-38.pyc,,
+numpy/typing/__pycache__/_shape.cpython-38.pyc,,
+numpy/typing/__pycache__/setup.cpython-38.pyc,,
+numpy/typing/_add_docstring.py,sha256=1qcfzFKkMl7vms4mztFapPC0Wwvjhe8ANxUOpYi_Fu4,2701
+numpy/typing/_array_like.py,sha256=na2mbjXRfOGOIHY5R7mxx7_Jr8__hpCKuIRdJGC7w1Q,1061
+numpy/typing/_callable.py,sha256=Jy74CjxwWv-DGGVH4d1u4SCR6ph9gmuiYNKu9NkN89I,11733
+numpy/typing/_dtype_like.py,sha256=MUQRBlzWwksVcLhvTduFxLr0No5VjIYEgJ1wyumX61I,2557
+numpy/typing/_scalars.py,sha256=pq1Y9MH0THa2Y0WZ26HDb7NGNIB5p-khAy70B8M8zuI,694
+numpy/typing/_shape.py,sha256=zl8gbEuxL1BqPzXVFFSwqkvI7kdxgdQTxXh1V_HI7v0,456
+numpy/typing/setup.py,sha256=NpNqwxDwSxWBInw-7TJHIqEf3scDAczZwmzGxI_Ftn0,385
+numpy/typing/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+numpy/typing/tests/__pycache__/__init__.cpython-38.pyc,,
+numpy/typing/tests/__pycache__/test_isfile.cpython-38.pyc,,
+numpy/typing/tests/__pycache__/test_typing.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/arithmetic.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/array_constructors.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/array_like.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/bitwise_ops.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/constants.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/dtype.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/flatiter.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/fromnumeric.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/modules.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/ndarray.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/ndarray_misc.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/numerictypes.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/scalars.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/ufunc_config.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/ufuncs.cpython-38.pyc,,
+numpy/typing/tests/data/fail/__pycache__/warnings_and_errors.cpython-38.pyc,,
+numpy/typing/tests/data/fail/arithmetic.py,sha256=aVKC-80x7Jj3V7cn5vaM2O-Sewsj0lT9NBnH7wQvANA,399
+numpy/typing/tests/data/fail/array_constructors.py,sha256=kNP8SE2jaL8kA3CCc4QWHGaMaJDigJ-uMyzOL6Am0a8,1041
+numpy/typing/tests/data/fail/array_like.py,sha256=kpQ9GYpCyNQnpCVNJfjzcjuyRaWcRSk5I3vwobto5Ik,486
+numpy/typing/tests/data/fail/bitwise_ops.py,sha256=6cpzCLl1EH81UiJwo5Qs-HkvUByG9V5MNLpk8nVrLLo,534
+numpy/typing/tests/data/fail/constants.py,sha256=rm5lDmBIS2M3CYKKvrZuzW_jKwGknLgc2Ih8bpDrOPc,274
+numpy/typing/tests/data/fail/dtype.py,sha256=mijyTgWwSqw6pgvd_cJ8XUYfjbsVa0-RfBhZkfynD2I,344
+numpy/typing/tests/data/fail/flatiter.py,sha256=YpW-SsU6ti1Pt2Adj-BgE0wQ9PAMYBylSN7y61Ujtfw,867
+numpy/typing/tests/data/fail/fromnumeric.py,sha256=3bTUhDm4ZztQK_V0oIA_4R8td9FXAb-qMxeWbsy4yTM,6178
+numpy/typing/tests/data/fail/modules.py,sha256=E2atmSaRx4Q8XOog-5WsqlFLpAr2FaO90WPegzg5Yd4,553
+numpy/typing/tests/data/fail/ndarray.py,sha256=2I4smD6MlUD23Xx8Rt1gCtjj_m-tI5JEma-Z0unrgas,416
+numpy/typing/tests/data/fail/ndarray_misc.py,sha256=_DySvTQjAbHH460tAURU_-EqOkfGFiR_10F20DMSd4w,587
+numpy/typing/tests/data/fail/numerictypes.py,sha256=S6Xn_z1KoI8tSVSZ0aM7alvDfyAxNxEQuhMjXVW1Uws,397
+numpy/typing/tests/data/fail/scalars.py,sha256=0SkWYaG2yGON82lcOzoU1EX2UrNrbtVvQA9MsxyV_V0,2558
+numpy/typing/tests/data/fail/ufunc_config.py,sha256=V5R7wY_P7KWn4IRxbLx42b1YF3wbIYzHEMr9BC41JHE,754
+numpy/typing/tests/data/fail/ufuncs.py,sha256=nJ0vP3zPzaC7-U8veFZlSXEjRFlhJTPaFgRJBGM39sc,235
+numpy/typing/tests/data/fail/warnings_and_errors.py,sha256=UhM-s2DqkkD-Nd2O7_y_34_ygn4w4nEip6AXsQ1kQ4k,287
+numpy/typing/tests/data/mypy.ini,sha256=eiFW-OwC4m5btqviLfeISc-OZHWfnzQWOo9gdDi4Ic8,108
+numpy/typing/tests/data/pass/__pycache__/arithmetic.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/array_constructors.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/array_like.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/bitwise_ops.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/dtype.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/flatiter.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/fromnumeric.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/literal.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/mod.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/modules.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/ndarray_conversion.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/ndarray_misc.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/ndarray_shape_manipulation.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/numeric.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/numerictypes.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/scalars.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/simple.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/simple_py3.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/ufunc_config.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/ufuncs.cpython-38.pyc,,
+numpy/typing/tests/data/pass/__pycache__/warnings_and_errors.cpython-38.pyc,,
+numpy/typing/tests/data/pass/arithmetic.py,sha256=yffdMBRbA2DSbEl9zh2ebMi_9G-3ToVKW9CDT5auezA,2495
+numpy/typing/tests/data/pass/array_constructors.py,sha256=dd4LPu7RvPwUDwyqO69ZR_b1vKsCFWH6j-Yc70CxkXo,2602
+numpy/typing/tests/data/pass/array_like.py,sha256=PvPiNZmIbiwTNa5pleaF_azkp8Wkt-FnWMxhb90tnZc,976
+numpy/typing/tests/data/pass/bitwise_ops.py,sha256=zYz-ZNXpxjXDdo4fYWv_RQZq5af581dnaZrlu0-sSC8,1101
+numpy/typing/tests/data/pass/dtype.py,sha256=sFp19iFTqL2BvDVYjfMahdfxSXtaW9LG5W2AKE-g7i8,1000
+numpy/typing/tests/data/pass/flatiter.py,sha256=IeJY7T1G2yE5sYFwEylBQxqzr8bBGnzWm1Uxx-aRooY,140
+numpy/typing/tests/data/pass/fromnumeric.py,sha256=eM6RUBjVInsShXlblqq07-I0QwoST8n6g8WWuPSgYtA,4002
+numpy/typing/tests/data/pass/literal.py,sha256=wtFjvftYilKJcuehgIWJTL0yXOO72gJKZBfrw_yjNMY,1344
+numpy/typing/tests/data/pass/mod.py,sha256=Intb9Ni_LlHhEka8kk81-601JCOl85jz_4_BQDA6iYI,1727
+numpy/typing/tests/data/pass/modules.py,sha256=UZnvViLGUfRQVCR8-OJ7MWphQBlArWPBcoUgaz-86IM,618
+numpy/typing/tests/data/pass/ndarray_conversion.py,sha256=-1iJDSvdD86k3yJCrWf1nouQrRHStf4cheiZ5OHFE78,1720
+numpy/typing/tests/data/pass/ndarray_misc.py,sha256=fvfAffZ5ebefXKZzTm2SMmi0xrhjlBVTd6dieI_fjsQ,2414
+numpy/typing/tests/data/pass/ndarray_shape_manipulation.py,sha256=yaBK3hW5fe2VpvARkn_NMeF-JX-OajI8JiRWOA_Uk7Y,687
+numpy/typing/tests/data/pass/numeric.py,sha256=VCJ993mY9u8v4eNhJOJuOtc9Ics8AsAlAQtrsaTXth8,1567
+numpy/typing/tests/data/pass/numerictypes.py,sha256=cyObIdejhEzrwA_awjstkvO-_b79iBJZ20nf9XlCMY8,749
+numpy/typing/tests/data/pass/scalars.py,sha256=4HpW5v6YE5b7AppntjoUnKorJBHT0-oDtx4qx7BVmN0,2698
+numpy/typing/tests/data/pass/simple.py,sha256=ChlX7VN0SPpa877JwPRb-JpBUgpwhDHJuQLbRBY75FM,2855
+numpy/typing/tests/data/pass/simple_py3.py,sha256=OBpoDmf5u4bRblugokiOZzufESsEmoU03MqipERrjLg,102
+numpy/typing/tests/data/pass/ufunc_config.py,sha256=l1JiZe3VXYLzgvbuk42Mk6fd_nvLsc9aJ233W0_MLm0,1170
+numpy/typing/tests/data/pass/ufuncs.py,sha256=NUCjNCXprCD0iQHbmCyft_vLGrCb5dwyf-86dNZF4S8,460
+numpy/typing/tests/data/pass/warnings_and_errors.py,sha256=CtuAoGmmjsiWw34jjPsFUMZDrmMsVssQ6KHBWsDk7Jw,179
+numpy/typing/tests/data/reveal/__pycache__/arithmetic.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/array_constructors.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/bitwise_ops.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/constants.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/dtype.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/flatiter.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/fromnumeric.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/mod.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/modules.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/nbit_base_example.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/ndarray_conversion.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/ndarray_misc.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/ndarray_shape_manipulation.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/numeric.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/numerictypes.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/scalars.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/ufunc_config.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/__pycache__/warnings_and_errors.cpython-38.pyc,,
+numpy/typing/tests/data/reveal/arithmetic.py,sha256=3AvTw9IEJkG9KO0MeVD1kctSpZalQIY1xWGYWlrO5EQ,15516
+numpy/typing/tests/data/reveal/array_constructors.py,sha256=zv-yZiNIRlS2ip4lDJJh4V-qldm1ibffvyrlkLrKJ8A,3921
+numpy/typing/tests/data/reveal/bitwise_ops.py,sha256=GJ4oIEaoqniGRnMJTo1XgJ1pJpKgNPnB_OqS4GFWg3M,5786
+numpy/typing/tests/data/reveal/constants.py,sha256=KA1cM3BLqwq4cjoFt2-oOkOEyEj05kv1Zm_usnN7POI,1794
+numpy/typing/tests/data/reveal/dtype.py,sha256=zEZAjKXcWyYeoFB8GYZI3N55N7XopAO9XzDduM9dxoo,2311
+numpy/typing/tests/data/reveal/flatiter.py,sha256=6XVwZ8MESoV3IGF0C8mUZg87ZPmsuGtm5yS7FCWphEE,485
+numpy/typing/tests/data/reveal/fromnumeric.py,sha256=jRFNKtWaznzyLjwIuN6w9Oq2AEANoslsa0eNEhN4_ng,9899
+numpy/typing/tests/data/reveal/mod.py,sha256=wlCsZkKMoiA3Oh1M2Azr5hC3aY77cyRLtLahaiDZ3-o,9037
+numpy/typing/tests/data/reveal/modules.py,sha256=faHLlqquClwykUILg8OTJ01km6MYEoICsVgIWyqrCtY,1943
+numpy/typing/tests/data/reveal/nbit_base_example.py,sha256=lV-J8KPlamCkRIkTm8Lzgywq7zOz1elplWw2516lmIo,544
+numpy/typing/tests/data/reveal/ndarray_conversion.py,sha256=mTbv2cNYU05dH7wxuPWFlhhMi4N0adi5ocF6MUyNCtc,1630
+numpy/typing/tests/data/reveal/ndarray_misc.py,sha256=P5-HugOViKrBNLgsQkFlx-VogrB4bszfu2funSjU7K8,4942
+numpy/typing/tests/data/reveal/ndarray_shape_manipulation.py,sha256=hRbNwpFuiWKPZ5YcOlFeER72qLOJzHle_IZQ0wj-Rfk,1041
+numpy/typing/tests/data/reveal/numeric.py,sha256=6Rn9N_73Jomx-hDZgbP5Ksd6Lw2ffOkvNuJIY9QZlpY,2890
+numpy/typing/tests/data/reveal/numerictypes.py,sha256=NXDYYJTvLP-aCNbSNQe7yuFWSmp_sbdCKVkYsQPd0Hg,666
+numpy/typing/tests/data/reveal/scalars.py,sha256=TG-L69AUViCSeSFSGkCV5FMnNc_8IugMXO4417AlCks,1156
+numpy/typing/tests/data/reveal/ufunc_config.py,sha256=dcIwOjSa4B2DWffbRTCFsgRUxQJWkfeKlTAgIlcLDeQ,1416
+numpy/typing/tests/data/reveal/warnings_and_errors.py,sha256=vgKMl6HOqJqp0kijIx9bOVY1p_0yNxZqnNJQHl4Bw3U,438
+numpy/typing/tests/test_isfile.py,sha256=_QxXdUtcEpjFYbJSL9JlEP73ghbS9QjvUgtCw04GDb0,914
+numpy/typing/tests/test_typing.py,sha256=St99JVX9g1U7yyWe--IFnhJJuu_uCNwgpzh7PLEnJy0,5452
+numpy/version.py,sha256=iP-bFjcFQufRC3yPglYF8f21XBlQGUq4qaQn7D4kYOg,332
diff --git a/venv/Lib/site-packages/numpy-1.20.3.dist-info/WHEEL b/venv/Lib/site-packages/numpy-1.20.3.dist-info/WHEEL
new file mode 100644
index 0000000..f7306a7
--- /dev/null
+++ b/venv/Lib/site-packages/numpy-1.20.3.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.36.2)
+Root-Is-Purelib: false
+Tag: cp38-cp38-win_amd64
+
diff --git a/venv/Lib/site-packages/numpy-1.20.3.dist-info/entry_points.txt b/venv/Lib/site-packages/numpy-1.20.3.dist-info/entry_points.txt
new file mode 100644
index 0000000..1010c24
--- /dev/null
+++ b/venv/Lib/site-packages/numpy-1.20.3.dist-info/entry_points.txt
@@ -0,0 +1,3 @@
+[console_scripts]
+f2py = numpy.f2py.f2py2e:main
+
diff --git a/venv/Lib/site-packages/numpy-1.20.3.dist-info/top_level.txt b/venv/Lib/site-packages/numpy-1.20.3.dist-info/top_level.txt
new file mode 100644
index 0000000..24ce15a
--- /dev/null
+++ b/venv/Lib/site-packages/numpy-1.20.3.dist-info/top_level.txt
@@ -0,0 +1 @@
+numpy
diff --git a/venv/Lib/site-packages/numpy/.libs/libopenblas.GK7GX5KEQ4F6UYO3P26ULGBQYHGQO7J4.gfortran-win_amd64.dll b/venv/Lib/site-packages/numpy/.libs/libopenblas.GK7GX5KEQ4F6UYO3P26ULGBQYHGQO7J4.gfortran-win_amd64.dll
new file mode 100644
index 0000000..e6b4242
Binary files /dev/null and b/venv/Lib/site-packages/numpy/.libs/libopenblas.GK7GX5KEQ4F6UYO3P26ULGBQYHGQO7J4.gfortran-win_amd64.dll differ
diff --git a/venv/Lib/site-packages/numpy/LICENSE.txt b/venv/Lib/site-packages/numpy/LICENSE.txt
new file mode 100644
index 0000000..04619f5
--- /dev/null
+++ b/venv/Lib/site-packages/numpy/LICENSE.txt
@@ -0,0 +1,938 @@
+
+----
+
+This binary distribution of NumPy also bundles the following software:
+
+
+Name: OpenBLAS
+Files: extra-dll\libopenb*.dll
+Description: bundled as a dynamically linked library
+Availability: https://github.com/xianyi/OpenBLAS/
+License: 3-clause BSD
+ Copyright (c) 2011-2014, The OpenBLAS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. Neither the name of the OpenBLAS project nor the names of
+ its contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Name: LAPACK
+Files: extra-dll\libopenb*.dll
+Description: bundled in OpenBLAS
+Availability: https://github.com/xianyi/OpenBLAS/
+License 3-clause BSD
+ Copyright (c) 1992-2013 The University of Tennessee and The University
+ of Tennessee Research Foundation. All rights
+ reserved.
+ Copyright (c) 2000-2013 The University of California Berkeley. All
+ rights reserved.
+ Copyright (c) 2006-2013 The University of Colorado Denver. All rights
+ reserved.
+
+ $COPYRIGHT$
+
+ Additional copyrights may follow
+
+ $HEADER$
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer listed
+ in this license in the documentation and/or other materials
+ provided with the distribution.
+
+ - Neither the name of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ The copyright holders provide no reassurances that the source code
+ provided does not infringe any patent, copyright, or any other
+ intellectual property rights of third parties. The copyright holders
+ disclaim any liability to any recipient for claims brought against
+ recipient by any third party for infringement of that parties
+ intellectual property rights.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Name: GCC runtime library
+Files: extra-dll\*.dll
+Description: statically linked, in DLL files compiled with gfortran only
+Availability: https://gcc.gnu.org/viewcvs/gcc/
+License: GPLv3 + runtime exception
+ Copyright (C) 2002-2017 Free Software Foundation, Inc.
+
+ Libgfortran is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Libgfortran is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ .
+
+
+Name: Microsoft Visual C++ Runtime Files
+Files: extra-dll\msvcp140.dll
+License: MSVC
+ https://www.visualstudio.com/license-terms/distributable-code-microsoft-visual-studio-2015-rc-microsoft-visual-studio-2015-sdk-rc-includes-utilities-buildserver-files/#visual-c-runtime
+
+ Subject to the License Terms for the software, you may copy and
+ distribute with your program any of the files within the followng
+ folder and its subfolders except as noted below. You may not modify
+ these files.
+
+ C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist
+
+ You may not distribute the contents of the following folders:
+
+ C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\debug_nonredist
+ C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\onecore\debug_nonredist
+
+ Subject to the License Terms for the software, you may copy and
+ distribute the following files with your program in your program’s
+ application local folder or by deploying them into the Global
+ Assembly Cache (GAC):
+
+ VC\atlmfc\lib\mfcmifc80.dll
+ VC\atlmfc\lib\amd64\mfcmifc80.dll
+
+
+Name: Microsoft Visual C++ Runtime Files
+Files: extra-dll\msvc*90.dll, extra-dll\Microsoft.VC90.CRT.manifest
+License: MSVC
+ For your convenience, we have provided the following folders for
+ use when redistributing VC++ runtime files. Subject to the license
+ terms for the software, you may redistribute the folder
+ (unmodified) in the application local folder as a sub-folder with
+ no change to the folder name. You may also redistribute all the
+ files (*.dll and *.manifest) within a folder, listed below the
+ folder for your convenience, as an entire set.
+
+ \VC\redist\x86\Microsoft.VC90.ATL\
+ atl90.dll
+ Microsoft.VC90.ATL.manifest
+ \VC\redist\ia64\Microsoft.VC90.ATL\
+ atl90.dll
+ Microsoft.VC90.ATL.manifest
+ \VC\redist\amd64\Microsoft.VC90.ATL\
+ atl90.dll
+ Microsoft.VC90.ATL.manifest
+ \VC\redist\x86\Microsoft.VC90.CRT\
+ msvcm90.dll
+ msvcp90.dll
+ msvcr90.dll
+ Microsoft.VC90.CRT.manifest
+ \VC\redist\ia64\Microsoft.VC90.CRT\
+ msvcm90.dll
+ msvcp90.dll
+ msvcr90.dll
+ Microsoft.VC90.CRT.manifest
+
+----
+
+Full text of license texts referred to above follows (that they are
+listed below does not necessarily imply the conditions apply to the
+present binary release):
+
+----
+
+GCC RUNTIME LIBRARY EXCEPTION
+
+Version 3.1, 31 March 2009
+
+Copyright (C) 2009 Free Software Foundation, Inc.
+
+Everyone is permitted to copy and distribute verbatim copies of this
+license document, but changing it is not allowed.
+
+This GCC Runtime Library Exception ("Exception") is an additional
+permission under section 7 of the GNU General Public License, version
+3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
+bears a notice placed by the copyright holder of the file stating that
+the file is governed by GPLv3 along with this Exception.
+
+When you use GCC to compile a program, GCC may combine portions of
+certain GCC header files and runtime libraries with the compiled
+program. The purpose of this Exception is to allow compilation of
+non-GPL (including proprietary) programs to use, in this way, the
+header files and runtime libraries covered by this Exception.
+
+0. Definitions.
+
+A file is an "Independent Module" if it either requires the Runtime
+Library for execution after a Compilation Process, or makes use of an
+interface provided by the Runtime Library, but is not otherwise based
+on the Runtime Library.
+
+"GCC" means a version of the GNU Compiler Collection, with or without
+modifications, governed by version 3 (or a specified later version) of
+the GNU General Public License (GPL) with the option of using any
+subsequent versions published by the FSF.
+
+"GPL-compatible Software" is software whose conditions of propagation,
+modification and use would permit combination with GCC in accord with
+the license of GCC.
+
+"Target Code" refers to output from any compiler for a real or virtual
+target processor architecture, in executable form or suitable for
+input to an assembler, loader, linker and/or execution
+phase. Notwithstanding that, Target Code does not include data in any
+format that is used as a compiler intermediate representation, or used
+for producing a compiler intermediate representation.
+
+The "Compilation Process" transforms code entirely represented in
+non-intermediate languages designed for human-written code, and/or in
+Java Virtual Machine byte code, into Target Code. Thus, for example,
+use of source code generators and preprocessors need not be considered
+part of the Compilation Process, since the Compilation Process can be
+understood as starting with the output of the generators or
+preprocessors.
+
+A Compilation Process is "Eligible" if it is done using GCC, alone or
+with other GPL-compatible software, or if it is done without using any
+work based on GCC. For example, using non-GPL-compatible Software to
+optimize any GCC intermediate representations would not qualify as an
+Eligible Compilation Process.
+
+1. Grant of Additional Permission.
+
+You have permission to propagate a work of Target Code formed by
+combining the Runtime Library with Independent Modules, even if such
+propagation would otherwise violate the terms of GPLv3, provided that
+all Target Code was generated by Eligible Compilation Processes. You
+may then convey such a combination under terms of your choice,
+consistent with the licensing of the Independent Modules.
+
+2. No Weakening of GCC Copyleft.
+
+The availability of this Exception does not imply any general
+presumption that third-party software is unaffected by the copyleft
+requirements of the license of GCC.
+
+----
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+ .
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/venv/Lib/site-packages/numpy/__config__.py b/venv/Lib/site-packages/numpy/__config__.py
new file mode 100644
index 0000000..2b2ee70
--- /dev/null
+++ b/venv/Lib/site-packages/numpy/__config__.py
@@ -0,0 +1,78 @@
+# This file is generated by numpy's setup.py
+# It contains system_info results at the time of building this package.
+__all__ = ["get_info","show"]
+
+
+import os
+import sys
+
+extra_dll_dir = os.path.join(os.path.dirname(__file__), '.libs')
+
+if sys.platform == 'win32' and os.path.isdir(extra_dll_dir):
+ if sys.version_info >= (3, 8):
+ os.add_dll_directory(extra_dll_dir)
+ else:
+ os.environ.setdefault('PATH', '')
+ os.environ['PATH'] += os.pathsep + extra_dll_dir
+
+blas_mkl_info={}
+blis_info={}
+openblas_info={'library_dirs': ['D:\\a\\1\\s\\numpy\\build\\openblas_info'], 'libraries': ['openblas_info'], 'language': 'f77', 'define_macros': [('HAVE_CBLAS', None)]}
+blas_opt_info={'library_dirs': ['D:\\a\\1\\s\\numpy\\build\\openblas_info'], 'libraries': ['openblas_info'], 'language': 'f77', 'define_macros': [('HAVE_CBLAS', None)]}
+lapack_mkl_info={}
+openblas_lapack_info={'library_dirs': ['D:\\a\\1\\s\\numpy\\build\\openblas_lapack_info'], 'libraries': ['openblas_lapack_info'], 'language': 'f77', 'define_macros': [('HAVE_CBLAS', None)]}
+lapack_opt_info={'library_dirs': ['D:\\a\\1\\s\\numpy\\build\\openblas_lapack_info'], 'libraries': ['openblas_lapack_info'], 'language': 'f77', 'define_macros': [('HAVE_CBLAS', None)]}
+
+def get_info(name):
+ g = globals()
+ return g.get(name, g.get(name + "_info", {}))
+
+def show():
+ """
+ Show libraries in the system on which NumPy was built.
+
+ Print information about various resources (libraries, library
+ directories, include directories, etc.) in the system on which
+ NumPy was built.
+
+ See Also
+ --------
+ get_include : Returns the directory containing NumPy C
+ header files.
+
+ Notes
+ -----
+ Classes specifying the information to be printed are defined
+ in the `numpy.distutils.system_info` module.
+
+ Information may include:
+
+ * ``language``: language used to write the libraries (mostly
+ C or f77)
+ * ``libraries``: names of libraries found in the system
+ * ``library_dirs``: directories containing the libraries
+ * ``include_dirs``: directories containing library header files
+ * ``src_dirs``: directories containing library source files
+ * ``define_macros``: preprocessor macros used by
+ ``distutils.setup``
+
+ Examples
+ --------
+ >>> import numpy as np
+ >>> np.show_config()
+ blas_opt_info:
+ language = c
+ define_macros = [('HAVE_CBLAS', None)]
+ libraries = ['openblas', 'openblas']
+ library_dirs = ['/usr/local/lib']
+ """
+ for name,info_dict in globals().items():
+ if name[0] == "_" or type(info_dict) is not type({}): continue
+ print(name + ":")
+ if not info_dict:
+ print(" NOT AVAILABLE")
+ for k,v in info_dict.items():
+ v = str(v)
+ if k == "sources" and len(v) > 200:
+ v = v[:60] + " ...\n... " + v[-60:]
+ print(" %s = %s" % (k,v))
diff --git a/venv/Lib/site-packages/numpy/__init__.cython-30.pxd b/venv/Lib/site-packages/numpy/__init__.cython-30.pxd
new file mode 100644
index 0000000..a2c451b
--- /dev/null
+++ b/venv/Lib/site-packages/numpy/__init__.cython-30.pxd
@@ -0,0 +1,1055 @@
+# NumPy static imports for Cython >= 3.0
+#
+# If any of the PyArray_* functions are called, import_array must be
+# called first. This is done automatically by Cython 3.0+ if a call
+# is not detected inside of the module.
+#
+# Author: Dag Sverre Seljebotn
+#
+
+from cpython.ref cimport Py_INCREF
+from cpython.object cimport PyObject, PyTypeObject, PyObject_TypeCheck
+cimport libc.stdio as stdio
+
+
+cdef extern from *:
+ # Leave a marker that the NumPy declarations came from NumPy itself and not from Cython.
+ # See https://github.com/cython/cython/issues/3573
+ """
+ /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */
+ """
+
+
+cdef extern from "Python.h":
+ ctypedef Py_ssize_t Py_intptr_t
+
+cdef extern from "numpy/arrayobject.h":
+ ctypedef Py_intptr_t npy_intp
+ ctypedef size_t npy_uintp
+
+ cdef enum NPY_TYPES:
+ NPY_BOOL
+ NPY_BYTE
+ NPY_UBYTE
+ NPY_SHORT
+ NPY_USHORT
+ NPY_INT
+ NPY_UINT
+ NPY_LONG
+ NPY_ULONG
+ NPY_LONGLONG
+ NPY_ULONGLONG
+ NPY_FLOAT
+ NPY_DOUBLE
+ NPY_LONGDOUBLE
+ NPY_CFLOAT
+ NPY_CDOUBLE
+ NPY_CLONGDOUBLE
+ NPY_OBJECT
+ NPY_STRING
+ NPY_UNICODE
+ NPY_VOID
+ NPY_DATETIME
+ NPY_TIMEDELTA
+ NPY_NTYPES
+ NPY_NOTYPE
+
+ NPY_INT8
+ NPY_INT16
+ NPY_INT32
+ NPY_INT64
+ NPY_INT128
+ NPY_INT256
+ NPY_UINT8
+ NPY_UINT16
+ NPY_UINT32
+ NPY_UINT64
+ NPY_UINT128
+ NPY_UINT256
+ NPY_FLOAT16
+ NPY_FLOAT32
+ NPY_FLOAT64
+ NPY_FLOAT80
+ NPY_FLOAT96
+ NPY_FLOAT128
+ NPY_FLOAT256
+ NPY_COMPLEX32
+ NPY_COMPLEX64
+ NPY_COMPLEX128
+ NPY_COMPLEX160
+ NPY_COMPLEX192
+ NPY_COMPLEX256
+ NPY_COMPLEX512
+
+ NPY_INTP
+
+ ctypedef enum NPY_ORDER:
+ NPY_ANYORDER
+ NPY_CORDER
+ NPY_FORTRANORDER
+ NPY_KEEPORDER
+
+ ctypedef enum NPY_CASTING:
+ NPY_NO_CASTING
+ NPY_EQUIV_CASTING
+ NPY_SAFE_CASTING
+ NPY_SAME_KIND_CASTING
+ NPY_UNSAFE_CASTING
+
+ ctypedef enum NPY_CLIPMODE:
+ NPY_CLIP
+ NPY_WRAP
+ NPY_RAISE
+
+ ctypedef enum NPY_SCALARKIND:
+ NPY_NOSCALAR,
+ NPY_BOOL_SCALAR,
+ NPY_INTPOS_SCALAR,
+ NPY_INTNEG_SCALAR,
+ NPY_FLOAT_SCALAR,
+ NPY_COMPLEX_SCALAR,
+ NPY_OBJECT_SCALAR
+
+ ctypedef enum NPY_SORTKIND:
+ NPY_QUICKSORT
+ NPY_HEAPSORT
+ NPY_MERGESORT
+
+ ctypedef enum NPY_SEARCHSIDE:
+ NPY_SEARCHLEFT
+ NPY_SEARCHRIGHT
+
+ enum:
+ # DEPRECATED since NumPy 1.7 ! Do not use in new code!
+ NPY_C_CONTIGUOUS
+ NPY_F_CONTIGUOUS
+ NPY_CONTIGUOUS
+ NPY_FORTRAN
+ NPY_OWNDATA
+ NPY_FORCECAST
+ NPY_ENSURECOPY
+ NPY_ENSUREARRAY
+ NPY_ELEMENTSTRIDES
+ NPY_ALIGNED
+ NPY_NOTSWAPPED
+ NPY_WRITEABLE
+ NPY_UPDATEIFCOPY
+ NPY_ARR_HAS_DESCR
+
+ NPY_BEHAVED
+ NPY_BEHAVED_NS
+ NPY_CARRAY
+ NPY_CARRAY_RO
+ NPY_FARRAY
+ NPY_FARRAY_RO
+ NPY_DEFAULT
+
+ NPY_IN_ARRAY
+ NPY_OUT_ARRAY
+ NPY_INOUT_ARRAY
+ NPY_IN_FARRAY
+ NPY_OUT_FARRAY
+ NPY_INOUT_FARRAY
+
+ NPY_UPDATE_ALL
+
+ enum:
+ # Added in NumPy 1.7 to replace the deprecated enums above.
+ NPY_ARRAY_C_CONTIGUOUS
+ NPY_ARRAY_F_CONTIGUOUS
+ NPY_ARRAY_OWNDATA
+ NPY_ARRAY_FORCECAST
+ NPY_ARRAY_ENSURECOPY
+ NPY_ARRAY_ENSUREARRAY
+ NPY_ARRAY_ELEMENTSTRIDES
+ NPY_ARRAY_ALIGNED
+ NPY_ARRAY_NOTSWAPPED
+ NPY_ARRAY_WRITEABLE
+ NPY_ARRAY_UPDATEIFCOPY
+
+ NPY_ARRAY_BEHAVED
+ NPY_ARRAY_BEHAVED_NS
+ NPY_ARRAY_CARRAY
+ NPY_ARRAY_CARRAY_RO
+ NPY_ARRAY_FARRAY
+ NPY_ARRAY_FARRAY_RO
+ NPY_ARRAY_DEFAULT
+
+ NPY_ARRAY_IN_ARRAY
+ NPY_ARRAY_OUT_ARRAY
+ NPY_ARRAY_INOUT_ARRAY
+ NPY_ARRAY_IN_FARRAY
+ NPY_ARRAY_OUT_FARRAY
+ NPY_ARRAY_INOUT_FARRAY
+
+ NPY_ARRAY_UPDATE_ALL
+
+ cdef enum:
+ NPY_MAXDIMS
+
+ npy_intp NPY_MAX_ELSIZE
+
+ ctypedef void (*PyArray_VectorUnaryFunc)(void *, void *, npy_intp, void *, void *)
+
+ ctypedef struct PyArray_ArrayDescr:
+ # shape is a tuple, but Cython doesn't support "tuple shape"
+ # inside a non-PyObject declaration, so we have to declare it
+ # as just a PyObject*.
+ PyObject* shape
+
+ ctypedef struct PyArray_Descr:
+ pass
+
+ ctypedef class numpy.dtype [object PyArray_Descr, check_size ignore]:
+ # Use PyDataType_* macros when possible, however there are no macros
+ # for accessing some of the fields, so some are defined.
+ cdef PyTypeObject* typeobj
+ cdef char kind
+ cdef char type
+ # Numpy sometimes mutates this without warning (e.g. it'll
+ # sometimes change "|" to "<" in shared dtype objects on
+ # little-endian machines). If this matters to you, use
+ # PyArray_IsNativeByteOrder(dtype.byteorder) instead of
+ # directly accessing this field.
+ cdef char byteorder
+ cdef char flags
+ cdef int type_num
+ cdef int itemsize "elsize"
+ cdef int alignment
+ cdef object fields
+ cdef tuple names
+ # Use PyDataType_HASSUBARRAY to test whether this field is
+ # valid (the pointer can be NULL). Most users should access
+ # this field via the inline helper method PyDataType_SHAPE.
+ cdef PyArray_ArrayDescr* subarray
+
+ ctypedef class numpy.flatiter [object PyArrayIterObject, check_size ignore]:
+ # Use through macros
+ pass
+
+ ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]:
+ # Use through macros
+ pass
+
+ ctypedef struct PyArrayObject:
+ # For use in situations where ndarray can't replace PyArrayObject*,
+ # like PyArrayObject**.
+ pass
+
+ ctypedef class numpy.ndarray [object PyArrayObject, check_size ignore]:
+ cdef __cythonbufferdefaults__ = {"mode": "strided"}
+
+ # NOTE: no field declarations since direct access is deprecated since NumPy 1.7
+ # Instead, we use properties that map to the corresponding C-API functions.
+
+ @property
+ cdef inline PyObject* base(self) nogil:
+ """Returns a borrowed reference to the object owning the data/memory.
+ """
+ return PyArray_BASE(self)
+
+ @property
+ cdef inline dtype descr(self):
+ """Returns an owned reference to the dtype of the array.
+ """
+ return PyArray_DESCR(self)
+
+ @property
+ cdef inline int ndim(self) nogil:
+ """Returns the number of dimensions in the array.
+ """
+ return PyArray_NDIM(self)
+
+ @property
+ cdef inline npy_intp *shape(self) nogil:
+ """Returns a pointer to the dimensions/shape of the array.
+ The number of elements matches the number of dimensions of the array (ndim).
+ Can return NULL for 0-dimensional arrays.
+ """
+ return PyArray_DIMS(self)
+
+ @property
+ cdef inline npy_intp *strides(self) nogil:
+ """Returns a pointer to the strides of the array.
+ The number of elements matches the number of dimensions of the array (ndim).
+ """
+ return PyArray_STRIDES(self)
+
+ @property
+ cdef inline npy_intp size(self) nogil:
+ """Returns the total size (in number of elements) of the array.
+ """
+ return PyArray_SIZE(self)
+
+ @property
+ cdef inline char* data(self) nogil:
+ """The pointer to the data buffer as a char*.
+ This is provided for legacy reasons to avoid direct struct field access.
+ For new code that needs this access, you probably want to cast the result
+ of `PyArray_DATA()` instead, which returns a 'void*'.
+ """
+ return PyArray_BYTES(self)
+
+ ctypedef unsigned char npy_bool
+
+ ctypedef signed char npy_byte
+ ctypedef signed short npy_short
+ ctypedef signed int npy_int
+ ctypedef signed long npy_long
+ ctypedef signed long long npy_longlong
+
+ ctypedef unsigned char npy_ubyte
+ ctypedef unsigned short npy_ushort
+ ctypedef unsigned int npy_uint
+ ctypedef unsigned long npy_ulong
+ ctypedef unsigned long long npy_ulonglong
+
+ ctypedef float npy_float
+ ctypedef double npy_double
+ ctypedef long double npy_longdouble
+
+ ctypedef signed char npy_int8
+ ctypedef signed short npy_int16
+ ctypedef signed int npy_int32
+ ctypedef signed long long npy_int64
+ ctypedef signed long long npy_int96
+ ctypedef signed long long npy_int128
+
+ ctypedef unsigned char npy_uint8
+ ctypedef unsigned short npy_uint16
+ ctypedef unsigned int npy_uint32
+ ctypedef unsigned long long npy_uint64
+ ctypedef unsigned long long npy_uint96
+ ctypedef unsigned long long npy_uint128
+
+ ctypedef float npy_float32
+ ctypedef double npy_float64
+ ctypedef long double npy_float80
+ ctypedef long double npy_float96
+ ctypedef long double npy_float128
+
+ ctypedef struct npy_cfloat:
+ float real
+ float imag
+
+ ctypedef struct npy_cdouble:
+ double real
+ double imag
+
+ ctypedef struct npy_clongdouble:
+ long double real
+ long double imag
+
+ ctypedef struct npy_complex64:
+ float real
+ float imag
+
+ ctypedef struct npy_complex128:
+ double real
+ double imag
+
+ ctypedef struct npy_complex160:
+ long double real
+ long double imag
+
+ ctypedef struct npy_complex192:
+ long double real
+ long double imag
+
+ ctypedef struct npy_complex256:
+ long double real
+ long double imag
+
+ ctypedef struct PyArray_Dims:
+ npy_intp *ptr
+ int len
+
+ int _import_array() except -1
+ # A second definition so _import_array isn't marked as used when we use it here.
+ # Do not use - subject to change any time.
+ int __pyx_import_array "_import_array"() except -1
+
+ #
+ # Macros from ndarrayobject.h
+ #
+ bint PyArray_CHKFLAGS(ndarray m, int flags) nogil
+ bint PyArray_IS_C_CONTIGUOUS(ndarray arr) nogil
+ bint PyArray_IS_F_CONTIGUOUS(ndarray arr) nogil
+ bint PyArray_ISCONTIGUOUS(ndarray m) nogil
+ bint PyArray_ISWRITEABLE(ndarray m) nogil
+ bint PyArray_ISALIGNED(ndarray m) nogil
+
+ int PyArray_NDIM(ndarray) nogil
+ bint PyArray_ISONESEGMENT(ndarray) nogil
+ bint PyArray_ISFORTRAN(ndarray) nogil
+ int PyArray_FORTRANIF(ndarray) nogil
+
+ void* PyArray_DATA(ndarray) nogil
+ char* PyArray_BYTES(ndarray) nogil
+
+ npy_intp* PyArray_DIMS(ndarray) nogil
+ npy_intp* PyArray_STRIDES(ndarray) nogil
+ npy_intp PyArray_DIM(ndarray, size_t) nogil
+ npy_intp PyArray_STRIDE(ndarray, size_t) nogil
+
+ PyObject *PyArray_BASE(ndarray) nogil # returns borrowed reference!
+ PyArray_Descr *PyArray_DESCR(ndarray) nogil # returns borrowed reference to dtype!
+ PyArray_Descr *PyArray_DTYPE(ndarray) nogil # returns borrowed reference to dtype! NP 1.7+ alias for descr.
+ int PyArray_FLAGS(ndarray) nogil
+ void PyArray_CLEARFLAGS(ndarray, int flags) nogil # Added in NumPy 1.7
+ void PyArray_ENABLEFLAGS(ndarray, int flags) nogil # Added in NumPy 1.7
+ npy_intp PyArray_ITEMSIZE(ndarray) nogil
+ int PyArray_TYPE(ndarray arr) nogil
+
+ object PyArray_GETITEM(ndarray arr, void *itemptr)
+ int PyArray_SETITEM(ndarray arr, void *itemptr, object obj)
+
+ bint PyTypeNum_ISBOOL(int) nogil
+ bint PyTypeNum_ISUNSIGNED(int) nogil
+ bint PyTypeNum_ISSIGNED(int) nogil
+ bint PyTypeNum_ISINTEGER(int) nogil
+ bint PyTypeNum_ISFLOAT(int) nogil
+ bint PyTypeNum_ISNUMBER(int) nogil
+ bint PyTypeNum_ISSTRING(int) nogil
+ bint PyTypeNum_ISCOMPLEX(int) nogil
+ bint PyTypeNum_ISPYTHON(int) nogil
+ bint PyTypeNum_ISFLEXIBLE(int) nogil
+ bint PyTypeNum_ISUSERDEF(int) nogil
+ bint PyTypeNum_ISEXTENDED(int) nogil
+ bint PyTypeNum_ISOBJECT(int) nogil
+
+ bint PyDataType_ISBOOL(dtype) nogil
+ bint PyDataType_ISUNSIGNED(dtype) nogil
+ bint PyDataType_ISSIGNED(dtype) nogil
+ bint PyDataType_ISINTEGER(dtype) nogil
+ bint PyDataType_ISFLOAT(dtype) nogil
+ bint PyDataType_ISNUMBER(dtype) nogil
+ bint PyDataType_ISSTRING(dtype) nogil
+ bint PyDataType_ISCOMPLEX(dtype) nogil
+ bint PyDataType_ISPYTHON(dtype) nogil
+ bint PyDataType_ISFLEXIBLE(dtype) nogil
+ bint PyDataType_ISUSERDEF(dtype) nogil
+ bint PyDataType_ISEXTENDED(dtype) nogil
+ bint PyDataType_ISOBJECT(dtype) nogil
+ bint PyDataType_HASFIELDS(dtype) nogil
+ bint PyDataType_HASSUBARRAY(dtype) nogil
+
+ bint PyArray_ISBOOL(ndarray) nogil
+ bint PyArray_ISUNSIGNED(ndarray) nogil
+ bint PyArray_ISSIGNED(ndarray) nogil
+ bint PyArray_ISINTEGER(ndarray) nogil
+ bint PyArray_ISFLOAT(ndarray) nogil
+ bint PyArray_ISNUMBER(ndarray) nogil
+ bint PyArray_ISSTRING(ndarray) nogil
+ bint PyArray_ISCOMPLEX(ndarray) nogil
+ bint PyArray_ISPYTHON(ndarray) nogil
+ bint PyArray_ISFLEXIBLE(ndarray) nogil
+ bint PyArray_ISUSERDEF(ndarray) nogil
+ bint PyArray_ISEXTENDED(ndarray) nogil
+ bint PyArray_ISOBJECT(ndarray) nogil
+ bint PyArray_HASFIELDS(ndarray) nogil
+
+ bint PyArray_ISVARIABLE(ndarray) nogil
+
+ bint PyArray_SAFEALIGNEDCOPY(ndarray) nogil
+ bint PyArray_ISNBO(char) nogil # works on ndarray.byteorder
+ bint PyArray_IsNativeByteOrder(char) nogil # works on ndarray.byteorder
+ bint PyArray_ISNOTSWAPPED(ndarray) nogil
+ bint PyArray_ISBYTESWAPPED(ndarray) nogil
+
+ bint PyArray_FLAGSWAP(ndarray, int) nogil
+
+ bint PyArray_ISCARRAY(ndarray) nogil
+ bint PyArray_ISCARRAY_RO(ndarray) nogil
+ bint PyArray_ISFARRAY(ndarray) nogil
+ bint PyArray_ISFARRAY_RO(ndarray) nogil
+ bint PyArray_ISBEHAVED(ndarray) nogil
+ bint PyArray_ISBEHAVED_RO(ndarray) nogil
+
+
+ bint PyDataType_ISNOTSWAPPED(dtype) nogil
+ bint PyDataType_ISBYTESWAPPED(dtype) nogil
+
+ bint PyArray_DescrCheck(object)
+
+ bint PyArray_Check(object)
+ bint PyArray_CheckExact(object)
+
+ # Cannot be supported due to out arg:
+ # bint PyArray_HasArrayInterfaceType(object, dtype, object, object&)
+ # bint PyArray_HasArrayInterface(op, out)
+
+
+ bint PyArray_IsZeroDim(object)
+ # Cannot be supported due to ## ## in macro:
+ # bint PyArray_IsScalar(object, verbatim work)
+ bint PyArray_CheckScalar(object)
+ bint PyArray_IsPythonNumber(object)
+ bint PyArray_IsPythonScalar(object)
+ bint PyArray_IsAnyScalar(object)
+ bint PyArray_CheckAnyScalar(object)
+
+ ndarray PyArray_GETCONTIGUOUS(ndarray)
+ bint PyArray_SAMESHAPE(ndarray, ndarray) nogil
+ npy_intp PyArray_SIZE(ndarray) nogil
+ npy_intp PyArray_NBYTES(ndarray) nogil
+
+ object PyArray_FROM_O(object)
+ object PyArray_FROM_OF(object m, int flags)
+ object PyArray_FROM_OT(object m, int type)
+ object PyArray_FROM_OTF(object m, int type, int flags)
+ object PyArray_FROMANY(object m, int type, int min, int max, int flags)
+ object PyArray_ZEROS(int nd, npy_intp* dims, int type, int fortran)
+ object PyArray_EMPTY(int nd, npy_intp* dims, int type, int fortran)
+ void PyArray_FILLWBYTE(object, int val)
+ npy_intp PyArray_REFCOUNT(object)
+ object PyArray_ContiguousFromAny(op, int, int min_depth, int max_depth)
+ unsigned char PyArray_EquivArrTypes(ndarray a1, ndarray a2)
+ bint PyArray_EquivByteorders(int b1, int b2) nogil
+ object PyArray_SimpleNew(int nd, npy_intp* dims, int typenum)
+ object PyArray_SimpleNewFromData(int nd, npy_intp* dims, int typenum, void* data)
+ #object PyArray_SimpleNewFromDescr(int nd, npy_intp* dims, dtype descr)
+ object PyArray_ToScalar(void* data, ndarray arr)
+
+ void* PyArray_GETPTR1(ndarray m, npy_intp i) nogil
+ void* PyArray_GETPTR2(ndarray m, npy_intp i, npy_intp j) nogil
+ void* PyArray_GETPTR3(ndarray m, npy_intp i, npy_intp j, npy_intp k) nogil
+ void* PyArray_GETPTR4(ndarray m, npy_intp i, npy_intp j, npy_intp k, npy_intp l) nogil
+
+ void PyArray_XDECREF_ERR(ndarray)
+ # Cannot be supported due to out arg
+ # void PyArray_DESCR_REPLACE(descr)
+
+
+ object PyArray_Copy(ndarray)
+ object PyArray_FromObject(object op, int type, int min_depth, int max_depth)
+ object PyArray_ContiguousFromObject(object op, int type, int min_depth, int max_depth)
+ object PyArray_CopyFromObject(object op, int type, int min_depth, int max_depth)
+
+ object PyArray_Cast(ndarray mp, int type_num)
+ object PyArray_Take(ndarray ap, object items, int axis)
+ object PyArray_Put(ndarray ap, object items, object values)
+
+ void PyArray_ITER_RESET(flatiter it) nogil
+ void PyArray_ITER_NEXT(flatiter it) nogil
+ void PyArray_ITER_GOTO(flatiter it, npy_intp* destination) nogil
+ void PyArray_ITER_GOTO1D(flatiter it, npy_intp ind) nogil
+ void* PyArray_ITER_DATA(flatiter it) nogil
+ bint PyArray_ITER_NOTDONE(flatiter it) nogil
+
+ void PyArray_MultiIter_RESET(broadcast multi) nogil
+ void PyArray_MultiIter_NEXT(broadcast multi) nogil
+ void PyArray_MultiIter_GOTO(broadcast multi, npy_intp dest) nogil
+ void PyArray_MultiIter_GOTO1D(broadcast multi, npy_intp ind) nogil
+ void* PyArray_MultiIter_DATA(broadcast multi, npy_intp i) nogil
+ void PyArray_MultiIter_NEXTi(broadcast multi, npy_intp i) nogil
+ bint PyArray_MultiIter_NOTDONE(broadcast multi) nogil
+
+ # Functions from __multiarray_api.h
+
+ # Functions taking dtype and returning object/ndarray are disabled
+ # for now as they steal dtype references. I'm conservative and disable
+ # more than is probably needed until it can be checked further.
+ int PyArray_SetNumericOps (object)
+ object PyArray_GetNumericOps ()
+ int PyArray_INCREF (ndarray)
+ int PyArray_XDECREF (ndarray)
+ void PyArray_SetStringFunction (object, int)
+ dtype PyArray_DescrFromType (int)
+ object PyArray_TypeObjectFromType (int)
+ char * PyArray_Zero (ndarray)
+ char * PyArray_One (ndarray)
+ #object PyArray_CastToType (ndarray, dtype, int)
+ int PyArray_CastTo (ndarray, ndarray)
+ int PyArray_CastAnyTo (ndarray, ndarray)
+ int PyArray_CanCastSafely (int, int)
+ npy_bool PyArray_CanCastTo (dtype, dtype)
+ int PyArray_ObjectType (object, int)
+ dtype PyArray_DescrFromObject (object, dtype)
+ #ndarray* PyArray_ConvertToCommonType (object, int *)
+ dtype PyArray_DescrFromScalar (object)
+ dtype PyArray_DescrFromTypeObject (object)
+ npy_intp PyArray_Size (object)
+ #object PyArray_Scalar (void *, dtype, object)
+ #object PyArray_FromScalar (object, dtype)
+ void PyArray_ScalarAsCtype (object, void *)
+ #int PyArray_CastScalarToCtype (object, void *, dtype)
+ #int PyArray_CastScalarDirect (object, dtype, void *, int)
+ object PyArray_ScalarFromObject (object)
+ #PyArray_VectorUnaryFunc * PyArray_GetCastFunc (dtype, int)
+ object PyArray_FromDims (int, int *, int)
+ #object PyArray_FromDimsAndDataAndDescr (int, int *, dtype, char *)
+ #object PyArray_FromAny (object, dtype, int, int, int, object)
+ object PyArray_EnsureArray (object)
+ object PyArray_EnsureAnyArray (object)
+ #object PyArray_FromFile (stdio.FILE *, dtype, npy_intp, char *)
+ #object PyArray_FromString (char *, npy_intp, dtype, npy_intp, char *)
+ #object PyArray_FromBuffer (object, dtype, npy_intp, npy_intp)
+ #object PyArray_FromIter (object, dtype, npy_intp)
+ object PyArray_Return (ndarray)
+ #object PyArray_GetField (ndarray, dtype, int)
+ #int PyArray_SetField (ndarray, dtype, int, object)
+ object PyArray_Byteswap (ndarray, npy_bool)
+ object PyArray_Resize (ndarray, PyArray_Dims *, int, NPY_ORDER)
+ int PyArray_MoveInto (ndarray, ndarray)
+ int PyArray_CopyInto (ndarray, ndarray)
+ int PyArray_CopyAnyInto (ndarray, ndarray)
+ int PyArray_CopyObject (ndarray, object)
+ object PyArray_NewCopy (ndarray, NPY_ORDER)
+ object PyArray_ToList (ndarray)
+ object PyArray_ToString (ndarray, NPY_ORDER)
+ int PyArray_ToFile (ndarray, stdio.FILE *, char *, char *)
+ int PyArray_Dump (object, object, int)
+ object PyArray_Dumps (object, int)
+ int PyArray_ValidType (int)
+ void PyArray_UpdateFlags (ndarray, int)
+ object PyArray_New (type, int, npy_intp *, int, npy_intp *, void *, int, int, object)
+ #object PyArray_NewFromDescr (type, dtype, int, npy_intp *, npy_intp *, void *, int, object)
+ #dtype PyArray_DescrNew (dtype)
+ dtype PyArray_DescrNewFromType (int)
+ double PyArray_GetPriority (object, double)
+ object PyArray_IterNew (object)
+ object PyArray_MultiIterNew (int, ...)
+
+ int PyArray_PyIntAsInt (object)
+ npy_intp PyArray_PyIntAsIntp (object)
+ int PyArray_Broadcast (broadcast)
+ void PyArray_FillObjectArray (ndarray, object)
+ int PyArray_FillWithScalar (ndarray, object)
+ npy_bool PyArray_CheckStrides (int, int, npy_intp, npy_intp, npy_intp *, npy_intp *)
+ dtype PyArray_DescrNewByteorder (dtype, char)
+ object PyArray_IterAllButAxis (object, int *)
+ #object PyArray_CheckFromAny (object, dtype, int, int, int, object)
+ #object PyArray_FromArray (ndarray, dtype, int)
+ object PyArray_FromInterface (object)
+ object PyArray_FromStructInterface (object)
+ #object PyArray_FromArrayAttr (object, dtype, object)
+ #NPY_SCALARKIND PyArray_ScalarKind (int, ndarray*)
+ int PyArray_CanCoerceScalar (int, int, NPY_SCALARKIND)
+ object PyArray_NewFlagsObject (object)
+ npy_bool PyArray_CanCastScalar (type, type)
+ #int PyArray_CompareUCS4 (npy_ucs4 *, npy_ucs4 *, register size_t)
+ int PyArray_RemoveSmallest (broadcast)
+ int PyArray_ElementStrides (object)
+ void PyArray_Item_INCREF (char *, dtype)
+ void PyArray_Item_XDECREF (char *, dtype)
+ object PyArray_FieldNames (object)
+ object PyArray_Transpose (ndarray, PyArray_Dims *)
+ object PyArray_TakeFrom (ndarray, object, int, ndarray, NPY_CLIPMODE)
+ object PyArray_PutTo (ndarray, object, object, NPY_CLIPMODE)
+ object PyArray_PutMask (ndarray, object, object)
+ object PyArray_Repeat (ndarray, object, int)
+ object PyArray_Choose (ndarray, object, ndarray, NPY_CLIPMODE)
+ int PyArray_Sort (ndarray, int, NPY_SORTKIND)
+ object PyArray_ArgSort (ndarray, int, NPY_SORTKIND)
+ object PyArray_SearchSorted (ndarray, object, NPY_SEARCHSIDE, PyObject *)
+ object PyArray_ArgMax (ndarray, int, ndarray)
+ object PyArray_ArgMin (ndarray, int, ndarray)
+ object PyArray_Reshape (ndarray, object)
+ object PyArray_Newshape (ndarray, PyArray_Dims *, NPY_ORDER)
+ object PyArray_Squeeze (ndarray)
+ #object PyArray_View (ndarray, dtype, type)
+ object PyArray_SwapAxes (ndarray, int, int)
+ object PyArray_Max (ndarray, int, ndarray)
+ object PyArray_Min (ndarray, int, ndarray)
+ object PyArray_Ptp (ndarray, int, ndarray)
+ object PyArray_Mean (ndarray, int, int, ndarray)
+ object PyArray_Trace (ndarray, int, int, int, int, ndarray)
+ object PyArray_Diagonal (ndarray, int, int, int)
+ object PyArray_Clip (ndarray, object, object, ndarray)
+ object PyArray_Conjugate (ndarray, ndarray)
+ object PyArray_Nonzero (ndarray)
+ object PyArray_Std (ndarray, int, int, ndarray, int)
+ object PyArray_Sum (ndarray, int, int, ndarray)
+ object PyArray_CumSum (ndarray, int, int, ndarray)
+ object PyArray_Prod (ndarray, int, int, ndarray)
+ object PyArray_CumProd (ndarray, int, int, ndarray)
+ object PyArray_All (ndarray, int, ndarray)
+ object PyArray_Any (ndarray, int, ndarray)
+ object PyArray_Compress (ndarray, object, int, ndarray)
+ object PyArray_Flatten (ndarray, NPY_ORDER)
+ object PyArray_Ravel (ndarray, NPY_ORDER)
+ npy_intp PyArray_MultiplyList (npy_intp *, int)
+ int PyArray_MultiplyIntList (int *, int)
+ void * PyArray_GetPtr (ndarray, npy_intp*)
+ int PyArray_CompareLists (npy_intp *, npy_intp *, int)
+ #int PyArray_AsCArray (object*, void *, npy_intp *, int, dtype)
+ #int PyArray_As1D (object*, char **, int *, int)
+ #int PyArray_As2D (object*, char ***, int *, int *, int)
+ int PyArray_Free (object, void *)
+ #int PyArray_Converter (object, object*)
+ int PyArray_IntpFromSequence (object, npy_intp *, int)
+ object PyArray_Concatenate (object, int)
+ object PyArray_InnerProduct (object, object)
+ object PyArray_MatrixProduct (object, object)
+ object PyArray_CopyAndTranspose (object)
+ object PyArray_Correlate (object, object, int)
+ int PyArray_TypestrConvert (int, int)
+ #int PyArray_DescrConverter (object, dtype*)
+ #int PyArray_DescrConverter2 (object, dtype*)
+ int PyArray_IntpConverter (object, PyArray_Dims *)
+ #int PyArray_BufferConverter (object, chunk)
+ int PyArray_AxisConverter (object, int *)
+ int PyArray_BoolConverter (object, npy_bool *)
+ int PyArray_ByteorderConverter (object, char *)
+ int PyArray_OrderConverter (object, NPY_ORDER *)
+ unsigned char PyArray_EquivTypes (dtype, dtype)
+ #object PyArray_Zeros (int, npy_intp *, dtype, int)
+ #object PyArray_Empty (int, npy_intp *, dtype, int)
+ object PyArray_Where (object, object, object)
+ object PyArray_Arange (double, double, double, int)
+ #object PyArray_ArangeObj (object, object, object, dtype)
+ int PyArray_SortkindConverter (object, NPY_SORTKIND *)
+ object PyArray_LexSort (object, int)
+ object PyArray_Round (ndarray, int, ndarray)
+ unsigned char PyArray_EquivTypenums (int, int)
+ int PyArray_RegisterDataType (dtype)
+ int PyArray_RegisterCastFunc (dtype, int, PyArray_VectorUnaryFunc *)
+ int PyArray_RegisterCanCast (dtype, int, NPY_SCALARKIND)
+ #void PyArray_InitArrFuncs (PyArray_ArrFuncs *)
+ object PyArray_IntTupleFromIntp (int, npy_intp *)
+ int PyArray_TypeNumFromName (char *)
+ int PyArray_ClipmodeConverter (object, NPY_CLIPMODE *)
+ #int PyArray_OutputConverter (object, ndarray*)
+ object PyArray_BroadcastToShape (object, npy_intp *, int)
+ void _PyArray_SigintHandler (int)
+ void* _PyArray_GetSigintBuf ()
+ #int PyArray_DescrAlignConverter (object, dtype*)
+ #int PyArray_DescrAlignConverter2 (object, dtype*)
+ int PyArray_SearchsideConverter (object, void *)
+ object PyArray_CheckAxis (ndarray, int *, int)
+ npy_intp PyArray_OverflowMultiplyList (npy_intp *, int)
+ int PyArray_CompareString (char *, char *, size_t)
+ int PyArray_SetBaseObject(ndarray, base) # NOTE: steals a reference to base! Use "set_array_base()" instead.
+
+
+# Typedefs that matches the runtime dtype objects in
+# the numpy module.
+
+# The ones that are commented out needs an IFDEF function
+# in Cython to enable them only on the right systems.
+
+ctypedef npy_int8 int8_t
+ctypedef npy_int16 int16_t
+ctypedef npy_int32 int32_t
+ctypedef npy_int64 int64_t
+#ctypedef npy_int96 int96_t
+#ctypedef npy_int128 int128_t
+
+ctypedef npy_uint8 uint8_t
+ctypedef npy_uint16 uint16_t
+ctypedef npy_uint32 uint32_t
+ctypedef npy_uint64 uint64_t
+#ctypedef npy_uint96 uint96_t
+#ctypedef npy_uint128 uint128_t
+
+ctypedef npy_float32 float32_t
+ctypedef npy_float64 float64_t
+#ctypedef npy_float80 float80_t
+#ctypedef npy_float128 float128_t
+
+ctypedef float complex complex64_t
+ctypedef double complex complex128_t
+
+# The int types are mapped a bit surprising --
+# numpy.int corresponds to 'l' and numpy.long to 'q'
+ctypedef npy_long int_t
+ctypedef npy_longlong long_t
+ctypedef npy_longlong longlong_t
+
+ctypedef npy_ulong uint_t
+ctypedef npy_ulonglong ulong_t
+ctypedef npy_ulonglong ulonglong_t
+
+ctypedef npy_intp intp_t
+ctypedef npy_uintp uintp_t
+
+ctypedef npy_double float_t
+ctypedef npy_double double_t
+ctypedef npy_longdouble longdouble_t
+
+ctypedef npy_cfloat cfloat_t
+ctypedef npy_cdouble cdouble_t
+ctypedef npy_clongdouble clongdouble_t
+
+ctypedef npy_cdouble complex_t
+
+cdef inline object PyArray_MultiIterNew1(a):
+ return PyArray_MultiIterNew(1, a)
+
+cdef inline object PyArray_MultiIterNew2(a, b):
+ return PyArray_MultiIterNew(2, a, b)
+
+cdef inline object PyArray_MultiIterNew3(a, b, c):
+ return PyArray_MultiIterNew(3, a, b, c)
+
+cdef inline object PyArray_MultiIterNew4(a, b, c, d):
+ return PyArray_MultiIterNew(4, a, b, c, d)
+
+cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
+ return PyArray_MultiIterNew(5, a, b, c, d, e)
+
+cdef inline tuple PyDataType_SHAPE(dtype d):
+ if PyDataType_HASSUBARRAY(d):
+ return d.subarray.shape
+ else:
+ return ()
+
+
+cdef extern from "numpy/ndarrayobject.h":
+ PyTypeObject PyTimedeltaArrType_Type
+ PyTypeObject PyDatetimeArrType_Type
+ ctypedef int64_t npy_timedelta
+ ctypedef int64_t npy_datetime
+
+cdef extern from "numpy/ndarraytypes.h":
+ ctypedef struct PyArray_DatetimeMetaData:
+ NPY_DATETIMEUNIT base
+ int64_t num
+
+cdef extern from "numpy/arrayscalars.h":
+
+ # abstract types
+ ctypedef class numpy.generic [object PyObject]:
+ pass
+ ctypedef class numpy.number [object PyObject]:
+ pass
+ ctypedef class numpy.integer [object PyObject]:
+ pass
+ ctypedef class numpy.signedinteger [object PyObject]:
+ pass
+ ctypedef class numpy.unsignedinteger [object PyObject]:
+ pass
+ ctypedef class numpy.inexact [object PyObject]:
+ pass
+ ctypedef class numpy.floating [object PyObject]:
+ pass
+ ctypedef class numpy.complexfloating [object PyObject]:
+ pass
+ ctypedef class numpy.flexible [object PyObject]:
+ pass
+ ctypedef class numpy.character [object PyObject]:
+ pass
+
+ ctypedef struct PyDatetimeScalarObject:
+ # PyObject_HEAD
+ npy_datetime obval
+ PyArray_DatetimeMetaData obmeta
+
+ ctypedef struct PyTimedeltaScalarObject:
+ # PyObject_HEAD
+ npy_timedelta obval
+ PyArray_DatetimeMetaData obmeta
+
+ ctypedef enum NPY_DATETIMEUNIT:
+ NPY_FR_Y
+ NPY_FR_M
+ NPY_FR_W
+ NPY_FR_D
+ NPY_FR_B
+ NPY_FR_h
+ NPY_FR_m
+ NPY_FR_s
+ NPY_FR_ms
+ NPY_FR_us
+ NPY_FR_ns
+ NPY_FR_ps
+ NPY_FR_fs
+ NPY_FR_as
+
+
+#
+# ufunc API
+#
+
+cdef extern from "numpy/ufuncobject.h":
+
+ ctypedef void (*PyUFuncGenericFunction) (char **, npy_intp *, npy_intp *, void *)
+
+ ctypedef class numpy.ufunc [object PyUFuncObject, check_size ignore]:
+ cdef:
+ int nin, nout, nargs
+ int identity
+ PyUFuncGenericFunction *functions
+ void **data
+ int ntypes
+ int check_return
+ char *name
+ char *types
+ char *doc
+ void *ptr
+ PyObject *obj
+ PyObject *userloops
+
+ cdef enum:
+ PyUFunc_Zero
+ PyUFunc_One
+ PyUFunc_None
+ UFUNC_ERR_IGNORE
+ UFUNC_ERR_WARN
+ UFUNC_ERR_RAISE
+ UFUNC_ERR_CALL
+ UFUNC_ERR_PRINT
+ UFUNC_ERR_LOG
+ UFUNC_MASK_DIVIDEBYZERO
+ UFUNC_MASK_OVERFLOW
+ UFUNC_MASK_UNDERFLOW
+ UFUNC_MASK_INVALID
+ UFUNC_SHIFT_DIVIDEBYZERO
+ UFUNC_SHIFT_OVERFLOW
+ UFUNC_SHIFT_UNDERFLOW
+ UFUNC_SHIFT_INVALID
+ UFUNC_FPE_DIVIDEBYZERO
+ UFUNC_FPE_OVERFLOW
+ UFUNC_FPE_UNDERFLOW
+ UFUNC_FPE_INVALID
+ UFUNC_ERR_DEFAULT
+ UFUNC_ERR_DEFAULT2
+
+ object PyUFunc_FromFuncAndData(PyUFuncGenericFunction *,
+ void **, char *, int, int, int, int, char *, char *, int)
+ int PyUFunc_RegisterLoopForType(ufunc, int,
+ PyUFuncGenericFunction, int *, void *)
+ int PyUFunc_GenericFunction \
+ (ufunc, PyObject *, PyObject *, PyArrayObject **)
+ void PyUFunc_f_f_As_d_d \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_d_d \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_f_f \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_g_g \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_F_F_As_D_D \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_F_F \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_D_D \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_G_G \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_O_O \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_ff_f_As_dd_d \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_ff_f \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_dd_d \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_gg_g \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_FF_F_As_DD_D \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_DD_D \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_FF_F \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_GG_G \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_OO_O \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_O_O_method \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_OO_O_method \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_On_Om \
+ (char **, npy_intp *, npy_intp *, void *)
+ int PyUFunc_GetPyValues \
+ (char *, int *, int *, PyObject **)
+ int PyUFunc_checkfperr \
+ (int, PyObject *, int *)
+ void PyUFunc_clearfperr()
+ int PyUFunc_getfperr()
+ int PyUFunc_handlefperr \
+ (int, PyObject *, int, int *)
+ int PyUFunc_ReplaceLoopBySignature \
+ (ufunc, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *)
+ object PyUFunc_FromFuncAndDataAndSignature \
+ (PyUFuncGenericFunction *, void **, char *, int, int, int,
+ int, char *, char *, int, char *)
+
+ int _import_umath() except -1
+
+cdef inline void set_array_base(ndarray arr, object base):
+ Py_INCREF(base) # important to do this before stealing the reference below!
+ PyArray_SetBaseObject(arr, base)
+
+cdef inline object get_array_base(ndarray arr):
+ base = PyArray_BASE(arr)
+ if base is NULL:
+ return None
+ return base
+
+# Versions of the import_* functions which are more suitable for
+# Cython code.
+cdef inline int import_array() except -1:
+ try:
+ __pyx_import_array()
+ except Exception:
+ raise ImportError("numpy.core.multiarray failed to import")
+
+cdef inline int import_umath() except -1:
+ try:
+ _import_umath()
+ except Exception:
+ raise ImportError("numpy.core.umath failed to import")
+
+cdef inline int import_ufunc() except -1:
+ try:
+ _import_umath()
+ except Exception:
+ raise ImportError("numpy.core.umath failed to import")
+
+
+cdef inline bint is_timedelta64_object(object obj):
+ """
+ Cython equivalent of `isinstance(obj, np.timedelta64)`
+
+ Parameters
+ ----------
+ obj : object
+
+ Returns
+ -------
+ bool
+ """
+ return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)
+
+
+cdef inline bint is_datetime64_object(object obj):
+ """
+ Cython equivalent of `isinstance(obj, np.datetime64)`
+
+ Parameters
+ ----------
+ obj : object
+
+ Returns
+ -------
+ bool
+ """
+ return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)
+
+
+cdef inline npy_datetime get_datetime64_value(object obj) nogil:
+ """
+ returns the int64 value underlying scalar numpy datetime64 object
+
+ Note that to interpret this as a datetime, the corresponding unit is
+ also needed. That can be found using `get_datetime64_unit`.
+ """
+ return (obj).obval
+
+
+cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:
+ """
+ returns the int64 value underlying scalar numpy timedelta64 object
+ """
+ return (obj).obval
+
+
+cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:
+ """
+ returns the unit part of the dtype for a numpy datetime64 object.
+ """
+ return (obj).obmeta.base
diff --git a/venv/Lib/site-packages/numpy/__init__.pxd b/venv/Lib/site-packages/numpy/__init__.pxd
new file mode 100644
index 0000000..fd704b7
--- /dev/null
+++ b/venv/Lib/site-packages/numpy/__init__.pxd
@@ -0,0 +1,1020 @@
+# NumPy static imports for Cython < 3.0
+#
+# If any of the PyArray_* functions are called, import_array must be
+# called first.
+#
+# Author: Dag Sverre Seljebotn
+#
+
+DEF _buffer_format_string_len = 255
+
+cimport cpython.buffer as pybuf
+from cpython.ref cimport Py_INCREF
+from cpython.mem cimport PyObject_Malloc, PyObject_Free
+from cpython.object cimport PyObject, PyTypeObject
+from cpython.buffer cimport PyObject_GetBuffer
+from cpython.type cimport type
+cimport libc.stdio as stdio
+
+cdef extern from "Python.h":
+ ctypedef int Py_intptr_t
+ bint PyObject_TypeCheck(object obj, PyTypeObject* type)
+
+cdef extern from "numpy/arrayobject.h":
+ ctypedef Py_intptr_t npy_intp
+ ctypedef size_t npy_uintp
+
+ cdef enum NPY_TYPES:
+ NPY_BOOL
+ NPY_BYTE
+ NPY_UBYTE
+ NPY_SHORT
+ NPY_USHORT
+ NPY_INT
+ NPY_UINT
+ NPY_LONG
+ NPY_ULONG
+ NPY_LONGLONG
+ NPY_ULONGLONG
+ NPY_FLOAT
+ NPY_DOUBLE
+ NPY_LONGDOUBLE
+ NPY_CFLOAT
+ NPY_CDOUBLE
+ NPY_CLONGDOUBLE
+ NPY_OBJECT
+ NPY_STRING
+ NPY_UNICODE
+ NPY_VOID
+ NPY_DATETIME
+ NPY_TIMEDELTA
+ NPY_NTYPES
+ NPY_NOTYPE
+
+ NPY_INT8
+ NPY_INT16
+ NPY_INT32
+ NPY_INT64
+ NPY_INT128
+ NPY_INT256
+ NPY_UINT8
+ NPY_UINT16
+ NPY_UINT32
+ NPY_UINT64
+ NPY_UINT128
+ NPY_UINT256
+ NPY_FLOAT16
+ NPY_FLOAT32
+ NPY_FLOAT64
+ NPY_FLOAT80
+ NPY_FLOAT96
+ NPY_FLOAT128
+ NPY_FLOAT256
+ NPY_COMPLEX32
+ NPY_COMPLEX64
+ NPY_COMPLEX128
+ NPY_COMPLEX160
+ NPY_COMPLEX192
+ NPY_COMPLEX256
+ NPY_COMPLEX512
+
+ NPY_INTP
+
+ ctypedef enum NPY_ORDER:
+ NPY_ANYORDER
+ NPY_CORDER
+ NPY_FORTRANORDER
+ NPY_KEEPORDER
+
+ ctypedef enum NPY_CASTING:
+ NPY_NO_CASTING
+ NPY_EQUIV_CASTING
+ NPY_SAFE_CASTING
+ NPY_SAME_KIND_CASTING
+ NPY_UNSAFE_CASTING
+
+ ctypedef enum NPY_CLIPMODE:
+ NPY_CLIP
+ NPY_WRAP
+ NPY_RAISE
+
+ ctypedef enum NPY_SCALARKIND:
+ NPY_NOSCALAR,
+ NPY_BOOL_SCALAR,
+ NPY_INTPOS_SCALAR,
+ NPY_INTNEG_SCALAR,
+ NPY_FLOAT_SCALAR,
+ NPY_COMPLEX_SCALAR,
+ NPY_OBJECT_SCALAR
+
+ ctypedef enum NPY_SORTKIND:
+ NPY_QUICKSORT
+ NPY_HEAPSORT
+ NPY_MERGESORT
+
+ ctypedef enum NPY_SEARCHSIDE:
+ NPY_SEARCHLEFT
+ NPY_SEARCHRIGHT
+
+ enum:
+ # DEPRECATED since NumPy 1.7 ! Do not use in new code!
+ NPY_C_CONTIGUOUS
+ NPY_F_CONTIGUOUS
+ NPY_CONTIGUOUS
+ NPY_FORTRAN
+ NPY_OWNDATA
+ NPY_FORCECAST
+ NPY_ENSURECOPY
+ NPY_ENSUREARRAY
+ NPY_ELEMENTSTRIDES
+ NPY_ALIGNED
+ NPY_NOTSWAPPED
+ NPY_WRITEABLE
+ NPY_UPDATEIFCOPY
+ NPY_ARR_HAS_DESCR
+
+ NPY_BEHAVED
+ NPY_BEHAVED_NS
+ NPY_CARRAY
+ NPY_CARRAY_RO
+ NPY_FARRAY
+ NPY_FARRAY_RO
+ NPY_DEFAULT
+
+ NPY_IN_ARRAY
+ NPY_OUT_ARRAY
+ NPY_INOUT_ARRAY
+ NPY_IN_FARRAY
+ NPY_OUT_FARRAY
+ NPY_INOUT_FARRAY
+
+ NPY_UPDATE_ALL
+
+ enum:
+ # Added in NumPy 1.7 to replace the deprecated enums above.
+ NPY_ARRAY_C_CONTIGUOUS
+ NPY_ARRAY_F_CONTIGUOUS
+ NPY_ARRAY_OWNDATA
+ NPY_ARRAY_FORCECAST
+ NPY_ARRAY_ENSURECOPY
+ NPY_ARRAY_ENSUREARRAY
+ NPY_ARRAY_ELEMENTSTRIDES
+ NPY_ARRAY_ALIGNED
+ NPY_ARRAY_NOTSWAPPED
+ NPY_ARRAY_WRITEABLE
+ NPY_ARRAY_UPDATEIFCOPY
+
+ NPY_ARRAY_BEHAVED
+ NPY_ARRAY_BEHAVED_NS
+ NPY_ARRAY_CARRAY
+ NPY_ARRAY_CARRAY_RO
+ NPY_ARRAY_FARRAY
+ NPY_ARRAY_FARRAY_RO
+ NPY_ARRAY_DEFAULT
+
+ NPY_ARRAY_IN_ARRAY
+ NPY_ARRAY_OUT_ARRAY
+ NPY_ARRAY_INOUT_ARRAY
+ NPY_ARRAY_IN_FARRAY
+ NPY_ARRAY_OUT_FARRAY
+ NPY_ARRAY_INOUT_FARRAY
+
+ NPY_ARRAY_UPDATE_ALL
+
+ cdef enum:
+ NPY_MAXDIMS
+
+ npy_intp NPY_MAX_ELSIZE
+
+ ctypedef void (*PyArray_VectorUnaryFunc)(void *, void *, npy_intp, void *, void *)
+
+ ctypedef struct PyArray_ArrayDescr:
+ # shape is a tuple, but Cython doesn't support "tuple shape"
+ # inside a non-PyObject declaration, so we have to declare it
+ # as just a PyObject*.
+ PyObject* shape
+
+ ctypedef struct PyArray_Descr:
+ pass
+
+ ctypedef class numpy.dtype [object PyArray_Descr, check_size ignore]:
+ # Use PyDataType_* macros when possible, however there are no macros
+ # for accessing some of the fields, so some are defined.
+ cdef PyTypeObject* typeobj
+ cdef char kind
+ cdef char type
+ # Numpy sometimes mutates this without warning (e.g. it'll
+ # sometimes change "|" to "<" in shared dtype objects on
+ # little-endian machines). If this matters to you, use
+ # PyArray_IsNativeByteOrder(dtype.byteorder) instead of
+ # directly accessing this field.
+ cdef char byteorder
+ cdef char flags
+ cdef int type_num
+ cdef int itemsize "elsize"
+ cdef int alignment
+ cdef object fields
+ cdef tuple names
+ # Use PyDataType_HASSUBARRAY to test whether this field is
+ # valid (the pointer can be NULL). Most users should access
+ # this field via the inline helper method PyDataType_SHAPE.
+ cdef PyArray_ArrayDescr* subarray
+
+ ctypedef class numpy.flatiter [object PyArrayIterObject, check_size ignore]:
+ # Use through macros
+ pass
+
+ ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]:
+ cdef int numiter
+ cdef npy_intp size, index
+ cdef int nd
+ cdef npy_intp *dimensions
+ cdef void **iters
+
+ ctypedef struct PyArrayObject:
+ # For use in situations where ndarray can't replace PyArrayObject*,
+ # like PyArrayObject**.
+ pass
+
+ ctypedef class numpy.ndarray [object PyArrayObject, check_size ignore]:
+ cdef __cythonbufferdefaults__ = {"mode": "strided"}
+
+ cdef:
+ # Only taking a few of the most commonly used and stable fields.
+ # One should use PyArray_* macros instead to access the C fields.
+ char *data
+ int ndim "nd"
+ npy_intp *shape "dimensions"
+ npy_intp *strides
+ dtype descr # deprecated since NumPy 1.7 !
+ PyObject* base # NOT PUBLIC, DO NOT USE !
+
+
+
+ ctypedef unsigned char npy_bool
+
+ ctypedef signed char npy_byte
+ ctypedef signed short npy_short
+ ctypedef signed int npy_int
+ ctypedef signed long npy_long
+ ctypedef signed long long npy_longlong
+
+ ctypedef unsigned char npy_ubyte
+ ctypedef unsigned short npy_ushort
+ ctypedef unsigned int npy_uint
+ ctypedef unsigned long npy_ulong
+ ctypedef unsigned long long npy_ulonglong
+
+ ctypedef float npy_float
+ ctypedef double npy_double
+ ctypedef long double npy_longdouble
+
+ ctypedef signed char npy_int8
+ ctypedef signed short npy_int16
+ ctypedef signed int npy_int32
+ ctypedef signed long long npy_int64
+ ctypedef signed long long npy_int96
+ ctypedef signed long long npy_int128
+
+ ctypedef unsigned char npy_uint8
+ ctypedef unsigned short npy_uint16
+ ctypedef unsigned int npy_uint32
+ ctypedef unsigned long long npy_uint64
+ ctypedef unsigned long long npy_uint96
+ ctypedef unsigned long long npy_uint128
+
+ ctypedef float npy_float32
+ ctypedef double npy_float64
+ ctypedef long double npy_float80
+ ctypedef long double npy_float96
+ ctypedef long double npy_float128
+
+ ctypedef struct npy_cfloat:
+ float real
+ float imag
+
+ ctypedef struct npy_cdouble:
+ double real
+ double imag
+
+ ctypedef struct npy_clongdouble:
+ long double real
+ long double imag
+
+ ctypedef struct npy_complex64:
+ float real
+ float imag
+
+ ctypedef struct npy_complex128:
+ double real
+ double imag
+
+ ctypedef struct npy_complex160:
+ long double real
+ long double imag
+
+ ctypedef struct npy_complex192:
+ long double real
+ long double imag
+
+ ctypedef struct npy_complex256:
+ long double real
+ long double imag
+
+ ctypedef struct PyArray_Dims:
+ npy_intp *ptr
+ int len
+
+ int _import_array() except -1
+ # A second definition so _import_array isn't marked as used when we use it here.
+ # Do not use - subject to change any time.
+ int __pyx_import_array "_import_array"() except -1
+
+ #
+ # Macros from ndarrayobject.h
+ #
+ bint PyArray_CHKFLAGS(ndarray m, int flags) nogil
+ bint PyArray_IS_C_CONTIGUOUS(ndarray arr) nogil
+ bint PyArray_IS_F_CONTIGUOUS(ndarray arr) nogil
+ bint PyArray_ISCONTIGUOUS(ndarray m) nogil
+ bint PyArray_ISWRITEABLE(ndarray m) nogil
+ bint PyArray_ISALIGNED(ndarray m) nogil
+
+ int PyArray_NDIM(ndarray) nogil
+ bint PyArray_ISONESEGMENT(ndarray) nogil
+ bint PyArray_ISFORTRAN(ndarray) nogil
+ int PyArray_FORTRANIF(ndarray) nogil
+
+ void* PyArray_DATA(ndarray) nogil
+ char* PyArray_BYTES(ndarray) nogil
+
+ npy_intp* PyArray_DIMS(ndarray) nogil
+ npy_intp* PyArray_STRIDES(ndarray) nogil
+ npy_intp PyArray_DIM(ndarray, size_t) nogil
+ npy_intp PyArray_STRIDE(ndarray, size_t) nogil
+
+ PyObject *PyArray_BASE(ndarray) nogil # returns borrowed reference!
+ PyArray_Descr *PyArray_DESCR(ndarray) nogil # returns borrowed reference to dtype!
+ int PyArray_FLAGS(ndarray) nogil
+ npy_intp PyArray_ITEMSIZE(ndarray) nogil
+ int PyArray_TYPE(ndarray arr) nogil
+
+ object PyArray_GETITEM(ndarray arr, void *itemptr)
+ int PyArray_SETITEM(ndarray arr, void *itemptr, object obj)
+
+ bint PyTypeNum_ISBOOL(int) nogil
+ bint PyTypeNum_ISUNSIGNED(int) nogil
+ bint PyTypeNum_ISSIGNED(int) nogil
+ bint PyTypeNum_ISINTEGER(int) nogil
+ bint PyTypeNum_ISFLOAT(int) nogil
+ bint PyTypeNum_ISNUMBER(int) nogil
+ bint PyTypeNum_ISSTRING(int) nogil
+ bint PyTypeNum_ISCOMPLEX(int) nogil
+ bint PyTypeNum_ISPYTHON(int) nogil
+ bint PyTypeNum_ISFLEXIBLE(int) nogil
+ bint PyTypeNum_ISUSERDEF(int) nogil
+ bint PyTypeNum_ISEXTENDED(int) nogil
+ bint PyTypeNum_ISOBJECT(int) nogil
+
+ bint PyDataType_ISBOOL(dtype) nogil
+ bint PyDataType_ISUNSIGNED(dtype) nogil
+ bint PyDataType_ISSIGNED(dtype) nogil
+ bint PyDataType_ISINTEGER(dtype) nogil
+ bint PyDataType_ISFLOAT(dtype) nogil
+ bint PyDataType_ISNUMBER(dtype) nogil
+ bint PyDataType_ISSTRING(dtype) nogil
+ bint PyDataType_ISCOMPLEX(dtype) nogil
+ bint PyDataType_ISPYTHON(dtype) nogil
+ bint PyDataType_ISFLEXIBLE(dtype) nogil
+ bint PyDataType_ISUSERDEF(dtype) nogil
+ bint PyDataType_ISEXTENDED(dtype) nogil
+ bint PyDataType_ISOBJECT(dtype) nogil
+ bint PyDataType_HASFIELDS(dtype) nogil
+ bint PyDataType_HASSUBARRAY(dtype) nogil
+
+ bint PyArray_ISBOOL(ndarray) nogil
+ bint PyArray_ISUNSIGNED(ndarray) nogil
+ bint PyArray_ISSIGNED(ndarray) nogil
+ bint PyArray_ISINTEGER(ndarray) nogil
+ bint PyArray_ISFLOAT(ndarray) nogil
+ bint PyArray_ISNUMBER(ndarray) nogil
+ bint PyArray_ISSTRING(ndarray) nogil
+ bint PyArray_ISCOMPLEX(ndarray) nogil
+ bint PyArray_ISPYTHON(ndarray) nogil
+ bint PyArray_ISFLEXIBLE(ndarray) nogil
+ bint PyArray_ISUSERDEF(ndarray) nogil
+ bint PyArray_ISEXTENDED(ndarray) nogil
+ bint PyArray_ISOBJECT(ndarray) nogil
+ bint PyArray_HASFIELDS(ndarray) nogil
+
+ bint PyArray_ISVARIABLE(ndarray) nogil
+
+ bint PyArray_SAFEALIGNEDCOPY(ndarray) nogil
+ bint PyArray_ISNBO(char) nogil # works on ndarray.byteorder
+ bint PyArray_IsNativeByteOrder(char) nogil # works on ndarray.byteorder
+ bint PyArray_ISNOTSWAPPED(ndarray) nogil
+ bint PyArray_ISBYTESWAPPED(ndarray) nogil
+
+ bint PyArray_FLAGSWAP(ndarray, int) nogil
+
+ bint PyArray_ISCARRAY(ndarray) nogil
+ bint PyArray_ISCARRAY_RO(ndarray) nogil
+ bint PyArray_ISFARRAY(ndarray) nogil
+ bint PyArray_ISFARRAY_RO(ndarray) nogil
+ bint PyArray_ISBEHAVED(ndarray) nogil
+ bint PyArray_ISBEHAVED_RO(ndarray) nogil
+
+
+ bint PyDataType_ISNOTSWAPPED(dtype) nogil
+ bint PyDataType_ISBYTESWAPPED(dtype) nogil
+
+ bint PyArray_DescrCheck(object)
+
+ bint PyArray_Check(object)
+ bint PyArray_CheckExact(object)
+
+ # Cannot be supported due to out arg:
+ # bint PyArray_HasArrayInterfaceType(object, dtype, object, object&)
+ # bint PyArray_HasArrayInterface(op, out)
+
+
+ bint PyArray_IsZeroDim(object)
+ # Cannot be supported due to ## ## in macro:
+ # bint PyArray_IsScalar(object, verbatim work)
+ bint PyArray_CheckScalar(object)
+ bint PyArray_IsPythonNumber(object)
+ bint PyArray_IsPythonScalar(object)
+ bint PyArray_IsAnyScalar(object)
+ bint PyArray_CheckAnyScalar(object)
+
+ ndarray PyArray_GETCONTIGUOUS(ndarray)
+ bint PyArray_SAMESHAPE(ndarray, ndarray) nogil
+ npy_intp PyArray_SIZE(ndarray) nogil
+ npy_intp PyArray_NBYTES(ndarray) nogil
+
+ object PyArray_FROM_O(object)
+ object PyArray_FROM_OF(object m, int flags)
+ object PyArray_FROM_OT(object m, int type)
+ object PyArray_FROM_OTF(object m, int type, int flags)
+ object PyArray_FROMANY(object m, int type, int min, int max, int flags)
+ object PyArray_ZEROS(int nd, npy_intp* dims, int type, int fortran)
+ object PyArray_EMPTY(int nd, npy_intp* dims, int type, int fortran)
+ void PyArray_FILLWBYTE(object, int val)
+ npy_intp PyArray_REFCOUNT(object)
+ object PyArray_ContiguousFromAny(op, int, int min_depth, int max_depth)
+ unsigned char PyArray_EquivArrTypes(ndarray a1, ndarray a2)
+ bint PyArray_EquivByteorders(int b1, int b2) nogil
+ object PyArray_SimpleNew(int nd, npy_intp* dims, int typenum)
+ object PyArray_SimpleNewFromData(int nd, npy_intp* dims, int typenum, void* data)
+ #object PyArray_SimpleNewFromDescr(int nd, npy_intp* dims, dtype descr)
+ object PyArray_ToScalar(void* data, ndarray arr)
+
+ void* PyArray_GETPTR1(ndarray m, npy_intp i) nogil
+ void* PyArray_GETPTR2(ndarray m, npy_intp i, npy_intp j) nogil
+ void* PyArray_GETPTR3(ndarray m, npy_intp i, npy_intp j, npy_intp k) nogil
+ void* PyArray_GETPTR4(ndarray m, npy_intp i, npy_intp j, npy_intp k, npy_intp l) nogil
+
+ void PyArray_XDECREF_ERR(ndarray)
+ # Cannot be supported due to out arg
+ # void PyArray_DESCR_REPLACE(descr)
+
+
+ object PyArray_Copy(ndarray)
+ object PyArray_FromObject(object op, int type, int min_depth, int max_depth)
+ object PyArray_ContiguousFromObject(object op, int type, int min_depth, int max_depth)
+ object PyArray_CopyFromObject(object op, int type, int min_depth, int max_depth)
+
+ object PyArray_Cast(ndarray mp, int type_num)
+ object PyArray_Take(ndarray ap, object items, int axis)
+ object PyArray_Put(ndarray ap, object items, object values)
+
+ void PyArray_ITER_RESET(flatiter it) nogil
+ void PyArray_ITER_NEXT(flatiter it) nogil
+ void PyArray_ITER_GOTO(flatiter it, npy_intp* destination) nogil
+ void PyArray_ITER_GOTO1D(flatiter it, npy_intp ind) nogil
+ void* PyArray_ITER_DATA(flatiter it) nogil
+ bint PyArray_ITER_NOTDONE(flatiter it) nogil
+
+ void PyArray_MultiIter_RESET(broadcast multi) nogil
+ void PyArray_MultiIter_NEXT(broadcast multi) nogil
+ void PyArray_MultiIter_GOTO(broadcast multi, npy_intp dest) nogil
+ void PyArray_MultiIter_GOTO1D(broadcast multi, npy_intp ind) nogil
+ void* PyArray_MultiIter_DATA(broadcast multi, npy_intp i) nogil
+ void PyArray_MultiIter_NEXTi(broadcast multi, npy_intp i) nogil
+ bint PyArray_MultiIter_NOTDONE(broadcast multi) nogil
+
+ # Functions from __multiarray_api.h
+
+ # Functions taking dtype and returning object/ndarray are disabled
+ # for now as they steal dtype references. I'm conservative and disable
+ # more than is probably needed until it can be checked further.
+ int PyArray_SetNumericOps (object)
+ object PyArray_GetNumericOps ()
+ int PyArray_INCREF (ndarray)
+ int PyArray_XDECREF (ndarray)
+ void PyArray_SetStringFunction (object, int)
+ dtype PyArray_DescrFromType (int)
+ object PyArray_TypeObjectFromType (int)
+ char * PyArray_Zero (ndarray)
+ char * PyArray_One (ndarray)
+ #object PyArray_CastToType (ndarray, dtype, int)
+ int PyArray_CastTo (ndarray, ndarray)
+ int PyArray_CastAnyTo (ndarray, ndarray)
+ int PyArray_CanCastSafely (int, int)
+ npy_bool PyArray_CanCastTo (dtype, dtype)
+ int PyArray_ObjectType (object, int)
+ dtype PyArray_DescrFromObject (object, dtype)
+ #ndarray* PyArray_ConvertToCommonType (object, int *)
+ dtype PyArray_DescrFromScalar (object)
+ dtype PyArray_DescrFromTypeObject (object)
+ npy_intp PyArray_Size (object)
+ #object PyArray_Scalar (void *, dtype, object)
+ #object PyArray_FromScalar (object, dtype)
+ void PyArray_ScalarAsCtype (object, void *)
+ #int PyArray_CastScalarToCtype (object, void *, dtype)
+ #int PyArray_CastScalarDirect (object, dtype, void *, int)
+ object PyArray_ScalarFromObject (object)
+ #PyArray_VectorUnaryFunc * PyArray_GetCastFunc (dtype, int)
+ object PyArray_FromDims (int, int *, int)
+ #object PyArray_FromDimsAndDataAndDescr (int, int *, dtype, char *)
+ #object PyArray_FromAny (object, dtype, int, int, int, object)
+ object PyArray_EnsureArray (object)
+ object PyArray_EnsureAnyArray (object)
+ #object PyArray_FromFile (stdio.FILE *, dtype, npy_intp, char *)
+ #object PyArray_FromString (char *, npy_intp, dtype, npy_intp, char *)
+ #object PyArray_FromBuffer (object, dtype, npy_intp, npy_intp)
+ #object PyArray_FromIter (object, dtype, npy_intp)
+ object PyArray_Return (ndarray)
+ #object PyArray_GetField (ndarray, dtype, int)
+ #int PyArray_SetField (ndarray, dtype, int, object)
+ object PyArray_Byteswap (ndarray, npy_bool)
+ object PyArray_Resize (ndarray, PyArray_Dims *, int, NPY_ORDER)
+ int PyArray_MoveInto (ndarray, ndarray)
+ int PyArray_CopyInto (ndarray, ndarray)
+ int PyArray_CopyAnyInto (ndarray, ndarray)
+ int PyArray_CopyObject (ndarray, object)
+ object PyArray_NewCopy (ndarray, NPY_ORDER)
+ object PyArray_ToList (ndarray)
+ object PyArray_ToString (ndarray, NPY_ORDER)
+ int PyArray_ToFile (ndarray, stdio.FILE *, char *, char *)
+ int PyArray_Dump (object, object, int)
+ object PyArray_Dumps (object, int)
+ int PyArray_ValidType (int)
+ void PyArray_UpdateFlags (ndarray, int)
+ object PyArray_New (type, int, npy_intp *, int, npy_intp *, void *, int, int, object)
+ #object PyArray_NewFromDescr (type, dtype, int, npy_intp *, npy_intp *, void *, int, object)
+ #dtype PyArray_DescrNew (dtype)
+ dtype PyArray_DescrNewFromType (int)
+ double PyArray_GetPriority (object, double)
+ object PyArray_IterNew (object)
+ object PyArray_MultiIterNew (int, ...)
+
+ int PyArray_PyIntAsInt (object)
+ npy_intp PyArray_PyIntAsIntp (object)
+ int PyArray_Broadcast (broadcast)
+ void PyArray_FillObjectArray (ndarray, object)
+ int PyArray_FillWithScalar (ndarray, object)
+ npy_bool PyArray_CheckStrides (int, int, npy_intp, npy_intp, npy_intp *, npy_intp *)
+ dtype PyArray_DescrNewByteorder (dtype, char)
+ object PyArray_IterAllButAxis (object, int *)
+ #object PyArray_CheckFromAny (object, dtype, int, int, int, object)
+ #object PyArray_FromArray (ndarray, dtype, int)
+ object PyArray_FromInterface (object)
+ object PyArray_FromStructInterface (object)
+ #object PyArray_FromArrayAttr (object, dtype, object)
+ #NPY_SCALARKIND PyArray_ScalarKind (int, ndarray*)
+ int PyArray_CanCoerceScalar (int, int, NPY_SCALARKIND)
+ object PyArray_NewFlagsObject (object)
+ npy_bool PyArray_CanCastScalar (type, type)
+ #int PyArray_CompareUCS4 (npy_ucs4 *, npy_ucs4 *, register size_t)
+ int PyArray_RemoveSmallest (broadcast)
+ int PyArray_ElementStrides (object)
+ void PyArray_Item_INCREF (char *, dtype)
+ void PyArray_Item_XDECREF (char *, dtype)
+ object PyArray_FieldNames (object)
+ object PyArray_Transpose (ndarray, PyArray_Dims *)
+ object PyArray_TakeFrom (ndarray, object, int, ndarray, NPY_CLIPMODE)
+ object PyArray_PutTo (ndarray, object, object, NPY_CLIPMODE)
+ object PyArray_PutMask (ndarray, object, object)
+ object PyArray_Repeat (ndarray, object, int)
+ object PyArray_Choose (ndarray, object, ndarray, NPY_CLIPMODE)
+ int PyArray_Sort (ndarray, int, NPY_SORTKIND)
+ object PyArray_ArgSort (ndarray, int, NPY_SORTKIND)
+ object PyArray_SearchSorted (ndarray, object, NPY_SEARCHSIDE, PyObject *)
+ object PyArray_ArgMax (ndarray, int, ndarray)
+ object PyArray_ArgMin (ndarray, int, ndarray)
+ object PyArray_Reshape (ndarray, object)
+ object PyArray_Newshape (ndarray, PyArray_Dims *, NPY_ORDER)
+ object PyArray_Squeeze (ndarray)
+ #object PyArray_View (ndarray, dtype, type)
+ object PyArray_SwapAxes (ndarray, int, int)
+ object PyArray_Max (ndarray, int, ndarray)
+ object PyArray_Min (ndarray, int, ndarray)
+ object PyArray_Ptp (ndarray, int, ndarray)
+ object PyArray_Mean (ndarray, int, int, ndarray)
+ object PyArray_Trace (ndarray, int, int, int, int, ndarray)
+ object PyArray_Diagonal (ndarray, int, int, int)
+ object PyArray_Clip (ndarray, object, object, ndarray)
+ object PyArray_Conjugate (ndarray, ndarray)
+ object PyArray_Nonzero (ndarray)
+ object PyArray_Std (ndarray, int, int, ndarray, int)
+ object PyArray_Sum (ndarray, int, int, ndarray)
+ object PyArray_CumSum (ndarray, int, int, ndarray)
+ object PyArray_Prod (ndarray, int, int, ndarray)
+ object PyArray_CumProd (ndarray, int, int, ndarray)
+ object PyArray_All (ndarray, int, ndarray)
+ object PyArray_Any (ndarray, int, ndarray)
+ object PyArray_Compress (ndarray, object, int, ndarray)
+ object PyArray_Flatten (ndarray, NPY_ORDER)
+ object PyArray_Ravel (ndarray, NPY_ORDER)
+ npy_intp PyArray_MultiplyList (npy_intp *, int)
+ int PyArray_MultiplyIntList (int *, int)
+ void * PyArray_GetPtr (ndarray, npy_intp*)
+ int PyArray_CompareLists (npy_intp *, npy_intp *, int)
+ #int PyArray_AsCArray (object*, void *, npy_intp *, int, dtype)
+ #int PyArray_As1D (object*, char **, int *, int)
+ #int PyArray_As2D (object*, char ***, int *, int *, int)
+ int PyArray_Free (object, void *)
+ #int PyArray_Converter (object, object*)
+ int PyArray_IntpFromSequence (object, npy_intp *, int)
+ object PyArray_Concatenate (object, int)
+ object PyArray_InnerProduct (object, object)
+ object PyArray_MatrixProduct (object, object)
+ object PyArray_CopyAndTranspose (object)
+ object PyArray_Correlate (object, object, int)
+ int PyArray_TypestrConvert (int, int)
+ #int PyArray_DescrConverter (object, dtype*)
+ #int PyArray_DescrConverter2 (object, dtype*)
+ int PyArray_IntpConverter (object, PyArray_Dims *)
+ #int PyArray_BufferConverter (object, chunk)
+ int PyArray_AxisConverter (object, int *)
+ int PyArray_BoolConverter (object, npy_bool *)
+ int PyArray_ByteorderConverter (object, char *)
+ int PyArray_OrderConverter (object, NPY_ORDER *)
+ unsigned char PyArray_EquivTypes (dtype, dtype)
+ #object PyArray_Zeros (int, npy_intp *, dtype, int)
+ #object PyArray_Empty (int, npy_intp *, dtype, int)
+ object PyArray_Where (object, object, object)
+ object PyArray_Arange (double, double, double, int)
+ #object PyArray_ArangeObj (object, object, object, dtype)
+ int PyArray_SortkindConverter (object, NPY_SORTKIND *)
+ object PyArray_LexSort (object, int)
+ object PyArray_Round (ndarray, int, ndarray)
+ unsigned char PyArray_EquivTypenums (int, int)
+ int PyArray_RegisterDataType (dtype)
+ int PyArray_RegisterCastFunc (dtype, int, PyArray_VectorUnaryFunc *)
+ int PyArray_RegisterCanCast (dtype, int, NPY_SCALARKIND)
+ #void PyArray_InitArrFuncs (PyArray_ArrFuncs *)
+ object PyArray_IntTupleFromIntp (int, npy_intp *)
+ int PyArray_TypeNumFromName (char *)
+ int PyArray_ClipmodeConverter (object, NPY_CLIPMODE *)
+ #int PyArray_OutputConverter (object, ndarray*)
+ object PyArray_BroadcastToShape (object, npy_intp *, int)
+ void _PyArray_SigintHandler (int)
+ void* _PyArray_GetSigintBuf ()
+ #int PyArray_DescrAlignConverter (object, dtype*)
+ #int PyArray_DescrAlignConverter2 (object, dtype*)
+ int PyArray_SearchsideConverter (object, void *)
+ object PyArray_CheckAxis (ndarray, int *, int)
+ npy_intp PyArray_OverflowMultiplyList (npy_intp *, int)
+ int PyArray_CompareString (char *, char *, size_t)
+ int PyArray_SetBaseObject(ndarray, base) # NOTE: steals a reference to base! Use "set_array_base()" instead.
+
+
+# Typedefs that matches the runtime dtype objects in
+# the numpy module.
+
+# The ones that are commented out needs an IFDEF function
+# in Cython to enable them only on the right systems.
+
+ctypedef npy_int8 int8_t
+ctypedef npy_int16 int16_t
+ctypedef npy_int32 int32_t
+ctypedef npy_int64 int64_t
+#ctypedef npy_int96 int96_t
+#ctypedef npy_int128 int128_t
+
+ctypedef npy_uint8 uint8_t
+ctypedef npy_uint16 uint16_t
+ctypedef npy_uint32 uint32_t
+ctypedef npy_uint64 uint64_t
+#ctypedef npy_uint96 uint96_t
+#ctypedef npy_uint128 uint128_t
+
+ctypedef npy_float32 float32_t
+ctypedef npy_float64 float64_t
+#ctypedef npy_float80 float80_t
+#ctypedef npy_float128 float128_t
+
+ctypedef float complex complex64_t
+ctypedef double complex complex128_t
+
+# The int types are mapped a bit surprising --
+# numpy.int corresponds to 'l' and numpy.long to 'q'
+ctypedef npy_long int_t
+ctypedef npy_longlong long_t
+ctypedef npy_longlong longlong_t
+
+ctypedef npy_ulong uint_t
+ctypedef npy_ulonglong ulong_t
+ctypedef npy_ulonglong ulonglong_t
+
+ctypedef npy_intp intp_t
+ctypedef npy_uintp uintp_t
+
+ctypedef npy_double float_t
+ctypedef npy_double double_t
+ctypedef npy_longdouble longdouble_t
+
+ctypedef npy_cfloat cfloat_t
+ctypedef npy_cdouble cdouble_t
+ctypedef npy_clongdouble clongdouble_t
+
+ctypedef npy_cdouble complex_t
+
+cdef inline object PyArray_MultiIterNew1(a):
+ return PyArray_MultiIterNew(1, a)
+
+cdef inline object PyArray_MultiIterNew2(a, b):
+ return PyArray_MultiIterNew(2, a, b)
+
+cdef inline object PyArray_MultiIterNew3(a, b, c):
+ return PyArray_MultiIterNew(3, a, b, c)
+
+cdef inline object PyArray_MultiIterNew4(a, b, c, d):
+ return PyArray_MultiIterNew(4, a, b, c, d)
+
+cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
+ return PyArray_MultiIterNew(5, a, b, c, d, e)
+
+cdef inline tuple PyDataType_SHAPE(dtype d):
+ if PyDataType_HASSUBARRAY(d):
+ return d.subarray.shape
+ else:
+ return ()
+
+
+cdef extern from "numpy/ndarrayobject.h":
+ PyTypeObject PyTimedeltaArrType_Type
+ PyTypeObject PyDatetimeArrType_Type
+ ctypedef int64_t npy_timedelta
+ ctypedef int64_t npy_datetime
+
+cdef extern from "numpy/ndarraytypes.h":
+ ctypedef struct PyArray_DatetimeMetaData:
+ NPY_DATETIMEUNIT base
+ int64_t num
+
+cdef extern from "numpy/arrayscalars.h":
+
+ # abstract types
+ ctypedef class numpy.generic [object PyObject]:
+ pass
+ ctypedef class numpy.number [object PyObject]:
+ pass
+ ctypedef class numpy.integer [object PyObject]:
+ pass
+ ctypedef class numpy.signedinteger [object PyObject]:
+ pass
+ ctypedef class numpy.unsignedinteger [object PyObject]:
+ pass
+ ctypedef class numpy.inexact [object PyObject]:
+ pass
+ ctypedef class numpy.floating [object PyObject]:
+ pass
+ ctypedef class numpy.complexfloating [object PyObject]:
+ pass
+ ctypedef class numpy.flexible [object PyObject]:
+ pass
+ ctypedef class numpy.character [object PyObject]:
+ pass
+
+ ctypedef struct PyDatetimeScalarObject:
+ # PyObject_HEAD
+ npy_datetime obval
+ PyArray_DatetimeMetaData obmeta
+
+ ctypedef struct PyTimedeltaScalarObject:
+ # PyObject_HEAD
+ npy_timedelta obval
+ PyArray_DatetimeMetaData obmeta
+
+ ctypedef enum NPY_DATETIMEUNIT:
+ NPY_FR_Y
+ NPY_FR_M
+ NPY_FR_W
+ NPY_FR_D
+ NPY_FR_B
+ NPY_FR_h
+ NPY_FR_m
+ NPY_FR_s
+ NPY_FR_ms
+ NPY_FR_us
+ NPY_FR_ns
+ NPY_FR_ps
+ NPY_FR_fs
+ NPY_FR_as
+
+
+#
+# ufunc API
+#
+
+cdef extern from "numpy/ufuncobject.h":
+
+ ctypedef void (*PyUFuncGenericFunction) (char **, npy_intp *, npy_intp *, void *)
+
+ ctypedef class numpy.ufunc [object PyUFuncObject, check_size ignore]:
+ cdef:
+ int nin, nout, nargs
+ int identity
+ PyUFuncGenericFunction *functions
+ void **data
+ int ntypes
+ int check_return
+ char *name
+ char *types
+ char *doc
+ void *ptr
+ PyObject *obj
+ PyObject *userloops
+
+ cdef enum:
+ PyUFunc_Zero
+ PyUFunc_One
+ PyUFunc_None
+ UFUNC_ERR_IGNORE
+ UFUNC_ERR_WARN
+ UFUNC_ERR_RAISE
+ UFUNC_ERR_CALL
+ UFUNC_ERR_PRINT
+ UFUNC_ERR_LOG
+ UFUNC_MASK_DIVIDEBYZERO
+ UFUNC_MASK_OVERFLOW
+ UFUNC_MASK_UNDERFLOW
+ UFUNC_MASK_INVALID
+ UFUNC_SHIFT_DIVIDEBYZERO
+ UFUNC_SHIFT_OVERFLOW
+ UFUNC_SHIFT_UNDERFLOW
+ UFUNC_SHIFT_INVALID
+ UFUNC_FPE_DIVIDEBYZERO
+ UFUNC_FPE_OVERFLOW
+ UFUNC_FPE_UNDERFLOW
+ UFUNC_FPE_INVALID
+ UFUNC_ERR_DEFAULT
+ UFUNC_ERR_DEFAULT2
+
+ object PyUFunc_FromFuncAndData(PyUFuncGenericFunction *,
+ void **, char *, int, int, int, int, char *, char *, int)
+ int PyUFunc_RegisterLoopForType(ufunc, int,
+ PyUFuncGenericFunction, int *, void *)
+ int PyUFunc_GenericFunction \
+ (ufunc, PyObject *, PyObject *, PyArrayObject **)
+ void PyUFunc_f_f_As_d_d \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_d_d \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_f_f \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_g_g \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_F_F_As_D_D \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_F_F \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_D_D \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_G_G \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_O_O \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_ff_f_As_dd_d \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_ff_f \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_dd_d \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_gg_g \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_FF_F_As_DD_D \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_DD_D \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_FF_F \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_GG_G \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_OO_O \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_O_O_method \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_OO_O_method \
+ (char **, npy_intp *, npy_intp *, void *)
+ void PyUFunc_On_Om \
+ (char **, npy_intp *, npy_intp *, void *)
+ int PyUFunc_GetPyValues \
+ (char *, int *, int *, PyObject **)
+ int PyUFunc_checkfperr \
+ (int, PyObject *, int *)
+ void PyUFunc_clearfperr()
+ int PyUFunc_getfperr()
+ int PyUFunc_handlefperr \
+ (int, PyObject *, int, int *)
+ int PyUFunc_ReplaceLoopBySignature \
+ (ufunc, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *)
+ object PyUFunc_FromFuncAndDataAndSignature \
+ (PyUFuncGenericFunction *, void **, char *, int, int, int,
+ int, char *, char *, int, char *)
+
+ int _import_umath() except -1
+
+cdef inline void set_array_base(ndarray arr, object base):
+ Py_INCREF(base) # important to do this before stealing the reference below!
+ PyArray_SetBaseObject(arr, base)
+
+cdef inline object get_array_base(ndarray arr):
+ base = PyArray_BASE(arr)
+ if base is NULL:
+ return None
+ return base
+
+# Versions of the import_* functions which are more suitable for
+# Cython code.
+cdef inline int import_array() except -1:
+ try:
+ __pyx_import_array()
+ except Exception:
+ raise ImportError("numpy.core.multiarray failed to import")
+
+cdef inline int import_umath() except -1:
+ try:
+ _import_umath()
+ except Exception:
+ raise ImportError("numpy.core.umath failed to import")
+
+cdef inline int import_ufunc() except -1:
+ try:
+ _import_umath()
+ except Exception:
+ raise ImportError("numpy.core.umath failed to import")
+
+cdef extern from *:
+ # Leave a marker that the NumPy declarations came from this file
+ # See https://github.com/cython/cython/issues/3573
+ """
+ /* NumPy API declarations from "numpy/__init__.pxd" */
+ """
+
+
+cdef inline bint is_timedelta64_object(object obj):
+ """
+ Cython equivalent of `isinstance(obj, np.timedelta64)`
+
+ Parameters
+ ----------
+ obj : object
+
+ Returns
+ -------
+ bool
+ """
+ return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)
+
+
+cdef inline bint is_datetime64_object(object obj):
+ """
+ Cython equivalent of `isinstance(obj, np.datetime64)`
+
+ Parameters
+ ----------
+ obj : object
+
+ Returns
+ -------
+ bool
+ """
+ return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)
+
+
+cdef inline npy_datetime get_datetime64_value(object obj) nogil:
+ """
+ returns the int64 value underlying scalar numpy datetime64 object
+
+ Note that to interpret this as a datetime, the corresponding unit is
+ also needed. That can be found using `get_datetime64_unit`.
+ """
+ return (obj).obval
+
+
+cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:
+ """
+ returns the int64 value underlying scalar numpy timedelta64 object
+ """
+ return (obj).obval
+
+
+cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:
+ """
+ returns the unit part of the dtype for a numpy datetime64 object.
+ """
+ return (obj).obmeta.base
diff --git a/venv/Lib/site-packages/numpy/__init__.py b/venv/Lib/site-packages/numpy/__init__.py
new file mode 100644
index 0000000..6021e6d
--- /dev/null
+++ b/venv/Lib/site-packages/numpy/__init__.py
@@ -0,0 +1,410 @@
+"""
+NumPy
+=====
+
+Provides
+ 1. An array object of arbitrary homogeneous items
+ 2. Fast mathematical operations over arrays
+ 3. Linear Algebra, Fourier Transforms, Random Number Generation
+
+How to use the documentation
+----------------------------
+Documentation is available in two forms: docstrings provided
+with the code, and a loose standing reference guide, available from
+`the NumPy homepage `_.
+
+We recommend exploring the docstrings using
+`IPython `_, an advanced Python shell with
+TAB-completion and introspection capabilities. See below for further
+instructions.
+
+The docstring examples assume that `numpy` has been imported as `np`::
+
+ >>> import numpy as np
+
+Code snippets are indicated by three greater-than signs::
+
+ >>> x = 42
+ >>> x = x + 1
+
+Use the built-in ``help`` function to view a function's docstring::
+
+ >>> help(np.sort)
+ ... # doctest: +SKIP
+
+For some objects, ``np.info(obj)`` may provide additional help. This is
+particularly true if you see the line "Help on ufunc object:" at the top
+of the help() page. Ufuncs are implemented in C, not Python, for speed.
+The native Python help() does not know how to view their help, but our
+np.info() function does.
+
+To search for documents containing a keyword, do::
+
+ >>> np.lookfor('keyword')
+ ... # doctest: +SKIP
+
+General-purpose documents like a glossary and help on the basic concepts
+of numpy are available under the ``doc`` sub-module::
+
+ >>> from numpy import doc
+ >>> help(doc)
+ ... # doctest: +SKIP
+
+Available subpackages
+---------------------
+doc
+ Topical documentation on broadcasting, indexing, etc.
+lib
+ Basic functions used by several sub-packages.
+random
+ Core Random Tools
+linalg
+ Core Linear Algebra Tools
+fft
+ Core FFT routines
+polynomial
+ Polynomial tools
+testing
+ NumPy testing tools
+f2py
+ Fortran to Python Interface Generator.
+distutils
+ Enhancements to distutils with support for
+ Fortran compilers support and more.
+
+Utilities
+---------
+test
+ Run numpy unittests
+show_config
+ Show numpy build configuration
+dual
+ Overwrite certain functions with high-performance SciPy tools.
+ Note: `numpy.dual` is deprecated. Use the functions from NumPy or Scipy
+ directly instead of importing them from `numpy.dual`.
+matlib
+ Make everything matrices.
+__version__
+ NumPy version string
+
+Viewing documentation using IPython
+-----------------------------------
+Start IPython with the NumPy profile (``ipython -p numpy``), which will
+import `numpy` under the alias `np`. Then, use the ``cpaste`` command to
+paste examples into the shell. To see which functions are available in
+`numpy`, type ``np.`` (where ```` refers to the TAB key), or use
+``np.*cos*?`` (where ``